graview 0.1.24 → 0.1.25
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.47GRZWQN.js → chunk.2AJMM7JG.js} +1 -1
- package/dist/preview/{chunk.2VX6H2LL.js → chunk.2WFEFZAW.js} +1 -1
- package/dist/preview/chunk.2YVXTTC2.js +1 -0
- package/dist/preview/{chunk.AKOC43TV.js → chunk.6DU4XN2F.js} +1 -1
- package/dist/preview/{chunk.RT3XFR6E.js → chunk.6OBXKKB5.js} +2 -2
- package/dist/preview/{chunk.7EN53F4Q.js → chunk.6UL2JUEH.js} +1 -1
- package/dist/preview/chunk.6WFN4C46.js +107 -0
- package/dist/preview/{chunk.Y4R77MKX.js → chunk.7BAUPTMY.js} +1 -1
- package/dist/preview/chunk.A4SJ7EEY.js +1 -0
- package/dist/preview/{chunk.BNSY25SG.js → chunk.ACKTGTOT.js} +1 -1
- package/dist/preview/{chunk.7U7Q3HIS.js → chunk.B57EIGTS.js} +1 -1
- package/dist/preview/{chunk.ISAMJ7AK.js → chunk.BJ2Y5F66.js} +1 -1
- package/dist/preview/{chunk.3O2QU7LU.js → chunk.BYUQOV3O.js} +1 -1
- package/dist/preview/chunk.C5N4RTPF.js +1 -0
- package/dist/preview/{chunk.XDPRWUCJ.js → chunk.CFL2B2Z5.js} +1 -1
- package/dist/preview/{chunk.UM5IPM22.js → chunk.DEZEXD24.js} +1 -1
- package/dist/preview/{chunk.6MCK7K3M.js → chunk.DJ72CUS7.js} +1 -1
- package/dist/preview/{chunk.WOTNMTIY.js → chunk.DSZ3I557.js} +1 -1
- package/dist/preview/chunk.EA4BZKPG.js +1 -0
- package/dist/preview/{chunk.GDIRDJF3.js → chunk.EKZWX6NG.js} +1 -1
- package/dist/preview/{chunk.RGXNZ7PN.js → chunk.F26676IW.js} +1 -1
- package/dist/preview/{chunk.NRWJ6PLU.js → chunk.F2KDFGHR.js} +1 -1
- package/dist/preview/chunk.FWV4XAZA.js +1 -0
- package/dist/preview/chunk.G3BOZHKR.js +1 -0
- package/dist/preview/{chunk.HH6WIUK3.js → chunk.H4LHHT56.js} +6 -6
- package/dist/preview/{chunk.FKQTQ3FV.js → chunk.HQX5FGYT.js} +1 -1
- package/dist/preview/{chunk.TWFYXD3P.js → chunk.I5ELK6JF.js} +1 -1
- package/dist/preview/{chunk.WEGBBWWK.js → chunk.I6T3FDQS.js} +1 -1
- package/dist/preview/{chunk.DQL3WKR3.js → chunk.IB6PGEU7.js} +1 -1
- package/dist/preview/{chunk.LW7KV5SL.js → chunk.JCZH55RX.js} +1 -1
- package/dist/preview/{chunk.XUXCDUKC.js → chunk.JEMQBV6K.js} +1 -1
- package/dist/preview/{chunk.AXACXB4D.js → chunk.JIXW4WIO.js} +1 -1
- package/dist/preview/chunk.JW3E4SAC.js +1 -0
- package/dist/preview/{chunk.HDEQXJWX.js → chunk.KUTTVYOB.js} +1 -1
- package/dist/preview/{chunk.53RZI5PM.js → chunk.LHFEOEYY.js} +1 -1
- package/dist/preview/{chunk.D3CYTXNZ.js → chunk.MJ67MK4R.js} +1 -1
- package/dist/preview/{chunk.BLAODPYJ.js → chunk.ORJ3T4IW.js} +1 -1
- package/dist/preview/{chunk.TDW6QEG4.js → chunk.PY42PBMB.js} +1 -1
- package/dist/preview/{chunk.VTBAKTFP.js → chunk.QOYC424P.js} +2 -2
- package/dist/preview/{chunk.OXODTBOP.js → chunk.R6F3YMRK.js} +1 -1
- package/dist/preview/chunk.RAE4M3KQ.js +8 -0
- package/dist/preview/chunk.RUFAVEXB.js +1 -0
- package/dist/preview/chunk.RVEMN5WU.js +1 -0
- package/dist/preview/{chunk.XDVKD6VX.js → chunk.S24R4MRK.js} +3 -3
- package/dist/preview/{chunk.S4FO7Y2Q.js → chunk.S56LSUHV.js} +1 -1
- package/dist/preview/{chunk.HAQ4KHRY.js → chunk.SSOTDXRS.js} +1 -1
- package/dist/preview/{chunk.TWGB347L.js → chunk.T6KID3WO.js} +1 -1
- package/dist/preview/chunk.TAOT74FR.js +1 -0
- package/dist/preview/chunk.TTODVIXW.js +1 -0
- package/dist/preview/{chunk.XJNXSQT4.js → chunk.U6BWYBPM.js} +1 -1
- package/dist/preview/{chunk.KKTHQJ6F.js → chunk.UOYH2DFX.js} +1 -1
- package/dist/preview/{chunk.MYCTNK6D.js → chunk.US4KIJSW.js} +1 -1
- package/dist/preview/{chunk.42U4UBDE.js → chunk.WX5CJ7PI.js} +1 -1
- package/dist/preview/chunk.WXO3XUNW.js +1 -0
- package/dist/preview/{chunk.6XBLDV4A.js → chunk.YZZGD5OY.js} +1 -1
- package/dist/preview/{chunk.C7KLA2MW.js → chunk.ZJVIH6IF.js} +1 -1
- package/dist/preview/{chunk.PRXKRG6O.js → chunk.ZRVDIVYY.js} +1 -1
- package/dist/preview/chunk.ZV7ZFH2S.js +1 -0
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2STFOAXA.js +0 -1
- package/dist/preview/chunk.33C6VZAD.js +0 -1
- package/dist/preview/chunk.3TNQPFIK.js +0 -1
- package/dist/preview/chunk.54NSG7BX.js +0 -1
- package/dist/preview/chunk.6O67NOZR.js +0 -1
- package/dist/preview/chunk.7Q7S7YCA.js +0 -1
- package/dist/preview/chunk.EUCXNNCZ.js +0 -107
- package/dist/preview/chunk.FRNIWOKD.js +0 -1
- package/dist/preview/chunk.H3HRTEW7.js +0 -1
- package/dist/preview/chunk.KWSXL3A2.js +0 -1
- package/dist/preview/chunk.UEBBASQW.js +0 -1
- package/dist/preview/chunk.UIZWVBJ7.js +0 -1
- package/dist/preview/chunk.VLNI5U6H.js +0 -1
- package/dist/preview/chunk.XCOPECOJ.js +0 -1
- package/dist/preview/chunk.ZQ4HFIIS.js +0 -8
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{D as L,E as T,T as D}from"./chunk.RAE4M3KQ.js";var Y=1e4,g=class{constructor(i){this.nodes=i}},B="",c=class extends Error{constructor(f,l){super(f);this.sentence=f;this.at=l}},_=class extends c{},V=t=>t!==null&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof g)&&typeof t.id=="string",U=t=>{let i=new Set;return new g(t.filter(f=>!i.has(f.id)&&i.add(f.id)))},p=t=>t===null?"nothing":t instanceof g?"a set of records":Array.isArray(t)?"a list":V(t)?"a record":typeof t=="string"?"a word":typeof t;function P(t,i){let f=i.budget??Y,l=(n,s)=>{if(f-=n,f<0)throw new _("this rule looks at too much of the graph to judge in one go",s)},b=i.today??new Date().toISOString().slice(0,10),A=i.now??new Date().toISOString(),w=new Map,F=new Set,G=i.bindings,I=(n,s,e,o)=>{let u=`${n?.id}\0${s}`;if(w.has(u))return w.get(u);if(F.has(u))throw new c(`"${s}"${n?` of ${D(n.kind)}`:""} depends on itself`,o);F.add(u);let r=G;G=void 0;try{let a=h(e,n);return w.set(u,a),a}finally{G=r,F.delete(u)}},M=(n,s,e)=>{l(1,e);let o=i.kinds.get(n.kind),u=o?.computed?.get(s);if(u)return I(n,s,u,e);let r=Object.hasOwn(n,s);if(o?.fields.has(s)||r){let d=r?n[s]:void 0;return d===void 0?null:d}let a=o?.edges.get(s);if(a){let d=i.graph.out(n.id,s);return l(d.length,e),a==="one"?d[0]??null:new g(d)}if(s==="id")return n.id;throw new c(`${D(n.kind)} has no field or relation called "${s}"`,e)},S=(n,s,e)=>{if(n instanceof g)return n;if(n===null)return new g([]);if(V(n))return new g([n]);throw new c(`${e}(\u2026) needs a set of records, and was given ${p(n)}`,s)},k=(n,s,e)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new c(`${e}(\u2026) needs a word, and was given ${p(n)}`,s)},O=(n,s,e)=>{let o=k(n,s,e);if(o===null)return null;let u=Date.parse(o.length===10?`${o}T00:00:00Z`:o);if(Number.isNaN(u))throw new c(`${e}(\u2026) needs a date, and "${o}" is not one`,s);return u},E=(n,s)=>V(n)&&V(s)?n.id===s.id:V(n)&&typeof s=="string"?n.id===s:typeof n=="string"&&V(s)?n===s.id:Array.isArray(n)&&Array.isArray(s)?n.length===s.length&&n.every((e,o)=>E(e,s[o])):n===s,N=(n,s,e)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new c(`${e} must be true or false, and was ${p(n)}`,s)},R=(n,s)=>h(s,n);function h(n,s){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(e=>h(e,s));case"ident":{let e=G&&Object.hasOwn(G,n.name)?G[n.name]:void 0;if(e!==void 0)return e;if(s)return M(s,n.name,n.at);throw new c(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let e=h(n.object,s);if(e===null)return null;if(V(e))return M(e,n.name,n.at);throw new c(`".${n.name}" needs a record before it, and was given ${p(e)}`,n.at)}case"unary":{let e=h(n.operand,s);if(n.op==="!")return!N(e,n.at,"what follows not");if(e===null)return null;if(typeof e!="number")throw new c(`"-" needs a number, and was given ${p(e)}`,n.at);return-e}case"where":{let e=S(h(n.set,s),n.at,"where");return l(e.nodes.length,n.at),new g(e.nodes.filter(o=>N(R(o,n.filter),n.at,"a where condition")))}case"binary":return z(n,s);case"call":return H(n,s)}}function z(n,s){if(n.op==="&&")return N(h(n.left,s),n.at,"each side of and")&&N(h(n.right,s),n.at,"each side of and");if(n.op==="||")return N(h(n.left,s),n.at,"each side of or")||N(h(n.right,s),n.at,"each side of or");let e=h(n.left,s),o=h(n.right,s);if(n.op==="&"||n.op==="|"||n.op==="-"&&(e instanceof g||o instanceof g)){let u=S(e,n.at,n.op).nodes,r=S(o,n.at,n.op).nodes;l(u.length+r.length,n.at);let a=new Set(r.map(d=>d.id));return U(n.op==="|"?[...u,...r]:u.filter(d=>a.has(d.id)===(n.op==="&")))}switch(n.op){case"==":return E(e,o);case"!=":return!E(e,o);case"in":{if(o===null)return!1;if(o instanceof g)return o.nodes.some(u=>E(e,u));if(Array.isArray(o))return o.some(u=>E(e,u));if(typeof o=="string"&&typeof e=="string")return o.includes(e);throw new c(`"in" needs a list or a set on its right, and was given ${p(o)}`,n.at)}case"<":case"<=":case">":case">=":{if(e===null||o===null)return!1;if(!(typeof e=="number"&&typeof o=="number"||typeof e=="string"&&typeof o=="string"))throw new c(`cannot compare ${p(e)} with ${p(o)}`,n.at);return n.op==="<"?e<o:n.op==="<="?e<=o:n.op===">"?e>o:e>=o}default:{if(e===null||o===null)return null;if(n.op==="+"&&(typeof e=="string"||typeof o=="string")){let u=`${k(e,n.at,"+")}${k(o,n.at,"+")}`;if(u.length>1e4)throw new c("that makes a word too long",n.at);return u}if(typeof e!="number"||typeof o!="number")throw new c(`"${n.op}" needs numbers, and was given ${p(e)} and ${p(o)}`,n.at);return(n.op==="/"||n.op==="%")&&o===0?null:n.op==="+"?e+o:n.op==="-"?e-o:n.op==="*"?e*o:n.op==="/"?e/o:e%o}}}function H(n,s){let e=(r,a=r)=>{if(n.args.length<r||n.args.length>a)throw new c(`${n.fn}(\u2026) takes ${r===a?r:`${r} to ${a}`} argument${a===1?"":"s"}`,n.at)},o=r=>h(n.args[r],s),u=r=>{let a=o(r);if(typeof a!="string")throw new c(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return a};switch(n.fn){case"out":case"in":{e(1,2);let r=($,m)=>n.fn==="out"?i.graph.out($,m):i.graph.in($,m);if(n.args.length===2){let $=S(o(0),n.at,n.fn).nodes,m=u(1);return U($.flatMap(y=>{let x=r(y.id,m);return l(x.length+1,n.at),x}))}let a=u(0);if(!s)throw new c(`${n.fn}('${a}') needs a record to start from`,n.at);let d=r(s.id,a);return l(d.length,n.at),new g(d)}case"all":{e(1);let r=i.graph.nodesOfKind(u(0));return l(r.length,n.at),new g(r)}case"count":return e(1),S(o(0),n.at,"count").nodes.length;case"exists":return e(1),S(o(0),n.at,"exists").nodes.length>0;case"every":case"some":{e(2);let r=S(o(0),n.at,n.fn);l(r.nodes.length,n.at);let a=d=>N(R(d,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(a):r.nodes.some(a)}case"sum":case"min":case"max":{e(2);let r=S(o(0),n.at,n.fn);l(r.nodes.length,n.at);let a=n.args[1],d=a.t==="lit"&&typeof a.value=="string"?a.value:void 0,$=a.t==="ident"?`'${a.name}'`:d!==void 0?`'${d}'`:"\u2026",m=r.nodes.map(y=>a.t==="ident"?M(y,a.name,n.at):d!==void 0?M(y,d,n.at):R(y,a)).filter(y=>{if(y===null)return!1;if(typeof y!="number")throw new c(`${n.fn}(\u2026, ${$}) needs a number for each member, and found ${p(y)}`,n.at);return!0});return n.fn==="sum"?m.reduce((y,x)=>y+x,0):m.length===0?null:n.fn==="min"?Math.min(...m):Math.max(...m)}case"fact":{e(1);let r=u(0),a=i.kinds.get(B)?.computed?.get(r);if(!a)throw new c(`no fact is called "${r}"`,n.at);return I(null,r,a,n.at)}case"first":return e(1),S(o(0),n.at,"first").nodes[0]??null;case"sort":{e(2,3);let r=S(o(0),n.at,"sort"),a=n.args.length===3?o(2):"asc";if(a!=="asc"&&a!=="desc")throw new c("sort(\u2026) goes 'asc' or 'desc'",n.at);let d=r.nodes.length;l(d+d*Math.ceil(Math.log2(d+1)),n.at);let $=r.nodes.map((y,x)=>({node:y,i:x,key:R(y,n.args[1])})),m=a==="desc"?-1:1;return $.sort((y,x)=>K(y.key,x.key,m,n.at)||y.i-x.i),new g($.map(y=>y.node))}case"either":{if(n.args.length<1)throw new c("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let a=o(r);if(a!==null&&!(a instanceof g&&a.nodes.length===0))return a}return null}case"present":{e(1);let r=o(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof g?r.nodes.length>0:!0}case"len":{e(1);let r=o(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof g)return r.nodes.length;throw new c(`len(\u2026) needs a word or a list, and was given ${p(r)}`,n.at)}case"contains":case"startsWith":{e(2);let r=o(0),a=o(1);if(r===null||a===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(m=>E(m,a));let d=k(r,n.at,n.fn),$=k(a,n.at,n.fn);return n.fn==="contains"?d.toLowerCase().includes($.toLowerCase()):d.startsWith($)}case"lower":{e(1);let r=k(o(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"today":return e(0),b;case"now":return e(0),A;case"date":{e(1);let r=O(o(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{e(2);let r=O(o(0),n.at,n.fn),a=O(o(1),n.at,n.fn);if(r===null||a===null)return null;let d=(a-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(d):d}case"if":return e(3),N(o(0),n.at,"the condition in if(\u2026)")?o(1):o(2);default:throw new c(`"${n.fn}" is not a function the rule language knows`,n.at)}}function K(n,s,e,o){if(n===null||s===null)return n===s?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(s)){for(let r=0;r<Math.max(n.length,s.length);r++){let a=K(n[r]??null,s[r]??null,e,o);if(a!==0)return a}return 0}let u=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:p(r);if(u(n)!==u(s)||typeof n=="object"||typeof s=="object")throw new c(`sort(\u2026) cannot put ${p(n)} and ${p(s)} in order`,o);return typeof n=="string"?e*(n<s?-1:n>s?1:0):e*(Number(n)-Number(s))}return h(t,i.subject)}var tn=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact"];var rn=(t,i,f,l)=>({severity:"error",code:t,path:i,message:f,...l?{fix:l}:{}}),on=(t,i,f,l)=>({severity:"warning",code:t,path:i,message:f,...l?{fix:l}:{}}),sn=t=>t.some(i=>i.severity==="error");function an(t){return t.map(i=>`${i.severity==="error"?"\u2717":i.severity==="warning"?"!":"\xB7"} ${i.path||"(document)"}: ${i.message}${i.fix?` \u2014 ${i.fix}`:""}`).join(`
|
|
2
2
|
`)}var cn=["money","percent","date","relative","upper","lower","count","words","and","plural"],J={getNode:()=>{},allNodes:()=>[],allEdges:()=>[],nodesOfKind:()=>[],edgesOfKind:()=>[],out:()=>[],in:()=>[],neighbors:()=>[],has:()=>!1};function fn(t,i,f,l=[],b){return j(t,i,f,l,b)}function Q(t,i={}){let f=Number.isInteger(t),l={maximumFractionDigits:f?0:2,minimumFractionDigits:f?0:2};try{return new Intl.NumberFormat(i.locale??"en-US",i.currency?{style:"currency",currency:i.currency,...l}:l).format(t)}catch{return t.toLocaleString("en-US",l)}}var W=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],q=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function X(t){return!Number.isInteger(t)||t<0||t>99?t.toLocaleString("en-US",{maximumFractionDigits:2}):t<20?W[t]:t%10===0?q[t/10]:`${q[Math.floor(t/10)]}-${W[t%10]}`}function Z(t){return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function v(t){return/[^aeiou]y$/i.test(t)?`${t.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/i.test(t)?`${t}es`:`${t}s`}var C=t=>String(t.name??t.title??t.label??t.id);function j(t,i,f,l=[],b){if(i==="plural"){let A=t instanceof g?t.nodes.length:Array.isArray(t)?t.length:typeof t=="number"?t:null;return A===null||l[0]===void 0?"\u2014":A===1?l[0]:l[1]??v(l[0])}if(t===null)return"\u2014";if(t instanceof g)return i==="count"?String(t.nodes.length):i==="and"?Z(t.nodes.map(C)):t.nodes.map(C).join(", ");if(Array.isArray(t)){if(i==="count")return String(t.length);let A=t.map(w=>j(w,void 0,f,[],b));return i==="and"?Z(A):A.join(", ")}if(typeof t=="object")return C(t);switch(i){case"words":return typeof t=="number"?X(t):String(t);case"money":return typeof t=="number"?Q(t,b):String(t);case"percent":return typeof t=="number"?`${Math.round(t*100)}%`:String(t);case"upper":return String(t).toUpperCase();case"lower":return String(t).toLowerCase();case"date":return T(String(t).slice(0,10));case"relative":{let A=Date.parse(String(t).length===10?`${t}T00:00:00Z`:String(t));if(Number.isNaN(A))return String(t);let w=Math.round((A-Date.parse(`${f}T00:00:00Z`))/864e5);return w===0?"today":w===1?"tomorrow":w===-1?"yesterday":w>0?`in ${w} days`:`${-w} days ago`}default:return typeof t=="string"&&L.test(t)?T(t):String(t)}}function gn(t,i){let f=i.today??new Date().toISOString().slice(0,10);return t.map(l=>{if(l.text!==void 0)return l.text;try{let b=P(l.expr,{graph:i.graph??J,subject:i.node,kinds:i.kinds,today:f,budget:i.budget??500,...i.bindings?{bindings:i.bindings}:{}});return j(b,l.format,f,l.formatArgs,i.money)}catch(b){if(b instanceof c)return"\u2014";throw b}}).join("")}export{g as a,B as b,c,_ as d,P as e,tn as f,rn as g,on as h,sn as i,an as j,cn as k,J as l,fn as m,Q as n,gn as o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as n}from"./chunk.QOYC424P.js";import"./chunk.B57EIGTS.js";import"./chunk.2YVXTTC2.js";import"./chunk.WWRWXFYR.js";import{a as p}from"./chunk.BJ2Y5F66.js";import"./chunk.A4SJ7EEY.js";import"./chunk.6KJSFIO7.js";import"./chunk.DEZEXD24.js";import"./chunk.YZZGD5OY.js";import"./chunk.DSZ3I557.js";import"./chunk.SSOTDXRS.js";import"./chunk.ZRVDIVYY.js";import"./chunk.AHDOKM4O.js";import"./chunk.PY42PBMB.js";import"./chunk.JCZH55RX.js";import"./chunk.2WFEFZAW.js";import"./chunk.RAE4M3KQ.js";import{b as m}from"./chunk.MRK6QJV5.js";import{b as t}from"./chunk.AJZBJBMO.js";var i=t(m(),1),a=new WeakMap;function l(o){let e=a.get(o);if(!e){let r=p(o);e=c=>c.mode==="fullscreen"?(0,i.jsx)(n,{blocks:r,slot:"home",heading:2,firstHeading:1}):(0,i.jsx)(n,{blocks:r,slot:"home",heading:3,firstHeading:2}),a.set(o,e)}return e}export{l as homeView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as x,c as P}from"./chunk.
|
|
1
|
+
import{a as x,c as P}from"./chunk.7BAUPTMY.js";import{S as w}from"./chunk.2WFEFZAW.js";var v="graview:pins",m={pinned:[],unpinned:[]},g=e=>Array.isArray(e)?e.filter(n=>typeof n=="string"):[];function O(){try{let e=globalThis.localStorage?.getItem(v);if(!e)return m;let n=JSON.parse(e);if(Array.isArray(n))return{pinned:g(n),unpinned:[]};if(typeof n=="object"&&n!==null){let r=n;return{pinned:g(r.pinned),unpinned:g(r.unpinned)}}return m}catch{return m}}function S(e){try{globalThis.localStorage?.setItem(v,JSON.stringify(e))}catch{}}function C(e,n,r=!1){let o=s=>s.filter(l=>l!==n),i=r?e.unpinned.includes(n)?{pinned:o(e.pinned),unpinned:o(e.unpinned)}:{pinned:o(e.pinned),unpinned:[...e.unpinned,n]}:e.pinned.includes(n)?{pinned:o(e.pinned),unpinned:o(e.unpinned)}:{pinned:[...e.pinned,n],unpinned:o(e.unpinned)};return S(i),i}var E=e=>`ai:${e.name??(e.complete||e.turn?"model":"on-device")}`;var A="Llama-3.2-3B-Instruct-q4f16_1-MLC",L=new Map;function R(e={}){let n=e.load?null:e.model??A,r=n?L.get(n)??L.set(n,{engine:null,failed:null}).get(n):{engine:null,failed:null},o=r.engine,i=!1,s=t=>e.onStatus?.(t),l=async()=>{if(e.load)return e.load();let t=globalThis.LanguageModel;if(t){let u=await t.create();return{chat:{completions:{create:async({messages:h})=>({choices:[{message:{content:await u.prompt(h[h.length-1]?.content??"")}}]})}}}}if(!globalThis.navigator?.gpu)throw new Error("this browser has no WebGPU, which the local model needs");return(await import("https://esm.run/@mlc-ai/web-llm")).CreateMLCEngine(e.model??A,{initProgressCallback:u=>s({state:"warming",progress:u.progress,detail:u.text})})},a=Promise.resolve();return{complete:async t=>{if(o=r.engine??o,!o)throw new Error("The local model is not warm yet");let f=(await o.chat.completions.create({messages:[{role:"user",content:t}]})).choices?.[0]?.message?.content;if(typeof f!="string")throw new Error("The local model answered with no content");return f},ready:()=>(r.engine??o)!==null,warm:()=>(o=r.engine??o,o?Promise.resolve():i?a:r.failed!==null?(s({state:"failed",detail:r.failed}),Promise.resolve()):(i=!0,s({state:"warming"}),a=l().then(t=>{o=t,r.engine=t,s({state:"ready"})}).catch(t=>{r.failed=t instanceof Error?t.message:String(t),s({state:"failed",detail:r.failed})}).finally(()=>{i=!1}),a)),failed:()=>r.failed}}function T(e,n={}){return b(e,n)?.complete}function b(e,n){let r=e.turn,o=e.complete??(r?l=>r({system:"",messages:[{role:"user",content:l}],tools:[],call:async()=>({error:"No tools here."})}):void 0);if(o)return{complete:o,ready:()=>!0,warm:()=>Promise.resolve(),failed:()=>null};if(!e.onDevice)return;let i=typeof e.onDevice=="object"?e.onDevice.model:void 0,s=R({...i?{model:i}:{},...n.onStatus?{onStatus:n.onStatus}:{}});return{complete:async l=>(s.ready()||s.warm(),s.complete(l)),ready:s.ready,warm:s.warm,failed:s.failed}}function D(e,n={}){let r=n.floor??x(),o=(a,d,p)=>r(p?.principal?a.seenBy(p.principal):a,d,p),i=b(e,n);if(!i)return async(a,d,p)=>{let t=await o(a,d,p);return t.unsure?{...t,say:e.withoutModel??w}:t};let s=P({complete:i.complete,...e.turn?{turn:e.turn}:{}}),l=E(e);return async(a,d,p)=>{let t=await o(a,d,p);if(t.grounded)return t;if(!i.ready()){if(await Promise.race([i.warm(),new Promise(c=>setTimeout(c,100))]),i.failed()!==null)return y(t,"(AI isn't available in this browser, so this is from the app alone.)");if(!i.ready())return y(t,"(AI is still getting ready on this device, so this is from the app alone.)")}try{let c=await s(a,d,{...p,...t.proposals.length>0?{reading:t.proposals}:{}});return c.proposals.length===0&&t.proposals.length>0?t:{...c,via:l}}catch{return y(t,"(AI didn't answer just now, so this is from the app alone.)")}}}function y(e,n){return{...e,say:`${e.say} ${n}`}}export{O as a,C as b,T as c,D as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as f}from"./chunk.
|
|
1
|
+
import{d as f}from"./chunk.6DU4XN2F.js";import{Rb as y}from"./chunk.RAE4M3KQ.js";import{a as S,b as s}from"./chunk.MRK6QJV5.js";import{b as a}from"./chunk.AJZBJBMO.js";var o=a(S(),1),l=a(s(),1);function A({context:e,stop:r,title:t,style:n,className:i,children:g,...p}){let d=y(e.views?.arrangement?.()),c=g??`In ${d==="Scene"?"the scene":d.replace(/^The /,"the ")} \u2197`;if(e.overview){let h=e.overview;return(0,l.jsx)("a",{href:r,...p,...t?{title:t}:{},style:n,...i?{className:i}:{},onClick:x=>{x.preventDefault(),h(r)},children:c})}return e.embedded?null:(0,l.jsx)("a",{href:`${e.sceneHref??"/"}${r}`,...p,...t?{title:t}:{},style:n,...i?{className:i}:{},children:c})}function v(){return(0,l.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:e=>{e.preventDefault();let r=new URL(window.location.href);r.searchParams.set("fresh","1"),window.location.assign(r.toString())},style:{color:"inherit",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24},children:"Start fresh"})}function b(e){let r=(0,o.useRef)(0),t=(0,o.useCallback)(n=>e.subscribe(()=>{r.current+=1,n()}),[e]);return(0,o.useSyncExternalStore)(t,()=>r.current,()=>0)}var m=a(s(),1),u=f.part(e=>(0,m.jsx)(e.ActivityRail,{calls:[]}),{quiet:!0});export{A as a,v as b,b as c,u as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as q,ca as G,i as j}from"./chunk.
|
|
1
|
+
import{B as q,ca as G,i as j}from"./chunk.2WFEFZAW.js";import{I as P,J as H,M as L,R,U as K,Va as T}from"./chunk.RAE4M3KQ.js";import{a as V,b as M}from"./chunk.MRK6QJV5.js";import{b as E}from"./chunk.AJZBJBMO.js";var a=E(V(),1),s=E(M(),1);function ne({affordance:r,onApply:o,onCancel:u}){let{store:l}=G(),[y,m]=(0,a.useState)({}),[f,x]=(0,a.useState)(""),[A,$]=(0,a.useState)(_),W=(0,a.useId)(),O=(0,a.useRef)(null),b=r.open.filter(e=>!(e.name in y)),i=b[0];if((0,a.useEffect)(()=>x(""),[i?.name]),(0,a.useEffect)(()=>{O.current?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[i?.name]),(0,a.useLayoutEffect)(()=>{let e=O.current,t=typeof document>"u"?null:document.activeElement;if(!e||t&&t!==document.body&&!e.contains(t))return;let p=e.querySelector("form input, [role=group] button:not([disabled])");p&&p!==t&&p.focus()},[i?.name]),!i)return null;let h=e=>{let t={...y,[i.name]:e};if(r.open.filter(c=>!(c.name in t)).length===0){let c=o(Object.fromEntries(Object.entries(t).filter(([,C])=>C!==void 0)));c&&c.length>0&&m(Object.fromEntries(Object.entries(t).filter(([C])=>!c.includes(C))))}else m(t)},F=i.optional?(0,s.jsx)("button",{type:"button",onClick:()=>h(void 0),style:{fontSize:"0.8125rem"},children:"Skip"}):null,n=i.shape??{type:"unknown"},d=Y(i,n),g=T(l.schema,l.allMutations().find(e=>e.name===r.mutation),i.name),[N,B]=(0,a.useState)(""),I=(0,a.useMemo)(()=>{let e=d.map(t=>l.graph.getNode(t)).filter(t=>t!==void 0);return P(e,t=>l.schema.tryDefinition(t))},[d,l]),z=e=>{let t=Q(l,n,e),p=n.type==="choice"||n.type==="several"&&n.of.type==="choice"?g.option(e):t,c=I.get(e);return c?`${p} \xB7 ${c}`:p},w=(0,a.useMemo)(()=>{let e=N.trim().toLowerCase();return e===""?d:d.filter(t=>z(t).toLowerCase().includes(e))},[d,N,l,n,I]),v=n.type==="several",D=v&&d.length===0,k=i.kinds&&i.kinds.length>0&&!i.kinds.includes("*")?i.kinds.map(e=>L(K(l.schema.tryDefinition(e),e))).join(" or "):g.label,U=r.open.length>1?`${k} \xB7 ${r.open.length-b.length+1} of ${r.open.length}`:k;return(0,s.jsxs)("div",{ref:O,"data-graview-asking":r.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:4,padding:"5px 0 2px"},children:[r.open.length>1||d.length>0?(0,s.jsx)("span",{id:W,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:U}):null,d.length>S?(0,s.jsx)("input",{type:"search",value:N,onChange:e=>B(e.target.value),placeholder:`Filter ${d.length}\u2026`,"aria-label":`Filter ${k}`,"data-testid":"ask-filter",style:{font:"inherit",fontSize:"0.8125rem",minWidth:0,padding:"3px 7px"}}):null,d.length>0?(0,s.jsxs)("div",{role:"group","aria-labelledby":W,style:{display:"flex",flexWrap:"wrap",gap:4},children:[w.slice(0,S).map(e=>{let t=A.includes(e);return(0,s.jsx)("button",{type:"button","aria-label":`${k}: ${z(e)}`,...v?{"aria-pressed":t}:{},style:{padding:"3px 9px",fontSize:"0.8125rem",...t?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},onClick:()=>v?$(p=>p.includes(e)?p.filter(c=>c!==e):[...p,e]):h(n.type==="boolean"?e==="yes":e),children:z(e)},e)}),w.length>S?(0,s.jsxs)("span",{"data-testid":"ask-more",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:[w.length-S," more \u2014 type to narrow"]}):null,w.length===0?(0,s.jsxs)("span",{"data-testid":"ask-none",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["None of the ",d.length," match that."]}):null,v?(0,s.jsx)("button",{type:"button",disabled:A.length===0,style:{fontSize:"0.8125rem"},onClick:()=>{let e=A;$(_),h(e)},children:b.length>1?"Next":"Apply"}):null,F]}):(0,s.jsxs)("form",{style:{display:"flex",flexWrap:"wrap",gap:4},onSubmit:e=>{if(e.preventDefault(),D){h(f.split(/[,\n]/).map(t=>t.trim()).filter(Boolean));return}f.trim().length!==0&&h(n.type==="number"?Number(f):f)},children:[n.type==="text"&&n.long?(0,s.jsx)("textarea",{autoFocus:!0,name:i.name,"aria-label":g.label,placeholder:g.label,value:f,rows:4,onChange:e=>x(e.target.value),onKeyDown:e=>{e.key==="Escape"?u():e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},style:{flex:"1 1 100%",minWidth:0,font:"inherit",fontSize:"0.875rem",lineHeight:1.45,padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",resize:"vertical",fieldSizing:"content",minHeight:"5.5em",maxHeight:"40vh"}}):(0,s.jsx)("input",{autoFocus:!0,type:n.type==="date"?n.time?"datetime-local":"date":n.type==="number"?"number":"text",name:i.name,"aria-label":g.label,placeholder:D?`${g.label}, separated by commas`:g.label,value:f,...n.type==="number"&&n.min!==void 0?{min:n.min}:{},...n.type==="number"&&n.max!==void 0?{max:n.max}:{},...n.type==="number"&&n.step!==void 0?{step:n.step}:{},onChange:e=>x(e.target.value),onKeyDown:e=>{e.key==="Escape"&&u()},style:{flex:1,minWidth:0,font:"inherit",fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}),(0,s.jsx)("button",{type:"submit",disabled:!D&&f.trim().length===0,style:{fontSize:"0.8125rem"},children:b.length>1?"Next":"Apply"}),F]})]})}var _=[],S=10;function Y(r,o){return r.candidates&&r.candidates.length>0?r.candidates:o.type==="choice"?o.options:o.type==="several"&&o.of.type==="choice"?o.of.options:o.type==="boolean"?J:[]}var J=["yes","no"];function Q(r,o,u){return o.type==="boolean"||o.type==="choice"||o.type==="several"&&o.of.type==="choice"?u:X(r,u)}function X(r,o){let u=j(o);if(u){let m=R(r.schema,r.graph.getNode(u.from)?.kind??"",u.kind,"out");return m.charAt(0).toUpperCase()+m.slice(1)}let l=q(o);if(l.length>0)return l.map(m=>r.schema.tryDefinition(m)?.plural??`${m}s`).join(" + ");let y=r.graph.getNode(o);return y?H(r.schema.tryDefinition(y.kind),y):o}export{ne as a,X as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as a,l as o}from"./chunk.QOYC424P.js";import"./chunk.B57EIGTS.js";import"./chunk.2YVXTTC2.js";import"./chunk.WWRWXFYR.js";import"./chunk.BJ2Y5F66.js";import"./chunk.A4SJ7EEY.js";import"./chunk.6KJSFIO7.js";import"./chunk.DEZEXD24.js";import"./chunk.YZZGD5OY.js";import"./chunk.DSZ3I557.js";import"./chunk.SSOTDXRS.js";import"./chunk.ZRVDIVYY.js";import"./chunk.AHDOKM4O.js";import"./chunk.PY42PBMB.js";import"./chunk.JCZH55RX.js";import{la as n}from"./chunk.2WFEFZAW.js";import"./chunk.RAE4M3KQ.js";import"./chunk.MRK6QJV5.js";import"./chunk.AJZBJBMO.js";var w=new WeakMap;function p(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=o(a(e,n(e)),e,i)),r}export{p as frameworkViews};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as K}from"./chunk.6DU4XN2F.js";import{a as se}from"./chunk.US4KIJSW.js";import{a as V}from"./chunk.B57EIGTS.js";import{l as ie,m as G}from"./chunk.2YVXTTC2.js";import{f as _,g as N,h as B}from"./chunk.ZRVDIVYY.js";import{Ba as ae,W as ee,a as O,ca as M,da as te,ea as ne,pa as oe,ra as re,ya as F}from"./chunk.2WFEFZAW.js";import{Q as J,R as Q,ub as Z,zb as z}from"./chunk.RAE4M3KQ.js";import{a as $,b as T}from"./chunk.MRK6QJV5.js";import{b as k}from"./chunk.AJZBJBMO.js";var i=k($(),1);var x=k(T(),1),le=336,w=16,ue=640,I=F(O(()=>import("./chunk.TAOT74FR.js"))),fe=I.part((t,n)=>{let s=t.SeatPanel;return(0,x.jsx)(s,{...n})},{what:"The conversation"});function xe({respond:t,onCall:n,onPick:s,start:y="field",onMove:l,place:S,onDraft:v}){let{brand:r,seatTalk:d}=M(),f=ee(d),g=r?.name?.trim()||"this app",h=(0,i.useRef)(null),o=(0,i.useRef)(null),[a,c]=(0,i.useState)(""),[m,P]=(0,i.useState)(!1),C=(0,i.useRef)(null),b=y==="hidden",p=f.open&&!b;(0,i.useEffect)(()=>b?void 0:d.drawn(),[d,b]),(0,i.useLayoutEffect)(()=>{let e=h.current?.parentElement;if(!e)return;let E=()=>P(e.getBoundingClientRect().width<ue);if(E(),typeof ResizeObserver>"u")return;let D=new ResizeObserver(E);return D.observe(e),()=>D.disconnect()},[b]),(0,i.useEffect)(()=>{typeof window<"u"&&window.dispatchEvent(new Event(se))},[p,f.side,m]),(0,i.useEffect)(()=>{let e=h.current;if(b||p||!e||typeof window>"u")return;let E=(e.closest("[data-graview-embed]")??document.documentElement).style,D=()=>{let Y=e.getBoundingClientRect(),X=e.offsetParent?.getBoundingClientRect(),ce=X?X.bottom-Y.top:Y.height+w;E.setProperty("--graview-foot-room",`${Math.max(0,Math.round(ce+w))}px`)};D();let U=typeof ResizeObserver>"u"?null:new ResizeObserver(D);return U?.observe(e),()=>{U?.disconnect(),E.removeProperty("--graview-foot-room")}},[b,p,m,f.side]),(0,i.useEffect)(()=>{!p||f.pending===null||(j(),o.current?.focus({preventScroll:!0}))},[p,f.pending]);let j=()=>{let e=typeof document>"u"?null:document.activeElement;e instanceof HTMLElement&&e!==document.body&&!h.current?.contains(e)&&(C.current=e)},H=()=>{j(),I.prefetch(),d.setOpen(!0)},q=()=>{d.setOpen(!1);let e=C.current;C.current=null,e?.isConnected&&!(m&&e instanceof HTMLInputElement)&&e.focus({preventScroll:!0}),document.activeElement!==e&&(m?h:o).current?.focus({preventScroll:!0})};if(b)return null;let R=!m&&f.side==="right",pe=m?p?{left:0,right:0,bottom:0,padding:"8px 12px calc(12px + env(safe-area-inset-bottom, 0px))",borderRadius:"12px 12px 0 0",...de}:{left:w,right:w,bottom:`calc(${w}px + env(safe-area-inset-bottom, 0px))`}:p?{[R?"right":"left"]:w/2-1,bottom:w/2-1,width:le+w+2,padding:w/2,borderRadius:12,...de}:{[R?"right":"left"]:w,bottom:w,width:le};return(0,x.jsxs)("section",{ref:h,role:"region","aria-label":`Ask ${g}`,tabIndex:-1,"data-testid":"seat","data-graview-seat":p?"open":"closed","data-graview-seat-side":R?"right":"left","data-graview-seat-shape":m?"phone":"desk","data-graview-foot":"","data-graview-offstage":"",onMouseDown:e=>e.stopPropagation(),onKeyDown:e=>{e.key!=="Escape"||!p||(e.preventDefault(),e.stopPropagation(),q())},style:{position:"absolute",zIndex:z("rail"),boxSizing:"border-box",display:"flex",flexDirection:"column",gap:8,pointerEvents:"auto",outline:"none",...pe},children:[(0,x.jsxs)("h2",{style:{...ae,margin:0},children:["Ask ",g]}),p?(0,x.jsx)(i.Suspense,{fallback:null,children:(0,x.jsx)(fe,{phone:m,side:R?"right":"left",name:g,onClose:q,...t?{respond:t}:{},...n?{onCall:n}:{},...s?{onPick:s}:{},...l?{onMove:l}:{},...S?{place:S}:{},...v?{onDraft:v}:{}})}):null,(0,x.jsx)("form",{onSubmit:e=>{e.preventDefault();let E=a.trim();p||H(),!(!E||f.busy)&&(d.ask(E),c(""))},style:{display:"flex",margin:0},children:(0,x.jsx)("input",{ref:o,"data-testid":"seat-field",type:"text",enterKeyHint:"send",autoComplete:"off",value:a,placeholder:`Ask ${g}\u2026`,"aria-label":`Ask ${g}`,onPointerEnter:()=>I.prefetch(),onFocus:()=>I.prefetch(),onClick:()=>{p||H()},onChange:e=>{c(e.target.value),p||H()},style:{flex:"1 1 auto",minWidth:0,boxSizing:"border-box",height:38,padding:"0 12px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8}})})]})}var de={background:"var(--graview-float)",border:"1px solid var(--graview-edge)",boxShadow:"var(--graview-lift-high)"};var W=k($(),1),L=k(T(),1),me=F(O(()=>import("./chunk.ZJVIH6IF.js"))),ge=me.part((t,n)=>{let s=t.DraftFrame;return(0,L.jsx)(s,{...n})},{what:"The view"});function Te(t){let{seatTalk:n}=M();return(0,W.useSyncExternalStore)(n.subscribe,()=>n.get().draft!==null,()=>!1)?(0,L.jsx)(W.Suspense,{fallback:null,children:(0,L.jsx)(ge,{...t})}):null}function Re(t={}){return t.scope===void 0?V:K(V,t.scope)}var A=k($(),1),u=k(T(),1);function We({inside:t=!1}={}){let{store:n,view:s,emphasis:y,setEmphasis:l}=M(),S=ie(),{selection:v,set:r}=oe(),{show:d}=re(),f=ne(),g=(0,A.useMemo)(()=>{let o=new Map;for(let a of n.graph.allEdges()){let c=o.get(a.kind)??{count:0,ends:new Set};c.count+=1;for(let m of[a.from,a.to]){let P=n.graph.getNode(m);P&&c.ends.add(`kind:${P.kind}`)}o.set(a.kind,c)}return[...o.entries()].sort(([a],[c])=>a.localeCompare(c)).map(([a,c])=>({kind:a,count:c.count,ends:[...c.ends]}))},[n,f]);if((0,A.useEffect)(()=>()=>l(null),[l]),!s.overview&&!t||g.length===0)return null;let h=new Set;for(let o of v){if(o.startsWith("kind:")){h.add(o);continue}let a=n.graph.getNode(o);a&&h.add(`kind:${a.kind}`)}return(0,u.jsxs)("section",{"aria-label":"What the lines mean",role:t?"group":void 0,"data-testid":"relation-key",style:t?{display:"grid",gap:1}:{position:"absolute",left:16,top:14,zIndex:z("rail"),display:"grid",gap:1,padding:"8px 10px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",maxWidth:he,animation:"graview-settle 380ms 280ms ease backwards"},children:[t?null:(0,u.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-faint)",paddingBottom:2},children:g.length===1?"1 relation":`${g.length} relations`}),g.map(({kind:o,count:a,ends:c})=>{let{connector:m,style:P}=G(S,o),C=ye(n.schema,o),b=y!==null?y===o:h.size===0||c.some(p=>h.has(p));return(0,u.jsxs)("button",{type:"button",title:n.schema.edge(o)?.description===void 0?`${a} of these`:C.words,onMouseEnter:()=>l(o),onMouseLeave:()=>l(null),onFocus:()=>l(o),onBlur:()=>l(null),onClick:()=>{r(c),d(null)},style:{all:"unset",outline:"revert-layer",cursor:"pointer",display:"grid",gridTemplateColumns:"30px 1fr auto",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px",borderRadius:6,opacity:b?1:.4},children:[(0,u.jsx)("svg",{width:"30",height:"8","aria-hidden":"true",style:{display:"block",opacity:m.visible?1:.35},children:(0,u.jsx)("path",{d:"M 1 4 L 29 4",fill:"none",stroke:N(P),strokeWidth:B(P,!0),strokeDasharray:_[P.pattern],strokeLinecap:"round"})}),(0,u.jsxs)("span",{style:{display:"grid",minWidth:0},"data-graview-relation-words":o,children:[(0,u.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink)"},children:C.words}),(0,u.jsx)("span",{style:{fontSize:"0.6875rem",color:"var(--graview-ink-faint)"},children:C.ends})]}),m.visible?null:(0,u.jsx)("span",{"data-graview-quiet":o,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontStyle:"italic"},children:"not drawn"}),(0,u.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontVariantNumeric:"tabular-nums"},children:a})]},o)})]})}var he="min(280px, calc(100% - 28px))";function ye(t,n,s){let y=t.edge(n)?.from??[],l=new Map;for(let r of s!==void 0&&y.includes(s)?[s]:y.length>0?y:[""]){let d=Q(t,r,n,"out");l.set(d,[...l.get(d)??[],r])}let S=r=>r==="*"?"anything":J(t,r),v=[...l].map(([r,d])=>{let f=d.flatMap(h=>t.tryDefinition(h)?.edges[n]?.to??[]),g=d[0]&&f.length>0?`${d.map(S).join(", ")} \u2192 ${(f.includes("*")?["*"]:[...new Set(f)]).map(S).join(", ")}`:"";return[r.charAt(0).toUpperCase()+r.slice(1),g]});return{words:v.map(([r])=>r).join(" \xB7 "),ends:v.flatMap(([,r])=>r?[r]:[]).join(" \xB7 ")}}function He({edgeKind:t,kit:n,width:s=30}){let y=te(),l=(0,A.useMemo)(()=>Z(n??y?.brand?.kit),[n,y?.brand?.kit]),{connector:S,style:v}=G(l,t);return(0,u.jsx)("svg",{width:s,height:"8","aria-hidden":"true","data-testid":"relation-mark","data-graview-relation":t,style:{display:"inline-block",verticalAlign:"middle",opacity:S.visible?1:.35},children:(0,u.jsx)("path",{d:`M 1 4 L ${s-1} 4`,fill:"none",stroke:N(v),strokeWidth:B(v,!0),strokeDasharray:_[v.pattern],strokeLinecap:"round"})})}export{xe as a,Te as b,We as c,he as d,He as e,Re as f};
|