marketplacepos 5.41.0 → 5.41.2

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 (215) hide show
  1. package/Marketplace/3rdpartylicenses.txt +123 -123
  2. package/Marketplace/{chunk-5MRT2EFE.js → chunk-25OT4I3W.js} +1 -1
  3. package/Marketplace/chunk-2BUABOHG.js +1 -0
  4. package/Marketplace/chunk-2SXRC4IG.js +1 -0
  5. package/Marketplace/{chunk-KXZCGKQW.js → chunk-2TZBEYNY.js} +1 -1
  6. package/Marketplace/chunk-2ZTDLZVZ.js +1 -0
  7. package/Marketplace/chunk-33IXC6UG.js +1 -0
  8. package/Marketplace/{chunk-7477X7LJ.js → chunk-4CTORK4F.js} +1 -1
  9. package/Marketplace/{chunk-IRKRLYXS.js → chunk-4DV4IT7R.js} +1 -1
  10. package/Marketplace/chunk-4HZR3O3W.js +1 -0
  11. package/Marketplace/chunk-4JG3ZRYP.js +5 -0
  12. package/Marketplace/{chunk-BUFEIJAI.js → chunk-4M63ID5T.js} +1 -1
  13. package/Marketplace/chunk-4PZ5Q3HI.js +1 -0
  14. package/Marketplace/chunk-4YOHPIVG.js +1 -0
  15. package/Marketplace/{chunk-RVYGL22E.js → chunk-55OI2SUF.js} +1 -1
  16. package/Marketplace/chunk-5B4KSPFM.js +1 -0
  17. package/Marketplace/chunk-5DIRXS7I.js +1 -0
  18. package/Marketplace/chunk-5EQNOCXP.js +1 -0
  19. package/Marketplace/chunk-5JYR3YJW.js +1 -0
  20. package/Marketplace/chunk-5QAURMZF.js +222 -0
  21. package/Marketplace/{chunk-V2OJQHE3.js → chunk-5XI7HWS5.js} +2 -2
  22. package/Marketplace/chunk-5ZX2OVBB.js +1 -0
  23. package/Marketplace/chunk-66YHNWRR.js +1 -0
  24. package/Marketplace/chunk-6IFZ2TO6.js +1 -0
  25. package/Marketplace/{chunk-Q72ZXPDP.js → chunk-6LH7FSOW.js} +1 -1
  26. package/Marketplace/{chunk-OLSC6KHB.js → chunk-6MPSYC77.js} +1 -1
  27. package/Marketplace/chunk-6RSAOZUV.js +1 -0
  28. package/Marketplace/chunk-6SBCWEJJ.js +1 -0
  29. package/Marketplace/chunk-6UEHSA6E.js +1 -0
  30. package/Marketplace/{chunk-BIQHA7UA.js → chunk-6X2OBNJQ.js} +4 -4
  31. package/Marketplace/chunk-7H5ILTTK.js +1 -0
  32. package/Marketplace/{chunk-IYYVZ6B6.js → chunk-A2YNWIX6.js} +1 -1
  33. package/Marketplace/chunk-A4F37V57.js +1 -0
  34. package/Marketplace/{chunk-77IUCPIQ.js → chunk-ACIMXBIC.js} +1 -1
  35. package/Marketplace/chunk-AGRVVEIR.js +397 -0
  36. package/Marketplace/chunk-ALKC77XL.js +78 -0
  37. package/Marketplace/chunk-AVEGIEYT.js +193 -0
  38. package/Marketplace/chunk-BBVWQJ7M.js +1 -0
  39. package/Marketplace/chunk-BM4KX73T.js +1 -0
  40. package/Marketplace/chunk-BQTUAYGY.js +1 -0
  41. package/Marketplace/chunk-C7QA2BEN.js +3 -0
  42. package/Marketplace/chunk-CEQA4PTY.js +1 -0
  43. package/Marketplace/chunk-CMZW5QAE.js +1 -0
  44. package/Marketplace/chunk-CSSG7NAJ.js +1 -0
  45. package/Marketplace/chunk-DG32XLYI.js +1 -0
  46. package/Marketplace/chunk-DJILLV4M.js +1 -0
  47. package/Marketplace/chunk-DS4AAABV.js +1 -0
  48. package/Marketplace/{chunk-ZD5LURJS.js → chunk-E2CS7ZMC.js} +1 -1
  49. package/Marketplace/chunk-EL2JACEW.js +1 -0
  50. package/Marketplace/chunk-EU2KAMEK.js +1 -0
  51. package/Marketplace/chunk-EVLYO3HX.js +1 -0
  52. package/Marketplace/chunk-F4GMWHYJ.js +33 -0
  53. package/Marketplace/{chunk-RGR34QZ3.js → chunk-FBZW4Y3J.js} +1 -1
  54. package/Marketplace/chunk-FFAZ3Q3F.js +1 -0
  55. package/Marketplace/chunk-FUWROOE4.js +265 -0
  56. package/Marketplace/{chunk-6NNAICJE.js → chunk-FWG4H3QG.js} +1 -1
  57. package/Marketplace/chunk-GCECFUOP.js +1 -0
  58. package/Marketplace/{chunk-UBMI3NQH.js → chunk-GHBGGQNM.js} +1 -1
  59. package/Marketplace/chunk-GOS4RIF2.js +1 -0
  60. package/Marketplace/{chunk-IEYFOHME.js → chunk-GPC4DECX.js} +1 -1
  61. package/Marketplace/chunk-GZXQUJKX.js +1 -0
  62. package/Marketplace/chunk-H4PA2O6O.js +1 -0
  63. package/Marketplace/chunk-H6WIS2HR.js +2 -0
  64. package/Marketplace/{chunk-TMFFA26Y.js → chunk-HFKKITEW.js} +1 -1
  65. package/Marketplace/chunk-HPGFBOM4.js +1 -0
  66. package/Marketplace/{chunk-KHWTOD6H.js → chunk-HPYTL6TX.js} +1 -1
  67. package/Marketplace/chunk-HTQJCQ32.js +1 -0
  68. package/Marketplace/chunk-IARG7PLL.js +1 -0
  69. package/Marketplace/chunk-IIMHYIRJ.js +1 -0
  70. package/Marketplace/{chunk-GBABJLPQ.js → chunk-IKPRRD5D.js} +1 -1
  71. package/Marketplace/{chunk-EGTYAIU5.js → chunk-JOBWFOGC.js} +1 -1
  72. package/Marketplace/{chunk-PPDHTO44.js → chunk-JRWFZQ5K.js} +1 -1
  73. package/Marketplace/chunk-JS55A2RS.js +7 -0
  74. package/Marketplace/chunk-JV4MMNGD.js +79 -0
  75. package/Marketplace/chunk-K6YEZYU4.js +5 -0
  76. package/Marketplace/{chunk-KQOYVGBL.js → chunk-KJHSB4A2.js} +1 -1
  77. package/Marketplace/chunk-KOKHDU4I.js +1 -0
  78. package/Marketplace/{chunk-GBXNTL4E.js → chunk-KQQCKHF3.js} +1 -1
  79. package/Marketplace/chunk-KTIKLSOU.js +1 -0
  80. package/Marketplace/chunk-KTXS7IPU.js +1 -0
  81. package/Marketplace/chunk-KWQS4KX7.js +1 -0
  82. package/Marketplace/{chunk-COBHWPGI.js → chunk-KX5AWR75.js} +1 -1
  83. package/Marketplace/chunk-KXS76PRS.js +70 -0
  84. package/Marketplace/chunk-KYIY3VQ6.js +141 -0
  85. package/Marketplace/{chunk-J7AGLBPL.js → chunk-LHD7CYML.js} +1 -1
  86. package/Marketplace/chunk-LOPJ3O56.js +1 -0
  87. package/Marketplace/chunk-LR4UZ2OS.js +30 -0
  88. package/Marketplace/{chunk-M3SJUKTG.js → chunk-LSXUXG54.js} +1 -1
  89. package/Marketplace/chunk-LWSRD5LF.js +1 -0
  90. package/Marketplace/{chunk-Q2OEJFVT.js → chunk-M5IQRAHV.js} +1 -1
  91. package/Marketplace/{chunk-3BGJ2T6Y.js → chunk-MCJRJUAO.js} +1 -1
  92. package/Marketplace/chunk-MGVYUYPC.js +15 -0
  93. package/Marketplace/chunk-MP43HA4R.js +1 -0
  94. package/Marketplace/{chunk-RIHLYYZU.js → chunk-MQXPOHBV.js} +1 -1
  95. package/Marketplace/chunk-MTUIRWOB.js +2 -0
  96. package/Marketplace/chunk-MZI5AYCE.js +1 -0
  97. package/Marketplace/{chunk-JBKHY4HH.js → chunk-NRCXYGO3.js} +5 -5
  98. package/Marketplace/chunk-NTW6FBP5.js +1 -0
  99. package/Marketplace/chunk-NZA4BEER.js +102 -0
  100. package/Marketplace/chunk-O55KM5KY.js +1 -0
  101. package/Marketplace/{chunk-G6EG5QJS.js → chunk-OKAPL3YZ.js} +1 -1
  102. package/Marketplace/{chunk-WAW37FIG.js → chunk-OZ77CAJD.js} +1 -1
  103. package/Marketplace/chunk-OZ7LWNOK.js +15 -0
  104. package/Marketplace/chunk-P5FCWMYK.js +1 -0
  105. package/Marketplace/{chunk-NR7IH2JG.js → chunk-PBGDP6XV.js} +1 -1
  106. package/Marketplace/chunk-PE5AFID4.js +1 -0
  107. package/Marketplace/chunk-PEA6KVUS.js +252 -0
  108. package/Marketplace/{chunk-7TWBIV3T.js → chunk-PO7JVKK3.js} +1 -1
  109. package/Marketplace/chunk-PW42BQIY.js +1 -0
  110. package/Marketplace/chunk-Q6V3IOGL.js +1 -0
  111. package/Marketplace/{chunk-AQMHZFKJ.js → chunk-R5TTZPDX.js} +11 -11
  112. package/Marketplace/{chunk-75BDXSG3.js → chunk-R76V3PTN.js} +10 -10
  113. package/Marketplace/chunk-REL734JM.js +1 -0
  114. package/Marketplace/chunk-RHRJXX4W.js +1 -0
  115. package/Marketplace/chunk-S3YMF63V.js +1 -0
  116. package/Marketplace/chunk-SD7M7HOB.js +1 -0
  117. package/Marketplace/{chunk-VGXQU74M.js → chunk-SH7KN2AS.js} +1 -1
  118. package/Marketplace/{chunk-CH2MLZU7.js → chunk-SIYMMMKQ.js} +1 -1
  119. package/Marketplace/chunk-SLQA5QBT.js +1 -0
  120. package/Marketplace/chunk-SRJREA2O.js +5 -0
  121. package/Marketplace/{chunk-QCZIDOKW.js → chunk-SXLKJLAE.js} +1 -1
  122. package/Marketplace/{chunk-6IAGGRZN.js → chunk-SYENQYR7.js} +1 -1
  123. package/Marketplace/chunk-T4K3CJ2R.js +1 -0
  124. package/Marketplace/{chunk-V5WYSCVT.js → chunk-TGMCGROM.js} +1 -1
  125. package/Marketplace/{chunk-OE2JYQHN.js → chunk-TNKPTRB3.js} +1 -1
  126. package/Marketplace/chunk-TQ4ZLZ7C.js +1 -0
  127. package/Marketplace/chunk-TQIIWFRF.js +1 -0
  128. package/Marketplace/chunk-UDQBFSOV.js +1 -0
  129. package/Marketplace/chunk-UF4FKEE7.js +93 -0
  130. package/Marketplace/chunk-UJYSVGLV.js +1 -0
  131. package/Marketplace/{chunk-5GX2GLRY.js → chunk-UMY6NG57.js} +1 -1
  132. package/Marketplace/{chunk-YXFTLQ5M.js → chunk-UPYS4A4M.js} +1 -1
  133. package/Marketplace/chunk-UYW53K3I.js +1 -0
  134. package/Marketplace/chunk-VRI3CYGG.js +1 -0
  135. package/Marketplace/{chunk-6XFYITUD.js → chunk-WGXUKTYP.js} +1 -1
  136. package/Marketplace/{chunk-ZZVNB72Q.js → chunk-WHZ44BAL.js} +1 -1
  137. package/Marketplace/chunk-WTAJSWM2.js +4 -0
  138. package/Marketplace/chunk-WX5S3HCU.js +1 -0
  139. package/Marketplace/{chunk-MNFHFW3E.js → chunk-XEMNZHW6.js} +1 -1
  140. package/Marketplace/chunk-XGYBJAFE.js +1 -0
  141. package/Marketplace/{chunk-J3P46Z53.js → chunk-XQGRC7V2.js} +1 -1
  142. package/Marketplace/chunk-YP2IPJ2O.js +1 -0
  143. package/Marketplace/{chunk-YR2WEZDG.js → chunk-YPVYJUXS.js} +1 -1
  144. package/Marketplace/chunk-Z3ITXK3D.js +1 -0
  145. package/Marketplace/chunk-Z3KD73SP.js +2 -0
  146. package/Marketplace/chunk-ZAVDOMSW.js +1 -0
  147. package/Marketplace/chunk-ZGZ74AJR.js +1 -0
  148. package/Marketplace/{chunk-GHQH62TZ.js → chunk-ZIOAOUAM.js} +1 -1
  149. package/Marketplace/{chunk-2G6NLWKN.js → chunk-ZIUDNFYT.js} +1 -1
  150. package/Marketplace/chunk-ZLNGASME.js +1 -0
  151. package/Marketplace/chunk-ZNDU44GH.js +51 -0
  152. package/Marketplace/{chunk-7FUVW73P.js → chunk-ZR5IXNXB.js} +1 -1
  153. package/Marketplace/index.html +3 -3
  154. package/Marketplace/main-SPNULRF2.js +1 -0
  155. package/Marketplace/{styles-NJFTKO3E.css → styles-X3FXEB7T.css} +1 -1
  156. package/package.json +1 -1
  157. package/Marketplace/chunk-2BBMPSAE.js +0 -93
  158. package/Marketplace/chunk-2Q5YW6MY.js +0 -2
  159. package/Marketplace/chunk-2SUNUZ5Y.js +0 -3
  160. package/Marketplace/chunk-3HTZTPHD.js +0 -1
  161. package/Marketplace/chunk-3ZWNYMH7.js +0 -1
  162. package/Marketplace/chunk-4ASUM4N5.js +0 -1
  163. package/Marketplace/chunk-4G3QN54S.js +0 -193
  164. package/Marketplace/chunk-56YK4SLT.js +0 -1
  165. package/Marketplace/chunk-5FBFUPHZ.js +0 -1
  166. package/Marketplace/chunk-62PFQNHJ.js +0 -1
  167. package/Marketplace/chunk-6ALHX2I4.js +0 -1
  168. package/Marketplace/chunk-6EV6VQBQ.js +0 -1
  169. package/Marketplace/chunk-7GQIIDFF.js +0 -4
  170. package/Marketplace/chunk-AMXLXRQK.js +0 -1
  171. package/Marketplace/chunk-BGEYIOMP.js +0 -1
  172. package/Marketplace/chunk-D54NUPYF.js +0 -153
  173. package/Marketplace/chunk-DI4V7KMK.js +0 -1
  174. package/Marketplace/chunk-DPLEMBB4.js +0 -1
  175. package/Marketplace/chunk-DZ2EE5MV.js +0 -1
  176. package/Marketplace/chunk-E3HMIPER.js +0 -2
  177. package/Marketplace/chunk-EDG73HHT.js +0 -4
  178. package/Marketplace/chunk-EIGDGRRL.js +0 -1
  179. package/Marketplace/chunk-G5MO6R5Z.js +0 -1
  180. package/Marketplace/chunk-GPEVUTDI.js +0 -2
  181. package/Marketplace/chunk-HKYVBAMV.js +0 -1
  182. package/Marketplace/chunk-I6JDDQC2.js +0 -5
  183. package/Marketplace/chunk-IIJMZKPL.js +0 -1
  184. package/Marketplace/chunk-K2H6WANG.js +0 -1
  185. package/Marketplace/chunk-K64THYES.js +0 -1
  186. package/Marketplace/chunk-KP4WSF75.js +0 -1
  187. package/Marketplace/chunk-KQ546ATX.js +0 -1
  188. package/Marketplace/chunk-KQAQTVXQ.js +0 -1
  189. package/Marketplace/chunk-KVP6OL4J.js +0 -2
  190. package/Marketplace/chunk-L4NLJBLA.js +0 -1
  191. package/Marketplace/chunk-LPXBSHUI.js +0 -180
  192. package/Marketplace/chunk-MATSRG2L.js +0 -447
  193. package/Marketplace/chunk-MNQZPU5N.js +0 -1
  194. package/Marketplace/chunk-NEIZYQV3.js +0 -1
  195. package/Marketplace/chunk-PXB4YEY3.js +0 -1
  196. package/Marketplace/chunk-QNT7YFQS.js +0 -1
  197. package/Marketplace/chunk-RLLHX27L.js +0 -1
  198. package/Marketplace/chunk-RNM3GVNZ.js +0 -1
  199. package/Marketplace/chunk-SE2DPPGP.js +0 -1
  200. package/Marketplace/chunk-SMZ7F54P.js +0 -5
  201. package/Marketplace/chunk-SXW52HYQ.js +0 -1
  202. package/Marketplace/chunk-T5ONJF63.js +0 -7
  203. package/Marketplace/chunk-T6QOFDEE.js +0 -1
  204. package/Marketplace/chunk-TAO67VCP.js +0 -1
  205. package/Marketplace/chunk-TQ2P22BQ.js +0 -1
  206. package/Marketplace/chunk-TRHB4HA4.js +0 -1
  207. package/Marketplace/chunk-V6IVDZR7.js +0 -2
  208. package/Marketplace/chunk-VETHPEVU.js +0 -1
  209. package/Marketplace/chunk-VSEWXNVC.js +0 -291
  210. package/Marketplace/chunk-XITXJ764.js +0 -15
  211. package/Marketplace/chunk-XM6GN4VF.js +0 -1
  212. package/Marketplace/chunk-XYIY2TDE.js +0 -1
  213. package/Marketplace/chunk-Y3U6BFV5.js +0 -1
  214. package/Marketplace/chunk-YIUQQGOQ.js +0 -1
  215. package/Marketplace/main-DNC2TBQ6.js +0 -1
@@ -0,0 +1 @@
1
+ import{c as E}from"./chunk-PW42BQIY.js";import{n as b}from"./chunk-MTUIRWOB.js";import{Gb as v,Gc as r,Hc as T,Ic as d,Jb as D,Mb as _,Oa as f,Yb as g,dc as h,ec as C,gc as w,hc as y,ic as a,jc as i,kc as m,pb as u,rb as n,uc as x}from"./chunk-JS55A2RS.js";var L=(()=>{class t{transform(e){return E.getChannelLogoByTypeId(e)}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275pipe=D({name:"channelImage",type:t,pure:!0})}}return t})();function S(t,l){if(t&1&&m(0,"img",8),t&2){let e=x().$implicit;g("src",e==null?null:e.ThumbnailURL,u)}}function V(t,l){t&1&&m(0,"img",9)}function F(t,l){if(t&1&&_(0,S,1,1,"img",8)(1,V,1,0,"img",9),t&2){let e=l.$implicit;h(e!=null&&e.ThumbnailURL?0:1)}}function j(t,l){if(t&1&&m(0,"img",12),t&2){let e=x().$implicit;g("src",e==null?null:e.ThumbnailURL,u)}}function P(t,l){t&1&&m(0,"img",13)}function q(t,l){if(t&1&&(a(0,"div",15),r(1),i()),t&2){let e=x().$implicit;n(),d("x",e.Quantity,"")}}function U(t,l){if(t&1&&(a(0,"li")(1,"div",10)(2,"div",11),_(3,j,1,1,"img",12)(4,P,1,0,"img",13),a(5,"div",14)(6,"div",15),r(7),i(),a(8,"div",16),r(9),i()()(),_(10,q,2,1,"div",15),i()()),t&2){let e=l.$implicit;n(3),h(e!=null&&e.ThumbnailURL?3:4),n(4),T(e.Name),n(2),T(e.Code),n(),h(e.Quantity>1?10:-1)}}var B=(()=>{class t{constructor(){this.variants=f()}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=v({type:t,selectors:[["variants-dropdown"]],inputs:{variants:[1,"variants"]},decls:15,vars:2,consts:[[1,"dropdown","pe-6"],["type","button","data-bs-toggle","dropdown","aria-expanded","false",1,"btn","dropdown-toggle","border-0","d-flex","align-items-center","justify-content-between","gap-4","w-100",2,"padding","0px"],[1,"text-start"],[1,"fs-6"],[1,"d-flex","align-items-center","gap-2"],[1,"fa-regular","fa-angle-down"],[1,"dropdown-menu","p-3"],[1,"ms-6","mt-3","text-black"],[1,"thumb-square","border","border-opacity-10",3,"src"],["src","https://cdn.dealpos.app/template/products_thumb.png",1,"border","border-opacity-10","thumb-square"],[1,"dropdown-item","d-flex","align-items-center","gap-5","justify-content-between",2,"padding-left","8px","padding-right","8px"],[1,"d-flex","align-items-center","justify-content-start","gap-5"],[1,"thumb-square-lg","border","border-opacity-10",3,"src"],["src","https://cdn.dealpos.app/template/products_thumb.png",1,"thumb-square-lg","border","border-opacity-10"],[1,"lh-base"],[1,"text-black"],[1,"text-muted"]],template:function(o,p){if(o&1&&(a(0,"div",0)(1,"button",1)(2,"div",2)(3,"div",3),r(4),i(),a(5,"div",4),w(6,F,2,1,null,null,C),i()(),a(8,"div"),m(9,"i",5),i()(),a(10,"ul",6)(11,"h5",7),r(12),i(),w(13,U,11,4,"li",null,C),i()()),o&2){let s,c;n(4),d("",(s=p.variants())==null?null:s.length," items"),n(2),y(p.variants()),n(6),d("",(c=p.variants())==null?null:c.length," Items"),n(),y(p.variants())}},dependencies:[b],styles:[".dropdown-toggle[_ngcontent-%COMP%]:after{display:none!important}.dropdown[_ngcontent-%COMP%] .dropdown-menu.show[_ngcontent-%COMP%]{top:unset!important}.thumb-square[_ngcontent-%COMP%]{width:26px;height:26px;object-fit:contain;object-position:center}.thumb-square-lg[_ngcontent-%COMP%]{width:50px;height:50px;object-fit:contain;object-position:center}"]})}}return t})();var G=(()=>{class t{constructor(){this.variant=f()}ngOnInit(){}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=v({type:t,selectors:[["variant-with-image"]],inputs:{variant:[1,"variant"]},decls:8,vars:3,consts:[[1,"d-flex","align-items-center","gap-5"],[1,"thumb-square-lg","border","border-opacity-10",3,"src"],[1,"lh-base"],[1,"text-black"],[1,"text-muted"]],template:function(o,p){if(o&1&&(a(0,"div",0)(1,"div"),m(2,"img",1),i(),a(3,"div",2)(4,"div",3),r(5),i(),a(6,"div",4),r(7),i()()()),o&2){let s,c,I;n(2),g("src",((s=p.variant())==null?null:s.ThumbnailURL)||"https://cdn.dealpos.app/template/products_thumb.png",u),n(3),d(" ",(c=p.variant())==null?null:c.Name," "),n(2),d(" ",(I=p.variant())==null?null:I.Code," ")}},dependencies:[b],styles:[".thumb-square-lg[_ngcontent-%COMP%]{width:50px;height:50px;object-fit:contain;object-position:center}"]})}}return t})();export{L as a,B as b,G as c};
@@ -0,0 +1 @@
1
+ import{a as d}from"./chunk-F4GMWHYJ.js";import{Aa as o,Ca as a,Gb as r,Kb as s,Xb as l,ac as C,ic as c,jc as f,kc as m}from"./chunk-JS55A2RS.js";var u=(()=>{class t extends d{static \u0275fac=(()=>{let n;return function(e){return(n||(n=a(t)))(e||t)}})();static \u0275cmp=r({type:t,selectors:[["ChevronLeftIcon"]],features:[s],decls:2,vars:5,consts:[["width","14","height","14","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M9.61296 13C9.50997 13.0005 9.40792 12.9804 9.3128 12.9409C9.21767 12.9014 9.13139 12.8433 9.05902 12.7701L3.83313 7.54416C3.68634 7.39718 3.60388 7.19795 3.60388 6.99022C3.60388 6.78249 3.68634 6.58325 3.83313 6.43628L9.05902 1.21039C9.20762 1.07192 9.40416 0.996539 9.60724 1.00012C9.81032 1.00371 10.0041 1.08597 10.1477 1.22959C10.2913 1.37322 10.3736 1.56698 10.3772 1.77005C10.3808 1.97313 10.3054 2.16968 10.1669 2.31827L5.49496 6.99022L10.1669 11.6622C10.3137 11.8091 10.3962 12.0084 10.3962 12.2161C10.3962 12.4238 10.3137 12.6231 10.1669 12.7701C10.0945 12.8433 10.0083 12.9014 9.91313 12.9409C9.81801 12.9804 9.71596 13.0005 9.61296 13Z","fill","currentColor"]],template:function(i,e){i&1&&(o(),c(0,"svg",0),m(1,"path",1),f()),i&2&&(C(e.getClassNames()),l("aria-label",e.ariaLabel)("aria-hidden",e.ariaHidden)("role",e.role))},encapsulation:2})}return t})();export{u as a};
@@ -1 +1 @@
1
- import{ja as n}from"./chunk-T5ONJF63.js";var a=(()=>{class e{isErrorState(t,i){return!!(t&&t.invalid&&(t.touched||i&&i.submitted))}static \u0275fac=function(i){return new(i||e)};static \u0275prov=n({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();export{a};
1
+ import{ja as n}from"./chunk-JS55A2RS.js";var a=(()=>{class e{isErrorState(t,i){return!!(t&&t.invalid&&(t.touched||i&&i.submitted))}static \u0275fac=function(i){return new(i||e)};static \u0275prov=n({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();export{a};
@@ -0,0 +1 @@
1
+ import{M as o}from"./chunk-OZ77CAJD.js";import{Hb as i,ka as t}from"./chunk-JS55A2RS.js";var m=(()=>{class e{static \u0275fac=function(r){return new(r||e)};static \u0275mod=i({type:e});static \u0275inj=t({imports:[o,o]})}return e})();export{m as a};
@@ -0,0 +1 @@
1
+ import{b as ae,e as re}from"./chunk-4M63ID5T.js";import{b as ie,c as le}from"./chunk-PW42BQIY.js";import{b as M,c as W,i as me,j as _,k as S}from"./chunk-6X2OBNJQ.js";import{c as T,e as K,h as R,i as Z,j as x,l as N,m as k,n as $,p as ee,r as te,v as ne,x as oe}from"./chunk-CSSG7NAJ.js";import{d as F,f as Q,g as X}from"./chunk-MTUIRWOB.js";import{Fc as A,Gb as y,Gc as r,Hc as P,Ic as Y,Kc as b,Lc as w,Mb as f,Mc as D,Sc as U,Tc as J,Yb as p,dc as h,ic as i,jc as l,kc as V,oc as I,pb as z,rb as a,tc as v,uc as L,xb as C,ya as c,za as g}from"./chunk-JS55A2RS.js";function pe(t,u){if(t&1&&(i(0,"tr")(1,"td")(2,"a",11),V(3,"img",12),i(4,"span"),r(5),l()()(),i(6,"td"),r(7),l(),i(8,"td"),r(9),l()()),t&2){let n=u.$implicit;a(2),p("href","/menu/channel/marketplace/view?ID="+n.Key.ID,z),a(),p("src",n.Logo,z),a(2),P(n.Key.Name),a(2),P(n.Value.Out),a(2),P(n.Value.Tg)}}var We=(()=>{class t{constructor(n,o){this.dialogRef=n,this.data=o,this.generateChannelName(),this.channels=this.setChannelLogo(o.channels)}ngOnInit(){this.modalConfig=new _,this.modalConfig.title="Channel - New Order Configuration is not Unique!",this.modalConfig.headerType=me.Warning,this.modalConfig.hideOk=!0,this.modalConfig.cancelText="Close",this.modalConfig.customWidth="500px",this.modalConfig.bodyScrollable=!0,this.modalConfig.hideClose=!0}setChannelLogo(n){return n.map(o=>(o.Logo=le.getChannelLogoByTypeId(o.Key.TypeID),o))}generateChannelName(){this.channelNames="";let n=this.data.channels;n.forEach((o,e)=>{this.channelNames+=`${o.Key} ${e!=n.length-1?" + ":""}`})}onClose(){this.dialogRef.close()}static{this.\u0275fac=function(o){return new(o||t)(C(M),C(W))}}static{this.\u0275cmp=y({type:t,selectors:[["app-modal-channel-warning"]],standalone:!1,decls:24,vars:2,consts:[[3,"onCancel","onClose","config"],["content","",1,"pt-2","px-4"],[1,"row"],[1,"col-12"],[1,"lh-base","fs-5"],[1,"mb-4"],[1,"table","table-bordered"],[1,"table-light"],[4,"ngFor","ngForOf"],[1,"fs-5","mt-4"],["href","https://support.dealpos.com/en/articles/8281096-setup-multiple-channel-marketplace-to-one-warehouse-outlet","target","_blank"],["target","_blank",3,"href"],[1,"me-3",2,"width","24px",3,"src"]],template:function(o,e){o&1&&(i(0,"modal-material",0),v("onCancel",function(){return e.onClose()})("onClose",function(){return e.onClose()}),i(1,"div",1)(2,"div",2)(3,"div",3)(4,"p",4),r(5,"When your order configuration is not unique, your Dashboard Sales Report will be invalid. You can use either Outlet or Order Tag to differentiate Channel Order. "),l(),i(6,"h5",5),r(7,"Your duplicate Channels are"),l(),i(8,"table",6)(9,"thead")(10,"tr",7)(11,"th"),r(12,"Channel"),l(),i(13,"th"),r(14,"Outlet"),l(),i(15,"th"),r(16,"Tag"),l()()(),i(17,"tbody"),f(18,pe,10,5,"tr",8),l()(),i(19,"p",9),r(20," Please refer to this "),i(21,"a",10),r(22,"article"),l(),r(23," for more information "),l()()()()()),o&2&&(p("config",e.modalConfig),a(18),p("ngForOf",e.channels))},dependencies:[Q,S],encapsulation:2})}}return t})();var Ke=(()=>{class t{constructor(n,o,e){this.dialogRef=n,this.httpService=o,this.toastr=e,this.modalConfig=new _,this.modalConfig.title="Write Off Reason"}onSubmit(){let n={Name:this.reason};this.subscription=this.httpService.post("/api/channel/AddWriteoffOption",n).subscribe(o=>{this.toastr.success(o.Message,"Success"),this.dialogRef.close(n)})}onClose(){this.dialogRef.close(!1)}ngOnDestroy(){this.subscription.unsubscribe()}static{this.\u0275fac=function(o){return new(o||t)(C(M),C(re),C(ae))}}static{this.\u0275cmp=y({type:t,selectors:[["app-dialog-writeOff-reason"]],standalone:!1,decls:7,vars:3,consts:[["name","ngModel"],[3,"onClose","onCancel","onOk","dynamicValidated","config"],["content",""],[1,"form-label-group"],["type","text","id","writeOffReason","placeholder","Write Off Reason","name","writeOffReason",1,"form-control",3,"ngModelChange","ngModel"],["for","shopid"]],template:function(o,e){if(o&1){let m=I();i(0,"modal-material",1),v("onClose",function(){return c(m),g(e.onClose())})("onCancel",function(){return c(m),g(e.onClose())})("onOk",function(){return c(m),g(e.onSubmit())}),i(1,"div",2)(2,"div",3)(3,"input",4,0),D("ngModelChange",function(s){return c(m),w(e.reason,s)||(e.reason=s),g(s)}),l(),i(5,"label",5),r(6,"Reason"),l()()()()}o&2&&(p("dynamicValidated",e.reason)("config",e.modalConfig),a(3),b("ngModel",e.reason))},dependencies:[T,R,k,S],styles:[".mat-dialog-title[_ngcontent-%COMP%]{margin-bottom:0%;margin-left:24px}"]})}}return t})();var ue=t=>({invalid:t});function fe(t,u){t&1&&(i(0,"small"),r(1," URL is required "),l())}function ce(t,u){if(t&1&&(i(0,"div",13),f(1,fe,2,0,"small",14),l()),t&2){L();let n=A(10);a(),p("ngIf",n.errors.required)}}function ge(t,u){t&1&&(i(0,"small"),r(1," Email is required "),l())}function Ce(t,u){t&1&&(i(0,"small"),r(1," Email is not valid "),l())}function he(t,u){if(t&1&&(i(0,"div",13),f(1,ge,2,0,"small",14)(2,Ce,2,0,"small",14),l()),t&2){L();let n=A(16);a(),p("ngIf",n.errors.required),a(),p("ngIf",n.errors.pattern)}}var Be=(()=>{class t{constructor(n){this.dialogRef=n}ngOnInit(){this.formData={URL:"",Email:""},this.initModalConfig()}initModalConfig(){this.modalConfig=new _,this.modalConfig.title="Fill data for Customer Support"}onSubmit(n){n!="Enter"&&this.dialogRef.close(this.formData)}onClose(){this.dialogRef.close()}static{this.\u0275fac=function(o){return new(o||t)(C(M))}}static{this.\u0275cmp=y({type:t,selectors:[["app-contact-support"]],standalone:!1,decls:18,vars:9,consts:[["url","ngModel"],["email","ngModel"],[3,"onClose","onCancel","onOk","dynamicValidated","config"],["content",""],[1,"mx-4"],["for","customerURL"],[1,"input-group","mb-2"],[1,"input-group-prepend"],["id","tokopediaUrl",1,"border-start-0","rounded-start","input-group-text","pointer-default","bg-light",2,"height","58px",3,"ngClass"],["required","","type","text","id","customerURL","name","customerURL","title","customerURL",1,"form-control","border-start-0","customerUrl",3,"ngModelChange","ngModel"],["class","text-danger",4,"ngIf"],["for","customerEmail"],["required","","type","text","id","customerEmail","name","customerEmail","title","customerEmail","pattern","\\b[\\w\\.-]+@[\\w\\.-]+\\.\\w{2,4}\\b",1,"form-control",3,"ngModelChange","ngModel"],[1,"text-danger"],[4,"ngIf"]],template:function(o,e){if(o&1){let m=I();i(0,"modal-material",2),v("onClose",function(){return c(m),g(e.onClose())})("onCancel",function(){return c(m),g(e.onClose())})("onOk",function(s){return c(m),g(e.onSubmit(s))}),i(1,"div",3)(2,"div",4)(3,"label",5),r(4,"Tokopedia URL"),l(),i(5,"div",6)(6,"div",7)(7,"span",8),r(8,"https://tokopedia.com/"),l()(),i(9,"input",9,0),D("ngModelChange",function(s){return c(m),w(e.formData.URL,s)||(e.formData.URL=s),g(s)}),l()(),f(11,ce,2,1,"div",10),i(12,"label",11),r(13,"Requester's Email"),l(),i(14,"div",6)(15,"input",12,1),D("ngModelChange",function(s){return c(m),w(e.formData.Email,s)||(e.formData.Email=s),g(s)}),l()(),f(17,he,3,2,"div",10),l()()()}if(o&2){let m=A(10),d=A(16);p("dynamicValidated",!m.invalid&&!d.invalid)("config",e.modalConfig),a(7),p("ngClass",U(7,ue,m.invalid&&(m.dirty||m.touched))),a(2),b("ngModel",e.formData.URL),a(2),p("ngIf",m.invalid&&(m.dirty||m.touched)),a(4),b("ngModel",e.formData.Email),a(2),p("ngIf",d.invalid&&(d.dirty||d.touched))}},dependencies:[F,X,T,R,ne,oe,k,S],styles:["mat-form-field[_ngcontent-%COMP%]{width:100%;height:100%}.mat-dialog-title[_ngcontent-%COMP%]{margin-bottom:0%;margin-left:24px}.input-group[_ngcontent-%COMP%] > input[_ngcontent-%COMP%]{height:3.625rem;padding:.75rem;color:#343434;font-size:.875rem;border-radius:.25rem!important;border-color:#c8d3df}.input-group[_ngcontent-%COMP%] > input.ng-invalid.ng-touched[_ngcontent-%COMP%]{border-color:#fb404b}.input-group[_ngcontent-%COMP%] > input.customerUrl[_ngcontent-%COMP%]{border-top-left-radius:0!important;border-bottom-left-radius:0!important}.invalid[_ngcontent-%COMP%]{border-color:#fb404b}.pointer-default[_ngcontent-%COMP%]{cursor:default}"]})}}return t})();var Je=(()=>{class t{constructor(n,o){this.dialogRef=n,this.data=o}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new _,this.modalConfig.title=this.data?.title,this.modalConfig.okText="SAVE"}onSubmit(){this.dialogRef.close(this.shopID)}onClose(){this.dialogRef.close()}static{this.\u0275fac=function(o){return new(o||t)(C(M),C(W))}}static{this.\u0275cmp=y({type:t,selectors:[["app-modal-dialog-tokopedia"]],standalone:!1,decls:7,vars:3,consts:[["name","ngModel"],[3,"onClose","onCancel","onOk","dynamicValidated","config"],["content",""],[1,"form-label-group"],["type","text","id","shopid","placeholder","Shop ID","name","ShopID","data-toggle","tooltip","title","Channel Name",1,"form-control",3,"ngModelChange","ngModel"],["for","shopid"]],template:function(o,e){if(o&1){let m=I();i(0,"modal-material",1),v("onClose",function(){return c(m),g(e.onClose())})("onCancel",function(){return c(m),g(e.onClose())})("onOk",function(){return c(m),g(e.onSubmit())}),i(1,"div",2)(2,"div",3)(3,"input",4,0),D("ngModelChange",function(s){return c(m),w(e.shopID,s)||(e.shopID=s),g(s)}),l(),i(5,"label",5),r(6,"Shop ID"),l()()()()}o&2&&(p("dynamicValidated",e.shopID)("config",e.modalConfig),a(3),b("ngModel",e.shopID))},dependencies:[T,R,k,S],styles:["mat-form-field[_ngcontent-%COMP%]{width:100%;height:100%}.mat-dialog-title[_ngcontent-%COMP%]{margin-bottom:0%;margin-left:24px}.vertical-radio[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:15px 0}"]})}}return t})();var _e=t=>({"input-group":t}),ye=(t,u)=>({"is-invalid":t,"input-shopify rounded-start":u}),se=t=>({"is-invalid":t});function ve(t,u){t&1&&(i(0,"label",3),r(1,"Shopify URL"),l())}function Me(t,u){t&1&&(i(0,"label",3),r(1,"URL"),l())}function Se(t,u){t&1&&(i(0,"span",6),r(1,"myshopify.com"),l())}function Te(t,u){if(t&1&&(i(0,"div"),r(1),l()),t&2){let n=L(2);a(),Y("",n.data==null?null:n.data.title," url is required")}}function Re(t,u){if(t&1&&(i(0,"div",7),f(1,Te,2,1,"div"),l()),t&2){let n,o=L();a(),h(!(o.formGroup==null||(n=o.formGroup.get("URL"))==null)&&n.getError("required")?1:-1)}}function be(t,u){t&1&&r(0," API Key ")}function we(t,u){t&1&&r(0," Consumer Key ")}function De(t,u){t&1&&(r(0," ("),i(1,"a",11),r(2,"help center article"),l(),r(3,") "))}function Ee(t,u){t&1&&(i(0,"div",7),r(1,"API Key is required"),l())}function Oe(t,u){t&1&&r(0," Admin API Access Token ")}function Ge(t,u){t&1&&r(0," Consumer Secret ")}function Ve(t,u){t&1&&(i(0,"div",7),r(1,"Consumer Secret is required"),l())}var et=(()=>{class t{constructor(n,o){this.dialogRef=n,this.data=o,this.modalConfig=new _,this.urlCtrl=new N(null),this.channelType=ie}ngOnInit(){this.initModalConfig(),this.initFormGroup()}initFormGroup(){let n=[K.required];this.formGroup=new x({URL:new N(null,n),ConsumerKey:new N(null,[K.required]),ConsumerSecret:new N(null,[K.required])})}initModalConfig(){this.modalConfig=new _,this.modalConfig.title=this.data.title,this.modalConfig.okText="SAVE"}onClose(){this.dialogRef.close()}onSubmit(){this.formGroup.markAllAsTouched();let n=this.formGroup?.get("URL")?.getError("pattern"),o=this.formGroup?.get("ConsumerKey")?.valid,e=this.formGroup?.get("ConsumerSecret")?.valid;if(this.formGroup?.valid||n&&o&&e){let d=this.formGroup.value;d=this.trimShopifyUrl(d),this.dialogRef.close(d)}}trimShopifyUrl(n){if(this.data?.channelType==this.channelType.Shopify){let o=n.URL?.trim()||"";o=o.replace(/^https?:\/\//,""),o.includes(".myshopify.com")||(o=`${o}.myshopify.com`),n.URL=o}return n}static{this.\u0275fac=function(o){return new(o||t)(C(M),C(W))}}static{this.\u0275cmp=y({type:t,selectors:[["app-modal-register-channel"]],standalone:!1,decls:23,vars:27,consts:[[3,"onClose","onCancel","onOk","config"],["content",""],[3,"formGroup"],["for","shopid",1,"form-label","fw-bold","mb-2"],[1,"mb-8","has-validation",3,"ngClass"],["type","text","id","shopid","name","URL","title","URL","formControlName","URL",1,"form-control","form-input","rounded",3,"placeholder","ngClass"],["id","basic-addon2",1,"input-group-text","rounded-end","form-input","text-secondary"],[1,"invalid-feedback"],[1,"mb-8","has-validation"],["type","text","id","ConsumerKey","name","ConsumerKey","title","ConsumerKey","formControlName","ConsumerKey",1,"form-control","rounded","form-input",3,"placeholder","ngClass"],["type","text","id","ConsumerSecret","name","ConsumerSecret","title","ConsumerSecret","formControlName","ConsumerSecret",1,"form-control","rounded","form-input",3,"placeholder","ngClass"],["target","_blank","href","https://support.dealpos.com/en/articles/9525716-shopify-authorization-at-dealpos-apps",1,"button","text-primary","fw-bold"]],template:function(o,e){if(o&1&&(i(0,"modal-material",0),v("onClose",function(){return e.onClose()})("onCancel",function(){return e.onClose()})("onOk",function(){return e.onSubmit()}),i(1,"div",1)(2,"form",2),f(3,ve,2,0,"label",3),i(4,"div",4),f(5,Me,2,0,"label",3),V(6,"input",5),f(7,Se,2,0,"span",6)(8,Re,2,1,"div",7),l(),i(9,"div",8)(10,"label",3)(11,"span"),f(12,be,1,0)(13,we,1,0),l(),f(14,De,4,0),l(),V(15,"input",9),f(16,Ee,2,0,"div",7),l(),i(17,"div",8)(18,"label",3),f(19,Oe,1,0)(20,Ge,1,0),l(),V(21,"input",10),f(22,Ve,2,0,"div",7),l()()()()),o&2){let m,d,s,E,O,G;p("config",e.modalConfig),a(2),p("formGroup",e.formGroup),a(),h((e.data==null?null:e.data.channelType)==e.channelType.Shopify?3:-1),a(),p("ngClass",U(18,_e,(e.data==null?null:e.data.channelType)==e.channelType.Shopify)),a(),h((e.data==null?null:e.data.channelType)!=e.channelType.Shopify?5:-1),a(),p("placeholder",(e.data==null?null:e.data.channelType)==e.channelType.Shopify?"[ex: brand.myshopify.com]":"https://mydomain.com/")("ngClass",J(20,ye,(e.formGroup==null||(m=e.formGroup.get("URL"))==null?null:m.invalid)&&((e.formGroup==null||(m=e.formGroup.get("URL"))==null?null:m.dirty)||(e.formGroup==null||(m=e.formGroup.get("URL"))==null?null:m.touched)),(e.data==null?null:e.data.channelType)==e.channelType.Shopify)),a(),h((e.data==null?null:e.data.channelType)==e.channelType.Shopify?7:-1),a(),h(!(e.formGroup==null||(d=e.formGroup.get("URL"))==null)&&d.invalid&&(!(e.formGroup==null||(d=e.formGroup.get("URL"))==null)&&d.dirty||!(e.formGroup==null||(d=e.formGroup.get("URL"))==null)&&d.touched)?8:-1),a(4),h((e.data==null?null:e.data.channelType)==e.channelType.Shopify?12:13),a(2),h((e.data==null?null:e.data.channelType)==e.channelType.Shopify?14:-1),a(),p("placeholder",(e.data==null?null:e.data.channelType)==e.channelType.Shopify?"[Create an app and copy the API Key]":"[Create an app and copy the Consumer Key]")("ngClass",U(23,se,(e.formGroup==null||(s=e.formGroup.get("ConsumerKey"))==null?null:s.invalid)&&((e.formGroup==null||(s=e.formGroup.get("ConsumerKey"))==null?null:s.dirty)||(e.formGroup==null||(s=e.formGroup.get("ConsumerKey"))==null?null:s.touched)))),a(),h(!(e.formGroup==null||(E=e.formGroup.get("ConsumerKey"))==null)&&E.getError("required")&&(!(e.formGroup==null||(E=e.formGroup.get("ConsumerKey"))==null)&&E.dirty||!(e.formGroup==null||(E=e.formGroup.get("ConsumerKey"))==null)&&E.touched)?16:-1),a(3),h((e.data==null?null:e.data.channelType)==e.channelType.Shopify?19:20),a(2),p("placeholder",(e.data==null?null:e.data.channelType)==e.channelType.Shopify?"[shpat***************************]":"cs_***************")("ngClass",U(25,se,(e.formGroup==null||(O=e.formGroup.get("ConsumerSecret"))==null?null:O.invalid)&&((e.formGroup==null||(O=e.formGroup.get("ConsumerSecret"))==null?null:O.dirty)||(e.formGroup==null||(O=e.formGroup.get("ConsumerSecret"))==null?null:O.touched)))),a(),h(!(e.formGroup==null||(G=e.formGroup.get("ConsumerSecret"))==null)&&G.getError("required")&&(!(e.formGroup==null||(G=e.formGroup.get("ConsumerSecret"))==null)&&G.dirty||!(e.formGroup==null||(G=e.formGroup.get("ConsumerSecret"))==null)&&G.touched)?22:-1)}},dependencies:[F,$,T,R,Z,S,ee,te],styles:[".input-shopify[_ngcontent-%COMP%]{border-top-right-radius:0!important;border-bottom-right-radius:0!important}.form-input[_ngcontent-%COMP%]{min-height:3.625rem}"]})}}return t})();export{We as a,Ke as b,Be as c,Je as d,et as e};
@@ -1 +1 @@
1
- import{e as h}from"./chunk-BUFEIJAI.js";import{K as n,ea as s,g as a,ja as o,pa as c,q as i}from"./chunk-T5ONJF63.js";var m=(()=>{class e{constructor(){this.httpService=c(h),this._channelTree=new a({isFirstLoad:!1,data:[]}),this.channelTree$=this._channelTree.asObservable()}getChannelTree$(){return this.channelTree$.pipe(n(t=>t.isFirstLoad?i(t.data):this.getChannelTree()))}getChannelTree(){return this.httpService.get("/api/InventoryLoader/Channel").pipe(s(r=>{this._channelTree.next({isFirstLoad:!0,data:r})}))}static{this.\u0275fac=function(r){return new(r||e)}}static{this.\u0275prov=o({token:e,factory:e.\u0275fac})}}return e})();export{m as a};
1
+ import{e as h}from"./chunk-4M63ID5T.js";import{K as n,ea as s,g as a,ja as o,pa as c,q as i}from"./chunk-JS55A2RS.js";var m=(()=>{class e{constructor(){this.httpService=c(h),this._channelTree=new a({isFirstLoad:!1,data:[]}),this.channelTree$=this._channelTree.asObservable()}getChannelTree$(){return this.channelTree$.pipe(n(t=>t.isFirstLoad?i(t.data):this.getChannelTree()))}getChannelTree(){return this.httpService.get("/api/InventoryLoader/Channel").pipe(s(r=>{this._channelTree.next({isFirstLoad:!0,data:r})}))}static{this.\u0275fac=function(r){return new(r||e)}}static{this.\u0275prov=o({token:e,factory:e.\u0275fac})}}return e})();export{m as a};
@@ -1 +1 @@
1
- import{d as de}from"./chunk-2SUNUZ5Y.js";import{b as ge,e as fe}from"./chunk-BUFEIJAI.js";import{g as he,ja as ue,oa as U}from"./chunk-T5ONJF63.js";import{a as _,b as $,c as A,i as g}from"./chunk-K2H6WANG.js";var C=class extends Error{constructor(e,t){let o=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=o}},P=class extends Error{constructor(e="A timeout occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},S=class extends Error{constructor(e="An abort occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},j=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=o}},O=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=o}},F=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=o}},M=class extends Error{constructor(e){let t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}},q=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=o}};var H=class{constructor(e,t,o){this.statusCode=e,this.statusText=t,this.content=o}},k=class{get(e,t){return this.send($(_({},t),{method:"GET",url:e}))}post(e,t){return this.send($(_({},t),{method:"POST",url:e}))}delete(e,t){return this.send($(_({},t),{method:"DELETE",url:e}))}getCookieString(e){return""}};var s=function(r){return r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Information=2]="Information",r[r.Warning=3]="Warning",r[r.Error=4]="Error",r[r.Critical=5]="Critical",r[r.None=6]="None",r}(s||{});var E=class{constructor(){}log(e,t){}};E.instance=new E;var be="8.0.17",d=class{static isRequired(e,t){if(e==null)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,o){if(!(e in t))throw new Error(`Unknown ${o} value: ${e}.`)}},p=class r{static get isBrowser(){return!r.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!r.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!r.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}};function x(r,e){let t="";return v(r)?(t=`Binary data of length ${r.byteLength}`,e&&(t+=`. Content: '${Se(r)}'`)):typeof r=="string"&&(t=`String data of length ${r.length}`,e&&(t+=`. Content: '${r}'`)),t}function Se(r){let e=new Uint8Array(r),t="";return e.forEach(o=>{let n=o<16?"0":"";t+=`0x${n}${o.toString(16)} `}),t.substr(0,t.length-1)}function v(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function J(r,e,t,o,n,i){return g(this,null,function*(){let c={},[a,l]=I();c[a]=l,r.log(s.Trace,`(${e} transport) sending data. ${x(n,i.logMessageContent)}.`);let u=v(n)?"arraybuffer":"text",f=yield t.post(o,{content:n,headers:_(_({},c),i.headers),responseType:u,timeout:i.timeout,withCredentials:i.withCredentials});r.log(s.Trace,`(${e} transport) request complete. Response status: ${f.statusCode}.`)})}function pe(r){return r===void 0?new R(s.Information):r===null?E.instance:r.log!==void 0?r:new R(r)}var z=class{constructor(e,t){this._subject=e,this._observer=t}dispose(){let e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}},R=class{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){let o=`[${new Date().toISOString()}] ${s[e]}: ${t}`;switch(e){case s.Critical:case s.Error:this.out.error(o);break;case s.Warning:this.out.warn(o);break;case s.Information:this.out.info(o);break;default:this.out.log(o);break}}}};function I(){let r="X-SignalR-User-Agent";return p.isNode&&(r="User-Agent"),[r,Ce(be,ye(),ke(),ve())]}function Ce(r,e,t,o){let n="Microsoft SignalR/",i=r.split(".");return n+=`${i[0]}.${i[1]}`,n+=` (${r}; `,e&&e!==""?n+=`${e}; `:n+="Unknown OS; ",n+=`${t}`,o?n+=`; ${o}`:n+="; Unknown Runtime Version",n+=")",n}function ye(){if(p.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function ve(){if(p.isNode)return process.versions.node}function ke(){return p.isNode?"NodeJS":"Browser"}function V(r){return r.stack?r.stack:r.message?r.message:`${r}`}function _e(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}var K=class extends k{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||p.isNode){let t=typeof __webpack_require__=="function"?__non_webpack_require__:A;this._jar=new(t("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=t("node-fetch"):this._fetchType=fetch,this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(_e());if(typeof AbortController>"u"){let t=typeof __webpack_require__=="function"?__non_webpack_require__:A;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}send(e){return g(this,null,function*(){if(e.abortSignal&&e.abortSignal.aborted)throw new S;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");let t=new this._abortControllerType,o;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),o=new S});let n=null;if(e.timeout){let l=e.timeout;n=setTimeout(()=>{t.abort(),this._logger.log(s.Warning,"Timeout from HTTP request."),o=new P},l)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},v(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let i;try{i=yield this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:_({"X-Requested-With":"XMLHttpRequest"},e.headers),method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(l){throw o||(this._logger.log(s.Warning,`Error from HTTP request. ${l}.`),l)}finally{n&&clearTimeout(n),e.abortSignal&&(e.abortSignal.onabort=null)}if(!i.ok){let l=yield me(i,"text");throw new C(l||i.statusText,i.status)}let a=yield me(i,e.responseType);return new H(i.status,i.statusText,a)})}getCookieString(e){let t="";return p.isNode&&this._jar&&this._jar.getCookies(e,(o,n)=>t=n.join("; ")),t}};function me(r,e){let t;switch(e){case"arraybuffer":t=r.arrayBuffer();break;case"text":t=r.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=r.text();break}return t}var X=class extends k{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new S):e.method?e.url?new Promise((t,o)=>{let n=new XMLHttpRequest;n.open(e.method,e.url,!0),n.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,n.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(v(e.content)?n.setRequestHeader("Content-Type","application/octet-stream"):n.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let i=e.headers;i&&Object.keys(i).forEach(c=>{n.setRequestHeader(c,i[c])}),e.responseType&&(n.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{n.abort(),o(new S)}),e.timeout&&(n.timeout=e.timeout),n.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),n.status>=200&&n.status<300?t(new H(n.status,n.statusText,n.response||n.responseText)):o(new C(n.response||n.responseText||n.statusText,n.status))},n.onerror=()=>{this._logger.log(s.Warning,`Error from HTTP request. ${n.status}: ${n.statusText}.`),o(new C(n.statusText,n.status))},n.ontimeout=()=>{this._logger.log(s.Warning,"Timeout from HTTP request."),o(new P)},n.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var G=class extends k{constructor(e){if(super(),typeof fetch<"u"||p.isNode)this._httpClient=new K(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new X(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new S):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}};var y=class r{static write(e){return`${e}${r.RecordSeparator}`}static parse(e){if(e[e.length-1]!==r.RecordSeparator)throw new Error("Message is incomplete.");let t=e.split(r.RecordSeparator);return t.pop(),t}};y.RecordSeparatorCode=30;y.RecordSeparator=String.fromCharCode(y.RecordSeparatorCode);var Y=class{writeHandshakeRequest(e){return y.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,o;if(v(e)){let a=new Uint8Array(e),l=a.indexOf(y.RecordSeparatorCode);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,u))),o=a.byteLength>u?a.slice(u).buffer:null}else{let a=e,l=a.indexOf(y.RecordSeparator);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=a.substring(0,u),o=a.length>u?a.substring(u):null}let n=y.parse(t),i=JSON.parse(n[0]);if(i.type)throw new Error("Expected a handshake response from the server.");return[o,i]}};var h=function(r){return r[r.Invocation=1]="Invocation",r[r.StreamItem=2]="StreamItem",r[r.Completion=3]="Completion",r[r.StreamInvocation=4]="StreamInvocation",r[r.CancelInvocation=5]="CancelInvocation",r[r.Ping=6]="Ping",r[r.Close=7]="Close",r[r.Ack=8]="Ack",r[r.Sequence=9]="Sequence",r}(h||{});var Q=class{constructor(){this.observers=[]}next(e){for(let t of this.observers)t.next(e)}error(e){for(let t of this.observers)t.error&&t.error(e)}complete(){for(let e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new z(this,e)}};var Z=class{constructor(e,t,o){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=o}_send(e){return g(this,null,function*(){let t=this._protocol.writeMessage(e),o=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let n=()=>{},i=()=>{};v(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(o=new Promise((c,a)=>{n=c,i=a})),this._messages.push(new ce(t,this._totalMessageCount,n,i))}try{this._reconnectInProgress||(yield this._connection.send(t))}catch{this._disconnected()}yield o})}_ack(e){let t=-1;for(let o=0;o<this._messages.length;o++){let n=this._messages[o];if(n._id<=e.sequenceId)t=o,v(n._message)?this._bufferedByteCount-=n._message.byteLength:this._bufferedByteCount-=n._message.length,n._resolver();else if(this._bufferedByteCount<this._bufferSize)n._resolver();else break}t!==-1&&(this._messages=this._messages.slice(t+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==h.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;let t=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,t<=this._latestReceivedSequenceId?(t===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=t,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}_resend(){return g(this,null,function*(){let e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;yield this._connection.send(this._protocol.writeMessage({type:h.Sequence,sequenceId:e}));let t=this._messages;for(let o of t)yield this._connection.send(o._message);this._reconnectInProgress=!1})}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(let t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case h.Invocation:case h.StreamItem:case h.Completion:case h.StreamInvocation:case h.CancelInvocation:return!0;case h.Close:case h.Sequence:case h.Ping:case h.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(()=>g(this,null,function*(){try{this._reconnectInProgress||(yield this._connection.send(this._protocol.writeMessage({type:h.Ack,sequenceId:this._latestReceivedSequenceId})))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}},ce=class{constructor(e,t,o,n){this._message=e,this._id=t,this._resolver=o,this._rejector=n}};var Ee=30*1e3,Ie=15*1e3,Te=1e5,m=function(r){return r.Disconnected="Disconnected",r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Reconnecting="Reconnecting",r}(m||{}),ee=class r{static create(e,t,o,n,i,c,a){return new r(e,t,o,n,i,c,a)}constructor(e,t,o,n,i,c,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(s.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},d.isRequired(e,"connection"),d.isRequired(t,"logger"),d.isRequired(o,"protocol"),this.serverTimeoutInMilliseconds=i??Ee,this.keepAliveIntervalInMilliseconds=c??Ie,this._statefulReconnectBufferSize=a??Te,this._logger=t,this._protocol=o,this.connection=e,this._reconnectPolicy=n,this._handshakeProtocol=new Y,this.connection.onreceive=l=>this._processIncomingData(l),this.connection.onclose=l=>this._connectionClosed(l),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=m.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:h.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==m.Disconnected&&this._connectionState!==m.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}_startWithStateTransitions(){return g(this,null,function*(){if(this._connectionState!==m.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=m.Connecting,this._logger.log(s.Debug,"Starting HubConnection.");try{yield this._startInternal(),p.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=m.Connected,this._connectionStarted=!0,this._logger.log(s.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=m.Disconnected,this._logger.log(s.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}})}_startInternal(){return g(this,null,function*(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let e=new Promise((t,o)=>{this._handshakeResolver=t,this._handshakeRejecter=o});yield this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);let o={protocol:this._protocol.name,version:t};if(this._logger.log(s.Debug,"Sending handshake request."),yield this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(o)),this._logger.log(s.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),yield e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new Z(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||(yield this._sendMessage(this._cachedPingMessage))}catch(t){throw this._logger.log(s.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),yield this.connection.stop(t),t}})}stop(){return g(this,null,function*(){let e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),yield this._stopPromise;try{yield e}catch{}})}_stopInternal(e){if(this._connectionState===m.Disconnected)return this._logger.log(s.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===m.Disconnecting)return this._logger.log(s.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;let t=this._connectionState;return this._connectionState=m.Disconnecting,this._logger.log(s.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(s.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===m.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new S("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}_sendCloseMessage(){return g(this,null,function*(){try{yield this._sendWithProtocol(this._createCloseMessage())}catch{}})}stream(e,...t){let[o,n]=this._replaceStreamingParams(t),i=this._createStreamInvocation(e,t,n),c,a=new Q;return a.cancelCallback=()=>{let l=this._createCancelInvocation(i.invocationId);return delete this._callbacks[i.invocationId],c.then(()=>this._sendWithProtocol(l))},this._callbacks[i.invocationId]=(l,u)=>{if(u){a.error(u);return}else l&&(l.type===h.Completion?l.error?a.error(new Error(l.error)):a.complete():a.next(l.item))},c=this._sendWithProtocol(i).catch(l=>{a.error(l),delete this._callbacks[i.invocationId]}),this._launchStreams(o,c),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){let[o,n]=this._replaceStreamingParams(t),i=this._sendWithProtocol(this._createInvocation(e,t,!0,n));return this._launchStreams(o,i),i}invoke(e,...t){let[o,n]=this._replaceStreamingParams(t),i=this._createInvocation(e,t,!1,n);return new Promise((a,l)=>{this._callbacks[i.invocationId]=(f,T)=>{if(T){l(T);return}else f&&(f.type===h.Completion?f.error?l(new Error(f.error)):a(f.result):l(new Error(`Unexpected message type: ${f.type}`)))};let u=this._sendWithProtocol(i).catch(f=>{l(f),delete this._callbacks[i.invocationId]});this._launchStreams(o,u)})}on(e,t){!e||!t||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(t)===-1&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();let o=this._methods[e];if(o)if(t){let n=o.indexOf(t);n!==-1&&(o.splice(n,1),o.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){let t=this._protocol.parseMessages(e,this._logger);for(let o of t)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(o)))switch(o.type){case h.Invocation:this._invokeClientMethod(o).catch(n=>{this._logger.log(s.Error,`Invoke client method threw error: ${V(n)}`)});break;case h.StreamItem:case h.Completion:{let n=this._callbacks[o.invocationId];if(n){o.type===h.Completion&&delete this._callbacks[o.invocationId];try{n(o)}catch(i){this._logger.log(s.Error,`Stream callback threw error: ${V(i)}`)}}break}case h.Ping:break;case h.Close:{this._logger.log(s.Information,"Close message received from server.");let n=o.error?new Error("Server returned an error on close: "+o.error):void 0;o.allowReconnect===!0?this.connection.stop(n):this._stopPromise=this._stopInternal(n);break}case h.Ack:this._messageBuffer&&this._messageBuffer._ack(o);break;case h.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(o);break;default:this._logger.log(s.Warning,`Invalid message type: ${o.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,o;try{[o,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(n){let i="Error parsing handshake response: "+n;this._logger.log(s.Error,i);let c=new Error(i);throw this._handshakeRejecter(c),c}if(t.error){let n="Server returned handshake error: "+t.error;this._logger.log(s.Error,n);let i=new Error(n);throw this._handshakeRejecter(i),i}else this._logger.log(s.Debug,"Server handshake complete.");return this._handshakeResolver(),o}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let e=this._nextKeepAlive-new Date().getTime();e<0&&(e=0),this._pingServerHandle=setTimeout(()=>g(this,null,function*(){if(this._connectionState===m.Connected)try{yield this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}_invokeClientMethod(e){return g(this,null,function*(){let t=e.target.toLowerCase(),o=this._methods[t];if(!o){this._logger.log(s.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(s.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),yield this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}let n=o.slice(),i=!!e.invocationId,c,a,l;for(let u of n)try{let f=c;c=yield u.apply(this,e.arguments),i&&c&&f&&(this._logger.log(s.Error,`Multiple results provided for '${t}'. Sending error to server.`),l=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(f){a=f,this._logger.log(s.Error,`A callback for the method '${t}' threw error '${f}'.`)}l?yield this._sendWithProtocol(l):i?(a?l=this._createCompletionMessage(e.invocationId,`${a}`,null):c!==void 0?l=this._createCompletionMessage(e.invocationId,null,c):(this._logger.log(s.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),l=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),yield this._sendWithProtocol(l)):c&&this._logger.log(s.Error,`Result given for '${t}' method but server is not expecting a result.`)})}_connectionClosed(e){this._logger.log(s.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new S("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===m.Disconnecting?this._completeClose(e):this._connectionState===m.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===m.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=m.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),p.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(s.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}_reconnect(e){return g(this,null,function*(){let t=Date.now(),o=0,n=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),i=this._getNextRetryDelay(o++,0,n);if(i===null){this._logger.log(s.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=m.Reconnecting,e?this._logger.log(s.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(s.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(c=>c.apply(this,[e]))}catch(c){this._logger.log(s.Error,`An onreconnecting callback called with error '${e}' threw error '${c}'.`)}if(this._connectionState!==m.Reconnecting){this._logger.log(s.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;i!==null;){if(this._logger.log(s.Information,`Reconnect attempt number ${o} will start in ${i} ms.`),yield new Promise(c=>{this._reconnectDelayHandle=setTimeout(c,i)}),this._reconnectDelayHandle=void 0,this._connectionState!==m.Reconnecting){this._logger.log(s.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(yield this._startInternal(),this._connectionState=m.Connected,this._logger.log(s.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(c=>c.apply(this,[this.connection.connectionId]))}catch(c){this._logger.log(s.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${c}'.`)}return}catch(c){if(this._logger.log(s.Information,`Reconnect attempt failed because of error '${c}'.`),this._connectionState!==m.Reconnecting){this._logger.log(s.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===m.Disconnecting&&this._completeClose();return}n=c instanceof Error?c:new Error(c.toString()),i=this._getNextRetryDelay(o++,Date.now()-t,n)}}this._logger.log(s.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${o} failed attempts. Connection disconnecting.`),this._completeClose()})}_getNextRetryDelay(e,t,o){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:o})}catch(n){return this._logger.log(s.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${n}'.`),null}}_cancelCallbacksWithError(e){let t=this._callbacks;this._callbacks={},Object.keys(t).forEach(o=>{let n=t[o];try{n(null,e)}catch(i){this._logger.log(s.Error,`Stream 'error' callback called with '${e}' threw error: ${V(i)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,o,n){if(o)return n.length!==0?{arguments:t,streamIds:n,target:e,type:h.Invocation}:{arguments:t,target:e,type:h.Invocation};{let i=this._invocationId;return this._invocationId++,n.length!==0?{arguments:t,invocationId:i.toString(),streamIds:n,target:e,type:h.Invocation}:{arguments:t,invocationId:i.toString(),target:e,type:h.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(let o in e)e[o].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(o)))},error:n=>{let i;n instanceof Error?i=n.message:n&&n.toString?i=n.toString():i="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(o,i)))},next:n=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(o,n)))}})}}_replaceStreamingParams(e){let t=[],o=[];for(let n=0;n<e.length;n++){let i=e[n];if(this._isObservable(i)){let c=this._invocationId;this._invocationId++,t[c]=i,o.push(c.toString()),e.splice(n,1)}}return[t,o]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,o){let n=this._invocationId;return this._invocationId++,o.length!==0?{arguments:t,invocationId:n.toString(),streamIds:o,target:e,type:h.StreamInvocation}:{arguments:t,invocationId:n.toString(),target:e,type:h.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:h.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:h.StreamItem}}_createCompletionMessage(e,t,o){return t?{error:t,invocationId:e,type:h.Completion}:{invocationId:e,result:o,type:h.Completion}}_createCloseMessage(){return{type:h.Close}}};var Pe=[0,2e3,1e4,3e4,null],L=class{constructor(e){this._retryDelays=e!==void 0?[...e,null]:Pe}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}};var D=(()=>{class r{}return r.Authorization="Authorization",r.Cookie="Cookie",r})();var te=class extends k{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}send(e){return g(this,null,function*(){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=yield this._accessTokenFactory()),this._setAuthorizationHeader(e);let o=yield this._innerClient.send(e);return t&&o.statusCode===401&&this._accessTokenFactory?(this._accessToken=yield this._accessTokenFactory(),this._setAuthorizationHeader(e),yield this._innerClient.send(e)):o})}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[D.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[D.Authorization]&&delete e.headers[D.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}};var b=function(r){return r[r.None=0]="None",r[r.WebSockets=1]="WebSockets",r[r.ServerSentEvents=2]="ServerSentEvents",r[r.LongPolling=4]="LongPolling",r}(b||{}),w=function(r){return r[r.Text=1]="Text",r[r.Binary=2]="Binary",r}(w||{});var oe=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};var W=class{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,o){this._httpClient=e,this._logger=t,this._pollAbort=new oe,this._options=o,this._running=!1,this.onreceive=null,this.onclose=null}connect(e,t){return g(this,null,function*(){if(d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._url=e,this._logger.log(s.Trace,"(LongPolling transport) Connecting."),t===w.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[o,n]=I(),i=_({[o]:n},this._options.headers),c={abortSignal:this._pollAbort.signal,headers:i,timeout:1e5,withCredentials:this._options.withCredentials};t===w.Binary&&(c.responseType="arraybuffer");let a=`${e}&_=${Date.now()}`;this._logger.log(s.Trace,`(LongPolling transport) polling: ${a}.`);let l=yield this._httpClient.get(a,c);l.statusCode!==200?(this._logger.log(s.Error,`(LongPolling transport) Unexpected response code: ${l.statusCode}.`),this._closeError=new C(l.statusText||"",l.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,c)})}_poll(e,t){return g(this,null,function*(){try{for(;this._running;)try{let o=`${e}&_=${Date.now()}`;this._logger.log(s.Trace,`(LongPolling transport) polling: ${o}.`);let n=yield this._httpClient.get(o,t);n.statusCode===204?(this._logger.log(s.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):n.statusCode!==200?(this._logger.log(s.Error,`(LongPolling transport) Unexpected response code: ${n.statusCode}.`),this._closeError=new C(n.statusText||"",n.statusCode),this._running=!1):n.content?(this._logger.log(s.Trace,`(LongPolling transport) data received. ${x(n.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(n.content)):this._logger.log(s.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(o){this._running?o instanceof P?this._logger.log(s.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=o,this._running=!1):this._logger.log(s.Trace,`(LongPolling transport) Poll errored after shutdown: ${o.message}`)}}finally{this._logger.log(s.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}})}send(e){return g(this,null,function*(){return this._running?J(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return g(this,null,function*(){this._logger.log(s.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{yield this._receiving,this._logger.log(s.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let e={},[t,o]=I();e[t]=o;let n={headers:_(_({},e),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials},i;try{yield this._httpClient.delete(this._url,n)}catch(c){i=c}i?i instanceof C&&(i.statusCode===404?this._logger.log(s.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(s.Trace,`(LongPolling transport) Error sending a DELETE request: ${i}`)):this._logger.log(s.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(s.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}})}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(s.Trace,e),this.onclose(this._closeError)}}};var ne=class{constructor(e,t,o,n){this._httpClient=e,this._accessToken=t,this._logger=o,this._options=n,this.onreceive=null,this.onclose=null}connect(e,t){return g(this,null,function*(){return d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._logger.log(s.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((o,n)=>{let i=!1;if(t!==w.Text){n(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let c;if(p.isBrowser||p.isWebWorker)c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{let a=this._httpClient.getCookieString(e),l={};l.Cookie=a;let[u,f]=I();l[u]=f,c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:_(_({},l),this._options.headers)})}try{c.onmessage=a=>{if(this.onreceive)try{this._logger.log(s.Trace,`(SSE transport) data received. ${x(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(l){this._close(l);return}},c.onerror=a=>{i?this._close():n(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},c.onopen=()=>{this._logger.log(s.Information,`SSE connected to ${this._url}`),this._eventSource=c,i=!0,o()}}catch(a){n(a);return}})})}send(e){return g(this,null,function*(){return this._eventSource?J(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}};var re=class{constructor(e,t,o,n,i,c){this._logger=o,this._accessTokenFactory=t,this._logMessageContent=n,this._webSocketConstructor=i,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=c}connect(e,t){return g(this,null,function*(){d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._logger.log(s.Trace,"(WebSockets transport) Connecting.");let o;return this._accessTokenFactory&&(o=yield this._accessTokenFactory()),new Promise((n,i)=>{e=e.replace(/^http/,"ws");let c,a=this._httpClient.getCookieString(e),l=!1;if(p.isNode||p.isReactNative){let u={},[f,T]=I();u[f]=T,o&&(u[D.Authorization]=`Bearer ${o}`),a&&(u[D.Cookie]=a),c=new this._webSocketConstructor(e,void 0,{headers:_(_({},u),this._headers)})}else o&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(o)}`);c||(c=new this._webSocketConstructor(e)),t===w.Binary&&(c.binaryType="arraybuffer"),c.onopen=u=>{this._logger.log(s.Information,`WebSocket connected to ${e}.`),this._webSocket=c,l=!0,n()},c.onerror=u=>{let f=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?f=u.error:f="There was an error with the transport",this._logger.log(s.Information,`(WebSockets transport) ${f}.`)},c.onmessage=u=>{if(this._logger.log(s.Trace,`(WebSockets transport) data received. ${x(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(f){this._close(f);return}},c.onclose=u=>{if(l)this._close(u);else{let f=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?f=u.error:f="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",i(new Error(f))}}})})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(s.Trace,`(WebSockets transport) sending data. ${x(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(s.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}};var we=100,se=class{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,d.isRequired(e,"url"),this._logger=pe(t.logger),this.baseUrl=this._resolveUrl(e),t=t||{},t.logMessageContent=t.logMessageContent===void 0?!1:t.logMessageContent,typeof t.withCredentials=="boolean"||t.withCredentials===void 0)t.withCredentials=t.withCredentials===void 0?!0:t.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.timeout=t.timeout===void 0?100*1e3:t.timeout;let o=null,n=null;if(p.isNode&&typeof A<"u"){let i=typeof __webpack_require__=="function"?__non_webpack_require__:A;o=i("ws"),n=i("eventsource")}!p.isNode&&typeof WebSocket<"u"&&!t.WebSocket?t.WebSocket=WebSocket:p.isNode&&!t.WebSocket&&o&&(t.WebSocket=o),!p.isNode&&typeof EventSource<"u"&&!t.EventSource?t.EventSource=EventSource:p.isNode&&!t.EventSource&&typeof n<"u"&&(t.EventSource=n),this._httpClient=new te(t.httpClient||new G(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}start(e){return g(this,null,function*(){if(e=e||w.Binary,d.isIn(e,w,"transferFormat"),this._logger.log(s.Debug,`Starting connection with transfer format '${w[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),yield this._startInternalPromise,this._connectionState==="Disconnecting"){let t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(s.Error,t),yield this._stopPromise,Promise.reject(new S(t))}else if(this._connectionState!=="Connected"){let t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(s.Error,t),Promise.reject(new S(t))}this._connectionStarted=!0})}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new ae(this.transport)),this._sendQueue.send(e))}stop(e){return g(this,null,function*(){if(this._connectionState==="Disconnected")return this._logger.log(s.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(s.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),yield this._stopInternal(e),yield this._stopPromise})}_stopInternal(e){return g(this,null,function*(){this._stopError=e;try{yield this._startInternalPromise}catch{}if(this.transport){try{yield this.transport.stop()}catch(t){this._logger.log(s.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(s.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")})}_startInternal(e){return g(this,null,function*(){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===b.WebSockets)this.transport=this._constructTransport(b.WebSockets),yield this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let o=null,n=0;do{if(o=yield this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new S("The connection was stopped during negotiation.");if(o.error)throw new Error(o.error);if(o.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(o.url&&(t=o.url),o.accessToken){let i=o.accessToken;this._accessTokenFactory=()=>i,this._httpClient._accessToken=i,this._httpClient._accessTokenFactory=void 0}n++}while(o.url&&n<we);if(n===we&&o.url)throw new Error("Negotiate redirection limit exceeded.");yield this._createTransport(t,this._options.transport,o,e)}this.transport instanceof W&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(s.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(o){return this._logger.log(s.Error,"Failed to start the connection: "+o),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(o)}})}_getNegotiationResponse(e){return g(this,null,function*(){let t={},[o,n]=I();t[o]=n;let i=this._resolveNegotiateUrl(e);this._logger.log(s.Debug,`Sending negotiation request: ${i}.`);try{let c=yield this._httpClient.post(i,{content:"",headers:_(_({},t),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(c.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${c.statusCode}'`));let a=JSON.parse(c.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new M("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(c){let a="Failed to complete negotiation with the server: "+c;return c instanceof C&&c.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(s.Error,a),Promise.reject(new M(a))}})}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}_createTransport(e,t,o,n){return g(this,null,function*(){let i=this._createConnectUrl(e,o.connectionToken);if(this._isITransport(t)){this._logger.log(s.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,yield this._startTransport(i,n),this.connectionId=o.connectionId;return}let c=[],a=o.availableTransports||[],l=o;for(let u of a){let f=this._resolveTransportOrError(u,t,n,l?.useStatefulReconnect===!0);if(f instanceof Error)c.push(`${u.transport} failed:`),c.push(f);else if(this._isITransport(f)){if(this.transport=f,!l){try{l=yield this._getNegotiationResponse(e)}catch(T){return Promise.reject(T)}i=this._createConnectUrl(e,l.connectionToken)}try{yield this._startTransport(i,n),this.connectionId=l.connectionId;return}catch(T){if(this._logger.log(s.Error,`Failed to start the transport '${u.transport}': ${T}`),l=void 0,c.push(new F(`${u.transport} failed: ${T}`,b[u.transport])),this._connectionState!=="Connecting"){let le="Failed to select transport before stop() was called.";return this._logger.log(s.Debug,le),Promise.reject(new S(le))}}}}return c.length>0?Promise.reject(new q(`Unable to connect to the server with any of the available transports. ${c.join(" ")}`,c)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))})}_constructTransport(e){switch(e){case b.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new re(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case b.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new ne(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case b.LongPolling:return new W(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=o=>g(this,null,function*(){let n=!1;if(this.features.reconnect)try{this.features.disconnected(),yield this.transport.connect(e,t),yield this.features.resend()}catch{n=!0}else{this._stopConnection(o);return}n&&this._stopConnection(o)}):this.transport.onclose=o=>this._stopConnection(o),this.transport.connect(e,t)}_resolveTransportOrError(e,t,o,n){let i=b[e.transport];if(i==null)return this._logger.log(s.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(xe(t,i))if(e.transferFormats.map(a=>w[a]).indexOf(o)>=0){if(i===b.WebSockets&&!this._options.WebSocket||i===b.ServerSentEvents&&!this._options.EventSource)return this._logger.log(s.Debug,`Skipping transport '${b[i]}' because it is not supported in your environment.'`),new j(`'${b[i]}' is not supported in your environment.`,i);this._logger.log(s.Debug,`Selecting transport '${b[i]}'.`);try{return this.features.reconnect=i===b.WebSockets?n:void 0,this._constructTransport(i)}catch(a){return a}}else return this._logger.log(s.Debug,`Skipping transport '${b[i]}' because it does not support the requested transfer format '${w[o]}'.`),new Error(`'${b[i]}' does not support ${w[o]}.`);else return this._logger.log(s.Debug,`Skipping transport '${b[i]}' because it was disabled by the client.`),new O(`'${b[i]}' is disabled by the client.`,i)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(s.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(s.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(s.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(s.Error,`Connection disconnected with error '${e}'.`):this._logger.log(s.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(s.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(s.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!p.isBrowser)throw new Error(`Cannot resolve '${e}'.`);let t=window.document.createElement("a");return t.href=e,this._logger.log(s.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){let t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";let o=new URLSearchParams(t.searchParams);return o.has("negotiateVersion")||o.append("negotiateVersion",this._negotiateVersion.toString()),o.has("useStatefulReconnect")?o.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&o.append("useStatefulReconnect","true"),t.search=o.toString(),t.toString()}};function xe(r,e){return!r||(e&r)!==0}var ae=class r{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new N,this._transportResult=new N,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new N),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}_sendLoop(){return g(this,null,function*(){for(;;){if(yield this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new N;let e=this._transportResult;this._transportResult=void 0;let t=typeof this._buffer[0]=="string"?this._buffer.join(""):r._concatBuffers(this._buffer);this._buffer.length=0;try{yield this._transport.send(t),e.resolve()}catch(o){e.reject(o)}}})}static _concatBuffers(e){let t=e.map(i=>i.byteLength).reduce((i,c)=>i+c),o=new Uint8Array(t),n=0;for(let i of e)o.set(new Uint8Array(i),n),n+=i.byteLength;return o.buffer}},N=class{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}};var Re="json",ie=class{constructor(){this.name=Re,this.version=2,this.transferFormat=w.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=E.instance);let o=y.parse(e),n=[];for(let i of o){let c=JSON.parse(i);if(typeof c.type!="number")throw new Error("Invalid payload.");switch(c.type){case h.Invocation:this._isInvocationMessage(c);break;case h.StreamItem:this._isStreamItemMessage(c);break;case h.Completion:this._isCompletionMessage(c);break;case h.Ping:break;case h.Close:break;case h.Ack:this._isAckMessage(c);break;case h.Sequence:this._isSequenceMessage(c);break;default:t.log(s.Information,"Unknown message type '"+c.type+"' ignored.");continue}n.push(c)}return n}writeMessage(e){return y.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}};var De={trace:s.Trace,debug:s.Debug,info:s.Information,information:s.Information,warn:s.Warning,warning:s.Warning,error:s.Error,critical:s.Critical,none:s.None};function $e(r){let e=De[r.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${r}`)}var B=class{configureLogging(e){if(d.isRequired(e,"logging"),Ae(e))this.logger=e;else if(typeof e=="string"){let t=$e(e);this.logger=new R(t)}else this.logger=new R(e);return this}withUrl(e,t){return d.isRequired(e,"url"),d.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions=_(_({},this.httpConnectionOptions),t):this.httpConnectionOptions=$(_({},this.httpConnectionOptions),{transport:t}),this}withHubProtocol(e){return d.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new L(e):this.reconnectPolicy=e:this.reconnectPolicy=new L,this}withServerTimeout(e){return d.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return d.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e?.bufferSize,this}build(){let e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");let t=new se(this.url,e);return ee.create(t,this.logger||E.instance,this.protocol||new ie,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function Ae(r){return r.log!==void 0}var Ao=(()=>{class r{constructor(t,o,n){this.decodeTokenService=t,this.toastr=o,this.httpService=n,this.initNotifications(),this.parseToken=this.decodeTokenService.getParseToken(),this.buildConnection()}initNotifications(){let t=JSON.parse(localStorage.getItem("Notifications"));this._notifications=new he(t||[])}setNotification(t){let n=[...this._notifications.value,t];this.saveNotificationTotal(n),this._notifications.next(n)}saveNotificationTotal(t=[]){localStorage.setItem("Notifications",JSON.stringify(t))}getNotification(){return this._notifications.asObservable()}getNotificationDetail(t){return this.httpService.post("/api/notification/GetByID",{ID:t})}buildConnection(){this.hubConnection=new B().withUrl("/MarketplaceHub").withAutomaticReconnect().configureLogging(s.Information).build(),this.startConnection(),this.onConnectionClose(),this.subscribeNotification()}connectToRegister(){this.hubConnection.invoke("SubscribeGroup",this.parseToken.PID)}startConnection(){this.hubConnection.start().then(()=>{this.connectToRegister()}).catch(t=>console.log("Error while starting connection: "+t))}onConnectionClose(){this.hubConnection.onclose(()=>{this.buildConnection()})}subscribeNotification(){this.hubConnection.on("Notification",t=>{let o=JSON.parse(t);this.setNotification(o),o.ID==this.parseToken.PID&&(o.StatusCode!=200?this.toastr.error(o.Message,o.Title,{enableHtml:!0}):this.toastr.success(o.Message,o.Title,{enableHtml:!0}))})}clearNotification(){localStorage.removeItem("Notifications"),this._notifications.next([])}static{this.\u0275fac=function(o){return new(o||r)(U(de),U(ge),U(fe))}}static{this.\u0275prov=ue({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();export{Ao as a};
1
+ import{b as de}from"./chunk-C7QA2BEN.js";import{b as ge,e as fe}from"./chunk-4M63ID5T.js";import{g as he,ja as ue,oa as U}from"./chunk-JS55A2RS.js";import{a as _,b as $,c as A,i as g}from"./chunk-66YHNWRR.js";var C=class extends Error{constructor(e,t){let o=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=o}},P=class extends Error{constructor(e="A timeout occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},S=class extends Error{constructor(e="An abort occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},j=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=o}},O=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=o}},F=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=o}},M=class extends Error{constructor(e){let t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}},q=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=o}};var H=class{constructor(e,t,o){this.statusCode=e,this.statusText=t,this.content=o}},k=class{get(e,t){return this.send($(_({},t),{method:"GET",url:e}))}post(e,t){return this.send($(_({},t),{method:"POST",url:e}))}delete(e,t){return this.send($(_({},t),{method:"DELETE",url:e}))}getCookieString(e){return""}};var s=function(r){return r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Information=2]="Information",r[r.Warning=3]="Warning",r[r.Error=4]="Error",r[r.Critical=5]="Critical",r[r.None=6]="None",r}(s||{});var E=class{constructor(){}log(e,t){}};E.instance=new E;var be="8.0.17",d=class{static isRequired(e,t){if(e==null)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,o){if(!(e in t))throw new Error(`Unknown ${o} value: ${e}.`)}},p=class r{static get isBrowser(){return!r.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!r.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!r.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}};function x(r,e){let t="";return v(r)?(t=`Binary data of length ${r.byteLength}`,e&&(t+=`. Content: '${Se(r)}'`)):typeof r=="string"&&(t=`String data of length ${r.length}`,e&&(t+=`. Content: '${r}'`)),t}function Se(r){let e=new Uint8Array(r),t="";return e.forEach(o=>{let n=o<16?"0":"";t+=`0x${n}${o.toString(16)} `}),t.substr(0,t.length-1)}function v(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function J(r,e,t,o,n,i){return g(this,null,function*(){let c={},[a,l]=I();c[a]=l,r.log(s.Trace,`(${e} transport) sending data. ${x(n,i.logMessageContent)}.`);let u=v(n)?"arraybuffer":"text",f=yield t.post(o,{content:n,headers:_(_({},c),i.headers),responseType:u,timeout:i.timeout,withCredentials:i.withCredentials});r.log(s.Trace,`(${e} transport) request complete. Response status: ${f.statusCode}.`)})}function pe(r){return r===void 0?new R(s.Information):r===null?E.instance:r.log!==void 0?r:new R(r)}var z=class{constructor(e,t){this._subject=e,this._observer=t}dispose(){let e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}},R=class{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){let o=`[${new Date().toISOString()}] ${s[e]}: ${t}`;switch(e){case s.Critical:case s.Error:this.out.error(o);break;case s.Warning:this.out.warn(o);break;case s.Information:this.out.info(o);break;default:this.out.log(o);break}}}};function I(){let r="X-SignalR-User-Agent";return p.isNode&&(r="User-Agent"),[r,Ce(be,ye(),ke(),ve())]}function Ce(r,e,t,o){let n="Microsoft SignalR/",i=r.split(".");return n+=`${i[0]}.${i[1]}`,n+=` (${r}; `,e&&e!==""?n+=`${e}; `:n+="Unknown OS; ",n+=`${t}`,o?n+=`; ${o}`:n+="; Unknown Runtime Version",n+=")",n}function ye(){if(p.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function ve(){if(p.isNode)return process.versions.node}function ke(){return p.isNode?"NodeJS":"Browser"}function V(r){return r.stack?r.stack:r.message?r.message:`${r}`}function _e(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}var K=class extends k{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||p.isNode){let t=typeof __webpack_require__=="function"?__non_webpack_require__:A;this._jar=new(t("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=t("node-fetch"):this._fetchType=fetch,this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(_e());if(typeof AbortController>"u"){let t=typeof __webpack_require__=="function"?__non_webpack_require__:A;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}send(e){return g(this,null,function*(){if(e.abortSignal&&e.abortSignal.aborted)throw new S;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");let t=new this._abortControllerType,o;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),o=new S});let n=null;if(e.timeout){let l=e.timeout;n=setTimeout(()=>{t.abort(),this._logger.log(s.Warning,"Timeout from HTTP request."),o=new P},l)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},v(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let i;try{i=yield this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:_({"X-Requested-With":"XMLHttpRequest"},e.headers),method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(l){throw o||(this._logger.log(s.Warning,`Error from HTTP request. ${l}.`),l)}finally{n&&clearTimeout(n),e.abortSignal&&(e.abortSignal.onabort=null)}if(!i.ok){let l=yield me(i,"text");throw new C(l||i.statusText,i.status)}let a=yield me(i,e.responseType);return new H(i.status,i.statusText,a)})}getCookieString(e){let t="";return p.isNode&&this._jar&&this._jar.getCookies(e,(o,n)=>t=n.join("; ")),t}};function me(r,e){let t;switch(e){case"arraybuffer":t=r.arrayBuffer();break;case"text":t=r.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=r.text();break}return t}var X=class extends k{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new S):e.method?e.url?new Promise((t,o)=>{let n=new XMLHttpRequest;n.open(e.method,e.url,!0),n.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,n.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(v(e.content)?n.setRequestHeader("Content-Type","application/octet-stream"):n.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let i=e.headers;i&&Object.keys(i).forEach(c=>{n.setRequestHeader(c,i[c])}),e.responseType&&(n.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{n.abort(),o(new S)}),e.timeout&&(n.timeout=e.timeout),n.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),n.status>=200&&n.status<300?t(new H(n.status,n.statusText,n.response||n.responseText)):o(new C(n.response||n.responseText||n.statusText,n.status))},n.onerror=()=>{this._logger.log(s.Warning,`Error from HTTP request. ${n.status}: ${n.statusText}.`),o(new C(n.statusText,n.status))},n.ontimeout=()=>{this._logger.log(s.Warning,"Timeout from HTTP request."),o(new P)},n.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var G=class extends k{constructor(e){if(super(),typeof fetch<"u"||p.isNode)this._httpClient=new K(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new X(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new S):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}};var y=class r{static write(e){return`${e}${r.RecordSeparator}`}static parse(e){if(e[e.length-1]!==r.RecordSeparator)throw new Error("Message is incomplete.");let t=e.split(r.RecordSeparator);return t.pop(),t}};y.RecordSeparatorCode=30;y.RecordSeparator=String.fromCharCode(y.RecordSeparatorCode);var Y=class{writeHandshakeRequest(e){return y.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,o;if(v(e)){let a=new Uint8Array(e),l=a.indexOf(y.RecordSeparatorCode);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,u))),o=a.byteLength>u?a.slice(u).buffer:null}else{let a=e,l=a.indexOf(y.RecordSeparator);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=a.substring(0,u),o=a.length>u?a.substring(u):null}let n=y.parse(t),i=JSON.parse(n[0]);if(i.type)throw new Error("Expected a handshake response from the server.");return[o,i]}};var h=function(r){return r[r.Invocation=1]="Invocation",r[r.StreamItem=2]="StreamItem",r[r.Completion=3]="Completion",r[r.StreamInvocation=4]="StreamInvocation",r[r.CancelInvocation=5]="CancelInvocation",r[r.Ping=6]="Ping",r[r.Close=7]="Close",r[r.Ack=8]="Ack",r[r.Sequence=9]="Sequence",r}(h||{});var Q=class{constructor(){this.observers=[]}next(e){for(let t of this.observers)t.next(e)}error(e){for(let t of this.observers)t.error&&t.error(e)}complete(){for(let e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new z(this,e)}};var Z=class{constructor(e,t,o){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=o}_send(e){return g(this,null,function*(){let t=this._protocol.writeMessage(e),o=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let n=()=>{},i=()=>{};v(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(o=new Promise((c,a)=>{n=c,i=a})),this._messages.push(new ce(t,this._totalMessageCount,n,i))}try{this._reconnectInProgress||(yield this._connection.send(t))}catch{this._disconnected()}yield o})}_ack(e){let t=-1;for(let o=0;o<this._messages.length;o++){let n=this._messages[o];if(n._id<=e.sequenceId)t=o,v(n._message)?this._bufferedByteCount-=n._message.byteLength:this._bufferedByteCount-=n._message.length,n._resolver();else if(this._bufferedByteCount<this._bufferSize)n._resolver();else break}t!==-1&&(this._messages=this._messages.slice(t+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==h.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;let t=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,t<=this._latestReceivedSequenceId?(t===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=t,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}_resend(){return g(this,null,function*(){let e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;yield this._connection.send(this._protocol.writeMessage({type:h.Sequence,sequenceId:e}));let t=this._messages;for(let o of t)yield this._connection.send(o._message);this._reconnectInProgress=!1})}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(let t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case h.Invocation:case h.StreamItem:case h.Completion:case h.StreamInvocation:case h.CancelInvocation:return!0;case h.Close:case h.Sequence:case h.Ping:case h.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(()=>g(this,null,function*(){try{this._reconnectInProgress||(yield this._connection.send(this._protocol.writeMessage({type:h.Ack,sequenceId:this._latestReceivedSequenceId})))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}},ce=class{constructor(e,t,o,n){this._message=e,this._id=t,this._resolver=o,this._rejector=n}};var Ee=30*1e3,Ie=15*1e3,Te=1e5,m=function(r){return r.Disconnected="Disconnected",r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Reconnecting="Reconnecting",r}(m||{}),ee=class r{static create(e,t,o,n,i,c,a){return new r(e,t,o,n,i,c,a)}constructor(e,t,o,n,i,c,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(s.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},d.isRequired(e,"connection"),d.isRequired(t,"logger"),d.isRequired(o,"protocol"),this.serverTimeoutInMilliseconds=i??Ee,this.keepAliveIntervalInMilliseconds=c??Ie,this._statefulReconnectBufferSize=a??Te,this._logger=t,this._protocol=o,this.connection=e,this._reconnectPolicy=n,this._handshakeProtocol=new Y,this.connection.onreceive=l=>this._processIncomingData(l),this.connection.onclose=l=>this._connectionClosed(l),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=m.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:h.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==m.Disconnected&&this._connectionState!==m.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}_startWithStateTransitions(){return g(this,null,function*(){if(this._connectionState!==m.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=m.Connecting,this._logger.log(s.Debug,"Starting HubConnection.");try{yield this._startInternal(),p.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=m.Connected,this._connectionStarted=!0,this._logger.log(s.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=m.Disconnected,this._logger.log(s.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}})}_startInternal(){return g(this,null,function*(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let e=new Promise((t,o)=>{this._handshakeResolver=t,this._handshakeRejecter=o});yield this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);let o={protocol:this._protocol.name,version:t};if(this._logger.log(s.Debug,"Sending handshake request."),yield this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(o)),this._logger.log(s.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),yield e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new Z(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||(yield this._sendMessage(this._cachedPingMessage))}catch(t){throw this._logger.log(s.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),yield this.connection.stop(t),t}})}stop(){return g(this,null,function*(){let e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),yield this._stopPromise;try{yield e}catch{}})}_stopInternal(e){if(this._connectionState===m.Disconnected)return this._logger.log(s.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===m.Disconnecting)return this._logger.log(s.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;let t=this._connectionState;return this._connectionState=m.Disconnecting,this._logger.log(s.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(s.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===m.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new S("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}_sendCloseMessage(){return g(this,null,function*(){try{yield this._sendWithProtocol(this._createCloseMessage())}catch{}})}stream(e,...t){let[o,n]=this._replaceStreamingParams(t),i=this._createStreamInvocation(e,t,n),c,a=new Q;return a.cancelCallback=()=>{let l=this._createCancelInvocation(i.invocationId);return delete this._callbacks[i.invocationId],c.then(()=>this._sendWithProtocol(l))},this._callbacks[i.invocationId]=(l,u)=>{if(u){a.error(u);return}else l&&(l.type===h.Completion?l.error?a.error(new Error(l.error)):a.complete():a.next(l.item))},c=this._sendWithProtocol(i).catch(l=>{a.error(l),delete this._callbacks[i.invocationId]}),this._launchStreams(o,c),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){let[o,n]=this._replaceStreamingParams(t),i=this._sendWithProtocol(this._createInvocation(e,t,!0,n));return this._launchStreams(o,i),i}invoke(e,...t){let[o,n]=this._replaceStreamingParams(t),i=this._createInvocation(e,t,!1,n);return new Promise((a,l)=>{this._callbacks[i.invocationId]=(f,T)=>{if(T){l(T);return}else f&&(f.type===h.Completion?f.error?l(new Error(f.error)):a(f.result):l(new Error(`Unexpected message type: ${f.type}`)))};let u=this._sendWithProtocol(i).catch(f=>{l(f),delete this._callbacks[i.invocationId]});this._launchStreams(o,u)})}on(e,t){!e||!t||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(t)===-1&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();let o=this._methods[e];if(o)if(t){let n=o.indexOf(t);n!==-1&&(o.splice(n,1),o.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){let t=this._protocol.parseMessages(e,this._logger);for(let o of t)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(o)))switch(o.type){case h.Invocation:this._invokeClientMethod(o).catch(n=>{this._logger.log(s.Error,`Invoke client method threw error: ${V(n)}`)});break;case h.StreamItem:case h.Completion:{let n=this._callbacks[o.invocationId];if(n){o.type===h.Completion&&delete this._callbacks[o.invocationId];try{n(o)}catch(i){this._logger.log(s.Error,`Stream callback threw error: ${V(i)}`)}}break}case h.Ping:break;case h.Close:{this._logger.log(s.Information,"Close message received from server.");let n=o.error?new Error("Server returned an error on close: "+o.error):void 0;o.allowReconnect===!0?this.connection.stop(n):this._stopPromise=this._stopInternal(n);break}case h.Ack:this._messageBuffer&&this._messageBuffer._ack(o);break;case h.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(o);break;default:this._logger.log(s.Warning,`Invalid message type: ${o.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,o;try{[o,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(n){let i="Error parsing handshake response: "+n;this._logger.log(s.Error,i);let c=new Error(i);throw this._handshakeRejecter(c),c}if(t.error){let n="Server returned handshake error: "+t.error;this._logger.log(s.Error,n);let i=new Error(n);throw this._handshakeRejecter(i),i}else this._logger.log(s.Debug,"Server handshake complete.");return this._handshakeResolver(),o}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let e=this._nextKeepAlive-new Date().getTime();e<0&&(e=0),this._pingServerHandle=setTimeout(()=>g(this,null,function*(){if(this._connectionState===m.Connected)try{yield this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}_invokeClientMethod(e){return g(this,null,function*(){let t=e.target.toLowerCase(),o=this._methods[t];if(!o){this._logger.log(s.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(s.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),yield this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}let n=o.slice(),i=!!e.invocationId,c,a,l;for(let u of n)try{let f=c;c=yield u.apply(this,e.arguments),i&&c&&f&&(this._logger.log(s.Error,`Multiple results provided for '${t}'. Sending error to server.`),l=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(f){a=f,this._logger.log(s.Error,`A callback for the method '${t}' threw error '${f}'.`)}l?yield this._sendWithProtocol(l):i?(a?l=this._createCompletionMessage(e.invocationId,`${a}`,null):c!==void 0?l=this._createCompletionMessage(e.invocationId,null,c):(this._logger.log(s.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),l=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),yield this._sendWithProtocol(l)):c&&this._logger.log(s.Error,`Result given for '${t}' method but server is not expecting a result.`)})}_connectionClosed(e){this._logger.log(s.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new S("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===m.Disconnecting?this._completeClose(e):this._connectionState===m.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===m.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=m.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),p.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(s.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}_reconnect(e){return g(this,null,function*(){let t=Date.now(),o=0,n=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),i=this._getNextRetryDelay(o++,0,n);if(i===null){this._logger.log(s.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=m.Reconnecting,e?this._logger.log(s.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(s.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(c=>c.apply(this,[e]))}catch(c){this._logger.log(s.Error,`An onreconnecting callback called with error '${e}' threw error '${c}'.`)}if(this._connectionState!==m.Reconnecting){this._logger.log(s.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;i!==null;){if(this._logger.log(s.Information,`Reconnect attempt number ${o} will start in ${i} ms.`),yield new Promise(c=>{this._reconnectDelayHandle=setTimeout(c,i)}),this._reconnectDelayHandle=void 0,this._connectionState!==m.Reconnecting){this._logger.log(s.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(yield this._startInternal(),this._connectionState=m.Connected,this._logger.log(s.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(c=>c.apply(this,[this.connection.connectionId]))}catch(c){this._logger.log(s.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${c}'.`)}return}catch(c){if(this._logger.log(s.Information,`Reconnect attempt failed because of error '${c}'.`),this._connectionState!==m.Reconnecting){this._logger.log(s.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===m.Disconnecting&&this._completeClose();return}n=c instanceof Error?c:new Error(c.toString()),i=this._getNextRetryDelay(o++,Date.now()-t,n)}}this._logger.log(s.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${o} failed attempts. Connection disconnecting.`),this._completeClose()})}_getNextRetryDelay(e,t,o){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:o})}catch(n){return this._logger.log(s.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${n}'.`),null}}_cancelCallbacksWithError(e){let t=this._callbacks;this._callbacks={},Object.keys(t).forEach(o=>{let n=t[o];try{n(null,e)}catch(i){this._logger.log(s.Error,`Stream 'error' callback called with '${e}' threw error: ${V(i)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,o,n){if(o)return n.length!==0?{arguments:t,streamIds:n,target:e,type:h.Invocation}:{arguments:t,target:e,type:h.Invocation};{let i=this._invocationId;return this._invocationId++,n.length!==0?{arguments:t,invocationId:i.toString(),streamIds:n,target:e,type:h.Invocation}:{arguments:t,invocationId:i.toString(),target:e,type:h.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(let o in e)e[o].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(o)))},error:n=>{let i;n instanceof Error?i=n.message:n&&n.toString?i=n.toString():i="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(o,i)))},next:n=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(o,n)))}})}}_replaceStreamingParams(e){let t=[],o=[];for(let n=0;n<e.length;n++){let i=e[n];if(this._isObservable(i)){let c=this._invocationId;this._invocationId++,t[c]=i,o.push(c.toString()),e.splice(n,1)}}return[t,o]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,o){let n=this._invocationId;return this._invocationId++,o.length!==0?{arguments:t,invocationId:n.toString(),streamIds:o,target:e,type:h.StreamInvocation}:{arguments:t,invocationId:n.toString(),target:e,type:h.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:h.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:h.StreamItem}}_createCompletionMessage(e,t,o){return t?{error:t,invocationId:e,type:h.Completion}:{invocationId:e,result:o,type:h.Completion}}_createCloseMessage(){return{type:h.Close}}};var Pe=[0,2e3,1e4,3e4,null],L=class{constructor(e){this._retryDelays=e!==void 0?[...e,null]:Pe}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}};var D=(()=>{class r{}return r.Authorization="Authorization",r.Cookie="Cookie",r})();var te=class extends k{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}send(e){return g(this,null,function*(){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=yield this._accessTokenFactory()),this._setAuthorizationHeader(e);let o=yield this._innerClient.send(e);return t&&o.statusCode===401&&this._accessTokenFactory?(this._accessToken=yield this._accessTokenFactory(),this._setAuthorizationHeader(e),yield this._innerClient.send(e)):o})}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[D.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[D.Authorization]&&delete e.headers[D.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}};var b=function(r){return r[r.None=0]="None",r[r.WebSockets=1]="WebSockets",r[r.ServerSentEvents=2]="ServerSentEvents",r[r.LongPolling=4]="LongPolling",r}(b||{}),w=function(r){return r[r.Text=1]="Text",r[r.Binary=2]="Binary",r}(w||{});var oe=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};var W=class{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,o){this._httpClient=e,this._logger=t,this._pollAbort=new oe,this._options=o,this._running=!1,this.onreceive=null,this.onclose=null}connect(e,t){return g(this,null,function*(){if(d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._url=e,this._logger.log(s.Trace,"(LongPolling transport) Connecting."),t===w.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[o,n]=I(),i=_({[o]:n},this._options.headers),c={abortSignal:this._pollAbort.signal,headers:i,timeout:1e5,withCredentials:this._options.withCredentials};t===w.Binary&&(c.responseType="arraybuffer");let a=`${e}&_=${Date.now()}`;this._logger.log(s.Trace,`(LongPolling transport) polling: ${a}.`);let l=yield this._httpClient.get(a,c);l.statusCode!==200?(this._logger.log(s.Error,`(LongPolling transport) Unexpected response code: ${l.statusCode}.`),this._closeError=new C(l.statusText||"",l.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,c)})}_poll(e,t){return g(this,null,function*(){try{for(;this._running;)try{let o=`${e}&_=${Date.now()}`;this._logger.log(s.Trace,`(LongPolling transport) polling: ${o}.`);let n=yield this._httpClient.get(o,t);n.statusCode===204?(this._logger.log(s.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):n.statusCode!==200?(this._logger.log(s.Error,`(LongPolling transport) Unexpected response code: ${n.statusCode}.`),this._closeError=new C(n.statusText||"",n.statusCode),this._running=!1):n.content?(this._logger.log(s.Trace,`(LongPolling transport) data received. ${x(n.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(n.content)):this._logger.log(s.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(o){this._running?o instanceof P?this._logger.log(s.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=o,this._running=!1):this._logger.log(s.Trace,`(LongPolling transport) Poll errored after shutdown: ${o.message}`)}}finally{this._logger.log(s.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}})}send(e){return g(this,null,function*(){return this._running?J(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return g(this,null,function*(){this._logger.log(s.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{yield this._receiving,this._logger.log(s.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let e={},[t,o]=I();e[t]=o;let n={headers:_(_({},e),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials},i;try{yield this._httpClient.delete(this._url,n)}catch(c){i=c}i?i instanceof C&&(i.statusCode===404?this._logger.log(s.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(s.Trace,`(LongPolling transport) Error sending a DELETE request: ${i}`)):this._logger.log(s.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(s.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}})}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(s.Trace,e),this.onclose(this._closeError)}}};var ne=class{constructor(e,t,o,n){this._httpClient=e,this._accessToken=t,this._logger=o,this._options=n,this.onreceive=null,this.onclose=null}connect(e,t){return g(this,null,function*(){return d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._logger.log(s.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((o,n)=>{let i=!1;if(t!==w.Text){n(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let c;if(p.isBrowser||p.isWebWorker)c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{let a=this._httpClient.getCookieString(e),l={};l.Cookie=a;let[u,f]=I();l[u]=f,c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:_(_({},l),this._options.headers)})}try{c.onmessage=a=>{if(this.onreceive)try{this._logger.log(s.Trace,`(SSE transport) data received. ${x(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(l){this._close(l);return}},c.onerror=a=>{i?this._close():n(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},c.onopen=()=>{this._logger.log(s.Information,`SSE connected to ${this._url}`),this._eventSource=c,i=!0,o()}}catch(a){n(a);return}})})}send(e){return g(this,null,function*(){return this._eventSource?J(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}};var re=class{constructor(e,t,o,n,i,c){this._logger=o,this._accessTokenFactory=t,this._logMessageContent=n,this._webSocketConstructor=i,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=c}connect(e,t){return g(this,null,function*(){d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._logger.log(s.Trace,"(WebSockets transport) Connecting.");let o;return this._accessTokenFactory&&(o=yield this._accessTokenFactory()),new Promise((n,i)=>{e=e.replace(/^http/,"ws");let c,a=this._httpClient.getCookieString(e),l=!1;if(p.isNode||p.isReactNative){let u={},[f,T]=I();u[f]=T,o&&(u[D.Authorization]=`Bearer ${o}`),a&&(u[D.Cookie]=a),c=new this._webSocketConstructor(e,void 0,{headers:_(_({},u),this._headers)})}else o&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(o)}`);c||(c=new this._webSocketConstructor(e)),t===w.Binary&&(c.binaryType="arraybuffer"),c.onopen=u=>{this._logger.log(s.Information,`WebSocket connected to ${e}.`),this._webSocket=c,l=!0,n()},c.onerror=u=>{let f=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?f=u.error:f="There was an error with the transport",this._logger.log(s.Information,`(WebSockets transport) ${f}.`)},c.onmessage=u=>{if(this._logger.log(s.Trace,`(WebSockets transport) data received. ${x(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(f){this._close(f);return}},c.onclose=u=>{if(l)this._close(u);else{let f=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?f=u.error:f="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",i(new Error(f))}}})})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(s.Trace,`(WebSockets transport) sending data. ${x(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(s.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}};var we=100,se=class{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,d.isRequired(e,"url"),this._logger=pe(t.logger),this.baseUrl=this._resolveUrl(e),t=t||{},t.logMessageContent=t.logMessageContent===void 0?!1:t.logMessageContent,typeof t.withCredentials=="boolean"||t.withCredentials===void 0)t.withCredentials=t.withCredentials===void 0?!0:t.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.timeout=t.timeout===void 0?100*1e3:t.timeout;let o=null,n=null;if(p.isNode&&typeof A<"u"){let i=typeof __webpack_require__=="function"?__non_webpack_require__:A;o=i("ws"),n=i("eventsource")}!p.isNode&&typeof WebSocket<"u"&&!t.WebSocket?t.WebSocket=WebSocket:p.isNode&&!t.WebSocket&&o&&(t.WebSocket=o),!p.isNode&&typeof EventSource<"u"&&!t.EventSource?t.EventSource=EventSource:p.isNode&&!t.EventSource&&typeof n<"u"&&(t.EventSource=n),this._httpClient=new te(t.httpClient||new G(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}start(e){return g(this,null,function*(){if(e=e||w.Binary,d.isIn(e,w,"transferFormat"),this._logger.log(s.Debug,`Starting connection with transfer format '${w[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),yield this._startInternalPromise,this._connectionState==="Disconnecting"){let t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(s.Error,t),yield this._stopPromise,Promise.reject(new S(t))}else if(this._connectionState!=="Connected"){let t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(s.Error,t),Promise.reject(new S(t))}this._connectionStarted=!0})}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new ae(this.transport)),this._sendQueue.send(e))}stop(e){return g(this,null,function*(){if(this._connectionState==="Disconnected")return this._logger.log(s.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(s.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),yield this._stopInternal(e),yield this._stopPromise})}_stopInternal(e){return g(this,null,function*(){this._stopError=e;try{yield this._startInternalPromise}catch{}if(this.transport){try{yield this.transport.stop()}catch(t){this._logger.log(s.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(s.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")})}_startInternal(e){return g(this,null,function*(){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===b.WebSockets)this.transport=this._constructTransport(b.WebSockets),yield this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let o=null,n=0;do{if(o=yield this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new S("The connection was stopped during negotiation.");if(o.error)throw new Error(o.error);if(o.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(o.url&&(t=o.url),o.accessToken){let i=o.accessToken;this._accessTokenFactory=()=>i,this._httpClient._accessToken=i,this._httpClient._accessTokenFactory=void 0}n++}while(o.url&&n<we);if(n===we&&o.url)throw new Error("Negotiate redirection limit exceeded.");yield this._createTransport(t,this._options.transport,o,e)}this.transport instanceof W&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(s.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(o){return this._logger.log(s.Error,"Failed to start the connection: "+o),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(o)}})}_getNegotiationResponse(e){return g(this,null,function*(){let t={},[o,n]=I();t[o]=n;let i=this._resolveNegotiateUrl(e);this._logger.log(s.Debug,`Sending negotiation request: ${i}.`);try{let c=yield this._httpClient.post(i,{content:"",headers:_(_({},t),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(c.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${c.statusCode}'`));let a=JSON.parse(c.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new M("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(c){let a="Failed to complete negotiation with the server: "+c;return c instanceof C&&c.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(s.Error,a),Promise.reject(new M(a))}})}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}_createTransport(e,t,o,n){return g(this,null,function*(){let i=this._createConnectUrl(e,o.connectionToken);if(this._isITransport(t)){this._logger.log(s.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,yield this._startTransport(i,n),this.connectionId=o.connectionId;return}let c=[],a=o.availableTransports||[],l=o;for(let u of a){let f=this._resolveTransportOrError(u,t,n,l?.useStatefulReconnect===!0);if(f instanceof Error)c.push(`${u.transport} failed:`),c.push(f);else if(this._isITransport(f)){if(this.transport=f,!l){try{l=yield this._getNegotiationResponse(e)}catch(T){return Promise.reject(T)}i=this._createConnectUrl(e,l.connectionToken)}try{yield this._startTransport(i,n),this.connectionId=l.connectionId;return}catch(T){if(this._logger.log(s.Error,`Failed to start the transport '${u.transport}': ${T}`),l=void 0,c.push(new F(`${u.transport} failed: ${T}`,b[u.transport])),this._connectionState!=="Connecting"){let le="Failed to select transport before stop() was called.";return this._logger.log(s.Debug,le),Promise.reject(new S(le))}}}}return c.length>0?Promise.reject(new q(`Unable to connect to the server with any of the available transports. ${c.join(" ")}`,c)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))})}_constructTransport(e){switch(e){case b.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new re(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case b.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new ne(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case b.LongPolling:return new W(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=o=>g(this,null,function*(){let n=!1;if(this.features.reconnect)try{this.features.disconnected(),yield this.transport.connect(e,t),yield this.features.resend()}catch{n=!0}else{this._stopConnection(o);return}n&&this._stopConnection(o)}):this.transport.onclose=o=>this._stopConnection(o),this.transport.connect(e,t)}_resolveTransportOrError(e,t,o,n){let i=b[e.transport];if(i==null)return this._logger.log(s.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(xe(t,i))if(e.transferFormats.map(a=>w[a]).indexOf(o)>=0){if(i===b.WebSockets&&!this._options.WebSocket||i===b.ServerSentEvents&&!this._options.EventSource)return this._logger.log(s.Debug,`Skipping transport '${b[i]}' because it is not supported in your environment.'`),new j(`'${b[i]}' is not supported in your environment.`,i);this._logger.log(s.Debug,`Selecting transport '${b[i]}'.`);try{return this.features.reconnect=i===b.WebSockets?n:void 0,this._constructTransport(i)}catch(a){return a}}else return this._logger.log(s.Debug,`Skipping transport '${b[i]}' because it does not support the requested transfer format '${w[o]}'.`),new Error(`'${b[i]}' does not support ${w[o]}.`);else return this._logger.log(s.Debug,`Skipping transport '${b[i]}' because it was disabled by the client.`),new O(`'${b[i]}' is disabled by the client.`,i)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(s.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(s.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(s.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(s.Error,`Connection disconnected with error '${e}'.`):this._logger.log(s.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(s.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(s.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!p.isBrowser)throw new Error(`Cannot resolve '${e}'.`);let t=window.document.createElement("a");return t.href=e,this._logger.log(s.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){let t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";let o=new URLSearchParams(t.searchParams);return o.has("negotiateVersion")||o.append("negotiateVersion",this._negotiateVersion.toString()),o.has("useStatefulReconnect")?o.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&o.append("useStatefulReconnect","true"),t.search=o.toString(),t.toString()}};function xe(r,e){return!r||(e&r)!==0}var ae=class r{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new N,this._transportResult=new N,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new N),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}_sendLoop(){return g(this,null,function*(){for(;;){if(yield this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new N;let e=this._transportResult;this._transportResult=void 0;let t=typeof this._buffer[0]=="string"?this._buffer.join(""):r._concatBuffers(this._buffer);this._buffer.length=0;try{yield this._transport.send(t),e.resolve()}catch(o){e.reject(o)}}})}static _concatBuffers(e){let t=e.map(i=>i.byteLength).reduce((i,c)=>i+c),o=new Uint8Array(t),n=0;for(let i of e)o.set(new Uint8Array(i),n),n+=i.byteLength;return o.buffer}},N=class{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}};var Re="json",ie=class{constructor(){this.name=Re,this.version=2,this.transferFormat=w.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=E.instance);let o=y.parse(e),n=[];for(let i of o){let c=JSON.parse(i);if(typeof c.type!="number")throw new Error("Invalid payload.");switch(c.type){case h.Invocation:this._isInvocationMessage(c);break;case h.StreamItem:this._isStreamItemMessage(c);break;case h.Completion:this._isCompletionMessage(c);break;case h.Ping:break;case h.Close:break;case h.Ack:this._isAckMessage(c);break;case h.Sequence:this._isSequenceMessage(c);break;default:t.log(s.Information,"Unknown message type '"+c.type+"' ignored.");continue}n.push(c)}return n}writeMessage(e){return y.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}};var De={trace:s.Trace,debug:s.Debug,info:s.Information,information:s.Information,warn:s.Warning,warning:s.Warning,error:s.Error,critical:s.Critical,none:s.None};function $e(r){let e=De[r.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${r}`)}var B=class{configureLogging(e){if(d.isRequired(e,"logging"),Ae(e))this.logger=e;else if(typeof e=="string"){let t=$e(e);this.logger=new R(t)}else this.logger=new R(e);return this}withUrl(e,t){return d.isRequired(e,"url"),d.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions=_(_({},this.httpConnectionOptions),t):this.httpConnectionOptions=$(_({},this.httpConnectionOptions),{transport:t}),this}withHubProtocol(e){return d.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new L(e):this.reconnectPolicy=e:this.reconnectPolicy=new L,this}withServerTimeout(e){return d.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return d.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e?.bufferSize,this}build(){let e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");let t=new se(this.url,e);return ee.create(t,this.logger||E.instance,this.protocol||new ie,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function Ae(r){return r.log!==void 0}var Ao=(()=>{class r{constructor(t,o,n){this.decodeTokenService=t,this.toastr=o,this.httpService=n,this.initNotifications(),this.parseToken=this.decodeTokenService.getParseToken(),this.buildConnection()}initNotifications(){let t=JSON.parse(localStorage.getItem("Notifications"));this._notifications=new he(t||[])}setNotification(t){let n=[...this._notifications.value,t];this.saveNotificationTotal(n),this._notifications.next(n)}saveNotificationTotal(t=[]){localStorage.setItem("Notifications",JSON.stringify(t))}getNotification(){return this._notifications.asObservable()}getNotificationDetail(t){return this.httpService.post("/api/notification/GetByID",{ID:t})}buildConnection(){this.hubConnection=new B().withUrl("/MarketplaceHub").withAutomaticReconnect().configureLogging(s.Information).build(),this.startConnection(),this.onConnectionClose(),this.subscribeNotification()}connectToRegister(){this.hubConnection.invoke("SubscribeGroup",this.parseToken.PID)}startConnection(){this.hubConnection.start().then(()=>{this.connectToRegister()}).catch(t=>console.log("Error while starting connection: "+t))}onConnectionClose(){this.hubConnection.onclose(()=>{this.buildConnection()})}subscribeNotification(){this.hubConnection.on("Notification",t=>{let o=JSON.parse(t);this.setNotification(o),o.ID==this.parseToken.PID&&(o.StatusCode!=200?this.toastr.error(o.Message,o.Title,{enableHtml:!0}):this.toastr.success(o.Message,o.Title,{enableHtml:!0}))})}clearNotification(){localStorage.removeItem("Notifications"),this._notifications.next([])}static{this.\u0275fac=function(o){return new(o||r)(U(de),U(ge),U(fe))}}static{this.\u0275prov=ue({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();export{Ao as a};
@@ -0,0 +1 @@
1
+ import{a as Ie,b as Ve,c as Re}from"./chunk-2BUABOHG.js";import{a as Le}from"./chunk-P5FCWMYK.js";import{a as Fe}from"./chunk-K6YEZYU4.js";import{a as Ee}from"./chunk-MCJRJUAO.js";import{a as Pe}from"./chunk-E2CS7ZMC.js";import"./chunk-R76V3PTN.js";import{a as Me}from"./chunk-5EQNOCXP.js";import"./chunk-6LH7FSOW.js";import"./chunk-XEMNZHW6.js";import"./chunk-WHZ44BAL.js";import"./chunk-LHD7CYML.js";import"./chunk-DJILLV4M.js";import"./chunk-OKAPL3YZ.js";import"./chunk-SDUUFQUI.js";import"./chunk-3RK6DDJD.js";import"./chunk-MQXPOHBV.js";import"./chunk-M5IQRAHV.js";import{c as $,d as ee,e as te}from"./chunk-SYENQYR7.js";import"./chunk-2ZTDLZVZ.js";import"./chunk-2TZBEYNY.js";import"./chunk-SXLKJLAE.js";import"./chunk-C7QA2BEN.js";import"./chunk-Z3ITXK3D.js";import"./chunk-ACIMXBIC.js";import"./chunk-TGMCGROM.js";import{a as M}from"./chunk-CMZW5QAE.js";import{b as ve,e as U}from"./chunk-4M63ID5T.js";import"./chunk-K5XRGNWG.js";import"./chunk-HPYTL6TX.js";import{b as y,c as H}from"./chunk-PW42BQIY.js";import{b as ie,c as ne,d as De,e as oe,f as re,g as be,h as ae,m as we,n as Oe}from"./chunk-6X2OBNJQ.js";import{c as ye,h as B,m as z,o as ke,z as V}from"./chunk-CSSG7NAJ.js";import"./chunk-MZI5AYCE.js";import"./chunk-UJYSVGLV.js";import{r as Te,s as xe}from"./chunk-HFKKITEW.js";import"./chunk-OZ77CAJD.js";import{j as Se,k as j,m as Ce,n as O}from"./chunk-MTUIRWOB.js";import{$c as x,G as pe,Gb as D,Gc as a,Hc as C,Ic as Q,Kc as k,Lc as v,Mb as E,Mc as T,Na as q,Nc as ue,Oa as J,Oc as he,Pc as ge,Qc as fe,Ra as f,Rc as _e,Sc as Y,Yb as u,Z as me,aa as le,ac as K,ad as X,bd as I,dc as P,ec as L,gc as N,hc as A,ic as o,ja as F,jc as r,kc as b,oc as w,pa as c,pb as de,rb as p,rd as Z,tc as m,uc as h,v as W,ya as _,za as S}from"./chunk-JS55A2RS.js";import"./chunk-EU2KAMEK.js";import{a as G,b as ce}from"./chunk-66YHNWRR.js";var Ne=i=>({"text-muted":i});function qe(i,g){if(i&1){let e=w();o(0,"div",10),m("click",function(){_(e);let n=h();return S(n.onSelectDelivery("DROP_OFF"))}),o(1,"div",11),b(2,"i",12),o(3,"h3",13),a(4,"Drop off"),r()(),o(5,"p",14),a(6," You can drop off your package at the nearest shipping counter in your city. "),r()()}if(i&2){let e=h();K(Y(2,Ne,e.selectedDelivery()==="PICK_UP"))}}function Je(i,g){if(i&1){let e=w();o(0,"div",10),m("click",function(){_(e);let n=h();return S(n.onSelectDelivery("PICK_UP"))}),o(1,"div",11),b(2,"i",15),o(3,"h3",13),a(4,"Pick up"),r()(),o(5,"p",14),a(6," The courier will collect the package from your address. "),r()()}if(i&2){let e=h();K(Y(2,Ne,e.selectedDelivery()==="DROP_OFF"))}}var Ae=(()=>{class i{constructor(){this.data=c(ne),this.dialogRef=c(ie),this.selectedDelivery=f("DROP_OFF"),this.showPickup=f(!0),this.showDropOff=f(!0),this.initOptionsCondition()}onSelectDelivery(e){this.selectedDelivery.set(e)}initOptionsCondition(){switch(this.data.channelType){case y.Shopee:break;case y.Tiktok:this.showPickup.set(this.data.options?.Form?.information?.can_pickup),this.showDropOff.set(this.data.options?.Form?.information?.can_drop_off);break}}onConfirm(){this.dialogRef.close(this.selectedDelivery())}onClose(){this.dialogRef.close()}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=D({type:i,selectors:[["app-delivery-dialog"]],decls:16,vars:2,consts:[["mat-dialog-title","",1,"mt-12","mb-8"],[1,"d-flex","justify-content-between","align-items-start","lh-lg"],[1,"ms-2"],[1,"text-secondary-emphasis"],[1,"fa-solid","fa-xmark","text-muted","cursor-pointer","fs-3",3,"click"],[1,"pb-0"],[1,"d-flex","align-items-center","justify-content-center","gap-12"],["role","button",1,"delivery-option","d-flex","flex-column","align-items-center","justify-content-center","p-4","cursor-pointer",3,"class"],[1,"d-flex","justify-content-center",2,"margin-top","1.5rem"],[1,"btn","btn-success",2,"width","70px",3,"click"],["role","button",1,"delivery-option","d-flex","flex-column","align-items-center","justify-content-center","p-4","cursor-pointer",3,"click"],[1,"text-center"],[1,"fa-solid","fa-cart-shopping-fast","fa-4x"],[1,"mt-4"],[1,"text-center","mt-4","lh-sm"],[1,"fa-solid","fa-hand-holding-box","fa-4x"]],template:function(t,n){t&1&&(o(0,"div",0)(1,"div",1)(2,"div",2)(3,"h2"),a(4,"Delivery Order"),r(),o(5,"div",3),a(6,"Your selected order(s) will be set to"),r()(),o(7,"div")(8,"i",4),m("click",function(){return n.onClose()}),r()()()(),o(9,"mat-dialog-content",5)(10,"div",6),E(11,qe,7,4,"div",7)(12,Je,7,4,"div",7),r(),o(13,"div",8)(14,"button",9),m("click",function(){return n.onConfirm()}),a(15," OK "),r()()()),t&2&&(p(11),P(n.showPickup()?11:-1),p(),P(n.showDropOff()?12:-1))},dependencies:[O,ae,oe,re],styles:[".delivery-option[_ngcontent-%COMP%]{width:14rem;height:12rem;border:1px solid #656565}.delivery-option[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin-bottom:0}.delivery-option.text-muted[_ngcontent-%COMP%]{opacity:.7;border-color:#bebebe}"]})}}return i})();function Xe(i,g){if(i&1&&(o(0,"ng-option",3),a(1),r()),i&2){let e=g.$implicit;u("value",e==null?null:e.address_id)("matTooltip",e==null?null:e.address),p(),C(e==null?null:e.address)}}function Ze(i,g){if(i&1&&(o(0,"ng-option",6)(1,"span",7),a(2),x(3,"date"),r(),o(4,"span"),a(5),r()()),i&2){let e=g.$implicit;u("value",e==null?null:e.pickup_time_id),p(2),C(I(3,3,e==null?null:e.date,"d MMMM")),p(3),C(e==null?null:e.time_text)}}var Be=(()=>{class i{constructor(){this.shippingOptions=J(),this.onFormChanges=q(),this.addressList=Z(()=>this.shippingOptions()?.response?.pickup?.address_list||[]),this.selectedShipping=f(null),this.timeOptions=f(this.convertTimestampToDate(this.addressList()[0]?.time_slot_list||[])),this.pickupTime=f(null)}onAddressChange(e){let t=this.addressList().find(n=>n.address_id===e);this.timeOptions.set(this.convertTimestampToDate(t?.time_slot_list||[])),this.pickupTime.set(null)}onValueChanges(){this.onFormChanges.emit({address_id:this.selectedShipping(),pickup_time_id:this.pickupTime()})}convertTimestampToDate(e){return e.map(t=>{let n=new Date(t.date*1e3);return ce(G({},t),{date:n})})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=D({type:i,selectors:[["shopee-pickup"]],inputs:{shippingOptions:[1,"shippingOptions"]},outputs:{onFormChanges:"onFormChanges"},decls:12,vars:4,consts:[[1,"mb-6"],["for","address",1,"mb-2","text-muted"],["id","address","placeholder","Select Address to Pickup","appendTo","body",1,"shipping-timepicker",3,"ngModelChange","clearable","ngModel"],[3,"value","matTooltip"],["for","timepicker",1,"mb-2","text-muted"],["id","timepicker","placeholder","Select Date Pickup","appendTo","body",1,"shipping-timepicker",3,"ngModelChange","clearable","ngModel"],[3,"value"],[1,"me-2"]],template:function(t,n){t&1&&(o(0,"div",0)(1,"label",1),a(2,"Address"),r(),o(3,"ng-select",2),T("ngModelChange",function(s){return v(n.selectedShipping,s)||(n.selectedShipping=s),s}),m("ngModelChange",function(s){return n.onAddressChange(s),n.onValueChanges()}),N(4,Xe,2,3,"ng-option",3,L),r()(),o(6,"div",0)(7,"label",4),a(8,"Date"),r(),o(9,"ng-select",5),T("ngModelChange",function(s){return v(n.pickupTime,s)||(n.pickupTime=s),s}),m("ngModelChange",function(){return n.onValueChanges()}),N(10,Ze,6,6,"ng-option",6,L),r()()),t&2&&(p(3),u("clearable",!1),k("ngModel",n.selectedShipping),p(),A(n.addressList()),p(5),u("clearable",!1),k("ngModel",n.pickupTime),p(),A(n.timeOptions()))},dependencies:[O,j,te,ee,$,V,B,z,xe,Te],encapsulation:2})}}return i})();function $e(i,g){if(i&1&&(o(0,"ng-option",3)(1,"span",4),a(2),x(3,"date"),r(),o(4,"span"),a(5),x(6,"date"),r(),o(7,"span",5),a(8,"-"),r(),o(9,"span"),a(10),x(11,"date"),r()()),i&2){let e=g.$implicit,t=g.$index;u("value",t),p(2),C(I(3,4,e==null?null:e.start_date,"d MMMM")),p(3),C(I(6,7,e==null?null:e.start_date,"HH:mm")),p(5),C(I(11,10,e==null?null:e.end_date,"HH:mm"))}}var ze=(()=>{class i{constructor(){this.shippingOptions=J(),this.onFormChanges=q(),this.timeOptions=Z(()=>this.shippingOptions()?.Options?.pickup_slots),this.selectedTimeIndex=f(null)}onValueChanges(){let e=this.timeOptions()[this.selectedTimeIndex()];this.onFormChanges.emit({start_time:e?.start_time,end_time:e?.end_time})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=D({type:i,selectors:[["tiktok-pickup"]],inputs:{shippingOptions:[1,"shippingOptions"]},outputs:{onFormChanges:"onFormChanges"},decls:6,vars:2,consts:[[1,"mb-6"],["for","timepicker",1,"mb-2","text-muted"],["id","timepicker","placeholder","Select Time Pickup","appendTo","body",1,"shipping-timepicker",3,"ngModelChange","clearable","ngModel"],[3,"value"],[1,"me-2"],[1,"mx-1"]],template:function(t,n){t&1&&(o(0,"div",0)(1,"label",1),a(2,"Time"),r(),o(3,"ng-select",2),T("ngModelChange",function(s){return v(n.selectedTimeIndex,s)||(n.selectedTimeIndex=s),s}),m("ngModelChange",function(){return n.onValueChanges()}),N(4,$e,12,13,"ng-option",3,L),r()()),t&2&&(p(3),u("clearable",!1),k("ngModel",n.selectedTimeIndex),p(),A(n.timeOptions()))},dependencies:[O,j,te,ee,$,V,B,z],encapsulation:2})}}return i})();function et(i,g){if(i&1){let e=w();o(0,"shopee-pickup",10),m("onFormChanges",function(n){_(e);let l=h();return S(l.onFormChanges(n))}),r()}if(i&2){let e=h();u("shippingOptions",e.dialogData.shippingOptions)}}function tt(i,g){if(i&1){let e=w();o(0,"tiktok-pickup",10),m("onFormChanges",function(n){_(e);let l=h();return S(l.onFormChanges(n))}),r()}if(i&2){let e=h();u("shippingOptions",e.dialogData.shippingOptions)}}var He=(()=>{class i{constructor(){this.dialogRef=c(ie),this.dialogData=c(ne),this.shippingOptions=f(this.dialogData.shippingOptions),this.channelType=f(this.dialogData.channelType),this.order=f(this.dialogData.order),this.channelTypeEnum=y,this.pickupData=f(null)}onFormChanges(e){this.pickupData.set(e)}onClose(){this.dialogRef.close()}onSave(){let e=this.generatePickupData();this.dialogRef.close(e)}generatePickupData(){switch(this.channelType()){case y.Shopee:return{OrderNumber:this.order().Number,ShopID:this.order().ShopID,pickup:this.pickupData()};case y.Tiktok:return{handover_method:"PICKUP",PackageID:this.shippingOptions().Form?.information?.PackageID,ShopID:this.order().ShopID,pickup_slot:this.pickupData()}}}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=D({type:i,selectors:[["app-pickup-dialog"]],decls:21,vars:2,consts:[["mat-dialog-title","",1,"mt-12","mb-6"],[1,"d-flex","justify-content-between","align-items-start","lh-lg"],[1,"lh-base","mt-6"],[1,"text-muted","fs-6"],["role","button",1,"fa-solid","fa-xmark","text-muted","cursor-pointer","fs-3",3,"click"],[2,"padding-bottom","10px"],[3,"shippingOptions"],[1,"d-flex","justify-content-end","align-items-center","w-100","pe-8","mb-4"],[1,"btn","btn-outline-secondary","me-4",2,"width","70px",3,"click"],[1,"btn","btn-success",2,"width","70px",3,"click"],[3,"onFormChanges","shippingOptions"]],template:function(t,n){if(t&1&&(o(0,"div",0)(1,"div",1)(2,"div")(3,"h3"),a(4,"Set Pickup"),r(),o(5,"div",2)(6,"div",3),a(7,"Shipping Method"),r(),o(8,"div",3),a(9),r()()(),o(10,"div")(11,"i",4),m("click",function(){return n.onClose()}),r()()()(),o(12,"mat-dialog-content",5),E(13,et,1,1,"shopee-pickup",6)(14,tt,1,1,"tiktok-pickup",6),r(),o(15,"mat-dialog-actions")(16,"div",7)(17,"button",8),m("click",function(){return n.onClose()}),a(18," Cancel "),r(),o(19,"button",9),m("click",function(){return n.onSave()}),a(20," Ok "),r()()()),t&2){let l,s;p(9),Q(" ",!((l=n.order())==null||l.LogisticService==null)&&l.LogisticService.Name?(l=n.order())==null||l.LogisticService==null?null:l.LogisticService.Name:"-"," "),p(4),P((s=n.channelType())===n.channelTypeEnum.Shopee?13:s===n.channelTypeEnum.Tiktok?14:-1)}},dependencies:[O,ae,oe,be,re,V,Be,ze],styles:['ng-select.shipping-timepicker .ng-arrow{border:none!important;width:0;height:0} ng-select.shipping-timepicker .ng-arrow-wrapper{width:28px;display:flex;align-items:center;justify-content:center} ng-select.shipping-timepicker .ng-arrow-wrapper:after{content:"\\f107";font-family:"Font Awesome 6 Pro","Font Awesome 6 Free","Font Awesome 5 Pro","Font Awesome 5 Free";font-style:normal;font-weight:400!important;font-size:16px;line-height:1;display:inline-block;color:#6b7280;pointer-events:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:auto}.label-opacity[_ngcontent-%COMP%]{opacity:.7}']})}}return i})();var se=(()=>{class i{constructor(){this.httpService=c(U)}getReadyToShipOrders(e){return this.httpService.post(M.GetToShip,e).pipe(W(t=>t?.Data))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=F({token:i,factory:i.\u0275fac})}}return i})();var Ue=(()=>{class i{constructor(){this.httpService=c(U)}getShippingOptions(e,t){return this.httpService.post(M.GetTiktokShippingOptions,{OrderNumber:e,ShopID:t}).pipe(W(n=>this.formatDatePickUpOptions(n)))}pickupOrder(e){return this.httpService.post(M.TiktokSelectShipping,e)}dropOffOrder(e,t){let n={handover_method:"DROP_OFF",PackageID:e,ShopID:t};return this.httpService.post(M.TiktokSelectShipping,n)}formatDatePickUpOptions(e){return e?.Options?.pickup_slots&&(e.Options.pickup_slots=e?.Options?.pickup_slots.map(t=>{let n=H.convertTimestampToDate(t.start_time),l=H.convertTimestampToDate(t.end_time);return t.start_date=n,t.end_date=l,t})),e}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=F({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var Ge=(()=>{class i{constructor(){this.httpService=c(U)}getShippingOptions(e,t){return this.httpService.post(M.GetShopeeShippingOptions,{OrderNumber:e,ShopID:t})}pickupOrder(e){return this.httpService.post(M.ShopeeSelectShipping,e)}dropOffOrder(e,t){let n={OrderNumber:e,ShopID:t,dropoff:{}};return this.httpService.post(M.ShopeeSelectShipping,n)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=F({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var Ke=(()=>{class i{constructor(){this.shopeeShippingService=c(Ge),this.tiktokShippingService=c(Ue)}getShippingOptions(e,t,n){switch(n){case y.Shopee:return this.getShopeeShippingOptions(e,t);case y.Tiktok:return this.getTiktokShippingOptions(e,t)}}pickupOrder(e,t){switch(e.MarketType){case y.Shopee:return this.shopeeShippingService.pickupOrder(t);case y.Tiktok:return this.tiktokShippingService.pickupOrder(t)}}dropOffOrder(e,t){switch(e.MarketType){case y.Shopee:return this.shopeeShippingService.dropOffOrder(e.Number,e.ShopID);case y.Tiktok:let n=t?.Form?.information?.PackageID;return this.tiktokShippingService.dropOffOrder(n,e.ShopID)}}getShopeeShippingOptions(e,t){return this.shopeeShippingService.getShippingOptions(e,t)}getTiktokShippingOptions(e,t){return this.tiktokShippingService.getShippingOptions(e,t)}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=F({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var it=()=>[],nt=i=>({"td-cell-hover":i});function ot(i,g){if(i&1&&b(0,"variants-dropdown",28),i&2){let e=h().$implicit;u("variants",e==null?null:e.Variants)}}function rt(i,g){if(i&1&&b(0,"variant-with-image",29),i&2){let e=h().$implicit;u("variant",e==null?null:e.Variants[0])}}function at(i,g){if(i&1&&(o(0,"span"),a(1),r()),i&2){let e=h().$implicit;p(),C(e.LogisticService==null?null:e.LogisticService.Option)}}function pt(i,g){if(i&1){let e=w();o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"div",24)(5,"div",25)(6,"div"),b(7,"img",26),x(8,"channelImage"),r(),o(9,"div"),b(10,"order-link",27),r()(),o(11,"small"),a(12),x(13,"date"),r()()(),o(14,"td"),a(15),r(),o(16,"td"),E(17,ot,1,1,"variants-dropdown",28)(18,rt,1,1,"variant-with-image",29),r(),o(19,"td",30),a(20),x(21,"number"),r(),o(22,"td")(23,"span"),a(24),r(),E(25,at,2,1,"span"),r(),o(26,"td",31)(27,"button",32),m("click",function(){let n=_(e).$implicit,l=h(2);return S(l.onSetFulfillment(n))}),a(28," Set Fulfillment "),r()()()}if(i&2){let e=g.$implicit;p(2),C(e.Outlet),p(5),u("src",X(8,12,e==null?null:e.MarketType),de)("alt",e==null||e.Variants[0]==null?null:e.Variants[0].Name),p(3),u("order",e),p(2),Q(" ",I(13,14,e==null?null:e.Created,"dd/MM/yyyy HH:mm:ss")," "),p(3),C(e.Customer),p(),K(Y(19,nt,(e.Variants==null?null:e.Variants.length)>1)),p(),P((e.Variants==null?null:e.Variants.length)>1?17:18),p(3),C(X(21,17,e.Amount)),p(4),C(e.LogisticService!=null&&e.LogisticService.Name?e.LogisticService==null?null:e.LogisticService.Name:"-"),p(),P(e.LogisticService!=null&&e.LogisticService.Option&&(e.LogisticService==null?null:e.LogisticService.Option)!="Default"?25:-1)}}function lt(i,g){if(i&1){let e=w();o(0,"div",13)(1,"table",15)(2,"thead",16)(3,"tr",17)(4,"th",18),a(5,"Outlet"),r(),o(6,"th",19),a(7,"Number"),r(),o(8,"th",19),a(9,"Customer"),r(),o(10,"th"),a(11,"Items"),r(),o(12,"th",20),a(13,"Amount"),r(),o(14,"th",21),a(15,"Shipping"),r(),b(16,"th",22),r()(),o(17,"tbody"),N(18,pt,29,21,"tr",null,L),r()(),o(20,"app-custom-paginator",23),m("next",function(){_(e);let n=h();return S(n.initReadyToShip())})("previous",function(){_(e);let n=h();return S(n.initReadyToShip())}),r()()}if(i&2){let e=h(),t=ge(0);p(18),A(t),p(2),u("filter",e.filter())("totaldata",t==null?null:t.length)}}function st(i,g){i&1&&(o(0,"div",14),b(1,"app-empty-state"),r())}var Ii=(()=>{class i{constructor(){this.readyToShipService=c(se),this.dialog=c(De),this.pickupService=c(Ke),this.toastr=c(ve),this.filter=f({PageNumber:1,PageSize:100,ListChannelID:[],From:new Date,To:new Date})}ngOnInit(){this.initReadyToShip()}initReadyToShip(){this.readyToShip$=this.readyToShipService.getReadyToShipOrders(this.filter()).pipe(me(1))}onFilterChange(e){this.filter.update(t=>G(G({},t),e))}onSetFulfillment(e){this.pickupService.getShippingOptions(e.Number,e.ShopID,e.MarketType).pipe(le(t=>this.dialog.open(Ae,{height:"400px",width:"530px",data:{options:t,channelType:e.MarketType}}).afterClosed().pipe(pe(n=>H.IsNotEmpty(n)),W(n=>({type:n,order:e,options:t}))))).subscribe(t=>{t.type=="PICK_UP"?this.onSelectPickup(t.order,t.options):this.onSelectDropOff(t.order,t.options)})}onSelectPickup(e,t){this.dialog.open(He,{width:"530px",data:{order:e,shippingOptions:t,channelType:e.MarketType},disableClose:!0}).afterClosed().pipe(pe(n=>H.IsNotEmpty(n)),le(n=>this.pickupService.pickupOrder(e,n))).subscribe(()=>{this.toastr.success("Pickup order created successfully","Success"),this.initReadyToShip()})}onSelectDropOff(e,t){this.pickupService.dropOffOrder(e,t).subscribe(()=>{this.toastr.success("Drop-off order created successfully","Success"),this.initReadyToShip()})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=D({type:i,selectors:[["app-ready-to-ship"]],features:[fe([se])],decls:29,vars:12,consts:[["headerTitle","To Ship","searchBoxPlaceHolder","Search Orders...",3,"onSubmit","hideSearchBox"],[1,"fw-bold","mb-2"],[3,"ngModelChange","multiple","ngModel"],[1,"mt-5"],[1,"mb-4"],["name","From",3,"dateChange","date"],["name","To",3,"dateChange","date"],[1,"fw-bold"],["type","number","name","PageNumber",1,"w-100","mt-2","form-control",3,"ngModelChange","ngModel"],["type","number","name","PageSize",1,"w-100","mt-2","form-control",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[1,"table-responsive"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"table"],[1,"sticky-top-thead"],[1,"table-light"],[2,"width","100px"],[2,"width","250px"],[1,"text-end",2,"width","150px"],[2,"width","150px"],[2,"width","160px"],["rowCountApi","/api/orders/toshipcount",3,"next","previous","filter","totaldata"],[1,"lh-sm"],[1,"d-flex","align-items-end","gap-2"],[2,"width","14px","padding-bottom","2.5px",3,"src","alt"],[2,"font-size","14px",3,"order"],[3,"variants"],[3,"variant"],[1,"text-end"],[1,"actions-cell"],[1,"btn","btn-success","btn-sm",2,"--bs-btn-padding-y","0.25rem","--bs-btn-padding-x","0.5rem","--bs-btn-font-size","0.75rem",3,"click"]],template:function(t,n){if(t&1){let l=w();ue(0),x(1,"async"),o(2,"mainpanel",0),m("onSubmit",function(){return _(l),S(n.initReadyToShip())}),o(3,"filters")(4,"div")(5,"label",1),a(6,"From/To"),r(),o(7,"channel-select-options",2),T("ngModelChange",function(d){return _(l),v(n.filter().ListChannelID,d)||(n.filter().ListChannelID=d),S(d)}),r()(),o(8,"div",3)(9,"label",1),a(10,"From/To"),r(),o(11,"div",4)(12,"datepicker",5),T("dateChange",function(d){return _(l),v(n.filter().From,d)||(n.filter().From=d),S(d)}),r()(),o(13,"div")(14,"datepicker",6),T("dateChange",function(d){return _(l),v(n.filter().To,d)||(n.filter().To=d),S(d)}),r()()(),o(15,"div",3)(16,"label",7),a(17,"Page Number"),r(),o(18,"input",8),T("ngModelChange",function(d){return _(l),v(n.filter().PageNumber,d)||(n.filter().PageNumber=d),S(d)}),r()(),o(19,"div",3)(20,"label",7),a(21,"Page Size"),r(),o(22,"input",9),T("ngModelChange",function(d){return _(l),v(n.filter().PageSize,d)||(n.filter().PageSize=d),S(d)}),r()()(),o(23,"content")(24,"div",10)(25,"div",11)(26,"div",12),E(27,lt,21,2,"div",13)(28,st,2,0,"div",14),r()()()()()}if(t&2){let l=he(X(1,8,n.readyToShip$)||_e(11,it));p(2),u("hideSearchBox",!0),p(5),u("multiple",!0),k("ngModel",n.filter().ListChannelID),p(5),k("date",n.filter().From),p(2),k("date",n.filter().To),p(4),k("ngModel",n.filter().PageNumber),p(4),k("ngModel",n.filter().PageSize),p(5),P(l.length>0?27:28)}},dependencies:[O,Se,Ce,j,Oe,we,Pe,Me,V,ye,ke,B,z,Ie,Ve,Re,Fe,Ee,Le],styles:[".actions-cell[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{opacity:0;visibility:hidden;transition:opacity .12s ease-in-out}tr[_ngcontent-%COMP%]:hover .actions-cell[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%], .actions-cell[_ngcontent-%COMP%]:hover .btn[_ngcontent-%COMP%], .actions-cell[_ngcontent-%COMP%]:focus-within .btn[_ngcontent-%COMP%], .actions-cell[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]:focus{opacity:1;visibility:visible}"]})}}return i})();export{Ii as ReadyToShipComponent};
@@ -0,0 +1,5 @@
1
+ import{a as ie,b as qe}from"./chunk-UMY6NG57.js";import"./chunk-NRCXYGO3.js";import"./chunk-2SXRC4IG.js";import"./chunk-WGXUKTYP.js";import{e as We,k as Le,l as Ae,m as $e,n as ze,o as Ye}from"./chunk-R76V3PTN.js";import"./chunk-6LH7FSOW.js";import"./chunk-XEMNZHW6.js";import"./chunk-ALKC77XL.js";import"./chunk-NTW6FBP5.js";import"./chunk-LR4UZ2OS.js";import"./chunk-F4GMWHYJ.js";import{a as Oe,b as Ne,c as Re}from"./chunk-ZIOAOUAM.js";import"./chunk-SIYMMMKQ.js";import"./chunk-WHZ44BAL.js";import{a as Be}from"./chunk-JOBWFOGC.js";import"./chunk-DJILLV4M.js";import"./chunk-OKAPL3YZ.js";import"./chunk-SDUUFQUI.js";import"./chunk-M5IQRAHV.js";import"./chunk-OZ7LWNOK.js";import"./chunk-VRI3CYGG.js";import"./chunk-AVEGIEYT.js";import{c as Ee,d as Pe,e as Ie}from"./chunk-SYENQYR7.js";import{a as Ue,b as Ge,c as je,e as Ke,f as He,g as Qe}from"./chunk-A2YNWIX6.js";import"./chunk-55OI2SUF.js";import"./chunk-2ZTDLZVZ.js";import"./chunk-2TZBEYNY.js";import"./chunk-SXLKJLAE.js";import{h as be,i as ee}from"./chunk-C7QA2BEN.js";import"./chunk-Z3ITXK3D.js";import"./chunk-ACIMXBIC.js";import"./chunk-TGMCGROM.js";import{a as Z}from"./chunk-CMZW5QAE.js";import{b as De,e as Te}from"./chunk-4M63ID5T.js";import"./chunk-K5XRGNWG.js";import"./chunk-HPYTL6TX.js";import{b as X,c as y}from"./chunk-PW42BQIY.js";import{m as Fe,n as ke}from"./chunk-6X2OBNJQ.js";import{c as Se,h as Ce,m as ve,w as ye,z as xe}from"./chunk-CSSG7NAJ.js";import"./chunk-MZI5AYCE.js";import"./chunk-UJYSVGLV.js";import{r as Me,s as Ve}from"./chunk-HFKKITEW.js";import"./chunk-OZ77CAJD.js";import{J as we,d as W,f as B,g as L,j as q,k as J,n as F}from"./chunk-MTUIRWOB.js";import{$c as R,Ac as ce,Bc as he,Cc as ue,Fc as T,Gb as I,Gc as s,Hc as V,Ic as C,Ka as j,Kc as b,Lc as E,Mb as g,Mc as P,Oa as k,Qc as K,Ra as _,Sc as fe,Tc as _e,Yb as d,Z as z,aa as le,ad as U,bd as ge,cd as H,dc as M,ea as Y,ic as o,ja as se,jc as a,kc as S,lc as O,m as re,mc as N,oc as x,pa as v,pb as pe,rb as r,sd as Q,tc as w,uc as h,v as G,xc as de,ya as m,yc as me,za as c}from"./chunk-JS55A2RS.js";import"./chunk-EU2KAMEK.js";import{a as ae,b as oe}from"./chunk-66YHNWRR.js";var et=t=>({"over-due":t});function tt(t,p){if(t&1&&(o(0,"tr",8)(1,"td"),s(2),a(),o(3,"td"),s(4),a(),o(5,"td"),s(6),a(),o(7,"td"),s(8),a()()),t&2){let e=p.$implicit,n=p.index;d("ngClass",fe(5,et,e.Exception)),r(2),V(n+1),r(2),V(e.Number),r(2),V(e.Status),r(2),V(e.Exception)}}function it(t,p){if(t&1&&(O(0),g(1,tt,9,7,"tr",7),N()),t&2){let e,n=h();r(),d("ngForOf",(e=n.downloadResult())==null?null:e.Body)}}function nt(t,p){t&1&&(o(0,"tr",9)(1,"td",10)(2,"div",11),S(3,"i",12),a(),o(4,"h4",13),s(5," There is no order to processed "),a()()())}var Je=(()=>{class t{constructor(){this.downloadResult=k()}ngOnInit(){}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=I({type:t,selectors:[["complete-step"]],inputs:{downloadResult:[1,"downloadResult"]},decls:16,vars:2,consts:[["EMPTY_DOWNLOAD",""],[1,"row","pt-2"],[1,"col-md-12"],[1,"table"],[1,"thead-light"],["width","1%"],[4,"ngIf","ngIfElse"],[3,"ngClass",4,"ngFor","ngForOf"],[3,"ngClass"],[1,"text-center"],["colspan","10",1,"border-0"],[2,"margin-top","16vh"],[1,"far","fa-file","text-secondary",2,"font-size","95px"],[1,"text-secondary","mt-6"]],template:function(n,i){if(n&1&&(o(0,"div",1)(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr"),S(5,"th",5),o(6,"th"),s(7,"Order Number"),a(),o(8,"th"),s(9,"Status"),a(),o(10,"th"),s(11,"Exception"),a()()(),o(12,"tbody"),g(13,it,2,1,"ng-container",6)(14,nt,6,0,"ng-template",null,0,H),a()()()()),n&2){let l,u=T(15);r(13),d("ngIf",((l=i.downloadResult())==null||l.Body==null?null:l.Body.length)>0)("ngIfElse",u)}},dependencies:[F,W,B,L],encapsulation:2})}}return t})();var A=(()=>{class t{constructor(){this.httpService=v(Te),this.toastr=v(De),this.datePipe=v(J)}gerChannelDetailById(e){return this.httpService.post(Z.GetChannelDetail,{ID:e})}getOrderPreview(e){return this.httpService.post(Z.GetOrderPreviewV2,e)}getDownloadOrder(e){return this.httpService.post(Z.GetDownloadOrderV2,e)}onPreviewOrder(e){return this.validateDatePreview(e)?this.getOrderPreview(e).pipe(Y(n=>{n.Data?.length===0&&this.toastrEmptyPreview(e)})):re}toastrEmptyPreview(e){let n=this.datePipe.transform(e.From,"dd MMM yyyy"),i=this.datePipe.transform(e.To,"dd MMM yyyy"),l=e.TimeFrom?e.TimeFrom:"",u=e.TimeTo?e.TimeTo:"";this.toastr.info(`There is no orders from ${n} ${l} to ${i} ${u}!`,"No Orders!")}validateDatePreview(e){let n=!0;return e.downloadType==!0?y.getDaysDiff(e?.From,e?.To)+1>7&&(this.toastr.warning("Dates cannot be more than 7 days apart!","Warning"),n=!1):y.getDaysDiff(e?.From,e?.To)+1>14&&(this.toastr.warning("Dates cannot be more than 14 days apart!","Warning"),n=!1),n}getDateTitle(e,n){let i=y.formatTitleFromDate(new Date(e),new Date(n)),l=this.datePipe.transform(e,i),u=this.datePipe.transform(n,"dd MMM yyyy");return`${i==null?"":l+"-"} ${u}`}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=se({token:t,factory:t.\u0275fac})}}return t})();function at(t,p){if(t&1&&(o(0,"ng-option",13),S(1,"img",14),s(2),a()),t&2){let e=p.$implicit;d("value",e.ID),r(),d("src",e==null?null:e.Img,pe),r(),C("",e.Name," ")}}function ot(t,p){if(t&1){let e=x();o(0,"div",8)(1,"div",4)(2,"h5"),s(3,"Type"),a(),o(4,"p",5),s(5,"Select Type want to download"),a()(),o(6,"div",4)(7,"div",15)(8,"div")(9,"mat-radio-group",16),P("ngModelChange",function(i){m(e);let l=h();return E(l.downloadType,i)||(l.downloadType=i),c(i)}),w("ngModelChange",function(){m(e);let i=h();return c(i.onDownloadTypeChange())}),o(10,"mat-radio-button",17),s(11," Orders "),a(),o(12,"mat-radio-button",18),s(13," Disbursement "),a()()()(),o(14,"div",19)(15,"div",20),S(16,"i",21),a(),o(17,"p",22),s(18," If there are completed transactions, to obtain payment and service fee, you need to download disbursement. "),a()()()()}if(t&2){let e=h();r(9),b("ngModel",e.downloadType),r(),d("value",!1),r(2),d("value",!0)}}function rt(t,p){t&1&&(o(0,"p",5),s(1," Select Disbursement date "),o(2,"span",23),s(3,"(payment date / order complete date)"),a(),s(4," of the channel you want to download (Max 1 Week). "),a())}function lt(t,p){t&1&&(o(0,"p",5),s(1," Select transaction date of the channel you want to download (Max 2 Weeks) "),a())}function st(t,p){if(t&1){let e=x();o(0,"div",12)(1,"app-timepicker",24),P("timeChange",function(i){m(e);let l=h();return E(l.startTime,i)||(l.startTime=i),c(i)}),w("timeChange",function(){m(e);let i=h();return c(i.onStartTimeChange())}),a(),o(2,"span",25),s(3,"-"),a(),o(4,"app-timepicker",24),P("timeChange",function(i){m(e);let l=h();return E(l.endTime,i)||(l.endTime=i),c(i)}),w("timeChange",function(){m(e);let i=h();return c(i.onEndTimeChange())}),a()()}if(t&2){let e=h();r(),b("time",e.startTime),r(3),b("time",e.endTime)}}var Xe=(()=>{class t{constructor(){this.reset=k(!1),this.authService=v(ee),this.tokenService=v(be),this.downloadService=v(A),this.downloadType=_(!1),this.selectedChannelId=_(null),this.channelOptions=_(this.authService.getChannels()),this.channelType=X,this.selectedChannel=_(null),this.showTimePicker=_(!1),this.startDate=_(null),this.endDate=_(null),this.startTime=_("00:00"),this.endTime=_("23:59"),this.minDate=_(new Date),this.maxDate=_(new Date),this.filterData=new j,Q(()=>{this.reset()&&this.resetFilter()},{allowSignalWrites:!0}),this.initDateValidation()}initDateValidation(){let e=this.tokenService?.getTokenValue(),n=e?.DownloadRange?JSON.parse(e?.DownloadRange):0;if(n<=0)this.minDate.set(null),this.maxDate.set(null);else{let i=new Date,l=y.addDays(i,n-1);this.minDate.set(l)}}resetFilter(){this.selectedChannelId.update(()=>null),this.startDate.update(()=>null),this.endDate.update(()=>null),this.startTime.update(()=>null),this.endTime.update(()=>null),this.downloadType.update(()=>!1),this.selectedChannel.update(()=>null),this.showTimePicker.update(()=>!1),this.channelDetail$=null}onSelectChannel(){this.selectedChannel.update(()=>this.channelOptions().find(e=>e.ID===this.selectedChannelId())),this.selectedChannel()?this.channelDetail$=this.downloadService.gerChannelDetailById(this.selectedChannelId()).pipe(G(e=>e?.Model),z(1)):this.channelDetail$=null,this.emitFilterData()}onFilterDateChange(){let e=1;this.startDate()&&this.endDate()&&(e=y.getDaysDiff(this.startDate(),this.endDate())),this.showTimePicker.update(()=>e==0),this.emitFilterData()}onDownloadTypeChange(){this.emitFilterData()}onStartTimeChange(){this.emitFilterData()}onEndTimeChange(){this.emitFilterData()}emitFilterData(){this.filterData.emit({channelId:this.selectedChannelId(),startDate:this.startDate(),endDate:this.endDate(),downloadType:this.downloadType(),startTime:this.startTime(),endTime:this.endTime()})}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=I({type:t,selectors:[["filter-step"]],inputs:{reset:[1,"reset"]},outputs:{filterData:"onFilterChange"},features:[K([A,We()])],decls:27,vars:13,consts:[["picker",""],[1,"row","pt-2",2,"width","63%","margin-right","40px"],[1,"col-12"],[1,"row"],[1,"col-6"],[1,"text-muted"],["appendTo","body","placeholder","Select Channel",3,"ngModelChange","clearable","ngModel"],[3,"value",4,"ngFor","ngForOf"],[1,"row","mt-6"],["id","dates",1,"form-control","rounded","dateRange",3,"rangePicker","min","max"],["matStartDate","","placeholder","Start date",3,"ngModelChange","click","ngModel","maxlength"],["matEndDate","","placeholder","End date",3,"ngModelChange","click","ngModel"],[1,"mt-8"],[3,"value"],[2,"width","18px","margin-right","10px",3,"src"],[1,"form-label-group","radio","download-type",2,"margin-bottom","0px"],["name","dowloadType",3,"ngModelChange","ngModel"],["matTooltip","Download from Create sales order until create logistics status",1,"me-5",3,"value"],["matTooltip","Download only Payment and write off",1,"me-5",3,"value"],[1,"d-flex","border","mb-4","pt-6","px-6","mt-3",2,"background","#1f87ac0a","border-radius","5px"],[1,"me-3","pt-1"],[1,"fa","fa-lightbulb","fs-5"],[1,"mb-6"],[1,"fw-bold"],[3,"timeChange","time"],[1,"mx-4"]],template:function(n,i){if(n&1){let l=x();o(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4)(4,"h5"),s(5,"Select a Channel"),a(),o(6,"p",5),s(7,"Select Channel want to download order"),a()(),o(8,"div",4)(9,"ng-select",6),P("ngModelChange",function(f){return m(l),E(i.selectedChannelId,f)||(i.selectedChannelId=f),c(f)}),w("ngModelChange",function(){return m(l),c(i.onSelectChannel())}),g(10,at,3,3,"ng-option",7),a()()(),g(11,ot,19,3,"div",8),R(12,"async"),o(13,"div",8)(14,"div",4)(15,"h5"),s(16,"Date Range"),a(),g(17,rt,5,0,"p",5)(18,lt,2,0,"p",5),a(),o(19,"div",4)(20,"div",2)(21,"mat-date-range-input",9)(22,"input",10),P("ngModelChange",function(f){return m(l),E(i.startDate,f)||(i.startDate=f),c(f)}),w("click",function(){m(l);let f=T(25);return c(f.open())}),a(),o(23,"input",11),P("ngModelChange",function(f){return m(l),E(i.endDate,f)||(i.endDate=f),c(f)}),w("click",function(){m(l);let f=T(25);return c(f.open())})("ngModelChange",function(){return m(l),c(i.onFilterDateChange())}),a()(),S(24,"mat-date-range-picker",null,0),a(),g(26,st,5,2,"div",12),a()()()()}if(n&2){let l,u,f=T(25);r(9),d("clearable",!1),b("ngModel",i.selectedChannelId),r(),d("ngForOf",i.channelOptions()),r(),M((l=U(12,11,i.channelDetail$))!=null&&l.ServiceFeeWriteOff&&((l=i.selectedChannel())==null?null:l.TypeID)==i.channelType.Tokopedia?11:-1),r(6),M(i.downloadType()&&((u=i.selectedChannel())==null?null:u.TypeID)==i.channelType.Tokopedia?17:18),r(4),d("rangePicker",f)("min",i.minDate())("max",i.maxDate()),r(),b("ngModel",i.startDate),r(),b("ngModel",i.endDate),r(3),M(i.showTimePicker()?26:-1)}},dependencies:[F,B,q,Ie,Pe,Ee,Re,Oe,Ne,xe,Se,Ce,ye,ve,qe,ze,Le,Ye,Ae,$e],styles:[".vertical-radio[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:15px 0}.mt-1rem[_ngcontent-%COMP%]{margin-top:1rem}.dateRange[_ngcontent-%COMP%]{padding-top:.8rem;padding-bottom:.8rem}.form-label-group.radio.download-type[_ngcontent-%COMP%]{height:45.5938px!important;border-radius:.375rem!important}"]})}}return t})();var D=function(t){return t.ALL="all",t.SYNC="sync",t.WRONG="wrong",t.UNSYNC="unsync",t}(D||{});var $=function(t){return t[t.DoNothing=0]="DoNothing",t[t.New=1]="New",t[t.Update=2]="Update",t}($||{});var pt=(t,p)=>({"over-due-today":t,"over-due":p});function dt(t,p){if(t&1&&(o(0,"th",21),s(1),a()),t&2){let e=h();r(),C(" ",e.selectedChannel()?"Created Date":"Last Status Update"," ")}}function mt(t,p){if(t&1&&(o(0,"td"),s(1),R(2,"date"),a()),t&2){let e=h().$implicit;r(),C(" ",ge(2,1,e.Modified,"dd MMM yyyy HH:mm:ss")," ")}}function ct(t,p){if(t&1&&(o(0,"span"),s(1),a()),t&2){let e=h().$implicit;r(),C(" ",e.ActionString," ")}}function ht(t,p){if(t&1&&(o(0,"li"),s(1),a()),t&2){let e=p.$implicit;r(),C(" ",e," ")}}function ut(t,p){if(t&1&&(o(0,"ul",27),g(1,ht,2,1,"li",22),a()),t&2){let e=h().$implicit;r(),d("ngForOf",e.ActionString)}}function ft(t,p){if(t&1&&(o(0,"span",28),S(1,"i",29),a()),t&2){let e=h().$implicit;me("title","Delivery : ",e.DeliveryState,`
2
+ Payment : `,e.PaymentState,"")}}function _t(t,p){if(t&1&&(o(0,"tr")(1,"td"),s(2),a(),o(3,"td"),s(4),a(),g(5,mt,3,4,"td",23),o(6,"td")(7,"span"),s(8),a(),s(9),a(),o(10,"td",24)(11,"span"),s(12),a(),s(13),a(),o(14,"td"),g(15,ct,2,1,"span",23)(16,ut,2,1,"ul",25),a(),o(17,"td"),g(18,ft,2,3,"span",26),a()()),t&2){let e,n=p.$implicit,i=p.index,l=h(2);r(2),V(i+1),r(2),V(n.Number),r(),d("ngIf",((e=l.selectedChannel())==null?null:e.TypeID)!=l.channelType.Shopee&&((e=l.selectedChannel())==null?null:e.TypeID)!==l.channelType.Tiktok),r(3),C("",n.ChannelStatus," - "),r(),C("",n.ChannelStatusDescription," "),r(),d("ngClass",_e(12,pt,(n==null?null:n.Action)==l.actionPreviewOrder.Update,(n==null?null:n.Action)==l.actionPreviewOrder.New))("matTooltip",n.POSStatus==91||n.POSStatusDescription=="Conflict"?"There is a missed status at POS, usually fulfillment has not been recorded but the payment has been recorded":""),r(2),C("",n.POSStatus," - "),r(),C("",n.POSStatusDescription," "),r(2),d("ngIf",n.ActionString.length==1),r(),d("ngIf",n.ActionString.length>1),r(2),d("ngIf",n.ChannelStatus!=99&&n.POSStatus!=99)}}function gt(t,p){if(t&1&&(O(0),g(1,_t,19,15,"tr",22),N()),t&2){let e=h();r(),d("ngForOf",e.displayPreviewData())}}function wt(t,p){t&1&&(o(0,"tr",30)(1,"td",31)(2,"div",32),S(3,"i",33),a(),o(4,"h4",34),s(5," There is no order to processed "),a()()())}var Ze=(()=>{class t{constructor(){this.orderPreview=k(),this.selectedChannel=k(),this.channelType=X,this.allData=_(0),this.syncData=_(0),this.wrongData=_(0),this.unsyncData=_(0),this.pillStatus=_(D.ALL),this.actionPreviewOrder=$,this.previewStatus=D,this.displayPreviewData=_([]),this.exportOrders=new j,Q(()=>{this.orderPreview()&&(this.filterPreviewData(D.ALL),this.initLengthStatusData())},{allowSignalWrites:!0})}filterPreviewData(e){this.pillStatus.update(()=>e),this.displayPreviewData.update(()=>this.filterDataByStatus(e))}initLengthStatusData(){this.wrongData.update(()=>this.filterDataByStatus(D.WRONG).length),this.syncData.update(()=>this.filterDataByStatus(D.SYNC).length),this.allData.update(()=>this.orderPreview().length),this.unsyncData.update(()=>this.filterDataByStatus(D.UNSYNC).length)}filterDataByStatus(e){let n=[];switch(e){case D.ALL:n=this.orderPreview();break;case D.SYNC:n=this.orderPreview().filter(i=>i.Action==$.DoNothing);break;case D.WRONG:n=this.orderPreview().filter(i=>i.Action==$.Update);break;case D.UNSYNC:n=this.orderPreview().filter(i=>i.Action==$.New);break}return n}onExportOrders(){this.exportOrders.emit()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=I({type:t,selectors:[["preview-step"]],inputs:{orderPreview:[1,"orderPreview"],selectedChannel:[1,"selectedChannel"]},outputs:{exportOrders:"onExportOrders"},decls:41,vars:11,consts:[["EMPTY",""],[1,"row","pt-2"],[1,"col-md-12"],[1,"row","mx-1","mb-5"],[1,"col-12","d-flex","justify-content-between","align-items-end",2,"padding-left","0px","padding-right","0px"],[1,"nav","nav-pills"],[1,"nav-item","me-3"],[1,"btn","btn-sm","rounded-pill",3,"click","ngClass"],[1,"nav-item","mx-3"],["matTooltip","All Invoice which is already available in POS",1,"btn","btn-sm","rounded-pill",3,"click","ngClass"],["matTooltip","Invoices that have different status between marketplace and POS",1,"btn","btn-sm","rounded-pill",3,"click","ngClass"],["matTooltip","Invoices which is not exist in POS",1,"btn","btn-sm","rounded-pill",3,"click","ngClass"],["type","button",1,"btn","btn-outline-secondary",3,"click"],[1,"fa-solid","fa-print","me-3"],[1,"table"],[1,"thead-light"],["width","1%"],["width","25%"],["width","15%",4,"ngIf"],["width","10%"],[4,"ngIf","ngIfElse"],["width","15%"],[4,"ngFor","ngForOf"],[4,"ngIf"],["matTooltipClass","custom-width-tooltip",3,"ngClass","matTooltip"],["class","ps-5",4,"ngIf"],[3,"title",4,"ngIf"],[1,"ps-5"],[3,"title"],[1,"fas","fa-info-circle","ms-2"],[1,"text-center"],["colspan","10",1,"border-0"],[2,"margin-top","16vh"],[1,"far","fa-file","text-secondary",2,"font-size","95px"],[1,"text-secondary","mt-6"]],template:function(n,i){if(n&1){let l=x();o(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4)(4,"div")(5,"ul",5)(6,"li",6)(7,"button",7),w("click",function(){return m(l),c(i.filterPreviewData(i.previewStatus.ALL))}),s(8),a()(),o(9,"li",8)(10,"button",9),w("click",function(){return m(l),c(i.filterPreviewData(i.previewStatus.SYNC))}),s(11),a()(),o(12,"li",8)(13,"button",10),w("click",function(){return m(l),c(i.filterPreviewData(i.previewStatus.WRONG))}),s(14),a()(),o(15,"li",8)(16,"button",11),w("click",function(){return m(l),c(i.filterPreviewData(i.previewStatus.UNSYNC))}),s(17),a()()()(),o(18,"div")(19,"button",12),w("click",function(){return m(l),c(i.onExportOrders())}),S(20,"i",13),o(21,"span"),s(22,"Export"),a()()()()(),o(23,"table",14)(24,"thead",15)(25,"tr"),S(26,"th",16),o(27,"th",17),s(28,"Number"),a(),g(29,dt,2,1,"th",18),o(30,"th",19),s(31,"Channel Status"),a(),o(32,"th",19),s(33,"POS Status"),a(),o(34,"th"),s(35,"Action"),a(),S(36,"th",16),a()(),o(37,"tbody"),g(38,gt,2,1,"ng-container",20)(39,wt,6,0,"ng-template",null,0,H),a()()()()}if(n&2){let l,u,f=T(40);r(7),d("ngClass",i.pillStatus()=="all"?"btn-secondary text-white":"btn-outline-dark"),r(),C(" All (",i.allData(),") "),r(2),d("ngClass",i.pillStatus()=="sync"?"btn-success":"btn-outline-success"),r(),C(" Existing (",i.syncData(),") "),r(2),d("ngClass",i.pillStatus()=="wrong"?"btn-warning text-white":"btn-outline-warning"),r(),C(" Wrong Status (",i.wrongData(),") "),r(2),d("ngClass",i.pillStatus()=="unsync"?"btn-danger":"btn-outline-danger"),r(),C(" Missing (",i.unsyncData(),") "),r(12),d("ngIf",((l=i.selectedChannel())==null?null:l.TypeID)!=i.channelType.Shopee&&((l=i.selectedChannel())==null?null:l.TypeID)!==i.channelType.Tiktok),r(9),d("ngIf",((u=i.displayPreviewData())==null?null:u.length)>0)("ngIfElse",f)}},dependencies:[F,W,B,L,J,Ve,Me],encapsulation:2})}}return t})();var St=["stepper"];function Ct(t,p){if(t&1){let e=x();o(0,"div",2)(1,"button",19),w("click",function(){m(e);let i=h();return c(i.onStepperBack())}),s(2," Back "),a(),o(3,"button",20),w("click",function(){m(e);let i=h();return c(i.onNextStep())}),s(4," Next "),a()()}if(t&2){let e=h();r(3),d("disabled",e.disabledNextFilter())}}function vt(t,p){if(t&1){let e=x();o(0,"button",21),w("click",function(){m(e);let i=h();return c(i.onNextStep())}),s(1," Next "),a()}if(t&2){let e=h();d("disabled",e.disabledNextFilter())}}function yt(t,p){if(t&1){let e=x();o(0,"button",22),w("click",function(){m(e);let i=h();return c(i.onNewDownload())}),S(1,"i",23),s(2," New "),a()}}function xt(t,p){t&1&&(S(0,"i",24),o(1,"span"),s(2,"Filter"),a())}function Dt(t,p){t&1&&(S(0,"i",25),o(1,"span"),s(2,"Preview"),a())}function Tt(t,p){if(t&1){let e=x();O(0),o(1,"preview-step",26),w("onExportOrders",function(){m(e);let i=h();return c(i.onExportOrders())}),a(),N()}if(t&2){let e=p.ngIf;r(),d("orderPreview",e)}}function bt(t,p){t&1&&(S(0,"i",27),o(1,"span"),s(2,"Finish"),a())}function Et(t,p){if(t&1&&(O(0),S(1,"complete-step",28),N()),t&2){let e=p.ngIf;r(),d("downloadResult",e)}}function Pt(t,p){t&1&&(o(0,"h6"),s(1,"1"),a())}function It(t,p){t&1&&(o(0,"h6"),s(1,"2"),a())}function Mt(t,p){t&1&&(o(0,"h6"),s(1,"3"),a())}var Ui=(()=>{class t{constructor(){this.downloadService=v(A),this.orderService=v(ie),this.productService=v(Be),this.authService=v(ee),this.stepperSelectedIndex=_(0),this.disabledNextFilter=_(!0),this.isResetFilter=_(!1),this.pageTitle=_("Download to POS"),this.cacheKey=_(y.GuidEMpty)}onFilterChange(e){this.filter=e,this.validateDisabledNext()}validateDisabledNext(){this.disabledNextFilter.update(()=>y.IsEmpty(this.filter?.channelId)||!y.isValidDate(this.filter.startDate)||!y.isValidDate(this.filter.endDate))}onNextStep(){switch(this.stepper.selectedIndex){case 0:this.onPreview();let e=this.productService.findChannelById(this.filter.channelId,this.authService.getChannels());this.setPageTitle(`Preview ${e?.Name}`);break;case 1:this.onDownload(),this.setPageTitle("Download");break}}onStepperNext(){this.stepper.selected.completed=!0,this.stepper.next()}onPreview(){let e={ID:this.filter.channelId,From:this.filter.startDate,To:this.filter.endDate,IsDisbursement:this.filter.downloadType};y.IsNotEmpty(this.filter.startTime)&&(e=oe(ae({},e),{TimeFrom:this.filter.startTime+":00",TimeTo:this.filter.endTime+":00"})),this.orderPreview$=this.downloadService.onPreviewOrder(e).pipe(Y(n=>{n.Data?.length>0&&(this.cacheKey.update(()=>n.CacheKey),this.onStepperNext())}),G(n=>n.Data),z(1))}onExportOrders(){let e={ID:this.filter.channelId,From:this.filter.startDate?this.filter.startDate:null,To:this.filter.endDate?this.filter.endDate:null},n=`Orders ${this.downloadService.getDateTitle(this.filter.startDate,this.filter.endDate)}`;this.orderService.exportOrders(e,n).subscribe()}onDownload(){let e={ID:this.filter.channelId,From:this.filter.startDate,To:this.filter.endDate,ListPreview:[],IsDisbursement:this.filter.downloadType,CacheKey:this.cacheKey()};this.downloadPreview$=this.orderPreview$.pipe(le(n=>(e.ListPreview=n,this.downloadService.getDownloadOrder(e))),Y(()=>{this.onStepperNext()}),z(1))}setPageTitle(e){this.pageTitle.update(()=>`
3
+ ${e} (${this.downloadService.getDateTitle(this.filter.startDate,this.filter.endDate)})
4
+ `)}onStepperBack(){this.stepper.previous(),this.pageTitle.update(()=>"Download to POS")}onNewDownload(){this.isResetFilter.update(()=>!0),this.stepper.reset(),this.stepperSelectedIndex.update(()=>0),this.orderPreview$=null,this.downloadPreview$=null,this.pageTitle.update(()=>"Download to POS")}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=I({type:t,selectors:[["app-download-v2"]],viewQuery:function(n,i){if(n&1&&ce(St,5),n&2){let l;he(l=ue())&&(i.stepper=l.first)}},features:[K([A,ie,{provide:Ue,useValue:{displayDefaultIndicatorType:!1}}])],decls:26,vars:20,consts:[["stepper",""],[3,"hideSearchBox","hideSearchDropdown","headerTitle","description"],[1,"btn-group","me-3"],["type","button",1,"btn","btn-outline-secondary","btn-fill","me-3","bg-success","text-white",3,"disabled"],[1,"btn","btn-outline-secondary","btn-fill"],[1,"container-fluid","pt-5","mt-5"],[1,"row"],[1,"col-12"],[1,"d-flex","justify-content-center"],["linear","",1,"w-100","stepper-download",3,"selectedIndexChange","ngClass","selectedIndex"],["state","filter",3,"completed","editable"],["matStepLabel",""],[1,"w-100",3,"onFilterChange","reset"],["state","preview",3,"editable","completed"],[4,"ngIf"],["state","finish"],["matStepperIcon","filter"],["matStepperIcon","preview"],["matStepperIcon","finish"],[1,"btn","btn-outline-secondary",3,"click"],["type","button",1,"btn","btn-outline-secondary","bg-success","text-white",3,"click","disabled"],["type","button",1,"btn","btn-outline-secondary","btn-fill","me-3","bg-success","text-white",3,"click","disabled"],[1,"btn","btn-outline-secondary","btn-fill",3,"click"],["aria-hidden","true",1,"fa","fa-file-alt","me-2"],[1,"fa-solid","fa-filter","me-3"],[1,"fa-solid","fa-file","me-3"],[3,"onExportOrders","orderPreview"],[1,"fa-solid","fa-flag","me-3"],[3,"downloadResult"]],template:function(n,i){if(n&1){let l=x();o(0,"mainpanel",1)(1,"actions"),g(2,Ct,5,1,"div",2)(3,vt,2,1,"button",3)(4,yt,3,0,"button",4),a(),o(5,"content")(6,"div",5)(7,"div",6)(8,"div",7)(9,"div",8)(10,"mat-stepper",9,0),P("selectedIndexChange",function(f){return m(l),E(i.stepperSelectedIndex,f)||(i.stepperSelectedIndex=f),c(f)}),o(12,"mat-step",10),g(13,xt,3,0,"ng-template",11),o(14,"filter-step",12),w("onFilterChange",function(f){return m(l),c(i.onFilterChange(f))}),a()(),o(15,"mat-step",13),g(16,Dt,3,0,"ng-template",11)(17,Tt,2,1,"ng-container",14),R(18,"async"),a(),o(19,"mat-step",15),g(20,bt,3,0,"ng-template",11)(21,Et,2,1,"ng-container",14),R(22,"async"),a(),g(23,Pt,2,0,"ng-template",16)(24,It,2,0,"ng-template",17)(25,Mt,2,0,"ng-template",18),a()()()()()()()}if(n&2){let l=T(11);d("hideSearchBox",!0)("hideSearchDropdown",!0)("headerTitle",i.pageTitle())("description",i.pageTitle()),r(2),M(i.stepperSelectedIndex()==1?2:-1),r(),M(i.stepperSelectedIndex()==0?3:-1),r(),M(i.stepperSelectedIndex()==2?4:-1),r(6),de("ngClass","last-edited-step-"+l.selectedIndex),b("selectedIndex",i.stepperSelectedIndex),r(2),d("completed",!1)("editable",i.stepperSelectedIndex()!=2),r(2),d("reset",i.isResetFilter()),r(),d("editable",i.stepperSelectedIndex()!=2)("completed",!1),r(2),d("ngIf",U(18,16,i.orderPreview$)),r(4),d("ngIf",U(22,18,i.downloadPreview$))}},dependencies:[F,W,L,q,Je,Xe,Ze,Qe,Ke,Ge,He,je,ke,Fe,we],styles:[`@import"https://fonts.googleapis.com/icon?family=Material+Icons";.vertical-radio{display:flex;flex-direction:column;margin:15px 0}.mt-1rem{margin-top:1rem}.dateRange{padding-top:.8rem;padding-bottom:.8rem}mat-stepper.stepper-download>div.mat-horizontal-stepper-wrapper>div.mat-horizontal-stepper-header-container{position:relative;width:60%;left:18%}mat-stepper.stepper-download>div.mat-horizontal-stepper-wrapper>div.mat-horizontal-content-container>div.mat-horizontal-stepper-content:nth-child(1){display:flex;justify-content:left}mat-stepper.stepper-download>div.mat-horizontal-stepper-wrapper>div.mat-horizontal-content-container{margin-top:30px}mat-stepper.stepper-download>div.mat-horizontal-stepper-wrapper>div.mat-horizontal-stepper-header-container>mat-step-header.mat-horizontal-stepper-header{pointer-events:none!important}.form-label-group.radio.download-type{height:45.5938px!important;border-radius:.375rem!important}
5
+ `],encapsulation:2})}}return t})();export{Ui as DownloadV2Component};