/*! grafana - v3.0.4 - 2016-06-01
 * Copyright (c) 2016 Torkel Ödegaard; Licensed Apache-2.0 */

define(["../core_module","app/core/utils/kbn"],function(a,b){"use strict";a["default"].directive("dashUpload",["timer","alertSrv","$location",function(a,c,d){return{restrict:"A",link:function(a){function e(c){for(var e,f=c.target.files,g=function(){return function(c){a.$apply(function(){try{window.grafanaImportDashboard=JSON.parse(c.target.result)}catch(e){return console.log(e),void a.appEvent("alert-error",["Import failed","JSON -> JS Serialization failed: "+e.message])}var f=b.slugifyForUrl(window.grafanaImportDashboard.title);window.grafanaImportDashboard.id=null,d.path("/dashboard-import/"+f)})}},h=0;e=f[h];h++){var i=new FileReader;i.onload=g(e),i.readAsText(e)}}window.File&&window.FileReader&&window.FileList&&window.Blob?document.getElementById("dashupload").addEventListener("change",e,!1):c.set("Oops","Sorry, the HTML5 File APIs are not fully supported in this browser.","error")}}}])});