graview 0.1.27 → 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.
Files changed (73) hide show
  1. package/dist/preview/{chunk.FS5K4AVA.js → chunk.22H4JXTH.js} +1 -1
  2. package/dist/preview/{chunk.7SVIRYBB.js → chunk.25OYH6MY.js} +1 -1
  3. package/dist/preview/{chunk.LHAAZQNQ.js → chunk.2GBQJXJH.js} +1 -1
  4. package/dist/preview/chunk.2VUG6EAN.js +1 -0
  5. package/dist/preview/chunk.337WDTG3.js +2 -0
  6. package/dist/preview/{chunk.UPGDSOBY.js → chunk.3HLLQ5CJ.js} +1 -1
  7. package/dist/preview/{chunk.UMMN5Z6V.js → chunk.46KUPBQC.js} +1 -1
  8. package/dist/preview/{chunk.4R7LDCDO.js → chunk.4H7CQE56.js} +1 -1
  9. package/dist/preview/{chunk.7THQFY52.js → chunk.4RO5DA22.js} +1 -1
  10. package/dist/preview/{chunk.TX2GOL65.js → chunk.4TUNX4WM.js} +1 -1
  11. package/dist/preview/{chunk.IXVSJJQH.js → chunk.5BGA2VUS.js} +2 -2
  12. package/dist/preview/{chunk.T2EZ5MTH.js → chunk.7S22MBNN.js} +1 -1
  13. package/dist/preview/{chunk.KAKX5TZN.js → chunk.A73BXXE4.js} +2 -2
  14. package/dist/preview/chunk.ARE3MEDN.js +1 -0
  15. package/dist/preview/chunk.ASFZTYFO.js +1 -0
  16. package/dist/preview/{chunk.S5JWZIVE.js → chunk.BBJZ6O7J.js} +1 -1
  17. package/dist/preview/{chunk.NQNQPPPM.js → chunk.BCBH6WJF.js} +1 -1
  18. package/dist/preview/{chunk.ZNIJONZN.js → chunk.CAZAB352.js} +1 -1
  19. package/dist/preview/chunk.CY7MDLRS.js +1 -0
  20. package/dist/preview/chunk.DAVRLRGB.js +1 -0
  21. package/dist/preview/{chunk.IZDKEFPJ.js → chunk.DCIC3YHX.js} +1 -1
  22. package/dist/preview/{chunk.DQ5OWYLQ.js → chunk.EW4JFOJY.js} +1 -1
  23. package/dist/preview/{chunk.5BN2ARQ2.js → chunk.EYF6ONTA.js} +1 -1
  24. package/dist/preview/{chunk.Q7544RCB.js → chunk.FP27W5MU.js} +1 -1
  25. package/dist/preview/{chunk.U5ZUXGWM.js → chunk.G2OOBROL.js} +1 -1
  26. package/dist/preview/{chunk.7CO6VP6F.js → chunk.GCKSQ52O.js} +1 -1
  27. package/dist/preview/{chunk.VD6FJ6KJ.js → chunk.GE5EAN36.js} +1 -1
  28. package/dist/preview/chunk.HOPIZMJR.js +2 -0
  29. package/dist/preview/{chunk.VMD4PDYJ.js → chunk.IBGO4BUF.js} +1 -1
  30. package/dist/preview/{chunk.OA5BVKJH.js → chunk.IDI2BQ7Y.js} +1 -1
  31. package/dist/preview/{chunk.MNPNW4BQ.js → chunk.IH42QTOM.js} +1 -1
  32. package/dist/preview/{chunk.CW7BMVBG.js → chunk.ISRS7GOT.js} +1 -1
  33. package/dist/preview/{chunk.AS35X6KA.js → chunk.J6CBMLGR.js} +1 -1
  34. package/dist/preview/{chunk.4JXWQO6Y.js → chunk.JRCV6HVV.js} +1 -1
  35. package/dist/preview/{chunk.ATLUMYAJ.js → chunk.KWW3YHQ4.js} +1 -1
  36. package/dist/preview/{chunk.VMEX2KZ4.js → chunk.MKNXV4TM.js} +7 -7
  37. package/dist/preview/{chunk.V57P4LIZ.js → chunk.MVNIKZIC.js} +1 -1
  38. package/dist/preview/{chunk.DG2WKNMX.js → chunk.N2WTNKEV.js} +1 -1
  39. package/dist/preview/{chunk.VFICMX5G.js → chunk.N7HCALRK.js} +1 -1
  40. package/dist/preview/{chunk.OYULDOQP.js → chunk.NRRUGG22.js} +1 -1
  41. package/dist/preview/{chunk.ZMMMKTAG.js → chunk.OGL4PHTY.js} +1 -1
  42. package/dist/preview/{chunk.FTBKJ5RZ.js → chunk.PFQFPJ5L.js} +1 -1
  43. package/dist/preview/{chunk.EVTZE2OZ.js → chunk.PN2H6X7O.js} +1 -1
  44. package/dist/preview/{chunk.7QTBDACG.js → chunk.PWHJHFC4.js} +1 -1
  45. package/dist/preview/{chunk.4W24TPMR.js → chunk.Q3HVA6L4.js} +1 -1
  46. package/dist/preview/{chunk.LQZ2VQWN.js → chunk.RZLNDVGN.js} +2 -2
  47. package/dist/preview/{chunk.HPD3DSTP.js → chunk.SBHVVJY7.js} +1 -1
  48. package/dist/preview/{chunk.QZWN46V6.js → chunk.SNBIZ3B6.js} +1 -1
  49. package/dist/preview/chunk.TBG2QBOS.js +1 -0
  50. package/dist/preview/chunk.VR735ZQL.js +1 -0
  51. package/dist/preview/{chunk.YO7UFBJP.js → chunk.VSXCXPK2.js} +1 -1
  52. package/dist/preview/{chunk.TMPV4HLQ.js → chunk.W3LDQ6B2.js} +1 -1
  53. package/dist/preview/{chunk.YV2RTNPU.js → chunk.WCNONCTL.js} +1 -1
  54. package/dist/preview/{chunk.XDHBV5K5.js → chunk.WHTNSETN.js} +1 -1
  55. package/dist/preview/{chunk.NKIFVPS3.js → chunk.XG67BWH6.js} +1 -1
  56. package/dist/preview/{chunk.DG2UE7PJ.js → chunk.XRM6WXPW.js} +1 -1
  57. package/dist/preview/chunk.Y5LPZLDE.js +1 -0
  58. package/dist/preview/{chunk.E3SZ7T75.js → chunk.YETBY2LM.js} +1 -1
  59. package/dist/preview/chunk.ZEUBAAVQ.js +1 -0
  60. package/dist/preview/{chunk.PHY3AH3L.js → chunk.ZJDRD6PO.js} +1 -1
  61. package/dist/preview/page.js +2 -2
  62. package/package.json +6 -6
  63. package/dist/preview/chunk.DY2FFBWF.js +0 -1
  64. package/dist/preview/chunk.GHMICJIB.js +0 -1
  65. package/dist/preview/chunk.HO6JR7VY.js +0 -1
  66. package/dist/preview/chunk.I5KD54S6.js +0 -1
  67. package/dist/preview/chunk.J36GTQTV.js +0 -1
  68. package/dist/preview/chunk.MHJJEGQO.js +0 -1
  69. package/dist/preview/chunk.OHGJ5BZ4.js +0 -2
  70. package/dist/preview/chunk.RUC4HFVC.js +0 -1
  71. package/dist/preview/chunk.SHDYLMZE.js +0 -2
  72. package/dist/preview/chunk.ZD5HGRPR.js +0 -1
  73. package/dist/preview/chunk.ZKM4P7US.js +0 -1
@@ -1 +1 @@
1
- import{Aa as w,B as s,K as k,xa as x,za as p}from"./chunk.VMEX2KZ4.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
+ 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.LQZ2VQWN.js";import"./chunk.TX2GOL65.js";import"./chunk.T2EZ5MTH.js";import"./chunk.ONDILMIX.js";import{f as g}from"./chunk.AS35X6KA.js";import"./chunk.I5KD54S6.js";import"./chunk.NQNQPPPM.js";import"./chunk.KAKX5TZN.js";import"./chunk.VFICMX5G.js";import"./chunk.IKT7JQUW.js";import"./chunk.CW7BMVBG.js";import"./chunk.IZDKEFPJ.js";import"./chunk.XDHBV5K5.js";import"./chunk.WVUJXDXZ.js";import"./chunk.UMMN5Z6V.js";import"./chunk.DG2WKNMX.js";import"./chunk.HPD3DSTP.js";import"./chunk.VD6FJ6KJ.js";import"./chunk.OHGJ5BZ4.js";import"./chunk.7QTBDACG.js";import"./chunk.5BN2ARQ2.js";import"./chunk.4W24TPMR.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.LHAAZQNQ.js";import"./chunk.PHY3AH3L.js";import"./chunk.QZWN46V6.js";import"./chunk.6LJ66MB7.js";import"./chunk.OYULDOQP.js";import{ta as n}from"./chunk.VMEX2KZ4.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};
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.OYULDOQP.js";import{Sb as L}from"./chunk.VMEX2KZ4.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.ZD5HGRPR.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.HO6JR7VY.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
+ 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.LHAAZQNQ.js";import{a,b}from"./chunk.PHY3AH3L.js";import"./chunk.QZWN46V6.js";import"./chunk.6LJ66MB7.js";import"./chunk.OYULDOQP.js";import"./chunk.VMEX2KZ4.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
+ 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{mb as u}from"./chunk.VMEX2KZ4.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
+ 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.XDHBV5K5.js";import"./chunk.WVUJXDXZ.js";import{b as $,c as ne}from"./chunk.UMMN5Z6V.js";import"./chunk.DG2WKNMX.js";import"./chunk.HPD3DSTP.js";import"./chunk.VD6FJ6KJ.js";import"./chunk.OHGJ5BZ4.js";import"./chunk.6R4EI47C.js";import{Y as X,da as ee,ga as te}from"./chunk.OYULDOQP.js";import{Fb as Y,H as J,I as v,J as j,Y as Q}from"./chunk.VMEX2KZ4.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.AS35X6KA.js";import{h as Pt,i as Dt,j as Bt,k as Ot,n as Wt,o as Ft}from"./chunk.FS5K4AVA.js";import"./chunk.DY2FFBWF.js";import"./chunk.MNPNW4BQ.js";import"./chunk.I5KD54S6.js";import"./chunk.EVTZE2OZ.js";import"./chunk.NQNQPPPM.js";import"./chunk.VFICMX5G.js";import{d as Kt}from"./chunk.NKIFVPS3.js";import{b as Nt}from"./chunk.7SVIRYBB.js";import{b as Lt}from"./chunk.ZMMMKTAG.js";import{a as na}from"./chunk.IKT7JQUW.js";import{b as Et,i as Mt}from"./chunk.CW7BMVBG.js";import"./chunk.IZDKEFPJ.js";import{l as Rt}from"./chunk.XDHBV5K5.js";import{a as Ht}from"./chunk.4R7LDCDO.js";import{a as It,b as Q}from"./chunk.TMPV4HLQ.js";import"./chunk.4W24TPMR.js";import"./chunk.AHDOKM4O.js";import"./chunk.6R4EI47C.js";import"./chunk.QZWN46V6.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.OYULDOQP.js";import{Eb as W,Gb as F,U as lt,W as xe,X as dt,Z as Me,_ as Le,_a as gt,bb as pt,cb as ct,mb as ut,tb as vt}from"./chunk.VMEX2KZ4.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`
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.7SVIRYBB.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.OYULDOQP.js";import{Xb as s,ua as y,va as r}from"./chunk.VMEX2KZ4.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
+ 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.OHGJ5BZ4.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===`
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};
@@ -1 +1 @@
1
- import{a as lt}from"./chunk.HPD3DSTP.js";import{f as it}from"./chunk.VD6FJ6KJ.js";import{a as M,e as q,n as st}from"./chunk.OHGJ5BZ4.js";import{D as Y,E as Q,F as G,Mb as at,Oa as ot,P as T,S as V,V as X,Y as k,_ as tt,fa as nt,ga as et,ja as rt}from"./chunk.VMEX2KZ4.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
+ 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.4R7LDCDO.js";import"./chunk.TMPV4HLQ.js";import{a as E,c as H,e as V,f as _}from"./chunk.7QTBDACG.js";import"./chunk.5BN2ARQ2.js";import"./chunk.4W24TPMR.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.OYULDOQP.js";import{P as L,S as O,W as T}from"./chunk.VMEX2KZ4.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=`
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)}
@@ -1 +1 @@
1
- import{a as G}from"./chunk.I5KD54S6.js";import{Aa as W,Lb as V,Na as j,R as B,Za as F,ba as C,eb as U,fb as q,g as z,sa as L,ya as x}from"./chunk.VMEX2KZ4.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.ZKM4P7US.js")),de=()=>import("./chunk.VMD4PDYJ.js").catch(()=>{}),le=async()=>{(await de())?.judgeWithLines()},R=J(()=>import("./chunk.E3SZ7T75.js")),ce=J(()=>import("./chunk.YV2RTNPU.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
+ 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.OYULDOQP.js";import{Bb as ye,Db as xe,Gb as ke,Hb as $e,P as se,Qa as U,Tb as Se,Ub as Pe,Vb as Be,W as de,Wb as Te,_b as Ee,ba as ce,la as pe,mb as ge,ob as ue,pb as ve,qb as Z,rb as we,sb as fe,ub as me,vb as he,wb as be}from"./chunk.VMEX2KZ4.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.OA5BVKJH.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=`
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}