graview 0.1.30 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/preview/chunk.26LLZN3C.js +1 -0
- package/dist/preview/chunk.2NIOHEMX.js +1 -0
- package/dist/preview/chunk.2WPZXIRP.js +2 -0
- package/dist/preview/{chunk.XRJBLH4N.js → chunk.3AGY4QVS.js} +1 -1
- package/dist/preview/chunk.3HXN4BOY.js +1 -0
- package/dist/preview/{chunk.2CIBWZJG.js → chunk.3K6YSVHC.js} +1 -1
- package/dist/preview/chunk.3NDH3EDN.js +47 -0
- package/dist/preview/{chunk.FWCOJDOD.js → chunk.3TVXGJTU.js} +1 -1
- package/dist/preview/{chunk.NDADLJE6.js → chunk.3TY5NFLY.js} +1 -1
- package/dist/preview/{chunk.UWGWXFWZ.js → chunk.47STJVRV.js} +1 -1
- package/dist/preview/{chunk.X37L5TN5.js → chunk.4HNG4UXT.js} +1 -1
- package/dist/preview/{chunk.34ZMMURV.js → chunk.4HRAQNJO.js} +6 -6
- package/dist/preview/{chunk.QTMWHE5O.js → chunk.4HZ7QTXZ.js} +1 -1
- package/dist/preview/{chunk.3JGGBLRB.js → chunk.4MERAWS2.js} +1 -1
- package/dist/preview/chunk.52W7WYME.js +1 -0
- package/dist/preview/chunk.5A4AOFOA.js +1 -0
- package/dist/preview/chunk.5H4VXLZF.js +88 -0
- package/dist/preview/{chunk.XS7YFNDU.js → chunk.5T5XGILP.js} +1 -1
- package/dist/preview/chunk.5UL7YDUD.js +1 -0
- package/dist/preview/chunk.63GXY2ME.js +1 -0
- package/dist/preview/chunk.67TPUXAY.js +1 -0
- package/dist/preview/chunk.6QWV5MVH.js +25 -0
- package/dist/preview/{chunk.PAVR5TK5.js → chunk.6UGEYZAC.js} +1 -1
- package/dist/preview/chunk.6YCBYL2Y.js +2 -0
- package/dist/preview/{chunk.ZYKAS4BT.js → chunk.7GKUVQVF.js} +1 -1
- package/dist/preview/{chunk.T3VPD7JQ.js → chunk.7T7NZZTC.js} +1 -1
- package/dist/preview/chunk.AKFKM4SW.js +3 -0
- package/dist/preview/chunk.AOSMJKLH.js +1 -0
- package/dist/preview/{chunk.DT7LHWU2.js → chunk.AR3DCDHU.js} +1 -1
- package/dist/preview/{chunk.D3IECJ2S.js → chunk.ASCLIM2P.js} +1 -1
- package/dist/preview/chunk.B2GLDIAS.js +1 -0
- package/dist/preview/chunk.BHXGM3PV.js +1 -0
- package/dist/preview/chunk.BNV77BQZ.js +4 -0
- package/dist/preview/chunk.BQ3JHEHV.js +1 -0
- package/dist/preview/chunk.CAVBSL27.js +1 -0
- package/dist/preview/{chunk.YLQB3KBA.js → chunk.CDP2XL66.js} +1 -1
- package/dist/preview/chunk.CIPS2OGR.js +1 -0
- package/dist/preview/chunk.CN3UEF5N.js +90 -0
- package/dist/preview/{chunk.6XMEU2Q2.js → chunk.COQKECUH.js} +1 -1
- package/dist/preview/{chunk.QTA4ROAK.js → chunk.CWHRDBOF.js} +1 -1
- package/dist/preview/chunk.CX3KL2C5.js +1 -0
- package/dist/preview/{chunk.AK3IHFCF.js → chunk.D75KC3LL.js} +1 -1
- package/dist/preview/chunk.DAZ2VSRD.js +1 -0
- package/dist/preview/{chunk.3ADPAGPY.js → chunk.DYSPCGXX.js} +1 -1
- package/dist/preview/chunk.E2YEOMPH.js +1 -0
- package/dist/preview/chunk.EBGAYL32.js +1 -0
- package/dist/preview/chunk.EF3XNU4O.js +1 -0
- package/dist/preview/chunk.EJPI3ST6.js +1 -0
- package/dist/preview/chunk.EKPRNDUV.js +1 -0
- package/dist/preview/chunk.ERIT3R6N.js +1 -0
- package/dist/preview/chunk.EYTBDMTW.js +1 -0
- package/dist/preview/{chunk.HHPGWJDO.js → chunk.FWTIUYXH.js} +1 -1
- package/dist/preview/{chunk.6T2Q6NLO.js → chunk.G5NZVPJU.js} +1 -1
- package/dist/preview/chunk.GBRRGTIH.js +1 -0
- package/dist/preview/{chunk.VG56IUIQ.js → chunk.GO4XBWJO.js} +1 -1
- package/dist/preview/chunk.GV2CQVKV.js +1 -0
- package/dist/preview/chunk.GYICGZMG.js +3 -0
- package/dist/preview/chunk.H7BST3XO.js +1 -0
- package/dist/preview/chunk.H7EPE74C.js +1 -0
- package/dist/preview/{chunk.26CZTUY4.js → chunk.HAIG6NVX.js} +1 -1
- package/dist/preview/{chunk.V7BDAGDE.js → chunk.HLTRQU4Y.js} +1 -1
- package/dist/preview/{chunk.VS7K3SCD.js → chunk.I6FPNX43.js} +1 -1
- package/dist/preview/chunk.IDVAR5HM.js +1 -0
- package/dist/preview/{chunk.3URFMWXZ.js → chunk.IWQCOGHW.js} +2 -2
- package/dist/preview/chunk.J25KOSNW.js +1 -0
- package/dist/preview/chunk.JDUJDAGA.js +1 -0
- package/dist/preview/chunk.JOOQUWLT.js +341 -0
- package/dist/preview/{chunk.4SJUTBDV.js → chunk.JQU5GEU3.js} +1 -1
- package/dist/preview/chunk.K5ME5GCG.js +1 -0
- package/dist/preview/chunk.KSES5U5B.js +1 -0
- package/dist/preview/chunk.KSXB4LDF.js +1 -0
- package/dist/preview/chunk.LR3VDXPI.js +1 -0
- package/dist/preview/{chunk.WYTIOLPP.js → chunk.LXBOVRFI.js} +1 -1
- package/dist/preview/{chunk.42YX6NOY.js → chunk.MAF7C3VM.js} +1 -1
- package/dist/preview/chunk.MNP4JI33.js +5 -0
- package/dist/preview/{chunk.O2LK2AO7.js → chunk.MWGGV7DE.js} +1 -1
- package/dist/preview/chunk.N6OX4NEQ.js +1 -0
- package/dist/preview/chunk.NRAYZY3X.js +1 -0
- package/dist/preview/chunk.NTF7FVB2.js +1 -0
- package/dist/preview/{chunk.DZRTOURR.js → chunk.OC6IWRQ3.js} +1 -1
- package/dist/preview/chunk.OJGHDWI6.js +1 -0
- package/dist/preview/chunk.OKRNJXTV.js +1 -0
- package/dist/preview/chunk.PBSMLINK.js +1 -0
- package/dist/preview/chunk.PHKSMUIA.js +1 -0
- package/dist/preview/{chunk.JN7DIFR3.js → chunk.PIP6Z563.js} +1 -1
- package/dist/preview/chunk.QVVJRSRM.js +1 -0
- package/dist/preview/{chunk.L6OMEYL6.js → chunk.QYZNAUIR.js} +1 -1
- package/dist/preview/chunk.R6K6GF5R.js +1 -0
- package/dist/preview/{chunk.JTNWD2CN.js → chunk.RCKTBOY2.js} +1 -1
- package/dist/preview/{chunk.QNGWEV47.js → chunk.RIJUCHP4.js} +1 -1
- package/dist/preview/chunk.SHTJZ6UX.js +1 -0
- package/dist/preview/{chunk.PKK6FRZR.js → chunk.SYAEBGDC.js} +1 -1
- package/dist/preview/chunk.T5VG5A6V.js +1 -0
- package/dist/preview/{chunk.ERXSYPYL.js → chunk.TAQ764IQ.js} +1 -1
- package/dist/preview/{chunk.RIEHYQLK.js → chunk.TMVCTBAD.js} +50 -24
- package/dist/preview/{chunk.HHI65WFZ.js → chunk.UATVTXZY.js} +1 -1
- package/dist/preview/{chunk.XSTXV6FP.js → chunk.UBFNZMUX.js} +2 -2
- package/dist/preview/{chunk.WAFDCOOG.js → chunk.UGFJKSHU.js} +1 -1
- package/dist/preview/chunk.UHUGOTUU.js +19 -0
- package/dist/preview/chunk.ULRW47RP.js +1 -0
- package/dist/preview/chunk.UNL2HIF2.js +1 -0
- package/dist/preview/chunk.UVR2Z5ZC.js +1 -0
- package/dist/preview/chunk.UZGRRDHD.js +1 -0
- package/dist/preview/{chunk.BPWNWE7N.js → chunk.VG3O4LWB.js} +1 -1
- package/dist/preview/chunk.WAZ7OGBD.js +1 -0
- package/dist/preview/{chunk.3JNMSOFG.js → chunk.XANVHJQ4.js} +1 -1
- package/dist/preview/chunk.XBJYQNVE.js +1 -0
- package/dist/preview/chunk.XKABS745.js +1 -0
- package/dist/preview/chunk.XMC7YDWT.js +1 -0
- package/dist/preview/chunk.XNJEFUF7.js +3 -0
- package/dist/preview/chunk.Y2SFUALD.js +117 -0
- package/dist/preview/chunk.Y6ZNFQK3.js +6 -0
- package/dist/preview/{chunk.J2ITFGN3.js → chunk.YIR7PPF3.js} +1 -1
- package/dist/preview/index.html +51 -0
- package/dist/preview/page.js +6 -6
- package/package.json +6 -6
- package/dist/preview/chunk.2EXGG6BB.js +0 -1
- package/dist/preview/chunk.2NBYNZRD.js +0 -1
- package/dist/preview/chunk.2XAONC66.js +0 -1
- package/dist/preview/chunk.3R4W2P5X.js +0 -1
- package/dist/preview/chunk.3SKKIHU3.js +0 -4
- package/dist/preview/chunk.3VL5WECB.js +0 -1
- package/dist/preview/chunk.4ALKPNXM.js +0 -1
- package/dist/preview/chunk.4HP7UWA2.js +0 -1
- package/dist/preview/chunk.5U5J3ISK.js +0 -1
- package/dist/preview/chunk.6V2RG5JG.js +0 -5
- package/dist/preview/chunk.7BWT5L2L.js +0 -1
- package/dist/preview/chunk.C5CYZNSJ.js +0 -1
- package/dist/preview/chunk.CM6LOIQE.js +0 -88
- package/dist/preview/chunk.FDELO7NY.js +0 -116
- package/dist/preview/chunk.FGVKJWNS.js +0 -6
- package/dist/preview/chunk.GFF2FB2J.js +0 -25
- package/dist/preview/chunk.GLBHQFJ2.js +0 -1
- package/dist/preview/chunk.HSCTWAUV.js +0 -1
- package/dist/preview/chunk.INZUEWC5.js +0 -1
- package/dist/preview/chunk.JH6MU6TX.js +0 -2
- package/dist/preview/chunk.JISMMIMX.js +0 -1
- package/dist/preview/chunk.JPHNKWTY.js +0 -1
- package/dist/preview/chunk.K75FUIZI.js +0 -1
- package/dist/preview/chunk.K776HO42.js +0 -2
- package/dist/preview/chunk.KN3ULTGF.js +0 -1
- package/dist/preview/chunk.KOB6N3SL.js +0 -1
- package/dist/preview/chunk.KQT7WAQE.js +0 -1
- package/dist/preview/chunk.L4DECHXR.js +0 -327
- package/dist/preview/chunk.LQ7V6KEE.js +0 -1
- package/dist/preview/chunk.MD74YVRN.js +0 -3
- package/dist/preview/chunk.MGNP4LAM.js +0 -1
- package/dist/preview/chunk.NCTOBUCT.js +0 -1
- package/dist/preview/chunk.NO52VON3.js +0 -1
- package/dist/preview/chunk.OAF7TUMI.js +0 -1
- package/dist/preview/chunk.OQ4KFN6W.js +0 -1
- package/dist/preview/chunk.OQDETV4X.js +0 -1
- package/dist/preview/chunk.OXQMNIRO.js +0 -1
- package/dist/preview/chunk.OZNW5W4Z.js +0 -1
- package/dist/preview/chunk.QIAKO27D.js +0 -1
- package/dist/preview/chunk.R26DREVU.js +0 -1
- package/dist/preview/chunk.RI3PYG5T.js +0 -19
- package/dist/preview/chunk.RRVIXV7W.js +0 -1
- package/dist/preview/chunk.RYT5U3QM.js +0 -1
- package/dist/preview/chunk.SE5SKFQH.js +0 -1
- package/dist/preview/chunk.SOBC3CTN.js +0 -47
- package/dist/preview/chunk.SOD3PBJM.js +0 -1
- package/dist/preview/chunk.UDSEJKCY.js +0 -1
- package/dist/preview/chunk.UZWWDAGM.js +0 -14
- package/dist/preview/chunk.V5ZYUVMH.js +0 -1
- package/dist/preview/chunk.VOAZBHCG.js +0 -1
- package/dist/preview/chunk.VSZQXB4Q.js +0 -3
- package/dist/preview/chunk.W3S6UXNA.js +0 -1
- package/dist/preview/chunk.Y4UXEL6Y.js +0 -1
- package/dist/preview/chunk.YJUB4OD7.js +0 -1
- package/dist/preview/chunk.YNQDVGZM.js +0 -1
- package/dist/preview/chunk.YV2LJFGS.js +0 -1
- package/dist/preview/chunk.Z2YUYZT4.js +0 -1
- /package/dist/preview/{chunk.EYZ7MHBZ.js → chunk.GZHZLJBF.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.XDYAG276.js";import{a as xe}from"./chunk.HJCQ6I3S.js";import{c as he}from"./chunk.O2LK2AO7.js";import{a as je,b as Ee,c as Ie,d as Re}from"./chunk.4SJUTBDV.js";import"./chunk.3VL5WECB.js";import"./chunk.JH6MU6TX.js";import"./chunk.WAFDCOOG.js";import{G as Ke,R as Pe}from"./chunk.GFF2FB2J.js";import"./chunk.6V2RG5JG.js";import{b as pe}from"./chunk.AJZBJBMO.js";var P=pe(Ke(),1);var E=.5,fe=1,ye=.76,Le=3,We=3,Ae=.6;function Oe(c){let{ribbons:m,plots:u,cell:i}=c,a=c.tilt??.5,g=c.labels??[],b=[...u.values()],k=new Map;if(b.length===0||i<=0)return k;let L=Math.min(...b.map(n=>n.col))-3,A=Math.min(...b.map(n=>n.row))-3,G=Math.max(...b.map(n=>n.col+n.side))+3,ce=Math.max(...b.map(n=>n.row+n.side))+3,h=Math.round((G-L)/E)+1,p=Math.round((ce-A)/E)+1,N=n=>L+n*E,B=n=>A+n*E,I=4,_=!0,C=(n,e)=>{if(!_)return!1;let t=he(n,e,i,a);return g.some(s=>t.x>s.x-I&&t.x<s.x+s.width+I&&t.y>s.y-I&&t.y<s.y+s.height+I)},H=(n,e)=>b.some(t=>n>t.col-ye&&n<t.col+t.side+ye&&e>t.row-ye&&e<t.row+t.side+ye),F=new Uint8Array(h*p),J=new Uint8Array(h*p);for(let n=0;n<h;n++)for(let e=0;e<p;e++){let t=N(n),s=B(e);J[e*h+n]=H(t,s)?0:1,F[e*h+n]=J[e*h+n]&&!C(t,s)?1:0}let Q=F,se=new Float32Array(h*p);for(let n=0;n<h;n++)for(let e=0;e<p;e++){let t=N(n),s=B(e);se[e*h+n]=Math.min(...b.map(o=>Math.max(0,o.col-t,t-(o.col+o.side),o.row-s,s-(o.row+o.side))))}let Z=(n,e,t,s)=>{let o=N(n)+t*E/2,l=B(e)+s*E/2;return!H(o,l)&&!C(o,l)},ue=n=>{let e=[],t=(o,l)=>{let w=[],d=Math.min(1,l/3);for(let y=Math.ceil((o+d)/E-1e-9)*E;y<=o+l-d+1e-9;y+=E)w.push(y);return w},s=(o,l,w,d)=>{let y=Math.round((o-L)/E),r=Math.round((l-A)/E);y>=0&&r>=0&&y<h&&r<p&&Q[r*h+y]&&e.push({i:y,j:r,out:w,curb:d})};for(let o of t(n.row,n.side))s(n.col-fe,o,1,{col:n.col,row:o}),s(n.col+n.side+fe,o,0,{col:n.col+n.side,row:o});for(let o of t(n.col,n.side))s(o,n.row-fe,3,{col:o,row:n.row}),s(o,n.row+n.side+fe,2,{col:o,row:n.row+n.side});return e},ee=new Map,V=(n,e,t,s)=>n<t||n===t&&e<s?`${n},${e}-${t},${s}`:`${t},${s}-${n},${e}`,de=[[1,0],[-1,0],[0,1],[0,-1]],X=new Map;for(let n of m){let e=u.get(n.from),t=u.get(n.to);if(!e||!t||e===t)continue;let s=-1,o=[],l=new Map,w=new Int32Array(0),d=1/0,y=[];for(let f of[!0,!1]){s=-1,d=1/0,_=f,Q=f?F:J,o=ue(e);let W=ue(t);if(o.length===0||W.length===0){y.push({reached:-1,starts:o,goal:l,back:w,best:d});continue}l=new Map(W.map(j=>[j.j*h+j.i,j]));let ne=(j,R)=>{let re=N(j),ae=B(R);return(Math.max(0,t.col-re,re-(t.col+t.side))+Math.max(0,t.row-ae,ae-(t.row+t.side)))*Ae},oe=h*p*4,ie=new Float64Array(oe).fill(1/0);w=new Int32Array(oe).fill(-1);let le=new ke;for(let j of o){let R=(j.j*h+j.i)*4+j.out;ie[R]=0,le.push(R,ne(j.i,j.j))}let Ce=[1,0,3,2];for(;le.size>0&&!(le.peekKey()>=d);){let R=le.pop(),re=Math.floor(R/4),ae=R%4,ge=re%h,we=Math.floor(re/h),ve=l.get(re);if(ve){let q=ie[R]+(ae===Ce[ve.out]?0:Le);q<d&&(d=q,s=R);continue}for(let q=0;q<4;q++){let[Me,$e]=de[q],U=ge+Me,z=we+$e;if(U<0||z<0||U>=h||z>=p||!Q[z*h+U]||!Z(ge,we,Me,$e))continue;let Te=E*(ee.has(V(ge,we,U,z))?Ae:1)*(1+Math.max(0,se[z*h+U]-We))+(q===ae?0:Le),me=(z*h+U)*4+q,be=ie[R]+Te;be<ie[me]&&(ie[me]=be,w[me]=R,le.push(me,be+ne(U,z)))}}y.push({reached:s,starts:o,goal:l,back:w,best:d})}_=!0,Q=F;let[r,v]=y,M=r&&r.reached!==-1&&(!v||v.reached===-1||r.best<=1.3*v.best+2)?r:v;if(!M||M.reached===-1)continue;({reached:s,starts:o,goal:l,back:w}=M);let x=[];for(let f=s;f!==-1;f=w[f]){let W=Math.floor(f/4),ne=x[x.length-1],oe={i:W%h,j:Math.floor(W/h)};(!ne||ne.i!==oe.i||ne.j!==oe.j)&&x.push(oe)}x.reverse();for(let f=1;f<x.length;f++){let W=V(x[f-1].i,x[f-1].j,x[f].i,x[f].j);ee.set(W,[...ee.get(W)??[],n.key])}let D=o.find(f=>f.i===x[0].i&&f.j===x[0].j),$=l.get(x[x.length-1].j*h+x[x.length-1].i);X.set(n.key,{cells:x,start:D.curb,end:$.curb})}let O=new Map(m.map(n=>[n.key,n.width])),T=new Map(m.map((n,e)=>[n.key,e])),te=i*a/Math.sqrt(1+a*a),Y=(n,e)=>n==="col"?`r${e.row.toFixed(2)}`:`c${e.col.toFixed(2)}`,K=new Map;for(let[n,e]of X)for(let t=1;t<e.cells.length;t++){let s=e.cells[t-1],o=e.cells[t],l=Y(s.i!==o.i?"col":"row",{col:N(s.i),row:B(s.j)});K.set(l,(K.get(l)??new Set).add(n))}for(let[n,e]of X){let t=[e.start,...e.cells.map(r=>({col:N(r.i),row:B(r.j)})),e.end],s=r=>r>=2&&r<=e.cells.length?V(e.cells[r-2].i,e.cells[r-2].j,e.cells[r-1].i,e.cells[r-1].j):null,o=[];for(let r=1;r<t.length;r++){let v=Math.abs(t[r].col-t[r-1].col)>1e-9?"col":"row",M=o[o.length-1];M&&M.axis===v?M.to=r:o.push({from:r-1,to:r,axis:v})}if(o.length===0)continue;let l=o.map(r=>{if(!Array.from({length:r.to-r.from},($,f)=>s(r.from+1+f)).some($=>$!==null))return 0;let v=K.get(Y(r.axis,t[r.from]))??new Set;if(!v.has(n))return 0;let M=[...v].sort(($,f)=>(T.get($)??0)-(T.get(f)??0)),D=-(M.reduce(($,f)=>$+(O.get(f)??2)+2,0)-2)/2;for(let $ of M){if($===n)return(D+(O.get($)??2)/2)/te;D+=(O.get($)??2)+2}return 0}),w=r=>{let v=o[r],M=t[v.from];return v.axis==="col"?{row:M.row+l[r]}:{col:M.col+l[r]}},d=(r,v,M)=>({col:r.col??v.col??M.col,row:r.row??v.row??M.row}),y=[d(w(0),{},t[0])];for(let r=0;r+1<o.length;r++)y.push(d(w(r),w(r+1),t[o[r].to]));y.push(d(w(o.length-1),{},t[t.length-1])),k.set(n,y.map(r=>he(r.col,r.row,i,a)))}return k}var ke=class{items=[];keys=[];get size(){return this.items.length}peekKey(){return this.keys[0]??1/0}push(m,u){this.items.push(m),this.keys.push(u);let i=this.items.length-1;for(;i>0;){let a=i-1>>1;if(this.keys[a]<=this.keys[i])break;this.swap(i,a),i=a}}pop(){let m=this.items[0],u=this.items.pop(),i=this.keys.pop();if(this.items.length>0){this.items[0]=u,this.keys[0]=i;let a=0;for(;;){let g=2*a+1,b=g+1,k=a;if(g<this.items.length&&this.keys[g]<this.keys[k]&&(k=g),b<this.items.length&&this.keys[b]<this.keys[k]&&(k=b),k===a)break;this.swap(a,k),a=k}}return m}swap(m,u){[this.items[m],this.items[u]]=[this.items[u],this.items[m]],[this.keys[m],this.keys[u]]=[this.keys[u],this.keys[m]]}};function Se(c,m){let u=c.col+c.side,i=u+.25+.22*Math.max(0,m),a=c.row+c.side*Math.max(.1,.3-.06*m),g=c.row+c.side*Math.min(.9,.7+.06*m);return[{col:u,row:a},{col:i,row:a},{col:i,row:g},{col:u,row:g}]}function Be(c,m){return c.map(u=>he(u.col,u.row,m.cell,m.tilt))}function Fe(c){return c.map((m,u)=>`${u===0?"M":"L"} ${m.x.toFixed(1)} ${m.y.toFixed(1)}`).join(" ")}function Ne(c){if(c.length===0)return{x:0,y:0};let m=0;for(let i=1;i<c.length;i++)m+=Math.hypot(c[i].x-c[i-1].x,c[i].y-c[i-1].y);let u=m/2;for(let i=1;i<c.length;i++){let a=c[i-1],g=c[i],b=Math.hypot(g.x-a.x,g.y-a.y);if(b>=u&&b>0)return{x:a.x+(g.x-a.x)*u/b,y:a.y+(g.y-a.y)*u/b};u-=b}return c[c.length-1]}var S=pe(Pe(),1);function Ue({frame:c,width:m,height:u,pan:i,store:a,graphVersion:g,selection:b,view:k,emphasis:L,hiddenKinds:A,drawn:G}){let[ce,h]=(0,P.useState)(null),p=c.city,N=e=>a.graph.getNode(e)?.kind,B=(0,P.useMemo)(()=>je(a.graph.allEdges(),e=>a.graph.getNode(e)?.kind),[a,g]),I=new Map;for(let e of c.nodes){let t=e.id.startsWith("kind:")?Ie(e.id):null;t!==null&&e.plot&&Math.round(e.plane)===2&&I.set(t,e.plot)}let _=[...I].map(([e,t])=>`${e}:${t.col},${t.row},${t.side}`).join(";"),C=p?.cell??0,H=B.filter(e=>I.has(e.from)&&I.has(e.to)&&!A.has(e.from)&&!A.has(e.to)&&G(e.edge)),F=p?.tilt??.5,[J,Q]=(0,P.useState)([]),se=J.map(e=>`${Math.round(e.x)},${Math.round(e.y)},${Math.round(e.width)},${Math.round(e.height)}`).join(";"),[Z,ue]=(0,P.useState)(null),ee=c.t>=1;(0,P.useLayoutEffect)(()=>{let e=Z?.parentElement;if(!e||!p||!ee)return;let t=e.getBoundingClientRect(),s=p.originX+i.x,o=p.originY+i.y,l=[...e.querySelectorAll('[data-graview-view^="kind:"] .graview-kind-face')].flatMap(d=>{let y=d.getBoundingClientRect();return y.width>0&&y.height>0?[{x:y.left-t.left-s,y:y.top-t.top-o,width:y.width,height:y.height}]:[]});l.map(d=>`${Math.round(d.x)},${Math.round(d.y)},${Math.round(d.width)},${Math.round(d.height)}`).join(";")!==se&&Q(l)},[Z,ee,_,C,F]);let V=(0,P.useMemo)(()=>{if(C===0)return[];let e=new Map,t=Math.max(0,...H.map(o=>o.links)),s=Oe({ribbons:H.map(o=>({key:o.key,from:o.from,to:o.to,width:xe(o.links,t)})),plots:I,cell:C,tilt:F,labels:J});return H.flatMap(o=>{let l;if(o.from===o.to){let w=e.get(o.from)??0;e.set(o.from,w+1),l=Be(Se(I.get(o.from),w),{cell:C,tilt:F})}else l=s.get(o.key);return!l||l.length<2?[]:[{ribbon:o,points:l,d:Fe(l),middle:Ne(l),width:xe(o.links,t)}]})},[C,F,_,B,G,A,se]),de=(0,P.useRef)([]),X=(0,P.useRef)({x:0,y:0});if(X.current=p?{x:p.originX+i.x,y:p.originY+i.y}:{x:0,y:0},(0,P.useEffect)(()=>{let e=Z?.parentElement;if(!e||typeof window>"u")return;let t=0,s=null,o=()=>{t=0;let d=s;if(!d)return;let y=d.target;if(d.pointerType==="touch"||d.buttons!==0||y?.closest("[data-graview-view], button, a, input, select, textarea, [data-graview-overlay], [data-graview-offstage]")){h(null);return}let r=e.getBoundingClientRect(),v=d.clientX-r.left-X.current.x,M=d.clientY-r.top-X.current.y,x=null,D=1/0;for(let $ of de.current){let f=qe($.points,v,M);f<=$.reach&&f<D&&(D=f,x=$.key)}h(x)},l=d=>{s=d,t===0&&(t=requestAnimationFrame(o))},w=()=>h(null);return e.addEventListener("pointermove",l,{passive:!0}),e.addEventListener("pointerleave",w),()=>{t!==0&&cancelAnimationFrame(t),e.removeEventListener("pointermove",l),e.removeEventListener("pointerleave",w)}},[Z]),!p||!k.overview||V.length===0)return null;let O=Ee(b,k,N);if(O.records.length>0||O.lens!==null)return null;let T=O.districts.length>0?V.filter(({ribbon:e})=>O.districts.includes(e.from)||O.districts.includes(e.to)):V;if(T.length===0)return null;let te=L??null,Y=T.find(({ribbon:e})=>e.key===ce);de.current=T.map(({ribbon:e,points:t,width:s})=>({key:e.key,points:t,reach:s/2+6}));let K={x:p.originX+i.x,y:p.originY+i.y},n=`translate(${K.x.toFixed(1)} ${K.y.toFixed(1)})`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("svg",{ref:ue,className:"graview-ribbons","aria-hidden":"true","data-graview-world":"","data-graview-ribbons":T.length,width:m,height:u,style:{position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible"},children:(0,S.jsx)("g",{transform:n,children:T.map(({ribbon:e,d:t,width:s})=>{let o=ce===e.key||te!==null&&te===e.edge||O.districts.length>0,l=te!==null&&te!==e.edge;return(0,S.jsx)("g",{className:"graview-ribbon","data-graview-ribbon":e.edge,"data-graview-from":`kind:${e.from}`,"data-graview-to":`kind:${e.to}`,"data-graview-links":e.links,"data-graview-lit":o&&!l?"":void 0,"data-graview-receded":l?"":void 0,children:(0,S.jsx)("path",{className:"graview-ribbon-band",d:t,style:{strokeWidth:s}})},e.key)})})}),Y?(0,S.jsx)("div",{className:"graview-ribbon-said","data-graview-world":"","data-testid":"ribbon-said",role:"status",style:{position:"absolute",left:K.x+Y.middle.x,top:K.y+Y.middle.y,pointerEvents:"none"},children:Re(a.schema,Y.ribbon)}):null]})}function qe(c,m,u){let i=1/0;for(let a=1;a<c.length;a++){let g=c[a-1],b=c[a],k=b.x-g.x,L=b.y-g.y,A=k*k+L*L,G=A===0?0:Math.max(0,Math.min(1,((m-g.x)*k+(u-g.y)*L)/A));i=Math.min(i,Math.hypot(m-(g.x+G*k),u-(g.y+G*L)))}return i}export{Ue as Ribbons,qe as distanceTo};
|
|
1
|
+
import"./chunk.XDYAG276.js";import{a as xe}from"./chunk.HJCQ6I3S.js";import{c as he}from"./chunk.MWGGV7DE.js";import{a as je,b as Ee,c as Ie,d as Re}from"./chunk.JQU5GEU3.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import{F as Ke,Q as Pe}from"./chunk.6QWV5MVH.js";import"./chunk.MNP4JI33.js";import{b as pe}from"./chunk.AJZBJBMO.js";var P=pe(Ke(),1);var E=.5,fe=1,ye=.76,Le=3,We=3,Ae=.6;function Oe(c){let{ribbons:m,plots:u,cell:i}=c,a=c.tilt??.5,g=c.labels??[],b=[...u.values()],k=new Map;if(b.length===0||i<=0)return k;let L=Math.min(...b.map(n=>n.col))-3,A=Math.min(...b.map(n=>n.row))-3,G=Math.max(...b.map(n=>n.col+n.side))+3,ce=Math.max(...b.map(n=>n.row+n.side))+3,h=Math.round((G-L)/E)+1,p=Math.round((ce-A)/E)+1,N=n=>L+n*E,B=n=>A+n*E,I=4,_=!0,C=(n,e)=>{if(!_)return!1;let t=he(n,e,i,a);return g.some(s=>t.x>s.x-I&&t.x<s.x+s.width+I&&t.y>s.y-I&&t.y<s.y+s.height+I)},H=(n,e)=>b.some(t=>n>t.col-ye&&n<t.col+t.side+ye&&e>t.row-ye&&e<t.row+t.side+ye),F=new Uint8Array(h*p),J=new Uint8Array(h*p);for(let n=0;n<h;n++)for(let e=0;e<p;e++){let t=N(n),s=B(e);J[e*h+n]=H(t,s)?0:1,F[e*h+n]=J[e*h+n]&&!C(t,s)?1:0}let Q=F,se=new Float32Array(h*p);for(let n=0;n<h;n++)for(let e=0;e<p;e++){let t=N(n),s=B(e);se[e*h+n]=Math.min(...b.map(o=>Math.max(0,o.col-t,t-(o.col+o.side),o.row-s,s-(o.row+o.side))))}let Z=(n,e,t,s)=>{let o=N(n)+t*E/2,l=B(e)+s*E/2;return!H(o,l)&&!C(o,l)},ue=n=>{let e=[],t=(o,l)=>{let w=[],d=Math.min(1,l/3);for(let y=Math.ceil((o+d)/E-1e-9)*E;y<=o+l-d+1e-9;y+=E)w.push(y);return w},s=(o,l,w,d)=>{let y=Math.round((o-L)/E),r=Math.round((l-A)/E);y>=0&&r>=0&&y<h&&r<p&&Q[r*h+y]&&e.push({i:y,j:r,out:w,curb:d})};for(let o of t(n.row,n.side))s(n.col-fe,o,1,{col:n.col,row:o}),s(n.col+n.side+fe,o,0,{col:n.col+n.side,row:o});for(let o of t(n.col,n.side))s(o,n.row-fe,3,{col:o,row:n.row}),s(o,n.row+n.side+fe,2,{col:o,row:n.row+n.side});return e},ee=new Map,V=(n,e,t,s)=>n<t||n===t&&e<s?`${n},${e}-${t},${s}`:`${t},${s}-${n},${e}`,de=[[1,0],[-1,0],[0,1],[0,-1]],X=new Map;for(let n of m){let e=u.get(n.from),t=u.get(n.to);if(!e||!t||e===t)continue;let s=-1,o=[],l=new Map,w=new Int32Array(0),d=1/0,y=[];for(let f of[!0,!1]){s=-1,d=1/0,_=f,Q=f?F:J,o=ue(e);let W=ue(t);if(o.length===0||W.length===0){y.push({reached:-1,starts:o,goal:l,back:w,best:d});continue}l=new Map(W.map(j=>[j.j*h+j.i,j]));let ne=(j,R)=>{let re=N(j),ae=B(R);return(Math.max(0,t.col-re,re-(t.col+t.side))+Math.max(0,t.row-ae,ae-(t.row+t.side)))*Ae},oe=h*p*4,ie=new Float64Array(oe).fill(1/0);w=new Int32Array(oe).fill(-1);let le=new ke;for(let j of o){let R=(j.j*h+j.i)*4+j.out;ie[R]=0,le.push(R,ne(j.i,j.j))}let Ce=[1,0,3,2];for(;le.size>0&&!(le.peekKey()>=d);){let R=le.pop(),re=Math.floor(R/4),ae=R%4,ge=re%h,we=Math.floor(re/h),ve=l.get(re);if(ve){let q=ie[R]+(ae===Ce[ve.out]?0:Le);q<d&&(d=q,s=R);continue}for(let q=0;q<4;q++){let[Me,$e]=de[q],U=ge+Me,z=we+$e;if(U<0||z<0||U>=h||z>=p||!Q[z*h+U]||!Z(ge,we,Me,$e))continue;let Te=E*(ee.has(V(ge,we,U,z))?Ae:1)*(1+Math.max(0,se[z*h+U]-We))+(q===ae?0:Le),me=(z*h+U)*4+q,be=ie[R]+Te;be<ie[me]&&(ie[me]=be,w[me]=R,le.push(me,be+ne(U,z)))}}y.push({reached:s,starts:o,goal:l,back:w,best:d})}_=!0,Q=F;let[r,v]=y,M=r&&r.reached!==-1&&(!v||v.reached===-1||r.best<=1.3*v.best+2)?r:v;if(!M||M.reached===-1)continue;({reached:s,starts:o,goal:l,back:w}=M);let x=[];for(let f=s;f!==-1;f=w[f]){let W=Math.floor(f/4),ne=x[x.length-1],oe={i:W%h,j:Math.floor(W/h)};(!ne||ne.i!==oe.i||ne.j!==oe.j)&&x.push(oe)}x.reverse();for(let f=1;f<x.length;f++){let W=V(x[f-1].i,x[f-1].j,x[f].i,x[f].j);ee.set(W,[...ee.get(W)??[],n.key])}let D=o.find(f=>f.i===x[0].i&&f.j===x[0].j),$=l.get(x[x.length-1].j*h+x[x.length-1].i);X.set(n.key,{cells:x,start:D.curb,end:$.curb})}let O=new Map(m.map(n=>[n.key,n.width])),T=new Map(m.map((n,e)=>[n.key,e])),te=i*a/Math.sqrt(1+a*a),Y=(n,e)=>n==="col"?`r${e.row.toFixed(2)}`:`c${e.col.toFixed(2)}`,K=new Map;for(let[n,e]of X)for(let t=1;t<e.cells.length;t++){let s=e.cells[t-1],o=e.cells[t],l=Y(s.i!==o.i?"col":"row",{col:N(s.i),row:B(s.j)});K.set(l,(K.get(l)??new Set).add(n))}for(let[n,e]of X){let t=[e.start,...e.cells.map(r=>({col:N(r.i),row:B(r.j)})),e.end],s=r=>r>=2&&r<=e.cells.length?V(e.cells[r-2].i,e.cells[r-2].j,e.cells[r-1].i,e.cells[r-1].j):null,o=[];for(let r=1;r<t.length;r++){let v=Math.abs(t[r].col-t[r-1].col)>1e-9?"col":"row",M=o[o.length-1];M&&M.axis===v?M.to=r:o.push({from:r-1,to:r,axis:v})}if(o.length===0)continue;let l=o.map(r=>{if(!Array.from({length:r.to-r.from},($,f)=>s(r.from+1+f)).some($=>$!==null))return 0;let v=K.get(Y(r.axis,t[r.from]))??new Set;if(!v.has(n))return 0;let M=[...v].sort(($,f)=>(T.get($)??0)-(T.get(f)??0)),D=-(M.reduce(($,f)=>$+(O.get(f)??2)+2,0)-2)/2;for(let $ of M){if($===n)return(D+(O.get($)??2)/2)/te;D+=(O.get($)??2)+2}return 0}),w=r=>{let v=o[r],M=t[v.from];return v.axis==="col"?{row:M.row+l[r]}:{col:M.col+l[r]}},d=(r,v,M)=>({col:r.col??v.col??M.col,row:r.row??v.row??M.row}),y=[d(w(0),{},t[0])];for(let r=0;r+1<o.length;r++)y.push(d(w(r),w(r+1),t[o[r].to]));y.push(d(w(o.length-1),{},t[t.length-1])),k.set(n,y.map(r=>he(r.col,r.row,i,a)))}return k}var ke=class{items=[];keys=[];get size(){return this.items.length}peekKey(){return this.keys[0]??1/0}push(m,u){this.items.push(m),this.keys.push(u);let i=this.items.length-1;for(;i>0;){let a=i-1>>1;if(this.keys[a]<=this.keys[i])break;this.swap(i,a),i=a}}pop(){let m=this.items[0],u=this.items.pop(),i=this.keys.pop();if(this.items.length>0){this.items[0]=u,this.keys[0]=i;let a=0;for(;;){let g=2*a+1,b=g+1,k=a;if(g<this.items.length&&this.keys[g]<this.keys[k]&&(k=g),b<this.items.length&&this.keys[b]<this.keys[k]&&(k=b),k===a)break;this.swap(a,k),a=k}}return m}swap(m,u){[this.items[m],this.items[u]]=[this.items[u],this.items[m]],[this.keys[m],this.keys[u]]=[this.keys[u],this.keys[m]]}};function Se(c,m){let u=c.col+c.side,i=u+.25+.22*Math.max(0,m),a=c.row+c.side*Math.max(.1,.3-.06*m),g=c.row+c.side*Math.min(.9,.7+.06*m);return[{col:u,row:a},{col:i,row:a},{col:i,row:g},{col:u,row:g}]}function Be(c,m){return c.map(u=>he(u.col,u.row,m.cell,m.tilt))}function Fe(c){return c.map((m,u)=>`${u===0?"M":"L"} ${m.x.toFixed(1)} ${m.y.toFixed(1)}`).join(" ")}function Ne(c){if(c.length===0)return{x:0,y:0};let m=0;for(let i=1;i<c.length;i++)m+=Math.hypot(c[i].x-c[i-1].x,c[i].y-c[i-1].y);let u=m/2;for(let i=1;i<c.length;i++){let a=c[i-1],g=c[i],b=Math.hypot(g.x-a.x,g.y-a.y);if(b>=u&&b>0)return{x:a.x+(g.x-a.x)*u/b,y:a.y+(g.y-a.y)*u/b};u-=b}return c[c.length-1]}var S=pe(Pe(),1);function Ue({frame:c,width:m,height:u,pan:i,store:a,graphVersion:g,selection:b,view:k,emphasis:L,hiddenKinds:A,drawn:G}){let[ce,h]=(0,P.useState)(null),p=c.city,N=e=>a.graph.getNode(e)?.kind,B=(0,P.useMemo)(()=>je(a.graph.allEdges(),e=>a.graph.getNode(e)?.kind),[a,g]),I=new Map;for(let e of c.nodes){let t=e.id.startsWith("kind:")?Ie(e.id):null;t!==null&&e.plot&&Math.round(e.plane)===2&&I.set(t,e.plot)}let _=[...I].map(([e,t])=>`${e}:${t.col},${t.row},${t.side}`).join(";"),C=p?.cell??0,H=B.filter(e=>I.has(e.from)&&I.has(e.to)&&!A.has(e.from)&&!A.has(e.to)&&G(e.edge)),F=p?.tilt??.5,[J,Q]=(0,P.useState)([]),se=J.map(e=>`${Math.round(e.x)},${Math.round(e.y)},${Math.round(e.width)},${Math.round(e.height)}`).join(";"),[Z,ue]=(0,P.useState)(null),ee=c.t>=1;(0,P.useLayoutEffect)(()=>{let e=Z?.parentElement;if(!e||!p||!ee)return;let t=e.getBoundingClientRect(),s=p.originX+i.x,o=p.originY+i.y,l=[...e.querySelectorAll('[data-graview-view^="kind:"] .graview-kind-face')].flatMap(d=>{let y=d.getBoundingClientRect();return y.width>0&&y.height>0?[{x:y.left-t.left-s,y:y.top-t.top-o,width:y.width,height:y.height}]:[]});l.map(d=>`${Math.round(d.x)},${Math.round(d.y)},${Math.round(d.width)},${Math.round(d.height)}`).join(";")!==se&&Q(l)},[Z,ee,_,C,F]);let V=(0,P.useMemo)(()=>{if(C===0)return[];let e=new Map,t=Math.max(0,...H.map(o=>o.links)),s=Oe({ribbons:H.map(o=>({key:o.key,from:o.from,to:o.to,width:xe(o.links,t)})),plots:I,cell:C,tilt:F,labels:J});return H.flatMap(o=>{let l;if(o.from===o.to){let w=e.get(o.from)??0;e.set(o.from,w+1),l=Be(Se(I.get(o.from),w),{cell:C,tilt:F})}else l=s.get(o.key);return!l||l.length<2?[]:[{ribbon:o,points:l,d:Fe(l),middle:Ne(l),width:xe(o.links,t)}]})},[C,F,_,B,G,A,se]),de=(0,P.useRef)([]),X=(0,P.useRef)({x:0,y:0});if(X.current=p?{x:p.originX+i.x,y:p.originY+i.y}:{x:0,y:0},(0,P.useEffect)(()=>{let e=Z?.parentElement;if(!e||typeof window>"u")return;let t=0,s=null,o=()=>{t=0;let d=s;if(!d)return;let y=d.target;if(d.pointerType==="touch"||d.buttons!==0||y?.closest("[data-graview-view], button, a, input, select, textarea, [data-graview-overlay], [data-graview-offstage]")){h(null);return}let r=e.getBoundingClientRect(),v=d.clientX-r.left-X.current.x,M=d.clientY-r.top-X.current.y,x=null,D=1/0;for(let $ of de.current){let f=qe($.points,v,M);f<=$.reach&&f<D&&(D=f,x=$.key)}h(x)},l=d=>{s=d,t===0&&(t=requestAnimationFrame(o))},w=()=>h(null);return e.addEventListener("pointermove",l,{passive:!0}),e.addEventListener("pointerleave",w),()=>{t!==0&&cancelAnimationFrame(t),e.removeEventListener("pointermove",l),e.removeEventListener("pointerleave",w)}},[Z]),!p||!k.overview||V.length===0)return null;let O=Ee(b,k,N);if(O.records.length>0||O.lens!==null)return null;let T=O.districts.length>0?V.filter(({ribbon:e})=>O.districts.includes(e.from)||O.districts.includes(e.to)):V;if(T.length===0)return null;let te=L??null,Y=T.find(({ribbon:e})=>e.key===ce);de.current=T.map(({ribbon:e,points:t,width:s})=>({key:e.key,points:t,reach:s/2+6}));let K={x:p.originX+i.x,y:p.originY+i.y},n=`translate(${K.x.toFixed(1)} ${K.y.toFixed(1)})`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("svg",{ref:ue,className:"graview-ribbons","aria-hidden":"true","data-graview-world":"","data-graview-ribbons":T.length,width:m,height:u,style:{position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible"},children:(0,S.jsx)("g",{transform:n,children:T.map(({ribbon:e,d:t,width:s})=>{let o=ce===e.key||te!==null&&te===e.edge||O.districts.length>0,l=te!==null&&te!==e.edge;return(0,S.jsx)("g",{className:"graview-ribbon","data-graview-ribbon":e.edge,"data-graview-from":`kind:${e.from}`,"data-graview-to":`kind:${e.to}`,"data-graview-links":e.links,"data-graview-lit":o&&!l?"":void 0,"data-graview-receded":l?"":void 0,children:(0,S.jsx)("path",{className:"graview-ribbon-band",d:t,style:{strokeWidth:s}})},e.key)})})}),Y?(0,S.jsx)("div",{className:"graview-ribbon-said","data-graview-world":"","data-testid":"ribbon-said",role:"status",style:{position:"absolute",left:K.x+Y.middle.x,top:K.y+Y.middle.y,pointerEvents:"none"},children:Re(a.schema,Y.ribbon)}):null]})}function qe(c,m,u){let i=1/0;for(let a=1;a<c.length;a++){let g=c[a-1],b=c[a],k=b.x-g.x,L=b.y-g.y,A=k*k+L*L,G=A===0?0:Math.max(0,Math.min(1,((m-g.x)*k+(u-g.y)*L)/A));i=Math.min(i,Math.hypot(m-(g.x+G*k),u-(g.y+G*L)))}return i}export{Ue as Ribbons,qe as distanceTo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.WVUJXDXZ.js";import{a as v,b as ae}from"./chunk.ULRW47RP.js";import"./chunk.PBSMLINK.js";import"./chunk.3TY5NFLY.js";import"./chunk.D75KC3LL.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import"./chunk.GZHZLJBF.js";import{n as re}from"./chunk.XMC7YDWT.js";import"./chunk.6UGEYZAC.js";import"./chunk.OJGHDWI6.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import"./chunk.JOOQUWLT.js";import{$ as ne,F as Fe,L as _,N as Z,Q as ee,Y as te}from"./chunk.6QWV5MVH.js";import{ca as Q,dc as X,ga as Y,ha as k,ia as j}from"./chunk.MNP4JI33.js";import{b as z}from"./chunk.AJZBJBMO.js";var g=z(Fe(),1);async function ie(e,n){let a=await createImageBitmap(e);try{let i=Math.min(1,n/Math.max(a.width,a.height)),o=document.createElement("canvas");o.width=Math.max(1,Math.round(a.width*i)),o.height=Math.max(1,Math.round(a.height*i));let s=o.getContext("2d");if(s===null)throw new Error("This browser will not give us a canvas to resize with.");return s.drawImage(a,0,0,o.width,o.height),o}finally{a.close()}}var t=z(ee(),1),$e=2048,xe=.85;function H(e){return e<1e3?`${e} bytes`:e<1e6?`${Math.round(e/1e3)} KB`:`${(e/1e6).toFixed(e<1e7?1:0)} MB`}function U(e){if(e.type==="application/pdf")return"PDF";let n=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return n?n.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ce(e){let n=[...new Set(e.map(a=>a==="image/*"?"pictures":a==="*/*"||a==="*"?"any file":`${U({type:a})} files`))];return n.length<=1?n[0]??"no files":`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`}function ge(e,n){if(e.length===0)return!0;let a=`${n.split("/")[0]}/*`;return e.some(i=>i==="*"||i==="*/*"||i===n||i===a)}var le=/^image\/hei[cf]$|\.hei[cf]$/i,oe=e=>le.test(e.type)||le.test(e.name);async function Se(e,n,a){let i=e.name||(a.camera?"photo.jpg":"file"),o=e.type||(oe({type:"",name:i})?"image/heic":"application/octet-stream"),s=oe({type:o,name:i}),d=o.startsWith("image/")||s;if(a.image&&!d)return{refused:`\u201C${i}\u201D isn\u2019t a picture.`};if(s||d&&/^image\/(jpeg|webp)$/.test(o)&&(a.camera||e.size>n.maxBytes||e.size>15e5))try{let l=await ie(e,$e),f=await new Promise(y=>l.toBlob(y,"image/jpeg",xe));if(f)return se({blob:f,name:s?i.replace(/\.hei[cf]$/i,"")+".jpg":i,type:"image/jpeg",width:l.width,height:l.height},n)}catch{if(s&&!ge(n.kinds,o))return{refused:`\u201C${i}\u201D is a HEIC photo, which this browser can\u2019t turn into a JPEG and this host doesn\u2019t take. Save it as a JPEG and try again.`}}let c={};if(d&&!s)try{let l=await createImageBitmap(e);c={width:l.width,height:l.height},l.close()}catch{}return se({blob:e,name:i,type:o,...c},n)}function se(e,n){return ge(n.kinds,e.type)?e.blob.size>n.maxBytes?{refused:`\u201C${e.name}\u201D is ${H(e.blob.size)}; this host takes files up to ${H(n.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${U(e)} file; this host takes ${ce(n.kinds)}.`}}async function Ce(e,n,a){let i;try{i=await n.upload(e.blob,e.name)}catch(s){let d=s instanceof Error&&s.message.trim()?s.message.trim():"the host refused it";return{refused:`\u201C${e.name}\u201D wasn\u2019t kept: ${d}`}}return Y(i)?a&&!k(i)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:{...i,...i.width===void 0&&e.width?{width:e.width}:{},...i.height===void 0&&e.height?{height:e.height}:{}}:{refused:`The host\u2019s answer for \u201C${e.name}\u201D isn\u2019t a file a record can keep.`}}var F="var(--graview-radius, 8px)",C={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function pe(e){let n=_(),a=Z()?.past!=null,[i,o]=(0,g.useState)(!1);return[n?.kept?.(e.href)===!1||a&&i,()=>o(!0)]}function he({file:e,style:n}){return(0,t.jsx)("span",{role:"img","aria-label":`${v(e)}, removed later`,"data-graview-removed-later":e.href,style:{display:"grid",placeItems:"center",textAlign:"center",padding:4,boxSizing:"border-box",fontSize:"0.6875rem",lineHeight:1.2,color:"var(--graview-ink-muted)",border:"1px dashed var(--graview-edge-bright)",borderRadius:F,...n},children:"removed later"})}function O({file:e,size:n=56,style:a}){let[i,o]=pe(e);return i?(0,t.jsx)(he,{file:e,style:{width:n,height:n,flex:"none",...a}}):(0,t.jsx)("img",{onError:o,src:e.href,alt:v(e),width:n,height:n,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:n,height:n,objectFit:"cover",borderRadius:F,display:"block",flex:"none",background:"var(--graview-edge)",...a}})}function Ee({file:e,onOpen:n}){let[a,i]=pe(e);return a?(0,t.jsx)(he,{file:e,style:{width:"100%",aspectRatio:"1"}}):(0,t.jsx)("button",{type:"button","aria-label":`Open ${v(e)} full size`,onClick:o=>n(o.currentTarget),style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:F},children:(0,t.jsx)("img",{src:e.href,alt:v(e),loading:"lazy",decoding:"async",onError:i,style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:F,display:"block",background:"var(--graview-edge)"}})})}function N({files:e,label:n}){let a=e.filter(k),i=e.filter(l=>!k(l)),[o,s]=(0,g.useState)(null),d=(0,g.useRef)(null),m=(0,g.useRef)(null);(0,g.useEffect)(()=>{let l=d.current;o!==null&&l&&!l.open&&l.showModal?.()},[o]);let c=o===null?void 0:a[o];return(0,t.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[a.length>0?(0,t.jsx)("ul",{"data-graview-gallery":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:a.map((l,f)=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ee,{file:l,onOpen:y=>{m.current=y,s(f)}})},l.href))}):null,i.length>0?(0,t.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:i.map(l=>(0,t.jsxs)("li",{"data-graview-document":l.type,style:{display:"grid",gap:6,minWidth:0},children:[l.type==="application/pdf"?(0,t.jsx)("object",{data:l.href,type:"application/pdf","aria-label":v(l),style:{width:"100%",height:420,border:"1px solid var(--graview-edge)",borderRadius:F},children:(0,t.jsxs)("p",{style:{margin:0,padding:12},children:["This browser shows no PDF here: ",(0,t.jsxs)("a",{href:l.href,download:l.name,children:["download ",l.name]}),"."]})}):null,(0,t.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:"2px 10px",alignItems:"baseline",minWidth:0,overflowWrap:"anywhere"},children:[(0,t.jsx)("a",{href:l.href,download:l.name,...l.type==="application/pdf"?{target:"_blank",rel:"noopener"}:{},children:l.name}),(0,t.jsxs)("span",{style:C,children:[U(l)," \xB7 ",H(l.bytes)]})]}),l.caption?(0,t.jsx)("span",{style:C,children:l.caption}):null]},l.href))}):null,c?(0,t.jsx)("dialog",{ref:d,"data-graview-full":c.href,"aria-label":v(c),onClose:()=>{s(null),m.current?.focus()},onClick:l=>{l.target===l.currentTarget&&l.currentTarget.close()},style:{padding:0,border:0,borderRadius:F,maxWidth:"min(96vw, 1600px)",maxHeight:"94vh",background:"var(--graview-panel)",color:"var(--graview-ink)"},children:(0,t.jsxs)("figure",{style:{margin:0,display:"grid",gap:8,padding:10},children:[(0,t.jsx)("img",{src:c.href,alt:v(c),style:{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain",display:"block",margin:"0 auto"}}),(0,t.jsxs)("figcaption",{style:{display:"flex",gap:12,alignItems:"center",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:c.caption??c.name}),(0,t.jsx)("form",{method:"dialog",style:{margin:0},children:(0,t.jsx)("button",{type:"submit",autoFocus:!0,children:"Close"})})]})]})}):null]})}function me({value:e,onChange:n,several:a,image:i,label:o,thumbs:s=!0}){let d=_(),m=(0,g.useId)(),c=(0,g.useRef)(null),l=(0,g.useRef)(null),[f,y]=(0,g.useState)(null),[$,I]=(0,g.useState)(null),[A,E]=(0,g.useState)([]),[D,L]=(0,g.useState)(!1),x=d?i?d.kinds.filter(r=>r.startsWith("image/")||r==="*"||r==="*/*"):d.kinds:[],G=d?d.kinds.length===0||x.some(r=>r.startsWith("image/")||r.startsWith("*")):!1,P=!!d&&(!i||G),q=i?a?"pictures":"a picture":a?"files":"a file",K=i?x.length>0?x.join(","):"image/*":d?.kinds.join(",")||void 0,be=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,V=(0,g.useRef)(e);V.current=e;let J=(0,g.useRef)(null),R=(0,g.useRef)(null);(0,g.useEffect)(()=>{let r=R.current;if(!r||r.from===e)return;R.current=null;let u=J.current?.children,h=u?.[Math.min(r.at,u.length-1)];((r.what==="move"?h?.querySelector("[data-graview-file-move]"):null)??h?.querySelector("[data-graview-file-remove]")??c.current?.parentElement?.querySelector("[data-graview-file-choose]"))?.focus()});let T=async(r,u)=>{if(!d||r.length===0)return;let h=a?r:r.slice(0,1),p=[],w=[];h.length<r.length&&w.push(`${o} holds one ${i?"picture":"file"}, so ${r.slice(1).map(b=>`\u201C${b.name||"the photo"}\u201D`).join(", ")} ${r.length>2?"were":"was"} left out.`),E([]),I(null);for(let b of h){y(`Sending ${b.name||"the photo"}\u2026`);let B=await Se(b,d,{image:i,camera:u==="camera"});if("refused"in B){w.push(B.refused);continue}let S=await Ce(B,d,i);"refused"in S?w.push(S.refused):[...a?V.current:[],...p].some(ke=>ke.href===S.href)?w.push(`\u201C${S.name}\u201D is already here.`):p.push(S)}if(y(null),E(w),p.length!==0)try{n(a?[...V.current,...p]:p.slice(-1)),I(`Added ${p.map(b=>b.name).join(", ")}.`)}catch(b){E([...w,b instanceof Error?b.message:String(b)])}},W=(r,u,h)=>{try{R.current=h?{...h,from:e}:null,n(r),I(u)}catch(p){R.current=null,E([p instanceof Error?p.message:String(p)])}},M=r=>r?Array.from(r):[],we=r=>{let u=M(r.clipboardData?.files);!P||u.length===0||(r.preventDefault(),T(u,"pasted"))},ve=r=>{L(!1),P&&(r.preventDefault(),T(M(r.dataTransfer?.files),"dropped"))};return(0,t.jsxs)("div",{role:"group","aria-labelledby":`${m}-label`,"data-graview-file-editor":"","data-graview-dropping":D?"":void 0,onPaste:we,onDragOver:r=>{P&&(r.preventDefault(),L(!0))},onDragLeave:()=>L(!1),onDrop:ve,style:{display:"grid",gap:8,minWidth:0,padding:D?6:0,outline:D?"2px dashed var(--graview-accent)":"none",borderRadius:F},children:[(0,t.jsx)("span",{id:`${m}-label`,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},children:o}),e.length>0&&(a||e.length>1)?(0,t.jsx)("ul",{ref:J,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((r,u)=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[s&&k(r)?(0,t.jsx)(O,{file:r,size:40}):null,(0,t.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:r.name}),(0,t.jsx)(ue,{file:r,onCaption:h=>W(e.map((p,w)=>w===u?de(p,h):p),h?`${r.name} now says \u201C${h}\u201D.`:`${r.name} says its name again.`)}),a&&u>0?(0,t.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${r.name} earlier`,onClick:()=>W(e.map((h,p)=>p===u-1?r:p===u?e[u-1]:h),`Moved ${r.name} earlier.`,{at:u-1,what:"move"}),children:"\u2191"}):null,a?(0,t.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${r.name}`,onClick:()=>W(e.filter((h,p)=>p!==u),`Removed ${r.name}.`,{at:u,what:"remove"}),children:"Remove"}):null]},`${u}:${r.href}`))}):e.length===1?(0,t.jsx)(ue,{file:e[0],onCaption:r=>W([de(e[0],r)],r?`${e[0].name} now says \u201C${r}\u201D.`:`${e[0].name} says its name again.`)}):null,P?(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{ref:c,type:"file",hidden:!0,multiple:a,...K?{accept:K}:{},"data-graview-file-input":"","aria-label":`Choose ${q}`,onChange:r=>{let u=M(r.currentTarget.files);r.currentTarget.value="",T(u,"picked")}}),(0,t.jsx)("button",{type:"button",disabled:f!==null,onClick:()=>c.current?.click(),"data-graview-file-choose":"",children:e.length>0&&!a?`Replace ${i?"the picture":"the file"}`:`Choose ${q}`}),G?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:l,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:r=>{let u=M(r.currentTarget.files);r.currentTarget.value="",T(u,"camera")}}),be?(0,t.jsx)("button",{type:"button",disabled:f!==null,onClick:()=>l.current?.click(),children:"Take a photo"}):null]}):null,(0,t.jsxs)("span",{style:C,"data-graview-file-takes":"",children:["or drop or paste ",a?"them":"it"," here \xB7 ",d.kinds.length>0?ce(x.length>0?x:d.kinds):"any file",", up to ",H(d.maxBytes)]})]}):(0,t.jsx)("p",{style:{...C,margin:0},"data-graview-file-none":"",children:d?"This host doesn\u2019t take pictures, so none can be added here.":"This host doesn\u2019t take files, so none can be added here."}),(0,t.jsx)("p",{"aria-live":"polite",style:{...C,margin:0,minHeight:f||$?void 0:0},"data-graview-file-status":"",children:f??$??""}),A.length>0?(0,t.jsx)("div",{role:"alert","data-graview-file-refused":"",style:{color:"var(--graview-warn)",fontSize:"0.875rem",display:"grid",gap:2},children:A.map((r,u)=>(0,t.jsx)("p",{style:{margin:0},children:r},u))}):null]})}var de=(e,n)=>{let{caption:a,...i}=e;return n?{...i,caption:n}:i};function ue({file:e,onCaption:n}){let[a,i]=(0,g.useState)(e.caption??"");(0,g.useEffect)(()=>i(e.caption??""),[e.caption]);let o=()=>{let s=a.trim().slice(0,500);s!==(e.caption??"")&&n(s)};return(0,t.jsx)("input",{type:"text",value:a,placeholder:k(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${k(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:s=>i(s.target.value),onBlur:o,onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),o())},style:{flex:"1 1 10rem",minWidth:0,font:"inherit",fontSize:"0.875rem",minHeight:24}})}function ye({field:e,label:n,labelStyle:a,valueStyle:i,style:o,children:s}){return(0,t.jsxs)("div",{"data-graview-files":e,style:{display:"grid",gap:6,minWidth:0,gridColumn:"1 / -1",...o},children:[(0,t.jsx)("dt",{style:a,children:n}),(0,t.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...i},children:s})]})}function fe(e){let{nodeId:n,field:a,label:i,files:o}=e,{fields:s,commit:d}=re(n),m=s.find(y=>y.field===a&&y.takesValue),c=m?.shape,l=c?.type==="several"?c.of:c,f=c?.type==="several";return o.length===0&&l?.type!=="file"?null:(0,t.jsxs)(ye,{...e,children:[(0,t.jsx)(N,{files:o,label:i}),m&&l?.type==="file"?(0,t.jsx)(me,{value:o,thumbs:!1,several:f,image:l.image===!0,label:i,onChange:y=>{let $=f?y:y[y.length-1];$!==void 0&&d(m,$)}}):null]})}function Le(e){switch(e.as){case"field":return e.read?e.files.length>0?(0,t.jsx)(ye,{...e,children:(0,t.jsx)(N,{files:e.files,label:e.label})}):null:(0,t.jsx)(fe,{...e});case"unfilled":return(0,t.jsx)(Pe,{...e});case"thumb":return(0,t.jsx)(O,{...e});case"block":return e.files.length>0?(0,t.jsx)("span",{className:"graview-spec-image","data-graview-field":e.field,"data-graview-image":e.view,style:{display:"block",minWidth:0,...e.view==="gallery"?{position:"relative",zIndex:X.raised}:{}},children:e.view==="thumb"?(0,t.jsx)(O,{file:e.files[0],size:72}):(0,t.jsx)(N,{files:e.files,label:e.label})}):null;case"control":{let n=(0,t.jsx)(me,{value:j(e.value),several:e.several,image:e.image,label:e.label,onChange:a=>e.onChange(e.several?a:a[a.length-1])});return e.title===void 0?n:(0,t.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.several?"files":"file",children:[(0,t.jsx)("legend",{"data-graview-part":"label",children:e.title}),n]})}}}function Pe({nodeId:e,skip:n,labels:a,labelStyle:i,style:o}){let{store:s}=te(),d=ne(e),m=d?s.schema.tryDefinition(d.kind):void 0,c=ae(m).filter(l=>!n.includes(l)&&!(m?.display?.hide??[]).includes(l)&&j(d?.[l]).length===0);return c.length===0?null:(0,t.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:c.map(l=>(0,t.jsx)(fe,{nodeId:e,field:l,label:a?.[l]??Q(m,l),files:[],...i?{labelStyle:i}:{},...o?{style:o}:{}},l))})}export{me as FilesEditor,$e as SEND_EDGE,Le as drawFiles,ce as kindsWords,Se as prepare,Ce as send,H as sizeWords,ge as takes,U as typeWords};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import{a as k,b as A,c as L,d as _,e as E,r as B,s as V,t as H,u as N,v as q}from"./chunk.OJGHDWI6.js";import"./chunk.MNP4JI33.js";import"./chunk.AJZBJBMO.js";var W=["drawElementImageToTexture","copyElementImageToTexture"],S=null,P=(r,e)=>r==="texture"?{texture:e}:{destination:{texture:e}};function Z(){return typeof globalThis>"u"?void 0:globalThis}function v(r,e){let t=[],n=Z(),o=!!(n?.navigator&&"gpu"in n.navigator);o||t.push("navigator.gpu is absent \u2014 WebGPU is unavailable.");let i=r??n?.GPUQueue?.prototype??void 0,a=null;if(i){for(let d of W)if(typeof i[d]=="function"){a=d;break}}a||t.push("No element-capture method on GPUQueue. Run Chromium 147+ with --enable-blink-features=CanvasDrawElement.");let c=e??n?.HTMLCanvasElement?.prototype??void 0,l=typeof c?.updateElementGeometry=="function";l||t.push("canvas.updateElementGeometry is absent \u2014 geometry cannot be reported.");let p=typeof c?.requestPaint=="function";p||t.push("canvas.requestPaint is absent \u2014 there is no capture-safe moment to hook.");let w=!1,h="unknown";if(typeof document<"u"){let d=document.createElement("canvas");w="layoutSubtree"in d||typeof d.captureElementImage=="function","layoutSubtree"in d?h="no":typeof d.captureElementImage=="function"&&(h="yes")}return{available:a!==null,captureMethod:a,geometrySync:l,hitTestFollowsGeometry:l?h:"no",layoutSubtree:w,paintEvents:p,webgpu:o,usable:o&&a!==null,notes:t}}var g=class extends Error{constructor(t){super(`HTML-in-Canvas is unavailable:
|
|
2
|
+
${t.notes.join(`
|
|
3
|
+
`)}`);this.capabilities=t;this.name="PlatformUnavailableError"}};function G(r,e,t){let n=r;for(let o of W){let i=n[o];if(typeof i=="function"){if(S){i.call(n,{source:e},P(S,t));return}try{i.call(n,{source:e},P("texture",t)),S="texture"}catch(a){if(!(a instanceof TypeError)||!/texture/i.test(a.message))throw a;i.call(n,{source:e},P("destination",t)),S="destination"}return}}throw new g(v(r))}function M(r,e=!0){e?r.setAttribute("drawable",""):r.removeAttribute("drawable")}function F(r){let e=r.changedElements;return e?new Set(Array.from(e)):null}function ee(r,e){let t=r;if(typeof t.captureElementImage!="function")throw new g(v(void 0,r));return t.captureElementImage(e)}function O(r,e,t){let n=r;if(typeof n.updateElementGeometry!="function")throw new g(v(void 0,r));n.updateElementGeometry(e,t)}function te(r,e){r.clearElementGeometry?.(e)}function m(r){r.requestPaint?.()}function D(r,e=!0){let t=r;e?t.setAttribute("content","drawable"):t.removeAttribute("content"),"layoutSubtree"in t?t.layoutSubtree=e:e?t.setAttribute("layoutsubtree",""):t.removeAttribute("layoutsubtree")}var I=`
|
|
4
|
+
struct Plane {
|
|
5
|
+
// x, y, width, height in canvas pixels, after the plane transform.
|
|
6
|
+
rect: vec4f,
|
|
7
|
+
// blur radius in texels, contrast falloff 0..1, shadow strength (cast by
|
|
8
|
+
// the view's own panel, so unused here), and the view's own opacity \u2014 which is how a node entering or leaving the scene
|
|
9
|
+
// fades rather than popping.
|
|
10
|
+
style: vec4f,
|
|
11
|
+
// canvas size in pixels, and the ground color's rgb packed as xyz.
|
|
12
|
+
canvas: vec4f,
|
|
13
|
+
ground: vec4f,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@group(0) @binding(0) var<uniform> plane: Plane;
|
|
17
|
+
@group(0) @binding(1) var view_texture: texture_2d<f32>;
|
|
18
|
+
@group(0) @binding(2) var view_sampler: sampler;
|
|
19
|
+
|
|
20
|
+
struct VertexOut {
|
|
21
|
+
@builtin(position) position: vec4f,
|
|
22
|
+
@location(0) uv: vec2f,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@vertex
|
|
26
|
+
fn vs_main(@builtin(vertex_index) index: u32) -> VertexOut {
|
|
27
|
+
// Two triangles, no vertex buffer: the quad is entirely a function of the
|
|
28
|
+
// plane rect, so nothing has to be uploaded per frame except the uniform.
|
|
29
|
+
var corners = array<vec2f, 6>(
|
|
30
|
+
vec2f(0.0, 0.0), vec2f(1.0, 0.0), vec2f(0.0, 1.0),
|
|
31
|
+
vec2f(0.0, 1.0), vec2f(1.0, 0.0), vec2f(1.0, 1.0),
|
|
32
|
+
);
|
|
33
|
+
let corner = corners[index];
|
|
34
|
+
let pixel = plane.rect.xy + corner * plane.rect.zw;
|
|
35
|
+
// Canvas pixels to clip space, y down.
|
|
36
|
+
let ndc = vec2f(
|
|
37
|
+
pixel.x / plane.canvas.x * 2.0 - 1.0,
|
|
38
|
+
1.0 - pixel.y / plane.canvas.y * 2.0,
|
|
39
|
+
);
|
|
40
|
+
var out: VertexOut;
|
|
41
|
+
out.position = vec4f(ndc, 0.0, 1.0);
|
|
42
|
+
out.uv = corner;
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
fn blurred(uv: vec2f, radius: f32) -> vec4f {
|
|
47
|
+
if (radius <= 0.0) {
|
|
48
|
+
return textureSample(view_texture, view_sampler, uv);
|
|
49
|
+
}
|
|
50
|
+
let size = vec2f(textureDimensions(view_texture, 0));
|
|
51
|
+
let step = radius / size;
|
|
52
|
+
var sum = vec4f(0.0);
|
|
53
|
+
var weight = 0.0;
|
|
54
|
+
// A 9-tap kernel: enough to read as depth-of-field at plane scale, cheap
|
|
55
|
+
// enough to run on every capture every frame.
|
|
56
|
+
for (var y = -1; y <= 1; y = y + 1) {
|
|
57
|
+
for (var x = -1; x <= 1; x = x + 1) {
|
|
58
|
+
let offset = vec2f(f32(x), f32(y)) * step;
|
|
59
|
+
let w = select(1.0, 2.0, x == 0 && y == 0);
|
|
60
|
+
sum = sum + textureSample(view_texture, view_sampler, uv + offset) * w;
|
|
61
|
+
weight = weight + w;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return sum / weight;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@fragment
|
|
68
|
+
fn fs_main(in: VertexOut) -> @location(0) vec4f {
|
|
69
|
+
let radius = plane.style.x;
|
|
70
|
+
let falloff = plane.style.y;
|
|
71
|
+
let opacity = plane.style.w;
|
|
72
|
+
|
|
73
|
+
let color = blurred(in.uv, radius);
|
|
74
|
+
|
|
75
|
+
// Recession dims the view toward whatever is under it \u2014 the ground \u2014 by
|
|
76
|
+
// the same share the DOM path's \`opacity\` does (\`recededOpacity\`), and
|
|
77
|
+
// the plane's shadow is the view's own panel, captured with it. Mixing
|
|
78
|
+
// toward a fixed ground color and darkening the quad's edges here drew a
|
|
79
|
+
// different picture from the DOM path's: gray bands down a light card,
|
|
80
|
+
// and haze of the wrong color in the other scheme.
|
|
81
|
+
let alpha = opacity * (1.0 - falloff * 0.55);
|
|
82
|
+
|
|
83
|
+
// A capture arrives with STRAIGHT alpha and the canvas composites
|
|
84
|
+
// premultiplied, so the color is multiplied by its own alpha here, once.
|
|
85
|
+
// Without it a panel's soft shadow \u2014 dark at a low alpha \u2014 came out
|
|
86
|
+
// lighter than the ground it fell on.
|
|
87
|
+
let a = color.a * alpha;
|
|
88
|
+
return vec4f(color.rgb * a, a);
|
|
89
|
+
}
|
|
90
|
+
`;var j=64,T=256,z=T/4,Q=64,b=class{constructor(e,t,n={}){this.canvas=e;this.deps=t;this.options=n;D(e,!0),this.blur=n.blur??!0,this.scheme=n.scheme??"dark",this.capabilities=v(t.gpu.device.gpu.queue,e);let o=n.platformHandlesHitTesting??this.capabilities.hitTestFollowsGeometry==="yes";this.router=new N(e,{platformHandlesHitTesting:o}),e.setAttribute("data-graview-hit",o?"platform":"router")}views=new Map;idOf=new WeakMap;resources=new Map;capturedAt={};uniforms=null;staging=new Float32Array(0);slotCount=0;nextSlot=0;freeSlots=[];reported=new Map;router;pipeline=null;sampler=null;frame=0;detachRouter=null;connectors=[];lastPlan=null;lastPlacements=[];blur;scheme;capabilities;attach(){return this.detachRouter=this.router.attach(),()=>this.detach()}detach(){this.detachRouter?.(),this.detachRouter=null}reconcile(e){let t=new Map(e.map(n=>[n.id,n]));for(let n of[...this.views.keys()])t.has(n)||this.remove(n);for(let n of e){let o=this.views.get(n.id);if(!o){this.add(n);continue}let i=o.width!==n.width||o.height!==n.height,a=o.element!==n.element||(o.dom??!1)!==(n.dom??!1);a&&this.track(n);let c=(o.opacity??1)!==(n.opacity??1),l=o.dirty||n.dirty===!0||i||a||c;this.views.set(n.id,{...n,dirty:l}),(a||i)&&delete this.capturedAt[n.id]}}add(e){if(!e.dom&&e.element.parentElement!==this.canvas)throw new Error(`View "${e.id}" must be an immediate child of the scene canvas \u2014 the capture API rejects deeper descendants. Nest inside a view, never between views.`);this.track(e),this.views.set(e.id,{...e,dirty:!0})}track(e){this.idOf.set(e.element,e.id),e.dom||M(e.element)}remove(e){let t=this.resources.get(e);t?.texture.destroy(),t&&this.freeSlots.push(t.slot),this.resources.delete(e),this.reported.delete(e),this.views.delete(e),delete this.capturedAt[e]}setBlur(e){this.blur=e}setScheme(e){this.scheme=e}setConnectors(e){this.connectors=e}invalidate(e){let t=this.views.get(e);t&&this.views.set(e,{...t,dirty:!0})}all(){return[...this.views.values()]}plan(){return this.lastPlan}placements(){return this.lastPlacements}deviceForProbe(){return this.deps.gpu.device.gpu}scheduleFrame(){m(this.canvas)}paint(e){return this.render(F(e))}render(e){let t=this.deps.gpu.device.gpu,n=t.queue;this.frame+=1;let o=this.canvas.width,i=this.canvas.height,a;if(e){a=new Set;for(let u of e){let s=this.idOf.get(u);s!==void 0&&a.add(s)}}let c=a?new Set(a):null,l=V([...this.views.values()],this.connectors,{canvasWidth:o,canvasHeight:i,capturedAt:this.capturedAt,captureBudget:this.options.captureBudget??B,scheme:this.scheme,...a?{changed:a}:{},...this.options.connectorOverrides?{connectorOverrides:this.options.connectorOverrides}:{}});this.lastPlan=l;let p=[];for(let u of l.captures){let s=this.views.get(u.viewId);if(!s)continue;let y=this.ensureResources(t,s);try{G(n,s.element,y.texture)}catch(f){if(!(f instanceof DOMException&&f.name==="InvalidStateError"))throw f;this.capturedAt[s.id]===void 0&&p.push(s.id),s.dirty||this.views.set(s.id,{...s,dirty:!0});continue}this.capturedAt[s.id]=this.frame,this.views.set(s.id,{...s,dirty:!1}),a?.delete(s.id)}for(let u of[...a??[],...l.deferred]){let s=this.views.get(u);s&&!s.dirty&&this.views.set(u,{...s,dirty:!0})}let w=t.createCommandEncoder({label:"graview-compositor"}),h=w.beginRenderPass({colorAttachments:[{view:this.deps.surface.context.getCurrentTexture().createView(),clearValue:this.options.transparent?{r:0,g:0,b:0,a:0}:this.groundColor(),loadOp:"clear",storeOp:"store"}]});h.setPipeline(this.ensurePipeline(t));let d=this.options.ground??[.957,.949,.933],U=[],x=-1;for(let u of l.draws){if(p.includes(u.viewId))continue;let s=this.resources.get(u.viewId);!s||!this.views.has(u.viewId)||(Y(this.staging,s.slot*z,u,o,i,d,this.blur),s.slot>x&&(x=s.slot),U.push(s))}x>=0&&this.uniforms&&n.writeBuffer(this.uniforms,0,this.staging.buffer,0,(x+1)*T);for(let u of U)h.setBindGroup(0,this.ensureBindGroup(t,u)),h.draw(6);let C=[];for(let u of l.placements){let s=this.views.get(u.viewId);s&&C.push({element:s.element,transform:u.transform,width:u.width,height:u.height,depth:u.depth})}if(h.end(),n.submit([w.finish()]),this.capabilities.geometrySync){let u=[];for(let s of[...l.geometry,...l.offCanvas]){let y=this.views.get(s.viewId);if(!y)continue;let f=s.transform.join(",");this.reported.get(s.viewId)!==f&&u.push({element:y.element,id:s.viewId,key:f,transform:s.transform})}for(let{element:s,id:y,key:f,transform:K}of u.slice(0,Q))O(this.canvas,s,{canvasTransform:E(K)}),this.reported.set(y,f);u.length>Q&&m(this.canvas)}return this.lastPlacements=C,this.router.setPlacements(C),p.length===0?{...l,missed:p,changed:c}:{...l,draws:l.draws.filter(u=>!p.includes(u.viewId)),missed:p,changed:c}}groundColor(){let[e,t,n]=this.options.ground??[.957,.949,.933];return{r:e,g:t,b:n,a:1}}ensurePipeline(e){if(this.pipeline)return this.pipeline;let t=e.createShaderModule({code:I,label:"graview-compositor"});return this.pipeline=e.createRenderPipeline({layout:"auto",vertex:{module:t,entryPoint:"vs_main"},fragment:{module:t,entryPoint:"fs_main",targets:[{format:navigator.gpu.getPreferredCanvasFormat(),blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}}),this.pipeline}ensureResources(e,t){let n=Math.max(1,Math.ceil(t.width)),o=Math.max(1,Math.ceil(t.height)),i=this.resources.get(t.id);if(i&&i.width===n&&i.height===o)return i;i?.texture.destroy();let a=i?.slot??this.takeSlot(e),l={texture:e.createTexture({size:[n,o],format:"rgba8unorm",usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,label:`graview-view-${t.id}`}),width:n,height:o,bindGroup:null,slot:a};return this.resources.set(t.id,l),l}takeSlot(e){let t=this.freeSlots.pop();if(t!==void 0)return t;let n=this.nextSlot++;if(n>=this.slotCount){let o=Math.max(64,this.slotCount*2);this.uniforms?.destroy(),this.uniforms=e.createBuffer({size:o*T,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,label:"graview-planes"});let i=new Float32Array(o*z);i.set(this.staging),this.staging=i,this.slotCount=o;for(let a of this.resources.values())a.bindGroup=null}return n}ensureBindGroup(e,t){return t.bindGroup||(this.sampler??=e.createSampler({magFilter:"linear",minFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}),t.bindGroup=e.createBindGroup({layout:this.ensurePipeline(e).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this.uniforms,offset:t.slot*T,size:j}},{binding:1,resource:t.texture.createView()},{binding:2,resource:this.sampler}]})),t.bindGroup}dispose(){this.detach(),this.canvas.removeAttribute("data-graview-hit");for(let e of[...this.resources.keys()])this.remove(e);this.uniforms?.destroy(),this.uniforms=null}};function ne(r,e,t,n,o=!0){let i=new Float32Array(j/4);return Y(i,0,r,e,t,n,o),i}function Y(r,e,t,n,o,i,a){r[e]=t.transform[12],r[e+1]=t.transform[13],r[e+2]=t.width,r[e+3]=t.height,r[e+4]=a?t.blur:0,r[e+5]=t.style.falloff,r[e+6]=t.style.shadow,r[e+7]=t.opacity,r[e+8]=n,r[e+9]=o,r[e+10]=0,r[e+11]=0,r[e+12]=i[0],r[e+13]=i[1],r[e+14]=i[2],r[e+15]=1}var re=3,$=4,X=1500,J=q*.75;function ie(r={}){let e=new WeakMap;return t=>{let n=e.get(t.canvas);(!n||n.disposed)&&(n=new R(t.canvas,r),e.set(t.canvas,n)),n.show(t);let o=n;return()=>o.release()}}var R=class{constructor(e,t){this.canvas=e;this.options=t;this.observer=typeof MutationObserver>"u"?null:new MutationObserver(()=>{this.stale=!0,m(this.canvas)}),this.observer?.observe(e,{childList:!0}),this.start()}disposed=!1;scene=null;compositor=null;ownDevice=null;stale=!0;onDom=new Set;lateFor=new Map;releasing=null;waiting=null;firstFrames=[];gone=!1;observer;onPaint=e=>this.paint(e);show(e){if(this.releasing&&clearTimeout(this.releasing),this.releasing=null,this.scene=e,this.stale=!0,this.compositor?.setBlur(e.blur??!0),e.scheme&&this.compositor?.setScheme(e.scheme),this.gone){e.fallBack?.();return}m(this.canvas)}release(){this.releasing&&clearTimeout(this.releasing),this.releasing=setTimeout(()=>this.dispose(),0)}async start(){try{let e=this.options.gpu;if(!e){let o=await navigator.gpu?.requestAdapter();if(!o)throw new Error("No WebGPU adapter.");let i=await o.requestDevice();this.ownDevice=i,i.lost.then(()=>{this.disposed||this.fallBack()}),e={device:{gpu:i}}}if(this.disposed)return;let t=e.device.gpu;if(!v(t.queue,this.canvas).usable)throw new Error("No element capture.");let n=this.canvas.getContext("webgpu");if(!n)throw new Error("No WebGPU context on the scene canvas.");n.configure({device:t,format:navigator.gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),this.compositor=new b(this.canvas,{gpu:e,surface:{context:n}},{transparent:!0,...this.options,blur:this.scene?.blur??this.options.blur??!0,...this.scene?.scheme?{scheme:this.scene.scheme}:{}}),this.compositor.attach(),this.canvas.addEventListener("paint",this.onPaint),this.stale=!0,this.waiting=setTimeout(()=>this.fallBack(),X),m(this.canvas)}catch{this.fallBack()}}fallBack(){if(this.gone)return;this.gone=!0,this.waiting&&clearTimeout(this.waiting),this.waiting=null,this.canvas.removeEventListener("paint",this.onPaint),this.compositor?.dispose(),this.compositor=null;let e=this.scene;e&&(e.fallBack?e.fallBack():e.drawOnDom?.(new Set(e.layout.nodes.map(t=>t.id))))}checkFirstFrame(e){let t=this.firstFrames;if(!t||(this.waiting&&clearTimeout(this.waiting),this.waiting=null,t.push(e),t.length<$))return;let n=[...t].sort((o,i)=>o-i)[Math.floor(t.length/2)];this.firstFrames=null,n>J&&this.fallBack()}paint(e){let t=this.compositor,n=this.scene;if(!t||!n)return;let o=performance.now(),i;try{this.stale&&(this.stale=!1,t.reconcile(this.views(n))),i=t.paint(e)}catch{this.fallBack();return}if(this.checkFirstFrame(performance.now()-o),this.gone)return;this.options.onFrame?.(i,t);let a=!1,c=new Set(i.deferred);for(let l of[...this.lateFor.keys()])c.has(l)||this.lateFor.delete(l);for(let l of c){if(i.changed&&!i.changed.has(l))continue;let p=(this.lateFor.get(l)??0)+1;this.lateFor.set(l,p),p>=re&&!this.onDom.has(l)&&(this.onDom.add(l),this.lateFor.delete(l),a=!0)}a&&n.drawOnDom?.(new Set(this.onDom)),(i.deferred.length>0||i.missed.length>0)&&m(this.canvas)}views(e){let t=new Map;for(let a of this.canvas.children){let c=a.getAttribute("data-graview-view");c!==null&&t.set(c,a)}let n=new Set,o=[];for(let a of H(e.layout,e.dirty).views){n.add(a.id);let c=t.get(a.id)??e.hostOf(a.id);c&&o.push({...a,element:c,...c.parentElement===this.canvas?{}:{dom:!0}})}let i=!1;for(let a of this.onDom)n.has(a)||(this.onDom.delete(a),i=!0);return i&&e.drawOnDom?.(new Set(this.onDom)),o}dispose(){this.disposed=!0,this.waiting&&clearTimeout(this.waiting),this.waiting=null,this.observer?.disconnect(),this.canvas.removeEventListener("paint",this.onPaint),this.compositor?.dispose(),this.compositor=null,this.ownDevice?.destroy(),this.ownDevice=null}};export{I as COMPOSITOR_WGSL,b as Compositor,$ as FIRST_FRAMES,J as FIRST_FRAME_BUDGET_MS,X as FIRST_PAINT_WAIT_MS,A as IDENTITY,g as PlatformUnavailableError,ie as attachGpu,G as captureElement,ee as captureElementImage,F as changedElementsOf,te as clearElementGeometry,v as detectCapabilities,k as isAffine,M as markDrawable,ne as packUniform,_ as perspectiveProbeMatrix,L as planeTransform,m as requestPaint,D as setLayoutSubtree,E as toDOMMatrix,O as updateElementGeometry};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g}from"./chunk.TI4OSTQV.js";import{
|
|
1
|
+
import{a as g}from"./chunk.TI4OSTQV.js";import{Db as c,Hb as y,Ta as p}from"./chunk.MNP4JI33.js";function h(t,i=()=>!0){let e=c(t),n=new Set(t.map(o=>o.lineage?.suggestion));return t.filter(o=>o.suggests&&!o.withheld&&!e.has(o.id)&&!n.has(o.id)).map(({id:o,batch:s,suggests:r,intent:x,author:b,lineage:d,at:O})=>{let l=new Set;return JSON.stringify(r.map(u=>u.args),(u,a)=>(typeof a=="string"&&i(a)&&l.add(a),a)),{id:o,batch:s,calls:r,intent:x,author:b,...d?{lineage:d}:{},at:O,about:[...l]}})}function S(t,i){return t.ops.length>0&&t.ops.every(e=>e.suggests!==void 0||e.undoes!==void 0&&i(e.undoes)?.suggests!==void 0)}var f=t=>JSON.stringify([t.kind,t.id??"",t.name??""]);function I(t,i=()=>{}){let e=[];for(let n of t){if(S(n,i))continue;let o=e.at(-1);if(!y(n.author)){e.push({batch:n});continue}if(o&&"digest"in o&&f(o.digest.author)===f(n.author)){let s=[...o.digest.batches,n];e[e.length-1]={digest:{author:o.digest.author,batches:s,things:m(s),at:n.at}}}else e.push({digest:{author:n.author,batches:[n],things:m([n]),at:n.at}})}return e}var m=t=>t.reduce((i,e)=>i+(e.undone?0:e.ops.length),0);function j(t,i=new Date().toISOString().slice(0,10)){let e=t.at.slice(0,10),n=e===i?"today":`on ${new Date(`${e}T12:00:00Z`).toLocaleDateString("en-US",{month:"short",day:"numeric",timeZone:"UTC"})}`;return`Tidied ${t.things===1?"one thing":`${t.things} things`} ${n}`}var A=t=>t;function v(t,i){let e=g(t),n=e?.store??t,o=i??e?.principal,s=(o!==void 0?n.seenBy(o):n).log.all();return h(s,r=>n.graph.has(r))}function w(t,i,e){let n=v(t,e).find(o=>o.id===i);if(!n)throw new p("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return n}function D(t,i,e={}){let n=g(t)?.store??t,o=e.author??A(n).by,s=w(n,i,o);return n.applyAll(s.calls,{...e,author:o,lineage:{...s.lineage,suggestion:i}})}function L(t,i,e={}){let n=g(t)?.store??t,o=e.author??A(n).by,s=w(n,i,o);return n.undo(s.batch,{...e,author:o})}export{I as a,j as b,v as c,D as d,L as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as p}from"./chunk.JOOQUWLT.js";import{Q as c}from"./chunk.6QWV5MVH.js";import{Kb as u}from"./chunk.MNP4JI33.js";import{b as h}from"./chunk.AJZBJBMO.js";var s={person:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><circle cx="11.6" cy="5.4" r="2.5"/><path d="M7.9 12.4c0-2.1 1.7-3.8 3.7-3.8s3.7 1.7 3.7 3.8v3.2H7.9z"/><path d="M8 12.6 6.4 17.2"/><path d="M15.2 12.6 16.8 17.2"/><path d="M9.8 15.6v5"/><path d="M13.4 15.6v5"/></svg>',plot:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.6 9.4 12 4.6l9.4 4.8-9.4 4.8z"/><path d="M2.6 9.4v4.4l9.4 4.8 9.4-4.8V9.4"/><path d="M12 14.2v4.4"/><path d="M7 11.9v3"/><path d="M17 11.9v3"/></svg>',box:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.4 7.9 12 3.6l8.6 4.3-8.6 4.3z"/><path d="M3.4 7.9v8.2L12 20.4l8.6-4.3V7.9"/><path d="M12 12.2v8.2"/></svg>',task:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 6.6 12 2.9l7.6 3.7v9.5L12 19.8 4.4 16.1z"/><path d="M12 12.4v7.4"/><path d="M4.4 6.6 12 10.3l7.6-3.7"/><path d="M8 9.6l2.4 2.4L16 8.4"/></svg>',shift:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.2 8.2 12 4l8.8 4.2-8.8 4.2z"/><path d="M3.2 8.2v7.2L12 19.6l8.8-4.2V8.2"/><path d="M12 12.4v7.2"/><path d="M6.6 10.8v3.4"/><path d="M9.3 12v3.4"/></svg>',list:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 10.4 12 6l9.2 4.4-9.2 4.4z"/><path d="M2.8 10.4v3.2L12 18l9.2-4.4v-3.2"/><path d="M6.6 8.6 15.8 13"/><path d="M9.4 7.2 18.6 11.6"/></svg>',vehicle:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 14.2 5 9.4l8.6-1.6 5.4 3-1 3.6z"/><path d="M2.8 14.2v2.2h2.4"/><path d="M18 16.4h1.9l.1-2.2"/><circle cx="7.6" cy="16.6" r="1.9"/><circle cx="16.1" cy="16.6" r="1.9"/><path d="M8.6 8.2 9.8 12l7.2-1"/></svg>',rule:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 19.4V6.6l12 12.8z"/><path d="M5.4 6.6 7.6 5.5l12 12.8-2.2 1.1"/><path d="M5.4 19.4 7.6 18.3h12"/><path d="M5.4 10.1h1.7"/><path d="M5.4 13.3h1.7"/><path d="M5.4 16.5h1.7"/></svg>',note:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6.2 6.2 14.8 10.5v9L6.2 15.2z"/><path d="M12.4 9.3 14.8 10.5l-.6 2.3"/><path d="M8.2 10.6 12.8 12.9"/><path d="M8.2 13.2 11.4 14.8"/></svg>'},v=Object.keys(s);function i(e){if(e)return s[e]??(e.trimStart().startsWith("<svg")?e:void 0)}var a=h(c(),1);function A({kind:e,schema:o,brand:n,size:r=16,title:t}){let f=o?.tryDefinition?.(e)?.figure,d=i(n?.figures?.[e]??f),l=Math.round(u(e,n?.accents)),g=p(d);return d?(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"figure",dangerouslySetInnerHTML:g,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:r,height:r,flex:"0 0 auto",color:`hsl(${l} 55% 52%)`,"--graview-figure-size":`${r}px`}}):(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"dot",style:{display:"inline-block",width:Math.round(r*.8),height:Math.round(r*.5),flex:"0 0 auto",background:`hsl(${l} 55% 52%)`,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)"}})}function C(e,o,n){return i(n?.figures?.[e]??o?.tryDefinition?.(e)?.figure)!==void 0}export{A as a,C as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as R}from"./chunk.3HXN4BOY.js";import"./chunk.GYICGZMG.js";import"./chunk.SHTJZ6UX.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ULRW47RP.js";import"./chunk.PBSMLINK.js";import"./chunk.3TY5NFLY.js";import"./chunk.D75KC3LL.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import"./chunk.GZHZLJBF.js";import{n as x}from"./chunk.XMC7YDWT.js";import"./chunk.6UGEYZAC.js";import"./chunk.OJGHDWI6.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import"./chunk.JOOQUWLT.js";import{F as k,Q as v,Z as g}from"./chunk.6QWV5MVH.js";import{ca as m,dc as A,fa as c}from"./chunk.MNP4JI33.js";import{b as u}from"./chunk.AJZBJBMO.js";var f=u(k(),1);var S=u(k(),1),L=(0,S.createContext)(void 0);var i=u(v(),1),W=new WeakMap,y=new WeakMap,P=(e,n)=>`${n.kind}\0${n.id??""}\0${e}`;function C(e,n,r){let o=P(n,r),p=W.get(e);p||W.set(e,p=new Map);let t=p.get(o);return t||(t=Promise.resolve().then(()=>e(n,r)).then(a=>b(a)?a:null,()=>null).then(a=>{let s=y.get(e);return s||y.set(e,s=new Map),s.set(o,a),a}),p.set(o,t)),t}function b(e){if(e===null)return!0;if(typeof e!="object"||e===void 0)return!1;if(e.denied===!0)return!0;let n=e;return typeof n.name=="string"&&n.name.trim()!==""&&typeof n.href=="string"}function h(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}}var N=e=>h(e)??(c(e)?e:void 0),E=e=>h(e)??(e.startsWith("/")&&c(e)?e:void 0),I={kind:"human"},w={color:"var(--graview-ink-muted)"};function M({icon:e}){if(!e)return null;let n=E(e);if(n)return(0,i.jsx)("img",{src:n,alt:"",width:20,height:20,"data-graview-app-icon":"",style:{width:20,height:20,borderRadius:5,objectFit:"cover",flex:"0 0 auto"}});let r=[...e.trim()].slice(0,2).join("");return r?(0,i.jsx)("span",{"aria-hidden":"true","data-graview-app-icon":"",style:{flex:"0 0 auto",lineHeight:"20px"},children:r}):null}function V(e){let n=g(),r=(0,f.useContext)(L)??n?.resolveApp,o=n?.principal??I,p=()=>r?y.get(r)?.get(P(e,o))??"asking":null,[t,a]=(0,f.useState)(p);return(0,f.useEffect)(()=>{let s=p();if(a(s),s!=="asking"||!r)return;let l=!0;return C(r,e,o).then(d=>l&&a(d)),()=>{l=!1}},[r,e,o.kind,o.id]),t}function D({address:e,as:n="chip",nodeId:r,field:o,style:p}){let t=V(e),a={position:"relative",zIndex:A.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%",...p},s;if(t==="asking")s=(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"asking","aria-busy":"true",style:{...w,...a},children:"Linked app"});else if(t&&"denied"in t)s=(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"denied",style:{...w,fontStyle:"italic",...a},children:"linked app (no access)"});else if(t){let l=N(t.href),d=n==="record"?t.headline?.trim():void 0;s=(0,i.jsxs)(l?"a":"span",{"data-graview-app-link":"","data-graview-app-state":"found",...l?{href:l}:{},...!d&&t.headline?{title:t.headline}:{},style:{display:"inline-flex",alignItems:d?"flex-start":"center",minHeight:24,gap:8,color:"inherit",textUnderlineOffset:3,...a},children:[(0,i.jsx)(M,{icon:t.icon}),(0,i.jsxs)("span",{style:{display:"grid",minWidth:0},children:[(0,i.jsx)("span",{"data-graview-app-name":"",style:{fontWeight:600},children:t.name}),d?(0,i.jsx)("span",{"data-graview-app-headline":"",style:{...w,fontSize:"0.8125em",fontWeight:400},children:d}):null]})]})}else{let l=h(e);s=l?(0,i.jsx)("a",{"data-graview-app-link":"","data-graview-app-state":"plain",href:l,rel:"noopener noreferrer",target:"_blank",style:{color:"var(--graview-accent)",display:"inline-flex",alignItems:"center",minHeight:24,...a},children:e}):(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"plain",style:a,children:e})}return r&&o?(0,i.jsx)(H,{nodeId:r,field:o,address:e,drawn:s}):s}function H({nodeId:e,field:n,address:r,drawn:o}){let p=x(e).fields.some(s=>s.field===n),t=g()?.store;if(!p)return o;let a=m(t?t.schema.tryDefinition(String(t.graph.getNode(e)?.kind)):void 0,n).toLowerCase();return(0,i.jsxs)("span",{style:{display:"inline-flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px",maxWidth:"100%",minWidth:0},children:[o,(0,i.jsx)("span",{style:{fontSize:"0.8125rem"},children:(0,i.jsx)(R,{nodeId:e,field:n,value:"Change",stored:r,said:`Change the ${a}`})})]})}var _=e=>(0,i.jsx)(D,{...e});export{D as AppLink,_ as drawAppLink};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as a}from"./chunk.
|
|
1
|
+
import{g as a}from"./chunk.FWTIUYXH.js";import{c as p}from"./chunk.MAF7C3VM.js";import{ua as d}from"./chunk.MNP4JI33.js";function v(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(([l,h])=>[l,h.cardinality??"many"])),...o?{computed:o}:{},...s.size>0?{linked:s}:{}})}let t=a(n);return t&&r.set(p,{computed:t}),r}export{v as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as ie}from"./chunk.B2GLDIAS.js";import{b as Te,d as Ce}from"./chunk.6YCBYL2Y.js";import{e as je}from"./chunk.UGFJKSHU.js";import{$ as Ae,Ac as Re,Cc as De,Dc as We,H as be,Ib as te,Ka as we,Ma as E,T as R,U as ke,Vc as Me,W as B,X as L,Y as xe,Z as v,aa as Ne,gc as re,kc as Se,lc as ve,yc as Oe}from"./chunk.MNP4JI33.js";function oe(n,e){return n.display?.labels?.[e]??v(e)}function ae(n){let e=ie(n);switch(e.type){case"text":case"date":case"number":case"boolean":case"choice":return e.type;default:return}}function Ye(n,e){let t=new Map,r=n.tryDefinition(e);for(let[o,i]of Object.entries(r?.edges??{}))t.set(o,{key:o,label:i.description?R(i.description):v(o),about:"edge",far:i.to==="*"?[...n.kinds]:[...i.to]});for(let o of n.definitions)if(o.kind!==e)for(let[i,d]of Object.entries(o.edges??{}))t.has(i)||d.to!=="*"&&!d.to.includes(e)||t.set(i,{key:i,label:d.inverse?R(d.inverse):v(i),about:"edge",far:[o.kind]});return[...t.values()]}var Je=["current","past","any","flagged","clear"];function Ie(n,e){let t=n?.lifecycle;if(!t||t.retired==="date")return!1;let r=t.retired.map(String);return e.some(o=>o.key===t.field&&r.includes(o.value))}function Fe(n,e){let t=n.tryDefinition(e);if(!t)return{kind:e,sorts:[],filters:[],groups:[]};let r=new Set(t.display?.hide??[]),o=t.fields.shape??{},i=[{key:"label",label:"Name",about:"label",type:"text"}],d=[],f=[];for(let[g,p]of Object.entries(o)){if(g==="id"||g==="kind"||g==="label"||r.has(g))continue;let A=ae(p);if(!A)continue;let O=oe(t,g),N=A==="choice"?Be(p):A==="boolean"?["true","false"]:void 0,w={key:g,label:O,about:"field",type:A,...N?{options:N}:{}};i.push(w),d.push(w),(A==="boolean"||A==="choice")&&f.push(w),A==="date"&&f.push({...w,buckets:["day","week","month","year","decade"]})}for(let g of Ye(n,e))i.push(g),d.push(g),f.push(g);let l={key:"is",label:t.lifecycle?"Standing and currency":"Standing",about:"is",type:"choice",options:t.lifecycle?[...Je]:["flagged","clear"]};d.push(l);let y=t.fieldRoles?.order,u=y&&(y in o||y==="label")?{by:y,direction:"asc"}:void 0;return{kind:e,sorts:i,filters:d,groups:f,...u?{natural:u}:{}}}function vn(n,e){let t=[];for(let o of e.filters){let i=o.about==="edge"&&o.far?.length===1?n.tryDefinition(o.far[0]):void 0;if(!(!i||i.kind===e.kind))for(let[d,f]of Object.entries(i.fields.shape??{}))ae(f)!=="choice"||i.display?.hide?.includes(d)||t.push({key:`${o.key}.${d}`,label:`${o.label} \xB7 ${oe(i,d)}`,about:"via",type:"choice",options:Be(f),far:[i.kind]})}if(t.length===0)return e;let r=e.filters.filter(o=>o.about!=="is");return{...e,filters:[...r,...t,...e.filters.filter(o=>o.about==="is")]}}function On(n,e){let t=n.tryDefinition(e.kind),r=Object.entries(t?.computed??{});if(!t||r.length===0)return e;let o=r.filter(([i])=>!e.sorts.some(d=>d.key===i)).map(([i,d])=>({key:i,label:(typeof d=="object"?d.label:void 0)??oe(t,i),about:"field",type:"number"}));return{...e,sorts:[...e.sorts,...o]}}function Be(n){let e=ie(n);return e.type==="choice"?e.options:[]}var $e=n=>n,Pe=n=>n;function Ze(n,e,t){let r=new Map;for(let o of[...n.out(e,t),...n.in(e,t)])r.set(o.id,o);return[...r.values()]}function se(n,e,t){let r=n.schema.tryDefinition(e.kind);if(t.key==="is")switch(t.value){case"current":return B(r,Pe(e),n.today);case"past":return!B(r,Pe(e),n.today);case"any":return!0;case"flagged":return n.flagged?.has(e.id)??!1;case"clear":return!(n.flagged?.has(e.id)??!1);default:return!0}let o=r?.fields.shape??{};if(t.key in o){let l=we($e(e),t.key,n.today??be()),y=ae(o[t.key]);if(y==="date"){let[u,g]=t.value.split(":");if(typeof l!="string"||!g)return!1;let p=l.slice(0,10);return u==="before"?p<g:u==="after"?p>g:p===g}if(y==="boolean")return String(l)===t.value;if(y==="number"){let u=t.value.lastIndexOf(":"),g=u>0?t.value.slice(0,u):"",p=Number(t.value.slice(u+1));if(g==="at-most"||g==="at-least")return typeof l!="number"||!Number.isFinite(p)?!1:g==="at-most"?l<=p:l>=p}return String(l)===t.value}let[i,d]=t.key.split("."),f=Ze(n.graph,e.id,i);return d?f.some(l=>String($e(l)[d])===t.value):t.value==="*"?f.length>0:t.value==="none"?f.length===0:f.some(l=>l.id===t.value)}var en=5;function _e(n){return n.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function de(n){return _e(n).replace(/ /g,"")}var _=new Map,nn=5e4;function K(n){let e=_.get(n);if(e===void 0){_.size>=nn&&_.clear();let t=_e(n);e={tokens:t.split(" ").filter(Boolean),whole:t.replace(/ /g,"")},_.set(n,e)}return e}var D=n=>[...K(n).tokens];function j(n,e){if(e.length===0)return;let{whole:t,tokens:r}=K(n),o=e.join("");if(t.length===0)return;if(t===o)return"exact";if(e.every(d=>r.some(f=>f.startsWith(d))))return t.startsWith(o)?"prefix":e.every(d=>r.includes(d))?"word":"part"}function q(n,e,t=48){let r=n.replace(/\s+/g," ").trim();if(r.length<=t)return r;let o=e[0],i=r.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase(),d=o?i.search(new RegExp(`(^|[^\\p{L}\\p{N}])${tn(o)}`,"u")):-1,f=d<0?0:d+(i[d]&&/[\p{L}\p{N}]/u.test(i[d])?0:1),l=Math.max(0,f-Math.floor(t/3));if(l>0){let u=r.lastIndexOf(" ",l);l=u<0?0:u+1}let y=Math.min(r.length,l+t);if(y<r.length){let u=r.indexOf(" ",y);y=u<0||u-y>16?y:u}return`${l>0?"\u2026":""}${r.slice(l,y).trim()}${y<r.length?"\u2026":""}`}var tn=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),rn=/^([\p{L}][\p{L}\p{N}_-]*):(\S+)$/u;function on(n){let e=[],t=[];for(let r of n.trim().split(/\s+/).filter(Boolean)){let o=rn.exec(r);o?t.push({key:o[1],value:o[2]}):e.push(r)}return{words:e.join(" "),conditions:t}}var Le=new WeakMap;function G(n,e){let t=Le.get(e);if(t&&t.definition===n)return t.texts;let r=an(n,e);return Le.set(e,{definition:n,texts:r}),r}function an(n,e){let t=L(n,e),r=[{field:"label",reading:"Name",text:t}];for(let o of Ce(e,n,{limit:Number.POSITIVE_INFINITY}))o.key==="label"||o.value===t||typeof e[o.key]!="boolean"&&r.push({field:o.key,reading:o.label,text:o.markdown?je(o.value):o.value});return r}var T={exact:0,prefix:1,word:2,part:3,field:4,near:5},ze=new Set(["a","an","the","of","and","or","for","to","in","on","at","by","with","my","our","is"]);function Ee(n){let e=n;e.length>4&&e.endsWith("ies")?e=`${e.slice(0,-3)}y`:e.length>4&&/(ss|x|ch|sh|z)es$/.test(e)?e=e.slice(0,-2):e.length>3&&e.endsWith("s")&&!/(ss|us|is)$/.test(e)&&(e=e.slice(0,-1));for(let t of["ing","ed"])if(e.length>t.length+2&&e.endsWith(t)){e=e.slice(0,-t.length),/([b-df-hj-km-np-rtv-z])\1$/.test(e)&&(e=e.slice(0,-1));break}return e.length>3&&e.endsWith("e")?e.slice(0,-1):e}function Ke(n,e,t){if(Math.abs(n.length-e.length)>t)return t+1;let r=[],o=Array.from({length:e.length+1},(i,d)=>d);for(let i=1;i<=n.length;i++){let d=[i],f=i;for(let l=1;l<=e.length;l++){let y=Math.min(o[l]+1,d[l-1]+1,o[l-1]+(n[i-1]===e[l-1]?0:1));i>1&&l>1&&n[i-1]===e[l-2]&&n[i-2]===e[l-1]&&(y=Math.min(y,r[l-2]+1)),d[l]=y,y<f&&(f=y)}if(f>t)return t+1;r=o,o=d}return o[e.length]}var z=new Map;function sn(n,e){let t=z.get(n);t||(z.size>=64&&z.clear(),z.set(n,t=new Map));let r=t.get(e);return r===void 0&&(r=dn(n,e)??null,t.set(e,r)),r??void 0}function dn(n,e){if(/\d/.test(n))return;let t=Ee(n);if(t.length>=3&&(Ee(e)===t||t.length>=4&&e.startsWith(t)))return"stem";let r=n.length<4?0:n.length<=7?1:2;if(r!==0){if(Ke(n,e,r)<=r)return"spelling";if(n.length>=5){for(let o=n.length-r;o<=n.length+r;o++)if(o<e.length&&Ke(n,e.slice(0,o),r)<=r)return"spelling"}}}function ln(n,e){let t=e.length>1?e.filter(o=>!ze.has(o)):e;if(t.length===0)return;let r;for(let o of t){let i;for(let d of n){for(let f of K(d.text).tokens){if(f.startsWith(o)){i={text:d,matched:f};break}let l=i?void 0:sn(o,f);l&&(i={text:d,matched:f,by:l})}if(i&&!i.by)break}if(!i)return;i.by&&!r&&(r={text:i.text,asked:o,matched:i.matched,by:i.by})}if(r)return{field:r.text.field,reading:r.text.reading,fragment:q(r.text.text,[r.matched]),strength:"near",asked:r.asked,matched:r.matched,by:r.by}}var cn=80;function fn(n,e,t){let r=D(e).filter(d=>!ze.has(d)).join(" ")||e,o=t===void 0?[]:D(t),i=o.length>0&&n.find(d=>o.every(f=>K(d.text).tokens.some(l=>l.startsWith(f))))||n[0];return{field:i.field,reading:i.reading,fragment:q(i.text,o),strength:"near",asked:r,matched:(t??i.text).slice(0,cn),by:"meaning"}}function He(n,e,t){let r=D(t);if(r.length===0)return;let o=G(n,e),[i,...d]=o,f=j(i.text,r);if(f)return{field:"label",reading:i.reading,fragment:q(i.text,r),strength:f};let l=p=>A=>K(A.text).tokens.some(O=>O.startsWith(p));if(!r.every(p=>o.some(l(p))))return;let y=D(i.text),u=r.find(p=>!y.some(A=>A.startsWith(p)))??r[0],g=d.find(l(u));return{field:g.field,reading:g.reading,fragment:q(g.text,[u]),strength:"field"}}var un=512,gn=64;function yn(n){let e=new Map;if(n.length===0)return e;let t=n.slice(-un),r=n[n.length-1].seq;for(let o of t){let i=Math.pow(.5,(r-o.seq)/gn);for(let d of o.writes)e.set(d,(e.get(d)??0)+i)}return e}var ce=(n,e)=>Ae({tryDefinition:()=>n},e),le=(n,e)=>Re({tryDefinition:()=>n},e);function hn(n,e,t){let r=n.tryDefinition(e),o=[{field:"plural",text:ce(r,e)},{field:"kind",text:v(e)},...r?.noun?[{field:"noun",text:r.noun}]:[]],i;for(let d of o){let f=j(d.text,t);f&&(!i||T[f]<T[i.strength])&&(i={strength:f,...d})}return i}var pn,mn=(n,e)=>(pn??=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0})).compare(n,e),Ge=(n,e)=>(n.nearly??0)-(e.nearly??0)||(n.archived??0)-(e.archived??0)||n.tier-e.tier||n.inKind-e.inKind||n.near-e.near||n.past-e.past||n.touched-e.touched||n.flagged-e.flagged||mn(n.name,e.name)||(n.id<e.id?-1:n.id>e.id?1:0);function En(n,e,t={}){let r=n.schema,o=on(e),i=D(o.words),d=t.principal??{kind:"human"},f=n.kindsKeptFrom(d),l=n.modules.disabledKinds,y=o.conditions.filter(a=>a.key==="kind").map(a=>a.value),u=o.conditions.filter(a=>a.key==="is").map(a=>a.value),g=u.includes("any")||u.includes("past"),p=u.includes("past")&&!u.includes("any")&&!u.includes("current"),A=u.includes("archived")?!0:t.archived??"all",O=(a,s)=>{let c=de(s),h=r.tryDefinition(a);return de(a)===c||de(ce(h,a))===c},N=r.kinds.filter(a=>!f.has(a)&&!l.has(a)&&(t.kinds===void 0||t.kinds.includes(a))&&(y.length===0||y.some(s=>O(a,s)))),W=o.conditions.filter(a=>a.key!=="kind").map(a=>({...a,admittedBy:N.filter(s=>Fe(r,s).filters.some(c=>c.key===a.key))})),Q=W.filter(a=>a.key!=="is"),C=u.filter(a=>a==="flagged"||a==="clear"||a==="past"||a==="archived"),U={kinds:N,past:g},qe={hits:[],words:o.words,conditions:W,searched:U,byKind:{},total:0,matched:[]};if(i.length===0&&Q.length===0&&C.length===0)return qe;let V=t.today,$=t.flagged??new Set(n.violations().flatMap(a=>a.nodeIds)),Qe=t.touched??yn(n.log.all()),X=new Set;for(let a of t.from??[]){X.add(a);for(let s of n.graph.neighbors(a))X.add(s.id)}let fe=Se(n,d)?ve(n,d):void 0,Y=re.keptFrom?.(n,d)&&n.seenBy(d).graph,J=a=>Me(a,t.basePath===void 0?{}:{basePath:t.basePath}),ue={schema:r,graph:n.graph,flagged:$,...V?{today:V}:{}},S=[],P={},I=[],Z=[],H=(a,s,c,h,m,b)=>{let x=L(c,a);P[s]=(P[s]??0)+1,S.push({hit:{about:"node",id:a.id,kind:s,label:x,why:m,current:h,flagged:$.has(a.id),address:J(`${le(c,s)}/${encodeURIComponent(a.id)}`),...b===void 0?{}:{near:!0},...E(a)?{archived:!0}:{}},...b===void 0?{}:{nearly:2-b},tier:T[m.strength],inKind:s===t.inKind?0:1,near:X.has(a.id)?0:1,past:h?0:1,archived:E(a)?1:0,touched:-(Qe.get(a.id)??0),flagged:$.has(a.id)?0:1,name:x,id:a.id})};for(let a of N){let s=r.tryDefinition(a),c=W.filter(m=>m.key!=="is"&&m.admittedBy.includes(a));if(i.length===0&&c.length===0&&C.length===0)continue;let h=Ie(s,c);for(let m of n.graph.nodesOfKind(a,{archived:A})){if(fe&&!fe(m.id))continue;let b=Y?Y.getNode(m.id):m;if(!b)continue;let x=B(s,b,V);if(!g&&!h&&!x){if(i.length>0&&u.length===0&&c.every(k=>se(ue,b,k))){let k=He(s,b,o.words);k&&Z.push({node:b,kind:a,definition:s,why:k})}continue}if(p&&x||!c.every(k=>se(ue,b,k))||u.includes("flagged")&&!$.has(b.id)||u.includes("clear")&&$.has(b.id))continue;let M=i.length>0?He(s,b,o.words):c[0]?{field:c[0].key,reading:v(c[0].key),fragment:`${c[0].key}:${c[0].value}`,strength:"field"}:{field:"is",reading:"Is",fragment:`is:${C[0]}`,strength:"field"};M?H(b,a,s,x,M):i.length>0&&I.push({node:b,kind:a,definition:s,current:x})}}let ge=!1;if(Z.length>0&&S.length===0){ge=!0;for(let a of Z)H(a.node,a.kind,a.definition,!1,a.why)}let ye=t.near!==!1&&i.length>0&&S.length<en&&I.length>0,ee=new Set;if(ye)for(let a of I){let s=ln(G(a.definition,a.node),i);s&&(ee.add(a.node.id),H(a.node,a.kind,a.definition,a.current,s,s.by==="stem"?.9:.8))}let Ue=a=>a==="exact"||a==="prefix"?-1:T[a],ne=(a,s,c,h)=>({hit:a,tier:Ue(s),inKind:1,near:1,past:0,touched:0,flagged:1,name:c,id:h});if(i.length>0){for(let s of N){let c=hn(r,s,i);if(!c)continue;let h=Ne(r,s),m={field:c.field,reading:c.field==="plural"?"Plural":"Kind",fragment:c.text,strength:c.strength};S.push(ne({about:"kind",kind:s,label:h,why:m,count:P[s]??0,address:J(le(r.tryDefinition(s),s))},c.strength,h,`kind:${s}`))}let a=t.places??[];for(let s of Oe(a.filter(c=>N.includes(c.kind)))){if(s.across&&f.has(s.across))continue;let c=j(s.title,i);if(!c)continue;let h={field:"title",reading:"Title",fragment:s.title,strength:c},m=We(s,a)?le(r.tryDefinition(s.kind),s.kind).slice(1):void 0,b=J(De(s.as,m));S.push(ne({about:"place",kind:s.kind,title:s.title,as:s.as,why:h,address:b},c,s.title,`place:${s.kind}:${s.as}`))}for(let s of n.allInvariants()){let c=s.scope==="graph"?void 0:s.scope.kind;if(c&&!N.includes(c))continue;let h=s.label??v(s.name),m=j(h,i),b=m?void 0:j(v(s.name),i),x=m??b;if(!x)continue;let M={field:m?"label":"name",reading:m?"Rule":"Name",fragment:m?h:s.name,strength:x};S.push(ne({about:"rule",name:s.name,label:h,...c?{kind:c}:{},why:M},x,h,`rule:${s.name}`))}}let he=()=>{S.sort(Ge);let a=t.limit??50,s=S.slice(0,a).map(k=>k.hit),c=s.flatMap(k=>k.about==="node"?[(Y||n.graph).getNode(k.id)]:[]).filter(Boolean),h=Te(c,k=>r.tryDefinition(k)),m=s.map(k=>k.about==="node"&&h.has(k.id)?{...k,apart:h.get(k.id)}:k),b=Object.values(P).reduce((k,Xe)=>k+Xe,0),x=S.flatMap(k=>k.hit.about==="node"?[k.hit.id]:[]),M=t.subject&&N.includes(String(n.graph.getNode(t.subject)?.kind))?bn(n,t.subject,o.words,{principal:d}):[];return{hits:[...m,...M],words:o.words,conditions:W,searched:ge?{...U,past:!0}:U,byKind:{...P},total:b,matched:x}},F=he(),pe=t.rank;if(!ye||!pe)return F;let me=I.filter(a=>!ee.has(a.node.id)).map(({node:a,kind:s,definition:c})=>({id:a.id,kind:s,label:L(c,a),texts:G(c,a)}));if(me.length===0)return F;let Ve=(async()=>{let a;try{a=await pe(o.words,me)}catch{return F}let s=new Map(I.filter(h=>!ee.has(h.node.id)).map(h=>[h.node.id,h])),c=!1;for(let{id:h,score:m,matched:b}of Array.isArray(a)?a:[]){let x=s.get(h);!x||!(m>0)||(s.delete(h),c=!0,H(x.node,x.kind,x.definition,x.current,fn(G(x.definition,x.node),o.words,typeof b=="string"?b:void 0),Math.min(1,m)))}return c?he():F})();return{...F,later:Ve}}function bn(n,e,t,r={}){let o=r.principal??{kind:"human"},i=(re.keptFrom?.(n,o)?n.seenBy(o):n).graph.getNode(e);if(!i)return[];if(n.kindsKeptFrom(o).has(i.kind))return[];let d=D(t),f=L(n.schema.tryDefinition(i.kind),i),l=[];for(let u of n.allMutations()){let g=u.subject;if(!g||g.kinds!=="*"&&!g.kinds.includes(i.kind))continue;let p=u.derived?.act;if((p==="archive"||p==="merge")&&E(i)||p==="unarchive"&&!E(i)||p==="leave-alone"&&te(i)||p==="allow-tidying"&&!te(i)||!n.permits({name:u.name,args:{[g.arg]:i.id}},o).ok)continue;let A=xe(u),O=D(A),N=d.filter(Q=>O.some(C=>C.startsWith(Q))),w=N.length>0?j(A,N):void 0,W=w?{field:"title",reading:"Act",fragment:A,strength:w}:{field:"subject",reading:"On",fragment:f,strength:"field"};l.push({hit:{about:"act",name:u.name,title:A,subject:i.id,why:W,destructive:u.destructive===!0},tier:w?T[w]:T.field+1,inKind:0,near:0,past:u.destructive?1:0,touched:0,flagged:u.pinned?0:1,name:A,id:`act:${u.name}`})}l.sort(Ge);let y=l.map(u=>u.hit);return r.limit===void 0?y:y.slice(0,r.limit)}function Kn(n,e){let t=e.kinds.map((i,d)=>{let f=ce(n.tryDefinition(i),i);return d===0?f:f.toLowerCase()}),r=ke(t)||"Nothing";return e.kinds.some(i=>n.tryDefinition(i)?.lifecycle)?e.past?`${R(r)}, past ones included.`:`${R(r)}, current ones; add is:any for past ones.`:`${R(r)}.`}export{oe as a,ae as b,Ye as c,Ie as d,Fe as e,vn as f,On as g,Be as h,$e as i,Pe as j,Ze as k,se as l,de as m,on as n,He as o,yn as p,En as q,bn as r,Kn as s};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as he,b as xe,c as be,d as ie,e as I}from"./chunk.XDYAG276.js";import{c as A,e as re}from"./chunk.
|
|
1
|
+
import{a as he,b as xe,c as be,d as ie,e as I}from"./chunk.XDYAG276.js";import{c as A,e as re}from"./chunk.MWGGV7DE.js";import{a as te}from"./chunk.6UGEYZAC.js";import{F as U,Q as Z,Y as ee,_ as ne}from"./chunk.6QWV5MVH.js";import{N as j,X as J,cc as Q}from"./chunk.MNP4JI33.js";import{b as C}from"./chunk.AJZBJBMO.js";var w=C(U(),1);var P=C(U(),1),ke=(e,n)=>`graview:last-visit:${n??"anyone"}:${e.join(",")}`;function Pe(e,n,r){let t=new Set;for(let i of e)if(!(i.author.id!==void 0&&i.author.id===r)&&Date.parse(i.at)>n)for(let o of i.writes)t.add(o);return t}function oe(e,n,r){let t=ke(n,r?.id),[i]=(0,P.useState)(()=>{try{let o=globalThis.localStorage?.getItem(t);return o?Number(o):null}catch{return null}});return(0,P.useEffect)(()=>{let o=()=>{if(document.visibilityState==="hidden")try{globalThis.localStorage?.setItem(t,String(Date.now()))}catch{}};return document.addEventListener("visibilitychange",o),window.addEventListener("pagehide",o),()=>{document.removeEventListener("visibilitychange",o),window.removeEventListener("pagehide",o)}},[t]),(0,P.useMemo)(()=>i===null?new Set:Pe(e,i,r?.id),[e,i,r?.id])}function ae(e,n,r){let t=new Set;if(r===void 0)return t;t.add(r);for(let i of[...e.out(r),...e.in(r)])t.add(i.id);for(let i of n)if(i.author.id===r)for(let o of i.primitives)o.op==="add-node"&&t.add(o.node.id);return t}var g=C(Z(),1);function Se(e,n,r={x:0,y:0}){let t=(i,o)=>{let c=A(i,o,n.cell,n.tilt);return{x:n.originX+r.x+c.x,y:n.originY+r.y+c.y}};return[t(e.col,e.row),t(e.col+e.side,e.row),t(e.col+e.side,e.row+e.side),t(e.col,e.row+e.side)]}var B=e=>e.map(n=>`${n.x.toFixed(1)},${n.y.toFixed(1)}`).join(" ");function Ie({frame:e,width:n,height:r,pan:t,pinned:i,close:o,today:c,swallowed:y,chosen:p=[],onFocus:f}){let{selection:u,store:d,scheme:S,principal:x}=ee(),b=ne(),a=(0,w.useMemo)(()=>d.log.all(),[d,b]),m=oe(a,d.schema.kinds,x),$=(0,w.useMemo)(()=>ae(d.graph,a,x?.id),[d,a,x?.id]),se=te(),E=e.city,D=e.nodes.filter(l=>l.plot!==void 0&&Math.round(l.plane)===2),R=E?.cell??0,F=E?.tilt??.5,K=(0,w.useRef)(f);K.current=f;let le=(0,w.useCallback)(l=>!K.current||y?.current?!1:(K.current(l),!0),[y]),X=(0,w.useRef)(new Map),M=new Map;for(let l of D){let O=l.aggregate?.memberIds??[],v=re(d.schema,l.kind),z=s=>v?d.graph.getNode(s)?.[v.field]:void 0,L=O.filter(s=>p.includes(s)),G=`${R}|${F}|${l.plot.col},${l.plot.row},${l.plot.side}|${L.join(",")}|${O.map(s=>`${s}=${String(z(s))}`).join(",")}`,T=X.current.get(l.id);if(T&&T.key===G){M.set(l.id,T);continue}let V={cell:R,originX:0,originY:0,tilt:F},q={x:0,y:0},we=d.schema.tryDefinition(l.kind),ye=s=>{let h=d.graph.getNode(s);return h?J(we,h):s},k=v?v.values.map(()=>[]):[[]],N=v?[...v.tiers]:["waiting"];for(let s of L.length>0?[...L,...O.filter(h=>!L.includes(h))]:O){let h=v?v.values.indexOf(z(s)):0;h>=0?k[h].push(s):(k.length===N.length&&(k.push([]),N.push("waiting")),k[k.length-1].push(s))}let{blocks:pe,rests:ve}=I(l.plot,k,N.map(s=>ie[s])),me=Se(l.plot,V,q),H=v?Le(d.schema,l.kind):void 0;M.set(l.id,{key:G,tile:B(me),rests:ve.map(s=>({count:s.count,at:A(s.col,s.row,R,F)})),buildings:pe.map(s=>{let W=(H?d.graph.getNode(s.id):void 0)?.[H];return{id:s.id,tier:N[s.lane],overdue:typeof W=="string"&&N[s.lane]!=="done"&&W.slice(0,10)<(c??new Date().toISOString().slice(0,10)),name:ye(s.id),width:s.footprint*R,...Ce(s,V,q)}})})}if(X.current=M,!E)return null;let de={position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible"},ge=u.join(`
|
|
2
2
|
`),ce=se.join(`
|
|
3
3
|
`),ue=m?[...m].join(`
|
|
4
4
|
`):"",fe=$?[...$].join(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as m}from"./chunk.FWTIUYXH.js";import{$ as p,X as c,Y as u,Z as f,da as h,ea as l}from"./chunk.MNP4JI33.js";function A(t,e){let n=t.schema.kinds,r="kind"in e?e.kind:void 0;if(r!==void 0&&!n.includes(r))return`There is no kind "${r}" in this app. Its kinds are: ${n.join(", ")}.`;if(e.on==="act"&&e.act!==void 0&&t.allMutations&&!t.allMutations().some(i=>i.name===e.act))return`There is no act "${e.act}" in this app.`;let o="record"in e?e.record:void 0;if(o!==void 0&&t.graph&&!t.graph.getNode(o))return`No record "${o}" is here to be told about.`;if(o!==void 0&&r!==void 0&&t.graph&&t.graph.getNode(o)?.kind!==r)return`\u201C${o}\u201D is not ${h(r)}.`;if(e.on==="changed"&&e.kind===void 0&&e.record===void 0)return"Say which kind, or which record, to be told about.";if(e.on==="reaches"){if(e.condition.trim()==="")return"Say what it should reach: a condition like done == true.";try{m(e.condition)}catch(i){return`The condition does not read: ${i instanceof Error?i.message:String(i)}.`}}}function a(t,e){let n=t.graph?.getNode(e);return n?c(t.schema.tryDefinition(n.kind),n):e}function g(t,e){let n=t.allMutations?.().find(r=>r.name===e);return n?u(n):f(e)}function M(t,e){let{when:n}=e,r=e.alsoMine?"anyone":"someone else",o=d=>l(t.schema.tryDefinition(d),d),i=d=>{let s=o(d);return`${/^[aeiou]/i.test(s)?"an":"a"} ${s}`};switch(n.on){case"act":{let d=n.act!==void 0?`\u201C${g(t,n.act)}\u201D`:"an act";return`When ${r} runs ${d}${n.record!==void 0?` on \u201C${a(t,n.record)}\u201D`:""}`}case"created":return`When ${r} adds ${i(n.kind)}`;case"changed":return n.record!==void 0?`When ${r} changes \u201C${a(t,n.record)}\u201D`:`When ${r} changes any of the ${p(t.schema,n.kind)}`;case"reaches":return`When ${n.record!==void 0?`\u201C${a(t,n.record)}\u201D`:i(n.kind)} reaches ${n.condition}${e.alsoMine?"":" (by someone else)"}`}}export{A as a,M as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as H,b as I,c as j,e as R,h as V,i as D,j as A,k,l as x,n as Y,o as Z}from"./chunk.DAZ2VSRD.js";import{b as U}from"./chunk.6YCBYL2Y.js";import{H as C,K as G,Ka as T,Na as B,Q as M,X as W,Z as F}from"./chunk.MNP4JI33.js";function re(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function te(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 ne(e,r){let n=[],s={};if(e.query&&(s.query=e.query),e.archived!==void 0&&e.archived!==!1&&(s.archived=e.archived),e.sort&&(r.sorts.some(u=>u.key===e.sort.by)?s.sort=e.sort:n.push(`sort ${e.sort.by}`)),e.filter){let u=e.filter.filter(c=>r.filters.find(l=>l.key===c.key)?!0:(n.push(`filter ${c.key}`),!1));u.length>0&&(s.filter=u)}return e.group&&(r.groups.some(u=>u.key===e.group.by)?s.group=e.group:n.push(`group ${e.group.by}`)),{arrangement:s,dropped:n}}function S(e,r){return W(e.schema.tryDefinition(r.kind),A(r))}var oe=(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 ie(e,r,n){if(n==="label")return S(e,r);let s=e.schema.tryDefinition(r.kind);return s&&n in(s.fields.shape??{})?T(D(r),n,e.today??C()):s?.computed?.[n]!==void 0?e.read?.(r,n):k(e.graph,r.id,n).map(c=>S(e,c)).sort()[0]}var se=/^(\d{4})-(\d{2})-(\d{2})/;function _(e,r){let n=se.exec(e);if(!n)return;let[,s,u,c]=n;if(r==="day")return`${s}-${u}-${c}`;if(r==="month")return`${s}-${u}-01`;if(r==="year")return`${s}-01-01`;if(r==="decade")return`${String(Number(s)-Number(s)%10).padStart(4,"0")}-01-01`;let a=new Date(Date.UTC(Number(s),Number(u)-1,Number(c))),l=(a.getUTCDay()+6)%7;return a.setUTCDate(a.getUTCDate()-l),a.toISOString().slice(0,10)}function de(e,r){return r==="month"?M(e):r==="week"?`Week of ${G(e)}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:G(e)}function ue(e,r,n){return z(e,n)(r)}function z(e,r){let{words:n,conditions:s}=Y(r);if(n.length===0&&s.length===0)return()=>!0;let u=new Map,c=a=>{let l=u.get(a);return l||(l=new Set(R(e.schema,a).filters.map(d=>d.key)),u.set(a,l)),l};return a=>{let l=c(a.kind),d=s.filter(i=>l.has(i.key));return d.every(i=>x(e,a,i))?n.length>0?Z(e.schema.tryDefinition(a.kind),A(a),n)!==void 0:d.length>0:!1}}function ae(e,r,n){let s=r.query?.trim(),u=r.archived===void 0?e:e.filter(t=>B(t,r.archived)),c=s?u.filter(z(n,s)):u,a=r.filter?.length?c.filter(t=>r.filter.every(f=>x(n,t,f))):[...c],l=[];for(let t=r.sort;t&&l.length<4;t=t.then)l.push(t);let d=l.length>0?a.map((t,f)=>({node:t,index:f,values:l.map(o=>ie(n,t,o.by))})).sort((t,f)=>{for(let[o,p]of l.entries()){let[h,K]=[t.values[o],f.values[o]],v=oe(h,K),E=p.direction==="desc"&&v!==0&&h!==void 0&&K!==void 0?-v:v;if(E!==0)return E}return t.index-f.index}).map(t=>t.node):a,i=r.group;if(!i)return{nodes:d,groups:[{key:"",label:"",nodes:d}],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)},N=d[0],m=N?n.schema.tryDefinition(N.kind):void 0,O=m?.fields.shape??{},J=m?H(m,i.by):F(i.by),$=i.by in O,b=$?I(O[i.by]):void 0,X=j(n.schema,N?.kind??"").find(t=>t.key===i.by)?.label,L=$?`No ${J.toLowerCase()}`:`Without ${(X??F(i.by)).toLowerCase()}`,q=$?new Map:U([...new Map(d.flatMap(t=>k(n.graph,t.id,i.by)).map(t=>[t.id,t])).values()].map(A),t=>n.schema.tryDefinition(t));for(let t of d){if($){let o=T(D(t),i.by,n.today??C());if(o==null||o==="")g("",L,t);else if(b==="date"){let p=i.bucket??"day",h=_(String(o),p);h?g(h,de(h,p),t):g("",L,t)}else if(b==="boolean")g(o?"1":"0",o?"Yes":"No",t);else{let p=m?.display?.format?.[i.by];g(String(o),p?p(o):String(o),t)}continue}let f=k(n.graph,t.id,i.by).map(o=>({id:o.id,label:q.has(o.id)?`${S(n,o)} \xB7 ${q.get(o.id)}`:S(n,o)})).sort((o,p)=>o.label.localeCompare(p.label));f.length===0?g("",L,t):g(f.map(o=>o.id).join(","),f.map(o=>o.label).join(", "),t)}let w=b==="choice"?V(O[i.by]):void 0,ee=[...y.entries()].sort(([t,f],[o,p])=>t===""?1:o===""?-1:w?w.indexOf(t)-w.indexOf(o):b==="boolean"?o.localeCompare(t):b==="date"?t.localeCompare(o):f.label.localeCompare(p.label)).map(([t,f])=>({key:t,label:f.label,nodes:f.nodes}));return{nodes:d,groups:ee,grouped:!0}}function P(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 Q(e){if(e!==void 0)return typeof e=="string"?{by:e}:e}function le(e){let r=P(e?.sort),n=Q(e?.group);if(!(!r&&!n))return{...r?{sort:r}:{},...n?{group:{by:n.by}}:{}}}var fe=(e,r)=>r?e==="1"?"true":"false":e;function ce(e,r,n){let s=n.type==="boolean",u=s?["true","false"]:n.options??[],c=[...new Set([...(r.order??[]).filter(d=>u.includes(d)),...u])],a=r.closed??[],l=d=>{if(d.key==="")return[1,0];let i=fe(d.key,s);if(a.includes(i))return[2,a.indexOf(i)];let y=c.indexOf(i);return[0,y<0?c.length:y]};return e.map((d,i)=>({group:d,at:i,rank:l(d)})).sort((d,i)=>d.rank[0]-i.rank[0]||d.rank[1]-i.rank[1]||d.at-i.at).map(({group:d,rank:i})=>({...d,closed:i[0]===2}))}export{Q as a,le as b,ce as c,re as d,te as e,ne as f,ue as g,ae as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.WVUJXDXZ.js";import{h as x}from"./chunk.ULRW47RP.js";import"./chunk.PBSMLINK.js";import"./chunk.3TY5NFLY.js";import"./chunk.D75KC3LL.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import"./chunk.UGFJKSHU.js";import{Ma as f,Oa as N,X as S}from"./chunk.MNP4JI33.js";import"./chunk.AJZBJBMO.js";var k=(n,r,t)=>({untrusted:!0,authoredBy:t.say(r),text:n});function O(n,r){let t;for(let[a,e]of Object.entries(n)){if(typeof e!="string"||a==="id"||a==="kind")continue;let o=r.fieldBy(n.id,a);o&&(t??={...n},t[a]=k(e,o,r))}return t??n}function L(n,r,t){let a=e=>{if(Array.isArray(e))return e.map(a);if(e!==null&&typeof e=="object"&&"id"in e&&"label"in e){let o=e,i=t.recordBy(o.id);return i?{...o,label:k(o.label,i,t)}:o}if(typeof e=="string"){let o=t.recordBy(n);return o?k(e,o,t):e}return e};return Object.fromEntries(Object.entries(r).map(([e,o])=>[e,a(o)]))}function $(n,r){return n.map(t=>{let a=r.recordBy(t.id);return a?{...t,label:k(t.label,a,r)}:t})}function D(n,r){return{...n,nodes:n.nodes.map(t=>O(t,r))}}var E=n=>(JSON.stringify(n)??"null").length,R=n=>typeof n=="number"&&Number.isFinite(n)&&n>0?Math.floor(n):0;function w(n,r,t,a,e,o=""){let i=n-r-t;return i>0?`and ${i} more ${e}: call ${a} with ${o}offset ${r+t} for the next page.`:void 0}var j=({line:n,...r})=>r;function T(n){let r;for(let[t,a]of Object.entries(n))typeof a!="string"||a.length<=600||(r??={...n},r[t]=`${a.slice(0,600)}\u2026 (cut at ${600} of ${a.length} characters)`);return r??n}function B(n,r,t,a){let e=Math.min(t,Math.max(0,n.length-r)),o=n.slice(r,r+e),i=a(o);for(;e>1&&E(i)>8e3;)e=Math.max(1,Math.floor(e*.75)),o=n.slice(r,r+e),i=a(o);return{page:o,answer:i}}function C(n,r){let t=JSON.stringify(r)??"null";if(t.length<=8e3)return r;let a=`This answer was ${t.length} characters, more than the ${8e3} one read answers, so it is cut. Ask ${n} for less, or use search_graph and get_node to read one thing.`;for(let e=8e3-a.length-40;;){let o={cut:a,partial:t.slice(0,e)},i=E(o)-8e3;if(i<=0)return o;e=Math.max(0,e-i-8)}}function I(n,r){let{matched:t,later:a,...e}=r,o=n.hits.filter(i=>i.about==="node").length;return n.total>o?{...e,more:`and ${n.total-o} more records match: narrow the words, or add kind:<kind>.`}:e}function P(n,r,t){let a=N(t.archived),e={nodes:n.graph.allNodes({archived:a}),edges:n.graph.allEdges({archived:"all"})},o=R(t.offset),i=e.nodes.length,{page:h,answer:u}=B(e.nodes,o,25,d=>{let g=new Set(d.map(s=>s.id)),l=new Set(d.map(s=>s.id)),c=w(i,o,d.length,"get_graph","nodes"),p=s=>l.has(s)||(a==="all"?n.graph.has(s):n.graph.has(s)&&f(n.graph.getNode(s))===a);return{...D({nodes:d.map(T),edges:e.edges.filter(s=>g.has(s.from)&&p(s.to))},r),total:i,...c?{more:c}:{}}});return{data:u,reads:h.map(d=>d.id)}}function U(n,r,t,a){let e=n.graph.getNode(t),o=R(a.offset),i=n.graph.outEdges(t),h=n.graph.inEdges(t),u=i.slice(o,o+20),d=h.slice(o,o+20),g=(s,A)=>{let m=n.graph.getNode(A);return{kind:s,id:A,label:m?S(n.schema.tryDefinition(m.kind),m):A,...f(m)?{archived:!0}:{}}},l=x(n.schema,n.graph,e),c=n.violations().filter(s=>s.nodeIds.includes(t)),p=[w(i.length,o,u.length,"get_node","links out",`id "${t}" and `),w(h.length,o,d.length,"get_node","links in",`id "${t}" and `),c.length>20?`and ${c.length-20} more problems: get_violations lists them.`:void 0].filter(Boolean);return{data:{node:O(T(e),r),...f(e)?{archived:!0}:{},...Object.keys(l.values).length>0?{computed:L(t,l.values,r)}:{},...Object.keys(l.refused).length>0?{uncomputed:l.refused}:{},out:$(u.map(s=>g(s.kind,s.to)),r),in:$(d.map(s=>g(s.kind,s.from)),r),violations:c.slice(0,20).map(j),...p.length>0?{more:p.join(" ")}:{}},reads:[t,...u.map(s=>s.to),...d.map(s=>s.from)]}}function F(n,r){let t=R(r.offset),{page:a,answer:e}=B(n,t,20,o=>{let i=w(n.length,t,o.length,"get_violations","problems");return{violations:o.map(j),total:n.length,...i?{more:i}:{}}});return{data:e,reads:[...new Set(a.flatMap(o=>o.nodeIds))]}}export{P as graphRead,U as nodeRead,I as searchRead,F as violationsRead,C as withinReadChars};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as ce,c as ge,d as ye,f as he}from"./chunk.SHTJZ6UX.js";import{f as T,i as k,j as pe,k as ue,q as fe,r as me}from"./chunk.B2GLDIAS.js";import{b as de}from"./chunk.6YCBYL2Y.js";import{c as se,f as le}from"./chunk.UGFJKSHU.js";import{F as Ae,Q as ae,Z as ie,i as re,v as oe}from"./chunk.6QWV5MVH.js";import{Ea as ne,Fa as te,X as Q,Z as X,ea as Z,ta as ee}from"./chunk.MNP4JI33.js";import{b as M}from"./chunk.AJZBJBMO.js";var l=M(Ae(),1),i=M(ae(),1);function He({affordance:n,onApply:a,onCancel:p,store:b}){let y=ie(),s=b??y?.store,[S,B]=(0,l.useState)({}),[f,C]=(0,l.useState)(""),[F,I]=(0,l.useState)(q),[G,J]=(0,l.useState)(void 0),_=(0,l.useId)(),P=(0,l.useRef)(null),x=n.open.filter(e=>!(e.name in S)),o=x[0],w=s.allMutations().find(e=>e.name===n.mutation),j=(0,l.useMemo)(()=>Oe(w,s,n.args??{}),[w,s,n.args]),d=o?j[o.name]:void 0,$=me(n.open.filter(e=>e.shape?.type==="date").map(e=>e.name)),we=(()=>{if(!$||o?.name!==$.end||o.shape?.type!=="date")return;let e=S[$.start];if(typeof e!="string")return;let r=j[$.start];return fe(typeof r=="string"?r:void 0,e,typeof d=="string"?d:void 0,{time:o.shape.time===!0,instant:o.shape.instant===!0})})();if((0,l.useEffect)(()=>{C(we??be(d,o?.shape)),I(Array.isArray(d)?d:q),J(d)},[o?.name]),(0,l.useEffect)(()=>{P.current?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[o?.name]),(0,l.useLayoutEffect)(()=>{let e=P.current,r=typeof document>"u"?null:document.activeElement;if(!e||r&&r!==document.body&&!e.contains(r))return;let u=e.querySelector("form input, [role=group] button:not([disabled])");u&&u!==r&&u.focus()},[o?.name]),!o)return null;let h=e=>{let r=d!==void 0&&JSON.stringify(e)===JSON.stringify(d)?void 0:e,u={...S,[o.name]:r};if(n.open.filter(R=>!(R.name in u)).length===0){let R=a(Object.fromEntries(Object.entries(u).filter(([,K])=>K!==void 0)));R&&R.length>0&&B(Object.fromEntries(Object.entries(u).filter(([K])=>!R.includes(K))))}else B(u)},A=o.optional?(0,i.jsx)("button",{type:"button",onClick:()=>h(void 0),style:{fontSize:"0.8125rem"},children:"Skip"}):null,t=o.shape??{type:"unknown"},c=t.type==="number"?t.amount:void 0,g=Ne(o,t),m=T(s.schema,w,o.name),U=ee((w?.input?.shape??{})[o.name]),ve=te((w?.input?.shape??{})[o.name]),O=ne(o.name),ke=typeof d=="boolean"?d?"yes":"no":d,[W,Se]=(0,l.useState)(""),V=(0,l.useMemo)(()=>{let e=g.map(r=>s.graph.getNode(r)).filter(r=>r!==void 0);return de(e,r=>s.schema.tryDefinition(r))},[g,s]),L=e=>{let r=Ce(s,t,e),u=t.type==="choice"||t.type==="several"&&t.of.type==="choice"?m.option(e):r,N=V.get(e);return N?`${u} \xB7 ${N}`:u},z=(0,l.useMemo)(()=>{let e=W.trim().toLowerCase();return e===""?g:g.filter(r=>L(r).toLowerCase().includes(e))},[g,W,s,t,V]),v=t.type==="several",Y=t.type==="file"?t:t.type==="several"&&t.of.type==="file"?t.of:void 0,H=v&&g.length===0,D=o.kinds&&o.kinds.length>0&&!o.kinds.includes("*")?o.kinds.map(e=>X(Z(s.schema.tryDefinition(e),e))).join(" or "):m.label,xe=n.open.length>1?`${D} \xB7 ${n.open.length-x.length+1} of ${n.open.length}`:D;return(0,i.jsxs)("div",{ref:P,"data-graview-asking":n.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:4,padding:"5px 0 2px"},children:[n.open.length>1||g.length>0?(0,i.jsx)("span",{id:_,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:xe}):null,g.length>E?(0,i.jsx)("input",{type:"search",value:W,onChange:e=>Se(e.target.value),placeholder:`Filter ${g.length}\u2026`,"aria-label":`Filter ${D}`,"data-testid":"ask-filter",style:{font:"inherit",fontSize:"0.8125rem",minWidth:0,padding:"3px 7px"}}):null,ve?(0,i.jsxs)("form",{style:{display:"grid",gap:4},onSubmit:e=>{e.preventDefault(),h(G??(d===void 0?void 0:null))},children:[(0,i.jsx)(ye,{value:G,onChange:J,start:O?S[O]??j[O]:void 0,label:`${O?T(s.schema,w,O).label:m.label} repeats`,name:o.name}),(0,i.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,i.jsx)("button",{type:"submit",style:{fontSize:"0.8125rem"},children:x.length>1?"Next":"Apply"}),A]})]}):U?(0,i.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,i.jsx)(ge,{relation:U,value:d,onChange:h,label:m.label}),A]}):Y?(0,i.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,i.jsx)(ce,{as:"control",value:d,onChange:h,several:v,image:Y.image===!0,label:m.label}),A]}):g.length>0?(0,i.jsxs)("div",{role:"group","aria-labelledby":_,style:{display:"flex",flexWrap:"wrap",gap:4},children:[z.slice(0,E).map(e=>{let r=v?F.includes(e):e===ke;return(0,i.jsx)("button",{type:"button","aria-label":`${D}: ${L(e)}`,...v?{"aria-pressed":r}:r?{"aria-current":!0}:{},style:{padding:"3px 9px",fontSize:"0.8125rem",...r?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},onClick:()=>v?I(u=>u.includes(e)?u.filter(N=>N!==e):[...u,e]):h(t.type==="boolean"?e==="yes":e),children:L(e)},e)}),z.length>E?(0,i.jsxs)("span",{"data-testid":"ask-more",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:[z.length-E," more \u2014 type to narrow"]}):null,z.length===0?(0,i.jsxs)("span",{"data-testid":"ask-none",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["None of the ",g.length," match that."]}):null,v?(0,i.jsx)("button",{type:"button",disabled:F.length===0,style:{fontSize:"0.8125rem"},onClick:()=>{let e=F;I(q),h(e)},children:x.length>1?"Next":"Apply"}):null,A]}):(0,i.jsxs)("form",{style:{display:"flex",flexWrap:"wrap",gap:4},onSubmit:e=>{if(e.preventDefault(),d!==void 0&&f===be(d,t)){h(void 0);return}if(H){h(f.split(/[,\n]/).map(r=>r.trim()).filter(Boolean));return}if(f.trim().length!==0){if(c){let r=ue(f,c);r!==void 0&&h(r);return}h(t.type==="number"?t.duration?le(f)??f:Number(f):f)}},children:[t.type==="text"&&t.long?(0,i.jsx)("textarea",{autoFocus:!0,name:o.name,"aria-label":m.label,placeholder:m.label,value:f,rows:4,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key==="Escape"?p():e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},style:{flex:"1 1 100%",minWidth:0,font:"inherit",fontSize:"0.875rem",lineHeight:1.45,padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",resize:"vertical",fieldSizing:"content",minHeight:"5.5em",maxHeight:"40vh"}}):t.type==="date"?(0,i.jsx)(he,{autoFocus:!0,name:o.name,label:m.label,value:f===""?void 0:f,time:t.time===!0,instant:t.instant===!0,onChange:e=>C(e??""),onCancel:p,boxStyle:{fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):(0,i.jsx)("input",{autoFocus:!0,type:t.type==="number"&&!t.duration&&!c?"number":t.type==="text"&&t.holds==="phone"?"tel":"text",...c?{inputMode:"decimal","data-graview-amount":c.format??"unit"}:{},name:o.name,"aria-label":m.label,placeholder:H?`${m.label}, separated by commas`:c?`${m.label}, ${k(c).hint} \u2014 ${k(c).prefix??""}${k(c).placeholder}${k(c).suffix?` ${k(c).suffix}`:""}`:m.label,value:f,...t.type==="number"&&t.min!==void 0?{min:t.min}:{},...t.type==="number"&&t.max!==void 0?{max:t.max}:{},...t.type==="number"&&t.step!==void 0?{step:t.step}:{},onChange:e=>C(e.target.value),onKeyDown:e=>{e.key==="Escape"&&p()},style:{flex:1,minWidth:0,font:"inherit",fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}),(0,i.jsx)("button",{type:"submit",disabled:!H&&f.trim().length===0,style:{fontSize:"0.8125rem"},children:x.length>1?"Next":"Apply"}),A]})]})}var q=[];function Oe(n,a,p){let b=n?.derived?.act==="edit"&&n.subject?p[n.subject.arg]:void 0,y=typeof b=="string"?a.graph.getNode(b):void 0;return y?Object.fromEntries((n.writes??[]).filter(s=>y[s]!==void 0&&y[s]!==null).map(s=>[s,y[s]])):{}}function be(n,a){return typeof n=="number"?a?.type==="number"&&a.amount?pe(n,a.amount):String(n):Array.isArray(n)?n.every(p=>typeof p=="string")?n.join(", "):"":typeof n!="string"?"":n}var E=10;function Ne(n,a){return n.candidates&&n.candidates.length>0?n.candidates:a.type==="choice"?a.options:a.type==="several"&&a.of.type==="choice"?a.of.options:a.type==="boolean"?Re:[]}var Re=["yes","no"];function Ce(n,a,p){return a.type==="boolean"||a.type==="choice"||a.type==="several"&&a.of.type==="choice"?p:$e(n,p)}function $e(n,a){let p=re(a);if(p){let s=se(n.schema,n.graph.getNode(p.from)?.kind??"",p.kind,"out");return s.charAt(0).toUpperCase()+s.slice(1)}let b=oe(a);if(b.length>0)return b.map(s=>n.schema.tryDefinition(s)?.plural??`${s}s`).join(" + ");let y=n.graph.getNode(a);return y?Q(n.schema.tryDefinition(y.kind),y):a}export{He as a,$e as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as y,b as h}from"./chunk.E2YEOMPH.js";import"./chunk.D75KC3LL.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import{oc as b}from"./chunk.MNP4JI33.js";import"./chunk.AJZBJBMO.js";var k=(d,i)=>({id:i.id,said:h(d,i),when:i.when,...i.alsoMine?{alsoMine:!0}:{}});async function A(d,i,t){let a=b(t.principal);if(a.id===void 0)return{ok:!1,error:"This seat acts for nobody the app knows by id, so there is nobody to tell. Nothing was kept."};let r=t.store.seenBy(a),p=async()=>(await t.subscriptions.list(a.id)).filter(n=>n.app===t.app);if(d==="list_subscriptions")return{ok:!0,data:{subscriptions:(await p()).map(n=>k(r,n))}};if(d==="unsubscribe"){let n=String(i.id??"");return(await p()).some(g=>g.id===n)?(await t.subscriptions.remove(n),{ok:!0,data:{removed:n}}):{ok:!1,error:`No subscription "${n}" of yours. list_subscriptions says which there are.`}}let o=String(i.on??""),c=n=>typeof i[n]=="string"&&i[n].trim()!==""?i[n].trim():void 0,e=c("record");if(e!==void 0&&!r.graph.getNode(e)){let n=t.store.resolveRef({name:"record",kinds:["*"]},e,a);if(!n.ok)return{ok:!1,error:`${n.message} Nothing was kept.`};e=n.id}let s=c("kind")??(e!==void 0&&o!=="act"?r.graph.getNode(e)?.kind:void 0),f=c("act"),m=c("condition"),u=o==="act"?{on:o,...f!==void 0?{act:f}:{},...e!==void 0?{record:e}:{}}:o==="created"&&s!==void 0?{on:o,kind:s}:o==="changed"?{on:o,...s!==void 0&&e===void 0?{kind:s}:{},...e!==void 0?{record:e}:{}}:o==="reaches"&&s!==void 0?{on:o,kind:s,condition:m??"",...e!==void 0?{record:e}:{}}:void 0;if(!u)return{ok:!1,error:'Say what to be told of: on is "act", "created", "changed" or "reaches", with a kind (or a record) for all but act. Nothing was kept.'};let l=y({schema:r.schema,allMutations:()=>t.store.allMutations(),graph:r.graph},u);if(l)return{ok:!1,error:`${l} Nothing was kept.`};let S=await t.subscriptions.add({who:a,app:t.app,when:u,...i.alsoMine===!0?{alsoMine:!0}:{}});return{ok:!0,data:{subscription:k(r,S)}}}export{A as runSubscriptionTool};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as a,k as o}from"./chunk.NRAYZY3X.js";import"./chunk.RIJUCHP4.js";import"./chunk.TAQ764IQ.js";import"./chunk.YIR7PPF3.js";import"./chunk.3HXN4BOY.js";import"./chunk.GYICGZMG.js";import"./chunk.47STJVRV.js";import"./chunk.EBGAYL32.js";import"./chunk.DAZ2VSRD.js";import"./chunk.CWHRDBOF.js";import"./chunk.3K6YSVHC.js";import"./chunk.SHTJZ6UX.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ULRW47RP.js";import"./chunk.PBSMLINK.js";import"./chunk.3TY5NFLY.js";import"./chunk.D75KC3LL.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import"./chunk.GZHZLJBF.js";import"./chunk.XMC7YDWT.js";import"./chunk.6UGEYZAC.js";import"./chunk.OJGHDWI6.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import"./chunk.JOOQUWLT.js";import{ja as n}from"./chunk.6QWV5MVH.js";import"./chunk.MNP4JI33.js";import"./chunk.AJZBJBMO.js";var w=new WeakMap;function s(e,i){let t=w.get(e);t||w.set(e,t=new Map);let r=t.get(i);return r||t.set(i,r=a(o(e,n(e)),e,i)),r}export{s as frameworkViews};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk.NTF7FVB2.js";import"./chunk.5UL7YDUD.js";import"./chunk.JOOQUWLT.js";import"./chunk.6QWV5MVH.js";import"./chunk.MNP4JI33.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as F,l as b}from"./chunk.
|
|
1
|
+
import{g as F,l as b}from"./chunk.MAF7C3VM.js";function L(t,o){return o===1&&["every","some","sum","min","max","sort"].includes(t.fn)}function M(t){let o=new Set,e=new Set,r=[],s=[],a=new Set(F),i=(l,f)=>{switch(l.t){case"lit":return;case"ident":f||o.add(l.name);return;case"list":l.items.forEach(c=>i(c,f));return;case"member":i(l.object,f);return;case"unary":i(l.operand,f);return;case"binary":i(l.left,f),i(l.right,f);return;case"where":i(l.set,f),i(l.filter,!0);return;case"call":{e.add(l.fn);let c=(l.fn==="out"||l.fn==="in")&&l.args.length===2?l.args[1]:l.args[0],m=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&m&&r.push(m),(l.fn==="out"||l.fn==="in")&&m&&s.push(m),l.args.forEach((v,k)=>i(v,f||L(l,k)));return}}};return i(t,!1),{names:o,functions:e,unknownFunctions:[...e].filter(l=>!a.has(l)),sweeps:r,edges:s}}var p=class extends Error{constructor(e,r,s){super(`${e} (at character ${r+1} of "${s}")`);this.sentence=e;this.at=r;this.source=s}},D=["||","&&","==","!=","<=",">=","<",">","!","|","&","+","-","*","/","%","(",")","[","]",",","."],j={and:"&&",or:"||",not:"!"},T=2e3;function H(t){let o=[],e=0;for(;e<t.length;){let r=t[e];if(r===" "||r===" "||r===`
|
|
2
2
|
`||r==="\r"){e++;continue}if(r>="0"&&r<="9"){let a=e;for(;e<t.length&&/[0-9.]/.test(t[e]);)e++;let i=t.slice(a,e),l=Number(i);if(!Number.isFinite(l)||i.split(".").length>2)throw new p(`"${i}" is not a number`,a,t);o.push({k:"num",v:l,at:a});continue}if(r==="'"||r==='"'){let a=e++,i="";for(;e<t.length&&t[e]!==r;)t[e]==="\\"&&e+1<t.length&&e++,i+=t[e++];if(e>=t.length)throw new p("a quoted word is never closed",a,t);e++,o.push({k:"str",v:i,at:a});continue}if(/[A-Za-z_]/.test(r)){let a=e;for(;e<t.length&&/[A-Za-z0-9_]/.test(t[e]);)e++;let i=t.slice(a,e),l=Object.hasOwn(j,i)?j[i]:void 0;o.push(l?{k:"op",v:l,at:a}:{k:"id",v:i,at:a});continue}let s=D.find(a=>t.startsWith(a,e));if(!s)throw new p(`"${r}" is not part of the rule language`,e,t);o.push({k:"op",v:s,at:e}),e+=s.length}return o.push({k:"end",at:t.length}),o}function w(t){if(t.length>T)throw new p(`an expression may be at most ${T} characters`,0,t.slice(0,40));let o=H(t),e=0,r=()=>o[e],s=n=>{let d=r();return d.k==="op"&&d.v===n},a=n=>{let d=r();return d.k==="id"&&d.v===n},i=(n,d)=>{if(!s(n))throw new p(`expected ${d}`,r().at,t);e++},l=0,f=(n,d)=>{if(++l>64)throw new p("the expression nests too deeply",n,t);try{return d()}finally{l--}},c=(n,d)=>()=>{let g=d();for(;;){let y=r(),S=y.k==="op"?n.find(q=>q===y.v):y.k==="id"&&y.v==="in"&&n.includes("in")?"in":void 0;if(!S)return g;e++,g={t:"binary",op:S,left:g,right:d(),at:y.at}}},m=()=>{let n=r();if(n.k==="num")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="str")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="id"){if(e++,n.v==="true"||n.v==="false")return{t:"lit",value:n.v==="true",at:n.at};if(n.v==="null")return{t:"lit",value:null,at:n.at};if(s("(")){e++;let d=[];if(!s(")"))for(;;){if(d.push(h()),s(",")){e++;continue}break}return i(")",`")" to close ${n.v}(\u2026)`),{t:"call",fn:n.v,args:d,at:n.at}}return{t:"ident",name:n.v,at:n.at}}if(n.k==="op"&&n.v==="("){e++;let d=f(n.at,h);return i(")",'a ")"'),d}if(n.k==="op"&&n.v==="["){e++;let d=[];if(!s("]"))for(;;){if(d.push(h()),s(",")){e++;continue}break}return i("]",'a "]" to close the list'),{t:"list",items:d,at:n.at}}throw n.k==="end"?new p("the expression ends too soon",n.at,t):new p(`"${n.k==="op"?n.v:""}" cannot start a value here`,n.at,t)},v=()=>{let n=m();for(;;){if(s(".")){let d=r();e++;let g=r();if(g.k!=="id")throw new p('expected a field name after "."',g.at,t);e++,n={t:"member",object:n,name:g.v,at:d.at};continue}if(a("where")){let d=r().at;e++,n={t:"where",set:n,filter:f(d,h),at:d};continue}return n}},k=()=>{let n=r();return n.k==="op"&&(n.v==="!"||n.v==="-")?(e++,{t:"unary",op:n.v,operand:f(n.at,k),at:n.at}):v()},P=c(["*","/","%"],k),z=c(["+","-"],P),N=c(["&"],z),R=c(["|"],N),_=()=>{let n=R(),d=r(),g=d.k==="op"&&["==","!=","<","<=",">",">="].includes(d.v)?d.v:d.k==="id"&&d.v==="in"?"in":void 0;return g?(e++,{t:"binary",op:g,left:n,right:R(),at:d.at}):n},O=()=>{let n=r();return n.k==="op"&&n.v==="!"?(e++,{t:"unary",op:"!",operand:f(n.at,O),at:n.at}):_()},B=c(["&&"],O),I=c(["||"],B);function h(){return I()}let K=h();if(r().k!=="end")throw new p("there is more after the end of the expression",r().at,t);return K}function E(t){let o,e=-1,r=0;for(let s=0;s<t.length;s++){let a=t[s];if(o){a==="\\"?s++:a===o&&(o=void 0);continue}a==="'"||a==='"'?o=a:a==="("||a==="["?r++:a===")"||a==="]"?r--:a==="|"&&r===0&&(t[s+1]==="|"?s++:e=s)}if(e>0&&t.slice(e+1).trim()===x){let s=E(t.slice(0,e));if(s>=0)return s}return e}var x="capital",$=/\s*(?:'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)")\s*(,|$)/y;function U(t){let o=E(t);if(o>=0){if(t.slice(o+1).trim()!==x)throw new u('only "capital" may follow another formatter, like {n | words | capital}');let e=t.slice(0,o);if(e.trim()===x)throw new u('"capital" is said once');return{...C(e),capital:!0}}return t.trim()===x?{args:[],capital:!0}:C(t)}function C(t){let o=t.indexOf(":"),e=(o>=0?t.slice(0,o):t).trim();if(!b.includes(e))throw new u(`"${e}" is not a formatter; use one of ${[...b,x].join(", ")}`);let r=[];if(o>=0&&e==="excerpt"){let s=t.slice(o+1).trim();if(!/^\d+$/.test(s)||Number(s)<20||Number(s)>1e3)throw new u("excerpt is told at most how many characters, 20 to 1000: {summary | excerpt: 80}");r.push(s)}else if(o>=0){let s=t.slice(o+1),a=0;for(;a<s.length;){$.lastIndex=a;let i=$.exec(s);if(!i)throw new u(`"${e}" is told quoted words, like ${e}: 'offer'`);if(r.push((i[1]??i[2]??"").replace(/\\(.)/g,"$1")),a=$.lastIndex,i[3]==="")break}}if(e==="plural"&&(r.length<1||r.length>2))throw new u("plural is told its noun, like {count | plural: 'offer'}, and its plural where English does not make it: plural: 'person', 'people'");if(e!=="plural"&&e!=="excerpt"&&r.length>0)throw new u(`"${e}" takes nothing after it`);return{format:e,args:r}}var u=class extends Error{constructor(e){super(e);this.sentence=e}};function Y(t){let o=[],e=0;for(;e<t.length;){let r=t.indexOf("{",e);if(r<0){o.push({text:t.slice(e)});break}r>e&&o.push({text:t.slice(e,r)});let s=t.indexOf("}",r);if(s<0)throw new u(`a "{" at character ${r+1} is never closed`);let a=t.slice(r+1,s),i=E(a),l=(i>=0?a.slice(0,i):a).trim(),f=i>=0?U(a.slice(i+1)):void 0,c=E(l);if(c>=0&&b.includes(l.slice(c+1).split(":")[0].trim()))throw new u('only "capital" may follow another formatter, like {n | words | capital}');o.push({expr:w(l),source:l,...f?.format?{format:f.format}:{},...f&&f.args.length>0?{formatArgs:f.args}:{},...f?.capital?{capital:!0}:{}}),e=s+1}return o}function A(t){let o=new Map;for(let[e,r]of Object.entries(t?.computed??{}))o.set(e,typeof r=="string"?{expr:r}:r);return o}function re(t){let o=A(t);if(o.size===0)return;let e=new Map;for(let[r,s]of o)try{e.set(r,w(s.expr))}catch(a){if(!(a instanceof p))throw a}return e}function Z(t,o,e=new Set){let r=A(t).get(o);if(!r||e.has(o))return!1;let s;try{s=w(r.expr)}catch{return!1}let a=M(s);if(a.edges.length>0||a.sweeps.length>0||[...a.functions].some(c=>c==="out"||c==="in"||c==="all"))return!1;let i=t.fields,l=c=>i instanceof Set?i.has(c):Object.hasOwn(i,c),f=new Set([...e,o]);return[...a.names].every(c=>l(c)||Z(t,c,f))}export{M as a,p as b,w as c,u as d,Y as e,A as f,re as g,Z as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{$a as k,db as O,eb as P,gb as h,hb as A,ic as E,jc as G,kc as F,mc as J,nc as W}from"./chunk.MNP4JI33.js";var I=(o,a)=>{let t=o.kindOf(a);return t===void 0?void 0:o.kept?.({id:a,kind:t})};function w(o,a){return o.flatMap(t=>{if(t.op!=="patch-node")return[t];let i=I(a,t.id);if(!i||!Object.keys(t.after).some(i))return[t];let c=r=>Object.fromEntries(Object.entries(r).filter(([f])=>!i(f))),s=c(t.after);return Object.keys(s).length===0?[]:[{op:"patch-node",id:t.id,before:c(t.before),after:s}]})}function _(o,a,t){if(!F(o,a))return t;let i=J(o,a),c=r=>o.graph.getNode(r)!==void 0||E(o.log).kindOf(r)!==void 0,s={...t};if(t.diff){let r=t.diff,f=G(o.log),l=o.log.length??o.log.all().length,u=t.ops?.[0]?.seq??l,x=k(a).id,y=(e,n)=>d=>f.writerAt(e,d,n),m=(e,n)=>i.shows(e.id)?i.servedWith(e,n):void 0,j=(e,n)=>e.flatMap(d=>m(d,n(d.id))??[]),S=e=>i.shows(e.from)&&i.shows(e.to)&&!h(e,i.sees),v=(e,n)=>t.ops?y(e,l):d=>n===void 0||n.includes(d)?x:f.writerAt(e,d,l),M=r.changedNodes.flatMap(e=>{let n=m(e.before,y(e.before.id,u)),d=m(e.after,v(e.after.id,e.fields));return n&&d?[{before:n,after:d,fields:e.fields.filter(p=>p in n||p in d)}]:[]}),D=new Set(r.changedNodes.map(e=>e.after.id)),g=new Map;for(let e of t.ops?.flatMap(n=>n.primitives)??t.primitives??[])e.op!=="patch-node"||D.has(e.id)||g.set(e.id,[...g.get(e.id)??[],...Object.keys(e.after)]);let B=[...g].flatMap(([e,n])=>{let d=o.graph.getNode(e);if(!d)return[];let p=m(d,y(e,u)),N=m(d,v(e,n));return p&&N&&JSON.stringify(p)!==JSON.stringify(N)?[{before:p,after:N,fields:n}]:[]});s.diff={addedNodes:j(r.addedNodes,e=>v(e)),removedNodes:j(r.removedNodes,e=>y(e,u)),changedNodes:[...M,...B],addedEdges:r.addedEdges.filter(S),removedEdges:r.removedEdges.filter(S),touched:[...r.touched.filter(i.shows),...[...g.keys()].filter(e=>i.shows(e)&&!r.touched.includes(e))]}}if(t.ops&&(s.ops=A(t.ops,i)),t.primitives){let r=s.ops;s.primitives=r?r.flatMap(f=>f.primitives):i.timeline?O(t.primitives,i.timeline,{served:(f,l)=>i.servedWith(f,l),edgeClean:f=>!h(f,i.sees),sees:i.sees},k(a).id):A([{id:"",seq:0,batch:"",author:{kind:"system"},intent:"",mutation:null,primitives:t.primitives,inverse:[],reads:[],writes:[],at:""}],i)[0].primitives}return i.kept&&s.primitives&&(s.primitives=w(s.primitives,i)),t.reads&&(s.reads=t.reads.filter(r=>i.shows(r)&&c(r))),t.writes&&(s.writes=t.writes.filter(i.shows)),t.intent!==void 0&&h(t.intent,i.sees)&&(s.intent=P),t.violationsAfter&&Object.assign(s,b?b(o,W(o,a),!!t.ops,s.primitives??[]):{introduces:[],resolves:[],violationsAfter:[]}),s}var b,z=o=>void(b=o);export{_ as a,z as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as c}from"./chunk.Y2SFUALD.js";import"./chunk.3NDH3EDN.js";import"./chunk.63GXY2ME.js";import"./chunk.UGFDSE37.js";import{j as m}from"./chunk.67TPUXAY.js";import"./chunk.Y6ZNFQK3.js";import"./chunk.NRAYZY3X.js";import"./chunk.RIJUCHP4.js";import"./chunk.TAQ764IQ.js";import"./chunk.YIR7PPF3.js";import"./chunk.3HXN4BOY.js";import"./chunk.GYICGZMG.js";import"./chunk.UHUGOTUU.js";import"./chunk.47STJVRV.js";import"./chunk.EBGAYL32.js";import"./chunk.DAZ2VSRD.js";import"./chunk.XANVHJQ4.js";import"./chunk.CAVBSL27.js";import"./chunk.J25KOSNW.js";import"./chunk.LR3VDXPI.js";import"./chunk.CWHRDBOF.js";import"./chunk.3K6YSVHC.js";import"./chunk.SHTJZ6UX.js";import"./chunk.UT6642FC.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ULRW47RP.js";import"./chunk.PBSMLINK.js";import"./chunk.3TY5NFLY.js";import"./chunk.D75KC3LL.js";import"./chunk.FWTIUYXH.js";import"./chunk.MAF7C3VM.js";import"./chunk.GZHZLJBF.js";import"./chunk.XMC7YDWT.js";import"./chunk.6UGEYZAC.js";import"./chunk.OJGHDWI6.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import"./chunk.JOOQUWLT.js";import{F as S,Q as g}from"./chunk.6QWV5MVH.js";import{Uc as n}from"./chunk.MNP4JI33.js";import{b as t}from"./chunk.AJZBJBMO.js";var y=t(S(),1),a=t(g(),1);function R({store:h,auto:f,brand:i,views:u,presence:r,steering:o,overview:s,scope:d,titleLevel:v=2,quickAsk:l,props:e}){let b=(0,y.useMemo)(()=>m({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:f?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:b}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(c,{context:{store:h,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...s?{overview:s}:{},titleLevel:v,views:u,settings:e.app.settings??[],...r?{presence:r}:{},...i?{brand:i}:{},...e.locale?{locale:e.locale}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{},...e.subscriptions?{subscriptions:e.subscriptions}:{},...l!==void 0?{quickAsk:l}:{}},...e.pages?{registry:e.pages}:{},...o?{steering:o}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{R as PagesContent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as J}from"./chunk.JDUJDAGA.js";import{a as V,c as T,d as _,e as D}from"./chunk.J25KOSNW.js";import"./chunk.LR3VDXPI.js";import"./chunk.COQKECUH.js";import"./chunk.EJPI3ST6.js";import"./chunk.CWHRDBOF.js";import"./chunk.3K6YSVHC.js";import"./chunk.SHTJZ6UX.js";import"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.GZHZLJBF.js";import"./chunk.XMC7YDWT.js";import"./chunk.6UGEYZAC.js";import"./chunk.OJGHDWI6.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import"./chunk.UGFJKSHU.js";import"./chunk.JOOQUWLT.js";import{F as q,Q as k,Y as w,d as B,sa as j,wa as E,y as G}from"./chunk.6QWV5MVH.js";import{La as M,X as H,Z as I,aa as L,fb as W}from"./chunk.MNP4JI33.js";import{b as f}from"./chunk.AJZBJBMO.js";function P(e){return{minHeight:24,padding:"3px 10px",borderRadius:6,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:e?"transparent":"var(--graview-edge)",color:e?"var(--graview-ink)":"var(--graview-ink-muted)",fontWeight:e?600:400,background:e?"color-mix(in srgb, var(--graview-accent) 16%, transparent)":"transparent"}}var A=f(k(),1);function K(){let{seats:e,principal:n,takeSeat:i}=w();return e.length<2?null:(0,A.jsxs)("div",{role:"group","aria-label":"Seat","data-testid":"seats",style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,rowGap:4},children:[(0,A.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"As"}),e.map(r=>{let d=Q(n,r.principal);return(0,A.jsx)("button",{type:"button","aria-pressed":d,"data-testid":`seat-${r.principal.id??r.label}`,title:`Sit down as ${r.label}: the acts, the kinds and the pages narrow to what this seat may do`,onClick:()=>i(r.principal),style:{...P(d),whiteSpace:"nowrap"},children:r.label},r.principal.id??r.label)})]})}function Q(e,n){return e.kind===n.kind&&e.id===n.id}var C=f(q(),1),l=f(k(),1),X=`
|
|
2
2
|
.graview-here{display:flex;flex:none}
|
|
3
3
|
.graview-here>button{display:inline-flex;align-items:center;gap:4px;height:30px;margin:0;padding:0 4px;border:1px solid transparent;border-radius:8px;background:none;box-shadow:none;font:inherit;font-size:.75rem;color:var(--graview-ink-muted);cursor:pointer}
|
|
4
4
|
.graview-here-mark{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:24px;height:24px;border-radius:50%;border:1.5px solid hsl(var(--graview-hue) 50% 48%);background:var(--graview-panel-muted);color:var(--graview-ink);font-size:.75rem;font-weight:600;box-shadow:0 0 0 2px var(--graview-bar)}
|