define(["@grafana/data","react","@grafana/ui","@grafana/runtime","@emotion/css","rxjs"],(e,n,t,r,a,o)=>(()=>{"use strict";var i={1269:e=>{e.exports=o},2007:e=>{e.exports=t},5959:e=>{e.exports=n},6089:e=>{e.exports=a},7781:n=>{n.exports=e},8531:e=>{e.exports=r}},l={};function c(e){var n=l[e];if(void 0!==n)return n.exports;var t=l[e]={exports:{}};return i[e](t,t.exports,c),t.exports}c.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return c.d(n,{a:n}),n},c.d=(e,n)=>{for(var t in n)c.o(n,t)&&!c.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},c.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};c.r(s),c.d(s,{plugin:()=>j});var u=c(7781),d=c(5959),p=c.n(d);class g extends d.PureComponent{render(){return d.createElement("div",{className:"page-container"},"OpenNMS Plugin for Grafana")}}var m=c(2007),f=c(8531),v=c(6089),y=c(1269);function b(e,n,t,r,a,o,i){try{var l=e[o](i),c=l.value}catch(e){return void t(e)}l.done?n(c):Promise.resolve(c).then(r,a)}function h(e){return function(){var n=this,t=arguments;return new Promise(function(r,a){var o=e.apply(n,t);function i(e){b(o,r,a,i,l,"next",e)}function l(e){b(o,r,a,i,l,"throw",e)}i(void 0)})}}const x=e=>({colorWeak:v.css`
    color: ${e.colors.text.secondary};
  `,marginTop:v.css`
    margin-top: ${e.spacing(3)};
  `}),E=(P=h(function*(e,n){try{yield S(e,n),window.location.reload()}catch(e){console.error("Error while updating the plugin",e)}}),function(e,n){return P.apply(this,arguments)});var P;const S=function(){var e=h(function*(e,n){const t=(0,f.getBackendSrv)().fetch({url:`/api/plugins/${e}/settings`,method:"POST",data:n});return(0,y.lastValueFrom)(t)});return function(n,t){return e.apply(this,arguments)}}(),j=(new u.AppPlugin).setRootPage(g).addConfigPage({title:"Configuration",icon:"cog",body:({plugin:e})=>{const n=(0,m.useStyles2)(x),{enabled:t,jsonData:r}=e.meta;return p().createElement("div",{className:"gf-form-group"},p().createElement("div",null,p().createElement(m.Legend,null,"Enable / Disable"),!t&&p().createElement(p().Fragment,null,p().createElement("div",{className:n.colorWeak},"The plugin is currently not enabled."),p().createElement(m.Button,{className:n.marginTop,variant:"primary",onClick:()=>E(e.meta.id,{enabled:!0,pinned:!0,jsonData:r})},"Enable plugin")),t&&p().createElement(p().Fragment,null,p().createElement("div",{className:n.colorWeak},"The plugin is currently enabled."),p().createElement(m.Button,{className:n.marginTop,variant:"destructive",onClick:()=>E(e.meta.id,{enabled:!1,pinned:!1,jsonData:r})},"Disable plugin"))))},id:"configuration"});return s})());
//# sourceMappingURL=module.js.map