graview 0.1.68 → 0.1.69

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 (184) hide show
  1. package/dist/preview/{chunk.ODYJEDIW.js → chunk.26RYER7Y.js} +1 -1
  2. package/dist/preview/{chunk.TRNJKHIA.js → chunk.2AL26ZPJ.js} +1 -1
  3. package/dist/preview/chunk.2WFOKJB4.js +1 -0
  4. package/dist/preview/chunk.3D37E2G5.js +1 -0
  5. package/dist/preview/chunk.3PT3BU6K.js +1 -0
  6. package/dist/preview/{chunk.7ZTGB4O7.js → chunk.3TKIZGC7.js} +1 -1
  7. package/dist/preview/{chunk.AQ2PI6MR.js → chunk.3VNOTHA5.js} +1 -1
  8. package/dist/preview/{chunk.QWLK3GKG.js → chunk.3XTIYX6M.js} +1 -1
  9. package/dist/preview/{chunk.GF3ZCX46.js → chunk.447RWLS7.js} +2 -2
  10. package/dist/preview/{chunk.E423JCOS.js → chunk.47VEV4BX.js} +1 -1
  11. package/dist/preview/{chunk.NRCWMYLH.js → chunk.4FJ4OPSJ.js} +1 -1
  12. package/dist/preview/{chunk.XFH6GHBQ.js → chunk.4O7WYLCK.js} +1 -1
  13. package/dist/preview/{chunk.MSUZAJ2K.js → chunk.4R7H3GIL.js} +2 -2
  14. package/dist/preview/{chunk.EB7PZJEO.js → chunk.4RPKCW4J.js} +1 -1
  15. package/dist/preview/{chunk.YM6SWEUI.js → chunk.523EFGHU.js} +1 -1
  16. package/dist/preview/chunk.5DU6FA5R.js +1 -0
  17. package/dist/preview/{chunk.LFFJB6D3.js → chunk.5MOXQUZH.js} +1 -1
  18. package/dist/preview/chunk.5TWRTGP6.js +1 -0
  19. package/dist/preview/{chunk.AWV57UBJ.js → chunk.66TRDXYR.js} +1 -1
  20. package/dist/preview/{chunk.AYZL3LCR.js → chunk.6BNSDPZE.js} +3 -3
  21. package/dist/preview/chunk.6BR2SUAE.js +1 -0
  22. package/dist/preview/{chunk.32JE2WS7.js → chunk.6TDVNWFU.js} +1 -1
  23. package/dist/preview/{chunk.UAMPR4MD.js → chunk.6XBQDXT6.js} +1 -1
  24. package/dist/preview/{chunk.TVWK3SGD.js → chunk.6ZFYFT5A.js} +1 -1
  25. package/dist/preview/{chunk.N5Z34V7U.js → chunk.7L3I776Z.js} +1 -1
  26. package/dist/preview/chunk.7OLKVOS6.js +1 -0
  27. package/dist/preview/{chunk.MKL4THIV.js → chunk.7T2P42VW.js} +1 -1
  28. package/dist/preview/{chunk.QM54TGU6.js → chunk.AG7WJYM5.js} +2 -2
  29. package/dist/preview/{chunk.ECNGVD25.js → chunk.AHYMIVBX.js} +1 -1
  30. package/dist/preview/chunk.AMAOZVEO.js +1 -0
  31. package/dist/preview/chunk.AMV2ILR6.js +1 -0
  32. package/dist/preview/{chunk.RQG672MJ.js → chunk.AUNQNTKY.js} +1 -1
  33. package/dist/preview/{chunk.HXTKBISQ.js → chunk.AZRICZKT.js} +1 -1
  34. package/dist/preview/{chunk.L7XKYGV7.js → chunk.B422DSYN.js} +1 -1
  35. package/dist/preview/{chunk.XDZDNZ7B.js → chunk.B5EFNTDA.js} +1 -1
  36. package/dist/preview/{chunk.F5GNNVSQ.js → chunk.BO32A3W5.js} +1 -1
  37. package/dist/preview/{chunk.ZLEBOR5T.js → chunk.BQORHDAH.js} +1 -1
  38. package/dist/preview/{chunk.4GVKKBQL.js → chunk.BSQI3KM2.js} +1 -1
  39. package/dist/preview/{chunk.BPNW5KCP.js → chunk.C6CT6F4C.js} +1 -1
  40. package/dist/preview/{chunk.JV432T4Q.js → chunk.CA2SYEYE.js} +1 -1
  41. package/dist/preview/{chunk.64LCHHZB.js → chunk.CCCONK73.js} +1 -1
  42. package/dist/preview/{chunk.GONZB3J3.js → chunk.CDSHUWSK.js} +1 -1
  43. package/dist/preview/{chunk.NFTPJAMJ.js → chunk.CKSRW3LA.js} +1 -1
  44. package/dist/preview/{chunk.LOKGUALC.js → chunk.CLIC2QBA.js} +1 -1
  45. package/dist/preview/{chunk.PLIV3IQK.js → chunk.CLZYNFFH.js} +1 -1
  46. package/dist/preview/{chunk.GKTQ5CZA.js → chunk.CSVDBDRZ.js} +2 -2
  47. package/dist/preview/{chunk.GJTEV6CK.js → chunk.CUEIGKFG.js} +1 -1
  48. package/dist/preview/{chunk.IPGLITWA.js → chunk.CYEPHT7V.js} +1 -1
  49. package/dist/preview/{chunk.BQAFFEOA.js → chunk.D3SWJ7OS.js} +1 -1
  50. package/dist/preview/{chunk.ACNOP2IU.js → chunk.D5JZQZ74.js} +1 -1
  51. package/dist/preview/{chunk.6AANHELP.js → chunk.DHPXRDT5.js} +5 -5
  52. package/dist/preview/{chunk.R3GE37OI.js → chunk.DKUEZPGR.js} +1 -1
  53. package/dist/preview/{chunk.2TUEBU7X.js → chunk.DO3FQM6R.js} +1 -1
  54. package/dist/preview/{chunk.G2BDEWJC.js → chunk.DRAPVGQZ.js} +1 -1
  55. package/dist/preview/{chunk.6WB2TYK7.js → chunk.DU76ASS4.js} +1 -1
  56. package/dist/preview/{chunk.AENP662H.js → chunk.EEUCRZA3.js} +1 -1
  57. package/dist/preview/{chunk.WC5WE34A.js → chunk.EK3JXEZL.js} +1 -1
  58. package/dist/preview/{chunk.2BMZPALF.js → chunk.EL7XXGQY.js} +1 -1
  59. package/dist/preview/{chunk.2KCDLCB2.js → chunk.EP7YT7LT.js} +1 -1
  60. package/dist/preview/{chunk.SS6KL5NT.js → chunk.EQZPEOIW.js} +1 -1
  61. package/dist/preview/{chunk.VW632VNJ.js → chunk.F4CDJBDS.js} +1 -1
  62. package/dist/preview/{chunk.O5FTWXA2.js → chunk.FE3SINPK.js} +1 -1
  63. package/dist/preview/{chunk.JULD4XFB.js → chunk.FIY4RUK5.js} +1 -1
  64. package/dist/preview/{chunk.3VEZ5MOC.js → chunk.FWXW4T4I.js} +1 -1
  65. package/dist/preview/{chunk.FSW535EA.js → chunk.G43YUGNW.js} +1 -1
  66. package/dist/preview/{chunk.QYPU444Y.js → chunk.GF5CZPZ7.js} +1 -1
  67. package/dist/preview/{chunk.4TT3ZHSJ.js → chunk.GPBHUIZQ.js} +1 -1
  68. package/dist/preview/{chunk.YL2RBZFE.js → chunk.GTF6EMVE.js} +1 -1
  69. package/dist/preview/chunk.GVFGS2HY.js +1 -0
  70. package/dist/preview/{chunk.EGSOHTZZ.js → chunk.HCX6KPRF.js} +1 -1
  71. package/dist/preview/{chunk.4YAO3A5Q.js → chunk.HGH27XZG.js} +3 -3
  72. package/dist/preview/{chunk.7WPVLEX2.js → chunk.HMJXB6KC.js} +2 -2
  73. package/dist/preview/chunk.HTEQCRVP.js +1 -0
  74. package/dist/preview/{chunk.VTDOWXCP.js → chunk.HU3KEWFO.js} +1 -1
  75. package/dist/preview/{chunk.DZ6UDZOB.js → chunk.I4H2GS4O.js} +2 -2
  76. package/dist/preview/{chunk.UD7VLXPM.js → chunk.I7KN732Z.js} +1 -1
  77. package/dist/preview/{chunk.YBQ5GVAX.js → chunk.I7OFRF6N.js} +2 -2
  78. package/dist/preview/{chunk.ZKXIZBCN.js → chunk.IAVIYJTL.js} +1 -1
  79. package/dist/preview/{chunk.CNN32262.js → chunk.IO5VFTXC.js} +1 -1
  80. package/dist/preview/{chunk.PIMAG4WT.js → chunk.IPKESOIU.js} +2 -2
  81. package/dist/preview/{chunk.42KHFGN6.js → chunk.IRNEWNUB.js} +1 -1
  82. package/dist/preview/{chunk.XRE7SHLD.js → chunk.ISZFRLNJ.js} +1 -1
  83. package/dist/preview/{chunk.GRTBEA7O.js → chunk.IY3DV52G.js} +1 -1
  84. package/dist/preview/{chunk.VES4XMZX.js → chunk.IYHY4VEC.js} +1 -1
  85. package/dist/preview/{chunk.HWFJQ42Y.js → chunk.J2N7EKMX.js} +1 -1
  86. package/dist/preview/{chunk.IT5DVKXY.js → chunk.J7O23NKZ.js} +2 -2
  87. package/dist/preview/chunk.JDUA5PH2.js +1 -0
  88. package/dist/preview/{chunk.DCLF4WWZ.js → chunk.JHAMSDAI.js} +1 -1
  89. package/dist/preview/{chunk.IKKKHHRN.js → chunk.JN3WZGJY.js} +1 -1
  90. package/dist/preview/{chunk.H4VNIAHN.js → chunk.JPAE6K4E.js} +1 -1
  91. package/dist/preview/{chunk.DGDW54KE.js → chunk.JQEXH23N.js} +1 -1
  92. package/dist/preview/{chunk.MPWLDQOG.js → chunk.KEGL6NBD.js} +1 -1
  93. package/dist/preview/{chunk.EGVM24ND.js → chunk.KHKCTVHD.js} +1 -1
  94. package/dist/preview/{chunk.VV5JAM5W.js → chunk.KKFKSJUN.js} +1 -1
  95. package/dist/preview/{chunk.Q6H5HESF.js → chunk.KLEKC4ZX.js} +1 -1
  96. package/dist/preview/chunk.KVQYOFDV.js +1 -0
  97. package/dist/preview/{chunk.ZLNUZ6LR.js → chunk.KW7PHJYX.js} +1 -1
  98. package/dist/preview/{chunk.PPCDPYYU.js → chunk.LAVLPYSC.js} +1 -1
  99. package/dist/preview/{chunk.FZELUSK5.js → chunk.LGNGFG5V.js} +1 -1
  100. package/dist/preview/{chunk.SADR3MQI.js → chunk.LKM2R5UF.js} +1 -1
  101. package/dist/preview/{chunk.42C3FIKK.js → chunk.LMZ2WMGH.js} +1 -1
  102. package/dist/preview/{chunk.KAM73WVF.js → chunk.MATUPDZ3.js} +1 -1
  103. package/dist/preview/{chunk.Z2X7BFCB.js → chunk.MD3N26BC.js} +2 -2
  104. package/dist/preview/{chunk.TFJA4QV4.js → chunk.MH3AQO2R.js} +1 -1
  105. package/dist/preview/chunk.MHHNO3O2.js +1 -0
  106. package/dist/preview/{chunk.DMZRFXH7.js → chunk.MKN7ADJB.js} +1 -1
  107. package/dist/preview/{chunk.ND3DEDWB.js → chunk.ML5EHDZG.js} +1 -1
  108. package/dist/preview/{chunk.Q4VFLLUT.js → chunk.MUWI54IP.js} +1 -1
  109. package/dist/preview/{chunk.PZQ5P6WK.js → chunk.MV27WMNW.js} +1 -1
  110. package/dist/preview/{chunk.6DMCEBSO.js → chunk.N7A3T5QU.js} +1 -1
  111. package/dist/preview/{chunk.H3IGXHZR.js → chunk.NLZHNPDU.js} +2 -2
  112. package/dist/preview/{chunk.4DXPPM6T.js → chunk.NRECR3NQ.js} +1 -1
  113. package/dist/preview/{chunk.LZ6MSQ5O.js → chunk.NSAGOOJW.js} +1 -1
  114. package/dist/preview/{chunk.LMTG5NPG.js → chunk.O7NYSO6F.js} +1 -1
  115. package/dist/preview/{chunk.2ME4DVBI.js → chunk.OD5QZHRC.js} +1 -1
  116. package/dist/preview/{chunk.QUETLFBJ.js → chunk.P26ATAAI.js} +1 -1
  117. package/dist/preview/{chunk.3JMQKANL.js → chunk.PJL3I2IW.js} +1 -1
  118. package/dist/preview/{chunk.6IR5LBJU.js → chunk.POKGLN4T.js} +1 -1
  119. package/dist/preview/{chunk.IXMIU4D4.js → chunk.PZ3KM3TY.js} +1 -1
  120. package/dist/preview/{chunk.MIOLBZBS.js → chunk.QEBD7SC4.js} +1 -1
  121. package/dist/preview/{chunk.DPHH5ZVL.js → chunk.QK7EUIPL.js} +1 -1
  122. package/dist/preview/{chunk.7TDML5YU.js → chunk.QNC2OKLF.js} +1 -1
  123. package/dist/preview/{chunk.QOQ26NXM.js → chunk.QRNKGPAD.js} +1 -1
  124. package/dist/preview/{chunk.QZP3ARLH.js → chunk.QVCKTDG3.js} +1 -1
  125. package/dist/preview/{chunk.2U6HB4XU.js → chunk.R7POSVUK.js} +1 -1
  126. package/dist/preview/{chunk.UFURYU4R.js → chunk.RNAL35ID.js} +1 -1
  127. package/dist/preview/{chunk.KUCBNMIY.js → chunk.ROYCJXPE.js} +1 -1
  128. package/dist/preview/chunk.RZ73YG5K.js +1 -0
  129. package/dist/preview/{chunk.JLDJZET2.js → chunk.S2NQRD6W.js} +1 -1
  130. package/dist/preview/{chunk.O32F6LGK.js → chunk.SAWASNDO.js} +1 -1
  131. package/dist/preview/{chunk.CFE3MHWZ.js → chunk.SCVKHGO3.js} +1 -1
  132. package/dist/preview/chunk.SM37MNS2.js +1 -0
  133. package/dist/preview/{chunk.DLSS56EU.js → chunk.T2BZBR7S.js} +1 -1
  134. package/dist/preview/{chunk.OQ4ZO3YY.js → chunk.T3PELB6I.js} +1 -1
  135. package/dist/preview/{chunk.TR4YFVZN.js → chunk.TAJBXG5U.js} +1 -1
  136. package/dist/preview/{chunk.3DEWQDP7.js → chunk.TLPCYKLW.js} +1 -1
  137. package/dist/preview/{chunk.7K2V5FUB.js → chunk.TQQDUJLX.js} +1 -1
  138. package/dist/preview/{chunk.CGBOPPNL.js → chunk.TQRC5VAM.js} +1 -1
  139. package/dist/preview/chunk.U563J5IM.js +1 -0
  140. package/dist/preview/{chunk.GRBWXTST.js → chunk.UAEOCWSG.js} +1 -1
  141. package/dist/preview/{chunk.Y7OGJOPA.js → chunk.UHJSZ2XZ.js} +1 -1
  142. package/dist/preview/{chunk.JGRSUTPJ.js → chunk.UPOYRCKI.js} +1 -1
  143. package/dist/preview/{chunk.I63462I3.js → chunk.VBBH5R5T.js} +1 -1
  144. package/dist/preview/chunk.VBYJBW32.js +1 -0
  145. package/dist/preview/{chunk.HH4D3JEI.js → chunk.VEQIH7HR.js} +1 -1
  146. package/dist/preview/chunk.VHLL6VC6.js +1 -0
  147. package/dist/preview/{chunk.VLXLBGMY.js → chunk.VQDL4EEP.js} +1 -1
  148. package/dist/preview/{chunk.UODTUBQ7.js → chunk.VQOYFBEV.js} +1 -1
  149. package/dist/preview/{chunk.H3W5C3XQ.js → chunk.VR553M6J.js} +1 -1
  150. package/dist/preview/{chunk.ENLIIZF2.js → chunk.VXPEXUQF.js} +1 -1
  151. package/dist/preview/{chunk.Z67LBSQO.js → chunk.W3WXI5B3.js} +1 -1
  152. package/dist/preview/{chunk.5JKUT2OM.js → chunk.W43XWQRC.js} +1 -1
  153. package/dist/preview/{chunk.BHJRT57H.js → chunk.WFJCC6G3.js} +1 -1
  154. package/dist/preview/{chunk.I34BWUB4.js → chunk.WJHLE73Y.js} +1 -1
  155. package/dist/preview/{chunk.MK5RPEB2.js → chunk.WQ7K5O2I.js} +1 -1
  156. package/dist/preview/{chunk.EP5JS7ZH.js → chunk.WV6SP6IJ.js} +1 -1
  157. package/dist/preview/{chunk.XXCHO2A5.js → chunk.YJ4PFOPC.js} +1 -1
  158. package/dist/preview/{chunk.JCETQQ7J.js → chunk.YZKHTBTC.js} +1 -1
  159. package/dist/preview/{chunk.CE3NKAF7.js → chunk.ZE5RSKXF.js} +1 -1
  160. package/dist/preview/{chunk.WV45KLXC.js → chunk.ZQYHNFRZ.js} +1 -1
  161. package/dist/preview/{chunk.TOUSIUJF.js → chunk.ZT3ZG52B.js} +1 -1
  162. package/dist/preview/{chunk.O2VXTYUJ.js → chunk.ZU3RPI34.js} +1 -1
  163. package/dist/preview/index.html +55 -55
  164. package/dist/preview/page.js +2 -2
  165. package/package.json +6 -6
  166. package/dist/preview/chunk.3WPCS6KP.js +0 -1
  167. package/dist/preview/chunk.5L4ADKTW.js +0 -1
  168. package/dist/preview/chunk.6ZENHSTQ.js +0 -1
  169. package/dist/preview/chunk.7OL6H4LF.js +0 -1
  170. package/dist/preview/chunk.ARS4HJD2.js +0 -1
  171. package/dist/preview/chunk.C2QKA6XY.js +0 -1
  172. package/dist/preview/chunk.FHQ25SWY.js +0 -1
  173. package/dist/preview/chunk.MBTEOF4R.js +0 -1
  174. package/dist/preview/chunk.N64RVSH3.js +0 -1
  175. package/dist/preview/chunk.PI4RFOBU.js +0 -1
  176. package/dist/preview/chunk.Q42R2KW4.js +0 -1
  177. package/dist/preview/chunk.R66ZVMWB.js +0 -1
  178. package/dist/preview/chunk.RYA7A4NA.js +0 -1
  179. package/dist/preview/chunk.SUG6LIOX.js +0 -1
  180. package/dist/preview/chunk.U7PAFLUM.js +0 -1
  181. package/dist/preview/chunk.WN7SAAH6.js +0 -1
  182. package/dist/preview/chunk.ZMADWPJO.js +0 -1
  183. package/dist/preview/chunk.ZO6VMEPP.js +0 -1
  184. package/dist/preview/chunk.ZUG7U7AT.js +0 -1
@@ -1 +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{L as $,Mb as L,P as j,Pb as N,S as H,nd as E}from"./chunk.6AANHELP.js";var W=()=>(__graviewPreload(import.meta.url,["./chunk.CGBOPPNL.js","./chunk.LMTG5NPG.js","./chunk.M5FP4Y4Q.js","./chunk.CNN32262.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.XRE7SHLD.js"));function D(e,l,d){let i=new Map;for(let y of d?.kinds??[])for(let a of e.nodesOfKind(y))l.has(a.id)||i.set(a.id,a);let s=new Set([...l,...i.keys()]),p=new Set(d?.edges??[]),k=new Set;if(p.size>0&&l.size>0){for(let y of l)for(let a of e.outEdges(y))p.has(a.kind)&&i.has(a.to)&&k.add(a.to);for(let y of i.keys())e.outEdges(y).some(a=>p.has(a.kind)&&l.has(a.to))&&k.add(y)}let R=new Map([...[...i].filter(([y])=>k.has(y)),...[...i].filter(([y])=>!k.has(y))]),h=[];if(p.size>0)for(let y of s)for(let a of e.outEdges(y))p.has(a.kind)&&s.has(a.to)&&h.push({kind:a.kind,from:a.from,to:a.to});return{nodes:[...R.values()],edges:h}}function O(e,l,d){let i=[];return()=>{let s=d();for(;i.length>0&&i[0]<=s-l;)i.shift();return i.length>=e?!1:(i.push(s),!0)}}function I(e={},l=Date.now){return{act:O(e.acts??30,e.actWindowMs??6e4,l),message:O(e.messages??120,e.messageWindowMs??1e3,l)}}var v=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function J(e,l){let d=l.flatMap(s=>v(s)&&typeof s.kind=="string"?[s.kind]:[]),i=E(e,d);return Object.keys(i).length>0?{choices:i}:{}}function _(e,l){let d=structuredClone(l),i=e.schema.tryDefinition(d.kind),s=d.label;return{...d,label:i?.label?i.label(d):typeof s=="string"&&s.length>0?s:d.id}}function Q(e){let l=e.limiter??I(e.limits,e.now),d=e.limits?.maxHeight??4e3,i=`view:${e.view}`,s={applied:0,refused:0,dropped:0},p=()=>e.store.seenBy(e.principal),k=n=>_(e.store,n),R=()=>{if(e.props)return e.props();let n=p(),u=n.graph,r=e.input?.()??{},c=r.node?u.getNode(r.node.id):void 0,o=r.nodes?.flatMap(t=>{let m=u.getNode(t.id);return m?[m]:[]}),g=new Set([...c?[c.id]:[],...(o??[]).map(t=>t.id)]),f=[];for(let t of g)for(let m of u.outEdges(t))g.has(m.to)&&f.push({kind:m.kind,from:m.from,to:m.to});let G=D(u,g,e.reads),A=new Set(f.map(t=>`${t.kind} ${t.from} ${t.to}`));for(let t of G.edges)A.has(`${t.kind} ${t.from} ${t.to}`)||f.push(t);let w=G.nodes.length>0?[...o??[],...G.nodes]:o,S=t=>t?.filter(m=>u.has(m)),F=n.permittedMutations(e.principal).map(t=>({name:t.name,title:t.title??t.name,...t.description!==void 0?{description:t.description}:{},...t.subject?{subject:{kinds:t.subject.kinds,arg:t.subject.arg}}:{}}));return{view:e.view,...c?{node:k(c)}:{},...w?{nodes:w.map(k)}:{},edges:f,...r.label!==void 0?{label:r.label}:{},...r.fidelity!==void 0?{fidelity:r.fidelity}:{},...r.cardinality!==void 0?{cardinality:r.cardinality}:{},...r.mode!==void 0?{mode:r.mode}:{},...r.selected!==void 0?{selected:r.selected}:{},...r.implicated?{implicated:S(r.implicated)}:{},...r.flagged?{flagged:S(r.flagged)}:{},acts:F,...e.theme?{theme:e.theme()}:{},locale:j(),timeZone:H(),today:e.store.today()??$(),...J(e.store.schema,[...c?[c]:[],...w??[]]),...e.placesShown?{places:e.placesShown().map(({as:t,title:m,kind:K})=>({as:t,title:m,kind:K}))}:{}}},h=!1,y=0,a=new Set,M=()=>{if(h)return;y+=1,a.add(y),a.size>100&&a.delete(a.values().next().value);let n=R();e.send({type:"props",props:e.hand?e.hand(n):n,push:y})},x=!1,T=e.store.subscribe(()=>{x||(x=!0,queueMicrotask(()=>{x=!1,M()}))}),b=(n,u)=>(s.refused+=1,{ok:!1,reason:n,message:u}),z=(n,u,r)=>P([{name:n,args:u}],r),P=(n,u,r)=>{if(!l.act())return b("rate-limited","Too many acts asked for at once; this one was not applied.");let c=[];for(let{name:o,args:g}of n){if(u){let f=u(o,g);if(!f.ok)return b(f.reason,f.message);o=f.name,g=f.args}if(!e.store.allMutations().some(f=>f.name===o))return b("unknown-act","There is no act by that name here.");c.push({name:o,args:g})}try{let o=e.store.applyAll(c,{author:e.principal,via:i,...r?{intent:r}:{}});return s.applied+=1,{ok:!0,intent:o.intent}}catch(o){return o instanceof L?b("refused",o.refusal.message):o instanceof N?b("failed",Z(o)):b("failed","The act could not be applied.")}},C=(n,u,r)=>{let c=Array.isArray(r);if(typeof u!="string"||(c?r.length===0||r.length>100||!r.every(v):!v(r)))return s.refused+=1,e.send({type:"answer",id:n,ok:!1,reason:"malformed",message:"An act is asked for by name, with its arguments as an object, or a list of 1 to 100 of them for several as one change."});let o=P((c?r:[r]).map(g=>({name:u,args:g})),e.judgeAct);e.send(o.ok?{type:"answer",id:n,ok:!0,intent:o.intent}:{type:"answer",id:n,ok:!1,reason:o.reason,message:o.message})};return{receive(n){if(h)return;if(!(v(n)&&n.nonce===e.nonce&&n.type==="pushed"&&typeof n.push=="number"&&a.delete(n.push))&&!l.message()){s.dropped+=1,e.onFlood?.();return}if(!v(n)||n.nonce!==e.nonce){s.dropped+=1;return}if(n.type==="act"&&(typeof n.id=="string"||typeof n.id=="number"))return C(n.id,n.name,n.args);if(n.type==="navigate"&&e.onArrive&&(typeof n.place=="string"||typeof n.to=="string")){let r={...n.where!==void 0?{where:n.where}:{},...n.section!==void 0?{section:n.section}:{}},c=typeof n.place=="string"?{place:n.place,...r}:{record:n.to,...r},o=e.onArrive;W().then(({judgeDestination:g,listsOf:f,placeVocabulary:G})=>{if(h)return;let A=new Set([...e.store.kindsKeptFrom(e.principal),...e.store.modules.disabledKinds]),w=g(c,{sees:S=>p().graph.has(S),places:G(e.store.schema,e.placesShown?.()??[],{kept:A}),lists:f(e.store.schema,A),schema:e.store.schema});w.ok?o(w.arrival):(s.dropped+=1,e.onLost?.(w.says))});return}if(n.type==="navigate"&&typeof n.place=="string"){e.places?.().includes(n.place)?e.onNavigatePlace?.(n.place):s.dropped+=1;return}if(n.type==="navigate"&&typeof n.to=="string"){p().graph.has(n.to)?e.onNavigate?.(n.to):s.dropped+=1;return}if(n.type==="render"&&Array.isArray(n.records)&&e.onRender){e.onRender(n.records);return}if(n.type==="style"&&Array.isArray(n.sheets)&&n.sheets.every(r=>typeof r=="string")&&e.onStyle){e.onStyle(n.sheets);return}if(n.type==="hears"&&Array.isArray(n.events)&&e.onHears){e.onHears(n.events.filter(r=>typeof r=="string").slice(0,20));return}if(n.type==="clicks"&&Array.isArray(n.selectors)){let r=c=>(Array.isArray(c)?c:[]).filter(o=>typeof o=="string"&&o.length<=500).slice(0,200);e.onClicks?.(r(n.selectors),r(n.acted));return}if(n.type==="gestures"&&Array.isArray(n.bound)&&e.onGestures){e.onGestures(n.bound.slice(0,32));return}if(n.type==="pushed"&&typeof n.push=="number"&&typeof n.ms=="number"&&e.onPushed){e.onPushed(n.push,n.ms);return}if(n.type==="size"&&typeof n.height=="number"&&Number.isFinite(n.height)){e.onSize?.(Math.max(0,Math.min(d,Math.round(n.height))));return}s.dropped+=1},push:M,pressed(n){return h?{ok:!1,reason:"refused",message:"The view has gone."}:n.ok?z(n.name,n.args):(s.refused+=1,n)},change(n,u){return h?{ok:!1,reason:"refused",message:"The view has gone."}:P(n,void 0,u)},get stats(){return s},dispose(){h=!0,T()}}}var V=e=>({number:"a number",string:"text",boolean:"yes or no",date:"a date",array:"a list",object:"a set of values"})[e.toLowerCase()]??`a ${e}`;function Z(e){return`Not applied: ${q(e)}.`}function q(e){return e.issues.slice(0,4).map(d=>{let i=d.path.map(String).join("."),s=/expected (\w+)/i.exec(d.message)?.[1];return i?s&&/^invalid (input|type)/i.test(d.message)?`\u201C${i}\u201D expects ${V(s)}`:`\u201C${i}\u201D: ${d.message.charAt(0).toLowerCase()}${d.message.slice(1)}`:d.message}).join("; ")||"its arguments did not fit"}export{D as a,I as b,J as c,_ as d,Q as e,Z as f,q as g};
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{L as $,Mb as L,P as j,Pb as N,S as H,nd as E}from"./chunk.DHPXRDT5.js";var W=()=>(__graviewPreload(import.meta.url,["./chunk.TQRC5VAM.js","./chunk.O7NYSO6F.js","./chunk.M5FP4Y4Q.js","./chunk.IO5VFTXC.js","./chunk.DHPXRDT5.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ISZFRLNJ.js"));function D(e,l,d){let i=new Map;for(let y of d?.kinds??[])for(let a of e.nodesOfKind(y))l.has(a.id)||i.set(a.id,a);let s=new Set([...l,...i.keys()]),p=new Set(d?.edges??[]),k=new Set;if(p.size>0&&l.size>0){for(let y of l)for(let a of e.outEdges(y))p.has(a.kind)&&i.has(a.to)&&k.add(a.to);for(let y of i.keys())e.outEdges(y).some(a=>p.has(a.kind)&&l.has(a.to))&&k.add(y)}let R=new Map([...[...i].filter(([y])=>k.has(y)),...[...i].filter(([y])=>!k.has(y))]),h=[];if(p.size>0)for(let y of s)for(let a of e.outEdges(y))p.has(a.kind)&&s.has(a.to)&&h.push({kind:a.kind,from:a.from,to:a.to});return{nodes:[...R.values()],edges:h}}function O(e,l,d){let i=[];return()=>{let s=d();for(;i.length>0&&i[0]<=s-l;)i.shift();return i.length>=e?!1:(i.push(s),!0)}}function I(e={},l=Date.now){return{act:O(e.acts??30,e.actWindowMs??6e4,l),message:O(e.messages??120,e.messageWindowMs??1e3,l)}}var v=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function J(e,l){let d=l.flatMap(s=>v(s)&&typeof s.kind=="string"?[s.kind]:[]),i=E(e,d);return Object.keys(i).length>0?{choices:i}:{}}function _(e,l){let d=structuredClone(l),i=e.schema.tryDefinition(d.kind),s=d.label;return{...d,label:i?.label?i.label(d):typeof s=="string"&&s.length>0?s:d.id}}function Q(e){let l=e.limiter??I(e.limits,e.now),d=e.limits?.maxHeight??4e3,i=`view:${e.view}`,s={applied:0,refused:0,dropped:0},p=()=>e.store.seenBy(e.principal),k=n=>_(e.store,n),R=()=>{if(e.props)return e.props();let n=p(),u=n.graph,r=e.input?.()??{},c=r.node?u.getNode(r.node.id):void 0,o=r.nodes?.flatMap(t=>{let m=u.getNode(t.id);return m?[m]:[]}),g=new Set([...c?[c.id]:[],...(o??[]).map(t=>t.id)]),f=[];for(let t of g)for(let m of u.outEdges(t))g.has(m.to)&&f.push({kind:m.kind,from:m.from,to:m.to});let G=D(u,g,e.reads),A=new Set(f.map(t=>`${t.kind} ${t.from} ${t.to}`));for(let t of G.edges)A.has(`${t.kind} ${t.from} ${t.to}`)||f.push(t);let w=G.nodes.length>0?[...o??[],...G.nodes]:o,S=t=>t?.filter(m=>u.has(m)),F=n.permittedMutations(e.principal).map(t=>({name:t.name,title:t.title??t.name,...t.description!==void 0?{description:t.description}:{},...t.subject?{subject:{kinds:t.subject.kinds,arg:t.subject.arg}}:{}}));return{view:e.view,...c?{node:k(c)}:{},...w?{nodes:w.map(k)}:{},edges:f,...r.label!==void 0?{label:r.label}:{},...r.fidelity!==void 0?{fidelity:r.fidelity}:{},...r.cardinality!==void 0?{cardinality:r.cardinality}:{},...r.mode!==void 0?{mode:r.mode}:{},...r.selected!==void 0?{selected:r.selected}:{},...r.implicated?{implicated:S(r.implicated)}:{},...r.flagged?{flagged:S(r.flagged)}:{},acts:F,...e.theme?{theme:e.theme()}:{},locale:j(),timeZone:H(),today:e.store.today()??$(),...J(e.store.schema,[...c?[c]:[],...w??[]]),...e.placesShown?{places:e.placesShown().map(({as:t,title:m,kind:K})=>({as:t,title:m,kind:K}))}:{}}},h=!1,y=0,a=new Set,M=()=>{if(h)return;y+=1,a.add(y),a.size>100&&a.delete(a.values().next().value);let n=R();e.send({type:"props",props:e.hand?e.hand(n):n,push:y})},x=!1,T=e.store.subscribe(()=>{x||(x=!0,queueMicrotask(()=>{x=!1,M()}))}),b=(n,u)=>(s.refused+=1,{ok:!1,reason:n,message:u}),z=(n,u,r)=>P([{name:n,args:u}],r),P=(n,u,r)=>{if(!l.act())return b("rate-limited","Too many acts asked for at once; this one was not applied.");let c=[];for(let{name:o,args:g}of n){if(u){let f=u(o,g);if(!f.ok)return b(f.reason,f.message);o=f.name,g=f.args}if(!e.store.allMutations().some(f=>f.name===o))return b("unknown-act","There is no act by that name here.");c.push({name:o,args:g})}try{let o=e.store.applyAll(c,{author:e.principal,via:i,...r?{intent:r}:{}});return s.applied+=1,{ok:!0,intent:o.intent}}catch(o){return o instanceof L?b("refused",o.refusal.message):o instanceof N?b("failed",Z(o)):b("failed","The act could not be applied.")}},C=(n,u,r)=>{let c=Array.isArray(r);if(typeof u!="string"||(c?r.length===0||r.length>100||!r.every(v):!v(r)))return s.refused+=1,e.send({type:"answer",id:n,ok:!1,reason:"malformed",message:"An act is asked for by name, with its arguments as an object, or a list of 1 to 100 of them for several as one change."});let o=P((c?r:[r]).map(g=>({name:u,args:g})),e.judgeAct);e.send(o.ok?{type:"answer",id:n,ok:!0,intent:o.intent}:{type:"answer",id:n,ok:!1,reason:o.reason,message:o.message})};return{receive(n){if(h)return;if(!(v(n)&&n.nonce===e.nonce&&n.type==="pushed"&&typeof n.push=="number"&&a.delete(n.push))&&!l.message()){s.dropped+=1,e.onFlood?.();return}if(!v(n)||n.nonce!==e.nonce){s.dropped+=1;return}if(n.type==="act"&&(typeof n.id=="string"||typeof n.id=="number"))return C(n.id,n.name,n.args);if(n.type==="navigate"&&e.onArrive&&(typeof n.place=="string"||typeof n.to=="string")){let r={...n.where!==void 0?{where:n.where}:{},...n.section!==void 0?{section:n.section}:{}},c=typeof n.place=="string"?{place:n.place,...r}:{record:n.to,...r},o=e.onArrive;W().then(({judgeDestination:g,listsOf:f,placeVocabulary:G})=>{if(h)return;let A=new Set([...e.store.kindsKeptFrom(e.principal),...e.store.modules.disabledKinds]),w=g(c,{sees:S=>p().graph.has(S),places:G(e.store.schema,e.placesShown?.()??[],{kept:A}),lists:f(e.store.schema,A),schema:e.store.schema});w.ok?o(w.arrival):(s.dropped+=1,e.onLost?.(w.says))});return}if(n.type==="navigate"&&typeof n.place=="string"){e.places?.().includes(n.place)?e.onNavigatePlace?.(n.place):s.dropped+=1;return}if(n.type==="navigate"&&typeof n.to=="string"){p().graph.has(n.to)?e.onNavigate?.(n.to):s.dropped+=1;return}if(n.type==="render"&&Array.isArray(n.records)&&e.onRender){e.onRender(n.records);return}if(n.type==="style"&&Array.isArray(n.sheets)&&n.sheets.every(r=>typeof r=="string")&&e.onStyle){e.onStyle(n.sheets);return}if(n.type==="hears"&&Array.isArray(n.events)&&e.onHears){e.onHears(n.events.filter(r=>typeof r=="string").slice(0,20));return}if(n.type==="clicks"&&Array.isArray(n.selectors)){let r=c=>(Array.isArray(c)?c:[]).filter(o=>typeof o=="string"&&o.length<=500).slice(0,200);e.onClicks?.(r(n.selectors),r(n.acted));return}if(n.type==="gestures"&&Array.isArray(n.bound)&&e.onGestures){e.onGestures(n.bound.slice(0,32));return}if(n.type==="pushed"&&typeof n.push=="number"&&typeof n.ms=="number"&&e.onPushed){e.onPushed(n.push,n.ms);return}if(n.type==="size"&&typeof n.height=="number"&&Number.isFinite(n.height)){e.onSize?.(Math.max(0,Math.min(d,Math.round(n.height))));return}s.dropped+=1},push:M,pressed(n){return h?{ok:!1,reason:"refused",message:"The view has gone."}:n.ok?z(n.name,n.args):(s.refused+=1,n)},change(n,u){return h?{ok:!1,reason:"refused",message:"The view has gone."}:P(n,void 0,u)},get stats(){return s},dispose(){h=!0,T()}}}var V=e=>({number:"a number",string:"text",boolean:"yes or no",date:"a date",array:"a list",object:"a set of values"})[e.toLowerCase()]??`a ${e}`;function Z(e){return`Not applied: ${q(e)}.`}function q(e){return e.issues.slice(0,4).map(d=>{let i=d.path.map(String).join("."),s=/expected (\w+)/i.exec(d.message)?.[1];return i?s&&/^invalid (input|type)/i.test(d.message)?`\u201C${i}\u201D expects ${V(s)}`:`\u201C${i}\u201D: ${d.message.charAt(0).toLowerCase()}${d.message.slice(1)}`:d.message}).join("; ")||"its arguments did not fit"}export{D as a,I as b,J as c,_ as d,Q as e,Z as f,q as g};
@@ -0,0 +1 @@
1
+ import{i}from"./chunk.IRNEWNUB.js";import"./chunk.AUNQNTKY.js";import"./chunk.KLEKC4ZX.js";import"./chunk.PJL3I2IW.js";import"./chunk.OD5QZHRC.js";import"./chunk.YJ4PFOPC.js";import"./chunk.LKM2R5UF.js";import"./chunk.5MOXQUZH.js";import"./chunk.MKN7ADJB.js";import"./chunk.I4H2GS4O.js";import"./chunk.MUWI54IP.js";import"./chunk.3D37E2G5.js";import"./chunk.WVUJXDXZ.js";import{e as l}from"./chunk.B422DSYN.js";import"./chunk.ZE5RSKXF.js";import"./chunk.DKUEZPGR.js";import"./chunk.EP7YT7LT.js";import"./chunk.I7KN732Z.js";import"./chunk.TLPCYKLW.js";import"./chunk.MIE4TJRW.js";import"./chunk.SCVKHGO3.js";import"./chunk.RD2FSSLV.js";import"./chunk.AZRICZKT.js";import"./chunk.MH3AQO2R.js";import"./chunk.J2N7EKMX.js";import"./chunk.P26ATAAI.js";import"./chunk.FIY4RUK5.js";import"./chunk.IY3DV52G.js";import"./chunk.NLZHNPDU.js";import"./chunk.QNC2OKLF.js";import{W as m}from"./chunk.FWXW4T4I.js";import"./chunk.SDO3U72B.js";import"./chunk.DHPXRDT5.js";import"./chunk.FQLNBIQ5.js";import{b as g}from"./chunk.AJZBJBMO.js";var a=g(m(),1),r=new WeakMap;function c(n){let o=r.get(n);if(!o){let t=l(n);o=e=>e.mode==="fullscreen"?(0,a.jsx)(i,{blocks:t,slot:"home",heading:2,firstHeading:1,...e.flagged?{flagged:e.flagged}:{}}):(0,a.jsx)(i,{blocks:t,slot:"home",heading:3,firstHeading:2,...e.flagged?{flagged:e.flagged}:{}}),r.set(n,o)}return o}export{c as homeView};
@@ -1 +1 @@
1
- import{sd as d}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var m="data-graview-refused-note",u=`position:absolute;z-index:${d.over};box-sizing:border-box;margin:0;padding:4px 8px;max-width:min(40ch,calc(100% - 8px));border-radius:6px;font:inherit;font-size:0.8125rem;line-height:1.35;color:var(--graview-ink,CanvasText);background:var(--graview-panel,Canvas);border:1px solid var(--graview-danger,#b42318);box-shadow:0 2px 8px rgb(0 0 0 / 0.12);pointer-events:none;overflow-wrap:anywhere`;function v(s){let n=new Map,p=0,a=(t,o)=>{let e=s.host.getBoundingClientRect(),r=t.getBoundingClientRect(),f=o.offsetWidth,i=o.offsetHeight,g=Math.max(4,Math.min(r.left-e.left,e.width-f-4)),c=r.bottom-e.top+4,h=c+i<=e.height||r.top-e.top-i-4<0?c:r.top-e.top-i-4;o.style.left=`${Math.round(g)}px`,o.style.top=`${Math.round(h)}px`},l={say(t,o){l.clear(t);let e=s.ownerDocument.createElement("p");e.setAttribute(m,""),e.setAttribute("role","status"),e.id=`graview-refused-${p+=1}`,e.setAttribute("style",u),e.textContent=o,s.appendChild(e),n.set(t,e),a(t,e)},clear(t){let o=n.get(t);o&&(o.remove(),n.delete(t))},refresh(){for(let[t,o]of n)t.isConnected?a(t,o):(o.remove(),n.delete(t))}};return l}export{v as createRefusalNotes};
1
+ import{sd as d}from"./chunk.DHPXRDT5.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var m="data-graview-refused-note",u=`position:absolute;z-index:${d.over};box-sizing:border-box;margin:0;padding:4px 8px;max-width:min(40ch,calc(100% - 8px));border-radius:6px;font:inherit;font-size:0.8125rem;line-height:1.35;color:var(--graview-ink,CanvasText);background:var(--graview-panel,Canvas);border:1px solid var(--graview-danger,#b42318);box-shadow:0 2px 8px rgb(0 0 0 / 0.12);pointer-events:none;overflow-wrap:anywhere`;function v(s){let n=new Map,p=0,a=(t,o)=>{let e=s.host.getBoundingClientRect(),r=t.getBoundingClientRect(),f=o.offsetWidth,i=o.offsetHeight,g=Math.max(4,Math.min(r.left-e.left,e.width-f-4)),c=r.bottom-e.top+4,h=c+i<=e.height||r.top-e.top-i-4<0?c:r.top-e.top-i-4;o.style.left=`${Math.round(g)}px`,o.style.top=`${Math.round(h)}px`},l={say(t,o){l.clear(t);let e=s.ownerDocument.createElement("p");e.setAttribute(m,""),e.setAttribute("role","status"),e.id=`graview-refused-${p+=1}`,e.setAttribute("style",u),e.textContent=o,s.appendChild(e),n.set(t,e),a(t,e)},clear(t){let o=n.get(t);o&&(o.remove(),n.delete(t))},refresh(){for(let[t,o]of n)t.isConnected?a(t,o):(o.remove(),n.delete(t))}};return l}export{v as createRefusalNotes};
@@ -1 +1 @@
1
- import{b as kn,c as bn,d as oe,e as wn,f as Y,h as Ee,i as je,n as vn,s as se,u as On}from"./chunk.3DEWQDP7.js";import{B as be,C as ue,Ea as Oe,F as _e,H as He,Ha as en,K as Ue,Ka as nn,L as We,Ma as tn,Nb as U,Qa as xe,Ra as Re,Sb as cn,Tb as ln,Uc as mn,Vb as fn,Xa as rn,_a as on,_b as pn,b as Fe,c as Ne,d as Ce,dc as un,e as K,fd as gn,g as ye,ga as Je,gd as yn,h as Z,ha as Ye,hd as Ae,i as Ie,id as hn,j as Ve,ja as Qe,jd as ze,k as he,kb as an,l as Ke,m as Ze,nb as sn,o as qe,p as fe,q as ve,sb as Se,ta as Xe,tb as dn,v as Be,x as pe,z as ke}from"./chunk.6AANHELP.js";var Tn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],q=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function xn(e,d=Tn){if(!q(e))return{document:e,respelled:[]};let n=[],t=e;for(let a of d)t=De(t,a.where.split("."),a,"",n);return{document:t,respelled:n}}function De(e,d,n,t,a){if(d.length===0){if(!q(e)||!Object.hasOwn(e,n.was))return e;a.push(`${t}${n.was}`);let{[n.was]:ie,...B}=e;return Object.hasOwn(e,n.now)?B:{...B,[n.now]:ie}}if(!q(e))return e;let[f,...E]=d,k=f.endsWith("[]"),O=k?f.slice(0,-2):f,G=e[O],X=G;if(!k)X=De(G,E,n,`${t}${O}.`,a);else if(Array.isArray(G)){let ie=G.map((B,T)=>De(B,E,n,`${t}${O}.${T}.`,a));X=ie.some((B,T)=>B!==G[T])?ie:G}return X===G?e:{...e,[O]:X}}var Rn=new WeakMap;function Sn(e,d){Rn.set(e,d)}function Zn(e){return Rn.get(e)}function An(e){if(typeof e=="string")return{form:"string",light:e};if(typeof e!="object"||e===null)return;let d=e,n=k=>typeof d[k]=="string"?d[k]:void 0,t=n("light")??n("src");if(t===void 0)return;let[a,f,E]=[n("dark"),n("alt"),n("darkFallback")];return{form:n("light")!==void 0?"light":"src",light:t,...a!==void 0?{dark:a}:{},...f!==void 0?{alt:f}:{},...E!==void 0?{darkFallback:E}:{}}}function Qn(e,d){let n=e.brand??{},t=n.ground,a=n.accent?ze(n.accent,t):void 0;t&&hn(a?.ok?a.schemes:Ae(t),n.accent)&&(d.push(je("brand","brand.ground","words would not read on that page background, so the app keeps Graview's","pick a lighter ground for the light scheme, a darker one for the dark")),t=void 0,a=n.accent?ze(n.accent):void 0),a&&!a.ok&&d.push(je("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${a.why}`,"pick a color further from orange-red, or a darker one"));let f=An(n.logo),E=n.name??e.name,k=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,O])=>typeof O=="string"&&yn(O)===null).map(([O,G])=>[O,gn(G)])):void 0;return{name:E,schemes:a?.ok?a.schemes:t?Ae(t):mn,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...n.timeZone?{timeZone:n.timeZone}:{},...f?{logo:f.dark||f.darkFallback==="invert"?{light:f.light,...f.dark?{dark:f.dark}:{darkFallback:"invert"}}:f.light,logoAlt:f.alt??E}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...n.subtitle===!1?{subtitleDrawn:!1}:{},...k?{typography:k}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{},...n.views&&(n.views.css||n.views.motion)?{views:{...n.views.css?{css:n.views.css}:{},...n.views.motion?{motion:n.views.motion}:{}}}:{}}}function zn(e){let{currency:d,locale:n,timeZone:t}=e.brand??{};return{...d?{currency:d}:{},...n?{locale:n}:{},...t?{timeZone:t}:{}}}var Gn=Symbol.for("@graview/core:typed-field"),En=(e,d)=>(/^(phone|place|duration)$/.test(d)&&(ue(e)[Gn]=d),e),jn=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;function Dn(e){let d=Z().check(K(300),ke(t=>nn(t,e)!==void 0,`a record of ${e.kinds.join(" or ")} in ${e.address}, as "<kind>:<id>"`)),n=e.cardinality==="one"?d:fe(d).check(K(200));return tn(e.description?n.check(be(e.description)):n,e)}var Ln="graview-compiled@1";function Fn(e,d){return e.find(([n,t])=>n!==Q&&"ref"in t&&(t.ref==="*"||t.ref.includes(d)))?.[0]}var Q="id",me=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function $n(e){let d=Object.entries(e.fields),n=t=>["name","title","label"].find(a=>t.some(([f])=>f===a))??t[0]?.[0];return n(d.filter(([,t])=>t.required&&(t.type==="string"||t.type==="text")))??n(d.filter(([,t])=>t.type==="string"))}function Pn(e,d,n){let t;switch(e.type){case"string":case"place":t=Z().check(K(500));break;case"phone":t=Z().check(K(40),ye(jn,"a phone number"));break;case"text":t=Z().check(K(2e4)),e.format&&(ue(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let f=e.min??(e.type==="duration"?0:void 0),E=[...e.type==="number"?[]:[Ke()],...f===void 0?[]:[Ne(f)],...e.max===void 0?[]:[Fe(e.max)],...e.step===void 0?[]:[Ce(e.step)]];t=E.length>0?he().check(...E):he();break}case"boolean":t=Ze();break;case"date":t=Z().check(ye(He,"a date like 2026-10-02, or a month (2016-05) or a year (2006) alone"));break;case"datetime":t=Z().check(ke(Ue,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=Be(e.options),e.multiple&&(t=fe(t).check(K(e.options.length)));break;case"list":t=fe(e.of==="number"?he():e.of==="date"?Z().check(ye(_e)):e.of==="image"||e.of==="video"||e.of==="file"?Oe(e.of):Z().check(K(500))).check(K(200));break;case"image":case"video":case"file":t=Oe(e.type);break;case"app-link":t=en();break;case"url":t=Ve();break;case"email":t=Ie();break}let a=e.type==="number"||e.type==="integer";return En(t,a&&e.format==="duration"?"duration":e.type),e.collaborative!==void 0&&(e.type==="text"||e.type==="string")&&(ue(t)[Symbol.for("@graview/core:collaborative")]=e.collaborative?1:0),e.description&&(t=t.check(be(e.description))),a&&(e.format==="money"||e.format==="percent"||!e.format&&e.unit)&&pn(t,{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{},...e.places===0?{places:0}:{}}),d?pe(t):t}var ge=e=>{throw new U(`there is no record "${e}"`,"invalid")},Nn=(e,d)=>"field"in e?Pn(e.field,e.optional,d):"ref"in e?un(e.ref):pe(qe()),Cn=new WeakMap;var Le=(e,d)=>q(d)&&Object.keys(e??{}).length===Object.keys(d).length&&Object.keys(e??{}).every(n=>Object.hasOwn(d,n));function xt(e,d={}){let n=q(e)?e.format:void 0;if(n!==Ln)return{ok:!1,findings:[Ee("compiled-format","format",n===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(n)}, and this build reads ${Ln}`,"compile the document instead")]};let t=e,a=xn(t.document).document,f=a===t.document?t:{...t,document:a},E=q(a)&&typeof a.name=="string"&&q(a.kinds)&&Le(a.kinds,f.kinds)&&Le(a.acts,f.acts)&&Le(a.rules,f.rules)&&Array.isArray(f.edges)&&Array.isArray(f.findings),k={ok:!1,findings:[Ee("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!E)return k;try{return In(f,d)}catch{return k}}function In(e,d={}){let{document:n}=e,t=n.brand?.timeZone,a=d.today??(()=>We(t)),f={...n.brand?.locale?{locale:n.brand.locale}:{},...t?{timeZone:t}:{}},E=new Map(e.edges.map(([p,i])=>[p,i])),k=new Map;for(let[p,i]of Object.entries(n.kinds)){let x=e.kinds[p]?.computed,w=Re(i.edges),j=new Map(Object.entries(i.fields).flatMap(([S,v])=>v.type==="enum"?[[S,v.optionLabels??{}]]:[]));k.set(p,{fields:new Set([...Object.keys(i.fields),...w.keys()]),edges:new Map(Object.entries(xe(i.edges)).map(([S,v])=>[S,v.cardinality??"many"])),...x?{computed:new Map(x)}:{},...w.size>0?{linked:w}:{},...j.size>0?{choices:j}:{}})}e.facts&&k.set(bn,{computed:new Map(e.facts)});let O=zn(n),G=p=>({from:p.from,via:p.via,sourceEnd:p.sourceEnd,back:p.back,values(i,x,w){let j={};for(let[S,v]of p.set)if("value"in v)j[S]=v.value;else try{let $=Y(v.expr,{graph:i,subject:x,kinds:k,bindings:{to:w},today:a(),...f});($===null||typeof $!="object"||Array.isArray($))&&(j[S]=$)}catch($){if(!($ instanceof oe))throw $}return j}}),X=new Map,ie=Object.entries(n.kinds).map(([p,i])=>{let x={};for(let[r,o]of Object.entries(i.fields))x[r]=Pn(o,!o.required,O),o.repeats&&(x[rn(r)]=pe(on()));for(let[r,o]of Re(i.edges))x[r]=pe(Dn(o));let{label:w,describe:j,durations:S}=e.kinds[p]??{},v=Object.entries(i.computed??{}).map(([r,o])=>[r,typeof o=="string"?{expr:o}:o]),$=Object.hasOwn(i.fields,"label")&&!i.fields.label.label&&!/\{\s*label\b/.test(i.label??`{${$n(i)??""}}`),ee=Object.fromEntries([...$?[["label","Label"]]:[],...Object.entries(i.fields).filter(([,r])=>r.label).map(([r,o])=>[r,o.label]),...v.filter(([,r])=>r.label).map(([r,o])=>[r,o.label])]),W=Object.keys(ee).length>0,L=Object.entries(i.fields).filter(([,r])=>r.type==="enum"&&(r.optionLabels&&Object.keys(r.optionLabels).length>0||r.multiple)),l=r=>o=>typeof o=="string"&&r.optionLabels&&Object.hasOwn(r.optionLabels,o)?r.optionLabels[o]:Ye(String(o)),M=Object.fromEntries(L.map(([r,o])=>[r,o.multiple?z=>Array.isArray(z)?z.map(l(o)).join(", "):l(o)(z):l(o)])),N=L.length>0,C=Object.fromEntries(Object.entries(i.fields).filter(([,r])=>r.default!==void 0).map(([r,o])=>[r,o.default]));X.set(p,C);let _=Object.fromEntries(Object.entries(xe(i.edges)).map(([r,{renamedFrom:o,...z}])=>[r,z])),I=Object.entries(i.fields).flatMap(([r,o])=>o.aliases?[[r,o.aliases]]:[]),P=r=>i[r]?{[r]:i[r]}:{};return Qe(p,{fields:ve(x),edges:_,...P("plural"),...P("noun"),...P("aliases"),...I.length>0?{fieldAliases:Object.fromEntries(I)}:{},...P("description"),...w?{label:r=>se(w,{node:r,kinds:k,today:a(),money:O})||r.id}:{},...j?{describe:r=>se(j,{node:r,kinds:k,today:a(),money:O})}:{},...P("lifecycle"),...P("figure"),...P("fieldRoles"),...P("people"),archives:i.archives,...i.tidying?{tidying:i.tidying}:{},...v.length>0?{computed:Object.fromEntries(v.map(([r,o])=>[r,Vn(o,S?.includes(r)??!1,O)??i.computed[r]]))}:{},...W||N||i.glance||i.page?{display:{...W?{labels:ee}:{},...N?{format:M}:{},...i.glance?{glance:[...i.glance]}:{},...i.page?{page:i.page}:{}}}:{},...Object.keys(C).length>0?{defaults:C}:{},...e.kinds[p]?.keptInStep?{keptInStep:e.kinds[p].keptInStep}:{},...e.kinds[p]?.derives?{derives:G(e.kinds[p].derives)}:{}})}),B=an(ie,n.computed);function T(p){return B.tryDefinition(p.kind)?.label?.(p)??p.id}let $e=p=>({id:"",kind:p,...X.get(p)}),Pe=[];for(let[p,i]of Object.entries(n.acts??{})){let x=e.acts[p],{title:w,effects:j,guard:S,refusal:v,destructive:$,idempotent:ee,creates:W,connects:L,severs:l,writes:M,writesOther:N,sets:C}=x,_={};for(let c of j)"through"in c&&(_[c.through]=[...new Set([..._[c.through]??[],...Object.keys(c.set)])]);let I=new Map(x.args),P={};for(let[c,A]of I)P[c]=Nn(A,O);let r=[i.on??[]].flat(),o=new Map(x.exprs),z=j.find(c=>"create"in c),J=(c,A,u,b=null)=>{if(q(c)&&"expr"in c)return Y(o.get(c.expr),{graph:u,subject:b,kinds:k,bindings:A,today:a(),...f});let h=me(c);return h===void 0?typeof c=="string"&&c.startsWith("$$")?c.slice(1):c:h==="now"?new Date().toISOString():h==="today"?a():A[h]},de=(c,A)=>{if(!z)return"";let u=n.kinds[z.create].fields,b=$e(z.create),h=[];for(let[R,ce]of Object.entries(z.set??{})){try{b[R]=J(ce,c,A)??b[R]}catch{}let ae=me(ce);ae&&c[ae]!==void 0&&h.push(R)}let V=T(b).trim(),ne=h.filter(R=>b[R]!==!1&&u[R].type!=="text"&&!(/[^]{41}/.test(b[R])||/ .*[.!?]$/.test(b[R])&&!/[ .][A-Z]\w{0,3}\.$/.test(b[R]))&&T({...b,[R]:void 0}).trim()===V).map(R=>b[R]===!0?u[R].label??Je(R):vn(b[R],u[R].format,a(),[],O));return V&&ne.length>0?`${V} (${ne.join(", ")})`:V};Pe.push(fn(p,{input:ve(P),title:w,...i.description?{description:i.description}:{},...i.fromTheOtherEnd?{fromTheOtherEnd:i.fromTheOtherEnd}:{},...I.has(Q)?{subject:{kinds:r.length>0?r:"*",arg:Q}}:{},...$?{destructive:!0}:{},...ee?{idempotent:!0}:{},...W.length>0?{creates:W}:{},...L.length>0?{connects:L}:{},...l.length>0?{severs:l}:{},writes:M,...Object.keys(N).length>0?{writesOther:N}:{},...Object.keys(_).length>0?{writesLinked:_}:{},...Object.keys(C).length>0?{sets:C}:{},...S?{allowedOn:(c,A)=>{let u=c.getNode(A);if(!u||r.length>0&&!r.includes(u.kind))return!1;try{return Y(S,{graph:c,subject:u,kinds:k,bindings:{},today:a(),...f})===!0}catch{return!1}}}:{},describe:(c,A)=>{let u=typeof c[Q]=="string"?A.getNode(c[Q]):void 0,b=u?T(u):de(c,A);return b?`${w}: ${b}`:w},apply(c,A){let u=c.graph,b=typeof A[Q]=="string"?A[Q]:void 0,h=b?u.getNode(b):void 0;if(b&&!h&&ge(b),h&&r.length>0&&!r.includes(h.kind))throw new U(`"${w}" acts on ${r.join(" or ")}, not on ${Xe(h.kind)}`,"invalid");let V={};for(let[s,m]of Object.entries(A))m!==void 0&&(V[s]=m);if(S&&h){let s;try{s=Y(S,{graph:u,subject:h,kinds:k,bindings:V,today:a(),...f})}catch(m){throw m instanceof oe?new U(`"${w}" could not be judged: ${m.sentence}`):m}if(s!==!0)throw new U(v?se(v,{node:h,kinds:k,graph:u,bindings:V,today:a(),money:O}):`"${w}" is not allowed for ${T(h)} right now`)}let ne=new Map,R=s=>u.has(s)||[...ne.values()].includes(s),ce=new Set,ae=s=>{let m=sn(s);ce.has(m)||(ce.add(m),c.removeEdge(s))},te=(s,m)=>{let g=me(s);if(g==="subject")return b;if(g==="me"){let y=c.me;if(y&&n.kinds[u.getNode(y)?.kind]?.people)return y;throw new U(`"${w}" is done as you, and you have no record here`)}if(ne.has(g))return ne.get(g);try{return J(s,V,u,m??h??null)}catch(y){throw y instanceof oe?new U(`"${w}" could not work out a value: ${y.sentence}`):y}};for(let s of j)if("create"in s){let m=n.kinds[s.create],g=$e(s.create);for(let[H,re]of Object.entries(s.set??{})){let Me=te(re,void 0);Me!==void 0&&(g[H]=Me)}let y=$n(m),D=String((y&&g[y])??s.create),le=ln(D,s.create,g,(H,re)=>cn(n.policy?.sees,H,re)),F=c.freshId(le?s.create:D,s.create,g);c.addNode({...g,id:F}),s.as&&ne.set(s.as,F)}else if("connect"in s||"sever"in s){let m="connect"in s?s.connect:s.sever,g=String(te(s.from,void 0)??""),y=String(te(s.to,void 0)??"");if(R(g)||ge(g),R(y)||ge(y),"connect"in s){if(E.get(m)?.cardinality==="one")for(let D of u.out(g,m))D.id!==y&&ae({kind:m,from:g,to:D.id});u.out(g,m).some(D=>D.id===y)||c.addEdge({kind:m,from:g,to:y})}else ae({kind:m,from:g,to:y})}else if("through"in s){if(!h)throw new U(`"${w}" carries a change to linked records, and has no record to start from`,"invalid");let g=E.get(s.through)?.from.includes(h.kind)??!0?u.out(h.id,s.through):u.in(h.id,s.through);for(let y of g){let D={};for(let[le,F]of Object.entries(s.set)){let H;if(me(F)==="to")H=y.id;else if(q(F)&&"expr"in F)try{H=Y(o.get(F.expr),{graph:u,subject:h,kinds:k,bindings:{...V,to:y},today:a(),...f})}catch(re){throw re instanceof oe?new U(`"${w}" could not work out a value for ${T(y)}: ${re.sentence}`):re}else H=te(F,void 0);H!==void 0&&(D[le]=H)}Object.keys(D).length>0&&c.patchNode(y.id,D)}}else if("set"in s){let m=String(te(s.target??"$subject",void 0)??""),g=u.getNode(m);!g&&!R(m)&&ge(m);let y={};for(let[D,le]of Object.entries(s.set)){let F=te(le,g);F!==void 0&&(y[D]=F)}Object.keys(y).length>0&&c.patchNode(m,y)}else if("remove"in s){let m=String(te(s.remove,void 0)??"");u.has(m)||ge(m),c.removeNode(m)}else if("replace"in s&&h){let m=A.to;for(let g of s.replace){let y=E.get(g)?.from.includes(h.kind)??!0;for(let D of y?u.out(h.id,g):u.in(h.id,g))g===s.keep&&D.id===m||ae(y?{kind:g,from:h.id,to:D.id}:{kind:g,from:D.id,to:h.id})}}}}))}let Te=[];for(let[p,i]of Object.entries(n.rules??{})){let{title:x,require:w,when:j,says:S,covers:v}=e.rules[p],$=i.repairs??[],ee=(L,l,M=a(),N)=>{let C=[],_={graph:L,subject:l,kinds:k,today:M,...f,...N?{linked:N}:{},onUnread:o=>C.push(o)},I,P=[];try{if(j&&Y(j,_)!==!0)return[];if(v&&l?(P=On(L,l,v),I=P.length===0):I=Y(w,_)===!0,!I&&C.length>0)throw new oe(`it reads ${kn(C[0])}`,0)}catch(o){throw o instanceof wn?new dn(o.sentence):o instanceof oe?new Error(o.sentence):o}if(I)return[];let r=$.flatMap(o=>{let z=n.acts?.[o.act],J={},de=l&&z?.on&&z.fromTheOtherEnd&&![z.on].flat().includes(l.kind)?Fn(e.acts[o.act].args,l.kind):void 0;de?J[de]=l.id:l&&(z?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(o.act))&&(J[Q]=l.id);for(let[u,b]of Object.entries(o.args??{}))J[u]=me(b)==="subject"?l?.id:b;let A=(z?e.acts[o.act].args:[]).filter(([u,b])=>b.required&&J[u]===void 0).map(([u])=>u);return[{mutation:o.act,label:o.label??(de?z.fromTheOtherEnd:z?.title)??o.act.replace(/-/g," "),args:J,...A.length>0?{missing:A}:{}}]});return v&&l?P.map(o=>({invariant:p,subjectId:l.id,label:x,message:S?se(S,{node:l,kinds:k,graph:L,today:M,money:O,bindings:{[l.kind]:l,[o.kind]:o}}):`${T(l)}: ${x} \u2014 ${T(o)}`,nodeIds:[l.id,o.id],repairs:r})):[{invariant:p,...l?{subjectId:l.id}:{},label:x,message:S?se(S,{node:l,kinds:k,graph:L,today:M,money:O}):l?`${T(l)}: ${x}`:x,nodeIds:l?[l.id]:[],repairs:r}]},W={label:x,shape:{over:i.over,require:w,...v?{covers:v}:{},when:j,says:S,declared:n.kinds,money:O,kinds:k,today:a},judgment:{...i.require?{require:i.require}:{},...i.covers?{covers:i.covers}:{},...i.when?{when:i.when}:{},...i.says?{says:i.says}:{}},...i.description?{description:i.description}:{},...$.length>0?{repairs:$.map(L=>L.act)}:{}};Te.push(i.over==="graph"?Se(p,{scope:"graph",...W,evaluate:({graph:L,today:l,context:M})=>ee(L,null,l,M?.linked)}):Se(p,{scope:{kind:i.over},...W,evaluate:({graph:L,subject:l,today:M,context:N})=>ee(L,l,M,N?.linked)}))}let Ge=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},we={name:n.name,schema:B,mutations:Pe,invariants:Te,...Ge?{policy:Ge}:{},...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}:{},...n.forms?{forms:n.forms}:{},...n.publishing?{publishing:n.publishing}:{},...n.tidying?{tidying:n.tidying}:{},...n.purpose?{purpose:n.purpose}:{},...e.viewSpecs?{viewSpecs:e.viewSpecs}:{},...e.home?{home:e.home}:{},version:n.version??1};return Sn(we,n),Cn.set(we,e),{ok:!0,app:we,document:n,findings:e.findings,sights:n.policy?.sees,kinds:k}}function Vn(e,d,n){let t=d||e.format==="duration",a=e.format==="money"||e.format==="percent"||!e.format&&e.unit!==void 0;if(!(!t&&!a))return{...e,...t?{as:"duration"}:{},...a?{amount:{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{},...e.places===0?{places:0}:{}}}:{}}}export{q as a,xn as b,Zn as c,Qn as d,Ln as e,Q as f,me as g,$n as h,xt as i,In as j};
1
+ import{b as kn,c as bn,d as oe,e as wn,f as Y,h as Ee,i as je,n as vn,s as se,u as On}from"./chunk.TLPCYKLW.js";import{B as be,C as ue,Ea as Oe,F as _e,H as He,Ha as en,K as Ue,Ka as nn,L as We,Ma as tn,Nb as U,Qa as xe,Ra as Re,Sb as cn,Tb as ln,Uc as mn,Vb as fn,Xa as rn,_a as on,_b as pn,b as Fe,c as Ne,d as Ce,dc as un,e as K,fd as gn,g as ye,ga as Je,gd as yn,h as Z,ha as Ye,hd as Ae,i as Ie,id as hn,j as Ve,ja as Qe,jd as ze,k as he,kb as an,l as Ke,m as Ze,nb as sn,o as qe,p as fe,q as ve,sb as Se,ta as Xe,tb as dn,v as Be,x as pe,z as ke}from"./chunk.DHPXRDT5.js";var Tn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],q=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function xn(e,d=Tn){if(!q(e))return{document:e,respelled:[]};let n=[],t=e;for(let a of d)t=De(t,a.where.split("."),a,"",n);return{document:t,respelled:n}}function De(e,d,n,t,a){if(d.length===0){if(!q(e)||!Object.hasOwn(e,n.was))return e;a.push(`${t}${n.was}`);let{[n.was]:ie,...B}=e;return Object.hasOwn(e,n.now)?B:{...B,[n.now]:ie}}if(!q(e))return e;let[f,...E]=d,k=f.endsWith("[]"),O=k?f.slice(0,-2):f,G=e[O],X=G;if(!k)X=De(G,E,n,`${t}${O}.`,a);else if(Array.isArray(G)){let ie=G.map((B,T)=>De(B,E,n,`${t}${O}.${T}.`,a));X=ie.some((B,T)=>B!==G[T])?ie:G}return X===G?e:{...e,[O]:X}}var Rn=new WeakMap;function Sn(e,d){Rn.set(e,d)}function Zn(e){return Rn.get(e)}function An(e){if(typeof e=="string")return{form:"string",light:e};if(typeof e!="object"||e===null)return;let d=e,n=k=>typeof d[k]=="string"?d[k]:void 0,t=n("light")??n("src");if(t===void 0)return;let[a,f,E]=[n("dark"),n("alt"),n("darkFallback")];return{form:n("light")!==void 0?"light":"src",light:t,...a!==void 0?{dark:a}:{},...f!==void 0?{alt:f}:{},...E!==void 0?{darkFallback:E}:{}}}function Qn(e,d){let n=e.brand??{},t=n.ground,a=n.accent?ze(n.accent,t):void 0;t&&hn(a?.ok?a.schemes:Ae(t),n.accent)&&(d.push(je("brand","brand.ground","words would not read on that page background, so the app keeps Graview's","pick a lighter ground for the light scheme, a darker one for the dark")),t=void 0,a=n.accent?ze(n.accent):void 0),a&&!a.ok&&d.push(je("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${a.why}`,"pick a color further from orange-red, or a darker one"));let f=An(n.logo),E=n.name??e.name,k=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,O])=>typeof O=="string"&&yn(O)===null).map(([O,G])=>[O,gn(G)])):void 0;return{name:E,schemes:a?.ok?a.schemes:t?Ae(t):mn,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...n.timeZone?{timeZone:n.timeZone}:{},...f?{logo:f.dark||f.darkFallback==="invert"?{light:f.light,...f.dark?{dark:f.dark}:{darkFallback:"invert"}}:f.light,logoAlt:f.alt??E}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...n.subtitle===!1?{subtitleDrawn:!1}:{},...k?{typography:k}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{},...n.views&&(n.views.css||n.views.motion)?{views:{...n.views.css?{css:n.views.css}:{},...n.views.motion?{motion:n.views.motion}:{}}}:{}}}function zn(e){let{currency:d,locale:n,timeZone:t}=e.brand??{};return{...d?{currency:d}:{},...n?{locale:n}:{},...t?{timeZone:t}:{}}}var Gn=Symbol.for("@graview/core:typed-field"),En=(e,d)=>(/^(phone|place|duration)$/.test(d)&&(ue(e)[Gn]=d),e),jn=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;function Dn(e){let d=Z().check(K(300),ke(t=>nn(t,e)!==void 0,`a record of ${e.kinds.join(" or ")} in ${e.address}, as "<kind>:<id>"`)),n=e.cardinality==="one"?d:fe(d).check(K(200));return tn(e.description?n.check(be(e.description)):n,e)}var Ln="graview-compiled@1";function Fn(e,d){return e.find(([n,t])=>n!==Q&&"ref"in t&&(t.ref==="*"||t.ref.includes(d)))?.[0]}var Q="id",me=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function $n(e){let d=Object.entries(e.fields),n=t=>["name","title","label"].find(a=>t.some(([f])=>f===a))??t[0]?.[0];return n(d.filter(([,t])=>t.required&&(t.type==="string"||t.type==="text")))??n(d.filter(([,t])=>t.type==="string"))}function Pn(e,d,n){let t;switch(e.type){case"string":case"place":t=Z().check(K(500));break;case"phone":t=Z().check(K(40),ye(jn,"a phone number"));break;case"text":t=Z().check(K(2e4)),e.format&&(ue(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let f=e.min??(e.type==="duration"?0:void 0),E=[...e.type==="number"?[]:[Ke()],...f===void 0?[]:[Ne(f)],...e.max===void 0?[]:[Fe(e.max)],...e.step===void 0?[]:[Ce(e.step)]];t=E.length>0?he().check(...E):he();break}case"boolean":t=Ze();break;case"date":t=Z().check(ye(He,"a date like 2026-10-02, or a month (2016-05) or a year (2006) alone"));break;case"datetime":t=Z().check(ke(Ue,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=Be(e.options),e.multiple&&(t=fe(t).check(K(e.options.length)));break;case"list":t=fe(e.of==="number"?he():e.of==="date"?Z().check(ye(_e)):e.of==="image"||e.of==="video"||e.of==="file"?Oe(e.of):Z().check(K(500))).check(K(200));break;case"image":case"video":case"file":t=Oe(e.type);break;case"app-link":t=en();break;case"url":t=Ve();break;case"email":t=Ie();break}let a=e.type==="number"||e.type==="integer";return En(t,a&&e.format==="duration"?"duration":e.type),e.collaborative!==void 0&&(e.type==="text"||e.type==="string")&&(ue(t)[Symbol.for("@graview/core:collaborative")]=e.collaborative?1:0),e.description&&(t=t.check(be(e.description))),a&&(e.format==="money"||e.format==="percent"||!e.format&&e.unit)&&pn(t,{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{},...e.places===0?{places:0}:{}}),d?pe(t):t}var ge=e=>{throw new U(`there is no record "${e}"`,"invalid")},Nn=(e,d)=>"field"in e?Pn(e.field,e.optional,d):"ref"in e?un(e.ref):pe(qe()),Cn=new WeakMap;var Le=(e,d)=>q(d)&&Object.keys(e??{}).length===Object.keys(d).length&&Object.keys(e??{}).every(n=>Object.hasOwn(d,n));function xt(e,d={}){let n=q(e)?e.format:void 0;if(n!==Ln)return{ok:!1,findings:[Ee("compiled-format","format",n===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(n)}, and this build reads ${Ln}`,"compile the document instead")]};let t=e,a=xn(t.document).document,f=a===t.document?t:{...t,document:a},E=q(a)&&typeof a.name=="string"&&q(a.kinds)&&Le(a.kinds,f.kinds)&&Le(a.acts,f.acts)&&Le(a.rules,f.rules)&&Array.isArray(f.edges)&&Array.isArray(f.findings),k={ok:!1,findings:[Ee("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!E)return k;try{return In(f,d)}catch{return k}}function In(e,d={}){let{document:n}=e,t=n.brand?.timeZone,a=d.today??(()=>We(t)),f={...n.brand?.locale?{locale:n.brand.locale}:{},...t?{timeZone:t}:{}},E=new Map(e.edges.map(([p,i])=>[p,i])),k=new Map;for(let[p,i]of Object.entries(n.kinds)){let x=e.kinds[p]?.computed,w=Re(i.edges),j=new Map(Object.entries(i.fields).flatMap(([S,v])=>v.type==="enum"?[[S,v.optionLabels??{}]]:[]));k.set(p,{fields:new Set([...Object.keys(i.fields),...w.keys()]),edges:new Map(Object.entries(xe(i.edges)).map(([S,v])=>[S,v.cardinality??"many"])),...x?{computed:new Map(x)}:{},...w.size>0?{linked:w}:{},...j.size>0?{choices:j}:{}})}e.facts&&k.set(bn,{computed:new Map(e.facts)});let O=zn(n),G=p=>({from:p.from,via:p.via,sourceEnd:p.sourceEnd,back:p.back,values(i,x,w){let j={};for(let[S,v]of p.set)if("value"in v)j[S]=v.value;else try{let $=Y(v.expr,{graph:i,subject:x,kinds:k,bindings:{to:w},today:a(),...f});($===null||typeof $!="object"||Array.isArray($))&&(j[S]=$)}catch($){if(!($ instanceof oe))throw $}return j}}),X=new Map,ie=Object.entries(n.kinds).map(([p,i])=>{let x={};for(let[r,o]of Object.entries(i.fields))x[r]=Pn(o,!o.required,O),o.repeats&&(x[rn(r)]=pe(on()));for(let[r,o]of Re(i.edges))x[r]=pe(Dn(o));let{label:w,describe:j,durations:S}=e.kinds[p]??{},v=Object.entries(i.computed??{}).map(([r,o])=>[r,typeof o=="string"?{expr:o}:o]),$=Object.hasOwn(i.fields,"label")&&!i.fields.label.label&&!/\{\s*label\b/.test(i.label??`{${$n(i)??""}}`),ee=Object.fromEntries([...$?[["label","Label"]]:[],...Object.entries(i.fields).filter(([,r])=>r.label).map(([r,o])=>[r,o.label]),...v.filter(([,r])=>r.label).map(([r,o])=>[r,o.label])]),W=Object.keys(ee).length>0,L=Object.entries(i.fields).filter(([,r])=>r.type==="enum"&&(r.optionLabels&&Object.keys(r.optionLabels).length>0||r.multiple)),l=r=>o=>typeof o=="string"&&r.optionLabels&&Object.hasOwn(r.optionLabels,o)?r.optionLabels[o]:Ye(String(o)),M=Object.fromEntries(L.map(([r,o])=>[r,o.multiple?z=>Array.isArray(z)?z.map(l(o)).join(", "):l(o)(z):l(o)])),N=L.length>0,C=Object.fromEntries(Object.entries(i.fields).filter(([,r])=>r.default!==void 0).map(([r,o])=>[r,o.default]));X.set(p,C);let _=Object.fromEntries(Object.entries(xe(i.edges)).map(([r,{renamedFrom:o,...z}])=>[r,z])),I=Object.entries(i.fields).flatMap(([r,o])=>o.aliases?[[r,o.aliases]]:[]),P=r=>i[r]?{[r]:i[r]}:{};return Qe(p,{fields:ve(x),edges:_,...P("plural"),...P("noun"),...P("aliases"),...I.length>0?{fieldAliases:Object.fromEntries(I)}:{},...P("description"),...w?{label:r=>se(w,{node:r,kinds:k,today:a(),money:O})||r.id}:{},...j?{describe:r=>se(j,{node:r,kinds:k,today:a(),money:O})}:{},...P("lifecycle"),...P("figure"),...P("fieldRoles"),...P("people"),archives:i.archives,...i.tidying?{tidying:i.tidying}:{},...v.length>0?{computed:Object.fromEntries(v.map(([r,o])=>[r,Vn(o,S?.includes(r)??!1,O)??i.computed[r]]))}:{},...W||N||i.glance||i.page?{display:{...W?{labels:ee}:{},...N?{format:M}:{},...i.glance?{glance:[...i.glance]}:{},...i.page?{page:i.page}:{}}}:{},...Object.keys(C).length>0?{defaults:C}:{},...e.kinds[p]?.keptInStep?{keptInStep:e.kinds[p].keptInStep}:{},...e.kinds[p]?.derives?{derives:G(e.kinds[p].derives)}:{}})}),B=an(ie,n.computed);function T(p){return B.tryDefinition(p.kind)?.label?.(p)??p.id}let $e=p=>({id:"",kind:p,...X.get(p)}),Pe=[];for(let[p,i]of Object.entries(n.acts??{})){let x=e.acts[p],{title:w,effects:j,guard:S,refusal:v,destructive:$,idempotent:ee,creates:W,connects:L,severs:l,writes:M,writesOther:N,sets:C}=x,_={};for(let c of j)"through"in c&&(_[c.through]=[...new Set([..._[c.through]??[],...Object.keys(c.set)])]);let I=new Map(x.args),P={};for(let[c,A]of I)P[c]=Nn(A,O);let r=[i.on??[]].flat(),o=new Map(x.exprs),z=j.find(c=>"create"in c),J=(c,A,u,b=null)=>{if(q(c)&&"expr"in c)return Y(o.get(c.expr),{graph:u,subject:b,kinds:k,bindings:A,today:a(),...f});let h=me(c);return h===void 0?typeof c=="string"&&c.startsWith("$$")?c.slice(1):c:h==="now"?new Date().toISOString():h==="today"?a():A[h]},de=(c,A)=>{if(!z)return"";let u=n.kinds[z.create].fields,b=$e(z.create),h=[];for(let[R,ce]of Object.entries(z.set??{})){try{b[R]=J(ce,c,A)??b[R]}catch{}let ae=me(ce);ae&&c[ae]!==void 0&&h.push(R)}let V=T(b).trim(),ne=h.filter(R=>b[R]!==!1&&u[R].type!=="text"&&!(/[^]{41}/.test(b[R])||/ .*[.!?]$/.test(b[R])&&!/[ .][A-Z]\w{0,3}\.$/.test(b[R]))&&T({...b,[R]:void 0}).trim()===V).map(R=>b[R]===!0?u[R].label??Je(R):vn(b[R],u[R].format,a(),[],O));return V&&ne.length>0?`${V} (${ne.join(", ")})`:V};Pe.push(fn(p,{input:ve(P),title:w,...i.description?{description:i.description}:{},...i.fromTheOtherEnd?{fromTheOtherEnd:i.fromTheOtherEnd}:{},...I.has(Q)?{subject:{kinds:r.length>0?r:"*",arg:Q}}:{},...$?{destructive:!0}:{},...ee?{idempotent:!0}:{},...W.length>0?{creates:W}:{},...L.length>0?{connects:L}:{},...l.length>0?{severs:l}:{},writes:M,...Object.keys(N).length>0?{writesOther:N}:{},...Object.keys(_).length>0?{writesLinked:_}:{},...Object.keys(C).length>0?{sets:C}:{},...S?{allowedOn:(c,A)=>{let u=c.getNode(A);if(!u||r.length>0&&!r.includes(u.kind))return!1;try{return Y(S,{graph:c,subject:u,kinds:k,bindings:{},today:a(),...f})===!0}catch{return!1}}}:{},describe:(c,A)=>{let u=typeof c[Q]=="string"?A.getNode(c[Q]):void 0,b=u?T(u):de(c,A);return b?`${w}: ${b}`:w},apply(c,A){let u=c.graph,b=typeof A[Q]=="string"?A[Q]:void 0,h=b?u.getNode(b):void 0;if(b&&!h&&ge(b),h&&r.length>0&&!r.includes(h.kind))throw new U(`"${w}" acts on ${r.join(" or ")}, not on ${Xe(h.kind)}`,"invalid");let V={};for(let[s,m]of Object.entries(A))m!==void 0&&(V[s]=m);if(S&&h){let s;try{s=Y(S,{graph:u,subject:h,kinds:k,bindings:V,today:a(),...f})}catch(m){throw m instanceof oe?new U(`"${w}" could not be judged: ${m.sentence}`):m}if(s!==!0)throw new U(v?se(v,{node:h,kinds:k,graph:u,bindings:V,today:a(),money:O}):`"${w}" is not allowed for ${T(h)} right now`)}let ne=new Map,R=s=>u.has(s)||[...ne.values()].includes(s),ce=new Set,ae=s=>{let m=sn(s);ce.has(m)||(ce.add(m),c.removeEdge(s))},te=(s,m)=>{let g=me(s);if(g==="subject")return b;if(g==="me"){let y=c.me;if(y&&n.kinds[u.getNode(y)?.kind]?.people)return y;throw new U(`"${w}" is done as you, and you have no record here`)}if(ne.has(g))return ne.get(g);try{return J(s,V,u,m??h??null)}catch(y){throw y instanceof oe?new U(`"${w}" could not work out a value: ${y.sentence}`):y}};for(let s of j)if("create"in s){let m=n.kinds[s.create],g=$e(s.create);for(let[H,re]of Object.entries(s.set??{})){let Me=te(re,void 0);Me!==void 0&&(g[H]=Me)}let y=$n(m),D=String((y&&g[y])??s.create),le=ln(D,s.create,g,(H,re)=>cn(n.policy?.sees,H,re)),F=c.freshId(le?s.create:D,s.create,g);c.addNode({...g,id:F}),s.as&&ne.set(s.as,F)}else if("connect"in s||"sever"in s){let m="connect"in s?s.connect:s.sever,g=String(te(s.from,void 0)??""),y=String(te(s.to,void 0)??"");if(R(g)||ge(g),R(y)||ge(y),"connect"in s){if(E.get(m)?.cardinality==="one")for(let D of u.out(g,m))D.id!==y&&ae({kind:m,from:g,to:D.id});u.out(g,m).some(D=>D.id===y)||c.addEdge({kind:m,from:g,to:y})}else ae({kind:m,from:g,to:y})}else if("through"in s){if(!h)throw new U(`"${w}" carries a change to linked records, and has no record to start from`,"invalid");let g=E.get(s.through)?.from.includes(h.kind)??!0?u.out(h.id,s.through):u.in(h.id,s.through);for(let y of g){let D={};for(let[le,F]of Object.entries(s.set)){let H;if(me(F)==="to")H=y.id;else if(q(F)&&"expr"in F)try{H=Y(o.get(F.expr),{graph:u,subject:h,kinds:k,bindings:{...V,to:y},today:a(),...f})}catch(re){throw re instanceof oe?new U(`"${w}" could not work out a value for ${T(y)}: ${re.sentence}`):re}else H=te(F,void 0);H!==void 0&&(D[le]=H)}Object.keys(D).length>0&&c.patchNode(y.id,D)}}else if("set"in s){let m=String(te(s.target??"$subject",void 0)??""),g=u.getNode(m);!g&&!R(m)&&ge(m);let y={};for(let[D,le]of Object.entries(s.set)){let F=te(le,g);F!==void 0&&(y[D]=F)}Object.keys(y).length>0&&c.patchNode(m,y)}else if("remove"in s){let m=String(te(s.remove,void 0)??"");u.has(m)||ge(m),c.removeNode(m)}else if("replace"in s&&h){let m=A.to;for(let g of s.replace){let y=E.get(g)?.from.includes(h.kind)??!0;for(let D of y?u.out(h.id,g):u.in(h.id,g))g===s.keep&&D.id===m||ae(y?{kind:g,from:h.id,to:D.id}:{kind:g,from:D.id,to:h.id})}}}}))}let Te=[];for(let[p,i]of Object.entries(n.rules??{})){let{title:x,require:w,when:j,says:S,covers:v}=e.rules[p],$=i.repairs??[],ee=(L,l,M=a(),N)=>{let C=[],_={graph:L,subject:l,kinds:k,today:M,...f,...N?{linked:N}:{},onUnread:o=>C.push(o)},I,P=[];try{if(j&&Y(j,_)!==!0)return[];if(v&&l?(P=On(L,l,v),I=P.length===0):I=Y(w,_)===!0,!I&&C.length>0)throw new oe(`it reads ${kn(C[0])}`,0)}catch(o){throw o instanceof wn?new dn(o.sentence):o instanceof oe?new Error(o.sentence):o}if(I)return[];let r=$.flatMap(o=>{let z=n.acts?.[o.act],J={},de=l&&z?.on&&z.fromTheOtherEnd&&![z.on].flat().includes(l.kind)?Fn(e.acts[o.act].args,l.kind):void 0;de?J[de]=l.id:l&&(z?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(o.act))&&(J[Q]=l.id);for(let[u,b]of Object.entries(o.args??{}))J[u]=me(b)==="subject"?l?.id:b;let A=(z?e.acts[o.act].args:[]).filter(([u,b])=>b.required&&J[u]===void 0).map(([u])=>u);return[{mutation:o.act,label:o.label??(de?z.fromTheOtherEnd:z?.title)??o.act.replace(/-/g," "),args:J,...A.length>0?{missing:A}:{}}]});return v&&l?P.map(o=>({invariant:p,subjectId:l.id,label:x,message:S?se(S,{node:l,kinds:k,graph:L,today:M,money:O,bindings:{[l.kind]:l,[o.kind]:o}}):`${T(l)}: ${x} \u2014 ${T(o)}`,nodeIds:[l.id,o.id],repairs:r})):[{invariant:p,...l?{subjectId:l.id}:{},label:x,message:S?se(S,{node:l,kinds:k,graph:L,today:M,money:O}):l?`${T(l)}: ${x}`:x,nodeIds:l?[l.id]:[],repairs:r}]},W={label:x,shape:{over:i.over,require:w,...v?{covers:v}:{},when:j,says:S,declared:n.kinds,money:O,kinds:k,today:a},judgment:{...i.require?{require:i.require}:{},...i.covers?{covers:i.covers}:{},...i.when?{when:i.when}:{},...i.says?{says:i.says}:{}},...i.description?{description:i.description}:{},...$.length>0?{repairs:$.map(L=>L.act)}:{}};Te.push(i.over==="graph"?Se(p,{scope:"graph",...W,evaluate:({graph:L,today:l,context:M})=>ee(L,null,l,M?.linked)}):Se(p,{scope:{kind:i.over},...W,evaluate:({graph:L,subject:l,today:M,context:N})=>ee(L,l,M,N?.linked)}))}let Ge=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},we={name:n.name,schema:B,mutations:Pe,invariants:Te,...Ge?{policy:Ge}:{},...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}:{},...n.forms?{forms:n.forms}:{},...n.publishing?{publishing:n.publishing}:{},...n.tidying?{tidying:n.tidying}:{},...n.purpose?{purpose:n.purpose}:{},...e.viewSpecs?{viewSpecs:e.viewSpecs}:{},...e.home?{home:e.home}:{},version:n.version??1};return Sn(we,n),Cn.set(we,e),{ok:!0,app:we,document:n,findings:e.findings,sights:n.policy?.sees,kinds:k}}function Vn(e,d,n){let t=d||e.format==="duration",a=e.format==="money"||e.format==="percent"||!e.format&&e.unit!==void 0;if(!(!t&&!a))return{...e,...t?{as:"duration"}:{},...a?{amount:{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{},...e.places===0?{places:0}:{}}}:{}}}export{q as a,xn as b,Zn as c,Qn as d,Ln as e,Q as f,me as g,$n as h,xt as i,In as j};
@@ -1 +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{l as C}from"./chunk.RD2FSSLV.js";import{j as T}from"./chunk.QUETLFBJ.js";import{G as b,Oa as Y,W as R,c as K,ea as v,fa as z,ga as q,x as $}from"./chunk.3VEZ5MOC.js";import{C as L,Qb as j,Zb as B,fc as H,od as G,pd as U,qc as I,yb as W}from"./chunk.6AANHELP.js";import{b as m}from"./chunk.AJZBJBMO.js";function Q(e,n,t={}){let o=e.graph.getNode(n);if(!o)return[];let i=t.principal?new Set(e.permittedMutations(t.principal).map(s=>s.name)):void 0,c=o.kind,p=e.schema.tryDefinition(c);if(!p)return[];let r=e.seenFor,a=r?j.keptFrom?.(e,r)?.(o):void 0,d=new Map;for(let s of e.allMutations()){let l=s.subject;if(!l||!(l.kinds==="*"||l.kinds.includes(c))||i&&!i.has(s.name))continue;let h=s.input.shape??{};for(let u of I(s,p)){if(a?.(u)||!B(s,e.schema,e.graph,n,u,r&&W(r).id))continue;let M=u in h,_=[];for(let g of Object.keys(h)){if(g===l.arg||g===u||ie(h[g]))continue;let S=H(s.input).find(E=>E.name===g);_.push({name:g,...S?{kinds:S.kinds}:{},...S?{candidates:S.kinds.includes("*")?e.graph.allNodes().map(E=>E.id):S.kinds.flatMap(E=>e.graph.nodesOfKind(E).map(oe=>oe.id))}:{},shape:T(s.input,g)})}let re={field:u,mutation:s.name,title:s.title??s.name,shape:M?T(s.input,u):{type:"unknown"},takesValue:M,alternatives:[],open:_,clearable:M&&(s.clearable?.includes(u)??!1),call:g=>({name:s.name,args:M?{[l.arg]:n,[u]:g}:{[l.arg]:n}})};d.set(u,[...d.get(u)??[],re])}}return[...d.values()].map(s=>{let l=[...s.filter(u=>u.takesValue),...s.filter(u=>!u.takesValue)],[w,...h]=l;return{...w,alternatives:h}})}function ie(e){let n=L(e)?.type;return n==="optional"||n==="default"||n==="nullable"}var O=m(b(),1);function Oe(e){let{store:n,principal:t}=v(),o=q(),i=(0,O.useMemo)(()=>e===null?[]:Q(n,e,{principal:t}),[n,e,o,t]),c=(0,O.useCallback)((p,r,a={})=>{let d=p.call(r);n.apply({name:d.name,args:{...d.args,...a}},{author:t})},[n,t]);return{fields:i,commit:c}}var J=m(b(),1);function ln(){let{brand:e}=v(),n=e?.kit;return(0,J.useMemo)(()=>G(n),[n])}function un(e,n){let t=U(e,n),o={...t.color!==void 0?{color:t.color}:{},...t.pattern!==void 0?{pattern:t.pattern}:{},...t.width!==void 0?{width:t.width}:{},...t.cap!==void 0?{cap:t.cap}:{},...t.opacity!==void 0?{opacity:t.opacity}:{}};return{connector:t,style:C(n,{[n]:o})}}var Z=m(b(),1);var x=m(R(),1);function ae(e){let n=e?.hint;return typeof n=="string"&&n.length>0?n:void 0}function se(e){if(e instanceof Error&&e.message)return e.message;let n=String(e);return n==="[object Object]"?"The view threw without a message.":n}var X=class extends Z.Component{static contextType=Y;state={};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,t){console.error(`[graview] the ${this.props.view??"view"} of ${this.props.kind} threw while rendering`,n,t.componentStack),this.context?.(n,{module:"@graview/react"})}render(){let{error:n}=this.state;if(!n)return this.props.children;let t=ae(n);return(0,x.jsxs)("div",{role:"alert","data-graview-view-error":this.props.kind,style:{display:"flex",flexDirection:"column",gap:"0.375rem",padding:"var(--graview-pad, 12px)",height:"100%",overflow:"auto",boxSizing:"border-box",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)",font:"var(--graview-font-body, 13px/1.45 system-ui)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,x.jsx)("strong",{style:{color:"var(--graview-warn, #b4462a)"},children:this.props.view?`${this.props.view} could not draw`:"This view could not draw"}),(0,x.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:this.props.kind}),(0,x.jsx)("span",{children:se(n)}),t?(0,x.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:t}):null]})}};var y=m(b(),1);var ne=m(R(),1),D=(0,y.createContext)([]);function gn({sections:e,children:n}){let t=(0,y.useContext)(D),o=(0,y.useMemo)(()=>[...t,...e.filter(i=>!t.includes(i))],[t,e]);return(0,ne.jsx)(D.Provider,{value:o,children:n})}function ee(){let e=(0,y.useContext)(D),n=z()?.menuSections;return(0,y.useMemo)(()=>n?[...e,...n.filter(t=>!e.includes(t))]:e,[e,n])}function hn(){let e=ee();return(0,y.useCallback)(n=>{for(let t of e)try{t(n)?.prepare?.()}catch{}},[e])}function xn(e){let n=ee();if(e===null||n.length===0)return{start:[],end:[]};let t=n.flatMap(o=>{try{let i=o(e);return i&&((i.items?.length??0)>0||i.render||i.mode)?[i]:[]}catch{return[]}});return{start:t.filter(o=>o.at==="start"),end:t.filter(o=>o.at!=="start")}}var V=new WeakMap;function bn(e,n){n?V.set(e,n):V.delete(e)}function vn(e){return e?V.get(e):void 0}var k,de,N=new Set;function Sn(e){N.add(e)}function En(){return de??=Promise.all([(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.Y7QDQ3WF.js")),...[...N].map(e=>e())]).then(([e])=>void(k=e.sectionUnder))}function kn(e){return e&&k?k(e):void 0}var Pn=()=>k===void 0&&N.size>0,Mn=e=>k===void 0&&e?.getRootNode()?.host?.hasAttribute("data-worker-view")===!0;var ce=m(b(),1);function An(){return v().activity}var A=(e,n)=>e.length*n*.58;var le=156,ue=2,P=le-18,pe=7.1,fe=16;function me(e,n){let t=0,o=P;for(let i of e.split(" ")){let c=n(i),p=o+n(" ")+c;if(p<=P)o=p;else{let r=Math.ceil(c/P)||1;t+=r,o=c-(r-1)*P}}return t}var ye=16.25,te=27,ge=(e,n)=>{let t=Math.ceil(e.length*pe/P);return n?Math.max(te,Math.ceil(Math.max(t,me(e,n))*ye)+6):Math.max(te,t*fe+6)};function Dn(e,n,t){return e.length===0?0:10+e.reduce((o,i)=>o+ge(i,t),0)+(e.length-1)*ue}var he=27,xe=8,Vn=4,we=64,Nn=e=>Math.max(1,Math.min(xe,e)),Fn=e=>e*he+we;var f=m(b(),1);function jn(e,{units:n,target:t=0,legibleAt:o=260}){let[i,c]=(0,f.useState)(n);(0,f.useEffect)(()=>{let r=e.current;if(r===null||typeof ResizeObserver>"u")return;let a=new ResizeObserver(([d])=>{let s=d?.contentRect.width??0;s>0&&c(s)});return a.observe(r),()=>a.disconnect()},[e]);let p=i/n;return{scale:p,width:i,touchable:p*t>=24,legible:i>=o}}function Bn(e="--graview-font-body",n="sans-serif"){let t=(0,f.useRef)(void 0),o=(0,f.useMemo)(()=>{if(typeof getComputedStyle!="function"||typeof document>"u")return n;let i=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return i.length>0?i:n},[e,n]);return(0,f.useMemo)(()=>{t.current===void 0&&(t.current=typeof document>"u"?null:document.createElement("canvas").getContext("2d")??null);let i=t.current;return i===null?A:(c,p)=>{i.font=`${p}px ${o}`;let r=i.measureText(c).width;return r>0?r:A(c,p)}},[o])}var Hn=(0,f.createContext)(void 0);var F=3;function be(e){let n=K(e),t=n.focusId;if(!t)return null;if(n.within?.view){let[i]=$(t);if(i)return{at:`screen:${i}`,audience:!0}}return{at:t,audience:!1}}var ve=102,Se=32;function Un(e,n,t){let o=[],i=new Map,c=new Map,p=0;for(let r of e){let a=be(r.stop),d=a?n(a.at):null;if(!a||!d){r.name&&o.push({kind:"edge",presence:r,point:{x:t-8,y:ve+p++*Se}});continue}if(!r.name){let u=c.get(a.at);c.set(a.at,{n:(u?.n??0)+1,box:d});continue}let s=i.get(a.at)??[];if(s.push(r),i.set(a.at,s),s.length>F)continue;let l=d,w=s.length-1,h=a.audience?{x:l.x+l.width*.5+(w-1)*26,y:l.y+Math.min(l.height,24)}:{x:l.x+l.width*.5-26-w*26,y:l.y+l.height-4};o.push({kind:"person",presence:r,point:h,at:a.at,index:w,of:s.length,audience:a.audience})}for(let[r,a]of i){if(a.length<=F)continue;let d=n(r);d&&o.push({kind:"count",at:r,point:{x:d.x+d.width*.5+2*26+18,y:d.y+d.height-4},n:a.length-F})}for(let[r,{n:a,box:d}]of c)o.push({kind:"count",at:r,point:{x:d.x+d.width*.5+40,y:d.y+d.height-4},n:a});for(let r of e)if(r.name){if(r.robot?.at&&r.robot.mode!=="docked"){let a=n(r.robot.at);a&&o.push({kind:"robot",presence:r,point:{x:a.x+a.width/2+22,y:a.y+a.height-4},mode:r.robot.mode})}if(r.over){let a=n(r.over);a&&o.push({kind:"over",presence:r,box:a})}}return o}export{An as a,A as b,le as c,ue as d,te as e,Dn as f,he as g,Vn as h,we as i,Nn as j,Fn as k,jn as l,Bn as m,Q as n,Oe as o,ln as p,un as q,Un as r,X as s,gn as t,hn as u,xn as v,bn as w,vn as x,Sn as y,En as z,kn as A,Pn as B,Mn as C};
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{l as C}from"./chunk.RD2FSSLV.js";import{j as T}from"./chunk.P26ATAAI.js";import{G as b,Oa as Y,W as R,c as K,ea as v,fa as z,ga as q,x as $}from"./chunk.FWXW4T4I.js";import{C as L,Qb as j,Zb as B,fc as H,od as G,pd as U,qc as I,yb as W}from"./chunk.DHPXRDT5.js";import{b as m}from"./chunk.AJZBJBMO.js";function Q(e,n,t={}){let o=e.graph.getNode(n);if(!o)return[];let i=t.principal?new Set(e.permittedMutations(t.principal).map(s=>s.name)):void 0,c=o.kind,p=e.schema.tryDefinition(c);if(!p)return[];let r=e.seenFor,a=r?j.keptFrom?.(e,r)?.(o):void 0,d=new Map;for(let s of e.allMutations()){let l=s.subject;if(!l||!(l.kinds==="*"||l.kinds.includes(c))||i&&!i.has(s.name))continue;let h=s.input.shape??{};for(let u of I(s,p)){if(a?.(u)||!B(s,e.schema,e.graph,n,u,r&&W(r).id))continue;let M=u in h,_=[];for(let g of Object.keys(h)){if(g===l.arg||g===u||ie(h[g]))continue;let S=H(s.input).find(E=>E.name===g);_.push({name:g,...S?{kinds:S.kinds}:{},...S?{candidates:S.kinds.includes("*")?e.graph.allNodes().map(E=>E.id):S.kinds.flatMap(E=>e.graph.nodesOfKind(E).map(oe=>oe.id))}:{},shape:T(s.input,g)})}let re={field:u,mutation:s.name,title:s.title??s.name,shape:M?T(s.input,u):{type:"unknown"},takesValue:M,alternatives:[],open:_,clearable:M&&(s.clearable?.includes(u)??!1),call:g=>({name:s.name,args:M?{[l.arg]:n,[u]:g}:{[l.arg]:n}})};d.set(u,[...d.get(u)??[],re])}}return[...d.values()].map(s=>{let l=[...s.filter(u=>u.takesValue),...s.filter(u=>!u.takesValue)],[w,...h]=l;return{...w,alternatives:h}})}function ie(e){let n=L(e)?.type;return n==="optional"||n==="default"||n==="nullable"}var O=m(b(),1);function Oe(e){let{store:n,principal:t}=v(),o=q(),i=(0,O.useMemo)(()=>e===null?[]:Q(n,e,{principal:t}),[n,e,o,t]),c=(0,O.useCallback)((p,r,a={})=>{let d=p.call(r);n.apply({name:d.name,args:{...d.args,...a}},{author:t})},[n,t]);return{fields:i,commit:c}}var J=m(b(),1);function ln(){let{brand:e}=v(),n=e?.kit;return(0,J.useMemo)(()=>G(n),[n])}function un(e,n){let t=U(e,n),o={...t.color!==void 0?{color:t.color}:{},...t.pattern!==void 0?{pattern:t.pattern}:{},...t.width!==void 0?{width:t.width}:{},...t.cap!==void 0?{cap:t.cap}:{},...t.opacity!==void 0?{opacity:t.opacity}:{}};return{connector:t,style:C(n,{[n]:o})}}var Z=m(b(),1);var x=m(R(),1);function ae(e){let n=e?.hint;return typeof n=="string"&&n.length>0?n:void 0}function se(e){if(e instanceof Error&&e.message)return e.message;let n=String(e);return n==="[object Object]"?"The view threw without a message.":n}var X=class extends Z.Component{static contextType=Y;state={};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,t){console.error(`[graview] the ${this.props.view??"view"} of ${this.props.kind} threw while rendering`,n,t.componentStack),this.context?.(n,{module:"@graview/react"})}render(){let{error:n}=this.state;if(!n)return this.props.children;let t=ae(n);return(0,x.jsxs)("div",{role:"alert","data-graview-view-error":this.props.kind,style:{display:"flex",flexDirection:"column",gap:"0.375rem",padding:"var(--graview-pad, 12px)",height:"100%",overflow:"auto",boxSizing:"border-box",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)",font:"var(--graview-font-body, 13px/1.45 system-ui)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,x.jsx)("strong",{style:{color:"var(--graview-warn, #b4462a)"},children:this.props.view?`${this.props.view} could not draw`:"This view could not draw"}),(0,x.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:this.props.kind}),(0,x.jsx)("span",{children:se(n)}),t?(0,x.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:t}):null]})}};var y=m(b(),1);var ne=m(R(),1),D=(0,y.createContext)([]);function gn({sections:e,children:n}){let t=(0,y.useContext)(D),o=(0,y.useMemo)(()=>[...t,...e.filter(i=>!t.includes(i))],[t,e]);return(0,ne.jsx)(D.Provider,{value:o,children:n})}function ee(){let e=(0,y.useContext)(D),n=z()?.menuSections;return(0,y.useMemo)(()=>n?[...e,...n.filter(t=>!e.includes(t))]:e,[e,n])}function hn(){let e=ee();return(0,y.useCallback)(n=>{for(let t of e)try{t(n)?.prepare?.()}catch{}},[e])}function xn(e){let n=ee();if(e===null||n.length===0)return{start:[],end:[]};let t=n.flatMap(o=>{try{let i=o(e);return i&&((i.items?.length??0)>0||i.render||i.mode)?[i]:[]}catch{return[]}});return{start:t.filter(o=>o.at==="start"),end:t.filter(o=>o.at!=="start")}}var V=new WeakMap;function bn(e,n){n?V.set(e,n):V.delete(e)}function vn(e){return e?V.get(e):void 0}var k,de,N=new Set;function Sn(e){N.add(e)}function En(){return de??=Promise.all([(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.Y7QDQ3WF.js")),...[...N].map(e=>e())]).then(([e])=>void(k=e.sectionUnder))}function kn(e){return e&&k?k(e):void 0}var Pn=()=>k===void 0&&N.size>0,Mn=e=>k===void 0&&e?.getRootNode()?.host?.hasAttribute("data-worker-view")===!0;var ce=m(b(),1);function An(){return v().activity}var A=(e,n)=>e.length*n*.58;var le=156,ue=2,P=le-18,pe=7.1,fe=16;function me(e,n){let t=0,o=P;for(let i of e.split(" ")){let c=n(i),p=o+n(" ")+c;if(p<=P)o=p;else{let r=Math.ceil(c/P)||1;t+=r,o=c-(r-1)*P}}return t}var ye=16.25,te=27,ge=(e,n)=>{let t=Math.ceil(e.length*pe/P);return n?Math.max(te,Math.ceil(Math.max(t,me(e,n))*ye)+6):Math.max(te,t*fe+6)};function Dn(e,n,t){return e.length===0?0:10+e.reduce((o,i)=>o+ge(i,t),0)+(e.length-1)*ue}var he=27,xe=8,Vn=4,we=64,Nn=e=>Math.max(1,Math.min(xe,e)),Fn=e=>e*he+we;var f=m(b(),1);function jn(e,{units:n,target:t=0,legibleAt:o=260}){let[i,c]=(0,f.useState)(n);(0,f.useEffect)(()=>{let r=e.current;if(r===null||typeof ResizeObserver>"u")return;let a=new ResizeObserver(([d])=>{let s=d?.contentRect.width??0;s>0&&c(s)});return a.observe(r),()=>a.disconnect()},[e]);let p=i/n;return{scale:p,width:i,touchable:p*t>=24,legible:i>=o}}function Bn(e="--graview-font-body",n="sans-serif"){let t=(0,f.useRef)(void 0),o=(0,f.useMemo)(()=>{if(typeof getComputedStyle!="function"||typeof document>"u")return n;let i=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return i.length>0?i:n},[e,n]);return(0,f.useMemo)(()=>{t.current===void 0&&(t.current=typeof document>"u"?null:document.createElement("canvas").getContext("2d")??null);let i=t.current;return i===null?A:(c,p)=>{i.font=`${p}px ${o}`;let r=i.measureText(c).width;return r>0?r:A(c,p)}},[o])}var Hn=(0,f.createContext)(void 0);var F=3;function be(e){let n=K(e),t=n.focusId;if(!t)return null;if(n.within?.view){let[i]=$(t);if(i)return{at:`screen:${i}`,audience:!0}}return{at:t,audience:!1}}var ve=102,Se=32;function Un(e,n,t){let o=[],i=new Map,c=new Map,p=0;for(let r of e){let a=be(r.stop),d=a?n(a.at):null;if(!a||!d){r.name&&o.push({kind:"edge",presence:r,point:{x:t-8,y:ve+p++*Se}});continue}if(!r.name){let u=c.get(a.at);c.set(a.at,{n:(u?.n??0)+1,box:d});continue}let s=i.get(a.at)??[];if(s.push(r),i.set(a.at,s),s.length>F)continue;let l=d,w=s.length-1,h=a.audience?{x:l.x+l.width*.5+(w-1)*26,y:l.y+Math.min(l.height,24)}:{x:l.x+l.width*.5-26-w*26,y:l.y+l.height-4};o.push({kind:"person",presence:r,point:h,at:a.at,index:w,of:s.length,audience:a.audience})}for(let[r,a]of i){if(a.length<=F)continue;let d=n(r);d&&o.push({kind:"count",at:r,point:{x:d.x+d.width*.5+2*26+18,y:d.y+d.height-4},n:a.length-F})}for(let[r,{n:a,box:d}]of c)o.push({kind:"count",at:r,point:{x:d.x+d.width*.5+40,y:d.y+d.height-4},n:a});for(let r of e)if(r.name){if(r.robot?.at&&r.robot.mode!=="docked"){let a=n(r.robot.at);a&&o.push({kind:"robot",presence:r,point:{x:a.x+a.width/2+22,y:a.y+a.height-4},mode:r.robot.mode})}if(r.over){let a=n(r.over);a&&o.push({kind:"over",presence:r,box:a})}}return o}export{An as a,A as b,le as c,ue as d,te as e,Dn as f,he as g,Vn as h,we as i,Nn as j,Fn as k,jn as l,Bn as m,Q as n,Oe as o,ln as p,un as q,Un as r,X as s,gn as t,hn as u,xn as v,bn as w,vn as x,Sn as y,En as z,kn as A,Pn as B,Mn as C};
@@ -0,0 +1 @@
1
+ import{a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as k,j as l,k as m,l as n,m as o,n as p}from"./chunk.LMZ2WMGH.js";import{a,b}from"./chunk.OD5QZHRC.js";import"./chunk.YJ4PFOPC.js";import"./chunk.LKM2R5UF.js";import"./chunk.MH3AQO2R.js";import"./chunk.J2N7EKMX.js";import"./chunk.P26ATAAI.js";import"./chunk.FIY4RUK5.js";import"./chunk.IY3DV52G.js";import"./chunk.NLZHNPDU.js";import"./chunk.QNC2OKLF.js";import"./chunk.FWXW4T4I.js";import"./chunk.SDO3U72B.js";import"./chunk.DHPXRDT5.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{j as ARRANGE_NARROW,o as ArrangeBar,e as CHIP_FIELDS,d as MANY_AT_THE_FAR_END,c as TYPED_FROM,p as arrangementCaption,a as arrangementOf,i as chipOffers,m as directionWords,g as farCount,f as farCounts,l as inSentence,h as offeredFilters,n as preloadArrangeLists,k as sayCondition,b as withArrangement};
@@ -1,4 +1,4 @@
1
- import{a as Ct,b as Lt,c as Ce,d as Dt,h as kt,i as ae,j as Ft,k as Tt}from"./chunk.7WPVLEX2.js";import{a as yt}from"./chunk.LFFJB6D3.js";import{d as vt}from"./chunk.QUETLFBJ.js";import{c as gt}from"./chunk.JULD4XFB.js";import{B as Et,I as xt,J as Pt,i as mt,j as pt,u as wt,v as Rt,y as St,z as bt}from"./chunk.H3IGXHZR.js";import{c as Mr}from"./chunk.7TDML5YU.js";import{G as M,P as dt,R as ft,W as Z,fa as ht}from"./chunk.3VEZ5MOC.js";import{$c as rt,$d as lt,Zd as ot,_d as it,dd as at,eb as tt,pa as de,pe as st,qe as ut,re as ct,sd as nt}from"./chunk.6AANHELP.js";import{b as D}from"./chunk.AJZBJBMO.js";function Or(e,t){return ot(e,t).slice(1)}function fe(e,t){return e.kinds.find(r=>Or(e,r)===t)}function Nn(e,t,r){return it(e,t,r)}function Mn(e,t){return lt(e,t)}var _=D(M(),1),g=D(M(),1),x=D(M(),1),Ye=D(M(),1),hr=D(M(),1),S=D(M(),1),rn=D(M(),1),an=D(M(),1),nn=D(M(),1),v=D(M(),1),Pr=D(M(),1);var Oe=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Ut=/^[\\/]{2}/;function Ar(e,t){return t+e.replace(/\\/g,"/")}var Nt="popstate";function ge(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function jt(e={}){let{initialEntries:t=["/"],initialIndex:r,v5Compat:a=!1}=e,n;n=t.map((h,y)=>c(h,typeof h=="string"?null:h.state,y===0?"default":void 0,typeof h=="string"?void 0:h.mask));let o=s(r??n.length-1),i="POP",l=null;function s(h){return Math.min(Math.max(h,0),n.length-1)}function u(){return n[o]}function c(h,y=null,p,f){let w=ve(n?u().pathname:"/",h,y,p,f);return O(w.pathname.charAt(0)==="/",`relative pathnames are not supported in memory history: ${JSON.stringify(h)}`),w}function d(h){return typeof h=="string"?h:B(h)}return{get index(){return o},get action(){return i},get location(){return u()},createHref:d,createURL(h){return new URL(d(h),"http://localhost")},encodeLocation(h){let y=typeof h=="string"?Y(h):h;return{pathname:y.pathname||"",search:y.search||"",hash:y.hash||""}},push(h,y){i="PUSH";let p=ge(h)?h:c(h,y);o+=1,n.splice(o,n.length,p),a&&l&&l({action:i,location:p,delta:1})},replace(h,y){i="REPLACE";let p=ge(h)?h:c(h,y);n[o]=p,a&&l&&l({action:i,location:p,delta:0})},go(h){i="POP";let y=s(o+h),p=n[y];o=y,l&&l({action:i,location:p,delta:h})},listen(h){return l=h,()=>{l=null}}}}function zt(e={}){function t(a,n){let o=n.state?.masked,{pathname:i,search:l,hash:s}=o||a.location;return ve("",{pathname:i,search:l,hash:s},n.state&&n.state.usr||null,n.state&&n.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,n){return typeof n=="string"?n:B(n)}return $r(t,r,null,e)}function L(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function O(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function _r(){return Math.random().toString(36).substring(2,10)}function Mt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ve(e,t,r=null,a,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Y(t):t,state:r,key:t&&t.key||a||_r(),mask:n}}function B({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Y(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function $r(e,t,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,l="POP",s=null,u=c();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function c(){return(i.state||{idx:null}).idx}function d(){l="POP";let f=c(),w=f==null?null:f-u;u=f,s&&s({action:l,location:p.location,delta:w})}function m(f,w){l="PUSH";let R=ge(f)?f:ve(p.location,f,w);r&&r(R,f),u=c()+1;let b=Mt(R,u),P=p.createHref(R.mask||R);try{i.pushState(b,"",P)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;n.location.assign(P)}o&&s&&s({action:l,location:p.location,delta:1})}function h(f,w){l="REPLACE";let R=ge(f)?f:ve(p.location,f,w);r&&r(R,f),u=c();let b=Mt(R,u),P=p.createHref(R.mask||R);i.replaceState(b,"",P),o&&s&&s({action:l,location:p.location,delta:0})}function y(f){return Ir(n,f)}let p={get action(){return l},get location(){return e(n,i)},listen(f){if(s)throw new Error("A history only accepts one active listener");return n.addEventListener(Nt,d),s=f,()=>{n.removeEventListener(Nt,d),s=null}},createHref(f){return t(n,f)},createURL:y,encodeLocation(f){let w=y(f);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:m,replace:h,go(f){return i.go(f)}};return p}function Ir(e,t,r=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),L(a,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:B(t);return n=n.replace(/ $/,"%20"),!r&&Ut.test(n)&&(n=a+n),new URL(n,a)}var Hr;Hr=new WeakMap;function Ae(e,t,r="/"){return Ur(e,t,r,!1)}function Ur(e,t,r,a,n){let o=typeof t=="string"?Y(t):t,i=U(o.pathname||"/",r);if(i==null)return null;let l=n??zr(e),s=null,u=Zr(i);for(let c=0;s==null&&c<l.length;++c)s=qr(l[c],u,a);return s}function jr(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function zr(e){let t=Bt(e);return Br(t),t}function Bt(e,t=[],r=[],a="",n=!1){let o=(i,l,s=n,u)=>{let c={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(c.relativePath.startsWith("/")){if(!c.relativePath.startsWith(a)&&s)return;L(c.relativePath.startsWith(a),`Absolute route path "${c.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(a.length)}let d=H([a,c.relativePath]),m=r.concat(c);i.children&&i.children.length>0&&(L(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),Bt(i.children,t,m,d,s)),!(i.path==null&&!i.index)&&t.push({path:d,score:Xr(d,i.index),routesMeta:m.map((h,y)=>{let[p,f]=Vt(h.relativePath,h.caseSensitive,y===m.length-1);return{...h,matcher:p,compiledParams:f}})})};return e.forEach((i,l)=>{if(i.path===""||!i.path?.includes("?"))o(i,l);else for(let s of Wt(i.path))o(i,l,!0,s)}),t}function Wt(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=Wt(a.join("/")),l=[];return l.push(...i.map(s=>s===""?o:[o,s].join("/"))),n&&l.push(...i),l.map(s=>e.startsWith("/")&&s===""?"/":s)}function Br(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Qr(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Wr=/^:[\w-]+$/,Yr=3,Vr=2,Jr=1,Kr=10,Gr=-2,Ot=e=>e==="*";function Xr(e,t){let r=e.split("/"),a=r.length;return r.some(Ot)&&(a+=Gr),t&&(a+=Vr),r.filter(n=>!Ot(n)).reduce((n,o)=>n+(Wr.test(o)?Yr:o===""?Jr:Kr),a)}function Qr(e,t){return e.length===t.length&&e.slice(0,-1).every((a,n)=>a===t[n])?e[e.length-1]-t[t.length-1]:0}function qr(e,t,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let l=0;l<a.length;++l){let s=a[l],u=l===a.length-1,c=o==="/"?t:t.slice(o.length)||"/",d={path:s.relativePath,caseSensitive:s.caseSensitive,end:u},m=s.matcher&&s.compiledParams?Yt(d,c,s.matcher,s.compiledParams):oe(d,c),h=s.route;if(!m&&u&&r&&!a[a.length-1].route.index&&(m=oe({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},c)),!m)return null;Object.assign(n,m.params),i.push({params:n,pathname:H([o,m.pathname]),pathnameBase:ta(H([o,m.pathnameBase])),route:h}),m.pathnameBase!=="/"&&(o=H([o,m.pathnameBase]))}return i}function oe(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Vt(e.path,e.caseSensitive,e.end);return Yt(e,t,r,a)}function Yt(e,t,r,a){let n=t.match(r);if(!n)return null;let o=n[0],i=ee(o,1),l=n.slice(1);return{params:a.reduce((u,{paramName:c,isOptional:d},m)=>{if(c==="*"){let y=l[m]||"";i=ee(o.slice(0,o.length-y.length),1)}let h=l[m];return d&&!h?u[c]=void 0:u[c]=(h||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function Vt(e,t=!1,r=!0){O(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,s,u,c)=>{if(a.push({paramName:l,isOptional:s!=null}),s){let d=c.charAt(u+i.length);return d&&d!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),a]}function Zr(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return O(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function U(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function Jt(e,t="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?Y(e):e,o;return r?(r=Kt(r),r.startsWith("/")||r.startsWith("\\")?o=At(r.substring(1),"/"):o=At(r,t)):o=t,{pathname:o,search:ra(a),hash:aa(n)}}function At(e,t){let r=ee(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function Le(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ea(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function _e(e){let t=ea(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function Se(e,t,r,a=!1){let n;typeof e=="string"?n=Y(e):(n={...e},L(!n.pathname||!n.pathname.includes("?"),Le("?","pathname","search",n)),L(!n.pathname||!n.pathname.includes("#"),Le("#","pathname","hash",n)),L(!n.search||!n.search.includes("#"),Le("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,l;if(i==null)l=r;else{let d=t.length-1;if(!a&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),d-=1;n.pathname=m.join("/")}l=d>=0?t[d]:"/"}let s=Jt(n,l),u=i&&i!=="/"&&i.endsWith("/"),c=(o||i===".")&&r.endsWith("/");return!s.pathname.endsWith("/")&&(u||c)&&(s.pathname+="/"),s}var Kt=e=>e.replace(/[\\/]{2,}/g,"/"),H=e=>Kt(e.join("/"));function ee(e,t=0){let r=e.length;for(;r>t&&e.charCodeAt(r-1)===47;)r--;return r===e.length?e:e.slice(0,r)}var ta=e=>ee(e).replace(/^\/*/,"/"),ra=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,aa=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var Gt=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Xt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function na(e){let t=e.map(r=>r.route.path).filter(Boolean);return H(t)||"/"}var Qt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function qt(e,t){let r=e;if(typeof r!="string"||!Oe.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,n=!1;if(Qt)try{let o=new URL(window.location.href),i=Ut.test(r)?new URL(Ar(r,o.protocol)):new URL(r),l=U(i.pathname,t);i.origin===o.origin&&l!=null?r=l+i.search+i.hash:n=!0}catch{O(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:n,to:r}}var An=Symbol("Uninstrumented");var _n=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var _t=new URL("http://localhost");function $e(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),_t)}catch{return _t}}function De(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function oa(e,t){if(e.startsWith("//"))return!0;let r=t.protocol.toLowerCase();return e.toLowerCase().startsWith(r)?t.host===""||e.slice(r.length).startsWith("//"):!1}function Ie(e,t,r,a){let n=null;try{n=e==null?null:new URL(e,r)}catch{}let o=new URL(t,r),i=n!=null&&!De(n,r),l=!De(o,r);if(a==="reject"){if(i||l)throw new Error("External navigation is not allowed")}else if(l&&(n==null||!oa(e,n)||!De(n,o)))throw new Error("External navigation is not allowed")}var Zt=["POST","PUT","PATCH","DELETE"],$n=new Set(Zt),ia=["GET",...Zt],In=new Set(ia);var Hn=Symbol("ResetLoaderData"),la,sa,ua,ca;la=new WeakMap;sa=new WeakMap;ua=new WeakMap;ca=new WeakMap;var da=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function fa(e){try{return da.includes(new URL(e).protocol)}catch{return!1}}var K=_.createContext(null);K.displayName="DataRouter";var te=_.createContext(null);te.displayName="DataRouterState";var er=_.createContext(!1);function ha(){return _.useContext(er)}var He=_.createContext({isTransitioning:!1});He.displayName="ViewTransition";var tr=_.createContext(new Map);tr.displayName="Fetchers";var ma=_.createContext(null);ma.displayName="Await";var N=_.createContext(null);N.displayName="Navigation";var G=_.createContext(null);G.displayName="Location";var I=_.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName="Route";var Ue=_.createContext(null);Ue.displayName="RouteError";var Te=!0,rr="REACT_ROUTER_ERROR",pa="REDIRECT",ya="ROUTE_ERROR_RESPONSE";function ga(e){if(e.startsWith(`${rr}:${pa}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function va(e){if(e.startsWith(`${rr}:${ya}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Gt(t.status,t.statusText,t.data)}catch{}}function be(e,{relative:t}={}){L(X(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=g.useContext(N),{hash:n,pathname:o,search:i}=re(e,{relative:t}),l=o;return r!=="/"&&(l=o==="/"?r:H([r,o])),a.createHref({pathname:l,search:i,hash:n})}function X(){return g.useContext(G)!=null}function T(){return L(X(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(G).location}function wa(){return g.useContext(G).navigationType}var ar="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nr(e){g.useContext(N).static||g.useLayoutEffect(e)}function Q(){let{isDataRoute:e}=g.useContext(I);return e?Fa():Ra()}function Ra(){L(X(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(K),{basename:t,navigator:r}=g.useContext(N),{matches:a}=g.useContext(I),{pathname:n}=T(),o=JSON.stringify(_e(a)),i=g.useRef(!1);return nr(()=>{i.current=!0}),g.useCallback((s,u={})=>{if(O(i.current,ar),!i.current)return;if(typeof s=="number"){r.go(s);return}let c=Se(s,JSON.parse(o),n,u.relative==="path");e==null&&t!=="/"&&(c.pathname=c.pathname==="/"?t:H([t,c.pathname])),Ie(typeof s=="string"?s:B(s),r.createHref(c),$e(r),"reject"),(u.replace?r.replace:r.push)(c,u.state,u)},[t,r,o,n,e])}var Un=g.createContext(null);function Sa(){let{matches:e}=g.useContext(I);return e[e.length-1]?.params??{}}function re(e,{relative:t}={}){let{matches:r}=g.useContext(I),{pathname:a}=T(),n=JSON.stringify(_e(r));return g.useMemo(()=>Se(e,JSON.parse(n),a,t==="path"),[e,n,a,t])}function or(e,t){return ir(e,t)}function ir(e,t,r){L(X(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=g.useContext(N),{matches:n}=g.useContext(I),o=n[n.length-1],i=o?o.params:{},l=o?o.pathname:"/",s=o?o.pathnameBase:"/",u=o&&o.route;if(Te){let f=u&&u.path||"";cr(l,!u||f.endsWith("*")||f.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${f}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
1
+ import{a as Ct,b as Lt,c as Ce,d as Dt,h as kt,i as ae,j as Ft,k as Tt}from"./chunk.HMJXB6KC.js";import{a as yt}from"./chunk.5MOXQUZH.js";import{d as vt}from"./chunk.P26ATAAI.js";import{c as gt}from"./chunk.FIY4RUK5.js";import{B as Et,I as xt,J as Pt,i as mt,j as pt,u as wt,v as Rt,y as St,z as bt}from"./chunk.NLZHNPDU.js";import{c as Mr}from"./chunk.QNC2OKLF.js";import{G as M,P as dt,R as ft,W as Z,fa as ht}from"./chunk.FWXW4T4I.js";import{$c as rt,$d as lt,Zd as ot,_d as it,dd as at,eb as tt,pa as de,pe as st,qe as ut,re as ct,sd as nt}from"./chunk.DHPXRDT5.js";import{b as D}from"./chunk.AJZBJBMO.js";function Or(e,t){return ot(e,t).slice(1)}function fe(e,t){return e.kinds.find(r=>Or(e,r)===t)}function Nn(e,t,r){return it(e,t,r)}function Mn(e,t){return lt(e,t)}var _=D(M(),1),g=D(M(),1),x=D(M(),1),Ye=D(M(),1),hr=D(M(),1),S=D(M(),1),rn=D(M(),1),an=D(M(),1),nn=D(M(),1),v=D(M(),1),Pr=D(M(),1);var Oe=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Ut=/^[\\/]{2}/;function Ar(e,t){return t+e.replace(/\\/g,"/")}var Nt="popstate";function ge(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function jt(e={}){let{initialEntries:t=["/"],initialIndex:r,v5Compat:a=!1}=e,n;n=t.map((h,y)=>c(h,typeof h=="string"?null:h.state,y===0?"default":void 0,typeof h=="string"?void 0:h.mask));let o=s(r??n.length-1),i="POP",l=null;function s(h){return Math.min(Math.max(h,0),n.length-1)}function u(){return n[o]}function c(h,y=null,p,f){let w=ve(n?u().pathname:"/",h,y,p,f);return O(w.pathname.charAt(0)==="/",`relative pathnames are not supported in memory history: ${JSON.stringify(h)}`),w}function d(h){return typeof h=="string"?h:B(h)}return{get index(){return o},get action(){return i},get location(){return u()},createHref:d,createURL(h){return new URL(d(h),"http://localhost")},encodeLocation(h){let y=typeof h=="string"?Y(h):h;return{pathname:y.pathname||"",search:y.search||"",hash:y.hash||""}},push(h,y){i="PUSH";let p=ge(h)?h:c(h,y);o+=1,n.splice(o,n.length,p),a&&l&&l({action:i,location:p,delta:1})},replace(h,y){i="REPLACE";let p=ge(h)?h:c(h,y);n[o]=p,a&&l&&l({action:i,location:p,delta:0})},go(h){i="POP";let y=s(o+h),p=n[y];o=y,l&&l({action:i,location:p,delta:h})},listen(h){return l=h,()=>{l=null}}}}function zt(e={}){function t(a,n){let o=n.state?.masked,{pathname:i,search:l,hash:s}=o||a.location;return ve("",{pathname:i,search:l,hash:s},n.state&&n.state.usr||null,n.state&&n.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function r(a,n){return typeof n=="string"?n:B(n)}return $r(t,r,null,e)}function L(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function O(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function _r(){return Math.random().toString(36).substring(2,10)}function Mt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ve(e,t,r=null,a,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Y(t):t,state:r,key:t&&t.key||a||_r(),mask:n}}function B({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Y(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function $r(e,t,r,a={}){let{window:n=document.defaultView,v5Compat:o=!1}=a,i=n.history,l="POP",s=null,u=c();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function c(){return(i.state||{idx:null}).idx}function d(){l="POP";let f=c(),w=f==null?null:f-u;u=f,s&&s({action:l,location:p.location,delta:w})}function m(f,w){l="PUSH";let R=ge(f)?f:ve(p.location,f,w);r&&r(R,f),u=c()+1;let b=Mt(R,u),P=p.createHref(R.mask||R);try{i.pushState(b,"",P)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;n.location.assign(P)}o&&s&&s({action:l,location:p.location,delta:1})}function h(f,w){l="REPLACE";let R=ge(f)?f:ve(p.location,f,w);r&&r(R,f),u=c();let b=Mt(R,u),P=p.createHref(R.mask||R);i.replaceState(b,"",P),o&&s&&s({action:l,location:p.location,delta:0})}function y(f){return Ir(n,f)}let p={get action(){return l},get location(){return e(n,i)},listen(f){if(s)throw new Error("A history only accepts one active listener");return n.addEventListener(Nt,d),s=f,()=>{n.removeEventListener(Nt,d),s=null}},createHref(f){return t(n,f)},createURL:y,encodeLocation(f){let w=y(f);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:m,replace:h,go(f){return i.go(f)}};return p}function Ir(e,t,r=!1){let a="http://localhost";e&&(a=e.location.origin!=="null"?e.location.origin:e.location.href),L(a,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:B(t);return n=n.replace(/ $/,"%20"),!r&&Ut.test(n)&&(n=a+n),new URL(n,a)}var Hr;Hr=new WeakMap;function Ae(e,t,r="/"){return Ur(e,t,r,!1)}function Ur(e,t,r,a,n){let o=typeof t=="string"?Y(t):t,i=U(o.pathname||"/",r);if(i==null)return null;let l=n??zr(e),s=null,u=Zr(i);for(let c=0;s==null&&c<l.length;++c)s=qr(l[c],u,a);return s}function jr(e,t){let{route:r,pathname:a,params:n}=e;return{id:r.id,pathname:a,params:n,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function zr(e){let t=Bt(e);return Br(t),t}function Bt(e,t=[],r=[],a="",n=!1){let o=(i,l,s=n,u)=>{let c={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(c.relativePath.startsWith("/")){if(!c.relativePath.startsWith(a)&&s)return;L(c.relativePath.startsWith(a),`Absolute route path "${c.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(a.length)}let d=H([a,c.relativePath]),m=r.concat(c);i.children&&i.children.length>0&&(L(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),Bt(i.children,t,m,d,s)),!(i.path==null&&!i.index)&&t.push({path:d,score:Xr(d,i.index),routesMeta:m.map((h,y)=>{let[p,f]=Vt(h.relativePath,h.caseSensitive,y===m.length-1);return{...h,matcher:p,compiledParams:f}})})};return e.forEach((i,l)=>{if(i.path===""||!i.path?.includes("?"))o(i,l);else for(let s of Wt(i.path))o(i,l,!0,s)}),t}function Wt(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,n=r.endsWith("?"),o=r.replace(/\?$/,"");if(a.length===0)return n?[o,""]:[o];let i=Wt(a.join("/")),l=[];return l.push(...i.map(s=>s===""?o:[o,s].join("/"))),n&&l.push(...i),l.map(s=>e.startsWith("/")&&s===""?"/":s)}function Br(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Qr(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var Wr=/^:[\w-]+$/,Yr=3,Vr=2,Jr=1,Kr=10,Gr=-2,Ot=e=>e==="*";function Xr(e,t){let r=e.split("/"),a=r.length;return r.some(Ot)&&(a+=Gr),t&&(a+=Vr),r.filter(n=>!Ot(n)).reduce((n,o)=>n+(Wr.test(o)?Yr:o===""?Jr:Kr),a)}function Qr(e,t){return e.length===t.length&&e.slice(0,-1).every((a,n)=>a===t[n])?e[e.length-1]-t[t.length-1]:0}function qr(e,t,r=!1){let{routesMeta:a}=e,n={},o="/",i=[];for(let l=0;l<a.length;++l){let s=a[l],u=l===a.length-1,c=o==="/"?t:t.slice(o.length)||"/",d={path:s.relativePath,caseSensitive:s.caseSensitive,end:u},m=s.matcher&&s.compiledParams?Yt(d,c,s.matcher,s.compiledParams):oe(d,c),h=s.route;if(!m&&u&&r&&!a[a.length-1].route.index&&(m=oe({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},c)),!m)return null;Object.assign(n,m.params),i.push({params:n,pathname:H([o,m.pathname]),pathnameBase:ta(H([o,m.pathnameBase])),route:h}),m.pathnameBase!=="/"&&(o=H([o,m.pathnameBase]))}return i}function oe(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Vt(e.path,e.caseSensitive,e.end);return Yt(e,t,r,a)}function Yt(e,t,r,a){let n=t.match(r);if(!n)return null;let o=n[0],i=ee(o,1),l=n.slice(1);return{params:a.reduce((u,{paramName:c,isOptional:d},m)=>{if(c==="*"){let y=l[m]||"";i=ee(o.slice(0,o.length-y.length),1)}let h=l[m];return d&&!h?u[c]=void 0:u[c]=(h||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function Vt(e,t=!1,r=!0){O(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,s,u,c)=>{if(a.push({paramName:l,isOptional:s!=null}),s){let d=c.charAt(u+i.length);return d&&d!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,t?void 0:"i"),a]}function Zr(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return O(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function U(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function Jt(e,t="/"){let{pathname:r,search:a="",hash:n=""}=typeof e=="string"?Y(e):e,o;return r?(r=Kt(r),r.startsWith("/")||r.startsWith("\\")?o=At(r.substring(1),"/"):o=At(r,t)):o=t,{pathname:o,search:ra(a),hash:aa(n)}}function At(e,t){let r=ee(t).split("/");return e.split("/").forEach(n=>{n===".."?r.length>1&&r.pop():n!=="."&&r.push(n)}),r.length>1?r.join("/"):"/"}function Le(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ea(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function _e(e){let t=ea(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function Se(e,t,r,a=!1){let n;typeof e=="string"?n=Y(e):(n={...e},L(!n.pathname||!n.pathname.includes("?"),Le("?","pathname","search",n)),L(!n.pathname||!n.pathname.includes("#"),Le("#","pathname","hash",n)),L(!n.search||!n.search.includes("#"),Le("#","search","hash",n)));let o=e===""||n.pathname==="",i=o?"/":n.pathname,l;if(i==null)l=r;else{let d=t.length-1;if(!a&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),d-=1;n.pathname=m.join("/")}l=d>=0?t[d]:"/"}let s=Jt(n,l),u=i&&i!=="/"&&i.endsWith("/"),c=(o||i===".")&&r.endsWith("/");return!s.pathname.endsWith("/")&&(u||c)&&(s.pathname+="/"),s}var Kt=e=>e.replace(/[\\/]{2,}/g,"/"),H=e=>Kt(e.join("/"));function ee(e,t=0){let r=e.length;for(;r>t&&e.charCodeAt(r-1)===47;)r--;return r===e.length?e:e.slice(0,r)}var ta=e=>ee(e).replace(/^\/*/,"/"),ra=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,aa=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var Gt=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Xt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function na(e){let t=e.map(r=>r.route.path).filter(Boolean);return H(t)||"/"}var Qt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function qt(e,t){let r=e;if(typeof r!="string"||!Oe.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,n=!1;if(Qt)try{let o=new URL(window.location.href),i=Ut.test(r)?new URL(Ar(r,o.protocol)):new URL(r),l=U(i.pathname,t);i.origin===o.origin&&l!=null?r=l+i.search+i.hash:n=!0}catch{O(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:n,to:r}}var An=Symbol("Uninstrumented");var _n=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var _t=new URL("http://localhost");function $e(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),_t)}catch{return _t}}function De(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function oa(e,t){if(e.startsWith("//"))return!0;let r=t.protocol.toLowerCase();return e.toLowerCase().startsWith(r)?t.host===""||e.slice(r.length).startsWith("//"):!1}function Ie(e,t,r,a){let n=null;try{n=e==null?null:new URL(e,r)}catch{}let o=new URL(t,r),i=n!=null&&!De(n,r),l=!De(o,r);if(a==="reject"){if(i||l)throw new Error("External navigation is not allowed")}else if(l&&(n==null||!oa(e,n)||!De(n,o)))throw new Error("External navigation is not allowed")}var Zt=["POST","PUT","PATCH","DELETE"],$n=new Set(Zt),ia=["GET",...Zt],In=new Set(ia);var Hn=Symbol("ResetLoaderData"),la,sa,ua,ca;la=new WeakMap;sa=new WeakMap;ua=new WeakMap;ca=new WeakMap;var da=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function fa(e){try{return da.includes(new URL(e).protocol)}catch{return!1}}var K=_.createContext(null);K.displayName="DataRouter";var te=_.createContext(null);te.displayName="DataRouterState";var er=_.createContext(!1);function ha(){return _.useContext(er)}var He=_.createContext({isTransitioning:!1});He.displayName="ViewTransition";var tr=_.createContext(new Map);tr.displayName="Fetchers";var ma=_.createContext(null);ma.displayName="Await";var N=_.createContext(null);N.displayName="Navigation";var G=_.createContext(null);G.displayName="Location";var I=_.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName="Route";var Ue=_.createContext(null);Ue.displayName="RouteError";var Te=!0,rr="REACT_ROUTER_ERROR",pa="REDIRECT",ya="ROUTE_ERROR_RESPONSE";function ga(e){if(e.startsWith(`${rr}:${pa}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function va(e){if(e.startsWith(`${rr}:${ya}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Gt(t.status,t.statusText,t.data)}catch{}}function be(e,{relative:t}={}){L(X(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=g.useContext(N),{hash:n,pathname:o,search:i}=re(e,{relative:t}),l=o;return r!=="/"&&(l=o==="/"?r:H([r,o])),a.createHref({pathname:l,search:i,hash:n})}function X(){return g.useContext(G)!=null}function T(){return L(X(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(G).location}function wa(){return g.useContext(G).navigationType}var ar="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function nr(e){g.useContext(N).static||g.useLayoutEffect(e)}function Q(){let{isDataRoute:e}=g.useContext(I);return e?Fa():Ra()}function Ra(){L(X(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(K),{basename:t,navigator:r}=g.useContext(N),{matches:a}=g.useContext(I),{pathname:n}=T(),o=JSON.stringify(_e(a)),i=g.useRef(!1);return nr(()=>{i.current=!0}),g.useCallback((s,u={})=>{if(O(i.current,ar),!i.current)return;if(typeof s=="number"){r.go(s);return}let c=Se(s,JSON.parse(o),n,u.relative==="path");e==null&&t!=="/"&&(c.pathname=c.pathname==="/"?t:H([t,c.pathname])),Ie(typeof s=="string"?s:B(s),r.createHref(c),$e(r),"reject"),(u.replace?r.replace:r.push)(c,u.state,u)},[t,r,o,n,e])}var Un=g.createContext(null);function Sa(){let{matches:e}=g.useContext(I);return e[e.length-1]?.params??{}}function re(e,{relative:t}={}){let{matches:r}=g.useContext(I),{pathname:a}=T(),n=JSON.stringify(_e(r));return g.useMemo(()=>Se(e,JSON.parse(n),a,t==="path"),[e,n,a,t])}function or(e,t){return ir(e,t)}function ir(e,t,r){L(X(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=g.useContext(N),{matches:n}=g.useContext(I),o=n[n.length-1],i=o?o.params:{},l=o?o.pathname:"/",s=o?o.pathnameBase:"/",u=o&&o.route;if(Te){let f=u&&u.path||"";cr(l,!u||f.endsWith("*")||f.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${f}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
2
2
 
3
3
  Please change the parent <Route path="${f}"> to <Route path="${f==="/"?"*":`${f}/*`}">.`)}let c=T(),d;if(t){let f=typeof t=="string"?Y(t):t;L(s==="/"||f.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${f.pathname}" was given in the \`location\` prop.`),d=f}else d=c;let m=d.pathname||"/",h=m;if(s!=="/"){let f=s.replace(/^\//,"").split("/");h="/"+m.replace(/^\//,"").split("/").slice(f.length).join("/")}let y=r&&r.state.matches.length?r.state.matches.map(f=>Object.assign(f,{route:r.manifest[f.route.id]||f.route})):Ae(e,{pathname:h});Te&&(O(u||y!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),O(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`));let p=Ca(y&&y.map(f=>Object.assign({},f,{params:Object.assign({},i,f.params),pathname:H([s,a.encodeLocation?a.encodeLocation(f.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:f.pathname]),pathnameBase:f.pathnameBase==="/"?s:H([s,a.encodeLocation?a.encodeLocation(f.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:f.pathnameBase])})),n,r);return t&&p?g.createElement(G.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...d},navigationType:"POP"}},p):p}function ba(){let e=ur(),t=Xt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",n={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},i=null;return Te&&(console.error("Error handled by React Router default ErrorBoundary:",e),i=g.createElement(g.Fragment,null,g.createElement("p",null,"\u{1F4BF} Hey developer \u{1F44B}"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:o},"ErrorBoundary")," or"," ",g.createElement("code",{style:o},"errorElement")," prop on your route."))),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),r?g.createElement("pre",{style:n},r):null,i)}var Ea=g.createElement(ba,null),lr=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=va(e.digest);r&&(e=r)}let t=e!==void 0?g.createElement(I.Provider,{value:this.props.routeContext},g.createElement(Ue.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement(xa,{error:e},t):t}};lr.contextType=er;var ke=new WeakMap;function xa({children:e,error:t}){let{basename:r,navigator:a}=g.useContext(N);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=ga(t.digest);if(n){let o=ke.get(t);if(o)throw o;let i=qt(n.location,r),l=i.absoluteURL||i.to;if(Ie(n.location,l,$e(a),"allow-explicit"),fa(l))throw new Error("Invalid redirect location");if(Qt&&!ke.get(t))if(i.isExternal||n.reloadDocument)window.location.href=l;else{let s=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:n.replace}));throw ke.set(t,s),s}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l}`})}}return e}function Pa({routeContext:e,match:t,children:r}){let a=g.useContext(K);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(I.Provider,{value:e},r)}function Ca(e,t=[],r){let a=r?.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let n=e,o=a?.errors;if(o!=null){let c=n.findIndex(d=>d.route.id&&o?.[d.route.id]!==void 0);L(c>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),n=n.slice(0,Math.min(n.length,c+1))}let i=!1,l=-1;if(r&&a){i=a.renderFallback;for(let c=0;c<n.length;c++){let d=n[c];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(l=c),d.route.id){let{loaderData:m,errors:h}=a,y=d.route.loader&&!m.hasOwnProperty(d.route.id)&&(!h||h[d.route.id]===void 0);if(d.route.lazy||y){r.isStatic&&(i=!0),l>=0?n=n.slice(0,l+1):n=[n[0]];break}}}}let s=r?.onError,u=a&&s?(c,d)=>{s(c,{location:a.location,params:a.matches?.[0]?.params??{},pattern:na(a.matches),errorInfo:d})}:void 0;return n.reduceRight((c,d,m)=>{let h,y=!1,p=null,f=null;a&&(h=o&&d.route.id?o[d.route.id]:void 0,p=d.route.errorElement||Ea,i&&(l<0&&m===0?(cr("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,f=null):l===m&&(y=!0,f=d.route.hydrateFallbackElement||null)));let w=t.concat(n.slice(0,m+1)),R=()=>{let b;return h?b=p:y?b=f:d.route.Component?b=g.createElement(d.route.Component,null):d.route.element?b=d.route.element:b=c,g.createElement(Pa,{match:d,routeContext:{outlet:c,matches:w,isDataRoute:a!=null},children:b})};return a&&(d.route.ErrorBoundary||d.route.errorElement||m===0)?g.createElement(lr,{location:a.location,revalidation:a.revalidation,component:p,error:h,children:R(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:u}):R()},null)}function je(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function La(e){let t=g.useContext(K);return L(t,je(e)),t}function ze(e){let t=g.useContext(te);return L(t,je(e)),t}function Da(e){let t=g.useContext(I);return L(t,je(e)),t}function Be(e){let t=Da(e),r=t.matches[t.matches.length-1];return L(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function ka(){return Be("useRouteId")}function sr(){let e=ze("useNavigation");return g.useMemo(()=>{let{matches:t,historyAction:r,...a}=e.navigation;return a},[e.navigation])}function We(){let{matches:e,loaderData:t}=ze("useMatches");return g.useMemo(()=>e.map(r=>jr(r,t)),[e,t])}function ur(){let e=g.useContext(Ue),t=ze("useRouteError"),r=Be("useRouteError");return e!==void 0?e:t.errors?.[r]}function Fa(){let{router:e}=La("useNavigate"),t=Be("useNavigate"),r=g.useRef(!1);return nr(()=>{r.current=!0}),g.useCallback(async(n,o={})=>{O(r.current,ar),r.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...o}))},[e,t])}var $t={};function cr(e,t,r){!t&&!$t[e]&&($t[e]=!0,O(!1,r))}var Ta="useOptimistic",jn=x[Ta];var zn=x.memo(Na);function Na({routes:e,manifest:t,future:r,state:a,isStatic:n,onError:o}){return ir(e,void 0,{manifest:t,state:a,isStatic:n,onError:o,future:r})}function Ma({basename:e,children:t,initialEntries:r,initialIndex:a,useTransitions:n}){let o=x.useRef();o.current==null&&(o.current=jt({initialEntries:r,initialIndex:a,v5Compat:!0}));let i=o.current,[l,s]=x.useState({action:i.action,location:i.location}),u=x.useCallback(c=>{n===!1?s(c):x.startTransition(()=>s(c))},[n]);return x.useLayoutEffect(()=>i.listen(u),[i,u]),x.createElement(Ee,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:i,useTransitions:n})}function Oa({to:e,replace:t,state:r,relative:a}){L(X(),"<Navigate> may be used only in the context of a <Router> component.");let{static:n,navigator:o}=x.useContext(N);O(!n,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=x.useContext(I),{pathname:l}=T(),s=Q(),u=Se(e,_e(i),l,a==="path");Ie(typeof e=="string"?e:B(e),o.createHref(u),$e(o),"reject");let c=JSON.stringify(u);return x.useEffect(()=>{s(JSON.parse(c),{replace:t,state:r,relative:a})},[s,c,a,t,r]),null}function dr(e){L(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Ee({basename:e="/",children:t=null,location:r,navigationType:a="POP",navigator:n,static:o=!1,useTransitions:i}){L(!X(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),s=x.useMemo(()=>({basename:l,navigator:n,static:o,useTransitions:i,future:{}}),[l,n,o,i]);typeof r=="string"&&(r=Y(r));let{pathname:u="/",search:c="",hash:d="",state:m=null,key:h="default",mask:y}=r,p=x.useMemo(()=>{let f=U(u,l);return f==null?null:{location:{pathname:f,search:c,hash:d,state:m,key:h,mask:y},navigationType:a}},[l,u,c,d,m,h,a,y]);return O(p!=null,`<Router basename="${l}"> is not able to match the URL "${u}${c}${d}" because it does not start with the basename, so the <Router> won't render anything.`),p==null?null:x.createElement(N.Provider,{value:s},x.createElement(G.Provider,{children:t,value:p}))}function Aa({children:e,location:t}){return or(we(e),t)}function we(e,t=[]){let r=[];return x.Children.forEach(e,(a,n)=>{if(!x.isValidElement(a))return;let o=[...t,n];if(a.type===x.Fragment){r.push.apply(r,we(a.props.children,o));return}L(a.type===dr,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),L(!a.props.index||!a.props.children,"An index route cannot have child routes.");let i={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(i.children=we(a.props.children,o)),r.push(i)}),r}var pe="get",ye="application/x-www-form-urlencoded";function xe(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function _a(e){return xe(e)&&e.tagName.toLowerCase()==="button"}function $a(e){return xe(e)&&e.tagName.toLowerCase()==="form"}function Ia(e){return xe(e)&&e.tagName.toLowerCase()==="input"}function Ha(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ua(e,t){return e.button===0&&(!t||t==="_self")&&!Ha(e)}function Re(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let a=e[r];return t.concat(Array.isArray(a)?a.map(n=>[r,n]):[[r,a]])},[]))}function ja(e,t){let r=Re(e);return t&&t.forEach((a,n)=>{r.has(n)||t.getAll(n).forEach(o=>{r.append(n,o)})}),r}var he=null;function za(){if(he===null)try{new FormData(document.createElement("form"),0),he=!1}catch{he=!0}return he}var Ba=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Fe(e){return e!=null&&!Ba.has(e)?(O(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ye}"`),null):e}function Wa(e,t){let r,a,n,o,i;if($a(e)){let l=e.getAttribute("action");a=l?U(l,t):null,r=e.getAttribute("method")||pe,n=Fe(e.getAttribute("enctype"))||ye,o=new FormData(e)}else if(_a(e)||Ia(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||l.getAttribute("action");if(a=s?U(s,t):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||pe,n=Fe(e.getAttribute("formenctype"))||Fe(l.getAttribute("enctype"))||ye,o=new FormData(l,e),!za()){let{name:u,type:c,value:d}=e;if(c==="image"){let m=u?`${u}.`:"";o.append(`${m}x`,"0"),o.append(`${m}y`,"0")}else u&&o.append(u,d)}}else{if(xe(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=pe,a=null,n=ye,i=e}return o&&n==="text/plain"&&(i=o,o=void 0),{action:a,method:r.toLowerCase(),encType:n,formData:o,body:i}}var Bn=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ya={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},Va=/[&><\u2028\u2029]/g;function It(e){return e.replace(Va,t=>Ya[t])}function Ve(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}var Ja=Symbol("SingleFetchRedirect");function fr(e,t,r,a){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?n.pathname.endsWith("/")?n.pathname=`${n.pathname}_.${a}`:n.pathname=`${n.pathname}.${a}`:n.pathname==="/"?n.pathname=`_root.${a}`:t&&U(n.pathname,t)==="/"?n.pathname=`${ee(t)}/_root.${a}`:n.pathname=`${ee(n.pathname)}.${a}`,n}async function Ka(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){if(console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode&&import.meta.hot)throw r;return window.location.reload(),new Promise(()=>{})}}function Ga(e){return e!=null&&typeof e.page=="string"}function Xa(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Qa(e,t,r){let a=await Promise.all(e.map(async n=>{let o=t.routes[n.route.id];if(o){let i=await Ka(o,r);return i.links?i.links():[]}return[]}));return tn(a.flat(1).filter(Xa).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}function Ht(e,t,r,a,n,o){let i=(s,u)=>r[u]?s.route.id!==r[u].route.id:!0,l=(s,u)=>r[u].pathname!==s.pathname||r[u].route.path?.endsWith("*")&&r[u].params["*"]!==s.params["*"];return o==="assets"?t.filter((s,u)=>i(s,u)||l(s,u)):o==="data"?t.filter((s,u)=>{let c=a.routes[s.route.id];if(!c||!c.hasLoader)return!1;if(i(s,u)||l(s,u))return!0;if(s.route.shouldRevalidate){let d=s.route.shouldRevalidate({currentUrl:new URL(n.pathname+n.search+n.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:s.params,defaultShouldRevalidate:!0});if(typeof d=="boolean")return d}return!0}):[]}function qa(e,t,{includeHydrateFallback:r}={}){return Za(e.map(a=>{let n=t.routes[a.route.id];if(!n)return[];let o=[n.module];return n.clientActionModule&&(o=o.concat(n.clientActionModule)),n.clientLoaderModule&&(o=o.concat(n.clientLoaderModule)),r&&n.hydrateFallbackModule&&(o=o.concat(n.hydrateFallbackModule)),n.imports&&(o=o.concat(n.imports)),o}).flat(1))}function Za(e){return[...new Set(e)]}function en(e){let t={},r=Object.keys(e).sort();for(let a of r)t[a]=e[a];return t}function tn(e,t){let r=new Set,a=new Set(t);return e.reduce((n,o)=>{if(t&&!Ga(o)&&o.as==="script"&&o.href&&a.has(o.href))return n;let l=JSON.stringify(en(o));return r.has(l)||(r.add(l),n.push({key:l,link:o})),n},[])}function Je(){let e=S.useContext(K);return Ve(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function on(){let e=S.useContext(te);return Ve(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var ie=S.createContext(void 0);ie.displayName="FrameworkContext";function Pe(){let e=S.useContext(ie);return Ve(e,"You must render this element inside a <HydratedRouter> element"),e}function ln(e,t){let r=S.useContext(ie),[a,n]=S.useState(!1),[o,i]=S.useState(!1),{onFocus:l,onBlur:s,onMouseEnter:u,onMouseLeave:c,onTouchStart:d}=t,m=S.useRef(null);S.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let p=w=>{w.forEach(R=>{i(R.isIntersecting)})},f=new IntersectionObserver(p,{threshold:.5});return m.current&&f.observe(m.current),()=>{f.disconnect()}}},[e]),S.useEffect(()=>{if(a){let p=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(p)}}},[a]);let h=()=>{n(!0)},y=()=>{n(!1),i(!1)};return r?e!=="intent"?[o,m,{}]:[o,m,{onFocus:ne(l,h),onBlur:ne(s,y),onMouseEnter:ne(u,h),onMouseLeave:ne(c,y),onTouchStart:ne(d,h)}]:[!1,m,{}]}function ne(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function mr({page:e,...t}){let r=ha(),{nonce:a}=Pe(),{router:n}=Je(),o=S.useMemo(()=>Ae(n.routes,e,n.basename),[n.routes,e,n.basename]);return o?(t.nonce==null&&a&&(t={...t,nonce:a}),r?S.createElement(un,{page:e,matches:o,...t}):S.createElement(cn,{page:e,matches:o,...t})):null}function sn(e){let{manifest:t,routeModules:r}=Pe(),[a,n]=S.useState([]);return S.useEffect(()=>{let o=!1;return Qa(e,t,r).then(i=>{o||n(i)}),()=>{o=!0}},[e,t,r]),a}function un({page:e,matches:t,...r}){let a=T(),{future:n}=Pe(),{basename:o}=Je(),i=S.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let l=fr(e,o,n.v8_trailingSlashAwareDataRequests,"rsc"),s=!1,u=[];for(let c of t)typeof c.route.shouldRevalidate=="function"?s=!0:u.push(c.route.id);return s&&u.length>0&&l.searchParams.set("_routes",u.join(",")),[l.pathname+l.search]},[o,n.v8_trailingSlashAwareDataRequests,e,a,t]);return S.createElement(S.Fragment,null,i.map(l=>S.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...r})))}function cn({page:e,matches:t,...r}){let a=T(),{future:n,manifest:o,routeModules:i}=Pe(),{basename:l}=Je(),{loaderData:s,matches:u}=on(),c=S.useMemo(()=>Ht(e,t,u,o,a,"data"),[e,t,u,o,a]),d=S.useMemo(()=>Ht(e,t,u,o,a,"assets"),[e,t,u,o,a]),m=S.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let p=new Set,f=!1;if(t.forEach(R=>{let b=o.routes[R.route.id];!b||!b.hasLoader||(!c.some(P=>P.route.id===R.route.id)&&R.route.id in s&&i[R.route.id]?.shouldRevalidate||b.hasClientLoader?f=!0:p.add(R.route.id))}),p.size===0)return[];let w=fr(e,l,n.v8_trailingSlashAwareDataRequests,"data");return f&&p.size>0&&w.searchParams.set("_routes",t.filter(R=>p.has(R.route.id)).map(R=>R.route.id).join(",")),[w.pathname+w.search]},[l,n.v8_trailingSlashAwareDataRequests,s,a,o,c,t,e,i]),h=S.useMemo(()=>qa(d,o),[d,o]),y=sn(d);return S.createElement(S.Fragment,null,m.map(p=>S.createElement("link",{key:p,rel:"prefetch",as:"fetch",href:p,...r})),h.map(p=>S.createElement("link",{key:p,rel:"modulepreload",href:p,...r})),y.map(({key:p,link:f})=>S.createElement("link",{key:p,nonce:r.nonce,...f,crossOrigin:f.crossOrigin??r.crossOrigin})))}function dn(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var fn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{fn&&(window.__reactRouterVersion="7.18.3")}catch{}function hn({basename:e,children:t,useTransitions:r,window:a}){let n=v.useRef();n.current==null&&(n.current=zt({window:a,v5Compat:!0}));let o=n.current,[i,l]=v.useState({action:o.action,location:o.location}),s=v.useCallback(u=>{r===!1?l(u):v.startTransition(()=>l(u))},[r]);return v.useLayoutEffect(()=>o.listen(s),[o,s]),v.createElement(Ee,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o,useTransitions:r})}function pr({basename:e,children:t,history:r,useTransitions:a}){let[n,o]=v.useState({action:r.action,location:r.location}),i=v.useCallback(l=>{a===!1?o(l):v.startTransition(()=>o(l))},[a]);return v.useLayoutEffect(()=>r.listen(i),[r,i]),v.createElement(Ee,{basename:e,children:t,location:n.location,navigationType:n.action,navigator:r,useTransitions:a})}pr.displayName="unstable_HistoryRouter";var le=v.forwardRef(function({onClick:t,discover:r="render",prefetch:a="none",relative:n,reloadDocument:o,replace:i,mask:l,state:s,target:u,to:c,preventScrollReset:d,viewTransition:m,defaultShouldRevalidate:h,...y},p){let{basename:f,navigator:w,useTransitions:R}=v.useContext(N),b=typeof c=="string"&&Oe.test(c),P=qt(c,f);c=P.to;let E=be(c,{relative:n}),F=T(),k=null;if(l){let W=Se(l,[],F.mask?F.mask.pathname:"/",!0);f!=="/"&&(W.pathname=W.pathname==="/"?f:H([f,W.pathname])),k=w.createHref(W)}let[$,J,z]=ln(a,y),ue=Rr(c,{replace:i,mask:l,state:s,target:u,preventScrollReset:d,relative:n,viewTransition:m,defaultShouldRevalidate:h,useTransitions:R});function q(W){t&&t(W),W.defaultPrevented||ue(W)}let ce=!(P.isExternal||o),et=v.createElement("a",{...y,...z,href:(ce?k:void 0)||P.absoluteURL||E,onClick:ce?q:t,ref:dn(p,J),target:u,"data-discover":!b&&r==="render"?"true":void 0});return $&&!b?v.createElement(v.Fragment,null,et,v.createElement(mr,{page:E})):et});le.displayName="Link";var yr=v.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:a="",end:n=!1,style:o,to:i,viewTransition:l,children:s,...u},c){let d=re(i,{relative:u.relative}),m=T(),h=v.useContext(te),{navigator:y,basename:p}=v.useContext(N),f=h!=null&&xr(d)&&l===!0,w=y.encodeLocation?y.encodeLocation(d).pathname:d.pathname,R=m.pathname,b=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;r||(R=R.toLowerCase(),b=b?b.toLowerCase():null,w=w.toLowerCase()),b&&p&&(b=U(b,p)||b);let P=w!=="/"&&w.endsWith("/")?w.length-1:w.length,E=R===w||!n&&R.startsWith(w)&&R.charAt(P)==="/",F=b!=null&&(b===w||!n&&b.startsWith(w)&&b.charAt(w.length)==="/"),k={isActive:E,isPending:F,isTransitioning:f},$=E?t:void 0,J;typeof a=="function"?J=a(k):J=[a,E?"active":null,F?"pending":null,f?"transitioning":null].filter(Boolean).join(" ");let z=typeof o=="function"?o(k):o;return v.createElement(le,{...u,"aria-current":$,className:J,ref:c,style:z,to:i,viewTransition:l},typeof s=="function"?s(k):s)});yr.displayName="NavLink";var gr=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:a,replace:n,state:o,method:i=pe,action:l,onSubmit:s,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:m,...h},y)=>{let{useTransitions:p}=v.useContext(N),f=Sr(),w=br(l,{relative:u}),R=i.toLowerCase()==="get"?"get":"post",b=typeof l=="string"&&Oe.test(l);return v.createElement("form",{ref:y,method:R,action:w,onSubmit:a?s:E=>{if(s&&s(E),E.defaultPrevented)return;E.preventDefault();let F=E.nativeEvent.submitter,k=F?.getAttribute("formmethod")||i,$=()=>f(F||E.currentTarget,{fetcherKey:t,method:k,navigate:r,replace:n,state:o,relative:u,preventScrollReset:c,viewTransition:d,defaultShouldRevalidate:m});p&&r!==!1?v.startTransition(()=>$()):$()},...h,"data-discover":!b&&e==="render"?"true":void 0})});gr.displayName="Form";function vr({getKey:e,storageKey:t,...r}){let a=v.useContext(ie),{basename:n}=v.useContext(N),o=T(),i=We();Er({getKey:e,storageKey:t});let l=v.useMemo(()=>{if(!a||!e)return null;let u=Me(o,i,n,e);return u!==o.key?u:null},[]);if(!a||a.isSpaMode)return null;let s=((u,c)=>{if(!window.history.state||!window.history.state.key){let d=Math.random().toString(32).slice(2);window.history.replaceState({key:d},"")}try{let m=JSON.parse(sessionStorage.getItem(u)||"{}")[c||window.history.state.key];typeof m=="number"&&window.scrollTo(0,m)}catch(d){console.error(d),sessionStorage.removeItem(u)}}).toString();return r.nonce==null&&a?.nonce&&(r.nonce=a.nonce),v.createElement("script",{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${s})(${It(JSON.stringify(t||Ne))}, ${It(JSON.stringify(l))})`}})}vr.displayName="ScrollRestoration";function wr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ke(e){let t=v.useContext(K);return L(t,wr(e)),t}function mn(e){let t=v.useContext(te);return L(t,wr(e)),t}function Rr(e,{target:t,replace:r,mask:a,state:n,preventScrollReset:o,relative:i,viewTransition:l,defaultShouldRevalidate:s,useTransitions:u}={}){let c=Q(),d=T(),m=re(e,{relative:i});return v.useCallback(h=>{if(Ua(h,t)){h.preventDefault();let y=r!==void 0?r:B(d)===B(m),p=()=>c(e,{replace:y,mask:a,state:n,preventScrollReset:o,relative:i,viewTransition:l,defaultShouldRevalidate:s});u?v.startTransition(()=>p()):p()}},[d,c,m,r,a,n,t,e,o,i,l,s,u])}function Ge(e){O(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=v.useRef(Re(e)),r=v.useRef(!1),a=T(),n=v.useMemo(()=>ja(a.search,r.current?null:t.current),[a.search]),o=Q(),i=v.useCallback((l,s)=>{let u=Re(typeof l=="function"?l(new URLSearchParams(n)):l);r.current=!0,o("?"+u,s)},[o,n]);return[n,i]}var pn=0,yn=()=>`__${String(++pn)}__`;function Sr(){let{router:e}=Ke("useSubmit"),{basename:t}=v.useContext(N),r=ka(),a=e.fetch,n=e.navigate;return v.useCallback(async(o,i={})=>{let{action:l,method:s,encType:u,formData:c,body:d}=Wa(o,t);if(i.navigate===!1){let m=i.fetcherKey||yn();await a(m,r,i.action||l,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:c,body:d,formMethod:i.method||s,formEncType:i.encType||u,flushSync:i.flushSync})}else await n(i.action||l,{defaultShouldRevalidate:i.defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:c,body:d,formMethod:i.method||s,formEncType:i.encType||u,replace:i.replace,state:i.state,fromRouteId:r,flushSync:i.flushSync,viewTransition:i.viewTransition})},[a,n,t,r])}function br(e,{relative:t}={}){let{basename:r}=v.useContext(N),a=v.useContext(I);L(a,"useFormAction must be used inside a RouteContext");let[n]=a.matches.slice(-1),o={...re(e||".",{relative:t})},i=T();if(e==null){o.search=i.search;let l=new URLSearchParams(o.search),s=l.getAll("index");if(s.some(c=>c==="")){l.delete("index"),s.filter(d=>d).forEach(d=>l.append("index",d));let c=l.toString();o.search=c?`?${c}`:""}}return(!e||e===".")&&n.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:H([r,o.pathname])),B(o)}var Ne="react-router-scroll-positions",me={};function Me(e,t,r,a){let n=null;return a&&(r!=="/"?n=a({...e,pathname:U(e.pathname,r)||e.pathname},t):n=a(e,t)),n==null&&(n=e.key),n}function Er({getKey:e,storageKey:t}={}){let{router:r}=Ke("useScrollRestoration"),{restoreScrollPosition:a,preventScrollReset:n}=mn("useScrollRestoration"),{basename:o}=v.useContext(N),i=T(),l=We(),s=sr();v.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),gn(v.useCallback(()=>{if(s.state==="idle"){let u=Me(i,l,o,e);me[u]=window.scrollY}try{sessionStorage.setItem(t||Ne,JSON.stringify(me))}catch(u){O(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${u}).`)}window.history.scrollRestoration="auto"},[s.state,e,o,i,l,t])),typeof document<"u"&&(v.useLayoutEffect(()=>{try{let u=sessionStorage.getItem(t||Ne);u&&(me=JSON.parse(u))}catch{}},[t]),v.useLayoutEffect(()=>{let u=r?.enableScrollRestoration(me,()=>window.scrollY,e?(c,d)=>Me(c,d,o,e):void 0);return()=>u&&u()},[r,o,e]),v.useLayoutEffect(()=>{if(a!==!1){if(typeof a=="number"){window.scrollTo(0,a);return}try{if(i.hash){let u=document.getElementById(decodeURIComponent(i.hash.slice(1)));if(u){u.scrollIntoView();return}}}catch{O(!1,`"${i.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}n!==!0&&window.scrollTo(0,0)}},[i,a,n]))}function gn(e,t){let{capture:r}=t||{};v.useEffect(()=>{let a=r!=null?{capture:r}:void 0;return window.addEventListener("pagehide",e,a),()=>{window.removeEventListener("pagehide",e,a)}},[e,r])}function xr(e,{relative:t}={}){let r=v.useContext(He);L(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Ke("useViewTransitionState"),n=re(e,{relative:t});if(!r.isTransitioning)return!1;let o=U(r.currentLocation.pathname,a)||r.currentLocation.pathname,i=U(r.nextLocation.pathname,a)||r.nextLocation.pathname;return oe(n.pathname,i)!=null||oe(n.pathname,o)!=null}var Cr=D(M(),1),Lr=D(Mr(),1);var se=D(Z(),1);function Dr({context:e,own:t}){return ae(e.store),ht()?(0,se.jsx)(vn,{context:e,...t?{own:t}:{}}):null}function vn({context:e,own:t}){let r=ft()?.live??e.store;if(ae(r),!Ct(r.batches().length))return null;let n=(0,se.jsx)(Cr.Suspense,{fallback:null,children:(0,se.jsx)(Lt,{remembers:!1})});return t?(0,Lr.createPortal)(n,t):(0,se.jsx)("div",{className:"graview-bar-own",children:n})}var A=D(M(),1);var V=D(M(),1),wn=(0,V.createContext)(null);function si(){let e=new Map,t=new Set,r=()=>{for(let a of t)a()};return{count:a=>e.get(a)??0,place(a){return e.set(a,(e.get(a)??0)+1),r(),()=>{e.set(a,(e.get(a)??1)-1),r()}},subscribe(a){return t.add(a),()=>t.delete(a)}}}function kr(e){let t=(0,V.useContext)(wn);(0,V.useLayoutEffect)(()=>t?.place(e),[t,e])}function ui(e,t){return(0,V.useSyncExternalStore)(e.subscribe,()=>e.count(t)>0,()=>!1)}var Fr=D(M(),1),j=D(Z(),1),Xe="var(--graview-text-small)",Qe="var(--graview-text-body)",gi="var(--graview-font-display, var(--graview-font-body, system-ui))",qe={maxWidth:760,margin:"0 auto",padding:"40px var(--graview-page-gutter, 20px) max(96px, calc(var(--graview-foot-room, 0px) + env(safe-area-inset-bottom, 0px)))",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40},Ze=1160,vi={...qe,maxWidth:Ze},Tr={margin:0,fontSize:"var(--graview-text-title)",lineHeight:1.2,letterSpacing:"-0.012em",overflowWrap:"anywhere",textWrap:"balance"},wi={margin:0,fontSize:"var(--graview-text-heading)",lineHeight:1.3,textWrap:"balance"},Ri={margin:0,fontSize:Xe,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},Si={margin:0,fontSize:Qe,color:"var(--graview-ink-muted)",maxWidth:"60ch"},Nr={color:"var(--graview-ink-muted)",fontSize:Xe},bi={borderTop:"1px solid var(--graview-edge)",paddingTop:24},Rn={color:"var(--graview-accent)",textDecorationColor:"color-mix(in srgb, currentColor 50%, transparent)",textDecorationThickness:1,textUnderlineOffset:"0.2em",display:"inline-flex",alignItems:"center",columnGap:"0.3em",minHeight:24},Ei={...Rn,textDecoration:"none"},xi={color:"inherit",textDecoration:"none",display:"inline-flex",alignItems:"center",minHeight:24},Pi=`.graview-list{container-type:inline-size}
4
4
  .graview-rows{display:grid;grid-template-columns:minmax(0,1fr);column-gap:1.5rem;margin:0;padding:0;list-style:none;border-top:1px solid var(--graview-edge)}
@@ -1 +1 @@
1
- import"./chunk.WVUJXDXZ.js";import{b as P}from"./chunk.L7XKYGV7.js";import"./chunk.CE3NKAF7.js";import"./chunk.R3GE37OI.js";import"./chunk.2KCDLCB2.js";import"./chunk.UD7VLXPM.js";import"./chunk.3DEWQDP7.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import{Aa as E,Ba as L,xa as M,za as T}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function G(r,l,i){let g=r.getAttribute("data-record")??"",m=r.getAttribute("data-field")??"",c=Number(r.getAttribute("data-index")??"0"),e=[...l?.node?[l.node]:[],...l?.nodes??[]].find(p=>p.id===g);if(!g||!e)return{why:g?`names a record it was not shown ("${g.slice(0,80)}")`:"names no record (data-record)"};let h=m&&Object.hasOwn(e,m)?e[m]:void 0,f=(Array.isArray(h)?h:[h]).filter(M),o=Number.isInteger(c)&&c>=0?f[c]:void 0,v=e.label?`"${e.label}"`:"a record";return m?o?(i==="video"?!E(o):!E(o)&&!T(o))?{why:`names "${o.name}" on ${v}, which is not ${i==="video"?"a video":"a picture or a video"}`}:{file:o,on:e}:{why:f.length===0?`names "${m}" on ${v}, which holds no file it was shown`:`names file ${r.getAttribute("data-index")} of "${m}" on ${v}, which holds ${f.length}`}:{why:`names no field of ${v} (data-field)`}}var C=r=>`${r.caption?.trim()||r.name}, ${L(r)}`;function N(r,l,i,g,m,c={}){let e=r.createElement("video");e.setAttribute("data-graview-video",""),e.setAttribute("playsinline",""),e.setAttribute("aria-label",C(i)),c.autoplay?(e.setAttribute("data-graview-video-autoplay",""),e.setAttribute("muted",""),e.muted=!0,e.setAttribute("loop",""),e.setAttribute("preload",c.still?"metadata":"auto"),c.still?e.setAttribute("data-graview-video-still",""):e.setAttribute("autoplay","")):(e.setAttribute("controls",""),e.setAttribute("preload","metadata"));let h=i.poster?g(i.poster):void 0;h&&e.setAttribute("poster",h),i.width&&i.height?(e.setAttribute("width",String(i.width)),e.setAttribute("height",String(i.height)),e.style.aspectRatio=`${i.width} / ${i.height}`):e.style.aspectRatio="16 / 9",c.cover?(e.setAttribute("data-graview-video-cover",""),e.style.cssText+=";display:block;width:100%;height:100%;max-height:none;aspect-ratio:auto;object-fit:cover;background:#000"):e.style.cssText+=";display:block;width:100%;height:auto;max-height:80vh;background:#000;border-radius:var(--graview-radius, 8px)";let f=i.captions?g(i.captions):void 0;if(f){let o=r.createElement("track");o.setAttribute("kind","captions"),o.setAttribute("src",f),o.setAttribute("srclang","en"),o.setAttribute("label","Captions"),o.setAttribute("default",""),e.appendChild(o)}return i.duration===void 0&&e.addEventListener("loadedmetadata",()=>Number.isFinite(e.duration)&&e.duration>0&&e.setAttribute("aria-label",C({...i,duration:e.duration}))),e.setAttribute("src",m),l.appendChild(e),e}function S(r,l){let i=r.document,g=new Set,m=t=>{g.has(t)||(g.add(t),l.onProblem?.(t))},c=t=>{let a=l.file?l.file(t):t;if(a!==void 0)try{let s=new r.URL(a,i.baseURI);return s.origin===r.location.origin&&/^https?:$/.test(s.protocol)?a:void 0}catch{return}},e=new WeakMap,h=typeof r.matchMedia=="function"?r.matchMedia("(prefers-reduced-motion: reduce)"):void 0,f=new Set,o=(t,a)=>{a?(t.removeAttribute("autoplay"),t.setAttribute("data-graview-video-still",""),t.pause()):(t.removeAttribute("data-graview-video-still"),t.setAttribute("autoplay",""),t.setAttribute("preload","auto"),t.play?.()?.catch?.(()=>{}))},v=()=>{for(let t of f)t.isConnected?o(t,h?.matches===!0):f.delete(t)};h?.addEventListener?.("change",v);let p,k=t=>{if(typeof t.close=="function")return t.close();t.removeAttribute("open"),t.dispatchEvent(new r.Event("close"))},w=(t,a)=>m(`The ${t} in the view ${l.view} was not drawn: it ${a}.`);return{refresh(t){let a=l.shown();for(let s of Array.from(t.querySelectorAll("graview-video"))){let d=s.shadowRoot??s.attachShadow({mode:"open"});if(!l.pictures){e.delete(s),d.replaceChildren(),w("video",`asks for no pictures: a view places a record's video where its manifest says "pictures": true`);continue}let u=G(s,a,"video"),n={autoplay:s.hasAttribute("autoplay"),cover:s.hasAttribute("cover"),still:h?.matches===!0},b="file"in u?JSON.stringify([u.file,n.autoplay,n.cover]):"";if(e.get(s)===b&&d.childNodes.length>0)continue;if(e.set(s,b),d.replaceChildren(),"why"in u){w("video",u.why);continue}let A=c(u.file.href);if(!A){w("video",`names "${u.file.name}", which this host does not say it serves on this page`);continue}let $=i.createElement("style");$.textContent=":host { display: block; min-width: 0; }",d.appendChild($);let y=N(i,d,u.file,c,A,n);n.autoplay&&f.add(y)}},open(t){if(!l.pictures)return w("full-screen viewer",`asks for no pictures: a view opens a record's picture or video full screen where its manifest says "pictures": true`),!1;let a=G(t,l.shown(),"any");if("why"in a)return w("full-screen viewer",a.why),!1;let s=c(a.file.href);if(!s)return w("full-screen viewer",`names "${a.file.name}", which this host does not say it serves on this page`),!1;p&&k(p);let d=a.file,u=d.caption?.trim()||d.name,n=i.createElement("dialog");n.setAttribute("data-graview-lightbox",""),n.setAttribute("aria-label",E(d)?C(d):u),n.style.cssText="padding:0;border:0;border-radius:var(--graview-radius, 8px);max-width:min(96vw, 1600px);max-height:94vh;background:var(--graview-panel, Canvas);color:var(--graview-ink, CanvasText)";let b=i.createElement("figure");if(b.style.cssText="margin:0;display:grid;gap:8px;padding:10px",E(d))N(i,b,d,c,s);else{let x=i.createElement("img");x.setAttribute("src",s),x.setAttribute("alt",u),x.style.cssText="max-width:100%;max-height:80vh;object-fit:contain;display:block;margin:0 auto",b.appendChild(x)}let A=i.createElement("figcaption");A.style.cssText="display:flex;gap:12px;align-items:center;justify-content:space-between";let $=i.createElement("span");$.textContent=E(d)&&d.duration!==void 0?`${u} \xB7 ${P(d.duration)}`:u;let y=i.createElement("button");return y.type="button",y.textContent="Close",y.addEventListener("click",()=>k(n)),A.append($,y),b.appendChild(A),n.appendChild(b),n.addEventListener("click",x=>x.target===n&&k(n)),n.addEventListener("close",()=>{n.remove(),p===n&&(p=void 0),t.focus?.()}),i.body.appendChild(n),p=n,typeof n.showModal=="function"?n.showModal():n.setAttribute("open",""),y.focus(),!0},dispose(){p&&k(p),p?.remove(),p=void 0,h?.removeEventListener?.("change",v),f.clear()}}}export{S as createGuestMedia,G as namedFile};
1
+ import"./chunk.WVUJXDXZ.js";import{b as P}from"./chunk.B422DSYN.js";import"./chunk.ZE5RSKXF.js";import"./chunk.DKUEZPGR.js";import"./chunk.EP7YT7LT.js";import"./chunk.I7KN732Z.js";import"./chunk.TLPCYKLW.js";import"./chunk.FIY4RUK5.js";import"./chunk.IY3DV52G.js";import{Aa as E,Ba as L,xa as M,za as T}from"./chunk.DHPXRDT5.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function G(r,l,i){let g=r.getAttribute("data-record")??"",m=r.getAttribute("data-field")??"",c=Number(r.getAttribute("data-index")??"0"),e=[...l?.node?[l.node]:[],...l?.nodes??[]].find(p=>p.id===g);if(!g||!e)return{why:g?`names a record it was not shown ("${g.slice(0,80)}")`:"names no record (data-record)"};let h=m&&Object.hasOwn(e,m)?e[m]:void 0,f=(Array.isArray(h)?h:[h]).filter(M),o=Number.isInteger(c)&&c>=0?f[c]:void 0,v=e.label?`"${e.label}"`:"a record";return m?o?(i==="video"?!E(o):!E(o)&&!T(o))?{why:`names "${o.name}" on ${v}, which is not ${i==="video"?"a video":"a picture or a video"}`}:{file:o,on:e}:{why:f.length===0?`names "${m}" on ${v}, which holds no file it was shown`:`names file ${r.getAttribute("data-index")} of "${m}" on ${v}, which holds ${f.length}`}:{why:`names no field of ${v} (data-field)`}}var C=r=>`${r.caption?.trim()||r.name}, ${L(r)}`;function N(r,l,i,g,m,c={}){let e=r.createElement("video");e.setAttribute("data-graview-video",""),e.setAttribute("playsinline",""),e.setAttribute("aria-label",C(i)),c.autoplay?(e.setAttribute("data-graview-video-autoplay",""),e.setAttribute("muted",""),e.muted=!0,e.setAttribute("loop",""),e.setAttribute("preload",c.still?"metadata":"auto"),c.still?e.setAttribute("data-graview-video-still",""):e.setAttribute("autoplay","")):(e.setAttribute("controls",""),e.setAttribute("preload","metadata"));let h=i.poster?g(i.poster):void 0;h&&e.setAttribute("poster",h),i.width&&i.height?(e.setAttribute("width",String(i.width)),e.setAttribute("height",String(i.height)),e.style.aspectRatio=`${i.width} / ${i.height}`):e.style.aspectRatio="16 / 9",c.cover?(e.setAttribute("data-graview-video-cover",""),e.style.cssText+=";display:block;width:100%;height:100%;max-height:none;aspect-ratio:auto;object-fit:cover;background:#000"):e.style.cssText+=";display:block;width:100%;height:auto;max-height:80vh;background:#000;border-radius:var(--graview-radius, 8px)";let f=i.captions?g(i.captions):void 0;if(f){let o=r.createElement("track");o.setAttribute("kind","captions"),o.setAttribute("src",f),o.setAttribute("srclang","en"),o.setAttribute("label","Captions"),o.setAttribute("default",""),e.appendChild(o)}return i.duration===void 0&&e.addEventListener("loadedmetadata",()=>Number.isFinite(e.duration)&&e.duration>0&&e.setAttribute("aria-label",C({...i,duration:e.duration}))),e.setAttribute("src",m),l.appendChild(e),e}function S(r,l){let i=r.document,g=new Set,m=t=>{g.has(t)||(g.add(t),l.onProblem?.(t))},c=t=>{let a=l.file?l.file(t):t;if(a!==void 0)try{let s=new r.URL(a,i.baseURI);return s.origin===r.location.origin&&/^https?:$/.test(s.protocol)?a:void 0}catch{return}},e=new WeakMap,h=typeof r.matchMedia=="function"?r.matchMedia("(prefers-reduced-motion: reduce)"):void 0,f=new Set,o=(t,a)=>{a?(t.removeAttribute("autoplay"),t.setAttribute("data-graview-video-still",""),t.pause()):(t.removeAttribute("data-graview-video-still"),t.setAttribute("autoplay",""),t.setAttribute("preload","auto"),t.play?.()?.catch?.(()=>{}))},v=()=>{for(let t of f)t.isConnected?o(t,h?.matches===!0):f.delete(t)};h?.addEventListener?.("change",v);let p,k=t=>{if(typeof t.close=="function")return t.close();t.removeAttribute("open"),t.dispatchEvent(new r.Event("close"))},w=(t,a)=>m(`The ${t} in the view ${l.view} was not drawn: it ${a}.`);return{refresh(t){let a=l.shown();for(let s of Array.from(t.querySelectorAll("graview-video"))){let d=s.shadowRoot??s.attachShadow({mode:"open"});if(!l.pictures){e.delete(s),d.replaceChildren(),w("video",`asks for no pictures: a view places a record's video where its manifest says "pictures": true`);continue}let u=G(s,a,"video"),n={autoplay:s.hasAttribute("autoplay"),cover:s.hasAttribute("cover"),still:h?.matches===!0},b="file"in u?JSON.stringify([u.file,n.autoplay,n.cover]):"";if(e.get(s)===b&&d.childNodes.length>0)continue;if(e.set(s,b),d.replaceChildren(),"why"in u){w("video",u.why);continue}let A=c(u.file.href);if(!A){w("video",`names "${u.file.name}", which this host does not say it serves on this page`);continue}let $=i.createElement("style");$.textContent=":host { display: block; min-width: 0; }",d.appendChild($);let y=N(i,d,u.file,c,A,n);n.autoplay&&f.add(y)}},open(t){if(!l.pictures)return w("full-screen viewer",`asks for no pictures: a view opens a record's picture or video full screen where its manifest says "pictures": true`),!1;let a=G(t,l.shown(),"any");if("why"in a)return w("full-screen viewer",a.why),!1;let s=c(a.file.href);if(!s)return w("full-screen viewer",`names "${a.file.name}", which this host does not say it serves on this page`),!1;p&&k(p);let d=a.file,u=d.caption?.trim()||d.name,n=i.createElement("dialog");n.setAttribute("data-graview-lightbox",""),n.setAttribute("aria-label",E(d)?C(d):u),n.style.cssText="padding:0;border:0;border-radius:var(--graview-radius, 8px);max-width:min(96vw, 1600px);max-height:94vh;background:var(--graview-panel, Canvas);color:var(--graview-ink, CanvasText)";let b=i.createElement("figure");if(b.style.cssText="margin:0;display:grid;gap:8px;padding:10px",E(d))N(i,b,d,c,s);else{let x=i.createElement("img");x.setAttribute("src",s),x.setAttribute("alt",u),x.style.cssText="max-width:100%;max-height:80vh;object-fit:contain;display:block;margin:0 auto",b.appendChild(x)}let A=i.createElement("figcaption");A.style.cssText="display:flex;gap:12px;align-items:center;justify-content:space-between";let $=i.createElement("span");$.textContent=E(d)&&d.duration!==void 0?`${u} \xB7 ${P(d.duration)}`:u;let y=i.createElement("button");return y.type="button",y.textContent="Close",y.addEventListener("click",()=>k(n)),A.append($,y),b.appendChild(A),n.appendChild(b),n.addEventListener("click",x=>x.target===n&&k(n)),n.addEventListener("close",()=>{n.remove(),p===n&&(p=void 0),t.focus?.()}),i.body.appendChild(n),p=n,typeof n.showModal=="function"?n.showModal():n.setAttribute("open",""),y.focus(),!0},dispose(){p&&k(p),p?.remove(),p=void 0,h?.removeEventListener?.("change",v),f.clear()}}}export{S as createGuestMedia,G as namedFile};
@@ -1 +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{e as K,f as H}from"./chunk.TFJA4QV4.js";import{f as $,h as F,i as P,j as B}from"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as se,La as A,W as S}from"./chunk.3VEZ5MOC.js";import{a as q}from"./chunk.SDO3U72B.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as T}from"./chunk.AJZBJBMO.js";var r=T(se(),1);var j=T(S(),1),Z=A(q(()=>(__graviewPreload(import.meta.url,["./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.FZELUSK5.js")))),U={Part:Z.part((n,t)=>(0,j.jsx)(n.WhenMonth,{...t}),{quiet:!0}),prefetch:()=>Z.prefetch()};var o=T(S(),1),E="try \u201Ctomorrow 3pm\u201D, \u201CFri 10:30\u201D or \u201C17 Oct\u201D";function _(n,t,i,b=!1){let y=Date.UTC(+n.day.slice(0,4),+n.day.slice(5,7)-1,+n.day.slice(8,10),0,t?n.minutes??0:0),x={weekday:b?"long":"short",year:"numeric",month:b?"long":"short",day:"numeric",...t?{hour:"numeric",minute:"2-digit"}:{},timeZone:"UTC"},h;try{h=new Intl.DateTimeFormat(i??"en-US",x)}catch{h=new Intl.DateTimeFormat("en-US",x)}return h.format(y).replace(/ /g," ")}function V(n,t){if(n.length===4)return n;let i=Date.UTC(+n.slice(0,4),+n.slice(5,7)-1,1);try{return new Intl.DateTimeFormat(t??"en-US",{month:"long",year:"numeric",timeZone:"UTC"}).format(i)}catch{return new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"}).format(i)}}function me({value:n,time:t,instant:i=!1,partial:b=!1,label:y,name:x,required:h,autoFocus:G,autoSelect:N,locale:s,onChange:J,onLeave:Q,onCancel:X,inputRef:W,boxStyle:Y}){let k=(0,r.useId)(),p=(0,r.useRef)(null),O=(0,r.useRef)(null),I=e=>b&&!t&&e!==void 0?K(e):void 0,C=e=>{let a=I(e);if(a!==void 0)return V(a,s);let l=F(e);return l?_(l,t,s):e??""},[g,D]=(0,r.useState)(()=>C(n)),[R,w]=(0,r.useState)(!1),[ee,L]=(0,r.useState)(n),[ne,te]=(0,r.useState)(n);n!==ne&&(te(n),n!==ee&&(L(n),D(C(n)))),(0,r.useEffect)(()=>{N&&(p.current?.focus(),p.current?.select())},[N]);let d=t&&i?B(s):void 0,M=g===C(n),u=F(n),c=I(M?n:g),f=c!==void 0?void 0:M?u:H(g,{today:$().day,time:t,...u?{base:u}:{},...s?{locale:s}:{}}),re=M?n:c!==void 0?c:f?P(f,{time:t,instant:i}):void 0,v=g.trim()==="",m=!v&&f===void 0&&c===void 0;(0,r.useEffect)(()=>{p.current?.setCustomValidity(m?`Not a date this reads \u2014 ${E}`:"")},[m]);let z=e=>{L(e),J(e)},oe=e=>{D(e);let a=I(e);if(a!==void 0)return z(a);let l=e.trim()===""?void 0:H(e,{today:$().day,time:t,...u?{base:u}:{},...s?{locale:s}:{}});z(l?P(l,{time:t,instant:i}):void 0)},ae=e=>{let a=t?{day:e,minutes:f?.minutes??u?.minutes??540}:{day:e},l=P(a,{time:t,instant:i});D(C(l)),z(l),w(!1),requestAnimationFrame(()=>{p.current?.focus(),p.current?.select()})},ie=v?`Type a date, or pick one \u2014 ${E}`:m?`Not a date this reads \u2014 ${E}`:c!==void 0?`${V(c,s)} (${c.length===4?"a year":"a month"} alone)`:f?`${_(f,t,s,!0)}${d?` ${d.short}`:""}`:"";return(0,o.jsxs)("span",{"data-graview-when":t?i?"instant":"moment":"day",style:{display:"inline-flex",flex:"1 1 14rem",flexWrap:"wrap",alignItems:"center",gap:"4px 6px",maxWidth:"100%",minWidth:0},onBlur:e=>{let a=e.relatedTarget;a&&e.currentTarget.contains(a)||!a&&typeof document<"u"&&!document.hasFocus()||(w(!1),Q?.(re))},children:[(0,o.jsx)("input",{ref:e=>{p.current=e,typeof W=="function"?W(e):W&&(W.current=e)},type:"text",name:x,required:h,autoFocus:G,"aria-label":y,"aria-describedby":`${k}-said`,"aria-invalid":m||void 0,autoComplete:"off",spellCheck:!1,enterKeyHint:"done",placeholder:t?"tomorrow 3pm":"17 Oct",value:g,"data-graview-part":"control",onChange:e=>oe(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),X?.()):e.key==="ArrowDown"&&e.altKey&&(e.preventDefault(),w(!0))},style:{flex:"1 1 12ch",minWidth:"10ch",maxWidth:"100%",boxSizing:"border-box",font:"inherit",...Y}}),(0,o.jsx)("button",{ref:O,type:"button","aria-label":`Pick a date for ${y}`,"aria-expanded":R,"aria-controls":`${k}-month`,"data-graview-part":"when-pick",onClick:()=>w(e=>!e),onPointerEnter:()=>U.prefetch(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:32,minHeight:32,padding:0,borderRadius:6},children:(0,o.jsxs)("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,o.jsx)("rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}),(0,o.jsx)("path",{d:"M2 6.5h12M5.5 1.5v3M10.5 1.5v3"})]})}),(0,o.jsxs)("span",{id:`${k}-said`,"aria-live":"polite","data-graview-part":"when-said",...d?{"data-graview-zone":d.zone,title:`Times are in ${d.zone.replace(/_/g," ")} (${d.short})`}:{},style:{flexBasis:"100%",fontSize:"0.75rem",color:m?"var(--graview-bad)":"var(--graview-ink-faint)"},children:[ie,d&&!m&&!v?(0,o.jsx)("span",{"data-graview-part":"when-zone",children:` \xB7 ${(d.zone.split("/").at(-1)??d.zone).replace(/_/g," ")} time`}):null]}),R?(0,o.jsx)(r.Suspense,{fallback:null,children:(0,o.jsx)(U.Part,{id:`${k}-month`,label:y,selected:f?.day??u?.day,today:$().day,locale:s,onPick:ae,onClose:()=>{w(!1),O.current?.focus()}})}):null]})}export{me as WhenInput,_ as wallAsRead};
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{e as K,f as H}from"./chunk.MH3AQO2R.js";import{f as $,h as F,i as P,j as B}from"./chunk.J2N7EKMX.js";import"./chunk.P26ATAAI.js";import"./chunk.FIY4RUK5.js";import"./chunk.IY3DV52G.js";import"./chunk.NLZHNPDU.js";import"./chunk.QNC2OKLF.js";import{G as se,La as A,W as S}from"./chunk.FWXW4T4I.js";import{a as q}from"./chunk.SDO3U72B.js";import"./chunk.DHPXRDT5.js";import"./chunk.FQLNBIQ5.js";import{b as T}from"./chunk.AJZBJBMO.js";var r=T(se(),1);var j=T(S(),1),Z=A(q(()=>(__graviewPreload(import.meta.url,["./chunk.NLZHNPDU.js","./chunk.QNC2OKLF.js","./chunk.FWXW4T4I.js","./chunk.SDO3U72B.js","./chunk.DHPXRDT5.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.LGNGFG5V.js")))),U={Part:Z.part((n,t)=>(0,j.jsx)(n.WhenMonth,{...t}),{quiet:!0}),prefetch:()=>Z.prefetch()};var o=T(S(),1),E="try \u201Ctomorrow 3pm\u201D, \u201CFri 10:30\u201D or \u201C17 Oct\u201D";function _(n,t,i,b=!1){let y=Date.UTC(+n.day.slice(0,4),+n.day.slice(5,7)-1,+n.day.slice(8,10),0,t?n.minutes??0:0),x={weekday:b?"long":"short",year:"numeric",month:b?"long":"short",day:"numeric",...t?{hour:"numeric",minute:"2-digit"}:{},timeZone:"UTC"},h;try{h=new Intl.DateTimeFormat(i??"en-US",x)}catch{h=new Intl.DateTimeFormat("en-US",x)}return h.format(y).replace(/ /g," ")}function V(n,t){if(n.length===4)return n;let i=Date.UTC(+n.slice(0,4),+n.slice(5,7)-1,1);try{return new Intl.DateTimeFormat(t??"en-US",{month:"long",year:"numeric",timeZone:"UTC"}).format(i)}catch{return new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"}).format(i)}}function me({value:n,time:t,instant:i=!1,partial:b=!1,label:y,name:x,required:h,autoFocus:G,autoSelect:N,locale:s,onChange:J,onLeave:Q,onCancel:X,inputRef:W,boxStyle:Y}){let k=(0,r.useId)(),p=(0,r.useRef)(null),O=(0,r.useRef)(null),I=e=>b&&!t&&e!==void 0?K(e):void 0,C=e=>{let a=I(e);if(a!==void 0)return V(a,s);let l=F(e);return l?_(l,t,s):e??""},[g,D]=(0,r.useState)(()=>C(n)),[R,w]=(0,r.useState)(!1),[ee,L]=(0,r.useState)(n),[ne,te]=(0,r.useState)(n);n!==ne&&(te(n),n!==ee&&(L(n),D(C(n)))),(0,r.useEffect)(()=>{N&&(p.current?.focus(),p.current?.select())},[N]);let d=t&&i?B(s):void 0,M=g===C(n),u=F(n),c=I(M?n:g),f=c!==void 0?void 0:M?u:H(g,{today:$().day,time:t,...u?{base:u}:{},...s?{locale:s}:{}}),re=M?n:c!==void 0?c:f?P(f,{time:t,instant:i}):void 0,v=g.trim()==="",m=!v&&f===void 0&&c===void 0;(0,r.useEffect)(()=>{p.current?.setCustomValidity(m?`Not a date this reads \u2014 ${E}`:"")},[m]);let z=e=>{L(e),J(e)},oe=e=>{D(e);let a=I(e);if(a!==void 0)return z(a);let l=e.trim()===""?void 0:H(e,{today:$().day,time:t,...u?{base:u}:{},...s?{locale:s}:{}});z(l?P(l,{time:t,instant:i}):void 0)},ae=e=>{let a=t?{day:e,minutes:f?.minutes??u?.minutes??540}:{day:e},l=P(a,{time:t,instant:i});D(C(l)),z(l),w(!1),requestAnimationFrame(()=>{p.current?.focus(),p.current?.select()})},ie=v?`Type a date, or pick one \u2014 ${E}`:m?`Not a date this reads \u2014 ${E}`:c!==void 0?`${V(c,s)} (${c.length===4?"a year":"a month"} alone)`:f?`${_(f,t,s,!0)}${d?` ${d.short}`:""}`:"";return(0,o.jsxs)("span",{"data-graview-when":t?i?"instant":"moment":"day",style:{display:"inline-flex",flex:"1 1 14rem",flexWrap:"wrap",alignItems:"center",gap:"4px 6px",maxWidth:"100%",minWidth:0},onBlur:e=>{let a=e.relatedTarget;a&&e.currentTarget.contains(a)||!a&&typeof document<"u"&&!document.hasFocus()||(w(!1),Q?.(re))},children:[(0,o.jsx)("input",{ref:e=>{p.current=e,typeof W=="function"?W(e):W&&(W.current=e)},type:"text",name:x,required:h,autoFocus:G,"aria-label":y,"aria-describedby":`${k}-said`,"aria-invalid":m||void 0,autoComplete:"off",spellCheck:!1,enterKeyHint:"done",placeholder:t?"tomorrow 3pm":"17 Oct",value:g,"data-graview-part":"control",onChange:e=>oe(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),X?.()):e.key==="ArrowDown"&&e.altKey&&(e.preventDefault(),w(!0))},style:{flex:"1 1 12ch",minWidth:"10ch",maxWidth:"100%",boxSizing:"border-box",font:"inherit",...Y}}),(0,o.jsx)("button",{ref:O,type:"button","aria-label":`Pick a date for ${y}`,"aria-expanded":R,"aria-controls":`${k}-month`,"data-graview-part":"when-pick",onClick:()=>w(e=>!e),onPointerEnter:()=>U.prefetch(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:32,minHeight:32,padding:0,borderRadius:6},children:(0,o.jsxs)("svg",{"aria-hidden":"true",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[(0,o.jsx)("rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}),(0,o.jsx)("path",{d:"M2 6.5h12M5.5 1.5v3M10.5 1.5v3"})]})}),(0,o.jsxs)("span",{id:`${k}-said`,"aria-live":"polite","data-graview-part":"when-said",...d?{"data-graview-zone":d.zone,title:`Times are in ${d.zone.replace(/_/g," ")} (${d.short})`}:{},style:{flexBasis:"100%",fontSize:"0.75rem",color:m?"var(--graview-bad)":"var(--graview-ink-faint)"},children:[ie,d&&!m&&!v?(0,o.jsx)("span",{"data-graview-part":"when-zone",children:` \xB7 ${(d.zone.split("/").at(-1)??d.zone).replace(/_/g," ")} time`}):null]}),R?(0,o.jsx)(r.Suspense,{fallback:null,children:(0,o.jsx)(U.Part,{id:`${k}-month`,label:y,selected:f?.day??u?.day,today:$().day,locale:s,onPick:ae,onClose:()=>{w(!1),O.current?.focus()}})}):null]})}export{me as WhenInput,_ as wallAsRead};
@@ -1,3 +1,3 @@
1
- import{F as W,G,H as sn,I as z,J as D,L as P,La as pn,M as dn,Q as ln,T as _,Ta as hn,U as un,V as fn,W as H,X as cn,Y,Z as q,ac as X,cb as mn,da as J,fa as B,gb as wn,ha as yn,hc as $n,ia as gn,ta as Q}from"./chunk.6AANHELP.js";var zn=864e5,j=e=>String(e).padStart(2,"0"),v=e=>new Date(e).toISOString().slice(0,10),E=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),Hn=(e,t)=>v(E(e)+t*zn),An=e=>new Date(E(e)).getUTCDay(),Yn=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e),nn=["sun","mon","tue","wed","thu","fri","sat"],Nn=e=>dn(e)??"UTC";function Mn(e,t){if(W.test(e))return v(E(e))===e?{day:e}:void 0;if(G.test(e))return{day:e.length===4?`${e}-01-01`:`${e}-01`};if(D.test(e)&&!Yn(e)){let l=e.slice(0,10);return v(E(l))!==l?void 0:{day:l,minutes:Number(e.slice(11,13))*60+Number(e.slice(14,16))}}let a=Date.parse(e);if(!Number.isNaN(a))return{...un(a,t),stamp:a}}var bn=["EEEE","EEE","MMMM","MMM","yyyy","HH","mm","h","a","d"],kn=/[A-Za-z]+/y;function qn(e){let t=[],a=0;for(;a<e.length;){let l=e[a];if(l==="'"){let f="",y=a+1;for(;y<e.length;y++){if(e[y]==="'"){if(e[y+1]==="'"){f+="'",y++;continue}break}f+=e[y]}if(y>=e.length)return`the quoted words in "${e}" are never closed`;t.push({text:f}),a=y+1;continue}kn.lastIndex=a;let u=kn.exec(e);if(u){let f=u[0];for(;f.length>0;){let y=bn.find($=>f.startsWith($));if(!y)return`"${f}" is not a piece of a date pattern; the pieces are ${bn.map($=>`${$}`).join(", ")}, and other words go in single quotes`;t.push(y),f=f.slice(y.length)}a+=u[0].length;continue}t.push({text:l}),a++}return t}var xn="UTC",Sn=new Map;function Jn(e,t){let a=`${e}|${JSON.stringify(t)}`,l=Sn.get(a);if(!l){try{l=new Intl.DateTimeFormat(e,{...t,timeZone:xn})}catch{l=new Intl.DateTimeFormat("en-US",{...t,timeZone:xn})}Sn.set(a,l)}return l}var C=(e,t,a,l)=>Jn(e,t).formatToParts(a).find(u=>u.type===l)?.value??"";function Rn(e,t,a){let l=qn(t);if(typeof l=="string")return{problem:l};let u=ln(a),f=E(e.day),y=e.minutes,$=y===void 0?void 0:f+y*6e4;return l.map(x=>{if(typeof x!="string")return x.text;switch(x){case"EEEE":return C(u,{weekday:"long"},f,"weekday");case"EEE":return C(u,{weekday:"short"},f,"weekday");case"MMMM":return C(u,{month:"long"},f,"month");case"MMM":return C(u,{month:"short"},f,"month");case"yyyy":return e.day.slice(0,4);case"d":return String(Number(e.day.slice(8,10)));case"HH":return y===void 0?"":j(Math.floor(y/60));case"mm":return y===void 0?"":j(y%60);case"h":return y===void 0?"":String((Math.floor(y/60)+11)%12+1);case"a":return $===void 0?"":C(u,{hour:"numeric",hour12:!0},$,"dayPeriod")}}).join("")}var Bn=/^(\d{1,2}):(\d{2})$/;function On(e){let t=Bn.exec(e.trim());if(!t)return;let a=Number(t[1]),l=Number(t[2]);return a<=23&&l<=59?a*60+l:void 0}var En=e=>new Date(e).toISOString().replace(/\.\d{3}Z$/,"Z"),Qn=(e,t)=>`${e}T${j(Math.floor(t/60))}:${j(t%60)}`;function Tn(e,t,a){return En(fn(e.day,t,a))}function Fn(e,t){if(e.stamp!==void 0)return En(e.stamp+t*6e4);let a=E(e.day)+(e.minutes??0)*6e4+t*6e4,l=v(a);return Qn(l,Math.round((a-E(l))/6e4))}var Gn=e=>nn[An(e.day)];function Dn(e,t){let a=(An(e.day)-nn.indexOf(t)+7)%7;return Hn(e.day,-a)}var Vn=e=>typeof e=="string"&&nn.includes(e);var Wn=1e4,w=class{constructor(t){this.nodes=t}},Cn=Symbol.for("@graview/core:far-record"),Xn=e=>typeof e=="object"&&e!==null&&e[Cn]===!0;function ne(e){let t={...e.fields,id:`@${e.address}/${e.kind}:${e.id}`,kind:`@${e.address}/${e.kind}`,label:e.label};return Object.defineProperty(t,Cn,{value:!0}),t}function be(e){let t=`the linked record in ${e.ref.address}`;return e.reason==="denied"?`${t} is not one this viewer may open`:`${t} has not been read`}var ee="",g=class extends Error{constructor(a,l){super(a);this.sentence=a;this.at=l}},en=class extends g{},T=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof w)&&typeof e.id=="string",_n=e=>{let t=new Set;return new w(e.filter(a=>!t.has(a.id)&&t.add(a.id)))},k=e=>e===null?"nothing":e instanceof w?"a set of records":Array.isArray(e)?"a list":T(e)?"a record":typeof e=="string"?"a word":typeof e;function te(e,t){if(!G.test(e)&&!G.test(t))return;let a=f=>z(D.test(f)?f.slice(0,10):f),l=a(e),u=a(t);return l&&u?[l,u]:void 0}function In(e,t){let a=t.budget??Wn,l=(n,d)=>{if(a-=n,a<0)throw new en("this rule looks at too much of the graph to judge in one go",d)},u=t.today??P(),f=t.now??new Date().toISOString(),y=Nn(t.timeZone),$=new Map,x=new Set,S=t.bindings,rn=(n,d,o,i)=>{let p=`${n?.id}\0${d}`;if($.has(p))return $.get(p);if(x.has(p))throw new g(`"${d}"${n?` of ${Q(n.kind)}`:""} depends on itself`,i);x.add(p);let r=S;S=void 0;let s=a;a=Math.max(s,Wn);try{let c=A(o,n);return $.set(p,c),c}finally{a=s,S=r,x.delete(p)}},I=(n,d,o)=>{l(1,o);let i=t.kinds.get(n.kind),p=i?.computed?.get(d);if(p)return rn(n,d,p,o);let r=i?.linked?.get(d);if(r){let h=pn(Object.hasOwn(n,d)?n[d]:void 0,r);l(h.length,o);let b=t.linked??hn(t.graph),m=h.flatMap(N=>{let K=b?b(N):{unread:!0};return"record"in K?[ne(K.record)]:(t.onUnread?.({relation:d,ref:N,reason:"denied"in K?"denied":"unread"}),[])});return r.cardinality==="one"?m[0]??null:new w(m)}let s=Object.hasOwn(n,d);if(i?.fields.has(d)||s){let h=s?mn(n,d,u):void 0;return h===void 0?null:h}let c=i?.edges.get(d);if(c){let h=t.graph.out(n.id,d);return l(h.length,o),c==="one"?h[0]??null:new w(h)}if(d==="id")return n.id;if(Xn(n))return null;throw new g(`${Q(n.kind)} has no field or relation called "${d}"`,o)},M=(n,d,o)=>{if(n instanceof w)return n;if(n===null)return new w([]);if(T(n))return new w([n]);throw new g(`${o}(\u2026) needs a set of records, and was given ${k(n)}`,d)},O=(n,d,o)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new g(`${o}(\u2026) needs a word, and was given ${k(n)}`,d)},Z=(n,d,o)=>{let i=O(n,d,o);if(i===null)return null;let p=G.test(i)?z(i).from:i,r=Date.parse(p.length===10?`${p}T00:00:00Z`:p);if(Number.isNaN(r))throw new g(`${o}(\u2026) needs a date, and "${i}" is not one`,d);return r},V=(n,d,o)=>{if(n===null)return null;if(typeof n!="string")throw new g(`${o}(\u2026) needs a date, and was given ${k(n)}`,d);let i=Mn(n,y);if(!i)throw new g(`${o}(\u2026) needs a date, and "${n}" is not one`,d);return i},F=(n,d)=>T(n)&&T(d)?n.id===d.id:T(n)&&typeof d=="string"?n.id===d:typeof n=="string"&&T(d)?n===d.id:Array.isArray(n)&&Array.isArray(d)?n.length===d.length&&n.every((o,i)=>F(o,d[i])):n===d,R=(n,d,o)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new g(`${o} must be true or false, and was ${k(n)}`,d)},L=(n,d)=>A(d,n);function A(n,d){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(o=>A(o,d));case"ident":{let o=S&&Object.hasOwn(S,n.name)?S[n.name]:void 0;if(o!==void 0)return o;if(d)return I(d,n.name,n.at);throw new g(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let o=A(n.object,d);if(o===null)return null;if(T(o))return I(o,n.name,n.at);throw new g(`".${n.name}" needs a record before it, and was given ${k(o)}`,n.at)}case"unary":{let o=A(n.operand,d);if(n.op==="!")return!R(o,n.at,"what follows not");if(o===null)return null;if(typeof o!="number")throw new g(`"-" needs a number, and was given ${k(o)}`,n.at);return-o}case"where":{let o=M(A(n.set,d),n.at,"where");return l(o.nodes.length,n.at),new w(o.nodes.filter(i=>R(L(i,n.filter),n.at,"a where condition")))}case"binary":return Zn(n,d);case"call":return Kn(n,d)}}function Zn(n,d){if(n.op==="&&")return R(A(n.left,d),n.at,"each side of and")&&R(A(n.right,d),n.at,"each side of and");if(n.op==="||")return R(A(n.left,d),n.at,"each side of or")||R(A(n.right,d),n.at,"each side of or");let o=A(n.left,d),i=A(n.right,d);if(n.op==="&"||n.op==="|"||n.op==="-"&&(o instanceof w||i instanceof w)){let p=M(o,n.at,n.op).nodes,r=M(i,n.at,n.op).nodes;l(p.length+r.length,n.at);let s=new Set(r.map(c=>c.id));return _n(n.op==="|"?[...p,...r]:p.filter(c=>s.has(c.id)===(n.op==="&")))}switch(n.op){case"==":return F(o,i);case"!=":return!F(o,i);case"in":{if(i===null)return!1;if(i instanceof w)return i.nodes.some(p=>F(o,p));if(Array.isArray(i))return i.some(p=>F(o,p));if(typeof i=="string"&&typeof o=="string")return i.includes(o);throw new g(`"in" needs a list or a set on its right, and was given ${k(i)}`,n.at)}case"<":case"<=":case">":case">=":{if(o===null||i===null)return!1;if(!(typeof o=="number"&&typeof i=="number"||typeof o=="string"&&typeof i=="string"))throw new g(`cannot compare ${k(o)} with ${k(i)}`,n.at);let r=typeof o=="string"&&typeof i=="string"?te(o,i):void 0;if(r){let[s,c]=r,h=s.to<c.from,b=s.from>c.to,m=s.from===c.from&&s.to===c.to;return n.op==="<"?h:n.op==="<="?h||m:n.op===">"?b:b||m}return n.op==="<"?o<i:n.op==="<="?o<=i:n.op===">"?o>i:o>=i}default:{if(o===null||i===null)return null;if(n.op==="+"&&(typeof o=="string"||typeof i=="string")){let p=`${O(o,n.at,"+")}${O(i,n.at,"+")}`;if(p.length>1e4)throw new g("that makes a word too long",n.at);return p}if(typeof o!="number"||typeof i!="number")throw new g(`"${n.op}" needs numbers, and was given ${k(o)} and ${k(i)}`,n.at);return(n.op==="/"||n.op==="%")&&i===0?null:n.op==="+"?o+i:n.op==="-"?o-i:n.op==="*"?o*i:n.op==="/"?o/i:o%i}}}function on(n,d){let o=n.t==="call"&&(n.fn==="in"||n.fn==="out")&&n.args.length===1?n.args[0]:void 0;if(!(!d||o?.t!=="lit"||typeof o.value!="string"))return l(1,n.at),n.fn==="out"?t.graph.out(d.id,o.value):t.graph.in(d.id,o.value)}function Kn(n,d){let o=(r,s=r)=>{if(n.args.length<r||n.args.length>s)throw new g(`${n.fn}(\u2026) takes ${r===s?r:`${r} to ${s}`} argument${s===1?"":"s"}`,n.at)},i=r=>A(n.args[r],d),p=r=>{let s=i(r);if(typeof s!="string")throw new g(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return s};switch(n.fn){case"out":case"in":{o(1,2);let r=(h,b)=>n.fn==="out"?t.graph.out(h,b):t.graph.in(h,b);if(n.args.length===2){let h=M(i(0),n.at,n.fn).nodes,b=p(1);return _n(h.flatMap(m=>{let N=r(m.id,b);return l(N.length+1,n.at),N}))}let s=p(0);if(!d)throw new g(`${n.fn}('${s}') needs a record to start from`,n.at);let c=r(d.id,s);return l(c.length,n.at),new w(c)}case"all":{o(1,2);let r=t.graph.nodesOfKind(p(0),{archived:n.args.length===2?i(1):!1});return l(r.length,n.at),new w(r)}case"archived":return o(0,1),wn(n.args.length===1?i(0):d);case"count":return o(1),(on(n.args[0],d)??M(i(0),n.at,"count").nodes).length;case"exists":return o(1),(on(n.args[0],d)??M(i(0),n.at,"exists").nodes).length>0;case"every":case"some":{o(2);let r=M(i(0),n.at,n.fn);l(r.nodes.length,n.at);let s=c=>R(L(c,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(s):r.nodes.some(s)}case"sum":case"min":case"max":{o(2);let r=M(i(0),n.at,n.fn);l(r.nodes.length,n.at);let s=n.args[1],c=s.t==="lit"&&typeof s.value=="string"?s.value:void 0,h=s.t==="ident"?`'${s.name}'`:c!==void 0?`'${c}'`:"\u2026",b=r.nodes.map(m=>s.t==="ident"?I(m,s.name,n.at):c!==void 0?I(m,c,n.at):L(m,s)).filter(m=>{if(m===null)return!1;if(typeof m!="number")throw new g(`${n.fn}(\u2026, ${h}) needs a number for each member, and found ${k(m)}`,n.at);return!0});return n.fn==="sum"?b.reduce((m,N)=>m+N,0):b.length===0?null:n.fn==="min"?Math.min(...b):Math.max(...b)}case"fact":{o(1);let r=p(0),s=t.kinds.get(ee)?.computed?.get(r);if(!s)throw new g(`no fact is called "${r}"`,n.at);return rn(null,r,s,n.at)}case"first":return o(1),M(i(0),n.at,"first").nodes[0]??null;case"sort":{o(2,3);let r=M(i(0),n.at,"sort"),s=n.args.length===3?i(2):"asc";if(s!=="asc"&&s!=="desc")throw new g("sort(\u2026) goes 'asc' or 'desc'",n.at);let c=r.nodes.length;l(c+c*Math.ceil(Math.log2(c+1)),n.at);let h=r.nodes.map((m,N)=>({node:m,i:N,key:L(m,n.args[1])})),b=s==="desc"?-1:1;return h.sort((m,N)=>an(m.key,N.key,b,n.at)||m.i-N.i),new w(h.map(m=>m.node))}case"either":{if(n.args.length<1)throw new g("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let s=i(r);if(s!==null&&!(s instanceof w&&s.nodes.length===0))return s}return null}case"present":{o(1);let r=i(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof w?r.nodes.length>0:!0}case"len":{o(1);let r=i(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof w)return r.nodes.length;throw new g(`len(\u2026) needs a word or a list, and was given ${k(r)}`,n.at)}case"contains":case"startsWith":{o(2);let r=i(0),s=i(1);if(r===null||s===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(b=>F(b,s));let c=O(r,n.at,n.fn),h=O(s,n.at,n.fn);return n.fn==="contains"?c.toLowerCase().includes(h.toLowerCase()):c.startsWith(h)}case"lower":{o(1);let r=O(i(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"concat":{if(n.args.length<1)throw new g("concat(\u2026) takes at least one argument",n.at);let r="";for(let s=0;s<n.args.length;s++)r+=O(i(s),n.at,"concat")??"";if(r.length>1e4)throw new g("that makes a word too long",n.at);return r}case"format":{o(2);let r=V(i(0),n.at,"format"),s=i(1);if(typeof s!="string")throw new g("format(\u2026) says its pattern in quotes, like format(start, 'EEE h:mm a')",n.at);if(r===null)return null;let c=Rn(r,s,t.locale);if(typeof c!="string")throw new g(c.problem,n.at);return c}case"datetime":case"at":{o(2);let r=V(i(0),n.at,n.fn),s=i(1);if(s===null||r===null)return null;let c=typeof s=="string"?On(s):void 0;if(c===void 0)throw new g(`${n.fn}(\u2026) needs a time of day written like '09:30', and was given ${typeof s=="string"?`"${s}"`:k(s)}`,n.at);return Tn(r,c,y)}case"addMinutes":{o(2);let r=V(i(0),n.at,"addMinutes"),s=i(1);if(r===null||s===null)return null;if(typeof s!="number"||!Number.isFinite(s))throw new g(`addMinutes(\u2026) needs a number of minutes, and was given ${k(s)}`,n.at);return Fn(r,Math.round(s))}case"weekday":{o(1);let r=V(i(0),n.at,"weekday");return r===null?null:Gn(r)}case"startOfWeek":{o(1,2);let r=V(i(0),n.at,"startOfWeek"),s=n.args.length===2?i(1):"mon";if(!Vn(s))throw new g("startOfWeek(\u2026) starts the week on a day said 'mon' to 'sun'",n.at);return r===null?null:Dn(r,s)}case"today":return o(0),u;case"now":return o(0),f;case"date":{o(1);let r=Z(i(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{o(2);let r=Z(i(0),n.at,n.fn),s=Z(i(1),n.at,n.fn);if(r===null||s===null)return null;let c=(s-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(c):c}case"round":{o(1,2);let r=i(0);if(r===null)return null;if(typeof r!="number")throw new g(`round(\u2026) needs a number, and was given ${k(r)}`,n.at);let s=n.args.length===2?i(1):0;if(typeof s!="number"||!Number.isInteger(s)||s<0||s>12)throw new g("round(\u2026, places) takes a whole number of places from 0 to 12",n.at);let c=10**s,h=Math.sign(r)*Math.round(Math.abs(r)*c*(1+Number.EPSILON))/c;return Object.is(h,-0)?0:h}case"if":return o(3),R(i(0),n.at,"the condition in if(\u2026)")?i(1):i(2);default:throw new g(`"${n.fn}" is not a function the rule language knows`,n.at)}}function an(n,d,o,i){if(n===null||d===null)return n===d?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(d)){for(let r=0;r<Math.max(n.length,d.length);r++){let s=an(n[r]??null,d[r]??null,o,i);if(s!==0)return s}return 0}let p=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:k(r);if(p(n)!==p(d)||typeof n=="object"||typeof d=="object")throw new g(`sort(\u2026) cannot put ${k(n)} and ${k(d)} in order`,i);return typeof n=="string"?o*(n<d?-1:n>d?1:0):o*(Number(n)-Number(d))}return A(e,t.subject)}var ke=["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","round","concat","format","datetime","at","addMinutes","weekday","startOfWeek"];var re=(e,t,a,l,u)=>({severity:"error",code:e,path:t,message:a,...l?{fix:l}:{},...u}),Se=(e,t,a,l,u)=>({...re(e,t,a,l,u?.length?{edits:u}:void 0),severity:"warning"}),Ae=e=>e.some(t=>t.severity==="error");function oe(e,t){return[...(e.edits??[]).map(a=>`${t}edit: ${JSON.stringify(a)}`),...e.details?[`${t}details: ${e.details}`]:[],...(e.fixes??[]).flatMap(a=>[`${t}fix: ${a.label}`,...(a.edits??[]).map(l=>`${t} edit: ${JSON.stringify(l)}`)])].map(a=>`
1
+ import{F as W,G,H as sn,I as z,J as D,L as P,La as pn,M as dn,Q as ln,T as _,Ta as hn,U as un,V as fn,W as H,X as cn,Y,Z as q,ac as X,cb as mn,da as J,fa as B,gb as wn,ha as yn,hc as $n,ia as gn,ta as Q}from"./chunk.DHPXRDT5.js";var zn=864e5,j=e=>String(e).padStart(2,"0"),v=e=>new Date(e).toISOString().slice(0,10),E=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),Hn=(e,t)=>v(E(e)+t*zn),An=e=>new Date(E(e)).getUTCDay(),Yn=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e),nn=["sun","mon","tue","wed","thu","fri","sat"],Nn=e=>dn(e)??"UTC";function Mn(e,t){if(W.test(e))return v(E(e))===e?{day:e}:void 0;if(G.test(e))return{day:e.length===4?`${e}-01-01`:`${e}-01`};if(D.test(e)&&!Yn(e)){let l=e.slice(0,10);return v(E(l))!==l?void 0:{day:l,minutes:Number(e.slice(11,13))*60+Number(e.slice(14,16))}}let a=Date.parse(e);if(!Number.isNaN(a))return{...un(a,t),stamp:a}}var bn=["EEEE","EEE","MMMM","MMM","yyyy","HH","mm","h","a","d"],kn=/[A-Za-z]+/y;function qn(e){let t=[],a=0;for(;a<e.length;){let l=e[a];if(l==="'"){let f="",y=a+1;for(;y<e.length;y++){if(e[y]==="'"){if(e[y+1]==="'"){f+="'",y++;continue}break}f+=e[y]}if(y>=e.length)return`the quoted words in "${e}" are never closed`;t.push({text:f}),a=y+1;continue}kn.lastIndex=a;let u=kn.exec(e);if(u){let f=u[0];for(;f.length>0;){let y=bn.find($=>f.startsWith($));if(!y)return`"${f}" is not a piece of a date pattern; the pieces are ${bn.map($=>`${$}`).join(", ")}, and other words go in single quotes`;t.push(y),f=f.slice(y.length)}a+=u[0].length;continue}t.push({text:l}),a++}return t}var xn="UTC",Sn=new Map;function Jn(e,t){let a=`${e}|${JSON.stringify(t)}`,l=Sn.get(a);if(!l){try{l=new Intl.DateTimeFormat(e,{...t,timeZone:xn})}catch{l=new Intl.DateTimeFormat("en-US",{...t,timeZone:xn})}Sn.set(a,l)}return l}var C=(e,t,a,l)=>Jn(e,t).formatToParts(a).find(u=>u.type===l)?.value??"";function Rn(e,t,a){let l=qn(t);if(typeof l=="string")return{problem:l};let u=ln(a),f=E(e.day),y=e.minutes,$=y===void 0?void 0:f+y*6e4;return l.map(x=>{if(typeof x!="string")return x.text;switch(x){case"EEEE":return C(u,{weekday:"long"},f,"weekday");case"EEE":return C(u,{weekday:"short"},f,"weekday");case"MMMM":return C(u,{month:"long"},f,"month");case"MMM":return C(u,{month:"short"},f,"month");case"yyyy":return e.day.slice(0,4);case"d":return String(Number(e.day.slice(8,10)));case"HH":return y===void 0?"":j(Math.floor(y/60));case"mm":return y===void 0?"":j(y%60);case"h":return y===void 0?"":String((Math.floor(y/60)+11)%12+1);case"a":return $===void 0?"":C(u,{hour:"numeric",hour12:!0},$,"dayPeriod")}}).join("")}var Bn=/^(\d{1,2}):(\d{2})$/;function On(e){let t=Bn.exec(e.trim());if(!t)return;let a=Number(t[1]),l=Number(t[2]);return a<=23&&l<=59?a*60+l:void 0}var En=e=>new Date(e).toISOString().replace(/\.\d{3}Z$/,"Z"),Qn=(e,t)=>`${e}T${j(Math.floor(t/60))}:${j(t%60)}`;function Tn(e,t,a){return En(fn(e.day,t,a))}function Fn(e,t){if(e.stamp!==void 0)return En(e.stamp+t*6e4);let a=E(e.day)+(e.minutes??0)*6e4+t*6e4,l=v(a);return Qn(l,Math.round((a-E(l))/6e4))}var Gn=e=>nn[An(e.day)];function Dn(e,t){let a=(An(e.day)-nn.indexOf(t)+7)%7;return Hn(e.day,-a)}var Vn=e=>typeof e=="string"&&nn.includes(e);var Wn=1e4,w=class{constructor(t){this.nodes=t}},Cn=Symbol.for("@graview/core:far-record"),Xn=e=>typeof e=="object"&&e!==null&&e[Cn]===!0;function ne(e){let t={...e.fields,id:`@${e.address}/${e.kind}:${e.id}`,kind:`@${e.address}/${e.kind}`,label:e.label};return Object.defineProperty(t,Cn,{value:!0}),t}function be(e){let t=`the linked record in ${e.ref.address}`;return e.reason==="denied"?`${t} is not one this viewer may open`:`${t} has not been read`}var ee="",g=class extends Error{constructor(a,l){super(a);this.sentence=a;this.at=l}},en=class extends g{},T=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof w)&&typeof e.id=="string",_n=e=>{let t=new Set;return new w(e.filter(a=>!t.has(a.id)&&t.add(a.id)))},k=e=>e===null?"nothing":e instanceof w?"a set of records":Array.isArray(e)?"a list":T(e)?"a record":typeof e=="string"?"a word":typeof e;function te(e,t){if(!G.test(e)&&!G.test(t))return;let a=f=>z(D.test(f)?f.slice(0,10):f),l=a(e),u=a(t);return l&&u?[l,u]:void 0}function In(e,t){let a=t.budget??Wn,l=(n,d)=>{if(a-=n,a<0)throw new en("this rule looks at too much of the graph to judge in one go",d)},u=t.today??P(),f=t.now??new Date().toISOString(),y=Nn(t.timeZone),$=new Map,x=new Set,S=t.bindings,rn=(n,d,o,i)=>{let p=`${n?.id}\0${d}`;if($.has(p))return $.get(p);if(x.has(p))throw new g(`"${d}"${n?` of ${Q(n.kind)}`:""} depends on itself`,i);x.add(p);let r=S;S=void 0;let s=a;a=Math.max(s,Wn);try{let c=A(o,n);return $.set(p,c),c}finally{a=s,S=r,x.delete(p)}},I=(n,d,o)=>{l(1,o);let i=t.kinds.get(n.kind),p=i?.computed?.get(d);if(p)return rn(n,d,p,o);let r=i?.linked?.get(d);if(r){let h=pn(Object.hasOwn(n,d)?n[d]:void 0,r);l(h.length,o);let b=t.linked??hn(t.graph),m=h.flatMap(N=>{let K=b?b(N):{unread:!0};return"record"in K?[ne(K.record)]:(t.onUnread?.({relation:d,ref:N,reason:"denied"in K?"denied":"unread"}),[])});return r.cardinality==="one"?m[0]??null:new w(m)}let s=Object.hasOwn(n,d);if(i?.fields.has(d)||s){let h=s?mn(n,d,u):void 0;return h===void 0?null:h}let c=i?.edges.get(d);if(c){let h=t.graph.out(n.id,d);return l(h.length,o),c==="one"?h[0]??null:new w(h)}if(d==="id")return n.id;if(Xn(n))return null;throw new g(`${Q(n.kind)} has no field or relation called "${d}"`,o)},M=(n,d,o)=>{if(n instanceof w)return n;if(n===null)return new w([]);if(T(n))return new w([n]);throw new g(`${o}(\u2026) needs a set of records, and was given ${k(n)}`,d)},O=(n,d,o)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new g(`${o}(\u2026) needs a word, and was given ${k(n)}`,d)},Z=(n,d,o)=>{let i=O(n,d,o);if(i===null)return null;let p=G.test(i)?z(i).from:i,r=Date.parse(p.length===10?`${p}T00:00:00Z`:p);if(Number.isNaN(r))throw new g(`${o}(\u2026) needs a date, and "${i}" is not one`,d);return r},V=(n,d,o)=>{if(n===null)return null;if(typeof n!="string")throw new g(`${o}(\u2026) needs a date, and was given ${k(n)}`,d);let i=Mn(n,y);if(!i)throw new g(`${o}(\u2026) needs a date, and "${n}" is not one`,d);return i},F=(n,d)=>T(n)&&T(d)?n.id===d.id:T(n)&&typeof d=="string"?n.id===d:typeof n=="string"&&T(d)?n===d.id:Array.isArray(n)&&Array.isArray(d)?n.length===d.length&&n.every((o,i)=>F(o,d[i])):n===d,R=(n,d,o)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new g(`${o} must be true or false, and was ${k(n)}`,d)},L=(n,d)=>A(d,n);function A(n,d){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(o=>A(o,d));case"ident":{let o=S&&Object.hasOwn(S,n.name)?S[n.name]:void 0;if(o!==void 0)return o;if(d)return I(d,n.name,n.at);throw new g(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let o=A(n.object,d);if(o===null)return null;if(T(o))return I(o,n.name,n.at);throw new g(`".${n.name}" needs a record before it, and was given ${k(o)}`,n.at)}case"unary":{let o=A(n.operand,d);if(n.op==="!")return!R(o,n.at,"what follows not");if(o===null)return null;if(typeof o!="number")throw new g(`"-" needs a number, and was given ${k(o)}`,n.at);return-o}case"where":{let o=M(A(n.set,d),n.at,"where");return l(o.nodes.length,n.at),new w(o.nodes.filter(i=>R(L(i,n.filter),n.at,"a where condition")))}case"binary":return Zn(n,d);case"call":return Kn(n,d)}}function Zn(n,d){if(n.op==="&&")return R(A(n.left,d),n.at,"each side of and")&&R(A(n.right,d),n.at,"each side of and");if(n.op==="||")return R(A(n.left,d),n.at,"each side of or")||R(A(n.right,d),n.at,"each side of or");let o=A(n.left,d),i=A(n.right,d);if(n.op==="&"||n.op==="|"||n.op==="-"&&(o instanceof w||i instanceof w)){let p=M(o,n.at,n.op).nodes,r=M(i,n.at,n.op).nodes;l(p.length+r.length,n.at);let s=new Set(r.map(c=>c.id));return _n(n.op==="|"?[...p,...r]:p.filter(c=>s.has(c.id)===(n.op==="&")))}switch(n.op){case"==":return F(o,i);case"!=":return!F(o,i);case"in":{if(i===null)return!1;if(i instanceof w)return i.nodes.some(p=>F(o,p));if(Array.isArray(i))return i.some(p=>F(o,p));if(typeof i=="string"&&typeof o=="string")return i.includes(o);throw new g(`"in" needs a list or a set on its right, and was given ${k(i)}`,n.at)}case"<":case"<=":case">":case">=":{if(o===null||i===null)return!1;if(!(typeof o=="number"&&typeof i=="number"||typeof o=="string"&&typeof i=="string"))throw new g(`cannot compare ${k(o)} with ${k(i)}`,n.at);let r=typeof o=="string"&&typeof i=="string"?te(o,i):void 0;if(r){let[s,c]=r,h=s.to<c.from,b=s.from>c.to,m=s.from===c.from&&s.to===c.to;return n.op==="<"?h:n.op==="<="?h||m:n.op===">"?b:b||m}return n.op==="<"?o<i:n.op==="<="?o<=i:n.op===">"?o>i:o>=i}default:{if(o===null||i===null)return null;if(n.op==="+"&&(typeof o=="string"||typeof i=="string")){let p=`${O(o,n.at,"+")}${O(i,n.at,"+")}`;if(p.length>1e4)throw new g("that makes a word too long",n.at);return p}if(typeof o!="number"||typeof i!="number")throw new g(`"${n.op}" needs numbers, and was given ${k(o)} and ${k(i)}`,n.at);return(n.op==="/"||n.op==="%")&&i===0?null:n.op==="+"?o+i:n.op==="-"?o-i:n.op==="*"?o*i:n.op==="/"?o/i:o%i}}}function on(n,d){let o=n.t==="call"&&(n.fn==="in"||n.fn==="out")&&n.args.length===1?n.args[0]:void 0;if(!(!d||o?.t!=="lit"||typeof o.value!="string"))return l(1,n.at),n.fn==="out"?t.graph.out(d.id,o.value):t.graph.in(d.id,o.value)}function Kn(n,d){let o=(r,s=r)=>{if(n.args.length<r||n.args.length>s)throw new g(`${n.fn}(\u2026) takes ${r===s?r:`${r} to ${s}`} argument${s===1?"":"s"}`,n.at)},i=r=>A(n.args[r],d),p=r=>{let s=i(r);if(typeof s!="string")throw new g(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return s};switch(n.fn){case"out":case"in":{o(1,2);let r=(h,b)=>n.fn==="out"?t.graph.out(h,b):t.graph.in(h,b);if(n.args.length===2){let h=M(i(0),n.at,n.fn).nodes,b=p(1);return _n(h.flatMap(m=>{let N=r(m.id,b);return l(N.length+1,n.at),N}))}let s=p(0);if(!d)throw new g(`${n.fn}('${s}') needs a record to start from`,n.at);let c=r(d.id,s);return l(c.length,n.at),new w(c)}case"all":{o(1,2);let r=t.graph.nodesOfKind(p(0),{archived:n.args.length===2?i(1):!1});return l(r.length,n.at),new w(r)}case"archived":return o(0,1),wn(n.args.length===1?i(0):d);case"count":return o(1),(on(n.args[0],d)??M(i(0),n.at,"count").nodes).length;case"exists":return o(1),(on(n.args[0],d)??M(i(0),n.at,"exists").nodes).length>0;case"every":case"some":{o(2);let r=M(i(0),n.at,n.fn);l(r.nodes.length,n.at);let s=c=>R(L(c,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(s):r.nodes.some(s)}case"sum":case"min":case"max":{o(2);let r=M(i(0),n.at,n.fn);l(r.nodes.length,n.at);let s=n.args[1],c=s.t==="lit"&&typeof s.value=="string"?s.value:void 0,h=s.t==="ident"?`'${s.name}'`:c!==void 0?`'${c}'`:"\u2026",b=r.nodes.map(m=>s.t==="ident"?I(m,s.name,n.at):c!==void 0?I(m,c,n.at):L(m,s)).filter(m=>{if(m===null)return!1;if(typeof m!="number")throw new g(`${n.fn}(\u2026, ${h}) needs a number for each member, and found ${k(m)}`,n.at);return!0});return n.fn==="sum"?b.reduce((m,N)=>m+N,0):b.length===0?null:n.fn==="min"?Math.min(...b):Math.max(...b)}case"fact":{o(1);let r=p(0),s=t.kinds.get(ee)?.computed?.get(r);if(!s)throw new g(`no fact is called "${r}"`,n.at);return rn(null,r,s,n.at)}case"first":return o(1),M(i(0),n.at,"first").nodes[0]??null;case"sort":{o(2,3);let r=M(i(0),n.at,"sort"),s=n.args.length===3?i(2):"asc";if(s!=="asc"&&s!=="desc")throw new g("sort(\u2026) goes 'asc' or 'desc'",n.at);let c=r.nodes.length;l(c+c*Math.ceil(Math.log2(c+1)),n.at);let h=r.nodes.map((m,N)=>({node:m,i:N,key:L(m,n.args[1])})),b=s==="desc"?-1:1;return h.sort((m,N)=>an(m.key,N.key,b,n.at)||m.i-N.i),new w(h.map(m=>m.node))}case"either":{if(n.args.length<1)throw new g("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let s=i(r);if(s!==null&&!(s instanceof w&&s.nodes.length===0))return s}return null}case"present":{o(1);let r=i(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof w?r.nodes.length>0:!0}case"len":{o(1);let r=i(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof w)return r.nodes.length;throw new g(`len(\u2026) needs a word or a list, and was given ${k(r)}`,n.at)}case"contains":case"startsWith":{o(2);let r=i(0),s=i(1);if(r===null||s===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(b=>F(b,s));let c=O(r,n.at,n.fn),h=O(s,n.at,n.fn);return n.fn==="contains"?c.toLowerCase().includes(h.toLowerCase()):c.startsWith(h)}case"lower":{o(1);let r=O(i(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"concat":{if(n.args.length<1)throw new g("concat(\u2026) takes at least one argument",n.at);let r="";for(let s=0;s<n.args.length;s++)r+=O(i(s),n.at,"concat")??"";if(r.length>1e4)throw new g("that makes a word too long",n.at);return r}case"format":{o(2);let r=V(i(0),n.at,"format"),s=i(1);if(typeof s!="string")throw new g("format(\u2026) says its pattern in quotes, like format(start, 'EEE h:mm a')",n.at);if(r===null)return null;let c=Rn(r,s,t.locale);if(typeof c!="string")throw new g(c.problem,n.at);return c}case"datetime":case"at":{o(2);let r=V(i(0),n.at,n.fn),s=i(1);if(s===null||r===null)return null;let c=typeof s=="string"?On(s):void 0;if(c===void 0)throw new g(`${n.fn}(\u2026) needs a time of day written like '09:30', and was given ${typeof s=="string"?`"${s}"`:k(s)}`,n.at);return Tn(r,c,y)}case"addMinutes":{o(2);let r=V(i(0),n.at,"addMinutes"),s=i(1);if(r===null||s===null)return null;if(typeof s!="number"||!Number.isFinite(s))throw new g(`addMinutes(\u2026) needs a number of minutes, and was given ${k(s)}`,n.at);return Fn(r,Math.round(s))}case"weekday":{o(1);let r=V(i(0),n.at,"weekday");return r===null?null:Gn(r)}case"startOfWeek":{o(1,2);let r=V(i(0),n.at,"startOfWeek"),s=n.args.length===2?i(1):"mon";if(!Vn(s))throw new g("startOfWeek(\u2026) starts the week on a day said 'mon' to 'sun'",n.at);return r===null?null:Dn(r,s)}case"today":return o(0),u;case"now":return o(0),f;case"date":{o(1);let r=Z(i(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{o(2);let r=Z(i(0),n.at,n.fn),s=Z(i(1),n.at,n.fn);if(r===null||s===null)return null;let c=(s-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(c):c}case"round":{o(1,2);let r=i(0);if(r===null)return null;if(typeof r!="number")throw new g(`round(\u2026) needs a number, and was given ${k(r)}`,n.at);let s=n.args.length===2?i(1):0;if(typeof s!="number"||!Number.isInteger(s)||s<0||s>12)throw new g("round(\u2026, places) takes a whole number of places from 0 to 12",n.at);let c=10**s,h=Math.sign(r)*Math.round(Math.abs(r)*c*(1+Number.EPSILON))/c;return Object.is(h,-0)?0:h}case"if":return o(3),R(i(0),n.at,"the condition in if(\u2026)")?i(1):i(2);default:throw new g(`"${n.fn}" is not a function the rule language knows`,n.at)}}function an(n,d,o,i){if(n===null||d===null)return n===d?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(d)){for(let r=0;r<Math.max(n.length,d.length);r++){let s=an(n[r]??null,d[r]??null,o,i);if(s!==0)return s}return 0}let p=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:k(r);if(p(n)!==p(d)||typeof n=="object"||typeof d=="object")throw new g(`sort(\u2026) cannot put ${k(n)} and ${k(d)} in order`,i);return typeof n=="string"?o*(n<d?-1:n>d?1:0):o*(Number(n)-Number(d))}return A(e,t.subject)}var ke=["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","round","concat","format","datetime","at","addMinutes","weekday","startOfWeek"];var re=(e,t,a,l,u)=>({severity:"error",code:e,path:t,message:a,...l?{fix:l}:{},...u}),Se=(e,t,a,l,u)=>({...re(e,t,a,l,u?.length?{edits:u}:void 0),severity:"warning"}),Ae=e=>e.some(t=>t.severity==="error");function oe(e,t){return[...(e.edits??[]).map(a=>`${t}edit: ${JSON.stringify(a)}`),...e.details?[`${t}details: ${e.details}`]:[],...(e.fixes??[]).flatMap(a=>[`${t}fix: ${a.label}`,...(a.edits??[]).map(l=>`${t} edit: ${JSON.stringify(l)}`)])].map(a=>`
2
2
  ${a}`).join("")}function Ne(e){return e.map(t=>`${t.severity==="error"?"\u2717":t.severity==="warning"?"!":"\xB7"} ${t.path||"(document)"}: ${t.message}${t.fix?` \u2014 ${t.fix}`:""}${oe(t," ")}`).join(`
3
3
  `)}var ie=(e,t)=>e.to==="*"||e.to.includes(t);function Ln(e,t,a){let l=a(e);if(l){if(t.some(u=>l.from.includes(u)))return{step:{relation:e,out:!0},far:l.to};if(t.some(u=>ie(l,u)))return{step:{relation:e,out:!1},far:l.from}}}function Re(e,t,a,l){if(!l(t.every))return{problem:{key:"every",message:`"${t.every}" is not a kind this document declares`}};let u=Ln(t.through,[e],a);if(!u){let S=a(t.through);return{problem:{key:"through",message:S?`"${t.through}" is a relation of ${S.from.join(", ")}, not of ${e}, so a ${e} cannot be followed through it`:`"${t.through}" is not a relation any kind declares`,fix:S?`name a relation ${e} declares, or one that points at ${e}`:void 0}}}let f=u.far==="*"?"*":u.far;if(!t.via)return f==="*"||f.includes(t.every)?{plan:{every:t.every,through:u.step}}:{problem:{key:"through",message:`"${t.through}" reaches ${f.join(", ")}, not ${t.every}`,fix:`add "via": the relation from ${f.join(" or ")} to ${t.every}, or name a relation that reaches ${t.every}`}};let y=f==="*"?[t.every]:f,$=Ln(t.via,y,a);if(!$){let S=a(t.via);return{problem:{key:"via",message:S?`"${t.via}" is a relation of ${S.from.join(", ")}, which "${t.through}" does not reach`:`"${t.via}" is not a relation any kind declares`,fix:S?`name a relation of ${y.join(" or ")}, or one that points at it`:void 0}}}let x=f==="*"?[t.every]:$.far;return x==="*"||x.includes(t.every)?{plan:{every:t.every,through:u.step,via:f==="*"?{relation:$.step.relation,out:!$.step.out}:$.step}}:{problem:{key:"via",message:`"${t.via}" reaches ${x.join(", ")}, not ${t.every}`,fix:`name a relation that reaches ${t.every}`}}}var Pn=(e,t,a)=>a.out?e.out(t,a.relation):e.in(t,a.relation);function Oe(e,t,a){let l=new Set;for(let u of Pn(e,t.id,a.through)){if(!a.via){l.add(u.id);continue}for(let f of Pn(e,u.id,a.via))l.add(f.id)}return e.nodesOfKind(a.every).filter(u=>!l.has(u.id))}var _e=["money","percent","date","time","datetime","relative","upper","lower","count","words","and","plural","excerpt"],ae={getNode:()=>{},allNodes:()=>[],allEdges:()=>[],nodesOfKind:()=>[],edgesOfKind:()=>[],out:()=>[],in:()=>[],neighbors:()=>[],has:()=>!1};function Ce(e,t,a,l=[],u,f=U){return tn(e,t,a,l,u,f)}var jn=(e,t)=>e.capital?J(t):t,se=new Set(["words","plural","relative"]);function Ie(e,t){let a=e[0];return!a||a.text!==void 0||!a.format||!se.has(a.format)?t:/^[a-z][a-z'’-]*(?=\s|$|[,.;:!?])/.test(t)?J(t):t}function de(e){return e?t=>{let a=e.tryDefinition(t.kind)?.label;return a?a(t):U(t)}:U}var vn=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],Un=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function le(e,t){return!Number.isInteger(e)||e<0||e>99?q(e,t):e<20?vn[e]:e%10===0?Un[e/10]:`${Un[Math.floor(e/10)]}-${vn[e%10]}`}function ue(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 U=e=>String(e.name??e.title??e.label??e.id);function tn(e,t,a,l=[],u,f=U){if(t==="plural"){let y=e instanceof w?e.nodes.length:Array.isArray(e)?e.length:typeof e=="number"?e:null;return y===null||l[0]===void 0?"\u2014":y===1?l[0]:l[1]??ue(l[0])}if(e===null)return"\u2014";if(e instanceof w)return t==="count"?String(e.nodes.length):t==="and"?B(e.nodes.map(f)):e.nodes.map(f).join(", ");if(Array.isArray(e)){if(t==="count")return String(e.length);let y=e.map($=>tn($,void 0,a,[],u,f));return t==="and"?B(y):y.join(", ")}if(typeof e=="object")return f(e);switch(t){case"words":return typeof e=="number"?le(e,u?.locale):String(e);case"money":return typeof e=="number"?X(e,u,l[0]==="0"?0:void 0):String(e);case"percent":return typeof e=="number"?q(e,u?.locale,{style:"percent",maximumFractionDigits:0}):String(e);case"upper":return String(e).toUpperCase();case"lower":return String(e).toLowerCase();case"excerpt":return $n(String(e),Number(l[0])||void 0);case"date":return _(Y(String(e),u?.timeZone)??String(e).slice(0,10),u?.locale);case"time":return typeof e=="string"&&W.test(e)?_(e,u?.locale):cn(String(e),u?.locale,u?.timeZone);case"datetime":return typeof e=="string"&&W.test(e)?_(e,u?.locale):H(String(e),u?.locale,u?.timeZone);case"relative":{let y=Y(String(e),u?.timeZone),$=y===void 0?Date.parse(String(e)):Date.parse(`${y}T00:00:00Z`);if(Number.isNaN($))return String(e);let x=Math.round(($-Date.parse(`${a}T00:00:00Z`))/864e5);return x===0?"today":x===1?"tomorrow":x===-1?"yesterday":x>0?`in ${x} days`:`${-x} days ago`}default:return typeof e=="string"&&sn.test(e)?_(e,u?.locale):typeof e=="string"&&D.test(e)?H(e,u?.locale,u?.timeZone):String(e)}}function fe(e,t,a){return(Array.isArray(e)?e:[e]).map(l=>t[String(l)]??(a?yn(String(l)):gn(String(l)))).join(", ")}function Le(e,t){let a=t.today??P(),l=t.name??de(t.graph?.schema);return e.map(u=>{if(u.text!==void 0)return u.text;try{let f=In(u.expr,{graph:t.graph??ae,subject:t.node,kinds:t.kinds,today:a,budget:t.budget??500,...t.bindings?{bindings:t.bindings}:{}}),y=!u.format&&u.expr.t==="ident"&&t.node?t.kinds.get(t.node.kind)?.choices?.get(u.expr.name):void 0;return y&&(typeof f=="string"||Array.isArray(f))?jn(u,fe(f,y,e.length===1)):jn(u,tn(f,u.format,a,u.formatArgs,t.money,l))}catch(f){if(f instanceof g)return"\u2014";throw f}}).join("")}export{w as a,be as b,ee as c,g as d,en as e,In as f,ke as g,re as h,Se as i,Ae as j,Ne as k,_e as l,ae as m,Ce as n,jn as o,Ie as p,de as q,fe as r,Le as s,Re as t,Oe as u};