/* Web Font Loader v1.5.3 - (c) Adobe Systems, Google. License: Apache 2.0 jQuery | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license jQuery UI http://jqueryui.com Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.sortable.js, jquery.ui.slider.js, jquery.ui.tabs.js Copyright 2013 jQuery Foundation and other contributors Licensed MIT hoverIntent http://cherne.net/brian/resources/jquery.hoverIntent.html You may use hoverIntent under the terms of the MIT license. Copyright 2007, 2013 Brian Cherne CryptoJS (c) 2009-2013 by Jeff Mott. All rights reserved. code.google.com/p/crypto-js/wiki/License jDataView by Vjeux A unique way to read a binary file in the browser http://github.com/vjeux/jDataView jQuery Hotkeys Plugin Copyright 2010, John Resig Dual licensed under the MIT or GPL Version 2 licenses. tipsy, facebook style tooltips for jquery (c) 2008-2010 jason frame [jason@onehackoranother.com] released under the MIT license Superfish Copyright (c) 2013 Joel Birch Dual licensed under the MIT and GPL licenses: http://www.opensource.org/licenses/mit-license.php http://www.gnu.org/licenses/gpl.html */ (function(b,j){function c(e){return function(){return this[e]}}function a(e,a){var b=e.split("."),c=Y;!(b[0]in c)&&c.execScript&&c.execScript("var "+b[0]);for(var f;b.length&&(f=b.shift());)!b.length&&void 0!==a?c[f]=a:c=c[f]?c[f]:c[f]={}}function h(e,a,b){return e.call.apply(e.bind,arguments)}function f(e,a,b){if(!e)throw Error();if(2h.d||536==h.d&&11>h.o,"iPhone"==b||"iPad"==b||"iPod"==b||"Macintosh"==b))}function G(e,a,b){return(e=e.match(a))&&e[b]?e[b]:""}function O(e){if(e.documentMode)return e.documentMode}function Z(e){this.ua=e||"-"}function J(e,a){this.K=e;this.V=4;this.L="n";var b=(a||"n4").match(/^([nio])([1-9])$/i);b&&(this.L=b[1],this.V=parseInt(b[2],10))}function P(e){return e.L+e.V}function ma(e){var a= 4,b="n",c=E;e&&((c=e.match(/(normal|oblique|italic)/i))&&c[1]&&(b=c[1].substr(0,1).toLowerCase()),(c=e.match(/([1-9]00|normal|bold)/i))&&c[1]&&(/bold/i.test(c[1])?a=7:/[1-9]00/.test(c[1])&&(a=parseInt(c[1].substr(0,1),10))));return b+a}function U(e,a,b){this.c=e;this.m=a;this.O=b;this.h="wf";this.g=new Z("-")}function $(e){var a=s(e.m,e.g.f(e.h,"active")),b=[],c=[e.g.f(e.h,"loading")];a||b.push(e.g.f(e.h,"inactive"));l(e.m,b,c);v(e,"inactive")}function v(e,a,b){if(e.O[a])if(b)e.O[a](b.getName(),P(b)); else e.O[a]()}function x(){this.w={}}function w(e,a){this.c=e;this.C=a;this.s=this.c.createElement("span",{"aria-hidden":"true"},this.C)}function u(e,a){var b;b=[];for(var c=a.K.split(/,\s*/),f=0;f=e.T?e.j.U&&va(e,a,b)&&(e.Z===E||e.Z.hasOwnProperty(e.q.getName()))?W(e,e.W):W(e,e.sa):setTimeout(g(function(){Ra(this)},e),25):W(e,e.W)}function W(e,a){e.A.remove();e.B.remove();a(e.q)}function B(a,b,c,f){this.c=b;this.t=c;this.P=0;this.ba=this.Y=e;this.T=f;this.j=a.j}function ab(e,a,b,c,f){if(0===a.length&&f)$(e.t);else{e.P+=a.length;f&&(e.Y=f);for(f=0;fb;b++)delete f[n[b]];if(!(a?g:e.isEmptyObject)(f))return}(a||(delete j[m].data,g(j[m])))&&(h?e.cleanData([d],!0):e.support.deleteExpando|| j!=j.window?delete j[m]:j[m]=null)}}}function f(d,n,a){if(a===j&&1===d.nodeType){var b="data-"+n.replace(Ic,"-$1").toLowerCase();if(a=d.getAttribute(b),"string"==typeof a){try{a="true"===a?!0:"false"===a?!1:"null"===a?null:+a+""===a?+a:Jc.test(a)?e.parseJSON(a):a}catch(c){}e.data(d,n,a)}else a=j}return a}function g(d){for(var n in d)if(("data"!==n||!e.isEmptyObject(d[n]))&&"toJSON"!==n)return!1;return!0}function m(){return!0}function k(){return!1}function l(d,n){do d=d[n];while(d&&1!==d.nodeType); return d}function s(d,n,a){if(n=n||0,e.isFunction(n))return e.grep(d,function(d,e){return!!n.call(d,e,d)===a});if(n.nodeType)return e.grep(d,function(d){return d===n===a});if("string"==typeof n){var b=e.grep(d,function(d){return 1===d.nodeType});if(Kc.test(n))return e.filter(n,b,!a);n=e.filter(n,b)}return e.grep(d,function(d){return 0<=e.inArray(d,n)===a})}function p(d){var n=bc.split("|");d=d.createDocumentFragment();if(d.createElement)for(;n.length;)d.createElement(n.pop());return d}function t(d){var n= d.getAttributeNode("type");return d.type=(n&&n.specified)+"/"+d.type,d}function r(d){var n=Lc.exec(d.type);return n?d.type=n[1]:d.removeAttribute("type"),d}function C(d,n){for(var a,b=0;null!=(a=d[b]);b++)e._data(a,"globalEval",!n||e._data(n[b],"globalEval"))}function q(d,n){if(1===n.nodeType&&e.hasData(d)){var a,b,c;b=e._data(d);var f=e._data(n,b),g=b.events;if(g)for(a in delete f.handle,f.events={},g){b=0;for(c=g[a].length;c>b;b++)e.event.add(n,a,g[a][b])}f.data&&(f.data=e.extend({},f.data))}}function y(d, n){var a,b,c=0,f=typeof d.getElementsByTagName!==W?d.getElementsByTagName(n||"*"):typeof d.querySelectorAll!==W?d.querySelectorAll(n||"*"):j;if(!f){f=[];for(a=d.childNodes||d;null!=(b=a[c]);c++)!n||e.nodeName(b,n)?f.push(b):e.merge(f,y(b,n))}return n===j||n&&e.nodeName(d,n)?e.merge([d],f):f}function z(d){Ab.test(d.type)&&(d.defaultChecked=d.checked)}function A(d,n){if(n in d)return n;for(var e=n.charAt(0).toUpperCase()+n.slice(1),a=n,b=cc.length;b--;)if(n=cc[b]+e,n in d)return n;return a}function F(d, n){return d=n||d,"none"===e.css(d,"display")||!e.contains(d.ownerDocument,d)}function T(d,n){for(var a,b,c,f=[],g=0,h=d.length;h>g;g++)b=d[g],b.style&&(f[g]=e._data(b,"olddisplay"),a=b.style.display,n?(f[g]||"none"!==a||(b.style.display=""),""===b.style.display&&F(b)&&(f[g]=e._data(b,"olddisplay",Z(b.nodeName)))):f[g]||(c=F(b),(a&&"none"!==a||!c)&&e._data(b,"olddisplay",c?a:e.css(b,"display"))));for(g=0;h>g;g++)b=d[g],b.style&&(n&&"none"!==b.style.display&&""!==b.style.display||(b.style.display=n? f[g]||"":"none"));return d}function L(d,n,e){return(d=Mc.exec(n))?Math.max(0,d[1]-(e||0))+(d[2]||"px"):n}function G(d,n,a,b,c){n=a===(b?"border":"content")?4:"width"===n?1:0;for(var f=0;4>n;n+=2)"margin"===a&&(f+=e.css(d,a+xa[n],!0,c)),b?("content"===a&&(f-=e.css(d,"padding"+xa[n],!0,c)),"margin"!==a&&(f-=e.css(d,"border"+xa[n]+"Width",!0,c))):(f+=e.css(d,"padding"+xa[n],!0,c),"padding"!==a&&(f+=e.css(d,"border"+xa[n]+"Width",!0,c)));return f}function O(d,n,a){var b=!0,c="width"===n?d.offsetWidth: d.offsetHeight,f=ya(d),g=e.support.boxSizing&&"border-box"===e.css(d,"boxSizing",!1,f);if(0>=c||null==c){if(c=za(d,n,f),(0>c||null==c)&&(c=d.style[n]),eb.test(c))return c;b=g&&(e.support.boxSizingReliable||c===d.style[n]);c=parseFloat(c)||0}return c+G(d,n,a||(g?"border":"content"),b,f)+"px"}function Z(d){var n=B,a=dc[d];return a||(a=J(d,n),"none"!==a&&a||(Ua=(Ua||e("');a.doRequest(picozu.API_CONVERT, "contents="+c+"&format="+b+("undefined"!==typeof e&&""!=e?"&"+e:""),function(a){$(".pico-iframe").attr("src",picozu.API_RETRIEVE+"?temp=1&file="+a.code+"&format="+a.format+"&title="+d)},null,"json")})}},{label:l("%Reset"),handle:"reset-workspace",callback:function(){this.confirmWindow(l("%main.resetworkspace"),l("%main.resetworkspacetext"),function(){this.reset(!1)})}}]}]},{label:l("%Edit"),handle:"edit",submenus:[{label:l("%Undo"),handle:"undo-history",id:"menu-edit-undo",shortcut:"ctrl+z",cssClass:"disabled", callback:function(){this.doUndo()}},{separator:!0},{label:l("%Cut"),handle:"cut-select",shortcut:"ctrl+x",callback:function(){this.cutClipboard()}},{label:l("%Copy"),handle:"copy-select",shortcut:"ctrl+c",callback:function(){this.copyClipboard()}},{label:l("%Paste"),handle:"paste-select",shortcut:"ctrl+v",id:"menu-edit-paste",cssClass:"disabled",callback:function(){this.pasteClipboard(!0)}},{separator:!0},{label:l("%Select"),handle:"select",submenus:[{label:l("%All"),handle:"all-select",shortcut:"ctrl+a", callback:function(){this.selectAll()}},{label:l("%None"),handle:"none-select",shortcut:"ctrl+d",callback:function(){this.selectNone()}}]},{separator:!0},{label:l("%Adjustments"),handle:"adjustments",submenus:[{label:l("%Curves"),handle:"adjustments-curves",innerTemplate:''},{separator:!0},{label:l("%Channels"),handle:"channels-layer",submenus:[{label:l("%Red"),handle:"red-channels-layer",callback:function(){this.configFilter({colorMatrix:[1,0,0,0,0,1,0,0,0,0,1,0,0,0, 0,0,0,0,1,0]}).addToQueue("colormatrix").processQueue()}},{label:l("%Green"),handle:"green-channels-layer",callback:function(){this.configFilter({colorMatrix:[0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0]}).addToQueue("colormatrix").processQueue()}},{label:l("%Blue"),handle:"blue-channels-layer",callback:function(){this.configFilter({colorMatrix:[0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0]}).addToQueue("colormatrix").processQueue()}}]}]}]},{label:l("%Layer"),handle:"layer",submenus:[{label:l("%New"),handle:"new-layer", submenus:[{label:l("%Layer"),handle:"new-layer-empty",shortcut:"ctrl+shift+n",callback:function(){this.newLayer()}},{label:l("%Layer via Cut"),handle:"new-layer-cut",callback:function(){!0===this.cutClipboard()&&this.pasteClipboard(!0)}},{label:l("%Layer via Copy"),handle:"new-layer-copy",callback:function(){!0===this.copyClipboard()&&this.pasteClipboard(!0)}}]},{label:l("%Image from Layer"),handle:"image-from-layer",callback:function(){this.imageFromLayer()}},{label:l("%Rotate"),handle:"rotate-layer", submenus:[{label:l("%Flip Horizontally"),handle:"flip-v-layer",callback:function(){this.getSelectedLayer().flip(picozu.FLIP_HORIZONTAL)}},{label:l("%Flip Vertically"),handle:"flip-h-layer",callback:function(){this.getSelectedLayer().flip(picozu.FLIP_VERTICAL)}},{separator:!0},{label:l("%Rotate 90"),handle:"rotate-90-layer",callback:function(){this.getSelectedLayer().rotate(90)}},{label:l("%Rotate 180"),handle:"rotate-180-layer",callback:function(){this.getSelectedLayer().rotate(180)}},{label:l("%Rotate 270"), handle:"rotate-270-layer",callback:function(){this.getSelectedLayer().rotate(270)}}]},{label:l("%Arrange"),handle:"arrange-image",submenus:[{label:l("%Bring to Front"),shortcut:"ctrl+shift+]",handle:"bring-front-image",callback:function(){this.getSelectedLayer().front()}},{label:l("%Bring Forward"),shortcut:"ctrl+]",handle:"bring-forward-image",callback:function(){this.getSelectedLayer().forward()}},{label:l("%Send Backward"),shortcut:"ctrl+[",handle:"send-backward-image",callback:function(){this.getSelectedLayer().backward()}}, {label:l("%Send to Back"),shortcut:"ctrl+shift+[",handle:"bring-back-image",callback:function(){this.getSelectedLayer().back()}},{label:l("%Reverse"),handle:"bring-reverse-image",callback:function(){this.getSelectedLayer().reverse()}}]},{label:l("%Duplicate"),shortcut:"insert",handle:"duplicate-layer",callback:function(){this.duplicateLayer()}},{label:l("%Delete"),handle:"delete-layer",shortcut:"del",callback:function(){this.deleteLayer()}},{separator:!0},{label:l("%Next Layer"),handle:"next-layer", shortcut:"pageup",callback:function(){this.selectNextLayer()}},{label:l("%Previous Layer"),handle:"prev-layer",shortcut:"pagedown",callback:function(){this.selectPreviousLayer()}},{label:l("%Flatten"),handle:"flatten-layer",shortcut:"ctrl+f",callback:function(){this.flattenLayers()}},{label:l("%menu.resize"),handle:"resize-layer",callback:function(){this.openWindow("resizelayer")}}]},{label:l("%Tools"),handle:"tools",submenus:[{label:l("%Extensions"),handle:"extensions-tool",shortcut:"f2",callback:function(){this.openWindow("extensions")}}, {label:l("%Settings"),handle:"settings-tool",shortcut:"ctrl+k",callback:function(){this.openWindow("settings")}},{separator:!0},{label:l("%Toggle Fullscreen"),handle:"fullscreen",shortcut:"f11",callback:function(){this.toggleFullscreen()}},{separator:!0},{label:l("%More tools"),handle:"tools-more",innerTemplate:''}]},{label:l("%Filters"),handle:"filters",callback:function(){this.openWindow("filters")}}, {label:l("%Help"),handle:"help",submenus:[{label:l("%Contents"),handle:"contents-help",shortcut:"f1",callback:function(){this.openWindow("helpcontents")}},{label:l("%Follow us on Twitter"),handle:"twitter-help",callback:function(){document.location.href=picozu.TWITTER_URL}}]}]; picozu.TAB_CONTEXTMENU_DEFS={newlayer:{label:l("%New Layer"),callback:function(){this.newLayer()}},copylayer:{label:l("%Copy to Clipboard"),callback:function(){this.copyClipboard(!0)}},flattenlayer:{label:l("%Flatten Layers"),callback:function(){this.flattenLayers()}},duplicatelayer:{label:l("%Duplicate Layer"),callback:function(){this.duplicateLayer()}},deletelayer:{label:l("%Delete Layer"),callback:function(){this.deleteLayer()}}}; picozu.SWATCHES_CONTEXTMENU_DEFS={addswatch:{label:l("%Add Custom Swatch"),callback:function(a,c){"undefined"!==typeof c&&null!==c&&this.addCustomSwatch($(a+'[data-mid="'+c+'"]').data("color"))}},separator:"",exportswatch:{label:l("%Export Swatches"),callback:function(){this.openWindow("colorpalette")}}}; picozu.IMAGE_SWATCHES_CONTEXTMENU_DEFS={addIswatch:{label:l("%Add Custom Swatch"),callback:function(a,c){"undefined"!==typeof c&&null!==c&&this.addCustomSwatch($(a+'[data-mid="'+c+'"]').data("color"))}},separator:"",exportIswatch:{label:l("%Export Image Swatches"),callback:function(){this.heap.paletteExport="image";this.openWindow("colorpalette")}}}; picozu.CUSTOM_SWATCHES_CONTEXTMENU_DEFS={exportCswatch:{label:l("%Export Custom Swatches"),callback:function(){this.heap.paletteExport="custom";this.openWindow("colorpalette")}},deleteCswatch:{label:l("%Clear Custom Swatches"),callback:function(){this.clearCustomSwatches()}}}; picozu.LAYERS_CONTEXTMENU_DEFS={Lnewlayer:{label:l("%New Layer"),callback:function(){this.newLayer()}},Lcopylayer:{label:l("%Copy to Clipboard"),callback:function(){this.copyClipboard(!0)}},Lflattenlayer:{label:l("%Flatten Layers"),callback:function(){this.flattenLayers(!0)}},Lduplicatelayer:{label:l("%Duplicate Layer"),callback:function(a,c){var b=$(a+'[data-mid="'+c+'"]').data("lid");this.duplicateLayer(b)}},Ldeletelayer:{label:l("%Delete Layer"),callback:function(a,c){var b=$(a+'[data-mid="'+c+ '"]').data("lid");this.deleteLayer(b)}}}; picozu.MAIN_PROPBAR_PANELS.push({handle:"layer",name:l("%Layer"),onCreate:function(){var a=this.getWorkspace();this.addElement({type:picozu.CONTROL_HTML,template:'
'}).addElement({type:picozu.CONTROL_HTML,template:'
'},".linfo").addElement({type:picozu.CONTROL_LEFTRIGHT, legendClass:"linfolpac",controlClass:"linfolpacvalue",legend:l("%Opacity"),value:10,size:3,minValue:0,tip:l("%Opacity of the layer"),maxValue:10,handle:"pz-layer-opacity",callback:function(a){this.getSelectedLayer().setOpacity(a,!0)}},".linfo").addElement({type:picozu.CONTROL_SEPARATOR}).addElement({type:picozu.CONTROL_SELECT,legendClass:"linfoblend",controlClass:"linfoblend",legend:l("%Blend Mode"),handle:"pz-layer-blend",tip:l("%Layer blend mode"),data:picozu.DEFAULT_BLEND_MODES,callback:function(a){this.applyBlend(!1, {blendMode:a})}}).addElement({type:picozu.CONTROL_HTML,template:'
'}).addElement({type:picozu.CONTROL_SEPARATOR},".linfotext").addElement({type:picozu.CONTROL_TEXTINPUT,legend:l("%Text"),cssClass:"linfotextvalue",handle:"pz-layerText",callback:function(a){var b=this.getSelectedLayer();b.getType()===picozu.LAYER_TYPE_TEXT?b.setText(a).drawText():b.getType()===picozu.LAYER_TYPE_TEXTSHAPE&&b.setText(a).drawTextShape()}},".linfotext").addElement({type:picozu.CONTROL_SEPARATOR}).addElement({type:picozu.CONTROL_HTML, template:'
'}).addElement({type:picozu.CONTROL_LEFTRIGHT,legendClass:"linfoposwlabel",controlClass:"linfoposwvalue",legend:l("%Width"),tip:l("%Width of the layer"),size:4,handle:"pz-layer-width",minValue:1,maxValue:9999,callback:function(a){var b=this.getSelectedLayer();b.resize(a,b.getHeight())}},".linfopos").addElement({type:picozu.CONTROL_LEFTRIGHT,legendClass:"linfoposhlabel",controlClass:"linfoposhvalue",legend:l("%Height"),size:4,tip:l("%Height of the layer"),minValue:1, maxValue:9999,handle:"pz-layer-height",callback:function(a){var b=this.getSelectedLayer();b.resize(b.getWidth(),a)}},".linfopos").addElement({type:picozu.CONTROL_LEFTRIGHT,legendClass:"linfoposxlabel",controlClass:"linfoposxvalue",legend:l("%x"),size:4,minValue:-9999,tip:l("%Left position of the layer"),maxValue:9999,handle:"pz-layer-left",callback:function(a){this.getSelectedLayer().move(a,null,!0)}},".linfopos").addElement({type:picozu.CONTROL_LEFTRIGHT,legendClass:"linfoposylabel",controlClass:"linfoposyvalue", legend:l("%y"),size:4,minValue:-9999,tip:l("%Top position of the layer"),maxValue:9999,handle:"pz-layer-top",callback:function(a){this.getSelectedLayer().move(null,a,!0)}},".linfopos");$(".pico-panel-layer").on("keyup.picozu","#pz-layer-name",function(c){13===c.keyCode&&(c=$(this).val(),""!==c&&(a.getSelectedLayer().setName(c),a._refreshLayers()))}).on("focusout","#pz-layer-name",function(){var c=$(this).val();""!==c&&(a.getSelectedLayer().setName(c),a._refreshLayers())})}}); picozu.MAIN_PROPBAR_PANELS.push({handle:"shapes",name:l("%Shapes"),hide:!0,onCreate:function(){var a=this.getWorkspace();this.addElement({type:picozu.CONTROL_HTML,template:'
'}).addElement({type:picozu.CONTROL_LEFTRIGHT,legendClass:"linfopac",controlClass:"linfopacvalue",handle:"pz-opacity",property:"opacity",tip:l("%Shape opacity"),legend:l("%Opacity"),value:10,size:3,minValue:0,maxValue:10},".linfo2").addElement({type:picozu.CONTROL_LEFTRIGHT,legendClass:"linfoshadowxlabel",controlClass:"linfoshadowxvalue",legend:l("%x"),size:3, tip:l("%Left shadow offset"),property:"shadowoX",handle:"pz-shadowoX",minValue:-99,value:0,maxValue:99},".linfo2").addElement({type:picozu.CONTROL_LEFTRIGHT,legendClass:"linfoshadowylabel",controlClass:"linfoshadowyvalue",legend:l("%y"),size:3,value:0,tip:l("%Top shadow offset"),property:"shadowoY",handle:"pz-shadowoY",minValue:-99,maxValue:99},".linfo2").addElement({type:picozu.CONTROL_LEFTRIGHT,legendClass:"linfoblurlabel",controlClass:"linfoblurvalue",legend:l("%Blur"),size:3,minValue:0,value:0, tip:l("%settings.blurshadow"),maxValue:99,handle:"pz-shadowBlur",property:"shadowBlur"},".linfo2").addElement({type:picozu.CONTROL_SEPARATOR}).addElement({type:picozu.CONTROL_HTML,template:'
'}).addElement({type:picozu.CONTROL_LEFTRIGHT,legendClass:"layerborderlabel",controlClass:"layerbordervalue",legend:l("%Border"),value:1,size:3,handle:"pz-border",property:"border",minValue:0,tip:l("%Border width size"),maxValue:100},".layerborder").addElement({type:picozu.CONTROL_SLIDER, legend:l("%panel.shape.radius"),handle:"pp-shapeRadius",property:"shapeRadius",value:10,minValue:1,maxValue:100});$(".pico-panel-shapes").on("click",".linfo2 .linfopreview",function(){$(this).parent().parent().children(".linfopick").fadeToggle()}).on("click",".linfo2 .linfopick a",function(){$(this).parent(".linfopick").fadeToggle();var c=parseInt($(this).data("id")),b=$(this).data("value");$(this).parent().parent().children(".linfopreview").addClass(b);3===c?a.openWindow("gradient"):a.setParam("drawMode", c)})}}); picozu.MAIN_PROPBAR_PANELS.push({handle:"font",name:l("%Fonts"),hide:!0,onCreate:function(){this.addElement({type:picozu.CONTROL_HTML,template:'
'}).addElement({type:picozu.CONTROL_LEFTRIGHT,legendClass:"fontsizelabel",controlClass:"fontsizevalue",legend:l("%panel.size"),property:"fontSize",handle:"pz-fontSize",value:30,tip:l("%Font size"),size:3,minValue:6,maxValue:200,callback:function(a){!1===this.parameters.isCreatingText&&!0===this.getSelectedLayer().isTextLayer()&&this.getSelectedLayer().setParameter("fontSize", a)}},".toolinfo").addElement({type:picozu.CONTROL_SELECT,legendClass:"fontfamilylabel",cssClass:"fontfamilyval",legend:l("%panel.font.family"),special:"font",tip:l("%Font family"),handle:"pz-fontFamily",property:"fontFamily",data:picozu.DEFAULT_FONTS,callback:function(a){var c=this;WebFont.load({google:{families:[a]},active:function(){c.getSelectedLayer().setParameter("fontFamily",a)},inactive:function(){}})}},".toolinfo").addElement({type:picozu.CONTROL_BUTTONGRID,controlClass:"textaligninfo",handle:"pz-fontAlign", property:"fontAlign",buttons:[{value:"left",selected:!0,tip:l("%Left aligned")},{value:"center",tip:l("%Center aligned")},{value:"right",tip:l("%Right aligned")}],callback:function(a){!1===this.parameters.isCreatingText&&!0===this.getSelectedLayer().isTextLayer()&&this.getSelectedLayer().setParameter("fontAlign",a)}},".toolinfo").addElement({type:picozu.CONTROL_BUTTONGRID_TOGGLE,controlClass:"textstyleinfo",handle:"pz-fontStyle",buttons:[{value:"bold",property:"fontWeight",tip:l("%Bold"),states:["normal", "bold"]},{value:"italic",property:"fontStyle",tip:l("%Italic"),states:["normal","italic"]},{value:"underline",property:"fontDecoration",tip:l("%Underlined"),states:["none","underline"]}],callback:function(a,c){!1===this.parameters.isCreatingText&&!0===this.getSelectedLayer().isTextLayer()&&("fontWeight"===c?this.getSelectedLayer().setParameter("fontWeight",a):"fontStyle"===c?this.getSelectedLayer().setParameter("fontStyle",a):"fontDecoration"===c&&this.getSelectedLayer().setParameter("fontDecoration", a))}},".toolinfo")}}); picozu.MAIN_PROPBAR_PANELS.push({name:l("%Pencil / Brush"),hide:!0,handle:"brush",onCreate:function(){var a=this;this.addElement({type:picozu.CONTROL_HTML,template:'
'}).addElement({type:picozu.CONTROL_LEFTRIGHT,legendClass:"brushsizelabel",controlClass:"brushsizevalue",legend:l("%panel.size"),property:"brushSize",handle:"pz-brushSize",value:1,tip:l("%tips.brush.size"),size:3,minValue:1,maxValue:99},".brushinfo").addElement({type:picozu.CONTROL_SELECT,legendClass:"brushtypelabel", cssClass:"brushtypeval",legend:l("%panel.type"),handle:"pz-brushType",property:"brushType",data:picozu.DEFAULT_BRUSHES,callback:function(c){a.getWorkspace().doTool(c)}},".brushinfo").addElement({type:picozu.CONTROL_SLIDER,legend:l("%panel.brushes.hardness"),handle:"pp-bhard",property:"brushHardness",value:60,minValue:1,maxValue:100}).addElement({type:picozu.CONTROL_SLIDER,legend:l("%panel.brushes.flow"),property:"brushFlow",handle:"pp-bflow",value:100,minValue:1,maxValue:100}).addElement({type:picozu.CONTROL_SLIDER, legend:l("%panel.brushes.tolerance"),property:"fillTolerance",handle:"pp-btolerance",value:30,minValue:10,maxValue:50})}});picozu.MAIN_DOCKBAR_PANELS.push({name:l("%Preview"),handle:"preview",template:'
',onCreate:function(){var a=this;$("#pico-slider-zoom").slider({value:1,min:0.1,max:1.9,step:0.1,slide:function(c,b){a.getWorkspace().getSelectedLayer().setZoom(b.value)}})}}); picozu.MAIN_DOCKBAR_PANELS.push({name:l("%Layers"),handle:"layers",template:'
    ',onCreate:function(){var a=this,c=this.getWorkspace();new picozu.objects.contextmenu({target:".select_layer",parent:c,submenus:picozu.LAYERS_CONTEXTMENU_DEFS});$(".layers-items-list").on("click",".layername",function(){var a=parseInt($(this).data("id"));c.getSelectedTab().layers[a].select();c._refreshLayers()}).on("click",".groupstatus",function(){var b=parseInt($(this).data("id")); $(this).toggleClass("hidden").toggleClass("visible");for(var d=1;d
    R:
    G:
    B:
    #:
    C:
    M:
    Y:
    K:
    X:
    Y:
    W:
    H:

    H:
    S:
    V:
    X:
    Y:
    Z:
    L:
    a:
    b:
    '}); picozu.DEBUGGER_PROPBAR.push({handle:"debugger",name:l("%Debugger"),onCreate:function(){this.addElement({type:picozu.CONTROL_HTML,template:'
      '});$(".pico-panel-debugger").on("click",".ticket",function(){self.getWorkspace().openWindow("support");return!1})}}); picozu.WINDOWS.push({name:l("%Extensions"),handle:"extensions",center:!0,width:650,template:'', onCreate:function(){var a="",c=this.getElementId(),b=this.getWorkspace();this.addFooter("");$(c+" footer").hide();$(c+" .tabs").tabs({activate:function(){$(c+" footer").empty().hide()}});for(var d=0;d
      '+ e.parameters.title+"
      ")}$(c+" .pico-plugins-list").append(a);a="";for(d=0;d
      '+picozu.AVAILABLE_THEMES[d].name+"
      ");$(c+" .pico-themes-list").append(a);a="";for(d=0;d
      '+picozu.AVAILABLE_FILTER_PACKS[d].name+"
      ";$(c+" .pico-filters-list").append(a);$(c).on("click",".pico-theme-item",function(){var a=$(this).data("id"),d=$(this).data("handle");$(".pico-themes-list").addClass("hasinfo");$(".pico-theme-item").removeClass("selected");$(this).addClass("selected");$(".pico-themes-info").empty().append('
      '+ l("%Author")+'
      '+l("%Description")+'
      ');$(".pico-themes-info .title").html(picozu.AVAILABLE_THEMES[a].name);$(".pico-themes-info .email").html(''+picozu.AVAILABLE_THEMES[a].author+"");$(".pico-themes-info .url").html(''+picozu.AVAILABLE_THEMES[a].url+ "");$(".pico-themes-info .description").html(picozu.AVAILABLE_THEMES[a].description);$(c+" .pico-themes-info").show();b.getSetting("theme")!==d?$(c+" footer").empty().append(''+l("%Activate")+"").show():$(c+" footer").empty().hide();return!1}).on("click",".pico-filter-item",function(){var a=$(this).data("id");$(this).data("handle");$(".pico-filters-list").addClass("hasinfo");$(".pico-filter-item").removeClass("selected"); $(this).addClass("selected");$(".pico-filters-info").empty().append('
      '+l("%Author")+'
      '+l("%Description")+'
      ');$(".pico-filters-info .title").html(picozu.AVAILABLE_FILTER_PACKS[a].name);$(".pico-filters-info .email").html(''+ picozu.AVAILABLE_FILTER_PACKS[a].author+"");$(".pico-filters-info .url").html(''+picozu.AVAILABLE_FILTER_PACKS[a].url+"");$(".pico-filters-info .description").html(picozu.AVAILABLE_FILTER_PACKS[a].description);$(c+" .pico-filters-info").show();return!1}).on("click",".pico-plugin-item",function(){$(".pico-plugins-list").addClass("hasinfo");$(".pico-plugins-info").empty();$(".pico-plugin-item").removeClass("selected"); $(this).addClass("selected");var a=$(this).data("handle"),d=b.getPlugin(a);if(d){$(".pico-plugins-info").append('
      '+l("%Author")+'
      '+l("%Dependencies")+'
        '+l("%Requirements")+"
          "+l("%Description")+ '
          ');$(".pico-plugins-info .title").html(d.parameters.title);$(".pico-plugins-info .version").html(d.parameters.version);$(".pico-plugins-info .email").html(''+d.parameters.email+"");$(".pico-plugins-info .url").html(''+d.parameters.url+"");$(".pico-plugins-info .description").html(d.parameters.description);if("undefined"!==typeof d.parameters.depends&& null!==d.parameters.depends){for(var e=0;e"+d.parameters.depends[e].capitalize()+"");$(c+" fieldset.depends").show()}else $(c+" fieldset.depends").hide();if("undefined"!==typeof d.parameters.requires&&null!==d.parameters.requires){for(e=0;e"+d.parameters.requires[e].capitalize()+"");$(c+" fieldset.requires").show()}else $(c+" fieldset.requires").hide(); !1===b.pluginIsInstalled(a)?$(c+" footer").empty().append(''+l("%Install")+"   ").show():($(c+" footer").empty().append(''+l("%Uninstall")+" ").show(),!0===b.pluginIsEnabled(a)?$(c+" footer").append(''+l("%Disable")+"").show(): $(c+" footer").append(''+l("%Enable")+"").show());$(c+" .pico-plugins-info").show()}return!1}).on("click",".pico-theme-activate",function(){var a=$(this).data("handle");b.loadTheme(a);$(c+" footer").empty().hide();return!1}).on("click",".pico-theme-item",function(){$(".pico-theme-item").removeClass("selected");$(this).addClass("selected");return!1}).on("click",".pico-plugin-install",function(){var a=$(this).data("handle"); "object"===typeof b.loadPlugin(a)&&$(c+" footer").empty().append(''+l("%Uninstall")+' '+l("%Enable")+"").show();return!1}).on("click",".pico-plugin-uninstall",function(){var a=$(this).data("handle");b.unloadPlugin(a);$(c+" footer").empty().append('Install').show(); return!1}).on("click",".pico-plugin-enable",function(){var a=$(this).data("handle");b.getPlugin(a).enable();$(c+" footer").empty().append(''+l("%Uninstall")+' '+l("%Disable")+"").show();return!1}).on("click",".pico-plugin-disable",function(){var a=$(this).data("handle");b.getPlugin(a).disable();$(c+" footer").empty().append(''+l("%Uninstall")+' '+l("%Enable")+"").show();return!1})}}); picozu.WINDOWS.push({name:l("%Save Image"),handle:"saveimage",width:500,modal:!0,onCreate:function(){var a=this,c=this.getElementId();this.addElement({type:picozu.CONTROL_HTML,template:'
          '}).addElement({type:picozu.CONTROL_HTML,template:"

          "+l("%saveimage.text1")+"


          "+l("%saveimage.text2")+"

          "},".column1").addElement({type:picozu.CONTROL_SEPARATOR},".column1").addElement({type:picozu.CONTROL_SELECT, legend:l("%main.saveas"),handle:"pico-save-as",legendClass:"legend",data:picozu.DEFAULT_EXPORTERS,callback:function(b){$(c+" .expSettings").empty();b=picozu.DEFAULT_EXPORTERS.findIndexM(parseInt(b));if(!1!==b&&(b=picozu.DEFAULT_EXPORTERS[b],"undefined"!==typeof b.settings))for(var d=0;d'},".column1").addFooter(picozu.DEFAULT_WINDOW_FOOTER)}, onApply:function(){var a=this.getWorkspace();a.getSelectedTab()._refreshPreview();a.exportData(this.getIntValue("#pico-save-as"),function(c,b,d,e){if(!0===a.isOnline())if("object"===typeof c)for(var f=0;f'),a.doRequest(picozu.API_CONVERT,"contents="+c[f]+"&format="+b[f]+"&title="+d[f]+("undefined"!==typeof e&&""!=e?"&"+e:""),function(a){$("#pico-save-iframe-"+ a.format).attr("src",picozu.API_RETRIEVE+"?temp=1&file="+a.code+"&format="+a.format+"&title="+a.title)},null,"json");else $(".pico-iframe").remove(),$(".picozu").append(''),a.doRequest(picozu.API_CONVERT,"contents="+c+"&format="+b+("undefined"!==typeof e&&""!=e?"&"+e:""),function(a){$(".pico-iframe").attr("src",picozu.API_RETRIEVE+"?temp=1&file="+a.code+"&format="+a.format+"&title="+d);parent.postMessage(a,"*")},null,"json");else!1===a.isOnline()&&("png"== b||"jpg"==b)?(window.open("about:blank","Picozu Image Editor").document.write("from canvas"),a.hideLoader()):(a.hideLoader(),a.notify(l("%main.offline"),!0))},$("form.expSettings").serializeArray())}}); picozu.WINDOWS.push({name:l("%Color"),handle:"color",left:110,top:10,width:320,template:'
          ',onCreate:function(){var a=this,c=this.getWorkspace(),b=c.getParam("foregroundColor"),d=this.getElementId();a.heap.color=b;$(d+" .pico-color-picker").colorPicker({color:b,onColorChange:function(b){a.heap.color=b;$(".pico-window-color footer .color").css({"background-color":Color.color2Exp("rgb",b)});$(d+" footer .pico-textfield").val(Color.rgb2hex(b));c.updateInfoPanel({rgb:b})}}); this.addFooter(picozu.CONTROL_COLORSELECT_HTML.replace(/{rgbColor}/g,Color.color2Exp("rgb",b)).replace(/{hexColor}/g,Color.rgb2hex("rgb",b)));$(d).on("keyup.picozu","footer .pico-textfield",function(){var c=$(this).val();/(^[0-9A-F]{6}$)|(^[0-9A-F]{3}$)/i.test(c)?(a.heap.color=Color.hex2rgb(c),$(d+" footer .color").css({"background-color":Color.color2Exp("rgb",a.heap.color)}),$(this).removeClass("error")):$(this).addClass("error")})},onApply:function(){this.getWorkspace().setParam("foregroundColor", this.heap.color)}}); picozu.WINDOWS.push({name:l("%Rename Image"),handle:"renameimage",modal:!0,width:270,onCreate:function(){var a=this.getElementId();this.addElement({type:picozu.CONTROL_TEXTINPUT,legend:l("%Name"),handle:"tabname",value:this.getWorkspace().getSelectedTab().getName(),cssClass:"tabname",max:20,tips:l("%rename.tab.tip")}).addFooter(picozu.DEFAULT_WINDOW_FOOTER);$(a).on("keyup.picozu",".tabname",function(c){13===c.keyCode&&($(a+" .accept-button").trigger("click"),$(this).blur());return!1})},onApply:function(){var a= this.getStrValue(".tabname").replace(/^\s\s*/,"").replace(/\s\s*$/,""),c=this.getWorkspace();2a.length?c.getSelectedTab().setName(a):c.notify(l("%main.invalidtabname"),!0)}}); picozu.WINDOWS.push({name:l("%main.cloudexport.title"),handle:"exportcloud",width:420,center:!0,onCreate:function(){var a=this,c=this.getWorkspace(),b=this.getElementId();this.addElement({type:picozu.CONTROL_IMAGE,image:picozu.DEFAULT_PATH+"images/windows/exportcloud/splash.png"}).addElement({type:picozu.CONTROL_SEPARATOR}).addElement({type:picozu.CONTROL_TEXTINPUT,legend:l("%main.title"),handle:"pz-cloudsave-title",legendClass:"legend",cssClass:"title"}).addElement({type:picozu.CONTROL_TEXTAREA, legend:l("%Description"),handle:"pz-cloudsave-description",legendClass:"legend",cssClass:"description"}).addElement({type:picozu.CONTROL_SELECT,legend:l("%visibility"),handle:"pz-cloudsave-vis",legendClass:"legend",data:picozu.DEFAULT_VISIBILITY,cssClass:"visibility"}).addElement({type:picozu.CONTROL_SELECT,legend:l("%main.saveas"),handle:"pico-save-as",legendClass:"legend",data:picozu.DEFAULT_EXPORTERS,callback:function(c){$(b+" .expSettings").empty();c=picozu.DEFAULT_EXPORTERS.findIndexM(parseInt(c)); if(!1!==c&&(c=picozu.DEFAULT_EXPORTERS[c],"undefined"!==typeof c.settings))for(var e=0;e'});!0!==c.isLoggedIn()?c.notify(l("%main.cloud.notloggedin"),!0):this.addFooter(picozu.DEFAULT_WINDOW_FOOTER)},onApply:function(){var a=this.getWorkspace();a.getSelectedTab()._refreshPreview();var c=this.getStrValue(".title"),b=this.getStrValue(".description"),d= this.getIntValue(".visibility");a.exportData(this.getIntValue("#pico-save-as"),function(e,f,g,h){if(!0===a.isOnline())if(a.showLoader(),"object"===typeof e)for(g=0;g
          • '+l("%main.noimages")+'
            ',onCreate:function(){var a=this,c=this.getElementId(),b=this.getWorkspace();!0!==b.isLoggedIn()&&b.notify(l("%main.cloud.notloggedin"),!0);this.addFooter(picozu.BROWSER_WINDOW_FOOTER);this.helper={page:1,imagesCount:0, images:[],results:15,getAll:function(a){var c=this;"prev"===a?this.page--:"next"===a?this.page++:this.page="undefined"===typeof a?1:a;b.doRequest(picozu.API_IMAGES,null,function(a){b.isErrorRequest(a)||(c.images=a.images,c.imagesCount=a.total,c._process())},function(){},"json")},_process:function(){var a="",c=(this.page-1)*this.results,f=this.results*this.page;$(".pico-cloud-list ul.photolist").empty();if(0=c&&g";b.paginate(Math.ceil(this.images.length/this.results),this.page,".pico-cloud-pager");$(".pico-cloud-list ul.photolist").append(a);b.hideLoader()},photoCallback:function(a,c){var b;c||(b="pzw"===a.ext||"pzi"===a.ext?'
          • '+a.title+"
          • ":'
          • '+ a.title+"
          • ");return b}};this.helper.getAll();$(c).on("click",".pico-cloud-list ul li a",function(){a.hide();var c=$(this).attr("href");(new picozu.objects.tab({parent:b,image:c})).activate();return!1}).on("click",".reload",function(){b.showLoader();a.helper.getAll()}).on("click",".pico-cloud-pager a",function(){$(this).parent("li").hasClass("next")?a.helper.getAll("next"):$(this).parent("li").hasClass("prev")?a.helper.getAll("prev"):a.helper.getAll(parseInt($(this).text()));return!1})}}); picozu.WINDOWS.push({name:l("%Account"),center:!0,width:460,handle:"account",template:'',onShow:function(){var a=this.getWorkspace(),c=this,b=this.getElementId();$(b+" .tabs").tabs(); !1!==a.getAccount()?(this.setValue(".prof-username",a.account.username).setValue(".prof-email",a.account.email).setValue(".prof-fullname",a.account.nickname).addFooter(' '),$(".prof-avatar").attr("src",a.account.avatar),$(".account-tab.profile-panel").show()):(this.addFooter(""),$(b+" footer").hide(),$(".account-tab.login-panel").show()); $(b).on("click",".login",function(){a.login({username:c.getValue(".log-username"),password:c.getValue(".log-pass")})}).on("click",".recover",function(){a.recover({username:c.getValue(".rec-username")})}).on("click",".update",function(){a.updateProfile({fullname:c.getValue(".prof-fullname"),email:c.getValue(".prof-email"),password:c.getValue(".prof-pass"),password2:c.getValue(".prof-pass2")})}).on("click",".register",function(){!0===c.getBoolValue(".reg-terms")?a.register({username:c.getValue(".reg-username"), fullname:c.getValue(".reg-fullname"),email:c.getValue(".reg-email"),password:c.getValue(".reg-pass"),password2:c.getValue(".reg-pass2")}):a.notify(l("%register.terms"),!0)}).on("click",".logout",function(){a.logout()}).on("keyup.picozu",".log-username, .log-pass",function(a){13===a.keyCode&&($(b+" .login").trigger("click"),$(this).blur());return!1}).on("keyup.picozu",".rec-username, .rec-email",function(a){13===a.keyCode&&($(b+" .recover").trigger("click"),$(this).blur());return!1}).on("keyup.picozu", ".reg-username, .reg-email, .reg-pass, .reg-pass2",function(a){13===a.keyCode&&($(b+" .register").trigger("click"),$(this).blur());return!1})}}); picozu.WINDOWS.push({name:l("%Filters"),center:!0,handle:"filters",template:'

              ',onCreate:function(){for(var a=this,c=this.getElementId(),b=this.getWorkspace(),d=0;d ul").append('
            • '+picozu.FILTERS[d].name+"
            • ");$(c).on("click",".sidebar ul li a",function(){var a=$(this).data("cid"),b="";$(c+" .main .intro").hide();$(c+" .main .enter").show();$(c+" .sidebar ul li").removeClass("selected");$(this).parent("li").addClass("selected");for(var d=0;d'+picozu.FILTERS[a].filters[d].name+"";$(c+" .preview-filter-list ul").empty().append(b);$(c+" .filtersetup").empty();return!1}).on("click",".preview-filter-list ul li a",function(){b.clearQueue();var d=$(this).data("filter"),f=b.getFilter(d);b.heap.currentFilter=d;$(c+" .filtersetup").empty(); if("undefined"!==typeof f.settings){for(var g=0;g ')},onShow:function(){var a= this.getWorkspace();a.getSelectedTab()._refreshPreview();a._refreshFilterPreview()},onApply:function(){var a=this.getWorkspace(),c=a.heap.currentFilter;if(null!==c&&"undefined"!==typeof c){c=a.getFilter(c);if("undefined"!==typeof c.queue)for(var b=0;b
                ',onCreate:function(){for(var a=this.getElementId(),c="",b=this.getWorkspace(),d=0;d'+picozu.LIBRARY[d].name+"";$(a+" .sidebar > ul").append(c);$(a).on("click",".sidebar ul li a",function(){var c=$(this).data("cid"), b="";$(a+" .sidebar ul li").removeClass("selected");$(this).parent("li").addClass("selected");for(var d=0;d'+picozu.LIBRARY[c].objects[d]+"";$(a+" .objects-list ul").empty().append(b);return!1}).on("click",".objects-list ul li a", function(){$(a+" .objects-list ul li a").removeClass("selected");$(this).addClass("selected");b.heap.currentLibraryObject=$(this).data("object");return!1});this.addFooter(picozu.DEFAULT_WINDOW_FOOTER)},onApply:function(){var a=this.getWorkspace(),c=a.heap.currentLibraryObject;a.showLoader();var c=picozu.DEFAULT_PATH+"images/library/"+c+".png",b=new Image;b.onload=function(){a.saveUndo();(new picozu.objects.layer({parent:a.getSelectedTab(),left:0,top:0,width:b.width,height:b.height,name:"Object"})).drawImage(b, b.width,b.height).select();a._refreshAll();a.hideLoader()};b.onerror=function(){a.notify(l("%main.image.notloaded"),!0).hideLoader()};b.src=c;this.hide()}}); picozu.WINDOWS.push({name:l("%Resize Image"),handle:"resizeimage",width:270,modal:!0,template:'
                ',onShow:function(){var a=this.getWorkspace().getPreviewLayer();this.setIntValue(".width",a.getWidth());this.setIntValue(".height",a.getHeight())},onCreate:function(){var a=this,c=this.getElementId(),b=this.getWorkspace().getPreviewLayer(),d= b.getWidth(),b=b.getHeight(),e=d/b;this.addFooter(picozu.DEFAULT_WINDOW_FOOTER);this.setIntValue(".width",d);this.setIntValue(".height",b);$(c).on("keyup.picozu",".width",function(){if($(c+" .ratio").is(":checked")){var b=parseInt($(this).val())/e+0.5|0;a.setIntValue(".height",b)}}).on("keyup.picozu",".height",function(){if($(c+" .ratio").is(":checked")){var b=parseInt($(this).val())*e+0.5|0;a.setIntValue(".width",b)}}).on("change",".ratio",function(){var c=a.getIntValue(".width")/e+0.5|0;a.setIntValue(".height", c)}).on("change",".width-unit, .height-unit",function(){var a=parseInt($(this).val());$(c+" select.width-unit, "+c+" select.height-unit").val(a)})},onApply:function(){var a=this.getWorkspace(),c=this.getIntValue(".width"),b=this.getIntValue(".height");if(a.validateImageSize(c)&&a.validateImageSize(b))a.saveUndo().getSelectedTab().resize(c,b);else return a.notify(l("%main.imagesizeerror"),!0),!1}}); picozu.WINDOWS.push({name:l("%Resize Layer"),handle:"resizelayer",width:270,modal:!0,template:'
                ',onShow:function(){var a=this.getWorkspace().getSelectedLayer();this.setIntValue(".width",a.getWidth());this.setIntValue(".height",a.getHeight())},onCreate:function(){var a=this,c=this.getElementId(),b=this.getWorkspace().getSelectedLayer(), d=b.getWidth(),b=b.getHeight(),e=d/b;this.addFooter(picozu.DEFAULT_WINDOW_FOOTER);this.setIntValue(".width",d);this.setIntValue(".height",b);$(c).on("keyup.picozu",".width",function(){if($(c+" .ratio").is(":checked")){var b=parseInt($(this).val())/e+0.5|0;a.setIntValue(".height",b)}}).on("keyup.picozu",".height",function(){if($(c+" .ratio").is(":checked")){var b=parseInt($(this).val())*e+0.5|0;a.setIntValue(".width",b)}}).on("change",".ratio",function(){var c=a.getIntValue(".width")/e+0.5|0;a.setIntValue(".height", c)}).on("change",".width-unit, .height-unit",function(){var a=parseInt($(this).val());$(c+" select.width-unit, "+c+" select.height-unit").val(a)})},onApply:function(){var a=this.getWorkspace(),c=this.getIntValue(".width"),b=this.getIntValue(".height");if(a.validateImageSize(c)&&a.validateImageSize(b))a.saveUndo().getSelectedLayer().resize(c,b);else return a.notify(l("%main.imagesizeerror"),!0),!1}}); picozu.WINDOWS.push({name:l("%Import from URL"),handle:"importURL",center:!0,width:400,template:"

                "+l("%info.importurl")+"


                ',onCreate:function(){var a=this,c=this.getWorkspace(),b=this.getElementId();this.addFooter(this.addButton({cssClass:"import",value:l("%Import")}));$(b).on("click",".import",function(){var b=a.getStrValue(".url");""!==b?(c.parseImageFile(b), a.setValue(".url",""),a.hide()):c.notify(l("%main.image.specify"),!0);return!1}).on("keyup.picozu",".url",function(a){13===a.keyCode&&$(b+" .import").trigger("click");return!1})}}); picozu.WINDOWS.push({name:l("%window.canvas.size"),handle:"canvassizeimage",modal:!0,width:270,template:'
                ',onShow:function(){var a=this.getWorkspace().getPreviewLayer();this.setIntValue(".width",a.getWidth());this.setIntValue(".height",a.getHeight())},onCreate:function(){var a=this,c=this.getElementId(),b=this.getWorkspace().getPreviewLayer(),d= b.getWidth(),b=b.getHeight(),e=d/b;this.addFooter(picozu.DEFAULT_WINDOW_FOOTER);this.setIntValue(".width",d);this.setIntValue(".height",b);$(c).on("keyup.picozu",".width",function(){if($(c+" .ratio").is(":checked")){var b=parseInt($(this).val())/e+0.5|0;a.setIntValue(".height",b)}}).on("keyup.picozu",".height",function(){if($(c+" .ratio").is(":checked")){var b=parseInt($(this).val())*e+0.5|0;a.setIntValue(".width",b)}}).on("change",".ratio",function(){var c=a.getIntValue(".width")/e+0.5|0;a.setIntValue(".height", c)}).on("change",".width-unit, .height-unit",function(){var a=parseInt($(this).val());$(c+" select.width-unit, "+c+" select.height-unit").val(a)})},onApply:function(){var a=this.getWorkspace(),c=a.getSelectedTab(),b=this.getIntValue(".width"),d=this.getIntValue(".height");if(a.validateImageSize(b)&&a.validateImageSize(d)){a.saveUndo();c.resize(b,d,!0);for(var e=1;e
                • '+l("%main.noimages")+'

                  ',onCreate:function(){var a=this,c=this.getWorkspace(),b=this.getElementId();this.helper={page:1,results:15,getAll:function(a){"prev"===a?this.page--:"next"===a?this.page++:this.page="undefined"===typeof a?1:a;a="";var b= picozu.SAMPLE_IMAGES,f=(this.page-1)*this.results,g=this.results*this.page;$(".pico-sample-list ul.photolist").empty();if(0=f&&h";c.paginate(Math.ceil(b/this.results),this.page,".pico-sample-pager");$(".pico-sample-list ul.photolist").append(a);c.hideLoader()},_photoCallback:function(a,c){var b="";c||(b='
                • ');return b}};this.helper.getAll();$(b).on("click",".photolist ul li a",function(){var b=$(this).attr("href");c.parseImageFile(b);a.hide();return!1}).on("click",".pagination a",function(){$(this).parent("li").hasClass("next")?a.helper.getAll("next"):$(this).parent("li").hasClass("prev")?a.helper.getAll("prev"):a.helper.getAll(parseInt($(this).text()));return!1})}}); picozu.WINDOWS.push({name:l("%Image Info"),handle:"imageinfo",center:!0,width:400,template:'
                  ', onCreate:function(){var a=this.getElementId();$(a+" .tabs").tabs();$(a+' input[type="text"]').prop("disabled",!0);this.addFooter(picozu.DEFAULT_WINDOW_FOOTER);$(a+" footer").on("click",".locate",function(){var a=$(".ii-GPSLatitude").val().split(","),b=$(".ii-GPSLongitude").val().split(","),a=Others.dms2dec(a[0],a[1],a[1],b[0],b[1],b[1],$(".ii-GPSLatitudeRef").val(),$(".ii-GPSLongitudeRef").val());$(this).attr("href","https://maps.google.com/maps?f=q&q=loc:"+a.latitude+","+a.longitude+"&t=k&spn=0.5,0.5"); $(this).attr("target","_blank")})},onShow:function(){this.getWorkspace().fillEXIFInfo()}}); picozu.WINDOWS.push({name:l("%Welcome to Picozu"),handle:"intro",movable:!1,left:Math.round(window.innerWidth/2-200),top:Math.round(window.innerHeight/2-300),width:420,template:'
                  '+l("%Create a new image")+""+l("%intro.create")+'
                  '+ l("%Open a Sample Image")+""+l("%intro.sample")+'
                  '+l("%Install Extensions")+""+l("%intro.extensions")+'
                  '+l("%Watch a Tutorial")+""+l("%intro.help")+"
                  ",onCreate:function(){var a=this,c=this.getWorkspace();$(".pico-window-intro").on("click",".create",function(){a.destroy(); return!1}).on("click",".facebook",function(){a.destroy();c.openWindow("facebookopen");return!1}).on("click",".sample",function(){a.destroy();c.openWindow("sampleimages");return!1}).on("click",".extensions",function(){a.destroy();c.openWindow("extensions");return!1}).on("click",".help",function(){a.destroy();c.openWindow("helpcontents");return!1})},onShow:function(){$("body").append('
                  ');$("#introModal").show()},onDestroy:function(){$("#introModal").hide().remove()}}); picozu.WINDOWS.push({name:l("%Upload"),handle:"uploadfiles",width:280,modal:!0,onCreate:function(){var a=this,c=this.getElementId(),b=this.getWorkspace();this.addElement({type:picozu.CONTROL_IMAGE,image:picozu.DEFAULT_PATH+"images/windows/uploadfiles/splash.png"}).addElement({type:picozu.CONTROL_SEPARATOR}).addElement({type:picozu.CONTROL_HTML,template:"

                  "+l("%window.upload.info")+'

                  '}).addFooter(this.addButton({cssClass:"upload", value:l("%main.selectfile")})+this.addButton({type:"gui",cssClass:"cancel-button",value:l("%main.cancel")}));$(c).on("click",".upload",function(){$(c+" .pico-files-upload").trigger("click");return!1});$(c).on("change",".pico-files-upload",function(c){a.hide();b.showLoader();c=c||window.event;c.preventDefault();c=c.originalEvent||c;b.loadFile(c.target.files[0]);return!1})}}); picozu.WINDOWS.push({name:l("%New Image"),handle:"newimage",modal:!0,width:270,template:'
                  ",onCreate:function(){var a=this,c=this.getElementId(),b="",d=this.getWorkspace();this.addFooter(picozu.DEFAULT_WINDOW_FOOTER);for(var e in picozu.NEW_IMAGE_PRESETS){for(var b=b+(''),f=0;f'+picozu.NEW_IMAGE_PRESETS[e][f].name+"";b+=""}$(c+" .name").val("untitled"+parseInt(d.heap.lastTabIndex+1));$(c+" .preset").append(b);$(c).on("change",".preset",function(){var b=$(c+" select.preset").val(),b=b.split("-");0!==b[0]&&(a.setIntValue(".width",picozu.NEW_IMAGE_PRESETS[b[1]][b[0]].width),a.setIntValue(".height",picozu.NEW_IMAGE_PRESETS[b[1]][b[0]].height))}).on("change",".width-unit, .height-unit",function(){var a=parseInt($(this).val());$(c+" select.width-unit, "+ c+" select.height-unit").val(a)}).on("click",".library",function(){d.openWindow("library");a.hide()})},onApply:function(){var a,c=this.getWorkspace(),b=this.getStrValue(".name"),d=this.getIntValue(".width"),e=this.getIntValue(".height"),f=this.getIntValue(".bg");if(c.validateImageSize(d)&&c.validateImageSize(e)){switch(f){case 0:a=[0,0,0,0];break;case 1:a=[255,255,255,1];break;case 2:a=[0,0,0,1];break;case 3:a=c.getParam("backgroundColor");break;case 4:a=c.getParam("foregroundColor")}c.newTab({name:b, width:d,height:e,hasBackground:0 section").css({"background-image":'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAOklEQVQ4je3PMQoAMAwCwPz/q+5xCvYLBjq0oOAmBxYgOW2OtStAKiPNsXYBAz4BNkc3+8HlgAH34AGSYSYzwWQ+CQAAAABJRU5ErkJggg==")'}):$(".pico-tab > section").css({"background-image":"none"})}}).addElement({type:picozu.CONTROL_CHECKBOX,legend:l("%Snap to Edges"),handle:"ptm-snap-tab",tips:l("%settings.snapedges"),property:"ptmSnapTab",checked:a.getSetting("snapTab"), callback:function(c){a.setSetting("snapTab",c)}}).addElement({type:picozu.CONTROL_CHECKBOX,legend:l("%Snap to Layers"),handle:"ptm-snap-layers",tips:l("%settings.snaplayers"),property:"ptmSnapLayers",checked:a.getSetting("snapLayers"),callback:function(c){a.setSetting("snapLayers",c)}}).addElement({type:picozu.CONTROL_CHECKBOX,legend:l("%Show Tips"),handle:"ptm-show-tips",tips:l("%settings.showtips"),property:"ptmShowTips",checked:a.getSetting("showTips"),callback:function(c){!0===c?a.heap.tipsInterval= setInterval(function(){a.showTip()},12E4):clearInterval(a.heap.tipsInterval);a.setSetting("showTips",c)}}).addElement({type:picozu.CONTROL_SELECT,legend:l("%autosave"),handle:"ptm-autosave",tips:l("%settings.autosave"),property:"ptmAutosave",value:a.getSetting("autosave"),data:picozu.AUTOSAVE_INTERVALS,callback:function(c){!0===c&&!0===a.isOnline()?a.heap.autosaveInterval=setInterval(function(){a.autosave()},parseInt(c)):clearInterval(a.heap.autosaveInterval);a.setSetting("autosave",c)}}).addFooter('')},onDestroy:function(){this.getWorkspace().getSelectedLayer().select()}}); picozu.WINDOWS.push({name:l("%Help Contents"),handle:"helpcontents",center:!0,width:800,resizable:!0,template:'

                  '+l("%main.help.text1")+"


                  • "+l("%main.help.text4")+"
                  • "+l("%main.help.text5")+"
                  • "+l("%main.help.text6")+"
                  • "+l("%main.help.text7")+"
                  • "+l("%main.help.text8")+"
                  • "+l("%main.help.text9")+"
                  • "+l("%main.help.text10")+"

                  "+l("%main.help.text2")+'


                  '+l("%main.help.text3")+"


                  "+l("%library version")+" "+picozu.VERSION+' © 2011-2018 Picozu


                  '+l("%help.search.tip")+'

                  '+l("%picozu.shooter.text1")+"


                  "+l("%picozu.shooter.text2")+'

                  • Ctrl + Z '+ l("%Undo last action")+"
                  • Ctrl + C "+l("%Copy selection")+"
                  • Ctrl + X "+l("%Cut selection")+"
                  • Ctrl + V "+l("%Paste selection")+"
                  • Ctrl + A "+l("%Select all")+"
                  • Ctrl + D "+l("%Select none")+"
                  • Insert "+l("%Duplicate layer")+"
                  • Delete "+l("%Delete layer")+"
                  • Pg Up "+l("%Select next layer")+"
                  • Pg Down "+l("%Select previous layer")+ "
                  • Ctrl + 1 "+l("%Toggle dockbar")+"
                  • Ctrl + 2 "+l("%Toggle toolbar")+"
                  • Ctrl + 3 "+l("%Toggle propbar")+"
                  • Ctrl + 0 "+l("%Close toolbar, dockbar and propbar")+"
                  • Ctrl + Shift + D "+l("%Open debugger")+"
                  • Ctrl + Shift + N "+l("%New layer")+"
                  • Alt + Ctrl + X "+l("%Close image")+"
                  • Esc "+l("%Quit tool")+'
                  • Left '+ l("%Move layer left")+"
                  • Right "+l("%Move layer right")+"
                  • Up "+l("%Move layer up")+"
                  • Down "+l("%Move layer down")+"
                  • F1 "+l("%Help")+"
                  • F11 "+l("%Toggle fullscreen mode")+"
                  • Ctrl + N "+l("%New image")+"
                  • Ctrl + S "+l("%Save image")+"
                  • Alt + Ctrl + I "+l("%Resize image")+"
                  • Alt + Ctrl + C "+l("%Canvas image")+"
                  • Ctrl + I "+ l("%Image info")+"
                  • Ctrl + Y "+l("%Image reset")+"
                  • Ctrl + Shift + ] "+l("%Bring to Front")+"
                  • Ctrl + ] "+l("%Bring Forward")+"
                  • Ctrl + Shift + [ "+l("%Send to Back")+"
                  • Ctrl + [ "+l("%Send Backward")+"
                  • Ctrl + K "+l("%Settings")+"
                  • Ctrl + F "+l("%Flatten Layers")+"
                  ",onCreate:function(){var a=this.getWorkspace(),c=this.getElementId(), b=navigator.userAgent.toLowerCase();$(c+" .tabs").tabs();!0===a.isLoggedIn()&&$(c+" .account").hide();-1"+l("%picozu.shooter.installed")+"").show():$(c+" .shooter-installed").empty().append(''+l("%Install Picozu Shooter")+"").show():-1"+ l("%picozu.shooter.installed")+"").show():$(c+" .shooter-installed").empty().append(''+l("%Install Picozu Shooter")+"").show());$(c).on("keyup.picozu",".pico-search-input",function(b){13===b.keyCode&&(b=$(".pico-search-input").val(),$(c+" .pico-search-input").val(""),""!=b&&3"+a.posts[d].content+ "";$(c+" .help-contents").empty().append(b).fadeIn()},null,"json")):a.notify(l("%search.errorempty"),!0));return!1}).on("click",".install-shooter-fx",function(){a.installFirefoxShooter();return!1}).on("click",".install-shooter-safari",function(){a.installSafariShooter();return!1}).on("click",".help-contents a",function(){return!1}).on("click",".bookmark",function(){a.infoWindow(l("%Info"),l("%bookmark.button"));return!1}).on("click",".account",function(){a.openWindow("account");return!1}).on("click", ".tutorials li a",function(){var c=$(this).data("id");a.dispatchAction(picozu.ACTION_OPEN_YOUTUBE_PLAYER,c)})}}); picozu.WINDOWS.push({name:l("%export.palette"),handle:"colorpalette",width:300,modal:!0,onCreate:function(){this.addElement({type:picozu.CONTROL_IMAGE,image:picozu.DEFAULT_PATH+"images/windows/colorpalette/splash.png"}).addElement({type:picozu.CONTROL_SEPARATOR}).addElement({type:picozu.CONTROL_SELECT,legend:l("%main.saveas"),legendClass:"legend",handle:"pico-palette-saveas",data:picozu.DEFAULT_COLOR_PALETTES}).addFooter(picozu.DEFAULT_WINDOW_FOOTER)},onApply:function(){this.getWorkspace().exportColorPalette(this.getIntValue("#pico-palette-saveas"))}}); var Import={fromPZI:function(a){a=JSON.parse(a);a.d=!0===a.e?JSON.parse(picozu.objects.crypter.decryptString(a.d,picozu.ENCRYPT_KEY)):JSON.parse(picozu.objects.crypter.base64Decode(a.d));return a},fromPZW:function(a){a=JSON.parse(a);a.d=!0===a.e?JSON.parse(picozu.objects.crypter.decryptString(a.d,picozu.ENCRYPT_KEY)):JSON.parse(picozu.objects.crypter.base64Decode(a.d));return a},fromPSD:function(){return!1},fromSVG:function(){return!1},fromASE:function(a){function c(a){var c,b;c=a[0].toString(16); 2>c.length&&(c="0"+c);b=a[1].toString(16);2>b.length&&(b="0"+b);a=a[2].toString(16);2>a.length&&(a="0"+a);return c+b+a}function b(a){for(var c,b="",d=a.getUint16();0<--d;)c=a.getUint16(),b+=String.fromCharCode(c);a.getUint16();return b}function d(a,f){for(var g,j,r,p,q,u;0<=--e;)switch(g=a.getUint16(),g){default:return!1;case 49153:a.getUint32();g=b(a);f.groups||(f.groups=[]);f.groups.push(g={name:g});if(d(a,g))return!1;continue;case 49154:return a.getUint32(),0;case 2:e++;continue;case 1:switch(a.getUint32(), g=b(a),j=a.getString(4),f.colors||(f.colors=[]),f.colors.push(g={name:g,model:j}),j){case "CMYK":r=a.getFloat32();p=a.getFloat32();j=a.getFloat32();q=a.getFloat32();g.cmyk=[r,p,j,q];1<=q?r=q=p=0:(r=r*(1-q)+q,p=p*(1-q)+q,j=j*(1-q)+q,r=1-r,q=1-p,p=1-j,r=Math.min(255,Math.max(0,Math.round(255*r))),q=Math.min(255,Math.max(0,Math.round(255*q))),p=Math.min(255,Math.max(0,Math.round(255*p))));h.push(c(g.rgb=[r,q,p]));break;case "RGB ":r=a.getFloat32();q=a.getFloat32();p=a.getFloat32();g.ase_rgb=[r,q,p]; r=Math.min(255,Math.max(0,Math.round(255*r)));q=Math.min(255,Math.max(0,Math.round(255*q)));p=Math.min(255,Math.max(0,Math.round(255*p)));h.push(c(g.rgb=[r,q,p]));break;case "LAB ":j=a.getFloat32();r=a.getFloat32();p=a.getFloat32();g.lab=[j,r,p];j=(j+16)/116;u=r/500+j;p=j-p/200;j=0.008856f.getInt16()||0>f.getInt16()||1>(e=f.getInt32()))return!1;d(f,g);return{palette:g,flattened:h}},_curvesGet:function(a){var c=[],b={},d=0;for(d in a)c.push(Import._curveGet(a[d]));b.a=c[0];b.r=c[1];b.g=c[2];b.b=c[3];for(d in b){a=b[d].getLowestAbove(0)-1;for(c=0;c<=b[d].length;c++)0==b[d][c]&&(b[d][c]=a)}return b},_curveGet:function(a){var c=function(a,c){var b, d,e,f,g,p,q,u,t,v,w;q=a.length;e=[];p=[];b=[];d=[];f=[];u=[];g=0;for(t=q-1;0<=t?gt;0<=t?g+=1:g-=1)e[g]=(c[g+1]-c[g])/(a[g+1]-a[g]),0v;0<=v?g+=1:g-=1)0===e[g]&&t.push(g);v=0;for(w=t.length;vt;0<=t?g+=1:g-=1)b[g]=p[g]/e[g],d[g]=p[g+1]/e[g],f[g]=Math.pow(b[g],2)+Math.pow(d[g],2),u[g]=3/Math.sqrt(f[g]);t=[];g=0;for(v=q-1;0<=v?gv;0<=v?g+=1:g-=1)9=c?0>=b:0<=b)&&!(this.x[b]<=a);0>=c?b+=1:b-=1);c=this.x[b+1]-this.x[b];a=(a-this.x[b])/c;d=Math.pow(a,2);e=Math.pow(a,3);return(2*e-3*d+1)*this.y[b]+(e-2*d+a)*c*this.m[b]+(-2*e+3*d)*this.y[b+1]+(e-d)*c*this.m[b+1]};var b=[],d=[],e=[],f,g;for(g=0;g=g;g++)b[g]=Math.round(cubicSpline.interpolate(g))||0;return b},_curvesPhotoshopLoad:function(a){var c={rgb:[],r:[],g:[],b:[]};a=new jDataView(a);a.seek(4);var b=a.getUint16(),d=["r","g","b"],e,f,g,h,j;c.rgb.push([0,a.getUint16()]);a.seek(a.tell()+2);for(h=1;hh;h++){b=a.getUint16();e=c[d[h]];for(j=0;j(j=0!==d?0:j),j=Math.abs(j),k=Math.floor(j),m=j-k,n;for(a=f;a;g[--a]=0);for(a=b+2;k&&a;g[--a]=k%2,k=Math.floor(k/2));for(a=b+1;0=c&&e<=b?a+1:b+1-(e=c-1)))+1]){if(!(n=g[j]))for(m=j+2;!n&&ma-2?-1:a-3;++a=c&&e<=b?++a:e>=1);m=j=0;a=(b=(h?"1":"0")+b+g.slice(a,a+23).join("")).length;for(c=[];a;m=(m+1)%8)j+=(1<c;c++)a+=String.fromCharCode(0,0,0);return picozu.objects.crypter.base64Encode(a)}, toGIMP:function(a){return picozu.objects.crypter.base64Encode("GIMP Palette\nName:Picozu Color Palette\n"+Export._convertColors(picozu.FILE_FORMAT_GMP,a))},toPNG:function(a){return a.toDataURL("image/png")},toBinary:function(a){return a.getContext().getImageData(0,0,a.getWidth(),a.getHeight()).data},toCSS:function(a,c,b){var d="sprite",e=0,f=1,g="",h="",h="";$.each(b,function(a,c){"spriteName"===c.name&&(d=c.value.replace(/ /g,""));"cssFormat"===c.name&&(f=parseInt(c.value));"embedImage"===c.name&& (e=parseInt(c.value))});if(1===f){b="."+d+' {\n\tbackground: url("'+(0===e?"sprites.png":c)+'") no-repeat;\n\tdisplay: block;\n}\n\n';var j="."+d+".{classname} {\n{rules}}\n\n";for(c=0;cb?b*(1+c):b+c-b*c,e=2*b-d;b=this.hue_to_rgb(e,d,a+1/3);c=this.hue_to_rgb(e,d,a); a=this.hue_to_rgb(e,d,a-1/3)}return[255*b,255*c,255*a]},rgb2hsv:function(a,c,b){var d=0;a/=255;c/=255;b/=255;var e=Math.min(a,Math.min(c,b)),f=Math.max(a,Math.max(c,b));if(e===f)return[0,0,e];d=60*((a===e?3:b===e?1:5)-(a===e?c-b:b===e?a-c:b-a)/(f-e));return[d,(f-e)/f,f]},hsv2rgb:function(a,c,b){var d,e,f,g=Math.floor(6*a),h=6*a-g;a=b*(1-c);var j=b*(1-h*c);c=b*(1-(1-h)*c);switch(g%6){case 0:d=b;e=c;f=a;break;case 1:d=j;e=b;f=a;break;case 2:d=a;e=b;f=c;break;case 3:d=a;e=j;f=b;break;case 4:d=c;e=a; f=b;break;case 5:d=b,e=a,f=j}return[255*d,255*e,255*f]},rgb2xyz:function(a,c,b){a/=255;c/=255;b/=255;a=0.04045this},a))||0}; CanvasRenderingContext2D.prototype.roundRect=function(a,c,b,d,e,f){"undefined"===typeof e&&(e=10);this.beginPath();this.moveTo(a+e,c);this.lineTo(a+b-e,c);this.quadraticCurveTo(a+b,c,a+b,c+e);this.lineTo(a+b,c+d-e);this.quadraticCurveTo(a+b,c+d,a+b-e,c+d);this.lineTo(a+e,c+d);this.quadraticCurveTo(a,c+d,a,c+d-e);this.lineTo(a,c+e);this.quadraticCurveTo(a,c,a+e,c);this.closePath();"undefined"===typeof f||!1===f?this.stroke():this.fill()}; String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1)}; (function(){var a=!1,c=/xyz/.test(function(){xyz})?/\b__super\b/:/.*/;this.Class=function(){};Class.extend=function(b){function d(){!a&&this.__constructor&&this.__constructor.apply(this,arguments)}var e=this.prototype;a=!0;var f=new this;a=!1;for(var g in b)f[g]="function"==typeof b[g]&&"function"==typeof e[g]&&c.test(b[g])?function(a,c){return function(){var b=this.__super;this.__super=e[a];var d=c.apply(this,arguments);this.__super=b;return d}}(g,b[g]):b[g];d.prototype=f;d.prototype.constructor= d;d.extend=arguments.callee;return d}})(); picozu.objects.control=Class.extend({heap:{},parent:null,template:"",getWorkspace:function(){return this.parent},getParent:function(){return this.parent},lock:function(){this.movable=!1;return this},setIntValue:function(a,c){this.setValue(a,parseInt(c));return this},setValue:function(a,c){$(this.getElementId()+" "+a).val(c);return this},getValue:function(a){return $(this.getElementId()+" "+a).val()},getIntValue:function(a){return parseInt(this.getValue(a))},getStrValue:function(a){return this.getValue(a).toString()}, getBoolValue:function(a){return $(this.getElementId()+" "+a).prop("checked")},createButton:function(a){a.accept=a.accept||!1;a.cssClass=a.cssClass||"";a.label=a.label||l("%main.ok");return''},unlock:function(){this.movable=!0;return this},isResizeable:function(){return this.resizeable},isCenter:function(){return this.center},isModal:function(){return this.modal},isMovable:function(){return this.movable}, isSystem:function(){return this.system},empty:function(){$(this.getElementId()+" > section").empty();return this},getName:function(){return this.name},setName:function(a){this.name=a;return this},getControlType:function(){return this.controlType},isVisible:function(){return this.visible},toggle:function(){!0===this.isVisible()?this.hide():this.show();return this},getHandle:function(){return this.handle},getId:function(){return this.id},getElementHandle:function(){return"pico-"+this.getControlType()+ "-"+this.getId()},getElementId:function(){return"#"+this.getElementHandle()},cleanHeap:function(){this.heap={};return this},addFooter:function(a){$(this.getElementId()).append("
                  "+a+"
                  ");return this},resize:function(){this.onResize.call(this);return this},move:function(a,c){this.left=a;this.top=c;$(this.getElementId()).css({top:this.top+"px",left:this.left+"px"});return this},injectHtml:function(a){switch(this.getControlType()){case "dockbar":case "toolbar":case "window":$(this.getElementId()+ " > section").append(a);break;case "buttonGroup":$(this.getElementId()+" > div").append(a);break;case "menu":$(".picozu > header > .header").append(a);break;case "contextmenu":$(".picozu").append(a);break;default:$(this.getElementId()).append(a)}return this},show:function(){if(!1===this.isVisible()){this.visible=!0;if("panel"===this.getControlType()){var a=this.parent.getElementId();"dockbar"===this.parent.getControlType()?$(a+" "+this.getElementId()+" > section").fadeIn():"propbar"===this.parent.getControlType()&& ($(a+" "+this.getElementId()).fadeIn(),this.parent.show())}else if("buttonGroup"===this.getControlType())$(this.getElementId()+" div").fadeIn(),$(this.getElementId()).css({height:"32px"}).addClass("pressed");else{if("window"===this.getControlType()){var c=$(this.getElementId());!0===this.isModal()&&c.parent(".pico-modal-overlay").fadeIn();c.fadeIn();!0===this.isCenter()&&(this.getWorkspace(),a=$(".picozu > section").width()/2-c.width()/2,c=$(".picozu > section").height()/2-c.height()/2,this.move(a, c))}else $(this.getElementId()).fadeIn();$(".pico-taskbar .pico-task."+this.getControlType()+'[data-id="'+this.getId()+'"]').addClass("open")}this.onShow.call(this)}return this},hide:function(){if(!0===this.isVisible()){this.visible=!1;if("panel"===this.getControlType()){var a=this.parent.getElementId();"dockbar"===this.parent.getControlType()?$(a+" "+this.getElementId()+" > section").hide():"propbar"===this.parent.getControlType()&&$(a+" "+this.getElementId()).hide()}else"buttonGroup"===this.getControlType()? ($(this.getElementId()+" div").fadeOut(),$(this.getElementId()).css({width:"32px","padding-left":"0",height:"32px"}).removeClass("pressed")):("window"===this.getControlType()?(a=$(this.getElementId()),!0===this.isModal()&&a.parent(".pico-modal-overlay").fadeOut(),a.fadeOut()):$(this.getElementId()).fadeOut(),$(".pico-taskbar .pico-task."+this.getControlType()+'[data-id="'+this.getId()+'"]').removeClass("open"));this.onHide.call(this)}return this},onRedraw:function(){},onResize:function(){},onApply:function(){}, onBuild:function(){},onCreate:function(){},onDestroy:function(){},onShow:function(){},onHide:function(){},onClick:function(){},onDblClick:function(){},destroy:function(){this.__destructor()},addButton:function(a){a.mode="undefined"!==typeof a.mode?a.mode:"input";a.type="undefined"!==typeof a.type?a.type:"ok";a.title="undefined"!==typeof a.title?a.title:!1;var c="";"input"===a.mode?c+='':"a"===a.mode&&(c+=">"+a.value+"");return c},addElement:function(a,c){var b="",d=null,e=this,f=null,g=null,h="",j="";"window"!==this.getControlType()&&(j=this.parent.getElementId());"undefined"!==typeof c&&(h=" "+c);d=j+" "+this.getElementId();f=d+" section"+h;switch(a.type){case picozu.CONTROL_SLIDER_COMBO:a.value1= "undefined"!==typeof a.value1?a.value1:0;a.step1="undefined"!==typeof a.step1?a.step1:1;a.minValue1="undefined"!==typeof a.minValue1?a.minValue1:-100;a.maxValue1="undefined"!==typeof a.maxValue1?a.maxValue1:100;d=a.onCreate instanceof Function?a.onCreate:function(){$(this).parent().children(".pico-slider-value").val(a.value1)};g=a.onSlide instanceof Function?a.onSlide:function(c,b){$(this).parent().children(".pico-slider-value").val(b.value);e.getWorkspace().setParam(a.property1,b.value);a.callback instanceof Function&&a.callback.call(e.getWorkspace(),b.value)};f=a.onStop instanceof Function?a.onStop:function(){};b='
                  ';!1!==a.legend1&&(b+=""+a.legend1+"");b+='
                  ';$(this.getElementId()+" section"+h).append(b);$("#"+a.handle1).slider({value:a.value1,min:a.minValue1,max:a.maxValue1,step:a.step1,create:d,slide:g,stop:f});$("#"+a.handle1).parent().children(".pico-slider-value").on("keyup.picozu",function(){var c=$(this).val();ca.minValue1&&$(this).parent().find(".pico-slider").slider("option","value",c)}).on("focusout",function(){var c=$(this).val();ca.minValue1&& $(this).parent().find(".pico-slider").slider("option","value",c)});$(".picozu").on("click","#"+a.handle2+" .arrowleft",function(){var c=$(this).parent().children(".pico-textinput"),b=parseInt(c.val())-1;b>=a.minValue2&&(c.val(b),"undefined"!==typeof a.property2&&e.getWorkspace().setParam(a.property2,b),a.callback instanceof Function&&a.callback.call(e.getWorkspace(),b))});$(".picozu").on("click","#"+a.handle2+" .arrowright",function(){var c=$(this).parent().children(".pico-textinput"),b=parseInt(c.val())+ 1;b<=a.maxValue2&&(c.val(b),"undefined"!==typeof a.property2&&e.getWorkspace().setParam(a.property2,b),a.callback instanceof Function&&a.callback.call(e.getWorkspace(),b))});$(".picozu").on("change","#"+a.handle2+" .pico-textinput",function(){var c=$(this),b=parseInt(c.val());(b>a.maxValue2||ba.maxValue2||b"+a.legend+"");b+='
                  ';$(j+" "+this.getElementId()+" section"+h).append(b);$(j+" #"+a.handle).slider({value:a.value,min:a.minValue,max:a.maxValue,step:a.step,create:d,slide:g,stop:f});$(j+" #"+a.handle).parent().children(".pico-slider-value").on("change",function(){var c=$(this).val();ca.minValue&&$(this).parent().find(".pico-slider").slider("option","value",c)}).on("focusout",function(){var c=$(this).val();ca.minValue&&$(this).parent().find(".pico-slider").slider("option","value",c)});break;case picozu.CONTROL_SEPARATOR:$(f).append("
                  ");break;case picozu.CONTROL_LEFTRIGHT:a.step="undefined"!==typeof a.step?a.step:1;b="";!1!==a.legend&&(b+=''+a.legend+"");"undefined"!==typeof a.extra&&(b+=a.extra);b+="
                  ';$(f).append(b);$(d).on("click","."+a.controlClass+" .arrowleft",function(){var c=$(this).parent().children(".pico-textinput"),b=parseFloat(c.val())-a.step;b>=a.minValue&&(c.val(b),"undefined"!==typeof a.property&&e.getWorkspace().setParam(a.property,b), a.callback instanceof Function&&a.callback.call(e.getWorkspace(),b))}).on("click","."+a.controlClass+" .arrowright",function(){var c=$(this).parent().children(".pico-textinput"),b=parseFloat(c.val())+a.step;b<=a.maxValue&&(c.val(b),"undefined"!==typeof a.property&&e.getWorkspace().setParam(a.property,b),a.callback instanceof Function&&a.callback.call(e.getWorkspace(),b))}).on("keyup.picozu","."+a.controlClass+" .pico-textinput",function(c){var b=$(this),d=parseFloat(b.val());13===c.keyCode&&(/\D/.test(d)? b.addClass("error"):((d>a.maxValue||da.maxValue||b";"undefined"!==typeof a.legend&&(b+=""+a.legend+" "+("undefined"!==typeof a.tips?'?':"")+"");b+="';$(f).append(b);if("string"===typeof a.data)$.ajax({url:a.data,dataType:"jsonp",success:function(c){$.each(c,function(c,b){"undefined"!==typeof a.special&&"font"===a.special?k.push('"):k.push('")});$("select#"+a.handle).append(k.join(""))}});else if("object"===typeof a.data){for(h=0;h'+a.data[h].name+""):k.push("");$("select#"+a.handle).append(k.join(""))}$(d).on("change","select#"+a.handle,function(){var c=$(this).val();"undefined"!==typeof a.property&&e.getWorkspace().setParam(a.property,c);a.callback instanceof Function&&a.callback.call(e.getWorkspace(),c)}); break;case picozu.CONTROL_CHECKBOX:b="
                  ';$(f).append(b);$(d).on("click","#"+a.handle,function(){var c=!0===$(this).prop("checked")?!0: !1;e.getWorkspace().setParam(a.property,c);a.callback instanceof Function&&a.callback.call(e.getWorkspace(),c)});break;case picozu.CONTROL_FILE_UPLOAD:b="
                  '+a.title+'
                  ';$(f).append(b);$(d).on("change","#"+a.handle+"_upl",function(c){c=c||window.event;c.preventDefault();c=c.originalEvent||c;e.getWorkspace().loadFile(c.target.files[0], a.callback)}).on("click","#"+a.handle+"_btn",function(){$("#"+a.handle+"_upl").trigger("click");return!1});break;case picozu.CONTROL_OPTIONBOX:b='
                  '+a.legend+"";if("undefined"!==typeof a.options)for(h=0;h"+a.options[h].legend+'';$(f).append(b+"
                  ");$(d).on("click", "#"+a.handle+" .pico-optionbox",function(){var c=$(this).val();e.getWorkspace().setParam(a.property,c);a.callback instanceof Function&&a.callback.call(e.getWorkspace())});break;case picozu.CONTROL_BUTTONGRID_TOGGLE:b='
                  ';for(h=0;h';b+="
                  ";$(f).append(b);$(d).on("click","."+a.controlClass+" .pico-button",function(){var c=$(this),b=c.data("id");c.toggleClass("selected");c.hasClass("selected")?c.data("value",a.buttons[b].states[1]):c.data("value",a.buttons[b].states[0]);c=c.data("value");"undefined"!==typeof a.buttons[b].property&&e.getWorkspace().setParam(a.buttons[b].property,c);a.callback instanceof Function&&a.callback.call(e.getWorkspace(),c,a.buttons[b].property)});break;case picozu.CONTROL_BUTTONGRID:b='
                  ';for(h=0;h';b+="
                  ";$(f).append(b);$(d).on("click","."+a.controlClass+" .pico-button",function(){$("."+a.controlClass+" > .pico-button").removeClass("selected"); var c=$(this),b=c.data("value");c.addClass("selected");"undefined"!==typeof a.property&&e.getWorkspace().setParam(a.property,b);a.callback instanceof Function&&a.callback.call(e.getWorkspace(),b)});break;case picozu.CONTROL_BUTTON:b='
                  '+a.legend+"
                  ";$(f).append(b);$(d).on("click","#"+a.handle,function(){a.callback.call(e.getWorkspace())});break;case picozu.CONTROL_TEXTINPUT:b="
                  "+a.legend+" "+("undefined"!==typeof a.tips?'?':"")+"
                  ";$(f).append(b);$(d).on("keyup.picozu","#"+a.handle,function(c){13===c.keyCode&&(c=$(this).val(),a.callback instanceof Function&&a.callback.call(e.getWorkspace(),c))}).on("focusout","#"+a.handle,function(){var c=$(this).val();a.callback instanceof Function&&a.callback.call(e.getWorkspace(),c)});if("undefined"!==typeof a.autoselect&&!0===a.autoselect)$(d).on("focus","#"+a.handle,function(){var a=$(this);a.select();a.mouseup(function(){a.unbind("mouseup");return!1})}); break;case picozu.CONTROL_TEXTINPUT_FILE:b="
                  "+a.legend+" "+("undefined"!==typeof a.tips?'?':"")+'.'+a.extension+"
                  ";$(f).append(b);$(d).on("keyup.picozu","#"+a.handle,function(c){13===c.keyCode&&(c=$(this).val(),a.callback instanceof Function&&a.callback.call(e.getWorkspace(),c))}).on("focusout","#"+a.handle,function(){var c=$(this).val();a.callback instanceof Function&&a.callback.call(e.getWorkspace(),c)});if("undefined"!==typeof a.autoselect&&!0===a.autoselect)$(d).on("focus", "#"+a.handle,function(){var a=$(this);a.select();a.mouseup(function(){a.unbind("mouseup");return!1})});break;case picozu.CONTROL_TEXTAREA:b="
                  "+a.legend+" "+("undefined"!==typeof a.tips?'?':"")+''); $("#"+d+" .pico-textform").focus().data("editing","true").css("font-family",this.workspace.getParam("fontFamily")).css("line-height",this.workspace.getParam("fontSize")+"px").css("font-size",this.workspace.getParam("fontSize")).css("font-style",this.workspace.getParam("fontStyle")).css("text-decoration",this.workspace.getParam("fontDecoration")).css("font-weight",this.workspace.getParam("fontWeight")).css("text-align",this.workspace.getParam("fontAlign")).css("color","#"+Color.rgb2hex(f[0],f[1],f[2])).css("opacity", this.workspace.getParam("opacity")/10);$("#"+d+" .pico-textform-helper").css("left",e.x1-2).css("top",e.y1-3).show();$(".pico-textform-helper").on("click",".validate",function(){var a=$("#"+d+" .pico-textform").val(),c=$("#"+d+" .pico-textform").width(),f=$("#"+d+" .pico-textform").height();$(".pico-textform-helper").remove();$.fn.tipsy.revalidate();b.workspace.newLayerText(a,{left:e.x1,top:e.y1,width:c,height:f+10});b.workspace.doTool(null);b.workspace.parameters.isCreatingText=!1});$(".pico-textform-helper").on("click", ".invalidate",function(){$(".pico-textform-helper").remove();$.fn.tipsy.revalidate()})}}}); picozu.tools.crop=picozu.objects.tool.extend({start:function(a,c){this.prevX=a;this.prevY=c;var b=this.layer.getContext();b.lineWidth=this.workspace.getParam("brushSize");var d=this.workspace.getParam("foregroundColor");4>d.length&&d.push(0.5*this.workspace.getParam("opacity"));b.strokeStyle=Color.color2Exp("rgba",d)},move:function(a,c,b){var d=this._normalizeTempCoords(this.prevX,this.prevY,a,c);b.lineWidth=1;b.fillStyle=picozu.OVERLAY_COLOR_CROP;b.fillRect(d.x1,d.y1,d.x-d.x1,d.y-d.y1);this.workspace.updateInfoPanel({x:this.prevX, y:this.prevY,w:a-this.prevX,h:c-this.prevY})},end:function(a,c){var b=Others.normCoords(this.prevX,this.prevY,a,c),d=0<=b.width?b.startX:b.endX,e=0<=b.height?b.startY:b.endY;this.workspace.getSelectedTab().crop(d,e,Math.abs(b.width),Math.abs(b.height));this.workspace.doTool(null)}}); picozu.tools.pencil=picozu.objects.tool.extend({start:function(a,c){var b=this.layer.getContext(),d=this.workspace.getParam("foregroundColor"),e=this.workspace.getParam("backgroundColor");this.prevX=a;this.prevY=c;b.lineWidth=this.workspace.getParam("brushSize");b.globalCompositeOperation="source-over";b.strokeStyle="rgba("+d[0]+","+d[1]+","+d[2]+","+0.5*this.workspace.getParam("opacity")+")";b.fillStyle="rgba("+e[0]+","+e[1]+","+e[2]+","+0.5*this.workspace.getParam("opacity")+")";b.beginPath();b.moveTo(a, c)},end:function(a,c,b,d){a=this.layer.getContext();a.closePath();d&&d.shiftKey&&(a.stroke(),a.fill())},move:function(a,c){var b=this.layer.getContext();b.lineTo(a,c);b.stroke();this.prevX=a;this.prevY=c}}); picozu.tools.ellipse=picozu.objects.tool.extend({move:function(a,c,b){a=Others.normCoords(this.prevX,this.prevY,a,c);this.workspace.drawEllipse(b,[[a.startX,a.startY],[a.endX,a.endY]]);this.workspace.updateInfoPanel({x:a.startX,y:a.startY,w:a.width,h:a.height})},end:function(a,c){this.workspace.saveUndo();var b=[],d=Others.normCoords(this.prevX,this.prevY,a,c);b.push([0,0]);b.push([Math.abs(d.width),Math.abs(d.height)]);this.workspace.newLayerShape(picozu.SHAPE_ELLIPSE,{left:0<=d.width?d.startX:d.endX, top:0<=d.height?d.startY:d.endY,width:Math.abs(d.width),height:Math.abs(d.height)},b)}}); picozu.tools.circle=picozu.objects.tool.extend({move:function(a,c,b){a=Others.normCoords(this.prevX,this.prevY,a,c);this.workspace.drawCircle(b,[[a.startX,a.startY],[a.endX,a.endY]]);this.workspace.updateInfoPanel({x:a.startX,y:a.startY,w:a.width,h:a.height})},end:function(a,c){this.workspace.saveUndo();var b=[],d=Others.normCoords(this.prevX,this.prevY,a,c);b.push([0,0]);b.push([Math.abs(d.width),Math.abs(d.height)]);this.workspace.newLayerShape(picozu.SHAPE_CIRCLE,{left:0<=d.width?d.startX:d.endX, top:0<=d.height?d.startY:d.endY,width:Math.abs(d.width),height:Math.abs(d.height)},b)}});picozu.tools.hand=picozu.objects.tool.extend({__constructor:function(a,c,b){this.workspace=b;this.workspace.enableTransformHelper()},__destructor:function(){this.workspace.disableTransformHelper()}}); picozu.tools.ruler=picozu.objects.tool.extend({start:function(a,c){this.prevX=a;this.prevY=c;this.layer.getContext().lineWidth=this.params.brushSize;this.layer.getContext().strokeStyle="rgba("+this.params.foregroundColor[0]+","+this.params.foregroundColor[1]+","+this.params.foregroundColor[2]+","+0.5*this.params.opacity+")"},move:function(a,c,b){a=Others.normCoords(this.prevX,this.prevY,a,c);this.workspace.drawLine(b,[[a.startX,a.startY],[a.startX+a.width,a.startY+a.height]]);this.workspace.updateInfoPanel({x:a.startX, y:a.startY,w:a.width,h:a.height})},end:function(){this.workspace._clearTempCanvas()}});picozu.tools.colorfill=picozu.objects.tool.extend({start:function(a,c){this.workspace.saveUndo();this.workspace.floodFill(a,c)}});picozu.tools.magiceraser=picozu.objects.tool.extend({start:function(a,c){this.workspace.saveUndo();this.workspace.magicErase(a,c)}}); picozu.tools.arrow=picozu.objects.tool.extend({move:function(a,c,b){a=Others.normCoords(this.prevX,this.prevY,a,c);this.workspace.drawArrow(b,[[a.startX,a.startY],[a.startX+a.width,a.startY+a.height]]);this.workspace.updateInfoPanel({x:a.startX,y:a.startY,w:a.width,h:a.height})},end:function(a,c){this.workspace.saveUndo();var b=[],d=Others.normCoords(this.prevX,this.prevY,a,c),e=0<=d.width?d.startX:d.endX,f=0<=d.height?d.startY:d.endY;b.push([d.startX-e,d.startY-f]);b.push([d.endX-e,d.endY-f]);this.workspace.newLayerShape(picozu.SHAPE_ARROW, {left:0<=d.width?d.startX:d.endX,top:0<=d.height?d.startY:d.endY,width:Math.abs(d.width),height:Math.abs(d.height)},b)}}); picozu.tools.roundedRectangle=picozu.objects.tool.extend({move:function(a,c,b){a=Others.normCoords(this.prevX,this.prevY,a,c);this.workspace.drawRoundedRectangle(b,[[a.startX,a.startY],[a.width,a.height]]);this.workspace.updateInfoPanel({x:a.startX,y:a.startY,w:a.width,h:a.height})},end:function(a,c){this.workspace.saveUndo();var b=[],d=Others.normCoords(this.prevX,this.prevY,a,c);b.push([0,0]);b.push([Math.abs(d.width),Math.abs(d.height)]);this.workspace.newLayerShape(picozu.SHAPE_ROUNDED_RECTANGLE, {left:0<=d.width?d.startX:d.endX,top:0<=d.height?d.startY:d.endY,width:Math.abs(d.width),height:Math.abs(d.height)},b)}}); picozu.tools.rectangle=picozu.objects.tool.extend({move:function(a,c,b){a=Others.normCoords(this.prevX,this.prevY,a,c);this.workspace.drawRectangle(b,[[a.startX,a.startY],[a.width,a.height]]);this.workspace.updateInfoPanel({x:a.startX,y:a.startY,w:a.width,h:a.height})},end:function(a,c){this.workspace.saveUndo();var b=[],d=Others.normCoords(this.prevX,this.prevY,a,c);b.push([0,0]);b.push([Math.abs(d.width),Math.abs(d.height)]);this.workspace.newLayerShape(picozu.SHAPE_RECTANGLE,{left:0<=d.width?d.startX: d.endX,top:0<=d.height?d.startY:d.endY,width:Math.abs(d.width),height:Math.abs(d.height)},b)}}); picozu.tools.line=picozu.objects.tool.extend({move:function(a,c,b){a=Others.normCoords(this.prevX,this.prevY,a,c);this.workspace.drawLine(b,[[a.startX,a.startY],[a.startX+a.width,a.startY+a.height]]);this.workspace.updateInfoPanel({x:a.startX,y:a.startY,w:a.width,h:a.height})},end:function(a,c){this.workspace.saveUndo();var b=[],d=Others.normCoords(this.prevX,this.prevY,a,c),e=0<=d.width?d.startX:d.endX,f=0<=d.height?d.startY:d.endY;b.push([d.startX-e,d.startY-f]);b.push([d.endX-e,d.endY-f]);this.workspace.newLayerShape(picozu.SHAPE_LINE, {left:0<=d.width?d.startX:d.endX,top:0<=d.height?d.startY:d.endY,width:Math.abs(d.width),height:Math.abs(d.height)},b)}}); picozu.objects.buttonGroup=picozu.objects.control.extend({controlType:"buttonGroup",parent:null,visible:!0,template:'
                  ',__constructor:function(a){var c=this;this.parent=a.parent;this.id=this.parent.buttons.length;this.name="undefined"!==typeof a.label?a.label:"generic";this.handle="undefined"!==typeof a.handle?a.handle:"";this.template=this.template.replace(/{id}/g, this.getId()).replace(/{icon}/g,this.handle).replace(/{name}/g,this.name);this.parent.injectHtml(this.template);this._load(a.buttons);$(".picozu").on("click",this.getElementId(),function(){c.toggle()});this.hide();this.parent.buttons[this.id]=this;this.onCreate.call(this);this.getWorkspace().log(l("%button group")+" #"+this.getId()+" "+l("%created"),l("%UI"));return this},getWorkspace:function(){return this.parent.parent},_load:function(a){for(var c=0;c"): this.addButton(a[c]);return this},addButton:function(a){var c=a.click instanceof Function?a.click:null;this.parent.buttons[this.parent.buttons.length]=new picozu.objects.button({parent:this.getParent(),onClick:c,handle:a.handle,label:a.label,group:this});return this},removeButton:function(a){a.destroy();return this},getButton:function(a){if("number"===typeof a)return this.parent.buttons[a];if("object"===typeof a)for(var c=0;ca.width()&&(b=a.width());d>a.height()&&(d=a.height());this.selection.style.width= b+"px";this.selection.style.height=d+"px";return this};this._updateMapPosition=function(){var a=parseInt(this.selection.style.left.replace("px","")),b=parseInt(this.selection.style.top.replace("px",""));this.canvas.parentNode.scrollLeft=100*(a/this.ratio);this.canvas.parentNode.scrollTop=100*(b/this.ratio);return this};this._updateMinimapPosition=function(){var a=parseInt(this.canvas.parentNode.scrollLeft),b=parseInt(this.canvas.parentNode.scrollTop),a=a*this.ratio/100,b=b*this.ratio/100;this.selection.style.left= a+"px";this.selection.style.top=b+"px";return this};this.onScrollMinimap=function(a){if(!0===this.selected){a=this._compute(a);var b=this.container.style.width.replace("px",""),d=this.container.style.height.replace("px",""),e=this.selection.style.width.replace("px",""),f=this.selection.style.height.replace("px","");0>a[0]-e/2&&(a[0]=e/2);0>a[1]-f/2&&(a[1]=f/2);a[0]+e/2>b&&(a[0]=b-e/2);a[1]+f/2>d&&(a[1]=d-f/2);"undefined"!==typeof a[0]&&(this.selection.style.left=a[0]-e/2+"px",this.selection.style.top= a[1]-f/2+"px");this._updateMapPosition()}else this.selected=!1};this._bounds=function(){var a=0,b=0,d=this.container;do a+=d.offsetLeft,b+=d.offsetTop;while(d=d.offsetParent);var d=a+parseInt(this.container.style.width.replace("px","")),e=b+parseInt(this.container.style.height.replace("px",""));return[a,b,d,e]};this._compute=function(a){var b=[],d=this._bounds();a.pageX>=d[0]&&(a.pageX<=d[2]&&a.pageY>=d[1]&&a.pageY<=d[3])&&(b=[a.pageX-d[0],a.pageY-d[1]+$("#pico-dockbar-0 > section").scrollTop()]); return b};return this.__constructor(a)}; picozu.objects.button=picozu.objects.control.extend({controlType:"button",parent:null,template:'
                  ',__constructor:function(a){var c=this;this.parent=a.parent;this.id=this.parent.buttons.length;this.name="undefined"!==typeof a.label?a.label:"generic";this.handle="undefined"!==typeof a.handle?a.handle:"";this.template=this.template.replace(/{id}/g,this.getId()).replace(/{icon}/g,this.handle).replace(/{name}/g, this.name).replace(/{handle}/g,this.handle);"undefined"!==typeof a.group?a.group.injectHtml(this.template):this.parent.injectHtml(this.template);$(".picozu").on("click",this.getElementId(),function(){c.onClick.call(c)});this.parent.buttons[this.id]=this;this.onCreate.call(this);this.getWorkspace().log(l("%button")+" #"+this.getId()+" "+l("%created"),l("%UI"));return this},getWorkspace:function(){return this.parent.parent}}); picozu.objects.dockbar=picozu.objects.control.extend({controlType:"dockbar",panels:[],visible:!0,template:'',taskbarTemplate:'
                  {name}
                  ',__constructor:function(a){this.parent=a.parent;this.name="undefined"===typeof a.name?l("%Dockbar"):a.name;this.id=this.parent.dockbars.length;this.handle="undefined"!== typeof a.handle?a.handle:this.getElementHandle();this.template=this.template.replace(/{id}/g,this.getId());this.parent.injectHtml(this.template);this._load(a.panels);this.taskbarTemplate=this.taskbarTemplate.replace(/{id}/g,this.getId()).replace(/{name}/g,this.name);this.getWorkspace().taskbar.injectHtml(this.taskbarTemplate);$(this.getElementId()+" > section").sortable({placeholder:"ui-state-highlight",axis:"y",handle:"header",items:".pico-panel",containment:"parent",opacity:0.8,stop:function(){}}); this.onCreate.call(this);this.parent.dockbars[this.id]=this;this.getWorkspace().log(l("%dockbar")+" #"+this.getId()+" "+l("%created"),l("%UI"));return this},_load:function(a){for(var c=0;c',taskbarTemplate:'
                  {name}
                  ',__constructor:function(a){this.parent=a.parent;this.name="undefined"===typeof a.name?l("%Properties"):a.name;this.id=this.parent.propbars.length;this.handle="undefined"!==typeof a.handle?a.handle: this.getElementHandle();this.template=this.template.replace(/{id}/g,this.getId());this.parent.injectHtml(this.template);this._load(a);this.onCreate.call(this);this.parent.propbars[this.id]=this;this.getWorkspace().log(l("%propbar")+" #"+this.getId()+" "+l("%created"),l("%UI"));return this},_load:function(a){for(var c=0;c';this.templateHelper='
                  ';this.__destructor=function(a){$(this.getElementId()).remove();$(".transform-helper").remove();if("undefined"===typeof a||!0===a)delete this.parent.layers[this.getId()],this.parent.layers.splice(this.getId(), 1),this.parent.heap.lastLayerIndex--;this.getWorkspace().log(l("%layer")+" #"+this.getId()+" "+l("%destroyed"))};this.__constructor=function(a){this._setup(a);this.getWorkspace().log(l("%layer")+" #"+this.getId()+" "+l("%created"));return this};this.setGroup=function(a){this.properties.group=a;return this};this.getGroup=function(){return this.properties.group};this.hasGroup=function(){return null===this.properties.group?!1:!0};this.getType=function(){return this.properties.type};this.getCoords=function(){return this.coords}; this.getText=function(){return this.properties.text};this.getControlType=function(){return this.properties.controlType};this.getHeight=function(){return this.coords.height};this.getWidth=function(){return this.coords.width};this.setHeight=function(a){this.canvas.height=a;this.coords.height=a;return this};this.setWidth=function(a){this.canvas.width=a;this.coords.width=a;return this};this.setText=function(a){this.properties.text=a;return this};this.getWorkspace=function(){return this.parent.parent}; this.getImageData=function(a,b,d,e){return 4===arguments.length?this.getContext().getImageData(a,b,d,e):2===arguments.length?this.getContext().getImageData(a,b,this.getWidth(),this.getHeight()):this.getContext().getImageData(0,0,this.getWidth(),this.getHeight())};this.drawImageData=function(a,b,d){return!1===this.isLocked()?(3===arguments.length?this.getContext().putImageData(a,b,d):this.getContext().putImageData(a,0,0),this.onResize.call(this),this):!1};this.getParameters=function(){return this.parameters}; this._parseParameters=function(){var a=this.getWorkspace(),b,d,e,f,g,h;f=null!==this.parameters.fontColor?this.parameters.fontColor:a.getParam("foregroundColor");b=null!==this.parameters.fontStyle?this.parameters.fontStyle:a.getParam("fontStyle");d=null!==this.parameters.fontWeight?this.parameters.fontWeight:a.getParam("fontWeight");e=null!==this.parameters.fontFamily?this.parameters.fontFamily:a.getParam("fontFamily");h=null!==this.parameters.fontAlign?this.parameters.fontAlign:a.getParam("fontAlign"); g=null!==this.parameters.fontCase?this.parameters.fontCase:a.getParam("fontCase");customStrokeColor=null!==this.parameters.strokeColor?this.parameters.strokeColor:a.getParam("foregroundColor");customFillColor=null!==this.parameters.fillColor?this.parameters.fillColor:a.getParam("backgroundColor");customDrawMode=null!==this.parameters.drawMode?this.parameters.drawMode:a.getParam("drawMode");customShapeBorder=null!==this.parameters.border?this.parameters.border:a.getParam("border");return{fontColor:f, fontStyle:b,fontWeight:d,fontFamily:e,fontCase:g,fontAlign:h,strokeColor:customStrokeColor,fillColor:customFillColor,border:customShapeBorder,drawMode:customDrawMode}};this.drawText=function(){this._clear(0,0,this.getWidth(),this.getHeight());var a=this.getWorkspace(),b=this.getContext(),d=this.getParameter("fontSize"),e=this.getText(),f=this._parseParameters();f.fontCase===picozu.FONT_CASE_UPPERCASE?e=e.toUpperCase():f.fontCase===picozu.FONT_CASE_LOWERCASE&&(e=e.toLowerCase());var e=e.split("\n"), g=e.length;this.setHeight(g*this.getParameter("fontSize"));a._applyDefaultSettings(b);b.textAlign=f.fontAlign;b.font=("italic"===f.fontStyle?f.fontStyle+" ":"")+("bold"===f.fontWeight?f.fontWeight+" ":"")+" "+d+"px "+f.fontFamily;for(var h=0;h section").append(this.templateHelper);!0===b.getSetting("snapTab")&&(d+=" .pico-tab"); !0===b.getSetting("snapLayers")&&(d+=" .pico-layer");""===d&&(d=!1);$(this.parent.getElementId()+" > section > .transform-helper").resizable({helper:"transform-helper-ghost",grid:!0===b.getSetting("snapGrid")?[20,20]:!1,handles:"n, e, s, w, ne, se, sw, nw",resize:function(a,c){var d=b._normalizeCoords(c.position.left,c.position.top);b.updateInfoPanel({x:d.tx,y:d.ty,w:c.size.width,h:c.size.height})},stop:function(d,f){var g=b._normalizeCoords(f.position.left,f.position.top);a.move(g.tx,g.ty);a.resize(f.size.width, f.size.height)}}).draggable({snap:d,scroll:!0,snapTolerance:10,grid:!0===b.getSetting("snapGrid")?[20,20]:!1,drag:function(b,d){a.move(d.position.left,d.position.top);$(".transform-helper .tooltip .left").html(l("%Left")+": "+d.position.left);$(".transform-helper .tooltip .top").html(l("%Top")+": "+d.position.top)},stop:function(){a.parent.isActive()&&b._refreshAll()}});this._adjustHelper();$(this.parent.getElementId()+" > section > .transform-helper").css({"border-color":this.properties.color}).children(".ui-resizable-ne, .ui-resizable-se, .ui-resizable-nw, .ui-resizable-sw").css("background-color", this.properties.color);$("#pico-slider-zoom").slider("option","value",this.getZoom());("hand"!==b.getTool()||!0===this.isLocked())&&b.disableTransformHelper();"freeselect"!==b.getTool()&&b.refreshTool();this.onResize.call(this);return this};this.isPreviewLayer=function(){return this.properties.type===picozu.LAYER_TYPE_PREVIEW?!0:!1};this.isBackgroundLayer=function(){return this.properties.type===picozu.LAYER_TYPE_BACKGROUND?!0:!1};this.isTextLayer=function(){return this.properties.type===picozu.LAYER_TYPE_TEXT? !0:!1};this.setZoom=function(a){this.properties.zoom=a;$(this.getElementId()).css({transform:"scale("+a+")"});this._adjustHelper();return this};this.getZoom=function(){return this.properties.zoom};this.fill=function(a,b,d,e,f){return!1===this.isLocked()?(this.getWorkspace().saveUndo(),this._fill(a,b,d,e,f),this.setFlag("altered",!0),this.onResize.call(this),this.getWorkspace()._refreshAll(!1),this):!1};this.isSelected=function(){return this.getWorkspace().getSelectedLayer()==this?!0:!1};this.rotate= function(a,b){if(!1===this.isLocked()){("undefined"===typeof b||!1===b)&&this.getWorkspace().saveUndo();var d=document.createElement("canvas"),e=this.getWidth(),f=this.getHeight(),g=0,h=0,j=a*Math.PI/180;d.width=e;d.height=f;d.getContext("2d").drawImage(this.getCanvas(),0,0,e,f);switch(a){case 90:e=this.getHeight();f=this.getWidth();h=-1*this.getHeight();break;case 180:g=-1*this.getWidth();h=-1*this.getHeight();break;case 270:e=this.getHeight(),f=this.getWidth(),g=-1*this.getWidth()}this.getCanvas().width= e;this.getCanvas().height=f;this.setWidth(e).setHeight(f);this.getContext().save();this.getContext().rotate(j);switch(a){case 90:this._draw(d,g,h,f,e);break;case 180:this._draw(d,g,h,e,f);break;case 270:this._draw(d,g,h,f,e)}this.getContext().restore();this._adjustHelper();this.onResize.call(this);("undefined"===typeof b||!1===b)&&this.getWorkspace()._refreshAll();return this}return!1};this.flip=function(a,b){if(!1===this.isLocked()){("undefined"===typeof b||!1===b)&&this.getWorkspace().saveUndo(); var d=document.createElement("canvas"),e=this.getWidth(),f=this.getHeight();d.width=e;d.height=f;d.getContext("2d").drawImage(this.getCanvas(),0,0,e,f,0,0,e,f);this._clear(0,0,e,f);this.getContext().save();a===picozu.FLIP_HORIZONTAL?(this.getContext().scale(-1,1),this.getContext().translate(-e,0)):a===picozu.FLIP_VERTICAL&&(this.getContext().scale(1,-1),this.getContext().translate(0,-f));this._draw(d,0,0,e,f);this.getContext().restore();this._adjustHelper();this.onResize.call(this);("undefined"=== typeof b||!1===b)&&this.getWorkspace()._refreshAll();return this}return!1};this.setBlend=function(a,b){return!1===this.isLocked()?(this.properties.blend=a,!0===b&&this.redraw(),this.onResize.call(this),this):!1};this.getBlend=function(){return this.properties.blend};this.hide=function(){this==this.getWorkspace().getSelectedLayer()&&$(".transform-helper").remove();$(this.getElementId()).hide();this.properties.visible=!1;return this};this.show=function(){$(this.getElementId()).show();this.properties.visible= !0;this==this.getWorkspace().getSelectedLayer()&&this._adjustHelper();return this};this.toggleVisibility=function(){!0===this.isVisible()?this.hide():this.show();this.getWorkspace()._refreshAll(!1);this.onResize.call(this);return this};this.toggleLock=function(){!0===this.isLocked()?this.unlock():this.lock();this.onResize.call(this);return this};this.back=function(){this.setPosition(1);for(var a=1;a',submenus:[],__constructor:function(a){var c=this;this.parent=a.parent;this.id=this.parent.menus.length;this.name="undefined"===typeof a.name?"main":a.name;this.cssClass="undefined"!==typeof a.cssClass?a.cssClass:"";this.handle="undefined"!==typeof a.handle?a.handle:this.getElementHandle();this.submenus="undefined"===typeof a.submenus? picozu.MAIN_MENU_DEFS:a.submenus;this.template=this.template.replace(/{id}/g,this.getId()).replace(/{cssClass}/g,""!=this.cssClass?" "+this.cssClass:"");this.injectHtml(this.template);$(this.getElementId()).html(this._load(this.submenus,!1));a.onBuild instanceof Function&&a.onBuild.call(this.parent);$(this.getElementId()+" > ul").superfish();$(this.getElementId()).on("click","ul li a",function(){if(!$(this).parent().hasClass("submenu")){var a=$(this).data("handle");c.callbacks[a]instanceof Function&& c.callbacks[a].call(c.parent)}return!1});0===this.getId()&&(this.getWorkspace().rebuildImporters(),this.getWorkspace().rebuildCurves(),this.getWorkspace().rebuildExporters(),$("#menu-importers-list").on("click","li a",function(){var a=$(this).data("handle");"undefined"!==typeof a&&c.getWorkspace().openWindow(a)}),$("#menu-exporters-list").on("click","li > a",function(){var a=$(this).data("handle");"undefined"!==typeof a&&c.getWorkspace().openWindow(a)}),$("#menu-tools-list").on("click","li > a",function(){var a= $(this).data("handle");"undefined"!==typeof a&&c.getWorkspace().openWindow(a)}),$("#menu-curves-list").on("click","li > a:not(.special)",function(){var a=$(this).data("handle"),d=c.getWorkspace().getStorage("curves"),e=d.findIndexM(a);"undefined"!==typeof a&&(c.getWorkspace().setParam("curves",d[e].curves),c.getWorkspace().addToQueue("curves").processQueue())}),$(this.getElementId()).on("click","#clear-recent-curves",function(){c.getWorkspace().delStorage("curves");c.getWorkspace().rebuildCurves(); return!1}));this.onCreate.call(this);this.parent.menus[this.id]=this;this.getWorkspace().log(l("%menu")+" #"+this.getId()+" "+l("%created"),l("%UI"));return this},_load:function(a,c){var b="";c&&(b=' class="arrows-menu"');for(var b="",d=0;d",a[d].callback instanceof Function&&(this.callbacks[a[d].handle]=a[d].callback);else if("undefined"!==typeof a[d].innerTemplate)b+='",a[d].callback instanceof Function&&(this.callbacks[a[d].handle]=a[d].callback);else{var e="",f="undefined"!==typeof a[d].cssClass?a[d].cssClass+" ":"",g="undefined"!==typeof a[d].id?' id="'+a[d].id+'"':"";a[d].separator?b+='
                •  
                • ':("undefined"!==typeof a[d].submenus&&(f+="submenu"),"undefined"!==typeof a[d].shortcut&&(e=''+a[d].shortcut.toUpperCase()+"",$(document).on("keydown.picozu",null,a[d].shortcut, a[d].callback.bind(this.parent))),a[d].callback instanceof Function&&(this.callbacks[a[d].handle]=a[d].callback),b+="'+a[d].label+e+"","undefined"!==typeof a[d].submenus&&(b+=this._load(a[d].submenus,!0)),b+="")}return b+""}}); picozu.objects.panel=picozu.objects.control.extend({controlType:"panel",visible:!0,template:'
                  {name}
                  {contents}
                  ',__constructor:function(a){var c=this;this.parent=a.parent;this.id=this.parent.panels.length;this.name=a.name;this.handle="undefined"!==typeof a.handle?a.handle:this.getElementHandle();a.onCreate instanceof Function&&(this.onCreate=a.onCreate);a.cssClass= "pico-panel-"+this.handle;this.parent.injectHtml(this.template.replace(/{id}/g,this.getId()).replace(/{name}/g,this.getName()).replace(/{contents}/g,"undefined"!==typeof a.template?a.template:"").replace(/{cssClass}/g,a.cssClass));this.onCreate.call(this);if("dockbar"===this.parent.getControlType())$(this.parent.getElementId()+" "+this.getElementId()).on("dblclick","header",function(a){c.toggle();a.preventDefault();return!1});!0===a.hide&&this.hide();this.parent.panels[this.id]=this;this.getWorkspace().log(l("%panel")+ " #"+this.getId()+" "+l("%created"),l("%UI"));return this},getWorkspace:function(){return this.parent.parent}}); picozu.objects.contextmenu=picozu.objects.control.extend({controlType:"contextmenu",menuID:null,parent:null,template:'',__constructor:function(a){this.parent=a.parent;this.id=this.parent.contextmenus.length;this.target="undefined"!==typeof a.target?a.target:null;this.handle=this.getElementHandle();this._init(a.target,a.submenus);this.onCreate.call(this);this.parent.contextmenus[this.id]=this;this.getWorkspace().log(l("%contextmenu")+" #"+this.getId()+" "+l("%created"), l("%UI"));return this},_init:function(a,c){var b=$(this.template);b.css({display:"none",position:"absolute"}).attr({id:this.getElementHandle()}).appendTo(".picozu");$(a).data("pz_id",this.getElementHandle());$(a).data("pz",$.extend(!0,{},c));this._load(a,b,c,!0);this._create(a)},_create:function(a){var c=this;$(document).on("mousedown",a,function(a){$(".pico-contextmenu").hide();a.stopPropagation();2==a.button&&(c.menuID=$(this).data("mid"),$(c.getElementId()).css({top:a.pageY,left:a.pageX}).fadeIn())})}, _load:function(a,c,b,d){var e=this,f=$("
                    ");!0==("undefined"!==typeof d?d:!0)&&f.show();for(var g in b){d=$("
                  • ");d.attr({id:"menuitem-"+g});switch(typeof b[g]){case "object":if("undefined"!==typeof b[g].label)if(""==b[g].label)d.addClass("separator");else{var h=$('');"string"==typeof b[g].icon?d.append(h.append(' ').append(b[g].label)):(h=$(''+b[g].label+""),d.append(h));b[g].callback instanceof Function&&h.bind("mousedown", {key:g,target:a,callback:b[g].callback},function(a){$(this).parent().hasClass("disabled")||($(".pico-contextmenu").hide(),a.data.callback.call(e.getWorkspace(),a.data.target,e.menuID))});"undefined"!==typeof b[g].disabled&&!0==b[g].disabled&&d.addClass("disabled");"object"==typeof b[g].children&&!d.hasClass("disabled")&&(d.addClass("submenu"),e._load(a,d,b[g].children,!1));d.hasClass("disabled")&&d.children("a").children("i").hide()}break;case "string":d.addClass("separator")}f.append(d)}c.append(f)}}); picozu.objects.tab=function(a){this.properties={controlType:"tab",name:null,handle:null,active:!1,id:null,dirty:!1,ready:!1};this.coords={width:0,height:0};this.activeLayer=this.parent=null;this.template='
                    ';this.templateHelper='
                    ';this.tabButtonTemplate='
                    {name}×
                    ';this.layers=[];this.groups=[];this.heap={exif:null,lastLayerIndex:0,flatten:null};this.undo=[];this.__destructor=function(){this.onDestroy.call(this);$.fn.tipsy.revalidate();this.parent.getSelectedTab()===this&&this.activatePrevious();this.destroyLayers();$(this.getElementId()+" .name").off("click");$(this.getElementId()).remove();$("#pico-tab-header-"+this.getId()).remove();delete this.parent.tabs[this.getId()];this.parent.tabs.splice(this.getId(), 1);this.parent.heap.lastTabIndex--;this.getWorkspace().log(l("%tab")+" #"+this.getId()+" "+l("%destroyed"),l("%UI"))};this.__constructor=function(a){var b=this;this.parent=a.parent;this.properties.id=this.parent.heap.lastTabIndex++;this.coords.width="undefined"!==typeof a.width?a.width:picozu.DEFAULT_WIDTH;this.coords.height="undefined"!==typeof a.height?a.height:picozu.DEFAULT_HEIGHT;this.properties.name="undefined"!==typeof a.name?a.name:l("%untitled")+parseInt(this.getId()+1);this.properties.handle= "undefined"!==typeof a.handle?a.handle:this.getElementHandle();this.template=this.template.replace(/{id}/g,this.getId()).replace(/{name}/g,this.getName());this.tabButtonTemplate=this.tabButtonTemplate.replace(/{id}/g,this.getId()).replace(/{name}/g,this.getName());a.image="undefined"!==typeof a.image?a.image:null;a.imageData="undefined"!==typeof a.imageData?a.imageData:null;this.parent.injectHtml(this.template);b.getWorkspace().showLoader();$(".picozu > header > .subheader").append(this.tabButtonTemplate); this._load(a);$(".subheader").on("click","#pico-tab-header-"+this.getId()+":not(.active)",function(a){b.activate();a.stopPropagation()}).on("click","#pico-tab-header-"+this.getId()+" .close",function(a){b.destroy();a.stopPropagation()}).on("dblclick","#pico-tab-header-"+this.getId(),function(a){b.getWorkspace().openWindow("renameimage");a.stopPropagation()});this.parent.tabs[this.properties.id]=this;this.onCreate.call(this);this.getWorkspace().log(l("%tab")+" #"+this.getId()+" "+l("%created"),l("%UI")); new picozu.objects.contextmenu({target:"#pico-temp-canvas",parent:this.getWorkspace(),submenus:picozu.TAB_CONTEXTMENU_DEFS});return this};this.getExif=function(){return this.heap.exif};this.getBackgroundLayer=function(){return!0===this.layers[1].isBackgroundLayer()?this.layers[1]:!1};this.getPreviewLayer=function(){return this.layers[0]};this.getImageData=function(){this._refreshPreview();return this.getPreviewLayer().getContext()};this.countLayers=function(){return this.layers.length-1};this.getElementId= function(){return"#"+this.getElementHandle()};this.setCoords=function(a,b){this.coords.width=a;this.coords.height=b;$(this.getElementId()+" > section").css({width:a>=this.parent.coords.width?this.parent.coords.width:a,height:b>=this.parent.coords.height?this.parent.coords.height:b});"undefined"!==typeof this.getPreviewLayer()&&(this.getPreviewLayer().setWidth(a),this.getPreviewLayer().setHeight(b));return this};this.getSelectedLayer=function(){return this.activeLayer};this.getCoords=function(){return this.coords}; this.getWidth=function(){return this.coords.width};this.getHeight=function(){return this.coords.height};this.flatten=function(a){this.getWorkspace().saveUndo();this._refreshPreview();"undefined"!==typeof a&&!0===a&&(this.destroyLayers(),(new picozu.objects.layer({parent:this,width:this.getPreviewLayer().getWidth(),height:this.getPreviewLayer().getHeight(),imageData:this.getPreviewLayer().getCanvas()})).select());this.getWorkspace()._refreshAll();return this};this.rotate=function(a){this.getWorkspace().saveUndo(); var b=this.getWidth(),d=this.getHeight();(90===a||270===a)&&this.setCoords(d,b);for(b=1;b section").append(a);return this}; this.changeBackgroundColor=function(a){!0===this.layers[1].isBackgroundLayer()&&this.layers[1].fill(a,0,0,this.layers[1].getWidth(),this.layers[1].getHeight());return this};this.getHandle=function(){return this.properties.handle};this.destroy=function(){var a=this;0
                    ',taskbarTemplate:'
                    {name}
                    ',__constructor:function(a){this.parent=a.parent;this.name="undefined"===typeof a.name?l("%Toolbar"):a.name;this.id=this.parent.toolbars.length; this.handle="undefined"!==typeof a.handle?a.handle:this.getElementHandle();this.template=this.template.replace(/{id}/g,this.getId());this.parent.injectHtml(this.template);a.onBuild instanceof Function&&(this.onBuild=a.onBuild);this._load(a.buttons);this.taskbarTemplate=this.taskbarTemplate.replace(/{id}/g,this.getId()).replace(/{name}/g,this.name);this.getWorkspace().taskbar.injectHtml(this.taskbarTemplate);this.onCreate.call(this);this.parent.toolbars[this.id]=this;this.getWorkspace().log(l("%toolbar")+ " #"+this.getId()+" "+l("%created"),l("%UI"));return this},_load:function(a){var c=this,b=c.getWorkspace();if(0===this.id){var d='
                      ';$(this.getElementId()).append(d);$(this.getElementId()).on("click", ".pico-swatch .colorswitch",function(){var a=b.getParam("backgroundColor");b.setParam("backgroundColor",b.getParam("foregroundColor"));b.setParam("foregroundColor",a)}).on("click",".fgcolor, .bgcolor",function(){b.openWindow("color")}).on("click",".swatchcolor",function(){var a=$(this).data("color"),a=Color.hex2rgb(a);b.setParam("foregroundColor",a);b.updateInfoPanel({rgb:a})}).on("dblclick","header",function(){c.toggleSize()})}$(this.getElementId()).on("click",".pico-button",function(){var a=$(this).data("handle"); $(c.getElementId()+" .pico-wrapGroup").fadeOut();b.doTool(a)});this.onBuild.call(b);$(this.getElementId()).draggable({opacity:0.8,containment:".picozu > section",handle:"header"});for(d=0;d"):"undefined"!==typeof a[d].group?1===b.getCapability(a[d].handle,picozu.SCOPE_APP)&&this.addButtonGroup(a[d]):1===b.getCapability(a[d].handle,picozu.SCOPE_APP)&&this.addButton(a[d]);return this},addButtonGroup:function(a){this.buttons[this.buttons.length]=new picozu.objects.buttonGroup({parent:this, onClick:a.click instanceof Function?a.click:null,buttons:a.group,handle:a.handle,label:a.label});return this},addButton:function(a){this.buttons[this.buttons.length]=new picozu.objects.button({parent:this,onClick:a.click instanceof Function?a.click:null,handle:a.handle,label:a.label});return this},removeButton:function(a){a.destroy();return this},getButton:function(a){if("number"===typeof a)return this.buttons[a];if("string"===typeof a)for(var c=0;c',__constructor:function(a){var c=this,b="";this.parent=a.parent;this.id=0;this.name="undefined"===typeof a.name?"system-taskbar":a.name;this.template=this.template.replace(/{id}/g, this.getId());$(".picozu > footer").append(this.template);this.parent.taskbar=this;for(a=0;a';$(this.getElementId()+" .langs").append(b);b="";for(a=0;a'+ picozu.WORKSPACES[a].name+"";$(this.getElementId()+" .workspaces").append(b);$(this.getElementId()).on("click",".langs",function(){$(this).children(".flag").fadeToggle()}).on("click",".flag",function(){var a=$(this).data("lang");c.getWorkspace().confirmWindow(l("%main.switchlocale"),l("%main.switchlocaletext"),function(){this.loadLocales(a);document.location.reload()})}).on("click","ul > li",function(){$(this).children("ul").fadeToggle()}).on("click","ul > li ul li",function(){var a=parseInt($(this).data("id")); c.getWorkspace().confirmWindow(l("%main.switchworkspace"),l("%main.go_switchworkspace_"+a),function(){this.switchWorkspace(a)})}).on("click",".pico-task",function(){var a=$(this),b=parseInt(a.data("id"));a.hasClass("window")?c.getWorkspace().windows[b].toggle():a.hasClass("propbar")?c.getWorkspace().propbars[b].toggle():a.hasClass("toolbar")?c.getWorkspace().toolbars[b].toggle():a.hasClass("dockbar")&&c.getWorkspace().dockbars[b].toggle();return!1});this.onCreate.call(this);this.getWorkspace().log(l("%taskbar")+ " #"+this.getId()+" "+l("%created"),l("%UI"));return this}}); picozu.objects.window=picozu.objects.control.extend({controlType:"window",movable:!0,modal:!1,visible:!1,resizable:!1,system:!1,minimized:!1,center:!1,left:0,top:0,width:0,height:0,cssClass:null,controls:[],modalTemplate:'
                      {contents}
                      ',template:'
                      {name}
                      {contents}
                      ',templateTaskbar:'
                      {name}
                      ',__constructor:function(a){this.parent=a.parent;a.onCreate instanceof Function&&(this.onCreate=a.onCreate);a.onHide instanceof Function&&(this.onHide=a.onHide);a.onDestroy instanceof Function&&(this.onDestroy=a.onDestroy);a.onBuild instanceof Function&&(this.onBuild=a.onBuild);a.onApply instanceof Function&&(this.onApply=a.onApply);a.onShow instanceof Function&&(this.onShow=a.onShow);a.onRedraw instanceof Function&& (this.onRedraw=a.onRedraw);this.id=this.parent.heap.lastWinIndex++;this.name=a.name;this.handle="undefined"!==typeof a.handle?a.handle:this.getElementHandle();this.cssClass="pico-window-"+this.handle;this.width="undefined"!==typeof a.width?a.width:"auto";this.height="undefined"!==typeof a.height?a.height:null;this.left="undefined"!==typeof a.left?a.left:0;this.top="undefined"!==typeof a.top?a.top:0;this.resizable="undefined"!==typeof a.resizable?a.resizable:!1;this.movable="undefined"!==typeof a.movable? a.movable:!0;this.modal="undefined"!==typeof a.modal?a.modal:!1;this.minimized="undefined"!==typeof a.minimized?a.minimized:!1;this.system="undefined"!==typeof a.system?a.system:!1;this.visible="undefined"!==typeof a.visible?a.visible:!1;this.center="undefined"!==typeof a.center?a.center:!1;this._load(a);this.onCreate.call(this);this.parent.windows[this.id]=this;this.getWorkspace().log(l("%window")+" #"+this.getId()+" "+l("%created"),l("%UI"));return this},_load:function(a){var c=this,b="#"+this.getElementHandle(), d=this.getWorkspace();!0===this.isModal()?(this.template=this.modalTemplate.replace(/{contents}/g,this.template.replace(/{id}/g,this.getId()).replace(/{name}/g,this.getName()).replace(/{contents}/g,"undefined"!==typeof a.template?a.template:"").replace(/{cssClass}/g,this.cssClass)),this.center=!0,$(".picozu").append(this.template)):(this.template=this.template.replace(/{id}/g,this.getId()).replace(/{name}/g,this.getName()).replace(/{contents}/g,"undefined"!==typeof a.template?a.template:"").replace(/{cssClass}/g, this.cssClass),$(".picozu > section").append(this.template));$(b+" .buttons").append('×');$(b).on("click",".minimize",function(){c.hide();return!1}).on("click",".close",function(){!0===c.isSystem()?c.hide():c.destroy();return!1}).on("click",".apply-button",function(){c.onApply.call(c);return!1}).on("click",".accept-button",function(){!1!==c.onApply.call(c)&&(!0===c.isSystem()?c.hide():c.destroy());return!1}).on("click",".cancel-button", function(){!0===c.isSystem()?c.hide():c.destroy();return!1});c.isSystem()&&($(b+" .buttons").append(''),c.templateTaskbar=c.templateTaskbar.replace(/{id}/g,c.getId()).replace(/{name}/g,this.getName()),d.taskbar.injectHtml(this.templateTaskbar),c.show());!0===this.isResizeable()&&($(b+" .buttons").append(''),$(b).on("click",".maximize",function(){c.maximize();return!1}).on("click", ".restore",function(){c.restore();return!1}));$(b).css({width:c.width,height:c.height,left:!1===d.getCapability("mobile",picozu.SCOPE_BROWSER)?c.left:"0px",top:!1===d.getCapability("mobile",picozu.SCOPE_BROWSER)?c.top:"0px"});!0===this.isMovable()&&$(b).draggable({opacity:0.8,containment:".picozu > section",handle:"header"});return this}}); picozu.objects.plugin=function(a,c){this.parent=null;this.parameters={id:null,title:null,handle:null,version:null,email:null,url:null,description:null,depends:null,requires:null,enabled:!1};this.getHandle=function(){return this.parameters.handle};this.getDependencies=function(){return this.parameters.depends};this.getRequirements=function(){return this.parameters.requires};this.install=function(){var a=this.parent.getStorage("plugins");if(!1===a.findIndexM(this.parameters.handle)){if(null!==this.parameters.depends&& !0===!this.parent.pluginIsInstalled(this.parameters.depends))return this.parent.notify(l("%plugin.depends.on")+this.parameters.depends+l("%plugin.depends.install"),!0),!1;a[a.length]={handle:this.getHandle(),enabled:!1};this.parent.setStorage("plugins",a);this.onInstall.call(this.parent);this.parent.log(''+this.getHandle()+" "+l("%installed"),l("%PLUGIN"))}return this};this.uninstall=function(){var a=this.parent.getStorage("plugins"),c=a.findIndexM(this.parameters.handle); !1!==c&&(this.parent.plugins[c]=null,a.splice(c,1),this.parent.setStorage("plugins",a),this.onUninstall.call(this.parent),this.parent.log(''+this.getHandle()+" "+l("%uninstalled"),l("%PLUGIN")));this.__destructor()};this.enable=function(){var a=this.parent.getStorage("plugins"),c=a.findIndexM(this.getHandle());!1!==c&&(a[c].enabled=!0,this.parent.setStorage("plugins",a),this.onEnable.call(this.parent),this.parent.log(''+this.getHandle()+" "+ l("%enabled"),l("%PLUGIN")));return this};this.disable=function(){var a=this.parent.getStorage("plugins"),c=a.findIndexM(this.getHandle());!1!==c&&(a[c].enabled=!1,this.parent.setStorage("plugins",a),this.onDisable.call(this.parent),this.parent.log(''+this.getHandle()+" "+l("%disabled"),l("%PLUGIN")));return this};this.setup=function(){this.onSetup.call(this.parent);return this};this.action=function(a,c){this.onAction.call(this.parent,a,c)};this.__constructor=function(a, c){this.parent=c;this.parameters.id=this.parent.plugins.length;a.onInstall instanceof Function&&(this.onInstall=a.onInstall);a.onUninstall instanceof Function&&(this.onUninstall=a.onUninstall);a.onEnable instanceof Function&&(this.onEnable=a.onEnable);a.onDisable instanceof Function&&(this.onDisable=a.onDisable);a.onSetup instanceof Function&&(this.onSetup=a.onSetup);a.onAction instanceof Function&&(this.onAction=a.onAction);for(var e in a.parameters)this.parameters[e]=a.parameters[e];this.parent.plugins[this.parameters.id]= this;this.parent.log(''+this.getHandle()+" "+l("%initialized"),l("%PLUGIN"));return this};this.__destructor=function(){this.parent.log(''+this.getHandle()+" "+l("%destroyed"),l("%PLUGIN"))};this.onInstall=function(){};this.onUninstall=function(){};this.onEnable=function(){};this.onDisable=function(){};this.onAction=function(){};this.onSetup=function(){};return this.__constructor(a,c)}; picozu.objects.workspace=function(a){this.parameters={preserveAlpha:!0,curves:null,activeLayer:null,color:[],smooth:!1,tool:null,backgroundColor:[0,0,0],foregroundColor:[0,0,0],zoom:100,hue:0,saturation:0,lightness:0,brightness:0,gradient:null,gradientType:"linear",contrast:0,opacity:10,brushSize:1,brushHardness:60,brushFlow:100,brushType:"brush_normal",shadowoX:0,shadowoY:0,fillTolerance:30,shadowBlur:0,border:1,fontSize:30,fontFamily:"Times New Roman",fontCase:picozu.FONT_CASE_NORMAL,fontAlign:"left", fontWeight:"normal",fontStyle:"normal",shapeRadius:10,fontDecoration:"none",sColor:[0,0,0],dColor:[219,2,104],drawMode:picozu.DRAW_MODE_STROKE,defaultImage:null,isCreatingText:!1,apiKey:picozu.API_KEY,whiteLabel:!1,logo:null};this._appCapabilities={};this._browserCapabilities={touch:!1,gesture:!1,platform:picozu.PLATFORM_GENERIC_DESKTOP,webgl:!1,orientation:!1,fullscreen:!1,websockets:!1,metroUI:!1,webstorage:!0,mobile:!1,collab:!1};this.settings={token:null,url:null,fullscreen:!1,locale:"en-US", snapGrid:!1,snapTab:!1,snapLayers:!0,online:!0,autosave:!1,loadImage:null,showTips:!0,showGrid:!0,theme:picozu.THEME_DEFAULT,uAgent:null};this.coords={select:{left:0,top:0,width:0,height:0},start:{x:0,y:0},end:{x:0,y:0},move:{x:0,y:0},offset:{x:0,y:0},width:0,height:0};this.account={achievements:{points:0,ids:[],list:[]},id:null,username:null,nickname:"user-"+Math.random(),email:null,guid:null};this.template='
                      '; this.loaderTemplate='

                      Picozu

                      '+l("%browser.too.old")+''+l("%JOIN")+''+l("%CREATE")+''+l("%EDIT")+'
                      ";this.containerTemplate='
                      ';this.threads=[];this.tabs=[];this.toolbars=[];this.dockbars=[];this.propbars=[];this.windows= [];this.menus=[];this.contextmenus=[];this.taskbar=null;this.plugins=[];this.modules=[];this.connectors=[];this.helpers=[];this.parent=null;this.heap={};this.debug=this.modal=this.logger=this.notifier=null;this.__destructor=function(){};this.__constructor=function(a){this.initTime=+new Date;this.clearHeap();$.support.cors=!0;$.event.props.push("dataTransfer");var b=picozu.THEME_DEFAULT,d=localStorage.getItem("theme");null!==d&&d!==b&&($("#pico-theme-loaded").attr("href",picozu.API_ENTRY_POINT+d+".css"), this.setSetting("theme",d));this.heap.params=a="undefined"!==typeof a&&"object"===typeof a?a:{};this._parseParameters(a)._detectCapabilities()._setDefaultSettings();picozu.events.initKeyboard.call(this);this._init(!0);"undefined"!==typeof a.theme&&this.loadTheme(a.theme);return this};this._init=function(a){!0===this.getSetting("hasFullscreen")?(this.coords.width=screen.width,this.coords.height=screen.height-81):(this.coords.width=window.innerWidth,this.coords.height=window.innerHeight-81);if(!0!== this._checkBrowser())return $(".pico-main-loader .browser").fadeIn(),!1;$(".pico-main-loader .join").delay(500).fadeIn();"undefined"!==typeof a&&!0===a?$(".picozu").append(this.template):$(".picozu").empty().append(this.template);this.notifier=new picozu.objects.notifier;this.logger=new picozu.objects.logger;this.modal=new picozu.objects.modal;$(".picozu > section").append('');this.tempCanvas=$("#pico-temp-canvas")[0];this._parseURL();this._heartbeat();("undefined"=== typeof this.settings.loadImage||null===this.settings.loadImage)&&this.openWindow("intro");return this};this._parseParameters=function(a){$("body").append(this.containerTemplate);$(".picozu").append(this.loaderTemplate);"undefined"!==typeof a.key&&null!==a.key&&(this.parameters.apiKey=picozu.API_KEY=a.key);"undefined"!==typeof a.whiteLabel&&null!==a.whiteLabel&&(this.parameters.whiteLabel=a.whiteLabel);"undefined"!==typeof a.saveURL&&null!==a.saveURL&&(picozu.API_SAVE=a.saveURL);!0===this.parameters.whiteLabel&& $(".pico-main-loader header h1").hide();this.settings.loadImage="undefined"!==typeof a.loadImage&&null!==a.loadImage?!0===this.validateBase64(a.loadImage)?window.atob(a.loadImage):!0===this.validateImageURL(a.loadImage)?a.loadImage:null:null;return this};this.createGradient=function(a,b,d,e,f){var g=null,h=this.getParam("gradient");if(null!==h){this.getParam("gradientType")==picozu.GRADIENT_MODE_LINEAR?g=a.createLinearGradient(b+e,d+f,e,f):(g=b+e/2,d+=f/2,_r=e/2,g=a.createRadialGradient(g,d,0,g,d, _r));for(a=0;a header").height()-$(".picozu > footer").height()):(this.coords.width=!0===this.getSetting("isEmbed")?this.settings.container.width():$(".picozu").width(),this.coords.height=(!0===this.getSetting("isEmbed")?this.settings.container.height():$(".picozu").height())-$(".picozu > header").height()-$(".picozu > footer").height());$("#pico-dockbar-0, .picozu > section, #pico-dockbar-0 > section").height(this.coords.height); var a=this.getSelectedTab();null!==a&&$(".pico-tab > section").css({width:this.coords.width'+a+" "+l("%initialized"))}}else this._clearTempCanvas(),$("#pico-toolbar-0 .pico-button").removeClass("selected pressed"),this.heap.activeBrush=this.heap.tool=null,this.disableTransformHelper();return this};this.log=function(a,b){this.logger.trigger({message:a,scope:"undefined"===typeof b?l("%APP"):b});return this};this.getTool=function(){return this.heap.activeBrush}; this.disableTransformHelper=function(){$(".transform-helper").css({"z-index":9997}).draggable("option","disabled",!0).resizable("option","disabled",!0).children(".tooltip").hide();return this};this.enableTransformHelper=function(){var a=this.getSelectedLayer().getCoords();$(".transform-helper").css({"z-index":9998}).draggable("option","disabled",!1).resizable("option","disabled",!1);$(".transform-helper .tooltip .left").html(l("%Left")+": "+a.left);$(".transform-helper .tooltip .top").html(l("%Top")+ ": "+a.top);$(".transform-helper .tooltip").show();return this};this.setParam=function(a,b){this.parameters[a]=b;switch(a){case "backgroundColor":$(".pico-swatch .bgcolor").css("background-color","#"+Color.rgb2hex(b[0],b[1],b[2]));break;case "foregroundColor":$(".pico-swatch .fgcolor").css("background-color","#"+Color.rgb2hex(b[0],b[1],b[2])),this.updateInfoPanel({rgb:b}),$(".layerborder .bordercolor").css({"background-color":"#"+Color.rgb2hex(b[0],b[1],b[2])});case "border":case "fontSize":case "brushSize":case "opacity":case "fontFamily":case "fontAlign":case "fontDecoration":case "fontStyle":case "fontWeight":case "shadowoX":case "shadowoY":case "shadowBlur":case "shapeRadius":$("#pz-"+ a)&&$("#pz-"+a).val(b);if($(".pico-textform")){var d=this.getParam("foregroundColor");$(".pico-textform").css("font-family",this.getParam("fontFamily")).css("font-size",this.getParam("fontSize")).css("font-style",this.getParam("fontStyle")).css("font-weight",this.getParam("fontWeight")).css("text-decoration",this.getParam("fontDecoration")).css("text-align",this.getParam("fontAlign")).css("color","#"+Color.rgb2hex(d[0],d[1],d[2])).css("opacity",this.getParam("opacity")/10)}break;case "drawMode":$(".drawmodeinfo > .pico-button[data-value="+ b+"]").addClass("selected")}return this};this.getParam=function(a){return"undefined"!==typeof this.parameters[a]?this.parameters[a]:!1};this._refreshHistograms=function(a){null!==this.getSelectedTab()&&(!0===this.getSelectedTab().isReady()&&this.pluginIsEnabled("histograms"))&&this.spawnThread(picozu.WORKER_TYPE_PROCESS,"histogram",{type:a,imageData:this.getPreviewLayer().getImageData(0,0,this.getPreviewLayer().getWidth(),this.getPreviewLayer().getHeight())});return this};this._refreshSwatches=function(){null!== this.getSelectedTab()&&(!0===this.getSelectedTab().isReady()&&this.pluginIsEnabled("swatches"))&&(this.spawnThread(picozu.WORKER_TYPE_PROCESS,"swatch",{params:this.parameters,imageData:this.getPreviewLayer().getImageData(0,0,this.getPreviewLayer().getWidth(),this.getPreviewLayer().getHeight())}),this.refreshCustomSwatches());return this};this.pickColor=function(a,b){var d=this.getPreviewLayer().getImageData(a,b,1,1).data;this.setParam("foregroundColor",d).updateInfoPanel({rgb:d});return this};this.importTabs= function(a){a=JSON.parse(a);this.reset();for(var b=0;b section"),e=0,f=0;a=a-$(this.getSelectedTab().getElementId()).offset().left+d.scrollLeft();b=b-$(this.getSelectedTab().getElementId()).offset().top+d.scrollTop();if(null!==this.getSelectedLayer()){var d=this.getSelectedLayer().getCoords(),g=this.getTool();"undefined"!==typeof g&&null!==g&&(-1===g.search("diagram_")&&"ellipse"!==g&&"line"!==g&&"arrow"!==g&&"circle"!==g&&"rectangle"!==g&&"roundedRectangle"!==g)&&(e= d.left,f=d.top)}}return{x:a-e,y:b-f,tx:a,ty:b}};this.formatLayerName=function(a){var b="";switch(a){case picozu.LAYER_TYPE_TEXT:b=l("%Text");break;case picozu.LAYER_TYPE_NORMAL:b=l("%Normal");break;case picozu.LAYER_TYPE_SHAPE:b=l("%Shape");break;case picozu.LAYER_TYPE_TEXTSHAPE:b=l("%Mixed");break;case picozu.LAYER_TYPE_BACKGROUND:b=l("%Background")}return b};this.formatShapeName=function(a){var b="";switch(a){case picozu.SHAPE_RECTANGLE:b=l("%Rectangle");break;case picozu.SHAPE_CIRCLE:b=l("%Circle"); break;case picozu.SHAPE_LINE:b=l("%Line");break;case picozu.SHAPE_ELLIPSE:b=l("%Ellipse");break;case picozu.SHAPE_ROUNDED_RECTANGLE:b=l("%Rounded Rect");break;case picozu.SHAPE_ARROW:b=l("%Arrow")}return b};this.loadTheme=function(a){"undefined"!==typeof a?(this.setSetting("theme",a),$("#pico-theme-loaded").attr("href",picozu.API_ENTRY_POINT+a+".css"),this.setStorage("theme",a)):(a=localStorage.getItem("theme"),$("#pico-theme-loaded").attr("href",a+".css"),this.setSetting("theme",a));return this}; this._applyDefaultSettings=function(a){var b=this.tempCanvas.getContext("2d");a="undefined"!==typeof a?a:this.getSelectedLayer().getContext();b.lineWidth=a.lineWidth=this.getParam("brushSize");b.shadowOffsetX=a.shadowOffsetX=this.getParam("shadowoX");b.shadowOffsetY=a.shadowOffsetY=this.getParam("shadowoY");b.shadowBlur=a.shadowBlur=this.getParam("shadowBlur");b.shadowColor=a.shadowColor="rgba("+this.parameters.backgroundColor[0]+", "+this.parameters.backgroundColor[1]+","+this.parameters.backgroundColor[2]+ ", "+0.1*this.getParam("opacity")+")";b.strokeStyle=a.strokeStyle="rgba("+this.parameters.foregroundColor[0]+", "+this.parameters.foregroundColor[1]+","+this.parameters.foregroundColor[2]+", "+0.1*this.getParam("opacity")+")";b.fillStyle=a.fillStyle="rgba("+this.parameters.backgroundColor[0]+", "+this.parameters.backgroundColor[1]+","+this.parameters.backgroundColor[2]+", "+0.1*this.getParam("opacity")+")";b.globalCompositeOperation=a.globalCompositeOperation="source-over";b.lineCap=a.lineCap="round"; b.lineJoin=a.lineJoin="round";b.globalAlpha=a.globalAlpha=0.1*this.parameters.opacity;b.textBaseline=a.textBaseline="top";b.textAlign=a.textAlign=this.getParam("fontAlign");return this};this.installSafariShooter=function(){this.plugins.shooterSafari=!0;$(".pico-window-helpcontents .shooter-installed").empty().append("
                      "+l("%picozu.shooter.installed")+"
                      ").show();return!1};this._installFirefoxShooter=function(){InstallTrigger.install({Picozu:{URL:picozu.SHOOTER_XPI,IconURL:picozu.SHOOTER_ICON_URL, toString:function(){return this.URL}}});this.plugins.shooterFirefox=!0;$(".pico-window-helpcontents .shooter-installed").empty().append("
                      "+l("%picozu.shooter.installed")+"
                      ").show();return!1};this._checkAppsInstalled=function(){var a=this;if(a.getCapability("platform",picozu.SCOPE_BROWSER)===picozu.PLATFORM_FIREFOX){var b=new Image;b.onload=function(){a.plugins.shooterFirefox=!0};b.onerror=function(){a.plugins.shooterFirefox=!1;a.notifier.trigger({title:l("%Picozu Shooter"), timeout:!1,error:!1,content:l("%picozu.shooter.text1")+' '+l("%Picozu Shooter")+" "+l("%picozu.shooter.text2")+'

                      '+l("%Install")+' '+l("%Mozilla project page")+""});$(".pico-notifications").on("click",".pico-install-shooter",function(b){a._installFirefoxShooter(b);return!1})};b.src=picozu.SHOOTER_ICON; "undefined"!==typeof window.navigator.mozApps&&(b=window.navigator.mozApps.getSelf(),b.onsuccess=function(){if(null===typeof this.result){var b=navigator.mozApps.install(picozu.API_MOZILLA_MANIFEST);b.onsuccess=function(){a.notify(l("%main.mozillainstall"))};b.onerror=function(){a.error(l("%main.mozilainstall.error")+" "+this.error.name)}}},b.onerror=function(){a.error(l("%main.mozilainstall.error")+" "+this.error.name)})}else a.getCapability("platform",picozu.SCOPE_BROWSER)===picozu.PLATFORM_CHROME? chrome.app.isInstalled||(this.notifier.trigger({title:l("%Picozu Chrome"),timeout:!1,error:!1,content:l("%picozu.chrome.text1")+' '+l("%Picozu Chrome")+" "+l("%picozu.chrome.text2")+'

                      '+l("%Install")+' '+l("%Picozu Chrome app page")+""}),$(".pico-notifications").on("click",".pico-install-chrome",function(){chrome.webstore.install(); return!1})):this.getCapability("platform",picozu.SCOPE_BROWSER);return this};this.loadLocales=function(a){this.setStorage("locale",a);String.locale=a;return this};this.addTool=function(a,b){picozu.TOOLS.push({name:a,handle:b});this.rebuildTools();return this};this.removeTool=function(a){if(a=picozu.TOOLS.findIndexM(a))picozu.TOOLS.splice(a,1),this.rebuildTools();return this};this.addImporter=function(a,b){picozu.IMPORTERS.push({name:a,handle:b});this.rebuildImporters();return this};this.removeImporter= function(a){if(a=picozu.IMPORTERS.findIndexM(a))picozu.IMPORTERS.splice(a,1),this.rebuildImporters();return this};this.addExporter=function(a,b){picozu.EXPORTERS.push({name:a,handle:b});this.rebuildExporters();return this};this.isErrorRequest=function(a){return"error"===a.status?!0:!1};this.imageFromLayer=function(){var a=this.getSelectedLayer();return this.newTab({imageData:a.getCanvas(),width:a.getWidth(),height:a.getHeight()})};this.removeExporter=function(a){if(a=picozu.EXPORTERS.findIndexM(a))picozu.EXPORTERS.splice(a, 1),this.rebuildExporters();return this};this.getMainDockbar=function(){return this.dockbars[0]};this.triggerAchievement=function(a){if(!1===this.hasAchievement(a)&&!0===this.getSetting("online")&&!0===picozu.ACHIEVEMENTS){var b=new picozu.objects.achievement(a,picozu.ACHIEVEMENTS_LIST[a],this);b.trigger();this.account.achievements.list[a]=b;return this}return!1};this.hasAchievement=function(a){return!0===picozu.ACHIEVEMENTS?!1===this.account.achievements.ids.findIndex(a)?!1:!0:!1};this._googleAnalyticsInit= function(){return this};this.googleAnalyticsTrack=function(){return this};return this.__constructor(a)}; picozu.objects.workspace.prototype.updateProfile=function(a){var c=this,b=[];this.validEmail(a.email)||b.push(l("%reg.error.email"));""!==a.password&&(this.validPassword(a.password)||b.push(l("%reg.error.password")),a.password!==a.password2&&b.push(l("%reg.error.password2")));0===b.length?($(".prof-pass, .prof-pass2").val(""),this.doRequest(picozu.API_PROFILE,$.param(a)+"&id="+c.account.id,function(a){"error"===a.status?c.error(l("%profile.error")):c.notify(l("%profile.success"))},function(){c.notify(l("%profile.error"))}, "json")):this.error(b.join("
                      "));return this};picozu.objects.workspace.prototype.recover=function(a){var c=this;$(".rec-username, .rec-email").val("");""===a.username&&""===a.email?c.error(l("%recover.error.empty")):this.doRequest(picozu.API_RECOVER,$.param(a),function(a){c.isErrorRequest(a)?c.error(l("%recover.error")):c.notify(l("%recover.success"))},function(){c.error(l("%recover.error"))},"json");return this}; picozu.objects.workspace.prototype.login=function(a){var c=this,b=[];$(".log-username, .log-pass").val("");this.validPassword(a.password)||b.push(l("%reg.error.password"));this.validUsername(a.username)||b.push(l("%reg.error.username"));0===b.length?this.doRequest(picozu.API_SIGNIN,$.param(a),function(a){c.isErrorRequest(a)?($(".account-tab.profile-panel").hide(),$(".account-tab.login-panel").show(),c.error(l("%login.error"))):($(".account-tab.login-panel").hide(),$(".account-tab.profile-panel").show(), $(".pico-window-account footer").empty().append(' ').show())},function(){c.error(l("%login.error"))},"json"):c.error(b.join("
                      "));return this}; picozu.objects.workspace.prototype.isLoggedIn=function(){return null!==this.account.id&&null!==this.account.username?!0:!1};picozu.objects.workspace.prototype.logout=function(){var a=this;this.doRequest(picozu.API_SIGNOUT,null,function(c){a.isErrorRequest(c)?a.error(l("%logout.error")):(a.resetAccount(),$(".account-tab.profile-panel").hide(),$(".account-tab.login-panel").fadeIn(),$(".pico-window-account footer").empty().hide())},function(){a.error(l("%logout.error"))},"json");return this}; picozu.objects.workspace.prototype.register=function(a){var c=this,b=[];this.validEmail(a.email)||b.push(l("%reg.error.email"));this.validPassword(a.password)||b.push(l("%reg.error.password"));this.validUsername(a.username)||b.push(l("%reg.error.username"));this.validFullname(a.fullname)||b.push(l("%reg.error.fullname"));a.password!==a.password2&&b.push(l("%reg.error.password2"));0===b.length?($(".reg-fullname, .reg-username, .reg-email, .reg-pass, .reg-pass2").val(""),this.doRequest(picozu.API_SIGNUP, $.param(a),function(a){"error"==a.status||"undefined"!==typeof a.user.id.errors?c.error("error"==a.status?a.error:l("%registration.error")):c.notify(l("%registration.success"))},null,"json")):c.error(b.join("
                      "));return this};picozu.objects.workspace.prototype.getAccount=function(){return null!==this.account.id?this.account:!1}; picozu.objects.workspace.prototype.fillAccount=function(a){this.account={achievements:{points:0,ids:[],list:[]},id:a.user.id,username:a.user.username,nickname:a.user.nickname,email:a.user.email,registered:a.user.registered,avatar:a.user.avatar,guid:picozu.objects.crypter.guid()};$(".prof-username").val(this.account.username);$(".prof-email").val(this.account.email);$(".prof-fullname").val(this.account.nickname);$(".prof-avatar").attr("src",this.account.avatar);return this}; picozu.objects.workspace.prototype.resetAccount=function(){this.account={achievements:{points:0,ids:[],list:[]},userdata:null,id:null,username:null,nickname:"user-"+Math.random(),email:null,registered:null,avatar:null,guid:null};$(".prof-username").val("");$(".prof-email").val("");$(".prof-nickname").val("");$(".prof-avatar").attr("src",picozu.DEFAULT_PATH+"images/gui/avatar.jpg");return this}; picozu.objects.workspace.prototype._loadFileHelper=function(a,c,b,d,e,f){!0===a?this.newLayer(c,{width:d,height:e}):(this._getExif(c),this.newTab({name:f,image:c,width:d,height:e,imageFormat:b}));return this};picozu.objects.workspace.prototype.loadPSDFile=function(a,c){this.newTab({name:c,image:a,imageFormat:picozu.FILE_FORMAT_PSD});return this};picozu.objects.workspace.prototype.loadWEBPFile=function(a,c){this.newTab({name:c,image:a,imageFormat:picozu.FILE_FORMAT_WEBP});return this}; picozu.objects.workspace.prototype.loadSVGFile=function(a,c){this.newTab({name:c,image:a,imageFormat:picozu.FILE_FORMAT_SVG});return this};picozu.objects.workspace.prototype.loadRAWFile=function(a,c){this.spawnThread(picozu.WORKER_TYPE_PROCESS,"raw",{image:a,name:c});return this}; picozu.objects.workspace.prototype.loadASEFile=function(a,c){var b=Import.fromASE(a),d=this.getStorage("customSwatches"),b=b.flattened;if(null===d)d=b;else for(var e=0;epicozu.WARN_IMAGE_DIMENSION||d.height>picozu.WARN_IMAGE_DIMENSION?e.openWindow("importResize",{name:l("%Resize Image"),handle:"importResize",width:270,modal:!0,template:"

                      "+l("%resize.bigimage")+"


                      ',onCreate:function(){var a=this,b=this.getElementId(),c=this.getIntValue(".pz-image-width"), d=this.getIntValue(".pz-image-height"),e=c/d;this.addFooter(picozu.DEFAULT_WINDOW_FOOTER);$(b).on("keyup.picozu",".pz-image-width",function(){if($(b+" .pz-image-ratio").is(":checked")){var c=parseInt($(this).val())/e+0.5|0;a.setIntValue(".pz-image-height",c)}}).on("keyup.picozu",".pz-image-height",function(){if($(b+" .pz-image-ratio").is(":checked")){var c=parseInt($(this).val())*e+0.5|0;a.setIntValue(".pz-image-width",c)}}).on("change",".pz-image-ratio",function(){var b=a.getIntValue(".pz-image-width")/ e+0.5|0;a.setIntValue(".pz-image-height",b)}).on("change",".pz-image-width-unit, .pz-image-height-unit",function(){var a=parseInt($(this).val());$(b+" select.pz-image-width-unit, "+b+" select.pz-image-height-unit").val(a)})},onApply:function(){var d=this.getIntValue(".pz-image-width"),g=this.getIntValue(".pz-image-height");e._loadFileHelper(c,a,null,d,g,b)}}):e._loadFileHelper(c,a,null,d.width,d.height,b)};d.onerror=function(){e.error(l("%main.file.notloaded")).hideLoader()};d.src=a;return this}; picozu.objects.workspace.prototype.isLocalImage=function(a){return"https://www.picozu.com/"===a.substring(0,23)?!0:!1};picozu.objects.workspace.prototype._onFailLoadImage=function(){this.error(l("%main.image.errorimport"));new picozu.objects.tab({parent:this});this.hideLoader()};picozu.objects.workspace.prototype._onDoneLoadImage=function(a){a=a.binaryResponse.getRawData();var c=picozu.objects.crypter.base64Encode(a);this._getExifFromBinary(a);this.loadImageFile("data:image/png;base64,"+c)}; picozu.objects.workspace.prototype.parseImageFile=function(a,c,b){this.showLoader();var d=this;"undefined"===typeof c&&(c=!1);!0===this.isLocalImage(a)?(a=decodeURIComponent(a),d.doBinaryRequest(a,this._onDoneLoadImage,this._onFailLoadImage)):!1===c?(a=a.split("?")[0],!0===this.validateImageURL(a)?this.doRequest(picozu.API_PROXY,"url="+picozu.objects.crypter.base64Encode(a)+("undefined"!==typeof b?"&token="+b:""),function(a){d.doBinaryRequest(picozu.API_ENTRY_POINT+"v/"+a.dir+a.code+"."+a.format, d._onDoneLoadImage,d._onFailLoadImage)},function(){d.error(l("%main.image.errorimport")).hideLoader()},"json"):this.error(l("%main.image.errorimport")).hideLoader()):this.doRequest(picozu.API_PROXY,"url="+picozu.objects.crypter.base64Encode(a)+("undefined"!==typeof b?"&token="+b:""),function(a){d.doBinaryRequest(picozu.API_ENTRY_POINT+"v/"+a.dir+a.code+"."+a.format,d._onDoneLoadImage,d._onFailLoadImage)},function(){d.error(l("%main.image.errorimport")).hideLoader()},"json");return this}; picozu.objects.workspace.prototype.loadPZIFile=function(a,c){var b=a.replace("data:application/octet-stream;base64,",""),b=Import.fromPZI(picozu.objects.crypter.base64Decode(b));this.newTab({name:c,width:b.d.width,height:b.d.height,layers:b.d.layers,imageFormat:picozu.FILE_FORMAT_PZI});this.notify(l("%main.image.done"));return this}; picozu.objects.workspace.prototype.loadFile=function(a,c,b){var d=this;this.showLoader();if(""!==a&&null!==a&&"undefined"!==typeof a){var e=new FileReader,f=a.name.split(".").pop().toLowerCase();a.name.split(".");var g=a.type.toLowerCase();e.onload=function(e){e=e.target.result;switch(g){case "image/jpeg":case "image/pjpeg":case "image/png":case "image/bmp":case "image/gif":d.loadImageFile(e,b,a.name);break;case "image/cr2":case "image/crw":d.loadRAWFile(e,a.name);break;case "image/svg+xml":d.loadSVGFile(e, a.name);break;case "":switch(f){case "psd":d.loadPSDFile(e,a.name);break;case "webp":d.loadWEBPFile(e,a.name);break;case "pzi":d.loadPZIFile(e,a.name);break;case "pzw":d.loadPZWFile(e);break;case "acv":d.loadACVFile(e,a.name,c);break;case "ase":d.loadASEFile(e,c);break;default:d.error(l("%main.file.unknown"))}break;default:d.error(l("%main.file.unknown")).hideLoader()}d.hideLoader()};e.onerror=function(){d.error(l("%main.file.notloaded")).hideLoader()};"acv"===f||"ase"===f||"webp"===f||"crw"===f|| "cr2"===f?e.readAsBinaryString(a):e.readAsDataURL(a)}return this};picozu.objects.workspace.prototype.fillPSDInfo=function(a){$(".pico-window-imageinfo .ii-PixelXDimension").val(a.header.cols);$(".pico-window-imageinfo .ii-PixelYDimension").val(a.header.rows);$(".pico-window-imageinfo .ii-ColorMode").val(a.header.modename);$(".pico-window-imageinfo .ii-Channels").val(a.header.channels);return this}; picozu.objects.workspace.prototype.fillEXIFInfo=function(){var a=this.getSelectedTab().getExif();if(null!==a){for(var c in a)$(".pico-window-imageinfo .ii-"+c).val("object"===typeof c?c.join(","):a[c]);""!=$(".ii-GPSLatitude").val()&&""!=$(".ii-GPSLongitude").val()&&$(".pico-window-imageinfo footer").append(''+l("%Locate on map")+"")}return this}; picozu.objects.workspace.prototype._getExif=function(a){a=a.split(",");this.spawnThread(picozu.WORKER_TYPE_PROCESS,"exif",1g?0:g;g=f.data[d+1]*c.data[d+1]/255;f.data[d+1]=255g?0:g;g=f.data[d+2]*c.data[d+2]/255;f.data[d+2]=255g?0:g}"undefined"!==typeof a&&!0===a?$("#filter-preview")[0].getContext("2d").putImageData(f,0,0):(b.getSelectedLayer().drawImageData(f,b.coords.select.left,b.coords.select.top),b._refreshAll());b.setParam("renderImage",null);b.processQueue()};e.onerror=function(){("undefined"===typeof a||!1===a)&&b.error(l("%main.image.notloaded"))}}return this}; picozu.objects.workspace.prototype._refreshFilterPreview=function(a){this.getSelectedTab()._refreshPreview();var c,b,d,e,f,g=$("#filter-preview")[0],h=g.getContext("2d");!0===this.hasSelection()?(e=this.getSelection(),c=e.width,b=e.height,d=e.left,e=e.top):(c=this.getSelectedLayer().getWidth(),b=this.getSelectedLayer().getHeight(),e=d=0);f=c/b;c>b?(g.width=285,g.height=285/f+0.5|0):(g.width=220*f+0.5|0,g.height=220);h.drawImage(this.getSelectedLayer().getCanvas(),d,e,c,b,0,0,g.width,g.height);if("undefined"!== typeof a&&(a=this.getFilter(a))){if("undefined"!==typeof a.queue)for(c=0;c'+l("%id")+":"+c+' '+l("%type")+":"+d+' '+l("%time")+":"+(this.endTime-this.initTime)+l("%ms")+"",l("%KERNEL"));if(!0===e)return $("#filter-preview")[0].getContext("2d").putImageData(a,0,0),this._killThread(c),this.log(l("%success.preview.thread")),this.processQueue(),this;if(null!== this.getSelectedLayer()){this._killThread(c);e=this.getSelection();switch(b){case picozu.WORKER_TYPE_BLENDMODE:this.saveUndo();this.getSelectedLayer().drawImageData(a,0,0);this.getSelectedLayer().setBlend(d);this.processQueue();break;case picozu.WORKER_TYPE_FILTER:this.saveUndo();this.getSelectedLayer().drawImageData(a,e.left,e.top);this.processQueue();break;case picozu.WORKER_TYPE_FRACTAL:this.getSelectedLayer().drawImageData(a,e.left,e.top);break;case picozu.WORKER_TYPE_OTHER:this.getSelectedLayer().drawImageData(a, e.left,e.top);break;case picozu.WORKER_TYPE_TEXTURE:this.getSelectedLayer().drawImageData(a,e.left,e.top);break;case picozu.WORKER_TYPE_PROCESS:if("exif"===d)this.getSelectedTab().heap.exif=a,this.fillEXIFInfo();else if("swatch"===d){$("#pico-toolbar-0 .swcolors").empty();if(null!=a.colors){d="";for(e=0;ee&&($("#pico-toolbar-0 .swcolors").append('
                    • '),$("#pico-toolbar-0 .swcolors .color"+(e+1)).css("background-color",f).data("color",g));d+='
                      '}$(".pico-swatches-container-image").empty().append(d)}else $(".pico-swatches-container-image").empty();this.heap.swatches=a.colors}else"histogram"===d?this.drawHistogram(a):"fill"===d?(this.saveUndo(),this.getSelectedLayer().drawImageData(a,e.left,e.top),this._refreshAll()): "raw"===d?this.newTab({name:a.name,image:a.image,width:a.width,height:a.height,imageFormat:picozu.FILE_FORMAT_RAW}):this.getSelectedLayer().drawImageData(a,e.left,e.top)}0===this.heap.queue.length&&(b===picozu.WORKER_TYPE_OTHER||b===picozu.WORKER_TYPE_FILTER||b===picozu.WORKER_TYPE_FRACTAL||b===picozu.WORKER_TYPE_BLENDMODE)&&this._refreshAll();this.log(l("%thread processed")+' '+l("%id")+":"+c+"",l("%KERNEL"));this.hideLoader()}this.selectNone();return this}; picozu.objects.workspace.prototype.hasWorkerSupport=function(){return!!window.Worker}; picozu.objects.workspace.prototype.spawnThread=function(a,c,b){a=parseInt(a);var d=this,e=d.threads.length;if(this.hasWorkerSupport()){this.initTime=+new Date;switch(a){case picozu.WORKER_TYPE_FILTER:!0!==b.preview&&this.showLoader();this.threads[e]=new Worker(picozu.DEFAULT_WORKER_PATH+"filters/"+c+".js");break;case picozu.WORKER_TYPE_TEXTURE:this.showLoader();this.threads[e]=new Worker(picozu.DEFAULT_WORKER_PATH+"textures/"+c+".js");break;case picozu.WORKER_TYPE_BLENDMODE:!0!==b.preview&&this.showLoader(); this.threads[e]=new Worker(picozu.DEFAULT_WORKER_PATH+"blendmodes/"+c+".js");break;case picozu.WORKER_TYPE_FRACTAL:this.showLoader();this.threads[e]=new Worker(picozu.DEFAULT_WORKER_PATH+"fractals/"+c+".js");break;case picozu.WORKER_TYPE_PROCESS:"fill"===c&&this.showLoader();this.showLoader();this.threads[e]=new Worker(picozu.DEFAULT_WORKER_PATH+"processors/"+c+".js");break;case picozu.WORKER_TYPE_OTHER:this.showLoader(),this.threads[e]=new Worker(picozu.DEFAULT_WORKER_PATH+"other/"+c+".js")}this.threads[e].addEventListener("message", function(f){d._processThread(f.data,e,a,c,b.preview)},!1);this.threads[e].addEventListener("error",function(a){d.log(l("%thread")+' #'+e+" "+l("%failed at line")+' '+a.lineno+" "+l("%in")+' '+a.filename+" "+l("%with the message")+' '+a.message+"",l("%ERR"));d._processThreadError(e)},!1);this.threads[e].postMessage(b);this.log(l("%thread spawned")+' '+l("%id")+":"+e+' '+ l("%type")+":"+c+" "+(!0===b.preview?''+l("%mode")+":preview":"")+("undefined"!==typeof b.imageData?' '+l("%size")+":"+b.imageData.data.length+"":""),l("%KERNEL"))}return this};picozu.objects.workspace.prototype._killThread=function(a){null!==this.threads[a]&&(this.threads[a].terminate(),this.log(l("%thread terminated")+' '+l("%id")+":"+a+"",l("%KERNEL")));return this}; picozu.objects.workspace.prototype._processThreadError=function(a){this._killThread(a).error(l("%main.threadprocesserror")).hideLoader().processQueue();return this};picozu.objects.workspace.prototype._reorderLayers=function(a){for(var c=1,b=a.length-1;0<=b;b--){var d=a[b].split("-").pop();this.getSelectedTab().layers[d].setPosition(c);c++}this.reorderLayers();return this}; picozu.objects.workspace.prototype.reorderLayers=function(){this.getSelectedTab().layers.sort(function(a,c){var b=a.properties.position,d=c.properties.position;return bd?1:0});this._refreshLayers();return this}; picozu.objects.workspace.prototype._parseLayers=function(a,c){var b,d,e,f,g;if(0'+a[h].getName()+'')}return this}; picozu.objects.workspace.prototype._refreshLayers=function(){var a=this.getSelectedTab();$(".layers-items-list").empty();if(a&&1'+b+'')}}else $(".layers-items-list").append('
                    • '+l("%no layers")+"
                    • ");return this};picozu.objects.workspace.prototype.flattenLayers=function(){this.getSelectedTab().flatten(!0);this._refreshAll();return this}; picozu.objects.workspace.prototype.duplicateLayer=function(a){"undefined"!==typeof a?this.getSelectedTab().layers[a].duplicate():this.getSelectedLayer().duplicate();this._refreshAll();return this};picozu.objects.workspace.prototype.selectNextLayer=function(){for(var a=this.getSelectedTab().countLayers()+1,c=this.getSelectedLayer().getId()+1;c"+b.getHandle().capitalize()+" "+l("%uninstalled successfully"));return this}; picozu.objects.workspace.prototype.loadPlugin=function(a,c){var b=null,b=window.picozu.extensions.plugins[a];if("undefined"!==typeof b&&null!==b)return b=new picozu.objects.plugin(b,this),"object"===typeof b.install()?(("undefined"===typeof c||!0===c)&&this.notify(l("%Plugin")+" "+b.getHandle().capitalize()+" "+l("%installed successfully")),b):!1;this.log(l("%plugin.notfound")+" "+a.capitalize(),l("%ERR"));return!1}; picozu.objects.workspace.prototype.dispatchAction=function(a,c){for(var b=0;bd[0]&&(h+=g);f(a,c,b,[h,h+d[1]-1],"bytes"==e,g)},j=e();j&&(h&&("undefined"!=typeof j.onload?j.onload=function(){"200"==j.status&&h.call(g,this);j=null}:j.onreadystatechange=function(){4== j.readyState&&("200"==j.status&&h.call(g,this),j=null)}),j.open("HEAD",a,!0),j.send(null))}else f(a,c,b);return this}; picozu.objects.workspace.prototype.doRequest=function(a,c,b,d,e,f,g){var h=this,j;j=null;parent!==window&&(j=document.referrer);null===c&&(c="");c+="&key="+picozu.API_KEY;null!==j&&(c+="&sign="+window.btoa(j));$.ajax({type:picozu.API_METHOD,dataType:"undefined"!==typeof e?e:"jsonp",xhrFields:{withCredentials:"undefined"===typeof f||!0===f?!0:!1},crossDomain:!0,data:c,url:a,async:"undefined"===typeof g||!0==g?!0:!1,success:b instanceof Function?b:function(){},error:d instanceof Function?d:function(){}, complete:function(){h.hideLoader()}});return this};picozu.objects.workspace.prototype.heartbeat=function(a,c){var b=this;this.doRequest(picozu.API_HEARTBEAT,null,function(c){b.setSetting("online",!0);if("ok"===c.status&&(b._appCapabilities=c.capabilities,b.parameters.whiteLabel=0===c.whitelabel?!1:!0,b.parameters.logo=""===c.logo?null:c.logo,0!==c.user.id&&b.fillAccount(c),a instanceof Function))return a.call(b)},function(){b.setSetting("online",!1);if(c instanceof Function)return c.call(b)},"json")}; picozu.objects.workspace.prototype._heartbeat=function(){var a=this;this.heartbeat(function(){a._setupDefaultUI()},function(){a._setupDefaultUI()});return this};picozu.objects.workspace.prototype.hasSelection=function(){return 0=a.length&&$("#menu-edit-undo").addClass("disabled"),c=setInterval(function(){b._refreshAll();clearInterval(c)},2E3)):$("#menu-edit-undo").addClass("disabled");return this}; picozu.objects.workspace.prototype.setStorage=function(a,c){if(!0===this.getCapability("webstorage",picozu.SCOPE_BROWSER))if(!0===this.getCapability("metroUI",picozu.SCOPE_BROWSER))Windows.Storage.ApplicationData.current.roamingSettings.values[a]=JSON.stringify(c);else return"object"===typeof c?localStorage.setItem(a,JSON.stringify(c)):localStorage.setItem(a,c);return!1}; picozu.objects.workspace.prototype.getStorage=function(a){return!0===this.getCapability("webstorage",picozu.SCOPE_BROWSER)?!0===this.getCapability("metroUI",picozu.SCOPE_BROWSER)?((a=Windows.Storage.ApplicationData.current.roamingSettings.values[a])&&(a=JSON.parse(a)),a):JSON.parse(localStorage.getItem(a)):!1}; picozu.objects.workspace.prototype.delStorage=function(a){!0===this.getCapability("webstorage",picozu.SCOPE_BROWSER)&&(!0===this.getCapability("metroUI",picozu.SCOPE_BROWSER)?Windows.Storage.ApplicationData.current.roamingSettings.values.remove(a):localStorage.removeItem(a));return this};picozu.objects.workspace.prototype.clearStorage=function(){!0===this.getCapability("webstorage",picozu.SCOPE_BROWSER)&&!0!==this.getCapability("metroUI",picozu.SCOPE_BROWSER)&&localStorage.clear();return this}; picozu.objects.workspace.prototype.clearCustomSwatches=function(){return this.confirmWindow(l("%main.clearswatches"),l("%main.clearswatches.text"),function(){this.heap.customSwatches=[];this.setStorage("customSwatches",[]);$(".pico-swatches-container-custom").empty();this.notify(l("%main.clearswatches.success"))})}; picozu.objects.workspace.prototype.refreshCustomSwatches=function(){var a="",c=this.getStorage("customSwatches");if(null!==c)for(var b=0;b';$(".pico-swatches-container-custom").empty().append(a);this.setStorage("customSwatches", d);this.heap.customSwatches=d;return this};picozu.objects.workspace.prototype.addCustomSwatch=function(a){var c=this.getStorage("customSwatches");this.heap.customSwatches.push(a);null===c&&(c=[]);c.push(a);this.setStorage("customSwatches",c);$(".pico-swatches-container-custom").append('
                      ');return this}; picozu.objects.workspace.prototype.deleteCustomSwatch=function(a){this.heap.customSwatches.splice(a,1);return this}; picozu.objects.workspace.prototype.exportColorPalette=function(a){this.showLoader();var c="",b="",d=[];if("image"===this.heap.paletteExport)d=this.heap.swatches;else{this.refreshCustomSwatches();for(var e=0;e'),this.doRequest(picozu.API_CONVERT,"contents="+c+"&format="+b,function(a){$(".pico-iframe").attr("src",picozu.API_RETRIEVE+"?temp=1&file="+a.code+"&format="+a.format)},null,"json",!1)):this.error(l("%main.offline")).hideLoader();return this};picozu.objects.workspace.prototype.getSwatches=function(){return this.heap.swatches}; picozu.objects.workspace.prototype.error=function(a,c){return this.notify(a,!0,c)};picozu.objects.workspace.prototype.infoWindow=function(a,c){this.modal.open({title:a,text:c,leftButtons:[l("%main.ok")],rightButtons:null,onClick:function(){return!1}});return this};picozu.objects.workspace.prototype.confirmWindow=function(a,c,b){var d=this;this.modal.open({title:a,text:c,onClick:function(a){if(a===picozu.BUTTON_YES)return b.apply(d)}});return this}; picozu.objects.workspace.prototype.notify=function(a,c,b){this.notifier.trigger({title:!0===c?l("%Error"):"undefined"!==typeof b?b:l("%Info"),error:!0===c?!0:!1,content:a});!0===c&&this.log(a,l("%ERR"));return this};picozu.objects.workspace.prototype.insertStyle=function(a,c){"undefined"!==typeof c&&!0===c&&(a=picozu.DEFAULT_PLUGINS_PATH+a+"/"+a+".css");$('').appendTo("head");return this}; picozu.objects.workspace.prototype.insertScript=function(a,c,b){"undefined"!==typeof c&&""!==c&&(a=picozu.DEFAULT_PLUGINS_PATH+c+"/"+a+".js",b="generic-"+c);var d=document.getElementsByTagName("script")[0];document.getElementById(b)||(c=document.createElement("script"),c.id=b,c.async=!0,c.src=a,d.parentNode.insertBefore(c,d));return this}; picozu.objects.workspace.prototype.removeWindow=function(a){var c;if("object"===typeof a)for(var b=0;b=a)$(b).empty();else{1«');if(11>a)for(i=1;i<=a;i++)d=c==i?d+("
                    • "+i+"
                    • "):d+('
                    • '+i+"
                    • ");else if(11<=a)if(7>c){for(i=1;8>i;i++)d=c==i?d+("
                    • "+i+"
                    • "):d+('
                    • '+i+"
                    • ");d+='
                    • ...
                    • '+a+"
                    • "}else if(a-4>c&&41
                    • ...
                    • '; for(i=c-2;i<=parseInt(c)+2;i++)d=c==i?d+("
                    • "+i+"
                    • "):d+('
                    • '+i+"
                    • ");d+='
                    • ...
                    • '+a+"
                    • "}else{d+='
                    • 1
                    • ...
                    • ';for(i=a-7;i<=a;i++)d=c==i?d+("
                    • "+i+"
                    • "):d+('
                    • '+i+"
                    • ")}c<=a-1&&(d+='');$(b).empty().append(d);return this}}; picozu.objects.workspace.prototype.rebuildCurves=function(){var a="",c=this.getStorage("curves");if(null!==c){for(var b=0;b'+c[b].handle+"";a+='
                    •  
                    • '}a+='
                    • '+l("%Clear recent curves")+"
                    • ";$("#menu-curves-list").empty().append(a);return this}; picozu.objects.workspace.prototype.rebuildExporters=function(){for(var a="",c=0;c ':a+('
                    • '+picozu.EXPORTERS[c].name+"
                    • ");$("#menu-exporters-list").empty().append(a);return this}; picozu.objects.workspace.prototype.rebuildTools=function(){for(var a="",c=0;c'+picozu.TOOLS[c].name+"";$("#menu-tools-list").empty().append(a);return this}; picozu.objects.workspace.prototype.rebuildImporters=function(){for(var a="",c=0;c ':a+('
                    • '+picozu.IMPORTERS[c].name+"
                    • ");$("#menu-importers-list").empty().append(a);return this}; picozu.objects.workspace.prototype.showLoader=function(){$(".picozu").prepend('
                      ');$(".pico-worker-loader").fadeIn(1E3);return this};picozu.objects.workspace.prototype.hideLoader=function(){$(".pico-worker-loader").fadeOut(1E3,function(){$(this).remove()});return this}; picozu.objects.workspace.prototype.switchWorkspace=function(a){switch(a){case 0:this.loadTheme(picozu.THEME_DEFAULT);this.propbars[1].hide();this.toolbars[0].show();this.dockbars[0].hide();this._unloadPlugins();break;case 1:this.loadTheme(picozu.THEME_DEFAULT);this.propbars[1].show();this.toolbars[0].show();this.dockbars[0].show();this._unloadPlugins();this._loadPlugins(picozu.DEFAULT_PLUGINS);break;case 2:this.loadTheme(picozu.THEME_DEFAULT);this.propbars[1].hide();this.toolbars[0].show();this.dockbars[0].show(); this._unloadPlugins();this._loadPlugins(picozu.DEFAULT_EDUCATIONAL_PLUGINS);break;case 3:this.loadTheme(picozu.THEME_KIDS),this.propbars[1].hide(),this.toolbars[0].show(),this.dockbars[0].show(),this._unloadPlugins(),this._loadPlugins(picozu.DEFAULT_KIDS_PLUGINS)}return this};picozu.objects.workspace.prototype.toggleFullscreen=function(){!this.isFullscreen()?this._enterFullscreen():this._leaveFullscreen();return this}; picozu.objects.workspace.prototype.isFullscreen=function(){return!(document.fullScreenElement&&null!==document.fullScreenElement||!document.mozFullScreen&&!document.webkitIsFullScreen)}; picozu.objects.workspace.prototype.newTab=function(a){return this.tabs.length>picozu.MAX_TABS-1?(this.error(l("%tab.toomany")),!1):new picozu.objects.tab({parent:this,name:a.name,image:"undefined"!==typeof a.image?a.image:null,imageData:"undefined"!==typeof a.imageData?a.imageData:null,imageFormat:"undefined"!==typeof a.imageFormat?a.imageFormat:"undefined",width:"undefined"!==typeof a.width?a.width:picozu.DEFAULT_WIDTH,height:"undefined"!==typeof a.height?a.height:picozu.DEFAULT_HEIGHT,layers:"undefined"!== typeof a.layers?a.layers:"undefined",handle:"undefined"!==typeof a.handle?a.handle:"undefined",id:"undefined"!==typeof a.id?a.id:"undefined",hasBackground:"undefined"!==typeof a.hasBackground?a.hasBackground:!1,backgroundColor:"undefined"!==typeof a.backgroundColor?a.backgroundColor:"undefined"})};picozu.objects.workspace.prototype._getWindowData=function(a){for(var c=0;c section").append(a);return this};picozu.objects.workspace.prototype.getSelectedTab=function(){return this.heap.activeTab};picozu.objects.workspace.prototype.controls=function(){return{tabs:this.tabs,toolbars:this.toolbars,dockbars:this.dockbars,windows:this.windows,menus:this.menus,contextmenus:this.contextmenus,propbars:this.propbars,taskbar:this.taskbar}}; picozu.objects.workspace.prototype.validateImageURL=function(a){return null!=a.match(/\.(jpeg|jpg|gif|png)$/)};picozu.objects.workspace.prototype.validateBase64=function(a){return/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/.test(a)};picozu.objects.workspace.prototype.validateImageSize=function(a){return 0a&&!isNaN(a)?!0:!1}; picozu.objects.workspace.prototype.validUsername=function(a){return 0===a.length?!1:4>a.length||50a.length||50',c=this.getParam("foregroundColor"),$("#"+b).append(a),$("#"+b+" .pico-textform").focus().data("editing","true").css("font-family",d.getParameter("fontFamily")).css("line-height",d.getParameter("fontSize")+"px").css("font-size",d.getParameter("fontSize")).css("font-style", d.getParameter("fontStyle")).css("font-weight",d.getParameter("fontWeight")).css("text-align",d.getParameter("fontAlign")).css("color","#"+Color.rgb2hex(c[0],c[1],c[2])).css("opacity",d.getOpacity()/10),$("#"+b+" .pico-textform-helper").css("left",d.getCoords().left-2).css("top",d.getCoords().top-3).show(),$(".pico-textform-helper").on("click",".validate",function(){var a=$("#"+b+" .pico-textform").val();$("#"+b+" .pico-textform").width();$("#"+b+" .pico-textform").height();$(".pico-textform-helper").remove(); $.fn.tipsy.revalidate();d.setText(a).drawText()}),$(".pico-textform-helper").on("click",".invalidate",function(){$(".pico-textform-helper").remove();$.fn.tipsy.revalidate()}))}}; picozu.events.onCanvasMouseUp=function(a){null!==this.heap.minimap&&(this.heap.minimap.selected=!1);var c=this._normalizeCoords(a.pageX,a.pageY);if(1e&&(f.strokeStyle= "rgba("+Math.floor(Math.random()*g[0])+", "+Math.floor(Math.random()*g[1])+", "+Math.floor(Math.random()*g[2])+", "+0.1*this.workspace.getParam("opacity")+")",f.beginPath(),f.moveTo(this.points[this.count][0]+0.2*b,this.points[this.count][1]+0.2*d),f.lineTo(this.points[h][0]-0.2*b,this.points[h][1]-0.2*d),f.stroke());this.prevX=a;this.prevY=c;this.count++;return this}}); picozu.tools.pencil_circles=picozu.objects.brush.extend({start:function(a,c){this.prevX=a;this.prevY=c;this._setLineWidth();this._setStroke(0.1);return this},move:function(a,c){for(var b=this.layer.getContext(),d=a-this.prevX,e=c-this.prevY,f=2*Math.sqrt(d*d+e*e),d=100*Math.floor(a/100)+50,e=100*Math.floor(c/100)+50,g=Math.floor(10*Math.random()),f=f/g,h=0;he&&Math.random()>e/2E3&&(f.beginPath(),f.moveTo(a+0.5* b,c+0.5*d),f.lineTo(a-0.5*b,c-0.5*d),f.stroke());this.prevX=a;this.prevY=c;this.count++;return this}}); picozu.tools.pencil_grassy=picozu.objects.brush.extend({start:function(a,c){this.prevX=a;this.prevY=c;this._setLineWidth();this._setStroke(0.1);return this},move:function(a,c){function b(a,b,c,d,e){var f=Math.sin(c);c=Math.cos(c);d-=a;e-=b;var g=d*f+e*c;d=d*c-e*f+a;return{x:d,y:g+b}}var d=this.layer.getContext();for(this.points.push([a,c]);100h/j&&n+100>s&&(h=20*Math.random(),r=h*Math.PI/180,g*=0.3,f*=0.3,h=b(a,c,r,k-g,m-f),e.push([h.x,h.y]),h=b(a,c,r,a+g,c+f),e.push([h.x,h.y]),h=180*Math.random(),r=h*Math.PI/180,h=b(a,c,r,k-g,m-f),e.push([h.x,h.y]),h=b(a,c,r,a+g,c+f),e.push([h.x,h.y]));f=e.length;for(k=0;kh;h++)b.beginPath(),b.moveTo(d,e),b.quadraticCurveTo(a+Math.random()*f,c+Math.random()*g,d,e),b.stroke();return this}}); picozu.tools.pencil_longfur=picozu.objects.brush.extend({start:function(a,c){this.prevX=a;this.prevY=c;this._setLineWidth();this._setStroke(0.05);return this},move:function(a,c){var b,d,e,f,g=this.layer.getContext();this.points.push([a,c]);for(var h=0;hf&&Math.random()>f/4E3&&(g.beginPath(),g.moveTo(this.points[this.count][0]+d*b,this.points[this.count][1]+ e*b),g.lineTo(this.points[h][0]-d*b+2*Math.random(),this.points[h][1]-e*b+2*Math.random()),g.stroke());this.count++;return this}}); picozu.tools.pencil_normal=picozu.objects.brush.extend({__constructor:function(a,c,b){this.layer=a;this.workspace=b;this.oldSize=this.workspace.getParam("brushSize");this.workspace.setParam("brushSize",1)},__destructor:function(){this.workspace.setParam("brushSize",this.oldSize)},start:function(a,c){this.prevX=a;this.prevY=c;this._setLineWidth();this._setStroke(0.2);return this},move:function(a,c){var b=this.layer.getContext();b.beginPath();b.moveTo(this.prevX,this.prevY);b.lineTo(a,c);b.stroke(); this.prevX=a;this.prevY=c;return this},end:function(a,c,b,d){a=this.layer.getContext();a.closePath();d&&d.shiftKey&&a.fill();a.stroke();return this}}); picozu.tools.pencil_palm=picozu.objects.brush.extend({start:function(a,c){this.prevX=a;this.prevY=c;this._setLineWidth();this._setStroke(0.1);return this},move:function(a,c){function b(a,b,c,d,e){var f=Math.sin(c);c=Math.cos(c);d-=a;e-=b;var g=d*f+e*c;d=d*c-e*f+a;return{x:d,y:g+b}}var d=this.layer.getContext();for(this.points.push([a,c]);100h/j&&n+100>s&&(g*=0.3,f*=0.3,h=90,r=h*Math.PI/180,h=b(a,c,r,k-g,m-f),e.push([h.x,h.y]),h=b(a,c,r,a+g,c+f),e.push([h.x,h.y]),h=270,r=h*Math.PI/180,h=b(a,c,r,k-g,m-f),e.push([h.x,h.y]),h=b(a,c,r,a+g,c+f),e.push([h.x,h.y]));f=e.length;for(k=0;ke.length&&e.push(0.5*this.workspace.getParam("opacity"));this.prevX=a;this.prevY=c;for(var f=0;50>f;f++)this.points.push({dx:(window.innerWidth-20)/2,dy:(window.innerHeight-20)/2,ax:0,ay:0,div:0.1,ease:0.2*Math.random()+0.6});this._i=setInterval(function(){d.lineWidth=b.workspace.getParam("brushSize");d.strokeStyle=Color.color2Exp("rgba",e); for(var a=0;ab&&(f.strokeStyle="rgba("+e[0]+", "+e[1]+","+e[2]+", "+0.1*(1-b/1E3)*this.workspace.getParam("opacity")+ ")",f.beginPath(),f.moveTo(this.points[this.count][0],this.points[this.count][1]),f.lineTo(this.points[g][0],this.points[g][1]),f.stroke());this.prevX=a;this.prevY=c;this.count++;return this}}); picozu.tools.pencil_dynamic=picozu.objects.brush.extend({__constructor:function(a,c,b){function d(){this.lasty=this.lastx=this.drag=this.mass=this.angy=this.angx=this.acc=this.accy=this.accx=this.vel=this.vely=this.velx=this.cury=this.curx=0;this.fixedangle=e.FIXED_ANGLE}var e=this;this.layer=a;this.workspace=b;this.curmass=0.5;this.curdrag=0.35;this.WIDTH=0.3;this.FIXED_ANGLE=0;this.MIN_MASS=1;this.MAX_MASS=160;this.MIN_DRAG=0;this.MAX_DRAG=0.5;this.xsize=this.layer.getWidth();this.ysize=this.layer.getWidth(); this.xyratio=this.xsize/this.ysize;this.my=this.mx=this.odely=this.odelx=0;this.isMouseDown=!1;this.oldCap=this.layer.getContext().lineCap;this.layer.getContext().lineJoin=this.layer.getContext().lineCap="round";d.prototype.setpos=function(a,b){this.curx=a;this.cury=b;this.lastx=a;this.lasty=b;this.accy=this.accx=this.vely=this.velx=0};d.prototype.apply=function(a,b){var c,d,k,m;c=e._flerp(e.MIN_MASS,e.MAX_MASS,e.curmass);d=e._flerp(e.MIN_DRAG,e.MAX_DRAG,e.curdrag*e.curdrag);k=a-this.curx;m=b-this.cury; this.acc=Math.sqrt(k*k+m*m);if(1E-6>this.acc)return 0;this.accx=k/c;this.accy=m/c;this.velx+=this.accx;this.vely+=this.accy;this.vel=Math.sqrt(this.velx*this.velx+this.vely*this.vely);if(1E-6>this.vel)return 0;this.angx=-this.vely;this.angy=this.velx;this.angx/=this.vel;this.angy/=this.vel;this.fixedangle&&(this.angx=0.6,this.angy=0.2);this.velx*=1-d;this.vely*=1-d;this.lastx=this.curx;this.lasty=this.cury;this.curx+=this.velx;this.cury+=this.vely;return 1};this.mouse=new d;setInterval(function(){e.isMouseDown&& e.mouse.apply(e.mx,e.my)&&e._draw()},5)},_flerp:function(a,c,b){return a*(1-b)+c*b},_draw:function(){var a=this.layer.getContext(),c=this.workspace.getParam("foregroundColor");4>c.length&&c.push(0.5*this.workspace.getParam("opacity"));var b,d,e,f,g,h;d=0.04-this.mouse.vel;d*=this.WIDTH;1E-5>d&&(d=1E-5);b=this.mouse.angx*d;d*=this.mouse.angy;e=this.mouse.lastx;f=this.mouse.lasty;g=this.mouse.curx;h=this.mouse.cury;a.fillStyle=Color.color2Exp("rgba",c);a.strokeStyle=Color.color2Exp("rgba",c);a.beginPath(); a.moveTo(this.xsize*(e+this.odelx)/this.xyratio,this.ysize*(f+this.odely));a.lineTo(this.xsize*(e-this.odelx)/this.xyratio,this.ysize*(f-this.odely));a.stroke();a.lineTo(this.xsize*(g-b)/this.xyratio,this.ysize*(h-d));a.lineTo(this.xsize*(g+b)/this.xyratio,this.ysize*(h+d));a.closePath();a.fill();this.odelx=b;this.odely=d},__destructor:function(){this.layer.getContext().lineJoin=this.layer.getContext().lineCap=this.oldCap},end:function(){this.isMouseDown=!1},start:function(a,c){this.isMouseDown=!0; this.mx=this.xyratio*a/this.xsize;this.my=c/this.ysize;this.mouse.setpos(this.mx,this.my);this.odely=this.odelx=0;return this},move:function(a,c){this.mx=this.xyratio*a/this.xsize;this.my=c/this.ysize;return this}}); picozu.tools.pencil_sketchy=picozu.objects.brush.extend({start:function(a,c){this.prevX=a;this.prevY=c;this._setLineWidth();this._setStroke(0.05);return this},move:function(a,c){var b,d,e,f=this.layer.getContext();this.points.push([a,c]);f.beginPath();f.moveTo(this.prevX,this.prevY);f.lineTo(a,c);f.stroke();for(var g=0;ge&&Math.random()>e/2E3&&(f.beginPath(),f.moveTo(this.points[this.count][0]+ 0.3*b,this.points[this.count][1]+0.3*d),f.lineTo(this.points[g][0]-0.3*b,this.points[g][1]-0.3*d),f.stroke());this.prevX=a;this.prevY=c;this.count++;return this}}); picozu.tools.pencil_sketchtaculous=picozu.objects.brush.extend({start:function(a,c){this.prevX=a;this.prevY=c;this._setLineWidth();this._setStroke(0.05);return this},move:function(a,c){var b,d,e,f=this.layer.getContext();this.points.push([a,c]);f.beginPath();f.moveTo(this.prevX,this.prevY);f.lineTo(a,c);f.stroke();for(var g=0;ge&&Math.random()>e/2E4&&(f.beginPath(),f.moveTo(this.points[this.count][0]+ 0.3*b,this.points[this.count][1]+0.3*d),f.lineTo(this.points[g][0]-0.3*b,this.points[g][1]-0.3*d),f.stroke());this.prevX=a;this.prevY=c;this.count++;return this}}); picozu.tools.pencil_squares=picozu.objects.brush.extend({start:function(a,c){this.prevX=a;this.prevY=c;this._setLineWidth();this._setStroke(0.1);this._setFill(0.1);return this},move:function(a,c){var b=a-this.prevX,d=c-this.prevY,e=this.layer.getContext(),f=Math.cos(1.57079633)*b-Math.sin(1.57079633)*d,b=Math.sin(1.57079633)*b+Math.cos(1.57079633)*d;e.beginPath();e.moveTo(this.prevX-f,this.prevY-b);e.lineTo(this.prevX+f,this.prevY+b);e.lineTo(a+f,c+b);e.lineTo(a-f,c-b);e.lineTo(this.prevX-f,this.prevY- b);e.fill();e.stroke();this.prevX=a;this.prevY=c;return this}}); picozu.tools.pencil_string=picozu.objects.brush.extend({start:function(a,c){this.prevX=a;this.prevY=c;this._setLineWidth();return this},move:function(a,c){var b=this.workspace.getParam("foregroundColor"),d=a+10*(Math.random()-0.5),e=c+10*(Math.random()-0.5),f=this.layer.getContext();4>b.length&&b.push(0.15);if(this.count){this.points.push([d,e]);f.beginPath();f.moveTo(this.prevX,this.prevY);f.lineTo(d,e);f.stroke();for(var g=this.points.slice(this.points.length-15,this.points.length),h=0;hb&&0.9f;f++){var g=d*Math.cos((72*f-20)*Math.PI/180),h=d*Math.sin((72*f-20)*Math.PI/180);a.lineTo(c+g,b+h);g=e*Math.cos((72*f-20+36)*Math.PI/180);h=e*Math.sin((72*f-20+36)*Math.PI/180);a.lineTo(c+g,b+h)}a.fill();a.stroke();return this}}); picozu.tools.pencil_rounds=picozu.objects.brush.extend({__constructor:function(a,c,b){this.layer=a;this.workspace=b;this.points=[];this.oldCap=this.layer.getContext().lineCap;this.oldAlpha=this.layer.getContext().globalAlpha;this.layer.getContext().lineJoin=this.layer.getContext().lineCap="round"},__destructor:function(){this.layer.getContext().lineJoin=this.layer.getContext().lineCap=this.oldCap;this.layer.getContext().globalAlpha=this.oldAlpha},end:function(){this.points.length=0},start:function(a, c){this.points.push({x:a,y:c,radius:Others.randomInt(10,30),opacity:Math.random()});return this},move:function(a,c){var b=this.layer.getContext(),d=this.workspace.getParam("foregroundColor");b.fillStyle=Color.color2Exp("rgb",d);this.points.push({x:a,y:c,radius:Others.randomInt(5,20),opacity:Math.random()});for(d=0;db&&(f.strokeStyle="rgba("+e[0]+", "+e[1]+","+e[2]+", "+0.1*(1-b/1E5)*this.workspace.getParam("opacity")+ ")",f.beginPath(),f.moveTo(this.points[this.count][0],this.points[this.count][1]),f.lineTo(this.points[g][0],this.points[g][1]),f.stroke());this.prevX=a;this.prevY=c;this.count++;return this}}); picozu.tools.pencil_smooth=picozu.objects.brush.extend({start:function(a,c){this.layer.getContext().globalCompositeOperation="source-over";this.prevX=a;this.prevY=c;this._setLineWidth();this._setStroke(0.1);return this},move:function(a,c){for(var b=a-this.prevX,d=c-this.prevY,e=this.layer.getContext(),f=2*Math.sqrt(b*b+d*d),b=100*Math.floor(a/100)+50,d=100*Math.floor(c/100)+50,g=Math.floor(10*Math.random()),f=f/g,h=0;h'}).addFooter(''+ l("%camera.newimage")+' '+l("%camera.newlayer")+' '+l("%main.cancel")+"");$(c).on("click",".capture-layer",function(){(new picozu.objects.layer({parent:a.getSelectedTab(),width:640,height:480,name:"Camera Image"})).drawImage(b.heap.video,640,480).select()}).on("click",".capture-image",function(){a.newTab({width:640,height:480,imageData:b.heap.video})})}})}}; String.toLocale({"en-US":{"%camera.title":"Camera","%camera.notsupported":"Unfortunately, your browser cannot give Picozu access to your computer camere, so therefore is not supported.","%camera.newlayer":"Capture as new layer","%camera.newimage":"Capture as new image"}}); picozu.extensions.plugins.cliparts={parameters:{title:"Cliparts",handle:"cliparts",version:"1.0",email:"office@picozu.com",url:"www.picozu.com",description:"Insert small illustrations into your Picozu workspace by choosing from four different categories."},onDisable:function(){this.removeTool("cliparts");this.removeWindow("cliparts")},onEnable:function(){this.addTool(l("%Cliparts"),"cliparts");var a=this;this.helperCliparts={page:1,folder:null,results:15,getAll:function(c,b){a.showLoader();"prev"=== c?this.page--:"next"===c?this.page++:this.page="undefined"===typeof c?1:c;"undefined"!==typeof b&&(this.folder=b);$(".pico-cliparts-list ul.photolist").empty();var d="",e=picozu.DEFAULT_CLIPARTS[this.folder],f=(this.page-1)*this.results,g=this.results*this.page;if(0=f&&h";a.paginate(Math.ceil(e/this.results),this.page,".pico-cliparts-pager");$(".pico-cliparts-list ul.photolist").append(d); a.hideLoader()},photoCallback:function(a,b,d){var e="";d||(e='
                    • ');return e}};picozu.WINDOWS.push({name:l("%Cliparts"),handle:"cliparts",center:!0,width:545,template:"

                      • '+ l("%main.noimages")+'
                        ',onCreate:function(){var c=this,b=this.getElementId(),d='";this.addFooter(picozu.BROWSER_WINDOW_FOOTER);for(var e in picozu.DEFAULT_CLIPARTS)d+='";$(b+" .categories").append(d);$(b).on("change",".categories",function(){$(".pico-cliparts-pager").empty();a.helperCliparts.getAll(1,c.getStrValue(".categories"));return!1}).on("click", ".reload",function(){a.helperCliparts.getAll(1,c.getStrValue(".categories"));return!1}).on("click",".pagination a",function(){$(this).parent("li").hasClass("next")?a.helperCliparts.getAll("next"):$(this).parent("li").hasClass("prev")?a.helperCliparts.getAll("prev"):a.helperCliparts.getAll(parseInt($(this).text()));return!1}).on("click",".photolist ul li a",function(){a.showLoader();var b=$(this).attr("href"),c=new Image;c.onload=function(){a.saveUndo();(new picozu.objects.layer({parent:a.getSelectedTab(), left:0,top:0,width:c.width,height:c.height,name:"Clipart"})).drawImage(c,c.width,c.height).select();a._refreshAll();a.hideLoader()};c.onerror=function(){a.notify(l("%main.image.notloaded"),!0).hideLoader()};c.src=b;return!1})}})}};String.toLocale({"en-US":{"%Cliparts":"Cliparts","%Category":"Category"}});picozu.DEFAULT_CLIPARTS={cute:60,doodles:9,flowers:21,leaves:11}; picozu.extensions.plugins.collage={parameters:{title:"Collage",handle:"collage",version:"1.0",email:"office@picozu.com",url:"www.picozu.com",description:"This plugin helps you create different type of photo collages with your favorite photos."},onDisable:function(){this.removeTool("collage");this.removeWindow("collage");this.helpers.collage=null},onEnable:function(){this.addTool(l("%Collage"),"collage");var a=this;this.helpers.collage={done:!1,width:1024,height:768,createLayers:!1,thumbWidth:300, thumbHeight:240,count:1,tab:null,files:[],ratios:{width:0.932,height:0.9},styleRatiosCalculate:function(a,b){this.ratios.padding=Math.round((a-a*this.ratios.width)/2);this.ratios.widthToHeightRatio=a*this.ratios.width/(b*this.ratios.height);this.ratios.heightToWidthRatio=b*this.ratios.height/(a*this.ratios.width)},prepare:function(){var c=a.getSelectedTab();c.heap.collage=!0;c.getCoords();c.getPreviewLayer().getCanvas();this.tab=a.newTab({width:this.width,name:"collage",height:this.height}).activate(); a.addDefaultWatermark().hideLoader();this.done=!0},drawImage:function(a,b,d,e){var f=Math.floor(97*Math.random())-48;b.save();b.translate(d+this.thumbWidth/2,e+this.thumbHeight/2);b.rotate(Math.PI/180*f);b.translate(-this.thumbWidth/2,-this.thumbHeight/2);b.shadowOffsetX=0.0125*this.thumbWidth;b.shadowOffsetY=0.0125*this.thumbHeight;b.shadowBlur=0.025*this.thumbWidth;b.shadowColor="rgba(0,0,0,0.4)";d=b.createLinearGradient(50,180,-10,20);d.addColorStop(0,"#FFFFFF");d.addColorStop(1,"#E6E1E1");b.fillStyle= d;b.fillRect(0,0,this.thumbWidth,this.thumbHeight);b.shadowOffsetX=0;b.shadowOffsetY=0;b.shadowBlur=0;b.shadowColor="transparent";b.drawImage(a,this.ratios.padding,this.ratios.padding,this.thumbWidth*this.ratios.width,this.thumbHeight*this.ratios.height);b.restore()},applySettings:function(a,b,d,e,f){this.width="undefined"!=typeof a||300>a||6E3b||6E3d||500e||500f||20

                          ',onCreate:function(){var c=this,b=this.getElementId();this.addElement({type:picozu.CONTROL_CHECKBOX,legend:l("%Create layers"),handle:"ptm-create-layers",property:"ptmCreateLayers", value:!0,checked:!1,callback:function(b){a.helpers.collage.createLayers=b}}).addFooter(picozu.BROWSER_WINDOW_FOOTER);$(b).on("click",".reload",function(){a.helpers.collage.applySettings(c.getIntValue(".width"),c.getIntValue(".height"),c.getIntValue(".twidth"),c.getIntValue(".theight"),c.getIntValue(".count"));!1===a.helpers.collage.done&&"undefined"===typeof a.getSelectedTab().heap.collage&&a.helpers.collage.prepare();a.helpers.collage.applyCollage();return!1}).on("click",".upload",function(){$(b+ " .pico-collage-upload").trigger("click");return!1}).on("change",".pico-collage-upload",function(b){b=b.target.files;for(var c=0;b[c];c++)a.helpers.collage.files.push(b[c]);return!1})}})}};String.toLocale({"en-US":{"%Collage":"Collage","%Create Collage":"Create Collage","%Select files":"Select files","%Collage width":"Collage width","%Collage height":"Collage height","%Repeat image x times":"Repeat image x times","%Thumb width":"Thumb width","%Thumb height":"Thumb height","%Create layers":"Create layers"}}); picozu.extensions.plugins.demotivator={parameters:{title:"Demotivator",handle:"demotivator",version:"1.1",email:"office@picozu.com",url:"www.picozu.com",description:"Plugin for creating (de)motivational posters."},onDisable:function(){this.removeTool("demotivator");this.removeWindow("demotivator");this.helpers.demotivator=null},onEnable:function(){this.addTool(l("%Demotivator"),"demotivator");var a=this;this.insertStyle("demotivator",!0);this.helpers.demotivator={done:!1,textLayer:null,titleLayer:null, imageLayer:null,newTab:null,leftSpacing:40,topSpacing:40,lineSize:5,titleFontSize:40,textFontSize:20,fontFamily:"Impact",imageHeight:0,text:"",title:"",prepare:function(){a.showLoader();var c=a.getSelectedTab();c._refreshPreview();c.heap.demotivator=!0;var b=c.getCoords(),c=c.getPreviewLayer().getCanvas();this.newTab=a.newTab({width:b.width+2*this.leftSpacing,height:b.height+2*this.topSpacing+120,hasBackground:!0,name:"demotivator",backgroundColor:[0,0,0,1]}).activate();this.imageLayer=(new picozu.objects.layer({parent:this.newTab, width:b.width,height:b.height,left:this.leftSpacing,composed:!0,top:this.topSpacing,name:"Demotivator Image"})).drawImage(c,b.width,b.height);c=this.imageLayer.getContext();this.imageHeight=b.height;c.lineWidth=this.lineSize;c.strokeStyle="rgb(255, 255, 255)";c.beginPath();c.moveTo(0,0);c.lineTo(b.width,0);c.lineTo(b.width,b.height);c.lineTo(0,b.height);c.closePath();c.stroke();this.titleLayer=new picozu.objects.layer({type:picozu.LAYER_TYPE_TEXT,parent:this.newTab,width:b.width,height:40,left:this.leftSpacing, text:$(".pico-window-demotivator .title").val(),name:"Demotivator Title",parameters:{fillColor:[255,255,255],fontColor:[255,255,255],fontFamily:"Impact",fontAlign:"center",drawMode:picozu.DRAW_MODE_FILL,fontSize:40},top:b.height+this.topSpacing+5});this.textLayer=new picozu.objects.layer({type:picozu.LAYER_TYPE_TEXT,parent:this.newTab,width:b.width,height:20,text:$(".pico-window-demotivator .text").val(),left:this.leftSpacing,name:"Demotivator Text",parameters:{fillColor:[255,255,255],fontColor:[255, 255,255],fontFamily:"Impact",fontAlign:"center",drawMode:picozu.DRAW_MODE_FILL,fontSize:20},top:b.height+this.topSpacing+60});a.addDefaultWatermark().hideLoader();this.apply();this.done=!0},apply:function(){this.title=$(".pico-window-demotivator .title").val();this.text=$(".pico-window-demotivator .text").val();this.titleFontSize=$(".pico-window-demotivator .titlesize").val();this.textFontSize=$(".pico-window-demotivator .textsize").val();this.fontFamily=$(".pico-window-demotivator .font").val(); this.textLayer.setText(this.text).setParameter("fontSize",this.textFontSize).setParameter("fontFamily",this.fontFamily).drawText();this.titleLayer.setText(this.title).setParameter("fontSize",this.titleFontSize).setParameter("fontFamily",this.fontFamily).drawText()}};picozu.WINDOWS.push({name:l("%demotivator.title"),handle:"demotivator",center:!0,width:500,template:"


                          ',onShow:function(){!1===a.helpers.demotivator.done&&"undefined"===typeof a.getSelectedTab().heap.demotivator&&a.helpers.demotivator.prepare()},onCreate:function(){var c= "",b="",d=this.getElementId();this.addFooter(picozu.DEFAULT_WINDOW_FOOTER);for(var e=30;71>e;e++)b=a.helpers.demotivator.titleFontSize==e?"selected ":"",c+="";$(d+" .titlesize").append(c);b=c="";for(e=10;41>e;e++)b=a.helpers.demotivator.textFontSize==e?"selected ":"",c+="";$(d+" .textsize").append(c);b=c="";for(e=0;e'+picozu.DEFAULT_FONTS[e].name+"";$(d+" .font").append(c);$(d).on("keyup.picozu","textarea",function(){a.helpers.demotivator.apply()}).on("change",".font, .textsize, .titlesize",function(){a.helpers.demotivator.apply()})}})}};String.toLocale({"en-US":{"%Demotivator":"Demotivator","%demotivator.title":"Demotivate this Image","%demotivator.titletext":"This is the title","%demotivator.maintext":"This is a long demotivator text that you can customize to your needs."}}); picozu.extensions.plugins.dropbox={parameters:{title:"Dropbox",handle:"dropbox",version:"1.12",email:"office@picozu.com",url:"www.picozu.com",requires:["internet"],description:"Dropbox integration plugin; import your Dropbox images into Picozu and export them back when you are done enhancing them."},onDisable:function(){this.removeImporter("dropboxopen");this.removeExporter("dropboxsave");this.removeWindow(["dropboxopen","dropboxsave"])},onEnable:function(){var a=this;this.addImporter(l("%Dropbox"), "dropboxopen");this.addExporter(l("%Dropbox"),"dropboxsave");this.insertScript("prerequisites","dropbox");this.insertStyle("dropbox",!0);this.connectors.dropbox={key:"vcvzkkvrq09x39b",encodedKey:"Y2q7YhCYOSA=|o6w+KaciiIeX4Q7GLvMlkCfQe66NvRck6LK9G+csbA==",page:1,results:15,folder:0,client:null,images:[],folders:[],fCnt:".pico-window-dropboxopen .folders, .pico-window-dropboxsave .folders",initialize:function(){this.client=new Dropbox.Client({key:this.key,sandbox:!0});this.isAuth();return this},getFolders:function(){a.showLoader(); var b=this;$(this.fCnt).empty();this.client.readdir("/",function(a,c,f,g){if(0-- '+l("%select folder")+" --");for(a=0;a'+g[a].name+""),b.folders.push(g[a]))}else $(b.fCnt).empty().append('")})},deauthenticate:function(){this.client.signOff();this._logout();a.notifier.trigger({title:l("%Info"), content:l("%dropbox.signout")})},authenticate:function(){var a=this;a.client.authDriver(new Dropbox.AuthDriver.Popup({receiverUrl:picozu.SITE_ENTRY_POINT+"oauth_receiver.html",rememberUser:!0}));a.client.authenticate(function(c){if(c)return a._logout(),!1;a.client.isAuthenticated()&&a._login()})},isAuth:function(){this.client.isAuthenticated()?this._login():this._logout()},upload:function(b,c){this.client.writeFile(c,b,function(b){b?a.notifier.trigger({title:l("%Error"),error:!0,content:l("%dropbox.errorupload")}): a.notifier.trigger({title:l("%Info"),content:l("%dropbox.doneupload")});a.hideLoader()})},getAll:function(){this.getFolders();this.getPhotos()},_login:function(){this.getAll();$(".pico-window-dropboxopen > footer, .pico-window-dropboxsave > footer").show();$(".pico-window-dropboxopen .folders, .pico-window-dropboxsave .folders").empty().append('");$(".pico-dropbox-loggedout").hide();$(".pico-dropbox-loggedin").show()},_logout:function(){$(".pico-window-dropboxopen > footer, .pico-window-dropboxsave > footer").hide(); $(".pico-window-dropboxopen .folders, .pico-window-dropboxsave .folders").empty();$(".pico-dropbox-loggedout").show();$(".pico-dropbox-loggedin").hide()},_retrievePhotos:function(a){var c=this;c.images=[];c.client.readdir(a,function(e,f){for(var g=0;g=g&&j'+l("%main.noimages")+"");a.paginate(Math.ceil(f/this.results),this.page,".pico-dropbox-pager");a.hideLoader()},getPhotos:function(b,c){a.showLoader();"prev"===b?this.page--:"next"===b?this.page++:this.page="undefined"===typeof b?1:b;"undefined"===typeof c&&(c="/");this._retrievePhotos(c)}, _photoCallback:function(a,c,e){"/"!==e&&(e+="/");if(!c){var f=this.client.thumbnailUrl(e+a,{sizeCode:"medium"});this.client.makeUrl(e+a,{download:!0},function(a,b){$(".pico-dropbox-list ul.photolist").append('
                        • ')})}}};var c=this.connectors.dropbox;picozu.WINDOWS.push({name:l("%dropbox.import"),handle:"dropboxopen",center:!0,width:545,onShow:function(){c.initialize()},onCreate:function(){var b= this,d=this.getElementId();this.addElement({type:picozu.CONTROL_HTML,template:'
                          '}).addElement({type:picozu.CONTROL_SELECT,legend:l("%Folder"),handle:"pico-dOfolders",cssClass:"folders",legendClass:"legend",data:[]},".pico-dropbox-loggedin").addElement({type:picozu.CONTROL_HTML,template:'
                          • '+l("%main.noimages")+ '
                            '},".pico-dropbox-loggedin").addFooter(picozu.CONNECTOR_OPEN_WINDOW_FOOTER);$(d).on("click",".logout",function(){c.deauthenticate();b.hide();return!1}).on("change",".folders",function(){c.getPhotos(1,$(this).val())}).on("click",".connect",function(){c.authenticate();return!1}).on("click",".reload",function(){c.getAll();return!1}).on("click",".photolist ul li a",function(){var c=$(this).attr("href");a.parseImageFile(c);b.hide();return!1}).on("click", ".pagination a",function(){$(this).parent("li").hasClass("next")?c.getPhotos("next"):$(this).parent("li").hasClass("prev")?c.getPhotos("prev"):c.getPhotos(parseInt($(this).text()));return!1})}});picozu.WINDOWS.push({name:l("%dropbox.export"),handle:"dropboxsave",center:!0,width:545,onShow:function(){c.initialize()},onCreate:function(){var b=this,d=this.getElementId();this.addElement({type:picozu.CONTROL_HTML,template:'
                            '}).addElement({type:picozu.CONTROL_SELECT, legend:l("%Folder"),handle:"pico-dSfolders",cssClass:"folders",legendClass:"legend",data:[]},".pico-dropbox-loggedin").addElement({type:picozu.CONTROL_TEXTINPUT_FILE,legend:l("%main.filename"),extension:"png",placeholder:"enter a file name",handle:"pz-dropboxsave-filename",legendClass:"legend"},".pico-dropbox-loggedin").addFooter(picozu.CONNECTOR_SAVE_WINDOW_FOOTER);$(d).on("click",".save",function(){var d=b.getStrValue("#pz-dropboxsave-filename"),f=b.getStrValue("#pico-dSfolders");""!==d?(a.showLoader(), a.exportData(picozu.FILE_FORMAT_PNG,function(a){a=picozu.objects.crypter.base64.decodeArrayBuffer(a.split(",")[1]);c.upload(a,f+"/"+d+".png");b.setValue("#pz-dropboxsave-filename","");b.hide()})):a.notifier.trigger({title:l("%Error"),error:!0,content:l("%dropbox.filename")});return!1}).on("click",".connect",function(){c.authenticate();return!1}).on("click",".logout",function(){c.deauthenticate();b.hide();return!1})}})}}; String.toLocale({"en-US":{"%Dropbox":"Dropbox","%dropbox.errorupload":"Error uploading your image to Dropbox.","%dropbox.doneupload":"Image uploaded successfully to Dropbox.","%dropbox.signout":"Successfully signed out from Dropbox.","%dropbox.import":"Import from Dropbox","%dropbox.export":"Export to Dropbox","%dropbox.filename":"You must specify a file name."}}); picozu.extensions.plugins.facebook={parameters:{title:"Facebook",handle:"facebook",version:"1.8",email:"office@picozu.com",url:"www.picozu.com",requires:["internet"],description:"This plugin allows you to import photos from your Facebook account / pages and export them back after editing."},onDisable:function(){this.removeImporter("facebookopen");this.removeExporter("facebooksave");this.removeWindow(["facebookopen","facebooksave"])},onEnable:function(){var a=this;this.addImporter(l("%Facebook"),"facebookopen"); this.addExporter(l("%Facebook"),"facebooksave");this.insertScript("//connect.facebook.net/en_US/all.js","","facebook-jssdk");this.insertStyle("facebook",!0);window.fbAsyncInit=function(){FB.init({appId:a.connectors.facebook.key,status:!0,cookie:!0,oauth:!0,xfbml:!0})};this.connectors.facebook={key:"153040191459844",page:1,results:15,album:"",photos:[],albums:[],pages:[],fCnt:".pico-window-facebookopen .albums, .pico-window-facebooksave .albums",page:null,token:"",scope:"manage_pages,read_stream,publish_actions,user_photos", deauthenticate:function(){var b=this;FB.logout(function(){b._logout();a.notifier.trigger({title:l("%Info"),content:l("%facebook.signout")})})},getAll:function(){this.getAccess();this.getAlbums();this.getPhotos()},authenticate:function(){var a=this;FB.login(function(c){c.authResponse?(a.token=c.authResponse.accessToken,a._login()):a._logout()},{scope:a.scope})},initialize:function(){var a=this;FB.getLoginStatus(function(c){c.authResponse?a._login():a._logout()})},_getPageToken:function(a){return this.pages[a]}, upload:function(b,c,e,f){FB.api("/"+e+"/photos","post",{message:c,url:b,status:"success",access_token:this._getPageToken(f)},function(b){!b||b.error?a.notifier.trigger({title:l("%Error"),error:!0,content:l("%facebook.errorupload")}):a.notifier.trigger({title:l("%Info"),content:l("%facebook.doneupload")})})},setAlbum:function(a){this.album=a;return this},_getPhotos:function(a){var c=this;""!=a&&(this.photos=[],FB.api("/"+c.album+"/photos?type=small",function(a){c.photos=a.data;c._process()}))},getAccess:function(){a.showLoader(); var b=this,c="",e=$(".saveas");this.pages=[];FB.api("/me/accounts",function(f){e.empty().append('");if("undefined"!=typeof f.data){for(var g=0;g'+f.data[g].category+" - "+f.data[g].name+"";e.append(c)}a.hideLoader()});return this},getAlbums:function(b){a.showLoader();var c=this,e="";"undefined"===typeof b&&(b="me");$(c.fCnt).empty().append('");FB.api("/"+b+"/albums",function(b){if("undefined"!==typeof b.data&&0'+b.data[g].name+"";$(c.fCnt).append(e);c._process()}else $(c.fCnt).empty().append('");a.hideLoader()});return this},_login:function(){this.getAll();$(".pico-window-facebookopen > footer, .pico-window-facebooksave > footer").show();$(this.fCnt).empty().append('");$(".pico-fb-loggedout").hide();$(".pico-fb-loggedin").show();return this},_logout:function(){this.token=null;this.pages=[];this.albums=[];$(".pico-window-facebookopen > footer, .pico-window-facebooksave > footer").hide();$(this.fCnt).empty().append('");$(".pico-fb-loggedout").show();$(".pico-fb-loggedin").hide();return this},_process:function(){var b="",c=(this.page-1)*this.results,e=this.results*this.page;if(0< this.photos.length)for(var f=0;f=c&&f";a.paginate(Math.ceil(this.photos.length/this.results),this.page,".pico-fb-pager");$(".pico-fb-list ul.photolist").empty().append(b);a.hideLoader()},getPhotos:function(b){a.showLoader();"prev"===b?this.page--:"next"===b?this.page++:this.page="undefined"===typeof b?1:b;this._getPhotos(this.album);return this},_photoCallback:function(a, c){var e="";c||(e='
                          • ');return e}};var c=this.connectors.facebook;picozu.WINDOWS.push({name:l("%facebook.import"),handle:"facebookopen",center:!0,width:545,template:'

                            • '+ l("%main.noimages")+'
                              ',onShow:function(){c.initialize()},onCreate:function(){var b=this,d=this.getElementId();this.addFooter(picozu.CONNECTOR_OPEN_WINDOW_FOOTER);$(d).on("click",".reload",function(){c.getAll();return!1}).on("change",".albums",function(){var a=$(this).val();""!=a&&c.setAlbum(a).getPhotos()}).on("change",".saveas",function(){c.getAlbums($(this).val())}).on("click",".logout", function(){c.deauthenticate();b.hide();return!1}).on("click",".connect",function(){c.authenticate();return!1}).on("click",".photolist ul li a",function(){var c=$(this).attr("href");a.parseImageFile(c,!0);b.hide();return!1}).on("click",".pagination a",function(){$(this).parent("li").hasClass("next")?c.getPhotos("next"):$(this).parent("li").hasClass("prev")?c.getPhotos("prev"):c.getPhotos(parseInt($(this).text()));return!1})}});picozu.WINDOWS.push({name:l("%facebook.export"),handle:"facebooksave",center:!0, width:545,template:'
                              ',onShow:function(){c.initialize()},onCreate:function(){var b=this,d=this.getElementId();this.addFooter(picozu.CONNECTOR_SAVE_WINDOW_FOOTER); $(d).on("click",".save",function(){a.exportData(picozu.FILE_FORMAT_PNG,function(d,f){a.doRequest(picozu.API_CONVERT,"contents="+d+"&format="+f,function(d){c.upload(picozu.API_ENTRY_POINT+"v/"+d.dir+d.code+"."+d.format,b.getStrValue(".description"),b.getStrValue(".albums"),b.getStrValue(".saveas"));$(".description").val("");a.hideLoader()},null,"json");b.hide()});return!1}).on("change",".saveas",function(){c.getAlbums($(this).val())}).on("click",".connect",function(){c.authenticate();return!1}).on("click", ".logout",function(){c.deauthenticate();b.hide();return!1})}})}};String.toLocale({"en-US":{"%facebook.errorupload":"Error uploading your image to Facebook.","%facebook.doneupload":"Image uploaded successfully to Facebook.","%facebook.signout":"Successfully signed out from Facebook.","%Facebook":"Facebook","%facebook.import":"Import from Facebook","%facebook.export":"Export to Facebook"}}); picozu.extensions.plugins.flickr={parameters:{title:"Flickr",handle:"flickr",version:"1.2",email:"office@picozu.com",url:"www.picozu.com",requires:["internet"],description:"Flickr integration plugin. Import photos via Flickr search."},onDisable:function(){this.removeImporter("flickr");this.removeWindow("flickr")},onEnable:function(){this.addImporter(l("%Flickr"),"flickr");var a=this;this.connectors.flickr={key:"a7e9b881a3ba68ab185372a9faeb128a",url:"https://api.flickr.com/services/rest/?format=json&method=", results:15,page:1,client:null,tags:"",user:"",setFilter:function(a,b){this.user=a;this.tags=b;return this},initialize:function(){},getAll:function(c){a.showLoader();"prev"===c?this.page--:"next"===c?this.page++:this.page="undefined"===typeof c?1:c;var b=this;c=b.url;if(""!=this.user)c+="flickr.photos.search&api_key="+this.key+"&user_id="+this.user;else{var d=new Date;d.setDate(d.getDate()-1);d=Math.round(d/1E3);c+="flickr.photos.search&api_key="+b.key+"&min_upload_date="+d}""!=this.tags&&(c+="&tags="+ encodeURIComponent(this.tags));c=c+"&license=4,2,3,6,1,5,7"+("&per_page="+b.results+"&page="+b.page+"&privacy_filter=1&safe_search=1&jsoncallback=?");var e="";$.getJSON(c,function(c){$(".pico-flickr-list ul.photolist").empty();0'+b.title+''}): e+='
                            • '+l("%main.noimages.generic")+"
                            • ";a.paginate(c.photos.pages,b.page,".pico-flickr-pager");$(".pico-flickr-list ul.photolist").append(e);a.hideLoader()})}};picozu.WINDOWS.push({name:l("%flickr.title"),handle:"flickr",center:!0,width:545,template:"

                              • '+l("%main.noimages.generic")+'
                                ',onShow:function(){a.connectors.flickr.getAll()},onCreate:function(){var c=this,b=this.getElementId();$(b).on("click",".photolist ul li a",function(){var b=$(this).attr("href");a.parseImageFile(b);c.hide();return!1}).on("click",".pagination a",function(){$(this).parent("li").hasClass("next")? a.connectors.flickr.getAll("next"):$(this).parent("li").hasClass("prev")?a.connectors.flickr.getAll("prev"):a.connectors.flickr.getAll(parseInt($(this).text()));return!1}).on("keyup.picozu",".user, .tag",function(b){13===b.keyCode&&(a.connectors.flickr.setFilter(c.getStrValue(".user"),c.getStrValue(".tag")).getAll(),$(this).blur());return!1})}})}};String.toLocale({"en-US":{"%Flickr":"Flickr","%flickr.title":"Import from Flickr","%flickr.nophotos":"Sorry, no photos match that search. Please try again."}}); picozu.extensions.plugins.fractals={parameters:{title:"Fractals",handle:"fractals",version:"1.1",email:"office@picozu.com",url:"www.picozu.com",requires:["workers"],description:"Fractal generation plugin, providing several fractal types: Mandelbrot, Multibrot, Julia, Burning Ship, Douady`s Rabbit, Julia variations and many more."},onDisable:function(){this.removeDockbarPanel("fractals")},onEnable:function(){var a=this;this.insertStyle("fractals",!0);this.generateFractal=function(a){if(!0===this.isLayerEditable()){if(null=== a||"undefined"===typeof a)return this.error(l("%main.select.fractal")),!1;!1===this.hasSelection()&&(this.coords.select.width=this.getSelectedLayer().getWidth(),this.coords.select.height=this.getSelectedLayer().getHeight());var b=this.getSelection();this.spawnThread(picozu.WORKER_TYPE_FRACTAL,a,{params:this.parameters,imageData:this.getSelectedLayer().getImageData(b.left,b.top,b.width,b.height)});return this}return!1};this.getMainDockbar().addPanel({name:l("%fractals.title"),handle:"fractals",template:"", onCreate:function(){this.addElement({type:picozu.CONTROL_SELECT,handle:"pico-fractal-type",data:picozu.DEFAULT_FRACTALS,callback:function(c){"none"!==c&&a.generateFractal(c)}})}})}};String.toLocale({"en-US":{"%fractals.title":"Fractals","%select-fractal":"-- select a fractal --"}}); picozu.DEFAULT_FRACTALS=[{name:l("%select-fractal"),handle:"none"},{name:"Mandelbrot",handle:"mandelbrot"},{name:"Multibrot 1",handle:"multibrot1"},{name:"Multibrot 2",handle:"multibrot2"},{name:"Multibrot 3",handle:"multibrot3"},{name:"Dendrite",handle:"dendrite"},{name:"Barnsley`s Tree",handle:"barnsleytree"},{name:"Burning Ship",handle:"burningship"},{name:"Douady Rabbit",handle:"douadyrabbit"},{name:"Julia Cosine",handle:"juliacosine"},{name:"Julia Cosine 1",handle:"juliacosine1"},{name:"Julia Cosine 2", handle:"juliacosine2"},{name:"Julia Cube",handle:"juliacube"},{name:"Julia Set 1",handle:"juliaset1"},{name:"Julia Set 2",handle:"juliaset2"},{name:"Julia Set 3",handle:"juliaset3"},{name:"Julia Set 4",handle:"juliaset4"},{name:"Julia Set 5",handle:"juliaset5"},{name:"Julia Set 6",handle:"juliaset6"},{name:"Julia Sine",handle:"juliasine"},{name:"Julia Sine 1",handle:"juliasine1"},{name:"SanMarco",handle:"sanmarco"},{name:"Siegel Disk",handle:"siegeldisk"},{name:"Tricorn",handle:"tricorn"}]; picozu.extensions.plugins.histograms={parameters:{title:"Histograms",handle:"histograms",version:"1.0",email:"office@picozu.com",url:"www.picozu.com",requires:["workers"],description:"This educational plugin enables Picozu to generate histograms."},onDisable:function(){this.removeDockbarPanel("histogram")},onEnable:function(){var a=this;this.insertStyle("histograms",!0);this.drawHistogram=function(a){this.dispatchAction(picozu.ACTION_CHANGE,a);return this};this.dockbars[0].addPanel({name:l("%histogram.title"), handle:"histogram",template:'
                                ', onCreate:function(){$(".pico-dockbar").on("change",".pico-histogram-select",function(){a._refreshHistograms($(this).val())});$(".pico-histogram-select").trigger("change")}});this.refreshHistogram=function(a){if(null!==a){for(var b=document.getElementById("pico-histogram"),d=b.getContext("2d"),e={red:["#000","#f00"],green:["#000","#0f0"],blue:["#000","#00f"],hue:"#f00 #ff0 #0f0 #0ff #00f #f0f #f00".split(" "),val:["#000","#fff"],kelvin:["#fff","#000"],cyan:["#000","#0ff"],yellow:["#000","#ff0"],magenta:["#000", "#f0f"]},f=d.createLinearGradient(0,0,b.width,0),g=e.hue,h=0,j=g.length;h=s;s++)s in g&&(n=Math.round(g[s]/m*b.height),k=Math.round(s/255*b.width),d.lineTo(k,b.height-n));d.lineTo(k,b.height);d.fill();d.stroke();d.closePath()}d.globalCompositeOperation="source-over"}}},onAction:function(a,c){a==picozu.ACTION_CHANGE&&this.refreshHistogram(c)}};String.toLocale({"en-US":{"%histogram.title":"Histogram"}}); picozu.extensions.plugins.iconfinder={parameters:{title:"Iconfinder",handle:"iconfinder",version:"1.0",email:"office@picozu.com",url:"www.picozu.com",requires:["internet"],description:"Import images from searching them in IconFinder."},onDisable:function(){this.removeImporter("iconfinder");this.removeWindow("iconfinder")},onEnable:function(){this.addImporter(l("%Iconfinder"),"iconfinder");var a=this;this.connectors.iconfinder={url:"http://www.iconfinder.com/json/search/?min=16&max=256&api_key=",results:15, apiKey:"30774ed6e6764d508193784b8c0227cf",page:1,tag:"social",getAll:function(c){a.showLoader();"prev"===c?this.page--:"next"===c?this.page++:this.page="undefined"===typeof c?1:c;var b="",d=this;c=this.url+this.apiKey+"&q="+encodeURIComponent(this.tag)+"&c=15&p="+this.page;$.getJSON(c,"callback=?",function(c){$(".pico-iconfinder-list ul.photolist").empty();var f=c.searchresults?c.searchresults.icons.length:0;if(0";else b+='
                              • '+l("%main.noimages.generic")+"
                              • ";a.paginate(Math.ceil(c.searchresults.totalResults/d.results),d.page,".pico-iconfinder-pager");$(".pico-iconfinder-list ul.photolist").append(b);a.hideLoader()})},setFilter:function(a){""!=a&&(this.tag=a);return this},_photoCallback:function(a,b){var d="";b||(d="
                              • ");return d}};picozu.WINDOWS.push({name:l("%iconfinder.title"),handle:"iconfinder",center:!0,width:545,template:"

                                • '+l("%main.noimages.generic")+'
                                  ',onShow:function(){a.connectors.iconfinder.getAll()}, onCreate:function(){var c=this,b=this.getElementId();this.addFooter(picozu.BROWSER_WINDOW_FOOTER);$(b).on("click",".photolist ul li a",function(){var b=$(this).attr("href");a.parseImageFile(b);c.hide();return!1}).on("click",".reload",function(){a.connectors.iconfinder.setFilter(c.getStrValue(".tag")).getAll();return!1}).on("click",".pagination a",function(){$(this).parent("li").hasClass("next")?a.connectors.iconfinder.getAll("next"):$(this).parent("li").hasClass("prev")?a.connectors.iconfinder.getAll("prev"): a.connectors.iconfinder.getAll(parseInt($(this).text()));return!1}).on("keyup.picozu",".tag",function(b){13===b.keyCode&&(a.connectors.iconfinder.setFilter(c.getStrValue(".tag")).getAll(),$(this).blur());return!1})}})}};String.toLocale({"en-US":{"%Iconfinder":"Iconfinder","%iconfinder.title":"Import from Iconfinder"}}); picozu.extensions.plugins.palettomatic={parameters:{title:"Palett-o-matic",handle:"palettomatic",version:"1.0",depends:["swatches"],email:"office@picozu.com",url:"www.picozu.com",description:"Plugin that helps you create different types of color palettes based on your images."},onDisable:function(){this.removeTool("palettomatic");this.removeWindow("palettomatic");this.helpers.palettomatic=null},onEnable:function(){this.addTool(l("%Palett-o-matic"),"palettomatic");var a=this;if(!this.pluginIsEnabled("swatches"))return this.log(l("%plugin.depends"), l("%ERR")),!1;this.helpers.palettomatic={done:!1,blockLayer:null,imageLayer:null,newTab:null,leftSpacing:10,topSpacing:10,blocks:6,blockHeight:200,background:[255,255,255],blockWidth:200,fontSize:19,coords:null,prepHorizontal:function(){this.blockLayer=new picozu.objects.layer({parent:this.newTab,width:this.coords.width,height:this.blockHeight,left:this.leftSpacing,top:2*this.topSpacing+this.coords.height,name:"Color blocks"})},prepVertical:function(){this.blockLayer=new picozu.objects.layer({parent:this.newTab, width:this.blockWidth,height:this.coords.height,left:2*this.leftSpacing+this.coords.width,top:this.topSpacing,name:"Color blocks"})},prepare:function(){a.showLoader();var c=a.getSelectedTab();c._refreshPreview();this.swatches=a.heap.swatches;this.coords=c.getCoords();image=c.getPreviewLayer().getCanvas();this.coords.width>this.coords.height?(this.blockHeight=20*this.coords.height/100,this.newWidth=this.coords.width+2*this.leftSpacing,this.newHeight=this.coords.height+3*this.topSpacing+this.blockHeight): (this.blockWidth=20*this.coords.width/100,this.newWidth=this.coords.width+3*this.leftSpacing+this.blockWidth,this.newHeight=this.coords.height+2*this.topSpacing);this.newTab=a.newTab({width:this.newWidth,height:this.newHeight,hasBackground:!0,name:"palett-o-matic",backgroundColor:[255,255,255,1]}).activate();this.imageLayer=(new picozu.objects.layer({parent:this.newTab,width:this.coords.width,height:this.coords.height,left:this.leftSpacing,top:this.topSpacing,name:"Main image"})).drawImage(image, this.coords.width,this.coords.height);this.coords.width>this.coords.height?this.prepHorizontal():this.prepVertical();a.addDefaultWatermark().hideLoader()},refreshSwatches:function(){a.showLoader();a.saveUndo();var c=[255,255,255];this.blockLayer._clear();this.newTab.getBackgroundLayer()._fill(this.background);if(this.coords.width>this.coords.height){this.blockWidth=(this.coords.width-(this.blocks-1)*this.leftSpacing)/this.blocks;this.fontSize=Math.round(this.blockWidth/10)+4;for(var b=0;b
                                  ',onShow:function(){!1===a.helpers.palettomatic.done&&"undefined"===typeof a.getSelectedTab().heap.demotivator&&a.helpers.palettomatic.prepare()},onCreate:function(){var c=this.getElementId();this.addElement({type:picozu.CONTROL_COLORSELECT,legend:l("%Background color"),handle:"ptm-background-color",value:[255,255,255],property:"ptmColor", callback:function(b){a.helpers.palettomatic.background=b}}).addElement({type:picozu.CONTROL_CHECKBOX,legend:l("%Show color codes"),handle:"ptm-show-codes",property:"ptmCodes",checked:!1,value:!0,callback:function(b){a.helpers.palettomatic.codes=b}}).addFooter(picozu.BROWSER_WINDOW_FOOTER);for(var b="",d="",e=2;21>e;e++)d=6==e?"selected ":d="",b+="";$(c+" .count").append(b);$(c).on("click",".reload",function(){a.helpers.palettomatic.refreshSwatches()}).on("change", ".count",function(){a.helpers.palettomatic.blocks=parseInt($(this).val())})}})}};String.toLocale({"en-US":{"%Palett-o-matic":"Palett-o-matic","%Number of colors":"Number of colors","%Background color":"Background color","%Show color codes":"Show color codes"}}); picozu.extensions.plugins.tagcloud={parameters:{title:"Tag Cloud",handle:"tagcloud",version:"1.0",email:"office@picozu.com",url:"www.picozu.com",description:"Plugin for creating tag clouds."},onDisable:function(){this.removeTool("tagcloud");this.removeWindow("tagcloud");this.helpers.tagcloud=null},onEnable:function(){this.addTool(l("%Tag Cloud"),"tagcloud");var a=this;this.insertScript("prerequisites","tagcloud");this.insertStyle("tagcloud",!0);var c=function(a){return function(){return a[Math.floor(Math.random()* a.length)]}};this.helpers.tagcloud={textLayer:null,newTab:null,shape:"circle",weight:8,url:"",fontFamily:"Impact",text:"",theme:0,themes:[{name:l("%Default"),color:"random-dark"},{name:l("%Cold as Ice"),color:c("#141614 #a5bcae #4a6176 #21203d #72737b #3b3841".split(" "))},{name:l("%Bubblegum Candy"),color:c("#32a9db #de57a4 #d9cc48 #9291ea #cd9b95 #a7d2e0 #cfb22a #3a4c2b".split(" "))},{name:l("%Autumn Harvest"),color:c("#663211 #945b1d #ea773e #c83c08 #6a5961 #ce9068 #30170b".split(" "))},{name:l("%Forest Fantasy"), color:c("#46572b #afae8c #6b694f #0a1415 #445a44 #35704f #2c6807 #64a526".split(" "))},{name:l("%Plums"),color:c(["#865b97","#cea3d0","#c27cbf","#581477","#980470"])},{name:l("%Noir"),color:c("#000000 #111111 #222222 #333333 #444444 #555555 #666666 #777777 #888888 #999999 #aaaaaa #bbbbbb".split(" "))},{name:l("%Picozu"),color:c("#ed1978 #ed5e9d #6c6c6c #f47cba #d2136a #c30c5f #ec1474".split(" "))},{name:l("%Party Tones"),color:c("#66d9ef #a6e22d #fd9720 #a6e22a #a581ff #f92772".split(" "))},{name:l("%Folklore"), color:c(["#ff0000","#ffff00","#0000ff"])},{name:l("%Jingle All The Way"),color:c("#670504 #e01c04 #fed883 #914804 #4c5004 #79a40e".split(" "))},{name:l("%Raspberry Tints"),color:c(["#5eaa9f","#8dc7b7","#ebe6ce","#e8b165","#b81f56"])},{name:l("%Roses for the Sweet"),color:c(["#e1bad9","#c52774","#d672b0","#b2dfda","#52b3ba"])},{name:l("%Artichoke Splash"),color:c(["#cdc89a","#b482aa","#825e82","#6b4267","#6b7870"])}],prepare:function(){a.showLoader();this.newTab=a.newTab({width:800,height:600,name:"tagcloud"}).activate(); this.newTab.heap.tagcloud=!0;this.textLayer=new picozu.objects.layer({parent:this.newTab,width:800,height:600,name:"Tag Cloud Text"});a.addDefaultWatermark().hideLoader();$(this.textLayer.getElementId()).on("wordcloudstop",function(){a._refreshAll()});this.apply()},getTheme:function(){return this.themes[this.theme].color},parseText:function(a){var c=this;WordFreq({workerUrl:picozu.DEFAULT_PLUGINS_PATH+"tagcloud/wordfreq.worker.js"}).process(a,function(a){WordCloud(c.textLayer.getCanvas(),{list:a, fontFamily:c.fontFamily,color:c.getTheme(),weightFactor:c.weight,backgroundColor:"rgba(0, 0, 0, 0)",gridSize:Math.round(16*c.textLayer.getWidth()/1024),minRotation:-Math.PI/2,maxRotation:Math.PI/2,shuffle:!0,rotateRatio:0.1,shape:c.shape,ellipticity:0.65})})},parseURL:function(){},apply:function(){this.text=$(".pico-window-tagcloud .tag-text").val();this.url=$(".pico-window-tagcloud .tag-url").val();this.fontFamily=$(".pico-window-tagcloud .tag-font").val();this.shape=$(".pico-window-tagcloud .tag-shape").val(); this.weight=$(".pico-window-tagcloud .tag-weight").val();this.theme=$(".pico-window-tagcloud .tag-theme").val();""!=this.text?this.parseText(this.text):""!=this.url&&this.parseURL()}};picozu.WINDOWS.push({name:l("%tagcloud.title"),handle:"tagcloud",center:!0,width:500,template:"
                                  or




                                  ',onShow:function(){"undefined"===typeof a.getSelectedTab().heap.tagcloud&&a.helpers.tagcloud.prepare()},onCreate:function(){var b="",c="",e=this.getElementId();this.addFooter(picozu.BROWSER_WINDOW_FOOTER);for(var f=1;30>=f;f++)c=a.helpers.tagcloud.weight==f?"selected ":"",b+="";$(e+" .tag-weight").append(b);c=b="";for(f=30;71>f;f++)c=a.helpers.tagcloud.fontSize==f?"selected ": "",b+="";$(e+" .tag-textsize").append(b);c=b="";for(f=0;f'+picozu.DEFAULT_FONTS[f].name+"";$(e+" .tag-font").append(b);c=b="";for(f=0;f'+a.helpers.tagcloud.themes[f].name+ "";$(e+" .tag-theme").append(b);$(e).on("change",".tag-theme, .tag-shape, .tag-weight",function(){a.helpers.tagcloud.apply()}).on("change",".tag-font",function(){var b=$(e+" .tag-font").val();WebFont.load({google:{families:[b]},active:function(){a.helpers.tagcloud.apply()},inactive:function(){}})}).on("click",".reload",function(){a.helpers.tagcloud.apply()})}})}}; String.toLocale({"en-US":{"%Tag Cloud":"Tag Cloud","%tagcloud.title":"Tag Cloud Generator","%tagcloud.text":"Picozu the HTML5 image editor Sharing Picozu Creativity Join Draw Edit Share Picozu the HTML5 image editor Sharing Creativity Picozu the HTML5 image editor Sharing Creativity Join Draw Edit Share Picozu the HTML5 image editor Picozu Sharing Creativity Picozu Join Draw Edit Share","%tagcloud.shape":"Shape","%tagcloud.weightFactor":"Weight Factor","%tagcloud.rss":"RSS feed URL","%tagcloud.theme":"Color Theme", "%Default":"Default","%Cold as Ice":"Cold as Ice","%Noir":"Noir","%Autumn Harvest":"Autumn Harvest","%Bubblegum Candy":"Bubblegum Candy","%Forest Fantasy":"Forest Fantasy","%Plums":"Plums","%Party Tones":"Party Tones"}}); picozu.extensions.plugins.picasa={parameters:{title:"Picasa",handle:"picasa",version:"1.0",email:"office@picozu.com",url:"www.picozu.com",requires:["internet"],description:"Import images by searching them in Picasa."},onDisable:function(){this.removeImporter("picasa");this.removeWindow("picasa")},onEnable:function(){this.addImporter(l("%Picasa"),"picasa");var a=this;this.connectors.picasa={url:"http://picasaweb.google.com/data/feed/api/",albumsUrl:"http://picasaweb.google.com/data/feed/api/user/", results:15,page:1,user:"",tags:"",getAll:function(c){a.showLoader();"prev"===c?this.page--:"next"===c?this.page++:this.page="undefined"===typeof c?1:c;var b="",d=this;$.getJSON(this.url+(""!==this.user?"user/"+this.user:"all")+"?kind=photo&max-results=1000&alt=json"+(""!=this.tags?"&q="+this.tags:"")+"&thumbsize=72u,800","callback=?",function(c){$(".pico-picasa-list ul.photolist").empty();var f=c.feed?c.feed.entry.length:0,g=(d.page-1)*d.results,h=d.results*d.page;if(0=g&&j";a.paginate(Math.ceil(f/d.results),d.page,".pico-picasa-pager");$(".pico-picasa-list ul.photolist").append(b);a.hideLoader()});return this},setFilter:function(a,b){this.user=a;this.tags=b;return this},_nl2br:function(a){return a.replace(/\n/g,"
                                  \n")},_photoCallback:function(a,b){var d="",e="",f="",f=this._nl2br(a.summary?a.summary.$t:"");b||(e+=f.replace(RegExp("'","g"),"'"),d='
                                • ');return d}};picozu.WINDOWS.push({name:l("%picasa.title"),handle:"picasa",center:!0,width:545,template:"

                                  • '+ l("%main.noimages.generic")+'

                                    ',onShow:function(){a.connectors.picasa.getAll()},onCreate:function(){var c=this,b=this.getElementId();$(b).on("click",".photolist ul li a",function(){var b=$(this).attr("href");a.parseImageFile(b);c.hide();return!1}).on("click",".pagination a",function(){$(this).parent("li").hasClass("next")?a.connectors.picasa.getAll("next"):$(this).parent("li").hasClass("prev")?a.connectors.picasa.getAll("prev"):a.connectors.picasa.getAll(parseInt($(this).text())); return!1}).on("keyup.picozu",".user, .tag",function(b){13===b.keyCode&&(a.connectors.picasa.setFilter(c.getStrValue(".user"),c.getStrValue(".tag")).getAll(),$(this).blur());return!1})}})}};String.toLocale({"en-US":{"%Picasa":"Picasa","%picasa.title":"Import from Picasa"}}); picozu.extensions.plugins.onedrive={parameters:{title:"Onedrive",handle:"onedrive",version:"1.4",email:"office@picozu.com",url:"www.picozu.com",requires:["internet"],description:"This plugin provides a basic integration with Microsoft Onedrive, allowing you to import your photos from Onedrive and export them back."},onDisable:function(){this.removeImporter("onedriveopen");this.removeExporter("onedrivesave");this.removeWindow(["onedriveopen","onedrivesave"])},onEnable:function(){var a=this;this.addImporter(l("%Onedrive"), "onedriveopen");this.addExporter(l("%Onedrive"),"onedrivesave");this.insertScript("//js.live.net/v5.0/wl.js","","onedrive");this.insertStyle("onedrive",!0);this.connectors.onedrive={appId:"00000000400D721E",redirectURI:"https://www.picozu.com/live_receiver.html",scope:["wl.signin","wl.basic","wl.photos","wl.skydrive_update"],page:1,results:15,inited:!1,album:"",token:null,photos:[],fCnt:".pico-window-onedriveopen .folders, .pico-window-onedrivesave .folders",albums:[],account:null,deauthenticate:function(){WL.logout(); a.notifier.trigger({title:l("%Info"),content:l("%onedrive.signout")})},authenticate:function(){var a=this;WL.login({scope:a.scope}).then(function(){a._login()},function(c){a.error(c.error.message)})},createUploadRequestBody:function(a,c){return'--A300x\r\nContent-Disposition: form-data; name="file"; filename="'+c+'"\r\nContent-Type: application/octet-stream\r\n\r\n'+a.replace("data:image/png;base64,","")+"\r\n--A300x--\r\n"},upload:function(b,c,e){$.ajax({type:"POST",contentType:"multipart/form-data; boundary=A300x", processData:!1,beforeSend:function(){},url:"https://apis.live.net/v5.0/"+b+"/files?access_token="+this.token,data:this.createUploadRequestBody(c,e),success:function(){a.notifier.trigger({title:l("%Info"),content:l("%onedrive.doneupload")});a.hideLoader()},error:function(){a.notifier.trigger({title:l("%Error"),error:!0,content:l("%onedrive.errorupload")});a.hideLoader()}})},getAll:function(){this.getAlbums();this.getPhotos()},_login:function(){this.getAll();$(".pico-window-onedriveopen > footer, .pico-window-onedrivesave > footer").show(); $(this.fCnt).empty().append('");$(".pico-onedrive-loggedout").hide();$(".pico-onedrive-loggedin").show()},_logout:function(){this.inited=!1;this.token=this.account=null;$(".pico-window-onedriveopen > footer, .pico-window-onedrivesave > footer").hide();$(this.fCnt).empty().append('");$(".pico-onedrive-loggedout").show();$(".pico-onedrive-loggedin").hide()},init:function(){var a=this;!1=== this.inited?(WL.Event.subscribe("auth.login",function(c){a.token=c.session.access_token}),WL.Event.subscribe("auth.logout",function(){a._logout()}),WL.init({client_id:a.appId,redirect_uri:a.redirectURI,response_type:"token",secure_cookie:!0}),a.inited=!0):a.authenticate()},getPhotos:function(a){"prev"===a?this.page--:"next"===a?this.page++:this.page="undefined"===typeof a?1:a;this.getPhotosFrom(this.album)},getPhotosFrom:function(b){a.showLoader();var c=this;""!=b&&(this.photos=[],WL.api({path:"/"+ b+"/photos",method:"GET"}).then(function(a){for(var b=0;b-- '+l("%select folder")+" --"));WL.api({path:b,method:"GET"}).then(function(b){if(0'+b.data[f].name+""),c.getAlbums("/"+b.data[f].id+"/files");a.hideLoader()},function(a){c.error(a.error.message)});return this},error:function(b){this._logout();a.hideLoader();a.notifier.trigger({title:l("%Error"),error:!0,content:b})},_process:function(){var b="",c=(this.page-1)*this.results,e=this.results*this.page;if(0=c&&f";a.paginate(Math.ceil(this.photos.length/this.results),this.page,".pico-onedrive-pager");$(".pico-onedrive-list ul.photolist").empty().append(b);a.hideLoader()},_photoCallback:function(a,c){var e="";c||(e='
                                  • ');return e}};var c=this.connectors.onedrive;picozu.WINDOWS.push({name:l("%onedrive.import"),handle:"onedriveopen",center:!0, width:545,onShow:function(){c.init()},onCreate:function(){var b=this,d=this.getElementId();this.addElement({type:picozu.CONTROL_HTML,template:'
                                    '}).addElement({type:picozu.CONTROL_SELECT,legend:l("%Folder"),handle:"pico-sOfolders",legendClass:"legend",cssClass:"folders",data:[]},".pico-onedrive-loggedin").addElement({type:picozu.CONTROL_HTML,template:'
                                    • '+ l("%main.noimages")+'
                                      '},".pico-onedrive-loggedin").addFooter(picozu.CONNECTOR_OPEN_WINDOW_FOOTER);$(d).on("click",".logout",function(){c.deauthenticate();b.hide();return!1}).on("change",".folders",function(){c.getPhotosFrom($(this).val())}).on("click",".reload",function(){c.getAll();return!1}).on("click",".connect",function(){c.authenticate();return!1}).on("click","ul li a",function(){var c=$(this).attr("href");a.parseImageFile(c);b.hide(); return!1}).on("click",".pagination a",function(){$(this).parent("li").hasClass("next")?c.getPhotos("next"):$(this).parent("li").hasClass("prev")?c.getPhotos("prev"):c.getPhotos(parseInt($(this).text()));return!1})}});picozu.WINDOWS.push({name:l("%onedrive.export"),handle:"onedrivesave",center:!0,width:545,onShow:function(){c.init()},onCreate:function(){var b=this,d=this.getElementId();this.addElement({type:picozu.CONTROL_HTML,template:'
                                      '}).addElement({type:picozu.CONTROL_SELECT, legend:l("%Folder"),handle:"pico-sSfolders",cssClass:"folders",legendClass:"legend",data:[]},".pico-onedrive-loggedin").addElement({type:picozu.CONTROL_TEXTINPUT_FILE,legend:l("%main.filename"),extension:"png",placeholder:"enter a file name",handle:"pz-onedrive-filename",legendClass:"legend"},".pico-onedrive-loggedin").addFooter(picozu.CONNECTOR_SAVE_WINDOW_FOOTER);$(d).on("click",".save",function(){var d=b.getStrValue("#pz-onedrive-filename"),f=b.getStrValue(".folders");a.showLoader();""!==d?a.exportData(picozu.FILE_FORMAT_PNG, function(a){c.upload(f,a,d+".png")}):a.notifier.trigger({title:l("%Error"),error:!0,content:l("%onedrive.filename")});return!1}).on("click",".connect",function(){c.authenticate();return!1}).on("click",".logout",function(){c.deauthenticate();b.hide();return!1})}})}}; String.toLocale({"en-US":{"%Onedrive":"Onedrive","%onedrive.errorupload":"Error uploading your image to your Onedrive.","%onedrive.doneupload":"Image uploaded successfully to your Onedrive.","%onedrive.signout":"Successfully signed out from Onedrive.","%onedrive.import":"Import from Onedrive","%onedrive.export":"Export to Onedrive","%onedrive.filename":"You must specify a file name.","%onedrive.signout":"Successfully signed out from Onedrive."}}); picozu.extensions.plugins.swatches={parameters:{title:"Swatches",handle:"swatches",version:"1.8",email:"office@picozu.com",url:"www.picozu.com",requires:["workers"],description:"Organize your color swatches with ease by using this plugin."},onDisable:function(){this.removeImporter("swatches");this.removeWindow("swatches");this.removeDockbarPanel("swatches");$(".pico-swatch .swcolors").empty()},onEnable:function(){var a=this;this.addImporter(l("%Color Palette"),"swatches");this.dockbars[0].addPanel({name:l("%Swatches"), handle:"swatches",template:'', onCreate:function(){var c="",b=this.getElementId();$(".pico-swatches-tabs").tabs();for(var d=0;d';$(".pico-swatches-container-default").append(c);$(b).on("click",".pico-swatches-item, .pico-image-swatches-item, .pico-custom-swatches-item", function(){var b=$(this).data("color"),b=Color.hex2rgb("#"+b);a.setParam("foregroundColor",b);a.updateInfoPanel({rgb:b})});new picozu.objects.contextmenu({target:".pico-swatches-item",parent:a,submenus:picozu.SWATCHES_CONTEXTMENU_DEFS});new picozu.objects.contextmenu({target:".pico-image-swatches-item",parent:a,submenus:picozu.IMAGE_SWATCHES_CONTEXTMENU_DEFS});new picozu.objects.contextmenu({target:".pico-custom-swatches-item",parent:a,submenus:picozu.CUSTOM_SWATCHES_CONTEXTMENU_DEFS})}});picozu.WINDOWS.push({name:l("%Import swatches"), handle:"swatches",center:!0,width:300,onCreate:function(){var a=this,b=this.getElementId(),d=this.getWorkspace();this.addElement({type:picozu.CONTROL_IMAGE,image:picozu.DEFAULT_PATH+"images/windows/colorpalette/splash.png"}).addElement({type:picozu.CONTROL_SEPARATOR}).addElement({type:picozu.CONTROL_HTML,template:"

                                      "+l("%upload.swatches")+'

                                      '}).addFooter(' ');$(b).on("click",".upload",function(){$(b+" .pico-upload-swatches").trigger("click");return!1}).on("change",".pico-upload-swatches",function(b){a.hide();d.showLoader();b=b||window.event;b.preventDefault();b=b.originalEvent||b;d.loadFile(b.target.files[0]);return!1})}});a._refreshSwatches()}}; String.toLocale({"en-US":{"%Color Palette":"Color Palette","%Import swatches":"Import swatches","%Swatches":"Swatches","%export.ase":"Adobe Swatch Exchange (.ase)","%export.clr":"Adobe Flash color palette (.clr)","%export.act":"Adobe Fireworks color table (.act)","%export.gmp":"GIMP color palette (.txt)","%export.aco":"Adobe pre-CS2 color palette (.aco)","%upload.swatches":"Select a swatches file to import into Picozu. Currently you can select Adobe StackExchange (.ase) swatch files."}}); picozu.DEFAULT_SWATCHES=[{name:"Alice Blue",value:"F0F8FF"},{name:"Antique White",value:"FAEBD7"},{name:"Aquamarine",value:"7FFFD4"},{name:"Azure",value:"F0FFFF"},{name:"Beige",value:"F5F5DC"},{name:"Bisque",value:"FFE4C4"},{name:"Black",value:"000000"},{name:"Blanched Almond",value:"FFEBCD"},{name:"Blue",value:"0000FF"},{name:"Blue Violet",value:"8A2BE2"},{name:"Brown",value:"A52A2A"},{name:"Burly Wood",value:"DEB887"},{name:"Cadet Blue",value:"5F9EA0"},{name:"Chartreuse",value:"7FFF00"},{name:"Chocolate", value:"D2691E"},{name:"Coral",value:"FF7F50"},{name:"Cornflower Blue",value:"6495ED"},{name:"Cornsilk",value:"FFF8DC"},{name:"Crimson",value:"DC143C"},{name:"Cyan",value:"00FFFF"},{name:"Dark Blue",value:"00008B"},{name:"Dark Cyan",value:"008B8B"},{name:"Dark Golden Rod",value:"B8860B"},{name:"Dark Gray",value:"A9A9A9"},{name:"Dark Green",value:"006400"},{name:"Dark Khaki",value:"BDB76B"},{name:"Dark Magenta",value:"8B008B"},{name:"Dark Olive Green",value:"556B2F"},{name:"Dark Orange",value:"FF8C00"}, {name:"Dark Orchid",value:"9932CC"},{name:"Dark Red",value:"8B0000"},{name:"Dark Salmon",value:"E9967A"},{name:"Dark Sea Green",value:"8FBC8F"},{name:"Dark Slate Blue",value:"483D8B"},{name:"Dark Slate Gray",value:"2F4F4F"},{name:"Dark Turquoise",value:"00CED1"},{name:"Dark Violet",value:"9400D3"},{name:"Deep Pink",value:"FF1493"},{name:"Deep Sky Blue",value:"00BFFF"},{name:"Dim Gray",value:"696969"},{name:"Dodger Blue",value:"1E90FF"},{name:"Fire Brick",value:"B22222"},{name:"Floral White",value:"FFFAF0"}, {name:"Forest Green",value:"228B22"},{name:"Gainsboro",value:"DCDCDC"},{name:"Ghost White",value:"F8F8FF"},{name:"Gold",value:"FFD700"},{name:"Golden Rod",value:"DAA520"},{name:"Green",value:"00FF00"},{name:"Green Yellow",value:"ADFF2F"},{name:"Honey Dew",value:"F0FFF0"},{name:"Hot Pink",value:"FF69B4"},{name:"Indian Red",value:"CD5C5C"},{name:"Indigo",value:"4B0082"},{name:"Ivory",value:"FFFFF0"},{name:"Khaki",value:"F0E68C"},{name:"Lavender",value:"E6E6FA"},{name:"Lavender Blush",value:"FFF0F5"}, {name:"Lawn Green",value:"7CFC00"},{name:"Lemon Chiffon",value:"FFFACD"},{name:"Light Blue",value:"ADD8E6"},{name:"Light Coral",value:"F08080"},{name:"Light Cyan",value:"E0FFFF"},{name:"Light Golden Rod",value:"EEDD82"},{name:"Light Golden Rod Yellow",value:"FAFAD2"},{name:"Light Gray",value:"D3D3D3"},{name:"Light Green",value:"90EE90"},{name:"Light Pink",value:"FFB6C1"},{name:"Light Salmon",value:"FFA07A"},{name:"Light Sea Green",value:"20B2AA"},{name:"Light Sky Blue",value:"87CEFA"},{name:"Light Slate Blue", value:"8470FF"},{name:"Light Slate Gray",value:"778899"},{name:"Light Steel Blue",value:"B0C4DE"},{name:"Light Yellow",value:"FFFFE0"},{name:"Lime Green",value:"32CD32"},{name:"Linen",value:"FAF0E6"},{name:"Magenta",value:"FF00FF"},{name:"Maroon",value:"B03060"},{name:"Medium Aquamarine",value:"66CDAA"},{name:"Medium Blue",value:"0000CD"},{name:"Medium Orchid",value:"BA55D3"},{name:"Medium Purple",value:"9370DB"},{name:"Medium Sea Green",value:"3CB371"},{name:"Medium Slate Blue",value:"7B68EE"},{name:"Medium Spring Green", value:"00FA9A"},{name:"Medium Turquoise",value:"48D1CC"},{name:"Medium Violet Red",value:"C71585"},{name:"Midnight Blue",value:"191970"},{name:"Mint Cream",value:"F5FFFA"},{name:"Misty Rose",value:"FFE4E1"},{name:"Moccasin",value:"FFE4B5"},{name:"Navajo White",value:"FFDEAD"},{name:"Navy",value:"000080"},{name:"Navy Blue",value:"000080"},{name:"Old Lace",value:"FDF5E6"},{name:"Olive Drab",value:"6B8E23"},{name:"Orange",value:"FFA500"},{name:"Orange Red",value:"FF4500"},{name:"Orchid",value:"DA70D6"}, {name:"Pale Golden Rod",value:"EEE8AA"},{name:"Pale Green",value:"98FB98"},{name:"Pale Turquoise",value:"AFEEEE"},{name:"Pale Violet Red",value:"DB7093"},{name:"Papaya Whip",value:"FFEFD5"},{name:"Peach Puff",value:"FFDAB9"},{name:"Peru",value:"CD853F"},{name:"Picozu",value:"DB0268"},{name:"Pink",value:"FFC0CB"},{name:"Plum",value:"DDA0DD"},{name:"Powder Blue",value:"B0E0E6"},{name:"Purple",value:"A020F0"},{name:"Red",value:"FF0000"},{name:"Rosy Brown",value:"BC8F8F"},{name:"Royal Blue",value:"4169E1"}, {name:"Saddle Brown",value:"8B4513"},{name:"Salmon",value:"FA8072"},{name:"Sandy Brown",value:"F4A460"},{name:"Sea Green",value:"2E8B57"},{name:"Sea Shell",value:"FFF5EE"},{name:"SGI Beet",value:"8E388E"},{name:"SGI Bright Gray",value:"C5C1AA"},{name:"SGI Chartreuse",value:"71C671"},{name:"SGI Light Blue",value:"7D9EC0"},{name:"SGI Light Gray",value:"AAAAAA"},{name:"sgilightgrey",value:"AAAAAA"},{name:"SGI Olive Drab",value:"8E8E38"},{name:"SGI Salmon",value:"C67171"},{name:"SGI Slate Blue",value:"7171C6"}, {name:"SGI Teal",value:"388E8E"},{name:"SGI Very Dark Gray",value:"282828"},{name:"SGI Very Light Gray",value:"D6D6D6"},{name:"Sienna",value:"A0522D"},{name:"Sky Blue",value:"87CEEB"},{name:"Slate Blue",value:"6A5ACD"},{name:"Slate Grey",value:"708090"},{name:"Snow",value:"FFFAFA"},{name:"Spring Green",value:"00FF7F"},{name:"Steel Blue",value:"4682B4"},{name:"Tan",value:"D2B48C"},{name:"Thistle",value:"D8BFD8"},{name:"Tomato",value:"FF6347"},{name:"Turquoise",value:"40E0D0"},{name:"Violet",value:"EE82EE"}, {name:"Violet Red",value:"D02090"},{name:"Wheat",value:"F5DEB3"},{name:"White",value:"FFFFFF"},{name:"White Smoke",value:"F5F5F5"},{name:"Yellow",value:"FFFF00"},{name:"Yellow Green",value:"9ACD32"}]; picozu.extensions.plugins.charts={parameters:{title:"Charts",handle:"charts",version:"1.0",email:"office@picozu.com",url:"www.picozu.com",description:"Allows you to integrate various types of charts into your workspaces and adjust settings such as shapes and colors."},onDisable:function(){this.removeToolbarButton("charts");this.removeWindow("charts");this.helpers.charts=null},onEnable:function(){var a=this;this.insertScript("prerequisites","charts");this.insertStyle("charts",!0);this.addToolbarButton(l("%charts"), "charts");this.helpers.charts={layer:null,createLayer:function(){var c=a.getSelectedTab();this.layer=(new picozu.objects.layer({parent:c,width:c.getWidth(),height:c.getHeight(),left:0,top:0,name:"Chart"})).select();this.layer.setHeap("charts",!0)},prepare:function(){var c=a.getSelectedTab();!0===c.getSelectedLayer().getHeap().charts?this.layer=c.getSelectedLayer():this.createLayer()},getLayer:function(){return this.layer}};picozu.WINDOWS.push({name:l("%charts"),handle:"charts",top:100,left:300,width:370, onShow:function(){a.helpers.charts.prepare()},onDestroy:function(){a.doTool(null)},onCreate:function(){function c(c){for(var d="",e=b.getIntValue("#pz-chartsItems"),j=b.getIntValue("#pz-chartsPoints"),k=0;k';!0!==b.getBoolValue("#pz-chartsRandom")&&(d+='
                                      ');for(var m=0;m';d+="
                                      ";k");if(!0!==b.getBoolValue("#pz-chartsRandom"))$(elId).on("click",".pico-control-colorselect",function(){var b=this;a.openWindow("colorpicker",{handle:"colorpicker",name:l("%Color"),left:200,parent:a,top:150,width:320,template:'
                                      ',onCreate:function(){var a= this;a.heap.color=_color;this.addFooter(picozu.DEFAULT_WINDOW_FOOTER);$("#charts-dataset-"+k+"-picker").colorPicker({color:_color,onColorChange:function(b){a.heap.color=b}})},onApply:function(){var a=this.heap.color;$(b).children("span").css({"background-color":Color.color2Exp("rgb",a)});$(b).data("color",a.join(","));this.destroy()}})})}!0===c&&$(".pico-charts-datasets").empty();$(".pico-charts-datasets").append(d)}var b=this;this.getElementId();var d="";this.addElement({type:picozu.CONTROL_IMAGE, cssClass:"pz-chartsImage",image:picozu.DEFAULT_PLUGINS_PATH+"charts/Line.png"}).addElement({type:picozu.CONTROL_SEPARATOR}).addElement({type:picozu.CONTROL_SELECT,legend:l("%Type"),tips:l("%tips.charts.type"),handle:"pz-chartsType",data:picozu.CHART_TYPES}).addElement({type:picozu.CONTROL_HTML,template:'
                                      '}).addElement({type:picozu.CONTROL_CHECKBOX,legend:l("%charts.showLabels"), tips:l("%tips.charts.labels"),handle:"pz-chartsLabels",checked:!0},".column1").addElement({type:picozu.CONTROL_CHECKBOX,legend:l("%charts.showGrid"),tips:l("%tips.charts.grid"),handle:"pz-chartsGrid",checked:!0},".column1").addElement({type:picozu.CONTROL_CHECKBOX,legend:l("%charts.fill"),tips:l("%tips.charts.fill"),handle:"pz-chartsFill",checked:!0},".column1").addElement({type:picozu.CONTROL_CHECKBOX,legend:l("%charts.stroke"),tips:l("%tips.charts.stroke"),handle:"pz-chartsStroke",checked:!0},".column2").addElement({type:picozu.CONTROL_CHECKBOX, legend:l("%charts.dot"),tips:l("%tips.charts.dot"),handle:"pz-chartsDot",checked:!0},".column2").addElement({type:picozu.CONTROL_CHECKBOX,legend:l("%charts.random"),tips:l("%tips.charts.random"),handle:"pz-chartsRandom",callback:function(){c(!0)}},".column2").addElement({type:picozu.CONTROL_SELECT,legend:l("%charts.items"),tips:l("%tips.charts.items"),handle:"pz-chartsItems"},".column3").addElement({type:picozu.CONTROL_SELECT,legend:l("%charts.points"),tips:l("%tips.charts.points"),handle:"pz-chartsPoints"}, ".column4").addElement({type:picozu.CONTROL_SEPARATOR}).addElement({type:picozu.CONTROL_HTML,template:'
                                      '}).addFooter(' ');$(elId).on("click",".reset",function(){c(!0)});for(var e=1;11>e;e++)d+="";$(elId+" #pz-chartsItems").append(d);d="";for(e=1;11>e;e++)d+="";$(elId+" #pz-chartsPoints").append(d);$(elId).on("change","#pz-chartsType",function(){var a=$(this).val();$(elId+" .pz-chartsImage").attr("src",picozu.DEFAULT_PLUGINS_PATH+"charts/"+a+".png");"StackedBar"===a||"Bar"===a||"Line"===a||"Radar"===a?$("#pz-chartsPoints").val(3).attr("disabled",!1):$("#pz-chartsPoints").val(1).attr("disabled", "disabled");c(!0)}).on("change","#pz-chartsItems, #pz-chartsPoints",function(){c(!0)}).on("click",".refresh",function(){a.helpers.charts.prepare();var c=[],d=b.getStrValue("#pz-chartsType"),e={};if("StackedBar"===d||"Bar"===d||"Line"===d||"Radar"===d){var j={},k=[];$(".pico-charts-datasets input.legend").each(function(){var a=[],d=$(this),e=d.parent().children("input.value"),g=null;c.push($(this).val());$(e).each(function(){a.push(parseInt($(this).val()))});g=!0===b.getBoolValue("#pz-chartsRandom")? Color.randomRgb():$.map(d.parent().children(".pico-control-colorselect").data("color").split(","),function(a){return parseInt(a,10)});k.push({fillColor:Color.color2Exp("rgba",Color.rgb2rgba(g,0.4)),strokeColor:Color.color2Exp("rgba",Color.rgb2rgba(g,1)),pointColor:Color.color2Exp("rgba",Color.rgb2rgba(g,1)),pointStrokeColor:"#fff",data:a})});j={labels:c,datasets:k}}else j=[],$(".pico-charts-datasets input.legend").each(function(){var a=$(this);a.parent().children("input.value");var c=null;!0===b.getBoolValue("#pz-chartsRandom")? c=Color.random():(c=$.map(a.parent().children(".pico-control-colorselect").data("color").split(","),function(a){return parseInt(a,10)}),c="#"+Color.rgb2hex(c));j.push({color:c,value:parseInt(a.parent().children("input.value").val())})});e={scaleShowGridLines:b.getBoolValue("#pz-chartsGrid"),scaleShowLabels:b.getBoolValue("#pz-chartsLabels"),datasetFill:b.getBoolValue("#pz-chartsFill"),pointDot:b.getBoolValue("#pz-chartsDot"),datasetStroke:b.getBoolValue("#pz-chartsStroke"),segmentStrokeWidth:4};(new Chart(a.helpers.charts.getLayer().getContext()))[d](j, e);a._refreshAll()});c(!0)}})}}; String.toLocale({"en-US":{"%charts":"Charts","%Bar":"Bar","%Stacked Bar":"Stacked Bar","%Pie":"Pie","%Polar Area":"Polar Area","%Doughnut":"Doughnut","%Radar":"Radar","%tips.charts.type":"Type of the generated chart.","%charts.font":"Font","%tips.charts.font":"Font type used for the labels. Not available for all types of charts.","%charts.random":"Random colors","%tips.charts.random":"Enable dataset color selection or draw the datasets using random colors.","%charts.showLabels":"Show labels","%tips.charts.labels":"Toggle showing of labels. Not available for all types of charts.", "%charts.showGrid":"Show grid","%tips.charts.grid":"Toggle showing of grid lines across the chart. Not available for all types of charts.","%charts.adddataset":"Add dataset","%charts.fill":"Fill datasets","%tips.charts.fill":"Fill the dataset with the specified color. Not available for all types of charts.","%charts.stroke":"Stroke datasets","%tips.charts.stroke":"Stroke the dataset edges with the specified color. Not available for all types of charts.","%charts.dot":"Show dots","%tips.charts.dot":"Show a point for each dataset point. Not available for all types of charts.", "%charts.items":"Datasets","%tips.charts.items":"Number of datasets for the chart.","%charts.points":"Points per dataset","%tips.charts.points":"Number of points per each dataset."}});picozu.tools.charts=picozu.objects.tool.extend({__constructor:function(a,c,b){b.saveUndo();b.openWindow("charts")},__destructor:function(){}}); picozu.CHART_TYPES=[{name:l("%Line"),handle:"Line"},{name:l("%Bar"),handle:"Bar"},{name:l("%Stacked Bar"),handle:"StackedBar"},{name:l("%Radar"),handle:"Radar"},{name:l("%Polar Area"),handle:"PolarArea"},{name:l("%Pie"),handle:"Pie"},{name:l("%Doughnut"),handle:"Doughnut"}]; picozu.extensions.plugins.youtube={parameters:{title:"Youtube",handle:"youtube",version:"1.1",email:"office@picozu.com",url:"www.picozu.com",requires:["internet"],description:"Youtube integration plugin that allows you to browse Youtube content and play it while remaining in editor."},onDisable:function(){this.removeTool("youtubeplayer");this.removeWindow("youtubeplayer")},onEnable:function(){this.addTool(l("%youtubeplayer.title"),"youtubeplayer");this.insertScript("prerequisites","youtube");this.insertStyle("youtube", !0);picozu.WINDOWS.push({name:l("%youtubeplayer.title"),handle:"youtubeplayer",left:200,top:100,system:!0,width:660,template:'

                                      ',onCreate:function(){var a=this.getElementId();$(a).on("focus",".pz-youtubeSearch", function(){var a=$(this);a.select();a.mouseup(function(){a.unbind("mouseup");return!1})});$(a+" .pz-youtubeSearch").autocomplete({source:function(a,b){$.ajax({url:"https://gdata.youtube.com/feeds/videos?max-results=10&alt=json-in-script&orderby=relevance&sortorder=descending&format=5&fmt=18",dataType:"jsonp",data:{vq:a.term},success:function(a){b($.map(a.feed.entry,function(a){var b=a.link[0].href,b=b.replace("&feature=youtube_gdata","");return{label:a.title.$t,value:b}}))}})},minLength:4,select:function(c, b){var d=b.item.value,d=d.split("=").pop();$(a+" .pz-youtubeIframe").attr("src","https://www.youtube.com/embed/"+d+"?autoplay=1&loop=1&iv_load_policy=3&modestbranding=1&theme=light&autohide=1")}})}})},onAction:function(a,c){a==picozu.ACTION_OPEN_YOUTUBE_PLAYER&&(this.openWindow("youtubeplayer"),$(".pico-window-youtubeplayer .pz-youtubeIframe").attr("src","https://www.youtube.com/embed/"+c+"?autoplay=1&loop=1&iv_load_policy=3&modestbranding=1&theme=light&autohide=1"))}};String.toLocale({"en-US":{"%youtubeplayer.title":"Youtube Player"}}); picozu.extensions.plugins.twitter={parameters:{title:"Twitter",handle:"twitter",version:"1.2",email:"office@picozu.com",url:"www.picozu.com",requires:["internet"],description:"This plugin allows you to tweet and stay up to date with Twitter updates."},onDisable:function(){this.removeTool("twitter");this.removeWindow("twitter")},onEnable:function(){this.addTool(l("%twitter.title"),"twitter");var a=this;this.insertStyle("twitter",!0);this.connectors.twitter={is_auth:!1,relativeTime:function(a){var b= a.split(" ");a=b[1]+" "+b[2]+", "+b[5]+" "+b[3];var d=Date.parse(a),b=1d?"less than a minute ago":120>d?"about a minute ago":3600>d?parseInt(d/60).toString()+" minutes ago":7200>d?"about an hour ago":86400>d?"about "+parseInt(d/3600).toString()+" hours ago":172800>d?"1 day ago":parseInt(d/86400).toString()+" days ago"},signIn:function(){document.location.href=picozu.API_ENTRY_POINT+"api/social/twitter_login/"}, initialize:function(){var c=this;a.showLoader();a.doRequest(picozu.API_SOCIAL+"twitter_isauth/",null,function(b){a.hideLoader();a.isErrorRequest(b)?(c.logout(),a.notifier.trigger({title:l("%Error"),error:!0,content:b.error})):!0===b.auth?c.login():c.logout()},function(){a.hideLoader();c.logout()},"json")},isAuth:function(){return this.is_auth},setStatus:function(c,b){var d=this;!0===this.isAuth()?(a.showLoader(),!0===b?a.exportData(picozu.FILE_FORMAT_PNG,function(b){a.doRequest(picozu.API_SAVE,"contents="+ b+"&format=png&title=TwitterUpload&description=&visibility=6",function(b){a.doRequest(picozu.API_SOCIAL+"twitter_post_update/","status="+c+"&image="+b.code,function(b){a.hideLoader();a.isErrorRequest(b)?(self.logout(),a.notifier.trigger({title:l("%Error"),error:!0,content:b.error})):a.notifier.trigger({title:l("%Info"),content:l("%twitter.posted")})},function(){a.hideLoader();d.logout()},"json")},function(){},"json")}):a.doRequest(picozu.API_SOCIAL+"twitter_post_update/","status="+c,function(b){a.hideLoader(); a.isErrorRequest(b)?(self.logout(),a.notifier.trigger({title:l("%Error"),error:!0,content:b.error})):a.notifier.trigger({title:l("%Info"),content:l("%twitter.posted")})},function(){a.hideLoader();d.logout()},"json")):this.logout()},login:function(){this.is_auth=!0;this.getHomeTimeline();$(".pico-window-twitter .tweet-list").empty();$(".pico-window-twitter .tweet-box").attr("disabled",!1);$(".pico-window-twitter footer").show();$(".pico-twitter-loggedout").hide();$(".pico-twitter-loggedin").show()}, logout:function(){this.is_auth=!1;$(".pico-window-twitter header .name").html(l("%twitter.title")+" - "+l("%twitter.notauth"));$(".pico-window-twitter .tweet-list").empty();$(".pico-window-twitter .tweet-box").attr("disabled",!0);$(".pico-window-twitter footer").hide();$(".pico-twitter-loggedout").show();$(".pico-twitter-loggedin").hide()},getUserTimeline:function(c){var b=this;$(".pico-window-twitter .tweet-list").empty();!0===this.isAuth()?(a.showLoader(),a.doRequest(picozu.API_SOCIAL+"twitter_user_timeline/", "user="+c,function(d){if(a.isErrorRequest(d))b.logout(),a.notifier.trigger({title:l("%Error"),error:!0,content:d.error});else{var e="
                                        ";if(0<$(d).length){for(var f=0;f<$(d).length;f++)var g=$(d)[f].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g,function(a){return''+a+""}).replace(/\B@([_a-z0-9]+)/ig,function(a){return a.charAt(0)+''+a.substring(1)+""}),e=e+("
                                      • "+g+' - '+ b.relativeTime($(d)[f].created_at)+"
                                      • ");$(".pico-window-twitter .tweet-list").append(e+"
                                      ");$(".pico-window-twitter header .name").html(l("%twitter.title")+" - "+c+" "+l("%twitter.timeline"))}else $(".pico-window-twitter .tweet-list").append(l("%twitter.noresults"))}a.hideLoader()},function(){a.hideLoader()},"json")):this.logout()},getHomeTimeline:function(){var c=this;$(".pico-window-twitter .tweet-list").empty();!0===this.isAuth()?(a.showLoader(),a.doRequest(picozu.API_SOCIAL+"twitter_home_timeline/", null,function(b){if(a.isErrorRequest(b))a.notifier.trigger({title:l("%Error"),error:!0,content:b.error});else{var d="
                                        ";if(0<$(b).length){for(var e=0;e<$(b).length;e++)var f=$(b)[e].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g,function(a){return''+a+""}).replace(/\B@([_a-z0-9]+)/ig,function(a){return a.charAt(0)+''+a.substring(1)+""}),d=d+("
                                      • "+f+" "+l("%twitter.by")+ ' '+$(b)[e].user.name+' - '+c.relativeTime($(b)[e].created_at)+"
                                      • ");$(".pico-window-twitter .tweet-list").append(d+"
                                      ");$(".pico-window-twitter header .name").html(l("%twitter.title")+" - "+l("%twitter.yourtimeline"))}else $(".pico-window-twitter .tweet-list").append(l("%twitter.noresults"))}a.hideLoader()},function(){a.hideLoader()},"json"),$(".pico-window-twitter").on("click",".by",function(){var b= $(this).data("by");a.connectors.twitter.getUserTimeline(b)})):this.logout()}};picozu.WINDOWS.push({name:l("%twitter.title"),handle:"twitter",left:400,system:!0,top:100,width:393,template:'
                                      140
                                      ', onShow:function(){a.connectors.twitter.initialize()},onCreate:function(){var c=this.getElementId(),b=this,d=140;this.addFooter(' ');$(c).on("click",".tweet",function(){var d=b.getStrValue(".tweet-box"),f=$(c+" .twitter-media").is(":checked"); a.connectors.twitter.setStatus(d,f);b.setValue(".tweet-box","");return!1}).on("keyup",".tweet-box",function(){var a=$(this);a.val().length>d?a.val(a.val().substr(0,d)):$(c+" .num-chars").html(d-a.val().length)}).on("click",".connect",function(){a.connectors.twitter.signIn();return!1}).on("click",".twitter-media",function(){d=$(this).is(":checked")?117:140;$(c+" .tweet-box").trigger("keyup")}).on("click",".reload",function(){var c=b.getStrValue(".search");""!=c?(a.connectors.twitter.getUserTimeline(c), b.setValue(".search","")):a.connectors.twitter.getHomeTimeline();return!1});$(c+" .tweet-box").focusin(function(){$(this).height(88)}).focusout(function(){$(this).height(18)});setInterval(function(){a.connectors.twitter.getHomeTimeline()},3E5)}})}}; String.toLocale({"en-US":{"%twitter.search":"search user","%twitter.tweet":"Tweet","%twitter.title":"Twitter","%twitter.posted":"Successfully posted to Twitter.","%twitter.timeline":"Timeline","%twitter.by":"by","%twitter.yourtimeline":"Your Timeline","%twitter.refresh":"Refresh","%twitter.noresults":"There are no results for your query.","%twitter.notauth":"Not logged in"}}); picozu.extensions.plugins.gdrive={parameters:{title:"Google Drive",handle:"gdrive",version:"1.7",email:"office@picozu.com",url:"www.picozu.com",requires:["internet"],description:"This plugin provides a basic integration with Google Drive, allowing you to import your photos from Google Drive and export them back."},onDisable:function(){this.removeImporter("gdriveopen");this.removeExporter("gdrivesave");this.removeWindow(["gdriveopen","gdrivesave"])},onEnable:function(){var a=this;this.addImporter(l("%Google Drive"), "gdriveopen");this.addExporter(l("%Google Drive"),"gdrivesave");this.insertScript("https://apis.google.com/js/client.js","","gapi-jssdk");this.insertStyle("gdrive",!0);this.connectors.gdrive={clientId:"421704185582.apps.googleusercontent.com",scopes:"https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/drive.file",page:1,results:15,fCnt:".pico-window-gdriveopen .folders, .pico-window-gdrivesave .folders",album:"root",photos:[],token:null,getAll:function(){this.getFolders();this.getFiles()}, initialize:function(){var a=this;gapi.auth.authorize({client_id:a.clientId,scope:a.scopes,immediate:!0},function(c){c&&!c.error?a._login():a._logout()})},deauthenticate:function(){this._logout();$.ajax({type:"POST",url:"https://accounts.google.com/o/oauth2/revoke?token="+gapi.auth.getToken().access_token,success:function(){},error:function(){}});a.notifier.trigger({title:l("%Info"),content:l("%gdrive.signout")})},getFiles:function(){a.showLoader();var b=this,c="";gapi.client.load("drive","v2",function(){var e= [];gapi.client.drive.files.list({q:"'"+b.album+"' in parents and mimeType contains 'image'"}).execute(function(f){e=e.concat(f.items);f=(b.page-1)*b.results;var g=b.results*b.page;if("undefined"!==typeof e&&0=f&&h";$(".pico-gdrive-list ul.photolist").empty().append(c);a.hideLoader()})})},getFolders:function(){a.showLoader(); var b="",c=this;gapi.client.load("drive","v2",function(){var e=[];gapi.client.drive.files.list({q:"mimeType = 'application/vnd.google-apps.folder'"}).execute(function(f){e="undefined"!==typeof f.items?e.concat(f.items):[];$(c.fCnt).empty().append('");if(0'+e[f].title+"";$(c.fCnt).append(b)}a.hideLoader()})})},authenticate:function(){var a=this;gapi.auth.authorize({client_id:a.clientId, scope:a.scopes,immediate:!1},function(c){c&&!c.error?a._login():a._logout()})},upload:function(a,c,e){var f=this;gapi.client.load("drive","v2",function(){f._upload(a,c,e)})},_upload:function(b,c){""===c&&(c="Untitled");b=b.replace("data:image/png;base64,","");var e="\r\n---------314159265358979323846\r\nContent-Type: application/json\r\n\r\n"+JSON.stringify({title:c+".png",mimeType:"image/png"})+"\r\n---------314159265358979323846\r\nContent-Type: image/png\r\nContent-Transfer-Encoding: base64\r\n\r\n"+ b+"\r\n---------314159265358979323846--";gapi.client.request({path:"/upload/drive/v2/files",method:"POST",params:{uploadType:"multipart"},headers:{"Content-Type":'multipart/mixed; boundary="-------314159265358979323846"'},body:e}).execute(function(b){a.notifier.trigger({title:l("%Info"),content:l("%gdrive.doneupload")+" "+l("%Click")+' '+l("%here")+" "+l("%gdrive.account")});$("#pz-gdrivesave-editLink").val(b.alternateLink);$("#pz-gdrivesave-downloadLink").val(b.downloadUrl); $("#pz-gdrivesave-shareLink").val(b.webContentLink);$("#pz-gdrivesave-fileSize").val(b.fileSize+" "+l("%bytes"));$(".pz-gdriveInfo").fadeIn();a.hideLoader()})},setAlbum:function(a){this.album=a;return this},_login:function(){this.getAll();$(".pico-window-gdriveopen > footer, .pico-window-gdrivesave > footer").show();$(this.fCnt).empty().append('");$(".pico-gdrive-loggedout").hide();$(".pico-gdrive-loggedin").show()},_logout:function(){$(".pico-window-gdriveopen > footer, .pico-window-gdrivesave > footer").hide(); $(this.fCnt).empty().append('");$(".pico-gdrive-loggedout").show();$(".pico-gdrive-loggedin").hide()},_photoCallback:function(a,c){var e="";c||(e='
                                    • ');return e}};var c=this.connectors.gdrive;picozu.WINDOWS.push({name:l("%gdrive.import"),handle:"gdriveopen",center:!0,width:545,template:'

                                      • '+l("%main.noimages")+'
                                        ',onShow:function(){c.initialize()},onCreate:function(){var b=this,d=this.getElementId();this.addFooter(picozu.CONNECTOR_OPEN_WINDOW_FOOTER);$(d).on("click",".reload",function(){c.getAll(); return!1}).on("change",".folders",function(){var a=$(this).val();""!=a&&c.setAlbum(a).getFiles()}).on("click",".logout",function(){c.deauthenticate();b.hide();return!1}).on("click",".connect",function(){c.authenticate();return!1}).on("click",".photolist ul li a",function(){var c=$(this).attr("href");a.parseImageFile(c,!0,gapi.auth.getToken().access_token);b.hide();return!1}).on("click",".pagination a",function(){$(this).parent("li").hasClass("next")?c.getFiles("next"):$(this).parent("li").hasClass("prev")? c.getFiles("prev"):c.getFiles(parseInt($(this).text()));return!1})}});picozu.WINDOWS.push({name:l("%gdrive.export"),handle:"gdrivesave",center:!0,width:545,onShow:function(){c.initialize()},onCreate:function(){var b=this,d=this.getElementId();this.addElement({type:picozu.CONTROL_HTML,template:'
                                        '}).addElement({type:picozu.CONTROL_TEXTINPUT_FILE,legend:l("%main.filename"),placeholder:"enter a file name",extension:"png", handle:"pz-gdrivesave-filename",cssClass:"filename",legendClass:"legend"},".pico-gdrive-loggedin").addElement({type:picozu.CONTROL_HTML,template:'
                                        File information
                                        '},".pico-gdrive-loggedin").addElement({type:picozu.CONTROL_TEXTINPUT,legend:l("%gdrive.editlink"),handle:"pz-gdrivesave-editLink",value:"",readonly:!0,autoselect:!0,tips:l("%tips.gdrive.editlink"),legendClass:"legend"},".pz-gdriveInfo").addElement({type:picozu.CONTROL_TEXTINPUT, legend:l("%gdrive.downloadlink"),handle:"pz-gdrivesave-downloadLink",value:"",readonly:!0,autoselect:!0,tips:l("%tips.gdrive.downloadlink"),legendClass:"legend"},".pz-gdriveInfo").addElement({type:picozu.CONTROL_TEXTINPUT,legend:l("%gdrive.sharelink"),handle:"pz-gdrivesave-shareLink",value:"",readonly:!0,autoselect:!0,tips:l("%tips.gdrive.sharelink"),legendClass:"legend"},".pz-gdriveInfo").addElement({type:picozu.CONTROL_TEXTINPUT,legend:l("%gdrive.filesize"),handle:"pz-gdrivesave-fileSize",value:"", readonly:!0,legendClass:"legend"},".pz-gdriveInfo").addFooter(picozu.CONNECTOR_SAVE_WINDOW_FOOTER);$(d).on("click",".save",function(){$(".pz-gdriveInfo").fadeOut();a.getSelectedTab()._refreshPreview();a.exportData(picozu.FILE_FORMAT_PNG,function(d){!0===a.isOnline()?(a.showLoader(),c.upload(d,b.getStrValue(".filename")),b.setValue(".filename","")):(a.hideLoader(),a.notify(l("%main.offline"),!0))},$("form.expSettings").serializeArray());return!1}).on("click",".connect",function(){c.authenticate(); return!1}).on("click",".logout",function(){c.deauthenticate();b.hide();return!1})}})}}; String.toLocale({"en-US":{"%gdrive.errorupload":"Error uploading your image to Google Drive.","%gdrive.doneupload":"Image uploaded successfully to Google Drive.","%gdrive.signout":"Successfully signed out from Google Drive.","%Google Drive":"Google Drive","%gdrive.import":"Import from Google Drive","%gdrive.export":"Export to Google Drive","%gdrive.account":"to view it in your Google Drive account.","%gdrive.downloadlink":"Download link","%gdrive.editlink":"Edit link","%gdrive.sharelink":"Share link", "%tips.gdrive.downloadlink":"Use this link to download the file directy.","%tips.gdrive.sharelink":"Use this link to share the file with your friends.","%tips.gdrive.editlink":"Use this link to edit the file.","%gdrive.filesize":"File size"}}); picozu.extensions.plugins.memes={parameters:{title:"Meme Designer",handle:"memes",version:"1.0",email:"office@picozu.com",url:"www.picozu.com",description:"The plugin offers the possibility to design your own memes in just few easy steps. You can choose from various types of memes and share your creations directly to 9GAG."},onDisable:function(){this.removeTool("memes");this.removeWindow("memes");this.helpers.memes=null},onEnable:function(){this.addTool(l("%memes.title"),"memes");var a=this;this.insertStyle("memes", !0);this.helpers.memes={done:!1,imageLayer:null,newTab:null,topLayer:null,bottomLayer:null,topFontSize:42,bottomFontSize:42,width:400,height:400,prepare:function(){a.showLoader();this.newTab=a.newTab({width:400,height:400,name:"meme designer"}).activate();this.newTab.heap.memes=!0;this.topLayer=new picozu.objects.layer({type:picozu.LAYER_TYPE_TEXT,parent:this.newTab,width:400,height:42,left:10,parameters:{fontColor:[0,0,0],fillColor:[255,255,255],fontFamily:"Impact",fontCase:picozu.FONT_CASE_UPPERCASE, fontAlign:"center",fontSize:42,drawMode:picozu.DRAW_MODE_BOTH},text:l("%Top Text"),name:"Top Meme Text",top:10});this.bottomLayer=new picozu.objects.layer({type:picozu.LAYER_TYPE_TEXT,parent:this.newTab,width:400,height:42,text:l("%Bottom Text"),left:10,name:"Bottom Meme Text",top:340,parameters:{fontColor:[0,0,0],fillColor:[255,255,255],fontFamily:"Impact",fontCase:picozu.FONT_CASE_UPPERCASE,fontAlign:"center",fontSize:42,drawMode:picozu.DRAW_MODE_BOTH}});a.addDefaultWatermark().hideLoader()},load:function(c){a.showLoader(); var b=this,d=new Image;d.onload=function(){b.newTab.resize(d.width,d.height,!0);b.newTab.layers[1].resize(d.width,d.height).drawImage(d,d.width,d.height);b.width=d.width;b.height=d.height;b.bottomLayer.move(0,d.height-10-b.bottomLayer.getHeight());a._refreshAll();b.refresh();a.hideLoader()};d.onerror=function(){a.notify(l("%main.image.notloaded"),!0)};d.src=c},refresh:function(){var a=$("#meme-gen-toptext").val(),b=$("#meme-gen-bottext").val();this.topLayer.setText(a).setWidth(this.width).drawText(); this.bottomLayer.setWidth(this.width).setText(b).drawText();this.bottomLayer.move(0,this.height-10-this.bottomLayer.getHeight())},adjustTopFont:function(a){10<=this.topFontSize&&100>=this.topFontSize&&(this.topFontSize=!0===a?this.topFontSize-2:this.topFontSize+2,this.topLayer.setParameter("fontSize",this.topFontSize).setHeight(this.topFontSize+10).drawText(),this.refresh())},adjustBottomFont:function(a){10<=this.bottomFontSize&&100>=this.bottomFontSize&&(this.bottomFontSize=!0===a?this.bottomFontSize- 2:this.bottomFontSize+2,this.bottomLayer.setParameter("fontSize",this.bottomFontSize).setHeight(this.bottomFontSize+10).drawText(),this.refresh())}};picozu.WINDOWS.push({name:l("%memes.title"),handle:"memes",center:!0,width:500,template:'

                                          -
                                          +

                                          -
                                          +
                                          ',onShow:function(){a.helpers.memes.load(picozu.DEFAULT_PLUGINS_PATH+"memes/templates/0.jpg")},onCreate:function(){var c= this.getElementId();this.addFooter(' ');!1===a.helpers.memes.done&&"undefined"===typeof a.getSelectedTab().heap.memes&&a.helpers.memes.prepare();for(var b=0;b ul").append('
                                        • '+picozu.MEME_TEMPLATES[b].name+"
                                        • ");$(c+" .images-list > ul").width(114*picozu.MEME_TEMPLATES.length);$(c).on("click",".images-list ul li a",function(){var b=$(this).data("id");null!==picozu.MEME_TEMPLATES[b].topText?$("#meme-gen-toptext").val(picozu.MEME_TEMPLATES[b].topText):$("#meme-gen-toptext").val(l("%Top Text"));null!==picozu.MEME_TEMPLATES[b].bottomText? $("#meme-gen-bottext").val(picozu.MEME_TEMPLATES[b].bottomText):$("#meme-gen-bottext").val(l("%Bottom Text"));a.helpers.memes.load(picozu.DEFAULT_PLUGINS_PATH+"memes/templates/"+b+".jpg");return!1}).on("keyup.picozu","textarea",function(){a.helpers.memes.refresh()}).on("click","#meme-inc-toptext",function(){a.helpers.memes.adjustTopFont(!0)}).on("click","#meme-dec-toptext",function(){a.helpers.memes.adjustTopFont(!1)}).on("click","#meme-inc-bottext",function(){a.helpers.memes.adjustBottomFont(!0)}).on("click", "#meme-dec-bottext",function(){a.helpers.memes.adjustBottomFont(!1)}).on("click",".upload",function(){a.exportData(picozu.FILE_FORMAT_PNG,function(b,c){$.ajax({type:picozu.API_METHOD,data:"key="+picozu.API_KEY+"&contents="+b+"&format="+c,dataType:"json",async:!1,url:picozu.API_CONVERT,success:function(b){window.open("http://9gag.com/submit?url="+encodeURIComponent(picozu.API_ENTRY_POINT+"v/"+b.dir+b.code+"."+b.format)+"&title=test.+test","_blank");a.hideLoader()}})})})}})}}; String.toLocale({"en-US":{"%memes.title":"Meme Designer","%Top Text":"Top Text","%Bottom Text":"Bottom Text","%Decrease Font Size":"Decrease Font Size","%Increase Font Size":"Increase Font Size","%share.9gag":"Share to 9GAG"}}); picozu.MEME_TEMPLATES=[{name:"Forever Alone",topText:null,bottomText:null},{name:"Stoner Stanley",topText:null,bottomText:null},{name:"Philosocraptor",topText:null,bottomText:null},{name:"Most Interesting",topText:"I don't always",bottomText:"but when I do,"},{name:"Brace Yourself",topText:null,bottomText:null},{name:"Asian Father",topText:null,bottomText:null},{name:"Imagination",topText:null,bottomText:null},{name:"First World",topText:null,bottomText:null},{name:"Buzz and Woody",topText:null,bottomText:null}, {name:"Ancient Aliens",topText:null,bottomText:null},{name:"College Freshman",topText:null,bottomText:null},{name:"Awkward Penguin",topText:null,bottomText:null},{name:"Condescending",topText:null,bottomText:null},{name:"I Will Find You",topText:null,bottomText:null},{name:"Annoyed Picard",topText:"Why the fuck",bottomText:null},{name:"One does not",topText:null,bottomText:null},{name:"Business Cat",topText:null,bottomText:null},{name:"Bad Luck Brian",topText:null,bottomText:null},{name:"Conspiracy Keanu", topText:null,bottomText:null},{name:"Grumpy Cat",topText:null,bottomText:null},{name:"Evil Toddler",topText:null,bottomText:null},{name:"Suspicious Fry",topText:"Not sure if",bottomText:"or"},{name:"Good Guy Greg",topText:null,bottomText:null},{name:"Grumpy Cat",topText:null,bottomText:null},{name:"Overly Attached",topText:null,bottomText:null},{name:"Facepalm Picard",topText:null,bottomText:null},{name:"Scumbag Steve",topText:null,bottomText:null},{name:"Awesome",topText:null,bottomText:null},{name:"Success Kid", topText:null,bottomText:null},{name:"Y U NO",topText:null,bottomText:"Y U NO"},{name:"Pedo Bear",topText:null,bottomText:null}]; picozu.extensions.plugins.socl={parameters:{title:"So.cl",handle:"socl",version:"1.0",email:"office@picozu.com",url:"www.picozu.com",requires:["internet"],description:"This plugin allows you to share your images on So.cl."},onDisable:function(){this.removeExporter("soclsave");this.removeWindow(["soclsave"])},onEnable:function(){this.addExporter(l("%So.cl"),"soclsave");var a=this;this.insertStyle("socl",!0);picozu.WINDOWS.push({name:l("%Export to So.cl"),handle:"soclsave",center:!0,width:545,template:'
                                          ', onCreate:function(){var c=this,b=this.getElementId();$(b).on("click",".connect",function(){a.exportData(picozu.FILE_FORMAT_PNG,function(b,e){a.doRequest(picozu.API_CONVERT,"contents="+b+"&format="+e,function(b){window.open("http://www.so.cl/#/postbuilder?v=results&bk=2.0&q="+encodeURIComponent(picozu.API_ENTRY_POINT+"v/"+b.dir+b.code+"."+b.format),"_blank");a.hideLoader();c.hide()},null,"json",!0,!1)});return!1})}})}};String.toLocale({"en-US":{"%So.cl":"So.cl","%Export to So.cl":"Export to So.cl"}}); picozu.extensions.plugins.notes={parameters:{title:"Notes",handle:"notes",version:"1.0",email:"office@picozu.com",url:"www.picozu.com",requires:["internet","account"],description:"Notes plugin. Notes can be saved in the Picozu Cloud or attached to a workspace and saved with it."},onDisable:function(){this.removeDockbarPanel("notes");this.removeWindow(["notescreate","notesdisplay"])},onEnable:function(){var a=this;this.insertStyle("notes",!0);this.heap.notes=[];this.helpers.notes={notes:[],selectedId:null, selectedIid:null,getSelected:function(){return{id:this.selectedId,iid:this.selectedIid}},setSelected:function(a,b){this.selectedId=a;this.selectedIid=b},get:function(a){return this.notes[a]},refreshPanel:function(){var c=this;$("ul.notes-items-list").empty().append('
                                        • '+l("%notes.none")+"
                                        • ");a.doRequest(picozu.API_NOTES_LIST,null,function(b){if("error"!==b.status){if(0'+b.notes[e].title+"";$("ul.notes-items-list").empty().append(d)}}else a.notifier.trigger({title:l("%Error"),error:!0,content:b.error})},function(){a.notifier.trigger({title:l("%Error"),error:!0,content:l("%notes.refresherror")})},"json")}};this.getMainDockbar().addPanel({name:l("%notes.title"),handle:"notes",template:'

                                            ',onCreate:function(){a.helpers.notes.refreshPanel();$(".pico-panel-notes").on("click",".new",function(){a.openWindow("notescreate");return!1}).on("click",".refresh",function(){a.helpers.notes.refreshPanel();return!1}).on("click",".view",function(){var c=a.helpers.notes.getSelected().id; if(null!==c){var b=a.helpers.notes.get(c);a.removeWindow("notesdisplay");a.openWindow("notesdisplay",{name:b.title,handle:"notesdisplay",center:!0,width:300,template:'',onCreate:function(){var a=this.getElementId();this.addFooter(picozu.DEFAULT_WINDOW_FOOTER);$(a+" .note-description").val(b.note);$(a+" .note-title").val(b.title)},onApply:function(){var c=b.id,e=this.getStrValue(".note-title"),f=this.getStrValue(".note-description"); a.doRequest(picozu.API_NOTES_UPDATE,"title="+e+"¬e="+f+"&id="+c,function(){a.notifier.trigger({title:l("%Info"),content:l("%notes.updatedsuccess")});a.helpers.notes.refreshPanel()},function(){a.notifier.trigger({title:l("%Error"),error:!0,content:l("%notes.updatederror")})},"json")}})}else a.notifier.trigger({title:l("%Error"),error:!0,content:l("%notes.selecterror")});return!1}).on("click","ul.notes-items-list li",function(){$(this).hasClass("noitems")||($("ul.notes-items-list li").removeClass("selected"), $(this).addClass("selected"),a.helpers.notes.setSelected($(this).data("id"),$(this).data("internal-id")));return!1}).on("dblclick","ul.notes-items-list li",function(){$("ul.notes-items-list li").removeClass("selected");$(this).addClass("selected");a.helpers.notes.setSelected($(this).data("id"),$(this).data("internal-id"));$(".pico-panel-notes .view").trigger("click");return!1}).on("click",".delete",function(){var c=a.helpers.notes.getSelected(),b=c.iid;null!==c.id?a.doRequest(picozu.API_NOTES_DELETE, "id="+b,function(){a.notifier.trigger({title:l("%Info"),content:l("%notes.deletedsuccess")});a.removeWindow("notesdisplay");a.helpers.notes.refreshPanel()},function(){a.notifier.trigger({title:l("%Error"),error:!0,content:l("%notes.deletederror")})},"json"):a.notifier.trigger({title:l("%Error"),error:!0,content:l("%notes.selecterror")});return!1}).on("click",".attach",function(){null===a.helpers.notes.getSelected().id&&a.notifier.trigger({title:l("%Error"),error:!0,content:l("%notes.selecterror")}); return!1})}});picozu.WINDOWS.push({name:l("%notes.create"),handle:"notescreate",center:!0,width:300,template:'',onCreate:function(){this.getElementId();this.addFooter(picozu.DEFAULT_WINDOW_FOOTER)},onApply:function(){var c=this.getStrValue(".note-title"),b=this.getStrValue(".note-description");a.doRequest(picozu.API_NOTES_CREATE,"title="+c+"¬e="+b,function(b){"error"!==b.status?(a.notifier.trigger({title:l("%Info"), content:l("%notes.createdsuccess")}),a.helpers.notes.refreshPanel()):a.notifier.trigger({title:l("%Error"),error:!0,content:b.error})},function(){a.notifier.trigger({title:l("%Error"),error:!0,content:l("%notes.createderror")})},"json")}})}}; String.toLocale({"en-US":{"%notes.title":"Notes","%notes.create":"Create a new note","%notes.new":"Create a new note.","%notes.view":"View/Edit the selected note.","%notes.delete":"Delete the selected note.","%notes.attach":"Attach the selected note to the current workspace.","%notes.refresh":"Refresh the notes list.","%notes.none":"No notes yet.","%notes.createdsuccess":"Note created successfully.","%notes.updatedsuccess":"Note updated successfully.","%notes.deletedsuccess":"Note deleted successfully.", "%notes.refresherror":"Error refreshing the notes list.","%notes.createderror":"Error creating the note.","%notes.updatederror":"Error updating the note.","%notes.deletederror":"Error deleting the note.","%notes.selecterror":"You need to select a note first by clicking on it."}});picozu.API_NOTES_CREATE=picozu.API_ENTRY_POINT+"api/notes/create/";picozu.API_NOTES_LIST=picozu.API_ENTRY_POINT+"api/notes/all/";picozu.API_NOTES_DELETE=picozu.API_ENTRY_POINT+"api/notes/delete/"; picozu.API_NOTES_UPDATE=picozu.API_ENTRY_POINT+"api/notes/update/"; picozu.extensions.plugins.support={parameters:{title:"Support",handle:"support",version:"1.0",email:"office@picozu.com",url:"www.picozu.com",requires:["internet"],description:"Support plugin enables you to open and check support tickets from the safety of your favorite editor."},onDisable:function(){this.removeDockbarPanel("support");this.removeWindow(["support"])},onEnable:function(){var a=this;this.insertStyle("support",!0);this.getMainDockbar().addPanel({name:l("%support.title"),handle:"support", template:'Open Support Tickets',onCreate:function(){$(".pico-panel-support").on("click",".open-support",function(){a.openWindow("support");return!1})}});this.helpers.support={page:1,results:10,_ticketCallback:function(a,b){var d="",e="";b||(e=1==a.priority?l("%Critical")+" "+l("%Priority"):2==a.priority?l("%High")+" "+l("%Priority"):3==a.priority?l("%Medium")+" "+l("%Priority"):4==a.priority?l("%Low")+" "+l("%Priority"):l("%Notice"),d='
                                          • '+a.subject+' '+a.type+' '+a.date+'
                                          • '+a.description+"

                                          • ");return d},create:function(c,b,d,e,f){""!==c&&""!==b?(a.showLoader(), a.doRequest(picozu.API_SUPPORT_CREATE,"subject="+c+"&description="+b+"&priority="+d+"&public="+e+"&type="+f,function(){$(".pico-window-support .subject").val("");$(".pico-window-support .description").val("");$(".pico-window-support .priority").val("");$(".pico-window-support .public").val("");$(".pico-window-support .type").val("");$(".pico-window-support .reload-all, .pico-window-support .reload-my").trigger("click");a.notify(l("%support.create.success"));a.hideLoader()},function(){a.notify(l("%support.create.error"), !0);a.hideLoader()},"json")):a.notify(l("%support.errorempty"),!0)},refresh:function(c,b){$(".pico-window-support ul."+c+".ticketlist").empty();var d="",e="undefined"!==typeof b&&b.issues?b.issues.length:0,f=(this.page-1)*this.results,g=this.results*this.page;if(0=f&&h";a.paginate(Math.ceil(e/this.results),this.page,".pico-tickets-pager."+c);$(".pico-window-support ul."+ c+".ticketlist").append(d);a.hideLoader()},getAll:function(c,b){var d=this;"prev"===b?this.page--:"next"===b?this.page++:this.page="undefined"===typeof b?1:b;url="my"===c?picozu.API_SUPPORT_MY:picozu.API_SUPPORT_BROWSE;a.showLoader();a.doRequest(url,null,function(a){d.refresh(c,a)},function(){a.notify(l("%support.load.error"),!0);a.hideLoader()},"json")}};picozu.WINDOWS.push({name:l("%support.wintitle"),handle:"support",center:!0,width:600,template:'

                                            • '+l("%main.my.notickets")+'

                                              • '+ l("%main.all.notickets")+'

                                                ',onCreate:function(){var c=this,b=this.getElementId();$(b+" .tabs").tabs();$(b).on("click",".ticketlist.my li.ticket",function(){var a=$(this);a.hasClass("noresults")||(a=a.data("tid"),$("ul.my li.info").hide(),$("ul.my li.ticket-id-"+a).fadeIn());return!1}).on("click",".ticketlist.all li.ticket",function(){var a= $(this);a.hasClass("noresults")||(a=a.data("tid"),$("ul.all li.info").hide(),$("ul.all li.ticket-id-"+a).fadeIn());return!1}).on("click",".create",function(){a.helpers.support.create(c.getValue(".subject"),c.getValue(".description"),c.getValue(".priority"),c.getValue(".public"),c.getValue(".type"));return!1}).on("click",".reload-all",function(){a.helpers.support.getAll("all");return!1}).on("click",".reload-my",function(){a.helpers.support.getAll("my");return!1}).on("click",".pagination a",function(){var b= $(this).parent("li").parent("ul").hasClass("my")?"my":"all";$(this).parent("li").hasClass("next")?a.helpers.support.getAll(b,"next"):$(this).parent("li").hasClass("prev")?a.helpers.support.getAll(b,"prev"):a.helpers.support.getAll(b,parseInt($(this).text()));return!1});$(b+" .reload-all, "+b+" .reload-my").trigger("click")}})}}; String.toLocale({"en-US":{"%support.title":"Support","%support.wintitle":"Support Tickets","%tips.support.subject":"Keep the subject of the ticket as simple as possible, 3-6 words at most.","%tips.support.description":"Please give as much information about the ticket as you can.","%tips.support.priority":"The priority of the ticket, try to be as objective as possible.","%tips.support.type":"Select the type of the ticket.","%tips.support.public":"Whether this ticket will be seen by everybody else. Note: the ticket won't go into the public tickets pool until validated by a community manager.", "%support.notassigned":"Not assigned yet","%support.create.success":"Your ticket was created successfully.","%support.create.error":"We encountered an error while saving your ticket. Please try again later.","%support.load.error":"We were unable to load the list of tickets. Please try again later.","%Subject":"Subject","%Priority":"Priority","%Public":"Public","%Bug / Error":"Bug / Error","%Improvement":"Improvement","%New feature":"New feature","%Notice":"Notice","%Low":"Low","%support.errorempty":"Please fill in the required information for the ticket creation.", "%Medium":"Medium","%High":"High","%Critical":"Critical","%enter ticket description":"enter ticket description","%enter ticket subject":"enter ticket subject","%main.my.notickets":"You have no opened tickets.","%main.all.notickets":"There are no public tickets you can browse.","%Open Ticket":"Open Ticket","%My Tickets":"My Tickets","%Browse Public Tickets":"Browse Public Tickets"}});picozu.API_SUPPORT_CREATE=picozu.API_ENTRY_POINT+"api/support/create/"; picozu.API_SUPPORT_BROWSE=picozu.API_ENTRY_POINT+"api/support/all/";picozu.API_SUPPORT_MY=picozu.API_ENTRY_POINT+"api/support/my/"; picozu.extensions.plugins.collab={parameters:{title:"Collab",handle:"collab",version:"0.1",email:"office@picozu.com",url:"www.picozu.com",requires:["internet"],description:"Collaborative drawing plugin."},onDisable:function(){this.removeDockbarPanel("collab")},onEnable:function(){var a=this;this.insertStyle("collab",!0);this.helpers.collab={createRoom:function(){var c=this;a.doRequest(picozu.API_COLLAB_CREATE_ROOM,"room="+a.account.guid,function(b){a.isErrorRequest(b)?a.error(l("%collab.error")): c.getMessages()},function(){a.error(l("%collab.error"))},"json")},getMessages:function(){$(".pico-window-collab .messages ul").empty();a.doRequest(picozu.API_COLLAB_ROOM_MESSAGES,"room="+a.account.guid,function(c){if(a.isErrorRequest(c))a.error(l("%collab.error"));else{if(0'+c.messages[b].nickname+ ''+c.messages[b].date+'
                                                '+c.messages[b].message+"
                                                ");else $(".pico-window-collab .messages ul").append('
                                              • '+l("%collab.noitems")+"
                                              • ");$(".pico-window-collab .messages").show()}},function(){a.error(l("%collab.error"))},"json")},getUsers:function(){$(".pico-window-collab .sidebar ul").empty().append('
                                              • '+a.account.nickname+"
                                              • ");a.doRequest(picozu.API_COLLAB_ROOM_MEMBERS,"room="+a.account.guid, function(c){if(a.isErrorRequest(c))a.error(l("%collab.error"));else for(var b=0;b"+c.users[b].nickname+"")},function(){a.error(l("%collab.error"))},"json")},sendMessage:function(c){var b=this;""!==c?a.doRequest(picozu.API_COLLAB_SEND_TO_ROOM,"room="+a.account.guid+"&message="+c,function(c){a.isErrorRequest(c)?a.error(l("%collab.error")):b.getMessages()},function(){a.error(l("%collab.error"))},"json"):a.error(l("%collab.empty.message")); $(".pico-window-collab .send-text").val("")}};picozu.WINDOWS.push({name:l("%collab.title"),handle:"collab",width:740,system:!0,center:!0,template:'',onCreate:function(){a.helpers.collab.createRoom();$(".pico-window-collab").on("click",".send",function(){var c=$(".pico-window-collab .send-text").val();a.helpers.collab.sendMessage(c)}).on("keyup.picozu",".send-text",function(c){var b=$(this).val();13===c.keyCode&&a.helpers.collab.sendMessage(b)})},onShow:function(){a.helpers.collab.getUsers();a.helpers.collab.getMessages()}});this.getMainDockbar().addPanel({name:l("%collab.title"), handle:"collab",template:''+l("%collab.start")+"",onCreate:function(){$(".collab-start").on("click",function(){!0!==a.isLoggedIn()?a.notify(l("%main.notloggedin"),!0):a.openWindow("collab");return!1})}})}};picozu.API_COLLAB_SEND_TO_ROOM=picozu.API_ENTRY_POINT+"api/collab/send_to_room/";picozu.API_COLLAB_CREATE_ROOM=picozu.API_ENTRY_POINT+"api/collab/create_room/";picozu.API_COLLAB_ROOM_MESSAGES=picozu.API_ENTRY_POINT+"api/collab/room_messages/"; picozu.API_COLLAB_ROOM_MEMBERS=picozu.API_ENTRY_POINT+"api/collab/room_members/"; String.toLocale({"en-US":{"%collab.title":"Collaborative Drawing","%collab.start":"Invite and Start Sharing","%collab.invite":"Invite a new user","%collab.unmute":"Unmute the selected user","%collab.mute":"Mute the selected user","%collab.kick":"Kick the selected user","%collab.clear":"Clear history","%collab.settings":"Change settings","%collab.placeholder":"enter your message here","%collab.send":"Send the message","%collab.attach":"Attach your current image to the message","%collab.error":"Unable to perform the requested action.", "%collab.noitems":"You have no messages.","%collab.empty.message":"The message must not be empty."}});