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