var i,t;i=this,t=function(i){return function(i){var t={axisTitle:"",axisClass:"ct-axis-title",offset:{x:0,y:0},textAnchor:"middle",flipTitle:!1},s={axisX:t,axisY:t},getTitle=function(i){return i instanceof Function?i():i},getClasses=function(i){return i instanceof Function?i():i};i.plugins=i.plugins||{},i.plugins.ctAxisTitle=function(t){return t=i.extend({},s,t),function ctAxisTitle(s){s.on("created",(function(s){if(!t.axisX.axisTitle&&!t.axisY.axisTitle)throw new Error("ctAxisTitle plugin - You must provide at least one axis title");if(!s.axisX&&!s.axisY)throw new Error("ctAxisTitle plugin can only be used on charts that have at least one axis");var a,e,n,o=i.normalizePadding(s.options.chartPadding);if(t.axisX.axisTitle&&s.axisX&&(a=s.axisX.axisLength/2+s.options.axisY.offset+o.left,e=o.top,"end"===s.options.axisY.position&&(a-=s.options.axisY.offset),"end"===s.options.axisX.position&&(e+=s.axisY.axisLength),(n=new i.Svg("text")).addClass(getClasses(t.axisX.axisClass)),n.text(getTitle(t.axisX.axisTitle)),n.attr({x:a+t.axisX.offset.x,y:e+t.axisX.offset.y,"text-anchor":t.axisX.textAnchor}),s.svg.append(n,!0)),t.axisY.axisTitle&&s.axisY){a=0,e=s.axisY.axisLength/2+o.top,"start"===s.options.axisX.position&&(e+=s.options.axisX.offset),"end"===s.options.axisY.position&&(a=s.axisX.axisLength);var x="rotate("+(t.axisY.flipTitle?-90:90)+", "+a+", "+e+")";(n=new i.Svg("text")).addClass(getClasses(t.axisY.axisClass)),n.text(getTitle(t.axisY.axisTitle)),n.attr({x:a+t.axisY.offset.x,y:e+t.axisY.offset.y,transform:x,"text-anchor":t.axisY.textAnchor}),s.svg.append(n,!0)}}))}}}(i),i.plugins.ctAxisTitle},"function"==typeof define&&define.amd?define(["chartist"],(function(s){return i.returnExportsGlobal=t(s)})):"object"==typeof exports?module.exports=t(require("chartist")):i["Chartist.plugins.ctAxisTitle"]=t(Chartist);