-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsquid.js
More file actions
2 lines (2 loc) · 47 KB
/
Copy pathsquid.js
File metadata and controls
2 lines (2 loc) · 47 KB
1
2
!function(){return function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var p=n[a]={exports:{}};e[a][0].call(p.exports,function(t){return i(e[a][1][t]||t)},p,p.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}}()({1:[function(t,e,n){e.exports=function(t,e,n){if("number"!=typeof e||"number"!=typeof n)throw new TypeError('Must specify "to" and "from" arguments as numbers');if(e>n){var r=e;e=n,n=r}var i=n-e;if(0===i)return n;return t-i*Math.floor((t-e)/i)}},{}],2:[function(t,e,n){var r=t("defined"),i=t("./lib/wrap"),o=Number.EPSILON;function a(t,e,n){return e<n?t<e?e:t>n?n:t:t<n?n:t>e?e:t}function s(t,e,n){return t*(1-n)+e*n}function u(t,e,n){return Math.abs(t-e)<o?0:(n-t)/(e-t)}function c(t,e){return e=r(e,0),"number"==typeof t&&isFinite(t)?t:e}function p(t){if("number"!=typeof t)throw new TypeError("Expected dims argument");return function(e,n){var i;n=r(n,0),null==e?i=n:"number"==typeof e&&isFinite(e)&&(i=e);var o,a=[];if(null==i)for(o=0;o<t;o++)a[o]=c(e[o],n);else for(o=0;o<t;o++)a[o]=i;return a}}function f(t,e,n,r){if(r=r||[],t.length!==e.length)throw new TypeError("min and max array are expected to have the same length");for(var i=0;i<t.length;i++)r[i]=s(t[i],e[i],n);return r}function h(t,e){if("number"!=typeof(t=r(t,0)))throw new TypeError("Expected n argument to be a number");for(var n=[],i=0;i<t;i++)n.push(e);return n}function l(t,e){return(t%e+e)%e}function d(t,e,n,r){return s(t,e,1-Math.exp(-n*r))}e.exports={mod:l,fract:function(t){return t-Math.floor(t)},sign:function(t){return t>0?1:t<0?-1:0},degToRad:function(t){return t*Math.PI/180},radToDeg:function(t){return 180*t/Math.PI},wrap:i,pingPong:function(t,e){return t=l(t,2*e),e-Math.abs(t-e)},linspace:function(t,e){if("number"!=typeof(t=r(t,0)))throw new TypeError("Expected n argument to be a number");"boolean"==typeof(e=e||{})&&(e={endpoint:!0});var n=r(e.offset,0);return e.endpoint?h(t).map(function(e,r){return t<=1?0:(r+n)/(t-1)}):h(t).map(function(e,r){return(r+n)/t})},lerp:s,lerpArray:f,inverseLerp:u,lerpFrames:function(t,e,n){e=a(e,0,1);var r=t.length-1,i=e*r,o=Math.floor(i),u=i-o,c=Math.min(o+1,r),p=t[o%t.length],h=t[c%t.length];if("number"==typeof p&&"number"==typeof h)return s(p,h,u);if(Array.isArray(p)&&Array.isArray(h))return f(p,h,u,n);throw new TypeError("Mismatch in value type of two array elements: "+o+" and "+c)},clamp:a,clamp01:function(t){return a(t,0,1)},smoothstep:function(t,e,n){var r=a(u(t,e,n),0,1);return r*r*(3-2*r)},damp:d,dampArray:function(t,e,n,r,i){i=i||[];for(var o=0;o<t.length;o++)i[o]=d(t[o],e[o],n,r);return i},mapRange:function(t,e,n,r,i,a){if(Math.abs(e-n)<o)return r;var s=(t-e)/(n-e)*(i-r)+r;return a&&(i<r?s<i?s=i:s>r&&(s=r):s>i?s=i:s<r&&(s=r)),s},expand2D:p(2),expand3D:p(3),expand4D:p(4)}},{"./lib/wrap":1,defined:5}],3:[function(t,e,n){var r=t("seed-random"),i=t("simplex-noise"),o=t("defined");e.exports=function t(e){e=o(e,null);var n,a,s,u=Math.random,c=null,p=!1;return f(e),{value:h,createRandom:function(e){return t(e)},setSeed:f,getSeed:function(){return n},getRandomSeed:function(){return String(Math.floor(1e6*Math.random()))},valueNonZero:function(){for(var t=0;0===t;)t=h();return t},permuteNoise:function(){s=l()},noise1D:function(t,e,n){if(!isFinite(t))throw new TypeError("x component for noise() must be finite");return e=o(e,1),(n=o(n,1))*s.noise2D(t*e,0)},noise2D:function(t,e,n,r){if(!isFinite(t))throw new TypeError("x component for noise() must be finite");if(!isFinite(e))throw new TypeError("y component for noise() must be finite");return n=o(n,1),(r=o(r,1))*s.noise2D(t*n,e*n)},noise3D:function(t,e,n,r,i){if(!isFinite(t))throw new TypeError("x component for noise() must be finite");if(!isFinite(e))throw new TypeError("y component for noise() must be finite");if(!isFinite(n))throw new TypeError("z component for noise() must be finite");return r=o(r,1),(i=o(i,1))*s.noise3D(t*r,e*r,n*r)},noise4D:function(t,e,n,r,i,a){if(!isFinite(t))throw new TypeError("x component for noise() must be finite");if(!isFinite(e))throw new TypeError("y component for noise() must be finite");if(!isFinite(n))throw new TypeError("z component for noise() must be finite");if(!isFinite(r))throw new TypeError("w component for noise() must be finite");return i=o(i,1),(a=o(a,1))*s.noise4D(t*i,e*i,n*i,r*i)},sign:function(){return d()?1:-1},boolean:d,chance:function(t){if("number"!=typeof(t=o(t,.5)))throw new TypeError("expected n to be a number");return h()<t},range:m,rangeFloor:y,pick:function(t){return 0===t.length?void 0:t[y(0,t.length)]},shuffle:function(t){if(!Array.isArray(t))throw new TypeError("Expected Array, got "+typeof t);for(var e,n,r=t.length,i=t.slice();r;)e=Math.floor(h()*r--),n=i[r],i[r]=i[e],i[e]=n;return i},onCircle:g,insideCircle:function(t,e){t=o(t,1),g(1,e=e||[]);var n=t*Math.sqrt(h());return e[0]*=n,e[1]*=n,e},onSphere:function(t,e){t=o(t,1),e=e||[];var n=h()*Math.PI*2,r=2*h()-1,i=n,a=Math.acos(r);return e[0]=t*Math.sin(a)*Math.cos(i),e[1]=t*Math.sin(a)*Math.sin(i),e[2]=t*Math.cos(a),e},insideSphere:function(t,e){t=o(t,1),e=e||[];var n=h()*Math.PI*2,r=2*h()-1,i=h(),a=n,s=Math.acos(r),u=t*Math.cbrt(i);return e[0]=u*Math.sin(s)*Math.cos(a),e[1]=u*Math.sin(s)*Math.sin(a),e[2]=u*Math.cos(s),e},quaternion:function(t){t=t||[];var e=h(),n=h(),r=h(),i=Math.sqrt(1-e),o=Math.sqrt(e),a=2*Math.PI*n,s=2*Math.PI*r,u=Math.sin(a)*i,c=Math.cos(a)*i,p=Math.sin(s)*o,f=Math.cos(s)*o;return t[0]=u,t[1]=c,t[2]=p,t[3]=f,t},weighted:w,weightedSet:function(t){return 0===(t=t||[]).length?null:t[v(t)].value},weightedSetIndex:v,gaussian:function(t,e){if(t=o(t,0),e=o(e,1),p){p=!1;var n=c;return c=null,t+e*n}var r=0,i=0,a=0;do{r=2*h()-1,i=2*h()-1,a=r*r+i*i}while(a>=1||0===a);var s=Math.sqrt(-2*Math.log(a)/a);return c=i*s,p=!0,t+e*(r*s)}};function f(t,e){"number"==typeof t||"string"==typeof t?a=r(n=t,e):(n=void 0,a=u),s=l(),c=null,p=!1}function h(){return a()}function l(){return new i(a)}function d(){return h()>.5}function m(t,e){if(void 0===e&&(e=t,t=0),"number"!=typeof t||"number"!=typeof e)throw new TypeError("Expected all arguments to be numbers");return h()*(e-t)+t}function y(t,e){if(void 0===e&&(e=t,t=0),"number"!=typeof t||"number"!=typeof e)throw new TypeError("Expected all arguments to be numbers");return Math.floor(m(t,e))}function g(t,e){t=o(t,1),e=e||[];var n=2*h()*Math.PI;return e[0]=t*Math.cos(n),e[1]=t*Math.sin(n),e}function v(t){return 0===(t=t||[]).length?-1:w(t.map(function(t){return t.weight}))}function w(t){if(0===(t=t||[]).length)return-1;var e,n=0;for(e=0;e<t.length;e++)n+=t[e];if(n<=0)throw new Error("Weights must sum to > 0");var r=h()*n;for(e=0;e<t.length;e++){if(r<t[e])return e;r-=t[e]}return 0}}()},{defined:5,"seed-random":6,"simplex-noise":7}],4:[function(t,e,n){(function(t){(function(){!function(t,r){"object"==typeof n&&void 0!==e?e.exports=r():"function"==typeof define&&define.amd?define(r):t.canvasSketch=r()}(this,function(){var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;var i=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,i){for(var o,a,s=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),u=1;u<arguments.length;u++){for(var c in o=Object(arguments[u]))n.call(o,c)&&(s[c]=o[c]);if(e){a=e(o);for(var p=0;p<a.length;p++)r.call(o,a[p])&&(s[a[p]]=o[a[p]])}}return s},o="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{};function a(t,e){return t(e={exports:{}},e.exports),e.exports}var s=o.performance&&o.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date},u=function(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then};var c=function(t){return!(!t||"object"!=typeof t)&&("object"==typeof window&&"object"==typeof window.Node?t instanceof window.Node:"number"==typeof t.nodeType&&"string"==typeof t.nodeName)};function p(){return"undefined"!=typeof window&&window["canvas-sketch-cli"]}function f(){for(var t=arguments,e=0;e<arguments.length;e++)if(null!=t[e])return t[e]}function h(){return"undefined"!=typeof document}var l,d=a(function(t,e){function n(t){var e=[];for(var n in t)e.push(n);return e}(t.exports="function"==typeof Object.keys?Object.keys:n).shim=n}),m=a(function(t,e){var n="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();function r(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function i(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}(e=t.exports=n?r:i).supported=r,e.unsupported=i}),y=a(function(t){var e=Array.prototype.slice,n=t.exports=function(t,o,a){return a||(a={}),t===o||(t instanceof Date&&o instanceof Date?t.getTime()===o.getTime():!t||!o||"object"!=typeof t&&"object"!=typeof o?a.strict?t===o:t==o:function(t,o,a){var s,u;if(r(t)||r(o))return!1;if(t.prototype!==o.prototype)return!1;if(m(t))return!!m(o)&&(t=e.call(t),o=e.call(o),n(t,o,a));if(i(t)){if(!i(o))return!1;if(t.length!==o.length)return!1;for(s=0;s<t.length;s++)if(t[s]!==o[s])return!1;return!0}try{var c=d(t),p=d(o)}catch(t){return!1}if(c.length!=p.length)return!1;for(c.sort(),p.sort(),s=c.length-1;s>=0;s--)if(c[s]!=p[s])return!1;for(s=c.length-1;s>=0;s--)if(!n(t[u=c[s]],o[u],a))return!1;return typeof t==typeof o}(t,o,a))};function r(t){return null==t}function i(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length)&&("function"==typeof t.copy&&"function"==typeof t.slice&&!(t.length>0&&"number"!=typeof t[0]))}}),g=a(function(t,e){!function(e){var n,r,i,o=(n=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|"[^"]*"|'[^']*'/g,r=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,i=/[^-+\dA-Z]/g,function(t,e,s,u){if(1!==arguments.length||"string"!==(null===(c=t)?"null":void 0===c?"undefined":"object"!=typeof c?typeof c:Array.isArray(c)?"array":{}.toString.call(c).slice(8,-1).toLowerCase())||/\d/.test(t)||(e=t,t=void 0),(t=t||new Date)instanceof Date||(t=new Date(t)),isNaN(t))throw TypeError("Invalid date");var c,p=(e=String(o.masks[e]||e||o.masks.default)).slice(0,4);"UTC:"!==p&&"GMT:"!==p||(e=e.slice(4),s=!0,"GMT:"===p&&(u=!0));var f=s?"getUTC":"get",h=t[f+"Date"](),l=t[f+"Day"](),d=t[f+"Month"](),m=t[f+"FullYear"](),y=t[f+"Hours"](),g=t[f+"Minutes"](),v=t[f+"Seconds"](),w=t[f+"Milliseconds"](),b=s?0:t.getTimezoneOffset(),x=function(t){var e=new Date(t.getFullYear(),t.getMonth(),t.getDate());e.setDate(e.getDate()-(e.getDay()+6)%7+3);var n=new Date(e.getFullYear(),0,4);n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=e.getTimezoneOffset()-n.getTimezoneOffset();return e.setHours(e.getHours()-r),1+Math.floor((e-n)/6048e5)}(t),M=function(t){var e=t.getDay();return 0===e&&(e=7),e}(t),_={d:h,dd:a(h),ddd:o.i18n.dayNames[l],dddd:o.i18n.dayNames[l+7],m:d+1,mm:a(d+1),mmm:o.i18n.monthNames[d],mmmm:o.i18n.monthNames[d+12],yy:String(m).slice(2),yyyy:m,h:y%12||12,hh:a(y%12||12),H:y,HH:a(y),M:g,MM:a(g),s:v,ss:a(v),l:a(w,3),L:a(Math.round(w/10)),t:y<12?o.i18n.timeNames[0]:o.i18n.timeNames[1],tt:y<12?o.i18n.timeNames[2]:o.i18n.timeNames[3],T:y<12?o.i18n.timeNames[4]:o.i18n.timeNames[5],TT:y<12?o.i18n.timeNames[6]:o.i18n.timeNames[7],Z:u?"GMT":s?"UTC":(String(t).match(r)||[""]).pop().replace(i,""),o:(b>0?"-":"+")+a(100*Math.floor(Math.abs(b)/60)+Math.abs(b)%60,4),S:["th","st","nd","rd"][h%10>3?0:(h%100-h%10!=10)*h%10],W:x,N:M};return e.replace(n,function(t){return t in _?_[t]:t.slice(1,t.length-1)})});function a(t,e){for(t=String(t),e=e||2;t.length<e;)t="0"+t;return t}o.masks={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},o.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},t.exports=o}()}),v="",w=function(t,e){if("string"!=typeof t)throw new TypeError("expected a string");if(1===e)return t;if(2===e)return t+t;var n=t.length*e;if(l!==t||void 0===l)l=t,v="";else if(v.length>=n)return v.substr(0,n);for(;n>v.length&&e>1;)1&e&&(v+=t),e>>=1,t+=t;return v=(v+=t).substr(0,n)};var b,x=function(t,e,n){return t=t.toString(),void 0===e?t:(n=0===n?"0":n?n.toString():" ",w(n,e-t.length)+t)},M=function(){},_={extension:"",prefix:"",suffix:""},T=["image/png","image/jpeg","image/webp"];function k(t,e){return void 0===e&&(e={}),new Promise(function(n,r){e=i({},_,e);var o=F(Object.assign({},e,{extension:"",frame:void 0})),a=t?"streamStart":"streamEnd",s=p();return s&&s.output&&"function"==typeof s[a]?s[a](i({},e,{filename:o})).then(function(t){return n(t)}):n({filename:o,client:!1})})}function E(t,e){return void 0===e&&(e={}),function(t){return new Promise(function(e){var n=t.indexOf(",");if(-1!==n){for(var r=t.slice(n+1),i=window.atob(r),o=t.slice(0,n),a=/data:([^;]+)/.exec(o),s=(a?a[1]:"")||void 0,u=new ArrayBuffer(i.length),c=new Uint8Array(u),p=0;p<i.length;p++)c[p]=i.charCodeAt(p);e(new window.Blob([u],{type:s}))}else e(new window.Blob)})}(t).then(function(t){return S(t,e)})}function S(t,e){return void 0===e&&(e={}),new Promise(function(n){var r=(e=i({},_,e)).filename,o=p();if(o&&"function"==typeof o.saveBlob&&o.output)return o.saveBlob(t,i({},e,{filename:r})).then(function(t){return n(t)});b||((b=document.createElement("a")).style.visibility="hidden",b.target="_blank"),b.download=r,b.href=window.URL.createObjectURL(t),document.body.appendChild(b),b.onclick=function(){b.onclick=M,setTimeout(function(){window.URL.revokeObjectURL(t),b.parentElement&&b.parentElement.removeChild(b),b.removeAttribute("href"),n({filename:r,client:!1})})},b.click()})}function F(t){if(void 0===t&&(t={}),"function"==typeof(t=i({},t)).file)return t.file(t);if(t.file)return t.file;var e,n=null,r="";("string"==typeof t.extension&&(r=t.extension),"number"==typeof t.frame)&&(e="number"==typeof t.totalFrames?t.totalFrames:Math.max(1e4,t.frame),n=x(String(t.frame),String(e).length,"0"));var o=isFinite(t.totalLayers)&&isFinite(t.layer)&&t.totalLayers>1?""+t.layer:"";return null!=n?[o,n].filter(Boolean).join("-")+r:[t.prefix,t.name||t.timeStamp,o,t.hash,t.suffix].filter(Boolean).join("-")+r}var P={dimension:"dimensions",animated:"animate",animating:"animate",unit:"units",P5:"p5",pixellated:"pixelated",looping:"loop",pixelPerInch:"pixels"},R=["dimensions","units","pixelsPerInch","orientation","scaleToFit","scaleToView","bleed","pixelRatio","exportPixelRatio","maxPixelRatio","scaleContext","resizeCanvas","styleCanvas","canvas","context","attributes","parent","file","name","prefix","suffix","animate","playing","loop","duration","totalFrames","fps","playbackRate","timeScale","frame","time","flush","pixelated","hotkeys","p5","id","scaleToFitPadding","data","params","encoding","encodingQuality"],C=function(t){Object.keys(t).forEach(function(t){t in P?console.warn('[canvas-sketch] Could not recognize the setting "'+t+'", did you mean "'+P[t]+'"?'):R.includes(t)||console.warn('[canvas-sketch] Could not recognize the setting "'+t+'"')})};var j=[["postcard",101.6,152.4],["poster-small",280,430],["poster",460,610],["poster-large",610,910],["business-card",50.8,88.9],["2r",64,89],["3r",89,127],["4r",102,152],["5r",127,178],["6r",152,203],["8r",203,254],["10r",254,305],["11r",279,356],["12r",305,381],["a0",841,1189],["a1",594,841],["a2",420,594],["a3",297,420],["a4",210,297],["a5",148,210],["a6",105,148],["a7",74,105],["a8",52,74],["a9",37,52],["a10",26,37],["2a0",1189,1682],["4a0",1682,2378],["b0",1e3,1414],["b1",707,1e3],["b1+",720,1020],["b2",500,707],["b2+",520,720],["b3",353,500],["b4",250,353],["b5",176,250],["b6",125,176],["b7",88,125],["b8",62,88],["b9",44,62],["b10",31,44],["b11",22,32],["b12",16,22],["c0",917,1297],["c1",648,917],["c2",458,648],["c3",324,458],["c4",229,324],["c5",162,229],["c6",114,162],["c7",81,114],["c8",57,81],["c9",40,57],["c10",28,40],["c11",22,32],["c12",16,22],["half-letter",5.5,8.5,"in"],["letter",8.5,11,"in"],["legal",8.5,14,"in"],["junior-legal",5,8,"in"],["ledger",11,17,"in"],["tabloid",11,17,"in"],["ansi-a",8.5,11,"in"],["ansi-b",11,17,"in"],["ansi-c",17,22,"in"],["ansi-d",22,34,"in"],["ansi-e",34,44,"in"],["arch-a",9,12,"in"],["arch-b",12,18,"in"],["arch-c",18,24,"in"],["arch-d",24,36,"in"],["arch-e",36,48,"in"],["arch-e1",30,42,"in"],["arch-e2",26,38,"in"],["arch-e3",27,39,"in"]].reduce(function(t,e){var n={units:e[3]||"mm",dimensions:[e[1],e[2]]};return t[e[0]]=n,t[e[0].replace(/-/g," ")]=n,t},{}),A=function(){for(var t=0;t<arguments.length;t++)if(void 0!==arguments[t])return arguments[t]},D=["mm","cm","m","pc","pt","in","ft","px"],O={m:{system:"metric",factor:1},cm:{system:"metric",factor:.01},mm:{system:"metric",factor:.001},pt:{system:"imperial",factor:1/72},pc:{system:"imperial",factor:1/6},in:{system:"imperial",factor:1},ft:{system:"imperial",factor:12}};const N={metric:{unit:"m",ratio:1/.0254},imperial:{unit:"in",ratio:.0254}};var H=function(t,e,n,r){if("number"!=typeof t||!isFinite(t))throw new Error("Value must be a finite number");if(!e||!n)throw new Error("Must specify from and to units");var i=A((r=r||{}).pixelsPerInch,96),o=r.precision,a=!1!==r.roundPixel;if(e=e.toLowerCase(),n=n.toLowerCase(),-1===D.indexOf(e))throw new Error('Invalid from unit "'+e+'", must be one of: '+D.join(", "));if(-1===D.indexOf(n))throw new Error('Invalid from unit "'+n+'", must be one of: '+D.join(", "));if(e===n)return t;var s=1,u=1,c=!1;"px"===e&&(u=1/i,e="in"),"px"===n&&(c=!0,s=i,n="in");var p=O[e],f=O[n],h=t*p.factor*u;p.system!==f.system&&(h*=N[p.system].ratio);var l=h/f.factor*s;return c&&a?l=Math.round(l):"number"==typeof o&&isFinite(o)&&(l=function(t,e){return Number(Math.round(t+"e"+e)+"e-"+e)}(l,o)),l};function z(t,e,n,r){return void 0===e&&(e="px"),void 0===n&&(n="px"),void 0===r&&(r=72),H(t,e,n,{pixelsPerInch:r,precision:4,roundPixel:!0})}function I(t,e){var n,r,i,o,a,s,u=h(),c=e.dimensions,p=function(t){return!(!t.dimensions||"string"!=typeof t.dimensions&&!(Array.isArray(t.dimensions)&&t.dimensions.length>=2))}(e),l=t.exporting,d=!!p&&!1!==e.scaleToFit,m=!(!l&&p)||e.scaleToView;u||(d=m=!1);var y,g,v=e.units,w="number"==typeof e.pixelsPerInch&&isFinite(e.pixelsPerInch)?e.pixelsPerInch:72,b=f(e.bleed,0),x=u?window.devicePixelRatio:1,M=m?x:1;"number"==typeof e.pixelRatio&&isFinite(e.pixelRatio)?g=f(e.exportPixelRatio,y=e.pixelRatio):p?(y=M,g=f(e.exportPixelRatio,1)):g=f(e.exportPixelRatio,y=x),"number"==typeof e.maxPixelRatio&&isFinite(e.maxPixelRatio)&&(y=Math.min(e.maxPixelRatio,y)),l&&(y=g);var _,T,k=function(t,e){if(!h())return[300,150];var n=e.parent||window;if(n===window||n===document||n===document.body)return[window.innerWidth,window.innerHeight];var r=n.getBoundingClientRect();return[r.width,r.height]}(0,e),E=k[0],S=k[1];if(p){var F=function(t,e,n){if(void 0===e&&(e="px"),void 0===n&&(n=72),"string"==typeof t){var r=t.toLowerCase();if(!(r in j))throw new Error('The dimension preset "'+t+'" is not supported or could not be found; try using a4, a3, postcard, letter, etc.');var i=j[r];return i.dimensions.map(function(t){return z(t,i.units,e,n)})}return t}(c,v,w),P=Math.max(F[0],F[1]),R=Math.min(F[0],F[1]);if(e.orientation){var C="landscape"===e.orientation;n=C?P:R,r=C?R:P}else n=F[0],r=F[1];_=n,T=r,n+=2*b,r+=2*b}else _=n=E,T=r=S;var A=n,D=r;if(p&&v&&(A=z(n,v,"px",w),D=z(r,v,"px",w)),i=Math.round(A),o=Math.round(D),d&&!l&&p){var O=n/r,N=E/S,H=f(e.scaleToFitPadding,40),I=Math.round(E-2*H),L=Math.round(S-2*H);(i>I||o>L)&&(N>O?(o=L,i=Math.round(o*O)):(i=I,o=Math.round(i/O)))}return{bleed:b,pixelRatio:y,width:n,height:r,dimensions:[n,r],units:v||"px",scaleX:(a=m?Math.round(y*i):Math.round(y*A))/n,scaleY:(s=m?Math.round(y*o):Math.round(y*D))/r,pixelsPerInch:w,viewportWidth:m?Math.round(i):Math.round(A),viewportHeight:m?Math.round(o):Math.round(D),canvasWidth:a,canvasHeight:s,trimWidth:_,trimHeight:T,styleWidth:i,styleHeight:o}}H.units=D;var L=function(t,e){if("string"!=typeof t)throw new TypeError("must specify type string");if(e=e||{},"undefined"==typeof document&&!e.canvas)return null;var n=e.canvas||document.createElement("canvas");"number"==typeof e.width&&(n.width=e.width);"number"==typeof e.height&&(n.height=e.height);var r,i=e;try{var o=[t];0===t.indexOf("webgl")&&o.push("experimental-"+t);for(var a=0;a<o.length;a++)if(r=n.getContext(o[a],i))return r}catch(t){r=null}return r||null};function U(t){var e,n;void 0===t&&(t={});var r=!1;if(!1!==t.canvas){if(!(e=t.context)||"string"==typeof e){var o=t.canvas;o||(o=function(){if(!h())throw new Error("It appears you are runing from Node.js or a non-browser environment. Try passing in an existing { canvas } interface instead.");return document.createElement("canvas")}(),r=!0);var a=e||"2d";if("function"!=typeof o.getContext)throw new Error("The specified { canvas } element does not have a getContext() function, maybe it is not a <canvas> tag?");if(!(e=L(a,i({},t.attributes,{canvas:o}))))throw new Error("Failed at canvas.getContext('"+a+"') - the browser may not support this context, or a different context may already be in use with this canvas.")}if(n=e.canvas,t.canvas&&n!==t.canvas)throw new Error("The { canvas } and { context } settings must point to the same underlying canvas element");t.pixelated&&(e.imageSmoothingEnabled=!1,e.mozImageSmoothingEnabled=!1,e.oImageSmoothingEnabled=!1,e.webkitImageSmoothingEnabled=!1,e.msImageSmoothingEnabled=!1,n.style["image-rendering"]="pixelated")}return{canvas:n,context:e,ownsCanvas:r}}var q=function(){var t=this;this._settings={},this._props={},this._sketch=void 0,this._raf=null,this._recordTimeout=null,this._lastRedrawResult=void 0,this._isP5Resizing=!1,this._keyboardShortcuts=function(t){void 0===t&&(t={});var e=function(e){if(t.enabled()){var n=p();83!==e.keyCode||e.altKey||!e.metaKey&&!e.ctrlKey?32===e.keyCode?t.togglePlay(e):n&&!e.altKey&&75===e.keyCode&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),t.commit(e)):(e.preventDefault(),t.save(e))}};return{attach:function(){window.addEventListener("keydown",e)},detach:function(){window.removeEventListener("keydown",e)}}}({enabled:function(){return!1!==t.settings.hotkeys},save:function(e){e.shiftKey?t.props.recording?(t.endRecord(),t.run()):t.record():t.props.recording||t.exportFrame()},togglePlay:function(){t.props.playing?t.pause():t.play()},commit:function(e){t.exportFrame({commit:!0})}}),this._animateHandler=function(){return t.animate()},this._resizeHandler=function(){t.resize()&&t.render()}},W={sketch:{configurable:!0},settings:{configurable:!0},props:{configurable:!0}};W.sketch.get=function(){return this._sketch},W.settings.get=function(){return this._settings},W.props.get=function(){return this._props},q.prototype._computePlayhead=function(t,e){return"number"==typeof e&&isFinite(e)?t/e:0},q.prototype._computeFrame=function(t,e,n,r){return isFinite(n)&&n>1?Math.floor(t*(n-1)):Math.floor(r*e)},q.prototype._computeCurrentFrame=function(){return this._computeFrame(this.props.playhead,this.props.time,this.props.totalFrames,this.props.fps)},q.prototype._getSizeProps=function(){var t=this.props;return{width:t.width,height:t.height,pixelRatio:t.pixelRatio,canvasWidth:t.canvasWidth,canvasHeight:t.canvasHeight,viewportWidth:t.viewportWidth,viewportHeight:t.viewportHeight}},q.prototype.run=function(){if(!this.sketch)throw new Error("should wait until sketch is loaded before trying to play()");return!1!==this.settings.playing&&this.play(),"function"==typeof this.sketch.dispose&&console.warn("In canvas-sketch@0.0.23 the dispose() event has been renamed to unload()"),this.props.started||(this._signalBegin(),this.props.started=!0),this.tick(),this.render(),this},q.prototype._cancelTimeouts=function(){null!=this._raf&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&(window.cancelAnimationFrame(this._raf),this._raf=null),null!=this._recordTimeout&&(clearTimeout(this._recordTimeout),this._recordTimeout=null)},q.prototype.play=function(){var t=this.settings.animate;"animation"in this.settings&&(t=!0,console.warn("[canvas-sketch] { animation } has been renamed to { animate }")),t&&(h()?this.props.playing||(this.props.started||(this._signalBegin(),this.props.started=!0),this.props.playing=!0,this._cancelTimeouts(),this._lastTime=s(),this._raf=window.requestAnimationFrame(this._animateHandler)):console.error("[canvas-sketch] WARN: Using { animate } in Node.js is not yet supported"))},q.prototype.pause=function(){this.props.recording&&this.endRecord(),this.props.playing=!1,this._cancelTimeouts()},q.prototype.togglePlay=function(){this.props.playing?this.pause():this.play()},q.prototype.stop=function(){this.pause(),this.props.frame=0,this.props.playhead=0,this.props.time=0,this.props.deltaTime=0,this.props.started=!1,this.render()},q.prototype.record=function(){var t=this;if(!this.props.recording)if(h()){this.stop(),this.props.playing=!0,this.props.recording=!0;var e=this._createExportOptions({sequence:!0}),n=1/this.props.fps;this._cancelTimeouts();var r,i=function(){return t.props.recording?(t.props.deltaTime=n,t.tick(),t.exportFrame(e).then(function(){t.props.recording&&(t.props.deltaTime=0,t.props.frame++,t.props.frame<t.props.totalFrames?(t.props.time+=n,t.props.playhead=t._computePlayhead(t.props.time,t.props.duration),t._recordTimeout=setTimeout(i,0)):(console.log("Finished recording"),t._signalEnd(),t.endRecord(),t.stop(),t.run()))})):Promise.resolve()};this.props.started||(this._signalBegin(),this.props.started=!0),this.sketch&&"function"==typeof this.sketch.beginRecord&&this._wrapContextScale(function(e){return t.sketch.beginRecord(e)}),(r=e,void 0===r&&(r={}),k(!0,r)).catch(function(t){console.error(t)}).then(function(e){t._raf=window.requestAnimationFrame(i)})}else console.error("[canvas-sketch] WARN: Recording from Node.js is not yet supported")},q.prototype._signalBegin=function(){var t=this;this.sketch&&"function"==typeof this.sketch.begin&&this._wrapContextScale(function(e){return t.sketch.begin(e)})},q.prototype._signalEnd=function(){var t=this;this.sketch&&"function"==typeof this.sketch.end&&this._wrapContextScale(function(e){return t.sketch.end(e)})},q.prototype.endRecord=function(){var t,e=this,n=this.props.recording;return this._cancelTimeouts(),this.props.recording=!1,this.props.deltaTime=0,this.props.playing=!1,(void 0===t&&(t={}),k(!1,t)).catch(function(t){console.error(t)}).then(function(){n&&e.sketch&&"function"==typeof e.sketch.endRecord&&e._wrapContextScale(function(t){return e.sketch.endRecord(t)})})},q.prototype._createExportOptions=function(t){return void 0===t&&(t={}),{sequence:t.sequence,save:t.save,fps:this.props.fps,frame:t.sequence?this.props.frame:void 0,file:this.settings.file,name:this.settings.name,prefix:this.settings.prefix,suffix:this.settings.suffix,encoding:this.settings.encoding,encodingQuality:this.settings.encodingQuality,timeStamp:t.timeStamp||g(new Date,"yyyy.mm.dd-HH.MM.ss"),totalFrames:isFinite(this.props.totalFrames)?Math.max(0,this.props.totalFrames):1e3}},q.prototype.exportFrame=function(t){var e=this;if(void 0===t&&(t={}),!this.sketch)return Promise.all([]);"function"==typeof this.sketch.preExport&&this.sketch.preExport();var n=this._createExportOptions(t),r=p(),o=Promise.resolve();if(r&&t.commit&&"function"==typeof r.commit){var a=i({},n),s=r.commit(a);o=u(s)?s:Promise.resolve(s)}return o.then(function(t){return e._doExportFrame(i({},n,{hash:t||""}))}).then(function(t){return 1===t.length?t[0]:t})},q.prototype._doExportFrame=function(t){var e=this;void 0===t&&(t={}),this._props.exporting=!0,this.resize();var n=this.render();return void 0===n&&(n=[this.props.canvas]),n=(n=[].concat(n).filter(Boolean)).map(function(e){var n,r="object"==typeof e&&e&&("data"in e||"dataURL"in e),o=r?e.data:e,a=r?i({},e,{data:o}):{data:o};if(c(n=o)&&/canvas/i.test(n.nodeName)&&"function"==typeof n.getContext){var s=function(t,e){void 0===e&&(e={});var n=e.encoding||"image/png";if(!T.includes(n))throw new Error("Invalid canvas encoding "+n);var r=(n.split("/")[1]||"").replace(/jpeg/i,"jpg");return r&&(r=("."+r).toLowerCase()),{extension:r,type:n,dataURL:t.toDataURL(n,e.encodingQuality)}}(o,{encoding:a.encoding||t.encoding,encodingQuality:f(a.encodingQuality,t.encodingQuality,.95)});return Object.assign(a,{dataURL:s.dataURL,extension:s.extension,type:s.type})}return a}),this._props.exporting=!1,this.resize(),this.render(),Promise.all(n.map(function(e,n,r){var o=i({extension:"",prefix:"",suffix:""},t,e,{layer:n,totalLayers:r.length}),a=!1!==t.save&&e.save;for(var s in o.save=!1!==a,o.filename=F(o),delete o.encoding,delete o.encodingQuality,o)void 0===o[s]&&delete o[s];var u=Promise.resolve({});if(o.save){var c=o.data;if(o.dataURL)u=E(o.dataURL,o);else u=function(t,e){void 0===e&&(e={});var n=Array.isArray(t)?t:[t];return S(new window.Blob(n,{type:e.type||""}),e)}(c,o)}return u.then(function(t){return Object.assign({},o,t)})})).then(function(n){var r=n.filter(function(t){return t.save});if(r.length>0){var i,o=r.find(function(t){return t.outputName}),a=r.some(function(t){return t.client}),s=r.some(function(t){return t.stream});i=r.length>1?r.length:o?o.outputName+"/"+r[0].filename:""+r[0].filename;var u="";if(t.sequence)u=isFinite(e.props.totalFrames)?" (frame "+(t.frame+1)+" / "+e.props.totalFrames+")":" (frame "+t.frame+")";else r.length>1&&(u=" files");console.log("%c["+(a?"canvas-sketch-cli":"canvas-sketch")+"]%c "+(s?"Streaming into":"Exported")+" %c"+i+"%c"+u,"color: #8e8e8e;","color: initial;","font-weight: bold;","font-weight: initial;")}return"function"==typeof e.sketch.postExport&&e.sketch.postExport(),n})},q.prototype._wrapContextScale=function(t){this._preRender(),t(this.props),this._postRender()},q.prototype._preRender=function(){var t=this.props;this.props.gl||!t.context||t.p5?t.p5&&t.p5.scale(t.scaleX/t.pixelRatio,t.scaleY/t.pixelRatio):(t.context.save(),!1!==this.settings.scaleContext&&t.context.scale(t.scaleX,t.scaleY))},q.prototype._postRender=function(){var t=this.props;this.props.gl||!t.context||t.p5||t.context.restore(),t.gl&&!1!==this.settings.flush&&!t.p5&&t.gl.flush()},q.prototype.tick=function(){this.sketch&&"function"==typeof this.sketch.tick&&(this._preRender(),this.sketch.tick(this.props),this._postRender())},q.prototype.render=function(){return this.props.p5?(this._lastRedrawResult=void 0,this.props.p5.redraw(),this._lastRedrawResult):this.submitDrawCall()},q.prototype.submitDrawCall=function(){if(this.sketch){var t,e=this.props;return this._preRender(),"function"==typeof this.sketch?t=this.sketch(e):"function"==typeof this.sketch.render&&(t=this.sketch.render(e)),this._postRender(),t}},q.prototype.update=function(t){var e=this;void 0===t&&(t={});var n=["animate"];Object.keys(t).forEach(function(t){if(n.indexOf(t)>=0)throw new Error("Sorry, the { "+t+" } option is not yet supported with update().")});var r=this._settings.canvas,i=this._settings.context;for(var o in t){var a=t[o];void 0!==a&&(e._settings[o]=a)}var s=Object.assign({},this._settings,t);if("time"in t&&"frame"in t)throw new Error("You should specify { time } or { frame } but not both");if("time"in t?delete s.frame:"frame"in t&&delete s.time,"duration"in t&&"totalFrames"in t)throw new Error("You should specify { duration } or { totalFrames } but not both");"duration"in t?delete s.totalFrames:"totalFrames"in t&&delete s.duration,"data"in t&&(this._props.data=t.data);var u=this.getTimeProps(s);if(Object.assign(this._props,u),r!==this._settings.canvas||i!==this._settings.context){var c=U(this._settings),p=c.context;this.props.canvas=c.canvas,this.props.context=p,this._setupGLKey(),this._appendCanvasIfNeeded()}return t.p5&&"function"!=typeof t.p5&&(this.props.p5=t.p5,this.props.p5.draw=function(){e._isP5Resizing||(e._lastRedrawResult=e.submitDrawCall())}),"playing"in t&&(t.playing?this.play():this.pause()),C(this._settings),this.resize(),this.render(),this.props},q.prototype.resize=function(){var t=this._getSizeProps(),e=this.settings,n=this.props,r=I(n,e);Object.assign(this._props,r);var i=this.props,o=i.pixelRatio,a=i.canvasWidth,s=i.canvasHeight,u=i.styleWidth,c=i.styleHeight,p=this.props.canvas;p&&!1!==e.resizeCanvas&&(n.p5?p.width===a&&p.height===s||(this._isP5Resizing=!0,n.p5.pixelDensity(o),n.p5.resizeCanvas(a/o,s/o,!1),this._isP5Resizing=!1):(p.width!==a&&(p.width=a),p.height!==s&&(p.height=s)),h()&&!1!==e.styleCanvas&&(p.style.width=u+"px",p.style.height=c+"px"));var f=this._getSizeProps(),l=!y(t,f);return l&&this._sizeChanged(),l},q.prototype._sizeChanged=function(){this.sketch&&"function"==typeof this.sketch.resize&&this.sketch.resize(this.props)},q.prototype.animate=function(){if(this.props.playing)if(h()){this._raf=window.requestAnimationFrame(this._animateHandler);var t=s(),e=1e3/this.props.fps,n=t-this._lastTime,r=this.props.duration,i="number"==typeof r&&isFinite(r),o=!0,a=this.settings.playbackRate;"fixed"===a?n=e:"throttle"===a?n>e?this._lastTime=t-=n%e:o=!1:this._lastTime=t;var u=n/1e3,c=this.props.time+u*this.props.timeScale;c<0&&i&&(c=r+c);var p=!1,f=!1;if(i&&c>=r&&(!1!==this.settings.loop?(o=!0,c%=r,f=!0):(o=!1,c=r,p=!0),this._signalEnd()),o){this.props.deltaTime=u,this.props.time=c,this.props.playhead=this._computePlayhead(c,r);var l=this.props.frame;this.props.frame=this._computeCurrentFrame(),f&&this._signalBegin(),l!==this.props.frame&&this.tick(),this.render(),this.props.deltaTime=0}p&&this.pause()}else console.error("[canvas-sketch] WARN: Animation in Node.js is not yet supported")},q.prototype.dispatch=function(t){if("function"!=typeof t)throw new Error("must pass function into dispatch()");t(this.props),this.render()},q.prototype.mount=function(){this._appendCanvasIfNeeded()},q.prototype.unmount=function(){h()&&(window.removeEventListener("resize",this._resizeHandler),this._keyboardShortcuts.detach()),this.props.canvas.parentElement&&this.props.canvas.parentElement.removeChild(this.props.canvas)},q.prototype._appendCanvasIfNeeded=function(){h()&&(!1!==this.settings.parent&&this.props.canvas&&!this.props.canvas.parentElement&&(this.settings.parent||document.body).appendChild(this.props.canvas))},q.prototype._setupGLKey=function(){var t;this.props.context&&("function"==typeof(t=this.props.context).clear&&"function"==typeof t.clearColor&&"function"==typeof t.bufferData?this._props.gl=this.props.context:delete this._props.gl)},q.prototype.getTimeProps=function(t){void 0===t&&(t={});var e=t.duration,n=t.totalFrames,r=f(t.timeScale,1),i=f(t.fps,24),o="number"==typeof e&&isFinite(e),a="number"==typeof n&&isFinite(n),s=o?Math.floor(i*e):void 0,u=a?n/i:void 0;if(o&&a&&s!==n)throw new Error("You should specify either duration or totalFrames, but not both. Or, they must match exactly.");void 0===t.dimensions&&void 0!==t.units&&console.warn("You've specified a { units } setting but no { dimension }, so the units will be ignored."),n=f(n,s,Infinity),e=f(e,u,Infinity);var c=t.time,p=t.frame,h="number"==typeof c&&isFinite(c),l="number"==typeof p&&isFinite(p),d=0,m=0,y=0;if(h&&l)throw new Error("You should specify either start frame or time, but not both.");return h?(y=this._computePlayhead(d=c,e),m=this._computeFrame(y,d,n,i)):l&&(y=this._computePlayhead(d=(m=p)/i,e)),{playhead:y,time:d,frame:m,duration:e,totalFrames:n,fps:i,timeScale:r}},q.prototype.setup=function(t){var e=this;if(void 0===t&&(t={}),this.sketch)throw new Error("Multiple setup() calls not yet supported.");this._settings=Object.assign({},t,this._settings),C(this._settings);var n=U(this._settings),r=n.context,i=n.canvas,o=this.getTimeProps(this._settings);this._props=Object.assign({},o,{canvas:i,context:r,deltaTime:0,started:!1,exporting:!1,playing:!1,recording:!1,settings:this.settings,data:this.settings.data,render:function(){return e.render()},togglePlay:function(){return e.togglePlay()},dispatch:function(t){return e.dispatch(t)},tick:function(){return e.tick()},resize:function(){return e.resize()},update:function(t){return e.update(t)},exportFrame:function(t){return e.exportFrame(t)},record:function(){return e.record()},play:function(){return e.play()},pause:function(){return e.pause()},stop:function(){return e.stop()}}),this._setupGLKey(),this.resize()},q.prototype.loadAndRun=function(t,e){var n=this;return this.load(t,e).then(function(){return n.run(),n})},q.prototype.unload=function(){var t=this;this.pause(),this.sketch&&("function"==typeof this.sketch.unload&&this._wrapContextScale(function(e){return t.sketch.unload(e)}),this._sketch=null)},q.prototype.destroy=function(){this.unload(),this.unmount()},q.prototype.load=function(t,e){var n=this;if("function"!=typeof t)throw new Error("The function must take in a function as the first parameter. Example:\n canvasSketcher(() => { ... }, settings)");this.sketch&&this.unload(),void 0!==e&&this.update(e),this._preRender();var r=Promise.resolve();if(this.settings.p5){if(!h())throw new Error("[canvas-sketch] ERROR: Using p5.js in Node.js is not supported");r=new Promise(function(t){var e,r=n.settings.p5;r.p5&&(e=r.preload,r=r.p5);var i=function(r){e&&(r.preload=function(){return e(r)}),r.setup=function(){var e=n.props,i="webgl"===n.settings.context,o=i?r.WEBGL:r.P2D;r.noLoop(),r.pixelDensity(e.pixelRatio),r.createCanvas(e.viewportWidth,e.viewportHeight,o),i&&n.settings.attributes&&r.setAttributes(n.settings.attributes),n.update({p5:r,canvas:r.canvas,context:r._renderer.drawingContext}),t()}};if("function"==typeof r)new r(i);else{if("function"!=typeof window.createCanvas)throw new Error("{ p5 } setting is passed but can't find p5.js in global (window) scope. Maybe you did not create it globally?\nnew p5(); // <-- attaches to global scope");i(window)}})}return r.then(function(){var e=t(n.props);return u(e)||(e=Promise.resolve(e)),e}).then(function(t){return t||(t={}),n._sketch=t,h()&&(n._keyboardShortcuts.attach(),window.addEventListener("resize",n._resizeHandler)),n._postRender(),n._sizeChanged(),n}).catch(function(t){throw console.warn("Could not start sketch, the async loading function rejected with an error:\n Error: "+t.message),t})},Object.defineProperties(q.prototype,W);var B="hot-id-cache",Y=[];function K(t,e){if(void 0===e&&(e={}),e.p5){if(e.canvas||e.context&&"string"!=typeof e.context)throw new Error('In { p5 } mode, you can\'t pass your own canvas or context, unless the context is a "webgl" or "2d" string');e=Object.assign({},e,{canvas:!1,context:"string"==typeof e.context&&e.context})}var n,r,i=(n=p())&&n.hot;i&&(r=f(e.id,"$__DEFAULT_CANVAS_SKETCH_ID__$"));var o=i&&"string"==typeof r;o&&Y.includes(r)&&(console.warn("Warning: You have multiple calls to canvasSketch() in --hot mode. You must pass unique { id } strings in settings to enable hot reload across multiple sketches. ",r),o=!1);var a=Promise.resolve();if(o){Y.push(r);var s=function(t){var e=p();if(e)return e[B]=e[B]||{},e[B][t]}(r);if(s){var u=function(){var t,n=(t=s.manager,e.animate?{time:t.props.time}:void 0);return s.manager.destroy(),n};a=s.load.then(u).catch(u)}}return a.then(function(n){var i,a,s,u,c=new q;return t?(e=Object.assign({},e,n),c.setup(e),c.mount(),i=c.loadAndRun(t)):i=Promise.resolve(c),o&&(a=r,s={load:i,manager:c},(u=p())&&(u[B]=u[B]||{},u[B][a]=s)),i})}return K.canvasSketch=K,K.PaperSizes=j,K})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(t,e,n){e.exports=function(){for(var t=0;t<arguments.length;t++)if(void 0!==arguments[t])return arguments[t]}},{}],6:[function(t,e,n){(function(t){(function(){"use strict";var n=256,r=[],i=void 0===t?window:t,o=Math.pow(n,6),a=Math.pow(2,52),s=2*a,u=n-1,c=Math.random;function p(t){var e,r=t.length,i=this,o=0,a=i.i=i.j=0,s=i.S=[];for(r||(t=[r++]);o<n;)s[o]=o++;for(o=0;o<n;o++)s[o]=s[a=u&a+t[o%r]+(e=s[o])],s[a]=e;(i.g=function(t){for(var e,r=0,o=i.i,a=i.j,s=i.S;t--;)e=s[o=u&o+1],r=r*n+s[u&(s[o]=s[a=u&a+e])+(s[a]=e)];return i.i=o,i.j=a,r})(n)}function f(t,e){for(var n,r=t+"",i=0;i<r.length;)e[u&i]=u&(n^=19*e[u&i])+r.charCodeAt(i++);return h(e)}function h(t){return String.fromCharCode.apply(0,t)}e.exports=function(t,u){if(u&&!0===u.global)return u.global=!1,Math.random=e.exports(t,u),u.global=!0,Math.random;var c=[],l=(f(function t(e,n){var r,i=[],o=(typeof e)[0];if(n&&"o"==o)for(r in e)try{i.push(t(e[r],n-1))}catch(t){}return i.length?i:"s"==o?e:e+"\0"}(u&&u.entropy||!1?[t,h(r)]:0 in arguments?t:function(t){try{return i.crypto.getRandomValues(t=new Uint8Array(n)),h(t)}catch(t){return[+new Date,i,i.navigator&&i.navigator.plugins,i.screen,h(r)]}}(),3),c),new p(c));return f(h(l.S),r),function(){for(var t=l.g(6),e=o,r=0;t<a;)t=(t+r)*n,e*=n,r=l.g(1);for(;t>=s;)t/=2,e/=2,r>>>=1;return(t+r)/e}},e.exports.resetGlobal=function(){Math.random=c},f(Math.random(),r)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(t,e,n){!function(){"use strict";var t=.5*(Math.sqrt(3)-1),r=(3-Math.sqrt(3))/6,i=1/6,o=(Math.sqrt(5)-1)/4,a=(5-Math.sqrt(5))/20;function s(t){var e;e="function"==typeof t?t:t?function(){var t=0,e=0,n=0,r=1,i=(o=4022871197,function(t){t=t.toString();for(var e=0;e<t.length;e++){var n=.02519603282416938*(o+=t.charCodeAt(e));n-=o=n>>>0,o=(n*=o)>>>0,o+=4294967296*(n-=o)}return 2.3283064365386963e-10*(o>>>0)});var o;t=i(" "),e=i(" "),n=i(" ");for(var a=0;a<arguments.length;a++)(t-=i(arguments[a]))<0&&(t+=1),(e-=i(arguments[a]))<0&&(e+=1),(n-=i(arguments[a]))<0&&(n+=1);return i=null,function(){var i=2091639*t+2.3283064365386963e-10*r;return t=e,e=n,n=i-(r=0|i)}}(t):Math.random,this.p=u(e),this.perm=new Uint8Array(512),this.permMod12=new Uint8Array(512);for(var n=0;n<512;n++)this.perm[n]=this.p[255&n],this.permMod12[n]=this.perm[n]%12}function u(t){var e,n=new Uint8Array(256);for(e=0;e<256;e++)n[e]=e;for(e=0;e<255;e++){var r=e+~~(t()*(256-e)),i=n[e];n[e]=n[r],n[r]=i}return n}s.prototype={grad3:new Float32Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]),grad4:new Float32Array([0,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,1,0,1,1,1,0,1,-1,1,0,-1,1,1,0,-1,-1,-1,0,1,1,-1,0,1,-1,-1,0,-1,1,-1,0,-1,-1,1,1,0,1,1,1,0,-1,1,-1,0,1,1,-1,0,-1,-1,1,0,1,-1,1,0,-1,-1,-1,0,1,-1,-1,0,-1,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,0]),noise2D:function(e,n){var i,o,a=this.permMod12,s=this.perm,u=this.grad3,c=0,p=0,f=0,h=(e+n)*t,l=Math.floor(e+h),d=Math.floor(n+h),m=(l+d)*r,y=e-(l-m),g=n-(d-m);y>g?(i=1,o=0):(i=0,o=1);var v=y-i+r,w=g-o+r,b=y-1+2*r,x=g-1+2*r,M=255&l,_=255&d,T=.5-y*y-g*g;if(T>=0){var k=3*a[M+s[_]];c=(T*=T)*T*(u[k]*y+u[k+1]*g)}var E=.5-v*v-w*w;if(E>=0){var S=3*a[M+i+s[_+o]];p=(E*=E)*E*(u[S]*v+u[S+1]*w)}var F=.5-b*b-x*x;if(F>=0){var P=3*a[M+1+s[_+1]];f=(F*=F)*F*(u[P]*b+u[P+1]*x)}return 70*(c+p+f)},noise3D:function(t,e,n){var r,o,a,s,u,c,p,f,h,l,d=this.permMod12,m=this.perm,y=this.grad3,g=(t+e+n)*(1/3),v=Math.floor(t+g),w=Math.floor(e+g),b=Math.floor(n+g),x=(v+w+b)*i,M=t-(v-x),_=e-(w-x),T=n-(b-x);M>=_?_>=T?(u=1,c=0,p=0,f=1,h=1,l=0):M>=T?(u=1,c=0,p=0,f=1,h=0,l=1):(u=0,c=0,p=1,f=1,h=0,l=1):_<T?(u=0,c=0,p=1,f=0,h=1,l=1):M<T?(u=0,c=1,p=0,f=0,h=1,l=1):(u=0,c=1,p=0,f=1,h=1,l=0);var k=M-u+i,E=_-c+i,S=T-p+i,F=M-f+2*i,P=_-h+2*i,R=T-l+2*i,C=M-1+.5,j=_-1+.5,A=T-1+.5,D=255&v,O=255&w,N=255&b,H=.6-M*M-_*_-T*T;if(H<0)r=0;else{var z=3*d[D+m[O+m[N]]];r=(H*=H)*H*(y[z]*M+y[z+1]*_+y[z+2]*T)}var I=.6-k*k-E*E-S*S;if(I<0)o=0;else{var L=3*d[D+u+m[O+c+m[N+p]]];o=(I*=I)*I*(y[L]*k+y[L+1]*E+y[L+2]*S)}var U=.6-F*F-P*P-R*R;if(U<0)a=0;else{var q=3*d[D+f+m[O+h+m[N+l]]];a=(U*=U)*U*(y[q]*F+y[q+1]*P+y[q+2]*R)}var W=.6-C*C-j*j-A*A;if(W<0)s=0;else{var B=3*d[D+1+m[O+1+m[N+1]]];s=(W*=W)*W*(y[B]*C+y[B+1]*j+y[B+2]*A)}return 32*(r+o+a+s)},noise4D:function(t,e,n,r){var i,s,u,c,p,f,h,l,d,m,y,g,v,w,b,x,M,_=this.perm,T=this.grad4,k=(t+e+n+r)*o,E=Math.floor(t+k),S=Math.floor(e+k),F=Math.floor(n+k),P=Math.floor(r+k),R=(E+S+F+P)*a,C=t-(E-R),j=e-(S-R),A=n-(F-R),D=r-(P-R),O=0,N=0,H=0,z=0;C>j?O++:N++,C>A?O++:H++,C>D?O++:z++,j>A?N++:H++,j>D?N++:z++,A>D?H++:z++;var I=C-(f=O>=3?1:0)+a,L=j-(h=N>=3?1:0)+a,U=A-(l=H>=3?1:0)+a,q=D-(d=z>=3?1:0)+a,W=C-(m=O>=2?1:0)+2*a,B=j-(y=N>=2?1:0)+2*a,Y=A-(g=H>=2?1:0)+2*a,K=D-(v=z>=2?1:0)+2*a,G=C-(w=O>=1?1:0)+3*a,Q=j-(b=N>=1?1:0)+3*a,Z=A-(x=H>=1?1:0)+3*a,J=D-(M=z>=1?1:0)+3*a,V=C-1+4*a,X=j-1+4*a,$=A-1+4*a,tt=D-1+4*a,et=255&E,nt=255&S,rt=255&F,it=255&P,ot=.6-C*C-j*j-A*A-D*D;if(ot<0)i=0;else{var at=_[et+_[nt+_[rt+_[it]]]]%32*4;i=(ot*=ot)*ot*(T[at]*C+T[at+1]*j+T[at+2]*A+T[at+3]*D)}var st=.6-I*I-L*L-U*U-q*q;if(st<0)s=0;else{var ut=_[et+f+_[nt+h+_[rt+l+_[it+d]]]]%32*4;s=(st*=st)*st*(T[ut]*I+T[ut+1]*L+T[ut+2]*U+T[ut+3]*q)}var ct=.6-W*W-B*B-Y*Y-K*K;if(ct<0)u=0;else{var pt=_[et+m+_[nt+y+_[rt+g+_[it+v]]]]%32*4;u=(ct*=ct)*ct*(T[pt]*W+T[pt+1]*B+T[pt+2]*Y+T[pt+3]*K)}var ft=.6-G*G-Q*Q-Z*Z-J*J;if(ft<0)c=0;else{var ht=_[et+w+_[nt+b+_[rt+x+_[it+M]]]]%32*4;c=(ft*=ft)*ft*(T[ht]*G+T[ht+1]*Q+T[ht+2]*Z+T[ht+3]*J)}var lt=.6-V*V-X*X-$*$-tt*tt;if(lt<0)p=0;else{var dt=_[et+1+_[nt+1+_[rt+1+_[it+1]]]]%32*4;p=(lt*=lt)*lt*(T[dt]*V+T[dt+1]*X+T[dt+2]*$+T[dt+3]*tt)}return 27*(i+s+u+c+p)}},s._buildPermutationTable=u,"undefined"!=typeof define&&define.amd&&define(function(){return s}),void 0!==n?n.SimplexNoise=s:"undefined"!=typeof window&&(window.SimplexNoise=s),void 0!==e&&(e.exports=s)}()},{}],8:[function(t,e,n){const r=t("canvas-sketch"),i=t("canvas-sketch-util/random"),{lerp:o}=t("canvas-sketch-util/math"),a=t("canvas-sketch-util/random");i.setSeed(i.getRandomSeed()),console.log("Random Seed:",i.getSeed());const s={hotkeys:!1,suffix:i.getSeed(),dimensions:"letter",orientation:"portrait",pixelsPerInch:300,units:"cm"},u=[c("#264653"),c("#2a9d8f"),c("#e9c46a"),c("#f4a261"),c("#e76f51")];function c(t){let e=0,n=0,r=0;4==t.length?(e="0x"+t[1]+t[1],n="0x"+t[2]+t[2],r="0x"+t[3]+t[3]):7==t.length&&(e="0x"+t[1]+t[2],n="0x"+t[3]+t[4],r="0x"+t[5]+t[6]),e/=255,n/=255,r/=255;let i=Math.min(e,n,r),o=Math.max(e,n,r),a=o-i,s=0,u=0,c=0;return s=0==a?0:o==e?(n-r)/a%6:o==n?(r-e)/a+2:(e-n)/a+4,(s=Math.round(60*s))<0&&(s+=360),c=(o+i)/2,"hsl("+s+","+(u=+(100*(u=0==a?0:a/(1-Math.abs(2*c-1)))).toFixed(1))+"%,"+(c=+(100*c).toFixed(1))+"%)"}r(({})=>{let t=0,e=0,n=0;const r=Array.from(new Array(200)).map(()=>(n%2==0?t=(t+a.gaussian(.03,.01))%1:e=(e+a.gaussian(.03,.01))%1,n++,{position:[t,e],size:Math.abs(a.gaussian(.2,.1))}));return console.log(r),({context:t,width:e,height:n})=>{t.fillStyle="hsl(0, 0%, 98%)",t.globalAlpha=1,t.fillRect(0,0,e,n),r.forEach(({position:r,size:i})=>{radius=i*e*.05;const[s,c]=r;t.lineWidth=.1;let p=o(2,e-2,s),f=o(2,n-2,c);t.globalAlpha=.5,t.strokeStyle="hsl(345, 100%, 50%)",t.fillStyle="hsl(0, 0%, 15%)",t.strokeStyle=a.pick(u),t.beginPath(),t.arc(p,f,radius,0,2*Math.PI,!1),t.stroke()})}},s)},{"canvas-sketch":4,"canvas-sketch-util/math":2,"canvas-sketch-util/random":3}],9:[function(t,e,n){(function(t){(function(){t.CANVAS_SKETCH_DEFAULT_STORAGE_KEY=window.location.href}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[8,9]);
//# sourceMappingURL=squid.js.map