graview 0.1.48 → 0.1.50

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 (202) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +6 -6
  3. package/dist/index.js.map +1 -1
  4. package/dist/preview/chunk.24MUPV4Y.js +1 -0
  5. package/dist/preview/chunk.25VJPUDH.js +1 -0
  6. package/dist/preview/{chunk.PTXLOFQW.js → chunk.2P66HH5Y.js} +1 -1
  7. package/dist/preview/chunk.2VZSC2MB.js +1 -0
  8. package/dist/preview/chunk.3L5USMQD.js +1 -0
  9. package/dist/preview/chunk.3O3H37WD.js +1 -0
  10. package/dist/preview/{chunk.Y4MQGEUS.js → chunk.3SY6WWWQ.js} +2 -2
  11. package/dist/preview/{chunk.HC5N3CT2.js → chunk.4BQNG3W3.js} +1 -1
  12. package/dist/preview/chunk.4SHSEIHT.js +1 -0
  13. package/dist/preview/{chunk.NTLHEHOM.js → chunk.4VJARLJ5.js} +1 -1
  14. package/dist/preview/{chunk.I5TOMBIF.js → chunk.4XOSDCCE.js} +1 -1
  15. package/dist/preview/{chunk.CH5ROV7N.js → chunk.53BGPCM6.js} +1 -1
  16. package/dist/preview/{chunk.NQZ73QV7.js → chunk.5DZR46YG.js} +1 -1
  17. package/dist/preview/{chunk.GNBN3BK7.js → chunk.5RNB6IC5.js} +1 -1
  18. package/dist/preview/{chunk.E5GM2SMO.js → chunk.64TFAR5Z.js} +1 -1
  19. package/dist/preview/chunk.6BMCZPT6.js +1 -0
  20. package/dist/preview/chunk.6SHF6IL5.js +1 -0
  21. package/dist/preview/{chunk.RLXKDXPB.js → chunk.6VA5XFRR.js} +1 -1
  22. package/dist/preview/{chunk.GUMJEVVP.js → chunk.73BJYIYS.js} +1 -1
  23. package/dist/preview/chunk.7PJVMADH.js +2 -0
  24. package/dist/preview/{chunk.YVOABA2U.js → chunk.7QW6JYGP.js} +1 -1
  25. package/dist/preview/{chunk.NR5ODXMO.js → chunk.7VX6TBNY.js} +1 -1
  26. package/dist/preview/{chunk.5IM645XQ.js → chunk.A53G42QO.js} +1 -1
  27. package/dist/preview/chunk.ATWNWPME.js +1 -0
  28. package/dist/preview/chunk.AVCW7C6V.js +1 -0
  29. package/dist/preview/{chunk.V4BCB7N2.js → chunk.AXCRFJDL.js} +1 -1
  30. package/dist/preview/chunk.AXMC6XVT.js +2 -0
  31. package/dist/preview/{chunk.DAUC2DFY.js → chunk.BBNF52IB.js} +1 -1
  32. package/dist/preview/chunk.BJAQRV2R.js +1 -0
  33. package/dist/preview/chunk.BLS2G3CD.js +5 -0
  34. package/dist/preview/chunk.BNQL37AC.js +88 -0
  35. package/dist/preview/{chunk.QGE6YKSU.js → chunk.BORCUDGS.js} +1 -1
  36. package/dist/preview/{chunk.MVRG75ZD.js → chunk.CBJHYNNT.js} +1 -1
  37. package/dist/preview/{chunk.I7QIHN66.js → chunk.CDZVUCEK.js} +1 -1
  38. package/dist/preview/chunk.CR5MQMOL.js +1 -0
  39. package/dist/preview/{chunk.2GLJH253.js → chunk.DUIKIJKC.js} +1 -1
  40. package/dist/preview/{chunk.GT3F6FQ6.js → chunk.DUJUJN35.js} +1 -1
  41. package/dist/preview/chunk.ECSWXLBI.js +9 -0
  42. package/dist/preview/{chunk.KW65F4WA.js → chunk.EF3UB7US.js} +1 -1
  43. package/dist/preview/chunk.EJUZGIQ5.js +1 -0
  44. package/dist/preview/{chunk.NLBIX7LH.js → chunk.ETWREHXF.js} +1 -1
  45. package/dist/preview/{chunk.3BAHAK6W.js → chunk.ETX4QMM2.js} +1 -1
  46. package/dist/preview/{chunk.VQAQQW4Q.js → chunk.F5FJHKWV.js} +1 -1
  47. package/dist/preview/{chunk.D5ETRTAF.js → chunk.F7AFJRPP.js} +1 -1
  48. package/dist/preview/{chunk.TKMQROXF.js → chunk.FDFVGHQE.js} +1 -1
  49. package/dist/preview/{chunk.UJRBOUGC.js → chunk.FFPG4PHX.js} +1 -1
  50. package/dist/preview/{chunk.CJ23XTSW.js → chunk.FKUVIG6D.js} +1 -1
  51. package/dist/preview/chunk.GDYI5QDS.js +1 -0
  52. package/dist/preview/{chunk.OFRGDJYX.js → chunk.GPJFNLEJ.js} +1 -1
  53. package/dist/preview/chunk.GQI53L5P.js +1 -0
  54. package/dist/preview/{chunk.X7JMJSLU.js → chunk.GQX57JIE.js} +1 -1
  55. package/dist/preview/{chunk.ZH4NWRWB.js → chunk.GTUBIJTP.js} +1 -1
  56. package/dist/preview/{chunk.X7N3JUO4.js → chunk.GZEZMU2T.js} +2 -2
  57. package/dist/preview/{chunk.6VAFNCR4.js → chunk.HG34MT7C.js} +1 -1
  58. package/dist/preview/{chunk.DUWYF7BO.js → chunk.HGP3Q7QX.js} +1 -1
  59. package/dist/preview/chunk.IATLUWAD.js +1 -0
  60. package/dist/preview/chunk.IDQHSAAQ.js +1 -0
  61. package/dist/preview/chunk.IMFAPZ6J.js +21 -0
  62. package/dist/preview/{chunk.PQVUQVRL.js → chunk.JC5NXMG3.js} +1 -1
  63. package/dist/preview/chunk.JJP5OL5E.js +1 -0
  64. package/dist/preview/{chunk.QQTRAY5W.js → chunk.JLPBXG4P.js} +1 -1
  65. package/dist/preview/chunk.JLR74UFP.js +1 -0
  66. package/dist/preview/{chunk.2VTMTW7K.js → chunk.JYJNRCK5.js} +1 -1
  67. package/dist/preview/chunk.K4ITS63T.js +1 -0
  68. package/dist/preview/{chunk.KTFUVR4V.js → chunk.KFHXTHIY.js} +1 -1
  69. package/dist/preview/{chunk.QQCDCRR2.js → chunk.KGGWFL54.js} +1 -1
  70. package/dist/preview/{chunk.5A4AOFOA.js → chunk.KHRS2SKB.js} +1 -1
  71. package/dist/preview/{chunk.NWT5FPEK.js → chunk.KOPRZLJH.js} +18 -18
  72. package/dist/preview/{chunk.Z4UM4CMT.js → chunk.KQSD5MLY.js} +1 -1
  73. package/dist/preview/{chunk.DFK2NA6L.js → chunk.KT2LXHSI.js} +1 -1
  74. package/dist/preview/{chunk.ETR6AV47.js → chunk.KVEDMKUN.js} +1 -1
  75. package/dist/preview/{chunk.7LL7OSBY.js → chunk.KZ3UPV2L.js} +2 -2
  76. package/dist/preview/{chunk.J2V76Z6G.js → chunk.L2AV6JRA.js} +1 -1
  77. package/dist/preview/chunk.L5MDUZLQ.js +1 -0
  78. package/dist/preview/chunk.LDE5HLTM.js +1 -0
  79. package/dist/preview/{chunk.IRHSTUZM.js → chunk.LGHMUUTG.js} +1 -1
  80. package/dist/preview/{chunk.PPRSGM64.js → chunk.LJXAZ5TF.js} +1 -1
  81. package/dist/preview/{chunk.OZGETOTK.js → chunk.M55U47A6.js} +1 -1
  82. package/dist/preview/chunk.M5RHVUZ6.js +1 -0
  83. package/dist/preview/chunk.MBZ6N5SO.js +1 -0
  84. package/dist/preview/chunk.MCFLCC42.js +12 -0
  85. package/dist/preview/{chunk.MVSV7T6E.js → chunk.MCPLU2U4.js} +1 -1
  86. package/dist/preview/chunk.MQISKON2.js +1 -0
  87. package/dist/preview/{chunk.DHAK6PPX.js → chunk.MRUDTYOL.js} +2 -2
  88. package/dist/preview/chunk.N7FIUTVY.js +1 -0
  89. package/dist/preview/chunk.NPU4WYRB.js +1 -0
  90. package/dist/preview/{chunk.DPHTUTOS.js → chunk.O6SKKF4V.js} +1 -1
  91. package/dist/preview/{chunk.SKJJBLXF.js → chunk.OB7XLVK6.js} +1 -1
  92. package/dist/preview/{chunk.P6FQAILU.js → chunk.ODHCSYXX.js} +1 -1
  93. package/dist/preview/chunk.OHAWUOUN.js +1 -0
  94. package/dist/preview/chunk.OKQ4JXTW.js +1 -0
  95. package/dist/preview/{chunk.YDL5BSTG.js → chunk.OUNLAMBA.js} +1 -1
  96. package/dist/preview/chunk.OYQ6ZA6T.js +1 -0
  97. package/dist/preview/chunk.Q7RI4SI4.js +1 -0
  98. package/dist/preview/chunk.Q7UQ5OXA.js +1 -0
  99. package/dist/preview/{chunk.PMJUGHW4.js → chunk.QAUZDLDA.js} +1 -1
  100. package/dist/preview/{chunk.5Y3Q7ONN.js → chunk.QFI4L2HK.js} +1 -1
  101. package/dist/preview/{chunk.UGJSMNVO.js → chunk.QSZLY62B.js} +1 -1
  102. package/dist/preview/{chunk.LXCJVZF3.js → chunk.QZMBEG4E.js} +1 -1
  103. package/dist/preview/{chunk.TBRJOKIK.js → chunk.RK6BK5FD.js} +1 -1
  104. package/dist/preview/{chunk.76W2FXEC.js → chunk.ROJZLOKZ.js} +1 -1
  105. package/dist/preview/chunk.RXJBYP7B.js +1 -0
  106. package/dist/preview/chunk.S64LCR23.js +1 -0
  107. package/dist/preview/{chunk.TMDI7KRS.js → chunk.S7OFTGBQ.js} +4 -4
  108. package/dist/preview/chunk.SGMVLKZO.js +25 -0
  109. package/dist/preview/chunk.SJRXBTGP.js +1 -0
  110. package/dist/preview/{chunk.GH2SWMCW.js → chunk.SRU2YDTJ.js} +1 -1
  111. package/dist/preview/chunk.SVH3OMU2.js +1 -0
  112. package/dist/preview/{chunk.SFAAM4KE.js → chunk.SWLDDQJS.js} +1 -1
  113. package/dist/preview/{chunk.ENPCLMP2.js → chunk.T4UYLB3Y.js} +1 -1
  114. package/dist/preview/chunk.THTHNY4N.js +1 -0
  115. package/dist/preview/{chunk.V2GSBYDK.js → chunk.TL7UGUY4.js} +2 -2
  116. package/dist/preview/{chunk.N4M54YK6.js → chunk.TT6QBWRA.js} +1 -1
  117. package/dist/preview/{chunk.7VT3TRHR.js → chunk.TY6VILZB.js} +1 -1
  118. package/dist/preview/{chunk.DOBQ4LO4.js → chunk.U2M4SGUU.js} +1 -1
  119. package/dist/preview/chunk.U6FGWVGB.js +1 -0
  120. package/dist/preview/{chunk.KVJFY7N5.js → chunk.UCS3CBT4.js} +1 -1
  121. package/dist/preview/{chunk.2QNGGF55.js → chunk.UDTBFAS5.js} +2 -2
  122. package/dist/preview/chunk.UEL7FLL7.js +1 -0
  123. package/dist/preview/{chunk.ODRL5OWR.js → chunk.UGJ32SEL.js} +1 -1
  124. package/dist/preview/{chunk.HKA5T7DL.js → chunk.UJTRKSCK.js} +1 -1
  125. package/dist/preview/{chunk.QII2C5OV.js → chunk.UN2OB6OD.js} +1 -1
  126. package/dist/preview/chunk.UOC3SIYT.js +1 -0
  127. package/dist/preview/{chunk.HDE2MGGU.js → chunk.V5IWJ3ZV.js} +1 -1
  128. package/dist/preview/{chunk.LPD74WBI.js → chunk.VM43YREJ.js} +1 -1
  129. package/dist/preview/chunk.VVRI7DNK.js +1 -0
  130. package/dist/preview/{chunk.MZLWLIKR.js → chunk.WGRF6EHC.js} +1 -1
  131. package/dist/preview/{chunk.KVEDIBXS.js → chunk.XWLGHTH6.js} +1 -1
  132. package/dist/preview/chunk.YAS6LXQ7.js +1 -0
  133. package/dist/preview/{chunk.EMQ5POGB.js → chunk.YCJ74LZS.js} +1 -1
  134. package/dist/preview/chunk.YEKHDZ45.js +20 -0
  135. package/dist/preview/chunk.YEMNR4WU.js +1 -0
  136. package/dist/preview/{chunk.44G5A53D.js → chunk.YG3BLY67.js} +1 -1
  137. package/dist/preview/{chunk.J6ANRF6E.js → chunk.YUV7HZYG.js} +1 -1
  138. package/dist/preview/{chunk.5IPH2SCE.js → chunk.YYS45ZGQ.js} +1 -1
  139. package/dist/preview/{chunk.GACKGEUY.js → chunk.YZ6UKKEL.js} +1 -1
  140. package/dist/preview/{chunk.GVNYPFIM.js → chunk.ZBBCUK2K.js} +1 -1
  141. package/dist/preview/chunk.ZI66HRES.js +1 -0
  142. package/dist/preview/{chunk.XTMOFRHL.js → chunk.ZITDUHX3.js} +1 -1
  143. package/dist/preview/{chunk.2UIUMG23.js → chunk.ZK446PSX.js} +3 -3
  144. package/dist/preview/{chunk.6TKILWRM.js → chunk.ZKDJQDKX.js} +1 -1
  145. package/dist/preview/{chunk.QPICKSSM.js → chunk.ZOQ3OKKI.js} +1 -1
  146. package/dist/preview/chunk.ZVETGRUM.js +1 -0
  147. package/dist/preview/{chunk.G7WDMUDV.js → chunk.ZVOP2HHI.js} +1 -1
  148. package/dist/preview/index.html +51 -51
  149. package/dist/preview/page.js +2 -2
  150. package/package.json +6 -6
  151. package/dist/preview/chunk.2AZTW66C.js +0 -1
  152. package/dist/preview/chunk.37CJSWLL.js +0 -1
  153. package/dist/preview/chunk.3RP3N2JP.js +0 -1
  154. package/dist/preview/chunk.3UD7GG5B.js +0 -1
  155. package/dist/preview/chunk.4GQA3AJU.js +0 -1
  156. package/dist/preview/chunk.4KX53HCV.js +0 -9
  157. package/dist/preview/chunk.4TJOS4C7.js +0 -5
  158. package/dist/preview/chunk.4VW6THJF.js +0 -1
  159. package/dist/preview/chunk.664PBQAQ.js +0 -1
  160. package/dist/preview/chunk.72OZLWJL.js +0 -1
  161. package/dist/preview/chunk.72W6S746.js +0 -1
  162. package/dist/preview/chunk.7FRPNQU4.js +0 -1
  163. package/dist/preview/chunk.7QZYFLBS.js +0 -1
  164. package/dist/preview/chunk.B2IIEVBF.js +0 -21
  165. package/dist/preview/chunk.BDHKWVNX.js +0 -1
  166. package/dist/preview/chunk.DQ7M3LFV.js +0 -1
  167. package/dist/preview/chunk.DWPU56S5.js +0 -1
  168. package/dist/preview/chunk.E2AJ7U5Z.js +0 -1
  169. package/dist/preview/chunk.EXEZBZGW.js +0 -1
  170. package/dist/preview/chunk.EZJNUFNQ.js +0 -1
  171. package/dist/preview/chunk.FOP5RBGF.js +0 -1
  172. package/dist/preview/chunk.FPYL6REZ.js +0 -1
  173. package/dist/preview/chunk.FQYOTK34.js +0 -1
  174. package/dist/preview/chunk.GTPC6JOW.js +0 -2
  175. package/dist/preview/chunk.HG4DDNPG.js +0 -1
  176. package/dist/preview/chunk.ILZYRJDS.js +0 -1
  177. package/dist/preview/chunk.KA44WNB4.js +0 -25
  178. package/dist/preview/chunk.LGSFGNWE.js +0 -1
  179. package/dist/preview/chunk.LNON6P7K.js +0 -1
  180. package/dist/preview/chunk.MAFFUPCR.js +0 -1
  181. package/dist/preview/chunk.MTXEURFE.js +0 -1
  182. package/dist/preview/chunk.NFDLCUCC.js +0 -1
  183. package/dist/preview/chunk.NX7IIZLO.js +0 -1
  184. package/dist/preview/chunk.O45VO36H.js +0 -1
  185. package/dist/preview/chunk.OAIWGWGU.js +0 -3
  186. package/dist/preview/chunk.OVO6L5IP.js +0 -88
  187. package/dist/preview/chunk.PCEYZQAW.js +0 -1
  188. package/dist/preview/chunk.PVEPU6EA.js +0 -1
  189. package/dist/preview/chunk.QO7MDWID.js +0 -1
  190. package/dist/preview/chunk.RQBEQYB2.js +0 -1
  191. package/dist/preview/chunk.SA34Y3X5.js +0 -2
  192. package/dist/preview/chunk.SAHNXAV3.js +0 -1
  193. package/dist/preview/chunk.SUPWMV2F.js +0 -1
  194. package/dist/preview/chunk.TPG6IY4M.js +0 -1
  195. package/dist/preview/chunk.UT6642FC.js +0 -1
  196. package/dist/preview/chunk.V3N34DSU.js +0 -1
  197. package/dist/preview/chunk.W72TTRLX.js +0 -20
  198. package/dist/preview/chunk.X5G7FOPY.js +0 -12
  199. package/dist/preview/chunk.YEVA72L2.js +0 -1
  200. package/dist/preview/chunk.YLWON7X3.js +0 -1
  201. package/dist/preview/chunk.YUH43J2K.js +0 -1
  202. package/dist/preview/chunk.ZXZNAG35.js +0 -1
@@ -1 +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"),K=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",Z="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 u=l.get(e);u||(u={},l.set(e,u));let m=u[a];if(m||(m=new Map,u[a]=m),m.has(n))return;let h=this,g={type:e,listener:n,capture:o,once:s,normalizedListener:n,signal:i};(s||i)&&(g.normalizedListener=function(...k){if(g.signal?.aborted){Nt(h,g);return}return g.once&&Nt(h,g),typeof g.listener=="object"?g.listener.handleEvent(...k):g.listener.call(this,...k)});let y=this[Ee];y||(y=new Map,this[Ee]=y);let O=y.get(e);O||(O={},y.set(e,O));let b=O[a];if(b||(b=new Set,O[a]=b),m.set(n,g),b.add(g),i){let N=()=>{Nt(h,g)};g.abortListener=N,i.addEventListener("abort",N,{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 Q=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 Q,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 u=l[8]?G(l[8]):l[2]||l[7];l[7]!=null&&!l[6]&&r.matchers.length>0&&W(t);let h,g=l[4]??l[5]??l[7];if(l[2]){Tt.test(u)||W(t);let y=l[5],O=y?.[0];if(l[3]==null&&(O===\'"\'||O==="\'")){let b=l[0].lastIndexOf(y);g=i.slice(l.index+b+1),s.lastIndex=i.length}else y!=null&&!Tt.test(y)&&W(t);h=rr}else l[6]?(Tt.test(u)||W(t),h=l[6]==="#"?xt:vt):l[8]?h=l[9]==null?En:or:l[7]==="*"?h=tr:l[7]&&Tt.test(l[7])?h=nr:W(t);l[9]?([g,s.lastIndex]=so(i,s.lastIndex),u!=="has"&&u!=="not"&&W(t),u==="has"&&e&&W(t),nt(g,e||u==="has",u==="has")):h===En&&W(t),r.matchers.push({type:h,name:u,value:g}),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 K 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 u=l[ne];if(u)for(let h of u)o.has(h)||(o.add(h),e.push(h));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 u=ar(a,n);j(a)||xn(a)?s.push({source:a,destination:u,appendTo:l,childIndex:0,cloningContent:!1}):l.appendChild(u)}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 J=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 ee=Symbol("insertNode"),Rn=Symbol("preflightInsertions"),It=Symbol("replaceNode"),he=class extends J{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[ee](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[ee](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[ee](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 J?e:String(e))}function it(t,e){return e instanceof J?e:t.ownerDocument.createTextNode(String(e))}function ae(t,e){for(let n of e){if(!(n instanceof J))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[ee](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 te(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 Q,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 Q,target:t.target,type:t.type})}function Lt(...t){let e=new Q;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 Q;children=new Q;appendChild(e){return B(()=>this[ee](e,null))}insertBefore(e,n){return B(()=>this[ee](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[ee](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[ee](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[ee](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:g})=>g)),u=s;for(;u&&l.has(u);)u=u[f];let m=Gt(this,n);if(a){for(let y of a)y[U]=!1;let g=new Set(a);for(let y of i)g.has(y.node)&&(y.shouldDisconnect=!1)}this.commitInsertion(i,u);let h=this[U];return this.queueRemovalMutationRecord(this,n,o,s),this.queueInsertionMutationRecords(i),a&&this.enqueueTreeReactions(a,"disconnectedCallback"),this.enqueueInsertionReactions(i,h),this.performOrCollectHookEffects([...this.collectRemovalHookEffects(n,m),...this.collectInsertionHookEffects(i)],r),n}querySelectorAll(e){return Ot(this,e)}querySelector(e){return St(this,e)}[ee](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,u,m;if(i[I]===o)l&&(u=st(i));else{let h=Rt(i);m=h.nodes,l&&(u=h.treeNodes)}s.push({node:i,nodes:u,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&&te({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),te({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 u of o)u[U]=!1;ot(n.nodes,r),at&&te({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&&te({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&&te({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 J{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&&te({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]===Z&&(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],u=G(a),m=o[o.length-1]?.element??e,h=m[S]===Z?Z:A;if(u==="svg")h=Z;else if(h===Z){if(gr(m))h=A;else if(bo(u,l)){for(;o.length>0;){let O=o[o.length-1];if(O.element[S]!==Z||gr(O.element))break;o.pop(),s=O.target}h=A}}let g=h===A?u:a,y=n[Ce](g,h,null,g);for(let O of l.matchAll(yr))y.setAttribute(O[1],hr(O[3]||O[4]||""));if(s.append(y),br(y)||h!==A&&i[4])continue;o.push({element:y,target:s}),s=h===A&&u==="template"?y.content:y}else if(i[5]){let l=G(i[5]);for(let u=o.length-1;u>=0;u--){let m=o[u],h=G(m.element[v]);if(h===l){s=m.target,o.length=u;break}if(m.element[S]===A&&h==="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[K].replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"));break}case Me:{let o=r;e.push(`<!--${o[K]}-->`);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]=Z;get ownerSVGElement(){let e=null,n=this.parentNode;for(;n instanceof t;)e=n,n=n.parentNode;return e}};var ge=class extends he{[K]="";constructor(e){super(),this[K]=e==null?"":String(e)}setData(e){let n=Pn,r=n?this[K]:null,o="";e!=null&&(o=typeof e=="string"?e:String(e)),this[K]=o,n&&r!==o&&te({type:"characterData",target:this,oldValue:r}),this[D].setText?.(this,o)}get data(){return this[K]}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===Z)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=J;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 $(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,$(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,$(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:$(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:$(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,$(t),je(e),n]]))};Fe.removeChild=(t,e,n)=>{let r=Be(t);r!=null&&(nn(e),r.mutate([[1,$(t),n]]))};Fe.setText=(t,e)=>{let n=Be(t);n?.mutate([[2,$(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=[],u=b=>{n?n.postMessage({...b,nonce:r}):l.push(b)},m=b=>{let N=b.data;if(!(!N||typeof N!="object")){if(N.type==="props"){o=N.props;for(let k of i)k(N.props)}else N.type==="answer"?(a.get(N.id)?.(N),a.delete(N.id)):N.type==="event"&&typeof N.listener=="number"?e.onEvent?.(N):N.type==="heartbeat"&&typeof N.beat=="number"&&u({type:"heartbeat",beat:N.beat});e.onMessage?.(N)}},h=()=>{},g=b=>{if(n||!t.fromHost(b)||!Pr(b.data)||b.data.protocol!==1)return;let N=b.ports[0];if(N){n=N,r=b.data.nonce,n.onmessage=m,n.start?.(),h();for(let k of l.splice(0))u(k)}};h=t.listen(g),t.ready({graview:"guest-ready",protocol:1});let y,O={get props(){return o},subscribe(b){return i.add(b),()=>i.delete(b)},act(b,N={}){let k=s+=1;return new Promise(L=>{a.set(k,L),u({type:"act",id:k,name:b,args:N})})},navigate(b){let N=rn(b);N&&u(N)},size(b){u({type:"size",height:b})},autoSize(b){let N=b??globalThis.document?.documentElement,k=globalThis.ResizeObserver;if(!N||!k||typeof N.getBoundingClientRect!="function")return()=>{};y?.disconnect();let L=new k(()=>O.size(Math.ceil(N.getBoundingClientRect().height)));return L.observe(N),y=L,()=>L.disconnect()},close(){y?.disconnect(),h(),n?.close(),i.clear()}};return{guest:O,send:u}}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"],ul=Object.freeze([...Mr,...Dr,...Lr,...Gr]),dl=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=(x,P)=>{let F=Reflect.getOwnPropertyDescriptor(x,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,u=a.setInterval,m=a.crypto,h=(x,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 x.call(t,F,Ye,...dt)},g=m?Object.freeze({getRandomValues:x=>m.getRandomValues(x)}):void 0,y=a.document?.defaultView;if(y&&y!==a)for(let x of Reflect.ownKeys(y))typeof x=="symbol"||s.has(x)||Reflect.deleteProperty(y,x)||o.push(`window.${x}`);let O=[];for(let x=t;x&&x!==Object.prototype;x=Object.getPrototypeOf(x))O.push(x);for(let x of O)for(let P of Reflect.ownKeys(x))s.has(P)||(Reflect.deleteProperty(x,P)?r.push(Ir(P)):i(x,P)||o.push(Ir(P)));let b=()=>function(){throw new EvalError("A guest view cannot make code from text.")},N=[Function.prototype,Object.getPrototypeOf(async function(){}),Object.getPrototypeOf(function*(){}),Object.getPrototypeOf(async function*(){})];for(let x of N){let P=b();Object.defineProperty(P,"prototype",{value:x,writable:!1,enumerable:!1,configurable:!1}),Reflect.defineProperty(x,"constructor",{value:P,writable:!1,enumerable:!1,configurable:!1})||o.push("Function.prototype.constructor"),x===Function.prototype&&Reflect.defineProperty(t,"Function",{value:P,writable:!0,enumerable:!1,configurable:!0})}let k=(x,P)=>{Reflect.defineProperty(t,x,{value:P,writable:!0,enumerable:!0,configurable:!0})||o.push(x)};k("setTimeout",h(l,"setTimeout")),k("setInterval",h(u,"setInterval")),g&&k("crypto",g);for(let x of O.slice(1))Object.freeze(x);for(let x of Reflect.ownKeys(t)){let P=Reflect.getOwnPropertyDescriptor(t,x);Reflect.defineProperty(t,x,"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:{attributes:{href:"link"}},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=u=>{let m=e.get(u);return m===void 0&&(m=r+=1,e.set(u,m),t.set(m,{listener:u,count:0})),t.get(m).count+=1,m},s=u=>{let m=t.get(u);m&&(m.count-=1,!(m.count>0)&&(t.delete(u),e.delete(m.listener)))},i=u=>{let m=n.get(u);if(m){n.delete(u);for(let h of m.listeners.values())s(h);for(let h of m.children)i(h)}},a=(u,m,h=0)=>{if(!an(u)||h>64)return oe(u);let g=typeof u.id=="string"?u.id:void 0,y=m&&g!==void 0&&g!==Fr;y&&i(g);let O={children:[],listeners:new Map};y&&n.set(g,O);let b={};for(let[N,k]of Object.entries(u))N==="children"&&Array.isArray(k)?b[N]=k.map(L=>{let x=a(L,y,h+1);return y&&an(L)&&typeof L.id=="string"&&O.children.push(L.id),x}):N==="eventListeners"&&an(k)?b[N]=Object.fromEntries(Object.entries(k).map(([L,x])=>{if(typeof x!="function"||!y)return[L,void 0];let P=o(x);return O.listeners.set(L,P),[L,{listener:P}]})):b[N]=oe(k,h+1);return b},l=u=>{if(!Array.isArray(u))return oe(u);let[m,h]=u,g=typeof h=="string"?n.get(h):void 0;if(m===0){let y=a(u[2],g!==void 0),O=an(u[2])?u[2].id:void 0;if(g&&typeof O=="string"&&n.has(O)){let b=Number(u[3]);g.children.splice(Number.isInteger(b)&&b>=0&&b<=g.children.length?b:g.children.length,0,O)}return[m,oe(h),y,oe(u[3])]}if(m===1){let y=Number(u[2]);return g&&Number.isInteger(y)&&y>=0&&y<g.children.length&&i(g.children.splice(y,1)[0]),oe(u)}if(m===3&&u[4]===3){let y=String(u[2]),O=u[3],b=g&&typeof O=="function"?o(O):void 0,N=g?.listeners.get(y);return N!==void 0&&s(N),b===void 0?g?.listeners.delete(y):g.listeners.set(y,b),[m,oe(h),y,b===void 0?void 0:{listener:b},3]}return oe(u)};return{encode:u=>u.map(l),listener:u=>t.get(u)?.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 c of["closest","matches","dataset"]){let p=()=>{throw new TypeError(`A view\'s element has no ${c}: graview.on hands event.element, the element its selector matched; read event.element.getAttribute("data-\\u2026").`)};c in Element.prototype||Object.defineProperty(Element.prototype,c,c==="dataset"?{get:p}:{value:p})}let l=document.createElement(ln),u=c=>{let p=E=>{for(let w of Array.from(E.childNodes)){if(w.nodeType!==1)continue;if($(w)===c)return w;let T=p(w);if(T)return T}};return p(l)},m=c=>{let p=u(c.target);if(!p)return;let E=new e(c.event,{bubbles:!0}),w={};for(let T of Uo)c[T]!==void 0&&(w[T]=c[T]);for(let T of Object.keys(w))Object.defineProperty(E,T,{value:w[T],enumerable:!0});p.dispatchEvent(E);for(let T of o){if(T.type!==c.event)continue;let _;try{_=new Set(Array.from(l.querySelectorAll(T.selector)))}catch{continue}for(let z=p;z&&z!==l;z=z.parentNode)if(_.has(z)){T.listener(Object.freeze({type:c.event,target:p,element:z,...w}));break}}},h=c=>{if(c.type==="dom-event"&&typeof c.target=="string")return m(c);if(c.type==="notice")return t.warn(c.text);if(c.type!=="props")return;s=c.props;let p=t.now();for(let T of r)try{T(c.props)}catch(_){t.threw(_)}let E=t.now()-p,w=c.push;typeof w=="number"&&t.microtask(()=>t.microtask(()=>t.send({type:"pushed",push:w,ms:E})))},g;l.connect({mutate(c){g||(g=[],t.microtask(()=>{let p=g??[];g=void 0,t.send({type:"render",records:n.encode(p)})})),g.push(...c)},call:()=>{}});let y=c=>c.nodeType===1?c.getAttribute("data-key")??c.getAttribute("id"):null,O=(c,p)=>c.nodeType===p.nodeType&&(c.nodeType!==1||c.localName===p.localName&&c.namespaceURI===p.namespaceURI&&y(c)===y(p));function b(c,p){let E=Array.from(p.childNodes),w=0;for(let T of E){let _=c.childNodes[w]??null;if(_&&O(_,T)){N(_,T),w+=1;continue}if(y(T)!==null){let ce=Array.from(c.childNodes).slice(w+1).find(We=>O(We,T));if(ce){c.insertBefore(ce,_),N(ce,T),w+=1;continue}}c.insertBefore(T,_),w+=1}for(;c.childNodes.length>w;)c.removeChild(c.lastChild)}function N(c,p){if(c.nodeType!==1){c.data!==p.data&&(c.data=p.data);return}let E=c,w=p,T=k(E);for(let _ of E.getAttributeNames())w.hasAttribute(_)||(E.removeAttribute(_),T&&be(E,_,void 0));for(let _ of w.getAttributeNames()){let z=w.getAttribute(_);E.getAttribute(_)!==z&&E.setAttribute(_,z),T&&be(E,_,z)}b(E,w)}let k=c=>c.localName.includes("-");function L(c){for(let p of Array.from(c.childNodes)){if(p.nodeType!==1)continue;let E=p;if(k(E))for(let w of E.getAttributeNames())be(E,w,E.getAttribute(w)??void 0);L(E)}}function x(c,p,E){for(let w of Array.from(c.childNodes)){if(w.nodeType!==1)continue;let T=w,_=T.localName,z=p||_.toLowerCase()==="svg",ce=z?zr(_):Object.prototype.hasOwnProperty.call(Vn,_.toLowerCase())?_.toLowerCase():void 0;if(!ce){E.add(`<${_}>`);continue}for(let We of T.getAttributeNames())(!jr(z?"svg":"html",ce,We)||!z&&Br[ce]?.includes(We.toLowerCase()))&&E.add(`${ce} ${We}`);x(T,z,E)}}function P(c){let p=document.createElement("div"),E=Array.isArray(c)?c:[c];for(let T of E)if(T!=null)if(typeof T=="string"||Yr(T)){let _=document.createElement("div");_.innerHTML=typeof T=="string"?T:T.html,p.append(...Array.from(_.childNodes))}else p.append(T);let w=new Set;x(p,!1,w),i=[...w],i.length>0&&t.warn(`The host will not draw: ${i.join(", ")}`),L(p),b(l,p)}let F=[],Ye=new Set(_r),dt="[]",cn=!1,Fn=()=>{cn||(cn=!0,t.microtask(()=>{cn=!1;let c=[...new Map([...o].filter(E=>Ye.has(E.type)).map(E=>[`${E.type} ${E.selector}`,{event:E.type,selector:E.selector}])).entries()].sort(([E],[w])=>E<w?-1:E>w?1:0).map(([,E])=>E),p=JSON.stringify(c);p!==dt&&(dt=p,t.send({type:"gestures",bound:c}))}))};return{view:Object.freeze({get props(){return s},onProps(c){return r.add(c),s&&c(s),()=>void r.delete(c)},render:P,style(c){typeof c!="string"||F.includes(c)||(F.push(c),t.send({type:"style",sheets:[...F]}))},on(c,p,E){let w={type:c,selector:p,listener:E};return o.add(w),typeof c=="string"&&!a.has(c)&&(a.add(c),t.send({type:"hears",events:[c]})),Ye.has(c)&&Fn(),()=>{o.delete(w),Ye.has(c)&&Fn()}},act:(c,p={})=>t.act(c,p),navigate(c){if(typeof c=="string")return t.navigate(c);let p=rn(c);p&&t.send(p)},html(c,...p){return Bo(c.reduce((E,w,T)=>E+w+(T<p.length?Wr(p[T]):""),""))},get refused(){return i},get hardening(){return t.hardening()}}),hear:h,find:c=>{try{let p=l.querySelectorAll(c)[0];return p?$(p):void 0}catch{return}},listened:c=>{let p=new Set;for(let E of o)if(E.type===c)try{for(let w of Array.from(l.querySelectorAll(E.selector))){let T=$(w);T&&p.add(T)}}catch{}return[...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
+ 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,Jr=Oe.addEventListener,eo=Oe.removeEventListener,to=Oe.postMessage,no=globalThis.queueMicrotask,dn=globalThis.performance,ro=dn?dn.now.bind(dn):Date.now,Re={listen:t=>Jr.call(Oe,"message",t),unlisten:t=>eo.call(Oe,"message",t),post:t=>to.call(Oe,t),microtask:t=>no.call(globalThis,t),now:()=>ro()};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"),p=Symbol("next"),R=Symbol("child"),Y=Symbol("parent"),me=Symbol("host"),K=Symbol("data"),Ee=Symbol("listeners"),mn=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"),ke=Symbol("create_element"),Xn=0,X=1,Ce=2,Ie=3,Me=8,Te=9,$n=10,fe=11,A="http://www.w3.org/1999/xhtml",Z="http://www.w3.org/2000/svg",Kn="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 Zn(t){return t.replace(/[a-z]/g,e=>String.fromCharCode(e.charCodeAt(0)-32))}function k(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 Qn=/^(?:[A-Za-z][^\\0\\t\\n\\f\\r\\u0020/>]*|[:_\\u0080-\\u{10FFFF}][A-Za-z0-9-.:_\\u0080-\\u{10FFFF}]*)$/u,Jn=/[\\0\\t\\n\\f\\r />=]/u,oo=/[\\0\\t\\n\\f\\r />]/u;function ie(t){if(t==null)return null;let e=String(t);return e===""?null:e}function er(t){Qn.test(t)||pn(t)}function fn(t){(t===""||Jn.test(t))&&pn(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===""||oo.test(i))||(n==="element"?!Qn.test(a):a===""||Jn.test(a)))&&pn(o),i!=null&&r==null)throw k(`A namespace is required for the prefix in "${o}"`,"NamespaceError");if(i==="xml"&&r!==Kn)throw k("The xml prefix requires the XML namespace","NamespaceError");if((o==="xmlns"||i==="xmlns")&&r!==Xe)throw k("The xmlns name requires the XMLNS namespace","NamespaceError");if(r===Xe&&o!=="xmlns"&&i!=="xmlns")throw k("The XMLNS namespace requires the xmlns name or prefix","NamespaceError");return{namespace:r,qualifiedName:o,prefix:i,localName:a}}function pn(t){throw k(`Invalid name: "${t}"`,"InvalidCharacterError")}var ht=0,gt=1,tr=2,hn=3,so=typeof performance>"u"?Date.now:performance.now.bind(performance),V=class{static NONE=ht;static CAPTURING_PHASE=gt;static AT_TARGET=tr;static BUBBLING_PHASE=hn;timeStamp=so();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,mn,{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[mn]}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 gn(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?tr:n,t.currentTarget=e;let i=s.normalizedListener;try{typeof i=="object"?i.handleEvent(t):i.call(e,t)}catch(a){setTimeout(io,0,a)}if(t[_e])break}}function io(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{nr(e)}catch{}throw r}return $e.pop(),nr(e),n}function nr(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=[],yn=!1;function we(t){for(let e of t)Et.push(e),e[1]&&Ke.push(e[1]);if(!yn){yn=!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,yn=!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=bn(o),c=this[Qe];c||(c=new Map,this[Qe]=c);let u=c.get(e);u||(u={},c.set(e,u));let m=u[a];if(m||(m=new Map,u[a]=m),m.has(n))return;let h=this,g={type:e,listener:n,capture:o,once:s,normalizedListener:n,signal:i};(s||i)&&(g.normalizedListener=function(...C){if(g.signal?.aborted){Nt(h,g);return}return g.once&&Nt(h,g),typeof g.listener=="object"?g.listener.handleEvent(...C):g.listener.call(this,...C)});let y=this[Ee];y||(y=new Map,this[Ee]=y);let O=y.get(e);O||(O={},y.set(e,O));let E=O[a];if(E||(E=new Set,O[a]=E),m.set(n,g),E.add(g),i){let N=()=>{Nt(h,g)};g.abortListener=N,i.addEventListener("abort",N,{once:!0})}this[I]?.defaultView[Ne].addEventListener?.(this,e,n,r)}removeEventListener(e,n,r){return ao.call(this,e,n,r)}dispatchEvent(e){if(e[Pe])throw k("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(gn(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(gn(e,o[s],hn),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 ao(t,e,n){if(e==null)return;let r=n===!0||n&&n.capture===!0,o=bn(!!r),s=this[Qe]?.get(t)?.[o]?.get(e);s&&Nt(this,s)}function bn(t){return t?"capture":"bubble"}function Nt(t,e){let n=bn(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 c=a[n];c?.delete(e)&&(c.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 Q=class extends Array{item(e){return this[e]??null}};var et=0,rr=1,Tn=2,wn=3,tt=4,or=0,sr=1,xt=2,vt=3,ir=4,Nn=5,ar=6,lr=7,Tt=/^(?:--|-?[A-Za-z_\\u0080-\\u{10FFFF}])[A-Za-z0-9_\\u0080-\\u{10FFFF}-]*$/u;function lo(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 k(`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&&xn(o,n,s=>(r=s,!1)),r}function Ot(t,e){let n=typeof e=="string"?nt(e):[{combinator:tt,matchers:e}],r=new Q,o=t[R];return o&&n[0].matchers.length&&xn(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,c;for(;c=s.exec(i);){c.index!==a&&W(t),c[1]&&(r.matchers.length===0&&!(n&&o.length===1)&&W(t),c[1]===">"?r.combinator=rr:c[1]==="+"?r.combinator=wn:c[1]==="~"?r.combinator=Tn:r.combinator=et,r={combinator:tt,matchers:[]},o.push(r));let u=c[8]?G(c[8]):c[2]||c[7];c[7]!=null&&!c[6]&&r.matchers.length>0&&W(t);let h,g=c[4]??c[5]??c[7];if(c[2]){Tt.test(u)||W(t);let y=c[5],O=y?.[0];if(c[3]==null&&(O===\'"\'||O==="\'")){let E=c[0].lastIndexOf(y);g=i.slice(c.index+E+1),s.lastIndex=i.length}else y!=null&&!Tt.test(y)&&W(t);h=ir}else c[6]?(Tt.test(u)||W(t),h=c[6]==="#"?xt:vt):c[8]?h=c[9]==null?Nn:ar:c[7]==="*"?h=or:c[7]&&Tt.test(c[7])?h=sr:W(t);c[9]?([g,s.lastIndex]=lo(i,s.lastIndex),u!=="has"&&u!=="not"&&W(t),u==="has"&&e&&W(t),nt(g,e||u==="has",u==="has")):h===Nn&&W(t),r.matchers.push({type:h,name:u,value:g}),a=s.lastIndex}return(a!==i.length||r.matchers.length===0)&&W(t),o}function co(t,e){let n=nt(e);return n[0]?.matchers.length?Je(t,n):!1}function uo(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:lr,name:":scope"};if(r.matchers.length===0?(o=r.combinator,r.matchers.push(s)):n.unshift({combinator:et,matchers:[s]}),n.some(({matchers:c})=>c.length===0))return!1;let i=o===wn||o===Tn?t[p]:t[R];if(!i)return!1;let a=!1;return xn(i,n,()=>(a=!0,!1),t),a}function xn(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[p];a&&o.push(a),s=i;continue}}s=s[p]??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===rr||r===et?Y:M,i=t[s];if(!i)return!1;if(r===et||r===Tn){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===wn&&!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 En(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 or:return o==="*";case sr:return t.namespaceURI===A?t.localName===G(o):t.localName===o;case xt:return En(t,"id")===o;case vt:let i=En(t,"class");return i?ft(i).includes(o):!1;case ir:let a=En(t,o);return s==null?a!=null:a===s;case lr:return t===n;case Nn:W(`:${o}`);case ar:switch(o){case"has":return uo(t,s||"");case"not":return!co(t,s||"");default:W(`:${o}(${s})`)}}return!1}function mo(t){return t.nodeType===Ce}function rt(t){return K in t}function Sn(t){return t.nodeType===Ie}function fo(t){return t.nodeType===Me}function j(t){return t.nodeType===X}function vn(t){return t.nodeType===fe}function mr(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 c of st(i)){if(o.has(c)||(o.add(c),e.push(c),a.push(c),!j(c)))continue;let u=c[ne];if(u)for(let h of u)o.has(h)||(o.add(h),e.push(h));let m=c[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 cr(t,e){let n=t.constructor,r=new n(t.name,t.value,t.namespaceURI);return r[I]=e,r}function ur(t,e){if(Sn(t))return e.createTextNode(t.data);if(fo(t))return e.createComment(t.data);if(mo(t))return cr(t,e);if(j(t)){let n=e[ke](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(cr(o,e))}return n}else{if(vn(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 k("Cannot clone a document node","NotSupportedError");let r=ur(t,n);if(!e||!j(t)&&!vn(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,c;if(i.cloningContent)if(i.contentSource&&i.contentDestination)a=i.contentSource.childNodes[i.childIndex++],c=i.contentDestination;else{s.pop(),i.appendTo&&i.appendTo.appendChild(i.destination);continue}else if(a=i.source.childNodes[i.childIndex++],c=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)&&dr(),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)&&dr(),o.add(a);let u=ur(a,n);j(a)||vn(a)?s.push({source:a,destination:u,appendTo:c,childIndex:0,cloningContent:!1}):c.appendChild(u)}return r}function dr(){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 kt(t,e){let n=String(e),r=G(n),o=[];for(let s of Ct(t))j(s)&&(n==="*"||(s.namespaceURI===A?s[v]===r:s[v]===n))&&o.push(s);return o}function Ct(t){let e=[],n=[],r=t[R];for(;r;){e.push(r);let o=r[R],s=r[p];o?(s&&n.push(s),r=o):r=s??n.pop()??null}return e}function st(t){let e=Ct(t);return e.unshift(t),e}var J=class extends pe{nodeType=Xn;[v]="";[Y]=null;[me]=null;[R]=null;[M]=null;[p]=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 po(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[p]}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[p];for(;e&&e.nodeType!==1;)e=e[p];return e}set nextElementSibling(e){}get firstChild(){return this[R]}set firstChild(e){}get lastChild(){let e=this[R];for(;e;){let n=e[p];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 Ct(this))Sn(n)&&(e+=n.data);return e}set textContent(e){if(rt(this))this.data=e;else if(mr(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 po(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 $n:case fe:return null;case Ce:e=e.ownerElement;break;default:e=e.parentElement}return null}var ee=Symbol("insertNode"),An=Symbol("preflightInsertions"),It=Symbol("replaceNode"),he=class extends J{remove(){let e=this.parentNode;e&&e.removeChild(this)}replaceWith(...e){let n=xe(e),r=this.parentNode;if(r)return On(o=>{ae(r,n);let s=this[p];for(;s&&n.includes(s);)s=s[p];let i=Rn(r,n,o);this.parentNode===r?r[It](i,this,o):r[ee](i,s,o)})}before(...e){let n=xe(e),r=this.parentNode;if(r)return On(o=>{ae(r,n);let s=this[M];for(;s&&n.includes(s);)s=s[M];let i=Rn(r,n,o);r[ee](i,s?s[p]:r.firstChild,o)})}after(...e){let n=xe(e),r=this.parentNode;if(r)return On(o=>{ae(r,n);let s=this[p];for(;s&&n.includes(s);)s=s[p];let i=Rn(r,n,o);r[ee](i,s,o)})}};function On(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 J?e:String(e))}function it(t,e){return e instanceof J?e:t.ownerDocument.createTextNode(String(e))}function ae(t,e){for(let n of e){if(!(n instanceof J))continue;let r=t;for(;r;){if(r===n)throw k("Cannot insert a node into itself or one of its descendants","HierarchyRequestError");r=r[Y]??r[me]}}}function Rn(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[An](r);for(let s of r)o[ee](s,null,n);return o}var Mt,_n=0,fr=0,pr=0,hr=0,De=!1,kn=!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=ho(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?_n++:Pn(i,-1),s.set(this,r),Pn(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),_n--,Pn(o,-1)),r?.size===0&&e.delete(n)}this.#e.clear(),this.#n.length=0,_n===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 te(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 Q,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 Q,target:t.target,type:t.type})}function Lt(...t){let e=new Q;return e.push(...t),e}function ho(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 Pn(t,e){t.attributes&&(fr+=e),t.characterData&&(pr+=e),t.childList&&(hr+=e),De=fr>0,kn=pr>0,at=hr>0}var re=class extends he{childNodes=new Q;children=new Q;appendChild(e){return B(()=>this[ee](e,null))}insertBefore(e,n){return B(()=>this[ee](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[ee](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[ee](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[ee](it(this,o),null)})}removeChild(e){return B(()=>(this.removeChildImmediately(e),e))}removeChildImmediately(e){if(e.parentNode!==this)throw k("The node is not a child of this node","NotFoundError");let n=this[U]?st(e):void 0,r=e[M],o=e[p],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 k("The reference node is not a child of this parent","NotFoundError");let o=n[M],s=n[p],i=this.prepareInsertion(e),a=this[U]?st(n):void 0,c=new Set(i.map(({node:g})=>g)),u=s;for(;u&&c.has(u);)u=u[p];let m=Gt(this,n);if(a){for(let y of a)y[U]=!1;let g=new Set(a);for(let y of i)g.has(y.node)&&(y.shouldDisconnect=!1)}this.commitInsertion(i,u);let h=this[U];return this.queueRemovalMutationRecord(this,n,o,s),this.queueInsertionMutationRecords(i),a&&this.enqueueTreeReactions(a,"disconnectedCallback"),this.enqueueInsertionReactions(i,h),this.performOrCollectHookEffects([...this.collectRemovalHookEffects(n,m),...this.collectInsertionHookEffects(i)],r),n}querySelectorAll(e){return Ot(this,e)}querySelector(e){return St(this,e)}[ee](e,n,r){return this.validateInsertion(e,n),this.insertIntoValidated(e,n,r),e}[An](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 k("The reference node is not a child of this parent","NotFoundError")}insertIntoValidated(e,n,r){e===n&&(n=e[p]);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[p]}else n.push(e);let r=this[U],o=this[I],s=[];for(let i of n){let a=i[U],c=a||r,u,m;if(i[I]===o)c&&(u=st(i));else{let h=Rt(i);m=h.nodes,c&&(u=h.treeNodes)}s.push({node:i,nodes:u,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],c=s.node[p];s.source={parent:i,index:Gt(i,s.node),previousSibling:a,nextSibling:c}}}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[p]=n,e[M]=s,s?s[p]=e:this[R]=e,n[M]=e}else{e[p]=null;let s=this[R];if(s){let i;for(;i=s[p];)s=i;s[p]=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[p];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[p]}}queueRemovalMutationRecord(e,n,r,o){at&&te({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),te({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){yr(e,n)}};function gr(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[p],a=Gt(t,e);if(o)for(let u of o)u[U]=!1;ot(n.nodes,r),at&&te({type:"childList",target:t,removedNodes:Lt(e),previousSibling:s,nextSibling:i}),o&&yr(o,"disconnectedCallback");let c=[];t.nodeType===X&&!Ze(t)&&c.push([()=>t[D].removeChild?.(t,e,a)]),we(c)}function Gt(t,e){let n=e[M],r=e[p];n?n[p]=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[p]=null,e[M]=null,o}function yr(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[p]}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[p]}return null}item(e){let n=this[R],r=0;for(;n;){if(r++===e)return n;n=n[p]}return null}get length(){let e=0,n=this[R];for(;n;)e++,n=n[p];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[p]=r[p]),this[R]===r&&(this[R]=r[p]);let s=r.value;return r[p]=null,r[q]=null,De&&te({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[p]}return null}setNamedItem(e){return B(()=>this.setNamedItemImmediately(e))}setNamedItemImmediately(e){let n=this[q],r=e[q];if(r!=null&&r!==n)throw k("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[p]=e:this[R]=e,e[p]=s[p],s[p]=null,o=s;break}i=s,s=s[p]}o==null&&(i?i[p]=e:this[R]=e),e[q]=n,e[I]=n[I],o&&(o[q]=null);let a=o==null||o.value!==e.value,c=o!=null&&o.name!==e.name;return a&&De&&te({type:"attributes",target:n,attributeName:e.name,attributeNamespace:e[S],oldValue:o?.value??null}),c&&n[D].removeAttribute?.(n,o.name,o[S]),(a||c)&&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[p]}};var ve=class extends J{nodeType=Ce;[S]=null;[p]=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&&te({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 go={amp:"&",AMP:"&",apos:"\'",gt:">",GT:">",lt:"<",LT:"<",quot:\'"\',QUOT:\'"\'},yo=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),bo=/(?:<([a-z][a-z0-9-:]*)((?:[\\s]+[^<>\'"=/\\s]+(?:=([\'"])[^]*?\\3|=[^>\'"\\s]*|))*)[\\s]*(\\/?)\\s*>|<\\/([a-z][a-z0-9-:]*)>|<!--(.*?)-->|([^<>]+))/gi,Nr=/\\s([^<>\'"=/\\n\\s]+)(?:=(["\'])([\\s\\S]*?)\\2|=([^>\'"\\n\\s]*)|)/g,Eo="|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|",No=/^(?:color|face|size)$/i;function br(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 go[n];let s=Number.parseInt(r??o,r?10:16);try{return String.fromCodePoint(s)}catch{return e}})}function Tr(t){return t.namespaceURI===A&&yo.has(t.localName)}function Er(t){let e=t.localName;return t[S]===Z&&(e==="foreignObject"||e==="desc"||e==="title")}function To(t,e){if(Eo.includes(`|${t}|`))return!0;if(t!=="font")return!1;for(let n of e.matchAll(Nr))if(No.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(bo)){let a=i[1];if(a){let c=i[2],u=G(a),m=o[o.length-1]?.element??e,h=m[S]===Z?Z:A;if(u==="svg")h=Z;else if(h===Z){if(Er(m))h=A;else if(To(u,c)){for(;o.length>0;){let O=o[o.length-1];if(O.element[S]!==Z||Er(O.element))break;o.pop(),s=O.target}h=A}}let g=h===A?u:a,y=n[ke](g,h,null,g);for(let O of c.matchAll(Nr))y.setAttribute(O[1],br(O[3]||O[4]||""));if(s.append(y),Tr(y)||h!==A&&i[4])continue;o.push({element:y,target:s}),s=h===A&&u==="template"?y.content:y}else if(i[5]){let c=G(i[5]);for(let u=o.length-1;u>=0;u--){let m=o[u],h=G(m.element[v]);if(h===c){s=m.target,o.length=u;break}if(m.element[S]===A&&h==="template")break}}else i[6]?s.append(n.createComment(i[6])):s.append(br(i[7]))}return r}function Vt(t){return xr([{type:"content",child:t[R]}])}function wr(t){return xr([{type:"opening",node:t}])}function xr(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[p]}if(e.push(">"),Tr(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[K].replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"));break}case Me:{let o=r;e.push(`<!--${o[K]}-->`);break}}break}case"content":{let r=n.child;r&&(t.push({type:"content",child:r[p]}),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?Zn(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 kt(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);fn(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"),c=this.attributes.getNamedItemNS(a.namespace,a.localName);c?c.value=i:this.attributes.setNamedItemNS(new ve(a.qualifiedName,i,a.namespace))}toggleAttribute(e,n){let r=String(e);fn(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 wr(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]=Z;get ownerSVGElement(){let e=null,n=this.parentNode;for(;n instanceof t;)e=n,n=n.parentNode;return e}};var ge=class extends he{[K]="";constructor(e){super(),this[K]=e==null?"":String(e)}setData(e){let n=kn,r=n?this[K]:null,o="";e!=null&&(o=typeof e=="string"?e:String(e)),this[K]=o,n&&r!==o&&te({type:"characterData",target:this,oldValue:r}),this[D].setText?.(this,o)}get data(){return this[K]}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 er(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)}[ke](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 kt(this,e)}importNode(e,n){if(e.nodeType===Te)throw k("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?gr(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===Z)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 wo=/^[a-z][^A-Z\\u0000\\t\\n\\f\\r />]*-[^A-Z\\u0000\\t\\n\\f\\r />]*$/u,xo=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function vr(t){return wo.test(t)&&!xo.has(t)}function Sr(t){return k(`Invalid custom element name: "${t}"`,"SyntaxError")}var Jt=class{registry=new Map;listenersByName=new Map;define(e,n,r){if(!vr(e))throw Sr(e);if(this.registry.has(e))throw k(`A custom element named "${e}" has already been defined`,"NotSupportedError");if(this.getName(n)!=null)throw k("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(!vr(e))return Promise.reject(Sr(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 vo=["onerror","onunhandledrejection"],Rr=Symbol.for("@remote-dom/polyfill/global-property");function Ar(t){return Object.getOwnPropertyDescriptors(t)}function _r(t){let e={};for(let[n,r]of Object.entries(Object.getOwnPropertyDescriptors(pe.prototype)))n!=="constructor"&&typeof r.value=="function"&&(r.value=In(r.value.bind(t)),e[n]=r);return e}function Pr(t){let e={};for(let n of vo)e[n]={configurable:!0,enumerable:!0,get:In(()=>t[n]),set:In(r=>{t[n]=r})};return e}function So(t){return Object.assign(Ar(t),_r(t),Pr(t))}function In(t){return Object.defineProperty(t,Rr,{value:!0}),t}function Or(t,e){for(let n of Reflect.ownKeys(e)){let r=Oo(t,n);(r==null||Ro(r))&&Object.defineProperty(t,n,e[n])}}function Oo(t,e){let n=t;for(;n;){let r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function Ro(t){return[t.value,t.get,t.set].some(e=>typeof e=="function"&&e[Rr]===!0)}var Se=class extends pe{[D]={};[mt]=[];[Ne]=_o(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=J;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)Ao(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=Ar(e),s=Object.assign(_r(e),Pr(e));delete o.self,Object.defineProperties(globalThis,o),Or(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),Or(n,s))}static setGlobalThis(e){for(let n in e)e[n]===e&&(e[n]=globalThis);Object.defineProperties(globalThis,So(e))}};function Ao(t,e){t[mt].push(e(t)??{})}function _o(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 Mn="~";var ye=new WeakMap;function Be(t){return ye.get(t)}var Hn=new WeakMap,ko=0;function $(t){let e=Hn.get(t);return e==null&&(e=String(ko++),tn(t,e)),e}function tn(t,e){Hn.set(t,e)}var Ln=new WeakMap;function Co(t){return Ln.get(t)}var Gn=new WeakMap;function Io(t){let e=Gn.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 Mo=new WeakMap;function Do(t){return Mo.get(t)}function Un(t,e,n){let r=Ln.get(t);if(r==null&&(r={},Ln.set(t,r)),r[e]===n)return;r[e]=n;let o=ye.get(t);o?.mutate([[3,$(t),e,n,1]])}function be(t,e,n){let r=Gn.get(t);if(r==null&&(r={},Gn.set(t,r)),r[e]===n)return;n==null?delete r[e]:r[e]=String(n);let o=ye.get(t);o?.mutate([[3,$(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:$(t),type:e,element:t.localName,properties:Dn(Co(t)),attributes:Dn(Io(t)),eventListeners:Dn(Do(t)),children:Array.from(t.childNodes).map(je)};case 3:case 8:return{id:$(t),type:e,data:t.data};default:throw new Error(`Cannot serialize node of type ${t.nodeType} (${typeof t.nodeType})`)}}function Dn(t){return t?{...t}:void 0}function Vn(t,e,...n){let r=Hn.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,$(t),je(e),n]]))};Fe.removeChild=(t,e,n)=>{let r=Be(t);r!=null&&(nn(e),r.mutate([[1,$(t),n]]))};Fe.setText=(t,e)=>{let n=Be(t);n?.mutate([[2,$(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 Cr=["wheel","drag","pinch"];function Ir(t){let e=t;return typeof t=="object"&&t!==null&&e.graview==="host-hello"&&typeof e.nonce=="string"}function Dr(t,e={}){let n,r="",o,s=0,i=new Set,a=new Map,c=[],u=E=>{n?n.postMessage({...E,nonce:r}):c.push(E)},m=E=>{let N=E.data;if(!(!N||typeof N!="object")){if(N.type==="props"){o=N.props;for(let C of i)C(N.props)}else N.type==="answer"?(a.get(N.id)?.(N),a.delete(N.id)):N.type==="event"&&typeof N.listener=="number"?e.onEvent?.(N):N.type==="heartbeat"&&typeof N.beat=="number"&&u({type:"heartbeat",beat:N.beat});e.onMessage?.(N)}},h=()=>{},g=E=>{if(n||!t.fromHost(E)||!Ir(E.data)||E.data.protocol!==1)return;let N=E.ports[0];if(N){n=N,r=E.data.nonce,n.onmessage=m,n.start?.(),h();for(let C of c.splice(0))u(C)}};h=t.listen(g),t.ready({graview:"guest-ready",protocol:1});let y,O={get props(){return o},subscribe(E){return i.add(E),()=>i.delete(E)},act(E,N={}){let C=s+=1;return new Promise(L=>{a.set(C,L),u({type:"act",id:C,name:E,args:N})})},navigate(E){let N=rn(E);N&&u(N)},size(E){u({type:"size",height:E})},autoSize(E){let N=E??globalThis.document?.documentElement,C=globalThis.ResizeObserver;if(!N||!C||typeof N.getBoundingClientRect!="function")return()=>{};y?.disconnect();let L=new C(()=>O.size(Math.ceil(N.getBoundingClientRect().height)));return L.observe(N),y=L,()=>L.disconnect()},close(){y?.disconnect(),h(),n?.close(),i.clear()}};return{guest:O,send:u}}var Gr=["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"],Hr=["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"],Ur=["self","postMessage","setTimeout","clearTimeout","setInterval","clearInterval","queueMicrotask","structuredClone","crypto","console","DOMException"],Vr=["TEMPORARY","PERSISTENT"],fl=Object.freeze([...Gr,...Hr,...Ur,...Vr]),pl=Object.freeze(["constructor","__defineGetter__","__defineSetter__","hasOwnProperty","__lookupGetter__","__lookupSetter__","isPrototypeOf","propertyIsEnumerable","toString","valueOf","__proto__","toLocaleString"]),Lr=t=>typeof t=="symbol"?`[${t.description??"symbol"}]`:t;function Br(t=globalThis,e=[],n={}){let r=[],o=[],s=new Set([...Gr,...Hr,...Ur,...e,"constructor",Symbol.toStringTag]),i=(x,P)=>{let F=Reflect.getOwnPropertyDescriptor(x,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:Vr.includes(P)&&typeof F.value=="number"},a=t,c=a.setTimeout,u=a.setInterval,m=a.crypto,h=(x,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 x.call(t,F,Ye,...dt)},g=m?Object.freeze({getRandomValues:x=>m.getRandomValues(x)}):void 0,y=a.document?.defaultView;if(y&&y!==a)for(let x of Reflect.ownKeys(y))typeof x=="symbol"||s.has(x)||Reflect.deleteProperty(y,x)||o.push(`window.${x}`);let O=[];for(let x=t;x&&x!==Object.prototype;x=Object.getPrototypeOf(x))O.push(x);for(let x of O)for(let P of Reflect.ownKeys(x))s.has(P)||(Reflect.deleteProperty(x,P)?r.push(Lr(P)):i(x,P)||o.push(Lr(P)));let E=()=>function(){throw new EvalError("A guest view cannot make code from text.")},N=[Function.prototype,Object.getPrototypeOf(async function(){}),Object.getPrototypeOf(function*(){}),Object.getPrototypeOf(async function*(){})];for(let x of N){let P=E();Object.defineProperty(P,"prototype",{value:x,writable:!1,enumerable:!1,configurable:!1}),Reflect.defineProperty(x,"constructor",{value:P,writable:!1,enumerable:!1,configurable:!1})||o.push("Function.prototype.constructor"),x===Function.prototype&&Reflect.defineProperty(t,"Function",{value:P,writable:!0,enumerable:!1,configurable:!0})}let C=(x,P)=>{Reflect.defineProperty(t,x,{value:P,writable:!0,enumerable:!0,configurable:!0})||o.push(x)};C("setTimeout",h(c,"setTimeout")),C("setInterval",h(u,"setInterval")),g&&C("crypto",g);for(let x of O.slice(1))Object.freeze(x);for(let x of Reflect.ownKeys(t)){let P=Reflect.getOwnPropertyDescriptor(t,x);Reflect.defineProperty(t,x,"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,Mn)}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,Mn,je(o),r])}e.mutate(n)}updateRemoteProperty(e,n){Un(this,e,n)}callRemoteMethod(e,...n){return Vn(this,e,...n)}};var d={},on={empty:!0},Lo={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"},Bn={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:{attributes:{href:"link"}},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},Go=["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"],Ho={id:"text",class:"text",style:"style",lang:"text",role:"text",tabindex:{oneOf:["-1","0"]},transform:"geometry",...Object.fromEntries(Go.map(t=>[t,"css"]))},qe={x:"geometry",y:"geometry",width:"geometry",height:"geometry"},sn={viewBox:"geometry",preserveAspectRatio:"geometry"},zr={gradientUnits:{oneOf:["userSpaceOnUse","objectBoundingBox"]},gradientTransform:"geometry",spreadMethod:{oneOf:["pad","reflect","repeat"]},href:"fragment"},jr={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",...zr}},radialGradient:{attributes:{cx:"geometry",cy:"geometry",r:"geometry",fx:"geometry",fy:"geometry",fr:"geometry",...zr}},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 Fr={section:["aria-label","aria-labelledby","title"]};function Uo(t){return/^aria-[a-z]+$/.test(t)}function Vo(t){return/^data-[a-z0-9][a-z0-9_.-]*$/.test(t)}var Bo=new Map(Object.keys(jr).map(t=>[t.toLowerCase(),t]));function qr(t){return Bo.get(t.toLowerCase())}function Yr(t,e,n){let r=n.toLowerCase(),o=t==="html"?[Bn[e]?.attributes,Lo]:[jr[e]?.attributes,Ho],s=t==="svg"&&r==="xlink:href"?"href":r;for(let i of o)if(i){for(let[a,c]of Object.entries(i))if(a.toLowerCase()===s)return{name:a,kind:c}}if(Uo(r)||Vo(r))return{name:r,kind:"text"}}var Wr="~",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 Xr(){let t=new Map,e=new Map,n=new Map([[Wr,{children:[],listeners:new Map}]]),r=0,o=u=>{let m=e.get(u);return m===void 0&&(m=r+=1,e.set(u,m),t.set(m,{listener:u,count:0})),t.get(m).count+=1,m},s=u=>{let m=t.get(u);m&&(m.count-=1,!(m.count>0)&&(t.delete(u),e.delete(m.listener)))},i=u=>{let m=n.get(u);if(m){n.delete(u);for(let h of m.listeners.values())s(h);for(let h of m.children)i(h)}},a=(u,m,h=0)=>{if(!an(u)||h>64)return oe(u);let g=typeof u.id=="string"?u.id:void 0,y=m&&g!==void 0&&g!==Wr;y&&i(g);let O={children:[],listeners:new Map};y&&n.set(g,O);let E={};for(let[N,C]of Object.entries(u))N==="children"&&Array.isArray(C)?E[N]=C.map(L=>{let x=a(L,y,h+1);return y&&an(L)&&typeof L.id=="string"&&O.children.push(L.id),x}):N==="eventListeners"&&an(C)?E[N]=Object.fromEntries(Object.entries(C).map(([L,x])=>{if(typeof x!="function"||!y)return[L,void 0];let P=o(x);return O.listeners.set(L,P),[L,{listener:P}]})):E[N]=oe(C,h+1);return E},c=u=>{if(!Array.isArray(u))return oe(u);let[m,h]=u,g=typeof h=="string"?n.get(h):void 0;if(m===0){let y=a(u[2],g!==void 0),O=an(u[2])?u[2].id:void 0;if(g&&typeof O=="string"&&n.has(O)){let E=Number(u[3]);g.children.splice(Number.isInteger(E)&&E>=0&&E<=g.children.length?E:g.children.length,0,O)}return[m,oe(h),y,oe(u[3])]}if(m===1){let y=Number(u[2]);return g&&Number.isInteger(y)&&y>=0&&y<g.children.length&&i(g.children.splice(y,1)[0]),oe(u)}if(m===3&&u[4]===3){let y=String(u[2]),O=u[3],E=g&&typeof O=="function"?o(O):void 0,N=g?.listeners.get(y);return N!==void 0&&s(N),E===void 0?g?.listeners.delete(y):g.listeners.set(y,E),[m,oe(h),y,E===void 0?void 0:{listener:E},3]}return oe(u)};return{encode:u=>u.map(c),listener:u=>t.get(u)?.listener,get listening(){return t.size},get nodes(){return n.size-1}}}var ln="graview-view-root",zo=["value","checked","key","pressed","files","refused","x","y","width","height","deltaX","deltaY","deltaMode","ctrlKey","metaKey","phase","pointerId","button","pressure","dx","dy","scale","rotation"],jo=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/\'/g,"&#39;"),Fo=t=>Object.freeze({html:t,toString:()=>t}),$r=t=>typeof t=="object"&&t!==null&&typeof t.html=="string"&&Object.isFrozen(t),Kr=t=>t==null||t===!1?"":Array.isArray(t)?t.map(Kr).join(""):$r(t)?t.html:jo(String(t));function Zr(t){customElements.get(ln)||customElements.define(ln,ut);let e=Event,n=Xr(),r=new Set,o=new Set,s,i=[],a=new Set;for(let l of["closest","matches","dataset"]){let f=()=>{throw new TypeError(`A view\'s element has no ${l}: graview.on hands event.element, the element its selector matched; read event.element.getAttribute("data-\\u2026").`)};l in Element.prototype||Object.defineProperty(Element.prototype,l,l==="dataset"?{get:f}:{value:f})}let c=document.createElement(ln),u=l=>{let f=b=>{for(let w of Array.from(b.childNodes)){if(w.nodeType!==1)continue;if($(w)===l)return w;let T=f(w);if(T)return T}};return f(c)},m=l=>{let f=u(l.target);if(!f)return;let b=new e(l.event,{bubbles:!0}),w={};for(let T of zo)l[T]!==void 0&&(w[T]=l[T]);for(let T of Object.keys(w))Object.defineProperty(b,T,{value:w[T],enumerable:!0});f.dispatchEvent(b);for(let T of o){if(T.type!==l.event)continue;let _;try{_=new Set(Array.from(c.querySelectorAll(T.selector)))}catch{continue}for(let z=f;z&&z!==c;z=z.parentNode)if(_.has(z)){T.listener(Object.freeze({type:l.event,target:f,element:z,...w}));break}}},h=l=>{if(l.type==="dom-event"&&typeof l.target=="string")return m(l);if(l.type==="notice")return t.warn(l.text);if(l.type!=="props")return;s=l.props;let f=t.now();for(let T of r)try{T(l.props)}catch(_){t.threw(_)}let b=t.now()-f,w=l.push;typeof w=="number"&&t.microtask(()=>t.microtask(()=>t.send({type:"pushed",push:w,ms:b})))},g;c.connect({mutate(l){g||(g=[],t.microtask(()=>{let f=g??[];g=void 0,t.send({type:"render",records:n.encode(f)})})),g.push(...l)},call:()=>{}});let y=l=>l.nodeType===1?l.getAttribute("data-key")??l.getAttribute("id"):null,O=(l,f)=>l.nodeType===f.nodeType&&(l.nodeType!==1||l.localName===f.localName&&l.namespaceURI===f.namespaceURI&&y(l)===y(f));function E(l,f){let b=Array.from(f.childNodes),w=0;for(let T of b){let _=l.childNodes[w]??null;if(_&&O(_,T)){N(_,T),w+=1;continue}if(y(T)!==null){let ce=Array.from(l.childNodes).slice(w+1).find(We=>O(We,T));if(ce){l.insertBefore(ce,_),N(ce,T),w+=1;continue}}l.insertBefore(T,_),w+=1}for(;l.childNodes.length>w;)l.removeChild(l.lastChild)}function N(l,f){if(l.nodeType!==1){l.data!==f.data&&(l.data=f.data);return}let b=l,w=f,T=C(b);for(let _ of b.getAttributeNames())w.hasAttribute(_)||(b.removeAttribute(_),T&&be(b,_,void 0));for(let _ of w.getAttributeNames()){let z=w.getAttribute(_);b.getAttribute(_)!==z&&b.setAttribute(_,z),T&&be(b,_,z)}E(b,w)}let C=l=>l.localName.includes("-");function L(l){for(let f of Array.from(l.childNodes)){if(f.nodeType!==1)continue;let b=f;if(C(b))for(let w of b.getAttributeNames())be(b,w,b.getAttribute(w)??void 0);L(b)}}function x(l,f,b){for(let w of Array.from(l.childNodes)){if(w.nodeType!==1)continue;let T=w,_=T.localName,z=f||_.toLowerCase()==="svg",ce=z?qr(_):Object.prototype.hasOwnProperty.call(Bn,_.toLowerCase())?_.toLowerCase():void 0;if(!ce){b.add(`<${_}>`);continue}for(let We of T.getAttributeNames())(!Yr(z?"svg":"html",ce,We)||!z&&Fr[ce]?.includes(We.toLowerCase()))&&b.add(`${ce} ${We}`);x(T,z,b)}}function P(l){let f=document.createElement("div"),b=Array.isArray(l)?l:[l];for(let T of b)if(T!=null)if(typeof T=="string"||$r(T)){let _=document.createElement("div");_.innerHTML=typeof T=="string"?T:T.html,f.append(...Array.from(_.childNodes))}else f.append(T);let w=new Set;x(f,!1,w),i=[...w],i.length>0&&t.warn(`The host will not draw: ${i.join(", ")}`),L(f),E(c,f)}let F=[],Ye=new Set(Cr),dt="[]",cn=!1,qn=()=>{cn||(cn=!0,t.microtask(()=>{cn=!1;let l=[...new Map([...o].filter(b=>Ye.has(b.type)).map(b=>[`${b.type} ${b.selector}`,{event:b.type,selector:b.selector}])).entries()].sort(([b],[w])=>b<w?-1:b>w?1:0).map(([,b])=>b),f=JSON.stringify(l);f!==dt&&(dt=f,t.send({type:"gestures",bound:l}))}))},Yn="[]",un=!1,Wn=()=>{un||(un=!0,t.microtask(()=>{un=!1;let l=[...new Set([...o].filter(b=>b.type==="click"&&typeof b.selector=="string").map(b=>b.selector))].sort().slice(0,200),f=JSON.stringify(l);f!==Yn&&(Yn=f,t.send({type:"clicks",selectors:l}))}))};return{view:Object.freeze({get props(){return s},onProps(l){return r.add(l),s&&l(s),()=>void r.delete(l)},render:P,style(l){typeof l!="string"||F.includes(l)||(F.push(l),t.send({type:"style",sheets:[...F]}))},on(l,f,b){let w={type:l,selector:f,listener:b};return o.add(w),typeof l=="string"&&!a.has(l)&&(a.add(l),t.send({type:"hears",events:[l]})),Ye.has(l)&&qn(),l==="click"&&Wn(),()=>{o.delete(w),Ye.has(l)&&qn(),l==="click"&&Wn()}},act:(l,f={})=>t.act(l,f),navigate(l){if(typeof l=="string")return t.navigate(l);let f=rn(l);f&&t.send(f)},html(l,...f){return Fo(l.reduce((b,w,T)=>b+w+(T<f.length?Kr(f[T]):""),""))},get refused(){return i},get hardening(){return t.hardening()}}),hear:h,find:l=>{try{let f=c.querySelectorAll(l)[0];return f?$(f):void 0}catch{return}},listened:l=>{let f=new Set;for(let b of o)if(b.type===l)try{for(let w of Array.from(c.querySelectorAll(b.selector))){let T=$(w);T&&f.add(T)}}catch{}return[...f]}}}var Fn={removed:[],stuck:[],sealed:!1,worker:!1},zn=Dr({listen(t){return Re.listen(t),()=>Re.unlisten(t)},fromHost:()=>!0,ready:t=>Re.post(t)},{onMessage:t=>Qr.hear(t)}),Qr=Zr({send:t=>zn.send(t),act:(t,e)=>zn.guest.act(t,e),navigate:t=>zn.guest.navigate(t),microtask:Re.microtask,now:Re.now,threw:t=>console.error(t),warn:t=>console.warn(t),hardening:()=>Fn}),qo=Qr.view;Object.defineProperty(globalThis,"graview",{value:qo,enumerable:!0,configurable:!0,writable:!1});var jn="WorkerGlobalScope"in globalThis?Br(globalThis,["graview"]):Fn;Fn=jn;if(jn.stuck.length>0)throw new Error(`The view\'s worker could not be hardened: ${jn.stuck.join(", ")} would not go.`);})();\n';export{e as VIEW_RUNTIME};
@@ -1 +1 @@
1
- import{a as y,b as h}from"./chunk.QII2C5OV.js";import"./chunk.PPRSGM64.js";import"./chunk.5Y3Q7ONN.js";import"./chunk.KTFUVR4V.js";import{Hc as b}from"./chunk.4TJOS4C7.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";var k=(d,i)=>({id:i.id,said:h(d,i),when:i.when,...i.alsoMine?{alsoMine:!0}:{}});async function A(d,i,t){let a=b(t.principal);if(a.id===void 0)return{ok:!1,error:"This seat acts for nobody the app knows by id, so there is nobody to tell. Nothing was kept."};let r=t.store.seenBy(a),p=async()=>(await t.subscriptions.list(a.id)).filter(n=>n.app===t.app);if(d==="list_subscriptions")return{ok:!0,data:{subscriptions:(await p()).map(n=>k(r,n))}};if(d==="unsubscribe"){let n=String(i.id??"");return(await p()).some(g=>g.id===n)?(await t.subscriptions.remove(n),{ok:!0,data:{removed:n}}):{ok:!1,error:`No subscription "${n}" of yours. list_subscriptions says which there are.`}}let o=String(i.on??""),c=n=>typeof i[n]=="string"&&i[n].trim()!==""?i[n].trim():void 0,e=c("record");if(e!==void 0&&!r.graph.getNode(e)){let n=t.store.resolveRef({name:"record",kinds:["*"]},e,a);if(!n.ok)return{ok:!1,error:`${n.message} Nothing was kept.`};e=n.id}let s=c("kind")??(e!==void 0&&o!=="act"?r.graph.getNode(e)?.kind:void 0),f=c("act"),m=c("condition"),u=o==="act"?{on:o,...f!==void 0?{act:f}:{},...e!==void 0?{record:e}:{}}:o==="created"&&s!==void 0?{on:o,kind:s}:o==="changed"?{on:o,...s!==void 0&&e===void 0?{kind:s}:{},...e!==void 0?{record:e}:{}}:o==="reaches"&&s!==void 0?{on:o,kind:s,condition:m??"",...e!==void 0?{record:e}:{}}:void 0;if(!u)return{ok:!1,error:'Say what to be told of: on is "act", "created", "changed" or "reaches", with a kind (or a record) for all but act. Nothing was kept.'};let l=y({schema:r.schema,allMutations:()=>t.store.allMutations(),graph:r.graph},u);if(l)return{ok:!1,error:`${l} Nothing was kept.`};let S=await t.subscriptions.add({who:a,app:t.app,when:u,...i.alsoMine===!0?{alsoMine:!0}:{}});return{ok:!0,data:{subscription:k(r,S)}}}export{A as runSubscriptionTool};
1
+ import{a as y,b as h}from"./chunk.UN2OB6OD.js";import"./chunk.LJXAZ5TF.js";import"./chunk.QFI4L2HK.js";import"./chunk.KFHXTHIY.js";import{Tc as b}from"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import"./chunk.AJZBJBMO.js";var k=(d,i)=>({id:i.id,said:h(d,i),when:i.when,...i.alsoMine?{alsoMine:!0}:{}});async function A(d,i,t){let a=b(t.principal);if(a.id===void 0)return{ok:!1,error:"This seat acts for nobody the app knows by id, so there is nobody to tell. Nothing was kept."};let r=t.store.seenBy(a),p=async()=>(await t.subscriptions.list(a.id)).filter(n=>n.app===t.app);if(d==="list_subscriptions")return{ok:!0,data:{subscriptions:(await p()).map(n=>k(r,n))}};if(d==="unsubscribe"){let n=String(i.id??"");return(await p()).some(g=>g.id===n)?(await t.subscriptions.remove(n),{ok:!0,data:{removed:n}}):{ok:!1,error:`No subscription "${n}" of yours. list_subscriptions says which there are.`}}let o=String(i.on??""),c=n=>typeof i[n]=="string"&&i[n].trim()!==""?i[n].trim():void 0,e=c("record");if(e!==void 0&&!r.graph.getNode(e)){let n=t.store.resolveRef({name:"record",kinds:["*"]},e,a);if(!n.ok)return{ok:!1,error:`${n.message} Nothing was kept.`};e=n.id}let s=c("kind")??(e!==void 0&&o!=="act"?r.graph.getNode(e)?.kind:void 0),f=c("act"),m=c("condition"),u=o==="act"?{on:o,...f!==void 0?{act:f}:{},...e!==void 0?{record:e}:{}}:o==="created"&&s!==void 0?{on:o,kind:s}:o==="changed"?{on:o,...s!==void 0&&e===void 0?{kind:s}:{},...e!==void 0?{record:e}:{}}:o==="reaches"&&s!==void 0?{on:o,kind:s,condition:m??"",...e!==void 0?{record:e}:{}}:void 0;if(!u)return{ok:!1,error:'Say what to be told of: on is "act", "created", "changed" or "reaches", with a kind (or a record) for all but act. Nothing was kept.'};let l=y({schema:r.schema,allMutations:()=>t.store.allMutations(),graph:r.graph},u);if(l)return{ok:!1,error:`${l} Nothing was kept.`};let S=await t.subscriptions.add({who:a,app:t.app,when:u,...i.alsoMine===!0?{alsoMine:!0}:{}});return{ok:!0,data:{subscription:k(r,S)}}}export{A as runSubscriptionTool};
@@ -1,4 +1,4 @@
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)}};function s(e){let t=[];return typeof e!="string"?["A view's source is text."]:(/\bimport\b/.test(e)&&t.push("It says import: a view loads nothing, so the word may not appear in it at all, even in a string or a comment."),/\bimportScripts\b/.test(e)&&t.push("It names importScripts: a view loads nothing."),/^\s*export\b/m.test(e)&&t.push("It exports something: a view is a plain script that draws through the graview global, not a module."),/\brequire\s*\(/.test(e)&&t.push("It calls require(): a view has no modules to require."),t)}var i,n=()=>i??=(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.Z4UM4CMT.js")).catch(e=>{throw i=void 0,e});async function p(e){let{VIEW_RUNTIME:t}=await n();return`${t}
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)}};function s(e){let t=[];return typeof e!="string"?["A view's source is text."]:(/\bimport\b/.test(e)&&t.push("It says import: a view loads nothing, so the word may not appear in it at all, even in a string or a comment."),/\bimportScripts\b/.test(e)&&t.push("It names importScripts: a view loads nothing."),/^\s*export\b/m.test(e)&&t.push("It exports something: a view is a plain script that draws through the graview global, not a module."),/\brequire\s*\(/.test(e)&&t.push("It calls require(): a view has no modules to require."),t)}var i,n=()=>i??=(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.KQSD5MLY.js")).catch(e=>{throw i=void 0,e});async function p(e){let{VIEW_RUNTIME:t}=await n();return`${t}
2
2
  ;(function () {
3
3
  "use strict";
4
4
  ${e}
@@ -1,6 +1,6 @@
1
- import{a as k}from"./chunk.G4JJXA63.js";import{a as Q}from"./chunk.NQZ73QV7.js";import{a as Y}from"./chunk.NX7IIZLO.js";import{a as X}from"./chunk.NFDLCUCC.js";import{c as _}from"./chunk.5Y3Q7ONN.js";import{fd as P,hd as z,id as G,jd as J,lb as H,mb as q}from"./chunk.4TJOS4C7.js";var O=e=>"failed"in e;function ue(e,n){let r=e.schema.kinds,t=e.policy?.sees;if(!t?.length||q(n))return{kinds:r};let s=H(n).roles??[],o=new Set(t.filter(i=>i.roles==="*"||s.some(a=>i.roles.includes(a))).flatMap(i=>i.kinds));return{kinds:r.filter(i=>o.has(i))}}function L(e,n){if(!n)return e;let r=new Set(n.kinds.filter(o=>e.tryDefinition(o)!==void 0));if(r.size===e.kinds.length)return e;let t=new Map,s=o=>{if(r.has(o)){if(!t.has(o)){let i=e.tryDefinition(o),a=Object.fromEntries(Object.entries(i?.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(o,{...i,edges:a})}return t.get(o)}};return{...e,definitions:e.definitions.filter(o=>r.has(o.kind)),kinds:e.kinds.filter(o=>r.has(o)),tryDefinition:s,definition:o=>{let i=s(o);if(!i)throw new Error(`Unknown node kind "${o}"`);return i}}}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 s=e.tryDefinition(t);if(!s)continue;let o=s.display?.labels??{},i=Object.entries(s.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:(o[d]??y(d)).toLowerCase()}}),a=Object.entries(s.edges??{}).map(([d,c])=>({name:d,from:t,to:c.to==="*"?e.kinds.filter(u=>u!==t):c.to,words:y(d)})),l=(s.plural??`${y(t)}s`).toLowerCase();n.push({kind:t,plural:l,noun:(s.noun??y(t)).toLowerCase(),fields:i,roles:s.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} `),v=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 s=new Set([t.plural,t.noun,`${t.noun}s`,y(t.kind),`${y(t.kind)}s`]),o=-1;for(let i of s){let a=e.indexOf(` ${i} `);a>=0&&(o<0||a<o)&&(o=a)}o>=0&&r.push({info:t,at:o})}return r.sort((t,s)=>t.at-s.at).map(t=>t.info)}function x(e,n,r){let t=n.trim().toLowerCase();if(t.length===0)return;let s=e.fields.filter(o=>!r||r(o));return s.find(o=>o.words===t||y(o.name)===t||o.name.toLowerCase()===t)??s.find(o=>o.words===v(t)||y(o.name)===v(t))??s.find(o=>t.split(" ").some(i=>i.length>2&&(o.words.split(" ").includes(i)||o.words.split(" ").includes(v(i)))))}function oe(e,n,r){let t=n.trim().toLowerCase();if(t.length!==0)return e.edges.find(s=>s.words===t||s.name.toLowerCase()===t)??e.edges.find(s=>s.to.some(o=>{let i=r.info(o);return i!==void 0&&(i.noun===v(t)||i.plural===t||y(o)===v(t))}))??e.edges.find(s=>t.split(" ").some(o=>o.length>2&&s.words.split(" ").includes(o)))}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(o=>o.type==="enum");if(n){let o=x(e,n);if(o&&o.type==="enum")return o;o&&h(`${e.plural}' ${o.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 s=r.find(o=>/^(status|stage|state|phase)$/.test(o.name));return s||(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},o=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(!o)return h(`no date field on ${e.plural}`);let i=t("end")??r.find(l=>l!==o&&/^(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:o,...i&&i!==o?{end:i}:{},...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 s=[];for(let i of e.kinds)for(let a of i.edges)for(let l of a.to){let d=e.info(l);if(!d||d.kind===i.kind)continue;let c=0;n.includes(i)&&(c+=4),n.includes(d)&&(c+=4),(Z.test(d.kind)||Z.test(d.noun))&&(c+=3),t&&(a.words.includes(t)||d.noun===v(t))&&(c+=5),a.words.split(" ").some(u=>u.length>2&&r.includes(` ${u}`))&&(c+=2),s.push({rows:i,across:d,link:a,score:c})}let o=s.sort((i,a)=>a.score-i.score)[0];return o||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,s){let o=U(t);switch(e){case"columns":{if(o){let i=x(n,o);if(!i||i.type!=="enum"){let a=oe(n,o,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,o).name}}case"calendar":{let i=ee(n,t),a=M(t);return{lens:"calendar",kind:n.kind,start:i.start.name,...i.end?{end:i.end.name}:{},...i.done?{done:i.done.name}:{},...a?{range:a}:{}}}case"timeline":{let i=ie(n);if(i&&!/\bdates?\b|\bdue\b|\bdeadlines?\b|\bmonths?\b|\byears?\b/.test(t))return{lens:"timeline",kind:n.kind,start:i.start.name,end:i.end.name,column:i.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 i=De(r,s,t,o);return{lens:"coverage",kind:i.rows.kind,across:i.across.kind,link:i.link.name}}case"board":{let i=$(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(i)||!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:i.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 i=$(n,n.roles.outline)??n.fields.find(a=>a.name==="outline");return i?{lens:"plan",kind:n.kind,outline:i.name}:h(`${n.plural} have no outline to draw a plan from`)}case"blocks":{let i={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]??(o&&!/ sort(?:ed)? by /.test(t)?o:void 0);if(a){let c=x(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`);i.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=x(n,l);if(!c)return h(`${n.plural} have nothing called ${l} to sort by`);i.sort={by:c.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}let d=V(n,t);return d.length>0&&(i.where=d),i}}}function V(e,n){let r=[],t=se(n);if(t){let s=e.fields.filter(A),o=$(e,e.roles.start),i=s.find(l=>E(n,l.words))??(A(o)?o:void 0)??s[0];(!i||!A(i))&&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(i.name,/\boverdue\b|\blate\b|\bpast due\b/.test(n)?a?.name:void 0),says:t.says(i)})}if(/\bonly\b|\bjust\b|\bthat are\b|\bwhich are\b/.test(n)){for(let s of e.fields){if(s.type!=="enum")continue;let o=s.options?.find(i=>E(n,i.toLowerCase())||E(n,y(i)));o&&r.push({expr:`${s.name} == '${o.replace(/'/g,"")}'`,says:`that are ${y(o)}`})}if(/\bnot done\b|\bundone\b|\bunfinished\b|\bopen ones\b|\bstill to do\b/.test(n)){let s=e.fields.find(o=>o.type==="boolean"&&/^(done|finished|complete|completed)$/.test(o.name));s&&r.push({expr:`not ${s.name}`,says:`not ${s.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=s=>s?$(r,s)?.words??y(s):"";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 s=e.range??"month";if(s==="agenda")return{title:`${k(r.plural)} in date order`,detail:`of ${r.plural} in order of ${t(e.start)}`};let o=s==="years"?"year":s;return{title:`${k(r.plural)} by ${o}`,detail:`of ${r.plural} by ${t(e.start)}, a ${o} 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 s=n.info(e.across);return{title:`${k(r.plural)} by ${s.noun}`,detail:`of which ${s.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 s=[e.where?.map(o=>o.says).join(" and "),e.group?`by ${t(e.group)}`:void 0,e.sort?`in order of ${t(e.sort.by)}`:void 0].filter(o=>!!o);return{title:[k(r.plural),...s].join(" "),detail:[`of ${r.plural}`,...s].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(o=>e.where.length>1?`(${o.expr})`:o.expr).join(" and ")}`:"",s={list:`all('${e.kind}')${t}`,as:e.as??"row"};return e.group&&(s.group=e.group),e.sort&&(s.sort=e.sort.direction?{by:e.sort.by,direction:e.sort.direction}:e.sort.by),s.empty="Nothing here yet.",{name:"blocks",...r,options:{blocks:[s]}}}}}function C(e,n){let{app:r}=n,t=o=>o.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,""),s=new Set(["home","overview",...Q(r,n.views?{views:n.views}:{}).map(o=>o.slug),...(r.lenses??[]).flatMap(o=>o.title?[t(o.title)]:[])]);if(!s.has(t(e)))return e;for(let o=2;;o++)if(!s.has(t(`${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=(i,a)=>{if(typeof i!="string"||i.trim()==="")return`its ${a} says nothing`;try{return _(i)}catch(l){return`its ${a} does not read: ${l instanceof Error?l.message.replace(/ \(at character.*$/,""):String(l)}`}},t=i=>{if(i.t==="where")return t(i.set);if(i.t==="call"&&i.fn==="all"){let a=i.args[0];return a?.t==="lit"&&typeof a.value=="string"?e.info(a.value)??null:void 0}},s=(i,a)=>{switch(i.t){case"lit":return;case"ident":return a&&!a.fields.some(l=>l.name===i.name)&&!a.edges.some(l=>l.name===i.name)?`${a.plural} have nothing called ${i.name}`:void 0;case"member":return s(i.object,a);case"list":return i.items.map(l=>s(l,a)).find(Boolean);case"unary":return s(i.operand,a);case"binary":return s(i.left,a)??s(i.right,a);case"where":{let l=t(i.set);return l===null?"Nothing by that name here":s(i.set,a)??s(i.filter,l??void 0)}case"call":return i.fn==="all"?t(i)===null?"Nothing by that name here":void 0:i.args.map(l=>s(l,a)).find(Boolean)}},o=(i,a)=>{if(a>4)return"its blocks nest deeper than a place draws";for(let l of i){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=s(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=o(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=o(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=s(f,void 0);if(m)return m}}}};return o(n,1)}function T(e,n,r){let t=L(e.schema,r),s=f=>({ok:!1,failed:`Couldn't draw that: ${f.replace(/\.$/,"")}.`});if(!G(n.name)||n.name==="reach")return s(`"${String(n.name)}" is not a picture the seat can draw; it draws ${z.filter(f=>f!=="reach").join(", ")}`);if(typeof n.title!="string"||n.title.trim().length===0||n.title.length>80)return s("it needs a title of a few words");if(typeof n.on!="string"||!t.tryDefinition(n.on))return s("Nothing by that name here");let o=P[n.name],i=n.bindings??{};if(o.binds==="fields")for(let[f,m]of Object.entries(i)){if(!t.tryDefinition(f))return s("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 s(`${y(f)} has no field "${String(D)}" for its ${S}`);for(let S of o.requiredRoles)if(!(S in(m??{})))return s(`a ${n.name} needs ${y(f)}'s ${S}`)}else if(o.binds==="entities")for(let f of o.requiredRoles){let m=i[f];if(!m)return s(`a ${n.name} needs its ${f}`);if(typeof m.kind=="string"&&!t.tryDefinition(m.kind))return s("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 s(u.message.replace(/^"[^"]*" /,"it "));let p=d.undrawn.find(f=>f.index===l);if(p)return s(p.why);let g=d.drawn.find(f=>f.index===l);if(!g)return s("its bindings name something the app does not have");if(g.as==="overview")return s(`"${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 s(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 ve(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,s=typeof n.on=="string"?n.on:w(t)&&P[r]?.binds==="fields"?Object.keys(t)[0]??"":"";return{name:r,title:typeof n.title=="string"?n.title.trim():"",on:s,...w(t)?{bindings:t}:{},...w(n.options)?{options:n.options}:{}}}function xe(e){let n=s=>w(e.bindings?.[s])?e.bindings[s]:{},r=s=>typeof s=="string"?s: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 s=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}:{},...s?{range:s}:{}}: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 s=w(e.bindings?.columns)?r(e.bindings.columns.kind):void 0,o=w(e.bindings?.link)?r(e.bindings.link.edge):void 0;return s&&o?{lens:"coverage",kind:e.on,across:s,link:o}:void 0}case"blocks":{let s=e.options?.blocks;if(!Array.isArray(s)||s.length!==1||!w(s[0]))return;let o=s[0],i=new RegExp(`^all\\('${e.on}'\\)(?: where (.+))?$`).exec(String(o.list??""));if(!i)return;let a=o.sort;return{lens:"blocks",kind:e.on,as:o.as==="card"?"card":"row",...typeof o.group=="string"?{group:o.group}:{},...typeof a=="string"?{sort:{by:a}}:w(a)&&typeof a.by=="string"?{sort:{by:a.by,...a.direction==="desc"?{direction:"desc"}:{}}}:{},...i[1]?{where:[{expr:i[1],says:"as asked"}]}:{}}}default:return}}function W(e,n,r,t,s){let o=I(L(e.schema,t)).info(n.on),i=xe(n);return{title:n.title,said:`${B[n.name]??"A picture"} of ${o?.plural??y(n.on)}.`,kind:n.on,lens:n,drawn:r,edit:K(n),by:s,asks:[],...i?{recipe:i}:{}}}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,s){let o=Re(e,n),i=e.title??s??C(o.title,r),a=Ae(e,i),l=T(r.app,a,r.sight);return l.ok?{title:i,said:`${B[e.lens]} ${o.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 s=e.lens==="blocks"&&!e.group&&!e.sort&&!e.where?.length&&e.title===void 0;return F(s?{...e,title:C(`Every ${t.noun}`,n)}:e,r,n,[])}function Le(e,n,r,t){if(r.length>0)return r;let s=i=>{switch(e){case"columns":return i.fields.some(a=>a.type==="enum");case"calendar":return i.fields.some(A);case"timeline":return ie(i)!==void 0||i.fields.some(A);case"coverage":return i.edges.some(a=>a.to.some(l=>l!==i.kind));case"board":return i.fields.some(a=>a.name==="x")&&i.fields.some(a=>a.name==="y");case"plan":return i.fields.some(a=>a.name==="outline")||i.roles.outline!==void 0;default:return!0}};return[...n.kinds.filter(s)].sort((i,a)=>Number(a.fields.some(l=>E(t,l.words)))-Number(i.fields.some(l=>E(t,l.words))))}function Ie(e,n){let r=I(L(n.app.schema,n.sight)),t=re(e),s=$e(t);if(s.length===0)return;let o=pe(t,r),i;for(let a of s){let l=a==="coverage"?[o[0]??r.kinds[0]].filter(d=>!!d):Le(a,r,o,t);for(let d of l)try{let c=ae(a,d,r,t,o),u=F(c,r,n,[e]);if(!O(u))return u;i??=u.failed}catch(c){if(!(c instanceof j))throw c;i??=`Couldn't draw that: ${c.message}.`}l.length===0&&o.length===0&&(i??=`Couldn't draw that: nothing here has what ${B[a].toLowerCase()} needs.`)}return{failed:i??"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 s=await le(e,n,void 0);return O(s)&&t?t:s}async function je(e,n,r){let t={lastGood:e},s={...r,lastGood:e},o=I(L(r.app.schema,r.sight)),i=re(n),a=o.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(i)??/ (?:call|name) it (.+?) $/.exec(i);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)},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(i);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,o,i,[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),o,s,l)}if(d){let g=Te(d,a,o,i);if(g)return F(g,o,s,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,s,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 s=/ (?: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(s){let d=x(n,s);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,s,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 ${s} to group by`)}let o=/ (?:sort(?:ed)?|order(?:ed)?) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1];if(o){let d=x(n,o);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 ${o} 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 i=se(t);if(i&&e.lens==="calendar"&&i.range)return{...R(e),range:i.range};if(i&&e.lens==="calendar"&&!i.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(o=>`${o.name} (${o.type??"value"}${o.options?`: ${o.options.join(" | ")}`:""})`).join(", "),t=n.edges.map(o=>`${o.name} \u2192 ${o.to.join(" | ")}`).join(", "),s=Object.entries(n.roles).map(([o,i])=>`${o}=${i}`).join(", ");return`- ${n.kind} ("${n.plural}"): ${r}${t?`; relations: ${t}`:""}${s?`; roles: ${s}`:""}`}).join(`
1
+ import{a as k}from"./chunk.G4JJXA63.js";import{a as Q}from"./chunk.5DZR46YG.js";import{a as Y}from"./chunk.Q7RI4SI4.js";import{a as X}from"./chunk.MQISKON2.js";import{c as _}from"./chunk.QFI4L2HK.js";import{nb as H,ob as q,pd as P,rd as z,sd as G,td as J}from"./chunk.BLS2G3CD.js";var O=e=>"failed"in e;function ue(e,n){let r=e.schema.kinds,t=e.policy?.sees;if(!t?.length||q(n))return{kinds:r};let s=H(n).roles??[],o=new Set(t.filter(i=>i.roles==="*"||s.some(a=>i.roles.includes(a))).flatMap(i=>i.kinds));return{kinds:r.filter(i=>o.has(i))}}function L(e,n){if(!n)return e;let r=new Set(n.kinds.filter(o=>e.tryDefinition(o)!==void 0));if(r.size===e.kinds.length)return e;let t=new Map,s=o=>{if(r.has(o)){if(!t.has(o)){let i=e.tryDefinition(o),a=Object.fromEntries(Object.entries(i?.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(o,{...i,edges:a})}return t.get(o)}};return{...e,definitions:e.definitions.filter(o=>r.has(o.kind)),kinds:e.kinds.filter(o=>r.has(o)),tryDefinition:s,definition:o=>{let i=s(o);if(!i)throw new Error(`Unknown node kind "${o}"`);return i}}}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 s=e.tryDefinition(t);if(!s)continue;let o=s.display?.labels??{},i=Object.entries(s.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:(o[d]??y(d)).toLowerCase()}}),a=Object.entries(s.edges??{}).map(([d,c])=>({name:d,from:t,to:c.to==="*"?e.kinds.filter(u=>u!==t):c.to,words:y(d)})),l=(s.plural??`${y(t)}s`).toLowerCase();n.push({kind:t,plural:l,noun:(s.noun??y(t)).toLowerCase(),fields:i,roles:s.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} `),v=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 s=new Set([t.plural,t.noun,`${t.noun}s`,y(t.kind),`${y(t.kind)}s`]),o=-1;for(let i of s){let a=e.indexOf(` ${i} `);a>=0&&(o<0||a<o)&&(o=a)}o>=0&&r.push({info:t,at:o})}return r.sort((t,s)=>t.at-s.at).map(t=>t.info)}function x(e,n,r){let t=n.trim().toLowerCase();if(t.length===0)return;let s=e.fields.filter(o=>!r||r(o));return s.find(o=>o.words===t||y(o.name)===t||o.name.toLowerCase()===t)??s.find(o=>o.words===v(t)||y(o.name)===v(t))??s.find(o=>t.split(" ").some(i=>i.length>2&&(o.words.split(" ").includes(i)||o.words.split(" ").includes(v(i)))))}function oe(e,n,r){let t=n.trim().toLowerCase();if(t.length!==0)return e.edges.find(s=>s.words===t||s.name.toLowerCase()===t)??e.edges.find(s=>s.to.some(o=>{let i=r.info(o);return i!==void 0&&(i.noun===v(t)||i.plural===t||y(o)===v(t))}))??e.edges.find(s=>t.split(" ").some(o=>o.length>2&&s.words.split(" ").includes(o)))}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(o=>o.type==="enum");if(n){let o=x(e,n);if(o&&o.type==="enum")return o;o&&h(`${e.plural}' ${o.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 s=r.find(o=>/^(status|stage|state|phase)$/.test(o.name));return s||(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},o=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(!o)return h(`no date field on ${e.plural}`);let i=t("end")??r.find(l=>l!==o&&/^(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:o,...i&&i!==o?{end:i}:{},...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 s=[];for(let i of e.kinds)for(let a of i.edges)for(let l of a.to){let d=e.info(l);if(!d||d.kind===i.kind)continue;let c=0;n.includes(i)&&(c+=4),n.includes(d)&&(c+=4),(Z.test(d.kind)||Z.test(d.noun))&&(c+=3),t&&(a.words.includes(t)||d.noun===v(t))&&(c+=5),a.words.split(" ").some(u=>u.length>2&&r.includes(` ${u}`))&&(c+=2),s.push({rows:i,across:d,link:a,score:c})}let o=s.sort((i,a)=>a.score-i.score)[0];return o||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,s){let o=U(t);switch(e){case"columns":{if(o){let i=x(n,o);if(!i||i.type!=="enum"){let a=oe(n,o,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,o).name}}case"calendar":{let i=ee(n,t),a=M(t);return{lens:"calendar",kind:n.kind,start:i.start.name,...i.end?{end:i.end.name}:{},...i.done?{done:i.done.name}:{},...a?{range:a}:{}}}case"timeline":{let i=ie(n);if(i&&!/\bdates?\b|\bdue\b|\bdeadlines?\b|\bmonths?\b|\byears?\b/.test(t))return{lens:"timeline",kind:n.kind,start:i.start.name,end:i.end.name,column:i.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 i=De(r,s,t,o);return{lens:"coverage",kind:i.rows.kind,across:i.across.kind,link:i.link.name}}case"board":{let i=$(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(i)||!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:i.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 i=$(n,n.roles.outline)??n.fields.find(a=>a.name==="outline");return i?{lens:"plan",kind:n.kind,outline:i.name}:h(`${n.plural} have no outline to draw a plan from`)}case"blocks":{let i={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]??(o&&!/ sort(?:ed)? by /.test(t)?o:void 0);if(a){let c=x(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`);i.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=x(n,l);if(!c)return h(`${n.plural} have nothing called ${l} to sort by`);i.sort={by:c.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}let d=V(n,t);return d.length>0&&(i.where=d),i}}}function V(e,n){let r=[],t=se(n);if(t){let s=e.fields.filter(A),o=$(e,e.roles.start),i=s.find(l=>E(n,l.words))??(A(o)?o:void 0)??s[0];(!i||!A(i))&&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(i.name,/\boverdue\b|\blate\b|\bpast due\b/.test(n)?a?.name:void 0),says:t.says(i)})}if(/\bonly\b|\bjust\b|\bthat are\b|\bwhich are\b/.test(n)){for(let s of e.fields){if(s.type!=="enum")continue;let o=s.options?.find(i=>E(n,i.toLowerCase())||E(n,y(i)));o&&r.push({expr:`${s.name} == '${o.replace(/'/g,"")}'`,says:`that are ${y(o)}`})}if(/\bnot done\b|\bundone\b|\bunfinished\b|\bopen ones\b|\bstill to do\b/.test(n)){let s=e.fields.find(o=>o.type==="boolean"&&/^(done|finished|complete|completed)$/.test(o.name));s&&r.push({expr:`not ${s.name}`,says:`not ${s.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=s=>s?$(r,s)?.words??y(s):"";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 s=e.range??"month";if(s==="agenda")return{title:`${k(r.plural)} in date order`,detail:`of ${r.plural} in order of ${t(e.start)}`};let o=s==="years"?"year":s;return{title:`${k(r.plural)} by ${o}`,detail:`of ${r.plural} by ${t(e.start)}, a ${o} 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 s=n.info(e.across);return{title:`${k(r.plural)} by ${s.noun}`,detail:`of which ${s.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 s=[e.where?.map(o=>o.says).join(" and "),e.group?`by ${t(e.group)}`:void 0,e.sort?`in order of ${t(e.sort.by)}`:void 0].filter(o=>!!o);return{title:[k(r.plural),...s].join(" "),detail:[`of ${r.plural}`,...s].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(o=>e.where.length>1?`(${o.expr})`:o.expr).join(" and ")}`:"",s={list:`all('${e.kind}')${t}`,as:e.as??"row"};return e.group&&(s.group=e.group),e.sort&&(s.sort=e.sort.direction?{by:e.sort.by,direction:e.sort.direction}:e.sort.by),s.empty="Nothing here yet.",{name:"blocks",...r,options:{blocks:[s]}}}}}function C(e,n){let{app:r}=n,t=o=>o.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,""),s=new Set(["home","overview",...Q(r,n.views?{views:n.views}:{}).map(o=>o.slug),...(r.lenses??[]).flatMap(o=>o.title?[t(o.title)]:[])]);if(!s.has(t(e)))return e;for(let o=2;;o++)if(!s.has(t(`${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=(i,a)=>{if(typeof i!="string"||i.trim()==="")return`its ${a} says nothing`;try{return _(i)}catch(l){return`its ${a} does not read: ${l instanceof Error?l.message.replace(/ \(at character.*$/,""):String(l)}`}},t=i=>{if(i.t==="where")return t(i.set);if(i.t==="call"&&i.fn==="all"){let a=i.args[0];return a?.t==="lit"&&typeof a.value=="string"?e.info(a.value)??null:void 0}},s=(i,a)=>{switch(i.t){case"lit":return;case"ident":return a&&!a.fields.some(l=>l.name===i.name)&&!a.edges.some(l=>l.name===i.name)?`${a.plural} have nothing called ${i.name}`:void 0;case"member":return s(i.object,a);case"list":return i.items.map(l=>s(l,a)).find(Boolean);case"unary":return s(i.operand,a);case"binary":return s(i.left,a)??s(i.right,a);case"where":{let l=t(i.set);return l===null?"Nothing by that name here":s(i.set,a)??s(i.filter,l??void 0)}case"call":return i.fn==="all"?t(i)===null?"Nothing by that name here":void 0:i.args.map(l=>s(l,a)).find(Boolean)}},o=(i,a)=>{if(a>4)return"its blocks nest deeper than a place draws";for(let l of i){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=s(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=o(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=o(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=s(f,void 0);if(m)return m}}}};return o(n,1)}function T(e,n,r){let t=L(e.schema,r),s=f=>({ok:!1,failed:`Couldn't draw that: ${f.replace(/\.$/,"")}.`});if(!G(n.name)||n.name==="reach")return s(`"${String(n.name)}" is not a picture the seat can draw; it draws ${z.filter(f=>f!=="reach").join(", ")}`);if(typeof n.title!="string"||n.title.trim().length===0||n.title.length>80)return s("it needs a title of a few words");if(typeof n.on!="string"||!t.tryDefinition(n.on))return s("Nothing by that name here");let o=P[n.name],i=n.bindings??{};if(o.binds==="fields")for(let[f,m]of Object.entries(i)){if(!t.tryDefinition(f))return s("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 s(`${y(f)} has no field "${String(D)}" for its ${S}`);for(let S of o.requiredRoles)if(!(S in(m??{})))return s(`a ${n.name} needs ${y(f)}'s ${S}`)}else if(o.binds==="entities")for(let f of o.requiredRoles){let m=i[f];if(!m)return s(`a ${n.name} needs its ${f}`);if(typeof m.kind=="string"&&!t.tryDefinition(m.kind))return s("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 s(u.message.replace(/^"[^"]*" /,"it "));let p=d.undrawn.find(f=>f.index===l);if(p)return s(p.why);let g=d.drawn.find(f=>f.index===l);if(!g)return s("its bindings name something the app does not have");if(g.as==="overview")return s(`"${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 s(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 ve(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,s=typeof n.on=="string"?n.on:w(t)&&P[r]?.binds==="fields"?Object.keys(t)[0]??"":"";return{name:r,title:typeof n.title=="string"?n.title.trim():"",on:s,...w(t)?{bindings:t}:{},...w(n.options)?{options:n.options}:{}}}function xe(e){let n=s=>w(e.bindings?.[s])?e.bindings[s]:{},r=s=>typeof s=="string"?s: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 s=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}:{},...s?{range:s}:{}}: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 s=w(e.bindings?.columns)?r(e.bindings.columns.kind):void 0,o=w(e.bindings?.link)?r(e.bindings.link.edge):void 0;return s&&o?{lens:"coverage",kind:e.on,across:s,link:o}:void 0}case"blocks":{let s=e.options?.blocks;if(!Array.isArray(s)||s.length!==1||!w(s[0]))return;let o=s[0],i=new RegExp(`^all\\('${e.on}'\\)(?: where (.+))?$`).exec(String(o.list??""));if(!i)return;let a=o.sort;return{lens:"blocks",kind:e.on,as:o.as==="card"?"card":"row",...typeof o.group=="string"?{group:o.group}:{},...typeof a=="string"?{sort:{by:a}}:w(a)&&typeof a.by=="string"?{sort:{by:a.by,...a.direction==="desc"?{direction:"desc"}:{}}}:{},...i[1]?{where:[{expr:i[1],says:"as asked"}]}:{}}}default:return}}function W(e,n,r,t,s){let o=I(L(e.schema,t)).info(n.on),i=xe(n);return{title:n.title,said:`${B[n.name]??"A picture"} of ${o?.plural??y(n.on)}.`,kind:n.on,lens:n,drawn:r,edit:K(n),by:s,asks:[],...i?{recipe:i}:{}}}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,s){let o=Re(e,n),i=e.title??s??C(o.title,r),a=Ae(e,i),l=T(r.app,a,r.sight);return l.ok?{title:i,said:`${B[e.lens]} ${o.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 s=e.lens==="blocks"&&!e.group&&!e.sort&&!e.where?.length&&e.title===void 0;return F(s?{...e,title:C(`Every ${t.noun}`,n)}:e,r,n,[])}function Le(e,n,r,t){if(r.length>0)return r;let s=i=>{switch(e){case"columns":return i.fields.some(a=>a.type==="enum");case"calendar":return i.fields.some(A);case"timeline":return ie(i)!==void 0||i.fields.some(A);case"coverage":return i.edges.some(a=>a.to.some(l=>l!==i.kind));case"board":return i.fields.some(a=>a.name==="x")&&i.fields.some(a=>a.name==="y");case"plan":return i.fields.some(a=>a.name==="outline")||i.roles.outline!==void 0;default:return!0}};return[...n.kinds.filter(s)].sort((i,a)=>Number(a.fields.some(l=>E(t,l.words)))-Number(i.fields.some(l=>E(t,l.words))))}function Ie(e,n){let r=I(L(n.app.schema,n.sight)),t=re(e),s=$e(t);if(s.length===0)return;let o=pe(t,r),i;for(let a of s){let l=a==="coverage"?[o[0]??r.kinds[0]].filter(d=>!!d):Le(a,r,o,t);for(let d of l)try{let c=ae(a,d,r,t,o),u=F(c,r,n,[e]);if(!O(u))return u;i??=u.failed}catch(c){if(!(c instanceof j))throw c;i??=`Couldn't draw that: ${c.message}.`}l.length===0&&o.length===0&&(i??=`Couldn't draw that: nothing here has what ${B[a].toLowerCase()} needs.`)}return{failed:i??"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 s=await le(e,n,void 0);return O(s)&&t?t:s}async function je(e,n,r){let t={lastGood:e},s={...r,lastGood:e},o=I(L(r.app.schema,r.sight)),i=re(n),a=o.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(i)??/ (?:call|name) it (.+?) $/.exec(i);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)},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(i);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,o,i,[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),o,s,l)}if(d){let g=Te(d,a,o,i);if(g)return F(g,o,s,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,s,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 s=/ (?: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(s){let d=x(n,s);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,s,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 ${s} to group by`)}let o=/ (?:sort(?:ed)?|order(?:ed)?) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1];if(o){let d=x(n,o);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 ${o} 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 i=se(t);if(i&&e.lens==="calendar"&&i.range)return{...R(e),range:i.range};if(i&&e.lens==="calendar"&&!i.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(o=>`${o.name} (${o.type??"value"}${o.options?`: ${o.options.join(" | ")}`:""})`).join(", "),t=n.edges.map(o=>`${o.name} \u2192 ${o.to.join(" | ")}`).join(", "),s=Object.entries(n.roles).map(([o,i])=>`${o}=${i}`).join(", ");return`- ${n.kind} ("${n.plural}"): ${r}${t?`; relations: ${t}`:""}${s?`; roles: ${s}`:""}`}).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)}
5
5
  Change it as asked, and keep everything not asked about.`:"",`Asked: ${JSON.stringify(e)}`,'Answer with ONE JSON object: {"title": "<a few words, like Deliverables by status>", "lens": \u2026, "on": \u2026, "bindings"?: \u2026, "options"?: \u2026}. Name only the kinds, fields and relations listed above. If it cannot be drawn from them, answer {"failed": "<one sentence saying why>"}.'].filter(t=>t!=="").join(`
6
- `)}async function le(e,n,r){let t=n.lastGood?{lastGood:n.lastGood}:{},s=I(L(n.app.schema,n.sight)),o;try{o=await n.complete(Ce(e,s,r))}catch{return{failed:"Couldn't draw that: the model did not answer.",...t}}let i=Y(o);if(typeof i!="object"||i===null||Array.isArray(i))return{failed:"Couldn't draw that: the model's answer was not a view.",...t};let a=i;if(typeof a.failed=="string")return{failed:`Couldn't draw that: ${a.failed.replace(/^Couldn't draw that:\s*/i,"").replace(/\.$/,"")}.`,...t};let l=de(a);if(!G(l.name))return{failed:`Couldn't draw that: "${l.name}" is not a picture the seat can draw.`,...t};let d=l.title?l.title.slice(0,80):r?.title??k(e.trim()).slice(0,80),c={...l,title:r&&r.title===d?d:C(d,n)},u=T(n.app,c,n.sight);return u.ok?{...W(n.app,c,u.drawn,n.sight,"model"),asks:[e]}:{failed:u.failed,...t}}function Qe(e,n,r){let t=[...e.lenses??[]];for(let s of n){let o={name:s.lens,title:s.title,on:s.on,...s.bindings?{bindings:s.bindings}:{},...s.options?{options:s.options}:{}};if(t.some(a=>a.title===o.title))continue;T({...e,lenses:t},o,r).ok&&(t=[...t,o])}return t.length===(e.lenses??[]).length?e:{...e,lenses:t}}async function Ze(e,n,r){let{app:t,drafts:s}=r,o=ue(t,r.principal),i=c=>{let u=de(c);return{lens:u,verdict:T(t,u,o)}};if(e==="keep_lens"){let{lens:c,verdict:u}=i(n);if(!u.ok)return{ok:!1,error:u.failed,reason:"invalid"};if(!s?.keep)return{ok:!1,error:"This app's declaration cannot be written from here."};let p=K(c),g=await s.keep(p);return g.ok?{ok:!0,data:{kept:p,said:g.said??`Adds \u201C${p.title}\u201D to the places.`,undo:ve(p)}}:{ok:!1,error:g.error}}if(n.lens!==void 0){let{lens:c,verdict:u}=i(n.lens);return u.ok?{ok:!0,data:te(W(t,c,u.drawn,o,"model"))}:{ok:!1,error:u.failed,reason:"invalid"}}let a={app:t,sight:o,...s?.complete?{complete:s.complete}:{},...s?.views?{views:s.views}:{}},l=String(n.ask??""),d;if(n.current!==void 0){let{lens:c,verdict:u}=i(n.current);if(!u.ok)return{ok:!1,error:u.failed,reason:"invalid"};d=await je(W(t,c,u.drawn,o,"model"),l,a)}else d=await Oe(l,a);return O(d)?{ok:!1,error:d.failed,reason:"invalid"}:{ok:!0,data:te(d)}}export{O as a,ue as b,T as c,K as d,ve as e,de as f,xe as g,W as h,te as i,Ye as j,Ie as k,Oe as l,je as m,Qe as n,Ze as o};
6
+ `)}async function le(e,n,r){let t=n.lastGood?{lastGood:n.lastGood}:{},s=I(L(n.app.schema,n.sight)),o;try{o=(await n.complete({prompt:Ce(e,s,r)})).text}catch{return{failed:"Couldn't draw that: the model did not answer.",...t}}let i=Y(o);if(typeof i!="object"||i===null||Array.isArray(i))return{failed:"Couldn't draw that: the model's answer was not a view.",...t};let a=i;if(typeof a.failed=="string")return{failed:`Couldn't draw that: ${a.failed.replace(/^Couldn't draw that:\s*/i,"").replace(/\.$/,"")}.`,...t};let l=de(a);if(!G(l.name))return{failed:`Couldn't draw that: "${l.name}" is not a picture the seat can draw.`,...t};let d=l.title?l.title.slice(0,80):r?.title??k(e.trim()).slice(0,80),c={...l,title:r&&r.title===d?d:C(d,n)},u=T(n.app,c,n.sight);return u.ok?{...W(n.app,c,u.drawn,n.sight,"model"),asks:[e]}:{failed:u.failed,...t}}function Qe(e,n,r){let t=[...e.lenses??[]];for(let s of n){let o={name:s.lens,title:s.title,on:s.on,...s.bindings?{bindings:s.bindings}:{},...s.options?{options:s.options}:{}};if(t.some(a=>a.title===o.title))continue;T({...e,lenses:t},o,r).ok&&(t=[...t,o])}return t.length===(e.lenses??[]).length?e:{...e,lenses:t}}async function Ze(e,n,r){let{app:t,drafts:s}=r,o=ue(t,r.principal),i=c=>{let u=de(c);return{lens:u,verdict:T(t,u,o)}};if(e==="keep_lens"){let{lens:c,verdict:u}=i(n);if(!u.ok)return{ok:!1,error:u.failed,reason:"invalid"};if(!s?.keep)return{ok:!1,error:"This app's declaration cannot be written from here."};let p=K(c),g=await s.keep(p);return g.ok?{ok:!0,data:{kept:p,said:g.said??`Adds \u201C${p.title}\u201D to the places.`,undo:ve(p)}}:{ok:!1,error:g.error}}if(n.lens!==void 0){let{lens:c,verdict:u}=i(n.lens);return u.ok?{ok:!0,data:te(W(t,c,u.drawn,o,"model"))}:{ok:!1,error:u.failed,reason:"invalid"}}let a={app:t,sight:o,...s?.complete?{complete:s.complete}:{},...s?.views?{views:s.views}:{}},l=String(n.ask??""),d;if(n.current!==void 0){let{lens:c,verdict:u}=i(n.current);if(!u.ok)return{ok:!1,error:u.failed,reason:"invalid"};d=await je(W(t,c,u.drawn,o,"model"),l,a)}else d=await Oe(l,a);return O(d)?{ok:!1,error:d.failed,reason:"invalid"}:{ok:!0,data:te(d)}}export{O as a,ue as b,T as c,K as d,ve as e,de as f,xe as g,W as h,te as i,Ye as j,Ie as k,Oe as l,je as m,Qe as n,Ze as o};
@@ -1,4 +1,4 @@
1
- import{a as z,b as Y,d as ee}from"./chunk.QQTRAY5W.js";import"./chunk.DOBQ4LO4.js";import{Sb as J,da as Q,ha as U,ma as X,qa as _}from"./chunk.4TJOS4C7.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";function ce(t){let r=t?.indexOf(":")??-1;if(!(!t||r<=0||r===t.length-1))return{relation:t.slice(0,r),record:t.slice(r+1)}}function ne(t,r){if(t.length===0)return!0;let d=`${r.split("/")[0]}/*`;return t.some(a=>a==="*"||a==="*/*"||a===r||a===d)}function re(t,r){let d=r.startsWith("image/")?"image":r.startsWith("video/")?"video":"file";return t.find(a=>a.as===d)??t.find(a=>a.as==="file")}function fe(t,r){let d=new Set(t.map(k=>k.as==="image"?"image/":k.as==="video"?"video/":""));if(d.has("")||r.kinds.length===0)return r.kinds.join(",");let a=[];for(let k of d){let m=r.kinds.filter(l=>l.startsWith(k));a.push(...m.length>0?m:[`${k}*`])}return a.join(",")}var T=t=>t.input?.shape??{},ie=(t,r)=>T(t)[r]?.safeParse(void 0).success===!1;function ae(t,r){let d=new Set(z(t.input).map(a=>a.name));return Object.keys(T(t)).filter(a=>!r.has(a)&&!d.has(a)&&ie(t,a)&&T(t)[a].safeParse("a name").success&&!T(t)[a].safeParse(1).success)}var ue=t=>t.replace(/\.[a-z0-9]{1,5}$/i,"")||t,se=(t,r)=>{let d=Number.isFinite(Date.parse(r))?new Date(Date.parse(r)).toISOString():r;return[r,d,d.replace(/\.\d{3}Z$/,"Z"),r.slice(0,10)].find(a=>t.safeParse(a).success)},pe="2026-01-01T00:00:00.000Z";function te(t,r){let d=T(t),a=new Set(ae(t,r)),k=Object.keys(d).filter(l=>!r.has(l)&&!a.has(l)&&ie(t,l)),m=k.filter(l=>se(d[l],pe)!==void 0);return{timed:m,left:k.filter(l=>!m.includes(l))}}function oe(t,r,d,a,k){let m=e=>({ok:!1,says:e}),{kind:l}=a,R=(d.accepts??[]).filter(e=>e.kind===l&&(a.field===void 0||e.field===a.field));if(R.length===0)return m(a.field===void 0?`The view's accepts names no field of "${l}", so nothing dropped there can become one.`:`The view's accepts does not name ${l}'s "${a.field}".`);let A=k.files;if(!A||!(A.maxBytes>0))return m("This host takes no files.");let j=R.flatMap(e=>{let n=ee(t,e.kind,e.field);return n?[{field:e.field,...n}]:[]}),w=j.filter(e=>e.as==="file"||A.kinds.length===0||A.kinds.some(n=>n==="*"||n==="*/*"||n.startsWith(e.as==="image"?"image/":"video/")));if(w.length===0)return m(`This host takes none of what ${l}'s ${j.map(e=>`"${e.field}"`).join(" or ")} holds.`);let c=a.connect===void 0?void 0:ce(a.connect);if(a.connect!==void 0&&(!c||k.shown.has(a.connect)))return m(`data-drop-connect is "<relation>:<record id>", not "${a.connect}".`);if(c&&!k.shown.has(c.record))return m(`data-drop-connect names "${c.record}", which this view was not shown.`);let g=c?t.seenBy(r).graph.getNode(c.record):void 0;if(c&&!g)return m(`data-drop-connect names "${c.record}", which this seat does not see.`);let $=e=>Object.hasOwn(t.schema.tryDefinition(e)?.edges??{},c.relation),E=c?$(l):!1;if(c&&!E&&!$(g.kind))return m(`Neither a "${l}" nor a "${g.kind}" has the relation "${c.relation}".`);let H=t.allMutations(),F=e=>t.permits(e,r).ok,Z=e=>w.every(n=>Object.hasOwn(T(e),n.field)),V=H.filter(e=>(e.creates??[]).includes(l)&&Z(e)),x=X(t.schema.tryDefinition(l),l),O=U(t.schema,l).toLowerCase(),S=g?Q(t.schema.tryDefinition(g.kind),g):void 0,G=e=>`${e===1?`a ${x}`:`${e} ${O}`}${S?` to ${S}`:""}`,K=e=>`Add ${G(e)}`,L=e=>`Added ${G(e)}.`,B=`Drop to add ${O}${S?` to ${S}`:""}.`,N=(e,n,u,v)=>{let I=new Set(Object.keys(n)),D=_(u.at)??v??new Date().toISOString();for(let C of te(e,I).timed)n[C]=se(T(e)[C],D);for(let C of ae(e,I))n[C]=ue(u.name);return n},q=(e,...n)=>new Set([...w.map(u=>u.field),...n,...z(e.input).map(u=>u.name)]),P=(e,...n)=>te(e,q(e,...n)).left,i=(e,n)=>m(`"${e.title??e.name}" asks for ${n.map(u=>`"${u}"`).join(" and ")}, which no dropped file says, so nothing dropped here can become a ${x}.`),o=(e,n)=>e.list?[n]:n,f={ok:!0,kind:l,fields:w,accept:fe(w,A),...c?{connect:c}:{},intent:K,invite:B,added:L};if(!c){let e=V.find(n=>!n.subject&&F({name:n.name,args:{}}));return e?P(e).length>0?i(e,P(e)):{...f,calls:n=>[{name:e.name,args:N(e,{[n.field]:o(w.find(u=>u.field===n.field),n.value)},n.value,n.at)}]}:m(`This seat may not make a "${l}" here.`)}let s=V.find(e=>e.subject&&(e.subject.kinds==="*"||e.subject.kinds.includes(g.kind))&&(e.connects??[]).includes(c.relation)&&F({name:e.name,args:{[e.subject.arg]:c.record}}));if(s){let e=s.subject.arg;return P(s,e).length>0?i(s,P(s,e)):{...f,calls:n=>[{name:s.name,args:N(s,{[e]:c.record,[n.field]:o(w.find(u=>u.field===n.field),n.value)},n.value,n.at)}]}}let p=V.find(e=>!e.subject&&F({name:e.name,args:{}}));if(!p)return m(`This seat may not make a "${l}" here.`);if(P(p).length>0)return i(p,P(p));let y=E?l:g.kind,W=E?g.kind:l,M=H.find(e=>{if(!(e.connects??[]).includes(c.relation)||!e.subject)return!1;let n=e.subject.kinds;if(n!=="*"&&!n.includes(y))return!1;let u=z(e.input).find(v=>v.name!==e.subject.arg&&(v.kinds.includes("*")||v.kinds.includes(W)));return u?F({name:e.name,args:E?{[u.name]:c.record}:{[e.subject.arg]:c.record}}):!1});if(!M)return m(`This seat may not link a "${l}" to ${c.record} by "${c.relation}".`);let h=M.subject.arg,b=z(M.input).find(e=>e.name!==h&&(e.kinds.includes("*")||e.kinds.includes(W))).name;return{...f,calls:(e,n)=>[{name:p.name,args:N(p,{[e.field]:o(w.find(u=>u.field===e.field),e.value)},e.value,e.at)},{name:M.name,args:E?{[h]:J(n*2),[b]:c.record}:{[h]:c.record,[b]:J(n*2)}}]}}var de=t=>t.type.startsWith("image/"),me=t=>t.type.startsWith("video/"),ge=`
1
+ import{a as z,b as Y,d as ee}from"./chunk.JLPBXG4P.js";import"./chunk.U2M4SGUU.js";import{Zb as J,da as Q,ha as U,ma as X,qa as _}from"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import"./chunk.AJZBJBMO.js";function ce(t){let r=t?.indexOf(":")??-1;if(!(!t||r<=0||r===t.length-1))return{relation:t.slice(0,r),record:t.slice(r+1)}}function ne(t,r){if(t.length===0)return!0;let d=`${r.split("/")[0]}/*`;return t.some(a=>a==="*"||a==="*/*"||a===r||a===d)}function re(t,r){let d=r.startsWith("image/")?"image":r.startsWith("video/")?"video":"file";return t.find(a=>a.as===d)??t.find(a=>a.as==="file")}function fe(t,r){let d=new Set(t.map(k=>k.as==="image"?"image/":k.as==="video"?"video/":""));if(d.has("")||r.kinds.length===0)return r.kinds.join(",");let a=[];for(let k of d){let m=r.kinds.filter(l=>l.startsWith(k));a.push(...m.length>0?m:[`${k}*`])}return a.join(",")}var T=t=>t.input?.shape??{},ie=(t,r)=>T(t)[r]?.safeParse(void 0).success===!1;function ae(t,r){let d=new Set(z(t.input).map(a=>a.name));return Object.keys(T(t)).filter(a=>!r.has(a)&&!d.has(a)&&ie(t,a)&&T(t)[a].safeParse("a name").success&&!T(t)[a].safeParse(1).success)}var ue=t=>t.replace(/\.[a-z0-9]{1,5}$/i,"")||t,se=(t,r)=>{let d=Number.isFinite(Date.parse(r))?new Date(Date.parse(r)).toISOString():r;return[r,d,d.replace(/\.\d{3}Z$/,"Z"),r.slice(0,10)].find(a=>t.safeParse(a).success)},pe="2026-01-01T00:00:00.000Z";function te(t,r){let d=T(t),a=new Set(ae(t,r)),k=Object.keys(d).filter(l=>!r.has(l)&&!a.has(l)&&ie(t,l)),m=k.filter(l=>se(d[l],pe)!==void 0);return{timed:m,left:k.filter(l=>!m.includes(l))}}function oe(t,r,d,a,k){let m=e=>({ok:!1,says:e}),{kind:l}=a,R=(d.accepts??[]).filter(e=>e.kind===l&&(a.field===void 0||e.field===a.field));if(R.length===0)return m(a.field===void 0?`The view's accepts names no field of "${l}", so nothing dropped there can become one.`:`The view's accepts does not name ${l}'s "${a.field}".`);let A=k.files;if(!A||!(A.maxBytes>0))return m("This host takes no files.");let j=R.flatMap(e=>{let n=ee(t,e.kind,e.field);return n?[{field:e.field,...n}]:[]}),w=j.filter(e=>e.as==="file"||A.kinds.length===0||A.kinds.some(n=>n==="*"||n==="*/*"||n.startsWith(e.as==="image"?"image/":"video/")));if(w.length===0)return m(`This host takes none of what ${l}'s ${j.map(e=>`"${e.field}"`).join(" or ")} holds.`);let c=a.connect===void 0?void 0:ce(a.connect);if(a.connect!==void 0&&(!c||k.shown.has(a.connect)))return m(`data-drop-connect is "<relation>:<record id>", not "${a.connect}".`);if(c&&!k.shown.has(c.record))return m(`data-drop-connect names "${c.record}", which this view was not shown.`);let g=c?t.seenBy(r).graph.getNode(c.record):void 0;if(c&&!g)return m(`data-drop-connect names "${c.record}", which this seat does not see.`);let $=e=>Object.hasOwn(t.schema.tryDefinition(e)?.edges??{},c.relation),E=c?$(l):!1;if(c&&!E&&!$(g.kind))return m(`Neither a "${l}" nor a "${g.kind}" has the relation "${c.relation}".`);let H=t.allMutations(),F=e=>t.permits(e,r).ok,Z=e=>w.every(n=>Object.hasOwn(T(e),n.field)),V=H.filter(e=>(e.creates??[]).includes(l)&&Z(e)),x=X(t.schema.tryDefinition(l),l),O=U(t.schema,l).toLowerCase(),S=g?Q(t.schema.tryDefinition(g.kind),g):void 0,G=e=>`${e===1?`a ${x}`:`${e} ${O}`}${S?` to ${S}`:""}`,K=e=>`Add ${G(e)}`,L=e=>`Added ${G(e)}.`,B=`Drop to add ${O}${S?` to ${S}`:""}.`,N=(e,n,u,v)=>{let I=new Set(Object.keys(n)),D=_(u.at)??v??new Date().toISOString();for(let C of te(e,I).timed)n[C]=se(T(e)[C],D);for(let C of ae(e,I))n[C]=ue(u.name);return n},q=(e,...n)=>new Set([...w.map(u=>u.field),...n,...z(e.input).map(u=>u.name)]),P=(e,...n)=>te(e,q(e,...n)).left,i=(e,n)=>m(`"${e.title??e.name}" asks for ${n.map(u=>`"${u}"`).join(" and ")}, which no dropped file says, so nothing dropped here can become a ${x}.`),o=(e,n)=>e.list?[n]:n,f={ok:!0,kind:l,fields:w,accept:fe(w,A),...c?{connect:c}:{},intent:K,invite:B,added:L};if(!c){let e=V.find(n=>!n.subject&&F({name:n.name,args:{}}));return e?P(e).length>0?i(e,P(e)):{...f,calls:n=>[{name:e.name,args:N(e,{[n.field]:o(w.find(u=>u.field===n.field),n.value)},n.value,n.at)}]}:m(`This seat may not make a "${l}" here.`)}let s=V.find(e=>e.subject&&(e.subject.kinds==="*"||e.subject.kinds.includes(g.kind))&&(e.connects??[]).includes(c.relation)&&F({name:e.name,args:{[e.subject.arg]:c.record}}));if(s){let e=s.subject.arg;return P(s,e).length>0?i(s,P(s,e)):{...f,calls:n=>[{name:s.name,args:N(s,{[e]:c.record,[n.field]:o(w.find(u=>u.field===n.field),n.value)},n.value,n.at)}]}}let p=V.find(e=>!e.subject&&F({name:e.name,args:{}}));if(!p)return m(`This seat may not make a "${l}" here.`);if(P(p).length>0)return i(p,P(p));let y=E?l:g.kind,W=E?g.kind:l,M=H.find(e=>{if(!(e.connects??[]).includes(c.relation)||!e.subject)return!1;let n=e.subject.kinds;if(n!=="*"&&!n.includes(y))return!1;let u=z(e.input).find(v=>v.name!==e.subject.arg&&(v.kinds.includes("*")||v.kinds.includes(W)));return u?F({name:e.name,args:E?{[u.name]:c.record}:{[e.subject.arg]:c.record}}):!1});if(!M)return m(`This seat may not link a "${l}" to ${c.record} by "${c.relation}".`);let h=M.subject.arg,b=z(M.input).find(e=>e.name!==h&&(e.kinds.includes("*")||e.kinds.includes(W))).name;return{...f,calls:(e,n)=>[{name:p.name,args:N(p,{[e.field]:o(w.find(u=>u.field===e.field),e.value)},e.value,e.at)},{name:M.name,args:E?{[h]:J(n*2),[b]:c.record}:{[h]:c.record,[b]:J(n*2)}}]}}var de=t=>t.type.startsWith("image/"),me=t=>t.type.startsWith("video/"),ge=`
2
2
  [data-graview-drop-over] { outline: 2px dashed var(--graview-accent, Highlight) !important; outline-offset: 2px !important; background-color: color-mix(in srgb, var(--graview-accent, Highlight) 10%, transparent) !important; }
3
3
  [data-graview-drop-status], [data-graview-drop-refused] { margin: 4px 0 0; font: 0.8125rem/1.4 var(--graview-font-body, system-ui, sans-serif); color: var(--graview-ink-muted, GrayText); }
4
4
  [data-graview-drop-refused] { color: var(--graview-warn, var(--graview-ink, CanvasText)); }