graview 0.1.55 → 0.1.56

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 (180) hide show
  1. package/dist/preview/{chunk.YGZGMRDC.js → chunk.22MIRLL6.js} +1 -1
  2. package/dist/preview/chunk.2BLRCT3E.js +1 -0
  3. package/dist/preview/chunk.2DETYEJM.js +1 -0
  4. package/dist/preview/{chunk.5EOSEVZB.js → chunk.2E6EWVWR.js} +1 -1
  5. package/dist/preview/{chunk.JRRVLGEK.js → chunk.2HZGUVB2.js} +1 -1
  6. package/dist/preview/{chunk.G5XTASMO.js → chunk.2OX4YI46.js} +1 -1
  7. package/dist/preview/{chunk.4OMSQFIY.js → chunk.2YNZVNCA.js} +1 -1
  8. package/dist/preview/chunk.3V2WH6F7.js +1 -0
  9. package/dist/preview/chunk.3X3GLNWQ.js +1 -0
  10. package/dist/preview/{chunk.FTW3K3G6.js → chunk.45VIF2SX.js} +2 -2
  11. package/dist/preview/{chunk.QWICAV2C.js → chunk.4EUH6TLG.js} +2 -2
  12. package/dist/preview/{chunk.35O5H5L7.js → chunk.4EY6WPSM.js} +2 -2
  13. package/dist/preview/{chunk.7Y6NK5CT.js → chunk.4KMY24YC.js} +1 -1
  14. package/dist/preview/chunk.4YI6656P.js +1 -0
  15. package/dist/preview/{chunk.XSMXSNDR.js → chunk.5B4HNQGR.js} +1 -1
  16. package/dist/preview/{chunk.P4ZZSFOQ.js → chunk.5MS2TQFX.js} +1 -1
  17. package/dist/preview/chunk.5MSWUTDB.js +1 -0
  18. package/dist/preview/{chunk.ATXSLBE3.js → chunk.64IKLRUS.js} +1 -1
  19. package/dist/preview/{chunk.6NQQUIBX.js → chunk.65Q5MKDW.js} +1 -1
  20. package/dist/preview/{chunk.KVQZ5FR6.js → chunk.6HLKAUWF.js} +1 -1
  21. package/dist/preview/chunk.6Q6BW4QT.js +2 -0
  22. package/dist/preview/{chunk.XTP5DGPJ.js → chunk.7NP2I2UP.js} +1 -1
  23. package/dist/preview/{chunk.FUZWXKTN.js → chunk.7O6Z3BFR.js} +1 -1
  24. package/dist/preview/chunk.7RJGEU3Y.js +1 -0
  25. package/dist/preview/{chunk.T66UK7PQ.js → chunk.7U2JO7ET.js} +1 -1
  26. package/dist/preview/chunk.7Z2PRPYE.js +1 -0
  27. package/dist/preview/{chunk.DBCVZGCC.js → chunk.7Z4USR3Y.js} +1 -1
  28. package/dist/preview/chunk.AGTFYPXY.js +1 -0
  29. package/dist/preview/{chunk.QIAH7HHO.js → chunk.AIK3Z25Y.js} +1 -1
  30. package/dist/preview/{chunk.XUHY4XO2.js → chunk.AKVBU5K5.js} +1 -1
  31. package/dist/preview/chunk.AKW6NR3X.js +1 -0
  32. package/dist/preview/{chunk.ZPXAKRKG.js → chunk.AM2YRNOQ.js} +1 -1
  33. package/dist/preview/{chunk.YRFN4VDD.js → chunk.APXYWI3L.js} +1 -1
  34. package/dist/preview/{chunk.HXR7EEXR.js → chunk.AQCU6TPV.js} +1 -1
  35. package/dist/preview/{chunk.YYWANGIC.js → chunk.AZUTYY2S.js} +1 -1
  36. package/dist/preview/{chunk.PIHCXN5U.js → chunk.BNEOLRQG.js} +1 -1
  37. package/dist/preview/chunk.BT7RLFPO.js +1 -0
  38. package/dist/preview/{chunk.DB3HOKZD.js → chunk.C2VFDBSG.js} +1 -1
  39. package/dist/preview/{chunk.62LPYPP3.js → chunk.CGM7OER2.js} +1 -1
  40. package/dist/preview/{chunk.DNJM6WQO.js → chunk.CKV2QCH5.js} +1 -1
  41. package/dist/preview/{chunk.NDLQXQV2.js → chunk.CU2NQ5WF.js} +1 -1
  42. package/dist/preview/{chunk.SUGOENC4.js → chunk.D4LN33J2.js} +1 -1
  43. package/dist/preview/{chunk.OT6EWYK2.js → chunk.D6BMAGPR.js} +1 -1
  44. package/dist/preview/{chunk.27ZSRO3O.js → chunk.D6KF72MZ.js} +1 -1
  45. package/dist/preview/{chunk.2SWQI4HF.js → chunk.DH7M57SE.js} +1 -1
  46. package/dist/preview/chunk.DPPT6WAJ.js +2 -0
  47. package/dist/preview/{chunk.6UAUME5U.js → chunk.DTSTUC2W.js} +1 -1
  48. package/dist/preview/{chunk.AFK5HHLL.js → chunk.DWMAFMYZ.js} +1 -1
  49. package/dist/preview/chunk.DZYLH5IM.js +1 -0
  50. package/dist/preview/{chunk.WUFCRE7O.js → chunk.E33EJU3Q.js} +1 -1
  51. package/dist/preview/{chunk.TAQB64FZ.js → chunk.E4EN4X5F.js} +1 -1
  52. package/dist/preview/{chunk.TUBAFVV4.js → chunk.E4HSSGF7.js} +1 -1
  53. package/dist/preview/{chunk.OL2N5NUV.js → chunk.E5XNQTEU.js} +1 -1
  54. package/dist/preview/{chunk.PIQ52FCI.js → chunk.EC5IWN74.js} +2 -2
  55. package/dist/preview/chunk.FBR4HJ2Q.js +1 -0
  56. package/dist/preview/{chunk.2HANQ737.js → chunk.FCUDBMGC.js} +1 -1
  57. package/dist/preview/chunk.FOQENWF5.js +1 -0
  58. package/dist/preview/{chunk.FUS2FJS3.js → chunk.G3ORIU7C.js} +1 -1
  59. package/dist/preview/chunk.GNQW4JOG.js +18 -0
  60. package/dist/preview/chunk.GUP7LC5O.js +21 -0
  61. package/dist/preview/{chunk.LMXNHBGH.js → chunk.HFVMGTNL.js} +2 -2
  62. package/dist/preview/chunk.HVN2DVP3.js +1 -0
  63. package/dist/preview/{chunk.YOBRVKJT.js → chunk.I2C5LPB5.js} +1 -1
  64. package/dist/preview/{chunk.LQCH2NFE.js → chunk.IF4FCQPG.js} +1 -1
  65. package/dist/preview/{chunk.K5WPS4RR.js → chunk.ILSK2E3R.js} +1 -1
  66. package/dist/preview/{chunk.RPVJ5IXD.js → chunk.IRMO4FUC.js} +1 -1
  67. package/dist/preview/chunk.IT763BYH.js +1 -0
  68. package/dist/preview/{chunk.QBMIET7P.js → chunk.IUQOSPQX.js} +1 -1
  69. package/dist/preview/{chunk.SIABGHF2.js → chunk.J3YBEZKE.js} +1 -1
  70. package/dist/preview/{chunk.4BFJWNVM.js → chunk.JHFHIG4P.js} +1 -1
  71. package/dist/preview/chunk.JL4DGITZ.js +1 -0
  72. package/dist/preview/{chunk.EJXUOL2C.js → chunk.JQY2UKU6.js} +1 -1
  73. package/dist/preview/{chunk.IXHLP2CL.js → chunk.JZDKHWRL.js} +1 -1
  74. package/dist/preview/{chunk.AFEEXRN3.js → chunk.K2JE3PD7.js} +1 -1
  75. package/dist/preview/chunk.K4MO22RM.js +1 -0
  76. package/dist/preview/{chunk.5DPFAVCZ.js → chunk.K5YLQAFW.js} +1 -1
  77. package/dist/preview/{chunk.CM2ETM2A.js → chunk.KBL4Y4UN.js} +1 -1
  78. package/dist/preview/chunk.KMEKMCKG.js +3 -0
  79. package/dist/preview/{chunk.ZOW7AC7U.js → chunk.LKK7VQBA.js} +1 -1
  80. package/dist/preview/chunk.LLOZKUCA.js +1 -0
  81. package/dist/preview/{chunk.QJ42D5GM.js → chunk.LP3SHWJG.js} +1 -1
  82. package/dist/preview/chunk.LVOVPU64.js +1 -0
  83. package/dist/preview/chunk.MEJUAV3Y.js +1 -0
  84. package/dist/preview/{chunk.PCKX2FHR.js → chunk.MFDSWA2W.js} +1 -1
  85. package/dist/preview/{chunk.U5AX4DD5.js → chunk.MJMVGW6Z.js} +1 -1
  86. package/dist/preview/{chunk.7WEQHJ3N.js → chunk.MLRPCZVS.js} +1 -1
  87. package/dist/preview/{chunk.Y3BEKXYB.js → chunk.MORMTKVR.js} +1 -1
  88. package/dist/preview/{chunk.O752PM42.js → chunk.N3Q5CPVA.js} +1 -1
  89. package/dist/preview/{chunk.AVVNQKA7.js → chunk.N7EEPFYV.js} +1 -1
  90. package/dist/preview/{chunk.PM64C5PX.js → chunk.NBLMANHT.js} +1 -1
  91. package/dist/preview/{chunk.6ZJE5M2A.js → chunk.NFU4UM6F.js} +1 -1
  92. package/dist/preview/{chunk.WSMYFEGU.js → chunk.NPAWTPLQ.js} +1 -1
  93. package/dist/preview/{chunk.4TLWZVVG.js → chunk.NQ4VGKEC.js} +1 -1
  94. package/dist/preview/{chunk.TT6GKRBE.js → chunk.NUE5VG4G.js} +1 -1
  95. package/dist/preview/{chunk.MFCBAQS3.js → chunk.O6LDZWLR.js} +1 -1
  96. package/dist/preview/chunk.OBUKZQCZ.js +1 -0
  97. package/dist/preview/{chunk.RZQKCLTW.js → chunk.ONGZ3YQF.js} +1 -1
  98. package/dist/preview/chunk.OYGPNO7A.js +1 -0
  99. package/dist/preview/chunk.PJCVFYFU.js +1 -0
  100. package/dist/preview/{chunk.5MCXTY2P.js → chunk.PMPDLE56.js} +1 -1
  101. package/dist/preview/{chunk.HXHFWZ2U.js → chunk.PRV3KYT6.js} +2 -2
  102. package/dist/preview/chunk.Q7X2IVLH.js +1 -0
  103. package/dist/preview/chunk.QAIYYIZQ.js +1 -0
  104. package/dist/preview/{chunk.PSLCI3GO.js → chunk.QNNRSPIJ.js} +1 -1
  105. package/dist/preview/{chunk.5L4J2XAI.js → chunk.QSO5BP2H.js} +1 -1
  106. package/dist/preview/{chunk.LYVRXRIH.js → chunk.QW3QLE53.js} +1 -1
  107. package/dist/preview/{chunk.USJ4J3GL.js → chunk.QYFZ7AZS.js} +2 -2
  108. package/dist/preview/{chunk.BRCKXL7B.js → chunk.RDL6652E.js} +1 -1
  109. package/dist/preview/{chunk.INBHY3SA.js → chunk.RR2IFETZ.js} +1 -1
  110. package/dist/preview/{chunk.NXM73RZA.js → chunk.RXYE2DAJ.js} +1 -1
  111. package/dist/preview/chunk.SOTB6C5A.js +1 -0
  112. package/dist/preview/{chunk.KHJ2MCMS.js → chunk.SRC37GNP.js} +1 -1
  113. package/dist/preview/{chunk.PHLMQO7V.js → chunk.SVAQGVS4.js} +1 -1
  114. package/dist/preview/chunk.T2RME6XF.js +1 -0
  115. package/dist/preview/{chunk.ZAHVKXYQ.js → chunk.T6HG2XIP.js} +1 -1
  116. package/dist/preview/{chunk.354A4QCG.js → chunk.TAIYNHSW.js} +1 -1
  117. package/dist/preview/chunk.TAJ2R44N.js +1 -0
  118. package/dist/preview/{chunk.5MSNKSTE.js → chunk.TQCRFZ53.js} +1 -1
  119. package/dist/preview/{chunk.RNYLNBIB.js → chunk.TXWCTHMI.js} +1 -1
  120. package/dist/preview/chunk.UE5YS3GN.js +1 -0
  121. package/dist/preview/{chunk.MFOSEOF4.js → chunk.UQQAGT3R.js} +1 -1
  122. package/dist/preview/chunk.USB6B6L3.js +104 -0
  123. package/dist/preview/{chunk.EKP3HQAX.js → chunk.USQNSNIA.js} +1 -1
  124. package/dist/preview/{chunk.CPNE6HPQ.js → chunk.V3NPUAPB.js} +1 -1
  125. package/dist/preview/{chunk.ZXOD5GM3.js → chunk.VDD3RHLB.js} +1 -1
  126. package/dist/preview/{chunk.O7RMVGAB.js → chunk.VEOS25PQ.js} +1 -1
  127. package/dist/preview/chunk.VIQ6EF2O.js +1 -0
  128. package/dist/preview/{chunk.UE5GAP67.js → chunk.VLBY66PB.js} +2 -2
  129. package/dist/preview/{chunk.OS5EALHY.js → chunk.VSM72NVF.js} +1 -1
  130. package/dist/preview/{chunk.WVKXELAF.js → chunk.VYW7DSUW.js} +2 -2
  131. package/dist/preview/{chunk.2KH2LWZL.js → chunk.WMB2NNBD.js} +1 -1
  132. package/dist/preview/{chunk.5SANELJT.js → chunk.WPJVMVAL.js} +1 -1
  133. package/dist/preview/{chunk.TDV7JGIQ.js → chunk.XGCOWCA2.js} +1 -1
  134. package/dist/preview/chunk.XJFAUOJS.js +1 -0
  135. package/dist/preview/{chunk.EGSE6NNE.js → chunk.XY5EVI22.js} +1 -1
  136. package/dist/preview/chunk.YEJ4LNUP.js +5 -0
  137. package/dist/preview/{chunk.6JYNNPAI.js → chunk.YL5ZCRHQ.js} +1 -1
  138. package/dist/preview/{chunk.DH4AC7TC.js → chunk.YLMOGGEP.js} +1 -1
  139. package/dist/preview/{chunk.V5PAFSWP.js → chunk.ZFXHZZHW.js} +1 -1
  140. package/dist/preview/index.html +50 -50
  141. package/dist/preview/page.js +2 -2
  142. package/package.json +6 -6
  143. package/dist/preview/chunk.2ORJGMRT.js +0 -104
  144. package/dist/preview/chunk.3IZOXNJH.js +0 -1
  145. package/dist/preview/chunk.5D6SIBOK.js +0 -1
  146. package/dist/preview/chunk.5EZDXWOE.js +0 -1
  147. package/dist/preview/chunk.5XUVCM7X.js +0 -1
  148. package/dist/preview/chunk.6NGSR2ZQ.js +0 -1
  149. package/dist/preview/chunk.7KERB5CH.js +0 -1
  150. package/dist/preview/chunk.AVNOLMCV.js +0 -1
  151. package/dist/preview/chunk.AZ6Q3WT2.js +0 -1
  152. package/dist/preview/chunk.DKJK2MMV.js +0 -2
  153. package/dist/preview/chunk.DU75P3Y7.js +0 -1
  154. package/dist/preview/chunk.DXJFAAOI.js +0 -1
  155. package/dist/preview/chunk.FVOFTM5J.js +0 -1
  156. package/dist/preview/chunk.G2XDQPE4.js +0 -1
  157. package/dist/preview/chunk.H536YUAZ.js +0 -3
  158. package/dist/preview/chunk.HNJFBI7J.js +0 -1
  159. package/dist/preview/chunk.HUABTCQE.js +0 -1
  160. package/dist/preview/chunk.KIMIPHAI.js +0 -1
  161. package/dist/preview/chunk.KXNWZ33P.js +0 -1
  162. package/dist/preview/chunk.LEPKPNPA.js +0 -1
  163. package/dist/preview/chunk.LLXEWLIP.js +0 -1
  164. package/dist/preview/chunk.LWLI5PI4.js +0 -1
  165. package/dist/preview/chunk.MIQMPOWF.js +0 -2
  166. package/dist/preview/chunk.MNSKBGRM.js +0 -1
  167. package/dist/preview/chunk.MSM6E6JK.js +0 -1
  168. package/dist/preview/chunk.NS6KWKF5.js +0 -1
  169. package/dist/preview/chunk.OIMYSR2J.js +0 -1
  170. package/dist/preview/chunk.QQ3YWKWU.js +0 -1
  171. package/dist/preview/chunk.R3ZS4QO6.js +0 -18
  172. package/dist/preview/chunk.SG67ID6C.js +0 -1
  173. package/dist/preview/chunk.SYX7AEHU.js +0 -1
  174. package/dist/preview/chunk.TEE23CVQ.js +0 -1
  175. package/dist/preview/chunk.TZTRGNAA.js +0 -1
  176. package/dist/preview/chunk.UADL2LHO.js +0 -1
  177. package/dist/preview/chunk.URDCHVH3.js +0 -21
  178. package/dist/preview/chunk.WR63RQGU.js +0 -5
  179. package/dist/preview/chunk.XEHLSKHP.js +0 -1
  180. package/dist/preview/chunk.YG2WZO53.js +0 -1
@@ -1,2 +1,2 @@
1
- import{f as k,h,i as b,n as S,o as w,p as I}from"./chunk.35O5H5L7.js";import"./chunk.BJUUSIQY.js";import"./chunk.BRCKXL7B.js";import"./chunk.CPNE6HPQ.js";import"./chunk.EKP3HQAX.js";import"./chunk.XOZU4OFA.js";import"./chunk.QQ3YWKWU.js";import{a as A}from"./chunk.IXHLP2CL.js";import"./chunk.DXJFAAOI.js";import"./chunk.5EZDXWOE.js";import"./chunk.MIQMPOWF.js";import"./chunk.T66UK7PQ.js";import"./chunk.LMXNHBGH.js";import"./chunk.DBCVZGCC.js";import{G as M,T as f}from"./chunk.WSMYFEGU.js";import"./chunk.SDO3U72B.js";import"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import{b as d}from"./chunk.AJZBJBMO.js";var n=d(M(),1);var r=d(f(),1),C="several";function T({chosen:c,acts:p,onAct:N}){let t=A(),u=(0,n.useMemo)(()=>[...c].sort(),[c]),i=u.join(`
1
+ import{f as k,h,i as b,n as S,o as w,p as I}from"./chunk.4EY6WPSM.js";import"./chunk.BJUUSIQY.js";import"./chunk.RDL6652E.js";import"./chunk.V3NPUAPB.js";import"./chunk.USQNSNIA.js";import"./chunk.XOZU4OFA.js";import"./chunk.IT763BYH.js";import{a as A}from"./chunk.JZDKHWRL.js";import"./chunk.SOTB6C5A.js";import"./chunk.XJFAUOJS.js";import"./chunk.DPPT6WAJ.js";import"./chunk.7U2JO7ET.js";import"./chunk.HFVMGTNL.js";import"./chunk.7Z4USR3Y.js";import{G as M,T as f}from"./chunk.NPAWTPLQ.js";import"./chunk.SDO3U72B.js";import"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import{b as d}from"./chunk.AJZBJBMO.js";var n=d(M(),1);var r=d(f(),1),C="several";function T({chosen:c,acts:p,onAct:N}){let t=A(),u=(0,n.useMemo)(()=>[...c].sort(),[c]),i=u.join(`
2
2
  `),o=(0,n.useMemo)(()=>({on:"selection",ids:u}),[i]),l=(0,n.useMemo)(()=>p.filter(e=>e.open.length===0&&!e.more&&!e.destructive),[p]),g=(0,n.useMemo)(()=>new Map(l.map(e=>[h(e.id),e])),[l]),v=S(t,o,C),[y,x]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(v!==void 0)return;let e=!0;return w(t,o,{by:C,ask:()=>b(t.ai,{store:t.store,target:o,principal:t.principal,interaction:k(),places:t.places,selection:t.selection,...t.place?{place:t.place}:{},shared:l.map(a=>({id:a.id,label:a.label,mutation:a.mutation,args:a.args}))})}).then(a=>{e&&x({key:i,result:a})}),()=>{e=!1}},[i]);let s=v??(y?.key===i?y.result:void 0);if(s===void 0)return(0,r.jsx)("span",{role:"status",className:"graview-several-quiet","data-testid":"several-ai-thinking",style:{textDecoration:"none"},children:"AI: thinking\u2026"});let m=s.offers.filter(e=>e.type!=="act"||g.has(e.id));if(m.length===0)return null;let E=e=>{let a=g.get(e.id);if(a){t.desk.record({...s.interaction,outcome:"accepted",accepted:[e.id]}),N(a);return}I(t,s,e)};return(0,r.jsx)("div",{role:"group","aria-label":"Suggested by AI",className:"graview-several-acts","data-testid":"several-ai",children:m.map(e=>(0,r.jsxs)("button",{type:"button",className:"graview-several-act","data-testid":"several-ai-offer","data-ai-offer":e.id,"data-ai-offer-type":e.type,onClick:()=>E(e),children:[e.label,(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \xB7 suggested"})]},e.id))})}export{T as SeveralAi};
@@ -5,67 +5,67 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <title>Graview preview</title>
7
7
  <link rel="preload" href="/graview/document" as="fetch" crossorigin="anonymous">
8
- <link rel="modulepreload" href="/chunk.G5XTASMO.js">
9
- <link rel="modulepreload" href="/chunk.PCKX2FHR.js">
10
- <link rel="modulepreload" href="/chunk.YRFN4VDD.js">
11
- <link rel="modulepreload" href="/chunk.EGSE6NNE.js">
12
- <link rel="modulepreload" href="/chunk.SG67ID6C.js">
13
- <link rel="modulepreload" href="/chunk.H536YUAZ.js">
14
- <link rel="modulepreload" href="/chunk.LMXNHBGH.js">
15
- <link rel="modulepreload" href="/chunk.DBCVZGCC.js">
16
- <link rel="modulepreload" href="/chunk.WSMYFEGU.js">
8
+ <link rel="modulepreload" href="/chunk.2OX4YI46.js">
9
+ <link rel="modulepreload" href="/chunk.APXYWI3L.js">
10
+ <link rel="modulepreload" href="/chunk.XY5EVI22.js">
11
+ <link rel="modulepreload" href="/chunk.MFDSWA2W.js">
12
+ <link rel="modulepreload" href="/chunk.K4MO22RM.js">
13
+ <link rel="modulepreload" href="/chunk.KMEKMCKG.js">
14
+ <link rel="modulepreload" href="/chunk.HFVMGTNL.js">
15
+ <link rel="modulepreload" href="/chunk.7Z4USR3Y.js">
16
+ <link rel="modulepreload" href="/chunk.NPAWTPLQ.js">
17
17
  <link rel="modulepreload" href="/chunk.SDO3U72B.js">
18
- <link rel="modulepreload" href="/chunk.WR63RQGU.js">
18
+ <link rel="modulepreload" href="/chunk.YEJ4LNUP.js">
19
19
  <link rel="modulepreload" href="/chunk.FQLNBIQ5.js">
20
20
  <link rel="modulepreload" href="/chunk.AJZBJBMO.js">
21
- <link rel="modulepreload" href="/chunk.3IZOXNJH.js">
22
- <link rel="modulepreload" href="/chunk.R3ZS4QO6.js">
23
- <link rel="modulepreload" href="/chunk.2ORJGMRT.js">
24
- <link rel="modulepreload" href="/chunk.YYWANGIC.js">
25
- <link rel="modulepreload" href="/chunk.FTW3K3G6.js">
21
+ <link rel="modulepreload" href="/chunk.2BLRCT3E.js">
22
+ <link rel="modulepreload" href="/chunk.GNQW4JOG.js">
23
+ <link rel="modulepreload" href="/chunk.USB6B6L3.js">
24
+ <link rel="modulepreload" href="/chunk.AZUTYY2S.js">
25
+ <link rel="modulepreload" href="/chunk.45VIF2SX.js">
26
+ <link rel="modulepreload" href="/chunk.IUQOSPQX.js">
26
27
  <link rel="modulepreload" href="/chunk.UGFDSE37.js">
27
- <link rel="modulepreload" href="/chunk.QBMIET7P.js">
28
28
  <link rel="modulepreload" href="/chunk.PXQVXBNG.js">
29
- <link rel="modulepreload" href="/chunk.WVKXELAF.js">
30
- <link rel="modulepreload" href="/chunk.ZOW7AC7U.js">
31
- <link rel="modulepreload" href="/chunk.INBHY3SA.js">
32
- <link rel="modulepreload" href="/chunk.TDV7JGIQ.js">
33
- <link rel="modulepreload" href="/chunk.RZQKCLTW.js">
34
- <link rel="modulepreload" href="/chunk.Y3BEKXYB.js">
35
- <link rel="modulepreload" href="/chunk.NDLQXQV2.js">
36
- <link rel="modulepreload" href="/chunk.WUFCRE7O.js">
37
- <link rel="modulepreload" href="/chunk.XEHLSKHP.js">
38
- <link rel="modulepreload" href="/chunk.MSM6E6JK.js">
39
- <link rel="modulepreload" href="/chunk.YGZGMRDC.js">
40
- <link rel="modulepreload" href="/chunk.6ZJE5M2A.js">
41
- <link rel="modulepreload" href="/chunk.2SWQI4HF.js">
42
- <link rel="modulepreload" href="/chunk.QIAH7HHO.js">
43
- <link rel="modulepreload" href="/chunk.DNJM6WQO.js">
44
- <link rel="modulepreload" href="/chunk.LEPKPNPA.js">
45
- <link rel="modulepreload" href="/chunk.5D6SIBOK.js">
46
- <link rel="modulepreload" href="/chunk.UE5GAP67.js">
29
+ <link rel="modulepreload" href="/chunk.VYW7DSUW.js">
30
+ <link rel="modulepreload" href="/chunk.LKK7VQBA.js">
31
+ <link rel="modulepreload" href="/chunk.RR2IFETZ.js">
32
+ <link rel="modulepreload" href="/chunk.ONGZ3YQF.js">
33
+ <link rel="modulepreload" href="/chunk.XGCOWCA2.js">
34
+ <link rel="modulepreload" href="/chunk.MORMTKVR.js">
35
+ <link rel="modulepreload" href="/chunk.CU2NQ5WF.js">
36
+ <link rel="modulepreload" href="/chunk.E33EJU3Q.js">
37
+ <link rel="modulepreload" href="/chunk.PJCVFYFU.js">
38
+ <link rel="modulepreload" href="/chunk.7RJGEU3Y.js">
39
+ <link rel="modulepreload" href="/chunk.22MIRLL6.js">
40
+ <link rel="modulepreload" href="/chunk.NFU4UM6F.js">
41
+ <link rel="modulepreload" href="/chunk.DH7M57SE.js">
42
+ <link rel="modulepreload" href="/chunk.AIK3Z25Y.js">
43
+ <link rel="modulepreload" href="/chunk.CKV2QCH5.js">
44
+ <link rel="modulepreload" href="/chunk.BT7RLFPO.js">
45
+ <link rel="modulepreload" href="/chunk.TAJ2R44N.js">
46
+ <link rel="modulepreload" href="/chunk.VLBY66PB.js">
47
47
  <link rel="modulepreload" href="/chunk.BJUUSIQY.js">
48
- <link rel="modulepreload" href="/chunk.BRCKXL7B.js">
49
- <link rel="modulepreload" href="/chunk.CPNE6HPQ.js">
48
+ <link rel="modulepreload" href="/chunk.RDL6652E.js">
49
+ <link rel="modulepreload" href="/chunk.V3NPUAPB.js">
50
50
  <link rel="modulepreload" href="/chunk.XOZU4OFA.js">
51
- <link rel="modulepreload" href="/chunk.QQ3YWKWU.js">
51
+ <link rel="modulepreload" href="/chunk.IT763BYH.js">
52
52
  <link rel="modulepreload" href="/chunk.MB7LKKUD.js">
53
53
  <link rel="modulepreload" href="/chunk.WVUJXDXZ.js">
54
- <link rel="modulepreload" href="/chunk.HUABTCQE.js">
55
- <link rel="modulepreload" href="/chunk.DXJFAAOI.js">
56
- <link rel="modulepreload" href="/chunk.5MSNKSTE.js">
57
- <link rel="modulepreload" href="/chunk.KVQZ5FR6.js">
58
- <link rel="modulepreload" href="/chunk.2HANQ737.js">
54
+ <link rel="modulepreload" href="/chunk.T2RME6XF.js">
55
+ <link rel="modulepreload" href="/chunk.SOTB6C5A.js">
56
+ <link rel="modulepreload" href="/chunk.TQCRFZ53.js">
57
+ <link rel="modulepreload" href="/chunk.6HLKAUWF.js">
58
+ <link rel="modulepreload" href="/chunk.FCUDBMGC.js">
59
59
  <link rel="modulepreload" href="/chunk.GZHZLJBF.js">
60
- <link rel="modulepreload" href="/chunk.OL2N5NUV.js">
60
+ <link rel="modulepreload" href="/chunk.E5XNQTEU.js">
61
61
  <link rel="modulepreload" href="/chunk.OJGHDWI6.js">
62
- <link rel="modulepreload" href="/chunk.5DPFAVCZ.js">
63
- <link rel="modulepreload" href="/chunk.5EZDXWOE.js">
64
- <link rel="modulepreload" href="/chunk.MIQMPOWF.js">
65
- <link rel="modulepreload" href="/chunk.T66UK7PQ.js">
66
- <link rel="modulepreload" href="/chunk.KXNWZ33P.js">
67
- <link rel="modulepreload" href="/chunk.6JYNNPAI.js">
68
- <script>(()=>{const later=["/chunk.6NGSR2ZQ.js","/chunk.5SANELJT.js","/chunk.PIQ52FCI.js","/chunk.HJCQ6I3S.js","/chunk.FUZWXKTN.js","/chunk.YOBRVKJT.js","/chunk.DKJK2MMV.js","/chunk.ATXSLBE3.js","/chunk.6UAUME5U.js","/chunk.MFOSEOF4.js","/chunk.TZTRGNAA.js","/chunk.EJXUOL2C.js","/chunk.HXHFWZ2U.js","/chunk.LWLI5PI4.js","/chunk.XUHY4XO2.js","/chunk.DU75P3Y7.js","/chunk.MNSKBGRM.js"],first=[...document.querySelectorAll('link[rel="modulepreload"]')];let left=first.length;const go=()=>{for(const href of later){const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};if(left===0)return go();const one=()=>{if(--left===0)go()};for(const link of first){link.addEventListener("load",one,{once:true});link.addEventListener("error",one,{once:true})}})()</script>
62
+ <link rel="modulepreload" href="/chunk.K5YLQAFW.js">
63
+ <link rel="modulepreload" href="/chunk.XJFAUOJS.js">
64
+ <link rel="modulepreload" href="/chunk.DPPT6WAJ.js">
65
+ <link rel="modulepreload" href="/chunk.7U2JO7ET.js">
66
+ <link rel="modulepreload" href="/chunk.HVN2DVP3.js">
67
+ <link rel="modulepreload" href="/chunk.YL5ZCRHQ.js">
68
+ <script>(()=>{const later=["/chunk.3V2WH6F7.js","/chunk.WPJVMVAL.js","/chunk.EC5IWN74.js","/chunk.HJCQ6I3S.js","/chunk.7O6Z3BFR.js","/chunk.I2C5LPB5.js","/chunk.6Q6BW4QT.js","/chunk.64IKLRUS.js","/chunk.DTSTUC2W.js","/chunk.UQQAGT3R.js","/chunk.JL4DGITZ.js","/chunk.JQY2UKU6.js","/chunk.PRV3KYT6.js","/chunk.Q7X2IVLH.js","/chunk.AKVBU5K5.js","/chunk.LLOZKUCA.js","/chunk.2DETYEJM.js"],first=[...document.querySelectorAll('link[rel="modulepreload"]')];let left=first.length;const go=()=>{for(const href of later){const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};if(left===0)return go();const one=()=>{if(--left===0)go()};for(const link of first){link.addEventListener("load",one,{once:true});link.addEventListener("error",one,{once:true})}})()</script>
69
69
  <style>html,body{margin:0;height:100%}#graview-app{min-height:100dvh}</style>
70
70
  </head>
71
71
  <body>
@@ -1,2 +1,2 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as ro}from"./chunk.G5XTASMO.js";import{a as Bt,b as or,c as ar,d as ir,e as sr,f as $t,g as cr,h as Nt}from"./chunk.PCKX2FHR.js";import{a as Wt,b as lr,c as ur,d as fr,e as It,f as pr,g as mr,h as hr,i as yr,j as gr,k as wr,l as vr,m as br,n as Ue}from"./chunk.YRFN4VDD.js";import{b as dr}from"./chunk.EGSE6NNE.js";import{a as Rt,g as Ln}from"./chunk.SG67ID6C.js";import{k as it}from"./chunk.H536YUAZ.js";import{E as tr,I as nr,J as rr,h as Yn,k as Dt,l as Qn,n as Zn,r as Xn,w as Vt,z as er}from"./chunk.LMXNHBGH.js";import{c as no}from"./chunk.DBCVZGCC.js";import{Aa as qn,Ca as zn,Da as Gn,Fa as Un,G as Mt,Ga as Ht,Ka as Kn,La as Jn,Oa as dt,T as Dn,Z as Vn,a as Mn,b as st,c as ct,ga as Bn,ha as $n,j as Hn,m as Lt,va as Nn,wa as Wn,xa as In,ya as _n,za as jn}from"./chunk.WSMYFEGU.js";import{a as Te}from"./chunk.SDO3U72B.js";import{Bb as Sn,Ld as Re,Md as Fn,Nd as On,Sd as xt,Tc as kn,Td as Ft,Ud as Ot,Xd as Cn,Yd as Ct,cb as _e,dd as An,ec as Tt,ed as En,fc as Pn,jd as Rn,ld as Tn,md as xn,nb as ot,ob as bn,od as at}from"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import{b as De}from"./chunk.AJZBJBMO.js";function _t(e){if(Array.isArray(e))return e.map(_t);if(e&&typeof e=="object"){let n={};for(let o of Object.keys(e).sort()){let i=e[o];i!==void 0&&(n[o]=_t(i))}return n}return e}function jt(e){return JSON.stringify(_t(e))??"undefined"}async function lt(e,n={}){let o=e.compiled===void 0||!ao(e.compiled,e.document)?void 0:Ln(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:i}=await oo();return i(e.document,n)}var Sr,oo=()=>Sr??=(__graviewPreload(import.meta.url,["./chunk.SG67ID6C.js","./chunk.5MSNKSTE.js","./chunk.2HANQ737.js","./chunk.H536YUAZ.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.FVOFTM5J.js")).catch(e=>{throw Sr=void 0,e});function ao(e,n){let o=typeof e=="object"&&e!==null?e.document:void 0,i=n;if(typeof i=="string")try{i=JSON.parse(i)}catch{return!1}return o!==void 0&&jt(Rt(o).document)===jt(Rt(i).document)}var d=De(Mt(),1);var ft=De(Mt(),1),qt="data-graview-drawn",io=200,Pr=50,so=1e4,ut=()=>typeof performance<"u"?performance.now():Date.now();function co(e){let n=[...e.querySelectorAll("img")];for(let o of e.querySelectorAll("[data-worker-view]"))o.shadowRoot&&n.push(...o.shadowRoot.querySelectorAll("img"));return n}function lo(e,n){if(e.ownerDocument.fonts?.status==="loading"||Wn()>0||qn(n)>0||e.querySelector('[aria-busy="true"]')||co(e).some(i=>!i.complete&&i.loading!=="lazy"))return!1;for(let i of e.querySelectorAll("[data-worker-view-place]"))if(!i.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function kr(e){let n=e.querySelector("[data-embed-content]"),o=[...e.querySelectorAll("[data-worker-view]")].map(i=>`${i.offsetWidth}x${i.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${o.join(",")}`}function uo(e,n,o,i){e.removeAttribute(qt);let c=e.ownerDocument.defaultView;if(!c)return()=>{};let l=ut(),S=l,p=kr(e),w=!1,E,T=typeof MutationObserver>"u"?void 0:new MutationObserver(v=>{v.some(_=>!(_.target===e&&_.attributeName===qt))&&(S=ut())});T?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let P=()=>{w=!0,T?.disconnect(),E!==void 0&&clearTimeout(E)},k=v=>{let _=!1,de=()=>{_||(_=!0,v())};typeof c.requestAnimationFrame=="function"&&c.requestAnimationFrame(()=>setTimeout(de,0)),setTimeout(de,100)},F=()=>{if(w)return;let v=kr(e);v!==p&&(p=v,S=ut());let _=ut();if(lo(e,i)&&_-S>=io||_-l>=so){k(()=>{w||(P(),e.setAttribute(qt,n),Gn(),o())});return}E=setTimeout(F,Pr)};return E=setTimeout(F,Pr),P}function Ar(e,n,o,i,c){zn();let l=(0,ft.useRef)({place:o,onDrawn:i});l.current={place:o,onDrawn:i},(0,ft.useLayoutEffect)(()=>{c&&jn(c);let S=E=>uo(E,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),c);if(e.current)return S(e.current);let p,w=!1;return queueMicrotask(()=>{!w&&e.current&&(p=S(e.current))}),()=>{w=!0,p?.()}},[n,e,c])}var ve=De(Mt(),1),Ke,fo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.KY7QD22S.js","./chunk.LYVRXRIH.js","./chunk.ZPXAKRKG.js","./chunk.G2XDQPE4.js","./chunk.5XUVCM7X.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KIMIPHAI.js"))),Er=()=>fo().then(e=>void(Ke=e),()=>new Promise(e=>setTimeout(e,2e3)).then(Er)),zt=Nn(Er),Rr=e=>!!e&&Ke===void 0;function Gt({onReady:e,fetch:n}){return(0,ve.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var po=0;function Tr(e){let[n,o]=(0,ve.useState)(()=>Ke);(0,ve.useEffect)(()=>{if(!e||n)return;let l=!1;return zt().then(()=>{l||o(Ke)}),()=>{l=!0}},[e,n]);let i=(0,ve.useMemo)(()=>po+=1,[e]);return{over:(0,ve.useMemo)(()=>{let l=n??Ke;if(!e||!l)return;let{source:S,worker:p,...w}=e,E={...w,worker:p??{source:S},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:T=>l.registerWorkerView(T,E)}},[e,n]),n:i}}var Or=De(ro(),1),I=De(no(),1);var g=De(Dn(),1);function pt(e,n={}){let o=Ht(e);return{Face:o.part((c,l)=>(0,d.createElement)(c,l),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var Jt=e=>Promise.all([e,nr()]).then(([n])=>n),Cr=Te(()=>(__graviewPreload(import.meta.url,["./chunk.QBMIET7P.js","./chunk.ZOW7AC7U.js","./chunk.PIQ52FCI.js","./chunk.RZQKCLTW.js","./chunk.Y3BEKXYB.js","./chunk.XEHLSKHP.js","./chunk.MSM6E6JK.js","./chunk.HJCQ6I3S.js","./chunk.FUZWXKTN.js","./chunk.YOBRVKJT.js","./chunk.LWLI5PI4.js","./chunk.6ZJE5M2A.js","./chunk.XUHY4XO2.js","./chunk.DU75P3Y7.js","./chunk.2SWQI4HF.js","./chunk.DNJM6WQO.js","./chunk.5D6SIBOK.js","./chunk.ATXSLBE3.js","./chunk.6UAUME5U.js","./chunk.BRCKXL7B.js","./chunk.CPNE6HPQ.js","./chunk.YRFN4VDD.js","./chunk.EGSE6NNE.js","./chunk.MFOSEOF4.js","./chunk.GZHZLJBF.js","./chunk.OL2N5NUV.js","./chunk.OJGHDWI6.js","./chunk.5DPFAVCZ.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.USJ4J3GL.js"))),mo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.R3ZS4QO6.js","./chunk.2ORJGMRT.js","./chunk.YYWANGIC.js","./chunk.FTW3K3G6.js","./chunk.UGFDSE37.js","./chunk.QBMIET7P.js","./chunk.PXQVXBNG.js","./chunk.WVKXELAF.js","./chunk.ZOW7AC7U.js","./chunk.INBHY3SA.js","./chunk.TDV7JGIQ.js","./chunk.RZQKCLTW.js","./chunk.Y3BEKXYB.js","./chunk.NDLQXQV2.js","./chunk.WUFCRE7O.js","./chunk.XEHLSKHP.js","./chunk.MSM6E6JK.js","./chunk.YGZGMRDC.js","./chunk.6ZJE5M2A.js","./chunk.2SWQI4HF.js","./chunk.QIAH7HHO.js","./chunk.DNJM6WQO.js","./chunk.LEPKPNPA.js","./chunk.5D6SIBOK.js","./chunk.UE5GAP67.js","./chunk.BJUUSIQY.js","./chunk.BRCKXL7B.js","./chunk.CPNE6HPQ.js","./chunk.XOZU4OFA.js","./chunk.QQ3YWKWU.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.HUABTCQE.js","./chunk.DXJFAAOI.js","./chunk.5MSNKSTE.js","./chunk.KVQZ5FR6.js","./chunk.2HANQ737.js","./chunk.H536YUAZ.js","./chunk.GZHZLJBF.js","./chunk.OL2N5NUV.js","./chunk.OJGHDWI6.js","./chunk.5DPFAVCZ.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.3IZOXNJH.js"))),ho=Te(()=>(__graviewPreload(import.meta.url,["./chunk.R3ZS4QO6.js","./chunk.2ORJGMRT.js","./chunk.YYWANGIC.js","./chunk.FTW3K3G6.js","./chunk.UGFDSE37.js","./chunk.QBMIET7P.js","./chunk.PXQVXBNG.js","./chunk.WVKXELAF.js","./chunk.ZOW7AC7U.js","./chunk.INBHY3SA.js","./chunk.TDV7JGIQ.js","./chunk.RZQKCLTW.js","./chunk.Y3BEKXYB.js","./chunk.NDLQXQV2.js","./chunk.WUFCRE7O.js","./chunk.XEHLSKHP.js","./chunk.MSM6E6JK.js","./chunk.YGZGMRDC.js","./chunk.6ZJE5M2A.js","./chunk.2SWQI4HF.js","./chunk.QIAH7HHO.js","./chunk.DNJM6WQO.js","./chunk.LEPKPNPA.js","./chunk.5D6SIBOK.js","./chunk.UE5GAP67.js","./chunk.BJUUSIQY.js","./chunk.BRCKXL7B.js","./chunk.CPNE6HPQ.js","./chunk.XOZU4OFA.js","./chunk.QQ3YWKWU.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.HUABTCQE.js","./chunk.DXJFAAOI.js","./chunk.5MSNKSTE.js","./chunk.KVQZ5FR6.js","./chunk.2HANQ737.js","./chunk.H536YUAZ.js","./chunk.GZHZLJBF.js","./chunk.OL2N5NUV.js","./chunk.OJGHDWI6.js","./chunk.5DPFAVCZ.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.TEE23CVQ.js"))),Lr=pt(()=>Jt(Cr().then(e=>e.SceneFace)),{what:"This view"}),Mr=pt(()=>Cr().then(e=>e.SceneKeeping),{quiet:!0}),Hr=pt(()=>Jt(mo().then(e=>e.PagesContent)),{what:"This page"}),Dr=pt(()=>Jt(ho().then(e=>e.PictureFace)),{what:"This picture"}),yo=Lr.Face,go=Mr.Face,wo=Hr.Face,vo=Dr.Face;function Ve(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Vr));return Promise.all([...[...o].map(i=>i.fetch()),Zn()]).then(()=>{},()=>{})}var Vr=e=>e==="pages"?[Hr]:e==="picture"?[Dr]:[Lr,Mr],Br=e=>Vr(e).every(n=>n.here()),bo=150,Ut=0;function xr(e,n){if(Br(e))return n();let o=++Ut,i=()=>{o===Ut&&(Ut+=1,n())};Ve(e).then(i),setTimeout(i,bo)}var So=768;function Po(e,n){let o=n!==null&&n>=So;(0,d.useEffect)(()=>{if(!o||e==="picture")return;let i=e==="pages"?"scene":"pages";if(Br(i))return;let c=globalThis,l=()=>void Ve(i),S=()=>{},p=Un(()=>{if(c.requestIdleCallback&&c.cancelIdleCallback){let w=c.requestIdleCallback(l,{timeout:4e3});S=()=>c.cancelIdleCallback?.(w)}else{let w=setTimeout(l,1500);S=()=>clearTimeout(w)}});return()=>(p(),S())},[e,o])}function ko({asked:e,shown:n,onDrawn:o}){return(0,d.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function Ao({auto:e,scene:n}){return(0,g.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${It}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var Eo=Ht(Te(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,g.jsx)(e.StudioPlace,{...n}),{quiet:!0});function $r(e,n,o,i,c){return $t(e,sr(n?ct(n):c??Mn,i),o)}function Yt(e){return e&&ct(e).overview?"graview":"scene"}function Fr(e,n){if(n.homeView?.()===void 0)return!1;let o=e.pages?.first?.trim();return o===void 0||o===""||o==="/"||o.toLowerCase()==="home"}function Nr(e){let[,n]=(0,d.useState)(!1),o=(0,d.useCallback)(()=>n(!0),[]),i=(0,d.useRef)(!1);return e.at&&!mt?(0,g.jsx)(Gt,{onReady:o,fetch:Qt}):!i.current&&Rr(e.draftView)?(0,g.jsx)(Gt,{onReady:o,fetch:zt}):(i.current=!0,(0,g.jsx)(Ro,{...e}))}function Ro(e){let{app:n,stop:o,bar:i=!0,standing:c="Everything is in order",principal:l,heading:S=2}=e,{rootRef:p,scope:w,css:E,scheme:T,store:P,presence:k,brand:F,auto:v,height:_}=pr(e),de=Tr(e.draftView),D=ur(e,rr,de.over),[ie]=(0,d.useState)(_n),f=e.basePath===void 0?{}:{basePath:e.basePath},[V]=(0,d.useState)(Dt),j=e.notices??V,Z=h=>xt(h,f),x={...e.routing?{routing:e.routing}:{},...f},[me]=(0,d.useState)(()=>{let h=e.at?.face;if(h)return h;let Q=o===void 0&&Fr(n,D)?"pages":Yt(o),K=Bt({...x,face:Q});return e.face===void 0&&e.onOpening?.(K),K}),[B,R]=(0,d.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&or(x)&&Fr(n,D)),he=(0,d.useRef)(e.onFace);he.current=e.onFace,(0,d.useLayoutEffect)(()=>{B&&(he.current?.("pages"),R(!1))},[B]);let L=B?"pages":e.face??me,O=n.schema.kinds,C=e.routing==="address",H=(0,d.useMemo)(()=>e.at?mt.settleAt(e,P.seenBy(l??{kind:"human"}),D.places()):void 0,[]),X=(0,d.useMemo)(()=>$n(D,n.schema),[D,n.schema]),q=(0,d.useMemo)(()=>{let h=H?.stop??(C?ar(e.basePath):void 0)??o;return L==="scene"&&h===void 0&&X===void 0&&(e.path===void 0||Kt(e.path))?Nt(void 0):$r(L,h,O,D.places(),X)},[]),[ye]=(0,d.useState)(L);(0,d.useEffect)(()=>{ye!=="pages"&&Bn(D)},[ye,D]);let $=(0,d.useRef)(void 0),Fe=h=>h===void 0||Kt(h)?"/":h;$.current??={path:Fe(H?.path??(C?L==="pages"?(Ft(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==$.current.asked&&($.current={path:Fe(e.path),asked:e.path});let M=(0,d.useRef)(e.onNavigate);M.current=e.onNavigate;let ee=(0,d.useCallback)((h,Q)=>{$.current.path=h,M.current?.(h,Q)},[]),{at:te,setAt:N,steering:Se,steer:J}=wr($.current.path),z=(0,d.useContext)(Wr);z&&(z.pages=()=>$.current.path);let G=(0,d.useRef)(void 0),le=(0,d.useCallback)(h=>void($.current.path=h),[]),ne=Yn(p),[Oe,Pe]=(0,d.useState)(!1),se=e.pagesBelow!==void 0&&ne!==null&&ne<e.pagesBelow&&(L==="scene"||L==="graview")&&!Oe,A=se?"pages":L,Ce=(0,d.useRef)(!1);Ce.current=Oe&&e.pagesBelow!==void 0&&ne!==null&&ne<e.pagesBelow&&(L==="scene"||L==="graview"),z&&(z.shown=A);let Le=(0,d.useRef)(L==="graview"?"graview":"scene");(A==="scene"||A==="graview")&&(Le.current=A),(0,d.useState)(()=>{if(!C||typeof window>"u"||A==="pages"||A==="picture")return;let{pathname:h,search:Q,hash:K}=window.location;Ft(h,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${Z(Re)}${Q}${K}`)}),fr(p,A,e.onIntrinsicHeight),Po(A,ne);let re=vr(e.onError,A),Me=br(e.onReady,A),ke=(0,d.useRef)(e.onFaceDrawn);ke.current=e.onFaceDrawn;let Ye=(0,d.useCallback)((h,Q)=>{Me(Q),ke.current?.(h)},[Me]),[Be,wt]=(0,d.useState)(null),Qe=D.places(),$e=(0,d.useRef)({shown:A,onFace:e.onFace});$e.current={shown:A,onFace:e.onFace};let W=(0,d.useCallback)((h,Q,K)=>{if(C){G.current?.(h,Q,K);return}$e.current.onFace?.(h),M.current?.(h==="pages"?Q??$.current.path:Re,"push")},[C]),[ge,U]=(0,d.useState)(void 0);(0,d.useEffect)(()=>{A==="pages"&&U(void 0)},[A]);let Ne=(0,d.useRef)(o);(0,d.useEffect)(()=>{Ne.current!==o&&(Ne.current=o,U(void 0))},[o]);let Ae=(0,d.useCallback)(h=>{if($e.current.shown==="pages"){if(Pe(!0),U(h),L==="scene"||L==="graview"){xr(L,()=>{C?window.history.pushState(null,"",`${Z(Re)}${h??""}`):M.current?.(Re,"push")});return}xr(Le.current,()=>W(Le.current,void 0,h))}},[C,L,e.basePath,W]),He=(0,d.useCallback)(h=>{if($e.current.shown==="pages"){Se.go.current||($.current.path=h),J(h);return}if($.current.path=h,N(h),Ce.current){Pe(!1),C?window.history.pushState(null,"",Z(h)):M.current?.(h,"push");return}W("pages",h)},[Se,J,N,W,C,e.basePath]),ze=D.arrangement?.(),ue=A==="pages",Ee=e.hrefOf,We=Ee??(C?Z:void 0),Y=(0,d.useMemo)(()=>({open:He,...Ee?{href:Ee}:C?{href:h=>xt(h,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[He,C,e.basePath,Ee]);return(0,g.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":A,"data-graview-scheme":T,...se?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:_,minHeight:v?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,g.jsx)("style",{children:E}),(0,g.jsxs)(Jn.Provider,{value:re,children:[(0,g.jsx)(mr,{rootRef:p,board:j}),(0,g.jsx)(lr,{rootRef:p,firstLook:e.firstLook,app:er(F??{name:n.name},n.schema)}),(0,g.jsx)(Ue,{module:"@graview/react",report:re,content:!0,children:(0,g.jsx)(In.Provider,{value:ie,children:(0,g.jsx)(Vn,{store:P,views:D,initialView:q,scheme:T,...hr(e,k,F),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,g.jsxs)(Qn.Provider,{value:j,children:[(0,g.jsx)(Oo,{face:A,stop:ge??o,kinds:O,places:Qe,opens:X}),z?(0,g.jsx)(To,{into:z}):null,(0,g.jsx)(xo,{rootRef:p,face:L,shown:A,path:te,stop:o,draft:de.n,onDrawn:e.onDrawn,parts:ie}),C?(0,g.jsx)(ir,{pagesWere:H?.path,basePath:e.basePath,shown:A,onFace:e.onFace,toggle:G,kinds:O,places:Qe,opens:X,landed:le}):null,i&&A!=="picture"?(0,g.jsx)(Ue,{module:"@graview/embed",report:re,children:(0,g.jsx)(yr,{name:F?.name??n.name,heading:S,named:Wt(i).name!==!1,faces:Wt(i).faces===!1?void 0:{scene:{label:Fn(ze),current:!ue,go:()=>Ae(),reach:()=>void Ve(Le.current)},pages:{label:On(ze),current:ue,go:()=>He($.current.path),reach:()=>void Ve("pages")}},at:ue?te:null,without:e.pages?.without(),home:{...We?.("/")!==void 0?{href:We("/")}:{},go:()=>He("/"),current:ue&&te.split("?")[0]==="/"},reach:{...We?{href:We}:{},go:h=>He(h.path)},standing:c,hostActions:e.hostActions,keeping:ue?void 0:(0,g.jsx)(Co,{app:n,studio:e.studio,report:re}),onFind:wt,switch:e.switch})}):null,(0,g.jsx)(Xn.Provider,{value:Be,children:(0,g.jsx)(Ue,{module:A==="pages"||A==="picture"?"@graview/pages":"@graview/react",report:re,content:!0,children:(0,g.jsxs)(d.Suspense,{fallback:(0,g.jsx)(Ao,{auto:v,scene:A!=="pages"&&A!=="picture"}),children:[A==="picture"?(0,g.jsx)(vo,{scope:w,store:P,views:D,as:(o?ct(o).within?.view:void 0)??""}):A==="pages"?(0,g.jsx)(wo,{store:P,views:D,presence:k,auto:v,brand:F,steering:Se,overview:Ae,scope:w,titleLevel:gr(S),quickAsk:Vt(e.quickAsk),props:{...e,onNavigate:ee,...C?{}:{path:$.current.path}}}):(0,g.jsx)(Kn.Provider,{value:Y,children:(0,g.jsx)(yo,{address:C,auto:v,scheme:T,scope:w,quickAsk:Vt(e.quickAsk)})}),(0,g.jsx)(ko,{asked:L,shown:A,onDrawn:Ye})]})},A)})]})})})})]})]})}var Kt=e=>e.split(/[?#]/)[0]===Re,Wr=(0,d.createContext)(null);function To({into:e}){return e.view=dt().view,null}function xo({rootRef:e,face:n,shown:o,path:i,stop:c,draft:l,onDrawn:S,parts:p}){let{view:w}=dt(),E=o==="scene"||o==="graview",T=st(w),{pan:P,...k}=w,F=w.pan?st(k):T,v={face:n,path:E?Re:o==="picture"?c??"#":i,stop:T};return Ar(e,`${o} ${E?F:v.path} ${l}`,v,S,p),null}var mt,Fo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.PCKX2FHR.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SIABGHF2.js"))),Qt=()=>Fo().then(e=>void(mt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(Qt));function Oo({face:e,stop:n,kinds:o,places:i,opens:c}){let{view:l,go:S}=dt(),p=(0,d.useRef)({face:e,stop:n});return(0,d.useLayoutEffect)(()=>{let w=p.current.stop!==n,E=p.current.face!==e,T=p.current.face==="pages";if(p.current={face:e,stop:n},!w&&!E||e==="pages"||e==="picture")return;let P=(w||T)&&n!==void 0?$r(e,n,o,i):T&&cr(l)?$t(e,Nt(c),o):e==="graview"?Lt(l,!0):l.overview?Hn(Lt(l,!1),tr(l,o)):l;S(P)},[e,n,o,l,S,c]),null}function Co({app:e,studio:n,report:o}){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Suspense,{fallback:null,children:(0,g.jsx)(go,{})}),n!==!1?(0,g.jsx)(Ue,{module:"@graview/studio",report:o,children:(0,g.jsx)(Lo,{app:e,studio:n})}):null]})}function Lo({app:e,studio:n}){let o={app:e,within:"box",...n?{onApply:n.onApply}:{},...n?.landmark?{landmark:n.landmark}:{},...n?.offered!==void 0?{offered:n.offered}:{}},i=n?.place;return i?(0,g.jsx)(i,{...o}):(0,g.jsx)(d.Suspense,{fallback:null,children:(0,g.jsx)(Eo,{...o})})}function Mo({path:e,stop:n,...o},i){return{...o,app:i.app,at:i.at,remote:i.remote,...i.remote.presence?{presence:i.remote.presence}:{}}}function Zt(e,n){let o=n.store??n.remote?.store??dr(n.app,n.seed),i=n.notices??Dt(),c=null,l={},S=0,p=n.label,w=n.app,E=Promise.resolve(),T=n.at?.face??n.face,P=T===void 0?void 0:Bt({...n,face:T}),k=P??Yt(n.stop),F=null,v=[],_=f=>{if(F=f,f!==k)return;let V=v;v=[];for(let j of V)j()};function de(){let[f,V]=(0,d.useState)(P),[j,Z]=(0,d.useState)(n.stop),[x,me]=(0,d.useState)(n.path),[B,R]=(0,d.useState)(n.scheme??"auto"),[he,L]=(0,d.useState)(n.principal),[O,C]=(0,d.useState)(n.seats),[H,X]=(0,d.useState)(n.quickAsk),[q,ye]=(0,d.useState)(n.people),[$,Fe]=(0,d.useState)(n.hostContext),[M,ee]=(0,d.useState)(n.brand),[te,N]=(0,d.useState)(n.whileAway),[Se,J]=(0,d.useState)(n.label),[z,G]=(0,d.useState)(n.hostActions),[le,ne]=(0,d.useState)(void 0),[Oe,Pe]=(0,d.useState)(n.draftView);return c={app:se=>{ne(se),me(void 0),Z(void 0)},face:V,stop:Z,path:me,scheme:R,seat:L,seats:C,quickAsk:X,people:ye,hostContext:Fe,brand:ee,whileAway:N,label:J,hostActions:G,draft:Pe},(0,g.jsx)(Wr.Provider,{value:l,children:(0,g.jsx)(Nr,{...le?Mo(n,le):n,store:o,notices:i,...f!==void 0?{face:f}:{},onOpening:se=>{k=se},...j!==void 0?{stop:j}:{},...x!==void 0?{path:x}:{},...he?{principal:he}:{},...O?{seats:O}:{},...H!==void 0?{quickAsk:H}:{},...q?{people:q}:{},...$?{hostContext:$}:{},...M?{brand:M}:{},whileAway:te,label:Se,hostActions:z,draftView:Oe,scheme:B,onFace:se=>{k=se,V(se)},onSeat:L,onFaceDrawn:_},le?.n??0)})}let D=()=>{let f=l.view?.focusId,V=f?o.graph.getNode(f)?.kind:void 0,j=(l.shown??k)==="scene"||(l.shown??k)==="graview";return{face:k,path:j?Re:l.pages?.()??n.path??"/",stop:l.view?st(l.view):n.stop??"#",...V?{kind:V}:{}}},ie=(0,Or.createRoot)(e);return(0,I.flushSync)(()=>ie.render((0,g.jsx)(de,{}))),{get store(){return o},where:D,setApp:(f,V,j)=>{let Z="graph"in V?{store:V}:V,x=()=>{let me=D();o=Z.store,p=j?.label??(p===w.name?f.name:p),w=f,(0,I.flushSync)(()=>{c?.label(p),c?.app({app:f,remote:Z,at:me,n:++S})})};mt?x():E=E.then(Qt).then(x)},setFace:f=>{k=f,(0,I.flushSync)(()=>c?.face(f))},setStop:f=>(0,I.flushSync)(()=>c?.stop(f)),setPath:f=>(0,I.flushSync)(()=>{if(Kt(f)){(k==="pages"||k==="picture")&&(k="scene",c?.face("scene"));return}c?.path(f),k!=="pages"&&(k="pages",c?.face("pages"))}),setScheme:f=>(0,I.flushSync)(()=>c?.scheme(f)),setSeat:f=>(0,I.flushSync)(()=>c?.seat(f)),setSeats:f=>(0,I.flushSync)(()=>c?.seats(f)),setQuickAsk:f=>(0,I.flushSync)(()=>c?.quickAsk(f)),setPeople:f=>(0,I.flushSync)(()=>c?.people(f)),setHostContext:f=>(0,I.flushSync)(()=>c?.hostContext(f)),setBrand:f=>(0,I.flushSync)(()=>c?.brand(f)),setWhileAway:f=>(0,I.flushSync)(()=>c?.whileAway(f)),setDraftView:f=>(0,I.flushSync)(()=>c?.draft(f)),setLabel:f=>{p=f,(0,I.flushSync)(()=>c?.label(f))},setHostActions:f=>(0,I.flushSync)(()=>c?.hostActions(f)),drawn:()=>E.then(()=>F===k?void 0:new Promise(f=>v.push(f))),notify:f=>{let V;return(0,I.flushSync)(()=>{V=i.notify(f)}),V},unmount:()=>ie.unmount()}}var ht=e=>`s${(e+1).toString(36)}`;var Ir="/graview/friction";var _r="/graview/live",Xt="graview.ship",en=`${Xt}.${ot}`;var be={seat:"x-graview-seat",roles:"x-graview-roles",kind:"x-graview-kind",name:"x-graview-name",for:"x-graview-for",forRoles:"x-graview-for-roles",forName:"x-graview-for-name",via:"x-graview-via"};var je=class extends Error{constructor(n){super(n),this.name="Superseded"}},xe=e=>e?.lineage?{lineage:e.lineage}:{},Ho=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
2
- `)[0]??"":String(n)})`;function Do(e){if(!e)return[];try{let n=e.storage.getItem(e.key);if(n===null)return[];e.storage.removeItem(e.key);let o=JSON.parse(n);return Array.isArray(o)?o.filter(i=>!!i&&Array.isArray(i.calls)):[]}catch{return[]}}var qe=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},Vo={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},pe=class extends Error{constructor(o,i){super(o);this.conflicts=i;this.name="StaleWrite"}},Je=class extends Error{constructor(n){super(n),this.name="Unreached"}},Bo=new Set([502,503,504]);async function $o(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function No(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Wo=1,Io=()=>({refusals:new Set,conflicts:new Set,statuses:new Set,helds:new Set,builds:new Set,who:new Set,declarations:new Set,tally:{reconnects:0,rebases:0,conflicts:0,resyncs:0}});async function yt(e){return(await jr(e,Do(e.carry),"This app was updated while your changes were on the way.",Io())).remote}async function jr(e,n,o,i){let c=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},S={...gt(e.principal),[be.via]:e.via??"web"};Object.assign(l,S);let p=e.live===!0,w=e.presenceEveryMs,E=e.visible??qo,T="connecting",P=i.statuses,k=i.tally,F=[],v,_=[],de=()=>T==="online"&&v!==void 0?"held":T,D=()=>{let t=de();if(i.told!==t){i.told=t;for(let r of[...P])r(t)}},ie=t=>{if(!(t===T||ce)&&(T==="offline"&&t==="online"&&k.reconnects++,T=t,D(),t==="online"))for(let r of F.splice(0))r.again()},f=t=>{if(ce)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==v;if(v=r,V(),!!s&&(D(),r===void 0)){for(let a of _.splice(0))a();oe&&clearTimeout(oe),an()}},V=()=>{if(i.toldHeld!==v){i.toldHeld=v;for(let t of[...i.helds])t(v??null)}},j=async(t,r)=>{let s;try{s=await c(t,r)}catch(a){throw Y()||ie("offline"),new Je(a instanceof Error?a.message:String(a))}if(s.status===503&&await $o(s))return ie("online"),s;if(Bo.has(s.status))throw Y()||ie("offline"),new Je(`The server is away (${s.status})`);return ie("online"),s},Z=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${_e.op}`,s=t?await c(r,{headers:l}):await j(r,{headers:l});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},x=e.state??await Z(!0);p||(T="online"),v=typeof x.held=="string"&&x.held.length>0?x.held:void 0,V();let me=x.enabledModules??e.enabledModules,B=e.localApp?e.localApp(e.app):e.app,R=new xn({schema:B.schema,mutations:B.mutations??[],invariants:B.invariants??[],...B.policy?{policy:B.policy}:{},...B.publishing?{publishing:B.publishing}:{},...B.modules?{modules:B.modules}:{},...me?{enabledModules:me}:{},...B.intelligence?{intelligence:B.intelligence}:{},...B.brand?.timeZone?{timeZone:B.brand.timeZone}:{},snapshot:x.snapshot,log:x.log,...x.horizon!==void 0?{horizon:x.horizon}:{},ids:No(),...e.storeOptions??{}});kn.served.add(R);let he=e.friction!==!1&&e.principal?.kind!=="visitor";he&&An(R,t=>{he&&c(`${e.url}${Ir}`,{method:"POST",headers:l,body:JSON.stringify({event:t})}).then(r=>void(he=r.status!==404&&r.status!==410),()=>{})});let L=Rn(R),O=x.log.at(-1)?.seq??(x.horizon??0)-1,C=Tt.of(x.log,{horizon:x.horizon??0}),H=null,X,q=new Map,ye=i.who,$=!1,Fe=t=>{if(ce)return;$=!0;let r=Cn(new Map,t,Date.now(),Ot,H?.participant);X!==void 0&&r.delete(X);let s=r.size!==q.size;if(!s)for(let[a,u]of r)Ct(u,q.get(a))||(s=!0);if(q=r,!!s)for(let a of[...ye])a([...q.values()])},M=[],ee=new Set,te=t=>{let r=M.indexOf(t);r>=0&&M.splice(r,1)},N=new Map,Se=(t,r)=>{let s=N.get(t);s&&(N.delete(t),s.resolve({ops:r.filter(a=>a.batch===t),batch:t}))},J,z=[],G=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(J)return z.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(m=>m.seq>O).map(m=>m.seq));if(Number.isFinite(s)&&s>O+1)return z.push({ops:t,drop:r}),le(),[];let a=M.filter(m=>t.some(ae=>ae.batch===m)),u=[...new Set([...r,...a])].filter(m=>ee.has(m)),y,b=M.filter(m=>!a.includes(m));try{y=R.rebase({confirmed:t,pending:b,drop:u}).confirmed}catch(m){if(!(m instanceof Tn))throw m;return z.push({ops:t,drop:r}),le(),[]}for(let m of a)te(m);t.some(m=>m.seq>O)&&b.some(m=>!u.includes(m))&&k.rebases++,t.length>0&&(O=Math.max(O,...t.map(m=>m.seq)),C.note(t));for(let m of u)ee.delete(m);for(let m of a)Se(m,t);return y},le=()=>{J||(J=ke(Z().then(t=>{if(ne(t)){z=[];return}let r=new Set(t.log.map(u=>u.batch)),s=M.filter(u=>r.has(u));for(let u of s)te(u);let a=R.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...M],drop:[...ee].filter(u=>!M.includes(u))});ee.clear();for(let u of a.pending)ee.add(u.batch);O=t.log.at(-1)?.seq??(t.horizon??0)-1,C=Tt.of(t.log,{horizon:t.horizon??0}),k.resyncs++;for(let u of s)Se(u,t.log)}).then(()=>{J=void 0;let t=z;z=[];for(let{ops:r,drop:s}of t)G(r,s)},()=>{J=void 0,z=[]})))},ne=t=>(typeof t.build=="string"&&cn(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===x.version?!1:(St(t.version),!0)),Oe=async t=>{let s=await(await j(`${e.url}/graview/since?seq=${ht(t)}&opFormat=${_e.op}`,{headers:l})).json();return ne(s)?[]:s.reset===!0?(le(),[]):s.ops??[]},Pe=async()=>{let t=await se();return J&&await J,t},se=async()=>{if(H&&!Y()&&E()){let r=await(await j(`${e.url}/graview/here?opFormat=${_e.op}`,{method:"POST",headers:l,body:JSON.stringify({presence:H,seq:ht(O)})})).json();return ne(r)?[]:(typeof r.participant=="string"&&(X=r.participant),Fe(r.who??[]),G(r.ops??[]))}return G(await Oe(O))},A=new Map,Ce=new Map,Le=new Set,re=new Map,Me=new Set,ke=t=>(Me.add(t),t.finally(()=>Me.delete(t)).catch(()=>{}),t),Ye=Promise.resolve(),Be=0,wt=(t,r)=>{let s=Ye.then(()=>$e(t,r));return Ye=s.catch(()=>{}),s},Qe=()=>new Promise((t,r)=>F.push({again:t,give:r})),$e=async(t,r)=>{let s,a;for(;;){try{s=await j(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:_e.op})})}catch(m){if(!(m instanceof Je)||U)throw m;if(await Qe(),Y())return Ze(t,r);continue}if(a=await s.json().catch(()=>({})),s.status===503&&a.reason==="unavailable"&&typeof a.held=="string"&&!U){if(typeof a.version=="number"?ne(a):(f(a.held),!1))break;if(v!==void 0&&(Et>0||p)){if(await new Promise(m=>_.push(m)),U)throw new je("The client closed.");if(Y())return Ze(t,r);continue}}let b;if(s.status===503&&a.reason==="unavailable"&&!U)b=tn(e.backoff,Be++);else{if(Be=0,s.status!==429||U)break;b=_o(s.headers.get("retry-after"),a.retryAfter)}if(await new Promise(m=>setTimeout(m,b)),Y())return Ze(t,r)}if(ce||ne(a))throw new je("The app was changed.");if(!s.ok){let b=a.error??`The server refused (${s.status})`;throw a.conflict?new pe(b,a.conflicts??[]):new qe({reason:a.reason??Vo[s.status]??"invalid",sentence:b,...a.wouldNeed?.length?{wouldNeed:a.wouldNeed}:{}})}let u=a.ops??[],y=u[0]?.seq;return y!==void 0&&y>O+1&&(u=await Oe(O)),r!==void 0&&(a.batch&&A.set(r,a.batch),te(r)),G(u,r!==void 0?[r]:[]),{ops:a.ops??[],...a.batch?{batch:a.batch}:{}}},W,ge=!1,U=!1,Ne=0,Ae,He=0,ze=0,ue=null,Ee=()=>{},We=new Promise(t=>{Ee=t}),Y=()=>p&&ge&&W?.readyState===Wo,h=t=>{if(!Y())return!1;try{return W.send(JSON.stringify(t)),!0}catch{return!1}},Q=(t=!1)=>{!H||!Y()||!E()||!t&&ue&&Ct(H,ue)&&(w===void 0||Date.now()-ze<w)||h({t:"here",presence:H})&&(ue=H,ze=Date.now())},K=new Set,oe,an=()=>{if(oe=void 0,v!==void 0)return;let t=[...N.entries()].filter(([r])=>K.has(r));K.clear();for(let[,r]of t)h(r.message)},sn=(t,r)=>{N.has(t)&&(K.add(t),oe&&clearTimeout(oe),oe=setTimeout(an,Math.max(0,r)))},Gr=t=>{N.has(t)&&K.add(t)},Ze=(t,r)=>new Promise((s,a)=>{let u=r??`send-${++He}`,y=t.undo?{t:"undo",cid:u,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...xe(t)}:{t:"call",cid:u,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...xe(t)};if(N.set(u,{message:y,...r!==void 0?{mine:r}:{},resolve:s,reject:a}),K.size>0||v!==void 0){K.add(u);return}h(y)}),Xe=(t,r)=>Y()?Ze(t,r):wt(t,r),Ur=t=>{switch(t.t){case"welcome":{if(cn(t.build),typeof t.version=="number"&&t.version!==x.version){St(t.version);return}if(ge=!0,Ne=0,typeof t.participant=="string"&&(X=t.participant),f(t.held),t.state?le():G(t.ops??[]),K.clear(),oe&&clearTimeout(oe),oe=void 0,v!==void 0)for(let r of N.keys())K.add(r);else for(let r of N.values())h(r.message);Q(!0),ie("online"),Ee();return}case"ops":G(t.ops??[]);return;case"ack":{let r=N.get(t.cid);if(!r){G(t.ops??[]);return}N.delete(t.cid),Be=0,r.mine!==void 0&&(A.set(r.mine,t.batch),te(r.mine)),G(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=N.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){v!==void 0?Gr(t.cid):sn(t.cid,tn(e.backoff,Be++));return}N.delete(t.cid),r.reject(t.t==="conflict"?new pe(t.sentence,t.conflicts??[]):new qe({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&sn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":Fe(t.who??[]);return;case"held":f(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==x.version&&St(t.version);return;case"reload":fn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&W){let r=W;mn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},ce=!1,vt=i.declarations,bt=i.builds,cn=t=>{if(!(ce||i.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){i.otherBuild=t;for(let r of[...bt])r(t)}},dn=()=>{let t=[],r=0;for(let s of M){let a=re.get(s);a?t.push({calls:a.calls,...a.intent?{intent:a.intent}:{},...a.via?{via:a.via}:{},...xe(a),batch:s}):r++}return{carried:t,undos:r}},ln=(t,r)=>`${r} while ${t===1?"an undo of yours was":"undos of yours were"} on the way; ${t===1?"it was":"they were"} not made.`,un=t=>{ce=!0,H=null;let r=new je(t);for(let a of N.values())a.reject(r);N.clear(),nt&&clearInterval(nt),U=!0,Ae&&clearTimeout(Ae),oe&&clearTimeout(oe),we&&clearTimeout(we);for(let a of F.splice(0))a.give(r);for(let a of _.splice(0))a();let s=W;W=void 0,ge=!1;try{s?.close(1e3,t)}catch{}Ee()};async function St(t){if(ce)return;if(!e.resolveApp){fn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=dn(),a=e.resolveApp,u=H;un("The app was changed.");try{let y=await a(t),{state:b,...m}=e,ae=await jr({...m,app:y},r,"The app was changed while your changes were on the way.",i);u&&ae.remote.presence.here(u);for(let rt of[...vt])rt(ae.remote,t);let fe=[...s>0?[et(ln(s,"The app was changed"))]:[],...ae.unheard()];for(let rt of fe)for(let to of Ie)to(rt.sentence,rt)}catch(y){let b=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let m of Ie)m(b,et(b))}}function fn(t){if(ce)return;let{carried:r,undos:s}=dn();un(t);let a=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),a=!0}catch{}let u=[];!a&&r.length>0&&u.push(`${t} ${r.length===1?"A change of yours was":`${r.length} changes of yours were`} not sent; make ${r.length===1?"it":"them"} again after the page reloads.`),s>0&&u.push(ln(s,"This app was updated"));for(let y of u)for(let b of Ie)b(y,et(y));(e.reloadPage??jo)()}let pn=()=>{if(U||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${_r}`,{"content-type":r,...s}=l,a;try{a=e.socket?e.socket(t,s,[en]):eo(t,s)}catch{return hn()}W=a,ge=!1,a.onopen=()=>{W===a&&a.send(JSON.stringify({t:"hello",seq:ht(O),protocol:ot,wire:Xt,opFormat:_e.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},a.onmessage=u=>{if(W!==a)return;let y;try{y=JSON.parse(String(u.data))}catch{return}Ur(y)},a.onclose=()=>mn(a),a.onerror=()=>{}},we,Kr=()=>{$=!1,we&&clearTimeout(we),we=setTimeout(()=>{if(we=void 0,$||U)return;let t=new Map([...q].filter(([,r])=>r.held!=="socket"));if(t.size!==q.size){q=t;for(let r of ye)r([...q.values()])}},Ot),we.unref?.()};function mn(t){if(W!==t)return;let r=ge;W=void 0,ge=!1,ue=null,r&&(ie("offline"),Kr()),hn()}let hn=()=>{if(U)return;let t=tn(e.backoff,Ne);Ne++,Ae=setTimeout(pn,t)},yn=R.applyAll.bind(R),Jr=R.undo.bind(R),Yr=R.previewAll.bind(R);R.previewAll=(t,r)=>Yr(t,{...e.principal?{author:e.principal}:{},...r});let Ie=i.refusals,Ge=[],et=t=>({reason:"invalid",sentence:t}),tt=i.conflicts,Pt=!1,gn,kt=async(t,r)=>{if(r instanceof je||ce)return;let s=r instanceof qe?r.refusal:Sn(r),a=s.sentence,u=r instanceof pe?gn?.yoursOf(R,re.get(t)?.calls??[]):void 0;te(t);try{G([],[t])}catch{}let y=re.get(t);re.delete(t);let b=y?.calls[0];if(b&&!(r instanceof pe)){let m=R.allMutations().find(fe=>fe.name===b.name)?.subject?.arg,ae=m&&R.graph.getNode(b.args[m])?.kind;En(R,{type:"refused",act:b.name,code:s.reason,...ae?{kind:ae}:{}},e.principal)}if(r instanceof pe&&k.conflicts++,r instanceof pe&&!Y()&&await Pe().catch(()=>[]),r instanceof pe&&J&&await J,r instanceof pe&&tt.size>0){let m=!1,ae={sentence:a,conflicts:u?r.conflicts.map(fe=>fe.node===u.node&&fe.field===u.field?{...fe,yours:u.yours}:fe):r.conflicts,keepTheirs(){m=!0},useMine(){if(!(m||!y)){m=!0,Pt=!0;try{R.applyAll(u?[u.over(O)]:y.calls,{...y.intent?{intent:y.intent}:{},...y.via?{via:y.via}:{},...xe(y)})}finally{Pt=!1}}}};for(let fe of tt)fe(ae);return}for(let m of Ie)m(a,s)},Qr=(t,r)=>t.flatMap(s=>s.mutation?.name===bn?[]:s.primitives.flatMap(a=>a.op==="splice-text"&&!r.has(a.id)&&!r.has(`${a.id}\0${a.field}`)?[{node:a.id,field:a.field,rev:O}]:[]));R.applyAll=(t,r)=>{let s=Pn(R.log.all().filter(b=>ee.has(b.batch))),a=yn(t,{...e.principal?{author:e.principal}:{},...r}),u=t.map((b,m)=>{let ae=a.minted?.[m];return ae===void 0||b.args?.id!==void 0?b:{...b,mintedHint:ae}});M.push(a.batch),ee.add(a.batch),re.set(a.batch,{calls:u,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...xe(r)});let y=Pt?[]:[...C.baseFor(a.ops,s,(b,m)=>R.collaborative(b,m)),...Qr(a.ops,s)];return Ce.set(a.batch,ke(Xe({calls:u,...r?.intent?{intent:r.intent}:{},batch:a.batch,...y.length>0?{base:y}:{},...r?.via?{via:r.via}:{},...xe(r)},a.batch).catch(b=>kt(a.batch,b)))),a},R.apply=(t,r)=>R.applyAll([t],r),R.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,a=Jr(s.map(y=>A.get(y)??y),{...e.principal?{author:e.principal}:{},...r});M.push(a.batch),ee.add(a.batch);let u=Promise.allSettled(s.map(y=>Ce.get(y)));return Ce.set(a.batch,ke(u.then(()=>{let y=s.filter(b=>!Le.has(b));if(y.length===0){te(a.batch),re.delete(a.batch),G([],[a.batch]);return}return Xe({undo:y.map(b=>A.get(b)??b),...r?.intent?{intent:r.intent}:{},batch:a.batch,...r?.via?{via:r.via}:{},...xe(r)},a.batch)}).catch(y=>kt(a.batch,y)))),a};let Zr=async(t,r={})=>{At++;try{return(await ke(Xe({calls:t,...r}))).ops}finally{At--}},At=0,wn={here(t){H=t,Q()},onWho(t){return ye.add(t),q.size>0&&t([...q.values()]),()=>{ye.delete(t)}},leave(){if(!H)return;let t=JSON.stringify({participant:X??H.participant});if(H=null,h({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${e.url}/graview/leave`,t):c(`${e.url}/graview/leave`,{method:"POST",headers:l,body:t}).catch(()=>{})}},Et=e.pollMs??800,nt=Et>0&&typeof setInterval=="function"?setInterval(()=>{Y()||Pe().catch(()=>{})},Et):null;if(p){pn();let t;await Promise.race([We,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!ce){let t=[],r=new Set(R.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{R.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...xe(s)})}catch(a){t.push(Ho(s,a))}t.length>0&&Ge.push(et(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let vn=new Map,Xr=()=>({store:R,author:e.principal,appliedAll:yn,pending:M,provisional:ee,asked:re,answers:Ce,letGo:Le,sent:(t,r)=>ke(Xe({calls:r,batch:t},t).catch(s=>kt(t,s))),settle:te,land:G,seen:()=>O,gone:()=>U||ce});return{remote:{store:R,typing(t,r){let s=`${t}\0${r}`,a=vn.get(s);return a||(a=(__graviewPreload(import.meta.url,["./chunk.U5AX4DD5.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.354A4QCG.js")).then(u=>(gn=u,u.typingOf(t,r,u.wireOf(Xr())))),vn.set(s,a)),a},version:x.version,migrated:x.migrated??[],send:Zr,pull:Pe,onRefusal(t){Ie.add(t);let r=Ge;Ge=[];for(let s of r)t(s.sentence,s);return()=>Ie.delete(t)},onDeclaration(t){return vt.add(t),()=>vt.delete(t)},onBuild(t){return bt.add(t),i.otherBuild!==void 0&&t(i.otherBuild),()=>bt.delete(t)},onConflict(t){return tt.add(t),()=>tt.delete(t)},revision:(t,r)=>C.of(t,r),seq:()=>O,participant:()=>X,transport:()=>Y()?"socket":"poll",status:de,onStatus(t){return P.add(t),()=>P.delete(t)},held:()=>v,onHeld(t){return i.helds.add(t),v!==void 0&&t(v),()=>i.helds.delete(t)},counters:()=>({...k}),who:()=>[...q.values()],pending:()=>M.length+At,async settled(){for(;Me.size>0;)await Promise.allSettled([...Me])},presence:wn,close(){nt&&clearInterval(nt),L(),wn.leave(),U=!0,Ae&&clearTimeout(Ae),oe&&clearTimeout(oe),we&&clearTimeout(we);for(let r of F.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of _.splice(0))r();let t=W;W=void 0,ge=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Ge;return Ge=[],t}};function eo(t,r){let s=globalThis.WebSocket;if(!s)throw new Error("This runtime has no WebSocket; the client polls instead.");let a=typeof globalThis.document<"u",u=e.subprotocol?[en]:[];if(!a)try{return new s(t,{headers:r,...u.length>0?{protocols:u}:{}})}catch{}let y=new URL(t);for(let[b,m]of Object.entries(S))y.searchParams.set(b,m);return u.length>0?new s(y.toString(),u):new s(y.toString())}}function _o(e,n,o=Date.now()){let i,c=e?.trim();if(c)if(/^\d+(\.\d+)?$/.test(c))i=Number(c)*1e3;else{let p=Date.parse(c);Number.isFinite(p)&&(i=Math.max(0,p-o))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,S=l!==void 0&&l<50&&i!==void 0&&Math.abs(l*1e3-i)<1e3;return l!==void 0&&!S?l:i??1e3}function jo(){globalThis.location?.reload?.()}function qo(){return globalThis.document?.visibilityState!=="hidden"}function tn(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:i=1e4,factor:c=2}=e??{};return Math.min(i,o*c**n)*(.75+Math.random()*.5)}function gt(e){let n={};if(!e)return n;e.id&&(n[be.seat]=e.id),e.roles?.length&&(n[be.roles]=e.roles.join(",")),e.kind!=="human"&&(n[be.kind]=e.kind),e.name&&(n[be.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[be.for]=o.id),o?.roles?.length&&(n[be.forRoles]=o.roles.join(",")),o?.name&&(n[be.forName]=encodeURIComponent(o.name)),n}var qr="/graview/views";function nn(e){let n=e.fetch??fetch,o=e.url.replace(/\/$/,""),i={"content-type":"application/json",...e.principal?gt(e.principal):{},...e.headers??{}},c=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??at.may}:at,l=new Set,S=P=>{if(JSON.stringify(P)!==JSON.stringify(c)){c=P;for(let k of l)k()}},p=async(P,k)=>{let F=await n(`${o}${e.path??qr}`,{method:P,headers:i,...k!==void 0?{body:JSON.stringify(k)}:{}}),v=await F.json();if(!F.ok)throw new Error(v.error??`The store answered ${F.status}.`);S({hidden:v.hidden??[],removed:v.removed??[],may:v.may??at.may})},w=()=>p("GET"),E=e.state?Promise.resolve():w().catch(()=>{}),T=e.pollMs?setInterval(()=>void w().catch(()=>{}),e.pollMs):void 0;return{ready:E,refresh:w,close:()=>clearInterval(T),current:()=>c,onChange(P){return l.add(P),()=>void l.delete(P)},hide:P=>p("POST",{hide:P}),show:P=>p("POST",{show:P}),remove:(P,k)=>p("POST",{remove:P,...k?{about:k}:{}}),async restore(P){let k=c.removed.find(F=>F.name===P)?.lens;await p("POST",{restore:P}),k&&await e.onDeclaration?.()},async lens(P){await p("POST",{lens:P}),await e.onDeclaration?.()}}}var on=document.getElementById("graview-app"),rn=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),zr=rn?(__graviewPreload(import.meta.url,["./chunk.2ORJGMRT.js","./chunk.5D6SIBOK.js","./chunk.XOZU4OFA.js","./chunk.QQ3YWKWU.js","./chunk.G5XTASMO.js","./chunk.EGSE6NNE.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KHJ2MCMS.js")):Ve("pages");try{rn?await zo(decodeURIComponent(rn[1])):await Go()}catch(e){let n=document.createElement("pre");n.setAttribute("role","alert"),n.style.cssText="margin:2rem;font:14px/1.5 ui-monospace,monospace;white-space:pre-wrap",n.textContent=e instanceof Error?e.message:String(e),on.replaceChildren(n),window.__graviewFailed=n.textContent}async function zo(e){let n=await fetch(`/graview/document?form=${encodeURIComponent(e)}`),o=await n.json();if(!n.ok)throw new Error(o.error??`The preview server did not hand over the form (${n.status}).`);let i=await lt(o);if(!i.ok)throw new Error(it(i.findings));let c=i.app,l=o.principal,S=await yt({app:c,url:location.origin,principal:l,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=c.forms?.[e]?.title??c.name;let{mount:p}=await zr;window.__graview=p(on,{app:c,form:e,principal:l,remote:S,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Go(){let e=await fetch("/graview/document");if(!e.ok)throw new Error(`The preview server did not hand over the document (${e.status}).`);let n=await e.json(),i=await(async w=>{if(typeof w.module=="string")return(await import(w.module)).app;let E=await lt(w);if(!E.ok)throw new Error(it(E.findings));return E.app})(n);if(!i||typeof i!="object"||!("schema"in i))throw new Error("The app module the preview server handed does not export an app.");let c=n.principal,l=await yt({app:i,url:location.origin,principal:c,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=i.name;let S,p=nn({url:location.origin,principal:c,...n.views?{state:n.views}:{},onDeclaration:async()=>{let w=await(await fetch("/graview/document")).json();if(typeof w.module=="string")return;let E=await lt(w);E.ok&&S?.setApp(E.app,l)}});await Promise.all([zr,p.ready]),S=Zt(on,{app:i,remote:l,principal:c,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:i.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=S,S.drawn().then(()=>{window.__graviewReady=!0})}
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as ro}from"./chunk.2OX4YI46.js";import{a as Wt,b as lr,c as ur,d as fr,e as It,f as pr,g as mr,h as hr,i as yr,j as gr,k as wr,l as vr,m as br,n as Ue}from"./chunk.APXYWI3L.js";import{b as dr}from"./chunk.XY5EVI22.js";import{a as Bt,b as or,c as ar,d as ir,e as sr,f as $t,g as cr,h as Nt}from"./chunk.MFDSWA2W.js";import{a as Rt,g as Ln}from"./chunk.K4MO22RM.js";import{k as it}from"./chunk.KMEKMCKG.js";import{E as tr,I as nr,J as rr,h as Yn,k as Dt,l as Qn,n as Zn,r as Xn,w as Vt,z as er}from"./chunk.HFVMGTNL.js";import{c as no}from"./chunk.7Z4USR3Y.js";import{Aa as qn,Ca as zn,Da as Gn,Fa as Un,G as Mt,Ga as Ht,Ka as Kn,La as Jn,Oa as dt,T as Dn,Z as Vn,a as Mn,b as st,c as ct,ga as Bn,ha as $n,j as Hn,m as Lt,va as Nn,wa as Wn,xa as In,ya as _n,za as jn}from"./chunk.NPAWTPLQ.js";import{a as Te}from"./chunk.SDO3U72B.js";import{$d as Cn,Eb as Sn,Pd as Re,Qd as Fn,Rd as On,Wd as xt,Xc as kn,Xd as Ft,Yd as Ot,ae as Ct,fb as _e,hc as Tt,hd as An,ic as Pn,id as En,nd as Rn,pd as Tn,qb as ot,qd as xn,rb as bn,sd as at}from"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import{b as De}from"./chunk.AJZBJBMO.js";function _t(e){if(Array.isArray(e))return e.map(_t);if(e&&typeof e=="object"){let n={};for(let o of Object.keys(e).sort()){let i=e[o];i!==void 0&&(n[o]=_t(i))}return n}return e}function jt(e){return JSON.stringify(_t(e))??"undefined"}async function lt(e,n={}){let o=e.compiled===void 0||!ao(e.compiled,e.document)?void 0:Ln(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:i}=await oo();return i(e.document,n)}var Sr,oo=()=>Sr??=(__graviewPreload(import.meta.url,["./chunk.K4MO22RM.js","./chunk.TQCRFZ53.js","./chunk.FCUDBMGC.js","./chunk.KMEKMCKG.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5MSWUTDB.js")).catch(e=>{throw Sr=void 0,e});function ao(e,n){let o=typeof e=="object"&&e!==null?e.document:void 0,i=n;if(typeof i=="string")try{i=JSON.parse(i)}catch{return!1}return o!==void 0&&jt(Rt(o).document)===jt(Rt(i).document)}var d=De(Mt(),1);var ft=De(Mt(),1),qt="data-graview-drawn",io=200,Pr=50,so=1e4,ut=()=>typeof performance<"u"?performance.now():Date.now();function co(e){let n=[...e.querySelectorAll("img")];for(let o of e.querySelectorAll("[data-worker-view]"))o.shadowRoot&&n.push(...o.shadowRoot.querySelectorAll("img"));return n}function lo(e,n){if(e.ownerDocument.fonts?.status==="loading"||Wn()>0||qn(n)>0||e.querySelector('[aria-busy="true"]')||co(e).some(i=>!i.complete&&i.loading!=="lazy"))return!1;for(let i of e.querySelectorAll("[data-worker-view-place]"))if(!i.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function kr(e){let n=e.querySelector("[data-embed-content]"),o=[...e.querySelectorAll("[data-worker-view]")].map(i=>`${i.offsetWidth}x${i.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${o.join(",")}`}function uo(e,n,o,i){e.removeAttribute(qt);let c=e.ownerDocument.defaultView;if(!c)return()=>{};let l=ut(),S=l,p=kr(e),w=!1,E,T=typeof MutationObserver>"u"?void 0:new MutationObserver(v=>{v.some(_=>!(_.target===e&&_.attributeName===qt))&&(S=ut())});T?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let P=()=>{w=!0,T?.disconnect(),E!==void 0&&clearTimeout(E)},k=v=>{let _=!1,de=()=>{_||(_=!0,v())};typeof c.requestAnimationFrame=="function"&&c.requestAnimationFrame(()=>setTimeout(de,0)),setTimeout(de,100)},F=()=>{if(w)return;let v=kr(e);v!==p&&(p=v,S=ut());let _=ut();if(lo(e,i)&&_-S>=io||_-l>=so){k(()=>{w||(P(),e.setAttribute(qt,n),Gn(),o())});return}E=setTimeout(F,Pr)};return E=setTimeout(F,Pr),P}function Ar(e,n,o,i,c){zn();let l=(0,ft.useRef)({place:o,onDrawn:i});l.current={place:o,onDrawn:i},(0,ft.useLayoutEffect)(()=>{c&&jn(c);let S=E=>uo(E,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),c);if(e.current)return S(e.current);let p,w=!1;return queueMicrotask(()=>{!w&&e.current&&(p=S(e.current))}),()=>{w=!0,p?.()}},[n,e,c])}var ve=De(Mt(),1),Ke,fo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.KY7QD22S.js","./chunk.QW3QLE53.js","./chunk.AM2YRNOQ.js","./chunk.AGTFYPXY.js","./chunk.FBR4HJ2Q.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.AKW6NR3X.js"))),Er=()=>fo().then(e=>void(Ke=e),()=>new Promise(e=>setTimeout(e,2e3)).then(Er)),zt=Nn(Er),Rr=e=>!!e&&Ke===void 0;function Gt({onReady:e,fetch:n}){return(0,ve.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var po=0;function Tr(e){let[n,o]=(0,ve.useState)(()=>Ke);(0,ve.useEffect)(()=>{if(!e||n)return;let l=!1;return zt().then(()=>{l||o(Ke)}),()=>{l=!0}},[e,n]);let i=(0,ve.useMemo)(()=>po+=1,[e]);return{over:(0,ve.useMemo)(()=>{let l=n??Ke;if(!e||!l)return;let{source:S,worker:p,...w}=e,E={...w,worker:p??{source:S},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:T=>l.registerWorkerView(T,E)}},[e,n]),n:i}}var Or=De(ro(),1),I=De(no(),1);var g=De(Dn(),1);function pt(e,n={}){let o=Ht(e);return{Face:o.part((c,l)=>(0,d.createElement)(c,l),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var Jt=e=>Promise.all([e,nr()]).then(([n])=>n),Cr=Te(()=>(__graviewPreload(import.meta.url,["./chunk.IUQOSPQX.js","./chunk.LKK7VQBA.js","./chunk.EC5IWN74.js","./chunk.ONGZ3YQF.js","./chunk.MORMTKVR.js","./chunk.PJCVFYFU.js","./chunk.7RJGEU3Y.js","./chunk.HJCQ6I3S.js","./chunk.7O6Z3BFR.js","./chunk.I2C5LPB5.js","./chunk.Q7X2IVLH.js","./chunk.NFU4UM6F.js","./chunk.AKVBU5K5.js","./chunk.LLOZKUCA.js","./chunk.DH7M57SE.js","./chunk.CKV2QCH5.js","./chunk.TAJ2R44N.js","./chunk.64IKLRUS.js","./chunk.DTSTUC2W.js","./chunk.RDL6652E.js","./chunk.V3NPUAPB.js","./chunk.APXYWI3L.js","./chunk.XY5EVI22.js","./chunk.UQQAGT3R.js","./chunk.GZHZLJBF.js","./chunk.E5XNQTEU.js","./chunk.OJGHDWI6.js","./chunk.K5YLQAFW.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.QYFZ7AZS.js"))),mo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.GNQW4JOG.js","./chunk.USB6B6L3.js","./chunk.AZUTYY2S.js","./chunk.45VIF2SX.js","./chunk.IUQOSPQX.js","./chunk.UGFDSE37.js","./chunk.PXQVXBNG.js","./chunk.VYW7DSUW.js","./chunk.LKK7VQBA.js","./chunk.RR2IFETZ.js","./chunk.ONGZ3YQF.js","./chunk.XGCOWCA2.js","./chunk.MORMTKVR.js","./chunk.CU2NQ5WF.js","./chunk.E33EJU3Q.js","./chunk.PJCVFYFU.js","./chunk.7RJGEU3Y.js","./chunk.22MIRLL6.js","./chunk.NFU4UM6F.js","./chunk.DH7M57SE.js","./chunk.AIK3Z25Y.js","./chunk.CKV2QCH5.js","./chunk.BT7RLFPO.js","./chunk.TAJ2R44N.js","./chunk.VLBY66PB.js","./chunk.BJUUSIQY.js","./chunk.RDL6652E.js","./chunk.V3NPUAPB.js","./chunk.XOZU4OFA.js","./chunk.IT763BYH.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.T2RME6XF.js","./chunk.SOTB6C5A.js","./chunk.TQCRFZ53.js","./chunk.6HLKAUWF.js","./chunk.FCUDBMGC.js","./chunk.KMEKMCKG.js","./chunk.GZHZLJBF.js","./chunk.E5XNQTEU.js","./chunk.OJGHDWI6.js","./chunk.K5YLQAFW.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.2BLRCT3E.js"))),ho=Te(()=>(__graviewPreload(import.meta.url,["./chunk.GNQW4JOG.js","./chunk.USB6B6L3.js","./chunk.AZUTYY2S.js","./chunk.45VIF2SX.js","./chunk.IUQOSPQX.js","./chunk.UGFDSE37.js","./chunk.PXQVXBNG.js","./chunk.VYW7DSUW.js","./chunk.LKK7VQBA.js","./chunk.RR2IFETZ.js","./chunk.ONGZ3YQF.js","./chunk.XGCOWCA2.js","./chunk.MORMTKVR.js","./chunk.CU2NQ5WF.js","./chunk.E33EJU3Q.js","./chunk.PJCVFYFU.js","./chunk.7RJGEU3Y.js","./chunk.22MIRLL6.js","./chunk.NFU4UM6F.js","./chunk.DH7M57SE.js","./chunk.AIK3Z25Y.js","./chunk.CKV2QCH5.js","./chunk.BT7RLFPO.js","./chunk.TAJ2R44N.js","./chunk.VLBY66PB.js","./chunk.BJUUSIQY.js","./chunk.RDL6652E.js","./chunk.V3NPUAPB.js","./chunk.XOZU4OFA.js","./chunk.IT763BYH.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.T2RME6XF.js","./chunk.SOTB6C5A.js","./chunk.TQCRFZ53.js","./chunk.6HLKAUWF.js","./chunk.FCUDBMGC.js","./chunk.KMEKMCKG.js","./chunk.GZHZLJBF.js","./chunk.E5XNQTEU.js","./chunk.OJGHDWI6.js","./chunk.K5YLQAFW.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.DZYLH5IM.js"))),Lr=pt(()=>Jt(Cr().then(e=>e.SceneFace)),{what:"This view"}),Mr=pt(()=>Cr().then(e=>e.SceneKeeping),{quiet:!0}),Hr=pt(()=>Jt(mo().then(e=>e.PagesContent)),{what:"This page"}),Dr=pt(()=>Jt(ho().then(e=>e.PictureFace)),{what:"This picture"}),yo=Lr.Face,go=Mr.Face,wo=Hr.Face,vo=Dr.Face;function Ve(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Vr));return Promise.all([...[...o].map(i=>i.fetch()),Zn()]).then(()=>{},()=>{})}var Vr=e=>e==="pages"?[Hr]:e==="picture"?[Dr]:[Lr,Mr],Br=e=>Vr(e).every(n=>n.here()),bo=150,Ut=0;function xr(e,n){if(Br(e))return n();let o=++Ut,i=()=>{o===Ut&&(Ut+=1,n())};Ve(e).then(i),setTimeout(i,bo)}var So=768;function Po(e,n){let o=n!==null&&n>=So;(0,d.useEffect)(()=>{if(!o||e==="picture")return;let i=e==="pages"?"scene":"pages";if(Br(i))return;let c=globalThis,l=()=>void Ve(i),S=()=>{},p=Un(()=>{if(c.requestIdleCallback&&c.cancelIdleCallback){let w=c.requestIdleCallback(l,{timeout:4e3});S=()=>c.cancelIdleCallback?.(w)}else{let w=setTimeout(l,1500);S=()=>clearTimeout(w)}});return()=>(p(),S())},[e,o])}function ko({asked:e,shown:n,onDrawn:o}){return(0,d.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function Ao({auto:e,scene:n}){return(0,g.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${It}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var Eo=Ht(Te(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,g.jsx)(e.StudioPlace,{...n}),{quiet:!0});function $r(e,n,o,i,c){return $t(e,sr(n?ct(n):c??Mn,i),o)}function Yt(e){return e&&ct(e).overview?"graview":"scene"}function Fr(e,n){if(n.homeView?.()===void 0)return!1;let o=e.pages?.first?.trim();return o===void 0||o===""||o==="/"||o.toLowerCase()==="home"}function Nr(e){let[,n]=(0,d.useState)(!1),o=(0,d.useCallback)(()=>n(!0),[]),i=(0,d.useRef)(!1);return e.at&&!mt?(0,g.jsx)(Gt,{onReady:o,fetch:Qt}):!i.current&&Rr(e.draftView)?(0,g.jsx)(Gt,{onReady:o,fetch:zt}):(i.current=!0,(0,g.jsx)(Ro,{...e}))}function Ro(e){let{app:n,stop:o,bar:i=!0,standing:c="Everything is in order",principal:l,heading:S=2}=e,{rootRef:p,scope:w,css:E,scheme:T,store:P,presence:k,brand:F,auto:v,height:_}=pr(e),de=Tr(e.draftView),D=ur(e,rr,de.over),[ie]=(0,d.useState)(_n),f=e.basePath===void 0?{}:{basePath:e.basePath},[V]=(0,d.useState)(Dt),j=e.notices??V,Z=h=>xt(h,f),x={...e.routing?{routing:e.routing}:{},...f},[me]=(0,d.useState)(()=>{let h=e.at?.face;if(h)return h;let Q=o===void 0&&Fr(n,D)?"pages":Yt(o),K=Bt({...x,face:Q});return e.face===void 0&&e.onOpening?.(K),K}),[B,R]=(0,d.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&or(x)&&Fr(n,D)),he=(0,d.useRef)(e.onFace);he.current=e.onFace,(0,d.useLayoutEffect)(()=>{B&&(he.current?.("pages"),R(!1))},[B]);let L=B?"pages":e.face??me,O=n.schema.kinds,C=e.routing==="address",H=(0,d.useMemo)(()=>e.at?mt.settleAt(e,P.seenBy(l??{kind:"human"}),D.places()):void 0,[]),X=(0,d.useMemo)(()=>$n(D,n.schema),[D,n.schema]),q=(0,d.useMemo)(()=>{let h=H?.stop??(C?ar(e.basePath):void 0)??o;return L==="scene"&&h===void 0&&X===void 0&&(e.path===void 0||Kt(e.path))?Nt(void 0):$r(L,h,O,D.places(),X)},[]),[ye]=(0,d.useState)(L);(0,d.useEffect)(()=>{ye!=="pages"&&Bn(D)},[ye,D]);let $=(0,d.useRef)(void 0),Fe=h=>h===void 0||Kt(h)?"/":h;$.current??={path:Fe(H?.path??(C?L==="pages"?(Ft(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==$.current.asked&&($.current={path:Fe(e.path),asked:e.path});let M=(0,d.useRef)(e.onNavigate);M.current=e.onNavigate;let ee=(0,d.useCallback)((h,Q)=>{$.current.path=h,M.current?.(h,Q)},[]),{at:te,setAt:N,steering:Se,steer:J}=wr($.current.path),z=(0,d.useContext)(Wr);z&&(z.pages=()=>$.current.path);let G=(0,d.useRef)(void 0),le=(0,d.useCallback)(h=>void($.current.path=h),[]),ne=Yn(p),[Oe,Pe]=(0,d.useState)(!1),se=e.pagesBelow!==void 0&&ne!==null&&ne<e.pagesBelow&&(L==="scene"||L==="graview")&&!Oe,A=se?"pages":L,Ce=(0,d.useRef)(!1);Ce.current=Oe&&e.pagesBelow!==void 0&&ne!==null&&ne<e.pagesBelow&&(L==="scene"||L==="graview"),z&&(z.shown=A);let Le=(0,d.useRef)(L==="graview"?"graview":"scene");(A==="scene"||A==="graview")&&(Le.current=A),(0,d.useState)(()=>{if(!C||typeof window>"u"||A==="pages"||A==="picture")return;let{pathname:h,search:Q,hash:K}=window.location;Ft(h,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${Z(Re)}${Q}${K}`)}),fr(p,A,e.onIntrinsicHeight),Po(A,ne);let re=vr(e.onError,A),Me=br(e.onReady,A),ke=(0,d.useRef)(e.onFaceDrawn);ke.current=e.onFaceDrawn;let Ye=(0,d.useCallback)((h,Q)=>{Me(Q),ke.current?.(h)},[Me]),[Be,wt]=(0,d.useState)(null),Qe=D.places(),$e=(0,d.useRef)({shown:A,onFace:e.onFace});$e.current={shown:A,onFace:e.onFace};let W=(0,d.useCallback)((h,Q,K)=>{if(C){G.current?.(h,Q,K);return}$e.current.onFace?.(h),M.current?.(h==="pages"?Q??$.current.path:Re,"push")},[C]),[ge,U]=(0,d.useState)(void 0);(0,d.useEffect)(()=>{A==="pages"&&U(void 0)},[A]);let Ne=(0,d.useRef)(o);(0,d.useEffect)(()=>{Ne.current!==o&&(Ne.current=o,U(void 0))},[o]);let Ae=(0,d.useCallback)(h=>{if($e.current.shown==="pages"){if(Pe(!0),U(h),L==="scene"||L==="graview"){xr(L,()=>{C?window.history.pushState(null,"",`${Z(Re)}${h??""}`):M.current?.(Re,"push")});return}xr(Le.current,()=>W(Le.current,void 0,h))}},[C,L,e.basePath,W]),He=(0,d.useCallback)(h=>{if($e.current.shown==="pages"){Se.go.current||($.current.path=h),J(h);return}if($.current.path=h,N(h),Ce.current){Pe(!1),C?window.history.pushState(null,"",Z(h)):M.current?.(h,"push");return}W("pages",h)},[Se,J,N,W,C,e.basePath]),ze=D.arrangement?.(),ue=A==="pages",Ee=e.hrefOf,We=Ee??(C?Z:void 0),Y=(0,d.useMemo)(()=>({open:He,...Ee?{href:Ee}:C?{href:h=>xt(h,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[He,C,e.basePath,Ee]);return(0,g.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":A,"data-graview-scheme":T,...se?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:_,minHeight:v?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,g.jsx)("style",{children:E}),(0,g.jsxs)(Jn.Provider,{value:re,children:[(0,g.jsx)(mr,{rootRef:p,board:j}),(0,g.jsx)(lr,{rootRef:p,firstLook:e.firstLook,app:er(F??{name:n.name},n.schema)}),(0,g.jsx)(Ue,{module:"@graview/react",report:re,content:!0,children:(0,g.jsx)(In.Provider,{value:ie,children:(0,g.jsx)(Vn,{store:P,views:D,initialView:q,scheme:T,...hr(e,k,F),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,g.jsxs)(Qn.Provider,{value:j,children:[(0,g.jsx)(Oo,{face:A,stop:ge??o,kinds:O,places:Qe,opens:X}),z?(0,g.jsx)(To,{into:z}):null,(0,g.jsx)(xo,{rootRef:p,face:L,shown:A,path:te,stop:o,draft:de.n,onDrawn:e.onDrawn,parts:ie}),C?(0,g.jsx)(ir,{pagesWere:H?.path,basePath:e.basePath,shown:A,onFace:e.onFace,toggle:G,kinds:O,places:Qe,opens:X,landed:le}):null,i&&A!=="picture"?(0,g.jsx)(Ue,{module:"@graview/embed",report:re,children:(0,g.jsx)(yr,{name:F?.name??n.name,heading:S,named:Wt(i).name!==!1,faces:Wt(i).faces===!1?void 0:{scene:{label:Fn(ze),current:!ue,go:()=>Ae(),reach:()=>void Ve(Le.current)},pages:{label:On(ze),current:ue,go:()=>He($.current.path),reach:()=>void Ve("pages")}},at:ue?te:null,without:e.pages?.without(),home:{...We?.("/")!==void 0?{href:We("/")}:{},go:()=>He("/"),current:ue&&te.split("?")[0]==="/"},reach:{...We?{href:We}:{},go:h=>He(h.path)},standing:c,hostActions:e.hostActions,keeping:ue?void 0:(0,g.jsx)(Co,{app:n,studio:e.studio,report:re}),onFind:wt,switch:e.switch})}):null,(0,g.jsx)(Xn.Provider,{value:Be,children:(0,g.jsx)(Ue,{module:A==="pages"||A==="picture"?"@graview/pages":"@graview/react",report:re,content:!0,children:(0,g.jsxs)(d.Suspense,{fallback:(0,g.jsx)(Ao,{auto:v,scene:A!=="pages"&&A!=="picture"}),children:[A==="picture"?(0,g.jsx)(vo,{scope:w,store:P,views:D,as:(o?ct(o).within?.view:void 0)??""}):A==="pages"?(0,g.jsx)(wo,{store:P,views:D,presence:k,auto:v,brand:F,steering:Se,overview:Ae,scope:w,titleLevel:gr(S),quickAsk:Vt(e.quickAsk),props:{...e,onNavigate:ee,...C?{}:{path:$.current.path}}}):(0,g.jsx)(Kn.Provider,{value:Y,children:(0,g.jsx)(yo,{address:C,auto:v,scheme:T,scope:w,quickAsk:Vt(e.quickAsk)})}),(0,g.jsx)(ko,{asked:L,shown:A,onDrawn:Ye})]})},A)})]})})})})]})]})}var Kt=e=>e.split(/[?#]/)[0]===Re,Wr=(0,d.createContext)(null);function To({into:e}){return e.view=dt().view,null}function xo({rootRef:e,face:n,shown:o,path:i,stop:c,draft:l,onDrawn:S,parts:p}){let{view:w}=dt(),E=o==="scene"||o==="graview",T=st(w),{pan:P,...k}=w,F=w.pan?st(k):T,v={face:n,path:E?Re:o==="picture"?c??"#":i,stop:T};return Ar(e,`${o} ${E?F:v.path} ${l}`,v,S,p),null}var mt,Fo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.MFDSWA2W.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.J3YBEZKE.js"))),Qt=()=>Fo().then(e=>void(mt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(Qt));function Oo({face:e,stop:n,kinds:o,places:i,opens:c}){let{view:l,go:S}=dt(),p=(0,d.useRef)({face:e,stop:n});return(0,d.useLayoutEffect)(()=>{let w=p.current.stop!==n,E=p.current.face!==e,T=p.current.face==="pages";if(p.current={face:e,stop:n},!w&&!E||e==="pages"||e==="picture")return;let P=(w||T)&&n!==void 0?$r(e,n,o,i):T&&cr(l)?$t(e,Nt(c),o):e==="graview"?Lt(l,!0):l.overview?Hn(Lt(l,!1),tr(l,o)):l;S(P)},[e,n,o,l,S,c]),null}function Co({app:e,studio:n,report:o}){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Suspense,{fallback:null,children:(0,g.jsx)(go,{})}),n!==!1?(0,g.jsx)(Ue,{module:"@graview/studio",report:o,children:(0,g.jsx)(Lo,{app:e,studio:n})}):null]})}function Lo({app:e,studio:n}){let o={app:e,within:"box",...n?{onApply:n.onApply}:{},...n?.landmark?{landmark:n.landmark}:{},...n?.offered!==void 0?{offered:n.offered}:{}},i=n?.place;return i?(0,g.jsx)(i,{...o}):(0,g.jsx)(d.Suspense,{fallback:null,children:(0,g.jsx)(Eo,{...o})})}function Mo({path:e,stop:n,...o},i){return{...o,app:i.app,at:i.at,remote:i.remote,...i.remote.presence?{presence:i.remote.presence}:{}}}function Zt(e,n){let o=n.store??n.remote?.store??dr(n.app,n.seed),i=n.notices??Dt(),c=null,l={},S=0,p=n.label,w=n.app,E=Promise.resolve(),T=n.at?.face??n.face,P=T===void 0?void 0:Bt({...n,face:T}),k=P??Yt(n.stop),F=null,v=[],_=f=>{if(F=f,f!==k)return;let V=v;v=[];for(let j of V)j()};function de(){let[f,V]=(0,d.useState)(P),[j,Z]=(0,d.useState)(n.stop),[x,me]=(0,d.useState)(n.path),[B,R]=(0,d.useState)(n.scheme??"auto"),[he,L]=(0,d.useState)(n.principal),[O,C]=(0,d.useState)(n.seats),[H,X]=(0,d.useState)(n.quickAsk),[q,ye]=(0,d.useState)(n.people),[$,Fe]=(0,d.useState)(n.hostContext),[M,ee]=(0,d.useState)(n.brand),[te,N]=(0,d.useState)(n.whileAway),[Se,J]=(0,d.useState)(n.label),[z,G]=(0,d.useState)(n.hostActions),[le,ne]=(0,d.useState)(void 0),[Oe,Pe]=(0,d.useState)(n.draftView);return c={app:se=>{ne(se),me(void 0),Z(void 0)},face:V,stop:Z,path:me,scheme:R,seat:L,seats:C,quickAsk:X,people:ye,hostContext:Fe,brand:ee,whileAway:N,label:J,hostActions:G,draft:Pe},(0,g.jsx)(Wr.Provider,{value:l,children:(0,g.jsx)(Nr,{...le?Mo(n,le):n,store:o,notices:i,...f!==void 0?{face:f}:{},onOpening:se=>{k=se},...j!==void 0?{stop:j}:{},...x!==void 0?{path:x}:{},...he?{principal:he}:{},...O?{seats:O}:{},...H!==void 0?{quickAsk:H}:{},...q?{people:q}:{},...$?{hostContext:$}:{},...M?{brand:M}:{},whileAway:te,label:Se,hostActions:z,draftView:Oe,scheme:B,onFace:se=>{k=se,V(se)},onSeat:L,onFaceDrawn:_},le?.n??0)})}let D=()=>{let f=l.view?.focusId,V=f?o.graph.getNode(f)?.kind:void 0,j=(l.shown??k)==="scene"||(l.shown??k)==="graview";return{face:k,path:j?Re:l.pages?.()??n.path??"/",stop:l.view?st(l.view):n.stop??"#",...V?{kind:V}:{}}},ie=(0,Or.createRoot)(e);return(0,I.flushSync)(()=>ie.render((0,g.jsx)(de,{}))),{get store(){return o},where:D,setApp:(f,V,j)=>{let Z="graph"in V?{store:V}:V,x=()=>{let me=D();o=Z.store,p=j?.label??(p===w.name?f.name:p),w=f,(0,I.flushSync)(()=>{c?.label(p),c?.app({app:f,remote:Z,at:me,n:++S})})};mt?x():E=E.then(Qt).then(x)},setFace:f=>{k=f,(0,I.flushSync)(()=>c?.face(f))},setStop:f=>(0,I.flushSync)(()=>c?.stop(f)),setPath:f=>(0,I.flushSync)(()=>{if(Kt(f)){(k==="pages"||k==="picture")&&(k="scene",c?.face("scene"));return}c?.path(f),k!=="pages"&&(k="pages",c?.face("pages"))}),setScheme:f=>(0,I.flushSync)(()=>c?.scheme(f)),setSeat:f=>(0,I.flushSync)(()=>c?.seat(f)),setSeats:f=>(0,I.flushSync)(()=>c?.seats(f)),setQuickAsk:f=>(0,I.flushSync)(()=>c?.quickAsk(f)),setPeople:f=>(0,I.flushSync)(()=>c?.people(f)),setHostContext:f=>(0,I.flushSync)(()=>c?.hostContext(f)),setBrand:f=>(0,I.flushSync)(()=>c?.brand(f)),setWhileAway:f=>(0,I.flushSync)(()=>c?.whileAway(f)),setDraftView:f=>(0,I.flushSync)(()=>c?.draft(f)),setLabel:f=>{p=f,(0,I.flushSync)(()=>c?.label(f))},setHostActions:f=>(0,I.flushSync)(()=>c?.hostActions(f)),drawn:()=>E.then(()=>F===k?void 0:new Promise(f=>v.push(f))),notify:f=>{let V;return(0,I.flushSync)(()=>{V=i.notify(f)}),V},unmount:()=>ie.unmount()}}var ht=e=>`s${(e+1).toString(36)}`;var Ir="/graview/friction";var _r="/graview/live",Xt="graview.ship",en=`${Xt}.${ot}`;var be={seat:"x-graview-seat",roles:"x-graview-roles",kind:"x-graview-kind",name:"x-graview-name",for:"x-graview-for",forRoles:"x-graview-for-roles",forName:"x-graview-for-name",via:"x-graview-via"};var je=class extends Error{constructor(n){super(n),this.name="Superseded"}},xe=e=>e?.lineage?{lineage:e.lineage}:{},Ho=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
2
+ `)[0]??"":String(n)})`;function Do(e){if(!e)return[];try{let n=e.storage.getItem(e.key);if(n===null)return[];e.storage.removeItem(e.key);let o=JSON.parse(n);return Array.isArray(o)?o.filter(i=>!!i&&Array.isArray(i.calls)):[]}catch{return[]}}var qe=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},Vo={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},pe=class extends Error{constructor(o,i){super(o);this.conflicts=i;this.name="StaleWrite"}},Je=class extends Error{constructor(n){super(n),this.name="Unreached"}},Bo=new Set([502,503,504]);async function $o(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function No(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Wo=1,Io=()=>({refusals:new Set,conflicts:new Set,statuses:new Set,helds:new Set,builds:new Set,who:new Set,declarations:new Set,tally:{reconnects:0,rebases:0,conflicts:0,resyncs:0}});async function yt(e){return(await jr(e,Do(e.carry),"This app was updated while your changes were on the way.",Io())).remote}async function jr(e,n,o,i){let c=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},S={...gt(e.principal),[be.via]:e.via??"web"};Object.assign(l,S);let p=e.live===!0,w=e.presenceEveryMs,E=e.visible??qo,T="connecting",P=i.statuses,k=i.tally,F=[],v,_=[],de=()=>T==="online"&&v!==void 0?"held":T,D=()=>{let t=de();if(i.told!==t){i.told=t;for(let r of[...P])r(t)}},ie=t=>{if(!(t===T||ce)&&(T==="offline"&&t==="online"&&k.reconnects++,T=t,D(),t==="online"))for(let r of F.splice(0))r.again()},f=t=>{if(ce)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==v;if(v=r,V(),!!s&&(D(),r===void 0)){for(let a of _.splice(0))a();oe&&clearTimeout(oe),an()}},V=()=>{if(i.toldHeld!==v){i.toldHeld=v;for(let t of[...i.helds])t(v??null)}},j=async(t,r)=>{let s;try{s=await c(t,r)}catch(a){throw Y()||ie("offline"),new Je(a instanceof Error?a.message:String(a))}if(s.status===503&&await $o(s))return ie("online"),s;if(Bo.has(s.status))throw Y()||ie("offline"),new Je(`The server is away (${s.status})`);return ie("online"),s},Z=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${_e.op}`,s=t?await c(r,{headers:l}):await j(r,{headers:l});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},x=e.state??await Z(!0);p||(T="online"),v=typeof x.held=="string"&&x.held.length>0?x.held:void 0,V();let me=x.enabledModules??e.enabledModules,B=e.localApp?e.localApp(e.app):e.app,R=new xn({schema:B.schema,mutations:B.mutations??[],invariants:B.invariants??[],...B.policy?{policy:B.policy}:{},...B.publishing?{publishing:B.publishing}:{},...B.modules?{modules:B.modules}:{},...me?{enabledModules:me}:{},...B.intelligence?{intelligence:B.intelligence}:{},...B.brand?.timeZone?{timeZone:B.brand.timeZone}:{},snapshot:x.snapshot,log:x.log,...x.horizon!==void 0?{horizon:x.horizon}:{},ids:No(),...e.storeOptions??{}});kn.served.add(R);let he=e.friction!==!1&&e.principal?.kind!=="visitor";he&&An(R,t=>{he&&c(`${e.url}${Ir}`,{method:"POST",headers:l,body:JSON.stringify({event:t})}).then(r=>void(he=r.status!==404&&r.status!==410),()=>{})});let L=Rn(R),O=x.log.at(-1)?.seq??(x.horizon??0)-1,C=Tt.of(x.log,{horizon:x.horizon??0}),H=null,X,q=new Map,ye=i.who,$=!1,Fe=t=>{if(ce)return;$=!0;let r=Cn(new Map,t,Date.now(),Ot,H?.participant);X!==void 0&&r.delete(X);let s=r.size!==q.size;if(!s)for(let[a,u]of r)Ct(u,q.get(a))||(s=!0);if(q=r,!!s)for(let a of[...ye])a([...q.values()])},M=[],ee=new Set,te=t=>{let r=M.indexOf(t);r>=0&&M.splice(r,1)},N=new Map,Se=(t,r)=>{let s=N.get(t);s&&(N.delete(t),s.resolve({ops:r.filter(a=>a.batch===t),batch:t}))},J,z=[],G=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(J)return z.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(m=>m.seq>O).map(m=>m.seq));if(Number.isFinite(s)&&s>O+1)return z.push({ops:t,drop:r}),le(),[];let a=M.filter(m=>t.some(ae=>ae.batch===m)),u=[...new Set([...r,...a])].filter(m=>ee.has(m)),y,b=M.filter(m=>!a.includes(m));try{y=R.rebase({confirmed:t,pending:b,drop:u}).confirmed}catch(m){if(!(m instanceof Tn))throw m;return z.push({ops:t,drop:r}),le(),[]}for(let m of a)te(m);t.some(m=>m.seq>O)&&b.some(m=>!u.includes(m))&&k.rebases++,t.length>0&&(O=Math.max(O,...t.map(m=>m.seq)),C.note(t));for(let m of u)ee.delete(m);for(let m of a)Se(m,t);return y},le=()=>{J||(J=ke(Z().then(t=>{if(ne(t)){z=[];return}let r=new Set(t.log.map(u=>u.batch)),s=M.filter(u=>r.has(u));for(let u of s)te(u);let a=R.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...M],drop:[...ee].filter(u=>!M.includes(u))});ee.clear();for(let u of a.pending)ee.add(u.batch);O=t.log.at(-1)?.seq??(t.horizon??0)-1,C=Tt.of(t.log,{horizon:t.horizon??0}),k.resyncs++;for(let u of s)Se(u,t.log)}).then(()=>{J=void 0;let t=z;z=[];for(let{ops:r,drop:s}of t)G(r,s)},()=>{J=void 0,z=[]})))},ne=t=>(typeof t.build=="string"&&cn(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===x.version?!1:(St(t.version),!0)),Oe=async t=>{let s=await(await j(`${e.url}/graview/since?seq=${ht(t)}&opFormat=${_e.op}`,{headers:l})).json();return ne(s)?[]:s.reset===!0?(le(),[]):s.ops??[]},Pe=async()=>{let t=await se();return J&&await J,t},se=async()=>{if(H&&!Y()&&E()){let r=await(await j(`${e.url}/graview/here?opFormat=${_e.op}`,{method:"POST",headers:l,body:JSON.stringify({presence:H,seq:ht(O)})})).json();return ne(r)?[]:(typeof r.participant=="string"&&(X=r.participant),Fe(r.who??[]),G(r.ops??[]))}return G(await Oe(O))},A=new Map,Ce=new Map,Le=new Set,re=new Map,Me=new Set,ke=t=>(Me.add(t),t.finally(()=>Me.delete(t)).catch(()=>{}),t),Ye=Promise.resolve(),Be=0,wt=(t,r)=>{let s=Ye.then(()=>$e(t,r));return Ye=s.catch(()=>{}),s},Qe=()=>new Promise((t,r)=>F.push({again:t,give:r})),$e=async(t,r)=>{let s,a;for(;;){try{s=await j(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:_e.op})})}catch(m){if(!(m instanceof Je)||U)throw m;if(await Qe(),Y())return Ze(t,r);continue}if(a=await s.json().catch(()=>({})),s.status===503&&a.reason==="unavailable"&&typeof a.held=="string"&&!U){if(typeof a.version=="number"?ne(a):(f(a.held),!1))break;if(v!==void 0&&(Et>0||p)){if(await new Promise(m=>_.push(m)),U)throw new je("The client closed.");if(Y())return Ze(t,r);continue}}let b;if(s.status===503&&a.reason==="unavailable"&&!U)b=tn(e.backoff,Be++);else{if(Be=0,s.status!==429||U)break;b=_o(s.headers.get("retry-after"),a.retryAfter)}if(await new Promise(m=>setTimeout(m,b)),Y())return Ze(t,r)}if(ce||ne(a))throw new je("The app was changed.");if(!s.ok){let b=a.error??`The server refused (${s.status})`;throw a.conflict?new pe(b,a.conflicts??[]):new qe({reason:a.reason??Vo[s.status]??"invalid",sentence:b,...a.wouldNeed?.length?{wouldNeed:a.wouldNeed}:{}})}let u=a.ops??[],y=u[0]?.seq;return y!==void 0&&y>O+1&&(u=await Oe(O)),r!==void 0&&(a.batch&&A.set(r,a.batch),te(r)),G(u,r!==void 0?[r]:[]),{ops:a.ops??[],...a.batch?{batch:a.batch}:{}}},W,ge=!1,U=!1,Ne=0,Ae,He=0,ze=0,ue=null,Ee=()=>{},We=new Promise(t=>{Ee=t}),Y=()=>p&&ge&&W?.readyState===Wo,h=t=>{if(!Y())return!1;try{return W.send(JSON.stringify(t)),!0}catch{return!1}},Q=(t=!1)=>{!H||!Y()||!E()||!t&&ue&&Ct(H,ue)&&(w===void 0||Date.now()-ze<w)||h({t:"here",presence:H})&&(ue=H,ze=Date.now())},K=new Set,oe,an=()=>{if(oe=void 0,v!==void 0)return;let t=[...N.entries()].filter(([r])=>K.has(r));K.clear();for(let[,r]of t)h(r.message)},sn=(t,r)=>{N.has(t)&&(K.add(t),oe&&clearTimeout(oe),oe=setTimeout(an,Math.max(0,r)))},Gr=t=>{N.has(t)&&K.add(t)},Ze=(t,r)=>new Promise((s,a)=>{let u=r??`send-${++He}`,y=t.undo?{t:"undo",cid:u,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...xe(t)}:{t:"call",cid:u,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...xe(t)};if(N.set(u,{message:y,...r!==void 0?{mine:r}:{},resolve:s,reject:a}),K.size>0||v!==void 0){K.add(u);return}h(y)}),Xe=(t,r)=>Y()?Ze(t,r):wt(t,r),Ur=t=>{switch(t.t){case"welcome":{if(cn(t.build),typeof t.version=="number"&&t.version!==x.version){St(t.version);return}if(ge=!0,Ne=0,typeof t.participant=="string"&&(X=t.participant),f(t.held),t.state?le():G(t.ops??[]),K.clear(),oe&&clearTimeout(oe),oe=void 0,v!==void 0)for(let r of N.keys())K.add(r);else for(let r of N.values())h(r.message);Q(!0),ie("online"),Ee();return}case"ops":G(t.ops??[]);return;case"ack":{let r=N.get(t.cid);if(!r){G(t.ops??[]);return}N.delete(t.cid),Be=0,r.mine!==void 0&&(A.set(r.mine,t.batch),te(r.mine)),G(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=N.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){v!==void 0?Gr(t.cid):sn(t.cid,tn(e.backoff,Be++));return}N.delete(t.cid),r.reject(t.t==="conflict"?new pe(t.sentence,t.conflicts??[]):new qe({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&sn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":Fe(t.who??[]);return;case"held":f(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==x.version&&St(t.version);return;case"reload":fn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&W){let r=W;mn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},ce=!1,vt=i.declarations,bt=i.builds,cn=t=>{if(!(ce||i.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){i.otherBuild=t;for(let r of[...bt])r(t)}},dn=()=>{let t=[],r=0;for(let s of M){let a=re.get(s);a?t.push({calls:a.calls,...a.intent?{intent:a.intent}:{},...a.via?{via:a.via}:{},...xe(a),batch:s}):r++}return{carried:t,undos:r}},ln=(t,r)=>`${r} while ${t===1?"an undo of yours was":"undos of yours were"} on the way; ${t===1?"it was":"they were"} not made.`,un=t=>{ce=!0,H=null;let r=new je(t);for(let a of N.values())a.reject(r);N.clear(),nt&&clearInterval(nt),U=!0,Ae&&clearTimeout(Ae),oe&&clearTimeout(oe),we&&clearTimeout(we);for(let a of F.splice(0))a.give(r);for(let a of _.splice(0))a();let s=W;W=void 0,ge=!1;try{s?.close(1e3,t)}catch{}Ee()};async function St(t){if(ce)return;if(!e.resolveApp){fn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=dn(),a=e.resolveApp,u=H;un("The app was changed.");try{let y=await a(t),{state:b,...m}=e,ae=await jr({...m,app:y},r,"The app was changed while your changes were on the way.",i);u&&ae.remote.presence.here(u);for(let rt of[...vt])rt(ae.remote,t);let fe=[...s>0?[et(ln(s,"The app was changed"))]:[],...ae.unheard()];for(let rt of fe)for(let to of Ie)to(rt.sentence,rt)}catch(y){let b=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let m of Ie)m(b,et(b))}}function fn(t){if(ce)return;let{carried:r,undos:s}=dn();un(t);let a=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),a=!0}catch{}let u=[];!a&&r.length>0&&u.push(`${t} ${r.length===1?"A change of yours was":`${r.length} changes of yours were`} not sent; make ${r.length===1?"it":"them"} again after the page reloads.`),s>0&&u.push(ln(s,"This app was updated"));for(let y of u)for(let b of Ie)b(y,et(y));(e.reloadPage??jo)()}let pn=()=>{if(U||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${_r}`,{"content-type":r,...s}=l,a;try{a=e.socket?e.socket(t,s,[en]):eo(t,s)}catch{return hn()}W=a,ge=!1,a.onopen=()=>{W===a&&a.send(JSON.stringify({t:"hello",seq:ht(O),protocol:ot,wire:Xt,opFormat:_e.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},a.onmessage=u=>{if(W!==a)return;let y;try{y=JSON.parse(String(u.data))}catch{return}Ur(y)},a.onclose=()=>mn(a),a.onerror=()=>{}},we,Kr=()=>{$=!1,we&&clearTimeout(we),we=setTimeout(()=>{if(we=void 0,$||U)return;let t=new Map([...q].filter(([,r])=>r.held!=="socket"));if(t.size!==q.size){q=t;for(let r of ye)r([...q.values()])}},Ot),we.unref?.()};function mn(t){if(W!==t)return;let r=ge;W=void 0,ge=!1,ue=null,r&&(ie("offline"),Kr()),hn()}let hn=()=>{if(U)return;let t=tn(e.backoff,Ne);Ne++,Ae=setTimeout(pn,t)},yn=R.applyAll.bind(R),Jr=R.undo.bind(R),Yr=R.previewAll.bind(R);R.previewAll=(t,r)=>Yr(t,{...e.principal?{author:e.principal}:{},...r});let Ie=i.refusals,Ge=[],et=t=>({reason:"invalid",sentence:t}),tt=i.conflicts,Pt=!1,gn,kt=async(t,r)=>{if(r instanceof je||ce)return;let s=r instanceof qe?r.refusal:Sn(r),a=s.sentence,u=r instanceof pe?gn?.yoursOf(R,re.get(t)?.calls??[]):void 0;te(t);try{G([],[t])}catch{}let y=re.get(t);re.delete(t);let b=y?.calls[0];if(b&&!(r instanceof pe)){let m=R.allMutations().find(fe=>fe.name===b.name)?.subject?.arg,ae=m&&R.graph.getNode(b.args[m])?.kind;En(R,{type:"refused",act:b.name,code:s.reason,...ae?{kind:ae}:{}},e.principal)}if(r instanceof pe&&k.conflicts++,r instanceof pe&&!Y()&&await Pe().catch(()=>[]),r instanceof pe&&J&&await J,r instanceof pe&&tt.size>0){let m=!1,ae={sentence:a,conflicts:u?r.conflicts.map(fe=>fe.node===u.node&&fe.field===u.field?{...fe,yours:u.yours}:fe):r.conflicts,keepTheirs(){m=!0},useMine(){if(!(m||!y)){m=!0,Pt=!0;try{R.applyAll(u?[u.over(O)]:y.calls,{...y.intent?{intent:y.intent}:{},...y.via?{via:y.via}:{},...xe(y)})}finally{Pt=!1}}}};for(let fe of tt)fe(ae);return}for(let m of Ie)m(a,s)},Qr=(t,r)=>t.flatMap(s=>s.mutation?.name===bn?[]:s.primitives.flatMap(a=>a.op==="splice-text"&&!r.has(a.id)&&!r.has(`${a.id}\0${a.field}`)?[{node:a.id,field:a.field,rev:O}]:[]));R.applyAll=(t,r)=>{let s=Pn(R.log.all().filter(b=>ee.has(b.batch))),a=yn(t,{...e.principal?{author:e.principal}:{},...r}),u=t.map((b,m)=>{let ae=a.minted?.[m];return ae===void 0||b.args?.id!==void 0?b:{...b,mintedHint:ae}});M.push(a.batch),ee.add(a.batch),re.set(a.batch,{calls:u,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...xe(r)});let y=Pt?[]:[...C.baseFor(a.ops,s,(b,m)=>R.collaborative(b,m)),...Qr(a.ops,s)];return Ce.set(a.batch,ke(Xe({calls:u,...r?.intent?{intent:r.intent}:{},batch:a.batch,...y.length>0?{base:y}:{},...r?.via?{via:r.via}:{},...xe(r)},a.batch).catch(b=>kt(a.batch,b)))),a},R.apply=(t,r)=>R.applyAll([t],r),R.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,a=Jr(s.map(y=>A.get(y)??y),{...e.principal?{author:e.principal}:{},...r});M.push(a.batch),ee.add(a.batch);let u=Promise.allSettled(s.map(y=>Ce.get(y)));return Ce.set(a.batch,ke(u.then(()=>{let y=s.filter(b=>!Le.has(b));if(y.length===0){te(a.batch),re.delete(a.batch),G([],[a.batch]);return}return Xe({undo:y.map(b=>A.get(b)??b),...r?.intent?{intent:r.intent}:{},batch:a.batch,...r?.via?{via:r.via}:{},...xe(r)},a.batch)}).catch(y=>kt(a.batch,y)))),a};let Zr=async(t,r={})=>{At++;try{return(await ke(Xe({calls:t,...r}))).ops}finally{At--}},At=0,wn={here(t){H=t,Q()},onWho(t){return ye.add(t),q.size>0&&t([...q.values()]),()=>{ye.delete(t)}},leave(){if(!H)return;let t=JSON.stringify({participant:X??H.participant});if(H=null,h({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${e.url}/graview/leave`,t):c(`${e.url}/graview/leave`,{method:"POST",headers:l,body:t}).catch(()=>{})}},Et=e.pollMs??800,nt=Et>0&&typeof setInterval=="function"?setInterval(()=>{Y()||Pe().catch(()=>{})},Et):null;if(p){pn();let t;await Promise.race([We,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!ce){let t=[],r=new Set(R.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{R.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...xe(s)})}catch(a){t.push(Ho(s,a))}t.length>0&&Ge.push(et(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let vn=new Map,Xr=()=>({store:R,author:e.principal,appliedAll:yn,pending:M,provisional:ee,asked:re,answers:Ce,letGo:Le,sent:(t,r)=>ke(Xe({calls:r,batch:t},t).catch(s=>kt(t,s))),settle:te,land:G,seen:()=>O,gone:()=>U||ce});return{remote:{store:R,typing(t,r){let s=`${t}\0${r}`,a=vn.get(s);return a||(a=(__graviewPreload(import.meta.url,["./chunk.MJMVGW6Z.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.TAIYNHSW.js")).then(u=>(gn=u,u.typingOf(t,r,u.wireOf(Xr())))),vn.set(s,a)),a},version:x.version,migrated:x.migrated??[],send:Zr,pull:Pe,onRefusal(t){Ie.add(t);let r=Ge;Ge=[];for(let s of r)t(s.sentence,s);return()=>Ie.delete(t)},onDeclaration(t){return vt.add(t),()=>vt.delete(t)},onBuild(t){return bt.add(t),i.otherBuild!==void 0&&t(i.otherBuild),()=>bt.delete(t)},onConflict(t){return tt.add(t),()=>tt.delete(t)},revision:(t,r)=>C.of(t,r),seq:()=>O,participant:()=>X,transport:()=>Y()?"socket":"poll",status:de,onStatus(t){return P.add(t),()=>P.delete(t)},held:()=>v,onHeld(t){return i.helds.add(t),v!==void 0&&t(v),()=>i.helds.delete(t)},counters:()=>({...k}),who:()=>[...q.values()],pending:()=>M.length+At,async settled(){for(;Me.size>0;)await Promise.allSettled([...Me])},presence:wn,close(){nt&&clearInterval(nt),L(),wn.leave(),U=!0,Ae&&clearTimeout(Ae),oe&&clearTimeout(oe),we&&clearTimeout(we);for(let r of F.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of _.splice(0))r();let t=W;W=void 0,ge=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Ge;return Ge=[],t}};function eo(t,r){let s=globalThis.WebSocket;if(!s)throw new Error("This runtime has no WebSocket; the client polls instead.");let a=typeof globalThis.document<"u",u=e.subprotocol?[en]:[];if(!a)try{return new s(t,{headers:r,...u.length>0?{protocols:u}:{}})}catch{}let y=new URL(t);for(let[b,m]of Object.entries(S))y.searchParams.set(b,m);return u.length>0?new s(y.toString(),u):new s(y.toString())}}function _o(e,n,o=Date.now()){let i,c=e?.trim();if(c)if(/^\d+(\.\d+)?$/.test(c))i=Number(c)*1e3;else{let p=Date.parse(c);Number.isFinite(p)&&(i=Math.max(0,p-o))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,S=l!==void 0&&l<50&&i!==void 0&&Math.abs(l*1e3-i)<1e3;return l!==void 0&&!S?l:i??1e3}function jo(){globalThis.location?.reload?.()}function qo(){return globalThis.document?.visibilityState!=="hidden"}function tn(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:i=1e4,factor:c=2}=e??{};return Math.min(i,o*c**n)*(.75+Math.random()*.5)}function gt(e){let n={};if(!e)return n;e.id&&(n[be.seat]=e.id),e.roles?.length&&(n[be.roles]=e.roles.join(",")),e.kind!=="human"&&(n[be.kind]=e.kind),e.name&&(n[be.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[be.for]=o.id),o?.roles?.length&&(n[be.forRoles]=o.roles.join(",")),o?.name&&(n[be.forName]=encodeURIComponent(o.name)),n}var qr="/graview/views";function nn(e){let n=e.fetch??fetch,o=e.url.replace(/\/$/,""),i={"content-type":"application/json",...e.principal?gt(e.principal):{},...e.headers??{}},c=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??at.may}:at,l=new Set,S=P=>{if(JSON.stringify(P)!==JSON.stringify(c)){c=P;for(let k of l)k()}},p=async(P,k)=>{let F=await n(`${o}${e.path??qr}`,{method:P,headers:i,...k!==void 0?{body:JSON.stringify(k)}:{}}),v=await F.json();if(!F.ok)throw new Error(v.error??`The store answered ${F.status}.`);S({hidden:v.hidden??[],removed:v.removed??[],may:v.may??at.may})},w=()=>p("GET"),E=e.state?Promise.resolve():w().catch(()=>{}),T=e.pollMs?setInterval(()=>void w().catch(()=>{}),e.pollMs):void 0;return{ready:E,refresh:w,close:()=>clearInterval(T),current:()=>c,onChange(P){return l.add(P),()=>void l.delete(P)},hide:P=>p("POST",{hide:P}),show:P=>p("POST",{show:P}),remove:(P,k)=>p("POST",{remove:P,...k?{about:k}:{}}),async restore(P){let k=c.removed.find(F=>F.name===P)?.lens;await p("POST",{restore:P}),k&&await e.onDeclaration?.()},async lens(P){await p("POST",{lens:P}),await e.onDeclaration?.()}}}var on=document.getElementById("graview-app"),rn=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),zr=rn?(__graviewPreload(import.meta.url,["./chunk.USB6B6L3.js","./chunk.TAJ2R44N.js","./chunk.XOZU4OFA.js","./chunk.IT763BYH.js","./chunk.2OX4YI46.js","./chunk.XY5EVI22.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SRC37GNP.js")):Ve("pages");try{rn?await zo(decodeURIComponent(rn[1])):await Go()}catch(e){let n=document.createElement("pre");n.setAttribute("role","alert"),n.style.cssText="margin:2rem;font:14px/1.5 ui-monospace,monospace;white-space:pre-wrap",n.textContent=e instanceof Error?e.message:String(e),on.replaceChildren(n),window.__graviewFailed=n.textContent}async function zo(e){let n=await fetch(`/graview/document?form=${encodeURIComponent(e)}`),o=await n.json();if(!n.ok)throw new Error(o.error??`The preview server did not hand over the form (${n.status}).`);let i=await lt(o);if(!i.ok)throw new Error(it(i.findings));let c=i.app,l=o.principal,S=await yt({app:c,url:location.origin,principal:l,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=c.forms?.[e]?.title??c.name;let{mount:p}=await zr;window.__graview=p(on,{app:c,form:e,principal:l,remote:S,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Go(){let e=await fetch("/graview/document");if(!e.ok)throw new Error(`The preview server did not hand over the document (${e.status}).`);let n=await e.json(),i=await(async w=>{if(typeof w.module=="string")return(await import(w.module)).app;let E=await lt(w);if(!E.ok)throw new Error(it(E.findings));return E.app})(n);if(!i||typeof i!="object"||!("schema"in i))throw new Error("The app module the preview server handed does not export an app.");let c=n.principal,l=await yt({app:i,url:location.origin,principal:c,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=i.name;let S,p=nn({url:location.origin,principal:c,...n.views?{state:n.views}:{},onDeclaration:async()=>{let w=await(await fetch("/graview/document")).json();if(typeof w.module=="string")return;let E=await lt(w);E.ok&&S?.setApp(E.app,l)}});await Promise.all([zr,p.ready]),S=Zt(on,{app:i,remote:l,principal:c,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:i.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=S,S.drawn().then(()=>{window.__graviewReady=!0})}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graview",
3
- "version": "0.1.55",
3
+ "version": "0.1.56",
4
4
  "type": "module",
5
5
  "description": "The Graview command line: start a product, check its declaration, write its agent docs, serve its store, preview a document with no product and photograph its places, say whether a product is on one release, host it for an agent over MCP, apply an act to it, sync its seed, install the authoring skills. The tool; @graview/* is the framework.",
6
6
  "keywords": [
@@ -29,11 +29,11 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@graview/guest": "0.1.55",
33
- "@graview/ship": "0.1.55",
34
- "@graview/skills": "0.1.55",
35
- "@graview/core": "0.1.55",
36
- "@graview/tools": "0.1.55"
32
+ "@graview/core": "0.1.56",
33
+ "@graview/guest": "0.1.56",
34
+ "@graview/ship": "0.1.56",
35
+ "@graview/skills": "0.1.56",
36
+ "@graview/tools": "0.1.56"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=22"
@@ -1,104 +0,0 @@
1
- import{a as L,c as O,d as W,f as I}from"./chunk.5D6SIBOK.js";import{a as ae,b as te}from"./chunk.XOZU4OFA.js";import{b as Z,c as ee,d as ne}from"./chunk.QQ3YWKWU.js";import{b as J,c as Q,d as N,j as U,k as X}from"./chunk.5EZDXWOE.js";import{b as V,k as Y,l as _}from"./chunk.MIQMPOWF.js";import{G as de,T as B}from"./chunk.WSMYFEGU.js";import{Bb as K,da as z,ed as $,fa as E,ma as G}from"./chunk.WR63RQGU.js";import{b as T}from"./chunk.AJZBJBMO.js";var y=T(de(),1),a=T(B(),1),se=`
2
- form:where([data-graview-part="form"]) {
3
- /* A grid item of the section above it and a grid container for the
4
- fields below: both halves are allowed to be narrower than what is in
5
- them, or a big enough text size pushes the page sideways. See the note
6
- on \`column\` in pages.tsx. */
7
- display: grid;
8
- grid-template-columns: minmax(0, 1fr);
9
- min-width: 0;
10
- gap: 12px;
11
- }
12
- label:where([data-graview-part="field"]),
13
- div:where([data-graview-part="field"][data-graview-field="date"]) {
14
- display: grid;
15
- /* A track the width it was given: see the note on \`column\` in pages.tsx. */
16
- grid-template-columns: minmax(0, 1fr);
17
- min-width: 0;
18
- gap: 4px;
19
- }
20
- label:where([data-graview-part="field"][data-graview-field="boolean"]) {
21
- grid-auto-flow: column;
22
- justify-content: start;
23
- align-items: center;
24
- }
25
- span:where([data-graview-part="label"]),
26
- legend:where([data-graview-part="label"]),
27
- p:where([data-graview-part="unasked"]) {
28
- font-size: 0.8125rem;
29
- color: var(--graview-ink-muted);
30
- }
31
- p:where([data-graview-part="unasked"]) { margin: 0; }
32
- input:where([data-graview-part="control"]:not([type="checkbox"])),
33
- select:where([data-graview-part="control"]) {
34
- font: inherit;
35
- /* A TARGET IN EVERY ENGINE, not only in the one it was measured in.
36
- Padding and line height alone came to 24 in Chromium and to 22 in
37
- WebKit, which has its own intrinsic metrics for a \`select\` and rounds
38
- nothing up for anybody. So every picker on the routed face was under
39
- the WCAG 2.2 minimum in the browser iOS ships, and the check that says
40
- so (\`verify-pages\`' \`bigEnoughToHit\`) only ever ran there through
41
- \`pnpm engines\`. */
42
- min-height: 24px;
43
- /* NEVER WIDER THAN ITS FIELD. A select is as wide as its longest option,
44
- and a picker over 320 vehicles ("2027 Mercedes-Benz GLE AMG 53 4MATIC+
45
- Coupe") was 618 pixels on a 390 phone, and the whole page scrolled
46
- sideways. It shrinks to its track and cuts the option inside its box. */
47
- min-width: 0;
48
- max-width: 100%;
49
- text-overflow: ellipsis;
50
- box-sizing: border-box;
51
- padding: 7px 10px;
52
- border-radius: 8px;
53
- border: 1px solid var(--graview-edge);
54
- background: var(--graview-panel);
55
- color: var(--graview-ink);
56
- }
57
- /* A PICKER THAT STILL LOOKS LIKE ONE.
58
- WebKit ignores an author's padding and minimum height on a \`select\`
59
- while the native appearance is on \u2014 so every picker on the routed face
60
- came out 22 pixels tall in the browser iOS ships, under the 24 WCAG 2.2
61
- asks for, while the same element measured 35 in Chromium. Turning the
62
- appearance off is what makes the box the size it was asked to be, and it
63
- takes the platform's chevron with it; the chevron is put back, in the ink
64
- the scheme is already using. */
65
- span:where([data-graview-part="picker"]) {
66
- position: relative;
67
- display: grid;
68
- min-width: 0;
69
- }
70
- span:where([data-graview-part="picker"]) > select:where([data-graview-part="control"]) {
71
- appearance: none;
72
- padding-right: 28px;
73
- }
74
- span:where([data-graview-part="chevron"]) {
75
- position: absolute;
76
- right: 10px;
77
- top: 50%;
78
- transform: translateY(-50%);
79
- font-size: 0.75rem;
80
- line-height: 1;
81
- color: var(--graview-ink-muted);
82
- pointer-events: none;
83
- }
84
- fieldset:where([data-graview-part="group"]) {
85
- display: grid;
86
- gap: 10px;
87
- border: 1px solid var(--graview-edge);
88
- border-radius: 10px;
89
- padding: 12px;
90
- }
91
- fieldset:where([data-graview-part="group"][data-graview-field="list"]) { gap: 8px; }
92
- div:where([data-graview-part="item"]) {
93
- display: flex;
94
- gap: 8px;
95
- align-items: end;
96
- }
97
- button:where([data-graview-part="add"]),
98
- button:where([data-graview-part="submit"]) { justify-self: start; }
99
- p:where([data-graview-part="refused"]) {
100
- margin: 0;
101
- color: var(--graview-warn);
102
- font-size: 0.875rem;
103
- }
104
- `;function pe({title:r,name:e,optional:t,amount:o,value:c,onChange:f}){let s=J(o),[S,g]=(0,y.useState)(()=>typeof c=="number"?Q(c,o):""),A=S.trim()!==""&&N(S,o)===void 0;return(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":"number","data-graview-amount":o.format??"unit",children:[(0,a.jsx)("span",{"data-graview-part":"label",children:r}),(0,a.jsxs)("span",{"data-graview-part":"amount",style:{display:"flex",alignItems:"center",gap:6},children:[s.prefix?(0,a.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:s.prefix}):null,(0,a.jsx)("input",{type:"text",inputMode:"decimal",name:e,required:!t,placeholder:s.placeholder,title:s.hint,"aria-invalid":A||void 0,value:S,onChange:u=>{g(u.target.value),f(N(u.target.value,o))},"data-graview-part":"control",style:{flex:1,minWidth:0}}),s.suffix?(0,a.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:s.suffix}):null]}),A?(0,a.jsxs)("span",{"data-graview-part":"hint",role:"status",children:["Not an amount ",s.hint,": write it like ",s.prefix??"",s.placeholder,s.suffix?` ${s.suffix}`:""]}):null]})}function re({children:r}){return(0,a.jsxs)("span",{"data-graview-part":"picker",children:[r,(0,a.jsx)("span",{"aria-hidden":"true","data-graview-part":"chevron",children:"\u25BE"})]})}var ue=r=>({label:E(r),option:e=>e}),me={phone:"+1 555 123 4567",place:"An address or a place's name",duration:"1h 30m, 90 or 1:30"};function M({store:r,spec:e,value:t,onChange:o,prefilled:c,open:f,words:s=ue,values:S}){if(e.name in c&&e.control!=="group"&&e.control!=="variant")return null;let g=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(n=>E(G(r.schema.tryDefinition(n),n))).join(" or "):s(e.name).label,A=!(e.optional||e.control==="boolean"),u=A?(0,a.jsxs)(a.Fragment,{children:[g,(0,a.jsx)("span",{"aria-hidden":"true",children:" *"})]}):g;switch(e.control){case"text":case"date":return e.control==="text"&&e.long?(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":"text",children:[(0,a.jsxs)("span",{"data-graview-part":"label",children:[u,e.markdown?(0,a.jsx)("span",{style:{fontWeight:"normal",color:"var(--graview-ink-faint)"},children:" \xB7 Markdown"}):null]}),(0,a.jsx)("textarea",{name:e.name,required:!e.optional,rows:6,value:typeof t=="string"?t:"",onChange:n=>o(n.target.value),"data-graview-part":"control",style:{fieldSizing:"content",minHeight:"7.5em",resize:"vertical",font:"inherit",lineHeight:1.5}})]}):e.control==="date"?(0,a.jsxs)("div",{"data-graview-part":"field","data-graview-field":"date",children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)(I,{name:e.name,label:s(e.name).label,required:!e.optional,value:typeof t=="string"&&t!==""?t:void 0,time:e.time===!0,instant:e.instant===!0,onChange:o})]}):(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control==="text"&&e.holds?e.holds:e.control,children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)("input",{type:e.control==="text"&&e.holds==="phone"?"tel":"text",name:e.name,required:!e.optional,...e.control==="text"&&e.app?{placeholder:"@owner/app or https://\u2026"}:{},...e.control==="text"&&e.holds?{placeholder:me[e.holds]}:{},...e.control==="text"&&e.holds==="phone"?{autoComplete:"tel"}:{},value:typeof t=="string"?t:typeof t=="number"?String(t):"",onChange:n=>o(n.target.value),"data-graview-part":"control"})]});case"number":return e.amount?(0,a.jsx)(pe,{title:u,name:e.name,optional:e.optional,amount:e.amount,value:t,onChange:o}):(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)("input",{type:"number",name:e.name,required:!e.optional,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},value:typeof t=="number"?t:"",onChange:n=>o(n.target.value===""?void 0:Number(n.target.value)),"data-graview-part":"control"})]});case"boolean":return(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":"boolean",children:[(0,a.jsx)("input",{type:"checkbox",name:e.name,checked:t===!0,onChange:n=>o(n.target.checked),"data-graview-part":"control"}),(0,a.jsx)("span",{"data-graview-part":"label",children:u})]});case"choice":return(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)(re,{children:(0,a.jsxs)("select",{name:e.name,required:!e.optional,value:typeof t=="string"?t:"",onChange:n=>o(n.target.value||void 0),"data-graview-part":"control",children:[(0,a.jsx)("option",{value:"",children:"\u2014"}),(e.options??[]).map(n=>(0,a.jsx)("option",{value:n,children:s(e.name).option(n)},n))]})})]});case"node":{let n=f.find(i=>i.name===e.name)?.candidates,m=new Set(Object.values(c).filter(i=>typeof i=="string")),w=(e.kinds.includes("*")?[...r.graph.allNodes()]:e.kinds.flatMap(i=>r.graph.nodesOfKind(i))).filter(i=>!m.has(i.id)),d=n?n.map(i=>r.graph.getNode(i)).filter(i=>i!==void 0):w,b=V(d,i=>r.schema.tryDefinition(i));return(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,a.jsx)("span",{"data-graview-part":"label",children:u}),(0,a.jsx)(re,{children:(0,a.jsxs)("select",{name:e.name,required:!e.optional,value:typeof t=="string"?t:"",onChange:i=>o(i.target.value||void 0),"data-graview-part":"control",children:[(0,a.jsx)("option",{value:"",children:"\u2014"}),d.map(i=>{let F=b.get(i.id);return(0,a.jsxs)("option",{value:i.id,children:[z(r.schema.tryDefinition(i.kind),i),F?` \xB7 ${F}`:""]},i.id)})]})})]})}case"group":{let n=t??{};return(0,a.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,a.jsx)("legend",{"data-graview-part":"label",children:u}),e.fields.map(m=>(0,a.jsx)(M,{store:r,spec:m,value:n[m.name],onChange:w=>o({...n,[m.name]:w}),prefilled:c,open:f,words:s},m.name))]})}case"variant":{let n=t??{},m=typeof n[e.tag]=="string"?n[e.tag]:"",w=e.options.find(d=>d.value===m);return(0,a.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,a.jsx)("legend",{"data-graview-part":"label",children:u}),(0,a.jsxs)("label",{"data-graview-part":"field","data-graview-field":"choice",children:[(0,a.jsx)("span",{"data-graview-part":"label",children:E(e.tag)}),(0,a.jsxs)("select",{value:m,onChange:d=>o({[e.tag]:d.target.value}),"data-graview-part":"control",children:[(0,a.jsx)("option",{value:"",children:"\u2014"}),e.options.map(d=>(0,a.jsx)("option",{value:d.value,children:E(d.value)},d.value))]})]}),w?.fields.map(d=>(0,a.jsx)(M,{store:r,spec:d,value:n[d.name],onChange:b=>o({...n,[d.name]:b}),prefilled:c,open:f,words:s},d.name))]})}case"file":case"list":{let n=e.control==="file"?e:e.item.control==="file"?e.item:void 0;if(n||e.control==="file")return(0,a.jsx)(L,{as:"control",title:A?`${g} *`:g,value:t,onChange:o,several:n!==e,image:n?.image===!0,video:n?.video===!0,label:g});let m=Array.isArray(t)?t:[];return(0,a.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":"list",children:[(0,a.jsx)("legend",{"data-graview-part":"label",children:u}),m.map((w,d)=>(0,a.jsxs)("div",{"data-graview-part":"item",children:[(0,a.jsx)("div",{style:{flex:1},children:(0,a.jsx)(M,{store:r,spec:{...e.item,optional:!1},value:w,onChange:b=>o(m.map((i,F)=>F===d?b:i)),prefilled:c,open:f,words:s})}),(0,a.jsx)("button",{type:"button","data-graview-part":"remove",onClick:()=>o(m.filter((b,i)=>i!==d)),children:"remove"})]},d)),(0,a.jsx)("button",{type:"button","data-graview-part":"add",onClick:()=>o([...m,void 0]),children:"add another"})]})}case"linked":return(0,a.jsx)("div",{"data-graview-part":"field","data-graview-field":"linked",children:(0,a.jsx)(O,{relation:e.relation,value:t,onChange:o,label:g})});case"repeat":return(0,a.jsx)(W,{value:t,onChange:o,start:e.of?S?.[e.of]:void 0,label:`${e.of?s(e.of).label:g} repeats`,name:e.name});case"opaque":return(0,a.jsxs)("p",{"data-graview-part":"unasked",children:["\u201C",E(e.name),"\u201D needs a structured answer this form cannot ask for yet."]})}}function ge(r){let e=[...r.querySelectorAll("input:not([type=hidden]), select, textarea")].filter(t=>!t.disabled&&!t.closest("[hidden], [inert], [aria-hidden='true']"));return e.find(t=>t.required&&t.value==="")??e[0]??r.querySelector('button[type="submit"]')}function Fe({store:r,mutation:e,prefilled:t={},open:o=[],onDone:c,principal:f,initial:s,label:S,only:g,autoFocus:A=!1}){let u=()=>ae(e,r.graph,t),[n,m]=(0,y.useState)(u),[w,d]=(0,y.useState)(()=>({...n,...s})),[b,i]=(0,y.useState)(null),F=f??r.seenFor,q=e.subject&&t[e.subject.arg],ie=F?ne(r,F,e,typeof q=="string"?q:void 0):void 0,j=ee(r.schema,e),C=(g===void 0?j:g.flatMap(l=>j.find(p=>p.name===l)??[])).filter(l=>!ie?.has(l.name)),oe=l=>Y(r.schema,e,l),P=X(C.filter(l=>l.control==="date").map(l=>l.name)),D=(0,y.useRef)(void 0),le=(l,p)=>d(v=>{let x={...v,[l.name]:p};if(P&&l.name===P.start&&l.control==="date"){let h=k=>typeof k=="string"&&k!==""?k:void 0,R=h(v[P.start])??D.current;if(h(p)){D.current=h(p);let k=U(R,h(p),h(v[P.end]),{time:l.time===!0,instant:l.instant===!0});k!==void 0&&(x[P.end]=k)}}return x}),H=(0,y.useRef)(null);return(0,y.useEffect)(()=>{if(!A)return;let l=document.activeElement,p=0,v=0,x=()=>{let h=H.current;if(!h)return;let R=document.activeElement;if(R!==l&&R!==document.body&&R!==null&&!h.contains(R)||h.contains(R))return;let k=h.querySelector("[data-graview-when-arriving]")&&v<30?null:ge(h);if(k){k.focus();return}v+=1,v<=30&&(p=requestAnimationFrame(x))};return p=requestAnimationFrame(x),()=>cancelAnimationFrame(p)},[]),(0,a.jsxs)("form",{ref:H,"data-testid":`form-${e.name}`,onSubmit:l=>{l.preventDefault();try{r.apply({name:e.name,args:{...te(Z(C,w),n),...t}},f?{author:f}:{}),i(null);let p=u();m(p),d({...p}),c?.()}catch(p){i(_(r.schema,r.allMutations(),p));let v=e.subject?t[e.subject.arg]:void 0,x=typeof v=="string"?r.graph.getNode(v)?.kind:void 0;$(r,{type:"refused",act:e.name,code:K(p).reason,...x?{kind:x}:{}},f)}},"data-graview-part":"form",children:[(0,a.jsx)("style",{children:se}),C.map(l=>(0,a.jsx)(M,{store:r,spec:l,value:w[l.name],values:w,onChange:p=>le(l,p),prefilled:t,open:o,words:oe},l.name)),b?(0,a.jsx)("p",{"data-testid":"refused","data-graview-part":"refused",role:"alert",children:b}):null,(0,a.jsx)("button",{type:"submit","data-graview-part":"submit",children:S??e.title??e.name})]})}export{Fe as a};
@@ -1 +0,0 @@
1
- import{b as f}from"./chunk.R3ZS4QO6.js";import"./chunk.2ORJGMRT.js";import"./chunk.YYWANGIC.js";import"./chunk.FTW3K3G6.js";import"./chunk.UGFDSE37.js";import{l as g}from"./chunk.QBMIET7P.js";import"./chunk.PXQVXBNG.js";import"./chunk.WVKXELAF.js";import"./chunk.ZOW7AC7U.js";import"./chunk.INBHY3SA.js";import"./chunk.TDV7JGIQ.js";import"./chunk.RZQKCLTW.js";import"./chunk.Y3BEKXYB.js";import"./chunk.NDLQXQV2.js";import"./chunk.WUFCRE7O.js";import"./chunk.XEHLSKHP.js";import"./chunk.MSM6E6JK.js";import"./chunk.YGZGMRDC.js";import"./chunk.6ZJE5M2A.js";import"./chunk.2SWQI4HF.js";import"./chunk.QIAH7HHO.js";import"./chunk.DNJM6WQO.js";import"./chunk.LEPKPNPA.js";import"./chunk.5D6SIBOK.js";import"./chunk.UE5GAP67.js";import"./chunk.BJUUSIQY.js";import"./chunk.BRCKXL7B.js";import"./chunk.CPNE6HPQ.js";import"./chunk.XOZU4OFA.js";import"./chunk.QQ3YWKWU.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.HUABTCQE.js";import"./chunk.DXJFAAOI.js";import"./chunk.5MSNKSTE.js";import"./chunk.KVQZ5FR6.js";import"./chunk.2HANQ737.js";import"./chunk.H536YUAZ.js";import"./chunk.GZHZLJBF.js";import"./chunk.OL2N5NUV.js";import"./chunk.OJGHDWI6.js";import"./chunk.5DPFAVCZ.js";import"./chunk.5EZDXWOE.js";import"./chunk.MIQMPOWF.js";import"./chunk.T66UK7PQ.js";import"./chunk.LMXNHBGH.js";import"./chunk.DBCVZGCC.js";import{G as b,T as h}from"./chunk.WSMYFEGU.js";import"./chunk.SDO3U72B.js";import{Rd as n}from"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import{b as t}from"./chunk.AJZBJBMO.js";var m=t(b(),1),a=t(h(),1);function P({store:c,auto:y,brand:i,views:u,presence:s,steering:r,overview:o,scope:d,titleLevel:w=2,quickAsk:l,props:e}){let v=(0,m.useMemo)(()=>g({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:y?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:v}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(f,{context:{store:c,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...o?{overview:o}:{},titleLevel:w,views:u,settings:e.app.settings??[],app:e.app,...s?{presence:s}:{},...i?{brand:i}:{},...e.locale?{locale:e.locale}:{},...e.timeZone?{timeZone:e.timeZone}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{},...e.subscriptions?{subscriptions:e.subscriptions}:{},dismissals:e.dismissals,whileAway:e.whileAway,...e.signIn?{signIn:e.signIn}:{},...l!==void 0?{quickAsk:l}:{}},...e.pages?{registry:e.pages}:{},...r?{steering:r}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.hrefOf?{hrefOf:e.hrefOf}:e.routing==="address"?{}:{hrefOf:!1},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{P as PagesContent};
@@ -1 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{G as k,Ga as o,T as n}from"./chunk.WSMYFEGU.js";import{a as t}from"./chunk.SDO3U72B.js";import{b as p}from"./chunk.AJZBJBMO.js";var f=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.HUABTCQE.js","./chunk.DXJFAAOI.js","./chunk.5MSNKSTE.js","./chunk.KVQZ5FR6.js","./chunk.2HANQ737.js","./chunk.H536YUAZ.js","./chunk.GZHZLJBF.js","./chunk.OL2N5NUV.js","./chunk.OJGHDWI6.js","./chunk.5DPFAVCZ.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.MFCBAQS3.js")))),y=f.part((e,r)=>e.drawFiles(r),{quiet:!0});var d=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.OL2N5NUV.js","./chunk.OJGHDWI6.js","./chunk.5DPFAVCZ.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5EOSEVZB.js")))),I=d.part((e,r)=>e.drawLinkedRecord(r),{quiet:!0}),w=d.part((e,r)=>e.drawLinkedPicker(r),{what:"Picking a linked record"});var s=p(n(),1),m=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.OL2N5NUV.js","./chunk.OJGHDWI6.js","./chunk.5DPFAVCZ.js","./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SUGOENC4.js")))),E=m.part((e,r)=>(0,s.jsx)(e.RepeatPicker,{...r}),{quiet:!0}),W=m.part((e,r)=>(0,s.jsx)(e.RepeatEditor,{...r}),{quiet:!0});var a=p(k(),1),i=p(n(),1),c=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.5EZDXWOE.js","./chunk.MIQMPOWF.js","./chunk.T66UK7PQ.js","./chunk.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.MNSKBGRM.js")))),l=c.part((e,r)=>(0,i.jsx)(e.WhenInput,{...r}),{quiet:!0});function M(e){return(0,i.jsx)(a.Suspense,{fallback:(0,i.jsx)("span",{"data-graview-when-arriving":"",style:{display:"inline-block",minHeight:24}}),children:(0,i.jsx)(l,{...e})})}var N=()=>c.load().then(()=>{},()=>{});export{y as a,I as b,w as c,E as d,W as e,M as f,N as g};
@@ -1 +0,0 @@
1
- import{E as b,L as w,M as N,N as T,P as O,Q as S,U as m}from"./chunk.WR63RQGU.js";var x=864e5,j=/^(\d{4})-(\d{2})-(\d{2})/,p=e=>String(e).padStart(2,"0"),D=e=>new Date(e).toISOString().slice(0,10),a=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),g=(e,t)=>D(a(e)+t*x),W=e=>new Date(a(e)).getUTCDay();function c(e,t,r){if(!(t>=1&&t<=12&&r>=1&&r<=31))return;let i=`${String(e).padStart(4,"0")}-${p(t)}-${p(r)}`;return D(a(i))===i?i:void 0}function F(e=new Date){let t=N();return t?O(e.getTime(),t):{day:`${e.getFullYear()}-${p(e.getMonth()+1)}-${p(e.getDate())}`,minutes:e.getHours()*60+e.getMinutes()}}var h=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e);function l(e){if(typeof e!="string")return;if(h(e)){let i=new Date(e);return Number.isNaN(i.getTime())?void 0:F(i)}let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t||!c(Number(t[1]),Number(t[2]),Number(t[3])))return;let r=e.slice(0,10);return t[4]===void 0?{day:r}:{day:r,minutes:Number(t[4])*60+Number(t[5])}}function A(e,t){if(!t.time)return e.day;let r=e.minutes??9*60;if(!t.instant)return`${e.day}T${p(Math.floor(r/60))}:${p(r%60)}`;let i=N(),[,n,o,d]=j.exec(e.day);return(i?new Date(S(e.day,r,i)):new Date(Number(n),Number(o)-1,Number(d),Math.floor(r/60),r%60)).toISOString().replace(/\.\d{3}Z$/,"Z")}function z(e,t=new Date){let r=T(),i=r;try{i=new Intl.DateTimeFormat(e??b,{timeZoneName:"short",timeZone:r}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??r}catch{i=r}return{zone:r,short:i}}function L(e,t,r,i){let n=l(t);if(!n)return r;let o=e===void 0?void 0:l(e),d=r===void 0?void 0:l(r),u=s=>a(s.day)+(s.minutes??0)*6e4,f=(s,$)=>{let y=u(s)+$;return{day:D(y),...i.time?{minutes:Math.round(y%x/6e4)}:{}}};return o&&d?A(f(d,u(n)-u(o)),i):d&&u(d)>=u(n)?r:i.time?A(f(n,36e5),i):r}var Y=/^(start|starts|startsAt|startsOn|startAt|begins|from|opens|checkIn)$/i,B=/^(end|ends|endsAt|endsOn|endAt|until|to|finish|finishes|closes|through|checkOut)$/i;function P(e,t={}){let r=(t.start&&e.includes(t.start)?t.start:void 0)??e.find(n=>Y.test(n)),i=(t.end&&e.includes(t.end)?t.end:void 0)??e.find(n=>n!==r&&B.test(n));return r&&i?{start:r,end:i}:void 0}var Z=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],H=["sun","mon","tue","wed","thu","fri","sat"],I="(jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sept?(?:ember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)",E="(sun(?:day)?|mon(?:day)?|tue(?:s|sday)?|wed(?:nesday)?|thu(?:r|rs|rsday)?|fri(?:day)?|sat(?:urday)?)",C=e=>Z.indexOf(e.slice(0,3))+1,M=e=>e===void 0?void 0:e.length===2?2e3+Number(e):Number(e);function U(e){try{let t=new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}).formatToParts(0).map(r=>r.type);return t.indexOf("month")<t.indexOf("day")}catch{return!0}}function v(e){let t=(n,o)=>({minutes:o,rest:`${e.slice(0,n.index)} ${e.slice(n.index+n[0].length)}`}),r=/\b(noon|midday)\b/.exec(e);if(r)return t(r,12*60);if(r=/\bmidnight\b/.exec(e),r)return t(r,0);if(r=/\b(\d{1,2})(?::(\d{2}))?\s*([ap])\.?m?\.?(?=\s|$)/.exec(e),r){let n=Number(r[1]),o=Number(r[2]??0);return n<1||n>12||o>59?{rest:e,bad:!0}:t(r,(n%12+(r[3]==="p"?12:0))*60+o)}if(r=/\b(\d{1,2}):(\d{2})\b/.exec(e),r){let n=Number(r[1]),o=Number(r[2]);return n>23||o>59?{rest:e,bad:!0}:t(r,n*60+o)}if(r=/\bat\s+(\d{1,2})\b/.exec(e),r){let n=Number(r[1]);return n>23?{rest:e,bad:!0}:t(r,(n>=1&&n<=7?n+12:n)*60)}let i=/\b(morning|afternoon|evening|tonight)\b/.exec(e);return i?{minutes:{morning:9,afternoon:15,evening:18,tonight:20}[i[1]]*60,rest:i[1]==="tonight"?`${e.slice(0,i.index)} today ${e.slice(i.index+i[0].length)}`:`${e.slice(0,i.index)} ${e.slice(i.index+i[0].length)}`}:{rest:e}}function K(e,t,r){let i=e.replace(/\b(on|at|the|of|this)\b/g," ").replace(/\s+/g," ").trim();if(i==="")return null;if(i==="today"||i==="now")return t;if(i==="tomorrow"||i==="tmrw"||i==="tmr")return g(t,1);if(i==="yesterday")return g(t,-1);if(i==="next week")return g(t,7);let n=/^in (\d{1,3}) (day|days|week|weeks)$/.exec(i);if(n)return g(t,Number(n[1])*(n[2].startsWith("week")?7:1));if(n=new RegExp(`^(next )?${E}$`).exec(i),n){let s=(H.indexOf(n[2].slice(0,3))-W(t)+7)%7;return g(t,n[1]&&s===0?7:s)}if(n=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(i),n)return c(Number(n[1]),Number(n[2]),Number(n[3]));let o=i.replace(new RegExp(`^${E} `),"");n=new RegExp(`^(\\d{1,2})(?:st|nd|rd|th)? ${I}(?: (\\d{4}))?$`).exec(o);let d=n?{date:n[1],month:n[2],year:n[3]}:void 0;n=new RegExp(`^${I} (\\d{1,2})(?:st|nd|rd|th)?(?: (\\d{4}))?$`).exec(o);let u=d??(n?{date:n[2],month:n[1],year:n[3]}:void 0);if(u)return R(t,M(u.year),C(u.month),Number(u.date));if(n=/^(\d{1,2})[/.-](\d{1,2})(?:[/.-](\d{2}|\d{4}))?$/.exec(o),n){let[f,s]=[Number(n[1]),Number(n[2])],[$,y]=U(r)?[f,s]:[s,f];return R(t,M(n[3]),$,y)}}function R(e,t,r,i){if(t!==void 0)return c(t,r,i);let n=Number(e.slice(0,4)),o=c(n,r,i);return o===void 0?c(n+1,r,i):a(e)-a(o)>183*x?c(n+1,r,i):o}function q(e,t){let r=e.trim();if(h(r)){let u=l(r);if(u)return t.time?u:{day:u.day}}let i=e.toLowerCase().replace(/,/g," ").replace(/(\d{4}-\d{2}-\d{2})t(\d\d:\d\d)(:\d\d(\.\d+)?)?/,"$1 $2").replace(/\s+/g," ").trim();if(i==="")return;let n=v(i);if(n.bad)return;let o=K(n.rest,t.today,t.locale??b);if(o===void 0||o===null&&n.minutes===void 0)return;let d=o??t.base?.day??t.today;return t.time?{day:d,minutes:n.minutes??t.base?.minutes??9*60}:{day:d}}function G(e){if(e===void 0||e==="web"||e.startsWith("ai:")||e.startsWith("app:"))return;if(e==="api")return"via the API";if(e==="cli")return"via the command line";let[t,...r]=e.split(":"),i=r.join(":");return(t==="mcp"||t==="view")&&i?`via ${i}`:t==="mcp"?"via an agent's tools":`via ${e}`}var _=e=>{if(!e.currency)return{before:!0};try{let t=w(e.locale),r=new Intl.NumberFormat(t,{style:"currency",currency:e.currency}).formatToParts(1),i=r.findIndex(d=>d.type==="currency"),n=r.findIndex(d=>d.type==="integer"),o;try{o=new Intl.DisplayNames([t],{type:"currency"}).of(e.currency)}catch{}return{...i>=0?{symbol:r[i].value}:{},before:i<n,...o?{name:o}:{}}}catch{return{symbol:e.currency,before:!0}}};function J(e){let t=e.locale;if(e.format==="money"){let{symbol:r,before:i,name:n}=_(e),o=m(1250,t,{minimumFractionDigits:2,maximumFractionDigits:2});return{...r?i?{prefix:r}:{suffix:r}:{},placeholder:o,hint:n?`in ${n}`:e.currency?`in ${e.currency}`:"an amount of money"}}return e.format==="percent"?{suffix:"%",placeholder:m(15,t),hint:"as a percent"}:{...e.unit?{suffix:e.unit}:{},placeholder:"",hint:e.unit?`in ${e.unit}`:"a number"}}function Q(e,t){return e===void 0||!Number.isFinite(e)?"":t.format==="money"?m(e,t.locale,Number.isInteger(e)?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}):t.format==="percent"?m(e*100,t.locale,{maximumFractionDigits:4}):m(e,t.locale,{maximumFractionDigits:6})}function V(e){try{let t=new Intl.NumberFormat(w(e)).formatToParts(12345.6);return{group:t.find(r=>r.type==="group")?.value??",",decimal:t.find(r=>r.type==="decimal")?.value??"."}}catch{return{group:",",decimal:"."}}}function X(e,t){let{group:r,decimal:i}=V(t),n=e.replace(/[\s  ']/g,"").replace(/[−–]/g,"-");if(i!=="."&&!n.includes(i)&&/^-?\d+\.\d{1,2}$/.test(n))return Number(n);if(r&&(n=n.split(r).join("")),i!=="."&&(n=n.replace(i,".")),!/^-?(\d+\.?\d*|\.\d+)$/.test(n))return;let o=Number(n);return Number.isFinite(o)?o:void 0}function k(e,t){let r=e.trim();if(r==="")return;let i=t?.format==="money"&&t.currency?_(t).symbol:void 0,n=r;i&&(n=n.split(i).join("")),t?.currency&&(n=n.replace(new RegExp(t.currency,"gi"),"")),n=n.replace(/^[$€£¥₹]|[$€£¥₹]$/g,""),/%\s*$/.test(n)&&(n=n.replace(/%\s*$/,"")),t?.unit&&t.format!=="money"&&(n=n.replace(new RegExp(`\\s*${t.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let d=X(n,t?.locale);if(d!==void 0)return t?.format==="percent"?d/100:d}export{G as a,J as b,Q as c,k as d,F as e,h as f,l as g,A as h,z as i,L as j,P as k,q as l};