!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["grapesjs-plugin-export"]=t():e["grapesjs-plugin-export"]=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";grapesjs.plugins.add("gjs-plugin-export",function(e,t){var n=t||{},i=r(1),o=r(91),a=e.getConfig(),s=a.stylePrefix,u=document.createElement("BUTTON"),h="gjs-export-zip",f={addExportBtn:1,btnLabel:"Export to ZIP",preHtml:'
',postHtml:"",preCss:"",postCss:""};for(var c in f)c in n||(n[c]=f[c]);u.innerHTML=n.btnLabel,u.className=s+"btn-prim",e.Commands.add(h,{run:function(){var t=new i,r=t.folder("css"),a="grapesjs_template_"+Date.now()+".zip";t.file("index.html",n.preHtml+e.getHtml()+n.postHtml),r.file("style.css",n.preCss+e.getCss()+n.postCss),t.generateAsync({type:"blob"}).then(function(e){o.saveAs(e,a)})}}),n.addExportBtn&&e.on("run:export-template",function(){e.Modal.getContentEl().appendChild(u),u.onclick=function(){e.runCommand(h)}})})},function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files={},this.comment=null,this.root="",this.clone=function(){var e=new n;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}n.prototype=r(2),n.prototype.loadAsync=r(82),n.support=r(5),n.defaults=r(53),n.loadAsync=function(e,t){return(new n).loadAsync(e,t)},n.external=r(45),e.exports=n},function(e,t,r){"use strict";function n(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var i=r(3),o=r(4),a=r(50),s=r(51),u=r(53),h=r(54),f=r(59),c=r(60),l=r(42),d=r(81),p=function(e,t,r){var n,i=o.getTypeOf(t);r=o.extend(r||{},u),r.date=r.date||new Date,null!==r.compression&&(r.compression=r.compression.toUpperCase()),"string"==typeof r.unixPermissions&&(r.unixPermissions=parseInt(r.unixPermissions,8)),r.unixPermissions&&16384&r.unixPermissions&&(r.dir=!0),r.dosPermissions&&16&r.dosPermissions&&(r.dir=!0),r.dir&&(e=m(e)),r.createFolders&&(n=g(e))&&_.call(this,n,!0);var s="string"===i&&r.binary===!1&&r.base64===!1;r.binary=!s;var c=t instanceof h&&0===t.uncompressedSize;(c||r.dir||!t||0===t.length)&&(r.base64=!1,r.binary=!0,t="",r.compression="STORE",i="string");var p=null;p=t instanceof h||t instanceof a?t:l.isNode&&l.isStream(t)?new d(e,t):o.prepareContent(e,t,r.binary,r.optimizedBinaryString,r.base64);var v=new f(e,p,r);this.files[e]=v},g=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},_=function(e,t){return t="undefined"!=typeof t?t:u.createFolders,e=m(e),this.files[e]||p.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]},v={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,n;for(t in this.files)this.files.hasOwnProperty(t)&&(n=this.files[t],r=t.slice(this.root.length,t.length),r&&t.slice(0,this.root.length)===this.root&&e(r,n))},filter:function(e){var t=[];return this.forEach(function(r,n){e(r,n)&&t.push(n)}),t},file:function(e,t,r){if(1===arguments.length){if(n(e)){var i=e;return this.filter(function(e,t){return!t.dir&&i.test(e)})}var o=this.files[this.root+e];return o&&!o.dir?o:null}return e=this.root+e,p.call(this,e,t,r),this},folder:function(e){if(!e)return this;if(n(e))return this.filter(function(t,r){return r.dir&&e.test(t)});var t=this.root+e,r=_.call(this,t),i=this.clone();return i.root=r.name,i},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var r=this.filter(function(t,r){return r.name.slice(0,e.length)===e}),n=0;n