text: /*! grapesjs-component-countdown - 0.1.4 */
  !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("grapesjs")):"function"==typeof define&&define.amd?define(["grapesjs"],t):"object"==typeof exports?exports["grapesjs-component-countdown"]=t(require("grapesjs")):e["grapesjs-component-countdown"]=t(e.grapesjs)}(this,function(e){return function(e){function t(o){if(n[o])return n[o].exports;var a=n[o]={i:o,l:!1,exports:{}};return e[o].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.countdownRef="countdown"},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),s=o(a),d=n(3),l=o(d),i=n(4),r=o(i),c=n(0);t.default=s.default.plugins.add("gjs-component-countdown",function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t,o={blocks:[c.countdownRef],defaultStyle:!0,startTime:"",endText:"EXPIRED",dateInputType:"date",countdownClsPfx:"countdown",labelCountdown:"Countdown",labelCountdownCategory:"Extra",labelDays:"days",labelHours:"hours",labelMinutes:"minutes",labelSeconds:"seconds"};for(var a in o)a in n||(n[a]=o[a]);(0,l.default)(e,n),(0,r.default)(e,n)})},function(t,n){t.exports=e},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e};t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t,a=e.DomComponents,s=a.getType("default"),d=a.getType("text"),l=s.model,i=s.view,r=(d.model,d.view,n.countdownClsPfx);a.addType("countdown",{model:l.extend({defaults:o({},l.prototype.defaults,{startfrom:n.startTime,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 20c4.42 0 8-3.58 8-8s-3.58-8-8-8-8 3.58-8 8 3.58 8 8 8m0-18c5.52 0 10 4.48 10 10s-4.48 10-10 10C6.47 22 2 17.5 2 12 2 6.48 6.48 2 12 2m.5 5v5.25l4.5 2.67-.75 1.23L11 13V7h1.5z"></path></svg>',endText:n.endText,droppable:!1,traits:[{label:"Start",name:"startfrom",changeProp:1,type:n.dateInputType},{label:"End text",name:"endText",changeProp:1}],script:function(){var e=new Date("{[ startfrom ]}").getTime(),t=this.querySelector("[data-js=countdown]"),n=this.querySelector("[data-js=countdown-endtext]"),o=this.querySelector("[data-js=countdown-day]"),a=this.querySelector("[data-js=countdown-hour]"),s=this.querySelector("[data-js=countdown-minute]"),d=this.querySelector("[data-js=countdown-second]"),l=this.gjs_countdown_interval;l&&l&&clearInterval(l);var i=function(e,t,n,l){o.innerHTML=e<10?"0"+e:e,a.innerHTML=t<10?"0"+t:t,s.innerHTML=n<10?"0"+n:n,d.innerHTML=l<10?"0"+l:l},r=function(){var o=(new Date).getTime(),a=e-o,s=Math.floor(a/864e5),d=Math.floor(a%864e5/36e5),l=Math.floor(a%36e5/6e4),r=Math.floor(a%6e4/1e3);i(s,d,l,r),a<0&&(clearInterval(c),n.innerHTML="{[ endText ]}",t.style.display="none",n.style.display="")};if(e){var c=setInterval(r,1e3);this.gjs_countdown_interval=c,n.style.display="none",t.style.display="",r()}else i(0,0,0,0)}})},{isComponent:function(e){if(e.getAttribute&&"countdown"==e.getAttribute("data-gjs-type"))return{type:"countdown"}}}),view:i.extend({init:function(){this.listenTo(this.model,"change:startfrom change:endText",this.updateScript);var e=this.model.get("components");e.length||(e.reset(),e.add('\n            <span data-js="countdown" data-gjs-type="span" class="'+r+'-cont">\n              <div class="'+r+'-block" data-gjs-type="box">\n                <div data-js="countdown-day"  data-gjs-type="box" class="'+r+'-digit"></div>\n                <div class="'+r+'-label" >'+n.labelDays+'</div>\n              </div>\n              <div class="'+r+'-block" data-gjs-type="box">\n                <div data-js="countdown-hour" data-gjs-type="box" class="'+r+'-digit"></div>\n                <div class="'+r+'-label">'+n.labelHours+'</div>\n              </div>\n              <div class="'+r+'-block" data-gjs-type="box">\n                <div data-js="countdown-minute" data-gjs-type="box" class="'+r+'-digit"></div>\n                <div class="'+r+'-label">'+n.labelMinutes+'</div>\n              </div>\n              <div class="'+r+'-block" data-gjs-type="box">\n                <div data-js="countdown-second" data-gjs-type="box" class="'+r+'-digit"></div>\n                <div class="'+r+'-label">'+n.labelSeconds+'</div>\n              </div>\n            </span>\n            <span data-js="countdown-endtext" class="'+r+'-endtext"></span>\n          '))}})})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t,a=e.BlockManager,s=n.countdownClsPfx,d=n.defaultStyle?"<style>\n    ."+s+" {\n      text-align: center;\n      font-family: Helvetica, serif;\n    }\n\n    ."+s+"-block {\n      display: inline-block;\n      margin: 0 10px;\n      padding: 10px;\n    }\n\n    ."+s+"-digit {\n      font-size: 5rem;\n    }\n\n    ."+s+"-endtext {\n      font-size: 5rem;\n    }\n\n    ."+s+"-cont,\n    ."+s+"-block {\n      display: inline-block;\n    }\n  </style>":"";n.blocks.indexOf(o.countdownRef)>=0&&a.add(o.countdownRef,{label:n.labelCountdown,category:n.labelCountdownCategory,attributes:{class:"fa fa-clock-o"},content:'\n        <div class="'+s+'" data-gjs-type="countdown"></div>\n        '+d+"\n      "})};var o=n(0)}])});