tupali/librerias/gantt/code/modules/offline-exporting.js
2020-05-23 15:45:54 -05:00

24 lines
7.1 KiB
JavaScript

/*
Highcharts JS v8.1.0 (2020-05-05)
Client side exporting module
(c) 2015-2019 Torstein Honsi / Oystein Moseng
License: www.highcharts.com/license
*/
(function(a){"object"===typeof module&&module.exports?(a["default"]=a,module.exports=a):"function"===typeof define&&define.amd?define("highcharts/modules/offline-exporting",["highcharts","highcharts/modules/exporting"],function(f){a(f);a.Highcharts=f;return a}):a("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(a){function f(b,d,a,x){b.hasOwnProperty(d)||(b[d]=x.apply(null,a))}a=a?a._modules:{};f(a,"mixins/download-url.js",[a["parts/Globals.js"]],function(b){var d=b.win,a=d.navigator,
x=d.document,f=d.URL||d.webkitURL||d,g=/Edge\/\d+/.test(a.userAgent);b.dataURLtoBlob=function(b){if((b=b.match(/data:([^;]*)(;base64)?,([0-9A-Za-z+/]+)/))&&3<b.length&&d.atob&&d.ArrayBuffer&&d.Uint8Array&&d.Blob&&f.createObjectURL){var a=d.atob(b[3]),e=new d.ArrayBuffer(a.length);e=new d.Uint8Array(e);for(var g=0;g<e.length;++g)e[g]=a.charCodeAt(g);b=new d.Blob([e],{type:b[1]});return f.createObjectURL(b)}};b.downloadURL=function(e,f){var l=x.createElement("a");if("string"===typeof e||e instanceof
String||!a.msSaveOrOpenBlob){if(g||2E6<e.length)if(e=b.dataURLtoBlob(e),!e)throw Error("Failed to convert to blob");if("undefined"!==typeof l.download)l.href=e,l.download=f,x.body.appendChild(l),l.click(),x.body.removeChild(l);else try{var p=d.open(e,"chart");if("undefined"===typeof p||null===p)throw Error("Failed to open window");}catch(A){d.location.href=e}}else a.msSaveOrOpenBlob(e,f)}});f(a,"modules/offline-exporting.src.js",[a["parts/Globals.js"],a["parts/Utilities.js"]],function(b,a){function d(a,
d){var k=y.getElementsByTagName("head")[0],c=y.createElement("script");c.type="text/javascript";c.src=a;c.onload=d;c.onerror=function(){b.error("Error loading script "+a)};k.appendChild(c)}var f=a.extend,D=b.addEvent;a=b.merge;var g=b.win,e=g.navigator,y=g.document,l=g.URL||g.webkitURL||g,p=/Edge\/|Trident\/|MSIE /.test(e.userAgent),A=p?150:0;b.CanVGRenderer={};b.svgToDataUrl=function(b){var a=-1<e.userAgent.indexOf("WebKit")&&0>e.userAgent.indexOf("Chrome");try{if(!a&&0>e.userAgent.toLowerCase().indexOf("firefox"))return l.createObjectURL(new g.Blob([b],
{type:"image/svg+xml;charset-utf-16"}))}catch(k){}return"data:image/svg+xml;charset=UTF-8,"+encodeURIComponent(b)};b.imageToDataUrl=function(b,a,k,c,d,e,f,n,m){var h=new g.Image,u=function(){setTimeout(function(){var e=y.createElement("canvas"),g=e.getContext&&e.getContext("2d");try{if(g){e.height=h.height*c;e.width=h.width*c;g.drawImage(h,0,0,e.width,e.height);try{var w=e.toDataURL(a);d(w,a,k,c)}catch(B){t(b,a,k,c)}}else f(b,a,k,c)}finally{m&&m(b,a,k,c)}},A)},q=function(){n(b,a,k,c);m&&m(b,a,k,c)};
var t=function(){h=new g.Image;t=e;h.crossOrigin="Anonymous";h.onload=u;h.onerror=q;h.src=b};h.onload=u;h.onerror=q;h.src=b};b.downloadSVGLocal=function(a,f,k,c){function t(a,b){b=new g.jsPDF("l","pt",[a.width.baseVal.value+2*b,a.height.baseVal.value+2*b]);[].forEach.call(a.querySelectorAll('*[visibility="hidden"]'),function(b){b.parentNode.removeChild(b)});g.svg2pdf(a,b,{removeInvalid:!0});return b.output("datauristring")}function u(){m.innerHTML=a;var e=m.getElementsByTagName("text"),d;[].forEach.call(e,
function(b){["font-family","font-size"].forEach(function(a){for(var c=b;c&&c!==m;){if(c.style[a]){b.style[a]=c.style[a];break}c=c.parentNode}});b.style["font-family"]=b.style["font-family"]&&b.style["font-family"].split(" ").splice(-1);d=b.getElementsByTagName("title");[].forEach.call(d,function(a){b.removeChild(a)})});e=t(m.firstChild,0);try{b.downloadURL(e,z),c&&c()}catch(E){k(E)}}var q=!0,n=f.libURL||b.getOptions().exporting.libURL,m=y.createElement("div"),h=f.type||"image/png",z=(f.filename||
"chart")+"."+("image/svg+xml"===h?"svg":h.split("/")[1]),p=f.scale||1;n="/"!==n.slice(-1)?n+"/":n;if("image/svg+xml"===h)try{if("undefined"!==typeof e.msSaveOrOpenBlob){var C=new MSBlobBuilder;C.append(a);var r=C.getBlob("image/svg+xml")}else r=b.svgToDataUrl(a);b.downloadURL(r,z);c&&c()}catch(w){k(w)}else if("application/pdf"===h)g.jsPDF&&g.svg2pdf?u():(q=!0,d(n+"jspdf.js",function(){d(n+"svg2pdf.js",function(){u()})}));else{r=b.svgToDataUrl(a);var v=function(){try{l.revokeObjectURL(r)}catch(w){}};
b.imageToDataUrl(r,h,{},p,function(a){try{b.downloadURL(a,z),c&&c()}catch(B){k(B)}},function(){var f=y.createElement("canvas"),u=f.getContext("2d"),t=a.match(/^<svg[^>]*width\s*=\s*"?(\d+)"?[^>]*>/)[1]*p,m=a.match(/^<svg[^>]*height\s*=\s*"?(\d+)"?[^>]*>/)[1]*p,l=function(){u.drawSvg(a,0,0,t,m);try{b.downloadURL(e.msSaveOrOpenBlob?f.msToBlob():f.toDataURL(h),z),c&&c()}catch(F){k(F)}finally{v()}};f.width=t;f.height=m;g.canvg?l():(q=!0,d(n+"rgbcolor.js",function(){d(n+"canvg.js",function(){l()})}))},
k,k,function(){q&&v()})}};b.Chart.prototype.getSVGForLocalExport=function(a,e,d,c){var f=this,k=0,g,n,m,h,l=function(){k===q.length&&c(f.sanitizeSVG(g.innerHTML,n))},p=function(b,a,c){++k;c.imageElement.setAttributeNS("http://www.w3.org/1999/xlink","href",b);l()};f.unbindGetSVG=D(f,"getSVG",function(b){n=b.chartCopy.options;g=b.chartCopy.container.cloneNode(!0)});f.getSVGForExport(a,e);var q=g.getElementsByTagName("image");try{if(!q.length){c(f.sanitizeSVG(g.innerHTML,n));return}var r=0;for(m=q.length;r<
m;++r){var v=q[r];(h=v.getAttributeNS("http://www.w3.org/1999/xlink","href"))?b.imageToDataUrl(h,"image/png",{imageElement:v},a.scale,p,d,d,d):(++k,v.parentNode.removeChild(v),l())}}catch(w){d(w)}f.unbindGetSVG()};b.Chart.prototype.exportChartLocal=function(a,e){var d=this,c=b.merge(d.options.exporting,a),g=function(a){!1===c.fallbackToExportServer?c.error?c.error(c,a):b.error(28,!0):d.exportChart(c)};a=function(){return[].some.call(d.container.getElementsByTagName("image"),function(a){a=a.getAttribute("href");
return""!==a&&0!==a.indexOf("data:")})};p&&d.styledMode&&(b.SVGRenderer.prototype.inlineWhitelist=[/^blockSize/,/^border/,/^caretColor/,/^color/,/^columnRule/,/^columnRuleColor/,/^cssFloat/,/^cursor/,/^fill$/,/^fillOpacity/,/^font/,/^inlineSize/,/^length/,/^lineHeight/,/^opacity/,/^outline/,/^parentRule/,/^rx$/,/^ry$/,/^stroke/,/^textAlign/,/^textAnchor/,/^textDecoration/,/^transform/,/^vectorEffect/,/^visibility/,/^x$/,/^y$/]);p&&("application/pdf"===c.type||d.container.getElementsByTagName("image").length&&
"image/svg+xml"!==c.type)||"application/pdf"===c.type&&a()?g("Image type not supported for this chart/browser."):d.getSVGForLocalExport(c,e,g,function(a){-1<a.indexOf("<foreignObject")&&"image/svg+xml"!==c.type?g("Image type not supportedfor charts with embedded HTML"):b.downloadSVGLocal(a,f({filename:d.getFilename()},c),g)})};a(!0,b.getOptions().exporting,{libURL:"https://code.highcharts.com/8.1.0/lib/",menuItemDefinitions:{downloadPNG:{textKey:"downloadPNG",onclick:function(){this.exportChartLocal()}},
downloadJPEG:{textKey:"downloadJPEG",onclick:function(){this.exportChartLocal({type:"image/jpeg"})}},downloadSVG:{textKey:"downloadSVG",onclick:function(){this.exportChartLocal({type:"image/svg+xml"})}},downloadPDF:{textKey:"downloadPDF",onclick:function(){this.exportChartLocal({type:"application/pdf"})}}}})});f(a,"masters/modules/offline-exporting.src.js",[],function(){})});
//# sourceMappingURL=offline-exporting.js.map