function init(){!function(){var e,t;RK.STLExporter=function(){},RK.STLExporter.prototype={constructor:THREE.STLExporter,parse:(e=new THREE.Vector3,t=new THREE.Matrix3,function(r){console.log(r);var n="";for(var o in n+="solid exported\n",r)r[o].traverse(function(r){if(r instanceof RK.Mesh){if(0==r.visible)return;var o=r.geometry,a=r.matrixWorld,i=r.skeleton,s=r;if(o instanceof RK.BufferGeometry){var c=o.clone();o=(new RK.Geometry).fromBufferGeometry(o);for(var l=c.getAttribute("skinIndex"),d=c.getAttribute("skinWeight"),p=c.getAttribute("morphTarget0"),f=0;void 0!==p;)f++,p=c.getAttribute("morphTarget"+f);if(void 0!==l){o.skinIndices=[],o.skinWeights=[],o.morphTargets=[];for(var u=0;u").css(c).text("Export Figure"),n=jQuery("").css(c).text("Export Model (STL)"),o=jQuery("").css(c).text("Export (JSON)"),a=jQuery("").attr({type:"file",id:"ljson"}).css({display:"none"}).text("Import (JSON)"),i=jQuery("").attr({for:"ljson"}).css(c).text("Import (JSON)"),enlarge=jQuery("").css(c).text("Enlarge"),reset_scale=jQuery("").css(c).text("Reset Scale"),(r=jQuery(".characterArea")).append(n),r.append(o),r.append(a),r.append(i),r.append(enlarge),r.append(reset_scale),r.css("right",0),n.click(function(e){e.preventDefault(),download_stl(s)}),enlarge.click(function(e){e.preventDefault(),set_object_props(s,[10,10,10],[Math.PI/2,0,0])}),reset_scale.click(function(e){e.preventDefault(),set_object_props(s,[1,1,1],[0,0,0])}),o.click(function(e){e.preventDefault();var t=JSON.stringify(CK.data),r=get_name();download(t,r+".json","text/plain")}),a.on("change",function(e){e.preventDefault();var t=e.target.files[0],r=new FileReader;r.onload=function(e){e.preventDefault(),CK.change(JSON.parse(e.target.result))},r.readAsText(t)})}()}function inject_script(e,t){var r=document.getElementsByTagName("head")[0],n=document.createElement("script");n.src=e,n.onload=function(e){t()},r.appendChild(n)}function download_stl(e){var t=(new RK.STLExporter).parse([e]),r=get_name();download(t,r+".stl","application/sla")}function set_object_props(e,t,r){e.scale.set(...t),e.rotation.set(...r),e.refresh()}function get_name(){var e="Character "+(new Date).getUTCMilliseconds().toString(36);try{var t=CK.character.data.meta.character_name;e=""===t?e:t}catch(e){e instanceof ReferenceError?(console.log("Name of character data location has changed"),console.log(e)):(console.log("Other Error"),console.log(e))}return e}!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.download=t()}(this,function(){return function e(t,r,n){function o(e){e=(t=e.split(/[:;,]/))[1];for(var t,r=(t=("base64"==t[2]?atob:decodeURIComponent)(t.pop())).length,n=0,o=new Uint8Array(r);nc.length&&(p=c.split("/").pop().split("?")[0],l.href=c,-1!==l.href.indexOf(c))){var f=new XMLHttpRequest;return f.open("GET",c,!0),f.responseType="blob",f.onload=function(t){e(t.target.response,p,"application/octet-stream")},setTimeout(function(){f.send()},0),f}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(t)){if(!(2096103.424