text: !function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.vueCockpit=n():t.vueCockpit=n()}(this,function(){return function(t){function n(e){if(i[e])return i[e].exports;var o=i[e]={exports:{},id:e,loaded:!1};return t[e].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var i={};return n.m=t,n.c=i,n.p="",n(0)}([function(t,n){var i=function(t,n,i){var e={cockpitUrl:t,apiKey:n,selector:i,basePath:location.pathname.slice(0,-1),collections:{},regions:{}},o=document.cookie.length>0,c=window.location.search.indexOf("hint")>=0,r=c?"Hide hints":"Show hints";if(o&&$("body").append('<button id="toggleSegmentHints" class="" style="position: fixed; top: 0; right: 0; background-color: #000; color: #fff; border: 0; font-size: 14px; padding: 10px 15px;">'+r+"</button>"),$("#toggleSegmentHints").click(function(){c?window.location.href=window.location.href.replace("?hints",""):window.location.href=window.location.href+"?hints"}),c>0){var s=function(t,n,i,e){0==t.parents(".has-binding").length&&(t.css("outline","1px dashed red").css("cursor","pointer"),t.attr("entity-type",n),t.attr("entity-name",i),t.attr("title",n+" > "+i+(e&&e.indexOf(" ")==-1?" > "+e:"")),t.addClass("has-binding"))};$(':not(:has(div)):contains("{{")').each(function(){var t=$(this),n=t.text();if(n.indexOf("regions.")>0||n.indexOf("collections.")>0){var i=n.replace("{{","").replace("}}","").split("."),e=i[0],o=i[1],c=i[2];s(t,e,o,c)}}),$("[v-for]").each(function(){var t=$(this),n=t.attr("v-for"),i=n.indexOf(" in ")>0?"in":"of",e=n.split(" "+i+" ")[1].split(".")[0],o=n.split(".")[1],c=n.split(".")[2];s(t,e,o,c)}),$("[v-html]").each(function(){var t=$(this),n=t.attr("v-html"),i=n.split("."),e=i[0],o=i[1],c=i[2];s(t,e,o,c)}),$("[v-bind\\:href]").each(function(){var t=$(this),n=t.attr("v-bind:href"),i=n.split("."),e="regions",o=i[1],c=i[2];s(t,e,o,c)}),$("[v-bind\\:src]").each(function(){var t=$(this),n=t.attr("v-bind:src"),i=n.split("."),e="regions",o=i[1],c=i[2];s(t,e,o,c)}),$("body").on("click",".has-binding",function(t){var n=$(this),i=n.attr("entity-type"),o=n.attr("entity-name"),c="regions"==i?"form":"entries",r=e.cockpitUrl+"/"+i+"/"+c+"/"+o;window.open(r)})}fetch(e.cockpitUrl+"/api/collections/listCollections?token="+e.apiKey).then(function(t){return t.json()}).then(function(t){e.collectionNames=t,t.forEach(function(t){e.collections[t]=[]}),fetch(e.cockpitUrl+"/api/regions/listRegions?token="+e.apiKey).then(function(t){return t.json()}).then(function(t){e.regionNames=t,t.forEach(function(t){e.regions[t]=[]}),new Vue({el:e.selector,data:e,created:function(){this.fetchAllCollectionEntries(),this.fetchAllRegionEntries()},methods:{fetchAllRegionEntries:function(){var t=this;this.regionNames.forEach(function(n){t.fetchRegionEntries(n)})},fetchRegionEntries:function(t){var n=this;fetch(e.cockpitUrl+"/api/regions/data/"+t+"?token="+this.apiKey).then(function(t){return t.json()}).then(function(i){n.regions[t]=i})["catch"](function(t){console.log("parsing failed",t)})},fetchAllCollectionEntries:function(){var t=this;this.collectionNames.forEach(function(n){t.fetchCollectionEntries(n)})},fetchCollectionEntries:function(t){var n=this;fetch(e.cockpitUrl+"/api/collections/get/"+t+"?token="+this.apiKey).then(function(t){return t.json()}).then(function(i){n.collections[t]=i.entries})["catch"](function(t){console.log("parsing failed",t)})}}})})})["catch"](function(t){console.log("parsing failed",t)})};t.exports={init:i}}])});
  //# sourceMappingURL=vue-cockpit.min.js.map