@sync-in/server 2.0.0 → 2.1.0

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 (232) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +38 -28
  3. package/environment/environment.dist.yaml +4 -0
  4. package/package.json +17 -17
  5. package/server/applications/files/utils/doc-textify/adapters/pdf.js +1 -1
  6. package/server/applications/files/utils/doc-textify/adapters/pdf.js.map +1 -1
  7. package/server/applications/files/utils/files.js +37 -24
  8. package/server/applications/files/utils/files.js.map +1 -1
  9. package/server/applications/notifications/i18n/index.js +5 -0
  10. package/server/applications/notifications/i18n/index.js.map +1 -1
  11. package/server/applications/notifications/i18n/nl.js +54 -0
  12. package/server/applications/notifications/i18n/nl.js.map +1 -0
  13. package/server/applications/sync/services/sync-clients-manager.service.js +1 -1
  14. package/server/applications/sync/services/sync-clients-manager.service.js.map +1 -1
  15. package/server/authentication/providers/oidc/auth-oidc.config.js +5 -0
  16. package/server/authentication/providers/oidc/auth-oidc.config.js.map +1 -1
  17. package/server/authentication/providers/oidc/auth-provider-oidc.service.js +10 -7
  18. package/server/authentication/providers/oidc/auth-provider-oidc.service.js.map +1 -1
  19. package/server/authentication/providers/oidc/auth-provider-oidc.service.spec.js +16 -0
  20. package/server/authentication/providers/oidc/auth-provider-oidc.service.spec.js.map +1 -1
  21. package/server/common/i18n.js +1 -0
  22. package/server/common/i18n.js.map +1 -1
  23. package/server/infrastructure/database/database.module.js +7 -0
  24. package/server/infrastructure/database/database.module.js.map +1 -1
  25. package/server/infrastructure/database/scripts/check-db.js +20 -0
  26. package/server/infrastructure/database/scripts/check-db.js.map +1 -0
  27. package/static/3rdpartylicenses.txt +391 -391
  28. package/static/assets/pdfjs/build/pdf.mjs +512 -417
  29. package/static/assets/pdfjs/build/pdf.mjs.map +1 -1
  30. package/static/assets/pdfjs/build/pdf.sandbox.mjs +390 -4
  31. package/static/assets/pdfjs/build/pdf.sandbox.mjs.map +1 -1
  32. package/static/assets/pdfjs/build/pdf.worker.mjs +2378 -401
  33. package/static/assets/pdfjs/build/pdf.worker.mjs.map +1 -1
  34. package/static/assets/pdfjs/version +1 -1
  35. package/static/assets/pdfjs/web/debugger.mjs +6 -15
  36. package/static/assets/pdfjs/web/locale/be/viewer.ftl +78 -0
  37. package/static/assets/pdfjs/web/locale/cs/viewer.ftl +82 -0
  38. package/static/assets/pdfjs/web/locale/cy/viewer.ftl +90 -0
  39. package/static/assets/pdfjs/web/locale/de/viewer.ftl +75 -0
  40. package/static/assets/pdfjs/web/locale/dsb/viewer.ftl +82 -0
  41. package/static/assets/pdfjs/web/locale/el/viewer.ftl +74 -0
  42. package/static/assets/pdfjs/web/locale/en-CA/viewer.ftl +74 -0
  43. package/static/assets/pdfjs/web/locale/en-GB/viewer.ftl +81 -0
  44. package/static/assets/pdfjs/web/locale/en-US/viewer.ftl +14 -14
  45. package/static/assets/pdfjs/web/locale/eo/viewer.ftl +74 -0
  46. package/static/assets/pdfjs/web/locale/es-AR/viewer.ftl +74 -0
  47. package/static/assets/pdfjs/web/locale/es-CL/viewer.ftl +74 -0
  48. package/static/assets/pdfjs/web/locale/es-ES/viewer.ftl +74 -0
  49. package/static/assets/pdfjs/web/locale/es-MX/viewer.ftl +75 -0
  50. package/static/assets/pdfjs/web/locale/eu/viewer.ftl +74 -0
  51. package/static/assets/pdfjs/web/locale/fi/viewer.ftl +74 -0
  52. package/static/assets/pdfjs/web/locale/fr/viewer.ftl +81 -0
  53. package/static/assets/pdfjs/web/locale/fy-NL/viewer.ftl +74 -0
  54. package/static/assets/pdfjs/web/locale/gn/viewer.ftl +77 -0
  55. package/static/assets/pdfjs/web/locale/he/viewer.ftl +81 -0
  56. package/static/assets/pdfjs/web/locale/hsb/viewer.ftl +87 -0
  57. package/static/assets/pdfjs/web/locale/hu/viewer.ftl +74 -0
  58. package/static/assets/pdfjs/web/locale/hy-AM/viewer.ftl +10 -10
  59. package/static/assets/pdfjs/web/locale/ia/viewer.ftl +75 -0
  60. package/static/assets/pdfjs/web/locale/it/viewer.ftl +81 -0
  61. package/static/assets/pdfjs/web/locale/ja/viewer.ftl +58 -0
  62. package/static/assets/pdfjs/web/locale/ka/viewer.ftl +74 -0
  63. package/static/assets/pdfjs/web/locale/kk/viewer.ftl +81 -0
  64. package/static/assets/pdfjs/web/locale/km/viewer.ftl +44 -0
  65. package/static/assets/pdfjs/web/locale/ko/viewer.ftl +65 -0
  66. package/static/assets/pdfjs/web/locale/nb-NO/viewer.ftl +74 -0
  67. package/static/assets/pdfjs/web/locale/nl/viewer.ftl +81 -0
  68. package/static/assets/pdfjs/web/locale/nn-NO/viewer.ftl +75 -0
  69. package/static/assets/pdfjs/web/locale/pa-IN/viewer.ftl +74 -0
  70. package/static/assets/pdfjs/web/locale/pl/viewer.ftl +78 -0
  71. package/static/assets/pdfjs/web/locale/pt-BR/viewer.ftl +74 -0
  72. package/static/assets/pdfjs/web/locale/ro/viewer.ftl +81 -3
  73. package/static/assets/pdfjs/web/locale/ru/viewer.ftl +85 -0
  74. package/static/assets/pdfjs/web/locale/sk/viewer.ftl +83 -1
  75. package/static/assets/pdfjs/web/locale/sl/viewer.ftl +82 -0
  76. package/static/assets/pdfjs/web/locale/sv-SE/viewer.ftl +81 -0
  77. package/static/assets/pdfjs/web/locale/tg/viewer.ftl +74 -0
  78. package/static/assets/pdfjs/web/locale/th/viewer.ftl +58 -0
  79. package/static/assets/pdfjs/web/locale/tr/viewer.ftl +74 -0
  80. package/static/assets/pdfjs/web/locale/uk/viewer.ftl +144 -0
  81. package/static/assets/pdfjs/web/locale/vi/viewer.ftl +65 -0
  82. package/static/assets/pdfjs/web/locale/zh-CN/viewer.ftl +61 -3
  83. package/static/assets/pdfjs/web/locale/zh-TW/viewer.ftl +65 -0
  84. package/static/assets/pdfjs/web/viewer.css +292 -152
  85. package/static/assets/pdfjs/web/viewer.html +14 -21
  86. package/static/assets/pdfjs/web/viewer.mjs +782 -327
  87. package/static/assets/pdfjs/web/viewer.mjs.map +1 -1
  88. package/static/assets/pdfjs/web/wasm/jbig2.wasm +0 -0
  89. package/static/{chunk-7WOPGQXB.js → chunk-25XD7GNL.js} +1 -1
  90. package/static/{chunk-E5WI5725.js → chunk-2W4Z5VTY.js} +1 -1
  91. package/static/chunk-2XNPCG4F.js +1 -0
  92. package/static/chunk-3B2RHO2H.js +1 -0
  93. package/static/{chunk-UMDRE4S7.js → chunk-3DNAFXGN.js} +1 -1
  94. package/static/{chunk-OANZITPM.js → chunk-3EPN4WD7.js} +1 -1
  95. package/static/chunk-4L2WBHB6.js +1 -0
  96. package/static/chunk-4RYZNAIZ.js +1 -0
  97. package/static/chunk-5C77PEFA.js +1 -0
  98. package/static/chunk-5JA3DZWQ.js +1 -0
  99. package/static/chunk-5MSTJGPE.js +1 -0
  100. package/static/{chunk-VSBFNFOM.js → chunk-5O7KTREI.js} +1 -1
  101. package/static/chunk-6KORLSUZ.js +1 -0
  102. package/static/chunk-6LIHQVPW.js +2 -0
  103. package/static/{chunk-2CKLZ3FM.js → chunk-72BXGTUG.js} +1 -1
  104. package/static/chunk-7423QJQN.js +1 -0
  105. package/static/chunk-77HB4DE6.js +1 -0
  106. package/static/{chunk-RWAAC3A4.js → chunk-7PVTMTWH.js} +1 -1
  107. package/static/{chunk-IWWBV6EM.js → chunk-7UIOW5AD.js} +1 -1
  108. package/static/chunk-7YMONFZZ.js +1 -0
  109. package/static/chunk-AUPNSQGJ.js +1 -0
  110. package/static/chunk-AYF6ZI6L.js +5 -0
  111. package/static/chunk-BEESW4BF.js +1 -0
  112. package/static/{chunk-2R6IBBPZ.js → chunk-BI3VI6XG.js} +1 -1
  113. package/static/chunk-BMGKB3JK.js +4 -0
  114. package/static/chunk-CFXAKPPB.js +563 -0
  115. package/static/chunk-CGYZG6CB.js +2 -0
  116. package/static/{chunk-K25E7YGG.js → chunk-CHAYERHQ.js} +1 -1
  117. package/static/chunk-CLNKPQMZ.js +1 -0
  118. package/static/{chunk-ISV3BO6R.js → chunk-CVLSRA2W.js} +1 -1
  119. package/static/chunk-D373HBMN.js +1 -0
  120. package/static/{chunk-MTRXBVWZ.js → chunk-D43PHZEY.js} +1 -1
  121. package/static/chunk-D44RAVFK.js +1 -0
  122. package/static/chunk-DFVVEGWC.js +1 -0
  123. package/static/chunk-E43LXI27.js +1 -0
  124. package/static/{chunk-GQFMWVFD.js → chunk-E5M4ZDID.js} +1 -1
  125. package/static/chunk-F7JS3YWP.js +2 -0
  126. package/static/chunk-FRWEEOOM.js +1 -0
  127. package/static/chunk-HIZGSP7R.js +1 -0
  128. package/static/chunk-HX6ZWXQD.js +1 -0
  129. package/static/chunk-HZ6LLXLE.js +1 -0
  130. package/static/{chunk-RLL634K4.js → chunk-IFHFPV5W.js} +1 -1
  131. package/static/{chunk-KJD3KFF3.js → chunk-JICKUOQ6.js} +1 -1
  132. package/static/chunk-KY2BW2LP.js +1 -0
  133. package/static/{chunk-CWYHOPOP.js → chunk-KYA3HPDX.js} +1 -1
  134. package/static/{chunk-RWCNTCU5.js → chunk-KYLATNX5.js} +1 -1
  135. package/static/chunk-LCZNSV4Z.js +1 -0
  136. package/static/{chunk-GVNTC564.js → chunk-MA6DYTMQ.js} +1 -1
  137. package/static/{chunk-KZS7CTNR.js → chunk-MXH5XYBD.js} +1 -1
  138. package/static/{chunk-NMTBMHUL.js → chunk-MXIJGSDQ.js} +1 -1
  139. package/static/{chunk-RS2OFKWP.js → chunk-NE75E3GD.js} +1 -1
  140. package/static/{chunk-MZQK6LNV.js → chunk-NJKIHMOH.js} +1 -1
  141. package/static/chunk-NMDGST45.js +1 -0
  142. package/static/{chunk-CU76ATCF.js → chunk-OF7P4LTI.js} +1 -1
  143. package/static/chunk-OK5K5CYJ.js +13 -0
  144. package/static/chunk-OZ6LXMUH.js +1 -0
  145. package/static/chunk-PFY6YUPS.js +2 -0
  146. package/static/chunk-PQ2YFCVM.js +1 -0
  147. package/static/{chunk-Y4AUYQTG.js → chunk-QPX34S6P.js} +4 -4
  148. package/static/{chunk-27ATUHBH.js → chunk-QQO7S2VY.js} +1 -1
  149. package/static/chunk-RANZZPRG.js +1 -0
  150. package/static/{chunk-WN4WXCVK.js → chunk-RNQB2QJB.js} +1 -1
  151. package/static/{chunk-Q3EGCMF5.js → chunk-S7QYAKG5.js} +1 -1
  152. package/static/chunk-SCEWOW5C.js +2 -0
  153. package/static/chunk-SQ2KIOJ7.js +1 -0
  154. package/static/{chunk-QVRVFYJH.js → chunk-SW5GCGOI.js} +1 -1
  155. package/static/chunk-SWCYWB2T.js +1 -0
  156. package/static/{chunk-4FIGEBNL.js → chunk-SWZ3L2LK.js} +1 -1
  157. package/static/{chunk-TWCGKSYE.js → chunk-TDK62XEQ.js} +1 -1
  158. package/static/chunk-TH4L5H6P.js +1 -0
  159. package/static/chunk-U3ZGYOLA.js +1 -0
  160. package/static/chunk-U6V4Y234.js +1 -0
  161. package/static/chunk-U7KNV64D.js +2 -0
  162. package/static/chunk-UC66HJV4.js +1 -0
  163. package/static/{chunk-7GWW6MJO.js → chunk-V4HAIERK.js} +1 -1
  164. package/static/chunk-V55LDRV7.js +1 -0
  165. package/static/{chunk-5CZOSAMZ.js → chunk-WF6D7CQ4.js} +1 -1
  166. package/static/chunk-WJPVHM7T.js +1 -0
  167. package/static/chunk-WM4XBDC2.js +1 -0
  168. package/static/chunk-X2EKQYMZ.js +1 -0
  169. package/static/{chunk-L5IHUVXL.js → chunk-XEDABMM5.js} +1 -1
  170. package/static/{chunk-OGE4SAHU.js → chunk-Y3YKVK3K.js} +1 -1
  171. package/static/{chunk-QIGUDEZF.js → chunk-YEOAMYRK.js} +1 -1
  172. package/static/{chunk-A4UGPSWX.js → chunk-ZLTL7I7D.js} +1 -1
  173. package/static/chunk-ZYNBYM7I.js +3 -0
  174. package/static/index.html +2 -2
  175. package/static/main-KFUSRCP5.js +5 -0
  176. package/static/media/inter-cyrillic-ext-wght-normal-IYF56FF6.woff2 +0 -0
  177. package/static/media/inter-cyrillic-wght-normal-JEOLYBOO.woff2 +0 -0
  178. package/static/media/inter-greek-ext-wght-normal-EOVOK2B5.woff2 +0 -0
  179. package/static/media/inter-greek-wght-normal-IRE366VL.woff2 +0 -0
  180. package/static/media/inter-latin-ext-wght-normal-HA22NDSG.woff2 +0 -0
  181. package/static/media/inter-latin-wght-normal-NRMW37G5.woff2 +0 -0
  182. package/static/media/inter-vietnamese-wght-normal-CE5GGD3W.woff2 +0 -0
  183. package/static/styles-66AEF62D.css +1 -0
  184. package/static/chunk-22TZP6HW.js +0 -1
  185. package/static/chunk-2QZPX7LO.js +0 -1
  186. package/static/chunk-4P3JABAP.js +0 -13
  187. package/static/chunk-677WUBCT.js +0 -1
  188. package/static/chunk-74CAHBFM.js +0 -1
  189. package/static/chunk-AHO37FKW.js +0 -1
  190. package/static/chunk-AQCXMKP3.js +0 -1
  191. package/static/chunk-B6PDYCRO.js +0 -3
  192. package/static/chunk-FC5HTKVM.js +0 -1
  193. package/static/chunk-FOSM7EYI.js +0 -1
  194. package/static/chunk-GAZO25PI.js +0 -1
  195. package/static/chunk-GB7ABR5N.js +0 -1
  196. package/static/chunk-GEHFKZQ5.js +0 -2
  197. package/static/chunk-HGL3NYP2.js +0 -2
  198. package/static/chunk-HLIWPWRA.js +0 -1
  199. package/static/chunk-HNYB3M4S.js +0 -1
  200. package/static/chunk-HUXAUQMN.js +0 -1
  201. package/static/chunk-I2XA6PPK.js +0 -1
  202. package/static/chunk-JV3AGU5B.js +0 -1
  203. package/static/chunk-K46PUTZB.js +0 -1
  204. package/static/chunk-KERFLJ56.js +0 -1
  205. package/static/chunk-KPKSI23S.js +0 -1
  206. package/static/chunk-L7RRX2M3.js +0 -1
  207. package/static/chunk-LGWJ2WKU.js +0 -1
  208. package/static/chunk-LUSVISM6.js +0 -1
  209. package/static/chunk-MLC7JK2H.js +0 -2
  210. package/static/chunk-MOHNYW2A.js +0 -1
  211. package/static/chunk-NCDUOVMW.js +0 -1
  212. package/static/chunk-NGUAJIGI.js +0 -1
  213. package/static/chunk-NIPP6JDI.js +0 -1
  214. package/static/chunk-O4XXMZFX.js +0 -4
  215. package/static/chunk-OI3ME22C.js +0 -1
  216. package/static/chunk-QF2NSHZA.js +0 -1
  217. package/static/chunk-QJVC3SRJ.js +0 -562
  218. package/static/chunk-QKN6LAAA.js +0 -1
  219. package/static/chunk-QRFESU5O.js +0 -2
  220. package/static/chunk-RFJIPIOK.js +0 -2
  221. package/static/chunk-S5Y64DDS.js +0 -1
  222. package/static/chunk-SLG5KDU6.js +0 -1
  223. package/static/chunk-TJ4CVFEL.js +0 -1
  224. package/static/chunk-VRIOLRYR.js +0 -5
  225. package/static/chunk-VS4O2XDP.js +0 -1
  226. package/static/chunk-WX7RXW7K.js +0 -1
  227. package/static/chunk-XC4POKR3.js +0 -2
  228. package/static/chunk-Y67J3BOL.js +0 -1
  229. package/static/chunk-YMIXHRJQ.js +0 -1
  230. package/static/chunk-ZUNKFAKP.js +0 -1
  231. package/static/main-QN4UCOC5.js +0 -5
  232. package/static/styles-46GLIE7Y.css +0 -1
@@ -0,0 +1,5 @@
1
+ import{a as Hr,h as ei,m as ti,n as Ur,p as Pe}from"./chunk-RTNEBRKJ.js";import{e as go,f as vo,g as bo,h as yo}from"./chunk-BEESW4BF.js";import{A as Qr,Ba as fo,C as ri,Ca as uo,D,Da as ho,E as St,Ea as kt,F as Xr,Fa as rn,G as Zi,Ga as mo,H as Jr,I as en,Ia as Xe,J as Zr,Ja as po,K as eo,L as to,M as io,O as no,Q as xt,R as oi,S as ro,T as oo,U as so,V as ao,W as si,a as Ji,b as Ae,c as Gr,d as Wr,e as $r,ea as C,g as qr,h as jr,i as w,j as Oe,k as ft,ka as ai,l as Kr,m as we,ma as lo,n as Ct,na as c,o as ee,oa as li,p as dt,pa as ci,q as te,qa as Mt,r as Ye,ra as tn,s as Qe,sa as nn,v as ii,w as ni,x as I,xa as co,y as Yr,z as H}from"./chunk-OK5K5CYJ.js";import{c as Br}from"./chunk-JXZCNFW7.js";import{y as Jt}from"./chunk-WM4XBDC2.js";import{a as Zt}from"./chunk-NJKIHMOH.js";import{Aa as be,Ba as Yt,Eb as $,Fb as Qt,Gb as Nr,Ha as _r,Hb as Vr,Ia as Pr,Ja as Ar,Ob as Xt,Pb as ne,Qb as Re,Sa as Tr,Va as ct,Za as Dr,cb as Fr,db as Ir,jb as Xi,m as cr,mb as Rr,s as qt,t as jt,vb as Or,xb as de,za as zr}from"./chunk-ZYNBYM7I.js";import{$ as et,$a as A,Ab as W,Ac as Ke,Ae as yr,Af as Lr,B as T,Bb as nt,Bd as at,C as $e,Db as M,Dd as ke,E as $n,Ef as Er,Fb as k,G as qn,Ga as Yn,Gb as Wi,Ha as De,Hb as $i,Ia as Vt,Ib as er,Id as lt,Jd as ce,Kb as qi,Kf as Kt,La as tt,Lb as ji,Mb as Bt,Na as p,Nb as Ht,Ob as tr,Oe as Cr,Pa as le,Pb as Y,Pc as Ie,Qb as je,Sb as x,Se as Sr,Tb as j,Ub as Ki,Vc as $t,Wa as Me,Wb as me,Wc as sr,Xb as pe,Xc as Z,Yb as ge,ab as _e,ae as fr,bb as Qn,bd as rt,c as Bn,ca as jn,cb as Hi,cd as ar,da as J,dc as Ut,dd as lr,de as dr,ea as ze,ee as ur,f as bt,fe as hr,gc as ir,gf as xr,he as mr,ia as y,id as ot,ie as pr,jc as V,k as Hn,kb as R,kc as nr,lb as O,lc as Q,le as gr,mb as Xn,mc as rr,me as vr,na as E,nd as st,ne as br,oa as z,ob as Ui,of as Mr,pb as Gi,q as Un,qb as b,qc as Gt,qf as kr,ra as Kn,rb as h,rc as Fe,sb as m,sc as Yi,t as Gn,tb as _,u as We,ua as ie,ub as Jn,uc as or,ug as fe,v as Ze,vb as Zn,vc as K,vf as wr,w as Wn,wa as yt,wb as it,wc as Wt,xc as ve,za as qe,zc as Qi}from"./chunk-CFXAKPPB.js";import{a as Nt,b as Bi,i as B}from"./chunk-KAVP6UXH.js";var L=(function(e){return e.MAKE="make",e.COPY="copy",e.MOVE="move",e.DELETE="delete",e.COMPRESS="compress",e.DECOMPRESS="decompress",e.DOWNLOAD="download",e.UPLOAD="upload",e.TOUCH="touch",e.THUMBNAIL="thumbnail",e.GET_SIZE="getSize",e.LOCK="lock",e.UNLOCK="unlock",e.UNLOCK_REQUEST="unlockRequest",e})(L||{}),Le=(function(e){return e.VIEW="view",e.EDIT="edit",e})(Le||{}),Co="forceAsFileOwner";var re={BASE:Qt.BASE,OPERATION:"operation",TASK_OPERATION:"task/operation",TASKS:"tasks",TASKS_DOWNLOAD:"download",RECENTS:"recents",SEARCH:"search"},ut=`${re.BASE}/${re.OPERATION}`,n2=`${ut}/${L.THUMBNAIL}`,on=`${ut}/${L.MAKE}`,sn=`${ut}/${L.UPLOAD}`,an=`${re.BASE}/${re.TASK_OPERATION}`,So=`${an}/${L.DOWNLOAD}`,xo=`${an}/${L.COMPRESS}`,Mo=`${an}/${L.DECOMPRESS}`,wt=`${re.BASE}/${re.TASKS}`,ko=`${re.BASE}/${re.TASKS}/${re.TASKS_DOWNLOAD}`,wo=`${re.BASE}/${re.RECENTS}`,Lo=`${re.BASE}/${re.SEARCH}`;var Eo="Collabora";var zo=new Set(["doc","docx","docm","dot","dotx","dotm","odt","ott","rtf","fodt","sxw","stw","xls","xlsx","xlsm","xlt","xltx","ods","ots","csv","fods","sxc","sdc","ppt","pptx","pptm","pps","ppsx","odp","otp","fodp","sxi","sdd","odg"]);var _o="OnlyOffice";var Po=new Map([["doc","word"],["docm","word"],["docx","word"],["dot","word"],["dotm","word"],["dotx","word"],["epub","word"],["fb2","word"],["fodt","word"],["gdoc","word"],["hwp","word"],["hwpx","word"],["mht","word"],["mhtml","word"],["odt","word"],["ott","word"],["pages","word"],["rtf","word"],["stw","word"],["sxw","word"],["wps","word"],["wpt","word"],["csv","cell"],["et","cell"],["ett","cell"],["fods","cell"],["gsheet","cell"],["numbers","cell"],["ods","cell"],["ots","cell"],["sxc","cell"],["xls","cell"],["xlsb","cell"],["xlsm","cell"],["xlsx","cell"],["xlt","cell"],["xltm","cell"],["xltx","cell"],["dps","slide"],["dpt","slide"],["fodp","slide"],["gslide","slide"],["key","slide"],["odg","slide"],["odp","slide"],["otp","slide"],["pot","slide"],["potm","slide"],["potx","slide"],["pps","slide"],["ppsm","slide"],["ppsx","slide"],["ppt","slide"],["pptm","slide"],["pptx","slide"],["sxi","slide"],["djvu","pdf"],["docxf","pdf"],["oform","pdf"],["oxps","pdf"],["pdf","pdf"],["xps","pdf"],["vsdm","diagram"],["vsdx","diagram"],["vssm","diagram"],["vssx","diagram"],["vstm","diagram"],["vstx","diagram"]]);var Ao=(()=>{let i=class i{constructor(){this.inPersonalSpace=!1,this.http=y(Z),this.layout=y($),this.breadCrumbFilesRepo=!1,this.inShareRepo=!1,this.inRootSpace=!1}setEnvironment(t,n){this.breadCrumbFilesRepo=Re.FILES===t,this.inPersonalSpace=n.length&&n[0].path===Re.PERSONAL,this.inShareRepo=t===Re.SHARES,this.inRootSpace=this.inShareRepo?n.length===0:n.length===1,this.browseApi=Fr(`${Nr}/${t}`,n,!1),this.breadCrumbUrl=`/${Re.SPACES}/${t}${Ir(n)}`,this.breadCrumbIcon=this.inShareRepo?ne.SHARED_WITH_ME:this.breadCrumbFilesRepo?this.inPersonalSpace&&this.breadCrumbFilesRepo?ne.PERSONAL:ne.SPACES:ne.TRASH}loadFiles(){return this.http.get(this.browseApi).pipe(et(()=>{this.layout.setBreadcrumbIcon(this.breadCrumbIcon),this.layout.setBreadcrumbNav(this.breadcrumbNav())}),qn(t=>Un(()=>t)))}breadcrumbNav(){return{url:this.inPersonalSpace&&this.inRootSpace?`${this.breadCrumbUrl}/${Xt.SHORT_PERSONAL_FILES}`:this.inShareRepo&&this.inRootSpace?`${this.breadCrumbUrl}/${Xt.SHARED_WITH_ME}`:this.breadCrumbUrl,translating:this.inRootSpace&&(this.inPersonalSpace||this.inShareRepo),sameLink:this.inRootSpace&&(this.inPersonalSpace||this.inShareRepo),firstLink:this.inPersonalSpace&&this.breadCrumbFilesRepo?null:this.breadCrumbFilesRepo?Re.SPACES:this.inShareRepo?Re.SPACES_SHARES:Re.TRASH,mutateLevel:this.inPersonalSpace&&!this.breadCrumbFilesRepo&&!this.inRootSpace?{0:{setTitle:Xt.PERSONAL_FILES,translateTitle:!0}}:null,splicing:this.inPersonalSpace?!this.breadCrumbFilesRepo&&!this.inRootSpace?2:3:2}}};i.\u0275fac=function(n){return new(n||i)},i.\u0275prov=J({token:i,factory:i.\u0275fac,providedIn:"root"});let e=i;return e})();function Te(e){let i=`${e.info?`${e.info}`:""}${e.app?` ${e.app}`:""}`;return`${e.owner.fullName} (${e.owner.email})${i?` - ${i}`:""}`}var To=(()=>{let i=class i{transform(t){return t?Te(t):"unknown"}};i.\u0275fac=function(n){return new(n||i)},i.\u0275pipe=Hi({name:"fileLockFormatPipe",type:i,pure:!0});let e=i;return e})();function v1(e,i){e&1&&(h(0,"span",6),x(1,"The file is locked by"),m())}function b1(e,i){e&1&&(h(0,"span",6),x(1,"The file is edited by"),m())}function y1(e,i){e&1&&(h(0,"div",8)(1,"small",11),x(2,"As the file owner, you can unlock the file or request the current lock owner to release it."),m()())}function C1(e,i){if(e&1){let o=W();h(0,"button",14),M("click",function(){E(o);let n=k(2);return z(n.onUnlock())}),x(1,"Unlock"),m()}if(e&2){let o=k(2);b("disabled",o.submitted)}}function S1(e,i){if(e&1){let o=W();h(0,"button",15),M("click",function(){E(o);let n=k(2);return z(n.onSendUnLockRequest())}),x(1,"Send an unlock request"),m()}if(e&2){let o=k(2);b("disabled",o.submitted)}}function x1(e,i){if(e&1&&(R(0,C1,2,1,"button",12),R(1,S1,2,1,"button",13)),e&2){let o=k();O(o.isLockOwner||o.isFileOwner?0:-1),p(),O(o.isLockOwner?-1:1)}}var Do=(()=>{let i=class i{constructor(){this.locale=y(ke),this.layout=y($),this.icons={faLock:Kt,faUnlock:hr},this.submitted=!1,this.store=y(de),this.userLogin=this.store.user.getValue().login,this.isFileOwner=!1,this.isLockOwner=!1,this.hasExclusiveLock=!0,this.spacesBrowserService=y(Ao),this.filesService=y(ht)}ngOnInit(){this.hasExclusiveLock=this.file.lock.isExclusive,this.isFileOwner=this.spacesBrowserService.inPersonalSpace||this.file.root?.owner?.login===this.userLogin,this.isLockOwner=this.file.lock.owner.login===this.userLogin,this.userAvatarUrl=Or(this.file.lock.owner.login)}onEnter(){return B(this,null,function*(){this.isLockOwner||this.isFileOwner?yield this.onUnlock():this.onSendUnLockRequest()})}onEsc(){this.layout.closeDialog()}onUnlock(){return B(this,null,function*(){try{this.submitted=!0,yield We(this.filesService.unlock(this.file,this.isFileOwner)),this.file.removeLock(),this.layout.closeDialog()}catch(t){this.submitted=!1,this.layout.sendNotification("warning",this.file.name,t.error.message)}})}onSendUnLockRequest(){this.submitted=!0,this.filesService.unlockRequest(this.file).subscribe({next:()=>this.layout.closeDialog(),error:t=>{this.submitted=!1,this.layout.sendNotification("warning",this.file.name,t.error.message)}})}};i.\u0275fac=function(n){return new(n||i)},i.\u0275cmp=A({type:i,selectors:[["app-files-lock-dialog"]],hostBindings:function(n,r){n&1&&M("keyup.enter",function(){return r.onEnter()},tt)("keyup.escape",function(){return r.onEsc()},tt)},inputs:{file:"file"},decls:19,vars:10,consts:[[1,"modal-header"],[1,"modal-title"],[3,"icon"],["aria-label","Close","type","button",1,"btn-close","btn-close-white",3,"click"],[1,"modal-body"],[1,"d-flex","flex-column","align-items-center","avatar","my-2"],["l10nTranslate","",1,"mb-2"],["alt","",1,"avatar-img","mb-2",3,"src"],[1,"text-align-center","mt-3","mb-1"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-secondary",3,"click"],["l10nTranslate",""],["type","button","l10nTranslate","",1,"btn","btn-primary",3,"disabled"],["type","button","l10nTranslate","",1,"btn","btn-success",3,"disabled"],["type","button","l10nTranslate","",1,"btn","btn-primary",3,"click","disabled"],["type","button","l10nTranslate","",1,"btn","btn-success",3,"click","disabled"]],template:function(n,r){n&1&&(h(0,"div",0)(1,"h4",1),_(2,"fa-icon",2),h(3,"span"),x(4),m()(),h(5,"button",3),M("click",function(){return r.layout.closeDialog()}),m()(),h(6,"div",4)(7,"div",5),R(8,v1,2,0,"span",6)(9,b1,2,0,"span",6),_(10,"img",7),h(11,"b"),x(12),V(13,"fileLockFormatPipe"),m()(),R(14,y1,3,0,"div",8),m(),h(15,"div",9)(16,"button",10),M("click",function(){return r.layout.closeDialog()}),x(17),m(),R(18,x1,2,2),m()),n&2&&(p(2),b("icon",r.hasExclusiveLock?r.icons.faLock:r.icons.faUnlock),p(2),j(r.file.name),p(4),O(r.hasExclusiveLock?8:9),p(2),b("src",r.userAvatarUrl,De),p(2),j(nr(13,8,r.file.lock)),p(2),O(r.hasExclusiveLock&&!r.isLockOwner&&r.isFileOwner?14:-1),p(3),Ki(" ",r.hasExclusiveLock?"Cancel":"Close"," "),p(),O(r.hasExclusiveLock?18:-1))},dependencies:[fe,ce,To],encapsulation:2});let e=i;return e})();var M1=(e,i)=>({old:e,new:i});function k1(e,i){e&1&&(h(0,"span",3),x(1,"Replace Existing File"),m())}function w1(e,i){e&1&&(h(0,"span",3),x(1,"Overwrite Existing File(s)"),m())}function L1(e,i){if(e&1&&(_(0,"div",6),V(1,"translate")),e&2){let o=k();b("innerHTML",rr(1,1,"RenameFileToExisting",o.locale.language,ir(5,M1,o.files[0].name,o.renamedTo)),Yn)}}function E1(e,i){if(e&1){let o=W();h(0,"div",11)(1,"img",12),M("error",function(){let n=E(o).$implicit;return z(n.fallBackMimeUrl())}),m(),h(2,"div",13)(3,"span"),x(4),m()()()}if(e&2){let o=i.$implicit;p(),b("src",o.mimeUrl,De),p(3),j(o.name)}}function z1(e,i){if(e&1&&(h(0,"div",10),x(1,"Do you want to replace the existing file(s)?"),m(),Ui(2,E1,5,2,"div",11,Xn)),e&2){let o=k();p(2),Gi(o.files)}}var Fo=(()=>{let i=class i{constructor(){this.files=[],this.overwrite=or(),this.locale=y(ke),this.layout=y($),this.icons={faFileShield:Sr},this.submitted=!1}onAction(t){this.submitted=t,this.overwrite.emit(t),this.layout.closeDialog()}};i.\u0275fac=function(n){return new(n||i)},i.\u0275cmp=A({type:i,selectors:[["app-files-overwrite-dialog"]],inputs:{files:"files",renamedTo:"renamedTo"},outputs:{overwrite:"overwrite"},decls:14,vars:4,consts:[[1,"modal-header"],[1,"modal-title"],[3,"icon"],["l10nTranslate",""],["aria-label","Close","type","button",1,"btn-close","btn-close-white",3,"click"],[1,"modal-body"],[3,"innerHTML"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-secondary",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-danger",3,"click","disabled"],["l10nTranslate","",1,"text-bold","mb-3"],["draggable","true",1,"d-flex","align-items-center","mb-1"],["alt","","height","24","width","24",3,"error","src"],[1,"d-flex","flex-column","text-truncate","ms-1"]],template:function(n,r){n&1&&(h(0,"div",0)(1,"h4",1),_(2,"fa-icon",2),R(3,k1,2,0,"span",3)(4,w1,2,0,"span",3),m(),h(5,"button",4),M("click",function(){return r.layout.closeDialog()}),m()(),h(6,"div",5),R(7,L1,2,8,"div",6)(8,z1,4,0),m(),h(9,"div",7)(10,"button",8),M("click",function(){return r.onAction(!1)}),x(11,"Cancel"),m(),h(12,"button",9),M("click",function(){return r.onAction(!0)}),x(13,"Confirm"),m()()),n&2&&(p(2),b("icon",r.icons.faFileShield),p(),O(r.renamedTo?3:4),p(4),O(r.renamedTo?7:8),p(5),b("disabled",r.submitted))},dependencies:[fe,ce,lt],encapsulation:2});let e=i;return e})();var fi={BASE:"/wopi",FILES:"files",CONTENTS:"contents",SETTINGS:"settings"},Io=`${fi.BASE}/${fi.SETTINGS}`,U2=`${fi.BASE}/${fi.FILES}`;function _1(e,i){if(e&1&&(Jn(0,"div",1),it(1,"iframe",2),Zn()),e&2){let o=k();Y("height",o.currentHeight(),"px"),p(),nt("src",o.documentServerUrl,Vt)}}var Ro=(()=>{let i=class i{constructor(){this.file=K.required(),this.isReadonly=ve.required(),this.currentHeight=K(),this.documentServerUrl=null,this.http=y(Z),this.layout=y($),this.store=y(de),this.sanitizer=y(rt)}ngOnInit(){this.http.get(`${Io}/${this.file().path}`).subscribe({next:t=>{if(!t){this.layout.closeDialog(),this.layout.sendNotification("error","Unable to open document","Settings are missing");return}t.hasLock&&(this.file().lock?this.file().lock.isExclusive||this.layout.sendNotification("info","The file is locked",Te(t.hasLock)):this.file().createLock(t.hasLock)),this.isReadonly.set(t.mode===Le.VIEW),!this.isReadonly()&&!this.file().lock&&this.file().createLock({owner:{login:this.store.user.getValue().login,fullName:this.store.user.getValue().fullName,email:this.store.user.getValue().email},app:Eo,isExclusive:!1}),this.documentServerUrl=this.sanitizer.bypassSecurityTrustResourceUrl(`${t.documentServerUrl}&lang=${this.layout.getCurrentLanguage()}`)},error:t=>{this.layout.closeDialog(),this.layout.sendNotification("error","Unable to open document",t.error.message)}})}ngOnDestroy(){!this.isReadonly()&&this.file().lock&&this.file().lock.owner.login===this.store.user.getValue().login&&this.file().removeLock()}};i.\u0275fac=function(n){return new(n||i)},i.\u0275cmp=A({type:i,selectors:[["app-files-viewer-collabora-online"]],inputs:{file:[1,"file"],isReadonly:[1,"isReadonly"],currentHeight:[1,"currentHeight"]},outputs:{isReadonly:"isReadonlyChange"},decls:1,vars:1,consts:[[1,"app-collabora-online-border",3,"height"],[1,"app-collabora-online-border"],["allow","clipboard-read *; clipboard-write *; fullscreen",1,"app-viewer-iframe","collabora-scaling",3,"src"]],template:function(n,r){n&1&&R(0,_1,2,3,"div",0),n&2&&O(r.documentServerUrl?0:-1)},styles:[".collabora-scaling[_ngcontent-%COMP%]{transform:scale(.9);transform-origin:0 0;width:111.1111111111%;height:111.1111111111%}"]});let e=i;return e})();var A1=["image"];function T1(e,i){if(e&1){let o=W();h(0,"button",5),V(1,"translate"),M("click",function(){E(o);let n=k();return z(n.startSlideshow())}),_(2,"fa-icon",4),m()}if(e&2){let o=k();b("tooltip",Q(1,2,"Start Slideshow",o.locale.language)),p(2),b("icon",o.icons.faPlay)}}function D1(e,i){if(e&1){let o=W();h(0,"button",5),V(1,"translate"),M("click",function(){E(o);let n=k();return z(n.stopSlideshow())}),_(2,"fa-icon",4),m()}if(e&2){let o=k();b("tooltip",Q(1,2,"Stop slideshow",o.locale.language)),p(2),b("icon",o.icons.faStop)}}var No=(()=>{let i=class i{constructor(){this.file=ve.required(),this.directoryImages=K.required(),this.currentHeight=K.required(),this.currentHeightWithOffset=Fe(()=>this.currentHeight()-40),this.isInfoboxOpen=ie(!1),this.isSlideshowActive=ie(!1),this.imageCount=Fe(()=>this.directoryImages().length),this.imageIndex=Fe(()=>this.directoryImages().indexOf(this.file())),this.imageResolution=ie(""),this.icons={faAngleLeft:br,faAngleRight:Cr,faExpand:gr,faInfo:kr,faPlay:xr,faStop:vr},this.locale=y(ke),this.slideDelay=5e3,this.destroyRef=y(Kn),this.imageRef=Wt.required("image")}onImageLoad(){let t=this.imageRef().nativeElement;this.imageResolution.set(`${t.naturalWidth}x${t.naturalHeight}`)}nextImage(){this.file.set(this.directoryImages()[(this.imageIndex()+1)%this.imageCount()])}previousImage(){this.file.set(this.directoryImages()[(this.imageCount()+this.imageIndex()-1)%this.imageCount()])}fullscreen(){this.imageRef().nativeElement.requestFullscreen()}startSlideshow(){this.isSlideshowActive.set(!0),this.slideshowSub=$e(this.slideDelay,this.slideDelay).pipe(cr(this.destroyRef)).subscribe(()=>this.nextImage())}stopSlideshow(){this.slideshowSub?.unsubscribe(),this.isSlideshowActive.set(!1)}};i.\u0275fac=function(n){return new(n||i)},i.\u0275cmp=A({type:i,selectors:[["app-files-viewer-image"]],viewQuery:function(n,r){n&1&&Bt(r.imageRef,A1,5),n&2&&Ht()},inputs:{file:[1,"file"],directoryImages:[1,"directoryImages"],currentHeight:[1,"currentHeight"]},outputs:{file:"fileChange"},decls:43,vars:47,consts:[["image",""],[1,"app-top-menu","d-flex","justify-content-between"],[1,"d-flex"],["container","body","type","button",1,"btn","btn-custom","me-1",3,"click","tooltip","adaptivePosition"],[3,"icon"],["container","body","type","button",1,"btn","btn-custom","me-1",3,"click","tooltip"],["container","body","type","button",1,"btn","btn-custom","me-1",3,"tooltip"],[1,"px-2"],["l10nTranslate","",1,"px-1"],["btnCheckbox","","container","body","type","button",1,"d-none","d-sm-block","btn","btn-custom","me-1",3,"ngModelChange","ngModel","tooltip"],[1,"app-viewer-image"],["alt","",3,"load","src"],[1,"info-box","p-2","m-2","d-flex","flex-column","app-small-card","rounded","opacity-75"],[1,"d-flex","mb-1"],[1,"d-flex","col-sm","text-bold"]],template:function(n,r){if(n&1){let s=W();h(0,"div",1)(1,"div",2)(2,"button",3),V(3,"translate"),M("click",function(){return E(s),z(r.previousImage())}),_(4,"fa-icon",4),m(),h(5,"button",5),V(6,"translate"),M("click",function(){return E(s),z(r.nextImage())}),_(7,"fa-icon",4),m(),R(8,T1,3,5,"button",6)(9,D1,3,5,"button",6),h(10,"button",5),V(11,"translate"),M("click",function(){return E(s),z(r.fullscreen())}),_(12,"fa-icon",4),m()(),h(13,"div",7),x(14),h(15,"span",8),x(16,"of"),m(),x(17),m(),h(18,"button",9),V(19,"translate"),ge("ngModelChange",function(l){return E(s),pe(r.isInfoboxOpen,l)||(r.isInfoboxOpen=l),z(l)}),_(20,"fa-icon",4),m()(),h(21,"div",10)(22,"img",11,0),M("load",function(){return E(s),z(r.onImageLoad())}),m(),h(24,"div",12)(25,"div",13)(26,"div",14),x(27),V(28,"translate"),m(),h(29,"div"),x(30),m()(),h(31,"div",13)(32,"div",14),x(33),V(34,"translate"),m(),h(35,"div"),x(36),m()(),h(37,"div",13)(38,"div",14),x(39),V(40,"translate"),m(),h(41,"div"),x(42),m()()()()}n&2&&(p(2),b("tooltip",Q(3,26,"Previous",r.locale.language))("adaptivePosition",!0),p(2),b("icon",r.icons.faAngleLeft),p(),b("tooltip",Q(6,29,"Next",r.locale.language)),p(2),b("icon",r.icons.faAngleRight),p(),O(r.isSlideshowActive()?9:8),p(2),b("tooltip",Q(11,32,"Fullscreen",r.locale.language)),p(2),b("icon",r.icons.faExpand),p(2),j(r.imageIndex()+1),p(3),j(r.imageCount()),p(),me("ngModel",r.isInfoboxOpen),b("tooltip",Q(19,35,"Info",r.locale.language)),p(2),b("icon",r.icons.faInfo),p(),Y("height",r.currentHeightWithOffset(),"px"),p(),Y("max-height",r.currentHeightWithOffset(),"px"),b("src",r.file().dataUrl,De),p(2),je("d-none",!r.isInfoboxOpen()),p(3),j(Q(28,38,"Type",r.locale.language)),p(3),j(r.file().mime),p(3),j(Q(34,41,"Dimensions",r.locale.language)),p(3),j(r.imageResolution()),p(3),j(Q(40,44,"Size",r.locale.language)),p(3),j(r.file().hSize))},dependencies:[at,ot,st,jt,qt,fe,Zt,ce,lt],encapsulation:2,changeDetection:0});let e=i;return e})();var F1=["*"],oe=(()=>{let i=class i{};i.VG_ENDED="ended",i.VG_PAUSED="paused",i.VG_PLAYING="playing",i.VG_LOADING="waiting",i.\u0275fac=function(n){return new(n||i)},i.\u0275prov=J({token:i,factory:i.\u0275fac,providedIn:"root"});let e=i;return e})(),Et=(()=>{let i=class i{constructor(){this.medias={},this.playerReadyEvent=new le(!0),this.isPlayerReady=!1}onPlayerReady(t){this.fsAPI=t,this.isPlayerReady=!0,this.playerReadyEvent.emit(this)}getDefaultMedia(){for(let t in this.medias)if(this.medias[t])return this.medias[t]}getMasterMedia(){let t;for(let n in this.medias)if(this.medias[n].vgMaster==="true"||this.medias[n].vgMaster===!0){t=this.medias[n];break}return t||this.getDefaultMedia()}isMasterDefined(){let t=!1;for(let n in this.medias)if(this.medias[n].vgMaster==="true"||this.medias[n].vgMaster===!0){t=!0;break}return t}getMediaById(t=null){let n=this.medias[t];return(!t||t==="*")&&(n=this),n}play(){for(let t in this.medias)this.medias[t]&&this.medias[t].play()}pause(){for(let t in this.medias)this.medias[t]&&this.medias[t].pause()}get duration(){return this.$$getAllProperties("duration")}set currentTime(t){this.$$setAllProperties("currentTime",t)}get currentTime(){return this.$$getAllProperties("currentTime")}set state(t){this.$$setAllProperties("state",t)}get state(){return this.$$getAllProperties("state")}set volume(t){this.$$setAllProperties("volume",t)}get volume(){return this.$$getAllProperties("volume")}set playbackRate(t){this.$$setAllProperties("playbackRate",t)}get playbackRate(){return this.$$getAllProperties("playbackRate")}get canPlay(){return this.$$getAllProperties("canPlay")}get canPlayThrough(){return this.$$getAllProperties("canPlayThrough")}get isMetadataLoaded(){return this.$$getAllProperties("isMetadataLoaded")}get isWaiting(){return this.$$getAllProperties("isWaiting")}get isCompleted(){return this.$$getAllProperties("isCompleted")}get isLive(){return this.$$getAllProperties("isLive")}get isMaster(){return this.$$getAllProperties("isMaster")}get time(){return this.$$getAllProperties("time")}get buffer(){return this.$$getAllProperties("buffer")}get buffered(){return this.$$getAllProperties("buffered")}get subscriptions(){return this.$$getAllProperties("subscriptions")}get textTracks(){return this.$$getAllProperties("textTracks")}seekTime(t,n=!1){for(let r in this.medias)this.medias[r]&&this.$$seek(this.medias[r],t,n)}$$seek(t,n,r=!1){let s,a=t.duration;r?(this.isMasterDefined()&&(a=this.getMasterMedia().duration),s=n*a/100):s=n,t.currentTime=s}addTextTrack(t,n,r){for(let s in this.medias)this.medias[s]&&this.$$addTextTrack(this.medias[s],t,n,r)}$$addTextTrack(t,n,r,s){t.addTextTrack(n,r,s)}$$getAllProperties(t){let n={},r;for(let a in this.medias)this.medias[a]&&(n[a]=this.medias[a]);switch(Object.keys(n).length){case 0:switch(t){case"state":r=oe.VG_PAUSED;break;case"playbackRate":case"volume":r=1;break;case"time":r={current:0,total:0,left:0};break}break;case 1:let a=Object.keys(n)[0];r=n[a][t];break;default:let l=this.getMasterMedia();r=n[l.id][t]}return r}$$setAllProperties(t,n){for(let r in this.medias)this.medias[r]&&(this.medias[r][t]=n)}registerElement(t){this.videogularElement=t}registerMedia(t){this.medias[t.id]=t}unregisterMedia(t){delete this.medias[t.id]}};i.\u0275fac=function(n){return new(n||i)},i.\u0275prov=J({token:i,factory:i.\u0275fac,providedIn:"root"});let e=i;return e})(),ln=(()=>{let i=class i{constructor(){this.isHiddenSubject=new bt,this.isHidden=this.isHiddenSubject.asObservable()}state(t){this.isHiddenSubject.next(t)}};i.\u0275fac=function(n){return new(n||i)},i.\u0275prov=J({token:i,factory:i.\u0275fac,providedIn:"root"});let e=i;return e})(),Lt=(()=>{let i=class i{static getZIndex(){let t=1,n,r=document.getElementsByTagName("*");for(let s=0,a=r.length;s<a;s++)n=parseInt(window.getComputedStyle(r[s])["z-index"],10),n>t&&(t=n+1);return t}static isMobileDevice(){return typeof window.orientation<"u"||navigator.userAgent.indexOf("IEMobile")!==-1}static isiOSDevice(){return(navigator.userAgent.match(/ip(hone|ad|od)/i)||i.isIpadOS())&&!navigator.userAgent.match(/(iemobile)[\/\s]?([\w\.]*)/i)}static isIpadOS(){return navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)}static isCordova(){return document.URL.indexOf("http://")===-1&&document.URL.indexOf("https://")===-1}};i.\u0275fac=function(n){return new(n||i)},i.\u0275prov=J({token:i,factory:i.\u0275fac,providedIn:"root"});let e=i;return e})(),cn=(()=>{let i=class i{constructor(){this.nativeFullscreen=!0,this.isFullscreen=!1,this.onChangeFullscreen=new le}init(t,n){this.videogularElement=t,this.medias=n;let r={w3:{enabled:"fullscreenEnabled",element:"fullscreenElement",request:"requestFullscreen",exit:"exitFullscreen",onchange:"fullscreenchange",onerror:"fullscreenerror"},newWebkit:{enabled:"webkitFullscreenEnabled",element:"webkitFullscreenElement",request:"webkitRequestFullscreen",exit:"webkitExitFullscreen",onchange:"webkitfullscreenchange",onerror:"webkitfullscreenerror"},oldWebkit:{enabled:"webkitIsFullScreen",element:"webkitCurrentFullScreenElement",request:"webkitRequestFullScreen",exit:"webkitCancelFullScreen",onchange:"webkitfullscreenchange",onerror:"webkitfullscreenerror"},moz:{enabled:"mozFullScreen",element:"mozFullScreenElement",request:"mozRequestFullScreen",exit:"mozCancelFullScreen",onchange:"mozfullscreenchange",onerror:"mozfullscreenerror"},ios:{enabled:"webkitFullscreenEnabled",element:"webkitFullscreenElement",request:"webkitEnterFullscreen",exit:"webkitExitFullscreen",onchange:"webkitendfullscreen",onerror:"webkitfullscreenerror"},ms:{enabled:"msFullscreenEnabled",element:"msFullscreenElement",request:"msRequestFullscreen",exit:"msExitFullscreen",onchange:"MSFullscreenChange",onerror:"MSFullscreenError"}};for(let a in r)if(r[a].enabled in document){this.polyfill=r[a];break}if(Lt.isiOSDevice()&&(this.polyfill=r.ios),this.isAvailable=this.polyfill!=null,this.polyfill==null)return;let s;switch(this.polyfill.onchange){case"mozfullscreenchange":s=document;break;case"webkitendfullscreen":s=this.medias.toArray()[0].elem;break;default:s=t}this.fsChangeSubscription=T(s,this.polyfill.onchange).subscribe(()=>{this.onFullscreenChange()})}onFullscreenChange(){this.isFullscreen=!!document[this.polyfill.element],this.onChangeFullscreen.emit(this.isFullscreen)}toggleFullscreen(t=null){return this.isFullscreen?this.exit():this.request(t)}request(t){return t||(t=this.videogularElement),this.isFullscreen=!0,this.onChangeFullscreen.emit(!0),this.isAvailable&&this.nativeFullscreen?Lt.isMobileDevice()?((!this.polyfill.enabled&&t===this.videogularElement||Lt.isiOSDevice())&&(t=this.medias.toArray()[0].elem),this.enterElementInFullScreen(t)):this.enterElementInFullScreen(this.videogularElement):Promise.resolve()}enterElementInFullScreen(t){return t[this.polyfill.request]()}exit(){return this.isFullscreen=!1,this.onChangeFullscreen.emit(!1),this.isAvailable&&this.nativeFullscreen?document[this.polyfill.exit]():Promise.resolve()}};i.\u0275fac=function(n){return new(n||i)},i.\u0275prov=J({token:i,factory:i.\u0275fac,providedIn:"root"});let e=i;return e})(),F=(()=>{let i=class i{};i.VG_ABORT="abort",i.VG_CAN_PLAY="canplay",i.VG_CAN_PLAY_THROUGH="canplaythrough",i.VG_DURATION_CHANGE="durationchange",i.VG_EMPTIED="emptied",i.VG_ENCRYPTED="encrypted",i.VG_ENDED="ended",i.VG_ERROR="error",i.VG_LOADED_DATA="loadeddata",i.VG_LOADED_METADATA="loadedmetadata",i.VG_LOAD_START="loadstart",i.VG_PAUSE="pause",i.VG_PLAY="play",i.VG_PLAYING="playing",i.VG_PROGRESS="progress",i.VG_RATE_CHANGE="ratechange",i.VG_SEEK="seek",i.VG_SEEKED="seeked",i.VG_SEEKING="seeking",i.VG_STALLED="stalled",i.VG_SUSPEND="suspend",i.VG_TIME_UPDATE="timeupdate",i.VG_VOLUME_CHANGE="volumechange",i.VG_WAITING="waiting",i.VG_LOAD="load",i.VG_ENTER="enter",i.VG_EXIT="exit",i.VG_START_ADS="startads",i.VG_END_ADS="endads",i.\u0275fac=function(n){return new(n||i)},i.\u0275prov=J({token:i,factory:i.\u0275fac,providedIn:"root"});let e=i;return e})();var fn=(()=>{let i=class i{constructor(t,n){this.api=t,this.ref=n,this.state=oe.VG_PAUSED,this.time={current:0,total:0,left:0},this.buffer={end:0},this.canPlay=!1,this.canPlayThrough=!1,this.isMetadataLoaded=!1,this.isWaiting=!1,this.isCompleted=!1,this.isLive=!1,this.isBufferDetected=!1,this.checkInterval=200,this.currentPlayPos=0,this.lastPlayPos=0,this.playAtferSync=!1,this.bufferDetected=new bt}ngOnInit(){this.vgMedia.nodeName?this.elem=this.vgMedia:this.elem=this.vgMedia.elem,this.api.registerMedia(this),this.subscriptions={abort:T(this.elem,F.VG_ABORT),canPlay:T(this.elem,F.VG_CAN_PLAY),canPlayThrough:T(this.elem,F.VG_CAN_PLAY_THROUGH),durationChange:T(this.elem,F.VG_DURATION_CHANGE),emptied:T(this.elem,F.VG_EMPTIED),encrypted:T(this.elem,F.VG_ENCRYPTED),ended:T(this.elem,F.VG_ENDED),error:T(this.elem,F.VG_ERROR),loadedData:T(this.elem,F.VG_LOADED_DATA),loadedMetadata:T(this.elem,F.VG_LOADED_METADATA),loadStart:T(this.elem,F.VG_LOAD_START),pause:T(this.elem,F.VG_PAUSE),play:T(this.elem,F.VG_PLAY),playing:T(this.elem,F.VG_PLAYING),progress:T(this.elem,F.VG_PROGRESS),rateChange:T(this.elem,F.VG_RATE_CHANGE),seeked:T(this.elem,F.VG_SEEKED),seeking:T(this.elem,F.VG_SEEKING),stalled:T(this.elem,F.VG_STALLED),suspend:T(this.elem,F.VG_SUSPEND),timeUpdate:T(this.elem,F.VG_TIME_UPDATE),volumeChange:T(this.elem,F.VG_VOLUME_CHANGE),waiting:T(this.elem,F.VG_WAITING),startAds:T(window,F.VG_START_ADS),endAds:T(window,F.VG_END_ADS),mutation:new Bn(t=>{let n=new MutationObserver(r=>{t.next(r)});return n.observe(this.elem,{childList:!0,attributes:!0}),()=>{n.disconnect()}}),bufferDetected:this.bufferDetected},this.mutationObs=this.subscriptions.mutation.subscribe(this.onMutation.bind(this)),this.canPlayObs=this.subscriptions.canPlay.subscribe(this.onCanPlay.bind(this)),this.canPlayThroughObs=this.subscriptions.canPlayThrough.subscribe(this.onCanPlayThrough.bind(this)),this.loadedMetadataObs=this.subscriptions.loadedMetadata.subscribe(this.onLoadMetadata.bind(this)),this.waitingObs=this.subscriptions.waiting.subscribe(this.onWait.bind(this)),this.progressObs=this.subscriptions.progress.subscribe(this.onProgress.bind(this)),this.endedObs=this.subscriptions.ended.subscribe(this.onComplete.bind(this)),this.playingObs=this.subscriptions.playing.subscribe(this.onStartPlaying.bind(this)),this.playObs=this.subscriptions.play.subscribe(this.onPlay.bind(this)),this.pauseObs=this.subscriptions.pause.subscribe(this.onPause.bind(this)),this.timeUpdateObs=this.subscriptions.timeUpdate.subscribe(this.onTimeUpdate.bind(this)),this.volumeChangeObs=this.subscriptions.volumeChange.subscribe(this.onVolumeChange.bind(this)),this.errorObs=this.subscriptions.error.subscribe(this.onError.bind(this)),this.vgMaster&&this.api.playerReadyEvent.subscribe(()=>{this.prepareSync()})}prepareSync(){let t=[];for(let n in this.api.medias)this.api.medias[n]&&t.push(this.api.medias[n].subscriptions.canPlay);this.canPlayAllSubscription=Wn(t).pipe(Ze((...n)=>{let r=a=>a?.target?a.target.readyState===4:!1;n.some(r)&&!this.syncSubscription&&(this.startSync(),this.syncSubscription.unsubscribe())})).subscribe()}startSync(){this.syncSubscription=$e(0,1e3).subscribe(()=>{for(let t in this.api.medias)if(this.api.medias[t]!==this){let n=this.api.medias[t].currentTime-this.currentTime;n<-.3||n>.3?(this.playAtferSync=this.state===oe.VG_PLAYING,this.pause(),this.api.medias[t].pause(),this.api.medias[t].currentTime=this.currentTime):this.playAtferSync&&(this.play(),this.api.medias[t].play(),this.playAtferSync=!1)}})}onMutation(t){for(let n=0,r=t.length;n<r;n++){let s=t[n];if(s.type==="attributes"&&s.attributeName==="src"){if(s.target.src&&s.target.src.length>0&&s.target.src.indexOf("blob:")<0){this.loadMedia();break}}else if(s.type==="childList"&&s.removedNodes.length&&s.removedNodes[0].nodeName.toLowerCase()==="source"){this.loadMedia();break}}}loadMedia(){this.vgMedia.pause(),this.vgMedia.currentTime=0,this.stopBufferCheck(),this.isBufferDetected=!0,this.bufferDetected.next(this.isBufferDetected),setTimeout(()=>this.vgMedia.load(),10)}play(){if(!(this.playPromise||this.state!==oe.VG_PAUSED&&this.state!==oe.VG_ENDED))return this.playPromise=this.vgMedia.play(),this.playPromise&&this.playPromise.then&&this.playPromise.catch&&this.playPromise.then(()=>{this.playPromise=null}).catch(()=>{this.playPromise=null}),this.playPromise}pause(){this.playPromise?this.playPromise.then(()=>{this.vgMedia.pause()}):this.vgMedia.pause()}get id(){let t;return this.vgMedia&&(t=this.vgMedia.id),t}get duration(){return this.vgMedia.duration===1/0?this.specifiedDuration:this.vgMedia.duration}set currentTime(t){this.vgMedia.currentTime=t}get currentTime(){return this.vgMedia.currentTime}set volume(t){this.vgMedia.volume=t}get volume(){return this.vgMedia.volume}set playbackRate(t){this.vgMedia.playbackRate=t}get playbackRate(){return this.vgMedia.playbackRate}get buffered(){return this.vgMedia.buffered}get textTracks(){return this.vgMedia.textTracks}onCanPlay(t){this.isBufferDetected=!1,this.bufferDetected.next(this.isBufferDetected),this.canPlay=!0,this.ref.detectChanges()}onCanPlayThrough(t){this.isBufferDetected=!1,this.bufferDetected.next(this.isBufferDetected),this.canPlayThrough=!0,this.ref.detectChanges()}onLoadMetadata(t){this.isMetadataLoaded=!0,this.time={current:0,left:0,total:this.duration*1e3},this.state=oe.VG_PAUSED;let n=Math.round(this.time.total);this.isLive=n===1/0,this.ref.detectChanges()}onWait(t){this.isWaiting=!0,this.ref.detectChanges()}onComplete(t){this.isCompleted=!0,this.state=oe.VG_ENDED,this.ref.detectChanges()}onStartPlaying(t){this.state=oe.VG_PLAYING,this.ref.detectChanges()}onPlay(t){this.state=oe.VG_PLAYING,this.vgMaster&&(!this.syncSubscription||this.syncSubscription.closed)&&this.startSync(),this.startBufferCheck(),this.ref.detectChanges()}onPause(t){this.state=oe.VG_PAUSED,this.vgMaster&&(this.playAtferSync||this.syncSubscription.unsubscribe()),this.stopBufferCheck(),this.ref.detectChanges()}onTimeUpdate(t){let n=this.buffered.length-1;this.time={current:this.currentTime*1e3,total:this.time.total,left:(this.duration-this.currentTime)*1e3},n>=0&&(this.buffer={end:this.buffered.end(n)*1e3}),this.ref.detectChanges()}onProgress(t){let n=this.buffered.length-1;n>=0&&(this.buffer={end:this.buffered.end(n)*1e3}),this.ref.detectChanges()}onVolumeChange(t){this.ref.detectChanges()}onError(t){this.ref.detectChanges()}bufferCheck(){let t=1/this.checkInterval;this.currentPlayPos=this.currentTime,!this.isBufferDetected&&this.currentPlayPos<this.lastPlayPos+t&&(this.isBufferDetected=!0),this.isBufferDetected&&this.currentPlayPos>this.lastPlayPos+t&&(this.isBufferDetected=!1),this.bufferDetected.closed||this.bufferDetected.next(this.isBufferDetected),this.lastPlayPos=this.currentPlayPos}startBufferCheck(){this.checkBufferSubscription=$e(0,this.checkInterval).subscribe(()=>{this.bufferCheck()})}stopBufferCheck(){this.checkBufferSubscription&&this.checkBufferSubscription.unsubscribe(),this.isBufferDetected=!1,this.bufferDetected.next(this.isBufferDetected)}seekTime(t,n=!1){let r,s=this.duration;n?r=t*s/100:r=t,this.currentTime=r}addTextTrack(t,n,r,s){let a=this.vgMedia.addTextTrack(t,n,r);return s&&(a.mode=s),a}ngOnDestroy(){this.vgMedia.src="",this.mutationObs?.unsubscribe(),this.canPlayObs?.unsubscribe(),this.canPlayThroughObs?.unsubscribe(),this.loadedMetadataObs?.unsubscribe(),this.waitingObs?.unsubscribe(),this.progressObs?.unsubscribe(),this.endedObs?.unsubscribe(),this.playingObs?.unsubscribe(),this.playObs?.unsubscribe(),this.pauseObs?.unsubscribe(),this.timeUpdateObs?.unsubscribe(),this.volumeChangeObs?.unsubscribe(),this.errorObs?.unsubscribe(),this.checkBufferSubscription?.unsubscribe(),this.syncSubscription?.unsubscribe(),this.bufferDetected?.complete(),this.bufferDetected?.unsubscribe(),this.api.unregisterMedia(this)}};i.\u0275fac=function(n){return new(n||i)(Me(Et),Me(Qi))},i.\u0275dir=Qn({type:i,selectors:[["","vgMedia",""]],inputs:{vgMedia:"vgMedia",vgMaster:"vgMaster"},standalone:!1});let e=i;return e})(),Vo=(()=>{let i=class i{constructor(t,n,r,s){this.api=n,this.fsAPI=r,this.controlsHidden=s,this.isFullscreen=!1,this.isNativeFullscreen=!1,this.areControlsHidden=!1,this.onPlayerReady=new le,this.onMediaReady=new le,this.subscriptions=[],this.elem=t.nativeElement,this.api.registerElement(this.elem)}ngAfterContentInit(){this.medias.toArray().forEach(t=>{this.api.registerMedia(t)}),this.fsAPI.init(this.elem,this.medias),this.subscriptions.push(this.fsAPI.onChangeFullscreen.subscribe(this.onChangeFullscreen.bind(this))),this.subscriptions.push(this.controlsHidden.isHidden.subscribe(this.onHideControls.bind(this))),this.api.onPlayerReady(this.fsAPI),this.onPlayerReady.emit(this.api)}onChangeFullscreen(t){this.fsAPI.nativeFullscreen?this.isNativeFullscreen=t:(this.isFullscreen=t,this.zIndex=t?Lt.getZIndex().toString():"auto")}onHideControls(t){this.areControlsHidden=t}ngOnDestroy(){this.subscriptions.forEach(t=>t.unsubscribe())}};i.\u0275fac=function(n){return new(n||i)(Me(qe),Me(Et),Me(cn),Me(ln))},i.\u0275cmp=A({type:i,selectors:[["vg-player"]],contentQueries:function(n,r,s){if(n&1&&er(s,fn,5),n&2){let a;qi(a=ji())&&(r.medias=a)}},hostVars:8,hostBindings:function(n,r){n&2&&(Y("z-index",r.zIndex),je("fullscreen",r.isFullscreen)("native-fullscreen",r.isNativeFullscreen)("controls-hidden",r.areControlsHidden))},outputs:{onPlayerReady:"onPlayerReady",onMediaReady:"onMediaReady"},standalone:!1,features:[Ut([Et,cn,ln])],ngContentSelectors:F1,decls:1,vars:0,template:function(n,r){n&1&&(Wi(),$i(0))},styles:[`vg-player{font-family:videogular;position:relative;display:flex;width:100%;height:100%;overflow:hidden;background-color:#000}vg-player.fullscreen{position:fixed;left:0;top:0}vg-player.native-fullscreen.controls-hidden{cursor:none}
2
+ `],encapsulation:2});let e=i;return e})(),I1=[Et,ln,cn,Lt,F,oe];var Ne=(()=>{let i=class i{};i.\u0275fac=function(n){return new(n||i)},i.\u0275mod=_e({type:i}),i.\u0275inj=ze({providers:[...I1],imports:[Ie]});let e=i;return e})();var Bo=(()=>{let i=class i{};i.\u0275fac=function(n){return new(n||i)},i.\u0275mod=_e({type:i}),i.\u0275inj=ze({imports:[Ie,Ne]});let e=i;return e})();var Ho=(()=>{let i=class i{};i.\u0275fac=function(n){return new(n||i)},i.\u0275mod=_e({type:i}),i.\u0275inj=ze({imports:[Ie,Ne]});let e=i;return e})();var Uo=(()=>{let i=class i{};i.\u0275fac=function(n){return new(n||i)},i.\u0275mod=_e({type:i}),i.\u0275inj=ze({imports:[Ie,Ne]});let e=i;return e})();var Go=(()=>{let i=class i{constructor(){this.fileUrl=K(),this.currentHeight=K()}};i.\u0275fac=function(n){return new(n||i)},i.\u0275cmp=A({type:i,selectors:[["app-files-viewer-media"]],inputs:{fileUrl:[1,"fileUrl"],currentHeight:[1,"currentHeight"]},decls:4,vars:4,consts:[["media",""],["preload","none","autoplay","","controls","",3,"vgMedia"],["type","video/webm",3,"src"]],template:function(n,r){if(n&1&&(h(0,"vg-player")(1,"video",1,0),_(3,"source",2),m()()),n&2){let s=tr(2);Y("height",r.currentHeight(),"px"),p(),b("vgMedia",s),p(2),b("src",r.fileUrl(),De)}},dependencies:[Ne,fn,Vo,Ho,Uo,Bo],encapsulation:2,changeDetection:0});let e=i;return e})();var zt={BASE:Qt.BASE,ONLY_OFFICE:"onlyoffice",SETTINGS:"settings",DOCUMENT:"document",CALLBACK:"callback"},dn=`${zt.BASE}/${zt.ONLY_OFFICE}`,Wo=`${dn}/${zt.SETTINGS}`,K0=`${dn}/${zt.DOCUMENT}`,Y0=`${dn}/${zt.CALLBACK}`;var O1=(e,i)=>B(null,null,function*(){return new Promise((o,t)=>{try{if(window.DocsAPI)return o(null);let n=document.getElementById(i);if(n){let r=setInterval(()=>{if(!n.getAttribute("loading")){if(clearInterval(r),window.DocsAPI)return o(null);let a=$o(i,e,o,t);n.remove(),document.body.appendChild(a)}},500)}else{let r=$o(i,e,o,t);document.body.appendChild(r)}}catch(n){console.error(n)}})}),$o=(e,i,o,t)=>{let n=document.createElement("script");return n.id=e,n.type="text/javascript",n.src=i,n.async=!0,n.onload=()=>{n.removeAttribute("loading"),o(null)},n.onerror=r=>{n.removeAttribute("loading"),t(r)},n.setAttribute("loading",""),n},qo=O1;var jo=(()=>{let i=class i{constructor(){this.loadError=new le,this.wasSaved=new le,this.isFirstOnChanges=!0,this.onLoad=()=>{try{if(window.DocsAPI||this.onError(-3),window?.DocEditor?.instances[this.id]){console.log("Skip loading, instance already exists",this.id);return}window?.DocEditor?.instances||(window.DocEditor={instances:{}});let t=JSON.parse(JSON.stringify(this.config));t.events={onDocumentStateChange:n=>n.data?this.wasSaved.emit():null},window.DocEditor.instances[this.id]=window.DocsAPI.DocEditor(this.id,t)}catch(t){console.error(t),this.onError(-1)}}}ngOnInit(){let t=this.documentServerUrl;t.endsWith("/")||(t+="/");let n=`${t}web-apps/apps/api/documents/api.js`;qo(n,"onlyoffice-api-script").then(()=>this.onLoad()).catch(()=>{this.onError(-2)})}ngOnChanges(t){if(this.isFirstOnChanges){this.isFirstOnChanges=!1;return}if("config"in t&&window?.DocEditor?.instances[this.id]){window.DocEditor.instances[this.id].destroyEditor(),window.DocEditor.instances[this.id]=void 0,console.warn("Important props have been changed, reloading ..."),this.onLoad();return}}ngOnDestroy(){window?.DocEditor?.instances[this.id]&&(window.DocEditor.instances[this.id].destroyEditor(),window.DocEditor.instances[this.id]=void 0,delete window.DocEditor.instances[this.id])}onError(t){let n={title:"Unknown OnlyOffice error",message:`Code: ${t}`};switch(t){case-2:n.title="Unable to load OnlyOffice editor",n.message="The document server may be unreachable or the configuration is invalid";break;case-3:n.title="OnlyOffice editor failed to initialize",n.message="DocsAPI not available";break}this.loadError.emit(n)}};i.\u0275fac=function(n){return new(n||i)},i.\u0275cmp=A({type:i,selectors:[["app-files-onlyoffice-document"]],inputs:{id:"id",documentServerUrl:"documentServerUrl",config:"config"},outputs:{loadError:"loadError",wasSaved:"wasSaved"},features:[yt],decls:1,vars:1,consts:[[3,"id"]],template:function(n,r){n&1&&it(0,"div",0),n&2&&nt("id",r.id)},encapsulation:2});let e=i;return e})();function N1(e,i){if(e&1){let o=W();h(0,"div")(1,"app-files-onlyoffice-document",1),M("loadError",function(n){E(o);let r=k();return z(r.loadError(n))})("wasSaved",function(){E(o);let n=k();return z(n.onSave())}),m()()}if(e&2){let o=k();Y("height",o.currentHeight(),"px"),p(),b("id",o.docId)("documentServerUrl",o.documentConfig.documentServerUrl)("config",o.documentConfig.config)}}var Ko=(()=>{let i=class i{constructor(){this.file=K.required(),this.isReadonly=ve.required(),this.currentHeight=K.required(),this.documentConfig=null,this.http=y(Z),this.layout=y($),this.store=y(de)}ngOnInit(){this.docId=`viewer-doc-${this.file().id}`,this.http.get(`${Wo}/${this.file().path}`).subscribe({next:t=>{if(!t){this.layout.closeDialog(),this.layout.sendNotification("error","Unable to open document","Settings are missing");return}t.hasLock&&(this.file().lock?this.file().lock.isExclusive||this.layout.sendNotification("info","The file is locked",Te(t.hasLock)):this.file().createLock(t.hasLock)),this.isReadonly.set(t.config.editorConfig.mode===Le.VIEW),!this.isReadonly()&&!this.file().lock&&this.file().createLock({owner:{login:this.store.user.getValue().login,fullName:this.store.user.getValue().fullName,email:this.store.user.getValue().email},app:_o,isExclusive:!1}),t.config.editorConfig.lang=this.layout.getCurrentLanguage(),t.config.editorConfig.region=t.config.editorConfig.lang,this.documentConfig=t},error:t=>{this.layout.closeDialog(),this.layout.sendNotification("error","Unable to open document",t.status===404?"Unable to load OnlyOffice editor":t.error.message)}})}loadError(t){this.layout.closeDialog(),this.layout.sendNotification("error",t.title,t.message)}onSave(){this.file().updateHTimeAgo()}ngOnDestroy(){!this.isReadonly()&&this.file().lock&&this.file().lock.owner.login===this.store.user.getValue().login&&this.file().removeLock()}};i.\u0275fac=function(n){return new(n||i)},i.\u0275cmp=A({type:i,selectors:[["app-files-viewer-only-office"]],inputs:{file:[1,"file"],isReadonly:[1,"isReadonly"],currentHeight:[1,"currentHeight"]},outputs:{isReadonly:"isReadonlyChange"},decls:1,vars:1,consts:[[3,"height"],[3,"loadError","wasSaved","id","documentServerUrl","config"]],template:function(n,r){n&1&&R(0,N1,2,5,"div",0),n&2&&O(r.documentConfig?0:-1)},dependencies:[jo],styles:[".doc-placeholder[_ngcontent-%COMP%]{display:none!important}"]});let e=i;return e})();var Yo=(()=>{let i=class i{constructor(){this.fileUrl=K(),this.currentHeight=K(),this.sanitizer=y(rt),this.pdfjsUrl=`${Hr}/pdfjs/web/viewer.html?file=`,this.url=Fe(()=>this.fileUrl()?this.sanitizer.bypassSecurityTrustResourceUrl(`${this.pdfjsUrl}${encodeURIComponent(this.fileUrl())}`):null)}};i.\u0275fac=function(n){return new(n||i)},i.\u0275cmp=A({type:i,selectors:[["app-files-viewer-pdf"]],inputs:{fileUrl:[1,"fileUrl"],currentHeight:[1,"currentHeight"]},decls:1,vars:3,consts:[[1,"app-viewer-iframe",3,"src"]],template:function(n,r){n&1&&it(0,"iframe",0),n&2&&(Y("height",r.currentHeight(),"px"),nt("src",r.url(),Vt))},encapsulation:2,changeDetection:0});let e=i;return e})();var V1=e=>{let{state:i}=e,o=i.doc.lineAt(i.selection.main.from),t=bn(e.state,o.from);return t.line?B1(e):t.block?U1(e):!1};function vn(e,i){return({state:o,dispatch:t})=>{if(o.readOnly)return!1;let n=e(i,o);return n?(t(o.update(n)),!0):!1}}var B1=vn($1,0);var H1=vn(rs,0);var U1=vn((e,i)=>rs(e,i,W1(i)),0);function bn(e,i){let o=e.languageDataAt("commentTokens",i,1);return o.length?o[0]:{}}var _t=50;function G1(e,{open:i,close:o},t,n){let r=e.sliceDoc(t-_t,t),s=e.sliceDoc(n,n+_t),a=/\s*$/.exec(r)[0].length,l=/^\s*/.exec(s)[0].length,f=r.length-a;if(r.slice(f-i.length,f)==i&&s.slice(l,l+o.length)==o)return{open:{pos:t-a,margin:a&&1},close:{pos:n+l,margin:l&&1}};let u,g;n-t<=2*_t?u=g=e.sliceDoc(t,n):(u=e.sliceDoc(t,t+_t),g=e.sliceDoc(n-_t,n));let v=/^\s*/.exec(u)[0].length,S=/\s*$/.exec(g)[0].length,P=g.length-S-o.length;return u.slice(v,v+i.length)==i&&g.slice(P,P+o.length)==o?{open:{pos:t+v+i.length,margin:/\s/.test(u.charAt(v+i.length))?1:0},close:{pos:n-S-o.length,margin:/\s/.test(g.charAt(P-1))?1:0}}:null}function W1(e){let i=[];for(let o of e.selection.ranges){let t=e.doc.lineAt(o.from),n=o.to<=t.to?t:e.doc.lineAt(o.to);n.from>t.from&&n.from==o.to&&(n=o.to==t.to+1?t:e.doc.lineAt(o.to-1));let r=i.length-1;r>=0&&i[r].to>t.from?i[r].to=n.to:i.push({from:t.from+/^\s*/.exec(t.text)[0].length,to:n.to})}return i}function rs(e,i,o=i.selection.ranges){let t=o.map(r=>bn(i,r.from).block);if(!t.every(r=>r))return null;let n=o.map((r,s)=>G1(i,t[s],r.from,r.to));if(e!=2&&!n.every(r=>r))return{changes:i.changes(o.map((r,s)=>n[s]?[]:[{from:r.from,insert:t[s].open+" "},{from:r.to,insert:" "+t[s].close}]))};if(e!=1&&n.some(r=>r)){let r=[];for(let s=0,a;s<n.length;s++)if(a=n[s]){let l=t[s],{open:f,close:u}=a;r.push({from:f.pos-l.open.length,to:f.pos+f.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:r}}return null}function $1(e,i,o=i.selection.ranges){let t=[],n=-1;e:for(let{from:r,to:s}of o){let a=t.length,l=1e9,f;for(let u=r;u<=s;){let g=i.doc.lineAt(u);if(f==null&&(f=bn(i,g.from).line,!f))continue e;if(g.from>n&&(r==s||s>g.from)){n=g.from;let v=/^\s*/.exec(g.text)[0].length,S=v==g.length,P=g.text.slice(v,v+f.length)==f?v:-1;v<g.text.length&&v<l&&(l=v),t.push({line:g,comment:P,token:f,indent:v,empty:S,single:!1})}u=g.to+1}if(l<1e9)for(let u=a;u<t.length;u++)t[u].indent<t[u].line.text.length&&(t[u].indent=l);t.length==a+1&&(t[a].single=!0)}if(e!=2&&t.some(r=>r.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:a,token:l,indent:f,empty:u,single:g}of t)(g||!u)&&r.push({from:a.from+f,insert:l+" "});let s=i.changes(r);return{changes:s,selection:i.selection.map(s,1)}}else if(e!=1&&t.some(r=>r.comment>=0)){let r=[];for(let{line:s,comment:a,token:l}of t)if(a>=0){let f=s.from+a,u=f+l.length;s.text[u-s.from]==" "&&u++,r.push({from:f,to:u})}return{changes:r}}return null}var mn=Ct.define(),q1=Ct.define(),j1=Oe.define(),os=Oe.define({combine(e){return Qe(e,{minDepth:100,newGroupDelay:500,joinToEvent:(i,o)=>o},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(i,o)=>(t,n)=>i(t,n)||o(t,n)})}}),yn=ft.define({create(){return hn.empty},update(e,i){let o=i.state.facet(os),t=i.annotation(mn);if(t){let l=ye.fromTransaction(i,t.selection),f=t.side,u=f==0?e.undone:e.done;return l?u=ui(u,u.length,o.minDepth,l):u=fs(u,i.startState.selection),new hn(f==0?t.rest:u,f==0?u:t.rest)}let n=i.annotation(q1);if((n=="full"||n=="before")&&(e=e.isolate()),i.annotation(dt.addToHistory)===!1)return i.changes.empty?e:e.addMapping(i.changes.desc);let r=ye.fromTransaction(i),s=i.annotation(dt.time),a=i.annotation(dt.userEvent);return r?e=e.addChanges(r,s,a,o,i):i.selection&&(e=e.addSelection(i.startState.selection,s,a,o.newGroupDelay)),(n=="full"||n=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(i=>i.toJSON()),undone:e.undone.map(i=>i.toJSON())}},fromJSON(e){return new hn(e.done.map(ye.fromJSON),e.undone.map(ye.fromJSON))}});function Cn(e={}){return[yn,os.of(e),D.domEventHandlers({beforeinput(i,o){let t=i.inputType=="historyUndo"?mi:i.inputType=="historyRedo"?Pt:null;return t?(i.preventDefault(),t(o)):!1}})]}function hi(e,i){return function({state:o,dispatch:t}){if(!i&&o.readOnly)return!1;let n=o.field(yn,!1);if(!n)return!1;let r=n.pop(e,o,i);return r?(t(r),!0):!1}}var mi=hi(0,!1),Pt=hi(1,!1),K1=hi(0,!0),Y1=hi(1,!0);function ss(e){return function(i){let o=i.field(yn,!1);if(!o)return 0;let t=e==0?o.done:o.undone;return t.length-(t.length&&!t[0].changes?1:0)}}var as=ss(0),ls=ss(1),ye=class e{constructor(i,o,t,n,r){this.changes=i,this.effects=o,this.mapped=t,this.startSelection=n,this.selectionsAfter=r}setSelAfter(i){return new e(this.changes,this.effects,this.mapped,this.startSelection,i)}toJSON(){var i,o,t;return{changes:(i=this.changes)===null||i===void 0?void 0:i.toJSON(),mapped:(o=this.mapped)===null||o===void 0?void 0:o.toJSON(),startSelection:(t=this.startSelection)===null||t===void 0?void 0:t.toJSON(),selectionsAfter:this.selectionsAfter.map(n=>n.toJSON())}}static fromJSON(i){return new e(i.changes&&jr.fromJSON(i.changes),[],i.mapped&&qr.fromJSON(i.mapped),i.startSelection&&w.fromJSON(i.startSelection),i.selectionsAfter.map(w.fromJSON))}static fromTransaction(i,o){let t=ue;for(let n of i.startState.facet(j1)){let r=n(i);r.length&&(t=t.concat(r))}return!t.length&&i.changes.empty?null:new e(i.changes.invert(i.startState.doc),t,void 0,o||i.startState.selection,ue)}static selection(i){return new e(void 0,ue,void 0,void 0,i)}};function ui(e,i,o,t){let n=i+1>o+20?i-o-1:0,r=e.slice(n,i);return r.push(t),r}function Q1(e,i){let o=[],t=!1;return e.iterChangedRanges((n,r)=>o.push(n,r)),i.iterChangedRanges((n,r,s,a)=>{for(let l=0;l<o.length;){let f=o[l++],u=o[l++];a>=f&&s<=u&&(t=!0)}}),t}function X1(e,i){return e.ranges.length==i.ranges.length&&e.ranges.filter((o,t)=>o.empty!=i.ranges[t].empty).length===0}function cs(e,i){return e.length?i.length?e.concat(i):e:i}var ue=[],J1=200;function fs(e,i){if(e.length){let o=e[e.length-1],t=o.selectionsAfter.slice(Math.max(0,o.selectionsAfter.length-J1));return t.length&&t[t.length-1].eq(i)?e:(t.push(i),ui(e,e.length-1,1e9,o.setSelAfter(t)))}else return[ye.selection([i])]}function Z1(e){let i=e[e.length-1],o=e.slice();return o[e.length-1]=i.setSelAfter(i.selectionsAfter.slice(0,i.selectionsAfter.length-1)),o}function un(e,i){if(!e.length)return e;let o=e.length,t=ue;for(;o;){let n=ea(e[o-1],i,t);if(n.changes&&!n.changes.empty||n.effects.length){let r=e.slice(0,o);return r[o-1]=n,r}else i=n.mapped,o--,t=n.selectionsAfter}return t.length?[ye.selection(t)]:ue}function ea(e,i,o){let t=cs(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(i)):ue,o);if(!e.changes)return ye.selection(t);let n=e.changes.map(i),r=i.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(r):r;return new ye(n,ee.mapEffects(e.effects,i),s,e.startSelection.map(r),t)}var ta=/^(input\.type|delete)($|\.)/,hn=(()=>{class e{constructor(o,t,n=0,r=void 0){this.done=o,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(o,t,n,r,s){let a=this.done,l=a[a.length-1];return l&&l.changes&&!l.changes.empty&&o.changes&&(!n||ta.test(n))&&(!l.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(s,Q1(l.changes,o.changes))||n=="input.type.compose")?a=ui(a,a.length-1,r.minDepth,new ye(o.changes.compose(l.changes),cs(ee.mapEffects(o.effects,l.changes),l.effects),l.mapped,l.startSelection,ue)):a=ui(a,a.length,r.minDepth,o),new e(a,ue,t,n)}addSelection(o,t,n,r){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:ue;return s.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&X1(s[s.length-1],o)?this:new e(fs(this.done,o),this.undone,t,n)}addMapping(o){return new e(un(this.done,o),un(this.undone,o),this.prevTime,this.prevUserEvent)}pop(o,t,n){let r=o==0?this.done:this.undone;if(r.length==0)return null;let s=r[r.length-1],a=s.selectionsAfter[0]||(s.startSelection?s.startSelection.map(s.changes.invertedDesc,1):t.selection);if(n&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:mn.of({side:o,rest:Z1(r),selection:a}),userEvent:o==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let l=r.length==1?ue:r.slice(0,r.length-1);return s.mapped&&(l=un(l,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:mn.of({side:o,rest:l,selection:a}),filter:!1,userEvent:o==0?"undo":"redo",scrollIntoView:!0})}else return null}}return e.empty=new e(ue,ue),e})(),Sn=[{key:"Mod-z",run:mi,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Pt,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Pt,preventDefault:!0},{key:"Mod-u",run:K1,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Y1,preventDefault:!0}];function mt(e,i){return w.create(e.ranges.map(i),e.mainIndex)}function Ce(e,i){return e.update({selection:i,scrollIntoView:!0,userEvent:"select"})}function Se({state:e,dispatch:i},o){let t=mt(e.selection,o);return t.eq(e.selection,!0)?!1:(i(Ce(e,t)),!0)}function pi(e,i){return w.cursor(i?e.to:e.from)}function ds(e,i){return Se(e,o=>o.empty?e.moveByChar(o,i):pi(o,i))}function X(e){return e.textDirectionAt(e.state.selection.main.head)==Qr.LTR}var us=e=>ds(e,!X(e)),hs=e=>ds(e,X(e));function ms(e,i){return Se(e,o=>o.empty?e.moveByGroup(o,i):pi(o,i))}var ia=e=>ms(e,!X(e)),na=e=>ms(e,X(e));var Lc=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function ra(e,i,o){if(i.type.prop(o))return!0;let t=i.to-i.from;return t&&(t>2||/[^\s,.;:]/.test(e.sliceDoc(i.from,i.to)))||i.firstChild}function gi(e,i,o){let t=ai(e).resolveInner(i.head),n=o?si.closedBy:si.openedBy;for(let l=i.head;;){let f=o?t.childAfter(l):t.childBefore(l);if(!f)break;ra(e,f,n)?t=f:l=o?f.to:f.from}let r=t.type.prop(n),s,a;return r&&(s=o?Xe(e,t.from,1):Xe(e,t.to,-1))&&s.matched?a=o?s.end.to:s.end.from:a=o?t.to:t.from,w.cursor(a,o?-1:1)}var oa=e=>Se(e,i=>gi(e.state,i,!X(e))),sa=e=>Se(e,i=>gi(e.state,i,X(e)));function ps(e,i){return Se(e,o=>{if(!o.empty)return pi(o,i);let t=e.moveVertically(o,i);return t.head!=o.head?t:e.moveToLineBoundary(o,i)})}var gs=e=>ps(e,!1),vs=e=>ps(e,!0);function bs(e){let i=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,o=0,t=0,n;if(i){for(let r of e.state.facet(D.scrollMargins)){let s=r(e);s?.top&&(o=Math.max(s?.top,o)),s?.bottom&&(t=Math.max(s?.bottom,t))}n=e.scrollDOM.clientHeight-o-t}else n=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:o,marginBottom:t,selfScroll:i,height:Math.max(e.defaultLineHeight,n-5)}}function ys(e,i){let o=bs(e),{state:t}=e,n=mt(t.selection,s=>s.empty?e.moveVertically(s,i,o.height):pi(s,i));if(n.eq(t.selection))return!1;let r;if(o.selfScroll){let s=e.coordsAtPos(t.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),l=a.top+o.marginTop,f=a.bottom-o.marginBottom;s&&s.top>l&&s.bottom<f&&(r=D.scrollIntoView(n.main.head,{y:"start",yMargin:s.top-l}))}return e.dispatch(Ce(t,n),{effects:r}),!0}var Qo=e=>ys(e,!1),pn=e=>ys(e,!0);function Ve(e,i,o){let t=e.lineBlockAt(i.head),n=e.moveToLineBoundary(i,o);if(n.head==i.head&&n.head!=(o?t.to:t.from)&&(n=e.moveToLineBoundary(i,o,!1)),!o&&n.head==t.from&&t.length){let r=/^\s*/.exec(e.state.sliceDoc(t.from,Math.min(t.from+100,t.to)))[0].length;r&&i.head!=t.from+r&&(n=w.cursor(t.from+r))}return n}var aa=e=>Se(e,i=>Ve(e,i,!0)),la=e=>Se(e,i=>Ve(e,i,!1)),ca=e=>Se(e,i=>Ve(e,i,!X(e))),fa=e=>Se(e,i=>Ve(e,i,X(e))),da=e=>Se(e,i=>w.cursor(e.lineBlockAt(i.head).from,1)),ua=e=>Se(e,i=>w.cursor(e.lineBlockAt(i.head).to,-1));function ha(e,i,o){let t=!1,n=mt(e.selection,r=>{let s=Xe(e,r.head,-1)||Xe(e,r.head,1)||r.head>0&&Xe(e,r.head-1,1)||r.head<e.doc.length&&Xe(e,r.head+1,-1);if(!s||!s.end)return r;t=!0;let a=s.start.from==r.head?s.end.to:s.end.from;return o?w.range(r.anchor,a):w.cursor(a)});return t?(i(Ce(e,n)),!0):!1}var ma=({state:e,dispatch:i})=>ha(e,i,!1);function he(e,i){let o=mt(e.state.selection,t=>{let n=i(t);return w.range(t.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return o.eq(e.state.selection)?!1:(e.dispatch(Ce(e.state,o)),!0)}function Cs(e,i){return he(e,o=>e.moveByChar(o,i))}var Ss=e=>Cs(e,!X(e)),xs=e=>Cs(e,X(e));function Ms(e,i){return he(e,o=>e.moveByGroup(o,i))}var pa=e=>Ms(e,!X(e)),ga=e=>Ms(e,X(e));var va=e=>he(e,i=>gi(e.state,i,!X(e))),ba=e=>he(e,i=>gi(e.state,i,X(e)));function ks(e,i){return he(e,o=>e.moveVertically(o,i))}var ws=e=>ks(e,!1),Ls=e=>ks(e,!0);function Es(e,i){return he(e,o=>e.moveVertically(o,i,bs(e).height))}var Xo=e=>Es(e,!1),Jo=e=>Es(e,!0),ya=e=>he(e,i=>Ve(e,i,!0)),Ca=e=>he(e,i=>Ve(e,i,!1)),Sa=e=>he(e,i=>Ve(e,i,!X(e))),xa=e=>he(e,i=>Ve(e,i,X(e))),Ma=e=>he(e,i=>w.cursor(e.lineBlockAt(i.head).from)),ka=e=>he(e,i=>w.cursor(e.lineBlockAt(i.head).to)),Zo=({state:e,dispatch:i})=>(i(Ce(e,{anchor:0})),!0),es=({state:e,dispatch:i})=>(i(Ce(e,{anchor:e.doc.length})),!0),ts=({state:e,dispatch:i})=>(i(Ce(e,{anchor:e.selection.main.anchor,head:0})),!0),is=({state:e,dispatch:i})=>(i(Ce(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),wa=({state:e,dispatch:i})=>(i(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),La=({state:e,dispatch:i})=>{let o=vi(e).map(({from:t,to:n})=>w.range(t,Math.min(n+1,e.doc.length)));return i(e.update({selection:w.create(o),userEvent:"select"})),!0},Ea=({state:e,dispatch:i})=>{let o=mt(e.selection,t=>{let n=ai(e),r=n.resolveStack(t.from,1);if(t.empty){let s=n.resolveStack(t.from,-1);s.node.from>=r.node.from&&s.node.to<=r.node.to&&(r=s)}for(let s=r;s;s=s.next){let{node:a}=s;if((a.from<t.from&&a.to>=t.to||a.to>t.to&&a.from<=t.from)&&s.next)return w.range(a.to,a.from)}return t});return o.eq(e.selection)?!1:(i(Ce(e,o)),!0)};function zs(e,i){let{state:o}=e,t=o.selection,n=o.selection.ranges.slice();for(let r of o.selection.ranges){let s=o.doc.lineAt(r.head);if(i?s.to<e.state.doc.length:s.from>0)for(let a=r;;){let l=e.moveVertically(a,i);if(l.head<s.from||l.head>s.to){n.some(f=>f.head==l.head)||n.push(l);break}else{if(l.head==a.head)break;a=l}}}return n.length==t.ranges.length?!1:(e.dispatch(Ce(o,w.create(n,n.length-1))),!0)}var za=e=>zs(e,!1),_a=e=>zs(e,!0),Pa=({state:e,dispatch:i})=>{let o=e.selection,t=null;return o.ranges.length>1?t=w.create([o.main]):o.main.empty||(t=w.create([w.cursor(o.main.head)])),t?(i(Ce(e,t)),!0):!1};function At(e,i){if(e.state.readOnly)return!1;let o="delete.selection",{state:t}=e,n=t.changeByRange(r=>{let{from:s,to:a}=r;if(s==a){let l=i(r);l<s?(o="delete.backward",l=di(e,l,!1)):l>s&&(o="delete.forward",l=di(e,l,!0)),s=Math.min(s,l),a=Math.max(a,l)}else s=di(e,s,!1),a=di(e,a,!0);return s==a?{range:r}:{changes:{from:s,to:a},range:w.cursor(s,s<r.head?-1:1)}});return n.changes.empty?!1:(e.dispatch(t.update(n,{scrollIntoView:!0,userEvent:o,effects:o=="delete.selection"?D.announce.of(t.phrase("Selection deleted")):void 0})),!0)}function di(e,i,o){if(e instanceof D)for(let t of e.state.facet(D.atomicRanges).map(n=>n(e)))t.between(i,i,(n,r)=>{n<i&&r>i&&(i=o?r:n)});return i}var _s=(e,i,o)=>At(e,t=>{let n=t.from,{state:r}=e,s=r.doc.lineAt(n),a,l;if(o&&!i&&n>s.from&&n<s.from+200&&!/[^ \t]/.test(a=s.text.slice(0,n-s.from))){if(a[a.length-1]==" ")return n-1;let f=ni(a,r.tabSize),u=f%ci(r)||ci(r);for(let g=0;g<u&&a[a.length-1-g]==" ";g++)n--;l=n}else l=Ae(s.text,n-s.from,i,i)+s.from,l==n&&s.number!=(i?r.doc.lines:1)?l+=i?1:-1:!i&&/[\ufe00-\ufe0f]/.test(s.text.slice(l-s.from,n-s.from))&&(l=Ae(s.text,l-s.from,!1,!1)+s.from);return l}),gn=e=>_s(e,!1,!0);var Ps=e=>_s(e,!0,!1),As=(e,i)=>At(e,o=>{let t=o.head,{state:n}=e,r=n.doc.lineAt(t),s=n.charCategorizer(t);for(let a=null;;){if(t==(i?r.to:r.from)){t==o.head&&r.number!=(i?n.doc.lines:1)&&(t+=i?1:-1);break}let l=Ae(r.text,t-r.from,i)+r.from,f=r.text.slice(Math.min(t,l)-r.from,Math.max(t,l)-r.from),u=s(f);if(a!=null&&u!=a)break;(f!=" "||t!=o.head)&&(a=u),t=l}return t}),Ts=e=>As(e,!1),Aa=e=>As(e,!0);var Ta=e=>At(e,i=>{let o=e.lineBlockAt(i.head).to;return i.head<o?o:Math.min(e.state.doc.length,i.head+1)});var Da=e=>At(e,i=>{let o=e.moveToLineBoundary(i,!1).head;return i.head>o?o:Math.max(0,i.head-1)}),Fa=e=>At(e,i=>{let o=e.moveToLineBoundary(i,!0).head;return i.head<o?o:Math.min(e.state.doc.length,i.head+1)});var Ia=({state:e,dispatch:i})=>{if(e.readOnly)return!1;let o=e.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:Ji.of(["",""])},range:w.cursor(t.from)}));return i(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0},Ra=({state:e,dispatch:i})=>{if(e.readOnly)return!1;let o=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),s=n==r.from?n-1:Ae(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:Ae(r.text,n-r.from,!0)+r.from;return{changes:{from:s,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(s,n))},range:w.cursor(a)}});return o.changes.empty?!1:(i(e.update(o,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function vi(e){let i=[],o=-1;for(let t of e.selection.ranges){let n=e.doc.lineAt(t.from),r=e.doc.lineAt(t.to);if(!t.empty&&t.to==r.from&&(r=e.doc.lineAt(t.to-1)),o>=n.number){let s=i[i.length-1];s.to=r.to,s.ranges.push(t)}else i.push({from:n.from,to:r.to,ranges:[t]});o=r.number+1}return i}function Ds(e,i,o){if(e.readOnly)return!1;let t=[],n=[];for(let r of vi(e)){if(o?r.to==e.doc.length:r.from==0)continue;let s=e.doc.lineAt(o?r.to+1:r.from-1),a=s.length+1;if(o){t.push({from:r.to,to:s.to},{from:r.from,insert:s.text+e.lineBreak});for(let l of r.ranges)n.push(w.range(Math.min(e.doc.length,l.anchor+a),Math.min(e.doc.length,l.head+a)))}else{t.push({from:s.from,to:r.from},{from:r.to,insert:e.lineBreak+s.text});for(let l of r.ranges)n.push(w.range(l.anchor-a,l.head-a))}}return t.length?(i(e.update({changes:t,scrollIntoView:!0,selection:w.create(n,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}var Oa=({state:e,dispatch:i})=>Ds(e,i,!1),Na=({state:e,dispatch:i})=>Ds(e,i,!0);function Fs(e,i,o){if(e.readOnly)return!1;let t=[];for(let r of vi(e))o?t.push({from:r.from,insert:e.doc.slice(r.from,r.to)+e.lineBreak}):t.push({from:r.to,insert:e.lineBreak+e.doc.slice(r.from,r.to)});let n=e.changes(t);return i(e.update({changes:n,selection:e.selection.map(n,o?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}var Va=({state:e,dispatch:i})=>Fs(e,i,!1),Ba=({state:e,dispatch:i})=>Fs(e,i,!0),Ha=e=>{if(e.state.readOnly)return!1;let{state:i}=e,o=i.changes(vi(i).map(({from:n,to:r})=>(n>0?n--:r<i.doc.length&&r++,{from:n,to:r}))),t=mt(i.selection,n=>{let r;if(e.lineWrapping){let s=e.lineBlockAt(n.head),a=e.coordsAtPos(n.head,n.assoc||1);a&&(r=s.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2)}return e.moveVertically(n,!0,r)}).map(o);return e.dispatch({changes:o,selection:t,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Ua(e,i){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(i-1,i+1)))return{from:i,to:i};let o=ai(e).resolveInner(i),t=o.childBefore(i),n=o.childAfter(i),r;return t&&n&&t.to<=i&&n.from>=i&&(r=t.type.prop(si.closedBy))&&r.indexOf(n.name)>-1&&e.doc.lineAt(t.to).from==e.doc.lineAt(n.from).from&&!/\S/.test(e.sliceDoc(t.to,n.from))?{from:t.to,to:n.from}:null}var ns=Is(!1),Ga=Is(!0);function Is(e){return({state:i,dispatch:o})=>{if(i.readOnly)return!1;let t=i.changeByRange(n=>{let{from:r,to:s}=n,a=i.doc.lineAt(r),l=!e&&r==s&&Ua(i,r);e&&(r=s=(s<=a.to?a:i.doc.lineAt(s)).to);let f=new nn(i,{simulateBreak:r,simulateDoubleBreak:!!l}),u=tn(f,r);for(u==null&&(u=ni(/^\s*/.exec(i.doc.lineAt(r).text)[0],i.tabSize));s<a.to&&/\s/.test(a.text[s-a.from]);)s++;l?{from:r,to:s}=l:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let g=["",Mt(i,u)];return l&&g.push(Mt(i,f.lineIndent(a.from,-1))),{changes:{from:r,to:s,insert:Ji.of(g)},range:w.cursor(r+1+g[1].length)}});return o(i.update(t,{scrollIntoView:!0,userEvent:"input"})),!0}}function xn(e,i){let o=-1;return e.changeByRange(t=>{let n=[];for(let s=t.from;s<=t.to;){let a=e.doc.lineAt(s);a.number>o&&(t.empty||t.to>a.from)&&(i(a,n,t),o=a.number),s=a.to+1}let r=e.changes(n);return{changes:n,range:w.range(r.mapPos(t.anchor,1),r.mapPos(t.head,1))}})}var Wa=({state:e,dispatch:i})=>{if(e.readOnly)return!1;let o=Object.create(null),t=new nn(e,{overrideIndentation:r=>{let s=o[r];return s??-1}}),n=xn(e,(r,s,a)=>{let l=tn(t,r.from);if(l==null)return;/\S/.test(r.text)||(l=0);let f=/^\s*/.exec(r.text)[0],u=Mt(e,l);(f!=u||a.from<r.from+f.length)&&(o[r.from]=l,s.push({from:r.from,to:r.from+f.length,insert:u}))});return n.changes.empty||i(e.update(n,{userEvent:"indent"})),!0},Rs=({state:e,dispatch:i})=>e.readOnly?!1:(i(e.update(xn(e,(o,t)=>{t.push({from:o.from,insert:e.facet(li)})}),{userEvent:"input.indent"})),!0),Os=({state:e,dispatch:i})=>e.readOnly?!1:(i(e.update(xn(e,(o,t)=>{let n=/^\s*/.exec(o.text)[0];if(!n)return;let r=ni(n,e.tabSize),s=0,a=Mt(e,Math.max(0,r-ci(e)));for(;s<n.length&&s<a.length&&n.charCodeAt(s)==a.charCodeAt(s);)s++;t.push({from:o.from+s,to:o.from+n.length,insert:a.slice(s)})}),{userEvent:"delete.dedent"})),!0),$a=e=>(e.setTabFocusMode(),!0);var qa=[{key:"Ctrl-b",run:us,shift:Ss,preventDefault:!0},{key:"Ctrl-f",run:hs,shift:xs},{key:"Ctrl-p",run:gs,shift:ws},{key:"Ctrl-n",run:vs,shift:Ls},{key:"Ctrl-a",run:da,shift:Ma},{key:"Ctrl-e",run:ua,shift:ka},{key:"Ctrl-d",run:Ps},{key:"Ctrl-h",run:gn},{key:"Ctrl-k",run:Ta},{key:"Ctrl-Alt-h",run:Ts},{key:"Ctrl-o",run:Ia},{key:"Ctrl-t",run:Ra},{key:"Ctrl-v",run:pn}],ja=[{key:"ArrowLeft",run:us,shift:Ss,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:ia,shift:pa,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:ca,shift:Sa,preventDefault:!0},{key:"ArrowRight",run:hs,shift:xs,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:na,shift:ga,preventDefault:!0},{mac:"Cmd-ArrowRight",run:fa,shift:xa,preventDefault:!0},{key:"ArrowUp",run:gs,shift:ws,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Zo,shift:ts},{mac:"Ctrl-ArrowUp",run:Qo,shift:Xo},{key:"ArrowDown",run:vs,shift:Ls,preventDefault:!0},{mac:"Cmd-ArrowDown",run:es,shift:is},{mac:"Ctrl-ArrowDown",run:pn,shift:Jo},{key:"PageUp",run:Qo,shift:Xo},{key:"PageDown",run:pn,shift:Jo},{key:"Home",run:la,shift:Ca,preventDefault:!0},{key:"Mod-Home",run:Zo,shift:ts},{key:"End",run:aa,shift:ya,preventDefault:!0},{key:"Mod-End",run:es,shift:is},{key:"Enter",run:ns,shift:ns},{key:"Mod-a",run:wa},{key:"Backspace",run:gn,shift:gn,preventDefault:!0},{key:"Delete",run:Ps,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Ts,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Aa,preventDefault:!0},{mac:"Mod-Backspace",run:Da,preventDefault:!0},{mac:"Mod-Delete",run:Fa,preventDefault:!0}].concat(qa.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Mn=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:oa,shift:va},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:sa,shift:ba},{key:"Alt-ArrowUp",run:Oa},{key:"Shift-Alt-ArrowUp",run:Va},{key:"Alt-ArrowDown",run:Na},{key:"Shift-Alt-ArrowDown",run:Ba},{key:"Mod-Alt-ArrowUp",run:za},{key:"Mod-Alt-ArrowDown",run:_a},{key:"Escape",run:Pa},{key:"Mod-Enter",run:Ga},{key:"Alt-l",mac:"Ctrl-l",run:La},{key:"Mod-i",run:Ea,preventDefault:!0},{key:"Mod-[",run:Os},{key:"Mod-]",run:Rs},{key:"Mod-Alt-\\",run:Wa},{key:"Shift-Mod-k",run:Ha},{key:"Shift-Mod-\\",run:ma},{key:"Mod-/",run:V1},{key:"Alt-A",run:H1},{key:"Ctrl-m",mac:"Shift-Alt-m",run:$a}].concat(ja),Ns={key:"Tab",run:Rs,shift:Os};var Ka="#e5c07b",Vs="#e06c75",Ya="#56b6c2",Qa="#ffffff",bi="#abb2bf",wn="#7d8799",Xa="#61afef",Ja="#98c379",Bs="#d19a66",Za="#c678dd",el="#21252b",Hs="#2c313a",Us="#282c34",kn="#353a42",tl="#3E4451",Gs="#528bff";var il=D.theme({"&":{color:bi,backgroundColor:Us},".cm-content":{caretColor:Gs},".cm-cursor, .cm-dropCursor":{borderLeftColor:Gs},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:tl},".cm-panels":{backgroundColor:el,color:bi},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:Us,color:wn,border:"none"},".cm-activeLineGutter":{backgroundColor:Hs},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:kn},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:kn,borderBottomColor:kn},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Hs,color:bi}}},{dark:!0}),nl=ho.define([{tag:C.keyword,color:Za},{tag:[C.name,C.deleted,C.character,C.propertyName,C.macroName],color:Vs},{tag:[C.function(C.variableName),C.labelName],color:Xa},{tag:[C.color,C.constant(C.name),C.standard(C.name)],color:Bs},{tag:[C.definition(C.name),C.separator],color:bi},{tag:[C.typeName,C.className,C.number,C.changed,C.annotation,C.modifier,C.self,C.namespace],color:Ka},{tag:[C.operator,C.operatorKeyword,C.url,C.escape,C.regexp,C.link,C.special(C.string)],color:Ya},{tag:[C.meta,C.comment],color:wn},{tag:C.strong,fontWeight:"bold"},{tag:C.emphasis,fontStyle:"italic"},{tag:C.strikethrough,textDecoration:"line-through"},{tag:C.link,color:wn,textDecoration:"underline"},{tag:C.heading,fontWeight:"bold",color:Vs},{tag:[C.atom,C.bool,C.special(C.variableName)],color:Bs},{tag:[C.processingInstruction,C.string,C.inserted],color:Ja},{tag:C.invalid,color:Qa}]),Ws=[il,kt(nl)];var $s=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e,He=class{constructor(i,o,t=0,n=i.length,r,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=i.iterRange(t,n),this.bufferStart=t,this.normalize=r?a=>r($s(a)):$s,this.query=this.normalize(o)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Gr(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let i=this.peek();if(i<0)return this.done=!0,this;let o=Wr(i),t=this.bufferStart+this.bufferPos;this.bufferPos+=$r(i);let n=this.normalize(o);if(n.length)for(let r=0,s=t;;r++){let a=n.charCodeAt(r),l=this.match(a,s,this.bufferPos+this.bufferStart);if(r==n.length-1){if(l)return this.value=l,this;break}s==t&&r<o.length&&o.charCodeAt(r)==a&&s++}}}match(i,o,t){let n=null;for(let r=0;r<this.matches.length;r+=2){let s=this.matches[r],a=!1;this.query.charCodeAt(s)==i&&(s==this.query.length-1?n={from:this.matches[r+1],to:t}:(this.matches[r]++,a=!0)),a||(this.matches.splice(r,2),r-=2)}return this.query.charCodeAt(0)==i&&(this.query.length==1?n={from:o,to:t}:this.matches.push(1,o)),n&&this.test&&!this.test(n.from,n.to,this.buffer,this.bufferStart)&&(n=null),n}};typeof Symbol<"u"&&(He.prototype[Symbol.iterator]=function(){return this});var Ks={from:-1,to:-1,match:/.*/.exec("")},An="gm"+(/x/.unicode==null?"":"u"),Si=class{constructor(i,o,t,n=0,r=i.length){if(this.text=i,this.to=r,this.curLine="",this.done=!1,this.value=Ks,/\\[sWDnr]|\n|\r|\[\^/.test(o))return new Mi(i,o,t,n,r);this.re=new RegExp(o,An+(t?.ignoreCase?"i":"")),this.test=t?.test,this.iter=i.iter();let s=i.lineAt(n);this.curLineStart=s.from,this.matchPos=ki(i,n),this.getLine(this.curLineStart)}getLine(i){this.iter.next(i),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let i=this.matchPos-this.curLineStart;;){this.re.lastIndex=i;let o=this.matchPos<=this.to&&this.re.exec(this.curLine);if(o){let t=this.curLineStart+o.index,n=t+o[0].length;if(this.matchPos=ki(this.text,n+(t==n?1:0)),t==this.curLineStart+this.curLine.length&&this.nextLine(),(t<n||t>this.value.to)&&(!this.test||this.test(t,n,o)))return this.value={from:t,to:n,match:o},this;i=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),i=0;else return this.done=!0,this}}},Ln=new WeakMap,xi=class e{constructor(i,o){this.from=i,this.text=o}get to(){return this.from+this.text.length}static get(i,o,t){let n=Ln.get(i);if(!n||n.from>=t||n.to<=o){let a=new e(o,i.sliceString(o,t));return Ln.set(i,a),a}if(n.from==o&&n.to==t)return n;let{text:r,from:s}=n;return s>o&&(r=i.sliceString(o,s)+r,s=o),n.to<t&&(r+=i.sliceString(n.to,t)),Ln.set(i,new e(s,r)),new e(o,r.slice(o-s,t-s))}},Mi=class{constructor(i,o,t,n,r){this.text=i,this.to=r,this.done=!1,this.value=Ks,this.matchPos=ki(i,n),this.re=new RegExp(o,An+(t?.ignoreCase?"i":"")),this.test=t?.test,this.flat=xi.get(i,n,this.chunkEnd(n+5e3))}chunkEnd(i){return i>=this.to?this.to:this.text.lineAt(i).to}next(){for(;;){let i=this.re.lastIndex=this.matchPos-this.flat.from,o=this.re.exec(this.flat.text);if(o&&!o[0]&&o.index==i&&(this.re.lastIndex=i+1,o=this.re.exec(this.flat.text)),o){let t=this.flat.from+o.index,n=t+o[0].length;if((this.flat.to>=this.to||o.index+o[0].length<=this.flat.text.length-10)&&(!this.test||this.test(t,n,o)))return this.value={from:t,to:n,match:o},this.matchPos=ki(this.text,n+(t==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=xi.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(Si.prototype[Symbol.iterator]=Mi.prototype[Symbol.iterator]=function(){return this});function rl(e){try{return new RegExp(e,An),!0}catch{return!1}}function ki(e,i){if(i>=e.length)return i;let o=e.lineAt(i),t;for(;i<o.to&&(t=o.text.charCodeAt(i-o.from))>=56320&&t<57344;)i++;return i}var ol=e=>{let{state:i}=e,o=String(i.doc.lineAt(e.state.selection.main.head).number),{close:t,result:n}=ro(e,{label:i.phrase("Go to line"),input:{type:"text",name:"line",value:o},focus:!0,submitLabel:i.phrase("go")});return n.then(r=>{let s=r&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);if(!s){e.dispatch({effects:t});return}let a=i.doc.lineAt(i.selection.main.head),[,l,f,u,g]=s,v=u?+u.slice(1):0,S=f?+f:a.number;if(f&&g){let G=S/100;l&&(G=G*(l=="-"?-1:1)+a.number/i.doc.lines),S=Math.round(i.doc.lines*G)}else f&&l&&(S=S*(l=="-"?-1:1)+a.number);let P=i.doc.line(Math.max(1,Math.min(i.doc.lines,S))),U=w.cursor(P.from+Math.max(0,Math.min(v,P.length)));e.dispatch({effects:[t,D.scrollIntoView(U.from,{y:"center"})],selection:U})}),!0},sl={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Ys=Oe.define({combine(e){return Qe(e,sl,{highlightWordAroundCursor:(i,o)=>i||o,minSelectionLength:Math.min,maxMatches:Math.min})}});function Qs(e){let i=[dl,fl];return e&&i.push(Ys.of(e)),i}var al=H.mark({class:"cm-selectionMatch"}),ll=H.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function qs(e,i,o,t){return(o==0||e(i.sliceDoc(o-1,o))!=te.Word)&&(t==i.doc.length||e(i.sliceDoc(t,t+1))!=te.Word)}function cl(e,i,o,t){return e(i.sliceDoc(o,o+1))==te.Word&&e(i.sliceDoc(t-1,t))==te.Word}var fl=ri.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let i=e.state.facet(Ys),{state:o}=e,t=o.selection;if(t.ranges.length>1)return H.none;let n=t.main,r,s=null;if(n.empty){if(!i.highlightWordAroundCursor)return H.none;let l=o.wordAt(n.head);if(!l)return H.none;s=o.charCategorizer(n.head),r=o.sliceDoc(l.from,l.to)}else{let l=n.to-n.from;if(l<i.minSelectionLength||l>200)return H.none;if(i.wholeWords){if(r=o.sliceDoc(n.from,n.to),s=o.charCategorizer(n.head),!(qs(s,o,n.from,n.to)&&cl(s,o,n.from,n.to)))return H.none}else if(r=o.sliceDoc(n.from,n.to),!r)return H.none}let a=[];for(let l of e.visibleRanges){let f=new He(o.doc,r,l.from,l.to);for(;!f.next().done;){let{from:u,to:g}=f.value;if((!s||qs(s,o,u,g))&&(n.empty&&u<=n.from&&g>=n.to?a.push(ll.range(u,g)):(u>=n.to||g<=n.from)&&a.push(al.range(u,g)),a.length>i.maxMatches))return H.none}}return H.set(a)}},{decorations:e=>e.decorations}),dl=D.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),ul=({state:e,dispatch:i})=>{let{selection:o}=e,t=w.create(o.ranges.map(n=>e.wordAt(n.head)||w.cursor(n.head)),o.mainIndex);return t.eq(o)?!1:(i(e.update({selection:t})),!0)};function hl(e,i){let{main:o,ranges:t}=e.selection,n=e.wordAt(o.head),r=n&&n.from==o.from&&n.to==o.to;for(let s=!1,a=new He(e.doc,i,t[t.length-1].to);;)if(a.next(),a.done){if(s)return null;a=new He(e.doc,i,0,Math.max(0,t[t.length-1].from-1)),s=!0}else{if(s&&t.some(l=>l.from==a.value.from))continue;if(r){let l=e.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}var ml=({state:e,dispatch:i})=>{let{ranges:o}=e.selection;if(o.some(r=>r.from===r.to))return ul({state:e,dispatch:i});let t=e.sliceDoc(o[0].from,o[0].to);if(e.selection.ranges.some(r=>e.sliceDoc(r.from,r.to)!=t))return!1;let n=hl(e,t);return n?(i(e.update({selection:e.selection.addRange(w.range(n.from,n.to),!1),effects:D.scrollIntoView(n.to)})),!0):!1},vt=Oe.define({combine(e){return Qe(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:i=>new Pn(i),scrollToMatch:i=>D.scrollIntoView(i)})}});var wi=class{constructor(i){this.search=i.search,this.caseSensitive=!!i.caseSensitive,this.literal=!!i.literal,this.regexp=!!i.regexp,this.replace=i.replace||"",this.valid=!!this.search&&(!this.regexp||rl(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!i.wholeWord,this.test=i.test}unquote(i){return this.literal?i:i.replace(/\\([nrt\\])/g,(o,t)=>t=="n"?`
3
+ `:t=="r"?"\r":t=="t"?" ":"\\")}eq(i){return this.search==i.search&&this.replace==i.replace&&this.caseSensitive==i.caseSensitive&&this.regexp==i.regexp&&this.wholeWord==i.wholeWord&&this.test==i.test}create(){return this.regexp?new zn(this):new En(this)}getCursor(i,o=0,t){let n=i.doc?i:Ye.create({doc:i});return t==null&&(t=n.doc.length),this.regexp?gt(this,n,o,t):pt(this,n,o,t)}},Li=class{constructor(i){this.spec=i}};function pl(e,i,o){return(t,n,r,s)=>{if(o&&!o(t,n,r,s))return!1;let a=t>=s&&n<=s+r.length?r.slice(t-s,n-s):i.doc.sliceString(t,n);return e(a,i,t,n)}}function pt(e,i,o,t){let n;return e.wholeWord&&(n=gl(i.doc,i.charCategorizer(i.selection.main.head))),e.test&&(n=pl(e.test,i,n)),new He(i.doc,e.unquoted,o,t,e.caseSensitive?void 0:r=>r.toLowerCase(),n)}function gl(e,i){return(o,t,n,r)=>((r>o||r+n.length<t)&&(r=Math.max(0,o-2),n=e.sliceString(r,Math.min(e.length,t+2))),(i(Ei(n,o-r))!=te.Word||i(zi(n,o-r))!=te.Word)&&(i(zi(n,t-r))!=te.Word||i(Ei(n,t-r))!=te.Word))}var En=class extends Li{constructor(i){super(i)}nextMatch(i,o,t){let n=pt(this.spec,i,t,i.doc.length).nextOverlapping();if(n.done){let r=Math.min(i.doc.length,o+this.spec.unquoted.length);n=pt(this.spec,i,0,r).nextOverlapping()}return n.done||n.value.from==o&&n.value.to==t?null:n.value}prevMatchInRange(i,o,t){for(let n=t;;){let r=Math.max(o,n-1e4-this.spec.unquoted.length),s=pt(this.spec,i,r,n),a=null;for(;!s.nextOverlapping().done;)a=s.value;if(a)return a;if(r==o)return null;n-=1e4}}prevMatch(i,o,t){let n=this.prevMatchInRange(i,0,o);return n||(n=this.prevMatchInRange(i,Math.max(0,t-this.spec.unquoted.length),i.doc.length)),n&&(n.from!=o||n.to!=t)?n:null}getReplacement(i){return this.spec.unquote(this.spec.replace)}matchAll(i,o){let t=pt(this.spec,i,0,i.doc.length),n=[];for(;!t.next().done;){if(n.length>=o)return null;n.push(t.value)}return n}highlight(i,o,t,n){let r=pt(this.spec,i,Math.max(0,o-this.spec.unquoted.length),Math.min(t+this.spec.unquoted.length,i.doc.length));for(;!r.next().done;)n(r.value.from,r.value.to)}};function vl(e,i,o){return(t,n,r)=>(!o||o(t,n,r))&&e(r[0],i,t,n)}function gt(e,i,o,t){let n;return e.wholeWord&&(n=bl(i.charCategorizer(i.selection.main.head))),e.test&&(n=vl(e.test,i,n)),new Si(i.doc,e.search,{ignoreCase:!e.caseSensitive,test:n},o,t)}function Ei(e,i){return e.slice(Ae(e,i,!1),i)}function zi(e,i){return e.slice(i,Ae(e,i))}function bl(e){return(i,o,t)=>!t[0].length||(e(Ei(t.input,t.index))!=te.Word||e(zi(t.input,t.index))!=te.Word)&&(e(zi(t.input,t.index+t[0].length))!=te.Word||e(Ei(t.input,t.index+t[0].length))!=te.Word)}var zn=class extends Li{nextMatch(i,o,t){let n=gt(this.spec,i,t,i.doc.length).next();return n.done&&(n=gt(this.spec,i,0,o).next()),n.done?null:n.value}prevMatchInRange(i,o,t){for(let n=1;;n++){let r=Math.max(o,t-n*1e4),s=gt(this.spec,i,r,t),a=null;for(;!s.next().done;)a=s.value;if(a&&(r==o||a.from>r+10))return a;if(r==o)return null}}prevMatch(i,o,t){return this.prevMatchInRange(i,0,o)||this.prevMatchInRange(i,t,i.doc.length)}getReplacement(i){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(o,t)=>{if(t=="&")return i.match[0];if(t=="$")return"$";for(let n=t.length;n>0;n--){let r=+t.slice(0,n);if(r>0&&r<i.match.length)return i.match[r]+t.slice(n)}return o})}matchAll(i,o){let t=gt(this.spec,i,0,i.doc.length),n=[];for(;!t.next().done;){if(n.length>=o)return null;n.push(t.value)}return n}highlight(i,o,t,n){let r=gt(this.spec,i,Math.max(0,o-250),Math.min(t+250,i.doc.length));for(;!r.next().done;)n(r.value.from,r.value.to)}},Dt=ee.define(),Tn=ee.define(),Be=ft.define({create(e){return new Tt(_n(e).create(),null)},update(e,i){for(let o of i.effects)o.is(Dt)?e=new Tt(o.value.create(),e.panel):o.is(Tn)&&(e=new Tt(e.query,o.value?Dn:null));return e},provide:e=>oi.from(e,i=>i.panel)});var Tt=class{constructor(i,o){this.query=i,this.panel=o}},yl=H.mark({class:"cm-searchMatch"}),Cl=H.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Sl=ri.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Be))}update(e){let i=e.state.field(Be);(i!=e.startState.field(Be)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(i))}highlight({query:e,panel:i}){if(!i||!e.spec.valid)return H.none;let{view:o}=this,t=new ii;for(let n=0,r=o.visibleRanges,s=r.length;n<s;n++){let{from:a,to:l}=r[n];for(;n<s-1&&l>r[n+1].from-500;)l=r[++n].to;e.highlight(o.state,a,l,(f,u)=>{let g=o.state.selection.ranges.some(v=>v.from==f&&v.to==u);t.add(f,u,g?Cl:yl)})}return t.finish()}},{decorations:e=>e.decorations});function Ft(e){return i=>{let o=i.state.field(Be,!1);return o&&o.query.spec.valid?e(i,o):Ai(i)}}var _i=Ft((e,{query:i})=>{let{to:o}=e.state.selection.main,t=i.nextMatch(e.state,o,o);if(!t)return!1;let n=w.single(t.from,t.to),r=e.state.facet(vt);return e.dispatch({selection:n,effects:[Fn(e,t),r.scrollToMatch(n.main,e)],userEvent:"select.search"}),Js(e),!0}),Pi=Ft((e,{query:i})=>{let{state:o}=e,{from:t}=o.selection.main,n=i.prevMatch(o,t,t);if(!n)return!1;let r=w.single(n.from,n.to),s=e.state.facet(vt);return e.dispatch({selection:r,effects:[Fn(e,n),s.scrollToMatch(r.main,e)],userEvent:"select.search"}),Js(e),!0}),xl=Ft((e,{query:i})=>{let o=i.matchAll(e.state,1e3);return!o||!o.length?!1:(e.dispatch({selection:w.create(o.map(t=>w.range(t.from,t.to))),userEvent:"select.search.matches"}),!0)}),Ml=({state:e,dispatch:i})=>{let o=e.selection;if(o.ranges.length>1||o.main.empty)return!1;let{from:t,to:n}=o.main,r=[],s=0;for(let a=new He(e.doc,e.sliceDoc(t,n));!a.next().done;){if(r.length>1e3)return!1;a.value.from==t&&(s=r.length),r.push(w.range(a.value.from,a.value.to))}return i(e.update({selection:w.create(r,s),userEvent:"select.search.matches"})),!0},js=Ft((e,{query:i})=>{let{state:o}=e,{from:t,to:n}=o.selection.main;if(o.readOnly)return!1;let r=i.nextMatch(o,t,t);if(!r)return!1;let s=r,a=[],l,f,u=[];s.from==t&&s.to==n&&(f=o.toText(i.getReplacement(s)),a.push({from:s.from,to:s.to,insert:f}),s=i.nextMatch(o,s.from,s.to),u.push(D.announce.of(o.phrase("replaced match on line $",o.doc.lineAt(t).number)+".")));let g=e.state.changes(a);return s&&(l=w.single(s.from,s.to).map(g),u.push(Fn(e,s)),u.push(o.facet(vt).scrollToMatch(l.main,e))),e.dispatch({changes:g,selection:l,effects:u,userEvent:"input.replace"}),!0}),kl=Ft((e,{query:i})=>{if(e.state.readOnly)return!1;let o=i.matchAll(e.state,1e9).map(n=>{let{from:r,to:s}=n;return{from:r,to:s,insert:i.getReplacement(n)}});if(!o.length)return!1;let t=e.state.phrase("replaced $ matches",o.length)+".";return e.dispatch({changes:o,effects:D.announce.of(t),userEvent:"input.replace.all"}),!0});function Dn(e){return e.state.facet(vt).createPanel(e)}function _n(e,i){var o,t,n,r,s;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(i&&!l)return i;let f=e.facet(vt);return new wi({search:((o=i?.literal)!==null&&o!==void 0?o:f.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(t=i?.caseSensitive)!==null&&t!==void 0?t:f.caseSensitive,literal:(n=i?.literal)!==null&&n!==void 0?n:f.literal,regexp:(r=i?.regexp)!==null&&r!==void 0?r:f.regexp,wholeWord:(s=i?.wholeWord)!==null&&s!==void 0?s:f.wholeWord})}function Xs(e){let i=xt(e,Dn);return i&&i.dom.querySelector("[main-field]")}function Js(e){let i=Xs(e);i&&i==e.root.activeElement&&i.select()}var Ai=e=>{let i=e.state.field(Be,!1);if(i&&i.panel){let o=Xs(e);if(o&&o!=e.root.activeElement){let t=_n(e.state,i.query.spec);t.valid&&e.dispatch({effects:Dt.of(t)}),o.focus(),o.select()}}else e.dispatch({effects:[Tn.of(!0),i?Dt.of(_n(e.state,i.query.spec)):ee.appendConfig.of(Ll)]});return!0},Ti=e=>{let i=e.state.field(Be,!1);if(!i||!i.panel)return!1;let o=xt(e,Dn);return o&&o.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Tn.of(!1)}),!0},Zs=[{key:"Mod-f",run:Ai,scope:"editor search-panel"},{key:"F3",run:_i,shift:Pi,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:_i,shift:Pi,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Ti,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Ml},{key:"Mod-Alt-g",run:ol},{key:"Mod-d",run:ml,preventDefault:!0}],Pn=class{constructor(i){this.view=i;let o=this.query=i.state.field(Be).query.spec;this.commit=this.commit.bind(this),this.searchField=I("input",{value:o.search,placeholder:se(i,"Find"),"aria-label":se(i,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=I("input",{value:o.replace,placeholder:se(i,"Replace"),"aria-label":se(i,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=I("input",{type:"checkbox",name:"case",form:"",checked:o.caseSensitive,onchange:this.commit}),this.reField=I("input",{type:"checkbox",name:"re",form:"",checked:o.regexp,onchange:this.commit}),this.wordField=I("input",{type:"checkbox",name:"word",form:"",checked:o.wholeWord,onchange:this.commit});function t(n,r,s){return I("button",{class:"cm-button",name:n,onclick:r,type:"button"},s)}this.dom=I("div",{onkeydown:n=>this.keydown(n),class:"cm-search"},[this.searchField,t("next",()=>_i(i),[se(i,"next")]),t("prev",()=>Pi(i),[se(i,"previous")]),t("select",()=>xl(i),[se(i,"all")]),I("label",null,[this.caseField,se(i,"match case")]),I("label",null,[this.reField,se(i,"regexp")]),I("label",null,[this.wordField,se(i,"by word")]),...i.state.readOnly?[]:[I("br"),this.replaceField,t("replace",()=>js(i),[se(i,"replace")]),t("replaceAll",()=>kl(i),[se(i,"replace all")])],I("button",{name:"close",onclick:()=>Ti(i),"aria-label":se(i,"close"),type:"button"},["\xD7"])])}commit(){let i=new wi({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});i.eq(this.query)||(this.query=i,this.view.dispatch({effects:Dt.of(i)}))}keydown(i){Xr(this.view,i,"search-panel")?i.preventDefault():i.keyCode==13&&i.target==this.searchField?(i.preventDefault(),(i.shiftKey?Pi:_i)(this.view)):i.keyCode==13&&i.target==this.replaceField&&(i.preventDefault(),js(this.view))}update(i){for(let o of i.transactions)for(let t of o.effects)t.is(Dt)&&!t.value.eq(this.query)&&this.setQuery(t.value)}setQuery(i){this.query=i,this.searchField.value=i.search,this.replaceField.value=i.replace,this.caseField.checked=i.caseSensitive,this.reField.checked=i.regexp,this.wordField.checked=i.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(vt).top}};function se(e,i){return e.state.phrase(i)}var yi=30,Ci=/[\s\.,:;?!]/;function Fn(e,{from:i,to:o}){let t=e.state.doc.lineAt(i),n=e.state.doc.lineAt(o).to,r=Math.max(t.from,i-yi),s=Math.min(n,o+yi),a=e.state.sliceDoc(r,s);if(r!=t.from){for(let l=0;l<yi;l++)if(!Ci.test(a[l+1])&&Ci.test(a[l])){a=a.slice(l);break}}if(s!=n){for(let l=a.length-1;l>a.length-yi;l--)if(!Ci.test(a[l-1])&&Ci.test(a[l])){a=a.slice(0,l);break}}return D.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${t.number}.`)}var wl=D.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Ll=[Be,Kr.low(Sl),wl];var Fi=class{constructor(i,o,t){this.from=i,this.to=o,this.diagnostic=t}},Je=class e{constructor(i,o,t){this.diagnostics=i,this.panel=o,this.selected=t}static init(i,o,t){let n=t.facet(It).markerFilter;n&&(i=n(i,t));let r=i.slice().sort((S,P)=>S.from-P.from||S.to-P.to),s=new ii,a=[],l=0,f=t.doc.iter(),u=0,g=t.doc.length;for(let S=0;;){let P=S==r.length?null:r[S];if(!P&&!a.length)break;let U,G;if(a.length)U=l,G=a.reduce((N,xe)=>Math.min(N,xe.to),P&&P.from>U?P.from:1e8);else{if(U=P.from,U>g)break;G=P.to,a.push(P),S++}for(;S<r.length;){let N=r[S];if(N.from==U&&(N.to>N.from||N.to==U))a.push(N),S++,G=Math.min(N.to,G);else{G=Math.min(N.from,G);break}}G=Math.min(G,g);let Ot=!1;if(a.some(N=>N.from==U&&(N.to==G||G==g))&&(Ot=U==G,!Ot&&G-U<10)){let N=U-(u+f.value.length);N>0&&(f.next(N),u=U);for(let xe=U;;){if(xe>=G){Ot=!0;break}if(!f.lineBreak&&u+f.value.length>xe)break;xe=u+f.value.length,u+=f.value.length,f.next()}}let Nn=Ol(a);if(Ot)s.add(U,U,H.widget({widget:new In(Nn),diagnostics:a.slice()}));else{let N=a.reduce((xe,Vn)=>Vn.markClass?xe+" "+Vn.markClass:xe,"");s.add(U,G,H.mark({class:"cm-lintRange cm-lintRange-"+Nn+N,diagnostics:a.slice(),inclusiveEnd:a.some(xe=>xe.to>G)}))}if(l=G,l==g)break;for(let N=0;N<a.length;N++)a[N].to<=l&&a.splice(N--,1)}let v=s.finish();return new e(v,o,Ue(v))}};function Ue(e,i=null,o=0){let t=null;return e.between(o,1e9,(n,r,{spec:s})=>{if(!(i&&s.diagnostics.indexOf(i)<0))if(!t)t=new Fi(n,r,i||s.diagnostics[0]);else{if(s.diagnostics.indexOf(t.diagnostic)<0)return!1;t=new Fi(t.from,r,t.diagnostic)}}),t}function El(e,i){let o=i.pos,t=i.end||o,n=e.state.facet(It).hideOn(e,o,t);if(n!=null)return n;let r=e.startState.doc.lineAt(i.pos);return!!(e.effects.some(s=>s.is(i1))||e.changes.touchesRange(r.from,Math.max(r.to,t)))}function zl(e,i){return e.field(ae,!1)?i:i.concat(ee.appendConfig.of(Nl))}var i1=ee.define(),Rn=ee.define(),n1=ee.define(),ae=ft.define({create(){return new Je(H.none,null,null)},update(e,i){if(i.docChanged&&e.diagnostics.size){let o=e.diagnostics.map(i.changes),t=null,n=e.panel;if(e.selected){let r=i.changes.mapPos(e.selected.from,1);t=Ue(o,e.selected.diagnostic,r)||Ue(o,null,r)}!o.size&&n&&i.state.facet(It).autoPanel&&(n=null),e=new Je(o,n,t)}for(let o of i.effects)if(o.is(i1)){let t=i.state.facet(It).autoPanel?o.value.length?Rt.open:null:e.panel;e=Je.init(o.value,t,i.state)}else o.is(Rn)?e=new Je(e.diagnostics,o.value?Rt.open:null,e.selected):o.is(n1)&&(e=new Je(e.diagnostics,e.panel,o.value));return e},provide:e=>[oi.from(e,i=>i.panel),D.decorations.from(e,i=>i.diagnostics)]});var _l=H.mark({class:"cm-lintRange cm-lintRange-active"});function Pl(e,i,o){let{diagnostics:t}=e.state.field(ae),n,r=-1,s=-1;t.between(i-(o<0?1:0),i+(o>0?1:0),(l,f,{spec:u})=>{if(i>=l&&i<=f&&(l==f||(i>l||o>0)&&(i<f||o<0)))return n=u.diagnostics,r=l,s=f,!1});let a=e.state.facet(It).tooltipFilter;return n&&a&&(n=a(n,e.state)),n?{pos:r,end:s,above:e.state.doc.lineAt(r).to<s,create(){return{dom:Al(e,n)}}}:null}function Al(e,i){return I("ul",{class:"cm-tooltip-lint"},i.map(o=>s1(e,o,!1)))}var Tl=e=>{let i=e.state.field(ae,!1);(!i||!i.panel)&&e.dispatch({effects:zl(e.state,[Rn.of(!0)])});let o=xt(e,Rt.open);return o&&o.dom.querySelector(".cm-panel-lint ul").focus(),!0},e1=e=>{let i=e.state.field(ae,!1);return!i||!i.panel?!1:(e.dispatch({effects:Rn.of(!1)}),!0)},Dl=e=>{let i=e.state.field(ae,!1);if(!i)return!1;let o=e.state.selection.main,t=Ue(i.diagnostics,null,o.to+1);return!t&&(t=Ue(i.diagnostics,null,0),!t||t.from==o.from&&t.to==o.to)?!1:(e.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0}),!0)};var r1=[{key:"Mod-Shift-m",run:Tl,preventDefault:!0},{key:"F8",run:Dl}];var It=Oe.define({combine(e){return Nt({sources:e.map(i=>i.source).filter(i=>i!=null)},Qe(e.map(i=>i.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:t1,tooltipFilter:t1,needsRefresh:(i,o)=>i?o?t=>i(t)||o(t):i:o,hideOn:(i,o)=>i?o?(t,n,r)=>i(t,n,r)||o(t,n,r):i:o,autoPanel:(i,o)=>i||o}))}});function t1(e,i){return e?i?(o,t)=>i(e(o,t),t):e:i}function o1(e){let i=[];if(e)e:for(let{name:o}of e){for(let t=0;t<o.length;t++){let n=o[t];if(/[a-zA-Z]/.test(n)&&!i.some(r=>r.toLowerCase()==n.toLowerCase())){i.push(n);continue e}}i.push("")}return i}function s1(e,i,o){var t;let n=o?o1(i.actions):[];return I("li",{class:"cm-diagnostic cm-diagnostic-"+i.severity},I("span",{class:"cm-diagnosticText"},i.renderMessage?i.renderMessage(e):i.message),(t=i.actions)===null||t===void 0?void 0:t.map((r,s)=>{let a=!1,l=S=>{if(S.preventDefault(),a)return;a=!0;let P=Ue(e.state.field(ae).diagnostics,i);P&&r.apply(e,P.from,P.to)},{name:f}=r,u=n[s]?f.indexOf(n[s]):-1,g=u<0?f:[f.slice(0,u),I("u",f.slice(u,u+1)),f.slice(u+1)],v=r.markClass?" "+r.markClass:"";return I("button",{type:"button",class:"cm-diagnosticAction"+v,onclick:l,onmousedown:l,"aria-label":` Action: ${f}${u<0?"":` (access key "${n[s]})"`}.`},g)}),i.source&&I("div",{class:"cm-diagnosticSource"},i.source))}var In=class extends Yr{constructor(i){super(),this.sev=i}eq(i){return i.sev==this.sev}toDOM(){return I("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}},Ii=class{constructor(i,o){this.diagnostic=o,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=s1(i,o,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}},Rt=class e{constructor(i){this.view=i,this.items=[];let o=n=>{if(!(n.ctrlKey||n.altKey||n.metaKey)){if(n.keyCode==27)e1(this.view),this.view.focus();else if(n.keyCode==38||n.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(n.keyCode==40||n.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(n.keyCode==36)this.moveSelection(0);else if(n.keyCode==35)this.moveSelection(this.items.length-1);else if(n.keyCode==13)this.view.focus();else if(n.keyCode>=65&&n.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],s=o1(r.actions);for(let a=0;a<s.length;a++)if(s[a].toUpperCase().charCodeAt(0)==n.keyCode){let l=Ue(this.view.state.field(ae).diagnostics,r);l&&r.actions[a].apply(i,l.from,l.to)}}else return;n.preventDefault()}},t=n=>{for(let r=0;r<this.items.length;r++)this.items[r].dom.contains(n.target)&&this.moveSelection(r)};this.list=I("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:o,onclick:t}),this.dom=I("div",{class:"cm-panel-lint"},this.list,I("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>e1(this.view)},"\xD7")),this.update()}get selectedIndex(){let i=this.view.state.field(ae).selected;if(!i)return-1;for(let o=0;o<this.items.length;o++)if(this.items[o].diagnostic==i.diagnostic)return o;return-1}update(){let{diagnostics:i,selected:o}=this.view.state.field(ae),t=0,n=!1,r=null,s=new Set;for(i.between(0,this.view.state.doc.length,(a,l,{spec:f})=>{for(let u of f.diagnostics){if(s.has(u))continue;s.add(u);let g=-1,v;for(let S=t;S<this.items.length;S++)if(this.items[S].diagnostic==u){g=S;break}g<0?(v=new Ii(this.view,u),this.items.splice(t,0,v),n=!0):(v=this.items[g],g>t&&(this.items.splice(t,g-t),n=!0)),o&&v.diagnostic==o.diagnostic?v.dom.hasAttribute("aria-selected")||(v.dom.setAttribute("aria-selected","true"),r=v):v.dom.hasAttribute("aria-selected")&&v.dom.removeAttribute("aria-selected"),t++}});t<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)n=!0,this.items.pop();this.items.length==0&&(this.items.push(new Ii(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),n=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let f=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/f:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/f)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),n&&this.sync()}sync(){let i=this.list.firstChild;function o(){let t=i;i=t.nextSibling,t.remove()}for(let t of this.items)if(t.dom.parentNode==this.list){for(;i!=t.dom;)o();i=t.dom.nextSibling}else this.list.insertBefore(t.dom,i);for(;i;)o()}moveSelection(i){if(this.selectedIndex<0)return;let o=this.view.state.field(ae),t=Ue(o.diagnostics,this.items[i].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:n1.of(t)})}static open(i){return new e(i)}};function Fl(e,i='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${i}>${encodeURIComponent(e)}</svg>')`}function Di(e){return Fl(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}var Il=D.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Di("#d11")},".cm-lintRange-warning":{backgroundImage:Di("orange")},".cm-lintRange-info":{backgroundImage:Di("#999")},".cm-lintRange-hint":{backgroundImage:Di("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function Rl(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function Ol(e){let i="hint",o=1;for(let t of e){let n=Rl(t.severity);n>o&&(o=n,i=t.severity)}return i}var Nl=[ae,D.decorations.compute([ae],e=>{let{selected:i,panel:o}=e.field(ae);return!i||!o||i.from==i.to?H.none:H.set([_l.range(i.from,i.to)])}),no(Pl,{hideOn:El}),Il];var a1=[oo(),so(),en(),Cn(),uo(),Zi(),Jr(),Ye.allowMultipleSelections.of(!0),co(),kt(rn,{fallback:!0}),mo(),go(),bo(),to(),io(),Zr(),Qs(),St.of([...vo,...Mn,...Zs,...Sn,...fo,...yo,...r1])],l1=[en(),Cn(),Zi(),kt(rn,{fallback:!0}),St.of([...Mn,...Sn])];var Vl=Ct.define(),c1=(()=>{let i=class i{constructor(){this._elementRef=y(qe),this.autoFocus=!1,this.value="",this.disabled=!1,this.readonly=!1,this.theme="light",this.placeholder="",this.indentWithTab=!1,this.indentUnit="",this.lineWrapping=!1,this.highlightWhitespace=!1,this.languages=[],this.language="",this.setup="basic",this.extensions=[],this.change=new le,this.focus=new le,this.blur=new le,this._onChange=()=>{},this._onTouched=()=>{},this._updateListener=D.updateListener.of(t=>{if(t.docChanged&&!t.transactions.some(n=>n.annotation(Vl))){let n=t.state.doc.toString();this._onChange(n),this.change.emit(n)}}),this._editableConf=new we,this._readonlyConf=new we,this._themeConf=new we,this._placeholderConf=new we,this._indentWithTabConf=new we,this._indentUnitConf=new we,this._lineWrappingConf=new we,this._highlightWhitespaceConf=new we,this._languageConf=new we}_getAllExtensions(){return[this._updateListener,this._editableConf.of([]),this._readonlyConf.of([]),this._themeConf.of([]),this._placeholderConf.of([]),this._indentWithTabConf.of([]),this._indentUnitConf.of([]),this._lineWrappingConf.of([]),this._highlightWhitespaceConf.of([]),this._languageConf.of([]),this.setup==="basic"?a1:this.setup==="minimal"?l1:[],...this.extensions]}ngOnChanges(t){this.view&&(t.value&&this.setValue(this.value),t.disabled&&this.setEditable(!this.disabled),t.readonly&&this.setReadonly(this.readonly),t.theme&&this.setTheme(this.theme),t.placeholder&&this.setPlaceholder(this.placeholder),t.indentWithTab&&this.setIndentWithTab(this.indentWithTab),t.indentUnit&&this.setIndentUnit(this.indentUnit),t.lineWrapping&&this.setLineWrapping(this.lineWrapping),t.highlightWhitespace&&this.setHighlightWhitespace(this.highlightWhitespace),t.language&&this.setLanguage(this.language),(t.setup||t.extensions)&&this.setExtensions(this._getAllExtensions()))}ngOnInit(){this.state=Ye.create({doc:this.value,extensions:this._getAllExtensions()}),this.view=new D({root:this.root,parent:this._elementRef.nativeElement,state:this.state}),this.autoFocus&&this.view.focus(),this.view.contentDOM.addEventListener("focus",()=>{this._onTouched(),this.focus.emit()}),this.view.contentDOM.addEventListener("blur",()=>{this._onTouched(),this.blur.emit()}),this.setEditable(!this.disabled),this.setReadonly(this.readonly),this.setTheme(this.theme),this.setPlaceholder(this.placeholder),this.setIndentWithTab(this.indentWithTab),this.setIndentUnit(this.indentUnit),this.setLineWrapping(this.lineWrapping),this.setHighlightWhitespace(this.highlightWhitespace),this.setLanguage(this.language)}ngOnDestroy(){this.view.destroy()}writeValue(t){this.view&&this.setValue(t)}registerOnChange(t){this._onChange=t}registerOnTouched(t){this._onTouched=t}setDisabledState(t){this.disabled=t,this.setEditable(!t)}setValue(t){this.view.dispatch({changes:{from:0,to:this.view.state.doc.length,insert:t},annotations:dt.addToHistory.of(!1)})}_dispatchEffects(t){return this.view.dispatch({effects:t})}setExtensions(t){this._dispatchEffects(ee.reconfigure.of(t))}setEditable(t){this._dispatchEffects(this._editableConf.reconfigure(D.editable.of(t)))}setReadonly(t){this._dispatchEffects(this._readonlyConf.reconfigure(Ye.readOnly.of(t)))}setTheme(t){this._dispatchEffects(this._themeConf.reconfigure(t==="light"?[]:t==="dark"?Ws:t))}setPlaceholder(t){this._dispatchEffects(this._placeholderConf.reconfigure(t?eo(t):[]))}setIndentWithTab(t){this._dispatchEffects(this._indentWithTabConf.reconfigure(t?St.of([Ns]):[]))}setIndentUnit(t){this._dispatchEffects(this._indentUnitConf.reconfigure(t?li.of(t):[]))}setLineWrapping(t){this._dispatchEffects(this._lineWrappingConf.reconfigure(t?D.lineWrapping:[]))}setHighlightWhitespace(t){this._dispatchEffects(this._highlightWhitespaceConf.reconfigure(t?ao():[]))}setLanguage(t){if(!t||t=="plaintext"){this._dispatchEffects(this._languageConf.reconfigure([]));return}if(this.languages.length===0){this.view&&console.error("No supported languages. Please set the `languages` prop at first.");return}this._findLanguage(t)?.load().then(r=>{this._dispatchEffects(this._languageConf.reconfigure([r]))})}_findLanguage(t){for(let n of this.languages)for(let r of[n.name,...n.alias])if(t.toLowerCase()===r.toLowerCase())return n;return console.error("Language not found:",t),console.info("Supported language names:",this.languages.map(n=>n.name).join(", ")),null}};i.\u0275fac=function(n){return new(n||i)},i.\u0275cmp=A({type:i,selectors:[["code-editor"]],hostAttrs:[1,"code-editor"],inputs:{root:"root",autoFocus:[2,"autoFocus","autoFocus",Ke],value:"value",disabled:[2,"disabled","disabled",Ke],readonly:[2,"readonly","readonly",Ke],theme:"theme",placeholder:"placeholder",indentWithTab:[2,"indentWithTab","indentWithTab",Ke],indentUnit:"indentUnit",lineWrapping:[2,"lineWrapping","lineWrapping",Ke],highlightWhitespace:[2,"highlightWhitespace","highlightWhitespace",Ke],languages:"languages",language:"language",setup:"setup",extensions:"extensions"},outputs:{change:"change",focus:"focus",blur:"blur"},features:[Ut([{provide:ar,useExisting:jn(()=>i),multi:!0}]),yt],decls:0,vars:0,template:function(n,r){},styles:[`.code-editor{display:block}.code-editor .cm-editor{height:100%}
4
+ `],encapsulation:2,changeDetection:0});let e=i;return e})();function d(e){return new lo(po.define(e))}function Ge(e){return import("./chunk-IFHFPV5W.js").then(i=>i.sql({dialect:i[e]}))}var On=[c.of({name:"C",extensions:["c","h","ino"],load(){return import("./chunk-E5M4ZDID.js").then(e=>e.cpp())}}),c.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return import("./chunk-E5M4ZDID.js").then(e=>e.cpp())}}),c.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return Ge("Cassandra")}}),c.of({name:"CSS",extensions:["css"],load(){return import("./chunk-KY2BW2LP.js").then(e=>e.css())}}),c.of({name:"Go",extensions:["go"],load(){return import("./chunk-OF7P4LTI.js").then(e=>e.go())}}),c.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return import("./chunk-E43LXI27.js").then(e=>e.html())}}),c.of({name:"Java",extensions:["java"],load(){return import("./chunk-Y3YKVK3K.js").then(e=>e.java())}}),c.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return import("./chunk-NE75E3GD.js").then(e=>e.javascript())}}),c.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return import("./chunk-BI3VI6XG.js").then(e=>e.jinja())}}),c.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return import("./chunk-5O7KTREI.js").then(e=>e.json())}}),c.of({name:"JSX",extensions:["jsx"],load(){return import("./chunk-NE75E3GD.js").then(e=>e.javascript({jsx:!0}))}}),c.of({name:"LESS",extensions:["less"],load(){return import("./chunk-3DNAFXGN.js").then(e=>e.less())}}),c.of({name:"Liquid",extensions:["liquid"],load(){return import("./chunk-6KORLSUZ.js").then(e=>e.liquid())}}),c.of({name:"MariaDB SQL",load(){return Ge("MariaSQL")}}),c.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return import("./chunk-XEDABMM5.js").then(e=>e.markdown())}}),c.of({name:"MS SQL",load(){return Ge("MSSQL")}}),c.of({name:"MySQL",load(){return Ge("MySQL")}}),c.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return import("./chunk-72BXGTUG.js").then(e=>e.php())}}),c.of({name:"PLSQL",extensions:["pls"],load(){return Ge("PLSQL")}}),c.of({name:"PostgreSQL",load(){return Ge("PostgreSQL")}}),c.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return import("./chunk-TDK62XEQ.js").then(e=>e.python())}}),c.of({name:"Rust",extensions:["rs"],load(){return import("./chunk-2W4Z5VTY.js").then(e=>e.rust())}}),c.of({name:"Sass",extensions:["sass"],load(){return import("./chunk-ZLTL7I7D.js").then(e=>e.sass({indented:!0}))}}),c.of({name:"SCSS",extensions:["scss"],load(){return import("./chunk-ZLTL7I7D.js").then(e=>e.sass())}}),c.of({name:"SQL",extensions:["sql"],load(){return Ge("StandardSQL")}}),c.of({name:"SQLite",load(){return Ge("SQLite")}}),c.of({name:"TSX",extensions:["tsx"],load(){return import("./chunk-NE75E3GD.js").then(e=>e.javascript({jsx:!0,typescript:!0}))}}),c.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return import("./chunk-NE75E3GD.js").then(e=>e.javascript({typescript:!0}))}}),c.of({name:"WebAssembly",extensions:["wat","wast"],load(){return import("./chunk-KYA3HPDX.js").then(e=>e.wast())}}),c.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return import("./chunk-MXIJGSDQ.js").then(e=>e.xml())}}),c.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return import("./chunk-WF6D7CQ4.js").then(e=>e.yaml())}}),c.of({name:"APL",extensions:["dyalog","apl"],load(){return import("./chunk-4ORP3SBY.js").then(e=>d(e.apl))}}),c.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return import("./chunk-UPGVU5LG.js").then(e=>d(e.asciiArmor))}}),c.of({name:"ASN.1",extensions:["asn","asn1"],load(){return import("./chunk-AGREZPV4.js").then(e=>d(e.asn1({})))}}),c.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return import("./chunk-YTDE6SXT.js").then(e=>d(e.asterisk))}}),c.of({name:"Brainfuck",extensions:["b","bf"],load(){return import("./chunk-NYJPOP4L.js").then(e=>d(e.brainfuck))}}),c.of({name:"Cobol",extensions:["cob","cpy"],load(){return import("./chunk-2FC5EKS5.js").then(e=>d(e.cobol))}}),c.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return import("./chunk-WR3MA3L3.js").then(e=>d(e.csharp))}}),c.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return import("./chunk-JAEJ6IMV.js").then(e=>d(e.clojure))}}),c.of({name:"ClojureScript",extensions:["cljs"],load(){return import("./chunk-JAEJ6IMV.js").then(e=>d(e.clojure))}}),c.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return import("./chunk-OQRWXCLY.js").then(e=>d(e.gss))}}),c.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return import("./chunk-556I6YIW.js").then(e=>d(e.cmake))}}),c.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return import("./chunk-PZGLDZZM.js").then(e=>d(e.coffeeScript))}}),c.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return import("./chunk-VWIRXLNE.js").then(e=>d(e.commonLisp))}}),c.of({name:"Cypher",extensions:["cyp","cypher"],load(){return import("./chunk-BBHYIURC.js").then(e=>d(e.cypher))}}),c.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return import("./chunk-MKUUWY6Y.js").then(e=>d(e.cython))}}),c.of({name:"Crystal",extensions:["cr"],load(){return import("./chunk-VZMVGIVW.js").then(e=>d(e.crystal))}}),c.of({name:"D",extensions:["d"],load(){return import("./chunk-JF6WIV6M.js").then(e=>d(e.d))}}),c.of({name:"Dart",extensions:["dart"],load(){return import("./chunk-WR3MA3L3.js").then(e=>d(e.dart))}}),c.of({name:"diff",extensions:["diff","patch"],load(){return import("./chunk-7DUTYOJG.js").then(e=>d(e.diff))}}),c.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return import("./chunk-7NZJZATZ.js").then(e=>d(e.dockerFile))}}),c.of({name:"DTD",extensions:["dtd"],load(){return import("./chunk-PTLYIUFW.js").then(e=>d(e.dtd))}}),c.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return import("./chunk-5KJXGMKR.js").then(e=>d(e.dylan))}}),c.of({name:"EBNF",load(){return import("./chunk-5SPGSHKL.js").then(e=>d(e.ebnf))}}),c.of({name:"ECL",extensions:["ecl"],load(){return import("./chunk-TJZKTNNS.js").then(e=>d(e.ecl))}}),c.of({name:"edn",extensions:["edn"],load(){return import("./chunk-JAEJ6IMV.js").then(e=>d(e.clojure))}}),c.of({name:"Eiffel",extensions:["e"],load(){return import("./chunk-QM6CQMEX.js").then(e=>d(e.eiffel))}}),c.of({name:"Elm",extensions:["elm"],load(){return import("./chunk-6I5BGQHT.js").then(e=>d(e.elm))}}),c.of({name:"Erlang",extensions:["erl"],load(){return import("./chunk-F6V37MKG.js").then(e=>d(e.erlang))}}),c.of({name:"Esper",load(){return import("./chunk-S7S5M3AZ.js").then(e=>d(e.esper))}}),c.of({name:"Factor",extensions:["factor"],load(){return import("./chunk-GAGHHYLF.js").then(e=>d(e.factor))}}),c.of({name:"FCL",load(){return import("./chunk-F2XG7EWI.js").then(e=>d(e.fcl))}}),c.of({name:"Forth",extensions:["forth","fth","4th"],load(){return import("./chunk-5DPIGJU4.js").then(e=>d(e.forth))}}),c.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return import("./chunk-L6SYG23T.js").then(e=>d(e.fortran))}}),c.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return import("./chunk-DKGXUMLT.js").then(e=>d(e.fSharp))}}),c.of({name:"Gas",extensions:["s"],load(){return import("./chunk-3OHSTP3R.js").then(e=>d(e.gas))}}),c.of({name:"Gherkin",extensions:["feature"],load(){return import("./chunk-Y63UUJGJ.js").then(e=>d(e.gherkin))}}),c.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return import("./chunk-JSE63Q5X.js").then(e=>d(e.groovy))}}),c.of({name:"Haskell",extensions:["hs"],load(){return import("./chunk-R7PNKQU2.js").then(e=>d(e.haskell))}}),c.of({name:"Haxe",extensions:["hx"],load(){return import("./chunk-RCAORRB7.js").then(e=>d(e.haxe))}}),c.of({name:"HXML",extensions:["hxml"],load(){return import("./chunk-RCAORRB7.js").then(e=>d(e.hxml))}}),c.of({name:"HTTP",load(){return import("./chunk-4GCCF6PF.js").then(e=>d(e.http))}}),c.of({name:"IDL",extensions:["pro"],load(){return import("./chunk-7AXEPO3G.js").then(e=>d(e.idl))}}),c.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return import("./chunk-MR3U7TKQ.js").then(e=>d(e.jsonld))}}),c.of({name:"Julia",extensions:["jl"],load(){return import("./chunk-KT3TWCST.js").then(e=>d(e.julia))}}),c.of({name:"Kotlin",extensions:["kt","kts"],load(){return import("./chunk-WR3MA3L3.js").then(e=>d(e.kotlin))}}),c.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return import("./chunk-SBLNYV74.js").then(e=>d(e.liveScript))}}),c.of({name:"Lua",extensions:["lua"],load(){return import("./chunk-4YT6K5KY.js").then(e=>d(e.lua))}}),c.of({name:"mIRC",extensions:["mrc"],load(){return import("./chunk-JGXVTKLG.js").then(e=>d(e.mirc))}}),c.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return import("./chunk-ZHRYYMYE.js").then(e=>d(e.mathematica))}}),c.of({name:"Modelica",extensions:["mo"],load(){return import("./chunk-ATXLZN2B.js").then(e=>d(e.modelica))}}),c.of({name:"MUMPS",extensions:["mps"],load(){return import("./chunk-DFOOSIIA.js").then(e=>d(e.mumps))}}),c.of({name:"Mbox",extensions:["mbox"],load(){return import("./chunk-RO7SAOLK.js").then(e=>d(e.mbox))}}),c.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return import("./chunk-5IL7C45D.js").then(e=>d(e.nginx))}}),c.of({name:"NSIS",extensions:["nsh","nsi"],load(){return import("./chunk-RUN556VW.js").then(e=>d(e.nsis))}}),c.of({name:"NTriples",extensions:["nt","nq"],load(){return import("./chunk-2E7IJZLL.js").then(e=>d(e.ntriples))}}),c.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return import("./chunk-WR3MA3L3.js").then(e=>d(e.objectiveC))}}),c.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return import("./chunk-WR3MA3L3.js").then(e=>d(e.objectiveCpp))}}),c.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return import("./chunk-DKGXUMLT.js").then(e=>d(e.oCaml))}}),c.of({name:"Octave",extensions:["m"],load(){return import("./chunk-RQUUINHV.js").then(e=>d(e.octave))}}),c.of({name:"Oz",extensions:["oz"],load(){return import("./chunk-7HKFYRPF.js").then(e=>d(e.oz))}}),c.of({name:"Pascal",extensions:["p","pas"],load(){return import("./chunk-CFTKW432.js").then(e=>d(e.pascal))}}),c.of({name:"Perl",extensions:["pl","pm"],load(){return import("./chunk-6NOS45DG.js").then(e=>d(e.perl))}}),c.of({name:"Pig",extensions:["pig"],load(){return import("./chunk-XEGHEUP5.js").then(e=>d(e.pig))}}),c.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return import("./chunk-HS4S6BV3.js").then(e=>d(e.powerShell))}}),c.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return import("./chunk-UQ6O3I6W.js").then(e=>d(e.properties))}}),c.of({name:"ProtoBuf",extensions:["proto"],load(){return import("./chunk-Q7U2VPIS.js").then(e=>d(e.protobuf))}}),c.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return import("./chunk-22DWHRCL.js").then(e=>d(e.pug))}}),c.of({name:"Puppet",extensions:["pp"],load(){return import("./chunk-Q4VNZGFI.js").then(e=>d(e.puppet))}}),c.of({name:"Q",extensions:["q"],load(){return import("./chunk-ATBJWFA3.js").then(e=>d(e.q))}}),c.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return import("./chunk-6OKLPRCD.js").then(e=>d(e.r))}}),c.of({name:"RPM Changes",load(){return import("./chunk-PJF5XUTO.js").then(e=>d(e.rpmChanges))}}),c.of({name:"RPM Spec",extensions:["spec"],load(){return import("./chunk-PJF5XUTO.js").then(e=>d(e.rpmSpec))}}),c.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return import("./chunk-4BPSQMI2.js").then(e=>d(e.ruby))}}),c.of({name:"SAS",extensions:["sas"],load(){return import("./chunk-JGB4LLUT.js").then(e=>d(e.sas))}}),c.of({name:"Scala",extensions:["scala"],load(){return import("./chunk-WR3MA3L3.js").then(e=>d(e.scala))}}),c.of({name:"Scheme",extensions:["scm","ss"],load(){return import("./chunk-F672FY5I.js").then(e=>d(e.scheme))}}),c.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return import("./chunk-EVQKKVUZ.js").then(e=>d(e.shell))}}),c.of({name:"Sieve",extensions:["siv","sieve"],load(){return import("./chunk-KMF3ZRAO.js").then(e=>d(e.sieve))}}),c.of({name:"Smalltalk",extensions:["st"],load(){return import("./chunk-62WT7PI3.js").then(e=>d(e.smalltalk))}}),c.of({name:"Solr",load(){return import("./chunk-DWYP6ZGG.js").then(e=>d(e.solr))}}),c.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return import("./chunk-DKGXUMLT.js").then(e=>d(e.sml))}}),c.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return import("./chunk-6VEJCG43.js").then(e=>d(e.sparql))}}),c.of({name:"Spreadsheet",alias:["excel","formula"],load(){return import("./chunk-32L7RG2G.js").then(e=>d(e.spreadsheet))}}),c.of({name:"Squirrel",extensions:["nut"],load(){return import("./chunk-WR3MA3L3.js").then(e=>d(e.squirrel))}}),c.of({name:"Stylus",extensions:["styl"],load(){return import("./chunk-FQHOSSCO.js").then(e=>d(e.stylus))}}),c.of({name:"Swift",extensions:["swift"],load(){return import("./chunk-25QTY2GI.js").then(e=>d(e.swift))}}),c.of({name:"sTeX",load(){return import("./chunk-JVV3ZL6L.js").then(e=>d(e.stex))}}),c.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return import("./chunk-JVV3ZL6L.js").then(e=>d(e.stex))}}),c.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return import("./chunk-R4MI25E2.js").then(e=>d(e.verilog))}}),c.of({name:"Tcl",extensions:["tcl"],load(){return import("./chunk-YZPIUJB3.js").then(e=>d(e.tcl))}}),c.of({name:"Textile",extensions:["textile"],load(){return import("./chunk-JB5R6V33.js").then(e=>d(e.textile))}}),c.of({name:"TiddlyWiki",load(){return import("./chunk-KLOUBIO4.js").then(e=>d(e.tiddlyWiki))}}),c.of({name:"Tiki wiki",load(){return import("./chunk-LRQSPCYZ.js").then(e=>d(e.tiki))}}),c.of({name:"TOML",extensions:["toml"],load(){return import("./chunk-SIZCHHUA.js").then(e=>d(e.toml))}}),c.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return import("./chunk-T3YI3BSS.js").then(e=>d(e.troff))}}),c.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return import("./chunk-RK7XRDNB.js").then(e=>d(e.ttcn))}}),c.of({name:"TTCN_CFG",extensions:["cfg"],load(){return import("./chunk-4AGQL5GV.js").then(e=>d(e.ttcnCfg))}}),c.of({name:"Turtle",extensions:["ttl"],load(){return import("./chunk-YBNAC7QM.js").then(e=>d(e.turtle))}}),c.of({name:"Web IDL",extensions:["webidl"],load(){return import("./chunk-4FDRWZWT.js").then(e=>d(e.webIDL))}}),c.of({name:"VB.NET",extensions:["vb"],load(){return import("./chunk-CNOVT6KU.js").then(e=>d(e.vb))}}),c.of({name:"VBScript",extensions:["vbs"],load(){return import("./chunk-TAL3RTTQ.js").then(e=>d(e.vbScript))}}),c.of({name:"Velocity",extensions:["vtl"],load(){return import("./chunk-D56H3XE2.js").then(e=>d(e.velocity))}}),c.of({name:"Verilog",extensions:["v"],load(){return import("./chunk-R4MI25E2.js").then(e=>d(e.verilog))}}),c.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return import("./chunk-UJTFWZEC.js").then(e=>d(e.vhdl))}}),c.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return import("./chunk-6F6OMQ5H.js").then(e=>d(e.xQuery))}}),c.of({name:"Yacas",extensions:["ys"],load(){return import("./chunk-4QBOHIC3.js").then(e=>d(e.yacas))}}),c.of({name:"Z80",extensions:["z80"],load(){return import("./chunk-NBBDVVUF.js").then(e=>d(e.z80))}}),c.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return import("./chunk-IJ7K7ATQ.js").then(e=>d(e.mscgen))}}),c.of({name:"X\xF9",extensions:["xu"],load(){return import("./chunk-IJ7K7ATQ.js").then(e=>d(e.xu))}}),c.of({name:"MsGenny",extensions:["msgenny"],load(){return import("./chunk-IJ7K7ATQ.js").then(e=>d(e.msgenny))}}),c.of({name:"Vue",extensions:["vue"],load(){return import("./chunk-JICKUOQ6.js").then(e=>e.vue())}}),c.of({name:"Angular Template",load(){return import("./chunk-SWZ3L2LK.js").then(e=>e.angular())}})];var Ee=(function(e){return e[e.PENDING=0]="PENDING",e[e.SUCCESS=1]="SUCCESS",e[e.ERROR=2]="ERROR",e})(Ee||{}),Ri=class{constructor(i,o,t,n){this.props={},this.id=i,this.type=o,this.path=t,this.name=n,(o===L.COPY||o===L.MOVE||o===L.DOWNLOAD)&&(this.props={progress:1},o!==L.DOWNLOAD&&(this.props.src={name:n,path:t}))}};var Oi=(()=>{let i=class i{constructor(){this.http=y(Z),this.layout=y($),this.store=y(de),this.onDone={[L.DELETE]:{fileEvent:{delete:!0},msg:{success:"Deletion done",failed:"Deletion failed"}},[L.MOVE]:{fileEvent:{delete:!0,reloadFocusOnDst:!0},msg:{success:"Move done",failed:"Move failed"}},[L.COPY]:{msg:{success:"Copy done",failed:"Copy failed"},fileEvent:{reload:!0,focus:!0}},[L.DOWNLOAD]:{fileEvent:{reload:!0,focus:!0},msg:{success:"Download done",failed:"Download failed"}},[L.UPLOAD]:{fileEvent:{reload:!0,focus:!0},msg:{success:"Upload done",failed:"Upload failed"}},[L.COMPRESS]:{fileEvent:{reload:!0,focus:!0},msg:{success:"Compression done",failed:"Compression failed"}},[L.DECOMPRESS]:{fileEvent:{reload:!0,focus:!0},msg:{success:"Decompression done",failed:"Decompression failed"}}},this.watcher=null,this.watch=$e(1e3,1e3).pipe(et(()=>this.doWatch())),this.store.user.subscribe(t=>{t&&this.currentUserId!==t?.id&&this.loadAll(),this.currentUserId=t?.id})}addTask(t){t.status===Ee.PENDING?(this.store.filesActiveTasks.next([t,...this.store.filesActiveTasks.getValue()]),this.startWatch()):this.store.filesEndedTasks.next([t,...this.store.filesEndedTasks.getValue()])}createUploadTask(t,n,r){let s=new Ri(Dr(),L.UPLOAD,t,n);return s.status=Ee.PENDING,s.startedAt=Ar(null,!0),s.props={progress:1,size:0,totalSize:r},this.store.filesActiveTasks.next([s,...this.store.filesActiveTasks.getValue()]),this.layout.showRSideBarTab(ct.TASKS,!0),s}removeAll(){this.http.delete(wt).subscribe({next:()=>this.clearEndedTasks(),error:t=>console.error(t)})}remove(t){this.http.delete(`${wt}/${t.id}`).subscribe({next:()=>this.deleteTask(t.id,!1),error:n=>console.error(n)})}updateTask(t){if(t.status===Ee.PENDING){let n=this.findTask(t.id,!0);Object.assign(n,t)}else this.deleteTask(t.id,!0),this.addTask(t),this.taskDone(t)}loadAll(){this.http.get(wt).subscribe({next:t=>t.forEach(n=>this.addTask(n)),error:t=>console.error(t)})}doWatch(){this.store.filesActiveTasks.getValue().length?this.fetchActiveTasks():this.stopWatch()}startWatch(){(!this.watcher||this.watcher.closed)&&(this.layout.showRSideBarTab(ct.TASKS,!0),this.watcher=this.watch.subscribe())}stopWatch(){(this.watcher||!this.watcher.closed)&&(this.layout.hideRSideBarTab(ct.TASKS,3e3),this.watcher.unsubscribe())}fetchActiveTasks(){for(let t of this.store.filesActiveTasks.getValue().filter(n=>n.type!==L.UPLOAD))this.http.get(`${wt}/${t.id}`).subscribe({next:n=>this.updateTask(n),error:n=>{n.status===404&&(t.result=n.error.message,t.status=Ee.ERROR,this.updateTask(t)),console.warn(n)}})}findTask(t,n){return n?this.store.filesActiveTasks.getValue().find(r=>r.id===t):this.store.filesEndedTasks.getValue().find(r=>r.id===t)}deleteTask(t,n){n?this.store.filesActiveTasks.next(this.store.filesActiveTasks.getValue().filter(r=>r.id!==t)):this.store.filesEndedTasks.next(this.store.filesEndedTasks.getValue().filter(r=>r.id!==t))}taskDone(t){if(t.type in this.onDone){if(this.onDone[t.type].fileEvent){let n=Bi(Nt({},this.onDone[t.type].fileEvent),{status:t.status});t.type===L.COPY||t.type===L.MOVE?(n.filePath=t.props.src.path,n.fileName=t.props.src.name,n.fileDstPath=t.path):(n.filePath=t.path,n.fileName=t.name,t.type===L.COMPRESS&&(n.archiveId=t.props.compressInDirectory===!1?t.id:null)),this.store.filesOnEvent.next(n)}t.status===Ee.SUCCESS?t.type===L.DELETE?this.removeDeletedChildTasks(t):this.layout.sendNotification("info",this.onDone[t.type].msg.success,t.name):this.layout.sendNotification("error",this.onDone[t.type].msg.failed,t.name,{error:{message:t.result}})}}removeDeletedChildTasks(t){if(t.path.startsWith(be.SHARES))this.remove(t);else if(t.path.startsWith(be.TRASH)){for(let n of this.store.filesEndedTasks.getValue().filter(r=>r.id!==t.id&&r.type===L.DELETE&&r.path.startsWith(be.FILES))){let r=t.path.replace(be.TRASH,be.FILES);new RegExp(`^${Br(`${r}/${t.name}`)}(/|$)`).test(`${n.path}/${n.name}`)&&this.remove(n)}this.remove(t)}}clearEndedTasks(){this.store.filesEndedTasks.next([])}};i.\u0275fac=function(n){return new(n||i)},i.\u0275prov=J({token:i,factory:i.\u0275fac,providedIn:"root"});let e=i;return e})();var f1=(()=>{let i=class i{constructor(){this.supportUploadDirectory=Rr(),this.http=y(Z),this.filesService=y(ht),this.filesTasksService=y(Oi)}addFiles(t,n){return B(this,null,function*(){let r=`${sn}/${this.filesService.currentRoute}`,s=[];for(let[a,l]of Object.entries(this.sortFiles(t))){let f=`${this.filesService.currentRoute}/${a}`.split("/").slice(0,-1).join("/"),u=`${this.filesService.currentRoute}/${a}`.split("/").slice(-1)[0],g=this.filesTasksService.createUploadTask(f,u,l.size);s.unshift([g,this.uploadFiles(`${r}/${a}`,l.form,n).pipe($n(v=>v.type===sr.UploadProgress),et(v=>this.updateProgress(g,v)))])}for(let[a,l]of s)try{yield Gn(l),a.props.progress=100,a.status=Ee.SUCCESS}catch(f){a.status=Ee.ERROR,f.status===0?a.result=f.statusText:a.result=f.error.message}finally{this.filesTasksService.updateTask(a)}})}onDropFiles(t,n){t.dataTransfer.items&&t.dataTransfer.items[0]?.webkitGetAsEntry?this.webkitReadDataTransfer(t,n):this.addFiles(t.dataTransfer.files,n.length>0).catch(console.error)}uploadOneFile(t,n,r=!1,s=!1){let a=`${sn}/${t.path}`,l=(t?.root?.alias||t.name).normalize(),f=new File([new Blob([n])],l,{type:t.mime.replace("-","/")}),u=new FormData;return u.append("file",f),this.http.request(r?"patch":s?"put":"post",a,{body:u})}uploadFiles(t,n,r){return this.http.request(r?"put":"post",t,{body:n,reportProgress:!0,observe:"events"})}updateProgress(t,n){t.props.size=n.loaded,t.props.progress=Math.round(100*n.loaded/n.total)}sortFiles(t){let n={};for(let r of t){let s=r.relativePath||r.webkitRelativePath,a=(s?s.split("/")[0]:r.name).normalize();a in n||(n[a]={nb:0,size:0,form:new FormData}),n[a].form.append("file",r,(s||r.name).normalize()),n[a].nb++,n[a].size+=r.size}return n}webkitReadDataTransfer(t,n){let r=t.dataTransfer.items.length,s=[],a=v=>{v.readEntries(function(S){if(S.length){r+=S.length;for(let P of S)P.isFile?P.file(U=>{l(P,U)},f):P.isDirectory&&a(P.createReader());a(v)}else u()},f)},l=(v,S)=>{g(v,S),s.push(S),u()},f=v=>{throw u(),v},u=()=>{if(--r==0){if(n.length<=0){this.addFiles(s,!1).catch(console.error);return}this.filesService.openOverwriteDialog(n).then(v=>{v&&this.addFiles(s,!0).catch(console.error)}).catch(console.error)}},g=(v,S)=>{v.fullPath&&v.fullPath!==`/${S.name}`&&(S.relativePath=v.fullPath.startsWith("/")?v.fullPath.slice(1):v.fullPath)};for(let v of t.dataTransfer.items){let S=v.webkitGetAsEntry();if(!S){u();return}S.isFile?l(S,v.getAsFile()):a(S.createReader())}}};i.\u0275fac=function(n){return new(n||i)},i.\u0275prov=J({token:i,factory:i.\u0275fac,providedIn:"root"});let e=i;return e})();var Bl=["editor"];function Hl(e,i){if(e&1&&_(0,"fa-icon",5),e&2){let o=k();b("icon",o.icons.faSpinner)}}function Ul(e,i){if(e&1&&_(0,"fa-icon",3),e&2){let o=k();b("icon",o.icons.faFloppyDisk)}}function Gl(e,i){if(e&1){let o=W();h(0,"button",10),M("click",function(){E(o);let n=k();return z(n.save(!0))}),x(1,"Save And Exit "),m(),h(2,"button",11),M("click",function(){E(o);let n=k();return z(n.onClose())}),x(3,"Close Without Saving "),m(),h(4,"button",12),M("click",function(){E(o);let n=k();return z(n.warnOnUnsavedChanges.set(!1))}),x(5,"Cancel "),m()}}var d1=(()=>{let i=class i{constructor(){this.editor=Wt("editor"),this.currentHeight=K.required(),this.file=ve.required(),this.isWriteable=K.required(),this.isReadonly=ve.required(),this.modalClosing=K.required(),this.isSupported=ie(!1),this.isModified=ie(!1),this.isSaving=ie(!1),this.lineWrapping=ie(!1),this.warnOnUnsavedChanges=ie(!1),this.content=!1,this.currentLanguage=void 0,this.languages=On,this.currentTheme="light",this.icons={faFloppyDisk:ur,faLock:Kt,faLockOpen:Lr,faMagnifyingGlass:fr,faSpinner:Mr,faArrowsLeftRightToLine:pr,faReply:dr,faShare:yr},this.isSearchPanelOpen=ie(!1),this.layout=y($),this.locale=y(ke),this.isContentReady=!1,this.http=y(Z),this.filesServices=y(ht),this.filesUpload=y(f1),this.subscription=this.layout.switchTheme.subscribe(t=>this.currentTheme=t===Tr?"dark":"light"),Yi(()=>{if(!this.modalClosing())return;let t=Gt(()=>this.file().id);Gt(()=>this.isModified())?(this.warnOnUnsavedChanges.set(!0),this.layout.windows.getValue().find(r=>r.id===t)&&this.layout.restoreDialog(t)):this.onClose().catch(console.error)}),Yi(()=>{this.isReadonly(),Gt(()=>this.isSearchPanelOpen())&&setTimeout(()=>{this.toggleSearch(),this.toggleSearch()},100)})}onKeyDown(t){if(t.key==="Escape"||t.key==="Esc"){t.preventDefault(),this.isSearchPanelOpen()?(t.stopPropagation(),this.toggleSearch()):this.warnOnUnsavedChanges()?(t.stopPropagation(),this.warnOnUnsavedChanges.set(!1)):this.isModified()?(t.stopPropagation(),this.warnOnUnsavedChanges.set(!0)):(t.stopPropagation(),this.onClose().catch(console.error));return}if(t.ctrlKey||t.metaKey)switch(t.key.toLowerCase()){case"s":t.preventDefault(),this.save();return;case"f":t.preventDefault(),t.stopPropagation(),this.toggleSearch();return}}ngOnInit(){return B(this,null,function*(){let t=c.matchFilename(On,this.file().name);this.currentLanguage=t?.name,this.isSupported.set(!0),this.loadContent().catch(console.error)})}toggleReadonly(){return B(this,null,function*(){this.isReadonly()?yield this.lockFile():yield this.unlockFile(),this.isReadonly.update(t=>!t)})}save(t=!1){this.isSaving.set(!0),this.filesUpload.uploadOneFile(this.file(),this.content,!0).subscribe({next:()=>{this.isModified.set(!1),this.isSaving.set(!1),this.warnOnUnsavedChanges.set(!1),t&&this.onClose().catch(console.error),this.file().updateHTimeAgo()},error:n=>{this.isSaving.set(!1),this.layout.sendNotification("error","Unable to save document",n.error.message)}})}toggleSearch(){this.isSearchPanelOpen.update(t=>!t),this.isSearchPanelOpen()?Ai(this.editor().view):Ti(this.editor().view)}contentChange(){this.isContentReady?this.isModified.set(!0):this.isContentReady=!0}onUndo(){mi({state:this.editor().view.state,dispatch:this.editor().view.dispatch})}onRedo(){Pt({state:this.editor().view.state,dispatch:this.editor().view.dispatch})}canUndo(){return this.editor()?.view?as(this.editor().view.state)>0:!1}canRedo(){return this.editor()?.view?ls(this.editor().view.state)>0:!1}onClose(){return B(this,null,function*(){this.isReadonly()||(yield this.unlockFile()),this.layout.closeDialog(null,this.file().id)})}ngOnDestroy(){this.subscription.unsubscribe()}loadContent(){return B(this,null,function*(){this.isReadonly()||(yield this.lockFile()),this.http.get(this.file().dataUrl,{responseType:"text"}).subscribe({next:t=>this.content=t,error:t=>this.layout.sendNotification("error","Unable to open document",this.file().name,t)})})}lockFile(){return B(this,null,function*(){if(!(!this.isSupported||!this.isWriteable()))try{let t=yield We(this.filesServices.lock(this.file()));this.file.update(n=>(n.lock=t,n))}catch(t){this.lockError(t)}})}unlockFile(){return B(this,null,function*(){if(!(!this.isSupported||!this.isWriteable()))try{yield We(this.filesServices.unlock(this.file())),this.file.update(t=>(delete t.lock,t))}catch(t){this.lockError(t)}})}lockError(t){if(this.isReadonly.set(!0),this.isSupported.set(!1),t.error?.owner){let n=t.error;this.file.update(r=>(r.lock=n,r)),this.layout.sendNotification("info","The file is locked",Te(n))}else this.layout.sendNotification("warning",this.file().name,t.error.message)}};i.\u0275fac=function(n){return new(n||i)},i.\u0275cmp=A({type:i,selectors:[["app-files-viewer-text"]],viewQuery:function(n,r){n&1&&Bt(r.editor,Bl,5),n&2&&Ht()},hostBindings:function(n,r){n&1&&M("keydown",function(a){return r.onKeyDown(a)},tt)},inputs:{currentHeight:[1,"currentHeight"],file:[1,"file"],isWriteable:[1,"isWriteable"],isReadonly:[1,"isReadonly"],modalClosing:[1,"modalClosing"]},outputs:{file:"fileChange",isReadonly:"isReadonlyChange"},decls:24,vars:49,consts:[["editor",""],[1,"app-top-menu"],["type","button",1,"btn","btn-default","me-1",3,"click","tooltip","adaptivePosition","disabled"],[3,"icon"],["type","button",1,"btn","btn-default","me-1",3,"click","tooltip","isDisabled","disabled"],["animation","spin",3,"icon"],["type","button",1,"d-none","d-sm-block","btn","btn-custom","me-1",3,"click","disabled","tooltip"],["btnCheckbox","","type","button",1,"btn","btn-custom","me-1",3,"ngModelChange","ngModel","tooltip"],["btnCheckbox","","type","button",1,"d-none","d-sm-block","btn","btn-custom",3,"ngModelChange","ngModel","tooltip"],[3,"ngModelChange","change","autoFocus","languages","language","ngModel","theme","readonly","disabled","lineWrapping"],["type","button","l10nTranslate","",1,"btn","btn-primary","me-2","ms-auto",3,"click"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-danger","me-2",3,"click"],["data-dismiss","modal","type","button","l10nTranslate","",1,"d-none","d-sm-block","btn","btn-default",3,"click"]],template:function(n,r){if(n&1){let s=W();h(0,"div")(1,"div",1)(2,"button",2),V(3,"translate"),M("click",function(){return E(s),z(r.toggleReadonly())}),_(4,"fa-icon",3),m(),h(5,"button",4),V(6,"translate"),M("click",function(){return E(s),z(r.save())}),R(7,Hl,1,1,"fa-icon",5)(8,Ul,1,1,"fa-icon",3),m(),h(9,"button",6),V(10,"translate"),M("click",function(){return E(s),z(r.onUndo())}),_(11,"fa-icon",3),m(),h(12,"button",6),V(13,"translate"),M("click",function(){return E(s),z(r.onRedo())}),_(14,"fa-icon",3),m(),h(15,"button",7),V(16,"translate"),M("ngModelChange",function(l){return E(s),z(r.lineWrapping.set(l))}),_(17,"fa-icon",3),m(),h(18,"button",8),V(19,"translate"),M("ngModelChange",function(){return E(s),z(r.toggleSearch())}),_(20,"fa-icon",3),m(),R(21,Gl,6,0),m(),h(22,"code-editor",9,0),ge("ngModelChange",function(l){return E(s),pe(r.content,l)||(r.content=l),z(l)}),M("change",function(){return E(s),z(r.contentChange())}),m()()}n&2&&(Y("height",r.currentHeight(),"px"),p(2),b("tooltip",Q(3,31,r.isReadonly()||!r.isWriteable()?"Read-only":"Read-write",r.locale.language))("adaptivePosition",!0)("disabled",!r.isSupported()||!r.isWriteable()),p(2),b("icon",r.isReadonly()?r.icons.faLock:r.icons.faLockOpen),p(),b("tooltip",Q(6,34,r.isReadonly()||!r.isWriteable()||!r.isModified()?void 0:"Save",r.locale.language))("isDisabled",r.isReadonly()||!r.isWriteable()||!r.isModified())("disabled",r.isReadonly()||!r.isWriteable()||!r.isModified()),p(2),O(r.isSaving()?7:8),p(2),b("disabled",!r.canUndo())("tooltip",Q(10,37,"Undo",r.locale.language)),p(2),b("icon",r.icons.faReply),p(),b("disabled",!r.canRedo())("tooltip",Q(13,40,"Redo",r.locale.language)),p(2),b("icon",r.icons.faShare),p(),b("ngModel",r.lineWrapping())("tooltip",Q(16,43,"Line Wrap",r.locale.language)),p(2),b("icon",r.icons.faArrowsLeftRightToLine),p(),b("ngModel",r.isSearchPanelOpen())("tooltip",Q(19,46,"Search",r.locale.language)),p(2),b("icon",r.icons.faMagnifyingGlass),p(),O(r.warnOnUnsavedChanges()?21:-1),p(),b("autoFocus",!0)("languages",r.languages)("language",r.currentLanguage),me("ngModel",r.content),b("theme",r.currentTheme)("readonly",r.isReadonly())("disabled",r.isReadonly())("lineWrapping",r.lineWrapping()))},dependencies:[c1,jt,qt,at,ot,st,fe,Zt,ce,lt],styles:[`.code-editor{height:calc(100% - 40px)}.cm-focused{outline:none!important}.cm-panel.cm-search{display:flex;align-items:center;text-wrap:nowrap}.cm-panel.cm-search label{display:flex;align-items:center}.cm-panel.cm-search button[aria-label=close]{display:none}
5
+ `],encapsulation:2});let e=i;return e})();function Wl(e,i){if(e&1){let o=W();h(0,"app-files-viewer-image",9),ge("fileChange",function(n){E(o);let r=k(2);return pe(r.currentFile,n)||(r.currentFile=n),z(n)}),m()}if(e&2){let o=k(2);b("currentHeight",o.currentHeight),me("file",o.currentFile),b("directoryImages",o.directoryImages())}}function $l(e,i){if(e&1&&_(0,"app-files-viewer-pdf",7),e&2){let o=k(2);b("currentHeight",o.currentHeight)("fileUrl",o.currentFile.dataUrl)}}function ql(e,i){if(e&1&&_(0,"app-files-viewer-media",7),e&2){let o=k(2);b("currentHeight",o.currentHeight)("fileUrl",o.currentFile.dataUrl)}}function jl(e,i){if(e&1){let o=W();h(0,"app-files-viewer-collabora-online",12),ge("isReadonlyChange",function(n){E(o);let r=k(3);return pe(r.isReadonly,n)||(r.isReadonly=n),z(n)}),m()}if(e&2){let o=k(3);b("currentHeight",o.currentHeight)("file",o.currentFile),me("isReadonly",o.isReadonly)}}function Kl(e,i){if(e&1){let o=W();h(0,"app-files-viewer-only-office",12),ge("isReadonlyChange",function(n){E(o);let r=k(3);return pe(r.isReadonly,n)||(r.isReadonly=n),z(n)}),m()}if(e&2){let o=k(3);b("currentHeight",o.currentHeight)("file",o.currentFile),me("isReadonly",o.isReadonly)}}function Yl(e,i){if(e&1&&(h(0,"div",13),x(1,"No editor found"),m()),e&2){let o=k(3);Y("height",o.currentHeight,"px")}}function Ql(e,i){if(e&1&&R(0,jl,1,3,"app-files-viewer-collabora-online",10)(1,Kl,1,3,"app-files-viewer-only-office",10)(2,Yl,2,2,"div",11),e&2){let o=k(2);O(o.editorProvider.collabora?0:o.editorProvider.onlyoffice?1:2)}}function Xl(e,i){if(e&1){let o=W();h(0,"app-files-viewer-text",14),ge("isReadonlyChange",function(n){E(o);let r=k(2);return pe(r.isReadonly,n)||(r.isReadonly=n),z(n)}),m()}if(e&2){let o=k(2);b("currentHeight",o.currentHeight)("file",o.currentFile)("isWriteable",o.isWriteable)("modalClosing",o.modalClosing()),me("isReadonly",o.isReadonly)}}function Jl(e,i){if(e&1&&(h(0,"div",5),R(1,Wl,1,3,"app-files-viewer-image",6)(2,$l,1,2,"app-files-viewer-pdf",7)(3,ql,1,2,"app-files-viewer-media",7)(4,Ql,3,1)(5,Xl,1,5,"app-files-viewer-text",8),m()),e&2){let o,t=k();p(),O((o=t.hookedShortMime)===t.SHORT_MIME.IMAGE?1:o===t.SHORT_MIME.PDF?2:o===t.SHORT_MIME.MEDIA?3:o===t.SHORT_MIME.DOCUMENT?4:5)}}var u1=(()=>{let i=class i{constructor(){this.modalClosing=ie(!1),this.isReadonly=ve(!0),this.SHORT_MIME=Pe,this.icons={faEye:mr,faPen:Er},this.directoryImages=Fe(()=>this.directoryFiles.filter(t=>t.isImage)),this.store=y(de),this.layout=y($),this.subscription=this.layout.resizeEvent.subscribe(()=>this.onResize()),this.offsetTop=42}ngOnInit(){this.isReadonly.set(this.mode===Le.VIEW),this.openedFile={id:this.currentFile.id,name:this.currentFile.name,mimeUrl:this.currentFile.mimeUrl},this.onResize()}ngOnDestroy(){this.subscription.unsubscribe()}onClose(){this.currentFile.isEditable&&this.hookedShortMime===Pe.TEXT?(this.modalClosing.set(!0),setTimeout(()=>this.modalClosing.set(!1),1e3)):this.layout.closeDialog(null,this.openedFile.id)}onMinimize(){this.layout.minimizeDialog(this.openedFile.id,{name:this.openedFile.name,mimeUrl:this.openedFile.mimeUrl})}onResize(){this.currentHeight=window.innerHeight-this.offsetTop}};i.\u0275fac=function(n){return new(n||i)},i.\u0275cmp=A({type:i,selectors:[["app-files-viewer-dialog"]],inputs:{currentFile:"currentFile",directoryFiles:"directoryFiles",mode:"mode",isWriteable:"isWriteable",hookedShortMime:"hookedShortMime",editorProvider:"editorProvider",isReadonly:[1,"isReadonly"]},outputs:{isReadonly:"isReadonlyChange"},decls:8,vars:3,consts:[[1,"modal-header"],[1,"modal-title"],[3,"icon"],["aria-label","Minimize","type","button",1,"btn-minimize","btn-minimize-white",3,"click"],["aria-label","Close","type","button",1,"btn-close","btn-close-white","ms-3",3,"click"],[1,"modal-body"],[3,"currentHeight","file","directoryImages"],[3,"currentHeight","fileUrl"],[3,"currentHeight","file","isWriteable","modalClosing","isReadonly"],[3,"fileChange","currentHeight","file","directoryImages"],[3,"currentHeight","file","isReadonly"],["l10nTranslate","",1,"d-flex","p-4",3,"height"],[3,"isReadonlyChange","currentHeight","file","isReadonly"],["l10nTranslate","",1,"d-flex","p-4"],[3,"isReadonlyChange","currentHeight","file","isWriteable","modalClosing","isReadonly"]],template:function(n,r){n&1&&(h(0,"div",0)(1,"h4",1),_(2,"fa-icon",2),h(3,"span"),x(4),m()(),h(5,"button",3),M("click",function(){return r.onMinimize()}),m(),h(6,"button",4),M("click",function(){return r.onClose()}),m()(),R(7,Jl,6,1,"div",5)),n&2&&(p(2),b("icon",r.isReadonly()?r.icons.faEye:r.icons.faPen),p(2),j(r.currentFile.name),p(3),O(r.currentFile?7:-1))},dependencies:[Yo,Go,d1,No,fe,Ko,Ro,ce],encapsulation:2});let e=i;return e})();var O6={prefix:"far",iconName:"bell",icon:[448,512,[128276,61602],"f0f3","M224 0c-13.3 0-24 10.7-24 24l0 9.7C118.6 45.3 56 115.4 56 200l0 14.5c0 37.7-10 74.7-29 107.3L5.1 359.2C1.8 365 0 371.5 0 378.2 0 399.1 16.9 416 37.8 416l372.4 0c20.9 0 37.8-16.9 37.8-37.8 0-6.7-1.8-13.3-5.1-19L421 321.7c-19-32.6-29-69.6-29-107.3l0-14.5c0-84.6-62.6-154.7-144-166.3l0-9.7c0-13.3-10.7-24-24-24zM392.4 368l-336.9 0 12.9-22.1C91.7 306 104 260.6 104 214.5l0-14.5c0-66.3 53.7-120 120-120s120 53.7 120 120l0 14.5c0 46.2 12.3 91.5 35.5 131.4L392.4 368zM156.1 464c9.9 28 36.6 48 67.9 48s58-20 67.9-48l-135.8 0z"]};var Zl={prefix:"far",iconName:"file-zipper",icon:[384,512,["file-archive"],"f1c6","M64 48l112 0 0 88c0 39.8 32.2 72 72 72l88 0 0 240c0 8.8-7.2 16-16 16L64 464c-8.8 0-16-7.2-16-16L48 64c0-8.8 7.2-16 16-16zM224 67.9l92.1 92.1-68.1 0c-13.3 0-24-10.7-24-24l0-68.1zM64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-261.5c0-17-6.7-33.3-18.7-45.3L242.7 18.7C230.7 6.7 214.5 0 197.5 0L64 0zM80 104c0 13.3 10.7 24 24 24l16 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-16 0c-13.3 0-24 10.7-24 24zm0 80c0 13.3 10.7 24 24 24l32 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-32 0c-13.3 0-24 10.7-24 24zm64 56l-32 0c-17.7 0-32 14.3-32 32l0 48c0 26.5 21.5 48 48 48s48-21.5 48-48l0-48c0-17.7-14.3-32-32-32zm-16 64a16 16 0 1 1 0 32 16 16 0 1 1 0-32z"]},N6=Zl;var V6={prefix:"far",iconName:"clock",icon:[512,512,[128339,"clock-four"],"f017","M464 256a208 208 0 1 1 -416 0 208 208 0 1 1 416 0zM0 256a256 256 0 1 0 512 0 256 256 0 1 0 -512 0zM232 120l0 136c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2 280 120c0-13.3-10.7-24-24-24s-24 10.7-24 24z"]};var h1={prefix:"far",iconName:"file",icon:[384,512,[128196,128459,61462],"f15b","M176 48L64 48c-8.8 0-16 7.2-16 16l0 384c0 8.8 7.2 16 16 16l256 0c8.8 0 16-7.2 16-16l0-240-88 0c-39.8 0-72-32.2-72-72l0-88zM316.1 160L224 67.9 224 136c0 13.3 10.7 24 24 24l68.1 0zM0 64C0 28.7 28.7 0 64 0L197.5 0c17 0 33.3 6.7 45.3 18.7L365.3 141.3c12 12 18.7 28.3 18.7 45.3L384 448c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64z"]};var B6={prefix:"far",iconName:"trash-can",icon:[448,512,[61460,"trash-alt"],"f2ed","M166.2-16c-13.3 0-25.3 8.3-30 20.8L120 48 24 48C10.7 48 0 58.7 0 72S10.7 96 24 96l400 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-96 0-16.2-43.2C307.1-7.7 295.2-16 281.8-16L166.2-16zM32 144l0 304c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-304-48 0 0 304c0 8.8-7.2 16-16 16L96 464c-8.8 0-16-7.2-16-16l0-304-48 0zm160 72c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 176c0 13.3 10.7 24 24 24s24-10.7 24-24l0-176zm112 0c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 176c0 13.3 10.7 24 24 24s24-10.7 24-24l0-176z"]};var H6={prefix:"far",iconName:"user",icon:[448,512,[128100,62144,62470,"user-alt","user-large"],"f007","M144 128a80 80 0 1 1 160 0 80 80 0 1 1 -160 0zm208 0a128 128 0 1 0 -256 0 128 128 0 1 0 256 0zM48 480c0-70.7 57.3-128 128-128l96 0c70.7 0 128 57.3 128 128l0 8c0 13.3 10.7 24 24 24s24-10.7 24-24l0-8c0-97.2-78.8-176-176-176l-96 0C78.8 304 0 382.8 0 480l0 8c0 13.3 10.7 24 24 24s24-10.7 24-24l0-8z"]};var m1={prefix:"far",iconName:"file-lines",icon:[384,512,[128441,128462,61686,"file-alt","file-text"],"f15c","M64 48l112 0 0 88c0 39.8 32.2 72 72 72l88 0 0 240c0 8.8-7.2 16-16 16L64 464c-8.8 0-16-7.2-16-16L48 64c0-8.8 7.2-16 16-16zM224 67.9l92.1 92.1-68.1 0c-13.3 0-24-10.7-24-24l0-68.1zM64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-261.5c0-17-6.7-33.3-18.7-45.3L242.7 18.7C230.7 6.7 214.5 0 197.5 0L64 0zm56 256c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0zm0 96c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0z"]};var U6={prefix:"far",iconName:"comment-dots",icon:[512,512,[128172,62075,"commenting"],"f4ad","M0 240c0 54.4 19.3 104.6 51.9 144.9L3.1 474.3c-2 3.7-3.1 7.9-3.1 12.2 0 14.1 11.4 25.5 25.5 25.5 4 0 7.8-.6 11.5-2.1L153.4 460c31.4 12.9 66.1 20 102.6 20 141.4 0 256-107.5 256-240S397.4 0 256 0 0 107.5 0 240zM94 407.9c9.3-17.1 7.4-38.1-4.8-53.2-26.1-32.3-41.2-71.9-41.2-114.7 0-103.2 90.2-192 208-192s208 88.8 208 192-90.2 192-208 192c-30.2 0-58.7-5.9-84.3-16.4-11.9-4.9-25.3-4.8-37.1 .3L76 440.9 94 407.9zM144 272a32 32 0 1 0 0-64 32 32 0 1 0 0 64zm144-32a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm80 32a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"]};var G6={prefix:"far",iconName:"flag",icon:[448,512,[127988,61725],"f024","M48 24C48 10.7 37.3 0 24 0S0 10.7 0 24L0 488c0 13.3 10.7 24 24 24s24-10.7 24-24l0-100 80.3-20.1c41.1-10.3 84.6-5.5 122.5 13.4 44.2 22.1 95.5 24.8 141.7 7.4l34.7-13c12.5-4.7 20.8-16.6 20.8-30l0-279.7c0-23-24.2-38-44.8-27.7l-9.6 4.8c-46.3 23.2-100.8 23.2-147.1 0-35.1-17.6-75.4-22-113.5-12.5L48 52 48 24zm0 77.5l96.6-24.2c27-6.7 55.5-3.6 80.4 8.8 54.9 27.4 118.7 29.7 175 6.8l0 241.8-24.4 9.1c-33.7 12.6-71.2 10.7-103.4-5.4-48.2-24.1-103.3-30.1-155.6-17.1l-68.6 17.2 0-237z"]};var W6={prefix:"far",iconName:"window-restore",icon:[576,512,[],"f2d2","M512 80L224 80c-8.8 0-16 7.2-16 16l0 16-48 0 0-16c0-35.3 28.7-64 64-64l288 0c35.3 0 64 28.7 64 64l0 192c0 35.3-28.7 64-64 64l-48 0 0-48 48 0c8.8 0 16-7.2 16-16l0-192c0-8.8-7.2-16-16-16zM368 288l-320 0 0 128c0 8.8 7.2 16 16 16l288 0c8.8 0 16-7.2 16-16l0-128zM64 160l288 0c35.3 0 64 28.7 64 64l0 192c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 224c0-35.3 28.7-64 64-64z"]};var p1={prefix:"far",iconName:"file-word",icon:[384,512,[],"f1c2","M64 48l112 0 0 88c0 39.8 32.2 72 72 72l88 0 0 240c0 8.8-7.2 16-16 16L64 464c-8.8 0-16-7.2-16-16L48 64c0-8.8 7.2-16 16-16zM224 67.9l92.1 92.1-68.1 0c-13.3 0-24-10.7-24-24l0-68.1zM64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-261.5c0-17-6.7-33.3-18.7-45.3L242.7 18.7C230.7 6.7 214.5 0 197.5 0L64 0zm71.3 274.2c-3.2-12.9-16.2-20.7-29.1-17.5S85.5 273 88.7 285.8l32 128c2.5 10.2 11.4 17.5 21.9 18.1s20.1-5.7 23.8-15.5l25.5-68.1 25.5 68.1c3.7 9.8 13.3 16.1 23.8 15.5s19.4-7.9 21.9-18.1l32-128c3.2-12.9-4.6-25.9-17.5-29.1s-25.9 4.6-29.1 17.5l-13.3 53.2-20.9-55.8C211 262.2 202 256 192 256s-19 6.2-22.5 15.6l-20.9 55.8-13.3-53.2z"]};var $6={prefix:"far",iconName:"folder-closed",icon:[512,512,[],"e185","M448 400L64 400c-8.8 0-16-7.2-16-16l0-144 416 0 0 144c0 8.8-7.2 16-16 16zm16-208l-416 0 0-96c0-8.8 7.2-16 16-16l138.7 0c3.5 0 6.8 1.1 9.6 3.2L250.7 112c13.8 10.4 30.7 16 48 16L448 128c8.8 0 16 7.2 16 16l0 48zM64 448l384 0c35.3 0 64-28.7 64-64l0-240c0-35.3-28.7-64-64-64L298.7 80c-6.9 0-13.7-2.2-19.2-6.4L241.1 44.8C230 36.5 216.5 32 202.7 32L64 32C28.7 32 0 60.7 0 96L0 384c0 35.3 28.7 64 64 64z"]};var g1=(()=>{let i=class i{constructor(){this.file=null,this.rememberChoice=!1,this.icons={faFile:h1,faFileWord:p1,faArrowRight:wr,faFileLines:m1},this.locale=y(ke),this.layout=y($),this.userService=y(Jt)}selectEditor(t){this.rememberChoice&&this.userService.setEditorProviderPreference(t),this.editorProvider[t]=!0,this.layout.closeDialog()}};i.\u0275fac=function(n){return new(n||i)},i.\u0275cmp=A({type:i,selectors:[["app-files-viewer-select-dialog"]],inputs:{file:"file",editorProvider:"editorProvider"},decls:36,vars:5,consts:[[1,"modal-header"],[1,"modal-title"],[3,"icon"],["aria-label","Close","type","button",1,"btn-close","btn-close-white",3,"click"],[1,"modal-body","modal-viewer-select"],["l10nTranslate","",1,"text-muted","mb-3"],[1,"row","g-3"],[1,"col-12","col-md-6"],["type","button",1,"editor-choice","is-collabora","w-100","btn","p-0","border-0","text-start",3,"click"],[1,"card","h-100","shadow-sm","editor-card","editor-collabora"],[1,"card-body","d-flex","align-items-center","gap-3","p-3"],[1,"editor-badge","collabora"],[1,"flex-grow-1"],[1,"text-bold","mb-1"],["l10nTranslate","",1,"text-muted","fs-2xs"],["type","button",1,"editor-choice","is-onlyoffice","w-100","btn","p-0","border-0","text-start",3,"click"],[1,"card","h-100","shadow-sm","editor-card"],[1,"editor-badge","bg-primary-subtle","text-primary"],[1,"form-check","ms-auto","mt-3"],["type","checkbox","id","rememberEditor",1,"form-check-input",3,"ngModelChange","ngModel"],["for","rememberEditor","l10nTranslate","",1,"form-check-label","fs-sm"]],template:function(n,r){n&1&&(h(0,"div",0)(1,"h4",1),_(2,"fa-icon",2),h(3,"span"),x(4),m()(),h(5,"button",3),M("click",function(){return r.layout.closeDialog()}),m()(),h(6,"div",4)(7,"p",5),x(8," Choose which editor you want to use to open this document. "),m(),h(9,"div",6)(10,"div",7)(11,"button",8),M("click",function(){return r.selectEditor("collabora")}),h(12,"div",9)(13,"div",10)(14,"div",11),_(15,"fa-icon",2),m(),h(16,"div",12)(17,"h3",13),x(18,"Collabora"),m(),h(19,"div",14),x(20," Open-source office suite built on LibreOffice. "),m()()()()()(),h(21,"div",7)(22,"button",15),M("click",function(){return r.selectEditor("onlyoffice")}),h(23,"div",16)(24,"div",10)(25,"div",17),_(26,"fa-icon",2),m(),h(27,"div",12)(28,"h3",13),x(29,"OnlyOffice"),m(),h(30,"div",14),x(31," Open-source office suite for Microsoft Office. "),m()()()()()()(),h(32,"div",18)(33,"input",19),ge("ngModelChange",function(a){return pe(r.rememberChoice,a)||(r.rememberChoice=a),a}),m(),h(34,"label",20),x(35," Remember my choice for next time "),m()()()),n&2&&(p(2),b("icon",r.icons.faFile),p(2),j(r.file.name),p(11),b("icon",r.icons.faFileLines),p(11),b("icon",r.icons.faFileWord),p(7),me("ngModel",r.rememberChoice))},dependencies:[fe,ce,at,lr,ot,st],styles:['@charset "UTF-8";.editor-card[_ngcontent-%COMP%]{position:relative;background:#ffffff80;transition:box-shadow .25s ease,border-color .25s ease,background-color .25s ease;overflow:hidden}.editor-card[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:0;opacity:0;pointer-events:none;transition:opacity .25s ease}.editor-choice.is-collabora[_ngcontent-%COMP%] .editor-card[_ngcontent-%COMP%]{border:.5px solid rgba(188,57,205,.35);box-shadow:0 0 0 1px #bc39cd40,0 10px 26px #bc39cd40}.editor-choice.is-collabora[_ngcontent-%COMP%] .editor-card[_ngcontent-%COMP%]:before{opacity:.55;background:radial-gradient(circle at top left,rgba(188,57,205,.35),transparent 65%)}.editor-choice.is-collabora[_ngcontent-%COMP%]:hover .editor-card[_ngcontent-%COMP%]{border-color:#bc39cdbf}.editor-choice.is-collabora[_ngcontent-%COMP%]:hover .editor-card[_ngcontent-%COMP%]:before{opacity:1}.editor-choice.is-onlyoffice[_ngcontent-%COMP%] .editor-card[_ngcontent-%COMP%]{border:.5px solid rgba(0,153,248,.35);box-shadow:0 0 0 1px #0099f840,0 10px 26px #0099f840}.editor-choice.is-onlyoffice[_ngcontent-%COMP%] .editor-card[_ngcontent-%COMP%]:before{opacity:.55;background:radial-gradient(circle at top left,rgba(0,153,248,.35),transparent 65%)}.editor-choice.is-onlyoffice[_ngcontent-%COMP%]:hover .editor-card[_ngcontent-%COMP%]{border-color:#0099f8bf}.editor-choice.is-onlyoffice[_ngcontent-%COMP%]:hover .editor-card[_ngcontent-%COMP%]:before{opacity:1}.editor-badge[_ngcontent-%COMP%]{min-width:45px;height:45px;border-radius:16px;display:grid;place-items:center;font-size:calc(var(--font-size-base) * 1.4666667)}.editor-badge.collabora[_ngcontent-%COMP%]{background-color:#e7c3ee;color:#9a4bb4}']});let e=i;return e})();var Ni=class{constructor(i){Object.assign(this,i),this.mimeUrl=ei(this.mime),this.setProperties()}fallBackMimeUrl(){this.mimeUrl=ti}setProperties(){let i=this.path.split("/")[0],o=this.path.split("/")[1]===Yt.PERSONAL;this.showedPath=this.path.split("/").slice(o?2:1).join("/"),this.iconClass=i===be.SHARES?"purple":"primary",this.icon=i===be.SHARES?ne.SHARES:o?ne.PERSONAL:ne.SPACES}};var Vi=class{constructor(i){this.inTrash=!1,Object.assign(this,i),this.mimeUrl=ei(this.mime),this.iconClass=this.shareId?"purple":"primary",this.icon=this.shareId?ne.SHARES:this.spaceId?ne.SPACES:ne.PERSONAL,this.showedPath=this.path.split("/").slice(this.path.split("/")[1]===Yt.PERSONAL?2:1).join("/"),this.inTrash=this.path.split("/")[0]===be.TRASH}fallBackMimeUrl(){this.mimeUrl=ti}};var ht=(()=>{let i=class i{constructor(){this.treeNodeSelected=null,this.treeCopyMoveOn=new bt,this.clipboardAction="copyPaste",this.http=y(Z),this.layout=y($),this.store=y(de),this.sanitizer=y(rt),this.filesTasksService=y(Oi),this.userService=y(Jt)}getTreeNode(t,n=!1){return We(this.http.get(`${Vr}/${t}`,{params:n?new $t().set("showFiles",n):null}))}addToClipboard(t){if(t.length)if(!this.store.filesClipboard.getValue().length)this.layout.showRSideBarTab(ct.CLIPBOARD,!0),this.store.filesClipboard.next(t);else{let n=t.filter(r=>this.store.filesClipboard.getValue().indexOf(r)===-1);n.length&&this.store.filesClipboard.next([...n,...this.store.filesClipboard.getValue()])}}removeFromClipboard(t){this.store.filesClipboard.next(this.store.filesClipboard.getValue().filter(n=>n.id!==t.id))}clearClipboard(){this.store.filesClipboard.next([])}onPasteClipboard(t){let n=t||this.clipboardAction;if(this.store.filesClipboard.getValue().length){let r=this.currentRoute;this.copyMove([...this.store.filesClipboard.getValue()],r,n==="copyPaste"?L.COPY:L.MOVE).catch(console.error),this.clearClipboard()}}download(t){Xi(t.dataUrl)}copyMove(t,n,r){return B(this,null,function*(){let s=!1,a=yield this.getTreeNode(n,!0),l=t.filter(u=>a.some(g=>g.name.toLowerCase()===u.name.toLowerCase()));if(l.length>0&&(s=yield this.openOverwriteDialog(l),!s))return;let f=r===L.MOVE;for(let u of t){f&&(u.isBeingDeleted=!0);let g={dstDirectory:n,overwrite:s};this.http.request(r,u.taskUrl,{body:g}).subscribe({next:v=>this.filesTasksService.addTask(v),error:v=>{f&&(u.isBeingDeleted=!1),this.layout.sendNotification("error",r==="move"?"Move failed":"Copy failed",u.name,v)}})}})}rename(t,n,r=!1){if(!this.isValidName(n))return Hn;let a={dstDirectory:t.path.split("/").slice(0,-1).join("/")||".",dstName:n,overwrite:r};return this.http.request(L.MOVE,t.dataUrl,{body:a})}delete(t){for(let n of t)n.isBeingDeleted=!0,this.http.delete(n.taskUrl).subscribe({next:r=>this.filesTasksService.addTask(r),error:r=>{n.isBeingDeleted=!1,this.layout.sendNotification("error","Deletion failed",n.name,r)}})}make(t,n,r=null,s=!1){if(!this.isValidName(n))return;r=r||this.currentRoute;let a={type:t};if(s)return this.http.post(`${on}/${r}/${n}`,a);this.http.post(`${on}/${r}/${n}`,a).subscribe({next:()=>this.store.filesOnEvent.next({filePath:r,fileName:n,focus:!0,reload:!0}),error:l=>this.layout.sendNotification("error","Creation failed",n,l)})}compress(t){let n=this.currentRoute;this.http.post(`${xo}/${n}/${t.name}.${t.extension}`,t).subscribe({next:r=>this.filesTasksService.addTask(r),error:r=>this.layout.sendNotification("error","Compression failed",t.name,r)})}decompress(t){let n=this.currentRoute;this.http.post(`${Mo}/${n}/${t.name}`,null).subscribe({next:r=>this.filesTasksService.addTask(r),error:r=>this.layout.sendNotification("error","Compression failed",t.name,r)})}downloadFromUrl(t,n){if(!this.isValidName(n))return;let r=this.currentRoute,s={url:t};this.http.post(`${So}/${r}/${n}`,s).subscribe({next:a=>this.filesTasksService.addTask(a),error:a=>this.layout.sendNotification("error","Download failed",t,a)})}downloadTaskArchive(t){Xi(`${ko}/${t}`)}loadRecents(t){this.http.get(wo,{params:new $t().set("limit",t)}).pipe(Ze(n=>n.map(r=>new Vi(r)))).subscribe({next:n=>{this.store.filesRecents.update(r=>[...n,...r.slice(t)])},error:n=>this.layout.sendNotification("error","Files","Unable to load",n)})}search(t){return this.http.request("search",Lo,{body:t}).pipe(Ze(n=>n.map(r=>(r.content&&(r.content=this.sanitizer.bypassSecurityTrustHtml(r.content)),new Ni(r)))))}lock(t){return this.http.request(L.LOCK,t.dataUrl)}unlock(t,n=!1){let r=n?new $t().set(Co,"true"):null;return this.http.request(L.UNLOCK,t.dataUrl,{params:r})}unlockRequest(t){return this.http.request(L.UNLOCK,`${ut}/${L.UNLOCK_REQUEST}/${t.path}`)}getSize(t){return this.http.get(`${ut}/${L.GET_SIZE}/${t.path}`).pipe(Ze(n=>n.size))}openLockDialog(t){this.layout.openDialog(Do,null,{initialState:{file:t}})}openOverwriteDialog(t,n){return B(this,null,function*(){let r=this.layout.openDialog(Fo,null,{initialState:{files:t,renamedTo:n}});return new Promise(s=>{let a=!1,l=r.content.overwrite.subscribe(g=>{a=!0,u(),s(g)}),f=r.onHidden?.subscribe(()=>{a||(u(),s(!1))}),u=()=>{l.unsubscribe(),f?.unsubscribe()}})})}openSelectViewerDialog(t,n){return B(this,null,function*(){let r=this.layout.openDialog(g1,null,{initialState:{file:t,editorProvider:n}});return new Promise(s=>{let a=r.onHidden?.subscribe(()=>{l(),s(null)}),l=()=>{a?.unsubscribe()}})})}openViewerDialog(t,n,r){return B(this,null,function*(){this.http.head(t.dataUrl).subscribe({next:()=>B(this,null,function*(){let s=!t?.lock?.isExclusive&&r.includes(zr.MODIFY),a=s?Le.EDIT:Le.VIEW,l;try{l=yield this.viewerHook(t,s),t?.lock?.isExclusive&&this.layout.sendNotification("info","The file is locked",Te(t.lock))}catch{this.download(t);return}let f={collabora:!1,onlyoffice:!1};if(l===Pe.DOCUMENT)if(this.store.server().fileEditors.collabora&&this.store.server().fileEditors.onlyoffice){let u=zo.has(t.getExtension()),g=Po.has(t.getExtension());if(u&&g){let v=this.userService.getEditorProviderPreference();if(v&&v in f)f[v]=!0;else if(yield this.openSelectViewerDialog(t,f),!f.onlyoffice&&!f.collabora)return}else f.collabora=u,f.onlyoffice=g}else f.collabora=this.store.server().fileEditors.collabora,f.onlyoffice=this.store.server().fileEditors.onlyoffice;this.layout.openDialog(u1,"full",{id:t.id,initialState:{currentFile:t,directoryFiles:n,mode:a,isWriteable:s,hookedShortMime:l,editorProvider:f}})}),error:s=>{this.layout.sendNotification("error","Unable to open document",t?.name,s)}})})}viewerHook(t,n=!1){return B(this,null,function*(){if(n&&t.shortMime===Pe.PDF&&t.isEditable)return Pe.DOCUMENT;if(t.shortMime===Pe.TEXT){if(t.size<Ur)return Pe.TEXT;throw new Error("No editor found")}return t.shortMime})}isValidName(t){try{return Pr(t),!0}catch(n){return this.layout.sendNotification("error","Rename",`${this.layout.translateString(n.message)} : ${_r}`),!1}}};i.\u0275fac=function(n){return new(n||i)},i.\u0275prov=J({token:i,factory:i.\u0275fac,providedIn:"root"});let e=i;return e})();export{L as a,ut as b,n2 as c,an as d,Eo as e,zo as f,_o as g,Po as h,Ao as i,To as j,Go as k,Ee as l,Oi as m,f1 as n,O6 as o,N6 as p,V6 as q,h1 as r,B6 as s,H6 as t,m1 as u,U6 as v,G6 as w,W6 as x,$6 as y,ht as z};
@@ -0,0 +1 @@
1
+ import{A as De,B as z,C as Re,D as A,E as ie,N as Pe,P as ne,a as Ce,c as w,d as ee,e as S,f as H,i as v,j as te,k as V,ka as $,l as q,n as Se,o as I,oa as Le,p as Ie,q as K,s as Te,t as Oe,u as Ae,y as Ee,z as B}from"./chunk-OK5K5CYJ.js";import{a as k,b as M}from"./chunk-KAVP6UXH.js";var Q=class{constructor(e,t,n,o){this.state=e,this.pos=t,this.explicit=n,this.view=o,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=$(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),o=t.text.slice(n-t.from,this.pos-t.from),s=o.search(je(e,!1));return s<0?null:{from:n+s,to:this.pos,text:o.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function ke(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Xe(i){let e=Object.create(null),t=Object.create(null);for(let{label:o}of i){e[o[0]]=!0;for(let s=1;s<o.length;s++)t[o[s]]=!0}let n=ke(e)+ke(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function Ge(i){let e=i.map(o=>typeof o=="string"?{label:o}:o),[t,n]=e.every(o=>/^\w+$/.test(o.label))?[/\w*$/,/\w+$/]:Xe(e);return o=>{let s=o.matchBefore(n);return s||o.explicit?{from:s?s.from:o.pos,options:e,validFor:t}:null}}function jt(i,e){return t=>{for(let n=$(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(i.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}var X=class{constructor(e,t,n,o){this.completion=e,this.source=t,this.match=n,this.score=o}};function D(i){return i.selection.main.from}function je(i,e){var t;let{source:n}=i,o=e&&n[0]!="^",s=n[n.length-1]!="$";return!o&&!s?i:new RegExp(`${o?"^":""}(?:${n})${s?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}var ge=Se.define();function Je(i,e,t,n){let{main:o}=i.selection,s=t-o.from,l=n-o.from;return M(k({},i.changeByRange(a=>{if(a!=o&&t!=n&&i.sliceDoc(a.from+s,a.from+l)!=i.sliceDoc(t,n))return{range:a};let r=i.toText(e);return{changes:{from:a.from+s,to:n==o.from?a.to:a.from+l,insert:r},range:v.cursor(a.from+s+r.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}var Me=new WeakMap;function Ze(i){if(!Array.isArray(i))return i;let e=Me.get(i);return e||Me.set(i,e=Ge(i)),e}var G=I.define(),F=I.define(),re=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=w(e,t),o=S(n);this.chars.push(n);let s=e.slice(t,t+o),l=s.toUpperCase();this.folded.push(w(l==s?s.toLowerCase():l,0)),t+=o}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:o,precise:s,byWord:l}=this;if(t.length==1){let d=w(e,0),R=S(d),C=R==e.length?0:-100;if(d!=t[0])if(d==n[0])C+=-200;else return null;return this.ret(C,[0,R])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let r=t.length,h=0;if(a<0){for(let d=0,R=Math.min(e.length,200);d<R&&h<r;){let C=w(e,d);(C==t[h]||C==n[h])&&(o[h++]=d),d+=S(C)}if(h<r)return null}let c=0,f=0,u=!1,p=0,m=-1,y=-1,L=/[a-z]/.test(e),O=!0;for(let d=0,R=Math.min(e.length,200),C=0;d<R&&f<r;){let b=w(e,d);a<0&&(c<r&&b==t[c]&&(s[c++]=d),p<r&&(b==t[p]||b==n[p]?(p==0&&(m=d),y=d+1,p++):p=0));let j,_=b<255?b>=48&&b<=57||b>=97&&b<=122?2:b>=65&&b<=90?1:0:(j=ee(b))!=j.toLowerCase()?1:j!=j.toUpperCase()?2:0;(!d||_==1&&L||C==0&&_!=0)&&(t[f]==b||n[f]==b&&(u=!0)?l[f++]=d:l.length&&(O=!1)),C=_,d+=S(b)}return f==r&&l[0]==0&&O?this.result(-100+(u?-200:0),l,e):p==r&&m==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==r?this.ret(-900-e.length,[m,y]):f==r?this.result(-100+(u?-200:0)+-700+(O?0:-1100),l,e):t.length==2?null:this.result((o[0]?-700:0)+-200+-1100,o,e)}result(e,t,n){let o=[],s=0;for(let l of t){let a=l+(this.astral?S(w(n,l)):1);s&&o[s-1]==l?o[s-1]=a:(o[s++]=l,o[s++]=a)}return this.ret(e-n.length,o)}},ae=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},g=te.define({combine(i){return Te(i,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:_e,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>Be(e(n),t(n)),optionClass:(e,t)=>n=>Be(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Be(i,e){return i?e?i+" "+e:i:e}function _e(i,e,t,n,o,s){let l=i.textDirection==De.RTL,a=l,r=!1,h="top",c,f,u=e.left-o.left,p=o.right-e.right,m=n.right-n.left,y=n.bottom-n.top;if(a&&u<Math.min(m,p)?a=!1:!a&&p<Math.min(m,u)&&(a=!0),m<=(a?u:p))c=Math.max(o.top,Math.min(t.top,o.bottom-y))-e.top,f=Math.min(400,a?u:p);else{r=!0,f=Math.min(400,(l?e.right:o.right-e.left)-30);let d=o.bottom-e.bottom;d>=y||d>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let L=(e.bottom-e.top)/s.offsetHeight,O=(e.right-e.left)/s.offsetWidth;return{style:`${h}: ${c/L}px; max-width: ${f/O}px`,class:"cm-completionInfo-"+(r?l?"left-narrow":"right-narrow":a?"left":"right")}}var ye=I.define();function et(i){let e=i.addToOptions.slice();return i.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(o=>"cm-completionIcon-"+o)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,o,s){let l=document.createElement("span");l.className="cm-completionLabel";let a=t.displayLabel||t.label,r=0;for(let h=0;h<s.length;){let c=s[h++],f=s[h++];c>r&&l.appendChild(document.createTextNode(a.slice(r,c)));let u=l.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(a.slice(c,f))),u.className="cm-completionMatchedText",r=f}return r<a.length&&l.appendChild(document.createTextNode(a.slice(r))),l},position:50},{render(t){if(!t.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=t.detail,n},position:80}),e.sort((t,n)=>t.position-n.position).map(t=>t.render)}function oe(i,e,t){if(i<=t)return{from:0,to:i};if(e<0&&(e=0),e<=i>>1){let o=Math.floor(e/t);return{from:o*t,to:(o+1)*t}}let n=Math.floor((i-e)/t);return{from:i-(n+1)*t,to:i-n*t}}var ce=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:r=>this.placeInfo(r),key:this},this.space=null,this.currentClass="";let o=e.state.field(t),{options:s,selected:l}=o.open,a=e.state.facet(g);this.optionContent=et(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=oe(s.length,l,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",r=>{let{options:h}=e.state.field(t).open;for(let c=r.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]<h.length){this.applyCompletion(e,h[+f[1]]),r.preventDefault();return}if(r.target==this.list){let c=this.list.classList.contains("cm-completionListIncompleteTop")&&r.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&r.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:ye.of(c)}),r.preventDefault())}}),this.dom.addEventListener("focusout",r=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(g).closeOnBlur&&r.relatedTarget!=e.contentDOM&&e.dispatch({effects:F.of(null)})}),this.showOptions(s,o.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),o=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=o){let{options:s,selected:l,disabled:a}=n.open;(!o.open||o.open.options!=s)&&(this.range=oe(s.length,l,e.state.facet(g).maxRenderedOptions),this.showOptions(s,n.id)),this.updateSel(),a!=((t=o.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=oe(t.options.length,t.selected,this.view.state.facet(g).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:o}=t.options[t.selected],{info:s}=o;if(!s)return;let l=typeof s=="string"?document.createTextNode(s):s(o);if(!l)return;"then"in l?l.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,o)}).catch(a=>z(this.view.state,a,"completion info")):(this.addInfoPane(l,o),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:o,destroy:s}=e;n.appendChild(o),this.infoDestroy=s||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,o=this.range.from;n;n=n.nextSibling,o++)n.nodeName!="LI"||!n.id?o--:o==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return t&&it(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),o=e.getBoundingClientRect(),s=this.space;if(!s){let l=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight}}return o.top>Math.min(s.bottom,t.bottom)-10||o.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(g).positionInfo(this.view,t,o,n,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){let o=document.createElement("ul");o.id=t,o.setAttribute("role","listbox"),o.setAttribute("aria-expanded","true"),o.setAttribute("aria-label",this.view.state.phrase("Completions")),o.addEventListener("mousedown",l=>{l.target==o&&l.preventDefault()});let s=null;for(let l=n.from;l<n.to;l++){let{completion:a,match:r}=e[l],{section:h}=a;if(h){let u=typeof h=="string"?h:h.name;if(u!=s&&(l>n.from||n.from==0))if(s=u,typeof h!="string"&&h.header)o.appendChild(h.header(h));else{let p=o.appendChild(document.createElement("completion-section"));p.textContent=u}}let c=o.appendChild(document.createElement("li"));c.id=t+"-"+l,c.setAttribute("role","option");let f=this.optionClass(a);f&&(c.className=f);for(let u of this.optionContent){let p=u(a,this.view.state,this.view,r);p&&c.appendChild(p)}}return n.from&&o.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&o.classList.add("cm-completionListIncompleteBottom"),o}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}};function tt(i,e){return t=>new ce(t,i,e)}function it(i,e){let t=i.getBoundingClientRect(),n=e.getBoundingClientRect(),o=t.height/i.offsetHeight;n.top<t.top?i.scrollTop-=(t.top-n.top)/o:n.bottom>t.bottom&&(i.scrollTop+=(n.bottom-t.bottom)/o)}function $e(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function nt(i,e){let t=[],n=null,o=null,s=c=>{t.push(c);let{section:f}=c.completion;if(f){n||(n=[]);let u=typeof f=="string"?f:f.name;n.some(p=>p.name==u)||n.push(typeof f=="string"?{name:u}:f)}},l=e.facet(g);for(let c of i)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let u of c.result.options)s(new X(u,c.source,f?f(u):[],1e9-t.length));else{let u=e.sliceDoc(c.from,c.to),p,m=l.filterStrict?new ae(u):new re(u);for(let y of c.result.options)if(p=m.match(y.label)){let L=y.displayLabel?f?f(y,p.matched):[]:p.matched,O=p.score+(y.boost||0);if(s(new X(y,c.source,L,O)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:d}=y.section;o||(o=Object.create(null)),o[d]=Math.max(O,o[d]||-1e9)}}}}if(n){let c=Object.create(null),f=0,u=(p,m)=>(p.rank==="dynamic"&&m.rank==="dynamic"?o[m.name]-o[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(p.name<m.name?-1:1);for(let p of n.sort(u))f-=1e5,c[p.name]=f;for(let p of t){let{section:m}=p.completion;m&&(p.score+=c[typeof m=="string"?m:m.name])}}let a=[],r=null,h=l.compareCompletions;for(let c of t.sort((f,u)=>u.score-f.score||h(f.completion,u.completion))){let f=c.completion;!r||r.label!=f.label||r.detail!=f.detail||r.type!=null&&f.type!=null&&r.type!=f.type||r.apply!=f.apply||r.boost!=f.boost?a.push(c):$e(c.completion)>$e(r)&&(a[a.length-1]=c),r=c.completion}return a}var fe=class i{constructor(e,t,n,o,s,l){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=o,this.selected=s,this.disabled=l}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new i(this.options,Fe(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,o,s,l){if(o&&!l&&e.some(h=>h.isPending))return o.setDisabled();let a=nt(e,t);if(!a.length)return o&&e.some(h=>h.isPending)?o.setDisabled():null;let r=t.facet(g).selectOnOpen?0:-1;if(o&&o.selected!=r&&o.selected!=-1){let h=o.options[o.selected].completion;for(let c=0;c<a.length;c++)if(a[c].completion==h){r=c;break}}return new i(a,Fe(n,r),{pos:e.reduce((h,c)=>c.hasResult()?Math.min(h,c.from):h,1e8),create:ct,above:s.aboveCursor},o?o.timestamp:Date.now(),r,!1)}map(e){return new i(this.options,this.attrs,M(k({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new i(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},he=class i{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new i(rt,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(g),s=(n.override||t.languageDataAt("autocomplete",D(t)).map(Ze)).map(r=>(this.active.find(c=>c.source==r)||new T(r,this.active.some(c=>c.state!=0)?1:0)).update(e,n));s.length==this.active.length&&s.every((r,h)=>r==this.active[h])&&(s=this.active);let l=this.open,a=e.effects.some(r=>r.is(be));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||s.some(r=>r.hasResult()&&e.changes.touchesRange(r.from,r.to))||!ot(s,this.active)||a?l=fe.build(s,t,this.id,l,n,a):l&&l.disabled&&!s.some(r=>r.isPending)&&(l=null),!l&&s.every(r=>!r.isPending)&&s.some(r=>r.hasResult())&&(s=s.map(r=>r.hasResult()?new T(r.source,0):r));for(let r of e.effects)r.is(ye)&&(l=l&&l.setSelected(r.value,this.id));return s==this.active&&l==this.open?this:new i(s,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?st:lt}};function ot(i,e){if(i==e)return!0;for(let t=0,n=0;;){for(;t<i.length&&!i[t].hasResult();)t++;for(;n<e.length&&!e[n].hasResult();)n++;let o=t==i.length,s=n==e.length;if(o||s)return o==s;if(i[t++].result!=e[n++].result)return!1}}var st={"aria-autocomplete":"list"},lt={};function Fe(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}var rt=[];function He(i,e){if(i.isUserEvent("input.complete")){let n=i.annotation(ge);if(n&&e.activateOnCompletion(n))return 12}let t=i.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:i.isUserEvent("delete.backward")?2:i.selection?8:i.docChanged?16:0}var T=class i{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let n=He(e,t),o=this;(n&8||n&16&&this.touches(e))&&(o=new i(o.source,0)),n&4&&o.state==0&&(o=new i(this.source,1)),o=o.updateFor(e,n);for(let s of e.effects)if(s.is(G))o=new i(o.source,1,s.value);else if(s.is(F))o=new i(o.source,0);else if(s.is(be))for(let l of s.value)l.source==o.source&&(o=l);return o}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(D(e.state))}},J=class i extends T{constructor(e,t,n,o,s,l){super(e,3,t),this.limit=n,this.result=o,this.from=s,this.to=l}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let o=this.result;o.map&&!e.changes.empty&&(o=o.map(o,e.changes));let s=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),a=D(e.state);if(a>l||!o||t&2&&(D(e.startState)==this.from||a<this.limit))return new T(this.source,t&4?1:0);let r=e.changes.mapPos(this.limit);return at(o.validFor,e.state,s,l)?new i(this.source,this.explicit,r,o,s,l):o.update&&(o=o.update(o,s,l,new Q(e.state,a,!1)))?new i(this.source,this.explicit,r,o,o.from,(n=o.to)!==null&&n!==void 0?n:D(e.state)):new T(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new i(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new T(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function at(i,e,t,n){if(!i)return!1;let o=e.sliceDoc(t,n);return typeof i=="function"?i(o,t,n,e):je(i,!0).test(o)}var be=I.define({map(i,e){return i.map(t=>t.map(e))}}),x=V.define({create(){return he.start()},update(i,e){return i.update(e)},provide:i=>[Pe.from(i,e=>e.tooltip),A.contentAttributes.from(i,e=>e.attrs)]});function xe(i,e){let t=e.completion.apply||e.completion.label,n=i.state.field(x).active.find(o=>o.source==e.source);return n instanceof J?(typeof t=="string"?i.dispatch(M(k({},Je(i.state,t,n.from,n.to)),{annotations:ge.of(e.completion)})):t(i,e.completion,n.from,n.to),!0):!1}var ct=tt(x,xe);function Y(i,e="option"){return t=>{let n=t.state.field(x,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(g).interactionDelay)return!1;let o=1,s;e=="page"&&(s=ne(t,n.open.tooltip))&&(o=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:l}=n.open.options,a=n.open.selected>-1?n.open.selected+o*(i?1:-1):i?0:l-1;return a<0?a=e=="page"?0:l-1:a>=l&&(a=e=="page"?l-1:0),t.dispatch({effects:ye.of(a)}),!0}}var ft=i=>{let e=i.state.field(x,!1);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<i.state.facet(g).interactionDelay?!1:xe(i,e.open.options[e.open.selected])},se=i=>i.state.field(x,!1)?(i.dispatch({effects:G.of(!0)}),!0):!1,ht=i=>{let e=i.state.field(x,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:F.of(null)}),!0)},ue=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},ut=50,pt=1e3,dt=Re.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of i.state.field(x).active)e.isPending&&this.startQuery(e)}update(i){let e=i.state.field(x),t=i.state.facet(g);if(!i.selectionSet&&!i.docChanged&&i.startState.field(x)==e)return;let n=i.transactions.some(s=>{let l=He(s,t);return l&8||(s.selection||s.docChanged)&&!(l&3)});for(let s=0;s<this.running.length;s++){let l=this.running[s];if(n||l.context.abortOnDocChange&&i.docChanged||l.updates.length+i.transactions.length>ut&&Date.now()-l.time>pt){for(let a of l.context.abortListeners)try{a()}catch(r){z(this.view.state,r)}l.context.abortListeners=null,this.running.splice(s--,1)}else l.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(s=>s.effects.some(l=>l.is(G)))&&(this.pendingStart=!0);let o=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(l=>l.active.source==s.source))?setTimeout(()=>this.startUpdate(),o):-1,this.composing!=0)for(let s of i.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,e=i.field(x);for(let t of e.active)t.isPending&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(g).updateSyncTime))}startQuery(i){let{state:e}=this.view,t=D(e),n=new Q(e,t,i.explicit,this.view),o=new ue(i,n);this.running.push(o),Promise.resolve(i.source(n)).then(s=>{o.context.aborted||(o.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:F.of(null)}),z(this.view.state,s)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(g).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(g),n=this.view.state.field(x);for(let o=0;o<this.running.length;o++){let s=this.running[o];if(s.done===void 0)continue;if(this.running.splice(o--,1),s.done){let a=D(s.updates.length?s.updates[0].startState:this.view.state),r=Math.min(a,s.done.from+(s.active.explicit?0:1)),h=new J(s.active.source,s.active.explicit,r,s.done,s.done.from,(i=s.done.to)!==null&&i!==void 0?i:a);for(let c of s.updates)h=h.update(c,t);if(h.hasResult()){e.push(h);continue}}let l=n.active.find(a=>a.source==s.active.source);if(l&&l.isPending)if(s.done==null){let a=new T(s.active.source,0);for(let r of s.updates)a=a.update(r,t);a.isPending||e.push(a)}else this.startQuery(l)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:be.of(e)})}},{eventHandlers:{blur(i){let e=this.view.state.field(x,!1);if(e&&e.tooltip&&this.view.state.facet(g).closeOnBlur){let t=e.open&&ne(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:F.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:G.of(!1)}),20),this.composing=0}}}),mt=typeof navigator=="object"&&/Win/.test(navigator.platform),gt=q.highest(A.domEventHandlers({keydown(i,e){let t=e.state.field(x,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(mt&&i.altKey)||i.metaKey)return!1;let n=t.open.options[t.open.selected],o=t.active.find(l=>l.source==n.source),s=n.completion.commitCharacters||o.result.commitCharacters;return s&&s.indexOf(i.key)>-1&&xe(e,n),!1}})),Ve=A.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),pe=class{constructor(e,t,n,o){this.field=e,this.line=t,this.from=n,this.to=o}},de=class i{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,H.TrackDel),n=e.mapPos(this.to,1,H.TrackDel);return t==null||n==null?null:new i(this.field,t,n)}},me=class i{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],o=[t],s=e.doc.lineAt(t),l=/^\s*/.exec(s.text)[0];for(let r of this.lines){if(n.length){let h=l,c=/^\t*/.exec(r)[0].length;for(let f=0;f<c;f++)h+=e.facet(Le);o.push(t+h.length-c),r=h+r.slice(c)}n.push(r),t+=r.length+1}let a=this.fieldPositions.map(r=>new de(r.field,o[r.line]+r.from,o[r.line]+r.to));return{text:n,ranges:a}}static parse(e){let t=[],n=[],o=[],s;for(let l of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l);){let a=s[1]?+s[1]:null,r=s[2]||s[3]||"",h=-1,c=r.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f<t.length;f++)(a!=null?t[f].seq==a:c&&t[f].name==c)&&(h=f);if(h<0){let f=0;for(;f<t.length&&(a==null||t[f].seq!=null&&t[f].seq<a);)f++;t.splice(f,0,{seq:a,name:c}),h=f;for(let u of o)u.field>=h&&u.field++}for(let f of o)if(f.line==n.length&&f.from>s.index){let u=s[2]?3+(s[1]||"").length:2;f.from-=u,f.to-=u}o.push(new pe(h,n.length,s.index,s.index+c.length)),l=l.slice(0,s.index)+r+l.slice(s.index+s[0].length)}l=l.replace(/\\([{}])/g,(a,r,h)=>{for(let c of o)c.line==n.length&&c.from>h&&(c.from--,c.to--);return r}),n.push(l)}return new i(n,o)}},yt=B.widget({widget:new class extends Ee{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),bt=B.mark({class:"cm-snippetField"}),P=class i{constructor(e,t){this.ranges=e,this.active=t,this.deco=B.set(e.map(n=>(n.from==n.to?yt:bt).range(n.from,n.to)),!0)}map(e){let t=[];for(let n of this.ranges){let o=n.map(e);if(!o)return null;t.push(o)}return new i(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(n=>n.field==this.active&&n.from<=t.from&&n.to>=t.to))}},U=I.define({map(i,e){return i&&i.map(e)}}),xt=I.define(),W=V.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(U))return t.value;if(t.is(xt)&&i)return new P(i.ranges,t.value)}return i&&e.docChanged&&(i=i.map(e.changes)),i&&e.selection&&!i.selectionInsideField(e.selection)&&(i=null),i},provide:i=>A.decorations.from(i,e=>e?e.deco:B.none)});function ve(i,e){return v.create(i.filter(t=>t.field==e).map(t=>v.range(t.from,t.to)))}function vt(i){let e=me.parse(i);return(t,n,o,s)=>{let{text:l,ranges:a}=e.instantiate(t.state,o),{main:r}=t.state.selection,h={changes:{from:o,to:s==r.from?r.to:s,insert:Ce.of(l)},scrollIntoView:!0,annotations:n?[ge.of(n),Ie.userEvent.of("input.complete")]:void 0};if(a.length&&(h.selection=ve(a,0)),a.some(c=>c.field>0)){let c=new P(a,0),f=h.effects=[U.of(c)];t.state.field(W,!1)===void 0&&f.push(I.appendConfig.of([W,Tt,Ot,Ve]))}t.dispatch(t.state.update(h))}}function qe(i){return({state:e,dispatch:t})=>{let n=e.field(W,!1);if(!n||i<0&&n.active==0)return!1;let o=n.active+i,s=i>0&&!n.ranges.some(l=>l.field==o+i);return t(e.update({selection:ve(n.ranges,o),effects:U.of(s?null:new P(n.ranges,o)),scrollIntoView:!0})),!0}}var wt=({state:i,dispatch:e})=>i.field(W,!1)?(e(i.update({effects:U.of(null)})),!0):!1,Ct=qe(1),St=qe(-1);var It=[{key:"Tab",run:Ct,shift:St},{key:"Escape",run:wt}],We=te.define({combine(i){return i.length?i[0]:It}}),Tt=q.highest(ie.compute([We],i=>i.facet(We)));function Ht(i,e){return M(k({},e),{apply:vt(i)})}var Ot=A.domEventHandlers({mousedown(i,e){let t=e.state.field(W,!1),n;if(!t||(n=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let o=t.ranges.find(s=>s.from<=n&&s.to>=n);return!o||o.field==t.active?!1:(e.dispatch({selection:ve(t.ranges,o.field),effects:U.of(t.ranges.some(s=>s.field>o.field)?new P(t.ranges,o.field):null),scrollIntoView:!0}),!0)}});var N={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},E=I.define({map(i,e){let t=e.mapPos(i,-1,H.TrackAfter);return t??void 0}}),we=new class extends Oe{};we.startSide=1;we.endSide=-1;var Ke=V.define({create(){return Ae.empty},update(i,e){if(i=i.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);i=i.update({filter:n=>n>=t.from&&n<=t.to})}for(let t of e.effects)t.is(E)&&(i=i.update({add:[we.range(t.value,t.value+1)]}));return i}});function Vt(){return[Et,Ke]}var le="()[]{}<>\xAB\xBB\xBB\xAB\uFF3B\uFF3D\uFF5B\uFF5D";function ze(i){for(let e=0;e<le.length;e+=2)if(le.charCodeAt(e)==i)return le.charAt(e+1);return ee(i<128?i:i+1)}function Ye(i,e){return i.languageDataAt("closeBrackets",e)[0]||N}var At=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Et=A.inputHandler.of((i,e,t,n)=>{if((At?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let o=i.state.selection.main;if(n.length>2||n.length==2&&S(w(n,0))==1||e!=o.from||t!=o.to)return!1;let s=Rt(i.state,n);return s?(i.dispatch(s),!0):!1}),Dt=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let n=Ye(i,i.selection.main.head).brackets||N.brackets,o=null,s=i.changeByRange(l=>{if(l.empty){let a=Pt(i.doc,l.head);for(let r of n)if(r==a&&Z(i.doc,l.head)==ze(w(r,0)))return{changes:{from:l.head-r.length,to:l.head+r.length},range:v.cursor(l.head-r.length)}}return{range:o=l}});return o||e(i.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!o},qt=[{key:"Backspace",run:Dt}];function Rt(i,e){let t=Ye(i,i.selection.main.head),n=t.brackets||N.brackets;for(let o of n){let s=ze(w(o,0));if(e==o)return s==o?Mt(i,o,n.indexOf(o+o+o)>-1,t):Lt(i,o,s,t.before||N.before);if(e==s&&Qe(i,i.selection.main.from))return kt(i,o,s)}return null}function Qe(i,e){let t=!1;return i.field(Ke).between(0,i.doc.length,n=>{n==e&&(t=!0)}),t}function Z(i,e){let t=i.sliceString(e,e+2);return t.slice(0,S(w(t,0)))}function Pt(i,e){let t=i.sliceString(e-2,e);return S(w(t,0))==t.length?t:t.slice(1)}function Lt(i,e,t,n){let o=null,s=i.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:t,from:l.to}],effects:E.of(l.to+e.length),range:v.range(l.anchor+e.length,l.head+e.length)};let a=Z(i.doc,l.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:e+t,from:l.head},effects:E.of(l.head+e.length),range:v.cursor(l.head+e.length)}:{range:o=l}});return o?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function kt(i,e,t){let n=null,o=i.changeByRange(s=>s.empty&&Z(i.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:v.cursor(s.head+t.length)}:n={range:s});return n?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Mt(i,e,t,n){let o=n.stringPrefixes||N.stringPrefixes,s=null,l=i.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:E.of(a.to+e.length),range:v.range(a.anchor+e.length,a.head+e.length)};let r=a.head,h=Z(i.doc,r),c;if(h==e){if(Ne(i,r))return{changes:{insert:e+e,from:r},effects:E.of(r+e.length),range:v.cursor(r+e.length)};if(Qe(i,r)){let u=t&&i.sliceDoc(r,r+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:r,to:r+u.length,insert:u},range:v.cursor(r+u.length)}}}else{if(t&&i.sliceDoc(r-2*e.length,r)==e+e&&(c=Ue(i,r-2*e.length,o))>-1&&Ne(i,c))return{changes:{insert:e+e+e+e,from:r},effects:E.of(r+e.length),range:v.cursor(r+e.length)};if(i.charCategorizer(r)(h)!=K.Word&&Ue(i,r,o)>-1&&!Bt(i,r,e,o))return{changes:{insert:e+e,from:r},effects:E.of(r+e.length),range:v.cursor(r+e.length)}}return{range:s=a}});return s?null:i.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function Ne(i,e){let t=$(i).resolveInner(e+1);return t.parent&&t.from==e}function Bt(i,e,t,n){let o=$(i).resolveInner(e,-1),s=n.reduce((l,a)=>Math.max(l,a.length),0);for(let l=0;l<5;l++){let a=i.sliceDoc(o.from,Math.min(o.to,o.from+t.length+s)),r=a.indexOf(t);if(!r||r>-1&&n.indexOf(a.slice(0,r))>-1){let c=o.firstChild;for(;c&&c.from==o.from&&c.to-c.from>t.length+r;){if(i.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=o.to==e&&o.parent;if(!h)break;o=h}return!1}function Ue(i,e,t){let n=i.charCategorizer(e);if(n(i.sliceDoc(e-1,e))!=K.Word)return e;for(let o of t){let s=e-o.length;if(i.sliceDoc(s,e)==o&&n(i.sliceDoc(s-1,s))!=K.Word)return s}return-1}function Kt(i={}){return[gt,x,g.of(i),dt,Ft,Ve]}var $t=[{key:"Ctrl-Space",run:se},{mac:"Alt-`",run:se},{mac:"Alt-i",run:se},{key:"Escape",run:ht},{key:"ArrowDown",run:Y(!0)},{key:"ArrowUp",run:Y(!1)},{key:"PageDown",run:Y(!0,"page")},{key:"PageUp",run:Y(!1,"page")},{key:"Enter",run:ft}],Ft=q.highest(ie.computeN([g],i=>i.facet(g).defaultKeymap?[$t]:[]));export{Q as a,Ge as b,jt as c,Ht as d,Vt as e,qt as f,Kt as g,$t as h};