graview 0.1.26 → 0.1.28
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.QFJRXAU3.js → chunk.22H4JXTH.js} +2 -2
- package/dist/preview/{chunk.BK2MJOUN.js → chunk.25OYH6MY.js} +1 -1
- package/dist/preview/{chunk.UUMXYMOX.js → chunk.2GBQJXJH.js} +1 -1
- package/dist/preview/chunk.2VUG6EAN.js +1 -0
- package/dist/preview/chunk.337WDTG3.js +2 -0
- package/dist/preview/chunk.3HLLQ5CJ.js +1 -0
- package/dist/preview/chunk.46KUPBQC.js +1 -0
- package/dist/preview/{chunk.564EIRAT.js → chunk.4H7CQE56.js} +1 -1
- package/dist/preview/chunk.4RO5DA22.js +1 -0
- package/dist/preview/{chunk.LHIYFAN5.js → chunk.4TUNX4WM.js} +1 -1
- package/dist/preview/chunk.5BGA2VUS.js +20 -0
- package/dist/preview/{chunk.ECRZZ3U4.js → chunk.7S22MBNN.js} +1 -1
- package/dist/preview/{chunk.I5U42VDK.js → chunk.A73BXXE4.js} +2 -2
- package/dist/preview/chunk.ARE3MEDN.js +1 -0
- package/dist/preview/chunk.ASFZTYFO.js +1 -0
- package/dist/preview/chunk.BBJZ6O7J.js +1 -0
- package/dist/preview/{chunk.XOC5BRPU.js → chunk.BCBH6WJF.js} +1 -1
- package/dist/preview/{chunk.CL7GGNEK.js → chunk.CAZAB352.js} +1 -1
- package/dist/preview/chunk.CY7MDLRS.js +1 -0
- package/dist/preview/chunk.DAVRLRGB.js +1 -0
- package/dist/preview/{chunk.ZOWWWRYA.js → chunk.DCIC3YHX.js} +1 -1
- package/dist/preview/{chunk.XD4Q4FI2.js → chunk.EW4JFOJY.js} +1 -1
- package/dist/preview/{chunk.PKFL2AR4.js → chunk.EYF6ONTA.js} +1 -1
- package/dist/preview/{chunk.ECG7RM6L.js → chunk.FP27W5MU.js} +1 -1
- package/dist/preview/{chunk.AAVCTGAE.js → chunk.G2OOBROL.js} +1 -1
- package/dist/preview/{chunk.2GFB5FOK.js → chunk.GCKSQ52O.js} +1 -1
- package/dist/preview/{chunk.KSEKVHJJ.js → chunk.GE5EAN36.js} +1 -1
- package/dist/preview/chunk.HOPIZMJR.js +2 -0
- package/dist/preview/chunk.IBGO4BUF.js +1 -0
- package/dist/preview/{chunk.OBGG4SYF.js → chunk.IDI2BQ7Y.js} +1 -1
- package/dist/preview/chunk.IH42QTOM.js +1 -0
- package/dist/preview/{chunk.NQP3DWME.js → chunk.ISRS7GOT.js} +1 -1
- package/dist/preview/{chunk.YXQCEXZX.js → chunk.J6CBMLGR.js} +1 -1
- package/dist/preview/{chunk.OBQ4DIFO.js → chunk.JRCV6HVV.js} +1 -1
- package/dist/preview/{chunk.4INXWGIT.js → chunk.KWW3YHQ4.js} +1 -1
- package/dist/preview/chunk.MKNXV4TM.js +8 -0
- package/dist/preview/{chunk.MLQQR57X.js → chunk.MVNIKZIC.js} +1 -1
- package/dist/preview/{chunk.YOMW4MKD.js → chunk.N2WTNKEV.js} +1 -1
- package/dist/preview/{chunk.4MAYBFPU.js → chunk.N7HCALRK.js} +1 -1
- package/dist/preview/{chunk.SVL6I37U.js → chunk.NRRUGG22.js} +1 -1
- package/dist/preview/{chunk.3RT463XY.js → chunk.OGL4PHTY.js} +1 -1
- package/dist/preview/{chunk.5CXMUC6R.js → chunk.PFQFPJ5L.js} +1 -1
- package/dist/preview/{chunk.NIEQZOHX.js → chunk.PN2H6X7O.js} +1 -1
- package/dist/preview/{chunk.KXWRS6LY.js → chunk.PWHJHFC4.js} +1 -1
- package/dist/preview/{chunk.XNYBOKLW.js → chunk.Q3HVA6L4.js} +1 -1
- package/dist/preview/{chunk.HFFEOCYY.js → chunk.RZLNDVGN.js} +2 -2
- package/dist/preview/{chunk.DRIWJRQW.js → chunk.SBHVVJY7.js} +1 -1
- package/dist/preview/{chunk.NLFLFIDS.js → chunk.SNBIZ3B6.js} +1 -1
- package/dist/preview/chunk.TBG2QBOS.js +1 -0
- package/dist/preview/chunk.VR735ZQL.js +1 -0
- package/dist/preview/{chunk.AKWBAWQF.js → chunk.VSXCXPK2.js} +1 -1
- package/dist/preview/chunk.W3LDQ6B2.js +1 -0
- package/dist/preview/{chunk.24X6LFD3.js → chunk.WCNONCTL.js} +1 -1
- package/dist/preview/{chunk.LEVR7WLB.js → chunk.WHTNSETN.js} +1 -1
- package/dist/preview/{chunk.XXNC2AFL.js → chunk.XG67BWH6.js} +1 -1
- package/dist/preview/{chunk.VW7U4CT5.js → chunk.XRM6WXPW.js} +1 -1
- package/dist/preview/chunk.Y5LPZLDE.js +1 -0
- package/dist/preview/chunk.YETBY2LM.js +1 -0
- package/dist/preview/chunk.ZEUBAAVQ.js +1 -0
- package/dist/preview/{chunk.D3XF643V.js → chunk.ZJDRD6PO.js} +1 -1
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.4YY54TMR.js +0 -1
- package/dist/preview/chunk.6GJF3F7L.js +0 -2
- package/dist/preview/chunk.6MZBFEXW.js +0 -1
- package/dist/preview/chunk.7OOKA2DK.js +0 -1
- package/dist/preview/chunk.7ZJPJARU.js +0 -1
- package/dist/preview/chunk.IQLDOIWD.js +0 -1
- package/dist/preview/chunk.JIWB6VGT.js +0 -2
- package/dist/preview/chunk.LCFCU3I3.js +0 -1
- package/dist/preview/chunk.LLUZMOBZ.js +0 -1
- package/dist/preview/chunk.LUUT2ZWF.js +0 -20
- package/dist/preview/chunk.P7YN4Z3K.js +0 -8
- package/dist/preview/chunk.PQ2IIC27.js +0 -1
- package/dist/preview/chunk.REODVRPZ.js +0 -1
- package/dist/preview/chunk.RH6VRP76.js +0 -1
- package/dist/preview/chunk.TAW67PZU.js +0 -1
- package/dist/preview/chunk.TUYKH4FG.js +0 -1
- package/dist/preview/chunk.UEEXBS2U.js +0 -1
- package/dist/preview/chunk.WWWZZAHE.js +0 -1
- package/dist/preview/chunk.YIZ3DJO3.js +0 -1
- package/dist/preview/chunk.ZLPA5BAW.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as n}from"./chunk.A73BXXE4.js";import"./chunk.N7HCALRK.js";import"./chunk.WHTNSETN.js";import"./chunk.WVUJXDXZ.js";import{e as p}from"./chunk.46KUPBQC.js";import"./chunk.N2WTNKEV.js";import"./chunk.SBHVVJY7.js";import"./chunk.GE5EAN36.js";import"./chunk.337WDTG3.js";import"./chunk.EYF6ONTA.js";import"./chunk.Q3HVA6L4.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.ZJDRD6PO.js";import"./chunk.SNBIZ3B6.js";import"./chunk.6LJ66MB7.js";import"./chunk.NRRUGG22.js";import"./chunk.MKNXV4TM.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as he,b as Oe,c as xe,d as ce,e as v,f as Ee,h as Fe}from"./chunk.CY7MDLRS.js";import{e as Re,f as De,g as Me}from"./chunk.N2WTNKEV.js";import{a as ne,b as te,c as L,d as Ae,e as W,g as X,h as Te}from"./chunk.GE5EAN36.js";import{b as Se,g as u,h as ve,i as ae}from"./chunk.337WDTG3.js";import{a as ee,b as Y,d as ye,e as $e,f as C,h as k,k as G,l as be,m as _,n as ke,o as q,p as F,r as w,s as we,sa as We,t as R,u as O,v as U,w as T,x as n,y as V,z as je}from"./chunk.MKNXV4TM.js";import"./chunk.AJZBJBMO.js";var le="graview-document",pe=1,fe=256*1024,de=64*1024,Pe=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ue=/^[a-z][A-Za-z0-9]*$/,Ze=new Set(["id","kind"]),Je=e=>e in Object.prototype,Ke=V(e=>!Je(e),"every object already has this name \u2014 choose another"),Ce=(e,t)=>[...e===void 0?[]:[$e(e)],...t===void 0?[]:[ye(t)]],b=(e,t)=>k().check(...Ce(e,t)),x=(e,t,i)=>F(e).check(...Ce(t,i)),A=e=>k().check(C(Pe,`${e} names are lower-case words joined by hyphens, like "booked-vendor"`)),Ye=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,B=k().check(C(Ye,'relation names are one camelCase word, like "tendedBy"'),Ke),P=k().check(C(ue,'field names are one word or camelCase, like "dueDate" \u2014 rules say them bare'),V(e=>!Ze.has(e),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),Ke),I=b(1,500),J=b(1,2e3),se=b(1,300),Xe=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","file"],Ge=w({type:U(Xe),required:n(_()),description:n(I),label:n(b(1,60)),options:n(x(b(1,80),1,100)),of:n(U(["string","number","date","image","file"])),default:n(q()),unit:n(b(void 0,12)),format:n(U(["money","percent","duration"])),min:n(G()),max:n(G()),step:n(G()),renamedFrom:n(k().check(C(ue)))}).check(je((e,t)=>{e.type==="enum"&&!e.options&&t.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),e.type!=="enum"&&e.options&&t.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),e.type!=="list"&&e.of&&t.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]})})),He=w({to:R([x(A("kind"),1),T("*")]),cardinality:n(U(["one","many"])),description:n(I),inverse:n(b(1,80)),appendOnly:n(_()),renamedFrom:n(k())}),_e=R([J,w({expr:J,label:n(b(1,60)),description:n(I)})]),Qe=w({noun:n(b(1,40)),plural:n(b(1,40)),description:n(I),fields:O(P,Ge).check(V(e=>Object.keys(e).length>0,"a kind has at least one field")),label:n(se),describe:n(se),lifecycle:n(w({field:P,retired:x(R([k(),G(),_()]),1)})),figure:n(b(void 0,2e4)),glance:n(x(P,1,20)),page:n(w({fields:n(x(P,1,40)),groups:n(x(w({title:b(1,60),fields:x(P,1,40)}),1,12))})),edges:n(O(B,He)),computed:n(O(k(),_e).check(V(e=>Object.keys(e).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:n(O(k(),k())),renamedFrom:n(k().check(C(Pe))),people:n(_())}),H=R([k(),G(),_(),ke(),F(q()),w({expr:J})]),Z=k().check(C(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),en=R([w({create:A("kind"),as:n(k().check(C(ue))),set:n(O(P,H))}),w({set:O(P,H),target:n(Z)}),w({connect:B,from:Z,to:Z}),w({sever:B,from:Z,to:Z}),w({remove:Z})]),nn=w({title:n(b(1,80)),description:n(I),fromTheOtherEnd:n(b(1,80)),on:n(R([A("kind"),x(A("kind"),1)])),creates:n(A("kind")),sets:n(O(P,H)),writes:n(x(P,1)),connects:n(B),severs:n(B),setsOther:n(O(P,H)),replaces:n(R([T(!0),x(B,1,10)])),removes:n(T(!0)),args:n(O(P,Ge)),effects:n(x(en,1,20)),allowedWhen:n(J),refusal:n(se),destructive:n(_())}),tn=w({act:A("act"),label:n(b(1,80)),args:n(O(k(),H))}),on=w({title:n(b(1,120)),description:n(I),over:R([T("graph"),A("kind")]),when:n(J),require:J,says:n(se),repairs:n(x(tn,void 0,10))}),sn=w({roles:R([x(A("role"),1),T("*")]),mutations:R([x(A("act"),1),T("*")]),kinds:n(R([F(A("kind")),T("*")])),describe:n(I),self:n(_()),ownEnd:n(_())}),rn=w({roles:R([x(A("role"),1),T("*")]),kinds:x(A("kind"),1),own:n(_()),via:n(B)}),an=w({grants:F(sn),sees:n(F(rn))}),cn=w({accent:n(k().check(C(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),name:n(b(1,60)),currency:n(k().check(C(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(b(2,35)),logo:n(R([b(1,de),w({src:b(1,de),alt:n(b(1,120))})])),favicon:n(b(1,de)),typography:n(w({display:n(b(1,200)),body:n(b(1,200)),mono:n(b(1,200))})),shape:n(w({radius:n(G().check(Y(0),ee(32))),density:n(G().check(Y(.75),ee(1.5)))})),accents:n(O(k(),G().check(Y(0),ee(360)))),scheme:n(U(["light","dark","auto"]))}),oe=O(k(),q()),dn=w({card:n(F(q())),row:n(F(q())),page:n(F(q()))}),ln=we({order:n(F(k())),hide:n(F(k())),first:n(k()),primary:n(x(b(1,80),void 0,40)),scene:n(b(1,40)),pages:n(b(1,40))}),qe=w({$schema:n(k()),format:T(le),formatVersion:T(pe),name:b(1,80),description:n(I),version:n(G().check(be(),Y(1))),kinds:O(A("kind"),Qe).check(V(e=>Object.keys(e).length>0,"a document declares at least one kind"),V(e=>Object.keys(e).length<=40,"a document declares at most 40 kinds")),computed:n(O(k(),_e)),acts:n(O(A("act"),nn)),rules:n(O(A("rule"),on)),roles:n(F(A("role"))),policy:n(an),modules:n(oe),lenses:n(F(oe)),pages:n(ln),views:n(O(k(),R([dn,F(q())]))),brand:n(cn),settings:n(F(oe)),migrations:n(F(oe))});var pn={};function Ie(e,t=pn,i=pe){let{document:a,respelled:p}=he(e),f=p.length>0?{respelled:p}:{};if(!a||typeof a!="object"||Array.isArray(a))return{document:a};let m=a;if(m.format!==le||typeof m.formatVersion!="number"||m.formatVersion>=i)return{document:a,...f};let c=m.formatVersion,r=structuredClone(m);for(let s=c;s<i;s++){let d=t[s];if(!d)throw new Error(`there is no upgrade from format ${s} to ${s+1}`);r={...d(r),formatVersion:s+1}}return{document:r,from:c,...f}}function Ne(e,t,i){let a=Object.keys(e).filter(c=>e[c].edges?.[t]!==void 0);if(a.length===0)return;let p=a.map(c=>e[c].edges[t].to),f=p.some(c=>c==="*")?"*":[...new Set(p.flatMap(c=>c))];if(i.length===0||i.some(c=>a.includes(c)))return{reversed:!1,kinds:f};let m=a.filter(c=>{let r=e[c].edges[t].to;return r==="*"||i.every(s=>r.includes(s))});return m.length>0?{reversed:!0,kinds:m}:{reversed:!1,kinds:f}}function Ve(e,t,i=`kinds.${e}.page`){let a=t.page;if(!a)return[];let p=[],f=[...Object.keys(t.fields),...Object.keys(t.computed??{})],m=new Set,c=(s,d)=>{f.includes(s)?m.has(s)&&p.push(u("page-field-twice",d,`"${s}" is on ${e}'s page twice; name each field once`)):p.push(u("page-field",d,`${e}'s page is to show "${s}", and ${e} has no field or computed field called that`,`use one of: ${f.join(", ")}`)),m.add(s)};(a.fields??[]).forEach((s,d)=>c(s,`${i}.fields.${d}`));let r=new Set;return(a.groups??[]).forEach((s,d)=>{let l=s.title.trim().toLowerCase();r.has(l)&&p.push(u("page-group-twice",`${i}.groups.${d}.title`,`${e}'s page has two groups called "${s.title}"; give each its own title`)),r.add(l),s.fields.forEach((y,o)=>c(y,`${i}.groups.${d}.fields.${o}`))}),p}var fn=new Set(["subject","now","today","me"]);function un(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>fe)return{findings:[u("too-large","",`a document may be at most ${fe/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(a){return{findings:[u("not-json","",`this is not JSON: ${a.message}`)]}}try{e=Ie(e).document}catch(a){return{findings:[u("format","formatVersion",a.message)]}}let t=qe.safeParse(e);if(!t.success)return{findings:t.error.issues.map(a=>{let p=a.path.map(String).join(".");if(a.code==="unrecognized_keys")return u("unknown-key",p,`${a.keys.map(f=>`"${f}"`).join(", ")} ${a.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(a.code==="invalid_union"&&/\.effects\.\d+$/.test(p))return u("effect-shape",p,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(a.code==="invalid_key"){let f=a.issues?.[0]?.message;return u("shape",p,`the name "${String(a.path.at(-1))}" is not allowed here${f?`: ${f}`:""}`)}return u("shape",p,a.message)})};let i=t.data;return{document:i,findings:mn(i)}}var re=e=>[e??[]].flat();function Be(e){let t=new Map;for(let[i,a]of Object.entries(e.kinds))for(let[p,f]of Object.entries(a.edges??{})){let m=t.get(p);t.set(p,{name:p,from:[...m?.from??[],i],to:f.to==="*"||m?.to==="*"?"*":[...new Set([...m?.to??[],...f.to])],cardinality:f.cardinality??"many"})}return t}function qn(e){let t=new Map;for(let[a,p]of Object.entries(e.kinds)){let f=X(p);t.set(a,{fields:new Set(Object.keys(p.fields)),edges:new Map(Object.entries(p.edges??{}).map(([m,c])=>[m,c.cardinality??"many"])),...f?{computed:f}:{}})}let i=X(e);return i&&t.set(Se,{computed:i}),t}function Ue(e,t){let i=[],a=re(e.on),p=(f,m)=>{let c=Ne(t.kinds,f,a)?.reversed===!0,[r,s]=c?["$to","$subject"]:["$subject","$to"];return m==="connect"?{connect:f,from:r,to:s}:{sever:f,from:r,to:s}};if(e.creates){let f=t.kinds[e.creates],m={};for(let c of Object.keys(f?.fields??{}))m[c]=`$${c}`;for(let c of e.effects??[])"set"in c&&!("create"in c)&&v(c.target)==="new"&&Object.assign(m,c.set);i.push({create:e.creates,as:"new",set:m})}return e.sets&&i.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&i.push({set:Object.fromEntries(e.writes.map(f=>[f,`$${f}`]))}),e.connects&&(e.replaces&&i.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),i.push(p(e.connects,"connect"))),e.severs&&i.push(p(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&i.push({set:e.setsOther,target:"$to"}),e.removes&&i.push({remove:"$subject"}),e.effects&&i.push(...e.effects.filter(f=>!(e.creates&&"set"in f&&!("create"in f)&&v(f.target)==="new"))),i}function me(e,t,i){try{let a=L(e),p=ne(a);for(let f of p.unknownFunctions)i.push(u("unknown-function",t,`"${f}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return a}catch(a){if(a instanceof te){i.push(u("expression",t,a.sentence+` (at character ${a.at+1})`));return}throw a}}function ge(e,t,i){try{return W(e)}catch(a){if(a instanceof Ae||a instanceof te){i.push(u("template",t,(a instanceof te,a.sentence)));return}throw a}}function mn(e){let t=[],i=new Set(Object.keys(e.kinds)),a=Be(e),p=e.acts??{},f=new Set(e.roles??[]);for(let[c,r]of Object.entries(e.kinds)){let s=`kinds.${c}`;for(let[l,y]of Object.entries(r.edges??{})){if(y.to!=="*")for(let o of y.to)i.has(o)||t.push(u("edge-target",`${s}.edges.${l}.to`,`"${o}" is not a kind this document declares`));r.fields[l]&&t.push(u("edge-field-clash",`${s}.edges.${l}`,`"${l}" is both a field and a relation of ${c}`,"rename one of them"))}r.lifecycle&&!r.fields[r.lifecycle.field]&&t.push(u("lifecycle-field",`${s}.lifecycle.field`,`${c} has no field "${r.lifecycle.field}"`));let d=l=>r.computed!==void 0&&Object.hasOwn(r.computed,l);for(let l of r.glance??[])!r.fields[l]&&!d(l)&&t.push(u("glance-field",`${s}.glance`,`a glance at ${c} is to say "${l}", and ${c} has no field or computed field called that`,`use one of: ${[...Object.keys(r.fields),...Object.keys(r.computed??{})].join(", ")}`));t.push(...Ve(c,r));for(let l of["label","describe"]){let y=r[l];if(!y)continue;let o=ge(y,`${s}.${l}`,t);for(let z of o??[])if(z.expr){for(let $ of ne(z.expr).names)if(!r.fields[$]){if(d($)){Te(r,$)||t.push(u("template-field",`${s}.${l}`,`${c}'s ${$} is worked out from beyond the record, and a ${l} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${c}'s own fields`));continue}t.push(u("template-field",`${s}.${l}`,`${c} has no field "${$}" for its ${l} to show`,l==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[l,y]of Object.entries(r.fields))y.default!==void 0&&y.type==="enum"&&!y.options?.includes(String(y.default))&&t.push(u("default-option",`${s}.fields.${l}.default`,`"${String(y.default)}" is not one of ${l}'s options`))}for(let[c,r]of Object.entries(p)){let s=`acts.${c}`;for(let o of re(r.on))i.has(o)||t.push(u("act-kind",`${s}.on`,`"${o}" is not a kind this document declares`));let d=re(r.on),l=Ue(r,e);if(r.creates&&r.on===void 0&&r.writes&&i.has(r.creates))for(let o of r.writes)e.kinds[r.creates].fields[o]||(e.kinds[r.creates].computed?.[o]!==void 0?t.push(u("computed-written",`${s}.writes`,`${r.creates}'s ${o} is worked out, not written: no act can set it`,"write the stored fields it is worked out from")):t.push(u("act-field",`${s}.writes`,`${r.creates} has no field "${o}"`)));l.length===0&&t.push(u("act-empty",s,`"${c}" does nothing`,"give it effects or a shorthand such as sets or creates"));let y=new Map;l.forEach((o,z)=>{let $=l.length-(r.effects?.length??0),j=r.effects&&z>=$?`${s}.effects.${z-$}`:s;if("create"in o){if(!i.has(o.create))t.push(u("act-kind",`${j}.create`,`"${o.create}" is not a kind this document declares`));else for(let h of Object.keys(o.set??{}))e.kinds[o.create].fields[h]||(e.kinds[o.create].computed?.[h]!==void 0?t.push(u("computed-written",`${j}.set.${h}`,`${o.create}'s ${h} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):t.push(u("act-field",`${j}.set.${h}`,`${o.create} has no field "${h}"`)));o.as&&y.set(o.as,o.create)}else if("connect"in o||"sever"in o){let h="connect"in o?o.connect:o.sever;a.has(h)||t.push(u("act-edge",`${j}.${"connect"in o?"connect":"sever"}`,`"${h}" is not a relation any kind declares`)),v(o.from)==="subject"&&d.length===0&&t.push(u("act-subject",`${s}.on`,`"${c}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in o){let h=v(o.target??"$subject"),M=h==="subject"?d:y.has(h??"")?[y.get(h)]:[];h==="subject"&&d.length===0&&t.push(u("act-subject",`${s}.on`,`"${c}" changes "$subject" but does not say which kinds it is "on"`));for(let K of Object.keys(o.set))for(let N of M)!i.has(N)||e.kinds[N].fields[K]||(e.kinds[N].computed?.[K]!==void 0?t.push(u("computed-written",`${j}.set.${K}`,`${N}'s ${K} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):t.push(u("act-field",`${j}.set.${K}`,`${N} has no field "${K}"`)))}else"remove"in o&&v(o.remove)==="subject"&&d.length===0&&t.push(u("act-subject",`${s}.on`,`"${c}" removes "$subject" but does not say which kinds it is "on"`));("set"in o&&o.set?Object.values(o.set):[]).forEach(h=>{h&&typeof h=="object"&&!Array.isArray(h)&&"expr"in h&&me(h.expr,`${j}.set`,t)})}),r.allowedWhen&&me(r.allowedWhen,`${s}.allowedWhen`,t),r.refusal&&ge(r.refusal,`${s}.refusal`,t)}for(let[c,r]of Object.entries(e.rules??{})){let s=`rules.${c}`;r.over!=="graph"&&!i.has(r.over)&&t.push(u("rule-kind",`${s}.over`,`"${r.over}" is not a kind this document declares`));let d=r.over==="graph"?void 0:e.kinds[r.over];for(let l of["when","require"]){let y=r[l];if(!y)continue;let o=me(y,`${s}.${l}`,t);if(!o)continue;let z=ne(o);for(let $ of z.names)if(r.over==="graph")t.push(u("rule-name",`${s}.${l}`,`"${$}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(d&&!d.fields[$]&&!d.edges?.[$]&&d.computed?.[$]===void 0){let j=Object.keys(d.edges??{}).find(E=>E.includes("-")&&E.split("-").includes($));t.push(u("rule-name",`${s}.${l}`,`${r.over} has no field or relation called "${$}"`,j?`"${j}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${j.replace(/-([a-z0-9])/g,(E,h)=>h.toUpperCase())}"`:void 0))}for(let $ of z.edges)a.has($)||t.push(u("rule-edge",`${s}.${l}`,`"${$}" is not a relation any kind declares`));for(let $ of z.sweeps)i.has($)?r.over!=="graph"&&t.push(ve("rule-cost",`${s}.${l}`,`this rule looks at every ${$} for every ${r.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):t.push(u("rule-kind",`${s}.${l}`,`"${$}" is not a kind this document declares`))}r.says&&ge(r.says,`${s}.says`,t),(r.repairs??[]).forEach((l,y)=>{!p[l.act]&&!/^(edit|remove)-/.test(l.act)&&t.push(u("repair-act",`${s}.repairs.${y}.act`,`"${l.act}" is not an act this document declares`))})}let m=e.policy;return m&&(m.grants.forEach((c,r)=>{if(c.roles!=="*"&&f.size>0)for(let s of c.roles)f.has(s)||t.push(u("grant-role",`policy.grants.${r}.roles`,`"${s}" is not one of the document's roles`));if(c.mutations!=="*")for(let s of c.mutations)!p[s]&&!/^(edit|remove)-/.test(s)&&t.push(u("grant-act",`policy.grants.${r}.mutations`,`"${s}" is not an act this document declares`))}),(m.sees??[]).forEach((c,r)=>{for(let s of c.kinds)i.has(s)||t.push(u("sight-kind",`policy.sees.${r}.kinds`,`"${s}" is not a kind this document declares`));if(c.roles!=="*"&&f.size>0)for(let s of c.roles)f.has(s)||t.push(u("sight-role",`policy.sees.${r}.roles`,`"${s}" is not one of the document's roles`))})),t.push(...Me(e)),t}function gn(e,t,i,a){let p=new Map,f=re(e.on),m=new Map,c=new Map;(f.length>0||t.some(o=>"remove"in o&&v(o.remove)==="subject"||"from"in o&&(v(o.from)==="subject"||v(o.to)==="subject")||"set"in o&&!("create"in o)&&v(o.target??"$subject")==="subject"))&&p.set(ce,{ref:f.length>0?f:"*",required:!0});let s=e.args??{},d=e.writes?.length===1,l=(o,z)=>z&&o.type===z.type&&o.min===void 0&&o.max===void 0&&o.step===void 0?{...o,...z.min===void 0?{}:{min:z.min},...z.max===void 0?{}:{max:z.max},...z.step===void 0?{}:{step:z.step}}:o,y=(o,z,$)=>{if(o===ce||fn.has(o)||m.has(o)||p.has(o))return;let j=s[o]?l(s[o],$):void 0;p.set(o,j?{field:j,optional:!j.required,required:!!j.required}:z())};for(let o of t)if("create"in o){let z=i.kinds[o.create];for(let[$,j]of Object.entries(o.set??{})){let E=v(j),h=z?.fields[$];if(E&&h){let M=!!h.required&&h.default===void 0;y(E,()=>({field:h,optional:!M,required:M}),h)}}o.as&&m.set(o.as,o.create)}else if("connect"in o||"sever"in o){let z=a.get("connect"in o?o.connect:o.sever);for(let[$,j]of[["from",o.from],["to",o.to]]){let E=v(j);if(!E)continue;let h=$==="to"?z?.to??"*":z?.from??"*";h!=="*"&&!c.has(E)&&c.set(E,h),y(E,()=>({ref:h,required:!0}))}}else if("set"in o){let z=v(o.target??"$subject"),$=z==="subject"?f[0]:m.get(z??"")??c.get(z??"")?.[0];z&&z!=="subject"&&!m.has(z)&&y(z,()=>({ref:"*",required:!0}));for(let[j,E]of Object.entries(o.set)){let h=v(E);if(!h)continue;let M=$?i.kinds[$]?.fields[j]:void 0;y(h,()=>M?{field:M,optional:!d,required:d}:{any:!0,required:!1},M)}}else if("remove"in o){let z=v(o.remove);z&&y(z,()=>({ref:"*",required:!0}))}for(let[o,z]of Object.entries(s))p.has(o)||p.set(o,{field:z,optional:!z.required,required:!!z.required});return p}function In(e,t={}){let i=un(e);if(!i.document||ae(i.findings))return{ok:!1,findings:i.findings};let a=i.document,p=[...i.findings];t.previous&&p.push(...hn(a,t.previous));let f=zn(a,p);return ae(f.findings)?{ok:!1,findings:f.findings}:Fe(f,t)}function zn(e,t){let i=Be(e),a={};for(let[s,d]of Object.entries(e.kinds)){let l=Ee(d),y=d.label??(l?`{${l}}`:void 0),o=X(d);a[s]={...y?{label:W(y)}:{},...d.describe?{describe:W(d.describe)}:{},...o?{computed:[...o]}:{}}}let p={};for(let[s,d]of Object.entries(e.acts??{})){let l=Ue(d,e),y=gn(d,l,e,i),o=d.destructive??l.some(g=>"remove"in g||"sever"in g||"replace"in g),z=[...new Set(l.flatMap(g=>"create"in g?[g.create]:[]))],$=[...new Set(l.flatMap(g=>"connect"in g?[g.connect]:[]))],j=[...new Set(l.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],E=[...new Set(l.flatMap(g=>"set"in g&&!("create"in g)&&v(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],h=new Map;for(let g of l){if(!("connect"in g)&&!("sever"in g))continue;let S=i.get("connect"in g?g.connect:g.sever);for(let[D,Le]of[["from",g.from],["to",g.to]]){let Q=v(Le),ie=D==="to"?S?.to:S?.from;Q&&Q!=="subject"&&ie&&ie!=="*"&&h.set(Q,[...new Set([...h.get(Q)??[],...ie])])}}let M={};for(let g of l){if(!("set"in g)||"create"in g)continue;let S=v(g.target??"$subject");for(let D of S&&S!=="subject"&&h.get(S)||[])M[D]=[...new Set([...M[D]??[],...Object.keys(g.set)])]}let K={};for(let g of l)if(!(!("set"in g)||"create"in g||v(g.target??"$subject")!=="subject"))for(let[S,D]of Object.entries(g.set??{}))typeof D=="string"&&v(D)===void 0||typeof D=="number"||typeof D=="boolean"?K[S]=typeof D=="string"&&D.startsWith("$$")?D.slice(1):D:delete K[S];let N=z.length===0&&l.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(S=>!(S&&typeof S=="object"&&!Array.isArray(S)&&"expr"in S))),ze=new Map;for(let g of l)if(!(!("set"in g)||!g.set))for(let S of Object.values(g.set))S&&typeof S=="object"&&!Array.isArray(S)&&"expr"in S&&ze.set(S.expr,L(S.expr));p[s]={title:d.title??s.replace(/-/g," "),effects:l,args:[...y],...d.allowedWhen?{guard:L(d.allowedWhen)}:{},...d.refusal?{refusal:W(d.refusal)}:{},exprs:[...ze],destructive:o,idempotent:N,creates:z,connects:$,severs:j,writes:E,writesOther:M,sets:K}}let f={};for(let[s,d]of Object.entries(e.rules??{}))f[s]={title:d.title??s.replace(/-/g," "),require:L(d.require),...d.when?{when:L(d.when)}:{},...d.says?{says:W(d.says)}:{}};let m=Oe(e,t),c=Re(e),r=De(e);return{format:xe,document:e,findings:t,kinds:a,...e.computed?{facts:[...X(e)??[]]}:{},edges:[...i].map(([s,{from:d,to:l,cardinality:y}])=>[s,{from:d,to:l,cardinality:y}]),acts:p,rules:f,brand:m,...Object.keys(c).length>0?{viewSpecs:c}:{},...r?{home:r}:{}}}function Nn(e,t){let i=e.split(/[\s:·]/).find(a=>a.length>0)??e;return t.kinds[i]?`kinds.${i}`:t.acts?.[i]?`acts.${i}`:t.rules?.[i]?`rules.${i}`:e}function Vn(e,t,i){let a=/^defineNode\("([^"]+)"\)/.exec(t)?.[1],p=a?i.kinds[a]:void 0;if(!a||!p)return e;let f=Object.keys(p.fields).filter(m=>m!=="label").slice(0,3);return{...e,path:`kinds.${a}.glance`,fix:`Say which: "glance": [${f.map(m=>`"${m}"`).join(", ")}] on kinds.${a} \u2014 the facts a person compares one by, at a glance.`}}function hn(e,t){let i=[],a=new Set(Object.values(t.kinds).flatMap(p=>Object.keys(p.edges??{})));for(let[p,f]of Object.entries(e.kinds)){let m=f.renamedFrom;m&&!t.kinds[m]&&i.push(u("renamed-from-nothing",`kinds.${p}.renamedFrom`,`${p} says it was ${m}, and the previous version has no kind called ${m}`,"name the kind it was, or drop renamedFrom"));let c=t.kinds[m??p];for(let[r,s]of Object.entries(f.fields)){let d=s.renamedFrom;d&&!c?.fields[d]&&i.push(u("renamed-from-nothing",`kinds.${p}.fields.${r}.renamedFrom`,`${r} says it was ${d}, and the previous ${m??p} has no field called ${d}`,"name the field it was, or drop renamedFrom"))}for(let[r,s]of Object.entries(f.edges??{})){let d=s.renamedFrom;d&&!a.has(d)&&i.push(u("renamed-from-nothing",`kinds.${p}.edges.${r}.renamedFrom`,`${r} says it was ${d}, and the previous version has no relation called ${d}`,"name the relation it was, or drop renamedFrom"))}}return i}export{We as ActRefusal,In as compileDocumentWithoutCheck,Ue as effectsOf,Nn as frameworkPath,Vn as inDocumentWords,qn as kindShapes,un as readDocument};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Aa as p,B as s,Ba as w,L as k,ya as x}from"./chunk.MKNXV4TM.js";var j=e=>e.safeParse?.(void 0).success??!1,O=e=>p(e).shape,m=e=>{let r=p(e);if(s(r)?.type!=="literal")return;let o=s(r)?.values;return o&&o.length===1&&typeof o[0]=="string"?o[0]:void 0};function u(e,r){let o=j(r),n=p(r),i=s(n)?.type,g=x(r);if(g)return{control:"node",name:e,optional:o,kinds:g};if(i==="boolean")return{control:"boolean",name:e,optional:o};let b=k(n);if(b)return{control:"file",name:e,optional:o,...b==="image"?{image:!0}:{}};if(i==="object"){let a=n.shape??{};return{control:"group",name:e,optional:o,fields:Object.entries(a).map(([d,c])=>u(d,c))}}if(i==="union"){let a=s(n)?.options??[],d=a.map(l=>O(l));if(d.every(l=>l!==void 0)){let l=Object.keys(d[0]??{}).find(F=>d.every(f=>m(f?.[F])!==void 0));if(l)return{control:"variant",name:e,optional:o,tag:l,options:a.map((F,f)=>({value:m(d[f]?.[l])??"",fields:Object.entries(d[f]??{}).filter(([y])=>y!==l).map(([y,v])=>u(y,v))}))}}let c=a.map(l=>m(l));return c.every(l=>l!==void 0)?{control:"choice",name:e,optional:o,options:c}:{control:"opaque",name:e,optional:o}}if(i==="array"){let a=s(n)?.element;return a!==void 0?{control:"list",name:e,optional:o,item:u(e,a)}:{control:"opaque",name:e,optional:o}}let t=w(r);return t.type==="text"?{control:"text",name:e,optional:o,...t.long?{long:!0}:{}}:t.type==="date"?{control:"date",name:e,optional:o,...t.time?{time:!0}:{}}:t.type==="number"?{control:"number",name:e,optional:o,...t.min===void 0?{}:{min:t.min},...t.max===void 0?{}:{max:t.max},...t.step===void 0?{}:{step:t.step}}:t.type==="choice"?{control:"choice",name:e,optional:o,options:t.options}:{control:"opaque",name:e,optional:o}}function R(e){let r=e.shape;return r?Object.entries(r).map(([o,n])=>u(o,n)):[]}function h(e,r){let o={...r};for(let n of e){let i=r[n.name];i===void 0&&!n.optional&&(n.control==="list"||n.control==="boolean")&&(o[n.name]=n.control==="list"?[]:!1),n.control==="group"&&i!==void 0&&typeof i=="object"&&i!==null&&(o[n.name]=h(n.fields,i))}return o}export{R as a,h as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as m}from"./chunk.
|
|
1
|
+
import{b as m}from"./chunk.RZLNDVGN.js";import"./chunk.4TUNX4WM.js";import"./chunk.7S22MBNN.js";import"./chunk.ONDILMIX.js";import{f as g}from"./chunk.J6CBMLGR.js";import"./chunk.TBG2QBOS.js";import"./chunk.BCBH6WJF.js";import"./chunk.A73BXXE4.js";import"./chunk.N7HCALRK.js";import"./chunk.IKT7JQUW.js";import"./chunk.ISRS7GOT.js";import"./chunk.DCIC3YHX.js";import"./chunk.WHTNSETN.js";import"./chunk.WVUJXDXZ.js";import"./chunk.46KUPBQC.js";import"./chunk.N2WTNKEV.js";import"./chunk.SBHVVJY7.js";import"./chunk.GE5EAN36.js";import"./chunk.337WDTG3.js";import"./chunk.PWHJHFC4.js";import"./chunk.EYF6ONTA.js";import"./chunk.Q3HVA6L4.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.2GBQJXJH.js";import"./chunk.ZJDRD6PO.js";import"./chunk.SNBIZ3B6.js";import"./chunk.6LJ66MB7.js";import"./chunk.NRRUGG22.js";import{ua as n}from"./chunk.MKNXV4TM.js";import{a as b,b as l}from"./chunk.MRK6QJV5.js";import{b as t}from"./chunk.AJZBJBMO.js";var y=t(b(),1),a=t(l(),1);function P({store:h,auto:c,brand:r,views:f,presence:i,steering:o,overview:s,scope:d,titleLevel:v=2,props:e}){let u=(0,y.useMemo)(()=>g({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:c?{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:u}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(m,{context:{store:h,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...s?{overview:s}:{},titleLevel:v,views:f,settings:e.app.settings??[],...i?{presence:i}:{},...r?{brand:r}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}},...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{P as PagesContent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as _e,c as ae,d as We,e as ne,g as he,h as He,m as Je,o as te}from"./chunk.337WDTG3.js";import{A as Me,Ab as Be,Bb as Ze,D as me,E as Pe,M as ge,N as Te,T as Ne,_ as Fe,a as Oe,b as Re,c as xe,d as ee,ea as Ce,eb as Le,f as pe,fa as Ve,h as B,i as Ae,ia as ye,j as je,ja as Ie,k as se,l as Se,m as Ee,o as ze,p as De,q as fe,qb as qe,sa as Z,v as Ge,x as ue,xa as Ke,y as $e}from"./chunk.MKNXV4TM.js";function un(n,l){let e=n.brand??{},o=e.accent?Ze(e.accent):void 0;o&&!o.ok&&l.push(He("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${o.why}`,"pick a color further from orange-red, or a darker one"));let g=typeof e.logo=="string"?{src:e.logo}:e.logo,c=e.name??n.name,O=e.typography?Object.fromEntries(Object.entries(e.typography).filter(([,A])=>typeof A=="string"&&!/url\(|@import|[;{}<>\\]/i.test(A)).map(([A,N])=>[A,Be(N)])):void 0;return{name:c,schemes:o?.ok?o.schemes:qe,...e.currency?{currency:e.currency}:{},...e.locale?{locale:e.locale}:{},...g?{logo:g.src,logoAlt:g.alt??c}:{},...e.favicon?{favicon:e.favicon}:{},...n.description?{subtitle:n.description}:{},...O?{typography:O}:{},...e.shape?{shape:e.shape}:{},...e.accents?{accents:e.accents}:{},...e.scheme?{scheme:e.scheme}:{}}}function Ue(n){let{currency:l,locale:e}=n.brand??{};return{...l?{currency:l}:{},...e?{locale:e}:{}}}var tn=new WeakMap;function Ye(n,l){tn.set(n,l)}var rn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],T=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function Qe(n,l=rn){if(!T(n))return{document:n,respelled:[]};let e=[],o=n;for(let g of l)o=we(o,g.where.split("."),g,"",e);return{document:o,respelled:e}}function we(n,l,e,o,g){if(l.length===0){if(!T(n)||!Object.hasOwn(n,e.was))return n;g.push(`${o}${e.was}`);let{[e.was]:V,...$}=n;return Object.hasOwn(n,e.now)?$:{...$,[e.now]:V}}if(!T(n))return n;let[c,...O]=l,A=c.endsWith("[]"),N=A?c.slice(0,-2):c,z=n[N],D=z;if(!A)D=we(z,O,e,`${o}${N}.`,g);else if(Array.isArray(z)){let V=z.map(($,W)=>we($,O,e,`${o}${N}.${W}.`,g));D=V.some(($,W)=>$!==z[W])?V:z}return D===z?n:{...n,[N]:D}}var Xe="graview-compiled@1",_="id",de=n=>typeof n=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(n)?n.slice(1):void 0;function on(n){let l=Object.entries(n.fields);return l.find(([,e])=>e.required&&(e.type==="string"||e.type==="text"))?.[0]??l.find(([,e])=>e.type==="string")?.[0]}function en(n,l){let e;switch(n.type){case"string":e=B().check(ee(500));break;case"text":e=B().check(ee(2e4));break;case"number":case"integer":{let o=[...n.type==="integer"?[Se()]:[],...n.min===void 0?[]:[Re(n.min)],...n.max===void 0?[]:[Oe(n.max)],...n.step===void 0?[]:[xe(n.step)]];e=o.length>0?se().check(...o):se();break}case"boolean":e=Ee();break;case"date":e=B().check(pe(me,"a date like 2026-10-02"));break;case"datetime":e=B().check($e(o=>!Number.isNaN(Date.parse(o)),"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":e=Ge(n.options);break;case"list":e=De(n.of==="number"?se():n.of==="date"?B().check(pe(me)):n.of==="image"||n.of==="file"?ge(n.of):B().check(ee(500))).check(ee(200));break;case"image":case"file":e=ge(n.type);break;case"url":e=je();break;case"email":e=Ae();break}return n.description&&(e=e.check(Me(n.description))),l?ue(e):e}var re=n=>{throw new Z(`there is no record "${n}"`,"invalid")},sn=n=>"field"in n?en(n.field,n.optional):"ref"in n?Ke(n.ref):ue(ze()),an=new WeakMap;var ke=(n,l)=>T(l)&&Object.keys(n??{}).length===Object.keys(l).length&&Object.keys(n??{}).every(e=>Object.hasOwn(l,e));function zn(n,l={}){let e=T(n)?n.format:void 0;if(e!==Xe)return{ok:!1,findings:[he("compiled-format","format",e===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(e)}, and this build reads ${Xe}`,"compile the document instead")]};let o=n,g=Qe(o.document).document,c=g===o.document?o:{...o,document:g},O=T(g)&&typeof g.name=="string"&&T(g.kinds)&&ke(g.kinds,c.kinds)&&ke(g.acts,c.acts)&&ke(g.rules,c.rules)&&Array.isArray(c.edges)&&Array.isArray(c.findings),A={ok:!1,findings:[he("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!O)return A;try{return dn(c,l)}catch{return A}}function dn(n,l={}){let{document:e}=n,o=l.today??Pe,g=new Map(n.edges.map(([u,t])=>[u,t])),c=new Map;for(let[u,t]of Object.entries(e.kinds)){let R=n.kinds[u]?.computed;c.set(u,{fields:new Set(Object.keys(t.fields)),edges:new Map(Object.entries(t.edges??{}).map(([b,E])=>[b,E.cardinality??"many"])),...R?{computed:new Map(R)}:{}})}n.facts&&c.set(_e,{computed:new Map(n.facts)});let O=Ue(e),A=new Map,N=Object.entries(e.kinds).map(([u,t])=>{let R={};for(let[i,k]of Object.entries(t.fields))R[i]=en(k,!k.required);let{label:b,describe:E}=n.kinds[u]??{},F=Object.entries(t.computed??{}).map(([i,k])=>[i,typeof k=="string"?{expr:k}:k]),M=Object.fromEntries([...Object.entries(t.fields).filter(([,i])=>i.label).map(([i,k])=>[i,k.label]),...F.filter(([,i])=>i.label).map(([i,k])=>[i,k.label])]),I=Object.keys(M).length>0,C=Object.fromEntries(Object.entries(t.fields).filter(([,i])=>i.default!==void 0).map(([i,k])=>[i,k.default]));A.set(u,C);let j=Object.fromEntries(Object.entries(t.edges??{}).map(([i,{renamedFrom:k,...H}])=>[i,H])),p=i=>t[i]?{[i]:t[i]}:{};return Te(u,{fields:fe(R),edges:j,...p("plural"),...p("noun"),...p("description"),...b?{label:i=>te(b,{node:i,kinds:c,today:o(),money:O})||i.id}:{},...E?{describe:i=>te(E,{node:i,kinds:c,today:o(),money:O})}:{},...p("lifecycle"),...p("figure"),...p("fieldRoles"),...p("people"),...t.computed&&Object.keys(t.computed).length>0?{computed:t.computed}:{},...I||t.glance||t.page?{display:{...I?{labels:M}:{},...t.glance?{glance:[...t.glance]}:{},...t.page?{page:t.page}:{}}}:{},...Object.keys(C).length>0?{defaults:C}:{}})}),z=Ce(N,e.computed);function D(u){return z.tryDefinition(u.kind)?.label?.(u)??u.id}let V=u=>({id:"",kind:u,...A.get(u)}),$=[];for(let[u,t]of Object.entries(e.acts??{})){let R=n.acts[u],{title:b,effects:E,guard:F,refusal:M,destructive:I,idempotent:C,creates:j,connects:p,severs:i,writes:k,writesOther:H,sets:v}=R,J=new Map(R.args),K={};for(let[a,x]of J)K[a]=sn(x);let U=[t.on??[]].flat(),oe=new Map(R.exprs),G=E.find(a=>"create"in a),L=(a,x,y,h=null)=>{if(T(a)&&"expr"in a)return ne(oe.get(a.expr),{graph:y,subject:h,kinds:c,bindings:x,today:o()});let m=de(a);return m===void 0?typeof a=="string"&&a.startsWith("$$")?a.slice(1):a:m==="now"?new Date().toISOString():m==="today"?o():x[m]},nn=(a,x)=>{if(!G)return"";let y=e.kinds[G.create].fields,h=V(G.create),m=[];for(let[w,X]of Object.entries(G.set??{})){try{h[w]=L(X,a,x)??h[w]}catch{}let Y=de(X);Y&&a[Y]!==void 0&&m.push(w)}let P=D(h).trim(),q=m.filter(w=>h[w]!==!1&&y[w].type!=="text"&&!(/[^]{41}/.test(h[w])||/ .*[.!?]$/.test(h[w])&&!/[ .][A-Z]\w{0,3}\.$/.test(h[w]))&&D({...h,[w]:void 0}).trim()===P).map(w=>h[w]===!0?y[w].label??Ne(w):Je(h[w],y[w].format,o(),[],O));return P&&q.length>0?`${P} (${q.join(", ")})`:P};$.push(Le(u,{input:fe(K),title:b,...t.description?{description:t.description}:{},...t.fromTheOtherEnd?{fromTheOtherEnd:t.fromTheOtherEnd}:{},...J.has(_)?{subject:{kinds:U.length>0?U:"*",arg:_}}:{},...I?{destructive:!0}:{},...C?{idempotent:!0}:{},...j.length>0?{creates:j}:{},...p.length>0?{connects:p}:{},...i.length>0?{severs:i}:{},writes:k,...Object.keys(H).length>0?{writesOther:H}:{},...Object.keys(v).length>0?{sets:v}:{},describe:(a,x)=>{let y=typeof a[_]=="string"?x.getNode(a[_]):void 0,h=y?D(y):nn(a,x);return h?`${b}: ${h}`:b},apply(a,x){let y=a.graph,h=typeof x[_]=="string"?x[_]:void 0,m=h?y.getNode(h):void 0;if(h&&!m&&re(h),m&&U.length>0&&!U.includes(m.kind))throw new Z(`"${b}" acts on ${U.join(" or ")}, not on ${Fe(m.kind)}`,"invalid");let P={};for(let[r,s]of Object.entries(x))s!==void 0&&(P[r]=s);if(F&&m){let r;try{r=ne(F,{graph:y,subject:m,kinds:c,bindings:P,today:o()})}catch(s){throw s instanceof ae?new Z(`"${b}" could not be judged: ${s.sentence}`):s}if(r!==!0)throw new Z(M?te(M,{node:m,kinds:c,graph:y,bindings:P,today:o(),money:O}):`"${b}" is not allowed for ${D(m)} right now`)}let q=new Map,w=r=>y.has(r)||[...q.values()].includes(r),X=new Set,Y=r=>{let s=Ve(r);X.has(s)||(X.add(s),a.removeEdge(r))},Q=(r,s)=>{let d=de(r);if(d==="subject")return h;if(d==="me"){let f=a.me;if(f&&e.kinds[y.getNode(f)?.kind]?.people)return f;throw new Z(`"${b}" is done as you, and you have no record here`)}if(q.has(d))return q.get(d);try{return L(r,P,y,s??m??null)}catch(f){throw f instanceof ae?new Z(`"${b}" could not work out a value: ${f.sentence}`):f}};for(let r of E)if("create"in r){let s=e.kinds[r.create],d=V(r.create);for(let[le,ie]of Object.entries(r.set??{})){let ve=Q(ie,void 0);ve!==void 0&&(d[le]=ve)}let f=on(s),S=a.freshId(String((f&&d[f])??r.create),r.create);a.addNode({...d,id:S}),r.as&&q.set(r.as,S)}else if("connect"in r||"sever"in r){let s="connect"in r?r.connect:r.sever,d=String(Q(r.from,void 0)??""),f=String(Q(r.to,void 0)??"");if(w(d)||re(d),w(f)||re(f),"connect"in r){if(g.get(s)?.cardinality==="one")for(let S of y.out(d,s))S.id!==f&&Y({kind:s,from:d,to:S.id});y.out(d,s).some(S=>S.id===f)||a.addEdge({kind:s,from:d,to:f})}else Y({kind:s,from:d,to:f})}else if("set"in r){let s=String(Q(r.target??"$subject",void 0)??""),d=y.getNode(s);!d&&!w(s)&&re(s);let f={};for(let[S,le]of Object.entries(r.set)){let ie=Q(le,d);ie!==void 0&&(f[S]=ie)}Object.keys(f).length>0&&a.patchNode(s,f)}else if("remove"in r){let s=String(Q(r.remove,void 0)??"");y.has(s)||re(s),a.removeNode(s)}else if("replace"in r&&m){let s=x.to;for(let d of r.replace){let f=g.get(d)?.from.includes(m.kind)??!0;for(let S of f?y.out(m.id,d):y.in(m.id,d))d===r.keep&&S.id===s||Y(f?{kind:d,from:m.id,to:S.id}:{kind:d,from:S.id,to:m.id})}}}}))}let W=[];for(let[u,t]of Object.entries(e.rules??{})){let{title:R,require:b,when:E,says:F}=n.rules[u],M=t.repairs??[],I=(j,p)=>{let i={graph:j,subject:p,kinds:c,today:o()},k;try{if(E&&ne(E,i)!==!0)return[];k=ne(b,i)===!0}catch(v){throw v instanceof We?new Ie(v.sentence):v instanceof ae?new Error(v.sentence):v}if(k)return[];let H=M.flatMap(v=>{let J=e.acts?.[v.act],K={};p&&(J?.on||/^(edit|remove)-/.test(v.act))&&(K[_]=p.id);for(let[G,L]of Object.entries(v.args??{}))K[G]=de(L)==="subject"?p?.id:L;let oe=(J?n.acts[v.act].args:[]).filter(([G,L])=>L.required&&K[G]===void 0).map(([G])=>G);return[{mutation:v.act,label:v.label??J?.title??v.act.replace(/-/g," "),args:K,...oe.length>0?{missing:oe}:{}}]});return[{invariant:u,...p?{subjectId:p.id}:{},label:R,message:F?te(F,{node:p,kinds:c,graph:j,today:o(),money:O}):p?`${D(p)}: ${R}`:R,nodeIds:p?[p.id]:[],repairs:H}]},C={label:R,shape:{over:t.over,require:b,when:E,says:F,declared:e.kinds,money:O,kinds:c,today:o},judgment:{require:t.require,...t.when?{when:t.when}:{},...t.says?{says:t.says}:{}},...t.description?{description:t.description}:{},...M.length>0?{repairs:M.map(j=>j.act)}:{}};W.push(t.over==="graph"?ye(u,{scope:"graph",...C,evaluate:({graph:j})=>I(j,null)}):ye(u,{scope:{kind:t.over},...C,evaluate:({graph:j,subject:p})=>I(j,p)}))}let be=e.policy&&{...e.policy,...e.roles?{roles:e.roles}:{}},ce={name:e.name,schema:z,mutations:$,invariants:W,...be?{policy:be}:{},...n.brand?{brand:n.brand}:{},...e.modules?{modules:e.modules}:{},...e.lenses?{lenses:e.lenses}:{},...e.pages?{pages:e.pages}:{},...e.settings?{settings:e.settings}:{},...n.viewSpecs?{viewSpecs:n.viewSpecs}:{},...n.home?{home:n.home}:{},version:e.version??1};return Ye(ce,e),an.set(ce,n),{ok:!0,app:ce,document:e,findings:n.findings,sights:e.policy?.sees,kinds:c}}export{Qe as a,un as b,Xe as c,_ as d,de as e,on as f,zn as g,dn as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i}from"./chunk.HOPIZMJR.js";import"./chunk.46KUPBQC.js";import"./chunk.N2WTNKEV.js";import"./chunk.SBHVVJY7.js";import"./chunk.GE5EAN36.js";import"./chunk.337WDTG3.js";import"./chunk.MKNXV4TM.js";import"./chunk.AJZBJBMO.js";export{f as columnActs,c as columnMoves,b as columnOf,d as columnReach,e as columnSteps,h as describePlace,i as placeText,g as resolveFor,a as statusColumns};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g}from"./chunk.6LJ66MB7.js";import{za as w}from"./chunk.
|
|
1
|
+
import{a as g}from"./chunk.6LJ66MB7.js";import{za as w}from"./chunk.NRRUGG22.js";import{Tb as L}from"./chunk.MKNXV4TM.js";import{a as C,b as V}from"./chunk.MRK6QJV5.js";import{b as u}from"./chunk.AJZBJBMO.js";var E="[data-graview-foot]",N="graview:foot-moved";var D=()=>({width:document.documentElement.clientWidth||innerWidth,height:innerHeight});function z(t,e){let o=D(),r=e?.getBoundingClientRect()??{left:0,top:0,right:o.width,bottom:o.height},i=Math.max(0,r.left),c=Math.min(o.width,r.right),s=Math.max(0,r.top),l=Math.min(o.height,r.bottom),m=Math.max(0,c-i),x=m<640;t.style.translate="none",t.style.top="auto",t.style.right="auto",t.style.maxWidth=`${Math.max(0,Math.min(560,m-2*16))}px`;let p=t.getBoundingClientRect();if(p.width===0&&p.height===0&&t.style.left!=="")return;let y=p.width,A=p.height;t.style.visibility=e&&l-s<A+16?"hidden":"";let h=x?i+(m-y)/2:i+16,f=o.height-l+16,v=[...document.querySelectorAll(E)].filter(n=>n!==t&&!t.contains(n)&&!n.contains(t)).map(n=>n.getBoundingClientRect()).filter(n=>n.width>0&&n.height>0&&n.right>i&&n.left<c&&n.bottom>s&&n.top<l),P=n=>n.bottom-n.top>(l-s)*.4;if(!x)for(let n of v)P(n)&&n.left<=h+1&&n.right+16>h&&n.right+16+y<=c&&(h=n.right+16);let R=v.filter(n=>!P(n));for(let n=!0,b=0;n&&b<R.length+1;b++){n=!1;for(let d of R){let M=o.height-f;d.right>h&&d.left<h+y&&d.bottom>M-A&&d.top<M&&(f=o.height-d.top+16/2,n=!0)}}t.style.left=`${Math.round(h)}px`,t.style.bottom=`calc(${Math.round(f)}px + env(safe-area-inset-bottom, 0px))`}function U(t,e){let o=D(),r=e?.getBoundingClientRect()??{left:0,top:0,right:o.width,bottom:o.height},i=Math.max(0,r.left),c=Math.min(o.width,r.right),s=Math.max(0,c-i);t.style.translate="none",t.style.bottom="auto",t.style.right="auto",t.style.maxWidth=`${Math.max(0,Math.min(560,s-2*16))}px`;let l=t.getBoundingClientRect().width;t.style.left=`${Math.round(i+(s-l)/2)}px`,t.style.top=`${Math.round(Math.max(16/2,r.top+16/2))}px`}var O=t=>`graview:lenses:${t}`,q=(t,e)=>t?.name??e.kinds.join(",");function k(t){try{let e=JSON.parse(localStorage.getItem(O(t))??"[]");return Array.isArray(e)?e.filter(o=>typeof o?.title=="string"&&typeof o.lens=="string"):[]}catch{return[]}}var S=u(C(),1);var a=u(V(),1),G=w(g(()=>import("./chunk.ARE3MEDN.js")));function B({lens:t,view:e}){let o=G.current.declaredLensView(t);return(0,a.jsx)(o,{...e})}var K=G.part((t,e)=>(0,a.jsx)(B,{...e}),{what:"This picture"});function $(t){return o=>(0,a.jsx)(S.Suspense,{fallback:null,children:(0,a.jsx)(K,{lens:t,view:o})})}var T=w(g(()=>import("./chunk.ASFZTYFO.js")));function W({blocks:t,view:e}){let o=T.current.homeView(t);return(0,a.jsx)(o,{...e})}var _=T.part((t,e)=>(0,a.jsx)(W,{...e}),{what:"The home"});function F(t){let e=o=>(0,a.jsx)(S.Suspense,{fallback:null,children:(0,a.jsx)(_,{blocks:t,view:o})});return Object.defineProperty(e,Symbol.for("graview.home-blocks"),{value:!0}),e}function tt(t,e){return e.home&&e.home.length>0&&t.home?.(F(e.home)),H(t,e),t.arrange?.(e.pages),t}function H(t,e,o){for(let r of L(e).drawn){if(o&&t.places().some(s=>s.title===r.title))continue;let i=$(r),c={title:r.title,...r.across?{across:r.across}:{},...o?{beside:o}:{}};for(let s of r.kinds)t.register(s,{cardinality:"many",fidelity:"full"},i,c),t.register(s,{cardinality:"many",fidelity:"summary"},i,c)}}function I(t,e,o){o.length>0&&H(t,{schema:e,lenses:o.map(({lens:r,...i})=>({...i,name:r}))},!0)}function et(t,e,o){I(t,e,k(o))}export{N as a,z as b,U as c,O as d,q as e,k as f,tt as g,I as h,et as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c,b as d,c as e,d as f,e as g,f as h,g as i}from"./chunk.
|
|
1
|
+
import{a as c,b as d,c as e,d as f,e as g,f as h,g as i}from"./chunk.2GBQJXJH.js";import{a,b}from"./chunk.ZJDRD6PO.js";import"./chunk.SNBIZ3B6.js";import"./chunk.6LJ66MB7.js";import"./chunk.NRRUGG22.js";import"./chunk.MKNXV4TM.js";import"./chunk.MRK6QJV5.js";import"./chunk.AJZBJBMO.js";export{c as ARRANGE_NARROW,h as ArrangeBar,i as arrangementCaption,a as arrangementOf,f as directionWords,e as inSentence,g as preloadArrangeLists,d as sayCondition,b as withArrangement};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p}from"./chunk.AHDOKM4O.js";import{
|
|
1
|
+
import{a as p}from"./chunk.AHDOKM4O.js";import{nb as u}from"./chunk.MKNXV4TM.js";import{b as c}from"./chunk.MRK6QJV5.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 B({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 A(e,o,n){return i(n?.figures?.[e]??o?.tryDefinition?.(e)?.figure)!==void 0}export{B as a,A as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as ae}from"./chunk.LEVR7WLB.js";import"./chunk.WVUJXDXZ.js";import{b as $,c as ne}from"./chunk.TAW67PZU.js";import"./chunk.YOMW4MKD.js";import"./chunk.DRIWJRQW.js";import"./chunk.KSEKVHJJ.js";import"./chunk.JIWB6VGT.js";import"./chunk.6R4EI47C.js";import{Y as X,da as ee,ga as te}from"./chunk.SVL6I37U.js";import{Eb as Y,G as J,H as v,I as j,X as Q}from"./chunk.P7YN4Z3K.js";import{a as we,b as Z}from"./chunk.MRK6QJV5.js";import{b as B}from"./chunk.AJZBJBMO.js";var g=B(we(),1);async function re(e,i){let r=await createImageBitmap(e);try{let l=Math.min(1,i/Math.max(r.width,r.height)),o=document.createElement("canvas");o.width=Math.max(1,Math.round(r.width*l)),o.height=Math.max(1,Math.round(r.height*l));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(r,0,0,o.width,o.height),o}finally{r.close()}}var t=B(Z(),1),ve=2048,$e=.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 O(e){if(e.type==="application/pdf")return"PDF";let i=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return i?i.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ue(e){let i=[...new Set(e.map(r=>r==="image/*"?"pictures":r==="*/*"||r==="*"?"any file":`${O({type:r})} files`))];return i.length<=1?i[0]??"no files":`${i.slice(0,-1).join(", ")} and ${i[i.length-1]}`}function ce(e,i){if(e.length===0)return!0;let r=`${i.split("/")[0]}/*`;return e.some(l=>l==="*"||l==="*/*"||l===i||l===r)}var ie=/^image\/hei[cf]$|\.hei[cf]$/i,le=e=>ie.test(e.type)||ie.test(e.name);async function Fe(e,i,r){let l=e.name||(r.camera?"photo.jpg":"file"),o=e.type||(le({type:"",name:l})?"image/heic":"application/octet-stream"),s=le({type:o,name:l}),d=o.startsWith("image/")||s;if(r.image&&!d)return{refused:`\u201C${l}\u201D isn\u2019t a picture.`};if(s||d&&/^image\/(jpeg|webp)$/.test(o)&&(r.camera||e.size>i.maxBytes||e.size>15e5))try{let a=await re(e,ve),f=await new Promise(y=>a.toBlob(y,"image/jpeg",$e));if(f)return oe({blob:f,name:s?l.replace(/\.hei[cf]$/i,"")+".jpg":l,type:"image/jpeg",width:a.width,height:a.height},i)}catch{if(s&&!ce(i.kinds,o))return{refused:`\u201C${l}\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 a=await createImageBitmap(e);c={width:a.width,height:a.height},a.close()}catch{}return oe({blob:e,name:l,type:o,...c},i)}function oe(e,i){return ce(i.kinds,e.type)?e.blob.size>i.maxBytes?{refused:`\u201C${e.name}\u201D is ${H(e.blob.size)}; this host takes files up to ${H(i.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${O(e)} file; this host takes ${ue(i.kinds)}.`}}async function ke(e,i,r){let l;try{l=await i.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 J(l)?r&&!v(l)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:{...l,...l.width===void 0&&e.width?{width:e.width}:{},...l.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)",S={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function _({file:e,size:i=56,style:r}){return(0,t.jsx)("img",{src:e.href,alt:$(e),width:i,height:i,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:i,height:i,objectFit:"cover",borderRadius:F,display:"block",flex:"none",background:"var(--graview-edge)",...r}})}function N({files:e,label:i}){let r=e.filter(v),l=e.filter(a=>!v(a)),[o,s]=(0,g.useState)(null),d=(0,g.useRef)(null),m=(0,g.useRef)(null);(0,g.useEffect)(()=>{let a=d.current;o!==null&&a&&!a.open&&a.showModal?.()},[o]);let c=o===null?void 0:r[o];return(0,t.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[r.length>0?(0,t.jsx)("ul",{"data-graview-gallery":"","aria-label":i,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:r.map((a,f)=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)("button",{type:"button","aria-label":`Open ${$(a)} full size`,onClick:y=>{m.current=y.currentTarget,s(f)},style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:F},children:(0,t.jsx)("img",{src:a.href,alt:$(a),loading:"lazy",decoding:"async",style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:F,display:"block",background:"var(--graview-edge)"}})})},a.href))}):null,l.length>0?(0,t.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:l.map(a=>(0,t.jsxs)("li",{"data-graview-document":a.type,style:{display:"grid",gap:6,minWidth:0},children:[a.type==="application/pdf"?(0,t.jsx)("object",{data:a.href,type:"application/pdf","aria-label":$(a),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:a.href,download:a.name,children:["download ",a.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:a.href,download:a.name,...a.type==="application/pdf"?{target:"_blank",rel:"noopener"}:{},children:a.name}),(0,t.jsxs)("span",{style:S,children:[O(a)," \xB7 ",H(a.bytes)]})]}),a.caption?(0,t.jsx)("span",{style:S,children:a.caption}):null]},a.href))}):null,c?(0,t.jsx)("dialog",{ref:d,"data-graview-full":c.href,"aria-label":$(c),onClose:()=>{s(null),m.current?.focus()},onClick:a=>{a.target===a.currentTarget&&a.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:$(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 ge({value:e,onChange:i,several:r,image:l,label:o,thumbs:s=!0}){let d=X(),m=(0,g.useId)(),c=(0,g.useRef)(null),a=(0,g.useRef)(null),[f,y]=(0,g.useState)(null),[k,D]=(0,g.useState)(null),[U,E]=(0,g.useState)([]),[I,L]=(0,g.useState)(!1),C=d?l?d.kinds.filter(n=>n.startsWith("image/")||n==="*"||n==="*/*"):d.kinds:[],A=d?d.kinds.length===0||C.some(n=>n.startsWith("image/")||n.startsWith("*")):!1,P=!!d&&(!l||A),G=l?r?"pictures":"a picture":r?"files":"a file",q=l?C.length>0?C.join(","):"image/*":d?.kinds.join(",")||void 0,me=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,V=(0,g.useRef)(e);V.current=e;let K=(0,g.useRef)(null),W=(0,g.useRef)(null);(0,g.useEffect)(()=>{let n=W.current;if(!n||n.from===e)return;W.current=null;let u=K.current?.children,h=u?.[Math.min(n.at,u.length-1)];((n.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(n,u)=>{if(!d||n.length===0)return;let h=r?n:n.slice(0,1),p=[],w=[];h.length<n.length&&w.push(`${o} holds one ${l?"picture":"file"}, so ${n.slice(1).map(b=>`\u201C${b.name||"the photo"}\u201D`).join(", ")} ${n.length>2?"were":"was"} left out.`),E([]),D(null);for(let b of h){y(`Sending ${b.name||"the photo"}\u2026`);let z=await Fe(b,d,{image:l,camera:u==="camera"});if("refused"in z){w.push(z.refused);continue}let x=await ke(z,d,l);"refused"in x?w.push(x.refused):[...r?V.current:[],...p].some(be=>be.href===x.href)?w.push(`\u201C${x.name}\u201D is already here.`):p.push(x)}if(y(null),E(w),p.length!==0)try{i(r?[...V.current,...p]:p.slice(-1)),D(`Added ${p.map(b=>b.name).join(", ")}.`)}catch(b){E([...w,b instanceof Error?b.message:String(b)])}},R=(n,u,h)=>{try{W.current=h?{...h,from:e}:null,i(n),D(u)}catch(p){W.current=null,E([p instanceof Error?p.message:String(p)])}},M=n=>n?Array.from(n):[],ye=n=>{let u=M(n.clipboardData?.files);!P||u.length===0||(n.preventDefault(),T(u,"pasted"))},fe=n=>{L(!1),P&&(n.preventDefault(),T(M(n.dataTransfer?.files),"dropped"))};return(0,t.jsxs)("div",{role:"group","aria-labelledby":`${m}-label`,"data-graview-file-editor":"","data-graview-dropping":I?"":void 0,onPaste:ye,onDragOver:n=>{P&&(n.preventDefault(),L(!0))},onDragLeave:()=>L(!1),onDrop:fe,style:{display:"grid",gap:8,minWidth:0,padding:I?6:0,outline:I?"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&&(r||e.length>1)?(0,t.jsx)("ul",{ref:K,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((n,u)=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[s&&v(n)?(0,t.jsx)(_,{file:n,size:40}):null,(0,t.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:n.name}),(0,t.jsx)(de,{file:n,onCaption:h=>R(e.map((p,w)=>w===u?se(p,h):p),h?`${n.name} now says \u201C${h}\u201D.`:`${n.name} says its name again.`)}),r&&u>0?(0,t.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${n.name} earlier`,onClick:()=>R(e.map((h,p)=>p===u-1?n:p===u?e[u-1]:h),`Moved ${n.name} earlier.`,{at:u-1,what:"move"}),children:"\u2191"}):null,r?(0,t.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${n.name}`,onClick:()=>R(e.filter((h,p)=>p!==u),`Removed ${n.name}.`,{at:u,what:"remove"}),children:"Remove"}):null]},`${u}:${n.href}`))}):e.length===1?(0,t.jsx)(de,{file:e[0],onCaption:n=>R([se(e[0],n)],n?`${e[0].name} now says \u201C${n}\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:r,...q?{accept:q}:{},"data-graview-file-input":"","aria-label":`Choose ${G}`,onChange:n=>{let u=M(n.currentTarget.files);n.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&&!r?`Replace ${l?"the picture":"the file"}`:`Choose ${G}`}),A?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:a,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:n=>{let u=M(n.currentTarget.files);n.currentTarget.value="",T(u,"camera")}}),me?(0,t.jsx)("button",{type:"button",disabled:f!==null,onClick:()=>a.current?.click(),children:"Take a photo"}):null]}):null,(0,t.jsxs)("span",{style:S,"data-graview-file-takes":"",children:["or drop or paste ",r?"them":"it"," here \xB7 ",d.kinds.length>0?ue(C.length>0?C:d.kinds):"any file",", up to ",H(d.maxBytes)]})]}):(0,t.jsx)("p",{style:{...S,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:{...S,margin:0,minHeight:f||k?void 0:0},"data-graview-file-status":"",children:f??k??""}),U.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:U.map((n,u)=>(0,t.jsx)("p",{style:{margin:0},children:n},u))}):null]})}var se=(e,i)=>{let{caption:r,...l}=e;return i?{...l,caption:i}:l};function de({file:e,onCaption:i}){let[r,l]=(0,g.useState)(e.caption??"");(0,g.useEffect)(()=>l(e.caption??""),[e.caption]);let o=()=>{let s=r.trim().slice(0,500);s!==(e.caption??"")&&i(s)};return(0,t.jsx)("input",{type:"text",value:r,placeholder:v(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${v(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:s=>l(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 pe({field:e,label:i,labelStyle:r,valueStyle:l,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:r,children:i}),(0,t.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...l},children:s})]})}function he(e){let{nodeId:i,field:r,label:l,files:o}=e,{fields:s,commit:d}=ae(i),m=s.find(y=>y.field===r&&y.takesValue),c=m?.shape,a=c?.type==="several"?c.of:c,f=c?.type==="several";return o.length===0&&a?.type!=="file"?null:(0,t.jsxs)(pe,{...e,children:[(0,t.jsx)(N,{files:o,label:l}),m&&a?.type==="file"?(0,t.jsx)(ge,{value:o,thumbs:!1,several:f,image:a.image===!0,label:l,onChange:y=>{let k=f?y:y[y.length-1];k!==void 0&&d(m,k)}}):null]})}function Re(e){switch(e.as){case"field":return e.read?e.files.length>0?(0,t.jsx)(pe,{...e,children:(0,t.jsx)(N,{files:e.files,label:e.label})}):null:(0,t.jsx)(he,{...e});case"unfilled":return(0,t.jsx)(Ce,{...e});case"thumb":return(0,t.jsx)(_,{...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:Y.raised}:{}},children:e.view==="thumb"?(0,t.jsx)(_,{file:e.files[0],size:72}):(0,t.jsx)(N,{files:e.files,label:e.label})}):null;case"control":{let i=(0,t.jsx)(ge,{value:j(e.value),several:e.several,image:e.image,label:e.label,onChange:r=>e.onChange(e.several?r:r[r.length-1])});return e.title===void 0?i:(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}),i]})}}}function Ce({nodeId:e,skip:i,labels:r,labelStyle:l,style:o}){let{store:s}=ee(),d=te(e),m=d?s.schema.tryDefinition(d.kind):void 0,c=ne(m).filter(a=>!i.includes(a)&&!(m?.display?.hide??[]).includes(a)&&j(d?.[a]).length===0);return c.length===0?null:(0,t.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:c.map(a=>(0,t.jsx)(he,{nodeId:e,field:a,label:r?.[a]??Q(m,a),files:[],...l?{labelStyle:l}:{},...o?{style:o}:{}},a))})}export{ge as FilesEditor,ve as SEND_EDGE,Re as drawFiles,ue as kindsWords,Fe as prepare,ke as send,H as sizeWords,ce as takes,O as typeWords};
|
|
1
|
+
import{h as ae}from"./chunk.WHTNSETN.js";import"./chunk.WVUJXDXZ.js";import{b as $,c as ne}from"./chunk.46KUPBQC.js";import"./chunk.N2WTNKEV.js";import"./chunk.SBHVVJY7.js";import"./chunk.GE5EAN36.js";import"./chunk.337WDTG3.js";import"./chunk.6R4EI47C.js";import{Y as X,da as ee,ga as te}from"./chunk.NRRUGG22.js";import{Gb as Y,I as J,J as v,K as j,Z as Q}from"./chunk.MKNXV4TM.js";import{a as we,b as Z}from"./chunk.MRK6QJV5.js";import{b as B}from"./chunk.AJZBJBMO.js";var g=B(we(),1);async function re(e,i){let r=await createImageBitmap(e);try{let l=Math.min(1,i/Math.max(r.width,r.height)),o=document.createElement("canvas");o.width=Math.max(1,Math.round(r.width*l)),o.height=Math.max(1,Math.round(r.height*l));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(r,0,0,o.width,o.height),o}finally{r.close()}}var t=B(Z(),1),ve=2048,$e=.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 O(e){if(e.type==="application/pdf")return"PDF";let i=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return i?i.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ue(e){let i=[...new Set(e.map(r=>r==="image/*"?"pictures":r==="*/*"||r==="*"?"any file":`${O({type:r})} files`))];return i.length<=1?i[0]??"no files":`${i.slice(0,-1).join(", ")} and ${i[i.length-1]}`}function ce(e,i){if(e.length===0)return!0;let r=`${i.split("/")[0]}/*`;return e.some(l=>l==="*"||l==="*/*"||l===i||l===r)}var ie=/^image\/hei[cf]$|\.hei[cf]$/i,le=e=>ie.test(e.type)||ie.test(e.name);async function Fe(e,i,r){let l=e.name||(r.camera?"photo.jpg":"file"),o=e.type||(le({type:"",name:l})?"image/heic":"application/octet-stream"),s=le({type:o,name:l}),d=o.startsWith("image/")||s;if(r.image&&!d)return{refused:`\u201C${l}\u201D isn\u2019t a picture.`};if(s||d&&/^image\/(jpeg|webp)$/.test(o)&&(r.camera||e.size>i.maxBytes||e.size>15e5))try{let a=await re(e,ve),f=await new Promise(y=>a.toBlob(y,"image/jpeg",$e));if(f)return oe({blob:f,name:s?l.replace(/\.hei[cf]$/i,"")+".jpg":l,type:"image/jpeg",width:a.width,height:a.height},i)}catch{if(s&&!ce(i.kinds,o))return{refused:`\u201C${l}\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 a=await createImageBitmap(e);c={width:a.width,height:a.height},a.close()}catch{}return oe({blob:e,name:l,type:o,...c},i)}function oe(e,i){return ce(i.kinds,e.type)?e.blob.size>i.maxBytes?{refused:`\u201C${e.name}\u201D is ${H(e.blob.size)}; this host takes files up to ${H(i.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${O(e)} file; this host takes ${ue(i.kinds)}.`}}async function ke(e,i,r){let l;try{l=await i.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 J(l)?r&&!v(l)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:{...l,...l.width===void 0&&e.width?{width:e.width}:{},...l.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)",S={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function _({file:e,size:i=56,style:r}){return(0,t.jsx)("img",{src:e.href,alt:$(e),width:i,height:i,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:i,height:i,objectFit:"cover",borderRadius:F,display:"block",flex:"none",background:"var(--graview-edge)",...r}})}function N({files:e,label:i}){let r=e.filter(v),l=e.filter(a=>!v(a)),[o,s]=(0,g.useState)(null),d=(0,g.useRef)(null),m=(0,g.useRef)(null);(0,g.useEffect)(()=>{let a=d.current;o!==null&&a&&!a.open&&a.showModal?.()},[o]);let c=o===null?void 0:r[o];return(0,t.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[r.length>0?(0,t.jsx)("ul",{"data-graview-gallery":"","aria-label":i,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:r.map((a,f)=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)("button",{type:"button","aria-label":`Open ${$(a)} full size`,onClick:y=>{m.current=y.currentTarget,s(f)},style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:F},children:(0,t.jsx)("img",{src:a.href,alt:$(a),loading:"lazy",decoding:"async",style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:F,display:"block",background:"var(--graview-edge)"}})})},a.href))}):null,l.length>0?(0,t.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:l.map(a=>(0,t.jsxs)("li",{"data-graview-document":a.type,style:{display:"grid",gap:6,minWidth:0},children:[a.type==="application/pdf"?(0,t.jsx)("object",{data:a.href,type:"application/pdf","aria-label":$(a),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:a.href,download:a.name,children:["download ",a.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:a.href,download:a.name,...a.type==="application/pdf"?{target:"_blank",rel:"noopener"}:{},children:a.name}),(0,t.jsxs)("span",{style:S,children:[O(a)," \xB7 ",H(a.bytes)]})]}),a.caption?(0,t.jsx)("span",{style:S,children:a.caption}):null]},a.href))}):null,c?(0,t.jsx)("dialog",{ref:d,"data-graview-full":c.href,"aria-label":$(c),onClose:()=>{s(null),m.current?.focus()},onClick:a=>{a.target===a.currentTarget&&a.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:$(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 ge({value:e,onChange:i,several:r,image:l,label:o,thumbs:s=!0}){let d=X(),m=(0,g.useId)(),c=(0,g.useRef)(null),a=(0,g.useRef)(null),[f,y]=(0,g.useState)(null),[k,D]=(0,g.useState)(null),[U,E]=(0,g.useState)([]),[I,L]=(0,g.useState)(!1),C=d?l?d.kinds.filter(n=>n.startsWith("image/")||n==="*"||n==="*/*"):d.kinds:[],A=d?d.kinds.length===0||C.some(n=>n.startsWith("image/")||n.startsWith("*")):!1,P=!!d&&(!l||A),G=l?r?"pictures":"a picture":r?"files":"a file",q=l?C.length>0?C.join(","):"image/*":d?.kinds.join(",")||void 0,me=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,V=(0,g.useRef)(e);V.current=e;let K=(0,g.useRef)(null),W=(0,g.useRef)(null);(0,g.useEffect)(()=>{let n=W.current;if(!n||n.from===e)return;W.current=null;let u=K.current?.children,h=u?.[Math.min(n.at,u.length-1)];((n.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(n,u)=>{if(!d||n.length===0)return;let h=r?n:n.slice(0,1),p=[],w=[];h.length<n.length&&w.push(`${o} holds one ${l?"picture":"file"}, so ${n.slice(1).map(b=>`\u201C${b.name||"the photo"}\u201D`).join(", ")} ${n.length>2?"were":"was"} left out.`),E([]),D(null);for(let b of h){y(`Sending ${b.name||"the photo"}\u2026`);let z=await Fe(b,d,{image:l,camera:u==="camera"});if("refused"in z){w.push(z.refused);continue}let x=await ke(z,d,l);"refused"in x?w.push(x.refused):[...r?V.current:[],...p].some(be=>be.href===x.href)?w.push(`\u201C${x.name}\u201D is already here.`):p.push(x)}if(y(null),E(w),p.length!==0)try{i(r?[...V.current,...p]:p.slice(-1)),D(`Added ${p.map(b=>b.name).join(", ")}.`)}catch(b){E([...w,b instanceof Error?b.message:String(b)])}},R=(n,u,h)=>{try{W.current=h?{...h,from:e}:null,i(n),D(u)}catch(p){W.current=null,E([p instanceof Error?p.message:String(p)])}},M=n=>n?Array.from(n):[],ye=n=>{let u=M(n.clipboardData?.files);!P||u.length===0||(n.preventDefault(),T(u,"pasted"))},fe=n=>{L(!1),P&&(n.preventDefault(),T(M(n.dataTransfer?.files),"dropped"))};return(0,t.jsxs)("div",{role:"group","aria-labelledby":`${m}-label`,"data-graview-file-editor":"","data-graview-dropping":I?"":void 0,onPaste:ye,onDragOver:n=>{P&&(n.preventDefault(),L(!0))},onDragLeave:()=>L(!1),onDrop:fe,style:{display:"grid",gap:8,minWidth:0,padding:I?6:0,outline:I?"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&&(r||e.length>1)?(0,t.jsx)("ul",{ref:K,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((n,u)=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[s&&v(n)?(0,t.jsx)(_,{file:n,size:40}):null,(0,t.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:n.name}),(0,t.jsx)(de,{file:n,onCaption:h=>R(e.map((p,w)=>w===u?se(p,h):p),h?`${n.name} now says \u201C${h}\u201D.`:`${n.name} says its name again.`)}),r&&u>0?(0,t.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${n.name} earlier`,onClick:()=>R(e.map((h,p)=>p===u-1?n:p===u?e[u-1]:h),`Moved ${n.name} earlier.`,{at:u-1,what:"move"}),children:"\u2191"}):null,r?(0,t.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${n.name}`,onClick:()=>R(e.filter((h,p)=>p!==u),`Removed ${n.name}.`,{at:u,what:"remove"}),children:"Remove"}):null]},`${u}:${n.href}`))}):e.length===1?(0,t.jsx)(de,{file:e[0],onCaption:n=>R([se(e[0],n)],n?`${e[0].name} now says \u201C${n}\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:r,...q?{accept:q}:{},"data-graview-file-input":"","aria-label":`Choose ${G}`,onChange:n=>{let u=M(n.currentTarget.files);n.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&&!r?`Replace ${l?"the picture":"the file"}`:`Choose ${G}`}),A?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:a,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:n=>{let u=M(n.currentTarget.files);n.currentTarget.value="",T(u,"camera")}}),me?(0,t.jsx)("button",{type:"button",disabled:f!==null,onClick:()=>a.current?.click(),children:"Take a photo"}):null]}):null,(0,t.jsxs)("span",{style:S,"data-graview-file-takes":"",children:["or drop or paste ",r?"them":"it"," here \xB7 ",d.kinds.length>0?ue(C.length>0?C:d.kinds):"any file",", up to ",H(d.maxBytes)]})]}):(0,t.jsx)("p",{style:{...S,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:{...S,margin:0,minHeight:f||k?void 0:0},"data-graview-file-status":"",children:f??k??""}),U.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:U.map((n,u)=>(0,t.jsx)("p",{style:{margin:0},children:n},u))}):null]})}var se=(e,i)=>{let{caption:r,...l}=e;return i?{...l,caption:i}:l};function de({file:e,onCaption:i}){let[r,l]=(0,g.useState)(e.caption??"");(0,g.useEffect)(()=>l(e.caption??""),[e.caption]);let o=()=>{let s=r.trim().slice(0,500);s!==(e.caption??"")&&i(s)};return(0,t.jsx)("input",{type:"text",value:r,placeholder:v(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${v(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:s=>l(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 pe({field:e,label:i,labelStyle:r,valueStyle:l,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:r,children:i}),(0,t.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...l},children:s})]})}function he(e){let{nodeId:i,field:r,label:l,files:o}=e,{fields:s,commit:d}=ae(i),m=s.find(y=>y.field===r&&y.takesValue),c=m?.shape,a=c?.type==="several"?c.of:c,f=c?.type==="several";return o.length===0&&a?.type!=="file"?null:(0,t.jsxs)(pe,{...e,children:[(0,t.jsx)(N,{files:o,label:l}),m&&a?.type==="file"?(0,t.jsx)(ge,{value:o,thumbs:!1,several:f,image:a.image===!0,label:l,onChange:y=>{let k=f?y:y[y.length-1];k!==void 0&&d(m,k)}}):null]})}function Re(e){switch(e.as){case"field":return e.read?e.files.length>0?(0,t.jsx)(pe,{...e,children:(0,t.jsx)(N,{files:e.files,label:e.label})}):null:(0,t.jsx)(he,{...e});case"unfilled":return(0,t.jsx)(Ce,{...e});case"thumb":return(0,t.jsx)(_,{...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:Y.raised}:{}},children:e.view==="thumb"?(0,t.jsx)(_,{file:e.files[0],size:72}):(0,t.jsx)(N,{files:e.files,label:e.label})}):null;case"control":{let i=(0,t.jsx)(ge,{value:j(e.value),several:e.several,image:e.image,label:e.label,onChange:r=>e.onChange(e.several?r:r[r.length-1])});return e.title===void 0?i:(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}),i]})}}}function Ce({nodeId:e,skip:i,labels:r,labelStyle:l,style:o}){let{store:s}=ee(),d=te(e),m=d?s.schema.tryDefinition(d.kind):void 0,c=ne(m).filter(a=>!i.includes(a)&&!(m?.display?.hide??[]).includes(a)&&j(d?.[a]).length===0);return c.length===0?null:(0,t.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:c.map(a=>(0,t.jsx)(he,{nodeId:e,field:a,label:r?.[a]??Q(m,a),files:[],...l?{labelStyle:l}:{},...o?{style:o}:{}},a))})}export{ge as FilesEditor,ve as SEND_EDGE,Re as drawFiles,ue as kindsWords,Fe as prepare,ke as send,H as sizeWords,ce as takes,O as typeWords};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Be,b as Oe,c as qt,d as _t,f as We}from"./chunk.
|
|
1
|
+
import{a as Be,b as Oe,c as qt,d as _t,f as We}from"./chunk.J6CBMLGR.js";import{h as Pt,i as Dt,j as Bt,k as Ot,n as Wt,o as Ft}from"./chunk.22H4JXTH.js";import"./chunk.2VUG6EAN.js";import"./chunk.IH42QTOM.js";import"./chunk.TBG2QBOS.js";import"./chunk.PN2H6X7O.js";import"./chunk.BCBH6WJF.js";import"./chunk.N7HCALRK.js";import{d as Kt}from"./chunk.XG67BWH6.js";import{b as Nt}from"./chunk.25OYH6MY.js";import{b as Lt}from"./chunk.OGL4PHTY.js";import{a as na}from"./chunk.IKT7JQUW.js";import{b as Et,i as Mt}from"./chunk.ISRS7GOT.js";import"./chunk.DCIC3YHX.js";import{l as Rt}from"./chunk.WHTNSETN.js";import{a as Ht}from"./chunk.4H7CQE56.js";import{a as It,b as Q}from"./chunk.W3LDQ6B2.js";import"./chunk.Q3HVA6L4.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.SNBIZ3B6.js";import{a as wt,d as ze}from"./chunk.6LJ66MB7.js";import{A as yt,D as kt,E as St,F as $t,J as he,V as zt,ca as Ct,da as T,fa as At,h as ht,i as ye,l as we,m as mt,n as ft,o as ke,p as bt,q as Se,qa as De,r as Ne,ra as Tt,sa as de,u as Pe,va as $e,x as xt,ya as Ee}from"./chunk.NRRUGG22.js";import{$ as Le,$a as gt,Fb as W,Hb as F,V as lt,X as xe,Y as dt,_ as Me,cb as pt,db as ct,nb as ut,ub as vt}from"./chunk.MKNXV4TM.js";import{a as ae,b as E}from"./chunk.MRK6QJV5.js";import{b as w}from"./chunk.AJZBJBMO.js";var Ce=t=>`${t.saturation}% ${t.lightness}%`,Ut=t=>`${Ce(t)} / ${t.alpha}`;function la(t){let a=vt(t);return`
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
.graview-altitude-control {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as W}from"./chunk.
|
|
1
|
+
import{b as W}from"./chunk.25OYH6MY.js";import{B as R,a as A,b as T,c as v,d as f,e as x,i as I,l as b,sa as k}from"./chunk.NRRUGG22.js";import{Yb as s,va as y,wa as r}from"./chunk.MKNXV4TM.js";import{a as H}from"./chunk.MRK6QJV5.js";import{b as B}from"./chunk.AJZBJBMO.js";var u=B(H(),1),L=e=>typeof e=="object"&&e!==null&&"idx"in e;function E(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":L(window.history.state)?"pages":null}function J(e){let n=e.face??(e.stop&&v(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:E(e.basePath)??n}function K(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&E(e.basePath)===null}function Q(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?T(f(window.location.hash)):void 0}function X({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:U,places:w,opens:$}){let{view:F,go:p}=k(),g=(0,u.useRef)({shown:t,view:F,onFace:i});g.current={shown:t,view:F,onFace:i};let S=(0,u.useRef)(n??"/"),M=()=>{S.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:N,onFace:V}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",y(c??S.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){M();let m=a===void 0?N:j(v(a),w),h=Y(m)?q($):m,O=h!==m&&h.overview?"graview":o,P=_(O,h,U);p(P),window.history.pushState(null,"",`${y(s,{basePath:e})}${x(P)}`),V?.(O);return}V?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=E(e)??"pages",{shown:a,onFace:d}=g.current;if(c==="pages"){a!=="pages"&&d?.("pages");return}a==="pages"&&(p(j(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function j(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:R(i.kind)}:e}function _(e,n,t){return e==="graview"?b(n,!0):n.overview?I(b(n,!1),W(n,t)):n}function Y(e){return e.focusId===null&&e.overview!==!0}function q(e){return e??{...A,overview:!0}}export{J as a,K as b,Q as c,X as d,j as e,_ as f,Y as g,q as h};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as O,k as b}from"./chunk.
|
|
1
|
+
import{f as O,k as b}from"./chunk.337WDTG3.js";function K(n,s){return s===1&&["every","some","sum","min","max","sort"].includes(n.fn)}function S(n){let s=new Set,e=new Set,r=[],i=[],o=new Set(O),a=(l,f)=>{switch(l.t){case"lit":return;case"ident":f||s.add(l.name);return;case"list":l.items.forEach(c=>a(c,f));return;case"member":a(l.object,f);return;case"unary":a(l.operand,f);return;case"binary":a(l.left,f),a(l.right,f);return;case"where":a(l.set,f),a(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],h=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&h&&r.push(h),(l.fn==="out"||l.fn==="in")&&h&&i.push(h),l.args.forEach((k,x)=>a(k,f||K(l,x)));return}}};return a(n,!1),{names:s,functions:e,unknownFunctions:[...e].filter(l=>!o.has(l)),sweeps:r,edges:i}}var p=class extends Error{constructor(e,r,i){super(`${e} (at character ${r+1} of "${i}")`);this.sentence=e;this.at=r;this.source=i}},q=["||","&&","==","!=","<=",">=","<",">","!","|","&","+","-","*","/","%","(",")","[","]",",","."],F={and:"&&",or:"||",not:"!"},M=2e3;function I(n){let s=[],e=0;for(;e<n.length;){let r=n[e];if(r===" "||r===" "||r===`
|
|
2
2
|
`||r==="\r"){e++;continue}if(r>="0"&&r<="9"){let o=e;for(;e<n.length&&/[0-9.]/.test(n[e]);)e++;let a=n.slice(o,e),l=Number(a);if(!Number.isFinite(l)||a.split(".").length>2)throw new p(`"${a}" is not a number`,o,n);s.push({k:"num",v:l,at:o});continue}if(r==="'"||r==='"'){let o=e++,a="";for(;e<n.length&&n[e]!==r;)n[e]==="\\"&&e+1<n.length&&e++,a+=n[e++];if(e>=n.length)throw new p("a quoted word is never closed",o,n);e++,s.push({k:"str",v:a,at:o});continue}if(/[A-Za-z_]/.test(r)){let o=e;for(;e<n.length&&/[A-Za-z0-9_]/.test(n[e]);)e++;let a=n.slice(o,e),l=Object.hasOwn(F,a)?F[a]:void 0;s.push(l?{k:"op",v:l,at:o}:{k:"id",v:a,at:o});continue}let i=q.find(o=>n.startsWith(o,e));if(!i)throw new p(`"${r}" is not part of the rule language`,e,n);s.push({k:"op",v:i,at:e}),e+=i.length}return s.push({k:"end",at:n.length}),s}function w(n){if(n.length>M)throw new p(`an expression may be at most ${M} characters`,0,n.slice(0,40));let s=I(n),e=0,r=()=>s[e],i=t=>{let d=r();return d.k==="op"&&d.v===t},o=t=>{let d=r();return d.k==="id"&&d.v===t},a=(t,d)=>{if(!i(t))throw new p(`expected ${d}`,r().at,n);e++},l=0,f=(t,d)=>{if(++l>64)throw new p("the expression nests too deeply",t,n);try{return d()}finally{l--}},c=(t,d)=>()=>{let u=d();for(;;){let y=r(),R=y.k==="op"?t.find(B=>B===y.v):y.k==="id"&&y.v==="in"&&t.includes("in")?"in":void 0;if(!R)return u;e++,u={t:"binary",op:R,left:u,right:d(),at:y.at}}},h=()=>{let t=r();if(t.k==="num")return e++,{t:"lit",value:t.v,at:t.at};if(t.k==="str")return e++,{t:"lit",value:t.v,at:t.at};if(t.k==="id"){if(e++,t.v==="true"||t.v==="false")return{t:"lit",value:t.v==="true",at:t.at};if(t.v==="null")return{t:"lit",value:null,at:t.at};if(i("(")){e++;let d=[];if(!i(")"))for(;;){if(d.push(m()),i(",")){e++;continue}break}return a(")",`")" to close ${t.v}(\u2026)`),{t:"call",fn:t.v,args:d,at:t.at}}return{t:"ident",name:t.v,at:t.at}}if(t.k==="op"&&t.v==="("){e++;let d=f(t.at,m);return a(")",'a ")"'),d}if(t.k==="op"&&t.v==="["){e++;let d=[];if(!i("]"))for(;;){if(d.push(m()),i(",")){e++;continue}break}return a("]",'a "]" to close the list'),{t:"list",items:d,at:t.at}}throw t.k==="end"?new p("the expression ends too soon",t.at,n):new p(`"${t.k==="op"?t.v:""}" cannot start a value here`,t.at,n)},k=()=>{let t=h();for(;;){if(i(".")){let d=r();e++;let u=r();if(u.k!=="id")throw new p('expected a field name after "."',u.at,n);e++,t={t:"member",object:t,name:u.v,at:d.at};continue}if(o("where")){let d=r().at;e++,t={t:"where",set:t,filter:f(d,m),at:d};continue}return t}},x=()=>{let t=r();return t.k==="op"&&(t.v==="!"||t.v==="-")?(e++,{t:"unary",op:t.v,operand:f(t.at,x),at:t.at}):k()},T=c(["*","/","%"],x),C=c(["+","-"],T),A=c(["&"],C),v=c(["|"],A),P=()=>{let t=v(),d=r(),u=d.k==="op"&&["==","!=","<","<=",">",">="].includes(d.v)?d.v:d.k==="id"&&d.v==="in"?"in":void 0;return u?(e++,{t:"binary",op:u,left:t,right:v(),at:d.at}):t},$=()=>{let t=r();return t.k==="op"&&t.v==="!"?(e++,{t:"unary",op:"!",operand:f(t.at,$),at:t.at}):P()},z=c(["&&"],$),_=c(["||"],z);function m(){return _()}let N=m();if(r().k!=="end")throw new p("there is more after the end of the expression",r().at,n);return N}function D(n){let s,e=-1,r=0;for(let i=0;i<n.length;i++){let o=n[i];if(s){o==="\\"?i++:o===s&&(s=void 0);continue}o==="'"||o==='"'?s=o:o==="("||o==="["?r++:o===")"||o==="]"?r--:o==="|"&&r===0&&(n[i+1]==="|"?i++:e=i)}return e}var E=/\s*(?:'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)")\s*(,|$)/y;function H(n){let s=n.indexOf(":"),e=(s>=0?n.slice(0,s):n).trim();if(!b.includes(e))throw new g(`"${e}" is not a formatter; use one of ${b.join(", ")}`);let r=[];if(s>=0){let i=n.slice(s+1),o=0;for(;o<i.length;){E.lastIndex=o;let a=E.exec(i);if(!a)throw new g(`"${e}" is told quoted words, like ${e}: 'offer'`);if(r.push((a[1]??a[2]??"").replace(/\\(.)/g,"$1")),o=E.lastIndex,a[3]==="")break}}if(e==="plural"&&(r.length<1||r.length>2))throw new g("plural is told its noun, like {count | plural: 'offer'}, and its plural where English does not make it: plural: 'person', 'people'");if(e!=="plural"&&r.length>0)throw new g(`"${e}" takes nothing after it`);return{format:e,args:r}}var g=class extends Error{constructor(e){super(e);this.sentence=e}};function J(n){let s=[],e=0;for(;e<n.length;){let r=n.indexOf("{",e);if(r<0){s.push({text:n.slice(e)});break}r>e&&s.push({text:n.slice(e,r)});let i=n.indexOf("}",r);if(i<0)throw new g(`a "{" at character ${r+1} is never closed`);let o=n.slice(r+1,i),a=D(o),l=(a>=0?o.slice(0,a):o).trim(),f=a>=0?H(o.slice(a+1)):void 0;s.push({expr:w(l),source:l,...f?{format:f.format}:{},...f&&f.args.length>0?{formatArgs:f.args}:{}}),e=i+1}return s}function j(n){let s=new Map;for(let[e,r]of Object.entries(n?.computed??{}))s.set(e,typeof r=="string"?{expr:r}:r);return s}function te(n){let s=j(n);if(s.size===0)return;let e=new Map;for(let[r,i]of s)try{e.set(r,w(i.expr))}catch(o){if(!(o instanceof p))throw o}return e}function L(n,s,e=new Set){let r=j(n).get(s);if(!r||e.has(s))return!1;let i;try{i=w(r.expr)}catch{return!1}let o=S(i);if(o.edges.length>0||o.sweeps.length>0||[...o.functions].some(c=>c==="out"||c==="in"||c==="all"))return!1;let a=n.fields,l=c=>a instanceof Set?a.has(c):Object.hasOwn(a,c),f=new Set([...e,s]);return[...o.names].every(c=>l(c)||L(n,c,f))}export{S as a,p as b,w as c,g as d,J as e,j as f,te as g,L as h};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e as ye,f as he,i as be,j as J,k as we}from"./chunk.46KUPBQC.js";import{f as ge}from"./chunk.GE5EAN36.js";import{$b as me,B as z,E as ne,Jb as ue,O as E,Q as T,Sa as ie,T as te,Tb as pe,U as re,V as X,W as oe,Z as _,aa as H,ba as se,bc as fe,hb as ae,ib as q,jb as le,vb as de,xb as ce}from"./chunk.MKNXV4TM.js";function Re(t,r,n){let s=t.tryDefinition(r)?.fields.shape,e=z(s?.[n]),l=!1,i=!1;for(;e&&(e.type==="optional"||e.type==="default"||e.type==="nullable"||e.type==="prefault");)(e.type==="optional"||e.type==="nullable")&&(l=!0),(e.type==="default"||e.type==="prefault")&&(i=!0),e=z(e.innerType);if(e?.type!=="enum")return;let y=(e.entries?Object.values(e.entries):e.values??[]).filter(u=>typeof u=="string");return y.length>0?{values:y,empty:l&&!i}:void 0}function L(t,r,n){let s=Re(t,r,n);if(!s)return[];let e=t.tryDefinition(r),l=s.values.map(i=>({value:i,label:re(e,n,i)}));return s.empty&&l.push({value:null,label:`No ${_(e,n).toLowerCase()}`}),l}function U(t,r,n){let s=t[r];return typeof s=="string"&&n.some(e=>e.value===s)?s:null}function Q(t,r,n,s,e=L(t.schema,n.kind,s)){let l=xe(t.schema,t.allMutations(),n.kind,s,e),i=U(n,s,e),y=[];for(let{value:u,by:A,acts:O}of l)if(u!==i)for(let $ of O){let B=A==="step"?{[$.subject.arg]:n.id}:{[$.subject.arg]:n.id,[s]:u},R={name:$.name,args:B};if($.input.safeParse(B).success&&t.permits(R,r).ok){try{ae(t.graph,$,B)}catch{continue}y.push({to:u,call:R,title:$.title??$.name});break}}return y}function xe(t,r,n,s,e=L(t,n,s)){let l=ve(t,r,n,s),i=$e(t,r,n,s);return e.flatMap(y=>{if(y.value===null)return[];let u=l.filter(A=>A.sets?.[s]===y.value);return[{value:y.value,label:y.label,by:u.length>0?"step":i.length>0?"value":"none",acts:u.length>0?u:i}]})}function ve(t,r,n,s){return r.filter(e=>e.subject!==void 0&&e.derived===void 0&&typeof e.sets?.[s]=="string"&&q(t,e).includes(n))}function $e(t,r,n,s){let e=t.tryDefinition(n);return e?r.filter(l=>{if(!l.subject||!q(t,l).includes(n)||!le(l,e).includes(s))return!1;let i=l.input.shape;return i!==void 0&&s in i}).sort((l,i)=>+(l.derived!==void 0)-+(i.derived!==void 0)):[]}var Y=(t,r)=>r&&t[r]!==void 0?String(t[r]):"";function Ae(t,r,n){let s=d=>t.tryDefinition(d)?r.nodesOfKind(d).filter(k=>E(t.tryDefinition(d),k)):[],e=s(n.rows),l=s(n.columns),i=new Set(e.map(d=>d.id)),y=new Set(l.map(d=>d.id)),u=r.allEdges(),A=[],O=n.link;if(typeof O=="string"){let d=p=>t.tryDefinition(p)?.edges?.[O]?.to,k=(d(n.columns)??[]).some(p=>p===n.rows||p==="*"),w=(d(n.rows)??[]).some(p=>p===n.columns||p==="*"),D=k||!w;for(let p of u){if(p.kind!==O)continue;let m=D?p.to:p.from,o=D?p.from:p.to;i.has(m)&&y.has(o)&&A.push({rowId:m,columnId:o,via:[]})}}else{let d=new Map(O.path.map(w=>[w,new Map]));for(let w of u){let D=d.get(w.kind);if(!D)continue;let p=D.get(w.from);p?p.push(w.to):D.set(w.from,[w.to]);let m=D.get(w.to);m?m.push(w.from):D.set(w.to,[w.from])}let k=new Set;for(let w of l){let D=[{id:w.id,via:[]}];for(let p of O.path){let m=[],o=new Set;for(let f of D)for(let P of d.get(p).get(f.id)??[])o.has(`${f.id}|${P}`)||(o.add(`${f.id}|${P}`),m.push({id:P,via:[...f.via,f.id]}));D=m}for(let p of D){let m=`${p.id}|${w.id}`;!i.has(p.id)||k.has(m)||(k.add(m),A.push({rowId:p.id,columnId:w.id,via:p.via.slice(1)}))}}}let $=n.groupOrder??[],B=d=>$.indexOf(d)===-1?$.length:$.indexOf(d),R=e.map(d=>{let k=d;return{node:d,label:String(k.label??T(t.tryDefinition(d.kind),d)),group:Y(k,n.rowGroup),ref:Y(k,n.rowRef)}}).sort((d,k)=>B(d.group)-B(k.group)||(d.ref<k.ref?-1:d.ref>k.ref?1:0)),N=l.map(d=>({node:d,label:T(t.tryDefinition(d.kind),d),group:Y(d,n.columnGroup)})).sort((d,k)=>d.group<k.group?-1:d.group>k.group?1:d.node.id<k.node.id?-1:d.node.id>k.node.id?1:0);return{rows:R,columns:N,cells:A}}function ke(t,r,n){let{rows:s,columns:e,cells:l}=Ae(t,r,n),i=(o,f)=>X(t,o,f),y=o=>X(t,o,1).replace(/^1 /,""),u=o=>({id:o.id,kind:o.kind,title:T(t.tryDefinition(o.kind),o),parts:[]}),A=o=>{let f=r.getNode(o);if(!f)return null;let P=t.tryDefinition(f.kind),M=T(P,f),K=H(f,P,{limit:3,said:[M],glance:!0}).map(I=>I.alone.startsWith(I.label)?`${I.label.toLowerCase()}${I.alone.slice(I.label.length)}`:I.alone);return[M,...K].join(", ")},O=typeof n.link=="string"?[]:n.link.path.slice(0,-1).flatMap((o,f,P)=>{let M=ue(t,n.columns,P.slice(0,f+1));return M.ok?[...M.reached]:[]}),$=[{t:"text",text:`${i(n.rows,s.length)} against ${i(n.columns,e.length)}${O.length>0?`, through ${[...new Set(O)].map(o=>i(o,2).replace(/^2 /,"")).join(" and ")}`:""}${e.length>0?`: ${e.map(o=>o.label).join(", ")}`:""}.`}],B=new Map(e.map(o=>[o.node.id,o.label])),R=new Map(e.map((o,f)=>[o.node.id,f])),N=new Map,d=new Map;for(let o of l){let f=N.get(o.rowId);f?f.push(o):N.set(o.rowId,[o]);let P=d.get(o.columnId);P?P.add(o.rowId):d.set(o.columnId,new Set([o.rowId]))}for(let o of s){let P=[...N.get(o.node.id)??[]].sort((M,K)=>R.get(M.columnId)-R.get(K.columnId)).map(M=>{let K=M.via.map(A).filter(I=>I!==null);return`${B.get(M.columnId)}${K.length>0?` (${K.join("; ")})`:""}`});$.push({t:"field",label:o.label,text:P.length>0?P.join(", "):"none"})}$.push({t:"list",as:"name",columns:1,groups:e.map(o=>{let f=d.get(o.node.id)??new Set,P=s.filter(M=>f.has(M.node.id)).map(M=>u(M.node));return{heading:`${o.label} (${P.length})`,items:P}})});let k=new Set(l.map(o=>o.rowId)),w=new Set(l.map(o=>o.columnId)),D=s.filter(o=>!k.has(o.node.id)),p=e.filter(o=>!w.has(o.node.id)),m=n.rows===n.columns;return D.length>0&&$.push({t:"text",text:`${m?`${D.length} with none across`:`${i(n.rows,D.length)} with no ${y(n.columns)}`}: ${D.map(o=>o.label).join(", ")}.`}),p.length>0&&$.push({t:"text",text:`${m?`${p.length} with none down`:`${i(n.columns,p.length)} on no ${y(n.rows)}`}: ${p.map(o=>o.label).join(", ")}.`}),$}function Z(t,r,n,s={}){let{app:e,blocks:l=n?e?.viewSpecs?.[n.kind]?.[s.slot??"page"]:e?.home}=s;if(!l?.length)return[];let i=s.firstHeading??(n||s.blocks?void 0:1),y=we(t,r,n,{...s,money:s.money??e?.brand,firstHeading:i});return n&&!y.node?[]:he(typeof l[0]?.t=="string"?l:ye(l),y)}var Ce=240,Se=10,je=1160,Me=40,Oe=640,Be=3,Ie=t=>Math.max(1,Math.floor((Math.min(t,je)-Me+Se)/(Ce+Se)));function Ge(t,r,n,s){let{app:e}=s,l=s.width??1440,i=s.today??ne(),y=t.seenBy(r),u=y.schema,A=y.graph,O=fe(e),$=typeof n=="string"?n.trim():n.slug,B=typeof n=="string"?O.find(a=>a.slug===$||a.title===$||a.address===$):O.find(a=>a.slug===n.slug&&a.kind===n.kind)??n,R=!B&&typeof n=="string"?A.getNode($):void 0;if(!B&&!R)return{ok:!1,error:`"${$}" is not a place this app has, nor a record this seat can see.`,places:O.map(a=>a.slug)};let N=[],d=e.viewSpecs??{},k=Ie(l),w=(a,h)=>Z(y,null,a,{app:e,today:i,...h}),D=(a,h,b)=>{let g=u.tryDefinition(a.kind),S=T(g,a);if(h==="name")return{id:a.id,kind:a.kind,title:S,parts:[]};if(d[a.kind]?.[h]){let j=w(a,{slot:h}),[F,...v]=j,C=F?.t==="title";return{id:a.id,kind:a.kind,title:C?F.text:S,parts:p(C?v:j,b,`views.${a.kind}.${h}`,` (${a.id})`,C?1:0)}}if(h==="row")return{id:a.id,kind:a.kind,title:S,parts:[]};let c=g?.computed?J(u,A,a):a,G=H(c,g,{limit:3,said:[S],glance:!0});return{id:a.id,kind:a.kind,title:S,parts:G.map(j=>({t:"text",text:j.alone}))}};function p(a,h,b,g="",S=0){let x=[];return a.forEach((c,G)=>{let j=`${b}.${G+S}`;switch("problem"in c&&c.problem&&N.push({at:`${j}${g}`,says:c.problem}),c.t){case"title":x.push({t:"heading",level:3,text:c.text});return;case"text":x.push({t:"text",text:c.text,...c.tone?{tone:c.tone}:{}});return;case"badge":x.push({t:"badge",text:c.text});return;case"field":case"image":x.push({t:"field",label:c.label,text:c.text});return;case"progress":x.push({t:"progress",label:c.label,text:c.text});return;case"group":x.push(...p(c.blocks,h,`${j}.group`,g));return;case"when":x.push(...p(c.blocks,h,`${j}.show`,g));return;case"divider":case"figure":return;case"headline":x.push({t:"heading",level:c.level,text:c.text});return;case"number":x.push({t:"figure",text:c.text,...c.label?{label:c.label}:{}});return;case"list":{if(c.failed){x.push({t:"text",text:"\u2014"});return}if(c.members.length===0){c.empty&&x.push({t:"list",as:c.as,columns:1,groups:[],empty:c.empty});return}let F=h+1,v=F>Be?"name":c.as,C=(c.groups??[{value:null,members:c.members}]).map(W=>({..."heading"in W&&W.heading?{heading:W.heading}:{},items:W.members.map(Pe=>D(Pe,v,F))}));x.push({t:"list",as:v,columns:v==="card"?k:1,groups:C,...c.more>0?{more:c.more}:{}});return}}}),x}let m=[],o,f,P;if(R){f="record";let a=u.tryDefinition(R.kind),h=T(a,R);P={slug:R.id,title:h,kind:R.kind,address:ie(u,R.kind,R.id)},d[R.kind]?.page&&m.push(...p(w(R,{slot:"page"}),1,`views.${R.kind}.page`));let g=a?.computed?J(u,A,R):R;for(let S of se(a,H(g,a,{said:[h]}))){S.title&&m.push({t:"heading",level:2,text:S.title});for(let x of S.fields)m.push({t:"field",label:x.label,text:x.value})}}else{let a=B;P={slug:a.slug,title:a.title,kind:a.kind,address:a.address};let h=a.lens?pe(e).drawn.find(b=>b.as===a.slug&&(a.kind===null||b.kinds.includes(a.kind))):void 0;if(a.kind===null){let b=e.brand,g=b?.name??e.name,S=b?.logo&&ce(b.logo)?b.logo:void 0;if(o={name:g,...b?.subtitle?{subtitle:b.subtitle}:{},...S?{logo:{alt:b?.logoAlt??g,...de(S)?{drawn:"inline SVG"}:{drawn:"image",src:S}}}:{}},e.home)f="blocks",m=p(w(null,{}),0,"views.home");else{f="derived";let x=new Set(e.pages?.hide??[]),c=me(u.kinds,e.pages?.order).filter(G=>!x.has(G));m.push({t:"heading",level:1,text:e.name??"Home"});for(let G of c){let j=A.nodesOfKind(G).filter(F=>E(u.tryDefinition(G),F)).length;j>0&&m.push({t:"text",text:`${j} ${V(u,G,j)}`})}}}else if(h?.lens==="blocks")f="lens:blocks",m=p(w(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){f="lens:columns";let b=h.options.bindings??{};for(let g of Object.keys(b)){let S=b[g]?.column;if(!S)continue;let x=L(u,g,S),c=A.nodesOfKind(g).filter(v=>E(u.tryDefinition(g),v));Object.keys(b).length>1&&m.push({t:"heading",level:2,text:V(u,g,2).replace(/^./,v=>v.toUpperCase())}),m.push({t:"text",text:`${c.length} ${V(u,g,c.length)} in columns by ${_(u.tryDefinition(g),S).toLowerCase()}.`});let G=x.map(v=>({column:v,items:c.filter(C=>U(C,S,x)===v.value).map(C=>D(C,"card",1))})).filter(({column:v,items:C})=>v.value!==null||C.length>0).map(({column:v,items:C})=>({heading:`${v.label} (${C.length})`,items:C}));m.push({t:"list",as:"card",columns:1,groups:G});let j=new Map;for(let v of c)for(let C of Q(t,r,v,S,x))j.set(C.to,(j.get(C.to)??new Set).add(`"${C.title}"`));let F=x.filter(v=>v.value!==null&&j.has(v.value)).map(v=>`to ${v.label} by ${[...j.get(v.value)].join(" or ")}`);m.push({t:"text",text:F.length>0?`Moves: ${F.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")f="lens:coverage",m=ke(u,A,h.options);else if(h){f=`lens:${h.lens}`;let b=h.kinds.flatMap(g=>A.nodesOfKind(g).filter(S=>E(u.tryDefinition(g),S)));m.push({t:"text",text:`A ${h.lens} of ${b.length} ${h.kinds.map(g=>V(u,g,b.length)).join(" and ")}.`}),m.push({t:"list",as:"name",columns:1,groups:[{items:b.map(g=>D(g,"name",1))}]})}else{f="derived";let b=A.nodesOfKind(a.kind).filter(g=>E(u.tryDefinition(a.kind),g));m.push({t:"heading",level:1,text:a.title}),b.length===0?m.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${V(u,a.kind,0)} yet.`}):m.push({t:"list",as:"row",columns:1,groups:[{items:b.map(g=>D(g,"row",1))}]})}}let M=r.kind==="system"?"the system":(r.roles??[]).length>0?(r.roles??[]).join(", "):r.kind,K=l<Oe?"phone":"wide",I=P.kind===null?Fe(u,A):[],ee={...o?{masthead:o}:{},...I.length>0?{facts:I}:{},place:P,seat:M,width:l,variant:K,drawnBy:f,parts:m,problems:N};return{ok:!0,description:{...ee,text:De(ee)}}}function Fe(t,r){let n=be(t,r,null),s=e=>Array.isArray(e)?e.map(s).join(", "):e===null?"nothing":typeof e=="boolean"?e?"yes":"no":typeof e=="object"?e.label:String(e);return[...ge(t)].map(([e,l])=>{let i=l.label??te(e);return Object.hasOwn(n.values,e)?{name:e,label:i,value:s(n.values[e])}:{name:e,label:i,refused:n.refused[e]??"it could not be worked out"}})}function V(t,r,n){let s=t.tryDefinition(r);if(n===1)return s?.noun??r;let e=oe(t,r);return e.charAt(0).toLowerCase()+e.slice(1)}function De(t){let r=[`${t.place.title} (${t.place.address}) \u2014 as ${t.seat}, ${t.width} wide (${t.variant}).`],n=t.masthead;n&&r.push(`Masthead: ${n.logo?`the logo ("${n.logo.alt}", ${n.logo.drawn==="image"?n.logo.src:"inline SVG"}), `:""}${n.name}${n.subtitle?` \u2014 ${n.subtitle}`:""}`);let s=(e,l)=>{for(let i of e)switch(i.t){case"heading":r.push(`${l}${"#".repeat(i.level)} ${i.text}`);break;case"text":r.push(`${l}${i.text}`);break;case"badge":r.push(`${l}[${i.text}]`);break;case"field":case"progress":r.push(`${l}${i.label}: ${i.text}`);break;case"figure":r.push(`${l}${i.text}${i.label?` \u2014 ${i.label}`:""}`);break;case"list":if(i.groups.length===0){i.empty&&r.push(`${l}(${i.empty})`);break}for(let y of i.groups){y.heading&&r.push(`${l}${y.heading}:`);for(let u of y.items)r.push(`${l}${y.heading?" ":""}- ${u.title}`),s(u.parts,`${l}${y.heading?" ":" "}`)}i.as==="card"&&i.columns>1&&r.push(`${l}(cards, ${i.columns} across)`),i.more&&r.push(`${l}and ${i.more} more`);break}};if(s(t.parts,""),t.facts){r.push("Facts of the whole graph (what fact('<name>') reads):");for(let e of t.facts)r.push(`- ${e.label} (${e.name}): ${e.value??`not worked out \u2014 ${e.refused}`}`)}if(t.problems.length>0){r.push("Problems:");for(let e of t.problems)r.push(`- ${e.at}: ${e.says}`)}return r.join(`
|
|
2
|
+
`)}export{L as a,U as b,Q as c,xe as d,ve as e,$e as f,Z as g,Ge as h,De as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as lt}from"./chunk.SBHVVJY7.js";import{f as it}from"./chunk.GE5EAN36.js";import{a as M,e as q,n as st}from"./chunk.337WDTG3.js";import{$ as tt,D as Y,E as Q,F as G,Nb as at,Pa as ot,Q as T,T as V,W as X,Z as k,ga as nt,ha as et,ka as rt}from"./chunk.MKNXV4TM.js";import"./chunk.AJZBJBMO.js";function _(t){let e=[],n=!0;for(let r of t){if(r.text.length===0)continue;let a=r.as==="close"||r.text===","||r.text===":"||r.text.startsWith("'")||n;e.push({part:r,space:!a}),n=r.as==="open"}return e}function F(t,e){return _(t).map(({part:n,space:r})=>`${r?" ":""}${e?n.said??n.text:n.text}`).join("")}function xt(t){return F(t,!1)}function bt(t){return F(t,!0)}function ut(t,e=!1){let n=e?t.said:t.text;return t.record!==void 0?`${t.record} \u2014 ${n}`:n}function J(t){let e=u=>_(u).map(({part:o,space:s})=>({...o,space:s})),n=e(t.parts),r=t.when&&t.when.length>0?e(t.when):void 0,a=u=>`${F(n,u)}${r?`, when ${F(r,u)}`:""}`;return{...t,parts:n,...r?{when:r}:{},text:a(!1),said:a(!0)}}function Rt(t,e=!1){return t.line?ut(t.line,e):t.message}var ft=60,L=t=>({text:t,as:"name"}),d=(t,e)=>e===void 0?{text:t,as:"word"}:{text:t,as:"word",said:e},P=(t,e)=>e===void 0||e===t?{text:t,as:"value"}:{text:t,as:"value",said:e},b=(t,e)=>({text:t,as:"op",said:e}),R={text:"(",as:"open"},w={text:")",as:"close"},N={text:"\u2014",as:"value",said:"empty"},K={">=":["\u2265","at least"],"<=":["\u2264","at most"],"<":["<","less than"],">":[">","more than"],"==":["=","is"],"!=":["\u2260","is not"]},z={">=":"<","<=":">","<":">=",">":"<=","==":"!=","!=":"=="},wt={"+":["+","plus"],"-":["\u2212","minus"],"*":["\xD7","times"],"/":["\xF7","divided by"],"%":["mod","modulo"]},dt=t=>t.t==="binary"&&t.op in K;function D(t){return t.length>1&&t[1]===t[1].toUpperCase()&&/[A-Z]/.test(t[1])?t:t.charAt(0).toLowerCase()+t.slice(1)}function pt(t){let{schema:e}=t,n=i=>i===null?void 0:e.tryDefinition(i),r=(i,c)=>{let y=n(i)?.edges;return y&&Object.hasOwn(y,c)?y[c]:void 0},a=(i,c)=>{let y=r(i,c)?.to;return Array.isArray(y)&&y.length===1?y[0]:null},u=(i,c)=>{let y=(e.edge(c)?.from??[]).filter(A=>{let $=r(A,c)?.to;return i===null||$==="*"||Array.isArray($)&&$.includes(i)});return y.length===1?y[0]:null},o=(i,c)=>r(i,c)?V(c).toLowerCase():D(k(n(i),c)),s=i=>D(X(e,i)),p=i=>D(it(e).get(i)?.label??V(i)),x=i=>D(tt(n(i),i)),l=(i,c)=>{let y=i===null?void 0:t.formatOf?.(i,c);if(y?.format)return y;let A=t.said?.get(c);return A?{...y,format:A}:y},m=i=>T(e.tryDefinition(i.kind),i),g=(i,c)=>{if(i==null)return N;if(i instanceof M){if(i.nodes.length===0)return N;let v=i.nodes.slice(0,3).map(m),H=i.nodes.length-v.length;return P(H>0?`${v.join(", ")} and ${H} more`:v.length>1?`${v.slice(0,-1).join(", ")} and ${v[v.length-1]}`:v[0])}if(Array.isArray(i))return P(`{${i.map(v=>g(v,c).text).join(", ")}}`,i.map(v=>g(v,c).text).join(" or "));if(typeof i=="object")return P(m(i));if(typeof i=="boolean")return P(i?"yes":"no");let y=c?.format??(c?l(c.kind,c.key):void 0);if(typeof i=="number"){if(y?.format==="money")return P(st(i,{...t.money,...y.unit&&/^[A-Z]{3}$/.test(y.unit)?{currency:y.unit}:{}}));if(y?.format==="percent")return P(`${Math.round(i*100)}%`);let v=i.toLocaleString("en-US",{maximumFractionDigits:2});return P(y?.unit&&!/^[A-Z]{3}$/.test(y.unit)?`${v} ${y.unit}`:v)}if(Y.test(i)||y?.format==="date")return P(G(i.slice(0,10)));let A=c&&c.kind!==null?n(c.kind)?.display?.format?.[c.key]:void 0;if(A)return P(A(i));let $=i.length>ft?`${i.slice(0,ft-1).trimEnd()}\u2026`:i;return P(/^[a-z][a-z0-9]*([-_][a-z0-9]+)*$/.test($)?$.replace(/[-_]+/g," "):$)};return{definition:n,relation:r,farOf:a,nearOf:u,fieldName:o,plural:s,noun:x,factName:p,formatOf:l,valueWords:g}}function E(t,e,n){if(t.t==="ident")return{kind:e,key:t.name};if(t.t==="member")return{kind:O(t.object,e,n),key:t.name};if(t.t==="call"&&(t.fn==="sum"||t.fn==="min"||t.fn==="max")&&t.args.length===2){let r=O(t.args[0],e,n),a=t.args[1];if(a.t==="ident")return{kind:r,key:a.name};if(a.t==="lit"&&typeof a.value=="string")return{kind:r,key:a.value}}if(t.t==="binary"&&(t.op==="+"||t.op==="-"))return E(t.left,e,n)??E(t.right,e,n);if(t.t==="call"&&t.fn==="if"&&t.args.length===3)return E(t.args[1],e,n)??E(t.args[2],e,n)}function O(t,e,n){switch(t.t){case"ident":return n.relation(e,t.name)?n.farOf(e,t.name):null;case"member":return n.farOf(O(t.object,e,n),t.name);case"where":return O(t.set,e,n);case"binary":return t.op==="|"||t.op==="&"||t.op==="-"?O(t.left,e,n):null;case"call":{let r=a=>{let u=t.args[a];return u?.t==="lit"&&typeof u.value=="string"?u.value:void 0};return t.fn==="all"?r(0)??null:t.fn==="out"?t.args.length===2?n.farOf(O(t.args[0],e,n),r(1)??""):n.farOf(e,r(0)??""):t.fn==="in"?t.args.length===2?n.nearOf(O(t.args[0],e,n),r(1)??""):n.nearOf(e,r(0)??""):(t.fn==="first"||t.fn==="sort")&&t.args[0]?O(t.args[0],e,n):null}default:return null}}function S(t){return t.t==="binary"?t.op==="||"?B(t)?4:1:t.op==="&&"?2:t.op in K||t.op==="in"?4:t.op==="+"||t.op==="-"?5:t.op==="*"||t.op==="/"||t.op==="%"?6:4.5:t.t==="unary"&&t.op==="!"?3:t.t==="where"?3.5:9}var W=t=>t.t==="lit",h=(t,e)=>t.t==="call"&&t.fn===e;function C(t,e){return t.t==="binary"&&t.op===e?[...C(t.left,e),...C(t.right,e)]:[t]}function B(t){if(t.t!=="binary"||t.op!=="||")return;let e=[];e.push(...C(t,"||"));let n,r=[];for(let a of e){if(a.t!=="binary"||a.op!=="=="||!W(a.right)||typeof a.right.value!="string"||n&&JSON.stringify(ct(n))!==JSON.stringify(ct(a.left)))return;n=a.left,r.push(a.right)}return n?{subject:n,values:r}:void 0}var ct=t=>JSON.parse(JSON.stringify(t,(e,n)=>e==="at"?void 0:n));function f(t,e,n,r){let a=(u,o,s=e)=>S(u)<o?[R,...f(u,s,n),w]:f(u,s,n);switch(t.t){case"lit":return[n.valueWords(t.value,r)];case"list":return[n.valueWords(t.items.map(u=>u.t==="lit"?u.value:null),r)];case"ident":return[L(n.fieldName(e,t.name))];case"member":{let u=h(t.object,"first")&&t.object.args[0]&&h(t.object.args[0],"all"),o=O(t.object,e,n);if(u&&o)return e!==null&&n.fieldName(e,t.name)===n.fieldName(o,t.name)&&n.definition(e)?.fields?.shape&&Object.prototype.hasOwnProperty.call(n.definition(e).fields.shape,t.name)?[L(`${n.noun(o)}'s ${n.fieldName(o,t.name)}`)]:[L(n.fieldName(o,t.name))];let s=f(t.object,e,n),p=s[s.length-1];return s.length===1&&p?.as==="name"?[L(`${p.text}'s ${n.fieldName(o,t.name)}`)]:[...s,d("'s"),L(n.fieldName(o,t.name))]}case"unary":return t.op==="-"?[b("\u2212","minus"),...a(t.operand,7)]:I(t.operand,e,n);case"where":{let u=O(t.set,e,n),o=f(t.filter,u,n),s=o.every(p=>p.as==="name"||p.as==="word"&&p.text==="not");return[...a(t.set,4),...s?[]:[d("with")],...S(t.filter)<=2?[R,...o,w]:o]}case"binary":return mt(t,e,n);case"call":return vt(t,e,n)}}function I(t,e,n){return dt(t)?mt({...t,op:z[t.op]},e,n):h(t,"present")||h(t,"exists")?[...f(t.args[0],e,n),b("=","is"),N]:t.t==="ident"?[d("not"),L(n.fieldName(e,t.name))]:[d("not"),R,...f(t,e,n),w]}function mt(t,e,n){let r=(o,s)=>S(o)<s?[R,...f(o,e,n),w]:f(o,e,n);if(t.op==="&&"||t.op==="||"){let o=B(t);if(o){let p=E(o.subject,e,n);return[...f(o.subject,e,n),b("\u2208","is one of"),n.valueWords(o.values.map(x=>x.value),p)]}let s=t.op==="&&"?2:1;return[...r(t.left,s),d(t.op==="&&"?"and":"or"),...r(t.right,s+.5)]}if(t.op in K){if(W(t.right)&&typeof t.right.value=="boolean"&&(t.op==="=="||t.op==="!="))return t.op==="=="===t.right.value?f(t.left,e,n):I(t.left,e,n);let[o,s]=K[t.op],p=E(t.left,e,n),x=E(t.right,e,n);return[...j(t.left,e,n,x),b(o,s),...j(t.right,e,n,p)]}if(t.op==="in")return[...r(t.left,5),b("\u2208","is one of"),...j(t.right,e,n,E(t.left,e,n))];let a=wt[t.op];if(a){let o=S(t);return[...r(t.left,o),b(a[0],a[1]),...r(t.right,o+.5)]}let u={"|":"or","&":"and also","-":"except"};return[...r(t.left,5),d(u[t.op]??t.op),...r(t.right,5)]}function j(t,e,n,r){return t.t==="lit"||t.t==="list"?f(t,e,n,r):S(t)<5?[R,...f(t,e,n),w]:f(t,e,n)}function vt(t,e,n){let r=o=>t.args[o],a=o=>{let s=t.args[o];return s?.t==="lit"&&typeof s.value=="string"?s.value:void 0},u=o=>{let s=r(o);return S(s)<9&&s.t!=="where"?[R,...f(s,e,n),w]:f(s,e,n)};switch(t.fn){case"out":{let o=a(t.args.length-1)??"",s=L(V(o).toLowerCase());return t.args.length===2?[s,d("of"),...u(0)]:[s]}case"in":{let o=a(t.args.length-1)??"",s=t.args.length===2?n.nearOf(O(r(0),e,n),o):n.nearOf(e,o),p=L(s?n.plural(s):V(o).toLowerCase());return t.args.length===2?[p,d("of"),...u(0)]:[p]}case"all":{let o=a(0);return[L(o?n.plural(o):"everything")]}case"fact":{let o=a(0);return[L(o?n.factName(o):"fact")]}case"count":return[d("number of"),...u(0)];case"exists":return[...u(0),b("\u2260","is not"),N];case"present":return[...f(r(0),e,n),b("\u2260","is not"),N];case"some":case"every":{let o=O(r(0),e,n),s=r(1);return[...t.fn==="some"?[d("some")]:[],...u(0),d(t.fn==="some"?"with":"all with"),...S(s)<=2?[R,...f(s,o,n),w]:f(s,o,n)]}case"sum":case"min":case"max":{let o=O(r(0),e,n),s=r(1),p=s.t==="lit"&&typeof s.value=="string"?[L(n.fieldName(o,s.value))]:S(s)<9?[R,...f(s,o,n),w]:f(s,o,n);return[d(t.fn==="sum"?"total":t.fn==="min"?"least":"most"),...p,d("of"),...u(0)]}case"first":{let o=r(0);if(h(o,"all")){let s=o.args[0]?.value;if(typeof s=="string")return[L(`the ${n.noun(s)}`)]}return[d("first of"),...u(0)]}case"sort":return[...u(0),d("by"),...f(r(1),O(r(0),e,n),n)];case"len":return[d("length of"),...f(r(0),e,n)];case"lower":return f(r(0),e,n);case"contains":case"startsWith":return[...f(r(0),e,n),d(t.fn==="contains"?"contains":"starts with"),...j(r(1),e,n,E(r(0),e,n))];case"today":return[P("today")];case"now":return[P("now")];case"date":return W(r(0))&&typeof r(0).value=="string"?[P(G(String(r(0).value)))]:f(r(0),e,n);case"days":case"hours":{let o=t.fn,[s,p]=[r(0),r(1)];return h(p,"today")||h(p,"now")?[d(`${o} since`),...f(s,e,n)]:h(s,"today")||h(s,"now")?[d(`${o} until`),...f(p,e,n)]:[d(`${o} from`),...f(s,e,n),d("to"),...f(p,e,n)]}case"if":return[R,...f(r(1),e,n),d("if"),...f(r(0),e,n),d(","),d("else"),...f(r(2),e,n),w];case"either":return t.args.flatMap((o,s)=>s===0?f(o,e,n):[d(","),d("else"),...f(o,e,n)]);default:return[d(t.fn),R,...t.args.flatMap((o,s)=>s===0?f(o,e,n):[d(","),...f(o,e,n)]),w]}}function U(t,e){let n=pt(e),r=t.over==="graph"?null:t.over;return J({...r===null?{}:{kind:r},parts:f(t.require,r,n),...t.when?{when:f(t.when,r,n)}:{}})}function Z(t,e,n){let r=pt(e),a=t.over==="graph"?null:t.over,u=n.subject,o=l=>{try{return q(l,{...n,budget:2e3})}catch{return}},s=(l,m)=>{let g=j(l,a,r,m);if(l.t==="lit"||l.t==="list"||h(l,"today")||h(l,"now")||h(l,"date"))return g;let i=o(l);if(i===void 0)return g;let c=E(l,a,r),y=r.valueWords(i,c?{...c,format:r.formatOf(c.kind,c.key)??(m?r.formatOf(m.kind,m.key):void 0)}:m);return i instanceof M?[...g,d(":"),y]:[...g,y]},p=l=>{if(l.t==="binary"&&l.op==="&&"){let m=[];m.push(...C(l,"&&"));let g=m.filter(i=>o(i)!==!0);return(g.length>0?g:m).flatMap((i,c)=>[...c>0?[d("and")]:[],...S(i)<=2?[R,...p(i),w]:p(i)])}if(l.t==="binary"&&l.op==="||"){let m=B(l);if(m){let i=E(m.subject,a,r);return[...s(m.subject),b("\u2209","is not one of"),r.valueWords(m.values.map(c=>c.value),i)]}let g=[];return g.push(...C(l,"||")),g.flatMap((i,c)=>[...c>0?[d("and")]:[],...S(i)<=2?[R,...p(i),w]:p(i)])}if(l.t==="binary"&&l.op in K){if(W(l.right)&&typeof l.right.value=="boolean"&&(l.op==="=="||l.op==="!="))return l.op==="=="===l.right.value?I(l.left,a,r):f(l.left,a,r);let m=z[l.op],[g,i]=K[m],c=E(l.left,a,r),y=E(l.right,a,r);if(W(l.right)&&l.right.value===null)return[...m==="=="?j(l.left,a,r,y):s(l.left,y),b(g,i),N];let A=m==="=="&&(W(l.right)||W(l.left));return[...A?j(l.left,a,r,y):s(l.left,y),b(g,i),...A?j(l.right,a,r,c):s(l.right,c)]}if(l.t==="binary"&&l.op==="in")return[...s(l.left),b("\u2209","is not one of"),...j(l.right,a,r,E(l.left,a,r))];if(l.t==="unary"&&l.op==="!"){let m=l.operand;return dt(m)?p({...m,op:z[m.op]}):h(m,"present")||h(m,"exists")?[...s(m.args[0]),b("\u2260","is not"),N]:m.t==="ident"?f(m,a,r):[d("not"),R,...I(m,a,r),w]}if(h(l,"present")||h(l,"exists"))return[...f(l.args[0],a,r),b("=","is"),N];if(h(l,"some"))return[...f(l,a,r).slice(1),b("=","is"),N];if(h(l,"every")&&l.args.length===2){let m=o(l.args[0]);if(m instanceof M){let g=m.nodes.filter(i=>{try{return q(l.args[1],{...n,subject:i,budget:2e3})!==!0}catch{return!0}});return[...f(l,a,r),d(","),d("not"),r.valueWords(new M(g))]}}return l.t==="ident"?[d("not"),L(r.fieldName(a,l.name))]:[d("not"),R,...f(l,a,r),w]},x;try{x=p(t.require)}catch{x=[d("not"),R,...f(t.require,a,r),w]}return J({...a===null?{}:{kind:a},parts:x,...u?{record:T(e.schema.tryDefinition(u.kind),u)}:{}})}function yt(t){let e=new Map;for(let n of t??[])n.expr?.t==="ident"&&n.format&&(n.format==="money"||n.format==="percent"||n.format==="date")&&e.set(n.expr.name,n.format);return e}function Ot(t){return(e,n)=>{let r=t[e]?.fields?.[n],a=r?.format??(r?.type==="date"?"date":void 0);return a||r?.unit?{...a?{format:a}:{},...r?.unit?{unit:r.unit}:{}}:void 0}}function ht(t,e){return{schema:e,said:yt(t.says),...t.declared?{formatOf:Ot(t.declared)}:{},...t.money?{money:t.money}:{}}}function Jt(t,e){return t.shape?U(t.shape,ht(t.shape,e)):void 0}var gt=new WeakMap;function Et(t,e){let n=new Map(t.allInvariants().map(r=>[r.name,r]));return e.map(r=>{let a=At(r),u=n.get(a.invariant)?.shape;if(!u||a.status&&a.status!=="violated")return a;let o=a.subjectId?t.graph.getNode(a.subjectId):void 0;if(u.over!=="graph"&&!o)return a;let s=u.kinds;s||(s=gt.get(t.schema),s||gt.set(t.schema,s=lt(t.schema)));try{let p=u.today?.()??t.today?.()??Q(),x=Z(u,ht(u,t.schema),{graph:t.graph,subject:o??null,kinds:s,today:p});return{...a,line:x,...u.says?{}:{message:`${a.message} \u2014 ${x.text}`}}}catch{return a}})}function Pt(){rt((t,e,n)=>Et({graph:t,schema:t.schema,allInvariants:()=>e},n)),ot(Lt)}function Lt(t,e,n,r){let a=e.graph,u=et.from(t.schema,a.snapshot(),{validate:!1});for(let x of n?[...r].reverse().map(nt):r)try{u.applyPrimitives([x],{restoring:!0})}catch{}let o=x=>t.violations(void 0,x),s=o(n?u:a),p=o(n?a:u);return{...at(t.allInvariants(),s,p),violationsAfter:p}}function At(t){if(!t.line)return t;let{line:e,...n}=t,r=` \u2014 ${e.text}`;return n.message.endsWith(r)?{...n,message:n.message.slice(0,-r.length)}:n}Pt();export{Z as brokenLineOf,Pt as judgeWithLines,Lt as judgedForASeat,Rt as problemWords,Jt as ruleLine,U as ruleLineOf,ut as ruleLineWords,_ as ruleSpacing,bt as ruleSpoken,xt as ruleText,At as unlined,Et as withLines};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Y}from"./chunk.
|
|
1
|
+
import{a as Y}from"./chunk.4H7CQE56.js";import"./chunk.W3LDQ6B2.js";import{a as E,c as H,e as V,f as _}from"./chunk.PWHJHFC4.js";import"./chunk.EYF6ONTA.js";import"./chunk.Q3HVA6L4.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.6LJ66MB7.js";import{D as W,c as M,da as w,va as G,ya as B}from"./chunk.NRRUGG22.js";import{Q as L,T as O,X as T}from"./chunk.MKNXV4TM.js";import{a as U,b as k}from"./chunk.MRK6QJV5.js";import{b as y}from"./chunk.AJZBJBMO.js";function A(t){return{minHeight:24,padding:"3px 10px",borderRadius:6,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:t?"transparent":"var(--graview-edge)",color:t?"var(--graview-ink)":"var(--graview-ink-muted)",fontWeight:t?600:400,background:t?"color-mix(in srgb, var(--graview-accent) 16%, transparent)":"transparent"}}var P=y(k(),1);function j(){let{seats:t,principal:r,takeSeat:i}=w();return t.length<2?null:(0,P.jsxs)("div",{role:"group","aria-label":"Seat","data-testid":"seats",style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,rowGap:4},children:[(0,P.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"As"}),t.map(a=>{let l=q(r,a.principal);return(0,P.jsx)("button",{type:"button","aria-pressed":l,"data-testid":`seat-${a.principal.id??a.label}`,title:`Sit down as ${a.label}: the acts, the kinds and the pages narrow to what this seat may do`,onClick:()=>i(a.principal),style:{...A(l),whiteSpace:"nowrap"},children:a.label},a.principal.id??a.label)})]})}function q(t,r){return t.kind===r.kind&&t.id===r.id}var z=y(U(),1),o=y(k(),1),J=`
|
|
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)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as G}from"./chunk.TBG2QBOS.js";import{Ba as W,Mb as V,Oa as j,S as B,_a as F,ca as C,fb as U,g as z,gb as q,ta as L,za as x}from"./chunk.MKNXV4TM.js";function K(e){return z(e,{io:"input",unrepresentable:"any",override:ae})}var re={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"};function ae(e){let n=e.zodSchema._zod?.def;if(!n||n.type!=="string"||typeof n.format!="string"||n.format==="regex")return;let t=e.jsonSchema,f=(n.checks??[]).map(s=>s._zod?.def).filter(s=>s?.format==="regex"&&s.pattern instanceof RegExp).map(s=>s.pattern.source);delete t.pattern;let l=t.allOf;Array.isArray(l)&&l.every(s=>typeof s=="object"&&s!==null&&Object.keys(s).length===1&&"pattern"in s)&&delete t.allOf,t.format=re[n.format]??n.format,f.length===1?t.pattern=f[0]:f.length>1&&(t.allOf=f.map(s=>({pattern:s})))}function _(e){let n=x(e.input),t=K(e.input),f=t.properties??{};if(U(e)){let l=e.creates.join(" | ");f.id={type:"string",minLength:1,description:`Optional: the id for the ${l} this makes. Refused if the graph already has it; left out, one is minted from the label.`},t.properties=f}q(e)&&(t.additionalProperties=!1);for(let l of n){let s=f[l.name];if(!s)continue;let k=l.kinds.includes("*")?"any node kind":l.kinds.join(" | ");s.description=[s.description,`Id of a node (${k}).`].filter(Boolean).join(" ")}return{name:e.name,...e.title===void 0?{}:{title:e.title},description:e.description??e.title??e.name,inputSchema:t,nodeRefs:n}}function Z(e){let n=new Set;for(let t=e;t;t=t.onBehalfOf)t.id!==void 0&&n.add(`${t.kind}:${t.id}`);return n}function O(e,n){let t=Z(n),f=y=>{if(y.kind==="rule")return!1;let m=Z(y);if(m.size===0)return!1;for(let h of m)if(t.has(h))return!1;return!0},l,s=()=>{if(l)return l;l=new Map;for(let y of e.log.live()){if(y.undoes!==void 0)continue;let m=f(y.author)?y.author:void 0;for(let h of y.primitives){h.op==="remove-node"&&l.delete(h.node.id);let i=h.op==="add-node"?h.node.id:h.op==="patch-node"?h.id:void 0;if(i===void 0)continue;let r=h.op==="add-node"?Object.keys(h.node):Object.keys(h.after),c=l.get(i);(h.op==="add-node"||!c)&&l.set(i,c=new Map);for(let p of r)p==="id"||p==="kind"||(m?c.set(p,m):c.delete(p))}}return l},k=e.schema,g=new Map,v=(y,m)=>{let h=`${y}\0${m}`,i=g.get(h);if(i===void 0){let r=k.tryDefinition(y)?.fields?.shape;i=r!==void 0&&m in r&&W(r[m]).type==="text",g.set(h,i)}return i},b=y=>e.graph.getNode(y)?.kind;return{prose:v,say:y=>C(y,{graph:e.graph,schema:k}),fieldBy(y,m){let h=b(y);if(!(h===void 0||!v(h,m)))return s().get(y)?.get(m)},recordBy(y){let m=b(y),h=s().get(y);if(m===void 0||!h)return;let i;for(let[r,c]of h)v(m,r)&&(i=c);return i}}}var D=(e,n,t)=>({untrusted:!0,authoredBy:t.say(n),text:e});function I(e,n){return{...e,hits:e.hits.map(t=>{if(t.about!=="node")return t;let f=n.recordBy(t.id);if(!f)return t;let l=n.prose(t.kind,t.why.field)?n.fieldBy(t.id,t.why.field):f;return{...t,label:D(t.label,f,n),...t.apart!==void 0?{apart:D(t.apart,f,n)}:{},why:l?{...t.why,fragment:D(t.why.fragment,l,n)}:t.why}})}}var J=e=>{let n;return()=>n??=e().catch(t=>{throw n=void 0,t})},se=J(()=>import("./chunk.DAVRLRGB.js")),de=()=>import("./chunk.IBGO4BUF.js").catch(()=>{}),le=async()=>{(await de())?.judgeWithLines()},R=J(()=>import("./chunk.YETBY2LM.js")),ce=J(()=>import("./chunk.WCNONCTL.js")),S=e=>({title:e,readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}),M={type:"number",description:"Where the page starts; 0 when unsaid."},P=[{name:"search_graph",title:"Find by name",description:"Find things by name: records whose name or readable fields carry the words, and the kinds, places and rules the words name \u2014 each with why it matched. Reach for this before get_graph when you know what something is called. Words match the start of words, case and accents aside; key:value tokens narrow as a list's filter does (done:false, is:any for past records, kind:<kind>). Pass subject (a node id) to get the acts you may run on it as hits too.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Words, with optional key:value conditions."},limit:{type:"number",description:"Most hits to return; at most 20."},subject:{type:"string",description:"A node id whose acts to include."}},required:["query"],additionalProperties:!1},mutating:!1,annotations:S("Find by name")},{name:"get_graph",title:"Read the graph",description:"Read the graph, 25 nodes a page: their fields, the edges out of them, and how many more. Start here when you need the shape of the domain rather than one thing in it.",inputSchema:{type:"object",properties:{offset:M},additionalProperties:!1},mutating:!1,annotations:S("Read the graph")},{name:"get_node",title:"Read one node",description:"Read one node: its fields, its links (id, kind and label, 20 each way a page), the violations that implicate it, and its computed values: read-only fields worked out from what you can see, which no act sets. Use this to check a thing before you change it.",inputSchema:{type:"object",properties:{id:{type:"string",description:"A node's id, or its name."},offset:M},required:["id"],additionalProperties:!1},mutating:!1,annotations:S("Read one node")},{name:"get_violations",title:"List the problems",description:"List the invariant violations the graph currently has, 20 a page, with the repairs that would resolve each one. Read this before proposing work: a rule that is already broken is more urgent than anything you could add.",inputSchema:{type:"object",properties:{offset:M,context:{type:"object",description:"Evaluation context, e.g. { weekStart }."}},additionalProperties:!1},mutating:!1,annotations:S("List the problems")},{name:"get_affordances",title:"Ask what can be done",description:"Ask what can legally be done with a selection, ranked. Prefer these over composing a mutation by hand: they are derived from the schema, the invariants and the shape of the graph, so they cannot name an action that does not exist.",inputSchema:{type:"object",properties:{selection:{type:"array",items:{type:"string"},description:"Node ids."},context:{type:"object"}},required:["selection"],additionalProperties:!1},mutating:!1,annotations:S("Ask what can be done")},{name:"describe_place",title:"Say what a place shows",description:`Say what one place of the app shows you, as a person in your seat would see it: its headings, its figures as drawn, its lists with each record's title and what its card or row says, the headings a list is grouped under, what an empty list says, and any block that could not be worked out. Pass a place's slug ("home", a lens's address like "the-offers", a kind's like "offers") or a record's id, and width 390 for a phone. Use it after a change to check what somebody now sees, instead of guessing.`,inputSchema:{type:"object",properties:{place:{type:"string",description:`"home", a place's slug, or a record's id.`},width:{type:"number",description:"The screen's width in CSS pixels; 390 is a phone, 1440 when unsaid."}},required:["place"],additionalProperties:!1},mutating:!1,annotations:S("Say what a place shows")},{name:"preview_mutation",title:"Try an act without applying it",description:"Try a mutation without applying it: get back the diff it would produce and any invariant it would break. Do this when you are unsure, rather than applying and undoing.",inputSchema:{type:"object",properties:{mutation:{type:"string"},args:{type:"object"}},required:["mutation","args"],additionalProperties:!1},mutating:!1,annotations:S("Try an act without applying it")},{name:"undo_batch",title:"Undo a batch",description:"Undo one batch of operations. Fails, naming the blocking operation, when a later operation read what it wrote.",inputSchema:{type:"object",properties:{batch:{type:"string"},include:{type:"array",items:{type:"string"}}},required:["batch"],additionalProperties:!1},mutating:!0,annotations:{title:"Undo a batch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}}],N={type:"object",description:"A lens, as draft_view returns one.",properties:{title:{type:"string"},lens:{type:"string"},on:{type:"string"},bindings:{type:"object"},options:{type:"object"}},required:["title","lens","on"]},$={name:"draft_view",title:"Draw a view",description:'Draw a view of the data from words ("a board of tasks by status", "who covers what") as a lens the app could keep; or check a lens you wrote (lens); or change the one on screen (current, with ask: "only this month"). Returns the lens and its add-lens edit, or one sentence saying why not. Writes nothing.',inputSchema:{type:"object",properties:{ask:{type:"string",description:"What to see, in words."},lens:N,current:N},additionalProperties:!1},mutating:!1,annotations:S("Draw a view")},Y={name:"keep_lens",title:"Keep a view as a lens",description:"Keep a lens draft_view drew as one of the app's places: checked again, then written as the add-lens edit. Returns the remove-lens edit that takes it back.",inputSchema:{...N,additionalProperties:!1},mutating:!0,annotations:{title:"Keep a view as a lens",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}};function ue(e,n){return e===void 0?[]:e==="keep"&&!n?[$,Y]:[$]}var fe="An argument that names a record takes its id or its name.",Q=[...P.map(e=>e.name),$.name,Y.name],ee=64;function T(e){let{line:n,...t}=e;return t}function X(e){return{...e,...e.introduces?{introduces:e.introduces.map(T)}:{},...e.resolves?{resolves:e.resolves.map(T)}:{},...e.violationsAfter?{violationsAfter:e.violationsAfter.map(T)}:{}}}function pe(e){let n=e.normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^A-Za-z0-9_-]/g,"_");return n.length===0&&(n="act"),/^[A-Za-z_]/.test(n)||(n=`act_${n}`),n.slice(0,ee)}function he(e){let n=new Set(Q),t=new Map;for(let f of e){let l=pe(f),s=l;for(let k=2;n.has(s);k+=1)s=`${l.slice(0,ee-`_${k}`.length)}_${k}`;n.add(s),t.set(f,s)}return t}function ye(e,n){let t=_(e),f=B(e),l=t.nodeRefs.length>0?`${t.description}${/[.!?]$/.test(t.description)?"":"."} ${fe}`:t.description;return{name:n,title:f,description:l,inputSchema:t.inputSchema,mutating:!0,annotations:{title:f,readOnlyHint:!1,destructiveHint:e.destructive===!0||(e.severs?.length??0)>0,idempotentHint:e.idempotent===!0,openWorldHint:!1},act:e.name}}function H(e){if(e===null||typeof e!="object")return JSON.stringify(e)??"null";if(Array.isArray(e))return`[${e.map(H).join(",")}]`;let n=e;return`{${Object.keys(n).filter(t=>n[t]!==void 0).sort().map(t=>`${JSON.stringify(t)}:${H(n[t])}`).join(",")}}`}function me(e){return`sha256:${V(H(e))}`}function ge(e,n,t,f){let l=he(e.map(g=>g.name)),s=ue(f,t);return{definitions:t?[...P.filter(g=>!g.mutating),...s]:[...P,...s,...e.filter(g=>n.has(g.name)).map(g=>ye(g,l.get(g.name)))],names:l}}function Fe(e,n={}){let t=n.author??{kind:"agent"},f=e.allMutations(),l=new Set(e.permittedMutations(t).map(i=>i.name)),{definitions:s,names:k}=ge(f,l,n.readOnly===!0,n.drafts?n.drafts.keep?"keep":"draw":void 0),g=me(s),v=i=>{if(!Q.includes(i)){for(let[r,c]of k)if(c===i)return r;return k.has(i)?i:void 0}},b=(i,r)=>{let c=f.find(a=>a.name===i);if(!c)return{args:r,resolved:[]};let p={...r},o=[];for(let a of x(c.input)){let d=p[a.name];if(typeof d!="string"||d.trim()==="")continue;let u=e.resolveRef(a,d,t);if(!u.ok){let w=u.reason==="none"?` Nothing was changed. Use search_graph to look it up, then pass its id as ${a.name}.`:" Nothing was changed.";return{ok:!1,error:`${u.message}${w}`,argument:a.name,candidates:u.candidates}}u.by!=="id"&&(p[a.name]=u.id,o.push({argument:a.name,given:d,id:u.id,label:u.label}))}return{args:p,resolved:o}},y=async(i,r)=>{try{await le();let c=s.find(o=>o.name===i)??s.find(o=>o.act===i);if(!c){let o=v(i);if(o){let a=e.permits({name:o,args:r},t);if(!a.ok)return{ok:!1,error:a.refusal.message,reason:"forbidden"}}return{ok:!1,error:`Unknown tool "${i}". Available: ${s.map(a=>a.name).join(", ")}`}}if(c.mutating&&n.readOnly)return{ok:!1,error:`"${i}" changes the graph, and this seat is read-only.`,reason:"forbidden"};if(c.act!==void 0){let o=b(c.act,r);if("ok"in o)return o;let a=j(e,t,e.apply({name:c.act,args:o.args},{...n.author?{author:n.author}:{},...we(n.via)}));return{ok:!0,data:{batch:a.batch,intent:a.intent,introduces:a.introduces.map(T),resolves:a.resolves.map(T),...o.resolved.length>0?{resolved:o.resolved}:{}},diff:a.diff}}let p=e.seenBy(t);switch(c.name){case"search_graph":{let o=typeof n.places=="function"?n.places():n.places,a=typeof r.subject=="string"?r.subject:void 0,d=F(p,String(r.query??""),{principal:t,limit:typeof r.limit=="number"&&r.limit>0?Math.min(r.limit,20):20,...o?{places:o}:{},...a?{subject:a,from:[a]}:{}});return{ok:!0,data:(await R()).searchRead(d,I(d,O(p,t))),reads:d.hits.flatMap(u=>u.about==="node"?[u.id]:[])}}case"get_graph":return{ok:!0,...(await R()).graphRead(p,O(p,t),r)};case"get_node":{let o=String(r.id??""),a=o,d;if(!p.graph.getNode(o)){let w=o.trim()===""?void 0:e.resolveRef({name:"id",kinds:["*"]},o,t);if(w?.ok)a=w.id,d={argument:"id",given:o,id:a,label:w.label};else return w?.reason==="ambiguous"?{ok:!1,error:w.message,argument:"id",candidates:w.candidates}:{ok:!1,error:`No node "${o}".`}}let u=(await R()).nodeRead(p,O(p,t),a,r);return{ok:!0,data:d?{...u.data,resolved:[d]}:u.data,reads:u.reads}}case"describe_place":{let o=n.app??{name:"",schema:e.schema},a=typeof r.width=="number"&&Number.isFinite(r.width)&&r.width>0?r.width:1440,{describePlace:d}=await se(),u=d(e,t,String(r.place??""),{app:o,width:a});if(!u.ok)return{ok:!1,error:`${u.error} The places are: ${u.places.join(", ")}.`};let w=new Set,A=ne=>{for(let te of ne)for(let oe of te.groups??[])for(let E of oe.items)w.add(E.id),A(E.parts)};return A(u.description.parts),{ok:!0,data:u.description,reads:[...w]}}case"draft_view":case"keep_lens":{let o=n.app??{name:"",schema:e.schema};return(await ce()).runDraftTool(c.name,r,{app:o,principal:t,...n.drafts?{drafts:n.drafts}:{}})}case"get_violations":{let o=p.violations(r.context);return{ok:!0,...(await R()).violationsRead(o,r)}}case"get_affordances":{let o=r.selection??[];return{ok:!0,data:G(p,o,{...typeof n.derive=="function"?n.derive():n.derive,...n.author?{principal:n.author}:{},...r.context?{context:r.context}:{}}),reads:o.filter(d=>p.graph.has(d))}}case"preview_mutation":{let o=String(r.mutation),a=v(o)??o,d=b(a,r.args??{});if("ok"in d)return d;let u=e.missingFor({name:a,args:d.args},t);if(u)return{ok:!1,error:u.message,reason:"missing"};let w=j(e,t,e.preview({name:a,args:d.args},void 0,{author:t})),A=X(w);return{ok:!0,data:d.resolved.length>0?{...A,resolved:d.resolved}:A}}case"undo_batch":{let o=String(r.batch),a=r.include??[],d=p.canUndo([o,...a]);if(!d.ok)return{ok:!1,error:d.message};let u=j(e,t,e.undo([o,...a],{...n.author?{author:n.author}:{}}));return{ok:!0,data:X(u),diff:u.diff}}default:return{ok:!1,error:`Unknown tool "${i}".`}}}catch(c){let{reason:p,wouldNeed:o}=L(c);return{ok:!1,error:c instanceof Error?c.message:String(c),reason:p,...o?{wouldNeed:o}:{}}}},m=new Set,h=i=>{for(let r of m)r(i)};return{definitions:s,hash:g,...n.author?{author:n.author}:{},onDiff(i){return e.subscribe(i)},onCall(i){return m.add(i),()=>m.delete(i)},async call(i,r){let c=(s.find(d=>d.name===i)??s.find(d=>d.act===i))?.mutating??!1,p={name:i,args:r,mutating:c,at:new Date().toISOString()};h({...p,phase:"running"});let o=d=>(h(d.ok?{...p,phase:"ok",...!c&&d.reads?{reads:d.reads}:{}}:{...p,phase:"failed",error:d.error}),d),a=await y(i,r);return o(a.ok&&!c?{...a,data:(await R()).withinReadChars(i,a.data)}:a)}}}function we(e){let n=typeof e=="function"?e():e;return n?{via:n}:{}}export{H as a,Fe as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ne}from"./chunk.AHDOKM4O.js";import{a as Me}from"./chunk.6LJ66MB7.js";import{da as Ce,ea as Le,qa as He,ra as Ae,va as L,ya as H,za as Re}from"./chunk.
|
|
1
|
+
import{a as Ne}from"./chunk.AHDOKM4O.js";import{a as Me}from"./chunk.6LJ66MB7.js";import{da as Ce,ea as Le,qa as He,ra as Ae,va as L,ya as H,za as Re}from"./chunk.NRRUGG22.js";import{$b as Ee,Cb as ye,Eb as xe,Hb as ke,Ib as $e,Q as se,Ra as U,Ub as Se,Vb as Pe,Wb as Be,X as de,Xb as Te,ca as ce,ma as pe,nb as ge,pb as ue,qb as ve,rb as Z,sb as we,tb as fe,vb as me,wb as he,xb as be}from"./chunk.MKNXV4TM.js";import{a as G,b as E}from"./chunk.MRK6QJV5.js";import{b as $}from"./chunk.AJZBJBMO.js";var w=$(G(),1);var Oe=$(G(),1);var K=$(E(),1);function ze({brand:e,size:a=22}){let t=e?.logo,r=t!==void 0&&me(t)&&he(t)===null?t:void 0,l=Ne(r);if(!t||!be(t))return null;let n=e?.logoAlt??e?.name??"",o=n!==""&&n!==e?.name,c={display:"inline-flex",flex:"0 0 auto",height:a,color:"var(--graview-accent)"};return r?(0,K.jsx)("span",{className:"graview-logo","data-testid":"app-mark",style:c,...o?{role:"img","aria-label":n}:{"aria-hidden":!0},dangerouslySetInnerHTML:l}):(0,K.jsx)("img",{className:"graview-logo","data-testid":"app-mark",src:t,alt:o?n:"",style:{...c,width:"auto"}})}function ja(e){(0,Oe.useEffect)(()=>{if(!e||typeof document>"u")return;let a=[...document.querySelectorAll('link[rel~="icon"]')],t=a.map(l=>l.getAttribute("href")),r;a.length===0&&(r=document.createElement("link"),r.rel="icon",r.setAttribute("data-graview-favicon",""),document.head.appendChild(r),a.push(r));for(let l of a)l.href=e;return()=>{r&&r.remove(),a.forEach((l,n)=>{l!==r&&t[n]!==null&&t[n]!==void 0&&l.setAttribute("href",t[n])})}},[e])}var B=Re(Me(()=>import("./chunk.IDI2BQ7Y.js")));var i=$(E(),1),da=B.part((e,a)=>(0,i.jsx)(e.Here,{...a}),{quiet:!0}),ca="home",pa="/",ga="scene:whole";function er(e){let{store:a,principal:t,views:r}=e,l=a.kindsKeptFrom(t),n=a.schema.kinds.filter(s=>!a.modules.disabledKinds.has(s)&&!l.has(s)),o=r?.arrangement?.(),c=r?.places()??[],p=Be(o,a.schema,c),d=Pe(a.schema,o,[...a.modules.administered.values()].flatMap(s=>s.kinds??[])),u=(s,m)=>(!a.graph.size.nodes||a.graph.count(s)>0)&&(p?m?p.places.has(`${s}|${m}`):p.kinds.has(s):!d.has(s)),g=[{key:ca,label:"Home",path:pa,group:"home",primary:!0}];for(let s of Ee(n,o?.order))g.push({key:`kind:${s}`,label:de(a.schema,s),path:U(a.schema,s),group:"lists",kind:s,primary:u(s)});for(let s of c){if(!n.includes(s.kind)||s.as===Te)continue;let m=c.some(P=>P.as===s.as&&P.kind!==s.kind),b=`/places/${encodeURIComponent(s.as)}${m?`?of=${U(a.schema,s.kind).slice(1)}`:""}`;g.some(P=>P.path===b)||g.push({key:`place:${s.kind}:${s.as}`,label:s.title,path:b,group:"pictures",kind:s.kind,primary:u(s.kind,s.as)})}return n.some(s=>Object.keys(a.schema.tryDefinition(s)?.edges??{}).length>0)&&g.push({key:"connections",label:"Connections",path:"/map",group:"pictures",primary:!1}),g}function ar(e,a){let[t="/",r=""]=a.split("?"),l=e.find(o=>o.path===(r?`${t}?${r}`:t))??e.find(o=>o.path===t);if(l)return l.key;let n=`/${t.split("/").filter(Boolean)[0]??""}`;return e.find(o=>o.group==="lists"&&o.path===n)?.key??null}var ua=(0,w.createContext)(null),rr=()=>(0,w.useContext)(ua),N=30,va=48,_=640,Ie=4,We=2;function wa(e){let{widths:a,current:t,room:r,more:l,gap:n=Ie,primary:o,most:c=Se}=e;if(a.length===0||!(r>0)||!(l>0)||a.some(g=>!(g>0)))return null;let p=(g,f)=>g.reduce((s,m)=>s+a[m],0)+n*Math.max(0,g.length-1)+(f?n+l:0),d=(g,f)=>t<0||!g.includes(t)||g.slice(0,f).includes(t)?g.slice(0,f):[...g.filter(s=>s!==t).slice(0,f-1),t].sort((s,m)=>s-m),u=d(a.map((g,f)=>f).filter(g=>o?.[g]!==!1||g===t),c);if(p(u,u.length<a.length)<=r)return u.length>=We?u:null;for(let g=u.length-1;g>=We;g--){let f=d(u,g);if(p(f,!0)<=r)return f}return null}var fa=`
|
|
2
2
|
.graview-bar{display:block;margin:0;padding:0;container:graview-bar/inline-size;flex:0 0 auto;position:relative;background:var(--graview-bar);border-bottom:1px solid var(--graview-edge);color:var(--graview-ink);font-family:var(--graview-font-body,system-ui)}
|
|
3
3
|
.graview-bar-row{display:flex;flex-wrap:nowrap;align-items:center;gap:16px;height:${va-1}px;margin:0;padding:0 16px}
|
|
4
4
|
.graview-bar-home,.graview-bar-face,.graview-bar-place,.graview-bar-item,.graview-bar-at{display:inline-flex;align-items:center;box-sizing:border-box;min-width:0;margin:0;border:0;background:none;box-shadow:none;font:inherit;letter-spacing:normal;text-transform:none;text-decoration:none;color:var(--graview-ink);cursor:pointer;text-align:left}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as V}from"./chunk.
|
|
1
|
+
import{a as V}from"./chunk.N7HCALRK.js";import{b as K}from"./chunk.ISRS7GOT.js";import{a as ie}from"./chunk.DCIC3YHX.js";import{l as se,m as G}from"./chunk.WHTNSETN.js";import{f as _,g as N,h as B}from"./chunk.6R4EI47C.js";import{a as O,d as ae}from"./chunk.6LJ66MB7.js";import{V as ee,da as M,ea as te,fa as ne,qa as oe,sa as re,za as F}from"./chunk.NRRUGG22.js";import{Cb as Z,Hb as z,X as J,Y as Q}from"./chunk.MKNXV4TM.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.3HLLQ5CJ.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(ie))},[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.JRCV6HVV.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=se(),{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};
|