graview 0.1.40 → 0.1.42

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 (174) hide show
  1. package/dist/preview/chunk.22QEYFWI.js +1 -0
  2. package/dist/preview/{chunk.YWNHCZQ5.js → chunk.27P37343.js} +1 -1
  3. package/dist/preview/{chunk.D25XEVKO.js → chunk.2ZGICECC.js} +1 -1
  4. package/dist/preview/{chunk.6PSWHBL2.js → chunk.35FR36BQ.js} +1 -1
  5. package/dist/preview/chunk.36LP3I7Z.js +21 -0
  6. package/dist/preview/{chunk.JDRLSVOI.js → chunk.37NF3YXZ.js} +1 -1
  7. package/dist/preview/chunk.3JATXDSP.js +1 -0
  8. package/dist/preview/{chunk.2JB4Y2ET.js → chunk.3K2KBIRG.js} +1 -1
  9. package/dist/preview/chunk.3SKUJWFC.js +1 -0
  10. package/dist/preview/{chunk.47KHZCNG.js → chunk.3WABA2WQ.js} +1 -1
  11. package/dist/preview/{chunk.FFZBOP65.js → chunk.4NBB44YU.js} +1 -1
  12. package/dist/preview/chunk.4QEDYRES.js +349 -0
  13. package/dist/preview/{chunk.YYIKSH2F.js → chunk.4YBP552Z.js} +2 -2
  14. package/dist/preview/{chunk.XQHDP5C3.js → chunk.4YRCKOX2.js} +1 -1
  15. package/dist/preview/{chunk.WVDKYUF3.js → chunk.57R4ZUMM.js} +1 -1
  16. package/dist/preview/{chunk.VNUHESMZ.js → chunk.5FHH5NR6.js} +1 -1
  17. package/dist/preview/{chunk.XRYTJNA7.js → chunk.5NDYYTT4.js} +1 -1
  18. package/dist/preview/{chunk.4VG2KN7G.js → chunk.6HUS5UHZ.js} +1 -1
  19. package/dist/preview/{chunk.YYFLTMNN.js → chunk.6MLAJKYM.js} +1 -1
  20. package/dist/preview/{chunk.T3TYD7QI.js → chunk.6NF32PAT.js} +1 -1
  21. package/dist/preview/chunk.6WB24MS3.js +1 -0
  22. package/dist/preview/{chunk.Z7LDT55A.js → chunk.7EB6SDUQ.js} +1 -1
  23. package/dist/preview/chunk.7HZVCW3Q.js +1 -0
  24. package/dist/preview/{chunk.DPZTW24D.js → chunk.7MJM3OVC.js} +1 -1
  25. package/dist/preview/chunk.7OSL64QH.js +1 -0
  26. package/dist/preview/chunk.7XDNCCLG.js +6 -0
  27. package/dist/preview/{chunk.S356ACK2.js → chunk.7Z2GTKA4.js} +1 -1
  28. package/dist/preview/{chunk.GT2BITLW.js → chunk.AOC2KUFE.js} +1 -1
  29. package/dist/preview/{chunk.6FNMDAX5.js → chunk.AQTCN7KQ.js} +1 -1
  30. package/dist/preview/{chunk.5RABSIF7.js → chunk.ARTJL3X2.js} +1 -1
  31. package/dist/preview/{chunk.JQEYZB5I.js → chunk.AWSUMY3D.js} +1 -1
  32. package/dist/preview/{chunk.H6XKMLDQ.js → chunk.B65HPL4I.js} +1 -1
  33. package/dist/preview/{chunk.4QPVS2ZM.js → chunk.B6DKKNVR.js} +1 -1
  34. package/dist/preview/{chunk.PPG2SEIY.js → chunk.B7DCQJXV.js} +1 -1
  35. package/dist/preview/chunk.BBLIT7S7.js +1 -0
  36. package/dist/preview/chunk.BJET6KOG.js +1 -0
  37. package/dist/preview/{chunk.I7XSDXQ3.js → chunk.BZ4VZ6WQ.js} +1 -1
  38. package/dist/preview/{chunk.67WWRC6Y.js → chunk.CAZX6OPN.js} +1 -1
  39. package/dist/preview/{chunk.BSAXZQSY.js → chunk.CSWX7YGI.js} +1 -1
  40. package/dist/preview/chunk.D3ELYLME.js +1 -0
  41. package/dist/preview/{chunk.ETOGQE2V.js → chunk.DNMBZONP.js} +1 -1
  42. package/dist/preview/{chunk.G6VZNRQ5.js → chunk.DXAUXGNN.js} +1 -1
  43. package/dist/preview/{chunk.LPE4FLC6.js → chunk.EC2T2UVH.js} +2 -2
  44. package/dist/preview/chunk.EHMCRUYR.js +1 -0
  45. package/dist/preview/{chunk.STI447YW.js → chunk.EQIQPY4O.js} +1 -1
  46. package/dist/preview/{chunk.VZYCILPJ.js → chunk.ETWOZQWL.js} +1 -1
  47. package/dist/preview/{chunk.LPBM5AES.js → chunk.EVHXF7LZ.js} +1 -1
  48. package/dist/preview/{chunk.6J37UQKG.js → chunk.FFRWSODT.js} +1 -1
  49. package/dist/preview/chunk.G4AY6NGN.js +1 -0
  50. package/dist/preview/{chunk.ZGCRMNER.js → chunk.GN2SZEFH.js} +1 -1
  51. package/dist/preview/{chunk.ZK3X23EU.js → chunk.GXWOEOUY.js} +1 -1
  52. package/dist/preview/{chunk.ISXFH3CK.js → chunk.HAY22FPJ.js} +1 -1
  53. package/dist/preview/{chunk.42XSBKPO.js → chunk.HG2IO5NS.js} +1 -1
  54. package/dist/preview/{chunk.UOPKRN55.js → chunk.HOTOH7ZB.js} +1 -1
  55. package/dist/preview/chunk.HQMGTPDC.js +117 -0
  56. package/dist/preview/{chunk.C2PECN4C.js → chunk.I7QCXRP7.js} +1 -1
  57. package/dist/preview/{chunk.ESSSNLEO.js → chunk.IGA7OD3L.js} +1 -1
  58. package/dist/preview/{chunk.GY6RYJHM.js → chunk.ILPD5CZG.js} +1 -1
  59. package/dist/preview/chunk.IQ3LUSD6.js +6 -0
  60. package/dist/preview/chunk.IWLVZGW5.js +1 -0
  61. package/dist/preview/chunk.IXS5XBG6.js +1 -0
  62. package/dist/preview/{chunk.ZHLQWMV5.js → chunk.J7ZMNAWB.js} +1 -1
  63. package/dist/preview/{chunk.6AVZWLRF.js → chunk.JCTT2LAK.js} +1 -1
  64. package/dist/preview/{chunk.FOQZADMA.js → chunk.JE4QQEJE.js} +1 -1
  65. package/dist/preview/{chunk.CL2ZS5EQ.js → chunk.JEBB3WM7.js} +1 -1
  66. package/dist/preview/{chunk.OW7NSJ4H.js → chunk.JPD2I4Z7.js} +1 -1
  67. package/dist/preview/{chunk.MIM2QLF5.js → chunk.K63BUJBF.js} +2 -2
  68. package/dist/preview/{chunk.GTV2VZAS.js → chunk.KMGGP6XT.js} +2 -2
  69. package/dist/preview/{chunk.P5ODICND.js → chunk.KZDLDXLB.js} +1 -1
  70. package/dist/preview/{chunk.BFNVG5JE.js → chunk.L6HKDIZB.js} +1 -1
  71. package/dist/preview/{chunk.2FLPDPEL.js → chunk.LFJH6X6O.js} +1 -1
  72. package/dist/preview/{chunk.7WPCP2LZ.js → chunk.LKGDN25E.js} +1 -1
  73. package/dist/preview/{chunk.IDUPJMJO.js → chunk.LMUFLZYT.js} +1 -1
  74. package/dist/preview/chunk.LQGXUMUX.js +1 -0
  75. package/dist/preview/{chunk.UTCB3CE7.js → chunk.LWAZ6ZO6.js} +2 -2
  76. package/dist/preview/{chunk.CNFL5IN5.js → chunk.LZH65VSN.js} +1 -1
  77. package/dist/preview/{chunk.H5HWN7A2.js → chunk.MUBZIU6F.js} +1 -1
  78. package/dist/preview/chunk.MZ6I2Q4E.js +1 -0
  79. package/dist/preview/{chunk.UWW6ZEPY.js → chunk.NS3Z7QNP.js} +1 -1
  80. package/dist/preview/{chunk.7LIKEE5Z.js → chunk.NTJNBKWC.js} +1 -1
  81. package/dist/preview/chunk.O7VHAKSA.js +2 -0
  82. package/dist/preview/{chunk.Q4TZHWQX.js → chunk.OMCXJGDI.js} +1 -1
  83. package/dist/preview/chunk.OTHGZPUC.js +1 -0
  84. package/dist/preview/{chunk.VF7P3ZVZ.js → chunk.P6FGIYWP.js} +1 -1
  85. package/dist/preview/{chunk.6JEU3ZNE.js → chunk.P6J6VFF5.js} +1 -1
  86. package/dist/preview/{chunk.ACBUAIDF.js → chunk.P7ISPJAQ.js} +1 -1
  87. package/dist/preview/{chunk.HB7ELBVK.js → chunk.PACJFDDU.js} +1 -1
  88. package/dist/preview/{chunk.2RVUDRRY.js → chunk.PCTVLNOS.js} +1 -1
  89. package/dist/preview/{chunk.BXT6FDT4.js → chunk.PH5ITX3N.js} +1 -1
  90. package/dist/preview/chunk.PYFQGBU3.js +1 -0
  91. package/dist/preview/{chunk.AWX7GP72.js → chunk.QHLD4TZW.js} +1 -1
  92. package/dist/preview/{chunk.ZJMDLRC5.js → chunk.QHP7AJUV.js} +1 -1
  93. package/dist/preview/{chunk.AKQXF7GW.js → chunk.QXMTGLHR.js} +1 -1
  94. package/dist/preview/{chunk.AVKDWISO.js → chunk.RFCTUGMU.js} +1 -1
  95. package/dist/preview/chunk.ROHM3ETN.js +49 -0
  96. package/dist/preview/{chunk.SIGC3G7S.js → chunk.RR4RZH4S.js} +1 -1
  97. package/dist/preview/chunk.RRCPEHM4.js +1 -0
  98. package/dist/preview/{chunk.FDE3TSTK.js → chunk.S5K4FLLG.js} +1 -1
  99. package/dist/preview/{chunk.ZRLXVYPG.js → chunk.SUQU4AXG.js} +1 -1
  100. package/dist/preview/{chunk.TIH2PDFH.js → chunk.SZKVNPEF.js} +1 -1
  101. package/dist/preview/chunk.T3F6BKIO.js +1 -0
  102. package/dist/preview/{chunk.2GDXNTY5.js → chunk.U3MQUIJL.js} +1 -1
  103. package/dist/preview/{chunk.H5ADMSE7.js → chunk.U6YOAS4X.js} +1 -1
  104. package/dist/preview/chunk.UG727PEE.js +5 -0
  105. package/dist/preview/{chunk.NGDXH66B.js → chunk.V3K32XD7.js} +1 -1
  106. package/dist/preview/{chunk.QIV65FWE.js → chunk.V5VQCANB.js} +1 -1
  107. package/dist/preview/{chunk.RCM7NOPF.js → chunk.VEP4EJ2N.js} +1 -1
  108. package/dist/preview/chunk.VKJAGZNU.js +2 -0
  109. package/dist/preview/{chunk.N2K25KH3.js → chunk.VMBIFUYX.js} +1 -1
  110. package/dist/preview/{chunk.35PHXNOC.js → chunk.VO6DBVZR.js} +1 -1
  111. package/dist/preview/{chunk.UUBYFBPN.js → chunk.VTUMPH4Z.js} +1 -1
  112. package/dist/preview/{chunk.3Q75TIGL.js → chunk.VXZFW52D.js} +1 -1
  113. package/dist/preview/{chunk.PYNYHNDS.js → chunk.VYPR2MZO.js} +1 -1
  114. package/dist/preview/chunk.W77OH637.js +1 -0
  115. package/dist/preview/{chunk.HPAGOEZG.js → chunk.WERBD5ZR.js} +1 -1
  116. package/dist/preview/{chunk.2WACBAUN.js → chunk.WODEO2JF.js} +2 -2
  117. package/dist/preview/{chunk.JACGQ2PR.js → chunk.WUQOSVQU.js} +2 -2
  118. package/dist/preview/{chunk.N6MVK3KD.js → chunk.WVN62OMH.js} +1 -1
  119. package/dist/preview/{chunk.Z5AB2DBF.js → chunk.WZEA2UK6.js} +1 -1
  120. package/dist/preview/{chunk.VJXXCUKS.js → chunk.X2M7IOQA.js} +1 -1
  121. package/dist/preview/chunk.X5WIS4BC.js +1 -0
  122. package/dist/preview/{chunk.UHI3D7JC.js → chunk.XDPIS7RS.js} +1 -1
  123. package/dist/preview/{chunk.VIYECFKZ.js → chunk.XNW7PUAF.js} +1 -1
  124. package/dist/preview/chunk.XPML6T3P.js +1 -0
  125. package/dist/preview/{chunk.XEKLEHC3.js → chunk.Y2QDZLSY.js} +1 -1
  126. package/dist/preview/{chunk.R5WY567U.js → chunk.YJM23BJL.js} +1 -1
  127. package/dist/preview/chunk.YLGSXLXF.js +1 -0
  128. package/dist/preview/chunk.YLI6I6XP.js +1 -0
  129. package/dist/preview/chunk.YRYEWVNP.js +1 -0
  130. package/dist/preview/chunk.Z2TYCMBT.js +5 -0
  131. package/dist/preview/chunk.ZAFIZXGX.js +1 -0
  132. package/dist/preview/{chunk.IFTWVUJO.js → chunk.ZBYLAC3B.js} +1 -1
  133. package/dist/preview/chunk.ZOS5APMD.js +1 -0
  134. package/dist/preview/{chunk.TGVUIFKD.js → chunk.ZQCGDTQ3.js} +1 -1
  135. package/dist/preview/chunk.ZRIDKFTV.js +1 -0
  136. package/dist/preview/index.html +45 -45
  137. package/dist/preview/page.js +3 -3
  138. package/package.json +6 -6
  139. package/dist/preview/chunk.242EUAPE.js +0 -1
  140. package/dist/preview/chunk.2CF2XKOS.js +0 -1
  141. package/dist/preview/chunk.2FGYWAID.js +0 -1
  142. package/dist/preview/chunk.2NXH7VAI.js +0 -1
  143. package/dist/preview/chunk.2OSNYF5C.js +0 -1
  144. package/dist/preview/chunk.6CRRPXKP.js +0 -1
  145. package/dist/preview/chunk.74NOI7QN.js +0 -1
  146. package/dist/preview/chunk.AUBGUDO5.js +0 -1
  147. package/dist/preview/chunk.BNVMMOOY.js +0 -1
  148. package/dist/preview/chunk.CN5WAKHJ.js +0 -5
  149. package/dist/preview/chunk.DL26BKT7.js +0 -1
  150. package/dist/preview/chunk.GZIVMOY4.js +0 -117
  151. package/dist/preview/chunk.H7POIT3V.js +0 -1
  152. package/dist/preview/chunk.HFYUAK5Z.js +0 -6
  153. package/dist/preview/chunk.J2CR4RRH.js +0 -1
  154. package/dist/preview/chunk.J4IULZFD.js +0 -1
  155. package/dist/preview/chunk.JLDBFX6O.js +0 -1
  156. package/dist/preview/chunk.L3A6YLMT.js +0 -21
  157. package/dist/preview/chunk.LLEFYJPJ.js +0 -344
  158. package/dist/preview/chunk.LOZJQ5ZX.js +0 -1
  159. package/dist/preview/chunk.O5JKDFDH.js +0 -1
  160. package/dist/preview/chunk.O6F3K6CU.js +0 -1
  161. package/dist/preview/chunk.QCWZSSNC.js +0 -1
  162. package/dist/preview/chunk.S2U5CEP4.js +0 -1
  163. package/dist/preview/chunk.T73RB7LC.js +0 -1
  164. package/dist/preview/chunk.TD2LNFUB.js +0 -1
  165. package/dist/preview/chunk.TNESS3LQ.js +0 -2
  166. package/dist/preview/chunk.V5MYKNL7.js +0 -5
  167. package/dist/preview/chunk.VDAMCTNL.js +0 -1
  168. package/dist/preview/chunk.W4HBRXMY.js +0 -1
  169. package/dist/preview/chunk.W7R2GFBW.js +0 -47
  170. package/dist/preview/chunk.WBLHCH5M.js +0 -1
  171. package/dist/preview/chunk.XFZKP4IF.js +0 -2
  172. package/dist/preview/chunk.XQTMO5PW.js +0 -1
  173. package/dist/preview/chunk.YO24NALN.js +0 -1
  174. package/dist/preview/chunk.ZOR6FKNI.js +0 -1
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{L as M,N as H,tb as N}from"./chunk.UG727PEE.js";var z=()=>(__graviewPreload(import.meta.url,["./chunk.2ZGICECC.js","./chunk.PXQVXBNG.js","./chunk.UG727PEE.js","./chunk.AJZBJBMO.js"]),import("./chunk.SZKVNPEF.js"));function F(n,l,y){let d=new Map;for(let u of y?.kinds??[])for(let a of n.nodesOfKind(u))l.has(a.id)||d.set(a.id,a);let o=new Set([...l,...d.keys()]),p=new Set(y?.edges??[]),k=new Set;if(p.size>0&&l.size>0){for(let u of l)for(let a of n.outEdges(u))p.has(a.kind)&&d.has(a.to)&&k.add(a.to);for(let u of d.keys())n.outEdges(u).some(a=>p.has(a.kind)&&l.has(a.to))&&k.add(u)}let b=new Map([...[...d].filter(([u])=>k.has(u)),...[...d].filter(([u])=>!k.has(u))]),h=[];if(p.size>0)for(let u of o)for(let a of n.outEdges(u))p.has(a.kind)&&o.has(a.to)&&h.push({kind:a.kind,from:a.from,to:a.to});return{nodes:[...b.values()],edges:h}}function L(n,l,y){let d=[];return()=>{let o=y();for(;d.length>0&&d[0]<=o-l;)d.shift();return d.length>=n?!1:(d.push(o),!0)}}function D(n={},l=Date.now){return{act:L(n.acts??30,n.actWindowMs??6e4,l),message:L(n.messages??120,n.messageWindowMs??1e3,l)}}var A=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function K(n,l){let y=structuredClone(l),d=n.schema.tryDefinition(y.kind),o=y.label;return{...y,label:d?.label?d.label(y):typeof o=="string"&&o.length>0?o:y.id}}function J(n){let l=n.limiter??D(n.limits,n.now),y=n.limits?.maxHeight??4e3,d=`view:${n.view}`,o={applied:0,refused:0,dropped:0},p=()=>n.store.seenBy(n.principal),k=e=>K(n.store,e),b=()=>{if(n.props)return n.props();let e=p(),t=e.graph,r=n.input?.()??{},f=r.node?t.getNode(r.node.id):void 0,i=r.nodes?.flatMap(s=>{let m=t.getNode(s.id);return m?[m]:[]}),g=new Set([...f?[f.id]:[],...(i??[]).map(s=>s.id)]),c=[];for(let s of g)for(let m of t.outEdges(s))g.has(m.to)&&c.push({kind:m.kind,from:m.from,to:m.to});let w=F(t,g,n.reads),S=new Set(c.map(s=>`${s.kind} ${s.from} ${s.to}`));for(let s of w.edges)S.has(`${s.kind} ${s.from} ${s.to}`)||c.push(s);let P=w.nodes.length>0?[...i??[],...w.nodes]:i,x=s=>s?.filter(m=>t.has(m)),T=e.permittedMutations(n.principal).map(s=>({name:s.name,title:s.title??s.name,...s.description!==void 0?{description:s.description}:{},...s.subject?{subject:{kinds:s.subject.kinds,arg:s.subject.arg}}:{}}));return{view:n.view,...f?{node:k(f)}:{},...P?{nodes:P.map(k)}:{},edges:c,...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:x(r.implicated)}:{},...r.flagged?{flagged:x(r.flagged)}:{},acts:T,...n.theme?{theme:n.theme()}:{},locale:M(),timeZone:H(),...n.placesShown?{places:n.placesShown().map(({as:s,title:m,kind:$})=>({as:s,title:m,kind:$}))}:{}}},h=!1,u=0,a=()=>{if(h)return;u+=1;let e=b();n.send({type:"props",props:n.hand?n.hand(e):e,push:u})},v=!1,E=n.store.subscribe(()=>{v||(v=!0,queueMicrotask(()=>{v=!1,a()}))}),G=(e,t)=>(o.refused+=1,{ok:!1,reason:e,message:t}),j=(e,t,r)=>R([{name:e,args:t}],r),R=(e,t,r)=>{if(!l.act())return G("rate-limited","Too many acts asked for at once; this one was not applied.");let f=[];for(let{name:i,args:g}of e){if(t){let c=t(i,g);if(!c.ok)return G(c.reason,c.message);i=c.name,g=c.args}if(!n.store.allMutations().some(c=>c.name===i))return G("unknown-act","There is no act by that name here.");f.push({name:i,args:g})}try{let i=n.store.applyAll(f,{author:n.principal,via:d,...r?{intent:r}:{}});return o.applied+=1,{ok:!0,intent:i.intent}}catch(i){return i instanceof N?G("refused",i.refusal.message):G("failed","The act could not be applied.")}},O=(e,t,r)=>{let f=Array.isArray(r);if(typeof t!="string"||(f?r.length===0||r.length>100||!r.every(A):!A(r)))return o.refused+=1,n.send({type:"answer",id:e,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 i=R((f?r:[r]).map(g=>({name:t,args:g})),n.judgeAct);n.send(i.ok?{type:"answer",id:e,ok:!0,intent:i.intent}:{type:"answer",id:e,ok:!1,reason:i.reason,message:i.message})};return{receive(e){if(!h){if(!l.message()){o.dropped+=1,n.onFlood?.();return}if(!A(e)||e.nonce!==n.nonce){o.dropped+=1;return}if(e.type==="act"&&(typeof e.id=="string"||typeof e.id=="number"))return O(e.id,e.name,e.args);if(e.type==="navigate"&&n.onArrive&&(typeof e.place=="string"||typeof e.to=="string")){let t={...e.where!==void 0?{where:e.where}:{},...e.section!==void 0?{section:e.section}:{}},r=typeof e.place=="string"?{place:e.place,...t}:{record:e.to,...t},f=n.onArrive;z().then(({judgeDestination:i,listsOf:g})=>{if(h)return;let c=new Set([...n.store.kindsKeptFrom(n.principal),...n.store.modules.disabledKinds]),w=i(r,{sees:S=>p().graph.has(S),places:n.placesShown?.()??[],lists:g(n.store.schema,c),schema:n.store.schema});w.ok?f(w.arrival):(o.dropped+=1,n.onLost?.(w.says))});return}if(e.type==="navigate"&&typeof e.place=="string"){n.places?.().includes(e.place)?n.onNavigatePlace?.(e.place):o.dropped+=1;return}if(e.type==="navigate"&&typeof e.to=="string"){p().graph.has(e.to)?n.onNavigate?.(e.to):o.dropped+=1;return}if(e.type==="render"&&Array.isArray(e.records)&&n.onRender){n.onRender(e.records);return}if(e.type==="style"&&typeof e.css=="string"&&n.onStyle){n.onStyle(e.css);return}if(e.type==="hears"&&Array.isArray(e.events)&&n.onHears){n.onHears(e.events.filter(t=>typeof t=="string").slice(0,20));return}if(e.type==="gestures"&&Array.isArray(e.bound)&&n.onGestures){n.onGestures(e.bound.slice(0,32));return}if(e.type==="pushed"&&typeof e.push=="number"&&typeof e.ms=="number"&&n.onPushed){n.onPushed(e.push,e.ms);return}if(e.type==="size"&&typeof e.height=="number"&&Number.isFinite(e.height)){n.onSize?.(Math.max(0,Math.min(y,Math.round(e.height))));return}o.dropped+=1}},push:a,pressed(e){return h?{ok:!1,reason:"refused",message:"The view has gone."}:e.ok?j(e.name,e.args):(o.refused+=1,e)},change(e,t){return h?{ok:!1,reason:"refused",message:"The view has gone."}:R(e,void 0,t)},get stats(){return o},dispose(){h=!0,E()}}}export{F as a,D as b,K as c,J as d};
@@ -1,4 +1,4 @@
1
- import{a as k,b as A,c as L,d as _,e as E,r as B,s as V,t as H,u as N,v as q}from"./chunk.OJGHDWI6.js";import"./chunk.V5MYKNL7.js";import"./chunk.AJZBJBMO.js";var W=["drawElementImageToTexture","copyElementImageToTexture"],S=null,P=(r,e)=>r==="texture"?{texture:e}:{destination:{texture:e}};function Z(){return typeof globalThis>"u"?void 0:globalThis}function v(r,e){let t=[],n=Z(),o=!!(n?.navigator&&"gpu"in n.navigator);o||t.push("navigator.gpu is absent \u2014 WebGPU is unavailable.");let i=r??n?.GPUQueue?.prototype??void 0,a=null;if(i){for(let d of W)if(typeof i[d]=="function"){a=d;break}}a||t.push("No element-capture method on GPUQueue. Run Chromium 147+ with --enable-blink-features=CanvasDrawElement.");let c=e??n?.HTMLCanvasElement?.prototype??void 0,l=typeof c?.updateElementGeometry=="function";l||t.push("canvas.updateElementGeometry is absent \u2014 geometry cannot be reported.");let p=typeof c?.requestPaint=="function";p||t.push("canvas.requestPaint is absent \u2014 there is no capture-safe moment to hook.");let w=!1,h="unknown";if(typeof document<"u"){let d=document.createElement("canvas");w="layoutSubtree"in d||typeof d.captureElementImage=="function","layoutSubtree"in d?h="no":typeof d.captureElementImage=="function"&&(h="yes")}return{available:a!==null,captureMethod:a,geometrySync:l,hitTestFollowsGeometry:l?h:"no",layoutSubtree:w,paintEvents:p,webgpu:o,usable:o&&a!==null,notes:t}}var g=class extends Error{constructor(t){super(`HTML-in-Canvas is unavailable:
1
+ import{a as k,b as A,c as L,d as _,e as E,r as B,s as V,t as H,u as N,v as q}from"./chunk.OJGHDWI6.js";import"./chunk.UG727PEE.js";import"./chunk.AJZBJBMO.js";var W=["drawElementImageToTexture","copyElementImageToTexture"],S=null,P=(r,e)=>r==="texture"?{texture:e}:{destination:{texture:e}};function Z(){return typeof globalThis>"u"?void 0:globalThis}function v(r,e){let t=[],n=Z(),o=!!(n?.navigator&&"gpu"in n.navigator);o||t.push("navigator.gpu is absent \u2014 WebGPU is unavailable.");let i=r??n?.GPUQueue?.prototype??void 0,a=null;if(i){for(let d of W)if(typeof i[d]=="function"){a=d;break}}a||t.push("No element-capture method on GPUQueue. Run Chromium 147+ with --enable-blink-features=CanvasDrawElement.");let c=e??n?.HTMLCanvasElement?.prototype??void 0,l=typeof c?.updateElementGeometry=="function";l||t.push("canvas.updateElementGeometry is absent \u2014 geometry cannot be reported.");let p=typeof c?.requestPaint=="function";p||t.push("canvas.requestPaint is absent \u2014 there is no capture-safe moment to hook.");let w=!1,h="unknown";if(typeof document<"u"){let d=document.createElement("canvas");w="layoutSubtree"in d||typeof d.captureElementImage=="function","layoutSubtree"in d?h="no":typeof d.captureElementImage=="function"&&(h="yes")}return{available:a!==null,captureMethod:a,geometrySync:l,hitTestFollowsGeometry:l?h:"no",layoutSubtree:w,paintEvents:p,webgpu:o,usable:o&&a!==null,notes:t}}var g=class extends Error{constructor(t){super(`HTML-in-Canvas is unavailable:
2
2
  ${t.notes.join(`
3
3
  `)}`);this.capabilities=t;this.name="PlatformUnavailableError"}};function G(r,e,t){let n=r;for(let o of W){let i=n[o];if(typeof i=="function"){if(S){i.call(n,{source:e},P(S,t));return}try{i.call(n,{source:e},P("texture",t)),S="texture"}catch(a){if(!(a instanceof TypeError)||!/texture/i.test(a.message))throw a;i.call(n,{source:e},P("destination",t)),S="destination"}return}}throw new g(v(r))}function M(r,e=!0){e?r.setAttribute("drawable",""):r.removeAttribute("drawable")}function F(r){let e=r.changedElements;return e?new Set(Array.from(e)):null}function ee(r,e){let t=r;if(typeof t.captureElementImage!="function")throw new g(v(void 0,r));return t.captureElementImage(e)}function O(r,e,t){let n=r;if(typeof n.updateElementGeometry!="function")throw new g(v(void 0,r));n.updateElementGeometry(e,t)}function te(r,e){r.clearElementGeometry?.(e)}function m(r){r.requestPaint?.()}function D(r,e=!0){let t=r;e?t.setAttribute("content","drawable"):t.removeAttribute("content"),"layoutSubtree"in t?t.layoutSubtree=e:e?t.setAttribute("layoutsubtree",""):t.removeAttribute("layoutsubtree")}var I=`
4
4
  struct Plane {
@@ -1 +1 @@
1
- import{a as m}from"./chunk.PXQVXBNG.js";import{Vc as w}from"./chunk.V5MYKNL7.js";var P=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),b=e=>e?._zod?.def;function $(e){let n=b(e);for(;n&&(n.type==="optional"||n.type==="default"||n.type==="nullable"||n.type==="prefault");)n=b(n.innerType);return n}function v(e){if(e?.type==="boolean")return["true","false"];if(e?.type==="enum")return(e.entries?Object.values(e.entries):e.values??[]).filter(n=>typeof n=="string")}var p=e=>e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]/g," ").replace(/^./,n=>n.toUpperCase());function T(e,n,t){let r=e.tryDefinition(n);if(!r)return[];let f=new Set(r.display?.hide??[]),o=[];for(let[i,a]of Object.entries(r.fields.shape??{})){if(i==="id"||i==="kind"||i==="label"||f.has(i))continue;let s=$(a);if(s?.type==="array"||s?.type==="object"||s?.type==="record")continue;let u=v(s);o.push({key:i,label:p(i),...u?{options:u}:{}})}let d=new Map;for(let[i,a]of Object.entries(r.edges??{}))d.set(i,a.to==="*"?[]:[...a.to]);for(let i of e.definitions)if(i.kind!==n)for(let[a,s]of Object.entries(i.edges??{}))!d.has(a)&&(s.to==="*"||s.to.includes(n))&&d.set(a,[i.kind]);let c=[];for(let[i,a]of d){o.push({key:i,label:p(i)});let s=t&&a.length===1&&a[0]!==n?e.tryDefinition(a[0]):void 0;for(let[u,l]of Object.entries(s?.fields.shape??{})){let y=$(l);y?.type==="enum"&&!s?.display?.hide?.includes(u)&&c.push({key:`${i}.${u}`,label:`${p(i)} \xB7 ${p(u)}`,options:v(y)})}}return o.push(...c),o.push({key:"is",label:"Is",options:r.lifecycle?["current","past","any","flagged","clear"]:["flagged","clear"]}),o}var A=e=>e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function x(e,n,t,r={}){if(t==null)return{ok:!0};if(!P(t))return{ok:!1,says:'A filter is an object of a field and the value it keeps, like { where: { stage: "building" } }.'};let f=Object.entries(t);if(f.length===0)return{ok:!0};let o=[];for(let a of n)for(let s of T(e,a,r.through===!0))o.some(u=>u.key===s.key)||o.push(s);let d=n[0]?e.tryDefinition(n[0]):void 0,c=d?d.plural??`${p(d.kind)}s`:"These",i=[];for(let[a,s]of f){let u=o.find(y=>y.key===a);if(!u)return{ok:!1,says:`${c.replace(/^./,y=>y.toUpperCase())} have no field "${a}" to filter by${o.length>0?`; they filter by ${A(o.map(y=>y.key))}`:""}.`};if(typeof s!="string"&&typeof s!="number"&&typeof s!="boolean")return{ok:!1,says:`The filter on "${a}" is ${Array.isArray(s)?"a list":s===null?"null":`a ${typeof s}`}; it keeps one value: a word, a number, or true or false.`};let l=String(s);if(l.trim().length===0)return{ok:!1,says:`The filter on "${a}" keeps nothing; give it a value, or leave "${a}" out.`};if(l.includes(","))return{ok:!1,says:`The filter on "${a}" holds a comma, which an address reads as a second filter; keep one value.`};if(u.options&&u.options.length>0&&!u.options.includes(l))return{ok:!1,says:`${u.label} has no choice "${l}"; its choices are ${A(u.options.map(y=>`"${y}"`))}.`};i.push(`${a}:${l}`)}return{ok:!0,filter:i.join(",")}}var S=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");function j(e,n){let t=e.find(o=>o.as===n);if(t)return t;let r=n.trim().toLowerCase(),f=S(n);return e.find(o=>o.title!==void 0&&o.title.trim().toLowerCase()===r)??(f?e.find(o=>o.as===f||o.title!==void 0&&S(o.title)===f):void 0)}function W(e){let n=[];for(let t of e){if(typeof t!="object"||t===null)continue;let{as:r,slug:f,title:o,kind:d}=t,c=typeof r=="string"&&r.length>0?r:typeof f=="string"&&f.length>0?f:void 0;!c||n.some(i=>i.as===c)||n.push({as:c,title:typeof o=="string"?o:c,kind:typeof d=="string"?d:""})}return n}var O=e=>` Its places: ${e.map(n=>typeof n=="string"?`"${n}"`:n.title&&n.title!==n.as?`"${n.as}" (${n.title})`:`"${n.as}"`).join(", ")||"none"}.`,g=e=>`"${e.length>80?`${e.slice(0,79)}\u2026`:e}"`,h=(e,n)=>`${"place"in e?`The place ${g(e.place)}`:`${g(e.record)} is no record this viewer may see and`} is no place of this app: it goes nowhere.${O(n)}`;function k(e){let n={};for(let t of e.split(",")){let r=t.indexOf(":");r>0&&(n[t.slice(0,r).trim()]=t.slice(r+1).trim())}return n}function J(e,n=new Set){return e.kinds.filter(t=>!n.has(t)).map(t=>({slug:w(e,t).slice(1),kind:t}))}function R(e,n){let t=[...new Set(n.places.map(l=>l.as))],r=n.lists.map(l=>l.slug).filter(l=>!t.includes(l)),f;if(e.section!==void 0&&e.section!==null){if(typeof e.section!="string"||m(e.section).length===0||e.section.length>120)return{ok:!1,says:`The section ${typeof e.section=="string"?g(e.section):"asked for"} names nothing on a page: a section is a heading's words or an element's id, like "shipping-soon". It goes nowhere.`};f=e.section}let o=f!==void 0?{section:f}:{};if("record"in e&&n.sees(e.record))return e.where!==void 0&&e.where!==null?{ok:!1,says:`${g(e.record)} is one record, and a filter narrows a list or a place: it goes nowhere. Go to { place, where } for a list narrowed.`}:{ok:!0,arrival:{record:e.record,...o}};let d="place"in e?e.place:e.record,c=j(n.places,d),i=c?void 0:n.lists.find(l=>l.slug===d||l.kind===d);if(!c&&!i)return{ok:!1,says:`${h(e,n.places.filter((l,y,D)=>D.findIndex(L=>L.as===l.as)===y))}${G(r)}`};let a=c?[c.kind]:[i.kind],s;if(e.where!==void 0&&e.where!==null){if(!n.schema)return{ok:!1,says:`The place ${g(d)} cannot be narrowed here: it goes nowhere.`};let l=x(n.schema,a,e.where,{through:i!==void 0});if(!l.ok)return{ok:!1,says:`The filter on ${g(d)} goes nowhere: ${l.says}`};s=l.filter}let u=s?{filter:s}:{};return{ok:!0,arrival:c?{place:c.as,...u,...o}:{list:i.kind,...u,...o}}}var G=e=>e.length===0?"":` Its lists: ${e.slice(0,8).map(n=>`"${n}"`).join(", ")}${e.length>8?` and ${e.length-8} more`:""}.`;function q(e){let n=t=>{let r=R(t,{sees:e.sees,places:e.places(),lists:e.lists?.()??[],...e.schema?{schema:e.schema}:{}});return r.ok?e.onNavigate?.(r.arrival):e.onLost?.(r.says),r.ok};return{link(t){let r=t.hasAttribute("data-record")||t.hasAttribute("data-place");r&&!t.hasAttribute("data-graview-link")?(t.setAttribute("data-graview-link",""),t.hasAttribute("role")||t.setAttribute("role","link"),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0")):!r&&t.hasAttribute("data-graview-link")&&(t.removeAttribute("data-graview-link"),t.getAttribute("role")==="link"&&t.removeAttribute("role"))},follow(t){let r=t.getAttribute("data-record"),f=t.getAttribute("data-place"),o=t.getAttribute("data-filter"),d=t.getAttribute("data-section"),c={...o?{where:k(o)}:{},...d?{section:d}:{}};r?n({record:r,...c}):f&&n({place:f,...c})},go:n}}export{W as a,O as b,g as c,h as d,k as e,J as f,R as g,q as h};
1
+ import{a as m}from"./chunk.PXQVXBNG.js";import{Xc as w}from"./chunk.UG727PEE.js";var P=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),b=e=>e?._zod?.def;function $(e){let n=b(e);for(;n&&(n.type==="optional"||n.type==="default"||n.type==="nullable"||n.type==="prefault");)n=b(n.innerType);return n}function v(e){if(e?.type==="boolean")return["true","false"];if(e?.type==="enum")return(e.entries?Object.values(e.entries):e.values??[]).filter(n=>typeof n=="string")}var p=e=>e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]/g," ").replace(/^./,n=>n.toUpperCase());function T(e,n,t){let r=e.tryDefinition(n);if(!r)return[];let f=new Set(r.display?.hide??[]),o=[];for(let[i,a]of Object.entries(r.fields.shape??{})){if(i==="id"||i==="kind"||i==="label"||f.has(i))continue;let s=$(a);if(s?.type==="array"||s?.type==="object"||s?.type==="record")continue;let u=v(s);o.push({key:i,label:p(i),...u?{options:u}:{}})}let d=new Map;for(let[i,a]of Object.entries(r.edges??{}))d.set(i,a.to==="*"?[]:[...a.to]);for(let i of e.definitions)if(i.kind!==n)for(let[a,s]of Object.entries(i.edges??{}))!d.has(a)&&(s.to==="*"||s.to.includes(n))&&d.set(a,[i.kind]);let c=[];for(let[i,a]of d){o.push({key:i,label:p(i)});let s=t&&a.length===1&&a[0]!==n?e.tryDefinition(a[0]):void 0;for(let[u,l]of Object.entries(s?.fields.shape??{})){let y=$(l);y?.type==="enum"&&!s?.display?.hide?.includes(u)&&c.push({key:`${i}.${u}`,label:`${p(i)} \xB7 ${p(u)}`,options:v(y)})}}return o.push(...c),o.push({key:"is",label:"Is",options:r.lifecycle?["current","past","any","flagged","clear"]:["flagged","clear"]}),o}var A=e=>e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function x(e,n,t,r={}){if(t==null)return{ok:!0};if(!P(t))return{ok:!1,says:'A filter is an object of a field and the value it keeps, like { where: { stage: "building" } }.'};let f=Object.entries(t);if(f.length===0)return{ok:!0};let o=[];for(let a of n)for(let s of T(e,a,r.through===!0))o.some(u=>u.key===s.key)||o.push(s);let d=n[0]?e.tryDefinition(n[0]):void 0,c=d?d.plural??`${p(d.kind)}s`:"These",i=[];for(let[a,s]of f){let u=o.find(y=>y.key===a);if(!u)return{ok:!1,says:`${c.replace(/^./,y=>y.toUpperCase())} have no field "${a}" to filter by${o.length>0?`; they filter by ${A(o.map(y=>y.key))}`:""}.`};if(typeof s!="string"&&typeof s!="number"&&typeof s!="boolean")return{ok:!1,says:`The filter on "${a}" is ${Array.isArray(s)?"a list":s===null?"null":`a ${typeof s}`}; it keeps one value: a word, a number, or true or false.`};let l=String(s);if(l.trim().length===0)return{ok:!1,says:`The filter on "${a}" keeps nothing; give it a value, or leave "${a}" out.`};if(l.includes(","))return{ok:!1,says:`The filter on "${a}" holds a comma, which an address reads as a second filter; keep one value.`};if(u.options&&u.options.length>0&&!u.options.includes(l))return{ok:!1,says:`${u.label} has no choice "${l}"; its choices are ${A(u.options.map(y=>`"${y}"`))}.`};i.push(`${a}:${l}`)}return{ok:!0,filter:i.join(",")}}var S=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");function j(e,n){let t=e.find(o=>o.as===n);if(t)return t;let r=n.trim().toLowerCase(),f=S(n);return e.find(o=>o.title!==void 0&&o.title.trim().toLowerCase()===r)??(f?e.find(o=>o.as===f||o.title!==void 0&&S(o.title)===f):void 0)}function W(e){let n=[];for(let t of e){if(typeof t!="object"||t===null)continue;let{as:r,slug:f,title:o,kind:d}=t,c=typeof r=="string"&&r.length>0?r:typeof f=="string"&&f.length>0?f:void 0;!c||n.some(i=>i.as===c)||n.push({as:c,title:typeof o=="string"?o:c,kind:typeof d=="string"?d:""})}return n}var O=e=>` Its places: ${e.map(n=>typeof n=="string"?`"${n}"`:n.title&&n.title!==n.as?`"${n.as}" (${n.title})`:`"${n.as}"`).join(", ")||"none"}.`,g=e=>`"${e.length>80?`${e.slice(0,79)}\u2026`:e}"`,h=(e,n)=>`${"place"in e?`The place ${g(e.place)}`:`${g(e.record)} is no record this viewer may see and`} is no place of this app: it goes nowhere.${O(n)}`;function k(e){let n={};for(let t of e.split(",")){let r=t.indexOf(":");r>0&&(n[t.slice(0,r).trim()]=t.slice(r+1).trim())}return n}function J(e,n=new Set){return e.kinds.filter(t=>!n.has(t)).map(t=>({slug:w(e,t).slice(1),kind:t}))}function R(e,n){let t=[...new Set(n.places.map(l=>l.as))],r=n.lists.map(l=>l.slug).filter(l=>!t.includes(l)),f;if(e.section!==void 0&&e.section!==null){if(typeof e.section!="string"||m(e.section).length===0||e.section.length>120)return{ok:!1,says:`The section ${typeof e.section=="string"?g(e.section):"asked for"} names nothing on a page: a section is a heading's words or an element's id, like "shipping-soon". It goes nowhere.`};f=e.section}let o=f!==void 0?{section:f}:{};if("record"in e&&n.sees(e.record))return e.where!==void 0&&e.where!==null?{ok:!1,says:`${g(e.record)} is one record, and a filter narrows a list or a place: it goes nowhere. Go to { place, where } for a list narrowed.`}:{ok:!0,arrival:{record:e.record,...o}};let d="place"in e?e.place:e.record,c=j(n.places,d),i=c?void 0:n.lists.find(l=>l.slug===d||l.kind===d);if(!c&&!i)return{ok:!1,says:`${h(e,n.places.filter((l,y,D)=>D.findIndex(L=>L.as===l.as)===y))}${G(r)}`};let a=c?[c.kind]:[i.kind],s;if(e.where!==void 0&&e.where!==null){if(!n.schema)return{ok:!1,says:`The place ${g(d)} cannot be narrowed here: it goes nowhere.`};let l=x(n.schema,a,e.where,{through:i!==void 0});if(!l.ok)return{ok:!1,says:`The filter on ${g(d)} goes nowhere: ${l.says}`};s=l.filter}let u=s?{filter:s}:{};return{ok:!0,arrival:c?{place:c.as,...u,...o}:{list:i.kind,...u,...o}}}var G=e=>e.length===0?"":` Its lists: ${e.slice(0,8).map(n=>`"${n}"`).join(", ")}${e.length>8?` and ${e.length-8} more`:""}.`;function q(e){let n=t=>{let r=R(t,{sees:e.sees,places:e.places(),lists:e.lists?.()??[],...e.schema?{schema:e.schema}:{}});return r.ok?e.onNavigate?.(r.arrival):e.onLost?.(r.says),r.ok};return{link(t){let r=t.hasAttribute("data-record")||t.hasAttribute("data-place");r&&!t.hasAttribute("data-graview-link")?(t.setAttribute("data-graview-link",""),t.hasAttribute("role")||t.setAttribute("role","link"),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0")):!r&&t.hasAttribute("data-graview-link")&&(t.removeAttribute("data-graview-link"),t.getAttribute("role")==="link"&&t.removeAttribute("role"))},follow(t){let r=t.getAttribute("data-record"),f=t.getAttribute("data-place"),o=t.getAttribute("data-filter"),d=t.getAttribute("data-section"),c={...o?{where:k(o)}:{},...d?{section:d}:{}};r?n({record:r,...c}):f&&n({place:f,...c})},go:n}}export{W as a,O as b,g as c,h as d,k as e,J as f,R as g,q as h};
@@ -1 +1 @@
1
- import{a as C,e as L,n as H,o as R,p as k}from"./chunk.UTCB3CE7.js";import"./chunk.QIV65FWE.js";import"./chunk.UT6642FC.js";import"./chunk.HPAGOEZG.js";import"./chunk.ISXFH3CK.js";import{a as S}from"./chunk.H5ADMSE7.js";import"./chunk.TI4OSTQV.js";import"./chunk.I7XSDXQ3.js";import"./chunk.2FLPDPEL.js";import"./chunk.UUBYFBPN.js";import"./chunk.2RVUDRRY.js";import"./chunk.LLEFYJPJ.js";import{Ea as E,G as T,R as b}from"./chunk.FOQZADMA.js";import"./chunk.SDO3U72B.js";import{uc as x}from"./chunk.V5MYKNL7.js";import{b as g}from"./chunk.AJZBJBMO.js";var t=g(T(),1);var c=g(b(),1);function N(n){if(!n||n.interaction.outcome==="failed")return null;let s=n.offers[0],o=s?n.interaction.offered.find(i=>i.id===s.id)?.confidence:void 0;return s&&o!==void 0&&o>=.6?{offer:s,confidence:o}:null}function j({rest:n,hold:s,leave:o}){let i=S(),u=(0,t.useMemo)(()=>C(n.target,e=>i.store.graph.has(e)),[n.target,i.store]),l=u.on==="record"&&L(i.ai)!==void 0,m=l?H(i,u):void 0,p=JSON.stringify(u),[y,I]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!l||m!==void 0)return;let e=!0;return R(i,u).then(r=>{e&&I({key:p,result:r})}),()=>{e=!1}},[p,l]);let w=m??(y?.key===p?y.result:void 0),f=l?N(w):null,v=f?.offer.id??null,h=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(v===null)return;let e=r=>{r.target instanceof Node&&h.current?.contains(r.target)||o(!0)};return document.addEventListener("pointerdown",e,{capture:!0,passive:!0}),document.addEventListener("contextmenu",e,{capture:!0,passive:!0}),addEventListener("scroll",e,{capture:!0,passive:!0}),addEventListener("resize",e,{passive:!0}),()=>{document.removeEventListener("pointerdown",e,{capture:!0}),document.removeEventListener("contextmenu",e,{capture:!0}),removeEventListener("scroll",e,{capture:!0}),removeEventListener("resize",e)}},[v,o]),(0,t.useLayoutEffect)(()=>{let e=h.current;if(!e)return;if(typeof e.showPopover=="function"&&!E(e))try{e.showPopover()}catch{}let r=n.element.getBoundingClientRect(),d=e.getBoundingClientRect(),O=r.top-d.height-4>=4?r.top-d.height-4:Math.min(innerHeight-d.height-4,r.top+4),A=Math.max(4,Math.min(innerWidth-d.width-4,r.right-d.width));e.style.top=`${Math.round(O)}px`,e.style.left=`${Math.round(A)}px`},[v,n.element]),!f)return null;let{offer:a,confidence:P}=f,M=a.type==="panel"?"a panel":a.type==="place"?"go there":a.type==="record"?"open it":"suggested";return(0,c.jsxs)("button",{ref:h,type:"button",popover:"manual","data-testid":"hover-chip","data-ai-offer":a.id,"data-ai-offer-type":a.type,"data-graview-overlay":"","data-graview-popover":"","aria-label":`Suggested by AI: ${a.label}`,title:`Suggested by AI, ${Math.round(P*100)}% sure`,onPointerEnter:s,onPointerLeave:()=>o(),onClick:()=>{n.element.closest("[tabindex], a[href], button")?.focus({preventScroll:!0}),o(!0),k(i,w,a)},style:$,children:[(0,c.jsxs)("span",{"aria-hidden":"true",style:{color:"var(--graview-accent)"},children:["\u2726"," "]}),a.label,(0,c.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",M]})]})}var $={position:"fixed",inset:"auto",top:0,left:0,margin:0,zIndex:x("toast"),boxSizing:"border-box",width:"max-content",maxWidth:"min(320px, calc(100vw - 8px))",height:"auto",minHeight:24,padding:"2px 10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",font:"inherit",fontSize:"0.75rem",cursor:"pointer"};export{j as HoverChip};
1
+ import{a as C,e as L,n as H,o as R,p as k}from"./chunk.LWAZ6ZO6.js";import"./chunk.V5VQCANB.js";import"./chunk.UT6642FC.js";import"./chunk.WERBD5ZR.js";import"./chunk.HAY22FPJ.js";import{a as S}from"./chunk.U6YOAS4X.js";import"./chunk.TI4OSTQV.js";import"./chunk.BZ4VZ6WQ.js";import"./chunk.LFJH6X6O.js";import"./chunk.VTUMPH4Z.js";import"./chunk.PCTVLNOS.js";import"./chunk.4QEDYRES.js";import{Ea as E,G as T,R as b}from"./chunk.JE4QQEJE.js";import"./chunk.SDO3U72B.js";import{wc as x}from"./chunk.UG727PEE.js";import{b as g}from"./chunk.AJZBJBMO.js";var t=g(T(),1);var c=g(b(),1);function N(n){if(!n||n.interaction.outcome==="failed")return null;let s=n.offers[0],o=s?n.interaction.offered.find(i=>i.id===s.id)?.confidence:void 0;return s&&o!==void 0&&o>=.6?{offer:s,confidence:o}:null}function j({rest:n,hold:s,leave:o}){let i=S(),u=(0,t.useMemo)(()=>C(n.target,e=>i.store.graph.has(e)),[n.target,i.store]),l=u.on==="record"&&L(i.ai)!==void 0,m=l?H(i,u):void 0,p=JSON.stringify(u),[y,I]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!l||m!==void 0)return;let e=!0;return R(i,u).then(r=>{e&&I({key:p,result:r})}),()=>{e=!1}},[p,l]);let w=m??(y?.key===p?y.result:void 0),f=l?N(w):null,v=f?.offer.id??null,h=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(v===null)return;let e=r=>{r.target instanceof Node&&h.current?.contains(r.target)||o(!0)};return document.addEventListener("pointerdown",e,{capture:!0,passive:!0}),document.addEventListener("contextmenu",e,{capture:!0,passive:!0}),addEventListener("scroll",e,{capture:!0,passive:!0}),addEventListener("resize",e,{passive:!0}),()=>{document.removeEventListener("pointerdown",e,{capture:!0}),document.removeEventListener("contextmenu",e,{capture:!0}),removeEventListener("scroll",e,{capture:!0}),removeEventListener("resize",e)}},[v,o]),(0,t.useLayoutEffect)(()=>{let e=h.current;if(!e)return;if(typeof e.showPopover=="function"&&!E(e))try{e.showPopover()}catch{}let r=n.element.getBoundingClientRect(),d=e.getBoundingClientRect(),O=r.top-d.height-4>=4?r.top-d.height-4:Math.min(innerHeight-d.height-4,r.top+4),A=Math.max(4,Math.min(innerWidth-d.width-4,r.right-d.width));e.style.top=`${Math.round(O)}px`,e.style.left=`${Math.round(A)}px`},[v,n.element]),!f)return null;let{offer:a,confidence:P}=f,M=a.type==="panel"?"a panel":a.type==="place"?"go there":a.type==="record"?"open it":"suggested";return(0,c.jsxs)("button",{ref:h,type:"button",popover:"manual","data-testid":"hover-chip","data-ai-offer":a.id,"data-ai-offer-type":a.type,"data-graview-overlay":"","data-graview-popover":"","aria-label":`Suggested by AI: ${a.label}`,title:`Suggested by AI, ${Math.round(P*100)}% sure`,onPointerEnter:s,onPointerLeave:()=>o(),onClick:()=>{n.element.closest("[tabindex], a[href], button")?.focus({preventScroll:!0}),o(!0),k(i,w,a)},style:$,children:[(0,c.jsxs)("span",{"aria-hidden":"true",style:{color:"var(--graview-accent)"},children:["\u2726"," "]}),a.label,(0,c.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",M]})]})}var $={position:"fixed",inset:"auto",top:0,left:0,margin:0,zIndex:x("toast"),boxSizing:"border-box",width:"max-content",maxWidth:"min(320px, calc(100vw - 8px))",height:"auto",minHeight:24,padding:"2px 10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",font:"inherit",fontSize:"0.75rem",cursor:"pointer"};export{j as HoverChip};
@@ -0,0 +1,21 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Je,b as nt,c as st,d as ot,e as it,f as at}from"./chunk.LQGXUMUX.js";import{a as rt,b as ke,c as lt}from"./chunk.IQ3LUSD6.js";import{g as Qe}from"./chunk.GAFYE37S.js";import{e as tt}from"./chunk.SUQU4AXG.js";import{c as Ze,f as et,g as ve}from"./chunk.ZRIDKFTV.js";import{b as se,d as oe}from"./chunk.22QEYFWI.js";import{a as we,e as Ye}from"./chunk.BBLIT7S7.js";import{a as ne,f as Xe,h as qe}from"./chunk.2ZGICECC.js";import"./chunk.PXQVXBNG.js";import{a as H}from"./chunk.SDO3U72B.js";import"./chunk.UG727PEE.js";import"./chunk.AJZBJBMO.js";var dt=["good","warn","bad","neutral","accent"],ut=["value","max","aria-label","placeholder","disabled"],ct=["click","change"],be=["_blank","_self"],pt=["section","div","span","strong","p","hr","a","button","input","progress"],ie={type:{oneOf:dt}},xe={"gv-card":{host:"section",properties:{tone:ie},events:{},children:"any"},"gv-group":{host:"div",properties:{direction:{type:{oneOf:["row","column"]}}},events:{},children:"any"},"gv-title":{host:"strong",properties:{},events:{},children:"text"},"gv-text":{host:"p",properties:{tone:ie},events:{},children:"text"},"gv-badge":{host:"span",properties:{tone:ie},events:{},children:"text"},"gv-field":{host:"div",properties:{label:{type:"string"}},events:{},children:"text"},"gv-progress":{host:"progress",properties:{value:{type:"number",as:"value"},max:{type:"number",as:"max"},label:{type:"string",as:"aria-label"}},events:{},children:"none"},"gv-divider":{host:"hr",properties:{},events:{},children:"none"},"gv-link":{host:"a",properties:{href:{type:"url"}},events:{},children:"text"},"gv-button":{host:"button",properties:{tone:ie,disabled:{type:"boolean",as:"disabled"}},events:{press:{from:"click"}},children:"text"},"gv-input":{host:"input",properties:{label:{type:"string",as:"aria-label"},value:{type:"string",as:"value"},placeholder:{type:"string",as:"placeholder"}},events:{change:{from:"change",detail:"value"}},children:"none"}},Se=1e4;var Kt=0,Rt=1,Gt=2,Wt=3,ft=1,Lt=2,_t=3,Ot=1,At=3,It=8,Te="~",Me=(s,e)=>Object.prototype.hasOwnProperty.call(s,e),Y=s=>typeof s=="object"&&s!==null&&!Array.isArray(s);function mt(s,e){return e.type==="url"?"href":e.as??`data-gv-${s.toLowerCase()}`}var Nt=2e3;function gt(s,e){if(e==null)return{ok:!0,value:null};let i=s.type;if(i==="boolean")return typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,reason:"value"};if(i==="number")return typeof e=="number"&&Number.isFinite(e)?{ok:!0,value:String(e)}:{ok:!1,reason:"value"};if(typeof e!="string"||e.length>Nt)return{ok:!1,reason:i==="url"?"url":"value"};if(typeof i=="object")return i.oneOf.includes(e)?{ok:!0,value:e}:{ok:!1,reason:"value"};if(i==="url"){let f;try{f=new URL(e)}catch{return{ok:!1,reason:"url"}}return f.protocol!=="https:"||f.hostname===""||!/^https:\/\//i.test(e)?{ok:!1,reason:"url"}:{ok:!0,value:f.href}}return{ok:!0,value:e}}function Pt(s){let e=s.host==="a";return pt.includes(s.host)&&(s.target===void 0||e&&be.includes(s.target))&&Object.values(s.properties).every(i=>i.type!=="url"||e)&&Object.values(s.properties).every(i=>i.as===void 0||i.type!=="url"&&ut.includes(i.as))&&Object.values(s.events).every(i=>ct.includes(i.from))}function Ee(s,e){let i=e.kit??xe,f=e.maxNodes??2e3,o=s.ownerDocument,g=[],w=new Map,W={dom:s,name:Te,component:{host:"div",properties:{},events:{},children:"any"},children:[],listeners:new Map,id:Te};w.set(Te,W);let R=e.links?new Set(e.links.origins.flatMap(r=>{try{let d=new URL(r);return d.protocol==="https:"&&d.hostname!==""?[d.origin]:[]}catch{return[]}})):void 0,A=0,M=0,N=!1,c=r=>{g.push(r),g.length>200&&g.shift()},E=()=>({dom:o.createComment(""),children:[],refused:!0,listeners:new Map}),T=(r,d,y)=>{let a=r.component;if(!Me(a.properties,d))return c({reason:"property",element:r.name,name:d});let n=a.properties[d],m=gt(n,y),b=m.ok&&n.type==="url"&&R&&typeof m.value=="string"&&!R.has(new URL(m.value).origin)?{ok:!1,reason:"url"}:m,S=r.dom,h=mt(d,n);if(!b.ok)return S.removeAttribute(h),c({reason:b.reason,element:r.name,name:d});let L=b.value;L===null||L===!1?S.removeAttribute(h):S.setAttribute(h,L===!0?"":L),h==="value"&&"value"in S&&(S.value=typeof L=="string"?L:""),h==="disabled"&&"disabled"in S&&(S.disabled=L!==null&&L!==!1)},v=(r,d,y)=>{let a=r.component;if(!Me(a.events,d))return c({reason:"event",element:r.name,name:d});let n=r.listeners.get(d);if(n&&(n(),r.listeners.delete(d),M-=1),y==null)return;if(!Y(y)||typeof y.listener!="number")return c({reason:"value",element:r.name,name:d});let m=y.listener,b=a.events[d],S=r.dom,h=()=>e.onEvent(m,b.detail==="value"?String(S.value??""):void 0);S.addEventListener(b.from,h),r.listeners.set(d,()=>S.removeEventListener(b.from,h)),M+=1},k=r=>{if(!r.refused){A-=1,r.id!==void 0&&w.delete(r.id);for(let d of r.listeners.values())d();M-=r.listeners.size,r.listeners.clear();for(let d of r.children)k(d)}},_=(r,d)=>{if(!Y(r)||typeof r.id!="string"||w.has(r.id))return c({reason:"record"}),E();if(A>=f)return c({reason:"budget"}),N||(N=!0,e.onOverBudget?.()),E();let y=r.id,a=d.component.children;if(r.type===It)return E();if(r.type===At){if(a==="none")return c({reason:"child",element:d.name}),E();let h={dom:o.createTextNode(String(r.data??"").slice(0,Se)),children:[],text:!0,listeners:new Map,id:y};return w.set(y,h),A+=1,h}if(r.type!==Ot)return c({reason:"record"}),E();let n=String(r.element);if(!Me(i,n)||!Pt(i[n]))return c({reason:"element",element:n}),E();if(a!=="any")return c({reason:"child",element:n}),E();let m=i[n],b=o.createElement(m.host);b.setAttribute("data-gv",n.replace(/^gv-/,"")),b.className=`graview-guest-${n.replace(/^gv-/,"")}`,m.host==="a"&&(b.setAttribute("rel","noopener noreferrer"),b.setAttribute("target",m.target??"_blank"),b.setAttribute("referrerpolicy","no-referrer")),m.host==="button"&&b.setAttribute("type","button");let S={dom:b,name:n,component:m,children:[],listeners:new Map,id:y};if(w.set(y,S),A+=1,Y(r.properties))for(let[h,L]of Object.entries(r.properties))T(S,h,L);if(Y(r.attributes))for(let h of Object.keys(r.attributes))c({reason:"attribute",element:n,name:h});if(Y(r.eventListeners))for(let[h,L]of Object.entries(r.eventListeners))v(S,h,L);if(Array.isArray(r.children))for(let h of r.children){let L=_(h,S);S.children.push(L),b.appendChild(L.dom)}return S},P=r=>{if(!Array.isArray(r))return c({reason:"record"});let[d,y]=r,a=typeof y=="string"?w.get(y):void 0;if(!a)return c({reason:"record"});switch(d){case Kt:{if(a.text)return c({reason:"record"});let n=Number(r[3]),m=Number.isInteger(n)&&n>=0&&n<=a.children.length?n:a.children.length,b=_(r[2],a);a.dom.insertBefore(b.dom,a.children[m]?.dom??null),a.children.splice(m,0,b);return}case Rt:{let n=Number(r[2]),m=a.children[n];if(!m)return c({reason:"record"});a.children.splice(n,1),m.dom.parentNode?.removeChild(m.dom),k(m);return}case Gt:if(!a.text)return c({reason:"record"});a.dom.data=String(r[2]??"").slice(0,Se);return;case Wt:{if(a===W||a.text)return c({reason:"record"});let n=String(r[2]),m=r[4]??ft;return m===ft?T(a,n,r[3]):m===_t?v(a,n,r[3]):c(m===Lt?{reason:"attribute",element:a.name,name:n}:{reason:"record"})}default:return c({reason:"record"})}};return{apply(r,d){if(!Array.isArray(r))return c({reason:"record"}),!0;for(let y=0;y<r.length;y+=1){if(d&&y%32===0&&d())return!1;P(r[y])}return!0},get refused(){return g},get size(){return A},get listening(){return M},dispose(){for(let r of W.children)k(r);W.children.length=0,s.replaceChildren()}}}var Ke=`
2
+ .graview-guest { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: var(--graview-ink, inherit); font: inherit; }
3
+ .graview-guest-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--graview-edge, #d0d0d0); border-radius: 10px; background: var(--graview-panel, transparent); }
4
+ .graview-guest-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
5
+ .graview-guest-group[data-gv-direction="row"] { flex-direction: row; flex-wrap: wrap; align-items: center; }
6
+ .graview-guest-title { font-weight: 600; font-size: 1rem; overflow-wrap: anywhere; }
7
+ .graview-guest-text { margin: 0; font-size: 0.875rem; line-height: 1.45; overflow-wrap: anywhere; }
8
+ .graview-guest-badge { align-self: flex-start; padding: 1px 8px; border: 1px solid currentColor; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; }
9
+ .graview-guest-field { font-size: 0.875rem; overflow-wrap: anywhere; }
10
+ .graview-guest-field[data-gv-label]::before { content: attr(data-gv-label) " "; color: var(--graview-ink-muted, inherit); }
11
+ .graview-guest-progress { width: 100%; }
12
+ .graview-guest-divider { width: 100%; margin: 2px 0; border: 0; border-top: 1px solid var(--graview-edge, #d0d0d0); }
13
+ .graview-guest-link { color: var(--graview-accent, inherit); text-decoration: underline; }
14
+ .graview-guest-button { align-self: flex-start; font: inherit; padding: 4px 12px; border-radius: 8px; border: 1px solid var(--graview-edge, #d0d0d0); background: var(--graview-panel, transparent); color: inherit; cursor: pointer; }
15
+ .graview-guest-input { font: inherit; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--graview-edge, #d0d0d0); }
16
+ .graview-guest [data-gv-tone="good"] { color: var(--graview-good, inherit); }
17
+ .graview-guest [data-gv-tone="bad"] { color: var(--graview-bad, inherit); }
18
+ .graview-guest [data-gv-tone="warn"] { color: var(--graview-warn, inherit); }
19
+ .graview-guest [data-gv-tone="accent"] { color: var(--graview-accent, inherit); }
20
+ .graview-guest [data-gv-tone="neutral"] { color: var(--graview-ink-muted, inherit); }
21
+ `;var yt=new WeakSet;function Vt(s,e){if(s.startsWith("blob:"))return"blob:";try{return new URL(s,e.location.href).origin}catch{return s}}function ht(s,e,i){let f=Vt(e,s),o=`this page's Content-Security-Policy${i?` (${i})`:""} does not allow a worker from ${f}: it needs worker-src ${f}`;return yt.has(s)||(yt.add(s),s.console?.warn?.(`Graview: worker views cannot start on this page, because ${o}. A host that will not allow ${f} serves each view's whole script from its own origin and passes worker: { url } (the @graview/guest README, "What the host page allows").`)),o}function Dt(s,e){return s===""?!0:e.startsWith("blob:")?s.startsWith("blob"):e.startsWith(s)||s.startsWith(e)}function ae(s,e){let i="script"in e.source?s.URL.createObjectURL(new s.Blob([e.source.script],{type:"text/javascript"})):void 0,f="script"in e.source?i:e.source.url,o,g,w=!1,W=!1,R=0,A=0,M="",N=0,c=0,E=s.performance,T=E.now(),v,k=a=>{let n=a,m=String(n.effectiveDirective||n.violatedDirective||"").split(" ")[0];/^(worker-src|script-src|script-src-elem|child-src|default-src)$/.test(m)&&Dt(String(n.blockedURI??""),f)&&(v=m)},_=s.document;_?.addEventListener("securitypolicyviolation",k);let P=()=>_?.removeEventListener("securitypolicyviolation",k),r=()=>{W||(W=!0,g?.close(),o?.terminate(),o=void 0,s.clearTimeout(R),s.clearInterval(A),P(),i&&s.URL.revokeObjectURL(i))},d=(a,n)=>{W||(r(),e.onStop(a,n))},y=()=>{s.clearTimeout(R),P(),M=Je();let a=new s.MessageChannel;g=a.port1;let n=Math.max(1,e.silentMs),m=Math.max(10,Math.min(1e3,Math.floor(n/4)));T=E.now();let b=T;A=s.setInterval(()=>{let h=E.now();if(h-b>m*2&&(T+=h-b-m),b=h,h-T>=n)return d("silent");N+=1,a.port1.postMessage({type:"heartbeat",beat:N})},m);let S={graview:"host-hello",protocol:1,nonce:M,view:e.name};o.postMessage(S,[a.port2]),e.onReady(M,a.port1)};try{o=new s.Worker(f,{name:e.name})}catch(a){o=void 0;let n=a,m=n?.name==="SecurityError"?ht(s,f,v):`the worker could not be made: ${String(n?.message??a)}`;queueMicrotask(()=>d("start",m))}return o&&(R=s.setTimeout(()=>d("start",`it never said it was ready in ${e.readyMs.toLocaleString("en-US")} ms`),e.readyMs),o.onerror=a=>{let n=typeof a.message=="string"&&a.message!==""?a.message:void 0;if(w)return void e.onError?.(n??"an error");s.clearTimeout(R),s.setTimeout(()=>!w&&d("start",v?ht(s,f,v):n?`it failed before it said ready: ${n}`:"it failed before it said ready, and the engine gave no reason (a page policy that refuses it, or a script that does not load)"),0)},o.onmessage=a=>{if(!e.limiter.message()||w||!Ye(a.data)||a.data.protocol!==1){e.onDropped();return}w=!0,y()}),{get worker(){return o},answer(a){let n=a;return typeof n!="object"||n===null||n.type!=="heartbeat"||n.nonce!==M?!1:(typeof n.beat=="number"&&n.beat>c&&n.beat<=N&&(c=n.beat,T=E.now()),!0)},stop:r}}function le(s,e){let i=e(),f=0;return{draw(o){let g=e();g-i>=1e3&&(i=g,f=0);let w=o(()=>f+(e()-g)>=s);return f+=e()-g,w&&f<s}}}var Ct=H(()=>(__graviewPreload(import.meta.url,["./chunk.GAFYE37S.js","./chunk.AJZBJBMO.js"]),import("./chunk.YWVOACSX.js"))),Ht=H(()=>(__graviewPreload(import.meta.url,["./chunk.SUQU4AXG.js","./chunk.ZRIDKFTV.js","./chunk.22QEYFWI.js","./chunk.UG727PEE.js","./chunk.AJZBJBMO.js"]),import("./chunk.MUBZIU6F.js"))),jt=H(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.SHNYYBNW.js"))),Ut=H(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.WVN62OMH.js","./chunk.BZ4VZ6WQ.js","./chunk.XDPIS7RS.js","./chunk.57R4ZUMM.js","./chunk.J7ZMNAWB.js","./chunk.VKJAGZNU.js","./chunk.PCTVLNOS.js","./chunk.UG727PEE.js","./chunk.AJZBJBMO.js"]),import("./chunk.VXZFW52D.js"))),Bt=H(()=>(__graviewPreload(import.meta.url,["./chunk.ZRIDKFTV.js","./chunk.22QEYFWI.js","./chunk.UG727PEE.js","./chunk.AJZBJBMO.js"]),import("./chunk.XNW7PUAF.js"))),$t=H(()=>(__graviewPreload(import.meta.url,["./chunk.BBLIT7S7.js","./chunk.AJZBJBMO.js"]),import("./chunk.RRCPEHM4.js")));function Ft(s,e,i){switch(s){case"manifest":return i??"Its manifest names something this app does not have.";case"source":return i??`Its code is longer than the ${e.maxSourceBytes.toLocaleString("en-US")} bytes a view may be.`;case"start":return`It could not start${i?`: ${i}.`:"."}`;case"error":return`It failed before it drew anything${i?`: ${i}`:"."}`;case"silent":return`It stopped answering for ${e.silentMs.toLocaleString("en-US")} ms.`;case"nodes":return`It drew more than the ${e.maxNodes.toLocaleString("en-US")} things a view may draw.`;case"flood":return`It sent more than ${e.messages} messages in ${e.messageWindowMs.toLocaleString("en-US")} ms.`;case"slow":return`It took longer than ${e.pushMs.toLocaleString("en-US")} ms to draw what it was shown.`}}function zt(s,e){let i=s.ownerDocument,f=i.defaultView,{manifest:o}=e,g=i.createElement("div");g.className="graview-worker-view",g.setAttribute("role","region"),g.setAttribute("aria-label",o.title??o.name),g.setAttribute("data-worker-view",o.name),g.style.cssText="display:block;position:relative;contain:layout paint style;isolation:isolate;overflow:clip;min-width:0",s.appendChild(g);let w=g.attachShadow({mode:"open"}),W=e.author?i.createElement("p"):void 0;W&&(W.className="graview-worker-view-author",W.setAttribute("data-worker-view-author",o.name),W.style.cssText="margin:4px 0 0;font-size:0.75rem;color:var(--graview-ink-muted, inherit)",W.textContent=e.author,s.appendChild(W));let R={applied:0,refused:0,dropped:0},A=se(e.limits),M={maxSourceBytes:e.limits?.maxSourceBytes??256e3,maxNodes:e.limits?.maxNodes??5e3,messages:e.limits?.messages??120,messageWindowMs:e.limits?.messageWindowMs??1e3,pushMs:e.limits?.pushMs??1e3,silentMs:e.limits?.silentMs??5e3,drawMs:e.limits?.drawMs??100},N,c,E,T,v=!1,k={applied:0,refused:0,dropped:0},_=[],P=()=>{if(!c)return;let t=c.stats;R.applied+=t.applied-k.applied,R.refused+=t.refused-k.refused,R.dropped+=t.dropped-k.dropped,k={...t}},r=()=>{},d=0,y=()=>{},a=()=>{y(),y=()=>{},P(),c?.dispose(),c=void 0,E?.stop(),r(),f.clearInterval(d)},n=(t,p)=>{if(v)return;v=!0,a(),T?.dispose();let x=Ft(t,M,p);g.removeAttribute("data-worker-view-drawn"),g.setAttribute("data-worker-view-failed",t),e.fallback!==!1&&(e.fallback??m)(g,t,x),e.onFailure?.(t,x)},m=(t,p,x)=>{let K=N??(()=>{try{return ve(e.store,e.principal,{manifest:o,...e.input?{input:e.input()}:{}})}catch{return}})(),l=i.createElement("div");l.setAttribute("data-graview-fallback",p),l.style.cssText="padding:12px;display:grid;gap:6px;color:var(--graview-ink, inherit);font-family:var(--graview-font-body, inherit)";let I=i.createElement("strong");I.textContent=o.title??o.name;let O=i.createElement("ul");O.style.cssText="margin:0;padding-left:1.2em";for(let $ of[...K?.node?[K.node]:[],...K?.nodes??[]]){let q=i.createElement("li");q.textContent=$.label??$.id,O.appendChild(q)}let B=i.createElement("p");B.style.cssText="margin:0;font-size:0.8125rem;color:var(--graview-ink-muted, inherit)",B.textContent=`This view was stopped. ${x}`,l.append(I,O,B),w.replaceChildren(l)},b=et(o,e.store);if(b.length>0)return queueMicrotask(()=>n("manifest",b.join(" "))),ge();let S=t=>{if(("source"in t?new TextEncoder().encode(t.source).length:"script"in t?new TextEncoder().encode(t.script).length:0)>M.maxSourceBytes)return["source"];let x="source"in t?rt(t.source):[];return x.length>0?["source",x.join(" ")]:void 0},h=e.worker,L=typeof h=="function"?void 0:S(h);if(L)return queueMicrotask(()=>n(...L)),ge();let Re=at(f,()=>We(),"blob"),de=()=>it(()=>e.theme?.()??st(g),e.brand,Re),Ge="",ue=()=>{Ge=JSON.stringify(de()),c?.push()},We=()=>{c&&JSON.stringify(de())!==Ge&&ue()},vt=ot(i,We),j,U,Le=o.pictures?jt().then(({createGuestPictures:t})=>{v||(j=t(f,{as:"blob",view:`"${o.title??o.name}"`,pictures:o.pictures,...e.limits?{limits:e.limits}:{},...e.file?{file:e.file}:{},moved:()=>c?.push(),onLeft:p=>{D?.postMessage({type:"notice",text:p}),e.onProblem?.(p)}}))}):Promise.resolve();r=()=>{vt(),Re.dispose(),j?.dispose(),X?.dispose(),U?.dispose(),te?.dispose()};let D,J=t=>D?.postMessage(t),_e=!1,Oe=!1,Q=()=>g.toggleAttribute("data-worker-view-drawn",!v&&Oe&&T!==void 0&&_.length===0&&z.size===0&&!j?.waiting()&&!(U?.waiting??0)),F=f.performance,z=new Map,Z=F.now(),ce=Math.max(10,Math.min(250,Math.floor(M.pushMs/4))),kt=()=>{d||(Z=F.now(),d=f.setInterval(()=>{let t=F.now(),p=t-Z>ce*2?t-Z-ce:0;Z=t;for(let[x,K]of z){let l=K+p;if(z.set(x,l),t-l>=M.pushMs)return n("slow")}},ce))},bt=le(M.drawMs,()=>F.now()),Ae=()=>{},pe=t=>{if(v)return;if(!T)return void _.push(t);let p=T;if(!bt.draw(K=>t[0]==="render"?p.apply(t[1],K):(p.style(t[1]),!0)))return n("slow");t[0]==="render"&&Ae()},Ie=()=>Xe(e.store.schema,new Set([...e.store.kindsKeptFrom(e.principal),...e.store.modules.disabledKinds])),ee=qe({sees:t=>e.store.seenBy(e.principal).graph.has(t),places:()=>ne(e.places?.()??[]),lists:Ie,schema:e.store.schema,...e.onNavigate?{onNavigate:e.onNavigate}:e.goTo?{onNavigate:t=>nt(e.goTo(),t)}:{},onLost:t=>{D?.postMessage({type:"notice",text:t}),e.onProblem?.(t)}}),C=new Set,Ne=new Set,X,Pe=!1,Ve=()=>{Pe||(Pe=!0,Ut().then(({createGuestMedia:t})=>{v||(X=t(f,{view:`"${o.title??o.name}"`,pictures:o.pictures!==void 0,shown:()=>N,...e.file?{file:e.file}:{},onProblem:p=>{D?.postMessage({type:"notice",text:p}),e.onProblem?.(p)}}),X.refresh(w))},()=>e.onProblem?.(`The view "${o.title??o.name}" places a video or a full-screen viewer, and the host's player could not be loaded.`)))},De=!1,Ce=!1,fe=new Map,He=()=>{De||!o.accepts?.length||(De=!0,Bt().then(({createGuestDrops:t})=>{v||(U=t(f,{shadow:w,manifest:o,store:e.store,principal:e.principal,files:()=>e.files?.(),shown:()=>C,hears:()=>Ce,idOf:p=>T?.renderer.idOf(p),send:J,change:(p,x)=>{if(!c)return{ok:!1,reason:"refused",message:"The view has gone."};let K=c.change(p,x);return P(),K},handed:p=>fe.set(p.href,p),onProblem:p=>{D?.postMessage({type:"notice",text:p}),e.onProblem?.(p)},onBusy:()=>Q()}),U.refresh())},()=>e.onProblem?.(`The view "${o.title??o.name}" takes files, and the host's drop could not be loaded.`)))},te,je=[],Ue=!1,xt=t=>{je=t,te?.bind(t),!(Ue||t.length===0)&&(Ue=!0,$t().then(({createGuestGestures:p,unheardWords:x})=>{if(!v){if(o.gestures!==!0){let K=x(o.title??o.name);return D?.postMessage({type:"notice",text:K}),e.onProblem?.(K)}te=p(w,{root:()=>w.querySelector("[data-graview-view-root]")??void 0,idOf:K=>T?.renderer.idOf(K),send:J}),te.bind(je)}},()=>{}))},St=t=>{let p=e.store.seenBy(e.principal).graph;for(let x of C){let K=p.getNode(x);for(let l of Object.values(K??{}))for(let I of Ze(l))if(I.href===t)return I}},Be=t=>{if(t.localName==="graview-video")return Ve();t.hasAttribute("data-lightbox")&&(t.setAttribute("aria-haspopup","dialog"),Ve())};Promise.all([Ct(),Ht()]).then(([{createOpenDrawing:t},{createPressReader:p,createSaver:x,fillPrefills:K,judgePress:l,prefillOf:I}])=>{if(v)return;let O=p(),B=(u,G)=>{let V=T?.renderer.idOf(u);V!==void 0&&J({type:"dom-event",target:V,event:"acted",pressed:G})},$=x({reader:O,save:(u,G)=>{if(!c)return;let V=c.pressed(l(e.store,o,C,u));P(),B(G,{as:u.as,...V})}}),q=()=>$.flush();f.addEventListener("pagehide",q),y=()=>{f.removeEventListener("pagehide",q),$.flush()};let Tt=new WeakSet;Ae=()=>{K(w,O,Tt,u=>I(e.store,e.principal,o,C,u)),X?.refresh(w),U?.refresh()},T=t(w,{origin:e.origin??f.location.origin,...e.asset?{asset:e.asset}:{},...e.images?{imageOrigins:e.images.origins}:{},...o.pictures?{picture:u=>j?.drawn(u)}:{},onRefused:u=>{if(u.reason!=="url"||u.element!=="img"||u.address===void 0||Ne.has(u.address))return;Ne.add(u.address);let G=Qe(u.address,{...e.images?{origins:e.images.origins}:{},assets:e.asset!==void 0},u.length);D?.postMessage({type:"notice",text:G}),e.onProblem?.(G)},...e.limits?.maxNodes!==void 0?{maxNodes:e.limits.maxNodes}:{},onOverBudget:()=>n("nodes"),send:J,onFieldSet:u=>O.filled(u),onAttribute:(u,G)=>{u.localName==="a"&&(G==="data-record"||G==="data-place")&&ee.link(u),G==="data-lightbox"&&Be(u),G==="data-drop"&&He()},decorate:u=>{u.localName==="a"&&ee.link(u),Be(u),u.hasAttribute("data-drop")&&He()},before:(u,G,V)=>{O.heard(u,G),$.heard(u,G,V);let ye=G.closest("a[data-graview-link]");ye&&V.contains(ye)&&(u.type==="click"||u.type==="keydown"&&u.key==="Enter")&&(u.preventDefault(),u.stopPropagation(),ee.follow(ye));let re=G.closest("[data-lightbox]"),Fe=u.type==="keydown"?u.key:void 0;if(re&&V.contains(re)&&u.isTrusted&&(u.type==="click"||(Fe==="Enter"||Fe===" ")&&re.localName!=="button")&&(u.preventDefault(),u.stopPropagation(),X?.open(re)),U?.before(u,G,V))return!1;let he=O.press(u,G,V);if(!he||!c)return;u.stopPropagation();let Mt=c.pressed(l(e.store,o,C,he));P();let ze={as:he.as,...Mt},Et=G.closest("[data-act]");return queueMicrotask(()=>B(Et,ze)),{pressed:ze}}});for(let u of _.splice(0))pe(u);Q()},()=>n("start","the view's drawing could not be loaded"));let me=t=>E=ae(f,{source:t,name:o.name,limiter:A,readyMs:e.limits?.readyMs??5e3,silentMs:e.limits?.silentMs??5e3,onDropped:()=>R.dropped+=1,onStop:(p,x)=>n(p,x),onError:p=>{_e||n("error",p)},onReady:(p,x)=>{D=x,kt();let K=oe({store:e.store,principal:e.principal,view:o.name,nonce:p,send:l=>{l.type==="props"&&typeof l.push=="number"&&(z.set(l.push,F.now()),Q()),x.postMessage(l)},props:()=>{let l=ve(e.store,e.principal,{manifest:o,...e.input?{input:e.input()}:{},theme:de(),...e.places?{places:ne(e.places())}:{}});return C=new Set([...l.node?[l.node.id]:[],...(l.nodes??[]).map(I=>I.id)]),N=l,l},...j?{hand:j.hand}:{},judgeAct:(l,I)=>tt(e.store,o,l,I,{shown:C,file:O=>fe.get(O)??St(O),dropped:O=>fe.has(O)}),onHears:l=>{l.includes("drop")&&(Ce=!0)},onGestures:xt,onRender:l=>{_e=!0,pe(["render",l])},onPushed:(l,I)=>{if(z.delete(l),I>=M.pushMs)return n("slow");Oe=!0,Q()},onFlood:()=>n("flood"),onStyle:l=>pe(["style",l]),places:()=>[...new Set([...ne(e.places?.()??[]).map(l=>l.as),...Ie().map(l=>l.slug)])],...e.limits?{limits:e.limits}:{},limiter:A});c=K,x.onmessage=({data:l})=>{if(!E?.answer(l)&&(K.receive(l),P(),!v&&l?.nonce===p&&l.type==="navigate")){let I={...l.where!==void 0?{where:l.where}:{},...l.section!==void 0?{section:l.section}:{}},O=typeof l.place=="string"?{place:l.place,...I}:typeof l.to=="string"&&{record:l.to,...I};O&&ee.go(O)}},ue()}}),$e=t=>{"source"in t?(o.pictures?Promise.all([ke(t.source),Le]).then(([p])=>p):ke(t.source)).then(p=>{v||me({script:p})},()=>n("start","the view's runtime could not be loaded")):o.pictures?Le.then(()=>{v||me(t)},()=>n("start","the view's pictures could not be loaded")):me(t)};return typeof h=="function"?lt(h).then(t=>{if(v)return;let p=S(t);p?n(...p):$e(t)},t=>n("source",`Its code did not arrive${t instanceof Error&&t.message?`: ${t.message}`:""}.`)):$e(h),ge();function ge(){return{element:g,shadow:w,get worker(){return E?.worker},update:()=>{c&&ue()},get stats(){return P(),R},get refused(){return T?.refused??[]},dispose(){v=!0,a(),T?.dispose(),g.remove(),W?.remove()}}}}var wt="graview-guest-kit";function br(s,e){let i=s.ownerDocument,f=i.defaultView;if(!i.getElementById(wt)){let k=i.createElement("style");k.id=wt,k.textContent=Ke,i.head.appendChild(k)}let o=i.createElement("div");o.className="graview-guest",o.setAttribute("role","group"),o.setAttribute("aria-label",e.title??e.view),o.setAttribute("data-guest-view",e.view),s.appendChild(o);let g={applied:0,refused:0,dropped:0},w=se(e.limits),W=le(e.limits?.drawMs??100,()=>f.performance.now()),R,A,M,N=!1,c={applied:0,refused:0,dropped:0},E=()=>{if(!R)return;let k=R.stats;g.applied+=k.applied-c.applied,g.refused+=k.refused-c.refused,g.dropped+=k.dropped-c.dropped,c={...k}},T=()=>{E(),R?.dispose(),R=void 0,M?.stop()},v=(k,_)=>{N||(N=!0,T(),A?.dispose(),e.onFailure?.(k,_))};return M=ae(f,{source:e.worker,name:e.view,limiter:w,readyMs:e.limits?.readyMs??5e3,silentMs:e.limits?.silentMs??5e3,onDropped:()=>g.dropped+=1,onStop:(k,_)=>v(k,_),onReady:(k,_)=>{let P=Ee(o,{...e.kit?{kit:e.kit}:{},...e.links?{links:e.links}:{},onEvent:(d,y)=>_.postMessage({type:"event",listener:d,...y!==void 0?{detail:y}:{}}),...e.limits?.maxNodes!==void 0?{maxNodes:e.limits.maxNodes}:{},onOverBudget:()=>v("budget")});A=P;let r=oe({store:e.store,principal:e.principal,view:e.view,nonce:k,send:d=>_.postMessage(d),onRender:d=>{W.draw(y=>P.apply(d,y))||v("slow")},...e.input?{input:e.input}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{},onSize:e.onSize??(d=>o.style.minHeight=`${d}px`),...e.limits?{limits:e.limits}:{},limiter:w});R=r,_.onmessage=d=>{M?.answer(d.data)||(r.receive(d.data),E())},r.push()}}),{element:o,get worker(){return M?.worker},update:()=>R?.push(),get stats(){return E(),g},get refused(){return A?.refused??[]},dispose(){N=!0,T(),A?.dispose(),o.remove()}}}export{xe as GUEST_KIT,Ke as GUEST_KIT_CSS,be as KIT_LINK_TARGETS,dt as KIT_TONES,Ee as createKitRenderer,mt as hostAttribute,gt as kitValue,br as mountGuestWorker,zt as mountWorkerView};
@@ -1,4 +1,4 @@
1
- import{a as k}from"./chunk.G4JJXA63.js";import{a as Q}from"./chunk.Z5AB2DBF.js";import{a as Y}from"./chunk.HPAGOEZG.js";import{a as X}from"./chunk.I7XSDXQ3.js";import{c as _}from"./chunk.ZHLQWMV5.js";import{ad as G,cd as H,dd as P,ed as J,jb as q,kb as z}from"./chunk.V5MYKNL7.js";var O=e=>"failed"in e;function ue(e,n){let r=e.schema.kinds,t=e.policy?.sees;if(!t?.length||z(n))return{kinds:r};let o=q(n).roles??[],i=new Set(t.filter(s=>s.roles==="*"||o.some(a=>s.roles.includes(a))).flatMap(s=>s.kinds));return{kinds:r.filter(s=>i.has(s))}}function L(e,n){if(!n)return e;let r=new Set(n.kinds.filter(i=>e.tryDefinition(i)!==void 0));if(r.size===e.kinds.length)return e;let t=new Map,o=i=>{if(r.has(i)){if(!t.has(i)){let s=e.tryDefinition(i),a=Object.fromEntries(Object.entries(s?.edges??{}).flatMap(([l,d])=>{if(d.to==="*")return[[l,d]];let c=d.to.filter(u=>r.has(u));return c.length>0?[[l,{...d,to:c}]]:[]}));t.set(i,{...s,edges:a})}return t.get(i)}};return{...e,definitions:e.definitions.filter(i=>r.has(i.kind)),kinds:e.kinds.filter(i=>r.has(i)),tryDefinition:o,definition:i=>{let s=o(i);if(!s)throw new Error(`Unknown node kind "${i}"`);return s}}}var fe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),y=e=>fe(e).replace(/[-_]+/g," ").trim();function I(e){let n=[];for(let t of e.kinds){let o=e.tryDefinition(t);if(!o)continue;let i=o.display?.labels??{},s=Object.entries(o.fields?.shape??{}).filter(([d])=>d!=="id"&&d!=="kind").map(([d,c])=>{let u=X(c);return{name:d,type:u?.type,...u?.options?{options:u.options}:{},words:(i[d]??y(d)).toLowerCase()}}),a=Object.entries(o.edges??{}).map(([d,c])=>({name:d,from:t,to:c.to==="*"?e.kinds.filter(u=>u!==t):c.to,words:y(d)})),l=(o.plural??`${y(t)}s`).toLowerCase();n.push({kind:t,plural:l,noun:(o.noun??y(t)).toLowerCase(),fields:s,roles:o.fieldRoles??{},edges:a})}let r=new Map(n.map(t=>[t.kind,t]));return{schema:e,kinds:n,info:t=>r.get(t)}}var $=(e,n)=>n===void 0?void 0:e.fields.find(r=>r.name===n),A=e=>e?.type==="date"||e?.type==="datetime",N=e=>e?.type==="number"||e?.type==="integer"||e?.type==="duration",re=e=>` ${e.toLowerCase().replace(/[“”"’‘]/g,"'").replace(/[^\p{L}\p{N}' -]+/gu," ").replace(/\s+/g," ").trim()} `,E=(e,n)=>e.includes(` ${n} `),x=e=>e.endsWith("ies")?`${e.slice(0,-3)}y`:e.endsWith("ses")?e.slice(0,-2):e.endsWith("s")?e.slice(0,-1):e;function pe(e,n){let r=[];for(let t of n.kinds){let o=new Set([t.plural,t.noun,`${t.noun}s`,y(t.kind),`${y(t.kind)}s`]),i=-1;for(let s of o){let a=e.indexOf(` ${s} `);a>=0&&(i<0||a<i)&&(i=a)}i>=0&&r.push({info:t,at:i})}return r.sort((t,o)=>t.at-o.at).map(t=>t.info)}function v(e,n,r){let t=n.trim().toLowerCase();if(t.length===0)return;let o=e.fields.filter(i=>!r||r(i));return o.find(i=>i.words===t||y(i.name)===t||i.name.toLowerCase()===t)??o.find(i=>i.words===x(t)||y(i.name)===x(t))??o.find(i=>t.split(" ").some(s=>s.length>2&&(i.words.split(" ").includes(s)||i.words.split(" ").includes(x(s)))))}function oe(e,n,r){let t=n.trim().toLowerCase();if(t.length!==0)return e.edges.find(o=>o.words===t||o.name.toLowerCase()===t)??e.edges.find(o=>o.to.some(i=>{let s=r.info(i);return s!==void 0&&(s.noun===x(t)||s.plural===t||y(i)===x(t))}))??e.edges.find(o=>t.split(" ").some(i=>i.length>2&&o.words.split(" ").includes(i)))}function U(e){return/ (?:grouped |group |split |sorted |organi[sz]ed )?by ([\p{L}\p{N}' -]+?)(?= (?:and|with|for|in|on|only|where|from|this|that|as|sorted|grouped) |\s*$)/u.exec(e)?.[1]?.trim()}var me=/\bwho\b.*\b(covers?|cover|tends?|owns?|handles?|does|works? on|looks? after|is on|is assigned|staffs?|runs?)\b|\bcoverage\b|\bmatrix\b|\bwho covers\b/,ge=/\bcalendar\b|\bmonth\b|\bagenda\b|\bschedule\b|\bdue\b|\bdeadlines?\b|\bdates?\b|\bwhen\b/,ye=/\btimeline\b|\bover time\b|\bgantt\b|\bspans?\b|\bweek\b/,he=/\bboard\b|\bkanban\b|\bcolumns?\b|\bpipeline\b|\bstages?\b|\bstatus\b/,be=/\blaid out\b|\blayout\b|\bseating\b|\bwhere (?:they|it|each) (?:sits?|lies?|stands?)\b|\bfloor\b/,we=/\bplan\b|\bmap\b|\bregions?\b/,ke=/\blist\b|\btable\b|\bgroup(?:ed)? by\b|\bsort(?:ed)? by\b|\bonly\b|\bjust the\b/;function $e(e){let n=[];return/\blist\b|\btable\b/.test(e)&&n.push("blocks"),me.test(e)&&n.push("coverage"),be.test(e)&&n.push("board"),(/\bfloor plan\b/.test(e)||we.test(e))&&n.push("plan"),ye.test(e)&&n.push("timeline"),ge.test(e)&&n.push("calendar"),he.test(e)&&n.push("columns"),ke.test(e)&&!n.includes("blocks")&&n.push("blocks"),n.length===0&&U(e)&&n.push("columns"),n}var se=e=>{let n=r=>r?` and not ${r}`:"";if(/\boverdue\b|\blate\b|\bpast due\b/.test(e))return{cond:(r,t)=>`days(today(), ${r}) < 0${n(t)}`,says:r=>`overdue by ${r.words}`};if(/\btoday\b/.test(e))return{range:"day",cond:r=>`days(today(), ${r}) == 0`,says:r=>`with ${r.words} today`};if(/\bthis week\b|\bnext 7 days\b|\bnext week\b/.test(e))return{range:"week",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 6`,says:r=>`with ${r.words} in the next week`};if(/\bthis month\b|\bnext 30 days\b|\bnext month\b/.test(e))return{range:"month",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 30`,says:r=>`with ${r.words} in the next month`};if(/\blast month\b|\bpast month\b/.test(e))return{range:"month",cond:r=>`days(today(), ${r}) >= -30 and days(today(), ${r}) <= 0`,says:r=>`with ${r.words} in the last month`};if(/\bthis year\b/.test(e))return{range:"year",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 365`,says:r=>`with ${r.words} in the next year`};if(/\bquarter\b/.test(e))return{range:"quarter",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 91`,says:r=>`with ${r.words} in the next quarter`}},M=e=>{if(/\bagenda\b|\bin order\b/.test(e))return"agenda";if(/\btoday\b|\bday\b/.test(e))return"day";if(/\bweek\b/.test(e))return"week";if(/\bquarter\b/.test(e))return"quarter";if(/\byears\b/.test(e))return"years";if(/\byear\b/.test(e))return"year";if(/\bmonth\b/.test(e))return"month"},Z=/^(user|person|people|member|staff|gardener|volunteer|owner|agent|employee|worker|team|player|customer|client|contact|party|attendee|guest)s?$/,j=class extends Error{},h=e=>{throw new j(e)};function Se(e,n){let r=e.fields.filter(i=>i.type==="enum");if(n){let i=v(e,n);if(i&&i.type==="enum")return i;i&&h(`${e.plural}' ${i.words} is not a choice, so it has no columns`)}let t=$(e,e.roles.status??e.roles.column);if(t?.type==="enum")return t;let o=r.find(i=>/^(status|stage|state|phase)$/.test(i.name));return o||(r[0]?r[0]:h(`${e.plural} have no choice field to put in columns`))}function ee(e,n){let r=e.fields.filter(A),t=l=>{let d=$(e,e.roles[l]);return A(d)?d:void 0},i=r.find(l=>E(n,l.words)||E(n,y(l.name)))??t("start")??r.find(l=>/^(due|date|on|at|start|starts|begins|from|sown|when)/i.test(l.name))??r[0];if(!i)return h(`no date field on ${e.plural}`);let s=t("end")??r.find(l=>l!==i&&/^(end|ends|until|to|finish|finished|harvested|due|closes|through)/i.test(l.name)),a=e.fields.find(l=>l.type==="boolean"&&/^(done|finished|complete|completed|closed)$/.test(l.name));return{start:i,...s&&s!==i?{end:s}:{},...a?{done:a}:{}}}function ie(e){let n=$(e,e.roles.start),r=$(e,e.roles.end),t=$(e,e.roles.column??e.roles.day??e.roles.columns);if(N(n)&&N(r)&&t?.type==="enum")return{start:n,end:r,column:t}}function De(e,n,r,t){let o=[];for(let s of e.kinds)for(let a of s.edges)for(let l of a.to){let d=e.info(l);if(!d||d.kind===s.kind)continue;let c=0;n.includes(s)&&(c+=4),n.includes(d)&&(c+=4),(Z.test(d.kind)||Z.test(d.noun))&&(c+=3),t&&(a.words.includes(t)||d.noun===x(t))&&(c+=5),a.words.split(" ").some(u=>u.length>2&&r.includes(` ${u}`))&&(c+=2),o.push({rows:s,across:d,link:a,score:c})}let i=o.sort((s,a)=>a.score-s.score)[0];return i||h(n[0]?`${n[0].plural} are joined to nothing else, so there is no who-covers-what to draw`:"nothing here is joined to anything else, so there is no who-covers-what to draw")}function ae(e,n,r,t,o){let i=U(t);switch(e){case"columns":{if(i){let s=v(n,i);if(!s||s.type!=="enum"){let a=oe(n,i,r);if(a){let l=r.info(a.to[0]);return{lens:"coverage",kind:n.kind,across:l.kind,link:a.name}}}}return{lens:"columns",kind:n.kind,column:Se(n,i).name}}case"calendar":{let s=ee(n,t),a=M(t);return{lens:"calendar",kind:n.kind,start:s.start.name,...s.end?{end:s.end.name}:{},...s.done?{done:s.done.name}:{},...a?{range:a}:{}}}case"timeline":{let s=ie(n);if(s&&!/\bdates?\b|\bdue\b|\bdeadlines?\b|\bmonths?\b|\byears?\b/.test(t))return{lens:"timeline",kind:n.kind,start:s.start.name,end:s.end.name,column:s.column.name};let a=ee(n,t);return{lens:"calendar",kind:n.kind,start:a.start.name,...a.end?{end:a.end.name}:{},...a.done?{done:a.done.name}:{},range:M(t)??"quarter"}}case"coverage":{let s=De(r,o,t,i);return{lens:"coverage",kind:s.rows.kind,across:s.across.kind,link:s.link.name}}case"board":{let s=$(n,n.roles.x)??n.fields.find(c=>c.name==="x"),a=$(n,n.roles.y)??n.fields.find(c=>c.name==="y");if(!N(s)||!N(a))return h(`${n.plural} have no x and y to be laid out by`);let d=r.kinds.flatMap(c=>c.edges.filter(u=>u.to.includes(n.kind)&&c.kind!==n.kind))[0]??n.edges[0];return d?{lens:"board",kind:n.kind,x:s.name,y:a.name,fill:d.name,...d.from!==n.kind?{fillFrom:"occupant"}:{}}:h(`nothing is joined to ${n.plural} to fill them`)}case"plan":{let s=$(n,n.roles.outline)??n.fields.find(a=>a.name==="outline");return s?{lens:"plan",kind:n.kind,outline:s.name}:h(`${n.plural} have no outline to draw a plan from`)}case"blocks":{let s={lens:"blocks",kind:n.kind,as:/\bcards?\b/.test(t)?"card":"row"},a=/ group(?:ed)? by ([\p{L}\p{N} -]+?)(?= (?:and|only|sorted|with)|\s*$)/u.exec(t)?.[1]??(i&&!/ sort(?:ed)? by /.test(t)?i:void 0);if(a){let c=v(n,a);if(!c||c.type!=="enum")return h(c?`${n.plural}' ${c.words} is not a choice, so they cannot be grouped by it`:`${n.plural} have nothing called ${a} to group by`);s.group=c.name}let l=/ sort(?:ed)? by ([\p{L}\p{N} -]+?)(?= (?:and|only|grouped|with)|\s*$)/u.exec(t)?.[1];if(l){let c=v(n,l);if(!c)return h(`${n.plural} have nothing called ${l} to sort by`);s.sort={by:c.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}let d=V(n,t);return d.length>0&&(s.where=d),s}}}function V(e,n){let r=[],t=se(n);if(t){let o=e.fields.filter(A),i=$(e,e.roles.start),s=o.find(l=>E(n,l.words))??(A(i)?i:void 0)??o[0];(!s||!A(s))&&h(`no date field on ${e.plural}`);let a=e.fields.find(l=>l.type==="boolean"&&/^(done|finished|complete|completed|closed)$/.test(l.name));r.push({expr:t.cond(s.name,/\boverdue\b|\blate\b|\bpast due\b/.test(n)?a?.name:void 0),says:t.says(s)})}if(/\bonly\b|\bjust\b|\bthat are\b|\bwhich are\b/.test(n)){for(let o of e.fields){if(o.type!=="enum")continue;let i=o.options?.find(s=>E(n,s.toLowerCase())||E(n,y(s)));i&&r.push({expr:`${o.name} == '${i.replace(/'/g,"")}'`,says:`that are ${y(i)}`})}if(/\bnot done\b|\bundone\b|\bunfinished\b|\bopen ones\b|\bstill to do\b/.test(n)){let o=e.fields.find(i=>i.type==="boolean"&&/^(done|finished|complete|completed)$/.test(i.name));o&&r.push({expr:`not ${o.name}`,says:`not ${o.words}`})}}return r}var B={columns:"A board",calendar:"A calendar",timeline:"A timeline",coverage:"A grid",board:"A layout",plan:"A plan",blocks:"A list",reach:"A picture"};function Re(e,n){let r=n.info(e.kind),t=o=>o?$(r,o)?.words??y(o):"";switch(e.lens){case"columns":return{title:`${k(r.plural)} by ${t(e.column)}`,detail:`of ${r.plural} by ${t(e.column)}`};case"calendar":{let o=e.range??"month";if(o==="agenda")return{title:`${k(r.plural)} in date order`,detail:`of ${r.plural} in order of ${t(e.start)}`};let i=o==="years"?"year":o;return{title:`${k(r.plural)} by ${i}`,detail:`of ${r.plural} by ${t(e.start)}, a ${i} at a time`}}case"timeline":return{title:`${k(r.plural)} over the ${t(e.column)}`,detail:`of ${r.plural} from ${t(e.start)} to ${t(e.end)}, by ${t(e.column)}`};case"coverage":{let o=n.info(e.across);return{title:`${k(r.plural)} by ${o.noun}`,detail:`of which ${o.noun} covers which ${r.noun}`}}case"board":return{title:`${k(r.plural)} where they stand`,detail:`of ${r.plural} where they stand`};case"plan":return{title:`${k(r.plural)} on a plan`,detail:`of ${r.plural}`};default:{let o=[e.where?.map(i=>i.says).join(" and "),e.group?`by ${t(e.group)}`:void 0,e.sort?`in order of ${t(e.sort.by)}`:void 0].filter(i=>!!i);return{title:[k(r.plural),...o].join(" "),detail:[`of ${r.plural}`,...o].join(" ")}}}}function Ae(e,n){let r={title:n,on:e.kind};switch(e.lens){case"columns":return{name:"columns",...r,bindings:{[e.kind]:{column:e.column}}};case"calendar":return{name:"calendar",...r,bindings:{[e.kind]:{start:e.start,...e.end?{end:e.end}:{},...e.done?{done:e.done}:{}}},...e.range?{options:{range:e.range}}:{}};case"timeline":return{name:"timeline",...r,bindings:{[e.kind]:{start:e.start,end:e.end,column:e.column}}};case"coverage":return{name:"coverage",...r,bindings:{rows:{kind:e.kind},columns:{kind:e.across},link:{edge:e.link}}};case"board":return{name:"board",...r,bindings:{slots:{kind:e.kind},x:{field:e.x,on:"slots"},y:{field:e.y,on:"slots"},fill:{edge:e.fill}},...e.fillFrom?{options:{fillFrom:e.fillFrom}}:{}};case"plan":return{name:"plan",...r,bindings:{regions:{kind:e.kind},outline:{field:e.outline,on:"regions"}}};default:{let t=e.where?.length?` where ${e.where.map(i=>e.where.length>1?`(${i.expr})`:i.expr).join(" and ")}`:"",o={list:`all('${e.kind}')${t}`,as:e.as??"row"};return e.group&&(o.group=e.group),e.sort&&(o.sort=e.sort.direction?{by:e.sort.by,direction:e.sort.direction}:e.sort.by),o.empty="Nothing here yet.",{name:"blocks",...r,options:{blocks:[o]}}}}}function C(e,n){let r=o=>o.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,""),t=new Set(["home","overview",...Q(n).map(o=>o.slug),...(n.lenses??[]).flatMap(o=>o.title?[r(o.title)]:[])]);if(!t.has(r(e)))return e;for(let o=2;;o++)if(!t.has(r(`${e} ${o}`)))return`${e} ${o}`}var ne={title:[],headline:[],text:["tone"],figure:["as","currency","label"],list:["sort","limit","group","empty","as"],progress:["label"],group:["direction"],when:["show"],divider:[]};function Ee(e,n){if(!Array.isArray(n)||n.length===0)return"it has no blocks to draw";if(n.length>40)return"it has more blocks than a place draws";let r=(s,a)=>{if(typeof s!="string"||s.trim()==="")return`its ${a} says nothing`;try{return _(s)}catch(l){return`its ${a} does not read: ${l instanceof Error?l.message.replace(/ \(at character.*$/,""):String(l)}`}},t=s=>{if(s.t==="where")return t(s.set);if(s.t==="call"&&s.fn==="all"){let a=s.args[0];return a?.t==="lit"&&typeof a.value=="string"?e.info(a.value)??null:void 0}},o=(s,a)=>{switch(s.t){case"lit":return;case"ident":return a&&!a.fields.some(l=>l.name===s.name)&&!a.edges.some(l=>l.name===s.name)?`${a.plural} have nothing called ${s.name}`:void 0;case"member":return o(s.object,a);case"list":return s.items.map(l=>o(l,a)).find(Boolean);case"unary":return o(s.operand,a);case"binary":return o(s.left,a)??o(s.right,a);case"where":{let l=t(s.set);return l===null?"Nothing by that name here":o(s.set,a)??o(s.filter,l??void 0)}case"call":return s.fn==="all"?t(s)===null?"Nothing by that name here":void 0:s.args.map(l=>o(l,a)).find(Boolean)}},i=(s,a)=>{if(a>4)return"its blocks nest deeper than a place draws";for(let l of s){if(!w(l))return"a block is not an object";let d=Object.keys(ne).find(p=>p in l);if(!d)return`"${Object.keys(l)[0]??""}" is not a block a place draws`;let c=Object.keys(l).find(p=>p!==d&&p!=="key"&&!ne[d].includes(p));if(c)return`a ${d} block takes no "${c}"`;let u=l[d];if(d==="list"||d==="figure"||d==="when"){if(d==="figure"&&u===!0)continue;let p=r(u,d);if(typeof p=="string")return p;let g=o(p,void 0);if(g)return g;if(d==="list"){let f=t(p);if(f==null)return f===null?"Nothing by that name here":"its list does not say which records it lists, like all('task')";for(let m of["group","sort"]){let b=l[m],S=typeof b=="string"?b:w(b)&&typeof b.by=="string"?b.by:void 0;if(b===void 0)continue;let D=S?f.fields.find(ce=>ce.name===S):void 0;if(!D)return`${f.plural} have nothing called ${String(S??b)} to ${m} by`;if(m==="group"&&D.type!=="enum")return`${f.plural}' ${D.words} is not a choice, so they cannot be grouped by it`}}if(d==="when"){let f=l.show;if(!Array.isArray(f))return"a when block shows a list of blocks";let m=i(f,a+1);if(m)return m}}else if(d==="group"){if(!Array.isArray(u))return"a group block holds a list of blocks";let p=i(u,a+1);if(p)return p}else{if(d!=="divider"&&typeof u!="string")return`a ${d} block says words`;if(typeof u=="string")for(let p of u.matchAll(/\{([^{}]*)\}/g)){let g=p[1].split(/\|(?![|])/)[0],f=r(g,`${d}'s braces`);if(typeof f=="string")return f;let m=o(f,void 0);if(m)return m}}}};return i(n,1)}function T(e,n,r){let t=L(e.schema,r),o=f=>({ok:!1,failed:`Couldn't draw that: ${f.replace(/\.$/,"")}.`});if(!P(n.name)||n.name==="reach")return o(`"${String(n.name)}" is not a picture the seat can draw; it draws ${H.filter(f=>f!=="reach").join(", ")}`);if(typeof n.title!="string"||n.title.trim().length===0||n.title.length>80)return o("it needs a title of a few words");if(typeof n.on!="string"||!t.tryDefinition(n.on))return o("Nothing by that name here");let i=G[n.name],s=n.bindings??{};if(i.binds==="fields")for(let[f,m]of Object.entries(s)){if(!t.tryDefinition(f))return o("Nothing by that name here");let b=Object.keys(t.tryDefinition(f).fields?.shape??{});for(let[S,D]of Object.entries(m??{}))if(typeof D!="string"||!b.includes(D))return o(`${y(f)} has no field "${String(D)}" for its ${S}`);for(let S of i.requiredRoles)if(!(S in(m??{})))return o(`a ${n.name} needs ${y(f)}'s ${S}`)}else if(i.binds==="entities")for(let f of i.requiredRoles){let m=s[f];if(!m)return o(`a ${n.name} needs its ${f}`);if(typeof m.kind=="string"&&!t.tryDefinition(m.kind))return o("Nothing by that name here")}let a={...e,schema:t,lenses:[...e.lenses??[],n]},l=a.lenses.length-1,d=J(a),c=`lenses.${l}`,u=d.findings.find(f=>f.path===c||f.path.startsWith(`${c}.`));if(u)return o(u.message.replace(/^"[^"]*" /,"it "));let p=d.undrawn.find(f=>f.index===l);if(p)return o(p.why);let g=d.drawn.find(f=>f.index===l);if(!g)return o("its bindings name something the app does not have");if(g.as==="overview")return o(`"${n.title}" is the scene's own address; give it another title`);if(n.name==="blocks"){let f=Ee(I(t),n.options?.blocks);if(f)return o(f)}return{ok:!0,drawn:g}}function K(e){return{op:"add-lens",title:e.title,lens:e.name,on:e.on,...e.bindings?{bindings:e.bindings}:{},...e.options?{options:e.options}:{}}}function xe(e){return{op:"remove-lens",title:e.title,on:e.on}}var w=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function de(e){let n=w(e)?e:{},r=String(n.lens??n.name??""),t=n.bindings,o=typeof n.on=="string"?n.on:w(t)&&G[r]?.binds==="fields"?Object.keys(t)[0]??"":"";return{name:r,title:typeof n.title=="string"?n.title.trim():"",on:o,...w(t)?{bindings:t}:{},...w(n.options)?{options:n.options}:{}}}function ve(e){let n=o=>w(e.bindings?.[o])?e.bindings[o]:{},r=o=>typeof o=="string"?o:void 0,t=n(e.on);switch(e.name){case"columns":return r(t.column)?{lens:"columns",kind:e.on,column:t.column}:void 0;case"calendar":{let o=r(e.options?.range);return r(t.start)?{lens:"calendar",kind:e.on,start:t.start,...r(t.end)?{end:t.end}:{},...r(t.done)?{done:t.done}:{},...o?{range:o}:{}}:void 0}case"timeline":return r(t.start)&&r(t.end)&&r(t.column)?{lens:"timeline",kind:e.on,start:t.start,end:t.end,column:t.column}:void 0;case"coverage":{let o=w(e.bindings?.columns)?r(e.bindings.columns.kind):void 0,i=w(e.bindings?.link)?r(e.bindings.link.edge):void 0;return o&&i?{lens:"coverage",kind:e.on,across:o,link:i}:void 0}case"blocks":{let o=e.options?.blocks;if(!Array.isArray(o)||o.length!==1||!w(o[0]))return;let i=o[0],s=new RegExp(`^all\\('${e.on}'\\)(?: where (.+))?$`).exec(String(i.list??""));if(!s)return;let a=i.sort;return{lens:"blocks",kind:e.on,as:i.as==="card"?"card":"row",...typeof i.group=="string"?{group:i.group}:{},...typeof a=="string"?{sort:{by:a}}:w(a)&&typeof a.by=="string"?{sort:{by:a.by,...a.direction==="desc"?{direction:"desc"}:{}}}:{},...s[1]?{where:[{expr:s[1],says:"as asked"}]}:{}}}default:return}}function W(e,n,r,t,o){let i=I(L(e.schema,t)).info(n.on),s=ve(n);return{title:n.title,said:`${B[n.name]??"A picture"} of ${i?.plural??y(n.on)}.`,kind:n.on,lens:n,drawn:r,edit:K(n),by:o,asks:[],...s?{recipe:s}:{}}}function te(e){return{title:e.title,said:e.said,lens:{title:e.lens.title,lens:e.lens.name,on:e.lens.on,...e.lens.bindings?{bindings:e.lens.bindings}:{},...e.lens.options?{options:e.lens.options}:{}},edit:e.edit,by:e.by,check:"It draws, and graview check would take it."}}function F(e,n,r,t,o){let i=Re(e,n),s=e.title??o??C(i.title,r.app),a=Ae(e,s),l=T(r.app,a,r.sight);return l.ok?{title:s,said:`${B[e.lens]} ${i.detail}.`,kind:e.kind,lens:a,drawn:l.drawn,edit:K(a),by:"template",asks:t,recipe:e}:{failed:l.failed,...r.lastGood?{lastGood:r.lastGood}:{}}}function Ye(e,n){let r=I(L(n.app.schema,n.sight)),t=r.info(e.kind);if(!t)return{failed:"Couldn't draw that: Nothing by that name here."};let o=e.lens==="blocks"&&!e.group&&!e.sort&&!e.where?.length&&e.title===void 0;return F(o?{...e,title:C(`Every ${t.noun}`,n.app)}:e,r,n,[])}function Le(e,n,r,t){if(r.length>0)return r;let o=s=>{switch(e){case"columns":return s.fields.some(a=>a.type==="enum");case"calendar":return s.fields.some(A);case"timeline":return ie(s)!==void 0||s.fields.some(A);case"coverage":return s.edges.some(a=>a.to.some(l=>l!==s.kind));case"board":return s.fields.some(a=>a.name==="x")&&s.fields.some(a=>a.name==="y");case"plan":return s.fields.some(a=>a.name==="outline")||s.roles.outline!==void 0;default:return!0}};return[...n.kinds.filter(o)].sort((s,a)=>Number(a.fields.some(l=>E(t,l.words)))-Number(s.fields.some(l=>E(t,l.words))))}function Ie(e,n){let r=I(L(n.app.schema,n.sight)),t=re(e),o=$e(t);if(o.length===0)return;let i=pe(t,r),s;for(let a of o){let l=a==="coverage"?[i[0]??r.kinds[0]].filter(d=>!!d):Le(a,r,i,t);for(let d of l)try{let c=ae(a,d,r,t,i),u=F(c,r,n,[e]);if(!O(u))return u;s??=u.failed}catch(c){if(!(c instanceof j))throw c;s??=`Couldn't draw that: ${c.message}.`}l.length===0&&i.length===0&&(s??=`Couldn't draw that: nothing here has what ${B[a].toLowerCase()} needs.`)}return{failed:s??"Couldn't draw that: Nothing by that name here.",...n.lastGood?{lastGood:n.lastGood}:{}}}async function Oe(e,n){let r=n.lastGood?{lastGood:n.lastGood}:{};if(e.trim().length===0)return{failed:"Say what you would like to see, like \u201Ca board of tasks by status\u201D.",...r};let t=Ie(e,n);if(t&&!O(t))return t;if(!n.complete)return t??{failed:"Couldn't draw that: drawing freely needs AI, which isn't on here. Ask for a board, a calendar, a timeline, a list or who covers what.",...r};let o=await le(e,n,void 0);return O(o)&&t?t:o}async function je(e,n,r){let t={lastGood:e},o={...r,lastGood:e},i=I(L(r.app.schema,r.sight)),s=re(n),a=i.info(e.kind),l=[...e.asks,n];if(!a)return{failed:"Couldn't change that: Nothing by that name here.",...t};let d=e.recipe,c=/^ (?:call|name|title) (?:it|this)? ?(.+?) $/.exec(s)??/ (?:call|name) it (.+?) $/.exec(s);try{if(c){let g=n.replace(/^.*?\b(?:call|name|title)\b\s*(?:it|this)?\s*/i,"").replace(/^["“']|["”']$/g,"").trim();if(g.length===0)return{failed:"Couldn't change that: say what to call it.",...t};let f={...e.lens,title:C(g,r.app)},m=T(r.app,f,r.sight);return m.ok?{...e,title:f.title,lens:f,drawn:m.drawn,edit:K(f),asks:l,...d?{recipe:{...d,title:f.title}}:{}}:{failed:m.failed,...t}}let p=/ as (?:a |an )?(board|kanban|calendar|timeline|list|table|cards|rows|grid|plan|layout)\b/.exec(s);if(p){let g=p[1]==="board"||p[1]==="kanban"?"columns":p[1]==="calendar"?"calendar":p[1]==="timeline"?"timeline":p[1]==="grid"?"coverage":p[1]==="plan"?"plan":p[1]==="layout"?"board":"blocks",f=ae(g,a,i,s,[a]),m=p[1]==="cards"?"card":p[1]==="rows"?"row":void 0,b=g==="blocks"&&d?.lens==="blocks"?{...d,...m?{as:m}:{}}:g==="blocks"&&d?.lens==="columns"?{...f,group:d.column,...m?{as:m}:{}}:f;return F(R(b),i,o,l)}if(d){let g=Te(d,a,i,s);if(g)return F(g,i,o,l)}}catch(p){if(!(p instanceof j))throw p;return{failed:`Couldn't change that: ${p.message}.`,...t}}if(!r.complete)return{failed:"Couldn't change that: changing it freely needs AI, which isn't on here. Try \u201Cgroup by status\u201D, \u201Conly this month\u201D or \u201Cas a calendar\u201D.",...t};let u=await le(n,o,e);return O(u)?u:{...u,asks:l}}var R=e=>{let{title:n,...r}=e;return r};function Te(e,n,r,t){let o=/ (?:group(?:ed)?|split|organi[sz]ed?|put them|columns) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1]??(/^ by /.test(t)?U(t):void 0);if(o){let d=v(n,o);if(d?.type==="enum")return e.lens==="blocks"?{...R(e),group:d.name}:{lens:"columns",kind:e.kind,column:d.name};let c=oe(n,o,r);return c?{lens:"coverage",kind:e.kind,across:c.to[0],link:c.name}:h(d?`${n.plural}' ${d.words} is not a choice, so they cannot be grouped by it`:`${n.plural} have nothing called ${o} to group by`)}let i=/ (?:sort(?:ed)?|order(?:ed)?) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1];if(i){let d=v(n,i);return d?{...e.lens==="blocks"?R(e):{lens:"blocks",kind:e.kind,as:"row",...e.lens==="columns"?{group:e.column}:{}},sort:{by:d.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}:h(`${n.plural} have nothing called ${i} to sort by`)}if(/\b(?:all of them|everything|show all|clear the filter|no filter|without the filter)\b/.test(t)){if(e.lens!=="blocks"||!e.where)return h("it already shows all of them");let{where:d,...c}=R(e);return c}let s=se(t);if(s&&e.lens==="calendar"&&s.range)return{...R(e),range:s.range};if(s&&e.lens==="calendar"&&!s.range)return{lens:"blocks",kind:e.kind,as:"row",sort:{by:e.start},where:V(n,t)};let a=V(n,t);if(a.length>0){let d=e.lens==="blocks"?R(e):{lens:"blocks",kind:e.kind,as:"row",...e.lens==="columns"?{group:e.column}:{}};return{...d,where:[...d.where??[],...a]}}let l=e.lens==="calendar"?M(t):void 0;if(l)return{...R(e),range:l}}function Ne(e){return e.kinds.map(n=>{let r=n.fields.map(i=>`${i.name} (${i.type??"value"}${i.options?`: ${i.options.join(" | ")}`:""})`).join(", "),t=n.edges.map(i=>`${i.name} \u2192 ${i.to.join(" | ")}`).join(", "),o=Object.entries(n.roles).map(([i,s])=>`${i}=${s}`).join(", ");return`- ${n.kind} ("${n.plural}"): ${r}${t?`; relations: ${t}`:""}${o?`; roles: ${o}`:""}`}).join(`
1
+ import{a as k}from"./chunk.G4JJXA63.js";import{a as Q}from"./chunk.WZEA2UK6.js";import{a as Y}from"./chunk.WERBD5ZR.js";import{a as X}from"./chunk.BZ4VZ6WQ.js";import{c as _}from"./chunk.J7ZMNAWB.js";import{cd as G,ed as H,fd as P,gd as J,kb as q,lb as z}from"./chunk.UG727PEE.js";var O=e=>"failed"in e;function ue(e,n){let r=e.schema.kinds,t=e.policy?.sees;if(!t?.length||z(n))return{kinds:r};let o=q(n).roles??[],i=new Set(t.filter(s=>s.roles==="*"||o.some(a=>s.roles.includes(a))).flatMap(s=>s.kinds));return{kinds:r.filter(s=>i.has(s))}}function L(e,n){if(!n)return e;let r=new Set(n.kinds.filter(i=>e.tryDefinition(i)!==void 0));if(r.size===e.kinds.length)return e;let t=new Map,o=i=>{if(r.has(i)){if(!t.has(i)){let s=e.tryDefinition(i),a=Object.fromEntries(Object.entries(s?.edges??{}).flatMap(([l,d])=>{if(d.to==="*")return[[l,d]];let c=d.to.filter(u=>r.has(u));return c.length>0?[[l,{...d,to:c}]]:[]}));t.set(i,{...s,edges:a})}return t.get(i)}};return{...e,definitions:e.definitions.filter(i=>r.has(i.kind)),kinds:e.kinds.filter(i=>r.has(i)),tryDefinition:o,definition:i=>{let s=o(i);if(!s)throw new Error(`Unknown node kind "${i}"`);return s}}}var fe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),y=e=>fe(e).replace(/[-_]+/g," ").trim();function I(e){let n=[];for(let t of e.kinds){let o=e.tryDefinition(t);if(!o)continue;let i=o.display?.labels??{},s=Object.entries(o.fields?.shape??{}).filter(([d])=>d!=="id"&&d!=="kind").map(([d,c])=>{let u=X(c);return{name:d,type:u?.type,...u?.options?{options:u.options}:{},words:(i[d]??y(d)).toLowerCase()}}),a=Object.entries(o.edges??{}).map(([d,c])=>({name:d,from:t,to:c.to==="*"?e.kinds.filter(u=>u!==t):c.to,words:y(d)})),l=(o.plural??`${y(t)}s`).toLowerCase();n.push({kind:t,plural:l,noun:(o.noun??y(t)).toLowerCase(),fields:s,roles:o.fieldRoles??{},edges:a})}let r=new Map(n.map(t=>[t.kind,t]));return{schema:e,kinds:n,info:t=>r.get(t)}}var $=(e,n)=>n===void 0?void 0:e.fields.find(r=>r.name===n),A=e=>e?.type==="date"||e?.type==="datetime",N=e=>e?.type==="number"||e?.type==="integer"||e?.type==="duration",re=e=>` ${e.toLowerCase().replace(/[“”"’‘]/g,"'").replace(/[^\p{L}\p{N}' -]+/gu," ").replace(/\s+/g," ").trim()} `,E=(e,n)=>e.includes(` ${n} `),x=e=>e.endsWith("ies")?`${e.slice(0,-3)}y`:e.endsWith("ses")?e.slice(0,-2):e.endsWith("s")?e.slice(0,-1):e;function pe(e,n){let r=[];for(let t of n.kinds){let o=new Set([t.plural,t.noun,`${t.noun}s`,y(t.kind),`${y(t.kind)}s`]),i=-1;for(let s of o){let a=e.indexOf(` ${s} `);a>=0&&(i<0||a<i)&&(i=a)}i>=0&&r.push({info:t,at:i})}return r.sort((t,o)=>t.at-o.at).map(t=>t.info)}function v(e,n,r){let t=n.trim().toLowerCase();if(t.length===0)return;let o=e.fields.filter(i=>!r||r(i));return o.find(i=>i.words===t||y(i.name)===t||i.name.toLowerCase()===t)??o.find(i=>i.words===x(t)||y(i.name)===x(t))??o.find(i=>t.split(" ").some(s=>s.length>2&&(i.words.split(" ").includes(s)||i.words.split(" ").includes(x(s)))))}function oe(e,n,r){let t=n.trim().toLowerCase();if(t.length!==0)return e.edges.find(o=>o.words===t||o.name.toLowerCase()===t)??e.edges.find(o=>o.to.some(i=>{let s=r.info(i);return s!==void 0&&(s.noun===x(t)||s.plural===t||y(i)===x(t))}))??e.edges.find(o=>t.split(" ").some(i=>i.length>2&&o.words.split(" ").includes(i)))}function U(e){return/ (?:grouped |group |split |sorted |organi[sz]ed )?by ([\p{L}\p{N}' -]+?)(?= (?:and|with|for|in|on|only|where|from|this|that|as|sorted|grouped) |\s*$)/u.exec(e)?.[1]?.trim()}var me=/\bwho\b.*\b(covers?|cover|tends?|owns?|handles?|does|works? on|looks? after|is on|is assigned|staffs?|runs?)\b|\bcoverage\b|\bmatrix\b|\bwho covers\b/,ge=/\bcalendar\b|\bmonth\b|\bagenda\b|\bschedule\b|\bdue\b|\bdeadlines?\b|\bdates?\b|\bwhen\b/,ye=/\btimeline\b|\bover time\b|\bgantt\b|\bspans?\b|\bweek\b/,he=/\bboard\b|\bkanban\b|\bcolumns?\b|\bpipeline\b|\bstages?\b|\bstatus\b/,be=/\blaid out\b|\blayout\b|\bseating\b|\bwhere (?:they|it|each) (?:sits?|lies?|stands?)\b|\bfloor\b/,we=/\bplan\b|\bmap\b|\bregions?\b/,ke=/\blist\b|\btable\b|\bgroup(?:ed)? by\b|\bsort(?:ed)? by\b|\bonly\b|\bjust the\b/;function $e(e){let n=[];return/\blist\b|\btable\b/.test(e)&&n.push("blocks"),me.test(e)&&n.push("coverage"),be.test(e)&&n.push("board"),(/\bfloor plan\b/.test(e)||we.test(e))&&n.push("plan"),ye.test(e)&&n.push("timeline"),ge.test(e)&&n.push("calendar"),he.test(e)&&n.push("columns"),ke.test(e)&&!n.includes("blocks")&&n.push("blocks"),n.length===0&&U(e)&&n.push("columns"),n}var se=e=>{let n=r=>r?` and not ${r}`:"";if(/\boverdue\b|\blate\b|\bpast due\b/.test(e))return{cond:(r,t)=>`days(today(), ${r}) < 0${n(t)}`,says:r=>`overdue by ${r.words}`};if(/\btoday\b/.test(e))return{range:"day",cond:r=>`days(today(), ${r}) == 0`,says:r=>`with ${r.words} today`};if(/\bthis week\b|\bnext 7 days\b|\bnext week\b/.test(e))return{range:"week",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 6`,says:r=>`with ${r.words} in the next week`};if(/\bthis month\b|\bnext 30 days\b|\bnext month\b/.test(e))return{range:"month",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 30`,says:r=>`with ${r.words} in the next month`};if(/\blast month\b|\bpast month\b/.test(e))return{range:"month",cond:r=>`days(today(), ${r}) >= -30 and days(today(), ${r}) <= 0`,says:r=>`with ${r.words} in the last month`};if(/\bthis year\b/.test(e))return{range:"year",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 365`,says:r=>`with ${r.words} in the next year`};if(/\bquarter\b/.test(e))return{range:"quarter",cond:r=>`days(today(), ${r}) >= 0 and days(today(), ${r}) <= 91`,says:r=>`with ${r.words} in the next quarter`}},M=e=>{if(/\bagenda\b|\bin order\b/.test(e))return"agenda";if(/\btoday\b|\bday\b/.test(e))return"day";if(/\bweek\b/.test(e))return"week";if(/\bquarter\b/.test(e))return"quarter";if(/\byears\b/.test(e))return"years";if(/\byear\b/.test(e))return"year";if(/\bmonth\b/.test(e))return"month"},Z=/^(user|person|people|member|staff|gardener|volunteer|owner|agent|employee|worker|team|player|customer|client|contact|party|attendee|guest)s?$/,j=class extends Error{},h=e=>{throw new j(e)};function Se(e,n){let r=e.fields.filter(i=>i.type==="enum");if(n){let i=v(e,n);if(i&&i.type==="enum")return i;i&&h(`${e.plural}' ${i.words} is not a choice, so it has no columns`)}let t=$(e,e.roles.status??e.roles.column);if(t?.type==="enum")return t;let o=r.find(i=>/^(status|stage|state|phase)$/.test(i.name));return o||(r[0]?r[0]:h(`${e.plural} have no choice field to put in columns`))}function ee(e,n){let r=e.fields.filter(A),t=l=>{let d=$(e,e.roles[l]);return A(d)?d:void 0},i=r.find(l=>E(n,l.words)||E(n,y(l.name)))??t("start")??r.find(l=>/^(due|date|on|at|start|starts|begins|from|sown|when)/i.test(l.name))??r[0];if(!i)return h(`no date field on ${e.plural}`);let s=t("end")??r.find(l=>l!==i&&/^(end|ends|until|to|finish|finished|harvested|due|closes|through)/i.test(l.name)),a=e.fields.find(l=>l.type==="boolean"&&/^(done|finished|complete|completed|closed)$/.test(l.name));return{start:i,...s&&s!==i?{end:s}:{},...a?{done:a}:{}}}function ie(e){let n=$(e,e.roles.start),r=$(e,e.roles.end),t=$(e,e.roles.column??e.roles.day??e.roles.columns);if(N(n)&&N(r)&&t?.type==="enum")return{start:n,end:r,column:t}}function De(e,n,r,t){let o=[];for(let s of e.kinds)for(let a of s.edges)for(let l of a.to){let d=e.info(l);if(!d||d.kind===s.kind)continue;let c=0;n.includes(s)&&(c+=4),n.includes(d)&&(c+=4),(Z.test(d.kind)||Z.test(d.noun))&&(c+=3),t&&(a.words.includes(t)||d.noun===x(t))&&(c+=5),a.words.split(" ").some(u=>u.length>2&&r.includes(` ${u}`))&&(c+=2),o.push({rows:s,across:d,link:a,score:c})}let i=o.sort((s,a)=>a.score-s.score)[0];return i||h(n[0]?`${n[0].plural} are joined to nothing else, so there is no who-covers-what to draw`:"nothing here is joined to anything else, so there is no who-covers-what to draw")}function ae(e,n,r,t,o){let i=U(t);switch(e){case"columns":{if(i){let s=v(n,i);if(!s||s.type!=="enum"){let a=oe(n,i,r);if(a){let l=r.info(a.to[0]);return{lens:"coverage",kind:n.kind,across:l.kind,link:a.name}}}}return{lens:"columns",kind:n.kind,column:Se(n,i).name}}case"calendar":{let s=ee(n,t),a=M(t);return{lens:"calendar",kind:n.kind,start:s.start.name,...s.end?{end:s.end.name}:{},...s.done?{done:s.done.name}:{},...a?{range:a}:{}}}case"timeline":{let s=ie(n);if(s&&!/\bdates?\b|\bdue\b|\bdeadlines?\b|\bmonths?\b|\byears?\b/.test(t))return{lens:"timeline",kind:n.kind,start:s.start.name,end:s.end.name,column:s.column.name};let a=ee(n,t);return{lens:"calendar",kind:n.kind,start:a.start.name,...a.end?{end:a.end.name}:{},...a.done?{done:a.done.name}:{},range:M(t)??"quarter"}}case"coverage":{let s=De(r,o,t,i);return{lens:"coverage",kind:s.rows.kind,across:s.across.kind,link:s.link.name}}case"board":{let s=$(n,n.roles.x)??n.fields.find(c=>c.name==="x"),a=$(n,n.roles.y)??n.fields.find(c=>c.name==="y");if(!N(s)||!N(a))return h(`${n.plural} have no x and y to be laid out by`);let d=r.kinds.flatMap(c=>c.edges.filter(u=>u.to.includes(n.kind)&&c.kind!==n.kind))[0]??n.edges[0];return d?{lens:"board",kind:n.kind,x:s.name,y:a.name,fill:d.name,...d.from!==n.kind?{fillFrom:"occupant"}:{}}:h(`nothing is joined to ${n.plural} to fill them`)}case"plan":{let s=$(n,n.roles.outline)??n.fields.find(a=>a.name==="outline");return s?{lens:"plan",kind:n.kind,outline:s.name}:h(`${n.plural} have no outline to draw a plan from`)}case"blocks":{let s={lens:"blocks",kind:n.kind,as:/\bcards?\b/.test(t)?"card":"row"},a=/ group(?:ed)? by ([\p{L}\p{N} -]+?)(?= (?:and|only|sorted|with)|\s*$)/u.exec(t)?.[1]??(i&&!/ sort(?:ed)? by /.test(t)?i:void 0);if(a){let c=v(n,a);if(!c||c.type!=="enum")return h(c?`${n.plural}' ${c.words} is not a choice, so they cannot be grouped by it`:`${n.plural} have nothing called ${a} to group by`);s.group=c.name}let l=/ sort(?:ed)? by ([\p{L}\p{N} -]+?)(?= (?:and|only|grouped|with)|\s*$)/u.exec(t)?.[1];if(l){let c=v(n,l);if(!c)return h(`${n.plural} have nothing called ${l} to sort by`);s.sort={by:c.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}let d=V(n,t);return d.length>0&&(s.where=d),s}}}function V(e,n){let r=[],t=se(n);if(t){let o=e.fields.filter(A),i=$(e,e.roles.start),s=o.find(l=>E(n,l.words))??(A(i)?i:void 0)??o[0];(!s||!A(s))&&h(`no date field on ${e.plural}`);let a=e.fields.find(l=>l.type==="boolean"&&/^(done|finished|complete|completed|closed)$/.test(l.name));r.push({expr:t.cond(s.name,/\boverdue\b|\blate\b|\bpast due\b/.test(n)?a?.name:void 0),says:t.says(s)})}if(/\bonly\b|\bjust\b|\bthat are\b|\bwhich are\b/.test(n)){for(let o of e.fields){if(o.type!=="enum")continue;let i=o.options?.find(s=>E(n,s.toLowerCase())||E(n,y(s)));i&&r.push({expr:`${o.name} == '${i.replace(/'/g,"")}'`,says:`that are ${y(i)}`})}if(/\bnot done\b|\bundone\b|\bunfinished\b|\bopen ones\b|\bstill to do\b/.test(n)){let o=e.fields.find(i=>i.type==="boolean"&&/^(done|finished|complete|completed)$/.test(i.name));o&&r.push({expr:`not ${o.name}`,says:`not ${o.words}`})}}return r}var B={columns:"A board",calendar:"A calendar",timeline:"A timeline",coverage:"A grid",board:"A layout",plan:"A plan",blocks:"A list",reach:"A picture"};function Re(e,n){let r=n.info(e.kind),t=o=>o?$(r,o)?.words??y(o):"";switch(e.lens){case"columns":return{title:`${k(r.plural)} by ${t(e.column)}`,detail:`of ${r.plural} by ${t(e.column)}`};case"calendar":{let o=e.range??"month";if(o==="agenda")return{title:`${k(r.plural)} in date order`,detail:`of ${r.plural} in order of ${t(e.start)}`};let i=o==="years"?"year":o;return{title:`${k(r.plural)} by ${i}`,detail:`of ${r.plural} by ${t(e.start)}, a ${i} at a time`}}case"timeline":return{title:`${k(r.plural)} over the ${t(e.column)}`,detail:`of ${r.plural} from ${t(e.start)} to ${t(e.end)}, by ${t(e.column)}`};case"coverage":{let o=n.info(e.across);return{title:`${k(r.plural)} by ${o.noun}`,detail:`of which ${o.noun} covers which ${r.noun}`}}case"board":return{title:`${k(r.plural)} where they stand`,detail:`of ${r.plural} where they stand`};case"plan":return{title:`${k(r.plural)} on a plan`,detail:`of ${r.plural}`};default:{let o=[e.where?.map(i=>i.says).join(" and "),e.group?`by ${t(e.group)}`:void 0,e.sort?`in order of ${t(e.sort.by)}`:void 0].filter(i=>!!i);return{title:[k(r.plural),...o].join(" "),detail:[`of ${r.plural}`,...o].join(" ")}}}}function Ae(e,n){let r={title:n,on:e.kind};switch(e.lens){case"columns":return{name:"columns",...r,bindings:{[e.kind]:{column:e.column}}};case"calendar":return{name:"calendar",...r,bindings:{[e.kind]:{start:e.start,...e.end?{end:e.end}:{},...e.done?{done:e.done}:{}}},...e.range?{options:{range:e.range}}:{}};case"timeline":return{name:"timeline",...r,bindings:{[e.kind]:{start:e.start,end:e.end,column:e.column}}};case"coverage":return{name:"coverage",...r,bindings:{rows:{kind:e.kind},columns:{kind:e.across},link:{edge:e.link}}};case"board":return{name:"board",...r,bindings:{slots:{kind:e.kind},x:{field:e.x,on:"slots"},y:{field:e.y,on:"slots"},fill:{edge:e.fill}},...e.fillFrom?{options:{fillFrom:e.fillFrom}}:{}};case"plan":return{name:"plan",...r,bindings:{regions:{kind:e.kind},outline:{field:e.outline,on:"regions"}}};default:{let t=e.where?.length?` where ${e.where.map(i=>e.where.length>1?`(${i.expr})`:i.expr).join(" and ")}`:"",o={list:`all('${e.kind}')${t}`,as:e.as??"row"};return e.group&&(o.group=e.group),e.sort&&(o.sort=e.sort.direction?{by:e.sort.by,direction:e.sort.direction}:e.sort.by),o.empty="Nothing here yet.",{name:"blocks",...r,options:{blocks:[o]}}}}}function C(e,n){let r=o=>o.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,""),t=new Set(["home","overview",...Q(n).map(o=>o.slug),...(n.lenses??[]).flatMap(o=>o.title?[r(o.title)]:[])]);if(!t.has(r(e)))return e;for(let o=2;;o++)if(!t.has(r(`${e} ${o}`)))return`${e} ${o}`}var ne={title:[],headline:[],text:["tone"],figure:["as","currency","label"],list:["sort","limit","group","empty","as"],progress:["label"],group:["direction"],when:["show"],divider:[]};function Ee(e,n){if(!Array.isArray(n)||n.length===0)return"it has no blocks to draw";if(n.length>40)return"it has more blocks than a place draws";let r=(s,a)=>{if(typeof s!="string"||s.trim()==="")return`its ${a} says nothing`;try{return _(s)}catch(l){return`its ${a} does not read: ${l instanceof Error?l.message.replace(/ \(at character.*$/,""):String(l)}`}},t=s=>{if(s.t==="where")return t(s.set);if(s.t==="call"&&s.fn==="all"){let a=s.args[0];return a?.t==="lit"&&typeof a.value=="string"?e.info(a.value)??null:void 0}},o=(s,a)=>{switch(s.t){case"lit":return;case"ident":return a&&!a.fields.some(l=>l.name===s.name)&&!a.edges.some(l=>l.name===s.name)?`${a.plural} have nothing called ${s.name}`:void 0;case"member":return o(s.object,a);case"list":return s.items.map(l=>o(l,a)).find(Boolean);case"unary":return o(s.operand,a);case"binary":return o(s.left,a)??o(s.right,a);case"where":{let l=t(s.set);return l===null?"Nothing by that name here":o(s.set,a)??o(s.filter,l??void 0)}case"call":return s.fn==="all"?t(s)===null?"Nothing by that name here":void 0:s.args.map(l=>o(l,a)).find(Boolean)}},i=(s,a)=>{if(a>4)return"its blocks nest deeper than a place draws";for(let l of s){if(!w(l))return"a block is not an object";let d=Object.keys(ne).find(p=>p in l);if(!d)return`"${Object.keys(l)[0]??""}" is not a block a place draws`;let c=Object.keys(l).find(p=>p!==d&&p!=="key"&&!ne[d].includes(p));if(c)return`a ${d} block takes no "${c}"`;let u=l[d];if(d==="list"||d==="figure"||d==="when"){if(d==="figure"&&u===!0)continue;let p=r(u,d);if(typeof p=="string")return p;let g=o(p,void 0);if(g)return g;if(d==="list"){let f=t(p);if(f==null)return f===null?"Nothing by that name here":"its list does not say which records it lists, like all('task')";for(let m of["group","sort"]){let b=l[m],S=typeof b=="string"?b:w(b)&&typeof b.by=="string"?b.by:void 0;if(b===void 0)continue;let D=S?f.fields.find(ce=>ce.name===S):void 0;if(!D)return`${f.plural} have nothing called ${String(S??b)} to ${m} by`;if(m==="group"&&D.type!=="enum")return`${f.plural}' ${D.words} is not a choice, so they cannot be grouped by it`}}if(d==="when"){let f=l.show;if(!Array.isArray(f))return"a when block shows a list of blocks";let m=i(f,a+1);if(m)return m}}else if(d==="group"){if(!Array.isArray(u))return"a group block holds a list of blocks";let p=i(u,a+1);if(p)return p}else{if(d!=="divider"&&typeof u!="string")return`a ${d} block says words`;if(typeof u=="string")for(let p of u.matchAll(/\{([^{}]*)\}/g)){let g=p[1].split(/\|(?![|])/)[0],f=r(g,`${d}'s braces`);if(typeof f=="string")return f;let m=o(f,void 0);if(m)return m}}}};return i(n,1)}function T(e,n,r){let t=L(e.schema,r),o=f=>({ok:!1,failed:`Couldn't draw that: ${f.replace(/\.$/,"")}.`});if(!P(n.name)||n.name==="reach")return o(`"${String(n.name)}" is not a picture the seat can draw; it draws ${H.filter(f=>f!=="reach").join(", ")}`);if(typeof n.title!="string"||n.title.trim().length===0||n.title.length>80)return o("it needs a title of a few words");if(typeof n.on!="string"||!t.tryDefinition(n.on))return o("Nothing by that name here");let i=G[n.name],s=n.bindings??{};if(i.binds==="fields")for(let[f,m]of Object.entries(s)){if(!t.tryDefinition(f))return o("Nothing by that name here");let b=Object.keys(t.tryDefinition(f).fields?.shape??{});for(let[S,D]of Object.entries(m??{}))if(typeof D!="string"||!b.includes(D))return o(`${y(f)} has no field "${String(D)}" for its ${S}`);for(let S of i.requiredRoles)if(!(S in(m??{})))return o(`a ${n.name} needs ${y(f)}'s ${S}`)}else if(i.binds==="entities")for(let f of i.requiredRoles){let m=s[f];if(!m)return o(`a ${n.name} needs its ${f}`);if(typeof m.kind=="string"&&!t.tryDefinition(m.kind))return o("Nothing by that name here")}let a={...e,schema:t,lenses:[...e.lenses??[],n]},l=a.lenses.length-1,d=J(a),c=`lenses.${l}`,u=d.findings.find(f=>f.path===c||f.path.startsWith(`${c}.`));if(u)return o(u.message.replace(/^"[^"]*" /,"it "));let p=d.undrawn.find(f=>f.index===l);if(p)return o(p.why);let g=d.drawn.find(f=>f.index===l);if(!g)return o("its bindings name something the app does not have");if(g.as==="overview")return o(`"${n.title}" is the scene's own address; give it another title`);if(n.name==="blocks"){let f=Ee(I(t),n.options?.blocks);if(f)return o(f)}return{ok:!0,drawn:g}}function K(e){return{op:"add-lens",title:e.title,lens:e.name,on:e.on,...e.bindings?{bindings:e.bindings}:{},...e.options?{options:e.options}:{}}}function xe(e){return{op:"remove-lens",title:e.title,on:e.on}}var w=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function de(e){let n=w(e)?e:{},r=String(n.lens??n.name??""),t=n.bindings,o=typeof n.on=="string"?n.on:w(t)&&G[r]?.binds==="fields"?Object.keys(t)[0]??"":"";return{name:r,title:typeof n.title=="string"?n.title.trim():"",on:o,...w(t)?{bindings:t}:{},...w(n.options)?{options:n.options}:{}}}function ve(e){let n=o=>w(e.bindings?.[o])?e.bindings[o]:{},r=o=>typeof o=="string"?o:void 0,t=n(e.on);switch(e.name){case"columns":return r(t.column)?{lens:"columns",kind:e.on,column:t.column}:void 0;case"calendar":{let o=r(e.options?.range);return r(t.start)?{lens:"calendar",kind:e.on,start:t.start,...r(t.end)?{end:t.end}:{},...r(t.done)?{done:t.done}:{},...o?{range:o}:{}}:void 0}case"timeline":return r(t.start)&&r(t.end)&&r(t.column)?{lens:"timeline",kind:e.on,start:t.start,end:t.end,column:t.column}:void 0;case"coverage":{let o=w(e.bindings?.columns)?r(e.bindings.columns.kind):void 0,i=w(e.bindings?.link)?r(e.bindings.link.edge):void 0;return o&&i?{lens:"coverage",kind:e.on,across:o,link:i}:void 0}case"blocks":{let o=e.options?.blocks;if(!Array.isArray(o)||o.length!==1||!w(o[0]))return;let i=o[0],s=new RegExp(`^all\\('${e.on}'\\)(?: where (.+))?$`).exec(String(i.list??""));if(!s)return;let a=i.sort;return{lens:"blocks",kind:e.on,as:i.as==="card"?"card":"row",...typeof i.group=="string"?{group:i.group}:{},...typeof a=="string"?{sort:{by:a}}:w(a)&&typeof a.by=="string"?{sort:{by:a.by,...a.direction==="desc"?{direction:"desc"}:{}}}:{},...s[1]?{where:[{expr:s[1],says:"as asked"}]}:{}}}default:return}}function W(e,n,r,t,o){let i=I(L(e.schema,t)).info(n.on),s=ve(n);return{title:n.title,said:`${B[n.name]??"A picture"} of ${i?.plural??y(n.on)}.`,kind:n.on,lens:n,drawn:r,edit:K(n),by:o,asks:[],...s?{recipe:s}:{}}}function te(e){return{title:e.title,said:e.said,lens:{title:e.lens.title,lens:e.lens.name,on:e.lens.on,...e.lens.bindings?{bindings:e.lens.bindings}:{},...e.lens.options?{options:e.lens.options}:{}},edit:e.edit,by:e.by,check:"It draws, and graview check would take it."}}function F(e,n,r,t,o){let i=Re(e,n),s=e.title??o??C(i.title,r.app),a=Ae(e,s),l=T(r.app,a,r.sight);return l.ok?{title:s,said:`${B[e.lens]} ${i.detail}.`,kind:e.kind,lens:a,drawn:l.drawn,edit:K(a),by:"template",asks:t,recipe:e}:{failed:l.failed,...r.lastGood?{lastGood:r.lastGood}:{}}}function Ye(e,n){let r=I(L(n.app.schema,n.sight)),t=r.info(e.kind);if(!t)return{failed:"Couldn't draw that: Nothing by that name here."};let o=e.lens==="blocks"&&!e.group&&!e.sort&&!e.where?.length&&e.title===void 0;return F(o?{...e,title:C(`Every ${t.noun}`,n.app)}:e,r,n,[])}function Le(e,n,r,t){if(r.length>0)return r;let o=s=>{switch(e){case"columns":return s.fields.some(a=>a.type==="enum");case"calendar":return s.fields.some(A);case"timeline":return ie(s)!==void 0||s.fields.some(A);case"coverage":return s.edges.some(a=>a.to.some(l=>l!==s.kind));case"board":return s.fields.some(a=>a.name==="x")&&s.fields.some(a=>a.name==="y");case"plan":return s.fields.some(a=>a.name==="outline")||s.roles.outline!==void 0;default:return!0}};return[...n.kinds.filter(o)].sort((s,a)=>Number(a.fields.some(l=>E(t,l.words)))-Number(s.fields.some(l=>E(t,l.words))))}function Ie(e,n){let r=I(L(n.app.schema,n.sight)),t=re(e),o=$e(t);if(o.length===0)return;let i=pe(t,r),s;for(let a of o){let l=a==="coverage"?[i[0]??r.kinds[0]].filter(d=>!!d):Le(a,r,i,t);for(let d of l)try{let c=ae(a,d,r,t,i),u=F(c,r,n,[e]);if(!O(u))return u;s??=u.failed}catch(c){if(!(c instanceof j))throw c;s??=`Couldn't draw that: ${c.message}.`}l.length===0&&i.length===0&&(s??=`Couldn't draw that: nothing here has what ${B[a].toLowerCase()} needs.`)}return{failed:s??"Couldn't draw that: Nothing by that name here.",...n.lastGood?{lastGood:n.lastGood}:{}}}async function Oe(e,n){let r=n.lastGood?{lastGood:n.lastGood}:{};if(e.trim().length===0)return{failed:"Say what you would like to see, like \u201Ca board of tasks by status\u201D.",...r};let t=Ie(e,n);if(t&&!O(t))return t;if(!n.complete)return t??{failed:"Couldn't draw that: drawing freely needs AI, which isn't on here. Ask for a board, a calendar, a timeline, a list or who covers what.",...r};let o=await le(e,n,void 0);return O(o)&&t?t:o}async function je(e,n,r){let t={lastGood:e},o={...r,lastGood:e},i=I(L(r.app.schema,r.sight)),s=re(n),a=i.info(e.kind),l=[...e.asks,n];if(!a)return{failed:"Couldn't change that: Nothing by that name here.",...t};let d=e.recipe,c=/^ (?:call|name|title) (?:it|this)? ?(.+?) $/.exec(s)??/ (?:call|name) it (.+?) $/.exec(s);try{if(c){let g=n.replace(/^.*?\b(?:call|name|title)\b\s*(?:it|this)?\s*/i,"").replace(/^["“']|["”']$/g,"").trim();if(g.length===0)return{failed:"Couldn't change that: say what to call it.",...t};let f={...e.lens,title:C(g,r.app)},m=T(r.app,f,r.sight);return m.ok?{...e,title:f.title,lens:f,drawn:m.drawn,edit:K(f),asks:l,...d?{recipe:{...d,title:f.title}}:{}}:{failed:m.failed,...t}}let p=/ as (?:a |an )?(board|kanban|calendar|timeline|list|table|cards|rows|grid|plan|layout)\b/.exec(s);if(p){let g=p[1]==="board"||p[1]==="kanban"?"columns":p[1]==="calendar"?"calendar":p[1]==="timeline"?"timeline":p[1]==="grid"?"coverage":p[1]==="plan"?"plan":p[1]==="layout"?"board":"blocks",f=ae(g,a,i,s,[a]),m=p[1]==="cards"?"card":p[1]==="rows"?"row":void 0,b=g==="blocks"&&d?.lens==="blocks"?{...d,...m?{as:m}:{}}:g==="blocks"&&d?.lens==="columns"?{...f,group:d.column,...m?{as:m}:{}}:f;return F(R(b),i,o,l)}if(d){let g=Te(d,a,i,s);if(g)return F(g,i,o,l)}}catch(p){if(!(p instanceof j))throw p;return{failed:`Couldn't change that: ${p.message}.`,...t}}if(!r.complete)return{failed:"Couldn't change that: changing it freely needs AI, which isn't on here. Try \u201Cgroup by status\u201D, \u201Conly this month\u201D or \u201Cas a calendar\u201D.",...t};let u=await le(n,o,e);return O(u)?u:{...u,asks:l}}var R=e=>{let{title:n,...r}=e;return r};function Te(e,n,r,t){let o=/ (?:group(?:ed)?|split|organi[sz]ed?|put them|columns) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1]??(/^ by /.test(t)?U(t):void 0);if(o){let d=v(n,o);if(d?.type==="enum")return e.lens==="blocks"?{...R(e),group:d.name}:{lens:"columns",kind:e.kind,column:d.name};let c=oe(n,o,r);return c?{lens:"coverage",kind:e.kind,across:c.to[0],link:c.name}:h(d?`${n.plural}' ${d.words} is not a choice, so they cannot be grouped by it`:`${n.plural} have nothing called ${o} to group by`)}let i=/ (?:sort(?:ed)?|order(?:ed)?) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1];if(i){let d=v(n,i);return d?{...e.lens==="blocks"?R(e):{lens:"blocks",kind:e.kind,as:"row",...e.lens==="columns"?{group:e.column}:{}},sort:{by:d.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}:h(`${n.plural} have nothing called ${i} to sort by`)}if(/\b(?:all of them|everything|show all|clear the filter|no filter|without the filter)\b/.test(t)){if(e.lens!=="blocks"||!e.where)return h("it already shows all of them");let{where:d,...c}=R(e);return c}let s=se(t);if(s&&e.lens==="calendar"&&s.range)return{...R(e),range:s.range};if(s&&e.lens==="calendar"&&!s.range)return{lens:"blocks",kind:e.kind,as:"row",sort:{by:e.start},where:V(n,t)};let a=V(n,t);if(a.length>0){let d=e.lens==="blocks"?R(e):{lens:"blocks",kind:e.kind,as:"row",...e.lens==="columns"?{group:e.column}:{}};return{...d,where:[...d.where??[],...a]}}let l=e.lens==="calendar"?M(t):void 0;if(l)return{...R(e),range:l}}function Ne(e){return e.kinds.map(n=>{let r=n.fields.map(i=>`${i.name} (${i.type??"value"}${i.options?`: ${i.options.join(" | ")}`:""})`).join(", "),t=n.edges.map(i=>`${i.name} \u2192 ${i.to.join(" | ")}`).join(", "),o=Object.entries(n.roles).map(([i,s])=>`${i}=${s}`).join(", ");return`- ${n.kind} ("${n.plural}"): ${r}${t?`; relations: ${t}`:""}${o?`; roles: ${o}`:""}`}).join(`
2
2
  `)}var Fe=['columns \u2014 a board, records in columns by one choice field: {"lens": "columns", "on": K, "bindings": {K: {"column": "<enum field>"}}}','calendar \u2014 records on a calendar by a date: {"lens": "calendar", "on": K, "bindings": {K: {"start": "<date field>", "end"?: "<date field>", "done"?: "<boolean field>"}}, "options": {"range"?: "day" | "week" | "month" | "quarter" | "year" | "agenda"}}','timeline \u2014 minutes of a day in columns: {"lens": "timeline", "on": K, "bindings": {K: {"start": "<number field>", "end": "<number field>", "column": "<enum field>"}}}','coverage \u2014 who covers what, a grid of two kinds joined by a relation: {"lens": "coverage", "on": K, "bindings": {"rows": {"kind": K}, "columns": {"kind": J}, "link": {"edge": "<relation of K to J>"}}}',`blocks \u2014 anything else, as blocks: {"lens": "blocks", "on": K, "options": {"blocks": [{"headline": "words"}, {"list": "all('K') where <condition>", "group"?: "<enum field>", "sort"?: "<field>" | {"by": "<field>", "direction": "desc"}, "as"?: "row" | "card", "empty"?: "words"}, {"figure": "count(all('K'))", "label": "words"}]}}. Conditions read a record's own fields: status == 'open', not done, days(today(), due) <= 7.`].join(`
3
3
  `);function Ce(e,n,r){return["You draw a view of an app's data as JSON \u2014 never code. The app's kinds, their fields (with types) and relations:",Ne(n),"","The lenses you may use (prefer the first four; use blocks only when none of them fits):",Fe,"",r?`The view on screen now:
4
4
  ${JSON.stringify(r.lens)}
@@ -0,0 +1 @@
1
+ import"./chunk.AJZBJBMO.js";var e='"use strict";\n/*! @remote-dom/core and @remote-dom/polyfill \u2014 Copyright 2020-present, Shopify Inc. \u2014 MIT License.\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n * @graview/guest\'s worker runtime \u2014 Elastic License 2.0. */\n"use strict";(()=>{var Oe=globalThis,Kr=Oe.addEventListener,Zr=Oe.removeEventListener,Qr=Oe.postMessage,Jr=globalThis.queueMicrotask,un=globalThis.performance,eo=un?un.now.bind(un):Date.now,Re={listen:t=>Kr.call(Oe,"message",t),unlisten:t=>Zr.call(Oe,"message",t),post:t=>Qr.call(Oe,t),microtask:t=>Jr.call(globalThis,t),now:()=>eo()};var v=Symbol("name"),ue=Symbol("prefix"),de=Symbol("value"),S=Symbol("ns"),q=Symbol("owner"),I=Symbol("owner_document"),ne=Symbol("attributes"),M=Symbol("prev"),f=Symbol("next"),R=Symbol("child"),Y=Symbol("parent"),me=Symbol("host"),$=Symbol("data"),Ee=Symbol("listeners"),dn=Symbol("isTrusted"),Ae=Symbol("path"),_e=Symbol("stop_immediate_propagation"),Pe=Symbol("dispatching"),se=Symbol("content"),D=Symbol("hooks"),mt=Symbol("extensions"),Ne=Symbol("hooks_dispatch"),U=Symbol("is_connected"),Ce=Symbol("create_element"),qn=0,X=1,ke=2,Ie=3,Me=8,Te=9,Yn=10,fe=11,A="http://www.w3.org/1999/xhtml",K="http://www.w3.org/2000/svg",Wn="http://www.w3.org/XML/1998/namespace",Xe="http://www.w3.org/2000/xmlns/";function ft(t){return t.split(/[\\t\\n\\f\\r ]+/).filter(Boolean)}function G(t){return t.replace(/[A-Z]/g,e=>String.fromCharCode(e.charCodeAt(0)+32))}function Xn(t){return t.replace(/[a-z]/g,e=>String.fromCharCode(e.charCodeAt(0)-32))}function C(t,e){let n=globalThis.DOMException;if(typeof n=="function")return new n(t,e);let r=new Error(t);return r.name=e,r}var $n=/^(?:[A-Za-z][^\\0\\t\\n\\f\\r\\u0020/>]*|[:_\\u0080-\\u{10FFFF}][A-Za-z0-9-.:_\\u0080-\\u{10FFFF}]*)$/u,Kn=/[\\0\\t\\n\\f\\r />=]/u,to=/[\\0\\t\\n\\f\\r />]/u;function ie(t){if(t==null)return null;let e=String(t);return e===""?null:e}function Zn(t){$n.test(t)||fn(t)}function mn(t){(t===""||Kn.test(t))&&fn(t)}function pt(t,e,n){let r=ie(t),o=String(e),s=o.indexOf(":"),i=s<0?null:o.slice(0,s),a=s<0?o:o.slice(s+1);if((i!=null&&(i===""||to.test(i))||(n==="element"?!$n.test(a):a===""||Kn.test(a)))&&fn(o),i!=null&&r==null)throw C(`A namespace is required for the prefix in "${o}"`,"NamespaceError");if(i==="xml"&&r!==Wn)throw C("The xml prefix requires the XML namespace","NamespaceError");if((o==="xmlns"||i==="xmlns")&&r!==Xe)throw C("The xmlns name requires the XMLNS namespace","NamespaceError");if(r===Xe&&o!=="xmlns"&&i!=="xmlns")throw C("The XMLNS namespace requires the xmlns name or prefix","NamespaceError");return{namespace:r,qualifiedName:o,prefix:i,localName:a}}function fn(t){throw C(`Invalid name: "${t}"`,"InvalidCharacterError")}var ht=0,gt=1,Qn=2,pn=3,no=typeof performance>"u"?Date.now:performance.now.bind(performance),V=class{static NONE=ht;static CAPTURING_PHASE=gt;static AT_TARGET=Qn;static BUBBLING_PHASE=pn;timeStamp=no();target=null;currentTarget=null;srcElement=null;bubbles=!1;cancelable=!1;composed=!1;defaultPrevented=!1;cancelBubble=!1;eventPhase=ht;[Ae]=[];[_e]=!1;[Pe]=!1;constructor(e,n){this.type=e,Object.defineProperty(this,dn,{writable:!0,value:!1}),n&&(n.bubbles&&(this.bubbles=n.bubbles),n.cancelable&&(this.cancelable=n.cancelable),n.composed&&(this.composed=n.composed))}get isTrusted(){return this[dn]}composedPath(){return[...this[Ae]]}stopPropagation(){this.cancelBubble=!0}stopImmediatePropagation(){this[_e]=!0,this.cancelBubble=!0}preventDefault(){this.cancelable&&(this.defaultPrevented=!0)}set returnValue(e){e||this.preventDefault()}get returnValue(){return!this.defaultPrevented}initEvent(e,n,r){this.type=e,this.bubbles=!!n,this.cancelable=!!r}};function hn(t,e,n){if(t.cancelBubble)return;let o=e[Ee]?.get(t.type)?.[n===gt?"capture":"bubble"];if(o)for(let s of[...o]){if(!o.has(s)||s.signal?.aborted)continue;t.eventPhase=t.target===e?Qn:n,t.currentTarget=e;let i=s.normalizedListener;try{typeof i=="object"?i.handleEvent(t):i.call(e,t)}catch(a){setTimeout(ro,0,a)}if(t[_e])break}}function ro(t){throw t}var $e=[],yt=new WeakMap;function bt(t,e){let n=yt.get(t);n?n.push(e):yt.set(t,[e]),$e[$e.length-1].push(t)}function B(t){let e=[];$e.push(e);let n;try{n=t()}catch(r){$e.pop();try{Jn(e)}catch{}throw r}return $e.pop(),Jn(e),n}function Jn(t){let e,n=!1;for(let r of t){let o=yt.get(r);if(o){for(;o.length>0;){let s=o.shift();try{s()}catch(i){n||(e=i,n=!0)}}yt.delete(r)}}if(n)throw e}var Et=[],Ke=[],gn=!1;function we(t){for(let e of t)Et.push(e),e[1]&&Ke.push(e[1]);if(!gn){gn=!0;try{let e,n=!1;for(let r=0;r<Et.length;r++){let[o,s]=Et[r];s&&Ke.splice(Ke.indexOf(s),1);try{o()}catch(i){n||(e=i,n=!0)}}if(n)throw e}finally{Et.length=0,Ke.length=0,gn=!1}}}function Ze(t){let e=t;for(;e;){if(Ke.includes(e))return!0;e=e[Y]??e[me]}return!1}var Qe=Symbol("listenerRegistrations"),pe=class{[Ee]=void 0;[Qe]=void 0;[I]=void 0;addEventListener(e,n,r){if(n==null)return;let o=r===!0||typeof r=="object"&&r.capture===!0,s=typeof r=="object"&&r.once===!0,i=typeof r=="object"?r.signal:void 0;if(i?.aborted)return;let a=yn(o),l=this[Qe];l||(l=new Map,this[Qe]=l);let c=l.get(e);c||(c={},l.set(e,c));let m=c[a];if(m||(m=new Map,c[a]=m),m.has(n))return;let p=this,h={type:e,listener:n,capture:o,once:s,normalizedListener:n,signal:i};(s||i)&&(h.normalizedListener=function(...k){if(h.signal?.aborted){Nt(p,h);return}return h.once&&Nt(p,h),typeof h.listener=="object"?h.listener.handleEvent(...k):h.listener.call(this,...k)});let g=this[Ee];g||(g=new Map,this[Ee]=g);let O=g.get(e);O||(O={},g.set(e,O));let b=O[a];if(b||(b=new Set,O[a]=b),m.set(n,h),b.add(h),i){let E=()=>{Nt(p,h)};h.abortListener=E,i.addEventListener("abort",E,{once:!0})}this[I]?.defaultView[Ne].addEventListener?.(this,e,n,r)}removeEventListener(e,n,r){return oo.call(this,e,n,r)}dispatchEvent(e){if(e[Pe])throw C("Failed to execute \'dispatchEvent\' on \'EventTarget\': The event is already being dispatched.","InvalidStateError");e[Pe]=!0;try{let n=[],r=this;for(;r!=null;)n.push(r),r=r.parentNode;e.target=this,e.srcElement=this,e[Ae]=n;for(let s=n.length;s--;)if(hn(e,n[s],gt),e.cancelBubble)return!e.defaultPrevented;let o=e.bubbles?n:n.slice(0,1);for(let s=0;s<o.length;s++)if(hn(e,o[s],pn),e.cancelBubble)return!e.defaultPrevented;return!e.defaultPrevented}finally{e[Pe]=!1,e.cancelBubble=!1,e[_e]=!1,e.eventPhase=ht,e.currentTarget=null,e[Ae]=[]}}};function oo(t,e,n){if(e==null)return;let r=n===!0||n&&n.capture===!0,o=yn(!!r),s=this[Qe]?.get(t)?.[o]?.get(e);s&&Nt(this,s)}function yn(t){return t?"capture":"bubble"}function Nt(t,e){let n=yn(e.capture),r=t[Qe],o=r?.get(e.type);if(!o)return;let s=o[n];if(!s||s.get(e.listener)!==e)return;s.delete(e.listener),s.size===0&&delete o[n],!o.bubble&&!o.capture&&r?.delete(e.type),e.signal&&e.abortListener&&e.signal.removeEventListener("abort",e.abortListener);let i=t[Ee],a=i?.get(e.type);if(!a)return;let l=a[n];l?.delete(e)&&(l.size===0&&delete a[n],!a.bubble&&!a.capture&&i?.delete(e.type),t[I]?.defaultView[Ne].removeEventListener?.(t,e.type,e.listener,e.capture))}var Z=class extends Array{item(e){return this[e]??null}};var et=0,er=1,Nn=2,Tn=3,tt=4,tr=0,nr=1,xt=2,vt=3,rr=4,En=5,or=6,sr=7,Tt=/^(?:--|-?[A-Za-z_\\u0080-\\u{10FFFF}])[A-Za-z0-9_\\u0080-\\u{10FFFF}-]*$/u;function so(t,e){let n=1,r=null;for(let o=e;o<t.length;o++){let s=t[o];if(r){s==="\\\\"?o++:s===r&&(r=null);continue}if(s===\'"\'||s==="\'")r=s;else if(s==="(")n++;else if(s===")"&&--n===0)return[t.slice(e,o),o+1]}return[t.slice(e),t.length]}function W(t){throw C(`Invalid or unsupported selector: "${t}"`,"SyntaxError")}function St(t,e){let n=typeof e=="string"?nt(e):[{combinator:tt,matchers:e}],r=null,o=t[R];return o&&n[0].matchers.length&&wn(o,n,s=>(r=s,!1)),r}function Ot(t,e){let n=typeof e=="string"?nt(e):[{combinator:tt,matchers:e}],r=new Z,o=t[R];return o&&n[0].matchers.length&&wn(o,n,s=>{r.push(s)}),r}function nt(t,e=!1,n=!1){let r={combinator:tt,matchers:[]},o=[r],s=/[\\t\\n\\f\\r ]*?([>\\t\\n\\f\\r +~]?)[\\t\\n\\f\\r ]*?(?:(?:\\[[\\t\\n\\f\\r ]*([^\\]=\\t\\n\\f\\r ]+)[\\t\\n\\f\\r ]*(?:=[\\t\\n\\f\\r ]*(?:([\'"])(.*?)\\3|([^\\]\\t\\n\\f\\r ]+)))?[\\t\\n\\f\\r ]*(?:\\]|$))|([#.]?)([^\\t\\n\\f\\r #.[>:+~()]+)|:(\\w+)(\\()?)/gi,i=t.replace(/^[\\t\\n\\f\\r ]+|[\\t\\n\\f\\r ]+$/g,"");i===""&&W(t);let a=0,l;for(;l=s.exec(i);){l.index!==a&&W(t),l[1]&&(r.matchers.length===0&&!(n&&o.length===1)&&W(t),l[1]===">"?r.combinator=er:l[1]==="+"?r.combinator=Tn:l[1]==="~"?r.combinator=Nn:r.combinator=et,r={combinator:tt,matchers:[]},o.push(r));let c=l[8]?G(l[8]):l[2]||l[7];l[7]!=null&&!l[6]&&r.matchers.length>0&&W(t);let p,h=l[4]??l[5]??l[7];if(l[2]){Tt.test(c)||W(t);let g=l[5],O=g?.[0];if(l[3]==null&&(O===\'"\'||O==="\'")){let b=l[0].lastIndexOf(g);h=i.slice(l.index+b+1),s.lastIndex=i.length}else g!=null&&!Tt.test(g)&&W(t);p=rr}else l[6]?(Tt.test(c)||W(t),p=l[6]==="#"?xt:vt):l[8]?p=l[9]==null?En:or:l[7]==="*"?p=tr:l[7]&&Tt.test(l[7])?p=nr:W(t);l[9]?([h,s.lastIndex]=so(i,s.lastIndex),c!=="has"&&c!=="not"&&W(t),c==="has"&&e&&W(t),nt(h,e||c==="has",c==="has")):p===En&&W(t),r.matchers.push({type:p,name:c,value:h}),a=s.lastIndex}return(a!==i.length||r.matchers.length===0)&&W(t),o}function io(t,e){let n=nt(e);return n[0]?.matchers.length?Je(t,n):!1}function ao(t,e){let n=nt(e,!0,!0),r=n[0];if(n.length===1&&r.matchers.length===0)return!1;let o=et,s={type:sr,name:":scope"};if(r.matchers.length===0?(o=r.combinator,r.matchers.push(s)):n.unshift({combinator:et,matchers:[s]}),n.some(({matchers:l})=>l.length===0))return!1;let i=o===Tn||o===Nn?t[f]:t[R];if(!i)return!1;let a=!1;return wn(i,n,()=>(a=!0,!1),t),a}function wn(t,e,n,r){let o=[],s=t;for(;s;){if(j(s)){if(Je(s,e,r)&&n(s)===!1)return!1;let i=s[R];if(i){let a=s[f];a&&o.push(a),s=i;continue}}s=s[f]??o.pop()??null}return!0}function Je(t,e,n){let{combinator:r,matchers:o}=e[e.length-1];if(r===tt){if(!wt(t,o,n))return!1;let a=e.slice(0,-1);return a.length===0||Je(t,a,n)}let s=r===er||r===et?Y:M,i=t[s];if(!i)return!1;if(r===et||r===Nn){for(;i;){if(j(i)&&wt(i,o,n)){let a=e.slice(0,-1);if(a.length===0||Je(i,a,n))return!0}i=i[s]}return!1}else{if(r===Tn&&!j(i)){for(;i&&!j(i);)i=i[s];if(!i)return!1}if(!j(i)||!wt(i,o,n))return!1;let a=e.slice(0,-1);return a.length===0||Je(i,a,n)}}function bn(t,e){return t.getAttributeNS(null,t.namespaceURI===A?G(e):e)}function wt(t,e,n){if(!t)return!1;if(Array.isArray(e)){for(let i of e)if(wt(t,i,n)===!1)return!1;return!0}let{type:r,name:o,value:s}=e;switch(r){case tr:return o==="*";case nr:return t.namespaceURI===A?t.localName===G(o):t.localName===o;case xt:return bn(t,"id")===o;case vt:let i=bn(t,"class");return i?ft(i).includes(o):!1;case rr:let a=bn(t,o);return s==null?a!=null:a===s;case sr:return t===n;case En:W(`:${o}`);case or:switch(o){case"has":return ao(t,s||"");case"not":return!io(t,s||"");default:W(`:${o}(${s})`)}}return!1}function lo(t){return t.nodeType===ke}function rt(t){return $ in t}function vn(t){return t.nodeType===Ie}function co(t){return t.nodeType===Me}function j(t){return t.nodeType===X}function xn(t){return t.nodeType===fe}function cr(t){return"appendChild"in t}function Rt(t){let e=[],n=[t],r=new Set(n),o=new Set,s;for(;n.length>0;){let i=n.pop();if(r.delete(i),o.has(i))continue;let a=[];for(let l of st(i)){if(o.has(l)||(o.add(l),e.push(l),a.push(l),!j(l)))continue;let c=l[ne];if(c)for(let p of c)o.has(p)||(o.add(p),e.push(p));let m=l[se];m&&!o.has(m)&&!r.has(m)&&(r.add(m),n.push(m))}s??=a}return{nodes:e,treeNodes:s}}function ot(t,e){for(let n of t)n[I]=e}function ir(t,e){let n=t.constructor,r=new n(t.name,t.value,t.namespaceURI);return r[I]=e,r}function ar(t,e){if(vn(t))return e.createTextNode(t.data);if(co(t))return e.createComment(t.data);if(lo(t))return ir(t,e);if(j(t)){let n=e[Ce](t[v],t.namespaceURI,t[ue],t.localName);if(t[ne])for(let r=0;r<t[ne].length;r++){let o=t[ne].item(r);n.attributes.setNamedItem(ir(o,e))}return n}else{if(xn(t))return e.createDocumentFragment();{let n=new t.constructor;return n[I]=e,n}}}function At(t,e,n=t.ownerDocument){if(t.nodeType===Te)throw C("Cannot clone a document node","NotSupportedError");let r=ar(t,n);if(!e||!j(t)&&!xn(t))return r;let o=new Set([t]),s=[{source:t,destination:r,childIndex:0,cloningContent:!1}];for(;s.length>0;){let i=s[s.length-1],a,l;if(i.cloningContent)if(i.contentSource&&i.contentDestination)a=i.contentSource.childNodes[i.childIndex++],l=i.contentDestination;else{s.pop(),i.appendTo&&i.appendTo.appendChild(i.destination);continue}else if(a=i.source.childNodes[i.childIndex++],l=i.destination,!a){if(i.cloningContent=!0,i.childIndex=0,j(i.source)&&i.source.namespaceURI===A&&i.source.localName==="template"){let m=i.source[se];m&&(o.has(m)&&lr(),o.add(m),i.contentSource=m,i.contentDestination=i.destination.content)}continue}if(!a){s.pop(),i.appendTo&&i.appendTo.appendChild(i.destination);continue}o.has(a)&&lr(),o.add(a);let c=ar(a,n);j(a)||xn(a)?s.push({source:a,destination:c,appendTo:l,childIndex:0,cloningContent:!1}):l.appendChild(c)}return r}function lr(){throw new Error("Cannot clone a cyclic or repeated node graph")}function _t(t,e){let n=String(e);return n===""?null:St(t,[{type:xt,name:n}])}function Pt(t,e){let n=[...new Set(ft(String(e)))];return Ot(t,n.map(r=>({type:vt,name:r})))}function Ct(t,e){let n=String(e),r=G(n),o=[];for(let s of kt(t))j(s)&&(n==="*"||(s.namespaceURI===A?s[v]===r:s[v]===n))&&o.push(s);return o}function kt(t){let e=[],n=[],r=t[R];for(;r;){e.push(r);let o=r[R],s=r[f];o?(s&&n.push(s),r=o):r=s??n.pop()??null}return e}function st(t){let e=kt(t);return e.unshift(t),e}var Q=class extends pe{nodeType=qn;[v]="";[Y]=null;[me]=null;[R]=null;[M]=null;[f]=null;[U]=!1;get[D](){return this[I].defaultView[Ne]}get localName(){return this[v]}get nodeName(){return this[v]}get ownerDocument(){return this[I]}get isConnected(){return this[U]}isDefaultNamespace(e){let n=ie(e);return uo(this)===n}get parentNode(){return this[Y]}set parentNode(e){}get parentElement(){let e=this[Y];return!e||e.nodeType!==1?null:e}set parentElement(e){}get previousSibling(){return this[M]}set previousSibling(e){}get nextSibling(){return this[f]}set nextSibling(e){}get previousElementSibling(){let e=this[M];for(;e&&e.nodeType!==1;)e=e[M];return e}set previousElementSibling(e){}get nextElementSibling(){let e=this[f];for(;e&&e.nodeType!==1;)e=e[f];return e}set nextElementSibling(e){}get firstChild(){return this[R]}set firstChild(e){}get lastChild(){let e=this[R];for(;e;){let n=e[f];if(n==null)break;e=n}return e}set lastChild(e){}get nodeValue(){return rt(this)?this.data:null}set nodeValue(e){rt(this)&&(this.data=e)}get textContent(){if(rt(this))return this.data;let e="";for(let n of kt(this))vn(n)&&(e+=n.data);return e}set textContent(e){if(rt(this))this.data=e;else if(cr(this)){let n=e==null?"":String(e);n===""?this.replaceChildren():this.replaceChildren(n)}}cloneNode(e){return At(this,e)}contains(e){let n=e;for(;n!=null;){if(n===this)return!0;n=n.parentNode}return!1}};function uo(t){let e=t;for(;e;)switch(e.nodeType){case X:{let n=e;if(n.prefix==null&&n.namespaceURI!=null)return n.namespaceURI;let r=n.attributes.getNamedItemNS(Xe,"xmlns");if(r!=null&&r.prefix==null)return ie(r.value);e=n.parentElement;break}case Te:e=e.documentElement;break;case Yn:case fe:return null;case ke:e=e.ownerElement;break;default:e=e.parentElement}return null}var J=Symbol("insertNode"),Rn=Symbol("preflightInsertions"),It=Symbol("replaceNode"),he=class extends Q{remove(){let e=this.parentNode;e&&e.removeChild(this)}replaceWith(...e){let n=xe(e),r=this.parentNode;if(r)return Sn(o=>{ae(r,n);let s=this[f];for(;s&&n.includes(s);)s=s[f];let i=On(r,n,o);this.parentNode===r?r[It](i,this,o):r[J](i,s,o)})}before(...e){let n=xe(e),r=this.parentNode;if(r)return Sn(o=>{ae(r,n);let s=this[M];for(;s&&n.includes(s);)s=s[M];let i=On(r,n,o);r[J](i,s?s[f]:r.firstChild,o)})}after(...e){let n=xe(e),r=this.parentNode;if(r)return Sn(o=>{ae(r,n);let s=this[f];for(;s&&n.includes(s);)s=s[f];let i=On(r,n,o);r[J](i,s,o)})}};function Sn(t){return B(()=>{let e=[];try{t(e)}catch(n){try{we(e)}catch{}throw n}we(e)})}function xe(t){return t.map(e=>e instanceof Q?e:String(e))}function it(t,e){return e instanceof Q?e:t.ownerDocument.createTextNode(String(e))}function ae(t,e){for(let n of e){if(!(n instanceof Q))continue;let r=t;for(;r;){if(r===n)throw C("Cannot insert a node into itself or one of its descendants","HierarchyRequestError");r=r[Y]??r[me]}}}function On(t,e,n){let r=[];for(let s of e)r.push(it(t,s));if(r.length===1)return r[0];let o=t.ownerDocument.createDocumentFragment();o[Rn](r);for(let s of r)o[J](s,null,n);return o}var Mt,An=0,ur=0,dr=0,mr=0,De=!1,Pn=!1,at=!1,Dt=class{#t;#n=[];#e=new Set;#r=!1;constructor(e){if(typeof e!="function")throw new TypeError("MutationObserver callback must be a function");this.#t=e}observe(e,n={}){let r=mo(n),o=Mt??=new WeakMap,s=o.get(e);s==null&&(s=new Map,o.set(e,s));let i=s.get(this);i==null?An++:_n(i,-1),s.set(this,r),_n(r,1),this.#e.add(e)}disconnect(){let e=Mt;if(e!=null){for(let n of this.#e){let r=e.get(n),o=r?.get(this);o!=null&&(r.delete(this),An--,_n(o,-1)),r?.size===0&&e.delete(n)}this.#e.clear(),this.#n.length=0,An===0&&(Mt=void 0)}}takeRecords(){return this.#n.splice(0)}enqueue(e){this.#n.push(e),!this.#r&&(this.#r=!0,queueMicrotask(()=>{this.#r=!1;let n=this.takeRecords();n.length>0&&this.#t.call(this,n,this)}))}};function ee(t){let e=Mt;if(e==null)return;let n=new Map,r=t.target;for(;r;){let o=e.get(r);if(o)for(let[s,i]of o){if(r!==t.target&&!i.subtree)continue;let a=!1;if(t.type==="attributes"){if(!i.attributes||i.attributeFilter&&!i.attributeFilter.has(t.attributeName??""))continue;a=i.attributeOldValue}else if(t.type==="characterData"){if(!i.characterData)continue;a=i.characterDataOldValue}else if(!i.childList)continue;n.set(s,n.get(s)===!0||a)}r=r.parentNode}for(let[o,s]of n)o.enqueue({addedNodes:t.addedNodes??new Z,attributeName:t.attributeName??null,attributeNamespace:t.attributeNamespace??null,nextSibling:t.nextSibling??null,oldValue:s?t.oldValue??null:null,previousSibling:t.previousSibling??null,removedNodes:t.removedNodes??new Z,target:t.target,type:t.type})}function Lt(...t){let e=new Z;return e.push(...t),e}function mo(t){if(t.attributes===!1&&(t.attributeOldValue||t.attributeFilter!=null))throw new TypeError("attributeOldValue and attributeFilter require attributes to be enabled");if(t.characterData===!1&&t.characterDataOldValue)throw new TypeError("characterDataOldValue requires characterData to be enabled");let e=t.attributes??(t.attributeOldValue===!0||t.attributeFilter!=null),n=t.characterData??t.characterDataOldValue===!0,r=t.childList===!0;if(!e&&!n&&!r)throw new TypeError("MutationObserver options must enable childList, attributes, or characterData");return{attributes:e,attributeFilter:t.attributeFilter==null?void 0:new Set(t.attributeFilter.map(String)),attributeOldValue:t.attributeOldValue===!0,characterData:n,characterDataOldValue:t.characterDataOldValue===!0,childList:r,subtree:t.subtree===!0}}function _n(t,e){t.attributes&&(ur+=e),t.characterData&&(dr+=e),t.childList&&(mr+=e),De=ur>0,Pn=dr>0,at=mr>0}var re=class extends he{childNodes=new Z;children=new Z;appendChild(e){return B(()=>this[J](e,null))}insertBefore(e,n){return B(()=>this[J](e,n||null))}append(...e){return B(()=>{let n=xe(e.filter(r=>r!=null));n.length>1&&ae(this,n);for(let r of n)this[J](it(this,r),null)})}prepend(...e){return B(()=>{let n=xe(e.filter(o=>o!=null));n.length>1&&ae(this,n);let r=this.firstChild;for(let o of n)this[J](it(this,o),r)})}replaceChildren(...e){return B(()=>{let n=xe(e.filter(o=>o!=null));ae(this,n);let r;for(;r=this.firstChild;)this.removeChildImmediately(r);for(let o of n)this[J](it(this,o),null)})}removeChild(e){return B(()=>(this.removeChildImmediately(e),e))}removeChildImmediately(e){if(e.parentNode!==this)throw C("The node is not a child of this node","NotFoundError");let n=this[U]?st(e):void 0,r=e[M],o=e[f],s=Gt(this,e);if(n)for(let i of n)i[U]=!1;this.queueRemovalMutationRecord(this,e,r,o),n&&this.enqueueTreeReactions(n,"disconnectedCallback"),we(this.collectRemovalHookEffects(e,s))}replaceChild(e,n){return B(()=>this[It](e,n))}[It](e,n,r){if(ae(this,[e]),n.parentNode!==this)throw C("The reference node is not a child of this parent","NotFoundError");let o=n[M],s=n[f],i=this.prepareInsertion(e),a=this[U]?st(n):void 0,l=new Set(i.map(({node:h})=>h)),c=s;for(;c&&l.has(c);)c=c[f];let m=Gt(this,n);if(a){for(let g of a)g[U]=!1;let h=new Set(a);for(let g of i)h.has(g.node)&&(g.shouldDisconnect=!1)}this.commitInsertion(i,c);let p=this[U];return this.queueRemovalMutationRecord(this,n,o,s),this.queueInsertionMutationRecords(i),a&&this.enqueueTreeReactions(a,"disconnectedCallback"),this.enqueueInsertionReactions(i,p),this.performOrCollectHookEffects([...this.collectRemovalHookEffects(n,m),...this.collectInsertionHookEffects(i)],r),n}querySelectorAll(e){return Ot(this,e)}querySelector(e){return St(this,e)}[J](e,n,r){return this.validateInsertion(e,n),this.insertIntoValidated(e,n,r),e}[Rn](e){for(let n of e)this.validateInsertion(n,null),this.prepareInsertion(n)}validateInsertion(e,n){if(ae(this,[e]),n&&n.parentNode!==this)throw C("The reference node is not a child of this parent","NotFoundError")}insertIntoValidated(e,n,r){e===n&&(n=e[f]);let o=this.prepareInsertion(e);this.commitInsertion(o,n);let s=this[U];this.queueInsertionMutationRecords(o),this.enqueueInsertionReactions(o,s),this.performOrCollectHookEffects(this.collectInsertionHookEffects(o),r)}performOrCollectHookEffects(e,n){n?n.push(...e):we(e)}prepareInsertion(e){let n=[];if(e.nodeType===fe){let i=e[R];for(;i;)n.push(i),i=i[f]}else n.push(e);let r=this[U],o=this[I],s=[];for(let i of n){let a=i[U],l=a||r,c,m;if(i[I]===o)l&&(c=st(i));else{let p=Rt(i);m=p.nodes,l&&(c=p.treeNodes)}s.push({node:i,nodes:c,adoption:m,shouldDisconnect:a})}return s}commitInsertion(e,n){for(let s of e){let i=s.node[Y];if(i){let a=s.node[M],l=s.node[f];s.source={parent:i,index:Gt(i,s.node),previousSibling:a,nextSibling:l}}}for(let s of e){let i=this.attachChild(s.node,n);s.insertIndex=i.index,s.previousSibling=i.previousSibling,s.nextSibling=i.nextSibling}let r=this[I];for(let{adoption:s}of e)s&&ot(s,r);let o=this[U];for(let{nodes:s}of e)if(s)for(let i of s)i[U]=o}attachChild(e,n){if(n){let s=n[M];e[f]=n,e[M]=s,s?s[f]=e:this[R]=e,n[M]=e}else{e[f]=null;let s=this[R];if(s){let i;for(;i=s[f];)s=i;s[f]=e,e[M]=s}else this[R]=e,e[M]=null}let r=j(e);e[Y]=this;let o;if(n){if(o=this.childNodes.indexOf(n),this.childNodes.splice(o,0,e),r){let s=n;for(;s&&!j(s);)s=s[f];s?this.children.splice(this.children.indexOf(s),0,e):this.children.push(e)}}else o=this.childNodes.length,this.childNodes.push(e),r&&this.children.push(e);return{index:o,previousSibling:e[M],nextSibling:e[f]}}queueRemovalMutationRecord(e,n,r,o){at&&ee({type:"childList",target:e,removedNodes:Lt(n),previousSibling:r,nextSibling:o})}queueInsertionMutationRecords(e){if(at)for(let n of e){let{node:r,source:o}=n;o&&this.queueRemovalMutationRecord(o.parent,r,o.previousSibling,o.nextSibling),ee({type:"childList",target:this,addedNodes:Lt(r),previousSibling:n.previousSibling,nextSibling:n.nextSibling})}}collectRemovalHookEffects(e,n){return this.nodeType!==X||Ze(this)?[]:[[()=>this[D].removeChild?.(this,e,n)]]}collectInsertionHookEffects(e){let n=[];for(let r of e){let{node:o,source:s}=r;s?.parent.nodeType===X&&!Ze(s.parent)&&n.push([()=>s.parent[D].removeChild?.(s.parent,o,s.index)]),this.nodeType===X&&!Ze(this)&&n.push([()=>this[D].insertChild?.(this,o,r.insertIndex),o])}return n}enqueueInsertionReactions(e,n){for(let r of e){let{nodes:o}=r;o&&(r.shouldDisconnect&&this.enqueueTreeReactions(o,"disconnectedCallback"),n&&this.enqueueTreeReactions(o,"connectedCallback"))}}enqueueTreeReactions(e,n){pr(e,n)}};function fr(t,e,n,r){if(e.parentNode!==t)throw Error("not a child of this node");let o=t[U]?n.treeNodes:void 0,s=e[M],i=e[f],a=Gt(t,e);if(o)for(let c of o)c[U]=!1;ot(n.nodes,r),at&&ee({type:"childList",target:t,removedNodes:Lt(e),previousSibling:s,nextSibling:i}),o&&pr(o,"disconnectedCallback");let l=[];t.nodeType===X&&!Ze(t)&&l.push([()=>t[D].removeChild?.(t,e,a)]),we(l)}function Gt(t,e){let n=e[M],r=e[f];n?n[f]=r:t[R]=r,r&&(r[M]=n);let o=t.childNodes.indexOf(e);return t.childNodes.splice(o,1),j(e)&&t.children.splice(t.children.indexOf(e),1),e[Y]=null,e[f]=null,e[M]=null,o}function pr(t,e){for(let n of t){let r=n[e];typeof r=="function"&&bt(n,()=>r.call(n))}}function lt(t,e,n,r,o){let{observedAttributes:s}=t.constructor,{attributeChangedCallback:i}=t;i==null||s==null||!s.includes(e)||bt(t,()=>i.call(t,e,n,r,o))}var Ht=class{[R]=null;constructor(e){this[q]=e}getNamedItem(e){let n=String(e),r=this[q][S]===A?G(n):n,o=this[R];for(;o;){if(o.name===r)return o;o=o[f]}return null}getNamedItemNS(e,n){let r=ie(e),o=String(n),s=this[R];for(;s;){if(s.localName===o&&s[S]===r)return s;s=s[f]}return null}item(e){let n=this[R],r=0;for(;n;){if(r++===e)return n;n=n[f]}return null}get length(){let e=0,n=this[R];for(;n;)e++,n=n[f];return e}removeNamedItem(e){let n=String(e),r=this[q][S]===A?G(n):n;return B(()=>this.removeNamedItemImmediately(o=>o.name===r))}removeNamedItemNS(e,n){let r=ie(e),o=String(n);return B(()=>this.removeNamedItemImmediately(s=>s.localName===o&&s[S]===r))}removeNamedItemImmediately(e){let n=this[q],r=this[R],o=null;for(;r!=null;){if(e(r)){o&&(o[f]=r[f]),this[R]===r&&(this[R]=r[f]);let s=r.value;return r[f]=null,r[q]=null,De&&ee({type:"attributes",target:n,attributeName:r.name,attributeNamespace:r[S],oldValue:s}),n[D].removeAttribute?.(n,r.name,r[S]),lt(n,r.localName,s,null,r[S]),r}o=r,r=r[f]}return null}setNamedItem(e){return B(()=>this.setNamedItemImmediately(e))}setNamedItemImmediately(e){let n=this[q],r=e[q];if(r!=null&&r!==n)throw C("The attribute is already in use by another element.","InUseAttributeError");let o=null,s=this[R],i=null;for(;s;){if(s.localName===e.localName&&s[S]===e[S]){if(s===e)return s;i?i[f]=e:this[R]=e,e[f]=s[f],s[f]=null,o=s;break}i=s,s=s[f]}o==null&&(i?i[f]=e:this[R]=e),e[q]=n,e[I]=n[I],o&&(o[q]=null);let a=o==null||o.value!==e.value,l=o!=null&&o.name!==e.name;return a&&De&&ee({type:"attributes",target:n,attributeName:e.name,attributeNamespace:e[S],oldValue:o?.value??null}),l&&n[D].removeAttribute?.(n,o.name,o[S]),(a||l)&&n[D].setAttribute?.(n,e.name,e.value,e[S]),a&&lt(n,e.localName,o?.value??null,e.value,e[S]),o}setNamedItemNS(e){return this.setNamedItem(e)}*[Symbol.iterator](){let e=this[R];for(;e;)yield e,e=e[f]}};var ve=class extends Q{nodeType=ke;[S]=null;[f]=null;[q]=null;constructor(e,n,r){super(),this[v]=e,this[de]=n,r&&(this[S]=r)}get nodeName(){return this[v]}set nodeName(e){}get name(){return this[v]}set name(e){}get localName(){if(this[S]==null)return this[v];let e=this[v].indexOf(":");return e<0?this[v]:this[v].slice(e+1)}get prefix(){if(this[S]==null)return null;let e=this[v].indexOf(":");return e<0?null:this[v].slice(0,e)}get value(){return this[de]}set value(e){let n=String(e),r=this[q];if(!r){this[de]=n;return}B(()=>{let o=this[de];this[de]=n,De&&o!==n&&ee({type:"attributes",target:r,attributeName:this[v],attributeNamespace:this[S],oldValue:o}),this[D].setAttribute?.(r,this[v],n,this[S]),lt(r,this.localName,o,n,this[S])})}get nodeValue(){return this.value}set nodeValue(e){this.value=e}get ownerElement(){return this[q]}get namespaceURI(){return this[S]}get specified(){return!0}};var fo={amp:"&",AMP:"&",apos:"\'",gt:">",GT:">",lt:"<",LT:"<",quot:\'"\',QUOT:\'"\'},po=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ho=/(?:<([a-z][a-z0-9-:]*)((?:[\\s]+[^<>\'"=/\\s]+(?:=([\'"])[^]*?\\3|=[^>\'"\\s]*|))*)[\\s]*(\\/?)\\s*>|<\\/([a-z][a-z0-9-:]*)>|<!--(.*?)-->|([^<>]+))/gi,yr=/\\s([^<>\'"=/\\n\\s]+)(?:=(["\'])([\\s\\S]*?)\\2|=([^>\'"\\n\\s]*)|)/g,go="|b|big|blockquote|body|br|center|code|dd|div|dl|dt|em|embed|h1|h2|h3|h4|h5|h6|head|hr|i|img|li|listing|menu|meta|nobr|ol|p|pre|ruby|s|small|span|strong|strike|sub|sup|table|tt|u|ul|var|",yo=/^(?:color|face|size)$/i;function hr(t){return t.replace(/&(?:(amp|AMP|apos|gt|GT|lt|LT|quot|QUOT)|#(\\d+)|#[xX]([\\da-fA-F]+));/g,(e,n,r,o)=>{if(n)return fo[n];let s=Number.parseInt(r??o,r?10:16);try{return String.fromCodePoint(s)}catch{return e}})}function br(t){return t.namespaceURI===A&&po.has(t.localName)}function gr(t){let e=t.localName;return t[S]===K&&(e==="foreignObject"||e==="desc"||e==="title")}function bo(t,e){if(go.includes(`|${t}|`))return!0;if(t!=="font")return!1;for(let n of e.matchAll(yr))if(yo.test(n[1]))return!0;return!1}function Ut(t,e){let n=e.ownerDocument,r=n.createDocumentFragment(),o=[],s=r;for(let i of t.matchAll(ho)){let a=i[1];if(a){let l=i[2],c=G(a),m=o[o.length-1]?.element??e,p=m[S]===K?K:A;if(c==="svg")p=K;else if(p===K){if(gr(m))p=A;else if(bo(c,l)){for(;o.length>0;){let O=o[o.length-1];if(O.element[S]!==K||gr(O.element))break;o.pop(),s=O.target}p=A}}let h=p===A?c:a,g=n[Ce](h,p,null,h);for(let O of l.matchAll(yr))g.setAttribute(O[1],hr(O[3]||O[4]||""));if(s.append(g),br(g)||p!==A&&i[4])continue;o.push({element:g,target:s}),s=p===A&&c==="template"?g.content:g}else if(i[5]){let l=G(i[5]);for(let c=o.length-1;c>=0;c--){let m=o[c],p=G(m.element[v]);if(p===l){s=m.target,o.length=c;break}if(m.element[S]===A&&p==="template")break}}else i[6]?s.append(n.createComment(i[6])):s.append(hr(i[7]))}return r}function Vt(t){return Nr([{type:"content",child:t[R]}])}function Er(t){return Nr([{type:"opening",node:t}])}function Nr(t){let e=[],n;for(;n=t.pop();)switch(n.type){case"opening":{let r=n.node;switch(r.nodeType){case X:{let o=r;e.push(`<${o[v]}`);let s=o[ne]?.[R];for(;s;){e.push(` ${s[v]}`);let a=s[de];a!==""&&(a=String(a).replace(/&/g,"&amp;").replace(/"/g,"&quot;"),e.push(`="${a}"`)),s=s[f]}if(e.push(">"),br(o))break;let i=o.namespaceURI===A&&o.localName==="template"?o[se]:o;t.push({type:"closing",name:o[v]}),t.push({type:"content",child:i?.[R]??null});break}case Ie:{let o=r;e.push(o[$].replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"));break}case Me:{let o=r;e.push(`<!--${o[$]}-->`);break}}break}case"content":{let r=n.child;r&&(t.push({type:"content",child:r[f]}),t.push({type:"opening",node:r}));break}case"closing":e.push(`</${n.name}>`);break}return e.join("")}var H=class extends re{nodeType=X;[S]=A;[ue]=null;get namespaceURI(){return this[S]}get prefix(){return this[ue]}get localName(){let e=this[ue];return e==null?this[v]:this[v].slice(e.length+1)}get nodeName(){return this[S]===A?Xn(this[v]):this[v]}get tagName(){return this.nodeName}get id(){return this.getAttributeNS(null,"id")??""}set id(e){this.setAttribute("id",String(e))}get slot(){return this.getAttributeNS(null,"slot")??""}set slot(e){let n=String(e);this.getAttributeNS(null,"slot")!==n&&this.attributes.setNamedItem(new ve("slot",n))}get attributes(){let e=this[ne];return e||(e=new Ht(this),this[ne]=e),e}getAttributeNames(){return[...this.attributes].map(e=>e.name)}getElementsByTagName(e){return Ct(this,e)}get firstElementChild(){return this.children[0]??null}getElementsByClassName(e){return Pt(this,e)}get lastElementChild(){return this.children[this.children.length-1]??null}get nextElementSibling(){let e=this.nextSibling;for(;e&&e.nodeType!==1;)e=e.nextSibling;return e}get previousElementSibling(){let e=this.previousSibling;for(;e&&e.nodeType!==1;)e=e.previousSibling;return e}setAttribute(e,n){let r=String(e),o=String(n);mn(r);let s=this[S]===A?G(r):r,i=this.attributes.getNamedItemNS(null,s);i?i.value=o:this.attributes.setNamedItem(new ve(s,o))}setAttributeNS(e,n,r){let o=ie(e),s=String(n),i=String(r),a=pt(o,s,"attribute"),l=this.attributes.getNamedItemNS(a.namespace,a.localName);l?l.value=i:this.attributes.setNamedItemNS(new ve(a.qualifiedName,i,a.namespace))}toggleAttribute(e,n){let r=String(e);mn(r);let o=this[S]===A?G(r):r,s=this.attributes.getNamedItemNS(null,o),i=n===void 0?void 0:!!n;return s==null?i===!1?!1:(this.attributes.setNamedItem(new ve(o,"")),!0):i===!0?!0:(this.attributes.removeNamedItemNS(null,o),!1)}getAttribute(e){let n=this.attributes.getNamedItem(e);return n&&n.value}getAttributeNS(e,n){let r=this.attributes.getNamedItemNS(e,n);return r&&r.value}hasAttribute(e){return this.attributes.getNamedItem(e)!=null}hasAttributeNS(e,n){return this.attributes.getNamedItemNS(e,n)!=null}removeAttribute(e){let n=String(e),r=this[S]===A?G(n):n;this.attributes.removeNamedItemNS(null,r)}removeAttributeNS(e,n){this.attributes.removeNamedItemNS(e,n)}get outerHTML(){return Er(this)}get innerHTML(){return Vt(this)}set innerHTML(e){if(e==null||e==="")this.replaceChildren();else{let n=Ut(String(e),this);this.replaceChildren(n)}}};var Le=class t extends H{[S]=K;get ownerSVGElement(){let e=null,n=this.parentNode;for(;n instanceof t;)e=n,n=n.parentNode;return e}};var ge=class extends he{[$]="";constructor(e){super(),this[$]=e==null?"":String(e)}setData(e){let n=Pn,r=n?this[$]:null,o="";e!=null&&(o=typeof e=="string"?e:String(e)),this[$]=o,n&&r!==o&&ee({type:"characterData",target:this,oldValue:r}),this[D].setText?.(this,o)}get data(){return this[$]}set data(e){this.setData(e)}};var Ge=class extends ge{nodeType=Ie;[v]="#text"};var He=class extends ge{nodeType=Me;[v]="#comment"};var Ue=class extends re{nodeType=fe;[v]="#document-fragment";[I]=typeof window<"u"?window.document:null;getElementById(e){return _t(this,e)}};var Ve=class extends H{get content(){let e=this[se];return e||(e=this.ownerDocument.createDocumentFragment(),e[me]=this,this[se]=e),e}set content(e){}set innerHTML(e){this.content.replaceChildren(Ut(String(e),this))}get innerHTML(){let e=this[se];return e?Vt(e):""}};var Bt=class extends H{};var zt=class extends H{};var jt=class extends H{};var ct=class extends re{nodeType=Te;[v]="#document";[U]=!0;constructor(e){super(),this.defaultView=e,this[I]=this,this.documentElement=qt(new jt,this,"html"),this.body=qt(new Bt,this,"body"),this.head=qt(new zt,this,"head"),this.appendChild(this.documentElement),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body)}get textContent(){return null}set textContent(e){}getElementsByClassName(e){return Pt(this,e)}createElement(e){let n=String(e);return Zn(n),Cn(this,G(n))}createElementNS(e,n){let r=pt(e,n,"element");return Cn(this,r.qualifiedName,r.namespace,r.prefix,r.localName)}[Ce](e,n,r,o){return Cn(this,e,n,r,o)}createTextNode(e){let n=Ft(new Ge(e),this);return this[D].createText?.(n,n.data),n}createComment(e){return Ft(new He(e),this)}createDocumentFragment(){return Ft(new Ue,this)}createEvent(){return new V("")}getElementById(e){return _t(this,e)}getElementsByTagName(e){return Ct(this,e)}importNode(e,n){if(e.nodeType===Te)throw C("Cannot import a document node","NotSupportedError");return At(e,n,this)}adoptNode(e){if(e[I]===this)return e;let n=Rt(e);return B(()=>{let r=e.parentNode;return r?fr(r,e,n,this):ot(n.nodes,this),e})}};function Ft(t,e){return Object.defineProperty(t,I,{value:e,writable:!0,enumerable:!1}),t}function Cn(t,e,n=A,r=null,o=e){let s;if(n===K)s=new Le;else if(n===A&&o==="template")s=new Ve;else if(n===A){let i=t.defaultView.customElements.get(o);s=i?new i:new H}else s=new H;return qt(s,t,e,n,r)}function qt(t,e,n,r=A,o=null){return Ft(t,e),Object.defineProperties(t,{[v]:{value:n},[S]:{value:r},[ue]:{value:o}}),e[D].createElement?.(t,r),t}var Yt=class extends V{constructor(e,n){super(e,n),this.detail=n?.detail??null}initCustomEvent(e,n,r,o){super.initEvent(e,n,r),this.detail=o??null}};var Wt=class extends V{constructor(e,n){super(e,n),this.message=n.message,this.filename=n.filename,this.lineno=n.lineno,this.colno=n.colno,this.error=n.error}};var Xt=class extends V{constructor(e,n){super(e,n),this.promise=n.promise,this.reason=n.reason}};var $t=class extends V{constructor(e,n){super(e,n),this.oldState=n.oldState,this.newState=n.newState}};var Kt=class extends V{constructor(e,n={}){super(e,n),this.relatedTarget=n.relatedTarget??null}};var Zt=class extends V{constructor(e,n={}){super(e,n),this.clipboardData=n.clipboardData??null}};var Qt=class extends H{};var Eo=/^[a-z][^A-Z\\u0000\\t\\n\\f\\r />]*-[^A-Z\\u0000\\t\\n\\f\\r />]*$/u,No=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function Tr(t){return Eo.test(t)&&!No.has(t)}function wr(t){return C(`Invalid custom element name: "${t}"`,"SyntaxError")}var Jt=class{registry=new Map;listenersByName=new Map;define(e,n,r){if(!Tr(e))throw wr(e);if(this.registry.has(e))throw C(`A custom element named "${e}" has already been defined`,"NotSupportedError");if(this.getName(n)!=null)throw C("This constructor has already been registered in this custom element registry","NotSupportedError");this.registry.set(e,n);let o=this.listenersByName.get(e);if(o!=null){this.listenersByName.delete(e);for(let s of o)s(n)}}get(e){return this.registry.get(e)}getName(e){for(let[n,r]of this.registry)if(r===e)return n;return null}whenDefined(e){if(!Tr(e))return Promise.reject(wr(e));let n=this.registry.get(e);if(n!=null)return Promise.resolve(n);let r=this.listenersByName.get(e);return r==null&&(r=[],this.listenersByName.set(e,r)),new Promise(o=>{r.push(o)})}upgrade(e){}initialize(e){}};var To=["onerror","onunhandledrejection"],vr=Symbol.for("@remote-dom/polyfill/global-property");function Sr(t){return Object.getOwnPropertyDescriptors(t)}function Or(t){let e={};for(let[n,r]of Object.entries(Object.getOwnPropertyDescriptors(pe.prototype)))n!=="constructor"&&typeof r.value=="function"&&(r.value=kn(r.value.bind(t)),e[n]=r);return e}function Rr(t){let e={};for(let n of To)e[n]={configurable:!0,enumerable:!0,get:kn(()=>t[n]),set:kn(r=>{t[n]=r})};return e}function wo(t){return Object.assign(Sr(t),Or(t),Rr(t))}function kn(t){return Object.defineProperty(t,vr,{value:!0}),t}function xr(t,e){for(let n of Reflect.ownKeys(e)){let r=xo(t,n);(r==null||vo(r))&&Object.defineProperty(t,n,e[n])}}function xo(t,e){let n=t;for(;n;){let r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function vo(t){return[t.value,t.get,t.set].some(e=>typeof e=="function"&&e[vr]===!0)}var Se=class extends pe{[D]={};[mt]=[];[Ne]=Oo(this);name="";window=this;parent=this;self=this;top=this;document=new ct(this);customElements=new Jt;location=globalThis.location;navigator=globalThis.navigator;Event=V;ErrorEvent=Wt;PromiseRejectionEvent=Xt;ToggleEvent=$t;FocusEvent=Kt;ClipboardEvent=Zt;EventTarget=pe;CustomEvent=Yt;Node=Q;ParentNode=re;ChildNode=he;DocumentFragment=Ue;Document=ct;CharacterData=ge;Comment=He;Text=Ge;Element=H;HTMLElement=Qt;SVGElement=Le;HTMLTemplateElement=Ve;MutationObserver=Dt;#t=null;#n=null;#e=null;static with(...e){let n=this;return class extends n{constructor(){super();for(let o of e)So(this,o)}}}get onerror(){return this.#n}set onerror(e){this.#t&&this.removeEventListener("error",this.#t),e&&typeof e=="function"?(this.#n=e,this.#t=n=>{e(n.message??"Error",n.filename,n.lineno,n.colno,n.error)},this.addEventListener("error",this.#t)):(this.#t=null,this.#n=null)}get onunhandledrejection(){return this.#e}set onunhandledrejection(e){this.#e&&this.removeEventListener("unhandledrejection",this.#e),e&&typeof e=="function"?(this.#e=e,this.addEventListener("unhandledrejection",this.#e)):this.#e=null}static setGlobal(e){let n=globalThis.self,r=globalThis.window,o=Sr(e),s=Object.assign(Or(e),Rr(e));delete o.self,Object.defineProperties(globalThis,o),xr(globalThis,s),typeof n>"u"||n===r&&n!==globalThis?Object.defineProperty(globalThis,"self",{value:e,configurable:!0,writable:!0,enumerable:!0}):n!==globalThis&&(Object.defineProperties(n,o),xr(n,s))}static setGlobalThis(e){for(let n in e)e[n]===e&&(e[n]=globalThis);Object.defineProperties(globalThis,wo(e))}};function So(t,e){t[mt].push(e(t)??{})}function Oo(t){return{createElement:le.bind(null,t,"createElement"),setAttribute:le.bind(null,t,"setAttribute"),removeAttribute:le.bind(null,t,"removeAttribute"),createText:le.bind(null,t,"createText"),setText:le.bind(null,t,"setText"),insertChild:le.bind(null,t,"insertChild"),removeChild:le.bind(null,t,"removeChild"),addEventListener:le.bind(null,t,"addEventListener"),removeEventListener:le.bind(null,t,"removeEventListener")}}function le(t,e,...n){for(let s of t[mt])s[e]?.apply(s,n);let r=t[D];r[e]?.apply(r,n)}var en=new Se;var In="~";var ye=new WeakMap;function Be(t){return ye.get(t)}var Gn=new WeakMap,Ao=0;function te(t){let e=Gn.get(t);return e==null&&(e=String(Ao++),tn(t,e)),e}function tn(t,e){Gn.set(t,e)}var Dn=new WeakMap;function _o(t){return Dn.get(t)}var Ln=new WeakMap;function Po(t){let e=Ln.get(t);if(e!=null)return e;if(!(!(t instanceof Element)||t.tagName.includes("-"))){e={};for(let{name:n,value:r}of t.attributes)e[n]=r;return e}}var Co=new WeakMap;function ko(t){return Co.get(t)}function Hn(t,e,n){let r=Dn.get(t);if(r==null&&(r={},Dn.set(t,r)),r[e]===n)return;r[e]=n;let o=ye.get(t);o?.mutate([[3,te(t),e,n,1]])}function be(t,e,n){let r=Ln.get(t);if(r==null&&(r={},Ln.set(t,r)),r[e]===n)return;n==null?delete r[e]:r[e]=String(n);let o=ye.get(t);o?.mutate([[3,te(t),e,n,2]])}function ze(t,e){if(ye.get(t)!==e&&(ye.set(t,e),t.childNodes))for(let r=0;r<t.childNodes.length;r++)ze(t.childNodes[r],e)}function nn(t){if(ye.get(t)!=null&&(ye.delete(t),t.childNodes))for(let n=0;n<t.childNodes.length;n++)nn(t.childNodes[n])}function je(t){let{nodeType:e}=t;switch(e){case 1:return{id:te(t),type:e,element:t.localName,properties:Mn(_o(t)),attributes:Mn(Po(t)),eventListeners:Mn(ko(t)),children:Array.from(t.childNodes).map(je)};case 3:case 8:return{id:te(t),type:e,data:t.data};default:throw new Error(`Cannot serialize node of type ${t.nodeType} (${typeof t.nodeType})`)}}function Mn(t){return t?{...t}:void 0}function Un(t,e,...n){let r=Gn.get(t),o=ye.get(t);if(r==null||o==null)throw new Error(`Cannot call method ${e} on an unconnected node`);return o.call(r,e,...n)}var Fe=en[D];Fe.insertChild=(t,e,n)=>{let r=Be(t);r!=null&&(ze(e,r),r.mutate([[0,te(t),je(e),n]]))};Fe.removeChild=(t,e,n)=>{let r=Be(t);r!=null&&(nn(e),r.mutate([[1,te(t),n]]))};Fe.setText=(t,e)=>{let n=Be(t);n?.mutate([[2,te(t),e]])};Fe.setAttribute=(t,e,n)=>{t.tagName.includes("-")||be(t,e,n)};Fe.removeAttribute=(t,e)=>{t.tagName.includes("-")||be(t,e)};Se.setGlobal(en);function rn(t){if(typeof t=="string")return{type:"navigate",to:t};let{place:e,record:n,where:r,section:o}=t??{},s={...r===void 0?{}:{where:r},...o===void 0?{}:{section:String(o)}};return typeof e=="string"?{type:"navigate",place:e,...s}:typeof n=="string"?{type:"navigate",to:n,...s}:void 0}var _r=["wheel","drag","pinch"];function Pr(t){let e=t;return typeof t=="object"&&t!==null&&e.graview==="host-hello"&&typeof e.nonce=="string"}function kr(t,e={}){let n,r="",o,s=0,i=new Set,a=new Map,l=[],c=b=>{n?n.postMessage({...b,nonce:r}):l.push(b)},m=b=>{let E=b.data;if(!(!E||typeof E!="object")){if(E.type==="props"){o=E.props;for(let k of i)k(E.props)}else E.type==="answer"?(a.get(E.id)?.(E),a.delete(E.id)):E.type==="event"&&typeof E.listener=="number"?e.onEvent?.(E):E.type==="heartbeat"&&typeof E.beat=="number"&&c({type:"heartbeat",beat:E.beat});e.onMessage?.(E)}},p=()=>{},h=b=>{if(n||!t.fromHost(b)||!Pr(b.data)||b.data.protocol!==1)return;let E=b.ports[0];if(E){n=E,r=b.data.nonce,n.onmessage=m,n.start?.(),p();for(let k of l.splice(0))c(k)}};p=t.listen(h),t.ready({graview:"guest-ready",protocol:1});let g,O={get props(){return o},subscribe(b){return i.add(b),()=>i.delete(b)},act(b,E={}){let k=s+=1;return new Promise(L=>{a.set(k,L),c({type:"act",id:k,name:b,args:E})})},navigate(b){let E=rn(b);E&&c(E)},size(b){c({type:"size",height:b})},autoSize(b){let E=b??globalThis.document?.documentElement,k=globalThis.ResizeObserver;if(!E||!k||typeof E.getBoundingClientRect!="function")return()=>{};g?.disconnect();let L=new k(()=>O.size(Math.ceil(E.getBoundingClientRect().height)));return L.observe(E),g=L,()=>L.disconnect()},close(){g?.disconnect(),p(),n?.close(),i.clear()}};return{guest:O,send:c}}var Mr=["globalThis","Infinity","NaN","undefined","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape","Object","Function","Array","Number","Boolean","String","Symbol","BigInt","Date","Promise","RegExp","Math","JSON","Reflect","Proxy","Intl","Error","AggregateError","EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError","SuppressedError","Map","Set","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Iterator","AsyncIterator","DisposableStack","AsyncDisposableStack","ArrayBuffer","SharedArrayBuffer","DataView","Atomics","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float16Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"],Dr=["window","parent","top","document","customElements","Event","ErrorEvent","PromiseRejectionEvent","ToggleEvent","FocusEvent","ClipboardEvent","CustomEvent","EventTarget","Node","ParentNode","ChildNode","DocumentFragment","Document","CharacterData","Comment","Text","Element","HTMLElement","SVGElement","HTMLTemplateElement","MutationObserver"],Lr=["self","postMessage","setTimeout","clearTimeout","setInterval","clearInterval","queueMicrotask","structuredClone","crypto","console","DOMException"],Gr=["TEMPORARY","PERSISTENT"],ll=Object.freeze([...Mr,...Dr,...Lr,...Gr]),cl=Object.freeze(["constructor","__defineGetter__","__defineSetter__","hasOwnProperty","__lookupGetter__","__lookupSetter__","isPrototypeOf","propertyIsEnumerable","toString","valueOf","__proto__","toLocaleString"]),Ir=t=>typeof t=="symbol"?`[${t.description??"symbol"}]`:t;function Hr(t=globalThis,e=[],n={}){let r=[],o=[],s=new Set([...Mr,...Dr,...Lr,...e,"constructor",Symbol.toStringTag]),i=(T,P)=>{let F=Reflect.getOwnPropertyDescriptor(T,P);return F===void 0||!("value"in F)||F.writable||F.configurable?!1:n.primitivesStay&&typeof P=="symbol"&&(typeof F.value!="object"||F.value===null)&&typeof F.value!="function"?!0:Gr.includes(P)&&typeof F.value=="number"},a=t,l=a.setTimeout,c=a.setInterval,m=a.crypto,p=(T,P)=>function(F,Ye,...dt){if(typeof F!="function")throw new TypeError(`${P} takes a function: a guest view cannot run code from text`);return T.call(t,F,Ye,...dt)},h=m?Object.freeze({getRandomValues:T=>m.getRandomValues(T)}):void 0,g=a.document?.defaultView;if(g&&g!==a)for(let T of Reflect.ownKeys(g))typeof T=="symbol"||s.has(T)||Reflect.deleteProperty(g,T)||o.push(`window.${T}`);let O=[];for(let T=t;T&&T!==Object.prototype;T=Object.getPrototypeOf(T))O.push(T);for(let T of O)for(let P of Reflect.ownKeys(T))s.has(P)||(Reflect.deleteProperty(T,P)?r.push(Ir(P)):i(T,P)||o.push(Ir(P)));let b=()=>function(){throw new EvalError("A guest view cannot make code from text.")},E=[Function.prototype,Object.getPrototypeOf(async function(){}),Object.getPrototypeOf(function*(){}),Object.getPrototypeOf(async function*(){})];for(let T of E){let P=b();Object.defineProperty(P,"prototype",{value:T,writable:!1,enumerable:!1,configurable:!1}),Reflect.defineProperty(T,"constructor",{value:P,writable:!1,enumerable:!1,configurable:!1})||o.push("Function.prototype.constructor"),T===Function.prototype&&Reflect.defineProperty(t,"Function",{value:P,writable:!0,enumerable:!1,configurable:!0})}let k=(T,P)=>{Reflect.defineProperty(t,T,{value:P,writable:!0,enumerable:!0,configurable:!0})||o.push(T)};k("setTimeout",p(l,"setTimeout")),k("setInterval",p(c,"setInterval")),h&&k("crypto",h);for(let T of O.slice(1))Object.freeze(T);for(let T of Reflect.ownKeys(t)){let P=Reflect.getOwnPropertyDescriptor(t,T);Reflect.defineProperty(t,T,"value"in P?{...P,writable:!1,configurable:!1}:{...P,configurable:!1})}let L;try{L=Reflect.preventExtensions(t)}catch{L=!1}return{removed:r,stuck:o,sealed:L}}var ut=class extends HTMLElement{constructor(){super(),tn(this,In)}connect(e){if(Be(this)===e||(ze(this,e),this.childNodes.length===0))return;let n=[];for(let r=0;r<this.childNodes.length;r++){let o=this.childNodes[r];n.push([0,In,je(o),r])}e.mutate(n)}updateRemoteProperty(e,n){Hn(this,e,n)}callRemoteMethod(e,...n){return Un(this,e,...n)}};var d={},on={empty:!0},Io={id:"text",class:"text",title:"text",lang:"text",dir:{oneOf:["ltr","rtl","auto"]},hidden:"text",tabindex:{oneOf:["-1","0"]},role:"text",style:"style",translate:{oneOf:["yes","no"]},spellcheck:{oneOf:["true","false"]},draggable:{oneOf:["true","false"]},inert:"boolean"},Vn={div:d,section:d,article:d,aside:d,header:d,footer:d,nav:d,hgroup:d,search:d,address:d,figure:d,figcaption:d,blockquote:d,p:d,pre:d,hr:on,br:on,wbr:on,h1:d,h2:d,h3:d,h4:d,h5:d,h6:d,span:d,strong:d,em:d,b:d,i:d,u:d,s:d,small:d,mark:d,abbr:d,cite:d,q:d,code:d,kbd:d,samp:d,var:d,sub:d,sup:d,dfn:d,bdi:d,bdo:d,ruby:d,rt:d,rp:d,time:{attributes:{datetime:"text"}},data:{attributes:{value:"text"}},del:{attributes:{datetime:"text"}},ins:{attributes:{datetime:"text"}},a:d,ul:d,menu:d,dl:d,dt:d,dd:d,ol:{attributes:{start:"number",reversed:"boolean",type:{oneOf:["1","a","A","i","I"]}}},li:{attributes:{value:"number"}},table:d,caption:d,thead:d,tbody:d,tfoot:d,tr:d,colgroup:{attributes:{span:"number"}},col:{attributes:{span:"number"},empty:!0},th:{attributes:{colspan:"number",rowspan:"number",headers:"text",scope:{oneOf:["row","col","rowgroup","colgroup"]},abbr:"text"}},td:{attributes:{colspan:"number",rowspan:"number",headers:"text"}},details:{attributes:{open:"boolean",name:"text"}},summary:d,button:{attributes:{type:{oneOf:["button"]},disabled:"boolean",name:"text",value:"text"}},input:{empty:!0,attributes:{type:{oneOf:["text","search","number","range","checkbox","radio","date","time","datetime-local","month","week","color","email","tel","url"]},name:"text",value:"text",placeholder:"text",min:"text",max:"text",step:"text",checked:"boolean",disabled:"boolean",readonly:"boolean",required:"boolean",maxlength:"number",minlength:"number",size:"number",pattern:"text",multiple:"boolean",inputmode:"text",enterkeyhint:"text"}},select:{attributes:{name:"text",disabled:"boolean",multiple:"boolean",required:"boolean",size:"number"}},option:{attributes:{value:"text",selected:"boolean",disabled:"boolean",label:"text"}},optgroup:{attributes:{label:"text",disabled:"boolean"}},textarea:{attributes:{name:"text",placeholder:"text",rows:"number",cols:"number",disabled:"boolean",readonly:"boolean",required:"boolean",maxlength:"number",minlength:"number",wrap:{oneOf:["soft","hard","off"]}}},label:{attributes:{for:"text"}},fieldset:{attributes:{disabled:"boolean",name:"text"}},legend:d,output:d,meter:{attributes:{value:"number",min:"number",max:"number",low:"number",high:"number",optimum:"number"}},progress:{attributes:{value:"number",max:"number"}},img:{empty:!0,attributes:{src:"image",alt:"text",width:"number",height:"number",decoding:{oneOf:["async","sync","auto"]}}},"graview-video":on},Mo=["fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","stroke-opacity","stroke-miterlimit","opacity","color","display","visibility","transform-origin","clip-path","clip-rule","marker-start","marker-mid","marker-end","font-family","font-size","font-weight","font-style","text-anchor","dominant-baseline","alignment-baseline","letter-spacing","text-decoration","paint-order","vector-effect","shape-rendering","pointer-events","stop-color","stop-opacity","overflow","mask"],Do={id:"text",class:"text",style:"style",lang:"text",role:"text",tabindex:{oneOf:["-1","0"]},transform:"geometry",...Object.fromEntries(Mo.map(t=>[t,"css"]))},qe={x:"geometry",y:"geometry",width:"geometry",height:"geometry"},sn={viewBox:"geometry",preserveAspectRatio:"geometry"},Ur={gradientUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},gradientTransform:"geometry",spreadMethod:{oneOf:["pad","reflect","repeat"]},href:"fragment"},Vr={svg:{attributes:{...qe,...sn}},g:d,defs:d,symbol:{attributes:{...qe,...sn,refX:"geometry",refY:"geometry"}},use:{attributes:{...qe,href:"fragment"}},title:d,desc:d,path:{attributes:{d:"geometry",pathLength:"number"}},rect:{attributes:{...qe,rx:"geometry",ry:"geometry",pathLength:"number"}},circle:{attributes:{cx:"geometry",cy:"geometry",r:"geometry",pathLength:"number"}},ellipse:{attributes:{cx:"geometry",cy:"geometry",rx:"geometry",ry:"geometry",pathLength:"number"}},line:{attributes:{x1:"geometry",y1:"geometry",x2:"geometry",y2:"geometry",pathLength:"number"}},polyline:{attributes:{points:"geometry",pathLength:"number"}},polygon:{attributes:{points:"geometry",pathLength:"number"}},text:{attributes:{x:"geometry",y:"geometry",dx:"geometry",dy:"geometry",rotate:"geometry",textLength:"geometry",lengthAdjust:{oneOf:["spacing","spacingAndGlyphs"]}}},tspan:{attributes:{x:"geometry",y:"geometry",dx:"geometry",dy:"geometry",rotate:"geometry",textLength:"geometry"}},textPath:{attributes:{href:"fragment",startOffset:"geometry",method:{oneOf:["align","stretch"]},spacing:{oneOf:["auto","exact"]},side:{oneOf:["left","right"]}}},linearGradient:{attributes:{x1:"geometry",y1:"geometry",x2:"geometry",y2:"geometry",...Ur}},radialGradient:{attributes:{cx:"geometry",cy:"geometry",r:"geometry",fx:"geometry",fy:"geometry",fr:"geometry",...Ur}},stop:{attributes:{offset:"geometry"}},clipPath:{attributes:{clipPathUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]}}},mask:{attributes:{...qe,maskUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},maskContentUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]}}},pattern:{attributes:{...qe,...sn,patternUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},patternContentUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},patternTransform:"geometry",href:"fragment"}},marker:{attributes:{...sn,markerWidth:"geometry",markerHeight:"geometry",refX:"geometry",refY:"geometry",orient:"geometry",markerUnits:{oneOf:["strokeWidth","userSpaceOnUse"]}}}};var Br={section:["aria-label","aria-labelledby","title"]};function Lo(t){return/^aria-[a-z]+$/.test(t)}function Go(t){return/^data-[a-z0-9][a-z0-9_.-]*$/.test(t)}var Ho=new Map(Object.keys(Vr).map(t=>[t.toLowerCase(),t]));function zr(t){return Ho.get(t.toLowerCase())}function jr(t,e,n){let r=n.toLowerCase(),o=t==="html"?[Vn[e]?.attributes,Io]:[Vr[e]?.attributes,Do],s=t==="svg"&&r==="xlink:href"?"href":r;for(let i of o)if(i){for(let[a,l]of Object.entries(i))if(a.toLowerCase()===s)return{name:a,kind:l}}if(Lo(r)||Go(r))return{name:r,kind:"text"}}var Fr="~",an=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),oe=(t,e=0)=>{if(t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===void 0)return t;if(!(e>64||typeof t!="object"))return Array.isArray(t)?t.map(n=>oe(n,e+1)):Object.fromEntries(Object.entries(t).map(([n,r])=>[n,oe(r,e+1)]))};function qr(){let t=new Map,e=new Map,n=new Map([[Fr,{children:[],listeners:new Map}]]),r=0,o=c=>{let m=e.get(c);return m===void 0&&(m=r+=1,e.set(c,m),t.set(m,{listener:c,count:0})),t.get(m).count+=1,m},s=c=>{let m=t.get(c);m&&(m.count-=1,!(m.count>0)&&(t.delete(c),e.delete(m.listener)))},i=c=>{let m=n.get(c);if(m){n.delete(c);for(let p of m.listeners.values())s(p);for(let p of m.children)i(p)}},a=(c,m,p=0)=>{if(!an(c)||p>64)return oe(c);let h=typeof c.id=="string"?c.id:void 0,g=m&&h!==void 0&&h!==Fr;g&&i(h);let O={children:[],listeners:new Map};g&&n.set(h,O);let b={};for(let[E,k]of Object.entries(c))E==="children"&&Array.isArray(k)?b[E]=k.map(L=>{let T=a(L,g,p+1);return g&&an(L)&&typeof L.id=="string"&&O.children.push(L.id),T}):E==="eventListeners"&&an(k)?b[E]=Object.fromEntries(Object.entries(k).map(([L,T])=>{if(typeof T!="function"||!g)return[L,void 0];let P=o(T);return O.listeners.set(L,P),[L,{listener:P}]})):b[E]=oe(k,p+1);return b},l=c=>{if(!Array.isArray(c))return oe(c);let[m,p]=c,h=typeof p=="string"?n.get(p):void 0;if(m===0){let g=a(c[2],h!==void 0),O=an(c[2])?c[2].id:void 0;if(h&&typeof O=="string"&&n.has(O)){let b=Number(c[3]);h.children.splice(Number.isInteger(b)&&b>=0&&b<=h.children.length?b:h.children.length,0,O)}return[m,oe(p),g,oe(c[3])]}if(m===1){let g=Number(c[2]);return h&&Number.isInteger(g)&&g>=0&&g<h.children.length&&i(h.children.splice(g,1)[0]),oe(c)}if(m===3&&c[4]===3){let g=String(c[2]),O=c[3],b=h&&typeof O=="function"?o(O):void 0,E=h?.listeners.get(g);return E!==void 0&&s(E),b===void 0?h?.listeners.delete(g):h.listeners.set(g,b),[m,oe(p),g,b===void 0?void 0:{listener:b},3]}return oe(c)};return{encode:c=>c.map(l),listener:c=>t.get(c)?.listener,get listening(){return t.size},get nodes(){return n.size-1}}}var ln="graview-view-root",Uo=["value","checked","key","pressed","files","refused","x","y","width","height","deltaX","deltaY","deltaMode","ctrlKey","metaKey","phase","pointerId","button","pressure","dx","dy","scale","rotation"],Vo=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/\'/g,"&#39;"),Bo=t=>Object.freeze({html:t,toString:()=>t}),Yr=t=>typeof t=="object"&&t!==null&&typeof t.html=="string"&&Object.isFrozen(t),Wr=t=>t==null||t===!1?"":Array.isArray(t)?t.map(Wr).join(""):Yr(t)?t.html:Vo(String(t));function Xr(t){customElements.get(ln)||customElements.define(ln,ut);let e=Event,n=qr(),r=new Set,o=new Set,s,i=[],a=new Set;for(let u of["closest","matches","dataset"]){let y=()=>{throw new TypeError(`A view\'s element has no ${u}: graview.on hands event.element, the element its selector matched; read event.element.getAttribute("data-\\u2026").`)};u in Element.prototype||Object.defineProperty(Element.prototype,u,u==="dataset"?{get:y}:{value:y})}let l=document.createElement(ln),c=u=>{let y=N=>{for(let w of Array.from(N.childNodes)){if(w.nodeType!==1)continue;if(te(w)===u)return w;let x=y(w);if(x)return x}};return y(l)},m=u=>{let y=c(u.target);if(!y)return;let N=new e(u.event,{bubbles:!0}),w={};for(let x of Uo)u[x]!==void 0&&(w[x]=u[x]);for(let x of Object.keys(w))Object.defineProperty(N,x,{value:w[x],enumerable:!0});y.dispatchEvent(N);for(let x of o){if(x.type!==u.event)continue;let _;try{_=new Set(Array.from(l.querySelectorAll(x.selector)))}catch{continue}for(let z=y;z&&z!==l;z=z.parentNode)if(_.has(z)){x.listener(Object.freeze({type:u.event,target:y,element:z,...w}));break}}},p=u=>{if(u.type==="dom-event"&&typeof u.target=="string")return m(u);if(u.type==="notice")return t.warn(u.text);if(u.type!=="props")return;s=u.props;let y=t.now();for(let x of r)try{x(u.props)}catch(_){t.threw(_)}let N=t.now()-y,w=u.push;typeof w=="number"&&t.microtask(()=>t.microtask(()=>t.send({type:"pushed",push:w,ms:N})))},h;l.connect({mutate(u){h||(h=[],t.microtask(()=>{let y=h??[];h=void 0,t.send({type:"render",records:n.encode(y)})})),h.push(...u)},call:()=>{}});let g=u=>u.nodeType===1?u.getAttribute("data-key")??u.getAttribute("id"):null,O=(u,y)=>u.nodeType===y.nodeType&&(u.nodeType!==1||u.localName===y.localName&&u.namespaceURI===y.namespaceURI&&g(u)===g(y));function b(u,y){let N=Array.from(y.childNodes),w=0;for(let x of N){let _=u.childNodes[w]??null;if(_&&O(_,x)){E(_,x),w+=1;continue}if(g(x)!==null){let ce=Array.from(u.childNodes).slice(w+1).find(We=>O(We,x));if(ce){u.insertBefore(ce,_),E(ce,x),w+=1;continue}}u.insertBefore(x,_),w+=1}for(;u.childNodes.length>w;)u.removeChild(u.lastChild)}function E(u,y){if(u.nodeType!==1){u.data!==y.data&&(u.data=y.data);return}let N=u,w=y,x=k(N);for(let _ of N.getAttributeNames())w.hasAttribute(_)||(N.removeAttribute(_),x&&be(N,_,void 0));for(let _ of w.getAttributeNames()){let z=w.getAttribute(_);N.getAttribute(_)!==z&&N.setAttribute(_,z),x&&be(N,_,z)}b(N,w)}let k=u=>u.localName.includes("-");function L(u){for(let y of Array.from(u.childNodes)){if(y.nodeType!==1)continue;let N=y;if(k(N))for(let w of N.getAttributeNames())be(N,w,N.getAttribute(w)??void 0);L(N)}}function T(u,y,N){for(let w of Array.from(u.childNodes)){if(w.nodeType!==1)continue;let x=w,_=x.localName,z=y||_.toLowerCase()==="svg",ce=z?zr(_):Object.prototype.hasOwnProperty.call(Vn,_.toLowerCase())?_.toLowerCase():void 0;if(!ce){N.add(`<${_}>`);continue}for(let We of x.getAttributeNames())(!jr(z?"svg":"html",ce,We)||!z&&Br[ce]?.includes(We.toLowerCase()))&&N.add(`${ce} ${We}`);T(x,z,N)}}function P(u){let y=document.createElement("div"),N=Array.isArray(u)?u:[u];for(let x of N)if(x!=null)if(typeof x=="string"||Yr(x)){let _=document.createElement("div");_.innerHTML=typeof x=="string"?x:x.html,y.append(...Array.from(_.childNodes))}else y.append(x);let w=new Set;T(y,!1,w),i=[...w],i.length>0&&t.warn(`The host will not draw: ${i.join(", ")}`),L(y),b(l,y)}let F,Ye=new Set(_r),dt="[]",cn=!1,Fn=()=>{cn||(cn=!0,t.microtask(()=>{cn=!1;let u=[...new Map([...o].filter(N=>Ye.has(N.type)).map(N=>[`${N.type} ${N.selector}`,{event:N.type,selector:N.selector}])).entries()].sort(([N],[w])=>N<w?-1:N>w?1:0).map(([,N])=>N),y=JSON.stringify(u);y!==dt&&(dt=y,t.send({type:"gestures",bound:u}))}))};return{view:Object.freeze({get props(){return s},onProps(u){return r.add(u),s&&u(s),()=>void r.delete(u)},render:P,style(u){typeof u!="string"||u===F||(F=u,t.send({type:"style",css:u}))},on(u,y,N){let w={type:u,selector:y,listener:N};return o.add(w),typeof u=="string"&&!a.has(u)&&(a.add(u),t.send({type:"hears",events:[u]})),Ye.has(u)&&Fn(),()=>{o.delete(w),Ye.has(u)&&Fn()}},act:(u,y={})=>t.act(u,y),navigate(u){if(typeof u=="string")return t.navigate(u);let y=rn(u);y&&t.send(y)},html(u,...y){return Bo(u.reduce((N,w,x)=>N+w+(x<y.length?Wr(y[x]):""),""))},get refused(){return i},get hardening(){return t.hardening()}}),hear:p}}var jn={removed:[],stuck:[],sealed:!1,worker:!1},Bn=kr({listen(t){return Re.listen(t),()=>Re.unlisten(t)},fromHost:()=>!0,ready:t=>Re.post(t)},{onMessage:t=>$r.hear(t)}),$r=Xr({send:t=>Bn.send(t),act:(t,e)=>Bn.guest.act(t,e),navigate:t=>Bn.guest.navigate(t),microtask:Re.microtask,now:Re.now,threw:t=>console.error(t),warn:t=>console.warn(t),hardening:()=>jn}),zo=$r.view;Object.defineProperty(globalThis,"graview",{value:zo,enumerable:!0,configurable:!0,writable:!1});var zn="WorkerGlobalScope"in globalThis?Hr(globalThis,["graview"]):jn;jn=zn;if(zn.stuck.length>0)throw new Error(`The view\'s worker could not be hardened: ${zn.stuck.join(", ")} would not go.`);})();\n';export{e as VIEW_RUNTIME};
@@ -1 +1 @@
1
- import"./chunk.2FLPDPEL.js";import"./chunk.UUBYFBPN.js";import{b as m}from"./chunk.2RVUDRRY.js";import"./chunk.LLEFYJPJ.js";import{R as p}from"./chunk.FOQZADMA.js";import"./chunk.SDO3U72B.js";import{T as l}from"./chunk.V5MYKNL7.js";import{b as f}from"./chunk.AJZBJBMO.js";var a=f(p(),1);function N({states:e,definition:v}){let s=e.values.reduce((t,n)=>t+n.count,0),u=t=>t===null?"with none":m(v,e.field,t).toLowerCase(),c=e.values.filter(t=>t.count>0).map(t=>`${l(t.count)} ${u(t.value)}`).join(", ");return s===0?null:(0,a.jsx)("div",{className:"graview-district-states",role:"img","aria-label":c,title:c,children:e.values.map((t,n)=>{if(t.count===0)return null;let y=e.values.filter(r=>r.count>0).length,w=t.count/s*(168-(y-1)),o=l(t.count),i=`${o} ${u(t.value)}`,d=r=>r.length*6.2+8<=w;return(0,a.jsx)("span",{"data-graview-tier":t.tier,style:{flexGrow:t.count},title:i,children:d(i)?i:d(o)?o:""},n)})})}export{N as StatesBar};
1
+ import"./chunk.LFJH6X6O.js";import"./chunk.VTUMPH4Z.js";import{b as m}from"./chunk.PCTVLNOS.js";import"./chunk.4QEDYRES.js";import{R as p}from"./chunk.JE4QQEJE.js";import"./chunk.SDO3U72B.js";import{U as l}from"./chunk.UG727PEE.js";import{b as f}from"./chunk.AJZBJBMO.js";var a=f(p(),1);function N({states:e,definition:v}){let s=e.values.reduce((t,n)=>t+n.count,0),u=t=>t===null?"with none":m(v,e.field,t).toLowerCase(),c=e.values.filter(t=>t.count>0).map(t=>`${l(t.count)} ${u(t.value)}`).join(", ");return s===0?null:(0,a.jsx)("div",{className:"graview-district-states",role:"img","aria-label":c,title:c,children:e.values.map((t,n)=>{if(t.count===0)return null;let y=e.values.filter(r=>r.count>0).length,w=t.count/s*(168-(y-1)),o=l(t.count),i=`${o} ${u(t.value)}`,d=r=>r.length*6.2+8<=w;return(0,a.jsx)("span",{"data-graview-tier":t.tier,style:{flexGrow:t.count},title:i,children:d(i)?i:d(o)?o:""},n)})})}export{N as StatesBar};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk.B7DCQJXV.js";import"./chunk.U6YOAS4X.js";import"./chunk.4QEDYRES.js";import"./chunk.JE4QQEJE.js";import"./chunk.SDO3U72B.js";import"./chunk.UG727PEE.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
@@ -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{a as y}from"./chunk.ZJMDLRC5.js";import{m as g}from"./chunk.LLEFYJPJ.js";import{G as R,R as c,ua as m}from"./chunk.FOQZADMA.js";import{a as f}from"./chunk.SDO3U72B.js";import{ka as p}from"./chunk.V5MYKNL7.js";import{b as u}from"./chunk.AJZBJBMO.js";var o=u(R(),1);var r=u(c(),1),S,h=()=>S??=m(f(()=>(__graviewPreload(import.meta.url,["./chunk.BXT6FDT4.js","./chunk.WVDKYUF3.js","./chunk.ZHLQWMV5.js","./chunk.TNESS3LQ.js","./chunk.V5MYKNL7.js","./chunk.AJZBJBMO.js"]),import("./chunk.OW7NSJ4H.js"))));function L(e){let[n,t]=(0,o.useState)(()=>h().current);return(0,o.useEffect)(()=>{if(!e||n)return;let i=!0;return h().load().then(a=>i&&t(a),()=>{}),()=>{i=!1}},[e,n]),n}function D(e,n){let t=L(n.length>0);return(0,o.useMemo)(()=>t?t.withLines(e,n):n,[t,e,n])}function I(e,n){let t=L(n.some(i=>i.shape));return(0,o.useMemo)(()=>{let i=new Map;if(!t)return i;for(let a of n){let l=t.ruleLine(a,e);l&&i.set(a.name,l)}return i},[t,e,n])}function M(e){let n=e.line;if(!(!n||e.message.endsWith(` \u2014 ${n.text}`)||e.message===b(e)))return e.message}function b(e){let n=e.line;return n?n.record!==void 0?`${n.record} \u2014 ${n.text}`:n.text:e.message}var P={name:{},op:{color:"var(--graview-ink-muted)",fontWeight:500},value:{fontWeight:600,fontVariantNumeric:"tabular-nums"},word:{color:"var(--graview-ink-muted)"},open:{color:"var(--graview-ink-faint)"},close:{color:"var(--graview-ink-faint)"}};function w({parts:e}){return(0,r.jsx)(r.Fragment,{children:e.map((n,t)=>(0,r.jsxs)("span",{children:[n.space?" ":"",(0,r.jsx)("span",{"data-graview-rule-part":n.as,style:P[n.as],children:n.text})]},t))})}function x(e,n){let t=p(e?.tryDefinition(n),n);return t.charAt(0).toUpperCase()+t.slice(1)}function C({line:e,schema:n,brand:t,lead:i=e.record===void 0?"kind":"record",stacked:a=!1,style:l}){let d=e.kind,s=i==="kind"?d?x(n,d):void 0:i==="record"?e.record:void 0,k=i==="kind"&&s?`${s}: ${e.said}`:i==="record"&&s?`${s} \u2014 ${e.said}`:e.said;return(0,r.jsxs)("span",{"data-graview-rule-line":"",style:{overflowWrap:"anywhere",...l},children:[(0,r.jsx)("span",{style:g,children:k}),(0,r.jsxs)("span",{"aria-hidden":"true",children:[i!=="none"&&d?(0,r.jsx)("span",{style:{display:"inline-flex",verticalAlign:"-0.1em",marginRight:"0.4em"},children:(0,r.jsx)(y,{kind:d,...n?{schema:n}:{},...t?{brand:t}:{},size:13})}):null,s?(0,r.jsxs)("span",{"data-graview-rule-head":"",style:{fontWeight:600,marginRight:i==="record"||a?0:"0.6em"},children:[s,i==="record"&&!a?(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \u2014 "}):null]}):null,a&&s?(0,r.jsx)("br",{}):null,(0,r.jsx)(w,{parts:e.parts}),e.when&&e.when.length>0?(0,r.jsxs)("span",{"data-graview-rule-when":"",style:{color:"var(--graview-ink-faint)"},children:[", when ",(0,r.jsx)(w,{parts:e.when})]}):null]})]})}function z(e){return e.line?e.label&&e.label.trim().length>0?e.label:void 0:e.label&&e.label!==e.message&&!e.message.startsWith(e.label)?e.label:void 0}export{D as a,I as b,M as c,C as d,z as e};
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as y}from"./chunk.QHP7AJUV.js";import{m as g}from"./chunk.4QEDYRES.js";import{G as R,R as c,ua as m}from"./chunk.JE4QQEJE.js";import{a as f}from"./chunk.SDO3U72B.js";import{la as p}from"./chunk.UG727PEE.js";import{b as u}from"./chunk.AJZBJBMO.js";var o=u(R(),1);var r=u(c(),1),S,h=()=>S??=m(f(()=>(__graviewPreload(import.meta.url,["./chunk.PH5ITX3N.js","./chunk.57R4ZUMM.js","./chunk.J7ZMNAWB.js","./chunk.VKJAGZNU.js","./chunk.UG727PEE.js","./chunk.AJZBJBMO.js"]),import("./chunk.JPD2I4Z7.js"))));function L(e){let[n,t]=(0,o.useState)(()=>h().current);return(0,o.useEffect)(()=>{if(!e||n)return;let i=!0;return h().load().then(a=>i&&t(a),()=>{}),()=>{i=!1}},[e,n]),n}function D(e,n){let t=L(n.length>0);return(0,o.useMemo)(()=>t?t.withLines(e,n):n,[t,e,n])}function I(e,n){let t=L(n.some(i=>i.shape));return(0,o.useMemo)(()=>{let i=new Map;if(!t)return i;for(let a of n){let l=t.ruleLine(a,e);l&&i.set(a.name,l)}return i},[t,e,n])}function M(e){let n=e.line;if(!(!n||e.message.endsWith(` \u2014 ${n.text}`)||e.message===b(e)))return e.message}function b(e){let n=e.line;return n?n.record!==void 0?`${n.record} \u2014 ${n.text}`:n.text:e.message}var P={name:{},op:{color:"var(--graview-ink-muted)",fontWeight:500},value:{fontWeight:600,fontVariantNumeric:"tabular-nums"},word:{color:"var(--graview-ink-muted)"},open:{color:"var(--graview-ink-faint)"},close:{color:"var(--graview-ink-faint)"}};function w({parts:e}){return(0,r.jsx)(r.Fragment,{children:e.map((n,t)=>(0,r.jsxs)("span",{children:[n.space?" ":"",(0,r.jsx)("span",{"data-graview-rule-part":n.as,style:P[n.as],children:n.text})]},t))})}function x(e,n){let t=p(e?.tryDefinition(n),n);return t.charAt(0).toUpperCase()+t.slice(1)}function C({line:e,schema:n,brand:t,lead:i=e.record===void 0?"kind":"record",stacked:a=!1,style:l}){let d=e.kind,s=i==="kind"?d?x(n,d):void 0:i==="record"?e.record:void 0,k=i==="kind"&&s?`${s}: ${e.said}`:i==="record"&&s?`${s} \u2014 ${e.said}`:e.said;return(0,r.jsxs)("span",{"data-graview-rule-line":"",style:{overflowWrap:"anywhere",...l},children:[(0,r.jsx)("span",{style:g,children:k}),(0,r.jsxs)("span",{"aria-hidden":"true",children:[i!=="none"&&d?(0,r.jsx)("span",{style:{display:"inline-flex",verticalAlign:"-0.1em",marginRight:"0.4em"},children:(0,r.jsx)(y,{kind:d,...n?{schema:n}:{},...t?{brand:t}:{},size:13})}):null,s?(0,r.jsxs)("span",{"data-graview-rule-head":"",style:{fontWeight:600,marginRight:i==="record"||a?0:"0.6em"},children:[s,i==="record"&&!a?(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \u2014 "}):null]}):null,a&&s?(0,r.jsx)("br",{}):null,(0,r.jsx)(w,{parts:e.parts}),e.when&&e.when.length>0?(0,r.jsxs)("span",{"data-graview-rule-when":"",style:{color:"var(--graview-ink-faint)"},children:[", when ",(0,r.jsx)(w,{parts:e.when})]}):null]})]})}function z(e){return e.line?e.label&&e.label.trim().length>0?e.label:void 0:e.label&&e.label!==e.message&&!e.message.startsWith(e.label)?e.label:void 0}export{D as a,I as b,M as c,C as d,z as e};
@@ -1 +1 @@
1
- import{ca as y,da as V}from"./chunk.FOQZADMA.js";import"./chunk.SDO3U72B.js";import{Rc as u,Uc as m}from"./chunk.V5MYKNL7.js";import"./chunk.AJZBJBMO.js";var c=t=>[t,...u.filter(r=>r!==t)];function w(t,r){if(r.hidden.length===0&&r.removed.length===0)return t;let f=new Set(r.removed.filter(e=>!e.lens).map(e=>e.name)),o=new Set(r.hidden),s=e=>e?.name!==void 0&&(f.has(e.name)||o.has(e.name)),a=(e,i,d)=>[...t.registrations()].reverse().find(n=>n.kind===e&&n.cardinality===i&&n.fidelity===d&&!n.beside&&!n.hidden&&!s(n)),h=(e,i)=>{for(let d of c(i.fidelity)){let n=a(e,i.cardinality,d);if(n)return n}if(i.cardinality==="one")for(let d of c(i.fidelity)){let n=a(e,"many",d);if(n)return n}},l={...t,register(e,i,d,n){return t.register(e,i,d,n),l},lookup(e,i){return t.lookup(e,i)===void 0?void 0:a(e,i.cardinality,i.fidelity)?.view},places:()=>t.places().filter(e=>!(e.name!==void 0&&f.has(e.name))).map(e=>e.name!==void 0&&o.has(e.name)&&!e.hidden?{...e,hidden:!0}:e),resolve(e,i,d){let n=t.resolve(e,i,d);return!n||!s(n)||d!==void 0&&n.name!==void 0&&!f.has(n.name)&&n.title!==void 0&&m(n.title)===d?n:h(e,i)},all:()=>t.all().filter(e=>!(e.name!==void 0&&f.has(e.name)))};return y(t)&&V(l),l}function v(t,r,f){let o,s=()=>{let a=r.current();o&&a.hidden===o.hidden&&a.removed===o.removed||(o=a,f(w(t,a)))};return s(),r.onChange?.(s)??(()=>{})}export{w as tidyViews,v as watchTidied};
1
+ import{ca as y,da as V}from"./chunk.JE4QQEJE.js";import"./chunk.SDO3U72B.js";import{Tc as u,Wc as m}from"./chunk.UG727PEE.js";import"./chunk.AJZBJBMO.js";var c=t=>[t,...u.filter(r=>r!==t)];function w(t,r){if(r.hidden.length===0&&r.removed.length===0)return t;let f=new Set(r.removed.filter(e=>!e.lens).map(e=>e.name)),o=new Set(r.hidden),s=e=>e?.name!==void 0&&(f.has(e.name)||o.has(e.name)),a=(e,i,d)=>[...t.registrations()].reverse().find(n=>n.kind===e&&n.cardinality===i&&n.fidelity===d&&!n.beside&&!n.hidden&&!s(n)),h=(e,i)=>{for(let d of c(i.fidelity)){let n=a(e,i.cardinality,d);if(n)return n}if(i.cardinality==="one")for(let d of c(i.fidelity)){let n=a(e,"many",d);if(n)return n}},l={...t,register(e,i,d,n){return t.register(e,i,d,n),l},lookup(e,i){return t.lookup(e,i)===void 0?void 0:a(e,i.cardinality,i.fidelity)?.view},places:()=>t.places().filter(e=>!(e.name!==void 0&&f.has(e.name))).map(e=>e.name!==void 0&&o.has(e.name)&&!e.hidden?{...e,hidden:!0}:e),resolve(e,i,d){let n=t.resolve(e,i,d);return!n||!s(n)||d!==void 0&&n.name!==void 0&&!f.has(n.name)&&n.title!==void 0&&m(n.title)===d?n:h(e,i)},all:()=>t.all().filter(e=>!(e.name!==void 0&&f.has(e.name)))};return y(t)&&V(l),l}function v(t,r,f){let o,s=()=>{let a=r.current();o&&a.hidden===o.hidden&&a.removed===o.removed||(o=a,f(w(t,a)))};return s(),r.onChange?.(s)??(()=>{})}export{w as tidyViews,v as watchTidied};