@sync-in/server 1.9.1 → 1.9.6

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 (177) hide show
  1. package/CHANGELOG.md +24 -8
  2. package/package.json +12 -12
  3. package/server/applications/files/interfaces/only-office-config.interface.js.map +1 -1
  4. package/server/applications/files/services/files-manager.service.js +2 -2
  5. package/server/applications/files/services/files-manager.service.js.map +1 -1
  6. package/server/applications/files/services/files-methods.service.spec.js +2 -4
  7. package/server/applications/files/services/files-methods.service.spec.js.map +1 -1
  8. package/server/applications/files/services/files-recents.service.js +4 -0
  9. package/server/applications/files/services/files-recents.service.js.map +1 -1
  10. package/server/applications/files/services/files-scheduler.service.js +23 -4
  11. package/server/applications/files/services/files-scheduler.service.js.map +1 -1
  12. package/server/applications/files/services/files-tasks-manager.service.js +1 -1
  13. package/server/applications/files/services/files-tasks-manager.service.js.map +1 -1
  14. package/server/applications/files/utils/send-file.js +18 -9
  15. package/server/applications/files/utils/send-file.js.map +1 -1
  16. package/server/applications/files/utils/url-file.js +6 -6
  17. package/server/applications/files/utils/url-file.js.map +1 -1
  18. package/server/applications/links/services/links-manager.service.js +1 -1
  19. package/server/applications/links/services/links-manager.service.js.map +1 -1
  20. package/server/applications/shares/interfaces/share-props.interface.js.map +1 -1
  21. package/server/applications/shares/services/shares-manager.service.js +6 -4
  22. package/server/applications/shares/services/shares-manager.service.js.map +1 -1
  23. package/server/applications/spaces/services/spaces-manager.service.js +15 -12
  24. package/server/applications/spaces/services/spaces-manager.service.js.map +1 -1
  25. package/server/applications/spaces/services/spaces-scheduler.service.js +9 -1
  26. package/server/applications/spaces/services/spaces-scheduler.service.js.map +1 -1
  27. package/server/applications/users/services/admin-users-manager.service.js +4 -0
  28. package/server/applications/users/services/admin-users-manager.service.js.map +1 -1
  29. package/server/applications/users/users.controller.js +4 -1
  30. package/server/applications/users/users.controller.js.map +1 -1
  31. package/static/assets/pdfjs/build/pdf.mjs +35 -20
  32. package/static/assets/pdfjs/build/pdf.mjs.map +1 -1
  33. package/static/assets/pdfjs/build/pdf.sandbox.mjs +2 -2
  34. package/static/assets/pdfjs/build/pdf.worker.mjs +1488 -52
  35. package/static/assets/pdfjs/build/pdf.worker.mjs.map +1 -1
  36. package/static/assets/pdfjs/version +1 -1
  37. package/static/assets/pdfjs/web/locale/be/viewer.ftl +2 -12
  38. package/static/assets/pdfjs/web/locale/bg/viewer.ftl +4 -0
  39. package/static/assets/pdfjs/web/locale/bs/viewer.ftl +0 -15
  40. package/static/assets/pdfjs/web/locale/ca/viewer.ftl +0 -4
  41. package/static/assets/pdfjs/web/locale/cs/viewer.ftl +4 -14
  42. package/static/assets/pdfjs/web/locale/cy/viewer.ftl +2 -12
  43. package/static/assets/pdfjs/web/locale/da/viewer.ftl +2 -12
  44. package/static/assets/pdfjs/web/locale/de/viewer.ftl +0 -12
  45. package/static/assets/pdfjs/web/locale/dsb/viewer.ftl +0 -12
  46. package/static/assets/pdfjs/web/locale/el/viewer.ftl +2 -12
  47. package/static/assets/pdfjs/web/locale/en-CA/viewer.ftl +0 -12
  48. package/static/assets/pdfjs/web/locale/en-GB/viewer.ftl +0 -12
  49. package/static/assets/pdfjs/web/locale/eo/viewer.ftl +2 -12
  50. package/static/assets/pdfjs/web/locale/es-AR/viewer.ftl +0 -12
  51. package/static/assets/pdfjs/web/locale/es-CL/viewer.ftl +2 -12
  52. package/static/assets/pdfjs/web/locale/es-ES/viewer.ftl +2 -12
  53. package/static/assets/pdfjs/web/locale/es-MX/viewer.ftl +0 -12
  54. package/static/assets/pdfjs/web/locale/eu/viewer.ftl +0 -12
  55. package/static/assets/pdfjs/web/locale/fi/viewer.ftl +0 -12
  56. package/static/assets/pdfjs/web/locale/fr/viewer.ftl +0 -12
  57. package/static/assets/pdfjs/web/locale/fur/viewer.ftl +0 -12
  58. package/static/assets/pdfjs/web/locale/fy-NL/viewer.ftl +0 -12
  59. package/static/assets/pdfjs/web/locale/gn/viewer.ftl +2 -12
  60. package/static/assets/pdfjs/web/locale/he/viewer.ftl +0 -12
  61. package/static/assets/pdfjs/web/locale/hsb/viewer.ftl +0 -12
  62. package/static/assets/pdfjs/web/locale/hu/viewer.ftl +0 -12
  63. package/static/assets/pdfjs/web/locale/hy-AM/viewer.ftl +0 -15
  64. package/static/assets/pdfjs/web/locale/ia/viewer.ftl +0 -12
  65. package/static/assets/pdfjs/web/locale/id/viewer.ftl +0 -15
  66. package/static/assets/pdfjs/web/locale/is/viewer.ftl +0 -15
  67. package/static/assets/pdfjs/web/locale/it/viewer.ftl +2 -14
  68. package/static/assets/pdfjs/web/locale/ja/viewer.ftl +7 -2
  69. package/static/assets/pdfjs/web/locale/ka/viewer.ftl +0 -12
  70. package/static/assets/pdfjs/web/locale/kab/viewer.ftl +0 -12
  71. package/static/assets/pdfjs/web/locale/kk/viewer.ftl +3 -12
  72. package/static/assets/pdfjs/web/locale/ko/viewer.ftl +0 -12
  73. package/static/assets/pdfjs/web/locale/nb-NO/viewer.ftl +2 -12
  74. package/static/assets/pdfjs/web/locale/nl/viewer.ftl +0 -12
  75. package/static/assets/pdfjs/web/locale/nn-NO/viewer.ftl +0 -12
  76. package/static/assets/pdfjs/web/locale/pa-IN/viewer.ftl +4 -12
  77. package/static/assets/pdfjs/web/locale/pl/viewer.ftl +2 -12
  78. package/static/assets/pdfjs/web/locale/pt-BR/viewer.ftl +2 -12
  79. package/static/assets/pdfjs/web/locale/rm/viewer.ftl +0 -12
  80. package/static/assets/pdfjs/web/locale/ro/viewer.ftl +2 -14
  81. package/static/assets/pdfjs/web/locale/ru/viewer.ftl +0 -12
  82. package/static/assets/pdfjs/web/locale/sc/viewer.ftl +0 -1
  83. package/static/assets/pdfjs/web/locale/sk/viewer.ftl +0 -12
  84. package/static/assets/pdfjs/web/locale/sl/viewer.ftl +2 -12
  85. package/static/assets/pdfjs/web/locale/sq/viewer.ftl +2 -12
  86. package/static/assets/pdfjs/web/locale/sv-SE/viewer.ftl +0 -12
  87. package/static/assets/pdfjs/web/locale/tg/viewer.ftl +2 -12
  88. package/static/assets/pdfjs/web/locale/th/viewer.ftl +0 -12
  89. package/static/assets/pdfjs/web/locale/tr/viewer.ftl +2 -12
  90. package/static/assets/pdfjs/web/locale/vi/viewer.ftl +0 -12
  91. package/static/assets/pdfjs/web/locale/zh-CN/viewer.ftl +2 -12
  92. package/static/assets/pdfjs/web/locale/zh-TW/viewer.ftl +0 -12
  93. package/static/assets/pdfjs/web/viewer.css +53 -41
  94. package/static/assets/pdfjs/web/viewer.html +493 -132
  95. package/static/assets/pdfjs/web/viewer.mjs +225 -150
  96. package/static/assets/pdfjs/web/viewer.mjs.map +1 -1
  97. package/static/{chunk-LYZGJZNP.js → chunk-25PWAXTJ.js} +1 -1
  98. package/static/{chunk-YMAN4LIU.js → chunk-2CAAJBRO.js} +1 -1
  99. package/static/{chunk-GRLHFXGB.js → chunk-2F42MZQ5.js} +1 -1
  100. package/static/{chunk-6B3GGAV3.js → chunk-2U5VKTML.js} +1 -1
  101. package/static/{chunk-HKRGIRKB.js → chunk-3AR5VNJE.js} +1 -1
  102. package/static/chunk-3WS72A6C.js +1 -0
  103. package/static/chunk-4GBA6EJ4.js +1 -0
  104. package/static/{chunk-FNOTGWRW.js → chunk-4ZKAVMB4.js} +1 -1
  105. package/static/{chunk-XQGPSNQB.js → chunk-5ATJIR5S.js} +1 -1
  106. package/static/{chunk-HMOB6XC5.js → chunk-5GIWZKNS.js} +1 -1
  107. package/static/{chunk-ZCOWBVOT.js → chunk-5HYSNQR4.js} +1 -1
  108. package/static/{chunk-BHZEPHRI.js → chunk-5KVI243T.js} +1 -1
  109. package/static/{chunk-Q556XB3S.js → chunk-5NFH4E2B.js} +1 -1
  110. package/static/{chunk-XCLK7NJL.js → chunk-7H5O4BLV.js} +1 -1
  111. package/static/{chunk-RDNTK4YH.js → chunk-7HL5Z6PF.js} +1 -1
  112. package/static/{chunk-V6FA5QY4.js → chunk-7QYALK5T.js} +1 -1
  113. package/static/{chunk-GNZPP2VO.js → chunk-ANH4VNOS.js} +1 -1
  114. package/static/{chunk-EIYRBM4J.js → chunk-AYYJZMBE.js} +1 -1
  115. package/static/chunk-B2A4HNDC.js +1 -0
  116. package/static/{chunk-NOPACN4F.js → chunk-B4TDS6AQ.js} +1 -1
  117. package/static/chunk-BJARRIS6.js +562 -0
  118. package/static/{chunk-PXRT4L57.js → chunk-BVKDW5XO.js} +1 -1
  119. package/static/{chunk-7CKHC72R.js → chunk-BX3QZ7IL.js} +1 -1
  120. package/static/{chunk-MIA5YBOI.js → chunk-C5T7RZSD.js} +1 -1
  121. package/static/{chunk-ACUF7IKP.js → chunk-CHMDM2ZW.js} +1 -1
  122. package/static/{chunk-U4RW6XG5.js → chunk-CUC7R6C2.js} +1 -1
  123. package/static/{chunk-XOF4UW3S.js → chunk-D6QWQHWE.js} +1 -1
  124. package/static/{chunk-6NEBGCAZ.js → chunk-DK2LAJEL.js} +1 -1
  125. package/static/{chunk-C3AAEQKW.js → chunk-DQAQUSVW.js} +1 -1
  126. package/static/{chunk-NN4ONTOT.js → chunk-DU4Q4RWJ.js} +1 -1
  127. package/static/{chunk-M4XL3JN5.js → chunk-E5C4QRNQ.js} +2 -2
  128. package/static/{chunk-BU4ZICZR.js → chunk-EPDWJEPD.js} +1 -1
  129. package/static/{chunk-I2S3XPC5.js → chunk-FCR5AEHR.js} +2 -2
  130. package/static/{chunk-4PZPHJ7L.js → chunk-FEQUP26G.js} +1 -1
  131. package/static/{chunk-ZXXHFBGL.js → chunk-FSGT46LM.js} +1 -1
  132. package/static/{chunk-QMHUIHSR.js → chunk-GENTF6JM.js} +1 -1
  133. package/static/{chunk-DQ3GEMPM.js → chunk-GLPKRULI.js} +1 -1
  134. package/static/{chunk-AZ5TF5Y3.js → chunk-GRV44RYI.js} +1 -1
  135. package/static/{chunk-JY2I3HGL.js → chunk-GYYJ4FWN.js} +1 -1
  136. package/static/{chunk-ERDZ7IVF.js → chunk-HB5DC7RJ.js} +1 -1
  137. package/static/{chunk-DJDRX53V.js → chunk-HLKZCMKV.js} +1 -1
  138. package/static/{chunk-HNMGPG72.js → chunk-IBC7CFBQ.js} +1 -1
  139. package/static/{chunk-5E3TYOL3.js → chunk-IIKL33TV.js} +1 -1
  140. package/static/{chunk-TGLJFALR.js → chunk-JYHTSSKW.js} +1 -1
  141. package/static/{chunk-VQJYCYWI.js → chunk-KAAFVHYE.js} +1 -1
  142. package/static/{chunk-VK7XMFVE.js → chunk-KWKZN53T.js} +1 -1
  143. package/static/{chunk-KDEEERWZ.js → chunk-LBXOAKBD.js} +1 -1
  144. package/static/{chunk-Y5RLD72B.js → chunk-LFAQLJZK.js} +1 -1
  145. package/static/chunk-MGMDT4VN.js +1 -0
  146. package/static/chunk-MWUUM2NK.js +13 -0
  147. package/static/{chunk-JMYAD7E2.js → chunk-NHMYAVJK.js} +1 -1
  148. package/static/{chunk-HHWXIK2M.js → chunk-NQCKX2AD.js} +1 -1
  149. package/static/{chunk-HCSWO7BO.js → chunk-O233BXWK.js} +1 -1
  150. package/static/{chunk-2TB2INBF.js → chunk-ODAQRAPO.js} +1 -1
  151. package/static/{chunk-RK2ONYTL.js → chunk-OVUMPMVM.js} +1 -1
  152. package/static/chunk-Q6B4OVER.js +5 -0
  153. package/static/{chunk-3YDYZLF7.js → chunk-QKMN3S4M.js} +1 -1
  154. package/static/{chunk-23UUFZSR.js → chunk-QUUQOBTF.js} +1 -1
  155. package/static/chunk-QV5LQKTS.js +1 -0
  156. package/static/{chunk-NKGKBQBX.js → chunk-S4UTSOPV.js} +1 -1
  157. package/static/{chunk-5S6KPQRA.js → chunk-SF6Q6VRC.js} +1 -1
  158. package/static/{chunk-BODMMLVB.js → chunk-TOCCCZP2.js} +1 -1
  159. package/static/{chunk-3WLBVJ2S.js → chunk-UO7ATVQG.js} +1 -1
  160. package/static/{chunk-AADK5D2H.js → chunk-X5UDV4ZB.js} +1 -1
  161. package/static/{chunk-S2VBGI6Q.js → chunk-XIQXRSZ2.js} +1 -1
  162. package/static/chunk-YYTDPI5S.js +1 -0
  163. package/static/{chunk-EL6QL4TP.js → chunk-Z2KBIZ5D.js} +1 -1
  164. package/static/{chunk-K657XPXA.js → chunk-ZCOEP4O2.js} +1 -1
  165. package/static/index.html +2 -2
  166. package/static/main-ODUA232E.js +11 -0
  167. package/static/{styles-Q4OZOSSK.css → styles-S5HVK4H5.css} +1 -1
  168. package/static/chunk-5XUIPWOH.js +0 -1
  169. package/static/chunk-EDJAISWO.js +0 -13
  170. package/static/chunk-H6WOTGQ5.js +0 -1
  171. package/static/chunk-HC7F57NA.js +0 -1
  172. package/static/chunk-IOIBQGHN.js +0 -562
  173. package/static/chunk-J6YSFHLZ.js +0 -1
  174. package/static/chunk-JWPXQOS3.js +0 -5
  175. package/static/chunk-QVFPHTOH.js +0 -1
  176. package/static/chunk-YCTCESL4.js +0 -1
  177. package/static/main-56PZQ6TJ.js +0 -11
@@ -0,0 +1 @@
1
+ import{d as b}from"./chunk-HB5DC7RJ.js";import"./chunk-DU4Q4RWJ.js";import"./chunk-5KVI243T.js";import{b as d,d as X}from"./chunk-B2A4HNDC.js";import"./chunk-4GBA6EJ4.js";import{D as m,aa as T,ca as f,da as r,i as q,ia as g,ja as u,la as x,sa as p,ta as h,ya as y}from"./chunk-MWUUM2NK.js";import"./chunk-KAVP6UXH.js";var S=1,w=2,k=3,_=180,R=4,z=181,v=5,E=182,U=6;function D(O){return O>=65&&O<=90||O>=97&&O<=122}var F=new d(O=>{let a=O.pos;for(;;){let{next:e}=O;if(e<0)break;if(e==123){let n=O.peek(1);if(n==123){if(O.pos>a)break;O.acceptToken(S,2);return}else if(n==37){if(O.pos>a)break;let $=2,i=2;for(;;){let Q=O.peek($);if(Q==32||Q==10)++$;else if(Q==35)for(++$;;){let t=O.peek($);if(t<0||t==10)break;$++}else if(Q==45&&i==2)i=++$;else{let t=Q==101&&O.peek($+1)==110&&O.peek($+2)==100;O.acceptToken(t?k:w,i);return}}}}if(O.advance(),e==10)break}O.pos>a&&O.acceptToken(_)});function W(O,a,e){return new d(n=>{let $=n.pos;for(;;){let{next:i}=n;if(i==123&&n.peek(1)==37){let Q=2;for(;;Q++){let o=n.peek(Q);if(o!=32&&o!=10)break}let t="";for(;;Q++){let o=n.peek(Q);if(!D(o))break;t+=String.fromCharCode(o)}if(t==O){if(n.pos>$)break;n.acceptToken(e,2);break}}else if(i<0)break;if(n.advance(),i==10)break}n.pos>$&&n.acceptToken(a)})}var C=W("endcomment",E,v),N=W("endraw",z,R),Y=new d(O=>{if(O.next==35){for(O.advance();!(O.next==10||O.next<0||(O.next==37||O.next==125)&&O.peek(1)==125);)O.advance();O.acceptToken(U)}}),I={__proto__:null,contains:34,or:38,and:38,true:52,false:52,empty:54,forloop:56,tablerowloop:58,continue:60,in:130,with:196,for:198,as:200,if:236,endif:240,unless:246,endunless:250,elsif:254,else:258,case:264,endcase:268,when:272,endfor:280,tablerow:286,endtablerow:290,break:294,cycle:300,echo:304,render:308,include:312,assign:316,capture:322,endcapture:326,increment:330,decrement:334},L={__proto__:null,if:86,endif:90,elsif:94,else:98,unless:104,endunless:108,case:114,endcase:118,when:122,for:128,endfor:138,tablerow:144,endtablerow:148,break:152,continue:156,cycle:160,comment:166,endcomment:172,raw:178,endraw:184,echo:188,render:192,include:204,assign:208,capture:214,endcapture:218,increment:222,decrement:226,liquid:230},A=X.deserialize({version:14,states:"HOQYOPOOOOOP'#F{'#F{OeOaO'#CdOsQhO'#CfO!bQxO'#DSO#{OPO'#DVO$ZOPO'#D`O$iOPO'#DeO$wOPO'#DlO%VOPO'#DtO%eOSO'#EPO%jOQO'#EVO%oOPO'#EiOOOP'#Gb'#GbOOOP'#G]'#G]OOOP'#Fz'#FzQYOPOOOOOP-E9y-E9yOOQW'#Cg'#CgO&cQ!jO,59QO&jQ!jO'#G^OsQhO'#CtOOQW'#G^'#G^OOOP,59n,59nO)YQhO,59nOsQhO,59rOsQhO,59vO)dQhO,59xOsQhO,59{OsQhO,5:QOsQhO,5:UO!]QhO,5:XO!]QhO,5:aO)iQhO,5:eO)nQhO,5:gO)sQhO,5:iO)xQhO,5:lO)}QhO,5:rOsQhO,5:wOsQhO,5:yOsQhO,5;POsQhO,5;ROsQhO,5;UOsQhO,5;YOsQhO,5;[O+^QhO,5;^O+eOPO'#CdOOOP,59q,59qO#{OPO,59qO+sQxO'#DYOOOP,59z,59zO$ZOPO,59zO+xQxO'#DcOOOP,5:P,5:PO$iOPO,5:PO+}QxO'#DhOOOP,5:W,5:WO$wOPO,5:WO,SQxO'#DrOOOP,5:`,5:`O%VOPO,5:`O,XQxO'#DwOOOS'#GQ'#GQO,^OSO'#ESO,fOSO,5:kOOOQ'#GR'#GRO,kOQO'#EYO,sOQO,5:qOOOP,5;T,5;TO%oOPO,5;TO,xQxO'#ElOOOP-E9x-E9xO,}Q#|O,59SOsQhO,59VOsQhO,59WOsQhO,59WO-SQhO'#C}OOQW'#F|'#F|O-XQhO1G.lOOOP1G.l1G.lOsQhO,59WOsQhO,59[O-rQ!jO,59`O-yQ!jO1G/YO.QQhO1G/YOOOP1G/Y1G/YO.YQ!jO1G/^O.aQ!jO1G/bOOOP1G/d1G/dO.hQ!jO1G/gO.oQ!jO1G/lO.vQ!jO1G/pO/QQhO1G/sO/VQhO1G/{OOOP1G0P1G0POOOP1G0R1G0RO/[QhO1G0TOOOS1G0W1G0WOOOQ1G0^1G0^O/gQ!jO1G0cO/nQ!jO1G0eO0OQ!jO1G0kO0VQ!jO1G0mO0^Q!jO1G0pO0eQ!jO1G0tO0lQ!jO1G0vO0sQhO'#EtO0zQhO'#EyO1RQhO'#FSO1YQhO'#FZO1aQhO'#F_O1hQhO'#FqOOQW'#Gc'#GcOOQW'#GT'#GTO1oQhO1G0xOsQhO'#EuOsQhO'#EzOsQhO'#FOOOQW'#FQ'#FQOsQhO'#FTOsQhO'#FXO!]QhO'#F[O!]QhO'#F`OOQW'#Fd'#FdOOQW'#Ff'#FfO1vQhO'#FgOsQhO'#FiOsQhO'#FkOsQhO'#FmOsQhO'#FoOsQhO'#FrOsQhO'#FvOsQhO'#FxOOOP1G0x1G0xOOOP1G/]1G/]O1{QhO,59tOOOP1G/f1G/fO2QQhO,59}OOOP1G/k1G/kO2VQhO,5:SOOOP1G/r1G/rO2[QhO,5:^OOOP1G/z1G/zO2aQhO,5:cOOOS-E:O-E:OOOOP1G0V1G0VO2fQxO'#ETOOOQ-E:P-E:POOOP1G0]1G0]O2kQxO'#EZOOOP1G0o1G0oO2pQhO,5;WOOQW1G.n1G.nO2uQ!jO1G.qO5fQ!jO1G.rO5mQ!jO1G.rOOQW'#DP'#DPO7{QhO,59iOOQW-E9z-E9zOOOP7+$W7+$WO9uQ!jO1G.rO9|Q!jO1G.vOsQhO1G.zO<[QhO7+$tOOOP7+$t7+$tOOOP7+$x7+$xOOOP7+$|7+$|OOOP7+%R7+%ROOOP7+%W7+%WOsQhO'#F}O<dQhO7+%[OOOP7+%[7+%[OsQhO7+%_OsQhO7+%gO<lQhO'#GPO<qQhO7+%oOOOP7+%o7+%oO<yQhO7+%oO=OQhO7+%}OOOP7+%}7+%}O!]QhO'#EaOOQW'#GS'#GSO=WQhO7+&POsQhO'#EaOOOP7+&P7+&POOOP7+&V7+&VO=fQhO7+&XOOOP7+&X7+&XOOOP7+&[7+&[OOOP7+&`7+&`OOOP7+&b7+&bOOQW,5;`,5;`O0sQhO,5;`OOQW'#Ew'#EwOOQW,5;e,5;eO0zQhO,5;eOOQW'#E|'#E|OOQW,5;n,5;nO1RQhO,5;nOOQW'#FV'#FVOOQW,5;u,5;uO1YQhO,5;uOOQW'#F]'#F]OOQW,5;y,5;yO1aQhO,5;yOOQW'#Fb'#FbOOQW,5<],5<]O1hQhO,5<]OOQW'#Ft'#FtOOQW-E:R-E:ROOOP7+&d7+&dO=nQ!jO,5;aO>}Q!jO,5;fO@^Q!jO,5;jOBPQ!jO,5;oOC`Q!jO,5;sOEUQhO,5;vOEZQhO,5;zOE`QhO,5<ROGVQ!jO,5<TOHxQ!jO,5<VOJqQ!jO,5<XOLdQ!jO,5<ZONVQ!jO,5<^O! fQ!jO,5<bO!#XQ!jO,5<dOOOP1G/`1G/`OOOP1G/i1G/iOOOP1G/n1G/nOOOP1G/x1G/xOOOP1G/}1G/}O!$zQhO,5:oO!%PQhO,5:uOOOP1G0r1G0rOOQW7+$]7+$]OsQhO1G/TO!%UQ!jO7+$fOOOP<<H`<<H`O!%]Q!jO,5<iOOQW-E9{-E9{OOOP<<Hv<<HvO!'XQ!jO<<HyO!'cQ!jO<<IROOQW,5<k,5<kOOQW-E9}-E9}OOOP<<IZ<<IZO!'mQhO<<IZOOOP<<Ii<<IiO!'uQhO,5:{OOQW-E:Q-E:QOOOP<<Ik<<IkO!'zQ!jO,5:{OOOP<<Is<<IsOOQW1G0z1G0zOOQW1G1P1G1POOQW1G1Y1G1YOOQW1G1a1G1aOOQW1G1e1G1eOOQW1G1w1G1wO!)vQhO1G1_OsQhO1G1bOsQhO1G1fO!+jQhO1G1mO!-^QhO1G1mO!-cQhO1G1oOOQW'#GU'#GUO!/VQhO1G1qO!0|QhO1G1uOOOP1G0Z1G0ZOOOP1G0a1G0aO!2pQ!jO7+$oOOQW<<HQ<<HQOOQW'#Dq'#DqO!4lQhO'#DpOOQW'#GO'#GOO!6VQhOAN>eOOOPAN>eAN>eO!6_QhOAN>mOOOPAN>mAN>mO!6gQhOAN>uOOOPAN>uAN>uOsQhO1G0gO!]QhO1G0gO!6oQ!jO7+&|O!8RQ!jO7+'QO!9eQhO7+'XOOQW-E:S-E:SO!;XQhO<<HZOsQhO,5:[OOQW-E9|-E9|OOOPG24PG24POOOPG24XG24XOOOPG24aG24aO!=RQ!jO7+&ROOQW7+&R7+&RO!>zQhO<<JhO!@[QhO<<JlO!AlQhO<<JsO!C`Q!jO1G/v",stateData:"!Dx~O%OOSUOS~OPROQSO$zPO~O$zPOPWXQWX$yWX~OgeOjfOkfOlfOmfOnfOofOpfO%RbO~OwhOxgO{iO!PjO!RkO!UlO!ZmO!_nO!boO!jpO!nqO!prO!rsO!utO!{uO#QvO#SwO#YxO#[yO#_zO#c{O#e|O#g}O~OPROQSOR!RO$zPO~OPROQSOR!UO$zPO~OPROQSOR!XO$zPO~OPROQSOR![O$zPO~OPROQSOR!_O$zPO~O$|!`O~O${!cO~OPROQSOR!hO$zPO~O]!jOa!rOb!lOc!mOr!nO%T!kO~OX!qO~P%}Oe!sOX%QX]%QXa%QXb%QXc%QXr%QX%T%QXi%QXx%QXu%QX#U%QX#V%QX%S%QXn%QX#j%QX#l%QX#o%QX#s%QX#u%QX#x%QX#|%QX$T%QX$X%QX$[%QX$^%QX$`%QX$b%QX$d%QX$g%QX$k%QX$m%QX#q%QX#z%QX$i%QXf%QX%R%QX#W%QX$Q%QX$V%QX~Or!nOx!wO~PsOx!zO~Ox#QO~Ox#RO~Oo#SO~Ox#TO~Ox#UO~On#pO#V#mO#j#gO#o#hO#s#iO#u#jO#x#kO#|#lO$T#nO$X#oO$[#qO$^#rO$`#sO$b#tO$d#uO$g#vO$k#wO$m#xO~Ox#yO~P*SO$zPOPWXQWXRWX~O}#{O~O!W#}O~O!]$PO~O!g$RO~O!l$TO~O$|!`OT!vX~OT$WO~O${!cOS!|X~OS$ZO~O#a$]O~O^$^O~O%R$bO~OX$eOr!nO~O]!jOa!rOb!lOc!mO%T!kO~Oi$hO~P-aOx$jO~P%}Or!nOx$jO~Ox$kO~P-aOx$lO~P-aOx$mO~P-aOx$nO~P-aOu$oOx$qO~P-aO!c$rO~O!c$sO~Ot$wOu$tOx$vO~Ox$yO~P%}Ou$zOx%OO#U$}O#V$}O~P-aOx%PO~P-aOx%RO~P%}Ox%SO~P-aOx%TO~P-aOx%UO~P-aO#l%XO~P*SO#q%[O~P*SO#z%_O~P*SO$Q%bO~P*SO$V%eO~P*SO$i%hO~P*SOx%jO~P*SOo%rO~Ox%zO~Ox%{O~Ox%|O~Ox%}O~Ox&OO~O!x&PO~O#O&QO~Ox&RO~O%S&SO~P-aO]!jO%T!kOX`ia`ic`ir`ii`ix`iu`i#U`i#V`i%S`in`i#j`i#l`i#o`i#s`i#u`i#x`i#|`i$T`i$X`i$[`i$^`i$``i$b`i$d`i$g`i$k`i$m`i#q`i#z`i$i`if`i%R`i#W`i$Q`i$V`i~Ob`i~P2|OX`ir`ii`ix`iu`i#U`i#V`i%S`in`i#j`i#l`i#o`i#s`i#u`i#x`i#|`i$T`i$X`i$[`i$^`i$``i$b`i$d`i$g`i$k`i$m`i#q`i#z`i$i`if`i%R`i#W`i$Q`i$V`i~P-aOt&TOXqarqaxqanqa#Vqa#jqa#oqa#sqa#uqa#xqa#|qa$Tqa$Xqa$[qa$^qa$`qa$bqa$dqa$gqa$kqa$mqa#lqa#qqa#zqa$Qqa$Vqa$iqa~Ob!lO~P2|OXdirdiidixdiudi#Udi#Vdi%Sdindi#jdi#ldi#odi#sdi#udi#xdi#|di$Tdi$Xdi$[di$^di$`di$bdi$ddi$gdi$kdi$mdi#qdi#zdi$idifdi%Rdi#Wdi$Qdi$Vdi~P-aOr!nOx&VO~Ou$oOx&YO~Oo&]O~Ou$tOx&_O~Oo&`O~Or!nOx&aO~Ou$zOx&dO#U$}O#V$}O~Or!nOx&fO~On#ia#V#ia#j#ia#l#ia#o#ia#s#ia#u#ia#x#ia#|#ia$T#ia$X#ia$[#ia$^#ia$`#ia$b#ia$d#ia$g#ia$k#ia$m#ia~P-aOn#na#V#na#j#na#o#na#q#na#s#na#u#na#x#na#|#na$T#na$X#na$[#na$^#na$`#na$b#na$d#na$g#na$k#na$m#na~P-aOn#rax#ra#V#ra#j#ra#o#ra#s#ra#u#ra#x#ra#|#ra$T#ra$X#ra$[#ra$^#ra$`#ra$b#ra$d#ra$g#ra$k#ra$m#ra#l#ra#q#ra#z#ra$Q#ra$V#ra$i#ra~P-aOn#wa#V#wa#j#wa#o#wa#s#wa#u#wa#x#wa#z#wa#|#wa$T#wa$X#wa$[#wa$^#wa$`#wa$b#wa$d#wa$g#wa$k#wa$m#wa~P-aOu$oOn#{ax#{a#V#{a#j#{a#o#{a#s#{a#u#{a#x#{a#|#{a$T#{a$X#{a$[#{a$^#{a$`#{a$b#{a$d#{a$g#{a$k#{a$m#{a#l#{a#q#{a#z#{a$Q#{a$V#{a$i#{a~P-aO!c&nO~O!c&oO~Ot&qOu$tOn$Zax$Za#V$Za#j$Za#o$Za#s$Za#u$Za#x$Za#|$Za$T$Za$X$Za$[$Za$^$Za$`$Za$b$Za$d$Za$g$Za$k$Za$m$Za#l$Za#q$Za#z$Za$Q$Za$V$Za$i$Za~On$]ax$]a#V$]a#j$]a#o$]a#s$]a#u$]a#x$]a#|$]a$T$]a$X$]a$[$]a$^$]a$`$]a$b$]a$d$]a$g$]a$k$]a$m$]a#l$]a#q$]a#z$]a$Q$]a$V$]a$i$]a~P%}Ou$zO#U$}O#V$}On$_ax$_a#j$_a#o$_a#s$_a#u$_a#x$_a#|$_a$T$_a$X$_a$[$_a$^$_a$`$_a$b$_a$d$_a$g$_a$k$_a$m$_a#l$_a#q$_a#z$_a$Q$_a$V$_a$i$_a~P-aOn$aax$aa#V$aa#j$aa#o$aa#s$aa#u$aa#x$aa#|$aa$T$aa$X$aa$[$aa$^$aa$`$aa$b$aa$d$aa$g$aa$k$aa$m$aa#l$aa#q$aa#z$aa$Q$aa$V$aa$i$aa~P-aOn$cax$ca#V$ca#j$ca#o$ca#s$ca#u$ca#x$ca#|$ca$T$ca$X$ca$[$ca$^$ca$`$ca$b$ca$d$ca$g$ca$k$ca$m$ca#l$ca#q$ca#z$ca$Q$ca$V$ca$i$ca~P%}On$fa#V$fa#j$fa#o$fa#s$fa#u$fa#x$fa#|$fa$T$fa$X$fa$[$fa$^$fa$`$fa$b$fa$d$fa$g$fa$i$fa$k$fa$m$fa~P-aOn$jax$ja#V$ja#j$ja#o$ja#s$ja#u$ja#x$ja#|$ja$T$ja$X$ja$[$ja$^$ja$`$ja$b$ja$d$ja$g$ja$k$ja$m$ja#l$ja#q$ja#z$ja$Q$ja$V$ja$i$ja~P-aOn$lax$la#V$la#j$la#o$la#s$la#u$la#x$la#|$la$T$la$X$la$[$la$^$la$`$la$b$la$d$la$g$la$k$la$m$la#l$la#q$la#z$la$Q$la$V$la$i$la~P-aOx&vO~Ox&wO~Of&yO~P-aOu$qax$qan$qa#V$qa#j$qa#o$qa#s$qa#u$qa#x$qa#|$qa$T$qa$X$qa$[$qa$^$qa$`$qa$b$qa$d$qa$g$qa$k$qa$m$qa#l$qa#q$qa#z$qa$Q$qa$V$qa$i$qaX$qar$qa~P-aOx'OO%R&zO~P-aOx'QO%R&zO~P-aOu$tOx'SO~Ot'TO~O#W'UOu#Tax#Ta#U#Ta#V#Tan#Ta#j#Ta#o#Ta#s#Ta#u#Ta#x#Ta#|#Ta$T#Ta$X#Ta$[#Ta$^#Ta$`#Ta$b#Ta$d#Ta$g#Ta$k#Ta$m#Ta#l#Ta#q#Ta#z#Ta$Q#Ta$V#Ta$i#Ta~P-aOu$oOn#{ix#{i#V#{i#j#{i#o#{i#s#{i#u#{i#x#{i#|#{i$T#{i$X#{i$[#{i$^#{i$`#{i$b#{i$d#{i$g#{i$k#{i$m#{i#l#{i#q#{i#z#{i$Q#{i$V#{i$i#{i~Ou$tOn$Zix$Zi#V$Zi#j$Zi#o$Zi#s$Zi#u$Zi#x$Zi#|$Zi$T$Zi$X$Zi$[$Zi$^$Zi$`$Zi$b$Zi$d$Zi$g$Zi$k$Zi$m$Zi#l$Zi#q$Zi#z$Zi$Q$Zi$V$Zi$i$Zi~Oo'XO~Or!nOn$]ix$]i#V$]i#j$]i#o$]i#s$]i#u$]i#x$]i#|$]i$T$]i$X$]i$[$]i$^$]i$`$]i$b$]i$d$]i$g$]i$k$]i$m$]i#l$]i#q$]i#z$]i$Q$]i$V$]i$i$]i~Ou$zO#U$}O#V$}On$_ix$_i#j$_i#o$_i#s$_i#u$_i#x$_i#|$_i$T$_i$X$_i$[$_i$^$_i$`$_i$b$_i$d$_i$g$_i$k$_i$m$_i#l$_i#q$_i#z$_i$Q$_i$V$_i$i$_i~Or!nOn$cix$ci#V$ci#j$ci#o$ci#s$ci#u$ci#x$ci#|$ci$T$ci$X$ci$[$ci$^$ci$`$ci$b$ci$d$ci$g$ci$k$ci$m$ci#l$ci#q$ci#z$ci$Q$ci$V$ci$i$ci~Ou$oOXqqrqqxqqnqq#Vqq#jqq#oqq#sqq#uqq#xqq#|qq$Tqq$Xqq$[qq$^qq$`qq$bqq$dqq$gqq$kqq$mqq#lqq#qqq#zqq$Qqq$Vqq$iqq~P-aOt'[Ox!dX%R!dXn!dX#V!dX#j!dX#o!dX#s!dX#u!dX#x!dX#|!dX$Q!dX$T!dX$X!dX$[!dX$^!dX$`!dX$b!dX$d!dX$g!dX$k!dX$m!dX$V!dX~Ox'^O%R&zO~Ox'_O%R&zO~Ou$tOx'`O~O%R&zOn$Oq#V$Oq#j$Oq#o$Oq#s$Oq#u$Oq#x$Oq#|$Oq$Q$Oq$T$Oq$X$Oq$[$Oq$^$Oq$`$Oq$b$Oq$d$Oq$g$Oq$k$Oq$m$Oq~P-aO%R&zOn$Sq#V$Sq#j$Sq#o$Sq#s$Sq#u$Sq#x$Sq#|$Sq$T$Sq$V$Sq$X$Sq$[$Sq$^$Sq$`$Sq$b$Sq$d$Sq$g$Sq$k$Sq$m$Sq~P-aOu$tOn$Zqx$Zq#V$Zq#j$Zq#o$Zq#s$Zq#u$Zq#x$Zq#|$Zq$T$Zq$X$Zq$[$Zq$^$Zq$`$Zq$b$Zq$d$Zq$g$Zq$k$Zq$m$Zq#l$Zq#q$Zq#z$Zq$Q$Zq$V$Zq$i$Zq~Ou$oOXqyrqyxqynqy#Vqy#jqy#oqy#sqy#uqy#xqy#|qy$Tqy$Xqy$[qy$^qy$`qy$bqy$dqy$gqy$kqy$mqy#lqy#qqy#zqy$Qqy$Vqy$iqy~Ou#Tqx#Tq#U#Tq#V#Tqn#Tq#j#Tq#o#Tq#s#Tq#u#Tq#x#Tq#|#Tq$T#Tq$X#Tq$[#Tq$^#Tq$`#Tq$b#Tq$d#Tq$g#Tq$k#Tq$m#Tq#l#Tq#q#Tq#z#Tq$Q#Tq$V#Tq$i#Tq~P-aO%R&zOn$Oy#V$Oy#j$Oy#o$Oy#s$Oy#u$Oy#x$Oy#|$Oy$Q$Oy$T$Oy$X$Oy$[$Oy$^$Oy$`$Oy$b$Oy$d$Oy$g$Oy$k$Oy$m$Oy~O%R&zOn$Sy#V$Sy#j$Sy#o$Sy#s$Sy#u$Sy#x$Sy#|$Sy$T$Sy$V$Sy$X$Sy$[$Sy$^$Sy$`$Sy$b$Sy$d$Sy$g$Sy$k$Sy$m$Sy~Ou$tOn$Zyx$Zy#V$Zy#j$Zy#o$Zy#s$Zy#u$Zy#x$Zy#|$Zy$T$Zy$X$Zy$[$Zy$^$Zy$`$Zy$b$Zy$d$Zy$g$Zy$k$Zy$m$Zy#l$Zy#q$Zy#z$Zy$Q$Zy$V$Zy$i$Zy~Ox!di%R!din!di#V!di#j!di#o!di#s!di#u!di#x!di#|!di$Q!di$T!di$X!di$[!di$^!di$`!di$b!di$d!di$g!di$k!di$m!di$V!di~P-aO",goto:"7r%WPPPPPPPP%XP%X%i&yPP&y&yPPP&yPPP&yPPPPPPPP'wP(XPP([PP([(lP(|P([P([P([)SP)dP([)jP)zP([P([*QPP*b*l*vP([*|P+^P([P([P([P([+dP+t+wP([+zP,[,_P([P([P,bPPP([P([P([,jP,zP([P([P([P-Q-bP-rP-Q-xP.YP-QP-QP-Q.`P.pP-QP-Q.v/WP-Q/^P/nP-QP-Q-QP-QP-QP-QP-QP-Q/tP0UP-QP-QP0[0z1b2Q2`2r3U3[3b3h4WPPPPPP4^4nPPP%X7bm^OTUVWX[`!Q!T!W!Z!^!g!vdRehijlmnvwxyz{|!k!l!m!r!s#g#h#i#k#l#r#s#t#u#v#w#x$h$o$r$s$}&T&n&o'T'[Q#OoQ#PpQ%p#mQ%q#nQ&b$zR'b'U!wfRehijlmnvwxyz{|!k!l!m!r!s#g#h#i#k#l#r#s#t#u#v#w#x$h$o$r$s$}&T&n&o'T'[m!och!p!u!v#V#Y$i$x%Q%s%v&r&uR$c!nm]OTUVWX[`!Q!T!W!Z!^!gmTOTUVWX[`!Q!T!W!Z!^!gQ!PTR#z!QmUOTUVWX[`!Q!T!W!Z!^!gQ!SUR#|!TmVOTUVWX[`!Q!T!W!Z!^!gQ!VVR$O!WmWOTUVWX[`!Q!T!W!Z!^!ga&|&Z&[&}'P'V'W'c'da&{&Z&[&}'P'V'W'c'dQ!YWR$Q!ZmXOTUVWX[`!Q!T!W!Z!^!gQ!]XR$S!^mYOTUVWX[`!Q!T!W!Z!^!gR!bYR$V!bmZOTUVWX[`!Q!T!W!Z!^!gR!eZR$Y!eS${#W$|T&s%t&tm[OTUVWX[`!Q!T!W!Z!^!gQ!f[R$[!gm#d}#^#_#`#a#b#c#f%W%Z%^%a%d%gm#^}#^#_#`#a#b#c#f%W%Z%^%a%d%gQ%V#^R&g%Wm#_}#^#_#`#a#b#c#f%W%Z%^%a%d%gQ%Y#_R&h%Zm#`}#^#_#`#a#b#c#f%W%Z%^%a%d%gQ%]#`R&i%^m#a}#^#_#`#a#b#c#f%W%Z%^%a%d%gQ%`#aR&j%am#b}#^#_#`#a#b#c#f%W%Z%^%a%d%gQ%c#bR&k%dm#c}#^#_#`#a#b#c#f%W%Z%^%a%d%gQ%f#cR&l%gQ`OQ!QTQ!TUQ!WVQ!ZWQ!^XQ!g[_!i`!Q!T!W!Z!^!gSQO`SaQ!Oi!OTUVWX[!Q!T!W!Z!^!gQ!pcQ!vh^$d!p!v$i$x%Q&r&uQ$i!uQ$x#VQ%Q#YQ&r%sR&u%vQ$p!}U&X$p&m'ZQ&m%oR'Z&xQ&}&ZQ'P&[W']&}'P'c'dQ'c'VR'd'WQ$u#SW&^$u&p'R'eQ&p%rQ'R&`R'e'XQ!aYR$U!aQ!dZR$X!dQ$|#WR&c$|Q#f}Q%W#^Q%Z#_Q%^#`Q%a#aQ%d#bQ%g#c_%i#f%W%Z%^%a%d%gQ&t%tR'Y&tm_OTUVWX[`!Q!T!W!Z!^!gQcRQ!teQ!uhQ!xiQ!yjQ!{lQ!|mQ!}nQ#VvQ#WwQ#XxQ#YyQ#ZzQ#[{Q#]|Q$_!kQ$`!lQ$a!mQ$f!rQ$g!sQ%k#gQ%l#hQ%m#iQ%n#kQ%o#lQ%s#rQ%t#sQ%u#tQ%v#uQ%w#vQ%x#wQ%y#xQ&U$hQ&W$oQ&Z$rQ&[$sQ&e$}Q&x&TQ'V&nQ'W&oQ'a'TR'f'[m#e}#^#_#`#a#b#c#f%W%Z%^%a%d%g",nodeNames:"\u26A0 {{ {% {% {% {% InlineComment Template Text }} Interpolation VariableName MemberExpression . PropertyName SubscriptExpression BinaryExpression contains CompareOp LogicOp AssignmentExpression AssignOp ) ( RangeExpression .. BooleanLiteral empty forloop tablerowloop continue StringLiteral NumberLiteral Filter | FilterName : , Tag TagName %} IfDirective Tag if EndTag endif Tag elsif Tag else UnlessDirective Tag unless EndTag endunless CaseDirective Tag case EndTag endcase Tag when ForDirective Tag for in Parameter ParameterName EndTag endfor TableDirective Tag tablerow EndTag endtablerow Tag break Tag continue Tag cycle Comment Tag comment CommentText EndTag endcomment RawDirective Tag raw RawText EndTag endraw Tag echo Tag render RenderParameter with for as Tag include Tag assign CaptureDirective Tag capture EndTag endcapture Tag increment Tag decrement Tag liquid IfDirective Tag if EndTag endif UnlessDirective Tag unless EndTag endunless Tag elsif Tag else CaseDirective Tag case EndTag endcase Tag when ForDirective Tag EndTag endfor TableDirective Tag tablerow EndTag endtablerow Tag break Tag Tag cycle Tag echo Tag render Tag include Tag assign CaptureDirective Tag capture EndTag endcapture Tag increment Tag decrement",maxTerm:191,nodeProps:[["closedBy",1,"}}",-4,2,3,4,5,"%}",23,")"],["openedBy",9,"{{",22,"(",40,"{%"],["group",-13,11,12,15,16,20,24,26,27,28,29,30,31,32,"Expression"]],skippedNodes:[0,6],repeatNodeCount:11,tokenData:")e~RmXY!|YZ!|]^!|pq!|qr#_rs#juv$[wx$gxy%Syz%X{|%^|}&x}!O&}!O!P'Z!Q![&g![!]'k!^!_'p!_!`'x!`!a'p!c!}(Q!}#O(y#P#Q)O#R#S(Q#T#o(Q#p#q)T#q#r)Y%W;'S(Q;'S;:j(s<%lO(Q~#RS%O~XY!|YZ!|]^!|pq!|~#bP!_!`#e~#jOb~~#mUOY#jZr#jrs$Ps;'S#j;'S;=`$U<%lO#j~$UOo~~$XP;=`<%l#j~$_P#q#r$b~$gOx~~$jUOY$gZw$gwx$Px;'S$g;'S;=`$|<%lO$g~%PP;=`<%l$g~%XOg~~%^Of~P%aQ!O!P%g!Q![&gP%jP!Q![%mP%rRpP!Q![%m!g!h%{#X#Y%{P&OR{|&X}!O&X!Q![&_P&[P!Q![&_P&dPpP!Q![&_P&lSpP!O!P%g!Q![&g!g!h%{#X#Y%{~&}Ou~~'QRuv$[!O!P%g!Q![&g~'`Q]S!O!P'f!Q![%m~'kOi~~'pOt~~'uPb~!_!`#e~'}Pe~!_!`#e_(ZW^WwQ%RT}!O(Q!Q![(Q!c!}(Q#R#S(Q#T#o(Q%W;'S(Q;'S;:j(s<%lO(Q_(vP;=`<%l(Q~)OO%T~~)TO%S~~)YOr~~)]P#q#r)`~)eOX~",tokenizers:[F,N,C,Y,0,1,2,3],topRules:{Template:[0,7]},specialized:[{term:187,get:O=>I[O]||-1},{term:39,get:O=>L[O]||-1}],tokenPrec:0});function l(O,a){return O.split(" ").map(e=>({label:e,type:a}))}var Z=l("abs append at_least at_most capitalize ceil compact concat date default divided_by downcase escape escape_once first floor join last lstrip map minus modulo newline_to_br plus prepend remove remove_first replace replace_first reverse round rstrip size slice sort sort_natural split strip strip_html strip_newlines sum times truncate truncatewords uniq upcase url_decode url_encode where","function"),j=l("cycle comment endcomment raw endraw echo increment decrement liquid if elsif else endif unless endunless case endcase for endfor tablerow endtablerow break continue assign capture endcapture render include","keyword"),G=l("empty forloop tablerowloop in with as","keyword"),B=l("first index index0 last length rindex","property"),H=l("col col0 col_first col_last first index index0 last length rindex rindex0 row","property");function M(O){var a;let{state:e,pos:n}=O,$=u(e).resolveInner(n,-1).enterUnfinishedNodesBefore(n),i=((a=$.childBefore(n))===null||a===void 0?void 0:a.name)||$.name;if($.name=="FilterName")return{type:"filter",node:$};if(O.explicit&&i=="|")return{type:"filter"};if($.name=="TagName")return{type:"tag",node:$};if(O.explicit&&i=="{%")return{type:"tag"};if($.name=="PropertyName"&&$.parent.name=="MemberExpression")return{type:"property",node:$,target:$.parent};if($.name=="."&&$.parent.name=="MemberExpression")return{type:"property",target:$.parent};if($.name=="MemberExpression"&&i==".")return{type:"property",target:$};if($.name=="VariableName")return{type:"expression",from:$.from};let Q=O.matchBefore(/[\w\u00c0-\uffff]+$/);return Q?{type:"expression",from:Q.from}:O.explicit&&$.name!="CommentText"&&$.name!="StringLiteral"&&$.name!="NumberLiteral"&&$.name!="InlineComment"?{type:"expression"}:null}function J(O,a,e,n){let $=[];for(;;){let i=a.getChild("Expression");if(!i)return[];if(i.name=="forloop")return $.length?[]:B;if(i.name=="tablerowloop")return $.length?[]:H;if(i.name=="VariableName"){$.unshift(O.sliceDoc(i.from,i.to));break}else if(i.name=="MemberExpression"){let Q=i.getChild("PropertyName");Q&&$.unshift(O.sliceDoc(Q.from,Q.to)),a=i}else return[]}return n?n($,O,e):[]}function K(O={}){let a=O.filters?O.filters.concat(Z):Z,e=O.tags?O.tags.concat(j):j,n=O.variables?O.variables.concat(G):G,{properties:$}=O;return i=>{var Q;let t=M(i);if(!t)return null;let o=(Q=t.from)!==null&&Q!==void 0?Q:t.node?t.node.from:i.pos,s;return t.type=="filter"?s=a:t.type=="tag"?s=e:t.type=="expression"?s=n:s=J(i.state,t.target,i,$),s.length?{options:s,from:o,validFor:/^[\w\u00c0-\uffff]*$/}:null}}var OO=m.inputHandler.of((O,a,e,n)=>n!="%"||a!=e||O.state.doc.sliceString(a-1,e+1)!="{}"?!1:(O.dispatch(O.state.changeByRange($=>({changes:{from:$.from,to:$.to,insert:"%%"},range:q.cursor($.from+1)})),{scrollIntoView:!0,userEvent:"input.type"}),!0));function P(O){return a=>{let e=O.test(a.textAfter);return a.lineIndent(a.node.from)+(e?0:a.unit)}}var $O=g.define({name:"liquid",parser:A.configure({props:[f({"cycle comment endcomment raw endraw echo increment decrement liquid in with as":r.keyword,"empty forloop tablerowloop":r.atom,"if elsif else endif unless endunless case endcase for endfor tablerow endtablerow break continue":r.controlKeyword,"assign capture endcapture":r.definitionKeyword,contains:r.operatorKeyword,"render include":r.moduleKeyword,VariableName:r.variableName,TagName:r.tagName,FilterName:r.function(r.variableName),PropertyName:r.propertyName,CompareOp:r.compareOperator,AssignOp:r.definitionOperator,LogicOp:r.logicOperator,NumberLiteral:r.number,StringLiteral:r.string,BooleanLiteral:r.bool,InlineComment:r.lineComment,CommentText:r.blockComment,"{% %} {{ }}":r.brace,"[ ]":r.bracket,"( )":r.paren,".":r.derefOperator,", .. : |":r.punctuation}),p.add({Tag:h({closing:"%}"}),"UnlessDirective ForDirective TablerowDirective CaptureDirective":P(/^\s*(\{%-?\s*)?end\w/),IfDirective:P(/^\s*(\{%-?\s*)?(endif|else|elsif)\b/),CaseDirective:P(/^\s*(\{%-?\s*)?(endcase|when)\b/)}),y.add({"UnlessDirective ForDirective TablerowDirective CaptureDirective IfDirective CaseDirective RawDirective Comment"(O){let a=O.firstChild,e=O.lastChild;return!a||a.name!="Tag"?null:{from:a.to,to:e.name=="EndTag"?e.from:O.to}}})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*{%-?\s*(?:end|elsif|else|when|)$/}}),c=b();function V(O){return $O.configure({wrap:T(a=>a.type.isTop?{parser:O.parser,overlay:e=>e.name=="Text"||e.name=="RawText"}:null)},"liquid")}var aO=V(c.language);function sO(O={}){let a=O.base||c,e=a.language==c.language?aO:V(a.language);return new x(e,[a.support,e.data.of({autocomplete:K(O)}),a.language.data.of({closeBrackets:{brackets:["{"]}}),OO])}export{OO as closePercentBrace,sO as liquid,K as liquidCompletionSource,aO as liquidLanguage};
@@ -0,0 +1 @@
1
+ import{A as Ee,B as z,C as De,D as A,E as ie,N as Pe,P as ne,a as we,c as w,d as ee,e as S,f as H,i as v,j as te,ja as $,k as V,l as q,n as Ce,na as Re,o as I,p as Se,q as K,s as Ie,t as Te,u as Oe,y as Ae,z as B}from"./chunk-MWUUM2NK.js";import{a as L,b as M}from"./chunk-KAVP6UXH.js";var X=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 Ye(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+$/]:Ye(e);return o=>{let s=o.matchBefore(n);return s||o.explicit?{from:s?s.from:o.pos,options:e,validFor:t}:null}}function Ut(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 Y=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=Ce.define();function Je(i,e,t,n){let{main:o}=i.selection,s=t-o.from,l=n-o.from;return M(L({},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 Le=new WeakMap;function Ze(i){if(!Array.isArray(i))return i;let e=Le.get(i);return e||Le.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),P=S(d),C=P==e.length?0:-100;if(d!=t[0])if(d==n[0])C+=-200;else return null;return this.ret(C,[0,P])}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,P=Math.min(e.length,200);d<P&&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,k=/[a-z]/.test(e),O=!0;for(let d=0,P=Math.min(e.length,200),C=0;d<P&&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 U,_=b<255?b>=48&&b<=57||b>=97&&b<=122?2:b>=65&&b<=90?1:0:(U=ee(b))!=U.toLowerCase()?1:U!=U.toUpperCase()?2:0;(!d||_==1&&k||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 Ie(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=>Me(e(n),t(n)),optionClass:(e,t)=>n=>Me(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Me(i,e){return i?e?i+" "+e:i:e}function _e(i,e,t,n,o,s){let l=i.textDirection==Ee.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 k=(e.bottom-e.top)/s.offsetHeight,O=(e.right-e.left)/s.offsetWidth;return{style:`${h}: ${c/k}px; max-width: ${f/O}px`,class:"cm-completionInfo-"+(r?l?"left-narrow":"right-narrow":a?"left":"right")}}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}}),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 Be(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 Y(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 k=y.displayLabel?f?f(y,p.matched):[]:p.matched,O=p.score+(y.boost||0);if(s(new Y(y,c.source,k,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):Be(c.completion)>Be(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,$e(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,$e(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(L({},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(ye));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(He)&&(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 $e(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 Ue(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=Ue(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(ye))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 X(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 ye=I.define({map(i,e){return i.map(t=>t.map(e))}}),He=I.define(),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 be(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(L({},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,be);function Q(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:He.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:be(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=De.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=Ue(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 X(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:ye.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&&be(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(Re);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 Ae{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),bt=B.mark({class:"cm-snippetField"}),R=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))}},j=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(j))return t.value;if(t.is(xt)&&i)return new R(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 xe(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:we.of(l)},scrollIntoView:!0,annotations:n?[ge.of(n),Se.userEvent.of("input.complete")]:void 0};if(a.length&&(h.selection=xe(a,0)),a.some(c=>c.field>0)){let c=new R(a,0),f=h.effects=[j.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:xe(n.ranges,o),effects:j.of(s?null:new R(n.ranges,o)),scrollIntoView:!0})),!0}}var wt=({state:i,dispatch:e})=>i.field(W,!1)?(e(i.update({effects:j.of(null)})),!0):!1,Ct=qe(1),St=qe(-1);var It=[{key:"Tab",run:Ct,shift:St},{key:"Escape",run:wt}],Fe=te.define({combine(i){return i.length?i[0]:It}}),Tt=q.highest(ie.compute([Fe],i=>i.facet(Fe)));function Ht(i,e){return M(L({},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:xe(t.ranges,o.field),effects:j.of(t.ranges.some(s=>s.field>o.field)?new R(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}}),ve=new class extends Te{};ve.startSide=1;ve.endSide=-1;var Ke=V.define({create(){return Oe.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:[ve.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 Qe(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=Pt(i.state,n);return s?(i.dispatch(s),!0):!1}),Dt=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let n=Qe(i,i.selection.main.head).brackets||N.brackets,o=null,s=i.changeByRange(l=>{if(l.empty){let a=Rt(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 Pt(i,e){let t=Qe(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):kt(i,o,s,t.before||N.before);if(e==s&&Xe(i,i.selection.main.from))return Lt(i,o,s)}return null}function Xe(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 Rt(i,e){let t=i.sliceString(e-2,e);return S(w(t,0))==t.length?t:t.slice(1)}function kt(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 Lt(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(We(i,r))return{changes:{insert:e+e,from:r},effects:E.of(r+e.length),range:v.cursor(r+e.length)};if(Xe(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=Ne(i,r-2*e.length,o))>-1&&We(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&&Ne(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 We(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 Ne(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:Q(!0)},{key:"ArrowUp",run:Q(!1)},{key:"PageDown",run:Q(!0,"page")},{key:"PageUp",run:Q(!1,"page")},{key:"Enter",run:ft}],Ft=q.highest(ie.computeN([g],i=>i.facet(g).defaultKeymap?[$t]:[]));export{X as a,Ge as b,Ut as c,Ht as d,Vt as e,qt as f,Kt as g,$t as h};
@@ -1 +1 @@
1
- import{$a as at,B as Kt,Ba as di,Cb as z,I as ni,Ma as mi,Mb as wi,Na as _i,Nb as ct,Pb as bi,Qb as Ai,Ua as gi,W as ai,X as Qt,_ as ot,aa as ci,ab as yi,ba as hi,ca as xt,da as ui,ea as li,fa as jt,ga as q,ha as pi,ia as fi,ja as X,qb as Ei,tb as M,ub as Si,vb as Pt}from"./chunk-I2S3XPC5.js";import{Aa as Ce,Bb as st,Bd as je,Cd as Je,Dd as Rt,Eb as B,Ed as Ot,Ef as ii,G as we,Gb as D,Jd as Xe,Kb as Ne,Kd as kt,L as be,Lb as Pe,Mb as Fe,Oa as m,Pb as Yt,Qa as Re,Qb as Le,Rb as At,Tb as A,Vb as Ie,Vc as We,W as Ae,Wf as ri,Xb as Ue,Yb as Be,Yc as Tt,Zb as De,ab as bt,bb as Oe,c as Se,cb as ke,ea as wt,fa as Te,fd as vt,ha as ve,hd as nt,he as ze,ie as Ze,ja as p,jb as xe,jd as Ct,kc as Me,kd as $e,lb as k,mb as x,mc as Ve,mg as si,oa as W,od as qe,og as Nt,pa as $,pd as Ge,rb as C,sb as f,sd as He,tb as _,td as Ye,ub as J,v as S,wf as ti,yd as Ke,yf as ei,zd as Qe}from"./chunk-IOIBQGHN.js";import{n as oi}from"./chunk-DM4NXKEP.js";import{a as O,b as _e,d as ge,e as ye,i as Ee}from"./chunk-KAVP6UXH.js";var V=(function(r){return r.USER="user",r.GUEST="guest",r.LINK="link",r.GROUP="group",r.PGROUP="personal group",r})(V||{});function Ti(r,t=[]){let e=O({},Object.fromEntries(Object.entries(Ai).filter(([i,s])=>t.indexOf(i)===-1)));if(!r)return e;for(let i of r.split(":"))i in e&&(e[i]=!0);return e}function jr(r,t,e=[]){let i={};if(!r)return i;for(let s of r.split(":"))e.indexOf(s)===-1&&(i[s]=t.indexOf(s)>-1);return i}function Jr(r,t=[]){let e={};if(!r)return e;for(let i of r.split(":"))t.indexOf(i)===-1&&(e[i]=bi[i]);return e}function Xr(r){return Object.entries(r).filter(([t,e])=>e).map(([t,e])=>t).join(":")}var T=class{constructor(t,e=[]){this.newly=0,this.linkSettings=null,Object.assign(this,t),this.mid=`${t.type[0]}${t.id}`,this.hPerms=Ti(t.permissions,e),t.login&&(this.avatarUrl=M(t.login)),this.isLink=!!this.linkId,this.isGuest=this.type===V.GUEST,this.isUser=this.isGuest||this.type===V.USER&&!this.isLink,this.isGroup=this.type===V.GROUP||this.type===V.PGROUP,this.isPersonalGroup=this.type===V.PGROUP,this.setGroupRole(),this.modifiedAt?this.newly=at(this.modifiedAt):this.createdAt&&(this.newly=at(this.createdAt))}setGroupRole(t){typeof t<"u"&&(this.groupRole=t),this.isGroupManager=this.groupRole===Kt.MANAGER}};function os(r,t,e){return new T({id:r.id,login:r.login,name:r.fullName,description:r.email,type:V.USER,spaceRole:t||di.IS_MEMBER,groupRole:e||Kt.MEMBER,permissions:""})}var vi={NAME_SPACE:"/",EVENTS:{NOTIFICATION:"notification"}};var ht={NAME_SPACE:"/",EVENTS:{ONLINE_STATUS:"onlineStatus",ONLINE_USERS:"onlineUsers",ONLINE_USER:"onlineUser"}};var l=(function(r){return r.BASE="/api/auth",r.LOGIN="login",r.LOGOUT="logout",r.REFRESH="refresh",r.TOKEN="token",r.TOKEN_REFRESH="token/refresh",r.WS="socket.io",r.TWO_FA_BASE="2fa",r.TWO_FA_ENABLE="enable",r.TWO_FA_DISABLE="disable",r.TWO_FA_LOGIN_VERIFY="login/verify",r.TWO_FA_ADMIN_RESET_USER="reset/user",r})(l||{}),us=`${l.BASE}/${l.LOGIN}`,ls=`${l.BASE}/${l.LOGOUT}`,Ci=`${l.BASE}/${l.REFRESH}`,ps=`${l.BASE}/${l.TOKEN}`,fs=`${l.BASE}/${l.TOKEN_REFRESH}`,Ri=`/${l.WS}`,Jt=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ENABLE}`,Oi=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_DISABLE}`,ki=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_LOGIN_VERIFY}`,xi=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ADMIN_RESET_USER}`;var pe={};ye(pe,{Fetch:()=>mt,Manager:()=>K,NodeWebSocket:()=>I,NodeXHR:()=>L,Socket:()=>H,WebSocket:()=>I,WebTransport:()=>G,XHR:()=>L,connect:()=>Q,default:()=>Q,io:()=>Q,protocol:()=>ue});var v=Object.create(null);v.open="0";v.close="1";v.ping="2";v.pong="3";v.message="4";v.upgrade="5";v.noop="6";var ut=Object.create(null);Object.keys(v).forEach(r=>{ut[v[r]]=r});var lt={type:"error",data:"parser error"};var Fi=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Li=typeof ArrayBuffer=="function",Ii=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,pt=({type:r,data:t},e,i)=>Fi&&t instanceof Blob?e?i(t):Ni(t,i):Li&&(t instanceof ArrayBuffer||Ii(t))?e?i(t):Ni(new Blob([t]),i):i(v[r]+(t||"")),Ni=(r,t)=>{let e=new FileReader;return e.onload=function(){let i=e.result.split(",")[1];t("b"+(i||""))},e.readAsDataURL(r)};function Pi(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var Xt;function Ui(r,t){if(Fi&&r.data instanceof Blob)return r.data.arrayBuffer().then(Pi).then(t);if(Li&&(r.data instanceof ArrayBuffer||Ii(r.data)))return t(Pi(r.data));pt(r,!1,e=>{Xt||(Xt=new TextEncoder),t(Xt.encode(e))})}var Bi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ft=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<Bi.length;r++)ft[Bi.charCodeAt(r)]=r;var Di=r=>{let t=r.length*.75,e=r.length,i,s=0,n,o,a,c;r[r.length-1]==="="&&(t--,r[r.length-2]==="="&&t--);let R=new ArrayBuffer(t),b=new Uint8Array(R);for(i=0;i<e;i+=4)n=ft[r.charCodeAt(i)],o=ft[r.charCodeAt(i+1)],a=ft[r.charCodeAt(i+2)],c=ft[r.charCodeAt(i+3)],b[s++]=n<<2|o>>4,b[s++]=(o&15)<<4|a>>2,b[s++]=(a&3)<<6|c&63;return R};var dr=typeof ArrayBuffer=="function",dt=(r,t)=>{if(typeof r!="string")return{type:"message",data:Mi(r,t)};let e=r.charAt(0);return e==="b"?{type:"message",data:mr(r.substring(1),t)}:ut[e]?r.length>1?{type:ut[e],data:r.substring(1)}:{type:ut[e]}:lt},mr=(r,t)=>{if(dr){let e=Di(r);return Mi(e,t)}else return{base64:!0,data:r}},Mi=(r,t)=>{switch(t){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var Vi="",Wi=(r,t)=>{let e=r.length,i=new Array(e),s=0;r.forEach((n,o)=>{pt(n,!1,a=>{i[o]=a,++s===e&&t(i.join(Vi))})})},$i=(r,t)=>{let e=r.split(Vi),i=[];for(let s=0;s<e.length;s++){let n=dt(e[s],t);if(i.push(n),n.type==="error")break}return i};function qi(){return new TransformStream({transform(r,t){Ui(r,e=>{let i=e.length,s;if(i<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,i);else if(i<65536){s=new Uint8Array(3);let n=new DataView(s.buffer);n.setUint8(0,126),n.setUint16(1,i)}else{s=new Uint8Array(9);let n=new DataView(s.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(i))}r.data&&typeof r.data!="string"&&(s[0]|=128),t.enqueue(s),t.enqueue(e)})}})}var zt;function Lt(r){return r.reduce((t,e)=>t+e.length,0)}function It(r,t){if(r[0].length===t)return r.shift();let e=new Uint8Array(t),i=0;for(let s=0;s<t;s++)e[s]=r[0][i++],i===r[0].length&&(r.shift(),i=0);return r.length&&i<r[0].length&&(r[0]=r[0].slice(i)),e}function Gi(r,t){zt||(zt=new TextDecoder);let e=[],i=0,s=-1,n=!1;return new TransformStream({transform(o,a){for(e.push(o);;){if(i===0){if(Lt(e)<1)break;let c=It(e,1);n=(c[0]&128)===128,s=c[0]&127,s<126?i=3:s===126?i=1:i=2}else if(i===1){if(Lt(e)<2)break;let c=It(e,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),i=3}else if(i===2){if(Lt(e)<8)break;let c=It(e,8),R=new DataView(c.buffer,c.byteOffset,c.length),b=R.getUint32(0);if(b>Math.pow(2,21)-1){a.enqueue(lt);break}s=b*Math.pow(2,32)+R.getUint32(4),i=3}else{if(Lt(e)<s)break;let c=It(e,s);a.enqueue(dt(n?c:zt.decode(c),t)),i=0}if(s===0||s>r){a.enqueue(lt);break}}}})}var Zt=4;function u(r){if(r)return _r(r)}function _r(r){for(var t in u.prototype)r[t]=u.prototype[t];return r}u.prototype.on=u.prototype.addEventListener=function(r,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(t),this};u.prototype.once=function(r,t){function e(){this.off(r,e),t.apply(this,arguments)}return e.fn=t,this.on(r,e),this};u.prototype.off=u.prototype.removeListener=u.prototype.removeAllListeners=u.prototype.removeEventListener=function(r,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var e=this._callbacks["$"+r];if(!e)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var i,s=0;s<e.length;s++)if(i=e[s],i===t||i.fn===t){e.splice(s,1);break}return e.length===0&&delete this._callbacks["$"+r],this};u.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),e=this._callbacks["$"+r],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(e){e=e.slice(0);for(var i=0,s=e.length;i<s;++i)e[i].apply(this,t)}return this};u.prototype.emitReserved=u.prototype.emit;u.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};u.prototype.hasListeners=function(r){return!!this.listeners(r).length};var N=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,e)=>e(t,0),g=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Hi="arraybuffer";function Ut(r,...t){return t.reduce((e,i)=>(r.hasOwnProperty(i)&&(e[i]=r[i]),e),{})}var gr=g.setTimeout,yr=g.clearTimeout;function P(r,t){t.useNativeTimers?(r.setTimeoutFn=gr.bind(g),r.clearTimeoutFn=yr.bind(g)):(r.setTimeoutFn=g.setTimeout.bind(g),r.clearTimeoutFn=g.clearTimeout.bind(g))}var Er=1.33;function Yi(r){return typeof r=="string"?Sr(r):Math.ceil((r.byteLength||r.size)*Er)}function Sr(r){let t=0,e=0;for(let i=0,s=r.length;i<s;i++)t=r.charCodeAt(i),t<128?e+=1:t<2048?e+=2:t<55296||t>=57344?e+=3:(i++,e+=4);return e}function Bt(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Ki(r){let t="";for(let e in r)r.hasOwnProperty(e)&&(t.length&&(t+="&"),t+=encodeURIComponent(e)+"="+encodeURIComponent(r[e]));return t}function Qi(r){let t={},e=r.split("&");for(let i=0,s=e.length;i<s;i++){let n=e[i].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t}var Dt=class extends Error{constructor(t,e,i){super(t),this.description=e,this.context=i,this.type="TransportError"}},F=class extends u{constructor(t){super(),this.writable=!1,P(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,e,i){return super.emitReserved("error",new Dt(t,e,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){let e=dt(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){let t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){let e=Ki(t);return e.length?"?"+e:""}};var Z=class extends F{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let e=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||e()})),this.writable||(i++,this.once("drain",function(){--i||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){let e=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};$i(t,this.socket.binaryType).forEach(e),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Wi(t,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.opts.secure?"https":"http",e=this.query||{};return this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Bt()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.createUri(t,e)}};var ji=!1;try{ji=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Ji=ji;function wr(){}var te=class extends Z{constructor(t){if(super(t),typeof location<"u"){let e=location.protocol==="https:",i=location.port;i||(i=e?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,e){let i=this.request({method:"POST",data:t});i.on("success",e),i.on("error",(s,n)=>{this.onError("xhr post error",s,n)})}doPoll(){let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(e,i)=>{this.onError("xhr poll error",e,i)}),this.pollXhr=t}},Mt=(()=>{class r extends u{constructor(e,i,s){super(),this.createRequest=e,P(this,s),this._opts=s,this._method=s.method||"GET",this._uri=i,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;let i=Ut(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;let s=this._xhr=this.createRequest(i);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&s.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var n;s.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=wr,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return r.requestsCount=0,r.requests={},r})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Xi);else if(typeof addEventListener=="function"){let r="onpagehide"in g?"pagehide":"unload";addEventListener(r,Xi,!1)}}function Xi(){for(let r in Mt.requests)Mt.requests.hasOwnProperty(r)&&Mt.requests[r].abort()}var br=(function(){let r=zi({xdomain:!1});return r&&r.responseType!==null})(),L=class extends te{constructor(t){super(t);let e=t&&t.forceBase64;this.supportsBinary=br&&!e}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Mt(zi,this.uri(),t)}};function zi(r){let t=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Ji))return new XMLHttpRequest}catch{}if(!t)try{return new g[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var Zi=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",ie=class extends F{get name(){return"websocket"}doOpen(){let t=this.uri(),e=this.opts.protocols,i=Zi?{}:Ut(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,e,i)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let i=t[e],s=e===t.length-1;pt(i,this.supportsBinary,n=>{try{this.doWrite(i,n)}catch{}s&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let t=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=Bt()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}},ee=g.WebSocket||g.MozWebSocket,I=class extends ie{createSocket(t,e,i){return Zi?new ee(t,e,i):e?new ee(t,e):new ee(t)}doWrite(t,e){this.ws.send(e)}};var G=class extends F{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{let e=Gi(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(e).getReader(),s=qi();s.readable.pipeTo(t.writable),this._writer=s.writable.getWriter();let n=()=>{i.read().then(({done:a,value:c})=>{a||(this.onPacket(c),n())}).catch(a=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let i=t[e],s=e===t.length-1;this._writer.write(i).then(()=>{s&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}};var re={websocket:I,webtransport:G,polling:L};var Ar=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Tr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function tt(r){if(r.length>8e3)throw"URI too long";let t=r,e=r.indexOf("["),i=r.indexOf("]");e!=-1&&i!=-1&&(r=r.substring(0,e)+r.substring(e,i).replace(/:/g,";")+r.substring(i,r.length));let s=Ar.exec(r||""),n={},o=14;for(;o--;)n[Tr[o]]=s[o]||"";return e!=-1&&i!=-1&&(n.source=t,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=vr(n,n.path),n.queryKey=Cr(n,n.query),n}function vr(r,t){let e=/\/{2,9}/g,i=t.replace(e,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function Cr(r,t){let e={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,s,n){s&&(e[s]=n)}),e}var se=typeof addEventListener=="function"&&typeof removeEventListener=="function",Vt=[];se&&addEventListener("offline",()=>{Vt.forEach(r=>r())},!1);var Wt=(()=>{class r extends u{constructor(e,i){if(super(),this.binaryType=Hi,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(i=e,e=null),e){let s=tt(e);i.hostname=s.host,i.secure=s.protocol==="https"||s.protocol==="wss",i.port=s.port,s.query&&(i.query=s.query)}else i.host&&(i.hostname=tt(i.host).host);P(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(s=>{let n=s.prototype.name;this.transports.push(n),this._transportsByName[n]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Qi(this.opts.query)),se&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Vt.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let i=Object.assign({},this.opts.query);i.EIO=Zt,i.transport=e,this.id&&(i.sid=this.id);let s=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let i=this.createTransport(e);i.open(),this.setTransport(i)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let i=new Error("server error");i.code=e.data,this._onError(i);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let s=0;s<this.writeBuffer.length;s++){let n=this.writeBuffer[s].data;if(n&&(i+=Yi(n)),s>0&&i>this._maxPayload)return this.writeBuffer.slice(0,s);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,N(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,i,s){return this._sendPacket("message",e,i,s),this}send(e,i,s){return this._sendPacket("message",e,i,s),this}_sendPacket(e,i,s,n){if(typeof i=="function"&&(n=i,i=void 0),typeof s=="function"&&(n=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;let o={type:e,data:i,options:s};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),e()},s=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),se&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let s=Vt.indexOf(this._offlineEventListener);s!==-1&&Vt.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,i),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=Zt,r})(),$t=class extends Wt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let e=this.createTransport(t),i=!1;Wt.priorWebsocketSuccess=!1;let s=()=>{i||(e.send([{type:"ping",data:"probe"}]),e.once("packet",U=>{if(!i)if(U.type==="pong"&&U.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;Wt.priorWebsocketSuccess=e.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(b(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{let rt=new Error("probe error");rt.transport=e.name,this.emitReserved("upgradeError",rt)}}))};function n(){i||(i=!0,b(),e.close(),e=null)}let o=U=>{let rt=new Error("probe error: "+U);rt.transport=e.name,n(),this.emitReserved("upgradeError",rt)};function a(){o("transport closed")}function c(){o("socket closed")}function R(U){e&&U.name!==e.name&&n()}let b=()=>{e.removeListener("open",s),e.removeListener("error",o),e.removeListener("close",a),this.off("close",c),this.off("upgrading",R)};e.once("open",s),e.once("error",o),e.once("close",a),this.once("close",c),this.once("upgrading",R),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||e.open()},200):e.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let e=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&e.push(t[i]);return e}},et=class extends $t{constructor(t,e={}){let i=typeof t=="object"?t:e;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(s=>re[s]).filter(s=>!!s)),super(t,i)}};var mt=class extends Z{doPoll(){this._fetch().then(t=>{if(!t.ok)return this.onError("fetch read error",t.status,t);t.text().then(e=>this.onData(e))}).catch(t=>{this.onError("fetch read error",t)})}doWrite(t,e){this._fetch(t).then(i=>{if(!i.ok)return this.onError("fetch write error",i.status,i);e()}).catch(i=>{this.onError("fetch write error",i)})}_fetch(t){var e;let i=t!==void 0,s=new Headers(this.opts.extraHeaders);return i&&s.set("content-type","text/plain;charset=UTF-8"),(e=this.socket._cookieJar)===null||e===void 0||e.appendCookies(s),fetch(this.uri(),{method:i?"POST":"GET",body:i?t:null,headers:s,credentials:this.opts.withCredentials?"include":"omit"}).then(n=>{var o;return(o=this.socket._cookieJar)===null||o===void 0||o.parseCookies(n.headers.getSetCookie()),n})}};var Sn=et.protocol;function tr(r,t="",e){let i=r;e=e||typeof location<"u"&&location,r==null&&(r=e.protocol+"//"+e.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=e.protocol+r:r=e.host+r),/^(https?|wss?):\/\//.test(r)||(typeof e<"u"?r=e.protocol+"//"+r:r="https://"+r),i=tt(r)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let n=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+t,i.href=i.protocol+"://"+n+(e&&e.port===i.port?"":":"+i.port),i}var le={};ye(le,{Decoder:()=>ce,Encoder:()=>ae,PacketType:()=>h,protocol:()=>ue});var Rr=typeof ArrayBuffer=="function",Or=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,er=Object.prototype.toString,kr=typeof Blob=="function"||typeof Blob<"u"&&er.call(Blob)==="[object BlobConstructor]",xr=typeof File=="function"||typeof File<"u"&&er.call(File)==="[object FileConstructor]";function gt(r){return Rr&&(r instanceof ArrayBuffer||Or(r))||kr&&r instanceof Blob||xr&&r instanceof File}function _t(r,t){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let e=0,i=r.length;e<i;e++)if(_t(r[e]))return!0;return!1}if(gt(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return _t(r.toJSON(),!0);for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e)&&_t(r[e]))return!0;return!1}function ir(r){let t=[],e=r.data,i=r;return i.data=ne(e,t),i.attachments=t.length,{packet:i,buffers:t}}function ne(r,t){if(!r)return r;if(gt(r)){let e={_placeholder:!0,num:t.length};return t.push(r),e}else if(Array.isArray(r)){let e=new Array(r.length);for(let i=0;i<r.length;i++)e[i]=ne(r[i],t);return e}else if(typeof r=="object"&&!(r instanceof Date)){let e={};for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=ne(r[i],t));return e}return r}function rr(r,t){return r.data=oe(r.data,t),delete r.attachments,r}function oe(r,t){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<t.length)return t[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=oe(r[e],t);else if(typeof r=="object")for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=oe(r[e],t));return r}var Nr=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ue=5,h=(function(r){return r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK",r})(h||{}),ae=class{constructor(t){this.replacer=t}encode(t){return(t.type===h.EVENT||t.type===h.ACK)&&_t(t)?this.encodeAsBinary({type:t.type===h.EVENT?h.BINARY_EVENT:h.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let e=""+t.type;return(t.type===h.BINARY_EVENT||t.type===h.BINARY_ACK)&&(e+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(e+=t.nsp+","),t.id!=null&&(e+=t.id),t.data!=null&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){let e=ir(t),i=this.encodeAsString(e.packet),s=e.buffers;return s.unshift(i),s}};function sr(r){return Object.prototype.toString.call(r)==="[object Object]"}var ce=class r extends u{constructor(t){super(),this.reviver=t}add(t){let e;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);let i=e.type===h.BINARY_EVENT;i||e.type===h.BINARY_ACK?(e.type=i?h.EVENT:h.ACK,this.reconstructor=new he(e),e.attachments===0&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else if(gt(t)||t.base64)if(this.reconstructor)e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let e=0,i={type:Number(t.charAt(0))};if(h[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===h.BINARY_EVENT||i.type===h.BINARY_ACK){let n=e+1;for(;t.charAt(++e)!=="-"&&e!=t.length;);let o=t.substring(n,e);if(o!=Number(o)||t.charAt(e)!=="-")throw new Error("Illegal attachments");i.attachments=Number(o)}if(t.charAt(e+1)==="/"){let n=e+1;for(;++e&&!(t.charAt(e)===","||e===t.length););i.nsp=t.substring(n,e)}else i.nsp="/";let s=t.charAt(e+1);if(s!==""&&Number(s)==s){let n=e+1;for(;++e;){let o=t.charAt(e);if(o==null||Number(o)!=o){--e;break}if(e===t.length)break}i.id=Number(t.substring(n,e+1))}if(t.charAt(++e)){let n=this.tryParse(t.substr(e));if(r.isPayloadValid(i.type,n))i.data=n;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,e){switch(t){case h.CONNECT:return sr(e);case h.DISCONNECT:return e===void 0;case h.CONNECT_ERROR:return typeof e=="string"||sr(e);case h.EVENT:case h.BINARY_EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&Nr.indexOf(e[0])===-1);case h.ACK:case h.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},he=class{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){let e=rr(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function w(r,t,e){return r.on(t,e),function(){r.off(t,e)}}var Pr=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),H=class extends u{constructor(t,e,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[w(t,"open",this.onopen.bind(this)),w(t,"packet",this.onpacket.bind(this)),w(t,"error",this.onerror.bind(this)),w(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){var i,s,n;if(Pr.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;let o={type:h.EVENT,data:e};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof e[e.length-1]=="function"){let b=this.ids++,U=e.pop();this._registerAckCallback(b,U),o.id=b}let a=(s=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||s===void 0?void 0:s.writable,c=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!a||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,e){var i;let s=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(s===void 0){this.acks[t]=e;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);e.call(this,new Error("operation has timed out"))},s),o=(...a)=>{this.io.clearTimeoutFn(n),e.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...e){return new Promise((i,s)=>{let n=(o,a)=>o?s(o):i(a);n.withError=!0,e.push(n),this.emit(t,...e)})}_addToQueue(t){let e;typeof t[t.length-1]=="function"&&(e=t.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((s,...n)=>i!==this._queue[0]?void 0:(s!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(s)):(this._queue.shift(),e&&e(null,...n)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;let e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:h.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){let i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case h.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case h.EVENT:case h.BINARY_EVENT:this.onevent(t);break;case h.ACK:case h.BINARY_ACK:this.onack(t);break;case h.DISCONNECT:this.ondisconnect();break;case h.CONNECT_ERROR:this.destroy();let i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){let e=t.data||[];t.id!=null&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){let e=this._anyListeners.slice();for(let i of e)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){let e=this,i=!1;return function(...s){i||(i=!0,e.packet({type:h.ACK,id:t,data:s}))}}onack(t){let e=this.acks[t.id];typeof e=="function"&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:h.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){let e=this._anyListeners;for(let i=0;i<e.length;i++)if(t===e[i])return e.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){let e=this._anyOutgoingListeners;for(let i=0;i<e.length;i++)if(t===e[i])return e.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let e=this._anyOutgoingListeners.slice();for(let i of e)i.apply(this,t.data)}}};function Y(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Y.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),e=Math.floor(t*this.jitter*r);r=(Math.floor(t*10)&1)==0?r-e:r+e}return Math.min(r,this.max)|0};Y.prototype.reset=function(){this.attempts=0};Y.prototype.setMin=function(r){this.ms=r};Y.prototype.setMax=function(r){this.max=r};Y.prototype.setJitter=function(r){this.jitter=r};var K=class extends u{constructor(t,e){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.opts=e,P(this,e),this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor((i=e.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Y({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this._readyState="closed",this.uri=t;let s=e.parser||le;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=e.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(e=this.backoff)===null||e===void 0||e.setMin(t),this)}randomizationFactor(t){var e;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(e=this.backoff)===null||e===void 0||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(e=this.backoff)===null||e===void 0||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new et(this.uri,this.opts);let e=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let s=w(e,"open",function(){i.onopen(),t&&t()}),n=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=w(e,"error",n);if(this._timeout!==!1){let a=this._timeout,c=this.setTimeoutFn(()=>{s(),n(new Error("timeout")),e.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(w(t,"ping",this.onping.bind(this)),w(t,"data",this.ondata.bind(this)),w(t,"error",this.onerror.bind(this)),w(t,"close",this.onclose.bind(this)),w(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(e){this.onclose("parse error",e)}}ondecoded(t){N(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new H(this,t,e),this.nsps[t]=i),i}_destroy(t){let e=Object.keys(this.nsps);for(let i of e)if(this.nsps[i].active)return;this._close()}_packet(t){let e=this.encoder.encode(t);for(let i=0;i<e.length;i++)this.engine.write(e[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,e){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let e=this.backoff.duration();this._reconnecting=!0;let i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(s=>{s?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",s)):t.onreconnect()}))},e);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}};var yt={};function Q(r,t){typeof r=="object"&&(t=r,r=void 0),t=t||{};let e=tr(r,t.path||"/socket.io"),i=e.source,s=e.id,n=e.path,o=yt[s]&&n in yt[s].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o,c;return a?c=new K(i,t):(yt[s]||(yt[s]=new K(i,t)),c=yt[s]),e.query&&!t.query&&(t.query=e.queryKey),c.socket(e.path,t)}Object.assign(Q,{Manager:K,Socket:H,io:Q,connect:Q});var it=class r{config;appRef;subscribersCounter={};eventObservables$={};namespaces={};ioSocket;emptyConfig={url:"",options:{}};constructor(t,e){this.config=t,this.appRef=e,t===void 0&&(t=this.emptyConfig);let i=t.url,s=t.options,n=Q?Q:pe;this.ioSocket=n(i,s)}get auth(){return this.ioSocket.auth}set auth(t){this.ioSocket.auth=t}get io(){return this.ioSocket.io}get open(){return this.connect}get close(){return this.disconnect}of(t){if(!t||t==="/")return this;let e=this.namespaces[t];if(e)return e;let a=this.config,{url:i}=a,s=ge(a,["url"]),n=O({url:!i.endsWith("/")&&!t.startsWith("/")?`${i}/${t}`:`${i}${t}`},s),o=new r(n,this.appRef);return this.namespaces[t]=o,o}on(t,e){return this.ioSocket.on(t,e),this}once(t,e){return this.ioSocket.once(t,e),this}connect(){return this.ioSocket.connect(),this}disconnect(){return this.ioSocket.disconnect(),this}emit(t,...e){return this.ioSocket.emit(t,...e),this}send(...t){return this.ioSocket.send.apply(this.ioSocket,arguments),this}emitWithAck(t,...e){return this.ioSocket.emitWithAck(t,...e)}removeListener(t,e){return this.ioSocket.removeListener(t,e),this}removeAllListeners(t){return this.ioSocket.removeAllListeners(t),this}fromEvent(t){return this.subscribersCounter[t]||(this.subscribersCounter[t]=0),this.subscribersCounter[t]++,this.eventObservables$[t]||(this.eventObservables$[t]=new Se(e=>{let i=s=>{e.next(s),this.appRef.tick()};return this.ioSocket.on(t,i),()=>{this.subscribersCounter[t]--,this.subscribersCounter[t]===0&&(this.ioSocket.removeListener(t,i),delete this.eventObservables$[t])}}).pipe(Ae())),this.eventObservables$[t]}fromOneTimeEvent(t){return new Promise(e=>this.once(t,e))}listeners(t){return this.ioSocket.listeners(t)}hasListeners(t){return this.ioSocket.hasListeners(t)}listenersAny(){return this.ioSocket.listenersAny()}listenersAnyOutgoing(){return this.ioSocket.listenersAnyOutgoing()}off(t,e){return this.ioSocket.off(t,e),this}offAny(t){return this.ioSocket.offAny(t),this}offAnyOutgoing(t){return this.ioSocket.offAnyOutgoing(t),this}onAny(t){return this.ioSocket.onAny(t),this}onAnyOutgoing(t){return this.ioSocket.onAnyOutgoing(t),this}prependAny(t){return this.ioSocket.prependAny(t),this}prependAnyOutgoing(t){return this.ioSocket.prependAnyOutgoing(t),this}timeout(t){return this.ioSocket.timeout(t),this}get volatile(){let t=this.ioSocket.volatile;return this}get active(){return this.ioSocket.active}get connected(){return this.ioSocket.connected}get disconnected(){return this.ioSocket.disconnected}get recovered(){return this.ioSocket.recovered}get id(){return this.ioSocket.id}compress(t){return this.ioSocket.compress(t),this}};function Fr(r,t){return new it(r,t)}var nr=new ve("__SOCKET_IO_CONFIG__"),uo=(()=>{class r{static forRoot(e){return{ngModule:r,providers:[{provide:nr,useValue:e},{provide:it,useFactory:Fr,deps:[nr,xe]}]}}static \u0275fac=function(i){return new(i||r)};static \u0275mod=Oe({type:r});static \u0275inj=Te({})}return r})();var fe={BASE:`${ai}/notifications`,UNREAD:"unread"},qt=fe.BASE;var d=(function(r){return r.ADD="add",r.UPDATE="update",r.DELETE="delete",r.DELETE_PERMANENTLY="deletePermanently",r})(d||{});var y=(function(r){return r.COMMENTS="comments",r.SPACES="spaces",r.SPACE_ROOTS="spaces_roots",r.SHARES="shares",r.LINKS="links",r.SYNC="sync",r.AUTH_LOCKED="auth_locked",r.AUTH_2FA="auth_2fa",r.UNLOCK_REQUEST="unlock_request",r.UPDATE_AVAILABLE="server_update_available",r})(y||{}),yo={COMMENTS:"commented",SPACES:{[d.ADD]:"You now have access to the space",[d.DELETE]:"You no longer have access to the space",[d.DELETE_PERMANENTLY]:"This space has been permanently deleted"},SPACE_ROOTS:{[d.ADD]:"anchored",[d.DELETE]:"unanchored"},SHARES:{[d.ADD]:"shared with you",[d.DELETE]:"no longer share with you"},SHARES_WITHOUT_OWNER:{[d.ADD]:"You now have access to the share",[d.DELETE]:"You no longer have access to the share",[d.DELETE_PERMANENTLY]:"You are no longer a member of the parent share, your child share has been deleted"},LINKS:{[d.ADD]:"shared with you",[d.UPDATE]:"You now have access to the space"},SYNC:{[d.DELETE]:"You are no longer synchronizing"},AUTH_2FA:{[d.ADD]:"Two-factor authentication (2FA) on your account has been enabled",[d.DELETE]:"Two-factor authentication (2FA) on your account has been disabled"},AUTH_LOCKED:{[d.DELETE]:"Your account has been locked after several unsuccessful authentication attempts"},UNLOCK_REQUEST:"sends you a request to unlock the file",UPDATE_AVAILABLE:"A new update is available"};var or=ei;var ar={[y.COMMENTS]:or,[y.SPACES]:ct.SPACES,[y.SPACE_ROOTS]:ct.SPACES,[y.SHARES]:ct.SHARES,[y.LINKS]:ct.LINKS,[y.SYNC]:Ei.SYNC,[y.UNLOCK_REQUEST]:ti};var Gt=class{constructor(t){this.soonRead=!1,Object.assign(this,t),this.fromUser?this.fromUser.avatarUrl=M(this.fromUser.login):this.fromUser={id:-1,login:null,email:null,fullName:"Info",avatarUrl:null},this.appIcon=ar[this.content.app],this.setMainElement()}setMainElement(){if(!(this.content.app===y.COMMENTS||this.content.app===y.SHARES||this.content.app===y.UPDATE_AVAILABLE||this.content.app===y.SYNC)&&this.content?.url){let t=this.content.url.split("/");t.length>1&&(this.mainElement=t[t.length-1])}}};var cr=(()=>{let t=class t{constructor(){this.http=p(Tt),this.store=p(Pt),this.layout=p(z)}getNotifications(i=!1){return this.http.get(`${qt}${i?`/${fe.UNREAD}`:""}`).pipe(S(s=>s.map(n=>new Gt(n))))}wasReadNotification(i){return this.http.patch(`${qt}/${i}`,null)}deleteNotification(i){return this.http.delete(`${qt}${i?`/${i}`:""}`)}checkUnreadNotifications(i=!1){this.getNotifications().subscribe(s=>{let n;if(i&&s.length){let o=s[0];n=this.layout.sendNotification("info",o.fromUser.fullName,this.layout.translateString(`${this.layout.translateString(o.content.event)}: <b>${o.content.element}</b>`),null,{enableHtml:!0})}else{let o=s.filter(a=>!a.wasRead).length;o&&(n=this.layout.sendNotification("info","Notifications",this.layout.translateString(o===1?"one_notification":"nb_notifications",{nb:o})))}n&&n.onTap.pipe(be(1)).subscribe(()=>this.layout.showRSideBarTab(gi.NOTIFICATIONS,!0)),this.store.notifications.set(s)})}};t.\u0275fac=function(s){return new(s||t)},t.\u0275prov=wt({token:t,factory:t.\u0275fac,providedIn:"root"});let r=t;return r})();var E=(function(r){return r.ACCESS="access",r.ACCESS_2FA="access_2fa",r.REFRESH="refresh",r.WS="ws",r.CSRF="csrf",r.CSRF_2FA="csrf_2fa",r})(E||{});var Yo="sync-in-csrf";var de=6;var hr="sync-in-two-fa-code",ur="sync-in-two-fa-password",Ko={[E.ACCESS]:"/",[E.REFRESH]:Ci,[E.WS]:Ri,[E.CSRF]:"/",[E.ACCESS_2FA]:ki,[E.CSRF_2FA]:"/"},Qo=[E.REFRESH,E.ACCESS,E.WS,E.CSRF],jo=[E.ACCESS_2FA,E.CSRF_2FA];var Ir=["Password"];function Ur(r,t){r&1&&(f(0,"label",1),A(1,"Password"),_())}function Br(r,t){if(r&1){let e=st();f(0,"div",5),B("click",function(){W(e);let s=D();return $(s.randomPassword())}),f(1,"span"),J(2,"fa-icon",6),_()()}if(r&2){let e=D();m(2),C("icon",e.icons.faDice)}}var lr=(()=>{let t=class t{constructor(){this.passwordChange=new Re,this.passwordMinLength=8,this.showGenerator=!1,this.showLabel=!1,this.disabled=!1,this.isRequired=!1,this.focus=!1,this.centered=!1,this.locale=p(Ot),this.toggleVisiblePassword=yi,this.icons={faEye:Ze,faEyeSlash:ri,faDice:si}}ngOnInit(){this.focus&&setTimeout(()=>{this.passwordElement.nativeElement.focus(),this.passwordElement.nativeElement.select()},0)}randomPassword(){this.disabled||this.passwordChange.emit(mi(this.passwordMinLength+2))}};t.\u0275fac=function(s){return new(s||t)},t.\u0275cmp=bt({type:t,selectors:[["app-input-password"]],viewQuery:function(s,n){if(s&1&&Ne(Ir,7),s&2){let o;Pe(o=Fe())&&(n.passwordElement=o.first)}},inputs:{password:"password",passwordMinLength:"passwordMinLength",placeholder:"placeholder",showGenerator:"showGenerator",showLabel:"showLabel",disabled:"disabled",isRequired:"isRequired",focus:"focus",centered:"centered"},outputs:{passwordChange:"passwordChange"},decls:9,vars:16,consts:[["Password",""],["for","password","l10nTranslate",""],["id","password",1,"input-group","input-group-sm",2,"min-width","150px"],["autocomplete","off","type","password",1,"form-control","form-control-sm","pe-0",3,"ngModelChange","keyup","ngModel","disabled","placeholder","required"],[1,"input-group-text","cursor-pointer"],[1,"input-group-text","cursor-pointer",3,"click"],[3,"icon"]],template:function(s,n){if(s&1){let o=st();k(0,Ur,2,0,"label",1),f(1,"div",2)(2,"input",3,0),Me(4,"translate"),De("ngModelChange",function(c){return W(o),Be(n.password,c)||(n.password=c),$(c)}),B("keyup",function(){return W(o),$(n.passwordChange.emit(n.password))}),_(),k(5,Br,3,1,"div",4),f(6,"div",5),B("click",function(){W(o);let c=Yt(3);return $(n.toggleVisiblePassword(c))}),f(7,"span"),J(8,"fa-icon",6),_()()()}if(s&2){let o=Yt(3);x(n.showLabel?0:-1),m(2),Le("padding-left",n.centered?"2rem":""),At("is-invalid",n.isRequired&&(n.password==null?null:n.password.length)<n.passwordMinLength)("text-center",n.centered),Ue("ngModel",n.password),C("disabled",n.disabled)("placeholder",Ve(4,13,n.placeholder,n.locale.language))("required",n.isRequired),m(3),x(n.showGenerator?5:-1),m(3),C("icon",o.type==="text"?n.icons.faEye:n.icons.faEyeSlash)}},dependencies:[Je,vt,Ct,Ke,qe,Rt,Nt,kt,Xe],encapsulation:2});let r=t;return r})();var pr=(()=>{let t=class t{constructor(){this.autoFocus=!0,this.autoSelect=!0,this.elementRef=p(Ce)}ngOnInit(){setTimeout(()=>{this.autoFocus&&this.elementRef.nativeElement.focus(),this.autoSelect&&this.elementRef.nativeElement.select()},0)}};t.\u0275fac=function(s){return new(s||t)},t.\u0275dir=ke({type:t,selectors:[["","appAutofocus",""]],inputs:{autoFocus:"autoFocus",autoSelect:"autoSelect"}});let r=t;return r})();function Dr(r,t){r&1&&(f(0,"span",3),A(1,"Two-Factor Authentication"),_())}function Mr(r,t){r&1&&(f(0,"span",3),A(1,"Password Authentication"),_())}function Vr(r,t){if(r&1&&A(0),r&2){let e=D();Ie(" ",e.hasError," ")}}function Wr(r,t){r&1&&A(0," Enter your password ")}function $r(r,t){r&1&&A(0," Valid with your TOTP code ")}function qr(r,t){if(r&1){let e=st();f(0,"div",9)(1,"app-input-password",13),B("passwordChange",function(s){W(e);let n=D();return $(n.updatePassword(s))}),_()()}if(r&2){let e=D();m(),C("password",e.twoFaForm.value.password)("focus",!0)("centered",!0)}}function Gr(r,t){r&1&&(f(0,"div",14),A(1,"Valid with your TOTP code"),_())}function Hr(r,t){if(r&1&&(k(0,Gr,2,0,"div",14),f(1,"div",15),J(2,"input",16),_()),r&2){let e=D();x(e.withPassword?0:-1),m(2),C("autoFocus",!e.withPassword)("autoSelect",!e.withPassword)("maxlength",e.twoFaCodelength)}}var fr=(()=>{let t=class t{constructor(){this.withPassword=!1,this.withTwoFaEnabled=!0,this.submitted=!1,this.hasError=null,this.icons={faKey:ze,faLock:ii},this.twoFaCodelength=de,this.locale=p(Ot),this.fb=p(je),this.layout=p(z)}ngOnInit(){this.twoFaForm=this.fb.group({totpCode:this.fb.control("",this.withTwoFaEnabled?[nt.required,nt.pattern(new RegExp(`^\\d{${de}}$`))]:null),password:this.fb.control("",this.withPassword?[nt.required,nt.minLength(8)]:null)})}onClose(i=!1){this.isValid(i),this.layout.closeDialog()}onSubmit(){this.submitted=!0;let i=new We(O(O({},this.withTwoFaEnabled?{[hr]:this.twoFaForm.value.totpCode}:{}),this.withPassword?{[ur]:this.twoFaForm.value.password}:{}));this.onClose(i)}updatePassword(i){this.twoFaForm.patchValue({password:i})}};t.\u0275fac=function(s){return new(s||t)},t.\u0275cmp=bt({type:t,selectors:[["app-user-auth-2fa-verify-dialog"]],inputs:{withPassword:"withPassword",withTwoFaEnabled:"withTwoFaEnabled"},decls:20,vars:9,consts:[[1,"modal-header","align-items-center","justify-content-center"],[1,"modal-title"],[1,"me-2",3,"icon"],["l10nTranslate",""],[1,"modal-body","modal-auth-verify-2fa"],[1,"card","shadow-sm"],[1,"card-body"],["l10nTranslate","",1,"d-flex","justify-content-center","align-items-center","mb-3"],[3,"ngSubmit","formGroup"],[1,"mb-4"],[1,"d-grid","gap-2"],["type","submit","l10nTranslate","",1,"btn","btn-primary",3,"disabled"],["type","button","l10nTranslate","",1,"btn","btn-secondary",3,"click"],["id","password","placeholder","\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",3,"passwordChange","password","focus","centered"],["l10nTranslate","",1,"text-align-center","mb-3"],[1,"mb-3"],["appAutofocus","","type","text","formControlName","totpCode","placeholder","\u2022\u2022\u2022\u2022\u2022\u2022","inputmode","numeric","autocomplete","one-time-code","name","totp",1,"form-control","text-center","fs-4",3,"autoFocus","autoSelect","maxlength"]],template:function(s,n){s&1&&(f(0,"div",0)(1,"h4",1),J(2,"fa-icon",2),k(3,Dr,2,0,"span",3)(4,Mr,2,0,"span",3),_()(),f(5,"div",4)(6,"div",5)(7,"div",6)(8,"p",7),k(9,Vr,1,1)(10,Wr,1,0)(11,$r,1,0),_(),f(12,"form",8),B("ngSubmit",function(){return n.onSubmit()}),k(13,qr,2,3,"div",9),k(14,Hr,3,4),f(15,"div",10)(16,"button",11),A(17,"Confirm"),_(),f(18,"button",12),B("click",function(){return n.onClose()}),A(19,"Cancel"),_()()()()()()),s&2&&(m(2),C("icon",n.icons.faLock),m(),x(n.withTwoFaEnabled?3:4),m(5),At("text-danger",n.hasError),m(),x(n.hasError?9:n.withPassword?10:11),m(3),C("formGroup",n.twoFaForm),m(),x(n.withPassword?13:-1),m(),x(n.withTwoFaEnabled?14:-1),m(2),C("disabled",n.twoFaForm.invalid||n.submitted))},dependencies:[Nt,kt,pr,Rt,Ge,vt,Ct,$e,Qe,He,Ye,lr],encapsulation:2});let r=t;return r})();var Ht=class{constructor(t){this.parentGroup=t.parentGroup,this.members=t.members.map(e=>new T(e))}};var j=class{constructor(t){this.newly=0,this.currentAccessHover=!1,this.setManagers(t),Object.assign(this,t),this.avatarUrl=M(t.login),this.userIsActiveText=this.isActive?"active":"suspended",this.hTimeAgo=oi(this.currentAccess).fromNow(!0),this.newly=at(this.currentAccess)}setManagers(t){t?.managers&&(t.managers=t.managers.map(e=>new T(e)))}};var St=class{constructor(t){this.setOnlineStatus(_i("status",t)),this.avatarUrl=M(t.login),Object.assign(this,t)}setOnlineStatus(t){this.onlineStatus=t,this.onlineTextStatus=ni[t]}};var oc=(()=>{let t=class t{constructor(){this.http=p(Tt),this.layout=p(z),this.store=p(Pt),this.webSocket=p(it),this.notifications=p(cr),this.webSocket.fromEvent("connect").subscribe(()=>this.notifications.checkUnreadNotifications()),this.webSocket.fromEvent("disconnect").subscribe(()=>this.store.onlineUsers.set([])),this.webSocket.fromEvent(vi.EVENTS.NOTIFICATION).subscribe(()=>this.notifications.checkUnreadNotifications(!0)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_USER).pipe(S(i=>new St(i))).subscribe(i=>this.newOnlineUser(i)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_USERS).pipe(S(i=>i.map(s=>new St(s)))).subscribe(i=>this.setOnlineUsers(i)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_STATUS).subscribe(i=>this.receiveOnlineStatus(i))}get user(){return this.store.user.getValue()}initUser(i,s=!1){this.refreshAvatar(),this.layout.setLanguage(i.language).catch(console.error),this.store.userImpersonate.set(s||i.impersonated),this.store.user.next(i),this.checkQuota(this.store.user.getValue()),s&&this.disconnectWebSocket(),this.connectWebSocket()}connectWebSocket(){this.webSocket.ioSocket.io.opts.query={onlineStatus:this.user.onlineStatus},this.webSocket.connect()}disconnectWebSocket(){this.webSocket.disconnect()}setOnlineUsers(i){this.store.onlineUsers.set(i)}newOnlineUser(i){this.store.onlineUsers().find(s=>s.id===i.id)?this.receiveOnlineStatus({userId:i.id,status:i.onlineStatus}):this.store.onlineUsers.update(s=>[i,...s])}userHavePermission(i){return this.user.isAdmin?!0:this.user?this.user.applications.indexOf(i)!==-1:!1}browseGroup(i){return this.http.get(`${pi}${i?`/${i}`:""}`).pipe(S(s=>new Ht(s)))}createPersonalGroup(i){return this.http.post(q,i).pipe(S(s=>new T(s)))}updatePersonalGroup(i,s){return this.http.put(`${q}/${i}`,s).pipe(S(n=>new T(n)))}leavePersonalGroup(i){return this.http.delete(`${fi}/${i}`)}addUsersToGroup(i,s){return this.http.patch(`${q}/${i}/${ot.USERS}`,s)}deletePersonalGroup(i){return this.http.delete(`${q}/${i}`)}updateUserFromPersonalGroup(i,s,n){return this.http.patch(`${q}/${i}/${ot.USERS}/${s}`,n)}removeUserFromGroup(i,s){return this.http.delete(`${q}/${i}/${ot.USERS}/${s}`)}listGuests(){return this.http.get(X).pipe(S(i=>i.map(s=>new j(s))))}getGuest(i){return this.http.get(`${X}/${i}`).pipe(S(s=>new j(s)))}createGuest(i){return this.http.post(X,i).pipe(S(s=>new j(s)))}updateGuest(i,s){return this.http.put(`${X}/${i}`,s).pipe(S(n=>n?new j(n):null))}deleteGuest(i){return this.http.delete(`${X}/${i}`)}genAvatar(){this.http.patch(jt,null).subscribe({next:()=>this.refreshAvatar(),error:i=>this.layout.sendNotification("error","Configuration","Avatar",i)})}uploadAvatar(i){let s=new FormData;s.append("file",i),this.http.put(jt,s).subscribe({next:()=>this.refreshAvatar(),error:n=>this.layout.sendNotification("error","Configuration","Avatar",n)})}changePassword(i,s){return this.http.put(hi,i,{headers:s})}changeLanguage(i){return this.http.put(ci,i)}changeNotification(i){return this.http.put(ui,i)}changeStorageIndexing(i){return this.http.put(li,i)}changeOnlineStatus(i,s=!0){this.webSocket.emit(ht.EVENTS.ONLINE_STATUS,{status:i,store:s})}receiveOnlineStatus(i){this.user.id===i.userId?this.user.onlineStatus=i.status:this.store.onlineUsers().length&&this.store.onlineUsers.update(s=>s.map(n=>n.id===i.userId?_e(O({},n),{onlineStatus:i.status}):n))}searchMembers(i,s=[]){return this.http.request("search",ot.BASE,{body:i}).pipe(S(n=>n.map(o=>new T(o,s))),we(()=>[]))}setMenusVisibility(i){for(let s of i)if(!(s.id&&(s.hide=!this.userHavePermission(s.id),s.hide))&&(s.checks?.length&&(s.hide=!s.checks.map(n=>n.negate?!this[n.prop][n.value]:this[n.prop][n.value]).every(n=>!!n)),s.submenus?.length&&this.setMenusVisibility(s.submenus),s.title===wi.FILES)){for(let n of s.submenus)if(!n.hide){s.link=n.link;break}}}refreshAvatar(){this.store.userAvatarUrl.next(Si())}checkAppStoreAvailability(){this.http.get(`${Qt.BASE}/${Qt.APP_STORE}`).subscribe({next:i=>this.store.appStoreManifest.set(i),error:i=>console.error(i)})}listAppPasswords(i){return this.http.get(xt,{headers:i})}generateAppPassword(i,s){return this.http.post(xt,i,{headers:s})}deleteAppPassword(i){return this.http.delete(`${xt}/${i}`)}init2Fa(){return this.http.get(Jt)}enable2Fa(i){return this.http.post(Jt,i)}disable2Fa(i){return this.http.post(Oi,i)}adminResetUser2Fa(i,s){return this.http.post(`${xi}/${i}`,null,{headers:s})}auth2FaVerifyDialog(i=!1){return Ee(this,null,function*(){let s=this.store.server().twoFaEnabled&&this.user.twoFaEnabled;if(i||s)return new Promise(n=>{let o=this.layout.openDialog(fr,"xs",{initialState:{withPassword:i,withTwoFaEnabled:s}},{keyboard:!1});o.content.isValid=a=>{n(a)}})})}checkQuota(i){if(!(i.isGuest||i.isLink)&&i.storageQuota){let s=Math.round(100/i.storageQuota*(i.storageQuota-i.storageUsage));s<=1?this.layout.sendNotification("error","Storage Quota","No more space available",null,{disableTimeOut:!0,closeButton:!0}):s<=5?this.layout.sendNotification("warning","Storage Quota",this.layout.translateString("available_space_is_low",{nb:s}),null,{disableTimeOut:!0,closeButton:!0}):s<=10&&this.layout.sendNotification("info","Storage Quota",this.layout.translateString("available_space_is_low",{nb:s}),null,{disableTimeOut:!0,closeButton:!0})}}};t.\u0275fac=function(s){return new(s||t)},t.\u0275prov=wt({token:t,factory:t.\u0275fac,providedIn:"root"});let r=t;return r})();export{us as a,ls as b,Ci as c,ki as d,Yo as e,de as f,hr as g,ur as h,uo as i,y as j,cr as k,lr as l,pr as m,V as n,Ti as o,jr as p,Jr as q,Xr as r,T as s,os as t,Ht as u,j as v,oc as w};
1
+ import{$a as at,B as Kt,Ba as di,Cb as z,I as ni,Ma as mi,Mb as wi,Na as _i,Nb as ct,Pb as bi,Qb as Ai,Ua as gi,W as ai,X as Qt,_ as ot,aa as ci,ab as yi,ba as hi,ca as xt,da as ui,ea as li,fa as jt,ga as q,ha as pi,ia as fi,ja as X,qb as Ei,tb as M,ub as Si,vb as Pt}from"./chunk-FCR5AEHR.js";import{Aa as Ce,Bb as st,Bd as je,Cd as Je,Dd as Rt,Eb as B,Ed as Ot,Ef as ii,G as we,Gb as D,Jd as Xe,Kb as Ne,Kd as kt,L as be,Lb as Pe,Mb as Fe,Oa as m,Pb as Yt,Qa as Re,Qb as Le,Rb as At,Tb as A,Vb as Ie,Vc as We,W as Ae,Wf as ri,Xb as Ue,Yb as Be,Yc as Tt,Zb as De,ab as bt,bb as Oe,c as Se,cb as ke,ea as wt,fa as Te,fd as vt,ha as ve,hd as nt,he as ze,ie as Ze,ja as p,jb as xe,jd as Ct,kc as Me,kd as $e,lb as k,mb as x,mc as Ve,mg as si,oa as W,od as qe,og as Nt,pa as $,pd as Ge,rb as C,sb as f,sd as He,tb as _,td as Ye,ub as J,v as S,wf as ti,yd as Ke,yf as ei,zd as Qe}from"./chunk-BJARRIS6.js";import{n as oi}from"./chunk-DM4NXKEP.js";import{a as O,b as _e,d as ge,e as ye,i as Ee}from"./chunk-KAVP6UXH.js";var V=(function(r){return r.USER="user",r.GUEST="guest",r.LINK="link",r.GROUP="group",r.PGROUP="personal group",r})(V||{});function Ti(r,t=[]){let e=O({},Object.fromEntries(Object.entries(Ai).filter(([i,s])=>t.indexOf(i)===-1)));if(!r)return e;for(let i of r.split(":"))i in e&&(e[i]=!0);return e}function jr(r,t,e=[]){let i={};if(!r)return i;for(let s of r.split(":"))e.indexOf(s)===-1&&(i[s]=t.indexOf(s)>-1);return i}function Jr(r,t=[]){let e={};if(!r)return e;for(let i of r.split(":"))t.indexOf(i)===-1&&(e[i]=bi[i]);return e}function Xr(r){return Object.entries(r).filter(([t,e])=>e).map(([t,e])=>t).join(":")}var T=class{constructor(t,e=[]){this.newly=0,this.linkSettings=null,Object.assign(this,t),this.mid=`${t.type[0]}${t.id}`,this.hPerms=Ti(t.permissions,e),t.login&&(this.avatarUrl=M(t.login)),this.isLink=!!this.linkId,this.isGuest=this.type===V.GUEST,this.isUser=this.isGuest||this.type===V.USER&&!this.isLink,this.isGroup=this.type===V.GROUP||this.type===V.PGROUP,this.isPersonalGroup=this.type===V.PGROUP,this.setGroupRole(),this.modifiedAt?this.newly=at(this.modifiedAt):this.createdAt&&(this.newly=at(this.createdAt))}setGroupRole(t){typeof t<"u"&&(this.groupRole=t),this.isGroupManager=this.groupRole===Kt.MANAGER}};function os(r,t,e){return new T({id:r.id,login:r.login,name:r.fullName,description:r.email,type:V.USER,spaceRole:t||di.IS_MEMBER,groupRole:e||Kt.MEMBER,permissions:""})}var vi={NAME_SPACE:"/",EVENTS:{NOTIFICATION:"notification"}};var ht={NAME_SPACE:"/",EVENTS:{ONLINE_STATUS:"onlineStatus",ONLINE_USERS:"onlineUsers",ONLINE_USER:"onlineUser"}};var l=(function(r){return r.BASE="/api/auth",r.LOGIN="login",r.LOGOUT="logout",r.REFRESH="refresh",r.TOKEN="token",r.TOKEN_REFRESH="token/refresh",r.WS="socket.io",r.TWO_FA_BASE="2fa",r.TWO_FA_ENABLE="enable",r.TWO_FA_DISABLE="disable",r.TWO_FA_LOGIN_VERIFY="login/verify",r.TWO_FA_ADMIN_RESET_USER="reset/user",r})(l||{}),us=`${l.BASE}/${l.LOGIN}`,ls=`${l.BASE}/${l.LOGOUT}`,Ci=`${l.BASE}/${l.REFRESH}`,ps=`${l.BASE}/${l.TOKEN}`,fs=`${l.BASE}/${l.TOKEN_REFRESH}`,Ri=`/${l.WS}`,Jt=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ENABLE}`,Oi=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_DISABLE}`,ki=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_LOGIN_VERIFY}`,xi=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ADMIN_RESET_USER}`;var pe={};ye(pe,{Fetch:()=>mt,Manager:()=>K,NodeWebSocket:()=>I,NodeXHR:()=>L,Socket:()=>H,WebSocket:()=>I,WebTransport:()=>G,XHR:()=>L,connect:()=>Q,default:()=>Q,io:()=>Q,protocol:()=>ue});var v=Object.create(null);v.open="0";v.close="1";v.ping="2";v.pong="3";v.message="4";v.upgrade="5";v.noop="6";var ut=Object.create(null);Object.keys(v).forEach(r=>{ut[v[r]]=r});var lt={type:"error",data:"parser error"};var Fi=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Li=typeof ArrayBuffer=="function",Ii=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,pt=({type:r,data:t},e,i)=>Fi&&t instanceof Blob?e?i(t):Ni(t,i):Li&&(t instanceof ArrayBuffer||Ii(t))?e?i(t):Ni(new Blob([t]),i):i(v[r]+(t||"")),Ni=(r,t)=>{let e=new FileReader;return e.onload=function(){let i=e.result.split(",")[1];t("b"+(i||""))},e.readAsDataURL(r)};function Pi(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var Xt;function Ui(r,t){if(Fi&&r.data instanceof Blob)return r.data.arrayBuffer().then(Pi).then(t);if(Li&&(r.data instanceof ArrayBuffer||Ii(r.data)))return t(Pi(r.data));pt(r,!1,e=>{Xt||(Xt=new TextEncoder),t(Xt.encode(e))})}var Bi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ft=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<Bi.length;r++)ft[Bi.charCodeAt(r)]=r;var Di=r=>{let t=r.length*.75,e=r.length,i,s=0,n,o,a,c;r[r.length-1]==="="&&(t--,r[r.length-2]==="="&&t--);let R=new ArrayBuffer(t),b=new Uint8Array(R);for(i=0;i<e;i+=4)n=ft[r.charCodeAt(i)],o=ft[r.charCodeAt(i+1)],a=ft[r.charCodeAt(i+2)],c=ft[r.charCodeAt(i+3)],b[s++]=n<<2|o>>4,b[s++]=(o&15)<<4|a>>2,b[s++]=(a&3)<<6|c&63;return R};var dr=typeof ArrayBuffer=="function",dt=(r,t)=>{if(typeof r!="string")return{type:"message",data:Mi(r,t)};let e=r.charAt(0);return e==="b"?{type:"message",data:mr(r.substring(1),t)}:ut[e]?r.length>1?{type:ut[e],data:r.substring(1)}:{type:ut[e]}:lt},mr=(r,t)=>{if(dr){let e=Di(r);return Mi(e,t)}else return{base64:!0,data:r}},Mi=(r,t)=>{switch(t){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var Vi="",Wi=(r,t)=>{let e=r.length,i=new Array(e),s=0;r.forEach((n,o)=>{pt(n,!1,a=>{i[o]=a,++s===e&&t(i.join(Vi))})})},$i=(r,t)=>{let e=r.split(Vi),i=[];for(let s=0;s<e.length;s++){let n=dt(e[s],t);if(i.push(n),n.type==="error")break}return i};function qi(){return new TransformStream({transform(r,t){Ui(r,e=>{let i=e.length,s;if(i<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,i);else if(i<65536){s=new Uint8Array(3);let n=new DataView(s.buffer);n.setUint8(0,126),n.setUint16(1,i)}else{s=new Uint8Array(9);let n=new DataView(s.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(i))}r.data&&typeof r.data!="string"&&(s[0]|=128),t.enqueue(s),t.enqueue(e)})}})}var zt;function Lt(r){return r.reduce((t,e)=>t+e.length,0)}function It(r,t){if(r[0].length===t)return r.shift();let e=new Uint8Array(t),i=0;for(let s=0;s<t;s++)e[s]=r[0][i++],i===r[0].length&&(r.shift(),i=0);return r.length&&i<r[0].length&&(r[0]=r[0].slice(i)),e}function Gi(r,t){zt||(zt=new TextDecoder);let e=[],i=0,s=-1,n=!1;return new TransformStream({transform(o,a){for(e.push(o);;){if(i===0){if(Lt(e)<1)break;let c=It(e,1);n=(c[0]&128)===128,s=c[0]&127,s<126?i=3:s===126?i=1:i=2}else if(i===1){if(Lt(e)<2)break;let c=It(e,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),i=3}else if(i===2){if(Lt(e)<8)break;let c=It(e,8),R=new DataView(c.buffer,c.byteOffset,c.length),b=R.getUint32(0);if(b>Math.pow(2,21)-1){a.enqueue(lt);break}s=b*Math.pow(2,32)+R.getUint32(4),i=3}else{if(Lt(e)<s)break;let c=It(e,s);a.enqueue(dt(n?c:zt.decode(c),t)),i=0}if(s===0||s>r){a.enqueue(lt);break}}}})}var Zt=4;function u(r){if(r)return _r(r)}function _r(r){for(var t in u.prototype)r[t]=u.prototype[t];return r}u.prototype.on=u.prototype.addEventListener=function(r,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(t),this};u.prototype.once=function(r,t){function e(){this.off(r,e),t.apply(this,arguments)}return e.fn=t,this.on(r,e),this};u.prototype.off=u.prototype.removeListener=u.prototype.removeAllListeners=u.prototype.removeEventListener=function(r,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var e=this._callbacks["$"+r];if(!e)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var i,s=0;s<e.length;s++)if(i=e[s],i===t||i.fn===t){e.splice(s,1);break}return e.length===0&&delete this._callbacks["$"+r],this};u.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),e=this._callbacks["$"+r],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(e){e=e.slice(0);for(var i=0,s=e.length;i<s;++i)e[i].apply(this,t)}return this};u.prototype.emitReserved=u.prototype.emit;u.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};u.prototype.hasListeners=function(r){return!!this.listeners(r).length};var N=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,e)=>e(t,0),g=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Hi="arraybuffer";function Ut(r,...t){return t.reduce((e,i)=>(r.hasOwnProperty(i)&&(e[i]=r[i]),e),{})}var gr=g.setTimeout,yr=g.clearTimeout;function P(r,t){t.useNativeTimers?(r.setTimeoutFn=gr.bind(g),r.clearTimeoutFn=yr.bind(g)):(r.setTimeoutFn=g.setTimeout.bind(g),r.clearTimeoutFn=g.clearTimeout.bind(g))}var Er=1.33;function Yi(r){return typeof r=="string"?Sr(r):Math.ceil((r.byteLength||r.size)*Er)}function Sr(r){let t=0,e=0;for(let i=0,s=r.length;i<s;i++)t=r.charCodeAt(i),t<128?e+=1:t<2048?e+=2:t<55296||t>=57344?e+=3:(i++,e+=4);return e}function Bt(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Ki(r){let t="";for(let e in r)r.hasOwnProperty(e)&&(t.length&&(t+="&"),t+=encodeURIComponent(e)+"="+encodeURIComponent(r[e]));return t}function Qi(r){let t={},e=r.split("&");for(let i=0,s=e.length;i<s;i++){let n=e[i].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t}var Dt=class extends Error{constructor(t,e,i){super(t),this.description=e,this.context=i,this.type="TransportError"}},F=class extends u{constructor(t){super(),this.writable=!1,P(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,e,i){return super.emitReserved("error",new Dt(t,e,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){let e=dt(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){let t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){let e=Ki(t);return e.length?"?"+e:""}};var Z=class extends F{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let e=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||e()})),this.writable||(i++,this.once("drain",function(){--i||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){let e=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};$i(t,this.socket.binaryType).forEach(e),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Wi(t,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.opts.secure?"https":"http",e=this.query||{};return this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Bt()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.createUri(t,e)}};var ji=!1;try{ji=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Ji=ji;function wr(){}var te=class extends Z{constructor(t){if(super(t),typeof location<"u"){let e=location.protocol==="https:",i=location.port;i||(i=e?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,e){let i=this.request({method:"POST",data:t});i.on("success",e),i.on("error",(s,n)=>{this.onError("xhr post error",s,n)})}doPoll(){let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(e,i)=>{this.onError("xhr poll error",e,i)}),this.pollXhr=t}},Mt=(()=>{class r extends u{constructor(e,i,s){super(),this.createRequest=e,P(this,s),this._opts=s,this._method=s.method||"GET",this._uri=i,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;let i=Ut(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;let s=this._xhr=this.createRequest(i);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&s.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var n;s.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=wr,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return r.requestsCount=0,r.requests={},r})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Xi);else if(typeof addEventListener=="function"){let r="onpagehide"in g?"pagehide":"unload";addEventListener(r,Xi,!1)}}function Xi(){for(let r in Mt.requests)Mt.requests.hasOwnProperty(r)&&Mt.requests[r].abort()}var br=(function(){let r=zi({xdomain:!1});return r&&r.responseType!==null})(),L=class extends te{constructor(t){super(t);let e=t&&t.forceBase64;this.supportsBinary=br&&!e}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Mt(zi,this.uri(),t)}};function zi(r){let t=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Ji))return new XMLHttpRequest}catch{}if(!t)try{return new g[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var Zi=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",ie=class extends F{get name(){return"websocket"}doOpen(){let t=this.uri(),e=this.opts.protocols,i=Zi?{}:Ut(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,e,i)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let i=t[e],s=e===t.length-1;pt(i,this.supportsBinary,n=>{try{this.doWrite(i,n)}catch{}s&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let t=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=Bt()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}},ee=g.WebSocket||g.MozWebSocket,I=class extends ie{createSocket(t,e,i){return Zi?new ee(t,e,i):e?new ee(t,e):new ee(t)}doWrite(t,e){this.ws.send(e)}};var G=class extends F{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{let e=Gi(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(e).getReader(),s=qi();s.readable.pipeTo(t.writable),this._writer=s.writable.getWriter();let n=()=>{i.read().then(({done:a,value:c})=>{a||(this.onPacket(c),n())}).catch(a=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let i=t[e],s=e===t.length-1;this._writer.write(i).then(()=>{s&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}};var re={websocket:I,webtransport:G,polling:L};var Ar=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Tr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function tt(r){if(r.length>8e3)throw"URI too long";let t=r,e=r.indexOf("["),i=r.indexOf("]");e!=-1&&i!=-1&&(r=r.substring(0,e)+r.substring(e,i).replace(/:/g,";")+r.substring(i,r.length));let s=Ar.exec(r||""),n={},o=14;for(;o--;)n[Tr[o]]=s[o]||"";return e!=-1&&i!=-1&&(n.source=t,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=vr(n,n.path),n.queryKey=Cr(n,n.query),n}function vr(r,t){let e=/\/{2,9}/g,i=t.replace(e,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function Cr(r,t){let e={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,s,n){s&&(e[s]=n)}),e}var se=typeof addEventListener=="function"&&typeof removeEventListener=="function",Vt=[];se&&addEventListener("offline",()=>{Vt.forEach(r=>r())},!1);var Wt=(()=>{class r extends u{constructor(e,i){if(super(),this.binaryType=Hi,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(i=e,e=null),e){let s=tt(e);i.hostname=s.host,i.secure=s.protocol==="https"||s.protocol==="wss",i.port=s.port,s.query&&(i.query=s.query)}else i.host&&(i.hostname=tt(i.host).host);P(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(s=>{let n=s.prototype.name;this.transports.push(n),this._transportsByName[n]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Qi(this.opts.query)),se&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Vt.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let i=Object.assign({},this.opts.query);i.EIO=Zt,i.transport=e,this.id&&(i.sid=this.id);let s=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let i=this.createTransport(e);i.open(),this.setTransport(i)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let i=new Error("server error");i.code=e.data,this._onError(i);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let s=0;s<this.writeBuffer.length;s++){let n=this.writeBuffer[s].data;if(n&&(i+=Yi(n)),s>0&&i>this._maxPayload)return this.writeBuffer.slice(0,s);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,N(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,i,s){return this._sendPacket("message",e,i,s),this}send(e,i,s){return this._sendPacket("message",e,i,s),this}_sendPacket(e,i,s,n){if(typeof i=="function"&&(n=i,i=void 0),typeof s=="function"&&(n=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;let o={type:e,data:i,options:s};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),e()},s=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),se&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let s=Vt.indexOf(this._offlineEventListener);s!==-1&&Vt.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,i),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=Zt,r})(),$t=class extends Wt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let e=this.createTransport(t),i=!1;Wt.priorWebsocketSuccess=!1;let s=()=>{i||(e.send([{type:"ping",data:"probe"}]),e.once("packet",U=>{if(!i)if(U.type==="pong"&&U.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;Wt.priorWebsocketSuccess=e.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(b(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{let rt=new Error("probe error");rt.transport=e.name,this.emitReserved("upgradeError",rt)}}))};function n(){i||(i=!0,b(),e.close(),e=null)}let o=U=>{let rt=new Error("probe error: "+U);rt.transport=e.name,n(),this.emitReserved("upgradeError",rt)};function a(){o("transport closed")}function c(){o("socket closed")}function R(U){e&&U.name!==e.name&&n()}let b=()=>{e.removeListener("open",s),e.removeListener("error",o),e.removeListener("close",a),this.off("close",c),this.off("upgrading",R)};e.once("open",s),e.once("error",o),e.once("close",a),this.once("close",c),this.once("upgrading",R),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||e.open()},200):e.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let e=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&e.push(t[i]);return e}},et=class extends $t{constructor(t,e={}){let i=typeof t=="object"?t:e;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(s=>re[s]).filter(s=>!!s)),super(t,i)}};var mt=class extends Z{doPoll(){this._fetch().then(t=>{if(!t.ok)return this.onError("fetch read error",t.status,t);t.text().then(e=>this.onData(e))}).catch(t=>{this.onError("fetch read error",t)})}doWrite(t,e){this._fetch(t).then(i=>{if(!i.ok)return this.onError("fetch write error",i.status,i);e()}).catch(i=>{this.onError("fetch write error",i)})}_fetch(t){var e;let i=t!==void 0,s=new Headers(this.opts.extraHeaders);return i&&s.set("content-type","text/plain;charset=UTF-8"),(e=this.socket._cookieJar)===null||e===void 0||e.appendCookies(s),fetch(this.uri(),{method:i?"POST":"GET",body:i?t:null,headers:s,credentials:this.opts.withCredentials?"include":"omit"}).then(n=>{var o;return(o=this.socket._cookieJar)===null||o===void 0||o.parseCookies(n.headers.getSetCookie()),n})}};var Sn=et.protocol;function tr(r,t="",e){let i=r;e=e||typeof location<"u"&&location,r==null&&(r=e.protocol+"//"+e.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=e.protocol+r:r=e.host+r),/^(https?|wss?):\/\//.test(r)||(typeof e<"u"?r=e.protocol+"//"+r:r="https://"+r),i=tt(r)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let n=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+t,i.href=i.protocol+"://"+n+(e&&e.port===i.port?"":":"+i.port),i}var le={};ye(le,{Decoder:()=>ce,Encoder:()=>ae,PacketType:()=>h,protocol:()=>ue});var Rr=typeof ArrayBuffer=="function",Or=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,er=Object.prototype.toString,kr=typeof Blob=="function"||typeof Blob<"u"&&er.call(Blob)==="[object BlobConstructor]",xr=typeof File=="function"||typeof File<"u"&&er.call(File)==="[object FileConstructor]";function gt(r){return Rr&&(r instanceof ArrayBuffer||Or(r))||kr&&r instanceof Blob||xr&&r instanceof File}function _t(r,t){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let e=0,i=r.length;e<i;e++)if(_t(r[e]))return!0;return!1}if(gt(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return _t(r.toJSON(),!0);for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e)&&_t(r[e]))return!0;return!1}function ir(r){let t=[],e=r.data,i=r;return i.data=ne(e,t),i.attachments=t.length,{packet:i,buffers:t}}function ne(r,t){if(!r)return r;if(gt(r)){let e={_placeholder:!0,num:t.length};return t.push(r),e}else if(Array.isArray(r)){let e=new Array(r.length);for(let i=0;i<r.length;i++)e[i]=ne(r[i],t);return e}else if(typeof r=="object"&&!(r instanceof Date)){let e={};for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=ne(r[i],t));return e}return r}function rr(r,t){return r.data=oe(r.data,t),delete r.attachments,r}function oe(r,t){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<t.length)return t[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=oe(r[e],t);else if(typeof r=="object")for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=oe(r[e],t));return r}var Nr=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ue=5,h=(function(r){return r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK",r})(h||{}),ae=class{constructor(t){this.replacer=t}encode(t){return(t.type===h.EVENT||t.type===h.ACK)&&_t(t)?this.encodeAsBinary({type:t.type===h.EVENT?h.BINARY_EVENT:h.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let e=""+t.type;return(t.type===h.BINARY_EVENT||t.type===h.BINARY_ACK)&&(e+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(e+=t.nsp+","),t.id!=null&&(e+=t.id),t.data!=null&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){let e=ir(t),i=this.encodeAsString(e.packet),s=e.buffers;return s.unshift(i),s}};function sr(r){return Object.prototype.toString.call(r)==="[object Object]"}var ce=class r extends u{constructor(t){super(),this.reviver=t}add(t){let e;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);let i=e.type===h.BINARY_EVENT;i||e.type===h.BINARY_ACK?(e.type=i?h.EVENT:h.ACK,this.reconstructor=new he(e),e.attachments===0&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else if(gt(t)||t.base64)if(this.reconstructor)e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let e=0,i={type:Number(t.charAt(0))};if(h[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===h.BINARY_EVENT||i.type===h.BINARY_ACK){let n=e+1;for(;t.charAt(++e)!=="-"&&e!=t.length;);let o=t.substring(n,e);if(o!=Number(o)||t.charAt(e)!=="-")throw new Error("Illegal attachments");i.attachments=Number(o)}if(t.charAt(e+1)==="/"){let n=e+1;for(;++e&&!(t.charAt(e)===","||e===t.length););i.nsp=t.substring(n,e)}else i.nsp="/";let s=t.charAt(e+1);if(s!==""&&Number(s)==s){let n=e+1;for(;++e;){let o=t.charAt(e);if(o==null||Number(o)!=o){--e;break}if(e===t.length)break}i.id=Number(t.substring(n,e+1))}if(t.charAt(++e)){let n=this.tryParse(t.substr(e));if(r.isPayloadValid(i.type,n))i.data=n;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,e){switch(t){case h.CONNECT:return sr(e);case h.DISCONNECT:return e===void 0;case h.CONNECT_ERROR:return typeof e=="string"||sr(e);case h.EVENT:case h.BINARY_EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&Nr.indexOf(e[0])===-1);case h.ACK:case h.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},he=class{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){let e=rr(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function w(r,t,e){return r.on(t,e),function(){r.off(t,e)}}var Pr=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),H=class extends u{constructor(t,e,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[w(t,"open",this.onopen.bind(this)),w(t,"packet",this.onpacket.bind(this)),w(t,"error",this.onerror.bind(this)),w(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){var i,s,n;if(Pr.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;let o={type:h.EVENT,data:e};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof e[e.length-1]=="function"){let b=this.ids++,U=e.pop();this._registerAckCallback(b,U),o.id=b}let a=(s=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||s===void 0?void 0:s.writable,c=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!a||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,e){var i;let s=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(s===void 0){this.acks[t]=e;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);e.call(this,new Error("operation has timed out"))},s),o=(...a)=>{this.io.clearTimeoutFn(n),e.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...e){return new Promise((i,s)=>{let n=(o,a)=>o?s(o):i(a);n.withError=!0,e.push(n),this.emit(t,...e)})}_addToQueue(t){let e;typeof t[t.length-1]=="function"&&(e=t.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((s,...n)=>i!==this._queue[0]?void 0:(s!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(s)):(this._queue.shift(),e&&e(null,...n)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;let e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:h.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){let i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case h.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case h.EVENT:case h.BINARY_EVENT:this.onevent(t);break;case h.ACK:case h.BINARY_ACK:this.onack(t);break;case h.DISCONNECT:this.ondisconnect();break;case h.CONNECT_ERROR:this.destroy();let i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){let e=t.data||[];t.id!=null&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){let e=this._anyListeners.slice();for(let i of e)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){let e=this,i=!1;return function(...s){i||(i=!0,e.packet({type:h.ACK,id:t,data:s}))}}onack(t){let e=this.acks[t.id];typeof e=="function"&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:h.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){let e=this._anyListeners;for(let i=0;i<e.length;i++)if(t===e[i])return e.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){let e=this._anyOutgoingListeners;for(let i=0;i<e.length;i++)if(t===e[i])return e.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let e=this._anyOutgoingListeners.slice();for(let i of e)i.apply(this,t.data)}}};function Y(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Y.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),e=Math.floor(t*this.jitter*r);r=(Math.floor(t*10)&1)==0?r-e:r+e}return Math.min(r,this.max)|0};Y.prototype.reset=function(){this.attempts=0};Y.prototype.setMin=function(r){this.ms=r};Y.prototype.setMax=function(r){this.max=r};Y.prototype.setJitter=function(r){this.jitter=r};var K=class extends u{constructor(t,e){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.opts=e,P(this,e),this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor((i=e.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Y({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this._readyState="closed",this.uri=t;let s=e.parser||le;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=e.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(e=this.backoff)===null||e===void 0||e.setMin(t),this)}randomizationFactor(t){var e;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(e=this.backoff)===null||e===void 0||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(e=this.backoff)===null||e===void 0||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new et(this.uri,this.opts);let e=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let s=w(e,"open",function(){i.onopen(),t&&t()}),n=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=w(e,"error",n);if(this._timeout!==!1){let a=this._timeout,c=this.setTimeoutFn(()=>{s(),n(new Error("timeout")),e.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(w(t,"ping",this.onping.bind(this)),w(t,"data",this.ondata.bind(this)),w(t,"error",this.onerror.bind(this)),w(t,"close",this.onclose.bind(this)),w(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(e){this.onclose("parse error",e)}}ondecoded(t){N(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new H(this,t,e),this.nsps[t]=i),i}_destroy(t){let e=Object.keys(this.nsps);for(let i of e)if(this.nsps[i].active)return;this._close()}_packet(t){let e=this.encoder.encode(t);for(let i=0;i<e.length;i++)this.engine.write(e[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,e){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let e=this.backoff.duration();this._reconnecting=!0;let i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(s=>{s?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",s)):t.onreconnect()}))},e);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}};var yt={};function Q(r,t){typeof r=="object"&&(t=r,r=void 0),t=t||{};let e=tr(r,t.path||"/socket.io"),i=e.source,s=e.id,n=e.path,o=yt[s]&&n in yt[s].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o,c;return a?c=new K(i,t):(yt[s]||(yt[s]=new K(i,t)),c=yt[s]),e.query&&!t.query&&(t.query=e.queryKey),c.socket(e.path,t)}Object.assign(Q,{Manager:K,Socket:H,io:Q,connect:Q});var it=class r{config;appRef;subscribersCounter={};eventObservables$={};namespaces={};ioSocket;emptyConfig={url:"",options:{}};constructor(t,e){this.config=t,this.appRef=e,t===void 0&&(t=this.emptyConfig);let i=t.url,s=t.options,n=Q?Q:pe;this.ioSocket=n(i,s)}get auth(){return this.ioSocket.auth}set auth(t){this.ioSocket.auth=t}get io(){return this.ioSocket.io}get open(){return this.connect}get close(){return this.disconnect}of(t){if(!t||t==="/")return this;let e=this.namespaces[t];if(e)return e;let a=this.config,{url:i}=a,s=ge(a,["url"]),n=O({url:!i.endsWith("/")&&!t.startsWith("/")?`${i}/${t}`:`${i}${t}`},s),o=new r(n,this.appRef);return this.namespaces[t]=o,o}on(t,e){return this.ioSocket.on(t,e),this}once(t,e){return this.ioSocket.once(t,e),this}connect(){return this.ioSocket.connect(),this}disconnect(){return this.ioSocket.disconnect(),this}emit(t,...e){return this.ioSocket.emit(t,...e),this}send(...t){return this.ioSocket.send.apply(this.ioSocket,arguments),this}emitWithAck(t,...e){return this.ioSocket.emitWithAck(t,...e)}removeListener(t,e){return this.ioSocket.removeListener(t,e),this}removeAllListeners(t){return this.ioSocket.removeAllListeners(t),this}fromEvent(t){return this.subscribersCounter[t]||(this.subscribersCounter[t]=0),this.subscribersCounter[t]++,this.eventObservables$[t]||(this.eventObservables$[t]=new Se(e=>{let i=s=>{e.next(s),this.appRef.tick()};return this.ioSocket.on(t,i),()=>{this.subscribersCounter[t]--,this.subscribersCounter[t]===0&&(this.ioSocket.removeListener(t,i),delete this.eventObservables$[t])}}).pipe(Ae())),this.eventObservables$[t]}fromOneTimeEvent(t){return new Promise(e=>this.once(t,e))}listeners(t){return this.ioSocket.listeners(t)}hasListeners(t){return this.ioSocket.hasListeners(t)}listenersAny(){return this.ioSocket.listenersAny()}listenersAnyOutgoing(){return this.ioSocket.listenersAnyOutgoing()}off(t,e){return this.ioSocket.off(t,e),this}offAny(t){return this.ioSocket.offAny(t),this}offAnyOutgoing(t){return this.ioSocket.offAnyOutgoing(t),this}onAny(t){return this.ioSocket.onAny(t),this}onAnyOutgoing(t){return this.ioSocket.onAnyOutgoing(t),this}prependAny(t){return this.ioSocket.prependAny(t),this}prependAnyOutgoing(t){return this.ioSocket.prependAnyOutgoing(t),this}timeout(t){return this.ioSocket.timeout(t),this}get volatile(){let t=this.ioSocket.volatile;return this}get active(){return this.ioSocket.active}get connected(){return this.ioSocket.connected}get disconnected(){return this.ioSocket.disconnected}get recovered(){return this.ioSocket.recovered}get id(){return this.ioSocket.id}compress(t){return this.ioSocket.compress(t),this}};function Fr(r,t){return new it(r,t)}var nr=new ve("__SOCKET_IO_CONFIG__"),uo=(()=>{class r{static forRoot(e){return{ngModule:r,providers:[{provide:nr,useValue:e},{provide:it,useFactory:Fr,deps:[nr,xe]}]}}static \u0275fac=function(i){return new(i||r)};static \u0275mod=Oe({type:r});static \u0275inj=Te({})}return r})();var fe={BASE:`${ai}/notifications`,UNREAD:"unread"},qt=fe.BASE;var d=(function(r){return r.ADD="add",r.UPDATE="update",r.DELETE="delete",r.DELETE_PERMANENTLY="deletePermanently",r})(d||{});var y=(function(r){return r.COMMENTS="comments",r.SPACES="spaces",r.SPACE_ROOTS="spaces_roots",r.SHARES="shares",r.LINKS="links",r.SYNC="sync",r.AUTH_LOCKED="auth_locked",r.AUTH_2FA="auth_2fa",r.UNLOCK_REQUEST="unlock_request",r.UPDATE_AVAILABLE="server_update_available",r})(y||{}),yo={COMMENTS:"commented",SPACES:{[d.ADD]:"You now have access to the space",[d.DELETE]:"You no longer have access to the space",[d.DELETE_PERMANENTLY]:"This space has been permanently deleted"},SPACE_ROOTS:{[d.ADD]:"anchored",[d.DELETE]:"unanchored"},SHARES:{[d.ADD]:"shared with you",[d.DELETE]:"no longer share with you"},SHARES_WITHOUT_OWNER:{[d.ADD]:"You now have access to the share",[d.DELETE]:"You no longer have access to the share",[d.DELETE_PERMANENTLY]:"You are no longer a member of the parent share, your child share has been deleted"},LINKS:{[d.ADD]:"shared with you",[d.UPDATE]:"You now have access to the space"},SYNC:{[d.DELETE]:"You are no longer synchronizing"},AUTH_2FA:{[d.ADD]:"Two-factor authentication (2FA) on your account has been enabled",[d.DELETE]:"Two-factor authentication (2FA) on your account has been disabled"},AUTH_LOCKED:{[d.DELETE]:"Your account has been locked after several unsuccessful authentication attempts"},UNLOCK_REQUEST:"sends you a request to unlock the file",UPDATE_AVAILABLE:"A new update is available"};var or=ei;var ar={[y.COMMENTS]:or,[y.SPACES]:ct.SPACES,[y.SPACE_ROOTS]:ct.SPACES,[y.SHARES]:ct.SHARES,[y.LINKS]:ct.LINKS,[y.SYNC]:Ei.SYNC,[y.UNLOCK_REQUEST]:ti};var Gt=class{constructor(t){this.soonRead=!1,Object.assign(this,t),this.fromUser?this.fromUser.avatarUrl=M(this.fromUser.login):this.fromUser={id:-1,login:null,email:null,fullName:"Info",avatarUrl:null},this.appIcon=ar[this.content.app],this.setMainElement()}setMainElement(){if(!(this.content.app===y.COMMENTS||this.content.app===y.SHARES||this.content.app===y.UPDATE_AVAILABLE||this.content.app===y.SYNC)&&this.content?.url){let t=this.content.url.split("/");t.length>1&&(this.mainElement=t[t.length-1])}}};var cr=(()=>{let t=class t{constructor(){this.http=p(Tt),this.store=p(Pt),this.layout=p(z)}getNotifications(i=!1){return this.http.get(`${qt}${i?`/${fe.UNREAD}`:""}`).pipe(S(s=>s.map(n=>new Gt(n))))}wasReadNotification(i){return this.http.patch(`${qt}/${i}`,null)}deleteNotification(i){return this.http.delete(`${qt}${i?`/${i}`:""}`)}checkUnreadNotifications(i=!1){this.getNotifications().subscribe(s=>{let n;if(i&&s.length){let o=s[0];n=this.layout.sendNotification("info",o.fromUser.fullName,this.layout.translateString(`${this.layout.translateString(o.content.event)}: <b>${o.content.element}</b>`),null,{enableHtml:!0})}else{let o=s.filter(a=>!a.wasRead).length;o&&(n=this.layout.sendNotification("info","Notifications",this.layout.translateString(o===1?"one_notification":"nb_notifications",{nb:o})))}n&&n.onTap.pipe(be(1)).subscribe(()=>this.layout.showRSideBarTab(gi.NOTIFICATIONS,!0)),this.store.notifications.set(s)})}};t.\u0275fac=function(s){return new(s||t)},t.\u0275prov=wt({token:t,factory:t.\u0275fac,providedIn:"root"});let r=t;return r})();var E=(function(r){return r.ACCESS="access",r.ACCESS_2FA="access_2fa",r.REFRESH="refresh",r.WS="ws",r.CSRF="csrf",r.CSRF_2FA="csrf_2fa",r})(E||{});var Yo="sync-in-csrf";var de=6;var hr="sync-in-two-fa-code",ur="sync-in-two-fa-password",Ko={[E.ACCESS]:"/",[E.REFRESH]:Ci,[E.WS]:Ri,[E.CSRF]:"/",[E.ACCESS_2FA]:ki,[E.CSRF_2FA]:"/"},Qo=[E.REFRESH,E.ACCESS,E.WS,E.CSRF],jo=[E.ACCESS_2FA,E.CSRF_2FA];var Ir=["Password"];function Ur(r,t){r&1&&(f(0,"label",1),A(1,"Password"),_())}function Br(r,t){if(r&1){let e=st();f(0,"div",5),B("click",function(){W(e);let s=D();return $(s.randomPassword())}),f(1,"span"),J(2,"fa-icon",6),_()()}if(r&2){let e=D();m(2),C("icon",e.icons.faDice)}}var lr=(()=>{let t=class t{constructor(){this.passwordChange=new Re,this.passwordMinLength=8,this.showGenerator=!1,this.showLabel=!1,this.disabled=!1,this.isRequired=!1,this.focus=!1,this.centered=!1,this.locale=p(Ot),this.toggleVisiblePassword=yi,this.icons={faEye:Ze,faEyeSlash:ri,faDice:si}}ngOnInit(){this.focus&&setTimeout(()=>{this.passwordElement.nativeElement.focus(),this.passwordElement.nativeElement.select()},0)}randomPassword(){this.disabled||this.passwordChange.emit(mi(this.passwordMinLength+2))}};t.\u0275fac=function(s){return new(s||t)},t.\u0275cmp=bt({type:t,selectors:[["app-input-password"]],viewQuery:function(s,n){if(s&1&&Ne(Ir,7),s&2){let o;Pe(o=Fe())&&(n.passwordElement=o.first)}},inputs:{password:"password",passwordMinLength:"passwordMinLength",placeholder:"placeholder",showGenerator:"showGenerator",showLabel:"showLabel",disabled:"disabled",isRequired:"isRequired",focus:"focus",centered:"centered"},outputs:{passwordChange:"passwordChange"},decls:9,vars:16,consts:[["Password",""],["for","password","l10nTranslate",""],["id","password",1,"input-group","input-group-sm",2,"min-width","150px"],["autocomplete","off","type","password",1,"form-control","form-control-sm","pe-0",3,"ngModelChange","keyup","ngModel","disabled","placeholder","required"],[1,"input-group-text","cursor-pointer"],[1,"input-group-text","cursor-pointer",3,"click"],[3,"icon"]],template:function(s,n){if(s&1){let o=st();k(0,Ur,2,0,"label",1),f(1,"div",2)(2,"input",3,0),Me(4,"translate"),De("ngModelChange",function(c){return W(o),Be(n.password,c)||(n.password=c),$(c)}),B("keyup",function(){return W(o),$(n.passwordChange.emit(n.password))}),_(),k(5,Br,3,1,"div",4),f(6,"div",5),B("click",function(){W(o);let c=Yt(3);return $(n.toggleVisiblePassword(c))}),f(7,"span"),J(8,"fa-icon",6),_()()()}if(s&2){let o=Yt(3);x(n.showLabel?0:-1),m(2),Le("padding-left",n.centered?"2rem":""),At("is-invalid",n.isRequired&&(n.password==null?null:n.password.length)<n.passwordMinLength)("text-center",n.centered),Ue("ngModel",n.password),C("disabled",n.disabled)("placeholder",Ve(4,13,n.placeholder,n.locale.language))("required",n.isRequired),m(3),x(n.showGenerator?5:-1),m(3),C("icon",o.type==="text"?n.icons.faEye:n.icons.faEyeSlash)}},dependencies:[Je,vt,Ct,Ke,qe,Rt,Nt,kt,Xe],encapsulation:2});let r=t;return r})();var pr=(()=>{let t=class t{constructor(){this.autoFocus=!0,this.autoSelect=!0,this.elementRef=p(Ce)}ngOnInit(){setTimeout(()=>{this.autoFocus&&this.elementRef.nativeElement.focus(),this.autoSelect&&this.elementRef.nativeElement.select()},0)}};t.\u0275fac=function(s){return new(s||t)},t.\u0275dir=ke({type:t,selectors:[["","appAutofocus",""]],inputs:{autoFocus:"autoFocus",autoSelect:"autoSelect"}});let r=t;return r})();function Dr(r,t){r&1&&(f(0,"span",3),A(1,"Two-Factor Authentication"),_())}function Mr(r,t){r&1&&(f(0,"span",3),A(1,"Password Authentication"),_())}function Vr(r,t){if(r&1&&A(0),r&2){let e=D();Ie(" ",e.hasError," ")}}function Wr(r,t){r&1&&A(0," Enter your password ")}function $r(r,t){r&1&&A(0," Valid with your TOTP code ")}function qr(r,t){if(r&1){let e=st();f(0,"div",9)(1,"app-input-password",13),B("passwordChange",function(s){W(e);let n=D();return $(n.updatePassword(s))}),_()()}if(r&2){let e=D();m(),C("password",e.twoFaForm.value.password)("focus",!0)("centered",!0)}}function Gr(r,t){r&1&&(f(0,"div",14),A(1,"Valid with your TOTP code"),_())}function Hr(r,t){if(r&1&&(k(0,Gr,2,0,"div",14),f(1,"div",15),J(2,"input",16),_()),r&2){let e=D();x(e.withPassword?0:-1),m(2),C("autoFocus",!e.withPassword)("autoSelect",!e.withPassword)("maxlength",e.twoFaCodelength)}}var fr=(()=>{let t=class t{constructor(){this.withPassword=!1,this.withTwoFaEnabled=!0,this.submitted=!1,this.hasError=null,this.icons={faKey:ze,faLock:ii},this.twoFaCodelength=de,this.locale=p(Ot),this.fb=p(je),this.layout=p(z)}ngOnInit(){this.twoFaForm=this.fb.group({totpCode:this.fb.control("",this.withTwoFaEnabled?[nt.required,nt.pattern(new RegExp(`^\\d{${de}}$`))]:null),password:this.fb.control("",this.withPassword?[nt.required,nt.minLength(8)]:null)})}onClose(i=!1){this.isValid(i),this.layout.closeDialog()}onSubmit(){this.submitted=!0;let i=new We(O(O({},this.withTwoFaEnabled?{[hr]:this.twoFaForm.value.totpCode}:{}),this.withPassword?{[ur]:this.twoFaForm.value.password}:{}));this.onClose(i)}updatePassword(i){this.twoFaForm.patchValue({password:i})}};t.\u0275fac=function(s){return new(s||t)},t.\u0275cmp=bt({type:t,selectors:[["app-user-auth-2fa-verify-dialog"]],inputs:{withPassword:"withPassword",withTwoFaEnabled:"withTwoFaEnabled"},decls:20,vars:9,consts:[[1,"modal-header","align-items-center","justify-content-center"],[1,"modal-title"],[1,"me-2",3,"icon"],["l10nTranslate",""],[1,"modal-body","modal-auth-verify-2fa"],[1,"card","shadow-sm"],[1,"card-body"],["l10nTranslate","",1,"d-flex","justify-content-center","align-items-center","mb-3"],[3,"ngSubmit","formGroup"],[1,"mb-4"],[1,"d-grid","gap-2"],["type","submit","l10nTranslate","",1,"btn","btn-primary",3,"disabled"],["type","button","l10nTranslate","",1,"btn","btn-secondary",3,"click"],["id","password","placeholder","\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",3,"passwordChange","password","focus","centered"],["l10nTranslate","",1,"text-align-center","mb-3"],[1,"mb-3"],["appAutofocus","","type","text","formControlName","totpCode","placeholder","\u2022\u2022\u2022\u2022\u2022\u2022","inputmode","numeric","autocomplete","one-time-code","name","totp",1,"form-control","text-center","fs-4",3,"autoFocus","autoSelect","maxlength"]],template:function(s,n){s&1&&(f(0,"div",0)(1,"h4",1),J(2,"fa-icon",2),k(3,Dr,2,0,"span",3)(4,Mr,2,0,"span",3),_()(),f(5,"div",4)(6,"div",5)(7,"div",6)(8,"p",7),k(9,Vr,1,1)(10,Wr,1,0)(11,$r,1,0),_(),f(12,"form",8),B("ngSubmit",function(){return n.onSubmit()}),k(13,qr,2,3,"div",9),k(14,Hr,3,4),f(15,"div",10)(16,"button",11),A(17,"Confirm"),_(),f(18,"button",12),B("click",function(){return n.onClose()}),A(19,"Cancel"),_()()()()()()),s&2&&(m(2),C("icon",n.icons.faLock),m(),x(n.withTwoFaEnabled?3:4),m(5),At("text-danger",n.hasError),m(),x(n.hasError?9:n.withPassword?10:11),m(3),C("formGroup",n.twoFaForm),m(),x(n.withPassword?13:-1),m(),x(n.withTwoFaEnabled?14:-1),m(2),C("disabled",n.twoFaForm.invalid||n.submitted))},dependencies:[Nt,kt,pr,Rt,Ge,vt,Ct,$e,Qe,He,Ye,lr],encapsulation:2});let r=t;return r})();var Ht=class{constructor(t){this.parentGroup=t.parentGroup,this.members=t.members.map(e=>new T(e))}};var j=class{constructor(t){this.newly=0,this.currentAccessHover=!1,this.setManagers(t),Object.assign(this,t),this.avatarUrl=M(t.login),this.userIsActiveText=this.isActive?"active":"suspended",this.hTimeAgo=oi(this.currentAccess).fromNow(!0),this.newly=at(this.currentAccess)}setManagers(t){t?.managers&&(t.managers=t.managers.map(e=>new T(e)))}};var St=class{constructor(t){this.setOnlineStatus(_i("status",t)),this.avatarUrl=M(t.login),Object.assign(this,t)}setOnlineStatus(t){this.onlineStatus=t,this.onlineTextStatus=ni[t]}};var oc=(()=>{let t=class t{constructor(){this.http=p(Tt),this.layout=p(z),this.store=p(Pt),this.webSocket=p(it),this.notifications=p(cr),this.webSocket.fromEvent("connect").subscribe(()=>this.notifications.checkUnreadNotifications()),this.webSocket.fromEvent("disconnect").subscribe(()=>this.store.onlineUsers.set([])),this.webSocket.fromEvent(vi.EVENTS.NOTIFICATION).subscribe(()=>this.notifications.checkUnreadNotifications(!0)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_USER).pipe(S(i=>new St(i))).subscribe(i=>this.newOnlineUser(i)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_USERS).pipe(S(i=>i.map(s=>new St(s)))).subscribe(i=>this.setOnlineUsers(i)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_STATUS).subscribe(i=>this.receiveOnlineStatus(i))}get user(){return this.store.user.getValue()}initUser(i,s=!1){this.refreshAvatar(),this.layout.setLanguage(i.language).catch(console.error),this.store.userImpersonate.set(s||i.impersonated),this.store.user.next(i),this.checkQuota(this.store.user.getValue()),s&&this.disconnectWebSocket(),this.connectWebSocket()}connectWebSocket(){this.webSocket.ioSocket.io.opts.query={onlineStatus:this.user.onlineStatus},this.webSocket.connect()}disconnectWebSocket(){this.webSocket.disconnect()}setOnlineUsers(i){this.store.onlineUsers.set(i)}newOnlineUser(i){this.store.onlineUsers().find(s=>s.id===i.id)?this.receiveOnlineStatus({userId:i.id,status:i.onlineStatus}):this.store.onlineUsers.update(s=>[i,...s])}userHavePermission(i){return this.user.isAdmin?!0:this.user?this.user.applications.indexOf(i)!==-1:!1}browseGroup(i){return this.http.get(`${pi}${i?`/${i}`:""}`).pipe(S(s=>new Ht(s)))}createPersonalGroup(i){return this.http.post(q,i).pipe(S(s=>new T(s)))}updatePersonalGroup(i,s){return this.http.put(`${q}/${i}`,s).pipe(S(n=>new T(n)))}leavePersonalGroup(i){return this.http.delete(`${fi}/${i}`)}addUsersToGroup(i,s){return this.http.patch(`${q}/${i}/${ot.USERS}`,s)}deletePersonalGroup(i){return this.http.delete(`${q}/${i}`)}updateUserFromPersonalGroup(i,s,n){return this.http.patch(`${q}/${i}/${ot.USERS}/${s}`,n)}removeUserFromGroup(i,s){return this.http.delete(`${q}/${i}/${ot.USERS}/${s}`)}listGuests(){return this.http.get(X).pipe(S(i=>i.map(s=>new j(s))))}getGuest(i){return this.http.get(`${X}/${i}`).pipe(S(s=>new j(s)))}createGuest(i){return this.http.post(X,i).pipe(S(s=>new j(s)))}updateGuest(i,s){return this.http.put(`${X}/${i}`,s).pipe(S(n=>n?new j(n):null))}deleteGuest(i){return this.http.delete(`${X}/${i}`)}genAvatar(){this.http.patch(jt,null).subscribe({next:()=>this.refreshAvatar(),error:i=>this.layout.sendNotification("error","Configuration","Avatar",i)})}uploadAvatar(i){let s=new FormData;s.append("file",i),this.http.put(jt,s).subscribe({next:()=>this.refreshAvatar(),error:n=>this.layout.sendNotification("error","Configuration","Avatar",n)})}changePassword(i,s){return this.http.put(hi,i,{headers:s})}changeLanguage(i){return this.http.put(ci,i)}changeNotification(i){return this.http.put(ui,i)}changeStorageIndexing(i){return this.http.put(li,i)}changeOnlineStatus(i,s=!0){this.webSocket.emit(ht.EVENTS.ONLINE_STATUS,{status:i,store:s})}receiveOnlineStatus(i){this.user.id===i.userId?this.user.onlineStatus=i.status:this.store.onlineUsers().length&&this.store.onlineUsers.update(s=>s.map(n=>n.id===i.userId?_e(O({},n),{onlineStatus:i.status}):n))}searchMembers(i,s=[]){return this.http.request("search",ot.BASE,{body:i}).pipe(S(n=>n.map(o=>new T(o,s))),we(()=>[]))}setMenusVisibility(i){for(let s of i)if(!(s.id&&(s.hide=!this.userHavePermission(s.id),s.hide))&&(s.checks?.length&&(s.hide=!s.checks.map(n=>n.negate?!this[n.prop][n.value]:this[n.prop][n.value]).every(n=>!!n)),s.submenus?.length&&this.setMenusVisibility(s.submenus),s.title===wi.FILES)){for(let n of s.submenus)if(!n.hide){s.link=n.link;break}}}refreshAvatar(){this.store.userAvatarUrl.next(Si())}checkAppStoreAvailability(){this.http.get(`${Qt.BASE}/${Qt.APP_STORE}`).subscribe({next:i=>this.store.appStoreManifest.set(i),error:i=>console.error(i)})}listAppPasswords(i){return this.http.get(xt,{headers:i})}generateAppPassword(i,s){return this.http.post(xt,i,{headers:s})}deleteAppPassword(i){return this.http.delete(`${xt}/${i}`)}init2Fa(){return this.http.get(Jt)}enable2Fa(i){return this.http.post(Jt,i)}disable2Fa(i){return this.http.post(Oi,i)}adminResetUser2Fa(i,s){return this.http.post(`${xi}/${i}`,null,{headers:s})}auth2FaVerifyDialog(i=!1){return Ee(this,null,function*(){let s=this.store.server().twoFaEnabled&&this.user.twoFaEnabled;if(i||s)return new Promise(n=>{let o=this.layout.openDialog(fr,"xs",{initialState:{withPassword:i,withTwoFaEnabled:s}},{keyboard:!1});o.content.isValid=a=>{n(a)}})})}checkQuota(i){if(!(i.isGuest||i.isLink)&&i.storageQuota){let s=Math.round(100/i.storageQuota*(i.storageQuota-i.storageUsage));s<=1?this.layout.sendNotification("error","Storage Quota","No more space available",null,{disableTimeOut:!0,closeButton:!0}):s<=5?this.layout.sendNotification("warning","Storage Quota",this.layout.translateString("available_space_is_low",{nb:s}),null,{disableTimeOut:!0,closeButton:!0}):s<=10&&this.layout.sendNotification("info","Storage Quota",this.layout.translateString("available_space_is_low",{nb:s}),null,{disableTimeOut:!0,closeButton:!0})}}};t.\u0275fac=function(s){return new(s||t)},t.\u0275prov=wt({token:t,factory:t.\u0275fac,providedIn:"root"});let r=t;return r})();export{us as a,ls as b,Ci as c,ki as d,Yo as e,de as f,hr as g,ur as h,uo as i,y as j,cr as k,lr as l,pr as m,V as n,Ti as o,jr as p,Jr as q,Xr as r,T as s,os as t,Ht as u,j as v,oc as w};