graview 0.1.63 → 0.1.65
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.2P34ML3O.js +111 -0
- package/dist/preview/{chunk.A2R53GWF.js → chunk.2PK335JQ.js} +1 -1
- package/dist/preview/{chunk.NIAM7OTV.js → chunk.2QQ37RCZ.js} +1 -1
- package/dist/preview/{chunk.FGDGTES4.js → chunk.2TZSLREX.js} +2 -2
- package/dist/preview/chunk.2UW5CRHF.js +1 -0
- package/dist/preview/{chunk.H7AH3IW4.js → chunk.2YMO7ZVX.js} +1 -1
- package/dist/preview/chunk.33ULA3CG.js +1 -0
- package/dist/preview/{chunk.HMMK7LCL.js → chunk.35E75QJ7.js} +1 -1
- package/dist/preview/chunk.3CJLAJXP.js +25 -0
- package/dist/preview/chunk.3IJSB5ET.js +1 -0
- package/dist/preview/{chunk.OM2NIQWA.js → chunk.3IZEZPJB.js} +1 -1
- package/dist/preview/chunk.3KO35VN4.js +1 -0
- package/dist/preview/{chunk.Q2EGESEZ.js → chunk.3KUYB5ZT.js} +1 -1
- package/dist/preview/chunk.3RFAUIGT.js +1 -0
- package/dist/preview/{chunk.Q4GJIJAU.js → chunk.3WP66LB5.js} +1 -1
- package/dist/preview/{chunk.2RASWDMQ.js → chunk.44ZHHPPJ.js} +2 -2
- package/dist/preview/chunk.4GJ7F4SP.js +35 -0
- package/dist/preview/{chunk.4MEQUUG4.js → chunk.4IJTPV5X.js} +1 -1
- package/dist/preview/{chunk.DWK3GXRR.js → chunk.4JFBLVXJ.js} +1 -1
- package/dist/preview/{chunk.XUXZW7DU.js → chunk.4O3C2LJF.js} +1 -1
- package/dist/preview/chunk.4PCVQEVI.js +1 -0
- package/dist/preview/{chunk.WBS7ND2C.js → chunk.5FQSYMAE.js} +1 -1
- package/dist/preview/chunk.5M34BJIQ.js +1 -0
- package/dist/preview/chunk.5NCLZ4NZ.js +1 -0
- package/dist/preview/{chunk.36OE6RKG.js → chunk.5THLLSS4.js} +1 -1
- package/dist/preview/chunk.5YNLFOBJ.js +5 -0
- package/dist/preview/{chunk.DZSZUX34.js → chunk.64FCAUAJ.js} +1 -1
- package/dist/preview/chunk.6RZHKQP3.js +1 -0
- package/dist/preview/chunk.6YDC6IDA.js +1 -0
- package/dist/preview/{chunk.BN7C5ZYX.js → chunk.74B6KQF4.js} +1 -1
- package/dist/preview/chunk.77XQEDT5.js +1 -0
- package/dist/preview/chunk.7E4CSXBT.js +1 -0
- package/dist/preview/chunk.7HPQI5SY.js +1 -0
- package/dist/preview/{chunk.Y4ZM75WL.js → chunk.7IGD2K4M.js} +1 -1
- package/dist/preview/{chunk.2F4AZZQR.js → chunk.7Q43N5JS.js} +1 -1
- package/dist/preview/{chunk.KB5BCW23.js → chunk.7VQ3C7F4.js} +1 -1
- package/dist/preview/{chunk.MT5DXJKN.js → chunk.A4VA3DU5.js} +1 -1
- package/dist/preview/{chunk.6Z2GHQQH.js → chunk.AB4RZSYW.js} +31 -23
- package/dist/preview/chunk.ABSY3UZF.js +1 -0
- package/dist/preview/chunk.ARHAD5IS.js +1 -0
- package/dist/preview/chunk.BOC2EOGB.js +9 -0
- package/dist/preview/chunk.BR6TINGU.js +1 -0
- package/dist/preview/{chunk.B5PJCYBU.js → chunk.BU5PVRX7.js} +1 -1
- package/dist/preview/{chunk.PDMX3GTL.js → chunk.BUQKRXI6.js} +1 -1
- package/dist/preview/{chunk.RUFYORIJ.js → chunk.C437FVD7.js} +1 -1
- package/dist/preview/chunk.CD6YWH6T.js +3 -0
- package/dist/preview/chunk.CDEAAWPS.js +1 -0
- package/dist/preview/{chunk.XUO67YMT.js → chunk.CGQ6KXVK.js} +1 -1
- package/dist/preview/{chunk.WYPCLZL7.js → chunk.CPYBJNHP.js} +1 -1
- package/dist/preview/{chunk.FXCQJPN4.js → chunk.CS72MISN.js} +2 -2
- package/dist/preview/chunk.CXJJB3MK.js +1 -0
- package/dist/preview/{chunk.CAXILB7K.js → chunk.CXLQPE4J.js} +1 -1
- package/dist/preview/{chunk.REUMBCSV.js → chunk.DA4RSHLW.js} +1 -1
- package/dist/preview/{chunk.YXAKHXYB.js → chunk.DICM56FT.js} +1 -1
- package/dist/preview/{chunk.ZSGDVNVN.js → chunk.DJMSXXP4.js} +1 -1
- package/dist/preview/{chunk.ZY7US4Y7.js → chunk.DJPNVXBQ.js} +1 -1
- package/dist/preview/chunk.DJVHKBEI.js +1 -0
- package/dist/preview/chunk.E5WJSTOV.js +1 -0
- package/dist/preview/{chunk.KPQLM4TM.js → chunk.F2TWV4TX.js} +1 -1
- package/dist/preview/chunk.F5VEHAP2.js +1 -0
- package/dist/preview/{chunk.GHN62OMG.js → chunk.FDWRH5P2.js} +1 -1
- package/dist/preview/chunk.FEGSYSA7.js +1 -0
- package/dist/preview/{chunk.T3JIZNE7.js → chunk.FHHVW2WB.js} +1 -1
- package/dist/preview/chunk.FOSY7MZF.js +2 -0
- package/dist/preview/{chunk.ZZAI57VI.js → chunk.FXG5AJF6.js} +1 -1
- package/dist/preview/{chunk.K7TK3KRB.js → chunk.G3Q5IMM3.js} +1 -1
- package/dist/preview/{chunk.KXFNRJ46.js → chunk.GPCKOYSF.js} +1 -1
- package/dist/preview/{chunk.YOUB3J3Y.js → chunk.HJS3LTSR.js} +1 -1
- package/dist/preview/chunk.HJUXC5GM.js +1 -0
- package/dist/preview/chunk.HNMSYQRA.js +1 -0
- package/dist/preview/chunk.HWLRKOI3.js +1 -0
- package/dist/preview/{chunk.BQM3YAMR.js → chunk.IFBGYFS4.js} +1 -1
- package/dist/preview/chunk.IHUMKFYH.js +10 -0
- package/dist/preview/{chunk.AW26EETU.js → chunk.IJ3YDBWI.js} +1 -1
- package/dist/preview/{chunk.SMHP2CQH.js → chunk.IMKD6QQG.js} +1 -1
- package/dist/preview/{chunk.75GENXGP.js → chunk.INTJD5WG.js} +1 -1
- package/dist/preview/chunk.IQ54QTA5.js +1 -0
- package/dist/preview/{chunk.MIE3ODQ2.js → chunk.IQC3GOXO.js} +1 -1
- package/dist/preview/{chunk.2PJ6STKA.js → chunk.IR4OW67N.js} +1 -1
- package/dist/preview/{chunk.72YXFJKC.js → chunk.ISN2QTVL.js} +1 -1
- package/dist/preview/{chunk.Q4MI53KK.js → chunk.J24YPQ5I.js} +5 -5
- package/dist/preview/chunk.J545NAMY.js +1 -0
- package/dist/preview/{chunk.57YDGGJK.js → chunk.J6KNEI5R.js} +1 -1
- package/dist/preview/chunk.K3JARAWU.js +1 -0
- package/dist/preview/{chunk.MY5HJW2Z.js → chunk.KHAVEYT7.js} +1 -1
- package/dist/preview/{chunk.STDJ6XG5.js → chunk.KIQXTQDU.js} +1 -1
- package/dist/preview/chunk.KROR65KD.js +2 -0
- package/dist/preview/chunk.KV7GZBJ6.js +50 -0
- package/dist/preview/{chunk.CGK2PY76.js → chunk.L6FGKJ5H.js} +1 -1
- package/dist/preview/chunk.L7NJLZWV.js +1 -0
- package/dist/preview/{chunk.HOFATBGD.js → chunk.LGRQDILY.js} +1 -1
- package/dist/preview/{chunk.IEDCFSN5.js → chunk.LKK5YF2H.js} +1 -1
- package/dist/preview/chunk.LON75VHP.js +1 -0
- package/dist/preview/chunk.LQWVJQ5X.js +18 -0
- package/dist/preview/{chunk.PDS4HT46.js → chunk.LVD3V77M.js} +1 -1
- package/dist/preview/{chunk.JIEDJEHK.js → chunk.LY5CY7GE.js} +1 -1
- package/dist/preview/{chunk.OXWOUE3W.js → chunk.M5W2RHC6.js} +1 -1
- package/dist/preview/chunk.M6BTLH24.js +1 -0
- package/dist/preview/chunk.MAGKI4PD.js +1 -0
- package/dist/preview/chunk.MD36ZSM5.js +74 -0
- package/dist/preview/chunk.MFZJVHWP.js +1 -0
- package/dist/preview/{chunk.VCTAFSZ5.js → chunk.MH46V556.js} +1 -1
- package/dist/preview/chunk.MHTA4HYB.js +19 -0
- package/dist/preview/{chunk.QSPLKCTX.js → chunk.N2FNHRI2.js} +1 -1
- package/dist/preview/chunk.N2YM247R.js +1 -0
- package/dist/preview/chunk.N35SJWAM.js +1 -0
- package/dist/preview/chunk.NBVPWLRY.js +3 -0
- package/dist/preview/{chunk.NEPQBMFT.js → chunk.NKYYDFIX.js} +1 -1
- package/dist/preview/chunk.NSO6RUKW.js +1 -0
- package/dist/preview/{chunk.OIMGD7FR.js → chunk.O2W5JTWA.js} +1 -1
- package/dist/preview/chunk.OHMHPTEW.js +1 -0
- package/dist/preview/{chunk.XBYJCGPU.js → chunk.P6TZGR3A.js} +1 -1
- package/dist/preview/{chunk.KQPKYWDM.js → chunk.PTQPS2FJ.js} +1 -1
- package/dist/preview/chunk.PV2I4UPH.js +1 -0
- package/dist/preview/chunk.QFQSSZN7.js +1 -0
- package/dist/preview/{chunk.OTSBF367.js → chunk.QO5RXOCS.js} +2 -2
- package/dist/preview/{chunk.VZDHRY3U.js → chunk.QSDBF7VL.js} +1 -1
- package/dist/preview/{chunk.V4HVFLFQ.js → chunk.R2TSTDS3.js} +1 -1
- package/dist/preview/{chunk.34DRUCH2.js → chunk.RFVOXX3P.js} +1 -1
- package/dist/preview/chunk.RSS6OHXG.js +1 -0
- package/dist/preview/{chunk.XYGNS637.js → chunk.S2DOVJRL.js} +1 -1
- package/dist/preview/chunk.S3EEY7T3.js +1 -0
- package/dist/preview/chunk.SBCAYTMT.js +1 -0
- package/dist/preview/chunk.SMTGRCMG.js +3 -0
- package/dist/preview/{chunk.NTC2H5ZX.js → chunk.SOMRYDDH.js} +1 -1
- package/dist/preview/{chunk.4EXC26LI.js → chunk.SPCAMQJE.js} +1 -1
- package/dist/preview/{chunk.SGPXYDSG.js → chunk.T3KNLP7C.js} +1 -1
- package/dist/preview/chunk.TBY5IR7C.js +1 -0
- package/dist/preview/chunk.TCZIZ2PU.js +1 -0
- package/dist/preview/{chunk.PWAP2GJS.js → chunk.TUCSUZNO.js} +1 -1
- package/dist/preview/{chunk.DIFIHNR3.js → chunk.TY74U3EI.js} +1 -1
- package/dist/preview/chunk.U74PTRHJ.js +1 -0
- package/dist/preview/chunk.UAORKZLO.js +1 -0
- package/dist/preview/chunk.UDVTPI2W.js +1 -0
- package/dist/preview/{chunk.OMRQTLI5.js → chunk.UETLP5KC.js} +1 -1
- package/dist/preview/chunk.UHI3X2YD.js +1 -0
- package/dist/preview/chunk.UL62ELNR.js +1 -0
- package/dist/preview/chunk.VRYSZYAD.js +1 -0
- package/dist/preview/{chunk.CI4RZL4Z.js → chunk.VUZFLDOX.js} +1 -1
- package/dist/preview/chunk.X2NGFOAF.js +1 -0
- package/dist/preview/chunk.XE762VL2.js +2 -0
- package/dist/preview/{chunk.QS32TO4N.js → chunk.XSWR5LI4.js} +1 -1
- package/dist/preview/{chunk.JVDPRQ7J.js → chunk.XTTESA7X.js} +1 -1
- package/dist/preview/chunk.Y2RZ5B4U.js +1 -0
- package/dist/preview/chunk.Y7QDQ3WF.js +1 -0
- package/dist/preview/{chunk.O3YIWIVQ.js → chunk.YKMBXMZE.js} +1 -1
- package/dist/preview/chunk.Z34KASY7.js +1 -0
- package/dist/preview/{chunk.XCWZFLIB.js → chunk.ZDUTEM3Z.js} +1 -1
- package/dist/preview/{chunk.EJ4MSVX2.js → chunk.ZJFXM3LE.js} +1 -1
- package/dist/preview/chunk.ZMGKWMID.js +1 -0
- package/dist/preview/{chunk.AHPYNDVA.js → chunk.ZMWAZACO.js} +1 -1
- package/dist/preview/chunk.ZT5YQSSP.js +21 -0
- package/dist/preview/{chunk.B46UZHGW.js → chunk.ZTN7BS5O.js} +1 -1
- package/dist/preview/{chunk.HRNNRA2I.js → chunk.ZYNC73DJ.js} +1 -1
- package/dist/preview/chunk.ZZM75ZTN.js +4 -0
- package/dist/preview/index.html +56 -56
- package/dist/preview/page.js +2 -2
- package/dist/preview/splash.js +3 -3
- package/package.json +6 -6
- package/dist/preview/chunk.24HNOLUS.js +0 -3
- package/dist/preview/chunk.25CQCCLN.js +0 -1
- package/dist/preview/chunk.26H33GJC.js +0 -50
- package/dist/preview/chunk.2KIWGQXC.js +0 -2
- package/dist/preview/chunk.33XNYHI6.js +0 -1
- package/dist/preview/chunk.37FLKAVZ.js +0 -1
- package/dist/preview/chunk.3JCHJLH6.js +0 -1
- package/dist/preview/chunk.3OQ6S6H4.js +0 -1
- package/dist/preview/chunk.47QEWSSE.js +0 -1
- package/dist/preview/chunk.4DAKQXDG.js +0 -1
- package/dist/preview/chunk.4TH3CGAZ.js +0 -1
- package/dist/preview/chunk.5GC4VAHU.js +0 -1
- package/dist/preview/chunk.5QXQ7PBI.js +0 -35
- package/dist/preview/chunk.6CSHRMJC.js +0 -1
- package/dist/preview/chunk.6HKWAHPT.js +0 -1
- package/dist/preview/chunk.6XHPBJ5F.js +0 -1
- package/dist/preview/chunk.6YK5E7ZQ.js +0 -4
- package/dist/preview/chunk.735AFUP5.js +0 -1
- package/dist/preview/chunk.ATDIDPKZ.js +0 -1
- package/dist/preview/chunk.AWUO3M5D.js +0 -1
- package/dist/preview/chunk.BF3EZCG3.js +0 -1
- package/dist/preview/chunk.BKQICGFW.js +0 -1
- package/dist/preview/chunk.C65EHQ7V.js +0 -1
- package/dist/preview/chunk.CCQMDZHO.js +0 -1
- package/dist/preview/chunk.CYTTZOYL.js +0 -25
- package/dist/preview/chunk.D5LOTCBU.js +0 -3
- package/dist/preview/chunk.DBFJVVWF.js +0 -1
- package/dist/preview/chunk.DDFRFSVN.js +0 -1
- package/dist/preview/chunk.E3XJMO7Q.js +0 -1
- package/dist/preview/chunk.EJ2WE764.js +0 -18
- package/dist/preview/chunk.ERPILTRY.js +0 -1
- package/dist/preview/chunk.FFXBDOKA.js +0 -1
- package/dist/preview/chunk.FNVGNISQ.js +0 -3
- package/dist/preview/chunk.G2JAYG2Z.js +0 -1
- package/dist/preview/chunk.H5SN46VK.js +0 -1
- package/dist/preview/chunk.HSMJHCR3.js +0 -1
- package/dist/preview/chunk.JNIDS66Z.js +0 -1
- package/dist/preview/chunk.JO3BBRSR.js +0 -1
- package/dist/preview/chunk.KL5H7KEV.js +0 -1
- package/dist/preview/chunk.KZUMXT5J.js +0 -74
- package/dist/preview/chunk.MAHNJO6U.js +0 -1
- package/dist/preview/chunk.MBB5A6BT.js +0 -1
- package/dist/preview/chunk.MENLUNM5.js +0 -1
- package/dist/preview/chunk.N3T2O6EW.js +0 -9
- package/dist/preview/chunk.NWWJNNEK.js +0 -2
- package/dist/preview/chunk.O67JXUVG.js +0 -1
- package/dist/preview/chunk.QAMW5QDT.js +0 -19
- package/dist/preview/chunk.R4HDKNT3.js +0 -88
- package/dist/preview/chunk.SJUXFPTI.js +0 -1
- package/dist/preview/chunk.SME4HD5I.js +0 -1
- package/dist/preview/chunk.SSAETRHR.js +0 -5
- package/dist/preview/chunk.T535ZLRM.js +0 -1
- package/dist/preview/chunk.UAVK54Z6.js +0 -1
- package/dist/preview/chunk.V6IL7CIZ.js +0 -1
- package/dist/preview/chunk.WNS5LEO5.js +0 -1
- package/dist/preview/chunk.WUVXIUA7.js +0 -1
- package/dist/preview/chunk.XCEZCOX4.js +0 -1
- package/dist/preview/chunk.XIW4SZHD.js +0 -1
- package/dist/preview/chunk.YZBJUAS6.js +0 -1
- package/dist/preview/chunk.Z2ZQJ3DD.js +0 -1
- package/dist/preview/chunk.ZELWW7UA.js +0 -21
- package/dist/preview/chunk.ZLTHWCKL.js +0 -2
- package/dist/preview/chunk.ZP7JEVVU.js +0 -1
- package/dist/preview/chunk.ZRH5X3MR.js +0 -1
- package/dist/preview/chunk.ZVG4FXJK.js +0 -1
- /package/dist/preview/{chunk.GZHZLJBF.js → chunk.MIE4TJRW.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as oe}from"./chunk.QSDBF7VL.js";import{p as Te,q as ne,t as W,u as xe,y as De}from"./chunk.CXJJB3MK.js";import{m as Z,n as be,o as Ae,p as ee,q as te}from"./chunk.OJGHDWI6.js";import{b as Ee}from"./chunk.NBVPWLRY.js";import{b as Se,d as J,e as X,g as Me,q as Ie}from"./chunk.MD36ZSM5.js";import{b as ge}from"./chunk.L6FGKJ5H.js";import{D as R,F as j,G as C,Ia as we,J as ve,Ja as ke,Ka as T,Oa as V,Q as ye,Qa as $,V as S,da as M,ea as F,fa as _,m as me,v as fe,z as he}from"./chunk.3CJLAJXP.js";import{a as E}from"./chunk.SDO3U72B.js";import{Pd as pe,nd as ue,pa as q,sd as de}from"./chunk.J24YPQ5I.js";import{b as h}from"./chunk.AJZBJBMO.js";var D=h(C(),1),I=h(S(),1),re=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.CPYBJNHP.js")))),Ne=re.part(e=>(0,I.jsx)(e.HoverChipDoor,{}),{quiet:!0}),Re="A",Q=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.KHRS2SKB.js","./chunk.T6PU3NKP.js","./chunk.LON75VHP.js","./chunk.7VQ3C7F4.js","./chunk.ZZM75ZTN.js","./chunk.ISN2QTVL.js","./chunk.2PK335JQ.js","./chunk.3KUYB5ZT.js","./chunk.IMKD6QQG.js","./chunk.HJCQ6I3S.js","./chunk.ZJFXM3LE.js","./chunk.PTQPS2FJ.js","./chunk.UETLP5KC.js","./chunk.IQC3GOXO.js","./chunk.NKYYDFIX.js","./chunk.6RZHKQP3.js","./chunk.L7NJLZWV.js","./chunk.TBY5IR7C.js","./chunk.XSWR5LI4.js","./chunk.BIDL7GQD.js","./chunk.XTTESA7X.js","./chunk.J6KNEI5R.js","./chunk.2YMO7ZVX.js","./chunk.MH46V556.js","./chunk.XOZU4OFA.js","./chunk.5M34BJIQ.js","./chunk.Q5WEOX3Q.js","./chunk.UHI3X2YD.js","./chunk.INTJD5WG.js","./chunk.YFVJUHAK.js","./chunk.2QQ37RCZ.js","./chunk.CXJJB3MK.js","./chunk.OJGHDWI6.js","./chunk.74B6KQF4.js","./chunk.S2DOVJRL.js","./chunk.64FCAUAJ.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.SPCAMQJE.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.MD36ZSM5.js","./chunk.L6FGKJ5H.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.XE762VL2.js"))));var We=Q.part((e,t)=>(0,I.jsx)(e.InspectorPane,{...t}),{what:"This card's acts"});function Ge(e){let t=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&e()},n=globalThis;if(n.requestIdleCallback){let a=n.requestIdleCallback(t,{timeout:5e3});return()=>n.cancelIdleCallback?.(a)}let r=setTimeout(t,2500);return()=>clearTimeout(r)}var He=150,Be="[data-graview-pick], [data-graview-view], [data-graview-record], [data-graview-act], [data-graview-field], a[href]";function ze(e){if(e.closest("[data-graview-face='pages'], [data-graview-popover]"))return null;let t=e.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??e.closest("[data-graview-view]")?.getAttribute("data-graview-view");return t?{face:"scene",on:t,about:[t]}:null}function qe(e){let{store:t,principal:n,providers:r,ai:a}=M(),p=xe(),v=j(a),i=(0,D.useRef)({aimAt:e,store:t,principal:n,providers:r,prepareSections:p,chipsOn:v});i.current={aimAt:e,store:t,principal:n,providers:r,prepareSections:p,chipsOn:v},(0,D.useEffect)(()=>{if(typeof document>"u")return;let u=null,w=null,k=null,l=g=>{let m=i.current,A=m.chipsOn?m.aimAt(g):null;A&&(k=g,re.load().then(z=>{k===g&&z.restOn(A,g)},()=>{}))},f=()=>{u&&clearTimeout(u.timer),u=null},c=g=>{let m=i.current,A=m.aimAt(g);if(!A)return;let z=JSON.stringify([A.face,A.on,A.about,A.field,A.place,A.act,m.store.log.length]);z!==w&&(w=z,m.prepareSections(A),Q.load().then(Oe=>Oe.prepareActs(m.store,A,{principal:m.principal,providers:m.providers}),()=>{}))},o=g=>g.target instanceof Element?g.target.closest(Be):null,d=g=>{if(g.pointerType==="touch")return;let m=o(g);m!==null&&m===u?.element||(f(),m!==null&&(u={element:m,timer:setTimeout(()=>{u=null,c(m),l(m)},He)}))},y=g=>{let m=g.relatedTarget;k!==null&&!(m instanceof Node&&k.contains(m))&&(k=null,re.current?.leaveRest()),u!==null&&(m instanceof Node&&u.element.contains(m)||f())},b=g=>{if(g.pointerType==="mouse")return;let m=o(g);m&&c(m)},x=g=>{if(!we())return;let m=o(g);m&&c(m)};return document.addEventListener("pointerover",d,{passive:!0}),document.addEventListener("pointerout",y,{passive:!0}),document.addEventListener("pointerdown",b,{capture:!0,passive:!0}),document.addEventListener("focusin",x),()=>{f(),document.removeEventListener("pointerover",d),document.removeEventListener("pointerout",y),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("focusin",x)}},[])}function ft({placement:e="float",openActs:t,aimAt:n}={}){let{menuAt:r,setMenuAt:a,registerActsDoor:p,ai:v}=M(),{selection:i}=V();qe(n??ze),(0,D.useEffect)(()=>{if(Q.current)return;let f=()=>{y(),Q.prefetch()},c=()=>{},o=ke(()=>void(c=Ge(f))),d=["pointerdown","keydown"];for(let b of d)document.addEventListener(b,f,{capture:!0,passive:!0});function y(){o(),c();for(let b of d)document.removeEventListener(b,f,{capture:!0})}return y},[]),(0,D.useEffect)(()=>{if(e==="menu")return p({key:Re,open:t??(f=>{let c=f.getBoundingClientRect(),o=f.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??f.closest("[data-graview-view]")?.getAttribute("data-graview-view")??void 0;a({x:Math.round(c.left+Math.min(16,c.width/2)),y:Math.round(Math.min(c.bottom,c.top+36)),...o?{on:o}:{}})})}),()=>p(null)},[e,p,a,t]);let u=r!==null||i.length>0&&t===void 0,[w,k]=(0,D.useState)(u);(0,D.useEffect)(()=>{u&&k(!0)},[u]);let l=j(v)?(0,I.jsx)(D.Suspense,{fallback:null,children:(0,I.jsx)(Ne,{})}):null;return!w&&!u?l:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(D.Suspense,{fallback:null,children:(0,I.jsx)(We,{placement:e,chosen:t===void 0})}),l]})}var Y=h(C(),1),K=h(S(),1),Fe=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.25VJPUDH.js","./chunk.KHRS2SKB.js","./chunk.T6PU3NKP.js","./chunk.LON75VHP.js","./chunk.7VQ3C7F4.js","./chunk.N2FNHRI2.js","./chunk.FDWRH5P2.js","./chunk.44ZHHPPJ.js","./chunk.ZDUTEM3Z.js","./chunk.ZZM75ZTN.js","./chunk.ISN2QTVL.js","./chunk.ARHAD5IS.js","./chunk.R2TSTDS3.js","./chunk.QSDBF7VL.js","./chunk.2PK335JQ.js","./chunk.MHTA4HYB.js","./chunk.BU5PVRX7.js","./chunk.3KUYB5ZT.js","./chunk.IMKD6QQG.js","./chunk.HJCQ6I3S.js","./chunk.ZJFXM3LE.js","./chunk.PTQPS2FJ.js","./chunk.UETLP5KC.js","./chunk.IQC3GOXO.js","./chunk.NKYYDFIX.js","./chunk.IR4OW67N.js","./chunk.6RZHKQP3.js","./chunk.N35SJWAM.js","./chunk.L7NJLZWV.js","./chunk.QO5RXOCS.js","./chunk.TBY5IR7C.js","./chunk.XSWR5LI4.js","./chunk.BIDL7GQD.js","./chunk.XTTESA7X.js","./chunk.J6KNEI5R.js","./chunk.2YMO7ZVX.js","./chunk.MH46V556.js","./chunk.XOZU4OFA.js","./chunk.5M34BJIQ.js","./chunk.Q5WEOX3Q.js","./chunk.UHI3X2YD.js","./chunk.INTJD5WG.js","./chunk.YFVJUHAK.js","./chunk.2QQ37RCZ.js","./chunk.MIE4TJRW.js","./chunk.CXJJB3MK.js","./chunk.OJGHDWI6.js","./chunk.74B6KQF4.js","./chunk.WVUJXDXZ.js","./chunk.S2DOVJRL.js","./chunk.64FCAUAJ.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.SPCAMQJE.js","./chunk.TUCSUZNO.js","./chunk.ZMWAZACO.js","./chunk.CD6YWH6T.js","./chunk.MD36ZSM5.js","./chunk.L6FGKJ5H.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.HJUXC5GM.js")))),_e=Fe.part((e,t)=>{let n=e.DraftFrame;return(0,K.jsx)(n,{...t})},{what:"The view"});function yt(e){let{seatTalk:t}=M();return(0,Y.useSyncExternalStore)(t.subscribe,()=>t.get().draft!==null,()=>!1)?(0,K.jsx)(Y.Suspense,{fallback:null,children:(0,K.jsx)(_e,{...e})}):null}var L=h(C(),1),P=h(S(),1),ie=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.IMKD6QQG.js","./chunk.Y2RZ5B4U.js","./chunk.FEGSYSA7.js","./chunk.KROR65KD.js","./chunk.BJUUSIQY.js","./chunk.J6KNEI5R.js","./chunk.2YMO7ZVX.js","./chunk.MH46V556.js","./chunk.XOZU4OFA.js","./chunk.5M34BJIQ.js","./chunk.HJS3LTSR.js","./chunk.64FCAUAJ.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.MD36ZSM5.js","./chunk.L6FGKJ5H.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.MAGKI4PD.js")))),Ve=ie.part((e,t)=>{let n=e.QuickAskCard;return(0,P.jsx)(n,{...t})},{what:"The quick ask"});function At({face:e,on:t=!0}){let{ai:n,aiDesk:r,selection:a,view:p}=M(),v=ye()?.open??!1,i=t&&R(n)&&!v,u=Me(r),w=(0,L.useRef)(null),k=(0,L.useRef)({selection:a,place:p.within?.view});return k.current={selection:a,place:p.within?.view},(0,L.useEffect)(()=>{if(!i)return;let l=Se(r);return l.drawn+=1,l.preload=()=>{ie.load().catch(()=>{}),(__graviewPreload(import.meta.url,["./chunk.KROR65KD.js","./chunk.BJUUSIQY.js","./chunk.64FCAUAJ.js","./chunk.S3EEY7T3.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.7E4CSXBT.js")).catch(()=>{})},J(l),()=>{l.drawn=Math.max(0,l.drawn-1),l.drawn===0&&(l.open=null),J(l)}},[i,r]),(0,L.useEffect)(()=>{if(!i)return;let l=f=>{if(f.defaultPrevented||f.key.toLowerCase()!=="k"||!(f.metaKey||f.ctrlKey)||f.altKey||f.shiftKey)return;let c=w.current?.closest("[data-graview-embed]"),o=f.target,d=!(o instanceof Node)||o===document.body||o===document.documentElement;if(c&&!(d||o instanceof Node&&c.contains(o)))return;f.preventDefault(),ie.prefetch();let y=document.activeElement,{selection:b,place:x}=k.current;X(r,{pointed:{...b[0]!==void 0?{on:b[0]}:{},about:b,...x?{place:x}:{}},returnTo:y instanceof HTMLElement&&y!==document.body?y:null})};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[i,r]),i?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("span",{ref:w,hidden:!0,"data-graview-quick-ask":e}),u?(0,P.jsx)(L.Suspense,{fallback:null,children:(0,P.jsx)(Ve,{face:e,opening:u,close:()=>X(r,null)},u.at)}):null]}):null}var G=h(C(),1),O=h(S(),1),se=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.Y2RZ5B4U.js","./chunk.FEGSYSA7.js","./chunk.KROR65KD.js","./chunk.BJUUSIQY.js","./chunk.J6KNEI5R.js","./chunk.2YMO7ZVX.js","./chunk.MH46V556.js","./chunk.XOZU4OFA.js","./chunk.5M34BJIQ.js","./chunk.HJS3LTSR.js","./chunk.64FCAUAJ.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.MD36ZSM5.js","./chunk.L6FGKJ5H.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.7HPQI5SY.js")))),$e=se.part((e,t)=>{let n=e.InlineAiMenu;return(0,O.jsx)(n,{...t})},{what:"The AI's suggestions"}),Qe=se.part((e,t)=>{let n=e.GhostTray;return(0,O.jsx)(n,{...t})},{quiet:!0});function Ke(){let{ai:e}=M(),t=R(e);return(0,G.useMemo)(()=>t?n=>({id:"inline-ai",heading:"AI",render:r=>(0,O.jsx)(G.Suspense,{fallback:null,children:(0,O.jsx)($e,{target:n,close:r})}),prepare:()=>se.prefetch()}):null,[t])}var Ye=[];function Pt({children:e}){let t=Ke(),n=(0,G.useMemo)(()=>t?[t]:Ye,[t]);return(0,O.jsx)(W,{sections:n,children:e})}function Ct(e){let{ai:t,aiDesk:n}=M(),{ghost:r}=ve(n);return r===null||r.onCard||t.off?null:(0,O.jsx)(G.Suspense,{fallback:null,children:(0,O.jsx)(Qe,{...e})})}var N=h(C(),1);var Ce=h(S(),1),je=e=>globalThis[Symbol.for("graview.shown-lists")]?.get(e),Pe=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.MD36ZSM5.js","./chunk.L6FGKJ5H.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.G3Q5IMM3.js"))));function Je(e){let t=e.about[0];if(e.about.length!==1||!t?.startsWith("aggregate:"))return;let n=t.slice(10).split("+");return n.length===1?n[0]:void 0}function Xe(e,t){return e.filter(n=>n.as!==t.as&&!n.hidden&&(n.kind===t.kind||n.over?.includes(t.kind)===!0)).at(-1)}function Ze(e){let t=F(),n=t?.keptViews,r=t?.views,a=(0,N.useContext)(Ie);return(0,N.useMemo)(()=>r?p=>{let v=n?.current(),i=Je(p),u=c=>c.length>0?{id:"tidy-view",items:c,prepare:()=>Pe.prefetch()}:null,w=(c,...o)=>Pe.load().then(d=>d[c](...o),()=>!1),k=(c,o)=>je(c)?.().menu(o,n,a)??[];if(p.place===void 0){if(p.face!=="pages"||i===void 0||p.on!==void 0)return null;let c=v?.may.lenses===!0&&n?.lens!==void 0,o=q(t.store.schema,i),d=r.arrangement?.()?.hide?.includes(i)===!0;return u([...c?[{id:d?"show-list":"hide-list",label:d?"Show":"Hide",hint:d?"Back in the places, for everyone":"Off the places, for everyone; still at its address",run:()=>void w("setListHidden",i,o,n,!d,a)}]:[],...k(`list:${i}`,c)])}let l=r.places().find(c=>c.as===p.place&&(i===void 0||c.kind===i||c.over?.includes(i)===!0));if(!l)return null;let f=n&&v?pe(l,v,n):null;return u([...f?[l.hidden?{id:"show-view",label:"Show",hint:"Back in the places, for everyone",run:()=>void w("setHidden",l,f,n,!1,a)}:{id:"hide-view",label:"Hide",hint:"Off the places and the scene, for everyone",run:()=>void w("setHidden",l,f,n,!0,a)},{id:"delete-view",label:"Delete",hint:`Kept ${30} days under Recently deleted`,run:()=>{let c=Xe(r.places(),l);w("remove",l,f,n,a).then(o=>o&&e?.(l,c))}}]:[],...k(`place:${l.as}`,f==="lens")])}:null,[n,r,a,e])}var et=[];function Bt({children:e}){let{view:t,go:n}=$(),r=(0,N.useCallback)((v,i)=>{let u=t.within?.view;t.focusId===fe(v.kind)&&(u===void 0||u===v.as)&&n(i?he(t,i.kind,i.as):me(t,!0))},[t,n]),a=Ze(r),p=(0,N.useMemo)(()=>a?[a]:et,[a]);return(0,Ce.jsx)(W,{sections:p,children:e})}var H=h(C(),1),ce=h(S(),1),U,ae=new Set,tt=e=>(ae.add(e),()=>void ae.delete(e)),nt=()=>(__graviewPreload(import.meta.url,["./chunk.PV2I4UPH.js","./chunk.MIE4TJRW.js","./chunk.CXJJB3MK.js","./chunk.OJGHDWI6.js","./chunk.74B6KQF4.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.DJVHKBEI.js")).then(e=>{U=e,ae.forEach(t=>t())});function ot(){let{ai:e,aiDesk:t,keptViews:n}=M();De(nt);let r=R(e)&&typeof n?.revise=="function";return(0,H.useMemo)(()=>r?a=>a.section&&U&&n?U.sectionFor(a,t,n):null:null,[r,t,n])}var rt=[];function Vt({children:e}){let t=ot(),n=(0,H.useMemo)(()=>t?[t]:rt,[t]);return(0,ce.jsx)(W,{sections:n,children:e})}function $t(){let e=(0,H.useSyncExternalStore)(tt,()=>U?.SectionDoor,()=>{});return e?(0,ce.jsx)(e,{}):null}function Ut(e={}){return e.scope===void 0?oe:ge(oe,e.scope)}var B=h(C(),1),s=h(S(),1);function nn({inside:e=!1,widthOf:t}={}){let{store:n,view:r,emphasis:a,setEmphasis:p}=M(),v=Te(),{selection:i,set:u}=V(),{show:w}=$(),k=_(),l=(0,B.useMemo)(()=>{let o=new Map;for(let d of n.graph.allEdges()){let y=o.get(d.kind)??{count:0,ends:new Set};y.count+=1;for(let b of[d.from,d.to]){let x=n.graph.getNode(b);x&&y.ends.add(`kind:${x.kind}`)}o.set(d.kind,y)}return[...o.entries()].sort(([d],[y])=>d.localeCompare(y)).map(([d,y])=>({kind:d,count:y.count,ends:[...y.ends]}))},[n,k]),f=Math.max(0,...l.map(o=>o.count));if((0,B.useEffect)(()=>()=>p(null),[p]),!r.overview&&!e||l.length===0)return null;let c=new Set;for(let o of i){if(o.startsWith("kind:")){c.add(o);continue}let d=n.graph.getNode(o);d&&c.add(`kind:${d.kind}`)}return(0,s.jsxs)("section",{"aria-label":"What the lines mean",role:e?"group":void 0,"data-testid":"relation-key",style:e?{display:"grid",gap:1}:{position:"absolute",left:16,top:14,zIndex:de("rail"),display:"grid",gap:1,padding:"8px 10px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",maxWidth:it,animation:"graview-settle 380ms 280ms ease backwards"},children:[e?null:(0,s.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-faint)",paddingBottom:2},children:l.length===1?"1 relation":`${l.length} relations`}),t?(0,s.jsx)(at,{aloft:r.overview===!0}):null,l.map(({kind:o,count:d,ends:y})=>{let{connector:b,style:x}=ne(v,o),g=st(n.schema,o),m=a!==null?a===o:c.size===0||y.some(A=>c.has(A));return(0,s.jsxs)("button",{type:"button",title:n.schema.edge(o)?.description===void 0?`${d} of these`:g.words,onMouseEnter:()=>p(o),onMouseLeave:()=>p(null),onFocus:()=>p(o),onBlur:()=>p(null),onClick:()=>{u(y),w(null)},style:{all:"unset",outline:"revert-layer",cursor:"pointer",display:"grid",gridTemplateColumns:"30px 1fr auto",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px",borderRadius:6,opacity:m?1:.4},children:[(0,s.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",style:{display:"block",opacity:b.visible?1:.35},children:r.overview&&t?(0,s.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",className:"graview-key-ribbon",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:t(d,f)}):(0,s.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",stroke:ee(x),strokeWidth:te(x,!0),strokeDasharray:Z[x.pattern],strokeLinecap:"round"})}),(0,s.jsxs)("span",{style:{display:"grid",minWidth:0},"data-graview-relation-words":o,children:[(0,s.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink)"},children:g.words}),(0,s.jsx)("span",{style:{fontSize:"0.6875rem",color:"var(--graview-ink-faint)"},children:g.ends})]}),b.visible?null:(0,s.jsx)("span",{"data-graview-quiet":o,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontStyle:"italic"},children:"not drawn"}),(0,s.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontVariantNumeric:"tabular-nums"},children:d})]},o)})]})}var it="min(280px, calc(100% - 28px))";function st(e,t,n){let r=e.edge(t)?.from??[],a=new Map;for(let i of n!==void 0&&r.includes(n)?[n]:r.length>0?r:[""]){let u=Ee(e,i,t,"out");a.set(u,[...a.get(u)??[],i])}let p=i=>i==="*"?"anything":q(e,i),v=[...a].map(([i,u])=>{let w=u.flatMap(l=>e.tryDefinition(l)?.edges[t]?.to??[]),k=u[0]&&w.length>0?`${u.map(p).join(", ")} \u2192 ${(w.includes("*")?["*"]:[...new Set(w)]).map(p).join(", ")}`:"";return[i.charAt(0).toUpperCase()+i.slice(1),k]});return{words:v.map(([i])=>i).join(" \xB7 "),ends:v.flatMap(([,i])=>i?[i]:[]).join(" \xB7 ")}}function on({edgeKind:e,kit:t,width:n=30}){let r=F(),a=(0,B.useMemo)(()=>ue(t??r?.brand?.kit),[t,r?.brand?.kit]),{connector:p,style:v}=ne(a,e);return(0,s.jsx)("svg",{width:n,height:"8","aria-hidden":"true","data-testid":"relation-mark","data-graview-relation":e,style:{display:"inline-block",verticalAlign:"middle",opacity:p.visible?1:.35},children:(0,s.jsx)("path",{d:`M 1 4 L ${n-1} 4`,fill:"none",stroke:ee(v),strokeWidth:te(v,!0),strokeDasharray:Z[v.pattern],strokeLinecap:"round"})})}function at({aloft:e}){let t={display:"grid",gridTemplateColumns:"30px 1fr",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px"},n={fontSize:"0.75rem",color:"var(--graview-ink-muted)"};return(0,s.jsxs)("div",{role:"group","aria-label":"The lines","data-testid":"line-manners",style:{display:"grid",gap:1,paddingBottom:6,marginBottom:4,borderBottom:"1px solid var(--graview-edge)"},children:[e?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{style:t,"data-graview-manner":"ribbon",children:[(0,s.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:6})}),(0,s.jsx)("span",{style:n,children:"A relation between two districts, as wide as the links along it \u2014 point at one for its words"})]}),(0,s.jsxs)("div",{style:t,"data-graview-manner":"record",children:[(0,s.jsxs)("svg",{width:"30",height:"10","aria-hidden":"true",children:[(0,s.jsx)("path",{d:"M 1 5 L 25 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeLinecap:"round"}),(0,s.jsx)("circle",{cx:26,cy:5,r:3,fill:"var(--graview-accent)"})]}),(0,s.jsx)("span",{style:n,children:"A chosen record's link to another record, labeled with the relation"})]}),(0,s.jsxs)("div",{style:t,"data-graview-manner":"district",children:[(0,s.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeDasharray:"5 4"})}),(0,s.jsx)("span",{style:n,children:"A chosen record's links into a district, with how many"})]})]}):null,(0,s.jsxs)("div",{style:t,"data-graview-manner":"unsure",children:[(0,s.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeOpacity:Ae,strokeWidth:1.8,strokeDasharray:be,strokeLinecap:"round"})}),(0,s.jsx)("span",{style:n,children:"Unsure: a link its maker was less than sure of, until a person keeps it \u2014 point at its words for what it was based on"})]})]})}var Le=h(C(),1),le=h(S(),1),ct=T(E(()=>(__graviewPreload(import.meta.url,["./chunk.25VJPUDH.js","./chunk.GPCKOYSF.js","./chunk.UETLP5KC.js","./chunk.IQC3GOXO.js","./chunk.NKYYDFIX.js","./chunk.6RZHKQP3.js","./chunk.L7NJLZWV.js","./chunk.2YMO7ZVX.js","./chunk.DA4RSHLW.js","./chunk.FOSY7MZF.js","./chunk.NBVPWLRY.js","./chunk.S3EEY7T3.js","./chunk.MD36ZSM5.js","./chunk.L6FGKJ5H.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.77XQEDT5.js")))),lt=ct.part(e=>(0,le.jsx)(e.SuggestedTray,{}),{quiet:!0});function cn(){let{store:e,whileAway:t}=M(),n=_();return(0,Le.useMemo)(()=>e.log.all().some(a=>a.suggests!==void 0&&!a.withheld),[e,n])||t?.tidied?(0,le.jsx)(lt,{}):null}export{ft as a,yt as b,At as c,nn as d,it as e,on as f,Ke as g,Pt as h,Ct as i,Ze as j,Bt as k,ot as l,Vt as m,$t as n,Ut as o,cn as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.WVUJXDXZ.js";import{k as m,m as i}from"./chunk.S2DOVJRL.js";import"./chunk.64FCAUAJ.js";import"./chunk.NBVPWLRY.js";import"./chunk.S3EEY7T3.js";import"./chunk.SPCAMQJE.js";import"./chunk.TUCSUZNO.js";import"./chunk.ZMWAZACO.js";import"./chunk.CD6YWH6T.js";import"./chunk.J24YPQ5I.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ee,b as Re,c as Le,d as we,e as U,f as ue,g as pe,h as fe}from"./chunk.
|
|
1
|
+
import{a as Ee,b as Re,c as Le,d as we,e as U,f as ue,g as pe,h as fe}from"./chunk.NSO6RUKW.js";import{c as j,e as ce}from"./chunk.PTQPS2FJ.js";import{a as ge}from"./chunk.74B6KQF4.js";import{G as H,V as z,da as le,fa as de}from"./chunk.3CJLAJXP.js";import"./chunk.SDO3U72B.js";import{Z as q,la as ae,oa as se,qd as _}from"./chunk.J24YPQ5I.js";import"./chunk.FQLNBIQ5.js";import{b as C}from"./chunk.AJZBJBMO.js";var b=C(H(),1);var I=C(H(),1),Ae=(e,t)=>`graview:last-visit:${t??"anyone"}:${e.join(",")}`;function Oe(e,t,o){let n=new Set;for(let r of e)if(!(r.author.id!==void 0&&r.author.id===o)&&Date.parse(r.at)>t)for(let i of r.writes)n.add(i);return n}function ye(e,t,o){let n=Ae(t,o?.id),[r]=(0,I.useState)(()=>{try{let i=globalThis.localStorage?.getItem(n);return i?Number(i):null}catch{return null}});return(0,I.useEffect)(()=>{let i=()=>{if(document.visibilityState==="hidden")try{globalThis.localStorage?.setItem(n,String(Date.now()))}catch{}};return document.addEventListener("visibilitychange",i),window.addEventListener("pagehide",i),()=>{document.removeEventListener("visibilitychange",i),window.removeEventListener("pagehide",i)}},[n]),(0,I.useMemo)(()=>r===null?new Set:Oe(e,r,o?.id),[e,r,o?.id])}function me(e,t,o){let n=new Set;if(o===void 0)return n;n.add(o);for(let r of[...e.out(o),...e.in(o)])n.add(r.id);for(let r of t)if(r.author.id===o)for(let i of r.primitives)i.op==="add-node"&&n.add(i.node.id);return n}var J=C(H(),1);var v=C(z(),1),Ce=`.graview-workflows{position:absolute;left:0;top:0;pointer-events:none;z-index:${_.plots};opacity:var(--graview-altitude);transition:opacity 640ms cubic-bezier(.33,0,.2,1)}
|
|
2
2
|
.graview-workflow-wire{fill:none;stroke:var(--graview-accent);stroke-width:1.5;stroke-opacity:.7;stroke-linecap:round}
|
|
3
3
|
.graview-workflow-wire[data-wire=reads]{stroke-dasharray:3 4;stroke-opacity:.55}
|
|
4
4
|
.graview-workflow-spot{fill:var(--graview-accent);stroke:var(--graview-panel);stroke-width:1.5}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ee,b as De,c as Le,d as N,e as te}from"./chunk.PV2I4UPH.js";import{c as Pe,d as Te}from"./chunk.FEGSYSA7.js";import"./chunk.KROR65KD.js";import"./chunk.BJUUSIQY.js";import"./chunk.MH46V556.js";import"./chunk.XOZU4OFA.js";import"./chunk.5M34BJIQ.js";import"./chunk.MIE4TJRW.js";import{A as Ce,x as Me}from"./chunk.CXJJB3MK.js";import"./chunk.OJGHDWI6.js";import"./chunk.74B6KQF4.js";import"./chunk.64FCAUAJ.js";import"./chunk.DA4RSHLW.js";import"./chunk.FOSY7MZF.js";import"./chunk.NBVPWLRY.js";import"./chunk.S3EEY7T3.js";import{m as $e}from"./chunk.MD36ZSM5.js";import"./chunk.L6FGKJ5H.js";import{G as et,Ka as Re,V as xe,da as Ae}from"./chunk.3CJLAJXP.js";import{a as ke}from"./chunk.SDO3U72B.js";import{sd as ee}from"./chunk.J24YPQ5I.js";import"./chunk.FQLNBIQ5.js";import{b as Q}from"./chunk.AJZBJBMO.js";var tt=/^h([1-6])$/,ne={section:null,article:null,form:null,region:null,nav:"navigation",navigation:"navigation",main:"main content",header:"header",banner:"header",footer:"footer",contentinfo:"footer",aside:"aside",complementary:"aside",search:"search"},nt=e=>typeof e=="object"&&e!==null&&typeof e.getAttribute=="function"&&(e.nodeType===void 0||e.nodeType===1),B=e=>(e??"").replace(/\s+/g," ").trim();function*V(e){yield e;for(let t of Array.from(e.childNodes))nt(t)&&(yield*V(t))}var Oe=e=>(e.getAttribute("data-graview-as")??e.localName??"").toLowerCase();function Ie(e){let t=tt.exec(Oe(e));return t?Number(t[1]):e.getAttribute("role")==="heading"?Number(e.getAttribute("aria-level")??2):void 0}function Ne(e){let t=[...V(e)],o=new Map;for(let s of t){let u=s.getAttribute("id");u&&o.set(u,s)}let n=[],d=new Set,i=(s,u)=>{let a=s.toLowerCase();!s||d.has(a)||(d.add(a),n.push({name:s.length>80?`${s.slice(0,79)}\u2026`:s,as:u}))};for(let s of t){if(s.getAttribute("aria-hidden")==="true"||s.getAttribute("hidden")!==null)continue;if(Ie(s)!==void 0){i(B(s.textContent),"heading");continue}let a=Oe(s),l=(s.getAttribute("role")??"").toLowerCase(),r=l in ne?l:a in ne?a:void 0;if(!r)continue;let g=(s.getAttribute("aria-labelledby")??"").split(/\s+/).flatMap(f=>o.get(f)?[B(o.get(f).textContent)]:[]).join(" "),h=[...V(s)].find(f=>f!==s&&Ie(f)!==void 0),c=B(s.getAttribute("aria-label"))||g||(h?B(h.textContent):"")||ne[r]||"";i(c,r==="region"?"section":r)}return n}var _="\0";function je(e){let t=[],o=e.length,n=0,d="",i=r=>r.replace(/\\(u\{[0-9a-fA-F]+\}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{2}|.)/gs,(g,h)=>h==="n"?`
|
|
2
|
+
`:h==="t"?" ":h[0]==="u"||h[0]==="x"?String.fromCodePoint(parseInt(h.replace(/[ux{}]/g,""),16)):h),s=r=>{let g=++n;for(;n<o&&e[n]!==r&&e[n]!==`
|
|
3
|
+
`;)n+=e[n]==="\\"?2:1;let h=e.slice(g,n);return n++,i(h)},u=()=>{n++;let r=!1;for(;n<o&&e[n]!==`
|
|
4
|
+
`;){let g=e[n];if(g==="\\")n+=2;else if(g==="[")r=!0,n++;else if(g==="]")r=!1,n++;else{if(g==="/"&&!r)break;n++}}for(n++;n<o&&/[a-z]/i.test(e[n]);)n++},a=()=>{n++;let r="";for(;n<o;){let g=e[n];if(g==="\\")r+=i(e.slice(n,n+2)),n+=2;else{if(g==="`")return n++,r;g==="$"&&e[n+1]==="{"?(n+=2,l(!0),r+=_):(r+=g,n++)}}return r};function l(r){let g=0;for(;n<o;){let h=e[n];if(h==="/"&&e[n+1]==="/"){let c=e.indexOf(`
|
|
5
|
+
`,n);n=c<0?o:c}else if(h==="/"&&e[n+1]==="*"){let c=e.indexOf("*/",n+2);n=c<0?o:c+2}else if(h==='"'||h==="'")t.push(s(h)),d="a";else if(h==="`")t.push(a()),d="a";else if(h==="/"&&(d===""||"(,=:[!&|?{};+-*%<>~^".includes(d)))u(),d="a";else{if(h==="{"&&g++,h==="}"){if(r&&g===0){n++;return}g--}/\s/.test(h)||(d=h),n++}}}return l(!1),t}var rt=e=>e.replace(/\s+/g," ").replace(/\s*([>+~,])\s*/g,"$1").trim();function ot(e){let t=[],o=0,n=0;for(let d=0;d<e.length;d++){let i=e[d];i==="("||i==="["?o++:i===")"||i==="]"?o--:i===","&&o===0&&(t.push(e.slice(n,d)),n=d+1)}return t.push(e.slice(n)),t.map(rt).filter(Boolean)}var it=new Set(["media","supports","container","layer","scope","document"]);function ie(e){let t=e.replace(/\/\*[\s\S]*?\*\//g,""),o=[],n=s=>{let u=t[s],a=s+1;for(;a<t.length&&t[a]!==u;)a+=t[a]==="\\"?2:1;return a+1},d=s=>{let u=1,a=s;for(;a<t.length&&u>0;){let l=t[a];if(l==='"'||l==="'"){a=n(a);continue}l==="{"?u++:l==="}"&&u--,a++}return a},i=s=>{let u="",a=s;for(;a<t.length;){let l=t[a];if(l==='"'||l==="'"){let r=n(a);u+=t.slice(a,r),a=r}else{if(l==="}")return a+1;if(l===";")u="",a++;else if(l==="{"){let r=u.trim();if(u="",r.startsWith("@")){let g=(/^@([\w-]+)/.exec(r)?.[1]??"").toLowerCase();a=it.has(g)?i(a+1):d(a+1)}else o.push(...ot(r)),a=d(a+1)}else u+=l,a++}}return a};return i(0),[...new Set(o)]}function q(e){let t=e.replace(/\[[^\]]*\]/g,"").replace(/"[^"]*"|'[^']*'/g,"");return[...new Set([...t.matchAll(/([.#])(-?[_a-zA-Z -][\w --]*)/g)].map(o=>`${o[1]}${o[2]}`))]}var st=e=>!e.includes(_)&&e.length<300&&!/[<;!@]|=>|^\d/.test(e)&&/^[\w\s.#:>+~*()[\]="'^$|,\\%-]+$/u.test(e),at=/\b(?:class|className)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,lt=/\bid\s*=\s*(?:"([^"]*)"|'([^']*)')/g,dt=/<h([1-6])\b[^>]*>([\s\S]*?)<\/h\1\s*>/gi,ct=/<(section|nav|main|aside|header|footer|article|form)\b[^>]*?\baria-label\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;function Ve(e){let t=e.css===void 0||e.drawing===void 0&&e.classes===void 0?je(e.source):[],o=e.css!==void 0?ie(e.css):[...new Set(t.filter(i=>i.includes("{")&&i.includes("}")).flatMap(i=>ie(i)).filter(st))],n=new Set,d;if(e.drawing){for(let i of V(e.drawing)){for(let u of(i.getAttribute("class")??"").split(/\s+/))u&&n.add(`.${u}`);let s=i.getAttribute("id");s&&n.add(`#${s}`)}d=Ne(e.drawing)}else{let i=a=>(a[1]??a[2]??"").split(/\s+/).filter(l=>l&&!l.includes(_));for(let a of t){for(let l of a.matchAll(at))for(let r of i(l))n.add(`.${r}`);for(let l of a.matchAll(lt))for(let r of i(l))n.add(`#${r}`)}let s=new Set;d=[];let u=(a,l)=>{let r=a.replace(/\s+/g," ").trim();!r||r.includes(_)||s.has(r.toLowerCase())||(s.add(r.toLowerCase()),d.push({name:r,as:l}))};for(let a of t){for(let l of a.matchAll(ct))u(l[2]??l[3]??"",l[1].toLowerCase());for(let l of a.matchAll(dt))u(l[2].replace(/<[^>]*>/g,""),"heading")}}for(let i of e.classes??[])n.add(`.${i}`);return{from:e.drawing||e.classes?"drawing":"source",selectors:o,drawn:n,sections:d}}var re=8,oe=e=>e.length<=re?e.join(", "):`${e.slice(0,re).join(", ")} and ${e.length-re} more`,He=e=>`${Math.round(e).toLocaleString("en-US")}px`;function se(e,t){let o=Ve(e),n=Ve(t),d=new Set(n.selectors.flatMap(q)),i=new Map;for(let m of o.selectors)for(let x of q(m))x.startsWith(".")&&i.set(x,[...i.get(x)??[],m]);let s=[...i].filter(([m])=>n.drawn.has(m)&&!d.has(m)).map(([m,x])=>({class:m.slice(1),styledBy:x})),u=new Set(s.map(m=>`.${m.class}`)),a=new Set(n.selectors),l=o.selectors.filter(m=>!a.has(m)).map(m=>({selector:m,names:q(m)})).filter(m=>m.names.length>0&&m.names.every(x=>n.drawn.has(x)&&(o.from==="source"||o.drawn.has(x)))),r=new Set(n.sections.map(m=>m.name.toLowerCase())),g=o.sections.filter(m=>!r.has(m.name.toLowerCase())),h=e.height!==void 0&&t.height!==void 0&&e.height>0?{before:e.height,after:t.height,change:t.height-e.height,ratio:Math.round((t.height-e.height)/e.height*1e3)/1e3}:void 0,c=h!==void 0&&Math.abs(h.ratio)>=.1&&Math.abs(h.change)>=50,f=[];if(s.length>0){let m=s.map(x=>`.${x.class}`);f.push(`${s.length===1?"A class":`${s.length} classes`} it still draws lost every rule that styled ${s.length===1?"it":"them"} before: ${oe(m)}. Put back the rules for ${s.length===1?"it":"them"}, or stop drawing ${s.length===1?"it":"them"}.`)}let S=l.filter(m=>!m.names.some(x=>u.has(x)));S.length>0&&f.push(`${S.length===1?"A rule was":`${S.length} rules were`} taken out while the markup ${S.length===1?"it":"they"} styled is still drawn: ${oe(S.map(m=>`"${m.selector}"`))}.`),g.length>0&&f.push(`${g.length===1?"A section":`${g.length} sections`} drawn before ${g.length===1?"is":"are"} not drawn now: ${oe(g.map(m=>`"${m.name}"`))}.`),h&&c&&f.push(`The page is ${He(h.after)} tall, ${h.change<0?"down":"up"} from ${He(h.before)} (${h.change<0?"\u2212":"+"}${Math.round(Math.abs(h.ratio)*100)}%).`);let $=f.length>0;return{regressed:$,unstyled:s,selectorsRemoved:l,sectionsMissing:g,...h?{height:h}:{},read:{before:o.from,after:n.from},said:f,text:$?f.join(" "):`Nothing it drew before lost its style, and no section it drew is gone${h?"; the page is about as tall":""}.`}}var qe=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]),ut=new Set(["section","article","nav","aside","header","footer","main","form","search"]),de=/^h([1-6])$/,gt=/<(\/?)([a-zA-Z][\w-]*)((?:"[^"]*"|'[^']*'|\$\{(?:[^{}]|\{[^{}]*\})*\}|[^>"'$]|\$(?!\{))*)>/g,H=e=>e.replace(/\s+/g," ").trim(),ue=e=>H(e.replace(/\$\{(?:[^{}]|\{[^{}]*\})*\}/g," ").replace(/<[^>]*>/g," ")),Ue=(e,t)=>H(e).toLowerCase()===H(t).toLowerCase();function _e(e){let t=[];for(let o of e.matchAll(gt)){let n=o[2].toLowerCase(),d=o[3]??"";t.push({start:o.index,end:o.index+o[0].length,name:n,closing:o[1]==="/",attrs:qe.has(n)||d.trimEnd().endsWith("/")?`${d}\0void`:d})}return t}var ce=e=>qe.has(e.name)||e.attrs.endsWith("\0void");function P(e,t){let o=new RegExp(`(?:^|\\s)${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,"i").exec(e.attrs),n=o?o[1]??o[2]??o[3]:void 0;return n===void 0||n.includes("${")?void 0:n}function W(e,t){let o=e[t],n=0;for(let d=t+1;d<e.length;d++){let i=e[d];if(!(i.name!==o.name||ce(i)))if(!i.closing)n+=1;else{if(n===0)return d;n-=1}}return-1}function ht(e,t,o){let n=t.findIndex(i=>!i.closing&&P(i,"id")===o);if(n<0)return;let d=W(t,n);return d<0?void 0:ue(e.slice(t[n].end,t[d].start))}function ft(e,t,o,n){let d=t[o],i=P(d,"data-section");if(i)return H(i);let s=P(d,"aria-label");if(s)return H(s);let u=P(d,"aria-labelledby");if(u){let a=u.split(/\s+/).filter(Boolean).map(l=>ht(e,t,l)??"").filter(Boolean).join(" ");if(a)return a}for(let a=o+1;a<n;a++){let l=t[a];if(l.closing||!de.test(l.name))continue;let r=W(t,a);if(r>0)return ue(e.slice(l.end,t[r].start))}return""}function pt(e){let t=[];for(let o of e.matchAll(/graview\.style\(\s*([`"'])/g)){let n=o[1],d=o.index+o[0].length,i=d;for(;i<e.length&&e[i]!==n;)i+=e[i]==="\\"?2:1;i<e.length&&t.push({start:d,end:i,quote:n})}return t}function mt(e,t,o){let n=[],d=0;for(;d<e.length;){let i=e.indexOf("{",d);if(i<0)break;let s=0,u=i;for(;u<e.length;u++)if(e[u]==="{")s+=1;else if(e[u]==="}"&&--s===0)break;if(u>=e.length)break;let a=d;for(;a<i&&/\s/.test(e[a]);)a+=1;for(;e.startsWith("/*",a);){let g=e.indexOf("*/",a);for(a=g<0?i:g+2;a<i&&/\s/.test(e[a]);)a+=1}let l=e.slice(a,i).trim(),r=l.startsWith("@")?[...e.slice(i+1,u).matchAll(/([^{}]+)\{/g)].map(g=>g[1].trim()).join(", "):l;n.push({start:t+a,end:t+u+1,selector:r,text:e.slice(a,u+1),sheet:o}),d=u+1}return n}var yt=e=>[...e.replace(/\[[^\]]*\]|:[\w-]+\([^)]*\)/g," ").matchAll(/([.#])(-?[_a-zA-Z][\w-]*)/g)].map(t=>`${t[1]}${t[2]}`);function wt(e){let t=new Set;for(let o of _e(e)){if(o.closing)continue;let n=/(?:^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(o.attrs);for(let i of(n?.[1]??n?.[2]??"").replace(/\$\{(?:[^{}]|\{[^{}]*\})*\}/g," ").split(/\s+/))i&&t.add(`.${i}`);let d=P(o,"id");d&&t.add(`#${d}`)}return t}function bt(e,t){let o=_e(e),n,d=1/0;for(let l=0;l<o.length;l++){let r=o[l];if(r.closing||ce(r)||!(ut.has(r.name)||P(r,"data-section")!==void 0||P(r,"role")==="region"))continue;let h=W(o,l);if(h<0)continue;let c=o[h].end;c-r.start<d&&Ue(ft(e,o,l,h),t)&&(d=c-r.start,n={start:r.start,end:c,text:e.slice(r.start,c)})}if(!n)for(let l=0;l<o.length&&!n;l++){let r=o[l],g=de.exec(r.name);if(r.closing||!g)continue;let h=W(o,l);if(h<0||!Ue(ue(e.slice(r.end,o[h].start)),t))continue;let c=0,f=o[h].end;for(let S=h+1;S<o.length;S++){let $=o[S];if(ce($))continue;let m=de.exec($.name);if(c===0&&!$.closing&&m&&Number(m[1])<=Number(g[1])||$.closing&&c===0)break;c+=$.closing?-1:1,f=$.end}n={start:r.start,end:f,text:e.slice(r.start,f)}}if(!n)return;let i=wt(n.text),s=pt(e),u=[],a=[];return s.forEach((l,r)=>{for(let g of mt(e.slice(l.start,l.end),l.start,r)){let h=g.selector.split(",").map(f=>yt(f));h.some(f=>f.some(S=>i.has(S)))&&(h.every(f=>f.some(S=>i.has(S)))?u.push(g):a.push(g))}}),{name:t,markup:n,rules:u,shared:a,names:[...i],sheets:s}}function ae(e,t){return t==="`"?e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"):e.replace(/\\/g,"\\\\").replace(new RegExp(t,"g"),`\\${t}`).replace(/\n/g,"\\n")}function Be(e,t,o){let n=[{start:t.markup.start,end:t.markup.end,text:o.markup}],d=o.css.trim(),[i,...s]=t.rules;if(i){let a=t.sheets[i.sheet];n.push({start:i.start,end:i.end,text:ae(d,a.quote)});for(let l of s)n.push({start:l.start,end:l.end,text:""})}else if(d){let a=t.sheets[0];a?n.push({start:a.end,end:a.end,text:ae(`
|
|
6
|
+
${d}
|
|
7
|
+
`,a.quote)}):n.push({start:0,end:0,text:`graview.style(\`
|
|
8
|
+
${ae(d,"`")}
|
|
9
|
+
\`);
|
|
10
|
+
`})}n.sort((a,l)=>l.start-a.start);let u=e;for(let a of n)u=u.slice(0,a.start)+a.text+u.slice(a.end);return u}var vt=["You revise one section of a view in a Graview app.","The view is a plain script: it draws HTML with graview.html`\u2026` templates and styles it with graview.style(css).","You are given the section's markup exactly as it stands in the script's template. It may hold ${\u2026} interpolations: keep each one you keep exactly as written, and never name a variable that is not already in them.","You are given the stylesheet rules that style only this section (you rewrite them), the rules it shares with the rest of the view (never restate or change those), the app's look (its scheme and the values of its --graview-* tokens), and the words the section shows now.",`Answer with one JSON object and nothing else: {"markup": "<the section's whole new markup>", "css": "<every rule that styles it now>", "said": "<one sentence to the person saying what you changed>"}.`,"Keep the same outer element, and keep its name \u2014 its label or its heading's words \u2014 so it is still found. Show the same data. Style every class the markup uses, or stop using it. Use var(--graview-\u2026) tokens for colors, type and corners, never colors of your own.","Never use import, export, require, <script>, <style>, or on\u2026= attributes."].join(" ");function le(e){let t=e.mode==="just"?"Make this section better: easier to read at a glance, laid out cleanly at a phone's width and at a desk's, in the app's own look. Change no data it shows.":(e.words??"").trim();return JSON.stringify({section:e.located.name,asked:t,...e.mode==="highlight"&&e.highlighted?.length?{pointed_at:e.highlighted}:{},markup:e.located.markup.text,rules:e.located.rules.map(o=>o.text),shared_rules:e.located.shared.map(o=>o.text),...e.theme?{look:e.theme}:{},...e.shows?{shows:e.shows.slice(0,1200)}:{},...e.findings?.length?{your_last_answer:e.last,what_broke:e.findings,repair:"Your last answer broke the view as said in what_broke. Answer again, fixing each one."}:{}})}function St(e){let t=/```(?:json)?\s*([\s\S]*?)```/.exec(e)?.[1]??e,o=t.indexOf("{"),n=t.lastIndexOf("}");if(!(o<0||n<=o))try{let d=JSON.parse(t.slice(o,n+1));return typeof d.markup!="string"||!d.markup.trim().startsWith("<")?void 0:{markup:d.markup.trim(),css:typeof d.css=="string"?d.css:"",said:typeof d.said=="string"&&d.said.trim()?d.said.trim():"Revised this section."}}catch{return}}async function We(e){let t=[],o=bt(e.source,e.section);if(!o)return{ok:!1,refused:`\u201C${e.section}\u201D could not be found in the view's code, so it cannot be revised on its own.`,stages:t};let n=e.ai.off?void 0:e.ai.light,d=Pe(e.ai),i=n??d;if(!i)return{ok:!1,refused:e.ai.withoutModel??"Revising a section needs AI, and none is on here.",stages:t};let s=async(f,S,$)=>{let m=Date.now();try{let x=await f.think({system:vt,prompt:$,state:{},catalog:{candidates:[]}});return t.push({stage:S,model:f.model,ms:Date.now()-m,...x.usage?{usage:x.usage}:{}}),St(x.text)}catch{t.push({stage:S,model:f.model,ms:Date.now()-m});return}},u={located:o,mode:e.mode,...e.words?{words:e.words}:{},...e.highlighted?{highlighted:e.highlighted}:{},...e.theme?{theme:e.theme}:{},...e.shows?{shows:e.shows}:{}},l=await s(i,n?"light":"thinking",le(u));if(!l&&n&&d&&d!==n&&(l=await s(d,"thinking",le(u))),!l)return{ok:!1,refused:"The model did not answer with a revision of this section.",stages:t};let r=Be(e.source,o,l),g=await e.judge(r);if(g.length===0)return{ok:!0,source:r,said:l.said,located:o,repaired:!1,stages:t};let h=d??i,c=await s(h,h===n?"light":"thinking",le({...u,findings:g,last:l}));return c?(r=Be(e.source,o,c),g=await e.judge(r),g.length>0?{ok:!1,refused:`It could not be revised without breaking the view: ${g.join(" ")}`,stages:t}:{ok:!0,source:r,said:c.said,located:o,repaired:!0,stages:t}):{ok:!1,refused:`It could not be revised without breaking the view: ${g.join(" ")}`,stages:t}}var w=Q(et(),1);var p=Q(xe(),1);var ge=Re(ke(()=>(__graviewPreload(import.meta.url,["./chunk.KROR65KD.js","./chunk.BJUUSIQY.js","./chunk.64FCAUAJ.js","./chunk.S3EEY7T3.js","./chunk.MD36ZSM5.js","./chunk.L6FGKJ5H.js","./chunk.3CJLAJXP.js","./chunk.SDO3U72B.js","./chunk.J24YPQ5I.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.UL62ELNR.js")))),kt=ge.part((e,t)=>(0,p.jsx)(e.RateTelling,{...t}),{quiet:!0});function en({ask:e,open:t,close:o}){return e?(0,p.jsx)(Mt,{ask:e,close:o},e.at):t?(0,p.jsx)(te,{elements:t}):null}var xt=360,R=12;function At(e,t){let o={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},n=Math.min(xt,o.width-2*R),d=e.getBoundingClientRect().height,i=a=>Math.max(R,Math.min(a,o.height-d-R)),s=(o.width-n)/2,u=i(72);t&&t.width>0&&(t.right+R+n<=o.width-R?[s,u]=[t.right+R,i(t.top)]:t.left-R-n>=R?[s,u]=[t.left-R-n,i(t.top)]:(s=Math.max(R,Math.min(t.left,o.width-n-R)),u=t.bottom+R+d<=o.height-R?t.bottom+R:i(t.top-R-d))),e.style.left=`${Math.round(s)}px`,e.style.top=`${Math.round(u)}px`,e.style.width=`${Math.round(n)}px`}var Rt=e=>e.map(t=>t.innerText??t.textContent??"").join(" ").replace(/\s+/g," ").trim(),Ye=e=>{let t=e.getBoundingClientRect();return{tag:(e.getAttribute("data-graview-as")??e.localName).toLowerCase(),classes:[...e.classList],text:e.textContent??"",box:{left:t.left,top:t.top,width:t.width,height:t.height}}};function $t(e,t,o){let n=[...e.querySelectorAll("*")].filter(s=>{let u=s.getBoundingClientRect();return u.width>0&&u.height>0});if(o){let s=n.filter(l=>{let r=l.getBoundingClientRect();return t.left>=r.left&&t.left<=r.right&&t.top>=r.top&&t.top<=r.bottom}),a=s.filter(l=>!s.some(r=>r!==l&&l.contains(r)))[0];if(!a)return[];for(let l=a;l&&l!==e;l=l.parentElement)if(l.classList.length>0||/^(h[1-6]|li|a|button|img|p|article|section)$/.test(l.localName))return[l];return[a]}let d=n.filter(s=>{let u=s.getBoundingClientRect();return u.left>=t.left-2&&u.right<=t.right+2&&u.top>=t.top-2&&u.bottom<=t.bottom+2}),i=d.filter(s=>!d.some(u=>u!==s&&u.contains(s)));for(;i.length===1;){let s=[...i[0].children].filter(u=>d.includes(u));if(s.length<2)break;i=s}return i}function ze(e,t,o,n,d,i){let s=d.drawing(),u=se({source:t,css:o.css,...o.root?{drawing:o.root}:{},...o.height!==void 0?{height:o.height}:{}},{source:i,css:s.css,...s.root?{drawing:s.root}:{},...s.height!==void 0?{height:s.height}:{}}),a=[];for(let g of u.unstyled)a.push(`The class \u201C${g.class}\u201D is still drawn and no rule styles it now.`);for(let g of u.sectionsMissing)a.push(`\u201C${g.name}\u201D is not drawn any more.`);for(let g of d.refused())n.includes(g)||a.push(g);let l=[],r=u.height;return r&&Math.abs(r.ratio)>=.1&&l.push(`The view is ${Math.abs(Math.round(r.change))} px ${r.change>0?"taller":"shorter"} (${Math.round(r.before)} \u2192 ${Math.round(r.after)}).`),{findings:a,notes:l}}function Mt({ask:e,close:t}){let{ai:o,aiDesk:n,principal:d,keptViews:i}=Ae(),[s,u]=(0,w.useState)(e.section),a=Ee(e.section),l=(0,w.useRef)(Me(a)),r=(0,w.useRef)(null),g=(0,w.useRef)(null),h=(0,w.useRef)(null),[c,f]=(0,w.useState)(e.mode==="highlight"?{at:"highlighting"}:e.mode==="describe"?{at:"asking"}:{at:"working"}),[S,$]=(0,w.useState)(""),m=(0,w.useRef)(void 0),[x,Xe]=(0,w.useState)(null),he=(0,w.useRef)(null),T=(0,w.useCallback)(y=>{let v=he.current;v&&o.told&&ge.load().then(b=>b.changeTelling(o.told,v.id,{outcome:y}),()=>{})},[o.told]),K=(0,w.useCallback)((y,v,b,A,k,E)=>{let C=o.told;if(!C)return;let L=A.at(-1)?.stage==="thinking"?"full":A.length>0?"light":void 0;ge.load().then(U=>{let I=U.keepTelling(C,{words:y,target:{on:"place",place:v.view},decided:b?{type:"refusal"}:{type:"view",section:v.name},...L?{slot:L}:{},stages:A.map(O=>({stage:O.stage==="thinking"?"full":"light",ms:O.ms,model:O.model})),ms:k,outcome:b?"abandoned":"previewed",interaction:E},d);he.current=I??null,Xe(I??null)},()=>{})},[o.told,d]);(0,w.useEffect)(()=>()=>{r.current?.dispose(),r.current=null},[]);let F=(0,w.useCallback)((y,v,b,A={})=>({id:Te(),at:new Date().toISOString(),by:d,target:{on:"place",place:s.view},targetLabel:l.current?.title??s.view,ask:{kind:"section",said:y},offered:[],outcome:v,stages:b.map(k=>({stage:k.stage,ms:k.ms,model:k.model})),usage:b.flatMap(k=>k.usage?[{tier:k.stage==="light"?"fast":"thinking",model:k.model,inputTokens:k.usage.inputTokens,outputTokens:k.usage.outputTokens}]:[]),...A}),[d,s.view]),X=(0,w.useCallback)(async(y,v,b,A=s)=>{let k=l.current,E=y==="just"?`Make \u201C${A.name}\u201D better`:`Make \u201C${A.name}\u201D better: ${v}`;if(!k)return f({at:"refused",said:"This view is not drawn here any more."});f({at:"working",...b?{pointed:b}:{}});let C=await k.source();if(C===void 0)return f({at:"refused",said:"This view is a whole worker script, and only a plain script's section can be revised here."});m.current??=C;let L=Date.now(),U=k.drawing(),I=k.refused(),O=await k.theme().catch(()=>({})),M=await We({ai:o,source:C,section:A.name,mode:y,...v?{words:v}:{},...b?{highlighted:[b.name,...b.lines]}:{},theme:O,shows:Rt(A.elements),judge:async D=>{r.current?.dispose(),r.current=null;let ve=await k.check(D);if(ve.length>0)return ve;let Z=k.draft(D);r.current=Z;let{failed:Se}=await Z.drawn;return Se?[`The view did not draw: ${Se}`]:(await new Promise(Qe=>requestAnimationFrame(()=>requestAnimationFrame(Qe))),ze(k,C,U,I,Z,D).findings)}});if(!M.ok){r.current?.dispose(),r.current=null;let D=F(E,"failed",M.stages,{failed:M.refused});return n.record(D),K(v||E,A,!0,M.stages,Date.now()-L,D.id),f({at:"refused",said:M.refused})}let we=r.current?ze(k,C,U,I,r.current,M.source).notes:[],be=F(E,"offered",M.stages);K(v||E,A,!1,M.stages,Date.now()-L,be.id),f({at:"draft",source:M.source,said:M.said,notes:M.repaired?["Repaired once after the first try broke the view.",...we]:we,entry:be})},[o,n,F,s,K]),fe=(0,w.useRef)(!1);(0,w.useEffect)(()=>{e.mode!=="just"||fe.current||(fe.current=!0,X("just",""))},[e.mode,X]);let Je=(0,w.useCallback)(async()=>{if(c.at!=="draft"||!i?.revise||!l.current)return;let y=l.current,v=await y.source()??"";f({at:"keeping",source:c.source,entry:c.entry});try{let b=await i.revise({name:y.name,title:y.title,source:c.source,before:v,section:s.name,said:c.said});r.current?.dispose(),r.current=null,y.draw(c.source);let A={...c.entry,outcome:"accepted"};n.record(A),T("accepted"),f({at:"kept",source:v,...b&&b.note?{note:b.note}:{},answer:b,entry:A})}catch(b){f({at:"refused",said:b instanceof Error?b.message:"The host did not keep it."})}},[c,i,n,s.name,T]),J=(0,w.useCallback)(()=>{r.current?.dispose(),r.current=null,c.at==="draft"&&(n.record({...c.entry,outcome:"dismissed"}),T("declined")),t()},[c,n,t,T]),Ze=(0,w.useCallback)(async()=>{if(c.at!=="kept"||!l.current)return;let y=l.current,v=await y.source()??"";try{c.answer&&typeof c.answer.undo=="function"?await c.answer.undo():await i?.revise?.({name:y.name,title:y.title,source:c.source,before:v,section:s.name,said:"Put back as it was.",undoes:!0}),y.draw(c.source===m.current?void 0:c.source),n.record({...c.entry,outcome:"dismissed"}),T("undone"),f({at:"undone"})}catch(b){f({at:"refused",said:b instanceof Error?b.message:"The host did not put it back."})}},[c,i,n,s.name,T]);(0,w.useLayoutEffect)(()=>{let y=0,v=()=>{if(g.current){let b=a?.querySelector("[data-graview-section-draft]");At(g.current,b?N([b]):N(s.elements)??(a?N([a]):null))}y=requestAnimationFrame(v)};return v(),()=>cancelAnimationFrame(y)},[s,a]),(0,w.useEffect)(()=>{c.at==="asking"?h.current?.focus():c.at!=="highlighting"&&g.current?.querySelector("button[data-first]")?.focus()},[c.at]),(0,w.useEffect)(()=>{let y=v=>{v.key==="Escape"&&(v.preventDefault(),J(),e.returnTo?.focus?.())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[J,e.returnTo]);let pe=c.at==="asking"||c.at==="working"?c.pointed:void 0;if(c.at==="highlighting")return(0,p.jsx)(Ct,{place:a,section:s,cancel:t,chose:y=>{let v=y[0],A=(v?Ce(v):void 0)??s;u(A),f({at:"asking",pointed:{name:De(y.map(Ye)),lines:Le(y.map(Ye))}})}});let me=c.at==="draft"||c.at==="keeping",ye=me?[...a?.querySelectorAll("[data-graview-section-draft]")??[]]:c.at==="kept"||c.at==="undone"?[]:s.elements;return(0,p.jsxs)(p.Fragment,{children:[ye.length>0?(0,p.jsx)(te,{elements:ye,label:me?"Draft":void 0}):null,(0,p.jsxs)("div",{ref:g,role:"dialog","aria-label":`Make \u201C${s.name}\u201D better`,"data-testid":"section-card","data-section-phase":c.at,"data-graview-popover":"",style:Pt,children:[(0,p.jsxs)("p",{style:Tt,children:["Make ",(0,p.jsxs)("strong",{children:["\u201C",s.name,"\u201D"]})," better"]}),pe?(0,p.jsxs)("p",{"data-testid":"section-pointed",style:Y,children:["You pointed at ",pe.name,"."]}):null,c.at==="asking"?(0,p.jsxs)("form",{onSubmit:y=>{y.preventDefault(),S.trim()&&X(e.mode,S.trim(),c.pointed)},style:{display:"grid",gap:8},children:[(0,p.jsx)("label",{style:$e,htmlFor:"graview-section-words",children:c.pointed?"What should change here?":"What should change?"}),(0,p.jsx)("input",{id:"graview-section-words",ref:h,"data-testid":"section-words",value:S,onChange:y=>$(y.target.value),placeholder:c.pointed?"What should change here?":"What should change?",style:Dt}),(0,p.jsxs)("div",{style:z,children:[(0,p.jsx)("button",{type:"submit","data-first":"",disabled:!S.trim(),style:Ge,children:"Revise"}),(0,p.jsx)("button",{type:"button",onClick:t,style:j,children:"Cancel"})]})]}):null,(0,p.jsx)("p",{role:"status","aria-live":"polite","data-testid":"section-status",style:c.at==="working"||c.at==="keeping"?Et:Y,children:c.at==="working"?`Revising \u201C${s.name}\u201D\u2026`:c.at==="keeping"?"Keeping it\u2026":c.at==="draft"?c.said:c.at==="kept"?`Kept.${c.note?` ${c.note}`:""}`:c.at==="undone"?"Put back as it was.":c.at==="refused"?c.said:""}),c.at==="draft"?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("p",{"data-testid":"section-draft-line",style:Y,children:"Draft \u2014 shown in place, not kept."}),c.notes.map(y=>(0,p.jsx)("p",{"data-testid":"section-note",style:Y,children:y},y)),(0,p.jsxs)("div",{style:z,children:[(0,p.jsx)("button",{type:"button","data-first":"","data-testid":"section-keep",onClick:()=>void Je(),style:Ge,children:"Keep"}),(0,p.jsx)("button",{type:"button","data-testid":"section-discard",onClick:J,style:j,children:"Discard"})]})]}):null,c.at==="kept"?(0,p.jsxs)("div",{style:z,children:[(0,p.jsx)("button",{type:"button","data-first":"","data-testid":"section-undo",onClick:()=>void Ze(),style:j,children:"Undo"}),(0,p.jsx)("button",{type:"button",onClick:t,style:j,children:"Close"})]}):null,c.at==="refused"||c.at==="undone"?(0,p.jsx)("div",{style:z,children:(0,p.jsx)("button",{type:"button","data-first":"",onClick:t,style:j,children:"Close"})}):null,x&&o.told&&c.at!=="working"&&c.at!=="asking"?(0,p.jsx)(kt,{told:o.told,telling:x}):null]})]})}function Ct({place:e,section:t,cancel:o,chose:n}){let d=(0,w.useRef)(null),[i,s]=(0,w.useState)(null),u=e?.querySelector("[data-worker-view]")?.shadowRoot?.querySelector("[data-graview-view-root]")??void 0;(0,w.useLayoutEffect)(()=>{let r=0,g=()=>{let h=e?N([e]):null,c=d.current;c&&h&&(c.style.left=`${Math.round(h.left-G)}px`,c.style.top=`${Math.round(h.top-G)}px`,c.style.width=`${Math.round(h.width+2*G)}px`,c.style.height=`${Math.round(h.height+2*G)}px`),r=requestAnimationFrame(g)};return g(),()=>cancelAnimationFrame(r)},[e]),(0,w.useEffect)(()=>{d.current?.focus()},[]);let a=r=>{if(!i||!u)return s(null);let g=Math.hypot(r.clientX-i.x0,r.clientY-i.y0)>4,h={left:Math.min(i.x0,r.clientX),top:Math.min(i.y0,r.clientY),right:Math.max(i.x0,r.clientX),bottom:Math.max(i.y0,r.clientY)};s(null);let c=$t(u,h,!g);c.length>0&&n(c)},l=i?{left:Math.min(i.x0,i.x1),top:Math.min(i.y0,i.y1),width:Math.abs(i.x1-i.x0),height:Math.abs(i.y1-i.y0)}:null;return(0,p.jsxs)("div",{ref:d,tabIndex:-1,role:"application","aria-label":"Highlight the area to change: drag over it, or click one part","data-testid":"section-highlighter","data-graview-popover":"",onKeyDown:r=>{r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),o())},onMouseDown:r=>r.preventDefault(),onPointerDown:r=>{r.preventDefault(),r.currentTarget.setPointerCapture?.(r.pointerId),s({x0:r.clientX,y0:r.clientY,x1:r.clientX,y1:r.clientY})},onPointerMove:r=>s(g=>g&&{...g,x1:r.clientX,y1:r.clientY}),onPointerUp:a,onPointerCancel:()=>s(null),style:Lt,children:[(0,p.jsxs)("p",{style:It,children:["Drag over the part to change, or click one \xB7"," ",(0,p.jsx)("button",{type:"button",onPointerDown:r=>r.stopPropagation(),onClick:()=>n(t.elements),style:Ke,children:"The whole section"})," ","\xB7"," ",(0,p.jsx)("button",{type:"button",onPointerDown:r=>r.stopPropagation(),onClick:o,style:Ke,children:"Cancel"})]}),l?(0,p.jsx)("div",{"data-testid":"section-drag",style:{...Ot,left:l.left-(d.current?.getBoundingClientRect().left??0),top:l.top-(d.current?.getBoundingClientRect().top??0),width:l.width,height:l.height}}):null]})}var Pt={position:"fixed",zIndex:ee("popover"),boxSizing:"border-box",display:"grid",gap:10,padding:12,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float, var(--graview-panel))",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",maxHeight:"calc(100dvh - 24px)",overflowY:"auto",fontSize:"0.875rem"},Tt={margin:0,fontSize:"0.9375rem"},Y={margin:0,color:"var(--graview-ink-muted)"},Et={margin:0,color:"var(--graview-ink)",fontStyle:"italic"},z={display:"flex",flexWrap:"wrap",gap:8},Dt={boxSizing:"border-box",width:"100%",height:36,padding:"0 10px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8},Fe={minHeight:36,padding:"0 14px",font:"inherit",borderRadius:8,cursor:"pointer"},Ge={...Fe,color:"var(--graview-accent-ink, #fff)",background:"var(--graview-accent)",border:"1px solid var(--graview-accent)"},j={...Fe,color:"var(--graview-ink)",background:"transparent",border:"1px solid var(--graview-edge)"},Ke={font:"inherit",color:"inherit",background:"none",border:0,padding:0,textDecoration:"underline",cursor:"pointer"},G=12,Lt={userSelect:"none",WebkitUserSelect:"none",position:"fixed",zIndex:ee("popover"),boxSizing:"border-box",cursor:"crosshair",touchAction:"none",outline:"2px dashed var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 6%, transparent)"},It={position:"absolute",left:8,top:8,margin:0,padding:"4px 10px",borderRadius:999,fontSize:"0.8125rem",color:"var(--graview-ink)",background:"var(--graview-float, var(--graview-panel))",border:"1px solid var(--graview-edge)",boxShadow:"var(--graview-lift-low)",cursor:"default"},Ot={position:"absolute",border:"2px solid var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 14%, transparent)",borderRadius:4,pointerEvents:"none"};export{Mt as SectionCard,en as SectionDrawn,te as SectionOutline};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r,b as m,d as k,e as y}from"./chunk.Q355UPFG.js";import"./chunk.
|
|
1
|
+
import{a as r,b as m,d as k,e as y}from"./chunk.Q355UPFG.js";import"./chunk.MD36ZSM5.js";import"./chunk.L6FGKJ5H.js";import"./chunk.3CJLAJXP.js";import"./chunk.SDO3U72B.js";import"./chunk.J24YPQ5I.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var i="way-back",b='[data-testid="notices-toasts"]';function g(t){let o=document.activeElement;o!==null&&o!==document.body&&!o.closest(b)||(t??document).querySelector('[data-graview-app-bar] [data-testid="app-home"]')?.focus({preventScroll:!0})}function E(t,o,a,d,h){if(t.past)return a?.dismiss(i),()=>{};let c=h?.closest("[data-graview-embed]"),s,f=e=>{if(e!==void 0&&r(t,o)?.batch!==e)return!1;try{let n=k(t,o);return n&&a?.notify({kind:"toast",id:i,sentence:`Took back \u201C${n.intent}\u201D`}),n!==void 0}catch(n){return a?.notify({kind:"toast",id:i,tone:"warn",sentence:n instanceof Error?n.message:String(n)}),!0}},u=()=>{let e=m(t,o,d);if(d=t.batches().length,e){let n=s=e.batch;a?.notify({kind:"toast",id:i,sentence:e.intent,timeout:1e4,action:{label:"Take back",keys:"Meta+Z Control+Z",onSelect:()=>(g(c),f(n))}})}else s&&r(t,o)?.batch!==s&&(s=void 0,a?.dismiss(i))},l=e=>{y(e)&&(!c||c.contains(e.target))&&f()&&e.preventDefault()};u();let p=t.subscribe(u);return document.addEventListener("keydown",l),(e=!1)=>{p(),document.removeEventListener("keydown",l),e&&s&&a?.dismiss(i)}}export{E as sceneWay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as Ce,d as $e,i as U}from"./chunk.2KIWGQXC.js";import{e as Te}from"./chunk.D5LOTCBU.js";import{L as ke,Lc as se,Pb as ae,Qd as Re,Td as De,Vd as We,Wd as Me,bb as Se,da as M,fa as xe,fb as G,ga as W,ka as _,la as z,ma as Ae,oa as we,pa as Ne,pe as je,td as ve,ud as Oe}from"./chunk.Q4MI53KK.js";function V(n,e){return n.display?.labels?.[e]??W(e)}function de(n){let e=U(n);switch(e.type){case"text":case"date":case"number":case"boolean":case"choice":return e.type;default:return}}function Je(n,e){let t=new Map,i=n.tryDefinition(e);for(let[r,a]of Object.entries(i?.edges??{}))t.set(r,{key:r,label:a.description?M(a.description):W(r),about:"edge",far:a.to==="*"?[...n.kinds]:[...a.to]});for(let r of n.definitions)if(r.kind!==e)for(let[a,s]of Object.entries(r.edges??{}))t.has(a)||s.to!=="*"&&!s.to.includes(e)||t.set(a,{key:a,label:s.inverse?M(s.inverse):W(a),about:"edge",far:[r.kind]});return[...t.values()]}var Ze=["current","past","any","flagged","clear"];function Fe(n,e){let t=n?.lifecycle;if(!t||t.retired==="date")return!1;let i=t.retired.map(String);return e.some(r=>r.key===t.field&&i.includes(r.value))}function Be(n,e){let t=n.tryDefinition(e);if(!t)return{kind:e,sorts:[],filters:[],groups:[]};let i=new Set(t.display?.hide??[]),r=t.fields.shape??{},a=[{key:"label",label:"Name",about:"label",type:"text"}],s=[],u=[];for(let[g,k]of Object.entries(r)){if(g==="id"||g==="kind"||g==="label"||i.has(g))continue;let A=en(k);if(A){s.push({key:g,label:V(t,g),about:"field",type:"choice",options:A});continue}let w=de(k);if(!w)continue;let N=V(t,g),O=w==="choice"?Le(k):w==="boolean"?["true","false"]:void 0,S={key:g,label:N,about:"field",type:w,...O?{options:O}:{}};a.push(S),s.push(S),(w==="boolean"||w==="choice")&&u.push(S),w==="date"&&u.push({...S,buckets:["day","week","month","year","decade"]})}for(let g of Je(n,e))a.push(g),s.push(g),u.push(g);let l={key:"is",label:t.lifecycle?"Standing and currency":"Standing",about:"is",type:"choice",options:t.lifecycle?[...Ze]:["flagged","clear"]};s.push(l);let y=t.fieldRoles?.order,f=y&&(y in r||y==="label")?{by:y,direction:"asc"}:void 0;return{kind:e,sorts:a,filters:s,groups:u,...f?{natural:f}:{}}}function On(n,e){let t=[];for(let r of e.filters){let a=r.about==="edge"&&r.far?.length===1?n.tryDefinition(r.far[0]):void 0;if(!(!a||a.kind===e.kind))for(let[s,u]of Object.entries(a.fields.shape??{}))de(u)!=="choice"||a.display?.hide?.includes(s)||t.push({key:`${r.key}.${s}`,label:`${r.label} \xB7 ${V(a,s)}`,about:"via",type:"choice",options:Le(u),far:[a.kind]})}if(t.length===0)return e;let i=e.filters.filter(r=>r.about!=="is");return{...e,filters:[...i,...t,...e.filters.filter(r=>r.about==="is")]}}function Rn(n,e){let t=n.tryDefinition(e.kind),i=Object.entries(t?.computed??{});if(!t||i.length===0)return e;let r=i.filter(([a])=>!e.sorts.some(s=>s.key===a)).map(([a,s])=>({key:a,label:(typeof s=="object"?s.label:void 0)??V(t,a),about:"field",type:"number"}));return{...e,sorts:[...e.sorts,...r]}}function Le(n){let e=U(n);return e.type==="choice"?e.options:[]}function en(n){let e=U(n);return e.type==="several"&&e.of.type==="choice"?e.of.options:void 0}var Ie=n=>n,Pe=n=>n;function nn(n,e,t){let i=new Map;for(let r of[...n.out(e,t),...n.in(e,t)])i.set(r.id,r);return[...i.values()]}function le(n,e,t){let i=n.schema.tryDefinition(e.kind);if(t.key==="is")switch(t.value){case"current":return _(i,Pe(e),n.today);case"past":return!_(i,Pe(e),n.today);case"any":return!0;case"flagged":return n.flagged?.has(e.id)??!1;case"clear":return!(n.flagged?.has(e.id)??!1);default:return!0}let r=i?.fields.shape??{};if(t.key in r){let l=Se(Ie(e),t.key,n.today??ke()),y=de(r[t.key]);if(y==="date"){let[f,g]=t.value.split(":");if(typeof l!="string"||!g)return!1;let k=l.slice(0,10);return f==="before"?k<g:f==="after"?k>g:k===g}if(y==="boolean")return String(l)===t.value;if(Array.isArray(l))return l.some(f=>String(f)===t.value);if(y==="number"){let f=t.value.lastIndexOf(":"),g=f>0?t.value.slice(0,f):"",k=Number(t.value.slice(f+1));if(g==="at-most"||g==="at-least")return typeof l!="number"||!Number.isFinite(k)?!1:g==="at-most"?l<=k:l>=k}return String(l)===t.value}let[a,s]=t.key.split("."),u=nn(n.graph,e.id,a);return s?u.some(l=>String(Ie(l)[s])===t.value):t.value==="*"?u.length>0:t.value==="none"?u.length===0:u.some(l=>l.id===t.value)}var tn=5;function ze(n){return n.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function ce(n){return ze(n).replace(/ /g,"")}var X=new Map,rn=5e4;function $(n){let e=X.get(n);if(e===void 0){X.size>=rn&&X.clear();let t=ze(n);e={tokens:t.split(" ").filter(Boolean),whole:t.replace(/ /g,"")},X.set(n,e)}return e}var T=n=>[...$(n).tokens];function j(n,e){if(e.length===0)return;let{whole:t,tokens:i}=$(n),r=e.join("");if(t.length===0)return;if(t===r)return"exact";if(e.every(s=>i.some(u=>u.startsWith(s))))return t.startsWith(r)?"prefix":e.every(s=>i.includes(s))?"word":"part"}function q(n,e,t=48){let i=n.replace(/\s+/g," ").trim();if(i.length<=t)return i;let r=e[0],a=i.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase(),s=r?a.search(new RegExp(`(^|[^\\p{L}\\p{N}])${on(r)}`,"u")):-1,u=s<0?0:s+(a[s]&&/[\p{L}\p{N}]/u.test(a[s])?0:1),l=Math.max(0,u-Math.floor(t/3));if(l>0){let f=i.lastIndexOf(" ",l);l=f<0?0:f+1}let y=Math.min(i.length,l+t);if(y<i.length){let f=i.indexOf(" ",y);y=f<0||f-y>16?y:f}return`${l>0?"\u2026":""}${i.slice(l,y).trim()}${y<i.length?"\u2026":""}`}var on=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),an=/^([\p{L}][\p{L}\p{N}_-]*):(\S+)$/u;function sn(n){let e=[],t=[];for(let i of n.trim().split(/\s+/).filter(Boolean)){let r=an.exec(i);r?t.push({key:r[1],value:r[2]}):e.push(i)}return{words:e.join(" "),conditions:t}}var Ee=new WeakMap;function Q(n,e){let t=Ee.get(e);if(t&&t.definition===n)return t.texts;let i=dn(n,e);return Ee.set(e,{definition:n,texts:i}),i}function dn(n,e){let t=z(n,e),i=[{field:"label",reading:"Name",text:t}];for(let r of $e(e,n,{limit:Number.POSITIVE_INFINITY}))r.key==="label"||r.value===t||typeof e[r.key]!="boolean"&&i.push({field:r.key,reading:r.label,text:r.markdown?Te(r.value):r.value});return i}var I={exact:0,prefix:1,word:2,part:3,field:4,near:5},Ge=new Set(["a","an","the","of","and","or","for","to","in","on","at","by","with","my","our","is"]);function Ke(n){let e=n;e.length>4&&e.endsWith("ies")?e=`${e.slice(0,-3)}y`:e.length>4&&/(ss|x|ch|sh|z)es$/.test(e)?e=e.slice(0,-2):e.length>3&&e.endsWith("s")&&!/(ss|us|is)$/.test(e)&&(e=e.slice(0,-1));for(let t of["ing","ed"])if(e.length>t.length+2&&e.endsWith(t)){e=e.slice(0,-t.length),/([b-df-hj-km-np-rtv-z])\1$/.test(e)&&(e=e.slice(0,-1));break}return e.length>3&&e.endsWith("e")?e.slice(0,-1):e}function He(n,e,t){if(Math.abs(n.length-e.length)>t)return t+1;let i=[],r=Array.from({length:e.length+1},(a,s)=>s);for(let a=1;a<=n.length;a++){let s=[a],u=a;for(let l=1;l<=e.length;l++){let y=Math.min(r[l]+1,s[l-1]+1,r[l-1]+(n[a-1]===e[l-1]?0:1));a>1&&l>1&&n[a-1]===e[l-2]&&n[a-2]===e[l-1]&&(y=Math.min(y,i[l-2]+1)),s[l]=y,y<u&&(u=y)}if(u>t)return t+1;i=r,r=s}return r[e.length]}var Y=new Map;function ln(n,e){let t=Y.get(n);t||(Y.size>=64&&Y.clear(),Y.set(n,t=new Map));let i=t.get(e);return i===void 0&&(i=cn(n,e)??null,t.set(e,i)),i??void 0}function cn(n,e){if(/\d/.test(n))return;let t=Ke(n);if(t.length>=3&&(Ke(e)===t||t.length>=4&&e.startsWith(t)))return"stem";let i=n.length<4?0:n.length<=7?1:2;if(i!==0){if(He(n,e,i)<=i)return"spelling";if(n.length>=5){for(let r=n.length-i;r<=n.length+i;r++)if(r<e.length&&He(n,e.slice(0,r),i)<=i)return"spelling"}}}function fn(n,e){let t=e.length>1?e.filter(r=>!Ge.has(r)):e;if(t.length===0)return;let i;for(let r of t){let a;for(let s of n){for(let u of $(s.text).tokens){if(u.startsWith(r)){a={text:s,matched:u};break}let l=a?void 0:ln(r,u);l&&(a={text:s,matched:u,by:l})}if(a&&!a.by)break}if(!a)return;a.by&&!i&&(i={text:a.text,asked:r,matched:a.matched,by:a.by})}if(i)return{field:i.text.field,reading:i.text.reading,fragment:q(i.text.text,[i.matched]),strength:"near",asked:i.asked,matched:i.matched,by:i.by}}var un=80;function gn(n,e,t){let i=T(e).filter(s=>!Ge.has(s)).join(" ")||e,r=t===void 0?[]:T(t),a=r.length>0&&n.find(s=>r.every(u=>$(s.text).tokens.some(l=>l.startsWith(u))))||n[0];return{field:a.field,reading:a.reading,fragment:q(a.text,r),strength:"near",asked:i,matched:(t??a.text).slice(0,un),by:"meaning"}}function _e(n,e,t,i){let r=T(t);if(r.length===0)return;if(i){let A=Q(n,e),w=i.includes("label")||i.some(v=>typeof e[v]=="string"&&e[v]===A[0].text),N=A.filter((v,D)=>D===0?w:i.includes(v.field)),O=v=>D=>$(D.text).tokens.some(P=>P.startsWith(v));if(!r.every(v=>N.some(O(v))))return;let S=N.find(O(r[0]));return{field:S.field,reading:S.reading,fragment:q(S.text,r),strength:S.field==="label"?j(S.text,r)??"field":"field"}}let a=Q(n,e),[s,...u]=a,l=j(s.text,r);if(l)return{field:"label",reading:s.reading,fragment:q(s.text,r),strength:l};let y=A=>w=>$(w.text).tokens.some(N=>N.startsWith(A));if(!r.every(A=>a.some(y(A))))return;let f=T(s.text),g=r.find(A=>!f.some(w=>w.startsWith(A)))??r[0],k=u.find(y(g));return{field:k.field,reading:k.reading,fragment:q(k.text,[g]),strength:"field"}}var yn=512,hn=64;function pn(n){let e=new Map;if(n.length===0)return e;let t=n.slice(-yn),i=n[n.length-1].seq;for(let r of t){let a=Math.pow(.5,(i-r.seq)/hn);for(let s of r.writes)e.set(s,(e.get(s)??0)+a)}return e}var ue=(n,e)=>we({tryDefinition:()=>n},e),fe=(n,e)=>De({tryDefinition:()=>n},e);function mn(n,e,t){let i=n.tryDefinition(e),r=[{field:"plural",text:ue(i,e)},{field:"kind",text:W(e)},...i?.noun?[{field:"noun",text:i.noun}]:[],...(i?.aliases??[]).map(s=>({field:"alias",text:s}))],a;for(let s of r){let u=j(s.text,t);u&&(!a||I[u]<I[a.strength])&&(a={strength:u,...s})}return a}var bn,kn=(n,e)=>(bn??=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0})).compare(n,e),qe=(n,e)=>(n.nearly??0)-(e.nearly??0)||(n.archived??0)-(e.archived??0)||n.tier-e.tier||n.inKind-e.inKind||n.near-e.near||n.past-e.past||n.touched-e.touched||n.flagged-e.flagged||kn(n.name,e.name)||(n.id<e.id?-1:n.id>e.id?1:0);function En(n,e,t={}){let i=n.schema,r=sn(e),a=T(r.words),s=t.principal??{kind:"human"},u=n.kindsKeptFrom(s),l=n.modules.disabledKinds,y=r.conditions.filter(o=>o.key==="kind").map(o=>o.value),f=r.conditions.filter(o=>o.key==="is").map(o=>o.value),g=f.includes("any")||f.includes("past"),k=f.includes("past")&&!f.includes("any")&&!f.includes("current"),A=f.includes("archived")?!0:t.archived??"all",w=(o,d)=>{let c=ce(d),h=i.tryDefinition(o);return ce(o)===c||ce(ue(h,o))===c},N=i.kinds.filter(o=>!u.has(o)&&!l.has(o)&&(t.kinds===void 0||t.kinds.includes(o))&&(y.length===0||y.some(d=>w(o,d)))),S=r.conditions.filter(o=>o.key!=="kind").map(o=>({...o,admittedBy:N.filter(d=>Be(i,d).filters.some(c=>c.key===o.key))})),v=S.filter(o=>o.key!=="is"),D=f.filter(o=>o==="flagged"||o==="clear"||o==="past"||o==="archived"),P={kinds:N,past:g},Qe={hits:[],words:r.words,conditions:S,searched:P,byKind:{},total:0,matched:[]};if(a.length===0&&v.length===0&&D.length===0)return Qe;let J=t.today,F=t.flagged??new Set(n.violations().flatMap(o=>o.nodeIds)),Ue=t.touched??pn(n.log.all()),Z=new Set;for(let o of t.from??[]){Z.add(o);for(let d of n.graph.neighbors(o))Z.add(d.id)}let ge=ve(n,s)?Oe(n,s):void 0,ee=ae.keptFrom?.(n,s)&&n.seenBy(s).graph,ne=o=>je(o,t.basePath===void 0?{}:{basePath:t.basePath}),ye={schema:i,graph:n.graph,flagged:F,...J?{today:J}:{}},R=[],B={},L=[],E=[],K=(o,d,c,h,p,m)=>{let x=z(c,o);B[d]=(B[d]??0)+1,R.push({hit:{about:"node",id:o.id,kind:d,label:x,why:p,current:h,flagged:F.has(o.id),address:ne(`${fe(c,d)}/${encodeURIComponent(o.id)}`),...m===void 0?{}:{near:!0},...G(o)?{archived:!0}:{}},...m===void 0?{}:{nearly:2-m},tier:I[p.strength],inKind:d===t.inKind?0:1,near:Z.has(o.id)?0:1,past:h?0:1,archived:G(o)?1:0,touched:-(Ue.get(o.id)??0),flagged:F.has(o.id)?0:1,name:x,id:o.id})};for(let o of N){let d=i.tryDefinition(o),c=S.filter(p=>p.key!=="is"&&p.admittedBy.includes(o));if(a.length===0&&c.length===0&&D.length===0)continue;let h=Fe(d,c);for(let p of n.graph.nodesOfKind(o,{archived:A})){if(ge&&!ge(p.id))continue;let m=ee?ee.getNode(p.id):p;if(!m)continue;let x=_(d,m,J);if(!g&&!h&&!x){if(a.length>0&&f.length===0&&c.every(b=>le(ye,m,b))){let b=_e(d,m,r.words);b&&E.push({node:m,kind:o,definition:d,why:b})}continue}if(k&&x||!c.every(b=>le(ye,m,b))||f.includes("flagged")&&!F.has(m.id)||f.includes("clear")&&F.has(m.id))continue;let C=a.length>0?_e(d,m,r.words):c[0]?{field:c[0].key,reading:W(c[0].key),fragment:`${c[0].key}:${c[0].value}`,strength:"field"}:{field:"is",reading:"Is",fragment:`is:${D[0]}`,strength:"field"};C?K(m,o,d,x,C):a.length>0&&L.push({node:m,kind:o,definition:d,current:x})}}let te=o=>o.strength!=="field",re=!1;if(E.length>0&&R.length===0){re=!0;for(let o of E)K(o.node,o.kind,o.definition,!1,o.why)}else if(E.some(o=>te(o.why))&&!R.some(o=>te(o.hit.why))){re=!0;for(let o of E)te(o.why)&&K(o.node,o.kind,o.definition,!1,o.why)}let he=t.near!==!1&&a.length>0&&R.length<tn&&L.length>0,ie=new Set;if(he)for(let o of L){let d=fn(Q(o.definition,o.node),a);d&&(ie.add(o.node.id),K(o.node,o.kind,o.definition,o.current,d,d.by==="stem"?.9:.8))}let Ve=o=>o==="exact"||o==="prefix"?-1:I[o],oe=(o,d,c,h)=>({hit:o,tier:Ve(d),inKind:1,near:1,past:0,touched:0,flagged:1,name:c,id:h});if(a.length>0){for(let d of N){let c=mn(i,d,a);if(!c)continue;let h=Ne(i,d),p={field:c.field,reading:c.field==="plural"?"Plural":"Kind",fragment:c.text,strength:c.strength};R.push(oe({about:"kind",kind:d,label:h,why:p,count:B[d]??0,address:ne(fe(i.tryDefinition(d),d))},c.strength,h,`kind:${d}`))}let o=t.places??[];for(let d of Re(o.filter(c=>N.includes(c.kind)))){if(d.across&&u.has(d.across))continue;let c=j(d.title,a);if(!c)continue;let h={field:"title",reading:"Title",fragment:d.title,strength:c},p=Me(d,o)?fe(i.tryDefinition(d.kind),d.kind).slice(1):void 0,m=ne(We(d.as,p));R.push(oe({about:"place",kind:d.kind,title:d.title,as:d.as,why:h,address:m},c,d.title,`place:${d.kind}:${d.as}`))}for(let d of n.allInvariants()){let c=d.scope==="graph"?void 0:d.scope.kind;if(c&&!N.includes(c))continue;let h=d.label??W(d.name),p=j(h,a),m=p?void 0:j(W(d.name),a),x=p??m;if(!x)continue;let C={field:p?"label":"name",reading:p?"Rule":"Name",fragment:p?h:d.name,strength:x};R.push(oe({about:"rule",name:d.name,label:h,...c?{kind:c}:{},why:C},x,h,`rule:${d.name}`))}}let pe=()=>{R.sort(qe);let o=t.limit??50,d=R.slice(0,o).map(b=>b.hit),c=d.flatMap(b=>b.about==="node"?[(ee||n.graph).getNode(b.id)]:[]).filter(Boolean),h=Ce(c,b=>i.tryDefinition(b)),p=d.map(b=>b.about==="node"&&h.has(b.id)?{...b,apart:h.get(b.id)}:b),m=Object.values(B).reduce((b,Ye)=>b+Ye,0),x=R.flatMap(b=>b.hit.about==="node"?[b.hit.id]:[]),C=t.subject&&N.includes(String(n.graph.getNode(t.subject)?.kind))?xn(n,t.subject,r.words,{principal:s}):[];return{hits:[...p,...C],words:r.words,conditions:S,searched:re?{...P,past:!0}:P,byKind:{...B},total:m,matched:x}},H=pe(),me=t.rank;if(!he||!me)return H;let be=L.filter(o=>!ie.has(o.node.id)).map(({node:o,kind:d,definition:c})=>({id:o.id,kind:d,label:z(c,o),texts:Q(c,o)}));if(be.length===0)return H;let Xe=(async()=>{let o;try{o=await me(r.words,be)}catch{return H}let d=new Map(L.filter(h=>!ie.has(h.node.id)).map(h=>[h.node.id,h])),c=!1;for(let{id:h,score:p,matched:m}of Array.isArray(o)?o:[]){let x=d.get(h);!x||!(p>0)||(d.delete(h),c=!0,K(x.node,x.kind,x.definition,x.current,gn(Q(x.definition,x.node),r.words,typeof m=="string"?m:void 0),Math.min(1,p)))}return c?pe():H})();return{...H,later:Xe}}function xn(n,e,t,i={}){let r=i.principal??{kind:"human"},a=(ae.keptFrom?.(n,r)?n.seenBy(r):n).graph.getNode(e);if(!a)return[];if(n.kindsKeptFrom(r).has(a.kind))return[];let s=T(t),u=z(n.schema.tryDefinition(a.kind),a),l=[];for(let f of n.allMutations()){let g=f.subject;if(!g||g.kinds!=="*"&&!g.kinds.includes(a.kind))continue;let k=f.derived?.act;if((k==="archive"||k==="merge")&&G(a)||k==="unarchive"&&!G(a)||k==="leave-alone"&&se(a)||k==="allow-tidying"&&!se(a)||!n.permits({name:f.name,args:{[g.arg]:a.id}},r).ok)continue;let A=Ae(f),w=T(A),N=s.filter(v=>w.some(D=>D.startsWith(v))),O=N.length>0?j(A,N):void 0,S=O?{field:"title",reading:"Act",fragment:A,strength:O}:{field:"subject",reading:"On",fragment:u,strength:"field"};l.push({hit:{about:"act",name:f.name,title:A,subject:a.id,why:S,destructive:f.destructive===!0},tier:O?I[O]:I.field+1,inKind:0,near:0,past:f.destructive?1:0,touched:0,flagged:f.pinned?0:1,name:A,id:`act:${f.name}`})}l.sort(qe);let y=l.map(f=>f.hit);return i.limit===void 0?y:y.slice(0,i.limit)}function Kn(n,e){let t=e.kinds.map((a,s)=>{let u=ue(n.tryDefinition(a),a);return s===0?u:u.toLowerCase()}),i=xe(t)||"Nothing";return e.kinds.some(a=>n.tryDefinition(a)?.lifecycle)?e.past?`${M(i)}, past ones included.`:`${M(i)}, current ones; add is:any for past ones.`:`${M(i)}.`}export{V as a,de as b,Je as c,Fe as d,Be as e,On as f,Rn as g,Le as h,Ie as i,Pe as j,nn as k,le as l,ze as m,ce as n,sn as o,_e as p,pn as q,En as r,xn as s,Kn as t};
|
|
1
|
+
import{b as Ce,d as $e,i as U}from"./chunk.FOSY7MZF.js";import{d as Te}from"./chunk.NBVPWLRY.js";import{L as ke,Lc as se,Pb as ae,Sd as Re,Vd as De,Xd as We,Yd as Me,bb as Se,da as M,fa as xe,fb as G,ga as W,ka as _,la as z,ma as Ae,oa as we,pa as Ne,re as je,vd as ve,wd as Oe}from"./chunk.J24YPQ5I.js";function V(n,e){return n.display?.labels?.[e]??W(e)}function de(n){let e=U(n);switch(e.type){case"text":case"date":case"number":case"boolean":case"choice":return e.type;default:return}}function Je(n,e){let t=new Map,i=n.tryDefinition(e);for(let[r,a]of Object.entries(i?.edges??{}))t.set(r,{key:r,label:a.description?M(a.description):W(r),about:"edge",far:a.to==="*"?[...n.kinds]:[...a.to]});for(let r of n.definitions)if(r.kind!==e)for(let[a,s]of Object.entries(r.edges??{}))t.has(a)||s.to!=="*"&&!s.to.includes(e)||t.set(a,{key:a,label:s.inverse?M(s.inverse):W(a),about:"edge",far:[r.kind]});return[...t.values()]}var Ze=["current","past","any","flagged","clear"];function Fe(n,e){let t=n?.lifecycle;if(!t||t.retired==="date")return!1;let i=t.retired.map(String);return e.some(r=>r.key===t.field&&i.includes(r.value))}function Be(n,e){let t=n.tryDefinition(e);if(!t)return{kind:e,sorts:[],filters:[],groups:[]};let i=new Set(t.display?.hide??[]),r=t.fields.shape??{},a=[{key:"label",label:"Name",about:"label",type:"text"}],s=[],u=[];for(let[g,k]of Object.entries(r)){if(g==="id"||g==="kind"||g==="label"||i.has(g))continue;let A=en(k);if(A){s.push({key:g,label:V(t,g),about:"field",type:"choice",options:A});continue}let w=de(k);if(!w)continue;let N=V(t,g),O=w==="choice"?Le(k):w==="boolean"?["true","false"]:void 0,S={key:g,label:N,about:"field",type:w,...O?{options:O}:{}};a.push(S),s.push(S),(w==="boolean"||w==="choice")&&u.push(S),w==="date"&&u.push({...S,buckets:["day","week","month","year","decade"]})}for(let g of Je(n,e))a.push(g),s.push(g),u.push(g);let l={key:"is",label:t.lifecycle?"Standing and currency":"Standing",about:"is",type:"choice",options:t.lifecycle?[...Ze]:["flagged","clear"]};s.push(l);let y=t.fieldRoles?.order,f=y&&(y in r||y==="label")?{by:y,direction:"asc"}:void 0;return{kind:e,sorts:a,filters:s,groups:u,...f?{natural:f}:{}}}function On(n,e){let t=[];for(let r of e.filters){let a=r.about==="edge"&&r.far?.length===1?n.tryDefinition(r.far[0]):void 0;if(!(!a||a.kind===e.kind))for(let[s,u]of Object.entries(a.fields.shape??{}))de(u)!=="choice"||a.display?.hide?.includes(s)||t.push({key:`${r.key}.${s}`,label:`${r.label} \xB7 ${V(a,s)}`,about:"via",type:"choice",options:Le(u),far:[a.kind]})}if(t.length===0)return e;let i=e.filters.filter(r=>r.about!=="is");return{...e,filters:[...i,...t,...e.filters.filter(r=>r.about==="is")]}}function Rn(n,e){let t=n.tryDefinition(e.kind),i=Object.entries(t?.computed??{});if(!t||i.length===0)return e;let r=i.filter(([a])=>!e.sorts.some(s=>s.key===a)).map(([a,s])=>({key:a,label:(typeof s=="object"?s.label:void 0)??V(t,a),about:"field",type:"number"}));return{...e,sorts:[...e.sorts,...r]}}function Le(n){let e=U(n);return e.type==="choice"?e.options:[]}function en(n){let e=U(n);return e.type==="several"&&e.of.type==="choice"?e.of.options:void 0}var Ie=n=>n,Pe=n=>n;function nn(n,e,t){let i=new Map;for(let r of[...n.out(e,t),...n.in(e,t)])i.set(r.id,r);return[...i.values()]}function le(n,e,t){let i=n.schema.tryDefinition(e.kind);if(t.key==="is")switch(t.value){case"current":return _(i,Pe(e),n.today);case"past":return!_(i,Pe(e),n.today);case"any":return!0;case"flagged":return n.flagged?.has(e.id)??!1;case"clear":return!(n.flagged?.has(e.id)??!1);default:return!0}let r=i?.fields.shape??{};if(t.key in r){let l=Se(Ie(e),t.key,n.today??ke()),y=de(r[t.key]);if(y==="date"){let[f,g]=t.value.split(":");if(typeof l!="string"||!g)return!1;let k=l.slice(0,10);return f==="before"?k<g:f==="after"?k>g:k===g}if(y==="boolean")return String(l)===t.value;if(Array.isArray(l))return l.some(f=>String(f)===t.value);if(y==="number"){let f=t.value.lastIndexOf(":"),g=f>0?t.value.slice(0,f):"",k=Number(t.value.slice(f+1));if(g==="at-most"||g==="at-least")return typeof l!="number"||!Number.isFinite(k)?!1:g==="at-most"?l<=k:l>=k}return String(l)===t.value}let[a,s]=t.key.split("."),u=nn(n.graph,e.id,a);return s?u.some(l=>String(Ie(l)[s])===t.value):t.value==="*"?u.length>0:t.value==="none"?u.length===0:u.some(l=>l.id===t.value)}var tn=5;function ze(n){return n.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function ce(n){return ze(n).replace(/ /g,"")}var X=new Map,rn=5e4;function $(n){let e=X.get(n);if(e===void 0){X.size>=rn&&X.clear();let t=ze(n);e={tokens:t.split(" ").filter(Boolean),whole:t.replace(/ /g,"")},X.set(n,e)}return e}var T=n=>[...$(n).tokens];function j(n,e){if(e.length===0)return;let{whole:t,tokens:i}=$(n),r=e.join("");if(t.length===0)return;if(t===r)return"exact";if(e.every(s=>i.some(u=>u.startsWith(s))))return t.startsWith(r)?"prefix":e.every(s=>i.includes(s))?"word":"part"}function q(n,e,t=48){let i=n.replace(/\s+/g," ").trim();if(i.length<=t)return i;let r=e[0],a=i.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase(),s=r?a.search(new RegExp(`(^|[^\\p{L}\\p{N}])${on(r)}`,"u")):-1,u=s<0?0:s+(a[s]&&/[\p{L}\p{N}]/u.test(a[s])?0:1),l=Math.max(0,u-Math.floor(t/3));if(l>0){let f=i.lastIndexOf(" ",l);l=f<0?0:f+1}let y=Math.min(i.length,l+t);if(y<i.length){let f=i.indexOf(" ",y);y=f<0||f-y>16?y:f}return`${l>0?"\u2026":""}${i.slice(l,y).trim()}${y<i.length?"\u2026":""}`}var on=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),an=/^([\p{L}][\p{L}\p{N}_-]*):(\S+)$/u;function sn(n){let e=[],t=[];for(let i of n.trim().split(/\s+/).filter(Boolean)){let r=an.exec(i);r?t.push({key:r[1],value:r[2]}):e.push(i)}return{words:e.join(" "),conditions:t}}var Ee=new WeakMap;function Q(n,e){let t=Ee.get(e);if(t&&t.definition===n)return t.texts;let i=dn(n,e);return Ee.set(e,{definition:n,texts:i}),i}function dn(n,e){let t=z(n,e),i=[{field:"label",reading:"Name",text:t}];for(let r of $e(e,n,{limit:Number.POSITIVE_INFINITY}))r.key==="label"||r.value===t||typeof e[r.key]!="boolean"&&i.push({field:r.key,reading:r.label,text:r.markdown?Te(r.value):r.value});return i}var I={exact:0,prefix:1,word:2,part:3,field:4,near:5},Ge=new Set(["a","an","the","of","and","or","for","to","in","on","at","by","with","my","our","is"]);function Ke(n){let e=n;e.length>4&&e.endsWith("ies")?e=`${e.slice(0,-3)}y`:e.length>4&&/(ss|x|ch|sh|z)es$/.test(e)?e=e.slice(0,-2):e.length>3&&e.endsWith("s")&&!/(ss|us|is)$/.test(e)&&(e=e.slice(0,-1));for(let t of["ing","ed"])if(e.length>t.length+2&&e.endsWith(t)){e=e.slice(0,-t.length),/([b-df-hj-km-np-rtv-z])\1$/.test(e)&&(e=e.slice(0,-1));break}return e.length>3&&e.endsWith("e")?e.slice(0,-1):e}function He(n,e,t){if(Math.abs(n.length-e.length)>t)return t+1;let i=[],r=Array.from({length:e.length+1},(a,s)=>s);for(let a=1;a<=n.length;a++){let s=[a],u=a;for(let l=1;l<=e.length;l++){let y=Math.min(r[l]+1,s[l-1]+1,r[l-1]+(n[a-1]===e[l-1]?0:1));a>1&&l>1&&n[a-1]===e[l-2]&&n[a-2]===e[l-1]&&(y=Math.min(y,i[l-2]+1)),s[l]=y,y<u&&(u=y)}if(u>t)return t+1;i=r,r=s}return r[e.length]}var Y=new Map;function ln(n,e){let t=Y.get(n);t||(Y.size>=64&&Y.clear(),Y.set(n,t=new Map));let i=t.get(e);return i===void 0&&(i=cn(n,e)??null,t.set(e,i)),i??void 0}function cn(n,e){if(/\d/.test(n))return;let t=Ke(n);if(t.length>=3&&(Ke(e)===t||t.length>=4&&e.startsWith(t)))return"stem";let i=n.length<4?0:n.length<=7?1:2;if(i!==0){if(He(n,e,i)<=i)return"spelling";if(n.length>=5){for(let r=n.length-i;r<=n.length+i;r++)if(r<e.length&&He(n,e.slice(0,r),i)<=i)return"spelling"}}}function fn(n,e){let t=e.length>1?e.filter(r=>!Ge.has(r)):e;if(t.length===0)return;let i;for(let r of t){let a;for(let s of n){for(let u of $(s.text).tokens){if(u.startsWith(r)){a={text:s,matched:u};break}let l=a?void 0:ln(r,u);l&&(a={text:s,matched:u,by:l})}if(a&&!a.by)break}if(!a)return;a.by&&!i&&(i={text:a.text,asked:r,matched:a.matched,by:a.by})}if(i)return{field:i.text.field,reading:i.text.reading,fragment:q(i.text.text,[i.matched]),strength:"near",asked:i.asked,matched:i.matched,by:i.by}}var un=80;function gn(n,e,t){let i=T(e).filter(s=>!Ge.has(s)).join(" ")||e,r=t===void 0?[]:T(t),a=r.length>0&&n.find(s=>r.every(u=>$(s.text).tokens.some(l=>l.startsWith(u))))||n[0];return{field:a.field,reading:a.reading,fragment:q(a.text,r),strength:"near",asked:i,matched:(t??a.text).slice(0,un),by:"meaning"}}function _e(n,e,t,i){let r=T(t);if(r.length===0)return;if(i){let A=Q(n,e),w=i.includes("label")||i.some(v=>typeof e[v]=="string"&&e[v]===A[0].text),N=A.filter((v,D)=>D===0?w:i.includes(v.field)),O=v=>D=>$(D.text).tokens.some(P=>P.startsWith(v));if(!r.every(v=>N.some(O(v))))return;let S=N.find(O(r[0]));return{field:S.field,reading:S.reading,fragment:q(S.text,r),strength:S.field==="label"?j(S.text,r)??"field":"field"}}let a=Q(n,e),[s,...u]=a,l=j(s.text,r);if(l)return{field:"label",reading:s.reading,fragment:q(s.text,r),strength:l};let y=A=>w=>$(w.text).tokens.some(N=>N.startsWith(A));if(!r.every(A=>a.some(y(A))))return;let f=T(s.text),g=r.find(A=>!f.some(w=>w.startsWith(A)))??r[0],k=u.find(y(g));return{field:k.field,reading:k.reading,fragment:q(k.text,[g]),strength:"field"}}var yn=512,hn=64;function pn(n){let e=new Map;if(n.length===0)return e;let t=n.slice(-yn),i=n[n.length-1].seq;for(let r of t){let a=Math.pow(.5,(i-r.seq)/hn);for(let s of r.writes)e.set(s,(e.get(s)??0)+a)}return e}var ue=(n,e)=>we({tryDefinition:()=>n},e),fe=(n,e)=>De({tryDefinition:()=>n},e);function mn(n,e,t){let i=n.tryDefinition(e),r=[{field:"plural",text:ue(i,e)},{field:"kind",text:W(e)},...i?.noun?[{field:"noun",text:i.noun}]:[],...(i?.aliases??[]).map(s=>({field:"alias",text:s}))],a;for(let s of r){let u=j(s.text,t);u&&(!a||I[u]<I[a.strength])&&(a={strength:u,...s})}return a}var bn,kn=(n,e)=>(bn??=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0})).compare(n,e),qe=(n,e)=>(n.nearly??0)-(e.nearly??0)||(n.archived??0)-(e.archived??0)||n.tier-e.tier||n.inKind-e.inKind||n.near-e.near||n.past-e.past||n.touched-e.touched||n.flagged-e.flagged||kn(n.name,e.name)||(n.id<e.id?-1:n.id>e.id?1:0);function En(n,e,t={}){let i=n.schema,r=sn(e),a=T(r.words),s=t.principal??{kind:"human"},u=n.kindsKeptFrom(s),l=n.modules.disabledKinds,y=r.conditions.filter(o=>o.key==="kind").map(o=>o.value),f=r.conditions.filter(o=>o.key==="is").map(o=>o.value),g=f.includes("any")||f.includes("past"),k=f.includes("past")&&!f.includes("any")&&!f.includes("current"),A=f.includes("archived")?!0:t.archived??"all",w=(o,d)=>{let c=ce(d),h=i.tryDefinition(o);return ce(o)===c||ce(ue(h,o))===c},N=i.kinds.filter(o=>!u.has(o)&&!l.has(o)&&(t.kinds===void 0||t.kinds.includes(o))&&(y.length===0||y.some(d=>w(o,d)))),S=r.conditions.filter(o=>o.key!=="kind").map(o=>({...o,admittedBy:N.filter(d=>Be(i,d).filters.some(c=>c.key===o.key))})),v=S.filter(o=>o.key!=="is"),D=f.filter(o=>o==="flagged"||o==="clear"||o==="past"||o==="archived"),P={kinds:N,past:g},Qe={hits:[],words:r.words,conditions:S,searched:P,byKind:{},total:0,matched:[]};if(a.length===0&&v.length===0&&D.length===0)return Qe;let J=t.today,F=t.flagged??new Set(n.violations().flatMap(o=>o.nodeIds)),Ue=t.touched??pn(n.log.all()),Z=new Set;for(let o of t.from??[]){Z.add(o);for(let d of n.graph.neighbors(o))Z.add(d.id)}let ge=ve(n,s)?Oe(n,s):void 0,ee=ae.keptFrom?.(n,s)&&n.seenBy(s).graph,ne=o=>je(o,t.basePath===void 0?{}:{basePath:t.basePath}),ye={schema:i,graph:n.graph,flagged:F,...J?{today:J}:{}},R=[],B={},L=[],E=[],K=(o,d,c,h,p,m)=>{let x=z(c,o);B[d]=(B[d]??0)+1,R.push({hit:{about:"node",id:o.id,kind:d,label:x,why:p,current:h,flagged:F.has(o.id),address:ne(`${fe(c,d)}/${encodeURIComponent(o.id)}`),...m===void 0?{}:{near:!0},...G(o)?{archived:!0}:{}},...m===void 0?{}:{nearly:2-m},tier:I[p.strength],inKind:d===t.inKind?0:1,near:Z.has(o.id)?0:1,past:h?0:1,archived:G(o)?1:0,touched:-(Ue.get(o.id)??0),flagged:F.has(o.id)?0:1,name:x,id:o.id})};for(let o of N){let d=i.tryDefinition(o),c=S.filter(p=>p.key!=="is"&&p.admittedBy.includes(o));if(a.length===0&&c.length===0&&D.length===0)continue;let h=Fe(d,c);for(let p of n.graph.nodesOfKind(o,{archived:A})){if(ge&&!ge(p.id))continue;let m=ee?ee.getNode(p.id):p;if(!m)continue;let x=_(d,m,J);if(!g&&!h&&!x){if(a.length>0&&f.length===0&&c.every(b=>le(ye,m,b))){let b=_e(d,m,r.words);b&&E.push({node:m,kind:o,definition:d,why:b})}continue}if(k&&x||!c.every(b=>le(ye,m,b))||f.includes("flagged")&&!F.has(m.id)||f.includes("clear")&&F.has(m.id))continue;let C=a.length>0?_e(d,m,r.words):c[0]?{field:c[0].key,reading:W(c[0].key),fragment:`${c[0].key}:${c[0].value}`,strength:"field"}:{field:"is",reading:"Is",fragment:`is:${D[0]}`,strength:"field"};C?K(m,o,d,x,C):a.length>0&&L.push({node:m,kind:o,definition:d,current:x})}}let te=o=>o.strength!=="field",re=!1;if(E.length>0&&R.length===0){re=!0;for(let o of E)K(o.node,o.kind,o.definition,!1,o.why)}else if(E.some(o=>te(o.why))&&!R.some(o=>te(o.hit.why))){re=!0;for(let o of E)te(o.why)&&K(o.node,o.kind,o.definition,!1,o.why)}let he=t.near!==!1&&a.length>0&&R.length<tn&&L.length>0,ie=new Set;if(he)for(let o of L){let d=fn(Q(o.definition,o.node),a);d&&(ie.add(o.node.id),K(o.node,o.kind,o.definition,o.current,d,d.by==="stem"?.9:.8))}let Ve=o=>o==="exact"||o==="prefix"?-1:I[o],oe=(o,d,c,h)=>({hit:o,tier:Ve(d),inKind:1,near:1,past:0,touched:0,flagged:1,name:c,id:h});if(a.length>0){for(let d of N){let c=mn(i,d,a);if(!c)continue;let h=Ne(i,d),p={field:c.field,reading:c.field==="plural"?"Plural":"Kind",fragment:c.text,strength:c.strength};R.push(oe({about:"kind",kind:d,label:h,why:p,count:B[d]??0,address:ne(fe(i.tryDefinition(d),d))},c.strength,h,`kind:${d}`))}let o=t.places??[];for(let d of Re(o.filter(c=>N.includes(c.kind)))){if(d.across&&u.has(d.across))continue;let c=j(d.title,a);if(!c)continue;let h={field:"title",reading:"Title",fragment:d.title,strength:c},p=Me(d,o)?fe(i.tryDefinition(d.kind),d.kind).slice(1):void 0,m=ne(We(d.as,p));R.push(oe({about:"place",kind:d.kind,title:d.title,as:d.as,why:h,address:m},c,d.title,`place:${d.kind}:${d.as}`))}for(let d of n.allInvariants()){let c=d.scope==="graph"?void 0:d.scope.kind;if(c&&!N.includes(c))continue;let h=d.label??W(d.name),p=j(h,a),m=p?void 0:j(W(d.name),a),x=p??m;if(!x)continue;let C={field:p?"label":"name",reading:p?"Rule":"Name",fragment:p?h:d.name,strength:x};R.push(oe({about:"rule",name:d.name,label:h,...c?{kind:c}:{},why:C},x,h,`rule:${d.name}`))}}let pe=()=>{R.sort(qe);let o=t.limit??50,d=R.slice(0,o).map(b=>b.hit),c=d.flatMap(b=>b.about==="node"?[(ee||n.graph).getNode(b.id)]:[]).filter(Boolean),h=Ce(c,b=>i.tryDefinition(b)),p=d.map(b=>b.about==="node"&&h.has(b.id)?{...b,apart:h.get(b.id)}:b),m=Object.values(B).reduce((b,Ye)=>b+Ye,0),x=R.flatMap(b=>b.hit.about==="node"?[b.hit.id]:[]),C=t.subject&&N.includes(String(n.graph.getNode(t.subject)?.kind))?xn(n,t.subject,r.words,{principal:s}):[];return{hits:[...p,...C],words:r.words,conditions:S,searched:re?{...P,past:!0}:P,byKind:{...B},total:m,matched:x}},H=pe(),me=t.rank;if(!he||!me)return H;let be=L.filter(o=>!ie.has(o.node.id)).map(({node:o,kind:d,definition:c})=>({id:o.id,kind:d,label:z(c,o),texts:Q(c,o)}));if(be.length===0)return H;let Xe=(async()=>{let o;try{o=await me(r.words,be)}catch{return H}let d=new Map(L.filter(h=>!ie.has(h.node.id)).map(h=>[h.node.id,h])),c=!1;for(let{id:h,score:p,matched:m}of Array.isArray(o)?o:[]){let x=d.get(h);!x||!(p>0)||(d.delete(h),c=!0,K(x.node,x.kind,x.definition,x.current,gn(Q(x.definition,x.node),r.words,typeof m=="string"?m:void 0),Math.min(1,p)))}return c?pe():H})();return{...H,later:Xe}}function xn(n,e,t,i={}){let r=i.principal??{kind:"human"},a=(ae.keptFrom?.(n,r)?n.seenBy(r):n).graph.getNode(e);if(!a)return[];if(n.kindsKeptFrom(r).has(a.kind))return[];let s=T(t),u=z(n.schema.tryDefinition(a.kind),a),l=[];for(let f of n.allMutations()){let g=f.subject;if(!g||g.kinds!=="*"&&!g.kinds.includes(a.kind))continue;let k=f.derived?.act;if((k==="archive"||k==="merge")&&G(a)||k==="unarchive"&&!G(a)||k==="leave-alone"&&se(a)||k==="allow-tidying"&&!se(a)||!n.permits({name:f.name,args:{[g.arg]:a.id}},r).ok)continue;let A=Ae(f),w=T(A),N=s.filter(v=>w.some(D=>D.startsWith(v))),O=N.length>0?j(A,N):void 0,S=O?{field:"title",reading:"Act",fragment:A,strength:O}:{field:"subject",reading:"On",fragment:u,strength:"field"};l.push({hit:{about:"act",name:f.name,title:A,subject:a.id,why:S,destructive:f.destructive===!0},tier:O?I[O]:I.field+1,inKind:0,near:0,past:f.destructive?1:0,touched:0,flagged:f.pinned?0:1,name:A,id:`act:${f.name}`})}l.sort(qe);let y=l.map(f=>f.hit);return i.limit===void 0?y:y.slice(0,i.limit)}function Kn(n,e){let t=e.kinds.map((a,s)=>{let u=ue(n.tryDefinition(a),a);return s===0?u:u.toLowerCase()}),i=xe(t)||"Nothing";return e.kinds.some(a=>n.tryDefinition(a)?.lifecycle)?e.past?`${M(i)}, past ones included.`:`${M(i)}, current ones; add is:any for past ones.`:`${M(i)}.`}export{V as a,de as b,Je as c,Fe as d,Be as e,On as f,Rn as g,Le as h,Ie as i,Pe as j,nn as k,le as l,ze as m,ce as n,sn as o,_e as p,pn as q,En as r,xn as s,Kn as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as kn,c as bn,d as oe,e as wn,f as Y,h as Ee,i as je,n as vn,s as se,u as On}from"./chunk.FNVGNISQ.js";import{B as be,C as ue,Da as Oe,F as _e,Ga as en,H as He,Ja as nn,K as Ue,L as We,La as tn,Mb as U,Pa as xe,Qa as Re,Rb as cn,Sb as ln,Sc as mn,Ub as fn,Wa as rn,Za as on,Zb as pn,b as Fe,c as Ne,cc as un,cd as gn,d as Ce,dd as yn,e as K,ed as Ae,fd as hn,g as ye,ga as Je,gd as ze,h as Z,ha as Ye,i as Ie,j as Ve,ja as Qe,jb as an,k as he,l as Ke,m as Ze,mb as sn,o as qe,p as fe,q as ve,rb as Se,sa as Xe,sb as dn,v as Be,x as pe,z as ke}from"./chunk.Q4MI53KK.js";var Tn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],q=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function xn(e,d=Tn){if(!q(e))return{document:e,respelled:[]};let n=[],t=e;for(let a of d)t=De(t,a.where.split("."),a,"",n);return{document:t,respelled:n}}function De(e,d,n,t,a){if(d.length===0){if(!q(e)||!Object.hasOwn(e,n.was))return e;a.push(`${t}${n.was}`);let{[n.was]:ie,...B}=e;return Object.hasOwn(e,n.now)?B:{...B,[n.now]:ie}}if(!q(e))return e;let[f,...E]=d,k=f.endsWith("[]"),O=k?f.slice(0,-2):f,G=e[O],X=G;if(!k)X=De(G,E,n,`${t}${O}.`,a);else if(Array.isArray(G)){let ie=G.map((B,T)=>De(B,E,n,`${t}${O}.${T}.`,a));X=ie.some((B,T)=>B!==G[T])?ie:G}return X===G?e:{...e,[O]:X}}var Rn=new WeakMap;function Sn(e,d){Rn.set(e,d)}function Zn(e){return Rn.get(e)}function An(e){if(typeof e=="string")return{form:"string",light:e};if(typeof e!="object"||e===null)return;let d=e,n=k=>typeof d[k]=="string"?d[k]:void 0,t=n("light")??n("src");if(t===void 0)return;let[a,f,E]=[n("dark"),n("alt"),n("darkFallback")];return{form:n("light")!==void 0?"light":"src",light:t,...a!==void 0?{dark:a}:{},...f!==void 0?{alt:f}:{},...E!==void 0?{darkFallback:E}:{}}}function Qn(e,d){let n=e.brand??{},t=n.ground,a=n.accent?ze(n.accent,t):void 0;t&&hn(a?.ok?a.schemes:Ae(t),n.accent)&&(d.push(je("brand","brand.ground","words would not read on that page background, so the app keeps Graview's","pick a lighter ground for the light scheme, a darker one for the dark")),t=void 0,a=n.accent?ze(n.accent):void 0),a&&!a.ok&&d.push(je("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${a.why}`,"pick a color further from orange-red, or a darker one"));let f=An(n.logo),E=n.name??e.name,k=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,O])=>typeof O=="string"&&yn(O)===null).map(([O,G])=>[O,gn(G)])):void 0;return{name:E,schemes:a?.ok?a.schemes:t?Ae(t):mn,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...n.timeZone?{timeZone:n.timeZone}:{},...f?{logo:f.dark||f.darkFallback==="invert"?{light:f.light,...f.dark?{dark:f.dark}:{darkFallback:"invert"}}:f.light,logoAlt:f.alt??E}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...n.subtitle===!1?{subtitleDrawn:!1}:{},...k?{typography:k}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{},...n.views&&(n.views.css||n.views.motion)?{views:{...n.views.css?{css:n.views.css}:{},...n.views.motion?{motion:n.views.motion}:{}}}:{}}}function zn(e){let{currency:d,locale:n,timeZone:t}=e.brand??{};return{...d?{currency:d}:{},...n?{locale:n}:{},...t?{timeZone:t}:{}}}var Gn=Symbol.for("@graview/core:typed-field"),En=(e,d)=>(/^(phone|place|duration)$/.test(d)&&(ue(e)[Gn]=d),e),jn=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;function Dn(e){let d=Z().check(K(300),ke(t=>nn(t,e)!==void 0,`a record of ${e.kinds.join(" or ")} in ${e.address}, as "<kind>:<id>"`)),n=e.cardinality==="one"?d:fe(d).check(K(200));return tn(e.description?n.check(be(e.description)):n,e)}var Ln="graview-compiled@1";function Fn(e,d){return e.find(([n,t])=>n!==Q&&"ref"in t&&(t.ref==="*"||t.ref.includes(d)))?.[0]}var Q="id",me=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function $n(e){let d=Object.entries(e.fields),n=t=>["name","title","label"].find(a=>t.some(([f])=>f===a))??t[0]?.[0];return n(d.filter(([,t])=>t.required&&(t.type==="string"||t.type==="text")))??n(d.filter(([,t])=>t.type==="string"))}function Pn(e,d,n){let t;switch(e.type){case"string":case"place":t=Z().check(K(500));break;case"phone":t=Z().check(K(40),ye(jn,"a phone number"));break;case"text":t=Z().check(K(2e4)),e.format&&(ue(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let f=e.min??(e.type==="duration"?0:void 0),E=[...e.type==="number"?[]:[Ke()],...f===void 0?[]:[Ne(f)],...e.max===void 0?[]:[Fe(e.max)],...e.step===void 0?[]:[Ce(e.step)]];t=E.length>0?he().check(...E):he();break}case"boolean":t=Ze();break;case"date":t=Z().check(ye(He,"a date like 2026-10-02, or a month (2016-05) or a year (2006) alone"));break;case"datetime":t=Z().check(ke(Ue,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=Be(e.options),e.multiple&&(t=fe(t).check(K(e.options.length)));break;case"list":t=fe(e.of==="number"?he():e.of==="date"?Z().check(ye(_e)):e.of==="image"||e.of==="video"||e.of==="file"?Oe(e.of):Z().check(K(500))).check(K(200));break;case"image":case"video":case"file":t=Oe(e.type);break;case"app-link":t=en();break;case"url":t=Ve();break;case"email":t=Ie();break}let a=e.type==="number"||e.type==="integer";return En(t,a&&e.format==="duration"?"duration":e.type),e.collaborative!==void 0&&(e.type==="text"||e.type==="string")&&(ue(t)[Symbol.for("@graview/core:collaborative")]=e.collaborative?1:0),e.description&&(t=t.check(be(e.description))),a&&(e.format==="money"||e.format==="percent"||!e.format&&e.unit)&&pn(t,{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{},...e.places===0?{places:0}:{}}),d?pe(t):t}var ge=e=>{throw new U(`there is no record "${e}"`,"invalid")},Nn=(e,d)=>"field"in e?Pn(e.field,e.optional,d):"ref"in e?un(e.ref):pe(qe()),Cn=new WeakMap;var Le=(e,d)=>q(d)&&Object.keys(e??{}).length===Object.keys(d).length&&Object.keys(e??{}).every(n=>Object.hasOwn(d,n));function xt(e,d={}){let n=q(e)?e.format:void 0;if(n!==Ln)return{ok:!1,findings:[Ee("compiled-format","format",n===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(n)}, and this build reads ${Ln}`,"compile the document instead")]};let t=e,a=xn(t.document).document,f=a===t.document?t:{...t,document:a},E=q(a)&&typeof a.name=="string"&&q(a.kinds)&&Le(a.kinds,f.kinds)&&Le(a.acts,f.acts)&&Le(a.rules,f.rules)&&Array.isArray(f.edges)&&Array.isArray(f.findings),k={ok:!1,findings:[Ee("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!E)return k;try{return In(f,d)}catch{return k}}function In(e,d={}){let{document:n}=e,t=n.brand?.timeZone,a=d.today??(()=>We(t)),f={...n.brand?.locale?{locale:n.brand.locale}:{},...t?{timeZone:t}:{}},E=new Map(e.edges.map(([p,i])=>[p,i])),k=new Map;for(let[p,i]of Object.entries(n.kinds)){let x=e.kinds[p]?.computed,w=Re(i.edges),j=new Map(Object.entries(i.fields).flatMap(([S,v])=>v.type==="enum"?[[S,v.optionLabels??{}]]:[]));k.set(p,{fields:new Set([...Object.keys(i.fields),...w.keys()]),edges:new Map(Object.entries(xe(i.edges)).map(([S,v])=>[S,v.cardinality??"many"])),...x?{computed:new Map(x)}:{},...w.size>0?{linked:w}:{},...j.size>0?{choices:j}:{}})}e.facts&&k.set(bn,{computed:new Map(e.facts)});let O=zn(n),G=p=>({from:p.from,via:p.via,sourceEnd:p.sourceEnd,back:p.back,values(i,x,w){let j={};for(let[S,v]of p.set)if("value"in v)j[S]=v.value;else try{let $=Y(v.expr,{graph:i,subject:x,kinds:k,bindings:{to:w},today:a(),...f});($===null||typeof $!="object"||Array.isArray($))&&(j[S]=$)}catch($){if(!($ instanceof oe))throw $}return j}}),X=new Map,ie=Object.entries(n.kinds).map(([p,i])=>{let x={};for(let[r,o]of Object.entries(i.fields))x[r]=Pn(o,!o.required,O),o.repeats&&(x[rn(r)]=pe(on()));for(let[r,o]of Re(i.edges))x[r]=pe(Dn(o));let{label:w,describe:j,durations:S}=e.kinds[p]??{},v=Object.entries(i.computed??{}).map(([r,o])=>[r,typeof o=="string"?{expr:o}:o]),$=Object.hasOwn(i.fields,"label")&&!i.fields.label.label&&!/\{\s*label\b/.test(i.label??`{${$n(i)??""}}`),ee=Object.fromEntries([...$?[["label","Label"]]:[],...Object.entries(i.fields).filter(([,r])=>r.label).map(([r,o])=>[r,o.label]),...v.filter(([,r])=>r.label).map(([r,o])=>[r,o.label])]),W=Object.keys(ee).length>0,L=Object.entries(i.fields).filter(([,r])=>r.type==="enum"&&(r.optionLabels&&Object.keys(r.optionLabels).length>0||r.multiple)),l=r=>o=>typeof o=="string"&&r.optionLabels&&Object.hasOwn(r.optionLabels,o)?r.optionLabels[o]:Ye(String(o)),M=Object.fromEntries(L.map(([r,o])=>[r,o.multiple?z=>Array.isArray(z)?z.map(l(o)).join(", "):l(o)(z):l(o)])),N=L.length>0,C=Object.fromEntries(Object.entries(i.fields).filter(([,r])=>r.default!==void 0).map(([r,o])=>[r,o.default]));X.set(p,C);let _=Object.fromEntries(Object.entries(xe(i.edges)).map(([r,{renamedFrom:o,...z}])=>[r,z])),I=Object.entries(i.fields).flatMap(([r,o])=>o.aliases?[[r,o.aliases]]:[]),P=r=>i[r]?{[r]:i[r]}:{};return Qe(p,{fields:ve(x),edges:_,...P("plural"),...P("noun"),...P("aliases"),...I.length>0?{fieldAliases:Object.fromEntries(I)}:{},...P("description"),...w?{label:r=>se(w,{node:r,kinds:k,today:a(),money:O})||r.id}:{},...j?{describe:r=>se(j,{node:r,kinds:k,today:a(),money:O})}:{},...P("lifecycle"),...P("figure"),...P("fieldRoles"),...P("people"),archives:i.archives,...i.tidying?{tidying:i.tidying}:{},...v.length>0?{computed:Object.fromEntries(v.map(([r,o])=>[r,Vn(o,S?.includes(r)??!1,O)??i.computed[r]]))}:{},...W||N||i.glance||i.page?{display:{...W?{labels:ee}:{},...N?{format:M}:{},...i.glance?{glance:[...i.glance]}:{},...i.page?{page:i.page}:{}}}:{},...Object.keys(C).length>0?{defaults:C}:{},...e.kinds[p]?.keptInStep?{keptInStep:e.kinds[p].keptInStep}:{},...e.kinds[p]?.derives?{derives:G(e.kinds[p].derives)}:{}})}),B=an(ie,n.computed);function T(p){return B.tryDefinition(p.kind)?.label?.(p)??p.id}let $e=p=>({id:"",kind:p,...X.get(p)}),Pe=[];for(let[p,i]of Object.entries(n.acts??{})){let x=e.acts[p],{title:w,effects:j,guard:S,refusal:v,destructive:$,idempotent:ee,creates:W,connects:L,severs:l,writes:M,writesOther:N,sets:C}=x,_={};for(let c of j)"through"in c&&(_[c.through]=[...new Set([..._[c.through]??[],...Object.keys(c.set)])]);let I=new Map(x.args),P={};for(let[c,A]of I)P[c]=Nn(A,O);let r=[i.on??[]].flat(),o=new Map(x.exprs),z=j.find(c=>"create"in c),J=(c,A,u,b=null)=>{if(q(c)&&"expr"in c)return Y(o.get(c.expr),{graph:u,subject:b,kinds:k,bindings:A,today:a(),...f});let h=me(c);return h===void 0?typeof c=="string"&&c.startsWith("$$")?c.slice(1):c:h==="now"?new Date().toISOString():h==="today"?a():A[h]},de=(c,A)=>{if(!z)return"";let u=n.kinds[z.create].fields,b=$e(z.create),h=[];for(let[R,ce]of Object.entries(z.set??{})){try{b[R]=J(ce,c,A)??b[R]}catch{}let ae=me(ce);ae&&c[ae]!==void 0&&h.push(R)}let V=T(b).trim(),ne=h.filter(R=>b[R]!==!1&&u[R].type!=="text"&&!(/[^]{41}/.test(b[R])||/ .*[.!?]$/.test(b[R])&&!/[ .][A-Z]\w{0,3}\.$/.test(b[R]))&&T({...b,[R]:void 0}).trim()===V).map(R=>b[R]===!0?u[R].label??Je(R):vn(b[R],u[R].format,a(),[],O));return V&&ne.length>0?`${V} (${ne.join(", ")})`:V};Pe.push(fn(p,{input:ve(P),title:w,...i.description?{description:i.description}:{},...i.fromTheOtherEnd?{fromTheOtherEnd:i.fromTheOtherEnd}:{},...I.has(Q)?{subject:{kinds:r.length>0?r:"*",arg:Q}}:{},...$?{destructive:!0}:{},...ee?{idempotent:!0}:{},...W.length>0?{creates:W}:{},...L.length>0?{connects:L}:{},...l.length>0?{severs:l}:{},writes:M,...Object.keys(N).length>0?{writesOther:N}:{},...Object.keys(_).length>0?{writesLinked:_}:{},...Object.keys(C).length>0?{sets:C}:{},...S?{allowedOn:(c,A)=>{let u=c.getNode(A);if(!u||r.length>0&&!r.includes(u.kind))return!1;try{return Y(S,{graph:c,subject:u,kinds:k,bindings:{},today:a(),...f})===!0}catch{return!1}}}:{},describe:(c,A)=>{let u=typeof c[Q]=="string"?A.getNode(c[Q]):void 0,b=u?T(u):de(c,A);return b?`${w}: ${b}`:w},apply(c,A){let u=c.graph,b=typeof A[Q]=="string"?A[Q]:void 0,h=b?u.getNode(b):void 0;if(b&&!h&&ge(b),h&&r.length>0&&!r.includes(h.kind))throw new U(`"${w}" acts on ${r.join(" or ")}, not on ${Xe(h.kind)}`,"invalid");let V={};for(let[s,m]of Object.entries(A))m!==void 0&&(V[s]=m);if(S&&h){let s;try{s=Y(S,{graph:u,subject:h,kinds:k,bindings:V,today:a(),...f})}catch(m){throw m instanceof oe?new U(`"${w}" could not be judged: ${m.sentence}`):m}if(s!==!0)throw new U(v?se(v,{node:h,kinds:k,graph:u,bindings:V,today:a(),money:O}):`"${w}" is not allowed for ${T(h)} right now`)}let ne=new Map,R=s=>u.has(s)||[...ne.values()].includes(s),ce=new Set,ae=s=>{let m=sn(s);ce.has(m)||(ce.add(m),c.removeEdge(s))},te=(s,m)=>{let g=me(s);if(g==="subject")return b;if(g==="me"){let y=c.me;if(y&&n.kinds[u.getNode(y)?.kind]?.people)return y;throw new U(`"${w}" is done as you, and you have no record here`)}if(ne.has(g))return ne.get(g);try{return J(s,V,u,m??h??null)}catch(y){throw y instanceof oe?new U(`"${w}" could not work out a value: ${y.sentence}`):y}};for(let s of j)if("create"in s){let m=n.kinds[s.create],g=$e(s.create);for(let[H,re]of Object.entries(s.set??{})){let Me=te(re,void 0);Me!==void 0&&(g[H]=Me)}let y=$n(m),D=String((y&&g[y])??s.create),le=ln(D,s.create,g,(H,re)=>cn(n.policy?.sees,H,re)),F=c.freshId(le?s.create:D,s.create,g);c.addNode({...g,id:F}),s.as&&ne.set(s.as,F)}else if("connect"in s||"sever"in s){let m="connect"in s?s.connect:s.sever,g=String(te(s.from,void 0)??""),y=String(te(s.to,void 0)??"");if(R(g)||ge(g),R(y)||ge(y),"connect"in s){if(E.get(m)?.cardinality==="one")for(let D of u.out(g,m))D.id!==y&&ae({kind:m,from:g,to:D.id});u.out(g,m).some(D=>D.id===y)||c.addEdge({kind:m,from:g,to:y})}else ae({kind:m,from:g,to:y})}else if("through"in s){if(!h)throw new U(`"${w}" carries a change to linked records, and has no record to start from`,"invalid");let g=E.get(s.through)?.from.includes(h.kind)??!0?u.out(h.id,s.through):u.in(h.id,s.through);for(let y of g){let D={};for(let[le,F]of Object.entries(s.set)){let H;if(me(F)==="to")H=y.id;else if(q(F)&&"expr"in F)try{H=Y(o.get(F.expr),{graph:u,subject:h,kinds:k,bindings:{...V,to:y},today:a(),...f})}catch(re){throw re instanceof oe?new U(`"${w}" could not work out a value for ${T(y)}: ${re.sentence}`):re}else H=te(F,void 0);H!==void 0&&(D[le]=H)}Object.keys(D).length>0&&c.patchNode(y.id,D)}}else if("set"in s){let m=String(te(s.target??"$subject",void 0)??""),g=u.getNode(m);!g&&!R(m)&&ge(m);let y={};for(let[D,le]of Object.entries(s.set)){let F=te(le,g);F!==void 0&&(y[D]=F)}Object.keys(y).length>0&&c.patchNode(m,y)}else if("remove"in s){let m=String(te(s.remove,void 0)??"");u.has(m)||ge(m),c.removeNode(m)}else if("replace"in s&&h){let m=A.to;for(let g of s.replace){let y=E.get(g)?.from.includes(h.kind)??!0;for(let D of y?u.out(h.id,g):u.in(h.id,g))g===s.keep&&D.id===m||ae(y?{kind:g,from:h.id,to:D.id}:{kind:g,from:D.id,to:h.id})}}}}))}let Te=[];for(let[p,i]of Object.entries(n.rules??{})){let{title:x,require:w,when:j,says:S,covers:v}=e.rules[p],$=i.repairs??[],ee=(L,l,M=a(),N)=>{let C=[],_={graph:L,subject:l,kinds:k,today:M,...f,...N?{linked:N}:{},onUnread:o=>C.push(o)},I,P=[];try{if(j&&Y(j,_)!==!0)return[];if(v&&l?(P=On(L,l,v),I=P.length===0):I=Y(w,_)===!0,!I&&C.length>0)throw new oe(`it reads ${kn(C[0])}`,0)}catch(o){throw o instanceof wn?new dn(o.sentence):o instanceof oe?new Error(o.sentence):o}if(I)return[];let r=$.flatMap(o=>{let z=n.acts?.[o.act],J={},de=l&&z?.on&&z.fromTheOtherEnd&&![z.on].flat().includes(l.kind)?Fn(e.acts[o.act].args,l.kind):void 0;de?J[de]=l.id:l&&(z?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(o.act))&&(J[Q]=l.id);for(let[u,b]of Object.entries(o.args??{}))J[u]=me(b)==="subject"?l?.id:b;let A=(z?e.acts[o.act].args:[]).filter(([u,b])=>b.required&&J[u]===void 0).map(([u])=>u);return[{mutation:o.act,label:o.label??(de?z.fromTheOtherEnd:z?.title)??o.act.replace(/-/g," "),args:J,...A.length>0?{missing:A}:{}}]});return v&&l?P.map(o=>({invariant:p,subjectId:l.id,label:x,message:S?se(S,{node:l,kinds:k,graph:L,today:M,money:O,bindings:{[l.kind]:l,[o.kind]:o}}):`${T(l)}: ${x} \u2014 ${T(o)}`,nodeIds:[l.id,o.id],repairs:r})):[{invariant:p,...l?{subjectId:l.id}:{},label:x,message:S?se(S,{node:l,kinds:k,graph:L,today:M,money:O}):l?`${T(l)}: ${x}`:x,nodeIds:l?[l.id]:[],repairs:r}]},W={label:x,shape:{over:i.over,require:w,...v?{covers:v}:{},when:j,says:S,declared:n.kinds,money:O,kinds:k,today:a},judgment:{...i.require?{require:i.require}:{},...i.covers?{covers:i.covers}:{},...i.when?{when:i.when}:{},...i.says?{says:i.says}:{}},...i.description?{description:i.description}:{},...$.length>0?{repairs:$.map(L=>L.act)}:{}};Te.push(i.over==="graph"?Se(p,{scope:"graph",...W,evaluate:({graph:L,today:l,context:M})=>ee(L,null,l,M?.linked)}):Se(p,{scope:{kind:i.over},...W,evaluate:({graph:L,subject:l,today:M,context:N})=>ee(L,l,M,N?.linked)}))}let Ge=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},we={name:n.name,schema:B,mutations:Pe,invariants:Te,...Ge?{policy:Ge}:{},...e.brand?{brand:e.brand}:{},...n.modules?{modules:n.modules}:{},...n.lenses?{lenses:n.lenses}:{},...n.pages?{pages:n.pages}:{},...n.settings?{settings:n.settings}:{},...n.connections?{connections:n.connections}:{},...n.forms?{forms:n.forms}:{},...n.publishing?{publishing:n.publishing}:{},...n.tidying?{tidying:n.tidying}:{},...n.purpose?{purpose:n.purpose}:{},...e.viewSpecs?{viewSpecs:e.viewSpecs}:{},...e.home?{home:e.home}:{},version:n.version??1};return Sn(we,n),Cn.set(we,e),{ok:!0,app:we,document:n,findings:e.findings,sights:n.policy?.sees,kinds:k}}function Vn(e,d,n){let t=d||e.format==="duration",a=e.format==="money"||e.format==="percent"||!e.format&&e.unit!==void 0;if(!(!t&&!a))return{...e,...t?{as:"duration"}:{},...a?{amount:{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{},...e.places===0?{places:0}:{}}}:{}}}export{q as a,xn as b,Zn as c,Qn as d,Ln as e,Q as f,me as g,$n as h,xt as i,In as j};
|
|
1
|
+
import{b as kn,c as bn,d as oe,e as wn,f as Y,h as Ee,i as je,n as vn,s as se,u as On}from"./chunk.CD6YWH6T.js";import{B as be,C as ue,Da as Oe,F as _e,Ga as en,H as He,Ja as nn,K as Ue,L as We,La as tn,Mb as U,Pa as xe,Qa as Re,Rb as cn,Sb as ln,Tc as mn,Ub as fn,Wa as rn,Za as on,Zb as pn,b as Fe,c as Ne,cc as un,d as Ce,e as K,ed as gn,fd as yn,g as ye,ga as Je,gd as Ae,h as Z,ha as Ye,hd as hn,i as Ie,id as ze,j as Ve,ja as Qe,jb as an,k as he,l as Ke,m as Ze,mb as sn,o as qe,p as fe,q as ve,rb as Se,sa as Xe,sb as dn,v as Be,x as pe,z as ke}from"./chunk.J24YPQ5I.js";var Tn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],q=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function xn(e,d=Tn){if(!q(e))return{document:e,respelled:[]};let n=[],t=e;for(let a of d)t=De(t,a.where.split("."),a,"",n);return{document:t,respelled:n}}function De(e,d,n,t,a){if(d.length===0){if(!q(e)||!Object.hasOwn(e,n.was))return e;a.push(`${t}${n.was}`);let{[n.was]:ie,...B}=e;return Object.hasOwn(e,n.now)?B:{...B,[n.now]:ie}}if(!q(e))return e;let[f,...E]=d,k=f.endsWith("[]"),O=k?f.slice(0,-2):f,G=e[O],X=G;if(!k)X=De(G,E,n,`${t}${O}.`,a);else if(Array.isArray(G)){let ie=G.map((B,T)=>De(B,E,n,`${t}${O}.${T}.`,a));X=ie.some((B,T)=>B!==G[T])?ie:G}return X===G?e:{...e,[O]:X}}var Rn=new WeakMap;function Sn(e,d){Rn.set(e,d)}function Zn(e){return Rn.get(e)}function An(e){if(typeof e=="string")return{form:"string",light:e};if(typeof e!="object"||e===null)return;let d=e,n=k=>typeof d[k]=="string"?d[k]:void 0,t=n("light")??n("src");if(t===void 0)return;let[a,f,E]=[n("dark"),n("alt"),n("darkFallback")];return{form:n("light")!==void 0?"light":"src",light:t,...a!==void 0?{dark:a}:{},...f!==void 0?{alt:f}:{},...E!==void 0?{darkFallback:E}:{}}}function Qn(e,d){let n=e.brand??{},t=n.ground,a=n.accent?ze(n.accent,t):void 0;t&&hn(a?.ok?a.schemes:Ae(t),n.accent)&&(d.push(je("brand","brand.ground","words would not read on that page background, so the app keeps Graview's","pick a lighter ground for the light scheme, a darker one for the dark")),t=void 0,a=n.accent?ze(n.accent):void 0),a&&!a.ok&&d.push(je("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${a.why}`,"pick a color further from orange-red, or a darker one"));let f=An(n.logo),E=n.name??e.name,k=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,O])=>typeof O=="string"&&yn(O)===null).map(([O,G])=>[O,gn(G)])):void 0;return{name:E,schemes:a?.ok?a.schemes:t?Ae(t):mn,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...n.timeZone?{timeZone:n.timeZone}:{},...f?{logo:f.dark||f.darkFallback==="invert"?{light:f.light,...f.dark?{dark:f.dark}:{darkFallback:"invert"}}:f.light,logoAlt:f.alt??E}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...n.subtitle===!1?{subtitleDrawn:!1}:{},...k?{typography:k}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{},...n.views&&(n.views.css||n.views.motion)?{views:{...n.views.css?{css:n.views.css}:{},...n.views.motion?{motion:n.views.motion}:{}}}:{}}}function zn(e){let{currency:d,locale:n,timeZone:t}=e.brand??{};return{...d?{currency:d}:{},...n?{locale:n}:{},...t?{timeZone:t}:{}}}var Gn=Symbol.for("@graview/core:typed-field"),En=(e,d)=>(/^(phone|place|duration)$/.test(d)&&(ue(e)[Gn]=d),e),jn=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;function Dn(e){let d=Z().check(K(300),ke(t=>nn(t,e)!==void 0,`a record of ${e.kinds.join(" or ")} in ${e.address}, as "<kind>:<id>"`)),n=e.cardinality==="one"?d:fe(d).check(K(200));return tn(e.description?n.check(be(e.description)):n,e)}var Ln="graview-compiled@1";function Fn(e,d){return e.find(([n,t])=>n!==Q&&"ref"in t&&(t.ref==="*"||t.ref.includes(d)))?.[0]}var Q="id",me=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function $n(e){let d=Object.entries(e.fields),n=t=>["name","title","label"].find(a=>t.some(([f])=>f===a))??t[0]?.[0];return n(d.filter(([,t])=>t.required&&(t.type==="string"||t.type==="text")))??n(d.filter(([,t])=>t.type==="string"))}function Pn(e,d,n){let t;switch(e.type){case"string":case"place":t=Z().check(K(500));break;case"phone":t=Z().check(K(40),ye(jn,"a phone number"));break;case"text":t=Z().check(K(2e4)),e.format&&(ue(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let f=e.min??(e.type==="duration"?0:void 0),E=[...e.type==="number"?[]:[Ke()],...f===void 0?[]:[Ne(f)],...e.max===void 0?[]:[Fe(e.max)],...e.step===void 0?[]:[Ce(e.step)]];t=E.length>0?he().check(...E):he();break}case"boolean":t=Ze();break;case"date":t=Z().check(ye(He,"a date like 2026-10-02, or a month (2016-05) or a year (2006) alone"));break;case"datetime":t=Z().check(ke(Ue,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=Be(e.options),e.multiple&&(t=fe(t).check(K(e.options.length)));break;case"list":t=fe(e.of==="number"?he():e.of==="date"?Z().check(ye(_e)):e.of==="image"||e.of==="video"||e.of==="file"?Oe(e.of):Z().check(K(500))).check(K(200));break;case"image":case"video":case"file":t=Oe(e.type);break;case"app-link":t=en();break;case"url":t=Ve();break;case"email":t=Ie();break}let a=e.type==="number"||e.type==="integer";return En(t,a&&e.format==="duration"?"duration":e.type),e.collaborative!==void 0&&(e.type==="text"||e.type==="string")&&(ue(t)[Symbol.for("@graview/core:collaborative")]=e.collaborative?1:0),e.description&&(t=t.check(be(e.description))),a&&(e.format==="money"||e.format==="percent"||!e.format&&e.unit)&&pn(t,{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{},...e.places===0?{places:0}:{}}),d?pe(t):t}var ge=e=>{throw new U(`there is no record "${e}"`,"invalid")},Nn=(e,d)=>"field"in e?Pn(e.field,e.optional,d):"ref"in e?un(e.ref):pe(qe()),Cn=new WeakMap;var Le=(e,d)=>q(d)&&Object.keys(e??{}).length===Object.keys(d).length&&Object.keys(e??{}).every(n=>Object.hasOwn(d,n));function xt(e,d={}){let n=q(e)?e.format:void 0;if(n!==Ln)return{ok:!1,findings:[Ee("compiled-format","format",n===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(n)}, and this build reads ${Ln}`,"compile the document instead")]};let t=e,a=xn(t.document).document,f=a===t.document?t:{...t,document:a},E=q(a)&&typeof a.name=="string"&&q(a.kinds)&&Le(a.kinds,f.kinds)&&Le(a.acts,f.acts)&&Le(a.rules,f.rules)&&Array.isArray(f.edges)&&Array.isArray(f.findings),k={ok:!1,findings:[Ee("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!E)return k;try{return In(f,d)}catch{return k}}function In(e,d={}){let{document:n}=e,t=n.brand?.timeZone,a=d.today??(()=>We(t)),f={...n.brand?.locale?{locale:n.brand.locale}:{},...t?{timeZone:t}:{}},E=new Map(e.edges.map(([p,i])=>[p,i])),k=new Map;for(let[p,i]of Object.entries(n.kinds)){let x=e.kinds[p]?.computed,w=Re(i.edges),j=new Map(Object.entries(i.fields).flatMap(([S,v])=>v.type==="enum"?[[S,v.optionLabels??{}]]:[]));k.set(p,{fields:new Set([...Object.keys(i.fields),...w.keys()]),edges:new Map(Object.entries(xe(i.edges)).map(([S,v])=>[S,v.cardinality??"many"])),...x?{computed:new Map(x)}:{},...w.size>0?{linked:w}:{},...j.size>0?{choices:j}:{}})}e.facts&&k.set(bn,{computed:new Map(e.facts)});let O=zn(n),G=p=>({from:p.from,via:p.via,sourceEnd:p.sourceEnd,back:p.back,values(i,x,w){let j={};for(let[S,v]of p.set)if("value"in v)j[S]=v.value;else try{let $=Y(v.expr,{graph:i,subject:x,kinds:k,bindings:{to:w},today:a(),...f});($===null||typeof $!="object"||Array.isArray($))&&(j[S]=$)}catch($){if(!($ instanceof oe))throw $}return j}}),X=new Map,ie=Object.entries(n.kinds).map(([p,i])=>{let x={};for(let[r,o]of Object.entries(i.fields))x[r]=Pn(o,!o.required,O),o.repeats&&(x[rn(r)]=pe(on()));for(let[r,o]of Re(i.edges))x[r]=pe(Dn(o));let{label:w,describe:j,durations:S}=e.kinds[p]??{},v=Object.entries(i.computed??{}).map(([r,o])=>[r,typeof o=="string"?{expr:o}:o]),$=Object.hasOwn(i.fields,"label")&&!i.fields.label.label&&!/\{\s*label\b/.test(i.label??`{${$n(i)??""}}`),ee=Object.fromEntries([...$?[["label","Label"]]:[],...Object.entries(i.fields).filter(([,r])=>r.label).map(([r,o])=>[r,o.label]),...v.filter(([,r])=>r.label).map(([r,o])=>[r,o.label])]),W=Object.keys(ee).length>0,L=Object.entries(i.fields).filter(([,r])=>r.type==="enum"&&(r.optionLabels&&Object.keys(r.optionLabels).length>0||r.multiple)),l=r=>o=>typeof o=="string"&&r.optionLabels&&Object.hasOwn(r.optionLabels,o)?r.optionLabels[o]:Ye(String(o)),M=Object.fromEntries(L.map(([r,o])=>[r,o.multiple?z=>Array.isArray(z)?z.map(l(o)).join(", "):l(o)(z):l(o)])),N=L.length>0,C=Object.fromEntries(Object.entries(i.fields).filter(([,r])=>r.default!==void 0).map(([r,o])=>[r,o.default]));X.set(p,C);let _=Object.fromEntries(Object.entries(xe(i.edges)).map(([r,{renamedFrom:o,...z}])=>[r,z])),I=Object.entries(i.fields).flatMap(([r,o])=>o.aliases?[[r,o.aliases]]:[]),P=r=>i[r]?{[r]:i[r]}:{};return Qe(p,{fields:ve(x),edges:_,...P("plural"),...P("noun"),...P("aliases"),...I.length>0?{fieldAliases:Object.fromEntries(I)}:{},...P("description"),...w?{label:r=>se(w,{node:r,kinds:k,today:a(),money:O})||r.id}:{},...j?{describe:r=>se(j,{node:r,kinds:k,today:a(),money:O})}:{},...P("lifecycle"),...P("figure"),...P("fieldRoles"),...P("people"),archives:i.archives,...i.tidying?{tidying:i.tidying}:{},...v.length>0?{computed:Object.fromEntries(v.map(([r,o])=>[r,Vn(o,S?.includes(r)??!1,O)??i.computed[r]]))}:{},...W||N||i.glance||i.page?{display:{...W?{labels:ee}:{},...N?{format:M}:{},...i.glance?{glance:[...i.glance]}:{},...i.page?{page:i.page}:{}}}:{},...Object.keys(C).length>0?{defaults:C}:{},...e.kinds[p]?.keptInStep?{keptInStep:e.kinds[p].keptInStep}:{},...e.kinds[p]?.derives?{derives:G(e.kinds[p].derives)}:{}})}),B=an(ie,n.computed);function T(p){return B.tryDefinition(p.kind)?.label?.(p)??p.id}let $e=p=>({id:"",kind:p,...X.get(p)}),Pe=[];for(let[p,i]of Object.entries(n.acts??{})){let x=e.acts[p],{title:w,effects:j,guard:S,refusal:v,destructive:$,idempotent:ee,creates:W,connects:L,severs:l,writes:M,writesOther:N,sets:C}=x,_={};for(let c of j)"through"in c&&(_[c.through]=[...new Set([..._[c.through]??[],...Object.keys(c.set)])]);let I=new Map(x.args),P={};for(let[c,A]of I)P[c]=Nn(A,O);let r=[i.on??[]].flat(),o=new Map(x.exprs),z=j.find(c=>"create"in c),J=(c,A,u,b=null)=>{if(q(c)&&"expr"in c)return Y(o.get(c.expr),{graph:u,subject:b,kinds:k,bindings:A,today:a(),...f});let h=me(c);return h===void 0?typeof c=="string"&&c.startsWith("$$")?c.slice(1):c:h==="now"?new Date().toISOString():h==="today"?a():A[h]},de=(c,A)=>{if(!z)return"";let u=n.kinds[z.create].fields,b=$e(z.create),h=[];for(let[R,ce]of Object.entries(z.set??{})){try{b[R]=J(ce,c,A)??b[R]}catch{}let ae=me(ce);ae&&c[ae]!==void 0&&h.push(R)}let V=T(b).trim(),ne=h.filter(R=>b[R]!==!1&&u[R].type!=="text"&&!(/[^]{41}/.test(b[R])||/ .*[.!?]$/.test(b[R])&&!/[ .][A-Z]\w{0,3}\.$/.test(b[R]))&&T({...b,[R]:void 0}).trim()===V).map(R=>b[R]===!0?u[R].label??Je(R):vn(b[R],u[R].format,a(),[],O));return V&&ne.length>0?`${V} (${ne.join(", ")})`:V};Pe.push(fn(p,{input:ve(P),title:w,...i.description?{description:i.description}:{},...i.fromTheOtherEnd?{fromTheOtherEnd:i.fromTheOtherEnd}:{},...I.has(Q)?{subject:{kinds:r.length>0?r:"*",arg:Q}}:{},...$?{destructive:!0}:{},...ee?{idempotent:!0}:{},...W.length>0?{creates:W}:{},...L.length>0?{connects:L}:{},...l.length>0?{severs:l}:{},writes:M,...Object.keys(N).length>0?{writesOther:N}:{},...Object.keys(_).length>0?{writesLinked:_}:{},...Object.keys(C).length>0?{sets:C}:{},...S?{allowedOn:(c,A)=>{let u=c.getNode(A);if(!u||r.length>0&&!r.includes(u.kind))return!1;try{return Y(S,{graph:c,subject:u,kinds:k,bindings:{},today:a(),...f})===!0}catch{return!1}}}:{},describe:(c,A)=>{let u=typeof c[Q]=="string"?A.getNode(c[Q]):void 0,b=u?T(u):de(c,A);return b?`${w}: ${b}`:w},apply(c,A){let u=c.graph,b=typeof A[Q]=="string"?A[Q]:void 0,h=b?u.getNode(b):void 0;if(b&&!h&&ge(b),h&&r.length>0&&!r.includes(h.kind))throw new U(`"${w}" acts on ${r.join(" or ")}, not on ${Xe(h.kind)}`,"invalid");let V={};for(let[s,m]of Object.entries(A))m!==void 0&&(V[s]=m);if(S&&h){let s;try{s=Y(S,{graph:u,subject:h,kinds:k,bindings:V,today:a(),...f})}catch(m){throw m instanceof oe?new U(`"${w}" could not be judged: ${m.sentence}`):m}if(s!==!0)throw new U(v?se(v,{node:h,kinds:k,graph:u,bindings:V,today:a(),money:O}):`"${w}" is not allowed for ${T(h)} right now`)}let ne=new Map,R=s=>u.has(s)||[...ne.values()].includes(s),ce=new Set,ae=s=>{let m=sn(s);ce.has(m)||(ce.add(m),c.removeEdge(s))},te=(s,m)=>{let g=me(s);if(g==="subject")return b;if(g==="me"){let y=c.me;if(y&&n.kinds[u.getNode(y)?.kind]?.people)return y;throw new U(`"${w}" is done as you, and you have no record here`)}if(ne.has(g))return ne.get(g);try{return J(s,V,u,m??h??null)}catch(y){throw y instanceof oe?new U(`"${w}" could not work out a value: ${y.sentence}`):y}};for(let s of j)if("create"in s){let m=n.kinds[s.create],g=$e(s.create);for(let[H,re]of Object.entries(s.set??{})){let Me=te(re,void 0);Me!==void 0&&(g[H]=Me)}let y=$n(m),D=String((y&&g[y])??s.create),le=ln(D,s.create,g,(H,re)=>cn(n.policy?.sees,H,re)),F=c.freshId(le?s.create:D,s.create,g);c.addNode({...g,id:F}),s.as&&ne.set(s.as,F)}else if("connect"in s||"sever"in s){let m="connect"in s?s.connect:s.sever,g=String(te(s.from,void 0)??""),y=String(te(s.to,void 0)??"");if(R(g)||ge(g),R(y)||ge(y),"connect"in s){if(E.get(m)?.cardinality==="one")for(let D of u.out(g,m))D.id!==y&&ae({kind:m,from:g,to:D.id});u.out(g,m).some(D=>D.id===y)||c.addEdge({kind:m,from:g,to:y})}else ae({kind:m,from:g,to:y})}else if("through"in s){if(!h)throw new U(`"${w}" carries a change to linked records, and has no record to start from`,"invalid");let g=E.get(s.through)?.from.includes(h.kind)??!0?u.out(h.id,s.through):u.in(h.id,s.through);for(let y of g){let D={};for(let[le,F]of Object.entries(s.set)){let H;if(me(F)==="to")H=y.id;else if(q(F)&&"expr"in F)try{H=Y(o.get(F.expr),{graph:u,subject:h,kinds:k,bindings:{...V,to:y},today:a(),...f})}catch(re){throw re instanceof oe?new U(`"${w}" could not work out a value for ${T(y)}: ${re.sentence}`):re}else H=te(F,void 0);H!==void 0&&(D[le]=H)}Object.keys(D).length>0&&c.patchNode(y.id,D)}}else if("set"in s){let m=String(te(s.target??"$subject",void 0)??""),g=u.getNode(m);!g&&!R(m)&&ge(m);let y={};for(let[D,le]of Object.entries(s.set)){let F=te(le,g);F!==void 0&&(y[D]=F)}Object.keys(y).length>0&&c.patchNode(m,y)}else if("remove"in s){let m=String(te(s.remove,void 0)??"");u.has(m)||ge(m),c.removeNode(m)}else if("replace"in s&&h){let m=A.to;for(let g of s.replace){let y=E.get(g)?.from.includes(h.kind)??!0;for(let D of y?u.out(h.id,g):u.in(h.id,g))g===s.keep&&D.id===m||ae(y?{kind:g,from:h.id,to:D.id}:{kind:g,from:D.id,to:h.id})}}}}))}let Te=[];for(let[p,i]of Object.entries(n.rules??{})){let{title:x,require:w,when:j,says:S,covers:v}=e.rules[p],$=i.repairs??[],ee=(L,l,M=a(),N)=>{let C=[],_={graph:L,subject:l,kinds:k,today:M,...f,...N?{linked:N}:{},onUnread:o=>C.push(o)},I,P=[];try{if(j&&Y(j,_)!==!0)return[];if(v&&l?(P=On(L,l,v),I=P.length===0):I=Y(w,_)===!0,!I&&C.length>0)throw new oe(`it reads ${kn(C[0])}`,0)}catch(o){throw o instanceof wn?new dn(o.sentence):o instanceof oe?new Error(o.sentence):o}if(I)return[];let r=$.flatMap(o=>{let z=n.acts?.[o.act],J={},de=l&&z?.on&&z.fromTheOtherEnd&&![z.on].flat().includes(l.kind)?Fn(e.acts[o.act].args,l.kind):void 0;de?J[de]=l.id:l&&(z?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(o.act))&&(J[Q]=l.id);for(let[u,b]of Object.entries(o.args??{}))J[u]=me(b)==="subject"?l?.id:b;let A=(z?e.acts[o.act].args:[]).filter(([u,b])=>b.required&&J[u]===void 0).map(([u])=>u);return[{mutation:o.act,label:o.label??(de?z.fromTheOtherEnd:z?.title)??o.act.replace(/-/g," "),args:J,...A.length>0?{missing:A}:{}}]});return v&&l?P.map(o=>({invariant:p,subjectId:l.id,label:x,message:S?se(S,{node:l,kinds:k,graph:L,today:M,money:O,bindings:{[l.kind]:l,[o.kind]:o}}):`${T(l)}: ${x} \u2014 ${T(o)}`,nodeIds:[l.id,o.id],repairs:r})):[{invariant:p,...l?{subjectId:l.id}:{},label:x,message:S?se(S,{node:l,kinds:k,graph:L,today:M,money:O}):l?`${T(l)}: ${x}`:x,nodeIds:l?[l.id]:[],repairs:r}]},W={label:x,shape:{over:i.over,require:w,...v?{covers:v}:{},when:j,says:S,declared:n.kinds,money:O,kinds:k,today:a},judgment:{...i.require?{require:i.require}:{},...i.covers?{covers:i.covers}:{},...i.when?{when:i.when}:{},...i.says?{says:i.says}:{}},...i.description?{description:i.description}:{},...$.length>0?{repairs:$.map(L=>L.act)}:{}};Te.push(i.over==="graph"?Se(p,{scope:"graph",...W,evaluate:({graph:L,today:l,context:M})=>ee(L,null,l,M?.linked)}):Se(p,{scope:{kind:i.over},...W,evaluate:({graph:L,subject:l,today:M,context:N})=>ee(L,l,M,N?.linked)}))}let Ge=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},we={name:n.name,schema:B,mutations:Pe,invariants:Te,...Ge?{policy:Ge}:{},...e.brand?{brand:e.brand}:{},...n.modules?{modules:n.modules}:{},...n.lenses?{lenses:n.lenses}:{},...n.pages?{pages:n.pages}:{},...n.settings?{settings:n.settings}:{},...n.connections?{connections:n.connections}:{},...n.forms?{forms:n.forms}:{},...n.publishing?{publishing:n.publishing}:{},...n.tidying?{tidying:n.tidying}:{},...n.purpose?{purpose:n.purpose}:{},...e.viewSpecs?{viewSpecs:e.viewSpecs}:{},...e.home?{home:e.home}:{},version:n.version??1};return Sn(we,n),Cn.set(we,e),{ok:!0,app:we,document:n,findings:e.findings,sights:n.policy?.sees,kinds:k}}function Vn(e,d,n){let t=d||e.format==="duration",a=e.format==="money"||e.format==="percent"||!e.format&&e.unit!==void 0;if(!(!t&&!a))return{...e,...t?{as:"duration"}:{},...a?{amount:{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{},...e.places===0?{places:0}:{}}}:{}}}export{q as a,xn as b,Zn as c,Qn as d,Ln as e,Q as f,me as g,$n as h,xt as i,In as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as l,N as p,U as k,W as y,c}from"./chunk.KV7GZBJ6.js";import"./chunk.5YNLFOBJ.js";import"./chunk.Q355UPFG.js";import{b as m}from"./chunk.HNMSYQRA.js";import"./chunk.44ZHHPPJ.js";import"./chunk.ZDUTEM3Z.js";import"./chunk.ARHAD5IS.js";import"./chunk.R2TSTDS3.js";import"./chunk.QSDBF7VL.js";import"./chunk.2PK335JQ.js";import"./chunk.MHTA4HYB.js";import"./chunk.BU5PVRX7.js";import"./chunk.3KUYB5ZT.js";import"./chunk.IMKD6QQG.js";import"./chunk.MB7LKKUD.js";import"./chunk.FXG5AJF6.js";import"./chunk.RFVOXX3P.js";import"./chunk.NKYYDFIX.js";import"./chunk.IR4OW67N.js";import"./chunk.6RZHKQP3.js";import"./chunk.N35SJWAM.js";import"./chunk.L7NJLZWV.js";import"./chunk.QO5RXOCS.js";import"./chunk.MIE4TJRW.js";import"./chunk.CXJJB3MK.js";import"./chunk.OJGHDWI6.js";import"./chunk.74B6KQF4.js";import"./chunk.WVUJXDXZ.js";import"./chunk.S2DOVJRL.js";import"./chunk.64FCAUAJ.js";import"./chunk.DA4RSHLW.js";import"./chunk.FOSY7MZF.js";import"./chunk.NBVPWLRY.js";import"./chunk.S3EEY7T3.js";import"./chunk.SPCAMQJE.js";import"./chunk.TUCSUZNO.js";import"./chunk.ZMWAZACO.js";import"./chunk.CD6YWH6T.js";import"./chunk.MD36ZSM5.js";import"./chunk.L6FGKJ5H.js";import{G as S,H as s,I as d,V as f,ea as g}from"./chunk.3CJLAJXP.js";import"./chunk.SDO3U72B.js";import"./chunk.J24YPQ5I.js";import"./chunk.FQLNBIQ5.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as B,b as ve}from"./chunk.
|
|
1
|
+
import{a as B,b as ve}from"./chunk.NKYYDFIX.js";import{a as ye,c as he,d as be,f as we}from"./chunk.L7NJLZWV.js";import{b as S,c as fe,d as me,j as ce,k as ge}from"./chunk.DA4RSHLW.js";import{b as pe,k as q}from"./chunk.FOSY7MZF.js";import{b as de,e as ue}from"./chunk.NBVPWLRY.js";import{G as Re,V as se,ea as le,h as ae,u as ie}from"./chunk.3CJLAJXP.js";import{Ma as te,Xa as re,Ya as oe,ga as Z,la as ee,ta as ne}from"./chunk.J24YPQ5I.js";import{b as W}from"./chunk.AJZBJBMO.js";var l=W(Re(),1);var i=W(se(),1);function qe({affordance:n,onApply:a,onCancel:u,store:w}){let y=le(),s=w??y?.store,[x,_]=(0,l.useState)({}),[p,D]=(0,l.useState)(""),[I,F]=(0,l.useState)(G),[J,V]=(0,l.useState)(void 0),U=(0,l.useId)(),L=(0,l.useRef)(null),A=n.open.filter(e=>!(e.name in x)),o=A[0],v=s.allMutations().find(e=>e.name===n.mutation),P=(0,l.useMemo)(()=>De(v,s,n.args??{}),[v,s,n.args]),d=o?P[o.name]:void 0,E=ge(n.open.filter(e=>e.shape?.type==="date").map(e=>e.name)),Se=(()=>{if(!E||o?.name!==E.end||o.shape?.type!=="date")return;let e=x[E.start];if(typeof e!="string")return;let r=P[E.start];return ce(typeof r=="string"?r:void 0,e,typeof d=="string"?d:void 0,{time:o.shape.time===!0,instant:o.shape.instant===!0})})();(0,l.useEffect)(()=>{D(Se??ke(d,o?.shape)),F(Array.isArray(d)?d:G),V(d)},[o?.name]),(0,l.useEffect)(()=>{L.current?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[o?.name]),(0,l.useLayoutEffect)(()=>{let e=L.current,r=typeof document>"u"?null:document.activeElement,f=r instanceof HTMLElement&&r.getAttribute("data-affordance")===n.id;if(!e||r&&r!==document.body&&!e.contains(r)&&!f)return;let b=e.querySelector('[data-testid="ask-filter"], form input, [role=group] button:not([disabled])');b&&b!==r&&b.focus()},[o?.name]);let Y=ve({flow:"both",letters:!0});if(!o)return null;let h=e=>{let r=d!==void 0&&JSON.stringify(e)===JSON.stringify(d)?void 0:e,f={...x,[o.name]:r};if(n.open.filter(R=>!(R.name in f)).length===0){let R=a(Object.fromEntries(Object.entries(f).filter(([,M])=>M!==void 0)));R&&R.length>0&&_(Object.fromEntries(Object.entries(f).filter(([M])=>!R.includes(M))))}else _(f)},O=o.optional?(0,i.jsx)("button",{type:"button",onClick:()=>h(void 0),style:{fontSize:"0.8125rem"},children:"Skip"}):null,t=o.shape??{type:"unknown"},c=t.type==="number"?t.amount:void 0,g=Ee(o,t),m=q(s.schema,v,o.name),Q=te((v?.input?.shape??{})[o.name]),xe=oe((v?.input?.shape??{})[o.name]),N=re(o.name),Ae=typeof d=="boolean"?d?"yes":"no":d,[T,Oe]=(0,l.useState)(""),X=(0,l.useMemo)(()=>{let e=g.map(r=>s.graph.getNode(r)).filter(r=>r!==void 0);return pe(e,r=>s.schema.tryDefinition(r))},[g,s]),j=e=>{let r=Ce(s,t,e),f=t.type==="choice"||t.type==="several"&&t.of.type==="choice"?m.option(e):r,b=X.get(e);return b?`${f} \xB7 ${b}`:f},$=(0,l.useMemo)(()=>{let e=T.trim().toLowerCase();return e===""?g:g.filter(r=>j(r).toLowerCase().includes(e))},[g,T,s,t,X]),k=t.type==="several",H=t.type==="file"?t:t.type==="several"&&t.of.type==="file"?t.of:void 0,K=k&&g.length===0,C=o.kinds&&o.kinds.length>0&&!o.kinds.includes("*")?o.kinds.map(e=>Z(ne(s.schema.tryDefinition(e),e))).join(" or "):m.label,Ne=n.open.length>1?`${C} \xB7 ${n.open.length-A.length+1} of ${n.open.length}`:C;return(0,i.jsxs)("div",{ref:L,"data-graview-asking":n.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:4,padding:"5px 0 2px"},children:[n.open.length>1||g.length>0?(0,i.jsx)("span",{id:U,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:Ne}):null,g.length>z?(0,i.jsx)("input",{type:"search",value:T,onChange:e=>Oe(e.target.value),placeholder:`Filter ${g.length}\u2026`,"aria-label":`Filter ${C}`,"data-testid":"ask-filter",onKeyDown:e=>{if(e.key!=="ArrowDown"||e.metaKey||e.ctrlKey||e.altKey)return;let r=Y.ref.current?.querySelector(`[${B}][tabindex="0"]`);r&&(e.preventDefault(),r.focus())},style:{font:"inherit",fontSize:"0.8125rem",minWidth:0,padding:"3px 7px"}}):null,xe?(0,i.jsxs)("form",{style:{display:"grid",gap:4},onSubmit:e=>{e.preventDefault(),h(J??(d===void 0?void 0:null))},children:[(0,i.jsx)(be,{value:J,onChange:V,start:N?x[N]??P[N]:void 0,label:`${N?q(s.schema,v,N).label:m.label} repeats`,name:o.name}),(0,i.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,i.jsx)("button",{type:"submit",style:{fontSize:"0.8125rem"},children:A.length>1?"Next":"Apply"}),O]})]}):Q?(0,i.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,i.jsx)(he,{relation:Q,value:d,onChange:h,label:m.label}),O]}):H?(0,i.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,i.jsx)(ye,{as:"control",value:d,onChange:h,several:k,image:H.image===!0,video:H.video===!0,label:m.label}),O]}):g.length>0?(0,i.jsxs)("div",{...Y,role:"group","aria-labelledby":U,style:{display:"flex",flexWrap:"wrap",gap:4},children:[$.slice(0,z).map(e=>{let r=k?I.includes(e):e===Ae;return(0,i.jsx)("button",{type:"button",[B]:"","aria-label":`${C}: ${j(e)}`,...k?{"aria-pressed":r}:r?{"aria-current":!0}:{},style:{padding:"3px 9px",fontSize:"0.8125rem",...r?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},onClick:()=>k?F(f=>f.includes(e)?f.filter(b=>b!==e):[...f,e]):h(t.type==="boolean"?e==="yes":e),children:j(e)},e)}),$.length>z?(0,i.jsxs)("span",{"data-testid":"ask-more",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:[$.length-z," more \u2014 type to narrow"]}):null,$.length===0?(0,i.jsxs)("span",{"data-testid":"ask-none",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["None of the ",g.length," match that."]}):null,k?(0,i.jsx)("button",{type:"button",disabled:I.length===0,style:{fontSize:"0.8125rem"},onClick:()=>{let e=I;F(G),h(e)},children:A.length>1?"Next":"Apply"}):null,O]}):(0,i.jsxs)("form",{style:{display:"flex",flexWrap:"wrap",gap:4},onSubmit:e=>{if(e.preventDefault(),d!==void 0&&p===ke(d,t)){h(void 0);return}if(K){h(p.split(/[,\n]/).map(r=>r.trim()).filter(Boolean));return}if(p.trim().length!==0){if(c){let r=me(p,c);r!==void 0&&h(r);return}h(t.type==="number"?t.duration?ue(p)??p:Number(p):p)}},children:[t.type==="text"&&t.long?(0,i.jsx)("textarea",{autoFocus:!0,name:o.name,"aria-label":m.label,placeholder:m.label,value:p,rows:4,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key==="Escape"?u():e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},style:{flex:"1 1 100%",minWidth:0,font:"inherit",fontSize:"0.875rem",lineHeight:1.45,padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",resize:"vertical",fieldSizing:"content",minHeight:"5.5em",maxHeight:"40vh"}}):t.type==="date"?(0,i.jsx)(we,{autoFocus:!0,name:o.name,label:m.label,value:p===""?void 0:p,time:t.time===!0,instant:t.instant===!0,partial:t.partial===!0,onChange:e=>D(e??""),onCancel:u,boxStyle:{fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):(0,i.jsx)("input",{autoFocus:!0,type:t.type==="number"&&!t.duration&&!c?"number":t.type==="text"&&t.holds==="phone"?"tel":"text",...c?{inputMode:"decimal","data-graview-amount":c.format??"unit"}:{},name:o.name,"aria-label":m.label,placeholder:K?`${m.label}, separated by commas`:c?`${m.label}, ${S(c).hint} \u2014 ${S(c).prefix??""}${S(c).placeholder}${S(c).suffix?` ${S(c).suffix}`:""}`:m.label,value:p,...t.type==="number"&&t.min!==void 0?{min:t.min}:{},...t.type==="number"&&t.max!==void 0?{max:t.max}:{},...t.type==="number"&&t.step!==void 0?{step:t.step}:{},onChange:e=>D(e.target.value),onKeyDown:e=>{e.key==="Escape"&&u()},style:{flex:1,minWidth:0,font:"inherit",fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}),(0,i.jsx)("button",{type:"submit",disabled:!K&&p.trim().length===0,style:{fontSize:"0.8125rem"},children:A.length>1?"Next":"Apply"}),O]})]})}var G=[];function De(n,a,u){let w=n?.derived?.act==="edit"&&n.subject?u[n.subject.arg]:void 0,y=typeof w=="string"?a.graph.getNode(w):void 0;return y?Object.fromEntries((n.writes??[]).filter(s=>y[s]!==void 0&&y[s]!==null).map(s=>[s,y[s]])):{}}function ke(n,a){return typeof n=="number"?a?.type==="number"&&a.amount?fe(n,a.amount):String(n):Array.isArray(n)?n.every(u=>typeof u=="string")?n.join(", "):"":typeof n!="string"?"":n}var z=10;function Ee(n,a){return n.candidates&&n.candidates.length>0?n.candidates:a.type==="choice"?a.options:a.type==="several"&&a.of.type==="choice"?a.of.options:a.type==="boolean"?$e:[]}var $e=["yes","no"];function Ce(n,a,u){return a.type==="boolean"||a.type==="choice"||a.type==="several"&&a.of.type==="choice"?u:ze(n,u)}function ze(n,a){let u=ae(a);if(u){let s=de(n.schema,n.graph.getNode(u.from)?.kind??"",u.kind,"out");return s.charAt(0).toUpperCase()+s.slice(1)}let w=ie(a);if(w.length>0)return w.map(s=>n.schema.tryDefinition(s)?.plural??`${s}s`).join(" + ");let y=n.graph.getNode(a);return y?ee(n.schema.tryDefinition(y.kind),y):a}export{qe as a,ze as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as g}from"./chunk.MD36ZSM5.js";import{V as p}from"./chunk.3CJLAJXP.js";import{Qc as u,Yc as c}from"./chunk.J24YPQ5I.js";import{b as h}from"./chunk.AJZBJBMO.js";var s={person:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><circle cx="11.6" cy="5.4" r="2.5"/><path d="M7.9 12.4c0-2.1 1.7-3.8 3.7-3.8s3.7 1.7 3.7 3.8v3.2H7.9z"/><path d="M8 12.6 6.4 17.2"/><path d="M15.2 12.6 16.8 17.2"/><path d="M9.8 15.6v5"/><path d="M13.4 15.6v5"/></svg>',plot:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.6 9.4 12 4.6l9.4 4.8-9.4 4.8z"/><path d="M2.6 9.4v4.4l9.4 4.8 9.4-4.8V9.4"/><path d="M12 14.2v4.4"/><path d="M7 11.9v3"/><path d="M17 11.9v3"/></svg>',box:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.4 7.9 12 3.6l8.6 4.3-8.6 4.3z"/><path d="M3.4 7.9v8.2L12 20.4l8.6-4.3V7.9"/><path d="M12 12.2v8.2"/></svg>',task:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 6.6 12 2.9l7.6 3.7v9.5L12 19.8 4.4 16.1z"/><path d="M12 12.4v7.4"/><path d="M4.4 6.6 12 10.3l7.6-3.7"/><path d="M8 9.6l2.4 2.4L16 8.4"/></svg>',shift:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.2 8.2 12 4l8.8 4.2-8.8 4.2z"/><path d="M3.2 8.2v7.2L12 19.6l8.8-4.2V8.2"/><path d="M12 12.4v7.2"/><path d="M6.6 10.8v3.4"/><path d="M9.3 12v3.4"/></svg>',list:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 10.4 12 6l9.2 4.4-9.2 4.4z"/><path d="M2.8 10.4v3.2L12 18l9.2-4.4v-3.2"/><path d="M6.6 8.6 15.8 13"/><path d="M9.4 7.2 18.6 11.6"/></svg>',vehicle:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 14.2 5 9.4l8.6-1.6 5.4 3-1 3.6z"/><path d="M2.8 14.2v2.2h2.4"/><path d="M18 16.4h1.9l.1-2.2"/><circle cx="7.6" cy="16.6" r="1.9"/><circle cx="16.1" cy="16.6" r="1.9"/><path d="M8.6 8.2 9.8 12l7.2-1"/></svg>',rule:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 19.4V6.6l12 12.8z"/><path d="M5.4 6.6 7.6 5.5l12 12.8-2.2 1.1"/><path d="M5.4 19.4 7.6 18.3h12"/><path d="M5.4 10.1h1.7"/><path d="M5.4 13.3h1.7"/><path d="M5.4 16.5h1.7"/></svg>',note:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6.2 6.2 14.8 10.5v9L6.2 15.2z"/><path d="M12.4 9.3 14.8 10.5l-.6 2.3"/><path d="M8.2 10.6 12.8 12.9"/><path d="M8.2 13.2 11.4 14.8"/></svg>'},w=Object.keys(s);function o(e){if(!e)return;let t=s[e];return t||(e.trimStart().startsWith("<svg")&&c(e)===null?e:void 0)}var a=h(p(),1);function j({kind:e,schema:t,brand:i,size:r=16,title:n}){let f=t?.tryDefinition?.(e)?.figure,d=o(i?.figures?.[e]??f),l=Math.round(u(e,i?.accents)),v=g(d);return d?(0,a.jsx)("span",{"aria-hidden":n===void 0?"true":void 0,...n===void 0?{}:{role:"img","aria-label":n},"data-graview-figure":e,"data-graview-figure-kind":"figure",dangerouslySetInnerHTML:v,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:r,height:r,flex:"0 0 auto",color:`hsl(${l} 55% 52%)`,"--graview-figure-size":`${r}px`}}):(0,a.jsx)("span",{"aria-hidden":n===void 0?"true":void 0,...n===void 0?{}:{role:"img","aria-label":n},"data-graview-figure":e,"data-graview-figure-kind":"dot",style:{display:"inline-block",width:Math.round(r*.8),height:Math.round(r*.5),flex:"0 0 auto",background:`hsl(${l} 55% 52%)`,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)"}})}function A(e,t,i){return o(i?.figures?.[e]??t?.tryDefinition?.(e)?.figure)!==void 0}export{j as a,A as b};
|