graview 0.1.71 → 0.1.72
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.2IOJNFCR.js +1 -0
- package/dist/preview/{chunk.5EQRIZ6I.js → chunk.2Q4ZXP7P.js} +1 -1
- package/dist/preview/{chunk.MEAUTBVM.js → chunk.2TTKQAWQ.js} +1 -1
- package/dist/preview/{chunk.6BBUTKFC.js → chunk.2YSE3SQN.js} +3 -3
- package/dist/preview/{chunk.CGRX6SDE.js → chunk.2ZPR6FRI.js} +1 -1
- package/dist/preview/chunk.3BE4SHZD.js +1 -0
- package/dist/preview/{chunk.TSZ2S3VG.js → chunk.43HWCHBN.js} +1 -1
- package/dist/preview/{chunk.TQ3MNB6K.js → chunk.45OLF6BK.js} +1 -1
- package/dist/preview/{chunk.ZY3NAJDM.js → chunk.47QWCVZD.js} +1 -1
- package/dist/preview/{chunk.WU6D3SPL.js → chunk.4A7BRBEA.js} +1 -1
- package/dist/preview/chunk.4EPCI6VY.js +1 -0
- package/dist/preview/{chunk.UZKBFI52.js → chunk.4PB5UFUJ.js} +1 -1
- package/dist/preview/{chunk.MKJV3BM5.js → chunk.4TDYDIIM.js} +1 -1
- package/dist/preview/{chunk.HXRHEPPJ.js → chunk.4VX7GPFS.js} +1 -1
- package/dist/preview/{chunk.OUF2QFZL.js → chunk.523X2YEQ.js} +1 -1
- package/dist/preview/{chunk.KBJ3UUER.js → chunk.53GQQETN.js} +1 -1
- package/dist/preview/{chunk.DHO3QZYK.js → chunk.5MKZTHU2.js} +1 -1
- package/dist/preview/{chunk.F5O3HR7X.js → chunk.5ZT4R227.js} +1 -1
- package/dist/preview/{chunk.LHCGC3K6.js → chunk.65SI77M7.js} +1 -1
- package/dist/preview/chunk.6ESAFTWB.js +1 -0
- package/dist/preview/chunk.6GUIFP2A.js +1 -0
- package/dist/preview/{chunk.D6ODKMOV.js → chunk.6GZYKHEN.js} +1 -1
- package/dist/preview/{chunk.F7KVEWFH.js → chunk.6YKKZI4H.js} +1 -1
- package/dist/preview/{chunk.Z2BCOZDZ.js → chunk.73RMM4W7.js} +1 -1
- package/dist/preview/{chunk.4O64QV2Y.js → chunk.7DCBIMOI.js} +1 -1
- package/dist/preview/chunk.7JE3J7H4.js +1 -0
- package/dist/preview/{chunk.RDUGUC7R.js → chunk.7QGDWAHH.js} +1 -1
- package/dist/preview/{chunk.7PWLRRUS.js → chunk.7VCYVCYM.js} +2 -2
- package/dist/preview/{chunk.GFBE4VNT.js → chunk.A4TBVXHQ.js} +1 -1
- package/dist/preview/{chunk.LDWWUKKX.js → chunk.A6LJPXJ3.js} +1 -1
- package/dist/preview/chunk.AAPXF6NP.js +1 -0
- package/dist/preview/{chunk.UJ7RTNT4.js → chunk.APUICV5Z.js} +1 -1
- package/dist/preview/chunk.ASNVH2G4.js +25 -0
- package/dist/preview/{chunk.OKHXXIMN.js → chunk.CJHCUHVN.js} +1 -1
- package/dist/preview/chunk.CUEPNS3Z.js +1 -0
- package/dist/preview/{chunk.H33XWGAY.js → chunk.CUJRWBPX.js} +1 -1
- package/dist/preview/{chunk.4YZ2A6SJ.js → chunk.D5PW6YWF.js} +3 -3
- package/dist/preview/chunk.DCIYOZYP.js +1 -0
- package/dist/preview/{chunk.3CLTABGP.js → chunk.DEBW4FH6.js} +1 -1
- package/dist/preview/{chunk.UQZ2P6KD.js → chunk.DYPSFTRP.js} +1 -1
- package/dist/preview/{chunk.BWMPC7LK.js → chunk.E6QZUT4L.js} +1 -1
- package/dist/preview/{chunk.MEBKTW7H.js → chunk.E7QZZRAQ.js} +1 -1
- package/dist/preview/chunk.EHCMBAZO.js +3 -0
- package/dist/preview/chunk.EXTD5JWD.js +1 -0
- package/dist/preview/{chunk.S2BMI23H.js → chunk.EZF2T3XQ.js} +1 -1
- package/dist/preview/chunk.EZSST3IU.js +1 -0
- package/dist/preview/{chunk.7THS3DLZ.js → chunk.F2BZ4SC4.js} +1 -1
- package/dist/preview/chunk.F2I7ERGM.js +1 -0
- package/dist/preview/{chunk.VUDNQOOX.js → chunk.FCV3NX6L.js} +1 -1
- package/dist/preview/{chunk.QVBP4UZG.js → chunk.FFTBUXKX.js} +2 -2
- package/dist/preview/{chunk.7MDGPTYF.js → chunk.FILBI7XA.js} +1 -1
- package/dist/preview/{chunk.D4F6QX5L.js → chunk.FKSI5522.js} +1 -1
- package/dist/preview/{chunk.QNWGDG2Z.js → chunk.FQ2QUDZS.js} +1 -1
- package/dist/preview/{chunk.O5RPSUXV.js → chunk.G2ZDDO3C.js} +1 -1
- package/dist/preview/{chunk.IPKODEOZ.js → chunk.GAVEWSXU.js} +1 -1
- package/dist/preview/chunk.GH6QX7JR.js +87 -0
- package/dist/preview/chunk.GMHBAS45.js +1 -0
- package/dist/preview/{chunk.OYMN3IFX.js → chunk.GXK5PI7I.js} +1 -1
- package/dist/preview/{chunk.DDSAFU3B.js → chunk.GYP3EF6Z.js} +1 -1
- package/dist/preview/chunk.H2RVMT4Y.js +111 -0
- package/dist/preview/chunk.HCHGKI64.js +1 -0
- package/dist/preview/chunk.HE7SAJKZ.js +1 -0
- package/dist/preview/{chunk.JLNTE5CH.js → chunk.HIIYDKFC.js} +2 -2
- package/dist/preview/chunk.HPDUGKEF.js +32 -0
- package/dist/preview/{chunk.H4BPTMED.js → chunk.HQRPOGTS.js} +1 -1
- package/dist/preview/chunk.HUJLELZ3.js +1 -0
- package/dist/preview/chunk.HVRUHRXR.js +1 -0
- package/dist/preview/{chunk.QJJWAYHB.js → chunk.I46VNAMS.js} +1 -1
- package/dist/preview/{chunk.QK4QZVQG.js → chunk.ID4GOKT6.js} +1 -1
- package/dist/preview/{chunk.64K5ELSQ.js → chunk.IZKCTF2R.js} +1 -1
- package/dist/preview/{chunk.4HU2ILFY.js → chunk.IZUAZ6EV.js} +1 -1
- package/dist/preview/{chunk.5PQV7GFE.js → chunk.J3CUBMUZ.js} +1 -1
- package/dist/preview/{chunk.P43LPXXJ.js → chunk.J4D4BIB4.js} +1 -1
- package/dist/preview/{chunk.NI4OPHTL.js → chunk.J7GH2CGV.js} +1 -1
- package/dist/preview/{chunk.5WCSQFS5.js → chunk.JE4RBRKH.js} +1 -1
- package/dist/preview/{chunk.ARGEGV5T.js → chunk.JJSZLCNU.js} +1 -1
- package/dist/preview/{chunk.WS5ORRGS.js → chunk.JKX4J3KG.js} +1 -1
- package/dist/preview/{chunk.ZONRIOIA.js → chunk.JMXBMLKH.js} +1 -1
- package/dist/preview/{chunk.6ZRVVRDQ.js → chunk.JOB3EKS6.js} +1 -1
- package/dist/preview/{chunk.PQTXM4VY.js → chunk.JP33TNCH.js} +1 -1
- package/dist/preview/{chunk.Z3TK2LJM.js → chunk.K6EN2YR4.js} +1 -1
- package/dist/preview/chunk.K6YKXTKC.js +1 -0
- package/dist/preview/{chunk.VPFUOTY7.js → chunk.KAIZDIRK.js} +1 -1
- package/dist/preview/{chunk.KZUHXOZU.js → chunk.KAQGSLC6.js} +3 -3
- package/dist/preview/{chunk.WGH2P2YL.js → chunk.KFYSKZC4.js} +1 -1
- package/dist/preview/chunk.KHVW6Q3T.js +1 -0
- package/dist/preview/chunk.KMFH26SS.js +1 -0
- package/dist/preview/{chunk.67S2UWBT.js → chunk.L3ST2YKI.js} +1 -1
- package/dist/preview/{chunk.V5JB5UJS.js → chunk.L6BLZJ6K.js} +1 -1
- package/dist/preview/{chunk.MQNW3O67.js → chunk.LG2BQ5LB.js} +1 -1
- package/dist/preview/{chunk.T6KOL7TW.js → chunk.LLYHHG67.js} +1 -1
- package/dist/preview/{chunk.MWWNKM3I.js → chunk.LPWANRBL.js} +1 -1
- package/dist/preview/{chunk.EJC7ACZT.js → chunk.LSS64NAA.js} +1 -1
- package/dist/preview/{chunk.NH3VXTGX.js → chunk.MFNWHXGL.js} +1 -1
- package/dist/preview/{chunk.DG3YNOH3.js → chunk.MNH3WUAB.js} +1 -1
- package/dist/preview/chunk.MQ7AB5N4.js +1 -0
- package/dist/preview/{chunk.KJPLX72N.js → chunk.MU5JK5TK.js} +1 -1
- package/dist/preview/{chunk.L6P55HFW.js → chunk.N5CACZ5F.js} +1 -1
- package/dist/preview/{chunk.W3TJF4EH.js → chunk.NFC2TYA6.js} +1 -1
- package/dist/preview/{chunk.VL3YDD7D.js → chunk.NKRDVOLJ.js} +1 -1
- package/dist/preview/{chunk.SGYZM6ZU.js → chunk.NNK2E2EP.js} +1 -1
- package/dist/preview/{chunk.W332P5T3.js → chunk.NVPKYWMF.js} +1 -1
- package/dist/preview/{chunk.EEGVI266.js → chunk.NWJ7ELHN.js} +1 -1
- package/dist/preview/{chunk.7KX36ENH.js → chunk.O5P6LXHF.js} +1 -1
- package/dist/preview/{chunk.DX7RGK5G.js → chunk.OFK6673S.js} +1 -1
- package/dist/preview/{chunk.HPFEYMGP.js → chunk.OG6FEP3K.js} +1 -1
- package/dist/preview/{chunk.EA2KYBBR.js → chunk.OHGAZ3D5.js} +1 -1
- package/dist/preview/{chunk.SPJ34VHA.js → chunk.ONVYKLRX.js} +1 -1
- package/dist/preview/chunk.OQ3FKUP2.js +1 -0
- package/dist/preview/chunk.OUJV4CYS.js +1 -0
- package/dist/preview/{chunk.CVN2XFMF.js → chunk.OWHH7JDV.js} +1 -1
- package/dist/preview/{chunk.G767NLBH.js → chunk.OXDCGGZV.js} +1 -1
- package/dist/preview/{chunk.VVIQSFM4.js → chunk.P3Z4ZCL3.js} +1 -1
- package/dist/preview/{chunk.FNSVGSZI.js → chunk.PF7XQ5R5.js} +1 -1
- package/dist/preview/chunk.PH547SON.js +1 -0
- package/dist/preview/{chunk.N3MXLORL.js → chunk.PS765ODQ.js} +1 -1
- package/dist/preview/{chunk.NXHEOHRR.js → chunk.PVAYYFT2.js} +1 -1
- package/dist/preview/{chunk.Z22C2JJ4.js → chunk.Q6WOIE5I.js} +1 -1
- package/dist/preview/{chunk.CEJIH3CN.js → chunk.QE257AXE.js} +1 -1
- package/dist/preview/chunk.QKNC5OUC.js +1 -0
- package/dist/preview/{chunk.W6L2VAJG.js → chunk.QMGBAKX6.js} +1 -1
- package/dist/preview/{chunk.DJGZOPAS.js → chunk.QNFX5VHW.js} +1 -1
- package/dist/preview/chunk.QPCDAQTW.js +1 -0
- package/dist/preview/{chunk.Y5WQD6KV.js → chunk.QPTQIGLX.js} +1 -1
- package/dist/preview/{chunk.IXYG65TM.js → chunk.R5YGW5ZX.js} +1 -1
- package/dist/preview/{chunk.7FI75ZVE.js → chunk.RJ6KEVZC.js} +1 -1
- package/dist/preview/{chunk.OVSKPBPS.js → chunk.RKVMRP7B.js} +1 -1
- package/dist/preview/{chunk.7TACFS7Q.js → chunk.S7U2CHHG.js} +1 -1
- package/dist/preview/{chunk.HT35PAHI.js → chunk.SD2UYSV6.js} +2 -2
- package/dist/preview/{chunk.LQ5J6YQW.js → chunk.SI5GGFQR.js} +1 -1
- package/dist/preview/{chunk.U5KJQFAP.js → chunk.SMF5S4DQ.js} +1 -1
- package/dist/preview/{chunk.RO3D2RNP.js → chunk.SNDFIJVX.js} +1 -1
- package/dist/preview/{chunk.CEOQY5KS.js → chunk.STHWM422.js} +2 -2
- package/dist/preview/{chunk.X7U3JMBR.js → chunk.SV75TRCH.js} +1 -1
- package/dist/preview/{chunk.Q6GEPVQ7.js → chunk.SXGPRFA4.js} +1 -1
- package/dist/preview/{chunk.6TBQV3NO.js → chunk.T3RFZ66S.js} +1 -1
- package/dist/preview/{chunk.VGYG2IBZ.js → chunk.T6ISUVUP.js} +1 -1
- package/dist/preview/{chunk.L3MLGFIS.js → chunk.TBLOBXZ2.js} +1 -1
- package/dist/preview/{chunk.MT252WP4.js → chunk.TDWJU6GW.js} +1 -1
- package/dist/preview/{chunk.EPSYX2SF.js → chunk.THLT6NVO.js} +1 -1
- package/dist/preview/{chunk.W5O5F4FT.js → chunk.TQCVEKPH.js} +1 -1
- package/dist/preview/{chunk.4ZEHLUXV.js → chunk.TQF5XCUS.js} +1 -1
- package/dist/preview/{chunk.VICBF3MQ.js → chunk.TWXYI5AP.js} +1 -1
- package/dist/preview/{chunk.LNKY6MT4.js → chunk.UOUQZYVD.js} +1 -1
- package/dist/preview/{chunk.FIUPDGUZ.js → chunk.UPL3D3ZO.js} +1 -1
- package/dist/preview/{chunk.GFOZVQBQ.js → chunk.UXW43HNW.js} +1 -1
- package/dist/preview/{chunk.MM7MLBGB.js → chunk.V4GSVXSV.js} +1 -1
- package/dist/preview/chunk.VCEDSOAK.js +1 -0
- package/dist/preview/{chunk.3RRK6UTN.js → chunk.VE4AQFLW.js} +1 -1
- package/dist/preview/{chunk.QDDDKEBH.js → chunk.VGQDPEB5.js} +1 -1
- package/dist/preview/{chunk.XTHSPLZZ.js → chunk.VMYXBFPE.js} +1 -1
- package/dist/preview/{chunk.EHLV3LND.js → chunk.VNI6HZEF.js} +2 -2
- package/dist/preview/chunk.VQRY2NQ6.js +1 -0
- package/dist/preview/{chunk.MFMC35ET.js → chunk.VUE6ILQV.js} +1 -1
- package/dist/preview/{chunk.BSWR5SGX.js → chunk.W2VSEEKX.js} +1 -1
- package/dist/preview/{chunk.4QMAYVPU.js → chunk.WAPY4RCS.js} +1 -1
- package/dist/preview/chunk.WFRSGGU5.js +1 -0
- package/dist/preview/{chunk.QKRQPUCE.js → chunk.WIVNFOQR.js} +1 -1
- package/dist/preview/chunk.WRIBFLVG.js +1 -0
- package/dist/preview/{chunk.RHIP2UYE.js → chunk.WWD2TS47.js} +1 -1
- package/dist/preview/{chunk.7XGU6KVF.js → chunk.WWFOQDPR.js} +2 -2
- package/dist/preview/{chunk.JNK5WBSU.js → chunk.X5MCAUFX.js} +1 -1
- package/dist/preview/{chunk.G5AF5IXL.js → chunk.XBWFQ54R.js} +1 -1
- package/dist/preview/{chunk.7LPHWJB4.js → chunk.XMBGT6UT.js} +1 -1
- package/dist/preview/{chunk.FOHZPYUV.js → chunk.XP4IVKKR.js} +1 -1
- package/dist/preview/chunk.XYBWBMNU.js +1 -0
- package/dist/preview/{chunk.OPMGQS5J.js → chunk.YC2IDHQX.js} +1 -1
- package/dist/preview/{chunk.JAPTTM6Y.js → chunk.YCYJHPWS.js} +1 -1
- package/dist/preview/{chunk.T6UJEXFL.js → chunk.YF5GCOSZ.js} +1 -1
- package/dist/preview/{chunk.VDFQFLTU.js → chunk.YGGBGHZU.js} +1 -1
- package/dist/preview/{chunk.U6V4KZF5.js → chunk.YRC6PKXP.js} +1 -1
- package/dist/preview/{chunk.EJIQDMLU.js → chunk.YRN67Z5K.js} +1 -1
- package/dist/preview/{chunk.6L6RUOSF.js → chunk.ZDUKVXBI.js} +1 -1
- package/dist/preview/index.html +55 -55
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.23DATB5Y.js +0 -1
- package/dist/preview/chunk.2INDKSJI.js +0 -1
- package/dist/preview/chunk.45HUV56Z.js +0 -1
- package/dist/preview/chunk.4LWWXIM4.js +0 -1
- package/dist/preview/chunk.4UDST6IF.js +0 -1
- package/dist/preview/chunk.6A3KTD66.js +0 -1
- package/dist/preview/chunk.6IMRCKB4.js +0 -1
- package/dist/preview/chunk.7ZLCA3WK.js +0 -1
- package/dist/preview/chunk.CPK6CYKN.js +0 -111
- package/dist/preview/chunk.DGYWNM5U.js +0 -1
- package/dist/preview/chunk.EOSN5DWW.js +0 -1
- package/dist/preview/chunk.EUXAIG73.js +0 -1
- package/dist/preview/chunk.EZQK23AB.js +0 -1
- package/dist/preview/chunk.F6MY6WJ4.js +0 -1
- package/dist/preview/chunk.FW6M6GIU.js +0 -32
- package/dist/preview/chunk.GKYJQE5A.js +0 -1
- package/dist/preview/chunk.HLKDYI6J.js +0 -1
- package/dist/preview/chunk.IZDB777E.js +0 -1
- package/dist/preview/chunk.JCKIJSW7.js +0 -25
- package/dist/preview/chunk.JREA2XDG.js +0 -1
- package/dist/preview/chunk.MJ4T6YXI.js +0 -1
- package/dist/preview/chunk.ML4X7VVK.js +0 -1
- package/dist/preview/chunk.NNGG7RCO.js +0 -1
- package/dist/preview/chunk.OOQG2AEF.js +0 -1
- package/dist/preview/chunk.RJ7VSWTA.js +0 -87
- package/dist/preview/chunk.RSMCTI2N.js +0 -1
- package/dist/preview/chunk.TBEKEHFS.js +0 -1
- package/dist/preview/chunk.TO3ZKCA2.js +0 -1
- package/dist/preview/chunk.TTM5GQ2U.js +0 -1
- package/dist/preview/chunk.TUBY6SV3.js +0 -1
- package/dist/preview/chunk.UJPX3BUV.js +0 -1
- package/dist/preview/chunk.X2UYEA7H.js +0 -1
- package/dist/preview/chunk.XSM4OTF4.js +0 -1
- package/dist/preview/chunk.YXVUJ3NB.js +0 -1
- package/dist/preview/chunk.ZGLOXN7O.js +0 -1
- package/dist/preview/chunk.ZLQIGZXO.js +0 -3
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{c as Er}from"./chunk.J4D4BIB4.js";import{Da as Rn,G as R,P as Cn,Qa as M,T as Mn,Va as Fn,Wa as Vn,Za as U,_ as P,a as be,bb as J,e as ke,ia as xe,j as Nn,ja as re,l as Ie,m as $e,s as Bn,ua as On,v as se,x as Hn,z as Tn}from"./chunk.ASNVH2G4.js";import{a as C}from"./chunk.SDO3U72B.js";import{$d as we,Hb as un,Uc as gn,Xc as fn,ae as ie,be as vn,cd as _,dd as mn,de as De,ed as yn,fe as bn,gd as hn,ge as kn,he as ne,id as wn,jd as Ve,ma as ye,oe as xn,pb as pn,pe as Sn,qa as he,qe as Ln,ra as cn,re as Pn,te as En,ue as ve,ye as An}from"./chunk.ZDUKVXBI.js";import{b as w}from"./chunk.AJZBJBMO.js";var We=w(R(),1),Qt=e=>{let n=e??null;for(;n?.parentElement?.closest('[data-testid="context-menu"]');)n=n.parentElement.closest('[data-testid="context-menu"]');let r=n?.getBoundingClientRect();return r&&r.width>0?{left:r.left,top:r.top}:void 0},_e=new WeakMap,Se=e=>{let n=_e.get(e);return n||_e.set(e,n={open:null,drawn:0,listeners:new Set}),n},Ut=e=>{let n=_e.get(e);n?.preload&&(typeof performance<"u"&&typeof performance.mark=="function"&&performance.mark("graview:quick-ask-preload"),n.preload(),n.preload=void 0)},Ar=e=>{for(let n of[...e.listeners])n()},Nr=0;function Jt(e,n){let r=Se(e);r.open=n?{...n,at:++Nr}:null,Ar(r)}var Dn=e=>n=>{let r=Se(e);return r.listeners.add(n),()=>void r.listeners.delete(n)};function In(e){let n=()=>e?Se(e).drawn>0:!1;return(0,We.useSyncExternalStore)(e?Dn(e):Br,n,n)}var Br=()=>()=>{};function Xt(e){let n=()=>Se(e).open;return(0,We.useSyncExternalStore)(Dn(e),n,n)}var V=w(R(),1),$n=w(Er(),1);function Hr(e){let[n,r]=(0,V.useState)(null),[t,i]=(0,V.useState)(null);return(0,V.useLayoutEffect)(()=>{e.current!==t&&i(e.current)}),(0,V.useLayoutEffect)(()=>{if(!t||typeof ResizeObserver>"u")return;let o=()=>Math.round(t.getBoundingClientRect().width),s=o();r(s);let p=new ResizeObserver(()=>{let d=o();d!==s&&(s=d,(0,$n.flushSync)(()=>r(d)))});return p.observe(t),()=>p.disconnect()},[t]),n}function Tr(e=!0){let[n,r]=(0,V.useState)();return(0,V.useEffect)(()=>{if(!e)return r(void 0);let t=0,i=()=>r(innerHeight),o=()=>{i(),clearTimeout(t),t=window.setTimeout(i,300)},s=p=>{for(let[d,l]of[[window,"resize"],[window,"orientationchange"],[window.visualViewport,"resize"]])d?.[p](l,o)};return s("addEventListener"),i(),()=>{clearTimeout(t),s("removeEventListener")}},[e]),n}var Le={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap"};var N=w(R(),1);var B=w(P(),1),_n=6e3;function Cr(e){return{...e,notify:n=>e.notify({...n,from:"framework"})}}var Mr=e=>({place:"overview",...e&&!/^(aggregate|kind):/.test(e)?{record:e}:{}});function Or(){let e=[],n=0,r=new Set,t=new Map,i,o=()=>{for(let l of[...r])l()},s=l=>{if(clearTimeout(t.get(l.id)),t.delete(l.id),l.kind!=="toast")return;let u=(l.actions?.length??0)+(l.action?1:0),g=l.timeout??(u>0?!1:_n);g!==!1&&t.set(l.id,setTimeout(()=>i?.()?s(l):p(l.id),g))},p=l=>{clearTimeout(t.get(l)),t.delete(l),e.some(u=>u.id===l)&&(e=e.filter(u=>u.id!==l),o())},d=l=>{e=e.some(u=>u.id===l.id)?e.map(u=>u.id===l.id?l:u):[...e,l],s(l),o()};return{notify(l){let u=l.id??`notice-${++n}`;return d({...l,id:u,said:++n}),{id:u,dismiss:()=>p(u),update:g=>{let c=e.find(h=>h.id===u);c&&d({...c,...g,id:u,kind:c.kind,said:g.sentence!==void 0&&g.sentence!==c.sentence?++n:c.said})}}},dismiss:p,hold(l){i=l},list:()=>e,subscribe(l){return r.add(l),()=>r.delete(l)}}}function Rr({notices:e}){let n=e.reduce((p,d)=>!p||d.said>p.said?d:p,void 0),[r,t]=(0,N.useState)(""),[i,o]=(0,N.useState)(""),s=(0,N.useRef)(0);return(0,N.useEffect)(()=>{if(!n||n.said===s.current)return;s.current=n.said;let p=n.tone==="bad";(p?o:t)("");let d=setTimeout(()=>(p?o:t)(n.sentence),50);return()=>clearTimeout(d)},[n]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{role:"status","aria-live":"polite","data-testid":"notices-said",style:Le,children:r}),(0,B.jsx)("div",{role:"alert","data-testid":"notices-alarm",style:Le,children:i})]})}var Fr=(0,N.createContext)(null);function Vr({board:e,anchor:n,report:r}){let t=(0,N.useSyncExternalStore)(e.subscribe,e.list,e.list);return(0,N.useEffect)(()=>$r(ze.prefetch),[]),(0,B.jsxs)(B.Fragment,{children:[t.length>0?(0,B.jsx)(N.Suspense,{fallback:null,children:(0,B.jsx)(Ir,{notices:t,anchor:n,board:e,...r?{report:r}:{}})}):null,(0,B.jsx)(Rr,{notices:t})]})}var ze=M(C(()=>(__graviewPreload(import.meta.url,["./chunk.MB7LKKUD.js","./chunk.GH6QX7JR.js","./chunk.J4D4BIB4.js","./chunk.ASNVH2G4.js","./chunk.SDO3U72B.js","./chunk.ZDUKVXBI.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.2Q4ZXP7P.js")))),Dr=()=>ze.load().then(()=>{},()=>{}),Ir=ze.part((e,n)=>(0,B.jsx)(e.NoticeStacks,{...n}),{quiet:!0});function $r(e){let n=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&e()},r=globalThis;if(r.requestIdleCallback){let i=r.requestIdleCallback(n,{timeout:5e3});return()=>r.cancelIdleCallback?.(i)}let t=setTimeout(n,2500);return()=>clearTimeout(t)}var O=M(C(()=>(__graviewPreload(import.meta.url,["./chunk.VE4AQFLW.js","./chunk.LPWANRBL.js","./chunk.I46VNAMS.js","./chunk.3BE4SHZD.js","./chunk.5OS4SYHE.js","./chunk.LG2BQ5LB.js","./chunk.U5P23GO7.js","./chunk.SNDFIJVX.js","./chunk.2TTKQAWQ.js","./chunk.CJHCUHVN.js","./chunk.MFNWHXGL.js","./chunk.DCIYOZYP.js","./chunk.A4TBVXHQ.js","./chunk.7QGDWAHH.js","./chunk.YC2IDHQX.js","./chunk.WIVNFOQR.js","./chunk.MIE4TJRW.js","./chunk.DEBW4FH6.js","./chunk.RD2FSSLV.js","./chunk.OWHH7JDV.js","./chunk.T3RFZ66S.js","./chunk.TDWJU6GW.js","./chunk.P3Z4ZCL3.js","./chunk.45OLF6BK.js","./chunk.T6ISUVUP.js","./chunk.GH6QX7JR.js","./chunk.J4D4BIB4.js","./chunk.ASNVH2G4.js","./chunk.SDO3U72B.js","./chunk.ZDUKVXBI.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.HPDUGKEF.js"))));var y=w(R(),1);var Ke=e=>Math.round(e).toString(16).padStart(2,"0");function Wn(e){let n=r=>{let t=e?.schemes?.[r]?.ground,i=t?gn(t)[0]:void 0;return i?`#${Ke(i.r)}${Ke(i.g)}${Ke(i.b)}`:void 0};if(e?.scheme==="light"||e?.scheme==="dark"){let r=n(e.scheme);return r?[{color:r}]:[]}return["light","dark"].flatMap(r=>{let t=n(r);return t?[{color:t,media:`(prefers-color-scheme: ${r})`}]:[]})}var Ge=w(R(),1);var zn=w(R(),1);function le(e){return(0,zn.useMemo)(()=>e===void 0||e===""?void 0:{__html:e},[e])}var W=w(P(),1);function je({brand:e,size:n=22}){let r=Cn(),t=hn(e),i=Kn(t?.light),o=i?Kn(t?.dark):void 0,s=le(i!==void 0&&_(i)?i:void 0),p=le(o!==void 0&&_(o)?o:void 0),d={display:"inline-flex",flex:"0 0 auto",height:n,color:"var(--graview-accent)"},l=wn(e);if(l)return(0,W.jsx)("span",{className:"graview-logo graview-emoji-mark","data-testid":"app-mark","aria-hidden":!0,style:{...d,alignItems:"center",fontSize:`${n*.86/16}rem`,lineHeight:1},children:l});if(!i)return null;let u=e?.logoAlt??e?.name??"",g=u!==""&&u!==e?.name,c=g?{role:"img","aria-label":u}:{"aria-hidden":!0};if(o){let v=(b,S,L)=>_(b)?(0,W.jsx)("span",{className:"graview-logo-face","data-graview-scheme-only":L,dangerouslySetInnerHTML:S}):(0,W.jsx)("img",{className:"graview-logo-face","data-graview-scheme-only":L,src:Ve(r,b),alt:""});return(0,W.jsxs)("span",{className:"graview-logo","data-testid":"app-mark",style:d,...c,children:[v(i,s,"light"),v(o,p,"dark")]})}let h=t?.darkFallback==="invert"?{"data-graview-logo-fallback":"invert"}:{};return _(i)?(0,W.jsx)("span",{className:"graview-logo","data-testid":"app-mark",style:d,...h,...c,dangerouslySetInnerHTML:s}):(0,W.jsx)("img",{className:"graview-logo","data-testid":"app-mark",src:Ve(r,i),alt:g?u:"",...h,style:{...d,width:"auto"}})}function Kn(e){if(!(!e||!yn(e)))return _(e)&&mn(e)!==null?void 0:e}function _r(e){(0,Ge.useEffect)(()=>{if(!e||typeof document>"u")return;let n=[...document.querySelectorAll('link[rel~="icon"]')],r=n.map(i=>i.getAttribute("href")),t;n.length===0&&(t=document.createElement("link"),t.rel="icon",t.setAttribute("data-graview-favicon",""),document.head.appendChild(t),n.push(t));for(let i of n)i.href=e;return()=>{t&&t.remove(),n.forEach((i,o)=>{i!==t&&r[o]!==null&&r[o]!==void 0&&i.setAttribute("href",r[o])})}},[e])}function Wr(e){let n=e?JSON.stringify(Wn(e)):"[]";(0,Ge.useEffect)(()=>{let r=JSON.parse(n);if(r.length===0||typeof document>"u")return;let t=[...document.head.querySelectorAll('meta[name="theme-color"]:not([data-graview-theme-color])')];t.forEach(o=>o.setAttribute("name","graview-theme-color-held"));let i=r.map(({color:o,media:s})=>{let p=document.createElement("meta");return p.name="theme-color",p.content=o,s&&(p.media=s),p.setAttribute("data-graview-theme-color",""),document.head.appendChild(p),p});return()=>{i.forEach(o=>o.remove()),t.forEach(o=>o.setAttribute("name","theme-color"))}},[n])}var a=w(P(),1),zr=O.part((e,n)=>(0,a.jsx)(e.TidyFoot,{...n}),{quiet:!0}),Kr=O.part((e,n)=>(0,a.jsx)(e.AppMenuPane,{...n}),{what:"The app menu"}),Gr=O.part((e,n)=>(0,a.jsx)(e.Here,{...n}),{quiet:!0});function jr(){let e=re(),[n,r]=(0,y.useState)("");return(0,y.useEffect)(()=>e?.store.subscribe((t,i)=>{i.some(o=>o.author.id!==e.principal.id)&&O.load().then(o=>o.sayTheirChange(i,e,r),String)}),[e]),(0,a.jsx)("span",{role:"status",className:"graview-bar-said",children:n})}var qn="home",Yn="/",X="scene:whole";function qr(e){let{store:n,principal:r,views:t}=e,i=n.kindsKeptFrom(r),o=n.schema.kinds.filter(f=>!n.modules.disabledKinds.has(f)&&!i.has(f)),s=t?.arrangement?.(),p=t?.places()??[],d=Pn(s,n.schema,p),l=Ln(n.schema,s,[...n.modules.administered.values()].flatMap(f=>f.kinds??[])),u=(f,E)=>(!n.graph.size.nodes||n.graph.count(f)>0)&&(d?E?d.places.has(`${f}|${E}`):d.kinds.has(f):!l.has(f)),g=[{key:qn,label:"Home",path:Yn,group:"home",primary:!0}],c=p.filter(f=>o.includes(f.kind)&&f.as!==En),h=c.filter(f=>!f.hidden),v=new Set(ie(h).map(f=>ne(f,p,n.schema).toLowerCase())),b=f=>bn(f.as,kn(f,p)?De(n.schema,f.kind).slice(1):void 0),S=new Set(s?.hide??[]),L=An(o,s?.order,h);for(let{kind:f,view:E}of L){if(E){g.push({key:`place:${E.kind}:${E.as}`,label:ne(E,p,n.schema),path:b(E),group:"lists",kind:f,primary:d?d.places.has(`${f}|${E.as}`):!0});continue}let q=he(n.schema,f),A=v.has(q.toLowerCase());g.push({key:`kind:${f}`,label:A?cn(n.schema,f):q,path:De(n.schema,f),group:"lists",kind:f,primary:A||S.has(f)?!1:u(f),...S.has(f)?{hidden:!0}:{}})}for(let f of ie(c)){if(L.some(A=>A.view&&we(A.view,f)))continue;let E=b(f),q=[f.kind,...f.over??[]].some(A=>o.includes(A)&&u(A,f.as));g.some(A=>A.path===E)||g.push({key:`place:${f.kind}:${f.as}`,label:ne(f,p,n.schema),path:E,group:"pictures",kind:f.kind,primary:q,hidden:f.hidden})}return o.some(f=>Object.keys(n.schema.tryDefinition(f)?.edges??{}).length>0)&&g.push({key:"connections",label:"Connections",path:"/map",group:"pictures",primary:!1}),g}function Yr(e,n){let[r="/",t=""]=n.split("?"),i=e.find(s=>s.path===(t?`${r}?${t}`:r))??e.find(s=>s.path===r);if(i)return i.key;let o=`/${r.split("/").filter(Boolean)[0]??""}`;return e.find(s=>s.group==="lists"&&s.path===o)?.key??null}var Qn=(0,y.createContext)(null),Qr=()=>(0,y.useContext)(Qn),K=30,Un=48,de=640,Jn=900,Qe=4,qe=2;function Xn(e){let{widths:n,current:r,room:t,more:i,gap:o=Qe,primary:s,most:p=Sn}=e;if(n.length===0||!(t>0)||!(i>0)||n.some(g=>!(g>0)))return null;let d=(g,c)=>g.reduce((h,v)=>h+n[v],0)+o*Math.max(0,g.length-1)+(c?o+i:0),l=(g,c)=>r<0||!g.includes(r)||g.slice(0,c).includes(r)?g.slice(0,c):[...g.filter(h=>h!==r).slice(0,c-1),r].sort((h,v)=>h-v),u=l(n.map((g,c)=>c).filter(g=>s?.[g]!==!1||g===r),p);if(d(u,u.length<n.length)<=t)return u.length>=qe?u:null;for(let g=u.length-1;g>=qe;g--){let c=l(u,g);if(d(c,!0)<=t)return c}return null}var Ur=`
|
|
2
|
+
.graview-bar{display:block;margin:0;padding:0;container:graview-bar/inline-size;flex:0 0 auto;position:relative;background:var(--graview-bar);border-bottom:1px solid var(--graview-edge);color:var(--graview-ink);font-family:var(--graview-font-body,system-ui)}
|
|
3
|
+
.graview-bar-row{display:flex;flex-wrap:nowrap;align-items:center;gap:16px;height:${Un-1}px;margin:0;padding:0 16px}
|
|
4
|
+
.graview-bar-home,.graview-bar-place,.graview-bar-item,.graview-bar-at{display:inline-flex;align-items:center;box-sizing:border-box;min-width:0;margin:0;border:0;background:none;box-shadow:none;font:inherit;letter-spacing:normal;text-transform:none;text-decoration:none;color:var(--graview-ink);cursor:pointer;text-align:left}
|
|
5
|
+
.graview-bar-app{display:flex;align-items:center;gap:2px;flex:0 1 auto;max-width:50%}
|
|
6
|
+
.graview-bar-app::after{content:"";flex:0 100000 auto;width:2px;min-width:0}
|
|
7
|
+
.graview-bar-name{margin:0;display:flex;font-family:var(--graview-font-display,var(--graview-font-body,system-ui));font-size:.9375rem;font-weight:600;line-height:1.25}
|
|
8
|
+
.graview-bar-home{gap:8px;min-width:auto;min-height:30px;padding:0;letter-spacing:-.005em}
|
|
9
|
+
.graview-bar-app-name{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis;overflow-wrap:normal;word-break:normal}
|
|
10
|
+
.graview-bar-said{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
|
|
11
|
+
.graview-bar-menu-open{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;box-sizing:border-box;width:24px;height:30px;margin:0;padding:0;border:1px solid transparent;border-radius:6px;background:none;box-shadow:none;color:var(--graview-ink-muted);cursor:pointer}
|
|
12
|
+
.graview-bar-menu-open:is(:hover,[aria-expanded=true]){border-color:var(--graview-edge);color:var(--graview-ink)}
|
|
13
|
+
.graview-bar-share{gap:6px;padding:0 10px}
|
|
14
|
+
.graview-bar-share-pane{display:grid;gap:10px;width:min(300px,calc(100vw - 24px));padding:14px;border-radius:10px;border:1px solid var(--graview-edge);background:var(--graview-float);box-shadow:var(--graview-lift-high);color:var(--graview-ink);font-size:.875rem;line-height:1.45}
|
|
15
|
+
.graview-bar-share-pane[hidden]{display:none}
|
|
16
|
+
.graview-bar-share-pane p{margin:0}
|
|
17
|
+
.graview-bar-share-links{display:flex;flex-wrap:wrap;gap:4px 16px}
|
|
18
|
+
.graview-bar-share-pane a,.graview-bar-share-pane button{justify-self:start;display:inline-flex;align-items:center;min-height:28px;padding:0;border:0;background:none;box-shadow:none;font:inherit;font-weight:600;color:var(--graview-accent);text-decoration:none;cursor:pointer}
|
|
19
|
+
.graview-bar-status{gap:6px;padding:0 8px;cursor:default;font-weight:400}
|
|
20
|
+
a.graview-bar-status{cursor:pointer}
|
|
21
|
+
.graview-bar-mid{display:flex;flex:1 100 0;min-width:0}
|
|
22
|
+
.graview-bar-mid[data-place]{min-width:9em;flex-basis:auto}
|
|
23
|
+
.graview-bar-place-at{position:relative;display:inline-flex;min-width:0;max-width:100%}
|
|
24
|
+
.graview-bar-place{gap:6px;height:30px;max-width:100%;padding:0 8px;border:1px solid transparent;border-radius:8px;font-size:.875rem;font-weight:600}
|
|
25
|
+
.graview-bar-place:hover{border-color:var(--graview-edge);color:var(--graview-ink)}
|
|
26
|
+
.graview-bar-place-words{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
27
|
+
.graview-bar-mid[data-places=standing]{flex:0 0 auto}
|
|
28
|
+
.graview-bar-places{display:flex;align-items:center;gap:${Qe}px;min-width:0;margin:0;padding:0}
|
|
29
|
+
.graview-bar-at{gap:6px;flex:0 0 auto;height:30px;padding:0 8px;border-block:2px solid transparent;border-radius:0;font-size:.875rem;font-weight:500;white-space:nowrap;color:var(--graview-ink-muted)}
|
|
30
|
+
.graview-bar-at:is(:hover,[aria-current],[aria-expanded=true]){color:var(--graview-ink)}
|
|
31
|
+
.graview-bar-at[aria-current]{font-weight:600;border-bottom-color:var(--graview-accent)}
|
|
32
|
+
.graview-bar-ruler{position:absolute;left:0;top:0;display:flex;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none}
|
|
33
|
+
.graview-bar-ruler .graview-bar-at{font-weight:600}
|
|
34
|
+
.graview-bar-ruler>.graview-bar-name{flex:none;white-space:nowrap;letter-spacing:-.005em}
|
|
35
|
+
.graview-bar-list{display:grid;align-content:start;width:min(320px,calc(100vw - 24px));height:auto;max-height:min(70vh,560px);overflow:auto;margin:0;padding:6px;border-radius:10px;border:1px solid var(--graview-edge);background:var(--graview-float);box-shadow:var(--graview-lift-high);color:var(--graview-ink)}
|
|
36
|
+
.graview-bar-list[hidden]{display:none}
|
|
37
|
+
.graview-bar-list p{margin:8px 8px 2px;font-size:.6875rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--graview-ink-muted)}
|
|
38
|
+
.graview-bar-list ul,.graview-bar-list li{display:grid;margin:0;padding:0;list-style:none}
|
|
39
|
+
.graview-bar-item{align-items:flex-start;gap:10px;width:100%;padding:7px 8px;border-radius:7px;font-size:.875rem;line-height:1.3;overflow-wrap:anywhere}
|
|
40
|
+
.graview-bar-item:hover{background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
|
|
41
|
+
.graview-bar-item[aria-current]{font-weight:600;background:color-mix(in srgb,var(--graview-accent) 14%,transparent)}
|
|
42
|
+
.graview-bar-mark{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:14px;height:1.3em;color:var(--graview-ink-muted)}
|
|
43
|
+
.graview-bar :focus-visible{outline:2px solid var(--graview-accent);outline-offset:1px}
|
|
44
|
+
.graview-bar-tools{display:contents}
|
|
45
|
+
.graview-bar-tools>*{margin-left:-8px}
|
|
46
|
+
.graview-bar-tools>:is(.graview-bar-find,.graview-bar-find-open){margin-left:auto}
|
|
47
|
+
.graview-bar-own{display:flex;align-items:center;flex:0 0 auto}
|
|
48
|
+
.graview-bar-own:empty{display:none}
|
|
49
|
+
.graview-bar-host{display:flex;align-items:center;gap:2px;flex:0 0 auto}
|
|
50
|
+
.graview-bar-host-action{display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;min-width:${K}px;height:${K}px;margin:0;padding:0 10px;border-radius:8px;border:1px solid transparent;background:none;box-shadow:none;font:inherit;font-size:.875rem;font-weight:500;letter-spacing:normal;text-transform:none;white-space:nowrap;color:var(--graview-ink-muted);cursor:pointer}
|
|
51
|
+
.graview-bar-host-action:is(:hover,[aria-expanded=true]){border-color:var(--graview-edge);color:var(--graview-ink)}
|
|
52
|
+
.graview-bar-host-action:is([data-folded],[data-icon-only]){padding:0;justify-content:center}
|
|
53
|
+
.graview-bar-host-mark{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:16px;height:16px;font-size:.9375rem;line-height:1}
|
|
54
|
+
.graview-bar-host-mark svg{width:16px;height:16px}
|
|
55
|
+
.graview-bar-list .graview-bar-host-action{width:100%;justify-content:flex-start;white-space:normal;overflow-wrap:anywhere}
|
|
56
|
+
.graview-bar-host-action[data-icon-only]>.graview-bar-host-words{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
|
57
|
+
.graview-bar-find{position:relative;display:flex;min-width:7.5rem;flex:0 600 9rem;--graview-bar-find-end:3.25em}
|
|
58
|
+
.graview-bar-find-slot{display:flex;flex:1;min-width:0}
|
|
59
|
+
.graview-bar-find-keys{position:absolute;right:10px;line-height:30px;pointer-events:none;font-size:.75rem;color:var(--graview-ink-faint)}
|
|
60
|
+
.graview-bar-find:is(:focus-within,:has(input:not(:placeholder-shown))){flex-basis:16rem;--graview-bar-find-end:10px}
|
|
61
|
+
:is(:focus-within,:has(input:not(:placeholder-shown)))>.graview-bar-find-keys,.graview-bar-find-open{display:none}
|
|
62
|
+
.graview-bar-line{display:flex;flex:0 0 auto;padding:6px 8px;background:var(--graview-ground);border-bottom:1px solid var(--graview-edge);font-family:var(--graview-font-body,system-ui)}
|
|
63
|
+
.graview-bar-line .graview-bar-place{height:auto;min-height:32px}
|
|
64
|
+
.graview-bar-line .graview-bar-place-words{white-space:normal}
|
|
65
|
+
@media (pointer:coarse){.graview-bar-find-keys{display:none}}
|
|
66
|
+
@container graview-bar (max-width: ${Jn-1}px){
|
|
67
|
+
.graview-bar-find{display:none}
|
|
68
|
+
.graview-bar-find-open{display:inline-flex}
|
|
69
|
+
.graview-bar-tools>.graview-bar-find-open{margin-left:auto}
|
|
70
|
+
.graview-bar[data-finding] :is(.graview-bar-app,.graview-bar-mid,.graview-bar-find-open){display:none}
|
|
71
|
+
.graview-bar[data-finding] .graview-bar-find{display:flex;flex:1 1 auto;min-width:0;margin-left:0}
|
|
72
|
+
}
|
|
73
|
+
@container graview-bar (max-width: ${de-1}px){
|
|
74
|
+
.graview-bar-row{gap:10px;padding:0 12px}
|
|
75
|
+
.graview-bar-app{max-width:none;flex:1 1 auto;min-width:28px}
|
|
76
|
+
.graview-bar-home{min-width:28px}
|
|
77
|
+
.graview-bar-name,.graview-bar-app-name{min-width:0}
|
|
78
|
+
.graview-bar-mid{display:none}
|
|
79
|
+
.graview-bar-share{padding:0}
|
|
80
|
+
.graview-bar-share>.graview-bar-share-words{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
|
81
|
+
.graview-bar-status[data-icon]{padding:0}
|
|
82
|
+
.graview-bar-status[data-icon]>.graview-bar-status-words{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
|
83
|
+
}
|
|
84
|
+
@container graview-bar (max-width: 300px){
|
|
85
|
+
.graview-bar-row{gap:4px;padding:0 10px}
|
|
86
|
+
}`,te={display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,minWidth:K,height:K,padding:0,borderRadius:8,border:"1px solid transparent",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"0.875rem",cursor:"pointer",flex:"0 0 auto"};function Jr({brand:e,name:n,heading:r=1,home:t,faces:i,places:o,current:s,reach:p,tools:d,find:l=!0,description:u,findBox:g,onFind:c,scenePlaces:h,skips:v,named:b=!0,history:S=!0,actions:L,appMenu:ue=Xr,scheme:f,share:E,status:q}){let A=(0,y.useRef)(null),dr=re()?.who.size,[ae,cr]=(0,y.useState)(null),[nn,pr]=(0,y.useState)(null),[I,ur]=(0,y.useState)(!1),[Z,gr]=(0,y.useState)(!1),[fr,rn]=(0,y.useState)(!1),[tn,mr]=(0,y.useState)(null),[yr,hr]=(0,y.useState)(!0),ge=i?i.pages.current:!h,oe=ge?{places:o,current:s,reach:p}:h,Ce=oe&&{...oe,places:vn(oe.places),here:oe.places.find(m=>m.key===oe.current)?.label},k=Ce&&Ce.places.length>0?Ce:null,Me=k?k.places.findIndex(m=>m.key===k.current):-1,an=k?k.places.map(m=>m.primary===!1?"0":"1").join(""):"",$=(0,y.useCallback)(()=>{let m=A.current;if(!m)return;let H=gt(m,Me,an);H!==void 0&&mr(H)},[Me,an]);(0,y.useLayoutEffect)(()=>{let m=A.current;if(!m)return;let H=()=>{let T=m.getBoundingClientRect().width;ur(T<de),gr(T<Jn);let Pr=m.querySelector("[data-graview-bar-host-ruler]");hr(T>=de+(Pr?.getBoundingClientRect().width??0)),m.style.setProperty("--graview-bar-width",`${Math.round(T)}px`),$()};H();let Y=typeof document>"u"?void 0:document.fonts;if(Y?.ready.then($),Y?.addEventListener?.("loadingdone",$),typeof ResizeObserver>"u")return()=>Y?.removeEventListener?.("loadingdone",$);let Q=new ResizeObserver(H);Q.observe(m);for(let T of m.querySelectorAll(".graview-bar-tools > *"))Q.observe(T);let ee=m.querySelector(".graview-bar-tools"),F=typeof MutationObserver>"u"||!ee?null:new MutationObserver(()=>{for(let T of ee.children)Q.observe(T)});return F?.observe(ee,{childList:!0}),()=>{F?.disconnect(),Q.disconnect(),Y?.removeEventListener?.("loadingdone",$)}},[$]);let Oe=(0,y.useRef)(c);Oe.current=c,(0,y.useLayoutEffect)(()=>{Oe.current?.(l&&ae?{slot:ae,compact:Z,own:nn}:null)},[l,ae,Z,nn]),(0,y.useLayoutEffect)(()=>()=>Oe.current?.(null),[]);let wr=(0,y.useCallback)(()=>{rn(!0),requestAnimationFrame(()=>ae?.querySelector("input")?.focus())},[ae]),on=(0,y.useRef)(null),fe=(0,y.useRef)(!1),Re=(0,y.useCallback)(()=>{rn(!1),fe.current&&(fe.current=!1,requestAnimationFrame(()=>on.current?.focus()))},[]),sn=(0,y.useRef)(null);(0,y.useEffect)(()=>{let m=sn.current;if(!m||!Z)return;let H=()=>!!m.querySelector("input")?.value,Y=F=>{let T=F.relatedTarget;T instanceof Node&&m.contains(T)||H()||Re()},Q=F=>{F.key==="Escape"&&(fe.current=!0)},ee=F=>{F.key==="Escape"&&queueMicrotask(()=>{!F.defaultPrevented||!H()?Re():fe.current=!1})};return m.addEventListener("focusout",Y),m.addEventListener("keydown",Q,!0),m.addEventListener("keydown",ee),()=>{m.removeEventListener("focusout",Y),m.removeEventListener("keydown",Q,!0),m.removeEventListener("keydown",ee)}},[Z,Re]);let vr=r===!1?"span":`h${r}`,br=t.href!==void 0?"a":"button",kr=m=>H=>{!m||!er(H)||(H.preventDefault(),m())},xr=!ge,ln=k&&!I&&tn!==null&&!(Me<0&&k.here)?tn.split(",").map(Number).filter(m=>m<k.places.length):null,me=k?(0,a.jsx)(pt,{places:k.places,current:k.current,here:k.here,reach:k.reach,scene:xr,stands:ln}):null,Sr=k?k.places.map(m=>m.label).join(`
|
|
87
|
+
`):"";(0,y.useLayoutEffect)($,[$,n,e,Sr,k?.current,ge,I,Z,l]);let Lr=Mn(),Fe=S&&b&&Lr!==null,dn=!!i||ue.length>0||!!f||Fe;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("header",{ref:A,className:"graview-bar","data-testid":"app-bar","data-graview-app-bar":"",...fr&&Z?{"data-finding":""}:{},children:[(0,a.jsx)("style",{children:Ur}),v,(0,a.jsxs)("div",{className:"graview-bar-row",children:[b?(0,a.jsxs)("div",{className:"graview-bar-app",children:[(0,a.jsx)(vr,{className:"graview-bar-name",children:(0,a.jsxs)(br,{...t.href!==void 0?{href:t.href,onClick:kr(t.go)}:{type:"button",onClick:t.go},"data-testid":"app-home",...t.current?{"aria-current":"page"}:{},title:u?`${n} \u2014 ${u}`:`${n} \u2014 home`,className:"graview-bar-home",children:[(0,a.jsx)(je,{brand:e,size:20}),(0,a.jsx)("span",{className:"graview-bar-app-name","data-testid":"app-name",children:n})]})}),dn?(0,a.jsx)(Gn,{name:n,faces:i,rows:ue,scheme:f,history:Fe}):null]}):dn?(0,a.jsx)(Gn,{name:n,faces:i,rows:ue,scheme:f,history:Fe}):null,(0,a.jsx)("div",{className:"graview-bar-mid",...ln?{"data-places":"standing"}:!I&&me?{"data-place":""}:{},children:I?null:me}),!I&&k&&k.places.length>1?(0,a.jsxs)("span",{className:"graview-bar-ruler","aria-hidden":"true","data-graview-bar-ruler":"",children:[k.places.map(m=>(0,a.jsx)("span",{className:"graview-bar-at",children:m.label},m.key)),(0,a.jsxs)("span",{className:"graview-bar-at",children:[Pe,(0,a.jsx)(Ue,{})]})]}):null,L&&L.length>0?(0,a.jsx)("span",{className:"graview-bar-ruler","aria-hidden":"true","data-graview-bar-host-ruler":"",children:(0,a.jsx)("span",{className:"graview-bar-host",children:L.map(m=>(0,a.jsxs)("span",{className:"graview-bar-host-action",...m.iconOnly&&m.icon?{"data-icon-only":""}:{},children:[m.icon?(0,a.jsx)(Je,{icon:m.icon}):null,(0,a.jsx)("span",{className:"graview-bar-host-words",children:m.label})]},m.label))})}):null,b?(0,a.jsx)("span",{className:"graview-bar-ruler","aria-hidden":"true",children:(0,a.jsx)("span",{className:"graview-bar-name",children:n})}):null,(0,a.jsxs)("div",{className:"graview-bar-tools",children:[l?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"graview-bar-find-open",ref:on,"data-testid":"app-find-open","aria-label":"Find",title:"Find",onClick:wr,style:{...te,display:void 0},children:(0,a.jsx)(it,{})}),(0,a.jsxs)("div",{ref:sn,className:"graview-bar-find","data-testid":"app-find",children:[(0,a.jsx)("div",{ref:cr,className:"graview-bar-find-slot",children:g}),(0,a.jsx)(at,{})]})]}):null,(0,a.jsx)("div",{ref:pr,className:"graview-bar-own","data-graview-bar-own":""}),L&&L.length>0?(0,a.jsx)(dt,{actions:L,folded:!(L.length<=2&&L.every(m=>m.iconOnly&&m.icon))&&(I||!yr)}):null,q?(0,a.jsx)(et,{status:q}):null,dr?(0,a.jsx)(y.Suspense,{fallback:null,children:(0,a.jsx)(Gr,{scene:!ge,compact:I})}):null,E?(0,a.jsx)(Zr,{share:E}):null,(0,a.jsx)(jr,{}),d]})]})]}),I&&me?(0,a.jsx)("div",{className:"graview-bar-line","data-graview-place-line":"","data-testid":"app-place-line",children:me}):null]})}var Xr=[],Ye="graview:go-to-face";function Gn({name:e,faces:n,rows:r,scheme:t,history:i}){let o=J("app-menu",{align:"start"}),s=()=>O.prefetch(),p=(0,y.useRef)(null),d=(0,y.useRef)(n);return d.current=n,(0,y.useEffect)(()=>{let l=p.current;if(!l)return;let u=g=>{let c=d.current?.[g.detail];!c||c.current||(c.reach?.(),c.go())};return l.addEventListener(Ye,u),()=>l.removeEventListener(Ye,u)},[]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{type:"button",className:"graview-bar-menu-open","data-testid":"app-menu-open",...o.trigger,ref:l=>{o.trigger.ref(l),p.current=l},onClick:o.toggle,onPointerEnter:s,onFocus:s,"aria-label":`${e} \u2014 app menu`,title:"App menu",...n?{"data-scene":n.scene.label,"data-pages":n.pages.label}:{},children:(0,a.jsx)(Ue,{})}),(0,a.jsx)("div",{...o.pane,"data-testid":"app-menu",hidden:!o.open,className:"graview-bar-list graview-app-menu",style:U,"aria-label":`${e} \u2014 app menu`,role:"group",children:o.open?(0,a.jsx)(y.Suspense,{fallback:null,children:(0,a.jsx)(Kr,{faces:n,rows:r,scheme:t,history:i,close:()=>o.setOpen(!1)})}):null})]})}function Zn({mark:e="lock"}){return e==="lock"?(0,a.jsxs)(z,{size:14,children:[(0,a.jsx)("rect",{x:"2.75",y:"6.25",width:"8.5",height:"6",rx:"1.25",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),(0,a.jsx)("path",{d:"M4.75 6.25 V4.5 a2.25 2.25 0 0 1 4.5 0 V6.25",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]}):e==="globe"?(0,a.jsxs)(z,{size:14,children:[(0,a.jsx)("circle",{cx:"7",cy:"7",r:"5.25",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),(0,a.jsx)("path",{d:"M1.75 7 H12.25 M7 1.75 C4.75 4.5 4.75 9.5 7 12.25 M7 1.75 C9.25 4.5 9.25 9.5 7 12.25",fill:"none",stroke:"currentColor",strokeWidth:"1.1"})]}):e==="people"?(0,a.jsxs)(z,{size:14,children:[(0,a.jsx)("circle",{cx:"5",cy:"5",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),(0,a.jsx)("path",{d:"M1.5 12 a3.5 3.5 0 0 1 7 0",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),(0,a.jsx)("circle",{cx:"10",cy:"5.5",r:"1.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),(0,a.jsx)("path",{d:"M9.5 9 a3 3 0 0 1 3.5 3",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]}):(0,a.jsx)(Je,{icon:e})}function Zr({share:e}){let n=J("share"),r=`graview-share-said-${(0,y.useId)().replace(/:/g,"")}`,t=e.label??"Share",i=e.link;return(0,a.jsxs)("div",{className:"graview-bar-share-at",children:[(0,a.jsxs)("button",{type:"button",className:"graview-bar-tool graview-bar-share","data-testid":"app-share-open",...n.trigger,onClick:n.toggle,"aria-describedby":r,title:e.description,children:[(0,a.jsx)(Zn,{mark:e.mark}),(0,a.jsx)("span",{className:"graview-bar-share-words",children:t})]}),(0,a.jsx)("span",{id:r,className:"graview-bar-said",children:e.description}),(0,a.jsxs)("div",{...n.pane,"data-testid":"app-share",hidden:!n.open,className:"graview-bar-share-pane",style:U,role:"group","aria-label":t,children:[(0,a.jsx)("p",{"data-testid":"app-share-said",children:e.description}),i||e.secondLink?(0,a.jsxs)("div",{className:"graview-bar-share-links",children:[i?(0,a.jsx)(jn,{link:i,testId:"app-share-link",close:()=>n.setOpen(!1)}):null,e.secondLink?(0,a.jsx)(jn,{link:e.secondLink,testId:"app-share-second-link",close:()=>n.setOpen(!1)}):null]}):null]})]})}function et({status:e}){let n=`graview-status-said-${(0,y.useId)().replace(/:/g,"")}`,r=(0,a.jsxs)(a.Fragment,{children:[e.icon?(0,a.jsx)(Zn,{mark:e.icon}):null,(0,a.jsx)("span",{className:"graview-bar-status-words",children:e.label})]}),t={className:"graview-bar-tool graview-bar-status","data-testid":"app-status",title:e.description,"aria-describedby":n,...e.icon?{"data-icon":""}:{}};return(0,a.jsxs)(a.Fragment,{children:[e.href!==void 0?(0,a.jsx)("a",{...t,href:e.href,...e.target?{target:e.target,rel:"noopener"}:{},children:r}):(0,a.jsx)("span",{...t,tabIndex:0,children:r}),(0,a.jsx)("span",{id:n,className:"graview-bar-said",children:e.description})]})}function jn({link:e,testId:n,close:r}){return e.href!==void 0?(0,a.jsx)("a",{href:e.href,"data-testid":n,...e.target?{target:e.target,rel:"noopener"}:{},onClick:()=>{e.onSelect?.(),r()},children:e.label}):(0,a.jsx)("button",{type:"button","data-testid":n,onClick:()=>{r(),e.onSelect?.()},children:e.label})}function nt(e){let n=e.querySelector(".graview-bar-row"),r=e.getBoundingClientRect();if(!n||!(r.width>0))return 0;let t=r.right-(parseFloat(getComputedStyle(n).paddingRight)||0),i=t;for(let o of n.querySelectorAll(":scope > *, .graview-bar-tools > *")){if(o.classList.contains("graview-bar-tools")||o.classList.contains("graview-bar-ruler")||o.classList.contains("graview-bar-said"))continue;let s=o.getBoundingClientRect();s.width>0&&(i=Math.max(i,s.right))}return Math.max(0,i-t)}function rt(e){let n=e.querySelector(".graview-bar-app"),r=e.querySelector(".graview-bar-ruler>.graview-bar-name");if(!n||!r)return 0;let t=s=>s?.getBoundingClientRect().width??0,i=t(n.firstElementChild)-t(e.querySelector(".graview-bar-app-name"))+t(r)+2,o=parseFloat(getComputedStyle(n).maxWidth)/100*(n.parentElement.clientWidth-2*n.offsetLeft)||1/0;return i>o+.5?null:Math.max(0,i-t(n))}var er=e=>e.button===0&&!(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey);function tt(){let e=globalThis.navigator?.platform??"";return/Mac|iPhone|iPad|iPod/.test(e)?"\u2318K":"Ctrl K"}function at(){let e=In(re()?.aiDesk);return(0,a.jsx)("span",{className:"graview-bar-find-keys","data-testid":"app-find-keys","aria-hidden":"true",children:e?"/":tt()})}function z({size:e,box:n=e,children:r}){return(0,a.jsx)("svg",{width:e,height:e,viewBox:`0 0 ${n} ${n}`,"aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto"},children:r})}function ot(){return(0,a.jsxs)(z,{size:14,children:[(0,a.jsx)("path",{d:"M7 1.5 L12.5 4.5 L7 7.5 L1.5 4.5 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),(0,a.jsx)("path",{d:"M1.5 7.5 L7 10.5 L12.5 7.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round",strokeLinecap:"round"})]})}function Ue(){return(0,a.jsx)(z,{size:10,children:(0,a.jsx)("path",{d:"M2 3.5 L5 6.5 L8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function it(){return(0,a.jsxs)(z,{size:16,children:[(0,a.jsx)("circle",{cx:"7",cy:"7",r:"4.75",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),(0,a.jsx)("path",{d:"M10.5 10.5 L14 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function st({place:e}){if(e.key===X)return(0,a.jsx)(ot,{});if(e.group==="home")return(0,a.jsx)(z,{size:13,box:14,children:(0,a.jsx)("path",{d:"M2 6.5 L7 2 L12 6.5 V12 H2 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})});let n=e.kind?`hsl(${Math.round(fn(e.kind))} 55% 52%`:"rgb(128 128 128";return(0,a.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:12,height:8,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",background:e.group==="lists"?`${n})`:`linear-gradient(${n}), ${n})) center / 6px 4px no-repeat, ${n} / 0.35)`}})}var lt=[{group:"home"},{group:"lists",heading:"Lists"},{group:"pictures",heading:"Pictures"}],Pe="More";function dt({actions:e,folded:n}){let r=J("host-actions",{popover:n}),t=e.map(o=>o.label).join(", "),i=o=>e.map(s=>(0,a.jsxs)("button",{type:"button",className:n?"graview-bar-host-action graview-bar-item":"graview-bar-host-action","data-testid":"host-bar-action",...!n&&s.iconOnly&&s.icon?{"data-icon-only":"",title:s.label}:{},onClick:()=>{o(),s.onSelect()},children:[s.icon?(0,a.jsx)(Je,{icon:s.icon}):null,(0,a.jsx)("span",{className:"graview-bar-host-words",children:s.label})]},s.label));return n?(0,a.jsxs)("div",{className:"graview-bar-host",children:[(0,a.jsx)("button",{type:"button",className:"graview-bar-host-action","data-testid":"host-bar-actions-open","data-folded":"",...r.trigger,onClick:r.toggle,"aria-label":`${Pe} \u2014 ${t}`,title:t,children:(0,a.jsxs)(z,{size:16,children:[(0,a.jsx)("circle",{cx:"3",cy:"8",r:"1.4",fill:"currentColor"}),(0,a.jsx)("circle",{cx:"8",cy:"8",r:"1.4",fill:"currentColor"}),(0,a.jsx)("circle",{cx:"13",cy:"8",r:"1.4",fill:"currentColor"})]})}),(0,a.jsx)("div",{...r.pane,"data-testid":"host-bar-actions",hidden:!r.open,className:"graview-bar-list",style:U,"aria-label":"From the host",children:i(()=>r.setOpen(!1))})]}):(0,a.jsx)("div",{className:"graview-bar-host","data-testid":"host-bar-actions-standing",role:"group","aria-label":"From the host",children:i(()=>{})})}function Je({icon:e}){let n=le(_(e)?e:void 0);return n?(0,a.jsx)("span",{className:"graview-bar-host-mark","aria-hidden":"true",dangerouslySetInnerHTML:n}):(0,a.jsx)("span",{className:"graview-bar-host-mark","aria-hidden":"true",children:e})}function nr({place:e,current:n,reach:r,standing:t,done:i}){let o=e.key===n,s=r.href?.(e.path);return(0,a.jsxs)(s!==void 0?"a":"button",{className:t?"graview-bar-at":"graview-bar-item","data-testid":`app-place-${e.key}`,"data-place-path":e.path,...o?{"aria-current":"page"}:{},...s!==void 0?{href:s}:{type:"button"},onClick:d=>{i(),r.go&&(s!==void 0&&!er(d)||(d.preventDefault(),r.go(e)))},children:[t?null:(0,a.jsx)("span",{className:"graview-bar-mark",children:(0,a.jsx)(st,{place:e})}),t&&o?(0,a.jsx)("span",{"data-testid":"app-place-current",children:e.label}):(0,a.jsx)("span",{children:e.label})]})}function ct({places:e,current:n,reach:r,id:t,done:i}){return(0,a.jsx)(a.Fragment,{children:lt.map(({group:o,heading:s})=>{let p=e.filter(l=>l.group===o);if(p.length===0)return null;let d=`${t}-${o}`;return(0,a.jsxs)("div",{role:"group",...s?{"aria-labelledby":d}:{"aria-label":p[0].label},"data-place-group":o,children:[s?(0,a.jsx)("p",{id:d,children:s}):null,(0,a.jsx)("ul",{children:p.map(l=>(0,a.jsx)("li",{children:(0,a.jsx)(nr,{place:l,current:n,reach:r,standing:!1,done:i})},l.key))})]},o)})})}function pt({places:e,current:n,here:r,reach:t,scene:i,stands:o}){let s=J("places"),p=(0,y.useRef)(o);s.open||(p.current=o);let d=p.current,u=e.find(S=>S.key===n)?.label??r??"Places",g=d?e.filter((S,L)=>!d.includes(L)):e,c=ut(e,n,i),h=re(),v=h?.keptViews?.current(),b=!!(v&&(v.removed.length>0||h.views.places().some(S=>S.hidden)||v.may.lenses&&(h.views.arrangement?.()?.hide?.length??0)>0));return(0,a.jsxs)("nav",{className:d?"graview-bar-places":"graview-bar-place-at","aria-label":i?"What the scene shows":"The app\u2019s places",...d?{"data-testid":"app-places-standing"}:{},...c,children:[d?.map(S=>(0,a.jsx)(nr,{place:e[S],current:n,reach:t,standing:!0,done:()=>{}},e[S].key)),g.length>0||b?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{type:"button",className:d?"graview-bar-at":"graview-bar-place","data-testid":"app-places-open",...s.trigger,onClick:s.toggle,"aria-label":d?`${Pe} \u2014 ${g.length} more ${i?"pictures":"places"}`:`${u} \u2014 ${i?"what the scene shows":"every place"}`,title:d?g.map(S=>S.label).join(", "):u,children:[d?Pe:(0,a.jsx)("span",{className:"graview-bar-place-words","data-testid":"app-place-current",children:u}),(0,a.jsx)(Ue,{})]}),(0,a.jsxs)("div",{...s.pane,"data-testid":"app-places",hidden:!s.open,className:"graview-bar-list",style:U,children:[(0,a.jsx)(ct,{places:g,current:n,reach:t,id:s.pane.id,done:()=>s.setOpen(!1)}),b&&s.open?(0,a.jsx)(y.Suspense,{fallback:null,children:(0,a.jsx)(zr,{id:s.pane.id,scene:i,reach:t,done:()=>s.setOpen(!1)})}):null]})]}):null]})}function ut(e,n,r){let t=re()?.setMenuAt,i=o=>{let s=o.target.closest?.("[data-place-path],[data-testid=app-places-open]");if(!s||!t)return;let p={at:0};o.type==="pointerdown"?document.addEventListener("pointerup",()=>p.at||=Date.now(),{once:!0}):o.preventDefault();let d=o.nativeEvent;O.load().then(l=>l.placeGesture(d,s,e,n,r,t,p),String)};return{onContextMenu:o=>o.shiftKey||i(o),onKeyDown:o=>(o.key==="ContextMenu"||o.key==="F10"&&o.shiftKey)&&i(o),onPointerDown:o=>o.pointerType!=="mouse"&&o.isPrimary&&i(o)}}function gt(e,n,r){let t=e.querySelector("[data-graview-bar-ruler]"),i=e.querySelector(".graview-bar-mid");if(!t||!i)return null;let o=e.querySelector(".graview-bar-find");if(o?.matches(":focus-within"))return;if(e.getBoundingClientRect().width<de)return null;let s=rt(e);if(s===null)return null;let p=[...t.children].map(h=>h.getBoundingClientRect().width),d=p.pop()??0,l=i.getBoundingClientRect().left+s,u=o&&getComputedStyle(o).display!=="none"?o.getBoundingClientRect():void 0,g=(u&&u.width>0?u.right-l-(parseFloat(getComputedStyle(o).minWidth)||0)-16:i.getBoundingClientRect().width-s)-nt(e),c=[...r].map(h=>h!=="0");return Xn({widths:p,current:n,room:Math.floor(g),more:d,primary:c})?.join(",")??null}var ft=e=>`graview:lenses:${e}`,mt=(e,n)=>e?.name??n.kinds.join(",");function Xe(e){try{let n=JSON.parse(localStorage.getItem(ft(e))??"[]");return Array.isArray(n)?n.filter(r=>typeof r?.title=="string"&&typeof r.lens=="string"):[]}catch{return[]}}var G=w(R(),1);var x=w(P(),1);function yt({profileHref:e,keeping:n,hostActions:r=ht,signature:t=!1}){let{store:i,principal:o,seats:s,people:p,signIn:d}=xe(),l=J("profile"),u=l.open,[g,c]=(0,G.useState)(!1);(0,G.useEffect)(()=>bt(Ee),[]),u&&!g&&c(!0),(0,G.useEffect)(()=>{u&&Ee()},[u]);let h=o.id===void 0?void 0:i.graph.getNode(o.id),v=h===void 0?o.id===void 0?"Nobody in particular":pn(o,{graph:i.graph,schema:i.schema,seats:s,people:p}):ye(i.schema.tryDefinition(h.kind),h),b=d?"Not signed in \u2014 sign in and your settings":`${v} \u2014 you, your seat and your settings`;return(0,x.jsxs)("div",{style:{position:"relative"},children:[(0,x.jsx)("button",{type:"button","data-testid":"profile-button",...l.trigger,onClick:l.toggle,onPointerEnter:Ee,onFocus:Ee,"aria-label":b,title:b,style:{...te,borderRadius:999},children:(0,x.jsx)("span",{"aria-hidden":"true","data-testid":"profile-mark",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:K-4,height:K-4,borderRadius:999,fontSize:"0.8125rem",fontWeight:600,background:"var(--graview-panel-muted)",color:"var(--graview-ink)",border:"1px solid var(--graview-edge)"},children:d?(0,x.jsxs)("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,x.jsx)("circle",{cx:"8",cy:"5.5",r:"2.75"}),(0,x.jsx)("path",{d:"M2.75 14c.6-2.9 2.7-4.5 5.25-4.5s4.65 1.6 5.25 4.5"})]}):kt(v)})}),(0,x.jsxs)("section",{...l.pane,"aria-label":"Profile","data-testid":"profile","data-graview-offstage":"",hidden:!u,style:{...U,width:280,maxWidth:"calc(100vw - 32px)",maxHeight:"min(62cqh, 520px)",overflowY:"auto",overflowX:"hidden",display:u?"grid":"none",gap:12,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[g?(0,x.jsx)(G.Suspense,{fallback:null,children:(0,x.jsx)(wt,{part:"top",name:v,me:h,profileHref:e,hostActions:r,close:()=>l.setOpen(!1)})}):null,(0,x.jsxs)("div",{className:"graview-profile-keeping","data-testid":"profile-keeping",style:St,children:[(0,x.jsx)("span",{style:xt,children:"Keeping this app"}),n]}),g?(0,x.jsx)(G.Suspense,{fallback:null,children:(0,x.jsx)(vt,{part:"rest",name:v,me:h,hostActions:r,signature:t,close:()=>l.setOpen(!1)})}):null]})]})}var ht=[],Ee=()=>O.prefetch(),wt=O.part((e,n)=>(0,x.jsx)(e.ProfilePane,{...n}),{what:"The rest of your menu"}),vt=O.part((e,n)=>(0,x.jsx)(e.ProfilePane,{...n}),{quiet:!0});function bt(e){let n=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&e()},r=globalThis;if(r.requestIdleCallback){let i=r.requestIdleCallback(n,{timeout:5e3});return()=>r.cancelIdleCallback?.(i)}let t=setTimeout(n,2500);return()=>clearTimeout(t)}function kt(e){return(e.trim()[0]??"?").toUpperCase()}var xt={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},St={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};function Lt(e){return!(e==="hidden"||e===!1)}var ce=w(R(),1);var rr="Everything",Ne="scene:district:",Ae=e=>`scene:${e.kind}:${e.as}`;function tr(e){let{view:n}=e,r=e.places.filter(c=>!e.hidden.has(c.kind)),t=ie(r),i=(c,h)=>{if(c===X)return Ie($e(h,!0),"view",null);if(c.startsWith(Ne))return Nn(Ie($e(h,!1),"view",null),c.slice(Ne.length));let v=t.find(b=>Ae(b)===c);return v?Tn(h,v.over?.find(b=>h.focusId===se(b))??v.kind,v.as):null},o=n.within?.view,s=c=>n.focusId===se(c.kind)&&(o===void 0?r.filter(h=>h.kind===c.kind).at(-1)===c:o===c.as),p=r.find(c=>s(c)&&(o!==void 0||!n.overview)),d=p?t.find(c=>we(c,p)):void 0,l=t.filter(c=>!c.hidden||c===d),u=d||n.overview||!n.focusId?void 0:Pt(n.focusId,e);return{places:[{key:X,label:rr,path:`${ve}${ke(i(X,be))}`,group:"home"},...l.map(c=>({key:Ae(c),label:ne(c,r,e.schema),path:`${ve}${ke(i(Ae(c),be))}`,group:"pictures",kind:c.kind,hidden:c.hidden})),...u?[{...u,path:`${ve}${ke(i(u.key,be))}`}]:[]],current:d?Ae(d):u?.key??X,to:i}}function Pt(e,n){let r=Hn(e);if(r.length>0)return r.some(i=>n.hidden.has(i))?void 0:{key:`${Ne}${e}`,label:r.map(i=>he(n.schema,i)).join(" and "),group:"lists",kind:r[0],hidden:!0};let t=n.nameOf?.(e);return t?{key:`${Ne}${e}`,label:t,group:"lists",hidden:!0}:void 0}function Et(){let{store:e,views:n,hiddenKinds:r,principal:t}=xe(),{view:i,go:o}=Vn(),s=n.places(),p=(0,ce.useMemo)(()=>e.kindsKeptFrom(t),[e,t]),d=(0,ce.useMemo)(()=>g=>{let c=e.graph.getNode(g);if(!(!c||r.has(c.kind)||p.has(c.kind)))return ye(e.schema.tryDefinition(c.kind),c)},[e,r,p]),l=(0,ce.useMemo)(()=>tr({places:s,hidden:r,view:i,schema:e.schema,nameOf:d}),[s,r,i,e.schema,d]),u=(0,ce.useMemo)(()=>({go:g=>{let c=l.to(g.key,i);c&&o(c)}}),[l,i,o]);return{places:l.places,current:l.current,reach:u}}var pe=w(P(),1);function At({clean:e="All rules hold"}){return Fn().length>0?null:(0,pe.jsx)("div",{style:{position:"relative",display:"inline-flex"},children:(0,pe.jsx)("button",{type:"button","data-testid":"standing","aria-disabled":!0,"aria-label":e,title:e,style:{...te,position:"relative",cursor:"default",color:"var(--graview-ink-muted)"},children:(0,pe.jsx)(ar,{tone:"var(--graview-good)"})})})}function Nt(e,n){return e.length===0?n:un(e)}function ar({tone:e}){return(0,pe.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:999,flex:"0 0 auto",background:e}})}function Bt(e,n,r=[]){if(e.focusId)return e.focusId;let i=(e.selection??[]).map(Bn).find(o=>o!==null)??r.find(o=>n.includes(o))??n[0]??null;return i===null?null:se(i)}var He=w(P(),1),Be=M(C(()=>(__graviewPreload(import.meta.url,["./chunk.KMFH26SS.js","./chunk.YF5GCOSZ.js","./chunk.F2BZ4SC4.js","./chunk.WAPY4RCS.js","./chunk.JKX4J3KG.js","./chunk.JMXBMLKH.js","./chunk.PVAYYFT2.js","./chunk.LG2BQ5LB.js","./chunk.L3ST2YKI.js","./chunk.7VCYVCYM.js","./chunk.MFNWHXGL.js","./chunk.DCIYOZYP.js","./chunk.WVUJXDXZ.js","./chunk.J7GH2CGV.js","./chunk.SMF5S4DQ.js","./chunk.XP4IVKKR.js","./chunk.R5YGW5ZX.js","./chunk.QMGBAKX6.js","./chunk.PS765ODQ.js","./chunk.MIE4TJRW.js","./chunk.DEBW4FH6.js","./chunk.RD2FSSLV.js","./chunk.OWHH7JDV.js","./chunk.T3RFZ66S.js","./chunk.TDWJU6GW.js","./chunk.P3Z4ZCL3.js","./chunk.45OLF6BK.js","./chunk.T6ISUVUP.js","./chunk.GH6QX7JR.js","./chunk.J4D4BIB4.js","./chunk.ASNVH2G4.js","./chunk.SDO3U72B.js","./chunk.ZDUKVXBI.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.6ESAFTWB.js"))));function Ht(){return Be.load().then(()=>{})}var Tt=[{cardinality:"one",fidelity:"full",slot:"page"},{cardinality:"one",fidelity:"summary",slot:"card"},{cardinality:"one",fidelity:"glyph",slot:"row"},{cardinality:"many",fidelity:"full"},{cardinality:"many",fidelity:"summary"},{cardinality:"many",fidelity:"glyph"}];function Ct({schema:e,specs:n,kind:r,view:t}){let i=Be.current.frameworkViews(e,n).lookup(r,{cardinality:t.cardinality,fidelity:t.fidelity});return i?(0,He.jsx)(i,{...t}):null}var Mt=Be.part((e,n)=>(0,He.jsx)(Ct,{...n}),{what:"This view"});function or(e,n,r){for(let t of n.kinds){let i=r?.[t];for(let o of Tt){let s=d=>(0,He.jsx)(Mt,{schema:n,specs:r,kind:t,view:d}),p=o.slot!==void 0&&i?.[o.slot]!==void 0;p&&(s.says=(d,l)=>Be.current?.frameworkViews(n,r).lookup(t,{cardinality:o.cardinality,fidelity:o.fidelity})?.says?.(d,l)),e.register(t,{cardinality:o.cardinality,fidelity:o.fidelity},p?s:On(s))}}return e}function Ot(e,n){return or(Rn(e),e,n)}var Ze=w(R(),1);var D=w(P(),1),ir=M(C(()=>(__graviewPreload(import.meta.url,["./chunk.L6BLZJ6K.js","./chunk.VNI6HZEF.js","./chunk.THLT6NVO.js","./chunk.HIIYDKFC.js","./chunk.GYP3EF6Z.js","./chunk.KMFH26SS.js","./chunk.YF5GCOSZ.js","./chunk.F2BZ4SC4.js","./chunk.WAPY4RCS.js","./chunk.JJSZLCNU.js","./chunk.JKX4J3KG.js","./chunk.JMXBMLKH.js","./chunk.PVAYYFT2.js","./chunk.HJCQ6I3S.js","./chunk.QNFX5VHW.js","./chunk.UXW43HNW.js","./chunk.LG2BQ5LB.js","./chunk.L3ST2YKI.js","./chunk.7VCYVCYM.js","./chunk.MFNWHXGL.js","./chunk.DCIYOZYP.js","./chunk.JP33TNCH.js","./chunk.BIDL7GQD.js","./chunk.O5P6LXHF.js","./chunk.VGQDPEB5.js","./chunk.WIVNFOQR.js","./chunk.53GQQETN.js","./chunk.Q5WEOX3Q.js","./chunk.7DCBIMOI.js","./chunk.GXK5PI7I.js","./chunk.DYPSFTRP.js","./chunk.WVUJXDXZ.js","./chunk.J7GH2CGV.js","./chunk.SMF5S4DQ.js","./chunk.XP4IVKKR.js","./chunk.R5YGW5ZX.js","./chunk.QMGBAKX6.js","./chunk.PS765ODQ.js","./chunk.MIE4TJRW.js","./chunk.DEBW4FH6.js","./chunk.RD2FSSLV.js","./chunk.OWHH7JDV.js","./chunk.T3RFZ66S.js","./chunk.TDWJU6GW.js","./chunk.P3Z4ZCL3.js","./chunk.45OLF6BK.js","./chunk.T6ISUVUP.js","./chunk.GH6QX7JR.js","./chunk.J4D4BIB4.js","./chunk.ASNVH2G4.js","./chunk.SDO3U72B.js","./chunk.ZDUKVXBI.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VQRY2NQ6.js"))));function Rt({lens:e,view:n}){let r=ir.current.declaredLensView(e);return(0,D.jsx)(r,{...n})}var Ft=ir.part((e,n)=>(0,D.jsx)(Rt,{...n}),{what:"This picture"});function Vt(e){let n=t=>(0,D.jsx)(Ze.Suspense,{fallback:null,children:(0,D.jsx)(Ft,{lens:e,view:t})});e.lens==="blocks"&&(n.flows=!0);let r=e.lens==="blocks"?e.options.blocks?.[0]:void 0;return typeof r?.headline=="string"&&(n.lede=r),e.create===!1&&(n.creates=!1),n}var sr=M(C(()=>(__graviewPreload(import.meta.url,["./chunk.KMFH26SS.js","./chunk.YF5GCOSZ.js","./chunk.F2BZ4SC4.js","./chunk.WAPY4RCS.js","./chunk.JKX4J3KG.js","./chunk.JMXBMLKH.js","./chunk.PVAYYFT2.js","./chunk.LG2BQ5LB.js","./chunk.L3ST2YKI.js","./chunk.7VCYVCYM.js","./chunk.MFNWHXGL.js","./chunk.DCIYOZYP.js","./chunk.WVUJXDXZ.js","./chunk.J7GH2CGV.js","./chunk.SMF5S4DQ.js","./chunk.XP4IVKKR.js","./chunk.R5YGW5ZX.js","./chunk.QMGBAKX6.js","./chunk.PS765ODQ.js","./chunk.MIE4TJRW.js","./chunk.DEBW4FH6.js","./chunk.RD2FSSLV.js","./chunk.OWHH7JDV.js","./chunk.T3RFZ66S.js","./chunk.TDWJU6GW.js","./chunk.P3Z4ZCL3.js","./chunk.45OLF6BK.js","./chunk.T6ISUVUP.js","./chunk.GH6QX7JR.js","./chunk.J4D4BIB4.js","./chunk.ASNVH2G4.js","./chunk.SDO3U72B.js","./chunk.ZDUKVXBI.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.EZSST3IU.js"))));function Dt({blocks:e,view:n}){let r=sr.current.homeView(e);return(0,D.jsx)(r,{...n})}var It=sr.part((e,n)=>(0,D.jsx)(Dt,{...n}),{what:"The home"});function $t(e){let n=r=>(0,D.jsx)(Ze.Suspense,{fallback:null,children:(0,D.jsx)(It,{blocks:e,view:r})});return Object.defineProperty(n,Symbol.for("graview.home-blocks"),{value:!0}),n}function _t(e,n){return n.home&&n.home.length>0&&e.home?.($t(n.home)),lr(e,n),e.arrange?.(n.pages),e}function lr(e,n,r){for(let t of xn(n).drawn){if(r&&e.places().some(s=>s.title===t.title))continue;let i=Vt(t),o={title:t.title,lens:t.lens,...t.across?{across:t.across}:{},...r?{beside:r}:{},...t.hidden?{hidden:!0}:{},over:t.kinds,...r?{}:{declared:!0}};for(let s of t.kinds)e.register(s,{cardinality:"many",fidelity:"full"},i,o),e.register(s,{cardinality:"many",fidelity:"summary"},i,o)}}function Wt(e,n,r){r.length>0&&lr(e,{schema:n,lenses:r.map(({lens:t,...i})=>({...i,name:t}))},!0)}function zt(e,n,r){Wt(e,n,Xe(r))}var j=w(R(),1),Te=w(P(),1);var en=e=>`graview:first-look:${e}`;function Kt(e,n){if(e.seen!==void 0)try{return typeof e.seen=="function"?e.seen():e.seen}catch{return!0}try{return window.localStorage.getItem(en(n))!==null}catch{return!1}}function Gt(e,n){if(e.seen===void 0)try{window.localStorage.setItem(en(n),"seen")}catch{}}var jt=M(C(()=>(__graviewPreload(import.meta.url,["./chunk.ASNVH2G4.js","./chunk.SDO3U72B.js","./chunk.ZDUKVXBI.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.NWJ7ELHN.js")))),qt=jt.part((e,n)=>{let r=e.FirstLookHints;return(0,Te.jsx)(r,{...n})},{quiet:!0});function Yt({firstLook:e,root:n,app:r}){let t=(0,j.useRef)(null);t.current=e===!0?{}:e||null;let[i,o]=(0,j.useState)(()=>t.current!==null&&typeof window<"u"&&!Kt(t.current,r)),s=(0,j.useCallback)(p=>{if(o(!1),p===null)return;let d=t.current??{};Gt(d,r),d.onDone?.(p)},[r]);return!i||t.current===null?null:(0,Te.jsx)(j.Suspense,{fallback:null,children:(0,Te.jsx)(qt,{root:n,steps:t.current.steps??[],onEnd:s})})}export{Qt as a,Se as b,Ut as c,Ar as d,Jt as e,In as f,Xt as g,le as h,_r as i,Wr as j,Hr as k,Tr as l,Le as m,Cr as n,Mr as o,Or as p,Fr as q,Vr as r,Dr as s,O as t,qr as u,Yr as v,Qn as w,Qr as x,K as y,te as z,Jr as A,Ye as B,yt as C,Lt as D,Et as E,ft as F,mt as G,Xe as H,At as I,Nt as J,ar as K,Bt as L,_t as M,Wt as N,zt as O,Ht as P,Ot as Q,Yt as R};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{c as ae,d as se,f as oe,i as re,j as le,k as de,m as ce,n as ue,o as pe,p as ge,q as fe}from"./chunk.4VX7GPFS.js";import{b as Z,c as ee,d as te,e as ne}from"./chunk.FQ2QUDZS.js";import{a as ie}from"./chunk.VGQDPEB5.js";import{a as Y}from"./chunk.6YKKZI4H.js";import{a as X,e as O}from"./chunk.GH6QX7JR.js";import{E as K,G as Ie,J as Q,U as V,_,ia as j}from"./chunk.ASNVH2G4.js";import{zd as J}from"./chunk.ZDUKVXBI.js";import{b as N}from"./chunk.AJZBJBMO.js";var c=N(Ie(),1);var o=N(_(),1);function he(e,a,t){let i=a.on==="selection"?a.ids:a.on==="record"||a.on==="field"?[a.id]:[],l=i.length>0?ie(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(s=>({mutation:s.mutation,label:s.label,args:s.args,open:s.open,why:s.why,...s.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:a,principal:e.principal,interaction:se(),places:e.places,selection:e.selection,...l?{acts:l}:{},...e.place?{place:e.place}:{},...t?{said:t}:{},...e.app.purpose?{purpose:e.app.purpose}:{}}}async function be(e,a,t){let i=await (__graviewPreload(import.meta.url,["./chunk.IZKCTF2R.js","./chunk.G4JJXA63.js","./chunk.TBY5IR7C.js","./chunk.JP33TNCH.js","./chunk.BIDL7GQD.js","./chunk.O5P6LXHF.js","./chunk.ONVYKLRX.js","./chunk.XOZU4OFA.js","./chunk.53GQQETN.js","./chunk.Q5WEOX3Q.js","./chunk.7DCBIMOI.js","./chunk.GXK5PI7I.js","./chunk.DYPSFTRP.js","./chunk.WVUJXDXZ.js","./chunk.J7GH2CGV.js","./chunk.SMF5S4DQ.js","./chunk.XP4IVKKR.js","./chunk.R5YGW5ZX.js","./chunk.QMGBAKX6.js","./chunk.PS765ODQ.js","./chunk.T3RFZ66S.js","./chunk.TDWJU6GW.js","./chunk.P3Z4ZCL3.js","./chunk.45OLF6BK.js","./chunk.T6ISUVUP.js","./chunk.ZDUKVXBI.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.XYBWBMNU.js")),l=i.recipeDraft(a.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(l))return l.failed;t?.(),e.seatTalk.setDraft(l,null),e.goTo.draft?.(),ke()}function ke(e=180){if(typeof document>"u")return;let a=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(a){i&&a.focus();return}e>0&&requestAnimationFrame(()=>ke(e-1))}async function T(e,a,t,i,l){let s=he(e,t,i),d=a==="suggest"?await oe(e.ai,s):a==="fill"?await re(e.ai,s):a==="record"?await le(e.ai,s):await de(e.ai,s);if(d.interaction.outcome==="failed")return a!=="suggest"&&e.desk.record(d.interaction),d;let u=g=>{let p={...d.interaction,outcome:"failed",failed:g};return e.desk.record(p),{...d,interaction:p}};if(a==="fill"||a==="record"){if(!d.ghost||d.ghost.proposals.length===0)return u("Nothing here could be filled in.");l?.(),e.desk.setGhost({ghost:d.ghost}),e.desk.record(d.interaction)}if(a==="panel"&&d.panel){let g=await be(e,d.panel,l);if(g)return u(g);e.desk.record(d.interaction)}return d}var W=new WeakMap,Te=64,me=new WeakMap;function Ee(e){let a=me.get(e);if(!a){let t=a={n:0};me.set(e,t),e.subscribe(()=>void(t.n+=1))}return a.n}var Se=(e,a)=>{let t=ee(a);return t.length>0?t.map(i=>e.graph.getNode(i)):[Ee(e)]},we=(e,a,t)=>JSON.stringify({target:a,seat:e.principal,by:t}),Ae=(e,a,t)=>{let i=Se(e.store,a);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((l,s)=>l===t.depends[s])};function Me(e,a,t="menu"){let i=W.get(e.store)?.get(we(e,a,t));return i?.result!==void 0&&Ae(e,a,i)?i.result:void 0}function Ce(e,a,t){let i=W.get(e.store);i||W.set(e.store,i=new Map);let l=we(e,a,t?.by??"menu"),s=i.get(l);if(s&&Ae(e,a,s))return s.result?Promise.resolve(s.result):s.asked;let d=t?t.ask():T(e,"suggest",a),u={schema:e.store.schema,ai:e.ai,depends:Se(e.store,a),asked:d};i.delete(l),i.set(l,u),i.size>Te&&i.delete(i.keys().next().value);let g=i;return d.then(p=>{p.interaction.outcome!=="failed"?u.result=p:g.get(l)===u&&g.delete(l)}),d}async function Oe(e,a,t,i,l={}){let s=a.interaction,d=ue(t);if(d){let u=s.usage?.at(-1)?.model,g=s.offered.find(h=>h.id===t.id)?.confidence,p=ce(e.store,{interaction:s.id,target:s.target,basis:`${s.ask.said}: ${t.label}`,...u?{model:u}:{},proposals:[{...d,...g!==void 0?{confidence:g}:{}}]},e.principal);if(p.proposals.length===0){let h="That can't be done now.";return e.desk.record({...s,outcome:"failed",failed:h}),h}l.onCard?e.desk.setGhost({ghost:p,onCard:!0}):(i?.(),e.desk.setGhost({ghost:p})),e.desk.record(s);return}if(t.type==="panel"){let u=t.label,g={title:u,recipe:{...t.panel,title:u}},p=await be(e,g,i);return e.desk.record(p?{...s,outcome:"failed",failed:p}:{...s,outcome:"drawn",accepted:[t.id],panel:g}),p}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...s,outcome:"accepted",accepted:[t.id]})}async function qe(e,a){if(a.ask.kind==="ask")return O(e.desk,{target:a.target,asked:a.ask.said}),null;let t=a.ask.kind==="panel"||a.ask.kind==="record"?a.ask.kind:"fill";return T(e,t,a.target,a.ask.said)}var k={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},ye=(0,o.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"aria-hidden":"true",style:{...k,visibility:"hidden"},children:"\xA0"}),P={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function ze({target:e,close:a}){let t=Y(),i=(0,c.useMemo)(()=>Z(e,n=>t.store.graph.has(n)),[e,t.store]),l=(0,c.useMemo)(()=>{let n=he(t,i);return te(t.store,i,{principal:t.principal,places:t.places,...n.acts?{acts:n.acts}:{}})},[t,i]),s=l.candidates.some(n=>n.type==="fill"),d=l.candidates.some(n=>n.type==="panel"),u=(0,c.useMemo)(()=>d?ne(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[d,t,i]),g=(0,c.useMemo)(()=>new Set(t.store.allMutations().filter(n=>(n.creates??[]).length>0).map(n=>n.name)),[t.store]),p=ae(t.ai)!==void 0&&l.candidates.some(n=>n.type==="act"&&n.asks.length>0&&g.has(n.mutation)),h=K(t.ai),S=Me(t,i),f=JSON.stringify(i),[m,I]=(0,c.useState)(!1),[A,R]=(0,c.useState)(null),[H,E]=(0,c.useState)(h&&S===void 0);(0,c.useEffect)(()=>{if(S!==void 0||!(h||m))return;let n=!0;return E(!0),Ce(t,i).then(y=>{n&&(R(y),E(!1))}),()=>{n=!1}},[f,m]);let r=S??A,w=(r?.offers??[]).filter(n=>!(n.type==="place"&&u.some(y=>y.place===n.place))).slice(0,Math.max(0,3-u.length)),b=r?.interaction.outcome==="failed"?r.interaction.failed??"The AI could not suggest anything here.":null,D=(0,c.useRef)(!1),F=(0,c.useRef)(null);(0,c.useLayoutEffect)(()=>{r===null||!D.current||(D.current=!1,F.current?.querySelector("button")?.focus())},[r]);let L=(0,c.useRef)(!0);(0,c.useEffect)(()=>()=>{L.current=!1},[]);let[U,G]=(0,c.useState)(!1),[B,$]=(0,c.useState)(null),M=n=>{if(U)return;G(!0),$(null);let y=!1;n(()=>{y=!0,a()}).then(x=>{L.current&&(G(!1),x?$(x):y||a())},x=>{L.current&&(G(!1),$(x instanceof Error?x.message:String(x)))})},q=n=>n.interaction.outcome==="failed"?n.interaction.failed??"The AI could not do that here.":void 0,C=H&&!m?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:P,children:"Thinking\u2026"}):U?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:P,children:"Asking\u2026"}):B?(0,o.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...P,color:"var(--graview-warn)"},children:B}):b?(0,o.jsx)("p",{role:"status",style:P,children:b}):null,z=(0,c.useRef)(0);z.current=Math.max(z.current,h&&S===void 0?Math.max(1,3-u.length):0,w.length+(C?1:0));let xe=Math.max(0,z.current-w.length-(C?1:0));return(0,o.jsxs)("div",{ref:F,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[(0,o.jsxs)("ul",{"data-testid":"inline-ai-room",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[C?(0,o.jsxs)("li",{style:{position:"relative"},children:[ye,(0,o.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center"},children:C})]}):null,w.map(n=>(0,o.jsx)("li",{children:(0,o.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${n.id}`,"data-ai-offer":n.id,"data-ai-offer-type":n.type,title:n.label,onClick:()=>M(y=>Oe(t,r,n,y)),style:{...k,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[n.label,(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",n.type==="panel"?"a panel":n.type==="place"?"go there":n.type==="record"?"open it":"suggested"]})]})},n.id)),Array.from({length:xe},(n,y)=>(0,o.jsx)("li",{"data-inline-ai-room":"",children:ye},`room-${y}`))]}),(0,o.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[!h&&r===null?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":m||void 0,onClick:n=>{m||(D.current=document.activeElement===n.currentTarget,I(!0))},style:k,children:m?"Thinking\u2026":"Suggest\u2026"})}):null,s?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>M(async n=>q(await T(t,"fill",i,"Fill in",n))),style:k,children:"Fill in with AI"})}):null,p?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>M(async n=>q(await T(t,"record",i,"Add one",n))),style:k,children:"Add one with AI"})}):null,u.map(n=>(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":`ai-open:${n.place}`,"data-ai-existing":n.fit,onClick:()=>{a(),t.goTo.place(n.place),n.fit==="partial"&&O(t.desk,{target:{on:"lens",place:n.place,...n.kind?{kind:n.kind}:{}}})},style:k,children:n.fit==="full"?`Open ${n.title}`:`Open and adjust ${n.title}`})},n.place)),d?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>M(async n=>q(await T(t,"panel",i,"Draw a panel",n))),style:k,children:u.length>0?"Draw a new view":"Draw a panel"})}):null,(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let n=document.activeElement,y=X(n instanceof Element?n.closest('[data-testid="context-menu"]'):null);a(),O(t.desk,{target:i,returnTo:n instanceof HTMLElement&&n!==document.body?n:null,...y?{from:y}:{}})},style:k,children:"Tell Graview\u2026"})})]})]})}var v={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function Ne({placement:e="picture"}){let{store:a,principal:t,aiDesk:i}=j(),l=V(a,t),{ghost:s,entries:d}=Q(i),[u,g]=(0,c.useState)(new Set);(0,c.useEffect)(()=>g(new Set),[s?.ghost.interaction]);let p=(0,c.useRef)(null),h=(0,c.useRef)(null),S=s?.batch;if((0,c.useEffect)(()=>{S!==void 0&&h.current?.focus()},[S]),!s)return null;let{ghost:f}=s,m=d.find(r=>r.id===f.interaction),I=()=>{let r=f.target.on==="record"||f.target.on==="field"?f.target.id:void 0,w=p.current?.closest("[data-graview-face], main")?.parentElement??document,b=(r?w.querySelector(`[data-graview-view="${CSS.escape(r)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??p.current?.closest("main")??document.querySelector("main");b&&!b.hasAttribute("tabindex")&&b.setAttribute("tabindex","-1"),b?.focus({preventScroll:!0}),i.setGhost(null)},A=f.proposals.filter(r=>!u.has(r.id)).map(r=>r.id),R=()=>{let r=pe(l,f,{author:t,ids:A});if(!r.ok){i.setGhost({...s,refused:r.refused});return}m&&i.record(ge(m,r.accepted,r.batch)),i.setGhost({ghost:f,batch:r.batch,took:r.accepted.length,...s.onCard?{onCard:!0}:{}})},H=()=>{m&&s.batch===void 0&&i.record(fe(m)),I()},E=()=>{if(s.batch!==void 0)try{l.undo(s.batch,{author:t}),m&&i.record({...m,undone:!0}),I()}catch(r){i.setGhost({...s,refused:r instanceof Error?r.message:String(r)})}};return(0,o.jsxs)("section",{ref:p,"data-testid":"ai-ghost","data-interaction":f.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:J("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,o.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:s.batch!==void 0?`Done: ${s.took===1?"one change":`${s.took} changes`}, as one.`:`Proposed by AI \xB7 ${f.basis}`}),s.batch===void 0?(0,o.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:f.proposals.map(r=>(0,o.jsx)("li",{"data-ghost-proposal":r.id,children:(0,o.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,o.jsx)("input",{type:"checkbox",checked:!u.has(r.id),onChange:w=>{let b=new Set(u);w.target.checked?b.delete(r.id):b.add(r.id),g(b)}}),(0,o.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:r.said}),r.confidence!==void 0?(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(r.confidence*100),"% sure"]}):null]})},r.id))}):null,s.refused?(0,o.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:s.refused}):null,(0,o.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.batch===void 0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:A.length===0,onClick:R,style:v,children:A.length===f.proposals.length?"Accept":`Accept ${A.length} of ${f.proposals.length}`}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:H,style:v,children:"Dismiss"})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button",ref:h,"data-testid":"ghost-undo",onClick:E,style:v,children:"Undo"}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:I,style:v,children:"Close"})]})})]})}export{he as a,be as b,T as c,Me as d,Ce as e,Oe as f,qe as g,ze as h,Ne as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as wn,f as bn,g as ie,h as vn,i as X,k as $e,l as De,q as On,v as de,x as xn}from"./chunk.N3MXLORL.js";import{$a as an,B as we,C as pe,Db as ze,Eb as cn,F as Ue,Fa as Re,H as We,Ia as nn,K as Je,L as Ye,La as tn,Na as rn,Ra as Se,Sa as Ae,Xb as I,Ya as on,_c as gn,ac as ln,b as Ce,bc as fn,c as Ie,d as Ve,dc as un,e as B,g as ye,h as _,ha as xe,i as Ke,ia as Qe,ic as pn,j as Ze,k as he,ka as Xe,l as qe,ld as yn,m as Be,md as hn,nc as mn,nd as Ee,o as _e,od as kn,p as fe,pd as je,q as Oe,ua as en,v as He,vb as sn,x as ue,yb as dn,z as ke}from"./chunk.6L6RUOSF.js";var Gn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],H=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Rn(e,d=Gn){if(!H(e))return{document:e,respelled:[]};let n=[],t=e;for(let s of d)t=Le(t,s.where.split("."),s,"",n);return{document:t,respelled:n}}function Le(e,d,n,t,s){if(d.length===0){if(!H(e)||!Object.hasOwn(e,n.was))return e;s.push(`${t}${n.was}`);let{[n.was]:ae,...U}=e;return Object.hasOwn(e,n.now)?U:{...U,[n.now]:ae}}if(!H(e))return e;let[g,...j]=d,w=g.endsWith("[]"),x=w?g.slice(0,-2):g,N=e[x],ne=N;if(!w)ne=Le(N,j,n,`${t}${x}.`,s);else if(Array.isArray(N)){let ae=N.map((U,L)=>Le(U,j,n,`${t}${x}.${L}.`,s));ne=ae.some((U,L)=>U!==N[L])?ae:N}return ne===N?e:{...e,[x]:ne}}var Sn=new WeakMap;function An(e,d){Sn.set(e,d)}function qn(e){return Sn.get(e)}function zn(e){if(typeof e=="string")return{form:"string",light:e};if(typeof e!="object"||e===null)return;let d=e,n=w=>typeof d[w]=="string"?d[w]:void 0,t=n("light")??n("src");if(t===void 0)return;let[s,g,j]=[n("dark"),n("alt"),n("darkFallback")];return{form:n("light")!==void 0?"light":"src",light:t,...s!==void 0?{dark:s}:{},...g!==void 0?{alt:g}:{},...j!==void 0?{darkFallback:j}:{}}}function Xn(e,d){let n=e.brand??{},t=n.ground,s=n.accent?je(n.accent,t):void 0;t&&kn(s?.ok?s.schemes:Ee(t),n.accent)&&(d.push(De("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,s=n.accent?je(n.accent):void 0),s&&!s.ok&&d.push(De("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${s.why}`,"pick a color further from orange-red, or a darker one"));let g=zn(n.logo),j=n.name??e.name,w=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,x])=>typeof x=="string"&&hn(x)===null).map(([x,N])=>[x,yn(N)])):void 0;return{name:j,schemes:s?.ok?s.schemes:t?Ee(t):gn,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...n.timeZone?{timeZone:n.timeZone}:{},...g?{logo:g.dark||g.darkFallback==="invert"?{light:g.light,...g.dark?{dark:g.dark}:{darkFallback:"invert"}}:g.light,logoAlt:g.alt??j}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...n.subtitle===!1?{subtitleDrawn:!1}:{},...w?{typography:w}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{},...n.views&&(n.views.css||n.views.motion||n.views.fonts?.length)?{views:{...n.views.css?{css:n.views.css}:{},...n.views.motion?{motion:n.views.motion}:{},...n.views.fonts?.length?{fonts:n.views.fonts}:{}}}:{}}}function En(e){let{currency:d,locale:n,timeZone:t}=e.brand??{};return{...d?{currency:d}:{},...n?{locale:n}:{},...t?{timeZone:t}:{}}}var Mn=Symbol.for("@graview/core:typed-field"),jn=(e,d)=>(/^(phone|place|duration)$/.test(d)&&(pe(e)[Mn]=d),e),$n=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;function Dn(e){let d=_().check(B(300),ke(t=>tn(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(B(200));return rn(e.description?n.check(we(e.description)):n,e)}var Ln="graview-compiled@1";function Nn(e,d){return e.find(([n,t])=>n!==ee&&"ref"in t&&(t.ref==="*"||t.ref.includes(d)))?.[0]}var ee="id",me=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function Pn(e){let d=Object.entries(e.fields),n=t=>["name","title","label"].find(s=>t.some(([g])=>g===s))??t[0]?.[0];return n(d.filter(([,t])=>t.required&&(t.type==="string"||t.type==="text")))??n(d.filter(([,t])=>t.type==="string"))}function Tn(e,d,n){let t;switch(e.type){case"string":case"place":t=_().check(B(500));break;case"phone":t=_().check(B(40),ye($n,"a phone number"));break;case"text":t=_().check(B(2e4)),e.format&&(pe(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let g=e.min??(e.type==="duration"?0:void 0),j=[...e.type==="number"?[]:[qe()],...g===void 0?[]:[Ie(g)],...e.max===void 0?[]:[Ce(e.max)],...e.step===void 0?[]:[Ve(e.step)]];t=j.length>0?he().check(...j):he();break}case"boolean":t=Be();break;case"date":t=_().check(ye(We,"a date like 2026-10-02, or a month (2016-05) or a year (2006) alone"));break;case"datetime":t=_().check(ke(Je,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=He(e.options),e.multiple&&(t=fe(t).check(B(e.options.length)));break;case"list":t=fe(e.of==="number"?he():e.of==="date"?_().check(ye(Ue)):e.of==="image"||e.of==="video"||e.of==="file"?Re(e.of):_().check(B(500))).check(B(200));break;case"image":case"video":case"file":t=Re(e.type);break;case"app-link":t=nn();break;case"url":t=Ze();break;case"email":t=Ke();break}let s=e.type==="number"||e.type==="integer";return jn(t,s&&e.format==="duration"?"duration":e.type),e.collaborative!==void 0&&(e.type==="text"||e.type==="string")&&(pe(t)[Symbol.for("@graview/core:collaborative")]=e.collaborative?1:0),e.description&&(t=t.check(we(e.description))),s&&(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?ue(t):t}var ge=e=>{throw new I(`there is no record "${e}"`,"invalid")},Cn=(e,d)=>"field"in e?Tn(e.field,e.optional,d):"ref"in e?mn(e.ref):ue(_e()),In=new WeakMap;var Pe=(e,d)=>H(d)&&Object.keys(e??{}).length===Object.keys(d).length&&Object.keys(e??{}).every(n=>Object.hasOwn(d,n));function Rt(e,d={}){let n=H(e)?e.format:void 0;if(n!==Ln)return{ok:!1,findings:[$e("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,s=Rn(t.document).document,g=s===t.document?t:{...t,document:s},j=H(s)&&typeof s.name=="string"&&H(s.kinds)&&Pe(s.kinds,g.kinds)&&Pe(s.acts,g.acts)&&Pe(s.rules,g.rules)&&Array.isArray(g.edges)&&Array.isArray(g.findings),w={ok:!1,findings:[$e("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!j)return w;try{return Vn(g,d)}catch{return w}}function Vn(e,d={}){let{document:n}=e,t=n.brand?.timeZone,s=d.today??(()=>Ye(t)),g={...n.brand?.locale?{locale:n.brand.locale}:{},...t?{timeZone:t}:{}},j=new Map(e.edges.map(([y,o])=>[y,o])),w=new Map;for(let[y,o]of Object.entries(n.kinds)){let R=e.kinds[y]?.computed,v=Ae(o.edges),$=new Map(Object.entries(o.fields).flatMap(([z,O])=>O.type==="enum"?[[z,O.optionLabels??{}]]:[]));w.set(y,{fields:new Set([...Object.keys(o.fields),...v.keys()]),edges:new Map(Object.entries(Se(o.edges)).map(([z,O])=>[z,O.cardinality??"many"])),...R?{computed:new Map(R)}:{},...v.size>0?{linked:v}:{},...$.size>0?{choices:$}:{}})}e.facts&&w.set(bn,{computed:new Map(e.facts)});let x=En(n),N=y=>({from:y.from,via:y.via,sourceEnd:y.sourceEnd,back:y.back,values(o,R,v){let $={};for(let[z,O]of y.set)if("value"in O)$[z]=O.value;else try{let P=X(O.expr,{graph:o,subject:R,kinds:w,bindings:{to:v},today:s(),...g});(P===null||typeof P!="object"||Array.isArray(P))&&($[z]=P)}catch(P){if(!(P instanceof ie))throw P}return $}}),ne=new Map,ae=Object.entries(n.kinds).map(([y,o])=>{let R={};for(let[r,i]of Object.entries(o.fields))R[r]=Tn(i,!i.required,x),i.repeats&&(R[on(r)]=ue(an()));for(let[r,i]of Ae(o.edges))R[r]=ue(Dn(i));let{label:v,describe:$,durations:z}=e.kinds[y]??{},O=Object.entries(o.computed??{}).map(([r,i])=>[r,typeof i=="string"?{expr:i}:i]),P=Object.hasOwn(o.fields,"label")&&!o.fields.label.label&&!/\{\s*label\b/.test(o.label??`{${Pn(o)??""}}`),te=Object.fromEntries([...P?[["label","Label"]]:[],...Object.entries(o.fields).filter(([,r])=>r.label).map(([r,i])=>[r,i.label]),...O.filter(([,r])=>r.label).map(([r,i])=>[r,i.label])]),J=Object.keys(te).length>0,D=Object.entries(o.fields).filter(([,r])=>r.type==="enum"&&(r.optionLabels&&Object.keys(r.optionLabels).length>0||r.multiple)),m=r=>i=>typeof i=="string"&&r.optionLabels&&Object.hasOwn(r.optionLabels,i)?r.optionLabels[i]:Qe(String(i)),C=Object.fromEntries(D.map(([r,i])=>[r,i.multiple?E=>Array.isArray(E)?E.map(m(i)).join(", "):m(i)(E):m(i)])),V=D.length>0,K=Object.fromEntries(Object.entries(o.fields).filter(([,r])=>r.default!==void 0).map(([r,i])=>[r,i.default]));ne.set(y,K);let W=Object.fromEntries(Object.entries(Se(o.edges)).map(([r,{renamedFrom:i,...E}])=>[r,E])),Z=Object.entries(o.fields).flatMap(([r,i])=>i.aliases?[[r,i.aliases]]:[]),T=r=>o[r]?{[r]:o[r]}:{};return Xe(y,{fields:Oe(R),edges:W,...T("plural"),...T("noun"),...T("aliases"),...Z.length>0?{fieldAliases:Object.fromEntries(Z)}:{},...T("description"),...v?{label:r=>de(v,{node:r,kinds:w,today:s(),money:x})||r.id}:{},...$?{describe:r=>de($,{node:r,kinds:w,today:s(),money:x})}:{},...T("lifecycle"),...T("figure"),...T("fieldRoles"),...T("people"),archives:o.archives,...o.tidying?{tidying:o.tidying}:{},...O.length>0?{computed:Object.fromEntries(O.map(([r,i])=>[r,Kn(i,z?.includes(r)??!1,x)??o.computed[r]]))}:{},...J||V||o.glance||o.page?{display:{...J?{labels:te}:{},...V?{format:C}:{},...o.glance?{glance:[...o.glance]}:{},...o.page?{page:o.page}:{}}}:{},...Object.keys(K).length>0?{defaults:K}:{},...e.kinds[y]?.keptInStep?{keptInStep:e.kinds[y].keptInStep}:{},...e.kinds[y]?.derives?{derives:N(e.kinds[y].derives)}:{}})}),U=sn(ae,n.computed);function L(y){return U.tryDefinition(y.kind)?.label?.(y)??y.id}let Te=y=>({id:"",kind:y,...ne.get(y)}),Ge=[];for(let[y,o]of Object.entries(n.acts??{})){let R=e.acts[y],{title:v,effects:$,guard:z,refusal:O,destructive:P,idempotent:te,creates:J,connects:D,severs:m,writes:C,writesOther:V,sets:K}=R,W={};for(let c of $)"through"in c&&(W[c.through]=[...new Set([...W[c.through]??[],...Object.keys(c.set)])]);let Z=new Map(R.args),T={};for(let[c,S]of Z)T[c]=Cn(S,x);let r=[o.on??[]].flat(),i=new Map(R.exprs),E=$.find(c=>"create"in c),Y=(c,S,l,b=null)=>{if(H(c)&&"expr"in c)return X(i.get(c.expr),{graph:l,subject:b,kinds:w,bindings:S,args:S,today:s(),...g});let h=me(c);return h===void 0?typeof c=="string"&&c.startsWith("$$")?c.slice(1):c:h==="now"?new Date().toISOString():h==="today"?s():S[h]},ce=(c,S)=>{if(!E)return"";let l=n.kinds[E.create].fields,b=Te(E.create),h=[];for(let[A,le]of Object.entries(E.set??{})){try{b[A]=Y(le,c,S)??b[A]}catch{}let se=me(le);se&&c[se]!==void 0&&h.push(A)}let G=L(b).trim(),re=h.filter(A=>b[A]!==!1&&l[A].type!=="text"&&!(/[^]{41}/.test(b[A])||/ .*[.!?]$/.test(b[A])&&!/[ .][A-Z]\w{0,3}\.$/.test(b[A]))&&L({...b,[A]:void 0}).trim()===G).map(A=>b[A]===!0?l[A].label??xe(A):On(b[A],l[A].format,s(),[],x));return G&&re.length>0?`${G} (${re.join(", ")})`:G};Ge.push(un(y,{input:Oe(T),title:v,...o.description?{description:o.description}:{},...o.fromTheOtherEnd?{fromTheOtherEnd:o.fromTheOtherEnd}:{},...Z.has(ee)?{subject:{kinds:r.length>0?r:"*",arg:ee}}:{},...P?{destructive:!0}:{},...te?{idempotent:!0}:{},...JSON.stringify(o).includes('"$me"')?{doneAsMe:!0}:{},...J.length>0?{creates:J}:{},...D.length>0?{connects:D}:{},...m.length>0?{severs:m}:{},writes:C,...Object.keys(V).length>0?{writesOther:V}:{},...Object.keys(W).length>0?{writesLinked:W}:{},...Object.keys(K).length>0?{sets:K}:{},...z?{allowedOn:(c,S)=>{let l=c.getNode(S);if(!l||r.length>0&&!r.includes(l.kind))return!1;try{return X(z,{graph:c,subject:l,kinds:w,bindings:{},today:s(),...g})===!0}catch{return!1}}}:{},describe:(c,S)=>{let l=typeof c[ee]=="string"?S.getNode(c[ee]):void 0,b=l?L(l):ce(c,S);return b?`${v}: ${b}`:v},apply(c,S){let l=c.graph,b=typeof S[ee]=="string"?S[ee]:void 0,h=b?l.getNode(b):void 0;if(b&&!h&&ge(b),h&&r.length>0&&!r.includes(h.kind))throw new I(`"${v}" acts on ${r.join(" or ")}, not on ${en(h.kind)}`,"invalid");let G={};for(let[a,p]of Object.entries(S))p!==void 0&&(G[a]=p);if(z&&h){let a;try{a=X(z,{graph:l,subject:h,kinds:w,bindings:G,args:G,today:s(),...g})}catch(p){throw p instanceof ie?new I(`"${v}" could not be judged: ${p.sentence}`):p}if(a!==!0)throw new I(O?de(O,{node:h,kinds:w,graph:l,bindings:G,args:G,today:s(),money:x}):`"${v}" is not allowed for ${L(h)} right now`)}let re=new Map,A=a=>l.has(a)||[...re.values()].includes(a),le=new Set,se=a=>{let p=dn(a);le.has(p)||(le.add(p),c.removeEdge(a))},ve=(a,p,f)=>{let u=a===void 0?void 0:n.kinds[a],k=u?.fields[p];if(k?.required){let M=k.label??xe(p);throw new I(`"${v}" cannot clear ${M}${f?` of ${L(f)}`:""}: every ${u.noun??a} has one`,"invalid")}},oe=(a,p)=>{let f=me(a);if(f==="subject")return b;if(f==="me"){let u=c.me;if(u&&n.kinds[l.getNode(u)?.kind]?.people)return u;throw new I(`"${v}" is done as you, and you have no record here`)}if(re.has(f))return re.get(f);try{return Y(a,G,l,p??h??null)}catch(u){throw u instanceof ie?new I(`"${v}" could not work out a value: ${u.sentence}`):u}};for(let a of $)if("create"in a){let p=n.kinds[a.create],f=Te(a.create);for(let[q,Q]of Object.entries(a.set??{})){let Ne=Q===null?ve(a.create,q):oe(Q,void 0);Ne!==void 0&&(f[q]=Ne)}let u=Pn(p),k=String((u&&f[u])??a.create),M=fn(k,a.create,f,(q,Q)=>ln(n.policy?.sees,q,Q)),F=c.freshId(M?a.create:k,a.create,f);c.addNode({...f,id:F}),a.as&&re.set(a.as,F)}else if("connect"in a||"sever"in a){let p="connect"in a?a.connect:a.sever,f=String(oe(a.from,void 0)??""),u=String(oe(a.to,void 0)??"");if(A(f)||ge(f),A(u)||ge(u),"connect"in a){if(j.get(p)?.cardinality==="one")for(let k of l.out(f,p))k.id!==u&&se({kind:p,from:f,to:k.id});l.out(f,p).some(k=>k.id===u)||c.addEdge({kind:p,from:f,to:u})}else{let k=[l.getNode(f),l.getNode(u)];if(k[0]&&k[1]&&!l.out(f,p,{archived:"all"}).some(M=>M.id===u))throw new I(`"${v}" has nothing to take away: ${L(k[0])} is not linked to ${L(k[1])} that way`);se({kind:p,from:f,to:u})}}else if("through"in a){if(!h)throw new I(`"${v}" carries a change to linked records, and has no record to start from`,"invalid");let f=j.get(a.through)?.from.includes(h.kind)??!0?l.out(h.id,a.through):l.in(h.id,a.through);for(let u of f){let k={};for(let[M,F]of Object.entries(a.set)){let q;if(me(F)==="to")q=u.id;else if(H(F)&&"expr"in F)try{q=X(i.get(F.expr),{graph:l,subject:h,kinds:w,bindings:{...G,to:u},args:G,today:s(),...g})}catch(Q){throw Q instanceof ie?new I(`"${v}" could not work out a value for ${L(u)}: ${Q.sentence}`):Q}else q=oe(F,void 0);F===null?k[M]=ve(u.kind,M,u):q!==void 0&&(k[M]=q)}Object.keys(k).length>0&&c.patchNode(u.id,k)}}else if("set"in a){let p=String(oe(a.target??"$subject",void 0)??""),f=l.getNode(p);!f&&!A(p)&&ge(p);let u={};for(let[k,M]of Object.entries(a.set))if(M===null)u[k]=ve(f?.kind,k,f);else{let F=oe(M,f);F!==void 0&&(u[k]=F)}Object.keys(u).length>0&&c.patchNode(p,u)}else if("remove"in a){let p=String(oe(a.remove,void 0)??"");l.has(p)||ge(p),c.removeNode(p)}else if("replace"in a&&h){let p=S.to;for(let f of a.replace){let u=j.get(f)?.from.includes(h.kind)??!0;for(let k of u?l.out(h.id,f):l.in(h.id,f))f===a.keep&&k.id===p||se(u?{kind:f,from:h.id,to:k.id}:{kind:f,from:k.id,to:h.id})}}}}))}let Me=[];for(let[y,o]of Object.entries(n.rules??{})){let{title:R,require:v,when:$,says:z,covers:O}=e.rules[y],P=o.repairs??[],te=(D,m,C=s(),V)=>{let K=[],W={graph:D,subject:m,kinds:w,today:C,...g,...V?{linked:V}:{},onUnread:i=>K.push(i)},Z,T=[];try{if($&&X($,W)!==!0)return[];if(O&&m?(T=xn(D,m,O),Z=T.length===0):Z=X(v,W)===!0,!Z&&K.length>0)throw new ie(`it reads ${wn(K[0])}`,0)}catch(i){throw i instanceof vn?new cn(i.sentence):i instanceof ie?new Error(i.sentence):i}if(Z)return[];let r=P.flatMap(i=>{let E=n.acts?.[i.act],Y={},ce=m&&E?.on&&E.fromTheOtherEnd&&![E.on].flat().includes(m.kind)?Nn(e.acts[i.act].args,m.kind):void 0;ce?Y[ce]=m.id:m&&(E?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(i.act))&&(Y[ee]=m.id);for(let[l,b]of Object.entries(i.args??{}))Y[l]=me(b)==="subject"?m?.id:b;let S=(E?e.acts[i.act].args:[]).filter(([l,b])=>b.required&&Y[l]===void 0).map(([l])=>l);return[{mutation:i.act,label:i.label??(ce?E.fromTheOtherEnd:E?.title)??i.act.replace(/-/g," "),args:Y,...S.length>0?{missing:S}:{}}]});return O&&m?T.map(i=>({invariant:y,subjectId:m.id,label:R,message:z?de(z,{node:m,kinds:w,graph:D,today:C,money:x,bindings:{[m.kind]:m,[i.kind]:i}}):`${L(m)}: ${R} \u2014 ${L(i)}`,nodeIds:[m.id,i.id],repairs:r})):[{invariant:y,...m?{subjectId:m.id}:{},label:R,message:z?de(z,{node:m,kinds:w,graph:D,today:C,money:x}):m?`${L(m)}: ${R}`:R,nodeIds:m?[m.id]:[],repairs:r}]},J={label:R,shape:{over:o.over,require:v,...O?{covers:O}:{},when:$,says:z,declared:n.kinds,money:x,kinds:w,today:s},judgment:{...o.require?{require:o.require}:{},...o.covers?{covers:o.covers}:{},...o.when?{when:o.when}:{},...o.says?{says:o.says}:{}},...o.description?{description:o.description}:{},...P.length>0?{repairs:P.map(D=>D.act)}:{}};Me.push(o.over==="graph"?ze(y,{scope:"graph",...J,evaluate:({graph:D,today:m,context:C})=>te(D,null,m,C?.linked)}):ze(y,{scope:{kind:o.over},...J,evaluate:({graph:D,subject:m,today:C,context:V})=>te(D,m,C,V?.linked)}))}let Fe=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},be={name:n.name,schema:U,mutations:Ge,invariants:Me,...Fe?{policy:Fe}:{},...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 An(be,n),In.set(be,e),{ok:!0,app:be,document:n,findings:e.findings,sights:n.policy?.sees,kinds:w}}function Kn(e,d,n){let t=d||e.format==="duration",s=e.format==="money"||e.format==="percent"||!e.format&&e.unit!==void 0;if(!(!t&&!s))return{...e,...t?{as:"duration"}:{},...s?{amount:{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{},...e.places===0?{places:0}:{}}}:{}}}export{H as a,Rn as b,qn as c,Xn as d,Ln as e,ee as f,me as g,Pn as h,Rt as i,Vn as j};
|
|
1
|
+
import{e as wn,f as bn,g as ie,h as vn,i as X,k as $e,l as De,q as On,v as de,x as xn}from"./chunk.PS765ODQ.js";import{$a as an,B as we,C as pe,Db as ze,Eb as cn,F as Ue,Fa as Re,H as We,Ia as nn,K as Je,L as Ye,La as tn,Na as rn,Ra as Se,Sa as Ae,Xb as I,Ya as on,_c as gn,ac as ln,b as Ce,bc as fn,c as Ie,d as Ve,dc as un,e as B,g as ye,h as _,ha as xe,i as Ke,ia as Qe,ic as pn,j as Ze,k as he,ka as Xe,l as qe,ld as yn,m as Be,md as hn,nc as mn,nd as Ee,o as _e,od as kn,p as fe,pd as je,q as Oe,ua as en,v as He,vb as sn,x as ue,yb as dn,z as ke}from"./chunk.ZDUKVXBI.js";var Gn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],H=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Rn(e,d=Gn){if(!H(e))return{document:e,respelled:[]};let n=[],t=e;for(let s of d)t=Le(t,s.where.split("."),s,"",n);return{document:t,respelled:n}}function Le(e,d,n,t,s){if(d.length===0){if(!H(e)||!Object.hasOwn(e,n.was))return e;s.push(`${t}${n.was}`);let{[n.was]:ae,...U}=e;return Object.hasOwn(e,n.now)?U:{...U,[n.now]:ae}}if(!H(e))return e;let[g,...j]=d,w=g.endsWith("[]"),x=w?g.slice(0,-2):g,N=e[x],ne=N;if(!w)ne=Le(N,j,n,`${t}${x}.`,s);else if(Array.isArray(N)){let ae=N.map((U,L)=>Le(U,j,n,`${t}${x}.${L}.`,s));ne=ae.some((U,L)=>U!==N[L])?ae:N}return ne===N?e:{...e,[x]:ne}}var Sn=new WeakMap;function An(e,d){Sn.set(e,d)}function qn(e){return Sn.get(e)}function zn(e){if(typeof e=="string")return{form:"string",light:e};if(typeof e!="object"||e===null)return;let d=e,n=w=>typeof d[w]=="string"?d[w]:void 0,t=n("light")??n("src");if(t===void 0)return;let[s,g,j]=[n("dark"),n("alt"),n("darkFallback")];return{form:n("light")!==void 0?"light":"src",light:t,...s!==void 0?{dark:s}:{},...g!==void 0?{alt:g}:{},...j!==void 0?{darkFallback:j}:{}}}function Xn(e,d){let n=e.brand??{},t=n.ground,s=n.accent?je(n.accent,t):void 0;t&&kn(s?.ok?s.schemes:Ee(t),n.accent)&&(d.push(De("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,s=n.accent?je(n.accent):void 0),s&&!s.ok&&d.push(De("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${s.why}`,"pick a color further from orange-red, or a darker one"));let g=zn(n.logo),j=n.name??e.name,w=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,x])=>typeof x=="string"&&hn(x)===null).map(([x,N])=>[x,yn(N)])):void 0;return{name:j,schemes:s?.ok?s.schemes:t?Ee(t):gn,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...n.timeZone?{timeZone:n.timeZone}:{},...g?{logo:g.dark||g.darkFallback==="invert"?{light:g.light,...g.dark?{dark:g.dark}:{darkFallback:"invert"}}:g.light,logoAlt:g.alt??j}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...n.subtitle===!1?{subtitleDrawn:!1}:{},...w?{typography:w}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{},...n.views&&(n.views.css||n.views.motion||n.views.fonts?.length)?{views:{...n.views.css?{css:n.views.css}:{},...n.views.motion?{motion:n.views.motion}:{},...n.views.fonts?.length?{fonts:n.views.fonts}:{}}}:{}}}function En(e){let{currency:d,locale:n,timeZone:t}=e.brand??{};return{...d?{currency:d}:{},...n?{locale:n}:{},...t?{timeZone:t}:{}}}var Mn=Symbol.for("@graview/core:typed-field"),jn=(e,d)=>(/^(phone|place|duration)$/.test(d)&&(pe(e)[Mn]=d),e),$n=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;function Dn(e){let d=_().check(B(300),ke(t=>tn(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(B(200));return rn(e.description?n.check(we(e.description)):n,e)}var Ln="graview-compiled@1";function Nn(e,d){return e.find(([n,t])=>n!==ee&&"ref"in t&&(t.ref==="*"||t.ref.includes(d)))?.[0]}var ee="id",me=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function Pn(e){let d=Object.entries(e.fields),n=t=>["name","title","label"].find(s=>t.some(([g])=>g===s))??t[0]?.[0];return n(d.filter(([,t])=>t.required&&(t.type==="string"||t.type==="text")))??n(d.filter(([,t])=>t.type==="string"))}function Tn(e,d,n){let t;switch(e.type){case"string":case"place":t=_().check(B(500));break;case"phone":t=_().check(B(40),ye($n,"a phone number"));break;case"text":t=_().check(B(2e4)),e.format&&(pe(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let g=e.min??(e.type==="duration"?0:void 0),j=[...e.type==="number"?[]:[qe()],...g===void 0?[]:[Ie(g)],...e.max===void 0?[]:[Ce(e.max)],...e.step===void 0?[]:[Ve(e.step)]];t=j.length>0?he().check(...j):he();break}case"boolean":t=Be();break;case"date":t=_().check(ye(We,"a date like 2026-10-02, or a month (2016-05) or a year (2006) alone"));break;case"datetime":t=_().check(ke(Je,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=He(e.options),e.multiple&&(t=fe(t).check(B(e.options.length)));break;case"list":t=fe(e.of==="number"?he():e.of==="date"?_().check(ye(Ue)):e.of==="image"||e.of==="video"||e.of==="file"?Re(e.of):_().check(B(500))).check(B(200));break;case"image":case"video":case"file":t=Re(e.type);break;case"app-link":t=nn();break;case"url":t=Ze();break;case"email":t=Ke();break}let s=e.type==="number"||e.type==="integer";return jn(t,s&&e.format==="duration"?"duration":e.type),e.collaborative!==void 0&&(e.type==="text"||e.type==="string")&&(pe(t)[Symbol.for("@graview/core:collaborative")]=e.collaborative?1:0),e.description&&(t=t.check(we(e.description))),s&&(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?ue(t):t}var ge=e=>{throw new I(`there is no record "${e}"`,"invalid")},Cn=(e,d)=>"field"in e?Tn(e.field,e.optional,d):"ref"in e?mn(e.ref):ue(_e()),In=new WeakMap;var Pe=(e,d)=>H(d)&&Object.keys(e??{}).length===Object.keys(d).length&&Object.keys(e??{}).every(n=>Object.hasOwn(d,n));function Rt(e,d={}){let n=H(e)?e.format:void 0;if(n!==Ln)return{ok:!1,findings:[$e("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,s=Rn(t.document).document,g=s===t.document?t:{...t,document:s},j=H(s)&&typeof s.name=="string"&&H(s.kinds)&&Pe(s.kinds,g.kinds)&&Pe(s.acts,g.acts)&&Pe(s.rules,g.rules)&&Array.isArray(g.edges)&&Array.isArray(g.findings),w={ok:!1,findings:[$e("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!j)return w;try{return Vn(g,d)}catch{return w}}function Vn(e,d={}){let{document:n}=e,t=n.brand?.timeZone,s=d.today??(()=>Ye(t)),g={...n.brand?.locale?{locale:n.brand.locale}:{},...t?{timeZone:t}:{}},j=new Map(e.edges.map(([y,o])=>[y,o])),w=new Map;for(let[y,o]of Object.entries(n.kinds)){let R=e.kinds[y]?.computed,v=Ae(o.edges),$=new Map(Object.entries(o.fields).flatMap(([z,O])=>O.type==="enum"?[[z,O.optionLabels??{}]]:[]));w.set(y,{fields:new Set([...Object.keys(o.fields),...v.keys()]),edges:new Map(Object.entries(Se(o.edges)).map(([z,O])=>[z,O.cardinality??"many"])),...R?{computed:new Map(R)}:{},...v.size>0?{linked:v}:{},...$.size>0?{choices:$}:{}})}e.facts&&w.set(bn,{computed:new Map(e.facts)});let x=En(n),N=y=>({from:y.from,via:y.via,sourceEnd:y.sourceEnd,back:y.back,values(o,R,v){let $={};for(let[z,O]of y.set)if("value"in O)$[z]=O.value;else try{let P=X(O.expr,{graph:o,subject:R,kinds:w,bindings:{to:v},today:s(),...g});(P===null||typeof P!="object"||Array.isArray(P))&&($[z]=P)}catch(P){if(!(P instanceof ie))throw P}return $}}),ne=new Map,ae=Object.entries(n.kinds).map(([y,o])=>{let R={};for(let[r,i]of Object.entries(o.fields))R[r]=Tn(i,!i.required,x),i.repeats&&(R[on(r)]=ue(an()));for(let[r,i]of Ae(o.edges))R[r]=ue(Dn(i));let{label:v,describe:$,durations:z}=e.kinds[y]??{},O=Object.entries(o.computed??{}).map(([r,i])=>[r,typeof i=="string"?{expr:i}:i]),P=Object.hasOwn(o.fields,"label")&&!o.fields.label.label&&!/\{\s*label\b/.test(o.label??`{${Pn(o)??""}}`),te=Object.fromEntries([...P?[["label","Label"]]:[],...Object.entries(o.fields).filter(([,r])=>r.label).map(([r,i])=>[r,i.label]),...O.filter(([,r])=>r.label).map(([r,i])=>[r,i.label])]),J=Object.keys(te).length>0,D=Object.entries(o.fields).filter(([,r])=>r.type==="enum"&&(r.optionLabels&&Object.keys(r.optionLabels).length>0||r.multiple)),m=r=>i=>typeof i=="string"&&r.optionLabels&&Object.hasOwn(r.optionLabels,i)?r.optionLabels[i]:Qe(String(i)),C=Object.fromEntries(D.map(([r,i])=>[r,i.multiple?E=>Array.isArray(E)?E.map(m(i)).join(", "):m(i)(E):m(i)])),V=D.length>0,K=Object.fromEntries(Object.entries(o.fields).filter(([,r])=>r.default!==void 0).map(([r,i])=>[r,i.default]));ne.set(y,K);let W=Object.fromEntries(Object.entries(Se(o.edges)).map(([r,{renamedFrom:i,...E}])=>[r,E])),Z=Object.entries(o.fields).flatMap(([r,i])=>i.aliases?[[r,i.aliases]]:[]),T=r=>o[r]?{[r]:o[r]}:{};return Xe(y,{fields:Oe(R),edges:W,...T("plural"),...T("noun"),...T("aliases"),...Z.length>0?{fieldAliases:Object.fromEntries(Z)}:{},...T("description"),...v?{label:r=>de(v,{node:r,kinds:w,today:s(),money:x})||r.id}:{},...$?{describe:r=>de($,{node:r,kinds:w,today:s(),money:x})}:{},...T("lifecycle"),...T("figure"),...T("fieldRoles"),...T("people"),archives:o.archives,...o.tidying?{tidying:o.tidying}:{},...O.length>0?{computed:Object.fromEntries(O.map(([r,i])=>[r,Kn(i,z?.includes(r)??!1,x)??o.computed[r]]))}:{},...J||V||o.glance||o.page?{display:{...J?{labels:te}:{},...V?{format:C}:{},...o.glance?{glance:[...o.glance]}:{},...o.page?{page:o.page}:{}}}:{},...Object.keys(K).length>0?{defaults:K}:{},...e.kinds[y]?.keptInStep?{keptInStep:e.kinds[y].keptInStep}:{},...e.kinds[y]?.derives?{derives:N(e.kinds[y].derives)}:{}})}),U=sn(ae,n.computed);function L(y){return U.tryDefinition(y.kind)?.label?.(y)??y.id}let Te=y=>({id:"",kind:y,...ne.get(y)}),Ge=[];for(let[y,o]of Object.entries(n.acts??{})){let R=e.acts[y],{title:v,effects:$,guard:z,refusal:O,destructive:P,idempotent:te,creates:J,connects:D,severs:m,writes:C,writesOther:V,sets:K}=R,W={};for(let c of $)"through"in c&&(W[c.through]=[...new Set([...W[c.through]??[],...Object.keys(c.set)])]);let Z=new Map(R.args),T={};for(let[c,S]of Z)T[c]=Cn(S,x);let r=[o.on??[]].flat(),i=new Map(R.exprs),E=$.find(c=>"create"in c),Y=(c,S,l,b=null)=>{if(H(c)&&"expr"in c)return X(i.get(c.expr),{graph:l,subject:b,kinds:w,bindings:S,args:S,today:s(),...g});let h=me(c);return h===void 0?typeof c=="string"&&c.startsWith("$$")?c.slice(1):c:h==="now"?new Date().toISOString():h==="today"?s():S[h]},ce=(c,S)=>{if(!E)return"";let l=n.kinds[E.create].fields,b=Te(E.create),h=[];for(let[A,le]of Object.entries(E.set??{})){try{b[A]=Y(le,c,S)??b[A]}catch{}let se=me(le);se&&c[se]!==void 0&&h.push(A)}let G=L(b).trim(),re=h.filter(A=>b[A]!==!1&&l[A].type!=="text"&&!(/[^]{41}/.test(b[A])||/ .*[.!?]$/.test(b[A])&&!/[ .][A-Z]\w{0,3}\.$/.test(b[A]))&&L({...b,[A]:void 0}).trim()===G).map(A=>b[A]===!0?l[A].label??xe(A):On(b[A],l[A].format,s(),[],x));return G&&re.length>0?`${G} (${re.join(", ")})`:G};Ge.push(un(y,{input:Oe(T),title:v,...o.description?{description:o.description}:{},...o.fromTheOtherEnd?{fromTheOtherEnd:o.fromTheOtherEnd}:{},...Z.has(ee)?{subject:{kinds:r.length>0?r:"*",arg:ee}}:{},...P?{destructive:!0}:{},...te?{idempotent:!0}:{},...JSON.stringify(o).includes('"$me"')?{doneAsMe:!0}:{},...J.length>0?{creates:J}:{},...D.length>0?{connects:D}:{},...m.length>0?{severs:m}:{},writes:C,...Object.keys(V).length>0?{writesOther:V}:{},...Object.keys(W).length>0?{writesLinked:W}:{},...Object.keys(K).length>0?{sets:K}:{},...z?{allowedOn:(c,S)=>{let l=c.getNode(S);if(!l||r.length>0&&!r.includes(l.kind))return!1;try{return X(z,{graph:c,subject:l,kinds:w,bindings:{},today:s(),...g})===!0}catch{return!1}}}:{},describe:(c,S)=>{let l=typeof c[ee]=="string"?S.getNode(c[ee]):void 0,b=l?L(l):ce(c,S);return b?`${v}: ${b}`:v},apply(c,S){let l=c.graph,b=typeof S[ee]=="string"?S[ee]:void 0,h=b?l.getNode(b):void 0;if(b&&!h&&ge(b),h&&r.length>0&&!r.includes(h.kind))throw new I(`"${v}" acts on ${r.join(" or ")}, not on ${en(h.kind)}`,"invalid");let G={};for(let[a,p]of Object.entries(S))p!==void 0&&(G[a]=p);if(z&&h){let a;try{a=X(z,{graph:l,subject:h,kinds:w,bindings:G,args:G,today:s(),...g})}catch(p){throw p instanceof ie?new I(`"${v}" could not be judged: ${p.sentence}`):p}if(a!==!0)throw new I(O?de(O,{node:h,kinds:w,graph:l,bindings:G,args:G,today:s(),money:x}):`"${v}" is not allowed for ${L(h)} right now`)}let re=new Map,A=a=>l.has(a)||[...re.values()].includes(a),le=new Set,se=a=>{let p=dn(a);le.has(p)||(le.add(p),c.removeEdge(a))},ve=(a,p,f)=>{let u=a===void 0?void 0:n.kinds[a],k=u?.fields[p];if(k?.required){let M=k.label??xe(p);throw new I(`"${v}" cannot clear ${M}${f?` of ${L(f)}`:""}: every ${u.noun??a} has one`,"invalid")}},oe=(a,p)=>{let f=me(a);if(f==="subject")return b;if(f==="me"){let u=c.me;if(u&&n.kinds[l.getNode(u)?.kind]?.people)return u;throw new I(`"${v}" is done as you, and you have no record here`)}if(re.has(f))return re.get(f);try{return Y(a,G,l,p??h??null)}catch(u){throw u instanceof ie?new I(`"${v}" could not work out a value: ${u.sentence}`):u}};for(let a of $)if("create"in a){let p=n.kinds[a.create],f=Te(a.create);for(let[q,Q]of Object.entries(a.set??{})){let Ne=Q===null?ve(a.create,q):oe(Q,void 0);Ne!==void 0&&(f[q]=Ne)}let u=Pn(p),k=String((u&&f[u])??a.create),M=fn(k,a.create,f,(q,Q)=>ln(n.policy?.sees,q,Q)),F=c.freshId(M?a.create:k,a.create,f);c.addNode({...f,id:F}),a.as&&re.set(a.as,F)}else if("connect"in a||"sever"in a){let p="connect"in a?a.connect:a.sever,f=String(oe(a.from,void 0)??""),u=String(oe(a.to,void 0)??"");if(A(f)||ge(f),A(u)||ge(u),"connect"in a){if(j.get(p)?.cardinality==="one")for(let k of l.out(f,p))k.id!==u&&se({kind:p,from:f,to:k.id});l.out(f,p).some(k=>k.id===u)||c.addEdge({kind:p,from:f,to:u})}else{let k=[l.getNode(f),l.getNode(u)];if(k[0]&&k[1]&&!l.out(f,p,{archived:"all"}).some(M=>M.id===u))throw new I(`"${v}" has nothing to take away: ${L(k[0])} is not linked to ${L(k[1])} that way`);se({kind:p,from:f,to:u})}}else if("through"in a){if(!h)throw new I(`"${v}" carries a change to linked records, and has no record to start from`,"invalid");let f=j.get(a.through)?.from.includes(h.kind)??!0?l.out(h.id,a.through):l.in(h.id,a.through);for(let u of f){let k={};for(let[M,F]of Object.entries(a.set)){let q;if(me(F)==="to")q=u.id;else if(H(F)&&"expr"in F)try{q=X(i.get(F.expr),{graph:l,subject:h,kinds:w,bindings:{...G,to:u},args:G,today:s(),...g})}catch(Q){throw Q instanceof ie?new I(`"${v}" could not work out a value for ${L(u)}: ${Q.sentence}`):Q}else q=oe(F,void 0);F===null?k[M]=ve(u.kind,M,u):q!==void 0&&(k[M]=q)}Object.keys(k).length>0&&c.patchNode(u.id,k)}}else if("set"in a){let p=String(oe(a.target??"$subject",void 0)??""),f=l.getNode(p);!f&&!A(p)&&ge(p);let u={};for(let[k,M]of Object.entries(a.set))if(M===null)u[k]=ve(f?.kind,k,f);else{let F=oe(M,f);F!==void 0&&(u[k]=F)}Object.keys(u).length>0&&c.patchNode(p,u)}else if("remove"in a){let p=String(oe(a.remove,void 0)??"");l.has(p)||ge(p),c.removeNode(p)}else if("replace"in a&&h){let p=S.to;for(let f of a.replace){let u=j.get(f)?.from.includes(h.kind)??!0;for(let k of u?l.out(h.id,f):l.in(h.id,f))f===a.keep&&k.id===p||se(u?{kind:f,from:h.id,to:k.id}:{kind:f,from:k.id,to:h.id})}}}}))}let Me=[];for(let[y,o]of Object.entries(n.rules??{})){let{title:R,require:v,when:$,says:z,covers:O}=e.rules[y],P=o.repairs??[],te=(D,m,C=s(),V)=>{let K=[],W={graph:D,subject:m,kinds:w,today:C,...g,...V?{linked:V}:{},onUnread:i=>K.push(i)},Z,T=[];try{if($&&X($,W)!==!0)return[];if(O&&m?(T=xn(D,m,O),Z=T.length===0):Z=X(v,W)===!0,!Z&&K.length>0)throw new ie(`it reads ${wn(K[0])}`,0)}catch(i){throw i instanceof vn?new cn(i.sentence):i instanceof ie?new Error(i.sentence):i}if(Z)return[];let r=P.flatMap(i=>{let E=n.acts?.[i.act],Y={},ce=m&&E?.on&&E.fromTheOtherEnd&&![E.on].flat().includes(m.kind)?Nn(e.acts[i.act].args,m.kind):void 0;ce?Y[ce]=m.id:m&&(E?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(i.act))&&(Y[ee]=m.id);for(let[l,b]of Object.entries(i.args??{}))Y[l]=me(b)==="subject"?m?.id:b;let S=(E?e.acts[i.act].args:[]).filter(([l,b])=>b.required&&Y[l]===void 0).map(([l])=>l);return[{mutation:i.act,label:i.label??(ce?E.fromTheOtherEnd:E?.title)??i.act.replace(/-/g," "),args:Y,...S.length>0?{missing:S}:{}}]});return O&&m?T.map(i=>({invariant:y,subjectId:m.id,label:R,message:z?de(z,{node:m,kinds:w,graph:D,today:C,money:x,bindings:{[m.kind]:m,[i.kind]:i}}):`${L(m)}: ${R} \u2014 ${L(i)}`,nodeIds:[m.id,i.id],repairs:r})):[{invariant:y,...m?{subjectId:m.id}:{},label:R,message:z?de(z,{node:m,kinds:w,graph:D,today:C,money:x}):m?`${L(m)}: ${R}`:R,nodeIds:m?[m.id]:[],repairs:r}]},J={label:R,shape:{over:o.over,require:v,...O?{covers:O}:{},when:$,says:z,declared:n.kinds,money:x,kinds:w,today:s},judgment:{...o.require?{require:o.require}:{},...o.covers?{covers:o.covers}:{},...o.when?{when:o.when}:{},...o.says?{says:o.says}:{}},...o.description?{description:o.description}:{},...P.length>0?{repairs:P.map(D=>D.act)}:{}};Me.push(o.over==="graph"?ze(y,{scope:"graph",...J,evaluate:({graph:D,today:m,context:C})=>te(D,null,m,C?.linked)}):ze(y,{scope:{kind:o.over},...J,evaluate:({graph:D,subject:m,today:C,context:V})=>te(D,m,C,V?.linked)}))}let Fe=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},be={name:n.name,schema:U,mutations:Ge,invariants:Me,...Fe?{policy:Fe}:{},...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 An(be,n),In.set(be,e),{ok:!0,app:be,document:n,findings:e.findings,sights:n.policy?.sees,kinds:w}}function Kn(e,d,n){let t=d||e.format==="duration",s=e.format==="money"||e.format==="percent"||!e.format&&e.unit!==void 0;if(!(!t&&!s))return{...e,...t?{as:"duration"}:{},...s?{amount:{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{},...e.places===0?{places:0}:{}}}:{}}}export{H as a,Rn as b,qn as c,Xn as d,Ln as e,ee as f,me as g,Pn as h,Rt as i,Vn as j};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as Ve}from"./chunk.7KX36ENH.js";import{c as Be,d as Ie,f as Ge}from"./chunk.KBJ3UUER.js";import{e as Re,f as Fe,k as Me,l as ne,n as Oe}from"./chunk.NI4OPHTL.js";import{f as Ae}from"./chunk.W6L2VAJG.js";import{d as z,e as Ce,k as te}from"./chunk.VVIQSFM4.js";import{a as je,d as Pe}from"./chunk.TQ3MNB6K.js";import{Ac as ye,C as J,L as ce,Md as ke,cd as we,ea as de,ed as be,ee as xe,gc as he,gd as $e,ha as U,ia as ue,la as H,ma as W,na as me,oa as Q,oe as Se,pa as pe,rd as Z,sa as fe,sd as ve,ta as ge,va as _,xe as De,zc as ee}from"./chunk.6L6RUOSF.js";function Ye(t,e,n){let o=t.tryDefinition(e)?.fields.shape,r=J(o?.[n]),a=!1,s=!1;for(;r&&(r.type==="optional"||r.type==="default"||r.type==="nullable"||r.type==="prefault");)(r.type==="optional"||r.type==="nullable")&&(a=!0),(r.type==="default"||r.type==="prefault")&&(s=!0),r=J(r.innerType);if(r?.type!=="enum")return;let p=(r.entries?Object.values(r.entries):r.values??[]).filter(m=>typeof m=="string");return p.length>0?{values:p,empty:a&&!s}:void 0}function E(t,e,n){let o=Ye(t,e,n);if(!o)return[];let r=t.tryDefinition(e),a=o.values.map(s=>({value:s,label:je(r,n,s)}));return o.empty&&a.push({value:null,label:`No ${ge(r,n)}`}),a}function q(t,e,n){let o=t[e];return typeof o=="string"&&n.some(r=>r.value===o)?o:null}function re(t,e,n,o,r=E(t.schema,n.kind,o)){return Ne(t,e,n,o,r).flatMap(a=>a.move?[a.move]:[])}function Ne(t,e,n,o,r=E(t.schema,n.kind,o)){let a=Ke(t.schema,t.allMutations(),n.kind,o,r),s=q(n,o,r),p=_(t.schema.tryDefinition(n.kind),n.kind),m=[];for(let{value:A,label:C,by:R,acts:F}of a){if(A===s)continue;let x,G,V;for(let c of F){let w=R==="step"?{[c.subject.arg]:n.id}:{[c.subject.arg]:n.id,[o]:A},S={name:c.name,args:w};if(!c.input.safeParse(w).success){V??=`${c.title??c.name} asks for more than the ${p} itself.`;continue}let k=t.permits(S,e);if(!k.ok){G??=k.refusal?.message??`You may not ${c.title??c.name}.`;continue}try{he(t.graph,c,w)}catch(f){G??=f instanceof Error?f.message:String(f);continue}x={to:A,call:S,title:c.title??c.name};break}m.push(x?{to:A,label:C,move:x}:{to:A,label:C,why:G??V??`Nothing in this app moves a ${p} to ${C}.`})}return m}function Ke(t,e,n,o,r=E(t,n,o)){let a=Te(t,e,n,o),s=We(t,e,n,o);return r.flatMap(p=>{if(p.value===null)return[];let m=a.filter(A=>A.sets?.[o]===p.value);return[{value:p.value,label:p.label,by:m.length>0?"step":s.length>0?"value":"none",acts:m.length>0?m:s}]})}function Te(t,e,n,o){return e.filter(r=>r.subject!==void 0&&r.derived===void 0&&typeof r.sets?.[o]=="string"&&ee(t,r).includes(n))}function We(t,e,n,o){let r=t.tryDefinition(n);return r?e.filter(a=>{if(!a.subject||!ee(t,a).includes(n)||!ye(a,r).includes(o))return!1;let s=a.input.shape;return s!==void 0&&o in s}).sort((a,s)=>+(a.derived!==void 0)-+(s.derived!==void 0)):[]}var se=(t,e)=>e&&t[e]!==void 0?String(t[e]):"";function Je(t,e,n){let o=c=>t.tryDefinition(c)?e.nodesOfKind(c).filter(w=>H(t.tryDefinition(c),w)):[],r=o(n.rows),a=o(n.columns),s=new Set(r.map(c=>c.id)),p=new Set(a.map(c=>c.id)),m=e.allEdges(),A=[],C=n.link;if(typeof C=="string"){let c=f=>t.tryDefinition(f)?.edges?.[C]?.to,w=(c(n.columns)??[]).some(f=>f===n.rows||f==="*"),S=(c(n.rows)??[]).some(f=>f===n.columns||f==="*"),k=w||!S;for(let f of m){if(f.kind!==C)continue;let j=k?f.to:f.from,i=k?f.from:f.to;s.has(j)&&p.has(i)&&A.push({rowId:j,columnId:i,via:[]})}}else{let c=new Map(C.path.map(S=>[S,new Map]));for(let S of m){let k=c.get(S.kind);if(!k)continue;let f=k.get(S.from);f?f.push(S.to):k.set(S.from,[S.to]);let j=k.get(S.to);j?j.push(S.from):k.set(S.to,[S.from])}let w=new Set;for(let S of a){let k=[{id:S.id,via:[]}];for(let f of C.path){let j=[],i=new Set;for(let v of k)for(let b of c.get(f).get(v.id)??[])i.has(`${v.id}|${b}`)||(i.add(`${v.id}|${b}`),j.push({id:b,via:[...v.via,v.id]}));k=j}for(let f of k){let j=`${f.id}|${S.id}`;!s.has(f.id)||w.has(j)||(w.add(j),A.push({rowId:f.id,columnId:S.id,via:f.via.slice(1)}))}}}let R=n.groupOrder??[],F=c=>R.indexOf(c)===-1?R.length:R.indexOf(c),x=(c,w)=>w==="label"?W(t.tryDefinition(c.kind),c):c[w],G=Z(r,n.sort,x).map(c=>{let w=c;return{node:c,label:W(t.tryDefinition(c.kind),c),group:se(w,n.rowGroup),ref:se(w,n.rowRef)}}).sort((c,w)=>F(c.group)-F(w.group)||(n.sort!==void 0?0:c.ref<w.ref?-1:c.ref>w.ref?1:0)),V=Z(a,n.columnSort,x).map(c=>({node:c,label:W(t.tryDefinition(c.kind),c),group:se(c,n.columnGroup)})).sort((c,w)=>c.group<w.group?-1:c.group>w.group?1:n.columnSort!==void 0?0:c.node.id<w.node.id?-1:c.node.id>w.node.id?1:0);return{rows:G,columns:V,cells:A}}function He(t,e,n){let{rows:o,columns:r,cells:a}=Je(t,e,n),s=(i,v)=>Q(t,i,v),p=i=>Q(t,i,1).replace(/^1 /,""),m=i=>({id:i.id,kind:i.kind,title:W(t.tryDefinition(i.kind),i),parts:[]}),A=i=>{let v=e.getNode(i);if(!v)return null;let b=t.tryDefinition(v.kind),P=W(b,v),N=z(v,b,{limit:3,said:[P],glance:!0}).map(K=>K.alone.startsWith(K.label)?`${K.label.toLowerCase()}${K.alone.slice(K.label.length)}`:K.alone);return[P,...N].join(", ")},C=typeof n.link=="string"?[]:n.link.path.slice(0,-1).flatMap((i,v,b)=>{let P=ke(t,n.columns,b.slice(0,v+1));return P.ok?[...P.reached]:[]}),R=ve(t,n,{rows:o.length,columns:r.length,cells:a.length});if(R)return[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}.`},{t:"text",text:R}];let F=[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}${C.length>0?`, through ${[...new Set(C)].map(i=>s(i,2).replace(/^2 /,"")).join(" and ")}`:""}${r.length>0?`: ${r.map(i=>i.label).join(", ")}`:""}.`}],x=new Map(r.map(i=>[i.node.id,i.label])),G=new Map(r.map((i,v)=>[i.node.id,v])),V=new Map,c=new Map;for(let i of a){let v=V.get(i.rowId);v?v.push(i):V.set(i.rowId,[i]);let b=c.get(i.columnId);b?b.add(i.rowId):c.set(i.columnId,new Set([i.rowId]))}for(let i of o){let b=[...V.get(i.node.id)??[]].sort((P,N)=>G.get(P.columnId)-G.get(N.columnId)).map(P=>{let N=P.via.map(A).filter(K=>K!==null);return`${x.get(P.columnId)}${N.length>0?` (${N.join("; ")})`:""}`});F.push({t:"field",label:i.label,text:b.length>0?b.join(", "):"none"})}F.push({t:"list",as:"name",columns:1,groups:r.map(i=>{let v=c.get(i.node.id)??new Set,b=o.filter(P=>v.has(P.node.id)).map(P=>m(P.node));return{heading:`${i.label} (${b.length})`,items:b}})});let w=new Set(a.map(i=>i.rowId)),S=new Set(a.map(i=>i.columnId)),k=o.filter(i=>!w.has(i.node.id)),f=r.filter(i=>!S.has(i.node.id)),j=n.rows===n.columns;return k.length>0&&F.push({t:"text",text:`${j?`${k.length} with none across`:`${s(n.rows,k.length)} with no ${p(n.columns)}`}: ${k.map(i=>i.label).join(", ")}.`}),f.length>0&&F.push({t:"text",text:`${j?`${f.length} with none down`:`${s(n.columns,f.length)} on no ${p(n.rows)}`}: ${f.map(i=>i.label).join(", ")}.`}),F}function oe(t,e,n,o={}){let{app:r,blocks:a=n?r?.viewSpecs?.[n.kind]?.[o.slot??"page"]:r?.home}=o;if(!a?.length)return[];let s=o.firstHeading??(n||o.blocks?void 0:1),p=Oe(t,e,n,{...o,money:o.money??r?.brand,firstHeading:s});return n&&!p.node?[]:Fe(typeof a[0]?.t=="string"?a:Re(a),p)}function X(t,e,n){let o=!(e.optional||e.control==="boolean"),r=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(s=>U(_(t.tryDefinition(s),s))).join(" or "):n(e.name).label,a={name:e.name,label:r,required:o};switch(e.control){case"text":return{...a,input:e.holds==="duration"?"length of time":e.holds??(e.markdown?"Markdown text":e.long?"long text":e.app?"app address":"text")};case"date":return{...a,input:e.time||e.instant?"date and time":"date"};case"number":return{...a,input:e.amount?"amount":"number",...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case"choice":return{...a,input:"choice",choices:(e.options??[]).map(s=>n(e.name).option(s))};case"boolean":return{...a,input:"yes or no"};case"node":return{...a,input:"record",kinds:e.kinds};case"linked":return{...a,input:"record in another app"};case"file":return{...a,input:e.image?"picture":e.video?"video":"file"};case"repeat":return{...a,input:"how it repeats"};case"list":return{...a,input:`list of ${X(t,e.item,n).input}`};case"group":return{...a,input:"group",fields:e.fields.map(s=>X(t,s,n))};case"variant":return{...a,input:"one of",choices:e.options.map(s=>ue(s.value))};default:return{...a,input:"answer"}}}function Ee(t,e,n){let o=Ie(t,e,n),r=t.schema,a=Be(r,n).filter(p=>p.name!==n.subject?.arg&&!o.has(p.name)),s=me(n);return{act:n.name,title:s,submit:s,fields:a.map(p=>X(r,p,m=>te(r,n,m)))}}function Le(t,e){return{act:e.act.name,title:e.title,submit:e.submit,visitor:e.name,fields:e.fields.map(n=>X(t,n,o=>te(t,e.act,o)))}}function Ze(t,e,n){return t.permittedMutations(e).filter(o=>!o.derived&&!o.subject&&(o.creates??[]).includes(n))}function ze(t,e=""){let n=[`${e}Form "${t.title}" (${t.visitor?`the visitor form ${t.visitor}, running `:""}act ${t.act}), button "${t.submit}":`],o=(r,a)=>{for(let s of r){let p=s.choices?`${s.input}: ${s.choices.join(", ")}`:s.kinds?`${s.input} (${s.kinds.join(" or ")})`:s.input,m=s.min!==void 0||s.max!==void 0?`, ${s.min??"\u2026"} to ${s.max??"\u2026"}`:"";n.push(`${a}- ${s.label}${s.required?" *":""} (${s.name}) \u2014 ${p}${m}`),s.fields&&o(s.fields,`${a} `)}};return o(t.fields,`${e} `),t.fields.length===0&&n.push(`${e} (asks nothing)`),n}function _e(t,e){let n=t.viewSpecs??{};return e.filter(o=>o.cardinality==="one"&&o.replaces==="page"&&(n[o.attach]?.page?.length??0)>0).map(o=>{let r=L(t.schema,o.attach,1);return{at:`views.${o.attach}.page`,says:`The view "${o.name}" replaces ${Qe(r)}'s page, so its page slot is never drawn: leave out replaces to draw the slot under the view, or draw what the slot says in the view.`}})}var Qe=t=>`${/^[aeiou]/i.test(t)?"an":"a"} ${t}`,et=240,Ue=10,tt=1160,nt=40,qe=640,rt=3,st=t=>Math.max(1,Math.floor((Math.min(t,tt)-nt+Ue)/(et+Ue)));function ot(t,e,n,o){let{app:r}=o,a=o.width??1440,s=o.today??t.today()??ce(r.brand?.timeZone),p=t.seenBy(e),m=p.schema,A=p.graph,C=Ve(r,o.views?{views:o.views}:{}),R=typeof n=="string"?n.trim():n.slug,F=typeof n=="string"?C.find(l=>l.slug===R||l.title===R||l.address===R):C.find(l=>l.slug===n.slug&&l.kind===n.kind)??n,x=!F&&typeof n=="string"?A.getNode(R):void 0,G=!F&&!x?/^\/?forms\/(.+)$/.exec(R)?.[1]:void 0,V=G!==void 0?Ge(r,G):void 0;if(V)return{ok:!0,description:it(m,V,a)};if(!F&&!x)return{ok:!1,error:`"${R}" is not a place this app has, nor a record this seat can see.`,places:[...C.map(l=>l.slug),...Object.keys(r.forms??{}).map(l=>`forms/${l}`)]};let c=[],w=r.viewSpecs??{},S=st(a),k=(l,h)=>oe(p,null,l,{app:r,today:s,...h}),f=(l,h,M)=>{let d=m.tryDefinition(l.kind),g=W(d,l);if(h==="name")return{id:l.id,kind:l.kind,title:g,parts:[]};if(w[l.kind]?.[h]){let I=k(l,{slot:h}),[B,...O]=I,y=B?.t==="title"||h==="row"&&B?.t==="headline";return{id:l.id,kind:l.kind,title:y?B.text:g,parts:j(y?O:I,M,`views.${l.kind}.${h}`,` (${l.id})`,y?1:0)}}if(h==="row")return{id:l.id,kind:l.kind,title:g,parts:[]};let u=d?.computed?ne(m,A,l):l,T=z(u,d,{limit:3,said:[g],glance:!0,locale:r.brand?.locale,timeZone:r.brand?.timeZone});return{id:l.id,kind:l.kind,title:g,parts:T.map(I=>({t:"text",text:I.alone}))}};function j(l,h,M,d="",g=0){let $=[];return l.forEach((u,T)=>{let I=`${M}.${T+g}`;switch("problem"in u&&u.problem&&c.push({at:`${I}${d}`,says:u.problem}),u.t){case"title":$.push({t:"heading",level:3,text:u.text});return;case"text":$.push({t:"text",text:u.markdown?Pe(u.text):u.runs?ct(u.runs):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":$.push({t:"badge",text:u.text});return;case"field":case"image":$.push({t:"field",label:u.label,text:u.text});return;case"progress":$.push({t:"progress",label:u.label,text:u.text});return;case"group":$.push(...j(u.blocks,h,`${I}.group`,d));return;case"when":$.push(...j(u.blocks,h,`${I}.show`,d));return;case"divider":case"figure":return;case"headline":$.push({t:"heading",level:u.level,text:u.text});return;case"number":$.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){$.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&$.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let B=h+1,O=B>rt?"name":u.as,y=(u.groups??[{value:null,members:u.members}]).map(D=>({..."heading"in D&&D.heading?{heading:D.heading,count:(u.everyGroup?.find(Y=>Y.value===D.value)??D).members.length}:{},items:D.members.map(Y=>f(Y,O,B))}));$.push({t:"list",as:O,columns:O==="card"?S:1,groups:y,...u.more>0?{more:u.more}:{}});return}}}),$}let i=[],v,b,P,N=[];if(x){b="record";let l=m.tryDefinition(x.kind),h=W(l,x);P={slug:x.id,title:h,kind:x.kind,address:xe(m,x.kind,x.id)};let M=w[x.kind]?.page,d=o.views?.find(g=>g.attach===x.kind&&g.cardinality==="one");if(d&&i.push({t:"view",name:d.name,...d.title?{title:d.title}:{},...d.replaces==="page"?{replaces:!0}:{},...d.parts?{parts:d.parts}:{}}),d?.replaces==="page")b=`view:${d.name}`,c.push(..._e(r,[d]));else{M&&i.push(...j(k(x,{slot:"page"}),1,`views.${x.kind}.page`));let g=l?.computed?ne(m,A,x):x;for(let $ of Ce(l,z(g,l,{said:[h],locale:r.brand?.locale,timeZone:r.brand?.timeZone}))){$.title&&i.push({t:"heading",level:2,text:$.title});for(let u of $.fields)i.push({t:"field",label:u.label,text:u.value,...u.long?{long:!0}:{},...u.markdown?{markdown:!0}:{}})}}}else{let l=F;P={slug:l.slug,title:l.title,kind:l.kind,address:l.address};let h=l.lens?Se(r).drawn.find(d=>d.as===l.slug&&(l.kind===null||d.kinds.includes(l.kind))):void 0,M=l.kind!==null&&l.view===void 0&&!h?o.views?.find(d=>d.attach===l.kind&&d.cardinality==="many"&&d.replaces==="page"&&!d.hidden):void 0;if(l.kind!==null&&h?.create!==!1&&l.view===void 0&&!M&&(N=Ze(t,e,l.kind).map(d=>Ee(t,e,d))),l.view!==void 0&&!h){let d=o.views?.find(g=>g.name===l.view);b=`view:${l.view}`,i.push({t:"view",name:l.view,title:d?.title??l.title,...typeof d?.flows=="boolean"?{flows:d.flows}:{},...d?.parts?{parts:d.parts}:{}})}else if(l.kind===null){let d=r.brand,g=d?.name??r.name,$=$e(d)?.light,u=$&&be($)?$:void 0;if(v={name:g,...d?.subtitle&&d.subtitleDrawn!==!1?{subtitle:d.subtitle}:{},...u?{logo:{alt:d?.logoAlt??g,...we(u)?{drawn:"inline SVG"}:{drawn:"image",src:u}}}:{}},r.home)b="blocks",i=j(k(null,{}),0,"views.home");else{b="derived";let T=t.kindsKeptFrom(e),I=new Set([...r.pages?.hide??[],...T,...t.modules.disabledKinds]),B=De(m.kinds,r.pages?.order).filter(O=>!I.has(O));i.push({t:"heading",level:1,text:r.name??"Home"});for(let O of B){let y=A.nodesOfKind(O).filter(D=>H(m.tryDefinition(O),D)).length;y>0&&i.push({t:"text",text:`${y} ${L(m,O,y)}`})}}}else if(h?.lens==="blocks")b="lens:blocks",i=j(k(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){b="lens:columns";let d=h.options.bindings??{};for(let g of Object.keys(d)){let $=d[g]?.column;if(!$)continue;let u=E(m,g,$),T=Z(A.nodesOfKind(g).filter(y=>H(m.tryDefinition(g),y)),h.options.sort,(y,D)=>D==="label"?W(m.tryDefinition(y.kind),y):y[D]);Object.keys(d).length>1&&i.push({t:"heading",level:2,text:L(m,g,2).replace(/^./,y=>y.toUpperCase())}),i.push({t:"text",text:`${T.length} ${L(m,g,T.length)} in columns by ${fe(m.tryDefinition(g),$).toLowerCase()}.`});let I=u.map(y=>({column:y,items:T.filter(D=>q(D,$,u)===y.value).map(D=>f(D,"card",1))})).filter(({column:y,items:D})=>y.value!==null||D.length>0).map(({column:y,items:D})=>({heading:`${y.label} (${D.length})`,items:D}));i.push({t:"list",as:"card",columns:1,groups:I});let B=new Map;for(let y of T)for(let D of re(t,e,y,$,u))B.set(D.to,(B.get(D.to)??new Set).add(`"${D.title}"`));let O=u.filter(y=>y.value!==null&&B.has(y.value)).map(y=>`to ${y.label} by ${[...B.get(y.value)].join(" or ")}`);i.push({t:"text",text:O.length>0?`Moves: ${O.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")b="lens:coverage",i=He(m,A,h.options);else if(h){b=`lens:${h.lens}`;let d=h.kinds.flatMap(g=>A.nodesOfKind(g).filter($=>H(m.tryDefinition(g),$)));i.push({t:"text",text:`A ${h.lens} of ${d.length} ${h.kinds.map(g=>L(m,g,d.length)).join(" and ")}.`}),i.push({t:"list",as:"name",columns:1,groups:[{items:d.map(g=>f(g,"name",1))}]})}else if(M)b=`view:${M.name}`,i.push({t:"heading",level:1,text:l.title}),i.push({t:"view",name:M.name,...M.title?{title:M.title}:{},replaces:!0,...M.parts?{parts:M.parts}:{}});else{b="derived";let d=A.nodesOfKind(l.kind).filter(g=>H(m.tryDefinition(l.kind),g));i.push({t:"heading",level:1,text:l.title}),d.length===0?i.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${L(m,l.kind,0)} yet.`}):i.push({t:"list",as:"row",columns:1,groups:[{items:d.map(g=>f(g,"row",1))}]})}}let K=e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,Xe=a<qe?"phone":"wide",ae=P.kind===null?at(m,A):[],le={...v?{masthead:v}:{},...ae.length>0?{facts:ae}:{},place:P,seat:K,width:a,variant:Xe,drawnBy:b,parts:i,...N.length>0?{forms:N}:{},problems:c};return{ok:!0,description:{...le,text:ie(le)}}}function it(t,e,n){let o=[{t:"heading",level:1,text:e.title},...e.intro?[{t:"text",text:e.intro}]:[]],r={place:{slug:`forms/${e.name}`,title:e.title,kind:null,address:`/forms/${e.name}`},seat:`a visitor (${e.role})`,width:n,variant:n<qe?"phone":"wide",drawnBy:"form",parts:o,forms:[Le(t,e)],problems:[]};return{...r,text:ie(r)}}function at(t,e){let n=Me(t,e,null),o=r=>Array.isArray(r)?r.map(o).join(", "):r===null?"nothing":typeof r=="boolean"?r?"yes":"no":typeof r=="object"?r.label:String(r);return[...Ae(t)].map(([r,a])=>{let s=a.label??U(r);return Object.hasOwn(n.values,r)?{name:r,label:s,value:o(n.values[r])}:{name:r,label:s,refused:n.refused[r]??"it could not be worked out"}})}function L(t,e,n){let o=t.tryDefinition(e);if(n===1)return o?.noun??e;let r=pe(t,e);return de(r)}function ie(t){let e=[`${t.place.title} (${t.place.address}) \u2014 as ${t.seat}, ${t.width} wide (${t.variant}).`],n=t.masthead;n&&e.push(`Masthead: ${n.logo?`the logo ("${n.logo.alt}", ${n.logo.drawn==="image"?n.logo.src:"inline SVG"}), `:""}${n.name}${n.subtitle?` \u2014 ${n.subtitle}`:""}`);let o=(r,a)=>{for(let s of r)switch(s.t){case"heading":e.push(`${a}${"#".repeat(s.level)} ${s.text}`);break;case"text":e.push(`${a}${s.text}`);break;case"badge":e.push(`${a}[${s.text}]`);break;case"field":case"progress":e.push(`${a}${s.label}: ${s.text}`);break;case"figure":e.push(`${a}${s.text}${s.label?` \u2014 ${s.label}`:""}`);break;case"list":if(s.groups.length===0){s.empty&&e.push(`${a}(${s.empty})`);break}for(let p of s.groups){p.heading&&e.push(`${a}${p.heading}${p.count!==void 0?` (${p.count})`:""}:`);for(let m of p.items)e.push(`${a}${p.heading?" ":""}- ${m.title}`),o(m.parts,`${a}${p.heading?" ":" "}`)}s.as==="card"&&s.columns>1&&e.push(`${a}(cards, ${s.columns} across)`),s.more&&e.push(`${a}and ${s.more} more`);break;case"view":e.push(`${a}[the view "${s.title??s.name}"${s.replaces?", in place of the page":""}${s.flows===!0?", flowing with the page":s.flows===!1?", in a frame of its own":""}]`),s.parts&&o(s.parts,`${a} `);break}};o(t.parts,"");for(let r of t.forms??[])e.push(...ze(r));if(t.facts){e.push("Facts of the whole graph (what fact('<name>') reads):");for(let r of t.facts)e.push(`- ${r.label} (${r.name}): ${r.value??`not worked out \u2014 ${r.refused}`}`)}if(t.videos&&t.videos.length>0){e.push("Videos:");for(let r of t.videos)e.push(`- ${lt(r)}`)}if(t.problems.length>0){e.push("Problems:");for(let r of t.problems)e.push(`- ${r.at}: ${r.says}`)}return e.join(`
|
|
1
|
+
import{b as Ve}from"./chunk.O5P6LXHF.js";import{c as Be,d as Ie,f as Ge}from"./chunk.53GQQETN.js";import{e as Re,f as Fe,k as Me,l as ne,n as Oe}from"./chunk.J7GH2CGV.js";import{f as Ae}from"./chunk.QMGBAKX6.js";import{d as z,e as Ce,k as te}from"./chunk.P3Z4ZCL3.js";import{a as je,d as Pe}from"./chunk.45OLF6BK.js";import{Ac as ye,C as J,L as ce,Md as ke,cd as we,ea as de,ed as be,ee as xe,gc as he,gd as $e,ha as U,ia as ue,la as H,ma as W,na as me,oa as Q,oe as Se,pa as pe,rd as Z,sa as fe,sd as ve,ta as ge,va as _,xe as De,zc as ee}from"./chunk.ZDUKVXBI.js";function Ye(t,e,n){let o=t.tryDefinition(e)?.fields.shape,r=J(o?.[n]),a=!1,s=!1;for(;r&&(r.type==="optional"||r.type==="default"||r.type==="nullable"||r.type==="prefault");)(r.type==="optional"||r.type==="nullable")&&(a=!0),(r.type==="default"||r.type==="prefault")&&(s=!0),r=J(r.innerType);if(r?.type!=="enum")return;let p=(r.entries?Object.values(r.entries):r.values??[]).filter(m=>typeof m=="string");return p.length>0?{values:p,empty:a&&!s}:void 0}function E(t,e,n){let o=Ye(t,e,n);if(!o)return[];let r=t.tryDefinition(e),a=o.values.map(s=>({value:s,label:je(r,n,s)}));return o.empty&&a.push({value:null,label:`No ${ge(r,n)}`}),a}function q(t,e,n){let o=t[e];return typeof o=="string"&&n.some(r=>r.value===o)?o:null}function re(t,e,n,o,r=E(t.schema,n.kind,o)){return Ne(t,e,n,o,r).flatMap(a=>a.move?[a.move]:[])}function Ne(t,e,n,o,r=E(t.schema,n.kind,o)){let a=Ke(t.schema,t.allMutations(),n.kind,o,r),s=q(n,o,r),p=_(t.schema.tryDefinition(n.kind),n.kind),m=[];for(let{value:A,label:C,by:R,acts:F}of a){if(A===s)continue;let x,G,V;for(let c of F){let w=R==="step"?{[c.subject.arg]:n.id}:{[c.subject.arg]:n.id,[o]:A},S={name:c.name,args:w};if(!c.input.safeParse(w).success){V??=`${c.title??c.name} asks for more than the ${p} itself.`;continue}let k=t.permits(S,e);if(!k.ok){G??=k.refusal?.message??`You may not ${c.title??c.name}.`;continue}try{he(t.graph,c,w)}catch(f){G??=f instanceof Error?f.message:String(f);continue}x={to:A,call:S,title:c.title??c.name};break}m.push(x?{to:A,label:C,move:x}:{to:A,label:C,why:G??V??`Nothing in this app moves a ${p} to ${C}.`})}return m}function Ke(t,e,n,o,r=E(t,n,o)){let a=Te(t,e,n,o),s=We(t,e,n,o);return r.flatMap(p=>{if(p.value===null)return[];let m=a.filter(A=>A.sets?.[o]===p.value);return[{value:p.value,label:p.label,by:m.length>0?"step":s.length>0?"value":"none",acts:m.length>0?m:s}]})}function Te(t,e,n,o){return e.filter(r=>r.subject!==void 0&&r.derived===void 0&&typeof r.sets?.[o]=="string"&&ee(t,r).includes(n))}function We(t,e,n,o){let r=t.tryDefinition(n);return r?e.filter(a=>{if(!a.subject||!ee(t,a).includes(n)||!ye(a,r).includes(o))return!1;let s=a.input.shape;return s!==void 0&&o in s}).sort((a,s)=>+(a.derived!==void 0)-+(s.derived!==void 0)):[]}var se=(t,e)=>e&&t[e]!==void 0?String(t[e]):"";function Je(t,e,n){let o=c=>t.tryDefinition(c)?e.nodesOfKind(c).filter(w=>H(t.tryDefinition(c),w)):[],r=o(n.rows),a=o(n.columns),s=new Set(r.map(c=>c.id)),p=new Set(a.map(c=>c.id)),m=e.allEdges(),A=[],C=n.link;if(typeof C=="string"){let c=f=>t.tryDefinition(f)?.edges?.[C]?.to,w=(c(n.columns)??[]).some(f=>f===n.rows||f==="*"),S=(c(n.rows)??[]).some(f=>f===n.columns||f==="*"),k=w||!S;for(let f of m){if(f.kind!==C)continue;let j=k?f.to:f.from,i=k?f.from:f.to;s.has(j)&&p.has(i)&&A.push({rowId:j,columnId:i,via:[]})}}else{let c=new Map(C.path.map(S=>[S,new Map]));for(let S of m){let k=c.get(S.kind);if(!k)continue;let f=k.get(S.from);f?f.push(S.to):k.set(S.from,[S.to]);let j=k.get(S.to);j?j.push(S.from):k.set(S.to,[S.from])}let w=new Set;for(let S of a){let k=[{id:S.id,via:[]}];for(let f of C.path){let j=[],i=new Set;for(let v of k)for(let b of c.get(f).get(v.id)??[])i.has(`${v.id}|${b}`)||(i.add(`${v.id}|${b}`),j.push({id:b,via:[...v.via,v.id]}));k=j}for(let f of k){let j=`${f.id}|${S.id}`;!s.has(f.id)||w.has(j)||(w.add(j),A.push({rowId:f.id,columnId:S.id,via:f.via.slice(1)}))}}}let R=n.groupOrder??[],F=c=>R.indexOf(c)===-1?R.length:R.indexOf(c),x=(c,w)=>w==="label"?W(t.tryDefinition(c.kind),c):c[w],G=Z(r,n.sort,x).map(c=>{let w=c;return{node:c,label:W(t.tryDefinition(c.kind),c),group:se(w,n.rowGroup),ref:se(w,n.rowRef)}}).sort((c,w)=>F(c.group)-F(w.group)||(n.sort!==void 0?0:c.ref<w.ref?-1:c.ref>w.ref?1:0)),V=Z(a,n.columnSort,x).map(c=>({node:c,label:W(t.tryDefinition(c.kind),c),group:se(c,n.columnGroup)})).sort((c,w)=>c.group<w.group?-1:c.group>w.group?1:n.columnSort!==void 0?0:c.node.id<w.node.id?-1:c.node.id>w.node.id?1:0);return{rows:G,columns:V,cells:A}}function He(t,e,n){let{rows:o,columns:r,cells:a}=Je(t,e,n),s=(i,v)=>Q(t,i,v),p=i=>Q(t,i,1).replace(/^1 /,""),m=i=>({id:i.id,kind:i.kind,title:W(t.tryDefinition(i.kind),i),parts:[]}),A=i=>{let v=e.getNode(i);if(!v)return null;let b=t.tryDefinition(v.kind),P=W(b,v),N=z(v,b,{limit:3,said:[P],glance:!0}).map(K=>K.alone.startsWith(K.label)?`${K.label.toLowerCase()}${K.alone.slice(K.label.length)}`:K.alone);return[P,...N].join(", ")},C=typeof n.link=="string"?[]:n.link.path.slice(0,-1).flatMap((i,v,b)=>{let P=ke(t,n.columns,b.slice(0,v+1));return P.ok?[...P.reached]:[]}),R=ve(t,n,{rows:o.length,columns:r.length,cells:a.length});if(R)return[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}.`},{t:"text",text:R}];let F=[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}${C.length>0?`, through ${[...new Set(C)].map(i=>s(i,2).replace(/^2 /,"")).join(" and ")}`:""}${r.length>0?`: ${r.map(i=>i.label).join(", ")}`:""}.`}],x=new Map(r.map(i=>[i.node.id,i.label])),G=new Map(r.map((i,v)=>[i.node.id,v])),V=new Map,c=new Map;for(let i of a){let v=V.get(i.rowId);v?v.push(i):V.set(i.rowId,[i]);let b=c.get(i.columnId);b?b.add(i.rowId):c.set(i.columnId,new Set([i.rowId]))}for(let i of o){let b=[...V.get(i.node.id)??[]].sort((P,N)=>G.get(P.columnId)-G.get(N.columnId)).map(P=>{let N=P.via.map(A).filter(K=>K!==null);return`${x.get(P.columnId)}${N.length>0?` (${N.join("; ")})`:""}`});F.push({t:"field",label:i.label,text:b.length>0?b.join(", "):"none"})}F.push({t:"list",as:"name",columns:1,groups:r.map(i=>{let v=c.get(i.node.id)??new Set,b=o.filter(P=>v.has(P.node.id)).map(P=>m(P.node));return{heading:`${i.label} (${b.length})`,items:b}})});let w=new Set(a.map(i=>i.rowId)),S=new Set(a.map(i=>i.columnId)),k=o.filter(i=>!w.has(i.node.id)),f=r.filter(i=>!S.has(i.node.id)),j=n.rows===n.columns;return k.length>0&&F.push({t:"text",text:`${j?`${k.length} with none across`:`${s(n.rows,k.length)} with no ${p(n.columns)}`}: ${k.map(i=>i.label).join(", ")}.`}),f.length>0&&F.push({t:"text",text:`${j?`${f.length} with none down`:`${s(n.columns,f.length)} on no ${p(n.rows)}`}: ${f.map(i=>i.label).join(", ")}.`}),F}function oe(t,e,n,o={}){let{app:r,blocks:a=n?r?.viewSpecs?.[n.kind]?.[o.slot??"page"]:r?.home}=o;if(!a?.length)return[];let s=o.firstHeading??(n||o.blocks?void 0:1),p=Oe(t,e,n,{...o,money:o.money??r?.brand,firstHeading:s});return n&&!p.node?[]:Fe(typeof a[0]?.t=="string"?a:Re(a),p)}function X(t,e,n){let o=!(e.optional||e.control==="boolean"),r=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(s=>U(_(t.tryDefinition(s),s))).join(" or "):n(e.name).label,a={name:e.name,label:r,required:o};switch(e.control){case"text":return{...a,input:e.holds==="duration"?"length of time":e.holds??(e.markdown?"Markdown text":e.long?"long text":e.app?"app address":"text")};case"date":return{...a,input:e.time||e.instant?"date and time":"date"};case"number":return{...a,input:e.amount?"amount":"number",...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case"choice":return{...a,input:"choice",choices:(e.options??[]).map(s=>n(e.name).option(s))};case"boolean":return{...a,input:"yes or no"};case"node":return{...a,input:"record",kinds:e.kinds};case"linked":return{...a,input:"record in another app"};case"file":return{...a,input:e.image?"picture":e.video?"video":"file"};case"repeat":return{...a,input:"how it repeats"};case"list":return{...a,input:`list of ${X(t,e.item,n).input}`};case"group":return{...a,input:"group",fields:e.fields.map(s=>X(t,s,n))};case"variant":return{...a,input:"one of",choices:e.options.map(s=>ue(s.value))};default:return{...a,input:"answer"}}}function Ee(t,e,n){let o=Ie(t,e,n),r=t.schema,a=Be(r,n).filter(p=>p.name!==n.subject?.arg&&!o.has(p.name)),s=me(n);return{act:n.name,title:s,submit:s,fields:a.map(p=>X(r,p,m=>te(r,n,m)))}}function Le(t,e){return{act:e.act.name,title:e.title,submit:e.submit,visitor:e.name,fields:e.fields.map(n=>X(t,n,o=>te(t,e.act,o)))}}function Ze(t,e,n){return t.permittedMutations(e).filter(o=>!o.derived&&!o.subject&&(o.creates??[]).includes(n))}function ze(t,e=""){let n=[`${e}Form "${t.title}" (${t.visitor?`the visitor form ${t.visitor}, running `:""}act ${t.act}), button "${t.submit}":`],o=(r,a)=>{for(let s of r){let p=s.choices?`${s.input}: ${s.choices.join(", ")}`:s.kinds?`${s.input} (${s.kinds.join(" or ")})`:s.input,m=s.min!==void 0||s.max!==void 0?`, ${s.min??"\u2026"} to ${s.max??"\u2026"}`:"";n.push(`${a}- ${s.label}${s.required?" *":""} (${s.name}) \u2014 ${p}${m}`),s.fields&&o(s.fields,`${a} `)}};return o(t.fields,`${e} `),t.fields.length===0&&n.push(`${e} (asks nothing)`),n}function _e(t,e){let n=t.viewSpecs??{};return e.filter(o=>o.cardinality==="one"&&o.replaces==="page"&&(n[o.attach]?.page?.length??0)>0).map(o=>{let r=L(t.schema,o.attach,1);return{at:`views.${o.attach}.page`,says:`The view "${o.name}" replaces ${Qe(r)}'s page, so its page slot is never drawn: leave out replaces to draw the slot under the view, or draw what the slot says in the view.`}})}var Qe=t=>`${/^[aeiou]/i.test(t)?"an":"a"} ${t}`,et=240,Ue=10,tt=1160,nt=40,qe=640,rt=3,st=t=>Math.max(1,Math.floor((Math.min(t,tt)-nt+Ue)/(et+Ue)));function ot(t,e,n,o){let{app:r}=o,a=o.width??1440,s=o.today??t.today()??ce(r.brand?.timeZone),p=t.seenBy(e),m=p.schema,A=p.graph,C=Ve(r,o.views?{views:o.views}:{}),R=typeof n=="string"?n.trim():n.slug,F=typeof n=="string"?C.find(l=>l.slug===R||l.title===R||l.address===R):C.find(l=>l.slug===n.slug&&l.kind===n.kind)??n,x=!F&&typeof n=="string"?A.getNode(R):void 0,G=!F&&!x?/^\/?forms\/(.+)$/.exec(R)?.[1]:void 0,V=G!==void 0?Ge(r,G):void 0;if(V)return{ok:!0,description:it(m,V,a)};if(!F&&!x)return{ok:!1,error:`"${R}" is not a place this app has, nor a record this seat can see.`,places:[...C.map(l=>l.slug),...Object.keys(r.forms??{}).map(l=>`forms/${l}`)]};let c=[],w=r.viewSpecs??{},S=st(a),k=(l,h)=>oe(p,null,l,{app:r,today:s,...h}),f=(l,h,M)=>{let d=m.tryDefinition(l.kind),g=W(d,l);if(h==="name")return{id:l.id,kind:l.kind,title:g,parts:[]};if(w[l.kind]?.[h]){let I=k(l,{slot:h}),[B,...O]=I,y=B?.t==="title"||h==="row"&&B?.t==="headline";return{id:l.id,kind:l.kind,title:y?B.text:g,parts:j(y?O:I,M,`views.${l.kind}.${h}`,` (${l.id})`,y?1:0)}}if(h==="row")return{id:l.id,kind:l.kind,title:g,parts:[]};let u=d?.computed?ne(m,A,l):l,T=z(u,d,{limit:3,said:[g],glance:!0,locale:r.brand?.locale,timeZone:r.brand?.timeZone});return{id:l.id,kind:l.kind,title:g,parts:T.map(I=>({t:"text",text:I.alone}))}};function j(l,h,M,d="",g=0){let $=[];return l.forEach((u,T)=>{let I=`${M}.${T+g}`;switch("problem"in u&&u.problem&&c.push({at:`${I}${d}`,says:u.problem}),u.t){case"title":$.push({t:"heading",level:3,text:u.text});return;case"text":$.push({t:"text",text:u.markdown?Pe(u.text):u.runs?ct(u.runs):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":$.push({t:"badge",text:u.text});return;case"field":case"image":$.push({t:"field",label:u.label,text:u.text});return;case"progress":$.push({t:"progress",label:u.label,text:u.text});return;case"group":$.push(...j(u.blocks,h,`${I}.group`,d));return;case"when":$.push(...j(u.blocks,h,`${I}.show`,d));return;case"divider":case"figure":return;case"headline":$.push({t:"heading",level:u.level,text:u.text});return;case"number":$.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){$.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&$.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let B=h+1,O=B>rt?"name":u.as,y=(u.groups??[{value:null,members:u.members}]).map(D=>({..."heading"in D&&D.heading?{heading:D.heading,count:(u.everyGroup?.find(Y=>Y.value===D.value)??D).members.length}:{},items:D.members.map(Y=>f(Y,O,B))}));$.push({t:"list",as:O,columns:O==="card"?S:1,groups:y,...u.more>0?{more:u.more}:{}});return}}}),$}let i=[],v,b,P,N=[];if(x){b="record";let l=m.tryDefinition(x.kind),h=W(l,x);P={slug:x.id,title:h,kind:x.kind,address:xe(m,x.kind,x.id)};let M=w[x.kind]?.page,d=o.views?.find(g=>g.attach===x.kind&&g.cardinality==="one");if(d&&i.push({t:"view",name:d.name,...d.title?{title:d.title}:{},...d.replaces==="page"?{replaces:!0}:{},...d.parts?{parts:d.parts}:{}}),d?.replaces==="page")b=`view:${d.name}`,c.push(..._e(r,[d]));else{M&&i.push(...j(k(x,{slot:"page"}),1,`views.${x.kind}.page`));let g=l?.computed?ne(m,A,x):x;for(let $ of Ce(l,z(g,l,{said:[h],locale:r.brand?.locale,timeZone:r.brand?.timeZone}))){$.title&&i.push({t:"heading",level:2,text:$.title});for(let u of $.fields)i.push({t:"field",label:u.label,text:u.value,...u.long?{long:!0}:{},...u.markdown?{markdown:!0}:{}})}}}else{let l=F;P={slug:l.slug,title:l.title,kind:l.kind,address:l.address};let h=l.lens?Se(r).drawn.find(d=>d.as===l.slug&&(l.kind===null||d.kinds.includes(l.kind))):void 0,M=l.kind!==null&&l.view===void 0&&!h?o.views?.find(d=>d.attach===l.kind&&d.cardinality==="many"&&d.replaces==="page"&&!d.hidden):void 0;if(l.kind!==null&&h?.create!==!1&&l.view===void 0&&!M&&(N=Ze(t,e,l.kind).map(d=>Ee(t,e,d))),l.view!==void 0&&!h){let d=o.views?.find(g=>g.name===l.view);b=`view:${l.view}`,i.push({t:"view",name:l.view,title:d?.title??l.title,...typeof d?.flows=="boolean"?{flows:d.flows}:{},...d?.parts?{parts:d.parts}:{}})}else if(l.kind===null){let d=r.brand,g=d?.name??r.name,$=$e(d)?.light,u=$&&be($)?$:void 0;if(v={name:g,...d?.subtitle&&d.subtitleDrawn!==!1?{subtitle:d.subtitle}:{},...u?{logo:{alt:d?.logoAlt??g,...we(u)?{drawn:"inline SVG"}:{drawn:"image",src:u}}}:{}},r.home)b="blocks",i=j(k(null,{}),0,"views.home");else{b="derived";let T=t.kindsKeptFrom(e),I=new Set([...r.pages?.hide??[],...T,...t.modules.disabledKinds]),B=De(m.kinds,r.pages?.order).filter(O=>!I.has(O));i.push({t:"heading",level:1,text:r.name??"Home"});for(let O of B){let y=A.nodesOfKind(O).filter(D=>H(m.tryDefinition(O),D)).length;y>0&&i.push({t:"text",text:`${y} ${L(m,O,y)}`})}}}else if(h?.lens==="blocks")b="lens:blocks",i=j(k(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){b="lens:columns";let d=h.options.bindings??{};for(let g of Object.keys(d)){let $=d[g]?.column;if(!$)continue;let u=E(m,g,$),T=Z(A.nodesOfKind(g).filter(y=>H(m.tryDefinition(g),y)),h.options.sort,(y,D)=>D==="label"?W(m.tryDefinition(y.kind),y):y[D]);Object.keys(d).length>1&&i.push({t:"heading",level:2,text:L(m,g,2).replace(/^./,y=>y.toUpperCase())}),i.push({t:"text",text:`${T.length} ${L(m,g,T.length)} in columns by ${fe(m.tryDefinition(g),$).toLowerCase()}.`});let I=u.map(y=>({column:y,items:T.filter(D=>q(D,$,u)===y.value).map(D=>f(D,"card",1))})).filter(({column:y,items:D})=>y.value!==null||D.length>0).map(({column:y,items:D})=>({heading:`${y.label} (${D.length})`,items:D}));i.push({t:"list",as:"card",columns:1,groups:I});let B=new Map;for(let y of T)for(let D of re(t,e,y,$,u))B.set(D.to,(B.get(D.to)??new Set).add(`"${D.title}"`));let O=u.filter(y=>y.value!==null&&B.has(y.value)).map(y=>`to ${y.label} by ${[...B.get(y.value)].join(" or ")}`);i.push({t:"text",text:O.length>0?`Moves: ${O.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")b="lens:coverage",i=He(m,A,h.options);else if(h){b=`lens:${h.lens}`;let d=h.kinds.flatMap(g=>A.nodesOfKind(g).filter($=>H(m.tryDefinition(g),$)));i.push({t:"text",text:`A ${h.lens} of ${d.length} ${h.kinds.map(g=>L(m,g,d.length)).join(" and ")}.`}),i.push({t:"list",as:"name",columns:1,groups:[{items:d.map(g=>f(g,"name",1))}]})}else if(M)b=`view:${M.name}`,i.push({t:"heading",level:1,text:l.title}),i.push({t:"view",name:M.name,...M.title?{title:M.title}:{},replaces:!0,...M.parts?{parts:M.parts}:{}});else{b="derived";let d=A.nodesOfKind(l.kind).filter(g=>H(m.tryDefinition(l.kind),g));i.push({t:"heading",level:1,text:l.title}),d.length===0?i.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${L(m,l.kind,0)} yet.`}):i.push({t:"list",as:"row",columns:1,groups:[{items:d.map(g=>f(g,"row",1))}]})}}let K=e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,Xe=a<qe?"phone":"wide",ae=P.kind===null?at(m,A):[],le={...v?{masthead:v}:{},...ae.length>0?{facts:ae}:{},place:P,seat:K,width:a,variant:Xe,drawnBy:b,parts:i,...N.length>0?{forms:N}:{},problems:c};return{ok:!0,description:{...le,text:ie(le)}}}function it(t,e,n){let o=[{t:"heading",level:1,text:e.title},...e.intro?[{t:"text",text:e.intro}]:[]],r={place:{slug:`forms/${e.name}`,title:e.title,kind:null,address:`/forms/${e.name}`},seat:`a visitor (${e.role})`,width:n,variant:n<qe?"phone":"wide",drawnBy:"form",parts:o,forms:[Le(t,e)],problems:[]};return{...r,text:ie(r)}}function at(t,e){let n=Me(t,e,null),o=r=>Array.isArray(r)?r.map(o).join(", "):r===null?"nothing":typeof r=="boolean"?r?"yes":"no":typeof r=="object"?r.label:String(r);return[...Ae(t)].map(([r,a])=>{let s=a.label??U(r);return Object.hasOwn(n.values,r)?{name:r,label:s,value:o(n.values[r])}:{name:r,label:s,refused:n.refused[r]??"it could not be worked out"}})}function L(t,e,n){let o=t.tryDefinition(e);if(n===1)return o?.noun??e;let r=pe(t,e);return de(r)}function ie(t){let e=[`${t.place.title} (${t.place.address}) \u2014 as ${t.seat}, ${t.width} wide (${t.variant}).`],n=t.masthead;n&&e.push(`Masthead: ${n.logo?`the logo ("${n.logo.alt}", ${n.logo.drawn==="image"?n.logo.src:"inline SVG"}), `:""}${n.name}${n.subtitle?` \u2014 ${n.subtitle}`:""}`);let o=(r,a)=>{for(let s of r)switch(s.t){case"heading":e.push(`${a}${"#".repeat(s.level)} ${s.text}`);break;case"text":e.push(`${a}${s.text}`);break;case"badge":e.push(`${a}[${s.text}]`);break;case"field":case"progress":e.push(`${a}${s.label}: ${s.text}`);break;case"figure":e.push(`${a}${s.text}${s.label?` \u2014 ${s.label}`:""}`);break;case"list":if(s.groups.length===0){s.empty&&e.push(`${a}(${s.empty})`);break}for(let p of s.groups){p.heading&&e.push(`${a}${p.heading}${p.count!==void 0?` (${p.count})`:""}:`);for(let m of p.items)e.push(`${a}${p.heading?" ":""}- ${m.title}`),o(m.parts,`${a}${p.heading?" ":" "}`)}s.as==="card"&&s.columns>1&&e.push(`${a}(cards, ${s.columns} across)`),s.more&&e.push(`${a}and ${s.more} more`);break;case"view":e.push(`${a}[the view "${s.title??s.name}"${s.replaces?", in place of the page":""}${s.flows===!0?", flowing with the page":s.flows===!1?", in a frame of its own":""}]`),s.parts&&o(s.parts,`${a} `);break}};o(t.parts,"");for(let r of t.forms??[])e.push(...ze(r));if(t.facts){e.push("Facts of the whole graph (what fact('<name>') reads):");for(let r of t.facts)e.push(`- ${r.label} (${r.name}): ${r.value??`not worked out \u2014 ${r.refused}`}`)}if(t.videos&&t.videos.length>0){e.push("Videos:");for(let r of t.videos)e.push(`- ${lt(r)}`)}if(t.problems.length>0){e.push("Problems:");for(let r of t.problems)e.push(`- ${r.at}: ${r.says}`)}return e.join(`
|
|
2
2
|
`)}function lt(t){let e=t.autoplay?"plays as a background, muted and looping, with no controls":"plays with the browser's controls";return`${t.text} (${t.field} of ${t.record}): ${t.source}${t.duration!==void 0?`, ${Math.round(t.duration)} s`:""}, ${t.poster?"with a poster":"no poster"}; ${e}${t.cover?", filling its box":""}; ${t.playable?"playable":`not playable: ${t.why??"it is not a video a browser plays"}`}.`}function ct(t){return t.map((e,n)=>(n===0?"":e.field===void 0&&t[n-1].field===void 0?" \xB7 ":" ")+e.text).join("")}export{E as a,q as b,re as c,Ne as d,Ke as e,Te as f,We as g,oe as h,_e as i,ot as j,ie as k};
|