openc3-cosmos-tool-dataextractor 6.10.3 → 6.10.4
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.
- checksums.yaml +4 -4
- data/tools/dataextractor/ArrayWidget-DfiusKpM-a429a5a35aff3aad2072.js +2 -0
- data/tools/dataextractor/{ArrayplotWidget-B9UGCr4--10bc9bda6d6218d666b9.js → ArrayplotWidget-DsvOovu9-cae71a1b94599e900be5.js} +1 -1
- data/tools/dataextractor/{BarColumn-ClLBRGll-fb02389b391b435091f1.js → BarColumn-DHHJBR3V-46bfcdd1b868aec90ca5.js} +1 -1
- data/tools/dataextractor/{BlockWidget-CoQp-LZM-272c36deb40927f0cf99.js → BlockWidget-BdYXWS_0-a1603263f5ba10e5abb4.js} +2 -2
- data/tools/dataextractor/{ButtonWidget-CTTwpFec-a45fcc1ebc4a0838d11d.js → ButtonWidget-zpSJmiQT-3cdbebd0c95fe74c6fed.js} +1 -1
- data/tools/dataextractor/CanvasWidget-DaUB1G9X-e59ca78e6da56a061082.js +1 -0
- data/tools/dataextractor/CanvasdotWidget-C255aTVc-6ae2f67bee6c22492603.js +1 -0
- data/tools/dataextractor/{CanvasimageWidget-DmyCSnuQ-f0bb0c1bc8ece5718733.js → CanvasimageWidget-CFlUUFqr-a895ca9cc3d9cee1e23d.js} +1 -1
- data/tools/dataextractor/{CanvasimagevalueWidget-CmbngMqv-ad858edad0b3552ad29d.js → CanvasimagevalueWidget-s4gR3fo5-8c62e8d6362be567898d.js} +1 -1
- data/tools/dataextractor/{CanvaslabelWidget-D8NzLKqi-a1cc6151409c4f4ef644.js → CanvaslabelWidget-CaOc-lTQ-80bbf76fcf08634a4d3f.js} +1 -1
- data/tools/dataextractor/{CanvaslabelvalueWidget-DOybGI9D-b4661f20261ff535e72b.js → CanvaslabelvalueWidget-hqJoPekq-927f7e4946a290758b8b.js} +1 -1
- data/tools/dataextractor/{CanvaslineWidget-D2NEei7j-e9037dd519b731eab390.js → CanvaslineWidget-DebP2L43-a008528d4dd073aa4f5b.js} +1 -1
- data/tools/dataextractor/{CanvaslinevalueWidget-Ctvv9owf-78ae8d0818475e5dab9e.js → CanvaslinevalueWidget-BkPG5Vtx-512390727604c4d72a50.js} +1 -1
- data/tools/dataextractor/CheckbuttonWidget-eQIcPATf-658fe1be998ed6c15429.js +1 -0
- data/tools/dataextractor/ComboboxWidget-B5kzYxFk-5a1a98b7ee3b81eefaaf.js +1 -0
- data/tools/dataextractor/{DataExtractor-49686590098f6223d96c.js → DataExtractor-9e315e6ca613394b5f93.js} +10 -10
- data/tools/dataextractor/{DateWidget-rYTjwUdb-be2b822f1c0563c1199d.js → DateWidget-1IZOe50K-1dfd8bef8abf3063d827.js} +1 -1
- data/tools/dataextractor/{DetailsDialog-p_vutijL-22b1ca4ac94462632604.js → DetailsDialog-D-rjL4oc-42527ff3f15896b49ffb.js} +1 -1
- data/tools/dataextractor/{DynamicWidget-DEHWYr8i-bb10f0f211e0d6007cd1.js → DynamicWidget-DEHWYr8i-46b6f8c6d4ac6db30649.js} +1 -1
- data/tools/dataextractor/{FilechecksumWidget-gcmXxJHl-51155f38449272edae15.js → FilechecksumWidget-F_FX1Kjx-30c3f25bba0fd0759a34.js} +1 -1
- data/tools/dataextractor/{FiledisplayWidget-CqM549A4-dde94b2c031fa0116e4b.js → FiledisplayWidget-BF3G22jF-2205b350f1620540a8ff.js} +1 -1
- data/tools/dataextractor/{FormatvalueWidget-BEwH0C7S-933bd49fee7450067242.js → FormatvalueWidget-BkF9iiHs-e6ea937daf837a000d48.js} +1 -1
- data/tools/dataextractor/Graph-C-7C2Jq5-11eb0a8d281ee8b042a8.js +1 -0
- data/tools/dataextractor/{GraphWidget-CjxnC0Dc-5286b6102a372059f83e.js → GraphWidget-DRkDn8za-1cadc0976f9566e325d7.js} +1 -1
- data/tools/dataextractor/HorizontalWidget-DB64wzZB-e2665ea2fa7ba485c122.js +1 -0
- data/tools/dataextractor/HorizontalboxWidget-BsHsGlvK-a97546bf1b5df47aed69.js +1 -0
- data/tools/dataextractor/{HorizontallineWidget-CXZJTeU2-670c042553f9e2ec7238.js → HorizontallineWidget-CyiexzIu-ed413bd3a5f83291ff07.js} +1 -1
- data/tools/dataextractor/{IframeWidget-CrcWiAVE-daa6303242c6802e6dc7.js → IframeWidget-D9Vh0w2c-7148a75b6b5e4e5896b7.js} +1 -1
- data/tools/dataextractor/{ImageLoader-DPqax8yu-8be4961c4ee3b55be3a2.js → ImageLoader-B4iBPFyi-63980dd733dd3b1c6768.js} +1 -1
- data/tools/dataextractor/{ImageviewerWidget-CTEl6iPg-2eabaaf03bd19fc18098.js → ImageviewerWidget-DqV4SClv-f306633521ca9d163b89.js} +1 -1
- data/tools/dataextractor/{LabelWidget-CPqKGMx0-fa9f8d26b895e6f7f328.js → LabelWidget-BDukcPet-31760d000a21f043f804.js} +1 -1
- data/tools/dataextractor/LabelledWidget-tVHE426s-21c84a75bf002fb8d01a.js +1 -0
- data/tools/dataextractor/LabelprogressbarWidget-CjMDFUUv-f37c673b8b65bfd7a3b0.js +1 -0
- data/tools/dataextractor/LabelsparklineWidget-dZl3cGu0-882d20869ccd87b0504a.js +1 -0
- data/tools/dataextractor/{LabelvalueWidget-NLsD60n4-f61de31e67979784b8cc.js → LabelvalueWidget-UcAc_2Ry-e635b73a24e0fafcb04d.js} +1 -1
- data/tools/dataextractor/{LabelvaluedescWidget-DXROG4Gs-24e058937e6a113f246c.js → LabelvaluedescWidget-Crb8udVe-9e0215d421c3cd4cb0a0.js} +1 -1
- data/tools/dataextractor/LabelvaluelimitsbarWidget-BZGUQrRt-fadf2a8cad01ed8ced03.js +1 -0
- data/tools/dataextractor/LabelvaluelimitscolumnWidget-NNYW2aMO-7ece42105a62cff943f7.js +1 -0
- data/tools/dataextractor/LabelvaluerangebarWidget-CjkVDlVJ-3e87ab73208f47528e87.js +1 -0
- data/tools/dataextractor/Layout-FpBx3iic-ce86a0846f170bb59bb3.js +1 -0
- data/tools/dataextractor/{LedWidget-CiAVs2tj-5cf1cbd43ddb51760d69.js → LedWidget-Bsp1aja--393030ed5a160d853828.js} +1 -1
- data/tools/dataextractor/{LimitsBar-_UQG-M6e-e79bee025393a20cb921.js → LimitsBar-IVv8t4FE-8c4464aab7f5c57f839c.js} +1 -1
- data/tools/dataextractor/{LimitsbarWidget-CIwcOhC8-49d2573d54ccb8358690.js → LimitsbarWidget-Bo1JAoQp-0d199c342a4173113eeb.js} +1 -1
- data/tools/dataextractor/{LimitscolorWidget-CGPfJwvT-e2a54a8441c7e7e559f3.js → LimitscolorWidget-Doq8h_g1-fab5ce7ba52f4f843b44.js} +1 -1
- data/tools/dataextractor/{LimitscolumnWidget-Bj_UPEC8-7498dda54149ed0b939d.js → LimitscolumnWidget-qasXHN7m-26fe75ce1876c0fff23a.js} +1 -1
- data/tools/dataextractor/LinegraphWidget-BNMqcr_r-cb99dd80c8953ea69ba6.js +1 -0
- data/tools/dataextractor/{MatrixbycolumnsWidget-U_NZ6aW--daf7faacbd6a239d2e64.js → MatrixbycolumnsWidget-BlF1CyIT-8ece83d295ac766f5fdc.js} +1 -1
- data/tools/dataextractor/OpenC3TimePicker-D-_qqySI-3567ab45a515094ba0d0.js +1 -0
- data/tools/dataextractor/{ProgressbarWidget-D4JtVzyk-2d40df70c7d96d536450.js → ProgressbarWidget-DQ80NANH-9fecc0b3bbb5e0110f90.js} +1 -1
- data/tools/dataextractor/{RadiobuttonWidget-BUaW7pRx-9c3e622297fb6fe927c0.js → RadiobuttonWidget-LD18M4IQ-88d530bbe15b4d4b24eb.js} +1 -1
- data/tools/dataextractor/{RadiogroupWidget-NIv4CaUQ-f5e48617b4d692b52115.js → RadiogroupWidget-D_pt2MPz-fdd38282ab3f3f6538ec.js} +1 -1
- data/tools/dataextractor/{RangebarWidget-1-CsFpcl-922edd7787bc653c0894.js → RangebarWidget-DhaWpHjB-7f827ea4b32592166f2e.js} +1 -1
- data/tools/dataextractor/{RollupWidget-ChasTJYP-e459eb112d1cdb953f75.js → RollupWidget-CMU1-HwL-45e2ca651e4c698b68f3.js} +1 -1
- data/tools/dataextractor/{ScrollwindowWidget-Y2J758y6-a1840fe72ef9472e7701.js → ScrollwindowWidget-D7Ln-QMq-e50f5afd615e22e0cb4e.js} +1 -1
- data/tools/dataextractor/{SignalWidget-DFhHDicI-ecaf75f863a425f0029e.js → SignalWidget-PreTg4Mt-fd853433a876369f4dc0.js} +1 -1
- data/tools/dataextractor/SpacerWidget-Chy1NO28-2c01d0a39e58e0f504b4.js +1 -0
- data/tools/dataextractor/SparklineWidget-Bb-gCNNt-c75f2105d22c4077be9c.js +1 -0
- data/tools/dataextractor/TabbookWidget-a-LsBhBE-f061d50e234198262752.js +1 -0
- data/tools/dataextractor/TargetPacketItemChooser-DDqBQTWC-14850752bb987478aae1.js +1 -0
- data/tools/dataextractor/{TextboxWidget-CrMYPQIF-a441611dd9de6e35d12f.js → TextboxWidget-DIHEOldN-d88ae753462abdf03bdb.js} +1 -1
- data/tools/dataextractor/TextfieldWidget-CIBo7Dau-aeef40d0899e9c0e93b3.js +1 -0
- data/tools/dataextractor/TimeWidget-CLuOYfPP-057e06980ffafaf21480.js +1 -0
- data/tools/dataextractor/{TitleWidget-V1FGI8l3-ecf255e12fafcf11eb5d.js → TitleWidget-BTHKLAsb-2d44a428a77f77ff7baa.js} +1 -1
- data/tools/dataextractor/{VWidget-rAFU-0vj-a2aaac1a8c481b8f7c9a.js → VWidget-BcwkHuIT-4b2fbda2cd88559aeb5b.js} +1 -1
- data/tools/dataextractor/ValueWidget-BubIamVx-8b83830f75d379716847.js +1 -0
- data/tools/dataextractor/ValuelimitsbarWidget-DKTrV1RT-62e9e609054c8e60d62e.js +1 -0
- data/tools/dataextractor/ValuelimitscolumnWidget-D8JIK4Zi-a8c29fba1f90d3ef7b74.js +1 -0
- data/tools/dataextractor/ValuerangebarWidget-D8hVKp0l-26ef42e5000b3d741af3.js +1 -0
- data/tools/dataextractor/{VerticalWidget-DZqghqIm-61e7a7bbc01859ca7088.js → VerticalWidget-DMp3DXGa-ec8a8497d466fc81135b.js} +1 -1
- data/tools/dataextractor/VerticalboxWidget-CVf1d_3_-ddc77d1deb5814b78edf.js +1 -0
- data/tools/dataextractor/{Widget-6-Nvewdp-7627de70dadaabe97688.js → Widget-D4rzBHnr-20d97feec6afa1ff041b.js} +1 -1
- data/tools/dataextractor/{main-9cd385edc6f249dcc77f.js → main-5393150a38f7b14176e1.js} +102 -102
- data/tools/dataextractor/main.js +1 -1
- metadata +73 -72
- data/tools/dataextractor/ArrayWidget-Bc-Awsbn-725121c6cf8f316888ed.js +0 -2
- data/tools/dataextractor/CanvasWidget-jFarbJ3t-3e04e3d0affd81c321d2.js +0 -1
- data/tools/dataextractor/CanvasdotWidget-BoyUcwiB-8e204fc12b1ca57b323f.js +0 -1
- data/tools/dataextractor/CheckbuttonWidget-CQeR0BMF-71221f9d684eae42d734.js +0 -1
- data/tools/dataextractor/ComboboxWidget-4N-MagvN-26319eb531aa923f37b0.js +0 -1
- data/tools/dataextractor/Graph-CbjlChwf-3f9aea310eebb71b56e5.js +0 -1
- data/tools/dataextractor/HorizontalWidget-Dt8bkM3k-6ab4d8e94d239065253a.js +0 -1
- data/tools/dataextractor/HorizontalboxWidget-CdAZ5Sa6-8011b01076138200ebce.js +0 -1
- data/tools/dataextractor/LabelledWidget-BHYzRMFd-6a04cbb0f4f91d7d6b99.js +0 -1
- data/tools/dataextractor/LabelprogressbarWidget-D9deeUo7-1d7a9973a162882a55ff.js +0 -1
- data/tools/dataextractor/LabelsparklineWidget-7mYre3CP-5592ea3a9f1fc86cc7cb.js +0 -1
- data/tools/dataextractor/LabelvaluelimitsbarWidget-DqVqHF4W-6ca44e7ccc0c75be52b1.js +0 -1
- data/tools/dataextractor/LabelvaluelimitscolumnWidget-BK6_31pC-978b968d0cfc86d19d48.js +0 -1
- data/tools/dataextractor/LabelvaluerangebarWidget-DR7C8gqw-df75eab4d60fdc1510a4.js +0 -1
- data/tools/dataextractor/Layout-B_Hgw3gd-efe811f3fe21a793ecc7.js +0 -1
- data/tools/dataextractor/LinegraphWidget-DccnHbWa-e3c43191d6d2d331893f.js +0 -1
- data/tools/dataextractor/SpacerWidget-D4KojaGb-b2be42972c8500719d8e.js +0 -1
- data/tools/dataextractor/SparklineWidget-DMHFzw8L-91b0a3c0ce8dd5ec82e3.js +0 -1
- data/tools/dataextractor/TabbookWidget-NVLYMdFG-412a422f8fc3efa49b1b.js +0 -1
- data/tools/dataextractor/TargetPacketItemChooser-D5h9Octy-dbed8f533322159c1cbf.js +0 -1
- data/tools/dataextractor/TextfieldWidget-DMBQwtnb-bd7a31892a735faf3b79.js +0 -1
- data/tools/dataextractor/TimeWidget-CWLJZ2bt-64225f9d27bc3a516f23.js +0 -1
- data/tools/dataextractor/ValueWidget-BI3uXmda-36fc637dd4e48d44fbe5.js +0 -1
- data/tools/dataextractor/ValuelimitsbarWidget-BGSJLpw4-ee2d9a6912e7863e8f9b.js +0 -1
- data/tools/dataextractor/ValuelimitscolumnWidget-CaNjHy4v-e43086a7f4293273a0c6.js +0 -1
- data/tools/dataextractor/ValuerangebarWidget-Do40-aaL-65d077ea4fc05701798c.js +0 -1
- data/tools/dataextractor/VerticalboxWidget-CQ__4FcS-80386c538d1cb5139942.js +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
System.register(["./main-
|
|
2
|
-
/*$vite$:1*/`,document.head.appendChild(x);const Is={__name:"TopBarMenu",props:{menu:{type:Object,required:!0},title:{type:String,required:!0}},emits:["submenu-click"],setup(t,{emit:e}){const s=e,n=St(!1);function r(){n.value=!1}function o(i){return i.replaceAll(" ","-").toLowerCase()}return(i,a)=>{const l=C("v-icon"),c=C("v-btn"),d=C("v-divider"),b=C("v-list-item-title"),_=C("v-list-item"),m=C("v-list"),p=C("v-menu"),h=C("v-radio"),E=C("v-list-item-action"),O=C("v-radio-group"),T=C("v-checkbox");return P(),L(p,{modelValue:n.value,"onUpdate:modelValue":a[0]||(a[0]=y=>n.value=y),"close-on-content-click":!1},{activator:g(({props:y})=>[f(c,Be(y,{variant:"outlined",class:"mx-1 menu-button",text:t.menu.label,"data-test":o(`${t.title} ${t.menu.label}`)}),{append:g(()=>[f(l,{class:"menu-button-icon"},{default:g(()=>[...a[1]||(a[1]=[F(" mdi-menu-down ",-1)])]),_:1})]),_:1},16,["text","data-test"])]),default:g(()=>[f(m,null,{default:g(()=>[(P(!0),ee(ae,null,fe(t.menu.items,(y,k)=>(P(),ee(ae,null,[y.divider?(P(),L(d,{key:k+"-divider"})):y.subMenu&&y.subMenu.length>0?(P(),ee("div",{key:k+"-submenu"},[(P(),L(p,{key:k,"open-on-hover":"",location:"right"},{activator:g(({props:R})=>[(P(),L(_,Be({ref_for:!0},R,{key:k,disabled:y.disabled}),He({append:g(()=>[f(l,null,{default:g(()=>[...a[2]||(a[2]=[F(" mdi-chevron-right ",-1)])]),_:1})]),default:g(()=>[!y.radio&&!y.checkbox?(P(),L(b,{key:0,style:ze("cursor: pointer;"+(y.disabled?"opacity: 0.2":""))},{default:g(()=>[F(Z(y.label),1)]),_:2},1032,["style"])):le("",!0)]),_:2},[y.icon?{name:"prepend",fn:g(()=>[f(l,{disabled:y.disabled},{default:g(()=>[F(Z(y.icon),1)]),_:2},1032,["disabled"])]),key:"0"}:void 0]),1040,["disabled"]))]),default:g(()=>[f(m,null,{default:g(()=>[(P(!0),ee(ae,null,fe(y.subMenu,(R,j)=>(P(),L(_,{key:j,"prepend-icon":R.icon,onClick:U=>s("submenu-click",R)},{default:g(()=>[f(b,null,{default:g(()=>[F(Z(R.label),1)]),_:2},1024)]),_:2},1032,["prepend-icon","onClick"]))),128))]),_:2},1024)]),_:2},1024))])):y.radioGroup?(P(),L(O,{key:k+"-radio-group",class:"ma-0 pa-0",density:"compact","hide-details":"","model-value":y.value,"onUpdate:modelValue":y.command},{default:g(()=>[(P(!0),ee(ae,null,fe(y.choices,(R,j)=>(P(),L(_,{key:j+"-choice"},{default:g(()=>[f(E,{class:"list-action"},{default:g(()=>[f(h,{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"])):(P(),L(_,{key:k+"-list",disabled:y.disabled,"data-test":o(`${t.title} ${t.menu.label} ${y.label}`),onClick:()=>{y.command(y),y.checkbox||r()}},He({default:g(()=>[y.checkbox?(P(),L(E,{key:0,class:"list-action"},{default:g(()=>[f(T,{modelValue:y.checked,"onUpdate:modelValue":R=>y.checked=R,label:y.label,color:"secondary",density:"compact","hide-details":""},null,8,["modelValue","onUpdate:modelValue","label"])]),_:2},1024)):le("",!0),!y.radio&&!y.checkbox?(P(),L(b,{key:1,style:ze("cursor: pointer;"+(y.disabled?"opacity: 0.2":""))},{default:g(()=>[F(Z(y.label),1)]),_:2},1032,["style"])):le("",!0)]),_:2},[y.icon?{name:"prepend",fn:g(()=>[f(l,{icon:y.icon,disabled:y.disabled},null,8,["icon","disabled"])]),key:"0"}:void 0]),1032,["disabled","data-test","onClick"]))],64))),256))]),_:1})]),_:1},8,["modelValue"])}}},Ds={components:{TopBarMenu:Is},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}}},Ns={class:"app-title mr-2"};function js(t,e,s,n,r,o){const i=C("v-col"),a=C("v-row"),l=C("TopBarMenu");return P(),L(vt,{to:"#openc3-menu"},[f(a,{"no-gutters":""},{default:g(()=>[f(i,{"align-self":"end"},{default:g(()=>[Te("span",Ns,Z(s.title),1)]),_:1})]),_:1}),f(a,{dense:"",class:"flex-nowrap"},{default:g(()=>[(P(!0),ee(ae,null,fe(s.menus,(c,d)=>(P(),L(l,{key:d+"-top-menu",ref_for:!0,ref:"topmenu",menu:c,title:s.title,onSubmenuClick:o.subMenuClick},null,8,["menu","title","onSubmenuClick"]))),128))]),_:1})])}const Us=pt(Ds,[["render",js],["__scopeId","data-v-b6581c4c"]]);var Ls=Object.defineProperty,Ms=(t,e,s)=>e in t?Ls(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,Ee=(t,e,s)=>Ms(t,typeof e!="symbol"?e+"":e,s);function Ct(t,e){return function(){return t.apply(e,arguments)}}const{toString:Fs}=Object.prototype,{getPrototypeOf:Je}=Object,{iterator:Ce,toStringTag:xt}=Symbol,xe=(t=>e=>{const s=Fs.call(e);return t[s]||(t[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),W=t=>(t=t.toLowerCase(),e=>xe(e)===t),Oe=t=>e=>typeof e===t,{isArray:ce}=Array,ue=Oe("undefined");function me(t){return t!==null&&!ue(t)&&t.constructor!==null&&!ue(t.constructor)&&V(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Ot=W("ArrayBuffer");function Vs(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ot(t.buffer),e}const qs=Oe("string"),V=Oe("function"),kt=Oe("number"),pe=t=>t!==null&&typeof t=="object",$s=t=>t===!0||t===!1,ke=t=>{if(xe(t)!=="object")return!1;const e=Je(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(xt in t)&&!(Ce in t)},Bs=t=>{if(!pe(t)||me(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Hs=W("Date"),zs=W("File"),Ws=W("Blob"),Js=W("FileList"),Ks=t=>pe(t)&&V(t.pipe),Zs=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||V(t.append)&&((e=xe(t))==="formdata"||e==="object"&&V(t.toString)&&t.toString()==="[object FormData]"))},Gs=W("URLSearchParams"),[Xs,Ys,Qs,en]=["ReadableStream","Request","Response","Headers"].map(W),tn=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ge(t,e,{allOwnKeys:s=!1}={}){if(t===null||typeof t>"u")return;let n,r;if(typeof t!="object"&&(t=[t]),ce(t))for(n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else{if(me(t))return;const o=s?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let a;for(n=0;n<i;n++)a=o[n],e.call(null,t[a],a,t)}}function Rt(t,e){if(me(t))return null;e=e.toLowerCase();const s=Object.keys(t);let n=s.length,r;for(;n-- >0;)if(r=s[n],e===r.toLowerCase())return r;return null}const se=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,At=t=>!ue(t)&&t!==se;function Ke(){const{caseless:t,skipUndefined:e}=At(this)&&this||{},s={},n=(r,o)=>{const i=t&&Rt(s,o)||o;ke(s[i])&&ke(r)?s[i]=Ke(s[i],r):ke(r)?s[i]=Ke({},r):ce(r)?s[i]=r.slice():(!e||!ue(r))&&(s[i]=r)};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&ge(arguments[r],n);return s}const sn=(t,e,s,{allOwnKeys:n}={})=>(ge(e,(r,o)=>{s&&V(r)?t[o]=Ct(r,s):t[o]=r},{allOwnKeys:n}),t),nn=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rn=(t,e,s,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),s&&Object.assign(t.prototype,s)},on=(t,e,s,n)=>{let r,o,i;const a={};if(e=e||{},t==null)return e;do{for(r=Object.getOwnPropertyNames(t),o=r.length;o-- >0;)i=r[o],(!n||n(i,t,e))&&!a[i]&&(e[i]=t[i],a[i]=!0);t=s!==!1&&Je(t)}while(t&&(!s||s(t,e))&&t!==Object.prototype);return e},an=(t,e,s)=>{t=String(t),(s===void 0||s>t.length)&&(s=t.length),s-=e.length;const n=t.indexOf(e,s);return n!==-1&&n===s},ln=t=>{if(!t)return null;if(ce(t))return t;let e=t.length;if(!kt(e))return null;const s=new Array(e);for(;e-- >0;)s[e]=t[e];return s},cn=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Je(Uint8Array)),un=(t,e)=>{const s=(t&&t[Ce]).call(t);let n;for(;(n=s.next())&&!n.done;){const r=n.value;e.call(t,r[0],r[1])}},dn=(t,e)=>{let s;const n=[];for(;(s=t.exec(e))!==null;)n.push(s);return n},hn=W("HTMLFormElement"),fn=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,s,n){return s.toUpperCase()+n}),Pt=(({hasOwnProperty:t})=>(e,s)=>t.call(e,s))(Object.prototype),mn=W("RegExp"),It=(t,e)=>{const s=Object.getOwnPropertyDescriptors(t),n={};ge(s,(r,o)=>{let i;(i=e(r,o,t))!==!1&&(n[o]=i||r)}),Object.defineProperties(t,n)},pn=t=>{It(t,(e,s)=>{if(V(t)&&["arguments","caller","callee"].indexOf(s)!==-1)return!1;const n=t[s];if(V(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},gn=(t,e)=>{const s={},n=r=>{r.forEach(o=>{s[o]=!0})};return ce(t)?n(t):n(String(t).split(e)),s},bn=()=>{},yn=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function _n(t){return!!(t&&V(t.append)&&t[xt]==="FormData"&&t[Ce])}const wn=t=>{const e=new Array(10),s=(n,r)=>{if(pe(n)){if(e.indexOf(n)>=0)return;if(me(n))return n;if(!("toJSON"in n)){e[r]=n;const o=ce(n)?[]:{};return ge(n,(i,a)=>{const l=s(i,r+1);!ue(l)&&(o[a]=l)}),e[r]=void 0,o}}return n};return s(t,0)},vn=W("AsyncFunction"),Sn=t=>t&&(pe(t)||V(t))&&V(t.then)&&V(t.catch),Dt=((t,e)=>t?setImmediate:e?((s,n)=>(se.addEventListener("message",({source:r,data:o})=>{r===se&&o===s&&n.length&&n.shift()()},!1),r=>{n.push(r),se.postMessage(s,"*")}))(`axios@${Math.random()}`,[]):s=>setTimeout(s))(typeof setImmediate=="function",V(se.postMessage)),Tn=typeof queueMicrotask<"u"?queueMicrotask.bind(se):typeof process<"u"&&process.nextTick||Dt,En=t=>t!=null&&V(t[Ce]),u={isArray:ce,isArrayBuffer:Ot,isBuffer:me,isFormData:Zs,isArrayBufferView:Vs,isString:qs,isNumber:kt,isBoolean:$s,isObject:pe,isPlainObject:ke,isEmptyObject:Bs,isReadableStream:Xs,isRequest:Ys,isResponse:Qs,isHeaders:en,isUndefined:ue,isDate:Hs,isFile:zs,isBlob:Ws,isRegExp:mn,isFunction:V,isStream:Ks,isURLSearchParams:Gs,isTypedArray:cn,isFileList:Js,forEach:ge,merge:Ke,extend:sn,trim:tn,stripBOM:nn,inherits:rn,toFlatObject:on,kindOf:xe,kindOfTest:W,endsWith:an,toArray:ln,forEachEntry:un,matchAll:dn,isHTMLForm:hn,hasOwnProperty:Pt,hasOwnProp:Pt,reduceDescriptors:It,freezeMethods:pn,toObjectSet:gn,toCamelCase:fn,noop:bn,toFiniteNumber:yn,findKey:Rt,global:se,isContextDefined:At,isSpecCompliantForm:_n,toJSONObject:wn,isAsyncFn:vn,isThenable:Sn,setImmediate:Dt,asap:Tn,isIterable:En};function S(t,e,s,n,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),s&&(this.config=s),n&&(this.request=n),r&&(this.response=r,this.status=r.status?r.status:null)}u.inherits(S,Error,{toJSON:function(){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:u.toJSONObject(this.config),code:this.code,status:this.status}}});const Nt=S.prototype,jt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{jt[t]={value:t}}),Object.defineProperties(S,jt),Object.defineProperty(Nt,"isAxiosError",{value:!0}),S.from=(t,e,s,n,r,o)=>{const i=Object.create(Nt);u.toFlatObject(t,i,function(c){return c!==Error.prototype},c=>c!=="isAxiosError");const a=t&&t.message?t.message:"Error",l=e==null&&t?t.code:e;return S.call(i,a,l,s,n,r),t&&i.cause==null&&Object.defineProperty(i,"cause",{value:t,configurable:!0}),i.name=t&&t.name||"Error",o&&Object.assign(i,o),i};const Cn=null;function Ze(t){return u.isPlainObject(t)||u.isArray(t)}function Ut(t){return u.endsWith(t,"[]")?t.slice(0,-2):t}function Lt(t,e,s){return t?t.concat(e).map(function(n,r){return n=Ut(n),!s&&r?"["+n+"]":n}).join(s?".":""):e}function xn(t){return u.isArray(t)&&!t.some(Ze)}const On=u.toFlatObject(u,{},null,function(t){return/^is[A-Z]/.test(t)});function Re(t,e,s){if(!u.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,s=u.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,p){return!u.isUndefined(p[m])});const n=s.metaTokens,r=s.visitor||c,o=s.dots,i=s.indexes,a=(s.Blob||typeof Blob<"u"&&Blob)&&u.isSpecCompliantForm(e);if(!u.isFunction(r))throw new TypeError("visitor must be a function");function l(m){if(m===null)return"";if(u.isDate(m))return m.toISOString();if(u.isBoolean(m))return m.toString();if(!a&&u.isBlob(m))throw new S("Blob is not supported. Use a Buffer instead.");return u.isArrayBuffer(m)||u.isTypedArray(m)?a&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function c(m,p,h){let E=m;if(m&&!h&&typeof m=="object"){if(u.endsWith(p,"{}"))p=n?p:p.slice(0,-2),m=JSON.stringify(m);else if(u.isArray(m)&&xn(m)||(u.isFileList(m)||u.endsWith(p,"[]"))&&(E=u.toArray(m)))return p=Ut(p),E.forEach(function(O,T){!(u.isUndefined(O)||O===null)&&e.append(i===!0?Lt([p],T,o):i===null?p:p+"[]",l(O))}),!1}return Ze(m)?!0:(e.append(Lt(h,p,o),l(m)),!1)}const d=[],b=Object.assign(On,{defaultVisitor:c,convertValue:l,isVisitable:Ze});function _(m,p){if(!u.isUndefined(m)){if(d.indexOf(m)!==-1)throw Error("Circular reference detected in "+p.join("."));d.push(m),u.forEach(m,function(h,E){(!(u.isUndefined(h)||h===null)&&r.call(e,h,u.isString(E)?E.trim():E,p,b))===!0&&_(h,p?p.concat(E):[E])}),d.pop()}}if(!u.isObject(t))throw new TypeError("data must be an object");return _(t),e}function Mt(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function Ge(t,e){this._pairs=[],t&&Re(t,this,e)}const Ft=Ge.prototype;Ft.append=function(t,e){this._pairs.push([t,e])},Ft.toString=function(t){const e=t?function(s){return t.call(this,s,Mt)}:Mt;return this._pairs.map(function(s){return e(s[0])+"="+e(s[1])},"").join("&")};function kn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Vt(t,e,s){if(!e)return t;const n=s&&s.encode||kn;u.isFunction(s)&&(s={serialize:s});const r=s&&s.serialize;let o;if(r?o=r(e,s):o=u.isURLSearchParams(e)?e.toString():new Ge(e,s).toString(n),o){const i=t.indexOf("#");i!==-1&&(t=t.slice(0,i)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class qt{constructor(){this.handlers=[]}use(e,s,n){return this.handlers.push({fulfilled:e,rejected:s,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){u.forEach(this.handlers,function(s){s!==null&&e(s)})}}const $t={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Rn=typeof URLSearchParams<"u"?URLSearchParams:Ge,An=typeof FormData<"u"?FormData:null,Pn=typeof Blob<"u"?Blob:null,In={isBrowser:!0,classes:{URLSearchParams:Rn,FormData:An,Blob:Pn},protocols:["http","https","file","blob","url","data"]},Xe=typeof window<"u"&&typeof document<"u",Ye=typeof navigator=="object"&&navigator||void 0,Dn=Xe&&(!Ye||["ReactNative","NativeScript","NS"].indexOf(Ye.product)<0),Nn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",jn=Xe&&window.location.href||"http://localhost",Un=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Xe,hasStandardBrowserEnv:Dn,hasStandardBrowserWebWorkerEnv:Nn,navigator:Ye,origin:jn},Symbol.toStringTag,{value:"Module"})),M={...Un,...In};function Ln(t,e){return Re(t,new M.classes.URLSearchParams,{visitor:function(s,n,r,o){return M.isNode&&u.isBuffer(s)?(this.append(n,s.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Mn(t){return u.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Fn(t){const e={},s=Object.keys(t);let n;const r=s.length;let o;for(n=0;n<r;n++)o=s[n],e[o]=t[o];return e}function Bt(t){function e(s,n,r,o){let i=s[o++];if(i==="__proto__")return!0;const a=Number.isFinite(+i),l=o>=s.length;return i=!i&&u.isArray(r)?r.length:i,l?(u.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a):((!r[i]||!u.isObject(r[i]))&&(r[i]=[]),e(s,n,r[i],o)&&u.isArray(r[i])&&(r[i]=Fn(r[i])),!a)}if(u.isFormData(t)&&u.isFunction(t.entries)){const s={};return u.forEachEntry(t,(n,r)=>{e(Mn(n),r,s,0)}),s}return null}function Vn(t,e,s){if(u.isString(t))try{return(e||JSON.parse)(t),u.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(s||JSON.stringify)(t)}const be={transitional:$t,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const s=e.getContentType()||"",n=s.indexOf("application/json")>-1,r=u.isObject(t);if(r&&u.isHTMLForm(t)&&(t=new FormData(t)),u.isFormData(t))return n?JSON.stringify(Bt(t)):t;if(u.isArrayBuffer(t)||u.isBuffer(t)||u.isStream(t)||u.isFile(t)||u.isBlob(t)||u.isReadableStream(t))return t;if(u.isArrayBufferView(t))return t.buffer;if(u.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(r){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Ln(t,this.formSerializer).toString();if((o=u.isFileList(t))||s.indexOf("multipart/form-data")>-1){const i=this.env&&this.env.FormData;return Re(o?{"files[]":t}:t,i&&new i,this.formSerializer)}}return r||n?(e.setContentType("application/json",!1),Vn(t)):t}],transformResponse:[function(t){const e=this.transitional||be.transitional,s=e&&e.forcedJSONParsing,n=this.responseType==="json";if(u.isResponse(t)||u.isReadableStream(t))return t;if(t&&u.isString(t)&&(s&&!this.responseType||n)){const r=!(e&&e.silentJSONParsing)&&n;try{return JSON.parse(t,this.parseReviver)}catch(o){if(r)throw o.name==="SyntaxError"?S.from(o,S.ERR_BAD_RESPONSE,this,null,this.response):o}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:M.classes.FormData,Blob:M.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};u.forEach(["delete","get","head","post","put","patch"],t=>{be.headers[t]={}});const qn=u.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"]),$n=t=>{const e={};let s,n,r;return t&&t.split(`
|
|
3
|
-
`).forEach(function(o){r=o.indexOf(":"),s=o.substring(0,r).trim().toLowerCase(),n=o.substring(r+1).trim(),!(!s||e[s]
|
|
4
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const s=new this(t);return e.forEach(n=>s.set(n)),s}static accessor(t){const e=(this[Ht]=this[Ht]={accessors:{}}).accessors,s=this.prototype;function n(r){const o=ye(r);e[o]||(Wn(s,r),e[o]=!0)}return u.isArray(t)?t.forEach(n):n(t),this}};q.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),u.reduceDescriptors(q.prototype,({value:t},e)=>{let s=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[s]=n}}}),u.freezeMethods(q);function et(t,e){const s=this||be,n=e||s,r=q.from(n.headers);let o=n.data;return u.forEach(t,function(i){o=i.call(s,o,r.normalize(),e?e.status:void 0)}),r.normalize(),o}function zt(t){return!!(t&&t.__CANCEL__)}function de(t,e,s){S.call(this,t??"canceled",S.ERR_CANCELED,e,s),this.name="CanceledError"}u.inherits(de,S,{__CANCEL__:!0});function Wt(t,e,s){const n=s.config.validateStatus;!s.status||!n||n(s.status)?t(s):e(new S("Request failed with status code "+s.status,[S.ERR_BAD_REQUEST,S.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))}function Jn(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Kn(t,e){t=t||10;const s=new Array(t),n=new Array(t);let r=0,o=0,i;return e=e!==void 0?e:1e3,function(a){const l=Date.now(),c=n[o];i||(i=l),s[r]=a,n[r]=l;let d=o,b=0;for(;d!==r;)b+=s[d++],d=d%t;if(r=(r+1)%t,r===o&&(o=(o+1)%t),l-i<e)return;const _=c&&l-c;return _?Math.round(b*1e3/_):void 0}}function Zn(t,e){let s=0,n=1e3/e,r,o;const i=(a,l=Date.now())=>{s=l,r=null,o&&(clearTimeout(o),o=null),t(...a)};return[(...a)=>{const l=Date.now(),c=l-s;c>=n?i(a,l):(r=a,o||(o=setTimeout(()=>{o=null,i(r)},n-c)))},()=>r&&i(r)]}const Pe=(t,e,s=3)=>{let n=0;const r=Kn(50,250);return Zn(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,l=i-n,c=r(l),d=i<=a;n=i;const b={loaded:i,total:a,progress:a?i/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&d?(a-i)/c:void 0,event:o,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(b)},s)},Jt=(t,e)=>{const s=t!=null;return[n=>e[0]({lengthComputable:s,total:t,loaded:n}),e[1]]},Kt=t=>(...e)=>u.asap(()=>t(...e)),Gn=M.hasStandardBrowserEnv?((t,e)=>s=>(s=new URL(s,M.origin),t.protocol===s.protocol&&t.host===s.host&&(e||t.port===s.port)))(new URL(M.origin),M.navigator&&/(msie|trident)/i.test(M.navigator.userAgent)):()=>!0,Xn=M.hasStandardBrowserEnv?{write(t,e,s,n,r,o,i){if(typeof document>"u")return;const a=[`${t}=${encodeURIComponent(e)}`];u.isNumber(s)&&a.push(`expires=${new Date(s).toUTCString()}`),u.isString(n)&&a.push(`path=${n}`),u.isString(r)&&a.push(`domain=${r}`),o===!0&&a.push("secure"),u.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Yn(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Qn(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Zt(t,e,s){let n=!Yn(e);return t&&(n||s==!1)?Qn(t,e):e}const Gt=t=>t instanceof q?{...t}:t;function ne(t,e){e=e||{};const s={};function n(c,d,b,_){return u.isPlainObject(c)&&u.isPlainObject(d)?u.merge.call({caseless:_},c,d):u.isPlainObject(d)?u.merge({},d):u.isArray(d)?d.slice():d}function r(c,d,b,_){if(u.isUndefined(d)){if(!u.isUndefined(c))return n(void 0,c,b,_)}else return n(c,d,b,_)}function o(c,d){if(!u.isUndefined(d))return n(void 0,d)}function i(c,d){if(u.isUndefined(d)){if(!u.isUndefined(c))return n(void 0,c)}else return n(void 0,d)}function a(c,d,b){if(b in e)return n(c,d);if(b in t)return n(void 0,c)}const l={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(c,d,b)=>r(Gt(c),Gt(d),b,!0)};return u.forEach(Object.keys({...t,...e}),function(c){const d=l[c]||r,b=d(t[c],e[c],c);u.isUndefined(b)&&d!==a||(s[c]=b)}),s}const Xt=t=>{const e=ne({},t);let{data:s,withXSRFToken:n,xsrfHeaderName:r,xsrfCookieName:o,headers:i,auth:a}=e;if(e.headers=i=q.from(i),e.url=Vt(Zt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),u.isFormData(s)){if(M.hasStandardBrowserEnv||M.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(u.isFunction(s.getHeaders)){const l=s.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([d,b])=>{c.includes(d.toLowerCase())&&i.set(d,b)})}}if(M.hasStandardBrowserEnv&&(n&&u.isFunction(n)&&(n=n(e)),n||n!==!1&&Gn(e.url))){const l=r&&o&&Xn.read(o);l&&i.set(r,l)}return e},er=typeof XMLHttpRequest<"u",tr=er&&function(t){return new Promise(function(e,s){const n=Xt(t);let r=n.data;const o=q.from(n.headers).normalize();let{responseType:i,onUploadProgress:a,onDownloadProgress:l}=n,c,d,b,_,m;function p(){_&&_(),m&&m(),n.cancelToken&&n.cancelToken.unsubscribe(c),n.signal&&n.signal.removeEventListener("abort",c)}let h=new XMLHttpRequest;h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout;function E(){if(!h)return;const T=q.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),y={data:!i||i==="text"||i==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:T,config:t,request:h};Wt(function(k){e(k),p()},function(k){s(k),p()},y),h=null}"onloadend"in h?h.onloadend=E:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(E)},h.onabort=function(){h&&(s(new S("Request aborted",S.ECONNABORTED,t,h)),h=null)},h.onerror=function(T){const y=T&&T.message?T.message:"Network Error",k=new S(y,S.ERR_NETWORK,t,h);k.event=T||null,s(k),h=null},h.ontimeout=function(){let T=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const y=n.transitional||$t;n.timeoutErrorMessage&&(T=n.timeoutErrorMessage),s(new S(T,y.clarifyTimeoutError?S.ETIMEDOUT:S.ECONNABORTED,t,h)),h=null},r===void 0&&o.setContentType(null),"setRequestHeader"in h&&u.forEach(o.toJSON(),function(T,y){h.setRequestHeader(y,T)}),u.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),i&&i!=="json"&&(h.responseType=n.responseType),l&&([b,m]=Pe(l,!0),h.addEventListener("progress",b)),a&&h.upload&&([d,_]=Pe(a),h.upload.addEventListener("progress",d),h.upload.addEventListener("loadend",_)),(n.cancelToken||n.signal)&&(c=T=>{h&&(s(!T||T.type?new de(null,t,h):T),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(c),n.signal&&(n.signal.aborted?c():n.signal.addEventListener("abort",c)));const O=Jn(n.url);if(O&&M.protocols.indexOf(O)===-1){s(new S("Unsupported protocol "+O+":",S.ERR_BAD_REQUEST,t));return}h.send(r||null)})},sr=(t,e)=>{const{length:s}=t=t?t.filter(Boolean):[];if(e||s){let n=new AbortController,r;const o=function(c){if(!r){r=!0,a();const d=c instanceof Error?c:this.reason;n.abort(d instanceof S?d:new de(d instanceof Error?d.message:d))}};let i=e&&setTimeout(()=>{i=null,o(new S(`timeout ${e} of ms exceeded`,S.ETIMEDOUT))},e);const a=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(o):c.removeEventListener("abort",o)}),t=null)};t.forEach(c=>c.addEventListener("abort",o));const{signal:l}=n;return l.unsubscribe=()=>u.asap(a),l}},nr=function*(t,e){let s=t.byteLength;if(s<e){yield t;return}let n=0,r;for(;n<s;)r=n+e,yield t.slice(n,r),n=r},rr=async function*(t,e){for await(const s of ir(t))yield*nr(s,e)},ir=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:s,value:n}=await e.read();if(s)break;yield n}}finally{await e.cancel()}},Yt=(t,e,s,n)=>{const r=rr(t,e);let o=0,i,a=l=>{i||(i=!0,n&&n(l))};return new ReadableStream({async pull(l){try{const{done:c,value:d}=await r.next();if(c){a(),l.close();return}let b=d.byteLength;if(s){let _=o+=b;s(_)}l.enqueue(new Uint8Array(d))}catch(c){throw a(c),c}},cancel(l){return a(l),r.return()}},{highWaterMark:2})},Qt=64*1024,{isFunction:Ie}=u,or=(({Request:t,Response:e})=>({Request:t,Response:e}))(u.global),{ReadableStream:es,TextEncoder:ts}=u.global,ss=(t,...e)=>{try{return!!t(...e)}catch{return!1}},ar=t=>{t=u.merge.call({skipUndefined:!0},or,t);const{fetch:e,Request:s,Response:n}=t,r=e?Ie(e):typeof fetch=="function",o=Ie(s),i=Ie(n);if(!r)return!1;const a=r&&Ie(es),l=r&&(typeof ts=="function"?(p=>h=>p.encode(h))(new ts):async p=>new Uint8Array(await new s(p).arrayBuffer())),c=o&&a&&ss(()=>{let p=!1;const h=new s(M.origin,{body:new es,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!h}),d=i&&a&&ss(()=>u.isReadableStream(new n("").body)),b={stream:d&&(p=>p.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!b[p]&&(b[p]=(h,E)=>{let O=h&&h[p];if(O)return O.call(h);throw new S(`Response type '${p}' is not supported`,S.ERR_NOT_SUPPORT,E)})});const _=async p=>{if(p==null)return 0;if(u.isBlob(p))return p.size;if(u.isSpecCompliantForm(p))return(await new s(M.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(u.isArrayBufferView(p)||u.isArrayBuffer(p))return p.byteLength;if(u.isURLSearchParams(p)&&(p=p+""),u.isString(p))return(await l(p)).byteLength},m=async(p,h)=>u.toFiniteNumber(p.getContentLength())??_(h);return async p=>{let{url:h,method:E,data:O,signal:T,cancelToken:y,timeout:k,onDownloadProgress:R,onUploadProgress:j,responseType:U,headers:X,withCredentials:$="same-origin",fetchOptions:te}=Xt(p),w=e||fetch;U=U?(U+"").toLowerCase():"text";let I=sr([T,y&&y.toAbortSignal()],k),K=null;const B=I&&I.unsubscribe&&(()=>{I.unsubscribe()});let qe;try{if(j&&c&&E!=="get"&&E!=="head"&&(qe=await m(X,O))!==0){let H=new s(h,{method:"POST",body:O,duplex:"half"}),Q;if(u.isFormData(O)&&(Q=H.headers.get("content-type"))&&X.setContentType(Q),H.body){const[mt,$e]=Jt(qe,Pe(Kt(j)));O=Yt(H.body,Qt,mt,$e)}}u.isString($)||($=$?"include":"omit");const N=o&&"credentials"in s.prototype,v={...te,signal:I,method:E.toUpperCase(),headers:X.normalize().toJSON(),body:O,duplex:"half",credentials:N?$:void 0};K=o&&new s(h,v);let A=await(o?w(K,te):w(h,v));const z=d&&(U==="stream"||U==="response");if(d&&(R||z&&B)){const H={};["status","statusText","headers"].forEach(Rs=>{H[Rs]=A[Rs]});const Q=u.toFiniteNumber(A.headers.get("content-length")),[mt,$e]=R&&Jt(Q,Pe(Kt(R),!0))||[];A=new n(Yt(A.body,Qt,mt,()=>{$e&&$e(),B&&B()}),H)}U=U||"text";let Y=await b[u.findKey(b,U)||"text"](A,p);return!z&&B&&B(),await new Promise((H,Q)=>{Wt(H,Q,{data:Y,headers:q.from(A.headers),status:A.status,statusText:A.statusText,config:p,request:K})})}catch(N){throw B&&B(),N&&N.name==="TypeError"&&/Load failed|fetch/i.test(N.message)?Object.assign(new S("Network Error",S.ERR_NETWORK,p,K),{cause:N.cause||N}):S.from(N,N&&N.code,p,K)}}},lr=new Map,ns=t=>{let e=t&&t.env||{};const{fetch:s,Request:n,Response:r}=e,o=[n,r,s];let i=o.length,a=i,l,c,d=lr;for(;a--;)l=o[a],c=d.get(l),c===void 0&&d.set(l,c=a?new Map:ar(e)),d=c;return c};ns();const tt={http:Cn,xhr:tr,fetch:{get:ns}};u.forEach(tt,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const rs=t=>`- ${t}`,cr=t=>u.isFunction(t)||t===null||t===!1;function ur(t,e){t=u.isArray(t)?t:[t];const{length:s}=t;let n,r;const o={};for(let i=0;i<s;i++){n=t[i];let a;if(r=n,!cr(n)&&(r=tt[(a=String(n)).toLowerCase()],r===void 0))throw new S(`Unknown adapter '${a}'`);if(r&&(u.isFunction(r)||(r=r.get(e))))break;o[a||"#"+i]=r}if(!r){const i=Object.entries(o).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=s?i.length>1?`since :
|
|
5
|
-
`+i.map(
|
|
6
|
-
`):" "+
|
|
7
|
-
`+r):s.stack=r}catch{}}throw s}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=ne(this.defaults,e);const{transitional:s,paramsSerializer:n,headers:r}=e;s!==void 0&&Ne.assertOptions(s,{silentJSONParsing:G.transitional(G.boolean),forcedJSONParsing:G.transitional(G.boolean),clarifyTimeoutError:G.transitional(G.boolean)},!1),n!=null&&(u.isFunction(n)?e.paramsSerializer={serialize:n}:Ne.assertOptions(n,{encode:G.function,serialize:G.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Ne.assertOptions(e,{baseUrl:G.spelling("baseURL"),withXsrfToken:G.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=r&&u.merge(r.common,r[e.method]);r&&u.forEach(["delete","get","head","post","put","patch","common"],m=>{delete r[m]}),e.headers=q.concat(o,r);const i=[];let a=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(e)===!1||(a=a&&m.synchronous,i.unshift(m.fulfilled,m.rejected))});const l=[];this.interceptors.response.forEach(function(m){l.push(m.fulfilled,m.rejected)});let c,d=0,b;if(!a){const m=[os.bind(this),void 0];for(m.unshift(...i),m.push(...l),b=m.length,c=Promise.resolve(e);d<b;)c=c.then(m[d++],m[d++]);return c}b=i.length;let _=e;for(;d<b;){const m=i[d++],p=i[d++];try{_=m(_)}catch(h){p.call(this,h);break}}try{c=os.call(this,_)}catch(m){return Promise.reject(m)}for(d=0,b=l.length;d<b;)c=c.then(l[d++],l[d++]);return c}getUri(t){t=ne(this.defaults,t);const e=Zt(t.baseURL,t.url,t.allowAbsoluteUrls);return Vt(e,t.params,t.paramsSerializer)}};u.forEach(["delete","get","head","options"],function(t){re.prototype[t]=function(e,s){return this.request(ne(s||{},{method:t,url:e,data:(s||{}).data}))}}),u.forEach(["post","put","patch"],function(t){function e(s){return function(n,r,o){return this.request(ne(o||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}re.prototype[t]=e(),re.prototype[t+"Form"]=e(!0)});let hr=class As{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(r){s=r});const n=this;this.promise.then(r=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](r);n._listeners=null}),this.promise.then=r=>{let o;const i=new Promise(a=>{n.subscribe(a),o=a}).then(r);return i.cancel=function(){n.unsubscribe(o)},i},e(function(r,o,i){n.reason||(n.reason=new de(r,o,i),s(n.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 s=this._listeners.indexOf(e);s!==-1&&this._listeners.splice(s,1)}toAbortSignal(){const e=new AbortController,s=n=>{e.abort(n)};return this.subscribe(s),e.signal.unsubscribe=()=>this.unsubscribe(s),e.signal}static source(){let e;return{token:new As(function(s){e=s}),cancel:e}}};function fr(t){return function(e){return t.apply(null,e)}}function mr(t){return u.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,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity: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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(nt).forEach(([t,e])=>{nt[e]=t});function cs(t){const e=new re(t),s=Ct(re.prototype.request,e);return u.extend(s,re.prototype,e,{allOwnKeys:!0}),u.extend(s,e,null,{allOwnKeys:!0}),s.create=function(n){return cs(ne(t,n))},s}const D=cs(be);D.Axios=re,D.CanceledError=de,D.CancelToken=hr,D.isCancel=zt,D.VERSION=as,D.toFormData=Re,D.AxiosError=S,D.Cancel=D.CanceledError,D.all=function(t){return Promise.all(t)},D.spread=fr,D.isAxiosError=mr,D.mergeConfig=ne,D.AxiosHeaders=q,D.formToJSON=t=>Bt(u.isHTMLForm(t)?new FormData(t):t),D.getAdapter=is.getAdapter,D.HttpStatusCode=nt,D.default=D;const{Axios:Di,AxiosError:Ni,CanceledError:ji,isCancel:Ui,CancelToken:Li,VERSION:Mi,all:Fi,Cancel:Vi,isAxiosError:qi,spread:$i,toFormData:Bi,AxiosHeaders:Hi,HttpStatusCode:zi,formToJSON:Wi,getAdapter:Ji,mergeConfig:Ki}=D,rt=D.create({baseURL:location.origin,timeout:6e4,params:{}});rt.interceptors.response.use(t=>t,t=>{var e,s,n,r,o,i,a,l,c,d,b;if(t.response){if(t.response.status===401&&OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity,!0).then(function(p){p&&OpenC3Auth.setTokens()}),t.response.config.headers["Ignore-Errors"]&&t.response.config.headers["Ignore-Errors"].includes(t.response.status.toString()))return Promise.reject(t);let _=`HTTP ${t.response.status} - `;(e=t.response)!=null&&e.statusText&&(_+=`${t.response.statusText} `),(n=(s=t.response)==null?void 0:s.config)!=null&&n.data&&(_+=`${t.response.config.data} `),(o=(r=t.response)==null?void 0:r.data)!=null&&o.message?_+=`${t.response.data.message}`:(a=(i=t.response)==null?void 0:i.data)!=null&&a.exception?_+=`${t.response.data.exception}`:(d=(c=(l=t.response)==null?void 0:l.data)==null?void 0:c.error)!=null&&d.message?(t.response.data.error.class&&(_+=`${t.response.data.error.class} `),_+=`${t.response.data.error.message}`):_+=`${(b=t.response)==null?void 0:b.data}`;const{$cosmosNotify:m}=window;throw m&&m.serious({title:"Network error",body:_}),t}else throw t});const je=async function(t,e,{data:s,params:n={},headers:r,noAuth:o=!1,noScope:i=!1,onUploadProgress:a=!1}={}){if(!o){try{await OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity)&&OpenC3Auth.setTokens()}catch{OpenC3Auth.login()}r.Authorization=localStorage.openc3Token}return r.manual=!0,!i&&!n.scope&&(n.scope=window.openc3Scope),rt({method:t,url:e,data:s,params:n,headers:r,onUploadProgress:a})},it={Accept:"application/json"},us={...it,"Content-Type":"application/json"},pr={get:function(t,{params:e,headers:s=it,noScope:n,noAuth:r,onUploadProgress:o}={}){return je("get",t,{params:e,headers:s,noScope:n,noAuth:r,onUploadProgress:o})},put:function(t,{data:e,params:s,headers:n=us,noScope:r,noAuth:o,onUploadProgress:i}={}){return je("put",t,{data:e,params:s,headers:n,noScope:r,noAuth:o,onUploadProgress:i})},post:function(t,{data:e,params:s,headers:n=us,noScope:r,noAuth:o,onUploadProgress:i}={}){return je("post",t,{data:e,params:s,headers:n,noScope:r,noAuth:o,onUploadProgress:i})},delete:function(t,{params:e,headers:s=it,noScope:n,noAuth:r,onUploadProgress:o}={}){return je("delete",t,{params:e,headers:s,noScope:n,noAuth:r,onUploadProgress:o})}};let Ue=()=>({emit(t,...e){for(let s=this.events[t]||[],n=0,r=s.length;n<r;n++)s[n](...e)},events:{},on(t,e){var s;return((s=this.events)[t]||(s[t]=[])).push(e),()=>{var n;this.events[t]=(n=this.events[t])==null?void 0:n.filter(r=>e!==r)}}});class _e extends Error{constructor(e,s){e instanceof Error?(super(e.message),this.cause=e):super(e),this.reason=s,this.name="ReasonError"}}class ot extends _e{constructor(e){super("Rejected",e),this.name="SubscriptionRejectedError"}}class gr extends _e{constructor(e){super(e||"Timed out to receive subscription ack"),this.name="SubscriptionTimeoutError"}}class J extends _e{constructor(e,s){s?super(e,s):super("Disconnected",e),this.name="DisconnectedError"}}class br extends J{constructor(e){super(e,"stale_connection"),this.name="StaleConnectionError"}}function ds(t){return t?`{${Object.keys(t).sort().filter(e=>t[e]!==void 0).map(e=>{let s=JSON.stringify(t[e]);return`${JSON.stringify(e)}:${s}`}).join(",")}}`:""}class yr{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,s){if(!this._info)return this._info={id:e,info:s},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((s,{id:n,info:r})=>(s[n]=r,s),{})}}const ie=Symbol("state");class hs{constructor(e={}){this.emitter=Ue(),this.params=Object.freeze(e),this.presence=new yr(this),this.initialConnect=!0,this[ie]="idle"}get identifier(){return this._identifier?this._identifier:(this._identifier=ds({channel:this.channelId,...this.params}),this._identifier)}get channelId(){return this.constructor.identifier}get state(){return this[ie]}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[ie]="connecting"}connected(){if(this.state==="connected"||this.state==="closed")return;this[ie]="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[ie]="connected";let e=!0,s=!0;this.initialConnect=!1,this.emit("connect",{reconnect:s,restored:e})}disconnected(e){this.state==="disconnected"||this.state==="closed"||(this[ie]="disconnected",this.presence.reset(),this.emit("disconnect",e))}closed(e){this.state!=="closed"&&(this[ie]="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,s){if(this.state==="idle"||this.state==="closed")throw Error("Channel is not subscribed");return this.receiver.perform(this.identifier,e,s)}async send(e){return this.perform(void 0,e)}async whisper(e){try{await this.perform("$whisper",e)}catch(s){let n=this.receiver?this.receiver.logger:null;n&&n.warn("whisper failed: ",s)}}receive(e,s){this.emit("message",e,s)}on(e,s){return this.emitter.on(e,s)}once(e,s){let n=this.emitter.on(e,(...r)=>{n(),s(...r)});return n}emit(e,...s){return this.emitter.emit(e,...s)}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,s)=>{let n=[()=>delete this._pendingSubscribe];n.push(this.on("connect",()=>{n.forEach(r=>r()),e()})),n.push(this.on("close",r=>{n.forEach(o=>o()),s(r||new _e("Channel was disconnected before subscribing","canceled"))}))}),this._pendingSubscribe)}}class _r{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 s=this.channels.indexOf(e);s>-1&&this.channels.splice(s,1)}notify(e,...s){this.state=e==="restored"?"connected":e,s.length===1?this.channels.forEach(n=>n[e](s[0])):this.channels.forEach(n=>n[e]())}pending(e){this._checkIntent(e);let s=this._pendings[0];return!s||s.intent!==e?Promise.resolve():s.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 s,n={promise:new Promise(o=>{s=o}),intent:e,release:()=>{this._pendings.splice(this._pendings.indexOf(n),1),s(n)},canceled:!1,acquired:!1},r=this._pendingTop;return this._pendings.push(n),r&&await r.promise,this.gvl&&await this.gvl.acquire(n,e),n.acquired=!0,n}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 s=this._pendingTop;return!s||s.acquired||s.intent!==e?!1:(this._pendings.pop(),s.canceled=!0,!0)}}class wr{constructor(){this.queue=[]}async acquire(e,s){s==="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 vr{constructor(e){e.concurrentSubscribes===!1&&(this.glv=new wr),this._subscriptions={},this._localToRemote={}}all(){return Object.values(this._subscriptions)}get(e){return this._subscriptions[e]}create(e,{subscribe:s,unsubscribe:n}){let r=this._subscriptions[e]=new _r(e);return r.remoteId=this._localToRemote[e],r.subscriber=s,r.unsubscriber=n,r.gvl=this.glv,r}remove(e){delete this._subscriptions[e],delete this._localToRemote[e]}storeRemoteId(e,s){this._localToRemote[e]=s;let n=this.get(e);n&&(n.remoteId=s)}}class Sr{constructor(e={}){this.subscriptions=new vr(e),this._pendingMessages=[],this._remoteToLocal={}}subscribe(e,s){this._remoteToLocal[s]=e,this.subscriptions.storeRemoteId(e,s),this.flush(s)}unsubscribe(e){let s=this.subscriptions.get(e);if(!s)return;let n=s.remoteId;n&&delete this._remoteToLocal[n],this.subscriptions.remove(e)}transmit(e,s,n){let r=this._remoteToLocal[e];if(!r){this._pendingMessages.push([e,s,n]);return}let o=this.subscriptions.get(r);o&&o.channels.forEach(i=>{i.receive(s,n)})}notify(e,s,n){let r=this._remoteToLocal[e];if(!r)return;let o=this.subscriptions.get(r);o&&o.channels.forEach(i=>i.emit(s,n))}close(){this._pendingMessages.length=0}get size(){return this.channels.length}get channels(){return this.subscriptions.all().flatMap(e=>e.channels)}flush(e){let s=[];for(let n of this._pendingMessages)n[0]===e?this.transmit(n[0],n[1],n[2]):s.push(n);this._pendingMessages=s}}const fs={debug:0,info:1,warn:2,error:3};class ms{constructor(e){this.level=e||"warn"}log(e,s,n){fs[e]<fs[this.level]||this.writeLogEntry(e,s,n)}writeLogEntry(){throw Error("Not implemented")}debug(e,s){this.log("debug",e,s)}info(e,s){this.log("info",e,s)}warn(e,s){this.log("warn",e,s)}error(e,s){this.log("error",e,s)}}class we extends ms{writeLogEntry(){}}class Tr{encode(e){return JSON.stringify(e)}decode(e){try{return JSON.parse(e)}catch{}}}let Er=0;class ps{constructor(e={}){let{logger:s}=e;this.logger=s||new we,this.pendingSubscriptions={},this.pendingUnsubscriptions={},this.subscribeCooldownInterval=e.subscribeCooldownInterval||250,this.subscribeRetryInterval=e.subscribeRetryInterval||5e3}attached(e){this.cable=e}subscribe(e,s){let n={channel:e};s&&Object.assign(n,s);let r=ds(n);if(this.pendingUnsubscriptions[r]){let i=this.subscribeCooldownInterval*1.5;return this.logger.debug(`unsubscribed recently, cooldown for ${i}`,r),new Promise(a=>{setTimeout(()=>{a(this.subscribe(e,s))},i)})}if(this.pendingSubscriptions[r])return this.logger.warn("subscription is already pending, skipping",r),Promise.reject(Error("Already subscribing"));let o=this.subscribeRetryInterval;return new Promise((i,a)=>{let l=++Er;this.pendingSubscriptions[r]={resolve:i,reject:a,id:l},this.cable.send(this.buildSubscribeRequest(r)),this.maybeRetrySubscribe(l,r,o)})}buildSubscribeRequest(e){return{command:"subscribe",identifier:e}}maybeRetrySubscribe(e,s,n){setTimeout(()=>{let r=this.pendingSubscriptions[s];r&&r.id===e&&(this.logger.warn(`no subscription ack received in ${n}ms, retrying subscribe`,s),this.cable.send(this.buildSubscribeRequest(s)),this.maybeExpireSubscribe(e,s,n))},n)}maybeExpireSubscribe(e,s,n){setTimeout(()=>{let r=this.pendingSubscriptions[s];r&&r.id===e&&(delete this.pendingSubscriptions[s],r.reject(new gr(`Haven't received subscription ack in ${n*2}ms for ${s}`)))},n)}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,s,n){return s==="$whisper"?this.whisper(e,n):(n||(n={}),n.action=s,this.cable.send({command:"message",identifier:e,data:JSON.stringify(n)}),Promise.resolve())}whisper(e,s){return this.cable.send({command:"whisper",identifier:e,data:s}),Promise.resolve()}receive(e){if(typeof e!="object"){this.logger.error("unsupported message format",{message:e});return}let{type:s,identifier:n,message:r,reason:o,reconnect:i}=e;if(s==="ping")return this.cable.keepalive(e.message);if(this.cable.keepalive(),s==="welcome"){let a=e.sid;return a&&this.cable.setSessionId(a),this.cable.connected()}if(s==="disconnect"){let a=new J(o);this.reset(a),i===!1?this.cable.closed(a):this.cable.disconnected(a);return}if(s==="confirm_subscription"){let a=this.pendingSubscriptions[n];if(!a){this.logger.error("subscription not found, unsubscribing",{type:s,identifier:n}),this.unsubscribe(n);return}return delete this.pendingSubscriptions[n],a.resolve(n)}if(s==="reject_subscription"){let a=this.pendingSubscriptions[n];return a?(delete this.pendingSubscriptions[n],a.reject(new ot)):this.logger.error("subscription not found",{type:s,identifier:n})}if(r)return{identifier:n,message:r};this.logger.warn(`unknown message type: ${s}`,{message:e})}reset(e){for(let s in this.pendingSubscriptions)this.pendingSubscriptions[s].reject(e);this.pendingSubscriptions={}}recoverableClosure(){return!1}}const gs=()=>Date.now()/1e3|0;class Cr extends ps{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=gs()),this.sessionId=void 0,this.sendPongs=e.pongs}reset(e){for(let s in this.pendingPresence)this.pendingPresence[s].reject(e);return this.pendingPresence={},super.reset()}receive(e){if(typeof e!="object"){this.logger.error("unsupported message format",{message:e});return}let{type:s,identifier:n,message:r}=e;if(s==="disconnect")return delete this.sessionId,this.cable.setSessionId(""),super.receive(e);if(s==="reject_subscription")return super.receive(e);if(s==="confirm_subscription")return this.subscriptionStreams[n]||(this.subscriptionStreams[n]=new Set),super.receive(e);if(s==="ping")return this.restoreSince&&(this.restoreSince=gs()),this.sendPongs&&this.sendPong(),this.cable.keepalive(e.message);if(this.cable.keepalive(),s==="confirm_history"){this.logger.debug("history result received",e),this.cable.notify("history_received",n);return}if(s==="reject_history"){this.logger.warn("failed to retrieve history",e),this.cable.notify("history_not_found",n);return}if(s==="welcome"){if(this.disableSessionRecovery||(this.sessionId=e.sid,this.sessionId&&this.cable.setSessionId(this.sessionId)),e.restored){let o=e.restored_ids||Object.keys(this.subscriptionStreams);for(let i of o)this.cable.send({identifier:i,command:"history",history:this.historyRequestFor(i)}),this.presenceInfo[i]&&this.cable.send({identifier:i,command:"join",presence:this.presenceInfo[i]});return this.cable.restored(o)}return this.cable.connected(this.sessionId)}if(s==="presence"){let o=r.type;if(o==="info"){let i=this.pendingPresence[n];i&&(delete this.pendingPresence[n],i.resolve(r))}else if(o==="error"){let i=this.pendingPresence[n];i&&(delete this.pendingPresence[n],i.reject(new Error("failed to retrieve presence")))}return{type:s,identifier:n,message:r}}if(r){let o=this.trackStreamPosition(n,e.stream_id,e.epoch,e.offset);return{identifier:n,message:r,meta:o}}this.logger.warn(`unknown message type: ${s}`,{message:e})}perform(e,s,n){switch(s){case"$presence:join":return this.join(e,n);case"$presence:leave":return this.leave(e,n);case"$presence:info":return this.presence(e,n)}return super.perform(e,s,n)}unsubscribe(e){return delete this.presenceInfo[e],super.unsubscribe(e)}buildSubscribeRequest(e){let s=super.buildSubscribeRequest(e),n=this.historyRequestFor(e);n&&(s.history=n,this.pendingHistory[e]=!0);let r=this.presenceInfo[e];return r&&(s.presence=r),s}recoverableClosure(){return!!this.sessionId}historyRequestFor(e){let s={},n=!1;if(this.subscriptionStreams[e])for(let r of this.subscriptionStreams[e]){let o=this.streamsPositions[r];o&&(n=!0,s[r]=o)}if(!(!n&&!this.restoreSince))return{since:this.restoreSince,streams:s}}trackStreamPosition(e,s,n,r){if(!(!s||!n))return this.subscriptionStreams[e]||(this.subscriptionStreams[e]=new Set),this.subscriptionStreams[e].add(s),this.streamsPositions[s]={epoch:n,offset:r},{stream:s,epoch:n,offset:r}}async sendPong(){await new Promise(e=>setTimeout(e,0)),this.cable.state==="connected"&&this.cable.send({command:"pong"})}async join(e,s){return this.presenceInfo[e]=s,this.cable.send({command:"join",identifier:e,presence:s}),Promise.resolve()}async leave(e,s){return delete this.presenceInfo[e],this.cable.send({command:"leave",identifier:e,presence:s}),Promise.resolve()}presence(e,s){return this.pendingPresence[e]?(this.logger.warn("presence is already pending, skipping",e),Promise.reject(Error("presence request is already pending"))):new Promise((n,r)=>{this.pendingPresence[e]={resolve:n,reject:r},this.cable.send({command:"presence",identifier:e,data:s})})}}class xr extends _e{constructor(){super("No connection","closed"),this.name="NoConnectionError"}}class at extends hs{constructor(e,s){super(s),this.channelId=e}set channelId(e){this._channelId=e}get channelId(){return this._channelId}}Ee(at,"identifier","__ghost__");const Or="$pubsub";class lt extends hs{async perform(e,s){if(e.startsWith("$"))return super.perform(e,s);throw Error("not implemented")}}Ee(lt,"identifier",Or);const oe=Symbol("state");let kr=class{constructor({transport:t,protocol:e,encoder:s,logger:n,lazy:r,hubOptions:o,performFailures:i,transportConfigurator:a}){this.emitter=Ue(),this.transport=t,this.encoder=s,this.logger=n||new we,this.protocol=e,this.performFailures=i||"throw",this.protocol.attached(this),this.hub=new Sr(o||{}),this[oe]="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,r===!1&&this.connect().catch(()=>{})}get state(){return this[oe]}async connect(){if(this.state==="connected")return Promise.resolve();if(this.state==="connecting")return this.pendingConnect();let t=this.state==="idle";this[oe]="connecting";let e=this.pendingConnect();this.logger.debug("connecting");try{this.transportConfigurator&&await this.transportConfigurator(this.transport,{initial:t}),await this.transport.open()}catch(s){this.handleClose(s)}return e}setSessionId(t){this.sessionId=t,this.transport.setParam("sid",t)}connected(){if(this.state==="connected")return;this.logger.info("connected"),this[oe]="connected",this.recovering&&this.hub.subscriptions.all().forEach(e=>e.notify("disconnected",new J("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[oe]="connected",this.hub.subscriptions.all().forEach(n=>{t&&n.remoteId&&t.includes(n.remoteId)?n.notify("restored"):(n.notify("disconnected",new J("recovery_failed")),this._resubscribe(n))});let e=!this.initialConnect,s=!0;this.recovering=!1,this.initialConnect=!1,this.emit("connect",{reconnect:e,restored:s})}notify(t,e,s){e&&typeof e!="string"&&(s=e,e=void 0),e?this.hub.notify(e,"info",{type:t,data:s}):this.emit("info",{type:t,data:s})}handleClose(t){this.logger.debug("transport closed",{error:t}),this.disconnected(new J(t,"transport_closed"))}disconnected(t){(this.state==="connected"||this.state==="connecting")&&(this.logger.info("disconnected",{reason:t}),this[oe]="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 J?t:new J(t,void 0)),this.logger.info("closed",{reason:t||"user"}),this[oe]="closed";let s=e||new J("cable_closed");this.hub.subscriptions.all().forEach(n=>n.notify("disconnected",s)),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 s=this.protocol.receive(e);if(s){this.logger.debug("processed incoming message",s);let{type:n,identifier:r,message:o,meta:i}=s;n?this.hub.notify(r,n,o):this.hub.transmit(r,o,i)}}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 lt({stream_name:t});return this.subscribe(e)}streamFromSigned(t){let e=new lt({signed_stream_name:t});return this.subscribe(e)}subscribeTo(t,e){let s,n;return typeof t=="string"&&(n=t,t=at),s=n?new t(n,e):new t(e),this.subscribe(s)}subscribe(t){if(!t.attached(this))return t;let e=t.identifier;t.connecting();let s=this.hub.subscriptions.get(e)||this.hub.subscriptions.create(e,{subscribe:n=>this._subscribe(n,t.channelId,t.params),unsubscribe:n=>this._unsubscribe(n)});return s.add(t),s.intent==="subscribed"&&s.state==="connected"&&t.connected(),s.ensureSubscribed(),t}async _resubscribe(t){t.intent!=="subscribed"||!t.channels[0]||(t.notify("connecting"),t.ensureResubscribed())}async _subscribe(t,e,s){let n=t.id;if(this.state==="idle"&&this.connect().catch(()=>{}),this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:n});return}this.logger.debug("acquiring subscribe lock",{identifier:n});let r=await t.acquire("subscribed");if(r.canceled){this.logger.debug("subscribe lock has been canceled",{identifier:n}),r.release();return}if(this.logger.debug("subscribe lock has been acquired",{identifier:n}),t.intent!=="subscribed"){this.logger.debug("cancel subscribe request, already unsubscribed"),r.release();return}if(this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:n}),r.release();return}if(t.state==="connected"){this.logger.debug("already connected, skip subscribe command",{identifier:n}),t.notify("connected"),r.release();return}let o={identifier:e,params:s};this.logger.debug("subscribing",o);try{let i=await this.protocol.subscribe(e,s);this.hub.subscribe(n,i),this.logger.debug("subscribed",{...o,remoteId:i}),t.notify("connected")}catch(i){if(i){if(i instanceof ot&&this.logger.warn("rejected",o),i instanceof J){this.logger.debug("disconnected during subscription; will retry on connect",o),r.release();return}this.logger.error("failed to subscribe",{error:i,...o})}t.close(i),this.hub.unsubscribe(n)}r.release()}unsubscribe(t){let e=t.identifier,s=this.hub.subscriptions.get(e);if(!s)throw Error(`Subscription not found: ${e}`);s.remove(t),t.closed(),s.maybeUnsubscribe()}async _unsubscribe(t){let e=t.id;this.logger.debug("acquiring unsubscribe lock",{identifier:e});let s=await t.acquire("unsubscribed");if(s.canceled){this.logger.debug("unsubscribe lock has been canceled",{identifier:e}),s.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}),s.release();return}if(t.state==="disconnected"||t.state==="closed"){this.logger.debug(`already ${t.state} connected, skip unsubscribe command`,{identifier:e}),s.release();return}let n=t.remoteId;if(this.logger.debug("unsubscribing...",{remoteId:n}),this.state!=="connected"){this.logger.debug("unsubscribe skipped (cable is not connected)",{id:e}),t.close(),this.hub.unsubscribe(e),s.release();return}try{await this.protocol.unsubscribe(n),this.logger.debug("unsubscribed remotely",{id:e})}catch(r){r&&(r instanceof J?this.logger.debug("cable disconnected during the unsubscribe command execution",{id:e,error:r}):this.logger.error("unsubscribe failed",{id:e,error:r}))}t.intent==="unsubscribed"?(t.close(),this.hub.unsubscribe(e)):t.state="closed",s.release()}async perform(t,e,s){if(this.performFailures==="throw")return this._perform(t,e,s);try{return await this._perform(t,e,s)}catch(n){this.performFailures==="warn"&&this.logger.warn("perform failed",{error:n});return}}async _perform(t,e,s){if(this.state==="connecting"&&await this.pendingConnect(),this.state==="closed"||this.state==="disconnected")throw new xr;let n=this.hub.subscriptions.get(t);if(!n)throw Error(`Subscription not found: ${t}`);if(await n.pending("subscribed"),n.intent!=="subscribed")throw Error(`Subscription is closed: ${t}`);let r=n.remoteId,o={id:r,action:e,payload:s};this.logger.debug("perform",o);try{let i=await this.protocol.perform(r,e,s);return i&&this.logger.debug("perform result",{message:i,request:o}),i}catch(i){throw this.logger.error("perform failed",{error:i,request:o}),i}}on(t,e){return this.emitter.on(t,e)}once(t,e){let s=this.emitter.on(t,(...n)=>{s(),e(...n)});return s}emit(t,...e){return this.emitter.emit(t,...e)}pendingConnect(){return this._pendingConnect?this._pendingConnect:(this._pendingConnect=new Promise((t,e)=>{let s=[()=>delete this._pendingConnect];s.push(this.on("connect",()=>{s.forEach(n=>n()),t()})),s.push(this.on("close",n=>{s.forEach(r=>r()),e(n)})),s.push(this.on("disconnect",n=>{s.forEach(r=>r()),e(n)}))}),this._pendingConnect)}};const Rr={maxMissingPings:2,maxReconnectAttempts:1/0},he=()=>Date.now(),bs=(t,e)=>{e=e||{};let{backoffRate:s,jitterRatio:n,maxInterval:r}=e;return s=s||2,n===void 0&&(n=.5),o=>{let i=t*s**o,a=i*s,l=i+(a-i)*Math.random(),c=2*(Math.random()-.5)*n;return l=l*(1+c),r&&r<l&&(l=r),l}};let ys=class{constructor({pingInterval:t,...e}){if(this.pingInterval=t,!this.pingInterval)throw Error(`Incorrect pingInterval is provided: ${t}`);if(e=Object.assign({},Rr,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 we,this.state="pending_connect",this.attempts=0,this.disconnectedAt=he()}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=he(),this.state="connected",this.cancelReconnect(),this.startPolling()})),this.unbind.push(this.target.on("disconnect",()=>{this.disconnectedAt=he(),this.state="disconnected",this.stopPolling(),this.scheduleReconnect()})),this.unbind.push(this.target.on("close",()=>{this.disconnectedAt=he(),this.state="closed",this.cancelReconnect(),this.stopPolling()})),this.unbind.push(this.target.on("keepalive",()=>{this.pingedAt=he()})),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=he()-this.pingedAt;t>this.maxMissingPings*this.pingInterval&&(this.logger.warn(`Stale connection: ${t}ms without pings`),this.state="pending_disconnect",this.target.disconnected(new br))}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 Ar{constructor(e,s={}){this.transports=e,this.transport=null,this.emitter=Ue(),this.unbind=[],this.logger=s.logger||new we}displayName(){return"fallbacked transport"}async open(){for(let e=0;e<this.transports.length;e++){let s=this.transports[e];try{this.transport=s,this.resetListeners(),this.logger.debug(`Trying to connect via ${s.displayName()}`),await s.open(),this.logger.debug(`Connected via ${s.displayName()}`);return}catch(n){this.logger.debug(`Failed to connect via ${s.displayName()}: ${n.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,s){this.transports.forEach(n=>{n.setParam(e,s)})}setToken(e,s){this.transports.forEach(n=>{n.setToken(e,s)})}on(e,s){return this.emitter.on(e,s)}once(e,s){let n=this.emitter.on(e,(...r)=>{n(),s(...r)});return n}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 Pr{constructor(e,s={}){this.url=e;let n=s.websocketImplementation;if(n)this.Impl=n;else if(typeof WebSocket<"u")this.Impl=WebSocket;else throw new Error("No WebSocket support");this.connected=!1,this.emitter=Ue();let{format:r,subprotocol:o,authStrategy:i}=s;this.format=r||"text",this.connectionOptions=s.websocketOptions,this.authStrategy=i||"param",this.authProtocol="",this.subprotocol=o}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((s,n)=>{let r=[];r.push(this.once("open",()=>{r.forEach(o=>o()),s()})),r.push(this.once("close",()=>{r.forEach(o=>o()),n(Error("WS connection closed"))}))})}setURL(e){this.url=e}setParam(e,s){let n=new URL(this.url);n.searchParams.set(e,s);let r=`${n.protocol}//${n.host}${n.pathname}?${n.searchParams}`;this.setURL(r)}setToken(e,s="jid"){if(this.authStrategy==="param")this.setParam(s,e);else if(this.authStrategy==="header"){this.connectionOptions=this.connectionOptions||{},this.connectionOptions.headers=this.connectionOptions.headers||{};let n=`x-${s}`.toLowerCase();n=Object.keys(this.connectionOptions.headers).find(r=>r.toLowerCase()===n)||n,this.connectionOptions.headers[n]=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,s){return this.emitter.on(e,s)}once(e,s){let n=this.emitter.on(e,(...r)=>{n(),s(...r)});return n}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 s=e.data;this.format==="binary"&&(s=new Uint8Array(s)),this.emitter.emit("data",s)},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")}}const _s={protocol:"actioncable-v1-json",pingInterval:3e3,maxReconnectAttempts:1/0,maxMissingPings:2,logLevel:"warn",lazy:!0};function Ir(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({},_s,e);let{protocol:s,websocketImplementation:n,websocketFormat:r,websocketOptions:o,websocketAuthStrategy:i,fallbacks:a,logLevel:l,logger:c,transport:d,encoder:b,lazy:_,monitor:m,pingInterval:p,reconnectStrategy:h,maxMissingPings:E,maxReconnectAttempts:O,subprotocol:T,tokenRefresher:y,historyTimestamp:k,protocolOptions:R,concurrentSubscribes:j,performFailures:U,transportConfigurator:X,auth:$}=e;if(c=c||new we(l),typeof s=="string"){T=T||s;let I=s.substring(0,s.lastIndexOf("-")),K=s.substring(s.lastIndexOf("-")+1);if(R=R||{},I==="actioncable-v1")s=new ps({logger:c,...R});else if(I==="actioncable-v1-ext")s=new Cr({logger:c,historyTimestamp:k,...R});else throw Error(`Protocol is not supported yet: ${s}`);if(K==="json")b=b||new Tr,r=r||"text";else if(K==="msgpack"){if(r="binary",!b)throw Error("Msgpack encoder must be specified explicitly. Use `@anycable/msgpack-encoder` package or build your own")}else if(K==="protobuf"){if(r=r||"binary",!b)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: ${s}`)}if(!s)throw Error("Protocol must be specified");d=d||new Pr(t,{websocketImplementation:n,websocketOptions:o,subprotocol:T,authStrategy:i,format:r}),a&&(d=new Ar([d,...a],{logger:c})),$&&$.token&&d.setToken($.token,$.param||"jid"),h=h||bs(p),m!==!1&&(m=m||new ys({pingInterval:p,reconnectStrategy:h,maxMissingPings:E,maxReconnectAttempts:O,logger:c}));let te={concurrentSubscribes:j},w=new kr({protocol:s,transport:d,encoder:b,logger:c,lazy:_,hubOptions:te,performFailures:U,transportConfigurator:X});return m&&(m.watch(w),w.monitor=m),y&&Dr(w,async()=>{try{await y(d)}catch(I){return c.error("Failed to refresh authentication token: "+I),!1}return w.connect().catch(()=>{}),!0}),w}function Dr(t,e){let s=!1;t.on("connect",()=>s=!1),t.on("close",async n=>{if(n){if(s){t.logger.warn("Token auto-refresh is disabled",n);return}n.reason==="token_expired"&&(s=!0,await e())}})}class Nr{constructor(e){this.channel=e}notify(e,...s){typeof this[e]=="function"&&this[e](...s)}perform(e,s={}){this.channel.perform(e,s)}send(e){this.channel.send(e)}get identifier(){return this.channel.identifier}unsubscribe(){return this.channel.disconnect()}}class jr extends at{constructor(e,s,n){super(e,s),this.subscription=new Nr(this),Object.assign(this.subscription,n),this.on("connect",({reconnect:r})=>this.subscription.notify("connected",{reconnected:r})),this.on("disconnect",()=>this.subscription.notify("disconnected",{allowReconnect:!0})),this.on("message",r=>this.subscription.notify("received",r)),this.on("close",r=>{r&&r instanceof ot?this.subscription.notify("rejected"):this.subscription.notify("disconnected",{allowReconnect:!1})})}}class Ur{constructor(e){this.cable=e}create(e,s){let n,r;typeof e=="object"?(n=e.channel,delete e.channel,r=e):(n=e,r={});let o=new jr(n,r,s);return o.subscription.notify("initialized"),this.cable.subscribe(o),o.subscription}findAll(e){return this.cable.hub.channels.filter(s=>s.identifier===e).map(s=>s.subscription)}}class Lr{constructor(e){this.cable=e,this.subscriptions=new Ur(e)}}class Mr extends ms{writeLogEntry(e,s,n){n?console[e](s,n):console[e](s)}}class Fr extends ys{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")},s=r=>{this.reconnectNow()&&this.logger.debug("Trigger reconnect",{event:r})},n=()=>this.disconnect(new J("page_frozen"));document.addEventListener("visibilitychange",e,!1),window.addEventListener("focus",s,!1),window.addEventListener("online",s,!1),window.addEventListener("resume",s,!1),window.addEventListener("freeze",n,!1),this.unbind.push(()=>{document.removeEventListener("visibilitychange",e,!1),window.removeEventListener("focus",s,!1),window.removeEventListener("online",s,!1),window.removeEventListener("resume",s,!1),window.removeEventListener("freeze",n,!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 Vr=["cable","action-cable"],qr="/cable",Le=(t,e)=>{for(let s of Vr){let n=t.head.querySelector(`meta[name='${s}-${e}']`);if(n)return n.getAttribute("content")}},ws=t=>t.match(/wss?:\/\//)?t:typeof window<"u"?`${window.location.protocol.replace("http","ws")}//${window.location.host}${t}`:t,$r=()=>{if(typeof document<"u"&&document.head){let t=Le(document,"url");if(t)return ws(t)}return ws(qr)},Br=()=>{if(typeof document<"u"&&document.head){let t=Le(document,"history-timestamp");if(t)return t|0}},Hr=()=>{if(typeof document<"u"&&document.head)return Le(document,"token")},zr=()=>{if(typeof document<"u"&&document.head)return Le(document,"token-param")};function Wr(t,e){typeof t=="object"&&typeof e>"u"&&(e=t,t=void 0),t=t||$r(),e=e||{},e.historyTimestamp||(e.historyTimestamp=Br());let s=Hr();if(s){let c=zr();e.auth=Object.assign({token:s,param:c},e.auth||{})}e=Object.assign({},_s,e);let{logLevel:n,logger:r,pingInterval:o,reconnectStrategy:i,maxMissingPings:a,maxReconnectAttempts:l}=e;return r=e.logger=e.logger||new Mr(n),i=e.reconnectStrategy=e.reconnectStrategy||bs(o),e.monitor!==!1&&(e.monitor=e.monitor||new Fr({pingInterval:o,reconnectStrategy:i,maxMissingPings:a,maxReconnectAttempts:l,logger:r})),Ir(t,e)}function Jr(t,e){let s=Wr(t,e);return new Lr(s)}class Kr{constructor(e="/openc3-api/cable"){this._cable=null,this._url=e}disconnect(){this._cable&&(this._cable.cable.disconnect(),this._cable=null)}createSubscription(e,s,n={},r={}){return OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity).then(o=>{if(o&&OpenC3Auth.setTokens(),this._cable==null){let i=this._url+"?scope="+encodeURIComponent(s)+"&authorization="+encodeURIComponent(localStorage.openc3Token);i=new URL(i,document.baseURI).href,this._cable=Jr(i)}return this._cable.subscriptions.create({channel:e,...r},n)})}recordPing(){}}function ve(t){return Zr.test(t)}const Zr=/^-?[0-9]+$/;function vs(t){return Gr.test(t)}const Gr=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function Ss(t,e){if(ve(t))return Number.isSafeInteger(Number.parseInt(t,10));const s=Number.parseFloat(t),n=String(s);if(t===n)return!0;const r=Ts(t),o=Ts(n);return!!(r===o||(e==null?void 0:e.approx)===!0&&!ve(t)&&o.length>=14&&r.startsWith(o.substring(0,14)))}let Se=function(t){return t.underflow="underflow",t.overflow="overflow",t.truncate_integer="truncate_integer",t.truncate_float="truncate_float",t}({});function Xr(t){if(Ss(t,{approx:!1}))return;if(ve(t))return Se.truncate_integer;const e=Number.parseFloat(t);return Number.isFinite(e)?e===0?Se.underflow:Se.truncate_float:Se.overflow}function Ts(t){const{start:e,end:s}=Yr(t),n=t.substring(e,s),r=n.indexOf(".");return r===-1?n:n.substring(0,r)+n.substring(r+1)}function Yr(t){let e=0;for(t[0]==="-"&&e++;t[e]==="0"||t[e]===".";)e++;let s=t.lastIndexOf("e");for(s===-1&&(s=t.lastIndexOf("E")),s===-1&&(s=t.length);(t[s-1]==="0"||t[s-1]===".")&&s>e;)s--;return{start:e,end:s}}class Qr{constructor(e){if(Ee(this,"isLosslessNumber",!0),!vs(e))throw new Error(`Invalid number (value: "${e}")`);this.value=e}valueOf(){const e=Xr(this.value);if(e===void 0||e===Se.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 ei(t){return t&&typeof t=="object"&&t.isLosslessNumber||!1}function ti(t){return new Qr(t)}function si(t,e){return ct({"":t},"",t,e)}function ct(t,e,s,n){return Array.isArray(s)?n.call(t,e,ri(s,n)):s&&typeof s=="object"&&!ei(s)?n.call(t,e,ni(s,n)):n.call(t,e,s)}function ni(t,e){for(const s of Object.keys(t)){const n=ct(t,s,t[s],e);n!==void 0?t[s]=n:delete t[s]}return t}function ri(t,e){for(let s=0;s<t.length;s++)t[s]=ct(t,String(s),t[s],e);return t}function ii(t,e,s){const n=typeof s=="function"?{parseNumber:s}:s,r=(n==null?void 0:n.parseNumber)??ti,o=(n==null?void 0:n.onDuplicateKey)??U;let i=0;const a=d();return O(a),y(),e?si(a,e):a;function l(){if(t.charCodeAt(i)===di){i++,_();const v={};let A=!0;for(;i<t.length&&t.charCodeAt(i)!==Cs;){A?A=!1:(h(),_());const z=i,Y=m();if(Y===void 0){j();return}_(),E();const H=d();if(H===void 0){I();return}if(Object.prototype.hasOwnProperty.call(v,Y)&&!ut(H,v[Y])){const Q=o({key:Y,position:z+1,oldValue:v[Y],newValue:H});Q!==void 0&&(v[Y]=Q)}else v[Y]=H}return t.charCodeAt(i)!==Cs&&X(),i++,v}}function c(){if(t.charCodeAt(i)===hi){i++,_();const v=[];let A=!0;for(;i<t.length&&t.charCodeAt(i)!==xs;){A?A=!1:h();const z=d();T(z),v.push(z)}return t.charCodeAt(i)!==xs&&$(),i++,v}}function d(){_();const v=m()??p()??l()??c()??b("true",!0)??b("false",!1)??b("null",null);return _(),v}function b(v,A){if(t.slice(i,i+v.length)===v)return i+=v.length,A}function _(){for(;oi(t.charCodeAt(i));)i++}function m(){if(t.charCodeAt(i)===dt){i++;let v="";for(;i<t.length&&t.charCodeAt(i)!==dt;){if(t.charCodeAt(i)===ui){const A=t[i+1],z=ci[A];z!==void 0?(v+=z,i++):A==="u"?Me(t.charCodeAt(i+2))&&Me(t.charCodeAt(i+3))&&Me(t.charCodeAt(i+4))&&Me(t.charCodeAt(i+5))?(v+=String.fromCharCode(Number.parseInt(t.slice(i+2,i+6),16)),i+=5):K(i):w(i)}else li(t.charCodeAt(i))?v+=t[i]:te(t[i]);i++}return R(),i++,v}}function p(){const v=i;if(t.charCodeAt(i)===Os&&(i++,k(v)),t.charCodeAt(i)===ht)i++;else if(ai(t.charCodeAt(i)))for(i++;Fe(t.charCodeAt(i));)i++;if(t.charCodeAt(i)===wi)for(i++,k(v);Fe(t.charCodeAt(i));)i++;if(t.charCodeAt(i)===Ci||t.charCodeAt(i)===Ei)for(i++,(t.charCodeAt(i)===Os||t.charCodeAt(i)===bi)&&i++,k(v);Fe(t.charCodeAt(i));)i++;if(i>v)return r(t.slice(v,i))}function h(){if(t.charCodeAt(i)!==_i)throw new SyntaxError(`Comma ',' expected after value ${N()}`);i++}function E(){if(t.charCodeAt(i)!==vi)throw new SyntaxError(`Colon ':' expected after property name ${N()}`);i++}function O(v){if(v===void 0)throw new SyntaxError(`JSON value expected ${N()}`)}function T(v){if(v===void 0)throw new SyntaxError(`Array item expected ${N()}`)}function y(){if(i<t.length)throw new SyntaxError(`Expected end of input ${N()}`)}function k(v){if(!Fe(t.charCodeAt(i))){const A=t.slice(v,i);throw new SyntaxError(`Invalid number '${A}', expecting a digit ${N()}`)}}function R(){if(t.charCodeAt(i)!==dt)throw new SyntaxError(`End of string '"' expected ${N()}`)}function j(){throw new SyntaxError(`Quoted object key expected ${N()}`)}function U(v){let{key:A,position:z}=v;throw new SyntaxError(`Duplicate key '${A}' encountered at position ${z}`)}function X(){throw new SyntaxError(`Quoted object key or end of object '}' expected ${N()}`)}function $(){throw new SyntaxError(`Array item or end of array ']' expected ${N()}`)}function te(v){throw new SyntaxError(`Invalid character '${v}' ${B()}`)}function w(v){const A=t.slice(v,v+2);throw new SyntaxError(`Invalid escape character '${A}' ${B()}`)}function I(){throw new SyntaxError(`Object value expected after ':' ${B()}`)}function K(v){const A=t.slice(v,v+6);throw new SyntaxError(`Invalid unicode character '${A}' ${B()}`)}function B(){return`at position ${i}`}function qe(){return i<t.length?`but got '${t[i]}'`:"but reached end of input"}function N(){return`${qe()} ${B()}`}}function oi(t){return t===fi||t===mi||t===pi||t===gi}function Me(t){return t>=ht&&t<=ft||t>=Si&&t<=xi||t>=Ti&&t<=Oi}function Fe(t){return t>=ht&&t<=ft}function ai(t){return t>=yi&&t<=ft}function li(t){return t>=32&&t<=1114111}function ut(t,e){return t===e?!0:Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((s,n)=>ut(s,e[n])):Es(t)&&Es(e)?[...new Set([...Object.keys(t),...Object.keys(e)])].every(s=>ut(t[s],e[s])):!1}function Es(t){return typeof t=="object"&&t!==null}const ci={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
8
|
-
`,r:"\r",t:" "},ui=92,di=123,Cs=125,hi=91,xs=93,fi=32,mi=10,pi=9,gi=13,dt=34,bi=43,Os=45,ht=48,yi=49,ft=57,_i=44,wi=46,vi=58,Si=65,Ti=97,Ei=69,Ci=101,xi=70,Oi=102;function ks(t,e,s,n){return r(t);function r(l,c){if(Array.isArray(n)){const d=n.find(b=>b.test(l));if(d){const b=d.stringify(l);if(typeof b!="string"||!vs(b))throw new Error(`Invalid JSON number: output of a number stringifier must be a string containing a JSON number (output: ${b})`);return b}}if(typeof l=="boolean"||typeof l=="number"||typeof l=="string"||l===null||l instanceof Date||l instanceof Boolean||l instanceof Number||l instanceof String)return JSON.stringify(l);if(l!=null&&l.isLosslessNumber||typeof l=="bigint")return l.toString();if(Array.isArray(l))return o(l);if(l&&typeof l=="object")return i(l)}function o(l,c){if(l.length===0)return"[]";let d="[";for(let b=0;b<l.length;b++){const _=l[b];typeof _<"u"&&typeof _!="function"?d+=r(_):d+="null",b<l.length-1&&(d+=",")}return d+="]",d}function i(l,c){if(typeof l.toJSON=="function")return ks(l.toJSON(),e,s,void 0);const d=Array.isArray(e)?e.map(String):Object.keys(l);if(d.length===0)return"{}";let b=!0,_="{";for(const m of d){const p=l[m];if(a(m,p)){b?b=!1:_+=",";const h=JSON.stringify(m);_+=`${h}:`,_+=r(p)}}return _+="}",_}function a(l,c){return typeof c<"u"&&typeof c!="function"&&typeof c!="symbol"}}function ki(t){return ve(t)&&!Ss(t)?BigInt(t):parseFloat(t)}class Ri{constructor(){Ee(this,"id",1)}async exec(e,s,n={},r={},o=6e4){try{await OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity)&&OpenC3Auth.setTokens()}catch{OpenC3Auth.login()}this.id=this.id+1;try{return n.scope=window.openc3Scope,r.manual=!0,(await rt.post("/openc3-api/api",{jsonrpc:"2.0",method:e,params:s,id:this.id,keyword_params:n},{headers:{Authorization:localStorage.openc3Token,"Content-Type":"application/json-rpc",...r},timeout:o,transformRequest:[(i,a)=>ks(i)],transformResponse:[i=>ii(i,void 0,ki)]})).data.result}catch(i){let a=new Error;throw i.response?(a.name=i.response.data.error.data.class,a.message=i.response.data.error.data.message,a.object=i.response.data.error):i.request?(a.name="Request error",a.message="Request error, no response received"):a=i,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,s,n,r,o){return this.exec("map_target_to_interface",[e,s],{cmd_only:n,tlm_only:r,unmap_old:o})}unmap_target_from_interface(e,s,n,r){return this.exec("unmap_target_from_interface",[e,s],{cmd_only:n,tlm_only:r})}connect_interface(e,...s){return s.length>0?this.exec("connect_interface",[e,...s]):this.exec("connect_interface",[e])}disconnect_interface(e){return this.exec("disconnect_interface",[e])}interface_cmd(e,s,...n){return this.exec("interface_cmd",[e,s,...n])}interface_target_enable(e,s,n=!1,r=!1){return this.exec("interface_target_enable",[e,s],{cmd_only:n,tlm_only:r})}interface_target_disable(e,s,n=!1,r=!1){return this.exec("interface_target_disable",[e,s],{cmd_only:n,tlm_only:r})}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,s,n,r,o){return this.exec("map_target_to_router",[e,s],{cmd_only:n,tlm_only:r,unmap_old:o})}unmap_target_from_router(e,s,n,r){return this.exec("unmap_target_from_router",[e,s],{cmd_only:n,tlm_only:r})}connect_router(e){return this.exec("connect_router",[e])}disconnect_router(e){return this.exec("disconnect_router",[e])}router_target_enable(e,s,n=!1,r=!1){return this.exec("router_target_enable",[e,s],{cmd_only:n,tlm_only:r})}router_target_disable(e,s,n=!1,r=!1){return this.exec("router_target_disable",[e,s],{cmd_only:n,tlm_only:r})}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,s,n){return this.exec("get_item",[e,s,n])}get_param(e,s,n){return this.exec("get_param",[e,s,n])}get_parameter(e,s,n){return this.exec("get_param",[e,s,n])}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])}get_target(e){return this.exec("get_target",[e])}get_target_names(){return this.exec("get_target_names",[])}get_target_list(){return this.exec("get_target_names",[])}get_tlm(e,s){return this.exec("get_tlm",[e,s])}get_telemetry(e,s){return this.exec("get_tlm",[e,s])}get_all_tlm(e){return this.exec("get_all_tlm",[e])}get_all_telemetry(e){return this.exec("get_all_tlm",[e])}get_all_tlm_names(e,s=!1){return this.exec("get_all_tlm_names",[e],{hidden:s})}get_all_telemetry_names(e){return this.exec("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,s,n,r=30){const o=await this.exec("get_tlm_packet",[e,s],{type:n,stale_time:r});if(o!=null){let i=o.length,a=null;for(let l=0;l<i;l++)a=this.decode_openc3_type(o[l][1]),a!==null&&(o[l][1]=a)}return o}get_packet_derived_items(e,s){return this.exec("get_packet_derived_items",[e,s])}get_tlm_buffer(e,s){return this.exec("get_tlm_buffer",[e,s])}get_tlm_available(e){return this.exec("get_tlm_available",[e])}async get_tlm_values(e,s=30,n=null,r=null,o=null){let i={stale_time:s};n!==null&&(i.cache_timeout=n),r!==null&&(i.start_time=r.toISOString()),o!==null&&(i.end_time=o.toISOString());const a=await this.exec("get_tlm_values",[e],i,{},1e4);if(a&&a.length>0){let l=a.length,c=null;for(let d=0;d<l;d++)c=this.decode_openc3_type(a[d][0]),c!==null&&(a[d][0]=c)}return a}get_limits(e,s,n){return this.exec("get_limits",[e,s,n])}async tlm(e,s,n,r="CONVERTED"){let o=null;if(s===void 0)o=await this.exec("tlm",[e]);else if(n===void 0)if(["RAW","CONVERTED","FORMATTED","WITH_UNITS"].includes(s))o=await this.exec("tlm",[e],{type:s});else{let a=new Error;throw a.name="TypeError",a.message=`Invalid data type ${s}. Valid options are RAW, CONVERTED, FORMATTED, and WITH_UNITS.`,a}else o=await this.exec("tlm",[e,s,n],{type:r});let i=this.decode_openc3_type(o);return i!==null&&(o=i),o}async inject_tlm(e,s,n=null,r="CONVERTED"){await this.exec("inject_tlm",[e,s,n],{type:r})}set_tlm(e,s,n,r){return this.exec("set_tlm",[e,s,n],{type:r})}override_tlm(e,s,n,r){return this.exec("override_tlm",[e,s,n],{type:r})}get_overrides(){return this.exec("get_overrides")}normalize_tlm(e,s,n,r){return this.exec("normalize_tlm",[e,s,n],{type:r})}get_all_cmds(e){return this.exec("get_all_cmds",[e])}get_all_commands(e){return this.exec("get_all_cmds",[e])}get_all_cmd_names(e,s=!1){return this.exec("get_all_cmd_names",[e],{hidden:s})}get_all_command_names(e){return this.exec("get_all_cmd_names",[e])}get_cmd(e,s){return this.exec("get_cmd",[e,s])}get_command(e,s){return this.exec("get_cmd",[e,s])}get_cmd_cnts(e){return this.exec("get_cmd_cnts",[e])}get_cmd_value(e,s,n,r="CONVERTED"){return this.exec("get_cmd_value",[e,s,n,r])}get_cmd_buffer(e,s){return this.exec("get_cmd_buffer",[e,s])}_cmd(e,s,n,r,o,i={}){let a=null;for(let l in r)Object.prototype.hasOwnProperty.call(r,l)&&(a=this.encode_openc3_type(r[l]),a!==null&&(r[l]=a));return this.exec(e,[s,n,r],i,o)}get_cmd_hazardous(e,s,n,r={}){return s===void 0?this.exec("get_cmd_hazardous",e,{},r):this._cmd("get_cmd_hazardous",e,s,n,r)}cmd(e,s,n,r={},o={}){return s===void 0?this.exec("cmd",e,o,r):this._cmd("cmd",e,s,n,r,o)}cmd_no_range_check(e,s,n,r={},o={}){return s===void 0?this.exec("cmd_no_range_check",e,o,r):this._cmd("cmd_no_range_check",e,s,n,r,o)}cmd_raw(e,s,n,r={},o={}){return s===void 0?this.exec("cmd_raw",e,o,r):this._cmd("cmd_raw",e,s,n,r,o)}cmd_raw_no_range_check(e,s,n,r={},o={}){return s===void 0?this.exec("cmd_raw_no_range_check",e,o,r):this._cmd("cmd_raw_no_range_check",e,s,n,r,o)}cmd_no_hazardous_check(e,s,n,r={},o={}){return s===void 0?this.exec("cmd_no_hazardous_check",e,o,r):this._cmd("cmd_no_hazardous_check",e,s,n,r,o)}cmd_no_checks(e,s,n,r={},o={}){return s===void 0?this.exec("cmd_no_checks",e,o,r):this._cmd("cmd_no_checks",e,s,n,r,o)}cmd_raw_no_hazardous_check(e,s,n,r={},o={}){return s===void 0?this.exec("cmd_raw_no_hazardous_check",e,o,r):this._cmd("cmd_raw_no_hazardous_check",e,s,n,r,o)}cmd_raw_no_checks(e,s,n,r={},o={}){return s===void 0?this.exec("cmd_raw_no_checks",e,o,r):this._cmd("cmd_raw_no_checks",e,s,n,r,o)}build_cmd(e,s,n,r={},o={}){return s===void 0?this.exec("build_cmd",e,o,r):this._cmd("build_cmd",e,s,n,r,o)}build_command(e,s,n,r={},o={}){return s===void 0?this.exec("build_cmd",e,o,r):this._cmd("build_cmd",e,s,n,r,o)}get_interface_names(){return this.exec("get_interface_names",[])}get_router_names(){return this.exec("get_router_names",[])}send_raw(e,s){return this.exec("send_raw",[e,s])}list_configs(e){return this.exec("list_configs",[e])}load_config(e,s){return this.exec("load_config",[e,s])}save_config(e,s,n){return this.exec("save_config",[e,s,n])}delete_config(e,s){return this.exec("delete_config",[e,s])}enable_limits(e,s,n){return this.exec("enable_limits",[e,s,n])}disable_limits(e,s,n){return this.exec("disable_limits",[e,s,n])}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,s){return this.exec("get_setting",[e],s)}get_settings(e,s){return this.exec("get_settings",e,s)}set_setting(e,s){return this.exec("set_setting",[e,s])}update_news(){return this.exec("update_news",[])}update_plugin_store(){return this.exec("update_plugin_store",[])}save_setting(e,s){return this.exec("set_setting",[e,s])}get_metrics(){return this.exec("get_metrics",[])}async hashString(e){if(window.isSecureContext){const s=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",s),r=new Uint8Array(n);return Array.from(r).map(o=>o.toString(16).padStart(2,"0")).join("")}}}let Ve=[];const Ai={components:{OpenConfigDialog:wt,SaveConfigDialog:_t,TargetPacketItemChooser:Et,TopBar:Us},mixins:[bt,yt],data(){return{title:"Data Extractor",configKey:"data_extractor",openConfig:!1,saveConfig:!1,api:null,timeZone:"local",progress:0,packetsReceived:0,totalPacketsReceived:0,itemsReceived:0,totalItemsReceived:0,processButtonText:"Process",todaysDate:null,startDate:null,startTime:null,endTime:null,endDate:null,startDateTime:null,endDateTime:null,startDateTimeFilename:"",rules:{required:t=>!!t||"Required"},cmdOrTlm:"tlm",items:[],search:"",headers:[{title:"Target",value:"targetName"},{title:"Packet",value:"packetName"},{title:"Item",value:"itemName"},{title:"Mode",value:"mode"},{title:"ValueType",value:"valueType"},{title:"ReducedType",value:"reducedType"},{title:"Edit",value:"edit"},{title:"Delete",value:"delete"}],itemsPerPage:20,columnMap:{},delimiter:",",columnMode:"normal",fileCount:0,skipIgnored:!0,fillDown:!1,matlabHeader:!1,uniqueOnly:!1,keyMap:{},modes:["DECOM","REDUCED_MINUTE","REDUCED_HOUR","REDUCED_DAY"],valueTypes:["CONVERTED","RAW","FORMATTED","WITH_UNITS"],reducedTypes:["SAMPLE","MIN","MAX","AVG","STDDEV"],editAll:!1,allItemMode:"DECOM",allItemValueType:"CONVERTED",allItemReducedType:"SAMPLE",cable:new Kr,subscription:null,enterprise:!1}},computed:{hasCommands:function(){return this.items.some(t=>t.cmdOrTlm==="CMD")},menus:function(){return[{label:"File",items:[{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.resetConfig(),this.resetConfigBase()}},{divider:!0},{radioGroup:!0,value:this.delimiter,command:t=>{this.delimiter=t},choices:[{label:"Comma Delimited",value:","},{label:"Tab Delimited",value:" "}]}]},{label:"Mode",items:[{label:"Fill Down",checkbox:!0,checked:this.fillDown,command:()=>{this.fillDown=!this.fillDown}},{label:"Matlab Header",checkbox:!0,checked:this.matlabHeader,command:t=>{this.matlabHeader=!this.matlabHeader}},{label:"Unique Only",checkbox:!0,checked:this.uniqueOnly,command:t=>{this.uniqueOnly=!this.uniqueOnly}},{divider:!0},{radioGroup:!0,value:this.columnMode,command:t=>{this.columnMode=t},choices:[{label:"Normal Columns",value:"normal"},{label:"Full Column Names",value:"full"}]}]}]},currentConfig:function(){return{delimiter:this.delimiter,fillDown:this.fillDown,matlabHeader:this.matlabHeader,uniqueOnly:this.uniqueOnly,columnMode:this.columnMode,cmdOrTlm:this.cmdOrTlm,items:this.items,itemsPerPage:this.itemsPerPage}}},watch:{delimiter:function(){this.saveDefaultConfig(this.currentConfig)},fillDown:function(){this.saveDefaultConfig(this.currentConfig)},matlabHeader:function(){this.saveDefaultConfig(this.currentConfig)},uniqueOnly:function(){this.saveDefaultConfig(this.currentConfig)},columnNode:function(){this.saveDefaultConfig(this.currentConfig)},cmdOrTlm:function(){this.items.length===0?this.saveDefaultConfig(this.currentConfig):this.items=[]},items:{handler:function(){this.saveDefaultConfig(this.currentConfig)},deep:!0},itemsPerPage:function(){this.saveDefaultConfig(this.currentConfig)}},async created(){this.api=new Ri,await this.api.get_setting("time_zone").then(e=>{e&&(this.timeZone=e)}).catch(e=>{}),await pr.get("/openc3-api/info").then(e=>{e.data.enterprise&&(this.enterprise=!0)});let t=new Date;this.todaysDate=this.formatDate(t,this.timeZone),this.startDate=this.formatDate(t-36e5,this.timeZone),this.startTime=this.formatTimeHMS(t-36e5,this.timeZone),this.endTime=this.formatTimeHMS(t,this.timeZone),this.endDate=this.formatDate(t,this.timeZone)},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.applyConfig(t)}},unmounted:function(){this.subscription&&this.subscription.unsubscribe(),this.cable.disconnect()},methods:{resetConfig:function(){this.delimiter=",",this.fillDown=!1,this.matlabHeader=!1,this.uniqueOnly=!1,this.columnMode="normal";let t=new Date;this.startDate=this.formatDate(t-36e5,this.timeZone),this.startTime=this.formatTimeHMS(t-36e5,this.timeZone),this.endTime=this.formatTimeHMS(t,this.timeZone),this.endDate=this.formatDate(t,this.timeZone),this.cmdOrTlm="tlm",this.items=[],this.itemsPerPage=20,this.applyConfig(this.currentConfig)},applyConfig:function(t){this.delimiter=t.delimiter||",",this.menus[0].radioGroup=this.delimiter===","?"Comma Delimited":"Tab Delimited",this.fillDown=t.fillDown,this.menus[1].items[0].checked=this.fillDown||!1,this.matlabHeader=t.matlabHeader,this.menus[1].items[1].checked=this.matlabHeader||!1,this.uniqueOnly=t.uniqueOnly,this.menus[1].items[2].checked=this.uniqueOnly||!1,this.columnMode=t.columnMode,this.menus[1].radioGroup=this.columnMode==="normal"?"Normal Columns":"Full Column Names",this.cmdOrTlm=t.cmdOrTlm,this.items=t.items,this.itemsPerPage=t.itemsPerPage},openConfiguration:function(t,e=!1){this.openConfigBase(t,e,s=>{this.applyConfig(s),this.startDate=s.startDate,this.startTime=s.startTime,this.endTime=s.endTime,this.endDate=s.endDate,this.saveDefaultConfig(this.currentConfig)})},saveConfiguration:function(t){let e=this.currentConfig;e.startDate=this.startDate,e.startTime=this.startTime,e.endTime=this.endTime,e.endDate=this.endDate,this.saveConfigBase(t,e)},addItem:function(t){for(const e of this.items)if(e.itemName===t.itemName&&e.packetName===t.packetName&&e.targetName===t.targetName&&e.valueType==="CONVERTED"&&e.reducedType==="SAMPLE"&&e.mode==="DECOM"){this.$notify.caution({body:"This item has already been added!"});return}t.cmdOrTlm=this.cmdOrTlm.toUpperCase(),t.edit=!1,t.valueType="CONVERTED",t.reducedType="SAMPLE",t.mode="DECOM",this.items.push(t)},deleteItem:function(t){let e=this.items.indexOf(t);this.items.splice(e,1)},deleteAll:function(){this.items=[]},editAllItems:function(){this.editAll=!1;for(let t of this.items)t.mode=this.allItemMode,t.valueType=this.allItemValueType,t.reducedType=this.allItemReducedType},getItemLabel:function(t){let e=[`${t.targetName} - ${t.packetName} - ${t.itemName}`];return t.mode!=="DECOM"&&e.push(`{ ${t.mode} }`),t.valueType!=="CONVERTED"&&e.push(`( ${t.valueType} )`),t.reducedType!=="SAMPLE"&&e.push(`[ ${t.reducedType} ]`),e.join(" ")},setTimestamps:function(){this.startDateTimeFilename=this.startDate+"_"+this.startTime,this.startDateTimeFilename=this.startDateTimeFilename.replace(/(:|-|\.)\s*/g,"_");let t,e;try{this.timeZone==="local"?(t=new Date(this.startDate+" "+this.startTime),e=new Date(this.endDate+" "+this.endTime)):(t=new Date(this.startDate+" "+this.startTime+"Z"),e=new Date(this.endDate+" "+this.endTime+"Z"),this.startDateTimeFilename+="_UTC")}catch{return}this.startDateTime=t.getTime()*1e6,this.endDateTime=e.getTime()*1e6},processItems:function(){if(this.processButtonText==="Cancel"){this.finished();return}if(this.setTimestamps(),!this.startDateTime||!this.endDateTime){this.$notify.caution({body:"Invalid date/time selected!"});return}if(this.startDateTime===this.endDateTime){this.$notify.caution({body:"Start date/time is equal to end date/time!"});return}if(this.endDateTime-this.startDateTime<0){this.$notify.caution({body:"Start date/time is greater then end date/time!"});return}new Date(this.endDateTime/1e6)>Date.now()&&this.$notify.caution({title:"Note",body:`End date/time is greater than current date/time. Data will
|
|
1
|
+
System.register(["./main-5393150a38f7b14176e1.js","vue","./TargetPacketItemChooser-DDqBQTWC-14850752bb987478aae1.js","./OpenC3TimePicker-D-_qqySI-3567ab45a515094ba0d0.js","vue-router","single-spa","vuex","vuetify"],function(Is,Di){"use strict";var mt,gt,bt,_t,yt,wt,C,U,P,vt,f,g,Te,G,ee,ae,fe,St,F,Be,He,ce,ze,Tt,We,Et,Ct;return{setters:[k=>{mt=k.d,gt=k._,bt=k.k,_t=k.R,yt=k.M,wt=k.I},k=>{C=k.resolveComponent,U=k.createBlock,P=k.openBlock,vt=k.Teleport,f=k.createVNode,g=k.withCtx,Te=k.createElementVNode,G=k.toDisplayString,ee=k.createElementBlock,ae=k.Fragment,fe=k.renderList,St=k.ref,F=k.createTextVNode,Be=k.mergeProps,He=k.createSlots,ce=k.createCommentVNode,ze=k.normalizeStyle,Tt=k.withModifiers,We=k.withKeys},k=>{Et=k.C},k=>{Ct=k.M},null,null,null,null],execute:function(){var k=document.createElement("style");k.textContent=`.title-font[data-v-2675b2d7]{font-size:1.125rem}.v-progress-linear__determinate[data-v-2675b2d7]{transition:none!important}
|
|
2
|
+
/*$vite$:1*/`,document.head.appendChild(k);const Ds={__name:"TopBarMenu",props:{menu:{type:Object,required:!0},title:{type:String,required:!0}},emits:["submenu-click"],setup(t,{emit:e}){const s=e,n=St(!1);function r(){n.value=!1}function o(i){return i.replaceAll(" ","-").toLowerCase()}return(i,a)=>{const c=C("v-icon"),u=C("v-btn"),d=C("v-divider"),b=C("v-list-item-title"),y=C("v-list-item"),p=C("v-list"),m=C("v-menu"),h=C("v-radio"),E=C("v-list-item-action"),x=C("v-radio-group"),T=C("v-checkbox");return P(),U(m,{modelValue:n.value,"onUpdate:modelValue":a[0]||(a[0]=_=>n.value=_),"close-on-content-click":!1},{activator:g(({props:_})=>[f(u,Be(_,{variant:"outlined",class:"mx-1 menu-button",text:t.menu.label,"data-test":o(`${t.title} ${t.menu.label}`)}),{append:g(()=>[f(c,{class:"menu-button-icon"},{default:g(()=>[...a[1]||(a[1]=[F(" mdi-menu-down ",-1)])]),_:1})]),_:1},16,["text","data-test"])]),default:g(()=>[f(p,null,{default:g(()=>[(P(!0),ee(ae,null,fe(t.menu.items,(_,O)=>(P(),ee(ae,null,[_.divider?(P(),U(d,{key:O+"-divider"})):_.subMenu&&_.subMenu.length>0?(P(),ee("div",{key:O+"-submenu"},[(P(),U(m,{key:O,"open-on-hover":"",location:"right"},{activator:g(({props:R})=>[(P(),U(y,Be({ref_for:!0},R,{key:O,disabled:_.disabled}),He({append:g(()=>[f(c,null,{default:g(()=>[...a[2]||(a[2]=[F(" mdi-chevron-right ",-1)])]),_:1})]),default:g(()=>[!_.radio&&!_.checkbox?(P(),U(b,{key:0,style:ze("cursor: pointer;"+(_.disabled?"opacity: 0.2":""))},{default:g(()=>[F(G(_.label),1)]),_:2},1032,["style"])):ce("",!0)]),_:2},[_.icon?{name:"prepend",fn:g(()=>[f(c,{disabled:_.disabled},{default:g(()=>[F(G(_.icon),1)]),_:2},1032,["disabled"])]),key:"0"}:void 0]),1040,["disabled"]))]),default:g(()=>[f(p,null,{default:g(()=>[(P(!0),ee(ae,null,fe(_.subMenu,(R,L)=>(P(),U(y,{key:L,"prepend-icon":R.icon,onClick:j=>s("submenu-click",R)},{default:g(()=>[f(b,null,{default:g(()=>[F(G(R.label),1)]),_:2},1024)]),_:2},1032,["prepend-icon","onClick"]))),128))]),_:2},1024)]),_:2},1024))])):_.radioGroup?(P(),U(x,{key:O+"-radio-group",class:"ma-0 pa-0",density:"compact","hide-details":"","model-value":_.value,"onUpdate:modelValue":_.command},{default:g(()=>[(P(!0),ee(ae,null,fe(_.choices,(R,L)=>(P(),U(y,{key:L+"-choice"},{default:g(()=>[f(E,{class:"list-action"},{default:g(()=>[f(h,{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"])):(P(),U(y,{key:O+"-list",disabled:_.disabled,"data-test":o(`${t.title} ${t.menu.label} ${_.label}`),onClick:()=>{_.command(_),_.checkbox||r()}},He({default:g(()=>[_.checkbox?(P(),U(E,{key:0,class:"list-action"},{default:g(()=>[f(T,{modelValue:_.checked,"onUpdate:modelValue":R=>_.checked=R,label:_.label,color:"secondary",density:"compact","hide-details":""},null,8,["modelValue","onUpdate:modelValue","label"])]),_:2},1024)):ce("",!0),!_.radio&&!_.checkbox?(P(),U(b,{key:1,style:ze("cursor: pointer;"+(_.disabled?"opacity: 0.2":""))},{default:g(()=>[F(G(_.label),1)]),_:2},1032,["style"])):ce("",!0)]),_:2},[_.icon?{name:"prepend",fn:g(()=>[f(c,{icon:_.icon,disabled:_.disabled},null,8,["icon","disabled"])]),key:"0"}:void 0]),1032,["disabled","data-test","onClick"]))],64))),256))]),_:1})]),_:1},8,["modelValue"])}}},Ns={components:{TopBarMenu:Ds},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}}},js={class:"app-title mr-2"};function Us(t,e,s,n,r,o){const i=C("v-col"),a=C("v-row"),c=C("TopBarMenu");return P(),U(vt,{to:"#openc3-menu"},[f(a,{"no-gutters":""},{default:g(()=>[f(i,{"align-self":"end"},{default:g(()=>[Te("span",js,G(s.title),1)]),_:1})]),_:1}),f(a,{dense:"",class:"flex-nowrap"},{default:g(()=>[(P(!0),ee(ae,null,fe(s.menus,(u,d)=>(P(),U(c,{key:d+"-top-menu",ref_for:!0,ref:"topmenu",menu:u,title:s.title,onSubmenuClick:o.subMenuClick},null,8,["menu","title","onSubmenuClick"]))),128))]),_:1})])}const Ms=mt(Ns,[["render",Us],["__scopeId","data-v-b6581c4c"]]);var Ls=Object.defineProperty,Fs=(t,e,s)=>e in t?Ls(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,Ee=(t,e,s)=>Fs(t,typeof e!="symbol"?e+"":e,s);function xt(t,e){return function(){return t.apply(e,arguments)}}const{toString:Vs}=Object.prototype,{getPrototypeOf:Je}=Object,{iterator:Ce,toStringTag:Ot}=Symbol,xe=(t=>e=>{const s=Vs.call(e);return t[s]||(t[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),J=t=>(t=t.toLowerCase(),e=>xe(e)===t),Oe=t=>e=>typeof e===t,{isArray:le}=Array,ue=Oe("undefined");function pe(t){return t!==null&&!ue(t)&&t.constructor!==null&&!ue(t.constructor)&&V(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const kt=J("ArrayBuffer");function qs(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&kt(t.buffer),e}const $s=Oe("string"),V=Oe("function"),Rt=Oe("number"),me=t=>t!==null&&typeof t=="object",Bs=t=>t===!0||t===!1,ke=t=>{if(xe(t)!=="object")return!1;const e=Je(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Ot in t)&&!(Ce in t)},Hs=t=>{if(!me(t)||pe(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},zs=J("Date"),Ws=J("File"),Js=J("Blob"),Ks=J("FileList"),Zs=t=>me(t)&&V(t.pipe),Gs=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||V(t.append)&&((e=xe(t))==="formdata"||e==="object"&&V(t.toString)&&t.toString()==="[object FormData]"))},Xs=J("URLSearchParams"),[Qs,Ys,en,tn]=["ReadableStream","Request","Response","Headers"].map(J),sn=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ge(t,e,{allOwnKeys:s=!1}={}){if(t===null||typeof t>"u")return;let n,r;if(typeof t!="object"&&(t=[t]),le(t))for(n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else{if(pe(t))return;const o=s?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let a;for(n=0;n<i;n++)a=o[n],e.call(null,t[a],a,t)}}function At(t,e){if(pe(t))return null;e=e.toLowerCase();const s=Object.keys(t);let n=s.length,r;for(;n-- >0;)if(r=s[n],e===r.toLowerCase())return r;return null}const se=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Pt=t=>!ue(t)&&t!==se;function Ke(){const{caseless:t,skipUndefined:e}=Pt(this)&&this||{},s={},n=(r,o)=>{const i=t&&At(s,o)||o;ke(s[i])&&ke(r)?s[i]=Ke(s[i],r):ke(r)?s[i]=Ke({},r):le(r)?s[i]=r.slice():(!e||!ue(r))&&(s[i]=r)};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&ge(arguments[r],n);return s}const nn=(t,e,s,{allOwnKeys:n}={})=>(ge(e,(r,o)=>{s&&V(r)?t[o]=xt(r,s):t[o]=r},{allOwnKeys:n}),t),rn=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),on=(t,e,s,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),s&&Object.assign(t.prototype,s)},an=(t,e,s,n)=>{let r,o,i;const a={};if(e=e||{},t==null)return e;do{for(r=Object.getOwnPropertyNames(t),o=r.length;o-- >0;)i=r[o],(!n||n(i,t,e))&&!a[i]&&(e[i]=t[i],a[i]=!0);t=s!==!1&&Je(t)}while(t&&(!s||s(t,e))&&t!==Object.prototype);return e},cn=(t,e,s)=>{t=String(t),(s===void 0||s>t.length)&&(s=t.length),s-=e.length;const n=t.indexOf(e,s);return n!==-1&&n===s},ln=t=>{if(!t)return null;if(le(t))return t;let e=t.length;if(!Rt(e))return null;const s=new Array(e);for(;e-- >0;)s[e]=t[e];return s},un=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Je(Uint8Array)),dn=(t,e)=>{const s=(t&&t[Ce]).call(t);let n;for(;(n=s.next())&&!n.done;){const r=n.value;e.call(t,r[0],r[1])}},hn=(t,e)=>{let s;const n=[];for(;(s=t.exec(e))!==null;)n.push(s);return n},fn=J("HTMLFormElement"),pn=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,s,n){return s.toUpperCase()+n}),It=(({hasOwnProperty:t})=>(e,s)=>t.call(e,s))(Object.prototype),mn=J("RegExp"),Dt=(t,e)=>{const s=Object.getOwnPropertyDescriptors(t),n={};ge(s,(r,o)=>{let i;(i=e(r,o,t))!==!1&&(n[o]=i||r)}),Object.defineProperties(t,n)},gn=t=>{Dt(t,(e,s)=>{if(V(t)&&["arguments","caller","callee"].indexOf(s)!==-1)return!1;const n=t[s];if(V(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},bn=(t,e)=>{const s={},n=r=>{r.forEach(o=>{s[o]=!0})};return le(t)?n(t):n(String(t).split(e)),s},_n=()=>{},yn=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function wn(t){return!!(t&&V(t.append)&&t[Ot]==="FormData"&&t[Ce])}const vn=t=>{const e=new Array(10),s=(n,r)=>{if(me(n)){if(e.indexOf(n)>=0)return;if(pe(n))return n;if(!("toJSON"in n)){e[r]=n;const o=le(n)?[]:{};return ge(n,(i,a)=>{const c=s(i,r+1);!ue(c)&&(o[a]=c)}),e[r]=void 0,o}}return n};return s(t,0)},Sn=J("AsyncFunction"),Tn=t=>t&&(me(t)||V(t))&&V(t.then)&&V(t.catch),Nt=((t,e)=>t?setImmediate:e?((s,n)=>(se.addEventListener("message",({source:r,data:o})=>{r===se&&o===s&&n.length&&n.shift()()},!1),r=>{n.push(r),se.postMessage(s,"*")}))(`axios@${Math.random()}`,[]):s=>setTimeout(s))(typeof setImmediate=="function",V(se.postMessage)),En=typeof queueMicrotask<"u"?queueMicrotask.bind(se):typeof process<"u"&&process.nextTick||Nt,Cn=t=>t!=null&&V(t[Ce]),l={isArray:le,isArrayBuffer:kt,isBuffer:pe,isFormData:Gs,isArrayBufferView:qs,isString:$s,isNumber:Rt,isBoolean:Bs,isObject:me,isPlainObject:ke,isEmptyObject:Hs,isReadableStream:Qs,isRequest:Ys,isResponse:en,isHeaders:tn,isUndefined:ue,isDate:zs,isFile:Ws,isBlob:Js,isRegExp:mn,isFunction:V,isStream:Zs,isURLSearchParams:Xs,isTypedArray:un,isFileList:Ks,forEach:ge,merge:Ke,extend:nn,trim:sn,stripBOM:rn,inherits:on,toFlatObject:an,kindOf:xe,kindOfTest:J,endsWith:cn,toArray:ln,forEachEntry:dn,matchAll:hn,isHTMLForm:fn,hasOwnProperty:It,hasOwnProp:It,reduceDescriptors:Dt,freezeMethods:gn,toObjectSet:bn,toCamelCase:pn,noop:_n,toFiniteNumber:yn,findKey:At,global:se,isContextDefined:Pt,isSpecCompliantForm:wn,toJSONObject:vn,isAsyncFn:Sn,isThenable:Tn,setImmediate:Nt,asap:En,isIterable:Cn};function S(t,e,s,n,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),s&&(this.config=s),n&&(this.request=n),r&&(this.response=r,this.status=r.status?r.status:null)}l.inherits(S,Error,{toJSON:function(){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:l.toJSONObject(this.config),code:this.code,status:this.status}}});const jt=S.prototype,Ut={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Ut[t]={value:t}}),Object.defineProperties(S,Ut),Object.defineProperty(jt,"isAxiosError",{value:!0}),S.from=(t,e,s,n,r,o)=>{const i=Object.create(jt);l.toFlatObject(t,i,function(u){return u!==Error.prototype},u=>u!=="isAxiosError");const a=t&&t.message?t.message:"Error",c=e==null&&t?t.code:e;return S.call(i,a,c,s,n,r),t&&i.cause==null&&Object.defineProperty(i,"cause",{value:t,configurable:!0}),i.name=t&&t.name||"Error",o&&Object.assign(i,o),i};const xn=null;function Ze(t){return l.isPlainObject(t)||l.isArray(t)}function Mt(t){return l.endsWith(t,"[]")?t.slice(0,-2):t}function Lt(t,e,s){return t?t.concat(e).map(function(n,r){return n=Mt(n),!s&&r?"["+n+"]":n}).join(s?".":""):e}function On(t){return l.isArray(t)&&!t.some(Ze)}const kn=l.toFlatObject(l,{},null,function(t){return/^is[A-Z]/.test(t)});function Re(t,e,s){if(!l.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,s=l.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,m){return!l.isUndefined(m[p])});const n=s.metaTokens,r=s.visitor||u,o=s.dots,i=s.indexes,a=(s.Blob||typeof Blob<"u"&&Blob)&&l.isSpecCompliantForm(e);if(!l.isFunction(r))throw new TypeError("visitor must be a function");function c(p){if(p===null)return"";if(l.isDate(p))return p.toISOString();if(l.isBoolean(p))return p.toString();if(!a&&l.isBlob(p))throw new S("Blob is not supported. Use a Buffer instead.");return l.isArrayBuffer(p)||l.isTypedArray(p)?a&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function u(p,m,h){let E=p;if(p&&!h&&typeof p=="object"){if(l.endsWith(m,"{}"))m=n?m:m.slice(0,-2),p=JSON.stringify(p);else if(l.isArray(p)&&On(p)||(l.isFileList(p)||l.endsWith(m,"[]"))&&(E=l.toArray(p)))return m=Mt(m),E.forEach(function(x,T){!(l.isUndefined(x)||x===null)&&e.append(i===!0?Lt([m],T,o):i===null?m:m+"[]",c(x))}),!1}return Ze(p)?!0:(e.append(Lt(h,m,o),c(p)),!1)}const d=[],b=Object.assign(kn,{defaultVisitor:u,convertValue:c,isVisitable:Ze});function y(p,m){if(!l.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(p),l.forEach(p,function(h,E){(!(l.isUndefined(h)||h===null)&&r.call(e,h,l.isString(E)?E.trim():E,m,b))===!0&&y(h,m?m.concat(E):[E])}),d.pop()}}if(!l.isObject(t))throw new TypeError("data must be an object");return y(t),e}function Ft(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function Ge(t,e){this._pairs=[],t&&Re(t,this,e)}const Vt=Ge.prototype;Vt.append=function(t,e){this._pairs.push([t,e])},Vt.toString=function(t){const e=t?function(s){return t.call(this,s,Ft)}:Ft;return this._pairs.map(function(s){return e(s[0])+"="+e(s[1])},"").join("&")};function Rn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function qt(t,e,s){if(!e)return t;const n=s&&s.encode||Rn;l.isFunction(s)&&(s={serialize:s});const r=s&&s.serialize;let o;if(r?o=r(e,s):o=l.isURLSearchParams(e)?e.toString():new Ge(e,s).toString(n),o){const i=t.indexOf("#");i!==-1&&(t=t.slice(0,i)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class $t{constructor(){this.handlers=[]}use(e,s,n){return this.handlers.push({fulfilled:e,rejected:s,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){l.forEach(this.handlers,function(s){s!==null&&e(s)})}}const Bt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},An=typeof URLSearchParams<"u"?URLSearchParams:Ge,Pn=typeof FormData<"u"?FormData:null,In=typeof Blob<"u"?Blob:null,Dn={isBrowser:!0,classes:{URLSearchParams:An,FormData:Pn,Blob:In},protocols:["http","https","file","blob","url","data"]},Xe=typeof window<"u"&&typeof document<"u",Qe=typeof navigator=="object"&&navigator||void 0,Nn=Xe&&(!Qe||["ReactNative","NativeScript","NS"].indexOf(Qe.product)<0),jn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Un=Xe&&window.location.href||"http://localhost",Mn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Xe,hasStandardBrowserEnv:Nn,hasStandardBrowserWebWorkerEnv:jn,navigator:Qe,origin:Un},Symbol.toStringTag,{value:"Module"})),M={...Mn,...Dn};function Ln(t,e){return Re(t,new M.classes.URLSearchParams,{visitor:function(s,n,r,o){return M.isNode&&l.isBuffer(s)?(this.append(n,s.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Fn(t){return l.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Vn(t){const e={},s=Object.keys(t);let n;const r=s.length;let o;for(n=0;n<r;n++)o=s[n],e[o]=t[o];return e}function Ht(t){function e(s,n,r,o){let i=s[o++];if(i==="__proto__")return!0;const a=Number.isFinite(+i),c=o>=s.length;return i=!i&&l.isArray(r)?r.length:i,c?(l.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a):((!r[i]||!l.isObject(r[i]))&&(r[i]=[]),e(s,n,r[i],o)&&l.isArray(r[i])&&(r[i]=Vn(r[i])),!a)}if(l.isFormData(t)&&l.isFunction(t.entries)){const s={};return l.forEachEntry(t,(n,r)=>{e(Fn(n),r,s,0)}),s}return null}function qn(t,e,s){if(l.isString(t))try{return(e||JSON.parse)(t),l.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(s||JSON.stringify)(t)}const be={transitional:Bt,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const s=e.getContentType()||"",n=s.indexOf("application/json")>-1,r=l.isObject(t);if(r&&l.isHTMLForm(t)&&(t=new FormData(t)),l.isFormData(t))return n?JSON.stringify(Ht(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 o;if(r){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Ln(t,this.formSerializer).toString();if((o=l.isFileList(t))||s.indexOf("multipart/form-data")>-1){const i=this.env&&this.env.FormData;return Re(o?{"files[]":t}:t,i&&new i,this.formSerializer)}}return r||n?(e.setContentType("application/json",!1),qn(t)):t}],transformResponse:[function(t){const e=this.transitional||be.transitional,s=e&&e.forcedJSONParsing,n=this.responseType==="json";if(l.isResponse(t)||l.isReadableStream(t))return t;if(t&&l.isString(t)&&(s&&!this.responseType||n)){const r=!(e&&e.silentJSONParsing)&&n;try{return JSON.parse(t,this.parseReviver)}catch(o){if(r)throw o.name==="SyntaxError"?S.from(o,S.ERR_BAD_RESPONSE,this,null,this.response):o}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:M.classes.FormData,Blob:M.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};l.forEach(["delete","get","head","post","put","patch"],t=>{be.headers[t]={}});const $n=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"]),Bn=t=>{const e={};let s,n,r;return t&&t.split(`
|
|
3
|
+
`).forEach(function(o){r=o.indexOf(":"),s=o.substring(0,r).trim().toLowerCase(),n=o.substring(r+1).trim(),!(!s||e[s]&&$n[s])&&(s==="set-cookie"?e[s]?e[s].push(n):e[s]=[n]:e[s]=e[s]?e[s]+", "+n:n)}),e},zt=Symbol("internals");function _e(t){return t&&String(t).trim().toLowerCase()}function Ae(t){return t===!1||t==null?t:l.isArray(t)?t.map(Ae):String(t)}function Hn(t){const e=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=s.exec(t);)e[n[1]]=n[2];return e}const zn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Ye(t,e,s,n,r){if(l.isFunction(n))return n.call(this,e,s);if(r&&(e=s),!!l.isString(e)){if(l.isString(n))return e.indexOf(n)!==-1;if(l.isRegExp(n))return n.test(e)}}function Wn(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,s,n)=>s.toUpperCase()+n)}function Jn(t,e){const s=l.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+s,{value:function(r,o,i){return this[n].call(this,e,r,o,i)},configurable:!0})})}let q=class{constructor(t){t&&this.set(t)}set(t,e,s){const n=this;function r(i,a,c){const u=_e(a);if(!u)throw new Error("header name must be a non-empty string");const d=l.findKey(n,u);(!d||n[d]===void 0||c===!0||c===void 0&&n[d]!==!1)&&(n[d||a]=Ae(i))}const o=(i,a)=>l.forEach(i,(c,u)=>r(c,u,a));if(l.isPlainObject(t)||t instanceof this.constructor)o(t,e);else if(l.isString(t)&&(t=t.trim())&&!zn(t))o(Bn(t),e);else if(l.isObject(t)&&l.isIterable(t)){let i={},a,c;for(const u of t){if(!l.isArray(u))throw TypeError("Object iterator must return a key-value pair");i[c=u[0]]=(a=i[c])?l.isArray(a)?[...a,u[1]]:[a,u[1]]:u[1]}o(i,e)}else t!=null&&r(e,t,s);return this}get(t,e){if(t=_e(t),t){const s=l.findKey(this,t);if(s){const n=this[s];if(!e)return n;if(e===!0)return Hn(n);if(l.isFunction(e))return e.call(this,n,s);if(l.isRegExp(e))return e.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=_e(t),t){const s=l.findKey(this,t);return!!(s&&this[s]!==void 0&&(!e||Ye(this,this[s],s,e)))}return!1}delete(t,e){const s=this;let n=!1;function r(o){if(o=_e(o),o){const i=l.findKey(s,o);i&&(!e||Ye(s,s[i],i,e))&&(delete s[i],n=!0)}}return l.isArray(t)?t.forEach(r):r(t),n}clear(t){const e=Object.keys(this);let s=e.length,n=!1;for(;s--;){const r=e[s];(!t||Ye(this,this[r],r,t,!0))&&(delete this[r],n=!0)}return n}normalize(t){const e=this,s={};return l.forEach(this,(n,r)=>{const o=l.findKey(s,r);if(o){e[o]=Ae(n),delete e[r];return}const i=t?Wn(r):String(r).trim();i!==r&&delete e[r],e[i]=Ae(n),s[i]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return l.forEach(this,(s,n)=>{s!=null&&s!==!1&&(e[n]=t&&l.isArray(s)?s.join(", "):s)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(`
|
|
4
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const s=new this(t);return e.forEach(n=>s.set(n)),s}static accessor(t){const e=(this[zt]=this[zt]={accessors:{}}).accessors,s=this.prototype;function n(r){const o=_e(r);e[o]||(Jn(s,r),e[o]=!0)}return l.isArray(t)?t.forEach(n):n(t),this}};q.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),l.reduceDescriptors(q.prototype,({value:t},e)=>{let s=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[s]=n}}}),l.freezeMethods(q);function et(t,e){const s=this||be,n=e||s,r=q.from(n.headers);let o=n.data;return l.forEach(t,function(i){o=i.call(s,o,r.normalize(),e?e.status:void 0)}),r.normalize(),o}function Wt(t){return!!(t&&t.__CANCEL__)}function de(t,e,s){S.call(this,t??"canceled",S.ERR_CANCELED,e,s),this.name="CanceledError"}l.inherits(de,S,{__CANCEL__:!0});function Jt(t,e,s){const n=s.config.validateStatus;!s.status||!n||n(s.status)?t(s):e(new S("Request failed with status code "+s.status,[S.ERR_BAD_REQUEST,S.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))}function Kn(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Zn(t,e){t=t||10;const s=new Array(t),n=new Array(t);let r=0,o=0,i;return e=e!==void 0?e:1e3,function(a){const c=Date.now(),u=n[o];i||(i=c),s[r]=a,n[r]=c;let d=o,b=0;for(;d!==r;)b+=s[d++],d=d%t;if(r=(r+1)%t,r===o&&(o=(o+1)%t),c-i<e)return;const y=u&&c-u;return y?Math.round(b*1e3/y):void 0}}function Gn(t,e){let s=0,n=1e3/e,r,o;const i=(a,c=Date.now())=>{s=c,r=null,o&&(clearTimeout(o),o=null),t(...a)};return[(...a)=>{const c=Date.now(),u=c-s;u>=n?i(a,c):(r=a,o||(o=setTimeout(()=>{o=null,i(r)},n-u)))},()=>r&&i(r)]}const Pe=(t,e,s=3)=>{let n=0;const r=Zn(50,250);return Gn(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,c=i-n,u=r(c),d=i<=a;n=i;const b={loaded:i,total:a,progress:a?i/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a&&d?(a-i)/u:void 0,event:o,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(b)},s)},Kt=(t,e)=>{const s=t!=null;return[n=>e[0]({lengthComputable:s,total:t,loaded:n}),e[1]]},Zt=t=>(...e)=>l.asap(()=>t(...e)),Xn=M.hasStandardBrowserEnv?((t,e)=>s=>(s=new URL(s,M.origin),t.protocol===s.protocol&&t.host===s.host&&(e||t.port===s.port)))(new URL(M.origin),M.navigator&&/(msie|trident)/i.test(M.navigator.userAgent)):()=>!0,Qn=M.hasStandardBrowserEnv?{write(t,e,s,n,r,o,i){if(typeof document>"u")return;const a=[`${t}=${encodeURIComponent(e)}`];l.isNumber(s)&&a.push(`expires=${new Date(s).toUTCString()}`),l.isString(n)&&a.push(`path=${n}`),l.isString(r)&&a.push(`domain=${r}`),o===!0&&a.push("secure"),l.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Yn(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function er(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Gt(t,e,s){let n=!Yn(e);return t&&(n||s==!1)?er(t,e):e}const Xt=t=>t instanceof q?{...t}:t;function ne(t,e){e=e||{};const s={};function n(u,d,b,y){return l.isPlainObject(u)&&l.isPlainObject(d)?l.merge.call({caseless:y},u,d):l.isPlainObject(d)?l.merge({},d):l.isArray(d)?d.slice():d}function r(u,d,b,y){if(l.isUndefined(d)){if(!l.isUndefined(u))return n(void 0,u,b,y)}else return n(u,d,b,y)}function o(u,d){if(!l.isUndefined(d))return n(void 0,d)}function i(u,d){if(l.isUndefined(d)){if(!l.isUndefined(u))return n(void 0,u)}else return n(void 0,d)}function a(u,d,b){if(b in e)return n(u,d);if(b in t)return n(void 0,u)}const c={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(u,d,b)=>r(Xt(u),Xt(d),b,!0)};return l.forEach(Object.keys({...t,...e}),function(u){const d=c[u]||r,b=d(t[u],e[u],u);l.isUndefined(b)&&d!==a||(s[u]=b)}),s}const Qt=t=>{const e=ne({},t);let{data:s,withXSRFToken:n,xsrfHeaderName:r,xsrfCookieName:o,headers:i,auth:a}=e;if(e.headers=i=q.from(i),e.url=qt(Gt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),l.isFormData(s)){if(M.hasStandardBrowserEnv||M.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(l.isFunction(s.getHeaders)){const c=s.getHeaders(),u=["content-type","content-length"];Object.entries(c).forEach(([d,b])=>{u.includes(d.toLowerCase())&&i.set(d,b)})}}if(M.hasStandardBrowserEnv&&(n&&l.isFunction(n)&&(n=n(e)),n||n!==!1&&Xn(e.url))){const c=r&&o&&Qn.read(o);c&&i.set(r,c)}return e},tr=typeof XMLHttpRequest<"u",sr=tr&&function(t){return new Promise(function(e,s){const n=Qt(t);let r=n.data;const o=q.from(n.headers).normalize();let{responseType:i,onUploadProgress:a,onDownloadProgress:c}=n,u,d,b,y,p;function m(){y&&y(),p&&p(),n.cancelToken&&n.cancelToken.unsubscribe(u),n.signal&&n.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(n.method.toUpperCase(),n.url,!0),h.timeout=n.timeout;function E(){if(!h)return;const T=q.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),_={data:!i||i==="text"||i==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:T,config:t,request:h};Jt(function(O){e(O),m()},function(O){s(O),m()},_),h=null}"onloadend"in h?h.onloadend=E:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(E)},h.onabort=function(){h&&(s(new S("Request aborted",S.ECONNABORTED,t,h)),h=null)},h.onerror=function(T){const _=T&&T.message?T.message:"Network Error",O=new S(_,S.ERR_NETWORK,t,h);O.event=T||null,s(O),h=null},h.ontimeout=function(){let T=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const _=n.transitional||Bt;n.timeoutErrorMessage&&(T=n.timeoutErrorMessage),s(new S(T,_.clarifyTimeoutError?S.ETIMEDOUT:S.ECONNABORTED,t,h)),h=null},r===void 0&&o.setContentType(null),"setRequestHeader"in h&&l.forEach(o.toJSON(),function(T,_){h.setRequestHeader(_,T)}),l.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),i&&i!=="json"&&(h.responseType=n.responseType),c&&([b,p]=Pe(c,!0),h.addEventListener("progress",b)),a&&h.upload&&([d,y]=Pe(a),h.upload.addEventListener("progress",d),h.upload.addEventListener("loadend",y)),(n.cancelToken||n.signal)&&(u=T=>{h&&(s(!T||T.type?new de(null,t,h):T),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(u),n.signal&&(n.signal.aborted?u():n.signal.addEventListener("abort",u)));const x=Kn(n.url);if(x&&M.protocols.indexOf(x)===-1){s(new S("Unsupported protocol "+x+":",S.ERR_BAD_REQUEST,t));return}h.send(r||null)})},nr=(t,e)=>{const{length:s}=t=t?t.filter(Boolean):[];if(e||s){let n=new AbortController,r;const o=function(u){if(!r){r=!0,a();const d=u instanceof Error?u:this.reason;n.abort(d instanceof S?d:new de(d instanceof Error?d.message:d))}};let i=e&&setTimeout(()=>{i=null,o(new S(`timeout ${e} of ms exceeded`,S.ETIMEDOUT))},e);const a=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),t=null)};t.forEach(u=>u.addEventListener("abort",o));const{signal:c}=n;return c.unsubscribe=()=>l.asap(a),c}},rr=function*(t,e){let s=t.byteLength;if(s<e){yield t;return}let n=0,r;for(;n<s;)r=n+e,yield t.slice(n,r),n=r},ir=async function*(t,e){for await(const s of or(t))yield*rr(s,e)},or=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:s,value:n}=await e.read();if(s)break;yield n}}finally{await e.cancel()}},Yt=(t,e,s,n)=>{const r=ir(t,e);let o=0,i,a=c=>{i||(i=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await r.next();if(u){a(),c.close();return}let b=d.byteLength;if(s){let y=o+=b;s(y)}c.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(c){return a(c),r.return()}},{highWaterMark:2})},es=64*1024,{isFunction:Ie}=l,ar=(({Request:t,Response:e})=>({Request:t,Response:e}))(l.global),{ReadableStream:ts,TextEncoder:ss}=l.global,ns=(t,...e)=>{try{return!!t(...e)}catch{return!1}},cr=t=>{t=l.merge.call({skipUndefined:!0},ar,t);const{fetch:e,Request:s,Response:n}=t,r=e?Ie(e):typeof fetch=="function",o=Ie(s),i=Ie(n);if(!r)return!1;const a=r&&Ie(ts),c=r&&(typeof ss=="function"?(m=>h=>m.encode(h))(new ss):async m=>new Uint8Array(await new s(m).arrayBuffer())),u=o&&a&&ns(()=>{let m=!1;const h=new s(M.origin,{body:new ts,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!h}),d=i&&a&&ns(()=>l.isReadableStream(new n("").body)),b={stream:d&&(m=>m.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!b[m]&&(b[m]=(h,E)=>{let x=h&&h[m];if(x)return x.call(h);throw new S(`Response type '${m}' is not supported`,S.ERR_NOT_SUPPORT,E)})});const y=async m=>{if(m==null)return 0;if(l.isBlob(m))return m.size;if(l.isSpecCompliantForm(m))return(await new s(M.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(l.isArrayBufferView(m)||l.isArrayBuffer(m))return m.byteLength;if(l.isURLSearchParams(m)&&(m=m+""),l.isString(m))return(await c(m)).byteLength},p=async(m,h)=>l.toFiniteNumber(m.getContentLength())??y(h);return async m=>{let{url:h,method:E,data:x,signal:T,cancelToken:_,timeout:O,onDownloadProgress:R,onUploadProgress:L,responseType:j,headers:Z,withCredentials:$="same-origin",fetchOptions:te}=Qt(m),z=e||fetch;j=j?(j+"").toLowerCase():"text";let w=nr([T,_&&_.toAbortSignal()],O),I=null;const B=w&&w.unsubscribe&&(()=>{w.unsubscribe()});let qe;try{if(L&&u&&E!=="get"&&E!=="head"&&(qe=await p(Z,x))!==0){let H=new s(h,{method:"POST",body:x,duplex:"half"}),Y;if(l.isFormData(x)&&(Y=H.headers.get("content-type"))&&Z.setContentType(Y),H.body){const[pt,$e]=Kt(qe,Pe(Zt(L)));x=Yt(H.body,es,pt,$e)}}l.isString($)||($=$?"include":"omit");const N=o&&"credentials"in s.prototype,v={...te,signal:w,method:E.toUpperCase(),headers:Z.normalize().toJSON(),body:x,duplex:"half",credentials:N?$:void 0};I=o&&new s(h,v);let A=await(o?z(I,te):z(h,v));const W=d&&(j==="stream"||j==="response");if(d&&(R||W&&B)){const H={};["status","statusText","headers"].forEach(As=>{H[As]=A[As]});const Y=l.toFiniteNumber(A.headers.get("content-length")),[pt,$e]=R&&Kt(Y,Pe(Zt(R),!0))||[];A=new n(Yt(A.body,es,pt,()=>{$e&&$e(),B&&B()}),H)}j=j||"text";let Q=await b[l.findKey(b,j)||"text"](A,m);return!W&&B&&B(),await new Promise((H,Y)=>{Jt(H,Y,{data:Q,headers:q.from(A.headers),status:A.status,statusText:A.statusText,config:m,request:I})})}catch(N){throw B&&B(),N&&N.name==="TypeError"&&/Load failed|fetch/i.test(N.message)?Object.assign(new S("Network Error",S.ERR_NETWORK,m,I),{cause:N.cause||N}):S.from(N,N&&N.code,m,I)}}},lr=new Map,rs=t=>{let e=t&&t.env||{};const{fetch:s,Request:n,Response:r}=e,o=[n,r,s];let i=o.length,a=i,c,u,d=lr;for(;a--;)c=o[a],u=d.get(c),u===void 0&&d.set(c,u=a?new Map:cr(e)),d=u;return u};rs();const tt={http:xn,xhr:sr,fetch:{get:rs}};l.forEach(tt,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const is=t=>`- ${t}`,ur=t=>l.isFunction(t)||t===null||t===!1;function dr(t,e){t=l.isArray(t)?t:[t];const{length:s}=t;let n,r;const o={};for(let i=0;i<s;i++){n=t[i];let a;if(r=n,!ur(n)&&(r=tt[(a=String(n)).toLowerCase()],r===void 0))throw new S(`Unknown adapter '${a}'`);if(r&&(l.isFunction(r)||(r=r.get(e))))break;o[a||"#"+i]=r}if(!r){const i=Object.entries(o).map(([c,u])=>`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=s?i.length>1?`since :
|
|
5
|
+
`+i.map(is).join(`
|
|
6
|
+
`):" "+is(i[0]):"as no adapter specified";throw new S("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r}const os={getAdapter:dr,adapters:tt};function st(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new de(null,t)}function as(t){return st(t),t.headers=q.from(t.headers),t.data=et.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),os.getAdapter(t.adapter||be.adapter,t)(t).then(function(e){return st(t),e.data=et.call(t,t.transformResponse,e),e.headers=q.from(e.headers),e},function(e){return Wt(e)||(st(t),e&&e.response&&(e.response.data=et.call(t,t.transformResponse,e.response),e.response.headers=q.from(e.response.headers))),Promise.reject(e)})}const cs="1.13.2",De={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{De[t]=function(s){return typeof s===t||"a"+(e<1?"n ":" ")+t}});const ls={};De.transitional=function(t,e,s){function n(r,o){return"[Axios v"+cs+"] Transitional option '"+r+"'"+o+(s?". "+s:"")}return(r,o,i)=>{if(t===!1)throw new S(n(o," has been removed"+(e?" in "+e:"")),S.ERR_DEPRECATED);return e&&!ls[o]&&(ls[o]=!0,console.warn(n(o," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(r,o,i):!0}},De.spelling=function(t){return(e,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function hr(t,e,s){if(typeof t!="object")throw new S("options must be an object",S.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let r=n.length;for(;r-- >0;){const o=n[r],i=e[o];if(i){const a=t[o],c=a===void 0||i(a,o,t);if(c!==!0)throw new S("option "+o+" must be "+c,S.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new S("Unknown option "+o,S.ERR_BAD_OPTION)}}const Ne={assertOptions:hr,validators:De},X=Ne.validators;let re=class{constructor(t){this.defaults=t||{},this.interceptors={request:new $t,response:new $t}}async request(t,e){try{return await this._request(t,e)}catch(s){if(s instanceof Error){let n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;const r=n.stack?n.stack.replace(/^.+\n/,""):"";try{s.stack?r&&!String(s.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
|
7
|
+
`+r):s.stack=r}catch{}}throw s}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=ne(this.defaults,e);const{transitional:s,paramsSerializer:n,headers:r}=e;s!==void 0&&Ne.assertOptions(s,{silentJSONParsing:X.transitional(X.boolean),forcedJSONParsing:X.transitional(X.boolean),clarifyTimeoutError:X.transitional(X.boolean)},!1),n!=null&&(l.isFunction(n)?e.paramsSerializer={serialize:n}:Ne.assertOptions(n,{encode:X.function,serialize:X.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Ne.assertOptions(e,{baseUrl:X.spelling("baseURL"),withXsrfToken:X.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=r&&l.merge(r.common,r[e.method]);r&&l.forEach(["delete","get","head","post","put","patch","common"],p=>{delete r[p]}),e.headers=q.concat(o,r);const i=[];let a=!0;this.interceptors.request.forEach(function(p){typeof p.runWhen=="function"&&p.runWhen(e)===!1||(a=a&&p.synchronous,i.unshift(p.fulfilled,p.rejected))});const c=[];this.interceptors.response.forEach(function(p){c.push(p.fulfilled,p.rejected)});let u,d=0,b;if(!a){const p=[as.bind(this),void 0];for(p.unshift(...i),p.push(...c),b=p.length,u=Promise.resolve(e);d<b;)u=u.then(p[d++],p[d++]);return u}b=i.length;let y=e;for(;d<b;){const p=i[d++],m=i[d++];try{y=p(y)}catch(h){m.call(this,h);break}}try{u=as.call(this,y)}catch(p){return Promise.reject(p)}for(d=0,b=c.length;d<b;)u=u.then(c[d++],c[d++]);return u}getUri(t){t=ne(this.defaults,t);const e=Gt(t.baseURL,t.url,t.allowAbsoluteUrls);return qt(e,t.params,t.paramsSerializer)}};l.forEach(["delete","get","head","options"],function(t){re.prototype[t]=function(e,s){return this.request(ne(s||{},{method:t,url:e,data:(s||{}).data}))}}),l.forEach(["post","put","patch"],function(t){function e(s){return function(n,r,o){return this.request(ne(o||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}re.prototype[t]=e(),re.prototype[t+"Form"]=e(!0)});let fr=class Ps{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(r){s=r});const n=this;this.promise.then(r=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](r);n._listeners=null}),this.promise.then=r=>{let o;const i=new Promise(a=>{n.subscribe(a),o=a}).then(r);return i.cancel=function(){n.unsubscribe(o)},i},e(function(r,o,i){n.reason||(n.reason=new de(r,o,i),s(n.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 s=this._listeners.indexOf(e);s!==-1&&this._listeners.splice(s,1)}toAbortSignal(){const e=new AbortController,s=n=>{e.abort(n)};return this.subscribe(s),e.signal.unsubscribe=()=>this.unsubscribe(s),e.signal}static source(){let e;return{token:new Ps(function(s){e=s}),cancel:e}}};function pr(t){return function(e){return t.apply(null,e)}}function mr(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,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity: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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(nt).forEach(([t,e])=>{nt[e]=t});function us(t){const e=new re(t),s=xt(re.prototype.request,e);return l.extend(s,re.prototype,e,{allOwnKeys:!0}),l.extend(s,e,null,{allOwnKeys:!0}),s.create=function(n){return us(ne(t,n))},s}const D=us(be);D.Axios=re,D.CanceledError=de,D.CancelToken=fr,D.isCancel=Wt,D.VERSION=cs,D.toFormData=Re,D.AxiosError=S,D.Cancel=D.CanceledError,D.all=function(t){return Promise.all(t)},D.spread=pr,D.isAxiosError=mr,D.mergeConfig=ne,D.AxiosHeaders=q,D.formToJSON=t=>Ht(l.isHTMLForm(t)?new FormData(t):t),D.getAdapter=os.getAdapter,D.HttpStatusCode=nt,D.default=D;const{Axios:Ni,AxiosError:ji,CanceledError:Ui,isCancel:Mi,CancelToken:Li,VERSION:Fi,all:Vi,Cancel:qi,isAxiosError:$i,spread:Bi,toFormData:Hi,AxiosHeaders:zi,HttpStatusCode:Wi,formToJSON:Ji,getAdapter:Ki,mergeConfig:Zi}=D,rt=D.create({baseURL:location.origin,timeout:6e4,params:{}});rt.interceptors.response.use(t=>t,t=>{var e,s,n,r,o,i,a,c,u,d,b;if(t.response){if(t.response.status===401&&OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity,!0).then(function(m){m&&OpenC3Auth.setTokens()}),t.response.config.headers["Ignore-Errors"]&&t.response.config.headers["Ignore-Errors"].includes(t.response.status.toString()))return Promise.reject(t);let y=`HTTP ${t.response.status} - `;(e=t.response)!=null&&e.statusText&&(y+=`${t.response.statusText} `),(n=(s=t.response)==null?void 0:s.config)!=null&&n.data&&(y+=`${t.response.config.data} `),(o=(r=t.response)==null?void 0:r.data)!=null&&o.message?y+=`${t.response.data.message}`:(a=(i=t.response)==null?void 0:i.data)!=null&&a.exception?y+=`${t.response.data.exception}`:(d=(u=(c=t.response)==null?void 0:c.data)==null?void 0:u.error)!=null&&d.message?(t.response.data.error.class&&(y+=`${t.response.data.error.class} `),y+=`${t.response.data.error.message}`):y+=`${(b=t.response)==null?void 0:b.data}`;const{$cosmosNotify:p}=window;throw p&&p.serious({title:"Network error",body:y}),t}else throw t});const je=async function(t,e,{data:s,params:n={},headers:r,noAuth:o=!1,noScope:i=!1,onUploadProgress:a=!1}={}){if(!o){try{await OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity)&&OpenC3Auth.setTokens()}catch{OpenC3Auth.login()}r.Authorization=localStorage.openc3Token}return r.manual=!0,!i&&!n.scope&&(n.scope=window.openc3Scope),rt({method:t,url:e,data:s,params:n,headers:r,onUploadProgress:a})},it={Accept:"application/json"},ds={...it,"Content-Type":"application/json"},gr={get:function(t,{params:e,headers:s=it,noScope:n,noAuth:r,onUploadProgress:o}={}){return je("get",t,{params:e,headers:s,noScope:n,noAuth:r,onUploadProgress:o})},put:function(t,{data:e,params:s,headers:n=ds,noScope:r,noAuth:o,onUploadProgress:i}={}){return je("put",t,{data:e,params:s,headers:n,noScope:r,noAuth:o,onUploadProgress:i})},post:function(t,{data:e,params:s,headers:n=ds,noScope:r,noAuth:o,onUploadProgress:i}={}){return je("post",t,{data:e,params:s,headers:n,noScope:r,noAuth:o,onUploadProgress:i})},delete:function(t,{params:e,headers:s=it,noScope:n,noAuth:r,onUploadProgress:o}={}){return je("delete",t,{params:e,headers:s,noScope:n,noAuth:r,onUploadProgress:o})}};let Ue=()=>({emit(t,...e){for(let s=this.events[t]||[],n=0,r=s.length;n<r;n++)s[n](...e)},events:{},on(t,e){var s;return((s=this.events)[t]||(s[t]=[])).push(e),()=>{var n;this.events[t]=(n=this.events[t])==null?void 0:n.filter(r=>e!==r)}}});class ye extends Error{constructor(e,s){e instanceof Error?(super(e.message),this.cause=e):super(e),this.reason=s,this.name="ReasonError"}}class ot extends ye{constructor(e){super("Rejected",e),this.name="SubscriptionRejectedError"}}class br extends ye{constructor(e){super(e||"Timed out to receive subscription ack"),this.name="SubscriptionTimeoutError"}}class K extends ye{constructor(e,s){s?super(e,s):super("Disconnected",e),this.name="DisconnectedError"}}class _r extends K{constructor(e){super(e,"stale_connection"),this.name="StaleConnectionError"}}function hs(t){return t?`{${Object.keys(t).sort().filter(e=>t[e]!==void 0).map(e=>{let s=JSON.stringify(t[e]);return`${JSON.stringify(e)}:${s}`}).join(",")}}`:""}class yr{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,s){if(!this._info)return this._info={id:e,info:s},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((s,{id:n,info:r})=>(s[n]=r,s),{})}}const ie=Symbol("state");class fs{constructor(e={}){this.emitter=Ue(),this.params=Object.freeze(e),this.presence=new yr(this),this.initialConnect=!0,this[ie]="idle"}get identifier(){return this._identifier?this._identifier:(this._identifier=hs({channel:this.channelId,...this.params}),this._identifier)}get channelId(){return this.constructor.identifier}get state(){return this[ie]}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[ie]="connecting"}connected(){if(this.state==="connected"||this.state==="closed")return;this[ie]="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[ie]="connected";let e=!0,s=!0;this.initialConnect=!1,this.emit("connect",{reconnect:s,restored:e})}disconnected(e){this.state==="disconnected"||this.state==="closed"||(this[ie]="disconnected",this.presence.reset(),this.emit("disconnect",e))}closed(e){this.state!=="closed"&&(this[ie]="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,s){if(this.state==="idle"||this.state==="closed")throw Error("Channel is not subscribed");return this.receiver.perform(this.identifier,e,s)}async send(e){return this.perform(void 0,e)}async whisper(e){try{await this.perform("$whisper",e)}catch(s){let n=this.receiver?this.receiver.logger:null;n&&n.warn("whisper failed: ",s)}}receive(e,s){this.emit("message",e,s)}on(e,s){return this.emitter.on(e,s)}once(e,s){let n=this.emitter.on(e,(...r)=>{n(),s(...r)});return n}emit(e,...s){return this.emitter.emit(e,...s)}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,s)=>{let n=[()=>delete this._pendingSubscribe];n.push(this.on("connect",()=>{n.forEach(r=>r()),e()})),n.push(this.on("close",r=>{n.forEach(o=>o()),s(r||new ye("Channel was disconnected before subscribing","canceled"))}))}),this._pendingSubscribe)}}class wr{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 s=this.channels.indexOf(e);s>-1&&this.channels.splice(s,1)}notify(e,...s){this.state=e==="restored"?"connected":e,s.length===1?this.channels.forEach(n=>n[e](s[0])):this.channels.forEach(n=>n[e]())}pending(e){this._checkIntent(e);let s=this._pendings[0];return!s||s.intent!==e?Promise.resolve():s.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 s,n={promise:new Promise(o=>{s=o}),intent:e,release:()=>{this._pendings.splice(this._pendings.indexOf(n),1),s(n)},canceled:!1,acquired:!1},r=this._pendingTop;return this._pendings.push(n),r&&await r.promise,this.gvl&&await this.gvl.acquire(n,e),n.acquired=!0,n}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 s=this._pendingTop;return!s||s.acquired||s.intent!==e?!1:(this._pendings.pop(),s.canceled=!0,!0)}}class vr{constructor(){this.queue=[]}async acquire(e,s){s==="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 Sr{constructor(e){e.concurrentSubscribes===!1&&(this.glv=new vr),this._subscriptions={},this._localToRemote={}}all(){return Object.values(this._subscriptions)}get(e){return this._subscriptions[e]}create(e,{subscribe:s,unsubscribe:n}){let r=this._subscriptions[e]=new wr(e);return r.remoteId=this._localToRemote[e],r.subscriber=s,r.unsubscriber=n,r.gvl=this.glv,r}remove(e){delete this._subscriptions[e],delete this._localToRemote[e]}storeRemoteId(e,s){this._localToRemote[e]=s;let n=this.get(e);n&&(n.remoteId=s)}}class Tr{constructor(e={}){this.subscriptions=new Sr(e),this._pendingMessages=[],this._remoteToLocal={}}subscribe(e,s){this._remoteToLocal[s]=e,this.subscriptions.storeRemoteId(e,s),this.flush(s)}unsubscribe(e){let s=this.subscriptions.get(e);if(!s)return;let n=s.remoteId;n&&delete this._remoteToLocal[n],this.subscriptions.remove(e)}transmit(e,s,n){let r=this._remoteToLocal[e];if(!r){this._pendingMessages.push([e,s,n]);return}let o=this.subscriptions.get(r);o&&o.channels.forEach(i=>{i.receive(s,n)})}notify(e,s,n){let r=this._remoteToLocal[e];if(!r)return;let o=this.subscriptions.get(r);o&&o.channels.forEach(i=>i.emit(s,n))}close(){this._pendingMessages.length=0}get size(){return this.channels.length}get channels(){return this.subscriptions.all().flatMap(e=>e.channels)}flush(e){let s=[];for(let n of this._pendingMessages)n[0]===e?this.transmit(n[0],n[1],n[2]):s.push(n);this._pendingMessages=s}}const ps={debug:0,info:1,warn:2,error:3};class ms{constructor(e){this.level=e||"warn"}log(e,s,n){ps[e]<ps[this.level]||this.writeLogEntry(e,s,n)}writeLogEntry(){throw Error("Not implemented")}debug(e,s){this.log("debug",e,s)}info(e,s){this.log("info",e,s)}warn(e,s){this.log("warn",e,s)}error(e,s){this.log("error",e,s)}}class we extends ms{writeLogEntry(){}}class Er{encode(e){return JSON.stringify(e)}decode(e){try{return JSON.parse(e)}catch{}}}let Cr=0;class gs{constructor(e={}){let{logger:s}=e;this.logger=s||new we,this.pendingSubscriptions={},this.pendingUnsubscriptions={},this.subscribeCooldownInterval=e.subscribeCooldownInterval||250,this.subscribeRetryInterval=e.subscribeRetryInterval||5e3}attached(e){this.cable=e}subscribe(e,s){let n={channel:e};s&&Object.assign(n,s);let r=hs(n);if(this.pendingUnsubscriptions[r]){let i=this.subscribeCooldownInterval*1.5;return this.logger.debug(`unsubscribed recently, cooldown for ${i}`,r),new Promise(a=>{setTimeout(()=>{a(this.subscribe(e,s))},i)})}if(this.pendingSubscriptions[r])return this.logger.warn("subscription is already pending, skipping",r),Promise.reject(Error("Already subscribing"));let o=this.subscribeRetryInterval;return new Promise((i,a)=>{let c=++Cr;this.pendingSubscriptions[r]={resolve:i,reject:a,id:c},this.cable.send(this.buildSubscribeRequest(r)),this.maybeRetrySubscribe(c,r,o)})}buildSubscribeRequest(e){return{command:"subscribe",identifier:e}}maybeRetrySubscribe(e,s,n){setTimeout(()=>{let r=this.pendingSubscriptions[s];r&&r.id===e&&(this.logger.warn(`no subscription ack received in ${n}ms, retrying subscribe`,s),this.cable.send(this.buildSubscribeRequest(s)),this.maybeExpireSubscribe(e,s,n))},n)}maybeExpireSubscribe(e,s,n){setTimeout(()=>{let r=this.pendingSubscriptions[s];r&&r.id===e&&(delete this.pendingSubscriptions[s],r.reject(new br(`Haven't received subscription ack in ${n*2}ms for ${s}`)))},n)}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,s,n){return s==="$whisper"?this.whisper(e,n):(n||(n={}),n.action=s,this.cable.send({command:"message",identifier:e,data:JSON.stringify(n)}),Promise.resolve())}whisper(e,s){return this.cable.send({command:"whisper",identifier:e,data:s}),Promise.resolve()}receive(e){if(typeof e!="object"){this.logger.error("unsupported message format",{message:e});return}let{type:s,identifier:n,message:r,reason:o,reconnect:i}=e;if(s==="ping")return this.cable.keepalive(e.message);if(this.cable.keepalive(),s==="welcome"){let a=e.sid;return a&&this.cable.setSessionId(a),this.cable.connected()}if(s==="disconnect"){let a=new K(o);this.reset(a),i===!1?this.cable.closed(a):this.cable.disconnected(a);return}if(s==="confirm_subscription"){let a=this.pendingSubscriptions[n];if(!a){this.logger.error("subscription not found, unsubscribing",{type:s,identifier:n}),this.unsubscribe(n);return}return delete this.pendingSubscriptions[n],a.resolve(n)}if(s==="reject_subscription"){let a=this.pendingSubscriptions[n];return a?(delete this.pendingSubscriptions[n],a.reject(new ot)):this.logger.error("subscription not found",{type:s,identifier:n})}if(r)return{identifier:n,message:r};this.logger.warn(`unknown message type: ${s}`,{message:e})}reset(e){for(let s in this.pendingSubscriptions)this.pendingSubscriptions[s].reject(e);this.pendingSubscriptions={}}recoverableClosure(){return!1}}const bs=()=>Date.now()/1e3|0;class xr extends gs{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=bs()),this.sessionId=void 0,this.sendPongs=e.pongs}reset(e){for(let s in this.pendingPresence)this.pendingPresence[s].reject(e);return this.pendingPresence={},super.reset()}receive(e){if(typeof e!="object"){this.logger.error("unsupported message format",{message:e});return}let{type:s,identifier:n,message:r}=e;if(s==="disconnect")return delete this.sessionId,this.cable.setSessionId(""),super.receive(e);if(s==="reject_subscription")return super.receive(e);if(s==="confirm_subscription")return this.subscriptionStreams[n]||(this.subscriptionStreams[n]=new Set),super.receive(e);if(s==="ping")return this.restoreSince&&(this.restoreSince=bs()),this.sendPongs&&this.sendPong(),this.cable.keepalive(e.message);if(this.cable.keepalive(),s==="confirm_history"){this.logger.debug("history result received",e),this.cable.notify("history_received",n);return}if(s==="reject_history"){this.logger.warn("failed to retrieve history",e),this.cable.notify("history_not_found",n);return}if(s==="welcome"){if(this.disableSessionRecovery||(this.sessionId=e.sid,this.sessionId&&this.cable.setSessionId(this.sessionId)),e.restored){let o=e.restored_ids||Object.keys(this.subscriptionStreams);for(let i of o)this.cable.send({identifier:i,command:"history",history:this.historyRequestFor(i)}),this.presenceInfo[i]&&this.cable.send({identifier:i,command:"join",presence:this.presenceInfo[i]});return this.cable.restored(o)}return this.cable.connected(this.sessionId)}if(s==="presence"){let o=r.type;if(o==="info"){let i=this.pendingPresence[n];i&&(delete this.pendingPresence[n],i.resolve(r))}else if(o==="error"){let i=this.pendingPresence[n];i&&(delete this.pendingPresence[n],i.reject(new Error("failed to retrieve presence")))}return{type:s,identifier:n,message:r}}if(r){let o=this.trackStreamPosition(n,e.stream_id,e.epoch,e.offset);return{identifier:n,message:r,meta:o}}this.logger.warn(`unknown message type: ${s}`,{message:e})}perform(e,s,n){switch(s){case"$presence:join":return this.join(e,n);case"$presence:leave":return this.leave(e,n);case"$presence:info":return this.presence(e,n)}return super.perform(e,s,n)}unsubscribe(e){return delete this.presenceInfo[e],super.unsubscribe(e)}buildSubscribeRequest(e){let s=super.buildSubscribeRequest(e),n=this.historyRequestFor(e);n&&(s.history=n,this.pendingHistory[e]=!0);let r=this.presenceInfo[e];return r&&(s.presence=r),s}recoverableClosure(){return!!this.sessionId}historyRequestFor(e){let s={},n=!1;if(this.subscriptionStreams[e])for(let r of this.subscriptionStreams[e]){let o=this.streamsPositions[r];o&&(n=!0,s[r]=o)}if(!(!n&&!this.restoreSince))return{since:this.restoreSince,streams:s}}trackStreamPosition(e,s,n,r){if(!(!s||!n))return this.subscriptionStreams[e]||(this.subscriptionStreams[e]=new Set),this.subscriptionStreams[e].add(s),this.streamsPositions[s]={epoch:n,offset:r},{stream:s,epoch:n,offset:r}}async sendPong(){await new Promise(e=>setTimeout(e,0)),this.cable.state==="connected"&&this.cable.send({command:"pong"})}async join(e,s){return this.presenceInfo[e]=s,this.cable.send({command:"join",identifier:e,presence:s}),Promise.resolve()}async leave(e,s){return delete this.presenceInfo[e],this.cable.send({command:"leave",identifier:e,presence:s}),Promise.resolve()}presence(e,s){return this.pendingPresence[e]?(this.logger.warn("presence is already pending, skipping",e),Promise.reject(Error("presence request is already pending"))):new Promise((n,r)=>{this.pendingPresence[e]={resolve:n,reject:r},this.cable.send({command:"presence",identifier:e,data:s})})}}class Or extends ye{constructor(){super("No connection","closed"),this.name="NoConnectionError"}}class at extends fs{constructor(e,s){super(s),this.channelId=e}set channelId(e){this._channelId=e}get channelId(){return this._channelId}}Ee(at,"identifier","__ghost__");const kr="$pubsub";class ct extends fs{async perform(e,s){if(e.startsWith("$"))return super.perform(e,s);throw Error("not implemented")}}Ee(ct,"identifier",kr);const oe=Symbol("state");let Rr=class{constructor({transport:t,protocol:e,encoder:s,logger:n,lazy:r,hubOptions:o,performFailures:i,transportConfigurator:a}){this.emitter=Ue(),this.transport=t,this.encoder=s,this.logger=n||new we,this.protocol=e,this.performFailures=i||"throw",this.protocol.attached(this),this.hub=new Tr(o||{}),this[oe]="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,r===!1&&this.connect().catch(()=>{})}get state(){return this[oe]}async connect(){if(this.state==="connected")return Promise.resolve();if(this.state==="connecting")return this.pendingConnect();let t=this.state==="idle";this[oe]="connecting";let e=this.pendingConnect();this.logger.debug("connecting");try{this.transportConfigurator&&await this.transportConfigurator(this.transport,{initial:t}),await this.transport.open()}catch(s){this.handleClose(s)}return e}setSessionId(t){this.sessionId=t,this.transport.setParam("sid",t)}connected(){if(this.state==="connected")return;this.logger.info("connected"),this[oe]="connected",this.recovering&&this.hub.subscriptions.all().forEach(e=>e.notify("disconnected",new K("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[oe]="connected",this.hub.subscriptions.all().forEach(n=>{t&&n.remoteId&&t.includes(n.remoteId)?n.notify("restored"):(n.notify("disconnected",new K("recovery_failed")),this._resubscribe(n))});let e=!this.initialConnect,s=!0;this.recovering=!1,this.initialConnect=!1,this.emit("connect",{reconnect:e,restored:s})}notify(t,e,s){e&&typeof e!="string"&&(s=e,e=void 0),e?this.hub.notify(e,"info",{type:t,data:s}):this.emit("info",{type:t,data:s})}handleClose(t){this.logger.debug("transport closed",{error:t}),this.disconnected(new K(t,"transport_closed"))}disconnected(t){(this.state==="connected"||this.state==="connecting")&&(this.logger.info("disconnected",{reason:t}),this[oe]="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 K?t:new K(t,void 0)),this.logger.info("closed",{reason:t||"user"}),this[oe]="closed";let s=e||new K("cable_closed");this.hub.subscriptions.all().forEach(n=>n.notify("disconnected",s)),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 s=this.protocol.receive(e);if(s){this.logger.debug("processed incoming message",s);let{type:n,identifier:r,message:o,meta:i}=s;n?this.hub.notify(r,n,o):this.hub.transmit(r,o,i)}}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 ct({stream_name:t});return this.subscribe(e)}streamFromSigned(t){let e=new ct({signed_stream_name:t});return this.subscribe(e)}subscribeTo(t,e){let s,n;return typeof t=="string"&&(n=t,t=at),s=n?new t(n,e):new t(e),this.subscribe(s)}subscribe(t){if(!t.attached(this))return t;let e=t.identifier;t.connecting();let s=this.hub.subscriptions.get(e)||this.hub.subscriptions.create(e,{subscribe:n=>this._subscribe(n,t.channelId,t.params),unsubscribe:n=>this._unsubscribe(n)});return s.add(t),s.intent==="subscribed"&&s.state==="connected"&&t.connected(),s.ensureSubscribed(),t}async _resubscribe(t){t.intent!=="subscribed"||!t.channels[0]||(t.notify("connecting"),t.ensureResubscribed())}async _subscribe(t,e,s){let n=t.id;if(this.state==="idle"&&this.connect().catch(()=>{}),this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:n});return}this.logger.debug("acquiring subscribe lock",{identifier:n});let r=await t.acquire("subscribed");if(r.canceled){this.logger.debug("subscribe lock has been canceled",{identifier:n}),r.release();return}if(this.logger.debug("subscribe lock has been acquired",{identifier:n}),t.intent!=="subscribed"){this.logger.debug("cancel subscribe request, already unsubscribed"),r.release();return}if(this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:n}),r.release();return}if(t.state==="connected"){this.logger.debug("already connected, skip subscribe command",{identifier:n}),t.notify("connected"),r.release();return}let o={identifier:e,params:s};this.logger.debug("subscribing",o);try{let i=await this.protocol.subscribe(e,s);this.hub.subscribe(n,i),this.logger.debug("subscribed",{...o,remoteId:i}),t.notify("connected")}catch(i){if(i){if(i instanceof ot&&this.logger.warn("rejected",o),i instanceof K){this.logger.debug("disconnected during subscription; will retry on connect",o),r.release();return}this.logger.error("failed to subscribe",{error:i,...o})}t.close(i),this.hub.unsubscribe(n)}r.release()}unsubscribe(t){let e=t.identifier,s=this.hub.subscriptions.get(e);if(!s)throw Error(`Subscription not found: ${e}`);s.remove(t),t.closed(),s.maybeUnsubscribe()}async _unsubscribe(t){let e=t.id;this.logger.debug("acquiring unsubscribe lock",{identifier:e});let s=await t.acquire("unsubscribed");if(s.canceled){this.logger.debug("unsubscribe lock has been canceled",{identifier:e}),s.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}),s.release();return}if(t.state==="disconnected"||t.state==="closed"){this.logger.debug(`already ${t.state} connected, skip unsubscribe command`,{identifier:e}),s.release();return}let n=t.remoteId;if(this.logger.debug("unsubscribing...",{remoteId:n}),this.state!=="connected"){this.logger.debug("unsubscribe skipped (cable is not connected)",{id:e}),t.close(),this.hub.unsubscribe(e),s.release();return}try{await this.protocol.unsubscribe(n),this.logger.debug("unsubscribed remotely",{id:e})}catch(r){r&&(r instanceof K?this.logger.debug("cable disconnected during the unsubscribe command execution",{id:e,error:r}):this.logger.error("unsubscribe failed",{id:e,error:r}))}t.intent==="unsubscribed"?(t.close(),this.hub.unsubscribe(e)):t.state="closed",s.release()}async perform(t,e,s){if(this.performFailures==="throw")return this._perform(t,e,s);try{return await this._perform(t,e,s)}catch(n){this.performFailures==="warn"&&this.logger.warn("perform failed",{error:n});return}}async _perform(t,e,s){if(this.state==="connecting"&&await this.pendingConnect(),this.state==="closed"||this.state==="disconnected")throw new Or;let n=this.hub.subscriptions.get(t);if(!n)throw Error(`Subscription not found: ${t}`);if(await n.pending("subscribed"),n.intent!=="subscribed")throw Error(`Subscription is closed: ${t}`);let r=n.remoteId,o={id:r,action:e,payload:s};this.logger.debug("perform",o);try{let i=await this.protocol.perform(r,e,s);return i&&this.logger.debug("perform result",{message:i,request:o}),i}catch(i){throw this.logger.error("perform failed",{error:i,request:o}),i}}on(t,e){return this.emitter.on(t,e)}once(t,e){let s=this.emitter.on(t,(...n)=>{s(),e(...n)});return s}emit(t,...e){return this.emitter.emit(t,...e)}pendingConnect(){return this._pendingConnect?this._pendingConnect:(this._pendingConnect=new Promise((t,e)=>{let s=[()=>delete this._pendingConnect];s.push(this.on("connect",()=>{s.forEach(n=>n()),t()})),s.push(this.on("close",n=>{s.forEach(r=>r()),e(n)})),s.push(this.on("disconnect",n=>{s.forEach(r=>r()),e(n)}))}),this._pendingConnect)}};const Ar={maxMissingPings:2,maxReconnectAttempts:1/0},he=()=>Date.now(),_s=(t,e)=>{e=e||{};let{backoffRate:s,jitterRatio:n,maxInterval:r}=e;return s=s||2,n===void 0&&(n=.5),o=>{let i=t*s**o,a=i*s,c=i+(a-i)*Math.random(),u=2*(Math.random()-.5)*n;return c=c*(1+u),r&&r<c&&(c=r),c}};let ys=class{constructor({pingInterval:t,...e}){if(this.pingInterval=t,!this.pingInterval)throw Error(`Incorrect pingInterval is provided: ${t}`);if(e=Object.assign({},Ar,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 we,this.state="pending_connect",this.attempts=0,this.disconnectedAt=he()}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=he(),this.state="connected",this.cancelReconnect(),this.startPolling()})),this.unbind.push(this.target.on("disconnect",()=>{this.disconnectedAt=he(),this.state="disconnected",this.stopPolling(),this.scheduleReconnect()})),this.unbind.push(this.target.on("close",()=>{this.disconnectedAt=he(),this.state="closed",this.cancelReconnect(),this.stopPolling()})),this.unbind.push(this.target.on("keepalive",()=>{this.pingedAt=he()})),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=he()-this.pingedAt;t>this.maxMissingPings*this.pingInterval&&(this.logger.warn(`Stale connection: ${t}ms without pings`),this.state="pending_disconnect",this.target.disconnected(new _r))}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 Pr{constructor(e,s={}){this.transports=e,this.transport=null,this.emitter=Ue(),this.unbind=[],this.logger=s.logger||new we}displayName(){return"fallbacked transport"}async open(){for(let e=0;e<this.transports.length;e++){let s=this.transports[e];try{this.transport=s,this.resetListeners(),this.logger.debug(`Trying to connect via ${s.displayName()}`),await s.open(),this.logger.debug(`Connected via ${s.displayName()}`);return}catch(n){this.logger.debug(`Failed to connect via ${s.displayName()}: ${n.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,s){this.transports.forEach(n=>{n.setParam(e,s)})}setToken(e,s){this.transports.forEach(n=>{n.setToken(e,s)})}on(e,s){return this.emitter.on(e,s)}once(e,s){let n=this.emitter.on(e,(...r)=>{n(),s(...r)});return n}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 Ir{constructor(e,s={}){this.url=e;let n=s.websocketImplementation;if(n)this.Impl=n;else if(typeof WebSocket<"u")this.Impl=WebSocket;else throw new Error("No WebSocket support");this.connected=!1,this.emitter=Ue();let{format:r,subprotocol:o,authStrategy:i}=s;this.format=r||"text",this.connectionOptions=s.websocketOptions,this.authStrategy=i||"param",this.authProtocol="",this.subprotocol=o}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((s,n)=>{let r=[];r.push(this.once("open",()=>{r.forEach(o=>o()),s()})),r.push(this.once("close",()=>{r.forEach(o=>o()),n(Error("WS connection closed"))}))})}setURL(e){this.url=e}setParam(e,s){let n=new URL(this.url);n.searchParams.set(e,s);let r=`${n.protocol}//${n.host}${n.pathname}?${n.searchParams}`;this.setURL(r)}setToken(e,s="jid"){if(this.authStrategy==="param")this.setParam(s,e);else if(this.authStrategy==="header"){this.connectionOptions=this.connectionOptions||{},this.connectionOptions.headers=this.connectionOptions.headers||{};let n=`x-${s}`.toLowerCase();n=Object.keys(this.connectionOptions.headers).find(r=>r.toLowerCase()===n)||n,this.connectionOptions.headers[n]=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,s){return this.emitter.on(e,s)}once(e,s){let n=this.emitter.on(e,(...r)=>{n(),s(...r)});return n}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 s=e.data;this.format==="binary"&&(s=new Uint8Array(s)),this.emitter.emit("data",s)},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")}}const ws={protocol:"actioncable-v1-json",pingInterval:3e3,maxReconnectAttempts:1/0,maxMissingPings:2,logLevel:"warn",lazy:!0};function Dr(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({},ws,e);let{protocol:s,websocketImplementation:n,websocketFormat:r,websocketOptions:o,websocketAuthStrategy:i,fallbacks:a,logLevel:c,logger:u,transport:d,encoder:b,lazy:y,monitor:p,pingInterval:m,reconnectStrategy:h,maxMissingPings:E,maxReconnectAttempts:x,subprotocol:T,tokenRefresher:_,historyTimestamp:O,protocolOptions:R,concurrentSubscribes:L,performFailures:j,transportConfigurator:Z,auth:$}=e;if(u=u||new we(c),typeof s=="string"){T=T||s;let w=s.substring(0,s.lastIndexOf("-")),I=s.substring(s.lastIndexOf("-")+1);if(R=R||{},w==="actioncable-v1")s=new gs({logger:u,...R});else if(w==="actioncable-v1-ext")s=new xr({logger:u,historyTimestamp:O,...R});else throw Error(`Protocol is not supported yet: ${s}`);if(I==="json")b=b||new Er,r=r||"text";else if(I==="msgpack"){if(r="binary",!b)throw Error("Msgpack encoder must be specified explicitly. Use `@anycable/msgpack-encoder` package or build your own")}else if(I==="protobuf"){if(r=r||"binary",!b)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: ${s}`)}if(!s)throw Error("Protocol must be specified");d=d||new Ir(t,{websocketImplementation:n,websocketOptions:o,subprotocol:T,authStrategy:i,format:r}),a&&(d=new Pr([d,...a],{logger:u})),$&&$.token&&d.setToken($.token,$.param||"jid"),h=h||_s(m),p!==!1&&(p=p||new ys({pingInterval:m,reconnectStrategy:h,maxMissingPings:E,maxReconnectAttempts:x,logger:u}));let te={concurrentSubscribes:L},z=new Rr({protocol:s,transport:d,encoder:b,logger:u,lazy:y,hubOptions:te,performFailures:j,transportConfigurator:Z});return p&&(p.watch(z),z.monitor=p),_&&Nr(z,async()=>{try{await _(d)}catch(w){return u.error("Failed to refresh authentication token: "+w),!1}return z.connect().catch(()=>{}),!0}),z}function Nr(t,e){let s=!1;t.on("connect",()=>s=!1),t.on("close",async n=>{if(n){if(s){t.logger.warn("Token auto-refresh is disabled",n);return}n.reason==="token_expired"&&(s=!0,await e())}})}class jr{constructor(e){this.channel=e}notify(e,...s){typeof this[e]=="function"&&this[e](...s)}perform(e,s={}){this.channel.perform(e,s)}send(e){this.channel.send(e)}get identifier(){return this.channel.identifier}unsubscribe(){return this.channel.disconnect()}}class Ur extends at{constructor(e,s,n){super(e,s),this.subscription=new jr(this),Object.assign(this.subscription,n),this.on("connect",({reconnect:r})=>this.subscription.notify("connected",{reconnected:r})),this.on("disconnect",()=>this.subscription.notify("disconnected",{allowReconnect:!0})),this.on("message",r=>this.subscription.notify("received",r)),this.on("close",r=>{r&&r instanceof ot?this.subscription.notify("rejected"):this.subscription.notify("disconnected",{allowReconnect:!1})})}}class Mr{constructor(e){this.cable=e}create(e,s){let n,r;typeof e=="object"?(n=e.channel,delete e.channel,r=e):(n=e,r={});let o=new Ur(n,r,s);return o.subscription.notify("initialized"),this.cable.subscribe(o),o.subscription}findAll(e){return this.cable.hub.channels.filter(s=>s.identifier===e).map(s=>s.subscription)}}class Lr{constructor(e){this.cable=e,this.subscriptions=new Mr(e)}}class Fr extends ms{writeLogEntry(e,s,n){n?console[e](s,n):console[e](s)}}class Vr extends ys{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")},s=r=>{this.reconnectNow()&&this.logger.debug("Trigger reconnect",{event:r})},n=()=>this.disconnect(new K("page_frozen"));document.addEventListener("visibilitychange",e,!1),window.addEventListener("focus",s,!1),window.addEventListener("online",s,!1),window.addEventListener("resume",s,!1),window.addEventListener("freeze",n,!1),this.unbind.push(()=>{document.removeEventListener("visibilitychange",e,!1),window.removeEventListener("focus",s,!1),window.removeEventListener("online",s,!1),window.removeEventListener("resume",s,!1),window.removeEventListener("freeze",n,!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 qr=["cable","action-cable"],$r="/cable",Me=(t,e)=>{for(let s of qr){let n=t.head.querySelector(`meta[name='${s}-${e}']`);if(n)return n.getAttribute("content")}},vs=t=>t.match(/wss?:\/\//)?t:typeof window<"u"?`${window.location.protocol.replace("http","ws")}//${window.location.host}${t}`:t,Br=()=>{if(typeof document<"u"&&document.head){let t=Me(document,"url");if(t)return vs(t)}return vs($r)},Hr=()=>{if(typeof document<"u"&&document.head){let t=Me(document,"history-timestamp");if(t)return t|0}},zr=()=>{if(typeof document<"u"&&document.head)return Me(document,"token")},Wr=()=>{if(typeof document<"u"&&document.head)return Me(document,"token-param")};function Jr(t,e){typeof t=="object"&&typeof e>"u"&&(e=t,t=void 0),t=t||Br(),e=e||{},e.historyTimestamp||(e.historyTimestamp=Hr());let s=zr();if(s){let u=Wr();e.auth=Object.assign({token:s,param:u},e.auth||{})}e=Object.assign({},ws,e);let{logLevel:n,logger:r,pingInterval:o,reconnectStrategy:i,maxMissingPings:a,maxReconnectAttempts:c}=e;return r=e.logger=e.logger||new Fr(n),i=e.reconnectStrategy=e.reconnectStrategy||_s(o),e.monitor!==!1&&(e.monitor=e.monitor||new Vr({pingInterval:o,reconnectStrategy:i,maxMissingPings:a,maxReconnectAttempts:c,logger:r})),Dr(t,e)}function Kr(t,e){let s=Jr(t,e);return new Lr(s)}class Zr{constructor(e="/openc3-api/cable"){this._cable=null,this._url=e}disconnect(){this._cable&&(this._cable.cable.disconnect(),this._cable=null)}createSubscription(e,s,n={},r={}){return OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity).then(o=>{if(o&&OpenC3Auth.setTokens(),this._cable==null){let i=this._url+"?scope="+encodeURIComponent(s)+"&authorization="+encodeURIComponent(localStorage.openc3Token);i=new URL(i,document.baseURI).href,this._cable=Kr(i)}return this._cable.subscriptions.create({channel:e,...r},n)})}recordPing(){}}function ve(t){return Gr.test(t)}const Gr=/^-?[0-9]+$/;function Ss(t){return Xr.test(t)}const Xr=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function Ts(t,e){if(ve(t))return Number.isSafeInteger(Number.parseInt(t,10));const s=Number.parseFloat(t),n=String(s);if(t===n)return!0;const r=Es(t),o=Es(n);return!!(r===o||(e==null?void 0:e.approx)===!0&&!ve(t)&&o.length>=14&&r.startsWith(o.substring(0,14)))}let Se=function(t){return t.underflow="underflow",t.overflow="overflow",t.truncate_integer="truncate_integer",t.truncate_float="truncate_float",t}({});function Qr(t){if(Ts(t,{approx:!1}))return;if(ve(t))return Se.truncate_integer;const e=Number.parseFloat(t);return Number.isFinite(e)?e===0?Se.underflow:Se.truncate_float:Se.overflow}function Es(t){const{start:e,end:s}=Yr(t),n=t.substring(e,s),r=n.indexOf(".");return r===-1?n:n.substring(0,r)+n.substring(r+1)}function Yr(t){let e=0;for(t[0]==="-"&&e++;t[e]==="0"||t[e]===".";)e++;let s=t.lastIndexOf("e");for(s===-1&&(s=t.lastIndexOf("E")),s===-1&&(s=t.length);(t[s-1]==="0"||t[s-1]===".")&&s>e;)s--;return{start:e,end:s}}class ei{constructor(e){if(Ee(this,"isLosslessNumber",!0),!Ss(e))throw new Error(`Invalid number (value: "${e}")`);this.value=e}valueOf(){const e=Qr(this.value);if(e===void 0||e===Se.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 ti(t){return t&&typeof t=="object"&&t.isLosslessNumber||!1}function si(t){return new ei(t)}function ni(t,e){return lt({"":t},"",t,e)}function lt(t,e,s,n){return Array.isArray(s)?n.call(t,e,ii(s,n)):s&&typeof s=="object"&&!ti(s)?n.call(t,e,ri(s,n)):n.call(t,e,s)}function ri(t,e){for(const s of Object.keys(t)){const n=lt(t,s,t[s],e);n!==void 0?t[s]=n:delete t[s]}return t}function ii(t,e){for(let s=0;s<t.length;s++)t[s]=lt(t,String(s),t[s],e);return t}function oi(t,e,s){const n=typeof s=="function"?{parseNumber:s}:s,r=(n==null?void 0:n.parseNumber)??si,o=(n==null?void 0:n.onDuplicateKey)??j;let i=0;const a=d();return x(a),_(),e?ni(a,e):a;function c(){if(t.charCodeAt(i)===hi){i++,y();const v={};let A=!0;for(;i<t.length&&t.charCodeAt(i)!==xs;){A?A=!1:(h(),y());const W=i,Q=p();if(Q===void 0){L();return}y(),E();const H=d();if(H===void 0){w();return}if(Object.prototype.hasOwnProperty.call(v,Q)&&!ut(H,v[Q])){const Y=o({key:Q,position:W+1,oldValue:v[Q],newValue:H});Y!==void 0&&(v[Q]=Y)}else v[Q]=H}return t.charCodeAt(i)!==xs&&Z(),i++,v}}function u(){if(t.charCodeAt(i)===fi){i++,y();const v=[];let A=!0;for(;i<t.length&&t.charCodeAt(i)!==Os;){A?A=!1:h();const W=d();T(W),v.push(W)}return t.charCodeAt(i)!==Os&&$(),i++,v}}function d(){y();const v=p()??m()??c()??u()??b("true",!0)??b("false",!1)??b("null",null);return y(),v}function b(v,A){if(t.slice(i,i+v.length)===v)return i+=v.length,A}function y(){for(;ai(t.charCodeAt(i));)i++}function p(){if(t.charCodeAt(i)===dt){i++;let v="";for(;i<t.length&&t.charCodeAt(i)!==dt;){if(t.charCodeAt(i)===di){const A=t[i+1],W=ui[A];W!==void 0?(v+=W,i++):A==="u"?Le(t.charCodeAt(i+2))&&Le(t.charCodeAt(i+3))&&Le(t.charCodeAt(i+4))&&Le(t.charCodeAt(i+5))?(v+=String.fromCharCode(Number.parseInt(t.slice(i+2,i+6),16)),i+=5):I(i):z(i)}else li(t.charCodeAt(i))?v+=t[i]:te(t[i]);i++}return R(),i++,v}}function m(){const v=i;if(t.charCodeAt(i)===ks&&(i++,O(v)),t.charCodeAt(i)===ht)i++;else if(ci(t.charCodeAt(i)))for(i++;Fe(t.charCodeAt(i));)i++;if(t.charCodeAt(i)===vi)for(i++,O(v);Fe(t.charCodeAt(i));)i++;if(t.charCodeAt(i)===xi||t.charCodeAt(i)===Ci)for(i++,(t.charCodeAt(i)===ks||t.charCodeAt(i)===_i)&&i++,O(v);Fe(t.charCodeAt(i));)i++;if(i>v)return r(t.slice(v,i))}function h(){if(t.charCodeAt(i)!==wi)throw new SyntaxError(`Comma ',' expected after value ${N()}`);i++}function E(){if(t.charCodeAt(i)!==Si)throw new SyntaxError(`Colon ':' expected after property name ${N()}`);i++}function x(v){if(v===void 0)throw new SyntaxError(`JSON value expected ${N()}`)}function T(v){if(v===void 0)throw new SyntaxError(`Array item expected ${N()}`)}function _(){if(i<t.length)throw new SyntaxError(`Expected end of input ${N()}`)}function O(v){if(!Fe(t.charCodeAt(i))){const A=t.slice(v,i);throw new SyntaxError(`Invalid number '${A}', expecting a digit ${N()}`)}}function R(){if(t.charCodeAt(i)!==dt)throw new SyntaxError(`End of string '"' expected ${N()}`)}function L(){throw new SyntaxError(`Quoted object key expected ${N()}`)}function j(v){let{key:A,position:W}=v;throw new SyntaxError(`Duplicate key '${A}' encountered at position ${W}`)}function Z(){throw new SyntaxError(`Quoted object key or end of object '}' expected ${N()}`)}function $(){throw new SyntaxError(`Array item or end of array ']' expected ${N()}`)}function te(v){throw new SyntaxError(`Invalid character '${v}' ${B()}`)}function z(v){const A=t.slice(v,v+2);throw new SyntaxError(`Invalid escape character '${A}' ${B()}`)}function w(){throw new SyntaxError(`Object value expected after ':' ${B()}`)}function I(v){const A=t.slice(v,v+6);throw new SyntaxError(`Invalid unicode character '${A}' ${B()}`)}function B(){return`at position ${i}`}function qe(){return i<t.length?`but got '${t[i]}'`:"but reached end of input"}function N(){return`${qe()} ${B()}`}}function ai(t){return t===pi||t===mi||t===gi||t===bi}function Le(t){return t>=ht&&t<=ft||t>=Ti&&t<=Oi||t>=Ei&&t<=ki}function Fe(t){return t>=ht&&t<=ft}function ci(t){return t>=yi&&t<=ft}function li(t){return t>=32&&t<=1114111}function ut(t,e){return t===e?!0:Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((s,n)=>ut(s,e[n])):Cs(t)&&Cs(e)?[...new Set([...Object.keys(t),...Object.keys(e)])].every(s=>ut(t[s],e[s])):!1}function Cs(t){return typeof t=="object"&&t!==null}const ui={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
8
|
+
`,r:"\r",t:" "},di=92,hi=123,xs=125,fi=91,Os=93,pi=32,mi=10,gi=9,bi=13,dt=34,_i=43,ks=45,ht=48,yi=49,ft=57,wi=44,vi=46,Si=58,Ti=65,Ei=97,Ci=69,xi=101,Oi=70,ki=102;function Rs(t,e,s,n){return r(t);function r(c,u){if(Array.isArray(n)){const d=n.find(b=>b.test(c));if(d){const b=d.stringify(c);if(typeof b!="string"||!Ss(b))throw new Error(`Invalid JSON number: output of a number stringifier must be a string containing a JSON number (output: ${b})`);return b}}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!=null&&c.isLosslessNumber||typeof c=="bigint")return c.toString();if(Array.isArray(c))return o(c);if(c&&typeof c=="object")return i(c)}function o(c,u){if(c.length===0)return"[]";let d="[";for(let b=0;b<c.length;b++){const y=c[b];typeof y<"u"&&typeof y!="function"?d+=r(y):d+="null",b<c.length-1&&(d+=",")}return d+="]",d}function i(c,u){if(typeof c.toJSON=="function")return Rs(c.toJSON(),e,s,void 0);const d=Array.isArray(e)?e.map(String):Object.keys(c);if(d.length===0)return"{}";let b=!0,y="{";for(const p of d){const m=c[p];if(a(p,m)){b?b=!1:y+=",";const h=JSON.stringify(p);y+=`${h}:`,y+=r(m)}}return y+="}",y}function a(c,u){return typeof u<"u"&&typeof u!="function"&&typeof u!="symbol"}}function Ri(t){return ve(t)&&!Ts(t)?BigInt(t):parseFloat(t)}class Ai{constructor(){Ee(this,"id",1)}async exec(e,s,n={},r={},o=6e4){try{await OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity)&&OpenC3Auth.setTokens()}catch{OpenC3Auth.login()}this.id=this.id+1;try{return n.scope=window.openc3Scope,r.manual=!0,(await rt.post("/openc3-api/api",{jsonrpc:"2.0",method:e,params:s,id:this.id,keyword_params:n},{headers:{Authorization:localStorage.openc3Token,"Content-Type":"application/json-rpc",...r},timeout:o,transformRequest:[(i,a)=>Rs(i)],transformResponse:[i=>oi(i,void 0,Ri)]})).data.result}catch(i){let a=new Error;throw i.response?(a.name=i.response.data.error.data.class,a.message=i.response.data.error.data.message,a.object=i.response.data.error):i.request?(a.name="Request error",a.message="Request error, no response received"):a=i,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,s,n,r,o){return this.exec("map_target_to_interface",[e,s],{cmd_only:n,tlm_only:r,unmap_old:o})}unmap_target_from_interface(e,s,n,r){return this.exec("unmap_target_from_interface",[e,s],{cmd_only:n,tlm_only:r})}connect_interface(e,...s){return s.length>0?this.exec("connect_interface",[e,...s]):this.exec("connect_interface",[e])}disconnect_interface(e){return this.exec("disconnect_interface",[e])}interface_cmd(e,s,...n){return this.exec("interface_cmd",[e,s,...n])}interface_target_enable(e,s,n=!1,r=!1){return this.exec("interface_target_enable",[e,s],{cmd_only:n,tlm_only:r})}interface_target_disable(e,s,n=!1,r=!1){return this.exec("interface_target_disable",[e,s],{cmd_only:n,tlm_only:r})}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,s,n,r,o){return this.exec("map_target_to_router",[e,s],{cmd_only:n,tlm_only:r,unmap_old:o})}unmap_target_from_router(e,s,n,r){return this.exec("unmap_target_from_router",[e,s],{cmd_only:n,tlm_only:r})}connect_router(e){return this.exec("connect_router",[e])}disconnect_router(e){return this.exec("disconnect_router",[e])}router_target_enable(e,s,n=!1,r=!1){return this.exec("router_target_enable",[e,s],{cmd_only:n,tlm_only:r})}router_target_disable(e,s,n=!1,r=!1){return this.exec("router_target_disable",[e,s],{cmd_only:n,tlm_only:r})}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,s,n){return this.exec("get_item",[e,s,n])}get_param(e,s,n){return this.exec("get_param",[e,s,n])}get_parameter(e,s,n){return this.exec("get_param",[e,s,n])}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])}get_target(e){return this.exec("get_target",[e])}get_target_names(){return this.exec("get_target_names",[])}get_target_list(){return this.exec("get_target_names",[])}get_tlm(e,s){return this.exec("get_tlm",[e,s])}get_telemetry(e,s){return this.exec("get_tlm",[e,s])}get_all_tlm(e){return this.exec("get_all_tlm",[e])}get_all_telemetry(e){return this.exec("get_all_tlm",[e])}get_all_tlm_names(e,s=!1){return this.exec("get_all_tlm_names",[e],{hidden:s})}get_all_telemetry_names(e){return this.exec("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,s,n,r=30){const o=await this.exec("get_tlm_packet",[e,s],{type:n,stale_time:r});if(o!=null){let i=o.length,a=null;for(let c=0;c<i;c++)a=this.decode_openc3_type(o[c][1]),a!==null&&(o[c][1]=a)}return o}get_packet_derived_items(e,s){return this.exec("get_packet_derived_items",[e,s])}get_tlm_buffer(e,s){return this.exec("get_tlm_buffer",[e,s])}get_tlm_available(e){return this.exec("get_tlm_available",[e])}async get_tlm_values(e,s=30,n=null,r=null,o=null){let i={stale_time:s};n!==null&&(i.cache_timeout=n),r!==null&&(i.start_time=r.toISOString()),o!==null&&(i.end_time=o.toISOString());const a=await this.exec("get_tlm_values",[e],i,{},1e4);if(a&&a.length>0){let c=a.length,u=null;for(let d=0;d<c;d++)u=this.decode_openc3_type(a[d][0]),u!==null&&(a[d][0]=u)}return a}get_limits(e,s,n){return this.exec("get_limits",[e,s,n])}async tlm(e,s,n,r="CONVERTED"){let o=null;if(s===void 0)o=await this.exec("tlm",[e]);else if(n===void 0)if(["RAW","CONVERTED","FORMATTED","WITH_UNITS"].includes(s))o=await this.exec("tlm",[e],{type:s});else{let a=new Error;throw a.name="TypeError",a.message=`Invalid data type ${s}. Valid options are RAW, CONVERTED, FORMATTED, and WITH_UNITS.`,a}else o=await this.exec("tlm",[e,s,n],{type:r});let i=this.decode_openc3_type(o);return i!==null&&(o=i),o}async inject_tlm(e,s,n=null,r="CONVERTED"){await this.exec("inject_tlm",[e,s,n],{type:r})}set_tlm(e,s,n,r){return this.exec("set_tlm",[e,s,n],{type:r})}override_tlm(e,s,n,r){return this.exec("override_tlm",[e,s,n],{type:r})}get_overrides(){return this.exec("get_overrides")}normalize_tlm(e,s,n,r){return this.exec("normalize_tlm",[e,s,n],{type:r})}get_all_cmds(e){return this.exec("get_all_cmds",[e])}get_all_commands(e){return this.exec("get_all_cmds",[e])}get_all_cmd_names(e,s=!1){return this.exec("get_all_cmd_names",[e],{hidden:s})}get_all_command_names(e){return this.exec("get_all_cmd_names",[e])}get_cmd(e,s){return this.exec("get_cmd",[e,s])}get_command(e,s){return this.exec("get_cmd",[e,s])}get_cmd_cnts(e){return this.exec("get_cmd_cnts",[e])}get_cmd_value(e,s,n,r="CONVERTED"){return this.exec("get_cmd_value",[e,s,n,r])}get_cmd_buffer(e,s){return this.exec("get_cmd_buffer",[e,s])}_cmd(e,s,n,r,o,i={}){let a=null;for(let c in r)Object.prototype.hasOwnProperty.call(r,c)&&(a=this.encode_openc3_type(r[c]),a!==null&&(r[c]=a));return this.exec(e,[s,n,r],i,o)}get_cmd_hazardous(e,s,n,r={}){return s===void 0?this.exec("get_cmd_hazardous",e,{},r):this._cmd("get_cmd_hazardous",e,s,n,r)}cmd(e,s,n,r={},o={}){return s===void 0?this.exec("cmd",e,o,r):this._cmd("cmd",e,s,n,r,o)}cmd_no_range_check(e,s,n,r={},o={}){return s===void 0?this.exec("cmd_no_range_check",e,o,r):this._cmd("cmd_no_range_check",e,s,n,r,o)}cmd_raw(e,s,n,r={},o={}){return s===void 0?this.exec("cmd_raw",e,o,r):this._cmd("cmd_raw",e,s,n,r,o)}cmd_raw_no_range_check(e,s,n,r={},o={}){return s===void 0?this.exec("cmd_raw_no_range_check",e,o,r):this._cmd("cmd_raw_no_range_check",e,s,n,r,o)}cmd_no_hazardous_check(e,s,n,r={},o={}){return s===void 0?this.exec("cmd_no_hazardous_check",e,o,r):this._cmd("cmd_no_hazardous_check",e,s,n,r,o)}cmd_no_checks(e,s,n,r={},o={}){return s===void 0?this.exec("cmd_no_checks",e,o,r):this._cmd("cmd_no_checks",e,s,n,r,o)}cmd_raw_no_hazardous_check(e,s,n,r={},o={}){return s===void 0?this.exec("cmd_raw_no_hazardous_check",e,o,r):this._cmd("cmd_raw_no_hazardous_check",e,s,n,r,o)}cmd_raw_no_checks(e,s,n,r={},o={}){return s===void 0?this.exec("cmd_raw_no_checks",e,o,r):this._cmd("cmd_raw_no_checks",e,s,n,r,o)}build_cmd(e,s,n,r={},o={}){return s===void 0?this.exec("build_cmd",e,o,r):this._cmd("build_cmd",e,s,n,r,o)}build_command(e,s,n,r={},o={}){return s===void 0?this.exec("build_cmd",e,o,r):this._cmd("build_cmd",e,s,n,r,o)}get_interface_names(){return this.exec("get_interface_names",[])}get_router_names(){return this.exec("get_router_names",[])}send_raw(e,s){return this.exec("send_raw",[e,s])}list_configs(e){return this.exec("list_configs",[e])}load_config(e,s){return this.exec("load_config",[e,s])}save_config(e,s,n){return this.exec("save_config",[e,s,n])}delete_config(e,s){return this.exec("delete_config",[e,s])}enable_limits(e,s,n){return this.exec("enable_limits",[e,s,n])}disable_limits(e,s,n){return this.exec("disable_limits",[e,s,n])}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,s){return this.exec("get_setting",[e],s)}get_settings(e,s){return this.exec("get_settings",e,s)}set_setting(e,s){return this.exec("set_setting",[e,s])}update_news(){return this.exec("update_news",[])}update_plugin_store(){return this.exec("update_plugin_store",[])}save_setting(e,s){return this.exec("set_setting",[e,s])}get_metrics(){return this.exec("get_metrics",[])}async hashString(e){if(window.isSecureContext){const s=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",s),r=new Uint8Array(n);return Array.from(r).map(o=>o.toString(16).padStart(2,"0")).join("")}}}let Ve=[];const Pi={components:{OpenC3TimePicker:Ct,OpenConfigDialog:wt,SaveConfigDialog:yt,TargetPacketItemChooser:Et,TopBar:Ms},mixins:[bt,_t],data(){return{title:"Data Extractor",configKey:"data_extractor",openConfig:!1,saveConfig:!1,api:null,timeZone:"local",progress:0,packetsReceived:0,totalPacketsReceived:0,itemsReceived:0,totalItemsReceived:0,processButtonText:"Process",todaysDate:null,startDate:null,startTime:null,endTime:null,endDate:null,startDateTime:null,endDateTime:null,startDateTimeFilename:"",rules:{required:t=>!!t||"Required"},cmdOrTlm:"tlm",items:[],search:"",headers:[{title:"Target",value:"targetName"},{title:"Packet",value:"packetName"},{title:"Item",value:"itemName"},{title:"Mode",value:"mode"},{title:"ValueType",value:"valueType"},{title:"ReducedType",value:"reducedType"},{title:"Edit",value:"edit"},{title:"Delete",value:"delete"}],itemsPerPage:20,columnMap:{},delimiter:",",columnMode:"normal",fileCount:0,skipIgnored:!0,fillDown:!1,matlabHeader:!1,uniqueOnly:!1,keyMap:{},modes:["DECOM","REDUCED_MINUTE","REDUCED_HOUR","REDUCED_DAY"],valueTypes:["CONVERTED","RAW","FORMATTED","WITH_UNITS"],reducedTypes:["SAMPLE","MIN","MAX","AVG","STDDEV"],editAll:!1,allItemMode:"DECOM",allItemValueType:"CONVERTED",allItemReducedType:"SAMPLE",cable:new Zr,subscription:null,enterprise:!1}},computed:{hasCommands:function(){return this.items.some(t=>t.cmdOrTlm==="CMD")},menus:function(){return[{label:"File",items:[{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.resetConfig(),this.resetConfigBase()}},{divider:!0},{radioGroup:!0,value:this.delimiter,command:t=>{this.delimiter=t},choices:[{label:"Comma Delimited",value:","},{label:"Tab Delimited",value:" "}]}]},{label:"Mode",items:[{label:"Fill Down",checkbox:!0,checked:this.fillDown,command:()=>{this.fillDown=!this.fillDown}},{label:"Matlab Header",checkbox:!0,checked:this.matlabHeader,command:t=>{this.matlabHeader=!this.matlabHeader}},{label:"Unique Only",checkbox:!0,checked:this.uniqueOnly,command:t=>{this.uniqueOnly=!this.uniqueOnly}},{divider:!0},{radioGroup:!0,value:this.columnMode,command:t=>{this.columnMode=t},choices:[{label:"Normal Columns",value:"normal"},{label:"Full Column Names",value:"full"}]}]}]},currentConfig:function(){return{delimiter:this.delimiter,fillDown:this.fillDown,matlabHeader:this.matlabHeader,uniqueOnly:this.uniqueOnly,columnMode:this.columnMode,cmdOrTlm:this.cmdOrTlm,items:this.items,itemsPerPage:this.itemsPerPage}}},watch:{delimiter:function(){this.saveDefaultConfig(this.currentConfig)},fillDown:function(){this.saveDefaultConfig(this.currentConfig)},matlabHeader:function(){this.saveDefaultConfig(this.currentConfig)},uniqueOnly:function(){this.saveDefaultConfig(this.currentConfig)},columnNode:function(){this.saveDefaultConfig(this.currentConfig)},cmdOrTlm:function(){this.items.length===0?this.saveDefaultConfig(this.currentConfig):this.items=[]},items:{handler:function(){this.saveDefaultConfig(this.currentConfig)},deep:!0},itemsPerPage:function(){this.saveDefaultConfig(this.currentConfig)}},async created(){this.api=new Ai,await this.api.get_setting("time_zone").then(e=>{e&&(this.timeZone=e)}).catch(e=>{}),await gr.get("/openc3-api/info").then(e=>{e.data.enterprise&&(this.enterprise=!0)});let t=new Date;this.todaysDate=this.formatDate(t,this.timeZone),this.startDate=this.formatDate(t-36e5,this.timeZone),this.startTime=this.formatTimeHMS(t-36e5,this.timeZone),this.endTime=this.formatTimeHMS(t,this.timeZone),this.endDate=this.formatDate(t,this.timeZone)},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.applyConfig(t)}},unmounted:function(){this.subscription&&this.subscription.unsubscribe(),this.cable.disconnect()},methods:{resetConfig:function(){this.delimiter=",",this.fillDown=!1,this.matlabHeader=!1,this.uniqueOnly=!1,this.columnMode="normal";let t=new Date;this.startDate=this.formatDate(t-36e5,this.timeZone),this.startTime=this.formatTimeHMS(t-36e5,this.timeZone),this.endTime=this.formatTimeHMS(t,this.timeZone),this.endDate=this.formatDate(t,this.timeZone),this.cmdOrTlm="tlm",this.items=[],this.itemsPerPage=20,this.applyConfig(this.currentConfig)},applyConfig:function(t){this.delimiter=t.delimiter||",",this.menus[0].radioGroup=this.delimiter===","?"Comma Delimited":"Tab Delimited",this.fillDown=t.fillDown,this.menus[1].items[0].checked=this.fillDown||!1,this.matlabHeader=t.matlabHeader,this.menus[1].items[1].checked=this.matlabHeader||!1,this.uniqueOnly=t.uniqueOnly,this.menus[1].items[2].checked=this.uniqueOnly||!1,this.columnMode=t.columnMode,this.menus[1].radioGroup=this.columnMode==="normal"?"Normal Columns":"Full Column Names",this.cmdOrTlm=t.cmdOrTlm,this.items=t.items,this.itemsPerPage=t.itemsPerPage},openConfiguration:function(t,e=!1){this.openConfigBase(t,e,s=>{this.applyConfig(s),this.startDate=s.startDate,this.startTime=s.startTime,this.endTime=s.endTime,this.endDate=s.endDate,this.saveDefaultConfig(this.currentConfig)})},saveConfiguration:function(t){let e=this.currentConfig;e.startDate=this.startDate,e.startTime=this.startTime,e.endTime=this.endTime,e.endDate=this.endDate,this.saveConfigBase(t,e)},addItem:function(t){for(const e of this.items)if(e.itemName===t.itemName&&e.packetName===t.packetName&&e.targetName===t.targetName&&e.valueType==="CONVERTED"&&e.reducedType==="SAMPLE"&&e.mode==="DECOM"){this.$notify.caution({body:"This item has already been added!"});return}t.cmdOrTlm=this.cmdOrTlm.toUpperCase(),t.edit=!1,t.valueType="CONVERTED",t.reducedType="SAMPLE",t.mode="DECOM",this.items.push(t)},deleteItem:function(t){let e=this.items.indexOf(t);this.items.splice(e,1)},deleteAll:function(){this.items=[]},editAllItems:function(){this.editAll=!1;for(let t of this.items)t.mode=this.allItemMode,t.valueType=this.allItemValueType,t.reducedType=this.allItemReducedType},getItemLabel:function(t){let e=[`${t.targetName} - ${t.packetName} - ${t.itemName}`];return t.mode!=="DECOM"&&e.push(`{ ${t.mode} }`),t.valueType!=="CONVERTED"&&e.push(`( ${t.valueType} )`),t.reducedType!=="SAMPLE"&&e.push(`[ ${t.reducedType} ]`),e.join(" ")},setTimestamps:function(){this.startDateTimeFilename=this.startDate+"_"+this.startTime,this.startDateTimeFilename=this.startDateTimeFilename.replace(/(:|-|\.)\s*/g,"_");let t,e;try{this.timeZone==="local"?(t=new Date(this.startDate+" "+this.startTime),e=new Date(this.endDate+" "+this.endTime)):(t=new Date(this.startDate+" "+this.startTime+"Z"),e=new Date(this.endDate+" "+this.endTime+"Z"),this.startDateTimeFilename+="_UTC")}catch{return}this.startDateTime=t.getTime()*1e6,this.endDateTime=e.getTime()*1e6},processItems:function(){if(this.processButtonText==="Cancel"){this.finished();return}if(this.setTimestamps(),!this.startDateTime||!this.endDateTime){this.$notify.caution({body:"Invalid date/time selected!"});return}if(this.startDateTime===this.endDateTime){this.$notify.caution({body:"Start date/time is equal to end date/time!"});return}if(this.endDateTime-this.startDateTime<0){this.$notify.caution({body:"Start date/time is greater then end date/time!"});return}new Date(this.endDateTime/1e6)>Date.now()&&this.$notify.caution({title:"Note",body:`End date/time is greater than current date/time. Data will
|
|
9
9
|
continue to stream in real-time until
|
|
10
|
-
${new Date(this.endDateTime/1e6).toISOString()} is reached.`}),this.progress=0,this.processButtonText="Cancel",this.cable.createSubscription("StreamingChannel",window.openc3Scope,{received:t=>this.received(t),connected:()=>this.onConnected(),disconnected:t=>{t.allowReconnect&&this.$notify.caution({body:"OpenC3 backend connection disconnected."})},rejected:()=>{this.$notify.caution({body:"OpenC3 backend connection rejected."})}}).then(t=>{this.subscription=t})},resetAllVars:function(){this.fileCount=0,this.totalPacketsReceived=0,this.totalItemsReceived=0,this.columnHeaders=[],this.columnMap={},this.keyMap={},this.resetPerFileVars()},resetPerFileVars:function(){Ve=[],this.packetsReceived=0,this.itemsReceived=0},onConnected:function(){this.resetAllVars();let t=[];this.items.forEach((e,s)=>{let n=`${e.mode}__${e.cmdOrTlm}__${e.targetName}__${e.packetName}__${e.itemName}__${e.valueType}`;e.reducedType!=="SAMPLE"&&(n=n+"__"+e.reducedType);let r=String(s);this.keyMap[r]=n,t.push([n,r])}),OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity).then(e=>{e&&OpenC3Auth.setTokens(),this.subscription.perform("add",{scope:window.openc3Scope,token:localStorage.openc3Token,items:t,start_time:this.startDateTime,end_time:this.endDateTime})})},received:function(t){if(this.cable.recordPing(),t.error){this.$notify.serious({body:t.error});return}if(this.packetsReceived+=t.length,this.totalPacketsReceived+=t.length,t.length>0){let e=new Set;for(let r of t){let o=Object.keys(r);o.forEach(e.add,e);let i=o.filter(a=>a.startsWith("__")).length;this.itemsReceived+=o.length-i,this.totalItemsReceived+=o.length-i}e.delete("__type"),e.delete("__time"),e.delete("__extra"),this.buildHeaders([...e]),Ve.push(t),this.progress=Math.ceil(100*(t[0].__time-this.startDateTime)/(this.endDateTime-this.startDateTime)),this.columnHeaders.length*this.packetsReceived+this.itemsReceived*8>1e8&&this.createFile()}else this.finished();t=null},buildHeaders:function(t){this.columnHeaders.length===0&&this.columnMode==="normal"&&(this.columnHeaders.push("TIME"),this.columnHeaders.push("TARGET"),this.columnHeaders.push("PACKET"),this.hasCommands&&(this.columnHeaders.push("USERNAME"),this.enterprise&&this.columnHeaders.push("APPROVER"))),t.forEach(e=>{if(e.slice(0,2)==="__"||this.columnMap[e])return;this.columnMap[e]=this.columnHeaders.length,e=this.keyMap[e];const[s,n,r,o,i,a,
|
|
11
|
-
`)],{type:d});await this.yieldToMain();const
|
|
10
|
+
${new Date(this.endDateTime/1e6).toISOString()} is reached.`}),this.progress=0,this.processButtonText="Cancel",this.cable.createSubscription("StreamingChannel",window.openc3Scope,{received:t=>this.received(t),connected:()=>this.onConnected(),disconnected:t=>{t.allowReconnect&&this.$notify.caution({body:"OpenC3 backend connection disconnected."})},rejected:()=>{this.$notify.caution({body:"OpenC3 backend connection rejected."})}}).then(t=>{this.subscription=t})},resetAllVars:function(){this.fileCount=0,this.totalPacketsReceived=0,this.totalItemsReceived=0,this.columnHeaders=[],this.columnMap={},this.keyMap={},this.resetPerFileVars()},resetPerFileVars:function(){Ve=[],this.packetsReceived=0,this.itemsReceived=0},onConnected:function(){this.resetAllVars();let t=[];this.items.forEach((e,s)=>{let n=`${e.mode}__${e.cmdOrTlm}__${e.targetName}__${e.packetName}__${e.itemName}__${e.valueType}`;e.reducedType!=="SAMPLE"&&(n=n+"__"+e.reducedType);let r=String(s);this.keyMap[r]=n,t.push([n,r])}),OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity).then(e=>{e&&OpenC3Auth.setTokens(),this.subscription.perform("add",{scope:window.openc3Scope,token:localStorage.openc3Token,items:t,start_time:this.startDateTime,end_time:this.endDateTime})})},received:function(t){if(this.cable.recordPing(),t.error){this.$notify.serious({body:t.error});return}if(this.packetsReceived+=t.length,this.totalPacketsReceived+=t.length,t.length>0){let e=new Set;for(let r of t){let o=Object.keys(r);o.forEach(e.add,e);let i=o.filter(a=>a.startsWith("__")).length;this.itemsReceived+=o.length-i,this.totalItemsReceived+=o.length-i}e.delete("__type"),e.delete("__time"),e.delete("__extra"),this.buildHeaders([...e]),Ve.push(t),this.progress=Math.ceil(100*(t[0].__time-this.startDateTime)/(this.endDateTime-this.startDateTime)),this.columnHeaders.length*this.packetsReceived+this.itemsReceived*8>1e8&&this.createFile()}else this.finished();t=null},buildHeaders:function(t){this.columnHeaders.length===0&&this.columnMode==="normal"&&(this.columnHeaders.push("TIME"),this.columnHeaders.push("TARGET"),this.columnHeaders.push("PACKET"),this.hasCommands&&(this.columnHeaders.push("USERNAME"),this.enterprise&&this.columnHeaders.push("APPROVER"))),t.forEach(e=>{if(e.slice(0,2)==="__"||this.columnMap[e])return;this.columnMap[e]=this.columnHeaders.length,e=this.keyMap[e];const[s,n,r,o,i,a,c]=e.split("__");let u=i;this.columnMode==="full"&&(u=r+" "+o+" "+i),s&&s!=="DECOM"&&(u=u+" {"+s+"}"),a&&a!=="CONVERTED"&&(u=u+" ("+a+")"),c&&(u=u+" ["+c+"]"),this.columnHeaders.push(u)})},createFile:async function(){var p,m;let t=Ve.flat(),e=this.columnHeaders,s=this.columnMap,n=[];this.resetPerFileVars();let r="";this.matlabHeader&&(r+="% "),r+=e.join(this.delimiter),n.push(r),await this.yieldToMain(),t.sort((h,E)=>h.__time-E.__time),await this.yieldToMain();let o=[],i=[],a=null,c=0;for(let h of t){let E=!1;this.fillDown&&a?i=[...a]:i=[];let x="";if(Object.keys(h).forEach(T=>{if(T.slice(0,2)==="__")return;x=T;let _=s[T];if(typeof h[T]=="object")if(h[T]===null)i[_]="";else if(Array.isArray(h[T]))i[_]='"['+h[T]+']"';else{let O=h[T].raw;if(Array.isArray(O)){let R="0x";O.forEach(L=>{R+=L.toString(16).padStart(2,"0").toUpperCase()}),i[_]=R}else i[_]="'"+O+"'"}else i[_]=h[T];this.uniqueOnly&&o[_]!==i[_]&&(E=!0),o[_]=i[_]}),this.fillDown&&(a=[...i]),!this.uniqueOnly||E){if(this.columnMode==="normal"){x=this.keyMap[x];const[T,_,O,R,L,j,Z]=x.split("__");i[0]=new Date(h.__time/1e6).toISOString(),i[1]=O,i[2]=R,this.hasCommands&&(i[3]=((p=h.__extra)==null?void 0:p.username)||"",this.enterprise&&(i[4]=((m=h.__extra)==null?void 0:m.approver)||""))}n.push(i.join(this.delimiter))}c+=1,c%1e3==0&&await this.yieldToMain()}let u=".csv",d="text/csv";this.delimiter===" "&&(u=".txt",d="text/tab-separated-values"),await this.yieldToMain();const b=new Blob([n.join(`
|
|
11
|
+
`)],{type:d});await this.yieldToMain();const y=document.createElement("a");y.href=URL.createObjectURL(b),y.setAttribute("download",this.startDateTimeFilename+"_"+this.fileCount+u),y.click(),this.fileCount+=1},yieldToMain:function(){return new Promise(t=>{setTimeout(t,0)})},finished:async function(){if(this.progress=95,this.subscription.unsubscribe(),Ve.length!==0)await this.createFile();else if(this.fileCount===0){let t=new Date(this.startDateTime/1e6).toISOString(),e=new Date(this.endDateTime/1e6).toISOString();this.$notify.caution({body:`No data found for the items in the requested time range of ${t} to ${e}`})}this.progress=100,this.processButtonText="Process"}}};function Ii(t,e,s,n,r,o){const i=C("top-bar"),a=C("v-text-field"),c=C("v-col"),u=C("OpenC3TimePicker"),d=C("v-row"),b=C("v-radio"),y=C("v-radio-group"),p=C("target-packet-item-chooser"),m=C("v-container"),h=C("v-progress-circular"),E=C("v-spacer"),x=C("v-btn"),T=C("v-toolbar"),_=C("v-card-title"),O=C("v-select"),R=C("v-card-text"),L=C("v-card-actions"),j=C("v-card"),Z=C("v-dialog"),$=C("v-data-table"),te=C("open-config-dialog"),z=C("save-config-dialog");return P(),ee("div",null,[f(i,{menus:o.menus,title:r.title},null,8,["menus","title"]),f(j,null,{default:g(()=>[f(m,null,{default:g(()=>[f(d,null,{default:g(()=>[f(c,null,{default:g(()=>[f(a,{modelValue:r.startDate,"onUpdate:modelValue":e[0]||(e[0]=w=>r.startDate=w),label:"Start Date",type:"date",max:r.todaysDate,rules:[r.rules.required],"data-test":"start-date"},null,8,["modelValue","max","rules"])]),_:1}),f(c,null,{default:g(()=>[f(u,{modelValue:r.startTime,"onUpdate:modelValue":e[1]||(e[1]=w=>r.startTime=w),label:"Start Time",rules:[r.rules.required],"data-test":"start-time"},null,8,["modelValue","rules"])]),_:1}),f(c,null,{default:g(()=>[f(a,{modelValue:r.endDate,"onUpdate:modelValue":e[2]||(e[2]=w=>r.endDate=w),label:"End Date",type:"date",max:r.todaysDate,rules:[r.rules.required],"data-test":"end-date"},null,8,["modelValue","max","rules"])]),_:1}),f(c,null,{default:g(()=>[f(u,{modelValue:r.endTime,"onUpdate:modelValue":e[3]||(e[3]=w=>r.endTime=w),label:"End Time",rules:[r.rules.required],"data-test":"end-time"},null,8,["modelValue","rules"])]),_:1})]),_:1}),f(d,{"no-gutters":""},{default:g(()=>[f(c,null,{default:g(()=>[f(y,{modelValue:r.cmdOrTlm,"onUpdate:modelValue":e[4]||(e[4]=w=>r.cmdOrTlm=w),inline:"","hide-details":"",class:"mt-0"},{default:g(()=>[f(b,{label:"Command",value:"cmd","data-test":"cmd-radio"}),f(b,{label:"Telemetry",value:"tlm","data-test":"tlm-radio"})]),_:1},8,["modelValue"])]),_:1})]),_:1}),f(d,null,{default:g(()=>[f(c,null,{default:g(()=>[f(p,{"button-text":"Add Item",mode:r.cmdOrTlm,hidden:!0,"choose-item":"","allow-all":"",onAddItem:e[5]||(e[5]=w=>o.addItem(w))},null,8,["mode"])]),_:1})]),_:1})]),_:1}),f(T,{class:"pl-3"},{default:g(()=>[f(h,{"model-value":r.progress},null,8,["model-value"]),F(" Processed: "+G(r.totalPacketsReceived)+" packets, "+G(r.totalItemsReceived)+" items ",1),f(E),f(x,{class:"bg-primary",disabled:r.items.length<1,onClick:o.processItems},{default:g(()=>[F(G(r.processButtonText),1)]),_:1},8,["disabled","onClick"]),f(E),f(x,{icon:"mdi-pencil-box-multiple",variant:"text",density:"compact",disabled:r.items.length<1,"data-test":"editAll","aria-label":"Edit All Items",onClick:e[6]||(e[6]=w=>r.editAll=!0)},null,8,["disabled"]),f(x,{icon:"mdi-delete-sweep",variant:"text",density:"compact",disabled:r.items.length<1,"data-test":"delete-all","aria-label":"Delete All Items",onClick:o.deleteAll},null,8,["disabled","onClick"])]),_:1}),f(j,{width:"100%"},{default:g(()=>[f(_,null,{default:g(()=>[e[18]||(e[18]=F(" Items ",-1)),f(E),f(a,{modelValue:r.search,"onUpdate:modelValue":e[7]||(e[7]=w=>r.search=w),label:"Search","prepend-inner-icon":"mdi-magnify",clearable:"",variant:"outlined",density:"compact","single-line":"","hide-details":"",class:"search"},null,8,["modelValue"])]),_:1}),f($,{"items-per-page":r.itemsPerPage,"onUpdate:itemsPerPage":e[8]||(e[8]=w=>r.itemsPerPage=w),headers:r.headers,items:r.items,search:r.search,"items-per-page-options":[10,20,50,100,-1],"multi-sort":"",density:"compact"},{"item.edit":g(({item:w})=>[f(x,{icon:"mdi-pencil",variant:"text","data-test":"edit-row","aria-label":"Edit Item",onClick:Tt(I=>w.edit=!0,["stop"])},null,8,["onClick"]),f(Z,{modelValue:w.edit,"onUpdate:modelValue":I=>w.edit=I,"max-width":"600",persistent:"",onKeydown:We(I=>w.edit=!1,["esc"])},{default:g(()=>[f(j,null,{default:g(()=>[f(T,{height:"24"},{default:g(()=>[f(E),e[19]||(e[19]=Te("span",null," DataExtractor: Edit Item Mode ",-1)),f(E)]),_:1}),f(R,null,{default:g(()=>[f(d,{class:"mt-3 title-font"},{default:g(()=>[f(c,null,{default:g(()=>[F(G(o.getItemLabel(w)),1)]),_:2},1024)]),_:2},1024),f(d,null,{default:g(()=>[f(c,null,{default:g(()=>[f(O,{modelValue:w.mode,"onUpdate:modelValue":I=>w.mode=I,"hide-details":"",items:r.modes,label:"Mode",variant:"outlined"},null,8,["modelValue","onUpdate:modelValue","items"])]),_:2},1024)]),_:2},1024),f(d,null,{default:g(()=>[f(c,null,{default:g(()=>[f(O,{modelValue:w.valueType,"onUpdate:modelValue":I=>w.valueType=I,"hide-details":"",items:r.valueTypes,label:"Value Type",variant:"outlined"},null,8,["modelValue","onUpdate:modelValue","items"])]),_:2},1024)]),_:2},1024),f(d,null,{default:g(()=>[f(c,null,{default:g(()=>[f(O,{modelValue:w.reducedType,"onUpdate:modelValue":I=>w.reducedType=I,"hide-details":"",items:r.reducedTypes,label:"Reduced Type",variant:"outlined"},null,8,["modelValue","onUpdate:modelValue","items"])]),_:2},1024)]),_:2},1024)]),_:2},1024),f(L,{class:"px-2"},{default:g(()=>[f(E),f(x,{variant:"flat",onClick:I=>w.edit=!1},{default:g(()=>[...e[20]||(e[20]=[F(" Close ",-1)])]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1032,["modelValue","onUpdate:modelValue","onKeydown"])]),"item.delete":g(({item:w})=>[f(x,{icon:"mdi-delete",variant:"text","data-test":"delete-row","aria-label":"Delete Item",onClick:I=>o.deleteItem(w)},null,8,["onClick"])]),_:1},8,["items-per-page","headers","items","search"])]),_:1})]),_:1}),f(Z,{modelValue:r.editAll,"onUpdate:modelValue":e[14]||(e[14]=w=>r.editAll=w),"max-width":"600",persistent:"",onKeydown:e[15]||(e[15]=We(w=>r.editAll=!1,["esc"]))},{default:g(()=>[f(j,null,{default:g(()=>[f(T,{height:"24"},{default:g(()=>[f(E),e[21]||(e[21]=Te("span",null," DataExtractor: Edit All Items",-1)),f(E)]),_:1}),f(R,null,{default:g(()=>[f(d,{class:"mt-3"},{default:g(()=>[f(c,null,{default:g(()=>[...e[22]||(e[22]=[F(" This will change all items to the following data type! ",-1)])]),_:1})]),_:1}),f(d,null,{default:g(()=>[f(c,null,{default:g(()=>[f(O,{modelValue:r.allItemMode,"onUpdate:modelValue":e[9]||(e[9]=w=>r.allItemMode=w),"hide-details":"",items:r.modes,label:"Mode",variant:"outlined"},null,8,["modelValue","items"])]),_:1})]),_:1}),f(d,null,{default:g(()=>[f(c,null,{default:g(()=>[f(O,{modelValue:r.allItemValueType,"onUpdate:modelValue":e[10]||(e[10]=w=>r.allItemValueType=w),"hide-details":"",items:r.valueTypes,label:"Value Type",variant:"outlined"},null,8,["modelValue","items"])]),_:1})]),_:1}),f(d,null,{default:g(()=>[f(c,null,{default:g(()=>[f(O,{modelValue:r.allItemReducedType,"onUpdate:modelValue":e[11]||(e[11]=w=>r.allItemReducedType=w),"hide-details":"",items:r.reducedTypes,label:"Reduced Type",variant:"outlined"},null,8,["modelValue","items"])]),_:1})]),_:1})]),_:1}),f(L,{class:"px-2"},{default:g(()=>[f(E),f(x,{variant:"outlined",onClick:e[12]||(e[12]=w=>r.editAll=!1)},{default:g(()=>[...e[23]||(e[23]=[F(" Cancel ",-1)])]),_:1}),f(x,{variant:"flat",disabled:!r.allItemValueType,onClick:e[13]||(e[13]=w=>o.editAllItems())},{default:g(()=>[...e[24]||(e[24]=[F(" Ok ",-1)])]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["modelValue"]),r.openConfig?(P(),U(te,{key:0,modelValue:r.openConfig,"onUpdate:modelValue":e[16]||(e[16]=w=>r.openConfig=w),"config-key":r.configKey,onSuccess:o.openConfiguration},null,8,["modelValue","config-key","onSuccess"])):ce("",!0),r.saveConfig?(P(),U(z,{key:1,modelValue:r.saveConfig,"onUpdate:modelValue":e[17]||(e[17]=w=>r.saveConfig=w),"config-key":r.configKey,onSuccess:o.saveConfiguration},null,8,["modelValue","config-key","onSuccess"])):ce("",!0)])}const Gi=Is("default",gt(Pi,[["render",Ii],["__scopeId","data-v-2675b2d7"]]))}}});
|