elm/elm-mini.js
2012-05-23 17:27:39 -04:00

45 lines
No EOL
22 KiB
JavaScript

var Guid=function(){var b=0;return{guid:function(){return b+=1}}}(),Value=function(){var b=function(a){if("boolean"===typeof a)return a?"True":"False";if("number"!==typeof a&&a[0]){if("Tuple"===a[0].substring(0,5)){for(var c="",e=a.length;--e;)c=","+b(a[e])+c;","===c[0]&&(c=c.substring(1));return"("+c+")"}if("Cons"===a[0])for(var e="string"===typeof a[1]?'"':"]",d="string"===typeof a[1]?"":",",c=("string"===typeof a[1]?'"':"[")+b(a[1]),a=a[2];;)if("Cons"===a[0])c+=d+b(a[1]),a=a[2];else return c+e;
else{if("Nil"===a[0])return"[]";c="";for(e=a.length;--e;)c=" "+b(a[e])+c;c=a[0]+c;return 1<a.length?"("+c+")":c}}return a+""};return{show:function(a){return Text.monospace(String.properEscape(b(a)))},Tuple:function(){var a=arguments.length,c=Array(a+1);for(c[0]="Tuple"+arguments.length;a--;)c[a+1]=arguments[a];return c},append:function(a,c){if("string"===typeof a&&"string"===typeof c)return a.concat(c);if("Nil"===a[0])return c;for(var e=["Cons",a[1],["Nil"]],b=e,a=a[2];"Cons"===a[0];)b[2]=["Cons",
a[1],["Nil"]],a=a[2],b=b[2];b[2]=c;return e}}}(),String=function(){return{toText:function(b){if("string"===typeof b)return b;for(var a=[];"Cons"===b[0];)a.push(b[1]),b=b[2];return String.properEscape(a.join(""))},properEscape:function(b){b.replace('"',"&#34;");b.replace("&","&#38;");b.replace("'","&#39;");b.replace("<","&#60;");b.replace(">","&#62;");return b}}}(),Color=function(){var b=function(a,c,b,d){return{r:Math.round(255*a),g:Math.round(255*c),b:Math.round(255*b),a:d}};return{black:b(0,0,0,
1),white:b(1,1,1,1),red:b(1,0,0,1),green:b(0,1,0,1),blue:b(0,0,1,1),rgba:function(a){return function(c){return function(e){return function(d){return b(a,c,e,d)}}}},rgb:function(a){return function(c){return function(e){return b(a,c,e,1)}}},Internal:{extract:function(a){return 1===a.a?"rgb("+a.r+","+a.g+","+a.b+")":"rgba("+a.r+","+a.g+","+a.b+","+a.a+")"}}}}(),Element=function(){var b=function(a){a=document.createElement(a);a.id=Guid.guid();return a},a=function(a){var c=b("div");c.appendChild(a);return c},
c=function(a){return function(c){return function(e){var d=b("div");d.isElmText=!0;d.innerHTML=e;d.style.textAlign=c;0<a&&(d.style.width=a+"px");d.isElmLeaf=!0;d.style.visibility="hidden";d.style.styleFloat="left";d.style.cssFloat="left";document.body.appendChild(d);e=window.getComputedStyle(d);0>=a&&(d.style.width=e.getPropertyValue("width"));d.style.height=e.getPropertyValue("height");document.body.removeChild(d);d.style.visibility="visible";d.style.styleFloat="none";d.style.cssFloat="none";return d}}},
e=c(0)("left"),d=c(0)("justify"),g=c(0)("center"),f=function(c){return"DIV"===c.tagName?c:a(c)},j=function(a){a.style.styleFloat="left";a.style.cssFloat="left";return a},h=function(a){a.style.position="absolute";return a},i=function(a,c,e){for(var d=b("div"),h=e.length;h--;){var g=c(e[h]);d.appendChild(g)}d.elmFlowDirection=a;return d},k=function(a){return function(c){for(var b=[];"Cons"===c[0];)b.push(c[1]),c=c[2];3<=a&&b.reverse();c=a%3;if(0==c)return i("Y",f,b);if(1==c)return i("X",j,b);if(2==
c)return i("Z",h,b)}},l=function(a){return function(b){if("A"===b.tagName)return l(a)(b.firstChild),b;if(b.hasOwnProperty("isElmText")){var e=c(a)(b.style.textAlign)(b.innerHTML);b.style.height=e.style.height}b.style.width=a+"px";return b}};return{text:e,image:function(a){var c=b("img");c.isElmLeaf=!0;c.onload=function(){""===c.style.width&&0<this.width&&(c.style.width=c.width=this.width+"px");""===c.style.height&&0<this.height&&(c.style.height=c.height=this.height+"px");Dispatcher.adjust()};c.src=
String.toText(a);c.name=c.src;return c},video:function(a){var a=String.toText(a),c=b("video");c.controls="controls";var e=b("source");e.src=a;e.type="video/"+a.substring(a.length-3,a.length);c.appendChild(e);c.isElmLeaf=!0;return c},audio:function(a){var a=String.toString(a),c=b("video");c.controls="controls";var e=b("source");e.src=a;e.type="audio/"+a.substring(a.length-3,a.length);c.appendChild(e);c.isElmLeaf=!0;return c},collage:function(a){return function(c){return function(e){var d=b("canvas");
d.style.width=a+"px";d.style.height=c+"px";d.width=a;d.height=c;if(d.getContext){var h=d.getContext("2d");for(h.clearRect(0,0,d.width,d.height);"Cons"===e[0];)h=e[1](h),e=e[2];return d}d.innerHTML="Your browser does not support the canvas element.";d.isElmLeaf=!0;return d}}},flow:k,layers:k(2),beside:function(a){return function(c){return k(1)(["Cons",a,["Cons",c,["Nil"]]])}},above:function(a){return function(c){return k(0)(["Cons",a,["Cons",c,["Nil"]]])}},below:function(a){return function(c){return k(3)(["Cons",
a,["Cons",c,["Nil"]]])}},box:function(a){return function(c){c.style.position="absolute";c.style.margin="auto";var e=(a-1)%3,d=(a-1)/3;2>e&&(c.style.left=0);0<e&&(c.style.right=0);2>d&&(c.style.top=0);0<d&&(c.style.bottom=0);e=b("div");e.style.position="relative";e.appendChild(c);return e}},width:l,height:function(a){return function(c){("A"===c.tagName?c.firstChild:c).style.height=a+"px";return c}},size:function(a){return function(c){return function(e){var b="A"===e.tagName?e.firstChild:e;b.style.width=
a+"px";b.style.height=c+"px";return e}}},color:function(a){return function(c){c.style.backgroundColor=Color.Internal.extract(a);return c}},opacity:function(a){return function(c){c.style.opacity=a;return c}},link:function(c){return function(e){var d=b("a");d.href=Text.fromString(c);d.appendChild(e);return a(d)}},asText:function(a){return c(0)("left")(Value.show(a))},plainText:function(a){return c(0)("left")(String.toText(a))},justifiedText:d,centeredText:g,up:0,left:1,inward:2,down:3,right:4,outward:5}}(),
Text=function(){var b=function(a){if("string"===typeof a)return a;for(var c=[];"Cons"===a[0];)c.push(a[1]),a=a[2];return String.properEscape(c.join(""))},a=function(a){return function(c){return"<"+a+">"+c+"</"+a+">"}},c=function(a,c){return function(e){return"<span style='"+a+":"+c+"'>"+e+"</span>"}},e=a("h1"),d=c("font-style","italic"),a=a("b"),g=c("text-decoration","underline"),f=c("text-decoration","overline"),j=c("text-decoration","line-through");return{fromString:b,toText:b,header:e,height:function(a){return c("font-size",
a+"em")},italic:d,bold:a,underline:g,overline:f,strikeThrough:j,monospace:c("font-family","monospace"),color:function(a){return c("color",Color.Internal.extract(a))},link:function(a){return function(c){return"<a href='"+b(a)+"'>"+c+"</a>"}}}}(),Shape=function(){var b=function(a,e,b,g){return{center:a,points:e,theta:b,scale:g}},a=function(a){return function(e){return function(b){return function(g){g.save();g.translate(b.center[0],b.center[1]);g.rotate(b.theta);g.scale(b.scale,b.scale);g.beginPath();
var f=b.points;g.moveTo(f[0][0],f[0][1]);for(var j=f.length;j--;)g.lineTo(f[j][0],f[j][1]);g.closePath();a?(g.fillStyle=Color.Internal.extract(e),g.fill()):(g.strokeStyle=Color.Internal.extract(e),g.stroke());g.restore();return g}}}};return{polygon:function(a){return function(e){for(var d=[];"Cons"===a[0];)d.push([a[1][1],a[1][2]]),a=a[2];e=[e[1],e[2]];return b(e,d,0,1)}},ngon:function(a){return function(e){return function(d){for(var g=[],f=a;f--;)g.push([e*Math.cos(2*Math.PI*f/a),e*Math.sin(2*Math.PI*
f/a)]);d=[d[1],d[2]];return b(d,g,0,1)}}},rect:function(a){return function(e){return function(d){var g=[[-a/2,-e/2],[a/2,-e/2],[a/2,e/2],[-a/2,e/2]],d=[d[1],d[2]];return b(d,g,0,1)}}},oval:function(a){return function(e){return function(d){for(var g=[],f=2*Math.PI;0<f;f-=Math.PI/50)g.push([a/2*Math.cos(f),e/2*Math.sin(f)]);d=[d[1],d[2]];return b(d,g,0,1)}}},move:function(a){return function(e){return function(d){return b([a+d.center[0],e+d.center[1]],d.points,d.theta,d.scale)}}},rotate:function(a){return function(e){return b(e.center,
e.points,e.theta+2*Math.PI*a,e.scale)}},scale:function(a){return function(e){return b(e.center,e.points,e.theta,e.scale*a)}},filled:a(!0),outlined:a(!1),customOutline:function(a){return function(e){return function(b){b.points.push(b.points[0]);return Line.customLine(a)(e)(b)}}}}}(),Line=function(){var b=function(a){return function(c){return function(b){if("string"===typeof a[0]){for(var d=[];"Cons"===a[0];)d.push(a[1]),a=a[2];a=d}0===a.length&&(a=[8,4]);return function(d){d.save();d.beginPath();d.translate(b.center[0],
b.center[1]);d.rotate(b.theta);d.scale(b.scale,b.scale);var f=a,j=b.points,h=j.length-1,i=j[h][0],k=j[h][1],l=0,p=0,m=0,n=0,o=0,r=0,t=f.length,s=!0,q=f[0];for(d.moveTo(i,k);h--;){l=j[h][0];p=j[h][1];m=l-i;n=p-k;for(o=Math.sqrt(m*m+n*n);q<=o;)i+=m*q/o,k+=n*q/o,d[s?"lineTo":"moveTo"](i,k),m=l-i,n=p-k,o=Math.sqrt(m*m+n*n),s=!s,r=(r+1)%t,q=f[r];0<o&&(d[s?"lineTo":"moveTo"](l,p),q-=o);i=l;k=p}d.strokeStyle=Color.Internal.extract(c);d.stroke();d.restore();return d}}}};return{line:function(a){for(var c=
[];"Cons"===a[0];)c.push([a[1][1],a[1][2]]),a=a[2];return{center:[0,0],points:c,theta:0,scale:1}},customLine:b,solid:function(a){return function(c){return function(b){b.save();b.beginPath();b.translate(c.center[0],c.center[1]);b.rotate(c.theta);b.scale(c.scale,c.scale);var d=c.points,g=d.length;for(b.moveTo(d[g-1][0],d[g-1][1]);g--;)b.lineTo(d[g][0],d[g][1]);b.strokeStyle=Color.Internal.extract(a);b.stroke();b.restore();return b}}},dashed:b([8,4]),dotted:b([3,3])}}(),Elm=function(){var b=function(a){this.id=
Guid.guid();this.value=a;this.step=function(a,c){var b=a===this.id;b&&(this.value=c);return b}},a=function(a,c){this.id=Guid.guid();this.value=null;c.reverse();this.recalc=function(){for(var b=a,f=c.length;f--;)b=b(c[f].value);this.value=b};this.recalc();this.step=function(a,b){if(this.hasOwnProperty(a))return!1;for(var e=!1,h=c.length;h--;)e=c[h].step(a,b)||e;e?this.recalc():this[a]=!0;return e}},c=function(a,c,b){this.id=Guid.guid();this.value=c;this.step=function(c,d){if(this.hasOwnProperty(c))return!1;
var h=b.step(c,d);h?this.value=a(b.value)(this.value):this[c]=!0;return h}};return{Input:function(a){return new b(a)},Lift:function(c,b){return new a(c,b)},Fold:function(a,b,g){return new c(a,b,g)}}}(),Dispatcher=function(){var b=null,a=function(c){var b=c.childNodes,d=b.length;if(c.hasOwnProperty("isElmLeaf")){var b=""===c.style.width?0:c.style.width.slice(0,-2)-0,g=""===c.style.height?0:c.style.height.slice(0,-2)-0;return[b,g]}if(1===d){var f=a(b[0]);""!==c.style.width&&(f[0]=c.style.width.slice(0,
-2)-0);""!==c.style.height&&(f[1]=c.style.height.slice(0,-2)-0);0!==f[0]&&(c.style.width=f[0]+"px");0!==f[1]&&(c.style.height=f[1]+"px");return f}for(var j=0,h=g=0,i=0,k=!0,l=!0;d--;)f=a(b[d]),j=Math.max(j,f[0]),g=Math.max(g,f[1]),h+=f[0],i+=f[1],k=k&&0<f[0],l=l&&0<f[1];b=j;d=c.elmFlowDirection;"X"===d&&(b=k?h:0);"Y"===d&&(g=l?i:0);0<b&&(c.style.width=b+"px");0<g&&(c.style.height=g+"px");return[b,g]};return{initialize:function(){try{b=main()}catch(c){throw document.body.innerHTML="An Error Occured: Better Messages to come.",
c;}b.hasOwnProperty("step")||(b=Elm.Input(b));var e=document.getElementById("content");e.appendChild(b.value);a(e);e=document.getElementById("widthChecker").offsetWidth;e!==window.innerWidth&&Dispatcher.notify(Window.dimensions.id,Value.Tuple(e,window.innerHeight))},notify:function(c,e){if(b.step(c,e)){var d=document.getElementById("content");d.replaceChild(b.value,d.children[0]);a(d)}},adjust:function(){var c=document.getElementById("content");a(c)}}}(),Signal=function(){function b(a){for(var c=
["Nil"],b=a.length;b--;)c=["Cons",a[b],c];return c}var a=function(){return document.addEventListener?function(a,c,b){a.addEventListener(c,b,!1)}:function(a,c,b){a.attachEvent("on"+c,b)}}(),c=function(){function c(a){var b=0,e=0;a||(a=window.event);if(a.pageX||a.pageY)b=a.pageX,e=a.pageY;else if(a.clientX||a.clientY)b=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,e=a.clientY+document.body.scrollTop+document.documentElement.scrollTop;return Value.Tuple(b,e)}var b=Elm.Input(Value.Tuple(0,
0)),e=Elm.Input(!1),d=Elm.Input(!1);a(document,"click",function(){Dispatcher.notify(d.id,!0);Dispatcher.notify(d.id,!1)});a(document,"mousedown",function(){Dispatcher.notify(e.id,!0)});a(document,"mouseup",function(){Dispatcher.notify(e.id,!1)});a(document,"mousemove",function(a){Dispatcher.notify(b.id,c(a))});return{position:b,x:Elm.Lift(function(a){return a[1]},[b]),y:Elm.Lift(function(a){return a[2]},[b]),isClicked:d,isDown:e,clickedOn:function(c){var b=Elm.Input(!1);a(c,"click",function(){Dispatcher.notify(b.id,
!0);Dispatcher.notify(b.id,!1)});return Value.Tuple(c,b)}}}(),e=function(){return{every:function(a){var a=1E3*a,c=Elm.Input(0),b=0;setInterval(function(){b+=a;Dispatcher.notify(c.id,b/1E3)},a);return c},after:function(a){var a=1E3*a,b=Elm.Input(!1);setTimeout(function(){Dispatcher.notify(b.id,!0)},a);return b},before:function(a){var a=1E3*a,b=Elm.Input(!0);setTimeout(function(){Dispatcher.notify(b.id,!1)},a);return b}}}(),d=function(){var b=Elm.Input(Value.Tuple(window.innerWidth,window.innerHeight));
a(window,"resize",function(){var a=document.getElementById("widthChecker").offsetWidth;Dispatcher.notify(b.id,Value.Tuple(a,window.innerHeight))});return{dimensions:b,width:Elm.Lift(function(a){return a[1]},[b]),height:Elm.Lift(function(a){return a[2]},[b])}}(),g=function(){var a=function(a){return function(c){var e=Elm.Input(["Waiting"]),d={};window.XMLHttpRequest?d=new XMLHttpRequest:window.ActiveXObject&&(d=new ActiveXObject("Microsoft.XMLHTTP"));d.onreadystatechange=function(){4===d.readyState&&
Dispatcher.notify(e.id,200===d.status?["Success",b(d.responseText)]:["Failure",d.status,b(d.statusText)])};d.open(a,String.toText(c),!0);d.send(null);return e}},c=function(a){return function(c){var d=Elm.Input(["Nothing"]),c=Elm.Lift(function(c){if("Just"!==c[0]){try{Dispatcher.notify(d.id,["Nothing"])}catch(e){}return[]}try{Dispatcher.notify(d.id,["Just",["Waiting"]])}catch(g){d.value=["Just",["Waiting"]]}var f={};window.XMLHttpRequest?f=new XMLHttpRequest:window.ActiveXObject&&(f=new ActiveXObject("Microsoft.XMLHTTP"));
f.onreadystatechange=function(){4===f.readyState&&Dispatcher.notify(d.id,["Just",200===f.status?["Success",b(f.responseText)]:["Failure",f.status,b(f.statusText)]])};f.open(a,String.toText(c[1]),!0);f.send(null);return[]},[c]);return Elm.Lift(function(a){return function(){return a}},[d,c])}};return{get:a("GET"),post:a("POST"),gets:c("GET"),posts:c("POST")}}(),f=function(){return{inRange:function(a){return function(c){return Elm.Input(Math.floor(Math.random()*(c-a+1))+a)}},randomize:function(a){return function(c){return function(b){return Elm.Lift(function(){return Math.floor(Math.random()*
(c-a+1))+a},[b])}}}}}(),j=function(){var c=function(c){c.isElmLeaf=!0;var d=Elm.Input(["Nil"]);a(c,"keyup",function(){Dispatcher.notify(d.id,b(c.value));c.focus()});return Value.Tuple(c,d)},d=function(a){a=document.createElement(a);a.id=Guid.guid();return a},e=function(c){for(var b=d("select"),e=[];"Cons"===c[0];){var f=d("option"),g=Text.toText(c[1][1]);f.value=g;f.innerHTML=g;b.appendChild(f);e.push(c[1][2]);c=c[2]}var h=Elm.Input(e[0]);a(b,"change",function(){Dispatcher.notify(h.id,e[b.selectedIndex])});
return Value.Tuple(b,h)};return{textArea:function(a){return function(b){var e=d("textarea");e.rows=b;e.cols=a;return c(e,"")}},textField:function(a){var b=d("input");b.type="text";return c(b,a)},password:function(a){var b=d("input");b.type="password";return c(b,a)},checkbox:function(c){var b=d("input");b.type="checkbox";b.checked=c;var e=Elm.Input(c);a(b,"change",function(){Dispatcher.notify(e.id,b.checked)});return Value.Tuple(b,e)},dropDown:e,stringDropDown:function(a){return e(List.map(function(a){return Value.Tuple(a,
a)})(a))},button:function(c){var b=d("input");b.type="button";b.value=Text.toText(c);var e=Elm.Input(!1);a(b,"click",function(){Dispatcher.notify(e.id,!0);Dispatcher.notify(e.id,!1)});return Value.Tuple(b,e)}}}();return{Mouse:c,Time:e,Window:d,HTTP:g,Random:f,Input:j}}(),List=function(){function b(a){return function(b){if("Nil"===b[0])return b;"Cons"!==b[0]&&i();for(var c=["Cons",a(b[1]),["Nil"]],d=c,b=b[2];"Cons"===b[0];)d[2]=["Cons",a(b[1]),["Nil"]],b=b[2],d=d[2];return c}}function a(a){return function(b){return function(c){var d=
b;if("Nil"===c[0])return d;for("Cons"!==c[0]&&i();"Cons"===c[0];)d=a(c[1])(d),c=c[2];return d}}}function c(a){return function(b){return function(c){var d=b;if("Nil"===c[0])return d;"Cons"!==c[0]&&i();for(var e=[];"Cons"===c[0];)e.push(c[1]),c=c[2];for(c=e.length;c--;)d=a(e[c])(d);return d}}}function e(c){return function(b){var d;"Cons"!==b[0]?d=void 0:(d=b[1],b=b[2],d=a(c)(d)(b));return d}}function d(a){return function(c){return function(b){if("Nil"===b[0])return["Cons",c,["Nil"]];"Cons"!==b[0]&&
i();for(var d=[c];"Cons"===b[0];)c=a(b[1])(c),d.push(c),b=b[2];for(var b=["Nil"],e=d.length;e--;)b=["Cons",d[e],b];return b}}}function g(a){return function(b){return function(){for(var c=[function(a){return"Nil"!==a[0]?void 0:["Tuple2",["Nil"],["Nil"]]},function(b){if("Cons"===b[0]){var c=b[1],b=b[2];var d=g(a)(b);"Tuple2"!==d[0]?c=void 0:(b=d[1],d=d[2],c=a(c)?["Tuple2",["Cons",c,b],d]:["Tuple2",b,["Cons",c,d]]);return c}}],d=c.length;d--;){var e=c[d](b);if(void 0!==e)return e}}()}}function f(a){return function(){for(var b=
[function(a){return"Nil"!==a[0]?void 0:["Tuple2",["Nil"],["Nil"]]},function(a){if("Cons"!==a[0])a=void 0;else if(a=["Tuple2",a[1],f(a[2])],"Tuple2"!==a[0]||"Tuple2"!==a[1][0])a=void 0;else var b=a[1][1],c=a[1][2],a="Tuple2"!==a[2][0]?void 0:["Tuple2",["Cons",b,a[2][1]],["Cons",c,a[2][2]]];return a}],c=b.length;c--;){var d=b[c](a);if(void 0!==d)return d}}()}function j(a){return function(b){return function(){for(var c=[function(a){return"Nil"!==a[0]?void 0:["Nil"]},function(a){if("Cons"===a[0]){var b=
a[1];return"Nil"!==a[2][0]?void 0:["Cons",b,["Nil"]]}},function(b){if("Cons"===b[0]){var c=b[1];if("Cons"===b[2][0]){var d=b[2][1],b=b[2][2];return["Cons",c,["Cons",a,j(a)(["Cons",d,b])]]}}}],d=c.length;d--;){var e=c[d](b);if(void 0!==e)return e}}()}}function h(a){return function(b){return function(){for(var c=[function(a){return"Nil"!==a[0]?void 0:["Nil"]},function(a){if("Cons"===a[0]){var b=a[1];return"Nil"!==a[2][0]?void 0:b}},function(b){if("Cons"===b[0]){var c=b[1];if("Cons"===b[2][0]){var d=
b[2][1],b=b[2][2];return Value.append(c,Value.append(a,h(a)(["Cons",d,b])))}}}],d=c.length;d--;){var e=c[d](b);if(void 0!==e)return e}}()}}var i=function(){throw"Function expecting a list!";},k=a(function(a){return function(b){return["Cons",a,b]}})(["Nil"]),l=c(function(a){return function(b){return Value.append(a,b)}})(["Nil"]),p=a(function(a){return function(b){return a&&b}})(!0),m=a(function(a){return function(b){return a||b}})(!1),n=a(function(a){return function(b){return a+b}})(0),o=a(function(a){return function(b){return a*
b}})(1),r=e(function(a){return function(b){return Math.max(a,b)}}),t=e(function(a){return function(b){return Math.min(a,b)}});return{head:function(a){if("Cons"!==a[0])throw"Error: 'head' only accepts lists of length greater than one.";return a[1]},tail:function(a){if("Cons"!==a[0])throw"Error: 'tail' only accepts lists of length greater than one.";return a[2]},map:b,foldl:a,foldr:c,foldl1:e,foldr1:function(a){return function(b){var d;"Cons"!==b[0]?d=void 0:(d=b[1],b=b[2],d=c(a)(d)(b));return d}},
scanl:d,scanl1:function(a){return function(b){if("Cons"!==b[0])throw"Error: 'scanl1' requires a list of at least length 1.";return d(a)(b[1])(b[2])}},filter:function(a){return function(b){if("Nil"===b[0])return b;"Cons"!==b[0]&&i();for(var c=[];"Cons"===b[0];)a(b[1])&&c.push(b[1]),b=b[2];for(var b=["Nil"],d=c.length;d--;)b=["Cons",c[d],b];return b}},length:function(a){for(var b=0;"Cons"===a[0];)b+=1,a=a[2];return b},reverse:k,concat:l,concatMap:function(a){return function(c){return l(b(a)(c))}},and:p,
or:m,forall:function(b){return a(function(a){return function(c){return c&&b(a)}})(!0)},exists:function(b){return a(function(a){return function(c){return c||b(a)}})(!1)},sum:n,product:o,maximum:r,minimum:t,partition:g,zipWith:function(a){return function(b){return function(c){if("Nil"===b[0]||"Nil"===c[0])return b;("Cons"!==b[0]||"Cons"!==c[0])&&i();for(var d=[];"Cons"===b[0]&&"Cons"===c[0];)d.push(a(b[1])(c[1])),b=b[2],c=c[2];for(var c=["Nil"],e=d.length;e--;)c=["Cons",d[e],c];return c}}},zip:function(a){return function(b){if("Nil"===
a[0]||"Nil"===b[0])return a;("Cons"!==a[0]||"Cons"!==b[0])&&i();for(var c=[];"Cons"===a[0]&&"Cons"===b[0];)c.push(["Tuple2",a[1],b[1]]),a=a[2],b=b[2];for(var b=["Nil"],d=c.length;d--;)b=["Cons",c[d],b];return b}},unzip:f,intersperse:j,intercalate:h,sort:function(a){if("Nil"===a[0])return a;"Cons"!==a[0]&&i();for(var b=[];"Cons"===a[0];)b.push(a[1]),a=a[2];b.sort(function(a,b){return a-b});for(var a=["Nil"],c=b.length;c--;)a=["Cons",b[c],a];return a}}}(),id=function(b){return b},not=function(b){return!b},
sqrt=function(b){return Math.sqrt(b)},rem=function(b){return function(a){return b%a}},mod=function(b){return function(a){var c=b%a,c=0==b?0:0<a?0<=b?c:c+a:-mod(-b)(-a);return c==a?0:c}},abs=function(b){return Math.abs(b)},logBase=function(b){return function(a){return Math.log(a)/Math.log(b)}},min=function(b){return function(a){return Math.min(b,a)}},max=function(b){return function(a){return Math.max(b,a)}},clamp=function(b){return function(a){return function(c){return Math.min(a,Math.max(b,c))}}},
sin=Math.sin,cos=Math.cos,tan=Math.tan,asin=Math.asin,acos=Math.acos,atan=Math.atan,flip=function(b){return function(a){return function(c){return b(c)(a)}}},Just=function(b){return["Just",b]},Nothing=["Nothing"];function constant(b){return Elm.Input(b)}function lift(b){return function(a){return Elm.Lift(b,[a])}}function lift2(b){return function(a){return function(c){return Elm.Lift(b,[a,c])}}}
function lift3(b){return function(a){return function(c){return function(e){return Elm.Lift(b,[a,c,e])}}}}function lift4(b){return function(a){return function(c){return function(e){return function(d){return Elm.Lift(b,[a,c,e,d])}}}}}function foldp(b){return function(a){return function(c){return Elm.Fold(b,a,c)}}}var includeGlobal=this;
(function(){var b=function(a){for(var b in a)if("Internal"!==b)try{includeGlobal[b]=a[b]}catch(d){"length"===b&&(includeGlobal.execScript("var length;"),length=a[b])}},a=function(a){return function(b){includeGlobal[a]=includeGlobal[a]||{};for(var d in b)"Internal"!==d&&(includeGlobal[a][d]=b[d])}};b(Element);b(Text);color=Element.color;height=Element.height;show=Value.show;a("Time")(Signal.Time);a("Mouse")(Signal.Mouse);a("Window")(Signal.Window);a("HTTP")(Signal.HTTP);a("Input")(Signal.Input);a("Random")(Signal.Random);
b(Color);b(Shape);b(Line)})();