graview 0.1.62 → 0.1.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/preview/{chunk.THVC2BEC.js → chunk.24HNOLUS.js} +1 -1
- package/dist/preview/chunk.25CQCCLN.js +1 -0
- package/dist/preview/{chunk.YP2QSPXU.js → chunk.26H33GJC.js} +1 -1
- package/dist/preview/{chunk.DPEIT3TW.js → chunk.2F4AZZQR.js} +1 -1
- package/dist/preview/chunk.2KIWGQXC.js +2 -0
- package/dist/preview/{chunk.UQQKDBIH.js → chunk.2PJ6STKA.js} +1 -1
- package/dist/preview/{chunk.ELTV44HU.js → chunk.2RASWDMQ.js} +2 -2
- package/dist/preview/chunk.33XNYHI6.js +1 -0
- package/dist/preview/{chunk.TIALD6SC.js → chunk.34DRUCH2.js} +1 -1
- package/dist/preview/{chunk.MDEX6ZVE.js → chunk.36OE6RKG.js} +1 -1
- package/dist/preview/{chunk.A3OL2BI2.js → chunk.37FLKAVZ.js} +1 -1
- package/dist/preview/chunk.3JCHJLH6.js +1 -0
- package/dist/preview/chunk.3OQ6S6H4.js +1 -0
- package/dist/preview/chunk.47QEWSSE.js +1 -0
- package/dist/preview/{chunk.7M4HNKDR.js → chunk.4DAKQXDG.js} +1 -1
- package/dist/preview/{chunk.QIPASE42.js → chunk.4EXC26LI.js} +1 -1
- package/dist/preview/{chunk.VJBBVLGZ.js → chunk.4MEQUUG4.js} +1 -1
- package/dist/preview/{chunk.Y2YYH3JN.js → chunk.4TH3CGAZ.js} +1 -1
- package/dist/preview/{chunk.PZQNR4KZ.js → chunk.57YDGGJK.js} +1 -1
- package/dist/preview/{chunk.O75HWF3F.js → chunk.5GC4VAHU.js} +1 -1
- package/dist/preview/{chunk.WEOVK2T4.js → chunk.5QXQ7PBI.js} +1 -1
- package/dist/preview/chunk.6CSHRMJC.js +1 -0
- package/dist/preview/chunk.6HKWAHPT.js +1 -0
- package/dist/preview/{chunk.TM4EPUNO.js → chunk.6XHPBJ5F.js} +1 -1
- package/dist/preview/chunk.6YK5E7ZQ.js +4 -0
- package/dist/preview/{chunk.LGRLVJGS.js → chunk.6Z2GHQQH.js} +3 -3
- package/dist/preview/chunk.72YXFJKC.js +2 -0
- package/dist/preview/{chunk.T3UQ7ZQK.js → chunk.735AFUP5.js} +1 -1
- package/dist/preview/chunk.75GENXGP.js +1 -0
- package/dist/preview/{chunk.KMV6PJFL.js → chunk.A2R53GWF.js} +1 -1
- package/dist/preview/{chunk.OWT3VVOT.js → chunk.AHPYNDVA.js} +2 -2
- package/dist/preview/chunk.ATDIDPKZ.js +1 -0
- package/dist/preview/{chunk.F7YXLYLX.js → chunk.AW26EETU.js} +1 -1
- package/dist/preview/{chunk.I77ZGIFE.js → chunk.AWUO3M5D.js} +1 -1
- package/dist/preview/{chunk.AQRB7LDA.js → chunk.B46UZHGW.js} +1 -1
- package/dist/preview/{chunk.A3ZC2JBO.js → chunk.B5PJCYBU.js} +1 -1
- package/dist/preview/{chunk.VACKSKGJ.js → chunk.BF3EZCG3.js} +1 -1
- package/dist/preview/chunk.BKQICGFW.js +1 -0
- package/dist/preview/{chunk.DDUCIUVW.js → chunk.BN7C5ZYX.js} +1 -1
- package/dist/preview/chunk.BQM3YAMR.js +35 -0
- package/dist/preview/chunk.C65EHQ7V.js +1 -0
- package/dist/preview/{chunk.B23WZQXQ.js → chunk.CAXILB7K.js} +1 -1
- package/dist/preview/{chunk.UVA7AALY.js → chunk.CCQMDZHO.js} +1 -1
- package/dist/preview/{chunk.G4ULQK64.js → chunk.CGK2PY76.js} +1 -1
- package/dist/preview/{chunk.DEAP3H2L.js → chunk.CI4RZL4Z.js} +1 -1
- package/dist/preview/chunk.CYTTZOYL.js +25 -0
- package/dist/preview/chunk.D5LOTCBU.js +3 -0
- package/dist/preview/chunk.DBFJVVWF.js +1 -0
- package/dist/preview/{chunk.7XLS6XTY.js → chunk.DDFRFSVN.js} +1 -1
- package/dist/preview/{chunk.GX4G4BX3.js → chunk.DIFIHNR3.js} +1 -1
- package/dist/preview/{chunk.VN23AGIY.js → chunk.DWK3GXRR.js} +1 -1
- package/dist/preview/{chunk.ZN3PUM2I.js → chunk.DZSZUX34.js} +1 -1
- package/dist/preview/chunk.E3XJMO7Q.js +1 -0
- package/dist/preview/chunk.EJ2WE764.js +18 -0
- package/dist/preview/{chunk.22BZU7ME.js → chunk.EJ4MSVX2.js} +1 -1
- package/dist/preview/chunk.ERPILTRY.js +1 -0
- package/dist/preview/{chunk.DC35FJAB.js → chunk.FFXBDOKA.js} +1 -1
- package/dist/preview/{chunk.UXMPFPFH.js → chunk.FGDGTES4.js} +2 -2
- package/dist/preview/chunk.FNVGNISQ.js +3 -0
- package/dist/preview/{chunk.ROZTJ6IY.js → chunk.FXCQJPN4.js} +1 -1
- package/dist/preview/chunk.G2JAYG2Z.js +1 -0
- package/dist/preview/{chunk.UFDJXQQQ.js → chunk.GHN62OMG.js} +6 -6
- package/dist/preview/{chunk.5ODHHH35.js → chunk.H5SN46VK.js} +1 -1
- package/dist/preview/{chunk.W4BKYSZX.js → chunk.H7AH3IW4.js} +1 -1
- package/dist/preview/{chunk.6JO5HQDR.js → chunk.HMMK7LCL.js} +1 -1
- package/dist/preview/{chunk.SVPKUWZU.js → chunk.HOFATBGD.js} +1 -1
- package/dist/preview/{chunk.JT3MFPRD.js → chunk.HRNNRA2I.js} +1 -1
- package/dist/preview/{chunk.7KVUUEZA.js → chunk.HSMJHCR3.js} +1 -1
- package/dist/preview/{chunk.RPDH32XV.js → chunk.IEDCFSN5.js} +1 -1
- package/dist/preview/{chunk.PCDUV3WP.js → chunk.JIEDJEHK.js} +1 -1
- package/dist/preview/chunk.JNIDS66Z.js +1 -0
- package/dist/preview/{chunk.DDO3GLEJ.js → chunk.JO3BBRSR.js} +1 -1
- package/dist/preview/{chunk.H5S7OL2U.js → chunk.JVDPRQ7J.js} +1 -1
- package/dist/preview/{chunk.SEHRPTNA.js → chunk.K7TK3KRB.js} +1 -1
- package/dist/preview/{chunk.ELOFPE25.js → chunk.KB5BCW23.js} +1 -1
- package/dist/preview/{chunk.6AKW7TXM.js → chunk.KL5H7KEV.js} +1 -1
- package/dist/preview/{chunk.ILIIBSGA.js → chunk.KPQLM4TM.js} +1 -1
- package/dist/preview/{chunk.2N4Z5K5S.js → chunk.KQPKYWDM.js} +1 -1
- package/dist/preview/{chunk.QHY5NVYH.js → chunk.KXFNRJ46.js} +1 -1
- package/dist/preview/chunk.KZUMXT5J.js +74 -0
- package/dist/preview/chunk.MAHNJO6U.js +1 -0
- package/dist/preview/{chunk.AJSUHPBE.js → chunk.MBB5A6BT.js} +1 -1
- package/dist/preview/chunk.MENLUNM5.js +1 -0
- package/dist/preview/{chunk.PLTH2LW5.js → chunk.MIE3ODQ2.js} +1 -1
- package/dist/preview/{chunk.QDWSU47A.js → chunk.MT5DXJKN.js} +1 -1
- package/dist/preview/{chunk.AFNSAQEQ.js → chunk.MY5HJW2Z.js} +1 -1
- package/dist/preview/{chunk.5HGD6OWL.js → chunk.N3T2O6EW.js} +2 -2
- package/dist/preview/{chunk.66P5IDTH.js → chunk.NEPQBMFT.js} +1 -1
- package/dist/preview/{chunk.NOGGSLVG.js → chunk.NIAM7OTV.js} +1 -1
- package/dist/preview/{chunk.BZMQDEIY.js → chunk.NTC2H5ZX.js} +1 -1
- package/dist/preview/chunk.NWWJNNEK.js +2 -0
- package/dist/preview/{chunk.5J3O2FVG.js → chunk.O3YIWIVQ.js} +1 -1
- package/dist/preview/chunk.O67JXUVG.js +1 -0
- package/dist/preview/{chunk.4HEFUOLV.js → chunk.OIMGD7FR.js} +1 -1
- package/dist/preview/{chunk.DD2NKFDX.js → chunk.OM2NIQWA.js} +1 -1
- package/dist/preview/chunk.OMRQTLI5.js +1 -0
- package/dist/preview/{chunk.O2BHPYA4.js → chunk.OTSBF367.js} +2 -2
- package/dist/preview/{chunk.Y4FZKUOK.js → chunk.OXWOUE3W.js} +1 -1
- package/dist/preview/{chunk.2B6P4GPS.js → chunk.PDMX3GTL.js} +1 -1
- package/dist/preview/{chunk.75GVFX7L.js → chunk.PDS4HT46.js} +1 -1
- package/dist/preview/{chunk.EVBCEEQ4.js → chunk.PWAP2GJS.js} +1 -1
- package/dist/preview/chunk.Q2EGESEZ.js +1 -0
- package/dist/preview/{chunk.L3WTKQQL.js → chunk.Q4GJIJAU.js} +1 -1
- package/dist/preview/chunk.Q4MI53KK.js +5 -0
- package/dist/preview/{chunk.SWMDFXUX.js → chunk.QAMW5QDT.js} +1 -1
- package/dist/preview/{chunk.M4AYA2PL.js → chunk.QS32TO4N.js} +1 -1
- package/dist/preview/{chunk.BLUKSGI4.js → chunk.QSPLKCTX.js} +1 -1
- package/dist/preview/{chunk.WPXPVD33.js → chunk.R4HDKNT3.js} +1 -1
- package/dist/preview/chunk.REUMBCSV.js +1 -0
- package/dist/preview/{chunk.MAKODQO3.js → chunk.RUFYORIJ.js} +1 -1
- package/dist/preview/{chunk.5YAOKOGV.js → chunk.SGPXYDSG.js} +1 -1
- package/dist/preview/chunk.SJUXFPTI.js +1 -0
- package/dist/preview/{chunk.OUDATENL.js → chunk.SME4HD5I.js} +1 -1
- package/dist/preview/{chunk.2GEJNG2U.js → chunk.SMHP2CQH.js} +1 -1
- package/dist/preview/chunk.SSAETRHR.js +5 -0
- package/dist/preview/{chunk.MYNMBOLD.js → chunk.STDJ6XG5.js} +1 -1
- package/dist/preview/{chunk.IQ3PRWGO.js → chunk.T3JIZNE7.js} +2 -2
- package/dist/preview/chunk.T535ZLRM.js +1 -0
- package/dist/preview/{chunk.QGU5QTR6.js → chunk.UAVK54Z6.js} +1 -1
- package/dist/preview/{chunk.RD2X25XB.js → chunk.V4HVFLFQ.js} +1 -1
- package/dist/preview/chunk.V6IL7CIZ.js +1 -0
- package/dist/preview/{chunk.T6WHGKWR.js → chunk.VCTAFSZ5.js} +1 -1
- package/dist/preview/{chunk.OWOOKLIU.js → chunk.VZDHRY3U.js} +1 -1
- package/dist/preview/{chunk.X6KYRBL6.js → chunk.WBS7ND2C.js} +1 -1
- package/dist/preview/chunk.WNS5LEO5.js +1 -0
- package/dist/preview/chunk.WUVXIUA7.js +1 -0
- package/dist/preview/{chunk.Z2TDZSMN.js → chunk.WYPCLZL7.js} +1 -1
- package/dist/preview/{chunk.IQMD7DG3.js → chunk.XBYJCGPU.js} +1 -1
- package/dist/preview/{chunk.CHHYIMB7.js → chunk.XCEZCOX4.js} +1 -1
- package/dist/preview/{chunk.CY3ELWCM.js → chunk.XCWZFLIB.js} +1 -1
- package/dist/preview/chunk.XIW4SZHD.js +1 -0
- package/dist/preview/{chunk.FULEUL34.js → chunk.XUO67YMT.js} +1 -1
- package/dist/preview/{chunk.RYRQ66JN.js → chunk.XUXZW7DU.js} +1 -1
- package/dist/preview/chunk.XYGNS637.js +1 -0
- package/dist/preview/{chunk.H7N7WN4U.js → chunk.Y4ZM75WL.js} +1 -1
- package/dist/preview/{chunk.5STU3KYG.js → chunk.YOUB3J3Y.js} +1 -1
- package/dist/preview/{chunk.3FON2Y72.js → chunk.YXAKHXYB.js} +1 -1
- package/dist/preview/chunk.YZBJUAS6.js +1 -0
- package/dist/preview/{chunk.7V56P2A7.js → chunk.Z2ZQJ3DD.js} +1 -1
- package/dist/preview/{chunk.OFWNMTGB.js → chunk.ZELWW7UA.js} +2 -2
- package/dist/preview/{chunk.N6EJXXQK.js → chunk.ZLTHWCKL.js} +2 -2
- package/dist/preview/chunk.ZP7JEVVU.js +1 -0
- package/dist/preview/{chunk.NUWDMH47.js → chunk.ZRH5X3MR.js} +1 -1
- package/dist/preview/{chunk.DNVWSWL2.js → chunk.ZSGDVNVN.js} +1 -1
- package/dist/preview/chunk.ZVG4FXJK.js +1 -0
- package/dist/preview/chunk.ZY7US4Y7.js +6 -0
- package/dist/preview/{chunk.4TX6VCBT.js → chunk.ZZAI57VI.js} +1 -1
- package/dist/preview/index.html +53 -52
- package/dist/preview/page.js +2 -2
- package/dist/preview/splash.js +7 -6
- package/package.json +6 -6
- package/dist/preview/chunk.2AT3GRXM.js +0 -1
- package/dist/preview/chunk.4HRYB7HF.js +0 -1
- package/dist/preview/chunk.5MZYCELA.js +0 -6
- package/dist/preview/chunk.7OBIBPYH.js +0 -1
- package/dist/preview/chunk.7YOAW7ED.js +0 -1
- package/dist/preview/chunk.ACTXR2MI.js +0 -3
- package/dist/preview/chunk.AI34V6WV.js +0 -74
- package/dist/preview/chunk.CAKFNKN5.js +0 -1
- package/dist/preview/chunk.CGALLZ54.js +0 -1
- package/dist/preview/chunk.DHJ3FQTR.js +0 -1
- package/dist/preview/chunk.DZZL5IDD.js +0 -5
- package/dist/preview/chunk.H24OC6OE.js +0 -1
- package/dist/preview/chunk.H73ZPYUX.js +0 -1
- package/dist/preview/chunk.HANJZ6FA.js +0 -1
- package/dist/preview/chunk.HIMQ65QT.js +0 -1
- package/dist/preview/chunk.IQPILSV3.js +0 -18
- package/dist/preview/chunk.IYBEXENQ.js +0 -1
- package/dist/preview/chunk.J7Q2WAF4.js +0 -28
- package/dist/preview/chunk.JYFZCJ4N.js +0 -2
- package/dist/preview/chunk.KDXU5DT3.js +0 -1
- package/dist/preview/chunk.KL7E4YHJ.js +0 -1
- package/dist/preview/chunk.LAYQ5PFS.js +0 -1
- package/dist/preview/chunk.LTZUF5VG.js +0 -1
- package/dist/preview/chunk.M7RESZB6.js +0 -25
- package/dist/preview/chunk.MGALQLRW.js +0 -1
- package/dist/preview/chunk.NAD7ZXYP.js +0 -1
- package/dist/preview/chunk.NHTGAP3G.js +0 -3
- package/dist/preview/chunk.NUYA4BWI.js +0 -1
- package/dist/preview/chunk.OKZT2QBM.js +0 -2
- package/dist/preview/chunk.OUPURRDE.js +0 -1
- package/dist/preview/chunk.PD2DECOP.js +0 -1
- package/dist/preview/chunk.PKWQKFPE.js +0 -2
- package/dist/preview/chunk.RMR24LFJ.js +0 -4
- package/dist/preview/chunk.RRKI24WY.js +0 -1
- package/dist/preview/chunk.SGCW2XRC.js +0 -1
- package/dist/preview/chunk.SS7234R6.js +0 -1
- package/dist/preview/chunk.TKUNRFDE.js +0 -1
- package/dist/preview/chunk.U6ZRJKVM.js +0 -1
- package/dist/preview/chunk.UKQUUPKE.js +0 -1
- package/dist/preview/chunk.VC3V7HLL.js +0 -1
- package/dist/preview/chunk.VIH5AX7S.js +0 -5
- package/dist/preview/chunk.WKI5INH7.js +0 -1
- package/dist/preview/chunk.Y4S7CDRB.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as K}from"./chunk.RPDH32XV.js";import{Ab as v,Hb as V,h as P,jc as Y,k as R,kc as X,nb as G,nc as B,q as I,ra as q,x as _,yc as $,zb as h,zc as N}from"./chunk.DZZL5IDD.js";import{a as T,c as C,h as L}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var te=Symbol.for("@graview/core:markdown"),ne=500;function ie(e){let n=e;for(let i=0;i<6;i++){let t=N(n);if(!t)return!1;if(t[$]!==void 0)return t[$]===1;if(t[te]===1)return!0;if(t.type==="string")return(t.checks??[]).some(s=>{let f=N(s);return f?.check==="max_length"&&(f.maximum??0)>ne});if(t.innerType===void 0)return!1;n=t.innerType}return!1}function O(e,n,i){if(n===void 0||i==="id"||i==="kind")return!1;let t=e.tryDefinition(n)?.fields?.shape;return!!t&&Object.prototype.hasOwnProperty.call(t,i)&&ie(t[i])}var re=e=>e>=55296&&e<=56319,oe=e=>e>=56320&&e<=57343;function S(e,n){let i=Math.min(e.length,n.length),t=0;for(;t<i&&e.charCodeAt(t)===n.charCodeAt(t);)t++;t>0&&re(e.charCodeAt(t-1))&&t--;let s=0;for(;s<i-t&&e.charCodeAt(e.length-1-s)===n.charCodeAt(n.length-1-s);)s++;return s>0&&oe(e.charCodeAt(e.length-s))&&s--,{at:t,removed:e.slice(t,e.length-s),inserted:n.slice(t,n.length-s)}}var w=e=>e.at+e.removed.length;function H(e){let n=S(e.removed,e.inserted);return{...n,at:e.at+n.at}}function U(e,n,i){if(w(e)<n.at)return e;if(e.at>w(n))return{...e,at:e.at+n.inserted.length-n.removed.length};let t=Math.min(e.at,n.at),s=w(e)-w(n),f=e.removed.slice(0,n.at-t)+n.inserted+(s>0?e.removed.slice(e.removed.length-s):""),r=n.at<e.at||n.at===e.at&&i;return H({at:t,removed:f,inserted:r?n.inserted+e.inserted:e.inserted+n.inserted})}function b(e,n){return[U(e,n,!1),U(n,e,!0)]}function D(e,n){let i=e.at+e.inserted.length;if(w(n)<e.at||n.at>i)return;let t=Math.min(e.at,n.at),s=w(n)-i,f=n.removed.slice(0,e.at-t),r=s>0?n.removed.slice(n.removed.length-s):"",l=T(f+e.inserted+r,{...n,at:n.at-t});return H({at:t,removed:f+e.removed+r,inserted:l})}function M(e,n,i){switch(e.op){case"patch-node":return e.id===n&&Object.prototype.hasOwnProperty.call(e.after,i);case"add-node":case"remove-node":return e.node.id===n;default:return!1}}function j(e,n,i){if(e.op!=="patch-node"||e.id!==n||!Object.prototype.hasOwnProperty.call(e.after,i))return;let t=e.before[i],s=e.after[i];return typeof s=="string"&&(t===void 0||t===""||C(t))?{at:0,removed:"",inserted:s}:void 0}var J=(e,n,i)=>e.flatMap(t=>t.op==="splice-text"&&t.id===n&&t.field===i?[t]:[]);function E(e,n,i,t,s,f){if(typeof f!="string"||s<n-1)return;let r=[];for(let o of e)if(!(o.seq<=s))for(let p of o.primitives){let a=j(p,i,t);if(a){r.push(a);continue}if(M(p,i,t))return;p.op==="splice-text"&&p.id===i&&p.field===t&&r.push(p)}let l=f;try{for(let o=r.length-1;o>=0;o--){let p=r[o];l=T(l,{at:p.at,removed:p.inserted,inserted:p.removed})}}catch{return}return{then:l,since:r}}function A(e,n){let i=e;for(let t of n)i=b(t,i)[1];return{at:i.at,removed:i.removed,inserted:i.inserted}}function Q(e,n,i){let t=i?A(S(i.then,n),i.since):S(e,n);return t.removed===""&&t.inserted===""?void 0:t}function Z(e){let n=e.schema,i=t=>{throw new V(t,"invalid")};return{name:h,title:"Type text",input:I({node:P(),field:P(),at:R(),remove:R(),insert:P(),rev:_(R())}),subject:{kinds:"*",arg:"node"},writes:[],describe:(t,s)=>{let{node:f,field:r,insert:l,remove:o}=t;return K({node:f,field:r,inserted:[...String(l??"")].length,removed:Number(o)||0},n,s)},apply(t,s){let{node:f,field:r,at:l,remove:o,insert:p,rev:a}=s;(![l,o,a??0].every(k=>Number.isInteger(k)&&k>=-1)||l<0||o<0)&&i("at and remove are whole numbers, none below 0, and rev a revision");let d=t.graph.getNode(f);if(!d)throw new G(f,"\u201CType text\u201D names a record that is not there.");if(O(n,d.kind,r)||i(`${q(n.tryDefinition(d.kind),d.kind)}'s "${r}" is not text typed together: write it whole, as its edit does`),o===0&&p==="")return;let c=d[r];if(typeof c!="string"||c===""){t.patchNode(f,{[r]:p});return}let g=e.graph.getNode(f)?.[r],m=a===void 0?{then:c,since:[]}:E(e.log.all(),e.log.horizon,f,r,Math.max(a,-1),g);m||i(`${r} was written whole since revision ${a}: read it again and type over what it holds now`);let{then:u,since:y}=m;l+o>u.length&&i(`${r} held ${u.length} characters at revision ${a??"now"}, so there is nothing at ${l}${o>0?`\u2013${l+o}`:""} to type over`);let x=A({at:l,removed:u.slice(l,l+o),inserted:p},y);x.removed===""&&x.inserted===""||t.emit({op:"splice-text",id:f,field:r,...x})}}}function ee(e,n,i,t,s=()=>!0){let f=i===void 0?void 0:e.tryDefinition(i);if(!f||typeof t!="string")return[];let r=new Set;for(let l of n)if(!(l.name===h||!Y(e,l).includes(i)||!X(l,f).includes(t))&&s(l)){r.add(l.name);for(let o of B(e,n,l)??[])r.add(o)}return[...r]}function se(e,n,i){if(!n.some(r=>r.op==="patch-node"))return[...n];let t=new Set,s=new Set,f=[];for(let r of n){if(r.op==="add-node"&&t.add(r.node.id),r.op!=="patch-node"||t.has(r.id)){r.op==="splice-text"&&s.add(`${r.id}\0${r.field}`),f.push(r);continue}let l=e.graph.getNode(r.id),o={},p={},a=[];for(let[d,c]of Object.entries(r.after)){let g=l?.[d],m=`${r.id}\0${d}`;if(typeof c=="string"&&typeof g=="string"&&g!==""&&!s.has(m)&&O(e.schema,l?.kind,d)){let u=i?.find(x=>x.node===r.id&&x.field===d),y=Q(g,c,u?E(e.log.all(),e.log.horizon,r.id,d,u.rev,g):void 0);if(y){a.push({op:"splice-text",id:r.id,field:d,...y}),s.add(m);continue}}o[d]=r.before[d],p[d]=c,s.add(m)}Object.keys(p).length>0&&f.push(a.length>0?{op:"patch-node",id:r.id,before:o,after:p}:r),f.push(...a)}return f}function de(e,n){let i=[];return[...n].sort((t,s)=>s.seq-t.seq).map(t=>{let s=L(t);if(!s.some(o=>o.op==="splice-text"))return i.push(...s),{op:t,primitives:s};let f=e.filter(o=>o.seq>t.seq).flatMap(o=>o.primitives),r=t.primitives.length,l=[];return s.forEach((o,p)=>{if(o.op!=="splice-text")return void l.push(o);let a=A(o,J([...t.primitives.slice(r-p),...f,...i,...l],o.id,o.field));(a.removed!==""||a.inserted!=="")&&l.push({op:"splice-text",id:o.id,field:o.field,...a})}),i.push(...l),{op:t,primitives:l}})}function ae(e,n){let i=(t,s)=>e.some(f=>M(f,t,s));return n.undoes!==void 0&&n.primitives.length===0&&e.some(t=>t.op==="splice-text")||n.primitives.length>0&&n.primitives.every(t=>t.op==="splice-text"&&!i(t.id,t.field))?!0:e.flatMap(t=>t.op==="splice-text"&&n.primitives.some(s=>M(s,t.id,t.field))?[t.id]:[])}function le(e,n,i){let t=new Map,s=[],f=new Set;for(let a of e){let d=a.primitives[0],c=a.mutation?.args,g=a.mutation?.name!==h||a.primitives.length!==1||!d?void 0:d.op==="splice-text"?d:j(d,String(c?.node),String(c?.field));g?s.push({batch:a.batch,node:String(c?.node),field:String(c?.field),splice:g}):f.add(a.batch)}if(s.length===0)return t;let r=a=>`${a.node}\0${a.field}`,l=new Set,o=new Set(e.map(a=>a.batch).filter(a=>!i.includes(a))),p=s;for(let a of n){if(o.has(a.batch)){p=p.filter(d=>d.batch!==a.batch);continue}for(let d of a.primitives){if(d.op==="add-edge"||d.op==="remove-edge")continue;let c=d.op==="add-node"||d.op==="remove-node"?d.node.id:d.id;for(let g of new Set(p.filter(m=>m.node===c).map(m=>m.field))){let m=d.op==="splice-text"?d.field===g?d:void 0:j(d,c,g);for(let u of p)u.node!==c||u.field!==g||(m?[m,u.splice]=b(m,u.splice):M(d,u.node,u.field)&&l.add(r(u)))}}}p.forEach((a,d)=>{if(!o.has(a.batch))return;let c={at:a.splice.at,removed:a.splice.inserted,inserted:a.splice.removed};for(let g of p.slice(d+1))r(g)===r(a)&&([c,g.splice]=b(c,g.splice))});for(let a of i){let d=p.filter(c=>c.batch===a);d.length===0||f.has(a)||d.some(c=>l.has(r(c)))||t.set(a,d.map(c=>({name:h,args:{node:c.node,field:c.field,at:c.splice.at,remove:c.splice.removed.length,insert:c.splice.inserted}})))}return t}v.typeText=Z;v.via=ee;v.collaborative=O;v.asSplices=se;v.undone=de;v.aside=ae;v.carried=le;function Ye(e){let{store:n,author:i,pending:t,provisional:s,asked:f}=e,r=new Map,l=(o,p)=>{r.get(o)?.(p),r.delete(o)};return{store:n,apply:(o,p)=>e.appliedAll(o,{...i?{author:i}:{},...p!==void 0?{batch:p}:{}}),hold(o){t.push(o),s.add(o),e.answers.set(o,new Promise(p=>r.set(o,p)))},ask:(o,p)=>void f.set(o,{calls:p}),send(o,p){f.set(o,{calls:p});let a=e.sent(o,p),d=()=>l(o,a);return a.then(c=>{Array.isArray(c?.ops)&&c.ops.length===0&&e.letGo.add(o),d()},d),a},drop(o){e.letGo.add(o),e.settle(o),f.delete(o),e.land([],[o]),l(o)},seen:e.seen,gone:e.gone,ahead(o,p,a){let d=t.indexOf(o),c=n.log.all(),g=m=>c.some(u=>u.batch===m&&u.primitives.some(y=>y.op==="splice-text"&&y.id===p&&y.field===a||y.op==="patch-node"&&y.id===p&&a in y.after));return t.slice(0,Math.max(0,d)).flatMap(m=>{let u=e.answers.get(m);return u&&g(m)?[{batch:m,answer:u}]:[]})}}}var ce=400,pe=/[\s.,;:!?)\]}]$/u,W=e=>typeof e=="string"?e:"";function z(e,n,i,t){let s=e.log.all(),f=s.findIndex(o=>o.batch===n);if(f<0)return;let r=W(e.graph.getNode(i)?.[t]),l;for(let o=s.length-1;o>=f;o--){let p=s[o];p.batch===n&&l===void 0&&(l=r);for(let a=p.primitives.length-1;a>=0;a--){let d=p.primitives[a];d.op==="splice-text"&&d.id===i&&d.field===t?r=T(r,{at:d.at,removed:d.inserted,inserted:d.removed}):d.op==="patch-node"&&d.id===i&&t in d.after&&(r=C(d.before[t])?"":W(d.before[t]))}}if(!(l===void 0||l===r))return S(r,l)}function Xe(e,n,i){let t,s=[],f,r,l=!1,o=new Set,p=c=>({name:h,args:{node:e,field:n,at:c.at,remove:c.removed.length,insert:c.inserted,rev:i.seen()}}),a=()=>{r&&clearTimeout(r),r=void 0,t!==void 0&&s.push(t),t=void 0,d()},d=()=>{if(f!==void 0||l||i.gone())return;let c=s.shift();if(c===void 0)return;let g=i.ahead(c,e,n).filter(u=>!o.has(u.batch));if(g.length>0){s.unshift(c),l=!0,Promise.allSettled(g.map(u=>u.answer)).then(()=>{for(let u of g)o.add(u.batch);l=!1,d()});return}let m=z(i.store,c,e,n);if(!m)return i.drop(c),d();f=c,i.send(c,[p(m)]).finally(()=>{f=void 0,d()})};return{splice(c,g,m){if(i.gone())return;let u=W(i.store.graph.getNode(e)?.[n]),y={at:c,removed:u.slice(c,c+g),inserted:m};if(t!==void 0){let F=z(i.store,t,e,n);(!F||!D(F,y))&&a()}let x=i.apply([{name:h,args:{node:e,field:n,at:c,remove:g,insert:m}}],t);if(x.ops.length===0)return;t===void 0&&(t=x.batch,i.hold(t));let k=z(i.store,t,e,n);if(k&&i.ask(t,[p(k)]),pe.test(m))return a();r&&clearTimeout(r),r=setTimeout(a,ce),r.unref?.()},flush:a,waiting:()=>s.length+(t!==void 0?1:0)+(f!==void 0?1:0)}}function Be(e,n){let i=n.find(l=>l.name===h)?.args;if(typeof i?.node!="string"||typeof i.field!="string")return;let{node:t,field:s}=i,f=()=>e.graph.getNode(t)?.[s],r=f();return{node:t,field:s,yours:r,over:l=>{let o=f();return{name:h,args:{node:t,field:s,at:0,remove:typeof o=="string"?o.length:0,insert:typeof r=="string"?r:"",rev:l}}}}}export{ce as TYPING_IDLE_MS,z as runSplice,Xe as typingOf,Ye as wireOf,Be as yoursOf};
|
|
1
|
+
import{d as K}from"./chunk.IEDCFSN5.js";import{Eb as h,Fb as v,Gc as $,Hc as N,Mb as V,h as P,k as R,oc as Y,pb as G,pc as X,q as I,sc as B,ta as q,x as _}from"./chunk.Q4MI53KK.js";import{a as T,c as C,h as L}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var te=Symbol.for("@graview/core:markdown"),ne=500;function ie(e){let n=e;for(let i=0;i<6;i++){let t=N(n);if(!t)return!1;if(t[$]!==void 0)return t[$]===1;if(t[te]===1)return!0;if(t.type==="string")return(t.checks??[]).some(s=>{let f=N(s);return f?.check==="max_length"&&(f.maximum??0)>ne});if(t.innerType===void 0)return!1;n=t.innerType}return!1}function O(e,n,i){if(n===void 0||i==="id"||i==="kind")return!1;let t=e.tryDefinition(n)?.fields?.shape;return!!t&&Object.prototype.hasOwnProperty.call(t,i)&&ie(t[i])}var re=e=>e>=55296&&e<=56319,oe=e=>e>=56320&&e<=57343;function S(e,n){let i=Math.min(e.length,n.length),t=0;for(;t<i&&e.charCodeAt(t)===n.charCodeAt(t);)t++;t>0&&re(e.charCodeAt(t-1))&&t--;let s=0;for(;s<i-t&&e.charCodeAt(e.length-1-s)===n.charCodeAt(n.length-1-s);)s++;return s>0&&oe(e.charCodeAt(e.length-s))&&s--,{at:t,removed:e.slice(t,e.length-s),inserted:n.slice(t,n.length-s)}}var w=e=>e.at+e.removed.length;function H(e){let n=S(e.removed,e.inserted);return{...n,at:e.at+n.at}}function U(e,n,i){if(w(e)<n.at)return e;if(e.at>w(n))return{...e,at:e.at+n.inserted.length-n.removed.length};let t=Math.min(e.at,n.at),s=w(e)-w(n),f=e.removed.slice(0,n.at-t)+n.inserted+(s>0?e.removed.slice(e.removed.length-s):""),r=n.at<e.at||n.at===e.at&&i;return H({at:t,removed:f,inserted:r?n.inserted+e.inserted:e.inserted+n.inserted})}function b(e,n){return[U(e,n,!1),U(n,e,!0)]}function D(e,n){let i=e.at+e.inserted.length;if(w(n)<e.at||n.at>i)return;let t=Math.min(e.at,n.at),s=w(n)-i,f=n.removed.slice(0,e.at-t),r=s>0?n.removed.slice(n.removed.length-s):"",l=T(f+e.inserted+r,{...n,at:n.at-t});return H({at:t,removed:f+e.removed+r,inserted:l})}function M(e,n,i){switch(e.op){case"patch-node":return e.id===n&&Object.prototype.hasOwnProperty.call(e.after,i);case"add-node":case"remove-node":return e.node.id===n;default:return!1}}function j(e,n,i){if(e.op!=="patch-node"||e.id!==n||!Object.prototype.hasOwnProperty.call(e.after,i))return;let t=e.before[i],s=e.after[i];return typeof s=="string"&&(t===void 0||t===""||C(t))?{at:0,removed:"",inserted:s}:void 0}var J=(e,n,i)=>e.flatMap(t=>t.op==="splice-text"&&t.id===n&&t.field===i?[t]:[]);function E(e,n,i,t,s,f){if(typeof f!="string"||s<n-1)return;let r=[];for(let o of e)if(!(o.seq<=s))for(let p of o.primitives){let a=j(p,i,t);if(a){r.push(a);continue}if(M(p,i,t))return;p.op==="splice-text"&&p.id===i&&p.field===t&&r.push(p)}let l=f;try{for(let o=r.length-1;o>=0;o--){let p=r[o];l=T(l,{at:p.at,removed:p.inserted,inserted:p.removed})}}catch{return}return{then:l,since:r}}function A(e,n){let i=e;for(let t of n)i=b(t,i)[1];return{at:i.at,removed:i.removed,inserted:i.inserted}}function Q(e,n,i){let t=i?A(S(i.then,n),i.since):S(e,n);return t.removed===""&&t.inserted===""?void 0:t}function Z(e){let n=e.schema,i=t=>{throw new V(t,"invalid")};return{name:h,title:"Type text",input:I({node:P(),field:P(),at:R(),remove:R(),insert:P(),rev:_(R())}),subject:{kinds:"*",arg:"node"},writes:[],describe:(t,s)=>{let{node:f,field:r,insert:l,remove:o}=t;return K({node:f,field:r,inserted:[...String(l??"")].length,removed:Number(o)||0},n,s)},apply(t,s){let{node:f,field:r,at:l,remove:o,insert:p,rev:a}=s;(![l,o,a??0].every(k=>Number.isInteger(k)&&k>=-1)||l<0||o<0)&&i("at and remove are whole numbers, none below 0, and rev a revision");let d=t.graph.getNode(f);if(!d)throw new G(f,"\u201CType text\u201D names a record that is not there.");if(O(n,d.kind,r)||i(`${q(n.tryDefinition(d.kind),d.kind)}'s "${r}" is not text typed together: write it whole, as its edit does`),o===0&&p==="")return;let c=d[r];if(typeof c!="string"||c===""){t.patchNode(f,{[r]:p});return}let g=e.graph.getNode(f)?.[r],m=a===void 0?{then:c,since:[]}:E(e.log.all(),e.log.horizon,f,r,Math.max(a,-1),g);m||i(`${r} was written whole since revision ${a}: read it again and type over what it holds now`);let{then:u,since:y}=m;l+o>u.length&&i(`${r} held ${u.length} characters at revision ${a??"now"}, so there is nothing at ${l}${o>0?`\u2013${l+o}`:""} to type over`);let x=A({at:l,removed:u.slice(l,l+o),inserted:p},y);x.removed===""&&x.inserted===""||t.emit({op:"splice-text",id:f,field:r,...x})}}}function ee(e,n,i,t,s=()=>!0){let f=i===void 0?void 0:e.tryDefinition(i);if(!f||typeof t!="string")return[];let r=new Set;for(let l of n)if(!(l.name===h||!Y(e,l).includes(i)||!X(l,f).includes(t))&&s(l)){r.add(l.name);for(let o of B(e,n,l)??[])r.add(o)}return[...r]}function se(e,n,i){if(!n.some(r=>r.op==="patch-node"))return[...n];let t=new Set,s=new Set,f=[];for(let r of n){if(r.op==="add-node"&&t.add(r.node.id),r.op!=="patch-node"||t.has(r.id)){r.op==="splice-text"&&s.add(`${r.id}\0${r.field}`),f.push(r);continue}let l=e.graph.getNode(r.id),o={},p={},a=[];for(let[d,c]of Object.entries(r.after)){let g=l?.[d],m=`${r.id}\0${d}`;if(typeof c=="string"&&typeof g=="string"&&g!==""&&!s.has(m)&&O(e.schema,l?.kind,d)){let u=i?.find(x=>x.node===r.id&&x.field===d),y=Q(g,c,u?E(e.log.all(),e.log.horizon,r.id,d,u.rev,g):void 0);if(y){a.push({op:"splice-text",id:r.id,field:d,...y}),s.add(m);continue}}o[d]=r.before[d],p[d]=c,s.add(m)}Object.keys(p).length>0&&f.push(a.length>0?{op:"patch-node",id:r.id,before:o,after:p}:r),f.push(...a)}return f}function de(e,n){let i=[];return[...n].sort((t,s)=>s.seq-t.seq).map(t=>{let s=L(t);if(!s.some(o=>o.op==="splice-text"))return i.push(...s),{op:t,primitives:s};let f=e.filter(o=>o.seq>t.seq).flatMap(o=>o.primitives),r=t.primitives.length,l=[];return s.forEach((o,p)=>{if(o.op!=="splice-text")return void l.push(o);let a=A(o,J([...t.primitives.slice(r-p),...f,...i,...l],o.id,o.field));(a.removed!==""||a.inserted!=="")&&l.push({op:"splice-text",id:o.id,field:o.field,...a})}),i.push(...l),{op:t,primitives:l}})}function ae(e,n){let i=(t,s)=>e.some(f=>M(f,t,s));return n.undoes!==void 0&&n.primitives.length===0&&e.some(t=>t.op==="splice-text")||n.primitives.length>0&&n.primitives.every(t=>t.op==="splice-text"&&!i(t.id,t.field))?!0:e.flatMap(t=>t.op==="splice-text"&&n.primitives.some(s=>M(s,t.id,t.field))?[t.id]:[])}function le(e,n,i){let t=new Map,s=[],f=new Set;for(let a of e){let d=a.primitives[0],c=a.mutation?.args,g=a.mutation?.name!==h||a.primitives.length!==1||!d?void 0:d.op==="splice-text"?d:j(d,String(c?.node),String(c?.field));g?s.push({batch:a.batch,node:String(c?.node),field:String(c?.field),splice:g}):f.add(a.batch)}if(s.length===0)return t;let r=a=>`${a.node}\0${a.field}`,l=new Set,o=new Set(e.map(a=>a.batch).filter(a=>!i.includes(a))),p=s;for(let a of n){if(o.has(a.batch)){p=p.filter(d=>d.batch!==a.batch);continue}for(let d of a.primitives){if(d.op==="add-edge"||d.op==="remove-edge")continue;let c=d.op==="add-node"||d.op==="remove-node"?d.node.id:d.id;for(let g of new Set(p.filter(m=>m.node===c).map(m=>m.field))){let m=d.op==="splice-text"?d.field===g?d:void 0:j(d,c,g);for(let u of p)u.node!==c||u.field!==g||(m?[m,u.splice]=b(m,u.splice):M(d,u.node,u.field)&&l.add(r(u)))}}}p.forEach((a,d)=>{if(!o.has(a.batch))return;let c={at:a.splice.at,removed:a.splice.inserted,inserted:a.splice.removed};for(let g of p.slice(d+1))r(g)===r(a)&&([c,g.splice]=b(c,g.splice))});for(let a of i){let d=p.filter(c=>c.batch===a);d.length===0||f.has(a)||d.some(c=>l.has(r(c)))||t.set(a,d.map(c=>({name:h,args:{node:c.node,field:c.field,at:c.splice.at,remove:c.splice.removed.length,insert:c.splice.inserted}})))}return t}v.typeText=Z;v.via=ee;v.collaborative=O;v.asSplices=se;v.undone=de;v.aside=ae;v.carried=le;function Ye(e){let{store:n,author:i,pending:t,provisional:s,asked:f}=e,r=new Map,l=(o,p)=>{r.get(o)?.(p),r.delete(o)};return{store:n,apply:(o,p)=>e.appliedAll(o,{...i?{author:i}:{},...p!==void 0?{batch:p}:{}}),hold(o){t.push(o),s.add(o),e.answers.set(o,new Promise(p=>r.set(o,p)))},ask:(o,p)=>void f.set(o,{calls:p}),send(o,p){f.set(o,{calls:p});let a=e.sent(o,p),d=()=>l(o,a);return a.then(c=>{Array.isArray(c?.ops)&&c.ops.length===0&&e.letGo.add(o),d()},d),a},drop(o){e.letGo.add(o),e.settle(o),f.delete(o),e.land([],[o]),l(o)},seen:e.seen,gone:e.gone,ahead(o,p,a){let d=t.indexOf(o),c=n.log.all(),g=m=>c.some(u=>u.batch===m&&u.primitives.some(y=>y.op==="splice-text"&&y.id===p&&y.field===a||y.op==="patch-node"&&y.id===p&&a in y.after));return t.slice(0,Math.max(0,d)).flatMap(m=>{let u=e.answers.get(m);return u&&g(m)?[{batch:m,answer:u}]:[]})}}}var ce=400,pe=/[\s.,;:!?)\]}]$/u,W=e=>typeof e=="string"?e:"";function z(e,n,i,t){let s=e.log.all(),f=s.findIndex(o=>o.batch===n);if(f<0)return;let r=W(e.graph.getNode(i)?.[t]),l;for(let o=s.length-1;o>=f;o--){let p=s[o];p.batch===n&&l===void 0&&(l=r);for(let a=p.primitives.length-1;a>=0;a--){let d=p.primitives[a];d.op==="splice-text"&&d.id===i&&d.field===t?r=T(r,{at:d.at,removed:d.inserted,inserted:d.removed}):d.op==="patch-node"&&d.id===i&&t in d.after&&(r=C(d.before[t])?"":W(d.before[t]))}}if(!(l===void 0||l===r))return S(r,l)}function Xe(e,n,i){let t,s=[],f,r,l=!1,o=new Set,p=c=>({name:h,args:{node:e,field:n,at:c.at,remove:c.removed.length,insert:c.inserted,rev:i.seen()}}),a=()=>{r&&clearTimeout(r),r=void 0,t!==void 0&&s.push(t),t=void 0,d()},d=()=>{if(f!==void 0||l||i.gone())return;let c=s.shift();if(c===void 0)return;let g=i.ahead(c,e,n).filter(u=>!o.has(u.batch));if(g.length>0){s.unshift(c),l=!0,Promise.allSettled(g.map(u=>u.answer)).then(()=>{for(let u of g)o.add(u.batch);l=!1,d()});return}let m=z(i.store,c,e,n);if(!m)return i.drop(c),d();f=c,i.send(c,[p(m)]).finally(()=>{f=void 0,d()})};return{splice(c,g,m){if(i.gone())return;let u=W(i.store.graph.getNode(e)?.[n]),y={at:c,removed:u.slice(c,c+g),inserted:m};if(t!==void 0){let F=z(i.store,t,e,n);(!F||!D(F,y))&&a()}let x=i.apply([{name:h,args:{node:e,field:n,at:c,remove:g,insert:m}}],t);if(x.ops.length===0)return;t===void 0&&(t=x.batch,i.hold(t));let k=z(i.store,t,e,n);if(k&&i.ask(t,[p(k)]),pe.test(m))return a();r&&clearTimeout(r),r=setTimeout(a,ce),r.unref?.()},flush:a,waiting:()=>s.length+(t!==void 0?1:0)+(f!==void 0?1:0)}}function Be(e,n){let i=n.find(l=>l.name===h)?.args;if(typeof i?.node!="string"||typeof i.field!="string")return;let{node:t,field:s}=i,f=()=>e.graph.getNode(t)?.[s],r=f();return{node:t,field:s,yours:r,over:l=>{let o=f();return{name:h,args:{node:t,field:s,at:0,remove:typeof o=="string"?o.length:0,insert:typeof r=="string"?r:"",rev:l}}}}}export{ce as TYPING_IDLE_MS,z as runSplice,Xe as typingOf,Ye as wireOf,Be as yoursOf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as L,Bb as q,Bc as Q,Cb as H,Cc as ee,Db as J,Dc as M,Eb as U,Ec as I,Fc as N,Kc as P,L as K,Nc as w,R as _,U as G,Y as $,nb as z,ob as h,ra as F,vc as V,xb as Y,yc as X,zc as Z}from"./chunk.Q4MI53KK.js";import{j as f}from"./chunk.FQLNBIQ5.js";var te=e=>Y(e).id??e.session;function D(e,o={}){let i=V(e),n=new Map,t=o.advisory===!0;for(let s of e){if(s.vote===void 0||s.withheld||i.has(s.id)||s.vote.advisory===!0!==t)continue;let r=t?s.vote.voter:te(s.author);if(r===void 0)continue;let a=n.get(s.vote.suggestion);a||n.set(s.vote.suggestion,a=new Map),s.vote.vote===null?a.delete(r):a.set(r,s.vote.vote)}return n}function ne(e){let o=0,i=0;for(let n of e?.values()??[])n==="for"?o++:i++;return{for:o,against:i}}function le(e,o,i){let n=M(o)?I(o):void 0,t=o&&(n===void 0?te(o):void 0),s=n!==void 0?i?.get(n):t!==void 0?e?.get(t):void 0,r=ne(i);return{...ne(e),...s!==void 0?{mine:s}:{},...r.for+r.against>0?{advisory:r}:{}}}var j=(e,o)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(o),ue=(e,o,i)=>(e??[]).some(n=>n.suggestion===o&&(n.until===void 0||Date.parse(n.until)>Date.parse(i)));function oe(e,o=()=>!0,i={}){let n=V(e),t=ce(e),s=i.now??new Date().toISOString(),r,a;return e.filter(d=>d.suggests&&!d.withheld&&!n.has(d.id)&&t.get(d.id)!=="all"&&!j(d,s)&&!ue(i.dismissed,d.id,s)).flatMap(({id:d,batch:l,suggests:u,suggestsSaid:g,intent:c,batchIntent:A,author:T,lineage:S,at:p,expiresAt:de})=>{let C=t.get(d),O=ge(u,g,c).filter(m=>!C?.has(m.at));if(O.length===0)return[];let B=O.map(m=>m.call),W=new Set;return JSON.stringify(B.map(m=>m.args),(m,k)=>(typeof k=="string"&&o(k)&&W.add(k),k)),[{id:d,batch:l,calls:B,intent:C?O.map(m=>m.intent).join("; "):c,...A!==void 0?{headline:A}:{},items:O,author:T,...S?{lineage:S}:{},at:p,expiresAt:de,about:[...W],tally:le((r??=D(e)).get(d),i.voter,(a??=D(e,{advisory:!0})).get(d))}]})}function ge(e,o,i){let n=o&&o.length===e.length?o:void 0;return e.map((t,s)=>({at:s,call:t,intent:n?.[s]??(e.length===1?i:t.name)}))}function ce(e){let o=new Map;for(let n of e){let t=n.lineage?.suggestion;if(t===void 0)continue;let s=n.lineage.items,r=o.get(t);if(r!=="all")if(s===void 0)o.set(t,"all");else{let a=r??new Set;for(let d of s)a.add(d);o.set(t,a)}}let i=new Map(e.filter(n=>n.suggests&&o.has(n.id)).map(n=>[n.id,n.suggests.length]));for(let[n,t]of o)t!=="all"&&i.has(n)&&t.size>=i.get(n)&&o.set(n,"all");return o}function ie(e,o){return e.ops.length>0&&e.ops.every(i=>i.suggests!==void 0||i.undoes!==void 0&&o(i.undoes)?.suggests!==void 0)}var E=e=>[...e].length;function pe(e){let o,i=0,n=0;for(let t of e.ops){let s=t.mutation?.name===U&&t.withheld!==!0&&t.undoes===void 0?t.mutation.args:void 0;if(typeof s?.node!="string"||typeof s.field!="string"||o&&(o.node!==s.node||o.field!==s.field))return;o={node:s.node,field:s.field};for(let r of t.primitives)r.op==="splice-text"?(i+=E(r.inserted),n+=E(r.removed)):r.op==="patch-node"&&typeof r.after[s.field]=="string"&&(i+=E(r.after[s.field]))}return o&&{...o,inserted:i,removed:n}}function fe(e,o,i){let n=i.getNode(e.node)?.kind,t=[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]];return`Wrote in ${F(n?o.tryDefinition(n):void 0,e.field)} (${t.join(" ")})`}var x=e=>JSON.stringify([e.kind,e.id??"",e.name??""]),ye=e=>e.ops.find(o=>o.lineage?.run!==void 0)?.lineage?.run;function me(e,o=()=>{}){let i=[];for(let n of e){if(ie(n,o))continue;if(!P(n.author)){let u=pe(n),g=i.at(-1),c=u&&g&&"batch"in g&&x(g.batch.author)===x(n.author)&&g.typed?.node===u.node&&g.typed.field===u.field?g.typed:void 0;c?i[i.length-1]={batch:n,typed:{...c,batches:[...c.batches,n],inserted:c.inserted+u.inserted,removed:c.removed+u.removed}}:i.push(u?{batch:n,typed:{batches:[n],...u}}:{batch:n});continue}let t=ye(n),s=x(n.author),r=t!==void 0?i.findIndex(u=>"digest"in u&&u.digest.run===t&&x(u.digest.author)===s):i.length-1,a=i[r],d=a!==void 0&&"digest"in a&&x(a.digest.author)===s&&a.digest.run===t?a.digest:void 0,l=[...d?.batches??[],n];d&&i.splice(r,1),i.push({digest:{author:n.author,batches:l,things:he(l),at:n.at,...t!==void 0?{run:t}:{}}})}return i}var he=e=>e.reduce((o,i)=>o+(i.undone?0:i.ops.length),0),Se=e=>{let o=Date.parse(e);if(Number.isNaN(o))return!1;let{minutes:i}=G(o,_());return i<6*60||i>=21*60};function ve(e,o=$(new Date().toISOString())??K()){let i=$(e.at)??e.at.slice(0,10),t=e.run!==void 0&&i===o&&[e.at,...(e.batches??[]).map(r=>r.at)].every(Se)?"overnight":i===o?"today":`on ${L(i)}`,s=e.things===1?"one thing":`${e.things} things`;return e.author?.id?.startsWith("workflow:")&&e.author.name?`${e.author.name}: ${s} ${t}`:`Tidied ${s} ${t}`}var y=e=>e,v=(e,o)=>o===void 0?{}:{[e]:o};function Ge(e,o,i){let n=f(e)?.store??e,t=y(n),s=Z(i.lineage);if(s===void 0)throw new h("A suggestion says what it is based on: { basis, confidence? }");let r=i.author??t.by;if(i.expiresAt!==void 0&&Number.isNaN(Date.parse(i.expiresAt)))throw new h(`A suggestion expires at a time: "${i.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let a=t.actMeanings(),d=w(o,a),l=R(n).find(p=>w(p.calls,a)===d);if(l)return n.log.get(l.id);t.refuseDeclined(o,r);let u=t.rehearsal();u.suggesting=!0;let g=u.applying(o,{author:r,lineage:s,...v("via",i.via)});if(g.ops.length===0)return;let c=[...new Set(g.ops.flatMap(p=>p.described??[]))],A=g.ops.filter(p=>p.mutation!==null&&p.author===r),T=o.length>1&&A.length===o.length?A.map(p=>p.intent):void 0,S={id:t.nextId(),seq:n.log.length,batch:t.mintBatch("batch"),author:r,intent:g.ops.map(p=>p.intent).join("; "),...v("batchIntent",i.intent),mutation:null,primitives:[],reads:[],writes:[],...c.length>0?{described:c}:{},at:t.now(),...v("via",i.via),lineage:s,suggests:o,...v("suggestsSaid",T),...v("expiresAt",i.expiresAt)};return n.log.append(S),n.notify(z,[S]),S}function R(e,o,i={}){let n=f(e),t=n?.store??e,s=o??n?.principal,r=(s!==void 0?t.seenBy(s):t).log.all();return oe(r,a=>t.graph.has(a),{now:y(t).now(),dismissed:i.dismissed,voter:s})}function se(e,o,i){let n=f(e),t=n?.store??e,s=i??n?.principal??y(t).by;return o.calls.every(r=>t.permits(r,s).ok)}function re(e,o,i,n={}){let t=f(e)?.store??e,s=n.author??y(t).by;b(t,o,s);let r=t.applyAll([{name:ee,args:{suggestion:o,vote:i}}],{...n,author:s});return i===null?r:{...r,voted:i}}function b(e,o,i){let n=R(e,i).find(s=>s.id===o),t=n?void 0:e.log.get(o);if(t?.suggests&&j(t,y(e).now()))throw new h(`That suggestion expired on ${t.expiresAt.slice(0,10)}.`);if(!n)throw new h("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return n}function Le(e,o,i={}){let n=f(e)?.store??e,{items:t,...s}=i,r=s.author??y(n).by,a=b(n,o,r),d=t===void 0?a.items:a.items.filter(c=>t.includes(c.at));if(t!==void 0&&(t.length===0||d.length!==new Set(t).size))throw new h("Name the changes to accept by their place among those still waiting in the suggestion.");let l={...a,calls:d.map(c=>c.call)};if(!se(n,l,r))return re(n,o,"for",{...s,author:r});let u=n.log.get(o)?.suggests?.length??d.length,g=d.length<u?{items:d.map(c=>c.at)}:{};return n.applyAll(l.calls,{...s,author:r,lineage:{...a.lineage,suggestion:o,...g}})}function Fe(e,o,i={}){let n=f(e)?.store??e,t=i.author??y(n).by,s=b(n,o,t);if(!se(n,s,t))return re(n,o,"against",{...i,author:t});let r=ae(s)&&i.intent===void 0?{intent:`Declined ${xe(we(s))} proposal: ${s.intent}`}:{};return n.undo(s.batch,{...i,...r,author:t})}function ze(e,o,i={}){let n=f(e)?.store??e,t=i.author??y(n).by,s=b(n,o,t);if(s.author.kind!==t.kind||s.author.id!==t.id)throw new h("Only who made a suggestion withdraws it: a person declines it (declineSuggestion).");return n.undo(s.batch,{...i,author:t})}var Ae={kind:"system",id:"tidying",name:"Graview, tidying",automated:!0};N.op=(e,o,i,n,t,s)=>{let r=e,{suggestion:a,vote:d}=i.args,l=b(r,a,t),u=M(t)?I(t):void 0,g=d==="for"?`For: ${l.intent}`:d==="against"?`Against: ${l.intent}`:`Withdraws a vote on: ${l.intent}`;return{id:o.id,seq:r.log.length,batch:n,author:t,intent:g,mutation:i,primitives:[],reads:[],writes:[],...l.about.length>0?{described:l.about}:{},at:o.at,...s.via!==void 0?{via:s.via}:{},vote:{suggestion:a,vote:d,...u!==void 0?{advisory:!0,voter:u}:{}}}};N.accepting=(e,o)=>{let i=e,n=i.tidying?.autoAcceptAt;if(n===void 0||o.vote?.vote!=="for")return;let t=o.vote.suggestion,s=R(i).find(l=>l.id===t);if(!s)return;let a=[...D(i.log.all()).get(t)??[]].filter(([,l])=>l==="for").map(([l])=>l);if(a.length<n)return;let d=P(s.author)?s.author:Ae;return{calls:s.calls,author:d,lineage:{...s.lineage,suggestion:t,voters:a.slice(0,X)}}};var ae=e=>e.lineage?.proposedBy!==void 0,we=e=>e.author.name??e.author.id??"Somebody",xe=e=>/s$/i.test(e)?`${e}'`:`${e}'s`;function Ye(e,o,i,n){let t=f(e)?.store??e,s=y(t).actMeanings(),r=w(i,s),a=R(t,o).find(l=>ae(l)&&w(l.calls,s)===r);if(a)return t.log.get(a.id);let d={calls:i.map(({name:l,args:u})=>({name:l,args:u})),...v("intent",n)};return t.applyAll([{name:Q,args:d}],{author:o}).ops.find(l=>l.suggests!==void 0)}function qe(e,o,i){if(!e||!e.grants.some(t=>t.propose!==void 0))return[];let n=new Set(q(e,o,i));return i.filter(t=>!n.has(t)&&H(t).some(s=>J(e,o,t.name,s)))}export{fe as a,me as b,ve as c,Ge as d,R as e,se as f,re as g,Le as h,Fe as i,ze as j,ae as k,Ye as l,qe as m};
|
|
@@ -1,3 +1,3 @@
|
|
|
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{Da as u,G as f,T as m}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{Da as u,G as f,T as m}from"./chunk.CYTTZOYL.js";import{b as d}from"./chunk.AJZBJBMO.js";var g=d(f(),1),n=d(m(),1),c=/^\s*(\d{1,6})[.)]\s+(.*)$/s,S=/^\s*[-*•]\s+(.*)$/s;function h(o){let s=[];for(let p of o.replace(/\r\n?/g,`
|
|
2
2
|
`).split(/\n[ \t]*\n+/)){let t=null,a=()=>{t&&(t.t==="p"?t.lines.length>0:t.items.length>0)&&s.push(t),t=null};for(let e of p.split(`
|
|
3
|
-
`)){let i=c.exec(e),l=i?null:S.exec(e);if(i)t?.t!=="ol"&&(a(),t={t:"ol",start:Number(i[1]),items:[]}),t.items.push(i[2]);else if(l)t?.t!=="ul"&&(a(),t={t:"ul",items:[]}),t.items.push(l[1]);else if(t&&t.t!=="p"&&/^\s+\S/.test(e)){let r=t.items;r[r.length-1]=`${r[r.length-1]} ${e.trim()}`}else e.trim().length>0&&(t?.t!=="p"&&(a(),t={t:"p",lines:[]}),t.lines.push(e.trim()))}a()}return s}function P(o){return/[\r\n]/.test(o)}var k={display:"grid",gap:"0.7em",minWidth:0,overflowWrap:"anywhere"},x={margin:0},y={margin:0,paddingInlineStart:"1.6em",display:"grid",gap:"0.3em"},B=u(()=>(__graviewPreload(import.meta.url,["./chunk.
|
|
3
|
+
`)){let i=c.exec(e),l=i?null:S.exec(e);if(i)t?.t!=="ol"&&(a(),t={t:"ol",start:Number(i[1]),items:[]}),t.items.push(i[2]);else if(l)t?.t!=="ul"&&(a(),t={t:"ul",items:[]}),t.items.push(l[1]);else if(t&&t.t!=="p"&&/^\s+\S/.test(e)){let r=t.items;r[r.length-1]=`${r[r.length-1]} ${e.trim()}`}else e.trim().length>0&&(t?.t!=="p"&&(a(),t={t:"p",lines:[]}),t.lines.push(e.trim()))}a()}return s}function P(o){return/[\r\n]/.test(o)}var k={display:"grid",gap:"0.7em",minWidth:0,overflowWrap:"anywhere"},x={margin:0},y={margin:0,paddingInlineStart:"1.6em",display:"grid",gap:"0.3em"},B=u(()=>(__graviewPreload(import.meta.url,["./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.Y4ZM75WL.js")));function b({text:o,className:s,style:p,markdown:t,headingsFrom:a}){return t?(0,n.jsx)(g.Suspense,{fallback:(0,n.jsx)(b,{text:o,...s?{className:s}:{},...p?{style:p}:{}}),children:(0,n.jsx)(B,{text:o,...s?{className:s}:{},...p?{style:p}:{},...a?{headingsFrom:a}:{}})}):(0,n.jsx)("div",{"data-graview-text-body":"",...s?{className:s}:{},style:{...k,...p},children:h(o).map((e,i)=>e.t==="p"?(0,n.jsx)("p",{style:x,children:e.lines.map((l,r)=>(0,n.jsxs)("span",{children:[r>0?(0,n.jsx)("br",{}):null,l]},r))},i):e.t==="ol"?(0,n.jsx)("ol",{start:e.start,style:y,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i):(0,n.jsx)("ul",{style:y,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i))})}export{P as a,b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as N,g as se,h as de}from"./chunk.TIALD6SC.js";import{a as R}from"./chunk.QHY5NVYH.js";import{a as ie,b as oe,c as re}from"./chunk.U6ZRJKVM.js";import{b}from"./chunk.PLTH2LW5.js";import{a as ae}from"./chunk.W4BKYSZX.js";import{a as S,b as T,c as A,d as $}from"./chunk.U5P23GO7.js";import{a as C}from"./chunk.NUYA4BWI.js";import{j as ne}from"./chunk.AI34V6WV.js";import{G as X,Ia as Z,J,O as H,P as q,Ra as ee,T as K,Va as te,ba as w,la as Q}from"./chunk.M7RESZB6.js";import{a as _}from"./chunk.SDO3U72B.js";import{Db as x,bb as j,cb as E,ga as U,ja as Y,oe as G}from"./chunk.DZZL5IDD.js";import{b as z}from"./chunk.AJZBJBMO.js";var h=z(X(),1);var le=z(X(),1);function pe(){let{ai:n,aiDesk:a}=w(),{entries:o}=J(a),i=n.off===!0;return(0,le.useEffect)(()=>{i||a.load()},[a,i]),i?[]:o}var e=z(K(),1),ue=Z(_(()=>(__graviewPreload(import.meta.url,["./chunk.7XLS6XTY.js","./chunk.U5P23GO7.js","./chunk.5STU3KYG.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.HIMQ65QT.js")))),ve=ue.part((n,a)=>(0,e.jsx)(n.InteractionRow,{...a}),{quiet:!0,as:"li"}),me=ue.part((n,a)=>(0,e.jsx)(n.ActivityFilter,{...a}),{quiet:!0,as:"div"}),we=n=>n.undoes===void 0&&n.primitives.some(a=>a.op==="remove-node"||a.op==="patch-node"&&a.after[E]===!0&&a.before[E]!==!0);function ke(n){let a=[...new Set(n.ops.filter(o=>!x(o)&&we(o)).map(o=>o.intent))].filter(o=>o!==n.intent);return a.length===0?n.intent:`${n.intent} \u2014 ${a.join("; ")}`}var ge=(n,a,o=ce(n,[a]))=>({intent:ke(a),author:a.author.kind,...a.author.id?{authorId:a.author.id}:{},by:a.author,...a.ops[0]?.via?{via:a.ops[0].via}:{},...a.lineage?{basis:ae(a.lineage)}:{},touched:[...new Set(a.ops.filter(i=>!x(i)).flatMap(i=>i.writes))],...xe(a.ops.filter(i=>!x(i)).flatMap(i=>i.writes),o),batch:a.id,at:a.at,...a.lineage?.interaction?{interaction:a.lineage.interaction}:{},seq:a.ops.at(-1).seq+1,...a.ops.every(x)?{withheld:!0}:{}});function be(n=4){let{store:a,principal:o}=w(),i=q(a,o),s=i.log.length;return(0,h.useMemo)(()=>{let d=i.batches(),l=ce(i,d);return oe(d,r=>i.log.get(r)).reverse().slice(0,n).map(r=>{if("batch"in r){let p=ge(i,r.batch,l);return r.typed?{...p,intent:ie(r.typed,i.schema,i.graph),batches:r.typed.batches.filter(k=>!k.undone).map(k=>k.id)}:p}let u=[...r.digest.batches].reverse().map(p=>ge(i,p,l));return{intent:re(r.digest),author:r.digest.author.kind,...r.digest.author.id?{authorId:r.digest.author.id}:{},by:r.digest.author,touched:[...new Set(u.flatMap(p=>p.touched))],batch:"",...u[0]?.at?{at:u[0].at}:{},seq:u[0]?.seq??0,digest:u}})},[i,s,n])}function ce(n,a){let o=new Map;for(let i of a)for(let s of i.ops)if(!x(s))for(let d of s.primitives)(d.op==="add-node"||d.op==="remove-node")&&d.node&&o.set(d.node.id,Y(n.schema.tryDefinition(d.node.kind),d.node));return o}function xe(n,a){let o={};for(let i of n){let s=a.get(i);s!==void 0&&(o[i]=s)}return Object.keys(o).length>0?{named:o}:{}}function Se({change:n}){let{store:a,principal:o,seats:i,people:s}=w();return(0,e.jsxs)("strong",{style:{fontWeight:600},children:[n.author==="human"&&n.by?.onBehalfOf===void 0&&(n.authorId===void 0||o.id===void 0||n.authorId===o.id)?"you":j(n.by??{kind:n.author,id:n.authorId},{graph:a.graph,schema:a.schema,seats:i,people:s}),C(n.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",C(n.via)]}):null]})}function Ae({change:n,goes:a}){let{store:o}=w(),[i,s]=(0,h.useState)(!1),d=n.digest??[];return(0,e.jsxs)("li",{"data-testid":"activity-digest",style:{...S,gap:5},children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,e.jsx)(Se,{change:n})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:n.intent})]}),(0,e.jsx)("button",{type:"button","data-testid":"digest-toggle","aria-expanded":i,onClick:()=>s(l=>!l),style:{marginLeft:"auto",flex:"0 0 auto",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"},children:i?"Hide":"Show each"})]}),i?(0,e.jsx)("ol",{"data-testid":"digest-changes",style:{margin:0,padding:"0 0 0 10px",listStyle:"none",display:"grid",gap:6,borderLeft:"1px solid var(--graview-edge)"},children:d.map(l=>(0,e.jsxs)("li",{"data-testid":"digest-change",style:S,children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:l.intent}),l.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",l.basis]}):null]}),l.withheld?null:(0,e.jsx)(V,{batch:l.batch})]}),l.touched.length>0?(0,e.jsx)("div",{"data-touched":l.touched.join(" "),style:$,children:l.touched.slice(0,4).map(r=>(0,e.jsx)(R,{id:r,label:o.graph.has(r)?b(o,r):l.named?.[r]??b(o,r),go:a(r),testId:"activity-record"},r))}):null]},l.batch))}):null]})}function V({batch:n}){let{store:a,principal:o,noteSeat:i}=w(),s=q(a,o),d=H()?.open??!1,l=s.log.length,[r,u]=(0,h.useState)(null),p=(0,h.useMemo)(()=>s.canUndo(n),[s,n,l]),k=(0,h.useMemo)(()=>p.ok?s.mayUndo(n,o):{ok:!0},[s,n,l,o,p]);if(d||!p.ok&&p.ops.length===0||!k.ok)return null;let f=!p.ok,W=f?p.includeBatches:[];return(0,e.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,e.jsx)("button",{type:"button","data-testid":"undo-turn",title:f?`${p.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{u(null);try{let v=typeof n=="string"?[n]:n,L=s.log.all().find(O=>v.includes(O.batch)&&O.author.kind==="agent");s.undo(f?[...v,...W]:typeof n=="string"?n:[...n],{author:o}),L&&i({type:"home",author:L.author})}catch(v){u(v instanceof Error?v.message:String(v))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...f?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:f?`undo +${W.length}`:"undo"}),r?(0,e.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:r}):null]})}function Ie({seq:n,intent:a}){let o=H();if(!o)return null;let i=o.past?.seq===n;return(0,e.jsx)("button",{type:"button","data-testid":"show-past","aria-label":`Show the app as it was after \u201C${a}\u201D`,title:"Show the app as it was here","aria-pressed":i,onPointerEnter:N,onFocus:N,onClick:()=>o.show(n),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:24,minWidth:24,padding:"1px 6px",fontSize:"0.75rem",flex:"0 0 auto"},children:(0,e.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,e.jsx)("path",{d:"M2.5 8 a5.5 5.5 0 1 0 1.6-3.9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("path",{d:"M2 2.5 V5.5 H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M8 5 V8 L10 9.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function Ce(){let n=()=>G(window.location.href);return(0,e.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:a=>{a.preventDefault(),window.location.assign(n())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function Ve({calls:n,seat:a,remembers:o=!1}){let i=be(),{store:s,principal:d,seats:l,people:r}=w(),u=pe(),[p,k]=(0,h.useState)("all"),[f,W]=(0,h.useState)(!1),v=t=>t!==void 0&&(t.id===d.id||t.onBehalfOf?.id===d.id)&&d.id!==void 0,L=new Set(u.map(t=>t.id)),O=i.filter(t=>!(t.interaction!==void 0&&L.has(t.interaction))&&(!f||v(t.by))),he=u.filter(t=>!f||v(t.by)).slice(0,4),M=[...p==="ai"?[]:O.map(t=>({at:t.at??"",change:t})),...p==="changes"?[]:he.map(t=>({at:t.at,entry:t}))].sort((t,y)=>t.at<y.at?1:t.at>y.at?-1:0),m=q(s,d),B=n.some(t=>t.phase==="running"),ye=se(),I=te("activity"),F=I.open,fe=Q(),P=H(),D=t=>m.graph.has(t)?y=>{I.setOpen(!1),P?.past&&P.show(null),fe.record(y)}:null;return a===void 0&&n.length===0&&i.length===0&&u.length===0&&!o&&ye===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"activity-button",...I.trigger,onClick:I.toggle,title:B?"An agent is working":"What has happened",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:B?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[B?(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,background:"var(--graview-accent)"}}):null,i.length>0?i.length:"",(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.75",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),(0,e.jsx)("path",{d:"M8 4.75 V8 L10.25 9.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Activity"})]}),!F&&a!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:a}):null,F?(0,e.jsxs)("section",{...I.pane,"aria-label":"Activity","data-testid":"activity","data-graview-offstage":"",style:{...ee,width:"min(300px, calc(100vw - 16px))",maxHeight:"min(52cqh, 460px)",overflowX:"hidden",overflowY:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...ne,margin:0},children:"Activity"}),a!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:n.length>0||M.length>0?9:0,...n.length>0||M.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,e.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),a]}):null,n.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:n.slice(0,6).map((t,y)=>(0,e.jsxs)("li",{style:{...S,gap:2,fontSize:"0.8125rem"},children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:t.phase==="running"?"var(--graview-accent)":t.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,e.jsxs)("span",{"data-graview-activity-words":"",style:{...A,color:"var(--graview-ink)"},children:[t.mutating?"changed":"read"," \xB7"," ",m.allMutations().find(g=>g.name===t.name)?.title??U(t.name)]})]}),!t.mutating&&t.reads&&t.reads.length>0?(0,e.jsxs)("div",{"data-testid":"activity-reads",style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:[[...new Set(t.reads)].slice(0,3).map(g=>(0,e.jsx)(R,{id:g,label:b(m,g),go:D(g),testId:"activity-record"},g)),new Set(t.reads).size>3?(0,e.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(t.reads).size-3]}):null]}):Object.values(t.args).some(g=>typeof g=="string")?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(t.args).filter(g=>typeof g[1]=="string").slice(0,3).map(([g,c])=>(0,e.jsx)(R,{id:c,label:b(m,c),go:D(c),testId:"activity-record"},g))}):null,t.error?(0,e.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:t.error}):null]},`${t.at}:${y}`))}):null,u.length>0?(0,e.jsx)(h.Suspense,{fallback:null,children:(0,e.jsx)(me,{shows:p,onShows:k,mine:f,onMine:W})}):null,M.length>0?(0,e.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:M.map(({change:t,entry:y},g)=>y!==void 0?(0,e.jsx)(h.Suspense,{fallback:null,children:(0,e.jsx)(ve,{entry:y,undo:c=>(0,e.jsx)(V,{batch:c})})},`ai:${y.id}`):t.digest?(0,e.jsx)(Ae,{change:t,goes:D},`digest:${t.digest[0]?.batch??g}`):t.withheld?(0,e.jsx)("li",{"data-testid":"withheld-change",style:S,children:(0,e.jsx)("span",{"data-touched":"",style:{...A,color:"var(--graview-ink-muted)",fontStyle:"italic"},children:t.intent})},`change:${g}`):(0,e.jsxs)("li",{"data-batch":t.batch,style:S,children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,e.jsxs)("strong",{style:{fontWeight:600},children:[t.author==="human"&&t.by?.onBehalfOf===void 0&&(t.authorId===void 0||d.id===void 0||t.authorId===d.id)?"you":j(t.by??{kind:t.author,id:t.authorId},{graph:m.graph,schema:m.schema,seats:l,people:r}),C(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",C(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent}),t.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",t.basis]}):null]}),t.batch?(0,e.jsx)(Ie,{seq:t.seq,intent:t.intent}):null,t.batch?(0,e.jsx)(V,{batch:t.batches&&t.batches.length>0?t.batches.length===1?t.batches[0]:t.batches:t.batch}):null]}),(0,e.jsx)("div",{"data-touched":t.touched.join(" "),style:$,children:t.touched.slice(0,4).map(c=>(0,e.jsx)(R,{id:c,label:m.graph.has(c)?b(m,c):t.named?.[c]??b(m,c),go:D(c),testId:"activity-record"},c))})]},`change:${g}`))}):null,(0,e.jsx)(de,{style:{paddingTop:8,borderTop:"1px solid var(--graview-edge)"}}),o?(0,e.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,e.jsx)("span",{children:"Remembered in this browser"}),(0,e.jsx)(Ce,{})]}):null]}):null]})}export{V as a,Ve as b};
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as N,g as se,h as de}from"./chunk.34DRUCH2.js";import{a as R}from"./chunk.KXFNRJ46.js";import{a as ie,b as oe,c as re}from"./chunk.OMRQTLI5.js";import{b}from"./chunk.MIE3ODQ2.js";import{a as ae}from"./chunk.H7AH3IW4.js";import{a as S,b as T,c as A,d as $}from"./chunk.U5P23GO7.js";import{a as C}from"./chunk.REUMBCSV.js";import{j as ne}from"./chunk.KZUMXT5J.js";import{G as X,Ia as Z,J,O as H,P as q,Ra as ee,T as K,Va as te,ba as w,la as Q}from"./chunk.CYTTZOYL.js";import{a as _}from"./chunk.SDO3U72B.js";import{Ib as x,db as j,eb as E,ga as U,la as Y,we as G}from"./chunk.Q4MI53KK.js";import{b as z}from"./chunk.AJZBJBMO.js";var h=z(X(),1);var le=z(X(),1);function pe(){let{ai:n,aiDesk:a}=w(),{entries:o}=J(a),i=n.off===!0;return(0,le.useEffect)(()=>{i||a.load()},[a,i]),i?[]:o}var e=z(K(),1),ue=Z(_(()=>(__graviewPreload(import.meta.url,["./chunk.DDFRFSVN.js","./chunk.U5P23GO7.js","./chunk.YOUB3J3Y.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZP7JEVVU.js")))),ve=ue.part((n,a)=>(0,e.jsx)(n.InteractionRow,{...a}),{quiet:!0,as:"li"}),me=ue.part((n,a)=>(0,e.jsx)(n.ActivityFilter,{...a}),{quiet:!0,as:"div"}),we=n=>n.undoes===void 0&&n.primitives.some(a=>a.op==="remove-node"||a.op==="patch-node"&&a.after[E]===!0&&a.before[E]!==!0);function ke(n){let a=[...new Set(n.ops.filter(o=>!x(o)&&we(o)).map(o=>o.intent))].filter(o=>o!==n.intent);return a.length===0?n.intent:`${n.intent} \u2014 ${a.join("; ")}`}var ge=(n,a,o=ce(n,[a]))=>({intent:ke(a),author:a.author.kind,...a.author.id?{authorId:a.author.id}:{},by:a.author,...a.ops[0]?.via?{via:a.ops[0].via}:{},...a.lineage?{basis:ae(a.lineage)}:{},touched:[...new Set(a.ops.filter(i=>!x(i)).flatMap(i=>i.writes))],...xe(a.ops.filter(i=>!x(i)).flatMap(i=>i.writes),o),batch:a.id,at:a.at,...a.lineage?.interaction?{interaction:a.lineage.interaction}:{},seq:a.ops.at(-1).seq+1,...a.ops.every(x)?{withheld:!0}:{}});function be(n=4){let{store:a,principal:o}=w(),i=q(a,o),s=i.log.length;return(0,h.useMemo)(()=>{let d=i.batches(),l=ce(i,d);return oe(d,r=>i.log.get(r)).reverse().slice(0,n).map(r=>{if("batch"in r){let p=ge(i,r.batch,l);return r.typed?{...p,intent:ie(r.typed,i.schema,i.graph),batches:r.typed.batches.filter(k=>!k.undone).map(k=>k.id)}:p}let u=[...r.digest.batches].reverse().map(p=>ge(i,p,l));return{intent:re(r.digest),author:r.digest.author.kind,...r.digest.author.id?{authorId:r.digest.author.id}:{},by:r.digest.author,touched:[...new Set(u.flatMap(p=>p.touched))],batch:"",...u[0]?.at?{at:u[0].at}:{},seq:u[0]?.seq??0,digest:u}})},[i,s,n])}function ce(n,a){let o=new Map;for(let i of a)for(let s of i.ops)if(!x(s))for(let d of s.primitives)(d.op==="add-node"||d.op==="remove-node")&&d.node&&o.set(d.node.id,Y(n.schema.tryDefinition(d.node.kind),d.node));return o}function xe(n,a){let o={};for(let i of n){let s=a.get(i);s!==void 0&&(o[i]=s)}return Object.keys(o).length>0?{named:o}:{}}function Se({change:n}){let{store:a,principal:o,seats:i,people:s}=w();return(0,e.jsxs)("strong",{style:{fontWeight:600},children:[n.author==="human"&&n.by?.onBehalfOf===void 0&&(n.authorId===void 0||o.id===void 0||n.authorId===o.id)?"you":j(n.by??{kind:n.author,id:n.authorId},{graph:a.graph,schema:a.schema,seats:i,people:s}),C(n.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",C(n.via)]}):null]})}function Ae({change:n,goes:a}){let{store:o}=w(),[i,s]=(0,h.useState)(!1),d=n.digest??[];return(0,e.jsxs)("li",{"data-testid":"activity-digest",style:{...S,gap:5},children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,e.jsx)(Se,{change:n})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:n.intent})]}),(0,e.jsx)("button",{type:"button","data-testid":"digest-toggle","aria-expanded":i,onClick:()=>s(l=>!l),style:{marginLeft:"auto",flex:"0 0 auto",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"},children:i?"Hide":"Show each"})]}),i?(0,e.jsx)("ol",{"data-testid":"digest-changes",style:{margin:0,padding:"0 0 0 10px",listStyle:"none",display:"grid",gap:6,borderLeft:"1px solid var(--graview-edge)"},children:d.map(l=>(0,e.jsxs)("li",{"data-testid":"digest-change",style:S,children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:l.intent}),l.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",l.basis]}):null]}),l.withheld?null:(0,e.jsx)(V,{batch:l.batch})]}),l.touched.length>0?(0,e.jsx)("div",{"data-touched":l.touched.join(" "),style:$,children:l.touched.slice(0,4).map(r=>(0,e.jsx)(R,{id:r,label:o.graph.has(r)?b(o,r):l.named?.[r]??b(o,r),go:a(r),testId:"activity-record"},r))}):null]},l.batch))}):null]})}function V({batch:n}){let{store:a,principal:o,noteSeat:i}=w(),s=q(a,o),d=H()?.open??!1,l=s.log.length,[r,u]=(0,h.useState)(null),p=(0,h.useMemo)(()=>s.canUndo(n),[s,n,l]),k=(0,h.useMemo)(()=>p.ok?s.mayUndo(n,o):{ok:!0},[s,n,l,o,p]);if(d||!p.ok&&p.ops.length===0||!k.ok)return null;let f=!p.ok,W=f?p.includeBatches:[];return(0,e.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,e.jsx)("button",{type:"button","data-testid":"undo-turn",title:f?`${p.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{u(null);try{let v=typeof n=="string"?[n]:n,L=s.log.all().find(O=>v.includes(O.batch)&&O.author.kind==="agent");s.undo(f?[...v,...W]:typeof n=="string"?n:[...n],{author:o}),L&&i({type:"home",author:L.author})}catch(v){u(v instanceof Error?v.message:String(v))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...f?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:f?`undo +${W.length}`:"undo"}),r?(0,e.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:r}):null]})}function Ie({seq:n,intent:a}){let o=H();if(!o)return null;let i=o.past?.seq===n;return(0,e.jsx)("button",{type:"button","data-testid":"show-past","aria-label":`Show the app as it was after \u201C${a}\u201D`,title:"Show the app as it was here","aria-pressed":i,onPointerEnter:N,onFocus:N,onClick:()=>o.show(n),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:24,minWidth:24,padding:"1px 6px",fontSize:"0.75rem",flex:"0 0 auto"},children:(0,e.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,e.jsx)("path",{d:"M2.5 8 a5.5 5.5 0 1 0 1.6-3.9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("path",{d:"M2 2.5 V5.5 H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M8 5 V8 L10 9.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function Ce(){let n=()=>G(window.location.href);return(0,e.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:a=>{a.preventDefault(),window.location.assign(n())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function Ve({calls:n,seat:a,remembers:o=!1}){let i=be(),{store:s,principal:d,seats:l,people:r}=w(),u=pe(),[p,k]=(0,h.useState)("all"),[f,W]=(0,h.useState)(!1),v=t=>t!==void 0&&(t.id===d.id||t.onBehalfOf?.id===d.id)&&d.id!==void 0,L=new Set(u.map(t=>t.id)),O=i.filter(t=>!(t.interaction!==void 0&&L.has(t.interaction))&&(!f||v(t.by))),he=u.filter(t=>!f||v(t.by)).slice(0,4),M=[...p==="ai"?[]:O.map(t=>({at:t.at??"",change:t})),...p==="changes"?[]:he.map(t=>({at:t.at,entry:t}))].sort((t,y)=>t.at<y.at?1:t.at>y.at?-1:0),m=q(s,d),B=n.some(t=>t.phase==="running"),ye=se(),I=te("activity"),F=I.open,fe=Q(),P=H(),D=t=>m.graph.has(t)?y=>{I.setOpen(!1),P?.past&&P.show(null),fe.record(y)}:null;return a===void 0&&n.length===0&&i.length===0&&u.length===0&&!o&&ye===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"activity-button",...I.trigger,onClick:I.toggle,title:B?"An agent is working":"What has happened",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:B?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[B?(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,background:"var(--graview-accent)"}}):null,i.length>0?i.length:"",(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.75",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),(0,e.jsx)("path",{d:"M8 4.75 V8 L10.25 9.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Activity"})]}),!F&&a!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:a}):null,F?(0,e.jsxs)("section",{...I.pane,"aria-label":"Activity","data-testid":"activity","data-graview-offstage":"",style:{...ee,width:"min(300px, calc(100vw - 16px))",maxHeight:"min(52cqh, 460px)",overflowX:"hidden",overflowY:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...ne,margin:0},children:"Activity"}),a!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:n.length>0||M.length>0?9:0,...n.length>0||M.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,e.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),a]}):null,n.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:n.slice(0,6).map((t,y)=>(0,e.jsxs)("li",{style:{...S,gap:2,fontSize:"0.8125rem"},children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:t.phase==="running"?"var(--graview-accent)":t.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,e.jsxs)("span",{"data-graview-activity-words":"",style:{...A,color:"var(--graview-ink)"},children:[t.mutating?"changed":"read"," \xB7"," ",m.allMutations().find(g=>g.name===t.name)?.title??U(t.name)]})]}),!t.mutating&&t.reads&&t.reads.length>0?(0,e.jsxs)("div",{"data-testid":"activity-reads",style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:[[...new Set(t.reads)].slice(0,3).map(g=>(0,e.jsx)(R,{id:g,label:b(m,g),go:D(g),testId:"activity-record"},g)),new Set(t.reads).size>3?(0,e.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(t.reads).size-3]}):null]}):Object.values(t.args).some(g=>typeof g=="string")?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(t.args).filter(g=>typeof g[1]=="string").slice(0,3).map(([g,c])=>(0,e.jsx)(R,{id:c,label:b(m,c),go:D(c),testId:"activity-record"},g))}):null,t.error?(0,e.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:t.error}):null]},`${t.at}:${y}`))}):null,u.length>0?(0,e.jsx)(h.Suspense,{fallback:null,children:(0,e.jsx)(me,{shows:p,onShows:k,mine:f,onMine:W})}):null,M.length>0?(0,e.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:M.map(({change:t,entry:y},g)=>y!==void 0?(0,e.jsx)(h.Suspense,{fallback:null,children:(0,e.jsx)(ve,{entry:y,undo:c=>(0,e.jsx)(V,{batch:c})})},`ai:${y.id}`):t.digest?(0,e.jsx)(Ae,{change:t,goes:D},`digest:${t.digest[0]?.batch??g}`):t.withheld?(0,e.jsx)("li",{"data-testid":"withheld-change",style:S,children:(0,e.jsx)("span",{"data-touched":"",style:{...A,color:"var(--graview-ink-muted)",fontStyle:"italic"},children:t.intent})},`change:${g}`):(0,e.jsxs)("li",{"data-batch":t.batch,style:S,children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,e.jsxs)("strong",{style:{fontWeight:600},children:[t.author==="human"&&t.by?.onBehalfOf===void 0&&(t.authorId===void 0||d.id===void 0||t.authorId===d.id)?"you":j(t.by??{kind:t.author,id:t.authorId},{graph:m.graph,schema:m.schema,seats:l,people:r}),C(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",C(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent}),t.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",t.basis]}):null]}),t.batch?(0,e.jsx)(Ie,{seq:t.seq,intent:t.intent}):null,t.batch?(0,e.jsx)(V,{batch:t.batches&&t.batches.length>0?t.batches.length===1?t.batches[0]:t.batches:t.batch}):null]}),(0,e.jsx)("div",{"data-touched":t.touched.join(" "),style:$,children:t.touched.slice(0,4).map(c=>(0,e.jsx)(R,{id:c,label:m.graph.has(c)?b(m,c):t.named?.[c]??b(m,c),go:D(c),testId:"activity-record"},c))})]},`change:${g}`))}):null,(0,e.jsx)(de,{style:{paddingTop:8,borderTop:"1px solid var(--graview-edge)"}}),o?(0,e.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,e.jsx)("span",{children:"Remembered in this browser"}),(0,e.jsx)(Ce,{})]}):null]}):null]})}export{V as a,Ve as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as h}from"./chunk.
|
|
1
|
+
import{G as h}from"./chunk.CYTTZOYL.js";import{Kd as u,Qc as a,bd as m}from"./chunk.Q4MI53KK.js";import{b as l}from"./chunk.AJZBJBMO.js";function f(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],o=[];for(let i of t){let n=i?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!n||m(n)||n.toLowerCase()!==a.toLowerCase()&&(o.includes(n)||o.push(n))}return o}function g(e){let t=f(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(i=>`family=${encodeURIComponent(i).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var r=l(h(),1);function k(e,t){return new u({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.publishing?{publishing:e.publishing}:{},...e.tidying?{tidying:e.tidying}:{},...e.intelligence?{intelligence:e.intelligence}:{},...e.brand?.timeZone?{timeZone:e.brand.timeZone}:{}})}function d(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function v(e,t){let[o,i]=(0,r.useState)(()=>d(t));return(0,r.useEffect)(()=>{if(!e||typeof document>"u")return;let n=()=>i(d(t));n();let s=new MutationObserver(n);s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let c=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return c?.addEventListener?.("change",n),()=>{s.disconnect(),c?.removeEventListener?.("change",n)}},[e,t]),o}export{g as a,k as b,v as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Ry}from"./chunk.
|
|
1
|
+
import{c as Ry}from"./chunk.CGK2PY76.js";import{G as Cy}from"./chunk.CYTTZOYL.js";import{a as an}from"./chunk.AJZBJBMO.js";var Ti=an(J=>{"use strict";function Gf(l,a){var t=l.length;l.push(a);l:for(;0<t;){var u=t-1>>>1,n=l[u];if(0<tn(n,a))l[u]=a,l[t]=n,t=u;else break l}}function Ll(l){return l.length===0?null:l[0]}function nn(l){if(l.length===0)return null;var a=l[0],t=l.pop();if(t!==a){l[0]=t;l:for(var u=0,n=l.length,f=n>>>1;u<f;){var e=2*(u+1)-1,c=l[e],i=e+1,m=l[i];if(0>tn(c,t))i<n&&0>tn(m,c)?(l[u]=m,l[i]=t,u=i):(l[u]=c,l[e]=t,u=e);else if(i<n&&0>tn(m,t))l[u]=m,l[i]=t,u=i;else break l}}return a}function tn(l,a){var t=l.sortIndex-a.sortIndex;return t!==0?t:l.id-a.id}J.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(yi=performance,J.unstable_now=function(){return yi.now()}):(Yf=Date,mi=Yf.now(),J.unstable_now=function(){return Yf.now()-mi});var yi,Yf,mi,Il=[],Aa=[],jy=1,Bl=null,ml=3,Zf=!1,au=!1,tu=!1,Cf=!1,Si=typeof setTimeout=="function"?setTimeout:null,gi=typeof clearTimeout=="function"?clearTimeout:null,hi=typeof setImmediate<"u"?setImmediate:null;function un(l){for(var a=Ll(Aa);a!==null;){if(a.callback===null)nn(Aa);else if(a.startTime<=l)nn(Aa),a.sortIndex=a.expirationTime,Gf(Il,a);else break;a=Ll(Aa)}}function Rf(l){if(tu=!1,un(l),!au)if(Ll(Il)!==null)au=!0,ht||(ht=!0,mt());else{var a=Ll(Aa);a!==null&&jf(Rf,a.startTime-l)}}var ht=!1,uu=-1,bi=5,zi=-1;function Ai(){return Cf?!0:!(J.unstable_now()-zi<bi)}function Qf(){if(Cf=!1,ht){var l=J.unstable_now();zi=l;var a=!0;try{l:{au=!1,tu&&(tu=!1,gi(uu),uu=-1),Zf=!0;var t=ml;try{a:{for(un(l),Bl=Ll(Il);Bl!==null&&!(Bl.expirationTime>l&&Ai());){var u=Bl.callback;if(typeof u=="function"){Bl.callback=null,ml=Bl.priorityLevel;var n=u(Bl.expirationTime<=l);if(l=J.unstable_now(),typeof n=="function"){Bl.callback=n,un(l),a=!0;break a}Bl===Ll(Il)&&nn(Il),un(l)}else nn(Il);Bl=Ll(Il)}if(Bl!==null)a=!0;else{var f=Ll(Aa);f!==null&&jf(Rf,f.startTime-l),a=!1}}break l}finally{Bl=null,ml=t,Zf=!1}a=void 0}}finally{a?mt():ht=!1}}}var mt;typeof hi=="function"?mt=function(){hi(Qf)}:typeof MessageChannel<"u"?(Xf=new MessageChannel,di=Xf.port2,Xf.port1.onmessage=Qf,mt=function(){di.postMessage(null)}):mt=function(){Si(Qf,0)};var Xf,di;function jf(l,a){uu=Si(function(){l(J.unstable_now())},a)}J.unstable_IdlePriority=5;J.unstable_ImmediatePriority=1;J.unstable_LowPriority=4;J.unstable_NormalPriority=3;J.unstable_Profiling=null;J.unstable_UserBlockingPriority=2;J.unstable_cancelCallback=function(l){l.callback=null};J.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):bi=0<l?Math.floor(1e3/l):5};J.unstable_getCurrentPriorityLevel=function(){return ml};J.unstable_next=function(l){switch(ml){case 1:case 2:case 3:var a=3;break;default:a=ml}var t=ml;ml=a;try{return l()}finally{ml=t}};J.unstable_requestPaint=function(){Cf=!0};J.unstable_runWithPriority=function(l,a){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var t=ml;ml=l;try{return a()}finally{ml=t}};J.unstable_scheduleCallback=function(l,a,t){var u=J.unstable_now();switch(typeof t=="object"&&t!==null?(t=t.delay,t=typeof t=="number"&&0<t?u+t:u):t=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=t+n,l={id:jy++,callback:a,priorityLevel:l,startTime:t,expirationTime:n,sortIndex:-1},t>u?(l.sortIndex=t,Gf(Aa,l),Ll(Il)===null&&l===Ll(Aa)&&(tu?(gi(uu),uu=-1):tu=!0,jf(Rf,t-u))):(l.sortIndex=n,Gf(Il,l),au||Zf||(au=!0,ht||(ht=!0,mt()))),l};J.unstable_shouldYield=Ai;J.unstable_wrapCallback=function(l){var a=ml;return function(){var t=ml;ml=a;try{return l.apply(this,arguments)}finally{ml=t}}}});var Mi=an((dd,Ei)=>{"use strict";Ei.exports=Ti()});var Qy=an(qf=>{"use strict";var tl=Mi(),w0=Cy(),Vy=Ry();function A(l){var a="https://react.dev/errors/"+l;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)a+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+l+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function F0(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function Ku(l){var a=l,t=l;if(l.alternate)for(;a.return;)a=a.return;else{l=a;do a=l,(a.flags&4098)!==0&&(t=a.return),l=a.return;while(l)}return a.tag===3?t:null}function $0(l){if(l.tag===13){var a=l.memoizedState;if(a===null&&(l=l.alternate,l!==null&&(a=l.memoizedState)),a!==null)return a.dehydrated}return null}function k0(l){if(l.tag===31){var a=l.memoizedState;if(a===null&&(l=l.alternate,l!==null&&(a=l.memoizedState)),a!==null)return a.dehydrated}return null}function Oi(l){if(Ku(l)!==l)throw Error(A(188))}function xy(l){var a=l.alternate;if(!a){if(a=Ku(l),a===null)throw Error(A(188));return a!==l?null:l}for(var t=l,u=a;;){var n=t.return;if(n===null)break;var f=n.alternate;if(f===null){if(u=n.return,u!==null){t=u;continue}break}if(n.child===f.child){for(f=n.child;f;){if(f===t)return Oi(n),l;if(f===u)return Oi(n),a;f=f.sibling}throw Error(A(188))}if(t.return!==u.return)t=n,u=f;else{for(var e=!1,c=n.child;c;){if(c===t){e=!0,t=n,u=f;break}if(c===u){e=!0,u=n,t=f;break}c=c.sibling}if(!e){for(c=f.child;c;){if(c===t){e=!0,t=f,u=n;break}if(c===u){e=!0,u=f,t=n;break}c=c.sibling}if(!e)throw Error(A(189))}}if(t.alternate!==u)throw Error(A(190))}if(t.tag!==3)throw Error(A(188));return t.stateNode.current===t?l:a}function I0(l){var a=l.tag;if(a===5||a===26||a===27||a===6)return l;for(l=l.child;l!==null;){if(a=I0(l),a!==null)return a;l=l.sibling}return null}var L=Object.assign,py=Symbol.for("react.element"),fn=Symbol.for("react.transitional.element"),mu=Symbol.for("react.portal"),At=Symbol.for("react.fragment"),r0=Symbol.for("react.strict_mode"),Te=Symbol.for("react.profiler"),P0=Symbol.for("react.consumer"),fa=Symbol.for("react.context"),Sc=Symbol.for("react.forward_ref"),Ee=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),gc=Symbol.for("react.memo"),Ta=Symbol.for("react.lazy");Symbol.for("react.scope");var Oe=Symbol.for("react.activity");Symbol.for("react.legacy_hidden");Symbol.for("react.tracing_marker");var Ky=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var Di=Symbol.iterator;function nu(l){return l===null||typeof l!="object"?null:(l=Di&&l[Di]||l["@@iterator"],typeof l=="function"?l:null)}var Ly=Symbol.for("react.client.reference");function De(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Ly?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case At:return"Fragment";case Te:return"Profiler";case r0:return"StrictMode";case Ee:return"Suspense";case Me:return"SuspenseList";case Oe:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case mu:return"Portal";case fa:return l.displayName||"Context";case P0:return(l._context.displayName||"Context")+".Consumer";case Sc:var a=l.render;return l=l.displayName,l||(l=a.displayName||a.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case gc:return a=l.displayName||null,a!==null?a:De(l.type)||"Memo";case Ta:a=l._payload,l=l._init;try{return De(l(a))}catch{}}return null}var hu=Array.isArray,D=w0.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Vy.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ka={pending:!1,data:null,method:null,action:null},Ue=[],Tt=-1;function $l(l){return{current:l}}function fl(l){0>Tt||(l.current=Ue[Tt],Ue[Tt]=null,Tt--)}function x(l,a){Tt++,Ue[Tt]=l.current,l.current=a}var Fl=$l(null),Nu=$l(null),Ba=$l(null),jn=$l(null);function Vn(l,a){switch(x(Ba,a),x(Nu,l),x(Fl,null),a.nodeType){case 9:case 11:l=(l=a.documentElement)&&(l=l.namespaceURI)?B0(l):0;break;default:if(l=a.tagName,a=a.namespaceURI)a=B0(a),l=Ty(a,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}fl(Fl),x(Fl,l)}function Ct(){fl(Fl),fl(Nu),fl(Ba)}function se(l){l.memoizedState!==null&&x(jn,l);var a=Fl.current,t=Ty(a,l.type);a!==t&&(x(Nu,l),x(Fl,t))}function xn(l){Nu.current===l&&(fl(Fl),fl(Nu)),jn.current===l&&(fl(jn),Vu._currentValue=ka)}var Vf,Ui;function Wa(l){if(Vf===void 0)try{throw Error()}catch(t){var a=t.stack.trim().match(/\n( *(at )?)/);Vf=a&&a[1]||"",Ui=-1<t.stack.indexOf(`
|
|
2
2
|
at`)?" (<anonymous>)":-1<t.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
3
|
`+Vf+l+Ui}var xf=!1;function pf(l,a){if(!l||xf)return"";xf=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var z=function(){throw Error()};if(Object.defineProperty(z.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(z,[])}catch(S){var d=S}Reflect.construct(l,[],z)}else{try{z.call()}catch(S){d=S}l.call(z.prototype)}}else{try{throw Error()}catch(S){d=S}(z=l())&&typeof z.catch=="function"&&z.catch(function(){})}}catch(S){if(S&&d&&typeof S.stack=="string")return[S.stack,d.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=u.DetermineComponentFrameRoot(),e=f[0],c=f[1];if(e&&c){var i=e.split(`
|
|
4
4
|
`),m=c.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as a}from"./chunk.
|
|
1
|
+
import{g as a}from"./chunk.AHPYNDVA.js";import{c as l}from"./chunk.FNVGNISQ.js";import{Na as d}from"./chunk.Q4MI53KK.js";function m(n){let r=new Map;for(let i of n.kinds){let e=n.tryDefinition(i),o=a(e),s=d(e);r.set(i,{fields:new Set(Object.keys(e?.fields?.shape??{})),edges:new Map(Object.entries(e?.edges??{}).map(([p,y])=>[p,y.cardinality??"many"])),...o?{computed:o}:{},...s.size>0?{linked:s}:{}})}let t=a(n);return t&&r.set(l,{computed:t}),r}export{m as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Y,b as _,c as D,e as R,h as z,i as q,j as k,k as S,l as N,o as H,p as P}from"./chunk.SMHP2CQH.js";import{b as V}from"./chunk.2KIWGQXC.js";import{G,L as T,T as A,aa as W,bb as F,ga as j,gb as U,ha as B,la as I}from"./chunk.Q4MI53KK.js";function ne(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function oe(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.archived!==void 0&&e.archived!==!1&&(r.archived=String(e.archived)),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(n=>`${n.key}:${n.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function ie(e,r){let n=[],d={};if(e.query&&(d.query=e.query),e.archived!==void 0&&e.archived!==!1&&(d.archived=e.archived),e.sort&&(r.sorts.some(u=>u.key===e.sort.by)?d.sort=e.sort:n.push(`sort ${e.sort.by}`)),e.filter){let u=e.filter.filter(c=>r.filters.find(a=>a.key===c.key)?!0:(n.push(`filter ${c.key}`),!1));u.length>0&&(d.filter=u)}return e.group&&(r.groups.some(u=>u.key===e.group.by)?d.group=e.group:n.push(`group ${e.group.by}`)),{arrangement:d,dropped:n}}function x(e,r){return I(e.schema.tryDefinition(r.kind),k(r))}var se=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function de(e,r,n){if(n==="label")return x(e,r);let d=e.schema.tryDefinition(r.kind);return d&&n in(d.fields.shape??{})?F(q(r),n,e.today??T()):d?.computed?.[n]!==void 0?e.read?.(r,n):S(e.graph,r.id,n).map(c=>x(e,c)).sort()[0]}var ue=/^(\d{4})-(\d{2})-(\d{2})/;function Z(e,r){if(G.test(e)){let[s,i]=[e.slice(0,4),e.slice(5,7)];return r==="year"?`${s}-01-01`:r==="decade"?`${String(Number(s)-Number(s)%10).padStart(4,"0")}-01-01`:r==="month"&&i?`${s}-${i}-01`:e}let n=ue.exec(e);if(!n)return;let[,d,u,c]=n;if(r==="day")return`${d}-${u}-${c}`;if(r==="month")return`${d}-${u}-01`;if(r==="year")return`${d}-01-01`;if(r==="decade")return`${String(Number(d)-Number(d)%10).padStart(4,"0")}-01-01`;let l=new Date(Date.UTC(Number(d),Number(u)-1,Number(c))),a=(l.getUTCDay()+6)%7;return l.setUTCDate(l.getUTCDate()-a),l.toISOString().slice(0,10)}function le(e,r){return G.test(e)?A(e):r==="month"?W(e):r==="week"?`Week of ${A(e)}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:A(e)}function ae(e,r,n){return Q(e,n)(r)}function Q(e,r){let{words:n,conditions:d}=H(r);if(n.length===0&&d.length===0)return()=>!0;let u=new Map,c=l=>{let a=u.get(l);return a||(a=new Set(R(e.schema,l).filters.map(s=>s.key)),u.set(l,a)),a};return l=>{let a=c(l.kind),s=d.filter(i=>a.has(i.key));return s.every(i=>N(e,l,i))?n.length>0?P(e.schema.tryDefinition(l.kind),k(l),n,e.searchIn)!==void 0:s.length>0:!1}}function fe(e,r,n){let d=r.query?.trim(),u=r.archived===void 0?e:e.filter(t=>U(t,r.archived)),c=d?u.filter(Q(n,d)):u,l=r.filter?.length?c.filter(t=>r.filter.every(f=>N(n,t,f))):[...c],a=[];for(let t=r.sort;t&&a.length<4;t=t.then)a.push(t);let s=a.length>0?l.map((t,f)=>({node:t,index:f,values:a.map(o=>de(n,t,o.by))})).sort((t,f)=>{for(let[o,p]of a.entries()){let[b,E]=[t.values[o],f.values[o]],C=se(b,E),M=p.direction==="desc"&&C!==0&&b!==void 0&&E!==void 0?-C:C;if(M!==0)return M}return t.index-f.index}).map(t=>t.node):l,i=r.group;if(!i)return{nodes:s,groups:[{key:"",label:"",nodes:s}],grouped:!1};let y=new Map,g=(t,f,o)=>{let p=y.get(t)??{label:f,nodes:[]};p.nodes.push(o),y.set(t,p)},O=s[0],m=O?n.schema.tryDefinition(O.kind):void 0,L=m?.fields.shape??{},ee=m?Y(m,i.by):j(i.by),$=i.by in L,h=$?_(L[i.by]):void 0,re=D(n.schema,O?.kind??"").find(t=>t.key===i.by)?.label,w=$?`No ${ee.toLowerCase()}`:`Without ${(re??j(i.by)).toLowerCase()}`,K=$?new Map:V([...new Map(s.flatMap(t=>S(n.graph,t.id,i.by)).map(t=>[t.id,t])).values()].map(k),t=>n.schema.tryDefinition(t));for(let t of s){if($){let o=F(q(t),i.by,n.today??T());if(o==null||o==="")g("",w,t);else if(h==="date"){let p=i.bucket??"day",b=Z(String(o),p);b?g(b,le(b,p),t):g("",w,t)}else if(h==="boolean")g(o?"1":"0",o?"Yes":"No",t);else{let p=m?.display?.format?.[i.by];g(String(o),p?p(o):h==="choice"?B(String(o)):String(o),t)}continue}let f=S(n.graph,t.id,i.by).map(o=>({id:o.id,label:K.has(o.id)?`${x(n,o)} \xB7 ${K.get(o.id)}`:x(n,o)})).sort((o,p)=>o.label.localeCompare(p.label));f.length===0?g("",w,t):g(f.map(o=>o.id).join(","),f.map(o=>o.label).join(", "),t)}let v=h==="choice"?z(L[i.by]):void 0,te=[...y.entries()].sort(([t,f],[o,p])=>t===""?1:o===""?-1:v?v.indexOf(t)-v.indexOf(o):h==="boolean"?o.localeCompare(t):h==="date"?t.localeCompare(o):f.label.localeCompare(p.label)).map(([t,f])=>({key:t,label:f.label,nodes:f.nodes}));return{nodes:s,groups:te,grouped:!0}}function J(e){if(e===void 0)return;if(typeof e=="string")return{by:e,direction:"asc"};let r=e.then===void 0?void 0:typeof e.then=="string"?{by:e.then,direction:"asc"}:{by:e.then.by,direction:e.then.direction??"asc"};return{by:e.by,direction:e.direction??"asc",...r?{then:r}:{}}}function X(e){if(e!==void 0)return typeof e=="string"?{by:e}:e}function ce(e){let r=J(e?.sort),n=X(e?.group);if(!(!r&&!n))return{...r?{sort:r}:{},...n?{group:{by:n.by}}:{}}}var pe=(e,r)=>r?e==="1"?"true":"false":e;function ge(e,r,n){let d=n.type==="boolean",u=d?["true","false"]:n.options??[],c=[...new Set([...(r.order??[]).filter(s=>u.includes(s)),...u])],l=r.closed??[],a=s=>{if(s.key==="")return[1,0];let i=pe(s.key,d);if(l.includes(i))return[2,l.indexOf(i)];let y=c.indexOf(i);return[0,y<0?c.length:y]};return e.map((s,i)=>({group:s,at:i,rank:a(s)})).sort((s,i)=>s.rank[0]-i.rank[0]||s.rank[1]-i.rank[1]||s.at-i.at).map(({group:s,rank:i})=>({...s,closed:i[0]===2}))}export{X as a,ce as b,ge as c,ne as d,oe as e,ie as f,ae as g,fe as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as T,c as A,d as m}from"./chunk.
|
|
1
|
+
import{a as T,c as A,d as m}from"./chunk.MT5DXJKN.js";import{P as $,S as x}from"./chunk.Q4MI53KK.js";var I=Symbol.for("@graview/core:file"),j=Symbol.for("@graview/core:node-ref"),y=e=>typeof e=="object"&&e!==null?e._zod?.def:void 0;function k(e){let t=y(e);return t?.[I]??(t?.innerType?k(t.innerType):void 0)}function F(e){let t=k(e);if(t)return{as:t,list:!1};let n=y(e);for(;n?.innerType;)n=y(n.innerType);let i=n?.type==="array"?k(n.element):void 0;return i?{as:i,list:!0}:void 0}function M(e){if(typeof e!="object"||e===null)return;let t=e[j];if(t)return t;let n=y(e);return n?.[j]??(n?.innerType?M(n.innerType):void 0)}function z(e){let t=e?.shape??{};return Object.entries(t).flatMap(([n,i])=>{let s=M(i);return s?[{name:n,kinds:s}]:[]})}var R=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.href=="string"&&typeof e.name=="string"&&typeof e.type=="string"&&typeof e.bytes=="number",C=e=>(Array.isArray(e)?e:[e]).filter(R);function O(e,t,n){let s=e.schema.tryDefinition(t)?.fields?.shape?.[n];return s===void 0?void 0:F(s)}function D(e,t){if(e===void 0)return[];if(!Array.isArray(e))return[`The view's accepts is a list of { "kind": <a kind>, "field": <its image, video or file field> }.`];let n=[],i=new Set(t.schema.kinds);for(let s of e){let{kind:l,field:r}=s??{};typeof l!="string"||typeof r!="string"?n.push(`Each of the view's accepts is { "kind": <a kind>, "field": <its image, video or file field> }.`):i.has(l)?O(t,l,r)?t.allMutations().some(d=>(d.creates??[]).includes(l)&&Object.hasOwn(d.input?.shape??{},r))||n.push(`No act of this app makes a "${l}" with its "${r}", so a file dropped could become nothing.`):n.push(`The view accepts files into ${l}'s "${r}", which holds no picture, video or file.`):n.push(`The view accepts files for "${l}", which is no kind of this app.`)}return n}function N(e,t,n){if(e===void 0||e===!0)return[];let i=`The view's pictures is true; the kinds whose pictures it draws, ["circuit"]; or { "width": <the widest it draws a picture, in pixels> } with the fields it draws them from, by kind, { "circuit": "photo" }.`;if(typeof e!="object"||e===null)return[i];let s=new Set([...n.attach==="home"?[]:[n.attach],...n.reads?.kinds??[]]),l=new Set(t.schema.kinds),r=[],d=a=>{if(!l.has(a))return void r.push(`The view's pictures chooses "${a}", which is no kind of this app.`);s.has(a)||r.push(`The view's pictures chooses "${a}", whose records it is not handed: add "${a}" to its reads.kinds.`)};if(Array.isArray(e)){if(e.length===0||!e.every(a=>typeof a=="string"))return[i];for(let a of e)d(a);return r}for(let[a,c]of Object.entries(e)){if(a==="width"&&typeof c!="string"&&!Array.isArray(c)){Number.isInteger(c)&&c>=16&&c<=4096||r.push("The view's pictures width is a whole number of pixels from 16 to 4096.");continue}let p=typeof c=="string"?[c]:Array.isArray(c)&&c.length>0&&c.every(u=>typeof u=="string")?c:void 0;if(!p){r.push(`The view's pictures says "${a}": beside "width", it names a kind and the field it draws pictures from, "circuit": "photo", or its fields, "circuit": ["photo", "map"].`);continue}let g=r.length;if(d(a),!(r.length>g))for(let u of p){let f=O(t,a,u);f?f.as==="video"&&r.push(`The view's pictures chooses ${a}'s "${u}", which holds videos: the host plays a video where the view places it, and hands no picture of it.`):r.push(`The view's pictures chooses ${a}'s "${u}", which holds no picture.`)}}return r}function H(e){if(e===void 0)return[];if(typeof e!="object"||e===null||Array.isArray(e))return[`The view's scene is { "maxHeight": <the tallest its preview on the Scene is drawn, in pixels> }.`];let{maxHeight:t,...n}=e,i=[];return Object.keys(n).length>0&&i.push(`The view's scene says ${Object.keys(n).map(s=>`"${s}"`).join(", ")}: only "maxHeight" is read.`),t!==void 0&&!(Number.isInteger(t)&&t>=80&&t<=4e3)&&i.push("The view's scene maxHeight is a whole number of pixels from 80 to 4000."),i}function V(e){return(e.acts??[]).map(t=>typeof t=="string"?{act:t}:t)}function J(e,t){let n=[],i=new Set(t.schema.kinds),s=new Set(t.schema.edgeKinds),l=new Set(t.allMutations().map(d=>d.name));(typeof e.name!="string"||!/^[a-z0-9][a-z0-9-]{0,62}$/.test(e.name))&&n.push(`The view's name "${String(e.name)}" is not lower-case letters, digits and hyphens.`),e.title!==void 0&&(typeof e.title!="string"||e.title.trim()===""||e.title.length>80)&&n.push("The view's title is empty or longer than 80 characters."),e.attach!=="home"&&!i.has(e.attach)&&n.push(`The view attaches to "${e.attach}", which is no kind of this app.`),e.cardinality!=="one"&&e.cardinality!=="many"&&n.push(`The view's cardinality is "${String(e.cardinality)}", not one or many.`),e.attach==="home"&&e.cardinality!=="many"&&n.push("A view of the home draws many records: its cardinality is many."),e.replaces!==void 0&&e.replaces!=="page"?n.push(`The view's replaces is "${String(e.replaces)}": the one thing a view replaces is "page", or leave it out to draw the view above the record's own fields.`):e.replaces==="page"&&e.attach==="home"&&n.push(`The home's view is the home already: replaces "page" is for a view of a kind, of one record (its page) or of many (its list).`),e.gestures!==void 0&&typeof e.gestures!="boolean"&&n.push(`The view's gestures is "${String(e.gestures)}": it is true, or left out.`),e.bleed!==void 0&&typeof e.bleed!="boolean"&&n.push(`The view's bleed is "${String(e.bleed)}": it is true, or left out.`),e.heading!==void 0&&(e.heading!=="own"||e.attach==="home"||e.cardinality!=="many"||e.title===void 0)&&n.push(`The view's heading is "${String(e.heading)}": it is "own" on a view that is a place (a title, cardinality many), or left out.`),e.flows!==void 0&&typeof e.flows!="boolean"?n.push(`The view's flows is "${String(e.flows)}": it is false for a view that keeps its place's frame, or left out.`):e.flows===!1&&(e.attach==="home"||e.cardinality!=="many"||e.title===void 0)&&n.push("Only a view that is a place keeps a frame: flows false needs a title and cardinality many on a kind."),n.push(...H(e.scene)),e.scene!==void 0&&(e.attach==="home"||e.cardinality!=="many")&&n.push("Only a view of a kind's members is drawn on the Scene as a card: scene needs cardinality many on a kind."),n.push(...N(e.pictures,t,e)),n.push(...D(e.accepts,t));for(let d of e.reads?.kinds??[])i.has(d)||n.push(`The view reads "${d}", which is no kind of this app.`);for(let d of e.reads?.edges??[])s.has(d)||n.push(`The view reads the edge "${d}", which no kind of this app declares.`);let r=new Set;for(let d of V(e)){l.has(d.act)||n.push(`The view asks for the act "${d.act}", which this app does not declare.`);let a=d.as??d.act;r.has(a)&&n.push(`Two of the view's acts are called "${a}".`),r.add(a)}return n}function _(e,t,n){let i=[...new Set([...t.attach==="home"?[]:[t.attach],...t.reads?.kinds??[]])];if(i.length<2)return[];let s=new Set(t.reads?.edges??[]),l=r=>new RegExp(`(["'\`])${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\1`).test(n);return e.schema.edgeKinds.filter(r=>{let d=e.schema.edge(r);return!s.has(r)&&d!==void 0&&d.from.some(a=>i.includes(a))&&(d.to==="*"||d.to.some(a=>i.includes(a)))&&l(r)})}function Q(e,t,n){let i=_(e,t,n);if(i.length===0)return;let s=(l,r)=>l.length<2?l[0]??"":`${l.slice(0,-1).join(", ")} ${r} ${l[l.length-1]}`;return`"${t.name}" names ${s(i,"and")} but does not read ${i.length>1?"them":"it"}, so the view is handed no such links: add ${s(i.map(l=>`"${l}"`),"and")} to its manifest's reads.edges.`}function U(e,t){return[...t.attach==="home"?[]:[t.attach],...t.reads?.kinds??[]].some(i=>Object.keys(e.schema.tryDefinition(i)?.computed??{}).length>0)}function X(e,t,n){let{manifest:i}=n,s=n.input??{},r=e.seenBy(t).graph,d=i.attach==="home"?void 0:i.attach,a=d&&i.cardinality==="one"&&s.node?r.getNode(s.node.id):void 0,c=a&&a.kind===d?[a]:[],p=d&&i.cardinality==="many"?s.nodes?s.nodes.flatMap(o=>{let h=r.getNode(o.id);return h&&h.kind===d?[h]:[]}):r.nodesOfKind(d):[],g=new Set([...c,...p].map(o=>o.id)),u=T(r,g,{kinds:(i.reads?.kinds??[]).filter(o=>o!==d||i.cardinality==="one"),edges:i.reads?.edges??[]}),f=new Map;for(let o of[...p,...u.nodes])c.some(h=>h.id===o.id)||f.set(o.id,o);let P=new Set([...c.map(o=>o.id),...f.keys()]),G=[...u.edges],K=new Set(V(i).map(o=>o.act)),W=e.permittedMutations(t).filter(o=>K.has(o.name)).map(o=>({name:o.name,title:o.title??o.name,...o.description!==void 0?{description:o.description}:{},...o.subject?{subject:{kinds:o.subject.kinds,arg:o.subject.arg}}:{}})),b=o=>o?.filter(h=>P.has(h)),S=n.computed,v=o=>S?{...m(e,o),...S(r,o)}:m(e,o);return{view:i.name,...c[0]?{node:v(c[0])}:{},nodes:[...f.values()].map(v),edges:G,...i.title!==void 0?{label:i.title}:s.label!==void 0?{label:s.label}:{},cardinality:i.cardinality,...s.fidelity!==void 0?{fidelity:s.fidelity}:{},...s.mode!==void 0?{mode:s.mode}:{},...s.selected!==void 0?{selected:s.selected}:{},...s.implicated?{implicated:b(s.implicated)}:{},...s.flagged?{flagged:b(s.flagged)}:{},acts:W,...n.theme?{theme:n.theme}:{},locale:$(),timeZone:x(),...A(e.schema,[...c,...f.values()]),...n.places?{places:n.places.filter((o,h,w)=>w.findIndex(E=>E.as===o.as)===h).map(({as:o,title:h,kind:w})=>({as:o,title:h,kind:w}))}:{}}}export{z as a,R as b,C as c,O as d,V as e,J as f,_ as g,Q as h,U as i,X as j};
|