/*! grafana - v4.5.1 - 2017-09-19
 * Copyright (c) 2017 Torkel Ödegaard; Licensed Apache-2.0 */

System.register(["lodash","./variable"],function(a,b){"use strict";var c,d,e;b&&b.id;return{setters:[function(a){c=a},function(a){d=a}],execute:function(){e=function(){function a(a,b,c,e){this.model=a,this.timeSrv=b,this.templateSrv=c,this.variableSrv=e,this.defaults={type:"custom",name:"",label:"",hide:0,options:[],current:{},query:"",includeAll:!1,multi:!1,allValue:null},d.assignModelProperties(this,a,this.defaults)}return a.$inject=["model","timeSrv","templateSrv","variableSrv"],a.prototype.setValue=function(a){return this.variableSrv.setOptionAsCurrent(this,a)},a.prototype.getSaveModel=function(){return d.assignModelProperties(this.model,this,this.defaults),this.model},a.prototype.updateOptions=function(){return this.options=c.default.map(this.query.split(/[,]+/),function(a){return{text:a.trim(),value:a.trim()}}),this.includeAll&&this.addAllOption(),this.variableSrv.validateVariableSelectionState(this)},a.prototype.addAllOption=function(){this.options.unshift({text:"All",value:"$__all"})},a.prototype.dependsOn=function(a){return!1},a.prototype.setValueFromUrl=function(a){return this.variableSrv.setOptionFromUrl(this,a)},a.prototype.getValueForUrl=function(){return"All"===this.current.text?"All":this.current.value},a}(),a("CustomVariable",e),d.variableTypes.custom={name:"Custom",ctor:e,description:"Define variable values manually",supportsMulti:!0}}}});