diff --git a/dist/bundle.js b/dist/bundle.js index 2523b9d..2f3ed4b 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -1 +1 @@ -!function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=8)}([function(e,t,i){"use strict";var n,s=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},o=function(){var e={};return function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}e[t]=i}return e[t]}}(),l=[];function d(e){for(var t=-1,i=0;i","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"𝒽","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"⁣","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","ifr":"𝔦","Ifr":"ℑ","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"⁣","InvisibleTimes":"⁢","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","iscr":"𝒾","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"⁢","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"‎","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","mscr":"𝓂","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"​","NegativeThickSpace":"​","NegativeThinSpace":"​","NegativeVeryThinSpace":"​","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"⁠","NonBreakingSpace":" ","nopf":"𝕟","Nopf":"ℕ","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","qopf":"𝕢","Qopf":"ℚ","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\\"","QUOT":"\\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"𝓇","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"­","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":"  ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","yuml":"ÿ","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"​","Zeta":"Ζ","zeta":"ζ","zfr":"𝔷","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","Zopf":"ℤ","Zscr":"𝒵","zscr":"𝓏","zwj":"‍","zwnj":"‌"}')},function(e){e.exports=JSON.parse('{"amp":"&","apos":"\'","gt":">","lt":"<","quot":"\\""}')},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.escapeUTF8=t.escape=t.encodeNonAsciiHTML=t.encodeHTML=t.encodeXML=void 0;var s=c(n(i(4)).default),o=u(s);t.encodeXML=m(s);var l,d,r=c(n(i(3)).default),a=u(r);function c(e){return Object.keys(e).sort().reduce((function(t,i){return t[e[i]]="&"+i+";",t}),{})}function u(e){for(var t=[],i=[],n=0,s=Object.keys(e);n1?_(e):e.charCodeAt(0)).toString(16).toUpperCase()+";"}var p=new RegExp(o.source+"|"+h.source,"g");function m(e){return function(t){return t.replace(p,(function(t){return e[t]||g(t)}))}}t.escape=function(e){return e.replace(p,g)},t.escapeUTF8=function(e){return e.replace(o,g)}},function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));const n=()=>{let e=window.location.hostname;return window.location.host===window.location.hostname?e+=":80":e+=":"+window.location.host.substring(window.location.hostname.length+1),e}},function(e,t,i){"use strict";i.d(t,"b",(function(){return Le})),i.d(t,"c",(function(){return Ce})),i.d(t,"a",(function(){return I}));let n=null;"undefined"!=typeof WebSocket&&(n=WebSocket);var s=n;const o={},l={};var d=e=>{if("string"==typeof e&&(e=JSON.parse(e.normalize().replace(/\\x([0-9A-Fa-f]{2})/g,""))),!e.id&&e.method){const t=l[e.method];t&&Array.isArray(t)&&t.length&&t.forEach(t=>{t(e.params)})}};let r=null;var a=e=>new Promise((t,i)=>{if(r&&1===r.readyState)return t(r);if(r&&0===r.readyState){const e=()=>{r.removeEventListener("open",e),t(r)};return r.addEventListener("open",e)}if(null===r){r=new s((e=>[e&&e.protocol||"ws://",e&&e.host||"localhost",":"+(e&&e.port||80),e&&e.endpoint||"/jsonrpc",e&&e.token?"?token="+e.token:null].join(""))(e),"notification"),r.addEventListener("message",t=>{e.debug&&(console.log(" "),console.log("API REPONSE:"),console.log(JSON.stringify(t.data,null,2)),console.log(" ")),(e=>{if("string"==typeof e&&(e=JSON.parse(e.normalize().replace(/\\x([0-9A-Fa-f]{2})/g,""))),e.id){const t=o[e.id];t?("result"in e?t.resolve(e.result):t.reject(e.error),delete o[e.id]):console.log("no pending request found with id "+e.id)}})(t.data)}),r.addEventListener("message",e=>{d(e.data)}),r.addEventListener("error",()=>{d({method:"client.ThunderJS.events.error"}),r=null});const n=e=>{r=null,i(e)};r.addEventListener("close",n),r.addEventListener("open",()=>{d({method:"client.ThunderJS.events.connect"}),r.removeEventListener("close",n),r.addEventListener("close",()=>{d({method:"client.ThunderJS.events.disconnect"}),r=null}),t(r)})}else r=null,i("Socket error")});let c=0;var u=e=>({request:(t,i,n)=>new Promise((s,l)=>{const d=(c+=1,c),r=((e,t,i)=>{let n;return(n=i&&i.version)?n:e&&(e[t]||e.default)||1})(e.versions,t,n),u=((e,t,i,n,s)=>{n&&delete n.version;const o={jsonrpc:"2.0",id:e,method:[t,s,i].join(".")};return(n||!1===n)&&(("object"!=typeof n||0!==Object.keys(n).length)&&(o.params=n)),o})(d,t,i,n,r);e.debug&&(console.log(" "),console.log("API REQUEST:"),console.log(JSON.stringify(u,null,2)),console.log(" ")),o[d]={body:u,resolve:s,reject:l},((e,t)=>a(e).then(e=>{e.send(JSON.stringify(t))}))(e,u).catch(e=>{l(e)})})}),h={DeviceInfo:{freeRam(e){return this.call("systeminfo",e).then(e=>e.freeram)},version(e){return this.call("systeminfo",e).then(e=>e.version)}}};function _(e,t,i,n){const s=this,o=p.call(this,e,t,i,n);return{dispose(){const i=g(e,t);void 0!==l[i]&&(l[i].splice(o,1),0===l[i].length&&m.call(s,e,t,n))}}}const g=(e,t)=>["client",e,"events",t].join("."),p=function(e,t,i,n){const s=g(e,t);if(!l[s]&&(l[s]=[],"ThunderJS"!==e)){const i="register",o={event:t,id:s.split(".").slice(0,-1).join(".")};this.api.request(e,i,o).catch(e=>{"function"==typeof n&&n(e.message)})}return l[s].push(i),l[s].length-1},m=function(e,t,i){const n=g(e,t);if(delete l[n],"ThunderJS"!==e){const s="unregister",o={event:t,id:n.split(".").slice(0,-1).join(".")};this.api.request(e,s,o).catch(e=>{"function"==typeof i&&i(e.message)})}};let v;const f=e=>({options:e,plugin:!1,call(){const e=[...arguments];this.plugin&&e[0]!==this.plugin&&e.unshift(this.plugin);const t=e[0],i=e[1];return"function"==typeof this[t][i]?this[t][i](e[2]):this.api.request.apply(this,e)},registerPlugin(e,t){this[e]=b(Object.assign(Object.create(f),t,{plugin:e}))},subscribe(){},on(){const e=[...arguments];return-1!==["connect","disconnect","error"].indexOf(e[0])?e.unshift("ThunderJS"):this.plugin&&e[0]!==this.plugin&&e.unshift(this.plugin),_.apply(this,e)},once(){console.log("todo ...")}}),b=e=>new Proxy(e,{get(e,t){const i=e[t];return"api"===t?v:void 0!==i?"function"==typeof i?["on","once","subscribe"].indexOf(t)>-1?function(...e){return i.apply(this,e)}:function(...e){return((e,t)=>{"object"==typeof e&&("object"!=typeof e||e.then&&"function"==typeof e.then)||(e=new Promise((t,i)=>{e instanceof Error==!1?t(e):i(e)}));const i="function"==typeof t[t.length-1]?t[t.length-1]:null;if(!i)return e;e.then(e=>i(null,e)).catch(e=>i(e))})(i.apply(this,e),e)}:"object"==typeof i?b(Object.assign(Object.create(f(e.options)),i,{plugin:t})):i:!1===e.plugin?b(Object.assign(Object.create(f(e.options)),{},{plugin:t})):function(...i){return i.unshift(t),e.call.apply(this,i)}}});var y=e=>(void 0===e.token&&"undefined"!=typeof window&&window.thunder&&"function"==typeof window.thunder.token&&(e.token=window.thunder.token()),v=u(e),b({...f(e),...h}));class E{constructor(e){this.prefixForService="Service",this.mainDiv=document.getElementById("main"),this.socket=null,this.plugins=void 0,this.host=e.split(":"),this.host[1]||(this.host[1]=80),this.t=y({host:this.host[0],port:this.host[1]}),this.socketListeners={},this.servicesAvailableInJsonRPC=["DeviceInfo","DHCPServer","DIALServer","LocationSync","MessageControl","Messenger","Monitor","NetworkControl","OCDM","RemoteControl","Spark","Streamer","SystemCommands","TestController","TestUtility","TimeSync","TraceControl","WebKitBrowser","WifiControl","LinearPlaybackControl"]}handleRequest(e,t,i,n){var s=new XMLHttpRequest;s.open(e,t,!0),n&&(s.onreadystatechange=function(){if(4==s.readyState)if(s.status>=200&&s.status<=299){var e;if(""!==s.responseText)try{e=JSON.parse(s.responseText.replace(/\\x([0-9A-Fa-f]{2})/g,""))}catch(e){}n(null,e,s.status)}else s.status>=300?n(s.responseText,null):0===s.status&&n("Connection interrupted",null)},s.ontimeout=function(){n("Connection timed out",null)}),null!==i?"string"==typeof i||i instanceof String?s.send(i):s.send(JSON.stringify(i)):s.send()}getURLStart(e,t){return e+"://"+this.host[0]+":"+this.host[1]+"/"+this.prefixForService+"/"}req(e,t){return new Promise((i,n)=>{if(t)console.debug(` ${t.plugin}.1.${t.method}`,t.params?t.params:""),this.t.call(t.plugin,t.method,t.params).then(e=>{i(e)}).catch(s=>{e?(console.debug(` ${t.plugin}.1.${t.method} failed, trying ${e.method} ${e.path}`),console.debug(" Error: ",s),this.handleRequest(e.method,this.getURLStart("http")+e.path,e.body,(e,t)=>{e?n(e):i(t)})):(console.error("JSONRPC Error, with no fallback: ",s),n(s))});else{if(void 0===e)return n("No rest or jsonrpc options provided, bailing out");this.handleRequest(e.method,this.getURLStart("http")+e.path,e.body,(e,t)=>{e?n(e):i(t)})}})}getControllerPlugins(){if(void 0!==this.plugins)return Promise.resolve(this.plugins);return this.req(null,{plugin:"Controller",method:"status"}).then(e=>(this.plugins=e,e))}startWebShell(e){e(null,new WebSocket(this.getURLStart("ws")+"WebShell","raw"))}startWebSocket(){this.socket&&this.socket.close(),this.socket=new WebSocket(this.getURLStart("ws")+"Controller","notification");var e=this;this.socket.onmessage=function(t){var i={};try{if(void 0===(i=JSON.parse(t.data)).callsign)return;for(var n=0;n\n
\n \n\n \x3c!--navigation--\x3e\n \n ',this.header=document.getElementById("header"),this.nav=document.getElementById("menu");var n=!1,s=new Image;s.alt="Metrological",s.onload=()=>{this.header.appendChild(s)},s.onerror=()=>{!0!==n&&(s.src="UI/img/ml.svg",n=!0)},s.src="img/ml.svg",document.getElementById("button-left").onclick=this.showMenu.bind(this),window.onresize=function(){if(!0!==this.isTouchDevice){var e=document.getElementById("menu");window.innerWidth>960?e.style.left="0px":e.style.left="-600px"}},this.api.t.on("Controller","all",e=>{e.data&&e.data.state&&this.render()})}clear(){this.nav.innerHTML=""}render(e){this.api.getControllerPlugins().then(t=>{this.clear();const i=Object.keys(this.plugins);let n=document.createElement("ul");for(let o=0;o\n \n -\n \n\n
\n \n -\n
\n\n
\n \n -\n
\n\n
\n \n -\n
\n\n
\n \n -\n /\n -\n
\n\n
\n \n -\n /\n -\n
\n\n
\n \n -\n
\n\n hide statistics\n ',this.versionSpan=document.getElementById("statusBarVersion"),this.uptimeSpan=document.getElementById("statusBarUptime"),this.serialSpan=document.getElementById("statusBarSerial"),this.cpuLoadSpan=document.getElementById("statusBarCpuLoad"),this.usedRamSpan=document.getElementById("statusBarUsedRam"),this.totalRamSpan=document.getElementById("statusBarTotalRam"),this.gpuUsedRamSpan=document.getElementById("statusBarGpuRamUsed"),this.gpuTotalRamSpan=document.getElementById("statusBarGpuRamTotal"),document.getElementById("pause-button").onclick=this.togglePause.bind(this),this.pauseButton=document.getElementById("pause-button"),void 0!==this.deviceInfo?(this.interval=setInterval(this.update.bind(this),I.refresh_interval),this.update(),this.updateStatisticsBlock(),this.api.t.on("connect",()=>{this.deviceIsConnected(!0)}),this.api.t.on("disconnect",()=>{this.deviceIsConnected(!1)})):this.togglePause()}render(e){void 0!==e&&(this.versionSpan.innerHTML=e.version,this.serialSpan.innerHTML=e.serialnumber,this.uptimeSpan.innerHTML=e.uptime,this.totalRamSpan.innerHTML=this.bytesToMbString(e.totalram),this.usedRamSpan.innerHTML=this.bytesToMbString(e.totalram-e.freeram),this.gpuTotalRamSpan.innerHTML=this.bytesToMbString(e.totalgpuram),this.gpuUsedRamSpan.innerHTML=this.bytesToMbString(e.totalgpuram-e.freegpuram),this.cpuLoadSpan.innerHTML=parseFloat(e.cpuload).toFixed(1)+" %")}update(){!1===this.connected&&this.deviceInfo.status().catch(e=>{}),!0===this.paused||this.deviceInfo&&"Activated"!==this.deviceInfo.state||this.deviceInfo&&this.deviceInfo.status().then(this.render.bind(this))}updateStatisticsBlock(){this.pauseButton.innerHTML=!1===this.paused?"hide statistics":"show statistics";var e=this.footer.getElementsByClassName("status"),t=0;if(!1===this.paused){for(;t\n
No connection with device
\n
Attempting to connect
\n ',t.style.display="block"),this.connected=e}}bytesToMbString(e){return(e/1024/1024).toFixed(1)+" MB"}};var k=class{constructor(e){this.renderInMenu=!1,this.api=e,this.api.t.on("Controller","all",this.handleNotification),document.getElementById("hide-notifications").onclick=this.toggleVisibility.bind(this)}handleNotification(e){document.getElementById("notifications-block").style.display="block";var t=document.createElement("div"),i="";for(var n in e)if("Monitor"===e[n]&&(t.className="red"),"callsign"===n){var s=document.createElement("label");s.innerHTML=e[n],t.appendChild(s)}else"event"===n?i+=n+': "'+e[n]+'"':"params"===n&&(i+=", "+n+": "+JSON.stringify(e[n],null,1).replace(/"(\w+)"\s*:/g,"$1:").replace(/\n/g,""));var o=document.createElement("span");o.innerHTML=i,t.appendChild(o),document.getElementById("notifications").appendChild(t),document.getElementById("notifications").scrollTop=document.getElementById("notifications").scrollHeight}toggleVisibility(){var e="block"===document.getElementById("notifications").style.display;document.getElementById("notifications").style.display=e?"none":"block",document.getElementById("hide-notifications").innerHTML=e?"show console":"hide console"}};var M=class{constructor(e,t){this.api=t,this.callsign=e.callsign,this.configuration=e.configuration,this.classname=e.classname,this.state=e.state,this.supportsSuspended=!1,this.supportsVisibility=!1,this.renderInMenu=!0,this.displayName=void 0,this.rendered=!1}activate(e){const t={plugin:"Controller",method:"activate",params:{callsign:e||this.callsign}};return this.api.req(null,t)}deactivate(e){const t={plugin:"Controller",method:"deactivate",params:{callsign:e||this.callsign}};return this.api.req(null,t)}suspend(e){const t={plugin:"Controller",method:"suspend",params:{callsign:e||this.callsign}};return this.api.req(null,t)}resume(e){const t={plugin:"Controller",method:"resume",params:{callsign:e||this.callsign}};return this.api.req(null,t)}status(e){const t={plugin:e||this.callsign,method:"status"};return this.api.req(null,t)}render(){this.rendered=!0}close(){this.rendered=!1}};var B=class extends M{constructor(e,t){super(e,t),this.monitored=!1,this.displayName="Activity Monitor"}render(){document.getElementById("main").innerHTML='\n
\n Memory Usage for all Apps\n
\n
\n \n
\n
\n
    \n
    \n
    \n Application Memory Usage\n
    \n
    \n PID\n
    \n
    \n \n \n
    \n
    \n App Name\n
    \n
    \n -\n
    \n
    \n Memory MB\n
    \n
    \n -\n
    \n
    \n Monitoring Applications\n
    \n
    \n PID (needed)\n
    \n
    \n \n
    \n
    \n Memory Threshold MB\n
    \n
    \n \n
    \n \n
    \n CPU Threshold Percent\n
    \n
    \n \n
    \n
    \n CPU Threshold Sec\n
    \n
    \n \n
    \n
    \n Memory Interval Sec (needed)\n
    \n
    \n \n
    \n
    \n CPU Interval Sec\n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n ',this.pid_monitor=document.getElementById("pid_monitor"),this.memory_Threshold_MB=document.getElementById("memory_Threshold_MB"),this.cpu_Threshold_Percent=document.getElementById("cpu_Threshold_Percent"),this.cpu_Threshold_Second=document.getElementById("cpu_Threshold_Second"),this.memory_Interval_Seconds=document.getElementById("memory_Interval_Seconds"),this.cpu_Interval_Seconds=document.getElementById("cpu_Interval_Seconds"),this.enable_monitoring=document.getElementById("enable_monitoring"),this.enable_monitoring.onclick=this.doMonitoring.bind(this),this.pid=document.getElementById("pid"),this.app_name=document.getElementById("app_name"),this.memory_mb=document.getElementById("memory_mb"),this.set_pid=document.getElementById("set_pid"),this.set_pid.onclick=this.showMemoryUsage.bind(this),this.memory_all=document.getElementById("memory_all"),this.memory_all.onclick=this.showMemoryUsageAll.bind(this),this.memory_usage=document.getElementById("memory_usage"),this.threshold_reached=document.getElementById("threshold_reached"),this.onMemoryThresholdOccurred=this.api.t.on(this.callsign,"onMemoryThresholdOccurred",this.memoryThresholdReached.bind(this)),this.onCPUThresholdOccurred=this.api.t.on(this.callsign,"onCPUThresholdOccurred",this.cpuThresholdReached.bind(this))}memoryThresholdReached(){this.threshold_reached.innerHTML="Reached Memory Threshold",setTimeout(this.removeMessage,2e3)}cpuThresholdReached(){this.threshold_reached.innerHTML="Reached CPU Threshold",setTimeout(this.removeMessage,2e3)}removeMessage(){this.threshold_reached.innerHTML=""}doMonitoring(){this.enable_monitoring.disabled=!0,"Enable Monitoring"==this.enable_monitoring.innerHTML?""!=this.pid_monitor.value&&""!=this.memory_Interval_Seconds.value?this.enableMonitoring(this.pid_monitor.value,this.memory_Threshold_MB.value,this.cpu_Threshold_Percent.value,this.cpu_Threshold_Second.value,this.memory_Interval_Seconds.value,this.cpu_Interval_Seconds.value).then(e=>{e.success?(this.enable_monitoring.innerHTML="Disable Monitoring",this.monitored=!0,this.enable_monitoring.disabled=!1):(alert("Failed to enable monitoring"),this.enable_monitoring.disabled=!1)}):""==this.pid_monitor.value&&""==this.memory_Interval_Seconds.value?(alert("Please provide PID and memory interval second to enable monitoring"),this.enable_monitoring.disabled=!1):""==this.pid_monitor.value?(alert("Please provide PID value to enable monitoring"),this.enable_monitoring.disabled=!1):""==this.memory_Interval_Seconds.value&&(alert("Please provide memory interval seconds to enable monitoring"),this.enable_monitoring.disabled=!1):this.disableMonitoring().then(e=>{e.success?(this.enable_monitoring.innerHTML="Enable Monitoring",this.monitored=!1,this.enable_monitoring.disabled=!1):(alert("Failed to disable monitoring"),this.enable_monitoring.disabled=!1)})}showMemoryUsage(){this.getApplicationMemoryUsage(this.pid.value).then(e=>{1==e.success&&(this.app_name.innerHTML=e.applicationMemory.appName,this.memory_mb.innerHTML=e.applicationMemory.memoryMB)})}showMemoryUsageAll(){if(this.memory_all.disabled=!0,"Show"==this.memory_all.innerHTML)this.getAllMemoryUsage().then(e=>{if(null!=e){this.length=e.applicationMemory.length;for(var t=0;t{this.monitored=!1}),this.onMemoryThresholdOccurred&&"function"==typeof this.onMemoryThresholdOccurred.dispose&&(this.onMemoryThresholdOccurred.dispose(),this.onMemoryThresholdOccurred=null),this.onCPUThresholdOccurred&&"function"==typeof this.onCPUThresholdOccurred.dispose&&(this.onCPUThresholdOccurred.dispose(),this.onCPUThresholdOccurred=null)}};var T=class extends M{constructor(e,t){super(e,t),this.displayName="AV Input"}render(){document.getElementById("main").innerHTML='\n
    \n AV Input details\n
    \n
    \n Number of Inputs\n
    \n
    \n -\n
    \n
    \n Current Video Mode\n
    \n
    \n -\n
    \n
    \n Content Protected\n
    \n
    \n -\n
    \n
    \n Active input\n
    \n
    \n -\n
    \n ',this.inputs=document.getElementById("inputs"),this.video_mode=document.getElementById("video_mode"),this.content_protected=document.getElementById("content_protected"),this.active_input=document.getElementById("active_input"),this.onAVInputActive=this.api.t.on(this.callsign,"onAVInputActive",e=>{this.active_input.innerHTML=e.url}),this.onAVInputInActive=this.api.t.on(this.callsign,"onAVInputInActive",e=>{this.active_input.innerHTML="-"}),this.update()}numberOfInputs(){const e={plugin:this.callsign,method:"numberOfInputs"};return this.api.req(null,e)}numberOfInputs(){const e={plugin:this.callsign,method:"numberOfInputs"};return this.api.req(null,e)}currentVideoMode(){const e={plugin:this.callsign,method:"currentVideoMode"};return this.api.req(null,e)}contentProtected(){const e={plugin:this.callsign,method:"contentProtected"};return this.api.req(null,e)}update(){this.numberOfInputs().then(e=>{this.inputs.innerHTML=e.numberOfInputs}),this.currentVideoMode().then(e=>{this.video_mode.innerHTML=e.currentVideoMode}),this.contentProtected().then(e=>{this.content_protected.innerHTML=e.isContentProtected})}close(){this.onAVInputActive&&"function"==typeof this.onAVInputActive.dispose&&(this.onAVInputActive.dispose(),this.onAVInputActive=null),this.onAVInputInActive&&"function"==typeof this.onAVInputInActive.dispose&&(this.onAVInputInActive.dispose(),this.onAVInputInActive=null)}};var L=class extends M{constructor(e,t){super(e,t),this._devices=[],this.scanning=new Set,this.discoverable=new Set,this.displayName="BluetoothControl"}render(){document.getElementById("main").innerHTML='\n
    \n Status\n
    \n\n
    \n Scanning\n
    \n
    \n
    \n
    \n Discoverable\n
    \n
    \n
    \n\n
    \n Device\n
    \n
    \n Select device\n
    \n
    \n \n
    \n
    \n Name\n
    \n
    \n -\n
    \n
    \n Type\n
    \n
    \n -\n
    \n
    \n Connected\n
    \n
    \n -\n
    \n
    \n Paired\n
    \n
    \n -\n
    \n\n
    Controls
    \n
    \n \n \n \n \n \n \n
    \n\n
    BLE Remote Control Unit
    \n
    \n \n \n
    \n\n
    BR/EDR Audio Sink
    \n
    \n \n \n
    \n\n
    \n Discovery\n
    \n
    Bluetooth LowEnergy
    \n
    \n
    \n \n \n
    \n
    \n
    Scan
    \n
    \n \n \n
    \n
    Visibility
    \n
    \n \n \n
    \n
    \n\n
    \n ',this.startScanButton=document.getElementById("BT_StartScan"),this.stopScanButton=document.getElementById("BT_StopScan"),this.setDiscoverableButton=document.getElementById("BT_SetDiscoverable"),this.stopDiscoverableButton=document.getElementById("BT_StopDiscoverable"),this.pairButton=document.getElementById("BT_Pair"),this.unpairButton=document.getElementById("BT_Unpair"),this.abortPairingButton=document.getElementById("BT_AbortPairing"),this.forgetButton=document.getElementById("BT_Forget"),this.connectButton=document.getElementById("BT_Connect"),this.disconnectButton=document.getElementById("BT_Disconnect"),this.btLowEnergyButton=document.getElementById("BT_LE"),this.assignRemoteButton=document.getElementById("BT_AssignRemote"),this.revokeRemoteButton=document.getElementById("BT_RevokeRemote"),this.assignAudioSinkButton=document.getElementById("BT_AssignAudioSink"),this.revokeAudioSinkButton=document.getElementById("BT_RevokeAudioSink"),this.deviceList=document.getElementById("BT_Devices"),this.deviceList.onchange=this.renderDevice.bind(this),this.startScanButton.onclick=this.startScan.bind(this),this.stopScanButton.onclick=this.stopScan.bind(this),this.setDiscoverableButton.onclick=this.setDiscoverable.bind(this),this.stopDiscoverableButton.onclick=this.stopDiscoverable.bind(this),this.pairButton.onclick=this.pairDevice.bind(this),this.unpairButton.onclick=this.unpairDevice.bind(this),this.abortPairingButton.onclick=this.abortPairingDevice.bind(this),this.forgetButton.onclick=this.forgetDevice.bind(this),this.disconnectButton.onclick=this.disconnect.bind(this),this.connectButton.onclick=this.connect.bind(this),this.assignRemoteButton.onclick=this.assignRemote.bind(this),this.revokeRemoteButton.onclick=this.revokeRemote.bind(this),this.assignAudioSinkButton.onclick=this.assignAudioSink.bind(this),this.revokeAudioSinkButton.onclick=this.revokeAudioSink.bind(this),this.nameEl=document.getElementById("BT_Name"),this.typeEl=document.getElementById("BT_Type"),this.connectedEl=document.getElementById("BT_Connected"),this.pairedEl=document.getElementById("BT_Paired"),this.scanningStatus=document.getElementById("BT_Scanning"),this.discoverableStatus=document.getElementById("BT_Discoverable"),this.statusMessages=document.getElementById("statusMessages"),this.scanStartedListener=this.api.t.on("BluetoothControl","scanstarted",this.scanStarted.bind(this)),this.scanCompleteListener=this.api.t.on("BluetoothControl","scancomplete",this.scanComplete.bind(this)),this.discoverableStartedListener=this.api.t.on("BluetoothControl","discoverablestarted",this.discoverableStarted.bind(this)),this.discoverableCompleteListener=this.api.t.on("BluetoothControl","discoverablecomplete",this.discoverableComplete.bind(this)),this.deviceStateListener=this.api.t.on("BluetoothControl","devicestatechange",this.deviceUpdated.bind(this)),this.update(!0)}deviceUpdated(e){this.renderDevice(),this.updateStatus(`${e.address} is ${e.state}`)}scanStarted(e){this.scanning.add(e.type),this.update(),this.updateStatus(e.type+" scan in progress...")}scanComplete(e){this.scanning.delete(e.type),this.update(!0),this.updateStatus(e.type+" scan complete")}discoverableStarted(e){this.discoverable.add(e.type),this.update(),this.updateStatus(e.type+" adapter now discoverable...")}discoverableComplete(e){this.discoverable.delete(e.type),this.update(),this.updateStatus(e.type+" adapter no longer discoverable")}devices(){return this.api.req(null,{plugin:"BluetoothControl",method:"getdevicelist"}).then(e=>{if(void 0!==e)return this._devices=[],e&&e.length&&e.forEach(e=>{this._devices.push({address:e.address,type:e.type})}),this._devices})}device(e,t){const i={plugin:"BluetoothControl",method:"getdeviceinfo",params:{address:e,type:t}};return this.api.req(null,i)}updateDeviceList(){this.deviceList.innerHTML="",this._devices&&this._devices.length&&(this._devices.forEach(e=>{this.deviceList.appendChild(document.createElement("option")).innerHTML=e.address}),this.renderDevice())}renderDevice(){let e=this.deviceList.selectedIndex;if(-1===e||0===this._devices.length)return this.nameEl.innerHTML="-",this.typeEl.innerHTML="-",this.connectedEl.innerHTML="-",void(this.pairedEl.innerHTML="-");let t=this._devices[e].address,i=this._devices[e].type;this.device(t,i).then(i=>{i&&(this._devices[e]={address:t,...i}),this.nameEl.innerHTML=this._devices[e].name,this.typeEl.innerHTML=this._devices[e].type,this.connectedEl.innerHTML=this._devices[e].connected,this.pairedEl.innerHTML=this._devices[e].paired})}updateStatus(e,t=!1){window.clearTimeout(this.statusMessageTimer),this.statusMessages.innerHTML=e,this.statusMessages.style=t?"color: red":"",this.statusMessageTimer=setTimeout(this.updateStatus,5e3,"")}update(e=!1){this.scanningStatus.innerHTML=0==this.scanning.size?"idle":Array.from(this.scanning).join(", "),this.discoverableStatus.innerHTML=0==this.discoverable.size?"idle":Array.from(this.discoverable).join(", "),e&&this.devices().then(()=>{this.updateDeviceList()})}startScan(){const e={plugin:"BluetoothControl",method:"scan",params:{type:this.btLowEnergyButton.checked?"LowEnergy":"Classic",timeout:12}};this.api.req(null,e).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}stopScan(){const e={plugin:"BluetoothControl",method:"stopscanning",params:{type:this.btLowEnergyButton.checked?"LowEnergy":"Classic"}};this.api.req(null,e).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}setDiscoverable(){const e={plugin:"BluetoothControl",method:"setdiscoverable",params:{type:this.btLowEnergyButton.checked?"LowEnergy":"Classic",timeout:30}};this.api.req(null,e).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}stopDiscoverable(){const e={plugin:"BluetoothControl",method:"stopdiscoverable",params:{type:this.btLowEnergyButton.checked?"LowEnergy":"Classic"}};this.api.req(null,e).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}pairDevice(){var e=this.deviceList.selectedIndex;this.updateStatus("Pairing to "+this._devices[e].name);const t={plugin:this.callsign,method:"pair",params:{address:this._devices[e].address,type:this._devices[e].type}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}unpairDevice(){var e=this.deviceList.selectedIndex;this.updateStatus("Unpairing "+this._devices[e].name);const t={plugin:this.callsign,method:"unpair",params:{address:this._devices[e].address,type:this._devices[e].type}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}abortPairingDevice(){var e=this.deviceList.selectedIndex;this.updateStatus("Aborting pairing to "+this._devices[e].name);const t={plugin:this.callsign,method:"abortpairing",params:{address:this._devices[e].address,type:this._devices[e].type}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}forgetDevice(){var e=this.deviceList.selectedIndex;this.updateStatus("Removing "+this._devices[e].name);const t={plugin:this.callsign,method:"forget",params:{address:this._devices[e].address,type:this._devices[e].type}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)}),this.update(!0)}connect(){var e=this.deviceList.selectedIndex;this.updateStatus("Connecting to "+this._devices[e].name);const t={plugin:this.callsign,method:"connect",params:{address:this._devices[e].address,type:this._devices[e].type}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}disconnect(){var e=this.deviceList.selectedIndex;this.updateStatus("Disconnecting from "+this._devices[e].name);const t={plugin:this.callsign,method:"disconnect",params:{address:this._devices[e].address,type:this._devices[e].type}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}assignRemote(){var e=this.deviceList.selectedIndex;this.updateStatus(`Assigning ${this._devices[e].name} as BLE remote control unit`);const t={plugin:"BluetoothRemoteControl",method:"assign",params:{address:this._devices[e].address}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}revokeRemote(){var e=this.deviceList.selectedIndex;this.updateStatus("Revoking BLE remote "+this._devices[e].name);const t={plugin:"BluetoothRemoteControl",method:"revoke",params:{address:this._devices[e].address}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}assignAudioSink(){var e=this.deviceList.selectedIndex;this.updateStatus(`Assigning ${this._devices[e].name} as BR/EDR audio sink`);const t={plugin:"BluetoothAudio",method:"sink::assign",params:{address:this._devices[e].address}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}revokeAudioSink(){var e=this.deviceList.selectedIndex;this.updateStatus("Revoking BR/EDR audio sink "+this._devices[e].name);const t={plugin:"BluetoothAudio",method:"sink::revoke",params:{address:this._devices[e].address}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}close(){clearInterval(this.statusMessageTimer),this.scanStartedListener&&"function"==typeof this.scanStartedListener.dispose&&this.scanStartedListener.dispose(),this.scanCompleteListener&&"function"==typeof this.scanCompleteListener.dispose&&this.scanCompleteListener.dispose(),this.discoverableStartedListener&&"function"==typeof this.discoverableStartedListener.dispose&&this.discoverableStartedListener.dispose(),this.discoverableCompleteListener&&"function"==typeof this.discoverableCompleteListener.dispose&&this.discoverableCompleteListener.dispose(),this.deviceStateListener&&"function"==typeof this.deviceStateListener.dispose&&this.deviceStateListener.dispose()}};const C={all:"DEFAULT",in:"SMARTPHONE, TABLET",out:"LOUDSPEAKER, HEADPHONES, WEARABLE HEADSET, HIFI AUDIO DEVICE",hid:" KEYBOARD, MOUSE, JOYSTICK",handsfree:'HANDSFREE"',tile:" LE, LE TILE"};var w=class extends M{constructor(e,t){super(e,t),this._devices=[],this.scanning=!1,this.displayName="Bluetooth"}render(){document.getElementById("main").innerHTML='\n
    Discovery
    \n
    Scan
    \n
    \n \n
    \n
    \n \n
    \n
    Status
    \n
    Scanning
    \n
    OFF
    \n\n
    Devices
    \n
    \n \n
    \n
    Device
    \n
    Name
    \n
    -
    \n
    Type
    \n
    -
    \n
    Connected
    \n
    -
    \n
    Paired
    \n
    -
    \n
    Controls
    \n
    \n \n \n \n \n
    \n
    \n
    \n ',this.scanButton=document.getElementById("BT_ScanForDevices"),this.pairButton=document.getElementById("BT_Pair"),this.unpairButton=document.getElementById("BT_Unpair"),this.connectButton=document.getElementById("BT_Connect"),this.disconnectButton=document.getElementById("BT_Disconnect"),this.deviceList=document.getElementById("BT_Devices"),this.deviceList.onchange=this.renderDevice.bind(this),this.scanButton.onclick=this.scanForDevices.bind(this),this.pairButton.onclick=this.pairDevice.bind(this),this.unpairButton.onclick=this.unpairDevice.bind(this),this.disconnectButton.onclick=this.disconnect.bind(this),this.connectButton.onclick=this.connect.bind(this),this.connectButton.style.display="none",this.disconnectButton.style.display="none",this.pairButton.style.display="none",this.unpairButton.style.display="none",this.nameEl=document.getElementById("BT_Name"),this.typeEl=document.getElementById("BT_Type"),this.connectedEl=document.getElementById("BT_Connected"),this.pairedEl=document.getElementById("BT_Paired"),this.profileValue=document.getElementById("profile"),this.scanningStatus=document.getElementById("BT_Scanning"),this.statusMessages=document.getElementById("statusMessages"),this.deviceList=document.getElementById("BT_Devices"),this.scanListener=this.api.t.on(this.callsign,"onDiscoveredDevice",this.scanComplete.bind(this)),this.complete=this.api.t.on(this.callsign,"onStatusChanged",e=>{this.statusUpdate(e),this.update()}),this.deviceStateListener=this.api.t.on(this.callsign,"onPairingRequest",e=>{e.pinRequired?this.updateStatus("Enter pairing code:"+e.pinValue):this.respondToevent(e.deviceID,"onPairingRequest","Accepted")}),this.update()}statusUpdate(e){switch(e.newStatus){case"DISCOVERY_COMPLETED":this.updateStatus("Scanning Completed"),this.scanningStatus.innerHTML="OFF";break;case"DISCOVERY_STARTED":this.updateStatus("Scanning Started"),this.scanningStatus.innerHTML="ON";break;case"PAIRING_CHANGE":e.paired?this.updateStatus("Paired to "+e.name):this.updateStatus("Unpaired from "+e.name);break;case"CONNECTION_CHANGE":e.connected?this.updateStatus("Connected to "+e.name):this.updateStatus("Disconnected from "+e.name)}}devices(){const e={plugin:this.callsign,method:"getDiscoveredDevices",params:{}};return this.api.req(null,e).then(e=>{if(void 0!==e)return e.discoveredDevices&&e.discoveredDevices.length&&e.discoveredDevices.forEach(e=>{this._pairedID.includes(e.deviceID)||this._devices.push({device:e})}),this._devices})}getPairedDevices(){const e={plugin:this.callsign,method:"getPairedDevices",params:{}};return this.api.req(null,e).then(e=>{this._pairedID=[],e.pairedDevices&&e.pairedDevices.length&&e.pairedDevices.forEach(e=>{this._pairedID.push(e.deviceID),e.paired=!0,this._devices.push({device:e})})})}device(e){const t={plugin:this.callsign,method:"getDeviceInfo",params:{deviceID:e}};return this.api.req(null,t)}scanComplete(){this.scanning=!1,this.update()}updateDeviceList(){this.deviceList.innerHTML="",this._devices&&this._devices.length?(this._devices.forEach(e=>{this.deviceList.appendChild(document.createElement("option")).innerHTML=e.device.name}),this.renderDevice()):this.renderDevice()}renderDevice(){this.connectButton.style.display="none",this.disconnectButton.style.display="none",this.pairButton.style.display="none",this.unpairButton.style.display="none";let e=this.deviceList.selectedIndex;if(-1===e||0===this._devices.length)return this.nameEl.innerHTML="-",this.typeEl.innerHTML="-",this.connectedEl.innerHTML="-",void(this.pairedEl.innerHTML="-");let t=this._devices[e].device;this.device(t.deviceID).then(i=>{i&&(this._devices[e]={device:t,...i.deviceInfo}),this.nameEl.innerHTML=this._devices[e].device.name,this.typeEl.innerHTML=this._devices[e].device.deviceType,this.connectedEl.innerHTML=this._devices[e].device.connected,this.pairedEl.innerHTML=this._devices[e].device.paired,this._devices[e].device.paired&&this._devices[e].device.connected?(this.disconnectButton.style.display="",this.unpairButton.style.display=""):this._devices[e].device.paired&&!this._devices[e].device.connected?(this.connectButton.style.display="",this.unpairButton.style.display=""):this._devices[e].device.paired||(this.pairButton.style.display="")})}updateStatus(e,t=!1,i=!1){window.clearTimeout(this.statusMessageTimer),this.statusMessages.innerHTML=e,this.statusMessages.classList.remove("loading"),t&&this.statusMessages.classList.add("loading"),this.statusMessages.style=i?"color: red":"",this.statusMessageTimer=setTimeout(this.updateStatus,5e3,"")}update(){this._devices=[],this.getPairedDevices().then(()=>{this.devices().then(()=>{this.updateDeviceList()})})}scanForDevices(){this.scanning=!0;const e={plugin:this.callsign,method:"startScan",params:{timeout:10,profile:C[this.profileValue.value]}};return this.api.req(null,e).then(e=>{console.log(e)}).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!1,!0)})}pairDevice(){var e=this.deviceList.selectedIndex;this.updateStatus("Pairing to "+this._devices[e].name,!0);const t={plugin:this.callsign,method:"pair",params:{deviceID:this._devices[e].deviceID}};return this.api.req(null,t).then(e=>{e.success||this.updateStatus("Pairing failed",!1,!0)}).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!1,!0)})}unpairDevice(){var e=this.deviceList.selectedIndex;this.updateStatus("Unpairing "+this._devices[e].name,!0);const t={plugin:this.callsign,method:"unpair",params:{deviceID:this._devices[e].deviceID}};return this.api.req(null,t).then(e=>{e.success||this.updateStatus("Unpairing failed",!1,!0)}).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!1,!0)})}connect(){var e=this.deviceList.selectedIndex;this.updateStatus("Connecting to "+this._devices[e].name,!0);const t={plugin:this.callsign,method:"connect",params:{deviceID:this._devices[e].deviceID,deviceType:this._devices[e].deviceType,profile:this._devices[e].deviceType}};return this.api.req(null,t).then(e=>{e.success||this.updateStatus("Connecting failed",!1,!0)}).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!1,!0)})}disconnect(){var e=this.deviceList.selectedIndex;this.updateStatus("Disconnecting from "+this._devices[e].name,!0);const t={plugin:this.callsign,method:"disconnect",params:{deviceID:this._devices[e].deviceID}};return this.api.req(null,t).then(e=>{e.success||this.updateStatus("Disconnecting failed",!1,!0)}).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!1,!0)})}respondToevent(e,t,i){const n={plugin:this.callsign,method:"respondToEvent",params:{deviceID:e,eventType:t,responseValue:i}};return this.api.req(null,n).then(e=>{console.log(e)})}close(){clearInterval(this.statusMessageTimer),this.scanListener&&"function"==typeof this.scanListener.dispose&&this.scanListener.dispose(),this.deviceStateListener&&"function"==typeof this.deviceStateListener&&this.deviceStateListener.dispose(),this.complete&&"function"==typeof this.complete.dispose&&this.complete.dispose()}};var D=class extends M{constructor(e,t){super(e,t),this.observablesList=[],this.restartList=[]}getMemoryInfo(e){return this.api.req(null,{plugin:"Monitor",method:"status"})}render(){document.getElementById("main").innerHTML='
    \n \n \n
    Observables
    \n
    \n
    \n
    RestartThreshold
    \n
    \n
    \n
    ',this.getObservableList(),this.observableListEl=document.getElementById("observables"),this.restartListEl=document.getElementById("restart"),this.bt_setRestart=document.getElementById("setRestart"),this.bt_setRestart.onclick=this.setRestartThreshold.bind(this)}getObservableList(){this.status().then(e=>{for(var t=[],i=0;i{this.getMemoryInfo(e).then(s=>{let o=s.filter(t=>t.observable===e||t.name===e||valse);o&&o[0]?t(i.createMonitorDiv(o[0])):n()})})}createMonitorDiv(e){if(void 0!==e.measurment&&(e.measurements=e.measurment),void 0!==e.measurements&&void 0!==e.measurements.resident){var t=e.measurements,i=document.createElement("div"),n=document.createElement("div");for(var s in n.className="title grid__col grid__col--8-of-8",n.innerHTML="Memory",i.appendChild(n),t.resident){var o=document.createElement("div");o.className="label grid__col grid__col--2-of-8",i.appendChild(o);var l=document.createElement("label");l.innerHTML=s,o.appendChild(l);var d=document.createElement("div");d.className="text grid__col grid__col--6-of-8";let e=t.resident[s];t.shared[s]&&(e-=t.shared[s]),d.innerHTML=this.bytesToMbString(e),i.appendChild(d)}var r=document.createElement("div");r.className="label grid__col grid__col--2-of-8",i.appendChild(r);var a=document.createElement("label");a.innerHTML="measurements",r.appendChild(a);var c=document.createElement("div");c.className="text grid__col grid__col--6-of-8",c.innerHTML=t.count,i.appendChild(c);var u=document.createElement("div");u.className="label grid__col grid__col--2-of-8",i.appendChild(u);var h=document.createElement("label");h.innerHTML="process",u.appendChild(h);var _=document.createElement("div");return _.className="text grid__col grid__col--6-of-8",_.innerHTML=t.process.last,i.appendChild(_),i}}bytesToMbString(e){return(e/1024/1024).toFixed(1)+" MB"}};var H=class extends M{constructor(e,t){super(e,t),this._url="",this._fps=0,this._isHidden=!1,this._isSuspended=!1,this.lastSetUrlKey="lastSetUrl",this.lastSetUrl=window.localStorage.getItem(this.lastSetUrlKey)||"",this.inspectorPort="9998",this.monitor=void 0,this.updateLoopInterval=void 0,this.template='
    \n\n
    Presets / URL
    \n\n
    URL
    \n
    -
    \n\n
    \n \n
    \n
    \n \n \n \n
    \n\n
    URL presets
    \n
    \n \n
    \n\n
    Performance
    \n
    FPS
    \n
    -
    \n
    \n\n
    Tools
    \n\n
    Current State
    \n
    \n
    \n
    \n \n
    \n\n
    Web Inspector
    \n
    \n \n
    \n\n
    ',this.presets=[{Name:"Select a preset",URL:""},{Name:"about:blank",URL:"about:blank"},{Name:"Smashcat",URL:"http://www.smashcat.org/av/canvas_test/"},{Name:"HTML5",URL:"http://beta.html5test.com/"},{Name:"PeaceKeeper",URL:"http://peacekeeper.futuremark.com/run.action"},{Name:"ChipTune",URL:"http://www.chiptune.com/kaleidoscope/"},{Name:"Poster Circle",URL:"http://www.webkit.org/blog-files/3d-transforms/poster-circle.html"},{Name:"Aquarium",URL:"http://webglsamples.org/aquarium/aquarium.html"},{Name:"Particles",URL:"http://oos.moxiecode.com/js_webgl/particles_morph/"},{Name:"EME v3 (race car)",URL:"http://cdn.metrological.com/static/eme-v3-clean.html"},{Name:"CMAF",URL:"https://cd-static-qa.bamgrid.com/bbd/player-test/harness-receiver/partners-test-interface.html?hls-player-url=https://cd-static-qa.bamgrid.com/bbd/player-test/players/partners/sky/hls-player-1.5.0-edge-7.js&test-suites-master-url=https://dev-basesite-static.fed-bam.com/mediaplayback-test/test-harness/test-suites/dss-cert-test-streams-suites.json"},{Name:"YouTube TV MSE 2018 (no vp9)",URL:"http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/2018.html?novp9=true"},{Name:"YouTube TV EME 2018",URL:"http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/2018.html?test_type=encryptedmedia-test"},{Name:"YouTube TV EME 2019",URL:"https://ytlr-cert.appspot.com/2019/main.html?test_type=encryptedmedia-test"},{Name:"YouTube TV EME 2020",URL:"https://ytlr-cert.appspot.com/2020/main.html?test_type=encryptedmedia-test"},{Name:"YouTube TV EME 2021",URL:"https://ytlr-cert.appspot.com/2021/main.html?test_type=encryptedmedia-test"},{Name:"Progressive",URL:"http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/2018.html?test_type=progressive-test"},{Name:"YouTube",URL:"http://youtube.com/tv"},{Name:"HelloRacer",URL:"http://www.emerveille.fr/lab/helloracer/index.html"},{Name:"Leaves",URL:"http://www.webkit.org/blog-files/leaves"},{Name:"Canvas Dots",URL:"http://themaninblue.com/experiment/AnimationBenchmark/canvas/"},{Name:"Anisotropic",URL:"http://whiteflashwhitehit.com/content/2011/02/anisotropic_webgl.html"},{Name:"Pasta",URL:"http://alteredqualia.com/three/examples/webgl_pasta.html"},{Name:"CSS3",URL:"http://css3test.com"},{Name:"Kraken",URL:"http://krakenbenchmark.mozilla.org/kraken-1.1/driver.html"},{Name:"KeyPress Test",URL:"http://keycode.info"}],void 0!==this.configuration&&void 0!==this.configuration.inspector&&(this.inspectorPort=this.configuration.inspector.split(":")[1]),this.api.getControllerPlugins().then(e=>{let t=e.filter(e=>"Monitor"===e.callsign);void 0!==t&&(this.monitor=new D(t,this.api))})}status(){const e={plugin:this.callsign,method:"state"};return this.api.req(null,e)}fps(){const e={plugin:this.callsign,method:"fps"};return this.api.req(null,e)}url(){const e={plugin:this.callsign,method:"url"};return this.api.req(null,e)}render(){var e=document.getElementById("main"),t=this.template.replace(/{{callsign}}/g,this.callsign);e.innerHTML=t,document.getElementById(this.callsign+"_url").value=this.lastSetUrl,document.getElementById(this.callsign+"_button").onclick=this.getAndSetUrl.bind(this),document.getElementById(this.callsign+"_reloadbutton").onclick=this.reloadUrl.bind(this),document.getElementById(this.callsign+"_linkPresets").onchange=this.getAndSetUrlFromPresets.bind(this);var i=document.getElementById(this.callsign+"_linkPresets");if(0===i.children.length)for(var n=0;n{e._isSuspended=t.suspended?t.suspended:"suspended"===t}).then(this.fps.bind(this)).then(t=>{e._fps=t.fps?t.fps:t}).then(this.url.bind(this)).then(t=>{e._url=t.url?t.url:t}).then(this.update.bind(this))}close(){window.removeEventListener("keydown",this.handleKey.bind(this),!1),clearInterval(this.updateLoopInterval),delete this.updateLoopInterval,this.rendered=!1}update(){document.getElementById(this.callsign+"_current_url").innerHTML=this._url,document.getElementById(this.callsign+"_fps").innerHTML=this._fps;var e=this._isSuspended?"Suspended":"Resumed",t=this._isSuspended?"Resume":"Suspend";document.getElementById(this.callsign+"StateInfo").innerHTML=e;var i=document.getElementById(this.callsign+"SuspendButton");i.innerHTML=t.toUpperCase(),i.onclick=this.toggleSuspend.bind(this,t),this.monitor&&this.monitor.getMonitorDataAndDiv().then(e=>{var t=document.getElementById(this.callsign+"Memory");t.innerHTML="",t.appendChild(e)})}setUrl(e){if(""===e)return;console.log("Setting url "+e+" for "+this.callsign);const t={plugin:this.callsign,method:"url",params:e};this.api.req(null,t),document.getElementById(this.callsign+"_linkPresets").selectedIndex=0}getAndSetUrl(){this.lastSetUrl=document.getElementById(this.callsign+"_url").value,this.setUrl(this.lastSetUrl),window.localStorage.setItem(this.lastSetUrlKey,this.lastSetUrl)}reloadUrl(){this.setUrl(this._url)}getAndSetUrlFromPresets(){var e=document.getElementById(this.callsign+"_linkPresets").selectedIndex;e>0&&this.setUrl(this.presets[e].URL)}handleKey(e){var t=document.getElementById("WebKitBrowser_url");13===e.which&&t&&t===document.activeElement&&this.getAndSetUrl()}toggleSuspend(e){"Resume"===e?this.resume():this.suspend()}launchWebinspector(){var e="http://"+this.api.host[0]+":"+this.inspectorPort;window.open(e,"_blank").focus()}};var P=class extends H{constructor(e,t){super(e,t),this.template='
    \n\n
    Presets / URL
    \n\n
    URL
    \n
    -
    \n\n
    \n \n
    \n
    \n \n \n \n
    \n\n
    URL presets
    \n
    \n \n
    \n\n
    Performance
    \n
    FPS
    \n
    -
    \n
    \n\n
    Tools
    \n\n
    Current State
    \n
    \n
    \n
    \n \n
    \n\n
    Visibility
    \n
    \n
    \n
    \n \n
    \n\n
    Web Inspector
    \n
    \n \n
    \n\n
    '}};var R=class extends M{constructor(e,t){super(e,t),this.resolutions=["720p","720p50Hz","1080p24Hz","1080i50Hz","1080p50Hz","1080p60Hz","2160p50Hz","2160p60Hz"]}render(){document.getElementById("main").innerHTML='
    \n Compositor\n
    \n
    \n Z-Order\n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n\n
    ',document.getElementById("compositorResolutions").onclick=this.setResolution.bind(this),this.resolutionsList=document.getElementById("compositorResolutions"),this.menu=document.getElementById("compositorClients"),this.controlDiv=document.getElementById("controls"),this.compositorClientsDiv=document.getElementById("compositorClientsDiv"),this.controlDiv.style.display="none",this.resolutionsList.innerHTML="";for(var e=0;e{null!=e&&Array.isArray(e)?e.length>0&&this.renderControls(e):this.compositorClientsDiv.innerHTML="No clients found."}),this.zorder().then(e=>{document.getElementById("zorder").innerHTML=e.toString()}),this.resolution().then(e=>{-1!==this.resolutions.indexOf(e)&&(this.resolutionsList.selectedIndex=this.resolutions.indexOf(e))})}getClients(){const e={plugin:this.callsign,method:"zorder"};return this.api.req(null,e)}renderControls(e){this.controlDiv.innerHTML='
    \n Controls\n
    \n
    \n Focus\n
    \n
    \n \n \n
    \n
    \n
    \n Opacity\n
    \n
    \n \n \n
    \n
    \n
    \n \n
    \n
    \n Visibility\n
    \n
    \n \n \n
    \n
    \n
    \n Geometry\n
    \n
    \n X\n
    \n
    \n \n
    \n
    \n Y\n
    \n
    \n \n
    \n
    \n Width\n
    \n
    \n \n
    \n
    \n Height\n
    \n
    \n \n
    \n
    \n
    \n \n
    ',document.getElementById("compositorSetTop").onclick=this.compositorAction.bind(this,"putontop"),document.getElementById("compositorSetInput").onclick=this.compositorAction.bind(this,"select"),document.getElementById("sliderOpacity").onchange=this.updateValue.bind(this,"sliderOpacity","numOpacity"),document.getElementById("numOpacity").onchange=this.updateValue.bind(this,"numOpacity","sliderOpacity"),document.getElementById("numOpacity").onkeyup=this.updateValue.bind(this,"numOpacity","sliderOpacity"),document.getElementById("numOpacity").onpaste=this.updateValue.bind(this,"numOpacity","sliderOpacity"),document.getElementById("numOpacity").oninput=this.updateValue.bind(this,"numOpacity","sliderOpacity"),document.getElementById("compositorSetOpacity").onclick=this.compositorSetOpacity.bind(this),document.getElementById("webkit_hide").onclick=this.compositorVisible.bind(this,"Hide"),document.getElementById("webkit_show").onclick=this.compositorVisible.bind(this,"Show"),document.getElementById("compositorGeometry").onclick=this.compositorSetGeometry.bind(this),document.getElementById("compositorClients").onchange=this.clientChange.bind(this);var t=document.getElementById("compositorClients");t.innerHTML="";var i=document.createElement("option");i.value="",i.setAttributeNode(document.createAttribute("disabled")),i.setAttributeNode(document.createAttribute("selected")),i.innerHTML="Select a client",t.appendChild(i);for(var n=0;n{document.getElementById("compositorXGeometry").value=e.x,document.getElementById("compositorYGeometry").value=e.y,document.getElementById("compositorWidthGeometry").value=e.width,document.getElementById("compositorHeightGeometry").value=e.height})}opacity(e,t){const i={plugin:this.callsign,method:"opacity@"+e};return void 0!==t&&(i.params=t),this.api.req(null,i)}compositorSetOpacity(){var e=this.menu.options[this.menu.selectedIndex].value,t=document.getElementById("sliderOpacity").value;return this.opacity(e,t)}updateValue(e,t){document.getElementById(t).value=document.getElementById(e).value}compositorVisible(e){console.log(e);var t=this.menu.options[this.menu.selectedIndex].value;const i={plugin:this.callsign,method:"visiblity@"+t,params:"Show"===e?"visible":"hidden"};this.api.req(null,i)}geometry(e,t){const i={plugin:this.callsign,method:"geometry@"+e};return void 0!==t&&(i.params={x:parseInt(t.x),y:parseInt(t.y),width:parseInt(t.w),height:parseInt(t.h)}),this.api.req(null,i)}zorder(e){const t={plugin:this.callsign,method:"zorder"};return this.api.req(null,t)}compositorSetGeometry(){const e=this.menu.options[this.menu.selectedIndex].value,t={x:document.getElementById("compositorXGeometry").value,y:document.getElementById("compositorYGeometry").value,w:document.getElementById("compositorWidthGeometry").value,h:document.getElementById("compositorHeightGeometry").value};return this.geometry(e,t)}resolution(e){const t={plugin:this.callsign,method:"resolution"};return void 0!==e&&(t.params=e),this.api.req(null,t)}setResolution(){var e=this.resolutionsList.options[this.resolutionsList.selectedIndex].value;return this.resolution(e)}};var N=class extends M{constructor(e,t){super(e,t),this.displayName="Continue Watching"}render(){document.getElementById("main").innerHTML='\n
    \n Set Application token\n
    \n
    \n Application name\n
    \n
    \n \n
    \n
    \n Token key\n
    \n
    \n \n
    \n
    \n
    \n Token value\n
    \n
    \n \n
    \n
    \n
    \n \n \n
    \n
    \n Get Application token\n
    \n
    \n Application name\n
    \n
    \n \n \n
    \n
    \n Token\n
    \n
    \n -\n
    \n
    \n Delete Application token\n
    \n
    \n Application name\n
    \n
    \n \n \n
    \n ',this.app_name=document.getElementById("app_name"),this.key_value_inputs=document.getElementById("key_value_inputs"),this.set_token=document.getElementById("set_token"),this.set_token.onclick=this.doSetToken.bind(this),this.add_key_value=document.getElementById("add_key_value"),this.add_key_value.onclick=this.addKeyValue.bind(this),this.buttons=document.getElementById("buttons"),this.app_name_token=document.getElementById("app_name_token"),this.get_token=document.getElementById("get_token"),this.get_token.onclick=this.doGetToken.bind(this),this.token=document.getElementById("token"),this.app_name_delete=document.getElementById("app_name_delete"),this.delete_token=document.getElementById("delete_token"),this.delete_token.onclick=this.doDeleteToken.bind(this),this.i=0}doSetToken(){for(var e={},t=0;t<=this.i;t++){var i=document.getElementById("this.token_value"+t).value.trim(),n=document.getElementById("this.token_key"+t).value.trim();""!=i&&""!=n&&(e[document.getElementById("this.token_key"+t).value]=document.getElementById("this.token_value"+t).value)}if(this.app_name.value&&0!=this.app_name.value.trim().length&&"{}"!=JSON.stringify(e))try{this.setApplicationToken(this.app_name.value,e).then(e=>{e&&e.success?alert("Successfully set token"):alert("Failed to set token")})}catch(e){alert("Error in getting response")}else""==this.app_name.value||0==this.app_name.value.trim().length?alert("Please provide app name"):"{}"==JSON.stringify(e)?alert("Please provide token key value pairs"):alert("Please provide application name and token key value pairs")}doGetToken(){if(this.app_name_token.value&&0!=this.app_name_token.value.trim().length)try{this.getApplicationToken(this.app_name_token.value).then(e=>{e&&e.success?this.token.innerHTML=e.application_token:(this.token.innerHTML="-",alert("Failed to get token"))})}catch(e){alert("Error in getting response")}else alert("Please provide app name")}doDeleteToken(){if(this.app_name_delete.value&&0!=this.app_name_delete.value.trim().length)try{this.deleteApplicationToken(this.app_name_delete.value).then(e=>{e&&e.success?alert("Successfully deleted token"):alert("Failed to delete token")})}catch(e){alert("Error in getting response")}else alert("Please provide app name")}addKeyValue(){this.i=this.i+1,1==this.i&&(this.refresh=document.createElement("button"),this.refresh.innerHTML="Refresh",this.refresh.id="refresh_button",this.refresh.onclick=this.refreshApp.bind(this),this.buttons.appendChild(this.refresh));var e=document.createElement("div_key_name");e.className="label grid__col grid__col--2-of-8",e.innerHTML="Token key",e.id="this.div_key_name"+this.i,this.key_value_inputs.appendChild(e);var t=document.createElement("div_key");t.className="label grid__col grid__col--6-of-8",t.id="this.div_key"+this.i;var i=document.createElement("input");i.id="this.token_key"+this.i,t.appendChild(i),this.key_value_inputs.appendChild(t);var n=document.createElement("div_value_name");n.className="label grid__col grid__col--2-of-8",n.innerHTML="Token value",n.id="this.div_value_name"+this.i,this.key_value_inputs.appendChild(n);var s=document.createElement("div_value");s.className="label grid__col grid__col--6-of-8",s.id="this.div_value"+this.i;var o=document.createElement("input");o.id="this.token_value"+this.i,s.appendChild(o),this.key_value_inputs.appendChild(s)}refreshApp(){this.app_name.value="",document.getElementById("this.token_value0").value="",document.getElementById("this.token_key0").value="",document.getElementById("refresh_button").remove();for(var e=1;e<=this.i;e++)document.getElementById("this.token_value"+e).remove(),document.getElementById("this.token_key"+e).remove(),document.getElementById("this.div_value_name"+e).remove(),document.getElementById("this.div_key_name"+e).remove(),document.getElementById("this.div_value"+e).remove(),document.getElementById("this.div_key"+e).remove();this.i=0}setApplicationToken(e,t){const i={plugin:this.callsign,method:"setApplicationToken",params:{applicationName:e,application_token:t}};return this.api.req(null,i)}deleteApplicationToken(){const e={plugin:this.callsign,method:"deleteApplicationToken"};return this.api.req(null,e)}getApplicationToken(e){const t={plugin:this.callsign,method:"getApplicationToken",params:{applicationName:e}};return this.api.req(null,t)}};var A=class extends M{constructor(e,t){super(e,t),this.plugins=void 0,this.mainDiv=void 0,this.controllerListener=void 0}controllerStatus(e){const t={plugin:"Controller"};return t.method=e?"status@"+e:"status",api.req(void 0,t)}harakiri(){const e={plugin:"Controller",method:"harakiri",params:{callsign:this.callsign}};return this.api.req(null,e)}initiateDiscovery(){return this.api.req(null,{plugin:"Controller",method:"startdiscovery",params:{ttl:1}})}getDiscovery(){return this.api.req(null,{plugin:"Controller",method:"discoveryresults"})}persist(e){return this.api.req(null,{plugin:"Controller",method:"storeconfig"})}toggleActivity(e){for(var t,i=0;i{void 0!==this.plugins[e]&&(this.plugins[e].state="Activated"),t.state="Activated"}).catch(e=>{this.render()})):(console.debug("Deactivating "+e),this.deactivate(e).then(i=>{void 0!==this.plugins[e]&&(this.plugins[e].state="Deactivated"),t.state="Deactivated"}).catch(e=>{this.render()}))}toggleSuspend(e){for(var t,i=0;i{void 0!==this.plugins[e]&&(this.plugins[e].state="Activated"),!1===document.getElementById(e+"suspend").checked?this.resume(e).then(this.render.bind(this)):api.suspendPlugin(e).then(this.render.bind(this))});"Resumed"===t.state?(console.debug("Suspending "+e),this.suspend(e).then(i=>{this.updateSuspendLabel(e,"resume"),void 0!==this.plugins[e]&&(this.plugins[e].state="Resumed"),document.getElementById(e+"suspend").checked=!0,t.state="Suspended"})):(console.debug("Resuming "+e),this.resume(e).then(i=>{this.updateSuspendLabel(e,"suspend"),void 0!==this.plugins[e]&&(this.plugins[e].state="Suspended"),document.getElementById(e+"suspend").checked=!1,t.state="Resumed"}))}clear(){this.mainDiv.innerHTML=""}discover(){console.log("Initiating discovery"),this.initiateDiscovery();let e=this;setTimeout((function(){e.getDiscovery().then(e=>{var t=e.bridges?e.bridges:e,i=document.getElementById("discoveryList");i.innerHTML="";for(var n=0;n{void 0!==e.state&&!0===this.rendered&&this.render(),void 0!==e.suspended&&!0===this.rendered&&this.render()})),this.mainDiv=document.getElementById("main"),this.mainDiv.innerHTML='\n
    \n Plugins\n
    \n
    \n
    \n Device actions\n
    \n
    \n \n
    \n
    \n \n
    \n
    \n Discover devices\n
    \n
    \n \n
    \n
    \n
      \n
      \n \n ',document.getElementById("persistButton").onclick=this.persist.bind(this),document.getElementById("harakiriButton").onclick=this.harakiri.bind(this),document.getElementById("discoverButton").onclick=this.discover.bind(this);var e=document.getElementById("controllerPlugins");this.status().then(t=>{var i=t.plugins?t.plugins:t;this.plugins=i;for(var n=0;nSet Audio Capture Parameters\n
      Buffer Duration(in seconds)
      \n
      \n \n \n
      \n
      Get Audio Clip
      \n
      Stream
      \n
      \n \n
      \n
      Capture Mode
      \n
      \n \n
      \n
      Duration(in seconds)
      \n
      \n \n
      \n
      URL
      \n
      \n \n
      \n
      \n \n
      \n
      \n ',this.mainDiv.innerHTML=this.template,this.bufferDuration=document.getElementById("buffer"),this.setBuffer=document.getElementById("set_buffer"),this.stream=document.getElementById("stream"),this.duration=document.getElementById("duration"),this.captureMode=document.getElementById("capture_mode"),this.uploadUrl=document.getElementById("url"),this.getButton=document.getElementById("get_button"),this.statusMessages=document.getElementById("statusMessages"),this.setBuffer.onclick=this.enableAudioCapture.bind(this),this.getButton.onclick=this.getAudioClip.bind(this),this.onAudioClipReady=this.api.t.on(this.callsign,"onAudioClipReady",e=>{e.status?this.statusMessage("Upload success.
      File name:"+e.fileName):this.statusMessage(e.message,!0)})}enableAudioCapture(){console.log(this.bufferDuration.value);const e={plugin:this.callsign,method:"enableAudioCapture",params:{bufferMaxDuration:parseInt(this.bufferDuration.value)}};return this.api.req(null,e).then(e=>{console.log(e),e.success?0==e.error&&this.statusMessage("Enabled audio capture"):255==e.error?this.statusMessage("settop cannot accommodate any level of audio buffering",!0):this.statusMessage(`Buffer set failed.Request exceeds maximum allowed buffer size.Maximum supported buffer duration is ${e.error} seconds`,!0)})}getAudioClip(){const e={plugin:this.callsign,method:"getAudioClip",params:{clipRequest:{stream:this.stream.value,duration:this.duration.value,captureMode:this.captureMode,url:this.uploadUrl}}};return this.api.req(null,e).then(e=>{console.log(e),e.success?this.statusMessage("Request success"):this.statusMessage("Request failed",!0)})}statusMessage(e,t=!1){window.clearTimeout(this.statusMessageTimer),this.statusMessages.innerHTML=e,this.statusMessages.style=t?"color: red":"",this.statusMessageTimer=setTimeout(this.statusMessage.bind(this),3e3,"")}close(){window.clearTimeout(this.statusMessageTimer),this.onAudioClipReady&&"function"==typeof this.onAudioClipReady.dispose&&this.onAudioClipReady.dispose()}};var U=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Device Info",this.deviceInfoDiv=void 0,this.mainDiv=document.getElementById("main"),this.selectedNetworkInterface=0,this.deviceNameEl=void 0,this.serialNumberEl=void 0,this.versionEl=void 0,this.uptimeEl=void 0,this.totalRamEl=void 0,this.usedRamEl=void 0,this.freeRamEl=void 0,this.usedGpuRamEl=void 0,this.freeGpuRamEl=void 0,this.totalGpuRamEl=void 0,this.cpuLoadEl=void 0,this.interfacesOptsEl=void 0,this.macIdEl=void 0,this.ipAddressEl=void 0,this.chartOptions={interval:1e3,maxElements:50},this.ramChart=void 0,this.gpuChart=void 0,this.cpuChart=void 0,this.chartIntervalId=void 0,this.template='
      \n Device\n
      \n\n
      \n Name\n
      \n
      \n -\n
      \n
      \n S/N\n
      \n
      \n -\n
      \n
      \n Version\n
      \n
      \n -\n
      \n
      \n Network Interface\n
      \n
      \n \n
      \n
      \n MAC\n
      \n
      \n -\n
      \n
      \n IP\n
      \n
      \n -\n
      \n
      \n Uptime\n
      \n
      \n -\n
      \n\n
      \n RAM\n
      \n\n
      \n Total RAM\n
      \n
      \n -\n
      \n
      \n Used RAM\n
      \n
      \n -\n
      \n
      \n Free RAM\n
      \n
      \n -\n
      \n
      \n Total GPU RAM\n
      \n
      \n -\n
      \n
      \n Used GPU RAM\n
      \n
      \n -\n
      \n
      \n Free GPU RAM\n
      \n
      \n -\n
      \n\n
      \n CPU\n
      \n\n
      \n CPU Load\n
      \n
      \n -\n
      \n\n
      \n CPU / GPU / RAM Graphs\n
      \n
      \n Poll interval in milliseconds\n
      \n
      \n \n
      \n
      \n Max elements per graph\n
      \n
      \n \n
      \n\n \n
      \n \n
      \n \n '}status(){return this.displayInfo().then(e=>new Promise((t,i)=>{this.deviceInfo().then(i=>{t({...e,...i})})}))}deviceInfo(){return this.api.req(null,{plugin:"DeviceInfo",method:"systeminfo"})}displayInfo(){return new Promise((e,t)=>{var i={};this.totalGPURam().then(t=>{i.totalgpuram=t,this.freeGPURam().then(t=>{i.freegpuram=t,e(i)})})})}totalGPURam(){return this.api.req(null,{plugin:"DisplayInfo",method:"totalgpuram"})}freeGPURam(){return this.api.req(null,{plugin:"DisplayInfo",method:"freegpuram"})}addresses(){return this.api.req(null,{plugin:"DeviceInfo",method:"addresses"})}socketinfo(){return this.api.req(null,{plugin:"DeviceInfo",method:"socketinfo"})}update(){this.deviceInfo().then(e=>{let t=e.systeminfo?e.systeminfo:e;this.deviceNameEl.innerHTML=t.devicename,this.serialNumberEl.innerHTML=t.serialnumber,this.versionEl.innerHTML=t.version,this.uptimeEl.innerHTML=t.uptime,this.totalRamEl.innerHTML=this.bytesToMbString(t.totalram),this.usedRamEl.innerHTML=this.bytesToMbString(t.totalram-t.freeram),this.freeRamEl.innerHTML=this.bytesToMbString(t.freeram),this.cpuLoadEl.innerHTML=parseFloat(t.cpuload).toFixed(1)+" %",this.addresses().then(e=>{let t=e.addresses?e.addresses:e;this.interfacesOptsEl.innerHTML="";for(var i=0;i{this.totalGpuRamEl.innerHTML=this.bytesToMbString(e.totalgpuram),this.freeGpuRamEl.innerHTML=this.bytesToMbString(e.freegpuram),this.usedGpuRamEl.innerHTML=this.bytesToMbString(e.totalgpuram-e.freegpuram)}),document.getElementById("startGraphs").onclick=this.startRealtimeGraphs.bind(this)}render(){this.mainDiv.innerHTML=this.template,this.deviceNameEl=document.getElementById("DeviceName"),this.serialNumberEl=document.getElementById("SerialNumber"),this.versionEl=document.getElementById("Version"),this.uptimeEl=document.getElementById("Uptime"),this.totalRamEl=document.getElementById("TotalRam"),this.usedRamEl=document.getElementById("UsedRam"),this.freeRamEl=document.getElementById("FreeRam"),this.totalGpuRamEl=document.getElementById("TotalGpuRam"),this.freeGpuRamEl=document.getElementById("FreeGpuRam"),this.usedGpuRamEl=document.getElementById("UsedGpuRam"),this.cpuLoadEl=document.getElementById("CpuLoad"),this.interfacesOptsEl=document.getElementById("NetworkInterface"),this.interfacesOptsEl.onchange=this.updateNetworkInterface.bind(this),this.macIdEl=document.getElementById("MAC_ID"),this.ipAddressEl=document.getElementById("IpAddress"),this.update()}startRealtimeGraphs(){this.chartOptions.maxElements=parseInt(document.getElementById("graph_max_elements").value),this.chartOptions.interval=parseInt(document.getElementById("graph_poll_interval").value),this.cpuChart=this.generateGraph("CPU usage",document.getElementById("graph_cpu").getContext("2d"),"#34c749","%"),this.ramChart=this.generateGraph("RAM used",document.getElementById("graph_ram").getContext("2d"),"#fc5652","MB"),this.gpuChart=this.generateGraph("GPU RAM used",document.getElementById("graph_gpu").getContext("2d"),"#fdbc40","MB"),this.chartIntervalId=setInterval(this.updateGraphs.bind(this),this.chartOptions.interval),document.getElementById("graphs").style.display="block"}generateGraph(e,t,i,n){return new Chart(t,{type:"line",data:{labels:[],datasets:[{label:e,backgroundColor:i,borderColor:i,data:[],fill:!1}]},options:{responsive:!1,scales:{yAxes:[{ticks:{callback:function(e,t,i){return e+n}}}]}}})}updateGraphs(){let e=this;const t=e.getTimestampForGraph();this.deviceInfo().then(i=>{e.ramChart&&(e.ramChart.config.data.labels.push(t),e.ramChart.config.data.datasets[0].data.push((i.totalram-i.freeram)/1024/1024),e.ramChart.config.data.labels.length>e.chartOptions.maxElements&&(e.ramChart.config.data.labels.shift(),e.ramChart.config.data.datasets[0].data.shift()),e.ramChart.update()),e.cpuChart&&(e.cpuChart.config.data.labels.push(t),e.cpuChart.config.data.datasets[0].data.push(parseFloat(i.cpuload).toFixed(1)),e.cpuChart.config.data.labels.length>e.chartOptions.maxElements&&(e.cpuChart.config.data.labels.shift(),e.cpuChart.config.data.datasets[0].data.shift()),e.cpuChart.update())}),this.displayInfo().then(i=>{e.gpuChart&&(e.gpuChart.config.data.labels.push(t),e.gpuChart.config.data.datasets[0].data.push((i.totalgpuram-i.freegpuram)/1024/1024),e.gpuChart.config.data.labels.length>e.chartOptions.maxElements&&(e.gpuChart.config.data.labels.shift(),e.gpuChart.config.data.datasets[0].data.shift()),e.gpuChart.update())})}close(){clearInterval(this.chartIntervalId),delete this.ramChart,delete this.cpuChart,delete this.gpuChart}updateNetworkInterface(e){this.selectedNetworkInterface=this.interfacesOptsEl.selectedIndex,this.update()}bytesToMbString(e){return(e/1024/1024).toFixed(1)+" MB"}getTimestampForGraph(){const e=new Date;return`${e.getHours()}:${e.getMinutes()}:${e.getSeconds()}`}};var F=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Display Info"}render(){document.getElementById("main").innerHTML='
      \n Display general information\n
      \n\n
      \n Total GPU\n
      \n
      \n -\n
      \n
      \n Free GPU\n
      \n
      \n -\n
      \n
      \n Audio Pass through\n
      \n
      \n -\n
      \n
      \n HDMI display\n
      \n
      \n -\n
      \n
      \n Width\n
      \n
      \n -\n
      \n
      \n Height\n
      \n
      \n -\n
      \n\n
      \n HDCP Protection\n
      \n
      \n -\n
      \n
      \n HDR Type\n
      \n
      \n -\n
      \n ',this.total_gpu=document.getElementById("total_gpu"),this.free_gpu=document.getElementById("free_gpu"),this.audio_pass_through=document.getElementById("audio_pass_through"),this.hdmi_display=document.getElementById("hdmi_display"),this.width=document.getElementById("width"),this.height=document.getElementById("height"),this.hdcp_protection=document.getElementById("hdcp_protection"),this.hdr_type=document.getElementById("hdr_type"),this.update()}totalGPURam(){const e={plugin:this.callsign,method:"totalgpuram"};return this.api.req(null,e)}freeGPURam(){const e={plugin:this.callsign,method:"freegpuram"};return this.api.req(null,e)}isAudioPassThrough(){const e={plugin:this.callsign,method:"isaudiopassthrough"};return this.api.req(null,e)}isConnected(){const e={plugin:this.callsign,method:"connected"};return this.api.req(null,e)}getWidth(){const e={plugin:this.callsign,method:"width"};return this.api.req(null,e)}getHeight(){const e={plugin:this.callsign,method:"height"};return this.api.req(null,e)}hdcpProtection(){const e={plugin:this.callsign,method:"hdcpprotection"};return this.api.req(null,e)}hdrType(){const e={plugin:this.callsign,method:"hdrsetting"};return this.api.req(null,e)}update(){this.totalGPURam().then(e=>{this.total_gpu.innerHTML=e}),this.freeGPURam().then(e=>{this.free_gpu.innerHTML=e}),this.isAudioPassThrough().then(e=>{this.audio_pass_through.innerHTML=e}),this.isConnected().then(e=>{this.hdmi_display.innerHTML=e}),this.getWidth().then(e=>{this.width.innerHTML=e}),this.getHeight().then(e=>{this.height.innerHTML=e}),this.hdcpProtection().then(e=>{this.hdcp_protection.innerHTML=e}),this.hdrType().then(e=>{this.hdr_type.innerHTML=e})}};var V=class extends M{constructor(e,t){super(e,t),this.displayName="FirmwareControl"}render(){document.getElementById("main").innerHTML="\n
      Upgrade
      \n\n
      Name
      \n
      \n \n
      \n\n
      Location
      \n
      \n \n
      \n \n
      Progress Interval
      \n
      \n \n
      \n\n
      HMAC
      \n
      \n \n
      \n\n
      Type
      \n
      \n \n
      \n
      \n \n
      \n
      \n \n
      \n
      \n\n ",this.name=document.getElementById("name"),this.location=document.getElementById("location"),this.progress_interval=document.getElementById("progressinterval"),this.hmac=document.getElementById("hmac"),this.type=document.getElementById("type"),this.statusMessages=document.getElementById("statusMessages"),this.upgrade_button=document.getElementById("upgradebutton"),this.upgrade_button.onclick=this.upgrade.bind(this),this.deviceStateListener=this.api.t.on(this.callsign,"upgradeprogress",e=>{"none"!=e.error?this.updateStatus("Status: "+e.status+" Error: "+e.error+" Progress: "+e.progress):this.updateStatus("Status:"+e.status+" Progress: "+e.progress)})}updateStatus(e){window.clearTimeout(this.statusMessageTimer),this.statusMessages.innerHTML=e,this.statusMessageTimer=setTimeout(this.updateStatus,5e3,"")}upgrade(){const e={plugin:this.callsign,method:"upgrade",params:{name:this.name.value,location:this.location.value,type:this.type.value,...this.progress_interval.value&&this.progress_interval.value.trim()&&{progressinterval:this.progress_interval.value},...this.hmac.value&&this.hmac.value.trim()&&{hmac:this.hmac.value}}};return this.api.req(null,e).then(e=>{e&&console.log(e)}).catch(e=>{e.code?this.updateStatus("Error in upgrade: "+e.code+" "+e.message):this.updateStatus("Error in upgrade")})}};var O=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Frame Rate",this.mainDiv=document.getElementById("main"),this.template='\n\t\t\t
      \n\t\t\t\tFrame Rate\n\t\t\t
      \n\t\t\t
      \n\t\t\t\tCollection frequency (in ms)\n\t\t\t
      \n\t\t\t
      \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t
      \n\t\t\t
      \n\t\t\t\tMinimum Frame Rate\n\t\t\t
      \n\t\t\t
      \n\t\t\t\t-\n\t\t\t
      \n\t\t\t
      \n\t\t\t\tMaximum Frame Rate\n\t\t\t
      \n\t\t\t
      \n\t\t\t\t-\n\t\t\t
      \n\t\t\t
      \n\t\t\t\tAverage Frame Rate\n\t\t\t
      \n\t\t\t
      \n\t\t\t\t-\n\t\t\t
      \n\t\t\t
      \n\t\t\t\tUpdate FPS\n\t\t\t
      \n\t\t\t
      \n\t\t\t\tSet new FPS\n\t\t\t
      \n\t\t\t
      \n\t\t\t\t\n\t\t\t\t\n\t\t\t
      \n '}render(){this.mainDiv.innerHTML=this.template,this.minFps=document.getElementById("Min_FPS"),this.maxFps=document.getElementById("Max_FPS"),this.avgFps=document.getElementById("Avg_FPS"),this.frequencyButton=document.getElementById("frequency_button"),this.fpsButton=document.getElementById("fps_button"),this.stopButton=document.getElementById("stop_button"),this.fps=document.getElementById("fps"),this.frequency=document.getElementById("freq"),this.frequencyButton.onclick=this.set.bind(this),this.fpsButton.onclick=this.update.bind(this),this.stopButton.onclick=this.stopCollection.bind(this),this.onFpsEvent=this.api.t.on(this.callsign,"onFpsEvent",e=>{this.minFps.innerHTML=e.min,this.maxFps.innerHTML=e.max,this.avgFps.innerHTML=e.average})}setFrequency(e){const t={plugin:this.callsign,method:"setCollectionFrequency",params:{frequency:e}};return this.api.req(null,t)}updateFrequency(e){const t={plugin:this.callsign,method:"updateFps",params:{newFpsValue:parseInt(e)}};return this.api.req(null,t)}update(){this.updateFrequency(this.fps.value)}set(){this.frequency.checkValidity()&&this.setFrequency(this.frequency.value).then(()=>{this.stop().then(()=>{this.start()})})}start(){const e={plugin:this.callsign,method:"startFpsCollection"};return this.api.req(null,e)}stopCollection(){this.stop().then(()=>{this.minFps.innerHTML="-",this.maxFps.innerHTML="-",this.avgFps.innerHTML="-"})}stop(){const e={plugin:this.callsign,method:"stopFpsCollection"};return this.api.req(null,e)}close(){this.stopCollection()}};var z=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Player Info"}render(){document.getElementById("main").innerHTML='
      \n Player general information\n
      \n \n
      \n Audio\n
      \n
      \n -\n
      \n
      \n Video\n
      \n
      \n -\n
      \n
      \n Dolbymode\n
      \n
      \n \n \n
      \n ',this.audio=document.getElementById("audio"),this.video=document.getElementById("video"),this.dolbymod=document.getElementById("dolbymod"),this.dolbymode_button=document.getElementById("dolbymode_button"),this.dolbymode_button.onclick=this.setDolbymode.bind(this),this.update()}setDolbymod(e){if(""===e)return;console.log("Setting dolbymod "+e+" for "+this.callsign);const t={plugin:this.callsign,method:"dolbymode",params:e};this.api.req(null,t)}setDolbymode(){this.setDolbymod(this.dolbymod.value)}playerInfo(){const e={plugin:this.callsign,method:"playerinfo"};return this.api.req(null,e)}dolbymodeInfo(){const e={plugin:this.callsign,method:"dolbymode"};return this.api.req(null,e)}update(){this.playerInfo().then(e=>{this.audio.innerHTML=e.audio[0],this.video.innerHTML=e.video[0]}),this.dolbymodeInfo().then(e=>{this.dolbymod.innerHTML=e})}};var G=class extends M{constructor(e,t){super(e,t),this.displayName="Device Diagnostics"}render(){document.getElementById("main").innerHTML='\n
      \n Configuration\n
      \n
      \n Property Name\n
      \n
      \n \n \n
      \n
      \n Value\n
      \n
      \n -\n
      \n ',this.property=document.getElementById("property"),this.show_value=document.getElementById("show_value"),this.show_value.onclick=this.showValue.bind(this),this.value=document.getElementById("value")}showValue(){this.value.innerHTML="-",""==this.property.value?alert("Please provide property name"):this.getConfiguration(this.property.value).then(e=>{e.success?e.paramList[0]?this.value.innerHTML=e.paramList[0].value:alert("No value available for the property "+this.property.value):alert("Error in getting configuration")})}getConfiguration(e){const t={plugin:this.callsign,method:"getConfiguration",params:{names:[e]}};return this.api.req(null,t)}};var j=class extends M{constructor(e,t){super(e,t),this.displayName="Device Identification"}render(){document.getElementById("main").innerHTML='\n
      \n Device Identification\n
      \n
      \n Firmware Version\n
      \n
      \n -\n
      \n
      \n Chip set\n
      \n
      \n -\n
      \n ',this.firmware_version=document.getElementById("firmware_version"),this.chipset=document.getElementById("chipset"),this.update()}deviceIdentification(){const e={plugin:this.callsign,method:"deviceidentification"};return this.api.req(null,e)}update(){this.deviceIdentification().then(e=>{this.firmware_version.innerHTML=e.firmwareversion,this.chipset.innerHTML=e.chipset})}};var W=class extends M{constructor(e,t){super(e,t),this.dialListenerStart=this.api.t.on("DIALServer","start",e=>{this.dialMessage("start",e)}),this.dialListenerStop=this.api.t.on("DIALServer","stop",e=>{this.dialMessage("stop",e)})}render(){document.getElementById("main").innerHTML='
      \n Received DIAL requests:\n
      \n\n
      ',this.statusMessagesEl=document.getElementById("statusMessages")}dialMessage(e,t){let i=document.createElement("div");"stop"===e&&(i.className="red");let n=document.createElement("span");n.innerHTML=`${e} :: ${t.application} - ${t.parameters}`,i.appendChild(n),this.statusMessagesEl.appendChild(i)}close(){this.dialListenerStart&&"function"==typeof this.dialListenerStart.dispose&&this.dialListenerStart.dispose(),this.dialListenerStop&&"function"==typeof this.dialListenerStop.dispose&&this.dialListenerStop.dispose()}};var K=class extends M{constructor(e,t){super(e,t),this.displayName="Display Settings"}render(){document.getElementById("main").innerHTML='\n
      \n Resolution\n
      \n
      \n Supported Resolutions\n
      \n
      \n VideoDisplay\n
      \n
      \n \n
      \n
      \n Supported Resolutions\n
      \n
      \n -\n
      \n
      \n Supported Tv Resolutions\n
      \n
      \n -\n
      \n
      \n Current Resolution\n
      \n
      \n VideoDisplay\n
      \n
      \n \n
      \n
      \n Resolution\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n
      \n Supported STB Resolutions\n
      \n
      \n -\n
      \n
      \n Default Resolution\n
      \n
      \n -\n
      \n
      \n
      \n Audio Ports\n
      \n
      \n Connected Audio Ports\n
      \n
      \n -\n
      \n
      \n Supported Audio Ports\n
      \n
      \n -\n
      \n \n
      \n Video Display\n
      \n
      \n Connected Video Displays\n
      \n
      \n -\n
      \n
      \n Supported Video Displays\n
      \n
      \n -\n
      \n \n
      \n EDID\n
      \n
      \n EDID from HDMI device\n
      \n
      \n -\n
      \n
      \n EDID Host\n
      \n
      \n -\n
      \n
      \n HDR Support\n
      \n
      \n HDR support standards for TV\n
      \n
      \n -\n
      \n \n
      \n HDR support standards for STB\n
      \n
      \n -\n
      \n
      \n TV HDR Capabilities\n
      \n
      \n -\n
      \n
      \n HDCP Repeater\n
      \n
      \n Is HDCP Repeater\n
      \n
      \n -\n
      \n
      \n Output Setting\n
      \n
      \n Color Space\n
      \n
      \n -\n
      \n
      \n Color Depth\n
      \n
      \n -\n
      \n
      \n Matrix coefficients\n
      \n
      \n -\n
      \n
      \n Video EOTF\n
      \n
      \n -\n
      \n
      \n Audio Modes\n
      \n
      \n Audio Port\n
      \n
      \n \n
      \n
      \n Supported Audio Modes\n
      \n
      \n -\n
      \n
      \n Active Input\n
      \n
      \n Video Display\n
      \n
      \n \n
      \n
      \n Active/Inactive\n
      \n
      \n -\n
      \n \n \n
      \n Zoom Setting\n
      \n
      \n Zoom Setting\n
      \n
      \n \n \n
      \n
      \n AudioCompression\n
      \n
      \n Compresion Level\n
      \n
      \n \n \n
      \n
      \n Dialog Enhancement\n
      \n
      \n Enhancer level\n
      \n
      \n \n \n
      \n
      \n Intelligent Equalizer\n
      \n
      \n Equalizer mode\n
      \n
      \n \n \n
      \n
      \n Sound Mode\n
      \n
      \n Audio Port\n
      \n
      \n \n
      \n
      \n Sound Mode\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Volume Leveller\n
      \n
      \n Audio Port\n
      \n
      \n \n
      \n
      \n Level\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Volume Level\n
      \n
      \n Audio Port\n
      \n
      \n \n
      \n
      \n Volume Level (0-100)\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Bass Enhancer\n
      \n
      \n Audio Port\n
      \n
      \n \n
      \n
      \n Bass boost\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Surround Virtualizer\n
      \n
      \n Audio Port\n
      \n
      \n \n
      \n
      \n Boost\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n DRC Mode\n
      \n
      \n Audio Port\n
      \n
      \n \n
      \n
      \n Mode\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Gain\n
      \n
      \n Audio Port\n
      \n
      \n \n
      \n
      \n Gain (0-100)\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Scart\n
      \n
      \n Scart Parameter\n
      \n
      \n \n
      \n
      \n Scart Parameter Data\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Audio Delay\n
      \n
      \n Audio Port\n
      \n
      \n \n
      \n
      \n Delay(in ms)\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Audio Delay Offset\n
      \n
      \n Audio Port\n
      \n
      \n \n
      \n
      \n Delay Offset(in ms)\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Video port Stand by\n
      \n
      \n Port name\n
      \n
      \n \n
      \n \n
      \n Standby Mode\n
      \n
      \n
      \n \n \n
      \n
      \n
      \n MI Steering\n
      \n
      \n Audio Port\n
      \n
      \n \n
      \n
      \n MI Steering Enable\n
      \n
      \n
      \n \n \n
      \n
      \n
      \n Surround Decoder\n
      \n
      \n Audio Port\n
      \n
      \n \n
      \n
      \n Enable/Disable\n
      \n
      \n
      \n \n \n
      \n
      \n
      \n Mute\n
      \n
      \n Audio Port\n
      \n
      \n \n
      \n
      \n Muted\n
      \n
      \n
      \n \n \n
      \n
      \n
      \n Atmos\n
      \n
      \n Sink Atmos capability\n
      \n
      \n -\n
      \n
      \n Audio atmos Output mode\n
      \n
      \n
      \n \n \n
      \n
      \n
      \n Dolby Mode\n
      \n
      \n Dolby Mode\n
      \n
      \n
      \n \n \n
      \n
      \n ',this.supported_resolutions=document.getElementById("supported_resolutions"),this.supported_tv_resolutions=document.getElementById("supported_tv_resolutions"),this.supported_stb_resolutions=document.getElementById("supported_stb_resolutions"),this.default_resolution=document.getElementById("default_resolution"),this.video_display_resolution=document.getElementById("video_display_resolution"),this.video_display_resolution.onchange=this.updateDisplayResolution.bind(this),this.video_display_current=document.getElementById("video_display_current"),this.resolution=document.getElementById("resolution"),this.setResolution=document.getElementById("set_resolution"),this.setResolution.onclick=this.updateResolution.bind(this),this.connected_audio_ports=document.getElementById("connected_audio_ports"),this.supported_audio_ports=document.getElementById("supported_audio_ports"),this.edid_hdmi=document.getElementById("edid_hdmi"),this.edid_host=document.getElementById("edid_host"),this.standby_mode=document.getElementById("standby_mode"),this.standby_mode.onclick=this.updateStandBy.bind(this),this.dolby_mode=document.getElementById("dolby_mode"),this.dolby_mode.onclick=this.updateDolbyMode.bind(this),this.select_port_standby=document.getElementById("select_port_standby"),this.hdr_tv=document.getElementById("hdr_tv"),this.hdr_stb=document.getElementById("hdr_stb"),this.hdr_tv_capabilities=document.getElementById("hdr_tv_capabilities"),this.color_space=document.getElementById("color_space"),this.color_depth=document.getElementById("color_depth"),this.matrix_coefficients=document.getElementById("matrix_coefficients"),this.video_EOTF=document.getElementById("video_EOTF"),this.select_audio_port=document.getElementById("select_audio_port"),this.supported_audio_modes=document.getElementById("supported_audio_modes"),this.select_audio_port.onchange=this.updateAudioMode.bind(this),this.connected_video_display=document.getElementById("connected_video_displays"),this.supported_video_displays=document.getElementById("supported_video_displays"),this.active_inactive=document.getElementById("active_inactive"),this.select_zoom_setting=document.getElementById("select_zoom_setting"),this.zoom_set=document.getElementById("zoom_set"),this.zoom_set.onclick=this.updateZoomSetting.bind(this),this.sound_mode=document.getElementById("sound_mode"),this.set_sound_mode=document.getElementById("set_sound_mode"),this.set_sound_mode.onclick=this.updateSoundMode.bind(this),this.select_MS12_audio_compression=document.getElementById("select_MS12_audio_compression"),this.set_compression=document.getElementById("set_compression"),this.set_compression.onclick=this.updateAudioCompression.bind(this),this.video_display_active=document.getElementById("select_video_display"),this.video_display_active.onchange=this.updateActiveInput.bind(this),this.audio_port=document.getElementById("audio_port"),this.select_enhancer=document.getElementById("select_enhancer"),this.set_enhancer=document.getElementById("set_enhancer"),this.set_enhancer.onclick=this.updateEnhanceLevel.bind(this),this.select_mode=document.getElementById("select_mode"),this.set_mode=document.getElementById("set_mode"),this.set_mode.onclick=this.updateEqualizerMode.bind(this),this.sink_atmos=document.getElementById("sink_atmos"),this.atmos_mode=document.getElementById("atmos_mode"),this.atmos_mode.onclick=this.updateAtmosMode.bind(this),this.repeater=document.getElementById("repeater"),this.audioPort_leveller=document.getElementById("audioPort_leveller"),this.leveller=document.getElementById("leveller"),this.set_leveller=document.getElementById("set_leveller"),this.set_leveller.onclick=this.updateAudioLeveller.bind(this),this.audioPort_level=document.getElementById("audioPort_level"),this.level=document.getElementById("level"),this.set_level=document.getElementById("set_level"),this.set_level.onclick=this.updateAudioLevel.bind(this),this.audioPort_bass=document.getElementById("audioPort_bass"),this.bass=document.getElementById("bass"),this.set_bass=document.getElementById("set_bass"),this.set_bass.onclick=this.updateBassEnhancer.bind(this),this.audioPort_boost=document.getElementById("audioPort_boost"),this.boost=document.getElementById("boost"),this.set_boost=document.getElementById("set_boost"),this.set_boost.onclick=this.updateBoostValue.bind(this),this.audioPort_steering=document.getElementById("audioPort_steering"),this.mi_enable=document.getElementById("mi_enable"),this.mi_enable.onclick=this.updateMISteering.bind(this),this.audioPort_surroundDecoder=document.getElementById("audioPort_surroundDecoder"),this.surroundDecoder_enable=document.getElementById("surroundDecoder_enable"),this.surroundDecoder_enable.onclick=this.updateSurroundDecoder.bind(this),this.audioPort_drc=document.getElementById("audioPort_drc"),this.drc=document.getElementById("drc"),this.set_drc=document.getElementById("set_drc"),this.set_drc.onclick=this.updateDRCMode.bind(this),this.audioPort_gain=document.getElementById("audioPort_gain"),this.gain=document.getElementById("gain"),this.set_gain=document.getElementById("set_gain"),this.set_gain.onclick=this.updateGain.bind(this),this.scart_param=document.getElementById("scart_param"),this.scart_data=document.getElementById("scart_data"),this.scart_param.onclick=this.updateScartData.bind(this),this.set_scart=document.getElementById("set_scart"),this.set_scart.onclick=this.updateScart.bind(this),this.audioPort_muted=document.getElementById("audioPort_muted"),this.muted_enable=document.getElementById("muted_enable"),this.muted_enable.onclick=this.updateMuted.bind(this),this.audioPort_delay=document.getElementById("audioPort_delay"),this.delay=document.getElementById("delay"),this.set_delay=document.getElementById("set_delay"),this.set_delay.onclick=this.updateDelay.bind(this),this.audioPort_delayOffset=document.getElementById("audioPort_delayOffset"),this.delayOffset=document.getElementById("delayOffset"),this.set_delayOffset=document.getElementById("set_delayOffset"),this.set_delayOffset.onclick=this.updateDelayOffset.bind(this),this.onResolutionChanged=this.api.t.on(this.callsign,"resolutionChanged",this.updateCurrentResolution.bind(this)),this.onZoomSettingUpdated=this.api.t.on(this.callsign,"zoomSettingUpdated",this.updateZoomValue.bind(this)),this.onActiveInputChanged=this.api.t.on(this.callsign,"activeInputChanged",this.updateActiveInput.bind(this)),this.onConnectedVideoDisplaysUpdated=this.api.t.on(this.callsign,"connectedVideoDisplaysUpdated",this.updateConnectedDisplay.bind(this)),this.update()}updateCurrentResolution(){this.resolution.innerHTML="",this.getCurrentResolution(this.video_display_current.value).then(e=>{if(null!=e&&e.success){var t=e.resolution;this.resolutionArray=document.createElement("option"),this.resolutionArray.text=e.resolution,this.resolutionArray.value=e.resolution,this.resolution.appendChild(this.resolutionArray),this.resolutionArrayFiltered=this.totalResolution.filter(e=>t!=e);for(var i=0;i{this.supported_tv_resolutions.innerHTML=e.supportedTvResolutions}),this.getSupportedResolutions(this.video_display_resolution[this.selectedIndex].value).then(e=>{this.supported_resolutions.innerHTML=e.supportedResolutions})}updateAudioMode(){this.supportedAudioModes(this.select_audio_port.value).then(e=>{null!=e&&e.supportedAudioModes?this.supported_audio_modes.innerHTML=e.supportedAudioModes:this.supported_audio_modes.innerHTML="-"})}updateZoomValue(){this.getZoomSetting().then(e=>{if(null!=e&&e.success){this.select_zoom_setting.innerHTML="",(i=document.createElement("option")).text=e.zoomSetting,i.value=e.zoomSetting,this.select_zoom_setting.appendChild(i),this.supportedZoomSettingFiltered=["FULL","NONE","Letterbox 16x9","Letterbox 14x9","CCO","PanScan","Letterbox 2.21 on 4x3","Letterbox 2.21 on 16x9","Platform","Zoom 16x9","Pillarbox 4x3","Widescreen 4x3"].filter(t=>e.zoomSetting!=t);for(var t=0;t{null!=e&&e.success?(this.updateZoomValue(),this.showNotification("notification_zoom","Successfully set zoom setting")):(alert("Failed to set zoom value"),this.updateZoomValue())}):alert("No zoom values are available")}updateConnectedDisplay(){this.getConnectedVideoDisplays().then(e=>{this.connected_video_display.innerHTML=e.connectedVideoDisplays})}updateMS12Compression(){this.select_MS12_audio_compression.innerHTML="",this.getMS12AudioCompression().then(e=>{if(null!=e&&e.success){(i=document.createElement("option")).text=e.compressionlevel,i.value=e.compressionlevel,this.select_MS12_audio_compression.appendChild(i);this.supportedCompressionFiltered=[0,1,2,3,4,5,6,7,8,9,10].filter(t=>e.compressionlevel.toString()!=t);for(var t=0;t{if(null!=e&&e.success){(i=document.createElement("option")).text=e.enhancerlevel,i.value=e.enhancerlevel,this.select_enhancer.appendChild(i),this.supportedEnhancerLevelFiltered=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16].filter(t=>e.enhancerlevel.toString()!=t);for(var t=0;t{if(null!=e&&e.success){(i=document.createElement("option")).text=e.DRCMode,i.value=e.DRCMode,this.drc.appendChild(i),this.supportedDRCModeFiltered=["line","rf"].filter(t=>e.DRCMode!=t);for(var t=0;t{null!=e&&e.success&&(this.gain.value=e.gain)})}updateScart(){this.setScartParameter(this.scart_param.value,this.scart_data.value).then(e=>{null!=e&&e.success?this.showNotification("notification_scart","Successfully set scart value"):alert("Failed to set scart value")})}updateScartData(){switch(this.scart_data.innerHTML="",this.scart_param.value){case"aspect_ratio":for(var e=["4x3","16x9"],t=0;t{if(null!=e&&e.success){(i=document.createElement("option")).text=e.mode,i.value=e.mode,this.select_mode.appendChild(i),this.supportedEqualizerModeFiltered=[1,2,3].filter(t=>e.mode.toString()!=t);for(var t=0;t{this.sound_mode.innerHTML="",(i=document.createElement("option")).text=e.soundMode,i.value=e.soundMode,this.sound_mode.appendChild(i),this.supportedSoundModeFiltered=["mono","stereo","surround","passthru","auto","auto *","AUTO *","dolby digital 5.1"].filter(t=>e.soundMode!=t);for(var t=0;t{null!=e&&e.success?(this.showNotification("notification_compression","Successfully set compression"),this.updateMS12Compression()):(alert("Failed to set audio compression"),this.updateMS12Compression())}):alert("No audio compression values are available")}updateResolution(){""!=this.video_display_current.value&&""!=this.resolution.value?this.setCurrentResolution(this.video_display_current.value,this.resolution.value).then(e=>{null!=e&&e.success?this.showNotification("notification_resolution","Successfully set resolution"):alert("Failed to set current resolution")}):""==this.video_display_current.value?alert("No video displays are available to set the current resolution"):""==this.resolution.value&&alert("No resolution is supported on the video display port")}updateSoundMode(){""!=this.audio_port.value&&""!=this.sound_mode.value?this.setSoundMode(this.audio_port.value,this.sound_mode.value).then(e=>{null!=e&&e.success?(this.showNotification("notification_soundMode","Successfully set sound mode"),this.updateSoundModeList()):(alert("Failed to set sound mode"),this.updateSoundModeList())}):""==this.audio_port.value?alert("No audio ports are available to set sound mode"):""!=this.sound_mode.value&&alert("No sound modes are available to set sound mode")}updateStandBy(){""!=this.select_port_standby.value?this.setVideoPortStatusInStandby(this.select_port_standby.value,this.standby_mode.checked).then(e=>{if(e.success&&null!=e){if(1==this.standby_mode.checked)var t="enabled";else t="disabled";this.showNotification("notification_standby","Successfully "+t+" standby mode ")}this.getVideoPortStatusInStandby(this.select_port_standby.value).then(e=>{this.standby_mode.checked=e.videoPortStatusInStandby})}):""==this.select_port_standby.value&&alert("No audio ports are available to set standby mode")}updateDolbyMode(){try{this.setDolbyVolumeMode(this.dolby_mode.checked).then(e=>{if(null!=e&&e.success){if(1==this.dolby_mode.checked)var t="enabled";else t="disabled";this.showNotification("notification_dolby","Successfully "+t+" dolby mode"),this.getDolbyVolumeMode().then(e=>{e&&null!=e.dolbyVolumeMode&&(this.dolby_mode.checked=e.dolbyVolumeMode)})}else this.dolby_mode.checked=!this.dolby_mode.checked,alert("Failed to set dolby mode")})}catch(e){alert("Error in setting dolby volume mode")}}updateAtmosMode(){try{this.setAudioAtmosOutputMode(this.atmos_mode.checked).then(e=>{var t;if(t=!!this.atmos_mode.checked,null!=e&&e.success){if(1==this.atmos_mode.checked)var i="enabled";else i="disabled";this.showNotification("notification_atmos","Successfully "+i+" atmos mode"),this.atmos_mode.checked=t}else this.atmos_mode.checked=!t,alert("Failed to set audio atmos mode")})}catch(e){alert("Error in setting audio atmos mode")}}updateActiveInput(){this.getActiveInput(this.video_display_active.value).then(e=>{1==e.activeInput?this.active_inactive.innerHTML="Active":this.active_inactive.innerHTML="InActive"})}updateEnhanceLevel(){""!=this.select_enhancer.value?this.setDialogEnhancement(parseInt(this.select_enhancer.value)).then(e=>{null!=e&&e.success?(this.showNotification("notification_enhancement","Successfully set dialog enhancement"),this.updateEnhancerList()):(alert("Failed to set dialog enhancer level"),this.updateEnhancerList())}):alert("No enhancer levels are available")}updateEqualizerMode(){""!=this.select_mode.value?this.setIntelligentEqualizerMode(parseInt(this.select_mode.value)).then(e=>{null!=e&&e.success?(this.showNotification("notification_equalizer","Successfully set equalizer mode"),this.updateEqualizerList()):(alert("Failed to set equalizer mode"),this.updateEqualizerList())}):alert("No equalizer modes are available")}updateLevel(){""!=this.audioPort_level.value&&this.getVolumeLevel(this.audioPort_level.value).then(e=>{e.success&&null!=e?this.level.value=e.volumeLevel:this.level.value=""})}updateAudioLevel(){if(""!=this.audioPort_level.value&&""!=this.level.value&&this.level.value>=0&&this.level.value<=100)try{this.setVolumeLevel(this.audioPort_level.value,this.level.value).then(e=>{e.success&&null!=e?(this.showNotification("notification_volumeLevel","Successfully set volume level"),this.updateLevel()):(alert("Failed to set volume level"),this.updateLevel())})}catch(e){alert("Error in setting volume level")}else""==this.audioPort_level.value?alert("No audio ports are available for setting volume level"):""==this.level.value?alert("Please provide volume level value"):(this.level.value<0||this.level.value>100)&&alert("Please provide a volume level value between 0 and 100")}updateLeveller(){""!=this.audioPort_leveller.value&&this.getVolumeLeveller(this.audioPort_leveller.value).then(e=>{if(null!=e&&e.success){this.leveller.innerHTML="",(i=document.createElement("option")).text=e.level,i.value=e.level,this.leveller.appendChild(i),this.supportedLevellerFiltered=[0,1,2,3,4,5,6,7,8,9,10].filter(t=>e.level.toString()!=t);for(var t=0;t{null!=e&&e.success?(this.showNotification("notification_volumeLeveller","Successfully set volume leveller"),this.updateLeveller()):(alert("Failed to set volume leveller"),this.updateLeveller())})}catch(e){alert("Error in setting volume leveller")}else""==this.audioPort_leveller.value?alert("No audio port are available to set volume leveller"):""==this.leveller.value&&alert("No leveller values are available to set volume leveller")}updateBass(){""!=this.audioPort_bass.value&&this.getBassEnhancer(this.audioPort_bass.value).then(e=>{if(null!=e&&e.success){for(var t=[],i=0;i<=100;i++)t.push(i);this.bass.innerHTML="",(n=document.createElement("option")).text=e.bassBoost,n.value=e.bassBoost,this.bass.appendChild(n),this.supportedBassFiltered=t.filter(t=>e.bassBoost.toString()!=t);for(i=0;i{null!=e&&e.success?(this.showNotification("notification_bassEnhancer","Successfully set bass enhancer value"),this.updateBass()):(alert("Failed to set bass enhancer"),this.updateBass())}):""==this.audioPort_bass.value&&""==this.bass.value?alert("No audio ports and bass values are available"):""==this.audioPort_bass.value?alert("No audio ports are available"):""==this.bass.value&&alert("No bass values are available")}updateBoost(){""!=this.audioPort_boost.value&&this.getSurroundVirtualizer(this.audioPort_boost.value).then(e=>{if(e.success&&null!=e){for(var t=[],i=0;i<=96;i++)t.push(i);this.boost.innerHTML="",(n=document.createElement("option")).text=e.boost,n.value=e.boost,this.boost.appendChild(n),this.supportedBoostFiltered=t.filter(t=>e.boost.toString()!=t);for(i=0;i{null!=e&&e.success?(this.showNotification("notification_virtualizer","Successfully set virtualizer"),this.updateBoost()):(alert("Failed to set boost value"),this.updateBoost())}):""==this.audioPort_boost.value&&""==this.boost.value?alert("No audio ports and bass values are available"):""==this.audioPort_boost.value?alert("No audio ports available are available"):""==this.boost.value&&alert("No boost values available are available")}updateMISteering(){if(""!=this.audioPort_steering.value)try{this.setMISteering(this.audioPort_steering.value,this.mi_enable.checked).then(e=>{var t=this.mi_enable.checked;if(null!=e&&e.success){if(1==this.mi_enable.checked)var i="enabled";else i="disabled";this.showNotification("notification_miEnable","Successfully "+i+" MI steering"),this.getMISteering(this.audioPort_steering.value).then(e=>{e&&null!=e.MISteeringEnable?this.mi_enable.checked=e.MISteeringEnable:this.mi_enable.checked=!1})}else this.mi_enable.checked=!t,alert("Failed to set MI steering")})}catch(e){alert("Error in setting MI steering")}else""==this.audioPort_steering.value&&alert("No audio ports available")}updateSurroundDecoder(){if(""!=this.audioPort_surroundDecoder.value)try{this.enableSurroundDecoder(this.audioPort_surroundDecoder.value,this.surroundDecoder_enable.checked).then(e=>{var t=this.surroundDecoder_enable.checked;if(null!=e&&e.success){if(1==this.surroundDecoder_enable.checked)var i="enabled";else i="disabled";this.showNotification("notification_surroundDecoder","Successfully "+i+" surround decoder"),this.isSurroundDecoderEnabled(this.audioPort_surroundDecoder[this.audioPort_surroundDecoder.selectedIndex].value).then(e=>{e&&null!=e.surroundDecoderEnable?this.surroundDecoder_enable.checked=e.surroundDecoderEnable:this.surroundDecoder_enable.checked=!1})}else this.surroundDecoder_enable.checked=!t,alert("Failed to set surround decoder")})}catch(e){alert("Error in enabling surround decoder")}else""==this.audioPort_surroundDecoder.value&&alert("No audio ports available")}updateMuted(){if(""!=this.audioPort_muted.value)try{this.setMuted(this.audioPort_muted.value,this.muted_enable.checked).then(e=>{var t=this.muted_enable.checked;if(null!=e&&e.success){if(1==this.muted_enable.checked)var i="enabled";else i="disabled";this.showNotification("notification_mute","Successfully "+i+" mute option"),this.getMuted(this.audioPort_muted.value).then(e=>{null!=e&&e.muted?this.muted_enable.checked=e.muted:this.muted_enable.checked=!1})}else{if(this.muted_enable.checked=!t,t)var n="enable";else n="disbale";alert("Failed to "+n+" mute")}})}catch(e){alert("Error in enabling/disabling mute")}else""==this.audioPort_muted.value&&alert("No audio ports available")}updateDRCMode(){if(""!=this.audioPort_drc.value&&""!=this.drc.value){"line"==this.drc.value?this.drcValue="0":"rf"==this.drc.value&&(this.drcValue="1");try{this.setDRCMode(this.audioPort_drc.value,this.drcValue).then(e=>{null!=e&&e.success&&(this.showNotification("notification_drc","Successfully set drc value"),this.updateDRCList())})}catch(e){alert("Error in setting drc value")}}else""==this.audioPort_drc.value?alert("No audio ports are available"):""==this.drc.value&&alert("No drc values available")}updateGain(){try{""!=this.audioPort_gain.value&&""!=this.gain.value&&this.gain.value>=0&&this.gain.value<=100?this.setGain(this.audioPort_gain.value,this.gain.value).then(e=>{null!=e&&e.success&&(this.showNotification("notification_gain","Successfully set gain"),this.updateGainList())}):""==this.audioPort_gain.value?alert("No audio ports are available"):""==this.gain.value?alert("No gain values are available"):(this.gain.value<0||this.gain.value>100)&&alert("Please provide gain value between 0 and 100")}catch(e){alert("Error in setting gain")}}updateDelay(){if(""!=this.delay.value&&""!=this.audioPort_delay.value)try{this.setAudioDelay(this.delay.value,this.audioPort_delay.value).then(e=>{null!=(e={success:!0})&&e.success?(this.showNotification("notification_delay","Successfully set delay"),this.getAudioDelay(this.audioPort_delay.value).then(e=>{e.success&&null!=e.audioDelay?this.delay.value=e.audioDelay:this.delay.value=""})):(this.delay.value="",alert("Failed to set audio delay"))})}catch(e){alert("Error in setting audio delay")}else""==this.audioPort_delay.value?alert("No audio ports are available"):""==this.delay.value&&alert("Please provide delay value in ms")}updateDelayOffset(){if(""!=this.delayOffset.value&&""!=this.audioPort_delayOffset.value)try{this.setAudioDelayOffset(this.delayOffset.value,this.audioPort_delayOffset.value).then(e=>{null!=e&&e.success?(this.showNotification("notification_delayOffset","Successfully set delay offset"),this.getAudioDelayOffset(this.audioPort_delayOffset.value).then(e=>{e.success&&null!=e.audioDelayOffset?this.delayOffset.value=e.audioDelayOffset:this.delayOffset.value=""})):(this.delayOffset.value="",alert("Failed to set delay offset"))})}catch(e){alert("Error in enabling delay offset")}else""==this.audioPort_delayOffset.value?alert("No audio ports are available"):""==this.delayOffset.value&&alert("No delay offset is available")}getSupportedResolutions(e){const t={plugin:this.callsign,method:"getSupportedResolutions",params:{videoDisplay:e}};return this.api.req(null,t)}getCurrentResolution(e){const t={plugin:this.callsign,method:"getCurrentResolution",params:{videoDisplay:e}};return this.api.req(null,t)}setCurrentResolution(e,t){const i={plugin:this.callsign,method:"setCurrentResolution",params:{videoDisplay:e,resolution:t,persist:!0}};return this.api.req(null,i)}getSupportedTvResolutions(e){const t={plugin:this.callsign,method:"getSupportedTvResolutions",params:{videoDisplay:e}};return this.api.req(null,t)}getSupportedSettopResolutions(){const e={plugin:this.callsign,method:"getSupportedSettopResolutions"};return this.api.req(null,e)}getDefaultResolution(){const e={plugin:this.callsign,method:"getDefaultResolution"};return this.api.req(null,e)}getVideoPortStatusInStandby(e){const t={plugin:this.callsign,method:"getVideoPortStatusInStandby",params:{portName:e}};return this.api.req(null,t)}setVideoPortStatusInStandby(e,t){const i={plugin:this.callsign,method:"setVideoPortStatusInStandby",params:{portName:e,enabled:t}};return this.api.req(null,i)}getTvHDRSupport(){const e={plugin:this.callsign,method:"getTvHDRSupport"};return this.api.req(null,e)}getSettopHDRSupport(){const e={plugin:this.callsign,method:"getSettopHDRSupport"};return this.api.req(null,e)}getTVHDRCapabilities(){const e={plugin:this.callsign,method:"getTVHDRCapabilities"};return this.api.req(null,e)}getConnectedAudioPorts(){const e={plugin:this.callsign,method:"getConnectedAudioPorts"};return this.api.req(null,e)}getSupportedAudioPorts(){const e={plugin:this.callsign,method:"getSupportedAudioPorts"};return this.api.req(null,e)}getCurrentOutputSettings(){const e={plugin:this.callsign,method:"getCurrentOutputSettings"};return this.api.req(null,e)}supportedAudioModes(e){const t={plugin:this.callsign,method:"getSupportedAudioModes",params:{audioPort:e}};return this.api.req(null,t)}getSoundMode(){const e={plugin:this.callsign,method:"getSoundMode"};return this.api.req(null,e)}setSoundMode(e,t){const i={plugin:this.callsign,method:"setSoundMode",params:{audioPort:e,soundMode:t,persist:!0}};return this.api.req(null,i)}getActiveInput(e){const t={plugin:this.callsign,method:"getActiveInput",params:{videoDisplay:e}};return this.api.req(null,t)}getZoomSetting(){const e={plugin:this.callsign,method:"getZoomSetting"};return this.api.req(null,e)}setZoomSetting(e){const t={plugin:this.callsign,method:"setZoomSetting",params:{zoomSetting:e}};return this.api.req(null,t)}getMS12AudioCompression(e){const t={plugin:this.callsign,method:"getMS12AudioCompression"};return this.api.req(null,t)}setMS12AudioCompression(e){const t={plugin:this.callsign,method:"setMS12AudioCompression",params:{compresionLevel:e}};return this.api.req(null,t)}getConnectedVideoDisplays(){const e={plugin:this.callsign,method:"getConnectedVideoDisplays"};return this.api.req(null,e)}getSupportedVideoDisplays(){const e={plugin:this.callsign,method:"getSupportedVideoDisplays"};return this.api.req(null,e)}setDolbyVolumeMode(e){const t={plugin:this.callsign,method:"setDolbyVolumeMode",params:{dolbyVolumeMode:e}};return this.api.req(null,t)}getDolbyVolumeMode(){const e={plugin:this.callsign,method:"getDolbyVolumeMode"};return this.api.req(null,e)}readEDID(){const e={plugin:this.callsign,method:"readEDID"};return this.api.req(null,e)}readHostEDID(){const e={plugin:this.callsign,method:"readHostEDID"};return this.api.req(null,e)}setDialogEnhancement(e){const t={plugin:this.callsign,method:"setDialogEnhancement",params:{enhancerlevel:e}};return this.api.req(null,t)}getDialogEnhancement(){const e={plugin:this.callsign,method:"getDialogEnhancement"};return this.api.req(null,e)}setIntelligentEqualizerMode(e){const t={plugin:this.callsign,method:"setIntelligentEqualizerMode",params:{intelligentEqualizerMode:e}};return this.api.req(null,t)}getIntelligentEqualizerMode(){const e={plugin:this.callsign,method:"getIntelligentEqualizerMode"};return this.api.req(null,e)}getSinkAtmosCapability(){const e={plugin:this.callsign,method:"getSinkAtmosCapability"};return this.api.req(null,e)}setAudioAtmosOutputMode(e){const t={plugin:this.callsign,method:"setAudioAtmosOutputMode",params:{enable:e}};return this.api.req(null,t)}isConnectedDeviceRepeater(){const e={plugin:this.callsign,method:"isConnectedDeviceRepeater"};return this.api.req(null,e)}setVolumeLeveller(e,t){const i={plugin:this.callsign,method:"setVolumeLeveller",params:{audioPort:e,level:t}};return this.api.req(null,i)}getVolumeLeveller(e){const t={plugin:this.callsign,method:"getVolumeLeveller",params:{audioPort:e}};return this.api.req(null,t)}setVolumeLevel(e,t){const i={plugin:this.callsign,method:"setVolumeLevel",params:{audioPort:e,volumeLevel:t}};return this.api.req(null,i)}getVolumeLevel(e){const t={plugin:this.callsign,method:"getVolumeLevel",params:{audioPort:e}};return this.api.req(null,t)}setBassEnhancer(e,t){const i={plugin:this.callsign,method:"setBassEnhancer",params:{audioPort:e,bassBoost:t}};return this.api.req(null,i)}getBassEnhancer(e){const t={plugin:this.callsign,method:"getBassEnhancer",params:{audioPort:e}};return this.api.req(null,t)}setSurroundVirtualizer(e,t){const i={plugin:this.callsign,method:"setBassEnhancer",params:{audioPort:e,boost:t}};return this.api.req(null,i)}getSurroundVirtualizer(e){const t={plugin:this.callsign,method:"getSurroundVirtualizer",params:{audioPort:e}};return this.api.req(null,t)}setMISteering(e,t){const i={plugin:this.callsign,method:"setMISteering",params:{audioPort:e,MISteeringEnable:t}};return this.api.req(null,i)}getMISteering(e){const t={plugin:this.callsign,method:"getMISteering",params:{audioPort:e}};return this.api.req(null,t)}enableSurroundDecoder(e,t){const i={plugin:this.callsign,method:"enableSurroundDecoder",params:{audioPort:e,surroundDecoderEnable:t}};return this.api.req(null,i)}isSurroundDecoderEnabled(e){const t={plugin:this.callsign,method:"isSurroundDecoderEnabled",params:{audioPort:e}};return this.api.req(null,t)}setDRCMode(e,t){const i={plugin:this.callsign,method:"setDRCMode",params:{audioPort:e,DRCMode:t}};return this.api.req(null,i)}getDRCMode(e){const t={plugin:this.callsign,method:"getDRCMode",params:{audioPort:e}};return this.api.req(null,t)}setGain(e,t){const i={plugin:this.callsign,method:"setDRCMode",params:{audioPort:e,gain:t}};return this.api.req(null,i)}getGain(e){const t={plugin:this.callsign,method:"getGain",params:{audioPort:e}};return this.api.req(null,t)}setMuted(e,t){const i={plugin:this.callsign,method:"setDRCMode",params:{audioPort:e,muted:t}};return this.api.req(null,i)}getMuted(e){const t={plugin:this.callsign,method:"getGain",params:{audioPort:e}};return this.api.req(null,t)}setAudioDelay(e,t){const i={plugin:this.callsign,method:"setAudioDelay",params:{audioDelay:e,audioPort:t}};return this.api.req(null,i)}getAudioDelay(e){const t={plugin:this.callsign,method:"getAudioDelay",params:{audioPort:e}};return this.api.req(null,t)}getAudioDelayOffset(e){const t={plugin:this.callsign,method:"getAudioDelayOffset",params:{audioPort:e}};return this.api.req(null,t)}setAudioDelayOffset(e,t){const i={plugin:this.callsign,method:"setAudioDelayOffset",params:{audioDelayOffset:e,audioPort:t}};return this.api.req(null,i)}setScartParameter(e,t){const i={plugin:this.callsign,method:"setScartParameter",params:{scartParameter:e,scartParameterData:t}};return this.api.req(null,i)}updateDisplayRelatedResponse(){this.getSupportedTvResolutions(this.video_display_resolution.value).then(e=>{this.supported_tv_resolutions.innerHTML=e.supportedTvResolutions}),this.getSupportedSettopResolutions(this.video_display_resolution.value).then(e=>{this.supported_stb_resolutions.innerHTML=e.supportedSettopResolutions}),this.getVideoPortStatusInStandby(this.select_port_standby.value).then(e=>{e.videoPortStatusInStandby?this.standby_mode.checked=!0:this.standby_mode.checked=!1}),this.updateActiveInput(),this.getSupportedResolutions(this.video_display_resolution.value).then(e=>{this.supported_resolutions.innerHTML=e.supportedResolutions,this.totalResolution=e.supportedResolutions,this.updateCurrentResolution()})}update(){this.getSupportedVideoDisplays().then(e=>{this.supported_video_displays.innerHTML=e.supportedVideoDisplays;for(var t=[this.video_display_resolution,this.video_display_current,this.select_port_standby,this.video_display_active],i=0;i{null!=e&&e.success&&(this.default_resolution.innerHTML=e.defaultResolution)}),this.getConnectedAudioPorts().then(e=>{this.connected_audio_ports.innerHTML=e.connectedAudioPorts}),this.getSupportedAudioPorts().then(e=>{this.supported_audio_ports.innerHTML=e.supportedAudioPorts,this.audioPort=e.supportedAudioPorts[0];for(var t=[this.select_audio_port,this.audio_port,this.audioPort_leveller,this.audioPort_level,this.audioPort_bass,this.audioPort_boost,this.audioPort_steering,this.audioPort_surroundDecoder,this.audioPort_drc,this.audioPort_gain,this.audioPort_muted,this.audioPort_delay,this.audioPort_delayOffset],i=0;i{this.edid_hdmi.innerHTML=e.EDID}),this.readHostEDID().then(e=>{e&&""!=e.EDID?this.edid_host.innerHTML=e.EDID:this.edid_host.innerHTML="-"}),this.getTvHDRSupport().then(e=>{this.hdr_tv.innerHTML=e.standards}),this.getSettopHDRSupport().then(e=>{this.hdr_stb.innerHTML=e.standards}),this.getTVHDRCapabilities().then(e=>{switch(e.capabilities){case 0:this.hdr_tv_capabilities.innerHTML="HDRSTANDARD_NONE";break;case 1:this.hdr_tv_capabilities.innerHTML="HDRSTANDARD_HDR10";break;case 2:this.hdr_tv_capabilities.innerHTML="HDRSTANDARD_HLG";break;case 4:this.hdr_tv_capabilities.innerHTML="HDRSTANDARD_DolbyVision";break;case 8:this.hdr_tv_capabilities.innerHTML="HDRSTANDARD_TechnicolorPrime";break;default:this.hdr_tv_capabilities.innerHTML=e.capabilities}}),this.getCurrentOutputSettings().then(e=>{this.color_space.innerHTML=e.colorSpace,this.color_depth.innerHTML=e.colorDepth,this.matrix_coefficients.innerHTML=e.matrixCoefficients,this.video_EOTF.innerHTML=e.videoEOTF}),this.getZoomSetting().then(e=>{(i=document.createElement("option")).text=e.zoomSetting,i.value=e.zoomSetting,this.select_zoom_setting.appendChild(i),this.supportedZoomSettingFiltered=["FULL","NONE","Letterbox 16x9","Letterbox 14x9","CCO","PanScan","Letterbox 2.21 on 4x3","Letterbox 2.21 on 16x9","Platform","Zoom 16x9","Pillarbox 4x3","Widescreen 4x3"].filter(t=>e.zoomSetting!=t);for(var t=0;t{e&&null!=e.dolbyVolumeMode&&(this.dolby_mode.checked=e.dolbyVolumeMode)}),this.getSinkAtmosCapability().then(e=>{null!=e&&e.success?this.sink_atmos.innerHTML=e.atmos_capability:this.sink_atmos.innerHTML="-"}),this.isConnectedDeviceRepeater().then(e=>{e&&null!=e.HdcpRepeater?this.repeater=e.HdcpRepeater:this.repeater="-"}),this.getMISteering(this.audioPort_steering.value).then(e=>{e&&null!=e.MISteeringEnable?this.mi_enable.checked=e.MISteeringEnable:this.mi_enable.checked=!1}),this.isSurroundDecoderEnabled(this.audioPort_surroundDecoder.value).then(e=>{null!=e&&null!=e.surroundDecoderEnable?this.surroundDecoder_enable.checked=e.surroundDecoderEnable:this.surroundDecoder_enable.checked=!1}),this.getMuted(this.audioPort_muted.value).then(e=>{null!=e&&null!=e.muted?this.muted_enable.checked=e.muted:this.muted_enable.checked=!1}),this.getAudioDelay(this.audioPort_delay.value).then(e=>{null!=e&&null!=e.audioDelay?this.delay.value=e.audioDelay:this.delay.value=""}),this.getAudioDelayOffset(this.audioPort_delayOffset.value).then(e=>{null!=e&&null!=e.audioDelayOffset?this.delayOffset.value=e.audioDelayOffset:this.delayOffset.value=""}),this.updateEnhancerList(),this.updateEqualizerList()}close(){this.onResolutionChanged&&"function"==typeof this.onResolutionChanged.dispose&&(this.onResolutionChanged.dispose(),this.onResolutionChanged=null),this.onZoomSettingUpdated&&"function"==typeof this.onZoomSettingUpdated.dispose&&(this.onZoomSettingUpdated.dispose(),this.onZoomSettingUpdated=null),this.onActiveInputChanged&&"function"==typeof this.onActiveInputChanged.dispose&&(this.onActiveInputChanged.dispose(),this.onActiveInputChanged=null),this.onConnectedVideoDisplaysUpdated&&"function"==typeof this.onConnectedVideoDisplaysUpdated.dispose&&(this.onConnectedVideoDisplaysUpdated.dispose(),this.onConnectedVideoDisplaysUpdated=null)}};var Z=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="HDCP Profile",this.mainDiv=document.getElementById("main"),this.template='\n\t\t
      \n\t\t\tHDCP Status\n\t\t
      \n\t\t
      \n\t\t\tHDCP Supported\n\t\t
      \n\t\t
      \n\t\t\t-\n\t\t
      \n\t\t
      \n\t\t\tDisplay connected\n\t\t
      \n\t\t
      \n\t\t\t-\n\t\t
      \n\t\t
      \n\t\t\tHDCP Compliant display\n\t\t
      \n\t\t
      \n\t\t\t-\n\t\t
      \n\t\t
      \n\t\t\tHDCP Enabled content\n\t\t
      \n\t\t
      \n\t\t\t-\n\t\t
      \n\t\t
      \n\t\t\tSupported HDCP Version\n\t\t
      \n\t\t
      \n\t\t\t-\n\t\t
      \n\t\t
      \n\t\t\tReceiver HDCP Version\n\t\t
      \n\t\t
      \n\t\t\t-\n\t\t
      \n\t\t
      \n\t\t\tCurrent HDCP Version\n\t\t
      \n\t\t
      \n\t\t\t-\n\t\t
      \n \t'}render(){this.mainDiv.innerHTML=this.template,this.hdcpSupport=document.getElementById("hdcp_support"),this.hdcpConnect=document.getElementById("hdcp_connect"),this.hdcpCompliant=document.getElementById("hdcp_compliant"),this.hdcpEnabled=document.getElementById("hdcp_enabled"),this.hdcpVersion=document.getElementById("hdcp_version"),this.receiverVersion=document.getElementById("receiver_version"),this.currentVersion=document.getElementById("current_version"),this.getStbSupport().then(e=>{this.hdcpSupport.innerHTML=e.isHDCPSupported}),this.update(),this.onDisplayChange=this.api.t.on(this.callsign,"onDisplayConnectionChanged",e=>{this.updateData(e.HDCPStatus)})}update(){this.getHdcpStatus().then(e=>{this.updateData(e.HDCPStatus)})}updateData(e){this.hdcpConnect.innerHTML=e.isConnected,this.hdcpCompliant.innerHTML=e.isHDCPCompliant,this.hdcpEnabled.innerHTML=e.isHDCPEnabled,this.hdcpVersion.innerHTML=e.supportedHDCPVersion,this.receiverVersion.innerHTML=e.receiverHDCPVersion,this.currentVersion.innerHTML=e.currentHDCPVersion}getStbSupport(){const e={plugin:this.callsign,method:"getSettopHDCPSupport"};return this.api.req(null,e)}getHdcpStatus(){const e={plugin:this.callsign,method:"getHDCPStatus"};return this.api.req(null,e)}};var J=class extends M{constructor(e,t){super(e,t),this.displayName="HDMIInput",this.value="",this.namedPing=!1,this.namedTrace=!1}render(){document.getElementById("main").innerHTML='\n
      \n HDMI Input Devices\n
      \n
      \n
      \n
      \n
      \n Activate/Deactivate Input\n
      \n
      \n Port Id\n
      \n
      \n \n
      \n
      \n \n \n
      \n
      \n EDID\n
      \n
      \n EDID value of currently stubbed\n
      \n
      \n -\n
      \n
      \n Change EDID value\n
      \n
      \n Device Id\n
      \n
      \n \n
      \n
      \n Message\n
      \n
      \n \n
      \n
      \n \n
      \n ',this.input_devices=document.getElementById("input_devices"),this.portId=document.getElementById("portId"),this.start=document.getElementById("start"),this.start.onclick=this.doStart.bind(this),this.stop=document.getElementById("stop"),this.stop.onclick=this.doStop.bind(this),this.read_edid=document.getElementById("read_edid"),this.deviceId=document.getElementById("deviceId"),this.edid_message=document.getElementById("edid_message"),this.write_edid=document.getElementById("write_edid"),this.write_edid.onclick=this.doWrite.bind(this),this.streaming=!1,this.onDevicesChanged=this.api.t.on(this.callsign,"onDevicesChanged",this.update()),this.length=0}doStart(){if(this.portId.value)try{this.startHdmiInput(this.portId.value).then(e=>{e&&e.success?(this.streaming=!0,alert("Successfully started hdmi input streaming")):alert("Failed to start hdmi input streaming")})}catch(e){alert("Error in getting response")}else alert("No active ports available to start hdmi streaming")}doStop(){if(this.streaming){if(this.portId.value)try{this.stopHdmiInput().then(e=>{e&&e.success?(this.streaming=!1,alert("Successfully stopped hdmi input streaming")):alert("Failed to stop hdmi input streaming")})}catch(e){alert("Error in getting response")}}else alert("Currently, there is no streaming from hdmi input to stop")}doWrite(){if(""!==this.edid_message.value&&0!=this.edid_message.value.trim().length&&this.deviceId.value)try{this.writeEDID(parseInt(this.deviceId.value),this.edid_message.value).then(e=>{e&&e.success?(this.streaming=!0,alert("Successfully set message")):alert("Failed to set edid value")})}catch(e){alert("Error in setting edid value")}else""==this.deviceId.value?alert("No active ports available to change EDID value"):""!=this.edid_message.value&&0!=this.edid_message.value.trim().length||alert("Please provide message")}getHDMIInputDevices(){const e={plugin:this.callsign,method:"getHDMIInputDevices"};return this.api.req(null,e)}startHdmiInput(e){const t={plugin:this.callsign,method:"startHdmiInput",params:{portId:e}};return this.api.req(null,t)}stopHdmiInput(){const e={plugin:this.callsign,method:"stopHdmiInput"};return this.api.req(null,e)}readEDID(){const e={plugin:this.callsign,method:"readEDID"};return this.api.req(null,e)}writeEDID(e,t){const i={plugin:this.callsign,method:"writeEDID",params:{deviceId:e,message:t}};return this.api.req(null,i)}update(){this.input_devices.innerHTML="";for(var e=length-1;e>=0;e--)this.portId.options[e]=null,this.deviceId.options[e]=null;try{this.getHDMIInputDevices().then(e=>{if(e&&e.success&&e.devices.length){this.length=e.devices.length,this.tr1=document.createElement("tr"),this.tr1.id="tr",this.tr1.className="text grid__col grid__col--8-of-8",this.td1=document.createElement("th"),this.td1.id="td",this.td1.className="text grid__col grid__col--2-of-8",this.td1div=document.createElement("div"),this.td1div.innerHTML="Locator",this.td2=document.createElement("th"),this.td2.id="td",this.td2div=document.createElement("div"),this.td2.className="text grid__col grid__col--2-of-8",this.td2div.innerHTML="Connected",this.td1.appendChild(this.td1div),this.td2.appendChild(this.td2div),this.tr1.appendChild(this.td1),this.tr1.appendChild(this.td2),this.input_devices.appendChild(this.tr1);for(var t=0;t\n Locator\n Connected\n \n \n No data available\n \n ":alert("Error in getting response")})}catch(e){alert("Failed to get response")}try{this.readEDID().then(e=>{e&&e.success&&e.name?this.read_edid.innerHTML=e.name:alert("Failed to get response")})}catch{alert("Error in getting response")}}close(){this.onDevicesChanged&&"function"==typeof this.onDevicesChanged.dispose&&(this.onDevicesChanged.dispose(),this.onDevicesChanged=null)}};var Y=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Logging Preferences",this.mainDiv=document.getElementById("main"),this.template='\n\t\t\t
      \n\t\t\t\tLogging Preferences\n\t\t\t
      \n\t\t\t
      \n\t\t\t\tKeystroke Mask\n\t\t\t
      \n\t\t\t
      \n\t\t\t\t\n\t\t\t\t\n\t\t\t
      \n\t\t\t
      \n\t\t\t\t-\n\t\t\t
      \n '}getKeyStrokeMask(){const e={plugin:this.callsign,method:"isKeystrokeMaskEnabled"};return this.api.req(null,e)}setKeyStrokeMask(e){const t={plugin:this.callsign,method:"setKeystrokeMaskEnabled",params:{keystrokeMaskEnabled:e}};return this.api.req(null,t)}update(){this.getKeyStrokeMask().then(e=>{e.keystrokeMaskEnabled?(this.logPreference.checked=!0,this.keyStroke.innerHTML="Enabled"):e.keystrokeMaskEnabled||(this.logPreference.checked=!1,this.keyStroke.innerHTML="Disabled")})}render(){this.mainDiv.innerHTML=this.template,this.keyStroke=document.getElementById("KeyStrokeMaskStatus"),this.logPreference=document.getElementById("LogPreference"),this.update(),this.logPreference.onclick=this.mask.bind(this),this.onKeystrokeMaskEnabledChange=this.api.t.on(this.callsign,"onKeystrokeMaskEnabledChange",this.update.bind(this))}mask(){this.logPreference.checked?this.setKeyStrokeMask(!0):this.logPreference.checked||this.setKeyStrokeMask(!1)}};var X=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Location"}render(){document.getElementById("main").innerHTML='
      \n Location\n
      \n\n
      \n City\n
      \n
      \n -\n
      \n
      \n Country\n
      \n
      \n -\n
      \n
      \n Region\n
      \n
      \n -\n
      \n\n
      \n Timezone\n
      \n
      \n -\n
      \n\n
      \n Public IP\n
      \n
      \n -\n
      \n\n
      \n Sync\n
      \n
      \n \n
      ',document.getElementById("syncButton").onclick=this.syncLocation.bind(this),this.cityEl=document.getElementById("city"),this.countryEl=document.getElementById("country"),this.regionEl=document.getElementById("region"),this.timezoneEl=document.getElementById("timezone"),this.publicIpEl=document.getElementById("publicip"),this.update()}syncLocation(){const e={plugin:this.callsign,method:"sync"};this.api.req(null,e).then(()=>{this.update()})}location(){const e={plugin:this.callsign,method:"location"};return this.api.req(null,e)}update(){this.location().then(e=>{this.cityEl.innerHTML=e.city,this.countryEl.innerHTML=e.country,this.regionEl.innerHTML=e.region,this.timezoneEl.innerHTML=e.timezone,this.publicIpEl.innerHTML=e.publicip})}};var $=class extends M{constructor(e,t){super(e,t),this.displayName="Messaging",this.modules=void 0,this.selectedModule=void 0,this.controls=void 0,this.socketUrl=`ws://${t.host[0]}:${t.host[1]}/Service/MessageControl`,this.messagingSocket=void 0}close(){this._closeSocket(),super.close()}enableControl(e,t,i){const n={plugin:"MessageControl",method:"enable",params:{type:"SysLog"===e?"Logging":"Reporting"===e?"Reporting":"OperationalStream"===e?"OperationalStream":"Assert"===e?"Assert":"Tracing",module:e,category:t,enabled:i}};return this.api.req(null,n)}retrieveModules(){return this.api.req(null,{plugin:"MessageControl",method:"modules"})}retrieveCategories(e){const t={plugin:"MessageControl",method:"controls@"+e};return this.api.req(null,t)}render(){this._openSocket();var e=this;document.getElementById("main").innerHTML='
      \n Modules\n
      \n\n
      \n \n
      \n
      \n \n
      \n\n
      \n\n
      \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
      timemodulecategorymessageadditional information
      \n
      \n ',document.getElementById("messagingModules").onchange=this.getSelectedModuleAndShowCategories.bind(this),this.retrieveModules().then(t=>{e.modules=t,e.modules.sort();var i=document.getElementById("messagingModules");if(i.options.length=0,void 0!==e.modules){for(var n=0;n{this.controls=t,this.controls.sort((e,t)=>e.categoryt.category?1:0);var i=document.getElementById("messaging_div");if(i.innerHTML="",0!==this.controls.length){this.selectedModule=e;for(var n=0;n/g,">").replace(/"/g,""").replace(/'/g,"'")}_socketMessage(e){const t=JSON.parse(e.data),n=new Date(t.time),s=document.createElement("tr"),o=document.createElement("td");o.innerHTML=`${n.getHours()}:${n.getMinutes()}:${n.getSeconds()}`,s.appendChild(o);const l=document.createElement("td");l.innerHTML=t.module,s.appendChild(l);const d=document.createElement("td");d.innerHTML=t.category,s.appendChild(d);var r=new(i(14));const a=document.createElement("td");a.innerHTML=r.toHtml(t.message),s.appendChild(a);const c=document.createElement("td");if(void 0!==t.classname&&void 0!==t.filename&&void 0!==t.linenumber){const e=this.escapeHtml(t.classname);c.innerHTML=`${t.filename}:${t.linenumber}::${e}`}else void 0!==t.processid&&void 0!==t.processname&&void 0!==t.filename&&void 0!==t.linenumber?c.innerHTML=`[${t.processid}]${t.processname}::${t.filename}:${t.linenumber}`:void 0!==t.callsign?c.innerHTML=""+t.callsign:c.innerHTML="";s.appendChild(c),document.getElementById("messagesData").appendChild(s);const u=document.getElementById("messagesTableContainer");u.scrollTop=u.scrollHeight}_openSocket(){this._closeSocket(),this.messagingSocket=new WebSocket(this.socketUrl,"json"),this.messagingSocket.onmessage=this._socketMessage.bind(this)}_closeSocket(){this.messagingSocket&&(this.messagingSocket.close(),this.messagingSocket=void 0)}};var Q=class extends M{constructor(e,t){super(e,t)}render(){document.getElementById("main").innerHTML='
      \n IOConnector\n
      \n\n
      \n PIN\n
      \n
      \n \n
      \n
      \n \n
      \n\n
      \n Value\n
      \n
      \n \n
      \n
      \n \n
      ',this.pinEl=document.getElementById("pinInput"),this.valueEl=document.getElementById("valueInput"),document.getElementById("get").onclick=this.getPin.bind(this),document.getElementById("set").onclick=this.setPin.bind(this)}pin(e,t){const i={plugin:this.callsign,method:"pin@"+e};return""!==t&&(i.params=t),this.api.req(null,i)}getPin(){let e=this.pinEl.value;this.pin(e).then(e=>{this.valueEl.value=e})}setPin(){let e=this.pinEl.value,t=this.valueEl.value;this.pin(e,t)}};var ee=class extends M{constructor(e,t){super(e,t),this.displayName="Messenger",this.rooms=new Map}render(){document.getElementById("main").innerHTML='\n
      \n Join\n
      \n
      \n User\n
      \n
      \n \n
      \n
      \n Room\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n
      \n
      \n Leave\n
      \n
      \n RoomId\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n
      \n
      \n Send Message\n
      \n
      \n RoomId\n
      \n
      \n \n
      \n
      \n Message\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n
      \n ',this.user=document.getElementById("user"),this.room=document.getElementById("room"),this.join=document.getElementById("join"),this.join.onclick=this.doJoinRoom.bind(this),this.joined_text=document.getElementById("joined_text"),this.room_id=document.getElementById("room_id"),this.leave=document.getElementById("leave"),this.leave.onclick=this.doLeaveRoom.bind(this),this.left_text=document.getElementById("left_text"),this.message_room_id=document.getElementById("message_room_id"),this.message=document.getElementById("message"),this.sent=document.getElementById("sent"),this.sent.onclick=this.doSentMessage.bind(this),this.send_text=document.getElementById("send_text")}_formatRoomLabel(e){const t=this.rooms.get(e);return t?`${e} (${t.user}/${t.name})`:e}_addRoomOptions(e){const t=this._formatRoomLabel(e);if([...this.room_id.options].some(t=>t.value===e))[...this.room_id.options].forEach(i=>{i.value===e&&(i.text=t)});else{const i=document.createElement("option");i.value=e,i.text=t,this.room_id.appendChild(i)}if([...this.message_room_id.options].some(t=>t.value===e))[...this.message_room_id.options].forEach(i=>{i.value===e&&(i.text=t)});else{const i=document.createElement("option");i.value=e,i.text=t,this.message_room_id.appendChild(i)}}_extractRoomId(e){if("string"==typeof e)return e;if(!e)return null;if("string"==typeof e.result)return e.result;const t=void 0!==e.result?e.result:e;return"string"==typeof t?t:t&&"object"==typeof t&&(t.roomid||t.roomId||t.room||t.id)||null}doJoinRoom(){if(""!==this.user.value&&""!==this.room.value&&0!==this.user.value.trim().length&&0!==this.room.value.trim().length){const e=this.user.value.trim(),t=this.room.value.trim();this.joinRoom(e,t).then(i=>{if(i&&"object"==typeof i&&i.error)return console.warn("Join returned error object:",i.error),void alert("Failed to join room (backend error)");const n=this._extractRoomId(i);console.debug("Extracted roomId:",n),n&&"string"==typeof n&&n.trim().length?(this.rooms.has(n)||this.rooms.set(n,{name:t,user:e}),this.joined_text.textContent="Joined room "+this._formatRoomLabel(n),setTimeout(()=>this.removeJoinText(),2e3),this._addRoomOptions(n),this.room_id.value=n,this.message_room_id.value=n):(console.warn("Join response missing usable room id after extraction:",i),alert("Failed to join room (no room identifier in response)"))}).catch(e=>{console.error("Join RPC failed:",e),alert("Failed to join room (RPC error)")})}else""===this.user.value&&""===this.room.value||0===this.user.value.trim().length&&0===this.room.value.trim().length?alert("Please provide user and room value to join the room"):""===this.user.value||0===this.user.value.trim().length?alert("Please provide user value to join the room"):""!==this.room.value&&0!==this.room.value.trim().length||alert("Please provide room value to join the room")}doLeaveRoom(){if(this.roomIdValue=this.room_id.selectedIndex,this.roomIdValue>=0){const e=this.room_id[this.roomIdValue].value;this.leaveRoom(e).then(t=>{t&&t.error?(console.warn("Leave error response:",t),alert("Failed to leave room")):(this.left_text.textContent="Left room "+this._formatRoomLabel(e),setTimeout(()=>this.removeLeftText(),2e3),this.room_id.remove(this.roomIdValue),this.message_room_id.remove(this.roomIdValue),this.rooms.delete(e),this.user.value="",this.room.value="",this.message.value="")}).catch(e=>{console.error("Leave RPC failed:",e),alert("Failed to leave room (RPC error)")})}else alert("No rooms are available to leave")}doSentMessage(){if(this.messageRoomIdValue=this.message_room_id.selectedIndex,this.messageRoomIdValue>=0&&""!==this.message.value&&0!==this.message.value.trim().length){const e=this.message_room_id.options[this.messageRoomIdValue].value;this.sentMessage(e,this.message.value).then(t=>{t&&t.error?(console.warn("Send error response:",t),alert("Failed to send message")):(this.send_text.innerText="Message sent to "+e,setTimeout(()=>this.removeSendText(),2e3))}).catch(e=>{console.error("Send RPC failed:",e),alert("Failed to send message (RPC error)")})}else""===this.message.value||0===this.message.value.trim().length?alert("Please provide message value"):this.messageRoomIdValue<0&&alert("No rooms are available to send a message")}joinRoom(e,t){const i={plugin:this.callsign,method:"join",params:{user:e,room:t}};return this.api.req(null,i)}leaveRoom(e){const t={plugin:this.callsign,method:"leave",params:{roomid:e}};return this.api.req(null,t)}sentMessage(e,t){const i={plugin:this.callsign,method:"sent",params:{roomid:e,message:t}};return this.api.req(null,i)}removeJoinText(){this.joined_text&&(this.joined_text.textContent="")}removeLeftText(){this.left_text&&(this.left_text.textContent="")}removeSendText(){this.send_text&&(this.send_text.textContent="")}close(){if(this.room_id){[...this.room_id.options].map(e=>e.value).forEach(e=>this.leaveRoom(e)),this.rooms.clear()}}};var te=class extends M{constructor(e,t){super(e,t),this.monitor=void 0,this.netflixVisibilityListener=this.api.t.on("Netflix","visibilitychange",e=>{"boolean"==typeof e.hidden&&(this.isHidden=e.hidden,!0===this.rendered&&this.update())}),this.netflixStateListener=this.api.t.on("Netflix","statechange",e=>{"boolean"==typeof e.suspended&&(this.isSuspended=e.suspended,!0===this.rendered&&this.update())}),this.api.getControllerPlugins().then(e=>{let t=e.filter(e=>"Monitor"===e.callsign);void 0!==t&&(this.monitor=new D(t,this.api))})}render(){document.getElementById("main").innerHTML='
      \n ESN\n
      \n\n
      \n ID\n
      \n
      \n -\n
      \n\n
      \n
      \n
      \n
      Memory
      \n
      Current State
      \n
      \n
      \n
      \n \n
      \n
      \n
      ',this.interval=setInterval(this.update.bind(this),I.refresh_interval),this.update()}update(e){this.status().then(e=>{e.esn&&(document.getElementById("netflix-esn").innerHTML=e.esn);var t=e.suspended?"Suspended":"Resumed";document.getElementById("NetflixStateInfo").innerHTML=t;var i="Suspend";!0===e.suspended&&(i="Resume");var n=document.getElementById("NetflixSuspendButton");n.innerHTML=i.toUpperCase(),n.onclick=this.toggleSuspend.bind(this,i),this.monitor&&this.monitor.getMonitorDataAndDiv().then(e=>{var t=document.getElementById(this.callsign+"Memory");t.innerHTML="",t.appendChild(e)})})}close(){clearInterval(this.interval),this.netflixVisibilityListener&&"function"==typeof this.netflixVisibilityListener.dispose&&this.netflixVisibilityListener.dispose(),this.netflixStateListener&&"function"==typeof this.netflixStateListener.dispose&&this.netflixStateListener.dispose()}toggleSuspend(e){var t=this;"Resume"===e?this.resume().then(()=>{t.update({suspended:!1})}).catch(e=>{t.render()}):this.suspend().then(()=>{t.update({suspended:!0})}).catch(e=>{t.render()})}};var ie=class extends M{constructor(e,t){super(e,t),this.displayName="Network",this.value="",this.namedPing=!1,this.namedTrace=!1}render(){document.getElementById("main").innerHTML='\n
      \n Interfaces and status\n
      \n
      \n
      \n
      \n
      \n IP address\n
      \n
      \n -\n
      \n
      \n Default Interface\n
      \n
      \n \n \n
      \n
      \n Ping an endpoint\n
      \n
      \n Type\n
      \n
      \n \n
      \n
      \n Endpoint\n
      \n
      \n \n
      \n
      \n Packets\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n
      \n
      \n
      \n Trace an endpoint\n
      \n
      \n Type\n
      \n
      \n \n
      \n
      \n Endpoint\n
      \n
      \n \n
      \n
      \n Packets\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n
      \n
      \n ',this.current_api_version=document.getElementById("current_api_version"),this.stb_ip=document.getElementById("stb_ip"),this.set_api=document.getElementById("set_api"),this.get_interfaces=document.getElementById("get_interfaces"),this.change_default_interface=document.getElementById("change_default_interface"),this.set_default_interface=document.getElementById("set_default_interface"),this.set_default_interface.onclick=this.setNewDefaultInterface.bind(this),this.input_endpoint_ping=document.getElementById("input_endpoint_ping"),this.input_endpoint_trace=document.getElementById("input_endpoint_trace"),this.select_input=document.getElementById("select_input "),this.packets_ping=document.getElementById("packets_ping"),this.type_ping=document.getElementById("type_ping"),this.type_ping.onchange=this.changePingInput.bind(this),this.type_trace=document.getElementById("type_trace"),this.type_trace.onchange=this.changeTraceInput.bind(this),this.set_ping_endpoint=document.getElementById("set_ping_endpoint"),this.set_ping_endpoint.onclick=this.doPing.bind(this),this.ping_response=document.getElementById("ping"),this.trace_endpoint=document.getElementById("trace_endpoint"),this.trace_packets=document.getElementById("trace_packets"),this.set_trace_endpoint=document.getElementById("set_trace_endpoint"),this.set_trace_endpoint.onclick=this.doTrace.bind(this),this.trace_response=document.getElementById("trace"),this.onConnectionStatusChanged=this.api.t.on(this.callsign,"onConnectionStatusChanged",this.connectionChange.bind(this)),this.onIPAddressStatusChanged=this.api.t.on(this.callsign,"onIPAddressStatusChanged",this.ipChange.bind(this)),this.onDefaultInterfaceChanged=this.api.t.on(this.callsign,"onDefaultInterfaceChanged",this.defaultInterfaceChange.bind(this)),this.onInterfaceStatusChanged=this.api.t.on(this.callsign,"onInterfaceStatusChanged",this.interfaceStatusChange.bind(this)),this.update()}changePingInput(){this.input_endpoint_ping.remove(),"Named"==this.type_ping.value?(this.input_endpoint_ping=document.createElement("select"),this.input_endpoint_ping.className="grid__col--5-of-8",document.getElementById("select_input").appendChild(this.input_endpoint_ping),this.getNamedEndpoints().then(e=>{for(var t=0;t{for(var t=0;t{this.stb_ip.innerHTML=e.ip})}interfaceChange(e){this.change_default_interface.innerHTML="",this.defaultInterface.remove(),this.updateDefaultInterface()}interfaceStatusChange(e){document.getElementById("enable_addr"+e.interface).checked=e.enabled}defaultInterfaceChange(){this.change_default_interface.innerHTML="",this.defaultInterface.remove(),this.updateDefaultInterface()}updateDefaultInterface(){this.getDefaultInterface().then(e=>{this.defaultInterface=document.createElement("option"),this.defaultInterface.text=e.interface,this.defaultInterface.value=e.interface,this.change_default_interface.appendChild(this.defaultInterface),this.interfacesList=this.interfaces.filter(t=>-1===e.interface.indexOf(t));for(var t=0;t{e.success||alert("Failed to set "+this.change_default_interface[this.selectedIndex].value+" as default interface"),this.change_default_interface.innerHTML="",this.updateDefaultInterface()})}createPingResponse(e,t){this.target=document.createElement("tr"),this.target_key=document.createElement("td"),this.target_key.className="label grid__col grid__col--4-of-8",this.target_key.innerHTML="Target",this.target_addr=document.createElement("td"),this.target_addr.className="label grid__col grid__col--4-of-8",this.target_addr.innerHTML=e.target,this.target.appendChild(this.target_key),this.target.appendChild(this.target_addr),this.packets_trans=document.createElement("tr"),this.packets_trans_key=document.createElement("td"),this.packets_trans_key.className="label grid__col grid__col--4-of-8",this.packets_trans_key.innerHTML="Packets transmitted",this.packets_trans_result=document.createElement("td"),this.packets_trans_result.className="label grid__col grid__col--4-of-8",this.packets_trans_result.innerHTML=e.packetsTransmitted,this.packets_trans.appendChild(this.packets_trans_key),this.packets_trans.appendChild(this.packets_trans_result),this.packets_receive=document.createElement("tr"),this.packets_receive_key=document.createElement("td"),this.packets_receive_key.className="label grid__col grid__col--4-of-8",this.packets_receive_key.innerHTML="Packets Received",this.packets_receive_result=document.createElement("td"),this.packets_receive_result.className="label grid__col grid__col--4-of-8",this.packets_receive_result.innerHTML=e.packetsReceived,this.packets_receive.appendChild(this.packets_receive_key),this.packets_receive.appendChild(this.packets_receive_result),this.packets_loss=document.createElement("tr"),this.packets_loss_key=document.createElement("td"),this.packets_loss_key.className="label grid__col grid__col--4-of-8",this.packets_loss_key.innerHTML="Packets Loss",this.packets_loss_result=document.createElement("td"),this.packets_loss_result.className="label grid__col grid__col--4-of-8",this.packets_loss_result.innerHTML=e.packetLoss,this.packets_loss.appendChild(this.packets_loss_key),this.packets_loss.appendChild(this.packets_loss_result),this.tripMin=document.createElement("tr"),this.tripMin_key=document.createElement("td"),this.tripMin_key.className="label grid__col grid__col--4-of-8",this.tripMin_key.innerHTML="Trip Min",this.tripMin_result=document.createElement("td"),this.tripMin_result.className="label grid__col grid__col--4-of-8",this.tripMin_result.innerHTML=e.tripMin,this.tripMin.appendChild(this.tripMin_key),this.tripMin.appendChild(this.tripMin_result),this.tripAvg=document.createElement("tr"),this.tripAvg_key=document.createElement("td"),this.tripAvg_key.className="label grid__col grid__col--4-of-8",this.tripAvg_key.innerHTML="Trip Avg",this.tripAvg_result=document.createElement("td"),this.tripAvg_result.className="label grid__col grid__col--4-of-8",this.tripAvg_result.innerHTML=e.tripAvg,this.tripAvg.appendChild(this.tripAvg_key),this.tripAvg.appendChild(this.tripAvg_result),this.tripMax=document.createElement("tr"),this.tripMax_key=document.createElement("td"),this.tripMax_key.className="label grid__col grid__col--4-of-8",this.tripMax_key.innerHTML="Trip Max",this.tripMax_result=document.createElement("td"),this.tripMax_result.className="label grid__col grid__col--4-of-8",this.tripMax_result.innerHTML=e.tripMax,this.tripAvg.appendChild(this.tripMax_key),this.tripAvg.appendChild(this.tripMax_result),this.tripStdDev=document.createElement("tr"),this.tripStdDev_key=document.createElement("td"),this.tripStdDev_key.className="label grid__col grid__col--4-of-8",this.tripStdDev_key.innerHTML="Trip Std Dev",this.tripStdDev_result=document.createElement("td"),this.tripStdDev_result.className="label grid__col grid__col--4-of-8",this.tripStdDev_result.innerHTML=e.tripStdDev,this.tripStdDev.appendChild(this.tripStdDev_key),this.tripStdDev.appendChild(this.tripStdDev_result),t.appendChild(this.target),t.appendChild(this.packets_trans),t.appendChild(this.packets_receive),t.appendChild(this.packets_loss),t.appendChild(this.tripMin),t.appendChild(this.tripAvg),t.appendChild(this.tripMax),t.appendChild(this.tripStdDev)}createPingErrMsg(e){alert(e.error)}createTraceResponse(e,t){for(var i=0;i{this.isInterfaceEnabled(e).then(t=>{document.getElementById("enable_addr"+e).checked=t.enabled}),t.success||(this.enableVal?this.alertMsg="enable":this.alertMsg="disable",alert("Failed to "+this.alertMsg+" "+e))})}startLoading(){this.loadingEl=document.getElementById("disconnected");this.loadingEl.style.display="block",this.loadingEl.innerHTML='
      \n
      Waiting for response
      \n
      '}stopLoading(){this.loadingEl.innerHTML="",this.loadingEl.style.display="none"}doPing(){this.ping_response&&(this.ping_response.innerHTML="",this.ping_response.id=""),this.namedPing?this.value=this.input_endpoint_ping[this.input_endpoint_ping.selectedIndex].value:this.value=this.input_endpoint_ping.value,""==this.value&&""==this.packets_ping.value?alert("Please provide endpoint and packet values to ping"):""==this.value?alert("Please provide endpoint value to ping"):""==this.packets_ping.value?alert("Please provide packet value to ping"):(this.startLoading(),this.namedPing?this.pingNamedEndpoint(this.value,this.packets_ping.value).then(e=>{this.stopLoading(),e.success?(this.ping_response.id="tableMedium",this.createPingResponse(e,this.ping_response,"notNamed")):this.createPingErrMsg(e,"notNamed")}):(this.value=this.input_endpoint_ping.value,this.ping(this.value,this.packets_ping.value).then(e=>{this.stopLoading(),e.success?(this.ping_response.id="tableMedium",this.createPingResponse(e,this.ping_response,"notNamed")):this.createPingErrMsg(e,"notNamed")})))}doTrace(){this.trace_response&&(this.trace_response.innerHTML="",this.trace_response.id=""),this.namedTrace?this.traceValue=this.input_endpoint_trace[this.input_endpoint_trace.selectedIndex].value:this.traceValue=this.input_endpoint_trace.value,""==this.traceValue&&""==this.trace_packets.value?alert("Please provide endpoint and packet values to trace"):""==this.traceValue?alert("Please provide endpoint value to trace"):""==this.trace_packets.value?alert("Please provide packet value to trace endpoint"):(this.startLoading(),this.namedTrace?this.traceNamedEndpoint(this.traceValue,this.trace_packets.value).then(e=>{this.stopLoading(),e.success?(this.trace_response.innerHTML="",this.trace_response.id="tableMedium",this.createTraceResponse(e,this.trace_response,"notNamed")):this.createTraceErrMsg(e,"notNamed")}):this.trace(this.traceValue,this.trace_packets.value).then(e=>{this.stopLoading(),e.success?(this.trace_response.innerHTML="",this.trace_response.id="tableMedium",this.createTraceResponse(e,this.trace_response,"notNamed")):this.createTraceErrMsg(e,"notNamed")}))}setTypes(){var e=document.createElement("option");e.text="NotNamed",e.value="NotNamed",this.type_ping.appendChild(e);var t=document.createElement("option");t.text="Named",t.value="Named",this.type_ping.appendChild(t);var i=document.createElement("option");i.text="NotNamed",i.value="NotNamed",this.type_trace.appendChild(i);var n=document.createElement("option");n.text="Named",n.value="Named",this.type_trace.appendChild(n)}setInterfaces(e){this.interfaces=[],this.tr1=document.createElement("tr"),this.tr1.className="text grid__col grid__col--8-of-8",this.td1=document.createElement("td"),this.td1.className="text grid__col grid__col--2-of-8",this.td1div=document.createElement("div"),this.td1div.innerHTML="Interface",this.td2=document.createElement("td"),this.td2div=document.createElement("div"),this.td2.className="text grid__col grid__col--2-of-8",this.td2div.innerHTML="MAC Address",this.td3=document.createElement("td"),this.td3div=document.createElement("div"),this.td3.className="text grid__col grid__col--2-of-8",this.td3div.innerHTML="Connection Status",this.td4=document.createElement("td"),this.td4div=document.createElement("div"),this.td4.className="text grid__col grid__col--2-of-8",this.td4div.innerHTML="Enabled status",this.td1.appendChild(this.td1div),this.td2.appendChild(this.td2div),this.td3.appendChild(this.td3div),this.td4.appendChild(this.td4div),this.tr1.appendChild(this.td1),this.tr1.appendChild(this.td2),this.tr1.appendChild(this.td3),this.tr1.appendChild(this.td4),this.get_interfaces.appendChild(this.tr1);for(var t=0;t{this.stb_ip.innerHTML=e.ip}),this.setTypes(),this.getInterfaces().then(e=>{this.setInterfaces(e)})}close(){this.onConnectionStatusChanged&&"function"==typeof this.onConnectionStatusChanged.dispose&&(this.onConnectionStatusChanged.dispose(),this.onConnectionStatusChanged=null),this.onIPAddressStatusChanged&&"function"==typeof this.onIPAddressStatusChanged.dispose&&(this.onIPAddressStatusChanged.dispose(),this.onIPAddressStatusChanged=null),this.onDefaultInterfaceChanged&&"function"==typeof this.onDefaultInterfaceChanged.dispose&&(this.onDefaultInterfaceChanged.dispose(),this.onDefaultInterfaceChanged=null),this.onInterfaceStatusChanged&&"function"==typeof this.onInterfaceStatusChanged.dispose&&(this.onInterfaceStatusChanged.dispose(),this.onInterfaceStatusChanged=null)}};var ne=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Network",this.isUp=!1,this.dns=[],this.networks=[],this.interfaces=[],this.modeList=["Dynamic","Static"]}render(){document.getElementById("main").innerHTML='\n
      \n Network Control\n
      \n
      \n Network Interface\n
      \n
      \n \n
      \n
      \n status\n
      \n
      \n -\n
      \n \n
      \n DNS\n
      \n
      \n \n
      \n
      \n Control\n
      \n
      \n \n \n
      ',this.interfacesOptsEl=document.getElementById("NetworkInterface"),this.interfacesOptsEl.onchange=this.updateNetworkInterface.bind(this),document.getElementById("save").onclick=this.save.bind(this);let e=document.getElementById("toggleUp");e.innerHTML=this.isUp?"Down":"Up",e.onclick=this.toggleUp.bind(this),document.getElementById("flush").onclick=this.flush.bind(this),this.dnsEl=document.getElementById("dnslist"),this.ipEl=document.getElementById("ip"),this.gatewayEl=document.getElementById("gateway"),this.maskEl=document.getElementById("mask"),this.modeEl=document.getElementById("mode"),this.statusTypeEl=document.getElementById("statusType"),this.networkListener=this.api.t.on("NetworkControl","update",e=>{console.log("NETWORK NOT",e),this.update()}),this.update()}getInterfaceIsUp(e){const t={plugin:this.callsign,method:"up@"+e};return this.api.req(null,t).then(e=>{if(void 0===e)return;let t=e.value?e.value:e;this.isUp=t,document.getElementById("toggleUp").innerHTML=this.isUp?"Down":"Up"})}getStatus(e){const t={plugin:this.callsign,method:"status@"+e};return this.api.req(null,t).then(t=>{if(void 0===t)return;let i=t.statustype?t.statustype:t;void 0!==i&&(this.statustype=i,this.statusTypeEl.innerHTML=i,this.getNetwork(e))})}getNetwork(e){const t={plugin:this.callsign,method:"network@"+e};return this.api.req(null,t).then(e=>{if(void 0===e)return;let t=e.network?e.network:e;void 0!==t&&(this.networks=t,this.renderNetworkDetails())})}getDNS(){const e={plugin:this.callsign,method:"dns"};return this.api.req(null,e).then(e=>{if(void 0===e)return;let t=e.dns?e.dns:e;if(void 0!==t&&(this.dns=[],this.dnsEl.value="",t.length)){for(var i=0;i{if(void 0===e)return;let t=e.interfaces?e.interfaces:e;if(void 0===t)return;let i=this.interfacesOptsEl.selectedIndex;this.networks=[],this.interfaces=t,this.interfacesOptsEl.innerHTML="";for(var n=0;n{this.getInterfaceIsUp(e)})}flush(){let e=this.interfaces[this.interfacesOptsEl.selectedIndex];const t={plugin:this.callsign,method:"flush",params:{interface:e}};return this.api.req(null,t)}save(){this.setNetwork(),this.setDNS()}setNetwork(){let e=this.interfaces[this.interfacesOptsEl.selectedIndex];this.networks[0].mode=this.modeEl.value,this.networks[0].address=this.ipEl.value,this.networks[0].defaultgateway=this.gatewayEl.value,this.networks[0].mask=this.maskEl.value;const t={plugin:this.callsign,method:"network@"+e,params:{value:this.networks}};return this.api.req(null,t)}setDNS(){this.dns=[this.dnsEl.value];const e={plugin:this.callsign,method:"dns",params:{value:this.dns.toString().split(",")}};return this.api.req(null,e)}update(){this.getDNS(),this.getInterfaces()}renderNetworkDetails(){let e=this.networks[0];"Available"==this.statustype?(document.getElementById("ipSettings").style.display="block",this.modeEl.value=e.mode,this.ipEl.value=e.address,this.gatewayEl.value=e.defaultgateway,this.maskEl.value=e.mask):document.getElementById("ipSettings").style.display="none"}updateNetworkInterface(e){this.update()}close(){this.networkListener&&"function"==typeof this.networkListener.dispose&&this.networkListener.dispose()}};var se=class extends M{constructor(e,t){super(e,t),this.ocdmTemplate='
      \n {{Name}}\n
      \n
      \n {{Designators}}\n
      '}drms(){const e={plugin:this.callsign,method:"drms"};return this.api.req(null,e)}keysystems(e){const t={plugin:this.callsign,method:"keysystems@"+e};return this.api.req(null,t)}render(){document.getElementById("main").innerHTML='
      \n OpenCDM Systems\n
      \n
      ',this.systemDiv=document.getElementById("systemDiv"),this.update()}update(){this.drms().then(e=>{e&&e.forEach(e=>{const t=this.ocdmTemplate.replace("{{Name}}",e.name).replace("{{Designators}}",e.keysystems.toString());this.systemDiv.innerHTML+=t})})}};var oe=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Persistent Store"}render(){document.getElementById("main").innerHTML='\n
      \n
      Persistent Store
      \n
      Set Value
      \n
      Name space
      \n
      \n \n
      \n
      Key
      \n
      \n \n
      \n
      Value
      \n
      \n \n
      \n
      \n \n
      \n
      Namespaces
      \n
      Available namespaces
      \n
      \n \n
      \n
      \n \n \n
      \n
      \n
      \n
      \n
      \n
      \n
      \n \n
      \n
      \n ',this.namespace=document.getElementById("namespace"),this.del_button=document.getElementById("del_namespace"),this.detail_button=document.getElementById("get_details"),this.key=document.getElementById("set_key"),this.value=document.getElementById("value"),this.set_value=document.getElementById("set_value"),this.details=document.getElementById("details"),this.avail_namespaces=document.getElementById("avail_namespaces"),this.set_value.onclick=this.setValue.bind(this),this.status_application=document.getElementById("status_application"),this.del_button.onclick=this.delete.bind(this),this.detail_button.onclick=this.getDetails.bind(this),this.update()}update(){this.getNameSpaces().then(e=>{this.avail_namespaces.innerHTML="",e&&e.namespaces.map(e=>{let t=document.createElement("option");t.text=e,t.value=e,this.avail_namespaces.appendChild(t)})})}setPersistValue(e,t,i){const n={plugin:this.callsign,method:"setValue",params:{namespace:e,key:t,value:i}};return this.api.req(null,n)}getNameSpaces(){const e={plugin:this.callsign,method:"getNamespaces"};return this.api.req(null,e)}getStorageSize(){const e={plugin:this.callsign,method:"getStorageSize"};return this.api.req(null,e)}getKeys(e){const t={plugin:this.callsign,method:"getKeys",params:{namespace:e}};return this.api.req(null,t)}deleteNameSpaces(e){const t={plugin:this.callsign,method:"deleteNamespace",params:{namespace:e}};return this.api.req(null,t)}getKeyValue(e,t){const i={plugin:this.callsign,method:"getValue",params:{namespace:e,key:t}};return this.api.req(null,i)}delete(){this.deleteNameSpaces(this.avail_namespaces.value).then(e=>{e.success?(this.update(),this.getDetails(),alert("Namespace deleted successfully")):alert("Delete failed")})}deleteKey(e){const t={plugin:this.callsign,method:"deleteKey",params:{namespace:e,key:this.availKeys.value}};return this.api.req(null,t).then(e=>{e.success?this.getDetails():alert("Delete failed:"+e.error)})}setValue(){this.setPersistValue(this.namespace.value,this.key.value,this.value.value).then(e=>{e.success?(this.update(),this.getDetails(),alert("Key/Value pair stored successfullty stored in the store")):alert("Failed to store the key/value pair")})}getDetails(){let e=this.avail_namespaces.value;this.details.innerHTML="",this.getKeys(e).then(t=>{if(t.success){let i={};if(t.keys.length>0){this.details.innerHTML='\n
      Storage Size
      \n
      \n
      \n Delete Key\n
      \n
      \n \n
      \n
      \n \n
      ';let n=document.getElementById("name_size");this.status_application.innerHTML="";let s=document.createElement("tr");s.id="trLarge",s.className="text grid__col grid__col--8-of-8";let o=document.createElement("th");o.id="td",o.className="text grid__col grid__col--2-of-8";let l=document.createElement("div");l.innerHTML="Key";let d=document.createElement("th");d.id="td";let r=document.createElement("div");d.className="text grid__col grid__col--2-of-8",r.innerHTML="Value",o.appendChild(l),d.appendChild(r),s.appendChild(o),s.appendChild(d),this.status_application.appendChild(s),this.availKeys=document.getElementById("avail_keys"),this.deleteKeyButton=document.getElementById("del_key"),this.deleteKeyButton.onclick=this.deleteKey.bind(this,e),this.getStorageSize().then(t=>{t.success&&(n.innerHTML=t.namespaceSizes[e])}),t.keys.map(t=>{this.getKeyValue(e,t).then(e=>{i[t]=e.value;let n=document.createElement("tr");n.id="trLarge",n.className="label grid__col grid__col--8-of-8";let s=document.createElement("td");s.id="td",s.className="label grid__col grid__col--2-of-8";let o=document.createElement("div");o.innerHTML=t;let l=document.createElement("td");l.id="td",l.className="label grid__col grid__col--2-of-8";let d=document.createElement("div");d.innerHTML=e.value,s.appendChild(o),l.appendChild(d),n.appendChild(s),n.appendChild(l),this.status_application.appendChild(n),this.keyName=document.createElement("option"),this.keyName.text=t,this.keyName.value=t,this.availKeys.appendChild(this.keyName)})})}else this.status_application.className="grid__col grid__col--8-of-8",this.status_application.innerHTML="\n \n Key\n Value\n \n \n No data available\n \n \n "}})}};var le=class extends M{constructor(e,t){super(e,t),this.mainDiv=document.getElementById("main"),this.state=1,this.stateLookup={1:"On",2:"Active standby",3:"Passive standby",4:"Suspend to Ram",5:"Hibernate",6:"Power Off"}}state(){const e={plugin:this.callsign,method:"state"};return this.api.req(null,e)}render(){this.mainDiv.innerHTML='\n
      \n Current State\n
      \n
      \n -\n
      \n\n
      \n \n
      \n
      \n \n
      \n
      \n\n
      Change state
      \n
      \n \n
      ',this.powerStateDiv=document.getElementById("powerState"),this.stateSelectorEl=document.getElementById("stateSelector"),this.timeoutInput=document.getElementById("timeout"),this.stateSelectorEl.onchange=this.changeState.bind(this);var e=Object.keys(this.stateLookup);if(0===this.stateSelectorEl.children.length)for(var t=0;t{void 0!==e.PowerState&&(this.powerStateDiv.innerHTML=this.stateLookup[e.PowerState],this.stateSelectorEl.children[e.PowerState-1].selected=!0)})}changeState(e){const t={plugin:this.callsign,method:"set",params:{state:this.stateSelectorEl.value}};""!==this.timeoutInput.value?t.params.timeout=this.timeoutInput.value:t.params.timeout=10,this.api.req(null,t).then(()=>{e<2&&setTimeout(this.update,5e3)})}};var de=class extends M{constructor(e,t){super(e,t)}render(){document.getElementById("main").innerHTML='
      \n Provisioning status\n
      \n\n
      \n Device\n
      \n
      \n -\n
      \n
      \n Provisioned for\n
      \n
      \n -\n
      \n
      \n Status\n
      \n
      \n -\n
      \n\n
      \n Provisioning\n
      \n
      \n \n
      ',document.getElementById("provisionButton").onclick=this.tiggerProvisioningRequest.bind(this),this.update()}triggerProvisioning(){const e={plugin:this.callsign,method:"provision"};return this.api.req(null,e)}status(){const e={plugin:this.callsign,method:"state"};return this.api.req(null,e)}update(){this.status().then(e=>{if(null!=e&&""!==e){var t=e.id,i=e.tokens||[],n=e.status;document.getElementById("device").innerHTML=t,document.getElementById("status").innerHTML=200==n?"provisioned":"not provisioned",200==n&&i.length>0&&(document.getElementById("provisioning-tokens").innerHTML=i.join(", ")),document.getElementById("provisionLabel").style.display=200==n?"none":null}}).catch(e=>{console.error(e),this.status(e)})}tiggerProvisioningRequest(){var e=this;this.triggerProvisioning().then(t=>{document.getElementById("provisionButton").style.display="none",document.getElementById("provisionLabel").style.display="none",setTimeout(e.update(),3e3)})}};var re=class extends M{constructor(e,t){super(e,t),this.displayName="RDK Shell",this.length=0}render(){document.getElementById("main").innerHTML='\n
      \n RDK Shell\n
      \n
      \n Client App Details\n
      \n
      \n Update App Details\n
      \n
      \n \n
      \n
      \n Client Apps\n
      \n
      \n
      \n
      \n Client Apps in Z order\n
      \n
      \n
      \n
      \n Available Types\n
      \n
      \n
      \n
      \n Status of application types\n
      \n
      \n \n
      \n
      \n
      \n System Resource Info\n
      \n
      \n
      \n
      \n
      \n Move To Front / Back\n
      \n
      \n Client\n
      \n
      \n \n
      \n
      \n \n \n
      \n
      \n Move Behind\n
      \n
      \n Client\n
      \n
      \n \n
      \n
      \n Target\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Manage Client apps\n
      \n
      \n Client\n
      \n
      \n \n
      \n
      \n \n \n \n \n
      \n
      \n Visibility\n
      \n
      \n Client\n
      \n
      \n \n
      \n
      \n Visibility\n
      \n
      \n
      \n \n \n
      \n
      \n
      \n Opacity\n
      \n
      \n Client\n
      \n
      \n \n
      \n
      \n Opacity\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Scale\n
      \n
      \n Client\n
      \n
      \n \n
      \n
      \n sx\n
      \n
      \n \n
      \n
      \n sy\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Bounds\n
      \n
      \n Client\n
      \n
      \n \n
      \n
      \n x\n
      \n
      \n \n
      \n
      \n y\n
      \n
      \n \n
      \n
      \n w\n
      \n
      \n \n
      \n
      \n h\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Animation\n
      \n
      \n Client\n
      \n
      \n \n
      \n
      \n x\n
      \n
      \n \n
      \n
      \n y\n
      \n
      \n \n
      \n
      \n w\n
      \n
      \n \n
      \n
      \n h\n
      \n
      \n \n
      \n
      \n alpha\n
      \n
      \n \n
      \n
      \n sx\n
      \n
      \n \n
      \n
      \n sy\n
      \n
      \n \n
      \n
      \n duration\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Launch\n
      \n
      \n Callsign\n
      \n
      \n \n
      \n
      \n type\n
      \n
      \n \n
      \n
      \n x\n
      \n
      \n \n
      \n
      \n y\n
      \n
      \n \n
      \n
      \n w\n
      \n
      \n \n
      \n
      \n h\n
      \n
      \n \n
      \n
      \n version\n
      \n
      \n \n
      \n
      \n uri\n
      \n
      \n \n
      \n
      \n behind\n
      \n
      \n \n
      \n
      \n configuration\n
      \n
      \n \n
      \n
      \n display name\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Screen Resolution\n
      \n
      \n Width\n
      \n
      \n \n
      \n
      \n Height\n
      \n
      \n \n
      \n
      \n \n
      \n ',this.update_app=document.getElementById("update_app"),this.update_app.onclick=this.update.bind(this),this.client_apps=document.getElementById("client_apps"),this.client_apps_zorder=document.getElementById("client_apps_zorder"),this.available_types=document.getElementById("available_types"),this.status_application=document.getElementById("status_application"),this.system_resource=document.getElementById("system_resource"),this.client_moveFrontBack=document.getElementById("client_moveFrontBack"),this.set_moveToFront=document.getElementById("set_moveToFront"),this.set_moveToFront.onclick=this.doMoveToFront.bind(this),this.set_moveToBack=document.getElementById("set_moveToBack"),this.set_moveToBack.onclick=this.doMoveToBack.bind(this),this.client_moveBehind=document.getElementById("client_moveBehind"),this.client_moveBehind.onclick=this.doUpdateTarget.bind(this),this.target_moveBehind=document.getElementById("target_moveBehind"),this.set_moveBehind=document.getElementById("set_moveBehind"),this.set_moveBehind.onclick=this.doMoveBehind.bind(this),this.client_manage=document.getElementById("client_manage"),this.set_focus=document.getElementById("set_focus"),this.set_focus.onclick=this.doSetFocus.bind(this),this.set_suspend=document.getElementById("set_suspend"),this.set_suspend.onclick=this.doSetSuspend.bind(this),this.set_destroy=document.getElementById("set_destroy"),this.set_destroy.onclick=this.doSetDestroy.bind(this),this.set_kill=document.getElementById("set_kill"),this.set_kill.onclick=this.doKill.bind(this),this.width_resolution=document.getElementById("width_resolution"),this.height_resolution=document.getElementById("height_resolution"),this.width=document.getElementById("width"),this.height=document.getElementById("height"),this.set_resolution=document.getElementById("set_resolution"),this.set_resolution.onclick=this.doScreenResolution.bind(this),this.client_visible=document.getElementById("client_visible"),this.show_visibility=document.getElementById("show_visibility"),this.visible=document.getElementById("visible"),this.client_set_visible=document.getElementById("client_set_visible"),this.set_visible=document.getElementById("set_visible"),this.set_visible.onclick=this.doSetVisibility.bind(this),this.client_opacity=document.getElementById("client_opacity"),this.show_opacity=document.getElementById("show_opacity"),this.opacity=document.getElementById("opacity"),this.client_set_opacity=document.getElementById("client_set_opacity"),this.value_opacity=document.getElementById("value_opacity"),this.set_opacity=document.getElementById("set_opacity"),this.set_opacity.onclick=this.doSetOpacity.bind(this),this.client_bounds=document.getElementById("client_bounds"),this.show_bounds=document.getElementById("show_bounds"),this.x_bounds=document.getElementById("x_bounds"),this.y_bounds=document.getElementById("y_bounds"),this.w_bounds=document.getElementById("w_bounds"),this.h_bounds=document.getElementById("h_bounds"),this.set_client_bounds=document.getElementById("set_client_bounds"),this.set_x_bounds=document.getElementById("set_x_bounds"),this.set_y_bounds=document.getElementById("set_y_bounds"),this.set_w_bounds=document.getElementById("set_w_bounds"),this.set_h_bounds=document.getElementById("set_h_bounds"),this.set_bounds=document.getElementById("set_bounds"),this.set_bounds.onclick=this.doSetBounds.bind(this),this.client_scale=document.getElementById("client_scale"),this.show_scale=document.getElementById("show_scale"),this.sx_scale=document.getElementById("sx_scale"),this.sy_scale=document.getElementById("sy_scale"),this.set_client_scale=document.getElementById("set_client_scale"),this.set_sx_scale=document.getElementById("set_sx_scale"),this.set_sy_scale=document.getElementById("set_sy_scale"),this.set_scale=document.getElementById("set_scale"),this.set_scale.onclick=this.doSetScale.bind(this),this.client_animation=document.getElementById("client_animation"),this.x_animation=document.getElementById("x_animation"),this.y_animation=document.getElementById("y_animation"),this.w_animation=document.getElementById("w_animation"),this.h_animation=document.getElementById("h_animation"),this.sx_animation=document.getElementById("sx_animation"),this.sy_animation=document.getElementById("sy_animation"),this.alpha_animation=document.getElementById("alpha_animation"),this.duration_animation=document.getElementById("duration_animation"),this.set_animation=document.getElementById("set_animation"),this.set_animation.onclick=this.doAnimate.bind(this),this.callsign_launch=document.getElementById("callsign_launch"),this.type_launch=document.getElementById("type_launch"),this.x_launch=document.getElementById("x_launch"),this.y_launch=document.getElementById("y_launch"),this.w_launch=document.getElementById("w_launch"),this.h_launch=document.getElementById("h_launch"),this.version_launch=document.getElementById("version_launch"),this.uri_launch=document.getElementById("uri_launch"),this.behind_launch=document.getElementById("behind_launch"),this.configuration_launch=document.getElementById("configuration_launch"),this.displayName_launch=document.getElementById("displayName_launch"),this.set_launch=document.getElementById("set_launch"),this.set_launch.onclick=this.doLaunch.bind(this),this.update()}doMoveToFront(){if(this.client_moveFrontBack.value)try{this.moveToFront(this.client_moveFrontBack.value).then(e=>{e&&e.success?this.update():alert("Failed to move "+this.client_moveFrontBack.value)})}catch{alert("Error in getting response")}else alert("Please provide client app name")}doMoveToBack(){if(this.client_moveFrontBack.value)try{this.moveToBack(this.client_moveFrontBack.value).then(e=>{e&&e.success?this.update():alert("Failed to move "+this.client_moveFrontBack.value)})}catch{alert("Error in getting response")}else alert("Please provide client app name")}doMoveBehind(){if(this.client_moveBehind.value)if(this.client_moveBehind.value&&this.target_moveBehind.value)try{this.moveBehind(this.client_moveBehind.value,this.target_moveBehind.value).then(e=>{e&&e.success?(this.update(),this.doUpdateTarget()):alert("Failed to move "+this.client_moveBehind.value)})}catch{alert("Error in getting response")}else""==this.client_moveBehind.value&&""==this.target_moveBehind.value?alert("Please provide client and target app name"):""==this.client_moveBehind.value?alert("Please provide client app name"):""==this.target_moveBehind.value&&alert("Please provide target app name")}doSetFocus(){if(this.client_manage.value)try{this.setFocus(this.client_manage.value).then(e=>{null!=e&&e.success||alert("Failed to set focus to "+this.client_manage.value)})}catch{alert("Error in getting response")}else alert("Please provide client app name")}doSetSuspend(){if(this.client_manage.value)try{this.suspend(this.client_manage.value).then(e=>{e&&e.success?this.update():alert("Failed to suspend "+this.client_manage.value)})}catch{alert("Error in getting response")}else alert("Please provide client app name")}doSetDestroy(){if(this.client_manage.value)try{this.destroy(this.client_manage.value).then(e=>{e&&e.success?this.update():alert("Failed to destroy "+this.client_manage.value)})}catch{alert("Error in getting response")}else alert("Please provide client app name")}doKill(){if(this.client_manage.value)try{this.kill(this.client_manage.value).then(e=>{e&&e.success?this.update():alert("Failed to kill "+this.client_manage.value)})}catch{alert("Error in getting response")}else alert("Please provide client app name")}doScreenResolution(){if(this.width.value&&this.height.value)try{this.setScreenResolution(parseInt(this.width.value),parseInt(this.height.value)).then(e=>{e&&e.success?this.getScreenResolution().then(e=>{this.width.value=e.w,this.height.value=e.h}):alert("Failed to set resolution")})}catch{alert("Error in getting response")}else""==this.width.value&&""==this.height.value?alert("Please provide width and height"):""==this.width.value?alert("Please provide width"):""==this.height.value&&alert("Please provide height")}doGetVisibility(){if(this.client_set_visible.value)try{this.getVisibility(this.client_set_visible.value).then(e=>{e&&e.success&&(this.set_visible.checked=e.visible)})}catch{alert("Error in getting response for visibility")}else alert("Please provide client name")}doSetVisibility(){if(this.client_set_visible.value){this.set_visible.checked?this.client_visibility=!0:this.client_visibility=!1;try{this.setVisibility(this.client_set_visible.value,this.client_visibility).then(e=>{e&&e.success?this.client_set_visible.value&&this.getVisibility(this.client_set_visible.value).then(e=>{e&&e.success&&(this.set_visible.checked=e.visible)}):(alert("Failed to set visibility to "+this.client_set_visible.value),this.set_visible.checked?this.set_visible.checked=!1:this.set_visible.checked=!0)})}catch{alert("Error in getting response")}}else""==this.client_set_visible.value&&(this.set_visible.checked?this.set_visible.checked=!1:this.set_visible.checked=!0,alert("Please provide client name"))}doGetOpacity(){if(this.client_set_opacity.value)try{this.getOpacity(this.client_set_opacity.value).then(e=>{e&&e.success?this.value_opacity.value=e.opacity:(alert(e.message),this.value_opacity.value="")})}catch{alert("Error in getting response")}else alert("Please provide client name")}doSetOpacity(){if(this.client_set_opacity.value&&this.value_opacity.value)try{this.setOpacity(this.client_set_opacity.value,parseInt(this.value_opacity.value)).then(e=>{e&&e.success?this.client_set_opacity.value&&this.getOpacity(this.client_set_opacity.value).then(e=>{e&&e.success&&(this.value_opacity.value=e.opacity)}):alert("Failed to set opacity to "+this.client_set_opacity.value)})}catch{alert("Error in getting response")}else""==this.client_set_opacity.value&&""==this.value_opacity.value?alert("Please provide client name and opacity value"):""==this.client_set_opacity.value?alert("Please provide client name"):""==this.value_opacity.value&&alert("Please provide opacity value")}doGetBounds(){if(this.set_client_bounds.value)try{this.getBounds(this.set_client_bounds.value).then(e=>{e&&e.success?(this.set_x_bounds.value=e.bounds.x,this.set_y_bounds.value=e.bounds.y,this.set_w_bounds.value=e.bounds.w,this.set_h_bounds.value=e.bounds.h):(this.set_x_bounds.value="-",this.set_y_bounds.value="-",this.set_w_bounds.value="-",this.set_h_bounds.value="-")})}catch{alert("Error in getting response")}else alert("Please provide client name")}doSetBounds(){if(this.set_client_bounds.value&&this.set_x_bounds.value&&this.set_y_bounds.value&&this.set_w_bounds.value&&this.set_h_bounds.value)try{this.setBounds(this.set_client_bounds.value,parseInt(this.set_x_bounds.value),parseInt(this.set_y_bounds.value),parseInt(this.set_w_bounds.value),parseInt(this.set_h_bounds.value)).then(e=>{null!=e&&e.success||alert("Failed to set bounds to "+this.set_client_bounds.value)})}catch{alert("Error in getting response")}else alert("Please provide all the parameters to set bounds")}doGetScale(){if(this.set_client_scale.value)try{this.getScale(this.set_client_scale.value).then(e=>{e&&e.success?(this.set_sx_scale.value=e.sx,this.set_sy_scale.value=e.sy):(this.set_sx_scale.value="-",this.set_sy_scale.value="-",alert(e.message))})}catch{alert("Error in getting response")}else alert("Please provide client name")}doSetScale(){if(this.set_client_scale.value&&this.set_sx_scale.value&&this.set_sy_scale.value)try{this.setScale(this.set_client_scale.value,this.set_sx_scale.value,this.set_sy_scale.value).then(e=>{this.set_client_scale.value&&this.getScale(this.set_client_scale.value).then(e=>{e&&e.success}),null!=e&&e.success||alert("Failed to scale client app"+this.set_client_scale.value)})}catch{alert("Error")}else alert("Please provide all the parameters to scale")}doAnimate(){for(var e={client:this.client_animation.value,x:parseInt(this.x_animation.value),y:parseInt(this.y_animation.value),w:parseInt(this.w_animation.value),h:parseInt(this.h_animation.value),sx:parseInt(this.sx_animation.value),sy:parseInt(this.sy_animation.value),a:parseInt(this.alpha_animation.value),duration:this.duration_animation.value},t=["client","x","y","w","h","sx","sy","a","duration"],i=[this.client_animation.value,this.x_animation.value,this.y_animation.value,this.w_animation.value,this.h_animation.value,this.sx_animation.value,this.sy_animation.value,this.alpha_animation.value,this.duration_animation.value],n=0;n{e&&e.success?(this.startLoading(),setTimeout(this.stopLoading,1e3*this.duration_animation.value)):alert("Failed to animate "+this.client_animation.value)})}catch{alert("Error in animating "+this.client_animation.value)}else""===this.duration_animation.value?alert("Please provide duration of animation"):alert("No client is available for animating")}startLoading(){this.loadingEl=document.getElementById("disconnected");this.loadingEl.style.display="block",this.loadingEl.innerHTML='
      \n
      Animation InProgress
      \n
      '}stopLoading(){document.getElementById("disconnected").innerHTML="",document.getElementById("disconnected").style.display="none",alert("Completed Animation")}doLaunch(){for(var e={callsign:this.callsign_launch.value,type:this.type_launch.value,x:parseInt(this.x_launch.value),y:parseInt(this.y_launch.value),w:parseInt(this.w_launch.value),h:parseInt(this.h_launch.value),version:parseInt(this.version_launch.value),uri:this.uri_launch.value,behind:this.behind_launch.value,configuration:this.configuration_launch.value,displayName:this.displayName_launch.value},t=["callsign","type","x","y","w","h","version","uri","behind","configuration","displayName"],i=[this.callsign_launch.value,this.type_launch.value,this.x_launch.value,this.y_launch.value,this.w_launch.value,this.h_launch.value,this.version_launch.value,this.uri_launch.value,this.behind_launch.value,this.configuration_launch.value,this.displayName_launch.value],n=0;n{null!=e&&e.success||alert("Failed to launch "+this.callsign_launch.value)})}catch{alert("Error in getting response")}else alert("Please provide parameters for launching app")}doUpdateTarget(){for(var e=this.length-1;e>=0;e--)this.target_moveBehind.options[e]=null;try{this.getClients().then(e=>{this.length=e.clients.length;for(var t=0;t=0;e--)this.client_moveFrontBack.options[e]=null,this.client_moveBehind.options[e]=null,this.target_moveBehind.options[e]=null,this.client_set_visible.options[e]=null,this.client_set_opacity.options[e]=null,this.set_client_bounds.options[e]=null,this.set_client_scale.options[e]=null,this.client_animation.options[e]=null,this.client_manage.options[e]=null;try{this.getClients().then(e=>{if(e.clients){this.client_apps.innerHTML=e.clients,this.length=e.clients.length,this.clientArray=e;for(var t=0;t0&&(this.target_list_movebehind=document.createElement("option"),this.target_list_movebehind.text=e.clients[t],this.target_list_movebehind.value=e.clients[t],this.target_moveBehind.appendChild(this.target_list_movebehind)),this.client_list_visible=document.createElement("option"),this.client_list_visible.text=e.clients[t],this.client_list_visible.value=e.clients[t],this.client_set_visible.appendChild(this.client_list_visible),this.client_list_opacity=document.createElement("option"),this.client_list_opacity.text=e.clients[t],this.client_list_opacity.value=e.clients[t],this.client_set_opacity.appendChild(this.client_list_opacity),this.client_list_bounds=document.createElement("option"),this.client_list_bounds.text=e.clients[t],this.client_list_bounds.value=e.clients[t],this.set_client_bounds.appendChild(this.client_list_bounds),this.client_list_scale=document.createElement("option"),this.client_list_scale.text=e.clients[t],this.client_list_scale.value=e.clients[t],this.set_client_scale.appendChild(this.client_list_scale),this.client_list_animation=document.createElement("option"),this.client_list_animation.text=e.clients[t],this.client_list_animation.value=e.clients[t],this.client_animation.appendChild(this.client_list_animation),this.client_list_manage=document.createElement("option"),this.client_list_manage.text=e.clients[t],this.client_list_manage.value=e.clients[t],this.client_manage.appendChild(this.client_list_manage);0!=this.length?(this.doGetOpacity(),this.doGetBounds(),this.doGetScale(),this.doGetVisibility()):(this.value_opacity.value="",this.set_x_bounds.value="",this.set_y_bounds.value="",this.set_w_bounds.value="",this.set_h_bounds.value="",this.set_sx_scale.value="",this.set_sy_scale.value="",this.set_visible.checked=!1)}})}catch{alert("Error in getting response")}try{this.getZOrder().then(e=>{e.clients&&(this.client_apps_zorder.innerHTML=e.clients)})}catch{alert("Error in getting zorder of client apps")}try{this.getScreenResolution().then(e=>{this.width.value=e.w,this.height.value=e.h})}catch{alert("Error in getting resolution")}try{this.getAvailableTypes().then(e=>{null!=e&&e.types?this.available_types.innerHTML=e.types:this.available_types.innerHTML="No data available"})}catch{alert("Error in getting available types")}try{this.getState().then(e=>{if(null!=e&&e.runtimes){this.status_application.innerHTML="",this.tr1=document.createElement("tr"),this.tr1.id="trLarge",this.tr1.className="text grid__col grid__col--8-of-8",this.td1=document.createElement("th"),this.td1.id="td",this.td1.className="text grid__col grid__col--2-of-8",this.td1div=document.createElement("div"),this.td1div.innerHTML="Callsign",this.td2=document.createElement("th"),this.td2.id="td",this.td2div=document.createElement("div"),this.td2.className="text grid__col grid__col--2-of-8",this.td2div.innerHTML="State",this.td3=document.createElement("th"),this.td3.id="td",this.td3div=document.createElement("div"),this.td3.className="text grid__col grid__col--2-of-8",this.td3div.innerHTML="URI",this.td1.appendChild(this.td1div),this.td2.appendChild(this.td2div),this.td3.appendChild(this.td3div),this.tr1.appendChild(this.td1),this.tr1.appendChild(this.td2),this.tr1.appendChild(this.td3),this.status_application.appendChild(this.tr1);for(var t=0;tNo data available\n \n "})}catch{alert("Error in getting state of apps")}try{this.getSystemResourceInfo().then(e=>{if(this.system_resource.innerHTML="",null!=e&&e.runtimes){this.system_resource.innerHTML="",this.tr2=document.createElement("tr"),this.tr2.id="trLarge",this.tr2.className="text grid__col grid__col--8-of-8",this.td4=document.createElement("th"),this.td4.id="td",this.td4.className="text grid__col grid__col--2-of-8",this.td4div=document.createElement("div"),this.td4div.innerHTML="Callsign",this.td5=document.createElement("th"),this.td5.id="td",this.td5div=document.createElement("div"),this.td5.className="text grid__col grid__col--2-of-8",this.td5div.innerHTML="RAM",this.td6=document.createElement("th"),this.td6.id="td",this.td6div=document.createElement("div"),this.td6.className="text grid__col grid__col--2-of-8",this.td6div.innerHTML="VRAM",this.td4.appendChild(this.td4div),this.td5.appendChild(this.td5div),this.td6.appendChild(this.td6div),this.tr2.appendChild(this.td4),this.tr2.appendChild(this.td5),this.tr2.appendChild(this.td6),this.system_resource.appendChild(this.tr2);for(var t=0;tNo data available\n \n "})}catch{alert("Error in getting system resource information")}}close(){}};var ae=class extends M{constructor(e,t){super(e,t),this.displayName="Remote Control",this.onScreenKeyBoardIsRendered=!1,this.doNotHandleKeys=!1,this.devicesThatSupportPairing=["GreenPeakRF4CE","GreenPeak","RF4CE"],this.autoFwdKeys=window.localStorage.getItem("autoFwdKeys"),this.automaticallyForwardKeys="false"!==this.autoFwdKeys,this.keyMapping={1:{code:"0x0021",color:void 0,string:"1"},2:{code:"0x0022",color:void 0,string:"2"},3:{code:"0x0023",color:void 0,string:"3"},4:{code:"0x0024",color:void 0,string:"4"},5:{code:"0x0025",color:void 0,string:"5"},6:{code:"0x0026",color:void 0,string:"6"},7:{code:"0x0027",color:void 0,string:"7"},8:{code:"0x0028",color:void 0,string:"8"},9:{code:"0x0029",color:void 0,string:"9"},0:{code:"0x0020",color:void 0,string:"0"},exit:{code:"0x0009",color:"blue",string:"exit"},a:{code:"0x8004",color:void 0,string:"a"},b:{code:"0x8005",color:void 0,string:"b"},c:{code:"0x8006",color:void 0,string:"c"},d:{code:"0x8007",color:void 0,string:"d"},e:{code:"0x8008",color:void 0,string:"e"},f:{code:"0x8009",color:void 0,string:"f"},g:{code:"0x800A",color:void 0,string:"g"},h:{code:"0x800B",color:void 0,string:"h"},i:{code:"0x800C",color:void 0,string:"i"},back:{code:"0x0032",color:"blue double",string:"back"},j:{code:"0x800D",color:void 0,string:"j"},k:{code:"0x800E",color:void 0,string:"k"},l:{code:"0x800F",color:void 0,string:"l"},m:{code:"0x8010",color:void 0,string:"m"},n:{code:"0x8011",color:void 0,string:"n"},o:{code:"0x8012",color:void 0,string:"o"},p:{code:"0x8013",color:void 0,string:"p"},q:{code:"0x8014",color:void 0,string:"q"},r:{code:"0x8015",color:void 0,string:"r"},up:{code:"0x0001",color:"blue",string:"up",div:'
      '},ok:{code:"0x002B",color:"blue",string:"ok"},s:{code:"0x8016",color:void 0,string:"s"},t:{code:"0x8017",color:void 0,string:"t"},u:{code:"0x8018",color:void 0,string:"u"},v:{code:"0x8019",color:void 0,string:"v"},w:{code:"0x801A",color:void 0,string:"w"},x:{code:"0x801B",color:void 0,string:"x"},y:{code:"0x801C",color:void 0,string:"y"},z:{code:"0x801D",color:void 0,string:"z"},left:{code:"0x0003",color:"blue",string:"left",div:'
      '},down:{code:"0x0002",color:"blue",string:"down",div:'
      '},right:{code:"0x0004",color:"blue",string:"right",div:'
      '}},this.jsToWpeKeyMap={13:{code:"0x002B",string:"enter"},37:{code:"0x0003",string:"left"},38:{code:"0x0001",string:"up"},39:{code:"0x0004",string:"right"},40:{code:"0x0002",string:"down"},27:{code:"0x0009",string:"esc"},8:{code:"0x0032",string:"backspace"},48:{code:"0x0020",string:"0"},49:{code:"0x0021",string:"1"},50:{code:"0x0022",string:"2"},51:{code:"0x0023",string:"3"},52:{code:"0x0024",string:"4"},53:{code:"0x0025",string:"5"},54:{code:"0x0026",string:"6"},55:{code:"0x0027",string:"7"},56:{code:"0x0028",string:"8"},57:{code:"0x0029",string:"9"},33:{code:"0x0030",string:"page up"},34:{code:"0x0031",string:"page down"},65:{code:"0x8004",string:"a"},66:{code:"0x8005",string:"b"},67:{code:"0x8006",string:"c"},68:{code:"0x8007",string:"d"},69:{code:"0x8008",string:"e"},70:{code:"0x8009",string:"f"},71:{code:"0x800A",string:"g"},72:{code:"0x800B",string:"h"},73:{code:"0x800C",string:"i"},74:{code:"0x800D",string:"j"},75:{code:"0x800E",string:"k"},76:{code:"0x800F",string:"l"},77:{code:"0x8010",string:"m"},78:{code:"0x8011",string:"n"},79:{code:"0x8012",string:"o"},80:{code:"0x8013",string:"p"},81:{code:"0x8014",string:"q"},82:{code:"0x8015",string:"r"},83:{code:"0x8016",string:"s"},84:{code:"0x8017",string:"t"},85:{code:"0x8018",string:"u"},86:{code:"0x8019",string:"v"},87:{code:"0x801A",string:"w"},88:{code:"0x801B",string:"x"},89:{code:"0x801C",string:"y"},90:{code:"0x801D",string:"z"},46:{code:"0x802A",string:"delete"},32:{code:"0x802C",string:"space"},189:{code:"0x802D",string:"-"},187:{code:"0x802E",string:"="},220:{code:"0x8031",string:"\\"},186:{code:"0x8033",string:";"},222:{code:"0x8034",string:"`"},188:{code:"0x8036",string:","},190:{code:"0x8037",string:"."},191:{code:"0x8038",string:"/"}},this.addKeyboardButton(),this.keyboardDiv=document.getElementById("keyboard"),this.keyBoardInnerDiv=document.createElement("div"),this.keyBoardInnerDiv.id="keyboard-inner";for(var i=Object.keys(this.keyMapping),n=0;n{if(void 0!==t)for(var i=void 0!==t.devices?t.devices:t,n=document.getElementById("remotesList"),s=document.getElementById("pairingDiv"),o=0;o\n Pairing\n
      '),s.innerHTML+=`
      ${l}
      \n
      \n \n
      `,document.getElementById(l+"-PairingMode").onclick=e.activatePairing.bind(e,l)}})}toggleAutoforwardOfKeys(){this.automaticallyForwardKeys=!0!==this.automaticallyForwardKeys,window.localStorage.setItem("autoFwdKeys",this.automaticallyForwardKeys)}};var ce=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="ScreenCapture",this.mainDiv=document.getElementById("main"),this.template='\n
      Screen Capture
      \n
      Take screenshot and upload
      \n
      Upload URL
      \n
      \n \n
      \n
      Screenshot Identifier(optional)
      \n
      \n \n
      \n
      \n \n
      \n '}uploadScreenshot(e,t){const i={plugin:this.callsign,method:"uploadScreenCapture",params:{url:e,callGUID:t}};return this.api.req(null,i)}render(){this.mainDiv.innerHTML=this.template,this.url=document.getElementById("url"),this.callGUID=document.getElementById("callGUID"),this.uploadButton=document.getElementById("upload"),this.uploadButton.onclick=this.upload.bind(this),this.onUploadComplete=this.api.t.on(this.callsign,"uploadComplete",e=>{e.status?alert("Upload completed"):alert("Upload failed!\n"+e.message+"\nScreenshot identifier:"+e.call_guid)})}upload(){console.log("uploading");var e=this.url.value,t=this.callGUID.value;console.log(e),console.log(t),this.uploadScreenshot(e,t).then(e=>{e?e.success||alert(e.message):alert("Screen caputer not successful")})}close(){this.rendered=!1,this.onUploadComplete&&"function"==typeof this.onUploadComplete.dispose&&(this.onUploadComplete.dispose(),this.onUploadComplete=null)}};var ue=class extends M{constructor(e,t){super(e,t)}render(){document.getElementById("main").innerHTML='
      \n Create\n
      \n\n
      \n Snapshot\n
      \n
      \n \n
      \n\n
      \n \n
      ',document.getElementById("snapshotButton").onclick=this.createSnapshot.bind(this)}getSnapshotLocator(){return this.api.getURLStart("http")+"Snapshot/Capture?"+(new Date).getTime()}createSnapshot(){var e=document.getElementById("snapshotOutput");e.src="",e.src=this.getSnapshotLocator()}};var he=class extends M{constructor(e,t){super(e,t),this.url="",this.isHidden=!1,this.isSuspended=!1,this.lastSetUrlKey="lastSetUrl"+this.callsign,this.lastSetUrl=window.localStorage.getItem(this.lastSetUrlKey)||"",this.template='
      \n\n
      Presets / URL
      \n\n
      \n \n
      \n
      \n \n \n
      \n\n
      URL presets
      \n
      \n \n
      \n\n
      Tools
      \n\n
      Current State
      \n
      \n
      \n
      \n \n
      \n\n
      Visibility
      \n
      \n
      \n
      \n \n
      \n
      ',this.presets=[{Name:"Select a preset",URL:""},{Name:"http://www.sparkui.org/examples/gallery/picturepile.js",URL:"http://www.sparkui.org/examples/gallery/picturepile.js"},{Name:"http://www.sparkui.org/examples/gallery/gallery.js",URL:"http://www.sparkui.org/examples/gallery/gallery.js"}],this.sparkUrlListener=this.api.t.on("Spark","urlchange",e=>{e.url&&e.loaded&&(this.url=e.url,this.handleNotification())}),this.sparkVisibilityListener=this.api.t.on("Spark","visibilitychange",e=>{"boolean"==typeof e.hidden&&(this.isHidden=e.hidden,this.handleNotification())}),this.sparkStateListener=this.api.t.on("Spark","statechange",e=>{"boolean"==typeof e.suspended&&(this.isSuspended=e.suspended,this.handleNotification())})}handleNotification(e){!1!==this.rendered&&this.update()}render(){var e=document.getElementById("main"),t=this.template.replace(/{{callsign}}/g,this.callsign);e.innerHTML=t,document.getElementById(this.callsign+"_url").value=this.lastSetUrl,document.getElementById(this.callsign+"_button").onclick=this.getAndSetUrl.bind(this),document.getElementById(this.callsign+"_linkPresets").onchange=this.getAndSetUrlFromPresets.bind(this);var i=document.getElementById(this.callsign+"_linkPresets");if(0===i.children.length)for(var n=0;n0&&this.setUrl(this.presets[e].URL)}handleKey(e){var t=document.getElementById(this.callsign+"_url");13===e.which&&t&&t===document.activeElement&&this.getAndSetUrl()}toggleSuspend(e){"Resume"===e?this.resume():this.suspend()}toggleVisibility(e){"Show"===e?this.show():this.hide()}};var _e=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.switchablePlugins=[],this.switches().then(e=>{this.switchablePlugins=e}),this.defaultPlugin=void 0,this.default().then(e=>{this.defaultPlugin=e})}switches(){return this.api.req(null,{plugin:"SwitchBoard",method:"switches"})}default(){return this.api.req(null,{plugin:"SwitchBoard",method:"default"})}getDefaultSwitchBoardPlugin(){return this.defaultPlugin}getSwitchablePlugins(){return this.switchablePlugins}render(){this.mainDiv=document.getElementById("main"),this.mainDiv.innerHTML='\n
      \n Plugins\n
      \n
      ';var e=document.getElementById("switchBoardPlugins");this.api.getControllerPlugins().then(t=>{for(var i=t,n=0;n{this.render()})}};var ge=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="System Services",this.mainDiv=document.getElementById("main"),this.updateStateList={0:"Uninitialized",1:"Requesting",2:"Downloading",3:"Failed",4:"Download Completed",5:"Validation completed",6:"Preparing to reboot"}}render(){this.template='\n
      Device Information
      \n
      Build Type
      \n
      -
      \n
      ESTB MAC
      \n
      -
      \n
      Model Number
      \n
      -
      \n
      Image Version
      \n
      -
      \n
      Receiver Version
      \n
      -
      \n
      Serial Number
      \n
      -
      \n
      Time Zone
      \n
      -
      \n
      Firmware Update
      \n
      Update Available
      \n
      No
      \n
      Update Version
      \n
      -
      \n
      Update State
      \n
      -
      \n
      Standby Mode
      \n
      Current Standby mode
      \n
      -
      \n
      Set Standby mode
      \n
      \n \n \n
      \n
      Power State
      \n
      Last Deep Sleep Reason
      \n
      -
      \n
      Current Power State
      \n
      -
      \n
      Set Power State
      \n
      \n \n \n
      \n
      Mode
      \n
      Current Mode
      \n
      -
      \n
      Set mode
      \n
      Mode
      \n
      \n \n
      \n
      \n
      Duration(in seconds)
      \n
      \n \n
      \n\n
      \n \n
      \n
      Status
      \n
      System Uptime(HH:MM:SS)
      \n
      -
      \n
      MoCa
      \n
      \n \n \n
      \n
      -
      \n
      GZ enabled
      \n
      \n \n \n
      \n
      -
      \n
      Store in cache
      \n
      Key
      \n
      \n \n
      \n
      \n
      Value
      \n
      \n \n
      \n
      \n
      \n \n
      \n
      Get/Remove cache value
      \n
      Key
      \n
      \n \n \n \n
      \n
      \n
      Value
      \n
      -
      \n
      Previous Reboot Info
      \n
      Source
      \n
      -
      \n
      Reboot Reason
      \n
      -
      \n
      Custom Reason
      \n
      -
      \n
      Last Hard Power Reset
      \n
      -
      \n
      Temperature
      \n
      Core Temperature
      \n
      -
      \n
      Warning Temperature
      \n
      -
      \n
      Maximum Temperature
      \n
      -
      \n
      RFC Configuration
      \n
      Account ID
      \n
      -
      \n
      UPNP Enabled
      \n
      -
      \n
      Allow open ports
      \n
      -
      \n
      Total Memory
      \n
      -
      \n
      Free Memory
      \n
      -
      \n
      State Info
      \n
      Property name
      \n
      \n \n \n
      \n
      \n
      Property Value
      \n
      -
      \n ',this.mainDiv.innerHTML=this.template,this.buildType=document.getElementById("build_type"),this.estbMac=document.getElementById("estb_mac"),this.imgVersion=document.getElementById("img_version"),this.modelNumber=document.getElementById("model_number"),this.rxVersion=document.getElementById("rx_version"),this.serialNumber=document.getElementById("serial_number"),this.timeZone=document.getElementById("time_zone"),this.updateAvailable=document.getElementById("update_available"),this.updateVersion=document.getElementById("update_version"),this.updateState=document.getElementById("update_state"),this.standbyMode=document.getElementById("standby_mode"),this.moca=document.getElementById("moca"),this.mocaStatus=document.getElementById("moca_status"),this.gz=document.getElementById("gz"),this.gzStatus=document.getElementById("gz_status"),this.setKey=document.getElementById("set_key"),this.setValue=document.getElementById("set_value"),this.getKey=document.getElementById("get_key"),this.getValue=document.getElementById("get_value"),this.setCacheButton=document.getElementById("set_cache"),this.removeCacheButton=document.getElementById("remove_cache"),this.deepSleep=document.getElementById("deep_sleep"),this.setStandbyButton=document.getElementById("set_standby"),this.upTime=document.getElementById("up_time"),this.availModes=document.getElementById("avail_modes"),this.powerStates=document.getElementById("power_states"),this.setPowerButton=document.getElementById("set_power"),this.powerMode=document.getElementById("power_mode"),this.mode=document.getElementById("mode"),this.setModeButton=document.getElementById("set_mode"),this.modeList=document.getElementById("mode_list"),this.modeDuration=document.getElementById("mode_dur"),this.getCacheButton=document.getElementById("get_cache"),this.rebootSrc=document.getElementById("src"),this.rebootReason=document.getElementById("reboot_reason"),this.custReason=document.getElementById("cust_reason"),this.hardReset=document.getElementById("hard_reset"),this.coreTemp=document.getElementById("core_temp"),this.warnTemp=document.getElementById("warn_temp"),this.maxTemp=document.getElementById("max_temp"),this.accountID=document.getElementById("account_ID"),this.upnp=document.getElementById("upnp"),this.allowPorts=document.getElementById("open_port"),this.totalMemory=document.getElementById("total_memory"),this.freeMemory=document.getElementById("free_memory"),this.propertyValue=document.getElementById("property_value"),this.propertyName=document.getElementById("property_name"),this.getPropertyButton=document.getElementById("get_property"),this.update(),this.getSystemVersion(),this.moca.onclick=this.mocaMask.bind(this),this.gz.onclick=this.gzMask.bind(this),this.setCacheButton.onclick=this.setCacheKey.bind(this),this.setStandbyButton.onclick=this.setStandby.bind(this),this.setPowerButton.onclick=this.setPowerState.bind(this),this.setModeButton.onclick=this.setMode.bind(this),this.getCacheButton.onclick=this.getCacheValue.bind(this),this.removeCacheButton.onclick=this.removeCache.bind(this),this.getPropertyButton.onclick=this.getPropertyValue.bind(this),this.propertyName.onchange=()=>{this.propertyValue.innerHTML="-"},this.updateTimer=setInterval(()=>{this.getUpTime()},1e3),this.getAvailStandbyModes(),this.getPowerState(),this.systemModeChanged=this.api.t.on(this.callsign,"onSystemModeChanged",()=>{this.getMode()}),this.systemPowerChanged=this.api.t.on(this.callsign,"onSystemPowerStateChanged",()=>{this.getPowerState()}),this.onFirmwareUpdateInfo=this.api.t.on(this.callsign," onFirmwareUpdateInfoReceived",e=>{1==e.updateAvailable?this.updateAvailable.innerHTML="YES":this.updateAvailable.innerHTML="NO",this.updateVersion.innerHTML=e.firmwareUpdateVersion}),this.onUpdateState=this.api.t.on(this.callsign,"onFirmwareUpdateStateChange",e=>{this.updateState.innerHTML=this.updateStateList[e.firmwareUpdateStateChange]})}update(){this.getXConf(),this.getMoca(),this.getStandbyMode(),this.getPowerState(),this.getGZ(),this.getMode(),this.prevRebootInfo(),this.getTempInfo(),this.getSerialNmmber(),this.getTimeZone(),this.getRFCConfig(),this.getDeepSleepReason(),this.getFirmwareUpdateInfo(),this.getFirmwareUpdateState()}getXConf(){const e={plugin:this.callsign,method:"getXconfParams"};return this.api.req(null,e).then(e=>{e.success&&(this.buildType.innerHTML=e.xconfParams.env,this.estbMac.innerHTML=e.xconfParams.eStbMac,this.imgVersion.innerHTML=e.xconfParams.firmwareVersion,this.modelNumber.innerHTML=e.xconfParams.model)})}getSystemVersion(){const e={plugin:this.callsign,method:"getSystemVersions"};return this.api.req(null,e).then(e=>{e.success&&(this.rxVersion.innerHTML=e.receiverVersion)})}getMoca(){const e={plugin:this.callsign,method:"queryMocaStatus"};return this.api.req(null,e).then(e=>{e.success&&(e.mocaEnabled?(this.moca.checked=!0,this.mocaStatus.innerHTML="Enabled"):(this.moca.checked=!1,this.mocaStatus.innerHTML="Disabled"))})}setMoca(e){const t={plugin:this.callsign,method:"enableMoca",params:{value:e}};return this.api.req(null,t).then(e=>{e.success||alert("Action failed"),this.getMoca()})}getGZ(){const e={plugin:this.callsign,method:"isGzEnabled"};return this.api.req(null,e).then(e=>{e.success&&(e.enabled?(this.gz.checked=!0,this.gzStatus.innerHTML="Enabled"):(this.gz.checked=!1,this.gzStatus.innerHTML="Disabled"))})}setGZ(e){const t={plugin:this.callsign,method:"setGzEnabled",params:{enabled:e}};return this.api.req(null,t).then(e=>{e.success||alert("Action failed"),this.getGZ()})}setCache(){const e={plugin:this.callsign,method:"",params:{value:bool}};return this.api.req(null,e).then(e=>{e.success||alert("Action failed"),this.getMoca()})}getStandbyMode(){const e={plugin:this.callsign,method:"getPreferredStandbyMode"};return this.api.req(null,e).then(e=>{e.success&&(this.standbyMode.innerHTML=e.preferredStandbyMode)})}getAvailStandbyModes(){const e={plugin:this.callsign,method:"getAvailableStandbyModes"};return this.api.req(null,e).then(e=>{e.supportedStandbyModes&&e.supportedStandbyModes.length>0&&e.supportedStandbyModes.forEach(e=>{this.availModes.appendChild(document.createElement("option")).innerHTML=e})})}setStandby(){const e={plugin:this.callsign,method:"setPreferredStandbyMode",params:{standbyMode:this.availModes.value}};return this.api.req(null,e).then(e=>{this.getStandbyMode()})}getPowerState(){const e={plugin:this.callsign,method:"getPowerState"};return this.api.req(null,e).then(e=>{e.success&&(this.powerMode.innerHTML=e.powerState)})}setPowerState(){const e={plugin:this.callsign,method:"setPowerState",params:{powerState:this.powerStates.value,standbyReason:"APIUnitTest"}};return this.api.req(null,e)}getMode(){const e={plugin:this.callsign,method:"getMode"};return this.api.req(null,e).then(e=>{e.success&&(this.mode.innerHTML=e.modeInfo.mode)})}setMode(){const e={plugin:this.callsign,method:"setMode",params:{modeInfo:{mode:this.modeList.value,duration:parseInt(this.modeDuration.value)}}};return this.api.req(null,e)}getUpTime(){const e={plugin:this.callsign,method:"requestSystemUptime"};return this.api.req(null,e).then(e=>{e.success&&(this.upTime.innerHTML=new Date(1e3*e.systemUptime).toISOString().substr(11,8))})}mocaMask(){this.moca.checked?this.setMoca(!0):this.moca.checked||this.setMoca(!1)}gzMask(){this.gz.checked?this.setGZ(!0):this.gz.checked||this.setGZ(!1)}setCacheKey(){const e={plugin:this.callsign,method:"setCachedValue",params:{key:this.setKey.value,value:this.setValue.value}};return this.api.req(null,e).then(e=>{e.success?this.upTime.innerHTML=e.systemUptime+"seconds":alert("Failed to store")})}getCacheValue(){window.clearTimeout(this.timeOut);const e={plugin:this.callsign,method:"getCachedValue",params:{key:this.getKey.value}};return this.api.req(null,e).then(e=>{e.success?this.getValue.innerHTML=null==e[this.getKey.value]?"Value not found":e[this.getKey.value]:this.getValue.innerHTML="Value not found",this.timeOut=setTimeout(()=>{this.getValue.innerHTML="-",this.getKey.value=""},5e3)})}removeCache(){const e={plugin:this.callsign,method:"removeCacheKey",params:{key:this.getKey.value}};return this.api.req(null,e).then(e=>{e.success?alert("Successfully removed"):alert("Cannot remove the key-value pair")})}prevRebootInfo(){const e={plugin:this.callsign,method:"getPreviousRebootInfo2"};return this.api.req(null,e).then(e=>{e.success&&(this.rebootSrc.innerHTML=e.rebootInfo.source,this.rebootReason.innerHTML=e.rebootInfo.reason,this.custReason.innerHTML=e.rebootInfo.customReason,this.hardReset.innerHTML=e.rebootInfo.lastHardPowerReset)})}getTempInfo(){const e={plugin:this.callsign,method:"getTemperatureThresholds"};return this.api.req(null,e).then(e=>{e.success&&(this.coreTemp.innerHTML=e.temperatureThresholds.temperature,this.warnTemp.innerHTML=e.temperatureThresholds.WARN,this.maxTemp.innerHTML=e.temperatureThresholds.MAX)})}getSerialNmmber(){const e={plugin:this.callsign,method:"getSerialNumber"};return this.api.req(null,e).then(e=>{e.success&&(this.serialNumber.innerHTML=e.serialNumber)})}getTimeZone(){const e={plugin:this.callsign,method:"getTimeZoneDST"};return this.api.req(null,e).then(e=>{e.success&&(this.timeZone.innerHTML=e.timeZone)})}getRFCConfig(){const e={plugin:this.callsign,method:"getRFCConfig",params:{rfcList:["Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AccountInfo.AccountID","Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.UPnP.Enabled","Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AllowOpenPorts.Enabled","Device.DeviceInfo.MemoryStatus.Total","Device.DeviceInfo.MemoryStatus.Free"]}};return this.api.req(null,e).then(e=>{e.success&&(this.accountID.innerHTML=e.RFCConfig["Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AccountInfo.AccountID"],this.upnp.innerHTML=e.RFCConfig["Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.UPnP.Enabled"],this.allowPorts.innerHTML=e.RFCConfig["Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AllowOpenPorts.Enabled"],this.totalMemory.innerHTML=e.RFCConfig["Device.DeviceInfo.MemoryStatus.Total"],this.freeMemory.innerHTML=e.RFCConfig["Device.DeviceInfo.MemoryStatus.Free"])})}getDeepSleepReason(){const e={plugin:this.callsign,method:"getLastDeepSleepReason"};return this.api.req(null,e).then(e=>{e.success&&(this.deepSleep.innerHTML=e.lastDeepSleepReason)})}getPropertyValue(){const e={plugin:this.callsign,method:"getStateInfo",params:{param:this.propertyName.value}};return this.api.req(null,e).then(e=>{e.success&&(this.propertyValue.innerHTML=e[this.propertyName.value])})}getFirmwareUpdateInfo(){const e={plugin:this.callsign,method:"getFirmwareUpdateInfo",params:{GUID:"1234abcd"}};return this.api.req(null,e)}getFirmwareUpdateState(){const e={plugin:this.callsign,method:"getFirmwareUpdateState"};return this.api.req(null,e)}close(){window.clearInterval(this.updateTimer),window.clearTimeout(this.timeOut),this.systemModeChanged&&"function"==typeof this.systemModeChanged.dispose&&this.systemModeChanged.dispose(),this.systemPowerChanged&&"function"==typeof this.systemPowerChanged.dispose&&this.systemPowerChanged.dispose(),this.onFirmwareUpdateInfo&&"function"==typeof this.onFirmwareUpdateInfo.dispose&&this.onFirmwareUpdateInfo.dispose(),this.onUpdateState&&"function"==typeof this.onUpdateState.dispose&&this.onUpdateState.dispose()}};var pe=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Timer",this.mainDiv=document.getElementById("main"),this.show=!1,this.length=0,this.onTimerExpired=this.api.t.on(this.callsign,"timerExpired",e=>{this.show&&this.showAllTimers()}),this.template='\n
      \n Timer\n
      \n
      \n Start timer\n
      \n
      \n Modes\n
      \n
      \n \n
      \n
      \n Interval (in seconds)\n
      \n
      \n \n
      \n
      \n Repeat Interval (in seconds)\n
      \n
      \n \n
      \n
      \n Remind Before (in seconds)\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n Status for all timers\n
      \n
      \n \n
      \n
      \n
      \n
      \n Suspend/Resume/Stop Timers\n
      \n
      \n Enter Timer ID\n
      \n
      \n \n
      \n
      \n \n
      \n
      \n \n
      \n '}render(){this.mainDiv.innerHTML=this.template,this.all_timers=document.getElementById("all_timers"),this.t_interval=document.getElementById("interval"),this.rep_interval=document.getElementById("rinterval"),this.rem_before=document.getElementById("rem_before"),this.timer_start=document.getElementById("timer_start"),this.modes=document.getElementById("modes"),this.ok=document.getElementById("ok"),this.ok.onclick=this.stateChange.bind(this),this.all_timers.onclick=this.click.bind(this),this.timer_start.onclick=this.start.bind(this)}startTimer(e,t,i,n){const s={plugin:this.callsign,method:"startTimer",params:{interval:e,mode:t,repeatInterval:i,remindBefore:n}};return this.api.req(null,s)}start(){""!=this.t_interval.value&&""!=this.rep_interval.value&&""!=this.rem_before.value?this.startTimer(this.t_interval.value,this.modes.value,this.rep_interval.value,this.rem_before.value).then(()=>{this.show&&this.showAllTimers()}):alert("Check your input parameters")}change(e,t){const i={plugin:this.callsign,method:e,params:{timerId:t}};return this.api.req(null,i)}click(){"Show all timers"==this.all_timers.innerHTML?this.showAllTimers():"Hide"==this.all_timers.innerHTML&&(this.hideTimers(),this.all_timers.innerHTML="Show all timers",this.show=!1)}getAllTimers(){const e={plugin:this.callsign,method:"getTimers"};return this.api.req(null,e)}showAllTimers(){this.show=!0;var e=document.getElementById("test");this.hideTimers(),this.getAllTimers().then(t=>{if(null!=t&&t.timers.length>0){this.length=t.timers.length;for(var i=0;i{e.success?this.showAllTimers():alert("Please check your timer ID and state once again")})}close(){this.hideTimers(),this.onTimerExpired&&"function"==typeof this.onTimerExpired.dispose&&(this.onTimerExpired.dispose(),this.onTimerExpired=null)}};var me=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Time"}render(){document.getElementById("main").innerHTML='\n
      \n Time\n
      \n
      \n Current time\n
      \n
      \n -\n
      \n
      \n Source\n
      \n
      \n -\n
      \n
      \n Last synced\n
      \n
      \n -\n
      \n\n
      \n \n
      \n
      \n \n \n
      \n\n
      \n Control\n
      \n
      \n \n
      ',document.getElementById("setTime").onclick=this.setTime.bind(this),document.getElementById("sync").onclick=this.synchronizeTime.bind(this),this.timeEl=document.getElementById("time"),this.sourceEl=document.getElementById("source"),this.syncedEl=document.getElementById("synced"),this.timesyncListener=this.api.t.on("TimeSync","update",e=>{console.log("TIME NOT",e),this.update()}),this.update()}synchronizeTime(){this.syncTime().then(this.synchronize())}synchronize(){const e={plugin:this.callsign,method:"synchronize"};return this.api.req(null,e)}syncTime(){const e={plugin:this.callsign,method:"synctime"};return this.api.req(null,e)}setTime(){let e=document.getElementById("timeinput").value;const t={plugin:this.callsign,method:"time",params:e};return this.api.req(null,t)}getTime(){const e={plugin:this.callsign,method:"time"};return this.api.req(null,e)}update(){this.getTime().then(e=>{this.timeEl.innerHTML=e,this.syncTime().then(e=>{this.sourceEl.innerHTML=e.source,this.syncedEl.innerHTML=e.time})})}close(){this.timesyncListener&&"function"==typeof this.timesyncListener.dispose&&this.timesyncListener.dispose()}};var ve=class extends M{constructor(e,t){super(e,t),this.displayName="Tracing",this.selectedTraceModule=void 0,this.traceModules=void 0,this.uniqueTraceModules=void 0,this.socketUrl=`ws://${t.host[0]}:${t.host[1]}/Service/TraceControl`,this.traceSocket=void 0}close(){this._closeSocket(),super.close()}toggleTracing(e,t,i){const n={plugin:"TraceControl",method:"set",params:{module:e,category:t,state:"on"===i?"enabled":"disabled"}};return this.api.req(null,n)}render(){this._openSocket();var e=this;document.getElementById("main").innerHTML='
      \n Modules\n
      \n\n
      \n \n
      \n
      \n \n
      \n\n
      \n\n\n
      \n \n \n \n \n \n \n \n \n \n \n \n
      timefile + linecategorymessage
      \n
      \n ',document.getElementById("tracingModules").onchange=this.getSelectedModuleAndShowCategories.bind(this),this.status().then(t=>{e.traceModules=t.settings?t.settings:[],e.uniqueTraceModules=[];var i=document.getElementById("tracingModules");i.getElementsByTagName("options");if(i.options.length=0,void 0!==e.traceModules){for(var n=0;n{this.update()})}update(){this.getUILanguage().then(e=>{this.current_ui_language.innerHTML=e.language})}};var be=class extends M{constructor(e,t){super(e,t)}render(){document.getElementById("main").innerHTML='
      \n Volume\n
      \n\n
      \n Muted\n
      \n
      \n -\n
      \n
      \n Volume level\n
      \n
      \n -\n
      \n\n
      \n Control\n
      \n
      \n \n \n \n
      ',this.mutedEl=document.getElementById("muted"),this.volumeEl=document.getElementById("volume"),this.muteBtn=document.getElementById("muteBtn"),document.getElementById("volumeUp").onclick=this.volumeChange.bind(this,10),document.getElementById("volumeDown").onclick=this.volumeChange.bind(this,-10),muteBtn.onclick=this.mute.bind(this),this.update()}update(){this.muted().then(e=>{this.mutedEl.innerHTML=e,muteBtn.innerHTML=e?"Unmute":"Mute"}),this.volume().then(e=>{this.volumeEl.innerHTML=e})}muted(e){const t={plugin:this.callsign,method:"muted"};return void 0!==e&&(t.params=e),this.api.req(null,t)}volume(e){const t={plugin:this.callsign,method:"volume"};return void 0!==e&&(t.params=e),this.api.req(null,t)}volumeChange(e){this.volume().then(t=>{this.volume(t+e).then(this.update())})}mute(){this.muted().then(e=>{this.muted(!e).then(this.update())})}};var ye=class extends M{constructor(e,t){super(e,t),this.webShellSocket=void 0}render(){var e=this;document.getElementById("main").innerHTML='
      WebShell
      \n
      \n
      \n        
      \n
      #
      ',this.api.startWebShell((function(t,i){e.webShellSocket=i,e.webShellSocket.onmessage=function(e){var t=new FileReader;t.onload=function(){document.getElementById("webShellData").innerHTML=String.fromCharCode.apply(null,new Uint8Array(t.result))},t.readAsArrayBuffer(e.data)},e.webShellSocket.onclose=function(){e.webShellSocket=null,e.render()}})),void 0!==plugins.RemoteControl&&(plugins.RemoteControl.doNotHandleKeys=!0),window.addEventListener("keydown",this.handleKey.bind(this))}close(){void 0!==plugins.RemoteControl&&(plugins.RemoteControl.doNotHandleKeys=!1),window.removeEventListener("keydown",this.handleKey.bind(this),!1)}handleKey(e){if(this.webShellSocket&&13===e.which){for(var t=document.getElementById("webShellInput").value+" \n",i=new ArrayBuffer(2*t.length),n=new Uint8Array(i),s=0,o=t.length;s{!0===this.rendered&&this.getNetworks()}),this.wifiConnectionListener=this.api.t.on("WifiControl","connectionchange",e=>{this.connected=e.connected,!0===this.rendered&&this.update()})}render(){document.getElementById("main").innerHTML='
      \n Status\n
      \n\n
      \n Connected to\n
      \n
      \n\n
      \n Scanning\n
      \n
      \n False\n
      \n\n
      \n Wireless networks\n
      \n
      \n \n
      \n
      \n
      \n
      \n \n
      \n\n
      \n Configs\n
      \n\n
      \n Configs\n
      \n
      \n \n
      \n\n
      \n SSID\n
      \n
      \n \n
      \n
      \n Mode\n
      \n
      \n
      \n \x3c!-- disable for now\n
      \n
      \n \n
      \n --\x3e\n
      \n Hidden\n
      \n
      \n
      \n Method\n
      \n
      \n \n
      \n
      Controls
      \n
      \n \n \n
      \n
      \n
      \n \n \n
      \n\n
      \n
      \n ',this.scanButton=document.getElementById("Wifi_scanForNetworksButton"),this.saveButton=document.getElementById("Wifi_saveButton"),this.deleteButton=document.getElementById("Wifi_deleteButton"),this.connectButton=document.getElementById("Wifi_connectButton"),this.disconnectButton=document.getElementById("Wifi_disconnectButton"),this.scanButton.onclick=this.scanForNetworks.bind(this),this.deleteButton.onclick=this.deleteConfig.bind(this),this.saveButton.onclick=this.saveConfig.bind(this),this.disconnectButton.onclick=this.disconnect.bind(this),this.connectButton.onclick=this.connect.bind(this),this.connectedStatus=document.getElementById("Wifi_Connected"),this.scanningStatus=document.getElementById("Wifi_Scanning"),this.statusMessages=document.getElementById("statusMessages"),this.networkListEl=document.getElementById("Wifi_WirelessNetwork"),this.networkListEl.onchange=this.renderNetworkDetails.bind(this),this.configListEl=document.getElementById("Wifi_Configs"),this.configListEl.onchange=this.renderConfigDetails.bind(this),this.ssidEl=document.getElementById("Wifi_SSID"),this.methodEl=document.getElementById("Wifi_Method"),this.passwordEl=document.getElementById("Wifi_Password"),this.accesspointEl=document.getElementById("Wifi_Mode"),this.hiddenEl=document.getElementById("Wifi_Hidden"),this.update(),setTimeout(this.getNetworks.bind(this),200),setTimeout(this.getConfigs.bind(this),400),this.rendered=!0}update(){this.status().then(e=>{void 0!==e&&(this.connected=e.connectedssid,"boolean"==typeof e.isscanning&&(this.scanning=e.isscanning),this.renderStatus())})}scanForNetworks(){const e={plugin:this.callsign,method:"scan"};this.api.req(null,e).then(e=>{this.update(),setTimeout(this.getNetworks.bind(this),5e3)})}getConfig(e){this.update();const t={plugin:this.callsign,method:"config@"+e};this.api.req(null,t).then(e=>{void 0!==e&&(this.configinfo.push(e),this.renderConfigDetails())})}getConfigs(){this.update();const e={plugin:this.callsign,method:"configs"};this.api.req(null,e).then(e=>{if(void 0!==e){this.configs=e,this.configinfo=[],this.configListEl.innerHTML="";for(var t=0;t{if(void 0!==e&&(this.networks=[],!1!==this.rendered)){this.networkListEl.innerHTML="";for(var t=0;t{e.statusMessage("Saved config for "+this.ssidEl.value),e.getConfigs()})}deleteConfig(){var e=this,t=this.configListEl.selectedIndex;this.statusMessage("Deleting config "+this.configs[t].ssid);const i={plugin:this.callsign,method:"config@"+this.configs[t],params:{value:{ssid:"",accesspoint:!1}}};this.api.req(null,i).then(t=>{e.connecting=!0,e.getConfigs()})}requestDHCP(){this.statusMessage("Requesting DHCP for wlan0");const e={plugin:"NetworkControl",method:"request",params:{device:this.wlanInterface}};this.api.req(null,e)}connect(){var e=this.configListEl.selectedIndex;this.statusMessage("Connecting to "+this.configs[e]);const t={plugin:this.callsign,method:"connect",params:{configssid:this.configs[e]}};this.api.req(null,t).then(()=>{this.connecting=!0,setTimeout(this.requestDHCP.bind(this),5e3)})}disconnect(){if(void 0===this.connected||""===this.connected)return;const e={plugin:this.callsign,method:"disconnect",params:{configssid:this.connected}};this.statusMessage("Disconnecting from "+this.connected),this.api.req(null,e)}close(){this.rendered=!1,this.wifiConnectionListener&&"function"==typeof this.wifiConnectionListener.dispose&&this.wifiConnectionListener.dispose(),this.wifiScanListener&&"function"==typeof this.wifiScanListener.dispose&&this.wifiScanListener.dispose()}};var Ie=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Warehouse",this.mainDiv=document.getElementById("main"),this.template='\n
      Device Information
      \n
      Bluetooth MAC
      \n
      -
      \n
      Box IP
      \n
      -
      \n
      Build Type
      \n
      -
      \n
      ESTB MAC
      \n
      -
      \n
      Ethernet MAC
      \n
      -
      \n
      Image Version
      \n
      -
      \n
      Model Number
      \n
      -
      \n
      rf4ce MAC
      \n
      -
      \n
      Wi-Fi MAC
      \n
      -
      \n
      Reset
      \n
      Device Reset
      \n
      \n \n
      \n
      Internal Reset
      \n
      \n \n
      \n
      Light Reset
      \n
      \n \n
      \n
      Front Panel State
      \n
      Set front panel state
      \n
      \n \n
      \n
      \n \n
      \n
      Customer Data
      \n
      -
      \n \t'}render(){this.mainDiv.innerHTML=this.template,this.btMac=document.getElementById("bt_mac"),this.boxIP=document.getElementById("box_ip"),this.buildType=document.getElementById("build_type"),this.estbMac=document.getElementById("estb_mac"),this.ethMac=document.getElementById("eth_mac"),this.imgVersion=document.getElementById("img_version"),this.modelNumber=document.getElementById("model_number"),this.rfMac=document.getElementById("rf_mac"),this.wifiMac=document.getElementById("wifi_mac"),this.custData=document.getElementById("cust_data"),this.deviceResetButton=document.getElementById("Device_Reset"),this.internalResetButton=document.getElementById("Internal_Reset"),this.lightResetButton=document.getElementById("Light_Reset"),this.frontPanelSetButton=document.getElementById("front_set"),this.state=document.getElementById("state"),this.deviceResetButton.onclick=()=>{confirm("Do you want to suppress reboot during device reset")?this.deviceReset(!0):this.deviceReset(!1)},this.internalResetButton.onclick=this.internalReset.bind(this),this.lightResetButton.onclick=this.lightReset.bind(this),this.frontPanelSetButton.onclick=this.frontPanelSet.bind(this),this.onResetDone=this.api.t.on(this.callsign,"resetDone",e=>{alert("Device reset successfully")}),this.deviceInfo(),this.isClean()}deviceReset(e){const t={plugin:this.callsign,method:"resetDevice",params:{supressReboot:e}};return this.api.req(null,t)}internalReset(){const e={plugin:this.callsign,method:"internalReset",params:{passPhrase:"FOR TEST PURPOSES ONLY"}};return this.api.req(null,e).then(e=>{e.success&&alert("Internal reset success")})}lightReset(){const e={plugin:this.callsign,method:"lightReset"};return this.api.req(null,e).then(e=>{e.success&&alert("Light reset success")})}frontPanelSet(){const e={plugin:this.callsign,method:"setFrontPanelState",params:{state:this.state.value}};return this.api.req(null,e).then(e=>{e.success?alert("Front panel LED states set successfully"):alert("Error: "+e.error)})}deviceInfo(){const e={plugin:this.callsign,method:"getDeviceInfo"};return this.api.req(null,e).then(e=>{e.success&&(this.btMac.innerHTML=e.bluetooth_mac,this.boxIP.innerHTML=e.boxIP,this.buildType.innerHTML=e.build_type,this.estbMac.innerHTML=e.estb_mac,this.ethMac.innerHTML=e.eth_mac,this.imgVersion.innerHTML=e.imageVersion,this.modelNumber.innerHTML=e.model_number,this.rfMac.innerHTML=e.rf4ce_mac,this.wifiMac.innerHTML=e.wifi_mac)})}isClean(){const e={plugin:this.callsign,method:"isClean"};return this.api.req(null,e).then(e=>{e.success?e.clean?this.custData.innerHTML="No records found":this.custData.innerHTML=e.files.join("
      "):this.custData.innerHTML="Error:"+e.error})}close(){this.onResetDone&&"function"==typeof this.onResetDone.dispose&&(this.onResetDone.dispose(),this.onResetDone=null)}};var xe=class extends M{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="XCast",this.mainDiv=document.getElementById("main")}render(){this.template='\n
      XCast
      \n
      API Version
      \n
      -
      \n
      Quirks
      \n
      -
      \n ',this.mainDiv.innerHTML=this.template,this.version=document.getElementById("version"),this.quirks=document.getElementById("quirks"),this.update()}update(){this.getVersion(),this.getQuirks()}getVersion(){const e={plugin:this.callsign,method:"getApiVersionNumber"};return this.api.req(null,e).then(e=>{e.success?this.version.innerHTML=e.version:this.version.innerHTML="Not Available"})}getQuirks(){const e={plugin:this.callsign,method:"getQuirks"};return this.api.req(null,e).then(e=>{e.success&&(0==e.quirks.length?this.quirks.innerHTML="-":this.quirks.innerHTML=e.quirks.join())})}};var Se=class extends M{constructor(e,t){super(e,t),this.displayName="Wi-Fi",this.networks=[],this.connecting=!1,this.connected=void 0,this.scanning=!1,this.statusMessageTimer=null,this.rendered=!1}render(){document.getElementById("main").innerHTML='\n
      Status
      \n
      Connected to
      \n
      \n
      \n \n
      \n
      \n
      Scanning
      \n
      false
      \n
      Wireless networks
      \n
      \n \n
      \n
      \n
      \n
      \n ',this.scanButton=document.getElementById("Wifi_scanForNetworksButton"),this.optionButton=document.getElementById("ssid_options"),this.scanButton.onclick=this.scanForNetworks.bind(this),this.connectedStatus=document.getElementById("Wifi_Connected"),this.scanningStatus=document.getElementById("Wifi_Scanning"),this.statusMessages=document.getElementById("statusMessages"),this.networkListEl=document.getElementById("Wifi_WirelessNetwork"),this.update(),this.wifiScanListener=this.api.t.on(this.callsign,"onAvailableSSIDs",e=>{this.renderNetworks(e),this.scanningStatus.innerHTML=!1}),this.wifiConnectionListener=this.api.t.on(this.callsign,"onWIFIStateChanged",e=>{switch(this.getConnectedSSID(),e.state){case 2:this.statusMessage("Disconnected from "+this.connectedStatus.innerHTML);break;case 4:this.statusMessage("Connecting",!0);break;case 5:this.statusMessage("Connected");break;case 6:this.statusMessage("Failed")}}),this.errorListener=this.api.t.on(this.callsign,"onError",e=>{switch(e.code){case 4:this.statusMessage("Invalid credentials",!1,!0)}}),this.networkListEl.onchange=this.renderOptions.bind(this),this.rendered=!0}update(){this.renderOptions(),this.getConnectedSSID(),this.scanForNetworks()}scanForNetworks(){const e={plugin:this.callsign,method:"startScan",params:{incremental:!1,ssid:"",frequency:""}};this.api.req(null,e).then(e=>{e.success?this.scanningStatus.innerHTML=!0:this.statusMessage(e.error,!1,!0)})}renderNetworks(e){if(void 0===e)return;if(this.networks=[],!1===this.rendered)return;let t=e.ssids;this.networkListEl.innerHTML="";for(var i=0;i{this.connecting=!0,this.passwordEl.value=""})}disconnect(){const e={plugin:this.callsign,method:"disconnect",params:{}};this.api.req(null,e).then(e=>{})}getConnectedSSID(){const e={plugin:this.callsign,method:"getConnectedSSID",params:{}};this.api.req(null,e).then(e=>{this.connectedStatus.innerHTML=e.ssid,this.renderOptions()})}renderOptions(){this.optionButton.innerHTML="";let e=this.networkListEl.selectedIndex;e>=0&&(this.networks[e].ssid==this.connectedStatus.innerHTML?(this.optionButton.innerHTML='\n
      \n \n
      \n ',this.disconnectButton=document.getElementById("Wifi_disconnectButton"),this.disconnectButton.onclick=this.disconnect.bind(this)):(0==this.networks[e].security||15==this.networks[e].security?this.optionButton.innerHTML='\n
      \n \n
      \n ':(this.optionButton.innerHTML='\n
      \n Password\n
      \n
      \n \n
      \n
      \n \n
      \n ',this.passwordEl=document.getElementById("Wifi_Password")),this.connectButton=document.getElementById("Wifi_connectButton"),this.connectButton.onclick=this.connect.bind(this)))}close(){this.rendered=!1,this.wifiConnectionListener&&"function"==typeof this.wifiConnectionListener.dispose&&this.wifiConnectionListener.dispose(),this.wifiScanListener&&"function"==typeof this.wifiScanListener.dispose&&this.wifiScanListener.dispose()}};var ke={ActivityMonitor:B,AVInput:T,BluetoothControl:L,Bluetooth:w,Cobalt:P,Compositor:R,ContinueWatching:N,Controller:A,DataCapture:q,DeviceInfo:U,DisplayInfo:F,DisplaySettings:K,PlayerInfo:z,DeviceDiagnostics:G,DeviceIdentification:j,DialServer:W,FirmwareControl:V,FrameRate:O,LoggingPreferences:Y,LocationSync:X,MessageControl:$,HdcpProfile:Z,HdmiInput:J,IOConnector:Q,Messenger:ee,Monitor:D,Netflix:te,Network:ie,NetworkControl:ne,OCDM:se,PersistentStore:oe,Power:le,Provisioning:de,RDKShell:re,RemoteControl:ae,ScreenCapture:ce,Snapshot:ue,Spark:he,SwitchBoard:_e,SystemServices:ge,Timer:pe,TimeSync:me,TraceControl:ve,UserPreferences:fe,VolumeControl:be,WebKitBrowser:H,WebShell:ye,WifiControl:Ee,Warehouse:Ie,WifiManager:Se,XCast:xe,LinearPlaybackControl:class extends M{constructor(e,t){super(e,t),this.api.t.on("LinearPlaybackControl","speedchanged",e=>{this.eventTrickPlaySpeed.innerHTML=e.speed})}render(){document.getElementById("main").innerHTML='
      \n Linear Playback Control\n
      \n\n
      Channel presets
      \n
      \n \n
      \n \n
      \n \n
      \n\n
      \n \n \n \n
      \n \n
      \n \n
      \n\n
      \n \n \n \n
      \n \n
      \n \n
      \n\n
      \n \n \n \n
      \n\n
      Event data
      \n
      Trick play speed [s]
      \n
      -
      \n\n
      Status
      \n
      Trick play speed [s]
      \n
      -
      \n
      Seek position [s]
      \n
      -
      \n
      TSB size [s]
      \n
      -
      \n
      Seek position [bytes]
      \n
      -
      \n
      TSB size [bytes]
      \n
      -
      \n
      TSB size max. [bytes]
      \n
      -
      \n
      Stream source lost
      \n
      -
      \n
      Stream source loss count
      \n
      -
      \n \n
      \n \n
      ',this.channel_presets=[{Name:"Select a channel",URL:""},{Name:"Test Chan 1",URL:"239.100.0.1"},{Name:"Test Chan 2",URL:"239.100.0.2"},{Name:"Test Chan 3",URL:"239.100.0.3"}];var e=document.getElementById("linear_channel_presets");if(0===e.children.length)for(var t=0;t0&&(console.log("Index= "+e),this.rpcSetChannel(this.channel_presets[e].URL).then(e=>{this.getChannel()}))}setChannel(){var e=document.getElementById("linear_channel_uri").value;document.getElementById("set_channel_button");this.rpcSetChannel(e)}getChannel(){document.getElementById("linear_channel_uri").value="-",this.rpcGet("channel").then(e=>{void 0!==e&&(document.getElementById("linear_channel_uri").value=e.channel)}).catch(e=>{alert("Error reading channel endpoint")})}setSeek(){var e=document.getElementById("linear_channel_seek").value;document.getElementById("set_seek_button");this.rpcSetSeek(e)}getSeek(){document.getElementById("linear_channel_seek").value="-",this.rpcGet("seek").then(e=>{void 0!==e&&(document.getElementById("linear_channel_seek").value=e.seekPosInSeconds)}).catch(e=>{alert("Error reading seek endpoint")})}setTrickPlaySpeed(){var e=document.getElementById("trick_play_speed").value;document.getElementById("set_trick_play_speed_button");this.rpcSetTrickPlaySpeed(e)}getTrickPlaySpeed(){document.getElementById("trick_play_speed").value="-",this.rpcGet("trickplay").then(e=>{void 0!==e&&(document.getElementById("trick_play_speed").value=e.speed)}).catch(e=>{alert("Error reading seek endpoint")})}getStatus(){document.getElementById("status_trick_play_speed").innerHTML="-",document.getElementById("status_seek_pos_seconds").innerHTML="-",document.getElementById("status_tsb_size_seconds").innerHTML="-",document.getElementById("status_seek_pos_bytes").innerHTML="-",document.getElementById("status_tsb_size_bytes").innerHTML="-",document.getElementById("status_max_tsb_size_bytes").innerHTML="-",document.getElementById("status_stream_source_lost").innerHTML="-",document.getElementById("status_stream_source_loss_count").innerHTML="-",this.rpcGet("status").then(e=>{void 0!==e&&(document.getElementById("status_trick_play_speed").innerHTML=e.trickPlaySpeed,document.getElementById("status_seek_pos_seconds").innerHTML=e.seekPosInSeconds,document.getElementById("status_tsb_size_seconds").innerHTML=e.currentSizeInSeconds,document.getElementById("status_seek_pos_bytes").innerHTML=e.seekPosInBytes,document.getElementById("status_tsb_size_bytes").innerHTML=e.currentSizeInBytes,document.getElementById("status_max_tsb_size_bytes").innerHTML=e.maxSizeInBytes,document.getElementById("status_stream_source_lost").innerHTML=e.streamSourceLost,document.getElementById("status_stream_source_loss_count").innerHTML=e.streamSourceLossCount)}).catch(e=>{alert("Error reading status endpoint")})}}},Me={},Be=void 0,Te=(document.getElementById("main"),window.localStorage.getItem("lastActivePlugin")||void 0);function Le(e){(Be=new E(e)).getControllerPlugins().then(e=>e).then(e=>{for(var t=0;t1)for(var i=1;i=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,d=!0,r=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return d=e.done,e},e:function(e){r=!0,l=e},f:function(){try{d||null==i.return||i.return()}finally{if(r)throw l}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i0?40*e+55:0,l=t>0?40*t+55:0,d=i>0?40*i+55:0;n[16+36*e+6*t+i]=function(e){var t,i=[],n=s(e);try{for(n.s();!(t=n.n()).done;){var o=t.value;i.push(a(o))}}catch(e){n.e(e)}finally{n.f()}return"#"+i.join("")}([o,l,d])}(e,t,i,l)}))}))})),h(0,23).forEach((function(e){var t=e+232,i=a(10*e+8);l[t]="#"+i+i+i})),l)};function a(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t}function c(e,t,i,n){var s;return"text"===t?s=function(e,t){if(t.escapeXML)return d.encodeXML(e);return e}(i,n):"display"===t?s=function(e,t,i){t=parseInt(t,10);var n,s={"-1":function(){return"
      "},0:function(){return e.length&&u(e)},1:function(){return g(e,"b")},3:function(){return g(e,"i")},4:function(){return g(e,"u")},8:function(){return p(e,"display:none")},9:function(){return g(e,"strike")},22:function(){return p(e,"font-weight:normal;text-decoration:none;font-style:normal")},23:function(){return f(e,"i")},24:function(){return f(e,"u")},39:function(){return m(e,i.fg)},49:function(){return v(e,i.bg)},53:function(){return p(e,"text-decoration:overline")}};s[t]?n=s[t]():4"})).join("")}function h(e,t){for(var i=[],n=e;n<=t;n++)i.push(n);return i}function _(e){var t=null;return 0===(e=parseInt(e,10))?t="all":1===e?t="bold":2")}function p(e,t){return g(e,"span",t)}function m(e,t){return g(e,"span","color:"+t)}function v(e,t){return g(e,"span","background-color:"+t)}function f(e,t){var i;if(e.slice(-1)[0]===t&&(i=e.pop()),i)return""}var b=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(t=t||{}).colors&&(t.colors=Object.assign({},r.colors,t.colors)),this.options=Object.assign({},r,t),this.stack=[],this.stickyStack=[]}var t,i,o;return t=e,(i=[{key:"toHtml",value:function(e){var t=this;e="string"==typeof e?[e]:e;var i=this.stack,n=this.options,o=[];return this.stickyStack.forEach((function(e){var t=c(i,e.token,e.data,n);t&&o.push(t)})),function(e,t,i){var n=!1;function o(){return""}function l(e){return t.newline?i("display",-1):i("text",e),""}var d=[{pattern:/^\x08+/,sub:o},{pattern:/^\x1b\[[012]?K/,sub:o},{pattern:/^\x1b\[\(B/,sub:o},{pattern:/^\x1b\[[34]8;2;\d+;\d+;\d+m/,sub:function(e){return i("rgb",e),""}},{pattern:/^\x1b\[38;5;(\d+)m/,sub:function(e,t){return i("xterm256Foreground",t),""}},{pattern:/^\x1b\[48;5;(\d+)m/,sub:function(e,t){return i("xterm256Background",t),""}},{pattern:/^\n/,sub:l},{pattern:/^\r+\n/,sub:l},{pattern:/^\r/,sub:l},{pattern:/^\x1b\[((?:\d{1,3};?)+|)m/,sub:function(e,t){n=!0,0===t.trim().length&&(t="0");var o,l=s(t=t.trimRight(";").split(";"));try{for(l.s();!(o=l.n()).done;){var d=o.value;i("display",d)}}catch(e){l.e(e)}finally{l.f()}return""}},{pattern:/^\x1b\[\d?J/,sub:o},{pattern:/^\x1b\[\d{0,3};\d{0,3}f/,sub:o},{pattern:/^\x1b\[?[\d;]{0,3}/,sub:o},{pattern:/^(([^\x1b\x08\r\n])+)/,sub:function(e){return i("text",e),""}}];function r(t,i){i>3&&n||(n=!1,e=e.replace(t.pattern,t.sub))}var a=[],c=e.length;e:for(;c>0;){for(var u=0,h=0,_=d.length;h<_;u=++h)if(r(d[u],u),e.length!==c){c=e.length;continue e}if(e.length===c)break;a.push(0),c=e.length}}(e.join(""),n,(function(e,s){var l=c(i,e,s,n);l&&o.push(l),n.stream&&(t.stickyStack=function(e,t,i){var n;return"text"!==t&&(e=e.filter((n=_(i),function(e){return(null===n||e.category!==n)&&"all"!==n}))).push({token:t,data:i,category:_(i)}),e}(t.stickyStack,e,s))})),i.length&&o.push(u(i)),o.join("")}}])&&n(t.prototype,i),o&&n(t,o),e}();e.exports=b},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeXMLStrict=t.decodeHTML5Strict=t.decodeHTML4Strict=t.decodeHTML5=t.decodeHTML4=t.decodeHTMLStrict=t.decodeHTML=t.decodeXML=t.encodeHTML5=t.encodeHTML4=t.escapeUTF8=t.escape=t.encodeNonAsciiHTML=t.encodeHTML=t.encodeXML=t.encode=t.decodeStrict=t.decode=void 0;var n=i(2),s=i(5);t.decode=function(e,t){return(!t||t<=0?n.decodeXML:n.decodeHTML)(e)},t.decodeStrict=function(e,t){return(!t||t<=0?n.decodeXML:n.decodeHTMLStrict)(e)},t.encode=function(e,t){return(!t||t<=0?s.encodeXML:s.encodeHTML)(e)};var o=i(5);Object.defineProperty(t,"encodeXML",{enumerable:!0,get:function(){return o.encodeXML}}),Object.defineProperty(t,"encodeHTML",{enumerable:!0,get:function(){return o.encodeHTML}}),Object.defineProperty(t,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return o.encodeNonAsciiHTML}}),Object.defineProperty(t,"escape",{enumerable:!0,get:function(){return o.escape}}),Object.defineProperty(t,"escapeUTF8",{enumerable:!0,get:function(){return o.escapeUTF8}}),Object.defineProperty(t,"encodeHTML4",{enumerable:!0,get:function(){return o.encodeHTML}}),Object.defineProperty(t,"encodeHTML5",{enumerable:!0,get:function(){return o.encodeHTML}});var l=i(2);Object.defineProperty(t,"decodeXML",{enumerable:!0,get:function(){return l.decodeXML}}),Object.defineProperty(t,"decodeHTML",{enumerable:!0,get:function(){return l.decodeHTML}}),Object.defineProperty(t,"decodeHTMLStrict",{enumerable:!0,get:function(){return l.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML4",{enumerable:!0,get:function(){return l.decodeHTML}}),Object.defineProperty(t,"decodeHTML5",{enumerable:!0,get:function(){return l.decodeHTML}}),Object.defineProperty(t,"decodeHTML4Strict",{enumerable:!0,get:function(){return l.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML5Strict",{enumerable:!0,get:function(){return l.decodeHTMLStrict}}),Object.defineProperty(t,"decodeXMLStrict",{enumerable:!0,get:function(){return l.decodeXML}})},function(e){e.exports=JSON.parse('{"Aacute":"Á","aacute":"á","Acirc":"Â","acirc":"â","acute":"´","AElig":"Æ","aelig":"æ","Agrave":"À","agrave":"à","amp":"&","AMP":"&","Aring":"Å","aring":"å","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","brvbar":"¦","Ccedil":"Ç","ccedil":"ç","cedil":"¸","cent":"¢","copy":"©","COPY":"©","curren":"¤","deg":"°","divide":"÷","Eacute":"É","eacute":"é","Ecirc":"Ê","ecirc":"ê","Egrave":"È","egrave":"è","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","frac12":"½","frac14":"¼","frac34":"¾","gt":">","GT":">","Iacute":"Í","iacute":"í","Icirc":"Î","icirc":"î","iexcl":"¡","Igrave":"Ì","igrave":"ì","iquest":"¿","Iuml":"Ï","iuml":"ï","laquo":"«","lt":"<","LT":"<","macr":"¯","micro":"µ","middot":"·","nbsp":" ","not":"¬","Ntilde":"Ñ","ntilde":"ñ","Oacute":"Ó","oacute":"ó","Ocirc":"Ô","ocirc":"ô","Ograve":"Ò","ograve":"ò","ordf":"ª","ordm":"º","Oslash":"Ø","oslash":"ø","Otilde":"Õ","otilde":"õ","Ouml":"Ö","ouml":"ö","para":"¶","plusmn":"±","pound":"£","quot":"\\"","QUOT":"\\"","raquo":"»","reg":"®","REG":"®","sect":"§","shy":"­","sup1":"¹","sup2":"²","sup3":"³","szlig":"ß","THORN":"Þ","thorn":"þ","times":"×","Uacute":"Ú","uacute":"ú","Ucirc":"Û","ucirc":"û","Ugrave":"Ù","ugrave":"ù","uml":"¨","Uuml":"Ü","uuml":"ü","Yacute":"Ý","yacute":"ý","yen":"¥","yuml":"ÿ"}')},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(i(18)),o=String.fromCodePoint||function(e){var t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|1023&e),t+=String.fromCharCode(e)};t.default=function(e){return e>=55296&&e<=57343||e>1114111?"�":(e in s.default&&(e=s.default[e]),o(e))}},function(e){e.exports=JSON.parse('{"0":65533,"128":8364,"130":8218,"131":402,"132":8222,"133":8230,"134":8224,"135":8225,"136":710,"137":8240,"138":352,"139":8249,"140":338,"142":381,"145":8216,"146":8217,"147":8220,"148":8221,"149":8226,"150":8211,"151":8212,"152":732,"153":8482,"154":353,"155":8250,"156":339,"158":382,"159":376}')}]); \ No newline at end of file +!function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=8)}([function(e,t,i){"use strict";var n,s=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},o=function(){var e={};return function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}e[t]=i}return e[t]}}(),l=[];function d(e){for(var t=-1,i=0;i","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"𝒽","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"⁣","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","ifr":"𝔦","Ifr":"ℑ","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"⁣","InvisibleTimes":"⁢","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","iscr":"𝒾","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"⁢","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"‎","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","mscr":"𝓂","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"​","NegativeThickSpace":"​","NegativeThinSpace":"​","NegativeVeryThinSpace":"​","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"⁠","NonBreakingSpace":" ","nopf":"𝕟","Nopf":"ℕ","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","qopf":"𝕢","Qopf":"ℚ","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\\"","QUOT":"\\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"𝓇","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"­","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":"  ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","yuml":"ÿ","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"​","Zeta":"Ζ","zeta":"ζ","zfr":"𝔷","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","Zopf":"ℤ","Zscr":"𝒵","zscr":"𝓏","zwj":"‍","zwnj":"‌"}')},function(e){e.exports=JSON.parse('{"amp":"&","apos":"\'","gt":">","lt":"<","quot":"\\""}')},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.escapeUTF8=t.escape=t.encodeNonAsciiHTML=t.encodeHTML=t.encodeXML=void 0;var s=c(n(i(4)).default),o=u(s);t.encodeXML=m(s);var l,d,r=c(n(i(3)).default),a=u(r);function c(e){return Object.keys(e).sort().reduce((function(t,i){return t[e[i]]="&"+i+";",t}),{})}function u(e){for(var t=[],i=[],n=0,s=Object.keys(e);n1?_(e):e.charCodeAt(0)).toString(16).toUpperCase()+";"}var p=new RegExp(o.source+"|"+h.source,"g");function m(e){return function(t){return t.replace(p,(function(t){return e[t]||g(t)}))}}t.escape=function(e){return e.replace(p,g)},t.escapeUTF8=function(e){return e.replace(o,g)}},function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));const n=()=>{let e=window.location.hostname;return window.location.host===window.location.hostname?e+=":80":e+=":"+window.location.host.substring(window.location.hostname.length+1),e}},function(e,t,i){"use strict";i.d(t,"b",(function(){return Pe})),i.d(t,"c",(function(){return He})),i.d(t,"a",(function(){return I}));let n=null;"undefined"!=typeof WebSocket&&(n=WebSocket);var s=n;const o={},l={};var d=e=>{if("string"==typeof e&&(e=JSON.parse(e.normalize().replace(/\\x([0-9A-Fa-f]{2})/g,""))),!e.id&&e.method){const t=l[e.method];t&&Array.isArray(t)&&t.length&&t.forEach(t=>{t(e.params)})}};let r=null;var a=e=>new Promise((t,i)=>{if(r&&1===r.readyState)return t(r);if(r&&0===r.readyState){const e=()=>{r.removeEventListener("open",e),t(r)};return r.addEventListener("open",e)}if(null===r){r=new s((e=>[e&&e.protocol||"ws://",e&&e.host||"localhost",":"+(e&&e.port||80),e&&e.endpoint||"/jsonrpc",e&&e.token?"?token="+e.token:null].join(""))(e),"notification"),r.addEventListener("message",t=>{e.debug&&(console.log(" "),console.log("API REPONSE:"),console.log(JSON.stringify(t.data,null,2)),console.log(" ")),(e=>{if("string"==typeof e&&(e=JSON.parse(e.normalize().replace(/\\x([0-9A-Fa-f]{2})/g,""))),e.id){const t=o[e.id];t?("result"in e?t.resolve(e.result):t.reject(e.error),delete o[e.id]):console.log("no pending request found with id "+e.id)}})(t.data)}),r.addEventListener("message",e=>{d(e.data)}),r.addEventListener("error",()=>{d({method:"client.ThunderJS.events.error"}),r=null});const n=e=>{r=null,i(e)};r.addEventListener("close",n),r.addEventListener("open",()=>{d({method:"client.ThunderJS.events.connect"}),r.removeEventListener("close",n),r.addEventListener("close",()=>{d({method:"client.ThunderJS.events.disconnect"}),r=null}),t(r)})}else r=null,i("Socket error")});let c=0;var u=e=>({request:(t,i,n)=>new Promise((s,l)=>{const d=(c+=1,c),r=((e,t,i)=>{let n;return(n=i&&i.version)?n:e&&(e[t]||e.default)||1})(e.versions,t,n),u=((e,t,i,n,s)=>{n&&delete n.version;const o={jsonrpc:"2.0",id:e,method:[t,s,i].join(".")};return(n||!1===n)&&(("object"!=typeof n||0!==Object.keys(n).length)&&(o.params=n)),o})(d,t,i,n,r);e.debug&&(console.log(" "),console.log("API REQUEST:"),console.log(JSON.stringify(u,null,2)),console.log(" ")),o[d]={body:u,resolve:s,reject:l},((e,t)=>a(e).then(e=>{e.send(JSON.stringify(t))}))(e,u).catch(e=>{l(e)})})}),h={DeviceInfo:{freeRam(e){return this.call("systeminfo",e).then(e=>e.freeram)},version(e){return this.call("systeminfo",e).then(e=>e.version)}}};function _(e,t,i,n){const s=this,o=p.call(this,e,t,i,n);return{dispose(){const i=g(e,t);void 0!==l[i]&&(l[i].splice(o,1),0===l[i].length&&m.call(s,e,t,n))}}}const g=(e,t)=>["client",e,"events",t].join("."),p=function(e,t,i,n){const s=g(e,t);if(!l[s]&&(l[s]=[],"ThunderJS"!==e)){const i="register",o={event:t,id:s.split(".").slice(0,-1).join(".")};this.api.request(e,i,o).catch(e=>{"function"==typeof n&&n(e.message)})}return l[s].push(i),l[s].length-1},m=function(e,t,i){const n=g(e,t);if(delete l[n],"ThunderJS"!==e){const s="unregister",o={event:t,id:n.split(".").slice(0,-1).join(".")};this.api.request(e,s,o).catch(e=>{"function"==typeof i&&i(e.message)})}};let v;const f=e=>({options:e,plugin:!1,call(){const e=[...arguments];this.plugin&&e[0]!==this.plugin&&e.unshift(this.plugin);const t=e[0],i=e[1];return"function"==typeof this[t][i]?this[t][i](e[2]):this.api.request.apply(this,e)},registerPlugin(e,t){this[e]=b(Object.assign(Object.create(f),t,{plugin:e}))},subscribe(){},on(){const e=[...arguments];return-1!==["connect","disconnect","error"].indexOf(e[0])?e.unshift("ThunderJS"):this.plugin&&e[0]!==this.plugin&&e.unshift(this.plugin),_.apply(this,e)},once(){console.log("todo ...")}}),b=e=>new Proxy(e,{get(e,t){const i=e[t];return"api"===t?v:void 0!==i?"function"==typeof i?["on","once","subscribe"].indexOf(t)>-1?function(...e){return i.apply(this,e)}:function(...e){return((e,t)=>{"object"==typeof e&&("object"!=typeof e||e.then&&"function"==typeof e.then)||(e=new Promise((t,i)=>{e instanceof Error==!1?t(e):i(e)}));const i="function"==typeof t[t.length-1]?t[t.length-1]:null;if(!i)return e;e.then(e=>i(null,e)).catch(e=>i(e))})(i.apply(this,e),e)}:"object"==typeof i?b(Object.assign(Object.create(f(e.options)),i,{plugin:t})):i:!1===e.plugin?b(Object.assign(Object.create(f(e.options)),{},{plugin:t})):function(...i){return i.unshift(t),e.call.apply(this,i)}}});var y=e=>(void 0===e.token&&"undefined"!=typeof window&&window.thunder&&"function"==typeof window.thunder.token&&(e.token=window.thunder.token()),v=u(e),b({...f(e),...h}));class E{constructor(e){this.prefixForService="Service",this.mainDiv=document.getElementById("main"),this.socket=null,this.plugins=void 0,this.host=e.split(":"),this.host[1]||(this.host[1]=80),this.t=y({host:this.host[0],port:this.host[1]}),this.socketListeners={},this.activePrefix=null,this.servicesAvailableInJsonRPC=["DeviceInfo","DHCPServer","DIALServer","LocationSync","MessageControl","Messenger","Monitor","NetworkControl","OCDM","RemoteControl","Spark","Streamer","SystemCommands","TestController","TestUtility","TimeSync","TraceControl","WebKitBrowser","WifiControl","LinearPlaybackControl"]}setActivePrefix(e){this.activePrefix=e}getPrefixedPlugin(e){return this.activePrefix?e.includes("/")?e:this.activePrefix+"/"+e:e}handleRequest(e,t,i,n){var s=new XMLHttpRequest;s.open(e,t,!0),n&&(s.onreadystatechange=function(){if(4==s.readyState)if(s.status>=200&&s.status<=299){var e;if(""!==s.responseText)try{e=JSON.parse(s.responseText.replace(/\\x([0-9A-Fa-f]{2})/g,""))}catch(e){}n(null,e,s.status)}else s.status>=300?n(s.responseText,null):0===s.status&&n("Connection interrupted",null)},s.ontimeout=function(){n("Connection timed out",null)}),null!==i?"string"==typeof i||i instanceof String?s.send(i):s.send(JSON.stringify(i)):s.send()}getURLStart(e,t){return e+"://"+this.host[0]+":"+this.host[1]+"/"+this.prefixForService+"/"}req(e,t,i={}){return new Promise((n,s)=>{if(t){const o=i.skipPrefix?t.plugin:this.getPrefixedPlugin(t.plugin);console.debug(` ${o}.1.${t.method}`,t.params?t.params:""),this.t.call(o,t.method,t.params).then(e=>{n(e)}).catch(i=>{e?(console.debug(` ${t.plugin}.1.${t.method} failed, trying ${e.method} ${e.path}`),console.debug(" Error: ",i),this.handleRequest(e.method,this.getURLStart("http")+e.path,e.body,(e,t)=>{e?s(e):n(t)})):(console.error("JSONRPC Error, with no fallback: ",i),s(i))})}else{if(void 0===e)return s("No rest or jsonrpc options provided, bailing out");this.handleRequest(e.method,this.getURLStart("http")+e.path,e.body,(e,t)=>{e?s(e):n(t)})}})}getControllerPlugins(){if(void 0!==this.plugins)return Promise.resolve(this.plugins);return this.req(null,{plugin:"Controller",method:"status"}).then(e=>(this.plugins=e,e))}startWebShell(e){e(null,new WebSocket(this.getURLStart("ws")+"WebShell","raw"))}startWebSocket(){this.socket&&this.socket.close(),this.socket=new WebSocket(this.getURLStart("ws")+"Controller","notification");var e=this;this.socket.onmessage=function(t){var i={};try{if(void 0===(i=JSON.parse(t.data)).callsign)return;for(var n=0;n&"']/g,"")}var k=class{constructor(e,t){this.api=t,this.plugins=e,this.top=document.getElementById("top"),this.renderInMenu=!1;const i=localStorage.getItem("thunderUI_selectedInstance");this.selectedInstance=i?x(i):null;const n=localStorage.getItem("thunderUI_currentPlugin");this.currentPlugin=n?x(n):null,this.selectedInstance&&this.api.setActivePrefix(this.selectedInstance),this.compositeControllerListeners=new Map,this.renderTimeout=null,this.pluginStateCaches=new Map,window.menu=this;var s=document.getElementsByTagName("body")[0];try{document.createEvent("TouchEvent"),this.nav.style.left="-600px",s.classList.remove("desktop"),s.className="touch",this.isTouchDevice=!0}catch(e){}this.header=document.createElement("div"),this.header.id="header",this.header.className="header";const o=document.createElement("div");o.id="button-left",o.className="fa fa-bars left",this.header.appendChild(o);const l=document.createElement("img");l.id="header-logo",l.src="img/ml.svg",l.alt="Metrological",l.onerror=function(){this.src="UI/img/ml.svg"},this.header.appendChild(l),this.instanceButtonsContainer=document.createElement("div"),this.instanceButtonsContainer.id="instance-buttons",this.instanceButtonsContainer.className="instance-buttons",this.instanceButtonsContainer.style.display="none",this.header.appendChild(this.instanceButtonsContainer),this.top.appendChild(this.header),this.nav=document.getElementById("menu"),this.nav||(this.nav=document.createElement("div"),this.nav.id="menu",this.nav.className="navigation",this.top.appendChild(this.nav)),o.onclick=this.showMenu.bind(this),window.onresize=function(){if(!0!==this.isTouchDevice){var e=document.getElementById("menu");window.innerWidth>960?e.style.left="0px":e.style.left="-600px"}},this.api.t.on("Controller","statechange",e=>{const t=e.callsign,i=e.state||(e.params?e.params.state:void 0);if(t&&i){const e=i.charAt(0).toUpperCase()+i.slice(1).toLowerCase();t.includes("/")||this._getInstanceCache(null).set(t,e),this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout(()=>{this.renderTimeout=null,this.render(this.currentPlugin)},100)}}),this.setupCompositeControllerListeners(),this.currentPlugin&&setTimeout(()=>{this.currentPlugin&&He(this.currentPlugin)},100)}setupCompositeControllerListeners(){this.api.req(null,{plugin:"Controller",method:"status"},{skipPrefix:!0}).then(e=>{const t=new Set;e.forEach(e=>{const i=e.callsign,n=i.indexOf("/");if(-1!==n){const e=i.substring(0,n)+"/Controller";t.add(e)}}),t.forEach(e=>{if(this.compositeControllerListeners.has(e))return;const t=this.api.t.on(e,"statechange",t=>{const i=t.callsign,n=t.state||(t.params?t.params.state:void 0);if(!i||!n)return;const s=e.substring(0,e.lastIndexOf("/")),o=s+"/"+i,l=n.charAt(0).toUpperCase()+n.slice(1).toLowerCase();this._getInstanceCache(s).set(o,l),this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout(()=>{this.renderTimeout=null,this.render(this.currentPlugin)},100)});this.compositeControllerListeners.set(e,t)})})}_getInstanceCache(e){return this.pluginStateCaches.has(e)||this.pluginStateCaches.set(e,new Map),this.pluginStateCaches.get(e)}clear(){const e=this.nav.querySelector("ul");e&&e.remove()}_extractInstancesFromPlugins(e){const t=[];for(const i of e){const n=i.callsign;if(n.includes("/"))continue;if("Deactivated"===i.state)continue;e.some(e=>e.callsign.startsWith(n+"/")&&e.callsign!==n)&&!t.includes(n)&&t.push(n)}return t}getAvailableInstances(e){return this._extractInstancesFromPlugins(e)}switchInstance(e){if(this.selectedInstance=e,this.selectedInstance?localStorage.setItem("thunderUI_selectedInstance",this.selectedInstance):localStorage.removeItem("thunderUI_selectedInstance"),this.api.setActivePrefix(this.selectedInstance),this.currentPlugin){const e="/",t=this.currentPlugin.indexOf(e),i=-1!==t?this.currentPlugin.substring(t+1):this.currentPlugin;let n;n=null===this.selectedInstance?i:this.selectedInstance+e+i;const s={plugin:"Controller",method:"status"};this.api.req(null,s,{skipPrefix:!0}).then(e=>{e.some(e=>e.callsign===n&&"Deactivated"!==e.state)?(this.currentPlugin=n,localStorage.setItem("thunderUI_currentPlugin",n),this.render(n),He(n)):(console.debug(`Plugin ${n} not found in selected instance`),this.currentPlugin=null,localStorage.removeItem("thunderUI_currentPlugin"),this.render())})}else this.render();this.updateInstanceButtonHighlight()}updateInstanceButtonHighlight(){this.instanceButtonsContainer.querySelectorAll(".instance-button").forEach(e=>{(""===e.dataset.instance?null:e.dataset.instance)===this.selectedInstance?e.classList.add("active"):e.classList.remove("active")})}updateInstanceButtons(e){if(e.length>0){for(this.instanceButtonsContainer.style.display="flex";this.instanceButtonsContainer.firstChild;)this.instanceButtonsContainer.removeChild(this.instanceButtonsContainer.firstChild);const t=document.createElement("button");t.className="instance-button"+(null===this.selectedInstance?" active":""),t.textContent="Local",t.dataset.instance="",t.onclick=()=>this.switchInstance(null),this.instanceButtonsContainer.appendChild(t),e.forEach(e=>{const t=document.createElement("button");t.className="instance-button"+(this.selectedInstance===x(e)?" active":""),t.textContent=S(e),t.dataset.instance=e,t.onclick=()=>this.switchInstance(e),this.instanceButtonsContainer.appendChild(t)})}else this.instanceButtonsContainer.style.display="none"}render(e){let t;if(null===this.selectedInstance){const e={plugin:"Controller",method:"status"};t=this.api.req(null,e)}else{const e="/",i=this.selectedInstance+e+"Controller";t=this.api.req(null,{plugin:i,method:"status"},{skipPrefix:!0}).catch(e=>{console.warn("Failed to query composite controller:",i,e),this.selectedInstance=null,localStorage.removeItem("thunderUI_selectedInstance");return this.api.req(null,{plugin:"Controller",method:"status"})}).then(e=>{if(null===this.selectedInstance)return e;return(e.plugins||e).map(e=>({...e,callsign:this.selectedInstance+"/"+e.callsign}))})}t.then(t=>{this.clear();const i=Object.keys(this.plugins);this.api.req(null,{plugin:"Controller",method:"status"},{skipPrefix:!0}).then(e=>{const t=this.getAvailableInstances(e);this.updateInstanceButtons(t),this.setupCompositeControllerListeners()});let n=document.createElement("ul");for(let o=0;o\n \n -\n \n\n
      \n \n -\n
      \n\n
      \n \n -\n
      \n\n
      \n \n -\n
      \n\n
      \n \n -\n /\n -\n
      \n\n
      \n \n -\n /\n -\n
      \n\n
      \n \n -\n
      \n\n hide statistics\n ',this.versionSpan=document.getElementById("statusBarVersion"),this.uptimeSpan=document.getElementById("statusBarUptime"),this.serialSpan=document.getElementById("statusBarSerial"),this.cpuLoadSpan=document.getElementById("statusBarCpuLoad"),this.usedRamSpan=document.getElementById("statusBarUsedRam"),this.totalRamSpan=document.getElementById("statusBarTotalRam"),this.gpuUsedRamSpan=document.getElementById("statusBarGpuRamUsed"),this.gpuTotalRamSpan=document.getElementById("statusBarGpuRamTotal"),document.getElementById("pause-button").onclick=this.togglePause.bind(this),this.pauseButton=document.getElementById("pause-button"),void 0!==this.deviceInfo?(this.interval=setInterval(this.update.bind(this),I.refresh_interval),this.update(),this.updateStatisticsBlock(),this.api.t.on("connect",()=>{this.deviceIsConnected(!0)}),this.api.t.on("disconnect",()=>{this.deviceIsConnected(!1)})):this.togglePause()}render(e){void 0!==e&&(this.versionSpan.innerHTML=e.version,this.serialSpan.innerHTML=e.serialnumber,this.uptimeSpan.innerHTML=e.uptime,this.totalRamSpan.innerHTML=this.bytesToMbString(e.totalram),this.usedRamSpan.innerHTML=this.bytesToMbString(e.totalram-e.freeram),this.gpuTotalRamSpan.innerHTML=this.bytesToMbString(e.totalgpuram),this.gpuUsedRamSpan.innerHTML=this.bytesToMbString(e.totalgpuram-e.freegpuram),this.cpuLoadSpan.innerHTML=parseFloat(e.cpuload).toFixed(1)+" %")}update(){!1===this.connected&&this.deviceInfo.status().catch(e=>{}),!0===this.paused||this.deviceInfo&&"Activated"!==this.deviceInfo.state||this.deviceInfo&&this.deviceInfo.status().then(this.render.bind(this))}updateStatisticsBlock(){this.pauseButton.innerHTML=!1===this.paused?"hide statistics":"show statistics";var e=this.footer.getElementsByClassName("status"),t=0;if(!1===this.paused){for(;t\n
      No connection with device
      \n
      Attempting to connect
      \n ',t.style.display="block"),this.connected=e}}bytesToMbString(e){return(e/1024/1024).toFixed(1)+" MB"}};var B=class{constructor(e){this.renderInMenu=!1,this.api=e,this.api.t.on("Controller","all",this.handleNotification),document.getElementById("hide-notifications").onclick=this.toggleVisibility.bind(this)}handleNotification(e){document.getElementById("notifications-block").style.display="block";var t=document.createElement("div"),i="";for(var n in e)if("Monitor"===e[n]&&(t.className="red"),"callsign"===n){var s=document.createElement("label");s.innerHTML=e[n],t.appendChild(s)}else"event"===n?i+=n+': "'+e[n]+'"':"params"===n&&(i+=", "+n+": "+JSON.stringify(e[n],null,1).replace(/"(\w+)"\s*:/g,"$1:").replace(/\n/g,""));var o=document.createElement("span");o.innerHTML=i,t.appendChild(o),document.getElementById("notifications").appendChild(t),document.getElementById("notifications").scrollTop=document.getElementById("notifications").scrollHeight}toggleVisibility(){var e="block"===document.getElementById("notifications").style.display;document.getElementById("notifications").style.display=e?"none":"block",document.getElementById("hide-notifications").innerHTML=e?"show console":"hide console"}};var T=class{constructor(e,t){this.api=t,this.callsign=e.callsign,this.configuration=e.configuration,this.classname=e.classname,this.state=e.state,this.supportsSuspended=!1,this.supportsVisibility=!1,this.renderInMenu=!0,this.displayName=void 0,this.rendered=!1}activate(e){const t={plugin:"Controller",method:"activate",params:{callsign:e||this.callsign}};return this.api.req(null,t)}deactivate(e){const t={plugin:"Controller",method:"deactivate",params:{callsign:e||this.callsign}};return this.api.req(null,t)}suspend(e){const t={plugin:"Controller",method:"suspend",params:{callsign:e||this.callsign}};return this.api.req(null,t)}resume(e){const t={plugin:"Controller",method:"resume",params:{callsign:e||this.callsign}};return this.api.req(null,t)}status(e){const t={plugin:e||this.callsign,method:"status"};return this.api.req(null,t)}render(){this.rendered=!0}close(){this.rendered=!1}};var L=class extends T{constructor(e,t){super(e,t),this.monitored=!1,this.displayName="Activity Monitor"}render(){document.getElementById("main").innerHTML='\n
      \n Memory Usage for all Apps\n
      \n
      \n \n
      \n
      \n
        \n
        \n
        \n Application Memory Usage\n
        \n
        \n PID\n
        \n
        \n \n \n
        \n
        \n App Name\n
        \n
        \n -\n
        \n
        \n Memory MB\n
        \n
        \n -\n
        \n
        \n Monitoring Applications\n
        \n
        \n PID (needed)\n
        \n
        \n \n
        \n
        \n Memory Threshold MB\n
        \n
        \n \n
        \n \n
        \n CPU Threshold Percent\n
        \n
        \n \n
        \n
        \n CPU Threshold Sec\n
        \n
        \n \n
        \n
        \n Memory Interval Sec (needed)\n
        \n
        \n \n
        \n
        \n CPU Interval Sec\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n
        \n ',this.pid_monitor=document.getElementById("pid_monitor"),this.memory_Threshold_MB=document.getElementById("memory_Threshold_MB"),this.cpu_Threshold_Percent=document.getElementById("cpu_Threshold_Percent"),this.cpu_Threshold_Second=document.getElementById("cpu_Threshold_Second"),this.memory_Interval_Seconds=document.getElementById("memory_Interval_Seconds"),this.cpu_Interval_Seconds=document.getElementById("cpu_Interval_Seconds"),this.enable_monitoring=document.getElementById("enable_monitoring"),this.enable_monitoring.onclick=this.doMonitoring.bind(this),this.pid=document.getElementById("pid"),this.app_name=document.getElementById("app_name"),this.memory_mb=document.getElementById("memory_mb"),this.set_pid=document.getElementById("set_pid"),this.set_pid.onclick=this.showMemoryUsage.bind(this),this.memory_all=document.getElementById("memory_all"),this.memory_all.onclick=this.showMemoryUsageAll.bind(this),this.memory_usage=document.getElementById("memory_usage"),this.threshold_reached=document.getElementById("threshold_reached"),this.onMemoryThresholdOccurred=this.api.t.on(this.callsign,"onMemoryThresholdOccurred",this.memoryThresholdReached.bind(this)),this.onCPUThresholdOccurred=this.api.t.on(this.callsign,"onCPUThresholdOccurred",this.cpuThresholdReached.bind(this))}memoryThresholdReached(){this.threshold_reached.innerHTML="Reached Memory Threshold",setTimeout(this.removeMessage,2e3)}cpuThresholdReached(){this.threshold_reached.innerHTML="Reached CPU Threshold",setTimeout(this.removeMessage,2e3)}removeMessage(){this.threshold_reached.innerHTML=""}doMonitoring(){this.enable_monitoring.disabled=!0,"Enable Monitoring"==this.enable_monitoring.innerHTML?""!=this.pid_monitor.value&&""!=this.memory_Interval_Seconds.value?this.enableMonitoring(this.pid_monitor.value,this.memory_Threshold_MB.value,this.cpu_Threshold_Percent.value,this.cpu_Threshold_Second.value,this.memory_Interval_Seconds.value,this.cpu_Interval_Seconds.value).then(e=>{e.success?(this.enable_monitoring.innerHTML="Disable Monitoring",this.monitored=!0,this.enable_monitoring.disabled=!1):(alert("Failed to enable monitoring"),this.enable_monitoring.disabled=!1)}):""==this.pid_monitor.value&&""==this.memory_Interval_Seconds.value?(alert("Please provide PID and memory interval second to enable monitoring"),this.enable_monitoring.disabled=!1):""==this.pid_monitor.value?(alert("Please provide PID value to enable monitoring"),this.enable_monitoring.disabled=!1):""==this.memory_Interval_Seconds.value&&(alert("Please provide memory interval seconds to enable monitoring"),this.enable_monitoring.disabled=!1):this.disableMonitoring().then(e=>{e.success?(this.enable_monitoring.innerHTML="Enable Monitoring",this.monitored=!1,this.enable_monitoring.disabled=!1):(alert("Failed to disable monitoring"),this.enable_monitoring.disabled=!1)})}showMemoryUsage(){this.getApplicationMemoryUsage(this.pid.value).then(e=>{1==e.success&&(this.app_name.innerHTML=e.applicationMemory.appName,this.memory_mb.innerHTML=e.applicationMemory.memoryMB)})}showMemoryUsageAll(){if(this.memory_all.disabled=!0,"Show"==this.memory_all.innerHTML)this.getAllMemoryUsage().then(e=>{if(null!=e){this.length=e.applicationMemory.length;for(var t=0;t{this.monitored=!1}),this.onMemoryThresholdOccurred&&"function"==typeof this.onMemoryThresholdOccurred.dispose&&(this.onMemoryThresholdOccurred.dispose(),this.onMemoryThresholdOccurred=null),this.onCPUThresholdOccurred&&"function"==typeof this.onCPUThresholdOccurred.dispose&&(this.onCPUThresholdOccurred.dispose(),this.onCPUThresholdOccurred=null)}};var C=class extends T{constructor(e,t){super(e,t),this.displayName="AV Input"}render(){document.getElementById("main").innerHTML='\n
        \n AV Input details\n
        \n
        \n Number of Inputs\n
        \n
        \n -\n
        \n
        \n Current Video Mode\n
        \n
        \n -\n
        \n
        \n Content Protected\n
        \n
        \n -\n
        \n
        \n Active input\n
        \n
        \n -\n
        \n ',this.inputs=document.getElementById("inputs"),this.video_mode=document.getElementById("video_mode"),this.content_protected=document.getElementById("content_protected"),this.active_input=document.getElementById("active_input"),this.onAVInputActive=this.api.t.on(this.callsign,"onAVInputActive",e=>{this.active_input.innerHTML=e.url}),this.onAVInputInActive=this.api.t.on(this.callsign,"onAVInputInActive",e=>{this.active_input.innerHTML="-"}),this.update()}numberOfInputs(){const e={plugin:this.callsign,method:"numberOfInputs"};return this.api.req(null,e)}numberOfInputs(){const e={plugin:this.callsign,method:"numberOfInputs"};return this.api.req(null,e)}currentVideoMode(){const e={plugin:this.callsign,method:"currentVideoMode"};return this.api.req(null,e)}contentProtected(){const e={plugin:this.callsign,method:"contentProtected"};return this.api.req(null,e)}update(){this.numberOfInputs().then(e=>{this.inputs.innerHTML=e.numberOfInputs}),this.currentVideoMode().then(e=>{this.video_mode.innerHTML=e.currentVideoMode}),this.contentProtected().then(e=>{this.content_protected.innerHTML=e.isContentProtected})}close(){this.onAVInputActive&&"function"==typeof this.onAVInputActive.dispose&&(this.onAVInputActive.dispose(),this.onAVInputActive=null),this.onAVInputInActive&&"function"==typeof this.onAVInputInActive.dispose&&(this.onAVInputInActive.dispose(),this.onAVInputInActive=null)}};var w=class extends T{constructor(e,t){super(e,t),this._devices=[],this.scanning=new Set,this.discoverable=new Set,this.displayName="BluetoothControl"}render(){document.getElementById("main").innerHTML='\n
        \n Status\n
        \n\n
        \n Scanning\n
        \n
        \n
        \n
        \n Discoverable\n
        \n
        \n
        \n\n
        \n Device\n
        \n
        \n Select device\n
        \n
        \n \n
        \n
        \n Name\n
        \n
        \n -\n
        \n
        \n Type\n
        \n
        \n -\n
        \n
        \n Connected\n
        \n
        \n -\n
        \n
        \n Paired\n
        \n
        \n -\n
        \n\n
        Controls
        \n
        \n \n \n \n \n \n \n
        \n\n
        BLE Remote Control Unit
        \n
        \n \n \n
        \n\n
        BR/EDR Audio Sink
        \n
        \n \n \n
        \n\n
        \n Discovery\n
        \n
        Bluetooth LowEnergy
        \n
        \n
        \n \n \n
        \n
        \n
        Scan
        \n
        \n \n \n
        \n
        Visibility
        \n
        \n \n \n
        \n
        \n\n
        \n ',this.startScanButton=document.getElementById("BT_StartScan"),this.stopScanButton=document.getElementById("BT_StopScan"),this.setDiscoverableButton=document.getElementById("BT_SetDiscoverable"),this.stopDiscoverableButton=document.getElementById("BT_StopDiscoverable"),this.pairButton=document.getElementById("BT_Pair"),this.unpairButton=document.getElementById("BT_Unpair"),this.abortPairingButton=document.getElementById("BT_AbortPairing"),this.forgetButton=document.getElementById("BT_Forget"),this.connectButton=document.getElementById("BT_Connect"),this.disconnectButton=document.getElementById("BT_Disconnect"),this.btLowEnergyButton=document.getElementById("BT_LE"),this.assignRemoteButton=document.getElementById("BT_AssignRemote"),this.revokeRemoteButton=document.getElementById("BT_RevokeRemote"),this.assignAudioSinkButton=document.getElementById("BT_AssignAudioSink"),this.revokeAudioSinkButton=document.getElementById("BT_RevokeAudioSink"),this.deviceList=document.getElementById("BT_Devices"),this.deviceList.onchange=this.renderDevice.bind(this),this.startScanButton.onclick=this.startScan.bind(this),this.stopScanButton.onclick=this.stopScan.bind(this),this.setDiscoverableButton.onclick=this.setDiscoverable.bind(this),this.stopDiscoverableButton.onclick=this.stopDiscoverable.bind(this),this.pairButton.onclick=this.pairDevice.bind(this),this.unpairButton.onclick=this.unpairDevice.bind(this),this.abortPairingButton.onclick=this.abortPairingDevice.bind(this),this.forgetButton.onclick=this.forgetDevice.bind(this),this.disconnectButton.onclick=this.disconnect.bind(this),this.connectButton.onclick=this.connect.bind(this),this.assignRemoteButton.onclick=this.assignRemote.bind(this),this.revokeRemoteButton.onclick=this.revokeRemote.bind(this),this.assignAudioSinkButton.onclick=this.assignAudioSink.bind(this),this.revokeAudioSinkButton.onclick=this.revokeAudioSink.bind(this),this.nameEl=document.getElementById("BT_Name"),this.typeEl=document.getElementById("BT_Type"),this.connectedEl=document.getElementById("BT_Connected"),this.pairedEl=document.getElementById("BT_Paired"),this.scanningStatus=document.getElementById("BT_Scanning"),this.discoverableStatus=document.getElementById("BT_Discoverable"),this.statusMessages=document.getElementById("statusMessages"),this.scanStartedListener=this.api.t.on("BluetoothControl","scanstarted",this.scanStarted.bind(this)),this.scanCompleteListener=this.api.t.on("BluetoothControl","scancomplete",this.scanComplete.bind(this)),this.discoverableStartedListener=this.api.t.on("BluetoothControl","discoverablestarted",this.discoverableStarted.bind(this)),this.discoverableCompleteListener=this.api.t.on("BluetoothControl","discoverablecomplete",this.discoverableComplete.bind(this)),this.deviceStateListener=this.api.t.on("BluetoothControl","devicestatechange",this.deviceUpdated.bind(this)),this.update(!0)}deviceUpdated(e){this.renderDevice(),this.updateStatus(`${e.address} is ${e.state}`)}scanStarted(e){this.scanning.add(e.type),this.update(),this.updateStatus(e.type+" scan in progress...")}scanComplete(e){this.scanning.delete(e.type),this.update(!0),this.updateStatus(e.type+" scan complete")}discoverableStarted(e){this.discoverable.add(e.type),this.update(),this.updateStatus(e.type+" adapter now discoverable...")}discoverableComplete(e){this.discoverable.delete(e.type),this.update(),this.updateStatus(e.type+" adapter no longer discoverable")}devices(){return this.api.req(null,{plugin:"BluetoothControl",method:"getdevicelist"}).then(e=>{if(void 0!==e)return this._devices=[],e&&e.length&&e.forEach(e=>{this._devices.push({address:e.address,type:e.type})}),this._devices})}device(e,t){const i={plugin:"BluetoothControl",method:"getdeviceinfo",params:{address:e,type:t}};return this.api.req(null,i)}updateDeviceList(){this.deviceList.innerHTML="",this._devices&&this._devices.length&&(this._devices.forEach(e=>{this.deviceList.appendChild(document.createElement("option")).innerHTML=e.address}),this.renderDevice())}renderDevice(){let e=this.deviceList.selectedIndex;if(-1===e||0===this._devices.length)return this.nameEl.innerHTML="-",this.typeEl.innerHTML="-",this.connectedEl.innerHTML="-",void(this.pairedEl.innerHTML="-");let t=this._devices[e].address,i=this._devices[e].type;this.device(t,i).then(i=>{i&&(this._devices[e]={address:t,...i}),this.nameEl.innerHTML=this._devices[e].name,this.typeEl.innerHTML=this._devices[e].type,this.connectedEl.innerHTML=this._devices[e].connected,this.pairedEl.innerHTML=this._devices[e].paired})}updateStatus(e,t=!1){window.clearTimeout(this.statusMessageTimer),this.statusMessages.innerHTML=e,this.statusMessages.style=t?"color: red":"",this.statusMessageTimer=setTimeout(this.updateStatus,5e3,"")}update(e=!1){this.scanningStatus.innerHTML=0==this.scanning.size?"idle":Array.from(this.scanning).join(", "),this.discoverableStatus.innerHTML=0==this.discoverable.size?"idle":Array.from(this.discoverable).join(", "),e&&this.devices().then(()=>{this.updateDeviceList()})}startScan(){const e={plugin:"BluetoothControl",method:"scan",params:{type:this.btLowEnergyButton.checked?"LowEnergy":"Classic",timeout:12}};this.api.req(null,e).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}stopScan(){const e={plugin:"BluetoothControl",method:"stopscanning",params:{type:this.btLowEnergyButton.checked?"LowEnergy":"Classic"}};this.api.req(null,e).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}setDiscoverable(){const e={plugin:"BluetoothControl",method:"setdiscoverable",params:{type:this.btLowEnergyButton.checked?"LowEnergy":"Classic",timeout:30}};this.api.req(null,e).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}stopDiscoverable(){const e={plugin:"BluetoothControl",method:"stopdiscoverable",params:{type:this.btLowEnergyButton.checked?"LowEnergy":"Classic"}};this.api.req(null,e).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}pairDevice(){var e=this.deviceList.selectedIndex;this.updateStatus("Pairing to "+this._devices[e].name);const t={plugin:this.callsign,method:"pair",params:{address:this._devices[e].address,type:this._devices[e].type}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}unpairDevice(){var e=this.deviceList.selectedIndex;this.updateStatus("Unpairing "+this._devices[e].name);const t={plugin:this.callsign,method:"unpair",params:{address:this._devices[e].address,type:this._devices[e].type}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}abortPairingDevice(){var e=this.deviceList.selectedIndex;this.updateStatus("Aborting pairing to "+this._devices[e].name);const t={plugin:this.callsign,method:"abortpairing",params:{address:this._devices[e].address,type:this._devices[e].type}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}forgetDevice(){var e=this.deviceList.selectedIndex;this.updateStatus("Removing "+this._devices[e].name);const t={plugin:this.callsign,method:"forget",params:{address:this._devices[e].address,type:this._devices[e].type}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)}),this.update(!0)}connect(){var e=this.deviceList.selectedIndex;this.updateStatus("Connecting to "+this._devices[e].name);const t={plugin:this.callsign,method:"connect",params:{address:this._devices[e].address,type:this._devices[e].type}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}disconnect(){var e=this.deviceList.selectedIndex;this.updateStatus("Disconnecting from "+this._devices[e].name);const t={plugin:this.callsign,method:"disconnect",params:{address:this._devices[e].address,type:this._devices[e].type}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}assignRemote(){var e=this.deviceList.selectedIndex;this.updateStatus(`Assigning ${this._devices[e].name} as BLE remote control unit`);const t={plugin:"BluetoothRemoteControl",method:"assign",params:{address:this._devices[e].address}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}revokeRemote(){var e=this.deviceList.selectedIndex;this.updateStatus("Revoking BLE remote "+this._devices[e].name);const t={plugin:"BluetoothRemoteControl",method:"revoke",params:{address:this._devices[e].address}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}assignAudioSink(){var e=this.deviceList.selectedIndex;this.updateStatus(`Assigning ${this._devices[e].name} as BR/EDR audio sink`);const t={plugin:"BluetoothAudio",method:"sink::assign",params:{address:this._devices[e].address}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}revokeAudioSink(){var e=this.deviceList.selectedIndex;this.updateStatus("Revoking BR/EDR audio sink "+this._devices[e].name);const t={plugin:"BluetoothAudio",method:"sink::revoke",params:{address:this._devices[e].address}};this.api.req(null,t).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!0)})}close(){clearInterval(this.statusMessageTimer),this.scanStartedListener&&"function"==typeof this.scanStartedListener.dispose&&this.scanStartedListener.dispose(),this.scanCompleteListener&&"function"==typeof this.scanCompleteListener.dispose&&this.scanCompleteListener.dispose(),this.discoverableStartedListener&&"function"==typeof this.discoverableStartedListener.dispose&&this.discoverableStartedListener.dispose(),this.discoverableCompleteListener&&"function"==typeof this.discoverableCompleteListener.dispose&&this.discoverableCompleteListener.dispose(),this.deviceStateListener&&"function"==typeof this.deviceStateListener.dispose&&this.deviceStateListener.dispose()}};const D={all:"DEFAULT",in:"SMARTPHONE, TABLET",out:"LOUDSPEAKER, HEADPHONES, WEARABLE HEADSET, HIFI AUDIO DEVICE",hid:" KEYBOARD, MOUSE, JOYSTICK",handsfree:'HANDSFREE"',tile:" LE, LE TILE"};var P=class extends T{constructor(e,t){super(e,t),this._devices=[],this.scanning=!1,this.displayName="Bluetooth"}render(){document.getElementById("main").innerHTML='\n
        Discovery
        \n
        Scan
        \n
        \n \n
        \n
        \n \n
        \n
        Status
        \n
        Scanning
        \n
        OFF
        \n\n
        Devices
        \n
        \n \n
        \n
        Device
        \n
        Name
        \n
        -
        \n
        Type
        \n
        -
        \n
        Connected
        \n
        -
        \n
        Paired
        \n
        -
        \n
        Controls
        \n
        \n \n \n \n \n
        \n
        \n
        \n ',this.scanButton=document.getElementById("BT_ScanForDevices"),this.pairButton=document.getElementById("BT_Pair"),this.unpairButton=document.getElementById("BT_Unpair"),this.connectButton=document.getElementById("BT_Connect"),this.disconnectButton=document.getElementById("BT_Disconnect"),this.deviceList=document.getElementById("BT_Devices"),this.deviceList.onchange=this.renderDevice.bind(this),this.scanButton.onclick=this.scanForDevices.bind(this),this.pairButton.onclick=this.pairDevice.bind(this),this.unpairButton.onclick=this.unpairDevice.bind(this),this.disconnectButton.onclick=this.disconnect.bind(this),this.connectButton.onclick=this.connect.bind(this),this.connectButton.style.display="none",this.disconnectButton.style.display="none",this.pairButton.style.display="none",this.unpairButton.style.display="none",this.nameEl=document.getElementById("BT_Name"),this.typeEl=document.getElementById("BT_Type"),this.connectedEl=document.getElementById("BT_Connected"),this.pairedEl=document.getElementById("BT_Paired"),this.profileValue=document.getElementById("profile"),this.scanningStatus=document.getElementById("BT_Scanning"),this.statusMessages=document.getElementById("statusMessages"),this.deviceList=document.getElementById("BT_Devices"),this.scanListener=this.api.t.on(this.callsign,"onDiscoveredDevice",this.scanComplete.bind(this)),this.complete=this.api.t.on(this.callsign,"onStatusChanged",e=>{this.statusUpdate(e),this.update()}),this.deviceStateListener=this.api.t.on(this.callsign,"onPairingRequest",e=>{e.pinRequired?this.updateStatus("Enter pairing code:"+e.pinValue):this.respondToevent(e.deviceID,"onPairingRequest","Accepted")}),this.update()}statusUpdate(e){switch(e.newStatus){case"DISCOVERY_COMPLETED":this.updateStatus("Scanning Completed"),this.scanningStatus.innerHTML="OFF";break;case"DISCOVERY_STARTED":this.updateStatus("Scanning Started"),this.scanningStatus.innerHTML="ON";break;case"PAIRING_CHANGE":e.paired?this.updateStatus("Paired to "+e.name):this.updateStatus("Unpaired from "+e.name);break;case"CONNECTION_CHANGE":e.connected?this.updateStatus("Connected to "+e.name):this.updateStatus("Disconnected from "+e.name)}}devices(){const e={plugin:this.callsign,method:"getDiscoveredDevices",params:{}};return this.api.req(null,e).then(e=>{if(void 0!==e)return e.discoveredDevices&&e.discoveredDevices.length&&e.discoveredDevices.forEach(e=>{this._pairedID.includes(e.deviceID)||this._devices.push({device:e})}),this._devices})}getPairedDevices(){const e={plugin:this.callsign,method:"getPairedDevices",params:{}};return this.api.req(null,e).then(e=>{this._pairedID=[],e.pairedDevices&&e.pairedDevices.length&&e.pairedDevices.forEach(e=>{this._pairedID.push(e.deviceID),e.paired=!0,this._devices.push({device:e})})})}device(e){const t={plugin:this.callsign,method:"getDeviceInfo",params:{deviceID:e}};return this.api.req(null,t)}scanComplete(){this.scanning=!1,this.update()}updateDeviceList(){this.deviceList.innerHTML="",this._devices&&this._devices.length?(this._devices.forEach(e=>{this.deviceList.appendChild(document.createElement("option")).innerHTML=e.device.name}),this.renderDevice()):this.renderDevice()}renderDevice(){this.connectButton.style.display="none",this.disconnectButton.style.display="none",this.pairButton.style.display="none",this.unpairButton.style.display="none";let e=this.deviceList.selectedIndex;if(-1===e||0===this._devices.length)return this.nameEl.innerHTML="-",this.typeEl.innerHTML="-",this.connectedEl.innerHTML="-",void(this.pairedEl.innerHTML="-");let t=this._devices[e].device;this.device(t.deviceID).then(i=>{i&&(this._devices[e]={device:t,...i.deviceInfo}),this.nameEl.innerHTML=this._devices[e].device.name,this.typeEl.innerHTML=this._devices[e].device.deviceType,this.connectedEl.innerHTML=this._devices[e].device.connected,this.pairedEl.innerHTML=this._devices[e].device.paired,this._devices[e].device.paired&&this._devices[e].device.connected?(this.disconnectButton.style.display="",this.unpairButton.style.display=""):this._devices[e].device.paired&&!this._devices[e].device.connected?(this.connectButton.style.display="",this.unpairButton.style.display=""):this._devices[e].device.paired||(this.pairButton.style.display="")})}updateStatus(e,t=!1,i=!1){window.clearTimeout(this.statusMessageTimer),this.statusMessages.innerHTML=e,this.statusMessages.classList.remove("loading"),t&&this.statusMessages.classList.add("loading"),this.statusMessages.style=i?"color: red":"",this.statusMessageTimer=setTimeout(this.updateStatus,5e3,"")}update(){this._devices=[],this.getPairedDevices().then(()=>{this.devices().then(()=>{this.updateDeviceList()})})}scanForDevices(){this.scanning=!0;const e={plugin:this.callsign,method:"startScan",params:{timeout:10,profile:D[this.profileValue.value]}};return this.api.req(null,e).then(e=>{console.log(e)}).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!1,!0)})}pairDevice(){var e=this.deviceList.selectedIndex;this.updateStatus("Pairing to "+this._devices[e].name,!0);const t={plugin:this.callsign,method:"pair",params:{deviceID:this._devices[e].deviceID}};return this.api.req(null,t).then(e=>{e.success||this.updateStatus("Pairing failed",!1,!0)}).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!1,!0)})}unpairDevice(){var e=this.deviceList.selectedIndex;this.updateStatus("Unpairing "+this._devices[e].name,!0);const t={plugin:this.callsign,method:"unpair",params:{deviceID:this._devices[e].deviceID}};return this.api.req(null,t).then(e=>{e.success||this.updateStatus("Unpairing failed",!1,!0)}).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!1,!0)})}connect(){var e=this.deviceList.selectedIndex;this.updateStatus("Connecting to "+this._devices[e].name,!0);const t={plugin:this.callsign,method:"connect",params:{deviceID:this._devices[e].deviceID,deviceType:this._devices[e].deviceType,profile:this._devices[e].deviceType}};return this.api.req(null,t).then(e=>{e.success||this.updateStatus("Connecting failed",!1,!0)}).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!1,!0)})}disconnect(){var e=this.deviceList.selectedIndex;this.updateStatus("Disconnecting from "+this._devices[e].name,!0);const t={plugin:this.callsign,method:"disconnect",params:{deviceID:this._devices[e].deviceID}};return this.api.req(null,t).then(e=>{e.success||this.updateStatus("Disconnecting failed",!1,!0)}).catch(e=>{e.message&&this.updateStatus("Error: "+e.message,!1,!0)})}respondToevent(e,t,i){const n={plugin:this.callsign,method:"respondToEvent",params:{deviceID:e,eventType:t,responseValue:i}};return this.api.req(null,n).then(e=>{console.log(e)})}close(){clearInterval(this.statusMessageTimer),this.scanListener&&"function"==typeof this.scanListener.dispose&&this.scanListener.dispose(),this.deviceStateListener&&"function"==typeof this.deviceStateListener&&this.deviceStateListener.dispose(),this.complete&&"function"==typeof this.complete.dispose&&this.complete.dispose()}};var H=class extends T{constructor(e,t){super(e,t),this.observablesList=[],this.restartList=[]}getMemoryInfo(e){return this.api.req(null,{plugin:"Monitor",method:"status"})}render(){document.getElementById("main").innerHTML='
        \n \n \n
        Observables
        \n
        \n
        \n
        RestartThreshold
        \n
        \n
        \n
        ',this.getObservableList(),this.observableListEl=document.getElementById("observables"),this.restartListEl=document.getElementById("restart"),this.bt_setRestart=document.getElementById("setRestart"),this.bt_setRestart.onclick=this.setRestartThreshold.bind(this)}getObservableList(){this.status().then(e=>{for(var t=[],i=0;i{this.getMemoryInfo(e).then(s=>{let o=s.filter(t=>t.observable===e||t.name===e||valse);o&&o[0]?t(i.createMonitorDiv(o[0])):n()})})}createMonitorDiv(e){if(void 0!==e.measurment&&(e.measurements=e.measurment),void 0!==e.measurements&&void 0!==e.measurements.resident){var t=e.measurements,i=document.createElement("div"),n=document.createElement("div");for(var s in n.className="title grid__col grid__col--8-of-8",n.innerHTML="Memory",i.appendChild(n),t.resident){var o=document.createElement("div");o.className="label grid__col grid__col--2-of-8",i.appendChild(o);var l=document.createElement("label");l.innerHTML=s,o.appendChild(l);var d=document.createElement("div");d.className="text grid__col grid__col--6-of-8";let e=t.resident[s];t.shared[s]&&(e-=t.shared[s]),d.innerHTML=this.bytesToMbString(e),i.appendChild(d)}var r=document.createElement("div");r.className="label grid__col grid__col--2-of-8",i.appendChild(r);var a=document.createElement("label");a.innerHTML="measurements",r.appendChild(a);var c=document.createElement("div");c.className="text grid__col grid__col--6-of-8",c.innerHTML=t.count,i.appendChild(c);var u=document.createElement("div");u.className="label grid__col grid__col--2-of-8",i.appendChild(u);var h=document.createElement("label");h.innerHTML="process",u.appendChild(h);var _=document.createElement("div");return _.className="text grid__col grid__col--6-of-8",_.innerHTML=t.process.last,i.appendChild(_),i}}bytesToMbString(e){return(e/1024/1024).toFixed(1)+" MB"}};var N=class extends T{constructor(e,t){super(e,t),this._url="",this._fps=0,this._isHidden=!1,this._isSuspended=!1,this.lastSetUrlKey="lastSetUrl",this.lastSetUrl=window.localStorage.getItem(this.lastSetUrlKey)||"",this.inspectorPort="9998",this.monitor=void 0,this.updateLoopInterval=void 0,this.template='
        \n\n
        Presets / URL
        \n\n
        URL
        \n
        -
        \n\n
        \n \n
        \n
        \n \n \n \n
        \n\n
        URL presets
        \n
        \n \n
        \n\n
        Performance
        \n
        FPS
        \n
        -
        \n
        \n\n
        Tools
        \n\n
        Current State
        \n
        \n
        \n
        \n \n
        \n\n
        Web Inspector
        \n
        \n \n
        \n\n
        ',this.presets=[{Name:"Select a preset",URL:""},{Name:"about:blank",URL:"about:blank"},{Name:"Smashcat",URL:"http://www.smashcat.org/av/canvas_test/"},{Name:"HTML5",URL:"http://beta.html5test.com/"},{Name:"PeaceKeeper",URL:"http://peacekeeper.futuremark.com/run.action"},{Name:"ChipTune",URL:"http://www.chiptune.com/kaleidoscope/"},{Name:"Poster Circle",URL:"http://www.webkit.org/blog-files/3d-transforms/poster-circle.html"},{Name:"Aquarium",URL:"http://webglsamples.org/aquarium/aquarium.html"},{Name:"Particles",URL:"http://oos.moxiecode.com/js_webgl/particles_morph/"},{Name:"EME v3 (race car)",URL:"http://cdn.metrological.com/static/eme-v3-clean.html"},{Name:"CMAF",URL:"https://cd-static-qa.bamgrid.com/bbd/player-test/harness-receiver/partners-test-interface.html?hls-player-url=https://cd-static-qa.bamgrid.com/bbd/player-test/players/partners/sky/hls-player-1.5.0-edge-7.js&test-suites-master-url=https://dev-basesite-static.fed-bam.com/mediaplayback-test/test-harness/test-suites/dss-cert-test-streams-suites.json"},{Name:"YouTube TV MSE 2018 (no vp9)",URL:"http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/2018.html?novp9=true"},{Name:"YouTube TV EME 2018",URL:"http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/2018.html?test_type=encryptedmedia-test"},{Name:"YouTube TV EME 2019",URL:"https://ytlr-cert.appspot.com/2019/main.html?test_type=encryptedmedia-test"},{Name:"YouTube TV EME 2020",URL:"https://ytlr-cert.appspot.com/2020/main.html?test_type=encryptedmedia-test"},{Name:"YouTube TV EME 2021",URL:"https://ytlr-cert.appspot.com/2021/main.html?test_type=encryptedmedia-test"},{Name:"Progressive",URL:"http://yt-dash-mse-test.commondatastorage.googleapis.com/unit-tests/2018.html?test_type=progressive-test"},{Name:"YouTube",URL:"http://youtube.com/tv"},{Name:"HelloRacer",URL:"http://www.emerveille.fr/lab/helloracer/index.html"},{Name:"Leaves",URL:"http://www.webkit.org/blog-files/leaves"},{Name:"Canvas Dots",URL:"http://themaninblue.com/experiment/AnimationBenchmark/canvas/"},{Name:"Anisotropic",URL:"http://whiteflashwhitehit.com/content/2011/02/anisotropic_webgl.html"},{Name:"Pasta",URL:"http://alteredqualia.com/three/examples/webgl_pasta.html"},{Name:"CSS3",URL:"http://css3test.com"},{Name:"Kraken",URL:"http://krakenbenchmark.mozilla.org/kraken-1.1/driver.html"},{Name:"KeyPress Test",URL:"http://keycode.info"}],void 0!==this.configuration&&void 0!==this.configuration.inspector&&(this.inspectorPort=this.configuration.inspector.split(":")[1]),this.api.getControllerPlugins().then(e=>{let t=e.filter(e=>"Monitor"===e.callsign);void 0!==t&&(this.monitor=new H(t,this.api))})}status(){const e={plugin:this.callsign,method:"state"};return this.api.req(null,e)}fps(){const e={plugin:this.callsign,method:"fps"};return this.api.req(null,e)}url(){const e={plugin:this.callsign,method:"url"};return this.api.req(null,e)}render(){var e=document.getElementById("main"),t=this.template.replace(/{{callsign}}/g,this.callsign);e.innerHTML=t,document.getElementById(this.callsign+"_url").value=this.lastSetUrl,document.getElementById(this.callsign+"_button").onclick=this.getAndSetUrl.bind(this),document.getElementById(this.callsign+"_reloadbutton").onclick=this.reloadUrl.bind(this),document.getElementById(this.callsign+"_linkPresets").onchange=this.getAndSetUrlFromPresets.bind(this);var i=document.getElementById(this.callsign+"_linkPresets");if(0===i.children.length)for(var n=0;n{e._isSuspended=t.suspended?t.suspended:"suspended"===t}).then(this.fps.bind(this)).then(t=>{e._fps=t.fps?t.fps:t}).then(this.url.bind(this)).then(t=>{e._url=t.url?t.url:t}).then(this.update.bind(this))}close(){window.removeEventListener("keydown",this.handleKey.bind(this),!1),clearInterval(this.updateLoopInterval),delete this.updateLoopInterval,this.rendered=!1}update(){document.getElementById(this.callsign+"_current_url").innerHTML=this._url,document.getElementById(this.callsign+"_fps").innerHTML=this._fps;var e=this._isSuspended?"Suspended":"Resumed",t=this._isSuspended?"Resume":"Suspend";document.getElementById(this.callsign+"StateInfo").innerHTML=e;var i=document.getElementById(this.callsign+"SuspendButton");i.innerHTML=t.toUpperCase(),i.onclick=this.toggleSuspend.bind(this,t),this.monitor&&this.monitor.getMonitorDataAndDiv().then(e=>{var t=document.getElementById(this.callsign+"Memory");t.innerHTML="",t.appendChild(e)})}setUrl(e){if(""===e)return;console.log("Setting url "+e+" for "+this.callsign);const t={plugin:this.callsign,method:"url",params:e};this.api.req(null,t),document.getElementById(this.callsign+"_linkPresets").selectedIndex=0}getAndSetUrl(){this.lastSetUrl=document.getElementById(this.callsign+"_url").value,this.setUrl(this.lastSetUrl),window.localStorage.setItem(this.lastSetUrlKey,this.lastSetUrl)}reloadUrl(){this.setUrl(this._url)}getAndSetUrlFromPresets(){var e=document.getElementById(this.callsign+"_linkPresets").selectedIndex;e>0&&this.setUrl(this.presets[e].URL)}handleKey(e){var t=document.getElementById("WebKitBrowser_url");13===e.which&&t&&t===document.activeElement&&this.getAndSetUrl()}toggleSuspend(e){"Resume"===e?this.resume():this.suspend()}launchWebinspector(){var e="http://"+this.api.host[0]+":"+this.inspectorPort;window.open(e,"_blank").focus()}};var A=class extends N{constructor(e,t){super(e,t),this.template='
        \n\n
        Presets / URL
        \n\n
        URL
        \n
        -
        \n\n
        \n \n
        \n
        \n \n \n \n
        \n\n
        URL presets
        \n
        \n \n
        \n\n
        Performance
        \n
        FPS
        \n
        -
        \n
        \n\n
        Tools
        \n\n
        Current State
        \n
        \n
        \n
        \n \n
        \n\n
        Visibility
        \n
        \n
        \n
        \n \n
        \n\n
        Web Inspector
        \n
        \n \n
        \n\n
        '}};var R=class extends T{constructor(e,t){super(e,t),this.resolutions=["720p","720p50Hz","1080p24Hz","1080i50Hz","1080p50Hz","1080p60Hz","2160p50Hz","2160p60Hz"]}render(){document.getElementById("main").innerHTML='
        \n Compositor\n
        \n
        \n Z-Order\n
        \n
        \n
        \n \n
        \n
        \n \n
        \n
        \n \n
        \n
        \n \n
        \n
        \n\n
        ',document.getElementById("compositorResolutions").onclick=this.setResolution.bind(this),this.resolutionsList=document.getElementById("compositorResolutions"),this.menu=document.getElementById("compositorClients"),this.controlDiv=document.getElementById("controls"),this.compositorClientsDiv=document.getElementById("compositorClientsDiv"),this.controlDiv.style.display="none",this.resolutionsList.innerHTML="";for(var e=0;e{null!=e&&Array.isArray(e)?e.length>0&&this.renderControls(e):this.compositorClientsDiv.innerHTML="No clients found."}),this.zorder().then(e=>{document.getElementById("zorder").innerHTML=e.toString()}),this.resolution().then(e=>{-1!==this.resolutions.indexOf(e)&&(this.resolutionsList.selectedIndex=this.resolutions.indexOf(e))})}getClients(){const e={plugin:this.callsign,method:"zorder"};return this.api.req(null,e)}renderControls(e){this.controlDiv.innerHTML='
        \n Controls\n
        \n
        \n Focus\n
        \n
        \n \n \n
        \n
        \n
        \n Opacity\n
        \n
        \n \n \n
        \n
        \n
        \n \n
        \n
        \n Visibility\n
        \n
        \n \n \n
        \n
        \n
        \n Geometry\n
        \n
        \n X\n
        \n
        \n \n
        \n
        \n Y\n
        \n
        \n \n
        \n
        \n Width\n
        \n
        \n \n
        \n
        \n Height\n
        \n
        \n \n
        \n
        \n
        \n \n
        ',document.getElementById("compositorSetTop").onclick=this.compositorAction.bind(this,"putontop"),document.getElementById("compositorSetInput").onclick=this.compositorAction.bind(this,"select"),document.getElementById("sliderOpacity").onchange=this.updateValue.bind(this,"sliderOpacity","numOpacity"),document.getElementById("numOpacity").onchange=this.updateValue.bind(this,"numOpacity","sliderOpacity"),document.getElementById("numOpacity").onkeyup=this.updateValue.bind(this,"numOpacity","sliderOpacity"),document.getElementById("numOpacity").onpaste=this.updateValue.bind(this,"numOpacity","sliderOpacity"),document.getElementById("numOpacity").oninput=this.updateValue.bind(this,"numOpacity","sliderOpacity"),document.getElementById("compositorSetOpacity").onclick=this.compositorSetOpacity.bind(this),document.getElementById("webkit_hide").onclick=this.compositorVisible.bind(this,"Hide"),document.getElementById("webkit_show").onclick=this.compositorVisible.bind(this,"Show"),document.getElementById("compositorGeometry").onclick=this.compositorSetGeometry.bind(this),document.getElementById("compositorClients").onchange=this.clientChange.bind(this);var t=document.getElementById("compositorClients");t.innerHTML="";var i=document.createElement("option");i.value="",i.setAttributeNode(document.createAttribute("disabled")),i.setAttributeNode(document.createAttribute("selected")),i.innerHTML="Select a client",t.appendChild(i);for(var n=0;n{document.getElementById("compositorXGeometry").value=e.x,document.getElementById("compositorYGeometry").value=e.y,document.getElementById("compositorWidthGeometry").value=e.width,document.getElementById("compositorHeightGeometry").value=e.height})}opacity(e,t){const i={plugin:this.callsign,method:"opacity@"+e};return void 0!==t&&(i.params=t),this.api.req(null,i)}compositorSetOpacity(){var e=this.menu.options[this.menu.selectedIndex].value,t=document.getElementById("sliderOpacity").value;return this.opacity(e,t)}updateValue(e,t){document.getElementById(t).value=document.getElementById(e).value}compositorVisible(e){console.log(e);var t=this.menu.options[this.menu.selectedIndex].value;const i={plugin:this.callsign,method:"visiblity@"+t,params:"Show"===e?"visible":"hidden"};this.api.req(null,i)}geometry(e,t){const i={plugin:this.callsign,method:"geometry@"+e};return void 0!==t&&(i.params={x:parseInt(t.x),y:parseInt(t.y),width:parseInt(t.w),height:parseInt(t.h)}),this.api.req(null,i)}zorder(e){const t={plugin:this.callsign,method:"zorder"};return this.api.req(null,t)}compositorSetGeometry(){const e=this.menu.options[this.menu.selectedIndex].value,t={x:document.getElementById("compositorXGeometry").value,y:document.getElementById("compositorYGeometry").value,w:document.getElementById("compositorWidthGeometry").value,h:document.getElementById("compositorHeightGeometry").value};return this.geometry(e,t)}resolution(e){const t={plugin:this.callsign,method:"resolution"};return void 0!==e&&(t.params=e),this.api.req(null,t)}setResolution(){var e=this.resolutionsList.options[this.resolutionsList.selectedIndex].value;return this.resolution(e)}};var q=class extends T{constructor(e,t){super(e,t),this.displayName="Continue Watching"}render(){document.getElementById("main").innerHTML='\n
        \n Set Application token\n
        \n
        \n Application name\n
        \n
        \n \n
        \n
        \n Token key\n
        \n
        \n \n
        \n
        \n
        \n Token value\n
        \n
        \n \n
        \n
        \n
        \n \n \n
        \n
        \n Get Application token\n
        \n
        \n Application name\n
        \n
        \n \n \n
        \n
        \n Token\n
        \n
        \n -\n
        \n
        \n Delete Application token\n
        \n
        \n Application name\n
        \n
        \n \n \n
        \n ',this.app_name=document.getElementById("app_name"),this.key_value_inputs=document.getElementById("key_value_inputs"),this.set_token=document.getElementById("set_token"),this.set_token.onclick=this.doSetToken.bind(this),this.add_key_value=document.getElementById("add_key_value"),this.add_key_value.onclick=this.addKeyValue.bind(this),this.buttons=document.getElementById("buttons"),this.app_name_token=document.getElementById("app_name_token"),this.get_token=document.getElementById("get_token"),this.get_token.onclick=this.doGetToken.bind(this),this.token=document.getElementById("token"),this.app_name_delete=document.getElementById("app_name_delete"),this.delete_token=document.getElementById("delete_token"),this.delete_token.onclick=this.doDeleteToken.bind(this),this.i=0}doSetToken(){for(var e={},t=0;t<=this.i;t++){var i=document.getElementById("this.token_value"+t).value.trim(),n=document.getElementById("this.token_key"+t).value.trim();""!=i&&""!=n&&(e[document.getElementById("this.token_key"+t).value]=document.getElementById("this.token_value"+t).value)}if(this.app_name.value&&0!=this.app_name.value.trim().length&&"{}"!=JSON.stringify(e))try{this.setApplicationToken(this.app_name.value,e).then(e=>{e&&e.success?alert("Successfully set token"):alert("Failed to set token")})}catch(e){alert("Error in getting response")}else""==this.app_name.value||0==this.app_name.value.trim().length?alert("Please provide app name"):"{}"==JSON.stringify(e)?alert("Please provide token key value pairs"):alert("Please provide application name and token key value pairs")}doGetToken(){if(this.app_name_token.value&&0!=this.app_name_token.value.trim().length)try{this.getApplicationToken(this.app_name_token.value).then(e=>{e&&e.success?this.token.innerHTML=e.application_token:(this.token.innerHTML="-",alert("Failed to get token"))})}catch(e){alert("Error in getting response")}else alert("Please provide app name")}doDeleteToken(){if(this.app_name_delete.value&&0!=this.app_name_delete.value.trim().length)try{this.deleteApplicationToken(this.app_name_delete.value).then(e=>{e&&e.success?alert("Successfully deleted token"):alert("Failed to delete token")})}catch(e){alert("Error in getting response")}else alert("Please provide app name")}addKeyValue(){this.i=this.i+1,1==this.i&&(this.refresh=document.createElement("button"),this.refresh.innerHTML="Refresh",this.refresh.id="refresh_button",this.refresh.onclick=this.refreshApp.bind(this),this.buttons.appendChild(this.refresh));var e=document.createElement("div_key_name");e.className="label grid__col grid__col--2-of-8",e.innerHTML="Token key",e.id="this.div_key_name"+this.i,this.key_value_inputs.appendChild(e);var t=document.createElement("div_key");t.className="label grid__col grid__col--6-of-8",t.id="this.div_key"+this.i;var i=document.createElement("input");i.id="this.token_key"+this.i,t.appendChild(i),this.key_value_inputs.appendChild(t);var n=document.createElement("div_value_name");n.className="label grid__col grid__col--2-of-8",n.innerHTML="Token value",n.id="this.div_value_name"+this.i,this.key_value_inputs.appendChild(n);var s=document.createElement("div_value");s.className="label grid__col grid__col--6-of-8",s.id="this.div_value"+this.i;var o=document.createElement("input");o.id="this.token_value"+this.i,s.appendChild(o),this.key_value_inputs.appendChild(s)}refreshApp(){this.app_name.value="",document.getElementById("this.token_value0").value="",document.getElementById("this.token_key0").value="",document.getElementById("refresh_button").remove();for(var e=1;e<=this.i;e++)document.getElementById("this.token_value"+e).remove(),document.getElementById("this.token_key"+e).remove(),document.getElementById("this.div_value_name"+e).remove(),document.getElementById("this.div_key_name"+e).remove(),document.getElementById("this.div_value"+e).remove(),document.getElementById("this.div_key"+e).remove();this.i=0}setApplicationToken(e,t){const i={plugin:this.callsign,method:"setApplicationToken",params:{applicationName:e,application_token:t}};return this.api.req(null,i)}deleteApplicationToken(){const e={plugin:this.callsign,method:"deleteApplicationToken"};return this.api.req(null,e)}getApplicationToken(e){const t={plugin:this.callsign,method:"getApplicationToken",params:{applicationName:e}};return this.api.req(null,t)}};var U=class extends T{constructor(e,t){super(e,t),this.plugins=void 0,this.mainDiv=void 0,this.controllerListener=void 0}activate(e){const t=e.indexOf("/");let i="Controller",n=e;if(-1!==t){i=e.substring(0,t)+"/Controller",n=e.substring(t+1)}const s={plugin:i,method:"activate",params:{callsign:n}};return this.api.req(null,s).then(i=>(window.menu?(window.menu.pluginStateCache&&window.menu.pluginStateCache.set(e,"Activated"),-1===t?setTimeout(()=>{this.isCompositePlugin(e).then(e=>{e?setTimeout(()=>window.location.reload(),500):window.menu.update()})},1e3):setTimeout(()=>window.menu.update(),200)):window.menu.update(),i))}deactivate(e){const t=e.indexOf("/");let i="Controller",n=e;if(-1!==t){const s=e.substring(0,t);i=s+"/Controller",n=e.substring(t+1)}return(-1===t?this.isCompositePlugin(e):Promise.resolve(!1)).then(s=>this._doDeactivate(i,n,e,t,s))}_doDeactivate(e,t,i,n,s){const o={plugin:e,method:"deactivate",params:{callsign:t}};return this.api.req(null,o).then(e=>(window.menu?(window.menu.pluginStateCache&&window.menu.pluginStateCache.set(i,"Deactivated"),-1===n&&s?setTimeout(()=>window.location.reload(),500):setTimeout(()=>window.menu.update(),200)):window.menu.update(),e))}suspend(e){const t=e.indexOf("/");let i="Controller",n=e;if(-1!==t){i=e.substring(0,t)+"/Controller",n=e.substring(t+1)}const s={plugin:i,method:"suspend",params:{callsign:n}};return this.api.req(null,s)}resume(e){const t=e.indexOf("/");let i="Controller",n=e;if(-1!==t){i=e.substring(0,t)+"/Controller",n=e.substring(t+1)}const s={plugin:i,method:"resume",params:{callsign:n}};return this.api.req(null,s)}controllerStatus(e){const t={plugin:"Controller"};return t.method=e?"status@"+e:"status",api.req(void 0,t)}harakiri(){const e={plugin:"Controller",method:"harakiri",params:{callsign:this.callsign}};return this.api.req(null,e)}initiateDiscovery(){return this.api.req(null,{plugin:"Controller",method:"startdiscovery",params:{ttl:1}})}getDiscovery(){return this.api.req(null,{plugin:"Controller",method:"discoveryresults"})}persist(e){return this.api.req(null,{plugin:"Controller",method:"storeconfig"})}toggleActivity(e){var t;if(this.pluginMap&&this.pluginMap[e])t=this.pluginMap[e];else for(var i=0;i{t.state="Activated",this.render()}).catch(e=>{console.error("Failed to activate:",e),this.render()}):this.deactivate(e).then(e=>{t.state="Deactivated",this.render()}).catch(e=>{console.error("Failed to deactivate:",e),this.render()}):console.error("Plugin not found:",e)}toggleSuspend(e){var t;if(this.pluginMap&&this.pluginMap[e])t=this.pluginMap[e];else for(var i=0;i{this.updateSuspendLabel(e,"resume"),document.getElementById(e+"suspend").checked=!0,t.state="Suspended"}):this.resume(e).then(i=>{this.updateSuspendLabel(e,"suspend"),document.getElementById(e+"suspend").checked=!1,t.state="Resumed"}):this.activate(e).then(i=>{t.state="Activated",!1===document.getElementById(e+"suspend").checked?this.resume(e).then(this.render.bind(this)):this.suspend(e).then(this.render.bind(this))}):console.error("Plugin not found:",e)}clear(){for(;this.mainDiv.firstChild;)this.mainDiv.removeChild(this.mainDiv.firstChild)}discover(){console.log("Initiating discovery"),this.initiateDiscovery();let e=this;setTimeout((function(){e.getDiscovery().then(e=>{for(var t=e.bridges?e.bridges:e,i=document.getElementById("discoveryList");i.firstChild;)i.removeChild(i.firstChild);for(var n=0;n{void 0!==e.state&&!0===this.rendered&&this.render(),void 0!==e.suspended&&!0===this.rendered&&this.render()})),this.mainDiv=document.getElementById("main");this.mainDiv.firstChild;)this.mainDiv.removeChild(this.mainDiv.firstChild);var e=document.createElement("div");e.className="title grid__col grid__col--8-of-8",e.textContent="Plugins",this.mainDiv.appendChild(e);var t=document.createElement("div");t.id="controllerPlugins",this.mainDiv.appendChild(t);var i=document.createElement("div");i.className="title grid__col grid__col--8-of-8",i.textContent="Device actions",this.mainDiv.appendChild(i);var n=document.createElement("div");n.className="text grid__col grid__col--8-of-8";var s=document.createElement("button");s.type="button",s.id="persistButton",s.textContent="PERSIST",n.appendChild(s),this.mainDiv.appendChild(n);var o=document.createElement("div");o.className="text grid__col grid__col--8-of-8";var l=document.createElement("button");l.type="button",l.id="harakiriButton",l.textContent="REBOOT",o.appendChild(l),this.mainDiv.appendChild(o);var d=document.createElement("div");d.className="title grid__col grid__col--8-of-8",d.textContent="Discover devices",this.mainDiv.appendChild(d);var r=document.createElement("div");r.className="label grid__col grid__col--2-of-8";var a=document.createElement("button");a.type="button",a.id="discoverButton",a.textContent="DISCOVER",r.appendChild(a),this.mainDiv.appendChild(r);var c=document.createElement("div");c.className="text grid__col grid__col--6-of-8";var u=document.createElement("ul");u.id="discoveryList",c.appendChild(u),this.mainDiv.appendChild(c),s.onclick=this.persist.bind(this),l.onclick=this.harakiri.bind(this),a.onclick=this.discover.bind(this);const h=this.callsign.indexOf("/"),_=-1!==h,g=_?this.callsign.substring(0,h):null;this.status().then(e=>{var i=e.plugins?e.plugins:e;this.plugins=i,this.pluginMap={};for(var n=0;n!0).catch(e=>!1)}close(){this.controllerListener&&"function"==typeof this.controllerListener.dispose&&(this.controllerListener.dispose(),this.controllerListener=null)}};var F=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Data Capture",this.mainDiv=document.getElementById("main")}render(){this.template='\n
        Set Audio Capture Parameters
        \n
        Buffer Duration(in seconds)
        \n
        \n \n \n
        \n
        Get Audio Clip
        \n
        Stream
        \n
        \n \n
        \n
        Capture Mode
        \n
        \n \n
        \n
        Duration(in seconds)
        \n
        \n \n
        \n
        URL
        \n
        \n \n
        \n
        \n \n
        \n
        \n ',this.mainDiv.innerHTML=this.template,this.bufferDuration=document.getElementById("buffer"),this.setBuffer=document.getElementById("set_buffer"),this.stream=document.getElementById("stream"),this.duration=document.getElementById("duration"),this.captureMode=document.getElementById("capture_mode"),this.uploadUrl=document.getElementById("url"),this.getButton=document.getElementById("get_button"),this.statusMessages=document.getElementById("statusMessages"),this.setBuffer.onclick=this.enableAudioCapture.bind(this),this.getButton.onclick=this.getAudioClip.bind(this),this.onAudioClipReady=this.api.t.on(this.callsign,"onAudioClipReady",e=>{e.status?this.statusMessage("Upload success.
        File name:"+e.fileName):this.statusMessage(e.message,!0)})}enableAudioCapture(){console.log(this.bufferDuration.value);const e={plugin:this.callsign,method:"enableAudioCapture",params:{bufferMaxDuration:parseInt(this.bufferDuration.value)}};return this.api.req(null,e).then(e=>{console.log(e),e.success?0==e.error&&this.statusMessage("Enabled audio capture"):255==e.error?this.statusMessage("settop cannot accommodate any level of audio buffering",!0):this.statusMessage(`Buffer set failed.Request exceeds maximum allowed buffer size.Maximum supported buffer duration is ${e.error} seconds`,!0)})}getAudioClip(){const e={plugin:this.callsign,method:"getAudioClip",params:{clipRequest:{stream:this.stream.value,duration:this.duration.value,captureMode:this.captureMode,url:this.uploadUrl}}};return this.api.req(null,e).then(e=>{console.log(e),e.success?this.statusMessage("Request success"):this.statusMessage("Request failed",!0)})}statusMessage(e,t=!1){window.clearTimeout(this.statusMessageTimer),this.statusMessages.innerHTML=e,this.statusMessages.style=t?"color: red":"",this.statusMessageTimer=setTimeout(this.statusMessage.bind(this),3e3,"")}close(){window.clearTimeout(this.statusMessageTimer),this.onAudioClipReady&&"function"==typeof this.onAudioClipReady.dispose&&this.onAudioClipReady.dispose()}};var V=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Device Info",this.deviceInfoDiv=void 0,this.mainDiv=document.getElementById("main"),this.selectedNetworkInterface=0,this.deviceNameEl=void 0,this.serialNumberEl=void 0,this.versionEl=void 0,this.uptimeEl=void 0,this.totalRamEl=void 0,this.usedRamEl=void 0,this.freeRamEl=void 0,this.usedGpuRamEl=void 0,this.freeGpuRamEl=void 0,this.totalGpuRamEl=void 0,this.cpuLoadEl=void 0,this.interfacesOptsEl=void 0,this.macIdEl=void 0,this.ipAddressEl=void 0,this.chartOptions={interval:1e3,maxElements:50},this.ramChart=void 0,this.gpuChart=void 0,this.cpuChart=void 0,this.chartIntervalId=void 0,this.template='
        \n Device\n
        \n\n
        \n Name\n
        \n
        \n -\n
        \n
        \n S/N\n
        \n
        \n -\n
        \n
        \n Version\n
        \n
        \n -\n
        \n
        \n Network Interface\n
        \n
        \n \n
        \n
        \n MAC\n
        \n
        \n -\n
        \n
        \n IP\n
        \n
        \n -\n
        \n
        \n Uptime\n
        \n
        \n -\n
        \n\n
        \n RAM\n
        \n\n
        \n Total RAM\n
        \n
        \n -\n
        \n
        \n Used RAM\n
        \n
        \n -\n
        \n
        \n Free RAM\n
        \n
        \n -\n
        \n
        \n Total GPU RAM\n
        \n
        \n -\n
        \n
        \n Used GPU RAM\n
        \n
        \n -\n
        \n
        \n Free GPU RAM\n
        \n
        \n -\n
        \n\n
        \n CPU\n
        \n\n
        \n CPU Load\n
        \n
        \n -\n
        \n\n
        \n CPU / GPU / RAM Graphs\n
        \n
        \n Poll interval in milliseconds\n
        \n
        \n \n
        \n
        \n Max elements per graph\n
        \n
        \n \n
        \n\n \n
        \n \n
        \n \n '}status(){return this.displayInfo().then(e=>new Promise((t,i)=>{this.deviceInfo().then(i=>{t({...e,...i})})}))}deviceInfo(){return this.api.req(null,{plugin:"DeviceInfo",method:"systeminfo"})}displayInfo(){return new Promise((e,t)=>{var i={};this.totalGPURam().then(t=>{i.totalgpuram=t,this.freeGPURam().then(t=>{i.freegpuram=t,e(i)})})})}totalGPURam(){return this.api.req(null,{plugin:"DisplayInfo",method:"totalgpuram"})}freeGPURam(){return this.api.req(null,{plugin:"DisplayInfo",method:"freegpuram"})}addresses(){return this.api.req(null,{plugin:"DeviceInfo",method:"addresses"})}socketinfo(){return this.api.req(null,{plugin:"DeviceInfo",method:"socketinfo"})}update(){this.deviceInfo().then(e=>{let t=e.systeminfo?e.systeminfo:e;this.deviceNameEl.innerHTML=t.devicename,this.serialNumberEl.innerHTML=t.serialnumber,this.versionEl.innerHTML=t.version,this.uptimeEl.innerHTML=t.uptime,this.totalRamEl.innerHTML=this.bytesToMbString(t.totalram),this.usedRamEl.innerHTML=this.bytesToMbString(t.totalram-t.freeram),this.freeRamEl.innerHTML=this.bytesToMbString(t.freeram),this.cpuLoadEl.innerHTML=parseFloat(t.cpuload).toFixed(1)+" %",this.addresses().then(e=>{let t=e.addresses?e.addresses:e;this.interfacesOptsEl.innerHTML="";for(var i=0;i{this.totalGpuRamEl.innerHTML=this.bytesToMbString(e.totalgpuram),this.freeGpuRamEl.innerHTML=this.bytesToMbString(e.freegpuram),this.usedGpuRamEl.innerHTML=this.bytesToMbString(e.totalgpuram-e.freegpuram)}),document.getElementById("startGraphs").onclick=this.startRealtimeGraphs.bind(this)}render(){this.mainDiv.innerHTML=this.template,this.deviceNameEl=document.getElementById("DeviceName"),this.serialNumberEl=document.getElementById("SerialNumber"),this.versionEl=document.getElementById("Version"),this.uptimeEl=document.getElementById("Uptime"),this.totalRamEl=document.getElementById("TotalRam"),this.usedRamEl=document.getElementById("UsedRam"),this.freeRamEl=document.getElementById("FreeRam"),this.totalGpuRamEl=document.getElementById("TotalGpuRam"),this.freeGpuRamEl=document.getElementById("FreeGpuRam"),this.usedGpuRamEl=document.getElementById("UsedGpuRam"),this.cpuLoadEl=document.getElementById("CpuLoad"),this.interfacesOptsEl=document.getElementById("NetworkInterface"),this.interfacesOptsEl.onchange=this.updateNetworkInterface.bind(this),this.macIdEl=document.getElementById("MAC_ID"),this.ipAddressEl=document.getElementById("IpAddress"),this.update()}startRealtimeGraphs(){this.chartOptions.maxElements=parseInt(document.getElementById("graph_max_elements").value),this.chartOptions.interval=parseInt(document.getElementById("graph_poll_interval").value),this.cpuChart=this.generateGraph("CPU usage",document.getElementById("graph_cpu").getContext("2d"),"#34c749","%"),this.ramChart=this.generateGraph("RAM used",document.getElementById("graph_ram").getContext("2d"),"#fc5652","MB"),this.gpuChart=this.generateGraph("GPU RAM used",document.getElementById("graph_gpu").getContext("2d"),"#fdbc40","MB"),this.chartIntervalId=setInterval(this.updateGraphs.bind(this),this.chartOptions.interval),document.getElementById("graphs").style.display="block"}generateGraph(e,t,i,n){return new Chart(t,{type:"line",data:{labels:[],datasets:[{label:e,backgroundColor:i,borderColor:i,data:[],fill:!1}]},options:{responsive:!1,scales:{yAxes:[{ticks:{callback:function(e,t,i){return e+n}}}]}}})}updateGraphs(){let e=this;const t=e.getTimestampForGraph();this.deviceInfo().then(i=>{e.ramChart&&(e.ramChart.config.data.labels.push(t),e.ramChart.config.data.datasets[0].data.push((i.totalram-i.freeram)/1024/1024),e.ramChart.config.data.labels.length>e.chartOptions.maxElements&&(e.ramChart.config.data.labels.shift(),e.ramChart.config.data.datasets[0].data.shift()),e.ramChart.update()),e.cpuChart&&(e.cpuChart.config.data.labels.push(t),e.cpuChart.config.data.datasets[0].data.push(parseFloat(i.cpuload).toFixed(1)),e.cpuChart.config.data.labels.length>e.chartOptions.maxElements&&(e.cpuChart.config.data.labels.shift(),e.cpuChart.config.data.datasets[0].data.shift()),e.cpuChart.update())}),this.displayInfo().then(i=>{e.gpuChart&&(e.gpuChart.config.data.labels.push(t),e.gpuChart.config.data.datasets[0].data.push((i.totalgpuram-i.freegpuram)/1024/1024),e.gpuChart.config.data.labels.length>e.chartOptions.maxElements&&(e.gpuChart.config.data.labels.shift(),e.gpuChart.config.data.datasets[0].data.shift()),e.gpuChart.update())})}close(){clearInterval(this.chartIntervalId),delete this.ramChart,delete this.cpuChart,delete this.gpuChart}updateNetworkInterface(e){this.selectedNetworkInterface=this.interfacesOptsEl.selectedIndex,this.update()}bytesToMbString(e){return(e/1024/1024).toFixed(1)+" MB"}getTimestampForGraph(){const e=new Date;return`${e.getHours()}:${e.getMinutes()}:${e.getSeconds()}`}};var O=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Display Info"}render(){document.getElementById("main").innerHTML='
        \n Display general information\n
        \n\n
        \n Total GPU\n
        \n
        \n -\n
        \n
        \n Free GPU\n
        \n
        \n -\n
        \n
        \n Audio Pass through\n
        \n
        \n -\n
        \n
        \n HDMI display\n
        \n
        \n -\n
        \n
        \n Width\n
        \n
        \n -\n
        \n
        \n Height\n
        \n
        \n -\n
        \n\n
        \n HDCP Protection\n
        \n
        \n -\n
        \n
        \n HDR Type\n
        \n
        \n -\n
        \n ',this.total_gpu=document.getElementById("total_gpu"),this.free_gpu=document.getElementById("free_gpu"),this.audio_pass_through=document.getElementById("audio_pass_through"),this.hdmi_display=document.getElementById("hdmi_display"),this.width=document.getElementById("width"),this.height=document.getElementById("height"),this.hdcp_protection=document.getElementById("hdcp_protection"),this.hdr_type=document.getElementById("hdr_type"),this.update()}totalGPURam(){const e={plugin:this.callsign,method:"totalgpuram"};return this.api.req(null,e)}freeGPURam(){const e={plugin:this.callsign,method:"freegpuram"};return this.api.req(null,e)}isAudioPassThrough(){const e={plugin:this.callsign,method:"isaudiopassthrough"};return this.api.req(null,e)}isConnected(){const e={plugin:this.callsign,method:"connected"};return this.api.req(null,e)}getWidth(){const e={plugin:this.callsign,method:"width"};return this.api.req(null,e)}getHeight(){const e={plugin:this.callsign,method:"height"};return this.api.req(null,e)}hdcpProtection(){const e={plugin:this.callsign,method:"hdcpprotection"};return this.api.req(null,e)}hdrType(){const e={plugin:this.callsign,method:"hdrsetting"};return this.api.req(null,e)}update(){this.totalGPURam().then(e=>{this.total_gpu.innerHTML=e}),this.freeGPURam().then(e=>{this.free_gpu.innerHTML=e}),this.isAudioPassThrough().then(e=>{this.audio_pass_through.innerHTML=e}),this.isConnected().then(e=>{this.hdmi_display.innerHTML=e}),this.getWidth().then(e=>{this.width.innerHTML=e}),this.getHeight().then(e=>{this.height.innerHTML=e}),this.hdcpProtection().then(e=>{this.hdcp_protection.innerHTML=e}),this.hdrType().then(e=>{this.hdr_type.innerHTML=e})}};var z=class extends T{constructor(e,t){super(e,t),this.displayName="FirmwareControl"}render(){document.getElementById("main").innerHTML="\n
        Upgrade
        \n\n
        Name
        \n
        \n \n
        \n\n
        Location
        \n
        \n \n
        \n \n
        Progress Interval
        \n
        \n \n
        \n\n
        HMAC
        \n
        \n \n
        \n\n
        Type
        \n
        \n \n
        \n
        \n \n
        \n
        \n \n
        \n
        \n\n ",this.name=document.getElementById("name"),this.location=document.getElementById("location"),this.progress_interval=document.getElementById("progressinterval"),this.hmac=document.getElementById("hmac"),this.type=document.getElementById("type"),this.statusMessages=document.getElementById("statusMessages"),this.upgrade_button=document.getElementById("upgradebutton"),this.upgrade_button.onclick=this.upgrade.bind(this),this.deviceStateListener=this.api.t.on(this.callsign,"upgradeprogress",e=>{"none"!=e.error?this.updateStatus("Status: "+e.status+" Error: "+e.error+" Progress: "+e.progress):this.updateStatus("Status:"+e.status+" Progress: "+e.progress)})}updateStatus(e){window.clearTimeout(this.statusMessageTimer),this.statusMessages.innerHTML=e,this.statusMessageTimer=setTimeout(this.updateStatus,5e3,"")}upgrade(){const e={plugin:this.callsign,method:"upgrade",params:{name:this.name.value,location:this.location.value,type:this.type.value,...this.progress_interval.value&&this.progress_interval.value.trim()&&{progressinterval:this.progress_interval.value},...this.hmac.value&&this.hmac.value.trim()&&{hmac:this.hmac.value}}};return this.api.req(null,e).then(e=>{e&&console.log(e)}).catch(e=>{e.code?this.updateStatus("Error in upgrade: "+e.code+" "+e.message):this.updateStatus("Error in upgrade")})}};var G=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Frame Rate",this.mainDiv=document.getElementById("main"),this.template='\n\t\t\t
        \n\t\t\t\tFrame Rate\n\t\t\t
        \n\t\t\t
        \n\t\t\t\tCollection frequency (in ms)\n\t\t\t
        \n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t
        \n\t\t\t
        \n\t\t\t\tMinimum Frame Rate\n\t\t\t
        \n\t\t\t
        \n\t\t\t\t-\n\t\t\t
        \n\t\t\t
        \n\t\t\t\tMaximum Frame Rate\n\t\t\t
        \n\t\t\t
        \n\t\t\t\t-\n\t\t\t
        \n\t\t\t
        \n\t\t\t\tAverage Frame Rate\n\t\t\t
        \n\t\t\t
        \n\t\t\t\t-\n\t\t\t
        \n\t\t\t
        \n\t\t\t\tUpdate FPS\n\t\t\t
        \n\t\t\t
        \n\t\t\t\tSet new FPS\n\t\t\t
        \n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\n\t\t\t
        \n '}render(){this.mainDiv.innerHTML=this.template,this.minFps=document.getElementById("Min_FPS"),this.maxFps=document.getElementById("Max_FPS"),this.avgFps=document.getElementById("Avg_FPS"),this.frequencyButton=document.getElementById("frequency_button"),this.fpsButton=document.getElementById("fps_button"),this.stopButton=document.getElementById("stop_button"),this.fps=document.getElementById("fps"),this.frequency=document.getElementById("freq"),this.frequencyButton.onclick=this.set.bind(this),this.fpsButton.onclick=this.update.bind(this),this.stopButton.onclick=this.stopCollection.bind(this),this.onFpsEvent=this.api.t.on(this.callsign,"onFpsEvent",e=>{this.minFps.innerHTML=e.min,this.maxFps.innerHTML=e.max,this.avgFps.innerHTML=e.average})}setFrequency(e){const t={plugin:this.callsign,method:"setCollectionFrequency",params:{frequency:e}};return this.api.req(null,t)}updateFrequency(e){const t={plugin:this.callsign,method:"updateFps",params:{newFpsValue:parseInt(e)}};return this.api.req(null,t)}update(){this.updateFrequency(this.fps.value)}set(){this.frequency.checkValidity()&&this.setFrequency(this.frequency.value).then(()=>{this.stop().then(()=>{this.start()})})}start(){const e={plugin:this.callsign,method:"startFpsCollection"};return this.api.req(null,e)}stopCollection(){this.stop().then(()=>{this.minFps.innerHTML="-",this.maxFps.innerHTML="-",this.avgFps.innerHTML="-"})}stop(){const e={plugin:this.callsign,method:"stopFpsCollection"};return this.api.req(null,e)}close(){this.stopCollection()}};var j=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Player Info"}render(){document.getElementById("main").innerHTML='
        \n Player general information\n
        \n \n
        \n Audio\n
        \n
        \n -\n
        \n
        \n Video\n
        \n
        \n -\n
        \n
        \n Dolbymode\n
        \n
        \n \n \n
        \n ',this.audio=document.getElementById("audio"),this.video=document.getElementById("video"),this.dolbymod=document.getElementById("dolbymod"),this.dolbymode_button=document.getElementById("dolbymode_button"),this.dolbymode_button.onclick=this.setDolbymode.bind(this),this.update()}setDolbymod(e){if(""===e)return;console.log("Setting dolbymod "+e+" for "+this.callsign);const t={plugin:this.callsign,method:"dolbymode",params:e};this.api.req(null,t)}setDolbymode(){this.setDolbymod(this.dolbymod.value)}playerInfo(){const e={plugin:this.callsign,method:"playerinfo"};return this.api.req(null,e)}dolbymodeInfo(){const e={plugin:this.callsign,method:"dolbymode"};return this.api.req(null,e)}update(){this.playerInfo().then(e=>{this.audio.innerHTML=e.audio[0],this.video.innerHTML=e.video[0]}),this.dolbymodeInfo().then(e=>{this.dolbymod.innerHTML=e})}};var W=class extends T{constructor(e,t){super(e,t),this.displayName="Device Diagnostics"}render(){document.getElementById("main").innerHTML='\n
        \n Configuration\n
        \n
        \n Property Name\n
        \n
        \n \n \n
        \n
        \n Value\n
        \n
        \n -\n
        \n ',this.property=document.getElementById("property"),this.show_value=document.getElementById("show_value"),this.show_value.onclick=this.showValue.bind(this),this.value=document.getElementById("value")}showValue(){this.value.innerHTML="-",""==this.property.value?alert("Please provide property name"):this.getConfiguration(this.property.value).then(e=>{e.success?e.paramList[0]?this.value.innerHTML=e.paramList[0].value:alert("No value available for the property "+this.property.value):alert("Error in getting configuration")})}getConfiguration(e){const t={plugin:this.callsign,method:"getConfiguration",params:{names:[e]}};return this.api.req(null,t)}};var K=class extends T{constructor(e,t){super(e,t),this.displayName="Device Identification"}render(){document.getElementById("main").innerHTML='\n
        \n Device Identification\n
        \n
        \n Firmware Version\n
        \n
        \n -\n
        \n
        \n Chip set\n
        \n
        \n -\n
        \n ',this.firmware_version=document.getElementById("firmware_version"),this.chipset=document.getElementById("chipset"),this.update()}deviceIdentification(){const e={plugin:this.callsign,method:"deviceidentification"};return this.api.req(null,e)}update(){this.deviceIdentification().then(e=>{this.firmware_version.innerHTML=e.firmwareversion,this.chipset.innerHTML=e.chipset})}};var Z=class extends T{constructor(e,t){super(e,t),this.dialListenerStart=this.api.t.on("DIALServer","start",e=>{this.dialMessage("start",e)}),this.dialListenerStop=this.api.t.on("DIALServer","stop",e=>{this.dialMessage("stop",e)})}render(){document.getElementById("main").innerHTML='
        \n Received DIAL requests:\n
        \n\n
        ',this.statusMessagesEl=document.getElementById("statusMessages")}dialMessage(e,t){let i=document.createElement("div");"stop"===e&&(i.className="red");let n=document.createElement("span");n.innerHTML=`${e} :: ${t.application} - ${t.parameters}`,i.appendChild(n),this.statusMessagesEl.appendChild(i)}close(){this.dialListenerStart&&"function"==typeof this.dialListenerStart.dispose&&this.dialListenerStart.dispose(),this.dialListenerStop&&"function"==typeof this.dialListenerStop.dispose&&this.dialListenerStop.dispose()}};var J=class extends T{constructor(e,t){super(e,t),this.displayName="Display Settings"}render(){document.getElementById("main").innerHTML='\n
        \n Resolution\n
        \n
        \n Supported Resolutions\n
        \n
        \n VideoDisplay\n
        \n
        \n \n
        \n
        \n Supported Resolutions\n
        \n
        \n -\n
        \n
        \n Supported Tv Resolutions\n
        \n
        \n -\n
        \n
        \n Current Resolution\n
        \n
        \n VideoDisplay\n
        \n
        \n \n
        \n
        \n Resolution\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n
        \n Supported STB Resolutions\n
        \n
        \n -\n
        \n
        \n Default Resolution\n
        \n
        \n -\n
        \n
        \n
        \n Audio Ports\n
        \n
        \n Connected Audio Ports\n
        \n
        \n -\n
        \n
        \n Supported Audio Ports\n
        \n
        \n -\n
        \n \n
        \n Video Display\n
        \n
        \n Connected Video Displays\n
        \n
        \n -\n
        \n
        \n Supported Video Displays\n
        \n
        \n -\n
        \n \n
        \n EDID\n
        \n
        \n EDID from HDMI device\n
        \n
        \n -\n
        \n
        \n EDID Host\n
        \n
        \n -\n
        \n
        \n HDR Support\n
        \n
        \n HDR support standards for TV\n
        \n
        \n -\n
        \n \n
        \n HDR support standards for STB\n
        \n
        \n -\n
        \n
        \n TV HDR Capabilities\n
        \n
        \n -\n
        \n
        \n HDCP Repeater\n
        \n
        \n Is HDCP Repeater\n
        \n
        \n -\n
        \n
        \n Output Setting\n
        \n
        \n Color Space\n
        \n
        \n -\n
        \n
        \n Color Depth\n
        \n
        \n -\n
        \n
        \n Matrix coefficients\n
        \n
        \n -\n
        \n
        \n Video EOTF\n
        \n
        \n -\n
        \n
        \n Audio Modes\n
        \n
        \n Audio Port\n
        \n
        \n \n
        \n
        \n Supported Audio Modes\n
        \n
        \n -\n
        \n
        \n Active Input\n
        \n
        \n Video Display\n
        \n
        \n \n
        \n
        \n Active/Inactive\n
        \n
        \n -\n
        \n \n \n
        \n Zoom Setting\n
        \n
        \n Zoom Setting\n
        \n
        \n \n \n
        \n
        \n AudioCompression\n
        \n
        \n Compresion Level\n
        \n
        \n \n \n
        \n
        \n Dialog Enhancement\n
        \n
        \n Enhancer level\n
        \n
        \n \n \n
        \n
        \n Intelligent Equalizer\n
        \n
        \n Equalizer mode\n
        \n
        \n \n \n
        \n
        \n Sound Mode\n
        \n
        \n Audio Port\n
        \n
        \n \n
        \n
        \n Sound Mode\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Volume Leveller\n
        \n
        \n Audio Port\n
        \n
        \n \n
        \n
        \n Level\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Volume Level\n
        \n
        \n Audio Port\n
        \n
        \n \n
        \n
        \n Volume Level (0-100)\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Bass Enhancer\n
        \n
        \n Audio Port\n
        \n
        \n \n
        \n
        \n Bass boost\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Surround Virtualizer\n
        \n
        \n Audio Port\n
        \n
        \n \n
        \n
        \n Boost\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n DRC Mode\n
        \n
        \n Audio Port\n
        \n
        \n \n
        \n
        \n Mode\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Gain\n
        \n
        \n Audio Port\n
        \n
        \n \n
        \n
        \n Gain (0-100)\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Scart\n
        \n
        \n Scart Parameter\n
        \n
        \n \n
        \n
        \n Scart Parameter Data\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Audio Delay\n
        \n
        \n Audio Port\n
        \n
        \n \n
        \n
        \n Delay(in ms)\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Audio Delay Offset\n
        \n
        \n Audio Port\n
        \n
        \n \n
        \n
        \n Delay Offset(in ms)\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Video port Stand by\n
        \n
        \n Port name\n
        \n
        \n \n
        \n \n
        \n Standby Mode\n
        \n
        \n
        \n \n \n
        \n
        \n
        \n MI Steering\n
        \n
        \n Audio Port\n
        \n
        \n \n
        \n
        \n MI Steering Enable\n
        \n
        \n
        \n \n \n
        \n
        \n
        \n Surround Decoder\n
        \n
        \n Audio Port\n
        \n
        \n \n
        \n
        \n Enable/Disable\n
        \n
        \n
        \n \n \n
        \n
        \n
        \n Mute\n
        \n
        \n Audio Port\n
        \n
        \n \n
        \n
        \n Muted\n
        \n
        \n
        \n \n \n
        \n
        \n
        \n Atmos\n
        \n
        \n Sink Atmos capability\n
        \n
        \n -\n
        \n
        \n Audio atmos Output mode\n
        \n
        \n
        \n \n \n
        \n
        \n
        \n Dolby Mode\n
        \n
        \n Dolby Mode\n
        \n
        \n
        \n \n \n
        \n
        \n ',this.supported_resolutions=document.getElementById("supported_resolutions"),this.supported_tv_resolutions=document.getElementById("supported_tv_resolutions"),this.supported_stb_resolutions=document.getElementById("supported_stb_resolutions"),this.default_resolution=document.getElementById("default_resolution"),this.video_display_resolution=document.getElementById("video_display_resolution"),this.video_display_resolution.onchange=this.updateDisplayResolution.bind(this),this.video_display_current=document.getElementById("video_display_current"),this.resolution=document.getElementById("resolution"),this.setResolution=document.getElementById("set_resolution"),this.setResolution.onclick=this.updateResolution.bind(this),this.connected_audio_ports=document.getElementById("connected_audio_ports"),this.supported_audio_ports=document.getElementById("supported_audio_ports"),this.edid_hdmi=document.getElementById("edid_hdmi"),this.edid_host=document.getElementById("edid_host"),this.standby_mode=document.getElementById("standby_mode"),this.standby_mode.onclick=this.updateStandBy.bind(this),this.dolby_mode=document.getElementById("dolby_mode"),this.dolby_mode.onclick=this.updateDolbyMode.bind(this),this.select_port_standby=document.getElementById("select_port_standby"),this.hdr_tv=document.getElementById("hdr_tv"),this.hdr_stb=document.getElementById("hdr_stb"),this.hdr_tv_capabilities=document.getElementById("hdr_tv_capabilities"),this.color_space=document.getElementById("color_space"),this.color_depth=document.getElementById("color_depth"),this.matrix_coefficients=document.getElementById("matrix_coefficients"),this.video_EOTF=document.getElementById("video_EOTF"),this.select_audio_port=document.getElementById("select_audio_port"),this.supported_audio_modes=document.getElementById("supported_audio_modes"),this.select_audio_port.onchange=this.updateAudioMode.bind(this),this.connected_video_display=document.getElementById("connected_video_displays"),this.supported_video_displays=document.getElementById("supported_video_displays"),this.active_inactive=document.getElementById("active_inactive"),this.select_zoom_setting=document.getElementById("select_zoom_setting"),this.zoom_set=document.getElementById("zoom_set"),this.zoom_set.onclick=this.updateZoomSetting.bind(this),this.sound_mode=document.getElementById("sound_mode"),this.set_sound_mode=document.getElementById("set_sound_mode"),this.set_sound_mode.onclick=this.updateSoundMode.bind(this),this.select_MS12_audio_compression=document.getElementById("select_MS12_audio_compression"),this.set_compression=document.getElementById("set_compression"),this.set_compression.onclick=this.updateAudioCompression.bind(this),this.video_display_active=document.getElementById("select_video_display"),this.video_display_active.onchange=this.updateActiveInput.bind(this),this.audio_port=document.getElementById("audio_port"),this.select_enhancer=document.getElementById("select_enhancer"),this.set_enhancer=document.getElementById("set_enhancer"),this.set_enhancer.onclick=this.updateEnhanceLevel.bind(this),this.select_mode=document.getElementById("select_mode"),this.set_mode=document.getElementById("set_mode"),this.set_mode.onclick=this.updateEqualizerMode.bind(this),this.sink_atmos=document.getElementById("sink_atmos"),this.atmos_mode=document.getElementById("atmos_mode"),this.atmos_mode.onclick=this.updateAtmosMode.bind(this),this.repeater=document.getElementById("repeater"),this.audioPort_leveller=document.getElementById("audioPort_leveller"),this.leveller=document.getElementById("leveller"),this.set_leveller=document.getElementById("set_leveller"),this.set_leveller.onclick=this.updateAudioLeveller.bind(this),this.audioPort_level=document.getElementById("audioPort_level"),this.level=document.getElementById("level"),this.set_level=document.getElementById("set_level"),this.set_level.onclick=this.updateAudioLevel.bind(this),this.audioPort_bass=document.getElementById("audioPort_bass"),this.bass=document.getElementById("bass"),this.set_bass=document.getElementById("set_bass"),this.set_bass.onclick=this.updateBassEnhancer.bind(this),this.audioPort_boost=document.getElementById("audioPort_boost"),this.boost=document.getElementById("boost"),this.set_boost=document.getElementById("set_boost"),this.set_boost.onclick=this.updateBoostValue.bind(this),this.audioPort_steering=document.getElementById("audioPort_steering"),this.mi_enable=document.getElementById("mi_enable"),this.mi_enable.onclick=this.updateMISteering.bind(this),this.audioPort_surroundDecoder=document.getElementById("audioPort_surroundDecoder"),this.surroundDecoder_enable=document.getElementById("surroundDecoder_enable"),this.surroundDecoder_enable.onclick=this.updateSurroundDecoder.bind(this),this.audioPort_drc=document.getElementById("audioPort_drc"),this.drc=document.getElementById("drc"),this.set_drc=document.getElementById("set_drc"),this.set_drc.onclick=this.updateDRCMode.bind(this),this.audioPort_gain=document.getElementById("audioPort_gain"),this.gain=document.getElementById("gain"),this.set_gain=document.getElementById("set_gain"),this.set_gain.onclick=this.updateGain.bind(this),this.scart_param=document.getElementById("scart_param"),this.scart_data=document.getElementById("scart_data"),this.scart_param.onclick=this.updateScartData.bind(this),this.set_scart=document.getElementById("set_scart"),this.set_scart.onclick=this.updateScart.bind(this),this.audioPort_muted=document.getElementById("audioPort_muted"),this.muted_enable=document.getElementById("muted_enable"),this.muted_enable.onclick=this.updateMuted.bind(this),this.audioPort_delay=document.getElementById("audioPort_delay"),this.delay=document.getElementById("delay"),this.set_delay=document.getElementById("set_delay"),this.set_delay.onclick=this.updateDelay.bind(this),this.audioPort_delayOffset=document.getElementById("audioPort_delayOffset"),this.delayOffset=document.getElementById("delayOffset"),this.set_delayOffset=document.getElementById("set_delayOffset"),this.set_delayOffset.onclick=this.updateDelayOffset.bind(this),this.onResolutionChanged=this.api.t.on(this.callsign,"resolutionChanged",this.updateCurrentResolution.bind(this)),this.onZoomSettingUpdated=this.api.t.on(this.callsign,"zoomSettingUpdated",this.updateZoomValue.bind(this)),this.onActiveInputChanged=this.api.t.on(this.callsign,"activeInputChanged",this.updateActiveInput.bind(this)),this.onConnectedVideoDisplaysUpdated=this.api.t.on(this.callsign,"connectedVideoDisplaysUpdated",this.updateConnectedDisplay.bind(this)),this.update()}updateCurrentResolution(){this.resolution.innerHTML="",this.getCurrentResolution(this.video_display_current.value).then(e=>{if(null!=e&&e.success){var t=e.resolution;this.resolutionArray=document.createElement("option"),this.resolutionArray.text=e.resolution,this.resolutionArray.value=e.resolution,this.resolution.appendChild(this.resolutionArray),this.resolutionArrayFiltered=this.totalResolution.filter(e=>t!=e);for(var i=0;i{this.supported_tv_resolutions.innerHTML=e.supportedTvResolutions}),this.getSupportedResolutions(this.video_display_resolution[this.selectedIndex].value).then(e=>{this.supported_resolutions.innerHTML=e.supportedResolutions})}updateAudioMode(){this.supportedAudioModes(this.select_audio_port.value).then(e=>{null!=e&&e.supportedAudioModes?this.supported_audio_modes.innerHTML=e.supportedAudioModes:this.supported_audio_modes.innerHTML="-"})}updateZoomValue(){this.getZoomSetting().then(e=>{if(null!=e&&e.success){this.select_zoom_setting.innerHTML="",(i=document.createElement("option")).text=e.zoomSetting,i.value=e.zoomSetting,this.select_zoom_setting.appendChild(i),this.supportedZoomSettingFiltered=["FULL","NONE","Letterbox 16x9","Letterbox 14x9","CCO","PanScan","Letterbox 2.21 on 4x3","Letterbox 2.21 on 16x9","Platform","Zoom 16x9","Pillarbox 4x3","Widescreen 4x3"].filter(t=>e.zoomSetting!=t);for(var t=0;t{null!=e&&e.success?(this.updateZoomValue(),this.showNotification("notification_zoom","Successfully set zoom setting")):(alert("Failed to set zoom value"),this.updateZoomValue())}):alert("No zoom values are available")}updateConnectedDisplay(){this.getConnectedVideoDisplays().then(e=>{this.connected_video_display.innerHTML=e.connectedVideoDisplays})}updateMS12Compression(){this.select_MS12_audio_compression.innerHTML="",this.getMS12AudioCompression().then(e=>{if(null!=e&&e.success){(i=document.createElement("option")).text=e.compressionlevel,i.value=e.compressionlevel,this.select_MS12_audio_compression.appendChild(i);this.supportedCompressionFiltered=[0,1,2,3,4,5,6,7,8,9,10].filter(t=>e.compressionlevel.toString()!=t);for(var t=0;t{if(null!=e&&e.success){(i=document.createElement("option")).text=e.enhancerlevel,i.value=e.enhancerlevel,this.select_enhancer.appendChild(i),this.supportedEnhancerLevelFiltered=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16].filter(t=>e.enhancerlevel.toString()!=t);for(var t=0;t{if(null!=e&&e.success){(i=document.createElement("option")).text=e.DRCMode,i.value=e.DRCMode,this.drc.appendChild(i),this.supportedDRCModeFiltered=["line","rf"].filter(t=>e.DRCMode!=t);for(var t=0;t{null!=e&&e.success&&(this.gain.value=e.gain)})}updateScart(){this.setScartParameter(this.scart_param.value,this.scart_data.value).then(e=>{null!=e&&e.success?this.showNotification("notification_scart","Successfully set scart value"):alert("Failed to set scart value")})}updateScartData(){switch(this.scart_data.innerHTML="",this.scart_param.value){case"aspect_ratio":for(var e=["4x3","16x9"],t=0;t{if(null!=e&&e.success){(i=document.createElement("option")).text=e.mode,i.value=e.mode,this.select_mode.appendChild(i),this.supportedEqualizerModeFiltered=[1,2,3].filter(t=>e.mode.toString()!=t);for(var t=0;t{this.sound_mode.innerHTML="",(i=document.createElement("option")).text=e.soundMode,i.value=e.soundMode,this.sound_mode.appendChild(i),this.supportedSoundModeFiltered=["mono","stereo","surround","passthru","auto","auto *","AUTO *","dolby digital 5.1"].filter(t=>e.soundMode!=t);for(var t=0;t{null!=e&&e.success?(this.showNotification("notification_compression","Successfully set compression"),this.updateMS12Compression()):(alert("Failed to set audio compression"),this.updateMS12Compression())}):alert("No audio compression values are available")}updateResolution(){""!=this.video_display_current.value&&""!=this.resolution.value?this.setCurrentResolution(this.video_display_current.value,this.resolution.value).then(e=>{null!=e&&e.success?this.showNotification("notification_resolution","Successfully set resolution"):alert("Failed to set current resolution")}):""==this.video_display_current.value?alert("No video displays are available to set the current resolution"):""==this.resolution.value&&alert("No resolution is supported on the video display port")}updateSoundMode(){""!=this.audio_port.value&&""!=this.sound_mode.value?this.setSoundMode(this.audio_port.value,this.sound_mode.value).then(e=>{null!=e&&e.success?(this.showNotification("notification_soundMode","Successfully set sound mode"),this.updateSoundModeList()):(alert("Failed to set sound mode"),this.updateSoundModeList())}):""==this.audio_port.value?alert("No audio ports are available to set sound mode"):""!=this.sound_mode.value&&alert("No sound modes are available to set sound mode")}updateStandBy(){""!=this.select_port_standby.value?this.setVideoPortStatusInStandby(this.select_port_standby.value,this.standby_mode.checked).then(e=>{if(e.success&&null!=e){if(1==this.standby_mode.checked)var t="enabled";else t="disabled";this.showNotification("notification_standby","Successfully "+t+" standby mode ")}this.getVideoPortStatusInStandby(this.select_port_standby.value).then(e=>{this.standby_mode.checked=e.videoPortStatusInStandby})}):""==this.select_port_standby.value&&alert("No audio ports are available to set standby mode")}updateDolbyMode(){try{this.setDolbyVolumeMode(this.dolby_mode.checked).then(e=>{if(null!=e&&e.success){if(1==this.dolby_mode.checked)var t="enabled";else t="disabled";this.showNotification("notification_dolby","Successfully "+t+" dolby mode"),this.getDolbyVolumeMode().then(e=>{e&&null!=e.dolbyVolumeMode&&(this.dolby_mode.checked=e.dolbyVolumeMode)})}else this.dolby_mode.checked=!this.dolby_mode.checked,alert("Failed to set dolby mode")})}catch(e){alert("Error in setting dolby volume mode")}}updateAtmosMode(){try{this.setAudioAtmosOutputMode(this.atmos_mode.checked).then(e=>{var t;if(t=!!this.atmos_mode.checked,null!=e&&e.success){if(1==this.atmos_mode.checked)var i="enabled";else i="disabled";this.showNotification("notification_atmos","Successfully "+i+" atmos mode"),this.atmos_mode.checked=t}else this.atmos_mode.checked=!t,alert("Failed to set audio atmos mode")})}catch(e){alert("Error in setting audio atmos mode")}}updateActiveInput(){this.getActiveInput(this.video_display_active.value).then(e=>{1==e.activeInput?this.active_inactive.innerHTML="Active":this.active_inactive.innerHTML="InActive"})}updateEnhanceLevel(){""!=this.select_enhancer.value?this.setDialogEnhancement(parseInt(this.select_enhancer.value)).then(e=>{null!=e&&e.success?(this.showNotification("notification_enhancement","Successfully set dialog enhancement"),this.updateEnhancerList()):(alert("Failed to set dialog enhancer level"),this.updateEnhancerList())}):alert("No enhancer levels are available")}updateEqualizerMode(){""!=this.select_mode.value?this.setIntelligentEqualizerMode(parseInt(this.select_mode.value)).then(e=>{null!=e&&e.success?(this.showNotification("notification_equalizer","Successfully set equalizer mode"),this.updateEqualizerList()):(alert("Failed to set equalizer mode"),this.updateEqualizerList())}):alert("No equalizer modes are available")}updateLevel(){""!=this.audioPort_level.value&&this.getVolumeLevel(this.audioPort_level.value).then(e=>{e.success&&null!=e?this.level.value=e.volumeLevel:this.level.value=""})}updateAudioLevel(){if(""!=this.audioPort_level.value&&""!=this.level.value&&this.level.value>=0&&this.level.value<=100)try{this.setVolumeLevel(this.audioPort_level.value,this.level.value).then(e=>{e.success&&null!=e?(this.showNotification("notification_volumeLevel","Successfully set volume level"),this.updateLevel()):(alert("Failed to set volume level"),this.updateLevel())})}catch(e){alert("Error in setting volume level")}else""==this.audioPort_level.value?alert("No audio ports are available for setting volume level"):""==this.level.value?alert("Please provide volume level value"):(this.level.value<0||this.level.value>100)&&alert("Please provide a volume level value between 0 and 100")}updateLeveller(){""!=this.audioPort_leveller.value&&this.getVolumeLeveller(this.audioPort_leveller.value).then(e=>{if(null!=e&&e.success){this.leveller.innerHTML="",(i=document.createElement("option")).text=e.level,i.value=e.level,this.leveller.appendChild(i),this.supportedLevellerFiltered=[0,1,2,3,4,5,6,7,8,9,10].filter(t=>e.level.toString()!=t);for(var t=0;t{null!=e&&e.success?(this.showNotification("notification_volumeLeveller","Successfully set volume leveller"),this.updateLeveller()):(alert("Failed to set volume leveller"),this.updateLeveller())})}catch(e){alert("Error in setting volume leveller")}else""==this.audioPort_leveller.value?alert("No audio port are available to set volume leveller"):""==this.leveller.value&&alert("No leveller values are available to set volume leveller")}updateBass(){""!=this.audioPort_bass.value&&this.getBassEnhancer(this.audioPort_bass.value).then(e=>{if(null!=e&&e.success){for(var t=[],i=0;i<=100;i++)t.push(i);this.bass.innerHTML="",(n=document.createElement("option")).text=e.bassBoost,n.value=e.bassBoost,this.bass.appendChild(n),this.supportedBassFiltered=t.filter(t=>e.bassBoost.toString()!=t);for(i=0;i{null!=e&&e.success?(this.showNotification("notification_bassEnhancer","Successfully set bass enhancer value"),this.updateBass()):(alert("Failed to set bass enhancer"),this.updateBass())}):""==this.audioPort_bass.value&&""==this.bass.value?alert("No audio ports and bass values are available"):""==this.audioPort_bass.value?alert("No audio ports are available"):""==this.bass.value&&alert("No bass values are available")}updateBoost(){""!=this.audioPort_boost.value&&this.getSurroundVirtualizer(this.audioPort_boost.value).then(e=>{if(e.success&&null!=e){for(var t=[],i=0;i<=96;i++)t.push(i);this.boost.innerHTML="",(n=document.createElement("option")).text=e.boost,n.value=e.boost,this.boost.appendChild(n),this.supportedBoostFiltered=t.filter(t=>e.boost.toString()!=t);for(i=0;i{null!=e&&e.success?(this.showNotification("notification_virtualizer","Successfully set virtualizer"),this.updateBoost()):(alert("Failed to set boost value"),this.updateBoost())}):""==this.audioPort_boost.value&&""==this.boost.value?alert("No audio ports and bass values are available"):""==this.audioPort_boost.value?alert("No audio ports available are available"):""==this.boost.value&&alert("No boost values available are available")}updateMISteering(){if(""!=this.audioPort_steering.value)try{this.setMISteering(this.audioPort_steering.value,this.mi_enable.checked).then(e=>{var t=this.mi_enable.checked;if(null!=e&&e.success){if(1==this.mi_enable.checked)var i="enabled";else i="disabled";this.showNotification("notification_miEnable","Successfully "+i+" MI steering"),this.getMISteering(this.audioPort_steering.value).then(e=>{e&&null!=e.MISteeringEnable?this.mi_enable.checked=e.MISteeringEnable:this.mi_enable.checked=!1})}else this.mi_enable.checked=!t,alert("Failed to set MI steering")})}catch(e){alert("Error in setting MI steering")}else""==this.audioPort_steering.value&&alert("No audio ports available")}updateSurroundDecoder(){if(""!=this.audioPort_surroundDecoder.value)try{this.enableSurroundDecoder(this.audioPort_surroundDecoder.value,this.surroundDecoder_enable.checked).then(e=>{var t=this.surroundDecoder_enable.checked;if(null!=e&&e.success){if(1==this.surroundDecoder_enable.checked)var i="enabled";else i="disabled";this.showNotification("notification_surroundDecoder","Successfully "+i+" surround decoder"),this.isSurroundDecoderEnabled(this.audioPort_surroundDecoder[this.audioPort_surroundDecoder.selectedIndex].value).then(e=>{e&&null!=e.surroundDecoderEnable?this.surroundDecoder_enable.checked=e.surroundDecoderEnable:this.surroundDecoder_enable.checked=!1})}else this.surroundDecoder_enable.checked=!t,alert("Failed to set surround decoder")})}catch(e){alert("Error in enabling surround decoder")}else""==this.audioPort_surroundDecoder.value&&alert("No audio ports available")}updateMuted(){if(""!=this.audioPort_muted.value)try{this.setMuted(this.audioPort_muted.value,this.muted_enable.checked).then(e=>{var t=this.muted_enable.checked;if(null!=e&&e.success){if(1==this.muted_enable.checked)var i="enabled";else i="disabled";this.showNotification("notification_mute","Successfully "+i+" mute option"),this.getMuted(this.audioPort_muted.value).then(e=>{null!=e&&e.muted?this.muted_enable.checked=e.muted:this.muted_enable.checked=!1})}else{if(this.muted_enable.checked=!t,t)var n="enable";else n="disbale";alert("Failed to "+n+" mute")}})}catch(e){alert("Error in enabling/disabling mute")}else""==this.audioPort_muted.value&&alert("No audio ports available")}updateDRCMode(){if(""!=this.audioPort_drc.value&&""!=this.drc.value){"line"==this.drc.value?this.drcValue="0":"rf"==this.drc.value&&(this.drcValue="1");try{this.setDRCMode(this.audioPort_drc.value,this.drcValue).then(e=>{null!=e&&e.success&&(this.showNotification("notification_drc","Successfully set drc value"),this.updateDRCList())})}catch(e){alert("Error in setting drc value")}}else""==this.audioPort_drc.value?alert("No audio ports are available"):""==this.drc.value&&alert("No drc values available")}updateGain(){try{""!=this.audioPort_gain.value&&""!=this.gain.value&&this.gain.value>=0&&this.gain.value<=100?this.setGain(this.audioPort_gain.value,this.gain.value).then(e=>{null!=e&&e.success&&(this.showNotification("notification_gain","Successfully set gain"),this.updateGainList())}):""==this.audioPort_gain.value?alert("No audio ports are available"):""==this.gain.value?alert("No gain values are available"):(this.gain.value<0||this.gain.value>100)&&alert("Please provide gain value between 0 and 100")}catch(e){alert("Error in setting gain")}}updateDelay(){if(""!=this.delay.value&&""!=this.audioPort_delay.value)try{this.setAudioDelay(this.delay.value,this.audioPort_delay.value).then(e=>{null!=(e={success:!0})&&e.success?(this.showNotification("notification_delay","Successfully set delay"),this.getAudioDelay(this.audioPort_delay.value).then(e=>{e.success&&null!=e.audioDelay?this.delay.value=e.audioDelay:this.delay.value=""})):(this.delay.value="",alert("Failed to set audio delay"))})}catch(e){alert("Error in setting audio delay")}else""==this.audioPort_delay.value?alert("No audio ports are available"):""==this.delay.value&&alert("Please provide delay value in ms")}updateDelayOffset(){if(""!=this.delayOffset.value&&""!=this.audioPort_delayOffset.value)try{this.setAudioDelayOffset(this.delayOffset.value,this.audioPort_delayOffset.value).then(e=>{null!=e&&e.success?(this.showNotification("notification_delayOffset","Successfully set delay offset"),this.getAudioDelayOffset(this.audioPort_delayOffset.value).then(e=>{e.success&&null!=e.audioDelayOffset?this.delayOffset.value=e.audioDelayOffset:this.delayOffset.value=""})):(this.delayOffset.value="",alert("Failed to set delay offset"))})}catch(e){alert("Error in enabling delay offset")}else""==this.audioPort_delayOffset.value?alert("No audio ports are available"):""==this.delayOffset.value&&alert("No delay offset is available")}getSupportedResolutions(e){const t={plugin:this.callsign,method:"getSupportedResolutions",params:{videoDisplay:e}};return this.api.req(null,t)}getCurrentResolution(e){const t={plugin:this.callsign,method:"getCurrentResolution",params:{videoDisplay:e}};return this.api.req(null,t)}setCurrentResolution(e,t){const i={plugin:this.callsign,method:"setCurrentResolution",params:{videoDisplay:e,resolution:t,persist:!0}};return this.api.req(null,i)}getSupportedTvResolutions(e){const t={plugin:this.callsign,method:"getSupportedTvResolutions",params:{videoDisplay:e}};return this.api.req(null,t)}getSupportedSettopResolutions(){const e={plugin:this.callsign,method:"getSupportedSettopResolutions"};return this.api.req(null,e)}getDefaultResolution(){const e={plugin:this.callsign,method:"getDefaultResolution"};return this.api.req(null,e)}getVideoPortStatusInStandby(e){const t={plugin:this.callsign,method:"getVideoPortStatusInStandby",params:{portName:e}};return this.api.req(null,t)}setVideoPortStatusInStandby(e,t){const i={plugin:this.callsign,method:"setVideoPortStatusInStandby",params:{portName:e,enabled:t}};return this.api.req(null,i)}getTvHDRSupport(){const e={plugin:this.callsign,method:"getTvHDRSupport"};return this.api.req(null,e)}getSettopHDRSupport(){const e={plugin:this.callsign,method:"getSettopHDRSupport"};return this.api.req(null,e)}getTVHDRCapabilities(){const e={plugin:this.callsign,method:"getTVHDRCapabilities"};return this.api.req(null,e)}getConnectedAudioPorts(){const e={plugin:this.callsign,method:"getConnectedAudioPorts"};return this.api.req(null,e)}getSupportedAudioPorts(){const e={plugin:this.callsign,method:"getSupportedAudioPorts"};return this.api.req(null,e)}getCurrentOutputSettings(){const e={plugin:this.callsign,method:"getCurrentOutputSettings"};return this.api.req(null,e)}supportedAudioModes(e){const t={plugin:this.callsign,method:"getSupportedAudioModes",params:{audioPort:e}};return this.api.req(null,t)}getSoundMode(){const e={plugin:this.callsign,method:"getSoundMode"};return this.api.req(null,e)}setSoundMode(e,t){const i={plugin:this.callsign,method:"setSoundMode",params:{audioPort:e,soundMode:t,persist:!0}};return this.api.req(null,i)}getActiveInput(e){const t={plugin:this.callsign,method:"getActiveInput",params:{videoDisplay:e}};return this.api.req(null,t)}getZoomSetting(){const e={plugin:this.callsign,method:"getZoomSetting"};return this.api.req(null,e)}setZoomSetting(e){const t={plugin:this.callsign,method:"setZoomSetting",params:{zoomSetting:e}};return this.api.req(null,t)}getMS12AudioCompression(e){const t={plugin:this.callsign,method:"getMS12AudioCompression"};return this.api.req(null,t)}setMS12AudioCompression(e){const t={plugin:this.callsign,method:"setMS12AudioCompression",params:{compresionLevel:e}};return this.api.req(null,t)}getConnectedVideoDisplays(){const e={plugin:this.callsign,method:"getConnectedVideoDisplays"};return this.api.req(null,e)}getSupportedVideoDisplays(){const e={plugin:this.callsign,method:"getSupportedVideoDisplays"};return this.api.req(null,e)}setDolbyVolumeMode(e){const t={plugin:this.callsign,method:"setDolbyVolumeMode",params:{dolbyVolumeMode:e}};return this.api.req(null,t)}getDolbyVolumeMode(){const e={plugin:this.callsign,method:"getDolbyVolumeMode"};return this.api.req(null,e)}readEDID(){const e={plugin:this.callsign,method:"readEDID"};return this.api.req(null,e)}readHostEDID(){const e={plugin:this.callsign,method:"readHostEDID"};return this.api.req(null,e)}setDialogEnhancement(e){const t={plugin:this.callsign,method:"setDialogEnhancement",params:{enhancerlevel:e}};return this.api.req(null,t)}getDialogEnhancement(){const e={plugin:this.callsign,method:"getDialogEnhancement"};return this.api.req(null,e)}setIntelligentEqualizerMode(e){const t={plugin:this.callsign,method:"setIntelligentEqualizerMode",params:{intelligentEqualizerMode:e}};return this.api.req(null,t)}getIntelligentEqualizerMode(){const e={plugin:this.callsign,method:"getIntelligentEqualizerMode"};return this.api.req(null,e)}getSinkAtmosCapability(){const e={plugin:this.callsign,method:"getSinkAtmosCapability"};return this.api.req(null,e)}setAudioAtmosOutputMode(e){const t={plugin:this.callsign,method:"setAudioAtmosOutputMode",params:{enable:e}};return this.api.req(null,t)}isConnectedDeviceRepeater(){const e={plugin:this.callsign,method:"isConnectedDeviceRepeater"};return this.api.req(null,e)}setVolumeLeveller(e,t){const i={plugin:this.callsign,method:"setVolumeLeveller",params:{audioPort:e,level:t}};return this.api.req(null,i)}getVolumeLeveller(e){const t={plugin:this.callsign,method:"getVolumeLeveller",params:{audioPort:e}};return this.api.req(null,t)}setVolumeLevel(e,t){const i={plugin:this.callsign,method:"setVolumeLevel",params:{audioPort:e,volumeLevel:t}};return this.api.req(null,i)}getVolumeLevel(e){const t={plugin:this.callsign,method:"getVolumeLevel",params:{audioPort:e}};return this.api.req(null,t)}setBassEnhancer(e,t){const i={plugin:this.callsign,method:"setBassEnhancer",params:{audioPort:e,bassBoost:t}};return this.api.req(null,i)}getBassEnhancer(e){const t={plugin:this.callsign,method:"getBassEnhancer",params:{audioPort:e}};return this.api.req(null,t)}setSurroundVirtualizer(e,t){const i={plugin:this.callsign,method:"setBassEnhancer",params:{audioPort:e,boost:t}};return this.api.req(null,i)}getSurroundVirtualizer(e){const t={plugin:this.callsign,method:"getSurroundVirtualizer",params:{audioPort:e}};return this.api.req(null,t)}setMISteering(e,t){const i={plugin:this.callsign,method:"setMISteering",params:{audioPort:e,MISteeringEnable:t}};return this.api.req(null,i)}getMISteering(e){const t={plugin:this.callsign,method:"getMISteering",params:{audioPort:e}};return this.api.req(null,t)}enableSurroundDecoder(e,t){const i={plugin:this.callsign,method:"enableSurroundDecoder",params:{audioPort:e,surroundDecoderEnable:t}};return this.api.req(null,i)}isSurroundDecoderEnabled(e){const t={plugin:this.callsign,method:"isSurroundDecoderEnabled",params:{audioPort:e}};return this.api.req(null,t)}setDRCMode(e,t){const i={plugin:this.callsign,method:"setDRCMode",params:{audioPort:e,DRCMode:t}};return this.api.req(null,i)}getDRCMode(e){const t={plugin:this.callsign,method:"getDRCMode",params:{audioPort:e}};return this.api.req(null,t)}setGain(e,t){const i={plugin:this.callsign,method:"setDRCMode",params:{audioPort:e,gain:t}};return this.api.req(null,i)}getGain(e){const t={plugin:this.callsign,method:"getGain",params:{audioPort:e}};return this.api.req(null,t)}setMuted(e,t){const i={plugin:this.callsign,method:"setDRCMode",params:{audioPort:e,muted:t}};return this.api.req(null,i)}getMuted(e){const t={plugin:this.callsign,method:"getGain",params:{audioPort:e}};return this.api.req(null,t)}setAudioDelay(e,t){const i={plugin:this.callsign,method:"setAudioDelay",params:{audioDelay:e,audioPort:t}};return this.api.req(null,i)}getAudioDelay(e){const t={plugin:this.callsign,method:"getAudioDelay",params:{audioPort:e}};return this.api.req(null,t)}getAudioDelayOffset(e){const t={plugin:this.callsign,method:"getAudioDelayOffset",params:{audioPort:e}};return this.api.req(null,t)}setAudioDelayOffset(e,t){const i={plugin:this.callsign,method:"setAudioDelayOffset",params:{audioDelayOffset:e,audioPort:t}};return this.api.req(null,i)}setScartParameter(e,t){const i={plugin:this.callsign,method:"setScartParameter",params:{scartParameter:e,scartParameterData:t}};return this.api.req(null,i)}updateDisplayRelatedResponse(){this.getSupportedTvResolutions(this.video_display_resolution.value).then(e=>{this.supported_tv_resolutions.innerHTML=e.supportedTvResolutions}),this.getSupportedSettopResolutions(this.video_display_resolution.value).then(e=>{this.supported_stb_resolutions.innerHTML=e.supportedSettopResolutions}),this.getVideoPortStatusInStandby(this.select_port_standby.value).then(e=>{e.videoPortStatusInStandby?this.standby_mode.checked=!0:this.standby_mode.checked=!1}),this.updateActiveInput(),this.getSupportedResolutions(this.video_display_resolution.value).then(e=>{this.supported_resolutions.innerHTML=e.supportedResolutions,this.totalResolution=e.supportedResolutions,this.updateCurrentResolution()})}update(){this.getSupportedVideoDisplays().then(e=>{this.supported_video_displays.innerHTML=e.supportedVideoDisplays;for(var t=[this.video_display_resolution,this.video_display_current,this.select_port_standby,this.video_display_active],i=0;i{null!=e&&e.success&&(this.default_resolution.innerHTML=e.defaultResolution)}),this.getConnectedAudioPorts().then(e=>{this.connected_audio_ports.innerHTML=e.connectedAudioPorts}),this.getSupportedAudioPorts().then(e=>{this.supported_audio_ports.innerHTML=e.supportedAudioPorts,this.audioPort=e.supportedAudioPorts[0];for(var t=[this.select_audio_port,this.audio_port,this.audioPort_leveller,this.audioPort_level,this.audioPort_bass,this.audioPort_boost,this.audioPort_steering,this.audioPort_surroundDecoder,this.audioPort_drc,this.audioPort_gain,this.audioPort_muted,this.audioPort_delay,this.audioPort_delayOffset],i=0;i{this.edid_hdmi.innerHTML=e.EDID}),this.readHostEDID().then(e=>{e&&""!=e.EDID?this.edid_host.innerHTML=e.EDID:this.edid_host.innerHTML="-"}),this.getTvHDRSupport().then(e=>{this.hdr_tv.innerHTML=e.standards}),this.getSettopHDRSupport().then(e=>{this.hdr_stb.innerHTML=e.standards}),this.getTVHDRCapabilities().then(e=>{switch(e.capabilities){case 0:this.hdr_tv_capabilities.innerHTML="HDRSTANDARD_NONE";break;case 1:this.hdr_tv_capabilities.innerHTML="HDRSTANDARD_HDR10";break;case 2:this.hdr_tv_capabilities.innerHTML="HDRSTANDARD_HLG";break;case 4:this.hdr_tv_capabilities.innerHTML="HDRSTANDARD_DolbyVision";break;case 8:this.hdr_tv_capabilities.innerHTML="HDRSTANDARD_TechnicolorPrime";break;default:this.hdr_tv_capabilities.innerHTML=e.capabilities}}),this.getCurrentOutputSettings().then(e=>{this.color_space.innerHTML=e.colorSpace,this.color_depth.innerHTML=e.colorDepth,this.matrix_coefficients.innerHTML=e.matrixCoefficients,this.video_EOTF.innerHTML=e.videoEOTF}),this.getZoomSetting().then(e=>{(i=document.createElement("option")).text=e.zoomSetting,i.value=e.zoomSetting,this.select_zoom_setting.appendChild(i),this.supportedZoomSettingFiltered=["FULL","NONE","Letterbox 16x9","Letterbox 14x9","CCO","PanScan","Letterbox 2.21 on 4x3","Letterbox 2.21 on 16x9","Platform","Zoom 16x9","Pillarbox 4x3","Widescreen 4x3"].filter(t=>e.zoomSetting!=t);for(var t=0;t{e&&null!=e.dolbyVolumeMode&&(this.dolby_mode.checked=e.dolbyVolumeMode)}),this.getSinkAtmosCapability().then(e=>{null!=e&&e.success?this.sink_atmos.innerHTML=e.atmos_capability:this.sink_atmos.innerHTML="-"}),this.isConnectedDeviceRepeater().then(e=>{e&&null!=e.HdcpRepeater?this.repeater=e.HdcpRepeater:this.repeater="-"}),this.getMISteering(this.audioPort_steering.value).then(e=>{e&&null!=e.MISteeringEnable?this.mi_enable.checked=e.MISteeringEnable:this.mi_enable.checked=!1}),this.isSurroundDecoderEnabled(this.audioPort_surroundDecoder.value).then(e=>{null!=e&&null!=e.surroundDecoderEnable?this.surroundDecoder_enable.checked=e.surroundDecoderEnable:this.surroundDecoder_enable.checked=!1}),this.getMuted(this.audioPort_muted.value).then(e=>{null!=e&&null!=e.muted?this.muted_enable.checked=e.muted:this.muted_enable.checked=!1}),this.getAudioDelay(this.audioPort_delay.value).then(e=>{null!=e&&null!=e.audioDelay?this.delay.value=e.audioDelay:this.delay.value=""}),this.getAudioDelayOffset(this.audioPort_delayOffset.value).then(e=>{null!=e&&null!=e.audioDelayOffset?this.delayOffset.value=e.audioDelayOffset:this.delayOffset.value=""}),this.updateEnhancerList(),this.updateEqualizerList()}close(){this.onResolutionChanged&&"function"==typeof this.onResolutionChanged.dispose&&(this.onResolutionChanged.dispose(),this.onResolutionChanged=null),this.onZoomSettingUpdated&&"function"==typeof this.onZoomSettingUpdated.dispose&&(this.onZoomSettingUpdated.dispose(),this.onZoomSettingUpdated=null),this.onActiveInputChanged&&"function"==typeof this.onActiveInputChanged.dispose&&(this.onActiveInputChanged.dispose(),this.onActiveInputChanged=null),this.onConnectedVideoDisplaysUpdated&&"function"==typeof this.onConnectedVideoDisplaysUpdated.dispose&&(this.onConnectedVideoDisplaysUpdated.dispose(),this.onConnectedVideoDisplaysUpdated=null)}};var Y=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="HDCP Profile",this.mainDiv=document.getElementById("main"),this.template='\n\t\t
        \n\t\t\tHDCP Status\n\t\t
        \n\t\t
        \n\t\t\tHDCP Supported\n\t\t
        \n\t\t
        \n\t\t\t-\n\t\t
        \n\t\t
        \n\t\t\tDisplay connected\n\t\t
        \n\t\t
        \n\t\t\t-\n\t\t
        \n\t\t
        \n\t\t\tHDCP Compliant display\n\t\t
        \n\t\t
        \n\t\t\t-\n\t\t
        \n\t\t
        \n\t\t\tHDCP Enabled content\n\t\t
        \n\t\t
        \n\t\t\t-\n\t\t
        \n\t\t
        \n\t\t\tSupported HDCP Version\n\t\t
        \n\t\t
        \n\t\t\t-\n\t\t
        \n\t\t
        \n\t\t\tReceiver HDCP Version\n\t\t
        \n\t\t
        \n\t\t\t-\n\t\t
        \n\t\t
        \n\t\t\tCurrent HDCP Version\n\t\t
        \n\t\t
        \n\t\t\t-\n\t\t
        \n \t'}render(){this.mainDiv.innerHTML=this.template,this.hdcpSupport=document.getElementById("hdcp_support"),this.hdcpConnect=document.getElementById("hdcp_connect"),this.hdcpCompliant=document.getElementById("hdcp_compliant"),this.hdcpEnabled=document.getElementById("hdcp_enabled"),this.hdcpVersion=document.getElementById("hdcp_version"),this.receiverVersion=document.getElementById("receiver_version"),this.currentVersion=document.getElementById("current_version"),this.getStbSupport().then(e=>{this.hdcpSupport.innerHTML=e.isHDCPSupported}),this.update(),this.onDisplayChange=this.api.t.on(this.callsign,"onDisplayConnectionChanged",e=>{this.updateData(e.HDCPStatus)})}update(){this.getHdcpStatus().then(e=>{this.updateData(e.HDCPStatus)})}updateData(e){this.hdcpConnect.innerHTML=e.isConnected,this.hdcpCompliant.innerHTML=e.isHDCPCompliant,this.hdcpEnabled.innerHTML=e.isHDCPEnabled,this.hdcpVersion.innerHTML=e.supportedHDCPVersion,this.receiverVersion.innerHTML=e.receiverHDCPVersion,this.currentVersion.innerHTML=e.currentHDCPVersion}getStbSupport(){const e={plugin:this.callsign,method:"getSettopHDCPSupport"};return this.api.req(null,e)}getHdcpStatus(){const e={plugin:this.callsign,method:"getHDCPStatus"};return this.api.req(null,e)}};var X=class extends T{constructor(e,t){super(e,t),this.displayName="HDMIInput",this.value="",this.namedPing=!1,this.namedTrace=!1}render(){document.getElementById("main").innerHTML='\n
        \n HDMI Input Devices\n
        \n
        \n
        \n
        \n
        \n Activate/Deactivate Input\n
        \n
        \n Port Id\n
        \n
        \n \n
        \n
        \n \n \n
        \n
        \n EDID\n
        \n
        \n EDID value of currently stubbed\n
        \n
        \n -\n
        \n
        \n Change EDID value\n
        \n
        \n Device Id\n
        \n
        \n \n
        \n
        \n Message\n
        \n
        \n \n
        \n
        \n \n
        \n ',this.input_devices=document.getElementById("input_devices"),this.portId=document.getElementById("portId"),this.start=document.getElementById("start"),this.start.onclick=this.doStart.bind(this),this.stop=document.getElementById("stop"),this.stop.onclick=this.doStop.bind(this),this.read_edid=document.getElementById("read_edid"),this.deviceId=document.getElementById("deviceId"),this.edid_message=document.getElementById("edid_message"),this.write_edid=document.getElementById("write_edid"),this.write_edid.onclick=this.doWrite.bind(this),this.streaming=!1,this.onDevicesChanged=this.api.t.on(this.callsign,"onDevicesChanged",this.update()),this.length=0}doStart(){if(this.portId.value)try{this.startHdmiInput(this.portId.value).then(e=>{e&&e.success?(this.streaming=!0,alert("Successfully started hdmi input streaming")):alert("Failed to start hdmi input streaming")})}catch(e){alert("Error in getting response")}else alert("No active ports available to start hdmi streaming")}doStop(){if(this.streaming){if(this.portId.value)try{this.stopHdmiInput().then(e=>{e&&e.success?(this.streaming=!1,alert("Successfully stopped hdmi input streaming")):alert("Failed to stop hdmi input streaming")})}catch(e){alert("Error in getting response")}}else alert("Currently, there is no streaming from hdmi input to stop")}doWrite(){if(""!==this.edid_message.value&&0!=this.edid_message.value.trim().length&&this.deviceId.value)try{this.writeEDID(parseInt(this.deviceId.value),this.edid_message.value).then(e=>{e&&e.success?(this.streaming=!0,alert("Successfully set message")):alert("Failed to set edid value")})}catch(e){alert("Error in setting edid value")}else""==this.deviceId.value?alert("No active ports available to change EDID value"):""!=this.edid_message.value&&0!=this.edid_message.value.trim().length||alert("Please provide message")}getHDMIInputDevices(){const e={plugin:this.callsign,method:"getHDMIInputDevices"};return this.api.req(null,e)}startHdmiInput(e){const t={plugin:this.callsign,method:"startHdmiInput",params:{portId:e}};return this.api.req(null,t)}stopHdmiInput(){const e={plugin:this.callsign,method:"stopHdmiInput"};return this.api.req(null,e)}readEDID(){const e={plugin:this.callsign,method:"readEDID"};return this.api.req(null,e)}writeEDID(e,t){const i={plugin:this.callsign,method:"writeEDID",params:{deviceId:e,message:t}};return this.api.req(null,i)}update(){this.input_devices.innerHTML="";for(var e=length-1;e>=0;e--)this.portId.options[e]=null,this.deviceId.options[e]=null;try{this.getHDMIInputDevices().then(e=>{if(e&&e.success&&e.devices.length){this.length=e.devices.length,this.tr1=document.createElement("tr"),this.tr1.id="tr",this.tr1.className="text grid__col grid__col--8-of-8",this.td1=document.createElement("th"),this.td1.id="td",this.td1.className="text grid__col grid__col--2-of-8",this.td1div=document.createElement("div"),this.td1div.innerHTML="Locator",this.td2=document.createElement("th"),this.td2.id="td",this.td2div=document.createElement("div"),this.td2.className="text grid__col grid__col--2-of-8",this.td2div.innerHTML="Connected",this.td1.appendChild(this.td1div),this.td2.appendChild(this.td2div),this.tr1.appendChild(this.td1),this.tr1.appendChild(this.td2),this.input_devices.appendChild(this.tr1);for(var t=0;t\n Locator\n Connected\n \n \n No data available\n \n ":alert("Error in getting response")})}catch(e){alert("Failed to get response")}try{this.readEDID().then(e=>{e&&e.success&&e.name?this.read_edid.innerHTML=e.name:alert("Failed to get response")})}catch{alert("Error in getting response")}}close(){this.onDevicesChanged&&"function"==typeof this.onDevicesChanged.dispose&&(this.onDevicesChanged.dispose(),this.onDevicesChanged=null)}};var $=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Logging Preferences",this.mainDiv=document.getElementById("main"),this.template='\n\t\t\t
        \n\t\t\t\tLogging Preferences\n\t\t\t
        \n\t\t\t
        \n\t\t\t\tKeystroke Mask\n\t\t\t
        \n\t\t\t
        \n\t\t\t\t\n\t\t\t\t\n\t\t\t
        \n\t\t\t
        \n\t\t\t\t-\n\t\t\t
        \n '}getKeyStrokeMask(){const e={plugin:this.callsign,method:"isKeystrokeMaskEnabled"};return this.api.req(null,e)}setKeyStrokeMask(e){const t={plugin:this.callsign,method:"setKeystrokeMaskEnabled",params:{keystrokeMaskEnabled:e}};return this.api.req(null,t)}update(){this.getKeyStrokeMask().then(e=>{e.keystrokeMaskEnabled?(this.logPreference.checked=!0,this.keyStroke.innerHTML="Enabled"):e.keystrokeMaskEnabled||(this.logPreference.checked=!1,this.keyStroke.innerHTML="Disabled")})}render(){this.mainDiv.innerHTML=this.template,this.keyStroke=document.getElementById("KeyStrokeMaskStatus"),this.logPreference=document.getElementById("LogPreference"),this.update(),this.logPreference.onclick=this.mask.bind(this),this.onKeystrokeMaskEnabledChange=this.api.t.on(this.callsign,"onKeystrokeMaskEnabledChange",this.update.bind(this))}mask(){this.logPreference.checked?this.setKeyStrokeMask(!0):this.logPreference.checked||this.setKeyStrokeMask(!1)}};var Q=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Location"}render(){document.getElementById("main").innerHTML='
        \n Location\n
        \n\n
        \n City\n
        \n
        \n -\n
        \n
        \n Country\n
        \n
        \n -\n
        \n
        \n Region\n
        \n
        \n -\n
        \n\n
        \n Timezone\n
        \n
        \n -\n
        \n\n
        \n Public IP\n
        \n
        \n -\n
        \n\n
        \n Sync\n
        \n
        \n \n
        ',document.getElementById("syncButton").onclick=this.syncLocation.bind(this),this.cityEl=document.getElementById("city"),this.countryEl=document.getElementById("country"),this.regionEl=document.getElementById("region"),this.timezoneEl=document.getElementById("timezone"),this.publicIpEl=document.getElementById("publicip"),this.update()}syncLocation(){const e={plugin:this.callsign,method:"sync"};this.api.req(null,e).then(()=>{this.update()})}location(){const e={plugin:this.callsign,method:"location"};return this.api.req(null,e)}update(){this.location().then(e=>{this.cityEl.innerHTML=e.city,this.countryEl.innerHTML=e.country,this.regionEl.innerHTML=e.region,this.timezoneEl.innerHTML=e.timezone,this.publicIpEl.innerHTML=e.publicip})}};var ee=class extends T{constructor(e,t){super(e,t),this.displayName="Messaging",this.modules=void 0,this.selectedModule=void 0,this.controls=void 0,this.socketUrl=`ws://${t.host[0]}:${t.host[1]}/Service/MessageControl`,this.messagingSocket=void 0}close(){this._closeSocket(),super.close()}enableControl(e,t,i){const n={plugin:"MessageControl",method:"enable",params:{type:"SysLog"===e?"Logging":"Reporting"===e?"Reporting":"OperationalStream"===e?"OperationalStream":"Assert"===e?"Assert":"Tracing",module:e,category:t,enabled:i}};return this.api.req(null,n)}retrieveModules(){return this.api.req(null,{plugin:"MessageControl",method:"modules"})}retrieveCategories(e){const t={plugin:"MessageControl",method:"controls@"+e};return this.api.req(null,t)}render(){this._openSocket();var e=this;document.getElementById("main").innerHTML='
        \n Modules\n
        \n\n
        \n \n
        \n
        \n \n
        \n\n
        \n\n
        \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
        timemodulecategorymessageadditional information
        \n
        \n ',document.getElementById("messagingModules").onchange=this.getSelectedModuleAndShowCategories.bind(this),this.retrieveModules().then(t=>{e.modules=t,e.modules.sort();var i=document.getElementById("messagingModules");if(i.options.length=0,void 0!==e.modules){for(var n=0;n{this.controls=t,this.controls.sort((e,t)=>e.categoryt.category?1:0);var i=document.getElementById("messaging_div");if(i.innerHTML="",0!==this.controls.length){this.selectedModule=e;for(var n=0;n/g,">").replace(/"/g,""").replace(/'/g,"'")}_socketMessage(e){const t=JSON.parse(e.data),n=new Date(t.time),s=document.createElement("tr"),o=document.createElement("td");o.innerHTML=`${n.getHours()}:${n.getMinutes()}:${n.getSeconds()}`,s.appendChild(o);const l=document.createElement("td");l.innerHTML=t.module,s.appendChild(l);const d=document.createElement("td");d.innerHTML=t.category,s.appendChild(d);var r=new(i(14));const a=document.createElement("td");a.innerHTML=r.toHtml(t.message),s.appendChild(a);const c=document.createElement("td");if(void 0!==t.classname&&void 0!==t.filename&&void 0!==t.linenumber){const e=this.escapeHtml(t.classname);c.innerHTML=`${t.filename}:${t.linenumber}::${e}`}else void 0!==t.processid&&void 0!==t.processname&&void 0!==t.filename&&void 0!==t.linenumber?c.innerHTML=`[${t.processid}]${t.processname}::${t.filename}:${t.linenumber}`:void 0!==t.callsign?c.innerHTML=""+t.callsign:c.innerHTML="";s.appendChild(c),document.getElementById("messagesData").appendChild(s);const u=document.getElementById("messagesTableContainer");u.scrollTop=u.scrollHeight}_openSocket(){this._closeSocket(),this.messagingSocket=new WebSocket(this.socketUrl,"json"),this.messagingSocket.onmessage=this._socketMessage.bind(this)}_closeSocket(){this.messagingSocket&&(this.messagingSocket.close(),this.messagingSocket=void 0)}};var te=class extends T{constructor(e,t){super(e,t)}render(){document.getElementById("main").innerHTML='
        \n IOConnector\n
        \n\n
        \n PIN\n
        \n
        \n \n
        \n
        \n \n
        \n\n
        \n Value\n
        \n
        \n \n
        \n
        \n \n
        ',this.pinEl=document.getElementById("pinInput"),this.valueEl=document.getElementById("valueInput"),document.getElementById("get").onclick=this.getPin.bind(this),document.getElementById("set").onclick=this.setPin.bind(this)}pin(e,t){const i={plugin:this.callsign,method:"pin@"+e};return""!==t&&(i.params=t),this.api.req(null,i)}getPin(){let e=this.pinEl.value;this.pin(e).then(e=>{this.valueEl.value=e})}setPin(){let e=this.pinEl.value,t=this.valueEl.value;this.pin(e,t)}};var ie=class extends T{constructor(e,t){super(e,t),this.displayName="Messenger",this.rooms=new Map}render(){document.getElementById("main").innerHTML='\n
        \n Join\n
        \n
        \n User\n
        \n
        \n \n
        \n
        \n Room\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n
        \n
        \n Leave\n
        \n
        \n RoomId\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n
        \n
        \n Send Message\n
        \n
        \n RoomId\n
        \n
        \n \n
        \n
        \n Message\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n
        \n ',this.user=document.getElementById("user"),this.room=document.getElementById("room"),this.join=document.getElementById("join"),this.join.onclick=this.doJoinRoom.bind(this),this.joined_text=document.getElementById("joined_text"),this.room_id=document.getElementById("room_id"),this.leave=document.getElementById("leave"),this.leave.onclick=this.doLeaveRoom.bind(this),this.left_text=document.getElementById("left_text"),this.message_room_id=document.getElementById("message_room_id"),this.message=document.getElementById("message"),this.sent=document.getElementById("sent"),this.sent.onclick=this.doSentMessage.bind(this),this.send_text=document.getElementById("send_text")}_formatRoomLabel(e){const t=this.rooms.get(e);return t?`${e} (${t.user}/${t.name})`:e}_addRoomOptions(e){const t=this._formatRoomLabel(e);if([...this.room_id.options].some(t=>t.value===e))[...this.room_id.options].forEach(i=>{i.value===e&&(i.text=t)});else{const i=document.createElement("option");i.value=e,i.text=t,this.room_id.appendChild(i)}if([...this.message_room_id.options].some(t=>t.value===e))[...this.message_room_id.options].forEach(i=>{i.value===e&&(i.text=t)});else{const i=document.createElement("option");i.value=e,i.text=t,this.message_room_id.appendChild(i)}}_extractRoomId(e){if("string"==typeof e)return e;if(!e)return null;if("string"==typeof e.result)return e.result;const t=void 0!==e.result?e.result:e;return"string"==typeof t?t:t&&"object"==typeof t&&(t.roomid||t.roomId||t.room||t.id)||null}doJoinRoom(){if(""!==this.user.value&&""!==this.room.value&&0!==this.user.value.trim().length&&0!==this.room.value.trim().length){const e=this.user.value.trim(),t=this.room.value.trim();this.joinRoom(e,t).then(i=>{if(i&&"object"==typeof i&&i.error)return console.warn("Join returned error object:",i.error),void alert("Failed to join room (backend error)");const n=this._extractRoomId(i);console.debug("Extracted roomId:",n),n&&"string"==typeof n&&n.trim().length?(this.rooms.has(n)||this.rooms.set(n,{name:t,user:e}),this.joined_text.textContent="Joined room "+this._formatRoomLabel(n),setTimeout(()=>this.removeJoinText(),2e3),this._addRoomOptions(n),this.room_id.value=n,this.message_room_id.value=n):(console.warn("Join response missing usable room id after extraction:",i),alert("Failed to join room (no room identifier in response)"))}).catch(e=>{console.error("Join RPC failed:",e),alert("Failed to join room (RPC error)")})}else""===this.user.value&&""===this.room.value||0===this.user.value.trim().length&&0===this.room.value.trim().length?alert("Please provide user and room value to join the room"):""===this.user.value||0===this.user.value.trim().length?alert("Please provide user value to join the room"):""!==this.room.value&&0!==this.room.value.trim().length||alert("Please provide room value to join the room")}doLeaveRoom(){if(this.roomIdValue=this.room_id.selectedIndex,this.roomIdValue>=0){const e=this.room_id[this.roomIdValue].value;this.leaveRoom(e).then(t=>{t&&t.error?(console.warn("Leave error response:",t),alert("Failed to leave room")):(this.left_text.textContent="Left room "+this._formatRoomLabel(e),setTimeout(()=>this.removeLeftText(),2e3),this.room_id.remove(this.roomIdValue),this.message_room_id.remove(this.roomIdValue),this.rooms.delete(e),this.user.value="",this.room.value="",this.message.value="")}).catch(e=>{console.error("Leave RPC failed:",e),alert("Failed to leave room (RPC error)")})}else alert("No rooms are available to leave")}doSentMessage(){if(this.messageRoomIdValue=this.message_room_id.selectedIndex,this.messageRoomIdValue>=0&&""!==this.message.value&&0!==this.message.value.trim().length){const e=this.message_room_id.options[this.messageRoomIdValue].value;this.sentMessage(e,this.message.value).then(t=>{t&&t.error?(console.warn("Send error response:",t),alert("Failed to send message")):(this.send_text.innerText="Message sent to "+e,setTimeout(()=>this.removeSendText(),2e3))}).catch(e=>{console.error("Send RPC failed:",e),alert("Failed to send message (RPC error)")})}else""===this.message.value||0===this.message.value.trim().length?alert("Please provide message value"):this.messageRoomIdValue<0&&alert("No rooms are available to send a message")}joinRoom(e,t){const i={plugin:this.callsign,method:"join",params:{user:e,room:t}};return this.api.req(null,i)}leaveRoom(e){const t={plugin:this.callsign,method:"leave",params:{roomid:e}};return this.api.req(null,t)}sentMessage(e,t){const i={plugin:this.callsign,method:"sent",params:{roomid:e,message:t}};return this.api.req(null,i)}removeJoinText(){this.joined_text&&(this.joined_text.textContent="")}removeLeftText(){this.left_text&&(this.left_text.textContent="")}removeSendText(){this.send_text&&(this.send_text.textContent="")}close(){if(this.room_id){[...this.room_id.options].map(e=>e.value).forEach(e=>this.leaveRoom(e)),this.rooms.clear()}}};var ne=class extends T{constructor(e,t){super(e,t),this.monitor=void 0,this.netflixVisibilityListener=this.api.t.on("Netflix","visibilitychange",e=>{"boolean"==typeof e.hidden&&(this.isHidden=e.hidden,!0===this.rendered&&this.update())}),this.netflixStateListener=this.api.t.on("Netflix","statechange",e=>{"boolean"==typeof e.suspended&&(this.isSuspended=e.suspended,!0===this.rendered&&this.update())}),this.api.getControllerPlugins().then(e=>{let t=e.filter(e=>"Monitor"===e.callsign);void 0!==t&&(this.monitor=new H(t,this.api))})}render(){document.getElementById("main").innerHTML='
        \n ESN\n
        \n\n
        \n ID\n
        \n
        \n -\n
        \n\n
        \n
        \n
        \n
        Memory
        \n
        Current State
        \n
        \n
        \n
        \n \n
        \n
        \n
        ',this.interval=setInterval(this.update.bind(this),I.refresh_interval),this.update()}update(e){this.status().then(e=>{e.esn&&(document.getElementById("netflix-esn").innerHTML=e.esn);var t=e.suspended?"Suspended":"Resumed";document.getElementById("NetflixStateInfo").innerHTML=t;var i="Suspend";!0===e.suspended&&(i="Resume");var n=document.getElementById("NetflixSuspendButton");n.innerHTML=i.toUpperCase(),n.onclick=this.toggleSuspend.bind(this,i),this.monitor&&this.monitor.getMonitorDataAndDiv().then(e=>{var t=document.getElementById(this.callsign+"Memory");t.innerHTML="",t.appendChild(e)})})}close(){clearInterval(this.interval),this.netflixVisibilityListener&&"function"==typeof this.netflixVisibilityListener.dispose&&this.netflixVisibilityListener.dispose(),this.netflixStateListener&&"function"==typeof this.netflixStateListener.dispose&&this.netflixStateListener.dispose()}toggleSuspend(e){var t=this;"Resume"===e?this.resume().then(()=>{t.update({suspended:!1})}).catch(e=>{t.render()}):this.suspend().then(()=>{t.update({suspended:!0})}).catch(e=>{t.render()})}};var se=class extends T{constructor(e,t){super(e,t),this.displayName="Network",this.value="",this.namedPing=!1,this.namedTrace=!1}render(){document.getElementById("main").innerHTML='\n
        \n Interfaces and status\n
        \n
        \n
        \n
        \n
        \n IP address\n
        \n
        \n -\n
        \n
        \n Default Interface\n
        \n
        \n \n \n
        \n
        \n Ping an endpoint\n
        \n
        \n Type\n
        \n
        \n \n
        \n
        \n Endpoint\n
        \n
        \n \n
        \n
        \n Packets\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n
        \n
        \n
        \n Trace an endpoint\n
        \n
        \n Type\n
        \n
        \n \n
        \n
        \n Endpoint\n
        \n
        \n \n
        \n
        \n Packets\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n
        \n
        \n ',this.current_api_version=document.getElementById("current_api_version"),this.stb_ip=document.getElementById("stb_ip"),this.set_api=document.getElementById("set_api"),this.get_interfaces=document.getElementById("get_interfaces"),this.change_default_interface=document.getElementById("change_default_interface"),this.set_default_interface=document.getElementById("set_default_interface"),this.set_default_interface.onclick=this.setNewDefaultInterface.bind(this),this.input_endpoint_ping=document.getElementById("input_endpoint_ping"),this.input_endpoint_trace=document.getElementById("input_endpoint_trace"),this.select_input=document.getElementById("select_input "),this.packets_ping=document.getElementById("packets_ping"),this.type_ping=document.getElementById("type_ping"),this.type_ping.onchange=this.changePingInput.bind(this),this.type_trace=document.getElementById("type_trace"),this.type_trace.onchange=this.changeTraceInput.bind(this),this.set_ping_endpoint=document.getElementById("set_ping_endpoint"),this.set_ping_endpoint.onclick=this.doPing.bind(this),this.ping_response=document.getElementById("ping"),this.trace_endpoint=document.getElementById("trace_endpoint"),this.trace_packets=document.getElementById("trace_packets"),this.set_trace_endpoint=document.getElementById("set_trace_endpoint"),this.set_trace_endpoint.onclick=this.doTrace.bind(this),this.trace_response=document.getElementById("trace"),this.onConnectionStatusChanged=this.api.t.on(this.callsign,"onConnectionStatusChanged",this.connectionChange.bind(this)),this.onIPAddressStatusChanged=this.api.t.on(this.callsign,"onIPAddressStatusChanged",this.ipChange.bind(this)),this.onDefaultInterfaceChanged=this.api.t.on(this.callsign,"onDefaultInterfaceChanged",this.defaultInterfaceChange.bind(this)),this.onInterfaceStatusChanged=this.api.t.on(this.callsign,"onInterfaceStatusChanged",this.interfaceStatusChange.bind(this)),this.update()}changePingInput(){this.input_endpoint_ping.remove(),"Named"==this.type_ping.value?(this.input_endpoint_ping=document.createElement("select"),this.input_endpoint_ping.className="grid__col--5-of-8",document.getElementById("select_input").appendChild(this.input_endpoint_ping),this.getNamedEndpoints().then(e=>{for(var t=0;t{for(var t=0;t{this.stb_ip.innerHTML=e.ip})}interfaceChange(e){this.change_default_interface.innerHTML="",this.defaultInterface.remove(),this.updateDefaultInterface()}interfaceStatusChange(e){document.getElementById("enable_addr"+e.interface).checked=e.enabled}defaultInterfaceChange(){this.change_default_interface.innerHTML="",this.defaultInterface.remove(),this.updateDefaultInterface()}updateDefaultInterface(){this.getDefaultInterface().then(e=>{this.defaultInterface=document.createElement("option"),this.defaultInterface.text=e.interface,this.defaultInterface.value=e.interface,this.change_default_interface.appendChild(this.defaultInterface),this.interfacesList=this.interfaces.filter(t=>-1===e.interface.indexOf(t));for(var t=0;t{e.success||alert("Failed to set "+this.change_default_interface[this.selectedIndex].value+" as default interface"),this.change_default_interface.innerHTML="",this.updateDefaultInterface()})}createPingResponse(e,t){this.target=document.createElement("tr"),this.target_key=document.createElement("td"),this.target_key.className="label grid__col grid__col--4-of-8",this.target_key.innerHTML="Target",this.target_addr=document.createElement("td"),this.target_addr.className="label grid__col grid__col--4-of-8",this.target_addr.innerHTML=e.target,this.target.appendChild(this.target_key),this.target.appendChild(this.target_addr),this.packets_trans=document.createElement("tr"),this.packets_trans_key=document.createElement("td"),this.packets_trans_key.className="label grid__col grid__col--4-of-8",this.packets_trans_key.innerHTML="Packets transmitted",this.packets_trans_result=document.createElement("td"),this.packets_trans_result.className="label grid__col grid__col--4-of-8",this.packets_trans_result.innerHTML=e.packetsTransmitted,this.packets_trans.appendChild(this.packets_trans_key),this.packets_trans.appendChild(this.packets_trans_result),this.packets_receive=document.createElement("tr"),this.packets_receive_key=document.createElement("td"),this.packets_receive_key.className="label grid__col grid__col--4-of-8",this.packets_receive_key.innerHTML="Packets Received",this.packets_receive_result=document.createElement("td"),this.packets_receive_result.className="label grid__col grid__col--4-of-8",this.packets_receive_result.innerHTML=e.packetsReceived,this.packets_receive.appendChild(this.packets_receive_key),this.packets_receive.appendChild(this.packets_receive_result),this.packets_loss=document.createElement("tr"),this.packets_loss_key=document.createElement("td"),this.packets_loss_key.className="label grid__col grid__col--4-of-8",this.packets_loss_key.innerHTML="Packets Loss",this.packets_loss_result=document.createElement("td"),this.packets_loss_result.className="label grid__col grid__col--4-of-8",this.packets_loss_result.innerHTML=e.packetLoss,this.packets_loss.appendChild(this.packets_loss_key),this.packets_loss.appendChild(this.packets_loss_result),this.tripMin=document.createElement("tr"),this.tripMin_key=document.createElement("td"),this.tripMin_key.className="label grid__col grid__col--4-of-8",this.tripMin_key.innerHTML="Trip Min",this.tripMin_result=document.createElement("td"),this.tripMin_result.className="label grid__col grid__col--4-of-8",this.tripMin_result.innerHTML=e.tripMin,this.tripMin.appendChild(this.tripMin_key),this.tripMin.appendChild(this.tripMin_result),this.tripAvg=document.createElement("tr"),this.tripAvg_key=document.createElement("td"),this.tripAvg_key.className="label grid__col grid__col--4-of-8",this.tripAvg_key.innerHTML="Trip Avg",this.tripAvg_result=document.createElement("td"),this.tripAvg_result.className="label grid__col grid__col--4-of-8",this.tripAvg_result.innerHTML=e.tripAvg,this.tripAvg.appendChild(this.tripAvg_key),this.tripAvg.appendChild(this.tripAvg_result),this.tripMax=document.createElement("tr"),this.tripMax_key=document.createElement("td"),this.tripMax_key.className="label grid__col grid__col--4-of-8",this.tripMax_key.innerHTML="Trip Max",this.tripMax_result=document.createElement("td"),this.tripMax_result.className="label grid__col grid__col--4-of-8",this.tripMax_result.innerHTML=e.tripMax,this.tripAvg.appendChild(this.tripMax_key),this.tripAvg.appendChild(this.tripMax_result),this.tripStdDev=document.createElement("tr"),this.tripStdDev_key=document.createElement("td"),this.tripStdDev_key.className="label grid__col grid__col--4-of-8",this.tripStdDev_key.innerHTML="Trip Std Dev",this.tripStdDev_result=document.createElement("td"),this.tripStdDev_result.className="label grid__col grid__col--4-of-8",this.tripStdDev_result.innerHTML=e.tripStdDev,this.tripStdDev.appendChild(this.tripStdDev_key),this.tripStdDev.appendChild(this.tripStdDev_result),t.appendChild(this.target),t.appendChild(this.packets_trans),t.appendChild(this.packets_receive),t.appendChild(this.packets_loss),t.appendChild(this.tripMin),t.appendChild(this.tripAvg),t.appendChild(this.tripMax),t.appendChild(this.tripStdDev)}createPingErrMsg(e){alert(e.error)}createTraceResponse(e,t){for(var i=0;i{this.isInterfaceEnabled(e).then(t=>{document.getElementById("enable_addr"+e).checked=t.enabled}),t.success||(this.enableVal?this.alertMsg="enable":this.alertMsg="disable",alert("Failed to "+this.alertMsg+" "+e))})}startLoading(){this.loadingEl=document.getElementById("disconnected");this.loadingEl.style.display="block",this.loadingEl.innerHTML='
        \n
        Waiting for response
        \n
        '}stopLoading(){this.loadingEl.innerHTML="",this.loadingEl.style.display="none"}doPing(){this.ping_response&&(this.ping_response.innerHTML="",this.ping_response.id=""),this.namedPing?this.value=this.input_endpoint_ping[this.input_endpoint_ping.selectedIndex].value:this.value=this.input_endpoint_ping.value,""==this.value&&""==this.packets_ping.value?alert("Please provide endpoint and packet values to ping"):""==this.value?alert("Please provide endpoint value to ping"):""==this.packets_ping.value?alert("Please provide packet value to ping"):(this.startLoading(),this.namedPing?this.pingNamedEndpoint(this.value,this.packets_ping.value).then(e=>{this.stopLoading(),e.success?(this.ping_response.id="tableMedium",this.createPingResponse(e,this.ping_response,"notNamed")):this.createPingErrMsg(e,"notNamed")}):(this.value=this.input_endpoint_ping.value,this.ping(this.value,this.packets_ping.value).then(e=>{this.stopLoading(),e.success?(this.ping_response.id="tableMedium",this.createPingResponse(e,this.ping_response,"notNamed")):this.createPingErrMsg(e,"notNamed")})))}doTrace(){this.trace_response&&(this.trace_response.innerHTML="",this.trace_response.id=""),this.namedTrace?this.traceValue=this.input_endpoint_trace[this.input_endpoint_trace.selectedIndex].value:this.traceValue=this.input_endpoint_trace.value,""==this.traceValue&&""==this.trace_packets.value?alert("Please provide endpoint and packet values to trace"):""==this.traceValue?alert("Please provide endpoint value to trace"):""==this.trace_packets.value?alert("Please provide packet value to trace endpoint"):(this.startLoading(),this.namedTrace?this.traceNamedEndpoint(this.traceValue,this.trace_packets.value).then(e=>{this.stopLoading(),e.success?(this.trace_response.innerHTML="",this.trace_response.id="tableMedium",this.createTraceResponse(e,this.trace_response,"notNamed")):this.createTraceErrMsg(e,"notNamed")}):this.trace(this.traceValue,this.trace_packets.value).then(e=>{this.stopLoading(),e.success?(this.trace_response.innerHTML="",this.trace_response.id="tableMedium",this.createTraceResponse(e,this.trace_response,"notNamed")):this.createTraceErrMsg(e,"notNamed")}))}setTypes(){var e=document.createElement("option");e.text="NotNamed",e.value="NotNamed",this.type_ping.appendChild(e);var t=document.createElement("option");t.text="Named",t.value="Named",this.type_ping.appendChild(t);var i=document.createElement("option");i.text="NotNamed",i.value="NotNamed",this.type_trace.appendChild(i);var n=document.createElement("option");n.text="Named",n.value="Named",this.type_trace.appendChild(n)}setInterfaces(e){this.interfaces=[],this.tr1=document.createElement("tr"),this.tr1.className="text grid__col grid__col--8-of-8",this.td1=document.createElement("td"),this.td1.className="text grid__col grid__col--2-of-8",this.td1div=document.createElement("div"),this.td1div.innerHTML="Interface",this.td2=document.createElement("td"),this.td2div=document.createElement("div"),this.td2.className="text grid__col grid__col--2-of-8",this.td2div.innerHTML="MAC Address",this.td3=document.createElement("td"),this.td3div=document.createElement("div"),this.td3.className="text grid__col grid__col--2-of-8",this.td3div.innerHTML="Connection Status",this.td4=document.createElement("td"),this.td4div=document.createElement("div"),this.td4.className="text grid__col grid__col--2-of-8",this.td4div.innerHTML="Enabled status",this.td1.appendChild(this.td1div),this.td2.appendChild(this.td2div),this.td3.appendChild(this.td3div),this.td4.appendChild(this.td4div),this.tr1.appendChild(this.td1),this.tr1.appendChild(this.td2),this.tr1.appendChild(this.td3),this.tr1.appendChild(this.td4),this.get_interfaces.appendChild(this.tr1);for(var t=0;t{this.stb_ip.innerHTML=e.ip}),this.setTypes(),this.getInterfaces().then(e=>{this.setInterfaces(e)})}close(){this.onConnectionStatusChanged&&"function"==typeof this.onConnectionStatusChanged.dispose&&(this.onConnectionStatusChanged.dispose(),this.onConnectionStatusChanged=null),this.onIPAddressStatusChanged&&"function"==typeof this.onIPAddressStatusChanged.dispose&&(this.onIPAddressStatusChanged.dispose(),this.onIPAddressStatusChanged=null),this.onDefaultInterfaceChanged&&"function"==typeof this.onDefaultInterfaceChanged.dispose&&(this.onDefaultInterfaceChanged.dispose(),this.onDefaultInterfaceChanged=null),this.onInterfaceStatusChanged&&"function"==typeof this.onInterfaceStatusChanged.dispose&&(this.onInterfaceStatusChanged.dispose(),this.onInterfaceStatusChanged=null)}};var oe=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Network",this.isUp=!1,this.dns=[],this.networks=[],this.interfaces=[],this.modeList=["Dynamic","Static"]}render(){document.getElementById("main").innerHTML='\n
        \n Network Control\n
        \n
        \n Network Interface\n
        \n
        \n \n
        \n
        \n status\n
        \n
        \n -\n
        \n \n
        \n DNS\n
        \n
        \n \n
        \n
        \n Control\n
        \n
        \n \n \n
        ',this.interfacesOptsEl=document.getElementById("NetworkInterface"),this.interfacesOptsEl.onchange=this.updateNetworkInterface.bind(this),document.getElementById("save").onclick=this.save.bind(this);let e=document.getElementById("toggleUp");e.innerHTML=this.isUp?"Down":"Up",e.onclick=this.toggleUp.bind(this),document.getElementById("flush").onclick=this.flush.bind(this),this.dnsEl=document.getElementById("dnslist"),this.ipEl=document.getElementById("ip"),this.gatewayEl=document.getElementById("gateway"),this.maskEl=document.getElementById("mask"),this.modeEl=document.getElementById("mode"),this.statusTypeEl=document.getElementById("statusType"),this.networkListener=this.api.t.on("NetworkControl","update",e=>{console.log("NETWORK NOT",e),this.update()}),this.update()}getInterfaceIsUp(e){const t={plugin:this.callsign,method:"up@"+e};return this.api.req(null,t).then(e=>{if(void 0===e)return;let t=e.value?e.value:e;this.isUp=t,document.getElementById("toggleUp").innerHTML=this.isUp?"Down":"Up"})}getStatus(e){const t={plugin:this.callsign,method:"status@"+e};return this.api.req(null,t).then(t=>{if(void 0===t)return;let i=t.statustype?t.statustype:t;void 0!==i&&(this.statustype=i,this.statusTypeEl.innerHTML=i,this.getNetwork(e))})}getNetwork(e){const t={plugin:this.callsign,method:"network@"+e};return this.api.req(null,t).then(e=>{if(void 0===e)return;let t=e.network?e.network:e;void 0!==t&&(this.networks=t,this.renderNetworkDetails())})}getDNS(){const e={plugin:this.callsign,method:"dns"};return this.api.req(null,e).then(e=>{if(void 0===e)return;let t=e.dns?e.dns:e;if(void 0!==t&&(this.dns=[],this.dnsEl.value="",t.length)){for(var i=0;i{if(void 0===e)return;let t=e.interfaces?e.interfaces:e;if(void 0===t)return;let i=this.interfacesOptsEl.selectedIndex;this.networks=[],this.interfaces=t,this.interfacesOptsEl.innerHTML="";for(var n=0;n{this.getInterfaceIsUp(e)})}flush(){let e=this.interfaces[this.interfacesOptsEl.selectedIndex];const t={plugin:this.callsign,method:"flush",params:{interface:e}};return this.api.req(null,t)}save(){this.setNetwork(),this.setDNS()}setNetwork(){let e=this.interfaces[this.interfacesOptsEl.selectedIndex];this.networks[0].mode=this.modeEl.value,this.networks[0].address=this.ipEl.value,this.networks[0].defaultgateway=this.gatewayEl.value,this.networks[0].mask=this.maskEl.value;const t={plugin:this.callsign,method:"network@"+e,params:{value:this.networks}};return this.api.req(null,t)}setDNS(){this.dns=[this.dnsEl.value];const e={plugin:this.callsign,method:"dns",params:{value:this.dns.toString().split(",")}};return this.api.req(null,e)}update(){this.getDNS(),this.getInterfaces()}renderNetworkDetails(){let e=this.networks[0];"Available"==this.statustype?(document.getElementById("ipSettings").style.display="block",this.modeEl.value=e.mode,this.ipEl.value=e.address,this.gatewayEl.value=e.defaultgateway,this.maskEl.value=e.mask):document.getElementById("ipSettings").style.display="none"}updateNetworkInterface(e){this.update()}close(){this.networkListener&&"function"==typeof this.networkListener.dispose&&this.networkListener.dispose()}};var le=class extends T{constructor(e,t){super(e,t),this.ocdmTemplate='
        \n {{Name}}\n
        \n
        \n {{Designators}}\n
        '}drms(){const e={plugin:this.callsign,method:"drms"};return this.api.req(null,e)}keysystems(e){const t={plugin:this.callsign,method:"keysystems@"+e};return this.api.req(null,t)}render(){document.getElementById("main").innerHTML='
        \n OpenCDM Systems\n
        \n
        ',this.systemDiv=document.getElementById("systemDiv"),this.update()}update(){this.drms().then(e=>{e&&e.forEach(e=>{const t=this.ocdmTemplate.replace("{{Name}}",e.name).replace("{{Designators}}",e.keysystems.toString());this.systemDiv.innerHTML+=t})})}};var de=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Persistent Store"}render(){document.getElementById("main").innerHTML='\n
        \n
        Persistent Store
        \n
        Set Value
        \n
        Name space
        \n
        \n \n
        \n
        Key
        \n
        \n \n
        \n
        Value
        \n
        \n \n
        \n
        \n \n
        \n
        Namespaces
        \n
        Available namespaces
        \n
        \n \n
        \n
        \n \n \n
        \n
        \n
        \n
        \n
        \n
        \n
        \n \n
        \n
        \n ',this.namespace=document.getElementById("namespace"),this.del_button=document.getElementById("del_namespace"),this.detail_button=document.getElementById("get_details"),this.key=document.getElementById("set_key"),this.value=document.getElementById("value"),this.set_value=document.getElementById("set_value"),this.details=document.getElementById("details"),this.avail_namespaces=document.getElementById("avail_namespaces"),this.set_value.onclick=this.setValue.bind(this),this.status_application=document.getElementById("status_application"),this.del_button.onclick=this.delete.bind(this),this.detail_button.onclick=this.getDetails.bind(this),this.update()}update(){this.getNameSpaces().then(e=>{this.avail_namespaces.innerHTML="",e&&e.namespaces.map(e=>{let t=document.createElement("option");t.text=e,t.value=e,this.avail_namespaces.appendChild(t)})})}setPersistValue(e,t,i){const n={plugin:this.callsign,method:"setValue",params:{namespace:e,key:t,value:i}};return this.api.req(null,n)}getNameSpaces(){const e={plugin:this.callsign,method:"getNamespaces"};return this.api.req(null,e)}getStorageSize(){const e={plugin:this.callsign,method:"getStorageSize"};return this.api.req(null,e)}getKeys(e){const t={plugin:this.callsign,method:"getKeys",params:{namespace:e}};return this.api.req(null,t)}deleteNameSpaces(e){const t={plugin:this.callsign,method:"deleteNamespace",params:{namespace:e}};return this.api.req(null,t)}getKeyValue(e,t){const i={plugin:this.callsign,method:"getValue",params:{namespace:e,key:t}};return this.api.req(null,i)}delete(){this.deleteNameSpaces(this.avail_namespaces.value).then(e=>{e.success?(this.update(),this.getDetails(),alert("Namespace deleted successfully")):alert("Delete failed")})}deleteKey(e){const t={plugin:this.callsign,method:"deleteKey",params:{namespace:e,key:this.availKeys.value}};return this.api.req(null,t).then(e=>{e.success?this.getDetails():alert("Delete failed:"+e.error)})}setValue(){this.setPersistValue(this.namespace.value,this.key.value,this.value.value).then(e=>{e.success?(this.update(),this.getDetails(),alert("Key/Value pair stored successfullty stored in the store")):alert("Failed to store the key/value pair")})}getDetails(){let e=this.avail_namespaces.value;this.details.innerHTML="",this.getKeys(e).then(t=>{if(t.success){let i={};if(t.keys.length>0){this.details.innerHTML='\n
        Storage Size
        \n
        \n
        \n Delete Key\n
        \n
        \n \n
        \n
        \n \n
        ';let n=document.getElementById("name_size");this.status_application.innerHTML="";let s=document.createElement("tr");s.id="trLarge",s.className="text grid__col grid__col--8-of-8";let o=document.createElement("th");o.id="td",o.className="text grid__col grid__col--2-of-8";let l=document.createElement("div");l.innerHTML="Key";let d=document.createElement("th");d.id="td";let r=document.createElement("div");d.className="text grid__col grid__col--2-of-8",r.innerHTML="Value",o.appendChild(l),d.appendChild(r),s.appendChild(o),s.appendChild(d),this.status_application.appendChild(s),this.availKeys=document.getElementById("avail_keys"),this.deleteKeyButton=document.getElementById("del_key"),this.deleteKeyButton.onclick=this.deleteKey.bind(this,e),this.getStorageSize().then(t=>{t.success&&(n.innerHTML=t.namespaceSizes[e])}),t.keys.map(t=>{this.getKeyValue(e,t).then(e=>{i[t]=e.value;let n=document.createElement("tr");n.id="trLarge",n.className="label grid__col grid__col--8-of-8";let s=document.createElement("td");s.id="td",s.className="label grid__col grid__col--2-of-8";let o=document.createElement("div");o.innerHTML=t;let l=document.createElement("td");l.id="td",l.className="label grid__col grid__col--2-of-8";let d=document.createElement("div");d.innerHTML=e.value,s.appendChild(o),l.appendChild(d),n.appendChild(s),n.appendChild(l),this.status_application.appendChild(n),this.keyName=document.createElement("option"),this.keyName.text=t,this.keyName.value=t,this.availKeys.appendChild(this.keyName)})})}else this.status_application.className="grid__col grid__col--8-of-8",this.status_application.innerHTML="\n \n Key\n Value\n \n \n No data available\n \n \n "}})}};var re=class extends T{constructor(e,t){super(e,t),this.mainDiv=document.getElementById("main"),this.state=1,this.stateLookup={1:"On",2:"Active standby",3:"Passive standby",4:"Suspend to Ram",5:"Hibernate",6:"Power Off"}}state(){const e={plugin:this.callsign,method:"state"};return this.api.req(null,e)}render(){this.mainDiv.innerHTML='\n
        \n Current State\n
        \n
        \n -\n
        \n\n
        \n \n
        \n
        \n \n
        \n
        \n\n
        Change state
        \n
        \n \n
        ',this.powerStateDiv=document.getElementById("powerState"),this.stateSelectorEl=document.getElementById("stateSelector"),this.timeoutInput=document.getElementById("timeout"),this.stateSelectorEl.onchange=this.changeState.bind(this);var e=Object.keys(this.stateLookup);if(0===this.stateSelectorEl.children.length)for(var t=0;t{void 0!==e.PowerState&&(this.powerStateDiv.innerHTML=this.stateLookup[e.PowerState],this.stateSelectorEl.children[e.PowerState-1].selected=!0)})}changeState(e){const t={plugin:this.callsign,method:"set",params:{state:this.stateSelectorEl.value}};""!==this.timeoutInput.value?t.params.timeout=this.timeoutInput.value:t.params.timeout=10,this.api.req(null,t).then(()=>{e<2&&setTimeout(this.update,5e3)})}};var ae=class extends T{constructor(e,t){super(e,t)}render(){document.getElementById("main").innerHTML='
        \n Provisioning status\n
        \n\n
        \n Device\n
        \n
        \n -\n
        \n
        \n Provisioned for\n
        \n
        \n -\n
        \n
        \n Status\n
        \n
        \n -\n
        \n\n
        \n Provisioning\n
        \n
        \n \n
        ',document.getElementById("provisionButton").onclick=this.tiggerProvisioningRequest.bind(this),this.update()}triggerProvisioning(){const e={plugin:this.callsign,method:"provision"};return this.api.req(null,e)}status(){const e={plugin:this.callsign,method:"state"};return this.api.req(null,e)}update(){this.status().then(e=>{if(null!=e&&""!==e){var t=e.id,i=e.tokens||[],n=e.status;document.getElementById("device").innerHTML=t,document.getElementById("status").innerHTML=200==n?"provisioned":"not provisioned",200==n&&i.length>0&&(document.getElementById("provisioning-tokens").innerHTML=i.join(", ")),document.getElementById("provisionLabel").style.display=200==n?"none":null}}).catch(e=>{console.error(e),this.status(e)})}tiggerProvisioningRequest(){var e=this;this.triggerProvisioning().then(t=>{document.getElementById("provisionButton").style.display="none",document.getElementById("provisionLabel").style.display="none",setTimeout(e.update(),3e3)})}};var ce=class extends T{constructor(e,t){super(e,t),this.displayName="RDK Shell",this.length=0}render(){document.getElementById("main").innerHTML='\n
        \n RDK Shell\n
        \n
        \n Client App Details\n
        \n
        \n Update App Details\n
        \n
        \n \n
        \n
        \n Client Apps\n
        \n
        \n
        \n
        \n Client Apps in Z order\n
        \n
        \n
        \n
        \n Available Types\n
        \n
        \n
        \n
        \n Status of application types\n
        \n
        \n \n
        \n
        \n
        \n System Resource Info\n
        \n
        \n
        \n
        \n
        \n Move To Front / Back\n
        \n
        \n Client\n
        \n
        \n \n
        \n
        \n \n \n
        \n
        \n Move Behind\n
        \n
        \n Client\n
        \n
        \n \n
        \n
        \n Target\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Manage Client apps\n
        \n
        \n Client\n
        \n
        \n \n
        \n
        \n \n \n \n \n
        \n
        \n Visibility\n
        \n
        \n Client\n
        \n
        \n \n
        \n
        \n Visibility\n
        \n
        \n
        \n \n \n
        \n
        \n
        \n Opacity\n
        \n
        \n Client\n
        \n
        \n \n
        \n
        \n Opacity\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Scale\n
        \n
        \n Client\n
        \n
        \n \n
        \n
        \n sx\n
        \n
        \n \n
        \n
        \n sy\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Bounds\n
        \n
        \n Client\n
        \n
        \n \n
        \n
        \n x\n
        \n
        \n \n
        \n
        \n y\n
        \n
        \n \n
        \n
        \n w\n
        \n
        \n \n
        \n
        \n h\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Animation\n
        \n
        \n Client\n
        \n
        \n \n
        \n
        \n x\n
        \n
        \n \n
        \n
        \n y\n
        \n
        \n \n
        \n
        \n w\n
        \n
        \n \n
        \n
        \n h\n
        \n
        \n \n
        \n
        \n alpha\n
        \n
        \n \n
        \n
        \n sx\n
        \n
        \n \n
        \n
        \n sy\n
        \n
        \n \n
        \n
        \n duration\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Launch\n
        \n
        \n Callsign\n
        \n
        \n \n
        \n
        \n type\n
        \n
        \n \n
        \n
        \n x\n
        \n
        \n \n
        \n
        \n y\n
        \n
        \n \n
        \n
        \n w\n
        \n
        \n \n
        \n
        \n h\n
        \n
        \n \n
        \n
        \n version\n
        \n
        \n \n
        \n
        \n uri\n
        \n
        \n \n
        \n
        \n behind\n
        \n
        \n \n
        \n
        \n configuration\n
        \n
        \n \n
        \n
        \n display name\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Screen Resolution\n
        \n
        \n Width\n
        \n
        \n \n
        \n
        \n Height\n
        \n
        \n \n
        \n
        \n \n
        \n ',this.update_app=document.getElementById("update_app"),this.update_app.onclick=this.update.bind(this),this.client_apps=document.getElementById("client_apps"),this.client_apps_zorder=document.getElementById("client_apps_zorder"),this.available_types=document.getElementById("available_types"),this.status_application=document.getElementById("status_application"),this.system_resource=document.getElementById("system_resource"),this.client_moveFrontBack=document.getElementById("client_moveFrontBack"),this.set_moveToFront=document.getElementById("set_moveToFront"),this.set_moveToFront.onclick=this.doMoveToFront.bind(this),this.set_moveToBack=document.getElementById("set_moveToBack"),this.set_moveToBack.onclick=this.doMoveToBack.bind(this),this.client_moveBehind=document.getElementById("client_moveBehind"),this.client_moveBehind.onclick=this.doUpdateTarget.bind(this),this.target_moveBehind=document.getElementById("target_moveBehind"),this.set_moveBehind=document.getElementById("set_moveBehind"),this.set_moveBehind.onclick=this.doMoveBehind.bind(this),this.client_manage=document.getElementById("client_manage"),this.set_focus=document.getElementById("set_focus"),this.set_focus.onclick=this.doSetFocus.bind(this),this.set_suspend=document.getElementById("set_suspend"),this.set_suspend.onclick=this.doSetSuspend.bind(this),this.set_destroy=document.getElementById("set_destroy"),this.set_destroy.onclick=this.doSetDestroy.bind(this),this.set_kill=document.getElementById("set_kill"),this.set_kill.onclick=this.doKill.bind(this),this.width_resolution=document.getElementById("width_resolution"),this.height_resolution=document.getElementById("height_resolution"),this.width=document.getElementById("width"),this.height=document.getElementById("height"),this.set_resolution=document.getElementById("set_resolution"),this.set_resolution.onclick=this.doScreenResolution.bind(this),this.client_visible=document.getElementById("client_visible"),this.show_visibility=document.getElementById("show_visibility"),this.visible=document.getElementById("visible"),this.client_set_visible=document.getElementById("client_set_visible"),this.set_visible=document.getElementById("set_visible"),this.set_visible.onclick=this.doSetVisibility.bind(this),this.client_opacity=document.getElementById("client_opacity"),this.show_opacity=document.getElementById("show_opacity"),this.opacity=document.getElementById("opacity"),this.client_set_opacity=document.getElementById("client_set_opacity"),this.value_opacity=document.getElementById("value_opacity"),this.set_opacity=document.getElementById("set_opacity"),this.set_opacity.onclick=this.doSetOpacity.bind(this),this.client_bounds=document.getElementById("client_bounds"),this.show_bounds=document.getElementById("show_bounds"),this.x_bounds=document.getElementById("x_bounds"),this.y_bounds=document.getElementById("y_bounds"),this.w_bounds=document.getElementById("w_bounds"),this.h_bounds=document.getElementById("h_bounds"),this.set_client_bounds=document.getElementById("set_client_bounds"),this.set_x_bounds=document.getElementById("set_x_bounds"),this.set_y_bounds=document.getElementById("set_y_bounds"),this.set_w_bounds=document.getElementById("set_w_bounds"),this.set_h_bounds=document.getElementById("set_h_bounds"),this.set_bounds=document.getElementById("set_bounds"),this.set_bounds.onclick=this.doSetBounds.bind(this),this.client_scale=document.getElementById("client_scale"),this.show_scale=document.getElementById("show_scale"),this.sx_scale=document.getElementById("sx_scale"),this.sy_scale=document.getElementById("sy_scale"),this.set_client_scale=document.getElementById("set_client_scale"),this.set_sx_scale=document.getElementById("set_sx_scale"),this.set_sy_scale=document.getElementById("set_sy_scale"),this.set_scale=document.getElementById("set_scale"),this.set_scale.onclick=this.doSetScale.bind(this),this.client_animation=document.getElementById("client_animation"),this.x_animation=document.getElementById("x_animation"),this.y_animation=document.getElementById("y_animation"),this.w_animation=document.getElementById("w_animation"),this.h_animation=document.getElementById("h_animation"),this.sx_animation=document.getElementById("sx_animation"),this.sy_animation=document.getElementById("sy_animation"),this.alpha_animation=document.getElementById("alpha_animation"),this.duration_animation=document.getElementById("duration_animation"),this.set_animation=document.getElementById("set_animation"),this.set_animation.onclick=this.doAnimate.bind(this),this.callsign_launch=document.getElementById("callsign_launch"),this.type_launch=document.getElementById("type_launch"),this.x_launch=document.getElementById("x_launch"),this.y_launch=document.getElementById("y_launch"),this.w_launch=document.getElementById("w_launch"),this.h_launch=document.getElementById("h_launch"),this.version_launch=document.getElementById("version_launch"),this.uri_launch=document.getElementById("uri_launch"),this.behind_launch=document.getElementById("behind_launch"),this.configuration_launch=document.getElementById("configuration_launch"),this.displayName_launch=document.getElementById("displayName_launch"),this.set_launch=document.getElementById("set_launch"),this.set_launch.onclick=this.doLaunch.bind(this),this.update()}doMoveToFront(){if(this.client_moveFrontBack.value)try{this.moveToFront(this.client_moveFrontBack.value).then(e=>{e&&e.success?this.update():alert("Failed to move "+this.client_moveFrontBack.value)})}catch{alert("Error in getting response")}else alert("Please provide client app name")}doMoveToBack(){if(this.client_moveFrontBack.value)try{this.moveToBack(this.client_moveFrontBack.value).then(e=>{e&&e.success?this.update():alert("Failed to move "+this.client_moveFrontBack.value)})}catch{alert("Error in getting response")}else alert("Please provide client app name")}doMoveBehind(){if(this.client_moveBehind.value)if(this.client_moveBehind.value&&this.target_moveBehind.value)try{this.moveBehind(this.client_moveBehind.value,this.target_moveBehind.value).then(e=>{e&&e.success?(this.update(),this.doUpdateTarget()):alert("Failed to move "+this.client_moveBehind.value)})}catch{alert("Error in getting response")}else""==this.client_moveBehind.value&&""==this.target_moveBehind.value?alert("Please provide client and target app name"):""==this.client_moveBehind.value?alert("Please provide client app name"):""==this.target_moveBehind.value&&alert("Please provide target app name")}doSetFocus(){if(this.client_manage.value)try{this.setFocus(this.client_manage.value).then(e=>{null!=e&&e.success||alert("Failed to set focus to "+this.client_manage.value)})}catch{alert("Error in getting response")}else alert("Please provide client app name")}doSetSuspend(){if(this.client_manage.value)try{this.suspend(this.client_manage.value).then(e=>{e&&e.success?this.update():alert("Failed to suspend "+this.client_manage.value)})}catch{alert("Error in getting response")}else alert("Please provide client app name")}doSetDestroy(){if(this.client_manage.value)try{this.destroy(this.client_manage.value).then(e=>{e&&e.success?this.update():alert("Failed to destroy "+this.client_manage.value)})}catch{alert("Error in getting response")}else alert("Please provide client app name")}doKill(){if(this.client_manage.value)try{this.kill(this.client_manage.value).then(e=>{e&&e.success?this.update():alert("Failed to kill "+this.client_manage.value)})}catch{alert("Error in getting response")}else alert("Please provide client app name")}doScreenResolution(){if(this.width.value&&this.height.value)try{this.setScreenResolution(parseInt(this.width.value),parseInt(this.height.value)).then(e=>{e&&e.success?this.getScreenResolution().then(e=>{this.width.value=e.w,this.height.value=e.h}):alert("Failed to set resolution")})}catch{alert("Error in getting response")}else""==this.width.value&&""==this.height.value?alert("Please provide width and height"):""==this.width.value?alert("Please provide width"):""==this.height.value&&alert("Please provide height")}doGetVisibility(){if(this.client_set_visible.value)try{this.getVisibility(this.client_set_visible.value).then(e=>{e&&e.success&&(this.set_visible.checked=e.visible)})}catch{alert("Error in getting response for visibility")}else alert("Please provide client name")}doSetVisibility(){if(this.client_set_visible.value){this.set_visible.checked?this.client_visibility=!0:this.client_visibility=!1;try{this.setVisibility(this.client_set_visible.value,this.client_visibility).then(e=>{e&&e.success?this.client_set_visible.value&&this.getVisibility(this.client_set_visible.value).then(e=>{e&&e.success&&(this.set_visible.checked=e.visible)}):(alert("Failed to set visibility to "+this.client_set_visible.value),this.set_visible.checked?this.set_visible.checked=!1:this.set_visible.checked=!0)})}catch{alert("Error in getting response")}}else""==this.client_set_visible.value&&(this.set_visible.checked?this.set_visible.checked=!1:this.set_visible.checked=!0,alert("Please provide client name"))}doGetOpacity(){if(this.client_set_opacity.value)try{this.getOpacity(this.client_set_opacity.value).then(e=>{e&&e.success?this.value_opacity.value=e.opacity:(alert(e.message),this.value_opacity.value="")})}catch{alert("Error in getting response")}else alert("Please provide client name")}doSetOpacity(){if(this.client_set_opacity.value&&this.value_opacity.value)try{this.setOpacity(this.client_set_opacity.value,parseInt(this.value_opacity.value)).then(e=>{e&&e.success?this.client_set_opacity.value&&this.getOpacity(this.client_set_opacity.value).then(e=>{e&&e.success&&(this.value_opacity.value=e.opacity)}):alert("Failed to set opacity to "+this.client_set_opacity.value)})}catch{alert("Error in getting response")}else""==this.client_set_opacity.value&&""==this.value_opacity.value?alert("Please provide client name and opacity value"):""==this.client_set_opacity.value?alert("Please provide client name"):""==this.value_opacity.value&&alert("Please provide opacity value")}doGetBounds(){if(this.set_client_bounds.value)try{this.getBounds(this.set_client_bounds.value).then(e=>{e&&e.success?(this.set_x_bounds.value=e.bounds.x,this.set_y_bounds.value=e.bounds.y,this.set_w_bounds.value=e.bounds.w,this.set_h_bounds.value=e.bounds.h):(this.set_x_bounds.value="-",this.set_y_bounds.value="-",this.set_w_bounds.value="-",this.set_h_bounds.value="-")})}catch{alert("Error in getting response")}else alert("Please provide client name")}doSetBounds(){if(this.set_client_bounds.value&&this.set_x_bounds.value&&this.set_y_bounds.value&&this.set_w_bounds.value&&this.set_h_bounds.value)try{this.setBounds(this.set_client_bounds.value,parseInt(this.set_x_bounds.value),parseInt(this.set_y_bounds.value),parseInt(this.set_w_bounds.value),parseInt(this.set_h_bounds.value)).then(e=>{null!=e&&e.success||alert("Failed to set bounds to "+this.set_client_bounds.value)})}catch{alert("Error in getting response")}else alert("Please provide all the parameters to set bounds")}doGetScale(){if(this.set_client_scale.value)try{this.getScale(this.set_client_scale.value).then(e=>{e&&e.success?(this.set_sx_scale.value=e.sx,this.set_sy_scale.value=e.sy):(this.set_sx_scale.value="-",this.set_sy_scale.value="-",alert(e.message))})}catch{alert("Error in getting response")}else alert("Please provide client name")}doSetScale(){if(this.set_client_scale.value&&this.set_sx_scale.value&&this.set_sy_scale.value)try{this.setScale(this.set_client_scale.value,this.set_sx_scale.value,this.set_sy_scale.value).then(e=>{this.set_client_scale.value&&this.getScale(this.set_client_scale.value).then(e=>{e&&e.success}),null!=e&&e.success||alert("Failed to scale client app"+this.set_client_scale.value)})}catch{alert("Error")}else alert("Please provide all the parameters to scale")}doAnimate(){for(var e={client:this.client_animation.value,x:parseInt(this.x_animation.value),y:parseInt(this.y_animation.value),w:parseInt(this.w_animation.value),h:parseInt(this.h_animation.value),sx:parseInt(this.sx_animation.value),sy:parseInt(this.sy_animation.value),a:parseInt(this.alpha_animation.value),duration:this.duration_animation.value},t=["client","x","y","w","h","sx","sy","a","duration"],i=[this.client_animation.value,this.x_animation.value,this.y_animation.value,this.w_animation.value,this.h_animation.value,this.sx_animation.value,this.sy_animation.value,this.alpha_animation.value,this.duration_animation.value],n=0;n{e&&e.success?(this.startLoading(),setTimeout(this.stopLoading,1e3*this.duration_animation.value)):alert("Failed to animate "+this.client_animation.value)})}catch{alert("Error in animating "+this.client_animation.value)}else""===this.duration_animation.value?alert("Please provide duration of animation"):alert("No client is available for animating")}startLoading(){this.loadingEl=document.getElementById("disconnected");this.loadingEl.style.display="block",this.loadingEl.innerHTML='
        \n
        Animation InProgress
        \n
        '}stopLoading(){document.getElementById("disconnected").innerHTML="",document.getElementById("disconnected").style.display="none",alert("Completed Animation")}doLaunch(){for(var e={callsign:this.callsign_launch.value,type:this.type_launch.value,x:parseInt(this.x_launch.value),y:parseInt(this.y_launch.value),w:parseInt(this.w_launch.value),h:parseInt(this.h_launch.value),version:parseInt(this.version_launch.value),uri:this.uri_launch.value,behind:this.behind_launch.value,configuration:this.configuration_launch.value,displayName:this.displayName_launch.value},t=["callsign","type","x","y","w","h","version","uri","behind","configuration","displayName"],i=[this.callsign_launch.value,this.type_launch.value,this.x_launch.value,this.y_launch.value,this.w_launch.value,this.h_launch.value,this.version_launch.value,this.uri_launch.value,this.behind_launch.value,this.configuration_launch.value,this.displayName_launch.value],n=0;n{null!=e&&e.success||alert("Failed to launch "+this.callsign_launch.value)})}catch{alert("Error in getting response")}else alert("Please provide parameters for launching app")}doUpdateTarget(){for(var e=this.length-1;e>=0;e--)this.target_moveBehind.options[e]=null;try{this.getClients().then(e=>{this.length=e.clients.length;for(var t=0;t=0;e--)this.client_moveFrontBack.options[e]=null,this.client_moveBehind.options[e]=null,this.target_moveBehind.options[e]=null,this.client_set_visible.options[e]=null,this.client_set_opacity.options[e]=null,this.set_client_bounds.options[e]=null,this.set_client_scale.options[e]=null,this.client_animation.options[e]=null,this.client_manage.options[e]=null;try{this.getClients().then(e=>{if(e.clients){this.client_apps.innerHTML=e.clients,this.length=e.clients.length,this.clientArray=e;for(var t=0;t0&&(this.target_list_movebehind=document.createElement("option"),this.target_list_movebehind.text=e.clients[t],this.target_list_movebehind.value=e.clients[t],this.target_moveBehind.appendChild(this.target_list_movebehind)),this.client_list_visible=document.createElement("option"),this.client_list_visible.text=e.clients[t],this.client_list_visible.value=e.clients[t],this.client_set_visible.appendChild(this.client_list_visible),this.client_list_opacity=document.createElement("option"),this.client_list_opacity.text=e.clients[t],this.client_list_opacity.value=e.clients[t],this.client_set_opacity.appendChild(this.client_list_opacity),this.client_list_bounds=document.createElement("option"),this.client_list_bounds.text=e.clients[t],this.client_list_bounds.value=e.clients[t],this.set_client_bounds.appendChild(this.client_list_bounds),this.client_list_scale=document.createElement("option"),this.client_list_scale.text=e.clients[t],this.client_list_scale.value=e.clients[t],this.set_client_scale.appendChild(this.client_list_scale),this.client_list_animation=document.createElement("option"),this.client_list_animation.text=e.clients[t],this.client_list_animation.value=e.clients[t],this.client_animation.appendChild(this.client_list_animation),this.client_list_manage=document.createElement("option"),this.client_list_manage.text=e.clients[t],this.client_list_manage.value=e.clients[t],this.client_manage.appendChild(this.client_list_manage);0!=this.length?(this.doGetOpacity(),this.doGetBounds(),this.doGetScale(),this.doGetVisibility()):(this.value_opacity.value="",this.set_x_bounds.value="",this.set_y_bounds.value="",this.set_w_bounds.value="",this.set_h_bounds.value="",this.set_sx_scale.value="",this.set_sy_scale.value="",this.set_visible.checked=!1)}})}catch{alert("Error in getting response")}try{this.getZOrder().then(e=>{e.clients&&(this.client_apps_zorder.innerHTML=e.clients)})}catch{alert("Error in getting zorder of client apps")}try{this.getScreenResolution().then(e=>{this.width.value=e.w,this.height.value=e.h})}catch{alert("Error in getting resolution")}try{this.getAvailableTypes().then(e=>{null!=e&&e.types?this.available_types.innerHTML=e.types:this.available_types.innerHTML="No data available"})}catch{alert("Error in getting available types")}try{this.getState().then(e=>{if(null!=e&&e.runtimes){this.status_application.innerHTML="",this.tr1=document.createElement("tr"),this.tr1.id="trLarge",this.tr1.className="text grid__col grid__col--8-of-8",this.td1=document.createElement("th"),this.td1.id="td",this.td1.className="text grid__col grid__col--2-of-8",this.td1div=document.createElement("div"),this.td1div.innerHTML="Callsign",this.td2=document.createElement("th"),this.td2.id="td",this.td2div=document.createElement("div"),this.td2.className="text grid__col grid__col--2-of-8",this.td2div.innerHTML="State",this.td3=document.createElement("th"),this.td3.id="td",this.td3div=document.createElement("div"),this.td3.className="text grid__col grid__col--2-of-8",this.td3div.innerHTML="URI",this.td1.appendChild(this.td1div),this.td2.appendChild(this.td2div),this.td3.appendChild(this.td3div),this.tr1.appendChild(this.td1),this.tr1.appendChild(this.td2),this.tr1.appendChild(this.td3),this.status_application.appendChild(this.tr1);for(var t=0;tNo data available\n \n "})}catch{alert("Error in getting state of apps")}try{this.getSystemResourceInfo().then(e=>{if(this.system_resource.innerHTML="",null!=e&&e.runtimes){this.system_resource.innerHTML="",this.tr2=document.createElement("tr"),this.tr2.id="trLarge",this.tr2.className="text grid__col grid__col--8-of-8",this.td4=document.createElement("th"),this.td4.id="td",this.td4.className="text grid__col grid__col--2-of-8",this.td4div=document.createElement("div"),this.td4div.innerHTML="Callsign",this.td5=document.createElement("th"),this.td5.id="td",this.td5div=document.createElement("div"),this.td5.className="text grid__col grid__col--2-of-8",this.td5div.innerHTML="RAM",this.td6=document.createElement("th"),this.td6.id="td",this.td6div=document.createElement("div"),this.td6.className="text grid__col grid__col--2-of-8",this.td6div.innerHTML="VRAM",this.td4.appendChild(this.td4div),this.td5.appendChild(this.td5div),this.td6.appendChild(this.td6div),this.tr2.appendChild(this.td4),this.tr2.appendChild(this.td5),this.tr2.appendChild(this.td6),this.system_resource.appendChild(this.tr2);for(var t=0;tNo data available\n \n "})}catch{alert("Error in getting system resource information")}}close(){}};var ue=class extends T{constructor(e,t){super(e,t),this.displayName="Remote Control",this.onScreenKeyBoardIsRendered=!1,this.doNotHandleKeys=!1,this.devicesThatSupportPairing=["GreenPeakRF4CE","GreenPeak","RF4CE"],this.autoFwdKeys=window.localStorage.getItem("autoFwdKeys"),this.automaticallyForwardKeys="false"!==this.autoFwdKeys,this.keyMapping={1:{code:"0x0021",color:void 0,string:"1"},2:{code:"0x0022",color:void 0,string:"2"},3:{code:"0x0023",color:void 0,string:"3"},4:{code:"0x0024",color:void 0,string:"4"},5:{code:"0x0025",color:void 0,string:"5"},6:{code:"0x0026",color:void 0,string:"6"},7:{code:"0x0027",color:void 0,string:"7"},8:{code:"0x0028",color:void 0,string:"8"},9:{code:"0x0029",color:void 0,string:"9"},0:{code:"0x0020",color:void 0,string:"0"},exit:{code:"0x0009",color:"blue",string:"exit"},a:{code:"0x8004",color:void 0,string:"a"},b:{code:"0x8005",color:void 0,string:"b"},c:{code:"0x8006",color:void 0,string:"c"},d:{code:"0x8007",color:void 0,string:"d"},e:{code:"0x8008",color:void 0,string:"e"},f:{code:"0x8009",color:void 0,string:"f"},g:{code:"0x800A",color:void 0,string:"g"},h:{code:"0x800B",color:void 0,string:"h"},i:{code:"0x800C",color:void 0,string:"i"},back:{code:"0x0032",color:"blue double",string:"back"},j:{code:"0x800D",color:void 0,string:"j"},k:{code:"0x800E",color:void 0,string:"k"},l:{code:"0x800F",color:void 0,string:"l"},m:{code:"0x8010",color:void 0,string:"m"},n:{code:"0x8011",color:void 0,string:"n"},o:{code:"0x8012",color:void 0,string:"o"},p:{code:"0x8013",color:void 0,string:"p"},q:{code:"0x8014",color:void 0,string:"q"},r:{code:"0x8015",color:void 0,string:"r"},up:{code:"0x0001",color:"blue",string:"up",div:'
        '},ok:{code:"0x002B",color:"blue",string:"ok"},s:{code:"0x8016",color:void 0,string:"s"},t:{code:"0x8017",color:void 0,string:"t"},u:{code:"0x8018",color:void 0,string:"u"},v:{code:"0x8019",color:void 0,string:"v"},w:{code:"0x801A",color:void 0,string:"w"},x:{code:"0x801B",color:void 0,string:"x"},y:{code:"0x801C",color:void 0,string:"y"},z:{code:"0x801D",color:void 0,string:"z"},left:{code:"0x0003",color:"blue",string:"left",div:'
        '},down:{code:"0x0002",color:"blue",string:"down",div:'
        '},right:{code:"0x0004",color:"blue",string:"right",div:'
        '}},this.jsToWpeKeyMap={13:{code:"0x002B",string:"enter"},37:{code:"0x0003",string:"left"},38:{code:"0x0001",string:"up"},39:{code:"0x0004",string:"right"},40:{code:"0x0002",string:"down"},27:{code:"0x0009",string:"esc"},8:{code:"0x0032",string:"backspace"},48:{code:"0x0020",string:"0"},49:{code:"0x0021",string:"1"},50:{code:"0x0022",string:"2"},51:{code:"0x0023",string:"3"},52:{code:"0x0024",string:"4"},53:{code:"0x0025",string:"5"},54:{code:"0x0026",string:"6"},55:{code:"0x0027",string:"7"},56:{code:"0x0028",string:"8"},57:{code:"0x0029",string:"9"},33:{code:"0x0030",string:"page up"},34:{code:"0x0031",string:"page down"},65:{code:"0x8004",string:"a"},66:{code:"0x8005",string:"b"},67:{code:"0x8006",string:"c"},68:{code:"0x8007",string:"d"},69:{code:"0x8008",string:"e"},70:{code:"0x8009",string:"f"},71:{code:"0x800A",string:"g"},72:{code:"0x800B",string:"h"},73:{code:"0x800C",string:"i"},74:{code:"0x800D",string:"j"},75:{code:"0x800E",string:"k"},76:{code:"0x800F",string:"l"},77:{code:"0x8010",string:"m"},78:{code:"0x8011",string:"n"},79:{code:"0x8012",string:"o"},80:{code:"0x8013",string:"p"},81:{code:"0x8014",string:"q"},82:{code:"0x8015",string:"r"},83:{code:"0x8016",string:"s"},84:{code:"0x8017",string:"t"},85:{code:"0x8018",string:"u"},86:{code:"0x8019",string:"v"},87:{code:"0x801A",string:"w"},88:{code:"0x801B",string:"x"},89:{code:"0x801C",string:"y"},90:{code:"0x801D",string:"z"},46:{code:"0x802A",string:"delete"},32:{code:"0x802C",string:"space"},189:{code:"0x802D",string:"-"},187:{code:"0x802E",string:"="},220:{code:"0x8031",string:"\\"},186:{code:"0x8033",string:";"},222:{code:"0x8034",string:"`"},188:{code:"0x8036",string:","},190:{code:"0x8037",string:"."},191:{code:"0x8038",string:"/"}},this.addKeyboardButton(),this.keyboardDiv=document.getElementById("keyboard"),this.keyBoardInnerDiv=document.createElement("div"),this.keyBoardInnerDiv.id="keyboard-inner";for(var i=Object.keys(this.keyMapping),n=0;n{if(void 0!==t)for(var i=void 0!==t.devices?t.devices:t,n=document.getElementById("remotesList"),s=document.getElementById("pairingDiv"),o=0;o\n Pairing\n
        '),s.innerHTML+=`
        ${l}
        \n
        \n \n
        `,document.getElementById(l+"-PairingMode").onclick=e.activatePairing.bind(e,l)}})}toggleAutoforwardOfKeys(){this.automaticallyForwardKeys=!0!==this.automaticallyForwardKeys,window.localStorage.setItem("autoFwdKeys",this.automaticallyForwardKeys)}};var he=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="ScreenCapture",this.mainDiv=document.getElementById("main"),this.template='\n
        Screen Capture
        \n
        Take screenshot and upload
        \n
        Upload URL
        \n
        \n \n
        \n
        Screenshot Identifier(optional)
        \n
        \n \n
        \n
        \n \n
        \n '}uploadScreenshot(e,t){const i={plugin:this.callsign,method:"uploadScreenCapture",params:{url:e,callGUID:t}};return this.api.req(null,i)}render(){this.mainDiv.innerHTML=this.template,this.url=document.getElementById("url"),this.callGUID=document.getElementById("callGUID"),this.uploadButton=document.getElementById("upload"),this.uploadButton.onclick=this.upload.bind(this),this.onUploadComplete=this.api.t.on(this.callsign,"uploadComplete",e=>{e.status?alert("Upload completed"):alert("Upload failed!\n"+e.message+"\nScreenshot identifier:"+e.call_guid)})}upload(){console.log("uploading");var e=this.url.value,t=this.callGUID.value;console.log(e),console.log(t),this.uploadScreenshot(e,t).then(e=>{e?e.success||alert(e.message):alert("Screen caputer not successful")})}close(){this.rendered=!1,this.onUploadComplete&&"function"==typeof this.onUploadComplete.dispose&&(this.onUploadComplete.dispose(),this.onUploadComplete=null)}};var _e=class extends T{constructor(e,t){super(e,t)}render(){document.getElementById("main").innerHTML='
        \n Create\n
        \n\n
        \n Snapshot\n
        \n
        \n \n
        \n\n
        \n \n
        ',document.getElementById("snapshotButton").onclick=this.createSnapshot.bind(this)}getSnapshotLocator(){return this.api.getURLStart("http")+"Snapshot/Capture?"+(new Date).getTime()}createSnapshot(){var e=document.getElementById("snapshotOutput");e.src="",e.src=this.getSnapshotLocator()}};var ge=class extends T{constructor(e,t){super(e,t),this.url="",this.isHidden=!1,this.isSuspended=!1,this.lastSetUrlKey="lastSetUrl"+this.callsign,this.lastSetUrl=window.localStorage.getItem(this.lastSetUrlKey)||"",this.template='
        \n\n
        Presets / URL
        \n\n
        \n \n
        \n
        \n \n \n
        \n\n
        URL presets
        \n
        \n \n
        \n\n
        Tools
        \n\n
        Current State
        \n
        \n
        \n
        \n \n
        \n\n
        Visibility
        \n
        \n
        \n
        \n \n
        \n
        ',this.presets=[{Name:"Select a preset",URL:""},{Name:"http://www.sparkui.org/examples/gallery/picturepile.js",URL:"http://www.sparkui.org/examples/gallery/picturepile.js"},{Name:"http://www.sparkui.org/examples/gallery/gallery.js",URL:"http://www.sparkui.org/examples/gallery/gallery.js"}],this.sparkUrlListener=this.api.t.on("Spark","urlchange",e=>{e.url&&e.loaded&&(this.url=e.url,this.handleNotification())}),this.sparkVisibilityListener=this.api.t.on("Spark","visibilitychange",e=>{"boolean"==typeof e.hidden&&(this.isHidden=e.hidden,this.handleNotification())}),this.sparkStateListener=this.api.t.on("Spark","statechange",e=>{"boolean"==typeof e.suspended&&(this.isSuspended=e.suspended,this.handleNotification())})}handleNotification(e){!1!==this.rendered&&this.update()}render(){var e=document.getElementById("main"),t=this.template.replace(/{{callsign}}/g,this.callsign);e.innerHTML=t,document.getElementById(this.callsign+"_url").value=this.lastSetUrl,document.getElementById(this.callsign+"_button").onclick=this.getAndSetUrl.bind(this),document.getElementById(this.callsign+"_linkPresets").onchange=this.getAndSetUrlFromPresets.bind(this);var i=document.getElementById(this.callsign+"_linkPresets");if(0===i.children.length)for(var n=0;n0&&this.setUrl(this.presets[e].URL)}handleKey(e){var t=document.getElementById(this.callsign+"_url");13===e.which&&t&&t===document.activeElement&&this.getAndSetUrl()}toggleSuspend(e){"Resume"===e?this.resume():this.suspend()}toggleVisibility(e){"Show"===e?this.show():this.hide()}};var pe=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.switchablePlugins=[],this.switches().then(e=>{this.switchablePlugins=e}),this.defaultPlugin=void 0,this.default().then(e=>{this.defaultPlugin=e})}switches(){return this.api.req(null,{plugin:"SwitchBoard",method:"switches"})}default(){return this.api.req(null,{plugin:"SwitchBoard",method:"default"})}getDefaultSwitchBoardPlugin(){return this.defaultPlugin}getSwitchablePlugins(){return this.switchablePlugins}render(){this.mainDiv=document.getElementById("main"),this.mainDiv.innerHTML='\n
        \n Plugins\n
        \n
        ';var e=document.getElementById("switchBoardPlugins");this.api.getControllerPlugins().then(t=>{for(var i=t,n=0;n{this.render()})}};var me=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="System Services",this.mainDiv=document.getElementById("main"),this.updateStateList={0:"Uninitialized",1:"Requesting",2:"Downloading",3:"Failed",4:"Download Completed",5:"Validation completed",6:"Preparing to reboot"}}render(){this.template='\n
        Device Information
        \n
        Build Type
        \n
        -
        \n
        ESTB MAC
        \n
        -
        \n
        Model Number
        \n
        -
        \n
        Image Version
        \n
        -
        \n
        Receiver Version
        \n
        -
        \n
        Serial Number
        \n
        -
        \n
        Time Zone
        \n
        -
        \n
        Firmware Update
        \n
        Update Available
        \n
        No
        \n
        Update Version
        \n
        -
        \n
        Update State
        \n
        -
        \n
        Standby Mode
        \n
        Current Standby mode
        \n
        -
        \n
        Set Standby mode
        \n
        \n \n \n
        \n
        Power State
        \n
        Last Deep Sleep Reason
        \n
        -
        \n
        Current Power State
        \n
        -
        \n
        Set Power State
        \n
        \n \n \n
        \n
        Mode
        \n
        Current Mode
        \n
        -
        \n
        Set mode
        \n
        Mode
        \n
        \n \n
        \n
        \n
        Duration(in seconds)
        \n
        \n \n
        \n\n
        \n \n
        \n
        Status
        \n
        System Uptime(HH:MM:SS)
        \n
        -
        \n
        MoCa
        \n
        \n \n \n
        \n
        -
        \n
        GZ enabled
        \n
        \n \n \n
        \n
        -
        \n
        Store in cache
        \n
        Key
        \n
        \n \n
        \n
        \n
        Value
        \n
        \n \n
        \n
        \n
        \n \n
        \n
        Get/Remove cache value
        \n
        Key
        \n
        \n \n \n \n
        \n
        \n
        Value
        \n
        -
        \n
        Previous Reboot Info
        \n
        Source
        \n
        -
        \n
        Reboot Reason
        \n
        -
        \n
        Custom Reason
        \n
        -
        \n
        Last Hard Power Reset
        \n
        -
        \n
        Temperature
        \n
        Core Temperature
        \n
        -
        \n
        Warning Temperature
        \n
        -
        \n
        Maximum Temperature
        \n
        -
        \n
        RFC Configuration
        \n
        Account ID
        \n
        -
        \n
        UPNP Enabled
        \n
        -
        \n
        Allow open ports
        \n
        -
        \n
        Total Memory
        \n
        -
        \n
        Free Memory
        \n
        -
        \n
        State Info
        \n
        Property name
        \n
        \n \n \n
        \n
        \n
        Property Value
        \n
        -
        \n ',this.mainDiv.innerHTML=this.template,this.buildType=document.getElementById("build_type"),this.estbMac=document.getElementById("estb_mac"),this.imgVersion=document.getElementById("img_version"),this.modelNumber=document.getElementById("model_number"),this.rxVersion=document.getElementById("rx_version"),this.serialNumber=document.getElementById("serial_number"),this.timeZone=document.getElementById("time_zone"),this.updateAvailable=document.getElementById("update_available"),this.updateVersion=document.getElementById("update_version"),this.updateState=document.getElementById("update_state"),this.standbyMode=document.getElementById("standby_mode"),this.moca=document.getElementById("moca"),this.mocaStatus=document.getElementById("moca_status"),this.gz=document.getElementById("gz"),this.gzStatus=document.getElementById("gz_status"),this.setKey=document.getElementById("set_key"),this.setValue=document.getElementById("set_value"),this.getKey=document.getElementById("get_key"),this.getValue=document.getElementById("get_value"),this.setCacheButton=document.getElementById("set_cache"),this.removeCacheButton=document.getElementById("remove_cache"),this.deepSleep=document.getElementById("deep_sleep"),this.setStandbyButton=document.getElementById("set_standby"),this.upTime=document.getElementById("up_time"),this.availModes=document.getElementById("avail_modes"),this.powerStates=document.getElementById("power_states"),this.setPowerButton=document.getElementById("set_power"),this.powerMode=document.getElementById("power_mode"),this.mode=document.getElementById("mode"),this.setModeButton=document.getElementById("set_mode"),this.modeList=document.getElementById("mode_list"),this.modeDuration=document.getElementById("mode_dur"),this.getCacheButton=document.getElementById("get_cache"),this.rebootSrc=document.getElementById("src"),this.rebootReason=document.getElementById("reboot_reason"),this.custReason=document.getElementById("cust_reason"),this.hardReset=document.getElementById("hard_reset"),this.coreTemp=document.getElementById("core_temp"),this.warnTemp=document.getElementById("warn_temp"),this.maxTemp=document.getElementById("max_temp"),this.accountID=document.getElementById("account_ID"),this.upnp=document.getElementById("upnp"),this.allowPorts=document.getElementById("open_port"),this.totalMemory=document.getElementById("total_memory"),this.freeMemory=document.getElementById("free_memory"),this.propertyValue=document.getElementById("property_value"),this.propertyName=document.getElementById("property_name"),this.getPropertyButton=document.getElementById("get_property"),this.update(),this.getSystemVersion(),this.moca.onclick=this.mocaMask.bind(this),this.gz.onclick=this.gzMask.bind(this),this.setCacheButton.onclick=this.setCacheKey.bind(this),this.setStandbyButton.onclick=this.setStandby.bind(this),this.setPowerButton.onclick=this.setPowerState.bind(this),this.setModeButton.onclick=this.setMode.bind(this),this.getCacheButton.onclick=this.getCacheValue.bind(this),this.removeCacheButton.onclick=this.removeCache.bind(this),this.getPropertyButton.onclick=this.getPropertyValue.bind(this),this.propertyName.onchange=()=>{this.propertyValue.innerHTML="-"},this.updateTimer=setInterval(()=>{this.getUpTime()},1e3),this.getAvailStandbyModes(),this.getPowerState(),this.systemModeChanged=this.api.t.on(this.callsign,"onSystemModeChanged",()=>{this.getMode()}),this.systemPowerChanged=this.api.t.on(this.callsign,"onSystemPowerStateChanged",()=>{this.getPowerState()}),this.onFirmwareUpdateInfo=this.api.t.on(this.callsign," onFirmwareUpdateInfoReceived",e=>{1==e.updateAvailable?this.updateAvailable.innerHTML="YES":this.updateAvailable.innerHTML="NO",this.updateVersion.innerHTML=e.firmwareUpdateVersion}),this.onUpdateState=this.api.t.on(this.callsign,"onFirmwareUpdateStateChange",e=>{this.updateState.innerHTML=this.updateStateList[e.firmwareUpdateStateChange]})}update(){this.getXConf(),this.getMoca(),this.getStandbyMode(),this.getPowerState(),this.getGZ(),this.getMode(),this.prevRebootInfo(),this.getTempInfo(),this.getSerialNmmber(),this.getTimeZone(),this.getRFCConfig(),this.getDeepSleepReason(),this.getFirmwareUpdateInfo(),this.getFirmwareUpdateState()}getXConf(){const e={plugin:this.callsign,method:"getXconfParams"};return this.api.req(null,e).then(e=>{e.success&&(this.buildType.innerHTML=e.xconfParams.env,this.estbMac.innerHTML=e.xconfParams.eStbMac,this.imgVersion.innerHTML=e.xconfParams.firmwareVersion,this.modelNumber.innerHTML=e.xconfParams.model)})}getSystemVersion(){const e={plugin:this.callsign,method:"getSystemVersions"};return this.api.req(null,e).then(e=>{e.success&&(this.rxVersion.innerHTML=e.receiverVersion)})}getMoca(){const e={plugin:this.callsign,method:"queryMocaStatus"};return this.api.req(null,e).then(e=>{e.success&&(e.mocaEnabled?(this.moca.checked=!0,this.mocaStatus.innerHTML="Enabled"):(this.moca.checked=!1,this.mocaStatus.innerHTML="Disabled"))})}setMoca(e){const t={plugin:this.callsign,method:"enableMoca",params:{value:e}};return this.api.req(null,t).then(e=>{e.success||alert("Action failed"),this.getMoca()})}getGZ(){const e={plugin:this.callsign,method:"isGzEnabled"};return this.api.req(null,e).then(e=>{e.success&&(e.enabled?(this.gz.checked=!0,this.gzStatus.innerHTML="Enabled"):(this.gz.checked=!1,this.gzStatus.innerHTML="Disabled"))})}setGZ(e){const t={plugin:this.callsign,method:"setGzEnabled",params:{enabled:e}};return this.api.req(null,t).then(e=>{e.success||alert("Action failed"),this.getGZ()})}setCache(){const e={plugin:this.callsign,method:"",params:{value:bool}};return this.api.req(null,e).then(e=>{e.success||alert("Action failed"),this.getMoca()})}getStandbyMode(){const e={plugin:this.callsign,method:"getPreferredStandbyMode"};return this.api.req(null,e).then(e=>{e.success&&(this.standbyMode.innerHTML=e.preferredStandbyMode)})}getAvailStandbyModes(){const e={plugin:this.callsign,method:"getAvailableStandbyModes"};return this.api.req(null,e).then(e=>{e.supportedStandbyModes&&e.supportedStandbyModes.length>0&&e.supportedStandbyModes.forEach(e=>{this.availModes.appendChild(document.createElement("option")).innerHTML=e})})}setStandby(){const e={plugin:this.callsign,method:"setPreferredStandbyMode",params:{standbyMode:this.availModes.value}};return this.api.req(null,e).then(e=>{this.getStandbyMode()})}getPowerState(){const e={plugin:this.callsign,method:"getPowerState"};return this.api.req(null,e).then(e=>{e.success&&(this.powerMode.innerHTML=e.powerState)})}setPowerState(){const e={plugin:this.callsign,method:"setPowerState",params:{powerState:this.powerStates.value,standbyReason:"APIUnitTest"}};return this.api.req(null,e)}getMode(){const e={plugin:this.callsign,method:"getMode"};return this.api.req(null,e).then(e=>{e.success&&(this.mode.innerHTML=e.modeInfo.mode)})}setMode(){const e={plugin:this.callsign,method:"setMode",params:{modeInfo:{mode:this.modeList.value,duration:parseInt(this.modeDuration.value)}}};return this.api.req(null,e)}getUpTime(){const e={plugin:this.callsign,method:"requestSystemUptime"};return this.api.req(null,e).then(e=>{e.success&&(this.upTime.innerHTML=new Date(1e3*e.systemUptime).toISOString().substr(11,8))})}mocaMask(){this.moca.checked?this.setMoca(!0):this.moca.checked||this.setMoca(!1)}gzMask(){this.gz.checked?this.setGZ(!0):this.gz.checked||this.setGZ(!1)}setCacheKey(){const e={plugin:this.callsign,method:"setCachedValue",params:{key:this.setKey.value,value:this.setValue.value}};return this.api.req(null,e).then(e=>{e.success?this.upTime.innerHTML=e.systemUptime+"seconds":alert("Failed to store")})}getCacheValue(){window.clearTimeout(this.timeOut);const e={plugin:this.callsign,method:"getCachedValue",params:{key:this.getKey.value}};return this.api.req(null,e).then(e=>{e.success?this.getValue.innerHTML=null==e[this.getKey.value]?"Value not found":e[this.getKey.value]:this.getValue.innerHTML="Value not found",this.timeOut=setTimeout(()=>{this.getValue.innerHTML="-",this.getKey.value=""},5e3)})}removeCache(){const e={plugin:this.callsign,method:"removeCacheKey",params:{key:this.getKey.value}};return this.api.req(null,e).then(e=>{e.success?alert("Successfully removed"):alert("Cannot remove the key-value pair")})}prevRebootInfo(){const e={plugin:this.callsign,method:"getPreviousRebootInfo2"};return this.api.req(null,e).then(e=>{e.success&&(this.rebootSrc.innerHTML=e.rebootInfo.source,this.rebootReason.innerHTML=e.rebootInfo.reason,this.custReason.innerHTML=e.rebootInfo.customReason,this.hardReset.innerHTML=e.rebootInfo.lastHardPowerReset)})}getTempInfo(){const e={plugin:this.callsign,method:"getTemperatureThresholds"};return this.api.req(null,e).then(e=>{e.success&&(this.coreTemp.innerHTML=e.temperatureThresholds.temperature,this.warnTemp.innerHTML=e.temperatureThresholds.WARN,this.maxTemp.innerHTML=e.temperatureThresholds.MAX)})}getSerialNmmber(){const e={plugin:this.callsign,method:"getSerialNumber"};return this.api.req(null,e).then(e=>{e.success&&(this.serialNumber.innerHTML=e.serialNumber)})}getTimeZone(){const e={plugin:this.callsign,method:"getTimeZoneDST"};return this.api.req(null,e).then(e=>{e.success&&(this.timeZone.innerHTML=e.timeZone)})}getRFCConfig(){const e={plugin:this.callsign,method:"getRFCConfig",params:{rfcList:["Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AccountInfo.AccountID","Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.UPnP.Enabled","Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AllowOpenPorts.Enabled","Device.DeviceInfo.MemoryStatus.Total","Device.DeviceInfo.MemoryStatus.Free"]}};return this.api.req(null,e).then(e=>{e.success&&(this.accountID.innerHTML=e.RFCConfig["Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AccountInfo.AccountID"],this.upnp.innerHTML=e.RFCConfig["Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.UPnP.Enabled"],this.allowPorts.innerHTML=e.RFCConfig["Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AllowOpenPorts.Enabled"],this.totalMemory.innerHTML=e.RFCConfig["Device.DeviceInfo.MemoryStatus.Total"],this.freeMemory.innerHTML=e.RFCConfig["Device.DeviceInfo.MemoryStatus.Free"])})}getDeepSleepReason(){const e={plugin:this.callsign,method:"getLastDeepSleepReason"};return this.api.req(null,e).then(e=>{e.success&&(this.deepSleep.innerHTML=e.lastDeepSleepReason)})}getPropertyValue(){const e={plugin:this.callsign,method:"getStateInfo",params:{param:this.propertyName.value}};return this.api.req(null,e).then(e=>{e.success&&(this.propertyValue.innerHTML=e[this.propertyName.value])})}getFirmwareUpdateInfo(){const e={plugin:this.callsign,method:"getFirmwareUpdateInfo",params:{GUID:"1234abcd"}};return this.api.req(null,e)}getFirmwareUpdateState(){const e={plugin:this.callsign,method:"getFirmwareUpdateState"};return this.api.req(null,e)}close(){window.clearInterval(this.updateTimer),window.clearTimeout(this.timeOut),this.systemModeChanged&&"function"==typeof this.systemModeChanged.dispose&&this.systemModeChanged.dispose(),this.systemPowerChanged&&"function"==typeof this.systemPowerChanged.dispose&&this.systemPowerChanged.dispose(),this.onFirmwareUpdateInfo&&"function"==typeof this.onFirmwareUpdateInfo.dispose&&this.onFirmwareUpdateInfo.dispose(),this.onUpdateState&&"function"==typeof this.onUpdateState.dispose&&this.onUpdateState.dispose()}};var ve=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Timer",this.mainDiv=document.getElementById("main"),this.show=!1,this.length=0,this.onTimerExpired=this.api.t.on(this.callsign,"timerExpired",e=>{this.show&&this.showAllTimers()}),this.template='\n
        \n Timer\n
        \n
        \n Start timer\n
        \n
        \n Modes\n
        \n
        \n \n
        \n
        \n Interval (in seconds)\n
        \n
        \n \n
        \n
        \n Repeat Interval (in seconds)\n
        \n
        \n \n
        \n
        \n Remind Before (in seconds)\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n Status for all timers\n
        \n
        \n \n
        \n
        \n
        \n
        \n Suspend/Resume/Stop Timers\n
        \n
        \n Enter Timer ID\n
        \n
        \n \n
        \n
        \n \n
        \n
        \n \n
        \n '}render(){this.mainDiv.innerHTML=this.template,this.all_timers=document.getElementById("all_timers"),this.t_interval=document.getElementById("interval"),this.rep_interval=document.getElementById("rinterval"),this.rem_before=document.getElementById("rem_before"),this.timer_start=document.getElementById("timer_start"),this.modes=document.getElementById("modes"),this.ok=document.getElementById("ok"),this.ok.onclick=this.stateChange.bind(this),this.all_timers.onclick=this.click.bind(this),this.timer_start.onclick=this.start.bind(this)}startTimer(e,t,i,n){const s={plugin:this.callsign,method:"startTimer",params:{interval:e,mode:t,repeatInterval:i,remindBefore:n}};return this.api.req(null,s)}start(){""!=this.t_interval.value&&""!=this.rep_interval.value&&""!=this.rem_before.value?this.startTimer(this.t_interval.value,this.modes.value,this.rep_interval.value,this.rem_before.value).then(()=>{this.show&&this.showAllTimers()}):alert("Check your input parameters")}change(e,t){const i={plugin:this.callsign,method:e,params:{timerId:t}};return this.api.req(null,i)}click(){"Show all timers"==this.all_timers.innerHTML?this.showAllTimers():"Hide"==this.all_timers.innerHTML&&(this.hideTimers(),this.all_timers.innerHTML="Show all timers",this.show=!1)}getAllTimers(){const e={plugin:this.callsign,method:"getTimers"};return this.api.req(null,e)}showAllTimers(){this.show=!0;var e=document.getElementById("test");this.hideTimers(),this.getAllTimers().then(t=>{if(null!=t&&t.timers.length>0){this.length=t.timers.length;for(var i=0;i{e.success?this.showAllTimers():alert("Please check your timer ID and state once again")})}close(){this.hideTimers(),this.onTimerExpired&&"function"==typeof this.onTimerExpired.dispose&&(this.onTimerExpired.dispose(),this.onTimerExpired=null)}};var fe=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Time"}render(){document.getElementById("main").innerHTML='\n
        \n Time\n
        \n
        \n Current time\n
        \n
        \n -\n
        \n
        \n Source\n
        \n
        \n -\n
        \n
        \n Last synced\n
        \n
        \n -\n
        \n\n
        \n \n
        \n
        \n \n \n
        \n\n
        \n Control\n
        \n
        \n \n
        ',document.getElementById("setTime").onclick=this.setTime.bind(this),document.getElementById("sync").onclick=this.synchronizeTime.bind(this),this.timeEl=document.getElementById("time"),this.sourceEl=document.getElementById("source"),this.syncedEl=document.getElementById("synced"),this.timesyncListener=this.api.t.on("TimeSync","update",e=>{console.log("TIME NOT",e),this.update()}),this.update()}synchronizeTime(){this.syncTime().then(this.synchronize())}synchronize(){const e={plugin:this.callsign,method:"synchronize"};return this.api.req(null,e)}syncTime(){const e={plugin:this.callsign,method:"synctime"};return this.api.req(null,e)}setTime(){let e=document.getElementById("timeinput").value;const t={plugin:this.callsign,method:"time",params:e};return this.api.req(null,t)}getTime(){const e={plugin:this.callsign,method:"time"};return this.api.req(null,e)}update(){this.getTime().then(e=>{this.timeEl.innerHTML=e,this.syncTime().then(e=>{this.sourceEl.innerHTML=e.source,this.syncedEl.innerHTML=e.time})})}close(){this.timesyncListener&&"function"==typeof this.timesyncListener.dispose&&this.timesyncListener.dispose()}};var be=class extends T{constructor(e,t){super(e,t),this.displayName="Tracing",this.selectedTraceModule=void 0,this.traceModules=void 0,this.uniqueTraceModules=void 0,this.socketUrl=`ws://${t.host[0]}:${t.host[1]}/Service/TraceControl`,this.traceSocket=void 0}close(){this._closeSocket(),super.close()}toggleTracing(e,t,i){const n={plugin:"TraceControl",method:"set",params:{module:e,category:t,state:"on"===i?"enabled":"disabled"}};return this.api.req(null,n)}render(){this._openSocket();var e=this;document.getElementById("main").innerHTML='
        \n Modules\n
        \n\n
        \n \n
        \n
        \n \n
        \n\n
        \n\n\n
        \n \n \n \n \n \n \n \n \n \n \n \n
        timefile + linecategorymessage
        \n
        \n ',document.getElementById("tracingModules").onchange=this.getSelectedModuleAndShowCategories.bind(this),this.status().then(t=>{e.traceModules=t.settings?t.settings:[],e.uniqueTraceModules=[];var i=document.getElementById("tracingModules");i.getElementsByTagName("options");if(i.options.length=0,void 0!==e.traceModules){for(var n=0;n{this.update()})}update(){this.getUILanguage().then(e=>{this.current_ui_language.innerHTML=e.language})}};var Ee=class extends T{constructor(e,t){super(e,t)}render(){document.getElementById("main").innerHTML='
        \n Volume\n
        \n\n
        \n Muted\n
        \n
        \n -\n
        \n
        \n Volume level\n
        \n
        \n -\n
        \n\n
        \n Control\n
        \n
        \n \n \n \n
        ',this.mutedEl=document.getElementById("muted"),this.volumeEl=document.getElementById("volume"),this.muteBtn=document.getElementById("muteBtn"),document.getElementById("volumeUp").onclick=this.volumeChange.bind(this,10),document.getElementById("volumeDown").onclick=this.volumeChange.bind(this,-10),muteBtn.onclick=this.mute.bind(this),this.update()}update(){this.muted().then(e=>{this.mutedEl.innerHTML=e,muteBtn.innerHTML=e?"Unmute":"Mute"}),this.volume().then(e=>{this.volumeEl.innerHTML=e})}muted(e){const t={plugin:this.callsign,method:"muted"};return void 0!==e&&(t.params=e),this.api.req(null,t)}volume(e){const t={plugin:this.callsign,method:"volume"};return void 0!==e&&(t.params=e),this.api.req(null,t)}volumeChange(e){this.volume().then(t=>{this.volume(t+e).then(this.update())})}mute(){this.muted().then(e=>{this.muted(!e).then(this.update())})}};var Ie=class extends T{constructor(e,t){super(e,t),this.webShellSocket=void 0}render(){var e=this;document.getElementById("main").innerHTML='
        WebShell
        \n
        \n
        \n        
        \n
        #
        ',this.api.startWebShell((function(t,i){e.webShellSocket=i,e.webShellSocket.onmessage=function(e){var t=new FileReader;t.onload=function(){document.getElementById("webShellData").innerHTML=String.fromCharCode.apply(null,new Uint8Array(t.result))},t.readAsArrayBuffer(e.data)},e.webShellSocket.onclose=function(){e.webShellSocket=null,e.render()}})),void 0!==plugins.RemoteControl&&(plugins.RemoteControl.doNotHandleKeys=!0),window.addEventListener("keydown",this.handleKey.bind(this))}close(){void 0!==plugins.RemoteControl&&(plugins.RemoteControl.doNotHandleKeys=!1),window.removeEventListener("keydown",this.handleKey.bind(this),!1)}handleKey(e){if(this.webShellSocket&&13===e.which){for(var t=document.getElementById("webShellInput").value+" \n",i=new ArrayBuffer(2*t.length),n=new Uint8Array(i),s=0,o=t.length;s{!0===this.rendered&&this.getNetworks()}),this.wifiConnectionListener=this.api.t.on("WifiControl","connectionchange",e=>{this.connected=e.connected,!0===this.rendered&&this.update()})}render(){document.getElementById("main").innerHTML='
        \n Status\n
        \n\n
        \n Connected to\n
        \n
        \n\n
        \n Scanning\n
        \n
        \n False\n
        \n\n
        \n Wireless networks\n
        \n
        \n \n
        \n
        \n
        \n
        \n \n
        \n\n
        \n Configs\n
        \n\n
        \n Configs\n
        \n
        \n \n
        \n\n
        \n SSID\n
        \n
        \n \n
        \n
        \n Mode\n
        \n
        \n
        \n \x3c!-- disable for now\n
        \n
        \n \n
        \n --\x3e\n
        \n Hidden\n
        \n
        \n
        \n Method\n
        \n
        \n \n
        \n
        Controls
        \n
        \n \n \n
        \n
        \n
        \n \n \n
        \n\n
        \n
        \n ',this.scanButton=document.getElementById("Wifi_scanForNetworksButton"),this.saveButton=document.getElementById("Wifi_saveButton"),this.deleteButton=document.getElementById("Wifi_deleteButton"),this.connectButton=document.getElementById("Wifi_connectButton"),this.disconnectButton=document.getElementById("Wifi_disconnectButton"),this.scanButton.onclick=this.scanForNetworks.bind(this),this.deleteButton.onclick=this.deleteConfig.bind(this),this.saveButton.onclick=this.saveConfig.bind(this),this.disconnectButton.onclick=this.disconnect.bind(this),this.connectButton.onclick=this.connect.bind(this),this.connectedStatus=document.getElementById("Wifi_Connected"),this.scanningStatus=document.getElementById("Wifi_Scanning"),this.statusMessages=document.getElementById("statusMessages"),this.networkListEl=document.getElementById("Wifi_WirelessNetwork"),this.networkListEl.onchange=this.renderNetworkDetails.bind(this),this.configListEl=document.getElementById("Wifi_Configs"),this.configListEl.onchange=this.renderConfigDetails.bind(this),this.ssidEl=document.getElementById("Wifi_SSID"),this.methodEl=document.getElementById("Wifi_Method"),this.passwordEl=document.getElementById("Wifi_Password"),this.accesspointEl=document.getElementById("Wifi_Mode"),this.hiddenEl=document.getElementById("Wifi_Hidden"),this.update(),setTimeout(this.getNetworks.bind(this),200),setTimeout(this.getConfigs.bind(this),400),this.rendered=!0}update(){this.status().then(e=>{void 0!==e&&(this.connected=e.connectedssid,"boolean"==typeof e.isscanning&&(this.scanning=e.isscanning),this.renderStatus())})}scanForNetworks(){const e={plugin:this.callsign,method:"scan"};this.api.req(null,e).then(e=>{this.update(),setTimeout(this.getNetworks.bind(this),5e3)})}getConfig(e){this.update();const t={plugin:this.callsign,method:"config@"+e};this.api.req(null,t).then(e=>{void 0!==e&&(this.configinfo.push(e),this.renderConfigDetails())})}getConfigs(){this.update();const e={plugin:this.callsign,method:"configs"};this.api.req(null,e).then(e=>{if(void 0!==e){this.configs=e,this.configinfo=[],this.configListEl.innerHTML="";for(var t=0;t{if(void 0!==e&&(this.networks=[],!1!==this.rendered)){this.networkListEl.innerHTML="";for(var t=0;t{e.statusMessage("Saved config for "+this.ssidEl.value),e.getConfigs()})}deleteConfig(){var e=this,t=this.configListEl.selectedIndex;this.statusMessage("Deleting config "+this.configs[t].ssid);const i={plugin:this.callsign,method:"config@"+this.configs[t],params:{value:{ssid:"",accesspoint:!1}}};this.api.req(null,i).then(t=>{e.connecting=!0,e.getConfigs()})}requestDHCP(){this.statusMessage("Requesting DHCP for wlan0");const e={plugin:"NetworkControl",method:"request",params:{device:this.wlanInterface}};this.api.req(null,e)}connect(){var e=this.configListEl.selectedIndex;this.statusMessage("Connecting to "+this.configs[e]);const t={plugin:this.callsign,method:"connect",params:{configssid:this.configs[e]}};this.api.req(null,t).then(()=>{this.connecting=!0,setTimeout(this.requestDHCP.bind(this),5e3)})}disconnect(){if(void 0===this.connected||""===this.connected)return;const e={plugin:this.callsign,method:"disconnect",params:{configssid:this.connected}};this.statusMessage("Disconnecting from "+this.connected),this.api.req(null,e)}close(){this.rendered=!1,this.wifiConnectionListener&&"function"==typeof this.wifiConnectionListener.dispose&&this.wifiConnectionListener.dispose(),this.wifiScanListener&&"function"==typeof this.wifiScanListener.dispose&&this.wifiScanListener.dispose()}};var Se=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="Warehouse",this.mainDiv=document.getElementById("main"),this.template='\n
        Device Information
        \n
        Bluetooth MAC
        \n
        -
        \n
        Box IP
        \n
        -
        \n
        Build Type
        \n
        -
        \n
        ESTB MAC
        \n
        -
        \n
        Ethernet MAC
        \n
        -
        \n
        Image Version
        \n
        -
        \n
        Model Number
        \n
        -
        \n
        rf4ce MAC
        \n
        -
        \n
        Wi-Fi MAC
        \n
        -
        \n
        Reset
        \n
        Device Reset
        \n
        \n \n
        \n
        Internal Reset
        \n
        \n \n
        \n
        Light Reset
        \n
        \n \n
        \n
        Front Panel State
        \n
        Set front panel state
        \n
        \n \n
        \n
        \n \n
        \n
        Customer Data
        \n
        -
        \n \t'}render(){this.mainDiv.innerHTML=this.template,this.btMac=document.getElementById("bt_mac"),this.boxIP=document.getElementById("box_ip"),this.buildType=document.getElementById("build_type"),this.estbMac=document.getElementById("estb_mac"),this.ethMac=document.getElementById("eth_mac"),this.imgVersion=document.getElementById("img_version"),this.modelNumber=document.getElementById("model_number"),this.rfMac=document.getElementById("rf_mac"),this.wifiMac=document.getElementById("wifi_mac"),this.custData=document.getElementById("cust_data"),this.deviceResetButton=document.getElementById("Device_Reset"),this.internalResetButton=document.getElementById("Internal_Reset"),this.lightResetButton=document.getElementById("Light_Reset"),this.frontPanelSetButton=document.getElementById("front_set"),this.state=document.getElementById("state"),this.deviceResetButton.onclick=()=>{confirm("Do you want to suppress reboot during device reset")?this.deviceReset(!0):this.deviceReset(!1)},this.internalResetButton.onclick=this.internalReset.bind(this),this.lightResetButton.onclick=this.lightReset.bind(this),this.frontPanelSetButton.onclick=this.frontPanelSet.bind(this),this.onResetDone=this.api.t.on(this.callsign,"resetDone",e=>{alert("Device reset successfully")}),this.deviceInfo(),this.isClean()}deviceReset(e){const t={plugin:this.callsign,method:"resetDevice",params:{supressReboot:e}};return this.api.req(null,t)}internalReset(){const e={plugin:this.callsign,method:"internalReset",params:{passPhrase:"FOR TEST PURPOSES ONLY"}};return this.api.req(null,e).then(e=>{e.success&&alert("Internal reset success")})}lightReset(){const e={plugin:this.callsign,method:"lightReset"};return this.api.req(null,e).then(e=>{e.success&&alert("Light reset success")})}frontPanelSet(){const e={plugin:this.callsign,method:"setFrontPanelState",params:{state:this.state.value}};return this.api.req(null,e).then(e=>{e.success?alert("Front panel LED states set successfully"):alert("Error: "+e.error)})}deviceInfo(){const e={plugin:this.callsign,method:"getDeviceInfo"};return this.api.req(null,e).then(e=>{e.success&&(this.btMac.innerHTML=e.bluetooth_mac,this.boxIP.innerHTML=e.boxIP,this.buildType.innerHTML=e.build_type,this.estbMac.innerHTML=e.estb_mac,this.ethMac.innerHTML=e.eth_mac,this.imgVersion.innerHTML=e.imageVersion,this.modelNumber.innerHTML=e.model_number,this.rfMac.innerHTML=e.rf4ce_mac,this.wifiMac.innerHTML=e.wifi_mac)})}isClean(){const e={plugin:this.callsign,method:"isClean"};return this.api.req(null,e).then(e=>{e.success?e.clean?this.custData.innerHTML="No records found":this.custData.innerHTML=e.files.join("
        "):this.custData.innerHTML="Error:"+e.error})}close(){this.onResetDone&&"function"==typeof this.onResetDone.dispose&&(this.onResetDone.dispose(),this.onResetDone=null)}};var ke=class extends T{constructor(e,t){super(e,t),this.renderInMenu=!0,this.displayName="XCast",this.mainDiv=document.getElementById("main")}render(){this.template='\n
        XCast
        \n
        API Version
        \n
        -
        \n
        Quirks
        \n
        -
        \n ',this.mainDiv.innerHTML=this.template,this.version=document.getElementById("version"),this.quirks=document.getElementById("quirks"),this.update()}update(){this.getVersion(),this.getQuirks()}getVersion(){const e={plugin:this.callsign,method:"getApiVersionNumber"};return this.api.req(null,e).then(e=>{e.success?this.version.innerHTML=e.version:this.version.innerHTML="Not Available"})}getQuirks(){const e={plugin:this.callsign,method:"getQuirks"};return this.api.req(null,e).then(e=>{e.success&&(0==e.quirks.length?this.quirks.innerHTML="-":this.quirks.innerHTML=e.quirks.join())})}};var Me=class extends T{constructor(e,t){super(e,t),this.displayName="Wi-Fi",this.networks=[],this.connecting=!1,this.connected=void 0,this.scanning=!1,this.statusMessageTimer=null,this.rendered=!1}render(){document.getElementById("main").innerHTML='\n
        Status
        \n
        Connected to
        \n
        \n
        \n \n
        \n
        \n
        Scanning
        \n
        false
        \n
        Wireless networks
        \n
        \n \n
        \n
        \n
        \n
        \n ',this.scanButton=document.getElementById("Wifi_scanForNetworksButton"),this.optionButton=document.getElementById("ssid_options"),this.scanButton.onclick=this.scanForNetworks.bind(this),this.connectedStatus=document.getElementById("Wifi_Connected"),this.scanningStatus=document.getElementById("Wifi_Scanning"),this.statusMessages=document.getElementById("statusMessages"),this.networkListEl=document.getElementById("Wifi_WirelessNetwork"),this.update(),this.wifiScanListener=this.api.t.on(this.callsign,"onAvailableSSIDs",e=>{this.renderNetworks(e),this.scanningStatus.innerHTML=!1}),this.wifiConnectionListener=this.api.t.on(this.callsign,"onWIFIStateChanged",e=>{switch(this.getConnectedSSID(),e.state){case 2:this.statusMessage("Disconnected from "+this.connectedStatus.innerHTML);break;case 4:this.statusMessage("Connecting",!0);break;case 5:this.statusMessage("Connected");break;case 6:this.statusMessage("Failed")}}),this.errorListener=this.api.t.on(this.callsign,"onError",e=>{switch(e.code){case 4:this.statusMessage("Invalid credentials",!1,!0)}}),this.networkListEl.onchange=this.renderOptions.bind(this),this.rendered=!0}update(){this.renderOptions(),this.getConnectedSSID(),this.scanForNetworks()}scanForNetworks(){const e={plugin:this.callsign,method:"startScan",params:{incremental:!1,ssid:"",frequency:""}};this.api.req(null,e).then(e=>{e.success?this.scanningStatus.innerHTML=!0:this.statusMessage(e.error,!1,!0)})}renderNetworks(e){if(void 0===e)return;if(this.networks=[],!1===this.rendered)return;let t=e.ssids;this.networkListEl.innerHTML="";for(var i=0;i{this.connecting=!0,this.passwordEl.value=""})}disconnect(){const e={plugin:this.callsign,method:"disconnect",params:{}};this.api.req(null,e).then(e=>{})}getConnectedSSID(){const e={plugin:this.callsign,method:"getConnectedSSID",params:{}};this.api.req(null,e).then(e=>{this.connectedStatus.innerHTML=e.ssid,this.renderOptions()})}renderOptions(){this.optionButton.innerHTML="";let e=this.networkListEl.selectedIndex;e>=0&&(this.networks[e].ssid==this.connectedStatus.innerHTML?(this.optionButton.innerHTML='\n
        \n \n
        \n ',this.disconnectButton=document.getElementById("Wifi_disconnectButton"),this.disconnectButton.onclick=this.disconnect.bind(this)):(0==this.networks[e].security||15==this.networks[e].security?this.optionButton.innerHTML='\n
        \n \n
        \n ':(this.optionButton.innerHTML='\n
        \n Password\n
        \n
        \n \n
        \n
        \n \n
        \n ',this.passwordEl=document.getElementById("Wifi_Password")),this.connectButton=document.getElementById("Wifi_connectButton"),this.connectButton.onclick=this.connect.bind(this)))}close(){this.rendered=!1,this.wifiConnectionListener&&"function"==typeof this.wifiConnectionListener.dispose&&this.wifiConnectionListener.dispose(),this.wifiScanListener&&"function"==typeof this.wifiScanListener.dispose&&this.wifiScanListener.dispose()}};var Be,Te={ActivityMonitor:L,AVInput:C,BluetoothControl:w,Bluetooth:P,Cobalt:A,Compositor:R,ContinueWatching:q,Controller:U,DataCapture:F,DeviceInfo:V,DisplayInfo:O,DisplaySettings:J,PlayerInfo:j,DeviceDiagnostics:W,DeviceIdentification:K,DialServer:Z,FirmwareControl:z,FrameRate:G,LoggingPreferences:$,LocationSync:Q,MessageControl:ee,HdcpProfile:Y,HdmiInput:X,IOConnector:te,Messenger:ie,Monitor:H,Netflix:ne,Network:se,NetworkControl:oe,OCDM:le,PersistentStore:de,Power:re,Provisioning:ae,RDKShell:ce,RemoteControl:ue,ScreenCapture:he,Snapshot:_e,Spark:ge,SwitchBoard:pe,SystemServices:me,Timer:ve,TimeSync:fe,TraceControl:be,UserPreferences:ye,VolumeControl:Ee,WebKitBrowser:N,WebShell:Ie,WifiControl:xe,Warehouse:Se,WifiManager:Me,XCast:ke,LinearPlaybackControl:class extends T{constructor(e,t){super(e,t),this.api.t.on("LinearPlaybackControl","speedchanged",e=>{this.eventTrickPlaySpeed.innerHTML=e.speed})}render(){document.getElementById("main").innerHTML='
        \n Linear Playback Control\n
        \n\n
        Channel presets
        \n
        \n \n
        \n \n
        \n \n
        \n\n
        \n \n \n \n
        \n \n
        \n \n
        \n\n
        \n \n \n \n
        \n \n
        \n \n
        \n\n
        \n \n \n \n
        \n\n
        Event data
        \n
        Trick play speed [s]
        \n
        -
        \n\n
        Status
        \n
        Trick play speed [s]
        \n
        -
        \n
        Seek position [s]
        \n
        -
        \n
        TSB size [s]
        \n
        -
        \n
        Seek position [bytes]
        \n
        -
        \n
        TSB size [bytes]
        \n
        -
        \n
        TSB size max. [bytes]
        \n
        -
        \n
        Stream source lost
        \n
        -
        \n
        Stream source loss count
        \n
        -
        \n \n
        \n \n
        ',this.channel_presets=[{Name:"Select a channel",URL:""},{Name:"Test Chan 1",URL:"239.100.0.1"},{Name:"Test Chan 2",URL:"239.100.0.2"},{Name:"Test Chan 3",URL:"239.100.0.3"}];var e=document.getElementById("linear_channel_presets");if(0===e.children.length)for(var t=0;t0&&(console.log("Index= "+e),this.rpcSetChannel(this.channel_presets[e].URL).then(e=>{this.getChannel()}))}setChannel(){var e=document.getElementById("linear_channel_uri").value;document.getElementById("set_channel_button");this.rpcSetChannel(e)}getChannel(){document.getElementById("linear_channel_uri").value="-",this.rpcGet("channel").then(e=>{void 0!==e&&(document.getElementById("linear_channel_uri").value=e.channel)}).catch(e=>{alert("Error reading channel endpoint")})}setSeek(){var e=document.getElementById("linear_channel_seek").value;document.getElementById("set_seek_button");this.rpcSetSeek(e)}getSeek(){document.getElementById("linear_channel_seek").value="-",this.rpcGet("seek").then(e=>{void 0!==e&&(document.getElementById("linear_channel_seek").value=e.seekPosInSeconds)}).catch(e=>{alert("Error reading seek endpoint")})}setTrickPlaySpeed(){var e=document.getElementById("trick_play_speed").value;document.getElementById("set_trick_play_speed_button");this.rpcSetTrickPlaySpeed(e)}getTrickPlaySpeed(){document.getElementById("trick_play_speed").value="-",this.rpcGet("trickplay").then(e=>{void 0!==e&&(document.getElementById("trick_play_speed").value=e.speed)}).catch(e=>{alert("Error reading seek endpoint")})}getStatus(){document.getElementById("status_trick_play_speed").innerHTML="-",document.getElementById("status_seek_pos_seconds").innerHTML="-",document.getElementById("status_tsb_size_seconds").innerHTML="-",document.getElementById("status_seek_pos_bytes").innerHTML="-",document.getElementById("status_tsb_size_bytes").innerHTML="-",document.getElementById("status_max_tsb_size_bytes").innerHTML="-",document.getElementById("status_stream_source_lost").innerHTML="-",document.getElementById("status_stream_source_loss_count").innerHTML="-",this.rpcGet("status").then(e=>{void 0!==e&&(document.getElementById("status_trick_play_speed").innerHTML=e.trickPlaySpeed,document.getElementById("status_seek_pos_seconds").innerHTML=e.seekPosInSeconds,document.getElementById("status_tsb_size_seconds").innerHTML=e.currentSizeInSeconds,document.getElementById("status_seek_pos_bytes").innerHTML=e.seekPosInBytes,document.getElementById("status_tsb_size_bytes").innerHTML=e.currentSizeInBytes,document.getElementById("status_max_tsb_size_bytes").innerHTML=e.maxSizeInBytes,document.getElementById("status_stream_source_lost").innerHTML=e.streamSourceLost,document.getElementById("status_stream_source_loss_count").innerHTML=e.streamSourceLossCount)}).catch(e=>{alert("Error reading status endpoint")})}}},Le={},Ce=void 0,we=(document.getElementById("main"),window.localStorage.getItem("lastActivePlugin")),De=we?"string"!=typeof(Be=we)?"":Be.replace(/[^a-zA-Z0-9_\/-]/g,"_"):void 0;function Pe(e){(Ce=new E(e)).getControllerPlugins().then(e=>e).then(e=>{for(var t=0;t1)for(var i=1;i=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,d=!0,r=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return d=e.done,e},e:function(e){r=!0,l=e},f:function(){try{d||null==i.return||i.return()}finally{if(r)throw l}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i0?40*e+55:0,l=t>0?40*t+55:0,d=i>0?40*i+55:0;n[16+36*e+6*t+i]=function(e){var t,i=[],n=s(e);try{for(n.s();!(t=n.n()).done;){var o=t.value;i.push(a(o))}}catch(e){n.e(e)}finally{n.f()}return"#"+i.join("")}([o,l,d])}(e,t,i,l)}))}))})),h(0,23).forEach((function(e){var t=e+232,i=a(10*e+8);l[t]="#"+i+i+i})),l)};function a(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t}function c(e,t,i,n){var s;return"text"===t?s=function(e,t){if(t.escapeXML)return d.encodeXML(e);return e}(i,n):"display"===t?s=function(e,t,i){t=parseInt(t,10);var n,s={"-1":function(){return"
        "},0:function(){return e.length&&u(e)},1:function(){return g(e,"b")},3:function(){return g(e,"i")},4:function(){return g(e,"u")},8:function(){return p(e,"display:none")},9:function(){return g(e,"strike")},22:function(){return p(e,"font-weight:normal;text-decoration:none;font-style:normal")},23:function(){return f(e,"i")},24:function(){return f(e,"u")},39:function(){return m(e,i.fg)},49:function(){return v(e,i.bg)},53:function(){return p(e,"text-decoration:overline")}};s[t]?n=s[t]():4"})).join("")}function h(e,t){for(var i=[],n=e;n<=t;n++)i.push(n);return i}function _(e){var t=null;return 0===(e=parseInt(e,10))?t="all":1===e?t="bold":2")}function p(e,t){return g(e,"span",t)}function m(e,t){return g(e,"span","color:"+t)}function v(e,t){return g(e,"span","background-color:"+t)}function f(e,t){var i;if(e.slice(-1)[0]===t&&(i=e.pop()),i)return""}var b=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(t=t||{}).colors&&(t.colors=Object.assign({},r.colors,t.colors)),this.options=Object.assign({},r,t),this.stack=[],this.stickyStack=[]}var t,i,o;return t=e,(i=[{key:"toHtml",value:function(e){var t=this;e="string"==typeof e?[e]:e;var i=this.stack,n=this.options,o=[];return this.stickyStack.forEach((function(e){var t=c(i,e.token,e.data,n);t&&o.push(t)})),function(e,t,i){var n=!1;function o(){return""}function l(e){return t.newline?i("display",-1):i("text",e),""}var d=[{pattern:/^\x08+/,sub:o},{pattern:/^\x1b\[[012]?K/,sub:o},{pattern:/^\x1b\[\(B/,sub:o},{pattern:/^\x1b\[[34]8;2;\d+;\d+;\d+m/,sub:function(e){return i("rgb",e),""}},{pattern:/^\x1b\[38;5;(\d+)m/,sub:function(e,t){return i("xterm256Foreground",t),""}},{pattern:/^\x1b\[48;5;(\d+)m/,sub:function(e,t){return i("xterm256Background",t),""}},{pattern:/^\n/,sub:l},{pattern:/^\r+\n/,sub:l},{pattern:/^\r/,sub:l},{pattern:/^\x1b\[((?:\d{1,3};?)+|)m/,sub:function(e,t){n=!0,0===t.trim().length&&(t="0");var o,l=s(t=t.trimRight(";").split(";"));try{for(l.s();!(o=l.n()).done;){var d=o.value;i("display",d)}}catch(e){l.e(e)}finally{l.f()}return""}},{pattern:/^\x1b\[\d?J/,sub:o},{pattern:/^\x1b\[\d{0,3};\d{0,3}f/,sub:o},{pattern:/^\x1b\[?[\d;]{0,3}/,sub:o},{pattern:/^(([^\x1b\x08\r\n])+)/,sub:function(e){return i("text",e),""}}];function r(t,i){i>3&&n||(n=!1,e=e.replace(t.pattern,t.sub))}var a=[],c=e.length;e:for(;c>0;){for(var u=0,h=0,_=d.length;h<_;u=++h)if(r(d[u],u),e.length!==c){c=e.length;continue e}if(e.length===c)break;a.push(0),c=e.length}}(e.join(""),n,(function(e,s){var l=c(i,e,s,n);l&&o.push(l),n.stream&&(t.stickyStack=function(e,t,i){var n;return"text"!==t&&(e=e.filter((n=_(i),function(e){return(null===n||e.category!==n)&&"all"!==n}))).push({token:t,data:i,category:_(i)}),e}(t.stickyStack,e,s))})),i.length&&o.push(u(i)),o.join("")}}])&&n(t.prototype,i),o&&n(t,o),e}();e.exports=b},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeXMLStrict=t.decodeHTML5Strict=t.decodeHTML4Strict=t.decodeHTML5=t.decodeHTML4=t.decodeHTMLStrict=t.decodeHTML=t.decodeXML=t.encodeHTML5=t.encodeHTML4=t.escapeUTF8=t.escape=t.encodeNonAsciiHTML=t.encodeHTML=t.encodeXML=t.encode=t.decodeStrict=t.decode=void 0;var n=i(2),s=i(5);t.decode=function(e,t){return(!t||t<=0?n.decodeXML:n.decodeHTML)(e)},t.decodeStrict=function(e,t){return(!t||t<=0?n.decodeXML:n.decodeHTMLStrict)(e)},t.encode=function(e,t){return(!t||t<=0?s.encodeXML:s.encodeHTML)(e)};var o=i(5);Object.defineProperty(t,"encodeXML",{enumerable:!0,get:function(){return o.encodeXML}}),Object.defineProperty(t,"encodeHTML",{enumerable:!0,get:function(){return o.encodeHTML}}),Object.defineProperty(t,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return o.encodeNonAsciiHTML}}),Object.defineProperty(t,"escape",{enumerable:!0,get:function(){return o.escape}}),Object.defineProperty(t,"escapeUTF8",{enumerable:!0,get:function(){return o.escapeUTF8}}),Object.defineProperty(t,"encodeHTML4",{enumerable:!0,get:function(){return o.encodeHTML}}),Object.defineProperty(t,"encodeHTML5",{enumerable:!0,get:function(){return o.encodeHTML}});var l=i(2);Object.defineProperty(t,"decodeXML",{enumerable:!0,get:function(){return l.decodeXML}}),Object.defineProperty(t,"decodeHTML",{enumerable:!0,get:function(){return l.decodeHTML}}),Object.defineProperty(t,"decodeHTMLStrict",{enumerable:!0,get:function(){return l.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML4",{enumerable:!0,get:function(){return l.decodeHTML}}),Object.defineProperty(t,"decodeHTML5",{enumerable:!0,get:function(){return l.decodeHTML}}),Object.defineProperty(t,"decodeHTML4Strict",{enumerable:!0,get:function(){return l.decodeHTMLStrict}}),Object.defineProperty(t,"decodeHTML5Strict",{enumerable:!0,get:function(){return l.decodeHTMLStrict}}),Object.defineProperty(t,"decodeXMLStrict",{enumerable:!0,get:function(){return l.decodeXML}})},function(e){e.exports=JSON.parse('{"Aacute":"Á","aacute":"á","Acirc":"Â","acirc":"â","acute":"´","AElig":"Æ","aelig":"æ","Agrave":"À","agrave":"à","amp":"&","AMP":"&","Aring":"Å","aring":"å","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","brvbar":"¦","Ccedil":"Ç","ccedil":"ç","cedil":"¸","cent":"¢","copy":"©","COPY":"©","curren":"¤","deg":"°","divide":"÷","Eacute":"É","eacute":"é","Ecirc":"Ê","ecirc":"ê","Egrave":"È","egrave":"è","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","frac12":"½","frac14":"¼","frac34":"¾","gt":">","GT":">","Iacute":"Í","iacute":"í","Icirc":"Î","icirc":"î","iexcl":"¡","Igrave":"Ì","igrave":"ì","iquest":"¿","Iuml":"Ï","iuml":"ï","laquo":"«","lt":"<","LT":"<","macr":"¯","micro":"µ","middot":"·","nbsp":" ","not":"¬","Ntilde":"Ñ","ntilde":"ñ","Oacute":"Ó","oacute":"ó","Ocirc":"Ô","ocirc":"ô","Ograve":"Ò","ograve":"ò","ordf":"ª","ordm":"º","Oslash":"Ø","oslash":"ø","Otilde":"Õ","otilde":"õ","Ouml":"Ö","ouml":"ö","para":"¶","plusmn":"±","pound":"£","quot":"\\"","QUOT":"\\"","raquo":"»","reg":"®","REG":"®","sect":"§","shy":"­","sup1":"¹","sup2":"²","sup3":"³","szlig":"ß","THORN":"Þ","thorn":"þ","times":"×","Uacute":"Ú","uacute":"ú","Ucirc":"Û","ucirc":"û","Ugrave":"Ù","ugrave":"ù","uml":"¨","Uuml":"Ü","uuml":"ü","Yacute":"Ý","yacute":"ý","yen":"¥","yuml":"ÿ"}')},function(e,t,i){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(i(18)),o=String.fromCodePoint||function(e){var t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|1023&e),t+=String.fromCharCode(e)};t.default=function(e){return e>=55296&&e<=57343||e>1114111?"�":(e in s.default&&(e=s.default[e]),o(e))}},function(e){e.exports=JSON.parse('{"0":65533,"128":8364,"130":8218,"131":402,"132":8222,"133":8230,"134":8224,"135":8225,"136":710,"137":8240,"138":352,"139":8249,"140":338,"142":381,"145":8216,"146":8217,"147":8220,"148":8221,"149":8226,"150":8211,"151":8212,"152":732,"153":8482,"154":353,"155":8250,"156":339,"158":382,"159":376}')}]); \ No newline at end of file diff --git a/src/css/style.css b/src/css/style.css index 0389b9d..dcd4d6d 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -58,6 +58,8 @@ html { user-select: none; z-index: 1000; background-color: rgba(0,0,0,0.1); + display: flex; + align-items: center; } .touch .header img { @@ -633,10 +635,8 @@ div#hide-notifications:hover { .desktop .header img { height: 30px; - width: 30px; - margin-top: 15px; - margin-left: 35px; - margin-bottom: 10px; + width: auto; + margin-left: 15px; } @media screen and (min-width: 960px) { @@ -882,3 +882,43 @@ input[type=checkbox] { -moz-transition: transform 0.15s ease-in-out, background-color 0.15s ease-in-out; -webkit-transition: transform 0.15s ease-in-out, background-color 0.15s ease-in-out; } + +.instance-buttons { + display: flex; + gap: 8px; + margin-left: 20px; + overflow-x: auto; + max-width: calc(100vw - 250px); + scrollbar-width: thin; +} + +.instance-buttons::-webkit-scrollbar { + height: 4px; +} + +.instance-buttons::-webkit-scrollbar-thumb { + background: rgba(255, 255, 255, 0.3); + border-radius: 2px; +} + +.instance-button { + background-color: #444; + border: 1px solid #555; + border-radius: 4px; + color: #ccc; + padding: 6px 14px; + font-size: 13px; + cursor: pointer; + transition: all 0.2s ease; +} + +.instance-button:hover { + background-color: #555; + color: #fff; +} + +.instance-button.active { + background-color: #0078d4; + border-color: #0078d4; + color: #fff; +} diff --git a/src/js/core/application.js b/src/js/core/application.js index 1b29963..d31476e 100644 --- a/src/js/core/application.js +++ b/src/js/core/application.js @@ -45,7 +45,9 @@ var plugin = undefined; // private var fetchedPlugins = []; var mainDiv = document.getElementById('main'); -var activePlugin = window.localStorage.getItem('lastActivePlugin') || undefined; +// Sanitize localStorage input to prevent stored XSS +var storedPlugin = window.localStorage.getItem('lastActivePlugin'); +var activePlugin = storedPlugin ? sanitizeForId(storedPlugin) : undefined; /** * Main initialization function @@ -85,24 +87,47 @@ function init(host){ /** (global) renders a plugin in the main div */ function showPlugin(callsign) { - if (plugins[ callsign ] === undefined) + // Extract base callsign for plugin lookup (e.g., "DeviceInfo" from "BridgeLink1/DeviceInfo") + const delimiter = '/'; + const lastDelimiterIndex = callsign.lastIndexOf(delimiter); + const baseCallsign = lastDelimiterIndex !== -1 ? callsign.substring(lastDelimiterIndex + 1) : callsign; + const prefix = lastDelimiterIndex !== -1 ? callsign.substring(0, lastDelimiterIndex) : null; + + if (plugins[ baseCallsign ] === undefined) return; - if (activePlugin !== undefined && plugins[ activePlugin ] !== undefined) - plugins[ activePlugin ].close(); + if (activePlugin !== undefined) { + // Get base callsign for the currently active plugin + const activeLastDelimiter = activePlugin.lastIndexOf(delimiter); + const activeBaseCallsign = activeLastDelimiter !== -1 ? activePlugin.substring(activeLastDelimiter + 1) : activePlugin; + if (plugins[ activeBaseCallsign ] !== undefined) + plugins[ activeBaseCallsign ].close(); + } - document.getElementById('main').innerHTML = ''; - plugins[ callsign ].render(); activePlugin = callsign; - window.localStorage.setItem('lastActivePlugin', callsign); -}; + + // Set the active prefix on the API so all subsequent calls use it + api.setActivePrefix(prefix); + + plugins[ baseCallsign ].render(); +} + +// Sanitize a string for safe use as object key/DOM id +function sanitizeForId(str) { + if (typeof str !== 'string') return ''; + return str.replace(/[^a-zA-Z0-9_\/-]/g, '_'); +} /** (global) refresh current active plugin */ function renderCurrentPlugin() { // lets re-render menu too, just to be sure plugins.menu.render(activePlugin); - document.getElementById('main').innerHTML = ''; + // Use DOM methods instead of innerHTML + var main = document.getElementById('main'); + while (main.firstChild) { + main.removeChild(main.firstChild); + } plugins[ activePlugin ].render(); }; diff --git a/src/js/core/wpeApi.js b/src/js/core/wpeApi.js index e35d6bb..e023ccc 100644 --- a/src/js/core/wpeApi.js +++ b/src/js/core/wpeApi.js @@ -35,6 +35,9 @@ export default class WpeApi { this.t = ThunderJS({ 'host' : this.host[0], 'port': this.host[1] }); this.socketListeners = {}; + + // Active prefix for composite plugin support (e.g., "BridgeLink1") + this.activePrefix = null; // might use this later if the requests are getting to slow with the jsonrpc -> rest fallback. this.servicesAvailableInJsonRPC = [ @@ -61,6 +64,34 @@ export default class WpeApi { ]; }; + /** + * Set the active prefix for API calls. + * When set, all plugin calls will be prefixed (e.g., "MessageControl" becomes "BridgeLink1/MessageControl"). + * @param {string|null} prefix - The prefix to apply, or null for local Thunder + */ + setActivePrefix(prefix) { + this.activePrefix = prefix; + } + + /** + * Get the prefixed plugin name for API calls. + * @param {string} pluginName - The base plugin name + * @returns {string} The prefixed plugin name (or original if no prefix set) + */ + getPrefixedPlugin(pluginName) { + // Don't prefix if no active prefix + if (!this.activePrefix) { + return pluginName; + } + + // Don't double-prefix if the plugin already has a prefix + if (pluginName.includes('/')) { + return pluginName; + } + + return this.activePrefix + '/' + pluginName; + } + handleRequest(method, URL, body, callback) { var self = this; @@ -109,11 +140,14 @@ export default class WpeApi { // Compatibility method to deal with transitioning APIs and older version of Thunder // note: This assumes the WebSocket to jsonrpc will fail. - req(rest, jsonrpc) { + req(rest, jsonrpc, options = {}) { return new Promise( (resolve, reject) => { if (jsonrpc) { - console.debug(` ${jsonrpc.plugin }.1.${jsonrpc.method}`, jsonrpc.params ? jsonrpc.params : ''); - this.t.call(jsonrpc.plugin, jsonrpc.method, jsonrpc.params) + // Apply active prefix to plugin name unless skipPrefix is set + // skipPrefix is used for infrastructure calls with absolute paths + const prefixedPlugin = options.skipPrefix ? jsonrpc.plugin : this.getPrefixedPlugin(jsonrpc.plugin); + console.debug(` ${prefixedPlugin}.1.${jsonrpc.method}`, jsonrpc.params ? jsonrpc.params : ''); + this.t.call(prefixedPlugin, jsonrpc.method, jsonrpc.params) .then( result => { resolve(result); }).catch( error => { diff --git a/src/js/layout/menu.js b/src/js/layout/menu.js index b497d77..e455143 100644 --- a/src/js/layout/menu.js +++ b/src/js/layout/menu.js @@ -19,12 +19,44 @@ /** The side navigation menu provides navigation across the different plugins */ import { showPlugin } from '../core/application.js'; +// Sanitize a string for safe use in DOM element IDs +// Only allow alphanumeric characters, hyphens, and underscores +function sanitizeForId(str) { + return str.replace(/[^a-zA-Z0-9_-]/g, '_'); +} + +// Sanitize a string for safe display in the DOM +// This is used even with textContent/createTextNode for defense in depth +function sanitizeForDisplay(str) { + if (typeof str !== 'string') return ''; + return str.replace(/[<>&"']/g, ''); +} + class Menu { constructor(plugins, api) { - this.api = api; - this.plugins = plugins; - this.top = document.getElementById('top'); - this.renderInMenu = false; + this.api = api; + this.plugins = plugins; + this.top = document.getElementById('top'); + this.renderInMenu = false; + // Restore selected instance from localStorage if available + // Sanitize to prevent any stored XSS payload from being used + const storedInstance = localStorage.getItem('thunderUI_selectedInstance'); + this.selectedInstance = storedInstance ? sanitizeForId(storedInstance) : null; + // Restore current plugin from localStorage if available + const storedPlugin = localStorage.getItem('thunderUI_currentPlugin'); + this.currentPlugin = storedPlugin ? sanitizeForId(storedPlugin) : null; + + // Also set the API prefix to match the restored selection + if (this.selectedInstance) + this.api.setActivePrefix(this.selectedInstance); + + this.compositeControllerListeners = new Map(); // Track composite controller listeners + this.renderTimeout = null; // Track pending render timeout + // Separate cache for each instance: key is instance name (null for local), value is Map of callsign -> state + this.pluginStateCaches = new Map(); + + // Expose menu instance globally for manual updates + window.menu = this; var bodyEl = document.getElementsByTagName('body')[0]; @@ -36,38 +68,42 @@ class Menu { this.isTouchDevice = true; } catch(e) {} - // add the top header + logo + keyboard hooks - this.top.innerHTML = ` + // Build header using DOM methods to avoid innerHTML XSS concerns + this.header = document.createElement('div'); + this.header.id = 'header'; + this.header.className = 'header'; - - - `; + const buttonLeft = document.createElement('div'); + buttonLeft.id = 'button-left'; + buttonLeft.className = 'fa fa-bars left'; + this.header.appendChild(buttonLeft); - this.header = document.getElementById('header'); - this.nav = document.getElementById('menu'); - - // for some reason WPE Framework stores everything under /UI/ and relative paths dont work :( so heres a workaround - var logoLoadError = false; - var logo = new Image(); + const logo = document.createElement('img'); + logo.id = 'header-logo'; + logo.src = 'img/ml.svg'; logo.alt = 'Metrological'; - logo.onload = () => { - this.header.appendChild(logo); - }; + logo.onerror = function() { this.src = 'UI/img/ml.svg'; }; + this.header.appendChild(logo); - logo.onerror= () => { - if (logoLoadError === true) - return; + this.instanceButtonsContainer = document.createElement('div'); + this.instanceButtonsContainer.id = 'instance-buttons'; + this.instanceButtonsContainer.className = 'instance-buttons'; + this.instanceButtonsContainer.style.display = 'none'; + this.header.appendChild(this.instanceButtonsContainer); - logo.src='UI/img/ml.svg'; - logoLoadError = true; - }; + this.top.appendChild(this.header); - logo.src='img/ml.svg'; + // Build navigation menu container + this.nav = document.getElementById('menu'); + if (!this.nav) { + this.nav = document.createElement('div'); + this.nav.id = 'menu'; + this.nav.className = 'navigation'; + this.top.appendChild(this.nav); + } // hooks - document.getElementById('button-left').onclick = this.showMenu.bind(this); + buttonLeft.onclick = this.showMenu.bind(this); window.onresize = function () { if (this.isTouchDevice === true) @@ -81,45 +117,390 @@ class Menu { } }; - this.api.t.on('Controller', 'all', _notification => { - if (_notification.data && _notification.data.state) - this.render(); + // Listen for state change events on Controller + this.api.t.on('Controller', 'statechange', _notification => { + const callsign = _notification.callsign; + const state = _notification.state || (_notification.params ? _notification.params.state : undefined); + + if (callsign && state) { + // Cache local plugin states for real-time menu updates. + // Use separate cache for each instance to avoid cross-contamination. + const normalizedState = state.charAt(0).toUpperCase() + state.slice(1).toLowerCase(); + + // Only cache local plugins (no prefix) in the local cache + if (!callsign.includes('/')) + this._getInstanceCache(null).set(callsign, normalizedState); + + // Trigger a re-render to update the menu + if (this.renderTimeout) + clearTimeout(this.renderTimeout); + + this.renderTimeout = setTimeout(() => { + this.renderTimeout = null; + this.render(this.currentPlugin); + }, 100); + } + }); + + // Setup listeners for composite controllers + this.setupCompositeControllerListeners(); + + // If we have a restored currentPlugin, show it after a short delay + // (to allow the initial render to complete) + if (this.currentPlugin) { + setTimeout(() => { + if (this.currentPlugin) { + showPlugin(this.currentPlugin); + } + }, 100); + } + } + + setupCompositeControllerListeners() { + // Get the list of plugins to detect composite controllers + // Bypass cache to get fresh data + const _rpc = { + plugin: 'Controller', + method: 'status' + }; + this.api.req(null, _rpc, { skipPrefix: true }).then(plugins => { + const delimiter = '/'; + const compositeControllers = new Set(); + + // Find all composite controllers + plugins.forEach(plugin => { + const callsign = plugin.callsign; + const delimiterIndex = callsign.indexOf(delimiter); + + if (delimiterIndex !== -1) { + // This is a composite plugin (e.g., BridgeLink/Monitor) + const prefix = callsign.substring(0, delimiterIndex); + const compositeController = prefix + delimiter + 'Controller'; + compositeControllers.add(compositeController); + } + }); + + // Subscribe to state changes from each composite controller + compositeControllers.forEach(controllerCallsign => { + if (this.compositeControllerListeners.has(controllerCallsign)) + return; + + // Subscribe to the composite controller's state changes + const listener = this.api.t.on(controllerCallsign, 'statechange', (_notification) => { + const callsign = _notification.callsign; + const state = _notification.state || (_notification.params ? _notification.params.state : undefined); + + if (!callsign || !state) + return; + + // Build full composite callsign and update cache + const delimiter = '/'; + const prefix = controllerCallsign.substring(0, controllerCallsign.lastIndexOf(delimiter)); + const fullCallsign = prefix + delimiter + callsign; + + // Normalize state and update cache + const normalizedState = state.charAt(0).toUpperCase() + state.slice(1).toLowerCase(); + + // Cache in the instance-specific cache + this._getInstanceCache(prefix).set(fullCallsign, normalizedState); + + // Re-render to update plugin states + if (this.renderTimeout) { + clearTimeout(this.renderTimeout); + } + this.renderTimeout = setTimeout(() => { + this.renderTimeout = null; + this.render(this.currentPlugin); + }, 100); + }); + + this.compositeControllerListeners.set(controllerCallsign, listener); + }); }); } + // Get or create a cache for a specific instance + _getInstanceCache(instance) { + if (!this.pluginStateCaches.has(instance)) { + this.pluginStateCaches.set(instance, new Map()); + } + return this.pluginStateCaches.get(instance); + } + clear() { - this.nav.innerHTML = ''; + // Clear only the menu items, not the instance selector + const ul = this.nav.querySelector('ul'); + if (ul) { + ul.remove(); + } + } + + // Get composite plugin instances from a list of plugins + // Returns unique instance names (e.g., ["BridgeLink1", "BridgeLink2"]) + // These are plugins that act as composite controllers (expose their own Controller interface) + _extractInstancesFromPlugins(plugins) { + const instances = []; + + for (const plugin of plugins) { + const callsign = plugin.callsign; + + // Skip plugins with a prefix (they are already under a composite) + if (callsign.includes('/')) { + continue; + } + + // Skip deactivated plugins + if (plugin.state === 'Deactivated') { + continue; + } + + // Check if this plugin exposes composite plugins (has /Controller suffix plugins) + // We detect this by checking if there are any plugins with this callsign as prefix + const hasCompositePlugins = plugins.some(p => + p.callsign.startsWith(callsign + '/') && p.callsign !== callsign + ); + + if (hasCompositePlugins && !instances.includes(callsign)) { + instances.push(callsign); + } + } + + return instances; + } + + getAvailableInstances(plugins) { + // Get composite plugin instances from local plugins + // Note: Only single-level composite plugins are supported (e.g., BridgeLink1, BridgeLink2). + // Nested/chained composites (e.g., BridgeLink1/BridgeLink2) are not supported by Thunder at this point (December 2025) + // To access a chained instance, connect directly to the intermediate Thunder's UI. + const instances = this._extractInstancesFromPlugins(plugins); + + return instances; + } + + // Switch to a different Thunder instance + switchInstance(instance) { + this.selectedInstance = instance; + + // Persist selection to localStorage + if (this.selectedInstance) { + localStorage.setItem('thunderUI_selectedInstance', this.selectedInstance); + } else { + localStorage.removeItem('thunderUI_selectedInstance'); + } + + // Update the API prefix to match the selected instance + this.api.setActivePrefix(this.selectedInstance); + + // No need to clear cache - each instance has its own cache + // If we have a current plugin, try to load the equivalent plugin in the new instance + if (this.currentPlugin) { + const delimiter = '/'; + const currentDelimiterIndex = this.currentPlugin.indexOf(delimiter); + const baseCallsign = currentDelimiterIndex !== -1 ? + this.currentPlugin.substring(currentDelimiterIndex + 1) : + this.currentPlugin; + + // Build the new callsign for the selected instance + let newCallsign; + if (this.selectedInstance === null) { + // Switching to local Thunder + newCallsign = baseCallsign; + } else { + // Switching to a BridgeLink instance + newCallsign = this.selectedInstance + delimiter + baseCallsign; + } + + // Check if the equivalent plugin exists in the new instance - bypass cache + const _rpc = { + plugin: 'Controller', + method: 'status' + }; + this.api.req(null, _rpc, { skipPrefix: true }).then(_plugins => { + const pluginExists = _plugins.some(p => p.callsign === newCallsign && p.state !== 'Deactivated'); + + if (pluginExists) { + // Update current plugin and render with it active + this.currentPlugin = newCallsign; + localStorage.setItem('thunderUI_currentPlugin', newCallsign); + this.render(newCallsign); + showPlugin(newCallsign); + } else { + // Plugin doesn't exist in new instance, just render the menu without selecting anything + console.debug(`Plugin ${newCallsign} not found in selected instance`); + this.currentPlugin = null; + localStorage.removeItem('thunderUI_currentPlugin'); + this.render(); + } + }); + } else { + this.render(); + } + + // Update button highlighting + this.updateInstanceButtonHighlight(); + } + + // Update which instance button is highlighted + updateInstanceButtonHighlight() { + const buttons = this.instanceButtonsContainer.querySelectorAll('.instance-button'); + buttons.forEach(btn => { + const btnInstance = btn.dataset.instance === '' ? null : btn.dataset.instance; + if (btnInstance === this.selectedInstance) { + btn.classList.add('active'); + } else { + btn.classList.remove('active'); + } + }); + } + + // Update the instance buttons in the header + updateInstanceButtons(instances) { + if (instances.length > 0) { + // Show the buttons container + this.instanceButtonsContainer.style.display = 'flex'; + // Clear existing buttons using DOM methods instead of innerHTML + while (this.instanceButtonsContainer.firstChild) { + this.instanceButtonsContainer.removeChild(this.instanceButtonsContainer.firstChild); + } + + // Add "Local" button first + const localBtn = document.createElement('button'); + localBtn.className = 'instance-button' + (this.selectedInstance === null ? ' active' : ''); + localBtn.textContent = 'Local'; + localBtn.dataset.instance = ''; + localBtn.onclick = () => this.switchInstance(null); + this.instanceButtonsContainer.appendChild(localBtn); + + // Add buttons for each instance + instances.forEach(inst => { + const btn = document.createElement('button'); + btn.className = 'instance-button' + (this.selectedInstance === sanitizeForId(inst) ? ' active' : ''); + btn.textContent = sanitizeForDisplay(inst); + btn.dataset.instance = inst; + btn.onclick = () => this.switchInstance(inst); + this.instanceButtonsContainer.appendChild(btn); + }); + } else { + // Hide the buttons if no linked instances + this.instanceButtonsContainer.style.display = 'none'; + } } render(activePlugin) { - this.api.getControllerPlugins().then( _plugins => { + // Determine which controller to query based on selected instance + let statusPromise; + if (this.selectedInstance === null) { + // Query local controller - bypass the cache to get fresh data + const _rpc = { + plugin: 'Controller', + method: 'status' + }; + statusPromise = this.api.req(null, _rpc); + } else { + // Query the composite controller for the selected instance + const delimiter = '/'; + const compositeController = this.selectedInstance + delimiter + 'Controller'; + + // Use skipPrefix since we're querying with an absolute path + statusPromise = this.api.req(null, { + plugin: compositeController, + method: 'status' + }, { skipPrefix: true }).catch(err => { + console.warn('Failed to query composite controller:', compositeController, err); + // Fall back to local controller + this.selectedInstance = null; + localStorage.removeItem('thunderUI_selectedInstance'); + const _rpc = { + plugin: 'Controller', + method: 'status' + }; + return this.api.req(null, _rpc); + }).then((response) => { + if (this.selectedInstance === null) { + return response; + } + const plugins = response.plugins || response; + // Add the instance prefix to each plugin's callsign + return plugins.map(p => ({...p, callsign: this.selectedInstance + '/' + p.callsign})); + }); + } + + statusPromise.then( _plugins => { this.clear(); const enabledPlugins = Object.keys(this.plugins); + + // Detect available instances and update selector - always use local controller + // to discover instances, regardless of which instance is currently selected + // Bypass cache to get fresh data + const _rpc = { + plugin: 'Controller', + method: 'status' + }; + this.api.req(null, _rpc, { skipPrefix: true }).then(localPlugins => { + const availableInstances = this.getAvailableInstances(localPlugins); + this.updateInstanceButtons(availableInstances); + // Set up listeners for composite controllers + this.setupCompositeControllerListeners(); + }); + let ul = document.createElement('ul'); for (let i = 0; i<_plugins.length; i++) { const plugin = _plugins[i]; + const callsign = plugin.callsign; + + // Extract base callsign (remove BridgeLink/ or any other prefix) + const delimiter = '/'; + const lastDelimiterIndex = callsign.lastIndexOf(delimiter); + const baseCallsign = lastDelimiterIndex !== -1 ? callsign.substring(lastDelimiterIndex + 1) : callsign; + const prefix = lastDelimiterIndex !== -1 ? callsign.substring(0, lastDelimiterIndex) : null; + + // Use cached state from the appropriate instance cache if available, + // otherwise fall back to API state. + const instanceCache = this._getInstanceCache(prefix); + const cachedState = instanceCache.get(callsign); + const actualState = cachedState !== undefined ? cachedState : plugin.state; + + // Filter based on selected instance + if (this.selectedInstance === null) { + // Show only local plugins (no prefix) + if (prefix !== null) + continue; + } else { + // Show only plugins from selected instance (prefix should match) + // For nested instances like BridgeLink1/BridgeLink2, we prepended the prefix above + if (prefix !== this.selectedInstance) + continue; + } - // check if plugin is available in our loaded plugins - if (enabledPlugins.indexOf(plugin.callsign) === -1) + // check if plugin is available in our loaded plugins (using base callsign) + if (enabledPlugins.indexOf(baseCallsign) === -1) continue; - const loadedPlugin = this.plugins[ plugin.callsign ]; - if (plugin.state !== 'Deactivated' && loadedPlugin.renderInMenu === true) { - console.debug('Menu :: rendering ' + plugin.callsign); + const loadedPlugin = this.plugins[ baseCallsign ]; + + // Use actualState instead of plugin.state + if (actualState.toLowerCase() !== 'deactivated' && loadedPlugin.renderInMenu === true) { var li = document.createElement('li'); - li.id = "item_" + plugin.callsign; + // Sanitize callsign for use in DOM id to prevent DOM clobbering + li.id = "item_" + sanitizeForId(callsign); if (activePlugin === undefined && i === 0) { li.className = 'menu-item active'; - } else if (activePlugin === plugin.callsign) { + } else if (activePlugin === callsign) { li.className = 'menu-item active'; } else { li.className = 'menu-item'; } - - li.appendChild(document.createTextNode(loadedPlugin.displayName !== undefined ? loadedPlugin.displayName : plugin.callsign)); - li.onclick = this.toggleMenuItem.bind(null, plugin.callsign); + + // Use the display name without prefix since we're already filtering by instance + const displayName = loadedPlugin.displayName !== undefined ? + loadedPlugin.displayName : + baseCallsign; + + li.appendChild(document.createTextNode(sanitizeForDisplay(displayName))); + li.onclick = this.toggleMenuItem.bind(this, callsign); ul.appendChild(li); this.nav.appendChild(ul); } @@ -128,19 +509,24 @@ class Menu { } update() { - // just re-render for now - this.render(); + this.render(this.currentPlugin); } toggleMenuItem(callsign) { + // Store the current plugin + this.currentPlugin = callsign; + + // Persist to localStorage so it survives page reloads + localStorage.setItem('thunderUI_currentPlugin', callsign); + var items = document.getElementsByClassName('menu-item'); for (var i = 0; i < items.length; i++) { - if ('item_' + callsign === items[i].id) { + // Use same sanitization as when setting the id + if ('item_' + sanitizeForId(callsign) === items[i].id) { items[i].className = 'menu-item active'; } else { items[i].className = 'menu-item'; } - } showPlugin(callsign); diff --git a/src/js/plugins/controller.js b/src/js/plugins/controller.js index 1ceaba9..d61d6d0 100644 --- a/src/js/plugins/controller.js +++ b/src/js/plugins/controller.js @@ -34,6 +34,164 @@ class Controller extends Plugin { /** * API */ + // Override activate to use the correct controller for composite plugins + activate(callsign) { + const delimiter = '/'; + const delimiterIndex = callsign.indexOf(delimiter); + + let controllerToUse = 'Controller'; + let callsignParam = callsign; // The callsign to pass as parameter + + if (delimiterIndex !== -1) { + // This is a composite plugin (e.g., BridgeLink/Monitor) + // Use the composite controller (e.g., BridgeLink/Controller) + const prefix = callsign.substring(0, delimiterIndex); + controllerToUse = prefix + delimiter + 'Controller'; + // Strip the prefix from the callsign parameter + callsignParam = callsign.substring(delimiterIndex + 1); + } + + const _rpc = { + plugin: controllerToUse, + method: 'activate', + params: { 'callsign': callsignParam } + }; + + return this.api.req(null, _rpc).then(result => { + if (window.menu) { + if (window.menu.pluginStateCache) { + window.menu.pluginStateCache.set(callsign, 'Activated'); + } + + // Check if this is a composite plugin by probing for its controller + // Only check top-level plugins (no "/" in callsign) + if (delimiterIndex === -1) { + // Wait for the plugin to fully start before probing + setTimeout(() => { + this.isCompositePlugin(callsign).then(isComposite => { + if (isComposite) { + setTimeout(() => window.location.reload(), 500); + } else { + window.menu.update(); + } + }); + }, 1000); + } else { + setTimeout(() => window.menu.update(), 200); + } + } else { + window.menu.update(); + } + return result; + }); + } + + // Override deactivate to use the correct controller for composite plugins + deactivate(callsign) { + const delimiter = '/'; + const delimiterIndex = callsign.indexOf(delimiter); + + let controllerToUse = 'Controller'; + let callsignParam = callsign; // The callsign to pass as parameter + + if (delimiterIndex !== -1) { + // This is a composite plugin (e.g., BridgeLink/Monitor) + // Use the composite controller (e.g., BridgeLink/Controller) + const prefix = callsign.substring(0, delimiterIndex); + controllerToUse = prefix + delimiter + 'Controller'; + // Strip the prefix from the callsign parameter + callsignParam = callsign.substring(delimiterIndex + 1); + } + + // For deactivation, we need to check if it's a composite plugin before deactivating + const checkCompositeFirst = delimiterIndex === -1 ? this.isCompositePlugin(callsign) : Promise.resolve(false); + + return checkCompositeFirst.then(isComposite => { + return this._doDeactivate(controllerToUse, callsignParam, callsign, delimiterIndex, isComposite); + }); + } + + // Internal method to perform the actual deactivation + _doDeactivate(controllerToUse, callsignParam, callsign, delimiterIndex, isComposite) { + const _rpc = { + plugin: controllerToUse, + method: 'deactivate', + params: { 'callsign': callsignParam } + }; + + return this.api.req(null, _rpc).then(result => { + if (window.menu) { + if (window.menu.pluginStateCache) { + window.menu.pluginStateCache.set(callsign, 'Deactivated'); + } + + // For composite plugins, reload the page to properly clean up the instance selector + // Only check top-level plugins (no "/" in callsign) + if (delimiterIndex === -1) { + // isComposite was determined before deactivation + if (isComposite) { + setTimeout(() => window.location.reload(), 500); + } else { + setTimeout(() => window.menu.update(), 200); + } + } else { + setTimeout(() => window.menu.update(), 200); + } + } else { + window.menu.update(); + } + return result; + }); + } + + // Override suspend to use the correct controller for composite plugins + suspend(callsign) { + const delimiter = '/'; + const delimiterIndex = callsign.indexOf(delimiter); + + let controllerToUse = 'Controller'; + let callsignParam = callsign; // The callsign to pass as parameter + + if (delimiterIndex !== -1) { + const prefix = callsign.substring(0, delimiterIndex); + controllerToUse = prefix + delimiter + 'Controller'; + // Strip the prefix from the callsign parameter + callsignParam = callsign.substring(delimiterIndex + 1); + } + + const _rpc = { + plugin: controllerToUse, + method: 'suspend', + params: { 'callsign': callsignParam } + }; + + return this.api.req(null, _rpc); + } + + // Override resume to use the correct controller for composite plugins + resume(callsign) { + const delimiter = '/'; + const delimiterIndex = callsign.indexOf(delimiter); + + let controllerToUse = 'Controller'; + let callsignParam = callsign; // The callsign to pass as parameter + + if (delimiterIndex !== -1) { + const prefix = callsign.substring(0, delimiterIndex); + controllerToUse = prefix + delimiter + 'Controller'; + // Strip the prefix from the callsign parameter + callsignParam = callsign.substring(delimiterIndex + 1); + } + + const _rpc = { + plugin: controllerToUse, + method: 'resume', + params: { 'callsign': callsignParam } + }; + + return this.api.req(null, _rpc); + } + controllerStatus(plugin) { const _rpc = { plugin : 'Controller' @@ -91,32 +249,38 @@ class Controller extends Plugin { toggleActivity(callsign) { var plugin; - // find plugin - for (var i=0; i { - if (this.plugins[ callsign ] !== undefined) - this.plugins[ callsign ].state = 'Activated'; - plugin.state = 'Activated'; + this.render(); }).catch( e => { + console.error('Failed to activate:', e); this.render(); }); } else { - console.debug('Deactivating ' + callsign); this.deactivate(callsign).then( (resp) => { - if (this.plugins[ callsign ] !== undefined) - this.plugins[ callsign ].state = 'Deactivated'; - plugin.state = 'Deactivated'; + this.render(); }).catch(e => { + console.error('Failed to deactivate:', e); this.render(); }); } @@ -125,49 +289,46 @@ class Controller extends Plugin { toggleSuspend(callsign) { var plugin; - // find plugin - for (var i=0; i { - if (this.plugins[ callsign ] !== undefined) - this.plugins[ callsign ].state = 'Activated'; - + plugin.state = 'Activated'; // we have to rerender at this stage, we're going to be out of sync if (document.getElementById(callsign + 'suspend').checked === false) this.resume(callsign).then( this.render.bind(this) ); else - api.suspendPlugin(callsign).then( this.render.bind(this)); + this.suspend(callsign).then( this.render.bind(this)); }); return; } if (plugin.state === 'Resumed') { - console.debug('Suspending ' + callsign); this.suspend(callsign).then( resp => { this.updateSuspendLabel(callsign, 'resume'); - - if (this.plugins[ callsign ] !== undefined) - this.plugins[ callsign ].state = 'Resumed'; - document.getElementById(callsign + 'suspend').checked = true; plugin.state = 'Suspended'; }); } else { - console.debug('Resuming ' + callsign); this.resume(callsign).then( resp => { this.updateSuspendLabel(callsign, 'suspend'); - - if (this.plugins[ callsign ] !== undefined) - this.plugins[ callsign ].state = 'Suspended'; - document.getElementById(callsign + 'suspend').checked = false; plugin.state = 'Resumed'; }); @@ -175,7 +336,9 @@ class Controller extends Plugin { } clear() { - this.mainDiv.innerHTML = ''; + while (this.mainDiv.firstChild) { + this.mainDiv.removeChild(this.mainDiv.firstChild); + } } discover() { @@ -188,11 +351,13 @@ class Controller extends Plugin { self.getDiscovery().then( data => { var discoveryList = data.bridges ? data.bridges : data; var container = document.getElementById('discoveryList'); - container.innerHTML = ''; + while (container.firstChild) { + container.removeChild(container.firstChild); + } for (var i=0; i - Plugins - -
        -
        - Device actions -
        -
        - -
        -
        - -
        -
        - Discover devices -
        -
        - -
        -
        -
          -
          - - `; - - document.getElementById('persistButton').onclick = this.persist.bind(this); - document.getElementById('harakiriButton').onclick = this.harakiri.bind(this); - document.getElementById('discoverButton').onclick = this.discover.bind(this); - var controllerPluginsDiv = document.getElementById('controllerPlugins'); + while (this.mainDiv.firstChild) { + this.mainDiv.removeChild(this.mainDiv.firstChild); + } + + // Build UI using DOM methods instead of innerHTML + var pluginsTitle = document.createElement('div'); + pluginsTitle.className = 'title grid__col grid__col--8-of-8'; + pluginsTitle.textContent = 'Plugins'; + this.mainDiv.appendChild(pluginsTitle); + + var controllerPluginsDiv = document.createElement('div'); + controllerPluginsDiv.id = 'controllerPlugins'; + this.mainDiv.appendChild(controllerPluginsDiv); + + var deviceActionsTitle = document.createElement('div'); + deviceActionsTitle.className = 'title grid__col grid__col--8-of-8'; + deviceActionsTitle.textContent = 'Device actions'; + this.mainDiv.appendChild(deviceActionsTitle); + + var persistDiv = document.createElement('div'); + persistDiv.className = 'text grid__col grid__col--8-of-8'; + var persistButton = document.createElement('button'); + persistButton.type = 'button'; + persistButton.id = 'persistButton'; + persistButton.textContent = 'PERSIST'; + persistDiv.appendChild(persistButton); + this.mainDiv.appendChild(persistDiv); + + var rebootDiv = document.createElement('div'); + rebootDiv.className = 'text grid__col grid__col--8-of-8'; + var harakiriButton = document.createElement('button'); + harakiriButton.type = 'button'; + harakiriButton.id = 'harakiriButton'; + harakiriButton.textContent = 'REBOOT'; + rebootDiv.appendChild(harakiriButton); + this.mainDiv.appendChild(rebootDiv); + + var discoverTitle = document.createElement('div'); + discoverTitle.className = 'title grid__col grid__col--8-of-8'; + discoverTitle.textContent = 'Discover devices'; + this.mainDiv.appendChild(discoverTitle); + + var discoverLabelDiv = document.createElement('div'); + discoverLabelDiv.className = 'label grid__col grid__col--2-of-8'; + var discoverButton = document.createElement('button'); + discoverButton.type = 'button'; + discoverButton.id = 'discoverButton'; + discoverButton.textContent = 'DISCOVER'; + discoverLabelDiv.appendChild(discoverButton); + this.mainDiv.appendChild(discoverLabelDiv); + + var discoverListDiv = document.createElement('div'); + discoverListDiv.className = 'text grid__col grid__col--6-of-8'; + var discoveryList = document.createElement('ul'); + discoveryList.id = 'discoveryList'; + discoverListDiv.appendChild(discoveryList); + this.mainDiv.appendChild(discoverListDiv); + + persistButton.onclick = this.persist.bind(this); + harakiriButton.onclick = this.harakiri.bind(this); + discoverButton.onclick = this.discover.bind(this); + + // Determine if we're viewing a bridged Controller (e.g., BridgeLink/Controller) + const delimiter = '/'; + const delimiterIndex = this.callsign.indexOf(delimiter); + const isCompositController = delimiterIndex !== -1; + const controllerPrefix = isCompositController ? this.callsign.substring(0, delimiterIndex) : null; this.status().then( data => { var plugins = data.plugins ? data.plugins : data; this.plugins = plugins; // store it + + // Create a mapping from display callsign to original plugin + // This is needed because we modify callsigns for composite controllers + this.pluginMap = {}; for (var i=0; i < plugins.length; i++) { var plugin = plugins[i]; var callsign = plugin.callsign; + var originalCallsign = callsign; // Store the original callsign var controlAllowed = true; - if (callsign === 'Controller') + // Extract the prefix and base callsign + const pluginDelimiterIndex = callsign.indexOf(delimiter); + const pluginPrefix = pluginDelimiterIndex !== -1 ? callsign.substring(0, pluginDelimiterIndex) : null; + const baseCallsign = pluginDelimiterIndex !== -1 ? callsign.substring(pluginDelimiterIndex + 1) : callsign; + + // Skip Controller plugin + if (callsign === 'Controller' || baseCallsign === 'Controller') continue; + // Filter based on which Controller we're viewing + if (isCompositController) { + // Viewing a bridged Controller (e.g., BridgeLink/Controller) + // The status call returns plugins from the remote Thunder without the prefix + // So we need to add the prefix to the callsign for operations + // But first, skip any plugins that already have a different prefix + if (pluginPrefix !== null && pluginPrefix !== controllerPrefix) { + continue; + } + + // If the plugin doesn't have a prefix, we need to add it for operations + if (pluginPrefix === null) { + callsign = controllerPrefix + delimiter + originalCallsign; + } + } else { + // Viewing local Controller + // Only show plugins without prefix (local plugins) + if (pluginPrefix !== null) { + continue; + } + } + + // Map the display callsign to the original plugin object + this.pluginMap[callsign] = plugin; + var labelDiv = document.createElement("div"); labelDiv.className = "label grid__col grid__col--2-of-8"; controllerPluginsDiv.appendChild(labelDiv); var label = document.createElement("label"); - label.innerHTML = callsign; + // Display the base callsign without prefix since we're already in context + label.textContent = baseCallsign; label.setAttribute("for", callsign); labelDiv.appendChild(label); @@ -280,6 +519,7 @@ class Controller extends Plugin { checkbox.checked = true; } + // Use the full callsign (with prefix if applicable) for activation/deactivation checkbox.onclick = this.toggleActivity.bind(this, callsign); checkboxDiv.appendChild(checkbox); @@ -305,9 +545,9 @@ class Controller extends Plugin { suspendLabel.setAttribute("for", callsign + "suspend"); suspendLabel.id = callsign + "suspendlabel"; if (plugin.state == "Suspended") { - suspendLabel.innerHTML = "resume"; + suspendLabel.textContent = "resume"; } else { - suspendLabel.innerHTML = "suspend"; + suspendLabel.textContent = "suspend"; } suspend.appendChild(suspendLabel); div.appendChild(suspend); @@ -320,13 +560,25 @@ class Controller extends Plugin { updateSuspendLabel(callsign, nextState) { var suspendLabel = document.getElementById(callsign + 'suspendlabel'); - suspendLabel.innerHTML = nextState; + suspendLabel.textContent = nextState; + } + + // Detect if a plugin is a composite plugin by probing for its controller + isCompositePlugin(callsign) { + const compositeController = callsign + '/Controller'; + return this.api.t.call(compositeController, 'status', {}) + .then(response => { + return true; + }) + .catch(error => { + return false; + }); } close() { if (this.controllerListener && typeof this.controllerListener.dispose === 'function') { - this.controllerListener.dispose(); - this.controllerListener = null; + this.controllerListener.dispose(); + this.controllerListener = null; } } }