graview 0.1.33 → 0.1.35

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 (144) hide show
  1. package/dist/preview/{chunk.CWHRDBOF.js → chunk.2OBIO5Y6.js} +1 -1
  2. package/dist/preview/{chunk.K5ME5GCG.js → chunk.2QQAOJET.js} +1 -1
  3. package/dist/preview/{chunk.4HZ7QTXZ.js → chunk.2YGQVI6T.js} +1 -1
  4. package/dist/preview/{chunk.COQKECUH.js → chunk.3C4RJIJU.js} +1 -1
  5. package/dist/preview/{chunk.TAQ764IQ.js → chunk.3H4NVUWV.js} +1 -1
  6. package/dist/preview/{chunk.UATVTXZY.js → chunk.3P4IIXIT.js} +1 -1
  7. package/dist/preview/chunk.3QXHII5W.js +1 -0
  8. package/dist/preview/chunk.4J75WRDG.js +1 -0
  9. package/dist/preview/{chunk.MAF7C3VM.js → chunk.4K5QCJFH.js} +1 -1
  10. package/dist/preview/chunk.4NZBMZC7.js +117 -0
  11. package/dist/preview/{chunk.ULRW47RP.js → chunk.52QAIGCD.js} +1 -1
  12. package/dist/preview/{chunk.D75KC3LL.js → chunk.577PGFUT.js} +1 -1
  13. package/dist/preview/{chunk.RCKTBOY2.js → chunk.5B7NWF7C.js} +1 -1
  14. package/dist/preview/{chunk.EBGAYL32.js → chunk.5EAQDBBE.js} +1 -1
  15. package/dist/preview/{chunk.XBJYQNVE.js → chunk.5FZQI2US.js} +1 -1
  16. package/dist/preview/chunk.5MCC54VM.js +1 -0
  17. package/dist/preview/{chunk.QVVJRSRM.js → chunk.5VB7DJTL.js} +1 -1
  18. package/dist/preview/chunk.656N5BHG.js +1 -0
  19. package/dist/preview/{chunk.5UL7YDUD.js → chunk.6J7DR7XQ.js} +1 -1
  20. package/dist/preview/{chunk.EF3XNU4O.js → chunk.6K2HASOH.js} +1 -1
  21. package/dist/preview/chunk.6P7P2AW7.js +1 -0
  22. package/dist/preview/chunk.747GGBPR.js +2 -0
  23. package/dist/preview/{chunk.T5VG5A6V.js → chunk.A3F7MFDR.js} +1 -1
  24. package/dist/preview/chunk.AEHPDVLQ.js +1 -0
  25. package/dist/preview/chunk.AINNENYD.js +6 -0
  26. package/dist/preview/{chunk.4HNG4UXT.js → chunk.APNN6BKF.js} +1 -1
  27. package/dist/preview/{chunk.AR3DCDHU.js → chunk.B2KITMSD.js} +1 -1
  28. package/dist/preview/{chunk.5T5XGILP.js → chunk.BGW7XTMH.js} +1 -1
  29. package/dist/preview/chunk.BL6VDLAW.js +1 -0
  30. package/dist/preview/{chunk.XNJEFUF7.js → chunk.CDMV6L5I.js} +1 -1
  31. package/dist/preview/chunk.CHJZ7LST.js +27 -0
  32. package/dist/preview/{chunk.H7EPE74C.js → chunk.D4WQEBWV.js} +1 -1
  33. package/dist/preview/chunk.DLT3EE4D.js +1 -0
  34. package/dist/preview/{chunk.GV2CQVKV.js → chunk.DMNXYMLC.js} +1 -1
  35. package/dist/preview/{chunk.IWQCOGHW.js → chunk.DNDHDDM6.js} +2 -2
  36. package/dist/preview/{chunk.EJPI3ST6.js → chunk.DPP7ITTU.js} +1 -1
  37. package/dist/preview/{chunk.LXBOVRFI.js → chunk.DQ5HAB3N.js} +1 -1
  38. package/dist/preview/chunk.DTR5I4BI.js +1 -0
  39. package/dist/preview/{chunk.MWGGV7DE.js → chunk.DUUARGPE.js} +1 -1
  40. package/dist/preview/{chunk.3TVXGJTU.js → chunk.EAM4NAQH.js} +1 -1
  41. package/dist/preview/{chunk.DYSPCGXX.js → chunk.EQWOQOFJ.js} +1 -1
  42. package/dist/preview/{chunk.FWTIUYXH.js → chunk.FBY5IUGU.js} +1 -1
  43. package/dist/preview/chunk.FHXXYWL3.js +1 -0
  44. package/dist/preview/{chunk.HLTRQU4Y.js → chunk.FIVLFXFB.js} +1 -1
  45. package/dist/preview/{chunk.UGFJKSHU.js → chunk.FSAHO3LV.js} +1 -1
  46. package/dist/preview/{chunk.JQU5GEU3.js → chunk.FUQVNXLB.js} +1 -1
  47. package/dist/preview/{chunk.TMVCTBAD.js → chunk.FVPOSGNG.js} +5 -5
  48. package/dist/preview/{chunk.4MERAWS2.js → chunk.FX6GH57T.js} +1 -1
  49. package/dist/preview/{chunk.CDP2XL66.js → chunk.G2ZPQUXM.js} +1 -1
  50. package/dist/preview/{chunk.CX3KL2C5.js → chunk.GCGITEON.js} +1 -1
  51. package/dist/preview/{chunk.3HXN4BOY.js → chunk.GCVO6N26.js} +1 -1
  52. package/dist/preview/{chunk.3K6YSVHC.js → chunk.GF7LA4QG.js} +1 -1
  53. package/dist/preview/{chunk.CN3UEF5N.js → chunk.GMOTRAKJ.js} +1 -1
  54. package/dist/preview/{chunk.UNL2HIF2.js → chunk.GO4QBFED.js} +1 -1
  55. package/dist/preview/{chunk.UHUGOTUU.js → chunk.H243UV3Z.js} +1 -1
  56. package/dist/preview/{chunk.G5NZVPJU.js → chunk.HPD5ZDZH.js} +1 -1
  57. package/dist/preview/{chunk.3TY5NFLY.js → chunk.IHFNLKXV.js} +1 -1
  58. package/dist/preview/{chunk.RIJUCHP4.js → chunk.IX6RNGAT.js} +1 -1
  59. package/dist/preview/{chunk.PIP6Z563.js → chunk.JAPYJ53U.js} +1 -1
  60. package/dist/preview/{chunk.5H4VXLZF.js → chunk.JLMLKDVX.js} +1 -1
  61. package/dist/preview/chunk.JMQ6YLQX.js +1 -0
  62. package/dist/preview/{chunk.J25KOSNW.js → chunk.KWCML3BF.js} +1 -1
  63. package/dist/preview/{chunk.ASCLIM2P.js → chunk.KYH4QIVI.js} +1 -1
  64. package/dist/preview/{chunk.HAIG6NVX.js → chunk.LAF6GTBN.js} +1 -1
  65. package/dist/preview/{chunk.E2YEOMPH.js → chunk.LIIC25G6.js} +1 -1
  66. package/dist/preview/{chunk.GYICGZMG.js → chunk.LRRVBM4F.js} +2 -2
  67. package/dist/preview/{chunk.I6FPNX43.js → chunk.LWSTEZIP.js} +1 -1
  68. package/dist/preview/chunk.M5HADQPP.js +1 -0
  69. package/dist/preview/{chunk.6UGEYZAC.js → chunk.MVN6H65Q.js} +1 -1
  70. package/dist/preview/chunk.O36ZDLWC.js +1 -0
  71. package/dist/preview/{chunk.GO4XBWJO.js → chunk.OEDCAHII.js} +1 -1
  72. package/dist/preview/{chunk.3NDH3EDN.js → chunk.OZ5KJLA2.js} +1 -1
  73. package/dist/preview/{chunk.QYZNAUIR.js → chunk.PJ2DF6C7.js} +1 -1
  74. package/dist/preview/{chunk.47STJVRV.js → chunk.PKKA6JWA.js} +1 -1
  75. package/dist/preview/{chunk.PBSMLINK.js → chunk.PPUAPAWR.js} +1 -1
  76. package/dist/preview/chunk.PQPTYNW2.js +1 -0
  77. package/dist/preview/{chunk.SYAEBGDC.js → chunk.PW7YH6JV.js} +1 -1
  78. package/dist/preview/{chunk.OC6IWRQ3.js → chunk.Q7TP4RFE.js} +1 -1
  79. package/dist/preview/chunk.QRMWFEEH.js +1 -0
  80. package/dist/preview/{chunk.UZGRRDHD.js → chunk.QU356VB2.js} +1 -1
  81. package/dist/preview/chunk.QVKKXMNK.js +1 -0
  82. package/dist/preview/{chunk.3AGY4QVS.js → chunk.QVUL2FSI.js} +1 -1
  83. package/dist/preview/chunk.RHYA742Q.js +1 -0
  84. package/dist/preview/{chunk.6YCBYL2Y.js → chunk.RIW7SQH4.js} +1 -1
  85. package/dist/preview/{chunk.NTF7FVB2.js → chunk.RTB4MMF6.js} +1 -1
  86. package/dist/preview/{chunk.NRAYZY3X.js → chunk.SBBNIYVB.js} +1 -1
  87. package/dist/preview/{chunk.7GKUVQVF.js → chunk.SD33BD7A.js} +1 -1
  88. package/dist/preview/{chunk.2NIOHEMX.js → chunk.SECORXDP.js} +1 -1
  89. package/dist/preview/{chunk.AOSMJKLH.js → chunk.TIBZZ2WY.js} +1 -1
  90. package/dist/preview/chunk.TPX6AVJL.js +1 -0
  91. package/dist/preview/{chunk.VG3O4LWB.js → chunk.TWWFWHK3.js} +1 -1
  92. package/dist/preview/chunk.U2PYW5MS.js +1 -0
  93. package/dist/preview/{chunk.BNV77BQZ.js → chunk.U5EJSTST.js} +3 -3
  94. package/dist/preview/{chunk.EKPRNDUV.js → chunk.UHQD3NTK.js} +1 -1
  95. package/dist/preview/chunk.UWIYKGYK.js +25 -0
  96. package/dist/preview/{chunk.UBFNZMUX.js → chunk.VMGWYCXU.js} +1 -1
  97. package/dist/preview/{chunk.JDUJDAGA.js → chunk.VWHMYPLL.js} +1 -1
  98. package/dist/preview/{chunk.R6K6GF5R.js → chunk.VZHV25JE.js} +1 -1
  99. package/dist/preview/chunk.WQBDTLPZ.js +1 -0
  100. package/dist/preview/{chunk.MNP4JI33.js → chunk.X7W27IRI.js} +4 -4
  101. package/dist/preview/{chunk.YIR7PPF3.js → chunk.XSYBNUXF.js} +1 -1
  102. package/dist/preview/{chunk.JOOQUWLT.js → chunk.Y5Z4ZDTO.js} +2 -2
  103. package/dist/preview/chunk.YT2CYCVT.js +1 -0
  104. package/dist/preview/{chunk.B2GLDIAS.js → chunk.Z7ZCR4LN.js} +1 -1
  105. package/dist/preview/{chunk.CAVBSL27.js → chunk.ZE4CTZQ3.js} +1 -1
  106. package/dist/preview/chunk.ZFWV4JAJ.js +1 -0
  107. package/dist/preview/chunk.ZHXX22AT.js +3 -0
  108. package/dist/preview/chunk.ZKXK22AH.js +1 -0
  109. package/dist/preview/chunk.ZQNLC33L.js +1 -0
  110. package/dist/preview/{chunk.OKRNJXTV.js → chunk.ZSW74NVJ.js} +1 -1
  111. package/dist/preview/{chunk.7T7NZZTC.js → chunk.ZZTDQKM2.js} +1 -1
  112. package/dist/preview/index.html +42 -42
  113. package/dist/preview/page.js +2 -2
  114. package/package.json +6 -6
  115. package/dist/preview/chunk.26LLZN3C.js +0 -1
  116. package/dist/preview/chunk.2WPZXIRP.js +0 -2
  117. package/dist/preview/chunk.4HRAQNJO.js +0 -27
  118. package/dist/preview/chunk.52W7WYME.js +0 -1
  119. package/dist/preview/chunk.63GXY2ME.js +0 -1
  120. package/dist/preview/chunk.67TPUXAY.js +0 -1
  121. package/dist/preview/chunk.6QWV5MVH.js +0 -25
  122. package/dist/preview/chunk.AKFKM4SW.js +0 -3
  123. package/dist/preview/chunk.BHXGM3PV.js +0 -1
  124. package/dist/preview/chunk.BQ3JHEHV.js +0 -1
  125. package/dist/preview/chunk.CIPS2OGR.js +0 -1
  126. package/dist/preview/chunk.DAZ2VSRD.js +0 -1
  127. package/dist/preview/chunk.ERIT3R6N.js +0 -1
  128. package/dist/preview/chunk.EYTBDMTW.js +0 -1
  129. package/dist/preview/chunk.GBRRGTIH.js +0 -1
  130. package/dist/preview/chunk.H7BST3XO.js +0 -1
  131. package/dist/preview/chunk.IDVAR5HM.js +0 -1
  132. package/dist/preview/chunk.KSES5U5B.js +0 -1
  133. package/dist/preview/chunk.LR3VDXPI.js +0 -1
  134. package/dist/preview/chunk.N6OX4NEQ.js +0 -1
  135. package/dist/preview/chunk.PHKSMUIA.js +0 -1
  136. package/dist/preview/chunk.SHPXD6FC.js +0 -1
  137. package/dist/preview/chunk.SHTJZ6UX.js +0 -1
  138. package/dist/preview/chunk.UVR2Z5ZC.js +0 -1
  139. package/dist/preview/chunk.WAZ7OGBD.js +0 -1
  140. package/dist/preview/chunk.XANVHJQ4.js +0 -1
  141. package/dist/preview/chunk.XKABS745.js +0 -1
  142. package/dist/preview/chunk.XMC7YDWT.js +0 -1
  143. package/dist/preview/chunk.Y2SFUALD.js +0 -117
  144. package/dist/preview/chunk.Y6ZNFQK3.js +0 -6
@@ -1 +1 @@
1
- import{h as p}from"./chunk.JOOQUWLT.js";import{Q as c}from"./chunk.6QWV5MVH.js";import{Kb as u}from"./chunk.MNP4JI33.js";import{b as h}from"./chunk.AJZBJBMO.js";var s={person:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><circle cx="11.6" cy="5.4" r="2.5"/><path d="M7.9 12.4c0-2.1 1.7-3.8 3.7-3.8s3.7 1.7 3.7 3.8v3.2H7.9z"/><path d="M8 12.6 6.4 17.2"/><path d="M15.2 12.6 16.8 17.2"/><path d="M9.8 15.6v5"/><path d="M13.4 15.6v5"/></svg>',plot:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.6 9.4 12 4.6l9.4 4.8-9.4 4.8z"/><path d="M2.6 9.4v4.4l9.4 4.8 9.4-4.8V9.4"/><path d="M12 14.2v4.4"/><path d="M7 11.9v3"/><path d="M17 11.9v3"/></svg>',box:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.4 7.9 12 3.6l8.6 4.3-8.6 4.3z"/><path d="M3.4 7.9v8.2L12 20.4l8.6-4.3V7.9"/><path d="M12 12.2v8.2"/></svg>',task:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 6.6 12 2.9l7.6 3.7v9.5L12 19.8 4.4 16.1z"/><path d="M12 12.4v7.4"/><path d="M4.4 6.6 12 10.3l7.6-3.7"/><path d="M8 9.6l2.4 2.4L16 8.4"/></svg>',shift:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.2 8.2 12 4l8.8 4.2-8.8 4.2z"/><path d="M3.2 8.2v7.2L12 19.6l8.8-4.2V8.2"/><path d="M12 12.4v7.2"/><path d="M6.6 10.8v3.4"/><path d="M9.3 12v3.4"/></svg>',list:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 10.4 12 6l9.2 4.4-9.2 4.4z"/><path d="M2.8 10.4v3.2L12 18l9.2-4.4v-3.2"/><path d="M6.6 8.6 15.8 13"/><path d="M9.4 7.2 18.6 11.6"/></svg>',vehicle:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 14.2 5 9.4l8.6-1.6 5.4 3-1 3.6z"/><path d="M2.8 14.2v2.2h2.4"/><path d="M18 16.4h1.9l.1-2.2"/><circle cx="7.6" cy="16.6" r="1.9"/><circle cx="16.1" cy="16.6" r="1.9"/><path d="M8.6 8.2 9.8 12l7.2-1"/></svg>',rule:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 19.4V6.6l12 12.8z"/><path d="M5.4 6.6 7.6 5.5l12 12.8-2.2 1.1"/><path d="M5.4 19.4 7.6 18.3h12"/><path d="M5.4 10.1h1.7"/><path d="M5.4 13.3h1.7"/><path d="M5.4 16.5h1.7"/></svg>',note:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6.2 6.2 14.8 10.5v9L6.2 15.2z"/><path d="M12.4 9.3 14.8 10.5l-.6 2.3"/><path d="M8.2 10.6 12.8 12.9"/><path d="M8.2 13.2 11.4 14.8"/></svg>'},v=Object.keys(s);function i(e){if(e)return s[e]??(e.trimStart().startsWith("<svg")?e:void 0)}var a=h(c(),1);function A({kind:e,schema:o,brand:n,size:r=16,title:t}){let f=o?.tryDefinition?.(e)?.figure,d=i(n?.figures?.[e]??f),l=Math.round(u(e,n?.accents)),g=p(d);return d?(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"figure",dangerouslySetInnerHTML:g,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:r,height:r,flex:"0 0 auto",color:`hsl(${l} 55% 52%)`,"--graview-figure-size":`${r}px`}}):(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"dot",style:{display:"inline-block",width:Math.round(r*.8),height:Math.round(r*.5),flex:"0 0 auto",background:`hsl(${l} 55% 52%)`,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)"}})}function C(e,o,n){return i(n?.figures?.[e]??o?.tryDefinition?.(e)?.figure)!==void 0}export{A as a,C as b};
1
+ import{h as p}from"./chunk.Y5Z4ZDTO.js";import{Q as c}from"./chunk.UWIYKGYK.js";import{Lb as u}from"./chunk.X7W27IRI.js";import{b as h}from"./chunk.AJZBJBMO.js";var s={person:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><circle cx="11.6" cy="5.4" r="2.5"/><path d="M7.9 12.4c0-2.1 1.7-3.8 3.7-3.8s3.7 1.7 3.7 3.8v3.2H7.9z"/><path d="M8 12.6 6.4 17.2"/><path d="M15.2 12.6 16.8 17.2"/><path d="M9.8 15.6v5"/><path d="M13.4 15.6v5"/></svg>',plot:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.6 9.4 12 4.6l9.4 4.8-9.4 4.8z"/><path d="M2.6 9.4v4.4l9.4 4.8 9.4-4.8V9.4"/><path d="M12 14.2v4.4"/><path d="M7 11.9v3"/><path d="M17 11.9v3"/></svg>',box:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.4 7.9 12 3.6l8.6 4.3-8.6 4.3z"/><path d="M3.4 7.9v8.2L12 20.4l8.6-4.3V7.9"/><path d="M12 12.2v8.2"/></svg>',task:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 6.6 12 2.9l7.6 3.7v9.5L12 19.8 4.4 16.1z"/><path d="M12 12.4v7.4"/><path d="M4.4 6.6 12 10.3l7.6-3.7"/><path d="M8 9.6l2.4 2.4L16 8.4"/></svg>',shift:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.2 8.2 12 4l8.8 4.2-8.8 4.2z"/><path d="M3.2 8.2v7.2L12 19.6l8.8-4.2V8.2"/><path d="M12 12.4v7.2"/><path d="M6.6 10.8v3.4"/><path d="M9.3 12v3.4"/></svg>',list:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 10.4 12 6l9.2 4.4-9.2 4.4z"/><path d="M2.8 10.4v3.2L12 18l9.2-4.4v-3.2"/><path d="M6.6 8.6 15.8 13"/><path d="M9.4 7.2 18.6 11.6"/></svg>',vehicle:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 14.2 5 9.4l8.6-1.6 5.4 3-1 3.6z"/><path d="M2.8 14.2v2.2h2.4"/><path d="M18 16.4h1.9l.1-2.2"/><circle cx="7.6" cy="16.6" r="1.9"/><circle cx="16.1" cy="16.6" r="1.9"/><path d="M8.6 8.2 9.8 12l7.2-1"/></svg>',rule:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 19.4V6.6l12 12.8z"/><path d="M5.4 6.6 7.6 5.5l12 12.8-2.2 1.1"/><path d="M5.4 19.4 7.6 18.3h12"/><path d="M5.4 10.1h1.7"/><path d="M5.4 13.3h1.7"/><path d="M5.4 16.5h1.7"/></svg>',note:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6.2 6.2 14.8 10.5v9L6.2 15.2z"/><path d="M12.4 9.3 14.8 10.5l-.6 2.3"/><path d="M8.2 10.6 12.8 12.9"/><path d="M8.2 13.2 11.4 14.8"/></svg>'},v=Object.keys(s);function i(e){if(e)return s[e]??(e.trimStart().startsWith("<svg")?e:void 0)}var a=h(c(),1);function A({kind:e,schema:o,brand:n,size:r=16,title:t}){let f=o?.tryDefinition?.(e)?.figure,d=i(n?.figures?.[e]??f),l=Math.round(u(e,n?.accents)),g=p(d);return d?(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"figure",dangerouslySetInnerHTML:g,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:r,height:r,flex:"0 0 auto",color:`hsl(${l} 55% 52%)`,"--graview-figure-size":`${r}px`}}):(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"dot",style:{display:"inline-block",width:Math.round(r*.8),height:Math.round(r*.5),flex:"0 0 auto",background:`hsl(${l} 55% 52%)`,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)"}})}function C(e,o,n){return i(n?.figures?.[e]??o?.tryDefinition?.(e)?.figure)!==void 0}export{A as a,C as b};
@@ -1 +1 @@
1
- import{F as C,Q as F,sa as H,ua as A}from"./chunk.6QWV5MVH.js";import"./chunk.MNP4JI33.js";import{b as x}from"./chunk.AJZBJBMO.js";var t=x(C(),1),f=x(F(),1),q={faces:'[data-testid="app-faces"]',problems:'[data-testid="standing"], [data-testid="standing-link"]',activity:'[data-testid="activity-button"]',ask:'[data-testid="app-find"], [data-testid="app-find-open"]',find:'[data-testid="app-find"], [data-testid="app-find-open"]',profile:'[data-testid="profile-button"]',home:'[data-testid="app-home"]'};function D(e){if(!e.isConnected||e.closest("[hidden], [inert], [aria-hidden='true']"))return!1;if(typeof e.checkVisibility!="function")return!0;if(!e.checkVisibility({visibilityProperty:!0}))return!1;let a=e.getBoundingClientRect();return a.width>1&&a.height>1}function S(e,a){if(!e||a==="ask"&&!e.querySelector("[data-graview-quick-ask]"))return null;for(let c of e.querySelectorAll(q[a]))if(D(c))return c;return null}function W(e){let a=(u,h,l)=>e.querySelector(u)?.getAttribute(h)?.trim()||l,c=a('[data-testid="app-face-scene"]',"title","Scene"),n=a('[data-testid="app-face-pages"]',"title","Pages");return[{anchor:"faces",title:`${c} or ${n}`,words:`One app, two ways to see it: ${c} draws every record as one picture, ${n} as lists and pages to read and change.`},{anchor:"problems",title:"Whether all is in order",words:"The dot is green while every rule holds. When one is broken it counts what is wrong, and pressing it shows each one and where."},{anchor:"activity",title:"Activity",words:"What has happened here and who did it, each change with its way back."},{anchor:"ask",title:"Ask",words:"Press \u2318K (Ctrl+K) to ask about what you have selected, or right-click it and choose Ask about this\u2026. The answer stands beside it, and a change it proposes waits for you to accept it."}]}var R=300,O=1200,$=15e3;function _({root:e,steps:a,onEnd:c}){let[n,u]=(0,t.useState)(null),h=(0,t.useRef)(null),l=(0,t.useRef)(!1),p=(0,t.useRef)(c);p.current=c,(0,t.useEffect)(()=>{let r=Date.now(),o=Date.now(),s=null,i,v=new MutationObserver(()=>o=Date.now());v.observe(document.body,{childList:!0,subtree:!0});let k=()=>{let L=e(),E=Date.now();if(L?.querySelector('[data-testid="app-bar"]')){if(s??=E,E-o>=R||E-s>=O){let T=[...W(L),...a].filter(P=>S(L,P.anchor)!==null);if(T.length===0){l.current=!0,p.current(null);return}h.current=document.activeElement,u({list:T,at:0});return}}else if(E-r>=$){l.current=!0,p.current(null);return}i=setTimeout(k,100)};return i=setTimeout(k,100),()=>{clearTimeout(i),v.disconnect()}},[]);let y=(0,t.useCallback)(()=>{let r=h.current;(r instanceof HTMLElement&&r!==document.body&&r.isConnected?r:e()?.querySelector('[data-testid="app-home"]'))?.focus({preventScroll:!0})},[e]),m=(0,t.useCallback)((r,o)=>{if(l.current)return;l.current=!0;let s=document.querySelector("[data-testid='first-look']"),i=document.activeElement,v=i===null||i===document.body||s!==null&&s.contains(i);u(null),p.current(r),!(!o&&!v)&&(y(),requestAnimationFrame(()=>{let k=document.activeElement;(k===null||k===document.body)&&y()}))},[y]),w=(0,t.useCallback)((r,o)=>{let s=e();for(let i=o;i<r.length;i++)if(S(s,r[i].anchor))return i;return-1},[e]),b=(0,t.useCallback)(()=>{if(!n)return;let r=w(n.list,n.at+1);r<0?m("finished",!0):u({list:n.list,at:r})},[n,w,m]);if((0,t.useEffect)(()=>{if(!n)return;let r=e();if(!r)return;let o=0,s=()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>{S(e(),n.list[n.at].anchor)||b()})},i=new MutationObserver(s);return i.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class","data-switch-drawn"]}),()=>{cancelAnimationFrame(o),i.disconnect()}},[n,e,b]),!n)return null;let g=n.list[n.at],d=w(n.list,n.at+1)<0;return(0,f.jsx)(I,{root:e,step:g,position:n.at+1,total:n.list.length,last:d,onNext:b,onEnd:m},n.at)}var N={...H,width:"min(320px, calc(100vw - 24px))",maxHeight:"min(70vh, 420px)",overflow:"auto",padding:"12px 14px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:"0.875rem",lineHeight:1.45,overflowWrap:"anywhere"},M={minHeight:32,padding:"0 12px",borderRadius:8,font:"inherit",fontWeight:600,cursor:"pointer"};function I({root:e,step:a,position:c,total:n,last:u,onNext:h,onEnd:l}){let p=(0,t.useRef)(null),y=(0,t.useRef)(null),m=(0,t.useId)().replace(/:/g,""),w=(0,t.useMemo)(()=>({get current(){return S(e(),a.anchor)}}),[e,a.anchor]),[b]=(0,t.useState)(()=>{let d=w.current?.getBoundingClientRect(),r=typeof document>"u"?0:document.documentElement.clientWidth||innerWidth;return d&&d.left+d.width/2<r/2?"start":"end"});A(p,!0,w,{align:b}),(0,t.useLayoutEffect)(()=>{y.current?.focus({preventScroll:!0})},[]);let g=(0,t.useRef)(l);return g.current=l,(0,t.useEffect)(()=>{let d=o=>{o.target instanceof Node&&p.current?.contains(o.target)||g.current("dismissed",!1)},r=o=>{if(o.key!=="Escape"||o.defaultPrevented)return;let s=o.target;s instanceof Node&&p.current?.contains(s)||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||[...document.querySelectorAll("[data-graview-overlay]:not([hidden])")].some(i=>i!==p.current)||g.current("dismissed",!0)};return document.addEventListener("pointerdown",d,!0),document.addEventListener("keydown",r),()=>{document.removeEventListener("pointerdown",d,!0),document.removeEventListener("keydown",r)}},[]),(0,f.jsxs)("div",{ref:p,popover:"manual",role:"dialog","aria-modal":"false","aria-labelledby":`${m}-title`,"aria-describedby":`${m}-words`,tabIndex:-1,"data-testid":"first-look","data-first-look-anchor":a.anchor,"data-graview-overlay":"",onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),l("dismissed",!0))},style:N,children:[(0,f.jsxs)("p",{style:{margin:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},"data-testid":"first-look-count",children:[c," of ",n]}),(0,f.jsx)("p",{id:`${m}-title`,style:{margin:"2px 0 4px",fontWeight:600,fontSize:"0.9375rem"},"data-testid":"first-look-title",children:a.title}),(0,f.jsx)("p",{id:`${m}-words`,style:{margin:0},"data-testid":"first-look-words",children:a.words}),(0,f.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,marginTop:12},children:[u?null:(0,f.jsx)("button",{type:"button","data-testid":"first-look-skip",onClick:()=>l("dismissed",!0),style:{...M,fontWeight:500,border:"1px solid transparent",background:"none",color:"var(--graview-ink-muted)"},children:"Skip"}),(0,f.jsx)("button",{ref:y,type:"button","data-testid":u?"first-look-done":"first-look-next",onClick:()=>u?l("finished",!0):h(),style:{...M,border:"1px solid var(--graview-accent)",background:"var(--graview-accent)",color:"var(--graview-accent-ink)"},children:u?"Done":"Next"})]})]})}export{_ as FirstLookHints,S as firstLookAnchor};
1
+ import{F as C,Q as F,sa as H,ua as A}from"./chunk.UWIYKGYK.js";import"./chunk.X7W27IRI.js";import{b as x}from"./chunk.AJZBJBMO.js";var t=x(C(),1),f=x(F(),1),q={faces:'[data-testid="app-faces"]',problems:'[data-testid="standing"], [data-testid="standing-link"]',activity:'[data-testid="activity-button"]',ask:'[data-testid="app-find"], [data-testid="app-find-open"]',find:'[data-testid="app-find"], [data-testid="app-find-open"]',profile:'[data-testid="profile-button"]',home:'[data-testid="app-home"]'};function D(e){if(!e.isConnected||e.closest("[hidden], [inert], [aria-hidden='true']"))return!1;if(typeof e.checkVisibility!="function")return!0;if(!e.checkVisibility({visibilityProperty:!0}))return!1;let a=e.getBoundingClientRect();return a.width>1&&a.height>1}function S(e,a){if(!e||a==="ask"&&!e.querySelector("[data-graview-quick-ask]"))return null;for(let c of e.querySelectorAll(q[a]))if(D(c))return c;return null}function W(e){let a=(u,h,l)=>e.querySelector(u)?.getAttribute(h)?.trim()||l,c=a('[data-testid="app-face-scene"]',"title","Scene"),n=a('[data-testid="app-face-pages"]',"title","Pages");return[{anchor:"faces",title:`${c} or ${n}`,words:`One app, two ways to see it: ${c} draws every record as one picture, ${n} as lists and pages to read and change.`},{anchor:"problems",title:"Whether all is in order",words:"The dot is green while every rule holds. When one is broken it counts what is wrong, and pressing it shows each one and where."},{anchor:"activity",title:"Activity",words:"What has happened here and who did it, each change with its way back."},{anchor:"ask",title:"Ask",words:"Press \u2318K (Ctrl+K) to ask about what you have selected, or right-click it and choose Ask about this\u2026. The answer stands beside it, and a change it proposes waits for you to accept it."}]}var R=300,O=1200,$=15e3;function _({root:e,steps:a,onEnd:c}){let[n,u]=(0,t.useState)(null),h=(0,t.useRef)(null),l=(0,t.useRef)(!1),p=(0,t.useRef)(c);p.current=c,(0,t.useEffect)(()=>{let r=Date.now(),o=Date.now(),s=null,i,v=new MutationObserver(()=>o=Date.now());v.observe(document.body,{childList:!0,subtree:!0});let k=()=>{let L=e(),E=Date.now();if(L?.querySelector('[data-testid="app-bar"]')){if(s??=E,E-o>=R||E-s>=O){let T=[...W(L),...a].filter(P=>S(L,P.anchor)!==null);if(T.length===0){l.current=!0,p.current(null);return}h.current=document.activeElement,u({list:T,at:0});return}}else if(E-r>=$){l.current=!0,p.current(null);return}i=setTimeout(k,100)};return i=setTimeout(k,100),()=>{clearTimeout(i),v.disconnect()}},[]);let y=(0,t.useCallback)(()=>{let r=h.current;(r instanceof HTMLElement&&r!==document.body&&r.isConnected?r:e()?.querySelector('[data-testid="app-home"]'))?.focus({preventScroll:!0})},[e]),m=(0,t.useCallback)((r,o)=>{if(l.current)return;l.current=!0;let s=document.querySelector("[data-testid='first-look']"),i=document.activeElement,v=i===null||i===document.body||s!==null&&s.contains(i);u(null),p.current(r),!(!o&&!v)&&(y(),requestAnimationFrame(()=>{let k=document.activeElement;(k===null||k===document.body)&&y()}))},[y]),w=(0,t.useCallback)((r,o)=>{let s=e();for(let i=o;i<r.length;i++)if(S(s,r[i].anchor))return i;return-1},[e]),b=(0,t.useCallback)(()=>{if(!n)return;let r=w(n.list,n.at+1);r<0?m("finished",!0):u({list:n.list,at:r})},[n,w,m]);if((0,t.useEffect)(()=>{if(!n)return;let r=e();if(!r)return;let o=0,s=()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>{S(e(),n.list[n.at].anchor)||b()})},i=new MutationObserver(s);return i.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class","data-switch-drawn"]}),()=>{cancelAnimationFrame(o),i.disconnect()}},[n,e,b]),!n)return null;let g=n.list[n.at],d=w(n.list,n.at+1)<0;return(0,f.jsx)(I,{root:e,step:g,position:n.at+1,total:n.list.length,last:d,onNext:b,onEnd:m},n.at)}var N={...H,width:"min(320px, calc(100vw - 24px))",maxHeight:"min(70vh, 420px)",overflow:"auto",padding:"12px 14px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:"0.875rem",lineHeight:1.45,overflowWrap:"anywhere"},M={minHeight:32,padding:"0 12px",borderRadius:8,font:"inherit",fontWeight:600,cursor:"pointer"};function I({root:e,step:a,position:c,total:n,last:u,onNext:h,onEnd:l}){let p=(0,t.useRef)(null),y=(0,t.useRef)(null),m=(0,t.useId)().replace(/:/g,""),w=(0,t.useMemo)(()=>({get current(){return S(e(),a.anchor)}}),[e,a.anchor]),[b]=(0,t.useState)(()=>{let d=w.current?.getBoundingClientRect(),r=typeof document>"u"?0:document.documentElement.clientWidth||innerWidth;return d&&d.left+d.width/2<r/2?"start":"end"});A(p,!0,w,{align:b}),(0,t.useLayoutEffect)(()=>{y.current?.focus({preventScroll:!0})},[]);let g=(0,t.useRef)(l);return g.current=l,(0,t.useEffect)(()=>{let d=o=>{o.target instanceof Node&&p.current?.contains(o.target)||g.current("dismissed",!1)},r=o=>{if(o.key!=="Escape"||o.defaultPrevented)return;let s=o.target;s instanceof Node&&p.current?.contains(s)||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||[...document.querySelectorAll("[data-graview-overlay]:not([hidden])")].some(i=>i!==p.current)||g.current("dismissed",!0)};return document.addEventListener("pointerdown",d,!0),document.addEventListener("keydown",r),()=>{document.removeEventListener("pointerdown",d,!0),document.removeEventListener("keydown",r)}},[]),(0,f.jsxs)("div",{ref:p,popover:"manual",role:"dialog","aria-modal":"false","aria-labelledby":`${m}-title`,"aria-describedby":`${m}-words`,tabIndex:-1,"data-testid":"first-look","data-first-look-anchor":a.anchor,"data-graview-overlay":"",onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),l("dismissed",!0))},style:N,children:[(0,f.jsxs)("p",{style:{margin:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},"data-testid":"first-look-count",children:[c," of ",n]}),(0,f.jsx)("p",{id:`${m}-title`,style:{margin:"2px 0 4px",fontWeight:600,fontSize:"0.9375rem"},"data-testid":"first-look-title",children:a.title}),(0,f.jsx)("p",{id:`${m}-words`,style:{margin:0},"data-testid":"first-look-words",children:a.words}),(0,f.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,marginTop:12},children:[u?null:(0,f.jsx)("button",{type:"button","data-testid":"first-look-skip",onClick:()=>l("dismissed",!0),style:{...M,fontWeight:500,border:"1px solid transparent",background:"none",color:"var(--graview-ink-muted)"},children:"Skip"}),(0,f.jsx)("button",{ref:y,type:"button","data-testid":u?"first-look-done":"first-look-next",onClick:()=>u?l("finished",!0):h(),style:{...M,border:"1px solid var(--graview-accent)",background:"var(--graview-accent)",color:"var(--graview-accent-ink)"},children:u?"Done":"Next"})]})]})}export{_ as FirstLookHints,S as firstLookAnchor};
@@ -1 +1 @@
1
- import{b as rn,c as on,d as te,e as an,f as re,h as Oe,i as sn,n as dn,q as oe}from"./chunk.MAF7C3VM.js";import{A as pe,B as me,Da as _e,E as ke,G as Ne,Ga as He,H as Ce,Nb as en,Qa as Ue,Ra as We,V as Ke,Va as xe,Wa as Je,Xb as nn,Yb as tn,Z as Ve,b as je,c as De,d as $e,da as Ie,e as K,g as de,h as L,i as Te,ib as U,j as Ge,k as ce,ka as we,l as Me,lb as Ye,m as Pe,na as Ze,o as Le,p as le,pb as Qe,q as he,qa as qe,sa as Be,ub as Xe,v as Fe,wa as be,x as ne,xa as ve,y as fe}from"./chunk.MNP4JI33.js";function Dn(e,a){let n=e.brand??{},t=n.accent?tn(n.accent):void 0;t&&!t.ok&&a.push(sn("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${t.why}`,"pick a color further from orange-red, or a darker one"));let l=typeof n.logo=="string"?{src:n.logo}:n.logo,c=n.name??e.name,x=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,S])=>typeof S=="string"&&!/url\(|@import|[;{}<>\\]/i.test(S)).map(([S,I])=>[S,nn(I)])):void 0;return{name:c,schemes:t?.ok?t.schemes:en,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...l?{logo:l.src,logoAlt:l.alt??c}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...x?{typography:x}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{}}}function cn(e){let{currency:a,locale:n}=e.brand??{};return{...a?{currency:a}:{},...n?{locale:n}:{}}}var kn=Symbol.for("@graview/core:typed-field"),ln=(e,a)=>(/^(phone|place|duration)$/.test(a)&&(me(e)[kn]=a),e),fn=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;function pn(e){let a=L().check(K(300),fe(t=>qe(t,e)!==void 0,`a record of ${e.kinds.join(" or ")} in ${e.address}, as "<kind>:<id>"`)),n=e.cardinality==="one"?a:le(a).check(K(200));return Be(e.description?n.check(pe(e.description)):n,e)}var bn=new WeakMap;function mn(e,a){bn.set(e,a)}var vn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],V=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function un(e,a=vn){if(!V(e))return{document:e,respelled:[]};let n=[],t=e;for(let l of a)t=Re(t,l.where.split("."),l,"",n);return{document:t,respelled:n}}function Re(e,a,n,t,l){if(a.length===0){if(!V(e)||!Object.hasOwn(e,n.was))return e;l.push(`${t}${n.was}`);let{[n.was]:B,...F}=e;return Object.hasOwn(e,n.now)?F:{...F,[n.now]:B}}if(!V(e))return e;let[c,...x]=a,S=c.endsWith("[]"),I=S?c.slice(0,-2):c,$=e[I],T=$;if(!S)T=Re($,x,n,`${t}${I}.`,l);else if(Array.isArray($)){let B=$.map((F,W)=>Re(F,x,n,`${t}${I}.${W}.`,l));T=B.some((F,W)=>F!==$[W])?B:$}return T===$?e:{...e,[I]:T}}var yn="graview-compiled@1";function xn(e,a){return e.find(([n,t])=>n!==q&&"ref"in t&&(t.ref==="*"||t.ref.includes(a)))?.[0]}var q="id",ue=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function gn(e){let a=Object.entries(e.fields),n=t=>["name","title","label"].find(l=>t.some(([c])=>c===l))??t[0]?.[0];return n(a.filter(([,t])=>t.required&&(t.type==="string"||t.type==="text")))??n(a.filter(([,t])=>t.type==="string"))}function hn(e,a,n){let t;switch(e.type){case"string":case"place":t=L().check(K(500));break;case"phone":t=L().check(K(40),de(fn,"a phone number"));break;case"text":t=L().check(K(2e4)),e.format&&(me(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let c=e.min??(e.type==="duration"?0:void 0),x=[...e.type==="number"?[]:[Me()],...c===void 0?[]:[De(c)],...e.max===void 0?[]:[je(e.max)],...e.step===void 0?[]:[$e(e.step)]];t=x.length>0?ce().check(...x):ce();break}case"boolean":t=Pe();break;case"date":t=L().check(de(ke,"a date like 2026-10-02"));break;case"datetime":t=L().check(fe(Ne,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=Fe(e.options);break;case"list":t=le(e.of==="number"?ce():e.of==="date"?L().check(de(ke)):e.of==="image"||e.of==="file"?we(e.of):L().check(K(500))).check(K(200));break;case"image":case"file":t=we(e.type);break;case"app-link":t=Ze();break;case"url":t=Ge();break;case"email":t=Te();break}let l=e.type==="number"||e.type==="integer";return ln(t,l&&e.format==="duration"?"duration":e.type),e.description&&(t=t.check(pe(e.description))),l&&(e.format==="money"||e.format==="percent"||!e.format&&e.unit)&&Qe(t,{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{}}),a?ne(t):t}var ie=e=>{throw new U(`there is no record "${e}"`,"invalid")},On=(e,a)=>"field"in e?hn(e.field,e.optional,a):"ref"in e?Xe(e.ref):ne(Le()),Rn=new WeakMap;var Ae=(e,a)=>V(a)&&Object.keys(e??{}).length===Object.keys(a).length&&Object.keys(e??{}).every(n=>Object.hasOwn(a,n));function nt(e,a={}){let n=V(e)?e.format:void 0;if(n!==yn)return{ok:!1,findings:[Oe("compiled-format","format",n===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(n)}, and this build reads ${yn}`,"compile the document instead")]};let t=e,l=un(t.document).document,c=l===t.document?t:{...t,document:l},x=V(l)&&typeof l.name=="string"&&V(l.kinds)&&Ae(l.kinds,c.kinds)&&Ae(l.acts,c.acts)&&Ae(l.rules,c.rules)&&Array.isArray(c.edges)&&Array.isArray(c.findings),S={ok:!1,findings:[Oe("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!x)return S;try{return An(c,a)}catch{return S}}function An(e,a={}){let{document:n}=e,t=a.today??Ce,l=new Map(e.edges.map(([g,r])=>[g,r])),c=new Map;for(let[g,r]of Object.entries(n.kinds)){let R=e.kinds[g]?.computed,O=ve(r.edges);c.set(g,{fields:new Set([...Object.keys(r.fields),...O.keys()]),edges:new Map(Object.entries(be(r.edges)).map(([j,G])=>[j,G.cardinality??"many"])),...R?{computed:new Map(R)}:{},...O.size>0?{linked:O}:{}})}e.facts&&c.set(on,{computed:new Map(e.facts)});let x=cn(n),S=new Map,I=Object.entries(n.kinds).map(([g,r])=>{let R={};for(let[o,u]of Object.entries(r.fields))R[o]=hn(u,!u.required,x),u.repeats&&(R[_e(o)]=ne(He()));for(let[o,u]of ve(r.edges))R[o]=ne(pn(u));let{label:O,describe:j,durations:G}=e.kinds[g]??{},M=Object.entries(r.computed??{}).map(([o,u])=>[o,typeof u=="string"?{expr:u}:u]),J=Object.hasOwn(r.fields,"label")&&!r.fields.label.label&&!/\{\s*label\b/.test(r.label??`{${gn(r)??""}}`),_=Object.fromEntries([...J?[["label","Label"]]:[],...Object.entries(r.fields).filter(([,o])=>o.label).map(([o,u])=>[o,u.label]),...M.filter(([,o])=>o.label).map(([o,u])=>[o,u.label])]),A=Object.keys(_).length>0,f=Object.fromEntries(Object.entries(r.fields).filter(([,o])=>o.default!==void 0).map(([o,u])=>[o,u.default]));S.set(g,f);let D=Object.fromEntries(Object.entries(be(r.edges)).map(([o,{renamedFrom:u,...Z}])=>[o,Z])),z=o=>r[o]?{[o]:r[o]}:{};return Ke(g,{fields:he(R),edges:D,...z("plural"),...z("noun"),...z("description"),...O?{label:o=>oe(O,{node:o,kinds:c,today:t(),money:x})||o.id}:{},...j?{describe:o=>oe(j,{node:o,kinds:c,today:t(),money:x})}:{},...z("lifecycle"),...z("figure"),...z("fieldRoles"),...z("people"),archives:r.archives,...r.tidying?{tidying:r.tidying}:{},...M.length>0?{computed:Object.fromEntries(M.map(([o,u])=>[o,G?.includes(o)?{...u,as:"duration"}:r.computed[o]]))}:{},...A||r.glance||r.page?{display:{...A?{labels:_}:{},...r.glance?{glance:[...r.glance]}:{},...r.page?{page:r.page}:{}}}:{},...Object.keys(f).length>0?{defaults:f}:{}})}),$=Ue(I,n.computed);function T(g){return $.tryDefinition(g.kind)?.label?.(g)??g.id}let B=g=>({id:"",kind:g,...S.get(g)}),F=[];for(let[g,r]of Object.entries(n.acts??{})){let R=e.acts[g],{title:O,effects:j,guard:G,refusal:M,destructive:J,idempotent:_,creates:A,connects:f,severs:D,writes:z,writesOther:o,sets:u}=R,Z=new Map(R.args),ae={};for(let[s,b]of Z)ae[s]=On(b,x);let k=[r.on??[]].flat(),N=new Map(R.exprs),P=j.find(s=>"create"in s),Y=(s,b,p,w=null)=>{if(V(s)&&"expr"in s)return re(N.get(s.expr),{graph:p,subject:w,kinds:c,bindings:b,today:t()});let h=ue(s);return h===void 0?typeof s=="string"&&s.startsWith("$$")?s.slice(1):s:h==="now"?new Date().toISOString():h==="today"?t():b[h]},Se=(s,b)=>{if(!P)return"";let p=n.kinds[P.create].fields,w=B(P.create),h=[];for(let[v,ee]of Object.entries(P.set??{})){try{w[v]=Y(ee,s,b)??w[v]}catch{}let Q=ue(ee);Q&&s[Q]!==void 0&&h.push(v)}let C=T(w).trim(),H=h.filter(v=>w[v]!==!1&&p[v].type!=="text"&&!(/[^]{41}/.test(w[v])||/ .*[.!?]$/.test(w[v])&&!/[ .][A-Z]\w{0,3}\.$/.test(w[v]))&&T({...w,[v]:void 0}).trim()===C).map(v=>w[v]===!0?p[v].label??Ve(v):dn(w[v],p[v].format,t(),[],x));return C&&H.length>0?`${C} (${H.join(", ")})`:C};F.push(Ye(g,{input:he(ae),title:O,...r.description?{description:r.description}:{},...r.fromTheOtherEnd?{fromTheOtherEnd:r.fromTheOtherEnd}:{},...Z.has(q)?{subject:{kinds:k.length>0?k:"*",arg:q}}:{},...J?{destructive:!0}:{},..._?{idempotent:!0}:{},...A.length>0?{creates:A}:{},...f.length>0?{connects:f}:{},...D.length>0?{severs:D}:{},writes:z,...Object.keys(o).length>0?{writesOther:o}:{},...Object.keys(u).length>0?{sets:u}:{},describe:(s,b)=>{let p=typeof s[q]=="string"?b.getNode(s[q]):void 0,w=p?T(p):Se(s,b);return w?`${O}: ${w}`:O},apply(s,b){let p=s.graph,w=typeof b[q]=="string"?b[q]:void 0,h=w?p.getNode(w):void 0;if(w&&!h&&ie(w),h&&k.length>0&&!k.includes(h.kind))throw new U(`"${O}" acts on ${k.join(" or ")}, not on ${Ie(h.kind)}`,"invalid");let C={};for(let[i,d]of Object.entries(b))d!==void 0&&(C[i]=d);if(G&&h){let i;try{i=re(G,{graph:p,subject:h,kinds:c,bindings:C,today:t()})}catch(d){throw d instanceof te?new U(`"${O}" could not be judged: ${d.sentence}`):d}if(i!==!0)throw new U(M?oe(M,{node:h,kinds:c,graph:p,bindings:C,today:t(),money:x}):`"${O}" is not allowed for ${T(h)} right now`)}let H=new Map,v=i=>p.has(i)||[...H.values()].includes(i),ee=new Set,Q=i=>{let d=We(i);ee.has(d)||(ee.add(d),s.removeEdge(i))},X=(i,d)=>{let m=ue(i);if(m==="subject")return w;if(m==="me"){let y=s.me;if(y&&n.kinds[p.getNode(y)?.kind]?.people)return y;throw new U(`"${O}" is done as you, and you have no record here`)}if(H.has(m))return H.get(m);try{return Y(i,C,p,d??h??null)}catch(y){throw y instanceof te?new U(`"${O}" could not work out a value: ${y.sentence}`):y}};for(let i of j)if("create"in i){let d=n.kinds[i.create],m=B(i.create);for(let[ge,se]of Object.entries(i.set??{})){let Ee=X(se,void 0);Ee!==void 0&&(m[ge]=Ee)}let y=gn(d),E=s.freshId(String((y&&m[y])??i.create),i.create);s.addNode({...m,id:E}),i.as&&H.set(i.as,E)}else if("connect"in i||"sever"in i){let d="connect"in i?i.connect:i.sever,m=String(X(i.from,void 0)??""),y=String(X(i.to,void 0)??"");if(v(m)||ie(m),v(y)||ie(y),"connect"in i){if(l.get(d)?.cardinality==="one")for(let E of p.out(m,d))E.id!==y&&Q({kind:d,from:m,to:E.id});p.out(m,d).some(E=>E.id===y)||s.addEdge({kind:d,from:m,to:y})}else Q({kind:d,from:m,to:y})}else if("set"in i){let d=String(X(i.target??"$subject",void 0)??""),m=p.getNode(d);!m&&!v(d)&&ie(d);let y={};for(let[E,ge]of Object.entries(i.set)){let se=X(ge,m);se!==void 0&&(y[E]=se)}Object.keys(y).length>0&&s.patchNode(d,y)}else if("remove"in i){let d=String(X(i.remove,void 0)??"");p.has(d)||ie(d),s.removeNode(d)}else if("replace"in i&&h){let d=b.to;for(let m of i.replace){let y=l.get(m)?.from.includes(h.kind)??!0;for(let E of y?p.out(h.id,m):p.in(h.id,m))m===i.keep&&E.id===d||Q(y?{kind:m,from:h.id,to:E.id}:{kind:m,from:E.id,to:h.id})}}}}))}let W=[];for(let[g,r]of Object.entries(n.rules??{})){let{title:R,require:O,when:j,says:G}=e.rules[g],M=r.repairs??[],J=(A,f,D=t(),z)=>{let o=[],u={graph:A,subject:f,kinds:c,today:D,...z?{linked:z}:{},onUnread:k=>o.push(k)},Z;try{if(j&&re(j,u)!==!0)return[];if(Z=re(O,u)===!0,!Z&&o.length>0)throw new te(`it reads ${rn(o[0])}`,0)}catch(k){throw k instanceof an?new Je(k.sentence):k instanceof te?new Error(k.sentence):k}if(Z)return[];let ae=M.flatMap(k=>{let N=n.acts?.[k.act],P={},Y=f&&N?.on&&N.fromTheOtherEnd&&![N.on].flat().includes(f.kind)?xn(e.acts[k.act].args,f.kind):void 0;Y?P[Y]=f.id:f&&(N?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(k.act))&&(P[q]=f.id);for(let[b,p]of Object.entries(k.args??{}))P[b]=ue(p)==="subject"?f?.id:p;let s=(N?e.acts[k.act].args:[]).filter(([b,p])=>p.required&&P[b]===void 0).map(([b])=>b);return[{mutation:k.act,label:k.label??(Y?N.fromTheOtherEnd:N?.title)??k.act.replace(/-/g," "),args:P,...s.length>0?{missing:s}:{}}]});return[{invariant:g,...f?{subjectId:f.id}:{},label:R,message:G?oe(G,{node:f,kinds:c,graph:A,today:D,money:x}):f?`${T(f)}: ${R}`:R,nodeIds:f?[f.id]:[],repairs:ae}]},_={label:R,shape:{over:r.over,require:O,when:j,says:G,declared:n.kinds,money:x,kinds:c,today:t},judgment:{require:r.require,...r.when?{when:r.when}:{},...r.says?{says:r.says}:{}},...r.description?{description:r.description}:{},...M.length>0?{repairs:M.map(A=>A.act)}:{}};W.push(r.over==="graph"?xe(g,{scope:"graph",..._,evaluate:({graph:A,today:f,context:D})=>J(A,null,f,D?.linked)}):xe(g,{scope:{kind:r.over},..._,evaluate:({graph:A,subject:f,today:D,context:z})=>J(A,f,D,z?.linked)}))}let ze=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},ye={name:n.name,schema:$,mutations:F,invariants:W,...ze?{policy:ze}:{},...e.brand?{brand:e.brand}:{},...n.modules?{modules:n.modules}:{},...n.lenses?{lenses:n.lenses}:{},...n.pages?{pages:n.pages}:{},...n.settings?{settings:n.settings}:{},...n.connections?{connections:n.connections}:{},...e.viewSpecs?{viewSpecs:e.viewSpecs}:{},...e.home?{home:e.home}:{},version:n.version??1};return mn(ye,n),Rn.set(ye,e),{ok:!0,app:ye,document:n,findings:e.findings,sights:n.policy?.sees,kinds:c}}export{un as a,Dn as b,yn as c,q as d,ue as e,gn as f,nt as g,An as h};
1
+ import{b as rn,c as on,d as te,e as an,f as re,h as Oe,i as sn,n as dn,q as oe}from"./chunk.4K5QCJFH.js";import{A as pe,B as me,Da as _e,E as ke,G as Ne,Ga as He,H as Ce,Ob as en,Qa as Ue,Ra as We,V as Ke,Va as xe,Wa as Je,Yb as nn,Z as Ve,Zb as tn,b as je,c as De,d as $e,da as Ie,e as K,g as de,h as L,i as Te,ib as U,j as Ge,k as ce,ka as we,l as Me,lb as Ye,m as Pe,na as Ze,o as Le,p as le,pb as Qe,q as he,qa as qe,sa as Be,ub as Xe,v as Fe,wa as be,x as ne,xa as ve,y as fe}from"./chunk.X7W27IRI.js";function Dn(e,a){let n=e.brand??{},t=n.accent?tn(n.accent):void 0;t&&!t.ok&&a.push(sn("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${t.why}`,"pick a color further from orange-red, or a darker one"));let l=typeof n.logo=="string"?{src:n.logo}:n.logo,c=n.name??e.name,x=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,S])=>typeof S=="string"&&!/url\(|@import|[;{}<>\\]/i.test(S)).map(([S,I])=>[S,nn(I)])):void 0;return{name:c,schemes:t?.ok?t.schemes:en,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...l?{logo:l.src,logoAlt:l.alt??c}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...x?{typography:x}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{}}}function cn(e){let{currency:a,locale:n}=e.brand??{};return{...a?{currency:a}:{},...n?{locale:n}:{}}}var kn=Symbol.for("@graview/core:typed-field"),ln=(e,a)=>(/^(phone|place|duration)$/.test(a)&&(me(e)[kn]=a),e),fn=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;function pn(e){let a=L().check(K(300),fe(t=>qe(t,e)!==void 0,`a record of ${e.kinds.join(" or ")} in ${e.address}, as "<kind>:<id>"`)),n=e.cardinality==="one"?a:le(a).check(K(200));return Be(e.description?n.check(pe(e.description)):n,e)}var bn=new WeakMap;function mn(e,a){bn.set(e,a)}var vn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],V=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function un(e,a=vn){if(!V(e))return{document:e,respelled:[]};let n=[],t=e;for(let l of a)t=Re(t,l.where.split("."),l,"",n);return{document:t,respelled:n}}function Re(e,a,n,t,l){if(a.length===0){if(!V(e)||!Object.hasOwn(e,n.was))return e;l.push(`${t}${n.was}`);let{[n.was]:B,...F}=e;return Object.hasOwn(e,n.now)?F:{...F,[n.now]:B}}if(!V(e))return e;let[c,...x]=a,S=c.endsWith("[]"),I=S?c.slice(0,-2):c,$=e[I],T=$;if(!S)T=Re($,x,n,`${t}${I}.`,l);else if(Array.isArray($)){let B=$.map((F,W)=>Re(F,x,n,`${t}${I}.${W}.`,l));T=B.some((F,W)=>F!==$[W])?B:$}return T===$?e:{...e,[I]:T}}var yn="graview-compiled@1";function xn(e,a){return e.find(([n,t])=>n!==q&&"ref"in t&&(t.ref==="*"||t.ref.includes(a)))?.[0]}var q="id",ue=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function gn(e){let a=Object.entries(e.fields),n=t=>["name","title","label"].find(l=>t.some(([c])=>c===l))??t[0]?.[0];return n(a.filter(([,t])=>t.required&&(t.type==="string"||t.type==="text")))??n(a.filter(([,t])=>t.type==="string"))}function hn(e,a,n){let t;switch(e.type){case"string":case"place":t=L().check(K(500));break;case"phone":t=L().check(K(40),de(fn,"a phone number"));break;case"text":t=L().check(K(2e4)),e.format&&(me(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let c=e.min??(e.type==="duration"?0:void 0),x=[...e.type==="number"?[]:[Me()],...c===void 0?[]:[De(c)],...e.max===void 0?[]:[je(e.max)],...e.step===void 0?[]:[$e(e.step)]];t=x.length>0?ce().check(...x):ce();break}case"boolean":t=Pe();break;case"date":t=L().check(de(ke,"a date like 2026-10-02"));break;case"datetime":t=L().check(fe(Ne,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=Fe(e.options);break;case"list":t=le(e.of==="number"?ce():e.of==="date"?L().check(de(ke)):e.of==="image"||e.of==="file"?we(e.of):L().check(K(500))).check(K(200));break;case"image":case"file":t=we(e.type);break;case"app-link":t=Ze();break;case"url":t=Ge();break;case"email":t=Te();break}let l=e.type==="number"||e.type==="integer";return ln(t,l&&e.format==="duration"?"duration":e.type),e.description&&(t=t.check(pe(e.description))),l&&(e.format==="money"||e.format==="percent"||!e.format&&e.unit)&&Qe(t,{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{}}),a?ne(t):t}var ie=e=>{throw new U(`there is no record "${e}"`,"invalid")},On=(e,a)=>"field"in e?hn(e.field,e.optional,a):"ref"in e?Xe(e.ref):ne(Le()),Rn=new WeakMap;var Ae=(e,a)=>V(a)&&Object.keys(e??{}).length===Object.keys(a).length&&Object.keys(e??{}).every(n=>Object.hasOwn(a,n));function nt(e,a={}){let n=V(e)?e.format:void 0;if(n!==yn)return{ok:!1,findings:[Oe("compiled-format","format",n===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(n)}, and this build reads ${yn}`,"compile the document instead")]};let t=e,l=un(t.document).document,c=l===t.document?t:{...t,document:l},x=V(l)&&typeof l.name=="string"&&V(l.kinds)&&Ae(l.kinds,c.kinds)&&Ae(l.acts,c.acts)&&Ae(l.rules,c.rules)&&Array.isArray(c.edges)&&Array.isArray(c.findings),S={ok:!1,findings:[Oe("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!x)return S;try{return An(c,a)}catch{return S}}function An(e,a={}){let{document:n}=e,t=a.today??Ce,l=new Map(e.edges.map(([g,r])=>[g,r])),c=new Map;for(let[g,r]of Object.entries(n.kinds)){let R=e.kinds[g]?.computed,O=ve(r.edges);c.set(g,{fields:new Set([...Object.keys(r.fields),...O.keys()]),edges:new Map(Object.entries(be(r.edges)).map(([j,G])=>[j,G.cardinality??"many"])),...R?{computed:new Map(R)}:{},...O.size>0?{linked:O}:{}})}e.facts&&c.set(on,{computed:new Map(e.facts)});let x=cn(n),S=new Map,I=Object.entries(n.kinds).map(([g,r])=>{let R={};for(let[o,u]of Object.entries(r.fields))R[o]=hn(u,!u.required,x),u.repeats&&(R[_e(o)]=ne(He()));for(let[o,u]of ve(r.edges))R[o]=ne(pn(u));let{label:O,describe:j,durations:G}=e.kinds[g]??{},M=Object.entries(r.computed??{}).map(([o,u])=>[o,typeof u=="string"?{expr:u}:u]),J=Object.hasOwn(r.fields,"label")&&!r.fields.label.label&&!/\{\s*label\b/.test(r.label??`{${gn(r)??""}}`),_=Object.fromEntries([...J?[["label","Label"]]:[],...Object.entries(r.fields).filter(([,o])=>o.label).map(([o,u])=>[o,u.label]),...M.filter(([,o])=>o.label).map(([o,u])=>[o,u.label])]),A=Object.keys(_).length>0,f=Object.fromEntries(Object.entries(r.fields).filter(([,o])=>o.default!==void 0).map(([o,u])=>[o,u.default]));S.set(g,f);let D=Object.fromEntries(Object.entries(be(r.edges)).map(([o,{renamedFrom:u,...Z}])=>[o,Z])),z=o=>r[o]?{[o]:r[o]}:{};return Ke(g,{fields:he(R),edges:D,...z("plural"),...z("noun"),...z("description"),...O?{label:o=>oe(O,{node:o,kinds:c,today:t(),money:x})||o.id}:{},...j?{describe:o=>oe(j,{node:o,kinds:c,today:t(),money:x})}:{},...z("lifecycle"),...z("figure"),...z("fieldRoles"),...z("people"),archives:r.archives,...r.tidying?{tidying:r.tidying}:{},...M.length>0?{computed:Object.fromEntries(M.map(([o,u])=>[o,G?.includes(o)?{...u,as:"duration"}:r.computed[o]]))}:{},...A||r.glance||r.page?{display:{...A?{labels:_}:{},...r.glance?{glance:[...r.glance]}:{},...r.page?{page:r.page}:{}}}:{},...Object.keys(f).length>0?{defaults:f}:{}})}),$=Ue(I,n.computed);function T(g){return $.tryDefinition(g.kind)?.label?.(g)??g.id}let B=g=>({id:"",kind:g,...S.get(g)}),F=[];for(let[g,r]of Object.entries(n.acts??{})){let R=e.acts[g],{title:O,effects:j,guard:G,refusal:M,destructive:J,idempotent:_,creates:A,connects:f,severs:D,writes:z,writesOther:o,sets:u}=R,Z=new Map(R.args),ae={};for(let[s,b]of Z)ae[s]=On(b,x);let k=[r.on??[]].flat(),N=new Map(R.exprs),P=j.find(s=>"create"in s),Y=(s,b,p,w=null)=>{if(V(s)&&"expr"in s)return re(N.get(s.expr),{graph:p,subject:w,kinds:c,bindings:b,today:t()});let h=ue(s);return h===void 0?typeof s=="string"&&s.startsWith("$$")?s.slice(1):s:h==="now"?new Date().toISOString():h==="today"?t():b[h]},Se=(s,b)=>{if(!P)return"";let p=n.kinds[P.create].fields,w=B(P.create),h=[];for(let[v,ee]of Object.entries(P.set??{})){try{w[v]=Y(ee,s,b)??w[v]}catch{}let Q=ue(ee);Q&&s[Q]!==void 0&&h.push(v)}let C=T(w).trim(),H=h.filter(v=>w[v]!==!1&&p[v].type!=="text"&&!(/[^]{41}/.test(w[v])||/ .*[.!?]$/.test(w[v])&&!/[ .][A-Z]\w{0,3}\.$/.test(w[v]))&&T({...w,[v]:void 0}).trim()===C).map(v=>w[v]===!0?p[v].label??Ve(v):dn(w[v],p[v].format,t(),[],x));return C&&H.length>0?`${C} (${H.join(", ")})`:C};F.push(Ye(g,{input:he(ae),title:O,...r.description?{description:r.description}:{},...r.fromTheOtherEnd?{fromTheOtherEnd:r.fromTheOtherEnd}:{},...Z.has(q)?{subject:{kinds:k.length>0?k:"*",arg:q}}:{},...J?{destructive:!0}:{},..._?{idempotent:!0}:{},...A.length>0?{creates:A}:{},...f.length>0?{connects:f}:{},...D.length>0?{severs:D}:{},writes:z,...Object.keys(o).length>0?{writesOther:o}:{},...Object.keys(u).length>0?{sets:u}:{},describe:(s,b)=>{let p=typeof s[q]=="string"?b.getNode(s[q]):void 0,w=p?T(p):Se(s,b);return w?`${O}: ${w}`:O},apply(s,b){let p=s.graph,w=typeof b[q]=="string"?b[q]:void 0,h=w?p.getNode(w):void 0;if(w&&!h&&ie(w),h&&k.length>0&&!k.includes(h.kind))throw new U(`"${O}" acts on ${k.join(" or ")}, not on ${Ie(h.kind)}`,"invalid");let C={};for(let[i,d]of Object.entries(b))d!==void 0&&(C[i]=d);if(G&&h){let i;try{i=re(G,{graph:p,subject:h,kinds:c,bindings:C,today:t()})}catch(d){throw d instanceof te?new U(`"${O}" could not be judged: ${d.sentence}`):d}if(i!==!0)throw new U(M?oe(M,{node:h,kinds:c,graph:p,bindings:C,today:t(),money:x}):`"${O}" is not allowed for ${T(h)} right now`)}let H=new Map,v=i=>p.has(i)||[...H.values()].includes(i),ee=new Set,Q=i=>{let d=We(i);ee.has(d)||(ee.add(d),s.removeEdge(i))},X=(i,d)=>{let m=ue(i);if(m==="subject")return w;if(m==="me"){let y=s.me;if(y&&n.kinds[p.getNode(y)?.kind]?.people)return y;throw new U(`"${O}" is done as you, and you have no record here`)}if(H.has(m))return H.get(m);try{return Y(i,C,p,d??h??null)}catch(y){throw y instanceof te?new U(`"${O}" could not work out a value: ${y.sentence}`):y}};for(let i of j)if("create"in i){let d=n.kinds[i.create],m=B(i.create);for(let[ge,se]of Object.entries(i.set??{})){let Ee=X(se,void 0);Ee!==void 0&&(m[ge]=Ee)}let y=gn(d),E=s.freshId(String((y&&m[y])??i.create),i.create);s.addNode({...m,id:E}),i.as&&H.set(i.as,E)}else if("connect"in i||"sever"in i){let d="connect"in i?i.connect:i.sever,m=String(X(i.from,void 0)??""),y=String(X(i.to,void 0)??"");if(v(m)||ie(m),v(y)||ie(y),"connect"in i){if(l.get(d)?.cardinality==="one")for(let E of p.out(m,d))E.id!==y&&Q({kind:d,from:m,to:E.id});p.out(m,d).some(E=>E.id===y)||s.addEdge({kind:d,from:m,to:y})}else Q({kind:d,from:m,to:y})}else if("set"in i){let d=String(X(i.target??"$subject",void 0)??""),m=p.getNode(d);!m&&!v(d)&&ie(d);let y={};for(let[E,ge]of Object.entries(i.set)){let se=X(ge,m);se!==void 0&&(y[E]=se)}Object.keys(y).length>0&&s.patchNode(d,y)}else if("remove"in i){let d=String(X(i.remove,void 0)??"");p.has(d)||ie(d),s.removeNode(d)}else if("replace"in i&&h){let d=b.to;for(let m of i.replace){let y=l.get(m)?.from.includes(h.kind)??!0;for(let E of y?p.out(h.id,m):p.in(h.id,m))m===i.keep&&E.id===d||Q(y?{kind:m,from:h.id,to:E.id}:{kind:m,from:E.id,to:h.id})}}}}))}let W=[];for(let[g,r]of Object.entries(n.rules??{})){let{title:R,require:O,when:j,says:G}=e.rules[g],M=r.repairs??[],J=(A,f,D=t(),z)=>{let o=[],u={graph:A,subject:f,kinds:c,today:D,...z?{linked:z}:{},onUnread:k=>o.push(k)},Z;try{if(j&&re(j,u)!==!0)return[];if(Z=re(O,u)===!0,!Z&&o.length>0)throw new te(`it reads ${rn(o[0])}`,0)}catch(k){throw k instanceof an?new Je(k.sentence):k instanceof te?new Error(k.sentence):k}if(Z)return[];let ae=M.flatMap(k=>{let N=n.acts?.[k.act],P={},Y=f&&N?.on&&N.fromTheOtherEnd&&![N.on].flat().includes(f.kind)?xn(e.acts[k.act].args,f.kind):void 0;Y?P[Y]=f.id:f&&(N?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(k.act))&&(P[q]=f.id);for(let[b,p]of Object.entries(k.args??{}))P[b]=ue(p)==="subject"?f?.id:p;let s=(N?e.acts[k.act].args:[]).filter(([b,p])=>p.required&&P[b]===void 0).map(([b])=>b);return[{mutation:k.act,label:k.label??(Y?N.fromTheOtherEnd:N?.title)??k.act.replace(/-/g," "),args:P,...s.length>0?{missing:s}:{}}]});return[{invariant:g,...f?{subjectId:f.id}:{},label:R,message:G?oe(G,{node:f,kinds:c,graph:A,today:D,money:x}):f?`${T(f)}: ${R}`:R,nodeIds:f?[f.id]:[],repairs:ae}]},_={label:R,shape:{over:r.over,require:O,when:j,says:G,declared:n.kinds,money:x,kinds:c,today:t},judgment:{require:r.require,...r.when?{when:r.when}:{},...r.says?{says:r.says}:{}},...r.description?{description:r.description}:{},...M.length>0?{repairs:M.map(A=>A.act)}:{}};W.push(r.over==="graph"?xe(g,{scope:"graph",..._,evaluate:({graph:A,today:f,context:D})=>J(A,null,f,D?.linked)}):xe(g,{scope:{kind:r.over},..._,evaluate:({graph:A,subject:f,today:D,context:z})=>J(A,f,D,z?.linked)}))}let ze=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},ye={name:n.name,schema:$,mutations:F,invariants:W,...ze?{policy:ze}:{},...e.brand?{brand:e.brand}:{},...n.modules?{modules:n.modules}:{},...n.lenses?{lenses:n.lenses}:{},...n.pages?{pages:n.pages}:{},...n.settings?{settings:n.settings}:{},...n.connections?{connections:n.connections}:{},...e.viewSpecs?{viewSpecs:e.viewSpecs}:{},...e.home?{home:e.home}:{},version:n.version??1};return mn(ye,n),Rn.set(ye,e),{ok:!0,app:ye,document:n,findings:e.findings,sights:n.policy?.sees,kinds:c}}export{un as a,Dn as b,yn as c,q as d,ue as e,gn as f,nt as g,An as h};
@@ -1 +1 @@
1
- import{a as g}from"./chunk.TI4OSTQV.js";import{Db as c,Hb as y,Ta as p}from"./chunk.MNP4JI33.js";function h(t,i=()=>!0){let e=c(t),n=new Set(t.map(o=>o.lineage?.suggestion));return t.filter(o=>o.suggests&&!o.withheld&&!e.has(o.id)&&!n.has(o.id)).map(({id:o,batch:s,suggests:r,intent:x,author:b,lineage:d,at:O})=>{let l=new Set;return JSON.stringify(r.map(u=>u.args),(u,a)=>(typeof a=="string"&&i(a)&&l.add(a),a)),{id:o,batch:s,calls:r,intent:x,author:b,...d?{lineage:d}:{},at:O,about:[...l]}})}function S(t,i){return t.ops.length>0&&t.ops.every(e=>e.suggests!==void 0||e.undoes!==void 0&&i(e.undoes)?.suggests!==void 0)}var f=t=>JSON.stringify([t.kind,t.id??"",t.name??""]);function I(t,i=()=>{}){let e=[];for(let n of t){if(S(n,i))continue;let o=e.at(-1);if(!y(n.author)){e.push({batch:n});continue}if(o&&"digest"in o&&f(o.digest.author)===f(n.author)){let s=[...o.digest.batches,n];e[e.length-1]={digest:{author:o.digest.author,batches:s,things:m(s),at:n.at}}}else e.push({digest:{author:n.author,batches:[n],things:m([n]),at:n.at}})}return e}var m=t=>t.reduce((i,e)=>i+(e.undone?0:e.ops.length),0);function j(t,i=new Date().toISOString().slice(0,10)){let e=t.at.slice(0,10),n=e===i?"today":`on ${new Date(`${e}T12:00:00Z`).toLocaleDateString("en-US",{month:"short",day:"numeric",timeZone:"UTC"})}`;return`Tidied ${t.things===1?"one thing":`${t.things} things`} ${n}`}var A=t=>t;function v(t,i){let e=g(t),n=e?.store??t,o=i??e?.principal,s=(o!==void 0?n.seenBy(o):n).log.all();return h(s,r=>n.graph.has(r))}function w(t,i,e){let n=v(t,e).find(o=>o.id===i);if(!n)throw new p("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return n}function D(t,i,e={}){let n=g(t)?.store??t,o=e.author??A(n).by,s=w(n,i,o);return n.applyAll(s.calls,{...e,author:o,lineage:{...s.lineage,suggestion:i}})}function L(t,i,e={}){let n=g(t)?.store??t,o=e.author??A(n).by,s=w(n,i,o);return n.undo(s.batch,{...e,author:o})}export{I as a,j as b,v as c,D as d,L as e};
1
+ import{a as g}from"./chunk.TI4OSTQV.js";import{Db as c,Hb as y,Ta as p}from"./chunk.X7W27IRI.js";function h(t,i=()=>!0){let e=c(t),n=new Set(t.map(o=>o.lineage?.suggestion));return t.filter(o=>o.suggests&&!o.withheld&&!e.has(o.id)&&!n.has(o.id)).map(({id:o,batch:s,suggests:r,intent:x,author:b,lineage:d,at:O})=>{let l=new Set;return JSON.stringify(r.map(u=>u.args),(u,a)=>(typeof a=="string"&&i(a)&&l.add(a),a)),{id:o,batch:s,calls:r,intent:x,author:b,...d?{lineage:d}:{},at:O,about:[...l]}})}function S(t,i){return t.ops.length>0&&t.ops.every(e=>e.suggests!==void 0||e.undoes!==void 0&&i(e.undoes)?.suggests!==void 0)}var f=t=>JSON.stringify([t.kind,t.id??"",t.name??""]);function I(t,i=()=>{}){let e=[];for(let n of t){if(S(n,i))continue;let o=e.at(-1);if(!y(n.author)){e.push({batch:n});continue}if(o&&"digest"in o&&f(o.digest.author)===f(n.author)){let s=[...o.digest.batches,n];e[e.length-1]={digest:{author:o.digest.author,batches:s,things:m(s),at:n.at}}}else e.push({digest:{author:n.author,batches:[n],things:m([n]),at:n.at}})}return e}var m=t=>t.reduce((i,e)=>i+(e.undone?0:e.ops.length),0);function j(t,i=new Date().toISOString().slice(0,10)){let e=t.at.slice(0,10),n=e===i?"today":`on ${new Date(`${e}T12:00:00Z`).toLocaleDateString("en-US",{month:"short",day:"numeric",timeZone:"UTC"})}`;return`Tidied ${t.things===1?"one thing":`${t.things} things`} ${n}`}var A=t=>t;function v(t,i){let e=g(t),n=e?.store??t,o=i??e?.principal,s=(o!==void 0?n.seenBy(o):n).log.all();return h(s,r=>n.graph.has(r))}function w(t,i,e){let n=v(t,e).find(o=>o.id===i);if(!n)throw new p("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return n}function D(t,i,e={}){let n=g(t)?.store??t,o=e.author??A(n).by,s=w(n,i,o);return n.applyAll(s.calls,{...e,author:o,lineage:{...s.lineage,suggestion:i}})}function L(t,i,e={}){let n=g(t)?.store??t,o=e.author??A(n).by,s=w(n,i,o);return n.undo(s.batch,{...e,author:o})}export{I as a,j as b,v as c,D as d,L as e};
@@ -1,4 +1,4 @@
1
- import{dc as e}from"./chunk.MNP4JI33.js";var a=`
1
+ import{ec as e}from"./chunk.X7W27IRI.js";var a=`
2
2
  .graview-spec{display:flex;flex-direction:column;gap:6px;min-width:0;color:var(--graview-ink)}
3
3
 
4
4
  .graview-spec-row{flex-direction:row;flex-wrap:wrap;align-items:center;gap:4px 10px;box-sizing:border-box;max-width:100%;padding:5px 10px;border:1px solid var(--graview-edge);border-radius:var(--graview-radius-sm,8px);background:var(--graview-panel);font-size:.875rem}
@@ -1,3 +1,3 @@
1
- import{b as ee}from"./chunk.JQU5GEU3.js";import"./chunk.B2GLDIAS.js";import"./chunk.6YCBYL2Y.js";import{c as Z}from"./chunk.UGFJKSHU.js";import{F as ce,Q as X}from"./chunk.6QWV5MVH.js";import{X as J,_ as U,cc as j}from"./chunk.MNP4JI33.js";import{b as _}from"./chunk.AJZBJBMO.js";var B=_(ce(),1);var ue=6;function ne(v,b,h,f,L){let t=new Set(v),o=new Map;for(let r of b)for(let[u,a,S]of[[r.from,r.to,"out"],[r.to,r.from,"in"]]){if(!t.has(u)||t.has(a))continue;let p=h(a);if(p===void 0)continue;let m=`${u}|${r.kind}|${S}|${p}`,k=o.get(m);k?k.others.includes(a)||k.others.push(a):o.set(m,{self:u,edge:r.kind,direction:S,kind:p,others:[a]})}let d=[];for(let r of o.values()){let u=h(r.self)??"",a=Z(L,r.direction==="out"?u:r.kind,r.edge,r.direction),S=r.others.filter(f),p=r.others.filter(m=>!f(m));if(r.others.length>ue){d.push({...r,others:r.others,lands:"district",words:a});continue}for(let m of S)d.push({...r,others:[m],lands:"record",words:a});p.length>0&&d.push({...r,others:p,lands:"district",words:a})}return d}function te(v,b=[]){let h=[...b],f=new Map,L=t=>h.some(o=>t.x<o.x+o.width&&o.x<t.x+t.width&&t.y<o.y+o.height&&o.y<t.y+t.height);for(let t of[...v].sort((o,d)=>o.y-d.y||o.x-d.x)){let o={x:t.x-t.width/2,y:t.y-t.height,width:t.width,height:t.height};for(let d=0;d<12&&L(o);d++)o.y+=t.height+2;h.push(o),f.set(t.key,{x:o.x,y:o.y})}return f}var s=_(X(),1),ge=4;function we({frame:v,width:b,height:h,stageRef:f,tick:L,store:t,graphVersion:o,selection:d,view:r,rulers:{visibleRect:u,clipQuadratic:a,unsureOf:S,unsureDash:p,unsureOpacity:m}}){let k=n=>t.graph.getNode(n)?.kind,C=ee(d,r,k),$=C.lens===null&&C.records.length<=ge?C.records:[],re=$.join(`
1
+ import{b as ee}from"./chunk.FUQVNXLB.js";import"./chunk.Z7ZCR4LN.js";import"./chunk.RIW7SQH4.js";import{c as Z}from"./chunk.FSAHO3LV.js";import{F as ce,Q as X}from"./chunk.UWIYKGYK.js";import{X as J,_ as U,dc as j}from"./chunk.X7W27IRI.js";import{b as _}from"./chunk.AJZBJBMO.js";var B=_(ce(),1);var ue=6;function ne(v,b,h,f,L){let t=new Set(v),o=new Map;for(let r of b)for(let[u,a,S]of[[r.from,r.to,"out"],[r.to,r.from,"in"]]){if(!t.has(u)||t.has(a))continue;let p=h(a);if(p===void 0)continue;let m=`${u}|${r.kind}|${S}|${p}`,k=o.get(m);k?k.others.includes(a)||k.others.push(a):o.set(m,{self:u,edge:r.kind,direction:S,kind:p,others:[a]})}let d=[];for(let r of o.values()){let u=h(r.self)??"",a=Z(L,r.direction==="out"?u:r.kind,r.edge,r.direction),S=r.others.filter(f),p=r.others.filter(m=>!f(m));if(r.others.length>ue){d.push({...r,others:r.others,lands:"district",words:a});continue}for(let m of S)d.push({...r,others:[m],lands:"record",words:a});p.length>0&&d.push({...r,others:p,lands:"district",words:a})}return d}function te(v,b=[]){let h=[...b],f=new Map,L=t=>h.some(o=>t.x<o.x+o.width&&o.x<t.x+t.width&&t.y<o.y+o.height&&o.y<t.y+t.height);for(let t of[...v].sort((o,d)=>o.y-d.y||o.x-d.x)){let o={x:t.x-t.width/2,y:t.y-t.height,width:t.width,height:t.height};for(let d=0;d<12&&L(o);d++)o.y+=t.height+2;h.push(o),f.set(t.key,{x:o.x,y:o.y})}return f}var s=_(X(),1),ge=4;function we({frame:v,width:b,height:h,stageRef:f,tick:L,store:t,graphVersion:o,selection:d,view:r,rulers:{visibleRect:u,clipQuadratic:a,unsureOf:S,unsureDash:p,unsureOpacity:m}}){let k=n=>t.graph.getNode(n)?.kind,C=ee(d,r,k),$=C.lens===null&&C.records.length<=ge?C.records:[],re=$.join(`
2
2
  `),[c,q]=(0,B.useState)(null);(0,B.useLayoutEffect)(()=>{let n=f.current;if(!r.overview||$.length===0||!n||typeof document>"u"||v.t<1){q(null);return}let g=n.getBoundingClientRect(),R=e=>({x:e.left-g.left,y:e.top-g.top,width:e.width,height:e.height}),N=new Map,oe=$.map(e=>`[data-graview-view="${CSS.escape(e)}"]`).join(","),D=e=>{if(N.has(e))return N.get(e);let i=null;for(let y of n.querySelectorAll(`[data-graview-pick="${CSS.escape(e)}"], [data-graview-view="${CSS.escape(e)}"]`))if(!y.closest("[data-graview-offstage], [data-graview-screen]")&&!(!$.includes(e)&&y.closest(oe))&&(i=u(y,n),i))break;if(!i){let y=n.querySelector(`[data-graview-building="${CSS.escape(e)}"]`);y&&(i=R(y.getBoundingClientRect()))}return N.set(e,i),i},T=e=>{let i=n.querySelector(`[data-graview-plot="kind:${CSS.escape(e)}"] .graview-plot-tile`);return i?R(i.getBoundingClientRect()):null},ie=ne($,t.graph.allEdges(),k,e=>D(e)!==null,t.schema),K=[];for(let e of n.querySelectorAll('[data-graview-view^="kind:"] .graview-kind-face')){let i=u(e,n);i&&K.push(i)}let H=e=>({x:e.x+e.width/2,y:e.y+e.height/2}),E=[],W=new Set($),A=new Set;for(let e of ie){let i=k(e.self),y=D(e.self)??(i?T(i):null),Q=e.lands==="record"?D(e.others[0]):T(e.kind);if(!y||!Q)continue;for(let l of e.others)W.add(l);A.add(e.kind),i&&A.add(i);let x=H(y),w=H(Q),O=Math.hypot(w.x-x.x,w.y-x.y);if(O<6)continue;let V=Math.min(40,O*.12)*(E.length%2===0?1:-1),de={x:(x.x+w.x)/2-(w.y-x.y)/O*V,y:(x.y+w.y)/2+(w.x-x.x)/O*V},Y=a({p0:x,c:de,p1:w},K);if(Y.length===0)continue;let ae=Y.map(l=>`M ${l.p0.x.toFixed(1)} ${l.p0.y.toFixed(1)} Q ${l.c.x.toFixed(1)} ${l.c.y.toFixed(1)} ${l.p1.x.toFixed(1)} ${l.p1.y.toFixed(1)}`).join(" "),le=l=>{let F=t.graph.getNode(l);return F?J(t.schema.tryDefinition(F.kind),F):l},G=e.lands==="record"?`${e.words}: ${le(e.others[0])}`:`${e.words}: ${U(t.schema,e.kind,e.others.length)}`,P=e.others[0],I=e.lands==="record"?S?.(e.edge,e.direction==="out"?e.self:P,e.direction==="out"?P:e.self):void 0;E.push({key:`${e.self}|${e.edge}|${e.direction}|${e.lands}|${P}`,link:e,d:ae,end:w,said:I!==void 0?`${G} \xB7 unsure`:G,...I!==void 0?{unsure:I}:{}})}let z=[];for(let e of n.querySelectorAll(".graview-kind-face[data-graview-nameplate]")){let i=u(e,n);i&&z.push(i)}let se=te(E.map(e=>({key:e.key,x:e.end.x,y:e.end.y-6,width:Math.min(260,14+e.said.length*6.6),height:20})),z);q({lines:E,labels:se,reached:[...W],districts:[...A]})},[re,r.overview,v,o,L,b,h,f,t]);let M=(0,B.useMemo)(()=>{if(!c)return"";let n=c.reached.map(R=>`[data-graview-building="${CSS.escape(R)}"]`).join(","),g=c.districts.map(R=>`[data-graview-plot="kind:${CSS.escape(R)}"]`).join(",");return[".graview-ground[data-graview-altitude] .graview-building { opacity: 0.22; }",n?`.graview-ground[data-graview-altitude] .graview-building:is(${n}) { opacity: 1; }`:"",g?`.graview-ground[data-graview-altitude] .graview-plot:not(:is(${g})) .graview-plot-tile { opacity: 0.4; }`:""].join(`
3
3
  `)},[c]);return!c||c.lines.length===0?M?(0,s.jsx)("style",{children:M}):null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("style",{children:M}),(0,s.jsx)("svg",{className:"graview-record-links","data-graview-world":"","data-graview-record-links":c.lines.length,"aria-hidden":"true",width:b,height:h,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:j.lines},children:c.lines.map(n=>(0,s.jsxs)("g",{className:"graview-record-link","data-graview-link":n.link.edge,"data-graview-lands":n.link.lands,"data-graview-direction":n.link.direction,"data-graview-provisional":n.unsure!==void 0||void 0,children:[(0,s.jsx)("path",{className:"graview-record-link-line",d:n.d,...n.unsure!==void 0?{strokeDasharray:p,strokeOpacity:m}:{}}),n.link.lands==="record"?(0,s.jsx)("circle",{className:"graview-record-link-end",cx:n.end.x,cy:n.end.y,r:3}):null]},n.key))}),(0,s.jsx)("div",{"aria-hidden":"true","data-graview-world":"",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:j.tieLabels},children:c.lines.map(n=>{let g=c.labels.get(n.key);return g?(0,s.jsx)("span",{className:"graview-record-link-said","data-graview-link-said":n.link.edge,"data-graview-lands":n.link.lands,...n.unsure!==void 0?{title:n.unsure}:{},style:{position:"absolute",left:g.x,top:g.y,...n.unsure!==void 0?{pointerEvents:"auto"}:{}},children:n.said},n.key):null})})]})}export{we as RecordLinks};
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as V}from"./chunk.3H4NVUWV.js";import{o as le,p as $,s as ce,t as ue}from"./chunk.QRMWFEEH.js";import{m as B,n as ae,o as ie,p as Q,q as H}from"./chunk.OJGHDWI6.js";import{c as se}from"./chunk.FSAHO3LV.js";import{b as X,c as re,d as F,e as _,g as oe}from"./chunk.Y5Z4ZDTO.js";import{E as N,F as D,I as Z,N as ee,Q as S,Y as w,Z as te,_ as O,a as A,na as R,pa as ne,xa as E}from"./chunk.UWIYKGYK.js";import{aa as j,ac as J,fc as K}from"./chunk.X7W27IRI.js";import{b as h}from"./chunk.AJZBJBMO.js";var M=h(D(),1),G=h(S(),1),ge="A",W=E(A(()=>(__graviewPreload(import.meta.url,["./chunk.5A4AOFOA.js","./chunk.KSXB4LDF.js","./chunk.VZHV25JE.js","./chunk.QVUL2FSI.js","./chunk.U5EJSTST.js","./chunk.PW7YH6JV.js","./chunk.XSYBNUXF.js","./chunk.5EAQDBBE.js","./chunk.YT2CYCVT.js","./chunk.HJCQ6I3S.js","./chunk.DUUARGPE.js","./chunk.FUQVNXLB.js","./chunk.LAF6GTBN.js","./chunk.QU356VB2.js","./chunk.QVKKXMNK.js","./chunk.ZSW74NVJ.js","./chunk.ZE4CTZQ3.js","./chunk.3C4RJIJU.js","./chunk.DPP7ITTU.js","./chunk.GF7LA4QG.js","./chunk.AEHPDVLQ.js","./chunk.UT6642FC.js","./chunk.TI4OSTQV.js","./chunk.HPD5ZDZH.js","./chunk.52QAIGCD.js","./chunk.PPUAPAWR.js","./chunk.IHFNLKXV.js","./chunk.577PGFUT.js","./chunk.FBY5IUGU.js","./chunk.4K5QCJFH.js","./chunk.QRMWFEEH.js","./chunk.MVN6H65Q.js","./chunk.OJGHDWI6.js","./chunk.Z7ZCR4LN.js","./chunk.RIW7SQH4.js","./chunk.FSAHO3LV.js","./chunk.Y5Z4ZDTO.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.747GGBPR.js"))));var ve=W.part((e,t)=>(0,G.jsx)(e.InspectorPane,{...t}),{what:"This card's acts"});function he(e){let t=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&e()},n=globalThis;if(n.requestIdleCallback){let p=n.requestIdleCallback(t,{timeout:5e3});return()=>n.cancelIdleCallback?.(p)}let a=setTimeout(t,2500);return()=>clearTimeout(a)}var ye=150,we="[data-graview-pick], [data-graview-view], [data-graview-record], [data-graview-act], [data-graview-field], a[href]";function ke(e){if(e.closest("[data-graview-face='pages'], [data-graview-popover]"))return null;let t=e.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??e.closest("[data-graview-view]")?.getAttribute("data-graview-view");return t?{face:"scene",on:t,about:[t]}:null}function be(e){let{store:t,principal:n,providers:a}=w(),p=ue(),u=(0,M.useRef)({aimAt:e,store:t,principal:n,providers:a,prepareSections:p});u.current={aimAt:e,store:t,principal:n,providers:a,prepareSections:p},(0,M.useEffect)(()=>{if(typeof document>"u")return;let d=null,l=null,f=()=>{d&&clearTimeout(d.timer),d=null},y=s=>{let r=u.current,v=r.aimAt(s);if(!v)return;let b=JSON.stringify([v.face,v.on,v.about,v.field,v.place,v.act,r.store.log.length]);b!==l&&(l=b,r.prepareSections(v),W.load().then(L=>L.prepareActs(r.store,v,{principal:r.principal,providers:r.providers}),()=>{}))},g=s=>s.target instanceof Element?s.target.closest(we):null,c=s=>{if(s.pointerType==="touch")return;let r=g(s);r!==null&&r===d?.element||(f(),r!==null&&(d={element:r,timer:setTimeout(()=>{d=null,y(r)},ye)}))},m=s=>{if(d===null)return;let r=s.relatedTarget;r instanceof Node&&d.element.contains(r)||f()},k=s=>{if(s.pointerType==="mouse")return;let r=g(s);r&&y(r)},i=s=>{let r=g(s);r&&y(r)};return document.addEventListener("pointerover",c,{passive:!0}),document.addEventListener("pointerout",m,{passive:!0}),document.addEventListener("pointerdown",k,{capture:!0,passive:!0}),document.addEventListener("focusin",i),()=>{f(),document.removeEventListener("pointerover",c),document.removeEventListener("pointerout",m),document.removeEventListener("pointerdown",k,{capture:!0}),document.removeEventListener("focusin",i)}},[])}function Ge({placement:e="float",openActs:t,aimAt:n}={}){let{menuAt:a,setMenuAt:p,registerActsDoor:u}=w(),{selection:d}=R();be(n??ke),(0,M.useEffect)(()=>{if(W.current)return;let g=()=>{k(),W.prefetch()},c=he(g),m=["pointerdown","keydown"];for(let i of m)document.addEventListener(i,g,{capture:!0,passive:!0});function k(){c();for(let i of m)document.removeEventListener(i,g,{capture:!0})}return k},[]),(0,M.useEffect)(()=>{if(e==="menu")return u({key:ge,open:t??(g=>{let c=g.getBoundingClientRect(),m=g.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??g.closest("[data-graview-view]")?.getAttribute("data-graview-view")??void 0;p({x:Math.round(c.left+Math.min(16,c.width/2)),y:Math.round(Math.min(c.bottom,c.top+36)),...m?{on:m}:{}})})}),()=>u(null)},[e,u,p,t]);let l=a!==null||d.length>0,[f,y]=(0,M.useState)(l);return(0,M.useEffect)(()=>{l&&y(!0)},[l]),!f&&!l?null:(0,G.jsx)(M.Suspense,{fallback:null,children:(0,G.jsx)(ve,{placement:e,chosen:t===void 0})})}var q=h(D(),1),z=h(S(),1),Se=E(A(()=>(__graviewPreload(import.meta.url,["./chunk.5A4AOFOA.js","./chunk.KSXB4LDF.js","./chunk.VZHV25JE.js","./chunk.QVUL2FSI.js","./chunk.SECORXDP.js","./chunk.CHJZ7LST.js","./chunk.AINNENYD.js","./chunk.U5EJSTST.js","./chunk.PW7YH6JV.js","./chunk.SBBNIYVB.js","./chunk.IX6RNGAT.js","./chunk.3H4NVUWV.js","./chunk.XSYBNUXF.js","./chunk.GCVO6N26.js","./chunk.LRRVBM4F.js","./chunk.H243UV3Z.js","./chunk.PKKA6JWA.js","./chunk.5EAQDBBE.js","./chunk.YT2CYCVT.js","./chunk.HJCQ6I3S.js","./chunk.DUUARGPE.js","./chunk.FUQVNXLB.js","./chunk.LAF6GTBN.js","./chunk.QU356VB2.js","./chunk.QVKKXMNK.js","./chunk.ZSW74NVJ.js","./chunk.ZE4CTZQ3.js","./chunk.3C4RJIJU.js","./chunk.DPP7ITTU.js","./chunk.2OBIO5Y6.js","./chunk.GF7LA4QG.js","./chunk.AEHPDVLQ.js","./chunk.UT6642FC.js","./chunk.TI4OSTQV.js","./chunk.HPD5ZDZH.js","./chunk.WVUJXDXZ.js","./chunk.52QAIGCD.js","./chunk.PPUAPAWR.js","./chunk.IHFNLKXV.js","./chunk.577PGFUT.js","./chunk.FBY5IUGU.js","./chunk.4K5QCJFH.js","./chunk.GZHZLJBF.js","./chunk.QRMWFEEH.js","./chunk.MVN6H65Q.js","./chunk.OJGHDWI6.js","./chunk.Z7ZCR4LN.js","./chunk.RIW7SQH4.js","./chunk.FSAHO3LV.js","./chunk.Y5Z4ZDTO.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.JMQ6YLQX.js")))),Me=Se.part((e,t)=>{let n=e.DraftFrame;return(0,z.jsx)(n,{...t})},{what:"The view"});function _e(e){let{seatTalk:t}=w();return(0,q.useSyncExternalStore)(t.subscribe,()=>t.get().draft!==null,()=>!1)?(0,z.jsx)(q.Suspense,{fallback:null,children:(0,z.jsx)(Me,{...e})}):null}var I=h(D(),1),T=h(S(),1),de=E(A(()=>(__graviewPreload(import.meta.url,["./chunk.YT2CYCVT.js","./chunk.ZHXX22AT.js","./chunk.QVKKXMNK.js","./chunk.ZSW74NVJ.js","./chunk.ZE4CTZQ3.js","./chunk.6J7DR7XQ.js","./chunk.UT6642FC.js","./chunk.TI4OSTQV.js","./chunk.PPUAPAWR.js","./chunk.Z7ZCR4LN.js","./chunk.RIW7SQH4.js","./chunk.FSAHO3LV.js","./chunk.Y5Z4ZDTO.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.BL6VDLAW.js")))),Ae=de.part((e,t)=>{let n=e.QuickAskCard;return(0,T.jsx)(n,{...t})},{what:"The quick ask"});function Ue({face:e,on:t=!0}){let{ai:n,aiDesk:a,selection:p,view:u}=w(),d=ee()?.open??!1,l=t&&N(n)&&!d,f=oe(a),y=(0,I.useRef)(null),g=(0,I.useRef)({selection:p,place:u.within?.view});return g.current={selection:p,place:u.within?.view},(0,I.useEffect)(()=>{if(!l)return;let c=re(a);return c.drawn+=1,F(c),()=>{c.drawn=Math.max(0,c.drawn-1),c.drawn===0&&(c.open=null),F(c)}},[l,a]),(0,I.useEffect)(()=>{if(!l)return;let c=m=>{if(m.defaultPrevented||m.key.toLowerCase()!=="k"||!(m.metaKey||m.ctrlKey)||m.altKey||m.shiftKey)return;let k=y.current?.closest("[data-graview-embed]"),i=m.target,s=!(i instanceof Node)||i===document.body||i===document.documentElement;if(k&&!(s||i instanceof Node&&k.contains(i)))return;m.preventDefault(),de.prefetch();let r=document.activeElement,{selection:v,place:b}=g.current;_(a,{pointed:{...v[0]!==void 0?{on:v[0]}:{},about:v,...b?{place:b}:{}},returnTo:r instanceof HTMLElement&&r!==document.body?r:null})};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[l,a]),l?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("span",{ref:y,hidden:!0,"data-graview-quick-ask":e}),f?(0,T.jsx)(I.Suspense,{fallback:null,children:(0,T.jsx)(Ae,{face:e,opening:f,close:()=>_(a,null)},f.at)}):null]}):null}var C=h(D(),1),x=h(S(),1),U=E(A(()=>(__graviewPreload(import.meta.url,["./chunk.ZHXX22AT.js","./chunk.QVKKXMNK.js","./chunk.ZSW74NVJ.js","./chunk.ZE4CTZQ3.js","./chunk.6J7DR7XQ.js","./chunk.UT6642FC.js","./chunk.TI4OSTQV.js","./chunk.PPUAPAWR.js","./chunk.Z7ZCR4LN.js","./chunk.RIW7SQH4.js","./chunk.FSAHO3LV.js","./chunk.Y5Z4ZDTO.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.U2PYW5MS.js")))),Ee=U.part((e,t)=>{let n=e.InlineAiMenu;return(0,x.jsx)(n,{...t})},{what:"The AI's suggestions"}),Te=U.part((e,t)=>{let n=e.GhostTray;return(0,x.jsx)(n,{...t})},{quiet:!0});function Ie(){let{ai:e}=w(),t=N(e);return(0,C.useMemo)(()=>t?n=>({id:"inline-ai",heading:"AI",render:a=>(0,x.jsx)(C.Suspense,{fallback:null,children:(0,x.jsx)(Ee,{target:n,close:a})}),prepare:()=>U.prefetch()}):null,[t])}var xe=[];function Ze({children:e}){let t=Ie(),n=(0,C.useMemo)(()=>t?[t]:xe,[t]);return(0,x.jsx)(ce,{sections:n,children:e})}function et(e){let{ai:t,aiDesk:n}=w(),{ghost:a}=Z(n);return a===null||a.onCard||t.off?null:(0,x.jsx)(C.Suspense,{fallback:null,children:(0,x.jsx)(Te,{...e})})}function ot(e={}){return e.scope===void 0?V:X(V,e.scope)}var P=h(D(),1),o=h(S(),1);function dt({inside:e=!1,widthOf:t}={}){let{store:n,view:a,emphasis:p,setEmphasis:u}=w(),d=le(),{selection:l,set:f}=R(),{show:y}=ne(),g=O(),c=(0,P.useMemo)(()=>{let i=new Map;for(let s of n.graph.allEdges()){let r=i.get(s.kind)??{count:0,ends:new Set};r.count+=1;for(let v of[s.from,s.to]){let b=n.graph.getNode(v);b&&r.ends.add(`kind:${b.kind}`)}i.set(s.kind,r)}return[...i.entries()].sort(([s],[r])=>s.localeCompare(r)).map(([s,r])=>({kind:s,count:r.count,ends:[...r.ends]}))},[n,g]),m=Math.max(0,...c.map(i=>i.count));if((0,P.useEffect)(()=>()=>u(null),[u]),!a.overview&&!e||c.length===0)return null;let k=new Set;for(let i of l){if(i.startsWith("kind:")){k.add(i);continue}let s=n.graph.getNode(i);s&&k.add(`kind:${s.kind}`)}return(0,o.jsxs)("section",{"aria-label":"What the lines mean",role:e?"group":void 0,"data-testid":"relation-key",style:e?{display:"grid",gap:1}:{position:"absolute",left:16,top:14,zIndex:K("rail"),display:"grid",gap:1,padding:"8px 10px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",maxWidth:De,animation:"graview-settle 380ms 280ms ease backwards"},children:[e?null:(0,o.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-faint)",paddingBottom:2},children:c.length===1?"1 relation":`${c.length} relations`}),t?(0,o.jsx)(Le,{aloft:a.overview===!0}):null,c.map(({kind:i,count:s,ends:r})=>{let{connector:v,style:b}=$(d,i),L=Ce(n.schema,i),me=p!==null?p===i:k.size===0||r.some(fe=>k.has(fe));return(0,o.jsxs)("button",{type:"button",title:n.schema.edge(i)?.description===void 0?`${s} of these`:L.words,onMouseEnter:()=>u(i),onMouseLeave:()=>u(null),onFocus:()=>u(i),onBlur:()=>u(null),onClick:()=>{f(r),y(null)},style:{all:"unset",outline:"revert-layer",cursor:"pointer",display:"grid",gridTemplateColumns:"30px 1fr auto",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px",borderRadius:6,opacity:me?1:.4},children:[(0,o.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",style:{display:"block",opacity:v.visible?1:.35},children:a.overview&&t?(0,o.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",className:"graview-key-ribbon",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:t(s,m)}):(0,o.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",stroke:Q(b),strokeWidth:H(b,!0),strokeDasharray:B[b.pattern],strokeLinecap:"round"})}),(0,o.jsxs)("span",{style:{display:"grid",minWidth:0},"data-graview-relation-words":i,children:[(0,o.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink)"},children:L.words}),(0,o.jsx)("span",{style:{fontSize:"0.6875rem",color:"var(--graview-ink-faint)"},children:L.ends})]}),v.visible?null:(0,o.jsx)("span",{"data-graview-quiet":i,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontStyle:"italic"},children:"not drawn"}),(0,o.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontVariantNumeric:"tabular-nums"},children:s})]},i)})]})}var De="min(280px, calc(100% - 28px))";function Ce(e,t,n){let a=e.edge(t)?.from??[],p=new Map;for(let l of n!==void 0&&a.includes(n)?[n]:a.length>0?a:[""]){let f=se(e,l,t,"out");p.set(f,[...p.get(f)??[],l])}let u=l=>l==="*"?"anything":j(e,l),d=[...p].map(([l,f])=>{let y=f.flatMap(c=>e.tryDefinition(c)?.edges[t]?.to??[]),g=f[0]&&y.length>0?`${f.map(u).join(", ")} \u2192 ${(y.includes("*")?["*"]:[...new Set(y)]).map(u).join(", ")}`:"";return[l.charAt(0).toUpperCase()+l.slice(1),g]});return{words:d.map(([l])=>l).join(" \xB7 "),ends:d.flatMap(([,l])=>l?[l]:[]).join(" \xB7 ")}}function pt({edgeKind:e,kit:t,width:n=30}){let a=te(),p=(0,P.useMemo)(()=>J(t??a?.brand?.kit),[t,a?.brand?.kit]),{connector:u,style:d}=$(p,e);return(0,o.jsx)("svg",{width:n,height:"8","aria-hidden":"true","data-testid":"relation-mark","data-graview-relation":e,style:{display:"inline-block",verticalAlign:"middle",opacity:u.visible?1:.35},children:(0,o.jsx)("path",{d:`M 1 4 L ${n-1} 4`,fill:"none",stroke:Q(d),strokeWidth:H(d,!0),strokeDasharray:B[d.pattern],strokeLinecap:"round"})})}function Le({aloft:e}){let t={display:"grid",gridTemplateColumns:"30px 1fr",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px"},n={fontSize:"0.75rem",color:"var(--graview-ink-muted)"};return(0,o.jsxs)("div",{role:"group","aria-label":"The lines","data-testid":"line-manners",style:{display:"grid",gap:1,paddingBottom:6,marginBottom:4,borderBottom:"1px solid var(--graview-edge)"},children:[e?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{style:t,"data-graview-manner":"ribbon",children:[(0,o.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,o.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:6})}),(0,o.jsx)("span",{style:n,children:"A relation between two districts, as wide as the links along it \u2014 point at one for its words"})]}),(0,o.jsxs)("div",{style:t,"data-graview-manner":"record",children:[(0,o.jsxs)("svg",{width:"30",height:"10","aria-hidden":"true",children:[(0,o.jsx)("path",{d:"M 1 5 L 25 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeLinecap:"round"}),(0,o.jsx)("circle",{cx:26,cy:5,r:3,fill:"var(--graview-accent)"})]}),(0,o.jsx)("span",{style:n,children:"A chosen record's link to another record, labeled with the relation"})]}),(0,o.jsxs)("div",{style:t,"data-graview-manner":"district",children:[(0,o.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,o.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeDasharray:"5 4"})}),(0,o.jsx)("span",{style:n,children:"A chosen record's links into a district, with how many"})]})]}):null,(0,o.jsxs)("div",{style:t,"data-graview-manner":"unsure",children:[(0,o.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,o.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeOpacity:ie,strokeWidth:1.8,strokeDasharray:ae,strokeLinecap:"round"})}),(0,o.jsx)("span",{style:n,children:"Unsure: a link its maker was less than sure of, until a person keeps it \u2014 point at its words for what it was based on"})]})]})}var pe=h(D(),1),Y=h(S(),1),Pe=E(A(()=>(__graviewPreload(import.meta.url,["./chunk.3C4RJIJU.js","./chunk.DPP7ITTU.js","./chunk.GF7LA4QG.js","./chunk.AEHPDVLQ.js","./chunk.UT6642FC.js","./chunk.TI4OSTQV.js","./chunk.Z7ZCR4LN.js","./chunk.RIW7SQH4.js","./chunk.FSAHO3LV.js","./chunk.Y5Z4ZDTO.js","./chunk.UWIYKGYK.js","./chunk.X7W27IRI.js","./chunk.AJZBJBMO.js"]),import("./chunk.SD33BD7A.js")))),Ne=Pe.part(e=>(0,Y.jsx)(e.SuggestedTray,{}),{quiet:!0});function vt(){let{store:e}=w(),t=O();return(0,pe.useMemo)(()=>e.log.all().some(a=>a.suggests!==void 0&&!a.withheld),[e,t])?(0,Y.jsx)(Ne,{}):null}export{Ge as a,_e as b,Ue as c,dt as d,De as e,pt as f,Ie as g,Ze as h,et as i,ot as j,vt as k};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk.RTB4MMF6.js";import"./chunk.6J7DR7XQ.js";import"./chunk.Y5Z4ZDTO.js";import"./chunk.UWIYKGYK.js";import"./chunk.X7W27IRI.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
@@ -1,2 +1,2 @@
1
- import{E as q,F as Z,H as T,K as _,Ka as Q,L as H,Ma as X,N as C,T as Y,U as j,da as U,ra as B,rb as K,yb as v,za as J}from"./chunk.MNP4JI33.js";var dn=1e4,c=class{constructor(s){this.nodes=s}},en=Symbol.for("@graview/core:far-record"),ln=e=>typeof e=="object"&&e!==null&&e[en]===!0;function un(e){let s={...e.fields,id:`@${e.address}/${e.kind}:${e.id}`,kind:`@${e.address}/${e.kind}`,label:e.label};return Object.defineProperty(s,en,{value:!0}),s}function kn(e){let s=`the linked record in ${e.ref.address}`;return e.reason==="denied"?`${s} is not one this viewer may open`:`${s} has not been read`}var fn="",u=class extends Error{constructor(p,l){super(p);this.sentence=p;this.at=l}},P=class extends u{},R=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof c)&&typeof e.id=="string",nn=e=>{let s=new Set;return new c(e.filter(p=>!s.has(p.id)&&s.add(p.id)))},w=e=>e===null?"nothing":e instanceof c?"a set of records":Array.isArray(e)?"a list":R(e)?"a record":typeof e=="string"?"a word":typeof e;function rn(e,s){let p=s.budget??dn,l=(n,a)=>{if(p-=n,p<0)throw new P("this rule looks at too much of the graph to judge in one go",a)},h=s.today??T(),b=s.now??new Date().toISOString(),A=new Map,k=new Set,V=s.bindings,z=(n,a,r,o)=>{let d=`${n?.id}\0${a}`;if(A.has(d))return A.get(d);if(k.has(d))throw new u(`"${a}"${n?` of ${U(n.kind)}`:""} depends on itself`,o);k.add(d);let t=V;V=void 0;try{let i=$(r,n);return A.set(d,i),i}finally{V=t,k.delete(d)}},E=(n,a,r)=>{l(1,r);let o=s.kinds.get(n.kind),d=o?.computed?.get(a);if(d)return z(n,a,d,r);let t=o?.linked?.get(a);if(t){let y=B(Object.hasOwn(n,a)?n[a]:void 0,t);l(y.length,r);let m=s.linked??J(s.graph),g=y.flatMap(x=>{let D=m?m(x):{unread:!0};return"record"in D?[un(D.record)]:(s.onUnread?.({relation:a,ref:x,reason:"denied"in D?"denied":"unread"}),[])});return t.cardinality==="one"?g[0]??null:new c(g)}let i=Object.hasOwn(n,a);if(o?.fields.has(a)||i){let y=i?Q(n,a,h):void 0;return y===void 0?null:y}let f=o?.edges.get(a);if(f){let y=s.graph.out(n.id,a);return l(y.length,r),f==="one"?y[0]??null:new c(y)}if(a==="id")return n.id;if(ln(n))return null;throw new u(`${U(n.kind)} has no field or relation called "${a}"`,r)},N=(n,a,r)=>{if(n instanceof c)return n;if(n===null)return new c([]);if(R(n))return new c([n]);throw new u(`${r}(\u2026) needs a set of records, and was given ${w(n)}`,a)},G=(n,a,r)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new u(`${r}(\u2026) needs a word, and was given ${w(n)}`,a)},L=(n,a,r)=>{let o=G(n,a,r);if(o===null)return null;let d=Date.parse(o.length===10?`${o}T00:00:00Z`:o);if(Number.isNaN(d))throw new u(`${r}(\u2026) needs a date, and "${o}" is not one`,a);return d},M=(n,a)=>R(n)&&R(a)?n.id===a.id:R(n)&&typeof a=="string"?n.id===a:typeof n=="string"&&R(a)?n===a.id:Array.isArray(n)&&Array.isArray(a)?n.length===a.length&&n.every((r,o)=>M(r,a[o])):n===a,S=(n,a,r)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new u(`${r} must be true or false, and was ${w(n)}`,a)},O=(n,a)=>$(a,n);function $(n,a){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(r=>$(r,a));case"ident":{let r=V&&Object.hasOwn(V,n.name)?V[n.name]:void 0;if(r!==void 0)return r;if(a)return E(a,n.name,n.at);throw new u(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let r=$(n.object,a);if(r===null)return null;if(R(r))return E(r,n.name,n.at);throw new u(`".${n.name}" needs a record before it, and was given ${w(r)}`,n.at)}case"unary":{let r=$(n.operand,a);if(n.op==="!")return!S(r,n.at,"what follows not");if(r===null)return null;if(typeof r!="number")throw new u(`"-" needs a number, and was given ${w(r)}`,n.at);return-r}case"where":{let r=N($(n.set,a),n.at,"where");return l(r.nodes.length,n.at),new c(r.nodes.filter(o=>S(O(o,n.filter),n.at,"a where condition")))}case"binary":return an(n,a);case"call":return sn(n,a)}}function an(n,a){if(n.op==="&&")return S($(n.left,a),n.at,"each side of and")&&S($(n.right,a),n.at,"each side of and");if(n.op==="||")return S($(n.left,a),n.at,"each side of or")||S($(n.right,a),n.at,"each side of or");let r=$(n.left,a),o=$(n.right,a);if(n.op==="&"||n.op==="|"||n.op==="-"&&(r instanceof c||o instanceof c)){let d=N(r,n.at,n.op).nodes,t=N(o,n.at,n.op).nodes;l(d.length+t.length,n.at);let i=new Set(t.map(f=>f.id));return nn(n.op==="|"?[...d,...t]:d.filter(f=>i.has(f.id)===(n.op==="&")))}switch(n.op){case"==":return M(r,o);case"!=":return!M(r,o);case"in":{if(o===null)return!1;if(o instanceof c)return o.nodes.some(d=>M(r,d));if(Array.isArray(o))return o.some(d=>M(r,d));if(typeof o=="string"&&typeof r=="string")return o.includes(r);throw new u(`"in" needs a list or a set on its right, and was given ${w(o)}`,n.at)}case"<":case"<=":case">":case">=":{if(r===null||o===null)return!1;if(!(typeof r=="number"&&typeof o=="number"||typeof r=="string"&&typeof o=="string"))throw new u(`cannot compare ${w(r)} with ${w(o)}`,n.at);return n.op==="<"?r<o:n.op==="<="?r<=o:n.op===">"?r>o:r>=o}default:{if(r===null||o===null)return null;if(n.op==="+"&&(typeof r=="string"||typeof o=="string")){let d=`${G(r,n.at,"+")}${G(o,n.at,"+")}`;if(d.length>1e4)throw new u("that makes a word too long",n.at);return d}if(typeof r!="number"||typeof o!="number")throw new u(`"${n.op}" needs numbers, and was given ${w(r)} and ${w(o)}`,n.at);return(n.op==="/"||n.op==="%")&&o===0?null:n.op==="+"?r+o:n.op==="-"?r-o:n.op==="*"?r*o:n.op==="/"?r/o:r%o}}}function sn(n,a){let r=(t,i=t)=>{if(n.args.length<t||n.args.length>i)throw new u(`${n.fn}(\u2026) takes ${t===i?t:`${t} to ${i}`} argument${i===1?"":"s"}`,n.at)},o=t=>$(n.args[t],a),d=t=>{let i=o(t);if(typeof i!="string")throw new u(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return i};switch(n.fn){case"out":case"in":{r(1,2);let t=(y,m)=>n.fn==="out"?s.graph.out(y,m):s.graph.in(y,m);if(n.args.length===2){let y=N(o(0),n.at,n.fn).nodes,m=d(1);return nn(y.flatMap(g=>{let x=t(g.id,m);return l(x.length+1,n.at),x}))}let i=d(0);if(!a)throw new u(`${n.fn}('${i}') needs a record to start from`,n.at);let f=t(a.id,i);return l(f.length,n.at),new c(f)}case"all":{r(1,2);let t=s.graph.nodesOfKind(d(0),{archived:n.args.length===2?o(1):!1});return l(t.length,n.at),new c(t)}case"archived":return r(0,1),X(n.args.length===1?o(0):a);case"count":return r(1),N(o(0),n.at,"count").nodes.length;case"exists":return r(1),N(o(0),n.at,"exists").nodes.length>0;case"every":case"some":{r(2);let t=N(o(0),n.at,n.fn);l(t.nodes.length,n.at);let i=f=>S(O(f,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?t.nodes.every(i):t.nodes.some(i)}case"sum":case"min":case"max":{r(2);let t=N(o(0),n.at,n.fn);l(t.nodes.length,n.at);let i=n.args[1],f=i.t==="lit"&&typeof i.value=="string"?i.value:void 0,y=i.t==="ident"?`'${i.name}'`:f!==void 0?`'${f}'`:"\u2026",m=t.nodes.map(g=>i.t==="ident"?E(g,i.name,n.at):f!==void 0?E(g,f,n.at):O(g,i)).filter(g=>{if(g===null)return!1;if(typeof g!="number")throw new u(`${n.fn}(\u2026, ${y}) needs a number for each member, and found ${w(g)}`,n.at);return!0});return n.fn==="sum"?m.reduce((g,x)=>g+x,0):m.length===0?null:n.fn==="min"?Math.min(...m):Math.max(...m)}case"fact":{r(1);let t=d(0),i=s.kinds.get(fn)?.computed?.get(t);if(!i)throw new u(`no fact is called "${t}"`,n.at);return z(null,t,i,n.at)}case"first":return r(1),N(o(0),n.at,"first").nodes[0]??null;case"sort":{r(2,3);let t=N(o(0),n.at,"sort"),i=n.args.length===3?o(2):"asc";if(i!=="asc"&&i!=="desc")throw new u("sort(\u2026) goes 'asc' or 'desc'",n.at);let f=t.nodes.length;l(f+f*Math.ceil(Math.log2(f+1)),n.at);let y=t.nodes.map((g,x)=>({node:g,i:x,key:O(g,n.args[1])})),m=i==="desc"?-1:1;return y.sort((g,x)=>W(g.key,x.key,m,n.at)||g.i-x.i),new c(y.map(g=>g.node))}case"either":{if(n.args.length<1)throw new u("either(\u2026) takes at least one argument",n.at);for(let t=0;t<n.args.length;t++){let i=o(t);if(i!==null&&!(i instanceof c&&i.nodes.length===0))return i}return null}case"present":{r(1);let t=o(0);return t===null||t===""?!1:Array.isArray(t)?t.length>0:t instanceof c?t.nodes.length>0:!0}case"len":{r(1);let t=o(0);if(t===null)return 0;if(typeof t=="string"||Array.isArray(t))return t.length;if(t instanceof c)return t.nodes.length;throw new u(`len(\u2026) needs a word or a list, and was given ${w(t)}`,n.at)}case"contains":case"startsWith":{r(2);let t=o(0),i=o(1);if(t===null||i===null)return!1;if(n.fn==="contains"&&Array.isArray(t))return t.some(m=>M(m,i));let f=G(t,n.at,n.fn),y=G(i,n.at,n.fn);return n.fn==="contains"?f.toLowerCase().includes(y.toLowerCase()):f.startsWith(y)}case"lower":{r(1);let t=G(o(0),n.at,"lower");return t===null?null:t.toLowerCase()}case"today":return r(0),h;case"now":return r(0),b;case"date":{r(1);let t=L(o(0),n.at,"date");return t===null?null:new Date(t).toISOString().slice(0,10)}case"days":case"hours":{r(2);let t=L(o(0),n.at,n.fn),i=L(o(1),n.at,n.fn);if(t===null||i===null)return null;let f=(i-t)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(f):f}case"if":return r(3),S(o(0),n.at,"the condition in if(\u2026)")?o(1):o(2);default:throw new u(`"${n.fn}" is not a function the rule language knows`,n.at)}}function W(n,a,r,o){if(n===null||a===null)return n===a?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(a)){for(let t=0;t<Math.max(n.length,a.length);t++){let i=W(n[t]??null,a[t]??null,r,o);if(i!==0)return i}return 0}let d=t=>typeof t=="number"||typeof t=="string"||typeof t=="boolean"?typeof t:w(t);if(d(n)!==d(a)||typeof n=="object"||typeof a=="object")throw new u(`sort(\u2026) cannot put ${w(n)} and ${w(a)} in order`,o);return typeof n=="string"?r*(n<a?-1:n>a?1:0):r*(Number(n)-Number(a))}return $(e,s.subject)}var xn=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact","archived"];var Sn=(e,s,p,l)=>({severity:"error",code:e,path:s,message:p,...l?{fix:l}:{}}),Rn=(e,s,p,l)=>({severity:"warning",code:e,path:s,message:p,...l?{fix:l}:{}}),Vn=e=>e.some(s=>s.severity==="error");function Gn(e){return e.map(s=>`${s.severity==="error"?"\u2717":s.severity==="warning"?"!":"\xB7"} ${s.path||"(document)"}: ${s.message}${s.fix?` \u2014 ${s.fix}`:""}`).join(`
1
+ import{E as q,F as Z,H as T,K as _,Ka as Q,L as H,Ma as X,N as C,T as Y,U as j,da as U,ra as B,rb as K,yb as v,za as J}from"./chunk.X7W27IRI.js";var dn=1e4,c=class{constructor(s){this.nodes=s}},en=Symbol.for("@graview/core:far-record"),ln=e=>typeof e=="object"&&e!==null&&e[en]===!0;function un(e){let s={...e.fields,id:`@${e.address}/${e.kind}:${e.id}`,kind:`@${e.address}/${e.kind}`,label:e.label};return Object.defineProperty(s,en,{value:!0}),s}function kn(e){let s=`the linked record in ${e.ref.address}`;return e.reason==="denied"?`${s} is not one this viewer may open`:`${s} has not been read`}var fn="",u=class extends Error{constructor(p,l){super(p);this.sentence=p;this.at=l}},P=class extends u{},R=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof c)&&typeof e.id=="string",nn=e=>{let s=new Set;return new c(e.filter(p=>!s.has(p.id)&&s.add(p.id)))},w=e=>e===null?"nothing":e instanceof c?"a set of records":Array.isArray(e)?"a list":R(e)?"a record":typeof e=="string"?"a word":typeof e;function rn(e,s){let p=s.budget??dn,l=(n,a)=>{if(p-=n,p<0)throw new P("this rule looks at too much of the graph to judge in one go",a)},h=s.today??T(),b=s.now??new Date().toISOString(),A=new Map,k=new Set,V=s.bindings,z=(n,a,r,o)=>{let d=`${n?.id}\0${a}`;if(A.has(d))return A.get(d);if(k.has(d))throw new u(`"${a}"${n?` of ${U(n.kind)}`:""} depends on itself`,o);k.add(d);let t=V;V=void 0;try{let i=$(r,n);return A.set(d,i),i}finally{V=t,k.delete(d)}},E=(n,a,r)=>{l(1,r);let o=s.kinds.get(n.kind),d=o?.computed?.get(a);if(d)return z(n,a,d,r);let t=o?.linked?.get(a);if(t){let y=B(Object.hasOwn(n,a)?n[a]:void 0,t);l(y.length,r);let m=s.linked??J(s.graph),g=y.flatMap(x=>{let D=m?m(x):{unread:!0};return"record"in D?[un(D.record)]:(s.onUnread?.({relation:a,ref:x,reason:"denied"in D?"denied":"unread"}),[])});return t.cardinality==="one"?g[0]??null:new c(g)}let i=Object.hasOwn(n,a);if(o?.fields.has(a)||i){let y=i?Q(n,a,h):void 0;return y===void 0?null:y}let f=o?.edges.get(a);if(f){let y=s.graph.out(n.id,a);return l(y.length,r),f==="one"?y[0]??null:new c(y)}if(a==="id")return n.id;if(ln(n))return null;throw new u(`${U(n.kind)} has no field or relation called "${a}"`,r)},N=(n,a,r)=>{if(n instanceof c)return n;if(n===null)return new c([]);if(R(n))return new c([n]);throw new u(`${r}(\u2026) needs a set of records, and was given ${w(n)}`,a)},G=(n,a,r)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new u(`${r}(\u2026) needs a word, and was given ${w(n)}`,a)},L=(n,a,r)=>{let o=G(n,a,r);if(o===null)return null;let d=Date.parse(o.length===10?`${o}T00:00:00Z`:o);if(Number.isNaN(d))throw new u(`${r}(\u2026) needs a date, and "${o}" is not one`,a);return d},M=(n,a)=>R(n)&&R(a)?n.id===a.id:R(n)&&typeof a=="string"?n.id===a:typeof n=="string"&&R(a)?n===a.id:Array.isArray(n)&&Array.isArray(a)?n.length===a.length&&n.every((r,o)=>M(r,a[o])):n===a,S=(n,a,r)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new u(`${r} must be true or false, and was ${w(n)}`,a)},O=(n,a)=>$(a,n);function $(n,a){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(r=>$(r,a));case"ident":{let r=V&&Object.hasOwn(V,n.name)?V[n.name]:void 0;if(r!==void 0)return r;if(a)return E(a,n.name,n.at);throw new u(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let r=$(n.object,a);if(r===null)return null;if(R(r))return E(r,n.name,n.at);throw new u(`".${n.name}" needs a record before it, and was given ${w(r)}`,n.at)}case"unary":{let r=$(n.operand,a);if(n.op==="!")return!S(r,n.at,"what follows not");if(r===null)return null;if(typeof r!="number")throw new u(`"-" needs a number, and was given ${w(r)}`,n.at);return-r}case"where":{let r=N($(n.set,a),n.at,"where");return l(r.nodes.length,n.at),new c(r.nodes.filter(o=>S(O(o,n.filter),n.at,"a where condition")))}case"binary":return an(n,a);case"call":return sn(n,a)}}function an(n,a){if(n.op==="&&")return S($(n.left,a),n.at,"each side of and")&&S($(n.right,a),n.at,"each side of and");if(n.op==="||")return S($(n.left,a),n.at,"each side of or")||S($(n.right,a),n.at,"each side of or");let r=$(n.left,a),o=$(n.right,a);if(n.op==="&"||n.op==="|"||n.op==="-"&&(r instanceof c||o instanceof c)){let d=N(r,n.at,n.op).nodes,t=N(o,n.at,n.op).nodes;l(d.length+t.length,n.at);let i=new Set(t.map(f=>f.id));return nn(n.op==="|"?[...d,...t]:d.filter(f=>i.has(f.id)===(n.op==="&")))}switch(n.op){case"==":return M(r,o);case"!=":return!M(r,o);case"in":{if(o===null)return!1;if(o instanceof c)return o.nodes.some(d=>M(r,d));if(Array.isArray(o))return o.some(d=>M(r,d));if(typeof o=="string"&&typeof r=="string")return o.includes(r);throw new u(`"in" needs a list or a set on its right, and was given ${w(o)}`,n.at)}case"<":case"<=":case">":case">=":{if(r===null||o===null)return!1;if(!(typeof r=="number"&&typeof o=="number"||typeof r=="string"&&typeof o=="string"))throw new u(`cannot compare ${w(r)} with ${w(o)}`,n.at);return n.op==="<"?r<o:n.op==="<="?r<=o:n.op===">"?r>o:r>=o}default:{if(r===null||o===null)return null;if(n.op==="+"&&(typeof r=="string"||typeof o=="string")){let d=`${G(r,n.at,"+")}${G(o,n.at,"+")}`;if(d.length>1e4)throw new u("that makes a word too long",n.at);return d}if(typeof r!="number"||typeof o!="number")throw new u(`"${n.op}" needs numbers, and was given ${w(r)} and ${w(o)}`,n.at);return(n.op==="/"||n.op==="%")&&o===0?null:n.op==="+"?r+o:n.op==="-"?r-o:n.op==="*"?r*o:n.op==="/"?r/o:r%o}}}function sn(n,a){let r=(t,i=t)=>{if(n.args.length<t||n.args.length>i)throw new u(`${n.fn}(\u2026) takes ${t===i?t:`${t} to ${i}`} argument${i===1?"":"s"}`,n.at)},o=t=>$(n.args[t],a),d=t=>{let i=o(t);if(typeof i!="string")throw new u(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return i};switch(n.fn){case"out":case"in":{r(1,2);let t=(y,m)=>n.fn==="out"?s.graph.out(y,m):s.graph.in(y,m);if(n.args.length===2){let y=N(o(0),n.at,n.fn).nodes,m=d(1);return nn(y.flatMap(g=>{let x=t(g.id,m);return l(x.length+1,n.at),x}))}let i=d(0);if(!a)throw new u(`${n.fn}('${i}') needs a record to start from`,n.at);let f=t(a.id,i);return l(f.length,n.at),new c(f)}case"all":{r(1,2);let t=s.graph.nodesOfKind(d(0),{archived:n.args.length===2?o(1):!1});return l(t.length,n.at),new c(t)}case"archived":return r(0,1),X(n.args.length===1?o(0):a);case"count":return r(1),N(o(0),n.at,"count").nodes.length;case"exists":return r(1),N(o(0),n.at,"exists").nodes.length>0;case"every":case"some":{r(2);let t=N(o(0),n.at,n.fn);l(t.nodes.length,n.at);let i=f=>S(O(f,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?t.nodes.every(i):t.nodes.some(i)}case"sum":case"min":case"max":{r(2);let t=N(o(0),n.at,n.fn);l(t.nodes.length,n.at);let i=n.args[1],f=i.t==="lit"&&typeof i.value=="string"?i.value:void 0,y=i.t==="ident"?`'${i.name}'`:f!==void 0?`'${f}'`:"\u2026",m=t.nodes.map(g=>i.t==="ident"?E(g,i.name,n.at):f!==void 0?E(g,f,n.at):O(g,i)).filter(g=>{if(g===null)return!1;if(typeof g!="number")throw new u(`${n.fn}(\u2026, ${y}) needs a number for each member, and found ${w(g)}`,n.at);return!0});return n.fn==="sum"?m.reduce((g,x)=>g+x,0):m.length===0?null:n.fn==="min"?Math.min(...m):Math.max(...m)}case"fact":{r(1);let t=d(0),i=s.kinds.get(fn)?.computed?.get(t);if(!i)throw new u(`no fact is called "${t}"`,n.at);return z(null,t,i,n.at)}case"first":return r(1),N(o(0),n.at,"first").nodes[0]??null;case"sort":{r(2,3);let t=N(o(0),n.at,"sort"),i=n.args.length===3?o(2):"asc";if(i!=="asc"&&i!=="desc")throw new u("sort(\u2026) goes 'asc' or 'desc'",n.at);let f=t.nodes.length;l(f+f*Math.ceil(Math.log2(f+1)),n.at);let y=t.nodes.map((g,x)=>({node:g,i:x,key:O(g,n.args[1])})),m=i==="desc"?-1:1;return y.sort((g,x)=>W(g.key,x.key,m,n.at)||g.i-x.i),new c(y.map(g=>g.node))}case"either":{if(n.args.length<1)throw new u("either(\u2026) takes at least one argument",n.at);for(let t=0;t<n.args.length;t++){let i=o(t);if(i!==null&&!(i instanceof c&&i.nodes.length===0))return i}return null}case"present":{r(1);let t=o(0);return t===null||t===""?!1:Array.isArray(t)?t.length>0:t instanceof c?t.nodes.length>0:!0}case"len":{r(1);let t=o(0);if(t===null)return 0;if(typeof t=="string"||Array.isArray(t))return t.length;if(t instanceof c)return t.nodes.length;throw new u(`len(\u2026) needs a word or a list, and was given ${w(t)}`,n.at)}case"contains":case"startsWith":{r(2);let t=o(0),i=o(1);if(t===null||i===null)return!1;if(n.fn==="contains"&&Array.isArray(t))return t.some(m=>M(m,i));let f=G(t,n.at,n.fn),y=G(i,n.at,n.fn);return n.fn==="contains"?f.toLowerCase().includes(y.toLowerCase()):f.startsWith(y)}case"lower":{r(1);let t=G(o(0),n.at,"lower");return t===null?null:t.toLowerCase()}case"today":return r(0),h;case"now":return r(0),b;case"date":{r(1);let t=L(o(0),n.at,"date");return t===null?null:new Date(t).toISOString().slice(0,10)}case"days":case"hours":{r(2);let t=L(o(0),n.at,n.fn),i=L(o(1),n.at,n.fn);if(t===null||i===null)return null;let f=(i-t)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(f):f}case"if":return r(3),S(o(0),n.at,"the condition in if(\u2026)")?o(1):o(2);default:throw new u(`"${n.fn}" is not a function the rule language knows`,n.at)}}function W(n,a,r,o){if(n===null||a===null)return n===a?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(a)){for(let t=0;t<Math.max(n.length,a.length);t++){let i=W(n[t]??null,a[t]??null,r,o);if(i!==0)return i}return 0}let d=t=>typeof t=="number"||typeof t=="string"||typeof t=="boolean"?typeof t:w(t);if(d(n)!==d(a)||typeof n=="object"||typeof a=="object")throw new u(`sort(\u2026) cannot put ${w(n)} and ${w(a)} in order`,o);return typeof n=="string"?r*(n<a?-1:n>a?1:0):r*(Number(n)-Number(a))}return $(e,s.subject)}var xn=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact","archived"];var Sn=(e,s,p,l)=>({severity:"error",code:e,path:s,message:p,...l?{fix:l}:{}}),Rn=(e,s,p,l)=>({severity:"warning",code:e,path:s,message:p,...l?{fix:l}:{}}),Vn=e=>e.some(s=>s.severity==="error");function Gn(e){return e.map(s=>`${s.severity==="error"?"\u2717":s.severity==="warning"?"!":"\xB7"} ${s.path||"(document)"}: ${s.message}${s.fix?` \u2014 ${s.fix}`:""}`).join(`
2
2
  `)}var Dn=["money","percent","date","relative","upper","lower","count","words","and","plural","excerpt"],cn={getNode:()=>{},allNodes:()=>[],allEdges:()=>[],nodesOfKind:()=>[],edgesOfKind:()=>[],out:()=>[],in:()=>[],neighbors:()=>[],has:()=>!1};function _n(e,s,p,l=[],h,b=F){return I(e,s,p,l,h,b)}var pn=(e,s)=>e.capital?Y(s):s;function yn(e){return e?s=>{let p=e.tryDefinition(s.kind)?.label;return p?p(s):F(s)}:F}var tn=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],on=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function gn(e,s){return!Number.isInteger(e)||e<0||e>99?C(e,s):e<20?tn[e]:e%10===0?on[e/10]:`${on[Math.floor(e/10)]}-${tn[e%10]}`}function hn(e){return/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:`${e}s`}var F=e=>String(e.name??e.title??e.label??e.id);function I(e,s,p,l=[],h,b=F){if(s==="plural"){let A=e instanceof c?e.nodes.length:Array.isArray(e)?e.length:typeof e=="number"?e:null;return A===null||l[0]===void 0?"\u2014":A===1?l[0]:l[1]??hn(l[0])}if(e===null)return"\u2014";if(e instanceof c)return s==="count"?String(e.nodes.length):s==="and"?j(e.nodes.map(b)):e.nodes.map(b).join(", ");if(Array.isArray(e)){if(s==="count")return String(e.length);let A=e.map(k=>I(k,void 0,p,[],h,b));return s==="and"?j(A):A.join(", ")}if(typeof e=="object")return b(e);switch(s){case"words":return typeof e=="number"?gn(e,h?.locale):String(e);case"money":return typeof e=="number"?K(e,h):String(e);case"percent":return typeof e=="number"?C(e,h?.locale,{style:"percent",maximumFractionDigits:0}):String(e);case"upper":return String(e).toUpperCase();case"lower":return String(e).toLowerCase();case"excerpt":return v(String(e),Number(l[0])||void 0);case"date":return _(String(e).slice(0,10),h?.locale);case"relative":{let A=Date.parse(String(e).length===10?`${e}T00:00:00Z`:String(e));if(Number.isNaN(A))return String(e);let k=Math.round((A-Date.parse(`${p}T00:00:00Z`))/864e5);return k===0?"today":k===1?"tomorrow":k===-1?"yesterday":k>0?`in ${k} days`:`${-k} days ago`}default:return typeof e=="string"&&q.test(e)?_(e,h?.locale):typeof e=="string"&&Z.test(e)?H(e,h?.locale):String(e)}}function Cn(e,s){let p=s.today??T(),l=s.name??yn(s.graph?.schema);return e.map(h=>{if(h.text!==void 0)return h.text;try{let b=rn(h.expr,{graph:s.graph??cn,subject:s.node,kinds:s.kinds,today:p,budget:s.budget??500,...s.bindings?{bindings:s.bindings}:{}});return pn(h,I(b,h.format,p,h.formatArgs,s.money,l))}catch(b){if(b instanceof u)return"\u2014";throw b}}).join("")}export{c as a,kn as b,fn as c,u as d,P as e,rn as f,xn as g,Sn as h,Rn as i,Vn as j,Gn as k,Dn as l,cn as m,_n as n,pn as o,yn as p,Cn as q};