openc3-cosmos-tool-limitsmonitor 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/limitsmonitor/ArrayWidget-DfiusKpM-cf0990717be754017b9b.js +2 -0
- data/tools/limitsmonitor/{ArrayplotWidget-B9UGCr4--c0699af13f3cc46edb6c.js → ArrayplotWidget-DsvOovu9-833069f6a4282c7af71d.js} +1 -1
- data/tools/limitsmonitor/{BarColumn-ClLBRGll-3a6f79b73ff3c9c4fc4a.js → BarColumn-DHHJBR3V-9295ddef137744696551.js} +1 -1
- data/tools/limitsmonitor/{BlockWidget-CoQp-LZM-d8c98a89a94b86795850.js → BlockWidget-BdYXWS_0-fe274c2509343ff838c1.js} +2 -2
- data/tools/limitsmonitor/{ButtonWidget-CTTwpFec-fdd74b632cabc9777cec.js → ButtonWidget-zpSJmiQT-1cfbc8b11918a26f1dfb.js} +1 -1
- data/tools/limitsmonitor/CanvasWidget-DaUB1G9X-25c7e03fdc64aee96a9a.js +1 -0
- data/tools/limitsmonitor/CanvasdotWidget-C255aTVc-60301f8aee0551b575fc.js +1 -0
- data/tools/limitsmonitor/{CanvasimageWidget-DmyCSnuQ-9c345c5871f8814901d4.js → CanvasimageWidget-CFlUUFqr-4881b41ab7df8e7a5680.js} +1 -1
- data/tools/limitsmonitor/{CanvasimagevalueWidget-CmbngMqv-f3566bc700f214195f83.js → CanvasimagevalueWidget-s4gR3fo5-b32ee9893bae3d08250c.js} +1 -1
- data/tools/limitsmonitor/{CanvaslabelWidget-D8NzLKqi-1d978d216a03b05dfe37.js → CanvaslabelWidget-CaOc-lTQ-9fd6711df24e0306a8b2.js} +1 -1
- data/tools/limitsmonitor/{CanvaslabelvalueWidget-DOybGI9D-e7206436a55d72b1aafe.js → CanvaslabelvalueWidget-hqJoPekq-14c156935dd6a8b688d2.js} +1 -1
- data/tools/limitsmonitor/{CanvaslineWidget-D2NEei7j-5b9e724ddb5d470fddbb.js → CanvaslineWidget-DebP2L43-8f76fa8e1b04cb5b33fb.js} +1 -1
- data/tools/limitsmonitor/{CanvaslinevalueWidget-Ctvv9owf-deb8f247c36073ab1be5.js → CanvaslinevalueWidget-BkPG5Vtx-208b9d6bbf4d6e9201ae.js} +1 -1
- data/tools/limitsmonitor/CheckbuttonWidget-eQIcPATf-561fd75a6613188950e1.js +1 -0
- data/tools/limitsmonitor/ComboboxWidget-B5kzYxFk-6a795cac86ac60c5a8f9.js +1 -0
- data/tools/limitsmonitor/{DateWidget-rYTjwUdb-6409639f4d08ad00a087.js → DateWidget-1IZOe50K-e72fd245302fb5f55b52.js} +1 -1
- data/tools/limitsmonitor/{DetailsDialog-p_vutijL-78c5dc88b9297d14152e.js → DetailsDialog-D-rjL4oc-ff97da486c63c518afca.js} +1 -1
- data/tools/limitsmonitor/{DynamicWidget-DEHWYr8i-5447f869bfddd5a0084b.js → DynamicWidget-DEHWYr8i-4eb7b509a3a838a6279e.js} +1 -1
- data/tools/limitsmonitor/{FilechecksumWidget-gcmXxJHl-4bacae64b021ba538301.js → FilechecksumWidget-F_FX1Kjx-884d97e69e2ba4631c4a.js} +1 -1
- data/tools/limitsmonitor/{FiledisplayWidget-CqM549A4-b03d5d3adb686bda82f4.js → FiledisplayWidget-BF3G22jF-87e9fbe9e4dc126d0c60.js} +1 -1
- data/tools/limitsmonitor/{FormatvalueWidget-BEwH0C7S-8c4fb201103de37e2081.js → FormatvalueWidget-BkF9iiHs-65964a96b0e76319c8be.js} +1 -1
- data/tools/limitsmonitor/Graph-C-7C2Jq5-5d3a9012ac5bc4a3e76d.js +1 -0
- data/tools/limitsmonitor/{GraphWidget-CjxnC0Dc-47f2c1607a312e05e2c1.js → GraphWidget-DRkDn8za-efb7620a1d156670ee85.js} +1 -1
- data/tools/limitsmonitor/HorizontalWidget-DB64wzZB-a861d6dc4f94807edea0.js +1 -0
- data/tools/limitsmonitor/HorizontalboxWidget-BsHsGlvK-ecf91e8c0c6514817284.js +1 -0
- data/tools/limitsmonitor/{HorizontallineWidget-CXZJTeU2-8f78de5fd8a4abd350e0.js → HorizontallineWidget-CyiexzIu-d82b266d499ce67ae610.js} +1 -1
- data/tools/limitsmonitor/{IframeWidget-CrcWiAVE-54a7c24a93f322f3f088.js → IframeWidget-D9Vh0w2c-fe7c97c7b441849017be.js} +1 -1
- data/tools/limitsmonitor/{ImageLoader-DPqax8yu-959c2e3ee8697e37d98c.js → ImageLoader-B4iBPFyi-d70fdf9459a261277349.js} +1 -1
- data/tools/limitsmonitor/{ImageviewerWidget-CTEl6iPg-b17325e58318b3b560bc.js → ImageviewerWidget-DqV4SClv-852c9ae6e9aec71ddf68.js} +1 -1
- data/tools/limitsmonitor/{LabelWidget-CPqKGMx0-d23e9a503a75d3ed8678.js → LabelWidget-BDukcPet-78f2dcdf731fa9c70821.js} +1 -1
- data/tools/limitsmonitor/LabelledWidget-tVHE426s-171befab20a48187fd01.js +1 -0
- data/tools/limitsmonitor/LabelprogressbarWidget-CjMDFUUv-73813ae73e7754a9d2ef.js +1 -0
- data/tools/limitsmonitor/LabelsparklineWidget-dZl3cGu0-36af28dbc6393e2b6230.js +1 -0
- data/tools/limitsmonitor/{LabelvalueWidget-NLsD60n4-abf8d632f5d34ee5d443.js → LabelvalueWidget-UcAc_2Ry-d7fa4ecebb25a87f4cf9.js} +1 -1
- data/tools/limitsmonitor/{LabelvaluedescWidget-DXROG4Gs-f6a9060fc00d1fd75f03.js → LabelvaluedescWidget-Crb8udVe-7bc898f6e273c9bfd42d.js} +1 -1
- data/tools/limitsmonitor/LabelvaluelimitsbarWidget-BZGUQrRt-5376f8235a0e21b4dd08.js +1 -0
- data/tools/limitsmonitor/LabelvaluelimitscolumnWidget-NNYW2aMO-862c68a9618f0000054a.js +1 -0
- data/tools/limitsmonitor/LabelvaluerangebarWidget-CjkVDlVJ-feb66c4325b105615ce7.js +1 -0
- data/tools/limitsmonitor/Layout-FpBx3iic-c48026c3d4dcd03ac0f9.js +1 -0
- data/tools/limitsmonitor/{LedWidget-CiAVs2tj-d2f1df29d4024df0feeb.js → LedWidget-Bsp1aja--6f57357e9ee9dccfead0.js} +1 -1
- data/tools/limitsmonitor/{LimitsBar-_UQG-M6e-42ba60acda458b527cae.js → LimitsBar-IVv8t4FE-f813e751f5a05d588238.js} +1 -1
- data/tools/limitsmonitor/{LimitsMonitor-522bff3ed412ef588e84.js → LimitsMonitor-7abe08c579e788354ab5.js} +6 -6
- data/tools/limitsmonitor/{LimitsbarWidget-CIwcOhC8-69887c1360d888b96ff7.js → LimitsbarWidget-Bo1JAoQp-72029a82062f0c81fcba.js} +1 -1
- data/tools/limitsmonitor/{LimitscolorWidget-CGPfJwvT-e007df69308453182be5.js → LimitscolorWidget-Doq8h_g1-b5ce37b19f20310118b4.js} +1 -1
- data/tools/limitsmonitor/{LimitscolumnWidget-Bj_UPEC8-7e65c45493148c676292.js → LimitscolumnWidget-qasXHN7m-25be83483ea446376cd8.js} +1 -1
- data/tools/limitsmonitor/LinegraphWidget-BNMqcr_r-32bef388aab21ed3d669.js +1 -0
- data/tools/limitsmonitor/{MatrixbycolumnsWidget-U_NZ6aW--eb2b8efc556c72a9e7ab.js → MatrixbycolumnsWidget-BlF1CyIT-425a84a463a45f590705.js} +1 -1
- data/tools/limitsmonitor/OpenC3TimePicker-D-_qqySI-d0fad6952194d8beb37d.js +1 -0
- data/tools/limitsmonitor/{ProgressbarWidget-D4JtVzyk-d6bd6bd6ed61ad0bdf70.js → ProgressbarWidget-DQ80NANH-3248cef6ed19ef8f389f.js} +1 -1
- data/tools/limitsmonitor/{RadiobuttonWidget-BUaW7pRx-45a526dd8c7b33954362.js → RadiobuttonWidget-LD18M4IQ-a40d78c06d45f3b8c71a.js} +1 -1
- data/tools/limitsmonitor/{RadiogroupWidget-NIv4CaUQ-e71b4237aea4f4fc7a53.js → RadiogroupWidget-D_pt2MPz-49a69ee63f029ceb2ef6.js} +1 -1
- data/tools/limitsmonitor/{RangebarWidget-1-CsFpcl-49ff7eafa75caedd7d0d.js → RangebarWidget-DhaWpHjB-26b033cfc3526a33750c.js} +1 -1
- data/tools/limitsmonitor/{RollupWidget-ChasTJYP-efc70883dfc30624c906.js → RollupWidget-CMU1-HwL-2a766178c8f1617e257c.js} +1 -1
- data/tools/limitsmonitor/{ScrollwindowWidget-Y2J758y6-fec57614b2924c22c414.js → ScrollwindowWidget-D7Ln-QMq-c40fd0d0be6af02be503.js} +1 -1
- data/tools/limitsmonitor/{SignalWidget-DFhHDicI-c5358801e3c702bc1f71.js → SignalWidget-PreTg4Mt-6aac21a7059face607c0.js} +1 -1
- data/tools/limitsmonitor/SpacerWidget-Chy1NO28-50530e2f1a6bfa0cdc97.js +1 -0
- data/tools/limitsmonitor/SparklineWidget-Bb-gCNNt-8322037a0abf74592fad.js +1 -0
- data/tools/limitsmonitor/TabbookWidget-a-LsBhBE-70f95d9bea7646f0f1c2.js +1 -0
- data/tools/limitsmonitor/{TextboxWidget-CrMYPQIF-4ec5c794abaa9680ef12.js → TextboxWidget-DIHEOldN-dd3826571d3e0445b710.js} +1 -1
- data/tools/limitsmonitor/TextfieldWidget-CIBo7Dau-279cadfb71bb9160012d.js +1 -0
- data/tools/limitsmonitor/TimeWidget-CLuOYfPP-e1c0aef574303b97333c.js +1 -0
- data/tools/limitsmonitor/{TitleWidget-V1FGI8l3-9dabf94b38811b223d52.js → TitleWidget-BTHKLAsb-42608bf42390da550181.js} +1 -1
- data/tools/limitsmonitor/{VWidget-rAFU-0vj-e02dd3fa06b7c3ce8d63.js → VWidget-BcwkHuIT-bf6a6ce5d0c5b6a31798.js} +1 -1
- data/tools/limitsmonitor/ValueWidget-BubIamVx-a56b1bb67ab7f77834e6.js +1 -0
- data/tools/limitsmonitor/ValuelimitsbarWidget-DKTrV1RT-902ce99eafdf364370d2.js +1 -0
- data/tools/limitsmonitor/ValuelimitscolumnWidget-D8JIK4Zi-4f6ad580f2ddd15530ef.js +1 -0
- data/tools/limitsmonitor/ValuerangebarWidget-D8hVKp0l-b19dea95dbc4c5267ddc.js +1 -0
- data/tools/limitsmonitor/{VerticalWidget-DZqghqIm-6d88a0c9d43e4ad485ad.js → VerticalWidget-DMp3DXGa-be892e728c9781516172.js} +1 -1
- data/tools/limitsmonitor/VerticalboxWidget-CVf1d_3_-59fa00533f2d42397f2c.js +1 -0
- data/tools/limitsmonitor/{Widget-6-Nvewdp-15acabff5795d9a67569.js → Widget-D4rzBHnr-3f2807322c003db85316.js} +1 -1
- data/tools/limitsmonitor/{main-bb1dcadee0b48f3773d0.js → main-40ee205662b8d03b0fda.js} +102 -102
- data/tools/limitsmonitor/main.js +1 -1
- metadata +72 -71
- data/tools/limitsmonitor/ArrayWidget-Bc-Awsbn-8f2dfaac36c130b9c9ea.js +0 -2
- data/tools/limitsmonitor/CanvasWidget-jFarbJ3t-6e7e5883d5fe849209ca.js +0 -1
- data/tools/limitsmonitor/CanvasdotWidget-BoyUcwiB-71b36c1e15eaded5c58b.js +0 -1
- data/tools/limitsmonitor/CheckbuttonWidget-CQeR0BMF-a305ecd554d0205a34be.js +0 -1
- data/tools/limitsmonitor/ComboboxWidget-4N-MagvN-4380eee9e7e006f7c0c6.js +0 -1
- data/tools/limitsmonitor/Graph-CbjlChwf-92edb1d3bc699c49d39f.js +0 -1
- data/tools/limitsmonitor/HorizontalWidget-Dt8bkM3k-7d1724dfc7f72aa81ee1.js +0 -1
- data/tools/limitsmonitor/HorizontalboxWidget-CdAZ5Sa6-b738ef01183fb1fd10fb.js +0 -1
- data/tools/limitsmonitor/LabelledWidget-BHYzRMFd-d1e997998898d6a83eb8.js +0 -1
- data/tools/limitsmonitor/LabelprogressbarWidget-D9deeUo7-48a7932a9fbebc9c90ae.js +0 -1
- data/tools/limitsmonitor/LabelsparklineWidget-7mYre3CP-3f83ccfff418c68a51bf.js +0 -1
- data/tools/limitsmonitor/LabelvaluelimitsbarWidget-DqVqHF4W-75546f42acf55ddb99fa.js +0 -1
- data/tools/limitsmonitor/LabelvaluelimitscolumnWidget-BK6_31pC-22925dc2a6c945561cab.js +0 -1
- data/tools/limitsmonitor/LabelvaluerangebarWidget-DR7C8gqw-fdcc52ae86b324df3887.js +0 -1
- data/tools/limitsmonitor/Layout-B_Hgw3gd-b6ac6b02679fe0446f63.js +0 -1
- data/tools/limitsmonitor/LinegraphWidget-DccnHbWa-3b1e2826840e30e4fa60.js +0 -1
- data/tools/limitsmonitor/SpacerWidget-D4KojaGb-1b26a6613de8203df599.js +0 -1
- data/tools/limitsmonitor/SparklineWidget-DMHFzw8L-de50f0895cd0448e1da7.js +0 -1
- data/tools/limitsmonitor/TabbookWidget-NVLYMdFG-d4ca4e8f17ddf51e2775.js +0 -1
- data/tools/limitsmonitor/TextfieldWidget-DMBQwtnb-fbebb75ac7cb81a27294.js +0 -1
- data/tools/limitsmonitor/TimeWidget-CWLJZ2bt-471a4d11ce1a393d59a0.js +0 -1
- data/tools/limitsmonitor/ValueWidget-BI3uXmda-6c05305ca94462b81f2b.js +0 -1
- data/tools/limitsmonitor/ValuelimitsbarWidget-BGSJLpw4-ce1b6572ee69269dfd15.js +0 -1
- data/tools/limitsmonitor/ValuelimitscolumnWidget-CaNjHy4v-1f977fb3fb925263f691.js +0 -1
- data/tools/limitsmonitor/ValuerangebarWidget-Do40-aaL-4ecc7cb88f506e5ed6c7.js +0 -1
- data/tools/limitsmonitor/VerticalboxWidget-CQ__4FcS-660d2e304f7bff95899a.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
System.register(["./main-
|
|
2
|
-
/*$vite$:1*/`,document.head.appendChild(E);const Ts={__name:"TopBarMenu",props:{menu:{type:Object,required:!0},title:{type:String,required:!0}},emits:["submenu-click"],setup(t,{emit:e}){const s=e,r=_t(!1);function n(){r.value=!1}function o(i){return i.replaceAll(" ","-").toLowerCase()}return(i,a)=>{const l=w("v-icon"),u=w("v-btn"),d=w("v-divider"),h=w("v-list-item-title"),y=w("v-list-item"),f=w("v-list"),m=w("v-menu"),p=w("v-radio"),O=w("v-list-item-action"),I=w("v-radio-group"),x=w("v-checkbox");return C(),j(m,{modelValue:r.value,"onUpdate:modelValue":a[0]||(a[0]=b=>r.value=b),"close-on-content-click":!1},{activator:g(({props:b})=>[_(u,Ce(b,{variant:"outlined",class:"mx-1 menu-button",text:t.menu.label,"data-test":o(`${t.title} ${t.menu.label}`)}),{append:g(()=>[_(l,{class:"menu-button-icon"},{default:g(()=>[...a[1]||(a[1]=[U(" mdi-menu-down ",-1)])]),_:1})]),_:1},16,["text","data-test"])]),default:g(()=>[_(f,null,{default:g(()=>[(C(!0),H(se,null,ue(t.menu.items,(b,A)=>(C(),H(se,null,[b.divider?(C(),j(d,{key:A+"-divider"})):b.subMenu&&b.subMenu.length>0?(C(),H("div",{key:A+"-submenu"},[(C(),j(m,{key:A,"open-on-hover":"",location:"right"},{activator:g(({props:T})=>[(C(),j(y,Ce({ref_for:!0},T,{key:A,disabled:b.disabled}),Oe({append:g(()=>[_(l,null,{default:g(()=>[...a[2]||(a[2]=[U(" mdi-chevron-right ",-1)])]),_:1})]),default:g(()=>[!b.radio&&!b.checkbox?(C(),j(h,{key:0,style:We("cursor: pointer;"+(b.disabled?"opacity: 0.2":""))},{default:g(()=>[U(Y(b.label),1)]),_:2},1032,["style"])):re("",!0)]),_:2},[b.icon?{name:"prepend",fn:g(()=>[_(l,{disabled:b.disabled},{default:g(()=>[U(Y(b.icon),1)]),_:2},1032,["disabled"])]),key:"0"}:void 0]),1040,["disabled"]))]),default:g(()=>[_(f,null,{default:g(()=>[(C(!0),H(se,null,ue(b.subMenu,(T,z)=>(C(),j(y,{key:z,"prepend-icon":T.icon,onClick:D=>s("submenu-click",T)},{default:g(()=>[_(h,null,{default:g(()=>[U(Y(T.label),1)]),_:2},1024)]),_:2},1032,["prepend-icon","onClick"]))),128))]),_:2},1024)]),_:2},1024))])):b.radioGroup?(C(),j(I,{key:A+"-radio-group",class:"ma-0 pa-0",density:"compact","hide-details":"","model-value":b.value,"onUpdate:modelValue":b.command},{default:g(()=>[(C(!0),H(se,null,ue(b.choices,(T,z)=>(C(),j(y,{key:z+"-choice"},{default:g(()=>[_(O,{class:"list-action"},{default:g(()=>[_(p,{color:"secondary",label:T.label,value:T.value,density:"compact","hide-details":""},null,8,["label","value"])]),_:2},1024)]),_:2},1024))),128))]),_:2},1032,["model-value","onUpdate:modelValue"])):(C(),j(y,{key:A+"-list",disabled:b.disabled,"data-test":o(`${t.title} ${t.menu.label} ${b.label}`),onClick:()=>{b.command(b),b.checkbox||n()}},Oe({default:g(()=>[b.checkbox?(C(),j(O,{key:0,class:"list-action"},{default:g(()=>[_(x,{modelValue:b.checked,"onUpdate:modelValue":T=>b.checked=T,label:b.label,color:"secondary",density:"compact","hide-details":""},null,8,["modelValue","onUpdate:modelValue","label"])]),_:2},1024)):re("",!0),!b.radio&&!b.checkbox?(C(),j(h,{key:1,style:We("cursor: pointer;"+(b.disabled?"opacity: 0.2":""))},{default:g(()=>[U(Y(b.label),1)]),_:2},1032,["style"])):re("",!0)]),_:2},[b.icon?{name:"prepend",fn:g(()=>[_(l,{icon:b.icon,disabled:b.disabled},null,8,["icon","disabled"])]),key:"0"}:void 0]),1032,["disabled","data-test","onClick"]))],64))),256))]),_:1})]),_:1},8,["modelValue"])}}},Ls={components:{TopBarMenu:Ts},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 Ns(t,e,s,r,n,o){const i=w("v-col"),a=w("v-row"),l=w("TopBarMenu");return C(),j(bt,{to:"#openc3-menu"},[_(a,{"no-gutters":""},{default:g(()=>[_(i,{"align-self":"end"},{default:g(()=>[$("span",js,Y(s.title),1)]),_:1})]),_:1}),_(a,{dense:"",class:"flex-nowrap"},{default:g(()=>[(C(!0),H(se,null,ue(s.menus,(u,d)=>(C(),j(l,{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 Ps=ft(Ls,[["render",Ns],["__scopeId","data-v-b6581c4c"]]);var Us=Object.defineProperty,Fs=(t,e,s)=>e in t?Us(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,ke=(t,e,s)=>Fs(t,typeof e!="symbol"?e+"":e,s);function St(t,e){return function(){return t.apply(e,arguments)}}const{toString:Ds}=Object.prototype,{getPrototypeOf:Je}=Object,{iterator:Re,toStringTag:Et}=Symbol,Ie=(t=>e=>{const s=Ds.call(e);return t[s]||(t[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),J=t=>(t=t.toLowerCase(),e=>Ie(e)===t),Ae=t=>e=>typeof e===t,{isArray:de}=Array,he=Ae("undefined");function me(t){return t!==null&&!he(t)&&t.constructor!==null&&!he(t.constructor)&&B(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const xt=J("ArrayBuffer");function $s(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&xt(t.buffer),e}const Bs=Ae("string"),B=Ae("function"),Ct=Ae("number"),ge=t=>t!==null&&typeof t=="object",Vs=t=>t===!0||t===!1,Te=t=>{if(Ie(t)!=="object")return!1;const e=Je(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Et in t)&&!(Re in t)},qs=t=>{if(!ge(t)||me(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Ms=J("Date"),zs=J("File"),Ws=J("Blob"),Hs=J("FileList"),Js=t=>ge(t)&&B(t.pipe),Ks=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||B(t.append)&&((e=Ie(t))==="formdata"||e==="object"&&B(t.toString)&&t.toString()==="[object FormData]"))},Gs=J("URLSearchParams"),[Zs,Ys,Xs,Qs]=["ReadableStream","Request","Response","Headers"].map(J),er=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function be(t,e,{allOwnKeys:s=!1}={}){if(t===null||typeof t>"u")return;let r,n;if(typeof t!="object"&&(t=[t]),de(t))for(r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else{if(me(t))return;const o=s?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let a;for(r=0;r<i;r++)a=o[r],e.call(null,t[a],a,t)}}function Ot(t,e){if(me(t))return null;e=e.toLowerCase();const s=Object.keys(t);let r=s.length,n;for(;r-- >0;)if(n=s[r],e===n.toLowerCase())return n;return null}const ne=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,kt=t=>!he(t)&&t!==ne;function Ke(){const{caseless:t,skipUndefined:e}=kt(this)&&this||{},s={},r=(n,o)=>{const i=t&&Ot(s,o)||o;Te(s[i])&&Te(n)?s[i]=Ke(s[i],n):Te(n)?s[i]=Ke({},n):de(n)?s[i]=n.slice():(!e||!he(n))&&(s[i]=n)};for(let n=0,o=arguments.length;n<o;n++)arguments[n]&&be(arguments[n],r);return s}const tr=(t,e,s,{allOwnKeys:r}={})=>(be(e,(n,o)=>{s&&B(n)?t[o]=St(n,s):t[o]=n},{allOwnKeys:r}),t),sr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rr=(t,e,s,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),s&&Object.assign(t.prototype,s)},nr=(t,e,s,r)=>{let n,o,i;const a={};if(e=e||{},t==null)return e;do{for(n=Object.getOwnPropertyNames(t),o=n.length;o-- >0;)i=n[o],(!r||r(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},ir=(t,e,s)=>{t=String(t),(s===void 0||s>t.length)&&(s=t.length),s-=e.length;const r=t.indexOf(e,s);return r!==-1&&r===s},or=t=>{if(!t)return null;if(de(t))return t;let e=t.length;if(!Ct(e))return null;const s=new Array(e);for(;e-- >0;)s[e]=t[e];return s},ar=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Je(Uint8Array)),cr=(t,e)=>{const s=(t&&t[Re]).call(t);let r;for(;(r=s.next())&&!r.done;){const n=r.value;e.call(t,n[0],n[1])}},lr=(t,e)=>{let s;const r=[];for(;(s=t.exec(e))!==null;)r.push(s);return r},ur=J("HTMLFormElement"),dr=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,s,r){return s.toUpperCase()+r}),Rt=(({hasOwnProperty:t})=>(e,s)=>t.call(e,s))(Object.prototype),hr=J("RegExp"),It=(t,e)=>{const s=Object.getOwnPropertyDescriptors(t),r={};be(s,(n,o)=>{let i;(i=e(n,o,t))!==!1&&(r[o]=i||n)}),Object.defineProperties(t,r)},fr=t=>{It(t,(e,s)=>{if(B(t)&&["arguments","caller","callee"].indexOf(s)!==-1)return!1;const r=t[s];if(B(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},pr=(t,e)=>{const s={},r=n=>{n.forEach(o=>{s[o]=!0})};return de(t)?r(t):r(String(t).split(e)),s},mr=()=>{},gr=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function br(t){return!!(t&&B(t.append)&&t[Et]==="FormData"&&t[Re])}const _r=t=>{const e=new Array(10),s=(r,n)=>{if(ge(r)){if(e.indexOf(r)>=0)return;if(me(r))return r;if(!("toJSON"in r)){e[n]=r;const o=de(r)?[]:{};return be(r,(i,a)=>{const l=s(i,n+1);!he(l)&&(o[a]=l)}),e[n]=void 0,o}}return r};return s(t,0)},yr=J("AsyncFunction"),wr=t=>t&&(ge(t)||B(t))&&B(t.then)&&B(t.catch),At=((t,e)=>t?setImmediate:e?((s,r)=>(ne.addEventListener("message",({source:n,data:o})=>{n===ne&&o===s&&r.length&&r.shift()()},!1),n=>{r.push(n),ne.postMessage(s,"*")}))(`axios@${Math.random()}`,[]):s=>setTimeout(s))(typeof setImmediate=="function",B(ne.postMessage)),vr=typeof queueMicrotask<"u"?queueMicrotask.bind(ne):typeof process<"u"&&process.nextTick||At,Sr=t=>t!=null&&B(t[Re]),c={isArray:de,isArrayBuffer:xt,isBuffer:me,isFormData:Ks,isArrayBufferView:$s,isString:Bs,isNumber:Ct,isBoolean:Vs,isObject:ge,isPlainObject:Te,isEmptyObject:qs,isReadableStream:Zs,isRequest:Ys,isResponse:Xs,isHeaders:Qs,isUndefined:he,isDate:Ms,isFile:zs,isBlob:Ws,isRegExp:hr,isFunction:B,isStream:Js,isURLSearchParams:Gs,isTypedArray:ar,isFileList:Hs,forEach:be,merge:Ke,extend:tr,trim:er,stripBOM:sr,inherits:rr,toFlatObject:nr,kindOf:Ie,kindOfTest:J,endsWith:ir,toArray:or,forEachEntry:cr,matchAll:lr,isHTMLForm:ur,hasOwnProperty:Rt,hasOwnProp:Rt,reduceDescriptors:It,freezeMethods:fr,toObjectSet:pr,toCamelCase:dr,noop:mr,toFiniteNumber:gr,findKey:Ot,global:ne,isContextDefined:kt,isSpecCompliantForm:br,toJSONObject:_r,isAsyncFn:yr,isThenable:wr,setImmediate:At,asap:vr,isIterable:Sr};function S(t,e,s,r,n){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),r&&(this.request=r),n&&(this.response=n,this.status=n.status?n.status:null)}c.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:c.toJSONObject(this.config),code:this.code,status:this.status}}});const Tt=S.prototype,Lt={};["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=>{Lt[t]={value:t}}),Object.defineProperties(S,Lt),Object.defineProperty(Tt,"isAxiosError",{value:!0}),S.from=(t,e,s,r,n,o)=>{const i=Object.create(Tt);c.toFlatObject(t,i,function(u){return u!==Error.prototype},u=>u!=="isAxiosError");const a=t&&t.message?t.message:"Error",l=e==null&&t?t.code:e;return S.call(i,a,l,s,r,n),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 Er=null;function Ge(t){return c.isPlainObject(t)||c.isArray(t)}function jt(t){return c.endsWith(t,"[]")?t.slice(0,-2):t}function Nt(t,e,s){return t?t.concat(e).map(function(r,n){return r=jt(r),!s&&n?"["+r+"]":r}).join(s?".":""):e}function xr(t){return c.isArray(t)&&!t.some(Ge)}const Cr=c.toFlatObject(c,{},null,function(t){return/^is[A-Z]/.test(t)});function Le(t,e,s){if(!c.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,s=c.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,m){return!c.isUndefined(m[f])});const r=s.metaTokens,n=s.visitor||u,o=s.dots,i=s.indexes,a=(s.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(e);if(!c.isFunction(n))throw new TypeError("visitor must be a function");function l(f){if(f===null)return"";if(c.isDate(f))return f.toISOString();if(c.isBoolean(f))return f.toString();if(!a&&c.isBlob(f))throw new S("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(f)||c.isTypedArray(f)?a&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,m,p){let O=f;if(f&&!p&&typeof f=="object"){if(c.endsWith(m,"{}"))m=r?m:m.slice(0,-2),f=JSON.stringify(f);else if(c.isArray(f)&&xr(f)||(c.isFileList(f)||c.endsWith(m,"[]"))&&(O=c.toArray(f)))return m=jt(m),O.forEach(function(I,x){!(c.isUndefined(I)||I===null)&&e.append(i===!0?Nt([m],x,o):i===null?m:m+"[]",l(I))}),!1}return Ge(f)?!0:(e.append(Nt(p,m,o),l(f)),!1)}const d=[],h=Object.assign(Cr,{defaultVisitor:u,convertValue:l,isVisitable:Ge});function y(f,m){if(!c.isUndefined(f)){if(d.indexOf(f)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(f),c.forEach(f,function(p,O){(!(c.isUndefined(p)||p===null)&&n.call(e,p,c.isString(O)?O.trim():O,m,h))===!0&&y(p,m?m.concat(O):[O])}),d.pop()}}if(!c.isObject(t))throw new TypeError("data must be an object");return y(t),e}function Pt(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function Ze(t,e){this._pairs=[],t&&Le(t,this,e)}const Ut=Ze.prototype;Ut.append=function(t,e){this._pairs.push([t,e])},Ut.toString=function(t){const e=t?function(s){return t.call(this,s,Pt)}:Pt;return this._pairs.map(function(s){return e(s[0])+"="+e(s[1])},"").join("&")};function Or(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ft(t,e,s){if(!e)return t;const r=s&&s.encode||Or;c.isFunction(s)&&(s={serialize:s});const n=s&&s.serialize;let o;if(n?o=n(e,s):o=c.isURLSearchParams(e)?e.toString():new Ze(e,s).toString(r),o){const i=t.indexOf("#");i!==-1&&(t=t.slice(0,i)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class Dt{constructor(){this.handlers=[]}use(e,s,r){return this.handlers.push({fulfilled:e,rejected:s,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){c.forEach(this.handlers,function(s){s!==null&&e(s)})}}const $t={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},kr=typeof URLSearchParams<"u"?URLSearchParams:Ze,Rr=typeof FormData<"u"?FormData:null,Ir=typeof Blob<"u"?Blob:null,Ar={isBrowser:!0,classes:{URLSearchParams:kr,FormData:Rr,Blob:Ir},protocols:["http","https","file","blob","url","data"]},Ye=typeof window<"u"&&typeof document<"u",Xe=typeof navigator=="object"&&navigator||void 0,Tr=Ye&&(!Xe||["ReactNative","NativeScript","NS"].indexOf(Xe.product)<0),Lr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",jr=Ye&&window.location.href||"http://localhost",Nr=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ye,hasStandardBrowserEnv:Tr,hasStandardBrowserWebWorkerEnv:Lr,navigator:Xe,origin:jr},Symbol.toStringTag,{value:"Module"})),F={...Nr,...Ar};function Pr(t,e){return Le(t,new F.classes.URLSearchParams,{visitor:function(s,r,n,o){return F.isNode&&c.isBuffer(s)?(this.append(r,s.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Ur(t){return c.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Fr(t){const e={},s=Object.keys(t);let r;const n=s.length;let o;for(r=0;r<n;r++)o=s[r],e[o]=t[o];return e}function Bt(t){function e(s,r,n,o){let i=s[o++];if(i==="__proto__")return!0;const a=Number.isFinite(+i),l=o>=s.length;return i=!i&&c.isArray(n)?n.length:i,l?(c.hasOwnProp(n,i)?n[i]=[n[i],r]:n[i]=r,!a):((!n[i]||!c.isObject(n[i]))&&(n[i]=[]),e(s,r,n[i],o)&&c.isArray(n[i])&&(n[i]=Fr(n[i])),!a)}if(c.isFormData(t)&&c.isFunction(t.entries)){const s={};return c.forEachEntry(t,(r,n)=>{e(Ur(r),n,s,0)}),s}return null}function Dr(t,e,s){if(c.isString(t))try{return(e||JSON.parse)(t),c.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(s||JSON.stringify)(t)}const _e={transitional:$t,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const s=e.getContentType()||"",r=s.indexOf("application/json")>-1,n=c.isObject(t);if(n&&c.isHTMLForm(t)&&(t=new FormData(t)),c.isFormData(t))return r?JSON.stringify(Bt(t)):t;if(c.isArrayBuffer(t)||c.isBuffer(t)||c.isStream(t)||c.isFile(t)||c.isBlob(t)||c.isReadableStream(t))return t;if(c.isArrayBufferView(t))return t.buffer;if(c.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(n){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Pr(t,this.formSerializer).toString();if((o=c.isFileList(t))||s.indexOf("multipart/form-data")>-1){const i=this.env&&this.env.FormData;return Le(o?{"files[]":t}:t,i&&new i,this.formSerializer)}}return n||r?(e.setContentType("application/json",!1),Dr(t)):t}],transformResponse:[function(t){const e=this.transitional||_e.transitional,s=e&&e.forcedJSONParsing,r=this.responseType==="json";if(c.isResponse(t)||c.isReadableStream(t))return t;if(t&&c.isString(t)&&(s&&!this.responseType||r)){const n=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t,this.parseReviver)}catch(o){if(n)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:F.classes.FormData,Blob:F.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};c.forEach(["delete","get","head","post","put","patch"],t=>{_e.headers[t]={}});const $r=c.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"]),Br=t=>{const e={};let s,r,n;return t&&t.split(`
|
|
3
|
-
`).forEach(function(o){n=o.indexOf(":"),s=o.substring(0,n).trim().toLowerCase(),r=o.substring(n+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(r=>s.set(r)),s}static accessor(t){const e=(this[Vt]=this[Vt]={accessors:{}}).accessors,s=this.prototype;function r(n){const o=ye(n);e[o]||(zr(s,n),e[o]=!0)}return c.isArray(t)?t.forEach(r):r(t),this}};V.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),c.reduceDescriptors(V.prototype,({value:t},e)=>{let s=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[s]=r}}}),c.freezeMethods(V);function et(t,e){const s=this||_e,r=e||s,n=V.from(r.headers);let o=r.data;return c.forEach(t,function(i){o=i.call(s,o,n.normalize(),e?e.status:void 0)}),n.normalize(),o}function qt(t){return!!(t&&t.__CANCEL__)}function fe(t,e,s){S.call(this,t??"canceled",S.ERR_CANCELED,e,s),this.name="CanceledError"}c.inherits(fe,S,{__CANCEL__:!0});function Mt(t,e,s){const r=s.config.validateStatus;!s.status||!r||r(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 Wr(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Hr(t,e){t=t||10;const s=new Array(t),r=new Array(t);let n=0,o=0,i;return e=e!==void 0?e:1e3,function(a){const l=Date.now(),u=r[o];i||(i=l),s[n]=a,r[n]=l;let d=o,h=0;for(;d!==n;)h+=s[d++],d=d%t;if(n=(n+1)%t,n===o&&(o=(o+1)%t),l-i<e)return;const y=u&&l-u;return y?Math.round(h*1e3/y):void 0}}function Jr(t,e){let s=0,r=1e3/e,n,o;const i=(a,l=Date.now())=>{s=l,n=null,o&&(clearTimeout(o),o=null),t(...a)};return[(...a)=>{const l=Date.now(),u=l-s;u>=r?i(a,l):(n=a,o||(o=setTimeout(()=>{o=null,i(n)},r-u)))},()=>n&&i(n)]}const Ne=(t,e,s=3)=>{let r=0;const n=Hr(50,250);return Jr(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,l=i-r,u=n(l),d=i<=a;r=i;const h={loaded:i,total:a,progress:a?i/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a&&d?(a-i)/u:void 0,event:o,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(h)},s)},zt=(t,e)=>{const s=t!=null;return[r=>e[0]({lengthComputable:s,total:t,loaded:r}),e[1]]},Wt=t=>(...e)=>c.asap(()=>t(...e)),Kr=F.hasStandardBrowserEnv?((t,e)=>s=>(s=new URL(s,F.origin),t.protocol===s.protocol&&t.host===s.host&&(e||t.port===s.port)))(new URL(F.origin),F.navigator&&/(msie|trident)/i.test(F.navigator.userAgent)):()=>!0,Gr=F.hasStandardBrowserEnv?{write(t,e,s,r,n,o,i){if(typeof document>"u")return;const a=[`${t}=${encodeURIComponent(e)}`];c.isNumber(s)&&a.push(`expires=${new Date(s).toUTCString()}`),c.isString(r)&&a.push(`path=${r}`),c.isString(n)&&a.push(`domain=${n}`),o===!0&&a.push("secure"),c.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 Zr(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Yr(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Ht(t,e,s){let r=!Zr(e);return t&&(r||s==!1)?Yr(t,e):e}const Jt=t=>t instanceof V?{...t}:t;function ie(t,e){e=e||{};const s={};function r(u,d,h,y){return c.isPlainObject(u)&&c.isPlainObject(d)?c.merge.call({caseless:y},u,d):c.isPlainObject(d)?c.merge({},d):c.isArray(d)?d.slice():d}function n(u,d,h,y){if(c.isUndefined(d)){if(!c.isUndefined(u))return r(void 0,u,h,y)}else return r(u,d,h,y)}function o(u,d){if(!c.isUndefined(d))return r(void 0,d)}function i(u,d){if(c.isUndefined(d)){if(!c.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function a(u,d,h){if(h in e)return r(u,d);if(h in t)return r(void 0,u)}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:(u,d,h)=>n(Jt(u),Jt(d),h,!0)};return c.forEach(Object.keys({...t,...e}),function(u){const d=l[u]||n,h=d(t[u],e[u],u);c.isUndefined(h)&&d!==a||(s[u]=h)}),s}const Kt=t=>{const e=ie({},t);let{data:s,withXSRFToken:r,xsrfHeaderName:n,xsrfCookieName:o,headers:i,auth:a}=e;if(e.headers=i=V.from(i),e.url=Ft(Ht(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),c.isFormData(s)){if(F.hasStandardBrowserEnv||F.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(c.isFunction(s.getHeaders)){const l=s.getHeaders(),u=["content-type","content-length"];Object.entries(l).forEach(([d,h])=>{u.includes(d.toLowerCase())&&i.set(d,h)})}}if(F.hasStandardBrowserEnv&&(r&&c.isFunction(r)&&(r=r(e)),r||r!==!1&&Kr(e.url))){const l=n&&o&&Gr.read(o);l&&i.set(n,l)}return e},Xr=typeof XMLHttpRequest<"u",Qr=Xr&&function(t){return new Promise(function(e,s){const r=Kt(t);let n=r.data;const o=V.from(r.headers).normalize();let{responseType:i,onUploadProgress:a,onDownloadProgress:l}=r,u,d,h,y,f;function m(){y&&y(),f&&f(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let p=new XMLHttpRequest;p.open(r.method.toUpperCase(),r.url,!0),p.timeout=r.timeout;function O(){if(!p)return;const x=V.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),b={data:!i||i==="text"||i==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:x,config:t,request:p};Mt(function(A){e(A),m()},function(A){s(A),m()},b),p=null}"onloadend"in p?p.onloadend=O:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(O)},p.onabort=function(){p&&(s(new S("Request aborted",S.ECONNABORTED,t,p)),p=null)},p.onerror=function(x){const b=x&&x.message?x.message:"Network Error",A=new S(b,S.ERR_NETWORK,t,p);A.event=x||null,s(A),p=null},p.ontimeout=function(){let x=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const b=r.transitional||$t;r.timeoutErrorMessage&&(x=r.timeoutErrorMessage),s(new S(x,b.clarifyTimeoutError?S.ETIMEDOUT:S.ECONNABORTED,t,p)),p=null},n===void 0&&o.setContentType(null),"setRequestHeader"in p&&c.forEach(o.toJSON(),function(x,b){p.setRequestHeader(b,x)}),c.isUndefined(r.withCredentials)||(p.withCredentials=!!r.withCredentials),i&&i!=="json"&&(p.responseType=r.responseType),l&&([h,f]=Ne(l,!0),p.addEventListener("progress",h)),a&&p.upload&&([d,y]=Ne(a),p.upload.addEventListener("progress",d),p.upload.addEventListener("loadend",y)),(r.cancelToken||r.signal)&&(u=x=>{p&&(s(!x||x.type?new fe(null,t,p):x),p.abort(),p=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const I=Wr(r.url);if(I&&F.protocols.indexOf(I)===-1){s(new S("Unsupported protocol "+I+":",S.ERR_BAD_REQUEST,t));return}p.send(n||null)})},en=(t,e)=>{const{length:s}=t=t?t.filter(Boolean):[];if(e||s){let r=new AbortController,n;const o=function(u){if(!n){n=!0,a();const d=u instanceof Error?u:this.reason;r.abort(d instanceof S?d:new fe(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:l}=r;return l.unsubscribe=()=>c.asap(a),l}},tn=function*(t,e){let s=t.byteLength;if(s<e){yield t;return}let r=0,n;for(;r<s;)n=r+e,yield t.slice(r,n),r=n},sn=async function*(t,e){for await(const s of rn(t))yield*tn(s,e)},rn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:s,value:r}=await e.read();if(s)break;yield r}}finally{await e.cancel()}},Gt=(t,e,s,r)=>{const n=sn(t,e);let o=0,i,a=l=>{i||(i=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:d}=await n.next();if(u){a(),l.close();return}let h=d.byteLength;if(s){let y=o+=h;s(y)}l.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(l){return a(l),n.return()}},{highWaterMark:2})},Zt=64*1024,{isFunction:Pe}=c,nn=(({Request:t,Response:e})=>({Request:t,Response:e}))(c.global),{ReadableStream:Yt,TextEncoder:Xt}=c.global,Qt=(t,...e)=>{try{return!!t(...e)}catch{return!1}},on=t=>{t=c.merge.call({skipUndefined:!0},nn,t);const{fetch:e,Request:s,Response:r}=t,n=e?Pe(e):typeof fetch=="function",o=Pe(s),i=Pe(r);if(!n)return!1;const a=n&&Pe(Yt),l=n&&(typeof Xt=="function"?(m=>p=>m.encode(p))(new Xt):async m=>new Uint8Array(await new s(m).arrayBuffer())),u=o&&a&&Qt(()=>{let m=!1;const p=new s(F.origin,{body:new Yt,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!p}),d=i&&a&&Qt(()=>c.isReadableStream(new r("").body)),h={stream:d&&(m=>m.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!h[m]&&(h[m]=(p,O)=>{let I=p&&p[m];if(I)return I.call(p);throw new S(`Response type '${m}' is not supported`,S.ERR_NOT_SUPPORT,O)})});const y=async m=>{if(m==null)return 0;if(c.isBlob(m))return m.size;if(c.isSpecCompliantForm(m))return(await new s(F.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(c.isArrayBufferView(m)||c.isArrayBuffer(m))return m.byteLength;if(c.isURLSearchParams(m)&&(m=m+""),c.isString(m))return(await l(m)).byteLength},f=async(m,p)=>c.toFiniteNumber(m.getContentLength())??y(p);return async m=>{let{url:p,method:O,data:I,signal:x,cancelToken:b,timeout:A,onDownloadProgress:T,onUploadProgress:z,responseType:D,headers:k,withCredentials:L="same-origin",fetchOptions:le}=Kt(m),Q=e||fetch;D=D?(D+"").toLowerCase():"text";let G=en([x,b&&b.toAbortSignal()],A),Z=null;const q=G&&G.unsubscribe&&(()=>{G.unsubscribe()});let qe;try{if(z&&u&&O!=="get"&&O!=="head"&&(qe=await f(k,I))!==0){let M=new s(p,{method:"POST",body:I,duplex:"half"}),te;if(c.isFormData(I)&&(te=M.headers.get("content-type"))&&k.setContentType(te),M.body){const[ht,Me]=zt(qe,Ne(Wt(z)));I=Gt(M.body,Zt,ht,Me)}}c.isString(L)||(L=L?"include":"omit");const P=o&&"credentials"in s.prototype,v={...le,signal:G,method:O.toUpperCase(),headers:k.normalize().toJSON(),body:I,duplex:"half",credentials:P?L:void 0};Z=o&&new s(p,v);let R=await(o?Q(Z,le):Q(p,v));const W=d&&(D==="stream"||D==="response");if(d&&(T||W&&q)){const M={};["status","statusText","headers"].forEach(Rs=>{M[Rs]=R[Rs]});const te=c.toFiniteNumber(R.headers.get("content-length")),[ht,Me]=T&&zt(te,Ne(Wt(T),!0))||[];R=new r(Gt(R.body,Zt,ht,()=>{Me&&Me(),q&&q()}),M)}D=D||"text";let ee=await h[c.findKey(h,D)||"text"](R,m);return!W&&q&&q(),await new Promise((M,te)=>{Mt(M,te,{data:ee,headers:V.from(R.headers),status:R.status,statusText:R.statusText,config:m,request:Z})})}catch(P){throw q&&q(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new S("Network Error",S.ERR_NETWORK,m,Z),{cause:P.cause||P}):S.from(P,P&&P.code,m,Z)}}},an=new Map,es=t=>{let e=t&&t.env||{};const{fetch:s,Request:r,Response:n}=e,o=[r,n,s];let i=o.length,a=i,l,u,d=an;for(;a--;)l=o[a],u=d.get(l),u===void 0&&d.set(l,u=a?new Map:on(e)),d=u;return u};es();const tt={http:Er,xhr:Qr,fetch:{get:es}};c.forEach(tt,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const ts=t=>`- ${t}`,cn=t=>c.isFunction(t)||t===null||t===!1;function ln(t,e){t=c.isArray(t)?t:[t];const{length:s}=t;let r,n;const o={};for(let i=0;i<s;i++){r=t[i];let a;if(n=r,!cn(r)&&(n=tt[(a=String(r)).toLowerCase()],n===void 0))throw new S(`Unknown adapter '${a}'`);if(n&&(c.isFunction(n)||(n=n.get(e))))break;o[a||"#"+i]=n}if(!n){const i=Object.entries(o).map(([l,u])=>`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=s?i.length>1?`since :
|
|
1
|
+
System.register(["./main-40ee205662b8d03b0fda.js","vue","single-spa","./ValueWidget-BubIamVx-a56b1bb67ab7f77834e6.js","./IframeWidget-D9Vh0w2c-fe7c97c7b441849017be.js","./ValuelimitsbarWidget-DKTrV1RT-902ce99eafdf364370d2.js","vue-router","vuex","vuetify","./DetailsDialog-D-rjL4oc-ff97da486c63c518afca.js","./LimitsBar-IVv8t4FE-f813e751f5a05d588238.js","./VWidget-BcwkHuIT-bf6a6ce5d0c5b6a31798.js","./Widget-D4rzBHnr-3f2807322c003db85316.js","./LimitsbarWidget-Bo1JAoQp-72029a82062f0c81fcba.js","./BarColumn-DHHJBR3V-9295ddef137744696551.js"],function(As,Ui){"use strict";var ft,xe,ze,pt,mt,gt,w,j,C,bt,_,g,B,G,H,se,ue,_t,U,Ce,Oe,re,We,He,yt,wt,vt;return{setters:[E=>{ft=E.d,xe=E._,ze=E.R,pt=E.k,mt=E.M,gt=E.I},E=>{w=E.resolveComponent,j=E.createBlock,C=E.openBlock,bt=E.Teleport,_=E.createVNode,g=E.withCtx,B=E.createElementVNode,G=E.toDisplayString,H=E.createElementBlock,se=E.Fragment,ue=E.renderList,_t=E.ref,U=E.createTextVNode,Ce=E.mergeProps,Oe=E.createSlots,re=E.createCommentVNode,We=E.normalizeStyle,He=E.normalizeClass,yt=E.withKeys},null,E=>{wt=E.default},null,E=>{vt=E.default},null,null,null,null,null,null,null,null,null],execute:function(){var E=document.createElement("style");E.textContent=`.footer[data-v-c479a205]{padding-top:5px}.v-input[data-v-c479a205]{background-color:var(--color-background-base-default)}.textfield-green[data-v-c479a205]{color:#00c800}.textfield-yellow[data-v-c479a205]{color:#ffdc00}.textfield-red[data-v-c479a205]{color:#ff2d2d}.limits-table[data-v-c479a205]{margin-top:5px;margin-bottom:10px}.limits-table[data-v-c479a205] th{font-weight:700;background-color:var(--color-background-base-default)}.card-height[data-v-3c276116]{height:calc(100vh - 150px)}
|
|
2
|
+
/*$vite$:1*/`,document.head.appendChild(E);const Ts={__name:"TopBarMenu",props:{menu:{type:Object,required:!0},title:{type:String,required:!0}},emits:["submenu-click"],setup(t,{emit:e}){const s=e,r=_t(!1);function n(){r.value=!1}function o(i){return i.replaceAll(" ","-").toLowerCase()}return(i,a)=>{const l=w("v-icon"),u=w("v-btn"),d=w("v-divider"),h=w("v-list-item-title"),y=w("v-list-item"),f=w("v-list"),m=w("v-menu"),p=w("v-radio"),O=w("v-list-item-action"),I=w("v-radio-group"),x=w("v-checkbox");return C(),j(m,{modelValue:r.value,"onUpdate:modelValue":a[0]||(a[0]=b=>r.value=b),"close-on-content-click":!1},{activator:g(({props:b})=>[_(u,Ce(b,{variant:"outlined",class:"mx-1 menu-button",text:t.menu.label,"data-test":o(`${t.title} ${t.menu.label}`)}),{append:g(()=>[_(l,{class:"menu-button-icon"},{default:g(()=>[...a[1]||(a[1]=[U(" mdi-menu-down ",-1)])]),_:1})]),_:1},16,["text","data-test"])]),default:g(()=>[_(f,null,{default:g(()=>[(C(!0),H(se,null,ue(t.menu.items,(b,A)=>(C(),H(se,null,[b.divider?(C(),j(d,{key:A+"-divider"})):b.subMenu&&b.subMenu.length>0?(C(),H("div",{key:A+"-submenu"},[(C(),j(m,{key:A,"open-on-hover":"",location:"right"},{activator:g(({props:T})=>[(C(),j(y,Ce({ref_for:!0},T,{key:A,disabled:b.disabled}),Oe({append:g(()=>[_(l,null,{default:g(()=>[...a[2]||(a[2]=[U(" mdi-chevron-right ",-1)])]),_:1})]),default:g(()=>[!b.radio&&!b.checkbox?(C(),j(h,{key:0,style:We("cursor: pointer;"+(b.disabled?"opacity: 0.2":""))},{default:g(()=>[U(G(b.label),1)]),_:2},1032,["style"])):re("",!0)]),_:2},[b.icon?{name:"prepend",fn:g(()=>[_(l,{disabled:b.disabled},{default:g(()=>[U(G(b.icon),1)]),_:2},1032,["disabled"])]),key:"0"}:void 0]),1040,["disabled"]))]),default:g(()=>[_(f,null,{default:g(()=>[(C(!0),H(se,null,ue(b.subMenu,(T,z)=>(C(),j(y,{key:z,"prepend-icon":T.icon,onClick:D=>s("submenu-click",T)},{default:g(()=>[_(h,null,{default:g(()=>[U(G(T.label),1)]),_:2},1024)]),_:2},1032,["prepend-icon","onClick"]))),128))]),_:2},1024)]),_:2},1024))])):b.radioGroup?(C(),j(I,{key:A+"-radio-group",class:"ma-0 pa-0",density:"compact","hide-details":"","model-value":b.value,"onUpdate:modelValue":b.command},{default:g(()=>[(C(!0),H(se,null,ue(b.choices,(T,z)=>(C(),j(y,{key:z+"-choice"},{default:g(()=>[_(O,{class:"list-action"},{default:g(()=>[_(p,{color:"secondary",label:T.label,value:T.value,density:"compact","hide-details":""},null,8,["label","value"])]),_:2},1024)]),_:2},1024))),128))]),_:2},1032,["model-value","onUpdate:modelValue"])):(C(),j(y,{key:A+"-list",disabled:b.disabled,"data-test":o(`${t.title} ${t.menu.label} ${b.label}`),onClick:()=>{b.command(b),b.checkbox||n()}},Oe({default:g(()=>[b.checkbox?(C(),j(O,{key:0,class:"list-action"},{default:g(()=>[_(x,{modelValue:b.checked,"onUpdate:modelValue":T=>b.checked=T,label:b.label,color:"secondary",density:"compact","hide-details":""},null,8,["modelValue","onUpdate:modelValue","label"])]),_:2},1024)):re("",!0),!b.radio&&!b.checkbox?(C(),j(h,{key:1,style:We("cursor: pointer;"+(b.disabled?"opacity: 0.2":""))},{default:g(()=>[U(G(b.label),1)]),_:2},1032,["style"])):re("",!0)]),_:2},[b.icon?{name:"prepend",fn:g(()=>[_(l,{icon:b.icon,disabled:b.disabled},null,8,["icon","disabled"])]),key:"0"}:void 0]),1032,["disabled","data-test","onClick"]))],64))),256))]),_:1})]),_:1},8,["modelValue"])}}},Ls={components:{TopBarMenu:Ts},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 Ns(t,e,s,r,n,o){const i=w("v-col"),a=w("v-row"),l=w("TopBarMenu");return C(),j(bt,{to:"#openc3-menu"},[_(a,{"no-gutters":""},{default:g(()=>[_(i,{"align-self":"end"},{default:g(()=>[B("span",js,G(s.title),1)]),_:1})]),_:1}),_(a,{dense:"",class:"flex-nowrap"},{default:g(()=>[(C(!0),H(se,null,ue(s.menus,(u,d)=>(C(),j(l,{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 Ps=ft(Ls,[["render",Ns],["__scopeId","data-v-b6581c4c"]]);var Us=Object.defineProperty,Fs=(t,e,s)=>e in t?Us(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,ke=(t,e,s)=>Fs(t,typeof e!="symbol"?e+"":e,s);function St(t,e){return function(){return t.apply(e,arguments)}}const{toString:Ds}=Object.prototype,{getPrototypeOf:Je}=Object,{iterator:Re,toStringTag:Et}=Symbol,Ie=(t=>e=>{const s=Ds.call(e);return t[s]||(t[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),J=t=>(t=t.toLowerCase(),e=>Ie(e)===t),Ae=t=>e=>typeof e===t,{isArray:de}=Array,he=Ae("undefined");function me(t){return t!==null&&!he(t)&&t.constructor!==null&&!he(t.constructor)&&$(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const xt=J("ArrayBuffer");function Bs(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&xt(t.buffer),e}const $s=Ae("string"),$=Ae("function"),Ct=Ae("number"),ge=t=>t!==null&&typeof t=="object",Vs=t=>t===!0||t===!1,Te=t=>{if(Ie(t)!=="object")return!1;const e=Je(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Et in t)&&!(Re in t)},qs=t=>{if(!ge(t)||me(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Ms=J("Date"),zs=J("File"),Ws=J("Blob"),Hs=J("FileList"),Js=t=>ge(t)&&$(t.pipe),Ks=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||$(t.append)&&((e=Ie(t))==="formdata"||e==="object"&&$(t.toString)&&t.toString()==="[object FormData]"))},Zs=J("URLSearchParams"),[Ys,Gs,Xs,Qs]=["ReadableStream","Request","Response","Headers"].map(J),er=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function be(t,e,{allOwnKeys:s=!1}={}){if(t===null||typeof t>"u")return;let r,n;if(typeof t!="object"&&(t=[t]),de(t))for(r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else{if(me(t))return;const o=s?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let a;for(r=0;r<i;r++)a=o[r],e.call(null,t[a],a,t)}}function Ot(t,e){if(me(t))return null;e=e.toLowerCase();const s=Object.keys(t);let r=s.length,n;for(;r-- >0;)if(n=s[r],e===n.toLowerCase())return n;return null}const ne=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,kt=t=>!he(t)&&t!==ne;function Ke(){const{caseless:t,skipUndefined:e}=kt(this)&&this||{},s={},r=(n,o)=>{const i=t&&Ot(s,o)||o;Te(s[i])&&Te(n)?s[i]=Ke(s[i],n):Te(n)?s[i]=Ke({},n):de(n)?s[i]=n.slice():(!e||!he(n))&&(s[i]=n)};for(let n=0,o=arguments.length;n<o;n++)arguments[n]&&be(arguments[n],r);return s}const tr=(t,e,s,{allOwnKeys:r}={})=>(be(e,(n,o)=>{s&&$(n)?t[o]=St(n,s):t[o]=n},{allOwnKeys:r}),t),sr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rr=(t,e,s,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),s&&Object.assign(t.prototype,s)},nr=(t,e,s,r)=>{let n,o,i;const a={};if(e=e||{},t==null)return e;do{for(n=Object.getOwnPropertyNames(t),o=n.length;o-- >0;)i=n[o],(!r||r(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},ir=(t,e,s)=>{t=String(t),(s===void 0||s>t.length)&&(s=t.length),s-=e.length;const r=t.indexOf(e,s);return r!==-1&&r===s},or=t=>{if(!t)return null;if(de(t))return t;let e=t.length;if(!Ct(e))return null;const s=new Array(e);for(;e-- >0;)s[e]=t[e];return s},ar=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Je(Uint8Array)),cr=(t,e)=>{const s=(t&&t[Re]).call(t);let r;for(;(r=s.next())&&!r.done;){const n=r.value;e.call(t,n[0],n[1])}},lr=(t,e)=>{let s;const r=[];for(;(s=t.exec(e))!==null;)r.push(s);return r},ur=J("HTMLFormElement"),dr=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,s,r){return s.toUpperCase()+r}),Rt=(({hasOwnProperty:t})=>(e,s)=>t.call(e,s))(Object.prototype),hr=J("RegExp"),It=(t,e)=>{const s=Object.getOwnPropertyDescriptors(t),r={};be(s,(n,o)=>{let i;(i=e(n,o,t))!==!1&&(r[o]=i||n)}),Object.defineProperties(t,r)},fr=t=>{It(t,(e,s)=>{if($(t)&&["arguments","caller","callee"].indexOf(s)!==-1)return!1;const r=t[s];if($(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},pr=(t,e)=>{const s={},r=n=>{n.forEach(o=>{s[o]=!0})};return de(t)?r(t):r(String(t).split(e)),s},mr=()=>{},gr=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function br(t){return!!(t&&$(t.append)&&t[Et]==="FormData"&&t[Re])}const _r=t=>{const e=new Array(10),s=(r,n)=>{if(ge(r)){if(e.indexOf(r)>=0)return;if(me(r))return r;if(!("toJSON"in r)){e[n]=r;const o=de(r)?[]:{};return be(r,(i,a)=>{const l=s(i,n+1);!he(l)&&(o[a]=l)}),e[n]=void 0,o}}return r};return s(t,0)},yr=J("AsyncFunction"),wr=t=>t&&(ge(t)||$(t))&&$(t.then)&&$(t.catch),At=((t,e)=>t?setImmediate:e?((s,r)=>(ne.addEventListener("message",({source:n,data:o})=>{n===ne&&o===s&&r.length&&r.shift()()},!1),n=>{r.push(n),ne.postMessage(s,"*")}))(`axios@${Math.random()}`,[]):s=>setTimeout(s))(typeof setImmediate=="function",$(ne.postMessage)),vr=typeof queueMicrotask<"u"?queueMicrotask.bind(ne):typeof process<"u"&&process.nextTick||At,Sr=t=>t!=null&&$(t[Re]),c={isArray:de,isArrayBuffer:xt,isBuffer:me,isFormData:Ks,isArrayBufferView:Bs,isString:$s,isNumber:Ct,isBoolean:Vs,isObject:ge,isPlainObject:Te,isEmptyObject:qs,isReadableStream:Ys,isRequest:Gs,isResponse:Xs,isHeaders:Qs,isUndefined:he,isDate:Ms,isFile:zs,isBlob:Ws,isRegExp:hr,isFunction:$,isStream:Js,isURLSearchParams:Zs,isTypedArray:ar,isFileList:Hs,forEach:be,merge:Ke,extend:tr,trim:er,stripBOM:sr,inherits:rr,toFlatObject:nr,kindOf:Ie,kindOfTest:J,endsWith:ir,toArray:or,forEachEntry:cr,matchAll:lr,isHTMLForm:ur,hasOwnProperty:Rt,hasOwnProp:Rt,reduceDescriptors:It,freezeMethods:fr,toObjectSet:pr,toCamelCase:dr,noop:mr,toFiniteNumber:gr,findKey:Ot,global:ne,isContextDefined:kt,isSpecCompliantForm:br,toJSONObject:_r,isAsyncFn:yr,isThenable:wr,setImmediate:At,asap:vr,isIterable:Sr};function S(t,e,s,r,n){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),r&&(this.request=r),n&&(this.response=n,this.status=n.status?n.status:null)}c.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:c.toJSONObject(this.config),code:this.code,status:this.status}}});const Tt=S.prototype,Lt={};["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=>{Lt[t]={value:t}}),Object.defineProperties(S,Lt),Object.defineProperty(Tt,"isAxiosError",{value:!0}),S.from=(t,e,s,r,n,o)=>{const i=Object.create(Tt);c.toFlatObject(t,i,function(u){return u!==Error.prototype},u=>u!=="isAxiosError");const a=t&&t.message?t.message:"Error",l=e==null&&t?t.code:e;return S.call(i,a,l,s,r,n),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 Er=null;function Ze(t){return c.isPlainObject(t)||c.isArray(t)}function jt(t){return c.endsWith(t,"[]")?t.slice(0,-2):t}function Nt(t,e,s){return t?t.concat(e).map(function(r,n){return r=jt(r),!s&&n?"["+r+"]":r}).join(s?".":""):e}function xr(t){return c.isArray(t)&&!t.some(Ze)}const Cr=c.toFlatObject(c,{},null,function(t){return/^is[A-Z]/.test(t)});function Le(t,e,s){if(!c.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,s=c.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,m){return!c.isUndefined(m[f])});const r=s.metaTokens,n=s.visitor||u,o=s.dots,i=s.indexes,a=(s.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(e);if(!c.isFunction(n))throw new TypeError("visitor must be a function");function l(f){if(f===null)return"";if(c.isDate(f))return f.toISOString();if(c.isBoolean(f))return f.toString();if(!a&&c.isBlob(f))throw new S("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(f)||c.isTypedArray(f)?a&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,m,p){let O=f;if(f&&!p&&typeof f=="object"){if(c.endsWith(m,"{}"))m=r?m:m.slice(0,-2),f=JSON.stringify(f);else if(c.isArray(f)&&xr(f)||(c.isFileList(f)||c.endsWith(m,"[]"))&&(O=c.toArray(f)))return m=jt(m),O.forEach(function(I,x){!(c.isUndefined(I)||I===null)&&e.append(i===!0?Nt([m],x,o):i===null?m:m+"[]",l(I))}),!1}return Ze(f)?!0:(e.append(Nt(p,m,o),l(f)),!1)}const d=[],h=Object.assign(Cr,{defaultVisitor:u,convertValue:l,isVisitable:Ze});function y(f,m){if(!c.isUndefined(f)){if(d.indexOf(f)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(f),c.forEach(f,function(p,O){(!(c.isUndefined(p)||p===null)&&n.call(e,p,c.isString(O)?O.trim():O,m,h))===!0&&y(p,m?m.concat(O):[O])}),d.pop()}}if(!c.isObject(t))throw new TypeError("data must be an object");return y(t),e}function Pt(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function Ye(t,e){this._pairs=[],t&&Le(t,this,e)}const Ut=Ye.prototype;Ut.append=function(t,e){this._pairs.push([t,e])},Ut.toString=function(t){const e=t?function(s){return t.call(this,s,Pt)}:Pt;return this._pairs.map(function(s){return e(s[0])+"="+e(s[1])},"").join("&")};function Or(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ft(t,e,s){if(!e)return t;const r=s&&s.encode||Or;c.isFunction(s)&&(s={serialize:s});const n=s&&s.serialize;let o;if(n?o=n(e,s):o=c.isURLSearchParams(e)?e.toString():new Ye(e,s).toString(r),o){const i=t.indexOf("#");i!==-1&&(t=t.slice(0,i)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class Dt{constructor(){this.handlers=[]}use(e,s,r){return this.handlers.push({fulfilled:e,rejected:s,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){c.forEach(this.handlers,function(s){s!==null&&e(s)})}}const Bt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},kr=typeof URLSearchParams<"u"?URLSearchParams:Ye,Rr=typeof FormData<"u"?FormData:null,Ir=typeof Blob<"u"?Blob:null,Ar={isBrowser:!0,classes:{URLSearchParams:kr,FormData:Rr,Blob:Ir},protocols:["http","https","file","blob","url","data"]},Ge=typeof window<"u"&&typeof document<"u",Xe=typeof navigator=="object"&&navigator||void 0,Tr=Ge&&(!Xe||["ReactNative","NativeScript","NS"].indexOf(Xe.product)<0),Lr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",jr=Ge&&window.location.href||"http://localhost",Nr=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ge,hasStandardBrowserEnv:Tr,hasStandardBrowserWebWorkerEnv:Lr,navigator:Xe,origin:jr},Symbol.toStringTag,{value:"Module"})),F={...Nr,...Ar};function Pr(t,e){return Le(t,new F.classes.URLSearchParams,{visitor:function(s,r,n,o){return F.isNode&&c.isBuffer(s)?(this.append(r,s.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function Ur(t){return c.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Fr(t){const e={},s=Object.keys(t);let r;const n=s.length;let o;for(r=0;r<n;r++)o=s[r],e[o]=t[o];return e}function $t(t){function e(s,r,n,o){let i=s[o++];if(i==="__proto__")return!0;const a=Number.isFinite(+i),l=o>=s.length;return i=!i&&c.isArray(n)?n.length:i,l?(c.hasOwnProp(n,i)?n[i]=[n[i],r]:n[i]=r,!a):((!n[i]||!c.isObject(n[i]))&&(n[i]=[]),e(s,r,n[i],o)&&c.isArray(n[i])&&(n[i]=Fr(n[i])),!a)}if(c.isFormData(t)&&c.isFunction(t.entries)){const s={};return c.forEachEntry(t,(r,n)=>{e(Ur(r),n,s,0)}),s}return null}function Dr(t,e,s){if(c.isString(t))try{return(e||JSON.parse)(t),c.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(s||JSON.stringify)(t)}const _e={transitional:Bt,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const s=e.getContentType()||"",r=s.indexOf("application/json")>-1,n=c.isObject(t);if(n&&c.isHTMLForm(t)&&(t=new FormData(t)),c.isFormData(t))return r?JSON.stringify($t(t)):t;if(c.isArrayBuffer(t)||c.isBuffer(t)||c.isStream(t)||c.isFile(t)||c.isBlob(t)||c.isReadableStream(t))return t;if(c.isArrayBufferView(t))return t.buffer;if(c.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let o;if(n){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Pr(t,this.formSerializer).toString();if((o=c.isFileList(t))||s.indexOf("multipart/form-data")>-1){const i=this.env&&this.env.FormData;return Le(o?{"files[]":t}:t,i&&new i,this.formSerializer)}}return n||r?(e.setContentType("application/json",!1),Dr(t)):t}],transformResponse:[function(t){const e=this.transitional||_e.transitional,s=e&&e.forcedJSONParsing,r=this.responseType==="json";if(c.isResponse(t)||c.isReadableStream(t))return t;if(t&&c.isString(t)&&(s&&!this.responseType||r)){const n=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t,this.parseReviver)}catch(o){if(n)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:F.classes.FormData,Blob:F.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};c.forEach(["delete","get","head","post","put","patch"],t=>{_e.headers[t]={}});const Br=c.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"]),$r=t=>{const e={};let s,r,n;return t&&t.split(`
|
|
3
|
+
`).forEach(function(o){n=o.indexOf(":"),s=o.substring(0,n).trim().toLowerCase(),r=o.substring(n+1).trim(),!(!s||e[s]&&Br[s])&&(s==="set-cookie"?e[s]?e[s].push(r):e[s]=[r]:e[s]=e[s]?e[s]+", "+r:r)}),e},Vt=Symbol("internals");function ye(t){return t&&String(t).trim().toLowerCase()}function je(t){return t===!1||t==null?t:c.isArray(t)?t.map(je):String(t)}function Vr(t){const e=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=s.exec(t);)e[r[1]]=r[2];return e}const qr=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Qe(t,e,s,r,n){if(c.isFunction(r))return r.call(this,e,s);if(n&&(e=s),!!c.isString(e)){if(c.isString(r))return e.indexOf(r)!==-1;if(c.isRegExp(r))return r.test(e)}}function Mr(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,s,r)=>s.toUpperCase()+r)}function zr(t,e){const s=c.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+s,{value:function(n,o,i){return this[r].call(this,e,n,o,i)},configurable:!0})})}let V=class{constructor(t){t&&this.set(t)}set(t,e,s){const r=this;function n(i,a,l){const u=ye(a);if(!u)throw new Error("header name must be a non-empty string");const d=c.findKey(r,u);(!d||r[d]===void 0||l===!0||l===void 0&&r[d]!==!1)&&(r[d||a]=je(i))}const o=(i,a)=>c.forEach(i,(l,u)=>n(l,u,a));if(c.isPlainObject(t)||t instanceof this.constructor)o(t,e);else if(c.isString(t)&&(t=t.trim())&&!qr(t))o($r(t),e);else if(c.isObject(t)&&c.isIterable(t)){let i={},a,l;for(const u of t){if(!c.isArray(u))throw TypeError("Object iterator must return a key-value pair");i[l=u[0]]=(a=i[l])?c.isArray(a)?[...a,u[1]]:[a,u[1]]:u[1]}o(i,e)}else t!=null&&n(e,t,s);return this}get(t,e){if(t=ye(t),t){const s=c.findKey(this,t);if(s){const r=this[s];if(!e)return r;if(e===!0)return Vr(r);if(c.isFunction(e))return e.call(this,r,s);if(c.isRegExp(e))return e.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=ye(t),t){const s=c.findKey(this,t);return!!(s&&this[s]!==void 0&&(!e||Qe(this,this[s],s,e)))}return!1}delete(t,e){const s=this;let r=!1;function n(o){if(o=ye(o),o){const i=c.findKey(s,o);i&&(!e||Qe(s,s[i],i,e))&&(delete s[i],r=!0)}}return c.isArray(t)?t.forEach(n):n(t),r}clear(t){const e=Object.keys(this);let s=e.length,r=!1;for(;s--;){const n=e[s];(!t||Qe(this,this[n],n,t,!0))&&(delete this[n],r=!0)}return r}normalize(t){const e=this,s={};return c.forEach(this,(r,n)=>{const o=c.findKey(s,n);if(o){e[o]=je(r),delete e[n];return}const i=t?Mr(n):String(n).trim();i!==n&&delete e[n],e[i]=je(r),s[i]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return c.forEach(this,(s,r)=>{s!=null&&s!==!1&&(e[r]=t&&c.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(r=>s.set(r)),s}static accessor(t){const e=(this[Vt]=this[Vt]={accessors:{}}).accessors,s=this.prototype;function r(n){const o=ye(n);e[o]||(zr(s,n),e[o]=!0)}return c.isArray(t)?t.forEach(r):r(t),this}};V.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),c.reduceDescriptors(V.prototype,({value:t},e)=>{let s=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[s]=r}}}),c.freezeMethods(V);function et(t,e){const s=this||_e,r=e||s,n=V.from(r.headers);let o=r.data;return c.forEach(t,function(i){o=i.call(s,o,n.normalize(),e?e.status:void 0)}),n.normalize(),o}function qt(t){return!!(t&&t.__CANCEL__)}function fe(t,e,s){S.call(this,t??"canceled",S.ERR_CANCELED,e,s),this.name="CanceledError"}c.inherits(fe,S,{__CANCEL__:!0});function Mt(t,e,s){const r=s.config.validateStatus;!s.status||!r||r(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 Wr(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Hr(t,e){t=t||10;const s=new Array(t),r=new Array(t);let n=0,o=0,i;return e=e!==void 0?e:1e3,function(a){const l=Date.now(),u=r[o];i||(i=l),s[n]=a,r[n]=l;let d=o,h=0;for(;d!==n;)h+=s[d++],d=d%t;if(n=(n+1)%t,n===o&&(o=(o+1)%t),l-i<e)return;const y=u&&l-u;return y?Math.round(h*1e3/y):void 0}}function Jr(t,e){let s=0,r=1e3/e,n,o;const i=(a,l=Date.now())=>{s=l,n=null,o&&(clearTimeout(o),o=null),t(...a)};return[(...a)=>{const l=Date.now(),u=l-s;u>=r?i(a,l):(n=a,o||(o=setTimeout(()=>{o=null,i(n)},r-u)))},()=>n&&i(n)]}const Ne=(t,e,s=3)=>{let r=0;const n=Hr(50,250);return Jr(o=>{const i=o.loaded,a=o.lengthComputable?o.total:void 0,l=i-r,u=n(l),d=i<=a;r=i;const h={loaded:i,total:a,progress:a?i/a:void 0,bytes:l,rate:u||void 0,estimated:u&&a&&d?(a-i)/u:void 0,event:o,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(h)},s)},zt=(t,e)=>{const s=t!=null;return[r=>e[0]({lengthComputable:s,total:t,loaded:r}),e[1]]},Wt=t=>(...e)=>c.asap(()=>t(...e)),Kr=F.hasStandardBrowserEnv?((t,e)=>s=>(s=new URL(s,F.origin),t.protocol===s.protocol&&t.host===s.host&&(e||t.port===s.port)))(new URL(F.origin),F.navigator&&/(msie|trident)/i.test(F.navigator.userAgent)):()=>!0,Zr=F.hasStandardBrowserEnv?{write(t,e,s,r,n,o,i){if(typeof document>"u")return;const a=[`${t}=${encodeURIComponent(e)}`];c.isNumber(s)&&a.push(`expires=${new Date(s).toUTCString()}`),c.isString(r)&&a.push(`path=${r}`),c.isString(n)&&a.push(`domain=${n}`),o===!0&&a.push("secure"),c.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 Yr(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Gr(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Ht(t,e,s){let r=!Yr(e);return t&&(r||s==!1)?Gr(t,e):e}const Jt=t=>t instanceof V?{...t}:t;function ie(t,e){e=e||{};const s={};function r(u,d,h,y){return c.isPlainObject(u)&&c.isPlainObject(d)?c.merge.call({caseless:y},u,d):c.isPlainObject(d)?c.merge({},d):c.isArray(d)?d.slice():d}function n(u,d,h,y){if(c.isUndefined(d)){if(!c.isUndefined(u))return r(void 0,u,h,y)}else return r(u,d,h,y)}function o(u,d){if(!c.isUndefined(d))return r(void 0,d)}function i(u,d){if(c.isUndefined(d)){if(!c.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function a(u,d,h){if(h in e)return r(u,d);if(h in t)return r(void 0,u)}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:(u,d,h)=>n(Jt(u),Jt(d),h,!0)};return c.forEach(Object.keys({...t,...e}),function(u){const d=l[u]||n,h=d(t[u],e[u],u);c.isUndefined(h)&&d!==a||(s[u]=h)}),s}const Kt=t=>{const e=ie({},t);let{data:s,withXSRFToken:r,xsrfHeaderName:n,xsrfCookieName:o,headers:i,auth:a}=e;if(e.headers=i=V.from(i),e.url=Ft(Ht(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),c.isFormData(s)){if(F.hasStandardBrowserEnv||F.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(c.isFunction(s.getHeaders)){const l=s.getHeaders(),u=["content-type","content-length"];Object.entries(l).forEach(([d,h])=>{u.includes(d.toLowerCase())&&i.set(d,h)})}}if(F.hasStandardBrowserEnv&&(r&&c.isFunction(r)&&(r=r(e)),r||r!==!1&&Kr(e.url))){const l=n&&o&&Zr.read(o);l&&i.set(n,l)}return e},Xr=typeof XMLHttpRequest<"u",Qr=Xr&&function(t){return new Promise(function(e,s){const r=Kt(t);let n=r.data;const o=V.from(r.headers).normalize();let{responseType:i,onUploadProgress:a,onDownloadProgress:l}=r,u,d,h,y,f;function m(){y&&y(),f&&f(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let p=new XMLHttpRequest;p.open(r.method.toUpperCase(),r.url,!0),p.timeout=r.timeout;function O(){if(!p)return;const x=V.from("getAllResponseHeaders"in p&&p.getAllResponseHeaders()),b={data:!i||i==="text"||i==="json"?p.responseText:p.response,status:p.status,statusText:p.statusText,headers:x,config:t,request:p};Mt(function(A){e(A),m()},function(A){s(A),m()},b),p=null}"onloadend"in p?p.onloadend=O:p.onreadystatechange=function(){!p||p.readyState!==4||p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0)||setTimeout(O)},p.onabort=function(){p&&(s(new S("Request aborted",S.ECONNABORTED,t,p)),p=null)},p.onerror=function(x){const b=x&&x.message?x.message:"Network Error",A=new S(b,S.ERR_NETWORK,t,p);A.event=x||null,s(A),p=null},p.ontimeout=function(){let x=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const b=r.transitional||Bt;r.timeoutErrorMessage&&(x=r.timeoutErrorMessage),s(new S(x,b.clarifyTimeoutError?S.ETIMEDOUT:S.ECONNABORTED,t,p)),p=null},n===void 0&&o.setContentType(null),"setRequestHeader"in p&&c.forEach(o.toJSON(),function(x,b){p.setRequestHeader(b,x)}),c.isUndefined(r.withCredentials)||(p.withCredentials=!!r.withCredentials),i&&i!=="json"&&(p.responseType=r.responseType),l&&([h,f]=Ne(l,!0),p.addEventListener("progress",h)),a&&p.upload&&([d,y]=Ne(a),p.upload.addEventListener("progress",d),p.upload.addEventListener("loadend",y)),(r.cancelToken||r.signal)&&(u=x=>{p&&(s(!x||x.type?new fe(null,t,p):x),p.abort(),p=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const I=Wr(r.url);if(I&&F.protocols.indexOf(I)===-1){s(new S("Unsupported protocol "+I+":",S.ERR_BAD_REQUEST,t));return}p.send(n||null)})},en=(t,e)=>{const{length:s}=t=t?t.filter(Boolean):[];if(e||s){let r=new AbortController,n;const o=function(u){if(!n){n=!0,a();const d=u instanceof Error?u:this.reason;r.abort(d instanceof S?d:new fe(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:l}=r;return l.unsubscribe=()=>c.asap(a),l}},tn=function*(t,e){let s=t.byteLength;if(s<e){yield t;return}let r=0,n;for(;r<s;)n=r+e,yield t.slice(r,n),r=n},sn=async function*(t,e){for await(const s of rn(t))yield*tn(s,e)},rn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:s,value:r}=await e.read();if(s)break;yield r}}finally{await e.cancel()}},Zt=(t,e,s,r)=>{const n=sn(t,e);let o=0,i,a=l=>{i||(i=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:d}=await n.next();if(u){a(),l.close();return}let h=d.byteLength;if(s){let y=o+=h;s(y)}l.enqueue(new Uint8Array(d))}catch(u){throw a(u),u}},cancel(l){return a(l),n.return()}},{highWaterMark:2})},Yt=64*1024,{isFunction:Pe}=c,nn=(({Request:t,Response:e})=>({Request:t,Response:e}))(c.global),{ReadableStream:Gt,TextEncoder:Xt}=c.global,Qt=(t,...e)=>{try{return!!t(...e)}catch{return!1}},on=t=>{t=c.merge.call({skipUndefined:!0},nn,t);const{fetch:e,Request:s,Response:r}=t,n=e?Pe(e):typeof fetch=="function",o=Pe(s),i=Pe(r);if(!n)return!1;const a=n&&Pe(Gt),l=n&&(typeof Xt=="function"?(m=>p=>m.encode(p))(new Xt):async m=>new Uint8Array(await new s(m).arrayBuffer())),u=o&&a&&Qt(()=>{let m=!1;const p=new s(F.origin,{body:new Gt,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!p}),d=i&&a&&Qt(()=>c.isReadableStream(new r("").body)),h={stream:d&&(m=>m.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!h[m]&&(h[m]=(p,O)=>{let I=p&&p[m];if(I)return I.call(p);throw new S(`Response type '${m}' is not supported`,S.ERR_NOT_SUPPORT,O)})});const y=async m=>{if(m==null)return 0;if(c.isBlob(m))return m.size;if(c.isSpecCompliantForm(m))return(await new s(F.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(c.isArrayBufferView(m)||c.isArrayBuffer(m))return m.byteLength;if(c.isURLSearchParams(m)&&(m=m+""),c.isString(m))return(await l(m)).byteLength},f=async(m,p)=>c.toFiniteNumber(m.getContentLength())??y(p);return async m=>{let{url:p,method:O,data:I,signal:x,cancelToken:b,timeout:A,onDownloadProgress:T,onUploadProgress:z,responseType:D,headers:k,withCredentials:L="same-origin",fetchOptions:le}=Kt(m),Q=e||fetch;D=D?(D+"").toLowerCase():"text";let Z=en([x,b&&b.toAbortSignal()],A),Y=null;const q=Z&&Z.unsubscribe&&(()=>{Z.unsubscribe()});let qe;try{if(z&&u&&O!=="get"&&O!=="head"&&(qe=await f(k,I))!==0){let M=new s(p,{method:"POST",body:I,duplex:"half"}),te;if(c.isFormData(I)&&(te=M.headers.get("content-type"))&&k.setContentType(te),M.body){const[ht,Me]=zt(qe,Ne(Wt(z)));I=Zt(M.body,Yt,ht,Me)}}c.isString(L)||(L=L?"include":"omit");const P=o&&"credentials"in s.prototype,v={...le,signal:Z,method:O.toUpperCase(),headers:k.normalize().toJSON(),body:I,duplex:"half",credentials:P?L:void 0};Y=o&&new s(p,v);let R=await(o?Q(Y,le):Q(p,v));const W=d&&(D==="stream"||D==="response");if(d&&(T||W&&q)){const M={};["status","statusText","headers"].forEach(Rs=>{M[Rs]=R[Rs]});const te=c.toFiniteNumber(R.headers.get("content-length")),[ht,Me]=T&&zt(te,Ne(Wt(T),!0))||[];R=new r(Zt(R.body,Yt,ht,()=>{Me&&Me(),q&&q()}),M)}D=D||"text";let ee=await h[c.findKey(h,D)||"text"](R,m);return!W&&q&&q(),await new Promise((M,te)=>{Mt(M,te,{data:ee,headers:V.from(R.headers),status:R.status,statusText:R.statusText,config:m,request:Y})})}catch(P){throw q&&q(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new S("Network Error",S.ERR_NETWORK,m,Y),{cause:P.cause||P}):S.from(P,P&&P.code,m,Y)}}},an=new Map,es=t=>{let e=t&&t.env||{};const{fetch:s,Request:r,Response:n}=e,o=[r,n,s];let i=o.length,a=i,l,u,d=an;for(;a--;)l=o[a],u=d.get(l),u===void 0&&d.set(l,u=a?new Map:on(e)),d=u;return u};es();const tt={http:Er,xhr:Qr,fetch:{get:es}};c.forEach(tt,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const ts=t=>`- ${t}`,cn=t=>c.isFunction(t)||t===null||t===!1;function ln(t,e){t=c.isArray(t)?t:[t];const{length:s}=t;let r,n;const o={};for(let i=0;i<s;i++){r=t[i];let a;if(n=r,!cn(r)&&(n=tt[(a=String(r)).toLowerCase()],n===void 0))throw new S(`Unknown adapter '${a}'`);if(n&&(c.isFunction(n)||(n=n.get(e))))break;o[a||"#"+i]=n}if(!n){const i=Object.entries(o).map(([l,u])=>`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=s?i.length>1?`since :
|
|
5
5
|
`+i.map(ts).join(`
|
|
6
6
|
`):" "+ts(i[0]):"as no adapter specified";throw new S("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return n}const ss={getAdapter:ln,adapters:tt};function st(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new fe(null,t)}function rs(t){return st(t),t.headers=V.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),ss.getAdapter(t.adapter||_e.adapter,t)(t).then(function(e){return st(t),e.data=et.call(t,t.transformResponse,e),e.headers=V.from(e.headers),e},function(e){return qt(e)||(st(t),e&&e.response&&(e.response.data=et.call(t,t.transformResponse,e.response),e.response.headers=V.from(e.response.headers))),Promise.reject(e)})}const ns="1.13.2",Ue={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Ue[t]=function(s){return typeof s===t||"a"+(e<1?"n ":" ")+t}});const is={};Ue.transitional=function(t,e,s){function r(n,o){return"[Axios v"+ns+"] Transitional option '"+n+"'"+o+(s?". "+s:"")}return(n,o,i)=>{if(t===!1)throw new S(r(o," has been removed"+(e?" in "+e:"")),S.ERR_DEPRECATED);return e&&!is[o]&&(is[o]=!0,console.warn(r(o," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(n,o,i):!0}},Ue.spelling=function(t){return(e,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function un(t,e,s){if(typeof t!="object")throw new S("options must be an object",S.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let n=r.length;for(;n-- >0;){const o=r[n],i=e[o];if(i){const a=t[o],l=a===void 0||i(a,o,t);if(l!==!0)throw new S("option "+o+" must be "+l,S.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new S("Unknown option "+o,S.ERR_BAD_OPTION)}}const Fe={assertOptions:un,validators:Ue},X=Fe.validators;let oe=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Dt,response:new Dt}}async request(t,e){try{return await this._request(t,e)}catch(s){if(s instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const n=r.stack?r.stack.replace(/^.+\n/,""):"";try{s.stack?n&&!String(s.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(s.stack+=`
|
|
7
|
-
`+n):s.stack=n}catch{}}throw s}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=ie(this.defaults,e);const{transitional:s,paramsSerializer:r,headers:n}=e;s!==void 0&&Fe.assertOptions(s,{silentJSONParsing:X.transitional(X.boolean),forcedJSONParsing:X.transitional(X.boolean),clarifyTimeoutError:X.transitional(X.boolean)},!1),r!=null&&(c.isFunction(r)?e.paramsSerializer={serialize:r}:Fe.assertOptions(r,{encode:X.function,serialize:X.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Fe.assertOptions(e,{baseUrl:X.spelling("baseURL"),withXsrfToken:X.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=n&&c.merge(n.common,n[e.method]);n&&c.forEach(["delete","get","head","post","put","patch","common"],f=>{delete n[f]}),e.headers=V.concat(o,n);const i=[];let a=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(e)===!1||(a=a&&f.synchronous,i.unshift(f.fulfilled,f.rejected))});const l=[];this.interceptors.response.forEach(function(f){l.push(f.fulfilled,f.rejected)});let u,d=0,h;if(!a){const f=[rs.bind(this),void 0];for(f.unshift(...i),f.push(...l),h=f.length,u=Promise.resolve(e);d<h;)u=u.then(f[d++],f[d++]);return u}h=i.length;let y=e;for(;d<h;){const f=i[d++],m=i[d++];try{y=f(y)}catch(p){m.call(this,p);break}}try{u=rs.call(this,y)}catch(f){return Promise.reject(f)}for(d=0,h=l.length;d<h;)u=u.then(l[d++],l[d++]);return u}getUri(t){t=ie(this.defaults,t);const e=Ht(t.baseURL,t.url,t.allowAbsoluteUrls);return Ft(e,t.params,t.paramsSerializer)}};c.forEach(["delete","get","head","options"],function(t){oe.prototype[t]=function(e,s){return this.request(ie(s||{},{method:t,url:e,data:(s||{}).data}))}}),c.forEach(["post","put","patch"],function(t){function e(s){return function(r,n,o){return this.request(ie(o||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}oe.prototype[t]=e(),oe.prototype[t+"Form"]=e(!0)});let dn=class Is{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(n){s=n});const r=this;this.promise.then(n=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](n);r._listeners=null}),this.promise.then=n=>{let o;const i=new Promise(a=>{r.subscribe(a),o=a}).then(n);return i.cancel=function(){r.unsubscribe(o)},i},e(function(n,o,i){r.reason||(r.reason=new fe(n,o,i),s(r.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=r=>{e.abort(r)};return this.subscribe(s),e.signal.unsubscribe=()=>this.unsubscribe(s),e.signal}static source(){let e;return{token:new Is(function(s){e=s}),cancel:e}}};function hn(t){return function(e){return t.apply(null,e)}}function fn(t){return c.isObject(t)&&t.isAxiosError===!0}const rt={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(rt).forEach(([t,e])=>{rt[e]=t});function os(t){const e=new oe(t),s=St(oe.prototype.request,e);return c.extend(s,oe.prototype,e,{allOwnKeys:!0}),c.extend(s,e,null,{allOwnKeys:!0}),s.create=function(r){return os(ie(t,r))},s}const N=os(_e);N.Axios=oe,N.CanceledError=fe,N.CancelToken=dn,N.isCancel=qt,N.VERSION=ns,N.toFormData=Le,N.AxiosError=S,N.Cancel=N.CanceledError,N.all=function(t){return Promise.all(t)},N.spread=hn,N.isAxiosError=fn,N.mergeConfig=ie,N.AxiosHeaders=V,N.formToJSON=t=>Bt(c.isHTMLForm(t)?new FormData(t):t),N.getAdapter=ss.getAdapter,N.HttpStatusCode=rt,N.default=N;const{Axios:Fi,AxiosError:Di,CanceledError:$i,isCancel:Bi,CancelToken:Vi,VERSION:qi,all:Mi,Cancel:zi,isAxiosError:Wi,spread:Hi,toFormData:Ji,AxiosHeaders:Ki,HttpStatusCode:Gi,formToJSON:Zi,getAdapter:Yi,mergeConfig:Xi}=N,as=N.create({baseURL:location.origin,timeout:6e4,params:{}});as.interceptors.response.use(t=>t,t=>{var e,s,r,n,o,i,a,l,u,d,h;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} `),(r=(s=t.response)==null?void 0:s.config)!=null&&r.data&&(y+=`${t.response.config.data} `),(o=(n=t.response)==null?void 0:n.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=(l=t.response)==null?void 0:l.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+=`${(h=t.response)==null?void 0:h.data}`;const{$cosmosNotify:f}=window;throw f&&f.serious({title:"Network error",body:y}),t}else throw t});let De=()=>({emit(t,...e){for(let s=this.events[t]||[],r=0,n=s.length;r<n;r++)s[r](...e)},events:{},on(t,e){var s;return((s=this.events)[t]||(s[t]=[])).push(e),()=>{var r;this.events[t]=(r=this.events[t])==null?void 0:r.filter(n=>e!==n)}}});class we extends Error{constructor(e,s){e instanceof Error?(super(e.message),this.cause=e):super(e),this.reason=s,this.name="ReasonError"}}class nt extends we{constructor(e){super("Rejected",e),this.name="SubscriptionRejectedError"}}class pn extends we{constructor(e){super(e||"Timed out to receive subscription ack"),this.name="SubscriptionTimeoutError"}}class K extends we{constructor(e,s){s?super(e,s):super("Disconnected",e),this.name="DisconnectedError"}}class mn extends K{constructor(e){super(e,"stale_connection"),this.name="StaleConnectionError"}}function cs(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 gn{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:r,info:n})=>(s[r]=n,s),{})}}const ae=Symbol("state");class ls{constructor(e={}){this.emitter=De(),this.params=Object.freeze(e),this.presence=new gn(this),this.initialConnect=!0,this[ae]="idle"}get identifier(){return this._identifier?this._identifier:(this._identifier=cs({channel:this.channelId,...this.params}),this._identifier)}get channelId(){return this.constructor.identifier}get state(){return this[ae]}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[ae]="connecting"}connected(){if(this.state==="connected"||this.state==="closed")return;this[ae]="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[ae]="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[ae]="disconnected",this.presence.reset(),this.emit("disconnect",e))}closed(e){this.state!=="closed"&&(this[ae]="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 r=this.receiver?this.receiver.logger:null;r&&r.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 r=this.emitter.on(e,(...n)=>{r(),s(...n)});return r}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 r=[()=>delete this._pendingSubscribe];r.push(this.on("connect",()=>{r.forEach(n=>n()),e()})),r.push(this.on("close",n=>{r.forEach(o=>o()),s(n||new we("Channel was disconnected before subscribing","canceled"))}))}),this._pendingSubscribe)}}class bn{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(r=>r[e](s[0])):this.channels.forEach(r=>r[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,r={promise:new Promise(o=>{s=o}),intent:e,release:()=>{this._pendings.splice(this._pendings.indexOf(r),1),s(r)},canceled:!1,acquired:!1},n=this._pendingTop;return this._pendings.push(r),n&&await n.promise,this.gvl&&await this.gvl.acquire(r,e),r.acquired=!0,r}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 _n{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 yn{constructor(e){e.concurrentSubscribes===!1&&(this.glv=new _n),this._subscriptions={},this._localToRemote={}}all(){return Object.values(this._subscriptions)}get(e){return this._subscriptions[e]}create(e,{subscribe:s,unsubscribe:r}){let n=this._subscriptions[e]=new bn(e);return n.remoteId=this._localToRemote[e],n.subscriber=s,n.unsubscriber=r,n.gvl=this.glv,n}remove(e){delete this._subscriptions[e],delete this._localToRemote[e]}storeRemoteId(e,s){this._localToRemote[e]=s;let r=this.get(e);r&&(r.remoteId=s)}}class wn{constructor(e={}){this.subscriptions=new yn(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 r=s.remoteId;r&&delete this._remoteToLocal[r],this.subscriptions.remove(e)}transmit(e,s,r){let n=this._remoteToLocal[e];if(!n){this._pendingMessages.push([e,s,r]);return}let o=this.subscriptions.get(n);o&&o.channels.forEach(i=>{i.receive(s,r)})}notify(e,s,r){let n=this._remoteToLocal[e];if(!n)return;let o=this.subscriptions.get(n);o&&o.channels.forEach(i=>i.emit(s,r))}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 r of this._pendingMessages)r[0]===e?this.transmit(r[0],r[1],r[2]):s.push(r);this._pendingMessages=s}}const us={debug:0,info:1,warn:2,error:3};class ds{constructor(e){this.level=e||"warn"}log(e,s,r){us[e]<us[this.level]||this.writeLogEntry(e,s,r)}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 ve extends ds{writeLogEntry(){}}class vn{encode(e){return JSON.stringify(e)}decode(e){try{return JSON.parse(e)}catch{}}}let Sn=0;class hs{constructor(e={}){let{logger:s}=e;this.logger=s||new ve,this.pendingSubscriptions={},this.pendingUnsubscriptions={},this.subscribeCooldownInterval=e.subscribeCooldownInterval||250,this.subscribeRetryInterval=e.subscribeRetryInterval||5e3}attached(e){this.cable=e}subscribe(e,s){let r={channel:e};s&&Object.assign(r,s);let n=cs(r);if(this.pendingUnsubscriptions[n]){let i=this.subscribeCooldownInterval*1.5;return this.logger.debug(`unsubscribed recently, cooldown for ${i}`,n),new Promise(a=>{setTimeout(()=>{a(this.subscribe(e,s))},i)})}if(this.pendingSubscriptions[n])return this.logger.warn("subscription is already pending, skipping",n),Promise.reject(Error("Already subscribing"));let o=this.subscribeRetryInterval;return new Promise((i,a)=>{let l=++Sn;this.pendingSubscriptions[n]={resolve:i,reject:a,id:l},this.cable.send(this.buildSubscribeRequest(n)),this.maybeRetrySubscribe(l,n,o)})}buildSubscribeRequest(e){return{command:"subscribe",identifier:e}}maybeRetrySubscribe(e,s,r){setTimeout(()=>{let n=this.pendingSubscriptions[s];n&&n.id===e&&(this.logger.warn(`no subscription ack received in ${r}ms, retrying subscribe`,s),this.cable.send(this.buildSubscribeRequest(s)),this.maybeExpireSubscribe(e,s,r))},r)}maybeExpireSubscribe(e,s,r){setTimeout(()=>{let n=this.pendingSubscriptions[s];n&&n.id===e&&(delete this.pendingSubscriptions[s],n.reject(new pn(`Haven't received subscription ack in ${r*2}ms for ${s}`)))},r)}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,r){return s==="$whisper"?this.whisper(e,r):(r||(r={}),r.action=s,this.cable.send({command:"message",identifier:e,data:JSON.stringify(r)}),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:r,message:n,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[r];if(!a){this.logger.error("subscription not found, unsubscribing",{type:s,identifier:r}),this.unsubscribe(r);return}return delete this.pendingSubscriptions[r],a.resolve(r)}if(s==="reject_subscription"){let a=this.pendingSubscriptions[r];return a?(delete this.pendingSubscriptions[r],a.reject(new nt)):this.logger.error("subscription not found",{type:s,identifier:r})}if(n)return{identifier:r,message:n};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 fs=()=>Date.now()/1e3|0;class En extends hs{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=fs()),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:r,message:n}=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[r]||(this.subscriptionStreams[r]=new Set),super.receive(e);if(s==="ping")return this.restoreSince&&(this.restoreSince=fs()),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",r);return}if(s==="reject_history"){this.logger.warn("failed to retrieve history",e),this.cable.notify("history_not_found",r);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=n.type;if(o==="info"){let i=this.pendingPresence[r];i&&(delete this.pendingPresence[r],i.resolve(n))}else if(o==="error"){let i=this.pendingPresence[r];i&&(delete this.pendingPresence[r],i.reject(new Error("failed to retrieve presence")))}return{type:s,identifier:r,message:n}}if(n){let o=this.trackStreamPosition(r,e.stream_id,e.epoch,e.offset);return{identifier:r,message:n,meta:o}}this.logger.warn(`unknown message type: ${s}`,{message:e})}perform(e,s,r){switch(s){case"$presence:join":return this.join(e,r);case"$presence:leave":return this.leave(e,r);case"$presence:info":return this.presence(e,r)}return super.perform(e,s,r)}unsubscribe(e){return delete this.presenceInfo[e],super.unsubscribe(e)}buildSubscribeRequest(e){let s=super.buildSubscribeRequest(e),r=this.historyRequestFor(e);r&&(s.history=r,this.pendingHistory[e]=!0);let n=this.presenceInfo[e];return n&&(s.presence=n),s}recoverableClosure(){return!!this.sessionId}historyRequestFor(e){let s={},r=!1;if(this.subscriptionStreams[e])for(let n of this.subscriptionStreams[e]){let o=this.streamsPositions[n];o&&(r=!0,s[n]=o)}if(!(!r&&!this.restoreSince))return{since:this.restoreSince,streams:s}}trackStreamPosition(e,s,r,n){if(!(!s||!r))return this.subscriptionStreams[e]||(this.subscriptionStreams[e]=new Set),this.subscriptionStreams[e].add(s),this.streamsPositions[s]={epoch:r,offset:n},{stream:s,epoch:r,offset:n}}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((r,n)=>{this.pendingPresence[e]={resolve:r,reject:n},this.cable.send({command:"presence",identifier:e,data:s})})}}class xn extends we{constructor(){super("No connection","closed"),this.name="NoConnectionError"}}class it extends ls{constructor(e,s){super(s),this.channelId=e}set channelId(e){this._channelId=e}get channelId(){return this._channelId}}ke(it,"identifier","__ghost__");const Cn="$pubsub";class ot extends ls{async perform(e,s){if(e.startsWith("$"))return super.perform(e,s);throw Error("not implemented")}}ke(ot,"identifier",Cn);const ce=Symbol("state");let On=class{constructor({transport:t,protocol:e,encoder:s,logger:r,lazy:n,hubOptions:o,performFailures:i,transportConfigurator:a}){this.emitter=De(),this.transport=t,this.encoder=s,this.logger=r||new ve,this.protocol=e,this.performFailures=i||"throw",this.protocol.attached(this),this.hub=new wn(o||{}),this[ce]="idle",this.handleClose=this.handleClose.bind(this),this.handleIncoming=this.handleIncoming.bind(this),this.transportConfigurator=a,this.transport.on("close",this.handleClose),this.transport.on("data",this.handleIncoming),this.initialConnect=!0,this.recovering=!1,n===!1&&this.connect().catch(()=>{})}get state(){return this[ce]}async connect(){if(this.state==="connected")return Promise.resolve();if(this.state==="connecting")return this.pendingConnect();let t=this.state==="idle";this[ce]="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[ce]="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[ce]="connected",this.hub.subscriptions.all().forEach(r=>{t&&r.remoteId&&t.includes(r.remoteId)?r.notify("restored"):(r.notify("disconnected",new K("recovery_failed")),this._resubscribe(r))});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[ce]="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[ce]="closed";let s=e||new K("cable_closed");this.hub.subscriptions.all().forEach(r=>r.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:r,identifier:n,message:o,meta:i}=s;r?this.hub.notify(n,r,o):this.hub.transmit(n,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 ot({stream_name:t});return this.subscribe(e)}streamFromSigned(t){let e=new ot({signed_stream_name:t});return this.subscribe(e)}subscribeTo(t,e){let s,r;return typeof t=="string"&&(r=t,t=it),s=r?new t(r,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:r=>this._subscribe(r,t.channelId,t.params),unsubscribe:r=>this._unsubscribe(r)});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 r=t.id;if(this.state==="idle"&&this.connect().catch(()=>{}),this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:r});return}this.logger.debug("acquiring subscribe lock",{identifier:r});let n=await t.acquire("subscribed");if(n.canceled){this.logger.debug("subscribe lock has been canceled",{identifier:r}),n.release();return}if(this.logger.debug("subscribe lock has been acquired",{identifier:r}),t.intent!=="subscribed"){this.logger.debug("cancel subscribe request, already unsubscribed"),n.release();return}if(this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:r}),n.release();return}if(t.state==="connected"){this.logger.debug("already connected, skip subscribe command",{identifier:r}),t.notify("connected"),n.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(r,i),this.logger.debug("subscribed",{...o,remoteId:i}),t.notify("connected")}catch(i){if(i){if(i instanceof nt&&this.logger.warn("rejected",o),i instanceof K){this.logger.debug("disconnected during subscription; will retry on connect",o),n.release();return}this.logger.error("failed to subscribe",{error:i,...o})}t.close(i),this.hub.unsubscribe(r)}n.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 r=t.remoteId;if(this.logger.debug("unsubscribing...",{remoteId:r}),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(r),this.logger.debug("unsubscribed remotely",{id:e})}catch(n){n&&(n instanceof K?this.logger.debug("cable disconnected during the unsubscribe command execution",{id:e,error:n}):this.logger.error("unsubscribe failed",{id:e,error:n}))}t.intent==="unsubscribed"?(t.close(),this.hub.unsubscribe(e)):t.state="closed",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(r){this.performFailures==="warn"&&this.logger.warn("perform failed",{error:r});return}}async _perform(t,e,s){if(this.state==="connecting"&&await this.pendingConnect(),this.state==="closed"||this.state==="disconnected")throw new xn;let r=this.hub.subscriptions.get(t);if(!r)throw Error(`Subscription not found: ${t}`);if(await r.pending("subscribed"),r.intent!=="subscribed")throw Error(`Subscription is closed: ${t}`);let n=r.remoteId,o={id:n,action:e,payload:s};this.logger.debug("perform",o);try{let i=await this.protocol.perform(n,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,(...r)=>{s(),e(...r)});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(r=>r()),t()})),s.push(this.on("close",r=>{s.forEach(n=>n()),e(r)})),s.push(this.on("disconnect",r=>{s.forEach(n=>n()),e(r)}))}),this._pendingConnect)}};const kn={maxMissingPings:2,maxReconnectAttempts:1/0},pe=()=>Date.now(),ps=(t,e)=>{e=e||{};let{backoffRate:s,jitterRatio:r,maxInterval:n}=e;return s=s||2,r===void 0&&(r=.5),o=>{let i=t*s**o,a=i*s,l=i+(a-i)*Math.random(),u=2*(Math.random()-.5)*r;return l=l*(1+u),n&&n<l&&(l=n),l}};let ms=class{constructor({pingInterval:t,...e}){if(this.pingInterval=t,!this.pingInterval)throw Error(`Incorrect pingInterval is provided: ${t}`);if(e=Object.assign({},kn,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 ve,this.state="pending_connect",this.attempts=0,this.disconnectedAt=pe()}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=pe(),this.state="connected",this.cancelReconnect(),this.startPolling()})),this.unbind.push(this.target.on("disconnect",()=>{this.disconnectedAt=pe(),this.state="disconnected",this.stopPolling(),this.scheduleReconnect()})),this.unbind.push(this.target.on("close",()=>{this.disconnectedAt=pe(),this.state="closed",this.cancelReconnect(),this.stopPolling()})),this.unbind.push(this.target.on("keepalive",()=>{this.pingedAt=pe()})),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=pe()-this.pingedAt;t>this.maxMissingPings*this.pingInterval&&(this.logger.warn(`Stale connection: ${t}ms without pings`),this.state="pending_disconnect",this.target.disconnected(new mn))}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 Rn{constructor(e,s={}){this.transports=e,this.transport=null,this.emitter=De(),this.unbind=[],this.logger=s.logger||new ve}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(r){this.logger.debug(`Failed to connect via ${s.displayName()}: ${r.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(r=>{r.setParam(e,s)})}setToken(e,s){this.transports.forEach(r=>{r.setToken(e,s)})}on(e,s){return this.emitter.on(e,s)}once(e,s){let r=this.emitter.on(e,(...n)=>{r(),s(...n)});return r}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 In{constructor(e,s={}){this.url=e;let r=s.websocketImplementation;if(r)this.Impl=r;else if(typeof WebSocket<"u")this.Impl=WebSocket;else throw new Error("No WebSocket support");this.connected=!1,this.emitter=De();let{format:n,subprotocol:o,authStrategy:i}=s;this.format=n||"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,r)=>{let n=[];n.push(this.once("open",()=>{n.forEach(o=>o()),s()})),n.push(this.once("close",()=>{n.forEach(o=>o()),r(Error("WS connection closed"))}))})}setURL(e){this.url=e}setParam(e,s){let r=new URL(this.url);r.searchParams.set(e,s);let n=`${r.protocol}//${r.host}${r.pathname}?${r.searchParams}`;this.setURL(n)}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 r=`x-${s}`.toLowerCase();r=Object.keys(this.connectionOptions.headers).find(n=>n.toLowerCase()===r)||r,this.connectionOptions.headers[r]=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 r=this.emitter.on(e,(...n)=>{r(),s(...n)});return r}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 gs={protocol:"actioncable-v1-json",pingInterval:3e3,maxReconnectAttempts:1/0,maxMissingPings:2,logLevel:"warn",lazy:!0};function An(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({},gs,e);let{protocol:s,websocketImplementation:r,websocketFormat:n,websocketOptions:o,websocketAuthStrategy:i,fallbacks:a,logLevel:l,logger:u,transport:d,encoder:h,lazy:y,monitor:f,pingInterval:m,reconnectStrategy:p,maxMissingPings:O,maxReconnectAttempts:I,subprotocol:x,tokenRefresher:b,historyTimestamp:A,protocolOptions:T,concurrentSubscribes:z,performFailures:D,transportConfigurator:k,auth:L}=e;if(u=u||new ve(l),typeof s=="string"){x=x||s;let G=s.substring(0,s.lastIndexOf("-")),Z=s.substring(s.lastIndexOf("-")+1);if(T=T||{},G==="actioncable-v1")s=new hs({logger:u,...T});else if(G==="actioncable-v1-ext")s=new En({logger:u,historyTimestamp:A,...T});else throw Error(`Protocol is not supported yet: ${s}`);if(Z==="json")h=h||new vn,n=n||"text";else if(Z==="msgpack"){if(n="binary",!h)throw Error("Msgpack encoder must be specified explicitly. Use `@anycable/msgpack-encoder` package or build your own")}else if(Z==="protobuf"){if(n=n||"binary",!h)throw Error("Protobuf encoder must be specified explicitly. Use `@anycable/protobuf-encoder` package or build your own")}else throw Error(`Protocol is not supported yet: ${s}`)}if(!s)throw Error("Protocol must be specified");d=d||new In(t,{websocketImplementation:r,websocketOptions:o,subprotocol:x,authStrategy:i,format:n}),a&&(d=new Rn([d,...a],{logger:u})),L&&L.token&&d.setToken(L.token,L.param||"jid"),p=p||ps(m),f!==!1&&(f=f||new ms({pingInterval:m,reconnectStrategy:p,maxMissingPings:O,maxReconnectAttempts:I,logger:u}));let le={concurrentSubscribes:z},Q=new On({protocol:s,transport:d,encoder:h,logger:u,lazy:y,hubOptions:le,performFailures:D,transportConfigurator:k});return f&&(f.watch(Q),Q.monitor=f),b&&Tn(Q,async()=>{try{await b(d)}catch(G){return u.error("Failed to refresh authentication token: "+G),!1}return Q.connect().catch(()=>{}),!0}),Q}function Tn(t,e){let s=!1;t.on("connect",()=>s=!1),t.on("close",async r=>{if(r){if(s){t.logger.warn("Token auto-refresh is disabled",r);return}r.reason==="token_expired"&&(s=!0,await e())}})}class Ln{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 jn extends it{constructor(e,s,r){super(e,s),this.subscription=new Ln(this),Object.assign(this.subscription,r),this.on("connect",({reconnect:n})=>this.subscription.notify("connected",{reconnected:n})),this.on("disconnect",()=>this.subscription.notify("disconnected",{allowReconnect:!0})),this.on("message",n=>this.subscription.notify("received",n)),this.on("close",n=>{n&&n instanceof nt?this.subscription.notify("rejected"):this.subscription.notify("disconnected",{allowReconnect:!1})})}}class Nn{constructor(e){this.cable=e}create(e,s){let r,n;typeof e=="object"?(r=e.channel,delete e.channel,n=e):(r=e,n={});let o=new jn(r,n,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 Pn{constructor(e){this.cable=e,this.subscriptions=new Nn(e)}}class Un extends ds{writeLogEntry(e,s,r){r?console[e](s,r):console[e](s)}}class Fn extends ms{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=n=>{this.reconnectNow()&&this.logger.debug("Trigger reconnect",{event:n})},r=()=>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",r,!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",r,!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 Dn=["cable","action-cable"],$n="/cable",$e=(t,e)=>{for(let s of Dn){let r=t.head.querySelector(`meta[name='${s}-${e}']`);if(r)return r.getAttribute("content")}},bs=t=>t.match(/wss?:\/\//)?t:typeof window<"u"?`${window.location.protocol.replace("http","ws")}//${window.location.host}${t}`:t,Bn=()=>{if(typeof document<"u"&&document.head){let t=$e(document,"url");if(t)return bs(t)}return bs($n)},Vn=()=>{if(typeof document<"u"&&document.head){let t=$e(document,"history-timestamp");if(t)return t|0}},qn=()=>{if(typeof document<"u"&&document.head)return $e(document,"token")},Mn=()=>{if(typeof document<"u"&&document.head)return $e(document,"token-param")};function zn(t,e){typeof t=="object"&&typeof e>"u"&&(e=t,t=void 0),t=t||Bn(),e=e||{},e.historyTimestamp||(e.historyTimestamp=Vn());let s=qn();if(s){let u=Mn();e.auth=Object.assign({token:s,param:u},e.auth||{})}e=Object.assign({},gs,e);let{logLevel:r,logger:n,pingInterval:o,reconnectStrategy:i,maxMissingPings:a,maxReconnectAttempts:l}=e;return n=e.logger=e.logger||new Un(r),i=e.reconnectStrategy=e.reconnectStrategy||ps(o),e.monitor!==!1&&(e.monitor=e.monitor||new Fn({pingInterval:o,reconnectStrategy:i,maxMissingPings:a,maxReconnectAttempts:l,logger:n})),An(t,e)}function Wn(t,e){let s=zn(t,e);return new Pn(s)}class _s{constructor(e="/openc3-api/cable"){this._cable=null,this._url=e}disconnect(){this._cable&&(this._cable.cable.disconnect(),this._cable=null)}createSubscription(e,s,r={},n={}){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=Wn(i)}return this._cable.subscriptions.create({channel:e,...n},r)})}recordPing(){}}function Se(t){return Hn.test(t)}const Hn=/^-?[0-9]+$/;function ys(t){return Jn.test(t)}const Jn=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function ws(t,e){if(Se(t))return Number.isSafeInteger(Number.parseInt(t,10));const s=Number.parseFloat(t),r=String(s);if(t===r)return!0;const n=vs(t),o=vs(r);return!!(n===o||(e==null?void 0:e.approx)===!0&&!Se(t)&&o.length>=14&&n.startsWith(o.substring(0,14)))}let Ee=function(t){return t.underflow="underflow",t.overflow="overflow",t.truncate_integer="truncate_integer",t.truncate_float="truncate_float",t}({});function Kn(t){if(ws(t,{approx:!1}))return;if(Se(t))return Ee.truncate_integer;const e=Number.parseFloat(t);return Number.isFinite(e)?e===0?Ee.underflow:Ee.truncate_float:Ee.overflow}function vs(t){const{start:e,end:s}=Gn(t),r=t.substring(e,s),n=r.indexOf(".");return n===-1?r:r.substring(0,n)+r.substring(n+1)}function Gn(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 Zn{constructor(e){if(ke(this,"isLosslessNumber",!0),!ys(e))throw new Error(`Invalid number (value: "${e}")`);this.value=e}valueOf(){const e=Kn(this.value);if(e===void 0||e===Ee.truncate_float)return Number.parseFloat(this.value);if(Se(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 Yn(t){return t&&typeof t=="object"&&t.isLosslessNumber||!1}function Xn(t){return new Zn(t)}function Qn(t,e){return at({"":t},"",t,e)}function at(t,e,s,r){return Array.isArray(s)?r.call(t,e,ti(s,r)):s&&typeof s=="object"&&!Yn(s)?r.call(t,e,ei(s,r)):r.call(t,e,s)}function ei(t,e){for(const s of Object.keys(t)){const r=at(t,s,t[s],e);r!==void 0?t[s]=r:delete t[s]}return t}function ti(t,e){for(let s=0;s<t.length;s++)t[s]=at(t,String(s),t[s],e);return t}function si(t,e,s){const r=typeof s=="function"?{parseNumber:s}:s,n=(r==null?void 0:r.parseNumber)??Xn,o=(r==null?void 0:r.onDuplicateKey)??D;let i=0;const a=d();return I(a),b(),e?Qn(a,e):a;function l(){if(t.charCodeAt(i)===ci){i++,y();const v={};let R=!0;for(;i<t.length&&t.charCodeAt(i)!==Es;){R?R=!1:(p(),y());const W=i,ee=f();if(ee===void 0){z();return}y(),O();const M=d();if(M===void 0){G();return}if(Object.prototype.hasOwnProperty.call(v,ee)&&!ct(M,v[ee])){const te=o({key:ee,position:W+1,oldValue:v[ee],newValue:M});te!==void 0&&(v[ee]=te)}else v[ee]=M}return t.charCodeAt(i)!==Es&&k(),i++,v}}function u(){if(t.charCodeAt(i)===li){i++,y();const v=[];let R=!0;for(;i<t.length&&t.charCodeAt(i)!==xs;){R?R=!1:p();const W=d();x(W),v.push(W)}return t.charCodeAt(i)!==xs&&L(),i++,v}}function d(){y();const v=f()??m()??l()??u()??h("true",!0)??h("false",!1)??h("null",null);return y(),v}function h(v,R){if(t.slice(i,i+v.length)===v)return i+=v.length,R}function y(){for(;ri(t.charCodeAt(i));)i++}function f(){if(t.charCodeAt(i)===lt){i++;let v="";for(;i<t.length&&t.charCodeAt(i)!==lt;){if(t.charCodeAt(i)===ai){const R=t[i+1],W=oi[R];W!==void 0?(v+=W,i++):R==="u"?Be(t.charCodeAt(i+2))&&Be(t.charCodeAt(i+3))&&Be(t.charCodeAt(i+4))&&Be(t.charCodeAt(i+5))?(v+=String.fromCharCode(Number.parseInt(t.slice(i+2,i+6),16)),i+=5):Z(i):Q(i)}else ii(t.charCodeAt(i))?v+=t[i]:le(t[i]);i++}return T(),i++,v}}function m(){const v=i;if(t.charCodeAt(i)===Cs&&(i++,A(v)),t.charCodeAt(i)===ut)i++;else if(ni(t.charCodeAt(i)))for(i++;Ve(t.charCodeAt(i));)i++;if(t.charCodeAt(i)===bi)for(i++,A(v);Ve(t.charCodeAt(i));)i++;if(t.charCodeAt(i)===Si||t.charCodeAt(i)===vi)for(i++,(t.charCodeAt(i)===Cs||t.charCodeAt(i)===pi)&&i++,A(v);Ve(t.charCodeAt(i));)i++;if(i>v)return n(t.slice(v,i))}function p(){if(t.charCodeAt(i)!==gi)throw new SyntaxError(`Comma ',' expected after value ${P()}`);i++}function O(){if(t.charCodeAt(i)!==_i)throw new SyntaxError(`Colon ':' expected after property name ${P()}`);i++}function I(v){if(v===void 0)throw new SyntaxError(`JSON value expected ${P()}`)}function x(v){if(v===void 0)throw new SyntaxError(`Array item expected ${P()}`)}function b(){if(i<t.length)throw new SyntaxError(`Expected end of input ${P()}`)}function A(v){if(!Ve(t.charCodeAt(i))){const R=t.slice(v,i);throw new SyntaxError(`Invalid number '${R}', expecting a digit ${P()}`)}}function T(){if(t.charCodeAt(i)!==lt)throw new SyntaxError(`End of string '"' expected ${P()}`)}function z(){throw new SyntaxError(`Quoted object key expected ${P()}`)}function D(v){let{key:R,position:W}=v;throw new SyntaxError(`Duplicate key '${R}' encountered at position ${W}`)}function k(){throw new SyntaxError(`Quoted object key or end of object '}' expected ${P()}`)}function L(){throw new SyntaxError(`Array item or end of array ']' expected ${P()}`)}function le(v){throw new SyntaxError(`Invalid character '${v}' ${q()}`)}function Q(v){const R=t.slice(v,v+2);throw new SyntaxError(`Invalid escape character '${R}' ${q()}`)}function G(){throw new SyntaxError(`Object value expected after ':' ${q()}`)}function Z(v){const R=t.slice(v,v+6);throw new SyntaxError(`Invalid unicode character '${R}' ${q()}`)}function q(){return`at position ${i}`}function qe(){return i<t.length?`but got '${t[i]}'`:"but reached end of input"}function P(){return`${qe()} ${q()}`}}function ri(t){return t===ui||t===di||t===hi||t===fi}function Be(t){return t>=ut&&t<=dt||t>=yi&&t<=Ei||t>=wi&&t<=xi}function Ve(t){return t>=ut&&t<=dt}function ni(t){return t>=mi&&t<=dt}function ii(t){return t>=32&&t<=1114111}function ct(t,e){return t===e?!0:Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((s,r)=>ct(s,e[r])):Ss(t)&&Ss(e)?[...new Set([...Object.keys(t),...Object.keys(e)])].every(s=>ct(t[s],e[s])):!1}function Ss(t){return typeof t=="object"&&t!==null}const oi={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
8
|
-
`,r:"\r",t:" "},ai=92,ci=123,Es=125,li=91,xs=93,ui=32,di=10,hi=9,fi=13,lt=34,pi=43,Cs=45,ut=48,mi=49,dt=57,gi=44,bi=46,_i=58,yi=65,wi=97,vi=69,Si=101,Ei=70,xi=102;function Os(t,e,s,r){return n(t);function n(l,u){if(Array.isArray(r)){const d=r.find(h=>h.test(l));if(d){const h=d.stringify(l);if(typeof h!="string"||!ys(h))throw new Error(`Invalid JSON number: output of a number stringifier must be a string containing a JSON number (output: ${h})`);return h}}if(typeof 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,u){if(l.length===0)return"[]";let d="[";for(let h=0;h<l.length;h++){const y=l[h];typeof y<"u"&&typeof y!="function"?d+=n(y):d+="null",h<l.length-1&&(d+=",")}return d+="]",d}function i(l,u){if(typeof l.toJSON=="function")return Os(l.toJSON(),e,s,void 0);const d=Array.isArray(e)?e.map(String):Object.keys(l);if(d.length===0)return"{}";let h=!0,y="{";for(const f of d){const m=l[f];if(a(f,m)){h?h=!1:y+=",";const p=JSON.stringify(f);y+=`${p}:`,y+=n(m)}}return y+="}",y}function a(l,u){return typeof u<"u"&&typeof u!="function"&&typeof u!="symbol"}}function Ci(t){return Se(t)&&!ws(t)?BigInt(t):parseFloat(t)}class ks{constructor(){ke(this,"id",1)}async exec(e,s,r={},n={},o=6e4){try{await OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity)&&OpenC3Auth.setTokens()}catch{OpenC3Auth.login()}this.id=this.id+1;try{return r.scope=window.openc3Scope,n.manual=!0,(await as.post("/openc3-api/api",{jsonrpc:"2.0",method:e,params:s,id:this.id,keyword_params:r},{headers:{Authorization:localStorage.openc3Token,"Content-Type":"application/json-rpc",...n},timeout:o,transformRequest:[(i,a)=>Os(i)],transformResponse:[i=>si(i,void 0,Ci)]})).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,r,n,o){return this.exec("map_target_to_interface",[e,s],{cmd_only:r,tlm_only:n,unmap_old:o})}unmap_target_from_interface(e,s,r,n){return this.exec("unmap_target_from_interface",[e,s],{cmd_only:r,tlm_only:n})}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,...r){return this.exec("interface_cmd",[e,s,...r])}interface_target_enable(e,s,r=!1,n=!1){return this.exec("interface_target_enable",[e,s],{cmd_only:r,tlm_only:n})}interface_target_disable(e,s,r=!1,n=!1){return this.exec("interface_target_disable",[e,s],{cmd_only:r,tlm_only:n})}interface_details(e){return this.exec("interface_details",[e])}get_all_router_info(){return this.exec("get_all_router_info",[])}map_target_to_router(e,s,r,n,o){return this.exec("map_target_to_router",[e,s],{cmd_only:r,tlm_only:n,unmap_old:o})}unmap_target_from_router(e,s,r,n){return this.exec("unmap_target_from_router",[e,s],{cmd_only:r,tlm_only:n})}connect_router(e){return this.exec("connect_router",[e])}disconnect_router(e){return this.exec("disconnect_router",[e])}router_target_enable(e,s,r=!1,n=!1){return this.exec("router_target_enable",[e,s],{cmd_only:r,tlm_only:n})}router_target_disable(e,s,r=!1,n=!1){return this.exec("router_target_disable",[e,s],{cmd_only:r,tlm_only:n})}router_details(e){return this.exec("router_details",[e])}get_target_interfaces(){return this.exec("get_target_interfaces",[])}get_tlm_cnts(e){return this.exec("get_tlm_cnts",[e])}get_item(e,s,r){return this.exec("get_item",[e,s,r])}get_param(e,s,r){return this.exec("get_param",[e,s,r])}get_parameter(e,s,r){return this.exec("get_param",[e,s,r])}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,r,n=30){const o=await this.exec("get_tlm_packet",[e,s],{type:r,stale_time:n});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,r=null,n=null,o=null){let i={stale_time:s};r!==null&&(i.cache_timeout=r),n!==null&&(i.start_time=n.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,u=null;for(let d=0;d<l;d++)u=this.decode_openc3_type(a[d][0]),u!==null&&(a[d][0]=u)}return a}get_limits(e,s,r){return this.exec("get_limits",[e,s,r])}async tlm(e,s,r,n="CONVERTED"){let o=null;if(s===void 0)o=await this.exec("tlm",[e]);else if(r===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,r],{type:n});let i=this.decode_openc3_type(o);return i!==null&&(o=i),o}async inject_tlm(e,s,r=null,n="CONVERTED"){await this.exec("inject_tlm",[e,s,r],{type:n})}set_tlm(e,s,r,n){return this.exec("set_tlm",[e,s,r],{type:n})}override_tlm(e,s,r,n){return this.exec("override_tlm",[e,s,r],{type:n})}get_overrides(){return this.exec("get_overrides")}normalize_tlm(e,s,r,n){return this.exec("normalize_tlm",[e,s,r],{type:n})}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,r,n="CONVERTED"){return this.exec("get_cmd_value",[e,s,r,n])}get_cmd_buffer(e,s){return this.exec("get_cmd_buffer",[e,s])}_cmd(e,s,r,n,o,i={}){let a=null;for(let l in n)Object.prototype.hasOwnProperty.call(n,l)&&(a=this.encode_openc3_type(n[l]),a!==null&&(n[l]=a));return this.exec(e,[s,r,n],i,o)}get_cmd_hazardous(e,s,r,n={}){return s===void 0?this.exec("get_cmd_hazardous",e,{},n):this._cmd("get_cmd_hazardous",e,s,r,n)}cmd(e,s,r,n={},o={}){return s===void 0?this.exec("cmd",e,o,n):this._cmd("cmd",e,s,r,n,o)}cmd_no_range_check(e,s,r,n={},o={}){return s===void 0?this.exec("cmd_no_range_check",e,o,n):this._cmd("cmd_no_range_check",e,s,r,n,o)}cmd_raw(e,s,r,n={},o={}){return s===void 0?this.exec("cmd_raw",e,o,n):this._cmd("cmd_raw",e,s,r,n,o)}cmd_raw_no_range_check(e,s,r,n={},o={}){return s===void 0?this.exec("cmd_raw_no_range_check",e,o,n):this._cmd("cmd_raw_no_range_check",e,s,r,n,o)}cmd_no_hazardous_check(e,s,r,n={},o={}){return s===void 0?this.exec("cmd_no_hazardous_check",e,o,n):this._cmd("cmd_no_hazardous_check",e,s,r,n,o)}cmd_no_checks(e,s,r,n={},o={}){return s===void 0?this.exec("cmd_no_checks",e,o,n):this._cmd("cmd_no_checks",e,s,r,n,o)}cmd_raw_no_hazardous_check(e,s,r,n={},o={}){return s===void 0?this.exec("cmd_raw_no_hazardous_check",e,o,n):this._cmd("cmd_raw_no_hazardous_check",e,s,r,n,o)}cmd_raw_no_checks(e,s,r,n={},o={}){return s===void 0?this.exec("cmd_raw_no_checks",e,o,n):this._cmd("cmd_raw_no_checks",e,s,r,n,o)}build_cmd(e,s,r,n={},o={}){return s===void 0?this.exec("build_cmd",e,o,n):this._cmd("build_cmd",e,s,r,n,o)}build_command(e,s,r,n={},o={}){return s===void 0?this.exec("build_cmd",e,o,n):this._cmd("build_cmd",e,s,r,n,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,r){return this.exec("save_config",[e,s,r])}delete_config(e,s){return this.exec("delete_config",[e,s])}enable_limits(e,s,r){return this.exec("enable_limits",[e,s,r])}disable_limits(e,s,r){return this.exec("disable_limits",[e,s,r])}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),r=await crypto.subtle.digest("SHA-256",s),n=new Uint8Array(r);return Array.from(n).map(o=>o.toString(16).padStart(2,"0")).join("")}}}const Oi={components:{ValueWidget:wt,ValuelimitsbarWidget:vt},mixins:[ze],props:{modelValue:{type:Array,default:()=>[]},timeZone:{type:String,default:"local"}},emits:["update:modelValue"],data(){return{api:null,cable:new _s,ignored:[],ignoredItemsDialog:!1,overallState:"GREEN",currentLimitsSet:"",items:[],itemList:[],screenItems:[],availableItems:[],screenValues:{},updateCounter:0,itemsPerPage:25,search:"",headers:[{title:"Timestamp",key:"timestamp",width:"130px",sortable:!0,nowrap:!0},{title:"Item",key:"item",value:t=>t.parameters[2],sortable:!0,minWidth:"100px",width:"200px",maxWidth:"410px"},{title:"Value",key:"value",width:"380px",sortable:!1},{title:"Controls",key:"actions",width:"80px",sortable:!1},{title:"",key:"limits",sortable:!1}],valueLimitsBarWidgetSettings:[["WIDTH","380px"],["0","WIDTH","200px"],["1","WIDTH","180px"]],valueWidgetSettings:[["WIDTH","200px"]]}},computed:{textFieldClass(){return this.overallState?`textfield-${this.overallState.toLowerCase()}`:""},overallStateFormatted(){return this.ignored.length===0?this.overallState:`${this.overallState} (Some items ignored)`},ignoredFormatted(){return this.ignored.map(t=>t.split("__").join(" "))},astroStatus(){switch(this.overallState){case"GREEN":return"normal";case"YELLOW":return"caution";case"RED":return"critical";case"BLUE":return"standby";default:return null}}},created(){this.api=new ks;for(let t of this.modelValue)t.match(/.+__.+__.+/)?this.ignoreItem(t,!0):this.ignorePacket(t,!0);this.updateOutOfLimits(),this.getCurrentLimitsSet(),this.currentSetRefreshInterval=setInterval(this.getCurrentLimitsSet,10*1e3),this.cable.createSubscription("LimitsEventsChannel",window.openc3Scope,{received:t=>{this.cable.recordPing(),this.handleMessages(t)}}).then(t=>{this.limitsSubscription=t}),this.cable.createSubscription("ConfigEventsChannel",window.openc3Scope,{received:t=>{this.cable.recordPing();const e=JSON.parse(t);this.handleConfigEvents(e)}}).then(t=>{this.configSubscription=t})},mounted(){this.updater=setInterval(()=>{this.update()},1e3)},unmounted(){this.updater!=null&&(clearInterval(this.updater),this.updater=null),this.limitsSubscription&&this.limitsSubscription.unsubscribe(),this.configSubscription&&this.configSubscription.unsubscribe(),this.cable.disconnect()},methods:{escapeBrackets(t){return t.includes("[")?t.replace(/\[/g,"[[").replace(/\]/g,"]]"):t},getCurrentLimitsSet:function(){this.api.get_limits_set().then(t=>{this.currentLimitsSet=t})},updateOutOfLimits(){this.items=[],this.itemList=[],this.api.get_out_of_limits().then(t=>{for(const e of t){let s=e.join("__");if(this.ignored.find(n=>s.includes(n)))continue;this.itemList.push(s);let r={key:e.slice(0,3).join("__"),parameters:[e[0],e[1],this.escapeBrackets(e[2])],timestamp:this.formatDateTime(new Date,this.timeZone)};e[3].includes("YELLOW")&&this.overallState!=="RED"&&(this.overallState="YELLOW"),e[3].includes("RED")&&(this.overallState="RED"),e[3]=="YELLOW"||e[3]=="RED"?r.limits=!1:r.limits=!0,this.items.push(r)}this.calcOverallState()})},calcOverallState(){let t="GREEN";for(let e of this.itemList)if(!this.ignored.find(s=>e.includes(s))&&(e.includes("YELLOW")&&t!=="RED"&&(t="YELLOW"),e.includes("RED"))){t="RED";break}this.overallState=t},ignorePacket(t,e){let[s,r,n]=t.split("__"),o=`${s}__${r}`;for(this.ignored.push(o),e||this.updateIgnored();;){let i=this.itemList.findIndex(a=>a.includes(o));if(i===-1)break;{let a=this.itemList[i].lastIndexOf("__");this.removeItem(this.itemList[i].substring(0,a))}}this.calcOverallState()},ignoreItem(t,e){this.ignored.push(t),e||this.updateIgnored(),this.removeItem(t),this.calcOverallState()},restoreItem(t){this.ignored.splice(t,1),this.updateIgnored(),this.updateOutOfLimits()},removeItem(t){const e=this.itemList.findIndex(s=>s.includes(t));this.items.splice(e,1),this.itemList.splice(e,1)},clearAll(){this.ignored=[],this.updateIgnored(),this.updateOutOfLimits()},updateIgnored(){this.$emit("update:modelValue",this.ignored)},handleConfigEvents(t){for(let e of t)e.kind==="deleted"&&e.type==="target"&&this.updateOutOfLimits()},handleMessages(t){for(let e of t){let s=JSON.parse(e.event);if(s.type!="LIMITS_CHANGE")continue;let r=`${s.target_name}__${s.packet_name}__${s.item_name}`;const n=this.itemList.findIndex(i=>i.includes(r));if(n!==-1){this.itemList[n]=`${r}__${s.new_limits_state}`,this.calcOverallState();continue}if(this.ignored.find(i=>r.includes(i))||s.new_limits_state&&!(s.new_limits_state.includes("YELLOW")||s.new_limits_state.includes("RED")))continue;let o={key:r,timestamp:this.formatNanoseconds(s.time_nsec,this.timeZone),parameters:[s.target_name,s.packet_name,this.escapeBrackets(s.item_name)]};s.new_limits_state=="YELLOW"||s.new_limits_state=="RED"?o.limits=!1:o.limits=!0,this.itemList.push(`${r}__${s.new_limits_state}`),this.items.push(o),this.calcOverallState()}},update(){this.availableItems.length!==0&&this.api.get_tlm_values(this.availableItems).then(t=>{this.updateValues(t)})},updateValues:function(t){this.updateCounter+=1;for(let e=0;e<t.length;e++)t[e].push(this.updateCounter),this.screenValues[this.screenItems[e]]=t[e]},addItem:function(t){this.api.get_tlm_available([t]).then(e=>{this.screenItems.push(t),this.availableItems.push(e[0]),this.screenValues[e[0]]=[null,null,0]})},deleteItem:function(t){let e=this.screenItems.indexOf(t);this.availableItems.splice(e,1),this.screenItems.splice(e,1)},showIgnored(){this.ignoredItemsDialog=!0},customFilter(t,e,s){if(!e||e.trim()==="")return!0;if(e=e.toLowerCase(),s.parameters&&s.parameters.length>0){for(const r of s.parameters)if(r.toLowerCase().includes(e))return!0}return!!(s.timestamp&&s.timestamp.toLowerCase().includes(e)||s.key&&s.key.toLowerCase().includes(e))}}},ki=["status"],Ri={class:"font-weight-black"};function Ii(t,e,s,r,n,o){const i=w("v-text-field"),a=w("v-spacer"),l=w("v-row"),u=w("valuelimitsbar-widget"),d=w("value-widget"),h=w("v-btn"),y=w("v-icon"),f=w("v-list-item-title"),m=w("v-list-item"),p=w("v-list"),O=w("v-menu"),I=w("v-data-table"),x=w("v-card"),b=w("v-toolbar"),A=w("v-divider"),T=w("v-card-text"),z=w("v-card-actions"),D=w("v-dialog");return C(),H("div",null,[_(x,{class:"pa-5"},{default:g(()=>[_(l,{class:"ma-1"},{default:g(()=>[_(i,{density:"compact",variant:"outlined",readonly:"","hide-details":"",label:"Overall Limits State","model-value":o.overallStateFormatted,class:He(o.textFieldClass),style:{"margin-right":"10px","max-width":"280px"},"data-test":"overall-state"},Oe({_:2},[o.astroStatus?{name:"prepend-inner",fn:g(()=>[$("rux-status",{status:o.astroStatus},null,8,ki)]),key:"0"}:void 0]),1032,["model-value","class"]),_(i,{density:"compact",variant:"outlined",readonly:"","hide-details":"",label:"Current Limits Set","model-value":n.currentLimitsSet,style:{"max-width":"200px"},"data-test":"limits-set"},null,8,["model-value"]),_(a),_(i,{modelValue:n.search,"onUpdate:modelValue":e[0]||(e[0]=k=>n.search=k),label:"Search","prepend-inner-icon":"mdi-magnify",clearable:"",variant:"outlined",density:"compact","single-line":"","hide-details":"",style:{"max-width":"300px"},"data-test":"search"},null,8,["modelValue"])]),_:1}),_(I,{"items-per-page":n.itemsPerPage,"onUpdate:itemsPerPage":e[1]||(e[1]=k=>n.itemsPerPage=k),headers:n.headers,items:n.items,search:n.search,"custom-filter":o.customFilter,"item-value":"key","data-test":"limits-table",class:"limits-table",density:"compact"},{"item.timestamp":g(({item:k})=>[U(Y(k.timestamp),1)]),"item.value":g(({item:k})=>[k.limits?(C(),j(u,{key:0,parameters:k.parameters,settings:n.valueLimitsBarWidgetSettings,"screen-values":n.screenValues,"screen-time-zone":s.timeZone,onAddItem:o.addItem,onDeleteItem:o.deleteItem},null,8,["parameters","settings","screen-values","screen-time-zone","onAddItem","onDeleteItem"])):(C(),j(d,{key:1,parameters:k.parameters,settings:n.valueWidgetSettings,"screen-values":n.screenValues,"screen-time-zone":s.timeZone,onAddItem:o.addItem,onDeleteItem:o.deleteItem},null,8,["parameters","settings","screen-values","screen-time-zone","onAddItem","onDeleteItem"]))]),"item.actions":g(({item:k})=>[_(O,null,{activator:g(({props:L})=>[_(h,Ce({icon:"mdi-dots-horizontal",variant:"text",density:"compact","aria-label":"Item Options"},L),null,16)]),default:g(()=>[_(p,null,{default:g(()=>[_(m,{onClick:L=>o.ignorePacket(k.key)},{prepend:g(()=>[_(y,null,{default:g(()=>[...e[4]||(e[4]=[U("mdi-close-circle-multiple",-1)])]),_:1})]),default:g(()=>[_(f,null,{default:g(()=>[...e[5]||(e[5]=[U("Ignore Entire Packet",-1)])]),_:1})]),_:1},8,["onClick"]),_(m,{onClick:L=>o.ignoreItem(k.key)},{prepend:g(()=>[_(y,null,{default:g(()=>[...e[6]||(e[6]=[U("mdi-close-circle",-1)])]),_:1})]),default:g(()=>[_(f,null,{default:g(()=>[...e[7]||(e[7]=[U("Ignore Item",-1)])]),_:1})]),_:1},8,["onClick"]),_(m,{onClick:L=>o.removeItem(k.key)},{prepend:g(()=>[_(y,null,{default:g(()=>[...e[8]||(e[8]=[U("mdi-eye-off",-1)])]),_:1})]),default:g(()=>[_(f,null,{default:g(()=>[...e[9]||(e[9]=[U("Temporarily Hide Item",-1)])]),_:1})]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)]),"item.limits":g(({item:k})=>[_(a)]),_:1},8,["items-per-page","headers","items","search","custom-filter"]),e[10]||(e[10]=$("div",{class:"footer"},' Note: Timestamp is "now" for items currently out of limits when the page is loaded. ',-1))]),_:1}),_(D,{modelValue:n.ignoredItemsDialog,"onUpdate:modelValue":e[3]||(e[3]=k=>n.ignoredItemsDialog=k),"max-width":"600"},{default:g(()=>[_(x,null,{default:g(()=>[_(b,{height:"24"},{default:g(()=>[_(a),e[11]||(e[11]=$("span",null,"Ignored Items",-1)),_(a)]),_:1}),_(T,{class:"mt-2"},{default:g(()=>[$("div",null,[(C(!0),H(se,null,ue(o.ignoredFormatted,(k,L)=>(C(),H("div",{key:L},[_(l,{class:"ma-1 align-center"},{default:g(()=>[$("span",Ri,Y(k),1),_(a),_(h,{icon:"mdi-delete",density:"compact",variant:"text","aria-label":"Remove Ignored Item","data-test":`remove-ignore-${L}`,onClick:le=>o.restoreItem(L)},null,8,["data-test","onClick"])]),_:2},1024),L<o.ignoredFormatted.length-1?(C(),j(A,{key:L})):re("",!0)]))),128))])]),_:1}),_(z,{class:"px-2"},{default:g(()=>[_(h,{variant:"outlined",onClick:o.clearAll},{default:g(()=>[...e[12]||(e[12]=[U(" Clear All ",-1)])]),_:1},8,["onClick"]),_(a),_(h,{variant:"flat",onClick:e[2]||(e[2]=k=>n.ignoredItemsDialog=!1)},{default:g(()=>[...e[13]||(e[13]=[U(" Ok ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])])}const Ai=xe(Oi,[["render",Ii],["__scopeId","data-v-c479a205"]]),Ti={mixins:[ze],props:{historyCount:{type:Number,default:1e3},timeZone:{type:String,default:"local"}},data(){return{data:[],cable:new _s,search:"",headers:[{title:"Time",value:"time_nsec",width:250},{title:"Level",value:"level",sortable:!1},{title:"Message",value:"message"}]}},created(){this.cable.createSubscription("LimitsEventsChannel",window.openc3Scope,{received:t=>{this.cable.recordPing(),this.handleMessages(t)}},{historyCount:1e3}).then(t=>{this.limitsSubscription=t})},unmounted(){this.limitsSubscription&&this.limitsSubscription.unsubscribe(),this.cable.disconnect()},methods:{handleMessages(t){for(let e=0;e<t.length;e++){let s=JSON.parse(t[e].event);this.data.unshift(s)}this.data.length>this.historyCount&&(this.data.length=this.historyCount)},getStatus(t){return t.includes("GREEN")?"normal":t.includes("YELLOW")?"caution":t.includes("RED")?"critical":t.includes("BLUE")?"standby":"off"},getColorClass(t){return t.includes("GREEN")?"openc3-green":t.includes("YELLOW")?"openc3-yellow":t.includes("RED")?"openc3-red":t.includes("BLUE")?"openc3-blue":"openc3-white"},calcTableHeight(){return window.innerHeight-250}}},Li=["status"];function ji(t,e,s,r,n,o){const i=w("v-spacer"),a=w("v-text-field"),l=w("v-card-title"),u=w("v-data-table"),d=w("v-card");return C(),j(d,{class:"card-height"},{default:g(()=>[_(l,{class:"d-flex align-center"},{default:g(()=>[e[1]||(e[1]=U(" Limits Events ",-1)),_(i),_(a,{modelValue:n.search,"onUpdate:modelValue":e[0]||(e[0]=h=>n.search=h),label:"Search","prepend-inner-icon":"mdi-magnify",clearable:"",variant:"outlined",density:"compact","single-line":"","hide-details":"",class:"search"},null,8,["modelValue"])]),_:1}),_(u,{headers:n.headers,items:n.data,search:n.search,"items-per-page":-1,"hide-default-footer":"","multi-sort":"",density:"compact",height:o.calcTableHeight(),hover:"","data-test":"limits-events"},{"item.time_nsec":g(({item:h})=>[$("span",null,Y(t.formatNanoseconds(h.time_nsec,s.timeZone)),1)]),"item.level":g(({item:h})=>[$("rux-status",{status:o.getStatus(h.message)},null,8,Li)]),"item.message":g(({item:h})=>[$("span",{class:He(o.getColorClass(h.message))},Y(h.message),3)]),_:1},8,["headers","items","search","height"])]),_:1})}const Ni={components:{LimitsControl:Ai,LimitsEvents:xe(Ti,[["render",ji],["__scopeId","data-v-3c276116"]]),TopBar:Ps,OpenConfigDialog:gt,SaveConfigDialog:mt},mixins:[pt],data(){return{title:"Limits Monitor",configKey:"limits_monitor",api:new ks,timeZone:"local",renderKey:0,ignored:[],openConfig:!1,saveConfig:!1,limitsSets:[],currentLimitsSet:null,currentSetRefreshInterval:null,limitsSetDialog:!1,menus:[{label:"File",items:[{label:"Show Ignored",icon:"mdi-magnify-close",command:()=>{this.$refs.control.showIgnored()}},{label:"Change Limits Set",icon:"mdi-swap-horizontal",command:()=>{this.limitsSetDialog=!0}},{divider:!0},{label:"Open Configuration",icon:"mdi-folder-open",command:()=>{this.openConfig=!0}},{label:"Save Configuration",icon:"mdi-content-save",command:()=>{this.saveConfig=!0}},{label:"Reset Configuration",icon:"mdi-monitor-shimmer",command:()=>{this.ignored=[],this.resetConfigBase(),this.renderKey++}}]}]}},created(){this.api.get_limits_sets().then(t=>{this.limitsSets=t}),this.api.get_setting("time_zone").then(t=>{t&&(this.timeZone=t)}).catch(t=>{})},mounted:function(){if(this.$route.query&&this.$route.query.config)this.openConfiguration(this.$route.query.config,!0);else{let t=this.loadDefaultConfig();JSON.stringify(t)!=="{}"&&(this.ignored=t,this.renderKey++)}},unmounted:function(){clearInterval(this.currentSetRefreshInterval)},methods:{setLimitsSet:function(){this.api.set_limits_set(this.currentLimitsSet),this.limitsSetDialog=!1,this.renderKey++},openConfiguration:function(t,e=!1){this.openConfigBase(t,e,s=>{this.ignored=s,this.renderKey++})},saveConfiguration:function(t){this.saveConfigBase(t,this.ignored)}}};function Pi(t,e,s,r,n,o){const i=w("top-bar"),a=w("limits-control"),l=w("limits-events"),u=w("open-config-dialog"),d=w("save-config-dialog"),h=w("v-spacer"),y=w("v-toolbar"),f=w("v-select"),m=w("v-card-text"),p=w("v-btn"),O=w("v-card-actions"),I=w("v-card"),x=w("v-dialog");return C(),H("div",null,[_(i,{menus:n.menus,title:n.title},null,8,["menus","title"]),(C(),j(a,{ref:"control",key:n.renderKey,modelValue:n.ignored,"onUpdate:modelValue":e[0]||(e[0]=b=>n.ignored=b),"time-zone":n.timeZone},null,8,["modelValue","time-zone"])),e[12]||(e[12]=$("div",{style:{height:"15px"}},null,-1)),_(l,{"time-zone":n.timeZone},null,8,["time-zone"]),n.openConfig?(C(),j(u,{key:0,modelValue:n.openConfig,"onUpdate:modelValue":e[1]||(e[1]=b=>n.openConfig=b),"config-key":n.configKey,onSuccess:o.openConfiguration},null,8,["modelValue","config-key","onSuccess"])):re("",!0),n.saveConfig?(C(),j(d,{key:1,modelValue:n.saveConfig,"onUpdate:modelValue":e[2]||(e[2]=b=>n.saveConfig=b),"config-key":n.configKey,onSuccess:o.saveConfiguration},null,8,["modelValue","config-key","onSuccess"])):re("",!0),_(x,{modelValue:n.limitsSetDialog,"onUpdate:modelValue":e[5]||(e[5]=b=>n.limitsSetDialog=b),"max-width":"650",persistent:"",onKeydown:e[6]||(e[6]=yt(b=>n.limitsSetDialog=!1,["esc"]))},{default:g(()=>[_(I,null,{default:g(()=>[_(y,{height:"24"},{default:g(()=>[_(h),e[7]||(e[7]=$("span",null,"Change Limits Set",-1)),_(h)]),_:1}),_(m,{class:"mt-6"},{default:g(()=>[e[8]||(e[8]=$("span",{style:{display:"block"}}," The Limits Set is a global option which changes the Limits Set across all tools. ",-1)),e[9]||(e[9]=$("span",{style:{display:"block"}}," NOTE: Changing this option clears the current list and recalculates based on the new set. ",-1)),_(f,{modelValue:n.currentLimitsSet,"onUpdate:modelValue":e[3]||(e[3]=b=>n.currentLimitsSet=b),label:"Limits Set",items:n.limitsSets,density:"compact",variant:"outlined","data-test":"limits-set","hide-details":"",class:"mt-3",style:{"max-width":"200px"}},null,8,["modelValue","items"])]),_:1}),_(O,{class:"px-2"},{default:g(()=>[_(h),_(p,{variant:"outlined",onClick:e[4]||(e[4]=b=>n.limitsSetDialog=!1)},{default:g(()=>[...e[10]||(e[10]=[U(" Cancel ",-1)])]),_:1}),_(p,{variant:"flat",onClick:o.setLimitsSet},{default:g(()=>[...e[11]||(e[11]=[U(" Ok ",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])])}const eo=As("default",xe(Ni,[["render",Pi]]))}}});
|
|
7
|
+
`+n):s.stack=n}catch{}}throw s}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=ie(this.defaults,e);const{transitional:s,paramsSerializer:r,headers:n}=e;s!==void 0&&Fe.assertOptions(s,{silentJSONParsing:X.transitional(X.boolean),forcedJSONParsing:X.transitional(X.boolean),clarifyTimeoutError:X.transitional(X.boolean)},!1),r!=null&&(c.isFunction(r)?e.paramsSerializer={serialize:r}:Fe.assertOptions(r,{encode:X.function,serialize:X.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),Fe.assertOptions(e,{baseUrl:X.spelling("baseURL"),withXsrfToken:X.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let o=n&&c.merge(n.common,n[e.method]);n&&c.forEach(["delete","get","head","post","put","patch","common"],f=>{delete n[f]}),e.headers=V.concat(o,n);const i=[];let a=!0;this.interceptors.request.forEach(function(f){typeof f.runWhen=="function"&&f.runWhen(e)===!1||(a=a&&f.synchronous,i.unshift(f.fulfilled,f.rejected))});const l=[];this.interceptors.response.forEach(function(f){l.push(f.fulfilled,f.rejected)});let u,d=0,h;if(!a){const f=[rs.bind(this),void 0];for(f.unshift(...i),f.push(...l),h=f.length,u=Promise.resolve(e);d<h;)u=u.then(f[d++],f[d++]);return u}h=i.length;let y=e;for(;d<h;){const f=i[d++],m=i[d++];try{y=f(y)}catch(p){m.call(this,p);break}}try{u=rs.call(this,y)}catch(f){return Promise.reject(f)}for(d=0,h=l.length;d<h;)u=u.then(l[d++],l[d++]);return u}getUri(t){t=ie(this.defaults,t);const e=Ht(t.baseURL,t.url,t.allowAbsoluteUrls);return Ft(e,t.params,t.paramsSerializer)}};c.forEach(["delete","get","head","options"],function(t){oe.prototype[t]=function(e,s){return this.request(ie(s||{},{method:t,url:e,data:(s||{}).data}))}}),c.forEach(["post","put","patch"],function(t){function e(s){return function(r,n,o){return this.request(ie(o||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}oe.prototype[t]=e(),oe.prototype[t+"Form"]=e(!0)});let dn=class Is{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(n){s=n});const r=this;this.promise.then(n=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](n);r._listeners=null}),this.promise.then=n=>{let o;const i=new Promise(a=>{r.subscribe(a),o=a}).then(n);return i.cancel=function(){r.unsubscribe(o)},i},e(function(n,o,i){r.reason||(r.reason=new fe(n,o,i),s(r.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=r=>{e.abort(r)};return this.subscribe(s),e.signal.unsubscribe=()=>this.unsubscribe(s),e.signal}static source(){let e;return{token:new Is(function(s){e=s}),cancel:e}}};function hn(t){return function(e){return t.apply(null,e)}}function fn(t){return c.isObject(t)&&t.isAxiosError===!0}const rt={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(rt).forEach(([t,e])=>{rt[e]=t});function os(t){const e=new oe(t),s=St(oe.prototype.request,e);return c.extend(s,oe.prototype,e,{allOwnKeys:!0}),c.extend(s,e,null,{allOwnKeys:!0}),s.create=function(r){return os(ie(t,r))},s}const N=os(_e);N.Axios=oe,N.CanceledError=fe,N.CancelToken=dn,N.isCancel=qt,N.VERSION=ns,N.toFormData=Le,N.AxiosError=S,N.Cancel=N.CanceledError,N.all=function(t){return Promise.all(t)},N.spread=hn,N.isAxiosError=fn,N.mergeConfig=ie,N.AxiosHeaders=V,N.formToJSON=t=>$t(c.isHTMLForm(t)?new FormData(t):t),N.getAdapter=ss.getAdapter,N.HttpStatusCode=rt,N.default=N;const{Axios:Fi,AxiosError:Di,CanceledError:Bi,isCancel:$i,CancelToken:Vi,VERSION:qi,all:Mi,Cancel:zi,isAxiosError:Wi,spread:Hi,toFormData:Ji,AxiosHeaders:Ki,HttpStatusCode:Zi,formToJSON:Yi,getAdapter:Gi,mergeConfig:Xi}=N,as=N.create({baseURL:location.origin,timeout:6e4,params:{}});as.interceptors.response.use(t=>t,t=>{var e,s,r,n,o,i,a,l,u,d,h;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} `),(r=(s=t.response)==null?void 0:s.config)!=null&&r.data&&(y+=`${t.response.config.data} `),(o=(n=t.response)==null?void 0:n.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=(l=t.response)==null?void 0:l.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+=`${(h=t.response)==null?void 0:h.data}`;const{$cosmosNotify:f}=window;throw f&&f.serious({title:"Network error",body:y}),t}else throw t});let De=()=>({emit(t,...e){for(let s=this.events[t]||[],r=0,n=s.length;r<n;r++)s[r](...e)},events:{},on(t,e){var s;return((s=this.events)[t]||(s[t]=[])).push(e),()=>{var r;this.events[t]=(r=this.events[t])==null?void 0:r.filter(n=>e!==n)}}});class we extends Error{constructor(e,s){e instanceof Error?(super(e.message),this.cause=e):super(e),this.reason=s,this.name="ReasonError"}}class nt extends we{constructor(e){super("Rejected",e),this.name="SubscriptionRejectedError"}}class pn extends we{constructor(e){super(e||"Timed out to receive subscription ack"),this.name="SubscriptionTimeoutError"}}class K extends we{constructor(e,s){s?super(e,s):super("Disconnected",e),this.name="DisconnectedError"}}class mn extends K{constructor(e){super(e,"stale_connection"),this.name="StaleConnectionError"}}function cs(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 gn{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:r,info:n})=>(s[r]=n,s),{})}}const ae=Symbol("state");class ls{constructor(e={}){this.emitter=De(),this.params=Object.freeze(e),this.presence=new gn(this),this.initialConnect=!0,this[ae]="idle"}get identifier(){return this._identifier?this._identifier:(this._identifier=cs({channel:this.channelId,...this.params}),this._identifier)}get channelId(){return this.constructor.identifier}get state(){return this[ae]}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[ae]="connecting"}connected(){if(this.state==="connected"||this.state==="closed")return;this[ae]="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[ae]="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[ae]="disconnected",this.presence.reset(),this.emit("disconnect",e))}closed(e){this.state!=="closed"&&(this[ae]="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 r=this.receiver?this.receiver.logger:null;r&&r.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 r=this.emitter.on(e,(...n)=>{r(),s(...n)});return r}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 r=[()=>delete this._pendingSubscribe];r.push(this.on("connect",()=>{r.forEach(n=>n()),e()})),r.push(this.on("close",n=>{r.forEach(o=>o()),s(n||new we("Channel was disconnected before subscribing","canceled"))}))}),this._pendingSubscribe)}}class bn{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(r=>r[e](s[0])):this.channels.forEach(r=>r[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,r={promise:new Promise(o=>{s=o}),intent:e,release:()=>{this._pendings.splice(this._pendings.indexOf(r),1),s(r)},canceled:!1,acquired:!1},n=this._pendingTop;return this._pendings.push(r),n&&await n.promise,this.gvl&&await this.gvl.acquire(r,e),r.acquired=!0,r}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 _n{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 yn{constructor(e){e.concurrentSubscribes===!1&&(this.glv=new _n),this._subscriptions={},this._localToRemote={}}all(){return Object.values(this._subscriptions)}get(e){return this._subscriptions[e]}create(e,{subscribe:s,unsubscribe:r}){let n=this._subscriptions[e]=new bn(e);return n.remoteId=this._localToRemote[e],n.subscriber=s,n.unsubscriber=r,n.gvl=this.glv,n}remove(e){delete this._subscriptions[e],delete this._localToRemote[e]}storeRemoteId(e,s){this._localToRemote[e]=s;let r=this.get(e);r&&(r.remoteId=s)}}class wn{constructor(e={}){this.subscriptions=new yn(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 r=s.remoteId;r&&delete this._remoteToLocal[r],this.subscriptions.remove(e)}transmit(e,s,r){let n=this._remoteToLocal[e];if(!n){this._pendingMessages.push([e,s,r]);return}let o=this.subscriptions.get(n);o&&o.channels.forEach(i=>{i.receive(s,r)})}notify(e,s,r){let n=this._remoteToLocal[e];if(!n)return;let o=this.subscriptions.get(n);o&&o.channels.forEach(i=>i.emit(s,r))}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 r of this._pendingMessages)r[0]===e?this.transmit(r[0],r[1],r[2]):s.push(r);this._pendingMessages=s}}const us={debug:0,info:1,warn:2,error:3};class ds{constructor(e){this.level=e||"warn"}log(e,s,r){us[e]<us[this.level]||this.writeLogEntry(e,s,r)}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 ve extends ds{writeLogEntry(){}}class vn{encode(e){return JSON.stringify(e)}decode(e){try{return JSON.parse(e)}catch{}}}let Sn=0;class hs{constructor(e={}){let{logger:s}=e;this.logger=s||new ve,this.pendingSubscriptions={},this.pendingUnsubscriptions={},this.subscribeCooldownInterval=e.subscribeCooldownInterval||250,this.subscribeRetryInterval=e.subscribeRetryInterval||5e3}attached(e){this.cable=e}subscribe(e,s){let r={channel:e};s&&Object.assign(r,s);let n=cs(r);if(this.pendingUnsubscriptions[n]){let i=this.subscribeCooldownInterval*1.5;return this.logger.debug(`unsubscribed recently, cooldown for ${i}`,n),new Promise(a=>{setTimeout(()=>{a(this.subscribe(e,s))},i)})}if(this.pendingSubscriptions[n])return this.logger.warn("subscription is already pending, skipping",n),Promise.reject(Error("Already subscribing"));let o=this.subscribeRetryInterval;return new Promise((i,a)=>{let l=++Sn;this.pendingSubscriptions[n]={resolve:i,reject:a,id:l},this.cable.send(this.buildSubscribeRequest(n)),this.maybeRetrySubscribe(l,n,o)})}buildSubscribeRequest(e){return{command:"subscribe",identifier:e}}maybeRetrySubscribe(e,s,r){setTimeout(()=>{let n=this.pendingSubscriptions[s];n&&n.id===e&&(this.logger.warn(`no subscription ack received in ${r}ms, retrying subscribe`,s),this.cable.send(this.buildSubscribeRequest(s)),this.maybeExpireSubscribe(e,s,r))},r)}maybeExpireSubscribe(e,s,r){setTimeout(()=>{let n=this.pendingSubscriptions[s];n&&n.id===e&&(delete this.pendingSubscriptions[s],n.reject(new pn(`Haven't received subscription ack in ${r*2}ms for ${s}`)))},r)}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,r){return s==="$whisper"?this.whisper(e,r):(r||(r={}),r.action=s,this.cable.send({command:"message",identifier:e,data:JSON.stringify(r)}),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:r,message:n,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[r];if(!a){this.logger.error("subscription not found, unsubscribing",{type:s,identifier:r}),this.unsubscribe(r);return}return delete this.pendingSubscriptions[r],a.resolve(r)}if(s==="reject_subscription"){let a=this.pendingSubscriptions[r];return a?(delete this.pendingSubscriptions[r],a.reject(new nt)):this.logger.error("subscription not found",{type:s,identifier:r})}if(n)return{identifier:r,message:n};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 fs=()=>Date.now()/1e3|0;class En extends hs{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=fs()),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:r,message:n}=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[r]||(this.subscriptionStreams[r]=new Set),super.receive(e);if(s==="ping")return this.restoreSince&&(this.restoreSince=fs()),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",r);return}if(s==="reject_history"){this.logger.warn("failed to retrieve history",e),this.cable.notify("history_not_found",r);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=n.type;if(o==="info"){let i=this.pendingPresence[r];i&&(delete this.pendingPresence[r],i.resolve(n))}else if(o==="error"){let i=this.pendingPresence[r];i&&(delete this.pendingPresence[r],i.reject(new Error("failed to retrieve presence")))}return{type:s,identifier:r,message:n}}if(n){let o=this.trackStreamPosition(r,e.stream_id,e.epoch,e.offset);return{identifier:r,message:n,meta:o}}this.logger.warn(`unknown message type: ${s}`,{message:e})}perform(e,s,r){switch(s){case"$presence:join":return this.join(e,r);case"$presence:leave":return this.leave(e,r);case"$presence:info":return this.presence(e,r)}return super.perform(e,s,r)}unsubscribe(e){return delete this.presenceInfo[e],super.unsubscribe(e)}buildSubscribeRequest(e){let s=super.buildSubscribeRequest(e),r=this.historyRequestFor(e);r&&(s.history=r,this.pendingHistory[e]=!0);let n=this.presenceInfo[e];return n&&(s.presence=n),s}recoverableClosure(){return!!this.sessionId}historyRequestFor(e){let s={},r=!1;if(this.subscriptionStreams[e])for(let n of this.subscriptionStreams[e]){let o=this.streamsPositions[n];o&&(r=!0,s[n]=o)}if(!(!r&&!this.restoreSince))return{since:this.restoreSince,streams:s}}trackStreamPosition(e,s,r,n){if(!(!s||!r))return this.subscriptionStreams[e]||(this.subscriptionStreams[e]=new Set),this.subscriptionStreams[e].add(s),this.streamsPositions[s]={epoch:r,offset:n},{stream:s,epoch:r,offset:n}}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((r,n)=>{this.pendingPresence[e]={resolve:r,reject:n},this.cable.send({command:"presence",identifier:e,data:s})})}}class xn extends we{constructor(){super("No connection","closed"),this.name="NoConnectionError"}}class it extends ls{constructor(e,s){super(s),this.channelId=e}set channelId(e){this._channelId=e}get channelId(){return this._channelId}}ke(it,"identifier","__ghost__");const Cn="$pubsub";class ot extends ls{async perform(e,s){if(e.startsWith("$"))return super.perform(e,s);throw Error("not implemented")}}ke(ot,"identifier",Cn);const ce=Symbol("state");let On=class{constructor({transport:t,protocol:e,encoder:s,logger:r,lazy:n,hubOptions:o,performFailures:i,transportConfigurator:a}){this.emitter=De(),this.transport=t,this.encoder=s,this.logger=r||new ve,this.protocol=e,this.performFailures=i||"throw",this.protocol.attached(this),this.hub=new wn(o||{}),this[ce]="idle",this.handleClose=this.handleClose.bind(this),this.handleIncoming=this.handleIncoming.bind(this),this.transportConfigurator=a,this.transport.on("close",this.handleClose),this.transport.on("data",this.handleIncoming),this.initialConnect=!0,this.recovering=!1,n===!1&&this.connect().catch(()=>{})}get state(){return this[ce]}async connect(){if(this.state==="connected")return Promise.resolve();if(this.state==="connecting")return this.pendingConnect();let t=this.state==="idle";this[ce]="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[ce]="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[ce]="connected",this.hub.subscriptions.all().forEach(r=>{t&&r.remoteId&&t.includes(r.remoteId)?r.notify("restored"):(r.notify("disconnected",new K("recovery_failed")),this._resubscribe(r))});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[ce]="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[ce]="closed";let s=e||new K("cable_closed");this.hub.subscriptions.all().forEach(r=>r.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:r,identifier:n,message:o,meta:i}=s;r?this.hub.notify(n,r,o):this.hub.transmit(n,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 ot({stream_name:t});return this.subscribe(e)}streamFromSigned(t){let e=new ot({signed_stream_name:t});return this.subscribe(e)}subscribeTo(t,e){let s,r;return typeof t=="string"&&(r=t,t=it),s=r?new t(r,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:r=>this._subscribe(r,t.channelId,t.params),unsubscribe:r=>this._unsubscribe(r)});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 r=t.id;if(this.state==="idle"&&this.connect().catch(()=>{}),this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:r});return}this.logger.debug("acquiring subscribe lock",{identifier:r});let n=await t.acquire("subscribed");if(n.canceled){this.logger.debug("subscribe lock has been canceled",{identifier:r}),n.release();return}if(this.logger.debug("subscribe lock has been acquired",{identifier:r}),t.intent!=="subscribed"){this.logger.debug("cancel subscribe request, already unsubscribed"),n.release();return}if(this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:r}),n.release();return}if(t.state==="connected"){this.logger.debug("already connected, skip subscribe command",{identifier:r}),t.notify("connected"),n.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(r,i),this.logger.debug("subscribed",{...o,remoteId:i}),t.notify("connected")}catch(i){if(i){if(i instanceof nt&&this.logger.warn("rejected",o),i instanceof K){this.logger.debug("disconnected during subscription; will retry on connect",o),n.release();return}this.logger.error("failed to subscribe",{error:i,...o})}t.close(i),this.hub.unsubscribe(r)}n.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 r=t.remoteId;if(this.logger.debug("unsubscribing...",{remoteId:r}),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(r),this.logger.debug("unsubscribed remotely",{id:e})}catch(n){n&&(n instanceof K?this.logger.debug("cable disconnected during the unsubscribe command execution",{id:e,error:n}):this.logger.error("unsubscribe failed",{id:e,error:n}))}t.intent==="unsubscribed"?(t.close(),this.hub.unsubscribe(e)):t.state="closed",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(r){this.performFailures==="warn"&&this.logger.warn("perform failed",{error:r});return}}async _perform(t,e,s){if(this.state==="connecting"&&await this.pendingConnect(),this.state==="closed"||this.state==="disconnected")throw new xn;let r=this.hub.subscriptions.get(t);if(!r)throw Error(`Subscription not found: ${t}`);if(await r.pending("subscribed"),r.intent!=="subscribed")throw Error(`Subscription is closed: ${t}`);let n=r.remoteId,o={id:n,action:e,payload:s};this.logger.debug("perform",o);try{let i=await this.protocol.perform(n,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,(...r)=>{s(),e(...r)});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(r=>r()),t()})),s.push(this.on("close",r=>{s.forEach(n=>n()),e(r)})),s.push(this.on("disconnect",r=>{s.forEach(n=>n()),e(r)}))}),this._pendingConnect)}};const kn={maxMissingPings:2,maxReconnectAttempts:1/0},pe=()=>Date.now(),ps=(t,e)=>{e=e||{};let{backoffRate:s,jitterRatio:r,maxInterval:n}=e;return s=s||2,r===void 0&&(r=.5),o=>{let i=t*s**o,a=i*s,l=i+(a-i)*Math.random(),u=2*(Math.random()-.5)*r;return l=l*(1+u),n&&n<l&&(l=n),l}};let ms=class{constructor({pingInterval:t,...e}){if(this.pingInterval=t,!this.pingInterval)throw Error(`Incorrect pingInterval is provided: ${t}`);if(e=Object.assign({},kn,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 ve,this.state="pending_connect",this.attempts=0,this.disconnectedAt=pe()}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=pe(),this.state="connected",this.cancelReconnect(),this.startPolling()})),this.unbind.push(this.target.on("disconnect",()=>{this.disconnectedAt=pe(),this.state="disconnected",this.stopPolling(),this.scheduleReconnect()})),this.unbind.push(this.target.on("close",()=>{this.disconnectedAt=pe(),this.state="closed",this.cancelReconnect(),this.stopPolling()})),this.unbind.push(this.target.on("keepalive",()=>{this.pingedAt=pe()})),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=pe()-this.pingedAt;t>this.maxMissingPings*this.pingInterval&&(this.logger.warn(`Stale connection: ${t}ms without pings`),this.state="pending_disconnect",this.target.disconnected(new mn))}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 Rn{constructor(e,s={}){this.transports=e,this.transport=null,this.emitter=De(),this.unbind=[],this.logger=s.logger||new ve}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(r){this.logger.debug(`Failed to connect via ${s.displayName()}: ${r.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(r=>{r.setParam(e,s)})}setToken(e,s){this.transports.forEach(r=>{r.setToken(e,s)})}on(e,s){return this.emitter.on(e,s)}once(e,s){let r=this.emitter.on(e,(...n)=>{r(),s(...n)});return r}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 In{constructor(e,s={}){this.url=e;let r=s.websocketImplementation;if(r)this.Impl=r;else if(typeof WebSocket<"u")this.Impl=WebSocket;else throw new Error("No WebSocket support");this.connected=!1,this.emitter=De();let{format:n,subprotocol:o,authStrategy:i}=s;this.format=n||"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,r)=>{let n=[];n.push(this.once("open",()=>{n.forEach(o=>o()),s()})),n.push(this.once("close",()=>{n.forEach(o=>o()),r(Error("WS connection closed"))}))})}setURL(e){this.url=e}setParam(e,s){let r=new URL(this.url);r.searchParams.set(e,s);let n=`${r.protocol}//${r.host}${r.pathname}?${r.searchParams}`;this.setURL(n)}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 r=`x-${s}`.toLowerCase();r=Object.keys(this.connectionOptions.headers).find(n=>n.toLowerCase()===r)||r,this.connectionOptions.headers[r]=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 r=this.emitter.on(e,(...n)=>{r(),s(...n)});return r}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 gs={protocol:"actioncable-v1-json",pingInterval:3e3,maxReconnectAttempts:1/0,maxMissingPings:2,logLevel:"warn",lazy:!0};function An(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({},gs,e);let{protocol:s,websocketImplementation:r,websocketFormat:n,websocketOptions:o,websocketAuthStrategy:i,fallbacks:a,logLevel:l,logger:u,transport:d,encoder:h,lazy:y,monitor:f,pingInterval:m,reconnectStrategy:p,maxMissingPings:O,maxReconnectAttempts:I,subprotocol:x,tokenRefresher:b,historyTimestamp:A,protocolOptions:T,concurrentSubscribes:z,performFailures:D,transportConfigurator:k,auth:L}=e;if(u=u||new ve(l),typeof s=="string"){x=x||s;let Z=s.substring(0,s.lastIndexOf("-")),Y=s.substring(s.lastIndexOf("-")+1);if(T=T||{},Z==="actioncable-v1")s=new hs({logger:u,...T});else if(Z==="actioncable-v1-ext")s=new En({logger:u,historyTimestamp:A,...T});else throw Error(`Protocol is not supported yet: ${s}`);if(Y==="json")h=h||new vn,n=n||"text";else if(Y==="msgpack"){if(n="binary",!h)throw Error("Msgpack encoder must be specified explicitly. Use `@anycable/msgpack-encoder` package or build your own")}else if(Y==="protobuf"){if(n=n||"binary",!h)throw Error("Protobuf encoder must be specified explicitly. Use `@anycable/protobuf-encoder` package or build your own")}else throw Error(`Protocol is not supported yet: ${s}`)}if(!s)throw Error("Protocol must be specified");d=d||new In(t,{websocketImplementation:r,websocketOptions:o,subprotocol:x,authStrategy:i,format:n}),a&&(d=new Rn([d,...a],{logger:u})),L&&L.token&&d.setToken(L.token,L.param||"jid"),p=p||ps(m),f!==!1&&(f=f||new ms({pingInterval:m,reconnectStrategy:p,maxMissingPings:O,maxReconnectAttempts:I,logger:u}));let le={concurrentSubscribes:z},Q=new On({protocol:s,transport:d,encoder:h,logger:u,lazy:y,hubOptions:le,performFailures:D,transportConfigurator:k});return f&&(f.watch(Q),Q.monitor=f),b&&Tn(Q,async()=>{try{await b(d)}catch(Z){return u.error("Failed to refresh authentication token: "+Z),!1}return Q.connect().catch(()=>{}),!0}),Q}function Tn(t,e){let s=!1;t.on("connect",()=>s=!1),t.on("close",async r=>{if(r){if(s){t.logger.warn("Token auto-refresh is disabled",r);return}r.reason==="token_expired"&&(s=!0,await e())}})}class Ln{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 jn extends it{constructor(e,s,r){super(e,s),this.subscription=new Ln(this),Object.assign(this.subscription,r),this.on("connect",({reconnect:n})=>this.subscription.notify("connected",{reconnected:n})),this.on("disconnect",()=>this.subscription.notify("disconnected",{allowReconnect:!0})),this.on("message",n=>this.subscription.notify("received",n)),this.on("close",n=>{n&&n instanceof nt?this.subscription.notify("rejected"):this.subscription.notify("disconnected",{allowReconnect:!1})})}}class Nn{constructor(e){this.cable=e}create(e,s){let r,n;typeof e=="object"?(r=e.channel,delete e.channel,n=e):(r=e,n={});let o=new jn(r,n,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 Pn{constructor(e){this.cable=e,this.subscriptions=new Nn(e)}}class Un extends ds{writeLogEntry(e,s,r){r?console[e](s,r):console[e](s)}}class Fn extends ms{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=n=>{this.reconnectNow()&&this.logger.debug("Trigger reconnect",{event:n})},r=()=>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",r,!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",r,!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 Dn=["cable","action-cable"],Bn="/cable",Be=(t,e)=>{for(let s of Dn){let r=t.head.querySelector(`meta[name='${s}-${e}']`);if(r)return r.getAttribute("content")}},bs=t=>t.match(/wss?:\/\//)?t:typeof window<"u"?`${window.location.protocol.replace("http","ws")}//${window.location.host}${t}`:t,$n=()=>{if(typeof document<"u"&&document.head){let t=Be(document,"url");if(t)return bs(t)}return bs(Bn)},Vn=()=>{if(typeof document<"u"&&document.head){let t=Be(document,"history-timestamp");if(t)return t|0}},qn=()=>{if(typeof document<"u"&&document.head)return Be(document,"token")},Mn=()=>{if(typeof document<"u"&&document.head)return Be(document,"token-param")};function zn(t,e){typeof t=="object"&&typeof e>"u"&&(e=t,t=void 0),t=t||$n(),e=e||{},e.historyTimestamp||(e.historyTimestamp=Vn());let s=qn();if(s){let u=Mn();e.auth=Object.assign({token:s,param:u},e.auth||{})}e=Object.assign({},gs,e);let{logLevel:r,logger:n,pingInterval:o,reconnectStrategy:i,maxMissingPings:a,maxReconnectAttempts:l}=e;return n=e.logger=e.logger||new Un(r),i=e.reconnectStrategy=e.reconnectStrategy||ps(o),e.monitor!==!1&&(e.monitor=e.monitor||new Fn({pingInterval:o,reconnectStrategy:i,maxMissingPings:a,maxReconnectAttempts:l,logger:n})),An(t,e)}function Wn(t,e){let s=zn(t,e);return new Pn(s)}class _s{constructor(e="/openc3-api/cable"){this._cable=null,this._url=e}disconnect(){this._cable&&(this._cable.cable.disconnect(),this._cable=null)}createSubscription(e,s,r={},n={}){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=Wn(i)}return this._cable.subscriptions.create({channel:e,...n},r)})}recordPing(){}}function Se(t){return Hn.test(t)}const Hn=/^-?[0-9]+$/;function ys(t){return Jn.test(t)}const Jn=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function ws(t,e){if(Se(t))return Number.isSafeInteger(Number.parseInt(t,10));const s=Number.parseFloat(t),r=String(s);if(t===r)return!0;const n=vs(t),o=vs(r);return!!(n===o||(e==null?void 0:e.approx)===!0&&!Se(t)&&o.length>=14&&n.startsWith(o.substring(0,14)))}let Ee=function(t){return t.underflow="underflow",t.overflow="overflow",t.truncate_integer="truncate_integer",t.truncate_float="truncate_float",t}({});function Kn(t){if(ws(t,{approx:!1}))return;if(Se(t))return Ee.truncate_integer;const e=Number.parseFloat(t);return Number.isFinite(e)?e===0?Ee.underflow:Ee.truncate_float:Ee.overflow}function vs(t){const{start:e,end:s}=Zn(t),r=t.substring(e,s),n=r.indexOf(".");return n===-1?r:r.substring(0,n)+r.substring(n+1)}function Zn(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 Yn{constructor(e){if(ke(this,"isLosslessNumber",!0),!ys(e))throw new Error(`Invalid number (value: "${e}")`);this.value=e}valueOf(){const e=Kn(this.value);if(e===void 0||e===Ee.truncate_float)return Number.parseFloat(this.value);if(Se(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 Gn(t){return t&&typeof t=="object"&&t.isLosslessNumber||!1}function Xn(t){return new Yn(t)}function Qn(t,e){return at({"":t},"",t,e)}function at(t,e,s,r){return Array.isArray(s)?r.call(t,e,ti(s,r)):s&&typeof s=="object"&&!Gn(s)?r.call(t,e,ei(s,r)):r.call(t,e,s)}function ei(t,e){for(const s of Object.keys(t)){const r=at(t,s,t[s],e);r!==void 0?t[s]=r:delete t[s]}return t}function ti(t,e){for(let s=0;s<t.length;s++)t[s]=at(t,String(s),t[s],e);return t}function si(t,e,s){const r=typeof s=="function"?{parseNumber:s}:s,n=(r==null?void 0:r.parseNumber)??Xn,o=(r==null?void 0:r.onDuplicateKey)??D;let i=0;const a=d();return I(a),b(),e?Qn(a,e):a;function l(){if(t.charCodeAt(i)===ci){i++,y();const v={};let R=!0;for(;i<t.length&&t.charCodeAt(i)!==Es;){R?R=!1:(p(),y());const W=i,ee=f();if(ee===void 0){z();return}y(),O();const M=d();if(M===void 0){Z();return}if(Object.prototype.hasOwnProperty.call(v,ee)&&!ct(M,v[ee])){const te=o({key:ee,position:W+1,oldValue:v[ee],newValue:M});te!==void 0&&(v[ee]=te)}else v[ee]=M}return t.charCodeAt(i)!==Es&&k(),i++,v}}function u(){if(t.charCodeAt(i)===li){i++,y();const v=[];let R=!0;for(;i<t.length&&t.charCodeAt(i)!==xs;){R?R=!1:p();const W=d();x(W),v.push(W)}return t.charCodeAt(i)!==xs&&L(),i++,v}}function d(){y();const v=f()??m()??l()??u()??h("true",!0)??h("false",!1)??h("null",null);return y(),v}function h(v,R){if(t.slice(i,i+v.length)===v)return i+=v.length,R}function y(){for(;ri(t.charCodeAt(i));)i++}function f(){if(t.charCodeAt(i)===lt){i++;let v="";for(;i<t.length&&t.charCodeAt(i)!==lt;){if(t.charCodeAt(i)===ai){const R=t[i+1],W=oi[R];W!==void 0?(v+=W,i++):R==="u"?$e(t.charCodeAt(i+2))&&$e(t.charCodeAt(i+3))&&$e(t.charCodeAt(i+4))&&$e(t.charCodeAt(i+5))?(v+=String.fromCharCode(Number.parseInt(t.slice(i+2,i+6),16)),i+=5):Y(i):Q(i)}else ii(t.charCodeAt(i))?v+=t[i]:le(t[i]);i++}return T(),i++,v}}function m(){const v=i;if(t.charCodeAt(i)===Cs&&(i++,A(v)),t.charCodeAt(i)===ut)i++;else if(ni(t.charCodeAt(i)))for(i++;Ve(t.charCodeAt(i));)i++;if(t.charCodeAt(i)===bi)for(i++,A(v);Ve(t.charCodeAt(i));)i++;if(t.charCodeAt(i)===Si||t.charCodeAt(i)===vi)for(i++,(t.charCodeAt(i)===Cs||t.charCodeAt(i)===pi)&&i++,A(v);Ve(t.charCodeAt(i));)i++;if(i>v)return n(t.slice(v,i))}function p(){if(t.charCodeAt(i)!==gi)throw new SyntaxError(`Comma ',' expected after value ${P()}`);i++}function O(){if(t.charCodeAt(i)!==_i)throw new SyntaxError(`Colon ':' expected after property name ${P()}`);i++}function I(v){if(v===void 0)throw new SyntaxError(`JSON value expected ${P()}`)}function x(v){if(v===void 0)throw new SyntaxError(`Array item expected ${P()}`)}function b(){if(i<t.length)throw new SyntaxError(`Expected end of input ${P()}`)}function A(v){if(!Ve(t.charCodeAt(i))){const R=t.slice(v,i);throw new SyntaxError(`Invalid number '${R}', expecting a digit ${P()}`)}}function T(){if(t.charCodeAt(i)!==lt)throw new SyntaxError(`End of string '"' expected ${P()}`)}function z(){throw new SyntaxError(`Quoted object key expected ${P()}`)}function D(v){let{key:R,position:W}=v;throw new SyntaxError(`Duplicate key '${R}' encountered at position ${W}`)}function k(){throw new SyntaxError(`Quoted object key or end of object '}' expected ${P()}`)}function L(){throw new SyntaxError(`Array item or end of array ']' expected ${P()}`)}function le(v){throw new SyntaxError(`Invalid character '${v}' ${q()}`)}function Q(v){const R=t.slice(v,v+2);throw new SyntaxError(`Invalid escape character '${R}' ${q()}`)}function Z(){throw new SyntaxError(`Object value expected after ':' ${q()}`)}function Y(v){const R=t.slice(v,v+6);throw new SyntaxError(`Invalid unicode character '${R}' ${q()}`)}function q(){return`at position ${i}`}function qe(){return i<t.length?`but got '${t[i]}'`:"but reached end of input"}function P(){return`${qe()} ${q()}`}}function ri(t){return t===ui||t===di||t===hi||t===fi}function $e(t){return t>=ut&&t<=dt||t>=yi&&t<=Ei||t>=wi&&t<=xi}function Ve(t){return t>=ut&&t<=dt}function ni(t){return t>=mi&&t<=dt}function ii(t){return t>=32&&t<=1114111}function ct(t,e){return t===e?!0:Array.isArray(t)&&Array.isArray(e)?t.length===e.length&&t.every((s,r)=>ct(s,e[r])):Ss(t)&&Ss(e)?[...new Set([...Object.keys(t),...Object.keys(e)])].every(s=>ct(t[s],e[s])):!1}function Ss(t){return typeof t=="object"&&t!==null}const oi={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
8
|
+
`,r:"\r",t:" "},ai=92,ci=123,Es=125,li=91,xs=93,ui=32,di=10,hi=9,fi=13,lt=34,pi=43,Cs=45,ut=48,mi=49,dt=57,gi=44,bi=46,_i=58,yi=65,wi=97,vi=69,Si=101,Ei=70,xi=102;function Os(t,e,s,r){return n(t);function n(l,u){if(Array.isArray(r)){const d=r.find(h=>h.test(l));if(d){const h=d.stringify(l);if(typeof h!="string"||!ys(h))throw new Error(`Invalid JSON number: output of a number stringifier must be a string containing a JSON number (output: ${h})`);return h}}if(typeof 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,u){if(l.length===0)return"[]";let d="[";for(let h=0;h<l.length;h++){const y=l[h];typeof y<"u"&&typeof y!="function"?d+=n(y):d+="null",h<l.length-1&&(d+=",")}return d+="]",d}function i(l,u){if(typeof l.toJSON=="function")return Os(l.toJSON(),e,s,void 0);const d=Array.isArray(e)?e.map(String):Object.keys(l);if(d.length===0)return"{}";let h=!0,y="{";for(const f of d){const m=l[f];if(a(f,m)){h?h=!1:y+=",";const p=JSON.stringify(f);y+=`${p}:`,y+=n(m)}}return y+="}",y}function a(l,u){return typeof u<"u"&&typeof u!="function"&&typeof u!="symbol"}}function Ci(t){return Se(t)&&!ws(t)?BigInt(t):parseFloat(t)}class ks{constructor(){ke(this,"id",1)}async exec(e,s,r={},n={},o=6e4){try{await OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity)&&OpenC3Auth.setTokens()}catch{OpenC3Auth.login()}this.id=this.id+1;try{return r.scope=window.openc3Scope,n.manual=!0,(await as.post("/openc3-api/api",{jsonrpc:"2.0",method:e,params:s,id:this.id,keyword_params:r},{headers:{Authorization:localStorage.openc3Token,"Content-Type":"application/json-rpc",...n},timeout:o,transformRequest:[(i,a)=>Os(i)],transformResponse:[i=>si(i,void 0,Ci)]})).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,r,n,o){return this.exec("map_target_to_interface",[e,s],{cmd_only:r,tlm_only:n,unmap_old:o})}unmap_target_from_interface(e,s,r,n){return this.exec("unmap_target_from_interface",[e,s],{cmd_only:r,tlm_only:n})}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,...r){return this.exec("interface_cmd",[e,s,...r])}interface_target_enable(e,s,r=!1,n=!1){return this.exec("interface_target_enable",[e,s],{cmd_only:r,tlm_only:n})}interface_target_disable(e,s,r=!1,n=!1){return this.exec("interface_target_disable",[e,s],{cmd_only:r,tlm_only:n})}interface_details(e){return this.exec("interface_details",[e])}get_all_router_info(){return this.exec("get_all_router_info",[])}map_target_to_router(e,s,r,n,o){return this.exec("map_target_to_router",[e,s],{cmd_only:r,tlm_only:n,unmap_old:o})}unmap_target_from_router(e,s,r,n){return this.exec("unmap_target_from_router",[e,s],{cmd_only:r,tlm_only:n})}connect_router(e){return this.exec("connect_router",[e])}disconnect_router(e){return this.exec("disconnect_router",[e])}router_target_enable(e,s,r=!1,n=!1){return this.exec("router_target_enable",[e,s],{cmd_only:r,tlm_only:n})}router_target_disable(e,s,r=!1,n=!1){return this.exec("router_target_disable",[e,s],{cmd_only:r,tlm_only:n})}router_details(e){return this.exec("router_details",[e])}get_target_interfaces(){return this.exec("get_target_interfaces",[])}get_tlm_cnts(e){return this.exec("get_tlm_cnts",[e])}get_item(e,s,r){return this.exec("get_item",[e,s,r])}get_param(e,s,r){return this.exec("get_param",[e,s,r])}get_parameter(e,s,r){return this.exec("get_param",[e,s,r])}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,r,n=30){const o=await this.exec("get_tlm_packet",[e,s],{type:r,stale_time:n});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,r=null,n=null,o=null){let i={stale_time:s};r!==null&&(i.cache_timeout=r),n!==null&&(i.start_time=n.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,u=null;for(let d=0;d<l;d++)u=this.decode_openc3_type(a[d][0]),u!==null&&(a[d][0]=u)}return a}get_limits(e,s,r){return this.exec("get_limits",[e,s,r])}async tlm(e,s,r,n="CONVERTED"){let o=null;if(s===void 0)o=await this.exec("tlm",[e]);else if(r===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,r],{type:n});let i=this.decode_openc3_type(o);return i!==null&&(o=i),o}async inject_tlm(e,s,r=null,n="CONVERTED"){await this.exec("inject_tlm",[e,s,r],{type:n})}set_tlm(e,s,r,n){return this.exec("set_tlm",[e,s,r],{type:n})}override_tlm(e,s,r,n){return this.exec("override_tlm",[e,s,r],{type:n})}get_overrides(){return this.exec("get_overrides")}normalize_tlm(e,s,r,n){return this.exec("normalize_tlm",[e,s,r],{type:n})}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,r,n="CONVERTED"){return this.exec("get_cmd_value",[e,s,r,n])}get_cmd_buffer(e,s){return this.exec("get_cmd_buffer",[e,s])}_cmd(e,s,r,n,o,i={}){let a=null;for(let l in n)Object.prototype.hasOwnProperty.call(n,l)&&(a=this.encode_openc3_type(n[l]),a!==null&&(n[l]=a));return this.exec(e,[s,r,n],i,o)}get_cmd_hazardous(e,s,r,n={}){return s===void 0?this.exec("get_cmd_hazardous",e,{},n):this._cmd("get_cmd_hazardous",e,s,r,n)}cmd(e,s,r,n={},o={}){return s===void 0?this.exec("cmd",e,o,n):this._cmd("cmd",e,s,r,n,o)}cmd_no_range_check(e,s,r,n={},o={}){return s===void 0?this.exec("cmd_no_range_check",e,o,n):this._cmd("cmd_no_range_check",e,s,r,n,o)}cmd_raw(e,s,r,n={},o={}){return s===void 0?this.exec("cmd_raw",e,o,n):this._cmd("cmd_raw",e,s,r,n,o)}cmd_raw_no_range_check(e,s,r,n={},o={}){return s===void 0?this.exec("cmd_raw_no_range_check",e,o,n):this._cmd("cmd_raw_no_range_check",e,s,r,n,o)}cmd_no_hazardous_check(e,s,r,n={},o={}){return s===void 0?this.exec("cmd_no_hazardous_check",e,o,n):this._cmd("cmd_no_hazardous_check",e,s,r,n,o)}cmd_no_checks(e,s,r,n={},o={}){return s===void 0?this.exec("cmd_no_checks",e,o,n):this._cmd("cmd_no_checks",e,s,r,n,o)}cmd_raw_no_hazardous_check(e,s,r,n={},o={}){return s===void 0?this.exec("cmd_raw_no_hazardous_check",e,o,n):this._cmd("cmd_raw_no_hazardous_check",e,s,r,n,o)}cmd_raw_no_checks(e,s,r,n={},o={}){return s===void 0?this.exec("cmd_raw_no_checks",e,o,n):this._cmd("cmd_raw_no_checks",e,s,r,n,o)}build_cmd(e,s,r,n={},o={}){return s===void 0?this.exec("build_cmd",e,o,n):this._cmd("build_cmd",e,s,r,n,o)}build_command(e,s,r,n={},o={}){return s===void 0?this.exec("build_cmd",e,o,n):this._cmd("build_cmd",e,s,r,n,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,r){return this.exec("save_config",[e,s,r])}delete_config(e,s){return this.exec("delete_config",[e,s])}enable_limits(e,s,r){return this.exec("enable_limits",[e,s,r])}disable_limits(e,s,r){return this.exec("disable_limits",[e,s,r])}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),r=await crypto.subtle.digest("SHA-256",s),n=new Uint8Array(r);return Array.from(n).map(o=>o.toString(16).padStart(2,"0")).join("")}}}const Oi={components:{ValueWidget:wt,ValuelimitsbarWidget:vt},mixins:[ze],props:{modelValue:{type:Array,default:()=>[]},timeZone:{type:String,default:"local"}},emits:["update:modelValue"],data(){return{api:null,cable:new _s,ignored:[],ignoredItemsDialog:!1,overallState:"GREEN",currentLimitsSet:"",items:[],itemList:[],screenItems:[],availableItems:[],screenValues:{},updateCounter:0,itemsPerPage:25,search:"",headers:[{title:"Timestamp",key:"timestamp",width:"130px",sortable:!0,nowrap:!0},{title:"Item",key:"item",value:t=>t.parameters[2],sortable:!0,minWidth:"100px",width:"200px",maxWidth:"410px"},{title:"Value",key:"value",width:"380px",sortable:!1},{title:"Controls",key:"actions",width:"80px",sortable:!1},{title:"",key:"limits",sortable:!1}],valueLimitsBarWidgetSettings:[["WIDTH","380px"],["0","WIDTH","200px"],["1","WIDTH","180px"]],valueWidgetSettings:[["WIDTH","200px"]]}},computed:{textFieldClass(){return this.overallState?`textfield-${this.overallState.toLowerCase()}`:""},overallStateFormatted(){return this.ignored.length===0?this.overallState:`${this.overallState} (Some items ignored)`},ignoredFormatted(){return this.ignored.map(t=>t.split("__").join(" "))},astroStatus(){switch(this.overallState){case"GREEN":return"normal";case"YELLOW":return"caution";case"RED":return"critical";case"BLUE":return"standby";default:return null}}},created(){this.api=new ks;for(let t of this.modelValue)t.match(/.+__.+__.+/)?this.ignoreItem(t,!0):this.ignorePacket(t,!0);this.updateOutOfLimits(),this.getCurrentLimitsSet(),this.currentSetRefreshInterval=setInterval(this.getCurrentLimitsSet,10*1e3),this.cable.createSubscription("LimitsEventsChannel",window.openc3Scope,{received:t=>{this.cable.recordPing(),this.handleMessages(t)}}).then(t=>{this.limitsSubscription=t}),this.cable.createSubscription("ConfigEventsChannel",window.openc3Scope,{received:t=>{this.cable.recordPing();const e=JSON.parse(t);this.handleConfigEvents(e)}}).then(t=>{this.configSubscription=t})},mounted(){this.updater=setInterval(()=>{this.update()},1e3)},unmounted(){this.updater!=null&&(clearInterval(this.updater),this.updater=null),this.limitsSubscription&&this.limitsSubscription.unsubscribe(),this.configSubscription&&this.configSubscription.unsubscribe(),this.cable.disconnect()},methods:{escapeBrackets(t){return t.includes("[")?t.replace(/\[/g,"[[").replace(/\]/g,"]]"):t},getCurrentLimitsSet:function(){this.api.get_limits_set().then(t=>{this.currentLimitsSet=t})},updateOutOfLimits(){this.items=[],this.itemList=[],this.api.get_out_of_limits().then(t=>{for(const e of t){let s=e.join("__");if(this.ignored.find(n=>s.includes(n)))continue;this.itemList.push(s);let r={key:e.slice(0,3).join("__"),parameters:[e[0],e[1],this.escapeBrackets(e[2])],timestamp:this.formatDateTime(new Date,this.timeZone)};e[3].includes("YELLOW")&&this.overallState!=="RED"&&(this.overallState="YELLOW"),e[3].includes("RED")&&(this.overallState="RED"),e[3]=="YELLOW"||e[3]=="RED"?r.limits=!1:r.limits=!0,this.items.push(r)}this.calcOverallState()})},calcOverallState(){let t="GREEN";for(let e of this.itemList)if(!this.ignored.find(s=>e.includes(s))&&(e.includes("YELLOW")&&t!=="RED"&&(t="YELLOW"),e.includes("RED"))){t="RED";break}this.overallState=t},ignorePacket(t,e){let[s,r,n]=t.split("__"),o=`${s}__${r}`;for(this.ignored.push(o),e||this.updateIgnored();;){let i=this.itemList.findIndex(a=>a.includes(o));if(i===-1)break;{let a=this.itemList[i].lastIndexOf("__");this.removeItem(this.itemList[i].substring(0,a))}}this.calcOverallState()},ignoreItem(t,e){this.ignored.push(t),e||this.updateIgnored(),this.removeItem(t),this.calcOverallState()},restoreItem(t){this.ignored.splice(t,1),this.updateIgnored(),this.updateOutOfLimits()},removeItem(t){const e=this.itemList.findIndex(s=>s.includes(t));this.items.splice(e,1),this.itemList.splice(e,1)},clearAll(){this.ignored=[],this.updateIgnored(),this.updateOutOfLimits()},updateIgnored(){this.$emit("update:modelValue",this.ignored)},handleConfigEvents(t){for(let e of t)e.kind==="deleted"&&e.type==="target"&&this.updateOutOfLimits()},handleMessages(t){for(let e of t){let s=JSON.parse(e.event);if(s.type!="LIMITS_CHANGE")continue;let r=`${s.target_name}__${s.packet_name}__${s.item_name}`;const n=this.itemList.findIndex(i=>i.includes(r));if(n!==-1){this.itemList[n]=`${r}__${s.new_limits_state}`,this.calcOverallState();continue}if(this.ignored.find(i=>r.includes(i))||s.new_limits_state&&!(s.new_limits_state.includes("YELLOW")||s.new_limits_state.includes("RED")))continue;let o={key:r,timestamp:this.formatNanoseconds(s.time_nsec,this.timeZone),parameters:[s.target_name,s.packet_name,this.escapeBrackets(s.item_name)]};s.new_limits_state=="YELLOW"||s.new_limits_state=="RED"?o.limits=!1:o.limits=!0,this.itemList.push(`${r}__${s.new_limits_state}`),this.items.push(o),this.calcOverallState()}},update(){this.availableItems.length!==0&&this.api.get_tlm_values(this.availableItems).then(t=>{this.updateValues(t)})},updateValues:function(t){this.updateCounter+=1;for(let e=0;e<t.length;e++)t[e].push(this.updateCounter),this.screenValues[this.screenItems[e]]=t[e]},addItem:function(t){this.api.get_tlm_available([t]).then(e=>{this.screenItems.push(t),this.availableItems.push(e[0]),this.screenValues[e[0]]=[null,null,0]})},deleteItem:function(t){let e=this.screenItems.indexOf(t);this.availableItems.splice(e,1),this.screenItems.splice(e,1)},showIgnored(){this.ignoredItemsDialog=!0},customFilter(t,e,s){if(!e||e.trim()==="")return!0;if(e=e.toLowerCase(),s.parameters&&s.parameters.length>0){for(const r of s.parameters)if(r.toLowerCase().includes(e))return!0}return!!(s.timestamp&&s.timestamp.toLowerCase().includes(e)||s.key&&s.key.toLowerCase().includes(e))}}},ki=["status"],Ri={class:"font-weight-black"};function Ii(t,e,s,r,n,o){const i=w("v-text-field"),a=w("v-spacer"),l=w("v-row"),u=w("valuelimitsbar-widget"),d=w("value-widget"),h=w("v-btn"),y=w("v-icon"),f=w("v-list-item-title"),m=w("v-list-item"),p=w("v-list"),O=w("v-menu"),I=w("v-data-table"),x=w("v-card"),b=w("v-toolbar"),A=w("v-divider"),T=w("v-card-text"),z=w("v-card-actions"),D=w("v-dialog");return C(),H("div",null,[_(x,{class:"pa-5"},{default:g(()=>[_(l,{class:"ma-1"},{default:g(()=>[_(i,{density:"compact",variant:"outlined",readonly:"","hide-details":"",label:"Overall Limits State","model-value":o.overallStateFormatted,class:He(o.textFieldClass),style:{"margin-right":"10px","max-width":"280px"},"data-test":"overall-state"},Oe({_:2},[o.astroStatus?{name:"prepend-inner",fn:g(()=>[B("rux-status",{status:o.astroStatus},null,8,ki)]),key:"0"}:void 0]),1032,["model-value","class"]),_(i,{density:"compact",variant:"outlined",readonly:"","hide-details":"",label:"Current Limits Set","model-value":n.currentLimitsSet,style:{"max-width":"200px"},"data-test":"limits-set"},null,8,["model-value"]),_(a),_(i,{modelValue:n.search,"onUpdate:modelValue":e[0]||(e[0]=k=>n.search=k),label:"Search","prepend-inner-icon":"mdi-magnify",clearable:"",variant:"outlined",density:"compact","single-line":"","hide-details":"",style:{"max-width":"300px"},"data-test":"search"},null,8,["modelValue"])]),_:1}),_(I,{"items-per-page":n.itemsPerPage,"onUpdate:itemsPerPage":e[1]||(e[1]=k=>n.itemsPerPage=k),headers:n.headers,items:n.items,search:n.search,"custom-filter":o.customFilter,"item-value":"key","data-test":"limits-table",class:"limits-table",density:"compact"},{"item.timestamp":g(({item:k})=>[U(G(k.timestamp),1)]),"item.value":g(({item:k})=>[k.limits?(C(),j(u,{key:0,parameters:k.parameters,settings:n.valueLimitsBarWidgetSettings,"screen-values":n.screenValues,"screen-time-zone":s.timeZone,onAddItem:o.addItem,onDeleteItem:o.deleteItem},null,8,["parameters","settings","screen-values","screen-time-zone","onAddItem","onDeleteItem"])):(C(),j(d,{key:1,parameters:k.parameters,settings:n.valueWidgetSettings,"screen-values":n.screenValues,"screen-time-zone":s.timeZone,onAddItem:o.addItem,onDeleteItem:o.deleteItem},null,8,["parameters","settings","screen-values","screen-time-zone","onAddItem","onDeleteItem"]))]),"item.actions":g(({item:k})=>[_(O,null,{activator:g(({props:L})=>[_(h,Ce({icon:"mdi-dots-horizontal",variant:"text",density:"compact","aria-label":"Item Options"},L),null,16)]),default:g(()=>[_(p,null,{default:g(()=>[_(m,{onClick:L=>o.ignorePacket(k.key)},{prepend:g(()=>[_(y,null,{default:g(()=>[...e[4]||(e[4]=[U("mdi-close-circle-multiple",-1)])]),_:1})]),default:g(()=>[_(f,null,{default:g(()=>[...e[5]||(e[5]=[U("Ignore Entire Packet",-1)])]),_:1})]),_:1},8,["onClick"]),_(m,{onClick:L=>o.ignoreItem(k.key)},{prepend:g(()=>[_(y,null,{default:g(()=>[...e[6]||(e[6]=[U("mdi-close-circle",-1)])]),_:1})]),default:g(()=>[_(f,null,{default:g(()=>[...e[7]||(e[7]=[U("Ignore Item",-1)])]),_:1})]),_:1},8,["onClick"]),_(m,{onClick:L=>o.removeItem(k.key)},{prepend:g(()=>[_(y,null,{default:g(()=>[...e[8]||(e[8]=[U("mdi-eye-off",-1)])]),_:1})]),default:g(()=>[_(f,null,{default:g(()=>[...e[9]||(e[9]=[U("Temporarily Hide Item",-1)])]),_:1})]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)]),"item.limits":g(({item:k})=>[_(a)]),_:1},8,["items-per-page","headers","items","search","custom-filter"]),e[10]||(e[10]=B("div",{class:"footer"},' Note: Timestamp is "now" for items currently out of limits when the page is loaded. ',-1))]),_:1}),_(D,{modelValue:n.ignoredItemsDialog,"onUpdate:modelValue":e[3]||(e[3]=k=>n.ignoredItemsDialog=k),"max-width":"600"},{default:g(()=>[_(x,null,{default:g(()=>[_(b,{height:"24"},{default:g(()=>[_(a),e[11]||(e[11]=B("span",null,"Ignored Items",-1)),_(a)]),_:1}),_(T,{class:"mt-2"},{default:g(()=>[B("div",null,[(C(!0),H(se,null,ue(o.ignoredFormatted,(k,L)=>(C(),H("div",{key:L},[_(l,{class:"ma-1 align-center"},{default:g(()=>[B("span",Ri,G(k),1),_(a),_(h,{icon:"mdi-delete",density:"compact",variant:"text","aria-label":"Remove Ignored Item","data-test":`remove-ignore-${L}`,onClick:le=>o.restoreItem(L)},null,8,["data-test","onClick"])]),_:2},1024),L<o.ignoredFormatted.length-1?(C(),j(A,{key:L})):re("",!0)]))),128))])]),_:1}),_(z,{class:"px-2"},{default:g(()=>[_(h,{variant:"outlined",onClick:o.clearAll},{default:g(()=>[...e[12]||(e[12]=[U(" Clear All ",-1)])]),_:1},8,["onClick"]),_(a),_(h,{variant:"flat",onClick:e[2]||(e[2]=k=>n.ignoredItemsDialog=!1)},{default:g(()=>[...e[13]||(e[13]=[U(" Ok ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])])}const Ai=xe(Oi,[["render",Ii],["__scopeId","data-v-c479a205"]]),Ti={mixins:[ze],props:{historyCount:{type:Number,default:1e3},timeZone:{type:String,default:"local"}},data(){return{data:[],cable:new _s,search:"",headers:[{title:"Time",value:"time_nsec",width:250},{title:"Level",value:"level",sortable:!1},{title:"Message",value:"message"}]}},created(){this.cable.createSubscription("LimitsEventsChannel",window.openc3Scope,{received:t=>{this.cable.recordPing(),this.handleMessages(t)}},{historyCount:1e3}).then(t=>{this.limitsSubscription=t})},unmounted(){this.limitsSubscription&&this.limitsSubscription.unsubscribe(),this.cable.disconnect()},methods:{handleMessages(t){for(let e=0;e<t.length;e++){let s=JSON.parse(t[e].event);this.data.unshift(s)}this.data.length>this.historyCount&&(this.data.length=this.historyCount)},getStatus(t){return t.includes("GREEN")?"normal":t.includes("YELLOW")?"caution":t.includes("RED")?"critical":t.includes("BLUE")?"standby":"off"},getColorClass(t){return t.includes("GREEN")?"openc3-green":t.includes("YELLOW")?"openc3-yellow":t.includes("RED")?"openc3-red":t.includes("BLUE")?"openc3-blue":"openc3-white"},calcTableHeight(){return window.innerHeight-250}}},Li=["status"];function ji(t,e,s,r,n,o){const i=w("v-spacer"),a=w("v-text-field"),l=w("v-card-title"),u=w("v-data-table"),d=w("v-card");return C(),j(d,{class:"card-height"},{default:g(()=>[_(l,{class:"d-flex align-center"},{default:g(()=>[e[1]||(e[1]=U(" Limits Events ",-1)),_(i),_(a,{modelValue:n.search,"onUpdate:modelValue":e[0]||(e[0]=h=>n.search=h),label:"Search","prepend-inner-icon":"mdi-magnify",clearable:"",variant:"outlined",density:"compact","single-line":"","hide-details":"",class:"search"},null,8,["modelValue"])]),_:1}),_(u,{headers:n.headers,items:n.data,search:n.search,"items-per-page":-1,"hide-default-footer":"","multi-sort":"",density:"compact",height:o.calcTableHeight(),hover:"","data-test":"limits-events"},{"item.time_nsec":g(({item:h})=>[B("span",null,G(t.formatNanoseconds(h.time_nsec,s.timeZone)),1)]),"item.level":g(({item:h})=>[B("rux-status",{status:o.getStatus(h.message)},null,8,Li)]),"item.message":g(({item:h})=>[B("span",{class:He(o.getColorClass(h.message))},G(h.message),3)]),_:1},8,["headers","items","search","height"])]),_:1})}const Ni={components:{LimitsControl:Ai,LimitsEvents:xe(Ti,[["render",ji],["__scopeId","data-v-3c276116"]]),TopBar:Ps,OpenConfigDialog:gt,SaveConfigDialog:mt},mixins:[pt],data(){return{title:"Limits Monitor",configKey:"limits_monitor",api:new ks,timeZone:"local",renderKey:0,ignored:[],openConfig:!1,saveConfig:!1,limitsSets:[],currentLimitsSet:null,currentSetRefreshInterval:null,limitsSetDialog:!1,menus:[{label:"File",items:[{label:"Show Ignored",icon:"mdi-magnify-close",command:()=>{this.$refs.control.showIgnored()}},{label:"Change Limits Set",icon:"mdi-swap-horizontal",command:()=>{this.limitsSetDialog=!0}},{divider:!0},{label:"Open Configuration",icon:"mdi-folder-open",command:()=>{this.openConfig=!0}},{label:"Save Configuration",icon:"mdi-content-save",command:()=>{this.saveConfig=!0}},{label:"Reset Configuration",icon:"mdi-monitor-shimmer",command:()=>{this.ignored=[],this.resetConfigBase(),this.renderKey++}}]}]}},created(){this.api.get_limits_sets().then(t=>{this.limitsSets=t}),this.api.get_setting("time_zone").then(t=>{t&&(this.timeZone=t)}).catch(t=>{})},mounted:function(){if(this.$route.query&&this.$route.query.config)this.openConfiguration(this.$route.query.config,!0);else{let t=this.loadDefaultConfig();JSON.stringify(t)!=="{}"&&(this.ignored=t,this.renderKey++)}},unmounted:function(){clearInterval(this.currentSetRefreshInterval)},methods:{setLimitsSet:function(){this.api.set_limits_set(this.currentLimitsSet),this.limitsSetDialog=!1,this.renderKey++},openConfiguration:function(t,e=!1){this.openConfigBase(t,e,s=>{this.ignored=s,this.renderKey++})},saveConfiguration:function(t){this.saveConfigBase(t,this.ignored)}}};function Pi(t,e,s,r,n,o){const i=w("top-bar"),a=w("limits-control"),l=w("limits-events"),u=w("open-config-dialog"),d=w("save-config-dialog"),h=w("v-spacer"),y=w("v-toolbar"),f=w("v-select"),m=w("v-card-text"),p=w("v-btn"),O=w("v-card-actions"),I=w("v-card"),x=w("v-dialog");return C(),H("div",null,[_(i,{menus:n.menus,title:n.title},null,8,["menus","title"]),(C(),j(a,{ref:"control",key:n.renderKey,modelValue:n.ignored,"onUpdate:modelValue":e[0]||(e[0]=b=>n.ignored=b),"time-zone":n.timeZone},null,8,["modelValue","time-zone"])),e[12]||(e[12]=B("div",{style:{height:"15px"}},null,-1)),_(l,{"time-zone":n.timeZone},null,8,["time-zone"]),n.openConfig?(C(),j(u,{key:0,modelValue:n.openConfig,"onUpdate:modelValue":e[1]||(e[1]=b=>n.openConfig=b),"config-key":n.configKey,onSuccess:o.openConfiguration},null,8,["modelValue","config-key","onSuccess"])):re("",!0),n.saveConfig?(C(),j(d,{key:1,modelValue:n.saveConfig,"onUpdate:modelValue":e[2]||(e[2]=b=>n.saveConfig=b),"config-key":n.configKey,onSuccess:o.saveConfiguration},null,8,["modelValue","config-key","onSuccess"])):re("",!0),_(x,{modelValue:n.limitsSetDialog,"onUpdate:modelValue":e[5]||(e[5]=b=>n.limitsSetDialog=b),"max-width":"650",persistent:"",onKeydown:e[6]||(e[6]=yt(b=>n.limitsSetDialog=!1,["esc"]))},{default:g(()=>[_(I,null,{default:g(()=>[_(y,{height:"24"},{default:g(()=>[_(h),e[7]||(e[7]=B("span",null,"Change Limits Set",-1)),_(h)]),_:1}),_(m,{class:"mt-6"},{default:g(()=>[e[8]||(e[8]=B("span",{style:{display:"block"}}," The Limits Set is a global option which changes the Limits Set across all tools. ",-1)),e[9]||(e[9]=B("span",{style:{display:"block"}}," NOTE: Changing this option clears the current list and recalculates based on the new set. ",-1)),_(f,{modelValue:n.currentLimitsSet,"onUpdate:modelValue":e[3]||(e[3]=b=>n.currentLimitsSet=b),label:"Limits Set",items:n.limitsSets,density:"compact",variant:"outlined","data-test":"limits-set","hide-details":"",class:"mt-3",style:{"max-width":"200px"}},null,8,["modelValue","items"])]),_:1}),_(O,{class:"px-2"},{default:g(()=>[_(h),_(p,{variant:"outlined",onClick:e[4]||(e[4]=b=>n.limitsSetDialog=!1)},{default:g(()=>[...e[10]||(e[10]=[U(" Cancel ",-1)])]),_:1}),_(p,{variant:"flat",onClick:o.setLimitsSet},{default:g(()=>[...e[11]||(e[11]=[U(" Ok ",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])])}const eo=As("default",xe(Ni,[["render",Pi]]))}}});
|