openc3-cosmos-tool-limitsmonitor 7.4.0 → 7.4.1

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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/tools/limitsmonitor/{ArrayWidget-CIDdZjk3-b356b7cd49e4686a92a4.js → ArrayWidget-_X_afgHR-0233cbec98a6114406dd.js} +2 -2
  3. data/tools/limitsmonitor/{ArrayplotWidget-BfO1atvG-8b35039c1b45ed70e608.js → ArrayplotWidget-BUH82FI4-54c8237b08243d74920f.js} +1 -1
  4. data/tools/limitsmonitor/{BarColumn-CHX_3ye3-5fc3cf4a7081e2df284a.js → BarColumn-B_V83WMV-45a92ddcb8ba6cf47a5c.js} +1 -1
  5. data/tools/limitsmonitor/{BlockWidget-DSbunlY_-b0dd66429346edd1d9f4.js → BlockWidget-DKedrbWf-b5621b0b80cc68abce68.js} +2 -2
  6. data/tools/limitsmonitor/{ButtonWidget-BB4ZOCI8-a8db88df0066b2eb80f6.js → ButtonWidget-DB3HWmyA-f056c37d8932e275e94e.js} +1 -1
  7. data/tools/limitsmonitor/CanvasWidget-D9EH5pzn-4933ca0a9c5d77ae432c.js +1 -0
  8. data/tools/limitsmonitor/CanvasdotWidget-BlE7J1N4-8f87324dbf4fadfd4c84.js +1 -0
  9. data/tools/limitsmonitor/{CanvasimageWidget-DY1DDf0a-5b0949c5f62f53fc1e83.js → CanvasimageWidget-BlIBXSax-170e4417fa9cd145580b.js} +1 -1
  10. data/tools/limitsmonitor/{CanvasimagevalueWidget-0lc2cCPV-b9c1aca37ef6bd2b29a8.js → CanvasimagevalueWidget-DXxbcD-Q-382cbf79e7eed229ba98.js} +1 -1
  11. data/tools/limitsmonitor/{CanvaslabelWidget-C6TDW9WO-8996bbabd02384a2aa75.js → CanvaslabelWidget-3GsIsHNJ-3b69a77d56f516e16769.js} +1 -1
  12. data/tools/limitsmonitor/{CanvaslabelvalueWidget-Cf_dcDW2-7428beac0b32d0c3a055.js → CanvaslabelvalueWidget-Cccis43F-160c860abf1f9bb8fb9e.js} +1 -1
  13. data/tools/limitsmonitor/CanvaslineWidget-w07GyddB-763acea7e24e390944e4.js +1 -0
  14. data/tools/limitsmonitor/{CanvaslinevalueWidget-CKpjqlKA-462ce46b5345ca895dd9.js → CanvaslinevalueWidget-CuTyiORB-e7c16bb3927052b2b082.js} +1 -1
  15. data/tools/limitsmonitor/{CheckbuttonWidget-BWXinMaT-54b673e4ddb970757772.js → CheckbuttonWidget-7b-uK9Tk-0898e2b6de62c2bb7999.js} +1 -1
  16. data/tools/limitsmonitor/ComboboxWidget-CdmrG6UT-b63f23a06f780c6c2812.js +1 -0
  17. data/tools/limitsmonitor/{DateWidget-qUbLzQsX-d557afabe22994bc40e6.js → DateWidget-D1pxOAks-c96b4f679579dcfeb5ad.js} +1 -1
  18. data/tools/limitsmonitor/{DetailsDialog-CLPj0nP0-4a192b15c2d91185e355.js → DetailsDialog-CrP3epOv-9e36df972ea347b32637.js} +1 -1
  19. data/tools/limitsmonitor/{DynamicWidget-yna_ejyc-21935db5a7e710823c83.js → DynamicWidget-yna_ejyc-53ebe6de0bde8aad55d9.js} +1 -1
  20. data/tools/limitsmonitor/{FilechecksumWidget-DqNThsOX-50cf51425b190ef4d520.js → FilechecksumWidget-eMy16t1i-3ca36f122211f2c768ea.js} +1 -1
  21. data/tools/limitsmonitor/{FiledisplayWidget-BRhhiVEs-244ccad0b8a9493fccd7.js → FiledisplayWidget-B-hR67mo-3d1b2993df33305147c1.js} +1 -1
  22. data/tools/limitsmonitor/{FormatvalueWidget-pEjAh0h2-262f5bb536d0356060bc.js → FormatvalueWidget-lUNlLWlR-9686132685f79f53ba12.js} +1 -1
  23. data/tools/limitsmonitor/Graph--wiWQKh0-e4893e3b73bbed446fe4.js +1 -0
  24. data/tools/limitsmonitor/{GraphWidget-BZjBkefj-b909c2fa3a5cf8c26720.js → GraphWidget-BvyRvV66-396cd73b34c1926d1605.js} +1 -1
  25. data/tools/limitsmonitor/{HorizontalWidget-Brag6E4y-030ebd630c13c4e98456.js → HorizontalWidget-DKjAFowf-ee3b8dccfe2852bda4fc.js} +1 -1
  26. data/tools/limitsmonitor/HorizontalboxWidget-ge9b4747-ab9e4cec3624be16da6a.js +1 -0
  27. data/tools/limitsmonitor/HorizontallineWidget-BX8YItd_-b16dc1ce0863bdfcaa83.js +1 -0
  28. data/tools/limitsmonitor/{IframeWidget-Ciu5u58E-2712563b626bc3a14da5.js → IframeWidget-B6WC_SMn-a81077e427408ab4fa03.js} +1 -1
  29. data/tools/limitsmonitor/ImageLoader-QC6TN_Tu-ecbdef6d35f550ac0180.js +1 -0
  30. data/tools/limitsmonitor/{ImageviewerWidget-vWMGPveb-e7653c2c62c71811c83f.js → ImageviewerWidget-CLcPtNkW-76d251fa4e54da0a0c10.js} +1 -1
  31. data/tools/limitsmonitor/{LabelWidget-DVp0CmFH-ee4609adef1f8ed73dca.js → LabelWidget-BMxEJEgT-c72e974b4552c90d5115.js} +1 -1
  32. data/tools/limitsmonitor/{LabelledWidget-1DeE1-6G-c23924571af5d0b4c2ac.js → LabelledWidget-DyLep7BJ-041e6674465c9720ff04.js} +1 -1
  33. data/tools/limitsmonitor/LabelprogressbarWidget-CQVg9bpz-8c86f65f2401720a0e1a.js +1 -0
  34. data/tools/limitsmonitor/LabelsparklineWidget-Dq4ZFHs0-e276d429e8f468386bbe.js +1 -0
  35. data/tools/limitsmonitor/LabelvalueWidget-17PcoD2V-a22bc802d3ca294156a7.js +1 -0
  36. data/tools/limitsmonitor/{LabelvaluedescWidget-c5BUCRxB-425904fd86e53f2aaf9b.js → LabelvaluedescWidget-zpeZoPGi-2257559c61780170a21e.js} +1 -1
  37. data/tools/limitsmonitor/LabelvaluelimitsbarWidget-CAX0dGi5-6e860072810be3b90b10.js +1 -0
  38. data/tools/limitsmonitor/LabelvaluelimitscolumnWidget-Bi-ROV2g-c54e1c3dfb0724c8c705.js +1 -0
  39. data/tools/limitsmonitor/LabelvaluerangebarWidget-D8zuio3--61202962df67024c500b.js +1 -0
  40. data/tools/limitsmonitor/{Layout-Df-lJgpB-fa0e905237af2242b94c.js → Layout-740AmQLZ-7744c633c53d5b14303f.js} +1 -1
  41. data/tools/limitsmonitor/{LedWidget-C97EJXBo-0e4f8e06986ae155da43.js → LedWidget-Bg65XQ0l-744dea1685fd3c7dca0b.js} +1 -1
  42. data/tools/limitsmonitor/{LimitsBar-DNV39okL-be518abae6613d52dfef.js → LimitsBar-DoRwFPYW-dabec512d162ec0aca6a.js} +1 -1
  43. data/tools/limitsmonitor/{LimitsMonitor-6ca6203f02f43a235751.js → LimitsMonitor-3440402c565bffe78fde.js} +6 -6
  44. data/tools/limitsmonitor/{LimitsbarWidget-BIO6xztx-75f6c0676b93cecd766f.js → LimitsbarWidget-BJcc_1qa-dc6061ddca8ed8f1601d.js} +1 -1
  45. data/tools/limitsmonitor/{LimitscolorWidget-BGrNA65J-89a1b605eb0529bba554.js → LimitscolorWidget-Dzz0Qxet-95423edbcdaf277ac65c.js} +1 -1
  46. data/tools/limitsmonitor/{LimitscolumnWidget-Bw6EXJs9-c5e764882f8fe42e8884.js → LimitscolumnWidget-CwzHaKP4-24b5f2a6e771ebdc9712.js} +1 -1
  47. data/tools/limitsmonitor/{LinegraphWidget-Drf9tTPN-8d489c10d808668d9d81.js → LinegraphWidget-C6tb4yDb-33b1c50109d28878db12.js} +1 -1
  48. data/tools/limitsmonitor/{MatrixbycolumnsWidget-C33-g7kK-97ef7fc5c4abd28c9241.js → MatrixbycolumnsWidget-B18dc43U-c36b2e5f80b6ee7f9dab.js} +1 -1
  49. data/tools/limitsmonitor/{OpenC3TimePicker-cOr0aOVn-eeb8fefcd9a16af2ecdb.js → OpenC3TimePicker-CM2VG1mS-bbaf2c0ebae72c5dfb89.js} +1 -1
  50. data/tools/limitsmonitor/{ProgressbarWidget-DqfSMI10-b6425fd6dd60d484d466.js → ProgressbarWidget-DXMt6dar-f85c65b5bb72ebc62e4d.js} +1 -1
  51. data/tools/limitsmonitor/{RadiobuttonWidget-CSQeEacF-a2044fea24882d465523.js → RadiobuttonWidget-zxv884Z8-1becbf5d3e530665db4b.js} +1 -1
  52. data/tools/limitsmonitor/RadiogroupWidget-BVE6wpmw-be2a287e90f6a4841571.js +1 -0
  53. data/tools/limitsmonitor/{RangebarWidget-CJSUof1--fdfd78df547ff7ec9fa8.js → RangebarWidget-B43rOEnA-8eedcafa1bb29f9f4929.js} +1 -1
  54. data/tools/limitsmonitor/{RollupWidget-C977Lkcx-a94f14d09d42f2dfd584.js → RollupWidget-BEEjvyua-92b8dd55f4b0ac1ad456.js} +1 -1
  55. data/tools/limitsmonitor/{ScrollwindowWidget-BFxz61oW-5b1949802dc9b2fe1b9b.js → ScrollwindowWidget-CUUtkAh4-85c5a612c96f49eeb000.js} +1 -1
  56. data/tools/limitsmonitor/{SignalWidget-BT6AcbBx-d9914f75797851ff999e.js → SignalWidget-CbvidVbl-11cf5d7c5fd8a97a5a06.js} +1 -1
  57. data/tools/limitsmonitor/{SpacerWidget-B_f09KAi-044fa5cc9b8b2cb35287.js → SpacerWidget-BukDoKlv-ca1c0467667da27bac3f.js} +1 -1
  58. data/tools/limitsmonitor/SparklineWidget-BjSNHLGS-9b7aa3af5527eb95eaa9.js +1 -0
  59. data/tools/limitsmonitor/TabbookWidget-5Dz5n4sQ-7515b413b16f221a29ce.js +1 -0
  60. data/tools/limitsmonitor/TextboxWidget-QzrrHB9s-fc728fb71aded05d575a.js +1 -0
  61. data/tools/limitsmonitor/TextfieldWidget-BpDBnDUq-50fd9f2ad6d3ef81ec09.js +1 -0
  62. data/tools/limitsmonitor/TimeWidget-CjZInJFT-89519ca02da53686a593.js +1 -0
  63. data/tools/limitsmonitor/TitleWidget-C9VC8OUI-0e4e583c707ab285a154.js +1 -0
  64. data/tools/limitsmonitor/{VWidget-C4VLQ7-b-ee37650b376b33eb71d2.js → VWidget-D8HzcrTo-e72cf0783026debd0277.js} +1 -1
  65. data/tools/limitsmonitor/ValueWidget-CGOhPtMG-9e707dc5b2a5983f78af.js +1 -0
  66. data/tools/limitsmonitor/ValuelimitsbarWidget-Lfq0cbnZ-f0904dd6829cec7bc2b4.js +1 -0
  67. data/tools/limitsmonitor/ValuelimitscolumnWidget-BH333HsT-b618dce611c6d73154e8.js +1 -0
  68. data/tools/limitsmonitor/ValuerangebarWidget-95AG0gex-619e763be10dc34d6bf7.js +1 -0
  69. data/tools/limitsmonitor/VerticalWidget-fxittOB1-5037e3eac55842daccba.js +1 -0
  70. data/tools/limitsmonitor/{VerticalboxWidget-BD5Eq3BH-b4adabcb09ae340cebc1.js → VerticalboxWidget-CKnoHa-u-1400bb55ff5a74858d70.js} +1 -1
  71. data/tools/limitsmonitor/{Widget-ClRi417b-83b61ac8961d9944d1cf.js → Widget-lYL8eSaS-261a094fe0bd216bc766.js} +1 -1
  72. data/tools/limitsmonitor/{main-841880377cb3fe70d8e1.js → main-fe1c8d8cac9248a6882f.js} +2 -2
  73. data/tools/limitsmonitor/main.js +1 -1
  74. metadata +72 -72
  75. data/tools/limitsmonitor/CanvasWidget-DsyMt7xW-4b5b045554b35e593a4e.js +0 -1
  76. data/tools/limitsmonitor/CanvasdotWidget-BZpkCAoH-c906c8da6ed47976e2c5.js +0 -1
  77. data/tools/limitsmonitor/CanvaslineWidget-jg2ozQ0N-6d529178eff330b4e150.js +0 -1
  78. data/tools/limitsmonitor/ComboboxWidget-BzKkyRDT-583ccc7aec8a2e3152eb.js +0 -1
  79. data/tools/limitsmonitor/Graph-GVQZltap-87c592a54590011da5df.js +0 -1
  80. data/tools/limitsmonitor/HorizontalboxWidget-BnkH4cVq-6049e74f546860222bb5.js +0 -1
  81. data/tools/limitsmonitor/HorizontallineWidget-k7fL4EPN-032b491b753e1fe2eda0.js +0 -1
  82. data/tools/limitsmonitor/ImageLoader-DH5e4lg8-ac27af24f569824d1e7b.js +0 -1
  83. data/tools/limitsmonitor/LabelprogressbarWidget-DME-BrZe-b47bcb173fe4bca1855d.js +0 -1
  84. data/tools/limitsmonitor/LabelsparklineWidget-4iDHGnPL-0b5cc465bc6fa894459c.js +0 -1
  85. data/tools/limitsmonitor/LabelvalueWidget-C6NQSHTb-6b6c85ea39a04c00d8bb.js +0 -1
  86. data/tools/limitsmonitor/LabelvaluelimitsbarWidget-DBKZLpXJ-61ca3bff500a51ba91fd.js +0 -1
  87. data/tools/limitsmonitor/LabelvaluelimitscolumnWidget-NdEu06go-6e1631b296b3fd7d5d51.js +0 -1
  88. data/tools/limitsmonitor/LabelvaluerangebarWidget-CL5HLK0t-a462da33d32b08751ce8.js +0 -1
  89. data/tools/limitsmonitor/RadiogroupWidget-DlQN9z-Z-508c286cf2c194ce67d9.js +0 -1
  90. data/tools/limitsmonitor/SparklineWidget-Bji9DILO-c8c2dc8a5d1a2fdd374e.js +0 -1
  91. data/tools/limitsmonitor/TabbookWidget-B74U8t2i-e8114d0ea704cda02e49.js +0 -1
  92. data/tools/limitsmonitor/TextboxWidget-CbKE9aSW-1ac69993f6649c812612.js +0 -1
  93. data/tools/limitsmonitor/TextfieldWidget-CpdmfNk5-2c4c4421f4af210ef85c.js +0 -1
  94. data/tools/limitsmonitor/TimeWidget-BTaXBxVm-97be78a69df6dd6a93fe.js +0 -1
  95. data/tools/limitsmonitor/TitleWidget-ulO_gdVY-010c4530628675ef48e9.js +0 -1
  96. data/tools/limitsmonitor/ValueWidget-B3-Jjoux-ee04d97af0922d6e7c50.js +0 -1
  97. data/tools/limitsmonitor/ValuelimitsbarWidget-CqRkPwWS-22a8e09ea0877c62d177.js +0 -1
  98. data/tools/limitsmonitor/ValuelimitscolumnWidget-CF4CN14a-994e69bd38c04b7e7d27.js +0 -1
  99. data/tools/limitsmonitor/ValuerangebarWidget-DJtrknKH-b9314f78922b511a0953.js +0 -1
  100. data/tools/limitsmonitor/VerticalWidget-CoJiy2TT-70a8c7544378e1dddf68.js +0 -1
@@ -1,11 +1,11 @@
1
- System.register(["./main-841880377cb3fe70d8e1.js","vue","single-spa","./ValueWidget-B3-Jjoux-ee04d97af0922d6e7c50.js","./IframeWidget-Ciu5u58E-2712563b626bc3a14da5.js","./ValuelimitsbarWidget-CqRkPwWS-22a8e09ea0877c62d177.js","vue-router","pinia","vuetify","./DetailsDialog-CLPj0nP0-4a192b15c2d91185e355.js","./LimitsBar-DNV39okL-be518abae6613d52dfef.js","./LimitsColor-CBcpB-la-3bd861951380f642016e.js","./VWidget-C4VLQ7-b-ee37650b376b33eb71d2.js","./Widget-ClRi417b-83b61ac8961d9944d1cf.js","./LimitsbarWidget-BIO6xztx-75f6c0676b93cecd766f.js","./BarColumn-CHX_3ye3-5fc3cf4a7081e2df284a.js"],(function(Ss,wa){"use strict";var Bt,dt,He,ht,$t,qt,E,T,D,Vt,w,_,V,ee,Z,pe,Oe,Mt,B,Pe,Ke,ft,de,pt,zt,Wt,Jt,Ht,Kt;return{setters:[A=>{Bt=A.g,dt=A.O,He=A._,ht=A.R,$t=A.a,qt=A.k},A=>{E=A.resolveComponent,T=A.openBlock,D=A.createBlock,Vt=A.Teleport,w=A.createVNode,_=A.withCtx,V=A.createElementVNode,ee=A.toDisplayString,Z=A.createElementBlock,pe=A.Fragment,Oe=A.renderList,Mt=A.ref,B=A.createTextVNode,Pe=A.mergeProps,Ke=A.createSlots,ft=A.normalizeStyle,de=A.createCommentVNode,pt=A.normalizeClass,zt=A.normalizeProps,Wt=A.guardReactiveProps,Jt=A.withKeys},null,A=>{Ht=A.default},null,A=>{Kt=A.default},null,null,null,null,null,null,null,null,null,null],execute:(function(){var A=document.createElement("style");A.textContent=`.footer[data-v-b6f77818]{padding-top:5px}.v-input[data-v-b6f77818]{background-color:var(--color-background-base-default)}.textfield-green[data-v-b6f77818]{color:#00c800}.textfield-yellow[data-v-b6f77818]{color:#ffdc00}.textfield-red[data-v-b6f77818]{color:#ff2d2d}.limits-table[data-v-b6f77818]{margin-top:5px;margin-bottom:10px}.limits-table[data-v-b6f77818] th{font-weight:700;background-color:var(--color-background-base-default)}.limits-table[data-v-b6f77818] .state-filtered-row{display:none}.card-height[data-v-192a6dcb]{height:calc(100vh - 150px)}
2
- /*$vite$:1*/`,document.head.appendChild(A);const Es={__name:"TopBarMenu",props:{menu:{type:Object,required:!0},title:{type:String,required:!0}},emits:["submenu-click"],setup(t,{emit:e}){const r=e,s=Mt(!1);function n(){s.value=!1}function i(o){return o.replaceAll(" ","-").toLowerCase()}return(o,a)=>{const c=E("v-icon"),d=E("v-btn"),u=E("v-divider"),h=E("v-list-item-title"),p=E("v-list-item"),y=E("v-list"),C=E("v-menu"),P=E("v-radio"),v=E("v-list-item-action"),S=E("v-radio-group"),g=E("v-checkbox"),b=E("v-tooltip");return T(),D(C,{modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=f=>s.value=f),"close-on-content-click":!1},{activator:_(({props:f})=>[w(d,Pe(f,{variant:"outlined",class:"mx-1 menu-button",text:t.menu.label,"data-test":i(`${t.title} ${t.menu.label}`)}),{append:_(()=>[w(c,{class:"menu-button-icon"},{default:_(()=>[...a[1]||(a[1]=[B(" mdi-menu-down ",-1)])]),_:1})]),_:1},16,["text","data-test"])]),default:_(()=>[w(y,null,{default:_(()=>[(T(!0),Z(pe,null,Oe(t.menu.items,(f,I)=>(T(),Z(pe,null,[f.divider?(T(),D(u,{key:I+"-divider"})):f.subMenu&&f.subMenu.length>0?(T(),Z("div",{key:I+"-submenu"},[(T(),D(C,{key:I,"open-on-hover":"",location:"right"},{activator:_(({props:R})=>[(T(),D(p,Pe({ref_for:!0},R,{key:I,disabled:f.disabled}),Ke({append:_(()=>[w(c,null,{default:_(()=>[...a[2]||(a[2]=[B(" mdi-chevron-right ",-1)])]),_:1})]),default:_(()=>[!f.radio&&!f.checkbox?(T(),D(h,{key:0,style:ft("cursor: pointer;"+(f.disabled?"opacity: 0.2":""))},{default:_(()=>[B(ee(f.label),1)]),_:2},1032,["style"])):de("",!0)]),_:2},[f.icon?{name:"prepend",fn:_(()=>[w(c,{disabled:f.disabled},{default:_(()=>[B(ee(f.icon),1)]),_:2},1032,["disabled"])]),key:"0"}:void 0]),1040,["disabled"]))]),default:_(()=>[w(y,null,{default:_(()=>[(T(!0),Z(pe,null,Oe(f.subMenu,(R,H)=>(T(),D(p,{key:H,"prepend-icon":R.icon,onClick:ie=>r("submenu-click",R)},{default:_(()=>[w(h,null,{default:_(()=>[B(ee(R.label),1)]),_:2},1024)]),_:2},1032,["prepend-icon","onClick"]))),128))]),_:2},1024)]),_:2},1024))])):f.radioGroup?(T(),D(S,{key:I+"-radio-group",class:"ma-0 pa-0",density:"compact","hide-details":"","model-value":f.value,"onUpdate:modelValue":f.command},{default:_(()=>[(T(!0),Z(pe,null,Oe(f.choices,(R,H)=>(T(),D(p,{key:H+"-choice"},{default:_(()=>[w(v,{class:"list-action"},{default:_(()=>[w(P,{color:"secondary",label:R.label,value:R.value,density:"compact","hide-details":""},null,8,["label","value"])]),_:2},1024)]),_:2},1024))),128))]),_:2},1032,["model-value","onUpdate:modelValue"])):(T(),D(b,{key:I+"-list",disabled:!f.tooltip,text:f.tooltip,location:"right"},{activator:_(({props:R})=>[V("div",Pe({ref_for:!0},R),[w(p,{disabled:f.disabled,"data-test":i(`${t.title} ${t.menu.label} ${f.label}`),onClick:()=>{f.command(f),f.checkbox||n()}},Ke({default:_(()=>[f.checkbox?(T(),D(v,{key:0,class:"list-action"},{default:_(()=>[w(g,{modelValue:f.checked,"onUpdate:modelValue":H=>f.checked=H,label:f.label,color:"secondary",density:"compact","hide-details":""},null,8,["modelValue","onUpdate:modelValue","label"])]),_:2},1024)):de("",!0),!f.radio&&!f.checkbox?(T(),D(h,{key:1,style:ft("cursor: pointer;"+(f.disabled?"opacity: 0.2":""))},{default:_(()=>[B(ee(f.label),1)]),_:2},1032,["style"])):de("",!0)]),_:2},[f.icon?{name:"prepend",fn:_(()=>[w(c,{icon:f.icon,disabled:f.disabled},null,8,["icon","disabled"])]),key:"0"}:void 0]),1032,["disabled","data-test","onClick"])],16)]),_:2},1032,["disabled","text"]))],64))),256))]),_:1})]),_:1},8,["modelValue"])}}},Os={components:{TopBarMenu:Es},props:{menus:{type:Array,default:function(){return[]}},title:{type:String,default:""}},mounted(){document.title=this.title},methods:{subMenuClick(t){t.command(t),this.$refs.topmenu[0].isActive=!1}}},xs={class:"app-title mr-2"};function Rs(t,e,r,s,n,i){const o=E("v-col"),a=E("v-row"),c=E("TopBarMenu");return T(),D(Vt,{to:"#openc3-menu"},[w(a,{"no-gutters":""},{default:_(()=>[w(o,{"align-self":"end"},{default:_(()=>[V("span",xs,ee(r.title),1)]),_:1})]),_:1}),w(a,{dense:"",class:"flex-nowrap"},{default:_(()=>[(T(!0),Z(pe,null,Oe(r.menus,(d,u)=>(T(),D(c,{key:u+"-top-menu",ref_for:!0,ref:"topmenu",menu:d,title:r.title,onSubmenuClick:i.subMenuClick},null,8,["menu","title","onSubmenuClick"]))),128))]),_:1})])}const Cs=Bt(Os,[["render",Rs],["__scopeId","data-v-f4fb184e"]]),ks="__default",As={data:{dontSaveDefaultConfig:!1},created:function(){if(!this.configKey)throw alert("Components using the Config mixin must provide a configKey"),new Error("Components using the Config mixin must provide a configKey")},computed:{storageKey(){return`${this.configKey}${ks}`}},methods:{loadDefaultConfig:function(){const t=localStorage.getItem(this.storageKey);return t?JSON.parse(t):{}},saveDefaultConfig:function(t){this.dontSaveDefaultConfig||localStorage.setItem(this.storageKey,JSON.stringify(t))},openConfigBase:function(t,e=!1,r=null){new dt().load_config(this.configKey,t).then(s=>{s?(this.$notify.normal({title:"Loading configuration",body:t}),r&&r(JSON.parse(s)),e||this.$route.fullPath.includes(t)||this.$router.push({query:{config:t}})):this.$notify.caution({title:"Unknown configuration",body:t})}).catch(s=>{s&&this.$notify.serious({title:`Error opening configuration: ${t}`,body:s})})},saveConfigBase:function(t,e){new dt().save_config(this.configKey,t,JSON.stringify(e)).then(()=>{this.$notify.normal({title:"Saved configuration",body:t})}).catch(r=>{r&&this.$notify.serious({title:`Error saving configuration: ${t}`,body:r})})},resetConfigBase:function(){localStorage.removeItem(this.storageKey);const t={...this.$route.query};delete t.config,this.$router.replace({query:t})}}};function Yt(t,e){return function(){return t.apply(e,arguments)}}const{toString:Ps}=Object.prototype,{getPrototypeOf:he}=Object,{iterator:Te,toStringTag:Zt}=Symbol,Ie=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Gt=t=>typeof t=="string"&&(t==="__proto__"||t==="constructor"||t==="prototype"),Xt=(t,e,r)=>t===Object.prototype||!r&&e===null,Ts=t=>{if(!Object.isExtensible(t))return!1;const e=Object.getOwnPropertyNames(t);return Object.getOwnPropertySymbols&&e.push(...Object.getOwnPropertySymbols(t)),e.every(r=>{if(Gt(r))return!1;const s=Object.getOwnPropertyDescriptor(t,r);return!!s&&s.configurable&&s.writable===!0})},Le=(t,e)=>{let r=t;const s=[];for(;r!=null;){if(s.indexOf(r)!==-1)return!1;s.push(r);const n=he(r);if(Xt(r,n,r===t))return!1;if(Ie(r,e))return!0;r=n}return!1},Is=(t,e)=>t!=null&&Le(t,e)?t[e]:void 0,Ls=t=>{if(t==null||typeof t!="object"&&typeof t!="function")return t;const e=he(t);if(e===null&&Ts(t))return t;const r=Object.create(null),s=Object.create(null),n=[];let i=t;for(;i!=null&&n.indexOf(i)===-1;){n.push(i);const o=i===t?e:he(i);if(Xt(i,o,i===t))break;const a=Object.getOwnPropertyNames(i);Object.getOwnPropertySymbols&&a.push(...Object.getOwnPropertySymbols(i));for(const c of a)Gt(c)||Ie(s,c)||(r[c]=t[c],s[c]=!0);i=o}return r},mt=(t=>e=>{const r=Ps.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),G=t=>(t=t.toLowerCase(),e=>mt(e)===t),Ye=t=>e=>typeof e===t,{isArray:me}=Array,ge=Ye("undefined");function xe(t){return t!==null&&!ge(t)&&t.constructor!==null&&!ge(t.constructor)&&K(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Qt=G("ArrayBuffer");function js(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Qt(t.buffer),e}const Ns=Ye("string"),K=Ye("function"),er=Ye("number"),Re=t=>t!==null&&typeof t=="object",Ds=t=>t===!0||t===!1,Ze=t=>{if(!Re(t))return!1;const e=he(t);return(e===null||e===Object.prototype||he(e)===null)&&!Le(t,Zt)&&!Le(t,Te)},Us=t=>{if(!Re(t)||xe(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Fs=G("Date"),Bs=G("File"),$s=t=>!!(t&&typeof t.uri<"u"),qs=t=>t&&typeof t.getParts<"u",Vs=G("Blob"),Ms=G("FileList"),zs=G("Set"),Ws=t=>Re(t)&&K(t.pipe);function Js(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const tr=Js(),rr=typeof tr.FormData<"u"?tr.FormData:void 0,Hs=t=>{if(!t)return!1;if(rr&&t instanceof rr)return!0;const e=he(t);if(!e||e===Object.prototype||!K(t.append))return!1;const r=mt(t);return r==="formdata"||r==="object"&&K(t.toString)&&t.toString()==="[object FormData]"},Ks=G("URLSearchParams"),[Ys,Zs,Gs,Xs]=["ReadableStream","Request","Response","Headers"].map(G),Qs=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function je(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let s,n;if(typeof t!="object"&&(t=[t]),me(t))for(s=0,n=t.length;s<n;s++)e.call(null,t[s],s,t);else{if(xe(t))return;const i=r?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let a;for(s=0;s<o;s++)a=i[s],e.call(null,t[a],a,t)}}function sr(t,e){if(xe(t))return null;e=e.toLowerCase();const r=Object.keys(t);let s=r.length,n;for(;s-- >0;)if(n=r[s],e===n.toLowerCase())return n;return null}const be=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nr=t=>!ge(t)&&t!==be;function gt(...t){const{caseless:e,skipUndefined:r}=nr(this)&&this||{},s={},n=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=e&&typeof o=="string"&&sr(s,o)||o,c=Ie(s,a)?s[a]:void 0;Ze(c)&&Ze(i)?s[a]=gt(c,i):Ze(i)?s[a]=gt({},i):me(i)?s[a]=i.slice():(!r||!ge(i))&&(s[a]=i)};for(let i=0,o=t.length;i<o;i++){const a=t[i];if(!a||xe(a)||(je(a,n),typeof a!="object"||me(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];hn.call(a,u)&&n(a[u],u)}}return s}const en=(t,e,r,{allOwnKeys:s}={})=>(je(e,(n,i)=>{r&&K(n)?Object.defineProperty(t,i,{__proto__:null,value:Yt(n,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,i,{__proto__:null,value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),t),tn=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rn=(t,e,r,s)=>{t.prototype=Object.create(e.prototype,s),Object.defineProperty(t.prototype,"constructor",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{__proto__:null,value:e.prototype}),r&&Object.assign(t.prototype,r)},sn=(t,e,r,s)=>{let n,i,o;const a={};if(e=e||{},t==null)return e;do{for(n=Object.getOwnPropertyNames(t),i=n.length;i-- >0;)o=n[i],(!s||s(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&he(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},nn=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const s=t.indexOf(e,r);return s!==-1&&s===r},on=t=>{if(!t)return null;if(me(t))return t;let e=t.length;if(!er(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},an=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&he(Uint8Array)),cn=(t,e)=>{const r=(t&&t[Te]).call(t);let s;for(;(s=r.next())&&!s.done;){const n=s.value;e.call(t,n[0],n[1])}},ln=(t,e)=>{let r;const s=[];for(;(r=t.exec(e))!==null;)s.push(r);return s},un=G("HTMLFormElement"),dn=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:hn}=Object.prototype,fn=G("RegExp"),ir=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),s={};je(r,(n,i)=>{let o;(o=e(n,i,t))!==!1&&(s[i]=o||n)}),Object.defineProperties(t,s)},pn=t=>{ir(t,(e,r)=>{if(K(t)&&["arguments","caller","callee"].includes(r))return!1;const s=t[r];if(K(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},mn=(t,e)=>{const r={},s=n=>{n.forEach(i=>{r[i]=!0})};return me(t)?s(t):s(String(t).split(e)),r},gn=()=>{},bn=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function _n(t){return!!(t&&K(t.append)&&t[Zt]==="FormData"&&t[Te])}const yn=t=>{const e=new WeakSet,r=s=>{if(Re(s)){if(e.has(s))return;if(xe(s))return s;if(!("toJSON"in s)){e.add(s);let n;if(zs(s)){n=[];for(const i of s){const o=r(i);!ge(o)&&n.push(o)}}else n=me(s)?[]:{},je(s,(i,o)=>{const a=r(i);!ge(a)&&(n[o]=a)});return e.delete(s),n}}return s};return r(t)},wn=G("AsyncFunction"),vn=t=>t&&(Re(t)||K(t))&&K(t.then)&&K(t.catch),or=((t,e)=>t?setImmediate:e?((r,s)=>(be.addEventListener("message",({source:n,data:i})=>{n===be&&i===r&&s.length&&s.shift()()},!1),n=>{s.push(n),be.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",K(be.postMessage)),Sn=typeof queueMicrotask<"u"?queueMicrotask.bind(be):typeof process<"u"&&process.nextTick||or,ar=t=>t!=null&&K(t[Te]),En=t=>t!=null&&Le(t,Te)&&ar(t),l={isArray:me,isArrayBuffer:Qt,isBuffer:xe,isFormData:Hs,isArrayBufferView:js,isString:Ns,isNumber:er,isBoolean:Ds,isObject:Re,isPlainObject:Ze,isEmptyObject:Us,isReadableStream:Ys,isRequest:Zs,isResponse:Gs,isHeaders:Xs,isUndefined:ge,isDate:Fs,isFile:Bs,isReactNativeBlob:$s,isReactNative:qs,isBlob:Vs,isRegExp:fn,isFunction:K,isStream:Ws,isURLSearchParams:Ks,isTypedArray:an,isFileList:Ms,forEach:je,merge:gt,extend:en,trim:Qs,stripBOM:tn,inherits:rn,toFlatObject:sn,kindOf:mt,kindOfTest:G,endsWith:nn,toArray:on,forEachEntry:cn,matchAll:ln,isHTMLForm:un,hasOwnProperty:Ie,hasOwnProp:Ie,hasOwnInPrototypeChain:Le,getSafeProp:Is,toSafeFlatObject:Ls,reduceDescriptors:ir,freezeMethods:pn,toObjectSet:mn,toCamelCase:dn,noop:gn,toFiniteNumber:bn,findKey:sr,global:be,isContextDefined:nr,isSpecCompliantForm:_n,toJSONObject:yn,isAsyncFn:wn,isThenable:vn,setImmediate:or,asap:Sn,isIterable:ar,isSafeIterable:En},On=l.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),xn=t=>{const e={};let r,s,n;return t&&t.split(`
3
- `).forEach(function(i){n=i.indexOf(":"),r=i.substring(0,n).trim().toLowerCase(),s=i.substring(n+1).trim();const o=l.hasOwnProp(e,r);!r||o&&l.hasOwnProp(On,r)||(r==="set-cookie"?o?e[r].push(s):e[r]=[s]:e[r]=o?e[r]+", "+s:s)}),e};function Rn(t){let e=0,r=t.length;for(;e<r;){const s=t.charCodeAt(e);if(s!==9&&s!==32)break;e+=1}for(;r>e;){const s=t.charCodeAt(r-1);if(s!==9&&s!==32)break;r-=1}return e===0&&r===t.length?t:t.slice(e,r)}const Cn=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),kn=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function bt(t,e){return l.isArray(t)?t.map(r=>bt(r,e)):Rn(String(t).replace(e,""))}const An=t=>bt(t,Cn),Pn=t=>bt(t,kn);function cr(t){const e=Object.create(null);return l.forEach(t.toJSON(),(r,s)=>{e[s]=Pn(r)}),e}const lr=Symbol("internals");function Ne(t){return t&&String(t).trim().toLowerCase()}function Ge(t){return t===!1||t==null?t:l.isArray(t)?t.map(Ge):An(String(t))}function Tn(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=r.exec(t);)e[s[1]]=s[2];return e}const In=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function _t(t){let e=0,r=t.length;for(;e<r;){const s=t.charCodeAt(e);if(s!==9&&s!==32)break;e+=1}for(;r>e;){const s=t.charCodeAt(r-1);if(s!==9&&s!==32)break;r-=1}return e===0&&r===t.length?t:t.slice(e,r)}function Ln(t){const e=t.length-1;if(e<1||t.charCodeAt(0)!==34||t.charCodeAt(e)!==34)return t;let r="";for(let s=1;s<e;s++){const n=t.charCodeAt(s);if(n===34||n===92&&(s+=1,s>=e))return t;r+=t[s]}return r}function jn(t){const e=Object.create(null),r=String(t);let s=0,n=!1,i=!1;function o(a){const c=_t(r.slice(s,a)),d=c.indexOf("=");if(d<1)return;const u=_t(c.slice(0,d));if(!In.test(u))return;const h=u.toLowerCase();if(h==="__proto__"||h==="constructor"||h==="prototype")return;const p=_t(c.slice(d+1));e[h]=Ln(p)}for(let a=0;a<r.length;a++){const c=r.charCodeAt(a);n?i?i=!1:c===92?i=!0:c===34&&(n=!1):c===34?n=!0:(c===44||c===59)&&(o(a),s=a+1)}return o(r.length),e}const Nn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function yt(t,e,r,s,n){if(l.isFunction(s))return s.call(this,e,r);if(n&&(e=r),!!l.isString(e)){if(l.isString(s))return e.indexOf(s)!==-1;if(l.isRegExp(s))return s.test(e)}}function Dn(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,s)=>r.toUpperCase()+s)}function Un(t,e){const r=l.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(t,s+r,{__proto__:null,value:function(n,i,o){return this[s].call(this,e,n,i,o)},configurable:!0})})}let M=class{constructor(t){t&&this.set(t)}set(t,e,r){const s=this;function n(o,a,c){const d=Ne(a);if(!d)return;const u=l.findKey(s,d);(!u||s[u]===void 0||c===!0||c===void 0&&s[u]!==!1)&&(s[u||a]=Ge(o))}const i=(o,a)=>l.forEach(o,(c,d)=>n(c,d,a));if(l.isPlainObject(t)||t instanceof this.constructor)i(t,e);else if(l.isString(t)&&(t=t.trim())&&!Nn(t))i(xn(t),e);else if(l.isObject(t)&&l.isSafeIterable(t)){let o=Object.create(null),a,c;for(const d of t){if(!l.isArray(d))throw new TypeError("Object iterator must return a key-value pair");c=d[0],l.hasOwnProp(o,c)?(a=o[c],o[c]=l.isArray(a)?[...a,d[1]]:[a,d[1]]):o[c]=d[1]}i(o,e)}else t!=null&&n(e,t,r);return this}get(t,e){if(t=Ne(t),t){const r=l.findKey(this,t);if(r){const s=this[r];if(!e)return s;if(e===!0)return Tn(s);if(l.isFunction(e))return e.call(this,s,r);if(l.isRegExp(e))return e.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=Ne(t),t){const r=l.findKey(this,t);return!!(r&&this[r]!==void 0&&(!e||yt(this,this[r],r,e)))}return!1}delete(t,e){const r=this;let s=!1;function n(i){if(i=Ne(i),i){const o=l.findKey(r,i);o&&(!e||yt(r,r[o],o,e))&&(delete r[o],s=!0)}}return l.isArray(t)?t.forEach(n):n(t),s}clear(t){const e=Object.keys(this);let r=e.length,s=!1;for(;r--;){const n=e[r];(!t||yt(this,this[n],n,t,!0))&&(delete this[n],s=!0)}return s}normalize(t){const e=this,r={};return l.forEach(this,(s,n)=>{const i=l.findKey(r,n);if(i){e[i]=Ge(s),delete e[n];return}const o=t?Dn(n):String(n).trim();o!==n&&delete e[n],e[o]=Ge(s),r[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return l.forEach(this,(r,s)=>{r!=null&&r!==!1&&(e[s]=t&&l.isArray(r)?r.join(", "):r)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(`
4
- `)}getSetCookie(){const t=this.get("set-cookie");return l.isArray(t)?t:t==null||t===!1?[]:[t]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static parseParameters(t){return jn(t)}static concat(t,...e){const r=new this(t);return e.forEach(s=>r.set(s)),r}static accessor(t){const e=(this[lr]=this[lr]={accessors:{}}).accessors,r=this.prototype;function s(n){const i=Ne(n);e[i]||(Un(r,n),e[i]=!0)}return l.isArray(t)?t.forEach(s):s(t),this}};M.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),l.reduceDescriptors(M.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(s){this[r]=s}}}),l.freezeMethods(M);const Xe="[REDACTED ****]";function Fn(t){if(l.hasOwnProp(t,"toJSON"))return!0;let e=Object.getPrototypeOf(t);for(;e&&e!==Object.prototype;){if(l.hasOwnProp(e,"toJSON"))return!0;e=Object.getPrototypeOf(e)}return!1}function Bn(t,e){const r=new Set(e.map(i=>String(i).toLowerCase())),s=[],n=i=>{if(i===null||typeof i!="object"||l.isBuffer(i))return i;if(s.indexOf(i)!==-1)return;i instanceof M&&(i=i.toJSON()),s.push(i);let o;if(l.isArray(i))o=[],i.forEach((a,c)=>{const d=n(a);l.isUndefined(d)||(o[c]=d)});else{if(!l.isPlainObject(i)&&Fn(i))return s.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=r.has(a.toLowerCase())?Xe:n(c);l.isUndefined(d)||(o[a]=d)}}return s.pop(),o};return n(t)}function ur(t){try{return String(t)}catch{return""}}function $n(t){return t.errors.map(e=>{try{return e&&e.message?ur(e.message):ur(e)}catch{return""}}).filter(Boolean).join("; ")||t.name||"AggregateError"}let m=class ws extends Error{static from(e,r,s,n,i,o){let a=e.message;!a&&l.isArray(e.errors)&&e.errors.length&&(a=$n(e));const c=new ws(a,r||e.code,s,n,i);return Object.defineProperty(c,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),c.name=e.name,e.status!=null&&c.status==null&&(c.status=e.status),o&&Object.assign(c,o),c}constructor(e,r,s,n,i){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),s&&(this.config=s),n&&(this.request=n),i&&(this.response=i,this.status=i.status)}toJSON(){const e=this.config,r=e&&l.hasOwnProp(e,"redact")?e.redact:void 0,s=l.isArray(r)&&r.length>0?Bn(e,r):l.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:s,code:this.code,status:this.status}}};m.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",m.ERR_BAD_OPTION="ERR_BAD_OPTION",m.ECONNABORTED="ECONNABORTED",m.ETIMEDOUT="ETIMEDOUT",m.ECONNREFUSED="ECONNREFUSED",m.ERR_NETWORK="ERR_NETWORK",m.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",m.ERR_DEPRECATED="ERR_DEPRECATED",m.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",m.ERR_BAD_REQUEST="ERR_BAD_REQUEST",m.ERR_CANCELED="ERR_CANCELED",m.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",m.ERR_INVALID_URL="ERR_INVALID_URL",m.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const qn=null,dr=100;function wt(t){return l.isPlainObject(t)||l.isArray(t)}function hr(t){return l.endsWith(t,"[]")?t.slice(0,-2):t}function vt(t,e,r){return t?t.concat(e).map(function(s,n){return s=hr(s),!r&&n?"["+s+"]":s}).join(r?".":""):e}function Vn(t){return l.isArray(t)&&!t.some(wt)}const Mn=l.toFlatObject(l,{},null,function(t){return/^is[A-Z]/.test(t)});function Qe(t,e,r){if(!l.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const s=(g,b)=>{const f=l.getSafeProp(r,g);return l.isUndefined(f)?b:f},n=s("metaTokens",!0),i=s("visitor")||P,o=s("dots",!1),a=s("indexes",!1),c=s("Blob")||typeof Blob<"u"&&Blob,d=s("maxDepth",dr),u=c&&l.isSpecCompliantForm(e),h=[];if(!l.isFunction(i))throw new TypeError("visitor must be a function");function p(g){if(g===null)return"";if(l.isDate(g))return g.toISOString();if(l.isBoolean(g))return g.toString();if(!u&&l.isBlob(g))throw new m("Blob is not supported. Use a Buffer instead.");if(l.isArrayBuffer(g)||l.isTypedArray(g)){if(u&&typeof c=="function")return new c([g]);throw new m("Blob is not supported. Use a Buffer instead.",m.ERR_NOT_SUPPORT)}return g}function y(g){if(g>d)throw new m("Object is too deeply nested ("+g+" levels). Max depth: "+d,m.ERR_FORM_DATA_DEPTH_EXCEEDED)}function C(g,b){if(d===1/0)return JSON.stringify(g);const f=[];return JSON.stringify(g,function(I,R){if(!l.isObject(R))return R;for(;f.length&&f[f.length-1]!==this;)f.pop();return f.push(R),y(b+f.length-1),R})}function P(g,b,f){let I=g;if(l.isReactNative(e)&&l.isReactNativeBlob(g))return e.append(vt(f,b,o),p(g)),!1;if(g&&!f&&typeof g=="object"){if(l.endsWith(b,"{}"))b=n?b:b.slice(0,-2),g=C(g,1);else if(l.isArray(g)&&Vn(g)||(l.isFileList(g)||l.endsWith(b,"[]"))&&(I=l.toArray(g)))return b=hr(b),I.forEach(function(R,H){!(l.isUndefined(R)||R===null)&&e.append(a===!0?vt([b],H,o):a===null?b:b+"[]",p(R))}),!1}return wt(g)?!0:(e.append(vt(f,b,o),p(g)),!1)}const v=Object.assign(Mn,{defaultVisitor:P,convertValue:p,isVisitable:wt});function S(g,b,f=0){if(!l.isUndefined(g)){if(y(f),h.indexOf(g)!==-1)throw new Error("Circular reference detected in "+b.join("."));h.push(g),l.forEach(g,function(I,R){(!(l.isUndefined(I)||I===null)&&i.call(e,I,l.isString(R)?R.trim():R,b,v))===!0&&S(I,b?b.concat(R):[R],f+1)}),h.pop()}}if(!l.isObject(t))throw new TypeError("data must be an object");return S(t),e}function fr(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(t).replace(/[!'()~]|%20/g,function(r){return e[r]})}function St(t,e){this._pairs=[],t&&Qe(t,this,e)}const pr=St.prototype;pr.append=function(t,e){this._pairs.push([t,e])},pr.toString=function(t){const e=t?r=>t.call(this,r,fr):fr;return this._pairs.map(function(r){return e(r[0])+"="+e(r[1])},"").join("&")};function zn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function mr(t,e,r){if(!e)return t;t=t||"";const s=l.isFunction(r)?{serialize:r}:r,n=l.getSafeProp(s,"encode")||zn,i=l.getSafeProp(s,"serialize");let o;if(i?o=i(e,s):o=l.isURLSearchParams(e)?e.toString():new St(e,s).toString(n),o){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}const De=Symbol("internals");function gr(t){return t?t.length:0}function br(t){if(t)for(;t.length&&t[t.length-1]===null;)t.pop()}function Ue(t,e){const r=t.handlers,s=gr(r);r!==e.handlersRef?(e.handlersRef=r,e.handlerEntries.clear()):s!==e.handlersLength&&(s?e.handlerEntries.forEach(function(n,i){r[n.index]!==n.handler&&e.handlerEntries.delete(i)}):e.handlerEntries.clear()),e.handlersLength=s}class _r{constructor(){this.handlers=[],this[De]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(e,r,s){const n={fulfilled:e,rejected:r,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null},i=this[De];this.handlers==null&&(this.handlers=[]),Ue(this,i);const o=i.nextId++;return this.handlers.push(n),i.handlerEntries.set(o,{handler:n,index:this.handlers.length-1}),i.handlersLength=this.handlers.length,o}eject(e){const r=this[De];Ue(this,r);const s=r.handlerEntries.get(e);if(s){if(r.handlerEntries.delete(e),this.handlers[s.index]!==s.handler)return;this.handlers[s.index]=null,r.iterationDepth||(br(this.handlers),r.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],Ue(this,this[De]))}forEach(e){const r=this[De];Ue(this,r),r.iterationDepth++;try{l.forEach(this.handlers,function(s){s!==null&&e(s)})}finally{--r.iterationDepth||(Ue(this,r),br(this.handlers),r.handlersLength=gr(this.handlers))}}}const Et={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Wn=typeof URLSearchParams<"u"?URLSearchParams:St,Jn=typeof FormData<"u"?FormData:null,Hn=typeof Blob<"u"?Blob:null,Kn={isBrowser:!0,classes:{URLSearchParams:Wn,FormData:Jn,Blob:Hn},protocols:["http","https","file","blob","url","data"]},Ot=typeof window<"u"&&typeof document<"u",xt=typeof navigator=="object"&&navigator||void 0,Yn=Ot&&(!xt||["ReactNative","NativeScript","NS"].indexOf(xt.product)<0),Zn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Gn=Ot&&window.location.href||"http://localhost",Xn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ot,hasStandardBrowserEnv:Yn,hasStandardBrowserWebWorkerEnv:Zn,navigator:xt,origin:Gn},Symbol.toStringTag,{value:"Module"})),$={...Xn,...Kn};function Qn(t,e){return Qe(t,new $.classes.URLSearchParams,{visitor:function(r,s,n,i){return $.isNode&&l.isBuffer(r)?(this.append(s,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}const yr=dr;function wr(t){if(t>yr)throw new m("FormData field is too deeply nested ("+t+" levels). Max depth: "+yr,m.ERR_FORM_DATA_DEPTH_EXCEEDED)}function ei(t){const e=[],r=/[^.[\]]+|\[([^.[\]]*)]/g;let s;for(;(s=r.exec(t))!==null;)wr(e.length),e.push(s[0]==="[]"?"":s[1]||s[0]);return e}function ti(t){const e={},r=Object.keys(t);let s;const n=r.length;let i;for(s=0;s<n;s++)i=r[s],e[i]=t[i];return e}function vr(t){function e(r,s,n,i){wr(i);let o=r[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=r.length;return o=!o&&l.isArray(n)?n.length:o,c?(l.hasOwnProp(n,o)?n[o]=l.isArray(n[o])?n[o].concat(s):[n[o],s]:n[o]=s,!a):((!l.hasOwnProp(n,o)||!l.isObject(n[o]))&&(n[o]=[]),e(r,s,n[o],i)&&l.isArray(n[o])&&(n[o]=ti(n[o])),!a)}if(l.isFormData(t)&&l.isFunction(t.entries)){const r={};return l.forEachEntry(t,(s,n)=>{e(ei(s),n,r,0)}),r}return null}const Sr=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),Ce=(t,e)=>t!=null&&l.hasOwnProp(t,e)?t[e]:void 0;function ri(t,e,r){if(l.isString(t))try{return(e||JSON.parse)(t),l.trim(t)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(t)}const Fe={transitional:Et,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const r=e.getContentType()||"",s=r.indexOf("application/json")>-1,n=l.isObject(t);if(n&&l.isHTMLForm(t)&&(t=new FormData(t)),l.isFormData(t))return s?JSON.stringify(vr(t)):t;if(l.isArrayBuffer(t)||l.isBuffer(t)||l.isStream(t)||l.isFile(t)||l.isBlob(t)||l.isReadableStream(t))return t;if(l.isArrayBufferView(t))return t.buffer;if(l.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let i;if(n){const o=Ce(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Qn(t,o).toString();if((i=l.isFileList(t))||r.indexOf("multipart/form-data")>-1){const a=Ce(this,"env"),c=a&&a.FormData;return Qe(i?{"files[]":t}:t,c&&new c,o)}}return n||s?(e.setContentType("application/json",!1),ri(t)):t}],transformResponse:[function(t){const e=Ce(this,"transitional")||Fe.transitional,r=e&&e.forcedJSONParsing,s=Ce(this,"responseType"),n=s==="json";if(l.isResponse(t)||l.isReadableStream(t))return t;if(t&&l.isString(t)&&(r&&!s||n)){const i=!(e&&e.silentJSONParsing)&&n;try{return JSON.parse(t,Ce(this,"parseReviver"))}catch(o){if(i)throw o.name==="SyntaxError"?m.from(o,m.ERR_BAD_RESPONSE,this,null,Ce(this,"response")):o}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$.classes.FormData,Blob:$.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};l.forEach(Sr,t=>{Fe.headers[t]={}});function Rt(t,e){const r=this||Fe,s=e||r,n=M.from(s.headers);let i=s.data;return l.forEach(t,function(o){i=o.call(r,i,n.normalize(),e?e.status:void 0)}),n.normalize(),i}function Er(t){return!!(t&&t.__CANCEL__)}let Be=class extends m{constructor(t,e,r){super(t??"canceled",m.ERR_CANCELED,e,r),this.name="CanceledError",this.__CANCEL__=!0}};function Or(t,e,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?t(r):e(new m("Request failed with status code "+r.status,r.status>=400&&r.status<500?m.ERR_BAD_REQUEST:m.ERR_BAD_RESPONSE,r.config,r.request,r))}const si=/[\t\n\r]/g;function xr(t){if(typeof t!="string")return t;let e=0;for(;e<t.length&&t.charCodeAt(e)<=32;)e++;return t.slice(e).replace(si,"")}function Ct(t){const e=/^([-+\w]{1,25}):(?:\/\/)?/.exec(t);return e&&e[1]||""}function ni(t,e){t=t||10;const r=new Array(t),s=new Array(t);let n=0,i=0,o;return e=e!==void 0?e:1e3,function(a){const c=Date.now(),d=s[i];o||(o=c),r[n]=a,s[n]=c;let u=i,h=0;for(;u!==n;)h+=r[u++],u=u%t;if(n=(n+1)%t,n===i&&(i=(i+1)%t),c-o<e)return;const p=d&&c-d;return p?Math.round(h*1e3/p):void 0}}function ii(t,e){let r=0,s=1e3/e,n,i;const o=(a,c=Date.now())=>{r=c,n=null,i&&(clearTimeout(i),i=null),t(...a)};return[(...a)=>{const c=Date.now(),d=c-r;d>=s?o(a,c):(n=a,i||(i=setTimeout(()=>{i=null,o(n)},s-d)))},()=>n&&o(n),(...a)=>o(a)]}const et=(t,e,r=3)=>{let s=0;const n=ni(50,250);return ii(i=>{if(!i||!l.isNumber(i.loaded))return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=Math.max(0,a!=null?Math.min(o,a):o),d=Math.max(0,c-s),u=n(d);s=Math.max(s,c);const h={loaded:c,total:a,progress:a?c/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(h)},r)},Rr=(t,e)=>{const r=t!=null;return[s=>e[0]({lengthComputable:r,total:t,loaded:s}),e[1]]},Cr=(t,e=l.asap)=>(...r)=>e(()=>t(...r)),oi=$.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,$.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL($.origin),$.navigator&&/(msie|trident)/i.test($.navigator.userAgent)):()=>!0,ai=$.hasStandardBrowserEnv?{write(t,e,r,s,n,i,o){if(typeof document>"u")return;const a=[`${t}=${encodeURIComponent(e)}`];l.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),l.isString(s)&&a.push(`path=${s}`),l.isString(n)&&a.push(`domain=${n}`),i===!0&&a.push("secure"),l.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.split(";");for(let r=0;r<e.length;r++){const s=e[r].replace(/^\s+/,""),n=s.indexOf("=");if(n!==-1&&s.slice(0,n)===t)try{return decodeURIComponent(s.slice(n+1))}catch{return s.slice(n+1)}}return null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function ci(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function li(t,e){if(!e)return t;let r=t.length;for(;r>0&&t.charCodeAt(r-1)===47;)r--;return t.slice(0,r)+"/"+e.replace(/^\/+/,"")}const ui=/^https?:(?!\/\/)/i;function di(t){return t&&t.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,r,s="")=>`${r}${s}${Xe}`)}function hi(t){const e=t.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${Xe}@`),r=e.indexOf("#"),s=(r===-1?e:e.slice(0,r)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${Xe}`);return r===-1?s:`${s}#${di(e.slice(r+1))}`}function kr(t,e){if(typeof t=="string"){const r=xr(t);if(ui.test(r))throw new m(`Invalid URL ${JSON.stringify(hi(r))}: missing "//" after protocol`,m.ERR_INVALID_URL,e)}}function Ar(t,e,r,s){kr(e,s);let n=!ci(e);return t&&(n||r===!1)?(kr(t,s),li(t,e)):e}const Pr=t=>t instanceof M?{...t}:t,fi=t=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(t).concat(Object.getOwnPropertySymbols(t).filter(e=>Object.getOwnPropertyDescriptor(t,e).enumerable)):Object.keys(t);function _e(t,e){t=t||{},e=e||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function s(u,h,p,y){return l.isPlainObject(u)&&l.isPlainObject(h)?l.merge.call({caseless:y},u,h):l.isPlainObject(h)?l.merge({},h):l.isArray(h)?h.slice():h}function n(u,h,p,y){if(l.isUndefined(h)){if(!l.isUndefined(u))return s(void 0,u,p,y)}else return s(u,h,p,y)}function i(u,h){if(!l.isUndefined(h))return s(void 0,h)}function o(u,h){if(l.isUndefined(h)){if(!l.isUndefined(u))return s(void 0,u)}else return s(void 0,h)}function a(u){const h=l.hasOwnProp(e,"transitional")?e.transitional:void 0;if(!l.isUndefined(h))if(l.isPlainObject(h)){if(l.hasOwnProp(h,u))return h[u]}else return;const p=l.hasOwnProp(t,"transitional")?t.transitional:void 0;if(l.isPlainObject(p)&&l.hasOwnProp(p,u))return p[u]}function c(u,h,p){if(l.hasOwnProp(e,p))return s(u,h);if(l.hasOwnProp(t,p))return s(void 0,u)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutErrorMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:c,headers:(u,h,p)=>n(Pr(u),Pr(h),p,!0)};return l.forEach(fi({...t,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const h=l.hasOwnProp(d,u)?d[u]:n,p=l.hasOwnProp(t,u)?t[u]:void 0,y=l.hasOwnProp(e,u)?e[u]:void 0,C=h(p,y,u);l.isUndefined(C)&&h!==c||(r[u]=C)}),l.hasOwnProp(e,"validateStatus")&&l.isUndefined(e.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(l.hasOwnProp(t,"validateStatus")?r.validateStatus=s(void 0,t.validateStatus):delete r.validateStatus),r}const pi=["content-type","content-length"];function mi(t,e,r){if(r!=="content-only"){t.set(e);return}Object.entries(e||{}).forEach(([s,n])=>{pi.includes(s.toLowerCase())&&t.set(s,n)})}const gi=t=>encodeURIComponent(t).replace(/%([0-9A-F]{2})/gi,(e,r)=>String.fromCharCode(parseInt(r,16)));function Tr(t){const e=_e({},t),r=p=>l.hasOwnProp(e,p)?e[p]:void 0,s=r("data");let n=r("withXSRFToken");const i=r("xsrfHeaderName"),o=r("xsrfCookieName");let a=r("headers");const c=r("auth"),d=r("baseURL"),u=r("allowAbsoluteUrls"),h=r("url");if(e.headers=a=M.from(a),e.url=mr(Ar(d,h,u,e),r("params"),r("paramsSerializer")),c){const p=l.getSafeProp(c,"username")||"",y=l.getSafeProp(c,"password")||"";try{a.set("Authorization","Basic "+btoa(p+":"+(y?gi(y):"")))}catch(C){throw m.from(C,m.ERR_BAD_OPTION_VALUE,t)}}if(l.isFormData(s)){const p=l.getSafeProp(s,"getHeaders");$.hasStandardBrowserEnv||$.hasStandardBrowserWebWorkerEnv||l.isReactNative(s)?a.setContentType(void 0):l.isFunction(p)&&mi(a,p.call(s),r("formDataHeaderPolicy"))}if($.hasStandardBrowserEnv&&(l.isFunction(n)&&(n=n(e)),n===!0||n==null&&oi(e.url))){const p=i&&o&&ai.read(o);p&&a.set(i,p)}return e}const bi=typeof XMLHttpRequest<"u",_i=bi&&function(t){return new Promise(function(e,r){const s=Tr(t);let n=s.data;const i=M.from(s.headers).normalize();let{responseType:o,onUploadProgress:a,onDownloadProgress:c}=s,d,u,h,p,y,C;function P(){p&&p(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let v=new XMLHttpRequest;v.open(s.method.toUpperCase(),s.url,!0),v.timeout=s.timeout;function S(b){if(!v)return;if(v.status===0&&(Ct(xr(s.url))||Ct($.origin))!=="file"&&!(v.responseURL&&v.responseURL.startsWith("file:"))){r(new m("Request aborted",m.ECONNABORTED,t,v)),P(),v=null;return}try{b?C&&C(b):y&&y()}catch(R){setTimeout(()=>{throw R})}if(!v)return;const f=M.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),I={data:!o||o==="text"||o==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:f,config:t,request:v};Or(function(R){e(R),P()},function(R){r(R),P()},I),v=null}"onloadend"in v?v.onloadend=S:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.startsWith("file:"))||setTimeout(S)},v.onabort=function(){v&&(r(new m("Request aborted",m.ECONNABORTED,t,v)),P(),v=null)},v.onerror=function(b){const f=b&&b.message?b.message:"Network Error",I=new m(f,m.ERR_NETWORK,t,v);I.event=b||null,r(I),P(),v=null},v.ontimeout=function(){let b=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const f=s.transitional||Et;s.timeoutErrorMessage&&(b=s.timeoutErrorMessage),r(new m(b,f.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,t,v)),P(),v=null},n===void 0&&i.setContentType(null),"setRequestHeader"in v&&l.forEach(cr(i),function(b,f){v.setRequestHeader(f,b)}),l.isUndefined(s.withCredentials)||(v.withCredentials=!!s.withCredentials),o&&o!=="json"&&(v.responseType=s.responseType),c&&([h,y,C]=et(c,!0),v.addEventListener("progress",h)),a&&v.upload&&([u,p]=et(a),v.upload.addEventListener("progress",u),v.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(d=b=>{v&&(r(!b||b.type?new Be(null,t,v):b),v.abort(),P(),v=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const g=Ct(s.url);if(g&&!$.protocols.includes(g)){r(new m("Unsupported protocol "+g+":",m.ERR_BAD_REQUEST,t)),P();return}v.send(n||null)})},yi=(t,e)=>{if(t=t?t.filter(Boolean):[],!e&&!t.length)return;const r=new AbortController;let s=!1;const n=function(c){if(!s){s=!0,o();const d=c instanceof Error?c:this.reason;r.abort(d instanceof m?d:new Be(d instanceof Error?d.message:d))}};let i=e&&setTimeout(()=>{i=null,n(new m(`timeout of ${e}ms exceeded`,m.ETIMEDOUT))},e);const o=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),t=null)};t.forEach(c=>{if(!s){if(c.aborted){n.call(c);return}c.addEventListener("abort",n,{once:!0})}});const{signal:a}=r;return a.unsubscribe=()=>l.asap(o),a},wi=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let s=0,n;for(;s<r;)n=s+e,yield t.slice(s,n),s=n},vi=async function*(t,e){for await(const r of Si(t))yield*wi(r,e)},Si=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:s}=await e.read();if(r)break;yield s}}finally{await e.cancel()}},Ir=(t,e,r,s)=>{const n=vi(t,e);let i=0,o,a=c=>{o||(o=!0,s&&s(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await n.next();if(d){a(),c.close();return}let h=u.byteLength;if(r){let p=i+=h;r(p)}c.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(c){return a(c),n.return()}},{highWaterMark:2})},Lr=t=>t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102,jr=(t,e,r)=>e+2<r&&Lr(t.charCodeAt(e+1))&&Lr(t.charCodeAt(e+2)),Nr=t=>t<=57?t-48:(t&223)-55,Ei=t=>t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===43||t===47||t===45||t===95,Oi=t=>t===9||t===10||t===12||t===13||t===32,xi=t=>{const e=Math.floor(t/4),r=t%4;return e*3+(r===2?1:r===3?2:0)},Ri=t=>{const e=t.length;let r=0;return e>0&&t.charCodeAt(e-1)===61&&(r++,e>1&&t.charCodeAt(e-2)===61&&r++),Math.floor((e-r)*3/4)},Ci=t=>{const e=t.length;let r=0,s=0,n=!1;for(let i=0;i<e;i++){let o=t.charCodeAt(i);if(o===37&&jr(t,i,e)&&(o=Nr(t.charCodeAt(i+1))*16+Nr(t.charCodeAt(i+2)),i+=2),!Oi(o)){if(o===61){s++;continue}if(!Ei(o)||s>0){n=!0;continue}r++}}return n||s>2||s>0&&(r+s)%4!==0||r%4===1?Ri(t):xi(r)},ki=(t,e)=>{if(!t||typeof t!="string"||!t.startsWith("data:"))return 0;const r=t.indexOf(",");if(r<0)return 0;const s=t.slice(5,r),n=t.slice(r+1);if(/;base64/i.test(s))return e(n);let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&jr(n,o,a))i+=1,o+=2;else if(c<128)i+=1;else if(c<2048)i+=2;else if(c>=55296&&c<=56319&&o+1<a){const d=n.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i};function Ai(t){const e=typeof t=="string"?t.indexOf("#"):-1;return ki(e===-1?t:t.slice(0,e),Ci)}const kt="1.20.0",Dr=64*1024,Pi={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:tt}=l,Ti=t=>encodeURIComponent(t).replace(/%([0-9A-F]{2})/gi,(e,r)=>String.fromCharCode(parseInt(r,16))),Ur=t=>{if(!l.isString(t))return t;try{return decodeURIComponent(t)}catch{return t}},Fr=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Ii=t=>{const e=t.indexOf("://");let r=t;return e!==-1&&(r=r.slice(e+3)),r.includes("@")||r.includes(":")},Li=t=>{const e=l.global!==void 0&&l.global!==null?l.global:globalThis,{ReadableStream:r,TextEncoder:s}=e;t=l.merge.call({skipUndefined:!0},{Request:e.Request,Response:e.Response},t);const{fetch:n,Request:i,Response:o}=t,a=n?tt(n):typeof fetch=="function",c=tt(i),d=tt(o);if(!a)return!1;const u=a&&tt(r),h=a&&(typeof s=="function"?(S=>g=>S.encode(g))(new s):async S=>new Uint8Array(await new i(S).arrayBuffer())),p=c&&u&&Fr(()=>{let S=!1;const g=new i($.origin,{body:new r,method:"POST",get duplex(){return S=!0,"half"}}),b=g.headers.has("Content-Type");return g.body!=null&&g.body.cancel(),S&&!b}),y=d&&u&&Fr(()=>l.isReadableStream(new o("").body)),C={stream:y&&(S=>S.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(S=>{!C[S]&&(C[S]=(g,b)=>{let f=g&&g[S];if(f)return f.call(g);throw new m(`Response type '${S}' is not supported`,m.ERR_NOT_SUPPORT,b)})});const P=async S=>{if(S==null)return 0;if(l.isBlob(S))return S.size;if(l.isSpecCompliantForm(S))return(await new i($.origin,{method:"POST",body:S}).arrayBuffer()).byteLength;if(l.isArrayBufferView(S)||l.isArrayBuffer(S))return S.byteLength;if(l.isURLSearchParams(S)&&(S=S+""),l.isString(S))return(await h(S)).byteLength},v=async(S,g)=>l.toFiniteNumber(S.getContentLength())??P(g);return async S=>{let{url:g,method:b,data:f,signal:I,cancelToken:R,timeout:H,onDownloadProgress:ie,onUploadProgress:k,responseType:j,headers:q,withCredentials:re="same-origin",fetchOptions:ae,maxContentLength:W,maxBodyLength:Ae,maxRedirects:X}=Tr(S);const O=l.isNumber(W)&&W>-1,N=l.isNumber(Ae)&&Ae>-1,se=L=>l.hasOwnProp(S,L)?S[L]:void 0;let oe=n||fetch;j=j?(j+"").toLowerCase():"text";let Y=yi([I,R&&R.toAbortSignal()],H),F=null;const Se=Y&&Y.unsubscribe&&(()=>{Y.unsubscribe()});let ze,We=null;const gs=()=>new m("Request body larger than maxBodyLength limit",m.ERR_BAD_REQUEST,S,F);try{let L;const Q=se("auth");if(Q){const x=l.getSafeProp(Q,"username")||"",J=l.getSafeProp(Q,"password")||"";L={username:x,password:J}}if(Ii(g)){const x=new URL(g,$.origin);if(!L&&(x.username||x.password)){const J=Ur(x.username),fe=Ur(x.password);L={username:J,password:fe}}(x.username||x.password)&&(x.username="",x.password="",g=x.href)}if(L&&(q.delete("authorization"),q.set("Authorization","Basic "+btoa(Ti((L.username||"")+":"+(L.password||""))))),O&&typeof g=="string"&&g.startsWith("data:")&&Ai(g)>W)throw new m("maxContentLength size of "+W+" exceeded",m.ERR_BAD_RESPONSE,S,F);if(N&&b!=="get"&&b!=="head"){const x=await P(f);if(typeof x=="number"&&isFinite(x)&&(ze=x,x>Ae))throw gs()}const ut=N&&(l.isReadableStream(f)||l.isStream(f)),bs=(x,J,fe)=>Ir(x,Dr,Ee=>{if(N&&Ee>Ae)throw We=gs();J&&J(Ee)},fe);if(p&&b!=="get"&&b!=="head"&&(k||ut)){if(ze=ze??await v(q,f),ze!==0||ut){let x=new i(g,{method:"POST",body:f,duplex:"half"}),J;if(l.isFormData(f)&&(J=x.headers.get("content-type"))&&q.setContentType(J),x.body){const[fe,Ee]=k&&Rr(ze,et(Cr(k)))||[];f=bs(x.body,fe,Ee)}}}else if(ut&&!c&&u&&b!=="get"&&b!=="head")f=bs(f);else if(ut&&c&&!p&&b!=="get"&&b!=="head")throw new m("Stream request bodies are not supported by the current fetch implementation",m.ERR_NOT_SUPPORT,S,F);l.isString(re)||(re=re?"include":"omit");const _a=c&&"credentials"in i.prototype;if(l.isFormData(f)){const x=q.getContentType();x&&/^multipart\/form-data/i.test(x)&&!/boundary=/i.test(x)&&q.delete("content-type")}q.set("User-Agent","axios/"+kt,!1);const ne=ae==null?ae:Object.assign(Object.create(null),ae);ne&&(delete ne.body,delete ne.headers,delete ne.method,delete ne.signal,delete ne.duplex,delete ne.credentials);const ce=Object.assign(Object.create(null),ne,{signal:Y,method:b.toUpperCase(),headers:cr(q.normalize()),body:f,duplex:"half",credentials:_a?re:void 0});c&&(l.forEach(Pi,(x,J)=>{ce[J]===void 0&&(ce[J]=x)}),ce.signal===void 0&&(ce.signal=null),ce.body===void 0&&(ce.body=null)),X===0&&(ce.redirect="manual",ne&&(ne.redirect="manual")),F=c&&new i(g,ce);let le=await(c?oe(F,ne):oe(g,ce));const _s=M.from(le.headers);if(O){const x=l.toFiniteNumber(_s.getContentLength());if(x!=null&&x>W)throw new m("maxContentLength size of "+W+" exceeded",m.ERR_BAD_RESPONSE,S,F)}const Ft=y&&(j==="stream"||j==="response");if(y&&le.body&&(ie||O||Ft&&Se)){const x={};["status","statusText","headers"].forEach(Je=>{x[Je]=le[Je]});const J=l.toFiniteNumber(_s.getContentLength()),[fe,Ee]=ie&&Rr(J,et(Cr(ie),!0))||[];let ys=0;const ya=Je=>{if(O&&(ys=Je,ys>W))throw new m("maxContentLength size of "+W+" exceeded",m.ERR_BAD_RESPONSE,S,F);fe&&fe(Je)};le=new o(Ir(le.body,Dr,ya,()=>{Ee&&Ee(),Se&&Se()}),x)}j=j||"text";let ue=await C[l.findKey(C,j)||"text"](le,S);if(O&&!y&&!Ft){let x;if(ue!=null&&(typeof ue.byteLength=="number"?x=ue.byteLength:typeof ue.size=="number"?x=ue.size:typeof ue=="string"&&(x=typeof s=="function"?new s().encode(ue).byteLength:ue.length)),typeof x=="number"&&x>W)throw new m("maxContentLength size of "+W+" exceeded",m.ERR_BAD_RESPONSE,S,F)}return!Ft&&Se&&Se(),await new Promise((x,J)=>{Or(x,J,{data:ue,headers:M.from(le.headers),status:le.status,statusText:le.statusText,config:S,request:F})})}catch(L){if(Se&&Se(),Y&&Y.aborted&&Y.reason instanceof m){const Q=Y.reason;throw Q.config=S,F&&(Q.request=F),L!==Q&&Object.defineProperty(Q,"cause",{__proto__:null,value:L,writable:!0,enumerable:!1,configurable:!0}),Q}if(We)throw F&&!We.request&&(We.request=F),We;if(L instanceof m)throw F&&!L.request&&(L.request=F),L;if(L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)){const Q=new m("Network Error",m.ERR_NETWORK,S,F,L&&L.response);throw Object.defineProperty(Q,"cause",{__proto__:null,value:L.cause||L,writable:!0,enumerable:!1,configurable:!0}),Q}throw m.from(L,L&&L.code,S,F,L&&L.response)}}},ji=new Map,Br=t=>{let e=t&&t.env||{};const{fetch:r,Request:s,Response:n}=e,i=[s,n,r];let o=i.length,a=o,c,d,u=ji;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:Li(e)),u=d;return d};Br();const At={http:qn,xhr:_i,fetch:{get:Br}};l.forEach(At,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{__proto__:null,value:e})}catch{}Object.defineProperty(t,"adapterName",{__proto__:null,value:e})}});const $r=t=>`- ${t}`,Ni=t=>l.isFunction(t)||t===null||t===!1;function Di(t,e){t=l.isArray(t)?t:[t];const{length:r}=t;let s,n;const i={};for(let o=0;o<r;o++){s=t[o];let a;if(n=s,!Ni(s)&&(n=At[(a=String(s)).toLowerCase()],n===void 0))throw new m(`Unknown adapter '${a}'`);if(n&&(l.isFunction(n)||(n=n.get(e))))break;i[a||"#"+o]=n}if(!n){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
1
+ System.register(["./main-fe1c8d8cac9248a6882f.js","vue","single-spa","./ValueWidget-CGOhPtMG-9e707dc5b2a5983f78af.js","./IframeWidget-B6WC_SMn-a81077e427408ab4fa03.js","./ValuelimitsbarWidget-Lfq0cbnZ-f0904dd6829cec7bc2b4.js","vue-router","pinia","vuetify","./DetailsDialog-CrP3epOv-9e36df972ea347b32637.js","./LimitsBar-DoRwFPYW-dabec512d162ec0aca6a.js","./LimitsColor-CBcpB-la-3bd861951380f642016e.js","./VWidget-D8HzcrTo-e72cf0783026debd0277.js","./Widget-lYL8eSaS-261a094fe0bd216bc766.js","./LimitsbarWidget-BJcc_1qa-dc6061ddca8ed8f1601d.js","./BarColumn-B_V83WMV-45a92ddcb8ba6cf47a5c.js"],(function(Ss,wa){"use strict";var Bt,dt,He,ht,$t,qt,E,T,D,Vt,w,_,V,ee,G,pe,Oe,Mt,B,Pe,Ke,ft,de,pt,zt,Wt,Jt,Ht,Kt;return{setters:[A=>{Bt=A.g,dt=A.O,He=A._,ht=A.R,$t=A.a,qt=A.k},A=>{E=A.resolveComponent,T=A.openBlock,D=A.createBlock,Vt=A.Teleport,w=A.createVNode,_=A.withCtx,V=A.createElementVNode,ee=A.toDisplayString,G=A.createElementBlock,pe=A.Fragment,Oe=A.renderList,Mt=A.ref,B=A.createTextVNode,Pe=A.mergeProps,Ke=A.createSlots,ft=A.normalizeStyle,de=A.createCommentVNode,pt=A.normalizeClass,zt=A.normalizeProps,Wt=A.guardReactiveProps,Jt=A.withKeys},null,A=>{Ht=A.default},null,A=>{Kt=A.default},null,null,null,null,null,null,null,null,null,null],execute:(function(){var A=document.createElement("style");A.textContent=`.footer[data-v-b6f77818]{padding-top:5px}.v-input[data-v-b6f77818]{background-color:var(--color-background-base-default)}.textfield-green[data-v-b6f77818]{color:#00c800}.textfield-yellow[data-v-b6f77818]{color:#ffdc00}.textfield-red[data-v-b6f77818]{color:#ff2d2d}.limits-table[data-v-b6f77818]{margin-top:5px;margin-bottom:10px}.limits-table[data-v-b6f77818] th{font-weight:700;background-color:var(--color-background-base-default)}.limits-table[data-v-b6f77818] .state-filtered-row{display:none}.card-height[data-v-192a6dcb]{height:calc(100vh - 150px)}
2
+ /*$vite$:1*/`,document.head.appendChild(A);const Es={__name:"TopBarMenu",props:{menu:{type:Object,required:!0},title:{type:String,required:!0}},emits:["submenu-click"],setup(t,{emit:e}){const r=e,s=Mt(!1);function n(){s.value=!1}function i(o){return o.replaceAll(" ","-").toLowerCase()}return(o,a)=>{const c=E("v-icon"),d=E("v-btn"),u=E("v-divider"),h=E("v-list-item-title"),p=E("v-list-item"),y=E("v-list"),C=E("v-menu"),P=E("v-radio"),v=E("v-list-item-action"),S=E("v-radio-group"),g=E("v-checkbox"),b=E("v-tooltip");return T(),D(C,{modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=f=>s.value=f),"close-on-content-click":!1},{activator:_(({props:f})=>[w(d,Pe(f,{variant:"outlined",class:"mx-1 menu-button",text:t.menu.label,"data-test":i(`${t.title} ${t.menu.label}`)}),{append:_(()=>[w(c,{class:"menu-button-icon"},{default:_(()=>[...a[1]||(a[1]=[B(" mdi-menu-down ",-1)])]),_:1})]),_:1},16,["text","data-test"])]),default:_(()=>[w(y,null,{default:_(()=>[(T(!0),G(pe,null,Oe(t.menu.items,(f,I)=>(T(),G(pe,null,[f.divider?(T(),D(u,{key:I+"-divider"})):f.subMenu&&f.subMenu.length>0?(T(),G("div",{key:I+"-submenu"},[(T(),D(C,{key:I,"open-on-hover":"",location:"right"},{activator:_(({props:R})=>[(T(),D(p,Pe({ref_for:!0},R,{key:I,disabled:f.disabled}),Ke({append:_(()=>[w(c,null,{default:_(()=>[...a[2]||(a[2]=[B(" mdi-chevron-right ",-1)])]),_:1})]),default:_(()=>[!f.radio&&!f.checkbox?(T(),D(h,{key:0,style:ft("cursor: pointer;"+(f.disabled?"opacity: 0.2":""))},{default:_(()=>[B(ee(f.label),1)]),_:2},1032,["style"])):de("",!0)]),_:2},[f.icon?{name:"prepend",fn:_(()=>[w(c,{disabled:f.disabled},{default:_(()=>[B(ee(f.icon),1)]),_:2},1032,["disabled"])]),key:"0"}:void 0]),1040,["disabled"]))]),default:_(()=>[w(y,null,{default:_(()=>[(T(!0),G(pe,null,Oe(f.subMenu,(R,H)=>(T(),D(p,{key:H,"prepend-icon":R.icon,onClick:ie=>r("submenu-click",R)},{default:_(()=>[w(h,null,{default:_(()=>[B(ee(R.label),1)]),_:2},1024)]),_:2},1032,["prepend-icon","onClick"]))),128))]),_:2},1024)]),_:2},1024))])):f.radioGroup?(T(),D(S,{key:I+"-radio-group",class:"ma-0 pa-0",density:"compact","hide-details":"","model-value":f.value,"onUpdate:modelValue":f.command},{default:_(()=>[(T(!0),G(pe,null,Oe(f.choices,(R,H)=>(T(),D(p,{key:H+"-choice"},{default:_(()=>[w(v,{class:"list-action"},{default:_(()=>[w(P,{color:"secondary",label:R.label,value:R.value,density:"compact","hide-details":""},null,8,["label","value"])]),_:2},1024)]),_:2},1024))),128))]),_:2},1032,["model-value","onUpdate:modelValue"])):(T(),D(b,{key:I+"-list",disabled:!f.tooltip,text:f.tooltip,location:"right"},{activator:_(({props:R})=>[V("div",Pe({ref_for:!0},R),[w(p,{disabled:f.disabled,"data-test":i(`${t.title} ${t.menu.label} ${f.label}`),onClick:()=>{f.command(f),f.checkbox||n()}},Ke({default:_(()=>[f.checkbox?(T(),D(v,{key:0,class:"list-action"},{default:_(()=>[w(g,{modelValue:f.checked,"onUpdate:modelValue":H=>f.checked=H,label:f.label,color:"secondary",density:"compact","hide-details":""},null,8,["modelValue","onUpdate:modelValue","label"])]),_:2},1024)):de("",!0),!f.radio&&!f.checkbox?(T(),D(h,{key:1,style:ft("cursor: pointer;"+(f.disabled?"opacity: 0.2":""))},{default:_(()=>[B(ee(f.label),1)]),_:2},1032,["style"])):de("",!0)]),_:2},[f.icon?{name:"prepend",fn:_(()=>[w(c,{icon:f.icon,disabled:f.disabled},null,8,["icon","disabled"])]),key:"0"}:void 0]),1032,["disabled","data-test","onClick"])],16)]),_:2},1032,["disabled","text"]))],64))),256))]),_:1})]),_:1},8,["modelValue"])}}},Os={components:{TopBarMenu:Es},props:{menus:{type:Array,default:function(){return[]}},title:{type:String,default:""}},mounted(){document.title=this.title},methods:{subMenuClick(t){t.command(t),this.$refs.topmenu[0].isActive=!1}}},xs={class:"app-title mr-2"};function Rs(t,e,r,s,n,i){const o=E("v-col"),a=E("v-row"),c=E("TopBarMenu");return T(),D(Vt,{to:"#openc3-menu"},[w(a,{"no-gutters":""},{default:_(()=>[w(o,{"align-self":"end"},{default:_(()=>[V("span",xs,ee(r.title),1)]),_:1})]),_:1}),w(a,{dense:"",class:"flex-nowrap"},{default:_(()=>[(T(!0),G(pe,null,Oe(r.menus,(d,u)=>(T(),D(c,{key:u+"-top-menu",ref_for:!0,ref:"topmenu",menu:d,title:r.title,onSubmenuClick:i.subMenuClick},null,8,["menu","title","onSubmenuClick"]))),128))]),_:1})])}const Cs=Bt(Os,[["render",Rs],["__scopeId","data-v-f4fb184e"]]),ks="__default",As={data:{dontSaveDefaultConfig:!1},created:function(){if(!this.configKey)throw alert("Components using the Config mixin must provide a configKey"),new Error("Components using the Config mixin must provide a configKey")},computed:{storageKey(){return`${this.configKey}${ks}`}},methods:{loadDefaultConfig:function(){const t=localStorage.getItem(this.storageKey);return t?JSON.parse(t):{}},saveDefaultConfig:function(t){this.dontSaveDefaultConfig||localStorage.setItem(this.storageKey,JSON.stringify(t))},openConfigBase:function(t,e=!1,r=null){new dt().load_config(this.configKey,t).then(s=>{s?(this.$notify.normal({title:"Loading configuration",body:t}),r&&r(JSON.parse(s)),e||this.$route.fullPath.includes(t)||this.$router.push({query:{config:t}})):this.$notify.caution({title:"Unknown configuration",body:t})}).catch(s=>{s&&this.$notify.serious({title:`Error opening configuration: ${t}`,body:s})})},saveConfigBase:function(t,e){new dt().save_config(this.configKey,t,JSON.stringify(e)).then(()=>{this.$notify.normal({title:"Saved configuration",body:t})}).catch(r=>{r&&this.$notify.serious({title:`Error saving configuration: ${t}`,body:r})})},resetConfigBase:function(){localStorage.removeItem(this.storageKey);const t={...this.$route.query};delete t.config,this.$router.replace({query:t})}}};function Yt(t,e){return function(){return t.apply(e,arguments)}}const{toString:Ps}=Object.prototype,{getPrototypeOf:he}=Object,{iterator:Te,toStringTag:Gt}=Symbol,Ie=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Zt=t=>typeof t=="string"&&(t==="__proto__"||t==="constructor"||t==="prototype"),Xt=(t,e,r)=>t===Object.prototype||!r&&e===null,Ts=t=>{if(!Object.isExtensible(t))return!1;const e=Object.getOwnPropertyNames(t);return Object.getOwnPropertySymbols&&e.push(...Object.getOwnPropertySymbols(t)),e.every(r=>{if(Zt(r))return!1;const s=Object.getOwnPropertyDescriptor(t,r);return!!s&&s.configurable&&s.writable===!0})},Le=(t,e)=>{let r=t;const s=[];for(;r!=null;){if(s.indexOf(r)!==-1)return!1;s.push(r);const n=he(r);if(Xt(r,n,r===t))return!1;if(Ie(r,e))return!0;r=n}return!1},Is=(t,e)=>t!=null&&Le(t,e)?t[e]:void 0,Ls=t=>{if(t==null||typeof t!="object"&&typeof t!="function")return t;const e=he(t);if(e===null&&Ts(t))return t;const r=Object.create(null),s=Object.create(null),n=[];let i=t;for(;i!=null&&n.indexOf(i)===-1;){n.push(i);const o=i===t?e:he(i);if(Xt(i,o,i===t))break;const a=Object.getOwnPropertyNames(i);Object.getOwnPropertySymbols&&a.push(...Object.getOwnPropertySymbols(i));for(const c of a)Zt(c)||Ie(s,c)||(r[c]=t[c],s[c]=!0);i=o}return r},mt=(t=>e=>{const r=Ps.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Z=t=>(t=t.toLowerCase(),e=>mt(e)===t),Ye=t=>e=>typeof e===t,{isArray:me}=Array,ge=Ye("undefined");function xe(t){return t!==null&&!ge(t)&&t.constructor!==null&&!ge(t.constructor)&&K(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Qt=Z("ArrayBuffer");function js(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Qt(t.buffer),e}const Ns=Ye("string"),K=Ye("function"),er=Ye("number"),Re=t=>t!==null&&typeof t=="object",Ds=t=>t===!0||t===!1,Ge=t=>{if(!Re(t))return!1;const e=he(t);return(e===null||e===Object.prototype||he(e)===null)&&!Le(t,Gt)&&!Le(t,Te)},Us=t=>{if(!Re(t)||xe(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Fs=Z("Date"),Bs=Z("File"),$s=t=>!!(t&&typeof t.uri<"u"),qs=t=>t&&typeof t.getParts<"u",Vs=Z("Blob"),Ms=Z("FileList"),zs=Z("Set"),Ws=t=>Re(t)&&K(t.pipe);function Js(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const tr=Js(),rr=typeof tr.FormData<"u"?tr.FormData:void 0,Hs=t=>{if(!t)return!1;if(rr&&t instanceof rr)return!0;const e=he(t);if(!e||e===Object.prototype||!K(t.append))return!1;const r=mt(t);return r==="formdata"||r==="object"&&K(t.toString)&&t.toString()==="[object FormData]"},Ks=Z("URLSearchParams"),[Ys,Gs,Zs,Xs]=["ReadableStream","Request","Response","Headers"].map(Z),Qs=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function je(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let s,n;if(typeof t!="object"&&(t=[t]),me(t))for(s=0,n=t.length;s<n;s++)e.call(null,t[s],s,t);else{if(xe(t))return;const i=r?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let a;for(s=0;s<o;s++)a=i[s],e.call(null,t[a],a,t)}}function sr(t,e){if(xe(t))return null;e=e.toLowerCase();const r=Object.keys(t);let s=r.length,n;for(;s-- >0;)if(n=r[s],e===n.toLowerCase())return n;return null}const be=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nr=t=>!ge(t)&&t!==be;function gt(...t){const{caseless:e,skipUndefined:r}=nr(this)&&this||{},s={},n=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const a=e&&typeof o=="string"&&sr(s,o)||o,c=Ie(s,a)?s[a]:void 0;Ge(c)&&Ge(i)?s[a]=gt(c,i):Ge(i)?s[a]=gt({},i):me(i)?s[a]=i.slice():(!r||!ge(i))&&(s[a]=i)};for(let i=0,o=t.length;i<o;i++){const a=t[i];if(!a||xe(a)||(je(a,n),typeof a!="object"||me(a)))continue;const c=Object.getOwnPropertySymbols(a);for(let d=0;d<c.length;d++){const u=c[d];hn.call(a,u)&&n(a[u],u)}}return s}const en=(t,e,r,{allOwnKeys:s}={})=>(je(e,(n,i)=>{r&&K(n)?Object.defineProperty(t,i,{__proto__:null,value:Yt(n,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,i,{__proto__:null,value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),t),tn=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rn=(t,e,r,s)=>{t.prototype=Object.create(e.prototype,s),Object.defineProperty(t.prototype,"constructor",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{__proto__:null,value:e.prototype}),r&&Object.assign(t.prototype,r)},sn=(t,e,r,s)=>{let n,i,o;const a={};if(e=e||{},t==null)return e;do{for(n=Object.getOwnPropertyNames(t),i=n.length;i-- >0;)o=n[i],(!s||s(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=r!==!1&&he(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},nn=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const s=t.indexOf(e,r);return s!==-1&&s===r},on=t=>{if(!t)return null;if(me(t))return t;let e=t.length;if(!er(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},an=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&he(Uint8Array)),cn=(t,e)=>{const r=(t&&t[Te]).call(t);let s;for(;(s=r.next())&&!s.done;){const n=s.value;e.call(t,n[0],n[1])}},ln=(t,e)=>{let r;const s=[];for(;(r=t.exec(e))!==null;)s.push(r);return s},un=Z("HTMLFormElement"),dn=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:hn}=Object.prototype,fn=Z("RegExp"),ir=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),s={};je(r,(n,i)=>{let o;(o=e(n,i,t))!==!1&&(s[i]=o||n)}),Object.defineProperties(t,s)},pn=t=>{ir(t,(e,r)=>{if(K(t)&&["arguments","caller","callee"].includes(r))return!1;const s=t[r];if(K(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},mn=(t,e)=>{const r={},s=n=>{n.forEach(i=>{r[i]=!0})};return me(t)?s(t):s(String(t).split(e)),r},gn=()=>{},bn=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function _n(t){return!!(t&&K(t.append)&&t[Gt]==="FormData"&&t[Te])}const yn=t=>{const e=new WeakSet,r=s=>{if(Re(s)){if(e.has(s))return;if(xe(s))return s;if(!("toJSON"in s)){e.add(s);let n;if(zs(s)){n=[];for(const i of s){const o=r(i);!ge(o)&&n.push(o)}}else n=me(s)?[]:{},je(s,(i,o)=>{const a=r(i);!ge(a)&&(n[o]=a)});return e.delete(s),n}}return s};return r(t)},wn=Z("AsyncFunction"),vn=t=>t&&(Re(t)||K(t))&&K(t.then)&&K(t.catch),or=((t,e)=>t?setImmediate:e?((r,s)=>(be.addEventListener("message",({source:n,data:i})=>{n===be&&i===r&&s.length&&s.shift()()},!1),n=>{s.push(n),be.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",K(be.postMessage)),Sn=typeof queueMicrotask<"u"?queueMicrotask.bind(be):typeof process<"u"&&process.nextTick||or,ar=t=>t!=null&&K(t[Te]),En=t=>t!=null&&Le(t,Te)&&ar(t),l={isArray:me,isArrayBuffer:Qt,isBuffer:xe,isFormData:Hs,isArrayBufferView:js,isString:Ns,isNumber:er,isBoolean:Ds,isObject:Re,isPlainObject:Ge,isEmptyObject:Us,isReadableStream:Ys,isRequest:Gs,isResponse:Zs,isHeaders:Xs,isUndefined:ge,isDate:Fs,isFile:Bs,isReactNativeBlob:$s,isReactNative:qs,isBlob:Vs,isRegExp:fn,isFunction:K,isStream:Ws,isURLSearchParams:Ks,isTypedArray:an,isFileList:Ms,forEach:je,merge:gt,extend:en,trim:Qs,stripBOM:tn,inherits:rn,toFlatObject:sn,kindOf:mt,kindOfTest:Z,endsWith:nn,toArray:on,forEachEntry:cn,matchAll:ln,isHTMLForm:un,hasOwnProperty:Ie,hasOwnProp:Ie,hasOwnInPrototypeChain:Le,getSafeProp:Is,toSafeFlatObject:Ls,reduceDescriptors:ir,freezeMethods:pn,toObjectSet:mn,toCamelCase:dn,noop:gn,toFiniteNumber:bn,findKey:sr,global:be,isContextDefined:nr,isSpecCompliantForm:_n,toJSONObject:yn,isAsyncFn:wn,isThenable:vn,setImmediate:or,asap:Sn,isIterable:ar,isSafeIterable:En},On=l.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),xn=t=>{const e={};let r,s,n;return t&&t.split(`
3
+ `).forEach(function(i){n=i.indexOf(":"),r=i.substring(0,n).trim().toLowerCase(),s=i.substring(n+1).trim();const o=l.hasOwnProp(e,r);!r||o&&l.hasOwnProp(On,r)||(r==="set-cookie"?o?e[r].push(s):e[r]=[s]:e[r]=o?e[r]+", "+s:s)}),e};function Rn(t){let e=0,r=t.length;for(;e<r;){const s=t.charCodeAt(e);if(s!==9&&s!==32)break;e+=1}for(;r>e;){const s=t.charCodeAt(r-1);if(s!==9&&s!==32)break;r-=1}return e===0&&r===t.length?t:t.slice(e,r)}const Cn=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),kn=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function bt(t,e){return l.isArray(t)?t.map(r=>bt(r,e)):Rn(String(t).replace(e,""))}const An=t=>bt(t,Cn),Pn=t=>bt(t,kn);function cr(t){const e=Object.create(null);return l.forEach(t.toJSON(),(r,s)=>{e[s]=Pn(r)}),e}const lr=Symbol("internals");function Ne(t){return t&&String(t).trim().toLowerCase()}function Ze(t){return t===!1||t==null?t:l.isArray(t)?t.map(Ze):An(String(t))}function Tn(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=r.exec(t);)e[s[1]]=s[2];return e}const In=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function _t(t){let e=0,r=t.length;for(;e<r;){const s=t.charCodeAt(e);if(s!==9&&s!==32)break;e+=1}for(;r>e;){const s=t.charCodeAt(r-1);if(s!==9&&s!==32)break;r-=1}return e===0&&r===t.length?t:t.slice(e,r)}function Ln(t){const e=t.length-1;if(e<1||t.charCodeAt(0)!==34||t.charCodeAt(e)!==34)return t;let r="";for(let s=1;s<e;s++){const n=t.charCodeAt(s);if(n===34||n===92&&(s+=1,s>=e))return t;r+=t[s]}return r}function jn(t){const e=Object.create(null),r=String(t);let s=0,n=!1,i=!1;function o(a){const c=_t(r.slice(s,a)),d=c.indexOf("=");if(d<1)return;const u=_t(c.slice(0,d));if(!In.test(u))return;const h=u.toLowerCase();if(h==="__proto__"||h==="constructor"||h==="prototype")return;const p=_t(c.slice(d+1));e[h]=Ln(p)}for(let a=0;a<r.length;a++){const c=r.charCodeAt(a);n?i?i=!1:c===92?i=!0:c===34&&(n=!1):c===34?n=!0:(c===44||c===59)&&(o(a),s=a+1)}return o(r.length),e}const Nn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function yt(t,e,r,s,n){if(l.isFunction(s))return s.call(this,e,r);if(n&&(e=r),!!l.isString(e)){if(l.isString(s))return e.indexOf(s)!==-1;if(l.isRegExp(s))return s.test(e)}}function Dn(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,s)=>r.toUpperCase()+s)}function Un(t,e){const r=l.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(t,s+r,{__proto__:null,value:function(n,i,o){return this[s].call(this,e,n,i,o)},configurable:!0})})}let M=class{constructor(t){t&&this.set(t)}set(t,e,r){const s=this;function n(o,a,c){const d=Ne(a);if(!d)return;const u=l.findKey(s,d);(!u||s[u]===void 0||c===!0||c===void 0&&s[u]!==!1)&&(s[u||a]=Ze(o))}const i=(o,a)=>l.forEach(o,(c,d)=>n(c,d,a));if(l.isPlainObject(t)||t instanceof this.constructor)i(t,e);else if(l.isString(t)&&(t=t.trim())&&!Nn(t))i(xn(t),e);else if(l.isObject(t)&&l.isSafeIterable(t)){let o=Object.create(null),a,c;for(const d of t){if(!l.isArray(d))throw new TypeError("Object iterator must return a key-value pair");c=d[0],l.hasOwnProp(o,c)?(a=o[c],o[c]=l.isArray(a)?[...a,d[1]]:[a,d[1]]):o[c]=d[1]}i(o,e)}else t!=null&&n(e,t,r);return this}get(t,e){if(t=Ne(t),t){const r=l.findKey(this,t);if(r){const s=this[r];if(!e)return s;if(e===!0)return Tn(s);if(l.isFunction(e))return e.call(this,s,r);if(l.isRegExp(e))return e.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=Ne(t),t){const r=l.findKey(this,t);return!!(r&&this[r]!==void 0&&(!e||yt(this,this[r],r,e)))}return!1}delete(t,e){const r=this;let s=!1;function n(i){if(i=Ne(i),i){const o=l.findKey(r,i);o&&(!e||yt(r,r[o],o,e))&&(delete r[o],s=!0)}}return l.isArray(t)?t.forEach(n):n(t),s}clear(t){const e=Object.keys(this);let r=e.length,s=!1;for(;r--;){const n=e[r];(!t||yt(this,this[n],n,t,!0))&&(delete this[n],s=!0)}return s}normalize(t){const e=this,r={};return l.forEach(this,(s,n)=>{const i=l.findKey(r,n);if(i){e[i]=Ze(s),delete e[n];return}const o=t?Dn(n):String(n).trim();o!==n&&delete e[n],e[o]=Ze(s),r[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return l.forEach(this,(r,s)=>{r!=null&&r!==!1&&(e[s]=t&&l.isArray(r)?r.join(", "):r)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(`
4
+ `)}getSetCookie(){const t=this.get("set-cookie");return l.isArray(t)?t:t==null||t===!1?[]:[t]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static parseParameters(t){return jn(t)}static concat(t,...e){const r=new this(t);return e.forEach(s=>r.set(s)),r}static accessor(t){const e=(this[lr]=this[lr]={accessors:{}}).accessors,r=this.prototype;function s(n){const i=Ne(n);e[i]||(Un(r,n),e[i]=!0)}return l.isArray(t)?t.forEach(s):s(t),this}};M.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),l.reduceDescriptors(M.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(s){this[r]=s}}}),l.freezeMethods(M);const Xe="[REDACTED ****]";function Fn(t){if(l.hasOwnProp(t,"toJSON"))return!0;let e=Object.getPrototypeOf(t);for(;e&&e!==Object.prototype;){if(l.hasOwnProp(e,"toJSON"))return!0;e=Object.getPrototypeOf(e)}return!1}function Bn(t,e){const r=new Set(e.map(i=>String(i).toLowerCase())),s=[],n=i=>{if(i===null||typeof i!="object"||l.isBuffer(i))return i;if(s.indexOf(i)!==-1)return;i instanceof M&&(i=i.toJSON()),s.push(i);let o;if(l.isArray(i))o=[],i.forEach((a,c)=>{const d=n(a);l.isUndefined(d)||(o[c]=d)});else{if(!l.isPlainObject(i)&&Fn(i))return s.pop(),i;o=Object.create(null);for(const[a,c]of Object.entries(i)){const d=r.has(a.toLowerCase())?Xe:n(c);l.isUndefined(d)||(o[a]=d)}}return s.pop(),o};return n(t)}function ur(t){try{return String(t)}catch{return""}}function $n(t){return t.errors.map(e=>{try{return e&&e.message?ur(e.message):ur(e)}catch{return""}}).filter(Boolean).join("; ")||t.name||"AggregateError"}let m=class ws extends Error{static from(e,r,s,n,i,o){let a=e.message;!a&&l.isArray(e.errors)&&e.errors.length&&(a=$n(e));const c=new ws(a,r||e.code,s,n,i);return Object.defineProperty(c,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),c.name=e.name,e.status!=null&&c.status==null&&(c.status=e.status),o&&Object.assign(c,o),c}constructor(e,r,s,n,i){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),s&&(this.config=s),n&&(this.request=n),i&&(this.response=i,this.status=i.status)}toJSON(){const e=this.config,r=e&&l.hasOwnProp(e,"redact")?e.redact:void 0,s=l.isArray(r)&&r.length>0?Bn(e,r):l.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:s,code:this.code,status:this.status}}};m.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",m.ERR_BAD_OPTION="ERR_BAD_OPTION",m.ECONNABORTED="ECONNABORTED",m.ETIMEDOUT="ETIMEDOUT",m.ECONNREFUSED="ECONNREFUSED",m.ERR_NETWORK="ERR_NETWORK",m.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",m.ERR_DEPRECATED="ERR_DEPRECATED",m.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",m.ERR_BAD_REQUEST="ERR_BAD_REQUEST",m.ERR_CANCELED="ERR_CANCELED",m.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",m.ERR_INVALID_URL="ERR_INVALID_URL",m.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const qn=null,dr=100;function wt(t){return l.isPlainObject(t)||l.isArray(t)}function hr(t){return l.endsWith(t,"[]")?t.slice(0,-2):t}function vt(t,e,r){return t?t.concat(e).map(function(s,n){return s=hr(s),!r&&n?"["+s+"]":s}).join(r?".":""):e}function Vn(t){return l.isArray(t)&&!t.some(wt)}const Mn=l.toFlatObject(l,{},null,function(t){return/^is[A-Z]/.test(t)});function Qe(t,e,r){if(!l.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const s=(g,b)=>{const f=l.getSafeProp(r,g);return l.isUndefined(f)?b:f},n=s("metaTokens",!0),i=s("visitor")||P,o=s("dots",!1),a=s("indexes",!1),c=s("Blob")||typeof Blob<"u"&&Blob,d=s("maxDepth",dr),u=c&&l.isSpecCompliantForm(e),h=[];if(!l.isFunction(i))throw new TypeError("visitor must be a function");function p(g){if(g===null)return"";if(l.isDate(g))return g.toISOString();if(l.isBoolean(g))return g.toString();if(!u&&l.isBlob(g))throw new m("Blob is not supported. Use a Buffer instead.");if(l.isArrayBuffer(g)||l.isTypedArray(g)){if(u&&typeof c=="function")return new c([g]);throw new m("Blob is not supported. Use a Buffer instead.",m.ERR_NOT_SUPPORT)}return g}function y(g){if(g>d)throw new m("Object is too deeply nested ("+g+" levels). Max depth: "+d,m.ERR_FORM_DATA_DEPTH_EXCEEDED)}function C(g,b){if(d===1/0)return JSON.stringify(g);const f=[];return JSON.stringify(g,function(I,R){if(!l.isObject(R))return R;for(;f.length&&f[f.length-1]!==this;)f.pop();return f.push(R),y(b+f.length-1),R})}function P(g,b,f){let I=g;if(l.isReactNative(e)&&l.isReactNativeBlob(g))return e.append(vt(f,b,o),p(g)),!1;if(g&&!f&&typeof g=="object"){if(l.endsWith(b,"{}"))b=n?b:b.slice(0,-2),g=C(g,1);else if(l.isArray(g)&&Vn(g)||(l.isFileList(g)||l.endsWith(b,"[]"))&&(I=l.toArray(g)))return b=hr(b),I.forEach(function(R,H){!(l.isUndefined(R)||R===null)&&e.append(a===!0?vt([b],H,o):a===null?b:b+"[]",p(R))}),!1}return wt(g)?!0:(e.append(vt(f,b,o),p(g)),!1)}const v=Object.assign(Mn,{defaultVisitor:P,convertValue:p,isVisitable:wt});function S(g,b,f=0){if(!l.isUndefined(g)){if(y(f),h.indexOf(g)!==-1)throw new Error("Circular reference detected in "+b.join("."));h.push(g),l.forEach(g,function(I,R){(!(l.isUndefined(I)||I===null)&&i.call(e,I,l.isString(R)?R.trim():R,b,v))===!0&&S(I,b?b.concat(R):[R],f+1)}),h.pop()}}if(!l.isObject(t))throw new TypeError("data must be an object");return S(t),e}function fr(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(t).replace(/[!'()~]|%20/g,function(r){return e[r]})}function St(t,e){this._pairs=[],t&&Qe(t,this,e)}const pr=St.prototype;pr.append=function(t,e){this._pairs.push([t,e])},pr.toString=function(t){const e=t?r=>t.call(this,r,fr):fr;return this._pairs.map(function(r){return e(r[0])+"="+e(r[1])},"").join("&")};function zn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function mr(t,e,r){if(!e)return t;t=t||"";const s=l.isFunction(r)?{serialize:r}:r,n=l.getSafeProp(s,"encode")||zn,i=l.getSafeProp(s,"serialize");let o;if(i?o=i(e,s):o=l.isURLSearchParams(e)?e.toString():new St(e,s).toString(n),o){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}const De=Symbol("internals");function gr(t){return t?t.length:0}function br(t){if(t)for(;t.length&&t[t.length-1]===null;)t.pop()}function Ue(t,e){const r=t.handlers,s=gr(r);r!==e.handlersRef?(e.handlersRef=r,e.handlerEntries.clear()):s!==e.handlersLength&&(s?e.handlerEntries.forEach(function(n,i){r[n.index]!==n.handler&&e.handlerEntries.delete(i)}):e.handlerEntries.clear()),e.handlersLength=s}class _r{constructor(){this.handlers=[],this[De]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(e,r,s){const n={fulfilled:e,rejected:r,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null},i=this[De];this.handlers==null&&(this.handlers=[]),Ue(this,i);const o=i.nextId++;return this.handlers.push(n),i.handlerEntries.set(o,{handler:n,index:this.handlers.length-1}),i.handlersLength=this.handlers.length,o}eject(e){const r=this[De];Ue(this,r);const s=r.handlerEntries.get(e);if(s){if(r.handlerEntries.delete(e),this.handlers[s.index]!==s.handler)return;this.handlers[s.index]=null,r.iterationDepth||(br(this.handlers),r.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],Ue(this,this[De]))}forEach(e){const r=this[De];Ue(this,r),r.iterationDepth++;try{l.forEach(this.handlers,function(s){s!==null&&e(s)})}finally{--r.iterationDepth||(Ue(this,r),br(this.handlers),r.handlersLength=gr(this.handlers))}}}const Et={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Wn=typeof URLSearchParams<"u"?URLSearchParams:St,Jn=typeof FormData<"u"?FormData:null,Hn=typeof Blob<"u"?Blob:null,Kn={isBrowser:!0,classes:{URLSearchParams:Wn,FormData:Jn,Blob:Hn},protocols:["http","https","file","blob","url","data"]},Ot=typeof window<"u"&&typeof document<"u",xt=typeof navigator=="object"&&navigator||void 0,Yn=Ot&&(!xt||["ReactNative","NativeScript","NS"].indexOf(xt.product)<0),Gn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Zn=Ot&&window.location.href||"http://localhost",Xn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ot,hasStandardBrowserEnv:Yn,hasStandardBrowserWebWorkerEnv:Gn,navigator:xt,origin:Zn},Symbol.toStringTag,{value:"Module"})),$={...Xn,...Kn};function Qn(t,e){return Qe(t,new $.classes.URLSearchParams,{visitor:function(r,s,n,i){return $.isNode&&l.isBuffer(r)?(this.append(s,r.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}const yr=dr;function wr(t){if(t>yr)throw new m("FormData field is too deeply nested ("+t+" levels). Max depth: "+yr,m.ERR_FORM_DATA_DEPTH_EXCEEDED)}function ei(t){const e=[],r=/[^.[\]]+|\[([^.[\]]*)]/g;let s;for(;(s=r.exec(t))!==null;)wr(e.length),e.push(s[0]==="[]"?"":s[1]||s[0]);return e}function ti(t){const e={},r=Object.keys(t);let s;const n=r.length;let i;for(s=0;s<n;s++)i=r[s],e[i]=t[i];return e}function vr(t){function e(r,s,n,i){wr(i);let o=r[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),c=i>=r.length;return o=!o&&l.isArray(n)?n.length:o,c?(l.hasOwnProp(n,o)?n[o]=l.isArray(n[o])?n[o].concat(s):[n[o],s]:n[o]=s,!a):((!l.hasOwnProp(n,o)||!l.isObject(n[o]))&&(n[o]=[]),e(r,s,n[o],i)&&l.isArray(n[o])&&(n[o]=ti(n[o])),!a)}if(l.isFormData(t)&&l.isFunction(t.entries)){const r={};return l.forEachEntry(t,(s,n)=>{e(ei(s),n,r,0)}),r}return null}const Sr=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),Ce=(t,e)=>t!=null&&l.hasOwnProp(t,e)?t[e]:void 0;function ri(t,e,r){if(l.isString(t))try{return(e||JSON.parse)(t),l.trim(t)}catch(s){if(s.name!=="SyntaxError")throw s}return(r||JSON.stringify)(t)}const Fe={transitional:Et,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const r=e.getContentType()||"",s=r.indexOf("application/json")>-1,n=l.isObject(t);if(n&&l.isHTMLForm(t)&&(t=new FormData(t)),l.isFormData(t))return s?JSON.stringify(vr(t)):t;if(l.isArrayBuffer(t)||l.isBuffer(t)||l.isStream(t)||l.isFile(t)||l.isBlob(t)||l.isReadableStream(t))return t;if(l.isArrayBufferView(t))return t.buffer;if(l.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let i;if(n){const o=Ce(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Qn(t,o).toString();if((i=l.isFileList(t))||r.indexOf("multipart/form-data")>-1){const a=Ce(this,"env"),c=a&&a.FormData;return Qe(i?{"files[]":t}:t,c&&new c,o)}}return n||s?(e.setContentType("application/json",!1),ri(t)):t}],transformResponse:[function(t){const e=Ce(this,"transitional")||Fe.transitional,r=e&&e.forcedJSONParsing,s=Ce(this,"responseType"),n=s==="json";if(l.isResponse(t)||l.isReadableStream(t))return t;if(t&&l.isString(t)&&(r&&!s||n)){const i=!(e&&e.silentJSONParsing)&&n;try{return JSON.parse(t,Ce(this,"parseReviver"))}catch(o){if(i)throw o.name==="SyntaxError"?m.from(o,m.ERR_BAD_RESPONSE,this,null,Ce(this,"response")):o}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:$.classes.FormData,Blob:$.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};l.forEach(Sr,t=>{Fe.headers[t]={}});function Rt(t,e){const r=this||Fe,s=e||r,n=M.from(s.headers);let i=s.data;return l.forEach(t,function(o){i=o.call(r,i,n.normalize(),e?e.status:void 0)}),n.normalize(),i}function Er(t){return!!(t&&t.__CANCEL__)}let Be=class extends m{constructor(t,e,r){super(t??"canceled",m.ERR_CANCELED,e,r),this.name="CanceledError",this.__CANCEL__=!0}};function Or(t,e,r){const s=r.config.validateStatus;!r.status||!s||s(r.status)?t(r):e(new m("Request failed with status code "+r.status,r.status>=400&&r.status<500?m.ERR_BAD_REQUEST:m.ERR_BAD_RESPONSE,r.config,r.request,r))}const si=/[\t\n\r]/g;function xr(t){if(typeof t!="string")return t;let e=0;for(;e<t.length&&t.charCodeAt(e)<=32;)e++;return t.slice(e).replace(si,"")}function Ct(t){const e=/^([-+\w]{1,25}):(?:\/\/)?/.exec(t);return e&&e[1]||""}function ni(t,e){t=t||10;const r=new Array(t),s=new Array(t);let n=0,i=0,o;return e=e!==void 0?e:1e3,function(a){const c=Date.now(),d=s[i];o||(o=c),r[n]=a,s[n]=c;let u=i,h=0;for(;u!==n;)h+=r[u++],u=u%t;if(n=(n+1)%t,n===i&&(i=(i+1)%t),c-o<e)return;const p=d&&c-d;return p?Math.round(h*1e3/p):void 0}}function ii(t,e){let r=0,s=1e3/e,n,i;const o=(a,c=Date.now())=>{r=c,n=null,i&&(clearTimeout(i),i=null),t(...a)};return[(...a)=>{const c=Date.now(),d=c-r;d>=s?o(a,c):(n=a,i||(i=setTimeout(()=>{i=null,o(n)},s-d)))},()=>n&&o(n),(...a)=>o(a)]}const et=(t,e,r=3)=>{let s=0;const n=ni(50,250);return ii(i=>{if(!i||!l.isNumber(i.loaded))return;const o=i.loaded,a=i.lengthComputable?i.total:void 0,c=Math.max(0,a!=null?Math.min(o,a):o),d=Math.max(0,c-s),u=n(d);s=Math.max(s,c);const h={loaded:c,total:a,progress:a?c/a:void 0,bytes:d,rate:u||void 0,estimated:u&&a?(a-c)/u:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(h)},r)},Rr=(t,e)=>{const r=t!=null;return[s=>e[0]({lengthComputable:r,total:t,loaded:s}),e[1]]},Cr=(t,e=l.asap)=>(...r)=>e(()=>t(...r)),oi=$.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,$.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL($.origin),$.navigator&&/(msie|trident)/i.test($.navigator.userAgent)):()=>!0,ai=$.hasStandardBrowserEnv?{write(t,e,r,s,n,i,o){if(typeof document>"u")return;const a=[`${t}=${encodeURIComponent(e)}`];l.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),l.isString(s)&&a.push(`path=${s}`),l.isString(n)&&a.push(`domain=${n}`),i===!0&&a.push("secure"),l.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.split(";");for(let r=0;r<e.length;r++){const s=e[r].replace(/^\s+/,""),n=s.indexOf("=");if(n!==-1&&s.slice(0,n)===t)try{return decodeURIComponent(s.slice(n+1))}catch{return s.slice(n+1)}}return null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function ci(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function li(t,e){if(!e)return t;let r=t.length;for(;r>0&&t.charCodeAt(r-1)===47;)r--;return t.slice(0,r)+"/"+e.replace(/^\/+/,"")}const ui=/^https?:(?!\/\/)/i;function di(t){return t&&t.replace(/(^|&)([^=&]*=)?[^&]+/g,(e,r,s="")=>`${r}${s}${Xe}`)}function hi(t){const e=t.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${Xe}@`),r=e.indexOf("#"),s=(r===-1?e:e.slice(0,r)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${Xe}`);return r===-1?s:`${s}#${di(e.slice(r+1))}`}function kr(t,e){if(typeof t=="string"){const r=xr(t);if(ui.test(r))throw new m(`Invalid URL ${JSON.stringify(hi(r))}: missing "//" after protocol`,m.ERR_INVALID_URL,e)}}function Ar(t,e,r,s){kr(e,s);let n=!ci(e);return t&&(n||r===!1)?(kr(t,s),li(t,e)):e}const Pr=t=>t instanceof M?{...t}:t,fi=t=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(t).concat(Object.getOwnPropertySymbols(t).filter(e=>Object.getOwnPropertyDescriptor(t,e).enumerable)):Object.keys(t);function _e(t,e){t=t||{},e=e||{};const r=Object.create(null);Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function s(u,h,p,y){return l.isPlainObject(u)&&l.isPlainObject(h)?l.merge.call({caseless:y},u,h):l.isPlainObject(h)?l.merge({},h):l.isArray(h)?h.slice():h}function n(u,h,p,y){if(l.isUndefined(h)){if(!l.isUndefined(u))return s(void 0,u,p,y)}else return s(u,h,p,y)}function i(u,h){if(!l.isUndefined(h))return s(void 0,h)}function o(u,h){if(l.isUndefined(h)){if(!l.isUndefined(u))return s(void 0,u)}else return s(void 0,h)}function a(u){const h=l.hasOwnProp(e,"transitional")?e.transitional:void 0;if(!l.isUndefined(h))if(l.isPlainObject(h)){if(l.hasOwnProp(h,u))return h[u]}else return;const p=l.hasOwnProp(t,"transitional")?t.transitional:void 0;if(l.isPlainObject(p)&&l.hasOwnProp(p,u))return p[u]}function c(u,h,p){if(l.hasOwnProp(e,p))return s(u,h);if(l.hasOwnProp(t,p))return s(void 0,u)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutErrorMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:c,headers:(u,h,p)=>n(Pr(u),Pr(h),p,!0)};return l.forEach(fi({...t,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const h=l.hasOwnProp(d,u)?d[u]:n,p=l.hasOwnProp(t,u)?t[u]:void 0,y=l.hasOwnProp(e,u)?e[u]:void 0,C=h(p,y,u);l.isUndefined(C)&&h!==c||(r[u]=C)}),l.hasOwnProp(e,"validateStatus")&&l.isUndefined(e.validateStatus)&&a("validateStatusUndefinedResolves")===!1&&(l.hasOwnProp(t,"validateStatus")?r.validateStatus=s(void 0,t.validateStatus):delete r.validateStatus),r}const pi=["content-type","content-length"];function mi(t,e,r){if(r!=="content-only"){t.set(e);return}Object.entries(e||{}).forEach(([s,n])=>{pi.includes(s.toLowerCase())&&t.set(s,n)})}const gi=t=>encodeURIComponent(t).replace(/%([0-9A-F]{2})/gi,(e,r)=>String.fromCharCode(parseInt(r,16)));function Tr(t){const e=_e({},t),r=p=>l.hasOwnProp(e,p)?e[p]:void 0,s=r("data");let n=r("withXSRFToken");const i=r("xsrfHeaderName"),o=r("xsrfCookieName");let a=r("headers");const c=r("auth"),d=r("baseURL"),u=r("allowAbsoluteUrls"),h=r("url");if(e.headers=a=M.from(a),e.url=mr(Ar(d,h,u,e),r("params"),r("paramsSerializer")),c){const p=l.getSafeProp(c,"username")||"",y=l.getSafeProp(c,"password")||"";try{a.set("Authorization","Basic "+btoa(p+":"+(y?gi(y):"")))}catch(C){throw m.from(C,m.ERR_BAD_OPTION_VALUE,t)}}if(l.isFormData(s)){const p=l.getSafeProp(s,"getHeaders");$.hasStandardBrowserEnv||$.hasStandardBrowserWebWorkerEnv||l.isReactNative(s)?a.setContentType(void 0):l.isFunction(p)&&mi(a,p.call(s),r("formDataHeaderPolicy"))}if($.hasStandardBrowserEnv&&(l.isFunction(n)&&(n=n(e)),n===!0||n==null&&oi(e.url))){const p=i&&o&&ai.read(o);p&&a.set(i,p)}return e}const bi=typeof XMLHttpRequest<"u",_i=bi&&function(t){return new Promise(function(e,r){const s=Tr(t);let n=s.data;const i=M.from(s.headers).normalize();let{responseType:o,onUploadProgress:a,onDownloadProgress:c}=s,d,u,h,p,y,C;function P(){p&&p(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let v=new XMLHttpRequest;v.open(s.method.toUpperCase(),s.url,!0),v.timeout=s.timeout;function S(b){if(!v)return;if(v.status===0&&(Ct(xr(s.url))||Ct($.origin))!=="file"&&!(v.responseURL&&v.responseURL.startsWith("file:"))){r(new m("Request aborted",m.ECONNABORTED,t,v)),P(),v=null;return}try{b?C&&C(b):y&&y()}catch(R){setTimeout(()=>{throw R})}if(!v)return;const f=M.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),I={data:!o||o==="text"||o==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:f,config:t,request:v};Or(function(R){e(R),P()},function(R){r(R),P()},I),v=null}"onloadend"in v?v.onloadend=S:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.startsWith("file:"))||setTimeout(S)},v.onabort=function(){v&&(r(new m("Request aborted",m.ECONNABORTED,t,v)),P(),v=null)},v.onerror=function(b){const f=b&&b.message?b.message:"Network Error",I=new m(f,m.ERR_NETWORK,t,v);I.event=b||null,r(I),P(),v=null},v.ontimeout=function(){let b=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const f=s.transitional||Et;s.timeoutErrorMessage&&(b=s.timeoutErrorMessage),r(new m(b,f.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,t,v)),P(),v=null},n===void 0&&i.setContentType(null),"setRequestHeader"in v&&l.forEach(cr(i),function(b,f){v.setRequestHeader(f,b)}),l.isUndefined(s.withCredentials)||(v.withCredentials=!!s.withCredentials),o&&o!=="json"&&(v.responseType=s.responseType),c&&([h,y,C]=et(c,!0),v.addEventListener("progress",h)),a&&v.upload&&([u,p]=et(a),v.upload.addEventListener("progress",u),v.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(d=b=>{v&&(r(!b||b.type?new Be(null,t,v):b),v.abort(),P(),v=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const g=Ct(s.url);if(g&&!$.protocols.includes(g)){r(new m("Unsupported protocol "+g+":",m.ERR_BAD_REQUEST,t)),P();return}v.send(n||null)})},yi=(t,e)=>{if(t=t?t.filter(Boolean):[],!e&&!t.length)return;const r=new AbortController;let s=!1;const n=function(c){if(!s){s=!0,o();const d=c instanceof Error?c:this.reason;r.abort(d instanceof m?d:new Be(d instanceof Error?d.message:d))}};let i=e&&setTimeout(()=>{i=null,n(new m(`timeout of ${e}ms exceeded`,m.ETIMEDOUT))},e);const o=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(n):c.removeEventListener("abort",n)}),t=null)};t.forEach(c=>{if(!s){if(c.aborted){n.call(c);return}c.addEventListener("abort",n,{once:!0})}});const{signal:a}=r;return a.unsubscribe=()=>l.asap(o),a},wi=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let s=0,n;for(;s<r;)n=s+e,yield t.slice(s,n),s=n},vi=async function*(t,e){for await(const r of Si(t))yield*wi(r,e)},Si=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:s}=await e.read();if(r)break;yield s}}finally{await e.cancel()}},Ir=(t,e,r,s)=>{const n=vi(t,e);let i=0,o,a=c=>{o||(o=!0,s&&s(c))};return new ReadableStream({async pull(c){try{const{done:d,value:u}=await n.next();if(d){a(),c.close();return}let h=u.byteLength;if(r){let p=i+=h;r(p)}c.enqueue(new Uint8Array(u))}catch(d){throw a(d),d}},cancel(c){return a(c),n.return()}},{highWaterMark:2})},Lr=t=>t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102,jr=(t,e,r)=>e+2<r&&Lr(t.charCodeAt(e+1))&&Lr(t.charCodeAt(e+2)),Nr=t=>t<=57?t-48:(t&223)-55,Ei=t=>t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===43||t===47||t===45||t===95,Oi=t=>t===9||t===10||t===12||t===13||t===32,xi=t=>{const e=Math.floor(t/4),r=t%4;return e*3+(r===2?1:r===3?2:0)},Ri=t=>{const e=t.length;let r=0;return e>0&&t.charCodeAt(e-1)===61&&(r++,e>1&&t.charCodeAt(e-2)===61&&r++),Math.floor((e-r)*3/4)},Ci=t=>{const e=t.length;let r=0,s=0,n=!1;for(let i=0;i<e;i++){let o=t.charCodeAt(i);if(o===37&&jr(t,i,e)&&(o=Nr(t.charCodeAt(i+1))*16+Nr(t.charCodeAt(i+2)),i+=2),!Oi(o)){if(o===61){s++;continue}if(!Ei(o)||s>0){n=!0;continue}r++}}return n||s>2||s>0&&(r+s)%4!==0||r%4===1?Ri(t):xi(r)},ki=(t,e)=>{if(!t||typeof t!="string"||!t.startsWith("data:"))return 0;const r=t.indexOf(",");if(r<0)return 0;const s=t.slice(5,r),n=t.slice(r+1);if(/;base64/i.test(s))return e(n);let i=0;for(let o=0,a=n.length;o<a;o++){const c=n.charCodeAt(o);if(c===37&&jr(n,o,a))i+=1,o+=2;else if(c<128)i+=1;else if(c<2048)i+=2;else if(c>=55296&&c<=56319&&o+1<a){const d=n.charCodeAt(o+1);d>=56320&&d<=57343?(i+=4,o++):i+=3}else i+=3}return i};function Ai(t){const e=typeof t=="string"?t.indexOf("#"):-1;return ki(e===-1?t:t.slice(0,e),Ci)}const kt="1.20.0",Dr=64*1024,Pi={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:tt}=l,Ti=t=>encodeURIComponent(t).replace(/%([0-9A-F]{2})/gi,(e,r)=>String.fromCharCode(parseInt(r,16))),Ur=t=>{if(!l.isString(t))return t;try{return decodeURIComponent(t)}catch{return t}},Fr=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Ii=t=>{const e=t.indexOf("://");let r=t;return e!==-1&&(r=r.slice(e+3)),r.includes("@")||r.includes(":")},Li=t=>{const e=l.global!==void 0&&l.global!==null?l.global:globalThis,{ReadableStream:r,TextEncoder:s}=e;t=l.merge.call({skipUndefined:!0},{Request:e.Request,Response:e.Response},t);const{fetch:n,Request:i,Response:o}=t,a=n?tt(n):typeof fetch=="function",c=tt(i),d=tt(o);if(!a)return!1;const u=a&&tt(r),h=a&&(typeof s=="function"?(S=>g=>S.encode(g))(new s):async S=>new Uint8Array(await new i(S).arrayBuffer())),p=c&&u&&Fr(()=>{let S=!1;const g=new i($.origin,{body:new r,method:"POST",get duplex(){return S=!0,"half"}}),b=g.headers.has("Content-Type");return g.body!=null&&g.body.cancel(),S&&!b}),y=d&&u&&Fr(()=>l.isReadableStream(new o("").body)),C={stream:y&&(S=>S.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach(S=>{!C[S]&&(C[S]=(g,b)=>{let f=g&&g[S];if(f)return f.call(g);throw new m(`Response type '${S}' is not supported`,m.ERR_NOT_SUPPORT,b)})});const P=async S=>{if(S==null)return 0;if(l.isBlob(S))return S.size;if(l.isSpecCompliantForm(S))return(await new i($.origin,{method:"POST",body:S}).arrayBuffer()).byteLength;if(l.isArrayBufferView(S)||l.isArrayBuffer(S))return S.byteLength;if(l.isURLSearchParams(S)&&(S=S+""),l.isString(S))return(await h(S)).byteLength},v=async(S,g)=>l.toFiniteNumber(S.getContentLength())??P(g);return async S=>{let{url:g,method:b,data:f,signal:I,cancelToken:R,timeout:H,onDownloadProgress:ie,onUploadProgress:k,responseType:j,headers:q,withCredentials:re="same-origin",fetchOptions:ae,maxContentLength:W,maxBodyLength:Ae,maxRedirects:X}=Tr(S);const O=l.isNumber(W)&&W>-1,N=l.isNumber(Ae)&&Ae>-1,se=L=>l.hasOwnProp(S,L)?S[L]:void 0;let oe=n||fetch;j=j?(j+"").toLowerCase():"text";let Y=yi([I,R&&R.toAbortSignal()],H),F=null;const Se=Y&&Y.unsubscribe&&(()=>{Y.unsubscribe()});let ze,We=null;const gs=()=>new m("Request body larger than maxBodyLength limit",m.ERR_BAD_REQUEST,S,F);try{let L;const Q=se("auth");if(Q){const x=l.getSafeProp(Q,"username")||"",J=l.getSafeProp(Q,"password")||"";L={username:x,password:J}}if(Ii(g)){const x=new URL(g,$.origin);if(!L&&(x.username||x.password)){const J=Ur(x.username),fe=Ur(x.password);L={username:J,password:fe}}(x.username||x.password)&&(x.username="",x.password="",g=x.href)}if(L&&(q.delete("authorization"),q.set("Authorization","Basic "+btoa(Ti((L.username||"")+":"+(L.password||""))))),O&&typeof g=="string"&&g.startsWith("data:")&&Ai(g)>W)throw new m("maxContentLength size of "+W+" exceeded",m.ERR_BAD_RESPONSE,S,F);if(N&&b!=="get"&&b!=="head"){const x=await P(f);if(typeof x=="number"&&isFinite(x)&&(ze=x,x>Ae))throw gs()}const ut=N&&(l.isReadableStream(f)||l.isStream(f)),bs=(x,J,fe)=>Ir(x,Dr,Ee=>{if(N&&Ee>Ae)throw We=gs();J&&J(Ee)},fe);if(p&&b!=="get"&&b!=="head"&&(k||ut)){if(ze=ze??await v(q,f),ze!==0||ut){let x=new i(g,{method:"POST",body:f,duplex:"half"}),J;if(l.isFormData(f)&&(J=x.headers.get("content-type"))&&q.setContentType(J),x.body){const[fe,Ee]=k&&Rr(ze,et(Cr(k)))||[];f=bs(x.body,fe,Ee)}}}else if(ut&&!c&&u&&b!=="get"&&b!=="head")f=bs(f);else if(ut&&c&&!p&&b!=="get"&&b!=="head")throw new m("Stream request bodies are not supported by the current fetch implementation",m.ERR_NOT_SUPPORT,S,F);l.isString(re)||(re=re?"include":"omit");const _a=c&&"credentials"in i.prototype;if(l.isFormData(f)){const x=q.getContentType();x&&/^multipart\/form-data/i.test(x)&&!/boundary=/i.test(x)&&q.delete("content-type")}q.set("User-Agent","axios/"+kt,!1);const ne=ae==null?ae:Object.assign(Object.create(null),ae);ne&&(delete ne.body,delete ne.headers,delete ne.method,delete ne.signal,delete ne.duplex,delete ne.credentials);const ce=Object.assign(Object.create(null),ne,{signal:Y,method:b.toUpperCase(),headers:cr(q.normalize()),body:f,duplex:"half",credentials:_a?re:void 0});c&&(l.forEach(Pi,(x,J)=>{ce[J]===void 0&&(ce[J]=x)}),ce.signal===void 0&&(ce.signal=null),ce.body===void 0&&(ce.body=null)),X===0&&(ce.redirect="manual",ne&&(ne.redirect="manual")),F=c&&new i(g,ce);let le=await(c?oe(F,ne):oe(g,ce));const _s=M.from(le.headers);if(O){const x=l.toFiniteNumber(_s.getContentLength());if(x!=null&&x>W)throw new m("maxContentLength size of "+W+" exceeded",m.ERR_BAD_RESPONSE,S,F)}const Ft=y&&(j==="stream"||j==="response");if(y&&le.body&&(ie||O||Ft&&Se)){const x={};["status","statusText","headers"].forEach(Je=>{x[Je]=le[Je]});const J=l.toFiniteNumber(_s.getContentLength()),[fe,Ee]=ie&&Rr(J,et(Cr(ie),!0))||[];let ys=0;const ya=Je=>{if(O&&(ys=Je,ys>W))throw new m("maxContentLength size of "+W+" exceeded",m.ERR_BAD_RESPONSE,S,F);fe&&fe(Je)};le=new o(Ir(le.body,Dr,ya,()=>{Ee&&Ee(),Se&&Se()}),x)}j=j||"text";let ue=await C[l.findKey(C,j)||"text"](le,S);if(O&&!y&&!Ft){let x;if(ue!=null&&(typeof ue.byteLength=="number"?x=ue.byteLength:typeof ue.size=="number"?x=ue.size:typeof ue=="string"&&(x=typeof s=="function"?new s().encode(ue).byteLength:ue.length)),typeof x=="number"&&x>W)throw new m("maxContentLength size of "+W+" exceeded",m.ERR_BAD_RESPONSE,S,F)}return!Ft&&Se&&Se(),await new Promise((x,J)=>{Or(x,J,{data:ue,headers:M.from(le.headers),status:le.status,statusText:le.statusText,config:S,request:F})})}catch(L){if(Se&&Se(),Y&&Y.aborted&&Y.reason instanceof m){const Q=Y.reason;throw Q.config=S,F&&(Q.request=F),L!==Q&&Object.defineProperty(Q,"cause",{__proto__:null,value:L,writable:!0,enumerable:!1,configurable:!0}),Q}if(We)throw F&&!We.request&&(We.request=F),We;if(L instanceof m)throw F&&!L.request&&(L.request=F),L;if(L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)){const Q=new m("Network Error",m.ERR_NETWORK,S,F,L&&L.response);throw Object.defineProperty(Q,"cause",{__proto__:null,value:L.cause||L,writable:!0,enumerable:!1,configurable:!0}),Q}throw m.from(L,L&&L.code,S,F,L&&L.response)}}},ji=new Map,Br=t=>{let e=t&&t.env||{};const{fetch:r,Request:s,Response:n}=e,i=[s,n,r];let o=i.length,a=o,c,d,u=ji;for(;a--;)c=i[a],d=u.get(c),d===void 0&&u.set(c,d=a?new Map:Li(e)),u=d;return d};Br();const At={http:qn,xhr:_i,fetch:{get:Br}};l.forEach(At,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{__proto__:null,value:e})}catch{}Object.defineProperty(t,"adapterName",{__proto__:null,value:e})}});const $r=t=>`- ${t}`,Ni=t=>l.isFunction(t)||t===null||t===!1;function Di(t,e){t=l.isArray(t)?t:[t];const{length:r}=t;let s,n;const i={};for(let o=0;o<r;o++){s=t[o];let a;if(n=s,!Ni(s)&&(n=At[(a=String(s)).toLowerCase()],n===void 0))throw new m(`Unknown adapter '${a}'`);if(n&&(l.isFunction(n)||(n=n.get(e))))break;i[a||"#"+o]=n}if(!n){const o=Object.entries(i).map(([c,d])=>`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let a=r?o.length>1?`since :
5
5
  `+o.map($r).join(`
6
6
  `):" "+$r(o[0]):"as no adapter specified";throw new m("There is no suitable adapter to dispatch the request "+a,m.ERR_NOT_SUPPORT)}return n}const qr={getAdapter:Di,adapters:At};function Pt(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Be(null,t)}function Tt(t){const e=l.toSafeFlatObject(t);return Pt(e),e.headers=M.from(l.getSafeProp(e,"headers")),e.data=Rt.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),qr.getAdapter(e.adapter||Fe.adapter,e)(e).then(function(r){Pt(e),e.response=r;try{r.data=Rt.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=M.from(r.headers),r},function(r){if(!Er(r)&&(Pt(e),r&&r.response)){e.response=r.response;try{r.response.data=Rt.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=M.from(r.response.headers)}return Promise.reject(r)})}const rt={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{rt[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const Vr={};rt.transitional=function(t,e,r){function s(n,i){return"[Axios v"+kt+"] Transitional option '"+n+"'"+i+(r?". "+r:"")}return(n,i,o)=>{if(t===!1)throw new m(s(i," has been removed"+(e?" in "+e:"")),m.ERR_DEPRECATED);return e&&!Vr[i]&&(Vr[i]=!0,console.warn(s(i," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(n,i,o):!0}},rt.spelling=function(t){return(e,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Ui(t,e,r){if(typeof t!="object"||t===null)throw new m("options must be an object",m.ERR_BAD_OPTION_VALUE);const s=Object.keys(t);let n=s.length;for(;n-- >0;){const i=s[n],o=Object.prototype.hasOwnProperty.call(e,i)?e[i]:void 0;if(o){const a=t[i],c=a===void 0||o(a,i,t);if(c!==!0)throw new m("option "+i+" must be "+c,m.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new m("Unknown option "+i,m.ERR_BAD_OPTION)}}const st={assertOptions:Ui,validators:rt},z=st.validators;let ye=class{constructor(t){this.defaults=t||{},this.interceptors={request:new _r,response:new _r}}async request(t,e){try{return await this._request(t,e)}catch(r){if(r instanceof Error)try{let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const n=s.stack;let i="";if(typeof n=="string"){const o=n.indexOf(`
7
7
  `);i=o===-1?"":n.slice(o+1)}if(!r.stack)r.stack=i;else if(i){const o=i.indexOf(`
8
8
  `),a=o===-1?-1:i.indexOf(`
9
9
  `,o+1),c=a===-1?"":i.slice(a+1);String(r.stack).endsWith(c)||(r.stack+=`
10
- `+i)}}catch{}throw r}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=_e(this.defaults,e);const{transitional:r,paramsSerializer:s,headers:n}=e;r!==void 0&&st.assertOptions(r,{silentJSONParsing:z.transitional(z.boolean),forcedJSONParsing:z.transitional(z.boolean),clarifyTimeoutError:z.transitional(z.boolean),legacyInterceptorReqResOrdering:z.transitional(z.boolean),advertiseZstdAcceptEncoding:z.transitional(z.boolean),validateStatusUndefinedResolves:z.transitional(z.boolean)},!1),s!=null&&(l.isFunction(s)?e.paramsSerializer={serialize:s}:st.assertOptions(s,{encode:z.function,serialize:z.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),st.assertOptions(e,{baseUrl:z.spelling("baseURL"),withXsrfToken:z.spelling("withXSRFToken")},!0),e.method=(l.getSafeProp(e,"method")||l.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=n&&l.merge(n.common,n[e.method]);n&&l.forEach(Sr.concat("common"),y=>{delete n[y]}),e.headers=M.concat(i,n);const o=[];let a=!0;this.interceptors.request.forEach(function(y){if(typeof y.runWhen=="function"&&y.runWhen(e)===!1)return;a=a&&y.synchronous;const C=e.transitional||Et;C&&C.legacyInterceptorReqResOrdering?o.unshift(y.fulfilled,y.rejected):o.push(y.fulfilled,y.rejected)});const c=[];this.interceptors.response.forEach(function(y){c.push(y.fulfilled,y.rejected)});let d,u=0,h;if(!a){const y=[Tt.bind(this),void 0];for(y.unshift(...o),y.push(...c),h=y.length,d=Promise.resolve(e);u<h;)d=d.then(y[u++],y[u++]);return d}h=o.length;let p=e;for(;u<h;){const y=o[u++],C=o[u++];try{p=y?y(p):p}catch(P){if(!C){d=Promise.reject(P);break}try{const v=C.call(this,P);l.isThenable(v)&&(d=Promise.resolve(v).then(()=>Tt.call(this,p)))}catch(v){d=Promise.reject(v)}break}}if(!d)try{d=Tt.call(this,p)}catch(y){d=Promise.reject(y)}for(u=0,h=c.length;u<h;)d=d.then(c[u++],c[u++]);return d}getUri(t){t=_e(this.defaults,t);const e=Ar(t.baseURL,t.url,t.allowAbsoluteUrls,t);return mr(e,t.params,t.paramsSerializer)}};l.forEach(["delete","get","head","options"],function(t){ye.prototype[t]=function(e,r){return this.request(_e(r||{},{method:t,url:e,data:r&&l.hasOwnProp(r,"data")?r.data:void 0}))}}),l.forEach(["post","put","patch","query"],function(t){function e(r){return function(s,n,i){return this.request(_e(i||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:n}))}}ye.prototype[t]=e(),t!=="query"&&(ye.prototype[t+"Form"]=e(!0))});let Fi=class vs{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(n){r=n});const s=this;this.promise.then(n=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](n);s._listeners=null}),this.promise.then=n=>{let i;const o=new Promise(a=>{s.subscribe(a),i=a}).then(n);return o.cancel=function(){s.unsubscribe(i)},o},e(function(n,i,o){s.reason||(s.reason=new Be(n,i,o),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=s=>{e.abort(s)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new vs(function(r){e=r}),cancel:e}}};function Bi(t){return function(e){return t.apply(null,e)}}function $i(t){return l.isObject(t)&&t.isAxiosError===!0}const nt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(nt).forEach(([t,e])=>{nt[e]===void 0&&(nt[e]=t)});function Mr(t){const e=new ye(t),r=Yt(ye.prototype.request,e);return l.extend(r,ye.prototype,e,{allOwnKeys:!0}),l.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return Mr(_e(t,s))},r}const U=Mr(Fe);U.Axios=ye,U.CanceledError=Be,U.CancelToken=Fi,U.isCancel=Er,U.VERSION=kt,U.toFormData=Qe,U.AxiosError=m,U.Cancel=U.CanceledError,U.all=function(t){return Promise.all(t)},U.spread=Bi,U.isAxiosError=$i,U.mergeConfig=_e,U.AxiosHeaders=M,U.formToJSON=t=>vr(l.isHTMLForm(t)?new FormData(t):t),U.getAdapter=qr.getAdapter,U.HttpStatusCode=nt,U.default=U;const{Axios:va,AxiosError:Sa,CanceledError:Ea,isCancel:Oa,CancelToken:xa,VERSION:Ra,all:Ca,Cancel:ka,isAxiosError:Aa,spread:Pa,toFormData:Ta,AxiosHeaders:Ia,HttpStatusCode:La,formToJSON:ja,getAdapter:Na,mergeConfig:Da,create:Ua}=U;function it(t){return t?.name==="AuthRequiredError"}const qi=new Set(["OpenC3::AuthError","OpenC3::ForbiddenError"]);function Vi(t){return t?.response?.status===401||t?.status===401||qi.has(t?.name)}function Mi(t){!it(t)&&!Vi(t)&&console.error(t)}class zr extends Error{constructor(e="Authentication required"){super(e),this.name="AuthRequiredError"}}globalThis.__openc3AuthRejectionHandler||(globalThis.__openc3AuthRejectionHandler=!0,globalThis.addEventListener?.("unhandledrejection",t=>{it(t.reason)&&t.preventDefault()}));let Wr=!1;function Jr(){Wr||(Wr=!0,OpenC3Auth.login())}async function zi(){try{await OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity)&&OpenC3Auth.setTokens()}catch(t){throw it(t)?t:(Jr(),new zr(t?.message))}if(!localStorage.openc3Token)throw Jr(),new zr}const Hr=U.create({baseURL:location.origin,timeout:6e4,params:{}});Hr.interceptors.response.use(t=>t,t=>{if(t.response){if(t.response.config.headers["Ignore-Errors"]&&t.response.config.headers["Ignore-Errors"].includes(t.response.status.toString()))return Promise.reject(t);if(t.response.status===401)return OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity,!0).then(function(n){n&&OpenC3Auth.setTokens()}).catch(Mi),Promise.reject(t);const e=t.response?.data?.error?.data?.class;if(e==="HazardousError"||e==="CriticalCmdError")return Promise.reject(t);let r=`HTTP ${t.response.status} - `;t.response?.statusText&&(r+=`${t.response.statusText} `),t.response?.config?.data&&(r+=`${t.response.config.data} `),t.response?.data?.message?r+=`${t.response.data.message}`:t.response?.data?.exception?r+=`${t.response.data.exception}`:t.response?.data?.error?.message?(t.response.data.error.class&&(r+=`${t.response.data.error.class} `),r+=`${t.response.data.error.message}`):r+=`${t.response?.data}`;const{$cosmosNotify:s}=window;throw s&&s.serious({title:"Network error",body:r}),t}else throw t});let ot=()=>({emit(t,...e){for(let r=this.events[t]||[],s=0,n=r.length;s<n;s++)r[s](...e)},events:{},on(t,e){return(this.events[t]||=[]).push(e),()=>{this.events[t]=this.events[t]?.filter(r=>e!==r)}}});class $e extends Error{constructor(e,r){e instanceof Error?(super(e.message),this.cause=e):super(e),this.reason=r,this.name="ReasonError"}}class It extends $e{constructor(e){super("Rejected",e),this.name="SubscriptionRejectedError"}}class Wi extends $e{constructor(e){super(e||"Timed out to receive subscription ack"),this.name="SubscriptionTimeoutError"}}class te extends $e{constructor(e,r){r?super(e,r):super("Disconnected",e),this.name="DisconnectedError"}}class Ji extends te{constructor(e){super(e,"stale_connection"),this.name="StaleConnectionError"}}function Kr(t){return t?`{${Object.keys(t).sort().filter(e=>t[e]!==void 0).map(e=>{let r=JSON.stringify(t[e]);return`${JSON.stringify(e)}:${r}`}).join(",")}}`:""}class Hi{constructor(e){this.channel=e,this.listeners=[]}watch(){this.listeners.push(this.channel.on("presence",e=>{if(e.type==="info"){this._state||(this._state=this.stateFromInfo(e));return}this._state&&(e.type==="join"?this._state[e.id]=e.info:e.type==="leave"&&delete this._state[e.id])}))}reset(){delete this._state}dispose(){delete this._info,delete this._state,this.listeners.forEach(e=>e()),this.listeners.length=0}async join(e,r){if(!this._info)return this._info={id:String(e),info:r},this.channel.perform("$presence:join",this._info)}async leave(){if(!this._info)return;let e=await this.channel.perform("$presence:leave");return delete this._info,e}async info(){return this._state?this._state:(this._promise||(this._promise=this._sync()),await this._promise,this._state)}async _sync(){this.watch();try{let e=await this.channel.perform("$presence:info",{});return this._state=this.stateFromInfo(e),this._state}finally{delete this._promise}}stateFromInfo(e){return e.records.reduce((r,{id:s,info:n})=>(r[s]=n,r),{})}}const we=Symbol("state");class Yr{constructor(e={}){this.emitter=ot(),this.params=Object.freeze(e),this.presence=new Hi(this),this.initialConnect=!0,this[we]="idle"}get identifier(){return this._identifier?this._identifier:(this._identifier=Kr({channel:this.channelId,...this.params}),this._identifier)}get channelId(){return this.constructor.identifier}get state(){return this[we]}attached(e){if(this.receiver){if(this.receiver!==e)throw Error("Already connected to a different receiver");return!1}return this.receiver=e,!0}connecting(){this[we]="connecting"}connected(){if(this.state==="connected"||this.state==="closed")return;this[we]="connected";let e=!1;this.initialConnect?(this.initialConnect=!1,this.emit("connect",{reconnect:!1,restored:e})):this.emit("connect",{reconnect:!0,restored:e})}restored(){if(this.state==="connected")throw Error("Already connected");this[we]="connected";let e=!0,r=!0;this.initialConnect=!1,this.emit("connect",{reconnect:r,restored:e})}disconnected(e){this.state==="disconnected"||this.state==="closed"||(this[we]="disconnected",this.presence.reset(),this.emit("disconnect",e))}closed(e){this.state!=="closed"&&(this[we]="closed",delete this.receiver,this.initialConnect=!0,this.presence.dispose(),this.emit("close",e))}disconnect(){this.state==="idle"||this.state==="closed"||this.receiver.unsubscribe(this)}async perform(e,r){if(this.state==="idle"||this.state==="closed")throw Error("Channel is not subscribed");return this.receiver.perform(this.identifier,e,r)}async send(e){return this.perform(void 0,e)}async whisper(e){try{await this.perform("$whisper",e)}catch(r){let s=this.receiver?this.receiver.logger:null;s&&s.warn("whisper failed: ",r)}}receive(e,r){this.emit("message",e,r)}on(e,r){return this.emitter.on(e,r)}once(e,r){let s=this.emitter.on(e,(...n)=>{s(),r(...n)});return s}emit(e,...r){return this.emitter.emit(e,...r)}ensureSubscribed(){return this.state==="connected"?Promise.resolve():this.state==="closed"?Promise.reject(Error("Channel is unsubscribed")):this.pendingSubscribe()}pendingSubscribe(){return this._pendingSubscribe?this._pendingSubscribe:(this._pendingSubscribe=new Promise((e,r)=>{let s=[()=>delete this._pendingSubscribe];s.push(this.on("connect",()=>{s.forEach(n=>n()),e()})),s.push(this.on("close",n=>{s.forEach(i=>i()),r(n||new $e("Channel was disconnected before subscribing","canceled"))}))}),this._pendingSubscribe)}}class Ki{constructor(e){this.id=e,this.intent="unsubscribed",this.state="idle",this.channels=[],this.disposed=!1,this._pendings=[]}add(e){this.channels.includes(e)||this.channels.push(e)}remove(e){let r=this.channels.indexOf(e);r>-1&&this.channels.splice(r,1)}notify(e,...r){this.state=e==="restored"?"connected":e,r.length===1?this.channels.forEach(s=>s[e](r[0])):this.channels.forEach(s=>s[e]())}pending(e){this._checkIntent(e);let r=this._pendings[0];return!r||r.intent!==e?Promise.resolve():r.promise}ensureResubscribed(){this.disposed||(this.intent=void 0,this.ensureSubscribed())}ensureSubscribed(){if(this.intent!=="subscribed"){if(this.disposed)throw Error("Subscription is disposed");this.intent="subscribed",!this._mergeWithPending("unsubscribed")&&this.subscriber(this)}}maybeUnsubscribe(){this.disposed||this.intent==="unsubscribed"||this.channels.length>0||(this.intent="unsubscribed",this._mergeWithPending("subscribed"))||this.unsubscriber(this)}async acquire(e){this._checkIntent(e);let r,s={promise:new Promise(i=>{r=i}),intent:e,release:()=>{this._pendings.splice(this._pendings.indexOf(s),1),r(s)},canceled:!1,acquired:!1},n=this._pendingTop;return this._pendings.push(s),n&&await n.promise,this.gvl&&await this.gvl.acquire(s,e),s.acquired=!0,s}close(e){this.disposed=!0,this.intent=void 0,this.notify("closed",e)}_checkIntent(e){if(!(e==="unsubscribed"||e==="subscribed"))throw Error(`Unknown subscription intent: ${e}`)}get _pendingTop(){return this._pendings.length?this._pendings[this._pendings.length-1]:void 0}_mergeWithPending(e){let r=this._pendingTop;return!r||r.acquired||r.intent!==e?!1:(this._pendings.pop(),r.canceled=!0,!0)}}class Yi{constructor(){this.queue=[]}async acquire(e,r){r==="subscribed"&&(this.queue.push(e.promise.then(()=>{this.queue.splice(this.queue.indexOf(e),1)})),this.queue.length>1&&await this.queue[this.queue.length-2])}}class Zi{constructor(e){e.concurrentSubscribes===!1&&(this.glv=new Yi),this._subscriptions={},this._localToRemote={}}all(){return Object.values(this._subscriptions)}get(e){return this._subscriptions[e]}create(e,{subscribe:r,unsubscribe:s}){let n=this._subscriptions[e]=new Ki(e);return n.remoteId=this._localToRemote[e],n.subscriber=r,n.unsubscriber=s,n.gvl=this.glv,n}remove(e){delete this._subscriptions[e],delete this._localToRemote[e]}storeRemoteId(e,r){this._localToRemote[e]=r;let s=this.get(e);s&&(s.remoteId=r)}}class Gi{constructor(e={}){this.subscriptions=new Zi(e),this._pendingMessages=[],this._remoteToLocal={}}subscribe(e,r){this._remoteToLocal[r]=e,this.subscriptions.storeRemoteId(e,r),this.flush(r)}unsubscribe(e){let r=this.subscriptions.get(e);if(!r)return;let s=r.remoteId;s&&delete this._remoteToLocal[s],this.subscriptions.remove(e)}transmit(e,r,s){let n=this._remoteToLocal[e];if(!n){this._pendingMessages.push([e,r,s]);return}let i=this.subscriptions.get(n);i&&i.channels.forEach(o=>{o.receive(r,s)})}notify(e,r,s){let n=this._remoteToLocal[e];if(!n)return;let i=this.subscriptions.get(n);i&&i.channels.forEach(o=>o.emit(r,s))}close(){this._pendingMessages.length=0}get size(){return this.channels.length}get channels(){return this.subscriptions.all().flatMap(e=>e.channels)}flush(e){let r=[];for(let s of this._pendingMessages)s[0]===e?this.transmit(s[0],s[1],s[2]):r.push(s);this._pendingMessages=r}}const Zr={debug:0,info:1,warn:2,error:3};class Gr{constructor(e){this.level=e||"warn"}log(e,r,s){Zr[e]<Zr[this.level]||this.writeLogEntry(e,r,s)}writeLogEntry(){throw Error("Not implemented")}debug(e,r){this.log("debug",e,r)}info(e,r){this.log("info",e,r)}warn(e,r){this.log("warn",e,r)}error(e,r){this.log("error",e,r)}}class qe extends Gr{writeLogEntry(){}}class Xi{encode(e){return JSON.stringify(e)}decode(e){try{return JSON.parse(e)}catch{}}}let Qi=0;class Xr{constructor(e={}){let{logger:r}=e;this.logger=r||new qe,this.pendingSubscriptions={},this.pendingUnsubscriptions={},this.subscribeCooldownInterval=e.subscribeCooldownInterval||250,this.subscribeRetryInterval=e.subscribeRetryInterval||5e3}attached(e){this.cable=e}subscribe(e,r){let s={channel:e};r&&Object.assign(s,r);let n=Kr(s);if(this.pendingUnsubscriptions[n]){let o=this.subscribeCooldownInterval*1.5;return this.logger.debug(`unsubscribed recently, cooldown for ${o}`,n),new Promise(a=>{setTimeout(()=>{a(this.subscribe(e,r))},o)})}if(this.pendingSubscriptions[n])return this.logger.warn("subscription is already pending, skipping",n),Promise.reject(Error("Already subscribing"));let i=this.subscribeRetryInterval;return new Promise((o,a)=>{let c=++Qi;this.pendingSubscriptions[n]={resolve:o,reject:a,id:c},this.cable.send(this.buildSubscribeRequest(n)),this.maybeRetrySubscribe(c,n,i)})}buildSubscribeRequest(e){return{command:"subscribe",identifier:e}}maybeRetrySubscribe(e,r,s){setTimeout(()=>{let n=this.pendingSubscriptions[r];n&&n.id===e&&(this.logger.warn(`no subscription ack received in ${s}ms, retrying subscribe`,r),this.cable.send(this.buildSubscribeRequest(r)),this.maybeExpireSubscribe(e,r,s))},s)}maybeExpireSubscribe(e,r,s){setTimeout(()=>{let n=this.pendingSubscriptions[r];n&&n.id===e&&(delete this.pendingSubscriptions[r],n.reject(new Wi(`Haven't received subscription ack in ${s*2}ms for ${r}`)))},s)}unsubscribe(e){return this.cable.send({command:"unsubscribe",identifier:e}),this.pendingUnsubscriptions[e]=!0,setTimeout(()=>{delete this.pendingUnsubscriptions[e]},this.subscribeCooldownInterval),Promise.resolve()}perform(e,r,s){return r==="$whisper"?this.whisper(e,s):(s||(s={}),s.action||=r,this.cable.send({command:"message",identifier:e,data:JSON.stringify(s)}),Promise.resolve())}whisper(e,r){return this.cable.send({command:"whisper",identifier:e,data:r}),Promise.resolve()}receive(e){if(typeof e!="object"){this.logger.error("unsupported message format",{message:e});return}let{type:r,identifier:s,message:n,reason:i,reconnect:o}=e;if(r==="ping")return this.cable.keepalive(e.message);if(this.cable.keepalive(),r==="welcome"){let a=e.sid;return a&&this.cable.setSessionId(a),this.cable.connected()}if(r==="disconnect"){let a=new te(i);this.reset(a),o===!1?this.cable.closed(a):this.cable.disconnected(a);return}if(r==="confirm_subscription"){let a=this.pendingSubscriptions[s];if(!a){this.logger.error("subscription not found, unsubscribing",{type:r,identifier:s}),this.unsubscribe(s);return}return delete this.pendingSubscriptions[s],a.resolve(s)}if(r==="reject_subscription"){let a=this.pendingSubscriptions[s];return a?(delete this.pendingSubscriptions[s],a.reject(new It)):this.logger.error("subscription not found",{type:r,identifier:s})}if(n)return{identifier:s,message:n};this.logger.warn(`unknown message type: ${r}`,{message:e})}reset(e){for(let r in this.pendingSubscriptions)this.pendingSubscriptions[r].reject(e);this.pendingSubscriptions={}}recoverableClosure(){return!1}}const Qr=()=>Date.now()/1e3|0;class eo extends Xr{constructor(e={}){super(e),this.streamsPositions={},this.subscriptionStreams={},this.pendingHistory={},this.pendingPresence={},this.presenceInfo={},this.restoreSince=e.historyTimestamp,this.disableSessionRecovery=e.disableSessionRecovery,this.restoreSince===void 0&&(this.restoreSince=Qr()),this.sessionId=void 0,this.sendPongs=e.pongs}reset(e){for(let r in this.pendingPresence)this.pendingPresence[r].reject(e);return this.pendingPresence={},super.reset()}receive(e){if(typeof e!="object"){this.logger.error("unsupported message format",{message:e});return}let{type:r,identifier:s,message:n}=e;if(r==="disconnect")return delete this.sessionId,this.cable.setSessionId(""),super.receive(e);if(r==="reject_subscription")return super.receive(e);if(r==="confirm_subscription")return this.subscriptionStreams[s]||(this.subscriptionStreams[s]=new Set),super.receive(e);if(r==="ping")return this.restoreSince&&(this.restoreSince=Qr()),this.sendPongs&&this.sendPong(),this.cable.keepalive(e.message);if(this.cable.keepalive(),r==="confirm_history"){this.logger.debug("history result received",e),this.cable.notify("history_received",s);return}if(r==="reject_history"){this.logger.warn("failed to retrieve history",e),this.cable.notify("history_not_found",s);return}if(r==="welcome"){if(this.disableSessionRecovery||(this.sessionId=e.sid,this.sessionId&&this.cable.setSessionId(this.sessionId)),e.restored){let i=e.restored_ids||Object.keys(this.subscriptionStreams);for(let o of i)this.cable.send({identifier:o,command:"history",history:this.historyRequestFor(o)}),this.presenceInfo[o]&&this.cable.send({identifier:o,command:"join",presence:this.presenceInfo[o]});return this.cable.restored(i)}return this.cable.connected(this.sessionId)}if(r==="presence"){let i=n.type;if(i==="info"){let o=this.pendingPresence[s];o&&(delete this.pendingPresence[s],o.resolve(n))}else if(i==="error"){let o=this.pendingPresence[s];o&&(delete this.pendingPresence[s],o.reject(new Error("failed to retrieve presence")))}return{type:r,identifier:s,message:n}}if(n){let i=this.trackStreamPosition(s,e.stream_id,e.epoch,e.offset);return{identifier:s,message:n,meta:i}}this.logger.warn(`unknown message type: ${r}`,{message:e})}perform(e,r,s){switch(r){case"$presence:join":return this.join(e,s);case"$presence:leave":return this.leave(e,s);case"$presence:info":return this.presence(e,s)}return super.perform(e,r,s)}unsubscribe(e){return delete this.presenceInfo[e],super.unsubscribe(e)}buildSubscribeRequest(e){let r=super.buildSubscribeRequest(e),s=this.historyRequestFor(e);s&&(r.history=s,this.pendingHistory[e]=!0);let n=this.presenceInfo[e];return n&&(r.presence=n),r}recoverableClosure(){return!!this.sessionId}historyRequestFor(e){let r={},s=!1;if(this.subscriptionStreams[e])for(let n of this.subscriptionStreams[e]){let i=this.streamsPositions[n];i&&(s=!0,r[n]=i)}if(!(!s&&!this.restoreSince))return{since:this.restoreSince,streams:r}}trackStreamPosition(e,r,s,n){if(!(!r||!s))return this.subscriptionStreams[e]||(this.subscriptionStreams[e]=new Set),this.subscriptionStreams[e].add(r),this.streamsPositions[r]={epoch:s,offset:n},{stream:r,epoch:s,offset:n}}async sendPong(){await new Promise(e=>setTimeout(e,0)),this.cable.state==="connected"&&this.cable.send({command:"pong"})}async join(e,r){return this.presenceInfo[e]=r,this.cable.send({command:"join",identifier:e,presence:r}),Promise.resolve()}async leave(e,r){return delete this.presenceInfo[e],this.cable.send({command:"leave",identifier:e,presence:r}),Promise.resolve()}presence(e,r){return this.pendingPresence[e]?(this.logger.warn("presence is already pending, skipping",e),Promise.reject(Error("presence request is already pending"))):new Promise((s,n)=>{this.pendingPresence[e]={resolve:s,reject:n},this.cable.send({command:"presence",identifier:e,data:r})})}}class to extends $e{constructor(){super("No connection","closed"),this.name="NoConnectionError"}}class es extends Yr{static identifier="__ghost__";constructor(e,r){super(r),this.channelId=e}set channelId(e){this._channelId=e}get channelId(){return this._channelId}}const ro="$pubsub";class ts extends Yr{static identifier=ro;async perform(e,r){if(e.startsWith("$"))return super.perform(e,r);throw Error("not implemented")}}const ve=Symbol("state");let so=class{constructor({transport:t,protocol:e,encoder:r,logger:s,lazy:n,hubOptions:i,performFailures:o,transportConfigurator:a}){this.emitter=ot(),this.transport=t,this.encoder=r,this.logger=s||new qe,this.protocol=e,this.performFailures=o||"throw",this.protocol.attached(this),this.hub=new Gi(i||{}),this[ve]="idle",this.handleClose=this.handleClose.bind(this),this.handleIncoming=this.handleIncoming.bind(this),this.transportConfigurator=a,this.transport.on("close",this.handleClose),this.transport.on("data",this.handleIncoming),this.initialConnect=!0,this.recovering=!1,n===!1&&this.connect().catch(()=>{})}get state(){return this[ve]}async connect(){if(this.state==="connected")return Promise.resolve();if(this.state==="connecting")return this.pendingConnect();let t=this.state==="idle";this[ve]="connecting";let e=this.pendingConnect();this.logger.debug("connecting");try{this.transportConfigurator&&await this.transportConfigurator(this.transport,{initial:t}),await this.transport.open()}catch(r){this.handleClose(r)}return e}setSessionId(t){this.sessionId=t,this.transport.setParam("sid",t)}connected(){if(this.state==="connected")return;this.logger.info("connected"),this[ve]="connected",this.recovering&&this.hub.subscriptions.all().forEach(e=>e.notify("disconnected",new te("recovery_failed"))),this.hub.subscriptions.all().forEach(e=>this._resubscribe(e));let t=!1;this.recovering=!1,this.initialConnect?(this.initialConnect=!1,this.emit("connect",{reconnect:!1,restored:t})):this.emit("connect",{reconnect:!0,restored:t})}restored(t){this.logger.info("connection recovered",{remoteIds:t}),this[ve]="connected",this.hub.subscriptions.all().forEach(s=>{t&&s.remoteId&&t.includes(s.remoteId)?s.notify("restored"):(s.notify("disconnected",new te("recovery_failed")),this._resubscribe(s))});let e=!this.initialConnect,r=!0;this.recovering=!1,this.initialConnect=!1,this.emit("connect",{reconnect:e,restored:r})}notify(t,e,r){e&&typeof e!="string"&&(r=e,e=void 0),e?this.hub.notify(e,"info",{type:t,data:r}):this.emit("info",{type:t,data:r})}handleClose(t){this.logger.debug("transport closed",{error:t}),this.disconnected(new te(t,"transport_closed"))}disconnected(t){(this.state==="connected"||this.state==="connecting")&&(this.logger.info("disconnected",{reason:t}),this[ve]="disconnected",this.recovering=this.protocol.recoverableClosure(t),this.recovering?this.hub.subscriptions.all().forEach(e=>e.notify("connecting")):this.hub.subscriptions.all().forEach(e=>{e.notify("disconnected",t)}),this.protocol.reset(t),this.hub.close(),this.transport.close(),this.emit("disconnect",t))}closed(t){if(this.state==="closed"||this.state==="idle")return;let e;t&&(e=t instanceof te?t:new te(t,void 0)),this.logger.info("closed",{reason:t||"user"}),this[ve]="closed";let r=e||new te("cable_closed");this.hub.subscriptions.all().forEach(s=>s.notify("disconnected",r)),this.hub.close(),this.protocol.reset(),this.transport.close(),this.initialConnect=!0,this.emit("close",e)}disconnect(){this.closed()}handleIncoming(t){if(this.state==="closed"||this.state==="idle")return;let e=this.encoder.decode(t);if(e===void 0){this.logger.error("failed to decode message",{message:t});return}this.logger.debug("incoming data",e);let r=this.protocol.receive(e);if(r){this.logger.debug("processed incoming message",r);let{type:s,identifier:n,message:i,meta:o}=r;s?this.hub.notify(n,s,i):this.hub.transmit(n,i,o)}}send(t){if(this.state==="closed")throw Error("Cable is closed");let e=this.encoder.encode(t);if(e===void 0){this.logger.error("failed to encode message",{message:t});return}this.logger.debug("outgoing message",t),this.transport.send(e)}keepalive(t){this.emit("keepalive",t)}streamFrom(t){let e=new ts({stream_name:t});return this.subscribe(e)}streamFromSigned(t){let e=new ts({signed_stream_name:t});return this.subscribe(e)}subscribeTo(t,e){let r,s;return typeof t=="string"&&(s=t,t=es),r=s?new t(s,e):new t(e),this.subscribe(r)}subscribe(t){if(!t.attached(this))return t;let e=t.identifier;t.connecting();let r=this.hub.subscriptions.get(e)||this.hub.subscriptions.create(e,{subscribe:s=>this._subscribe(s,t.channelId,t.params),unsubscribe:s=>this._unsubscribe(s)});return r.add(t),r.intent==="subscribed"&&r.state==="connected"&&t.connected(),r.ensureSubscribed(),t}async _resubscribe(t){t.intent!=="subscribed"||!t.channels[0]||(t.notify("connecting"),t.ensureResubscribed())}async _subscribe(t,e,r){let s=t.id;if(this.state==="idle"&&this.connect().catch(()=>{}),this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:s});return}this.logger.debug("acquiring subscribe lock",{identifier:s});let n=await t.acquire("subscribed");if(n.canceled){this.logger.debug("subscribe lock has been canceled",{identifier:s}),n.release();return}if(this.logger.debug("subscribe lock has been acquired",{identifier:s}),t.intent!=="subscribed"){this.logger.debug("cancel subscribe request, already unsubscribed"),n.release();return}if(this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:s}),n.release();return}if(t.state==="connected"){this.logger.debug("already connected, skip subscribe command",{identifier:s}),t.notify("connected"),n.release();return}let i={identifier:e,params:r};this.logger.debug("subscribing",i);try{let o=await this.protocol.subscribe(e,r);this.hub.subscribe(s,o),this.logger.debug("subscribed",{...i,remoteId:o}),t.notify("connected")}catch(o){if(o){if(o instanceof It&&this.logger.warn("rejected",i),o instanceof te){this.logger.debug("disconnected during subscription; will retry on connect",i),n.release();return}this.logger.error("failed to subscribe",{error:o,...i})}t.close(o),this.hub.unsubscribe(s)}n.release()}unsubscribe(t){let e=t.identifier,r=this.hub.subscriptions.get(e);if(!r)throw Error(`Subscription not found: ${e}`);r.remove(t),t.closed(),r.maybeUnsubscribe()}async _unsubscribe(t){let e=t.id;this.logger.debug("acquiring unsubscribe lock",{identifier:e});let r=await t.acquire("unsubscribed");if(r.canceled){this.logger.debug("unsubscribe lock has been canceled",{identifier:e}),r.release();return}if(this.logger.debug("unsubscribe lock has been acquired",{identifier:e}),t.intent!=="unsubscribed"){this.logger.debug("cancel unsubscribe, no longer needed",{identifier:e,intent:t.intent}),r.release();return}if(t.state==="disconnected"||t.state==="closed"){this.logger.debug(`already ${t.state} connected, skip unsubscribe command`,{identifier:e}),r.release();return}let s=t.remoteId;if(this.logger.debug("unsubscribing...",{remoteId:s}),this.state!=="connected"){this.logger.debug("unsubscribe skipped (cable is not connected)",{id:e}),t.close(),this.hub.unsubscribe(e),r.release();return}try{await this.protocol.unsubscribe(s),this.logger.debug("unsubscribed remotely",{id:e})}catch(n){n&&(n instanceof te?this.logger.debug("cable disconnected during the unsubscribe command execution",{id:e,error:n}):this.logger.error("unsubscribe failed",{id:e,error:n}))}t.intent==="unsubscribed"?(t.close(),this.hub.unsubscribe(e)):t.state="closed",r.release()}async perform(t,e,r){if(this.performFailures==="throw")return this._perform(t,e,r);try{return await this._perform(t,e,r)}catch(s){this.performFailures==="warn"&&this.logger.warn("perform failed",{error:s});return}}async _perform(t,e,r){if(this.state==="connecting"&&await this.pendingConnect(),this.state==="closed"||this.state==="disconnected")throw new to;let s=this.hub.subscriptions.get(t);if(!s)throw Error(`Subscription not found: ${t}`);if(await s.pending("subscribed"),s.intent!=="subscribed")throw Error(`Subscription is closed: ${t}`);let n=s.remoteId,i={id:n,action:e,payload:r};this.logger.debug("perform",i);try{let o=await this.protocol.perform(n,e,r);return o&&this.logger.debug("perform result",{message:o,request:i}),o}catch(o){throw this.logger.error("perform failed",{error:o,request:i}),o}}on(t,e){return this.emitter.on(t,e)}once(t,e){let r=this.emitter.on(t,(...s)=>{r(),e(...s)});return r}emit(t,...e){return this.emitter.emit(t,...e)}pendingConnect(){return this._pendingConnect?this._pendingConnect:(this._pendingConnect=new Promise((t,e)=>{let r=[()=>delete this._pendingConnect];r.push(this.on("connect",()=>{r.forEach(s=>s()),t()})),r.push(this.on("close",s=>{r.forEach(n=>n()),e(s)})),r.push(this.on("disconnect",s=>{r.forEach(n=>n()),e(s)}))}),this._pendingConnect)}};const no={maxMissingPings:2,maxReconnectAttempts:1/0},ke=()=>Date.now(),rs=(t,e)=>{e=e||{};let{backoffRate:r,jitterRatio:s,maxInterval:n}=e;return r=r||2,s===void 0&&(s=.5),i=>{let o=t*r**i,a=o*r,c=o+(a-o)*Math.random(),d=2*(Math.random()-.5)*s;return c=c*(1+d),n&&n<c&&(c=n),c}};let ss=class{constructor({pingInterval:t,...e}){if(this.pingInterval=t,!this.pingInterval)throw Error(`Incorrect pingInterval is provided: ${t}`);if(e=Object.assign({},no,e),this.strategy=e.reconnectStrategy,!this.strategy)throw Error("Reconnect strategy must be provided");this.maxMissingPings=e.maxMissingPings,this.maxReconnectAttempts=e.maxReconnectAttempts,this.logger=e.logger||new qe,this.state="pending_connect",this.attempts=0,this.disconnectedAt=ke()}watch(t){this.target=t,this.initListeners()}reconnectNow(){return this.state==="connected"||this.state==="pending_connect"||this.state==="closed"?!1:(this.cancelReconnect(),this.state="pending_connect",this.target.connect().catch(t=>{this.logger.info("Failed at reconnecting: "+t)}),!0)}initListeners(){this.unbind=[],this.unbind.push(this.target.on("connect",()=>{this.attempts=0,this.pingedAt=ke(),this.state="connected",this.cancelReconnect(),this.startPolling()})),this.unbind.push(this.target.on("disconnect",()=>{this.disconnectedAt=ke(),this.state="disconnected",this.stopPolling(),this.scheduleReconnect()})),this.unbind.push(this.target.on("close",()=>{this.disconnectedAt=ke(),this.state="closed",this.cancelReconnect(),this.stopPolling()})),this.unbind.push(this.target.on("keepalive",()=>{this.pingedAt=ke()})),this.unbind.push(()=>{this.cancelReconnect(),this.stopPolling()})}dispose(){delete this.target,this.unbind&&this.unbind.forEach(t=>t()),delete this.unbind}startPolling(){this.pollId&&clearTimeout(this.pollId);let t=this.pingInterval+(Math.random()-.5)*this.pingInterval*.5;this.pollId=setTimeout(()=>{this.checkStale(),this.state==="connected"&&this.startPolling()},t)}stopPolling(){this.pollId&&clearTimeout(this.pollId)}checkStale(){let t=ke()-this.pingedAt;t>this.maxMissingPings*this.pingInterval&&(this.logger.warn(`Stale connection: ${t}ms without pings`),this.state="pending_disconnect",this.target.disconnected(new Ji))}scheduleReconnect(){if(this.attempts>=this.maxReconnectAttempts){this.target.close();return}let t=this.strategy(this.attempts);this.attempts++,this.logger.info(`Reconnecting in ${t}ms (${this.attempts} attempt)`),this.state="pending_reconnect",this.reconnnectId=setTimeout(()=>this.reconnectNow(),t)}cancelReconnect(){this.reconnnectId&&(clearTimeout(this.reconnnectId),delete this.reconnnectId)}};class io{constructor(e,r={}){this.transports=e,this.transport=null,this.emitter=ot(),this.unbind=[],this.logger=r.logger||new qe}displayName(){return"fallbacked transport"}async open(){for(let e=0;e<this.transports.length;e++){let r=this.transports[e];try{this.transport=r,this.resetListeners(),this.logger.debug(`Trying to connect via ${r.displayName()}`),await r.open(),this.logger.debug(`Connected via ${r.displayName()}`);return}catch(s){this.logger.debug(`Failed to connect via ${r.displayName()}: ${s.message}`)}}throw this.transport=null,this.resetListeners(),new Error("Couldn't connect via any available transport")}send(e){if(!this.transport)throw new Error("No transport is open");this.transport.send(e)}async close(){if(!this.transport)throw new Error("No transport is open");await this.transport.close(),this.transport=null}setURL(){throw new Error("Not implemented. Set URL for each transport separately")}setParam(e,r){this.transports.forEach(s=>{s.setParam(e,r)})}setToken(e,r){this.transports.forEach(s=>{s.setToken(e,r)})}on(e,r){return this.emitter.on(e,r)}once(e,r){let s=this.emitter.on(e,(...n)=>{s(),r(...n)});return s}get url(){return this.transport?this.transport.url:""}resetListeners(){this.unbind.forEach(e=>e()),this.unbind.length=0,this.transport&&this.unbind.push(this.transport.on("open",()=>{this.emitter.emit("open")}),this.transport.on("data",e=>{this.emitter.emit("data",e)}),this.transport.on("close",e=>{this.emitter.emit("close",e)}),this.transport.on("error",e=>{this.emitter.emit("error",e)}))}}class oo{constructor(e,r={}){this.url=e;let s=r.websocketImplementation;if(s)this.Impl=s;else if(typeof WebSocket<"u")this.Impl=WebSocket;else throw new Error("No WebSocket support");this.connected=!1,this.emitter=ot();let{format:n,subprotocol:i,authStrategy:o}=r;this.format=n||"text",this.connectionOptions=r.websocketOptions,this.authStrategy=o||"param",this.authProtocol="",this.subprotocol=i}displayName(){return"WebSocket("+this.url+")"}open(){let e=this.subprotocol;return this.authStrategy==="sub-protocol"&&(e=[this.subprotocol,this.authProtocol]),this.connectionOptions?this.ws=new this.Impl(this.url,e,this.connectionOptions):this.ws=new this.Impl(this.url,e),this.ws.binaryType="arraybuffer",this.initListeners(),new Promise((r,s)=>{let n=[];n.push(this.once("open",()=>{n.forEach(i=>i()),r()})),n.push(this.once("close",()=>{n.forEach(i=>i()),s(Error("WS connection closed"))}))})}setURL(e){this.url=e}setParam(e,r){let s=new URL(this.url);s.searchParams.set(e,r);let n=`${s.protocol}//${s.host}${s.pathname}?${s.searchParams}`;this.setURL(n)}setToken(e,r="jid"){if(this.authStrategy==="param")this.setParam(r,e);else if(this.authStrategy==="header"){this.connectionOptions=this.connectionOptions||{},this.connectionOptions.headers=this.connectionOptions.headers||{};let s=`x-${r}`.toLowerCase();s=Object.keys(this.connectionOptions.headers).find(n=>n.toLowerCase()===s)||s,this.connectionOptions.headers[s]=e}else if(this.authStrategy==="sub-protocol")this.authProtocol=`anycable-token.${e}`;else throw new Error("Unknown auth strategy: "+this.authStrategy)}send(e){if(!this.ws||!this.connected)throw Error("WebSocket is not connected");this.ws.send(e)}close(){this.ws?this.onclose():this.connected=!1}on(e,r){return this.emitter.on(e,r)}once(e,r){let s=this.emitter.on(e,(...n)=>{s(),r(...n)});return s}initListeners(){this.ws.onerror=e=>{this.connected&&this.emitter.emit("error",e.error||new Error("WS Error"))},this.ws.onclose=()=>{this.onclose()},this.ws.onmessage=e=>{let r=e.data;this.format==="binary"&&(r=new Uint8Array(r)),this.emitter.emit("data",r)},this.ws.onopen=()=>{this.connected=!0,this.emitter.emit("open")}}onclose(){this.ws.onclose=void 0,this.ws.onmessage=void 0,this.ws.onopen=void 0,this.ws.close(),delete this.ws,this.connected=!1,this.emitter.emit("close")}}class ao{constructor(e){this.channel=e}notify(e,...r){typeof this[e]=="function"&&this[e](...r)}perform(e,r={}){this.channel.perform(e,r)}send(e){this.channel.send(e)}whisper(e){return this.channel.whisper(e)}get identifier(){return this.channel.identifier}unsubscribe(){return this.channel.disconnect()}}class co extends es{constructor(e,r,s){super(e,r),this.subscription=new ao(this),Object.assign(this.subscription,s),this.on("connect",({reconnect:n})=>this.subscription.notify("connected",{reconnected:n})),this.on("disconnect",()=>this.subscription.notify("disconnected",{allowReconnect:!0})),this.on("message",n=>this.subscription.notify("received",n)),this.on("close",n=>{n&&n instanceof It?this.subscription.notify("rejected"):this.subscription.notify("disconnected",{allowReconnect:!1})})}}class lo{constructor(e){this.cable=e}create(e,r){let s,n;typeof e=="object"?(s=e.channel,delete e.channel,n=e):(s=e,n={});let i=new co(s,n,r);return i.subscription.notify("initialized"),this.cable.subscribe(i),i.subscription}findAll(e){return this.cable.hub.channels.filter(r=>r.identifier===e).map(r=>r.subscription)}}class uo{constructor(e){this.cable=e,this.subscriptions=new lo(e)}send(e){return this.cable.send(e)}connect(){return this.cable.connect()}disconnect(){return this.cable.disconnect()}ensureActiveConnection(){return this.cable.connect()}}const ns={protocol:"actioncable-v1-json",pingInterval:3e3,maxReconnectAttempts:1/0,maxMissingPings:2,logLevel:"warn",lazy:!0};function ho(t,e){if(typeof t=="object"&&typeof e>"u"&&(e=t,t=void 0),e=e||{},!t&&!e.transport)throw Error("URL or transport must be specified");e=Object.assign({},ns,e);let{protocol:r,websocketImplementation:s,websocketFormat:n,websocketOptions:i,websocketAuthStrategy:o,fallbacks:a,logLevel:c,logger:d,transport:u,encoder:h,lazy:p,monitor:y,pingInterval:C,reconnectStrategy:P,maxMissingPings:v,maxReconnectAttempts:S,subprotocol:g,tokenRefresher:b,historyTimestamp:f,protocolOptions:I,concurrentSubscribes:R,performFailures:H,transportConfigurator:ie,auth:k}=e;if(d=d||new qe(c),typeof r=="string"){g=g||r;let re=r.substring(0,r.lastIndexOf("-")),ae=r.substring(r.lastIndexOf("-")+1);if(I=I||{},re==="actioncable-v1")r=new Xr({logger:d,...I});else if(re==="actioncable-v1-ext")r=new eo({logger:d,historyTimestamp:f,...I});else throw Error(`Protocol is not supported yet: ${r}`);if(ae==="json")h=h||new Xi,n=n||"text";else if(ae==="msgpack"){if(n="binary",!h)throw Error("Msgpack encoder must be specified explicitly. Use `@anycable/msgpack-encoder` package or build your own")}else if(ae==="protobuf"){if(n=n||"binary",!h)throw Error("Protobuf encoder must be specified explicitly. Use `@anycable/protobuf-encoder` package or build your own")}else throw Error(`Protocol is not supported yet: ${r}`)}if(!r)throw Error("Protocol must be specified");u=u||new oo(t,{websocketImplementation:s,websocketOptions:i,subprotocol:g,authStrategy:o,format:n}),a&&(u=new io([u,...a],{logger:d})),k&&k.token&&u.setToken(k.token,k.param||"jid"),P=P||rs(C),y!==!1&&(y=y||new ss({pingInterval:C,reconnectStrategy:P,maxMissingPings:v,maxReconnectAttempts:S,logger:d}));let j={concurrentSubscribes:R},q=new so({protocol:r,transport:u,encoder:h,logger:d,lazy:p,hubOptions:j,performFailures:H,transportConfigurator:ie});return y&&(y.watch(q),q.monitor=y),b&&fo(q,async()=>{try{await b(u)}catch(re){return d.error("Failed to refresh authentication token: "+re),!1}return q.connect().catch(()=>{}),!0}),q}function fo(t,e){let r=!1;t.on("connect",()=>r=!1),t.on("close",async s=>{if(s){if(r){t.logger.warn("Token auto-refresh is disabled",s);return}s.reason==="token_expired"&&(r=!0,await e())}})}class po extends Gr{writeLogEntry(e,r,s){s?console[e](r,s):console[e](r)}}class mo extends ss{watch(e){super.watch(e),this.initActivityListeners()}initActivityListeners(){if(typeof document<"u"&&typeof window<"u"&&document.addEventListener&&window.addEventListener){let e=()=>{document.hidden||this.reconnectNow()&&this.logger.debug("Trigger reconnect due to visibility change")},r=n=>{this.reconnectNow()&&this.logger.debug("Trigger reconnect",{event:n})},s=()=>this.disconnect(new te("page_frozen"));document.addEventListener("visibilitychange",e,!1),window.addEventListener("focus",r,!1),window.addEventListener("online",r,!1),window.addEventListener("resume",r,!1),window.addEventListener("freeze",s,!1),this.unbind.push(()=>{document.removeEventListener("visibilitychange",e,!1),window.removeEventListener("focus",r,!1),window.removeEventListener("online",r,!1),window.removeEventListener("resume",r,!1),window.removeEventListener("freeze",s,!1)})}}disconnect(e){this.state==="disconnected"||this.state==="closed"||(this.logger.info("Disconnecting",{reason:e.message}),this.cancelReconnect(),this.stopPolling(),this.state="pending_disconnect",this.target.disconnected(e))}}const go=["cable","action-cable"],bo="/cable",at=(t,e)=>{for(let r of go){let s=t.head.querySelector(`meta[name='${r}-${e}']`);if(s)return s.getAttribute("content")}},is=t=>t.match(/wss?:\/\//)?t:typeof window<"u"?`${window.location.protocol.replace("http","ws")}//${window.location.host}${t}`:t,_o=()=>{if(typeof document<"u"&&document.head){let t=at(document,"url");if(t)return is(t)}return is(bo)},yo=()=>{if(typeof document<"u"&&document.head){let t=at(document,"history-timestamp");if(t)return t|0}},wo=()=>{if(typeof document<"u"&&document.head)return at(document,"token")},vo=()=>{if(typeof document<"u"&&document.head)return at(document,"token-param")};function So(t,e){typeof t=="object"&&typeof e>"u"&&(e=t,t=void 0),t=t||_o(),e=e||{},e.historyTimestamp||=yo();let r=wo();if(r){let d=vo();e.auth=Object.assign({token:r,param:d},e.auth||{})}e=Object.assign({},ns,e);let{logLevel:s,logger:n,pingInterval:i,reconnectStrategy:o,maxMissingPings:a,maxReconnectAttempts:c}=e;return n=e.logger=e.logger||new po(s),o=e.reconnectStrategy=e.reconnectStrategy||rs(i),e.monitor!==!1&&(e.monitor=e.monitor||new mo({pingInterval:i,reconnectStrategy:o,maxMissingPings:a,maxReconnectAttempts:c,logger:n})),ho(t,e)}function Eo(t,e){let r=So(t,e);return new uo(r)}const Oo=1e3;class xo{constructor(e,r,s,n,i){this._cable=e,this._channel=r,this._scope=s,this._callbacks=n,this._additionalOptions=i,this._subscription=null,this._unsubscribed=!1}get identifier(){return this._subscription?.identifier}perform(e,r){return this._subscription?.perform(e,r)}send(e){return this._subscription?.send(e)}unsubscribe(){return this._unsubscribed=!0,this._cable._forget(this),this._subscription?.unsubscribe()}_subscribe(e){this._unsubscribed||(this._subscription=e.subscriptions.create({channel:this._channel,token:localStorage.openc3Token,...this._additionalOptions},{...this._callbacks,disconnected:r=>{this._unsubscribed||(r?.allowReconnect===!1&&this._cable._scheduleRecovery(),this._callbacks.disconnected?.(r))}}))}}class os{constructor(e="/openc3-api/cable"){this._cable=null,this._url=e,this._subscriptions=new Set,this._recovery=null}disconnect(){this._cancelRecovery(),this._subscriptions.forEach(e=>{e._unsubscribed=!0}),this._subscriptions.clear(),this._cable&&(this._cable.cable.disconnect(),this._cable=null)}createSubscription(e,r,s={},n={}){const i=new xo(this,e,r,s,n);return this._subscriptions.add(i),this._resubscribe(i).then(()=>i)}_resubscribe(e){if(this._cable==null){const r=new URL(this._url,document.baseURI);r.searchParams.set("scope",e._scope),this._cable=Eo(r.href)}return OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity).then(r=>{r&&OpenC3Auth.setTokens(),this._cable&&e._subscribe(this._cable)}).catch(r=>{if(!it(r))throw r})}_scheduleRecovery(){this._recovery||(this._recovery=setTimeout(()=>{const e=[...this._subscriptions];this._cable&&(this._cable.cable.disconnect(),this._cable=null),e.reduce((r,s)=>r.then(()=>this._resubscribe(s)),Promise.resolve()).catch(r=>console.error("failed to recover cable",r)).finally(()=>{this._recovery=null})},Oo))}_cancelRecovery(){this._recovery&&(clearTimeout(this._recovery),this._recovery=null)}_forget(e){this._subscriptions.delete(e),this._subscriptions.size===0&&this._cancelRecovery()}recordPing(){}}function Ve(t){return Ro.test(t)}const Ro=/^-?[0-9]+$/;function as(t){return Co.test(t)}const Co=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function cs(t,e){if(Ve(t))return Number.isSafeInteger(Number.parseInt(t,10));const r=Number.parseFloat(t),s=String(r);if(t===s)return!0;const n=ls(t),i=ls(s);return!!(n===i||e?.approx===!0&&!Ve(t)&&i.length>=14&&n.startsWith(i.substring(0,14)))}let Me=(function(t){return t.underflow="underflow",t.overflow="overflow",t.truncate_integer="truncate_integer",t.truncate_float="truncate_float",t})({});function ko(t){if(cs(t,{approx:!1}))return;if(Ve(t))return Me.truncate_integer;const e=Number.parseFloat(t);return Number.isFinite(e)?e===0?Me.underflow:Me.truncate_float:Me.overflow}function ls(t){const{start:e,end:r}=Ao(t),s=t.substring(e,r),n=s.indexOf(".");return n===-1?s:s.substring(0,n)+s.substring(n+1)}function Ao(t){let e=0;for(t[0]==="-"&&e++;t[e]==="0"||t[e]===".";)e++;let r=t.lastIndexOf("e");for(r===-1&&(r=t.lastIndexOf("E")),r===-1&&(r=t.length);(t[r-1]==="0"||t[r-1]===".")&&r>e;)r--;return{start:e,end:r}}class Po{isLosslessNumber=!0;constructor(e){if(!as(e))throw new Error(`Invalid number (value: "${e}")`);this.value=e}valueOf(){const e=ko(this.value);if(e===void 0||e===Me.truncate_float)return Number.parseFloat(this.value);if(Ve(this.value))return BigInt(this.value);throw new Error(`Cannot safely convert to number: the value '${this.value}' would ${e} and become ${Number.parseFloat(this.value)}`)}toString(){return this.value}}function To(t){return t&&typeof t=="object"&&t.isLosslessNumber||!1}function Io(t){return new Po(t)}function Lo(t,e){return Lt({"":t},"",t,e)}function Lt(t,e,r,s){return Array.isArray(r)?s.call(t,e,No(r,s)):r&&typeof r=="object"&&!To(r)?s.call(t,e,jo(r,s)):s.call(t,e,r)}function jo(t,e){for(const r of Object.keys(t)){const s=Lt(t,r,t[r],e);s!==void 0?t[r]=s:delete t[r]}return t}function No(t,e){for(let r=0;r<t.length;r++)t[r]=Lt(t,String(r),t[r],e);return t}function Do(t,e,r){const s=typeof r=="function"?{parseNumber:r}:r,n=s?.parseNumber??Io,i=s?.onDuplicateKey??H;let o=0;const a=u();return S(a),b(),e?Lo(a,e):a;function c(){if(t.charCodeAt(o)===Vo){o++,p();const O={};let N=!0;for(;o<t.length&&t.charCodeAt(o)!==ds;){N?N=!1:(P(),p());const se=o,oe=y();if(oe===void 0){R();return}p(),v();const Y=u();if(Y===void 0){re();return}if(Object.prototype.hasOwnProperty.call(O,oe)&&!jt(Y,O[oe])){const F=i({key:oe,position:se+1,oldValue:O[oe],newValue:Y});F!==void 0&&(O[oe]=F)}else O[oe]=Y}return t.charCodeAt(o)!==ds&&ie(),o++,O}}function d(){if(t.charCodeAt(o)===Mo){o++,p();const O=[];let N=!0;for(;o<t.length&&t.charCodeAt(o)!==hs;){N?N=!1:P();const se=u();g(se),O.push(se)}return t.charCodeAt(o)!==hs&&k(),o++,O}}function u(){p();const O=y()??C()??c()??d()??h("true",!0)??h("false",!1)??h("null",null);return p(),O}function h(O,N){if(t.slice(o,o+O.length)===O)return o+=O.length,N}function p(){for(;Uo(t.charCodeAt(o));)o++}function y(){if(t.charCodeAt(o)===Nt){o++;let O="";for(;o<t.length&&t.charCodeAt(o)!==Nt;){if(t.charCodeAt(o)===qo){const N=t[o+1],se=$o[N];se!==void 0?(O+=se,o++):N==="u"?ct(t.charCodeAt(o+2))&&ct(t.charCodeAt(o+3))&&ct(t.charCodeAt(o+4))&&ct(t.charCodeAt(o+5))?(O+=String.fromCharCode(Number.parseInt(t.slice(o+2,o+6),16)),o+=5):ae(o):q(o)}else Bo(t.charCodeAt(o))?O+=t[o]:j(t[o]);o++}return I(),o++,O}}function C(){const O=o;if(t.charCodeAt(o)===fs&&(o++,f(O)),t.charCodeAt(o)===Dt)o++;else if(Fo(t.charCodeAt(o)))for(o++;lt(t.charCodeAt(o));)o++;if(t.charCodeAt(o)===Go)for(o++,f(O);lt(t.charCodeAt(o));)o++;if(t.charCodeAt(o)===ra||t.charCodeAt(o)===ta)for(o++,(t.charCodeAt(o)===fs||t.charCodeAt(o)===Ko)&&o++,f(O);lt(t.charCodeAt(o));)o++;if(o>O)return n(t.slice(O,o))}function P(){if(t.charCodeAt(o)!==Zo)throw new SyntaxError(`Comma ',' expected after value ${X()}`);o++}function v(){if(t.charCodeAt(o)!==Xo)throw new SyntaxError(`Colon ':' expected after property name ${X()}`);o++}function S(O){if(O===void 0)throw new SyntaxError(`JSON value expected ${X()}`)}function g(O){if(O===void 0)throw new SyntaxError(`Array item expected ${X()}`)}function b(){if(o<t.length)throw new SyntaxError(`Expected end of input ${X()}`)}function f(O){if(!lt(t.charCodeAt(o))){const N=t.slice(O,o);throw new SyntaxError(`Invalid number '${N}', expecting a digit ${X()}`)}}function I(){if(t.charCodeAt(o)!==Nt)throw new SyntaxError(`End of string '"' expected ${X()}`)}function R(){throw new SyntaxError(`Quoted object key expected ${X()}`)}function H(O){let{key:N,position:se}=O;throw new SyntaxError(`Duplicate key '${N}' encountered at position ${se}`)}function ie(){throw new SyntaxError(`Quoted object key or end of object '}' expected ${X()}`)}function k(){throw new SyntaxError(`Array item or end of array ']' expected ${X()}`)}function j(O){throw new SyntaxError(`Invalid character '${O}' ${W()}`)}function q(O){const N=t.slice(O,O+2);throw new SyntaxError(`Invalid escape character '${N}' ${W()}`)}function re(){throw new SyntaxError(`Object value expected after ':' ${W()}`)}function ae(O){const N=t.slice(O,O+6);throw new SyntaxError(`Invalid unicode character '${N}' ${W()}`)}function W(){return`at position ${o}`}function Ae(){return o<t.length?`but got '${t[o]}'`:"but reached end of input"}function X(){return`${Ae()} ${W()}`}}function Uo(t){return t===zo||t===Wo||t===Jo||t===Ho}function ct(t){return t>=Dt&&t<=Ut||t>=Qo&&t<=sa||t>=ea&&t<=na}function lt(t){return t>=Dt&&t<=Ut}function Fo(t){return t>=Yo&&t<=Ut}function Bo(t){return t>=32&&t<=1114111}function jt(t,e){return t===e?!0:Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((r,s)=>jt(r,e[s])):us(t)&&us(e)?[...new Set([...Object.keys(t),...Object.keys(e)])].every(r=>jt(t[r],e[r])):!1}function us(t){return typeof t=="object"&&t!==null}const $o={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
11
- `,r:"\r",t:" "},qo=92,Vo=123,ds=125,Mo=91,hs=93,zo=32,Wo=10,Jo=9,Ho=13,Nt=34,Ko=43,fs=45,Dt=48,Yo=49,Ut=57,Zo=44,Go=46,Xo=58,Qo=65,ea=97,ta=69,ra=101,sa=70,na=102;function ps(t,e,r,s){return n(t);function n(c,d){if(Array.isArray(s)){const u=s.find(h=>h.test(c));if(u){const h=u.stringify(c);if(typeof h!="string"||!as(h))throw new Error(`Invalid JSON number: output of a number stringifier must be a string containing a JSON number (output: ${h})`);return h}}if(typeof c=="boolean"||typeof c=="number"||typeof c=="string"||c===null||c instanceof Date||c instanceof Boolean||c instanceof Number||c instanceof String)return JSON.stringify(c);if(c?.isLosslessNumber||typeof c=="bigint")return c.toString();if(Array.isArray(c))return i(c);if(c&&typeof c=="object")return o(c)}function i(c,d){if(c.length===0)return"[]";let u="[";for(let h=0;h<c.length;h++){const p=c[h];typeof p<"u"&&typeof p!="function"?u+=n(p):u+="null",h<c.length-1&&(u+=",")}return u+="]",u}function o(c,d){if(typeof c.toJSON=="function")return ps(c.toJSON(),e,r,void 0);const u=Array.isArray(e)?e.map(String):Object.keys(c);if(u.length===0)return"{}";let h=!0,p="{";for(const y of u){const C=c[y];if(a(y,C)){h?h=!1:p+=",";const P=JSON.stringify(y);p+=`${P}:`,p+=n(C)}}return p+="}",p}function a(c,d){return typeof d<"u"&&typeof d!="function"&&typeof d!="symbol"}}function ia(t){return Ve(t)&&!cs(t)?BigInt(t):Number.parseFloat(t)}class ms{id=1;constructor(){}async exec(e,r,s={},n={},i=6e4){await zi(),this.id=this.id+1;try{return s.scope=window.openc3Scope,n.manual=!0,(await Hr.post("/openc3-api/api",{jsonrpc:"2.0",method:e,params:r,id:this.id,keyword_params:s},{headers:{Authorization:localStorage.openc3Token,"Content-Type":"application/json-rpc",...n},timeout:i,transformRequest:[(o,a)=>ps(o)],transformResponse:[o=>{try{return Do(o,void 0,ia)}catch{const a=typeof o=="string"?o.substring(0,200):String(o),c=new Error(`Server returned non-JSON response: ${a}`);throw c.name="ServerError",c}}]})).data.result}catch(o){let a=new Error;throw o.response?(a.name=o.response.data.error.data.class,a.message=o.response.data.error.data.message,a.object=o.response.data.error):o.request?(a.name="Request error",a.message="Request error, no response received"):a=o,a}}decode_openc3_type(e){if(e!==null&&typeof e=="object"&&e.json_class=="Float"&&e.raw){if(e.raw=="NaN")return NaN;if(e.raw=="Infinity")return 1/0;if(e.raw=="-Infinity")return-1/0}return null}encode_openc3_type(e){return Number.isNaN(e)?{json_class:"Float",raw:"NaN"}:e==Number.POSITIVE_INFINITY?{json_class:"Float",raw:"Infinity"}:e==Number.NEGATIVE_INFINITY?{json_class:"Float",raw:"-Infinity"}:null}ensure_offline_access(){this.offline_access_needed().then(e=>{e&&(localStorage.openc3OfflineToken?this.set_offline_access(localStorage.openc3OfflineToken).then(()=>{delete localStorage.openc3OfflineToken}):OpenC3Auth.getOfflineAccess())})}offline_access_needed(){return this.exec("offline_access_needed",[])}set_offline_access(e){return this.exec("set_offline_access",[e])}get_all_interface_info(){return this.exec("get_all_interface_info",[])}map_target_to_interface(e,r,s,n,i){return this.exec("map_target_to_interface",[e,r],{cmd_only:s,tlm_only:n,unmap_old:i})}unmap_target_from_interface(e,r,s,n){return this.exec("unmap_target_from_interface",[e,r],{cmd_only:s,tlm_only:n})}connect_interface(e,...r){return r.length>0?this.exec("connect_interface",[e,...r]):this.exec("connect_interface",[e])}disconnect_interface(e){return this.exec("disconnect_interface",[e])}interface_cmd(e,r,...s){return this.exec("interface_cmd",[e,r,...s])}interface_target_enable(e,r,s=!1,n=!1){return this.exec("interface_target_enable",[e,r],{cmd_only:s,tlm_only:n})}interface_target_disable(e,r,s=!1,n=!1){return this.exec("interface_target_disable",[e,r],{cmd_only:s,tlm_only:n})}interface_details(e){return this.exec("interface_details",[e])}get_all_router_info(){return this.exec("get_all_router_info",[])}map_target_to_router(e,r,s,n,i){return this.exec("map_target_to_router",[e,r],{cmd_only:s,tlm_only:n,unmap_old:i})}unmap_target_from_router(e,r,s,n){return this.exec("unmap_target_from_router",[e,r],{cmd_only:s,tlm_only:n})}connect_router(e){return this.exec("connect_router",[e])}disconnect_router(e){return this.exec("disconnect_router",[e])}router_target_enable(e,r,s=!1,n=!1){return this.exec("router_target_enable",[e,r],{cmd_only:s,tlm_only:n})}router_target_disable(e,r,s=!1,n=!1){return this.exec("router_target_disable",[e,r],{cmd_only:s,tlm_only:n})}router_details(e){return this.exec("router_details",[e])}get_target_interfaces(){return this.exec("get_target_interfaces",[])}get_tlm_cnts(e){return this.exec("get_tlm_cnts",[e])}get_item(e,r,s){return this.exec("get_item",[e,r,s])}get_param(e,r,s){return this.exec("get_param",[e,r,s])}get_parameter(e,r,s){return this.get_param(e,r,s)}get_limits_sets(){return this.exec("get_limits_sets",[])}get_limits_set(){return this.exec("get_limits_set",[])}set_limits_set(e){return this.exec("set_limits_set",[e])}delete_limits_set(e){return this.exec("delete_limits_set",[e])}get_target(e){return this.exec("get_target",[e])}get_target_names(){return this.exec("get_target_names",[])}get_target_list(){return this.get_target_names()}get_tlm(e,r){return this.exec("get_tlm",[e,r])}get_telemetry(e,r){return this.get_tlm(e,r)}get_all_tlm(e){return this.exec("get_all_tlm",[e])}get_all_telemetry(e){return this.get_all_tlm(e)}get_all_tlm_names(e,r=!1){return this.exec("get_all_tlm_names",[e],{hidden:r})}get_all_telemetry_names(e){return this.get_all_tlm_names(e)}get_all_tlm_item_names(e){return this.exec("get_all_tlm_item_names",[e])}async get_tlm_packet(e,r,s,n=30){const i=await this.exec("get_tlm_packet",[e,r],{type:s,stale_time:n});if(i!=null){let o=i.length,a=null;for(let c=0;c<o;c++)a=this.decode_openc3_type(i[c][1]),a!==null&&(i[c][1]=a)}return i}get_packet_derived_items(e,r){return this.exec("get_packet_derived_items",[e,r])}get_tlm_buffer(e,r){return this.exec("get_tlm_buffer",[e,r])}get_tlm_available(e,r={},s={}){return this.exec("get_tlm_available",[e],r,s)}async get_tlm_values(e,r=30,s=null,n=null,i=null,o={}){let a={stale_time:r};s!==null&&(a.cache_timeout=s),n!==null&&(a.start_time=n.toISOString()),i!==null&&(a.end_time=i.toISOString());const c=await this.exec("get_tlm_values",[e],a,o,1e4);if(c&&c.length>0){let d=c.length,u=null;for(let h=0;h<d;h++)u=this.decode_openc3_type(c[h][0]),u!==null&&(c[h][0]=u)}return c}get_limits(e,r,s){return this.exec("get_limits",[e,r,s])}async tlm(e,r,s,n="CONVERTED"){let i=null;if(r===void 0)i=await this.exec("tlm",[e]);else if(s===void 0)if(["RAW","CONVERTED","FORMATTED"].includes(r))i=await this.exec("tlm",[e],{type:r});else{let a=new Error;throw a.name="TypeError",a.message=`Invalid data type ${r}. Valid options are RAW, CONVERTED or FORMATTED.`,a}else i=await this.exec("tlm",[e,r,s],{type:n});let o=this.decode_openc3_type(i);return o!==null&&(i=o),i}async inject_tlm(e,r,s=null,n="CONVERTED",i=!1){await this.exec("inject_tlm",[e,r,s],{type:n,stored:i})}set_tlm(e,r,s,n){return this.exec("set_tlm",[e,r,s],{type:n})}override_tlm(e,r,s,n){return this.exec("override_tlm",[e,r,s],{type:n})}get_overrides(){return this.exec("get_overrides")}normalize_tlm(e,r,s,n){return this.exec("normalize_tlm",[e,r,s],{type:n})}get_all_cmds(e){return this.exec("get_all_cmds",[e])}get_all_commands(e){return this.get_all_cmds(e)}get_all_cmd_names(e,r=!1){return this.exec("get_all_cmd_names",[e],{hidden:r})}get_all_command_names(e){return this.get_all_cmd_names(e)}get_cmd(e,r){return this.exec("get_cmd",[e,r])}get_command(e,r){return this.get_cmd(e,r)}get_cmd_cnts(e){return this.exec("get_cmd_cnts",[e])}get_cmd_value(e,r,s,n="CONVERTED"){return this.exec("get_cmd_value",[e,r,s,n])}get_cmd_buffer(e,r){return this.exec("get_cmd_buffer",[e,r])}_cmd(e,r,s,n,i,o={}){let a=null;for(let c in n)Object.prototype.hasOwnProperty.call(n,c)&&(a=this.encode_openc3_type(n[c]),a!==null&&(n[c]=a));return this.exec(e,[r,s,n],o,i)}get_cmd_hazardous(e,r,s,n={}){return r===void 0?this.exec("get_cmd_hazardous",e,{},n):this._cmd("get_cmd_hazardous",e,r,s,n)}cmd(e,r,s,n={},i={}){return r===void 0?this.exec("cmd",e,i,n):this._cmd("cmd",e,r,s,n,i)}cmd_no_range_check(e,r,s,n={},i={}){return r===void 0?this.exec("cmd_no_range_check",e,i,n):this._cmd("cmd_no_range_check",e,r,s,n,i)}cmd_raw(e,r,s,n={},i={}){return r===void 0?this.exec("cmd_raw",e,i,n):this._cmd("cmd_raw",e,r,s,n,i)}cmd_raw_no_range_check(e,r,s,n={},i={}){return r===void 0?this.exec("cmd_raw_no_range_check",e,i,n):this._cmd("cmd_raw_no_range_check",e,r,s,n,i)}cmd_no_hazardous_check(e,r,s,n={},i={}){return r===void 0?this.exec("cmd_no_hazardous_check",e,i,n):this._cmd("cmd_no_hazardous_check",e,r,s,n,i)}cmd_no_checks(e,r,s,n={},i={}){return r===void 0?this.exec("cmd_no_checks",e,i,n):this._cmd("cmd_no_checks",e,r,s,n,i)}cmd_raw_no_hazardous_check(e,r,s,n={},i={}){return r===void 0?this.exec("cmd_raw_no_hazardous_check",e,i,n):this._cmd("cmd_raw_no_hazardous_check",e,r,s,n,i)}cmd_raw_no_checks(e,r,s,n={},i={}){return r===void 0?this.exec("cmd_raw_no_checks",e,i,n):this._cmd("cmd_raw_no_checks",e,r,s,n,i)}build_cmd(e,r,s,n={},i={}){return r===void 0?this.exec("build_cmd",e,i,n):this._cmd("build_cmd",e,r,s,n,i)}build_command(e,r,s,n={},i={}){return this.build_cmd(e,r,s,n,i)}get_interface_names(){return this.exec("get_interface_names",[])}get_router_names(){return this.exec("get_router_names",[])}send_raw(e,r){return this.exec("send_raw",[e,r])}list_configs(e){return this.exec("list_configs",[e])}load_config(e,r){return this.exec("load_config",[e,r])}save_config(e,r,s){return this.exec("save_config",[e,r,s])}delete_config(e,r){return this.exec("delete_config",[e,r])}enable_limits(e,r,s){return this.exec("enable_limits",[e,r,s])}disable_limits(e,r,s){return this.exec("disable_limits",[e,r,s])}get_out_of_limits(){return this.exec("get_out_of_limits",[])}get_overall_limits_state(e){return this.exec("get_overall_limits_state",[e])}list_settings(){return this.exec("list_settings",[])}get_all_settings(){return this.exec("get_all_settings",[])}get_setting(e,r){return this.exec("get_setting",[e],r)}get_settings(e,r){return this.exec("get_settings",e,r)}set_setting(e,r){return this.exec("set_setting",[e,r])}update_news(){return this.exec("update_news",[])}update_plugin_store(){return this.exec("update_plugin_store",[])}save_setting(e,r){return this.set_setting(e,r)}get_metrics(){return this.exec("get_metrics",[])}open_tab(e){window.open(e,"_blank")}async hashString(e){if(window.isSecureContext){const r=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",r),n=new Uint8Array(s);return Array.from(n).map(i=>i.toString(16).padStart(2,"0")).join("")}}}const oa={components:{ValueWidget:Ht,ValuelimitsbarWidget:Kt},mixins:[ht],props:{modelValue:{type:Array,default:()=>[]},timeZone:{type:String,default:"local"}},emits:["update:modelValue"],data(){return{api:null,cable:new os,ignored:[],ignoredItemsDialog:!1,overallState:"GREEN",currentLimitsSet:"",items:[],itemList:[],screenItems:[],availableItems:[],screenValues:{},updateCounter:0,itemsPerPage:25,search:"",stateFilter:[],stateFilterOptions:[{value:"RED",label:"Critical",status:"critical"},{value:"YELLOW",label:"Caution",status:"caution"},{value:"GREEN",label:"Normal",status:"normal"},{value:"BLUE",label:"Standby",status:"standby"}],headers:[{title:"Timestamp",key:"timestamp",width:"130px",sortable:!0,nowrap:!0},{title:"Item",key:"item",value:t=>t.parameters[2],sortable:!0,minWidth:"100px",width:"200px",maxWidth:"410px"},{title:"Value",key:"value",width:"380px",sortable:!1},{title:"Controls",key:"actions",width:"80px",sortable:!1},{title:"",key:"limits",sortable:!1}],valueLimitsBarWidgetSettings:[["WIDTH","380px"],["0","WIDTH","200px"],["1","WIDTH","180px"]],valueWidgetSettings:[["WIDTH","200px"]]}},computed:{textFieldClass(){return this.overallState?`textfield-${this.overallState.toLowerCase()}`:""},overallStateFormatted(){return this.ignored.length===0?this.overallState:`${this.overallState} (Some items ignored)`},ignoredFormatted(){return this.ignored.map(t=>t.split("__").join(" "))},astroStatus(){switch(this.overallState){case"GREEN":return"normal";case"YELLOW":return"caution";case"RED":return"critical";case"BLUE":return"standby";default:return null}}},created(){this.api=new ms;for(let t of this.modelValue)t.match(/.+__.+__.+/)?this.ignoreItem(t,!0):this.ignorePacket(t,!0);this.updateOutOfLimits(),this.getCurrentLimitsSet(),this.currentSetRefreshInterval=setInterval(this.getCurrentLimitsSet,10*1e3),this.cable.createSubscription("LimitsEventsChannel",window.openc3Scope,{received:t=>{this.cable.recordPing(),this.handleMessages(t)}}).then(t=>{this.limitsSubscription=t}),this.cable.createSubscription("ConfigEventsChannel",window.openc3Scope,{received:t=>{this.cable.recordPing();const e=JSON.parse(t);this.handleConfigEvents(e)}}).then(t=>{this.configSubscription=t})},mounted(){this.updater=setInterval(()=>{this.update()},1e3)},unmounted(){this.updater!=null&&(clearInterval(this.updater),this.updater=null),this.limitsSubscription&&this.limitsSubscription.unsubscribe(),this.configSubscription&&this.configSubscription.unsubscribe(),this.cable.disconnect()},methods:{rowProps({item:t}){return this.stateFilter.length>0&&!this.stateFilter.some(e=>t.limitsState?.includes(e))?{class:"state-filtered-row"}:{}},escapeBrackets(t){return t.includes("[")?t.replace(/\[/g,"[[").replace(/\]/g,"]]"):t},getCurrentLimitsSet:function(){this.api.get_limits_set().then(t=>{this.currentLimitsSet=t})},updateOutOfLimits(){this.items=[],this.itemList=[],this.api.get_out_of_limits().then(t=>{for(const e of t){let r=e.join("__");if(this.ignored.find(n=>r.includes(n)))continue;this.itemList.push(r);let s={key:e.slice(0,3).join("__"),parameters:[e[0],e[1],this.escapeBrackets(e[2])],timestamp:this.formatDateTime(new Date,this.timeZone),limitsState:e[3]};e[3].includes("YELLOW")&&this.overallState!=="RED"&&(this.overallState="YELLOW"),e[3].includes("RED")&&(this.overallState="RED"),e[3]=="YELLOW"||e[3]=="RED"?s.limits=!1:s.limits=!0,this.items.push(s)}this.calcOverallState()})},calcOverallState(){let t="GREEN";for(let e of this.itemList)if(!this.ignored.find(r=>e.includes(r))&&(e.includes("YELLOW")&&t!=="RED"&&(t="YELLOW"),e.includes("RED"))){t="RED";break}this.overallState=t},ignorePacket(t,e){let[r,s,n]=t.split("__"),i=`${r}__${s}`;for(this.ignored.push(i),e||this.updateIgnored();;){let o=this.itemList.findIndex(a=>a.includes(i));if(o===-1)break;{let a=this.itemList[o].lastIndexOf("__");this.removeItem(this.itemList[o].substring(0,a))}}this.calcOverallState()},ignoreItem(t,e){this.ignored.push(t),e||this.updateIgnored(),this.removeItem(t),this.calcOverallState()},restoreItem(t){this.ignored.splice(t,1),this.updateIgnored(),this.updateOutOfLimits()},removeItem(t){const e=this.itemList.findIndex(r=>r.includes(t));this.items.splice(e,1),this.itemList.splice(e,1)},clearAll(){this.ignored=[],this.updateIgnored(),this.updateOutOfLimits()},updateIgnored(){this.$emit("update:modelValue",this.ignored)},handleConfigEvents(t){for(let e of t)e.kind==="deleted"&&e.type==="target"&&this.updateOutOfLimits()},handleMessages(t){for(let e of t){let r=JSON.parse(e.event);if(r.type!="LIMITS_CHANGE"||r.suppress_stored)continue;let s=`${r.target_name}__${r.packet_name}__${r.item_name}`;const n=this.itemList.findIndex(o=>o.includes(s));if(n!==-1){this.itemList[n]=`${s}__${r.new_limits_state}`,this.items[n].limitsState=r.new_limits_state,this.calcOverallState();continue}if(this.ignored.find(o=>s.includes(o))||r.new_limits_state&&!(r.new_limits_state.includes("YELLOW")||r.new_limits_state.includes("RED")))continue;let i={key:s,timestamp:this.formatNanoseconds(r.time_nsec,this.timeZone),parameters:[r.target_name,r.packet_name,this.escapeBrackets(r.item_name)],limitsState:r.new_limits_state};r.new_limits_state=="YELLOW"||r.new_limits_state=="RED"?i.limits=!1:i.limits=!0,this.itemList.push(`${s}__${r.new_limits_state}`),this.items.push(i),this.calcOverallState()}},update(){this.availableItems.length!==0&&this.api.get_tlm_values(this.availableItems).then(t=>{this.updateValues(t)})},updateValues:function(t){this.updateCounter+=1;for(let e=0;e<t.length;e++)t[e].push(this.updateCounter),this.screenValues[this.screenItems[e]]=t[e]},addItem:function(t){this.api.get_tlm_available([t]).then(e=>{this.screenItems.push(t),this.availableItems.push(e[0]),this.screenValues[e[0]]=[null,null,0]})},deleteItem:function(t){let e=this.screenItems.indexOf(t);this.availableItems.splice(e,1),this.screenItems.splice(e,1)},showIgnored(){this.ignoredItemsDialog=!0},customFilter(t,e,r){if(!e||e.trim()==="")return!0;if(e=e.toLowerCase(),r.parameters&&r.parameters.length>0){for(const s of r.parameters)if(s.toLowerCase().includes(e))return!0}return!!(r.timestamp&&r.timestamp.toLowerCase().includes(e)||r.key&&r.key.toLowerCase().includes(e))}}},aa=["status"],ca={key:0},la=["status"],ua={class:"font-weight-black"};function da(t,e,r,s,n,i){const o=E("v-text-field"),a=E("v-spacer"),c=E("v-list-item"),d=E("v-select"),u=E("v-row"),h=E("valuelimitsbar-widget"),p=E("value-widget"),y=E("v-btn"),C=E("v-icon"),P=E("v-list-item-title"),v=E("v-list"),S=E("v-menu"),g=E("v-data-table"),b=E("v-card"),f=E("v-toolbar"),I=E("v-divider"),R=E("v-card-text"),H=E("v-card-actions"),ie=E("v-dialog");return T(),Z("div",null,[w(b,{class:"pa-5"},{default:_(()=>[w(u,{class:"ma-1"},{default:_(()=>[w(o,{density:"compact",variant:"outlined",readonly:"","hide-details":"",label:"Overall Limits State","model-value":i.overallStateFormatted,class:pt(i.textFieldClass),style:{"margin-right":"10px","max-width":"280px"},"data-test":"overall-state"},Ke({_:2},[i.astroStatus?{name:"prepend-inner",fn:_(()=>[V("rux-status",{status:i.astroStatus},null,8,aa)]),key:"0"}:void 0]),1032,["model-value","class"]),w(o,{density:"compact",variant:"outlined",readonly:"","hide-details":"",label:"Current Limits Set","model-value":n.currentLimitsSet,style:{"max-width":"200px"},"data-test":"limits-set"},null,8,["model-value"]),w(a),w(d,{modelValue:n.stateFilter,"onUpdate:modelValue":e[0]||(e[0]=k=>n.stateFilter=k),items:n.stateFilterOptions,"item-title":"label","item-value":"value",label:"Filter by State",multiple:"",clearable:"",variant:"outlined",density:"compact","hide-details":"",class:"mr-2",style:{"max-width":"300px"},"data-test":"state-filter"},{selection:_(({index:k})=>[k===0?(T(),Z("span",ca,ee(n.stateFilter.length)+" selected ",1)):de("",!0)]),item:_(({props:k,item:j})=>[w(c,zt(Wt(k)),{prepend:_(()=>[V("rux-status",{status:j.raw.status,class:"mr-2"},null,8,la)]),_:2},1040)]),_:1},8,["modelValue","items"]),w(o,{modelValue:n.search,"onUpdate:modelValue":e[1]||(e[1]=k=>n.search=k),label:"Search","prepend-inner-icon":"mdi-magnify",clearable:"",variant:"outlined",density:"compact","single-line":"","hide-details":"",style:{"max-width":"300px"},"data-test":"search"},null,8,["modelValue"])]),_:1}),w(g,{"items-per-page":n.itemsPerPage,"onUpdate:itemsPerPage":e[2]||(e[2]=k=>n.itemsPerPage=k),headers:n.headers,items:n.items,search:n.search,"custom-filter":i.customFilter,"row-props":i.rowProps,"item-value":"key","data-test":"limits-table",class:"limits-table",density:"compact"},{"item.timestamp":_(({item:k})=>[B(ee(k.timestamp),1)]),"item.value":_(({item:k})=>[k.limits?(T(),D(h,{key:0,parameters:k.parameters,settings:n.valueLimitsBarWidgetSettings,"screen-values":n.screenValues,"screen-time-zone":r.timeZone,onAddItem:i.addItem,onDeleteItem:i.deleteItem},null,8,["parameters","settings","screen-values","screen-time-zone","onAddItem","onDeleteItem"])):(T(),D(p,{key:1,parameters:k.parameters,settings:n.valueWidgetSettings,"screen-values":n.screenValues,"screen-time-zone":r.timeZone,onAddItem:i.addItem,onDeleteItem:i.deleteItem},null,8,["parameters","settings","screen-values","screen-time-zone","onAddItem","onDeleteItem"]))]),"item.actions":_(({item:k})=>[w(S,null,{activator:_(({props:j})=>[w(y,Pe({icon:"mdi-dots-horizontal",variant:"text",density:"compact","aria-label":"Item Options"},j),null,16)]),default:_(()=>[w(v,null,{default:_(()=>[w(c,{onClick:j=>i.ignorePacket(k.key)},{prepend:_(()=>[w(C,null,{default:_(()=>[...e[5]||(e[5]=[B("mdi-close-circle-multiple",-1)])]),_:1})]),default:_(()=>[w(P,null,{default:_(()=>[...e[6]||(e[6]=[B("Ignore Entire Packet",-1)])]),_:1})]),_:1},8,["onClick"]),w(c,{onClick:j=>i.ignoreItem(k.key)},{prepend:_(()=>[w(C,null,{default:_(()=>[...e[7]||(e[7]=[B("mdi-close-circle",-1)])]),_:1})]),default:_(()=>[w(P,null,{default:_(()=>[...e[8]||(e[8]=[B("Ignore Item",-1)])]),_:1})]),_:1},8,["onClick"]),w(c,{onClick:j=>i.removeItem(k.key)},{prepend:_(()=>[w(C,null,{default:_(()=>[...e[9]||(e[9]=[B("mdi-eye-off",-1)])]),_:1})]),default:_(()=>[w(P,null,{default:_(()=>[...e[10]||(e[10]=[B("Temporarily Hide Item",-1)])]),_:1})]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)]),"item.limits":_(({item:k})=>[w(a)]),_:1},8,["items-per-page","headers","items","search","custom-filter","row-props"]),e[11]||(e[11]=V("div",{class:"footer"},' Note: Timestamp is "now" for items currently out of limits when the page is loaded. ',-1))]),_:1}),w(ie,{modelValue:n.ignoredItemsDialog,"onUpdate:modelValue":e[4]||(e[4]=k=>n.ignoredItemsDialog=k),"max-width":"600"},{default:_(()=>[w(b,null,{default:_(()=>[w(f,{height:"24"},{default:_(()=>[w(a),e[12]||(e[12]=V("span",null,"Ignored Items",-1)),w(a)]),_:1}),w(R,{class:"mt-2"},{default:_(()=>[V("div",null,[(T(!0),Z(pe,null,Oe(i.ignoredFormatted,(k,j)=>(T(),Z("div",{key:j},[w(u,{class:"ma-1 align-center"},{default:_(()=>[V("span",ua,ee(k),1),w(a),w(y,{icon:"mdi-delete",density:"compact",variant:"text","aria-label":"Remove Ignored Item","data-test":`remove-ignore-${j}`,onClick:q=>i.restoreItem(j)},null,8,["data-test","onClick"])]),_:2},1024),j<i.ignoredFormatted.length-1?(T(),D(I,{key:j})):de("",!0)]))),128))])]),_:1}),w(H,{class:"px-2"},{default:_(()=>[w(y,{variant:"outlined",onClick:i.clearAll},{default:_(()=>[...e[13]||(e[13]=[B(" Clear All ",-1)])]),_:1},8,["onClick"]),w(a),w(y,{variant:"flat",onClick:e[3]||(e[3]=k=>n.ignoredItemsDialog=!1)},{default:_(()=>[...e[14]||(e[14]=[B(" Ok ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])])}const ha=He(oa,[["render",da],["__scopeId","data-v-b6f77818"]]),fa={mixins:[ht],props:{historyCount:{type:Number,default:1e3},timeZone:{type:String,default:"local"}},data(){return{data:[],cable:new os,search:"",headers:[{title:"Time",value:"time_nsec",width:250},{title:"Level",value:"level",sortable:!1},{title:"Message",value:"message"}]}},created(){this.cable.createSubscription("LimitsEventsChannel",window.openc3Scope,{received:t=>{this.cable.recordPing(),this.handleMessages(t)}},{historyCount:1e3}).then(t=>{this.limitsSubscription=t})},unmounted(){this.limitsSubscription&&this.limitsSubscription.unsubscribe(),this.cable.disconnect()},methods:{handleMessages(t){for(let e=0;e<t.length;e++){let r=JSON.parse(t[e].event);this.data.unshift(r)}this.data.length>this.historyCount&&(this.data.length=this.historyCount)},getStatus(t){return t.includes("GREEN")?"normal":t.includes("YELLOW")?"caution":t.includes("RED")?"critical":t.includes("BLUE")?"standby":"off"},getColorClass(t){return t.includes("GREEN")?"openc3-green":t.includes("YELLOW")?"openc3-yellow":t.includes("RED")?"openc3-red":t.includes("BLUE")?"openc3-blue":"openc3-white"},calcTableHeight(){return window.innerHeight-250}}},pa=["status"];function ma(t,e,r,s,n,i){const o=E("v-spacer"),a=E("v-text-field"),c=E("v-card-title"),d=E("v-data-table"),u=E("v-card");return T(),D(u,{class:"card-height"},{default:_(()=>[w(c,{class:"d-flex align-center"},{default:_(()=>[e[1]||(e[1]=B(" Limits Events ",-1)),w(o),w(a,{modelValue:n.search,"onUpdate:modelValue":e[0]||(e[0]=h=>n.search=h),label:"Search","prepend-inner-icon":"mdi-magnify",clearable:"",variant:"outlined",density:"compact","single-line":"","hide-details":"",class:"search"},null,8,["modelValue"])]),_:1}),w(d,{headers:n.headers,items:n.data,search:n.search,"items-per-page":-1,"hide-default-footer":"","multi-sort":"",density:"compact",height:i.calcTableHeight(),hover:"","data-test":"limits-events"},{"item.time_nsec":_(({item:h})=>[V("span",null,ee(t.formatNanoseconds(h.time_nsec,r.timeZone)),1)]),"item.level":_(({item:h})=>[V("rux-status",{status:i.getStatus(h.message)},null,8,pa)]),"item.message":_(({item:h})=>[V("span",{class:pt(i.getColorClass(h.message))},ee(h.message),3)]),_:1},8,["headers","items","search","height"])]),_:1})}const ga={components:{LimitsControl:ha,LimitsEvents:He(fa,[["render",ma],["__scopeId","data-v-192a6dcb"]]),TopBar:Cs,OpenConfigDialog:qt,SaveConfigDialog:$t},mixins:[As],data(){return{title:"Limits Monitor",configKey:"limits_monitor",api:new ms,timeZone:"local",renderKey:0,ignored:[],openConfig:!1,saveConfig:!1,limitsSets:[],currentLimitsSet:null,currentSetRefreshInterval:null,limitsSetDialog:!1,menus:[{label:"File",items:[{label:"Show Ignored",icon:"mdi-magnify-close",command:()=>{this.$refs.control.showIgnored()}},{label:"Change Limits Set",icon:"mdi-swap-horizontal",command:()=>{this.limitsSetDialog=!0}},{divider:!0},{label:"Open Configuration",icon:"mdi-folder-open",command:()=>{this.openConfig=!0}},{label:"Save Configuration",icon:"mdi-content-save",command:()=>{this.saveConfig=!0}},{label:"Reset Configuration",icon:"mdi-monitor-shimmer",command:()=>{this.ignored=[],this.resetConfigBase(),this.renderKey++}}]}]}},created(){this.api.get_limits_sets().then(t=>{this.limitsSets=t}),this.api.get_setting("time_zone").then(t=>{t&&(this.timeZone=t)}).catch(t=>{})},mounted:function(){if(this.$route.query&&this.$route.query.config)this.openConfiguration(this.$route.query.config,!0);else{let t=this.loadDefaultConfig();JSON.stringify(t)!=="{}"&&(this.ignored=t,this.renderKey++)}},unmounted:function(){clearInterval(this.currentSetRefreshInterval)},methods:{setLimitsSet:function(){this.api.set_limits_set(this.currentLimitsSet),this.limitsSetDialog=!1,this.renderKey++},openConfiguration:function(t,e=!1){this.openConfigBase(t,e,r=>{this.ignored=r,this.renderKey++})},saveConfiguration:function(t){this.saveConfigBase(t,this.ignored)}}};function ba(t,e,r,s,n,i){const o=E("top-bar"),a=E("limits-control"),c=E("limits-events"),d=E("open-config-dialog"),u=E("save-config-dialog"),h=E("v-spacer"),p=E("v-toolbar"),y=E("v-select"),C=E("v-card-text"),P=E("v-btn"),v=E("v-card-actions"),S=E("v-card"),g=E("v-dialog");return T(),Z("div",null,[w(o,{menus:n.menus,title:n.title},null,8,["menus","title"]),(T(),D(a,{ref:"control",key:n.renderKey,modelValue:n.ignored,"onUpdate:modelValue":e[0]||(e[0]=b=>n.ignored=b),"time-zone":n.timeZone},null,8,["modelValue","time-zone"])),e[12]||(e[12]=V("div",{style:{height:"15px"}},null,-1)),w(c,{"time-zone":n.timeZone},null,8,["time-zone"]),n.openConfig?(T(),D(d,{key:0,modelValue:n.openConfig,"onUpdate:modelValue":e[1]||(e[1]=b=>n.openConfig=b),"config-key":n.configKey,onSuccess:i.openConfiguration},null,8,["modelValue","config-key","onSuccess"])):de("",!0),n.saveConfig?(T(),D(u,{key:1,modelValue:n.saveConfig,"onUpdate:modelValue":e[2]||(e[2]=b=>n.saveConfig=b),"config-key":n.configKey,onSuccess:i.saveConfiguration},null,8,["modelValue","config-key","onSuccess"])):de("",!0),w(g,{modelValue:n.limitsSetDialog,"onUpdate:modelValue":e[5]||(e[5]=b=>n.limitsSetDialog=b),"max-width":"650",persistent:"",onKeydown:e[6]||(e[6]=Jt(b=>n.limitsSetDialog=!1,["esc"]))},{default:_(()=>[w(S,null,{default:_(()=>[w(p,{height:"24"},{default:_(()=>[w(h),e[7]||(e[7]=V("span",null,"Change Limits Set",-1)),w(h)]),_:1}),w(C,{class:"mt-6"},{default:_(()=>[e[8]||(e[8]=V("span",{style:{display:"block"}}," The Limits Set is a global option which changes the Limits Set across all tools. ",-1)),e[9]||(e[9]=V("span",{style:{display:"block"}}," NOTE: Changing this option clears the current list and recalculates based on the new set. ",-1)),w(y,{modelValue:n.currentLimitsSet,"onUpdate:modelValue":e[3]||(e[3]=b=>n.currentLimitsSet=b),label:"Limits Set",items:n.limitsSets,density:"compact",variant:"outlined","data-test":"change-limits-set","hide-details":"",class:"mt-3",style:{"max-width":"200px"}},null,8,["modelValue","items"])]),_:1}),w(v,{class:"px-2"},{default:_(()=>[w(h),w(P,{variant:"outlined",onClick:e[4]||(e[4]=b=>n.limitsSetDialog=!1)},{default:_(()=>[...e[10]||(e[10]=[B(" Cancel ",-1)])]),_:1}),w(P,{variant:"flat",onClick:i.setLimitsSet},{default:_(()=>[...e[11]||(e[11]=[B(" Ok ",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])])}const Ba=Ss("default",He(ga,[["render",ba]]))})}}));
10
+ `+i)}}catch{}throw r}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=_e(this.defaults,e);const{transitional:r,paramsSerializer:s,headers:n}=e;r!==void 0&&st.assertOptions(r,{silentJSONParsing:z.transitional(z.boolean),forcedJSONParsing:z.transitional(z.boolean),clarifyTimeoutError:z.transitional(z.boolean),legacyInterceptorReqResOrdering:z.transitional(z.boolean),advertiseZstdAcceptEncoding:z.transitional(z.boolean),validateStatusUndefinedResolves:z.transitional(z.boolean)},!1),s!=null&&(l.isFunction(s)?e.paramsSerializer={serialize:s}:st.assertOptions(s,{encode:z.function,serialize:z.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),st.assertOptions(e,{baseUrl:z.spelling("baseURL"),withXsrfToken:z.spelling("withXSRFToken")},!0),e.method=(l.getSafeProp(e,"method")||l.getSafeProp(this.defaults,"method")||"get").toLowerCase();let i=n&&l.merge(n.common,n[e.method]);n&&l.forEach(Sr.concat("common"),y=>{delete n[y]}),e.headers=M.concat(i,n);const o=[];let a=!0;this.interceptors.request.forEach(function(y){if(typeof y.runWhen=="function"&&y.runWhen(e)===!1)return;a=a&&y.synchronous;const C=e.transitional||Et;C&&C.legacyInterceptorReqResOrdering?o.unshift(y.fulfilled,y.rejected):o.push(y.fulfilled,y.rejected)});const c=[];this.interceptors.response.forEach(function(y){c.push(y.fulfilled,y.rejected)});let d,u=0,h;if(!a){const y=[Tt.bind(this),void 0];for(y.unshift(...o),y.push(...c),h=y.length,d=Promise.resolve(e);u<h;)d=d.then(y[u++],y[u++]);return d}h=o.length;let p=e;for(;u<h;){const y=o[u++],C=o[u++];try{p=y?y(p):p}catch(P){if(!C){d=Promise.reject(P);break}try{const v=C.call(this,P);l.isThenable(v)&&(d=Promise.resolve(v).then(()=>Tt.call(this,p)))}catch(v){d=Promise.reject(v)}break}}if(!d)try{d=Tt.call(this,p)}catch(y){d=Promise.reject(y)}for(u=0,h=c.length;u<h;)d=d.then(c[u++],c[u++]);return d}getUri(t){t=_e(this.defaults,t);const e=Ar(t.baseURL,t.url,t.allowAbsoluteUrls,t);return mr(e,t.params,t.paramsSerializer)}};l.forEach(["delete","get","head","options"],function(t){ye.prototype[t]=function(e,r){return this.request(_e(r||{},{method:t,url:e,data:r&&l.hasOwnProp(r,"data")?r.data:void 0}))}}),l.forEach(["post","put","patch","query"],function(t){function e(r){return function(s,n,i){return this.request(_e(i||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:n}))}}ye.prototype[t]=e(),t!=="query"&&(ye.prototype[t+"Form"]=e(!0))});let Fi=class vs{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(n){r=n});const s=this;this.promise.then(n=>{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](n);s._listeners=null}),this.promise.then=n=>{let i;const o=new Promise(a=>{s.subscribe(a),i=a}).then(n);return o.cancel=function(){s.unsubscribe(i)},o},e(function(n,i,o){s.reason||(s.reason=new Be(n,i,o),r(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=s=>{e.abort(s)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new vs(function(r){e=r}),cancel:e}}};function Bi(t){return function(e){return t.apply(null,e)}}function $i(t){return l.isObject(t)&&t.isAxiosError===!0}const nt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(nt).forEach(([t,e])=>{nt[e]===void 0&&(nt[e]=t)});function Mr(t){const e=new ye(t),r=Yt(ye.prototype.request,e);return l.extend(r,ye.prototype,e,{allOwnKeys:!0}),l.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return Mr(_e(t,s))},r}const U=Mr(Fe);U.Axios=ye,U.CanceledError=Be,U.CancelToken=Fi,U.isCancel=Er,U.VERSION=kt,U.toFormData=Qe,U.AxiosError=m,U.Cancel=U.CanceledError,U.all=function(t){return Promise.all(t)},U.spread=Bi,U.isAxiosError=$i,U.mergeConfig=_e,U.AxiosHeaders=M,U.formToJSON=t=>vr(l.isHTMLForm(t)?new FormData(t):t),U.getAdapter=qr.getAdapter,U.HttpStatusCode=nt,U.default=U;const{Axios:va,AxiosError:Sa,CanceledError:Ea,isCancel:Oa,CancelToken:xa,VERSION:Ra,all:Ca,Cancel:ka,isAxiosError:Aa,spread:Pa,toFormData:Ta,AxiosHeaders:Ia,HttpStatusCode:La,formToJSON:ja,getAdapter:Na,mergeConfig:Da,create:Ua}=U;function it(t){return t?.name==="AuthRequiredError"}const qi=new Set(["OpenC3::AuthError","OpenC3::ForbiddenError"]);function Vi(t){return t?.response?.status===401||t?.status===401||qi.has(t?.name)}function Mi(t){!it(t)&&!Vi(t)&&console.error(t)}class zr extends Error{constructor(e="Authentication required"){super(e),this.name="AuthRequiredError"}}globalThis.__openc3AuthRejectionHandler||(globalThis.__openc3AuthRejectionHandler=!0,globalThis.addEventListener?.("unhandledrejection",t=>{it(t.reason)&&t.preventDefault()}));let Wr=!1;function Jr(){Wr||(Wr=!0,OpenC3Auth.login())}async function zi(){try{await OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity)&&OpenC3Auth.setTokens()}catch(t){throw it(t)?t:(Jr(),new zr(t?.message))}if(!localStorage.openc3Token)throw Jr(),new zr}const Hr=U.create({baseURL:location.origin,timeout:6e4,params:{}});Hr.interceptors.response.use(t=>t,t=>{if(t.response){if(t.response.config.headers["Ignore-Errors"]&&t.response.config.headers["Ignore-Errors"].includes(t.response.status.toString()))return Promise.reject(t);if(t.response.status===401)return OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity,!0).then(function(n){n&&OpenC3Auth.setTokens()}).catch(Mi),Promise.reject(t);const e=t.response?.data?.error?.data?.class;if(e==="HazardousError"||e==="CriticalCmdError")return Promise.reject(t);let r=`HTTP ${t.response.status} - `;t.response?.statusText&&(r+=`${t.response.statusText} `),t.response?.config?.data&&(r+=`${t.response.config.data} `),t.response?.data?.message?r+=`${t.response.data.message}`:t.response?.data?.exception?r+=`${t.response.data.exception}`:t.response?.data?.error?.message?(t.response.data.error.class&&(r+=`${t.response.data.error.class} `),r+=`${t.response.data.error.message}`):r+=`${t.response?.data}`;const{$cosmosNotify:s}=window;throw s&&s.serious({title:"Network error",body:r}),t}else throw t});let ot=()=>({emit(t,...e){for(let r=this.events[t]||[],s=0,n=r.length;s<n;s++)r[s](...e)},events:{},on(t,e){return(this.events[t]||=[]).push(e),()=>{this.events[t]=this.events[t]?.filter(r=>e!==r)}}});class $e extends Error{constructor(e,r){e instanceof Error?(super(e.message),this.cause=e):super(e),this.reason=r,this.name="ReasonError"}}class It extends $e{constructor(e){super("Rejected",e),this.name="SubscriptionRejectedError"}}class Wi extends $e{constructor(e){super(e||"Timed out to receive subscription ack"),this.name="SubscriptionTimeoutError"}}class te extends $e{constructor(e,r){r?super(e,r):super("Disconnected",e),this.name="DisconnectedError"}}class Ji extends te{constructor(e){super(e,"stale_connection"),this.name="StaleConnectionError"}}function Kr(t){return t?`{${Object.keys(t).sort().filter(e=>t[e]!==void 0).map(e=>{let r=JSON.stringify(t[e]);return`${JSON.stringify(e)}:${r}`}).join(",")}}`:""}class Hi{constructor(e){this.channel=e,this.listeners=[]}watch(){this.listeners.push(this.channel.on("presence",e=>{if(e.type==="info"){this._state||(this._state=this.stateFromInfo(e));return}this._state&&(e.type==="join"?this._state[e.id]=e.info:e.type==="leave"&&delete this._state[e.id])}))}reset(){delete this._state}dispose(){delete this._info,delete this._state,this.listeners.forEach(e=>e()),this.listeners.length=0}async join(e,r){if(!this._info)return this._info={id:String(e),info:r},this.channel.perform("$presence:join",this._info)}async leave(){if(!this._info)return;let e=await this.channel.perform("$presence:leave");return delete this._info,e}async info(){return this._state?this._state:(this._promise||(this._promise=this._sync()),await this._promise,this._state)}async _sync(){this.watch();try{let e=await this.channel.perform("$presence:info",{});return this._state=this.stateFromInfo(e),this._state}finally{delete this._promise}}stateFromInfo(e){return e.records.reduce((r,{id:s,info:n})=>(r[s]=n,r),{})}}const we=Symbol("state");class Yr{constructor(e={}){this.emitter=ot(),this.params=Object.freeze(e),this.presence=new Hi(this),this.initialConnect=!0,this[we]="idle"}get identifier(){return this._identifier?this._identifier:(this._identifier=Kr({channel:this.channelId,...this.params}),this._identifier)}get channelId(){return this.constructor.identifier}get state(){return this[we]}attached(e){if(this.receiver){if(this.receiver!==e)throw Error("Already connected to a different receiver");return!1}return this.receiver=e,!0}connecting(){this[we]="connecting"}connected(){if(this.state==="connected"||this.state==="closed")return;this[we]="connected";let e=!1;this.initialConnect?(this.initialConnect=!1,this.emit("connect",{reconnect:!1,restored:e})):this.emit("connect",{reconnect:!0,restored:e})}restored(){if(this.state==="connected")throw Error("Already connected");this[we]="connected";let e=!0,r=!0;this.initialConnect=!1,this.emit("connect",{reconnect:r,restored:e})}disconnected(e){this.state==="disconnected"||this.state==="closed"||(this[we]="disconnected",this.presence.reset(),this.emit("disconnect",e))}closed(e){this.state!=="closed"&&(this[we]="closed",delete this.receiver,this.initialConnect=!0,this.presence.dispose(),this.emit("close",e))}disconnect(){this.state==="idle"||this.state==="closed"||this.receiver.unsubscribe(this)}async perform(e,r){if(this.state==="idle"||this.state==="closed")throw Error("Channel is not subscribed");return this.receiver.perform(this.identifier,e,r)}async send(e){return this.perform(void 0,e)}async whisper(e){try{await this.perform("$whisper",e)}catch(r){let s=this.receiver?this.receiver.logger:null;s&&s.warn("whisper failed: ",r)}}receive(e,r){this.emit("message",e,r)}on(e,r){return this.emitter.on(e,r)}once(e,r){let s=this.emitter.on(e,(...n)=>{s(),r(...n)});return s}emit(e,...r){return this.emitter.emit(e,...r)}ensureSubscribed(){return this.state==="connected"?Promise.resolve():this.state==="closed"?Promise.reject(Error("Channel is unsubscribed")):this.pendingSubscribe()}pendingSubscribe(){return this._pendingSubscribe?this._pendingSubscribe:(this._pendingSubscribe=new Promise((e,r)=>{let s=[()=>delete this._pendingSubscribe];s.push(this.on("connect",()=>{s.forEach(n=>n()),e()})),s.push(this.on("close",n=>{s.forEach(i=>i()),r(n||new $e("Channel was disconnected before subscribing","canceled"))}))}),this._pendingSubscribe)}}class Ki{constructor(e){this.id=e,this.intent="unsubscribed",this.state="idle",this.channels=[],this.disposed=!1,this._pendings=[]}add(e){this.channels.includes(e)||this.channels.push(e)}remove(e){let r=this.channels.indexOf(e);r>-1&&this.channels.splice(r,1)}notify(e,...r){this.state=e==="restored"?"connected":e,r.length===1?this.channels.forEach(s=>s[e](r[0])):this.channels.forEach(s=>s[e]())}pending(e){this._checkIntent(e);let r=this._pendings[0];return!r||r.intent!==e?Promise.resolve():r.promise}ensureResubscribed(){this.disposed||(this.intent=void 0,this.ensureSubscribed())}ensureSubscribed(){if(this.intent!=="subscribed"){if(this.disposed)throw Error("Subscription is disposed");this.intent="subscribed",!this._mergeWithPending("unsubscribed")&&this.subscriber(this)}}maybeUnsubscribe(){this.disposed||this.intent==="unsubscribed"||this.channels.length>0||(this.intent="unsubscribed",this._mergeWithPending("subscribed"))||this.unsubscriber(this)}async acquire(e){this._checkIntent(e);let r,s={promise:new Promise(i=>{r=i}),intent:e,release:()=>{this._pendings.splice(this._pendings.indexOf(s),1),r(s)},canceled:!1,acquired:!1},n=this._pendingTop;return this._pendings.push(s),n&&await n.promise,this.gvl&&await this.gvl.acquire(s,e),s.acquired=!0,s}close(e){this.disposed=!0,this.intent=void 0,this.notify("closed",e)}_checkIntent(e){if(!(e==="unsubscribed"||e==="subscribed"))throw Error(`Unknown subscription intent: ${e}`)}get _pendingTop(){return this._pendings.length?this._pendings[this._pendings.length-1]:void 0}_mergeWithPending(e){let r=this._pendingTop;return!r||r.acquired||r.intent!==e?!1:(this._pendings.pop(),r.canceled=!0,!0)}}class Yi{constructor(){this.queue=[]}async acquire(e,r){r==="subscribed"&&(this.queue.push(e.promise.then(()=>{this.queue.splice(this.queue.indexOf(e),1)})),this.queue.length>1&&await this.queue[this.queue.length-2])}}class Gi{constructor(e){e.concurrentSubscribes===!1&&(this.glv=new Yi),this._subscriptions={},this._localToRemote={}}all(){return Object.values(this._subscriptions)}get(e){return this._subscriptions[e]}create(e,{subscribe:r,unsubscribe:s}){let n=this._subscriptions[e]=new Ki(e);return n.remoteId=this._localToRemote[e],n.subscriber=r,n.unsubscriber=s,n.gvl=this.glv,n}remove(e){delete this._subscriptions[e],delete this._localToRemote[e]}storeRemoteId(e,r){this._localToRemote[e]=r;let s=this.get(e);s&&(s.remoteId=r)}}class Zi{constructor(e={}){this.subscriptions=new Gi(e),this._pendingMessages=[],this._remoteToLocal={}}subscribe(e,r){this._remoteToLocal[r]=e,this.subscriptions.storeRemoteId(e,r),this.flush(r)}unsubscribe(e){let r=this.subscriptions.get(e);if(!r)return;let s=r.remoteId;s&&delete this._remoteToLocal[s],this.subscriptions.remove(e)}transmit(e,r,s){let n=this._remoteToLocal[e];if(!n){this._pendingMessages.push([e,r,s]);return}let i=this.subscriptions.get(n);i&&i.channels.forEach(o=>{o.receive(r,s)})}notify(e,r,s){let n=this._remoteToLocal[e];if(!n)return;let i=this.subscriptions.get(n);i&&i.channels.forEach(o=>o.emit(r,s))}close(){this._pendingMessages.length=0}get size(){return this.channels.length}get channels(){return this.subscriptions.all().flatMap(e=>e.channels)}flush(e){let r=[];for(let s of this._pendingMessages)s[0]===e?this.transmit(s[0],s[1],s[2]):r.push(s);this._pendingMessages=r}}const Gr={debug:0,info:1,warn:2,error:3};class Zr{constructor(e){this.level=e||"warn"}log(e,r,s){Gr[e]<Gr[this.level]||this.writeLogEntry(e,r,s)}writeLogEntry(){throw Error("Not implemented")}debug(e,r){this.log("debug",e,r)}info(e,r){this.log("info",e,r)}warn(e,r){this.log("warn",e,r)}error(e,r){this.log("error",e,r)}}class qe extends Zr{writeLogEntry(){}}class Xi{encode(e){return JSON.stringify(e)}decode(e){try{return JSON.parse(e)}catch{}}}let Qi=0;class Xr{constructor(e={}){let{logger:r}=e;this.logger=r||new qe,this.pendingSubscriptions={},this.pendingUnsubscriptions={},this.subscribeCooldownInterval=e.subscribeCooldownInterval||250,this.subscribeRetryInterval=e.subscribeRetryInterval||5e3}attached(e){this.cable=e}subscribe(e,r){let s={channel:e};r&&Object.assign(s,r);let n=Kr(s);if(this.pendingUnsubscriptions[n]){let o=this.subscribeCooldownInterval*1.5;return this.logger.debug(`unsubscribed recently, cooldown for ${o}`,n),new Promise(a=>{setTimeout(()=>{a(this.subscribe(e,r))},o)})}if(this.pendingSubscriptions[n])return this.logger.warn("subscription is already pending, skipping",n),Promise.reject(Error("Already subscribing"));let i=this.subscribeRetryInterval;return new Promise((o,a)=>{let c=++Qi;this.pendingSubscriptions[n]={resolve:o,reject:a,id:c},this.cable.send(this.buildSubscribeRequest(n)),this.maybeRetrySubscribe(c,n,i)})}buildSubscribeRequest(e){return{command:"subscribe",identifier:e}}maybeRetrySubscribe(e,r,s){setTimeout(()=>{let n=this.pendingSubscriptions[r];n&&n.id===e&&(this.logger.warn(`no subscription ack received in ${s}ms, retrying subscribe`,r),this.cable.send(this.buildSubscribeRequest(r)),this.maybeExpireSubscribe(e,r,s))},s)}maybeExpireSubscribe(e,r,s){setTimeout(()=>{let n=this.pendingSubscriptions[r];n&&n.id===e&&(delete this.pendingSubscriptions[r],n.reject(new Wi(`Haven't received subscription ack in ${s*2}ms for ${r}`)))},s)}unsubscribe(e){return this.cable.send({command:"unsubscribe",identifier:e}),this.pendingUnsubscriptions[e]=!0,setTimeout(()=>{delete this.pendingUnsubscriptions[e]},this.subscribeCooldownInterval),Promise.resolve()}perform(e,r,s){return r==="$whisper"?this.whisper(e,s):(s||(s={}),s.action||=r,this.cable.send({command:"message",identifier:e,data:JSON.stringify(s)}),Promise.resolve())}whisper(e,r){return this.cable.send({command:"whisper",identifier:e,data:r}),Promise.resolve()}receive(e){if(typeof e!="object"){this.logger.error("unsupported message format",{message:e});return}let{type:r,identifier:s,message:n,reason:i,reconnect:o}=e;if(r==="ping")return this.cable.keepalive(e.message);if(this.cable.keepalive(),r==="welcome"){let a=e.sid;return a&&this.cable.setSessionId(a),this.cable.connected()}if(r==="disconnect"){let a=new te(i);this.reset(a),o===!1?this.cable.closed(a):this.cable.disconnected(a);return}if(r==="confirm_subscription"){let a=this.pendingSubscriptions[s];if(!a){this.logger.error("subscription not found, unsubscribing",{type:r,identifier:s}),this.unsubscribe(s);return}return delete this.pendingSubscriptions[s],a.resolve(s)}if(r==="reject_subscription"){let a=this.pendingSubscriptions[s];return a?(delete this.pendingSubscriptions[s],a.reject(new It)):this.logger.error("subscription not found",{type:r,identifier:s})}if(n)return{identifier:s,message:n};this.logger.warn(`unknown message type: ${r}`,{message:e})}reset(e){for(let r in this.pendingSubscriptions)this.pendingSubscriptions[r].reject(e);this.pendingSubscriptions={}}recoverableClosure(){return!1}}const Qr=()=>Date.now()/1e3|0;class eo extends Xr{constructor(e={}){super(e),this.streamsPositions={},this.subscriptionStreams={},this.pendingHistory={},this.pendingPresence={},this.presenceInfo={},this.restoreSince=e.historyTimestamp,this.disableSessionRecovery=e.disableSessionRecovery,this.restoreSince===void 0&&(this.restoreSince=Qr()),this.sessionId=void 0,this.sendPongs=e.pongs}reset(e){for(let r in this.pendingPresence)this.pendingPresence[r].reject(e);return this.pendingPresence={},super.reset()}receive(e){if(typeof e!="object"){this.logger.error("unsupported message format",{message:e});return}let{type:r,identifier:s,message:n}=e;if(r==="disconnect")return delete this.sessionId,this.cable.setSessionId(""),super.receive(e);if(r==="reject_subscription")return super.receive(e);if(r==="confirm_subscription")return this.subscriptionStreams[s]||(this.subscriptionStreams[s]=new Set),super.receive(e);if(r==="ping")return this.restoreSince&&(this.restoreSince=Qr()),this.sendPongs&&this.sendPong(),this.cable.keepalive(e.message);if(this.cable.keepalive(),r==="confirm_history"){this.logger.debug("history result received",e),this.cable.notify("history_received",s);return}if(r==="reject_history"){this.logger.warn("failed to retrieve history",e),this.cable.notify("history_not_found",s);return}if(r==="welcome"){if(this.disableSessionRecovery||(this.sessionId=e.sid,this.sessionId&&this.cable.setSessionId(this.sessionId)),e.restored){let i=e.restored_ids||Object.keys(this.subscriptionStreams);for(let o of i)this.cable.send({identifier:o,command:"history",history:this.historyRequestFor(o)}),this.presenceInfo[o]&&this.cable.send({identifier:o,command:"join",presence:this.presenceInfo[o]});return this.cable.restored(i)}return this.cable.connected(this.sessionId)}if(r==="presence"){let i=n.type;if(i==="info"){let o=this.pendingPresence[s];o&&(delete this.pendingPresence[s],o.resolve(n))}else if(i==="error"){let o=this.pendingPresence[s];o&&(delete this.pendingPresence[s],o.reject(new Error("failed to retrieve presence")))}return{type:r,identifier:s,message:n}}if(n){let i=this.trackStreamPosition(s,e.stream_id,e.epoch,e.offset);return{identifier:s,message:n,meta:i}}this.logger.warn(`unknown message type: ${r}`,{message:e})}perform(e,r,s){switch(r){case"$presence:join":return this.join(e,s);case"$presence:leave":return this.leave(e,s);case"$presence:info":return this.presence(e,s)}return super.perform(e,r,s)}unsubscribe(e){return delete this.presenceInfo[e],super.unsubscribe(e)}buildSubscribeRequest(e){let r=super.buildSubscribeRequest(e),s=this.historyRequestFor(e);s&&(r.history=s,this.pendingHistory[e]=!0);let n=this.presenceInfo[e];return n&&(r.presence=n),r}recoverableClosure(){return!!this.sessionId}historyRequestFor(e){let r={},s=!1;if(this.subscriptionStreams[e])for(let n of this.subscriptionStreams[e]){let i=this.streamsPositions[n];i&&(s=!0,r[n]=i)}if(!(!s&&!this.restoreSince))return{since:this.restoreSince,streams:r}}trackStreamPosition(e,r,s,n){if(!(!r||!s))return this.subscriptionStreams[e]||(this.subscriptionStreams[e]=new Set),this.subscriptionStreams[e].add(r),this.streamsPositions[r]={epoch:s,offset:n},{stream:r,epoch:s,offset:n}}async sendPong(){await new Promise(e=>setTimeout(e,0)),this.cable.state==="connected"&&this.cable.send({command:"pong"})}async join(e,r){return this.presenceInfo[e]=r,this.cable.send({command:"join",identifier:e,presence:r}),Promise.resolve()}async leave(e,r){return delete this.presenceInfo[e],this.cable.send({command:"leave",identifier:e,presence:r}),Promise.resolve()}presence(e,r){return this.pendingPresence[e]?(this.logger.warn("presence is already pending, skipping",e),Promise.reject(Error("presence request is already pending"))):new Promise((s,n)=>{this.pendingPresence[e]={resolve:s,reject:n},this.cable.send({command:"presence",identifier:e,data:r})})}}class to extends $e{constructor(){super("No connection","closed"),this.name="NoConnectionError"}}class es extends Yr{static identifier="__ghost__";constructor(e,r){super(r),this.channelId=e}set channelId(e){this._channelId=e}get channelId(){return this._channelId}}const ro="$pubsub";class ts extends Yr{static identifier=ro;async perform(e,r){if(e.startsWith("$"))return super.perform(e,r);throw Error("not implemented")}}const ve=Symbol("state");let so=class{constructor({transport:t,protocol:e,encoder:r,logger:s,lazy:n,hubOptions:i,performFailures:o,transportConfigurator:a}){this.emitter=ot(),this.transport=t,this.encoder=r,this.logger=s||new qe,this.protocol=e,this.performFailures=o||"throw",this.protocol.attached(this),this.hub=new Zi(i||{}),this[ve]="idle",this.handleClose=this.handleClose.bind(this),this.handleIncoming=this.handleIncoming.bind(this),this.transportConfigurator=a,this.transport.on("close",this.handleClose),this.transport.on("data",this.handleIncoming),this.initialConnect=!0,this.recovering=!1,n===!1&&this.connect().catch(()=>{})}get state(){return this[ve]}async connect(){if(this.state==="connected")return Promise.resolve();if(this.state==="connecting")return this.pendingConnect();let t=this.state==="idle";this[ve]="connecting";let e=this.pendingConnect();this.logger.debug("connecting");try{this.transportConfigurator&&await this.transportConfigurator(this.transport,{initial:t}),await this.transport.open()}catch(r){this.handleClose(r)}return e}setSessionId(t){this.sessionId=t,this.transport.setParam("sid",t)}connected(){if(this.state==="connected")return;this.logger.info("connected"),this[ve]="connected",this.recovering&&this.hub.subscriptions.all().forEach(e=>e.notify("disconnected",new te("recovery_failed"))),this.hub.subscriptions.all().forEach(e=>this._resubscribe(e));let t=!1;this.recovering=!1,this.initialConnect?(this.initialConnect=!1,this.emit("connect",{reconnect:!1,restored:t})):this.emit("connect",{reconnect:!0,restored:t})}restored(t){this.logger.info("connection recovered",{remoteIds:t}),this[ve]="connected",this.hub.subscriptions.all().forEach(s=>{t&&s.remoteId&&t.includes(s.remoteId)?s.notify("restored"):(s.notify("disconnected",new te("recovery_failed")),this._resubscribe(s))});let e=!this.initialConnect,r=!0;this.recovering=!1,this.initialConnect=!1,this.emit("connect",{reconnect:e,restored:r})}notify(t,e,r){e&&typeof e!="string"&&(r=e,e=void 0),e?this.hub.notify(e,"info",{type:t,data:r}):this.emit("info",{type:t,data:r})}handleClose(t){this.logger.debug("transport closed",{error:t}),this.disconnected(new te(t,"transport_closed"))}disconnected(t){(this.state==="connected"||this.state==="connecting")&&(this.logger.info("disconnected",{reason:t}),this[ve]="disconnected",this.recovering=this.protocol.recoverableClosure(t),this.recovering?this.hub.subscriptions.all().forEach(e=>e.notify("connecting")):this.hub.subscriptions.all().forEach(e=>{e.notify("disconnected",t)}),this.protocol.reset(t),this.hub.close(),this.transport.close(),this.emit("disconnect",t))}closed(t){if(this.state==="closed"||this.state==="idle")return;let e;t&&(e=t instanceof te?t:new te(t,void 0)),this.logger.info("closed",{reason:t||"user"}),this[ve]="closed";let r=e||new te("cable_closed");this.hub.subscriptions.all().forEach(s=>s.notify("disconnected",r)),this.hub.close(),this.protocol.reset(),this.transport.close(),this.initialConnect=!0,this.emit("close",e)}disconnect(){this.closed()}handleIncoming(t){if(this.state==="closed"||this.state==="idle")return;let e=this.encoder.decode(t);if(e===void 0){this.logger.error("failed to decode message",{message:t});return}this.logger.debug("incoming data",e);let r=this.protocol.receive(e);if(r){this.logger.debug("processed incoming message",r);let{type:s,identifier:n,message:i,meta:o}=r;s?this.hub.notify(n,s,i):this.hub.transmit(n,i,o)}}send(t){if(this.state==="closed")throw Error("Cable is closed");let e=this.encoder.encode(t);if(e===void 0){this.logger.error("failed to encode message",{message:t});return}this.logger.debug("outgoing message",t),this.transport.send(e)}keepalive(t){this.emit("keepalive",t)}streamFrom(t){let e=new ts({stream_name:t});return this.subscribe(e)}streamFromSigned(t){let e=new ts({signed_stream_name:t});return this.subscribe(e)}subscribeTo(t,e){let r,s;return typeof t=="string"&&(s=t,t=es),r=s?new t(s,e):new t(e),this.subscribe(r)}subscribe(t){if(!t.attached(this))return t;let e=t.identifier;t.connecting();let r=this.hub.subscriptions.get(e)||this.hub.subscriptions.create(e,{subscribe:s=>this._subscribe(s,t.channelId,t.params),unsubscribe:s=>this._unsubscribe(s)});return r.add(t),r.intent==="subscribed"&&r.state==="connected"&&t.connected(),r.ensureSubscribed(),t}async _resubscribe(t){t.intent!=="subscribed"||!t.channels[0]||(t.notify("connecting"),t.ensureResubscribed())}async _subscribe(t,e,r){let s=t.id;if(this.state==="idle"&&this.connect().catch(()=>{}),this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:s});return}this.logger.debug("acquiring subscribe lock",{identifier:s});let n=await t.acquire("subscribed");if(n.canceled){this.logger.debug("subscribe lock has been canceled",{identifier:s}),n.release();return}if(this.logger.debug("subscribe lock has been acquired",{identifier:s}),t.intent!=="subscribed"){this.logger.debug("cancel subscribe request, already unsubscribed"),n.release();return}if(this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:s}),n.release();return}if(t.state==="connected"){this.logger.debug("already connected, skip subscribe command",{identifier:s}),t.notify("connected"),n.release();return}let i={identifier:e,params:r};this.logger.debug("subscribing",i);try{let o=await this.protocol.subscribe(e,r);this.hub.subscribe(s,o),this.logger.debug("subscribed",{...i,remoteId:o}),t.notify("connected")}catch(o){if(o){if(o instanceof It&&this.logger.warn("rejected",i),o instanceof te){this.logger.debug("disconnected during subscription; will retry on connect",i),n.release();return}this.logger.error("failed to subscribe",{error:o,...i})}t.close(o),this.hub.unsubscribe(s)}n.release()}unsubscribe(t){let e=t.identifier,r=this.hub.subscriptions.get(e);if(!r)throw Error(`Subscription not found: ${e}`);r.remove(t),t.closed(),r.maybeUnsubscribe()}async _unsubscribe(t){let e=t.id;this.logger.debug("acquiring unsubscribe lock",{identifier:e});let r=await t.acquire("unsubscribed");if(r.canceled){this.logger.debug("unsubscribe lock has been canceled",{identifier:e}),r.release();return}if(this.logger.debug("unsubscribe lock has been acquired",{identifier:e}),t.intent!=="unsubscribed"){this.logger.debug("cancel unsubscribe, no longer needed",{identifier:e,intent:t.intent}),r.release();return}if(t.state==="disconnected"||t.state==="closed"){this.logger.debug(`already ${t.state} connected, skip unsubscribe command`,{identifier:e}),r.release();return}let s=t.remoteId;if(this.logger.debug("unsubscribing...",{remoteId:s}),this.state!=="connected"){this.logger.debug("unsubscribe skipped (cable is not connected)",{id:e}),t.close(),this.hub.unsubscribe(e),r.release();return}try{await this.protocol.unsubscribe(s),this.logger.debug("unsubscribed remotely",{id:e})}catch(n){n&&(n instanceof te?this.logger.debug("cable disconnected during the unsubscribe command execution",{id:e,error:n}):this.logger.error("unsubscribe failed",{id:e,error:n}))}t.intent==="unsubscribed"?(t.close(),this.hub.unsubscribe(e)):t.state="closed",r.release()}async perform(t,e,r){if(this.performFailures==="throw")return this._perform(t,e,r);try{return await this._perform(t,e,r)}catch(s){this.performFailures==="warn"&&this.logger.warn("perform failed",{error:s});return}}async _perform(t,e,r){if(this.state==="connecting"&&await this.pendingConnect(),this.state==="closed"||this.state==="disconnected")throw new to;let s=this.hub.subscriptions.get(t);if(!s)throw Error(`Subscription not found: ${t}`);if(await s.pending("subscribed"),s.intent!=="subscribed")throw Error(`Subscription is closed: ${t}`);let n=s.remoteId,i={id:n,action:e,payload:r};this.logger.debug("perform",i);try{let o=await this.protocol.perform(n,e,r);return o&&this.logger.debug("perform result",{message:o,request:i}),o}catch(o){throw this.logger.error("perform failed",{error:o,request:i}),o}}on(t,e){return this.emitter.on(t,e)}once(t,e){let r=this.emitter.on(t,(...s)=>{r(),e(...s)});return r}emit(t,...e){return this.emitter.emit(t,...e)}pendingConnect(){return this._pendingConnect?this._pendingConnect:(this._pendingConnect=new Promise((t,e)=>{let r=[()=>delete this._pendingConnect];r.push(this.on("connect",()=>{r.forEach(s=>s()),t()})),r.push(this.on("close",s=>{r.forEach(n=>n()),e(s)})),r.push(this.on("disconnect",s=>{r.forEach(n=>n()),e(s)}))}),this._pendingConnect)}};const no={maxMissingPings:2,maxReconnectAttempts:1/0},ke=()=>Date.now(),rs=(t,e)=>{e=e||{};let{backoffRate:r,jitterRatio:s,maxInterval:n}=e;return r=r||2,s===void 0&&(s=.5),i=>{let o=t*r**i,a=o*r,c=o+(a-o)*Math.random(),d=2*(Math.random()-.5)*s;return c=c*(1+d),n&&n<c&&(c=n),c}};let ss=class{constructor({pingInterval:t,...e}){if(this.pingInterval=t,!this.pingInterval)throw Error(`Incorrect pingInterval is provided: ${t}`);if(e=Object.assign({},no,e),this.strategy=e.reconnectStrategy,!this.strategy)throw Error("Reconnect strategy must be provided");this.maxMissingPings=e.maxMissingPings,this.maxReconnectAttempts=e.maxReconnectAttempts,this.logger=e.logger||new qe,this.state="pending_connect",this.attempts=0,this.disconnectedAt=ke()}watch(t){this.target=t,this.initListeners()}reconnectNow(){return this.state==="connected"||this.state==="pending_connect"||this.state==="closed"?!1:(this.cancelReconnect(),this.state="pending_connect",this.target.connect().catch(t=>{this.logger.info("Failed at reconnecting: "+t)}),!0)}initListeners(){this.unbind=[],this.unbind.push(this.target.on("connect",()=>{this.attempts=0,this.pingedAt=ke(),this.state="connected",this.cancelReconnect(),this.startPolling()})),this.unbind.push(this.target.on("disconnect",()=>{this.disconnectedAt=ke(),this.state="disconnected",this.stopPolling(),this.scheduleReconnect()})),this.unbind.push(this.target.on("close",()=>{this.disconnectedAt=ke(),this.state="closed",this.cancelReconnect(),this.stopPolling()})),this.unbind.push(this.target.on("keepalive",()=>{this.pingedAt=ke()})),this.unbind.push(()=>{this.cancelReconnect(),this.stopPolling()})}dispose(){delete this.target,this.unbind&&this.unbind.forEach(t=>t()),delete this.unbind}startPolling(){this.pollId&&clearTimeout(this.pollId);let t=this.pingInterval+(Math.random()-.5)*this.pingInterval*.5;this.pollId=setTimeout(()=>{this.checkStale(),this.state==="connected"&&this.startPolling()},t)}stopPolling(){this.pollId&&clearTimeout(this.pollId)}checkStale(){let t=ke()-this.pingedAt;t>this.maxMissingPings*this.pingInterval&&(this.logger.warn(`Stale connection: ${t}ms without pings`),this.state="pending_disconnect",this.target.disconnected(new Ji))}scheduleReconnect(){if(this.attempts>=this.maxReconnectAttempts){this.target.close();return}let t=this.strategy(this.attempts);this.attempts++,this.logger.info(`Reconnecting in ${t}ms (${this.attempts} attempt)`),this.state="pending_reconnect",this.reconnnectId=setTimeout(()=>this.reconnectNow(),t)}cancelReconnect(){this.reconnnectId&&(clearTimeout(this.reconnnectId),delete this.reconnnectId)}};class io{constructor(e,r={}){this.transports=e,this.transport=null,this.emitter=ot(),this.unbind=[],this.logger=r.logger||new qe}displayName(){return"fallbacked transport"}async open(){for(let e=0;e<this.transports.length;e++){let r=this.transports[e];try{this.transport=r,this.resetListeners(),this.logger.debug(`Trying to connect via ${r.displayName()}`),await r.open(),this.logger.debug(`Connected via ${r.displayName()}`);return}catch(s){this.logger.debug(`Failed to connect via ${r.displayName()}: ${s.message}`)}}throw this.transport=null,this.resetListeners(),new Error("Couldn't connect via any available transport")}send(e){if(!this.transport)throw new Error("No transport is open");this.transport.send(e)}async close(){if(!this.transport)throw new Error("No transport is open");await this.transport.close(),this.transport=null}setURL(){throw new Error("Not implemented. Set URL for each transport separately")}setParam(e,r){this.transports.forEach(s=>{s.setParam(e,r)})}setToken(e,r){this.transports.forEach(s=>{s.setToken(e,r)})}on(e,r){return this.emitter.on(e,r)}once(e,r){let s=this.emitter.on(e,(...n)=>{s(),r(...n)});return s}get url(){return this.transport?this.transport.url:""}resetListeners(){this.unbind.forEach(e=>e()),this.unbind.length=0,this.transport&&this.unbind.push(this.transport.on("open",()=>{this.emitter.emit("open")}),this.transport.on("data",e=>{this.emitter.emit("data",e)}),this.transport.on("close",e=>{this.emitter.emit("close",e)}),this.transport.on("error",e=>{this.emitter.emit("error",e)}))}}class oo{constructor(e,r={}){this.url=e;let s=r.websocketImplementation;if(s)this.Impl=s;else if(typeof WebSocket<"u")this.Impl=WebSocket;else throw new Error("No WebSocket support");this.connected=!1,this.emitter=ot();let{format:n,subprotocol:i,authStrategy:o}=r;this.format=n||"text",this.connectionOptions=r.websocketOptions,this.authStrategy=o||"param",this.authProtocol="",this.subprotocol=i}displayName(){return"WebSocket("+this.url+")"}open(){let e=this.subprotocol;return this.authStrategy==="sub-protocol"&&(e=[this.subprotocol,this.authProtocol]),this.connectionOptions?this.ws=new this.Impl(this.url,e,this.connectionOptions):this.ws=new this.Impl(this.url,e),this.ws.binaryType="arraybuffer",this.initListeners(),new Promise((r,s)=>{let n=[];n.push(this.once("open",()=>{n.forEach(i=>i()),r()})),n.push(this.once("close",()=>{n.forEach(i=>i()),s(Error("WS connection closed"))}))})}setURL(e){this.url=e}setParam(e,r){let s=new URL(this.url);s.searchParams.set(e,r);let n=`${s.protocol}//${s.host}${s.pathname}?${s.searchParams}`;this.setURL(n)}setToken(e,r="jid"){if(this.authStrategy==="param")this.setParam(r,e);else if(this.authStrategy==="header"){this.connectionOptions=this.connectionOptions||{},this.connectionOptions.headers=this.connectionOptions.headers||{};let s=`x-${r}`.toLowerCase();s=Object.keys(this.connectionOptions.headers).find(n=>n.toLowerCase()===s)||s,this.connectionOptions.headers[s]=e}else if(this.authStrategy==="sub-protocol")this.authProtocol=`anycable-token.${e}`;else throw new Error("Unknown auth strategy: "+this.authStrategy)}send(e){if(!this.ws||!this.connected)throw Error("WebSocket is not connected");this.ws.send(e)}close(){this.ws?this.onclose():this.connected=!1}on(e,r){return this.emitter.on(e,r)}once(e,r){let s=this.emitter.on(e,(...n)=>{s(),r(...n)});return s}initListeners(){this.ws.onerror=e=>{this.connected&&this.emitter.emit("error",e.error||new Error("WS Error"))},this.ws.onclose=()=>{this.onclose()},this.ws.onmessage=e=>{let r=e.data;this.format==="binary"&&(r=new Uint8Array(r)),this.emitter.emit("data",r)},this.ws.onopen=()=>{this.connected=!0,this.emitter.emit("open")}}onclose(){this.ws.onclose=void 0,this.ws.onmessage=void 0,this.ws.onopen=void 0,this.ws.close(),delete this.ws,this.connected=!1,this.emitter.emit("close")}}class ao{constructor(e){this.channel=e}notify(e,...r){typeof this[e]=="function"&&this[e](...r)}perform(e,r={}){this.channel.perform(e,r)}send(e){this.channel.send(e)}whisper(e){return this.channel.whisper(e)}get identifier(){return this.channel.identifier}unsubscribe(){return this.channel.disconnect()}}class co extends es{constructor(e,r,s){super(e,r),this.subscription=new ao(this),Object.assign(this.subscription,s),this.on("connect",({reconnect:n})=>this.subscription.notify("connected",{reconnected:n})),this.on("disconnect",()=>this.subscription.notify("disconnected",{allowReconnect:!0})),this.on("message",n=>this.subscription.notify("received",n)),this.on("close",n=>{n&&n instanceof It?this.subscription.notify("rejected"):this.subscription.notify("disconnected",{allowReconnect:!1})})}}class lo{constructor(e){this.cable=e}create(e,r){let s,n;typeof e=="object"?(s=e.channel,delete e.channel,n=e):(s=e,n={});let i=new co(s,n,r);return i.subscription.notify("initialized"),this.cable.subscribe(i),i.subscription}findAll(e){return this.cable.hub.channels.filter(r=>r.identifier===e).map(r=>r.subscription)}}class uo{constructor(e){this.cable=e,this.subscriptions=new lo(e)}send(e){return this.cable.send(e)}connect(){return this.cable.connect()}disconnect(){return this.cable.disconnect()}ensureActiveConnection(){return this.cable.connect()}}const ns={protocol:"actioncable-v1-json",pingInterval:3e3,maxReconnectAttempts:1/0,maxMissingPings:2,logLevel:"warn",lazy:!0};function ho(t,e){if(typeof t=="object"&&typeof e>"u"&&(e=t,t=void 0),e=e||{},!t&&!e.transport)throw Error("URL or transport must be specified");e=Object.assign({},ns,e);let{protocol:r,websocketImplementation:s,websocketFormat:n,websocketOptions:i,websocketAuthStrategy:o,fallbacks:a,logLevel:c,logger:d,transport:u,encoder:h,lazy:p,monitor:y,pingInterval:C,reconnectStrategy:P,maxMissingPings:v,maxReconnectAttempts:S,subprotocol:g,tokenRefresher:b,historyTimestamp:f,protocolOptions:I,concurrentSubscribes:R,performFailures:H,transportConfigurator:ie,auth:k}=e;if(d=d||new qe(c),typeof r=="string"){g=g||r;let re=r.substring(0,r.lastIndexOf("-")),ae=r.substring(r.lastIndexOf("-")+1);if(I=I||{},re==="actioncable-v1")r=new Xr({logger:d,...I});else if(re==="actioncable-v1-ext")r=new eo({logger:d,historyTimestamp:f,...I});else throw Error(`Protocol is not supported yet: ${r}`);if(ae==="json")h=h||new Xi,n=n||"text";else if(ae==="msgpack"){if(n="binary",!h)throw Error("Msgpack encoder must be specified explicitly. Use `@anycable/msgpack-encoder` package or build your own")}else if(ae==="protobuf"){if(n=n||"binary",!h)throw Error("Protobuf encoder must be specified explicitly. Use `@anycable/protobuf-encoder` package or build your own")}else throw Error(`Protocol is not supported yet: ${r}`)}if(!r)throw Error("Protocol must be specified");u=u||new oo(t,{websocketImplementation:s,websocketOptions:i,subprotocol:g,authStrategy:o,format:n}),a&&(u=new io([u,...a],{logger:d})),k&&k.token&&u.setToken(k.token,k.param||"jid"),P=P||rs(C),y!==!1&&(y=y||new ss({pingInterval:C,reconnectStrategy:P,maxMissingPings:v,maxReconnectAttempts:S,logger:d}));let j={concurrentSubscribes:R},q=new so({protocol:r,transport:u,encoder:h,logger:d,lazy:p,hubOptions:j,performFailures:H,transportConfigurator:ie});return y&&(y.watch(q),q.monitor=y),b&&fo(q,async()=>{try{await b(u)}catch(re){return d.error("Failed to refresh authentication token: "+re),!1}return q.connect().catch(()=>{}),!0}),q}function fo(t,e){let r=!1;t.on("connect",()=>r=!1),t.on("close",async s=>{if(s){if(r){t.logger.warn("Token auto-refresh is disabled",s);return}s.reason==="token_expired"&&(r=!0,await e())}})}class po extends Zr{writeLogEntry(e,r,s){s?console[e](r,s):console[e](r)}}class mo extends ss{watch(e){super.watch(e),this.initActivityListeners()}initActivityListeners(){if(typeof document<"u"&&typeof window<"u"&&document.addEventListener&&window.addEventListener){let e=()=>{document.hidden||this.reconnectNow()&&this.logger.debug("Trigger reconnect due to visibility change")},r=n=>{this.reconnectNow()&&this.logger.debug("Trigger reconnect",{event:n})},s=()=>this.disconnect(new te("page_frozen"));document.addEventListener("visibilitychange",e,!1),window.addEventListener("focus",r,!1),window.addEventListener("online",r,!1),window.addEventListener("resume",r,!1),window.addEventListener("freeze",s,!1),this.unbind.push(()=>{document.removeEventListener("visibilitychange",e,!1),window.removeEventListener("focus",r,!1),window.removeEventListener("online",r,!1),window.removeEventListener("resume",r,!1),window.removeEventListener("freeze",s,!1)})}}disconnect(e){this.state==="disconnected"||this.state==="closed"||(this.logger.info("Disconnecting",{reason:e.message}),this.cancelReconnect(),this.stopPolling(),this.state="pending_disconnect",this.target.disconnected(e))}}const go=["cable","action-cable"],bo="/cable",at=(t,e)=>{for(let r of go){let s=t.head.querySelector(`meta[name='${r}-${e}']`);if(s)return s.getAttribute("content")}},is=t=>t.match(/wss?:\/\//)?t:typeof window<"u"?`${window.location.protocol.replace("http","ws")}//${window.location.host}${t}`:t,_o=()=>{if(typeof document<"u"&&document.head){let t=at(document,"url");if(t)return is(t)}return is(bo)},yo=()=>{if(typeof document<"u"&&document.head){let t=at(document,"history-timestamp");if(t)return t|0}},wo=()=>{if(typeof document<"u"&&document.head)return at(document,"token")},vo=()=>{if(typeof document<"u"&&document.head)return at(document,"token-param")};function So(t,e){typeof t=="object"&&typeof e>"u"&&(e=t,t=void 0),t=t||_o(),e=e||{},e.historyTimestamp||=yo();let r=wo();if(r){let d=vo();e.auth=Object.assign({token:r,param:d},e.auth||{})}e=Object.assign({},ns,e);let{logLevel:s,logger:n,pingInterval:i,reconnectStrategy:o,maxMissingPings:a,maxReconnectAttempts:c}=e;return n=e.logger=e.logger||new po(s),o=e.reconnectStrategy=e.reconnectStrategy||rs(i),e.monitor!==!1&&(e.monitor=e.monitor||new mo({pingInterval:i,reconnectStrategy:o,maxMissingPings:a,maxReconnectAttempts:c,logger:n})),ho(t,e)}function Eo(t,e){let r=So(t,e);return new uo(r)}const Oo=1e3;class xo{constructor(e,r,s,n,i){this._cable=e,this._channel=r,this._scope=s,this._callbacks=n,this._additionalOptions=i,this._subscription=null,this._unsubscribed=!1}get identifier(){return this._subscription?.identifier}perform(e,r){return this._subscription?.perform(e,r)}send(e){return this._subscription?.send(e)}unsubscribe(){return this._unsubscribed=!0,this._cable._forget(this),this._subscription?.unsubscribe()}_subscribe(e){this._unsubscribed||(this._subscription=e.subscriptions.create({channel:this._channel,token:localStorage.openc3Token,...this._additionalOptions},{...this._callbacks,disconnected:r=>{this._unsubscribed||(r?.allowReconnect===!1&&this._cable._scheduleRecovery(),this._callbacks.disconnected?.(r))}}))}}class os{constructor(e="/openc3-api/cable"){this._cable=null,this._url=e,this._subscriptions=new Set,this._recovery=null}disconnect(){this._cancelRecovery(),this._subscriptions.forEach(e=>{e._unsubscribed=!0}),this._subscriptions.clear(),this._cable&&(this._cable.cable.disconnect(),this._cable=null)}createSubscription(e,r,s={},n={}){const i=new xo(this,e,r,s,n);return this._subscriptions.add(i),this._resubscribe(i).then(()=>i)}_resubscribe(e){if(this._cable==null){const r=new URL(this._url,document.baseURI);r.searchParams.set("scope",e._scope),this._cable=Eo(r.href)}return OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity).then(r=>{r&&OpenC3Auth.setTokens(),this._cable&&e._subscribe(this._cable)}).catch(r=>{if(!it(r))throw r})}_scheduleRecovery(){this._recovery||(this._recovery=setTimeout(()=>{const e=[...this._subscriptions];this._cable&&(this._cable.cable.disconnect(),this._cable=null),e.reduce((r,s)=>r.then(()=>this._resubscribe(s)),Promise.resolve()).catch(r=>console.error("failed to recover cable",r)).finally(()=>{this._recovery=null})},Oo))}_cancelRecovery(){this._recovery&&(clearTimeout(this._recovery),this._recovery=null)}_forget(e){this._subscriptions.delete(e),this._subscriptions.size===0&&this._cancelRecovery()}recordPing(){}}function Ve(t){return Ro.test(t)}const Ro=/^-?[0-9]+$/;function as(t){return Co.test(t)}const Co=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function cs(t,e){if(Ve(t))return Number.isSafeInteger(Number.parseInt(t,10));const r=Number.parseFloat(t),s=String(r);if(t===s)return!0;const n=ls(t),i=ls(s);return!!(n===i||e?.approx===!0&&!Ve(t)&&i.length>=14&&n.startsWith(i.substring(0,14)))}let Me=(function(t){return t.underflow="underflow",t.overflow="overflow",t.truncate_integer="truncate_integer",t.truncate_float="truncate_float",t})({});function ko(t){if(cs(t,{approx:!1}))return;if(Ve(t))return Me.truncate_integer;const e=Number.parseFloat(t);return Number.isFinite(e)?e===0?Me.underflow:Me.truncate_float:Me.overflow}function ls(t){const{start:e,end:r}=Ao(t),s=t.substring(e,r),n=s.indexOf(".");return n===-1?s:s.substring(0,n)+s.substring(n+1)}function Ao(t){let e=0;for(t[0]==="-"&&e++;t[e]==="0"||t[e]===".";)e++;let r=t.lastIndexOf("e");for(r===-1&&(r=t.lastIndexOf("E")),r===-1&&(r=t.length);(t[r-1]==="0"||t[r-1]===".")&&r>e;)r--;return{start:e,end:r}}class Po{isLosslessNumber=!0;constructor(e){if(!as(e))throw new Error(`Invalid number (value: "${e}")`);this.value=e}valueOf(){const e=ko(this.value);if(e===void 0||e===Me.truncate_float)return Number.parseFloat(this.value);if(Ve(this.value))return BigInt(this.value);throw new Error(`Cannot safely convert to number: the value '${this.value}' would ${e} and become ${Number.parseFloat(this.value)}`)}toString(){return this.value}}function To(t){return t&&typeof t=="object"&&t.isLosslessNumber||!1}function Io(t){return new Po(t)}function Lo(t,e){return Lt({"":t},"",t,e)}function Lt(t,e,r,s){return Array.isArray(r)?s.call(t,e,No(r,s)):r&&typeof r=="object"&&!To(r)?s.call(t,e,jo(r,s)):s.call(t,e,r)}function jo(t,e){for(const r of Object.keys(t)){const s=Lt(t,r,t[r],e);s!==void 0?t[r]=s:delete t[r]}return t}function No(t,e){for(let r=0;r<t.length;r++)t[r]=Lt(t,String(r),t[r],e);return t}function Do(t,e,r){const s=typeof r=="function"?{parseNumber:r}:r,n=s?.parseNumber??Io,i=s?.onDuplicateKey??H;let o=0;const a=u();return S(a),b(),e?Lo(a,e):a;function c(){if(t.charCodeAt(o)===Vo){o++,p();const O={};let N=!0;for(;o<t.length&&t.charCodeAt(o)!==ds;){N?N=!1:(P(),p());const se=o,oe=y();if(oe===void 0){R();return}p(),v();const Y=u();if(Y===void 0){re();return}if(Object.prototype.hasOwnProperty.call(O,oe)&&!jt(Y,O[oe])){const F=i({key:oe,position:se+1,oldValue:O[oe],newValue:Y});F!==void 0&&(O[oe]=F)}else O[oe]=Y}return t.charCodeAt(o)!==ds&&ie(),o++,O}}function d(){if(t.charCodeAt(o)===Mo){o++,p();const O=[];let N=!0;for(;o<t.length&&t.charCodeAt(o)!==hs;){N?N=!1:P();const se=u();g(se),O.push(se)}return t.charCodeAt(o)!==hs&&k(),o++,O}}function u(){p();const O=y()??C()??c()??d()??h("true",!0)??h("false",!1)??h("null",null);return p(),O}function h(O,N){if(t.slice(o,o+O.length)===O)return o+=O.length,N}function p(){for(;Uo(t.charCodeAt(o));)o++}function y(){if(t.charCodeAt(o)===Nt){o++;let O="";for(;o<t.length&&t.charCodeAt(o)!==Nt;){if(t.charCodeAt(o)===qo){const N=t[o+1],se=$o[N];se!==void 0?(O+=se,o++):N==="u"?ct(t.charCodeAt(o+2))&&ct(t.charCodeAt(o+3))&&ct(t.charCodeAt(o+4))&&ct(t.charCodeAt(o+5))?(O+=String.fromCharCode(Number.parseInt(t.slice(o+2,o+6),16)),o+=5):ae(o):q(o)}else Bo(t.charCodeAt(o))?O+=t[o]:j(t[o]);o++}return I(),o++,O}}function C(){const O=o;if(t.charCodeAt(o)===fs&&(o++,f(O)),t.charCodeAt(o)===Dt)o++;else if(Fo(t.charCodeAt(o)))for(o++;lt(t.charCodeAt(o));)o++;if(t.charCodeAt(o)===Zo)for(o++,f(O);lt(t.charCodeAt(o));)o++;if(t.charCodeAt(o)===ra||t.charCodeAt(o)===ta)for(o++,(t.charCodeAt(o)===fs||t.charCodeAt(o)===Ko)&&o++,f(O);lt(t.charCodeAt(o));)o++;if(o>O)return n(t.slice(O,o))}function P(){if(t.charCodeAt(o)!==Go)throw new SyntaxError(`Comma ',' expected after value ${X()}`);o++}function v(){if(t.charCodeAt(o)!==Xo)throw new SyntaxError(`Colon ':' expected after property name ${X()}`);o++}function S(O){if(O===void 0)throw new SyntaxError(`JSON value expected ${X()}`)}function g(O){if(O===void 0)throw new SyntaxError(`Array item expected ${X()}`)}function b(){if(o<t.length)throw new SyntaxError(`Expected end of input ${X()}`)}function f(O){if(!lt(t.charCodeAt(o))){const N=t.slice(O,o);throw new SyntaxError(`Invalid number '${N}', expecting a digit ${X()}`)}}function I(){if(t.charCodeAt(o)!==Nt)throw new SyntaxError(`End of string '"' expected ${X()}`)}function R(){throw new SyntaxError(`Quoted object key expected ${X()}`)}function H(O){let{key:N,position:se}=O;throw new SyntaxError(`Duplicate key '${N}' encountered at position ${se}`)}function ie(){throw new SyntaxError(`Quoted object key or end of object '}' expected ${X()}`)}function k(){throw new SyntaxError(`Array item or end of array ']' expected ${X()}`)}function j(O){throw new SyntaxError(`Invalid character '${O}' ${W()}`)}function q(O){const N=t.slice(O,O+2);throw new SyntaxError(`Invalid escape character '${N}' ${W()}`)}function re(){throw new SyntaxError(`Object value expected after ':' ${W()}`)}function ae(O){const N=t.slice(O,O+6);throw new SyntaxError(`Invalid unicode character '${N}' ${W()}`)}function W(){return`at position ${o}`}function Ae(){return o<t.length?`but got '${t[o]}'`:"but reached end of input"}function X(){return`${Ae()} ${W()}`}}function Uo(t){return t===zo||t===Wo||t===Jo||t===Ho}function ct(t){return t>=Dt&&t<=Ut||t>=Qo&&t<=sa||t>=ea&&t<=na}function lt(t){return t>=Dt&&t<=Ut}function Fo(t){return t>=Yo&&t<=Ut}function Bo(t){return t>=32&&t<=1114111}function jt(t,e){return t===e?!0:Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((r,s)=>jt(r,e[s])):us(t)&&us(e)?[...new Set([...Object.keys(t),...Object.keys(e)])].every(r=>jt(t[r],e[r])):!1}function us(t){return typeof t=="object"&&t!==null}const $o={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
11
+ `,r:"\r",t:" "},qo=92,Vo=123,ds=125,Mo=91,hs=93,zo=32,Wo=10,Jo=9,Ho=13,Nt=34,Ko=43,fs=45,Dt=48,Yo=49,Ut=57,Go=44,Zo=46,Xo=58,Qo=65,ea=97,ta=69,ra=101,sa=70,na=102;function ps(t,e,r,s){return n(t);function n(c,d){if(Array.isArray(s)){const u=s.find(h=>h.test(c));if(u){const h=u.stringify(c);if(typeof h!="string"||!as(h))throw new Error(`Invalid JSON number: output of a number stringifier must be a string containing a JSON number (output: ${h})`);return h}}if(typeof c=="boolean"||typeof c=="number"||typeof c=="string"||c===null||c instanceof Date||c instanceof Boolean||c instanceof Number||c instanceof String)return JSON.stringify(c);if(c?.isLosslessNumber||typeof c=="bigint")return c.toString();if(Array.isArray(c))return i(c);if(c&&typeof c=="object")return o(c)}function i(c,d){if(c.length===0)return"[]";let u="[";for(let h=0;h<c.length;h++){const p=c[h];typeof p<"u"&&typeof p!="function"?u+=n(p):u+="null",h<c.length-1&&(u+=",")}return u+="]",u}function o(c,d){if(typeof c.toJSON=="function")return ps(c.toJSON(),e,r,void 0);const u=Array.isArray(e)?e.map(String):Object.keys(c);if(u.length===0)return"{}";let h=!0,p="{";for(const y of u){const C=c[y];if(a(y,C)){h?h=!1:p+=",";const P=JSON.stringify(y);p+=`${P}:`,p+=n(C)}}return p+="}",p}function a(c,d){return typeof d<"u"&&typeof d!="function"&&typeof d!="symbol"}}function ia(t){return Ve(t)&&!cs(t)?BigInt(t):Number.parseFloat(t)}class ms{id=1;constructor(){}async exec(e,r,s={},n={},i=6e4){await zi(),this.id=this.id+1;try{return s.scope=window.openc3Scope,n.manual=!0,(await Hr.post("/openc3-api/api",{jsonrpc:"2.0",method:e,params:r,id:this.id,keyword_params:s},{headers:{Authorization:localStorage.openc3Token,"Content-Type":"application/json-rpc",...n},timeout:i,transformRequest:[(o,a)=>ps(o)],transformResponse:[o=>{try{return Do(o,void 0,ia)}catch{const a=typeof o=="string"?o.substring(0,200):String(o),c=new Error(`Server returned non-JSON response: ${a}`);throw c.name="ServerError",c}}]})).data.result}catch(o){let a=new Error;throw o.response?(a.name=o.response.data.error.data.class,a.message=o.response.data.error.data.message,a.object=o.response.data.error):o.request?(a.name="Request error",a.message="Request error, no response received"):a=o,a}}decode_openc3_type(e){if(e!==null&&typeof e=="object"&&e.json_class=="Float"&&e.raw){if(e.raw=="NaN")return NaN;if(e.raw=="Infinity")return 1/0;if(e.raw=="-Infinity")return-1/0}return null}encode_openc3_type(e){return Number.isNaN(e)?{json_class:"Float",raw:"NaN"}:e==Number.POSITIVE_INFINITY?{json_class:"Float",raw:"Infinity"}:e==Number.NEGATIVE_INFINITY?{json_class:"Float",raw:"-Infinity"}:null}ensure_offline_access(){this.offline_access_needed().then(e=>{e&&(localStorage.openc3OfflineToken?this.set_offline_access(localStorage.openc3OfflineToken).then(()=>{delete localStorage.openc3OfflineToken}):OpenC3Auth.getOfflineAccess())})}offline_access_needed(){return this.exec("offline_access_needed",[])}set_offline_access(e){return this.exec("set_offline_access",[e])}get_all_interface_info(){return this.exec("get_all_interface_info",[])}map_target_to_interface(e,r,s,n,i){return this.exec("map_target_to_interface",[e,r],{cmd_only:s,tlm_only:n,unmap_old:i})}unmap_target_from_interface(e,r,s,n){return this.exec("unmap_target_from_interface",[e,r],{cmd_only:s,tlm_only:n})}connect_interface(e,...r){return r.length>0?this.exec("connect_interface",[e,...r]):this.exec("connect_interface",[e])}disconnect_interface(e){return this.exec("disconnect_interface",[e])}interface_cmd(e,r,...s){return this.exec("interface_cmd",[e,r,...s])}interface_target_enable(e,r,s=!1,n=!1){return this.exec("interface_target_enable",[e,r],{cmd_only:s,tlm_only:n})}interface_target_disable(e,r,s=!1,n=!1){return this.exec("interface_target_disable",[e,r],{cmd_only:s,tlm_only:n})}interface_details(e){return this.exec("interface_details",[e])}get_all_router_info(){return this.exec("get_all_router_info",[])}map_target_to_router(e,r,s,n,i){return this.exec("map_target_to_router",[e,r],{cmd_only:s,tlm_only:n,unmap_old:i})}unmap_target_from_router(e,r,s,n){return this.exec("unmap_target_from_router",[e,r],{cmd_only:s,tlm_only:n})}connect_router(e){return this.exec("connect_router",[e])}disconnect_router(e){return this.exec("disconnect_router",[e])}router_target_enable(e,r,s=!1,n=!1){return this.exec("router_target_enable",[e,r],{cmd_only:s,tlm_only:n})}router_target_disable(e,r,s=!1,n=!1){return this.exec("router_target_disable",[e,r],{cmd_only:s,tlm_only:n})}router_details(e){return this.exec("router_details",[e])}get_target_interfaces(){return this.exec("get_target_interfaces",[])}get_tlm_cnts(e){return this.exec("get_tlm_cnts",[e])}get_item(e,r,s){return this.exec("get_item",[e,r,s])}get_param(e,r,s){return this.exec("get_param",[e,r,s])}get_parameter(e,r,s){return this.get_param(e,r,s)}get_limits_sets(){return this.exec("get_limits_sets",[])}get_limits_set(){return this.exec("get_limits_set",[])}set_limits_set(e){return this.exec("set_limits_set",[e])}delete_limits_set(e){return this.exec("delete_limits_set",[e])}get_target(e){return this.exec("get_target",[e])}get_target_names(){return this.exec("get_target_names",[])}get_target_list(){return this.get_target_names()}get_tlm(e,r){return this.exec("get_tlm",[e,r])}get_telemetry(e,r){return this.get_tlm(e,r)}get_all_tlm(e){return this.exec("get_all_tlm",[e])}get_all_telemetry(e){return this.get_all_tlm(e)}get_all_tlm_names(e,r=!1){return this.exec("get_all_tlm_names",[e],{hidden:r})}get_all_telemetry_names(e){return this.get_all_tlm_names(e)}get_all_tlm_item_names(e){return this.exec("get_all_tlm_item_names",[e])}async get_tlm_packet(e,r,s,n=30){const i=await this.exec("get_tlm_packet",[e,r],{type:s,stale_time:n});if(i!=null){let o=i.length,a=null;for(let c=0;c<o;c++)a=this.decode_openc3_type(i[c][1]),a!==null&&(i[c][1]=a)}return i}get_packet_derived_items(e,r){return this.exec("get_packet_derived_items",[e,r])}get_tlm_buffer(e,r){return this.exec("get_tlm_buffer",[e,r])}get_tlm_available(e,r={},s={}){return this.exec("get_tlm_available",[e],r,s)}async get_tlm_values(e,r=30,s=null,n=null,i=null,o={}){let a={stale_time:r};s!==null&&(a.cache_timeout=s),n!==null&&(a.start_time=n.toISOString()),i!==null&&(a.end_time=i.toISOString());const c=await this.exec("get_tlm_values",[e],a,o,1e4);if(c&&c.length>0){let d=c.length,u=null;for(let h=0;h<d;h++)u=this.decode_openc3_type(c[h][0]),u!==null&&(c[h][0]=u)}return c}get_limits(e,r,s){return this.exec("get_limits",[e,r,s])}async tlm(e,r,s,n="CONVERTED"){let i=null;if(r===void 0)i=await this.exec("tlm",[e]);else if(s===void 0)if(["RAW","CONVERTED","FORMATTED"].includes(r))i=await this.exec("tlm",[e],{type:r});else{let a=new Error;throw a.name="TypeError",a.message=`Invalid data type ${r}. Valid options are RAW, CONVERTED or FORMATTED.`,a}else i=await this.exec("tlm",[e,r,s],{type:n});let o=this.decode_openc3_type(i);return o!==null&&(i=o),i}async inject_tlm(e,r,s=null,n="CONVERTED",i=!1){await this.exec("inject_tlm",[e,r,s],{type:n,stored:i})}set_tlm(e,r,s,n){return this.exec("set_tlm",[e,r,s],{type:n})}override_tlm(e,r,s,n){return this.exec("override_tlm",[e,r,s],{type:n})}get_overrides(){return this.exec("get_overrides")}normalize_tlm(e,r,s,n){return this.exec("normalize_tlm",[e,r,s],{type:n})}get_all_cmds(e){return this.exec("get_all_cmds",[e])}get_all_commands(e){return this.get_all_cmds(e)}get_all_cmd_names(e,r=!1){return this.exec("get_all_cmd_names",[e],{hidden:r})}get_all_command_names(e){return this.get_all_cmd_names(e)}get_cmd(e,r){return this.exec("get_cmd",[e,r])}get_command(e,r){return this.get_cmd(e,r)}get_cmd_cnts(e){return this.exec("get_cmd_cnts",[e])}get_cmd_value(e,r,s,n="CONVERTED"){return this.exec("get_cmd_value",[e,r,s,n])}get_cmd_buffer(e,r){return this.exec("get_cmd_buffer",[e,r])}_cmd(e,r,s,n,i,o={}){let a=null;for(let c in n)Object.prototype.hasOwnProperty.call(n,c)&&(a=this.encode_openc3_type(n[c]),a!==null&&(n[c]=a));return this.exec(e,[r,s,n],o,i)}get_cmd_hazardous(e,r,s,n={}){return r===void 0?this.exec("get_cmd_hazardous",e,{},n):this._cmd("get_cmd_hazardous",e,r,s,n)}cmd(e,r,s,n={},i={}){return r===void 0?this.exec("cmd",e,i,n):this._cmd("cmd",e,r,s,n,i)}cmd_no_range_check(e,r,s,n={},i={}){return r===void 0?this.exec("cmd_no_range_check",e,i,n):this._cmd("cmd_no_range_check",e,r,s,n,i)}cmd_raw(e,r,s,n={},i={}){return r===void 0?this.exec("cmd_raw",e,i,n):this._cmd("cmd_raw",e,r,s,n,i)}cmd_raw_no_range_check(e,r,s,n={},i={}){return r===void 0?this.exec("cmd_raw_no_range_check",e,i,n):this._cmd("cmd_raw_no_range_check",e,r,s,n,i)}cmd_no_hazardous_check(e,r,s,n={},i={}){return r===void 0?this.exec("cmd_no_hazardous_check",e,i,n):this._cmd("cmd_no_hazardous_check",e,r,s,n,i)}cmd_no_checks(e,r,s,n={},i={}){return r===void 0?this.exec("cmd_no_checks",e,i,n):this._cmd("cmd_no_checks",e,r,s,n,i)}cmd_raw_no_hazardous_check(e,r,s,n={},i={}){return r===void 0?this.exec("cmd_raw_no_hazardous_check",e,i,n):this._cmd("cmd_raw_no_hazardous_check",e,r,s,n,i)}cmd_raw_no_checks(e,r,s,n={},i={}){return r===void 0?this.exec("cmd_raw_no_checks",e,i,n):this._cmd("cmd_raw_no_checks",e,r,s,n,i)}build_cmd(e,r,s,n={},i={}){return r===void 0?this.exec("build_cmd",e,i,n):this._cmd("build_cmd",e,r,s,n,i)}build_command(e,r,s,n={},i={}){return this.build_cmd(e,r,s,n,i)}get_interface_names(){return this.exec("get_interface_names",[])}get_router_names(){return this.exec("get_router_names",[])}send_raw(e,r){return this.exec("send_raw",[e,r])}list_configs(e){return this.exec("list_configs",[e])}load_config(e,r){return this.exec("load_config",[e,r])}save_config(e,r,s){return this.exec("save_config",[e,r,s])}delete_config(e,r){return this.exec("delete_config",[e,r])}enable_limits(e,r,s){return this.exec("enable_limits",[e,r,s])}disable_limits(e,r,s){return this.exec("disable_limits",[e,r,s])}get_out_of_limits(){return this.exec("get_out_of_limits",[])}get_overall_limits_state(e){return this.exec("get_overall_limits_state",[e])}list_settings(){return this.exec("list_settings",[])}get_all_settings(){return this.exec("get_all_settings",[])}get_setting(e,r){return this.exec("get_setting",[e],r)}get_settings(e,r){return this.exec("get_settings",e,r)}set_setting(e,r){return this.exec("set_setting",[e,r])}update_news(){return this.exec("update_news",[])}update_plugin_store(){return this.exec("update_plugin_store",[])}save_setting(e,r){return this.set_setting(e,r)}get_metrics(){return this.exec("get_metrics",[])}open_tab(e){window.open(e,"_blank")}async hashString(e){if(window.isSecureContext){const r=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",r),n=new Uint8Array(s);return Array.from(n).map(i=>i.toString(16).padStart(2,"0")).join("")}}}const oa={components:{ValueWidget:Ht,ValuelimitsbarWidget:Kt},mixins:[ht],props:{modelValue:{type:Array,default:()=>[]},timeZone:{type:String,default:"local"}},emits:["update:modelValue"],data(){return{api:null,cable:new os,ignored:[],ignoredItemsDialog:!1,overallState:"GREEN",currentLimitsSet:"",items:[],itemList:[],screenItems:[],availableItems:[],screenValues:{},updateCounter:0,itemsPerPage:25,search:"",stateFilter:[],stateFilterOptions:[{value:"RED",label:"Critical",status:"critical"},{value:"YELLOW",label:"Caution",status:"caution"},{value:"GREEN",label:"Normal",status:"normal"},{value:"BLUE",label:"Standby",status:"standby"}],headers:[{title:"Timestamp",key:"timestamp",width:"130px",sortable:!0,nowrap:!0},{title:"Item",key:"item",value:t=>t.parameters[2],sortable:!0,minWidth:"100px",width:"200px",maxWidth:"410px"},{title:"Value",key:"value",width:"380px",sortable:!1},{title:"Controls",key:"actions",width:"80px",sortable:!1},{title:"",key:"limits",sortable:!1}],valueLimitsBarWidgetSettings:[["WIDTH","380px"],["0","WIDTH","200px"],["1","WIDTH","180px"]],valueWidgetSettings:[["WIDTH","200px"]]}},computed:{textFieldClass(){return this.overallState?`textfield-${this.overallState.toLowerCase()}`:""},overallStateFormatted(){return this.ignored.length===0?this.overallState:`${this.overallState} (Some items ignored)`},ignoredFormatted(){return this.ignored.map(t=>t.split("__").join(" "))},astroStatus(){switch(this.overallState){case"GREEN":return"normal";case"YELLOW":return"caution";case"RED":return"critical";case"BLUE":return"standby";default:return null}}},created(){this.api=new ms;for(let t of this.modelValue)t.match(/.+__.+__.+/)?this.ignoreItem(t,!0):this.ignorePacket(t,!0);this.updateOutOfLimits(),this.getCurrentLimitsSet(),this.currentSetRefreshInterval=setInterval(this.getCurrentLimitsSet,10*1e3),this.cable.createSubscription("LimitsEventsChannel",window.openc3Scope,{received:t=>{this.cable.recordPing(),this.handleMessages(t)}}).then(t=>{this.limitsSubscription=t}),this.cable.createSubscription("ConfigEventsChannel",window.openc3Scope,{received:t=>{this.cable.recordPing();const e=JSON.parse(t);this.handleConfigEvents(e)}}).then(t=>{this.configSubscription=t})},mounted(){this.updater=setInterval(()=>{this.update()},1e3)},unmounted(){this.updater!=null&&(clearInterval(this.updater),this.updater=null),this.limitsSubscription&&this.limitsSubscription.unsubscribe(),this.configSubscription&&this.configSubscription.unsubscribe(),this.cable.disconnect()},methods:{rowProps({item:t}){return this.stateFilter.length>0&&!this.stateFilter.some(e=>t.limitsState?.includes(e))?{class:"state-filtered-row"}:{}},escapeBrackets(t){return t.includes("[")?t.replace(/\[/g,"[[").replace(/\]/g,"]]"):t},getCurrentLimitsSet:function(){this.api.get_limits_set().then(t=>{this.currentLimitsSet=t})},updateOutOfLimits(){this.items=[],this.itemList=[],this.api.get_out_of_limits().then(t=>{for(const e of t){let r=e.join("__");if(this.ignored.find(n=>r.includes(n)))continue;this.itemList.push(r);let s={key:e.slice(0,3).join("__"),parameters:[e[0],e[1],this.escapeBrackets(e[2])],timestamp:this.formatDateTime(new Date,this.timeZone),limitsState:e[3]};e[3].includes("YELLOW")&&this.overallState!=="RED"&&(this.overallState="YELLOW"),e[3].includes("RED")&&(this.overallState="RED"),e[3]=="YELLOW"||e[3]=="RED"?s.limits=!1:s.limits=!0,this.items.push(s)}this.calcOverallState()})},calcOverallState(){let t="GREEN";for(let e of this.itemList)if(!this.ignored.find(r=>e.includes(r))&&(e.includes("YELLOW")&&t!=="RED"&&(t="YELLOW"),e.includes("RED"))){t="RED";break}this.overallState=t},ignorePacket(t,e){let[r,s,n]=t.split("__"),i=`${r}__${s}`;for(this.ignored.push(i),e||this.updateIgnored();;){let o=this.itemList.findIndex(a=>a.includes(i));if(o===-1)break;{let a=this.itemList[o].lastIndexOf("__");this.removeItem(this.itemList[o].substring(0,a))}}this.calcOverallState()},ignoreItem(t,e){this.ignored.push(t),e||this.updateIgnored(),this.removeItem(t),this.calcOverallState()},restoreItem(t){this.ignored.splice(t,1),this.updateIgnored(),this.updateOutOfLimits()},removeItem(t){const e=this.itemList.findIndex(r=>r.includes(t));this.items.splice(e,1),this.itemList.splice(e,1)},clearAll(){this.ignored=[],this.updateIgnored(),this.updateOutOfLimits()},updateIgnored(){this.$emit("update:modelValue",this.ignored)},handleConfigEvents(t){for(let e of t)e.kind==="deleted"&&e.type==="target"&&this.updateOutOfLimits()},handleMessages(t){for(let e of t){let r=JSON.parse(e.event);if(r.type!="LIMITS_CHANGE"||r.suppress_stored)continue;let s=`${r.target_name}__${r.packet_name}__${r.item_name}`;const n=this.itemList.findIndex(o=>o.includes(s));if(n!==-1){this.itemList[n]=`${s}__${r.new_limits_state}`,this.items[n].limitsState=r.new_limits_state,this.calcOverallState();continue}if(this.ignored.find(o=>s.includes(o))||r.new_limits_state&&!(r.new_limits_state.includes("YELLOW")||r.new_limits_state.includes("RED")))continue;let i={key:s,timestamp:this.formatNanoseconds(r.time_nsec,this.timeZone),parameters:[r.target_name,r.packet_name,this.escapeBrackets(r.item_name)],limitsState:r.new_limits_state};r.new_limits_state=="YELLOW"||r.new_limits_state=="RED"?i.limits=!1:i.limits=!0,this.itemList.push(`${s}__${r.new_limits_state}`),this.items.push(i),this.calcOverallState()}},update(){this.availableItems.length!==0&&this.api.get_tlm_values(this.availableItems).then(t=>{this.updateValues(t)})},updateValues:function(t){this.updateCounter+=1;for(let e=0;e<t.length;e++)t[e].push(this.updateCounter),this.screenValues[this.screenItems[e]]=t[e]},addItem:function(t){this.api.get_tlm_available([t]).then(e=>{this.screenItems.push(t),this.availableItems.push(e[0]),this.screenValues[e[0]]=[null,null,0]})},deleteItem:function(t){let e=this.screenItems.indexOf(t);this.availableItems.splice(e,1),this.screenItems.splice(e,1)},showIgnored(){this.ignoredItemsDialog=!0},customFilter(t,e,r){if(!e||e.trim()==="")return!0;if(e=e.toLowerCase(),r.parameters&&r.parameters.length>0){for(const s of r.parameters)if(s.toLowerCase().includes(e))return!0}return!!(r.timestamp&&r.timestamp.toLowerCase().includes(e)||r.key&&r.key.toLowerCase().includes(e))}}},aa=["status"],ca={key:0},la=["status"],ua={class:"font-weight-black"};function da(t,e,r,s,n,i){const o=E("v-text-field"),a=E("v-spacer"),c=E("v-list-item"),d=E("v-select"),u=E("v-row"),h=E("valuelimitsbar-widget"),p=E("value-widget"),y=E("v-btn"),C=E("v-icon"),P=E("v-list-item-title"),v=E("v-list"),S=E("v-menu"),g=E("v-data-table"),b=E("v-card"),f=E("v-toolbar"),I=E("v-divider"),R=E("v-card-text"),H=E("v-card-actions"),ie=E("v-dialog");return T(),G("div",null,[w(b,{class:"pa-5"},{default:_(()=>[w(u,{class:"ma-1"},{default:_(()=>[w(o,{density:"compact",variant:"outlined",readonly:"","hide-details":"",label:"Overall Limits State","model-value":i.overallStateFormatted,class:pt(i.textFieldClass),style:{"margin-right":"10px","max-width":"280px"},"data-test":"overall-state"},Ke({_:2},[i.astroStatus?{name:"prepend-inner",fn:_(()=>[V("rux-status",{status:i.astroStatus},null,8,aa)]),key:"0"}:void 0]),1032,["model-value","class"]),w(o,{density:"compact",variant:"outlined",readonly:"","hide-details":"",label:"Current Limits Set","model-value":n.currentLimitsSet,style:{"max-width":"200px"},"data-test":"limits-set"},null,8,["model-value"]),w(a),w(d,{modelValue:n.stateFilter,"onUpdate:modelValue":e[0]||(e[0]=k=>n.stateFilter=k),items:n.stateFilterOptions,"item-title":"label","item-value":"value",label:"Filter by State",multiple:"",clearable:"",variant:"outlined",density:"compact","hide-details":"",class:"mr-2",style:{"max-width":"300px"},"data-test":"state-filter"},{selection:_(({index:k})=>[k===0?(T(),G("span",ca,ee(n.stateFilter.length)+" selected ",1)):de("",!0)]),item:_(({props:k,item:j})=>[w(c,zt(Wt(k)),{prepend:_(()=>[V("rux-status",{status:j.raw.status,class:"mr-2"},null,8,la)]),_:2},1040)]),_:1},8,["modelValue","items"]),w(o,{modelValue:n.search,"onUpdate:modelValue":e[1]||(e[1]=k=>n.search=k),label:"Search","prepend-inner-icon":"mdi-magnify",clearable:"",variant:"outlined",density:"compact","single-line":"","hide-details":"",style:{"max-width":"300px"},"data-test":"search"},null,8,["modelValue"])]),_:1}),w(g,{"items-per-page":n.itemsPerPage,"onUpdate:itemsPerPage":e[2]||(e[2]=k=>n.itemsPerPage=k),headers:n.headers,items:n.items,search:n.search,"custom-filter":i.customFilter,"row-props":i.rowProps,"item-value":"key","data-test":"limits-table",class:"limits-table",density:"compact"},{"item.timestamp":_(({item:k})=>[B(ee(k.timestamp),1)]),"item.value":_(({item:k})=>[k.limits?(T(),D(h,{key:0,parameters:k.parameters,settings:n.valueLimitsBarWidgetSettings,"screen-values":n.screenValues,"screen-time-zone":r.timeZone,onAddItem:i.addItem,onDeleteItem:i.deleteItem},null,8,["parameters","settings","screen-values","screen-time-zone","onAddItem","onDeleteItem"])):(T(),D(p,{key:1,parameters:k.parameters,settings:n.valueWidgetSettings,"screen-values":n.screenValues,"screen-time-zone":r.timeZone,onAddItem:i.addItem,onDeleteItem:i.deleteItem},null,8,["parameters","settings","screen-values","screen-time-zone","onAddItem","onDeleteItem"]))]),"item.actions":_(({item:k})=>[w(S,null,{activator:_(({props:j})=>[w(y,Pe({icon:"mdi-dots-horizontal",variant:"text",density:"compact","aria-label":"Item Options"},j),null,16)]),default:_(()=>[w(v,null,{default:_(()=>[w(c,{onClick:j=>i.ignorePacket(k.key)},{prepend:_(()=>[w(C,null,{default:_(()=>[...e[5]||(e[5]=[B("mdi-close-circle-multiple",-1)])]),_:1})]),default:_(()=>[w(P,null,{default:_(()=>[...e[6]||(e[6]=[B("Ignore Entire Packet",-1)])]),_:1})]),_:1},8,["onClick"]),w(c,{onClick:j=>i.ignoreItem(k.key)},{prepend:_(()=>[w(C,null,{default:_(()=>[...e[7]||(e[7]=[B("mdi-close-circle",-1)])]),_:1})]),default:_(()=>[w(P,null,{default:_(()=>[...e[8]||(e[8]=[B("Ignore Item",-1)])]),_:1})]),_:1},8,["onClick"]),w(c,{onClick:j=>i.removeItem(k.key)},{prepend:_(()=>[w(C,null,{default:_(()=>[...e[9]||(e[9]=[B("mdi-eye-off",-1)])]),_:1})]),default:_(()=>[w(P,null,{default:_(()=>[...e[10]||(e[10]=[B("Temporarily Hide Item",-1)])]),_:1})]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)]),"item.limits":_(({item:k})=>[w(a)]),_:1},8,["items-per-page","headers","items","search","custom-filter","row-props"]),e[11]||(e[11]=V("div",{class:"footer"},' Note: Timestamp is "now" for items currently out of limits when the page is loaded. ',-1))]),_:1}),w(ie,{modelValue:n.ignoredItemsDialog,"onUpdate:modelValue":e[4]||(e[4]=k=>n.ignoredItemsDialog=k),"max-width":"600"},{default:_(()=>[w(b,null,{default:_(()=>[w(f,{height:"24"},{default:_(()=>[w(a),e[12]||(e[12]=V("span",null,"Ignored Items",-1)),w(a)]),_:1}),w(R,{class:"mt-2"},{default:_(()=>[V("div",null,[(T(!0),G(pe,null,Oe(i.ignoredFormatted,(k,j)=>(T(),G("div",{key:j},[w(u,{class:"ma-1 align-center"},{default:_(()=>[V("span",ua,ee(k),1),w(a),w(y,{icon:"mdi-delete",density:"compact",variant:"text","aria-label":"Remove Ignored Item","data-test":`remove-ignore-${j}`,onClick:q=>i.restoreItem(j)},null,8,["data-test","onClick"])]),_:2},1024),j<i.ignoredFormatted.length-1?(T(),D(I,{key:j})):de("",!0)]))),128))])]),_:1}),w(H,{class:"px-2"},{default:_(()=>[w(y,{variant:"outlined",onClick:i.clearAll},{default:_(()=>[...e[13]||(e[13]=[B(" Clear All ",-1)])]),_:1},8,["onClick"]),w(a),w(y,{variant:"flat",onClick:e[3]||(e[3]=k=>n.ignoredItemsDialog=!1)},{default:_(()=>[...e[14]||(e[14]=[B(" Ok ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])])}const ha=He(oa,[["render",da],["__scopeId","data-v-b6f77818"]]),fa={mixins:[ht],props:{historyCount:{type:Number,default:1e3},timeZone:{type:String,default:"local"}},data(){return{data:[],cable:new os,search:"",headers:[{title:"Time",value:"time_nsec",width:250},{title:"Level",value:"level",sortable:!1},{title:"Message",value:"message"}]}},created(){this.cable.createSubscription("LimitsEventsChannel",window.openc3Scope,{received:t=>{this.cable.recordPing(),this.handleMessages(t)}},{historyCount:1e3}).then(t=>{this.limitsSubscription=t})},unmounted(){this.limitsSubscription&&this.limitsSubscription.unsubscribe(),this.cable.disconnect()},methods:{handleMessages(t){for(let e=0;e<t.length;e++){let r=JSON.parse(t[e].event);this.data.unshift(r)}this.data.length>this.historyCount&&(this.data.length=this.historyCount)},getStatus(t){return t.includes("GREEN")?"normal":t.includes("YELLOW")?"caution":t.includes("RED")?"critical":t.includes("BLUE")?"standby":"off"},getColorClass(t){return t.includes("GREEN")?"openc3-green":t.includes("YELLOW")?"openc3-yellow":t.includes("RED")?"openc3-red":t.includes("BLUE")?"openc3-blue":"openc3-white"},calcTableHeight(){return window.innerHeight-250}}},pa=["status"];function ma(t,e,r,s,n,i){const o=E("v-spacer"),a=E("v-text-field"),c=E("v-card-title"),d=E("v-data-table"),u=E("v-card");return T(),D(u,{class:"card-height"},{default:_(()=>[w(c,{class:"d-flex align-center"},{default:_(()=>[e[1]||(e[1]=B(" Limits Events ",-1)),w(o),w(a,{modelValue:n.search,"onUpdate:modelValue":e[0]||(e[0]=h=>n.search=h),label:"Search","prepend-inner-icon":"mdi-magnify",clearable:"",variant:"outlined",density:"compact","single-line":"","hide-details":"",class:"search"},null,8,["modelValue"])]),_:1}),w(d,{headers:n.headers,items:n.data,search:n.search,"items-per-page":-1,"hide-default-footer":"","multi-sort":"",density:"compact",height:i.calcTableHeight(),hover:"","data-test":"limits-events"},{"item.time_nsec":_(({item:h})=>[V("span",null,ee(t.formatNanoseconds(h.time_nsec,r.timeZone)),1)]),"item.level":_(({item:h})=>[V("rux-status",{status:i.getStatus(h.message)},null,8,pa)]),"item.message":_(({item:h})=>[V("span",{class:pt(i.getColorClass(h.message))},ee(h.message),3)]),_:1},8,["headers","items","search","height"])]),_:1})}const ga={components:{LimitsControl:ha,LimitsEvents:He(fa,[["render",ma],["__scopeId","data-v-192a6dcb"]]),TopBar:Cs,OpenConfigDialog:qt,SaveConfigDialog:$t},mixins:[As],data(){return{title:"Limits Monitor",configKey:"limits_monitor",api:new ms,timeZone:"local",renderKey:0,ignored:[],openConfig:!1,saveConfig:!1,limitsSets:[],currentLimitsSet:null,currentSetRefreshInterval:null,limitsSetDialog:!1,menus:[{label:"File",items:[{label:"Show Ignored",icon:"mdi-magnify-close",command:()=>{this.$refs.control.showIgnored()}},{label:"Change Limits Set",icon:"mdi-swap-horizontal",command:()=>{this.limitsSetDialog=!0}},{divider:!0},{label:"Open Configuration",icon:"mdi-folder-open",command:()=>{this.openConfig=!0}},{label:"Save Configuration",icon:"mdi-content-save",command:()=>{this.saveConfig=!0}},{label:"Reset Configuration",icon:"mdi-monitor-shimmer",command:()=>{this.ignored=[],this.resetConfigBase(),this.renderKey++}}]}]}},created(){this.api.get_limits_sets().then(t=>{this.limitsSets=t}),this.api.get_setting("time_zone").then(t=>{t&&(this.timeZone=t)}).catch(t=>{})},mounted:function(){if(this.$route.query&&this.$route.query.config)this.openConfiguration(this.$route.query.config,!0);else{let t=this.loadDefaultConfig();JSON.stringify(t)!=="{}"&&(this.ignored=t,this.renderKey++)}},unmounted:function(){clearInterval(this.currentSetRefreshInterval)},methods:{setLimitsSet:function(){this.api.set_limits_set(this.currentLimitsSet),this.limitsSetDialog=!1,this.renderKey++},openConfiguration:function(t,e=!1){this.openConfigBase(t,e,r=>{this.ignored=r,this.renderKey++})},saveConfiguration:function(t){this.saveConfigBase(t,this.ignored)}}};function ba(t,e,r,s,n,i){const o=E("top-bar"),a=E("limits-control"),c=E("limits-events"),d=E("open-config-dialog"),u=E("save-config-dialog"),h=E("v-spacer"),p=E("v-toolbar"),y=E("v-select"),C=E("v-card-text"),P=E("v-btn"),v=E("v-card-actions"),S=E("v-card"),g=E("v-dialog");return T(),G("div",null,[w(o,{menus:n.menus,title:n.title},null,8,["menus","title"]),(T(),D(a,{ref:"control",key:n.renderKey,modelValue:n.ignored,"onUpdate:modelValue":e[0]||(e[0]=b=>n.ignored=b),"time-zone":n.timeZone},null,8,["modelValue","time-zone"])),e[12]||(e[12]=V("div",{style:{height:"15px"}},null,-1)),w(c,{"time-zone":n.timeZone},null,8,["time-zone"]),n.openConfig?(T(),D(d,{key:0,modelValue:n.openConfig,"onUpdate:modelValue":e[1]||(e[1]=b=>n.openConfig=b),"config-key":n.configKey,onSuccess:i.openConfiguration},null,8,["modelValue","config-key","onSuccess"])):de("",!0),n.saveConfig?(T(),D(u,{key:1,modelValue:n.saveConfig,"onUpdate:modelValue":e[2]||(e[2]=b=>n.saveConfig=b),"config-key":n.configKey,onSuccess:i.saveConfiguration},null,8,["modelValue","config-key","onSuccess"])):de("",!0),w(g,{modelValue:n.limitsSetDialog,"onUpdate:modelValue":e[5]||(e[5]=b=>n.limitsSetDialog=b),"max-width":"650",persistent:"",onKeydown:e[6]||(e[6]=Jt(b=>n.limitsSetDialog=!1,["esc"]))},{default:_(()=>[w(S,null,{default:_(()=>[w(p,{height:"24"},{default:_(()=>[w(h),e[7]||(e[7]=V("span",null,"Change Limits Set",-1)),w(h)]),_:1}),w(C,{class:"mt-6"},{default:_(()=>[e[8]||(e[8]=V("span",{style:{display:"block"}}," The Limits Set is a global option which changes the Limits Set across all tools. ",-1)),e[9]||(e[9]=V("span",{style:{display:"block"}}," NOTE: Changing this option clears the current list and recalculates based on the new set. ",-1)),w(y,{modelValue:n.currentLimitsSet,"onUpdate:modelValue":e[3]||(e[3]=b=>n.currentLimitsSet=b),label:"Limits Set",items:n.limitsSets,density:"compact",variant:"outlined","data-test":"change-limits-set","hide-details":"",class:"mt-3",style:{"max-width":"200px"}},null,8,["modelValue","items"])]),_:1}),w(v,{class:"px-2"},{default:_(()=>[w(h),w(P,{variant:"outlined",onClick:e[4]||(e[4]=b=>n.limitsSetDialog=!1)},{default:_(()=>[...e[10]||(e[10]=[B(" Cancel ",-1)])]),_:1}),w(P,{variant:"flat",onClick:i.setLimitsSet},{default:_(()=>[...e[11]||(e[11]=[B(" Ok ",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])])}const Ba=Ss("default",He(ga,[["render",ba]]))})}}));