Scenery Debug Snapshot'+this.getDebugHTML()+"";window.open("data:text/html;charset=utf-8,"+encodeURIComponent(t))},toStringWithChildren:function(t,e){function i(t){return t===n?e:(t.constructor.name?t.constructor.name.toLowerCase():"(node)")+t.id}e=e||"scene";var n=this._rootNode,r="",s=this._rootNode.getTopologicallySortedNodes().slice(0).reverse();return _.each(s,function(s){if(r&&(r+="\n"),t&&s===n){var o=n.getPropString(" ",!1),a=o?"\n"+o+"\n":""; ""!==a?r+=e+".mutate( {"+a+"} )":r=r.slice(0,-1)}else r+="var "+i(s)+" = "+s.toString("",!1);_.each(s.children,function(t){r+="\n"+i(s)+".addChild( "+i(t)+" );"})}),r},foreignObjectRasterization:function(t){function e(t){if(t.blocks)_.each(t.blocks,function(t){e(t)});else if(t.firstDrawable&&t.lastDrawable){for(var n=t.firstDrawable;n!==t.lastDrawable;n=n.nextDrawable)e(n);e(t.lastDrawable),t.domElement&&t.domElement instanceof window.HTMLCanvasElement&&(i[t.canvasId]=t.domElement.toDataURL())}}var i={};e(this._rootBackbone);var n=document.createElement("canvas"),r=n.getContext("2d");n.width=this.width,n.height=this.height;var s=document.implementation.createHTMLDocument("");s.documentElement.innerHTML=this.domElement.outerHTML,s.documentElement.setAttribute("xmlns",s.documentElement.namespaceURI);var o=s.documentElement.getElementsByTagName("canvas");o=Array.prototype.slice.call(o);for(var a=0;a
'+d+"
",f=new Image;f.onload=function(){r.drawImage(f,0,0),t(n.toDataURL())},f.onerror=function(){t(null)},f.src="data:image/svg+xml;base64,"+window.btoa(m)},popupRasterization:function(){this.foreignObjectRasterization(window.open)}},s.prototype)),e.customCursors={"scenery-grab-pointer":["grab","-moz-grab","-webkit-grab","pointer"],"scenery-grabbing-pointer":["grabbing","-moz-grabbing","-webkit-grabbing","pointer"]},o.addProperty(e,"focus",null),e.userGestureEmitter=new n,e}),i("SCENERY/accessibility/AccessiblePeer",["require","PHET_CORE/inherit","PHET_CORE/Poolable","AXON/Events","SCENERY/scenery","SCENERY/display/Display"],function(t){"use strict";function e(t,e,i){this.initializeAccessiblePeer(t,e,i)}var i=t("PHET_CORE/inherit"),n=t("PHET_CORE/Poolable"),r=t("AXON/Events"),s=t("SCENERY/scenery"),o=t("SCENERY/display/Display"),a=1;return s.register("AccessiblePeer",e),i(r,e,{initializeAccessiblePeer:function(t,e,i){var n=this;return r.call(this),this.id=this.id||a++,this.accessibleInstance=t,this.display=t.display,this.trail=t.trail,this.domElement=e,this.containerDOMElement=i?i:this.containerDOMElement||null,this.disposed=!1,n.focusEventListener=function(e){e.target===n.domElement&&(o.focus={display:t.display,trail:t.trail})},this.domElement.addEventListener("focus",n.focusEventListener),n.blurEventListener=function(t){t.target===n.domElement&&(o.focus=null)},this.domElement.addEventListener("blur",n.blurEventListener),this},getChildContainerElement:function(){return this.containerDOMElement||this.domElement},dispose:function(){this.disposed=!0,this.domElement.removeEventListener("blur",this.blurEventListener),this.domElement.removeEventListener("focus",this.focusEventListener),this.freeToPool&&this.freeToPool()}}),e.Poolable={mixin:function(t){n.mixin(t,{defaultFactory:function(){return new t},constructorDuplicateFactory:function(e){return function(i){return e.length?e.pop().initialize(i):new t(i)}}})}},e}),i("SCENERY/input/DownUpListener",["require","PHET_CORE/inherit","SCENERY/scenery","SCENERY/util/Trail","SCENERY/input/Input"],function(t){"use strict";function e(t){var e=this;t=_.extend({mouseButton:0},t),this.options=t,this.isDown=!1,this.downCurrentTarget=null,this.downTrail=null,this.pointer=null,this.downListener={up:function(t){t.pointer.isMouse&&t.domEvent.button!==e.options.mouseButton||e.buttonUp(t)},cancel:function(t){e.buttonUp(t)},keyup:function(t){var i=t.domEvent.keyCode;(i===r.KEY_ENTER||i===r.KEY_SPACE)&&e.buttonUp(t)}}}var i=t("PHET_CORE/inherit"),n=t("SCENERY/scenery");t("SCENERY/util/Trail");var r=t("SCENERY/input/Input");return n.register("DownUpListener",e),i(Object,e,{buttonDown:function(t){this.isDown||t.pointer.isMouse&&t.domEvent.button!==this.options.mouseButton||(t.pointer.addInputListener(this.downListener),this.isDown=!0,this.downCurrentTarget=t.currentTarget,this.downTrail=t.trail.subtrailTo(t.currentTarget,!1),this.pointer=t.pointer,this.options.down&&this.options.down(t,this.downTrail))},buttonUp:function(t){this.isDown=!1,this.pointer.removeInputListener(this.downListener);var e=t.currentTarget;if(t.currentTarget=this.downCurrentTarget,this.options.upInside||this.options.upOutside){var i=t.trail,n=i.isExtensionOf(this.downTrail,!0);n&&this.options.upInside?this.options.upInside(t,this.downTrail):!n&&this.options.upOutside&&this.options.upOutside(t,this.downTrail)}this.options.up&&this.options.up(t,this.downTrail),t.currentTarget=e},down:function(t){this.buttonDown(t)},keydown:function(t){var e=t.domEvent.keyCode;(e===r.KEY_ENTER||e===r.KEY_SPACE)&&this.buttonDown(t)}}),e}),i("SCENERY/input/ButtonListener",["require","SCENERY/scenery","SCENERY/util/Trail","PHET_CORE/inherit","SCENERY/input/DownUpListener"],function(t){"use strict";function e(t){var e=this;this.buttonState="up",this._overCount=0,this._buttonOptions=t;var i=this;r.call(this,{mouseButton:t.mouseButton||0,down:function(t,n){t.pointer.isKey&&e.enter(t),i.setButtonState(t,"down")},up:function(t,n){i.setButtonState(t,i._overCount>0?"over":"up"),t.pointer.isKey&&e.exit(t)}})}var i=t("SCENERY/scenery");t("SCENERY/util/Trail");var n=t("PHET_CORE/inherit"),r=t("SCENERY/input/DownUpListener");return i.register("ButtonListener",e),n(r,e,{setButtonState:function(t,e){if(e!==this.buttonState){var i=this.buttonState;this.buttonState=e,this._buttonOptions[e]&&this._buttonOptions[e](t,i),this._buttonOptions.fire&&this._overCount>0&&(this._buttonOptions.fireOnDown?"down"===e:"down"===i)&&this._buttonOptions.fire(t)}},enter:function(t){this._overCount++,1===this._overCount&&this.setButtonState(t,this.isDown?"down":"over")},exit:function(t){this._overCount--,0===this._overCount&&this.setButtonState(t,this.isDown?"out":"up")}}),e}),i("SUN/sun",["require","PHET_CORE/Namespace"],function(t){"use strict";var e=t("PHET_CORE/Namespace");return new e("sun")}),i("SUN/FontAwesomeNode",["require","PHET_CORE/inherit","DOT/Matrix3","SCENERY/nodes/Path","KITE/Shape","SUN/sun"],function(t){"use strict";function e(t,e){e=_.extend({fill:"#000",pickable:!1},e),r.call(this,h(t),e)}var i=t("PHET_CORE/inherit"),n=t("DOT/Matrix3"),r=t("SCENERY/nodes/Path"),s=t("KITE/Shape"),o=t("SUN/sun"),a={camera:"M960 864q119 0 203.5 -84.5t84.5 -203.5t-84.5 -203.5t-203.5 -84.5t-203.5 84.5t-84.5 203.5t84.5 203.5t203.5 84.5zM1664 1280q106 0 181 -75t75 -181v-896q0 -106 -75 -181t-181 -75h-1408q-106 0 -181 75t-75 181v896q0 106 75 181t181 75h224l51 136 q19 49 69.5 84.5t103.5 35.5h512q53 0 103.5 -35.5t69.5 -84.5l51 -136h224zM960 128q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z",fullscreen:"M1283 995l-355 -355l355 -355l144 144q29 31 70 14q39 -17 39 -59v-448q0 -26 -19 -45t-45 -19h-448q-42 0 -59 40q-17 39 14 69l144 144l-355 355l-355 -355l144 -144q31 -30 14 -69q-17 -40 -59 -40h-448q-26 0 -45 19t-19 45v448q0 42 40 59q39 17 69 -14l144 -144 l355 355l-355 355l-144 -144q-19 -19 -45 -19q-12 0 -24 5q-40 17 -40 59v448q0 26 19 45t45 19h448q42 0 59 -40q17 -39 -14 -69l-144 -144l355 -355l355 355l-144 144q-31 30 -14 69q17 40 59 40h448q26 0 45 -19t19 -45v-448q0 -42 -39 -59q-13 -5 -25 -5q-26 0 -45 19z",reorder:"M1536 192v-128q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1536 704v-128q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1536 1216v-128q0 -26 -19 -45 t-45 -19h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45z",home:"M1408 544v-480q0 -26 -19 -45t-45 -19h-384v384h-256v-384h-384q-26 0 -45 19t-19 45v480q0 1 0.5 3t0.5 3l575 474l575 -474q1 -2 1 -6zM1631 613l-62 -74q-8 -9 -21 -11h-3q-13 0 -21 7l-692 577l-692 -577q-12 -8 -24 -7q-13 2 -21 11l-62 74q-8 10 -7 23.5t11 21.5 l719 599q32 26 76 26t76 -26l244 -204v195q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-408l219 -182q10 -8 11 -21.5t-7 -23.5z",volume_off:"M768 1184v-1088q0 -26 -19 -45t-45 -19t-45 19l-333 333h-262q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h262l333 333q19 19 45 19t45 -19t19 -45z",volume_up:"M768 1184v-1088q0 -26 -19 -45t-45 -19t-45 19l-333 333h-262q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h262l333 333q19 19 45 19t45 -19t19 -45zM1152 640q0 -76 -42.5 -141.5t-112.5 -93.5q-10 -5 -25 -5q-26 0 -45 18.5t-19 45.5q0 21 12 35.5t29 25t34 23t29 35.5 t12 57t-12 57t-29 35.5t-34 23t-29 25t-12 35.5q0 27 19 45.5t45 18.5q15 0 25 -5q70 -27 112.5 -93t42.5 -142zM1408 640q0 -153 -85 -282.5t-225 -188.5q-13 -5 -25 -5q-27 0 -46 19t-19 45q0 39 39 59q56 29 76 44q74 54 115.5 135.5t41.5 173.5t-41.5 173.5 t-115.5 135.5q-20 15 -76 44q-39 20 -39 59q0 26 19 45t45 19q13 0 26 -5q140 -59 225 -188.5t85 -282.5zM1664 640q0 -230 -127 -422.5t-338 -283.5q-13 -5 -26 -5q-26 0 -45 19t-19 45q0 36 39 59q7 4 22.5 10.5t22.5 10.5q46 25 82 51q123 91 192 227t69 289t-69 289 t-192 227q-36 26 -82 51q-7 4 -22.5 10.5t-22.5 10.5q-39 23 -39 59q0 26 19 45t45 19q13 0 26 -5q211 -91 338 -283.5t127 -422.5z",check:"M1408 606v-318q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832q63 0 117 -25q15 -7 18 -23q3 -17 -9 -29l-49 -49q-10 -10 -23 -10q-3 0 -9 2q-23 6 -45 6h-832q-66 0 -113 -47t-47 -113v-832 q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v254q0 13 9 22l64 64q10 10 23 10q6 0 12 -3q20 -8 20 -29zM1639 1095l-814 -814q-24 -24 -57 -24t-57 24l-430 430q-24 24 -24 57t24 57l110 110q24 24 57 24t57 -24l263 -263l647 647q24 24 57 24t57 -24l110 -110 q24 -24 24 -57t-24 -57z",check_empty:"M1120 1280h-832q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v832q0 66 -47 113t-113 47zM1408 1120v-832q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832 q119 0 203.5 -84.5t84.5 -203.5z",undo:"M1536 640q0 -156 -61 -298t-164 -245t-245 -164t-298 -61q-179 0 -336.5 76t-266 213t-147.5 312q-3 14 7 27q9 12 25 12h199q23 0 30 -23q50 -162 185 -261.5t304 -99.5q104 0 198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5t-40.5 198.5t-109.5 163.5t-163.5 109.5 t-198.5 40.5q-98 0 -188 -35.5t-160 -101.5l137 -138q31 -30 14 -69q-17 -40 -59 -40h-448q-26 0 -45 19t-19 45v448q0 42 40 59q39 17 69 -14l130 -129q107 101 244.5 156.5t284.5 55.5q156 0 298 -61t245 -164t164 -245t61 -298z",cut:"M960 640q26 0 45 -19t19 -45t-19 -45t-45 -19t-45 19t-19 45t19 45t45 19zM1260 576l507 -398q28 -20 25 -56q-5 -35 -35 -51l-128 -64q-13 -7 -29 -7q-17 0 -31 8l-690 387l-110 -66q-8 -4 -12 -5q14 -49 10 -97q-7 -77 -56 -147.5t-132 -123.5q-132 -84 -277 -84 q-136 0 -222 78q-90 84 -79 207q7 76 56 147t131 124q132 84 278 84q83 0 151 -31q9 13 22 22l122 73l-122 73q-13 9 -22 22q-68 -31 -151 -31q-146 0 -278 84q-82 53 -131 124t-56 147q-5 59 15.5 113t63.5 93q85 79 222 79q145 0 277 -84q83 -52 132 -123t56 -148 q4 -48 -10 -97q4 -1 12 -5l110 -66l690 387q14 8 31 8q16 0 29 -7l128 -64q30 -16 35 -51q3 -36 -25 -56zM579 836q46 42 21 108t-106 117q-92 59 -192 59q-74 0 -113 -36q-46 -42 -21 -108t106 -117q92 -59 192 -59q74 0 113 36zM494 91q81 51 106 117t-21 108 q-39 36 -113 36q-100 0 -192 -59q-81 -51 -106 -117t21 -108q39 -36 113 -36q100 0 192 59zM672 704l96 -58v11q0 36 33 56l14 8l-79 47l-26 -26q-3 -3 -10 -11t-12 -12q-2 -2 -4 -3.5t-3 -2.5zM896 480l96 -32l736 576l-128 64l-768 -431v-113l-160 -96l9 -8q2 -2 7 -6 q4 -4 11 -12t11 -12l26 -26zM1600 64l128 64l-520 408l-177 -138q-2 -3 -13 -7z",trash:"M512 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM768 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1024 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576 q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1152 76v948h-896v-948q0 -22 7 -40.5t14.5 -27t10.5 -8.5h832q3 0 10.5 8.5t14.5 27t7 40.5zM480 1152h448l-48 117q-7 9 -17 11h-317q-10 -2 -17 -11zM1408 1120v-64q0 -14 -9 -23t-23 -9h-96v-948q0 -83 -47 -143.5t-113 -60.5h-832 q-66 0 -113 58.5t-47 141.5v952h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h309l70 167q15 37 54 63t79 26h320q40 0 79 -26t54 -63l70 -167h309q14 0 23 -9t9 -23z",ban_circle:"M1280 640q0 139 -71 260l-701 -701q121 -71 260 -71q104 0 198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5zM327 380l701 701q-121 71 -260 71q-104 0 -198.5 -40.5t-163.5 -109.5t-109.5 -163.5t-40.5 -198.5q0 -139 71 -260zM1536 640q0 -209 -103 -385.5 t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z",times_circle:"M1149 414q0 26 -19 45l-181 181l181 181q19 19 19 45q0 27 -19 46l-90 90q-19 19 -46 19q-26 0 -45 -19l-181 -181l-181 181q-19 19 -45 19q-27 0 -46 -19l-90 -90q-19 -19 -19 -46q0 -26 19 -45l181 -181l-181 -181q-19 -19 -19 -45q0 -27 19 -46l90 -90q19 -19 46 -19 q26 0 45 19l181 181l181 -181q19 -19 45 -19q27 0 46 19l90 90q19 19 19 46zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z",eye_open:"M1664 576q-152 236 -381 353q61 -104 61 -225q0 -185 -131.5 -316.5t-316.5 -131.5t-316.5 131.5t-131.5 316.5q0 121 61 225q-229 -117 -381 -353q133 -205 333.5 -326.5t434.5 -121.5t434.5 121.5t333.5 326.5zM944 960q0 20 -14 34t-34 14q-125 0 -214.5 -89.5 t-89.5 -214.5q0 -20 14 -34t34 -14t34 14t14 34q0 86 61 147t147 61q20 0 34 14t14 34zM1792 576q0 -34 -20 -69q-140 -230 -376.5 -368.5t-499.5 -138.5t-499.5 139t-376.5 368q-20 35 -20 69t20 69q140 229 376.5 368t499.5 139t499.5 -139t376.5 -368q20 -35 20 -69z",eye_close:"M555 201l78 141q-87 63 -136 159t-49 203q0 121 61 225q-229 -117 -381 -353q167 -258 427 -375zM944 960q0 20 -14 34t-34 14q-125 0 -214.5 -89.5t-89.5 -214.5q0 -20 14 -34t34 -14t34 14t14 34q0 86 61 147t147 61q20 0 34 14t14 34zM1307 1151q0 -7 -1 -9 q-105 -188 -315 -566t-316 -567l-49 -89q-10 -16 -28 -16q-12 0 -134 70q-16 10 -16 28q0 12 44 87q-143 65 -263.5 173t-208.5 245q-20 31 -20 69t20 69q153 235 380 371t496 136q89 0 180 -17l54 97q10 16 28 16q5 0 18 -6t31 -15.5t33 -18.5t31.5 -18.5t19.5 -11.5 q16 -10 16 -27zM1344 704q0 -139 -79 -253.5t-209 -164.5l280 502q8 -45 8 -84zM1792 576q0 -35 -20 -69q-39 -64 -109 -145q-150 -172 -347.5 -267t-419.5 -95l74 132q212 18 392.5 137t301.5 307q-115 179 -282 294l63 112q95 -64 182.5 -153t144.5 -184q20 -34 20 -69z",warning_sign:"M1024 161v190q0 14 -9.5 23.5t-22.5 9.5h-192q-13 0 -22.5 -9.5t-9.5 -23.5v-190q0 -14 9.5 -23.5t22.5 -9.5h192q13 0 22.5 9.5t9.5 23.5zM1022 535l18 459q0 12 -10 19q-13 11 -24 11h-220q-11 0 -24 -11q-10 -7 -10 -21l17 -457q0 -10 10 -16.5t24 -6.5h185 q14 0 23.5 6.5t10.5 16.5zM1008 1469l768 -1408q35 -63 -2 -126q-17 -29 -46.5 -46t-63.5 -17h-1536q-34 0 -63.5 17t-46.5 46q-37 63 -2 126l768 1408q17 31 47 49t65 18t65 -18t47 -49z"};a.check_without_box="M1639 1095l-814 -814q-24 -24 -57 -24t-57 24l-430 430q-24 24 -24 57t24 57l110 110q24 24 57 24t57 -24l263 -263l647 647q24 24 57 24t57 -24l110 -110 q24 -24 24 -57t-24 -57z";var l=n.createFromPool(.025,0,0,0,-.025,0,0,0,1),h=function(t){return new s(a[t]).transformed(l)};return o.register("FontAwesomeNode",e),i(r,e)}),i("PHET_CORE/escapeHTML",["require","PHET_CORE/phetCore"],function(t){"use strict";function e(t){return t.replace(/&/g,"&").replace(//g,">").replace(/\"/g,""").replace(/\'/g,"'").replace(/\//g,"/")}var i=t("PHET_CORE/phetCore");return i.register("escapeHTML",e),e}),i("SCENERY/util/Font",["require","PHET_CORE/inherit","SCENERY/scenery"],function(t){"use strict";function e(t){return"number"==typeof t?t+"px":t}function i(t){this._style="normal",this._variant="normal",this._weight="normal",this._stretch="normal",this._size="10px",this._lineHeight="normal",this._family="sans-serif";var i=typeof t;if("string"===i)for(var n=_.filter(t.split(/[\x09\x0A\x0C\x0D\x20]/),function(t){return t.length>0}),r=0;rn;n++)this._drawables[n].markDirtyText();this.invalidateText(),this.trigger2("text",e,t)}return this},getText:function(){return this._text},getRenderedText:function(){return null===this._cachedRenderedText&&(this._cachedRenderedText=this._text.replace(" "," "),a.edge&&(this._cachedRenderedText=e.simplifyEmbeddingMarks(this._cachedRenderedText))),this._cachedRenderedText},get renderedText(){return this.getRenderedText()},setBoundsMethod:function(t){if(t!==this._boundsMethod){this._boundsMethod=t,this.updateTextFlags();for(var e=this._drawables.length,i=0;e>i;i++)this._drawables[i].markDirtyBounds();this.invalidateText(),this.trigger0("boundsMethod"),this.trigger0("selfBoundsValid")}return this},getBoundsMethod:function(){return this._boundsMethod},getTextRendererBitmask:function(){var t=0;return"fast"===this._boundsMethod||this._isHTML||(t|=d.bitmaskCanvas),this._isHTML||(t|=d.bitmaskSVG),t|=d.bitmaskDOM},invalidateSupportedRenderers:function(){this.setRendererBitmask(this.getFillRendererBitmask()&this.getStrokeRendererBitmask()&this.getTextRendererBitmask())},updateTextFlags:function(){this.invalidateSupportedRenderers()},invalidateText:function(){this.invalidateSelf();for(var t=this._drawables.length,e=0;t>e;e++)this._drawables[e].markDirtyBounds();this.updateTextFlags()},updateSelfBounds:function(){var t;t=this._isHTML||I&&"accurate"!==this._boundsMethod?this.approximateDOMBounds():"hybrid"===this._boundsMethod?this.approximateHybridBounds():"fast"===this._boundsMethod||"fastCanvas"===this._boundsMethod?this.approximateSVGBounds():this.accurateCanvasBounds(),this.hasStroke()&&t.dilate(this.getLineWidth()/2);var e=!t.equals(this._selfBounds);return e&&this._selfBounds.set(t),e},invalidateStroke:function(){this.invalidateText()},invalidateFill:function(){this.invalidateText()},canvasPaintSelf:function(t){e.TextCanvasDrawable.prototype.paintCanvas(t,this)},createDOMDrawable:function(t,i){return e.TextDOMDrawable.createFromPool(t,i)},createSVGDrawable:function(t,i){return e.TextSVGDrawable.createFromPool(t,i)},createCanvasDrawable:function(t,i){return e.TextCanvasDrawable.createFromPool(t,i)},createWebGLDrawable:function(t,i){return e.TextWebGLDrawable.createFromPool(t,i)},getDOMTextNode:function(){if(this._isHTML){var t=document.createElement("span");return t.innerHTML=this._text,t}return document.createTextNode(this.renderedText)},getVerticalBounds:function(){if(!f)return l.NOTHING;var t=this._font.toCSS(),e=D[t];return e||(f.setFont(this._font),e=D[t]=f.getBounds().copy()),e},accurateCanvasBounds:function(){var t=this,e=this.approximateSVGBounds();return this._text&&0!==e.width?u.Util.canvasAccurateBounds(function(e){if(e.font=t.font,e.direction=t.direction,e.fillText(t.renderedText,0,0),t.hasStroke()){var i=new u.CanvasContextWrapper(null,e);t.beforeCanvasStroke(i),e.strokeText(t.renderedText,0,0),t.afterCanvasStroke(i)}},{precision:.5,resolution:128,initialScale:32/Math.max(Math.abs(e.minX),Math.abs(e.minY),Math.abs(e.maxX),Math.abs(e.maxY))}):e},approximateCanvasWidth:function(){var t=u.scratchContext;return t.font=this.font,t.direction=this.direction,t.measureText(this.renderedText).width},approximateSVGBounds:function(){if(!R.parentNode){if(!document.body){if(N)return l.NOTHING;throw new Error("No document.body and trying to get approximate SVG bounds of a Text node")}document.body.appendChild(R)}r(T,this);var t=T.getBBox();return new l(t.x,t.y,t.x+t.width,t.y+t.height)},approximateHybridBounds:function(){var t=this.getVerticalBounds(),e=this.approximateCanvasWidth();return new l(0,t.minY,e,t.maxY)},approximateDOMBounds:function(){var t=1024,e="rtl"===this.direction,i=document.createElement("div");$(i).css({position:"absolute",left:0,top:0,padding:"0 !important",margin:"0 !important",display:"hidden"});var n=document.createElement("span");$(n).css("font",this.getFont()),n.appendChild(this.getDOMTextNode()),n.setAttribute("direction",this._direction);var r=document.createElement("div");$(r).css({"vertical-align":"baseline",display:"inline-block",width:0,height:t+"px",margin:"0 !important",padding:"0 !important"}),i.appendChild(n),i.appendChild(r),document.body.appendChild(i);var s=n.getBoundingClientRect(),o=i.getBoundingClientRect(),a=new l(s.left,s.top-t,s.right+1,s.bottom-t).shifted(-o.left,-o.top);document.body.removeChild(i);var h=s.right-s.left;return a.shiftedX(e?-h:0)},approximateImprovedDOMBounds:function(){var t=document.createElement("div");t.style.display="inline-block",t.style.font=this.getFont(),t.style.color="transparent",t.style.padding="0 !important",t.style.margin="0 !important",t.style.position="absolute",t.style.left="0",t.style.top="0",t.setAttribute("direction",this._direction),t.appendChild(this.getDOMTextNode()),document.body.appendChild(t);var e=new l(t.offsetLeft,t.offsetTop,t.offsetLeft+t.offsetWidth+1,t.offsetTop+t.offsetHeight+1);document.body.removeChild(t);var i=this.getVerticalBounds();return e.shiftedY(i.minY)},getSafeSelfBounds:function(){var t=1,e=this.getSelfBounds();return e.dilatedXY(t*e.width,t*e.height)},setFont:function(t){if(this.font!==t){this._font=t instanceof u.Font?t:new u.Font(t);for(var e=this._drawables.length,i=0;e>i;i++)this._drawables[i].markDirtyFont();this.invalidateText()}return this},getFont:function(){return this._font.getFont()},setDirection:function(t){this._direction=t;for(var e=this._drawables.length,i=0;e>i;i++)this._drawables[i].markDirtyDirection();return this.invalidateText(),this},getDirection:function(){return this._direction},isPainted:function(){return!0},areSelfBoundsValid:function(){return"accurate"===this._boundsMethod},getDebugHTMLExtras:function(){return' "'+o(this.renderedText)+'"'+(this._isHTML?" (html)":"")},getBasicConstructor:function(t){return"new scenery.Text( '"+o(this._text.replace(/'/g,"\\'"))+"', {"+t+"} )"},getPropString:function(t,e){function i(e,i,r){n&&(n+=",\n"),n+=r||"string"!=typeof i?t+e+": "+i:t+e+": '"+i+"'"}var n=c.prototype.getPropString.call(this,t,e);return n=this.appendFillablePropString(t,n),n=this.appendStrokablePropString(t,n),this.font!==(new u.Font).getFont()&&i("font",this.font.replace(/'/g,"\\'")),"ltr"!==this._direction&&i("direction",this._direction),n}}),i("fontWeight","FontWeight","weight"),i("fontFamily","FontFamily","family"),i("fontStretch","FontStretch","stretch"),i("fontStyle","FontStyle","style"),i("fontSize","FontSize","size"),i("lineHeight","LineHeight","lineHeight"),e.prototype._mutatorKeys=["boundsMethod","text","font","fontWeight","fontFamily","fontStretch","fontStyle","fontSize","lineHeight","direction"].concat(c.prototype._mutatorKeys),Object.defineProperty(e.prototype,"font",{set:e.prototype.setFont,get:e.prototype.getFont}),Object.defineProperty(e.prototype,"text",{set:e.prototype.setText,get:e.prototype.getText}),Object.defineProperty(e.prototype,"direction",{set:e.prototype.setDirection,get:e.prototype.getDirection}),Object.defineProperty(e.prototype,"boundsMethod",{set:e.prototype.setBoundsMethod,get:e.prototype.getBoundsMethod}),m.mixin(e);var B="‪",x="‫",O="‬";e.embeddedDebugString=function(t){return t.replace(/\u202a/g,"[LTR]").replace(/\u202b/g,"[RTL]").replace(/\u202c/g,"[POP]")},e.simplifyEmbeddingMarks=function(t){function e(t){for(var e=t.children.length-1;e>=0;e--){var i=t.children[e];t.dir===i.dir&&Array.prototype.splice.apply(t.children,[e,1].concat(i.children))}}function i(t){1===t.children.length&&t.children[0].dir&&(t.dir=t.children[0].dir,t.children=t.children[0].children)}function n(t){for(var e=t.children.length-1;e>=1;e--){var i=t.children[e-1],r=t.children[e];r.dir&&i.dir===r.dir&&(i.children=i.children.concat(r.children),t.children.splice(e,1),n(i))}}function r(t){if("string"!=typeof t){for(var s=0;si;i++){var n=this._drawables[i];n[o]()}this.invalidateLine()}return this},Object.defineProperty(e.prototype,i,{set:e.prototype[r],get:e.prototype[n]})}var n=t("PHET_CORE/inherit"),r=t("SCENERY/scenery"),s=t("KITE/segments/Line"),o=t("SCENERY/nodes/Path"),a=t("KITE/Shape"),l=t("DOT/Bounds2"),h=t("DOT/Vector2"),u=t("SCENERY/nodes/Paintable"),c=t("SCENERY/display/SVGSelfDrawable"),d=t("SCENERY/display/CanvasSelfDrawable"),m=t("SCENERY/display/SelfDrawable"),f=t("SCENERY/display/Renderer"),p=!0;return r.register("Line",e),n(o,e,{setLine:function(t,e,i,n){this._x1=t,this._y1=e,this._x2=i,this._y2=n;for(var r=this._drawables.length,s=0;r>s;s++){var o=this._drawables[s];o.markDirtyLine()}this.invalidateLine()},setPoint1:function(t,e){"number"==typeof t?(this._x1=t,this._y1=e):(this._x1=t.x,this._y1=t.y);for(var i=this._drawables.length,n=0;i>n;n++){var r=this._drawables[n];r.markDirtyP1()}this.invalidateLine()},set p1(t){this.setPoint1(t)},get p1(){return new h(this._x1,this._y1)},setPoint2:function(t,e){"number"==typeof t?(this._x2=t,this._y2=e):(this._x2=t.x,this._y2=t.y);for(var i=this._drawables.length,n=0;i>n;n++){var r=this._drawables[n];r.markDirtyP2()}this.invalidateLine()},set p2(t){this.setPoint2(t)},get p2(){return new h(this._x2,this._y2)},createLineShape:function(){return a.lineSegment(this._x1,this._y1,this._x2,this._y2)},invalidateLine:function(){this._shape=null,this.invalidatePath()},containsPointSelf:function(t){return this._strokePickable?o.prototype.containsPointSelf.call(this,t):!1},intersectsBoundsSelf:function(t){return new s(this.p1,this.p2).intersectsBounds(t)},canvasPaintSelf:function(t){e.LineCanvasDrawable.prototype.paintCanvas(t,this)},computeShapeBounds:function(){if(this._stroke){var t=this.getLineCap(),e=this.getLineWidth()/2;if("round"===t)return new l(Math.min(this._x1,this._x2)-e,Math.min(this._y1,this._y2)-e,Math.max(this._x1,this._x2)+e,Math.max(this._y1,this._y2)+e);var i=this._x2-this._x1,n=this._y2-this._y1,r=Math.sqrt(i*i+n*n);if(0===r)return new l(this._x1-e,this._y1-e,this._x2+e,this._y2+e);var s=e*i/r,o=e*n/r,a=l.NOTHING.copy();return"butt"===t?(a.addCoordinates(this._x1-o,this._y1+s),a.addCoordinates(this._x1+o,this._y1-s),a.addCoordinates(this._x2-o,this._y2+s),a.addCoordinates(this._x2+o,this._y2-s)):(a.addCoordinates(this._x1-s-o,this._y1-o+s),a.addCoordinates(this._x1-s+o,this._y1-o-s),a.addCoordinates(this._x2+s-o,this._y2+o+s),a.addCoordinates(this._x2+s+o,this._y2+o-s)),a}var h=l.NOTHING.copy();return h.addCoordinates(this._x1,this._y1),h.addCoordinates(this._x2,this._y2),h},createSVGDrawable:function(t,i){return e.LineSVGDrawable.createFromPool(t,i)},createCanvasDrawable:function(t,i){return e.LineCanvasDrawable.createFromPool(t,i)},createWebGLDrawable:function(t,i){return e.LineWebGLDrawable.createFromPool(t,i)},getBasicConstructor:function(t){return"new scenery.Line( "+this._x1+", "+this._y1+", "+this._x1+", "+this._y1+", {"+t+"} )"},setShape:function(t){if(null!==t)throw new Error("Cannot set the shape of a scenery.Line to something non-null");this.invalidatePath()},getShape:function(){return this._shape||(this._shape=this.createLineShape()),this._shape},hasShape:function(){return!0},getFillRendererBitmask:function(){return f.bitmaskCanvas|f.bitmaskSVG|f.bitmaskDOM}}),i("X1"),i("Y1"),i("X2"),i("Y2"),e.prototype._mutatorKeys=["p1","p2","x1","y1","x2","y2"].concat(o.prototype._mutatorKeys),e.LineStatefulDrawable={mixin:function(t){var e=t.prototype;e.initializeState=function(t,e){return this.paintDirty=!0,this.dirtyX1=!0,this.dirtyY1=!0,this.dirtyX2=!0,this.dirtyY2=!0,this.initializePaintableState(t,e),this},e.disposeState=function(){this.disposePaintableState()},e.markPaintDirty=function(){this.paintDirty=!0,this.markDirty()},e.markDirtyLine=function(){this.dirtyX1=!0,this.dirtyY1=!0,this.dirtyX2=!0,this.dirtyY2=!0,this.markPaintDirty()},e.markDirtyP1=function(){this.dirtyX1=!0,this.dirtyY1=!0,this.markPaintDirty()},e.markDirtyP2=function(){this.dirtyX2=!0,this.dirtyY2=!0,this.markPaintDirty()},e.markDirtyX1=function(){this.dirtyX1=!0,this.markPaintDirty()},e.markDirtyY1=function(){this.dirtyY1=!0,this.markPaintDirty()},e.markDirtyX2=function(){this.dirtyX2=!0,this.markPaintDirty()},e.markDirtyY2=function(){this.dirtyY2=!0,this.markPaintDirty()},e.setToCleanState=function(){this.paintDirty=!1,this.dirtyX1=!1,this.dirtyY1=!1,this.dirtyX2=!1,this.dirtyY2=!1},u.PaintableStatefulDrawable.mixin(t)}},e.LineStatelessDrawable={mixin:function(t){var e=t.prototype;e.initializeLineStateless=function(){return this.paintDirty=!0,this},e.markPaintDirty=function(){this.paintDirty=!0,this.markDirty()},e.markDirtyLine=function(){this.markPaintDirty()},e.markDirtyP1=function(){this.markPaintDirty()},e.markDirtyP2=function(){this.markPaintDirty()},e.markDirtyX1=function(){this.markPaintDirty()},e.markDirtyY1=function(){this.markPaintDirty()},e.markDirtyX2=function(){this.markPaintDirty()},e.markDirtyY2=function(){this.markPaintDirty()},u.PaintableStatefulDrawable.mixin(t)}},e.LineSVGDrawable=function(t,e){this.initialize(t,e)},n(c,e.LineSVGDrawable,{initialize:function(t,e){return this.initializeSVGSelfDrawable(t,e,!0,p),this.svgElement||(this.svgElement=document.createElementNS(r.svgns,"line")),this},updateSVGSelf:function(){var t=this.svgElement;this.dirtyX1&&t.setAttribute("x1",this.node._x1),this.dirtyY1&&t.setAttribute("y1",this.node._y1),this.dirtyX2&&t.setAttribute("x2",this.node._x2),this.dirtyY2&&t.setAttribute("y2",this.node._y2),this.updateFillStrokeStyle(t)}}),e.LineStatefulDrawable.mixin(e.LineSVGDrawable),m.Poolable.mixin(e.LineSVGDrawable),e.LineCanvasDrawable=function(t,e){this.initialize(t,e)},n(d,e.LineCanvasDrawable,{initialize:function(t,e){return this.initializeCanvasSelfDrawable(t,e),this.initializePaintableStateless(t,e),this},paintCanvas:function(t,e){var i=t.context;i.beginPath(),i.moveTo(e._x1,e._y1),i.lineTo(e._x2,e._y2),e._stroke&&(e.beforeCanvasStroke(t),i.stroke(),e.afterCanvasStroke(t))},markDirtyLine:function(){this.markPaintDirty()},markDirtyP1:function(){this.markPaintDirty()},markDirtyP2:function(){this.markPaintDirty()},markDirtyX1:function(){this.markPaintDirty()},markDirtyY1:function(){this.markPaintDirty()},markDirtyX2:function(){this.markPaintDirty()},markDirtyY2:function(){this.markPaintDirty()},dispose:function(){d.prototype.dispose.call(this),this.disposePaintableStateless()}}),u.PaintableStatelessDrawable.mixin(e.LineCanvasDrawable),m.Poolable.mixin(e.LineCanvasDrawable),e}),i("SCENERY/util/Paint",["require","SCENERY/util/Color","PHET_CORE/inherit","SCENERY/scenery"],function(t){"use strict";function e(){this.id="paint"+r++,this.transformMatrix=null}t("SCENERY/util/Color");var i=t("PHET_CORE/inherit"),n=t("SCENERY/scenery"),r=1;return n.register("Paint",e),i(Object,e,{isPaint:!0,setTransformMatrix:function(t){return this.transformMatrix!==t&&(this.transformMatrix=t),this}}),e}),i("SCENERY/util/Gradient",["require","SCENERY/util/Color","PHET_CORE/inherit","SCENERY/scenery","SCENERY/util/Paint","SCENERY/util/Color"],function(t){"use strict";function e(t){r.call(this),this.stops=[],this.lastStopRatio=0,this.canvasGradient=t}t("SCENERY/util/Color");var i=t("PHET_CORE/inherit"),n=t("SCENERY/scenery"),r=t("SCENERY/util/Paint");t("SCENERY/util/Color");return n.register("Gradient",e),i(r,e,{isGradient:!0,addColorStop:function(t,e){if(this.lastStopRatio>t)throw new Error("Color stops not specified in the order of increasing ratios");return this.lastStopRatio=t,"string"==typeof e&&(e=new n.Color(e)),this.stops.push({ratio:t,color:e}),this.canvasGradient.addColorStop(t,e.toCSS()),this},getCanvasStyle:function(){return this.canvasGradient}}),e}),i("SCENERY/util/LinearGradient",["require","SCENERY/scenery","PHET_CORE/inherit","DOT/Vector2","SCENERY/util/Gradient"],function(t){"use strict";function e(t,e,n,o){var a=void 0===o;this.start=a?t:new r(t,e),this.end=a?e:new r(n,o),s.call(this,i.scratchContext.createLinearGradient(t,e,n,o))}var i=t("SCENERY/scenery"),n=t("PHET_CORE/inherit"),r=t("DOT/Vector2"),s=t("SCENERY/util/Gradient");return i.register("LinearGradient",e),n(s,e,{isLinearGradient:!0,getSVGDefinition:function(){var t=document.createElementNS(i.svgns,"linearGradient");return t.setAttribute("gradientUnits","userSpaceOnUse"),t.setAttribute("x1",this.start.x),t.setAttribute("y1",this.start.y),t.setAttribute("x2",this.end.x),t.setAttribute("y2",this.end.y),this.transformMatrix&&t.setAttribute("gradientTransform",this.transformMatrix.getSVGTransform()),_.each(this.stops,function(e){var n=document.createElementNS(i.svgns,"stop");n.setAttribute("offset",e.ratio),n.setAttribute("style","stop-color: "+e.color.withAlpha(1).toCSS()+"; stop-opacity: "+e.color.a.toFixed(20)+";"),t.appendChild(n)}),t},toString:function(){var t="new scenery.LinearGradient( "+this.start.x+", "+this.start.y+", "+this.end.x+", "+this.end.y+" )";return _.each(this.stops,function(e){t+=".addColorStop( "+e.ratio+", '"+(e.color.toCSS?e.color.toCSS():e.color.toString())+"' )"}),t}}),e}),i("SCENERY/input/SimpleDragHandler",["require","PHET_CORE/inherit","SCENERY/scenery"],function(t){"use strict";function e(t){var e=this;t=_.extend({allowTouchSnag:!1,mouseButton:0,dragCursor:"pointer"},t),this.options=t,this.dragging=!1,this.pointer=null,this.trail=null,this.transform=null,this.node=null,this.lastDragPoint=null,this.startTransformMatrix=null,this.mouseButton=void 0,this.transformListener={transform:function(t){if(e.trail.isExtensionOf(t.trail,!0)){var i=t.trail.getMatrix(),n=e.transform.getMatrix();e.node.prependMatrix(i.inverted().timesMatrix(n)),e.transform.setMatrix(i)}}},this.dragListener={up:function(t){if(!t.pointer.isMouse||t.domEvent.button===e.mouseButton){var i=t.currentTarget;t.currentTarget=e.node,e.endDrag(t),t.currentTarget=i}},cancel:function(t){var i=t.currentTarget;t.currentTarget=e.node,e.endDrag(t),t.currentTarget=i,e.transform||e.node.setMatrix(e.startTransformMatrix)},move:function(t){var i=e.pointer.point.minus(e.lastDragPoint);if(0!==i.magnitudeSquared()){var n=e.transform.inverseDelta2(i);if(e.options.translate){var r=e.node.getMatrix().getTranslation();e.options.translate.call(null,{delta:n,oldPosition:r,position:r.plus(n)})}if(e.lastDragPoint=e.pointer.point,e.options.drag){var s=t.currentTarget;t.currentTarget=e.node,e.options.drag.call(null,t,e.trail),t.currentTarget=s}}}}}var i=t("PHET_CORE/inherit"),n=t("SCENERY/scenery");return n.register("SimpleDragHandler",e),i(Object,e,{startDrag:function(t){t.pointer.dragging=!0,t.pointer.cursor=this.options.dragCursor,t.pointer.addInputListener(this.dragListener),this.dragging=!0,this.pointer=t.pointer,this.trail=t.trail.subtrailTo(t.currentTarget,!0),this.transform=this.trail.getTransform(),this.node=t.currentTarget,this.lastDragPoint=t.pointer.point,this.startTransformMatrix=t.currentTarget.getMatrix().copy(),this.mouseButton=t.pointer.isMouse?t.domEvent.button:void 0,this.options.start&&this.options.start.call(null,t,this.trail)},endDrag:function(t){this.pointer.dragging=!1,this.pointer.cursor=null,this.pointer.removeInputListener(this.dragListener),this.dragging=!1,this.options.end&&this.options.end.call(null,t,this.trail),this.pointer=null},tryToSnag:function(t){t.pointer.isMouse&&t.domEvent&&this.options.mouseButton!==t.domEvent.button&&-1!==this.options.mouseButton||this.dragging||t.pointer.dragging||this.startDrag(t)},tryTouchToSnag:function(t){this.options.allowTouchSnag&&(this.options.allowTouchSnag===!0||this.options.allowTouchSnag(t))&&this.tryToSnag(t)},down:function(t){this.tryToSnag(t)},touchenter:function(t){this.tryTouchToSnag(t)},touchmove:function(t){this.tryTouchToSnag(t)}}),e}),i("SUN/OnOffSwitch",["require","DOT/Dimension2","DOT/Vector2","DOT/Util","PHET_CORE/inherit","SCENERY/nodes/Node","SCENERY/nodes/Rectangle","KITE/Shape","SCENERY/input/SimpleDragHandler","SUN/sun"],function(t){"use strict";function e(t,e){e=_.extend({size:new i(60,30),cursor:"pointer",thumbFill:"white",thumbStroke:"black",trackOffFill:"white",trackOnFill:"rgb(0,200,0)",trackStroke:"black",toggleWhileDragging:null,dragThreshold:3,toggleThreshold:1,tandem:null},e);var s=this;o.call(s);var u=e.size.height/2,c=this.trackNode=new a(0,0,e.size.width,e.size.height,u,u,{fill:e.trackOffFill,stroke:e.trackStroke,cachedPaints:[e.trackOnFill,e.trackOffFill]});s.addChild(c);var d=this.thumbNode=new a(0,0,.5*e.size.width,e.size.height,u,u,{fill:e.thumbFill,stroke:e.thumbStroke});s.addChild(d);var m=.25*e.size.height;d.touchArea=l.roundRect(-m,-m,.5*e.size.width+2*m,e.size.height+2*m,u,u);var f=function(t){t?(d.right=e.size.width,c.fill=e.trackOnFill):(d.left=0,c.fill=e.trackOffFill)};t.link(f.bind(s));var p=e.dragThreshold*e.dragThreshold,g=new n,A=!1;s.addInputListener(new h({allowTouchSnag:function(t){return _.contains(t.trail.nodes,d)},start:function(t,e){g.setXY(0,0),A=!1},end:function(e,i){var n=t.get(),r=A?s.thumbPositionToValue():!t.get();s.trigger2("startedCallbacksForToggled",n,r),t.set(r),f(t.get()),s.trigger0("endedCallbacksForToggled")},drag:function(i,n){var o=i.currentTarget.globalToLocalPoint(i.pointer.point),a=d.width/2;d.centerX=r.clamp(o.x,a,e.size.width-a);var l=o.x<(1-2*e.toggleThreshold)*a||o.x>(-1+2*e.toggleThreshold)*a+e.size.width,h=s.thumbPositionToValue();c.fill=h?e.trackOnFill:e.trackOffFill,(e.toggleWhileDragging===!0||l&&null===e.toggleWhileDragging)&&(s.trigger2("startedCallbacksForToggled",!h,h),t.set(h),s.trigger0("endedCallbacksForToggled"))},translate:function(t){g.add(t.delta),A=A||g.magnitudeSquared()>p}})),this.onOffSwitchTandem=e.tandem,this.onOffSwitchTandem&&this.onOffSwitchTandem.addInstance(this),s.mutate(e)}var i=t("DOT/Dimension2"),n=t("DOT/Vector2"),r=t("DOT/Util"),s=t("PHET_CORE/inherit"),o=t("SCENERY/nodes/Node"),a=t("SCENERY/nodes/Rectangle"),l=t("KITE/Shape"),h=t("SCENERY/input/SimpleDragHandler"),u=t("SUN/sun");return u.register("OnOffSwitch",e),s(o,e,{thumbPositionToValue:function(){return this.thumbNode.centerX>this.trackNode.centerX}})}),i("SUN/ABSwitch",["require","SCENERY/input/ButtonListener","DOT/Dimension2","PHET_CORE/inherit","SCENERY/nodes/Line","SCENERY/util/LinearGradient","SCENERY/nodes/Node","SUN/OnOffSwitch","AXON/Property","SUN/sun"],function(t){"use strict";function e(t,e,r,u,c,d){d=_.extend({switchSize:new n(60,30),xSpacing:8,cursor:"pointer",centerOnButton:!1,setEnabled:function(t,e){t.opacity=e?1:.5}},d);var m=new o(0,0,0,d.switchSize.height).addColorStop(0,"rgb(40,40,40)").addColorStop(1,"rgb(200,200,200)");d.trackFillA=d.trackFillA||m,d.trackFillB=d.trackFillB||m,d.thumbFill=d.thumbFill||new o(0,0,0,d.switchSize.height).addColorStop(0,"white").addColorStop(1,"rgb(200,200,200)");var f=this;a.call(f);var p=new h(u===t.get()),g=new l(p,{size:d.switchSize,cursor:d.cursor,thumbFill:d.thumbFill,trackOnFill:d.trackFillB,trackOffFill:d.trackFillA});if(f.addChild(g),f.addChild(r),f.addChild(c),r.right=g.left-d.xSpacing,r.centerY=g.centerY,c.left=g.right+d.xSpacing,c.centerY=g.centerY,d.centerOnButton){var A=Math.abs(r.width-c.width),E=new s(0,0,f.width+A,0);f.addChild(E),E.moveToBack(),r.widthm&&o.scale(m/o.width),this.expandedProperty=new a(!0),i.call(this,o,{titleNode:new l(h,{font:d,maxWidth:f}),titleAlignX:"left",contentAlign:"left",fill:"white",showTitleWhenExpanded:!1,contentXMargin:8,contentYMargin:4,expandedProperty:this.expandedProperty,buttonTouchAreaXDilation:5,buttonTouchAreaYDilation:5}),this.mutate(r)}var i=t("SUN/AccordionBox"),n=t("AREA_BUILDER/areaBuilder"),r=t("PHET_CORE/inherit"),s=t("SCENERY/nodes/Node"),o=t("SCENERY_PHET/PhetFont"),a=t("AXON/Property"),l=t("SCENERY/nodes/Text"),h=t("string!AREA_BUILDER/values"),u=t("string!AREA_BUILDER/area"),c=t("string!AREA_BUILDER/perimeter"),d=new o(14),m=200,f=190;return n.register("AreaAndPerimeterDisplay",e),r(i,e,{reset:function(){this.expandedProperty.reset()}})}),i("SCENERY_PHET/bucket/BucketFront",["require","SCENERY/util/Color","PHET_CORE/inherit","SCENERY/util/LinearGradient","DOT/Matrix3","SCENERY/nodes/Node","SCENERY/nodes/Path","SCENERY_PHET/PhetFont","SCENERY/nodes/Text","SCENERY_PHET/sceneryPhet"],function(t){"use strict";function e(t,e,n){o.call(this,{cursor:"pointer"}),n=_.extend({labelFont:new l(20)},n);var u=s.scaling(e.getMatrix().m00(),e.getMatrix().m11()),c=t.containerShape.transformed(u),d=new i(t.baseColor),m=new r(c.bounds.getMinX(),0,c.bounds.getMaxX(),0);m.addColorStop(0,d.colorUtilsBrighter(.5).toCSS()),m.addColorStop(1,d.colorUtilsDarker(.5).toCSS()),this.addChild(new a(c,{fill:m}));var f=new h(t.captionText,{font:n.labelFont,fill:t.captionColor});f.scale(Math.min(1,Math.min(.75*c.bounds.width/f.width,.8*c.bounds.height/f.height))),f.centerX=c.bounds.getCenterX(),f.centerY=c.bounds.getCenterY(),this.addChild(f),this.translation=e.modelToViewPosition(t.position)}var i=t("SCENERY/util/Color"),n=t("PHET_CORE/inherit"),r=t("SCENERY/util/LinearGradient"),s=t("DOT/Matrix3"),o=t("SCENERY/nodes/Node"),a=t("SCENERY/nodes/Path"),l=t("SCENERY_PHET/PhetFont"),h=t("SCENERY/nodes/Text"),u=t("SCENERY_PHET/sceneryPhet");return u.register("BucketFront",e),n(o,e)}),i("SCENERY_PHET/bucket/BucketHole",["require","PHET_CORE/inherit","SCENERY/nodes/Node","SCENERY/nodes/Path","SCENERY/util/LinearGradient","DOT/Matrix3","SCENERY_PHET/sceneryPhet"],function(t){"use strict";function e(t,e){n.call(this);var i=o.scaling(e.getMatrix().m00(),e.getMatrix().m11()),a=t.holeShape.transformed(i),l=new s(a.bounds.getMinX(),0,a.bounds.getMaxX(),0);l.addColorStop(0,"black"),l.addColorStop(1,"#c0c0c0"),this.addChild(new r(a,{fill:l,stroke:"#777",lineWidth:1})),this.translation=e.modelToViewPosition(t.position)}var i=t("PHET_CORE/inherit"),n=t("SCENERY/nodes/Node"),r=t("SCENERY/nodes/Path"),s=t("SCENERY/util/LinearGradient"),o=t("DOT/Matrix3"),a=t("SCENERY_PHET/sceneryPhet");return a.register("BucketHole",e),i(n,e)}),i("SCENERY/nodes/Image",["require","PHET_CORE/inherit","PHET_CORE/cleanArray","PHET_CORE/platform","DOT/Bounds2","DOT/Vector2","SCENERY/scenery","SCENERY/nodes/Node","SCENERY/display/Renderer","SCENERY/util/Util","SCENERY/display/DOMSelfDrawable","SCENERY/display/SVGSelfDrawable","SCENERY/display/CanvasSelfDrawable","SCENERY/display/SelfDrawable","SCENERY/display/WebGLSelfDrawable","SCENERY/util/SpriteSheet"],function(t){"use strict";function e(t,e){e=e||{},t&&(e.image=t),this._initialWidth=0,this._initialHeight=0,this._imageOpacity=1,this._mipmap=!1,this._mipmapBias=E,this._mipmapInitialLevel=b,this._mipmapMaxLevel=S,this._mipmapCanvases=[],this._mipmapURLs=[],this._mipmapData=null;var i=this;this.loadListener=function(t){i.invalidateImage(),i._image.removeEventListener("load",i.loadListener)},l.call(this,e),this.invalidateSupportedRenderers()}var i=t("PHET_CORE/inherit"),n=t("PHET_CORE/cleanArray"),r=t("PHET_CORE/platform"),s=t("DOT/Bounds2"),o=t("DOT/Vector2"),a=t("SCENERY/scenery"),l=t("SCENERY/nodes/Node"),h=t("SCENERY/display/Renderer");t("SCENERY/util/Util");var u=t("SCENERY/display/DOMSelfDrawable"),c=t("SCENERY/display/SVGSelfDrawable"),d=t("SCENERY/display/CanvasSelfDrawable"),m=t("SCENERY/display/SelfDrawable"),f=t("SCENERY/display/WebGLSelfDrawable"),p=t("SCENERY/util/SpriteSheet"),g=!0,A=!0,E=-.7,b=4,S=5,v=Math.log2||function(t){return Math.log(t)/Math.LN2};a.register("Image",e),i(l,e,{allowsMultipleDOMInstances:!1,invalidateImage:function(){this._image?this.invalidateSelf(new s(0,0,this.getImageWidth(),this.getImageHeight())):this.invalidateSelf(s.NOTHING);for(var t=this._drawables.length,e=0;t>e;e++)this._drawables[e].markDirtyImage();this.invalidateMipmaps(),this.invalidateSupportedRenderers()},getImage:function(){return this._image},get image(){return this.getImage()},invalidateSupportedRenderers:function(){var t=h.bitmaskCanvas,e=this.getImageWidth()<=p.MAX_DIMENSION.width&&this.getImageHeight()<=p.MAX_DIMENSION.height;e&&(t|=h.bitmaskWebGL),this._image instanceof HTMLCanvasElement||(t|=h.bitmaskSVG|h.bitmaskDOM),this.setRendererBitmask(t)},setImage:function(t){if(this._image!==t&&("string"!=typeof t||!this._image||t!==this._image.src&&t!==this._mipmapData)){if(this._image&&this._image.removeEventListener("load",this.loadListener),this._mipmapData=null,"string"==typeof t){var e=t;t=document.createElement("img"),t.addEventListener("load",this.loadListener),t.src=e}else t instanceof HTMLImageElement?t.width&&t.height||t.addEventListener("load",this.loadListener):t instanceof Array&&(this._mipmapData=t,t=t[0].img,this._mipmapInitialLevel=this._mipmapMaxLevel=this._mipmapData.length,this._mipmap=!0);this._image=t,this.invalidateImage()}return this},set image(t){this.setImage(t)},setImageWithSize:function(t,e,i){this._initialWidth=e,this._initialHeight=i,this.setImage(t)},getImageOpacity:function(){return this._imageOpacity},get imageOpacity(){return this.getImageOpacity()},setImageOpacity:function(t){if(this._imageOpacity!==t){this._imageOpacity=t;for(var e=this._drawables.length,i=0;e>i;i++)this._drawables[i].markImageOpacityDirty()}},set imageOpacity(t){this.setImageOpacity(t)},getInitialWidth:function(){return this._initialWidth},get initialWidth(){return this.getInitialWidth()},setInitialWidth:function(t){this._initialWidth=t,this.invalidateImage()},set initialWidth(t){this.setInitialWidth(t)},getInitialHeight:function(){return this._initialHeight},get initialHeight(){return this.getInitialHeight()},setInitialHeight:function(t){this._initialHeight=t,this.invalidateImage()},set initialHeight(t){this.setInitialHeight(t)},isMipmap:function(){return this._mipmap},get mipmap(){return this.isMipmap()},setMipmap:function(t){this._mipmap!==t&&(this._mipmap=t,this.invalidateMipmaps())},set mipmap(t){this.setMipmap(t)},getMipmapBias:function(){return this._mipmapBias},get mipmapBias(){return this.getMipmapBias()},setMipmapBias:function(t){this._mipmapBias!==t&&(this._mipmapBias=t,this.invalidateMipmaps())},set mipmapBias(t){this.setMipmapBias(t)},getMipmapInitialLevel:function(){return this._mipmapInitialLevel},get mipmapInitialLevel(){return this.getMipmapInitialLevel()},setMipmapInitialLevel:function(t){this._mipmapInitialLevel!==t&&(this._mipmapInitialLevel=t,this.invalidateMipmaps())},set mipmapInitialLevel(t){this.setMipmapInitialLevel(t)},getMipmapMaxLevel:function(){return this._mipmapMaxLevel},get mipmapMaxLevel(){return this.getMipmapMaxLevel()},setMipmapMaxLevel:function(t){this._mipmapMaxLevel!==t&&(this._mipmapMaxLevel=t,this.invalidateMipmaps())},set mipmapMaxLevel(t){this.setMipmapMaxLevel(t)},constructNextMipmap:function(){var t=this._mipmapCanvases.length,e=this._mipmapCanvases[t-1];if(e.width*e.height>2){var i=document.createElement("canvas");if(i.width=Math.ceil(e.width/2),i.height=Math.ceil(e.height/2),i.width>0&&i.height>0){var n=i.getContext("2d");n.scale(.5,.5),n.drawImage(e,0,0),this._mipmapCanvases.push(i),this._mipmapURLs.push(i.toDataURL())}}},invalidateMipmaps:function(){if(n(this._mipmapCanvases),n(this._mipmapURLs),this._image&&this._mipmap)if(this._mipmapData)for(var t=0;th;h++)this._drawables[h].markDirtyMipmap()}this.trigger0("mipmap")},getMipmapLevel:function(t){if(t>=1)return 0;var e=v(1/t);if(e=Math.round(e+this._mipmapBias),0>e&&(e=0),e>this._mipmapMaxLevel&&(e=this._mipmapMaxLevel),this.mipmap&&!this._mipmapCanvases[e]){for(var i=this._mipmapCanvases.length-1;++i<=e;)this.constructNextMipmap();return Math.min(e,this._mipmapCanvases.length-1)}return e},getMipmapCanvas:function(t){return this._mipmapCanvases[t]},getMipmapURL:function(t){return this._mipmapURLs[t]},hasMipmaps:function(){return this._mipmapCanvases.length>0},getImageWidth:function(){var t=this._mipmapData?this._mipmapData[0].width:this._image.naturalWidth||this._image.width;return 0===t?this._initialWidth:t},get imageWidth(){return this.getImageWidth()},getImageHeight:function(){var t=this._mipmapData?this._mipmapData[0].height:this._image.naturalHeight||this._image.height;return 0===t?this._initialHeight:t},get imageHeight(){return this.getImageHeight()},getImageURL:function(){return this._image.src},isPainted:function(){return!0},canvasPaintSelf:function(t){e.ImageCanvasDrawable.prototype.paintCanvas(t,this)},createDOMDrawable:function(t,i){return e.ImageDOMDrawable.createFromPool(t,i)},createSVGDrawable:function(t,i){return e.ImageSVGDrawable.createFromPool(t,i)},createCanvasDrawable:function(t,i){return e.ImageCanvasDrawable.createFromPool(t,i)},createWebGLDrawable:function(t,i){return e.ImageWebGLDrawable.createFromPool(t,i)},getBasicConstructor:function(t){return"new scenery.Image( '"+(this._image.src?this._image.src.replace(/'/g,"\\'"):"other")+"', {"+t+"} )"}}),e.prototype._mutatorKeys=["image","imageOpacity","initialWidth","initialHeight","mipmap","mipmapBias","mipmapInitialLevel","mipmapMaxLevel"].concat(l.prototype._mutatorKeys),e.createSVGImage=function(t,e,i){var n=document.createElementNS(a.svgns,"image");return n.setAttribute("x",0),n.setAttribute("y",0),n.setAttribute("width",e+"px"),n.setAttribute("height",i+"px"),n.setAttributeNS(a.xlinkns,"xlink:href",t),n},e.createFastMipmapFromCanvas=function(t){var e=[],i=t.toDataURL(),n=new window.Image;n.src=i,e.push({img:n,url:i,width:t.width,height:t.height});for(var r=t;r.width>=2&&r.height>=2;){var s={},o=document.createElement("canvas");o.width=s.width=Math.ceil(r.width/2),o.height=s.height=Math.ceil(r.height/2);var a=o.getContext("2d");a.setTransform(.5,0,0,.5,0,0),a.drawImage(r,0,0),s.url=o.toDataURL(),s.img=new window.Image,s.img.src=s.url,r=o,e.push(s)}return e},e.ImageStatefulDrawable={mixin:function(t){var e=t.prototype;e.initializeState=function(t,e){return this.paintDirty=!0,this.dirtyImage=!0,this.dirtyImageOpacity=!0,this.dirtyMipmap=!0,this},e.disposeState=function(){},e.markPaintDirty=function(){this.paintDirty=!0,this.markDirty()},e.markDirtyImage=function(){this.dirtyImage=!0,this.markPaintDirty()},e.markDirtyMipmap=function(){this.dirtyMipmap=!0,this.markPaintDirty()},e.markImageOpacityDirty=function(){this.dirtyImageOpacity=!0,this.markPaintDirty()},e.setToCleanState=function(){this.paintDirty=!1,this.dirtyImage=!1,this.dirtyImageOpacity=!1,this.dirtyMipmap=!1}}},e.ImageDOMDrawable=i(u,function(t,e){this.initialize(t,e)},{initialize:function(t,e){return this.initializeDOMSelfDrawable(t,e),this.initializeState(t,e),this.domElement||(this.domElement=document.createElement("img"),this.domElement.style.display="block",this.domElement.style.position="absolute",this.domElement.style.pointerEvents="none",this.domElement.style.left="0",this.domElement.style.top="0"),this.hasOpacity=!1,a.Util.prepareForTransform(this.domElement,this.forceAcceleration),this},updateDOM:function(){var t=this.node,e=this.domElement;this.paintDirty&&this.dirtyImage&&(e.src=t._image?t._image.src:"//:0"),this.dirtyImageOpacity&&(1===t._imageOpacity?this.hasOpacity&&(this.hasOpacity=!1,e.style.opacity=""):(this.hasOpacity=!0,e.style.opacity=t._imageOpacity)),this.transformDirty&&a.Util.applyPreparedTransform(this.getTransformMatrix(),this.domElement,this.forceAcceleration),this.setToClean()},setToClean:function(){this.setToCleanState(),this.transformDirty=!1},dispose:function(){this.disposeState(),g||(this.domElement=null),u.prototype.dispose.call(this)}}),e.ImageStatefulDrawable.mixin(e.ImageDOMDrawable),m.Poolable.mixin(e.ImageDOMDrawable),e.ImageSVGDrawable=function(t,e){this.initialize(t,e)},i(c,e.ImageSVGDrawable,{initialize:function(t,e){this.initializeSVGSelfDrawable(t,e,!1,A);var i=this;return this.svgElement||(this.svgElement=document.createElementNS(a.svgns,"image"),this.svgElement.setAttribute("x",0),this.svgElement.setAttribute("y",0)),this.hasOpacity=!1,this._usingMipmap=!1,this._mipmapLevel=-1,this._mipmapTransformListener=this._mipmapTransformListener||function(){i.markDirtyMipmap()},this._mipmapListener=this._mipmapListener||function(){i.markDirtyMipmap(),i.updateMipmapStatus(i.node._mipmap)},this.node.onStatic("mipmap",this._mipmapListener),this.updateMipmapStatus(e.node._mipmap),this},updateSVGSelf:function(){var t=this.svgElement;this.dirtyImage?this.node._image?this.updateURL(t,!0):(t.setAttribute("width","0"),t.setAttribute("height","0"),t.setAttributeNS(a.xlinkns,"xlink:href","//:0")):this.dirtyMipmap&&this.node._image&&this.updateURL(t,!1),this.dirtyImageOpacity&&(1===this.node._imageOpacity?this.hasOpacity&&(this.hasOpacity=!1,t.removeAttribute("opacity")):(this.hasOpacity=!0,t.setAttribute("opacity",this.node._imageOpacity)))},updateURL:function(t,e){var i=-1;if(this.node._mipmap){var n=this.instance.relativeTransform.matrix,s=(Math.sqrt(n.m00()*n.m00()+n.m10()*n.m10())+Math.sqrt(n.m01()*n.m01()+n.m11()*n.m11()))/2;s*=window.devicePixelRatio||1,i=this.node.getMipmapLevel(s)}if(e||i!==this._mipmapLevel)if(this._mipmapLevel>=0&&-1===i&&(r.ie9||r.ie10?t.setAttribute("transform",""):t.removeAttribute("transform")),this._mipmapLevel=i,this.node._mipmap&&this.node.hasMipmaps()){var o=this.node.getMipmapURL(i),l=this.node.getMipmapCanvas(i);t.setAttribute("width",l.width+"px"),t.setAttribute("height",l.height+"px"),t.setAttribute("transform","scale("+Math.pow(2,i).toFixed(20)+")"),t.setAttributeNS(a.xlinkns,"xlink:href",o)}else t.setAttribute("width",this.node.getImageWidth()+"px"),t.setAttribute("height",this.node.getImageHeight()+"px"),t.setAttributeNS(a.xlinkns,"xlink:href",this.node.getImageURL())},updateMipmapStatus:function(t){this._usingMipmap!==t&&(this._usingMipmap=t,t?(this.instance.relativeTransform.addListener(this._mipmapTransformListener),this.instance.relativeTransform.addPrecompute()):(this.instance.relativeTransform.removeListener(this._mipmapTransformListener),this.instance.relativeTransform.removePrecompute()),this.markDirtyMipmap())},dispose:function(){this.updateMipmapStatus(!1),this.node.offStatic("mipmap",this._mipmapListener),c.prototype.dispose.call(this)}}),e.ImageStatefulDrawable.mixin(e.ImageSVGDrawable),m.Poolable.mixin(e.ImageSVGDrawable),e.ImageCanvasDrawable=function(t,e){this.initialize(t,e)},i(d,e.ImageCanvasDrawable,{initialize:function(t,e){return this.initializeCanvasSelfDrawable(t,e)},paintCanvas:function(t,e){var i=1!==e._imageOpacity;e._image&&0!==e._image.width&&0!==e._image.height&&(i&&(t.context.save(),t.context.globalAlpha*=e._imageOpacity),t.context.drawImage(e._image,0,0),i&&t.context.restore())},markDirtyImage:function(){this.markPaintDirty()},markDirtyMipmap:function(){this.markPaintDirty()},markImageOpacityDirty:function(){this.markPaintDirty()}}),m.Poolable.mixin(e.ImageCanvasDrawable);var C=5,y=0*C,w=1*C,R=2*C,T=3*C,I=4*C,N=5*C,P=0,D=1,B=2,x=3,O=4;return e.ImageWebGLDrawable=i(f,function(t,e){this.initialize(t,e)},{webglRenderer:h.webglTexturedTriangles,initialize:function(t,e){return this.initializeWebGLSelfDrawable(t,e),this.vertexArray||(this.vertexArray=new Float32Array(6*C)),this.upperLeft=new o,this.lowerLeft=new o,this.upperRight=new o,this.lowerRight=new o,this.xyDirty=!0,this.uvDirty=!0,this.updatedOnce=!1,this.sprite=null,this},onAddToBlock:function(t){this.webglBlock=t,this.markDirty(),this.reserveSprite()},onRemoveFromBlock:function(t){this.unreserveSprite()},reserveSprite:function(){if(this.sprite){if(this.sprite.image===this.node._image)return;this.unreserveSprite()}var t=this.node.getImageWidth(),e=this.node.getImageHeight();this.sprite=t>0&&e>0?this.webglBlock.addSpriteSheetImage(this.node._image,t,e):null,this.xyDirty=!0,this.uvDirty=!0},unreserveSprite:function(){this.sprite&&this.webglBlock.removeSpriteSheetImage(this.sprite),this.sprite=null},markTransformDirty:function(){this.xyDirty=!0,f.prototype.markTransformDirty.call(this)},markPaintDirty:function(){this.xyDirty=!0,this.uvDirty=!0,this.markDirty()},update:function(){if(this.dirty){if(this.dirty=!1,this.reserveSprite(),(this.dirtyImageOpacity||!this.updatedOnce)&&(this.vertexArray[y+O]=this.node._imageOpacity,this.vertexArray[w+O]=this.node._imageOpacity,this.vertexArray[R+O]=this.node._imageOpacity,this.vertexArray[T+O]=this.node._imageOpacity,this.vertexArray[I+O]=this.node._imageOpacity,this.vertexArray[N+O]=this.node._imageOpacity),this.updatedOnce=!0,!this.sprite)return;if(this.uvDirty){this.uvDirty=!1;var t=this.sprite.uvBounds;this.vertexArray[y+B]=t.minX,this.vertexArray[y+x]=t.minY,this.vertexArray[w+B]=t.minX,this.vertexArray[w+x]=t.maxY,this.vertexArray[R+B]=t.maxX,this.vertexArray[R+x]=t.minY,this.vertexArray[T+B]=t.maxX,this.vertexArray[T+x]=t.minY,this.vertexArray[I+B]=t.minX,this.vertexArray[I+x]=t.maxY,this.vertexArray[N+B]=t.maxX,this.vertexArray[N+x]=t.maxY}if(this.xyDirty){this.xyDirty=!1;var e=this.node.getImageWidth(),i=this.node.getImageHeight(),n=this.instance.relativeTransform.matrix;n.multiplyVector2(this.upperLeft.setXY(0,0)),n.multiplyVector2(this.lowerLeft.setXY(0,i)),n.multiplyVector2(this.upperRight.setXY(e,0)),n.multiplyVector2(this.lowerRight.setXY(e,i)),this.vertexArray[y+P]=this.upperLeft.x,this.vertexArray[y+D]=this.upperLeft.y,this.vertexArray[w+P]=this.lowerLeft.x,this.vertexArray[w+D]=this.lowerLeft.y,this.vertexArray[R+P]=this.upperRight.x,this.vertexArray[R+D]=this.upperRight.y,this.vertexArray[T+P]=this.upperRight.x,this.vertexArray[T+D]=this.upperRight.y,this.vertexArray[I+P]=this.lowerLeft.x,this.vertexArray[I+D]=this.lowerLeft.y,this.vertexArray[N+P]=this.lowerRight.x,this.vertexArray[N+D]=this.lowerRight.y}}},dispose:function(){f.prototype.dispose.call(this)}}),e.ImageStatefulDrawable.mixin(e.ImageWebGLDrawable),m.Poolable.mixin(e.ImageWebGLDrawable),e}),i("SUN/buttons/PushButtonInteractionStateProperty",["require","PHET_CORE/inherit","AXON/DerivedProperty","SUN/sun"],function(t){"use strict";function e(t,e){n.call(this,[t.overProperty,t.downProperty,t.enabledProperty],function(t,e,i){return i?t&&!e?"over":t&&e?"pressed":"idle":"disabled"},e)}var i=t("PHET_CORE/inherit"),n=t("AXON/DerivedProperty"),r=t("SUN/sun");return r.register("PushButtonInteractionStateProperty",e),i(n,e)}),i("SUN/buttons/ButtonModel",["require","PHET_CORE/inherit","AXON/PropertySet","SUN/sun"],function(t){"use strict";function e(t){t=_.extend({startCallback:function(){},endCallback:function(t){},enabled:!0},t);var e=this;n.call(this,{over:!1,down:!1,enabled:t.enabled},t),this.property("down").lazyLink(function(i){i?t.startCallback():t.endCallback(e.over)})}var i=t("PHET_CORE/inherit"),n=t("AXON/PropertySet"),r=t("SUN/sun");return r.register("ButtonModel",e),i(n,e)}),i("PHET_CORE/Timer",["require","PHET_CORE/cleanArray","PHET_CORE/phetCore"],function(t){"use strict";var e=t("PHET_CORE/cleanArray"),i=t("PHET_CORE/phetCore"),n=[],r=[],s={step:function(t){var i,s=n.length;for(i=0;s>i;i++)r[i]=n[i];for(i=0;s>i;i++)r[i](t);e(r)},setTimeout:function(t,e){var i=0,n=this,r=function(s){i+=s,1e3*i>=e&&(t(),n.removeStepListener(r))};return this.addStepListener(r),r},clearTimeout:function(t){this.hasStepListener(t)&&this.removeStepListener(t)},setInterval:function(t,e){var i=0,r=function(s){for(i+=s;1e3*i>=e&&-1!==n.indexOf(r);)t(),i-=e/1e3};return this.addStepListener(r),r},clearInterval:function(t){this.hasStepListener(t)&&this.removeStepListener(t)},addStepListener:function(t){n.push(t)},removeStepListener:function(t){var e=n.indexOf(t);-1!==e&&n.splice(e,1)},hasStepListener:function(t){return n.indexOf(t)>=0}};return i.register("Timer",s),s}),i("SUN/CallbackTimer",["require","PHET_CORE/inherit","PHET_CORE/Timer","SUN/sun"],function(t){"use strict";function e(t){t=_.extend({callback:null,delay:400,interval:100},t),this.delay=t.delay,this.interval=t.interval,this.callbacks=[],t.callback&&this.callbacks.push(t.callback),this.delayID=null,this.intervalID=null,this.fired=!1}var i=t("PHET_CORE/inherit"),n=t("PHET_CORE/Timer"),r=t("SUN/sun");return r.register("CallbackTimer",e),i(Object,e,{isRunning:function(){return null!==this.delayID||null!==this.intervalID},start:function(){var t=this;t.isRunning()||(t.fired=!1,t.delayID=n.setTimeout(function(){t.delayID=null,t.intervalID=n.setInterval(function(){t.fire()},t.interval),t.fire()},t.delay))},stop:function(t){this.isRunning()&&(this.delayID&&(n.clearTimeout(this.delayID),this.delayID=null),this.intervalID&&(n.clearInterval(this.intervalID),this.intervalID=null),t&&!this.fired&&this.fire())},addCallback:function(t){-1===this.callbacks.indexOf(t)&&this.callbacks.push(t)},removeCallback:function(t){var e=this.callbacks.indexOf(t);-1!==e&&this.callbacks.splice(e,1)},fire:function(){for(var t=this.callbacks.slice(0),e=0;e=0?i.substring(0,i.indexOf("?")):i)+"/../"}}),i("../../chipper/js/requirejs-plugins/registerLicenseEntry",[],function(){"use strict";function t(t,e){return"phet"===e||"phet-io"===e?t&&("http://phet.colorado.edu"===t.projectURL||"Public Domain"===t.license||"NASA"===t.license):!0}function e(e,i,n){var r=t(i,n)||i&&!!i.exception;if(r&&i&&i.exception){var s="license exception for "+e+": "+i.exception;global.phet.chipper.grunt?global.phet.chipper.grunt.log.warn(s):console.log("WARNING: "+s)}return r}function i(t,i,n,r,s){e(t,i,n)?(global.phet.chipper.licenseEntries=global.phet.chipper.licenseEntries||{},global.phet.chipper.licenseEntries[r]=global.phet.chipper.licenseEntries[r]||{},global.phet.chipper.licenseEntries[r][t]=i,s(null)):s.error(new Error("unacceptable license entry for "+t))}return i}),function(){"use strict";function t(t){var e=t.lastIndexOf("/"),i=t.substring(0,e),n=i+"/license.json",r=t.substring(e+1),s=global.phet.chipper.fs.readFileSync(n,"utf8"),o=null;try{o=JSON.parse(s)}catch(a){throw a instanceof SyntaxError?new Error("syntax error in "+n+": "+a.message):a}var l=o[r];return l?l:null}"undefined"!=typeof i&&i("../../chipper/js/common/getLicenseEntry",[],function(){return t}),"undefined"!=typeof module&&(module.exports=t)}(),i("image",{load:function(t){throw new Error("Dynamic load not allowed: "+t)}}),i("image!SCENERY_PHET/eraser.png",function(){var t=new Image;return window.phetImages=window.phetImages||[],window.phetImages.push(t),t.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAAA5CAYAAACLWl2QAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAB41JREFUeNrUm+tPU0kUwA+lavGDvCKKgNvwAXxTeQhmcUVZ8BHMaiQrEJ5fTDYL4gf/gPUv2PUrmqxRUDEiKL5AkFZlsypKC8FWECi2yMMIJSbyWGh3zvTe2pYWLtB2rieZzty596Zzfz3nzJlzp34gMjl9+rScVMdJ+YWUIFIUDIahl4oICEL4k5RiPA4ODiYlBKKjo8mRBSwWLODQJp8AfNvC9dvOuylmC5gd+sxgNlvbg0YDmEwm/BK5VERaUovakZSUBKn79sGm8HA6WLPdA1mPzXYPxz2U2UyPzViTwvfzx3NcbZ7D9pxTjf1z0Nv7noeCopSKAAqaSguaTU5uLiQlJtp+TV/J6OgIvHzxL0RGRoLRaMQutUQMUAICAoLOnTsHe4i2+FrGx8fg2VMVkDFAdnY2362RiAHK76WlEBERwQRKU2MD+Pv7Q3l5OXz+/NnmfCWsoZSWljGBMjMzAw2PHlIoZWVl1IzGxsbouYqKCqWEJRQcUEQkCyjT8OjhAwonLy+PjCGS9nd3d1P/gh9SZlDOnIGITZvA4mso0zPw4P49GCNmk5OTAzt27LSd4x0vfkh8CAXjlFqEcoZAiWRgPigqZQv1Jb+eOgWJds4e+yYnJ7E54DMwHBSckuX5+fnUnllIS0sz6PX98GNqKiQmJDqcMxoHbTGMT8DYQVHkFxTArl27mEB50tQE73Q6iI+Ph6ysrHnnBweNfNP7pmQPpYBASUlOZgJFo24HnU4Lu3fvhpMns11ew/kXPZmRTF4F4wwlOTmFCZS3b7tIAPcUNm7cCEeOHnV7XU9Pj01bvAZmnqaksIHS1dUFjxsbKZSi4hKQyWQurxsk2sI5XhXfJ/UmlMLCQk5TLD6HMjo6SmegDRs2QAEZhzsoKB2dnXyzzpsaY4PCSlMQys3qG+Dn5wdZx46BbI1swetfvnhBzYj4F71XwBBt+RuhpOzdyxTKjevXaTs3N49qzELSSbSFWwpcsO+XeBhK8V4CpYhoCwuZnpoiUe19mJ6ehlM5uRC2CBSUhoZHWJnszchjYOyhFDKCMkWgXLtWRXMrhw4fhrCwsEXvwdlqcJAGdhf4adpjYMQABaWq8iqMjIxARmYmbNu2XVDKoZHMWJxv+cP5vMRj5lNUxAzK3fq7FErqvp9g69Ztgu6prr7JT9Elrs5Lvnsod+5Ah0YDsVu2QJwiTtA99+rroa+vF5vnibaoPQZGLFCUSiVoNGqIiY2FAwfTBd3z5s1raG1tpTGLKxNaNhixQFGT9Y+KgAkPD4f9aQcE3aPVaqGmpoYP/UsWulayXCjFxcXMoLQTKHW1tRASEgrpGZmC7hkeHoLa27f5qfmA8yzkLNLvDYq+v58+YHBICBw6cgRWr169OJSRYbh65QpO6YKgCAYjFihDQ0NQVVVFYWRkHhIEBWerqspKeyhqId8l+Z6gXLp0kb45PPhzhiAoGPThDIT1UqAsqjFigTI1OQWVJICbm5uDNDL74HvtRZcHZFlQfeM6XTuho10KlAU1RkxQKi5WkEh1HBKT9kBQ0LKgXF7q9/q5gYK7Ds5iOyYmZkUP5u4dtHXjgmXBPmxi6I5Q4hMSQR4dDf4Sf5BK/emLsvlFArP/zcLtmlvw6dOnZUNxaUpcoulsaGgoYFkpBFcPyyeu+Ov5a5xr3H0wMTEB23fshKjNPwgagyeguPMx1G7QfJy1xfnBLQ4PbPdgDntXvhXzvD0qjts1zBb77RpmqL97Bzo7OiAyarOgh2l+3MRDOb8SKO7AlKOmrNSEPJJ0IlPtunWBsGrVqsXThs3N8O6dDpuXFwr1l+V8uVeo8vT0dOZQMOmEMUiIAHNWtbTYQynxxPc7a0w5figUCuZgBj7QN6WLgnmmUkFPT7dHobgCcxyhLNXpekM+DHBgQtyP5fmzp9D7/r3HoTiAIWaEOyWDxKAtVGP0AxSKO//yT+tz6Ovt9QoUZx+D20chLi6OOZQJMk2PkIUfLhRdyeu2Nq9CcQZDzWjt2rXMwegXMCN9fx90Wx2t0ltQbKZEzChNVGY0oCfRrXSexgzo++H1q1d8oumEN8cgFZsZoeB2DWco6Izb37TxUATlVDxhSmlRUVGiMKPh4WGaJggK/gbGYPjgUyhUY7i1kUIMka7VXPS0Xr/e+sLMaDRAp0btUyi8xig8sYr2lOi0OpDJAkAWIKMzEwsoPJg0MYHBPXJBwcHw5csX6LJuzzD5GgrvfOMw0hWDf9FptbReI5NBe9srmJ2dZQKFByMXwxLAGqNY/csAiVXsNEXNYizUx8TGxooCjJbTGNZQ5qUd2E7TQ2AyjfOHJ1hC4cGYDAYDczBPmp/wTUxJKlmPB8HUqdVqYAmn5tYtYkZvsfnXSlOSnhL/hIQEDamL29raZIGBgTQXIySVuByx2DUmpyYBfxB8ddpvdba4Uv5NLKbtxy0iMcjD/yTK8RiXBwgIaxTc+4/TOZ/85mMed8nwr1+/ggF3WnN9uOt6kvTh5bg1HTcDfvz40TYZgQeS114B45Ss2s9Fw3IelIfFxEWyWFQESB2IUPyEXMSlJXgR+l9oBwcqBoe6FPlfgAEATKZKoArJoOIAAAAASUVORK5CYII=",t}),i("SCENERY_PHET/buttons/EraserButton",["require","PHET_CORE/inherit","SCENERY/nodes/Image","SUN/buttons/RectangularPushButton","SCENERY_PHET/sceneryPhet","image!SCENERY_PHET/eraser.png"],function(t){"use strict";function e(t){t=_.extend({baseColor:"#F2E916",iconWidth:20},t),t.content=new n(o),t.content.scale(t.iconWidth/t.content.width),r.call(this,t)}var i=t("PHET_CORE/inherit"),n=t("SCENERY/nodes/Image"),r=t("SUN/buttons/RectangularPushButton"),s=t("SCENERY_PHET/sceneryPhet"),o=t("image!SCENERY_PHET/eraser.png");return s.register("EraserButton",e),i(r,e)}),i("PHETCOMMON/view/ModelViewTransform2",["require","PHET_CORE/inherit","DOT/Vector2","DOT/Matrix3","DOT/Transform3","PHETCOMMON/phetcommon"],function(t){"use strict";function e(t){s.call(this,t)}var i=t("PHET_CORE/inherit"),n=t("DOT/Vector2"),r=t("DOT/Matrix3"),s=t("DOT/Transform3"),o=t("PHETCOMMON/phetcommon");return o.register("ModelViewTransform2",e),i(s,e,{modelToViewPosition:function(t){return this.transformPosition2(t)},modelToViewXY:function(t,e){return new n(this.modelToViewX(t),this.modelToViewY(e))},modelToViewX:function(t){return this.matrix.m00()*t+this.matrix.m02()},modelToViewY:function(t){return this.matrix.m11()*t+this.matrix.m12()},modelToViewDelta:function(t){return this.transformDelta2(t)},modelToViewNormal:function(t){return this.transformNormal2(t)},modelToViewDeltaX:function(t){return this.transformDeltaX(t)},modelToViewDeltaY:function(t){return this.transformDeltaY(t)},modelToViewBounds:function(t){return this.transformBounds2(t)},modelToViewShape:function(t){return this.transformShape(t)},modelToViewRay:function(t){return this.transformRay2(t)},viewToModelPosition:function(t){return this.inversePosition2(t)},viewToModelXY:function(t,e){return new n(this.viewToModelX(t),this.viewToModelY(e))},viewToModelX:function(t){var e=this.getInverse();return e.m00()*t+e.m02()},viewToModelY:function(t){var e=this.getInverse();return e.m11()*t+e.m12()},viewToModelDelta:function(t){return this.inverseDelta2(t)},viewToModelDeltaXY:function(t,e){return new n(this.viewToModelDeltaX(t),this.viewToModelDeltaY(e))},viewToModelNormal:function(t){return this.inverseNormal2(t)},viewToModelDeltaX:function(t){return this.inverseDeltaX(t)},viewToModelDeltaY:function(t){return this.inverseDeltaY(t)},viewToModelBounds:function(t){return this.inverseBounds2(t)},viewToModelShape:function(t){return this.inverseShape(t)},viewToModelRay:function(t){return this.inverseRay2(t)},invalidate:function(){s.prototype.invalidate.call(this)}}),e.createIdentity=function(){return new e(r.IDENTITY)},e.createOffsetScaleMapping=function(t,i){return new e(r.affine(i,0,0,i,t.x,t.y))},e.createOffsetXYScaleMapping=function(t,i,n){return new e(r.affine(i,0,0,n,t.x,t.y))},e.createSinglePointXYScaleMapping=function(t,e,i,r){var s=e.x-t.x*i,o=e.y-t.y*r;return this.createOffsetXYScaleMapping(new n(s,o),i,r)},e.createSinglePointScaleMapping=function(t,e,i){return this.createSinglePointXYScaleMapping(t,e,i,i)},e.createSinglePointScaleInvertedYMapping=function(t,e,i){return this.createSinglePointXYScaleMapping(t,e,i,-i)},e.createRectangleMapping=function(t,i){var n=i.width/t.width,s=i.x-n*t.x,o=i.height/t.height,a=i.y-o*t.y;return new e(r.affine(n,0,0,o,s,a))},e.createRectangleInvertedYMapping=function(t,i){var n=i.width/t.width,s=i.x-n*t.x,o=-i.height/t.height,a=i.y-o*t.getMaxY();return new e(r.affine(n,0,0,o,s,a))},e}),i("BRAND/../../js/brand",["require","PHET_CORE/Namespace"],function(t){"use strict";var e=t("PHET_CORE/Namespace");return new e("brand")}),i("string!JOIST/termsPrivacyAndLicensing",function(){return window.phet.chipper.strings.get("JOIST/termsPrivacyAndLicensing")}),i("string!JOIST/translation.credits.link",function(){return window.phet.chipper.strings.get("JOIST/translation.credits.link")}),i("string!JOIST/thirdParty.credits.link",function(){return window.phet.chipper.strings.get("JOIST/thirdParty.credits.link")}),i("BRAND/Brand",["require","BRAND/../../js/brand","string!JOIST/termsPrivacyAndLicensing","string!JOIST/translation.credits.link","string!JOIST/thirdParty.credits.link"],function(t){"use strict";var e=t("BRAND/../../js/brand"),i=t("string!JOIST/termsPrivacyAndLicensing"),n=t("string!JOIST/translation.credits.link"),r=t("string!JOIST/thirdParty.credits.link"),s={id:"phet",name:"PhET™ Interactive Simulations",copyright:"Copyright © 2004-2016 University of Colorado Boulder",isPhetApp:!!phet.chipper.getQueryParameter("phet-app")||!!phet.chipper.getQueryParameter("phet-android-app"),getLinks:function(t,e){return[{text:i,url:"http://phet.colorado.edu/en/licensing/html"},{text:n,url:"http://phet.colorado.edu/translation-credits?simName="+encodeURIComponent(t)+"&locale="+encodeURIComponent(e)},{text:r,url:"http://phet.colorado.edu/third-party-credits?simName="+encodeURIComponent(t)+"&locale="+encodeURIComponent(e)+"#"+t}]}};return e.register("Brand",s),s}),i("TANDEM/scenery/input/TandemDragHandler",["require","BRAND/Brand","AXON/Emitter","PHET_CORE/inherit","SCENERY/input/SimpleDragHandler","SUN/sun"],function(t){"use strict";function e(t){t=_.extend({tandem:null},t),this.startedCallbacksForDragStartedEmitter=new n,this.endedCallbacksForDragStartedEmitter=new n,this.startedCallbacksForDraggedEmitter=new n,this.endedCallbacksForDraggedEmitter=new n,this.startedCallbacksForDragEndedEmitter=new n,this.endedCallbacksForDragEndedEmitter=new n;var e=_.clone(t);if("phet-io"===i.id){var r=this;e.start=function(e,i){r.startedCallbacksForDragStartedEmitter.emit2(e.pointer.point.x,e.pointer.point.y),t.start&&t.start(e,i),r.endedCallbacksForDragStartedEmitter.emit()},e.drag=function(e,i){r.startedCallbacksForDraggedEmitter.emit2(e.pointer.point.x,e.pointer.point.y),t.drag&&t.drag(e,i),r.endedCallbacksForDraggedEmitter.emit()},e.end=function(e,i){r.startedCallbacksForDragEndedEmitter.emit(),t.end&&t.end(e,i),r.endedCallbacksForDragEndedEmitter.emit()}}s.call(this,e),t.tandem&&t.tandem.addInstance(this),this.disposeTandemDragHandler=function(){t.tandem&&t.tandem.removeInstance(r)}}var i=t("BRAND/Brand"),n=t("AXON/Emitter"),r=t("PHET_CORE/inherit"),s=t("SCENERY/input/SimpleDragHandler"),o=t("SUN/sun");return o.register("TandemDragHandler",e),r(s,e,{dispose:function(){this.disposeTandemDragHandler()}})}),i("SCENERY_PHET/input/MovableDragHandler",["require","DOT/Bounds2","PHET_CORE/inherit","PHETCOMMON/view/ModelViewTransform2","TANDEM/scenery/input/TandemDragHandler","SCENERY_PHET/sceneryPhet"],function(t){"use strict";function e(t,e){var n=this;e=_.extend({dragBounds:i.EVERYTHING,modelViewTransform:r.createIdentity(),startDrag:function(t){},endDrag:function(t){},onDrag:function(t){},allowTouchSnag:!0,targetNode:null,tandem:null},e),this.locationProperty=t,this._dragBounds=e.dragBounds.copy(),this._modelViewTransform=e.modelViewTransform;var o;this.movableDragHandlerStart=function(i){e.startDrag(i);var r=e.targetNode||i.currentTarget,s=n._modelViewTransform.modelToViewPosition(t.get());o=r.globalToParentPoint(i.pointer.point).minus(s)},this.movableDragHandlerDrag=function(i){var r=e.targetNode||i.currentTarget,s=r.globalToParentPoint(i.pointer.point).minus(o),a=n._modelViewTransform.viewToModelPosition(s);a=n._dragBounds.closestPointTo(a),t.set(a),e.onDrag(i)},this.movableDragHandlerEnd=function(t){e.endDrag(t)},s.call(this,{tandem:e.tandem,allowTouchSnag:e.allowTouchSnag,start:this.movableDragHandlerStart,drag:this.movableDragHandlerDrag,end:this.movableDragHandlerEnd})}var i=t("DOT/Bounds2"),n=t("PHET_CORE/inherit"),r=t("PHETCOMMON/view/ModelViewTransform2"),s=t("TANDEM/scenery/input/TandemDragHandler"),o=t("SCENERY_PHET/sceneryPhet");return o.register("MovableDragHandler",e),n(s,e,{setDragBounds:function(t){this._dragBounds=t.copy(),this.locationProperty.set(this._dragBounds.closestPointTo(this.locationProperty.get()))},set dragBounds(t){this.setDragBounds(t)},getDragBounds:function(){return this._dragBounds},get dragBounds(){return this.getDragBounds()},setModelViewTransform:function(t){this._modelViewTransform=t},set modelViewTransform(t){this.setModelViewTransform(t)},getModelViewTransform:function(){return this._modelViewTransform},get modelViewTransform(){return this.getModelViewTransform()},handleForwardedStartEvent:function(t){this.movableDragHandlerStart(t)},handleForwardedDragEvent:function(t){this.movableDragHandlerDrag(t)},handleForwardedEndEvent:function(t){this.movableDragHandlerEnd(t)}})}),i("JOIST/joist",["require","PHET_CORE/Namespace"],function(t){"use strict";var e=t("PHET_CORE/Namespace");return new e("joist")}),i("JOIST/ScreenView",["require","SCENERY/nodes/Node","SCENERY/accessibility/AccessiblePeer","PHET_CORE/inherit","DOT/Bounds2","JOIST/joist","AXON/Property"],function(t){"use strict";function e(t){t=_.extend({layoutBounds:h.copy()},t),this.layoutBounds=t.layoutBounds,n.call(this,_.extend({layerSplit:!0,excludeInvisible:!0,accessibleContent:{createPeer:function(e){return new i(e,t.screenDescription,t.screenLabel)}}},t)),this.visibleBoundsProperty=new l(t.layoutBounds)}function i(t,e,i){this.initialize(t,e,i)}var n=t("SCENERY/nodes/Node"),r=t("SCENERY/accessibility/AccessiblePeer"),s=t("PHET_CORE/inherit"),o=t("DOT/Bounds2"),a=t("JOIST/joist"),l=t("AXON/Property"),h=new o(0,0,1024,618);return a.register("ScreenView",e),s(n,e,{getLayoutScale:function(t,e){return Math.min(t/this.layoutBounds.width,e/this.layoutBounds.height)},layout:function(t,e){this.resetTransform();var i=this.getLayoutScale(t,e);this.setScaleMagnitude(i);var n=0,r=0;i===t/this.layoutBounds.width?r=(e/i-this.layoutBounds.height)/2:i===e/this.layoutBounds.height&&(n=(t/i-this.layoutBounds.width)/2),this.translate(n,r),this.visibleBoundsProperty.set(new o(-n,-r,t/i-n,e/i-r))}},{DEFAULT_LAYOUT_BOUNDS:h,ScreenViewAccessiblePeer:function(t,e,n){return new i(t,e,n)}}),s(r,i,{initialize:function(t,e,i){var n=t.trail,r=n.getUniqueId();this.node=n.lastNode(),this.domElement=document.createElement("div"),this.domElement.className="ScreenView",this.initializeAccessiblePeer(t,this.domElement);var s=document.createElement("header");if(s.setAttribute("role","banner"),this.domElement.appendChild(s),i){var o=document.createElement("h1");o.id="scene-label-"+r,s.setAttribute("aria-labelledby",o.id),o.textContent=i,s.appendChild(o)}if(e){var a=document.createElement("div"),l=document.createElement("p");a.id="scene-descripion-"+r,s.setAttribute("aria-describedby",a.id),l.textContent=e,a.appendChild(l),s.appendChild(a)}this.containerDOMElement=document.createElement("main"),this.containerDOMElement.className="ScreenViewContainer",this.domElement.appendChild(this.containerDOMElement),this.visibilityListener=this.updateVisibility.bind(this),this.node.onStatic("visibility",this.visibilityListener),this.updateVisibility()},updateVisibility:function(){this.domElement.hidden=!this.node.visible},dispose:function(){r.prototype.dispose.call(this),this.node.offStatic("visibility",this.visibilityListener)}},{DEFAULT_LAYOUT_BOUNDS:h}),e}),i("AREA_BUILDER/common/view/ShapeCreatorNode",["require","AREA_BUILDER/areaBuilder","AREA_BUILDER/common/AreaBuilderSharedConstants","DOT/Bounds2","SCENERY/util/Color","AREA_BUILDER/common/view/Grid","PHET_CORE/inherit","SCENERY_PHET/input/MovableDragHandler","AREA_BUILDER/common/model/MovableShape","SCENERY/nodes/Node","SCENERY/nodes/Path","AXON/Property","JOIST/ScreenView","DOT/Vector2"],function(t){"use strict";function e(t,e,i,a){u.call(this,{cursor:"pointer"});var g=this;if(a=_.extend({gridSpacing:null,creationLimit:Number.POSITIVE_INFINITY,shapeDragBounds:r.EVERYTHING,nonMovingAncestor:null},a),a.creationLimit=t.length)throw new Error("Illegal use of function for identifying perimeter segments.");for(var i=t[e],n=(e+1)%t.length,r=t[n],s=Math.atan2(r.y-i.y,r.x-i.x),o=!1;!o&&0!==n;){var a=t[(n+1)%t.length],l=Math.atan2(a.y-r.y,a.x-r.x);s===l?(r=a,n=(n+1)%t.length):o=!0}return{startIndex:e,endIndex:n}}function i(t,i,n,s,l,p){function g(){var t=new c("",{font:m,centerX:i.centerX,centerY:i.centerY});t.visible=!1,y.push(t),C.addChild(t)}function A(){var i;b.fill=t.value.fillColor,v.stroke=t.value.edgeColor;var r=new u;if(t.value.exteriorPerimeters.forEach(function(t){for(r.moveToPoint(t[0]),i=1;iy.length&&_.times(o.length-y.length,g),o.forEach(function(t,e){var i=y[e];i.visible=!0,i.text=t.unitLength;var n,s=new d;0===t.edgeAngle||t.edgeAngle===Math.PI?(s.setXY(0,i.height/2),n=s.plusXY(1,0)):(s.setXY(.8*i.width,0),n=s.plusXY(0,1)),r.containsPoint(t.position.plus(n))&&s.rotate(Math.PI),i.center=t.position.plus(s)})}E.value=!0}}o.call(this);var E=new h(!1),b=new a;this.addChild(b);var S=new r(i,n,{lineDash:[0,3,1,0],stroke:"black"});this.addChild(S);var v=new a(null,{lineWidth:2});this.addChild(v);var C=new o;this.addChild(C);var y=[];_.times(16,g),s.linkAttribute(C,"visible"),h.multilink([l,E],function(t,e){S.visible=t&&e}),t.link(function(){A()}),this.mutate(p)}var n=t("AREA_BUILDER/areaBuilder"),r=t("AREA_BUILDER/common/view/Grid"),s=t("PHET_CORE/inherit"),o=t("SCENERY/nodes/Node"),a=t("SCENERY/nodes/Path"),l=t("SCENERY_PHET/PhetFont"),h=t("AXON/Property"),u=t("KITE/Shape"),c=t("SCENERY/nodes/Text"),d=t("DOT/Vector2"),m=new l({size:14}),f=1e-6;return n.register("PerimeterShapeNode",i),s(o,i)}),i("AREA_BUILDER/common/view/ShapePlacementBoardNode",["require","AREA_BUILDER/areaBuilder","AREA_BUILDER/common/view/Grid","PHET_CORE/inherit","SCENERY/nodes/Node","SCENERY/nodes/Path","AREA_BUILDER/common/view/PerimeterShapeNode","AXON/Property","SCENERY/nodes/Rectangle"],function(t){"use strict";function e(t){s.call(this);var e=h.bounds(t.bounds,{fill:"white",stroke:"black"});this.addChild(e);var i=new n(t.bounds,t.unitSquareLength,{stroke:"#C0C0C0"});this.addChild(i),t.showGridProperty.linkAttribute(i,"visible"),this.backgroundShape=new a(t.backgroundShapeProperty,t.bounds,t.unitSquareLength,t.showDimensionsProperty,t.showGridOnBackgroundShapeProperty),this.addChild(this.backgroundShape);var r=new s;this.addChild(r),t.residentShapes.addItemAddedListener(function(e){if(t.formComposite){var i=new o(e.shape,{fill:e.color,left:e.position.x,top:e.position.y});r.addChild(i),t.residentShapes.addItemRemovedListener(function n(s){s===e&&(r.removeChild(i),t.residentShapes.removeItemRemovedListener(n))})}}),this.addChild(new a(t.compositeShapeProperty,t.bounds,t.unitSquareLength,t.showDimensionsProperty,new l(!0)))}var i=t("AREA_BUILDER/areaBuilder"),n=t("AREA_BUILDER/common/view/Grid"),r=t("PHET_CORE/inherit"),s=t("SCENERY/nodes/Node"),o=t("SCENERY/nodes/Path"),a=t("AREA_BUILDER/common/view/PerimeterShapeNode"),l=t("AXON/Property"),h=t("SCENERY/nodes/Rectangle");return i.register("ShapePlacementBoardNode",e),r(s,e)}),i("AREA_BUILDER/common/view/ShapeNode",["require","AREA_BUILDER/areaBuilder","AREA_BUILDER/common/AreaBuilderSharedConstants","DOT/Bounds2","SCENERY/util/Color","AXON/DerivedProperty","AREA_BUILDER/common/view/Grid","PHET_CORE/inherit","SCENERY_PHET/input/MovableDragHandler","SCENERY/nodes/Node","SCENERY/nodes/Path","DOT/Vector2"],function(t){"use strict";function e(t,e){function i(){l.pickable=!t.animating&&0===t.fadeProportion}u.call(this,{cursor:"pointer"});var l=this;this.color=t.color,this.touchArea=t.shape,this.mouseArea=t.shape;var d=new u;this.addChild(d);var E=new c(t.shape,{fill:m,leftTop:f});d.addChild(E);var b=new c(t.shape,{fill:t.color,stroke:s.toColor(t.color).colorUtilsDarker(n.PERIMETER_DARKEN_FACTOR),lineWidth:1,lineJoin:"round"});d.addChild(b),b.addChild(new a(b.bounds.dilated(-A),g,{lineDash:[0,3,1,0],stroke:"black"})),t.positionProperty.link(function(t){l.leftTop=t});var S=new o([t.userControlledProperty,t.animatingProperty,t.fadeProportionProperty,t.invisibleWhenStillProperty],function(t,e,i,n){return t||e||i>0||!n}),v=new o([t.userControlledProperty,t.animatingProperty,t.fadeProportionProperty],function(t,e,i){return t||e?1:i>0?1-i:p});v.link(function(t){d.opacity=t}),S.link(function(t){d.visible=t});var C=new o([t.userControlledProperty,t.animatingProperty],function(t,e){return t||e});C.linkAttribute(E,"visible"),t.animatingProperty.link(function(){i()}),t.fadeProportionProperty.link(function(t){i()});var y=new r(e.minX,e.minY,e.maxX-t.shape.bounds.width,e.maxY-t.shape.bounds.height);this.addInputListener(new h(t.positionProperty,{dragBounds:y,allowTouchSnag:!0,startDrag:function(e,i){t.userControlled=!0},endDrag:function(e,i){t.userControlled=!1}}))}var i=t("AREA_BUILDER/areaBuilder"),n=t("AREA_BUILDER/common/AreaBuilderSharedConstants"),r=t("DOT/Bounds2"),s=t("SCENERY/util/Color"),o=t("AXON/DerivedProperty"),a=t("AREA_BUILDER/common/view/Grid"),l=t("PHET_CORE/inherit"),h=t("SCENERY_PHET/input/MovableDragHandler"),u=t("SCENERY/nodes/Node"),c=t("SCENERY/nodes/Path"),d=t("DOT/Vector2"),m="rgba( 50, 50, 50, 0.5 )",f=new d(5,5),p=.65,g=n.UNIT_SQUARE_LENGTH,A=1;return i.register("ShapeNode",e),l(u,e)}),i("AREA_BUILDER/explore/view/ExploreNode",["require","AREA_BUILDER/explore/view/AreaAndPerimeterDisplay","AREA_BUILDER/areaBuilder","AREA_BUILDER/common/AreaBuilderSharedConstants","DOT/Bounds2","SCENERY_PHET/bucket/BucketFront","SCENERY_PHET/bucket/BucketHole","SCENERY/util/Color","SCENERY_PHET/buttons/EraserButton","PHET_CORE/inherit","PHETCOMMON/view/ModelViewTransform2","SCENERY/nodes/Node","KITE/Shape","AREA_BUILDER/common/view/ShapeCreatorNode","AREA_BUILDER/common/view/ShapePlacementBoardNode","AREA_BUILDER/common/view/ShapeNode","DOT/Vector2"],function(t){ "use strict";function e(t,e,n,u,c){c=_.extend({shapeDragBounds:s.EVERYTHING,shapesLayer:null},c);var m=l.toColor(t.colorHandled);d.call(this);var A=new d;this.addChild(A);var S;c.shapesLayer?S=c.shapesLayer:(S=new d({layerSplit:!0}),this.addChild(S));var y=new d;this.addChild(y);var w=new d;this.addChild(w);var R=new p(t);A.addChild(R),this.areaAndPerimeterDisplay=new i(t.areaAndPerimeterProperty,m,m.colorUtilsDarker(r.PERIMETER_DARKEN_FACTOR),{centerX:R.centerX,bottom:R.top-E}),this.addChild(this.areaAndPerimeterDisplay);var T=new o(u,b);y.addChild(T);var I=new a(u,b);A.addChild(I),C.forEach(function(t){A.addChild(new f(v,m,e,{left:I.centerX+t.x,top:I.centerY+t.y,shapeDragBounds:c.shapeDragBounds}))}),this.addChild(new h({right:T.right-3,top:T.bottom+5,touchAreaXDilation:5,touchAreaYDilation:5,listener:function(){t.releaseAllShapes("fade")}})),n.addItemAddedListener(function(t){if(t.color.equals(m)){var e=new g(t,c.shapeDragBounds);S.addChild(e),t.userControlledProperty.link(function(t){t&&e.moveToFront()}),n.addItemRemovedListener(function i(r){r===t&&(S.removeChild(e),n.removeItemRemovedListener(i))})}})}var i=t("AREA_BUILDER/explore/view/AreaAndPerimeterDisplay"),n=t("AREA_BUILDER/areaBuilder"),r=t("AREA_BUILDER/common/AreaBuilderSharedConstants"),s=t("DOT/Bounds2"),o=t("SCENERY_PHET/bucket/BucketFront"),a=t("SCENERY_PHET/bucket/BucketHole"),l=t("SCENERY/util/Color"),h=t("SCENERY_PHET/buttons/EraserButton"),u=t("PHET_CORE/inherit"),c=t("PHETCOMMON/view/ModelViewTransform2"),d=t("SCENERY/nodes/Node"),m=t("KITE/Shape"),f=t("AREA_BUILDER/common/view/ShapeCreatorNode"),p=t("AREA_BUILDER/common/view/ShapePlacementBoardNode"),g=t("AREA_BUILDER/common/view/ShapeNode"),A=t("DOT/Vector2"),E=15,b=c.createIdentity(),S=r.UNIT_SQUARE_LENGTH,v=m.rect(0,0,S,S),C=[new A(-20-S/2,0-S/2),new A(-10-S/2,-2-S/2),new A(9-S/2,1-S/2),new A(18-S/2,3-S/2),new A(3-S/2,5-S/2)];return n.register("ExploreNode",e),u(d,e,{reset:function(){this.areaAndPerimeterDisplay.reset()}})}),i("SCENERY_PHET/PhetColorScheme",["require","SCENERY/util/Color","SCENERY_PHET/sceneryPhet"],function(t){"use strict";var e=t("SCENERY/util/Color"),i=t("SCENERY_PHET/sceneryPhet"),n=new e(0,200,0),r=new e(255,85,0),s=new e(0,135,0),o=new e(236,153,55),a={ACCELERATION:e.GREEN,APPLIED_FORCE:o,ELASTIC_ENERGY:new e(153,51,102),FRICTION_FORCE:r,GRAVITATIONAL_FORCE:new e(50,130,215),HEAT_THERMAL_ENERGY:r,IMAGINARY_PART:new e(153,51,102),KINETIC_ENERGY:e.GREEN,NET_WORK:n,NORMAL_FORCE:new e(255,235,0),POSITION:e.BLUE,POTENTIAL_ENERGY:e.BLUE,REAL_PART:new e(255,153,0),RED_COLORBLIND:r,RESET_ALL_BUTTON_BASE_COLOR:new e(247,151,34),GREEN_COLORBLIND:s,TOTAL_ENERGY:o,TOTAL_FORCE:n,VELOCITY:r,WALL_FORCE:new e(153,51,0)};return i.register("PhetColorScheme",a),a}),i("SCENERY_PHET/ResetShape",["require","PHET_CORE/inherit","KITE/Shape","SCENERY_PHET/sceneryPhet"],function(t){"use strict";function e(t){n.call(this);var e=.4*t,i=.625*t,r=2.25*(i-e),s=.35*-Math.PI,o=-2*Math.PI*.85,a=.18*-Math.PI;this.moveTo(e*Math.cos(s),e*Math.sin(s)),this.lineTo(i*Math.cos(s),i*Math.sin(s));var l=s+o;this.arc(0,0,i,s,l,!0);var h=(r-(i-e))/2;this.lineTo((i+h)*Math.cos(l),(i+h)*Math.sin(l));var u=.55*(i+e);this.lineTo(u*Math.cos(l+a),u*Math.sin(l+a)),this.lineTo((e-h)*Math.cos(l),(e-h)*Math.sin(l)),this.lineTo(e*Math.cos(l),e*Math.sin(l)),this.arc(0,0,e,l,s),this.close()}var i=t("PHET_CORE/inherit"),n=t("KITE/Shape"),r=t("SCENERY_PHET/sceneryPhet");return r.register("ResetShape",e),i(n,e)}),i("SCENERY/nodes/Circle",["require","PHET_CORE/inherit","SCENERY/scenery","DOT/Bounds2","DOT/Matrix3","SCENERY/nodes/Path","KITE/Shape","SCENERY/util/Features","SCENERY/nodes/Paintable","SCENERY/display/DOMSelfDrawable","SCENERY/display/SVGSelfDrawable","SCENERY/display/CanvasSelfDrawable","SCENERY/display/SelfDrawable","SCENERY/display/Renderer","SCENERY/util/Util"],function(t){"use strict";function e(t,e){"object"==typeof t?(e=t,this._radius=e.radius):(this._radius=t,e=e||{}),o.call(this,null,e)}var i=t("PHET_CORE/inherit"),n=t("SCENERY/scenery"),r=t("DOT/Bounds2"),s=t("DOT/Matrix3"),o=t("SCENERY/nodes/Path"),a=t("KITE/Shape"),l=t("SCENERY/util/Features"),h=t("SCENERY/nodes/Paintable"),u=t("SCENERY/display/DOMSelfDrawable"),c=t("SCENERY/display/SVGSelfDrawable"),d=t("SCENERY/display/CanvasSelfDrawable"),m=t("SCENERY/display/SelfDrawable"),f=t("SCENERY/display/Renderer");t("SCENERY/util/Util");var p=!0,g=!0;return n.register("Circle",e),i(o,e,{getStrokeRendererBitmask:function(){var t=o.prototype.getStrokeRendererBitmask.call(this);return this.hasStroke()&&!this.getStroke().isGradient&&!this.getStroke().isPattern&&this.getLineWidth()<=this.getRadius()&&(t|=f.bitmaskDOM),t},getPathRendererBitmask:function(){return f.bitmaskCanvas|f.bitmaskSVG|(l.borderRadius?f.bitmaskDOM:0)},invalidateCircle:function(){this._shape=null,this.invalidatePath()},createCircleShape:function(){return a.circle(0,0,this._radius)},intersectsBoundsSelf:function(t){var e=Math.abs(t.centerX),i=Math.abs(t.centerY),n=t.maxX-e,r=t.maxY-i;return e>n+this._radius||i>r+this._radius?!1:n>=e||r>=i?!0:(e-=n,i-=r,e*e+i*i<=this._radius*this._radius)},canvasPaintSelf:function(t){e.CircleCanvasDrawable.prototype.paintCanvas(t,this)},createDOMDrawable:function(t,i){return e.CircleDOMDrawable.createFromPool(t,i)},createSVGDrawable:function(t,i){return e.CircleSVGDrawable.createFromPool(t,i)},createCanvasDrawable:function(t,i){return e.CircleCanvasDrawable.createFromPool(t,i)},createWebGLDrawable:function(t,i){return e.CircleWebGLDrawable.createFromPool(t,i)},getBasicConstructor:function(t){return"new scenery.Circle( "+this._radius+", {"+t+"} )"},getRadius:function(){return this._radius},setRadius:function(t){if(this._radius!==t){this._radius=t,this.invalidateCircle();for(var e=this._drawables.length,i=0;e>i;i++)this._drawables[i].markDirtyRadius()}return this},computeShapeBounds:function(){var t=new r(-this._radius,-this._radius,this._radius,this._radius);return this._stroke&&(t=t.dilated(this.getLineWidth()/2)),t},containsPointSelf:function(t){var e,i=t.x*t.x+t.y*t.y,n=!0;if(this._strokePickable){e=this.getLineWidth()/2;var r=this._radius+e;n=n&&r*r>=i}if(this._fillPickable)return this._strokePickable?n:i<=this._radius*this._radius;if(this._strokePickable){var s=this._radius-e;return n&&i>=s*s}return!1},get radius(){return this.getRadius()},set radius(t){return this.setRadius(t)},setShape:function(t){if(null!==t)throw new Error("Cannot set the shape of a scenery.Circle to something non-null");this.invalidatePath()},getShape:function(){return this._shape||(this._shape=this.createCircleShape()),this._shape},hasShape:function(){return!0}}),e.prototype._mutatorKeys=["radius"].concat(o.prototype._mutatorKeys),e.CircleStatefulDrawable={mixin:function(t){var e=t.prototype;e.initializeState=function(t,e){return this.paintDirty=!0,this.dirtyRadius=!0,this.initializePaintableState(t,e),this},e.disposeState=function(){this.disposePaintableState()},e.markPaintDirty=function(){this.paintDirty=!0,this.markDirty()},e.markDirtyRadius=function(){this.dirtyRadius=!0,this.markPaintDirty()},e.setToCleanState=function(){this.paintDirty=!1,this.dirtyRadius=!1},h.PaintableStatefulDrawable.mixin(t)}},e.CircleDOMDrawable=function(t,e){this.initialize(t,e)},i(u,e.CircleDOMDrawable,{initialize:function(t,e){if(this.initializeDOMSelfDrawable(t,e),this.initializeState(t,e),this.matrix||(this.matrix=s.dirtyFromPool()),!this.fillElement||!this.strokeElement){var i=this.fillElement=document.createElement("div"),r=this.strokeElement=document.createElement("div");i.style.display="block",i.style.position="absolute",i.style.left="0",i.style.top="0",i.style.pointerEvents="none",r.style.display="block",r.style.position="absolute",r.style.left="0",r.style.top="0",r.style.pointerEvents="none",i.appendChild(r)}return this.domElement=this.fillElement,n.Util.prepareForTransform(this.domElement,this.forceAcceleration),this},updateDOM:function(){var t=this.node,e=this.fillElement,i=this.strokeElement;if(this.paintDirty&&(this.dirtyRadius&&(e.style.width=2*t._radius+"px",e.style.height=2*t._radius+"px",e.style[l.borderRadius]=t._radius+"px"),this.dirtyFill&&(e.style.backgroundColor=t.getCSSFill()),this.dirtyStroke&&(t.hasStroke()?i.style.borderStyle="solid":i.style.borderStyle="none"),t.hasStroke())){var r=null===this.lastStroke;(r||this.dirtyLineWidth||this.dirtyRadius)&&(i.style.width=2*t._radius-t.getLineWidth()+"px",i.style.height=2*t._radius-t.getLineWidth()+"px",i.style[l.borderRadius]=t._radius+t.getLineWidth()/2+"px"),(r||this.dirtyLineWidth)&&(i.style.left=-t.getLineWidth()/2+"px",i.style.top=-t.getLineWidth()/2+"px",i.style.borderWidth=t.getLineWidth()+"px"),(r||this.dirtyStroke)&&(i.style.borderColor=t.getSimpleCSSStroke())}if(this.transformDirty||this.dirtyRadius){this.matrix.set(this.getTransformMatrix());var o=s.translation(-t._radius,-t._radius);this.matrix.multiplyMatrix(o),o.freeToPool(),n.Util.applyPreparedTransform(this.matrix,this.fillElement,this.forceAcceleration)}this.setToClean()},setToClean:function(){this.setToCleanState(),this.cleanPaintableState(),this.transformDirty=!1},dispose:function(){this.disposeState(),p||(this.fillElement=null,this.strokeElement=null,this.domElement=null),u.prototype.dispose.call(this)}}),e.CircleStatefulDrawable.mixin(e.CircleDOMDrawable),m.Poolable.mixin(e.CircleDOMDrawable),e.CircleSVGDrawable=function(t,e){this.initialize(t,e)},i(c,e.CircleSVGDrawable,{initialize:function(t,e){return this.initializeSVGSelfDrawable(t,e,!0,g),this.svgElement||(this.svgElement=document.createElementNS(n.svgns,"circle")),this},updateSVGSelf:function(){var t=this.svgElement;this.dirtyRadius&&t.setAttribute("r",this.node._radius),this.updateFillStrokeStyle(t)}}),e.CircleStatefulDrawable.mixin(e.CircleSVGDrawable),m.Poolable.mixin(e.CircleSVGDrawable),e.CircleCanvasDrawable=function(t,e){this.initialize(t,e)},i(d,e.CircleCanvasDrawable,{initialize:function(t,e){return this.initializeCanvasSelfDrawable(t,e),this.initializePaintableStateless(t,e),this},paintCanvas:function(t,e){var i=t.context;i.beginPath(),i.arc(0,0,e._radius,0,2*Math.PI,!1),i.closePath(),e.hasFill()&&(e.beforeCanvasFill(t),i.fill(),e.afterCanvasFill(t)),e.hasStroke()&&(e.beforeCanvasStroke(t),i.stroke(),e.afterCanvasStroke(t))},markDirtyRadius:function(){this.markPaintDirty()},dispose:function(){d.prototype.dispose.call(this),this.disposePaintableStateless()}}),h.PaintableStatelessDrawable.mixin(e.CircleCanvasDrawable),m.Poolable.mixin(e.CircleCanvasDrawable),e}),i("SCENERY/util/RadialGradient",["require","SCENERY/scenery","PHET_CORE/inherit","PHET_CORE/platform","DOT/Vector2","SCENERY/util/Gradient"],function(t){"use strict";function e(t,e,n,a,l,h){if(this.start=new s(t,e),this.end=new s(a,l),r.safari){var u=(t+a)/2,c=(e+l)/2;this.start.x=u,this.start.y=c,this.end.x=u,this.end.y=c}this.startRadius=n,this.endRadius=h,this.focalPoint=this.start.plus(this.end.minus(this.start).times(this.startRadius/(this.startRadius-this.endRadius))),this.startRadius>=this.endRadius,o.call(this,i.scratchContext.createRadialGradient(t,e,n,a,l,h))}var i=t("SCENERY/scenery"),n=t("PHET_CORE/inherit"),r=t("PHET_CORE/platform"),s=t("DOT/Vector2"),o=t("SCENERY/util/Gradient");return i.register("RadialGradient",e),n(o,e,{isRadialGradient:!0,getSVGDefinition:function(){function t(t,e,i,n,r){return i+(r-t)*(n-i)/(e-t)}function e(e){var r=n?1-e.ratio:e.ratio;o>0&&(r=t(0,1,o/s,1,r));var l=document.createElementNS(i.svgns,"stop");l.setAttribute("offset",r),l.setAttribute("style","stop-color: "+e.color.withAlpha(1).toCSS()+"; stop-opacity: "+e.color.a.toFixed(20)+";"),a.appendChild(l)}var n=this.startRadius>this.endRadius,r=n?this.start:this.end,s=Math.max(this.startRadius,this.endRadius),o=Math.min(this.startRadius,this.endRadius),a=document.createElementNS(i.svgns,"radialGradient");a.setAttribute("gradientUnits","userSpaceOnUse"),a.setAttribute("cx",r.x),a.setAttribute("cy",r.y),a.setAttribute("r",s),a.setAttribute("fx",this.focalPoint.x),a.setAttribute("fy",this.focalPoint.y),this.transformMatrix&&a.setAttribute("gradientTransform",this.transformMatrix.getSVGTransform());var l;if(n)for(l=this.stops.length-1;l>=0;l--)e(this.stops[l]);else for(l=0;lf||t.shape.bounds.height>f)&&(t.animating?t.animatingProperty.once(function(i){!i&&e.shapePlacementBoard.isResidentShape(t)&&e.replaceShapeWithUnitSquares(t)}):e.replaceShapeWithUnitSquares(t)):t.returnToOrigin(!0))}),t.on("returnedToOrigin",function(){t.userControlled||e.movableShapes.remove(t)}),t.on("fadedAway",function(){e.movableShapes.remove(t)})},addUnitSquareDirectlyToBoard:function(t,e,i){var n=this,r=new h(g,i,this.solutionShapeOrigin);this.movableShapes.push(r),r.on("returnedToOrigin",function(){r.userControlled||n.movableShapes.remove(r)}),this.shapePlacementBoard.addShapeDirectlyToCell(t,e,r)},clearShapePlacementBoard:function(){this.shapePlacementBoard.releaseAllShapes("jumpHome")},startLevel:function(){this.shapePlacementBoard.showDimensionsProperty.value=!1,this.shapePlacementBoard.showGridProperty.value=!1},displayCorrectAnswer:function(t){var e=this;t.buildSpec?(this.clearShapePlacementBoard(),this.shapePlacementBoard.suspendUpdatesForBlockAdd(),t.exampleBuildItSolution.forEach(function(t){e.addUnitSquareDirectlyToBoard(t.cellColumn,t.cellRow,t.color)})):"areaEntered"===t.checkSpec&&(this.shapePlacementBoard.showGridOnBackgroundShape=!0)},checkAnswer:function(t){var e,i=!1;switch(t.checkSpec){case"areaEntered":i=this.areaGuess===t.backgroundShape.unitArea;break;case"areaConstructed":i=t.buildSpec.area===this.shapePlacementBoard.areaAndPerimeter.area;break;case"areaAndPerimeterConstructed":i=t.buildSpec.area===this.shapePlacementBoard.areaAndPerimeter.area&&t.buildSpec.perimeter===this.shapePlacementBoard.areaAndPerimeter.perimeter;break;case"areaAndProportionConstructed":e=new r(this.shapePlacementBoard.areaAndPerimeter.area,null,{color1:t.buildSpec.proportions.color1,color2:t.buildSpec.proportions.color2,color1Proportion:this.getProportionOfColor(t.buildSpec.proportions.color1)}),i=e.equals(t.buildSpec);break;case"areaPerimeterAndProportionConstructed":e=new r(this.shapePlacementBoard.areaAndPerimeter.area,this.shapePlacementBoard.areaAndPerimeter.perimeter,{color1:t.buildSpec.proportions.color1,color2:t.buildSpec.proportions.color2,color1Proportion:this.getProportionOfColor(t.buildSpec.proportions.color1)}),i=e.equals(t.buildSpec);break;default:i=!1}return i},tryAgain:function(){},getProportionOfColor:function(t){return this.shapePlacementBoard.getProportionOfColor(t)},setChallenge:function(t){if(t&&(this.shapePlacementBoard.setBackgroundShape(t.backgroundShape,!0),this.shapePlacementBoard.showGridOnBackgroundShape=!1,this.shapePlacementBoard.formComposite=null===t.backgroundShape,t.buildSpec&&this.shapePlacementBoard.formComposite&&t.userShapes)){var e,i=s.toColor(t.userShapes[0].color).colorUtilsDarker(n.PERIMETER_DARKEN_FACTOR);e=t.buildSpec.proportions?null:t.userShapes[0].color,this.shapePlacementBoard.setCompositeShapeColorScheme(e,i)}},step:function(t){this.movableShapes.forEach(function(e){e.step(t)})},reset:function(){this.shapePlacementBoard.releaseAllShapes("jumpHome"),this.movableShapes.clear()}},{SHAPE_BOARD_UNIT_WIDTH:p.width/f,SHAPE_BOARD_UNIT_HEIGHT:p.height/f,UNIT_SQUARE_LENGTH:f})}),i("AREA_BUILDER/game/model/AreaBuilderChallengeFactory",["require","AREA_BUILDER/areaBuilder","AREA_BUILDER/common/AreaBuilderSharedConstants","AREA_BUILDER/game/model/AreaBuilderGameChallenge","AREA_BUILDER/game/model/AreaBuilderGameModel","SCENERY/util/Color","PHETCOMMON/model/Fraction","AREA_BUILDER/common/model/PerimeterShape","KITE/Shape","DOT/Util","DOT/Vector2"],function(t){"use strict";function e(t){return t[Math.floor(Math.random()*t.length)]}function i(t,e,i,n,r){for(var s=[],o=0;i>o;o++)for(var a=0;n>a;a++)s.push({cellColumn:o+t,cellRow:a+e,color:r});return s}function n(t,e,i,n,r,s,o){for(var a=[],l=0;n>l;l++)for(var h=0;i>h;h++)a.push({cellColumn:h+t,cellRow:l+e,color:o>(l*i+h)/(i*n)?r:s});return a}function r(t){var e=[];return nt.forEach(function(i){e.push({shape:i.shape,color:t})}),e}function s(t,e){var i=[];return nt.forEach(function(n){var r={shape:n.shape,color:t};i.push(r);var s={shape:n.shape,color:e};i.push(s)}),i}function o(t){var e=[],i=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.forEach(function(t){i=Math.min(t.x,i),n=Math.max(t.x,n)}),t.forEach(function(t){e.push(new X(-1*(t.x-i-n),t.y))}),e}function a(t){var e=[],i=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.forEach(function(t){i=Math.min(t.y,i),n=Math.max(t.y,n)}),t.forEach(function(t){e.push(new X(t.x,-1*(t.y-i-n)))}),e}function l(t,e,i,n,r){return new G([[new X(t,e),new X(t+i,e),new X(t+i,e+n),new X(t,e+n)]],[],W,{fillColor:r,edgeColor:r.colorUtilsDarker(q.PERIMETER_DARKEN_FACTOR)})}function h(t,e,i,n,r,s,l,h){var u=[new X(t+s,e),new X(t+i,e),new X(t+i,e+n),new X(t,e+n),new X(t,e+l),new X(t+s,e+l)];return("rightTop"===r||"rightBottom"===r)&&(u=o(u)),("leftBottom"===r||"rightBottom"===r)&&(u=a(u)),new G([u],[],W,{fillColor:h,edgeColor:h.colorUtilsDarker(q.PERIMETER_DARKEN_FACTOR)})}function u(t,e,i,n,r,s,l,h,u){var c=[new X,new X,new X,new X,new X,new X,new X,new X];return"left"===r||"right"===r?(c[0].setXY(t,e),c[1].setXY(t+i,e),c[2].setXY(t+i,e+n),c[3].setXY(t,e+n),c[4].setXY(t,e+h+l),c[5].setXY(t+s,e+h+l),c[6].setXY(t+s,e+h),c[7].setXY(t,e+h),"right"===r&&(c=o(c))):(c[0].setXY(t,e),c[1].setXY(t+h,e),c[2].setXY(t+h,e+l),c[3].setXY(t+h+s,e+l),c[4].setXY(t+h+s,e),c[5].setXY(t+i,e),c[6].setXY(t+i,e+n),c[7].setXY(t,e+n),"bottom"===r&&(c=a(c))),new G([c],[],W,{fillColor:u,edgeColor:u.colorUtilsDarker(q.PERIMETER_DARKEN_FACTOR)})}function c(t,e,i,n,r,s,o,a,l){var h=[new X(t,e),new X(t+i,e),new X(t+i,e+n),new X(t,e+n)],u=[new X(t+o,e+a),new X(t+o,e+a+s),new X(t+o+r,e+a+s),new X(t+o+r,e+a)];return new G([h],[u],W,{fillColor:l,edgeColor:l.colorUtilsDarker(q.PERIMETER_DARKEN_FACTOR)})}function d(t,e,i,n,r){var s=[new X(t,e),new X(t+i,e),new X(t,e+i)];return("rightTop"===n||"rightBottom"===n)&&(s=o(s)),("leftBottom"===n||"rightBottom"===n)&&(s=a(s)),new G([s],[],W,{fillColor:r,edgeColor:r.colorUtilsDarker(q.PERIMETER_DARKEN_FACTOR)})}function m(t,e,i,n,r){var s;return"centerTop"===n||"centerBottom"===n?(s=[new X(t,e),new X(t+i,e),new X(t+i/2,e+i/2)],"centerBottom"===n&&(s=a(s))):(s=[new X(t,e),new X(t,e+i),new X(t+i/2,e+i/2)],"centerLeft"===n&&(s=o(s))),("centerTop"===n||"rightBottom"===n)&&(s=o(s)),("leftBottom"===n||"rightBottom"===n)&&(s=a(s)),new G([s],[],W,{fillColor:r,edgeColor:r.colorUtilsDarker(q.PERIMETER_DARKEN_FACTOR)})}function f(t,e,i,n,r,s,l,h,u){var c=[];return c.push(new X(t+i,e)),c.push(new X(t+i,e+n-s)),c.push(new X(t+i-s,e+n)),c.push(new X(t,e+n)),c.push(new X(t,e+h)),c.push(new X(t+l,e+h)),c.push(new X(t+l,e)),("leftTop"===r||"leftBottom"===r)&&(c=o(c)),("rightTop"===r||"leftTop"===r)&&(c=a(c)),new G([c],[],W,{fillColor:u,edgeColor:u.colorUtilsDarker(q.PERIMETER_DARKEN_FACTOR)})}function p(t,e){if(t.buildSpec&&e.buildSpec){if(t.buildSpec.proportions&&e.buildSpec.proportions){if(t.buildSpec.proportions.color1Proportion.denominator===e.buildSpec.proportions.color1Proportion.denominator&&(t.buildSpec.perimeter&&e.buildSpec.perimeter||!t.buildSpec.perimeter&&!e.buildSpec.perimeter))return!0}else if(!t.buildSpec.proportions&&!t.buildSpec.proportions&&t.buildSpec.area===e.buildSpec.area)return!0}else if(t.backgroundShape&&e.backgroundShape&&t.backgroundShape.unitArea===e.backgroundShape.unitArea)return!0;return!1}function g(t){for(var e=!0,i=0;ie*n||e*n>36;)n=_.random(H.SHAPE_BOARD_UNIT_HEIGHT-2);var s=ot.nextColor(),o=i(Math.floor((H.SHAPE_BOARD_UNIT_WIDTH-e)/2),Math.floor((H.SHAPE_BOARD_UNIT_HEIGHT-n)/2),e,n,s);return t=V.createBuildAreaChallenge(e*n,r(s),o)}function E(){var t,e=_.random(2,6);do t=_.random(1,4);while(e%2===t%2);var n=0;do n=_.random(1,6);while(e+n>H.SHAPE_BOARD_UNIT_WIDTH-2);var s;do s=_.random(1,6);while(n%2===s%2||t+s>H.SHAPE_BOARD_UNIT_HEIGHT-2);var o=_.random(1,Math.min(e,n)-1),a=Math.floor((H.SHAPE_BOARD_UNIT_WIDTH-(e+n-o))/2),l=Math.floor((H.SHAPE_BOARD_UNIT_HEIGHT-(t+s))/2),h=ot.nextColor(),u=i(a,l,e,t,h).concat(i(a+e-o,l+t,n,s,h));return V.createBuildAreaAndPerimeterChallenge(e*t+n*s,2*e+2*t+2*n+2*s-2*o,r(h),u)}function b(){var t,e;do t=_.random(3,8);while(0===t||7===t);do e=_.random(3,8);while(12>t*e||t*e>36||7===e||e>H.SHAPE_BOARD_UNIT_HEIGHT-2);var n=ot.nextColor(),s=i(Math.floor((H.SHAPE_BOARD_UNIT_WIDTH-t)/2),Math.floor((H.SHAPE_BOARD_UNIT_HEIGHT-e)/2),t,e,n);return V.createBuildAreaAndPerimeterChallenge(t*e,2*t+2*e,r(n),s)}function S(){var t,e;do t=_.random(2,H.SHAPE_BOARD_UNIT_WIDTH-4),e=_.random(2,H.SHAPE_BOARD_UNIT_HEIGHT-4);while(16>t*e||t*e>36);var i=l(0,0,t*W,e*W,st.nextColor());return V.createFindAreaChallenge(i,nt)}function v(){var t,i;do t=_.random(2,H.SHAPE_BOARD_UNIT_WIDTH-4),i=_.random(2,H.SHAPE_BOARD_UNIT_HEIGHT-4);while(16>t*i||t*i>36);var n=_.random(1,t-1),r=_.random(1,i-1),s=e(["leftTop","rightTop","leftBottom","rightBottom"]),o=h(0,0,t*W,i*W,s,n*W,r*W,st.nextColor());return V.createFindAreaChallenge(o,nt)}function C(){var t,i;do t=_.random(4,H.SHAPE_BOARD_UNIT_WIDTH-4),i=_.random(4,H.SHAPE_BOARD_UNIT_HEIGHT-2);while(16>t*i||t*i>36);var n,r,s,o=e(["left","right","top","bottom"]);"left"===o||"right"===o?(n=_.random(2,t-1),r=_.random(1,i-2),s=_.random(1,i-r-1)):(n=_.random(1,t-2),r=_.random(2,i-1),s=_.random(1,t-n-1));var a=u(0,0,t*W,i*W,o,n*W,r*W,s*W,st.nextColor());return V.createFindAreaChallenge(a,nt)}function y(){var t,e;do t=_.random(3,H.SHAPE_BOARD_UNIT_WIDTH-4),e=_.random(3,H.SHAPE_BOARD_UNIT_HEIGHT-2);while(16>t*e||t*e>36);var i=_.random(1,t-2),n=_.random(1,e-2),r=_.random(1,t-i-1),s=_.random(1,e-n-1),o=c(0,0,t*W,e*W,i*W,n*W,r*W,s*W,st.nextColor());return V.createFindAreaChallenge(o,nt)}function w(){var t=e(["leftTop","rightTop","rightBottom","leftBottom"]),i=0;do i=_.random(4,Math.min(H.SHAPE_BOARD_UNIT_WIDTH-2,H.SHAPE_BOARD_UNIT_HEIGHT-2));while(i%2!==0);var n=d(0,0,i*W,t,st.nextColor());return V.createFindAreaChallenge(n,rt)}function R(){var t,i=e(["centerTop","rightCenter","centerBottom","leftCenter"]),n=0;t="centerTop"===i||"centerBottom"===i?H.SHAPE_BOARD_UNIT_WIDTH-4:H.SHAPE_BOARD_UNIT_HEIGHT-2;do n=_.random(2,t);while(n%2!==0);var r=m(0,0,n*W,i,st.nextColor());return V.createFindAreaChallenge(r,rt)}function T(){var t,i,n,r=_.random(H.SHAPE_BOARD_UNIT_WIDTH-4,H.SHAPE_BOARD_UNIT_WIDTH-2),s=_.random(H.SHAPE_BOARD_UNIT_HEIGHT-3,H.SHAPE_BOARD_UNIT_HEIGHT-2),o=e(["left","right","top","bottom"]);"left"===o||"right"===o?(t=1,i=_.random(1,3),n=_.random(1,s-i-1)):(t=_.random(1,3),i=1,n=_.random(1,r-t-1));var a=u(0,0,r*W,s*W,o,t*W,i*W,n*W,st.nextColor());return V.createFindAreaChallenge(a,nt)}function I(){var t,e,i=_.random(H.SHAPE_BOARD_UNIT_WIDTH-4,H.SHAPE_BOARD_UNIT_WIDTH-2),n=_.random(H.SHAPE_BOARD_UNIT_HEIGHT-3,H.SHAPE_BOARD_UNIT_HEIGHT-2);Math.random()<.5?(t=_.random(1,3),e=1):(e=_.random(1,3),t=1);var r=_.random(1,i-t-1),s=_.random(1,n-e-1),o=c(0,0,i*W,n*W,t*W,e*W,r*W,s*W,st.nextColor());return V.createFindAreaChallenge(o,nt)}function N(){return Math.random()<.7?T():I()}function P(){var t=_.random(3,H.SHAPE_BOARD_UNIT_WIDTH-4),i=_.random(3,H.SHAPE_BOARD_UNIT_HEIGHT-4),n=e(["leftTop","rightTop","leftBottom","rightBottom"]),r=2;i>4&&t>4&&Math.random()>.5&&(r=4);var s=_.random(1,t-r),o=_.random(1,i-r),a=f(0,0,t*W,i*W,n,r*W,s*W,o*W,st.nextColor());return V.createFindAreaChallenge(a,rt)}function D(){return x("easy",!1)}function B(){return x("harder",!1)}function x(t,i){var r,o,a=[];do{o=_.random(3,6),r=3===o?_.random(4,8):_.random(2,10);for(var l="easy"===t?2:5,h="easy"===t?4:9,u=r*o,c=l;h>=c;c++)u%c===0&&a.push(c)}while(0===a.length);var d,m=e(a);do d=_.random(1,m-1);while(j.gcd(d,m)>1);var f=new F(d,m),p=at.nextColorPair(),g=n(Math.floor((H.SHAPE_BOARD_UNIT_WIDTH-r)/2),Math.floor((H.SHAPE_BOARD_UNIT_HEIGHT-o)/2),r,o,p.color1,p.color2,f.getValue()),A=s(p.color1,p.color2);return i?V.createTwoToneBuildAreaAndPerimeterChallenge(r*o,2*r+2*o,p.color1,p.color2,f,A,g):V.createTwoToneBuildAreaChallenge(r*o,p.color1,p.color2,f,A,g)}function O(){return x("easy",!0)}function k(){return x("harder",!0)}function L(t){for(var e,i=!1,n=0;!i;)e=t(),n++,i=g(e),n>12&&!i&&(lt=lt.slice(0,lt.length/2),n=0);return lt.push(e),e}function Y(t){t.toolSpec.gridControl=!1,t.userShapes=[{shape:Q,color:q.GREENISH_COLOR}];var e=new G(t.backgroundShape.exteriorPerimeters,[],W);return t.userShapes[0].creationLimit=Math.max(e.getWidth()/W,e.getHeight()/W),t}var M=t("AREA_BUILDER/areaBuilder"),q=t("AREA_BUILDER/common/AreaBuilderSharedConstants"),V=t("AREA_BUILDER/game/model/AreaBuilderGameChallenge"),H=t("AREA_BUILDER/game/model/AreaBuilderGameModel"),U=t("SCENERY/util/Color"),F=t("PHETCOMMON/model/Fraction"),G=t("AREA_BUILDER/common/model/PerimeterShape"),z=t("KITE/Shape"),j=t("DOT/Util"),X=t("DOT/Vector2"),W=q.UNIT_SQUARE_LENGTH,Q=(new z).moveTo(0,0).lineTo(W,0).lineTo(W,W).lineTo(0,W).close(),J=(new z).moveTo(0,0).lineTo(2*W,0).lineTo(2*W,W).lineTo(0,W).close(),K=(new z).moveTo(0,0).lineTo(W,0).lineTo(W,2*W).lineTo(0,2*W).close(),Z=(new z).moveTo(0,0).lineTo(2*W,0).lineTo(2*W,2*W).lineTo(0,2*W).close(),$=(new z).moveTo(W,0).lineTo(W,W).lineTo(0,W).lineTo(W,0).close(),tt=(new z).moveTo(0,0).lineTo(W,W).lineTo(0,W).lineTo(0,0).close(),et=(new z).moveTo(0,0).lineTo(W,0).lineTo(W,W).lineTo(0,0).close(),it=(new z).moveTo(0,0).lineTo(W,0).lineTo(0,W).lineTo(0,0).close(),nt=[{shape:Q,color:q.GREENISH_COLOR},{shape:J,color:q.GREENISH_COLOR},{shape:K,color:q.GREENISH_COLOR},{shape:Z,color:q.GREENISH_COLOR}],rt=[{shape:J,color:q.GREENISH_COLOR},{shape:Q,color:q.GREENISH_COLOR},{shape:K,color:q.GREENISH_COLOR},{shape:tt,color:q.GREENISH_COLOR},{shape:it,color:q.GREENISH_COLOR},{shape:$,color:q.GREENISH_COLOR},{shape:et,color:q.GREENISH_COLOR}],st={colorList:_.shuffle([new U(q.PALE_BLUE_COLOR),new U(q.PINKISH_COLOR),new U(q.PURPLISH_COLOR),new U(q.ORANGISH_COLOR),new U(q.DARK_GREEN_COLOR)]),index:0,nextColor:function(){if(this.index>=this.colorList.length){var t=this.colorList[this.colorList.length-1];do this.colorList=_.shuffle(this.colorList);while(this.colorList[0]===t);this.index=0}return this.colorList[this.index++]}},ot={colorList:_.shuffle([new U(q.GREENISH_COLOR),new U(q.PINKISH_COLOR),new U(q.ORANGISH_COLOR),new U(q.PALE_BLUE_COLOR)]),index:0,nextColor:function(){if(this.index>=this.colorList.length){var t=this.colorList[this.colorList.length-1];do this.colorList=_.shuffle(this.colorList);while(this.colorList[0]===t);this.index=0}return this.colorList[this.index++]}},at={colorPairList:_.shuffle([{color1:q.GREENISH_COLOR,color2:q.DARK_GREEN_COLOR},{color1:q.PURPLISH_COLOR,color2:q.DARK_PURPLE_COLOR},{color1:q.PALE_BLUE_COLOR,color2:q.DARK_BLUE_COLOR},{color1:q.PINKISH_COLOR,color2:q.PURPLE_PINK_COLOR}]),index:0,nextColorPair:function(){if(this.index>=this.colorPairList.length){var t=this.colorPairList[this.colorPairList.length-1];do this.colorPairList=_.shuffle(this.colorPairList);while(this.colorPairList[0]===t);this.index=0}return this.colorPairList[this.index++]}},lt=[],ht={generateChallengeSet:function(t,i){var n,r=[];switch(t){case 0:_.times(3,function(){r.push(L(A))}),_.times(2,function(){r.push(L(S))}),r.push(L(v));break;case 1:_.times(3,function(){r.push(L(b))}),_.times(3,function(){r.push(L(E))});break;case 2:r.push(L(C)),r.push(L(y)),r.push(L(P)),r=_.shuffle(r);var s=_.shuffle([L(R),L(w)]);s.forEach(function(t){r.push(t)}),r.push(L(N));break;case 3:r.push(Y(L(C))),r.push(Y(L(y))),r.push(Y(L(y))),r.push(Y(L(P))),r=_.shuffle(r),n=L(e([v,C])),n.toolSpec.gridControl=!1,n.userShapes=null,r.push(n),n=L(P),n.toolSpec.gridControl=!1,n.userShapes=null,r.push(n);break;case 4:_.times(3,function(){r.push(L(D))}),_.times(3,function(){r.push(L(B))});break;case 5:_.times(3,function(){r.push(L(O))}),_.times(3,function(){r.push(L(k))});break;default:throw new Error("Unsupported game level: "+t)}return r}};return M.register("AreaBuilderChallengeFactory",ht),ht}),i("PHETCOMMON/util/StringUtils",["require","PHETCOMMON/phetcommon"],function(t){"use strict";var e=t("PHETCOMMON/phetcommon"),i="‪",n="‫",r="‬",s={format:function(t){var e=arguments;return t.replace(/{(\d)}/g,function(t,i){return e[+i+1]})},isEmbeddingMark:function(t){return t===i||t===n||t===r},embeddedSlice:function(t,e,o){var a,l=[];for(void 0===o&&(o=t.length),0>o&&(o+=t.length);e=1&&s.isEmbeddingMark(t.charAt(o-1));)o--;if(e>=o||e>=t.length)return"";for(var h=0;e>h;h++)a=t.charAt(h),a===i||a===n?l.push(a):a===r&&l.pop();for(var u=l.length,c=l.slice(),d=t.slice(e,o),m=0;m=0;){o.push(s.embeddedSlice(t,l,l+r.index));var h=r.index+r.length;a=a.slice(h),l+=h}return o.push(s.embeddedSlice(t,l)),void 0!==i&&(o=_.first(o,i)),o},stripEmbeddingMarks:function(t){return t.replace(/\u202a|\u202b|\u202c/g,"")},embeddedDebugString:function(t){return t.replace(/\u202a/g,"[LTR]").replace(/\u202b/g,"[RTL]").replace(/\u202c/g,"[POP]")},toCamelCase:function(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}};return e.register("StringUtils",s),s}),i("VEGAS/vegas",["require","PHET_CORE/Namespace"],function(t){"use strict";var e=t("PHET_CORE/Namespace");return new e("vegas")}),i("string!VEGAS/pattern.0hours.1minutes.2seconds",function(){return window.phet.chipper.strings.get("VEGAS/pattern.0hours.1minutes.2seconds")}),i("string!VEGAS/pattern.0minutes.1seconds",function(){return window.phet.chipper.strings.get("VEGAS/pattern.0minutes.1seconds")}),i("VEGAS/GameTimer",["require","PHET_CORE/inherit","AXON/PropertySet","PHETCOMMON/util/StringUtils","PHET_CORE/Timer","VEGAS/vegas","string!VEGAS/pattern.0hours.1minutes.2seconds","string!VEGAS/pattern.0minutes.1seconds"],function(t){"use strict";function e(){n.call(this,{elapsedTime:0,isRunning:!1}),this._intervalId=null}var i=t("PHET_CORE/inherit"),n=t("AXON/PropertySet"),r=t("PHETCOMMON/util/StringUtils"),s=t("PHET_CORE/Timer"),o=t("VEGAS/vegas"),a=t("string!VEGAS/pattern.0hours.1minutes.2seconds"),l=t("string!VEGAS/pattern.0minutes.1seconds");return o.register("GameTimer",e),e.formatTime=function(t){var e=Math.floor(t/3600),i=Math.floor((t-3600*e)/60),n=Math.floor(t-3600*e-60*i),s=i>9||0===e?i:"0"+i,o=n>9?n:"0"+n;return e>0?r.format(a,e,s,o):r.format(l,s,o)},i(n,e,{start:function(){if(!this.isRunning){var t=this;t.elapsedTime=0,t._intervalId=s.setInterval(function(){t.elapsedTime+=1},1e3),t.isRunning=!0}},stop:function(){this.isRunning&&(s.clearInterval(this._intervalId),this._intervalId=null,this.isRunning=!1)},restart:function(){this.stop(),this.start()}})}),i("string!VEGAS/label.scorePattern",function(){return window.phet.chipper.strings.get("VEGAS/label.scorePattern")}),i("string!VEGAS/label.time",function(){return window.phet.chipper.strings.get("VEGAS/label.time")}),i("string!AREA_BUILDER/level",function(){return window.phet.chipper.strings.get("AREA_BUILDER/level")}),i("string!AREA_BUILDER/pattern.0challenge.1max",function(){return window.phet.chipper.strings.get("AREA_BUILDER/pattern.0challenge.1max")}),i("AREA_BUILDER/game/view/AreaBuilderScoreboard",["require","AREA_BUILDER/areaBuilder","VEGAS/GameTimer","PHET_CORE/inherit","SCENERY/nodes/Node","SCENERY_PHET/PhetFont","AXON/PropertySet","PHETCOMMON/util/StringUtils","SCENERY/nodes/Text","SCENERY/nodes/VBox","string!VEGAS/label.scorePattern","string!VEGAS/label.time","string!AREA_BUILDER/level","string!AREA_BUILDER/pattern.0challenge.1max"],function(t){"use strict";function e(t,e,i,r,p,g){s.call(this),g=_.extend({maxWidth:Number.POSITIVE_INFINITY},g),this.visibilityControls=new a({timeVisible:!0});var A=new h("",{font:new o({size:20,weight:"bold"}),maxWidth:g.maxWidth});t.link(function(t){A.text=l.format(m,t+1)});var E=new h("",{font:new o({size:16}),maxWidth:g.maxWidth});e.link(function(t){E.text=l.format(f,t+1,i)});var b=new h("",{font:new o(20),maxWidth:g.maxWidth});r.link(function(t){b.text=l.format(c,t)});var S=new h("",{font:new o(20),maxWidth:g.maxWidth});p.link(function(t){S.text=l.format(d,n.formatTime(t))});var v=new u({children:[A,E,b,S],spacing:12});this.addChild(v),this.visibilityControls.timeVisibleProperty.link(function(t){t&&!v.hasChild(S)?v.insertChild(v.indexOfChild(b)+1,S):!t&&v.hasChild(S)&&v.removeChild(S)}),this.mutate(g)}var i=t("AREA_BUILDER/areaBuilder"),n=t("VEGAS/GameTimer"),r=t("PHET_CORE/inherit"),s=t("SCENERY/nodes/Node"),o=t("SCENERY_PHET/PhetFont"),a=t("AXON/PropertySet"),l=t("PHETCOMMON/util/StringUtils"),h=t("SCENERY/nodes/Text"),u=t("SCENERY/nodes/VBox"),c=t("string!VEGAS/label.scorePattern"),d=t("string!VEGAS/label.time"),m=t("string!AREA_BUILDER/level"),f=t("string!AREA_BUILDER/pattern.0challenge.1max");return i.register("AreaBuilderScoreboard",e),r(s,e)}),i("AREA_BUILDER/game/view/FractionNode",["require","AREA_BUILDER/areaBuilder","PHET_CORE/inherit","SCENERY/nodes/Line","SCENERY/nodes/Node","SCENERY_PHET/PhetFont","SCENERY/nodes/Text"],function(t){"use strict";function e(t,e){s.call(this),e=_.extend({font:new o({size:18}),color:"black",fractionBarLineWidth:1,fractionBarWidthProportion:1.1},e),this.numeratorNode=new a("0",{font:e.font,fill:e.color}),this.addChild(this.numeratorNode),this.denominatorNode=new a("0",{font:e.font,fill:e.color}),this.addChild(this.denominatorNode);var i=e.fractionBarWidthProportion*Math.max(this.numeratorNode.width,this.denominatorNode.width);this.fractionBarNode=new r(0,0,i,0,{stroke:e.color,lineWidth:e.fractionBarLineWidth}),this.addChild(this.fractionBarNode),this._fraction=t,this.update()}var i=t("AREA_BUILDER/areaBuilder"),n=t("PHET_CORE/inherit"),r=t("SCENERY/nodes/Line"),s=t("SCENERY/nodes/Node"),o=t("SCENERY_PHET/PhetFont"),a=t("SCENERY/nodes/Text");return i.register("FractionNode",e),n(s,e,{update:function(){this.numeratorNode.text=this._fraction.numerator.toString(),this.denominatorNode.text=this._fraction.denominator.toString(),this.numeratorNode.centerX=this.fractionBarNode.centerX,this.denominatorNode.centerX=this.fractionBarNode.centerX,this.fractionBarNode.centerY=this.numeratorNode.bottom,this.denominatorNode.top=this.fractionBarNode.bottom},set fraction(t){this._fraction=t,this.update()},get fraction(){return this._fraction}})}),i("AREA_BUILDER/game/view/ColorProportionsPrompt",["require","AREA_BUILDER/areaBuilder","PHETCOMMON/model/Fraction","AREA_BUILDER/game/view/FractionNode","PHET_CORE/inherit","SCENERY/nodes/Node","SCENERY/nodes/Path","SCENERY_PHET/PhetFont","KITE/Shape"],function(t){"use strict";function e(t,e,i,s){o.call(this),s=_.extend({font:new l({size:18}),textFill:"black",multiLine:!1},s),this.color1FractionNode=new r(i,{font:s.font,color:s.textFill}),this.addChild(this.color1FractionNode);var m=new n(i.denominator-i.numerator,i.denominator);this.color2FractionNode=new r(m,{font:s.font,color:s.textFill}),this.addChild(this.color2FractionNode);var f=h.ellipse(0,0,.5*this.color1FractionNode.bounds.height,.35*this.color1FractionNode.bounds.height);this.color1Patch=new a(f,{fill:t,left:this.color1FractionNode.right+d,centerY:this.color1FractionNode.centerY}),this.addChild(this.color1Patch),s.multiLine?this.color2FractionNode.top=this.color1FractionNode.bottom+u:this.color2FractionNode.left=this.color1Patch.right+c,this.color2Patch=new a(f,{fill:e,left:this.color2FractionNode.right+d,centerY:this.color2FractionNode.centerY}),this.addChild(this.color2Patch),this.mutate(s)}var i=t("AREA_BUILDER/areaBuilder"),n=t("PHETCOMMON/model/Fraction"),r=t("AREA_BUILDER/game/view/FractionNode"),s=t("PHET_CORE/inherit"),o=t("SCENERY/nodes/Node"),a=t("SCENERY/nodes/Path"),l=t("SCENERY_PHET/PhetFont"),h=t("KITE/Shape"),u=5,c=12,d=4;return i.register("ColorProportionsPrompt",e),s(o,e,{set color1(t){this.color1Patch.fill=t},get color1(){return this.color1Patch.fill},set color2(t){this.color2Patch.fill=t},get color2(){return this.color2Patch.fill},set color1Proportion(t){this.color1FractionNode.fraction=t,this.color2FractionNode.fraction=new n(t.denominator-t.numerator,t.denominator)},get color1Proportion(){return this.color1FractionNode.fraction}})}),i("SCENERY_PHET/FaceWithPointsNode",["require","SCENERY_PHET/FaceNode","PHET_CORE/inherit","SCENERY/nodes/Node","SCENERY_PHET/PhetFont","SCENERY/nodes/Text","DOT/Vector2","SCENERY_PHET/sceneryPhet"],function(t){"use strict";function e(t){t=_.extend({spacing:2,faceDiameter:100,faceOpacity:1,pointsAlignment:"centerBottom",pointsFont:new s({size:44,weight:"bold"}),pointsFill:"black",pointsStroke:null,pointsOpacity:1,showZeroPoints:!1,points:0},t),this.pointsAlignment=t.pointsAlignment,this.spacing=t.spacing,this.showZeroPoints=t.showZeroPoints,this.faceNode=new i(t.faceDiameter,{opacity:t.faceOpacity}),this.pointsNode=new o("",{font:t.pointsFont,fill:t.pointsFill,opacity:t.pointsOpacity,stroke:t.pointsStroke,lineWidth:1}),t.children=[this.faceNode,this.pointsNode],r.call(this,t),this.setPoints(t.points)}var i=t("SCENERY_PHET/FaceNode"),n=t("PHET_CORE/inherit"),r=t("SCENERY/nodes/Node"),s=t("SCENERY_PHET/PhetFont"),o=t("SCENERY/nodes/Text"),a=t("DOT/Vector2"),l=t("SCENERY_PHET/sceneryPhet");return l.register("FaceWithPointsNode",e),n(r,e,{smile:function(){this.faceNode.smile(),this.pointsNode.visible=!0},frown:function(){this.faceNode.frown(),this.pointsNode.visible=!1},setPoints:function(t){0!==t||this.showZeroPoints?this.pointsNode.text="+"+t:this.pointsNode.text="",this.updatePointsLocation()},updatePointsLocation:function(){switch(this.pointsAlignment){case"centerBottom":this.pointsNode.centerX=this.faceNode.centerX,this.pointsNode.top=this.faceNode.bottom+this.spacing;break;case"rightBottom":var t=new a(this.faceNode.right+this.spacing,this.faceNode.centerY);t.rotate(Math.PI/4),this.pointsNode.left=t.x,this.pointsNode.centerY=t.y;break;case"rightCenter":this.pointsNode.left=this.faceNode.right+this.spacing,this.pointsNode.centerY=this.faceNode.centerY;break;default:throw new Error("unsupported pointsAlignment: "+this.pointsAlignment)}}})}),i("VIBE/vibe",["require","PHET_CORE/Namespace"],function(t){"use strict";var e=t("PHET_CORE/Namespace");return new e("vibe"); }),i("VIBE/Sound",["require","SCENERY/display/Display","PHET_CORE/inherit","AXON/Property","VIBE/vibe"],function(t){"use strict";function e(t){var e=this,n=t;t instanceof Array||(n=new Array(t)),n.forEach(function(t){if("object"!=typeof t||"undefined"==typeof t.base64&&"undefined"==typeof t.url)throw new Error("Error with soundInfo object: Does not contain a necessary value.")}),this.sound=document.createElement("audio");for(var r=!1,s=null,o=0;o=0?s.url.lastIndexOf("?"):s.url.length):s.base64.slice(s.base64.indexOf(":")+1,s.base64.indexOf(";")),this.sound.canPlayType(a)?r=!0:o===n.length-1&&console.log("Warning: No supported audio formats found, sound will not be played.")}if(r)if(i){var l;if(s.base64){for(var h=(s.base64?s.base64:this.sound.getAttribute("src")).replace(new RegExp("^.*,"),""),u=window.atob(h),c=new window.Uint8Array(u.length),d=0;dR&&w.setScaleMagnitude(R/w.width),w.left+=i-w.visibleBounds.centerX,w.top+=n-w.visibleBounds.centerY}var C=this;h.call(this,0,0,t,e,0,0,{fill:i}),this.titleTextProperty=new l(""),this.buildSpecProperty=new l(null),this.areaToFindProperty=new l(null);var y=new c(this.titleTextProperty.value,{font:p,fill:f,centerY:e/2,maxWidth:.3*t});this.addChild(y),this.titleTextProperty.link(function(i){y.text=i,y.centerY=e/2,null===C.buildSpecProperty.value&&null===C.areaToFindProperty.value?y.centerX=t/2:y.left=E});var w=new o;this.addChild(w);var R=t/2,T=new c("",{font:A,fill:f,top:0});w.addChild(T);var I=new c("",{font:A,fill:f,top:0});w.addChild(I);var N=new n("black","white",new r(1,1),{font:new a({size:11}),textFill:f,top:0});w.addChild(N),this.buildSpecProperty.link(function(t){null!==t?(T.text=u.format(d,t.area),T.visible=!0,t.perimeter||t.proportions?(T.font=A,t.perimeter?(I.text=u.format(m,t.perimeter),I.visible=!0):I.visible=!1,t.proportions?(T.text+=",",N.color1=t.proportions.color1,N.color2=t.proportions.color2,N.color1Proportion=t.proportions.color1Proportion,N.visible=!0):N.visible=!1):(T.font=g,I.visible=!1,N.visible=!1),I.top=T.bottom+.25*T.height,N.left=T.right+10,N.centerY=T.centerY,v(),S()):(T.visible=null!==C.areaToFindProperty.value,I.visible=!1,N.visible=!1)}),this.areaToFindProperty.link(function(t){null!==t?(T.text=u.format(d,t),T.font=g,T.visible=!0,I.visible=!1,N.visible=!1,v(),S()):T.visible=null!==C.buildSpecProperty.value}),this.mutate(s)}var i=t("AREA_BUILDER/areaBuilder"),n=t("AREA_BUILDER/game/view/ColorProportionsPrompt"),r=t("PHETCOMMON/model/Fraction"),s=t("PHET_CORE/inherit"),o=t("SCENERY/nodes/Node"),a=t("SCENERY_PHET/PhetFont"),l=t("AXON/Property"),h=t("SCENERY/nodes/Rectangle"),u=t("PHETCOMMON/util/StringUtils"),c=t("SCENERY/nodes/Text"),d=t("string!AREA_BUILDER/areaEquals"),m=t("string!AREA_BUILDER/perimeterEquals"),f="white",p=new a({size:24,weight:"bold"}),g=new a({size:24}),A=new a({size:18}),E=15,b=600;return i.register("GameInfoBanner",e),s(h,e,{reset:function(){this.titleTextProperty.reset(),this.buildSpecProperty.reset(),this.areaToFindProperty.reset()}})}),i("AREA_BUILDER/game/model/GameState",["AREA_BUILDER/areaBuilder"],function(){"use strict";var t=e("AREA_BUILDER/areaBuilder"),i={CHOOSING_LEVEL:"choosingLevel",PRESENTING_INTERACTIVE_CHALLENGE:"presentingInteractiveChallenge",SHOWING_CORRECT_ANSWER_FEEDBACK:"showingCorrectAnswerFeedback",SHOWING_INCORRECT_ANSWER_FEEDBACK_TRY_AGAIN:"showingIncorrectAnswerFeedbackTryAgain",SHOWING_INCORRECT_ANSWER_FEEDBACK_MOVE_ON:"showingIncorrectAnswerFeedbackMoveOn",DISPLAYING_CORRECT_ANSWER:"displayingCorrectAnswer",SHOWING_LEVEL_RESULTS:"showingLevelResults"};return t.register("GameState",i),i}),i("SUN/buttons/CarouselButton",["require","DOT/Dimension2","PHET_CORE/inherit","DOT/Matrix3","SCENERY/nodes/Path","SUN/buttons/RectangularButtonView","SUN/buttons/RectangularPushButton","KITE/Shape","SUN/sun"],function(t){"use strict";function e(t){t=_.extend({baseColor:"rgba( 200, 200, 200, 0.5 )",stroke:"black",buttonAppearanceStrategy:o.flatAppearanceStrategy,cornerRadius:4,arrowDirection:"up",arrowSize:new i(20,7),arrowStroke:"black",arrowLineWidth:3,arrowLineCap:"round",touchAreaXDilation:0,touchAreaYDilation:0,mouseAreaXDilation:0,mouseAreaYDilation:0},t);var e=(new l).moveTo(0,0).lineTo(t.arrowSize.width/2,-t.arrowSize.height).lineTo(t.arrowSize.width,0);e=e.transformed(r.rotation2(u[t.arrowDirection])),t.content=new s(e,{stroke:t.arrowStroke,lineWidth:t.arrowLineWidth,lineCap:t.arrowLineCap});var n=t.arrowDirection,h=t.cornerRadius;t.leftTopCornerRadius="up"===n||"left"===n?h:0,t.rightTopCornerRadius="up"===n||"right"===n?h:0,t.leftBottomCornerRadius="down"===n||"left"===n?h:0,t.rightBottomCornerRadius="down"===n||"right"===n?h:0,a.call(this,t),this.touchArea=c(this,n,t.touchAreaXDilation,t.touchAreaYDilation),this.mouseArea=c(this,n,t.mouseAreaXDilation,t.mouseAreaYDilation)}var i=t("DOT/Dimension2"),n=t("PHET_CORE/inherit"),r=t("DOT/Matrix3"),s=t("SCENERY/nodes/Path"),o=t("SUN/buttons/RectangularButtonView"),a=t("SUN/buttons/RectangularPushButton"),l=t("KITE/Shape"),h=t("SUN/sun"),u={up:0,down:Math.PI,left:-Math.PI/2,right:Math.PI/2};h.register("CarouselButton",e);var c=function(t,e,i,n){var r=null;if(i||n)switch(e){case"up":r=t.localBounds.dilatedXY(i,n/2).shiftedY(-n/2);break;case"down":r=t.localBounds.dilatedXY(i,n/2).shiftedY(n/2);break;case"left":r=t.localBounds.dilatedXY(i/2,n).shiftedX(-i/2);break;case"right":r=t.localBounds.dilatedXY(i/2,n).shiftedX(i/2);break;default:throw new Error("unsupported arrowDirection: "+e)}return r};return n(a,e)}),i("SUN/HSeparator",["require","PHET_CORE/inherit","SCENERY/nodes/Line","SUN/sun"],function(t){"use strict";function e(t,e){e=_.extend({stroke:"rgb(100,100,100)"},e),n.call(this,0,0,t,0,e)}var i=t("PHET_CORE/inherit"),n=t("SCENERY/nodes/Line"),r=t("SUN/sun");return r.register("HSeparator",e),i(n,e)}),i("SUN/VSeparator",["require","PHET_CORE/inherit","SCENERY/nodes/Line","SUN/sun"],function(t){"use strict";function e(t,e){e=_.extend({stroke:"rgb(100,100,100)"},e),n.call(this,0,0,0,t,e)}var i=t("PHET_CORE/inherit"),n=t("SCENERY/nodes/Line"),r=t("SUN/sun");return r.register("VSeparator",e),i(n,e)}),i("SUN/Carousel",["require","SUN/buttons/CarouselButton","DOT/Dimension2","SUN/HSeparator","PHET_CORE/inherit","SCENERY/nodes/Node","AXON/Property","SCENERY/nodes/Rectangle","KITE/Shape","SUN/sun","DOT/Util","SUN/VSeparator"],function(t){"use strict";function e(t,e){e=_.extend({},m,e);var n="horizontal"===e.orientation,s=_.max(t,function(t){return t.width}).width,u=_.max(t,function(t){return t.height}).height,f=n?s:u,p={xMargin:5,yMargin:5,cornerRadius:e.cornerRadius,baseColor:e.buttonColor,disabledBaseColor:e.fill,stroke:e.buttonStroke,lineWidth:e.buttonLineWidth,minWidth:n?0:s+2*e.margin,minHeight:n?u+2*e.margin:0,arrowSize:e.arrowSize,arrowStroke:e.arrowStroke,arrowLineWidth:e.arrowLineWidth,touchAreaXDilation:e.buttonTouchAreaXDilation,touchAreaYDilation:e.buttonTouchAreaYDilation,mouseAreaXDilation:e.buttonMouseAreaXDilation,mouseAreaYDilation:e.buttonMouseAreaYDilation},g=new i(_.extend({arrowDirection:n?"right":"down"},p)),A=new i(_.extend({arrowDirection:n?"left":"up"},p)),E=e.separatorsVisible?t.length-1:0,b=t.length*(f+e.spacing)+E*e.spacing+e.spacing,S=n?b:s+2*e.margin,v=n?u+2*e.margin:b,C=e.spacing+f/2,y={stroke:e.separatorColor,lineWidth:e.separatorLineWidth};this._animationEnabled=e.animationEnabled;var w=new l(0,0,S,v);t.forEach(function(t){if(n?(t.centerX=C,t.centerY=e.margin+u/2):(t.centerX=e.margin+s/2,t.centerY=C),w.addChild(t),C+=e.spacing+f,e.separatorsVisible){var i;n?(i=new d(v,_.extend({centerX:t.centerX+f/2+e.spacing,centerY:t.centerY},y)),w.addChild(i),C=i.centerX+e.spacing+f/2):(i=new r(S,_.extend({centerX:t.centerX,centerY:t.centerY+f/2+e.spacing},y)),w.addChild(i),C=i.centerY+e.spacing+f/2)}});var R=e.itemsPerPage*(f+e.spacing);e.separatorsVisible&&(R+=e.itemsPerPage*e.spacing);var T=R+e.spacing;e.separatorsVisible&&(T-=e.spacing);var I=n?T:w.width,N=n?w.height:T,P=n?h.rectangle(e.spacing/2,0,I-e.spacing,N):h.rectangle(0,e.spacing/2,I,N-e.spacing),D=new o({children:[w],clipArea:P}),B=n?I+g.width+A.width:I,x=n?N:N+g.height+A.height,O=new l(0,0,B,x,e.cornerRadius,e.cornerRadius,{fill:e.fill}),k=new l(0,0,B,x,e.cornerRadius,e.cornerRadius,{stroke:e.stroke});n?(g.centerY=A.centerY=D.centerY=O.centerY,g.right=O.right,A.left=O.left,D.centerX=O.centerX):(g.centerX=A.centerX=D.centerX=O.centerX,g.bottom=O.bottom,A.top=O.top,D.centerY=O.centerY);var L=t.length/e.itemsPerPage;c.isInteger(L)||(L=Math.floor(L+1));var Y,M=new a(e.defaultPageNumber),q=this;M.link(function(t){if(g.enabled=L-1>t,A.enabled=t>0,e.hideDisabledButtons&&(g.visible=g.enabled,A.visible=A.enabled),Y&&Y.stop(),q._animationEnabled){var i,r=400,s=TWEEN.Easing.Cubic.InOut;n?(i={left:w.left},Y=new TWEEN.Tween(i).easing(s).to({left:-t*R},r).onUpdate(function(){w.left=i.left}).start()):(i={top:w.top},Y=new TWEEN.Tween(i).easing(s).to({top:-t*R},r).onUpdate(function(){w.top=i.top}).start())}else n?w.left=-t*R:w.top=-t*R}),g.addListener(function(){M.set(M.get()+1)}),A.addListener(function(){M.set(M.get()-1)}),this.items=t,this.itemsPerPage=e.itemsPerPage,this.numberOfPages=L,this.pageNumberProperty=M,e.children=[O,D,g,A,k],o.call(this,e)}var i=t("SUN/buttons/CarouselButton"),n=t("DOT/Dimension2"),r=t("SUN/HSeparator"),s=t("PHET_CORE/inherit"),o=t("SCENERY/nodes/Node"),a=t("AXON/Property"),l=t("SCENERY/nodes/Rectangle"),h=t("KITE/Shape"),u=t("SUN/sun"),c=t("DOT/Util"),d=t("SUN/VSeparator"),m={orientation:"horizontal",fill:"white",stroke:"black",lineWidth:1,cornerRadius:4,defaultPageNumber:0,itemsPerPage:4,spacing:10,margin:10,buttonColor:"rgba( 200, 200, 200, 0.5 )",buttonStroke:void 0,buttonLineWidth:1,arrowSize:new n(20,7),arrowStroke:"black",arrowLineWidth:3,hideDisabledButtons:!1,buttonTouchAreaXDilation:0,buttonTouchAreaYDilation:0,buttonMouseAreaXDilation:0,buttonMouseAreaYDilation:0,separatorsVisible:!1,separatorColor:"rgb( 180, 180, 180 )",separatorLineWidth:.5,animationEnabled:!0};return u.register("Carousel",e),s(o,e,{reset:function(t){t=_.extend({animationEnabled:this.animationEnabled},t);var e=this.animationEnabled;this.animationEnabled=t.animationEnabled,this.pageNumberProperty.reset(),this.animationEnabled=e},setAnimationEnabled:function(t){this._animationEnabled=t},set animationEnabled(t){this.setAnimationEnabled(t)},getAnimationEnabled:function(){return this._animationEnabled},get animationEnabled(){return this.getAnimationEnabled()},scrollToItemIndex:function(t){this.pageNumberProperty.set(this.itemIndexToPageNumber(t))},scrollToItem:function(t){this.scrollToItemIndex(this.items.indexOf(t))},isItemVisible:function(t){var e=this.items.indexOf(t);return this.pageNumberProperty.get()===this.itemIndexToPageNumber(e)},itemIndexToPageNumber:function(t){return Math.floor(t/this.itemsPerPage)}},{DEFAULT_OPTIONS:m})}),i("SCENERY/nodes/Leaf",["require","SCENERY/scenery"],function(t){"use strict";var e=t("SCENERY/scenery"),i={mixin:function(t){var e=t.prototype;e.insertChild=function(t,e){throw new Error("Attempt to insert child into Leaf")},e.removeChildWithIndex=function(t,e){throw new Error("Attempt to remove child from Leaf")}}};return e.register("Leaf",i),e.Leaf}),i("SCENERY/nodes/Spacer",["require","PHET_CORE/inherit","SCENERY/scenery","DOT/Bounds2","SCENERY/nodes/Node","SCENERY/nodes/Leaf"],function(t){"use strict";function e(t,e,i){s.call(this),this.localBounds=new r(0,0,t,e),this.mutate(i)}var i=t("PHET_CORE/inherit"),n=t("SCENERY/scenery"),r=t("DOT/Bounds2"),s=t("SCENERY/nodes/Node"),o=t("SCENERY/nodes/Leaf");return n.register("Spacer",e),i(s,e),o.mixin(e),e}),i("SCENERY/nodes/HStrut",["require","PHET_CORE/inherit","SCENERY/scenery","SCENERY/nodes/Spacer"],function(t){"use strict";function e(t,e){r.call(this,t,0,e)}var i=t("PHET_CORE/inherit"),n=t("SCENERY/scenery"),r=t("SCENERY/nodes/Spacer");return n.register("HStrut",e),i(r,e)}),i("SCENERY_PHET/BackspaceIcon",["require","PHET_CORE/inherit","KITE/Shape","SCENERY/nodes/Path","SCENERY_PHET/sceneryPhet"],function(t){"use strict";function e(t){t=_.extend({stroke:"black",lineWidth:1,lineJoin:"round",lineCap:"square"},t);var e=(new n).moveTo(0,5).lineTo(5,0).lineTo(15,0).lineTo(15,10).lineTo(5,10).close();e.moveTo(7,3),e.lineTo(11,7),e.moveTo(7,7),e.lineTo(11,3),r.call(this,e,t)}var i=t("PHET_CORE/inherit"),n=t("KITE/Shape"),r=t("SCENERY/nodes/Path"),s=t("SCENERY_PHET/sceneryPhet");return s.register("BackspaceIcon",e),i(r,e)}),i("SCENERY_PHET/NumberKeypad",["require","PHET_CORE/inherit","SCENERY/nodes/HBox","SCENERY/nodes/HStrut","SCENERY_PHET/PhetFont","AXON/Property","SUN/buttons/RectangularPushButton","SCENERY/nodes/Text","SCENERY/nodes/VBox","SCENERY_PHET/BackspaceIcon","SCENERY_PHET/sceneryPhet"],function(t){"use strict";function e(t){t=_.extend({buttonFont:new o({size:20}),minButtonWidth:35,minButtonHeight:35,doubleWideZeroKey:!0,xSpacing:10,ySpacing:10,keyColor:"white",maxDigits:8,digitStringProperty:new a("")},t);var e=this;this.digitStringProperty=t.digitStringProperty,this.armedForNewEntry=!1;var n={minWidth:t.minButtonWidth,minHeight:t.minButtonHeight,baseColor:t.keyColor,font:t.buttonFont,maxDigits:t.maxDigits},h=new c;h.scale(Math.min(t.minButtonWidth/h.width*.7,.65*t.minButtonHeight/h.height));var d=new l({content:h,minWidth:n.minWidth,minHeight:n.minHeight,xMargin:1,baseColor:n.baseColor,listener:function(){if(e.digitStringProperty.value.length>0){var t=e.digitStringProperty.value.slice(0,-1);e.armedForNewEntry&&(e.digitStringProperty.reset(),e.armedForNewEntry=!1),e.digitStringProperty.value=t}}}),m=[];if(t.doubleWideZeroKey){var f=_.extend({},n,{minWidth:2*n.minWidth+t.xSpacing});m.push(i(0,this,f))}else m.push(i(0,this,n)),m.push(new s(t.minButtonWidth));m.push(d),u.call(this,{spacing:t.ySpacing,children:[new r({spacing:t.xSpacing,children:[i(7,this,n),i(8,this,n),i(9,this,n)]}),new r({spacing:t.xSpacing,children:[i(4,this,n),i(5,this,n),i(6,this,n)]}),new r({spacing:t.xSpacing,children:[i(1,this,n),i(2,this,n),i(3,this,n)]}),new r({spacing:t.xSpacing,children:m})]}),this.mutate(t)}function i(t,e,i){return new l({content:new h(t.toString(),{font:i.font}),baseColor:i.baseColor,minWidth:i.minWidth,minHeight:i.minHeight,xMargin:5,yMargin:5,listener:function(){e.armedForNewEntry&&(e.digitStringProperty.reset(),e.armedForNewEntry=!1),"0"===e.digitStringProperty.value?0!==t.toString&&(e.digitStringProperty.value=t.toString()):e.digitStringProperty.value.lengthi;i++){var a=i/10*Math.PI*2-Math.PI/2,l=i%2===0?t.outerRadius:t.innerRadius,h=l*Math.cos(a),u=l*Math.sin(a);e.push(new r(h,u))}if(1===t.value){for(this.moveTo(e[0].x,e[0].y),i=1;id&&(d=e[i].x);var m=d-c,f=t.value*m+c,p=new o(new r(f,2*-t.outerRadius),new r(f,2*t.outerRadius)),g=function(t){return s.lineSegmentIntersection(t.start.x,t.start.y,t.end.x,t.end.y,p.start.x,p.start.y,p.end.x,p.end.y)},A=function(t,i){return new o(new r(e[t].x,e[t].y),new r(e[i].x,e[i].y))},E=[A(8,9),A(9,0),A(0,1),A(1,2)],b=[A(8,7),A(7,6),A(6,5),A(5,4),A(4,3),A(3,2)],S=null,v=[],C=!1;for(i=E.length-1;i>=0;i--){var y=E[i];S=g(y),S&&(v.push(S),C=!0),C&&v.push(y.start)}for(i=0;iu;u++)r.push(new n(_.extend({value:1},h)));var c=a*t-l;c>1e-6&&r.push(new n(_.extend({value:c},h)));var d=t-r.length;for(u=0;d>u;u++)r.push(new n(_.extend({value:0},h)));o.children=r}),this.mutate(s)}var i=t("PHET_CORE/inherit"),n=t("SCENERY_PHET/StarNode"),r=t("SCENERY/nodes/HBox"),s=t("VEGAS/vegas");return s.register("ProgressIndicator",e),i(r,e)}),i("SCENERY_PHET/MultiLineText",["require","PHET_CORE/inherit","SCENERY/nodes/Node","SCENERY_PHET/PhetFont","SCENERY/nodes/Text","SCENERY/nodes/VBox","SCENERY_PHET/sceneryPhet","PHETCOMMON/util/StringUtils"],function(t){"use strict";function e(t,e){e=_.extend({font:new r,align:"center"},e),this.options=e,n.call(this),this._text=null,this.textParent=null,this.text=t,this.mutate(_.omit(e,"align"))}var i=t("PHET_CORE/inherit"),n=t("SCENERY/nodes/Node"),r=t("SCENERY_PHET/PhetFont"),s=t("SCENERY/nodes/Text"),o=t("SCENERY/nodes/VBox"),a=t("SCENERY_PHET/sceneryPhet"),l=t("PHETCOMMON/util/StringUtils");return a.register("MultiLineText",e),i(n,e,{setText:function(t){this._text=t;var e=this,i=l.embeddedSplit(t,"\n").map(function(t){return 0===t.length&&(t=" "),new s(t,_.omit(e.options,"align","maxWidth"))}),n=this.textParent?this.indexOfChild(this.textParent):0;this.textParent&&this.removeChild(this.textParent),this.textParent=new o({children:i,align:this.options.align}),this.insertChild(n,this.textParent)},set text(t){this.setText(t)},getText:function(){return this._text},get text(){return this.getText()},setFill:function(t){this.options.fill=t;for(var e=this.textParent.getChildren(),i=0;i.95?O=E:x>.75?O=A:x>=.5&&(O=g);var k=new c(O,{font:D.titleFont});if(B.push(k),B.push(new n(f,new h(e),s,{starInnerRadius:D.starDiameter/4,starOuterRadius:D.starDiameter/2})),D.levelVisible&&B.push(new c(u.format(w,t+1),{font:D.infoFont})),B.push(new c(u.format(b,e,s),{font:D.infoFont})),R){var L=new o(u.format(S,r.formatTime(T)),{font:D.infoFont,align:"center"});N?L.text=L.text+"\n"+v:null!==I&&(L.text=L.text+"\n"+u.format(C,r.formatTime(I))),B.push(L)}B.push(new d(y,{listener:P,font:D.buttonFont,baseColor:D.buttonFill,tandem:D.tandem&&D.tandem.createTandem("continueButton")})),a.call(this,new m({children:B,spacing:D.ySpacing}),D)}var i=t("SCENERY/util/Color"),n=t("VEGAS/ProgressIndicator"),r=t("VEGAS/GameTimer"),s=t("PHET_CORE/inherit"),o=t("SCENERY_PHET/MultiLineText"),a=t("SUN/Panel"),l=t("SCENERY_PHET/PhetFont"),h=t("AXON/Property"),u=t("PHETCOMMON/util/StringUtils"),c=t("SCENERY/nodes/Text"),d=t("SUN/buttons/TextPushButton"),m=t("SCENERY/nodes/VBox"),f=t("VEGAS/vegas"),p=t("string!VEGAS/keepTrying"),g=t("string!VEGAS/good"),A=t("string!VEGAS/great"),E=t("string!VEGAS/excellent"),b=t("string!VEGAS/label.score.max"),S=t("string!VEGAS/label.time"),v=t("string!VEGAS/yourNewBest"),C=t("string!VEGAS/pattern.0yourBest"),y=t("string!VEGAS/continue"),w=t("string!VEGAS/label.level");return f.register("LevelCompletedNode",e),s(a,e)}),i("VEGAS/LevelSelectionButton",["require","DOT/Dimension2","VEGAS/GameTimer","PHET_CORE/inherit","SCENERY/nodes/Node","SCENERY_PHET/PhetFont","VEGAS/ProgressIndicator","SCENERY/nodes/Rectangle","SUN/buttons/RectangularPushButton","SCENERY/nodes/Text","VEGAS/vegas"],function(t){"use strict";function e(t,e){if(t.scale(Math.min(e.width/t.bounds.width,e.height/t.bounds.height)),Math.abs(t.bounds.width-e.width)b.width?b.centerX=g.centerX:g.centerX=b.centerX,g.top=b.bottom+f.iconToProgressIndicatorYSpace,A.center=g.center,S.addChild(b),S.addChild(g),S.addChild(A);var v={content:S,xMargin:f.buttonXMargin,yMargin:f.buttonYMargin,baseColor:f.baseColor,cornerRadius:f.cornerRadius,listener:s,tandem:f.tandem},C=new u(v);if(this.addChild(C),f.bestTimeProperty){var y=new c("",{font:f.bestTimeFont,fill:f.bestTimeFill});this.addChild(y),f.bestTimeProperty.link(function(t){y.text=t?r.formatTime(t):"",y.centerX=C.centerX,y.top=C.bottom+f.bestTimeYSpacing}),f.bestTimeVisibleProperty&&f.bestTimeVisibleProperty.linkAttribute(y,"visible")}this.mutate(f)}var n=t("DOT/Dimension2"),r=t("VEGAS/GameTimer"),s=t("PHET_CORE/inherit"),o=t("SCENERY/nodes/Node"),a=t("SCENERY_PHET/PhetFont"),l=t("VEGAS/ProgressIndicator"),h=t("SCENERY/nodes/Rectangle"),u=t("SUN/buttons/RectangularPushButton"),c=t("SCENERY/nodes/Text"),d=t("VEGAS/vegas"),m=1e-4;return d.register("LevelSelectionButton",i),s(o,i)}),i("SUN/buttons/ToggleButtonInteractionStateProperty",["require","AXON/DerivedProperty","PHET_CORE/inherit","SUN/sun"],function(t){"use strict";function e(t){i.call(this,[t.overProperty,t.downProperty,t.enabledProperty],function(t,e,i){return i?t&&!e?"over":e?"pressed":"idle":"disabled"})}var i=t("AXON/DerivedProperty"),n=t("PHET_CORE/inherit"),r=t("SUN/sun");return r.register("ToggleButtonInteractionStateProperty",e),n(i,e)}),i("SUN/buttons/ToggleButtonModel",["require","SUN/buttons/ButtonModel","PHET_CORE/inherit","SUN/sun"],function(t){"use strict";function e(t,e,n){var r=this;this.valueOff=t,this.valueOn=e,this.valueProperty=n,i.call(this);var s=function(t){r.enabled&&r.over&&(t||r.toggle())};this.property("down").link(s),this.disposeToggleButtonModel=function(){r.property("down").unlink(s)}}var i=t("SUN/buttons/ButtonModel"),n=t("PHET_CORE/inherit"),r=t("SUN/sun");return r.register("ToggleButtonModel",e),n(i,e,{dispose:function(){i.prototype.dispose.call(this),this.disposeToggleButtonModel()},toggle:function(){var t=this.valueProperty.value,e=this.valueProperty.value===this.valueOff?this.valueOn:this.valueOff;this.trigger2("startedCallbacksForToggled",t,e),this.valueProperty.value=e,this.trigger0("endedCallbacksForToggled")}})}),i("SUN/buttons/RectangularToggleButton",["require","PHET_CORE/inherit","SUN/buttons/RectangularButtonView","SUN/sun","SUN/buttons/ToggleButtonInteractionStateProperty","SUN/buttons/ToggleButtonModel"],function(t){"use strict";function e(t,e,i,r){this.toggleButtonModel=new o(t,e,i,r),n.call(this,this.toggleButtonModel,new s(this.toggleButtonModel),r),r&&r.tandem&&r.tandem.addInstance(this)}var i=t("PHET_CORE/inherit"),n=t("SUN/buttons/RectangularButtonView"),r=t("SUN/sun"),s=t("SUN/buttons/ToggleButtonInteractionStateProperty"),o=t("SUN/buttons/ToggleButtonModel");return r.register("RectangularToggleButton",e),i(n,e,{dispose:function(){}})}),i("SUN/ToggleNode",["require","SCENERY/nodes/Node","SCENERY/nodes/Rectangle","PHET_CORE/inherit","SUN/sun"],function(t){"use strict";function e(t,e,r,s){s=_.extend({wrapChildren:!0},s);var o=this;i.call(o);var a=n.bounds(t.bounds.union(e.bounds),{visible:!1});this.addChild(a);var l=s.wrapChildren?new i({children:[t]}):t,h=s.wrapChildren?new i({children:[e]}):e;this.addChild(h),this.addChild(l),r.link(function(t){l.setVisible(t),h.setVisible(!t); }),s&&this.mutate(s)}var i=t("SCENERY/nodes/Node"),n=t("SCENERY/nodes/Rectangle"),r=t("PHET_CORE/inherit"),s=t("SUN/sun");return s.register("ToggleNode",e),r(i,e)}),i("SUN/buttons/BooleanRectangularToggleButton",["require","PHET_CORE/inherit","SUN/buttons/RectangularToggleButton","SUN/sun","SUN/ToggleNode"],function(t){"use strict";function e(t,e,i,r){n.call(this,!1,!0,i,_.extend({content:new s(t,e,i)},r))}var i=t("PHET_CORE/inherit"),n=t("SUN/buttons/RectangularToggleButton"),r=t("SUN/sun"),s=t("SUN/ToggleNode");return r.register("BooleanRectangularToggleButton",e),i(n,e)}),i("string!SCENERY_PHET/SoundToggleButton.name",function(){return window.phet.chipper.strings.get("SCENERY_PHET/SoundToggleButton.name")}),i("SCENERY_PHET/buttons/SoundToggleButton",["require","SCENERY/util/Color","SUN/FontAwesomeNode","PHET_CORE/inherit","SCENERY/nodes/Node","SCENERY/nodes/Path","KITE/Shape","SUN/buttons/BooleanRectangularToggleButton","SCENERY/accessibility/AccessiblePeer","SCENERY_PHET/sceneryPhet","string!SCENERY_PHET/SoundToggleButton.name"],function(t){"use strict";function e(t,e){var r=this,u=new s,g=new n("volume_up"),A=(c-2*m)/g.width;g.scale(A),u.addChild(new n("volume_off",{scale:A}));var E=new o((new a).moveTo(0,0).lineTo(f,f).moveTo(0,f).lineTo(f,0),{stroke:"black",lineWidth:3,left:u.width+5,centerY:u.centerY});u.addChild(E),l.call(this,g,u,t,_.extend({baseColor:new i(242,233,22),minWidth:c,minHeight:d,xMargin:m,yMargin:m,accessibleContent:{createPeer:function(e){var i=document.createElement("input");return i.value=p,i.type="button",i.tabIndex="0",i.addEventListener("click",function(){t.set(!t.value)}),new h(e,i)}}},e)),t.link(function(t){var e=t?"checked":"unchecked";r.textDescription="Sound Checkbox ("+e+")"})}var i=t("SCENERY/util/Color"),n=t("SUN/FontAwesomeNode"),r=t("PHET_CORE/inherit"),s=t("SCENERY/nodes/Node"),o=t("SCENERY/nodes/Path"),a=t("KITE/Shape"),l=t("SUN/buttons/BooleanRectangularToggleButton"),h=t("SCENERY/accessibility/AccessiblePeer"),u=t("SCENERY_PHET/sceneryPhet"),c=45,d=45,m=4,f=.25*c,p=t("string!SCENERY_PHET/SoundToggleButton.name");return u.register("SoundToggleButton",e),r(l,e)}),i("SCENERY_PHET/SimpleClockIcon",["require","SCENERY/nodes/Circle","PHET_CORE/inherit","SCENERY/nodes/Line","SCENERY/nodes/Node","SCENERY_PHET/sceneryPhet"],function(t){"use strict";function e(t,e){s.call(this),e=_.extend({fill:"white",stroke:"black",lineWidth:2},e),this.addChild(new i(t,e)),this.addChild(new i(.15*t,{fill:e.stroke}));var n={stroke:e.stroke,lineWidth:e.lineWidth,lineCap:"round",lineJoin:"round"};this.addChild(new r(0,0,0,.75*-t,n)),this.addChild(new r(0,0,.45*t,.3*t,n)),this.centerX=t,this.centerY=t,this.mutate(e)}var i=t("SCENERY/nodes/Circle"),n=t("PHET_CORE/inherit"),r=t("SCENERY/nodes/Line"),s=t("SCENERY/nodes/Node"),o=t("SCENERY_PHET/sceneryPhet");return o.register("SimpleClockIcon",e),n(s,e)}),i("SCENERY_PHET/buttons/TimerToggleButton",["require","SCENERY/util/Color","PHET_CORE/inherit","SCENERY/nodes/Node","SCENERY/nodes/Path","KITE/Shape","SCENERY_PHET/SimpleClockIcon","SUN/buttons/BooleanRectangularToggleButton","SCENERY_PHET/sceneryPhet"],function(t){"use strict";function e(t,e){var n=.35*u,h=new a(n),f=new r,p=new a(n,{opacity:.8});f.addChild(p);var g=new o,A=.8*f.width;g.moveTo(0,0),g.lineTo(A,A),g.moveTo(0,A),g.lineTo(A,0),f.addChild(new s(g,{stroke:"red",opacity:.55,lineWidth:m,lineCap:"round",centerX:f.width/2,centerY:f.height/2})),l.call(this,h,f,t,_.extend({baseColor:new i(242,233,22),minWidth:u,minHeight:c,xMargin:d,yMargin:d},e))}var i=t("SCENERY/util/Color"),n=t("PHET_CORE/inherit"),r=t("SCENERY/nodes/Node"),s=t("SCENERY/nodes/Path"),o=t("KITE/Shape"),a=t("SCENERY_PHET/SimpleClockIcon"),l=t("SUN/buttons/BooleanRectangularToggleButton"),h=t("SCENERY_PHET/sceneryPhet"),u=45,c=45,d=4,m=6;return h.register("TimerToggleButton",e),n(l,e)}),i("string!AREA_BUILDER/chooseYourLevel",function(){return window.phet.chipper.strings.get("AREA_BUILDER/chooseYourLevel")}),i("AREA_BUILDER/game/view/StartGameLevelNode",["require","AREA_BUILDER/areaBuilder","AREA_BUILDER/common/AreaBuilderSharedConstants","PHET_CORE/inherit","VEGAS/LevelSelectionButton","SCENERY/nodes/Node","SCENERY_PHET/PhetFont","SCENERY_PHET/buttons/ResetAllButton","SCENERY_PHET/buttons/SoundToggleButton","SCENERY/nodes/Text","SCENERY_PHET/buttons/TimerToggleButton","DOT/Vector2","string!AREA_BUILDER/chooseYourLevel"],function(t){"use strict";function e(t,e,i,r,p,g,A){function E(e){return function(){t(e)}}if(o.call(this),A=_.extend({numLevels:4,titleString:m,maxTitleWidth:500,numStarsOnButtons:5,perfectScore:10,buttonBackgroundColor:"#A8BEFF",numButtonRows:1,controlsInset:12,size:n.LAYOUT_BOUNDS},A),p.length!==A.numLevels||g.length!==A.numLevels)throw new Error("Number of game levels doesn't match length of provided arrays");var b=new u(A.titleString,{font:new a(30),maxWidth:A.maxTitleWidth});this.addChild(b);for(var S=new Array(A.numLevels),v=0;vD;D++){var B=P*R+D;S[B].centerX=N.x+D*T,S[B].centerY=N.y+P*I}w.right=A.size.width-A.controlsInset,w.bottom=A.size.height-A.controlsInset,b.centerX=A.size.width/2,b.centerY=S[0].top/2,y.left=A.controlsInset,y.bottom=A.size.height-A.controlsInset,C.left=A.controlsInset,C.bottom=y.top-10}var i=t("AREA_BUILDER/areaBuilder"),n=t("AREA_BUILDER/common/AreaBuilderSharedConstants"),r=t("PHET_CORE/inherit"),s=t("VEGAS/LevelSelectionButton"),o=t("SCENERY/nodes/Node"),a=t("SCENERY_PHET/PhetFont"),l=t("SCENERY_PHET/buttons/ResetAllButton"),h=t("SCENERY_PHET/buttons/SoundToggleButton"),u=t("SCENERY/nodes/Text"),c=t("SCENERY_PHET/buttons/TimerToggleButton"),d=t("DOT/Vector2"),m=t("string!AREA_BUILDER/chooseYourLevel"),f=4;return i.register("StartGameLevelNode",e),r(o,e)}),i("AREA_BUILDER/game/view/FeedbackWindow",["require","AREA_BUILDER/areaBuilder","PHET_CORE/inherit","SCENERY_PHET/PhetFont","SCENERY/nodes/Node","SUN/Panel","SCENERY/nodes/Text"],function(t){"use strict";function e(t,e,i){i=_.extend({fill:d,stroke:"black",xMargin:l},i),this.contentNode=new s,this.titleNode=new a(t,{font:h}),this.titleNode.scale(Math.min((e-2*l)/this.titleNode.width,1)),this.titleNode.top=5,this.contentNode.addChild(this.titleNode),o.call(this,this.contentNode,{fill:i.fill,stroke:i.stroke,xMargin:i.xMargin})}var i=t("AREA_BUILDER/areaBuilder"),n=t("PHET_CORE/inherit"),r=t("SCENERY_PHET/PhetFont"),s=t("SCENERY/nodes/Node"),o=t("SUN/Panel"),a=t("SCENERY/nodes/Text"),l=8,h=new r({size:20,weight:"bold"}),u=new r({size:18}),c="white",d="#F2E916";return i.register("FeedbackWindow",e),n(o,e,{setColorBasedOnAnswerCorrectness:function(t){this.background.fill=t?c:d}},{X_MARGIN:l,NORMAL_TEXT_FONT:u})}),i("string!AREA_BUILDER/youBuilt",function(){return window.phet.chipper.strings.get("AREA_BUILDER/youBuilt")}),i("AREA_BUILDER/game/view/YouBuiltWindow",["require","AREA_BUILDER/areaBuilder","PHET_CORE/inherit","AREA_BUILDER/game/view/ColorProportionsPrompt","AREA_BUILDER/game/view/FeedbackWindow","SCENERY_PHET/PhetFont","PHETCOMMON/util/StringUtils","SCENERY/nodes/Text","string!AREA_BUILDER/areaEquals","string!AREA_BUILDER/perimeterEquals","string!AREA_BUILDER/youBuilt"],function(t){"use strict";function e(t,e){s.call(this,c,t,e),this.currentBuildSpec=null,this.areaTextNode=new l(a.format(h,99),{font:s.NORMAL_TEXT_FONT,top:this.titleNode.bottom+d}),this.areaTextNode.width+2*s.X_MARGIN>t&&this.areaTextNode.scale((t-2*s.X_MARGIN)/this.areaTextNode.width),this.contentNode.addChild(this.areaTextNode),this.perimeterTextNode=new l(a.format(u,99),{font:s.NORMAL_TEXT_FONT}),this.perimeterTextNode.width+2*s.X_MARGIN>t&&this.perimeterTextNode.scale((t-2*s.X_MARGIN)/this.perimeterTextNode.width),this.proportionsInfoNode=null,this.mutate(e)}var i=t("AREA_BUILDER/areaBuilder"),n=t("PHET_CORE/inherit"),r=t("AREA_BUILDER/game/view/ColorProportionsPrompt"),s=t("AREA_BUILDER/game/view/FeedbackWindow"),o=t("SCENERY_PHET/PhetFont"),a=t("PHETCOMMON/util/StringUtils"),l=t("SCENERY/nodes/Text"),h=t("string!AREA_BUILDER/areaEquals"),u=t("string!AREA_BUILDER/perimeterEquals"),c=t("string!AREA_BUILDER/youBuilt"),d=5;return i.register("YouBuiltWindow",e),n(s,e,{proportionSpecsAreEqual:function(t,e){return null===t&&null!==e||null!==t&&null===e?!1:t.proportions&&!e.proportions||!t.proportions&&e.proportions?!1:t.proportions||e.proportions?t.proportions.color1.equals(e.proportions.color1)&&t.proportions.color2.equals(e.proportions.color2)&&t.proportions.color1Proportion.equals(e.proportions.color1Proportion):!0},setBuildSpec:function(t){this.areaTextNode.text=a.format(h,t.area),this.proportionSpecsAreEqual(t,this.currentBuildSpec)||(this.proportionsInfoNode&&(this.contentNode.removeChild(this.proportionsInfoNode),this.proportionsInfoNode=null),t.proportions&&(this.proportionsInfoNode=new r(t.proportions.color1,t.proportions.color2,t.proportions.color1Proportion,{top:this.areaTextNode.bottom+d,multiLine:!0},{font:new o(14)}),this.contentNode.addChild(this.proportionsInfoNode))),"undefined"!=typeof t.perimeter?(this.contentNode.hasChild(this.perimeterTextNode)||this.contentNode.addChild(this.perimeterTextNode),this.perimeterTextNode.text=a.format(u,t.perimeter),this.perimeterTextNode.visible=!0,this.perimeterTextNode.top=(this.proportionsInfoNode?this.proportionsInfoNode.bottom:this.areaTextNode.bottom)+d):this.contentNode.hasChild(this.perimeterTextNode)&&this.contentNode.removeChild(this.perimeterTextNode),this.currentBuildSpec=t}})}),i("string!AREA_BUILDER/youEntered",function(){return window.phet.chipper.strings.get("AREA_BUILDER/youEntered")}),i("AREA_BUILDER/game/view/YouEnteredWindow",["require","AREA_BUILDER/areaBuilder","PHET_CORE/inherit","AREA_BUILDER/game/view/FeedbackWindow","SCENERY/nodes/Text","string!AREA_BUILDER/youEntered"],function(t){"use strict";function e(t,e){r.call(this,o,t,e),this.valueEnteredNode=new s(99,{font:r.NORMAL_TEXT_FONT,top:this.titleNode.bottom+a}),this.contentNode.addChild(this.valueEnteredNode),this.mutate(e)}var i=t("AREA_BUILDER/areaBuilder"),n=t("PHET_CORE/inherit"),r=t("AREA_BUILDER/game/view/FeedbackWindow"),s=t("SCENERY/nodes/Text"),o=t("string!AREA_BUILDER/youEntered"),a=5;return i.register("YouEnteredWindow",e),n(r,e,{setValueEntered:function(t){this.valueEnteredNode.text=t.toString(),this.valueEnteredNode.centerX=this.titleNode.centerX}})}),i("string!AREA_BUILDER/areaQuestion",function(){return window.phet.chipper.strings.get("AREA_BUILDER/areaQuestion")}),i("string!AREA_BUILDER/aSolutionColon",function(){return window.phet.chipper.strings.get("AREA_BUILDER/aSolutionColon")}),i("string!AREA_BUILDER/aSolution",function(){return window.phet.chipper.strings.get("AREA_BUILDER/aSolution")}),i("string!AREA_BUILDER/buildIt",function(){return window.phet.chipper.strings.get("AREA_BUILDER/buildIt")}),i("string!VEGAS/check",function(){return window.phet.chipper.strings.get("VEGAS/check")}),i("string!AREA_BUILDER/findTheArea",function(){return window.phet.chipper.strings.get("AREA_BUILDER/findTheArea")}),i("string!VEGAS/next",function(){return window.phet.chipper.strings.get("VEGAS/next")}),i("string!AREA_BUILDER/solutionColon",function(){return window.phet.chipper.strings.get("AREA_BUILDER/solutionColon")}),i("string!AREA_BUILDER/solution",function(){return window.phet.chipper.strings.get("AREA_BUILDER/solution")}),i("string!AREA_BUILDER/startOver",function(){return window.phet.chipper.strings.get("AREA_BUILDER/startOver")}),i("string!VEGAS/tryAgain",function(){return window.phet.chipper.strings.get("VEGAS/tryAgain")}),i("string!AREA_BUILDER/yourGoal",function(){return window.phet.chipper.strings.get("AREA_BUILDER/yourGoal")}),i("AREA_BUILDER/game/view/AreaBuilderGameView",["require","AREA_BUILDER/areaBuilder","AREA_BUILDER/game/model/AreaBuilderGameModel","AREA_BUILDER/common/view/AreaBuilderControlPanel","AREA_BUILDER/game/view/AreaBuilderScoreboard","AREA_BUILDER/common/AreaBuilderSharedConstants","AREA_BUILDER/game/model/BuildSpec","AREA_BUILDER/game/view/ColorProportionsPrompt","SCENERY_PHET/buttons/EraserButton","SCENERY_PHET/FaceWithPointsNode","VEGAS/GameAudioPlayer","AREA_BUILDER/game/view/GameIconFactory","AREA_BUILDER/game/view/GameInfoBanner","AREA_BUILDER/game/model/GameState","SUN/Carousel","PHET_CORE/inherit","AREA_BUILDER/game/view/NumberEntryControl","VEGAS/LevelCompletedNode","SCENERY/nodes/Node","SUN/Panel","SCENERY_PHET/PhetFont","SUN/buttons/RectangularPushButton","JOIST/ScreenView","AREA_BUILDER/common/view/ShapeCreatorNode","AREA_BUILDER/common/view/ShapePlacementBoardNode","AREA_BUILDER/common/view/ShapeNode","AREA_BUILDER/game/view/StartGameLevelNode","PHETCOMMON/util/StringUtils","SCENERY/nodes/Text","SUN/buttons/TextPushButton","SCENERY/nodes/HBox","AREA_BUILDER/game/view/YouBuiltWindow","AREA_BUILDER/game/view/YouEnteredWindow","SCENERY/nodes/VBox","string!AREA_BUILDER/areaEquals","string!AREA_BUILDER/areaQuestion","string!AREA_BUILDER/aSolutionColon","string!AREA_BUILDER/aSolution","string!AREA_BUILDER/buildIt","string!VEGAS/check","string!AREA_BUILDER/findTheArea","string!VEGAS/next","string!AREA_BUILDER/perimeterEquals","string!AREA_BUILDER/solutionColon","string!AREA_BUILDER/solution","string!AREA_BUILDER/startOver","string!VEGAS/tryAgain","string!AREA_BUILDER/yourGoal"],function(t){"use strict";function e(t){y.call(this,{layoutBounds:o.LAYOUT_BOUNDS});var e=this;e.model=t,this.gameAudioPlayer=new c(t.soundEnabledProperty),this.rootNode=new b,this.addChild(e.rootNode),this.rootNode.moveToBack(),this.controlLayer=new b,this.rootNode.addChild(this.controlLayer),this.challengeLayer=new b,this.rootNode.addChild(this.challengeLayer),this.startGameLevelNode=new I(function(e){t.startLevel(e)},function(){t.reset()},t.timerEnabledProperty,t.soundEnabledProperty,[d.createIcon(1),d.createIcon(2),d.createIcon(3),d.createIcon(4),d.createIcon(5),d.createIcon(6)],t.bestScoreProperties,{numStarsOnButtons:t.challengesPerSet,perfectScore:t.maxPossibleScore,numLevels:t.numberOfLevels,numButtonRows:2,controlsInset:20}),this.rootNode.addChild(this.startGameLevelNode),this.shapeBoard=new R(t.simSpecificModel.shapePlacementBoard),this.shapeBoardOriginalBounds=this.shapeBoard.bounds.copy(),this.maxShapeBoardTextWidth=.9*this.shapeBoardOriginalBounds.width,this.yourGoalTitle=new P(Q,{font:new v({size:24,weight:"bold"}),maxWidth:this.maxShapeBoardTextWidth}),this.challengeLayer.addChild(this.shapeBoard),this.eraserButton=new h({right:this.shapeBoard.left,top:this.shapeBoard.bottom+tt,touchAreaXDilation:it,touchAreaYDilation:it,listener:function(){var e=t.currentChallenge,i="fade";"areaEntered"===e.checkSpec&&e.userShapes&&e.userShapes[0].creationLimit&&(i="animateHome"),t.simSpecificModel.shapePlacementBoard.releaseAllShapes(i),t.gameStateProperty.value===f.SHOWING_INCORRECT_ANSWER_FEEDBACK_TRY_AGAIN&&t.tryAgain()}}),this.challengeLayer.addChild(this.eraserButton),this.youBuiltWindow=new x(this.layoutBounds.width-this.shapeBoard.right-14),this.challengeLayer.addChild(this.youBuiltWindow),this.youEnteredWindow=new O(this.layoutBounds.width-this.shapeBoard.right-14),this.challengeLayer.addChild(this.youEnteredWindow),this.challengePromptBanner=new m(this.shapeBoard.width,Z,"#1b1464",{left:this.shapeBoard.left,bottom:this.shapeBoard.top-tt}),this.challengeLayer.addChild(this.challengePromptBanner),this.solutionBanner=new m(this.shapeBoard.width,Z,"#fbb03b",{left:this.shapeBoard.left,bottom:this.shapeBoard.top-tt}),this.challengeLayer.addChild(this.solutionBanner),this.controlPanel=new r(t.simSpecificModel.showGridOnBoardProperty,t.simSpecificModel.showDimensionsProperty,{centerX:(this.layoutBounds.x+this.shapeBoard.left)/2,bottom:this.shapeBoard.bottom}),this.controlLayer.addChild(this.controlPanel),this.scoreboard=new s(t.levelProperty,t.challengeIndexProperty,t.challengesPerSet,t.scoreProperty,t.elapsedTimeProperty,{centerX:(this.layoutBounds.x+this.shapeBoard.left)/2,top:this.shapeBoard.top,maxWidth:this.controlPanel.width}),this.controlLayer.addChild(this.scoreboard),this.model.timerEnabledProperty.link(function(t){e.scoreboard.visibilityControls.timeVisible=t}),this.controlLayer.addChild(new C({content:new P(X,{font:J,maxWidth:this.controlPanel.width}),touchAreaXDilation:it,touchAreaYDilation:it,listener:function(){t.simSpecificModel.reset(),t.setChoosingLevelState()},baseColor:K,centerX:this.scoreboard.centerX,centerY:this.solutionBanner.centerY})),this.buildPromptVBox=new k({children:[this.yourGoalTitle],spacing:20}),this.buildPromptPanel=new S(this.buildPromptVBox,{stroke:null,xMargin:10,yMargin:10}),this.challengeLayer.addChild(this.buildPromptPanel),this.areaOfUserCreatedShape=0,this.perimeterOfUserCreatedShape=0,this.color1Proportion=null,this.gameControlButtons=[];var i={font:J,baseColor:K,cornerRadius:4,touchAreaXDilation:it,touchAreaYDilation:it,maxWidth:.9*(this.layoutBounds.maxX-this.shapeBoardOriginalBounds.maxX)};this.checkAnswerButton=new D(H,_.extend({listener:function(){e.updateUserAnswer(),t.checkAnswer()}},i)),this.gameControlButtons.push(this.checkAnswerButton),this.nextButton=new D(F,_.extend({listener:function(){t.nextChallenge()}},i)),this.gameControlButtons.push(this.nextButton),this.tryAgainButton=new D(W,_.extend({listener:function(){t.tryAgain()}},i)),this.gameControlButtons.push(this.tryAgainButton),this.solutionButton=new D(j,_.extend({listener:function(){t.displayCorrectAnswer()}},i)),this.gameControlButtons.push(this.solutionButton),this.showASolutionButton=new D(q,_.extend({listener:function(){e.okayToUpdateYouBuiltWindow=!1,t.displayCorrectAnswer()}},i)),this.gameControlButtons.push(this.showASolutionButton);var n=(this.layoutBounds.width+this.shapeBoard.right)/2,a=this.shapeBoard.bottom;this.gameControlButtons.forEach(function(t){t.centerX=n,t.bottom=a,e.controlLayer.addChild(t)}),this.numberEntryControl=new A({centerX:n,bottom:this.checkAnswerButton.top-10}),this.challengeLayer.addChild(this.numberEntryControl),this.areaQuestionPrompt=new P(Y,{font:new v(20),centerX:this.numberEntryControl.centerX,bottom:this.numberEntryControl.top-10,maxWidth:this.numberEntryControl.width}),this.challengeLayer.addChild(this.areaQuestionPrompt),this.numberEntryControl.keypad.digitStringProperty.link(function(i){t.gameStateProperty.value===f.SHOWING_INCORRECT_ANSWER_FEEDBACK_TRY_AGAIN&&t.tryAgain(),e.updatedCheckButtonEnabledState()}),this.faceWithPointsNode=new u({faceDiameter:85,pointsAlignment:"rightBottom",centerX:n,top:a+20,pointsFont:new v({size:20,weight:"bold"})}),this.addChild(this.faceWithPointsNode),t.simSpecificModel.movableShapes.addItemAddedListener(function(i){var n=new T(i,e.layoutBounds);e.challengeLayer.addChild(n);var r=function(e){e&&(n.moveToFront(),t.gameStateProperty.value===f.SHOWING_INCORRECT_ANSWER_FEEDBACK_TRY_AGAIN&&t.tryAgain())};i.userControlledProperty.link(r),t.simSpecificModel.movableShapes.addItemRemovedListener(function s(o){o===i&&(e.challengeLayer.removeChild(n),i.userControlledProperty.unlink(r),t.simSpecificModel.movableShapes.removeItemRemovedListener(s))}),1===e.buildPromptPanel.opacity&&new TWEEN.Tween({opacity:e.buildPromptPanel.opacity}).to({opacity:0},500).easing(TWEEN.Easing.Cubic.InOut).onUpdate(function(){e.buildPromptPanel.opacity=this.opacity}).start(),t.currentChallenge.buildSpec&&null===e.challengePromptBanner.buildSpecProperty.value&&(e.challengePromptBanner.buildSpecProperty.value=t.currentChallenge.buildSpec)}),t.simSpecificModel.movableShapes.addItemRemovedListener(function(){t.gameStateProperty.value!==f.SHOWING_INCORRECT_ANSWER_FEEDBACK_MOVE_ON||e.isAnyShapeMoving()||e.model.checkAnswer()}),t.simSpecificModel.shapePlacementBoard.areaAndPerimeterProperty.link(function(i){e.updatedCheckButtonEnabledState(),t.gameStateProperty.value===f.SHOWING_INCORRECT_ANSWER_FEEDBACK_MOVE_ON&&e.model.currentChallenge.buildSpec&&e.okayToUpdateYouBuiltWindow&&(e.updateUserAnswer(),e.updateYouBuiltWindow(e.model.currentChallenge),e.isAnyShapeMoving()||e.model.checkAnswer())}),this.levelCompletedNode=null,this.shapeCarouselLayer=new b,this.challengeLayer.addChild(this.shapeCarouselLayer),this.clearDimensionsControlOnNextChallenge=!1,t.gameStateProperty.link(e.handleGameStateChange.bind(e)),this.okayToUpdateYouBuiltWindow=!0}var i=t("AREA_BUILDER/areaBuilder"),n=t("AREA_BUILDER/game/model/AreaBuilderGameModel"),r=t("AREA_BUILDER/common/view/AreaBuilderControlPanel"),s=t("AREA_BUILDER/game/view/AreaBuilderScoreboard"),o=t("AREA_BUILDER/common/AreaBuilderSharedConstants"),a=t("AREA_BUILDER/game/model/BuildSpec"),l=t("AREA_BUILDER/game/view/ColorProportionsPrompt"),h=t("SCENERY_PHET/buttons/EraserButton"),u=t("SCENERY_PHET/FaceWithPointsNode"),c=t("VEGAS/GameAudioPlayer"),d=t("AREA_BUILDER/game/view/GameIconFactory"),m=t("AREA_BUILDER/game/view/GameInfoBanner"),f=t("AREA_BUILDER/game/model/GameState"),p=t("SUN/Carousel"),g=t("PHET_CORE/inherit"),A=t("AREA_BUILDER/game/view/NumberEntryControl"),E=t("VEGAS/LevelCompletedNode"),b=t("SCENERY/nodes/Node"),S=t("SUN/Panel"),v=t("SCENERY_PHET/PhetFont"),C=t("SUN/buttons/RectangularPushButton"),y=t("JOIST/ScreenView"),w=t("AREA_BUILDER/common/view/ShapeCreatorNode"),R=t("AREA_BUILDER/common/view/ShapePlacementBoardNode"),T=t("AREA_BUILDER/common/view/ShapeNode"),I=t("AREA_BUILDER/game/view/StartGameLevelNode"),N=t("PHETCOMMON/util/StringUtils"),P=t("SCENERY/nodes/Text"),D=t("SUN/buttons/TextPushButton"),B=t("SCENERY/nodes/HBox"),x=t("AREA_BUILDER/game/view/YouBuiltWindow"),O=t("AREA_BUILDER/game/view/YouEnteredWindow"),k=t("SCENERY/nodes/VBox"),L=t("string!AREA_BUILDER/areaEquals"),Y=t("string!AREA_BUILDER/areaQuestion"),M=t("string!AREA_BUILDER/aSolutionColon"),q=t("string!AREA_BUILDER/aSolution"),V=t("string!AREA_BUILDER/buildIt"),H=t("string!VEGAS/check"),U=t("string!AREA_BUILDER/findTheArea"),F=t("string!VEGAS/next"),G=t("string!AREA_BUILDER/perimeterEquals"),z=t("string!AREA_BUILDER/solutionColon"),j=t("string!AREA_BUILDER/solution"),X=t("string!AREA_BUILDER/startOver"),W=t("string!VEGAS/tryAgain"),Q=t("string!AREA_BUILDER/yourGoal"),J=new v(18),K="#F2E916",Z=60,$=new v({size:20,weight:"bold"}),tt=15,et=4,it=7;return i.register("AreaBuilderGameView",e),g(y,e,{handleGameStateChange:function(t){this.hideAllGameNodes();var e=this.model.currentChallenge;switch(t){case f.CHOOSING_LEVEL:this.handleChoosingLevelState();break;case f.PRESENTING_INTERACTIVE_CHALLENGE:this.handlePresentingInteractiveChallengeState(e);break;case f.SHOWING_CORRECT_ANSWER_FEEDBACK:this.handleShowingCorrectAnswerFeedbackState(e);break;case f.SHOWING_INCORRECT_ANSWER_FEEDBACK_TRY_AGAIN:this.handleShowingIncorrectAnswerFeedbackTryAgainState(e);break;case f.SHOWING_INCORRECT_ANSWER_FEEDBACK_MOVE_ON:this.handleShowingIncorrectAnswerFeedbackMoveOnState(e);break;case f.DISPLAYING_CORRECT_ANSWER:this.handleDisplayingCorrectAnswerState(e);break;case f.SHOWING_LEVEL_RESULTS:this.handleShowingLevelResultsState();break;default:throw new Error("Unhandled game state: "+t)}},handleChoosingLevelState:function(){this.show([this.startGameLevelNode]),this.hideChallenge()},handlePresentingInteractiveChallengeState:function(t){this.challengeLayer.pickable=null,this.presentChallenge();var e=[this.scoreboard,this.controlPanel,this.checkAnswerButton,this.challengePromptBanner];"areaEntered"===t.checkSpec&&(e.push(this.numberEntryControl),e.push(this.areaQuestionPrompt)),t.userShapes&&(e.push(this.shapeCarouselLayer),e.push(this.eraserButton)),this.show(e),this.showChallengeGraphics(),this.updatedCheckButtonEnabledState(),this.okayToUpdateYouBuiltWindow=!0,this.clearDimensionsControlOnNextChallenge&&(this.model.simSpecificModel.showDimensions=!1,this.clearDimensionsControlOnNextChallenge=!1)},handleShowingCorrectAnswerFeedbackState:function(t){var e=[this.scoreboard,this.controlPanel,this.nextButton,this.challengePromptBanner,this.faceWithPointsNode];t.buildSpec?(this.updateYouBuiltWindow(t),e.push(this.youBuiltWindow)):(this.updateYouEnteredWindow(t),e.push(this.youEnteredWindow)),this.gameAudioPlayer.correctAnswer(),this.faceWithPointsNode.smile(),this.faceWithPointsNode.setPoints(this.model.getChallengeCurrentPointValue()),this.challengeLayer.pickable=!1,this.show(e)},handleShowingIncorrectAnswerFeedbackTryAgainState:function(t){var e=[this.scoreboard,this.controlPanel,this.tryAgainButton,this.challengePromptBanner,this.faceWithPointsNode];"areaEntered"===t.checkSpec&&(e.push(this.numberEntryControl),e.push(this.areaQuestionPrompt)),t.userShapes&&(e.push(this.shapeCarouselLayer),e.push(this.eraserButton)),this.gameAudioPlayer.wrongAnswer(),this.faceWithPointsNode.frown(),this.faceWithPointsNode.setPoints(this.model.score),"areaEntered"===t.checkSpec&&this.numberEntryControl.armForNewEntry(),this.show(e)},handleShowingIncorrectAnswerFeedbackMoveOnState:function(t){var e=[this.scoreboard,this.controlPanel,this.challengePromptBanner,this.faceWithPointsNode];t.buildSpec?(e.push(this.showASolutionButton),this.updateYouBuiltWindow(t),e.push(this.youBuiltWindow),t.userShapes&&(e.push(this.shapeCarouselLayer),e.push(this.eraserButton))):(e.push(this.solutionButton),this.updateYouEnteredWindow(t),e.push(this.youEnteredWindow)),this.show(e),this.gameAudioPlayer.wrongAnswer(),this.faceWithPointsNode.frown(),this.faceWithPointsNode.setPoints(this.model.score),"areaEntered"===t.checkSpec&&(this.challengeLayer.pickable=!1),this.show(e)},handleDisplayingCorrectAnswerState:function(t){var e=[this.scoreboard,this.controlPanel,this.nextButton,this.solutionBanner];t.buildSpec?e.push(this.youBuiltWindow):e.push(this.youEnteredWindow),this.solutionBanner.reset(),t.buildSpec?(this.solutionBanner.titleTextProperty.value=M,this.solutionBanner.buildSpecProperty.value=t.buildSpec):(this.solutionBanner.titleTextProperty.value=z,this.solutionBanner.areaToFindProperty.value=t.backgroundShape.unitArea),this.showChallengeGraphics(),this.challengeLayer.pickable=!1,this.clearDimensionsControlOnNextChallenge=!this.model.simSpecificModel.showDimensions,this.model.simSpecificModel.showDimensions=!0,this.show(e)},handleShowingLevelResultsState:function(){this.model.score===this.model.maxPossibleScore?this.gameAudioPlayer.gameOverPerfectScore():0===this.model.score?this.gameAudioPlayer.gameOverZeroScore():this.gameAudioPlayer.gameOverImperfectScore(),this.showLevelResultsNode(),this.hideChallenge()},updateYouBuiltWindow:function(t){var e=new a(this.areaOfUserCreatedShape,t.buildSpec.perimeter?this.perimeterOfUserCreatedShape:null,t.buildSpec.proportions?{color1:t.buildSpec.proportions.color1,color2:t.buildSpec.proportions.color2,color1Proportion:this.color1Proportion}:null);this.youBuiltWindow.setBuildSpec(e),this.youBuiltWindow.setColorBasedOnAnswerCorrectness(e.equals(t.buildSpec)),this.youBuiltWindow.centerY=this.shapeBoardOriginalBounds.centerY,this.youBuiltWindow.centerX=(this.layoutBounds.maxX+this.shapeBoardOriginalBounds.maxX)/2},updateYouEnteredWindow:function(t){this.youEnteredWindow.setValueEntered(this.model.simSpecificModel.areaGuess),this.youEnteredWindow.setColorBasedOnAnswerCorrectness(t.backgroundShape.unitArea===this.model.simSpecificModel.areaGuess),this.youEnteredWindow.centerY=this.shapeBoardOriginalBounds.centerY,this.youEnteredWindow.centerX=(this.layoutBounds.maxX+this.shapeBoardOriginalBounds.maxX)/2},updateUserAnswer:function(){this.areaOfUserCreatedShape=this.model.simSpecificModel.shapePlacementBoard.areaAndPerimeter.area,this.perimeterOfUserCreatedShape=this.model.simSpecificModel.shapePlacementBoard.areaAndPerimeter.perimeter;var t=this.model.currentChallenge;t.buildSpec&&t.buildSpec.proportions?this.color1Proportion=this.model.simSpecificModel.getProportionOfColor(t.buildSpec.proportions.color1):this.color1Proportion=null,this.model.simSpecificModel.areaGuess=this.numberEntryControl.value},isAnyShapeMoving:function(){for(var t=0;t.9*this.shapeBoardOriginalBounds.width&&r.scale(.9*this.shapeBoardOriginalBounds.width/r.width),this.buildPromptVBox.addChild(r)}else this.buildPromptVBox.addChild(i);e.buildSpec.perimeter&&this.buildPromptVBox.addChild(new P(N.format(G,e.buildSpec.perimeter),{font:$,maxWidth:this.maxShapeBoardTextWidth})),this.buildPromptPanel.centerX=this.shapeBoardOriginalBounds.centerX,this.buildPromptPanel.centerY=this.shapeBoardOriginalBounds.centerY,this.buildPromptPanel.visible=!0,this.buildPromptPanel.opacity=1}else this.buildPromptPanel.visible=!1;if(this.controlPanel.dimensionsIcon.setGridVisible(e.backgroundShape?!1:!0),this.controlPanel.visibilityControls.gridControlVisible=e.toolSpec.gridControl,this.controlPanel.visibilityControls.dimensionsControlVisible=e.toolSpec.dimensionsControl,e.backgroundShape?this.controlPanel.dimensionsIcon.setColor(e.backgroundShape.fillColor):e.userShapes?this.controlPanel.dimensionsIcon.setColor(e.userShapes[0].color):this.controlPanel.dimensionsIcon.setColor(o.GREENISH_COLOR),null!==e.userShapes){var a=[];if(e.userShapes.forEach(function(e){var i={gridSpacing:n.UNIT_SQUARE_LENGTH,shapeDragBounds:t.layoutBounds,nonMovingAncestor:t.shapeCarouselLayer};e.creationLimit&&(i.creationLimit=e.creationLimit),a.push(new w(e.shape,e.color,t.model.simSpecificModel.addUserCreatedMovableShape.bind(t.model.simSpecificModel),i))}),a.length>et)this.shapeCarouselLayer.addChild(new p(a,{orientation:"horizontal",itemsPerPage:et,centerX:this.shapeBoardOriginalBounds.centerX,top:this.shapeBoardOriginalBounds.bottom+tt,fill:o.CONTROL_PANEL_BACKGROUND_COLOR,hideDisabledButtons:!0}));else{var h=new B({children:a,spacing:20});this.shapeCarouselLayer.addChild(new S(h,{centerX:this.shapeBoardOriginalBounds.centerX,top:this.shapeBoardOriginalBounds.bottom+tt,xMargin:50,yMargin:15,fill:o.CONTROL_PANEL_BACKGROUND_COLOR}))}}}},hideAllGameNodes:function(){this.gameControlButtons.forEach(function(t){t.visible=!1}),this.setNodeVisibility(!1,[this.startGameLevelNode,this.faceWithPointsNode,this.scoreboard,this.controlPanel,this.challengePromptBanner,this.solutionBanner,this.numberEntryControl,this.areaQuestionPrompt,this.youBuiltWindow,this.youEnteredWindow,this.shapeCarouselLayer,this.eraserButton])},show:function(t){t.forEach(function(t){t.visible=!0})},setNodeVisibility:function(t,e){e.forEach(function(e){e.visible=t})},hideChallenge:function(){this.challengeLayer.visible=!1,this.controlLayer.visible=!1},showChallengeGraphics:function(){this.challengeLayer.visible=!0,this.controlLayer.visible=!0},updatedCheckButtonEnabledState:function(){this.model.currentChallenge&&("areaEntered"===this.model.currentChallenge.checkSpec?this.checkAnswerButton.enabled=this.numberEntryControl.keypad.digitStringProperty.value.length>0:this.checkAnswerButton.enabled=this.model.simSpecificModel.shapePlacementBoard.areaAndPerimeter.area>0); },showLevelResultsNode:function(){var t=this,e=new E(this.model.level,this.model.score,this.model.maxPossibleScore,this.model.challengesPerSet,this.model.timerEnabled,this.model.elapsedTime,this.model.bestTimes[this.model.level],t.model.newBestTime,function(){t.model.gameState=f.CHOOSING_LEVEL,t.rootNode.removeChild(e),e=null},{center:t.layoutBounds.center});this.rootNode.addChild(e)}})}),i("AREA_BUILDER/game/model/QuizGameModel",["require","AREA_BUILDER/areaBuilder","AREA_BUILDER/game/model/GameState","PHET_CORE/inherit","AXON/Property","AXON/PropertySet"],function(t){"use strict";function e(t,e,i){var r=this;this.challengeFactory=t,this.simSpecificModel=e,i=_.extend({numberOfLevels:6,challengesPerSet:6,maxPointsPerChallenge:2,maxAttemptsPerChallenge:2},i),o.call(this,{soundEnabled:!0,timerEnabled:!1,level:0,challengeIndex:0,currentChallenge:null,score:0,elapsedTime:0,gameState:n.CHOOSING_LEVEL}),this.numberOfLevels=i.numberOfLevels,this.challengesPerSet=i.challengesPerSet,this.maxPointsPerChallenge=i.maxPointsPerChallenge,this.maxPossibleScore=i.challengesPerSet*i.maxPointsPerChallenge,this.maxAttemptsPerChallenge=i.maxAttemptsPerChallenge,r.gameStartTime=0,r.bestTimes=[],r.bestScoreProperties=[],_.times(i.numberOfLevels,function(){r.bestTimes.push(null),r.bestScoreProperties.push(new s(0))}),this.incorrectGuessesOnCurrentChallenge=0,r.challengeList=null,r.currentChallengeProperty.lazyLink(function(t){e.setChallenge(t)})}var i=t("AREA_BUILDER/areaBuilder"),n=t("AREA_BUILDER/game/model/GameState"),r=t("PHET_CORE/inherit"),s=t("AXON/Property"),o=t("AXON/PropertySet");return i.register("QuizGameModel",e),r(o,e,{step:function(t){this.simSpecificModel.step(t)},reset:function(){o.prototype.reset.call(this),this.bestScoreProperties.forEach(function(t){t.reset()}),this.bestTimes=[];var t=this;_.times(this.numberOfLevels,function(){t.bestTimes.push(null)})},startLevel:function(t){this.level=t,this.score=0,this.challengeIndex=0,this.incorrectGuessesOnCurrentChallenge=0,this.restartGameTimer(),this.challengeList=this.challengeFactory.generateChallengeSet(t,this.challengesPerSet),this.currentChallenge=this.challengeList[this.challengeIndex],this.simSpecificModel.startLevel(),this.gameState=n.PRESENTING_INTERACTIVE_CHALLENGE,this.newBestTime=!1},setChoosingLevelState:function(){this.gameState=n.CHOOSING_LEVEL},getChallengeCurrentPointValue:function(){return Math.max(this.maxPointsPerChallenge-this.incorrectGuessesOnCurrentChallenge,0)},checkAnswer:function(t){this.handleProposedAnswer(this.simSpecificModel.checkAnswer(this.currentChallenge))},handleProposedAnswer:function(t){var e=0;t?(this.gameState=n.SHOWING_CORRECT_ANSWER_FEEDBACK,e=0===this.incorrectGuessesOnCurrentChallenge?this.maxPointsPerChallenge:Math.max(this.maxPointsPerChallenge-this.incorrectGuessesOnCurrentChallenge,0),this.score=this.score+e):(this.incorrectGuessesOnCurrentChallenge++,this.incorrectGuessesOnCurrentChallengeA.maxButtonWidth&&(v.maxWidth=b.maxWidth=A.maxButtonWidth-(this.width-C.width),y.setRect(0,0,C.width,y.height),y.center=C.center,R.spacing=T.spacing=y.width+2*p,R.center=T.center=C.center),this.mutate(_.omit(A,"tandem"))}var i=t("SUN/buttons/ButtonListener"),n=t("AXON/DerivedProperty"),r=t("JOIST/HighlightNode"),s=t("PHET_CORE/inherit"),o=t("SCENERY/nodes/Node"),a=t("SCENERY/accessibility/AccessiblePeer"),l=t("SCENERY_PHET/PhetFont"),h=t("AXON/Property"),u=t("SUN/buttons/PushButtonModel"),c=t("SCENERY/nodes/Rectangle"),d=t("SCENERY/nodes/Text"),m=(t("DOT/Util"),t("SCENERY/nodes/VBox")),f=t("JOIST/joist"),p=4;return f.register("NavigationBarScreenButton",e),s(o,e)}),i("string!JOIST/adaptedFrom",function(){return window.phet.chipper.strings.get("JOIST/adaptedFrom")}),i("JOIST/AdaptedFromText",["require","PHET_CORE/inherit","SCENERY_PHET/MultiLineText","SCENERY_PHET/PhetFont","JOIST/joist","string!JOIST/adaptedFrom"],function(t){"use strict";function e(t,e){e=_.extend({align:"right",font:a,maxWidth:60},e),n.call(this,o,e),t.linkAttribute(this,"fill")}var i=t("PHET_CORE/inherit"),n=t("SCENERY_PHET/MultiLineText"),r=t("SCENERY_PHET/PhetFont"),s=t("JOIST/joist"),o=t("string!JOIST/adaptedFrom"),a=new r({family:"Arial",size:10,weight:"bold"});return s.register("AdaptedFromText",e),i(n,e)}),i("SCENERY/nodes/VStrut",["require","PHET_CORE/inherit","SCENERY/scenery","SCENERY/nodes/Spacer"],function(t){"use strict";function e(t,e){r.call(this,0,t,e)}var i=t("PHET_CORE/inherit"),n=t("SCENERY/scenery"),r=t("SCENERY/nodes/Spacer");return n.register("VStrut",e),i(r,e)}),i("JOIST/Dialog",["require","PHET_CORE/inherit","KITE/Shape","SCENERY/nodes/Node","SCENERY/nodes/Path","SUN/Panel","SUN/buttons/RectangularPushButton","SCENERY/accessibility/AccessiblePeer","JOIST/joist"],function(t){"use strict";function e(t,n){var h=this;n=_.extend({modal:!1,title:null,titleAlign:"center",titleSpacing:20,hasCloseButton:!0,layoutStrategy:e.DEFAULT_LAYOUT_STRATEGY,cornerRadius:10,resize:!0,fill:"white",stroke:"black",backgroundPickable:!0,xMargin:20,yMargin:20,closeButtonMargin:5,accessibleContent:{createPeer:function(t){return new i(t,h)}}},n),this.isModal=n.modal,this.isShowing=!1;var u=new s({children:[t]});if(n.title){var c=n.title;u.addChild(c);var d=function(){switch(n.titleAlign){case"center":c.centerX=t.centerX;break;case"left":c.left=t.left;break;case"right":c.right=t.right;break;default:throw new Error("unknown titleAlign for Dialog: "+n.titleAlign)}c.bottom=t.top-n.titleSpacing};n.resize&&(t.addEventListener("bounds",d),c.addEventListener("localBounds",d)),d()}if(a.call(this,u,n),n.hasCloseButton){var m=10,f=new o((new r).moveTo(0,0).lineTo(m,m).moveTo(0,m).lineTo(m,0),{stroke:"#fff",lineWidth:3}),p=new l({content:f,baseColor:"#d00",xMargin:5,yMargin:5,listener:function(){h.hide()}});this.addChild(p);var g=function(){p.right=u.right+n.xMargin-n.closeButtonMargin,p.top=u.top-n.xMargin+n.closeButtonMargin};n.resize&&(u.addEventListener("bounds",g),n.title&&n.title.addEventListener("bounds",g)),g()}var A=window.phet.joist.sim;this.updateLayout=function(){n.layoutStrategy(h,A.bounds,A.screenBounds,A.scale)},this.updateLayout(),this.sim=A}function i(t,e){this.initialize(t,e)}var n=t("PHET_CORE/inherit"),r=t("KITE/Shape"),s=t("SCENERY/nodes/Node"),o=t("SCENERY/nodes/Path"),a=t("SUN/Panel"),l=t("SUN/buttons/RectangularPushButton"),h=t("SCENERY/accessibility/AccessiblePeer"),u=t("JOIST/joist");return u.register("Dialog",e),e.DEFAULT_LAYOUT_STRATEGY=function(t,e,i,n){t.center=e.center.times(1/n)},n(a,e,{show:function(){this.isShowing||(window.phet.joist.sim.showPopup(this,this.isModal),this.isShowing=!0,this.sim.on("resized",this.updateLayout))},hide:function(){this.isShowing&&(window.phet.joist.sim.hidePopup(this,this.isModal),this.isShowing=!1,this.sim.off("resized",this.updateLayout))}},{DialogAccessiblePeer:function(t,e){return new i(t,e)}}),n(h,i,{initialize:function(t,e){var i=t.trail,n=i.getUniqueId();this.domElement=document.createElement("div"),this.initializeAccessiblePeer(t,this.domElement),this.domElement.id="dialog-"+n,this.domElement.setAttribute("role","document")}}),e}),i("string!JOIST/credits.title",function(){return window.phet.chipper.strings.get("JOIST/credits.title")}),i("string!JOIST/credits.leadDesign",function(){return window.phet.chipper.strings.get("JOIST/credits.leadDesign")}),i("string!JOIST/credits.softwareDevelopment",function(){return window.phet.chipper.strings.get("JOIST/credits.softwareDevelopment")}),i("string!JOIST/credits.team",function(){return window.phet.chipper.strings.get("JOIST/credits.team")}),i("string!JOIST/credits.qualityAssurance",function(){return window.phet.chipper.strings.get("JOIST/credits.qualityAssurance")}),i("string!JOIST/credits.graphicArts",function(){return window.phet.chipper.strings.get("JOIST/credits.graphicArts")}),i("string!JOIST/credits.translation",function(){return window.phet.chipper.strings.get("JOIST/credits.translation")}),i("string!JOIST/credits.thanks",function(){return window.phet.chipper.strings.get("JOIST/credits.thanks")}),i("JOIST/CreditsNode",["require","SCENERY/nodes/VBox","SCENERY/nodes/Text","PHET_CORE/inherit","SCENERY_PHET/PhetFont","SCENERY_PHET/MultiLineText","PHETCOMMON/util/StringUtils","SCENERY/nodes/VStrut","JOIST/joist","string!JOIST/credits.title","string!JOIST/credits.leadDesign","string!JOIST/credits.softwareDevelopment","string!JOIST/credits.team","string!JOIST/credits.qualityAssurance","string!JOIST/credits.graphicArts","string!JOIST/credits.translation","string!JOIST/credits.thanks"],function(t){"use strict";function e(t,e){var r=new s({size:14,weight:"bold"}),h=new s(12),E={font:h,align:"left"},b=[];b.push(new n(u,{font:r})),t.leadDesign&&b.push(new o(a.format(c,"‪"+t.leadDesign+"‬"),E)),t.softwareDevelopment&&b.push(new o(a.format(d,"‪"+t.softwareDevelopment+"‬"),E)),t.team&&b.push(new o(a.format(m,"‪"+t.team+"‬"),E)),t.qualityAssurance&&b.push(new o(a.format(f,"‪"+t.qualityAssurance+"‬"),E)),t.graphicArts&&b.push(new o(a.format(p,"‪"+t.graphicArts+"‬"),E)),t.translation&&(b.length>0&&b.push(new l(10)),b.push(new n(g,{font:r})),b.push(new o(t.translation,E))),t.thanks&&(b.length>0&&b.push(new l(10)),b.push(new n(A,{font:r})),b.push(new o(t.thanks,E))),i.call(this,_.extend({align:"left",spacing:1,children:b},e))}var i=t("SCENERY/nodes/VBox"),n=t("SCENERY/nodes/Text"),r=t("PHET_CORE/inherit"),s=t("SCENERY_PHET/PhetFont"),o=t("SCENERY_PHET/MultiLineText"),a=t("PHETCOMMON/util/StringUtils"),l=t("SCENERY/nodes/VStrut"),h=t("JOIST/joist"),u=t("string!JOIST/credits.title"),c=t("string!JOIST/credits.leadDesign"),d=t("string!JOIST/credits.softwareDevelopment"),m=t("string!JOIST/credits.team"),f=t("string!JOIST/credits.qualityAssurance"),p=t("string!JOIST/credits.graphicArts"),g=t("string!JOIST/credits.translation"),A=t("string!JOIST/credits.thanks");return h.register("CreditsNode",e),r(i,e)}),i("SCENERY_PHET/SpinningIndicatorNode",["require","PHET_CORE/inherit","SCENERY/nodes/Node","SCENERY/nodes/Rectangle","SCENERY/nodes/Circle","SCENERY/util/Color","SCENERY_PHET/sceneryPhet"],function(t){"use strict";function e(t){t=_.extend({indicatorSize:15,indicatorSpeed:1,elementFactory:e.rectangleFactory,elementQuantity:16,activeColor:"rgba(0,0,0,1)",inactiveColor:"rgba(0,0,0,0.15)"},t),this.options=t,n.call(this,t),this.indicatorRotation=2*Math.PI,this.activeColor=new o(t.activeColor),this.inactiveColor=new o(t.inactiveColor),this.angleDelta=2*Math.PI/t.elementQuantity,this.elements=[];for(var i=0,r=0;rn?1-5*n:10*(n-.2)/8;var r=n*this.inactiveColor.red+(1-n)*this.activeColor.red,s=n*this.inactiveColor.green+(1-n)*this.activeColor.green,a=n*this.inactiveColor.blue+(1-n)*this.activeColor.blue,l=n*this.inactiveColor.alpha+(1-n)*this.activeColor.alpha;this.elements[i].fill=new o(r,s,a,l),e-=this.angleDelta}}},{rectangleFactory:function(t){return new r(0,0,.175*t.indicatorSize,1.2*t.indicatorSize/t.elementQuantity)},circleFactory:function(t){return new s(.8*t.indicatorSize/t.elementQuantity)}})}),i("text!REPOSITORY/package.json",[],function(){return'{\n "name": "area-builder",\n "version": "1.1.20",\n "license": "GPL-3.0",\n "repository": {\n "type": "git",\n "url": "https://github.com/phetsims/area-builder.git"\n },\n "devDependencies": {\n "grunt": "~0.4.1",\n "grunt-requirejs": "~0.4.0",\n "grunt-eslint": "~17.2.0",\n "uglify-js": "~2.4.0",\n "requirejs": "~2.1.8"\n },\n "phet": {\n "requirejsNamespace": "AREA_BUILDER",\n "phetLibs": [\n "vegas",\n "vibe"\n ],\n "preload": [\n "../sherpa/lib/Tween-r12.js"\n ]\n }\n}'}),i("JOIST/packageJSON",["require","JOIST/joist","text!REPOSITORY/package.json"],function(t){"use strict";var e=t("JOIST/joist"),i=t("text!REPOSITORY/package.json"),n=JSON.parse(i);return e.register("packageJSON",n),n}),i("JOIST/SimVersion",["require","PHET_CORE/inherit","JOIST/joist"],function(t){"use strict";function e(t){this.major=t.major,this.minor=t.minor,this.maintenance=t.maintenance,this.suffix=t.suffix,this.buildTimestamp=t.buildTimestamp}var i=t("PHET_CORE/inherit"),n=t("JOIST/joist");return n.register("SimVersion",e),i(Object,e,{compare:function(t){return this.majort.major?1:this.minort.minor?1:this.maintenancet.maintenance?1:0},get isSimNotPublished(){return this.major<1||1===this.major&&0===this.minor&&0===this.maintenance&&this.suffix},toString:function(){return this.major+"."+this.minor+"."+this.maintenance+(this.suffix?"-"+this.suffix:"")}},{parse:function(t,i){var n=t.match(/(\d+)\.(\d+)\.(\d+)(-(.+))?/);if(!n)throw new Error("could not parse version: "+t);return new e({major:parseInt(n[1],10),minor:parseInt(n[2],10),maintenance:parseInt(n[3],10),suffix:n[5],buildTimestamp:i})}})}),i("JOIST/UpdateCheck",["require","PHET_CORE/inherit","AXON/PropertySet","JOIST/packageJSON","JOIST/SimVersion","BRAND/Brand","JOIST/joist"],function(t){"use strict";function e(){n.call(this,{state:"unchecked",latestVersion:null,updateURL:"http://phet.colorado.edu/en/simulation/"+l}),this.ourVersion=h,this.timeoutCallback=this.timeout.bind(this)}var i=t("PHET_CORE/inherit"),n=t("AXON/PropertySet"),r=t("JOIST/packageJSON"),s=t("JOIST/SimVersion"),o=t("BRAND/Brand"),a=t("JOIST/joist"),l=r.name,h=s.parse(r.version,phet.chipper.buildTimestamp),u="https:"===document.location.protocol?"https:":"http:";i(n,e,{areUpdatesChecked:!window.phetio&&"phet"===o.id&&!o.isPhetApp,updateURL:"http://phet.colorado.edu/html-sim-update?simulation="+encodeURIComponent(l)+"&version="+encodeURIComponent(h.toString())+"&buildTimestamp="+encodeURIComponent(""+phet.chipper.buildTimestamp),timeoutId:-1,timeoutMilliseconds:15e3,clearTimeout:function(){window.clearTimeout(this.timeoutId)},setTimeout:function(){this.timeoutId=window.setTimeout(this.timeoutCallback,this.timeoutMilliseconds)},resetTimeout:function(){"checking"===this.state&&(this.clearTimeout(),this.setTimeout())},timeout:function(){this.state="offline"},check:function(){var t=this;if(this.areUpdatesChecked&&("unchecked"===t.state||"offline"===t.state)){if(this.ourVersion.isSimNotPublished)return void(t.state="up-to-date");var e=new XMLHttpRequest;"withCredentials"in e&&(t.state="checking",t.setTimeout(),e.onload=function(){t.clearTimeout();try{var i=JSON.parse(e.responseText);i.error?(console.log("Update check failure: "+i.error),t.state="offline"):(t.updateURL&&(t.updateURL=i.updateURL),t.latestVersion=s.parse(i.latestVersion,i.buildTimestamp),"out-of-date"===i.state||"up-to-date"===i.state?t.state=i.state:(console.log("Failed to get proper state: "+i.state),t.state="offline"))}catch(n){t.state="offline"}},e.onerror=function(){t.clearTimeout(),t.state="offline"},e.open("post",u+"//phet.colorado.edu/services/check-html-updates",!0),e.send(JSON.stringify({api:"1.0",simulation:l,locale:phet.joist.sim.locale,currentVersion:t.ourVersion.toString(),buildTimestamp:phet.chipper.buildTimestamp})))}}});var c=new e;return a.register("UpdateCheck",c),c}),i("JOIST/LinkText",["require","PHET_CORE/inherit","SCENERY/nodes/Text","SCENERY/input/ButtonListener","SCENERY/accessibility/AccessiblePeer","JOIST/joist"],function(t){"use strict";function e(t,e,i){i=_.extend({handleEvent:!1,accessibleContent:{createPeer:function(i){var n=document.createElement("a");return n.tabIndex="0",n.href=e,n.innerText=t,n.setAttribute("target","_blank"),new s(i,n)}}},i),n.call(this,t,_.extend({fill:"rgb(27,0,241)",cursor:"pointer"},i)),this.addInputListener(new r({fire:function(t){i.handleEvent&&t.handle();var n=window.open(e,"_blank");n.focus()}}))}var i=t("PHET_CORE/inherit"),n=t("SCENERY/nodes/Text"),r=t("SCENERY/input/ButtonListener"),s=t("SCENERY/accessibility/AccessiblePeer"),o=t("JOIST/joist");return o.register("LinkText",e),i(n,e)}),i("string!JOIST/updates.upToDate",function(){return window.phet.chipper.strings.get("JOIST/updates.upToDate")}),i("string!JOIST/updates.outOfDate",function(){return window.phet.chipper.strings.get("JOIST/updates.outOfDate")}),i("string!JOIST/updates.checking",function(){return window.phet.chipper.strings.get("JOIST/updates.checking")}),i("string!JOIST/updates.offline",function(){return window.phet.chipper.strings.get("JOIST/updates.offline")}),i("string!JOIST/updates.newVersionAvailable",function(){return window.phet.chipper.strings.get("JOIST/updates.newVersionAvailable")}),i("string!JOIST/updates.yourCurrentVersion",function(){return window.phet.chipper.strings.get("JOIST/updates.yourCurrentVersion")}),i("string!JOIST/updates.getUpdate",function(){return window.phet.chipper.strings.get("JOIST/updates.getUpdate")}),i("string!JOIST/updates.noThanks",function(){return window.phet.chipper.strings.get("JOIST/updates.noThanks")}),i("JOIST/UpdateNodes",["require","SCENERY/nodes/HBox","SCENERY/nodes/VBox","SCENERY/nodes/Text","SCENERY/nodes/Rectangle","PHETCOMMON/util/StringUtils","SCENERY_PHET/PhetFont","SUN/FontAwesomeNode","SUN/buttons/TextPushButton","SCENERY_PHET/SpinningIndicatorNode","SCENERY/nodes/VStrut","JOIST/UpdateCheck","JOIST/LinkText","JOIST/joist","string!JOIST/updates.upToDate","string!JOIST/updates.outOfDate","string!JOIST/updates.checking","string!JOIST/updates.offline","string!JOIST/updates.newVersionAvailable","string!JOIST/updates.yourCurrentVersion","string!JOIST/updates.getUpdate","string!JOIST/updates.noThanks"],function(t){"use strict";var e=t("SCENERY/nodes/HBox"),i=t("SCENERY/nodes/VBox"),n=t("SCENERY/nodes/Text"),r=t("SCENERY/nodes/Rectangle"),s=t("PHETCOMMON/util/StringUtils"),o=t("SCENERY_PHET/PhetFont"),a=t("SUN/FontAwesomeNode"),l=t("SUN/buttons/TextPushButton"),h=t("SCENERY_PHET/SpinningIndicatorNode"),u=t("SCENERY/nodes/VStrut"),c=t("JOIST/UpdateCheck"),d=t("JOIST/LinkText"),m=t("JOIST/joist"),f=t("string!JOIST/updates.upToDate"),p=t("string!JOIST/updates.outOfDate"),g=t("string!JOIST/updates.checking"),A=t("string!JOIST/updates.offline"),E=t("string!JOIST/updates.newVersionAvailable"),b=t("string!JOIST/updates.yourCurrentVersion"),S=t("string!JOIST/updates.getUpdate"),v=t("string!JOIST/updates.noThanks"),C=new o(14),y=550,w={createCheckingNode:function(t){var i=new h({indicatorSize:t.big?24:18}),r=new e(_.extend({spacing:t.big?10:8,maxWidth:y,children:[i,new n(g,{font:new o(t.big?16:14),fontWeight:t.big?"bold":"normal"})]},t));return r.step=function(t){"checking"===c.state&&i.step(t)},r.stepListener=r.step.bind(r),r},createUpToDateNode:function(t){return new e(_.extend({spacing:8,maxWidth:y,children:[new r(0,0,20,20,5,5,{fill:"#5c3",scale:t.big?1.2:1,children:[new a("check_without_box",{fill:"#fff",scale:.38,centerX:10,centerY:10})]}),new n(f,{font:new o(t.big?16:14),fontWeight:t.big?"bold":"normal"})]},t))},createOutOfDateAboutNode:function(t){return new e(_.extend({spacing:8,cursor:"pointer",maxWidth:y,children:[new a("warning_sign",{fill:"#E87600",scale:.5}),new d(p,c.updateURL,{font:C})]},t))},createOutOfDateDialogNode:function(t,r,a){return new i(_.extend({spacing:15,maxWidth:y,children:[new i({spacing:5,align:"left",children:[new n(s.format(E,r),{font:new o(16),fontWeight:"bold"}),new n(s.format(b,t),{font:C})]}),new e({spacing:25,children:[new l(S,{baseColor:"#6f6",font:C,listener:function(){var t=window.open(c.updateURL,"_blank");t&&t.focus()}}),new l(v,{baseColor:"#ddd",font:C,listener:function(){}})]})]},a))},createOfflineNode:function(t){return new e(_.extend({spacing:0,maxWidth:y,children:[new u(20),new n(A,{font:new o(t.big?16:14),fontWeight:t.big?"bold":"normal"})]},t))}};return m.register("UpdateNodes",w),w}),i("SCENERY_PHET/SubSupText",["require","PHET_CORE/inherit","SCENERY/nodes/Node","SCENERY_PHET/PhetFont","SCENERY/nodes/Text","SCENERY_PHET/sceneryPhet","PHETCOMMON/util/StringUtils"],function(t){"use strict";function e(t,e){e=_.extend({fill:"black",font:new r(20),textXSpacing:0,subScale:.75,subXSpacing:0,subYOffset:0,supScale:.75,supXSpacing:0,supYOffset:0,capHeightScale:.75},e),this._text=t,this._options=e;var i=new s("X",{font:e.font});this._capLineYOffset=e.capHeightScale*(i.top-i.y),n.call(this),this._textParent=new n,this.addChild(this._textParent),this.update(),this.mutate(e)}var i=t("PHET_CORE/inherit"),n=t("SCENERY/nodes/Node"),r=t("SCENERY_PHET/PhetFont"),s=t("SCENERY/nodes/Text"),o=t("SCENERY_PHET/sceneryPhet"),a=t("PHETCOMMON/util/StringUtils");return o.register("SubSupText",e),i(n,e,{update:function(){function t(t,e){e>t&&h.push({mode:l,string:a.embeddedSlice(i,t,e)})}for(var e,i=this._text,n=this._options,r=/<\/?[^>]+>/g,o=0,l="normal",h=[];null!==(e=r.exec(i));){var u=e[0],c=e.index;if(t(o,c),o=c+u.length,"normal"===l)if(""===u)l="sub";else{if(""!==u)break;l="sup"}else if("sub"===l){if(l="normal",""!==u)break}else if("sup"===l&&(l="normal",""!==u))break}t(o,i.length);var d={sub:n.subYOffset,sup:this._capLineYOffset+n.supYOffset},m={sub:n.subXSpacing,sup:n.supXSpacing},f={normal:1,sub:n.subScale,sup:n.supScale};this._textParent.removeAllChildren();for(var p,g=0;gi;i++)this._textParent.getChildAt(i).fill=t},set fill(t){this.setFill(t)},getFill:function(){return this._fill},get fill(){return this.getFill()}})}),i("string!JOIST/versionPattern",function(){return window.phet.chipper.strings.get("JOIST/versionPattern")}),i("JOIST/AboutDialog",["require","SCENERY/nodes/VBox","SCENERY/nodes/Text","SCENERY/nodes/Node","PHET_CORE/inherit","SCENERY/input/ButtonListener","SCENERY_PHET/PhetFont","PHETCOMMON/util/StringUtils","SCENERY/nodes/VStrut","JOIST/Dialog","PHET_CORE/Timer","JOIST/CreditsNode","JOIST/UpdateNodes","JOIST/UpdateCheck","JOIST/LinkText","SCENERY_PHET/SubSupText","SCENERY_PHET/MultiLineText","JOIST/packageJSON","JOIST/joist","string!JOIST/versionPattern"],function(t){"use strict";function e(t,e,s,c,b){var C=this,y=[];if(y.push(new n(t,{font:new a(28),maxWidth:v})),y.push(new n(l.format(S,e),{font:new a(20),maxWidth:v})),phet.chipper.buildTimestamp&&y.push(new n(phet.chipper.buildTimestamp,{font:new a(13),maxWidth:v})),f.areUpdatesChecked){var w={left:0,top:0},R=m.createCheckingNode(w),T=m.createUpToDateNode(w),I=m.createOutOfDateAboutNode(w),N=m.createOfflineNode(w);this.updateStepListener=R.stepListener,this.updateVisibilityListener=function(t){R.visible="checking"===t,T.visible="up-to-date"===t,I.visible="out-of-date"===t,N.visible="offline"===t},y.push(new r({children:[R,T,I,N],maxWidth:v}))}y.push(new h(15)),c.name&&y.push(new g(c.name,{font:new a(16),supScale:.5,supYOffset:2,maxWidth:v})),c.copyright&&y.push(new n(c.copyright,{font:new a(12),maxWidth:v})),c.additionalLicenseStatement&&y.push(new A(c.additionalLicenseStatement,{font:new a(10),fill:"gray",align:"left",maxWidth:v})),!s||"phet"!==c.id&&"phet-io"!==c.id||(y.push(new h(15)),y.push(new d(s,{maxWidth:v})));var P=c.getLinks(E.name,b);if(P&&P.length>0){y.push(new h(15));for(var D=0;Dt&&u>e}function n(t,e){if(!i(t,e))return[0,0,0,0];var n=4*(t*u+e);return[Math.pow(d[n+s]/255,h),Math.pow(d[n+o]/255,h),Math.pow(d[n+a]/255,h),Math.pow(d[n+l]/255,h)]}function r(t,e){return 4*(t*m+e)}for(var s=0,o=1,a=2,l=3,h=2.2,u=t.width,c=t.height,d=t.data,m=Math.ceil(u/2),f=Math.ceil(c/2),p=e(m,f),g=0;c>g;g++)for(var A=0;u>A;A++){var E=n(2*g,2*A),b=n(2*g,2*A+1),S=n(2*g+1,2*A),v=n(2*g+1,2*A+1),C=[0,0,0,0],y=E[l]+b[l]+S[l]+v[l];C[s]=(E[s]*E[l]+b[s]*b[l]+S[s]*S[l]+v[s]*v[l])/y,C[o]=(E[o]*E[l]+b[o]*b[l]+S[o]*S[l]+v[o]*v[l])/y,C[a]=(E[a]*E[l]+b[a]*b[l]+S[a]*S[l]+v[a]*v[l])/y,C[l]=y/4;var w=r(g,A);p[w+s]=Math.floor(255*Math.pow(C[s],1/h)),p[w+o]=Math.floor(255*Math.pow(C[o],1/h)),p[w+a]=Math.floor(255*Math.pow(C[a],1/h)),p[w+l]=Math.floor(255*Math.pow(C[l],1/h))}return{data:p,width:m,height:f}}t.define&&t.define(function(){return e}),"undefined"!=typeof module&&(module.exports=e)}(this),i("../../chipper/js/common/mipmapDownscale",function(){}),i("mipmap",{load:function(t){throw new Error("Dynamic load not allowed: "+t)}}),i("mipmap!BRAND/logo.png",function(){var t=window.phet.chipper.mipmaps["BRAND/logo.png"];return window.phetImages=window.phetImages||[],t.forEach(function(t){t.img=new Image,window.phetImages.push(t.img),t.img.src=t.url}),t}),i("mipmap!BRAND/logo-on-white.png",function(){var t=window.phet.chipper.mipmaps["BRAND/logo-on-white.png"];return window.phetImages=window.phetImages||[],t.forEach(function(t){t.img=new Image,window.phetImages.push(t.img),t.img.src=t.url}),t}),i("string!JOIST/PhetButton.name",function(){return window.phet.chipper.strings.get("JOIST/PhetButton.name")}),i("JOIST/PhetButton",["require","JOIST/AdaptedFromText","BRAND/Brand","SCENERY/nodes/Node","SCENERY/nodes/Image","SUN/FontAwesomeNode","PHET_CORE/inherit","JOIST/PhetMenu","AXON/Property","JOIST/JoistButton","JOIST/UpdateCheck","SCENERY/accessibility/AccessiblePeer","SCENERY/util/TransformTracker","JOIST/joist","mipmap!BRAND/logo.png","mipmap!BRAND/logo-on-white.png","string!JOIST/PhetButton.name"],function(t){"use strict";function e(t,e,i,l){function m(t,e,i){f.right=t.right/i-2/i;var n=t.height-e.height;f.bottom=e.bottom/i+n/2/i}var f=new h(t,{showSaveAndLoad:t.options.showSaveAndLoad,tandem:l.tandem&&l.tandem.createTandem("phetMenu"),closeCallback:function(){f.hide()}});t.on("resized",m),l=_.extend({textDescription:"PhET Menu Button",highlightExtensionWidth:6,highlightExtensionHeight:5,highlightCenterOffsetY:4,tandem:null,listener:function(){f.show()}},l);var p=new o(g,{scale:v,pickable:!1}),E=new a("reorder",{scale:.6,left:p.width+10,bottom:p.bottom-2,pickable:!1}),b=new s({children:[p,E]});c.call(this,b,e,l),"adapted-from-phet"===r.id&&this.addChild(new n(i,{pickable:!1,right:b.left-10,centerY:b.centerY})),u.multilink([e,t.showHomeScreenProperty,d.stateProperty],function(t,e,i){var n="black"!==t&&!e,r="out-of-date"===i;E.fill=n?r?"#0a0":"#222":r?"#3F3":"white",p.image=n?A:g})}function i(t,e){this.initialize(t,e)}var n=t("JOIST/AdaptedFromText"),r=t("BRAND/Brand"),s=t("SCENERY/nodes/Node"),o=t("SCENERY/nodes/Image"),a=t("SUN/FontAwesomeNode"),l=t("PHET_CORE/inherit"),h=t("JOIST/PhetMenu"),u=t("AXON/Property"),c=t("JOIST/JoistButton"),d=t("JOIST/UpdateCheck"),m=t("SCENERY/accessibility/AccessiblePeer"),f=t("SCENERY/util/TransformTracker"),p=t("JOIST/joist"),g=t("mipmap!BRAND/logo.png"),A=t("mipmap!BRAND/logo-on-white.png"),E=t("string!JOIST/PhetButton.name"),b=108,S=.28,v=S/g[0].height*b;return p.register("PhetButton",e),l(c,e,{},{HORIZONTAL_INSET:5,VERTICAL_INSET:0,linkPhetButtonTransform:function(t,e,i){function n(){r.matrix=o.matrix.inverted().timesMatrix(s.matrix)}var r=t.view.phetButton,s=new f(e.phetButton.getUniqueTrailTo(i),{isStatic:!0}),o=new f(r.getParent().getUniqueTrailTo(i),{isStatic:!0});s.addListener(n),o.addListener(n),n()}}),l(m,i,{initialize:function(t,e){this.domElement=document.createElement("input"),this.domElement.type="button",this.domElement.value=E,this.domElement.className="PhetButton",this.initializeAccessiblePeer(t,this.domElement),this.domElementListener=function(){this.hidden=!this.hidden;var t=document.getElementsByClassName("ScreenView");_.each(t,function(t){t.hidden=!t.hidden}),e(),document.getElementsByClassName("phetMenuItem")[0].focus()},this.domElement.addEventListener("click",this.domElementListener),this.dispose()},dispose:function(){m.prototype.dispose.call(this),this.domElement.removeEventListener("click",this.domElementListener)}}),e}),i("JOIST/Frame",["require","PHET_CORE/inherit","SCENERY/nodes/Node","SCENERY/nodes/Rectangle","SCENERY/util/LinearGradient","JOIST/joist"],function(t){"use strict";function e(t,e){e=_.extend({xMargin1:6,yMargin1:6,cornerRadius:0},e),n.call(this);var i=t.width+2*e.xMargin1,o=t.height+2*e.yMargin1;this.gradient=new s(0,0,i,0).addColorStop(0,"#fbff41").addColorStop(.1475,"#fef98b").addColorStop(.465,"#feff40").addColorStop(.77,"#fffccd").addColorStop(1,"#fbff41"),this.rectangle=new r(0,0,i,o,e.cornerRadius,e.cornerRadius,{stroke:this.gradient,lineWidth:3,x:t.x-e.xMargin1,y:t.y-e.yMargin1}),this.addChild(this.rectangle),this.mutate(e),this.frameWidth=i,this.frameHeight=o}var i=t("PHET_CORE/inherit"),n=t("SCENERY/nodes/Node"),r=t("SCENERY/nodes/Rectangle"),s=t("SCENERY/util/LinearGradient"),o=t("JOIST/joist");return o.register("Frame",e),i(n,e,{setHighlighted:function(t){this.rectangle.lineWidth=t?4.5:3,t?this.rectangle.setRect(-0.75,-0.75,this.frameWidth+1.5,this.frameHeight+1.5):this.rectangle.setRect(0,0,this.frameWidth,this.frameHeight)}}),e}),i("JOIST/HomeScreenView",["require","JOIST/PhetButton","SCENERY/nodes/Node","SCENERY/nodes/HBox","SCENERY/nodes/VBox","SCENERY/nodes/Text","KITE/Shape","PHET_CORE/inherit","JOIST/ScreenView","JOIST/Frame","AXON/Property","SCENERY_PHET/PhetFont","SCENERY/nodes/Rectangle","DOT/Bounds2","JOIST/joist","SCENERY/accessibility/AccessiblePeer"],function(t){"use strict";function e(t,e){var l=this;e=_.extend({showSmallHomeScreenIconFrame:!1,warningNode:null,tandem:null},e),h.call(this,{layoutBounds:b});var f=new o(t.name,{font:new d({size:52,family:E}),fill:"white",y:110});this.addChild(f),f.scale(Math.min(1,.9*this.layoutBounds.width/f.width)),f.centerX=this.layoutBounds.centerX;var p=new c(-1),v=_.map(t.screens,function(i){var r=t.screens.indexOf(i),l=new n({children:[i.homeScreenIcon],scale:A/i.homeScreenIcon.height*2}),h=new u(l);p.link(function(t){h.setHighlighted(t===r)});var c=new n({children:[h,l]}),f=new o(i.name,{font:new d(42),fill:"#f2e916"});f.width>c.width&&f.scale(c.width/f.width);var E=function(){b.trigger0("startedCallbacksForFired"),t.showHomeScreen=!1,p.value=-1,b.trigger0("endedCallbacksForFired")},b=new s({resize:!1,cursor:"pointer",children:[c,f],focusable:!0,textDescription:i.name+" Screen: Button",accessibleContent:{createPeer:function(t){var e=document.createElement("input");return e.setAttribute("type","button"),e.setAttribute("value",i.name),e.id="largeButton-"+r,e.tabIndex="0",e.addEventListener("click",function(){E()}),new g(t,e)}}});e.tandem&&e.tandem.createTandem(i.tandem.tail+"LargeButton").addInstance(b),b.addInputListener({down:function(){E()}});var S=new n({opacity:.5,children:[i.homeScreenIcon],scale:4===t.screens.length?1*A/i.homeScreenIcon.height:3===t.screens.length?1.25*A/i.homeScreenIcon.height:2===t.screens.length?1.75*A/i.homeScreenIcon.height:A/i.homeScreenIcon.height}),v=new m(0,0,S.width,S.height,{stroke:e.showSmallHomeScreenIconFrame?"#dddddd":null,lineWidth:.7}),C=new n({opacity:.5,children:[v,S]}),y=new o(i.name,{font:new d(18),fill:"gray"});y.width>C.width&&y.scale(C.width/y.width);var w=function(){R.trigger0("startedCallbacksForFired"),t.screenIndex=r,R.trigger0("endedCallbacksForFired")},R=new s({spacing:3,cursor:"pointer",children:[C,y],focusable:!0,textDescription:i.name+" Screen: Button",accessibleContent:{createPeer:function(t){var e=document.createElement("input");return e.setAttribute("type","button"),e.setAttribute("value",i.name),e.tabIndex="0",e.id="smallButton-"+r,e.addEventListener("focus",function(){w(),document.getElementById("largeButton-"+r).focus()}),new g(t,e)}}});R.mouseArea=R.touchArea=a.bounds(R.bounds),R.addInputListener({down:function(t){w()},over:function(e){e.pointer.isTouch&&(t.screenIndex=r)}}),e.tandem&&e.tandem.createTandem(i.tandem.tail+"SmallButton").addInstance(R);var T={over:function(t){p.value=r,R.children[0].opacity=1,R.children[1].fill="white"},out:function(t){p.value=-1,R.children[0].opacity=.5,R.children[1].fill="gray"}};return R.addInputListener(T),b.addInputListener(T),b.mouseArea=b.touchArea=a.bounds(b.bounds),{screen:i,small:R,large:b,index:r}}),C=new n({y:S});l.addChild(C);var y=null;t.screenIndexProperty.link(function(e){y&&(C.removeChild(y),y.removeAllChildren());var i=2===t.screens.length?60:3===t.screens.length?60:33,n=_.map(v,function(t){return t.index===e?t.large:t.small});y=new r({spacing:i,children:n,align:"top",resize:!1}),C.addChild(y),C.centerX=l.layoutBounds.width/2,C.top=S});var w=new c("black"),R=new c("white");if(this.phetButton=new i(t,w,R,{tandem:e.tandem?e.tandem.createTandem("phetButton"):null}),this.addChild(this.phetButton),e.warningNode){var T=e.warningNode;this.addChild(T),T.centerX=this.layoutBounds.centerX,T.bottom=this.layoutBounds.maxY-20}}var i=t("JOIST/PhetButton"),n=t("SCENERY/nodes/Node"),r=t("SCENERY/nodes/HBox"),s=t("SCENERY/nodes/VBox"),o=t("SCENERY/nodes/Text"),a=t("KITE/Shape"),l=t("PHET_CORE/inherit"),h=t("JOIST/ScreenView"),u=t("JOIST/Frame"),c=t("AXON/Property"),d=t("SCENERY_PHET/PhetFont"),m=t("SCENERY/nodes/Rectangle"),f=t("DOT/Bounds2"),p=t("JOIST/joist"),g=t("SCENERY/accessibility/AccessiblePeer"),A=70,E="Century Gothic, Futura",b=new f(0,0,768,504),S=170;return p.register("HomeScreenView",e),l(h,e,{},{TITLE_FONT_FAMILY:E,LAYOUT_BOUNDS:b})}),i("JOIST/NavigationBar",["require","DOT/Dimension2","JOIST/HomeButton","PHET_CORE/inherit","JOIST/NavigationBarScreenButton","JOIST/HomeScreenView","SCENERY/nodes/Node","JOIST/PhetButton","SCENERY_PHET/PhetFont","SCENERY/nodes/Rectangle","JOIST/Screen","SCENERY/nodes/Text","JOIST/joist"],function(t){"use strict";function e(t,e,i){if(i=_.extend({tandem:null},i),e.length>1)for(var r=c.NAVBAR_ICON_SIZE.width/c.NAVBAR_ICON_SIZE.height,m=c.HOME_SCREEN_ICON_SIZE.width/c.HOME_SCREEN_ICON_SIZE.height,y=0;yt;t++)this.histogram.push(0);$("body").append('
')}var i=t("PHET_CORE/inherit"),n=t("JOIST/joist");return n.register("Profiler",e),i(Object,e,{frameStarted:function(){this.frameStartTime=Date.now(),this.frameCount++},frameEnded:function(){var t=this.frameStartTime-this.lastFrameStartTime;if(this.frameCount%60===0){for(var e=0,i=0;ii;i++)this.histogram[i]=0;this.longTimes.length=0,this.allTimes.length=0}else{var o=t;30>o?this.histogram[o]++:this.longTimes.push(o),this.allTimes.push(o)}this.lastFrameStartTime=this.frameStartTime}},{start:function(t){var i=new e;t.on("frameStarted",function(){i.frameStarted()}),t.on("frameCompleted",function(){i.frameEnded()})}})}),i("JOIST/LookAndFeel",["require","PHET_CORE/inherit","AXON/PropertySet","SCENERY/util/Color","JOIST/joist"],function(t){"use strict";function e(){n.call(this,{backgroundColor:"black"}),this.addDerivedProperty("navigationBarFill",["backgroundColor"],function(t){var e=!!new r(t).equals(r.BLACK);return e?"white":"black"}),this.addDerivedProperty("navigationBarTextFill",["navigationBarFill"],function(t){return"black"===t?"white":"black"})}var i=t("PHET_CORE/inherit"),n=t("AXON/PropertySet"),r=t("SCENERY/util/Color"),s=t("JOIST/joist");return s.register("LookAndFeel",e),i(n,e)}),i("string!JOIST/titlePattern",function(){return window.phet.chipper.strings.get("JOIST/titlePattern")}),i("JOIST/Sim",["require","PHET_CORE/inherit","DOT/Bounds2","DOT/Dimension2","JOIST/NavigationBar","JOIST/HomeScreen","JOIST/HomeScreenView","JOIST/UpdateCheck","SCENERY/util/Util","SCENERY/display/Display","SCENERY/nodes/Node","SCENERY/input/ButtonListener","AXON/PropertySet","AXON/ObservableArray","PHET_CORE/platform","PHET_CORE/Timer","SCENERY/nodes/Rectangle","JOIST/Profiler","SCENERY/input/Input","JOIST/LookAndFeel","JOIST/ScreenshotGenerator","PHETCOMMON/util/StringUtils","JOIST/packageJSON","JOIST/PhetButton","JOIST/joist","string!JOIST/titlePattern"],function(t){"use strict";function e(t,e,i){function r(t){return"true"===t}function a(t){var e,i=new Date;do e=new Date;while(t>e-i)}var h=this;window.phet.joist=window.phet.joist||{},i=_.extend({showHomeScreen:!0,screenIndex:0,standalone:!1,credits:{},optionsNode:null,homeScreenWarningNode:null,recordInputEventLog:!1,playbackMode:!!phet.chipper.getQueryParameter("playbackMode"),inputEventLogName:void 0,batchEvents:!1,showSaveAndLoad:!1,showSmallHomeScreenIconFrame:!1,accessibility:!!phet.chipper.getQueryParameter("accessibility"),virtualCursor:!!phet.chipper.getQueryParameter("virtualCursor"),rootRenderer:p.edge?"canvas":"svg",tandem:null},i),this.tandem=i.tandem,this.options=i,this.playbackMode=i.playbackMode,i.rootRenderer=phet.chipper.getQueryParameter("rootRenderer")||i.rootRenderer;var g=_.isUndefined(i.showHomeScreen)?!0:i.showHomeScreen;if(phet.chipper.getQueryParameter("screens")){var E=phet.chipper.getQueryParameter("screens");e=E.split(".").map(function(t){return e[parseInt(t,10)-1]}),i.screenIndex=0}1===e.length&&(g=!1),m.call(this,{showHomeScreen:g,screenIndex:i.screenIndex||0,scale:1,bounds:null,screenBounds:null,currentScreen:null,active:!0,showPointerAreas:!!phet.chipper.getQueryParameter("showPointerAreas"),showPointers:!!phet.chipper.getQueryParameter("showPointers"),showCanvasNodeBounds:!!phet.chipper.getQueryParameter("showCanvasNodeBounds"),showFittedBlockBounds:!!phet.chipper.getQueryParameter("showFittedBlockBounds")},{tandemSet:i.tandem?{active:i.tandem.createTandem("sim.active"),screenIndex:i.tandem.createTandem("sim.screenIndex"),showHomeScreen:i.tandem.createTandem("sim.showHomeScreen")}:{}}),i.tandem&&i.tandem.createTandem("sim").addInstance(this),this.lookAndFeel=new S,this.destroyed=!1,window.phet.joist.sim=h,window.phet.joist.ScreenshotGenerator=v,this.name=t,this.version=y.version,this.credits=i.credits,this.frameCounter=0,this.inputEventLog=[],this.inputEventBounds=n.NOTHING,this.fuzzMouseAverage=10,this.locale=phet.chipper.locale||"en",$("title").html(C.format(T,t,h.version)),phet.chipper.getQueryParameter("showHomeScreen")&&(i.showHomeScreen=r(phet.chipper.getQueryParameter("showHomeScreen"))),phet.chipper.getQueryParameter("recordInputEventLog")&&(i.recordInputEventLog=!0,i.inputEventLogName=phet.chipper.getQueryParameter("recordInputEventLog")),phet.chipper.getQueryParameter("playbackInputEventLog")&&(i.playbackInputEventLog=!0,i.inputEventLogName=phet.chipper.getQueryParameter("playbackInputEventLog")),phet.chipper.getQueryParameter("fuzzMouse")&&(i.fuzzMouse=!0,"undefined"!==phet.chipper.getQueryParameter("fuzzMouse")&&(h.fuzzMouseAverage=parseFloat(phet.chipper.getQueryParameter("fuzzMouse"))),window.open=function(){return{focus:function(){},blur:function(){}}}),i.fuzzTouches=!!phet.chipper.getQueryParameter("fuzzTouches"),this.trigger1("startedSimConstructor",{sessionID:phet.chipper.getQueryParameter("sessionID")||null,simName:this.name,simVersion:this.version,url:window.location.href,randomSeed:window.phet.chipper.randomSeed});var b=$("body");b.css("padding","0").css("margin","0").css("overflow","hidden"),document.getElementById("sim")&&document.getElementById("sim").parentNode===document.body&&document.body.removeChild(document.getElementById("sim")),document.onselectstart=function(){return!1},this.rootNode=new c({renderer:i.rootRenderer}),this.display=new u(h.rootNode,{allowSceneOverflow:!1,allowWebGL:"false"!==phet.chipper.getQueryParameter("webgl"),accessibility:i.accessibility,virtualCursor:i.virtualCursor,isApplication:!1}),this.activeProperty.link(function(t){h.display.interactive=t});var R=h.display.domElement;R.id="sim",R.setAttribute("aria-hidden",!0),document.body.appendChild(R);var I=this.heartbeatDiv=document.createElement("div");if(I.style.opacity=0,I.style.position="absolute",I.style.left="0",I.style.top="0",I.style.width="0",I.style.height="0",I.style.clip="rect(0,0,0,0)",I.setAttribute("aria-hidden",!0),document.body.appendChild(I),phet.chipper.getQueryParameter("sceneryLog")){var N=phet.chipper.getQueryParameter("sceneryLog");void 0===N||"undefined"===N?this.display.scenery.enableLogging():this.display.scenery.enableLogging(N.split("."))}phet.chipper.getQueryParameter("sceneryStringLog")&&this.display.scenery.switchLogToString(),this.display.initializeWindowEvents({batchDOMEvents:this.options.batchEvents}),window.phet.joist.rootNode=this.rootNode,window.phet.joist.display=this.display,this.showPointersProperty.link(function(t){h.display.setPointerDisplayVisible(!!t)}),this.showPointerAreasProperty.link(function(t){h.display.setPointerAreaDisplayVisible(!!t)}),this.showCanvasNodeBoundsProperty.link(function(t){h.display.setCanvasNodeBoundsVisible(!!t)}),this.showFittedBlockBoundsProperty.link(function(t){h.display.setFittedBlockBoundsVisible(!!t)}),window.phet.joist.makeEverythingSlow=function(){window.setInterval(function(){a(64)},16)},window.phet.joist.makeRandomSlowness=function(){window.setInterval(function(){a(Math.ceil(100+200*Math.random()))},Math.ceil(100+200*Math.random()))},this.screens=e,e.length>1?(this.homeScreen=new o(this,{warningNode:i.homeScreenWarningNode,showSmallHomeScreenIconFrame:i.showSmallHomeScreenIconFrame,tandem:i.tandem?i.tandem.createTandem("homeScreen"):null}),this.homeScreen.initializeModelAndView()):this.homeScreen=null,this.navigationBar=new s(this,e,{tandem:i.tandem?i.tandem.createTandem("navigationBar"):null}),this.updateBackground=function(){h.lookAndFeel.backgroundColor=h.currentScreen?h.currentScreen.backgroundColor.toCSS():h.homeScreen.backgroundColor.toCSS()},this.lookAndFeel.backgroundColorProperty.link(function(t){h.display.backgroundColor=t}),this.multilink(["showHomeScreen","screenIndex"],function(t,i){ h.currentScreen=t?null:e[i],h.updateBackground()}),_.each(e,function(t){t.backgroundColorProperty.link(h.updateBackground),t.initializeModelAndView()}),this.homeScreen&&this.rootNode.addChild(this.homeScreen.view),_.each(e,function(t){t.view.layerSplit=!0,h.rootNode.addChild(t.view)}),this.rootNode.addChild(this.navigationBar),this.homeScreen&&w.linkPhetButtonTransform(this.homeScreen,this.navigationBar,this.rootNode),this.multilink(["screenIndex","showHomeScreen"],function(t,i){h.homeScreen&&h.homeScreen.view.setVisible(i);for(var n=0;n0}),this.barrierRectangle.addInputListener(new d({fire:function(t){h.barrierRectangle.trigger0("startedCallbacksForFired"),h.modalNodeStack.get(h.modalNodeStack.length-1).hide(),h.barrierRectangle.trigger0("endedCallbacksForFired")}})),i.tandem&&i.tandem.createTandem("sim.barrierRectangle").addInstance(this.barrierRectangle),$(window).resize(function(){h.resizeToWindow()}),window.addEventListener("orientationchange",function(){h.resizeToWindow()}),window.visualViewport&&window.visualViewport.addEventListener("resize",function(){h.resizeToWindow()}),this.resizeToWindow(),l.check(),this.lastTime=-1,this.boundRunAnimationLoop=this.runAnimationLoop.bind(this),this.trigger0("simulationStarted"),this.trigger0("endedSimConstructor")}var i=t("PHET_CORE/inherit"),n=t("DOT/Bounds2"),r=t("DOT/Dimension2"),s=t("JOIST/NavigationBar"),o=t("JOIST/HomeScreen"),a=t("JOIST/HomeScreenView"),l=t("JOIST/UpdateCheck"),h=t("SCENERY/util/Util"),u=t("SCENERY/display/Display"),c=t("SCENERY/nodes/Node"),d=t("SCENERY/input/ButtonListener"),m=t("AXON/PropertySet"),f=t("AXON/ObservableArray"),p=t("PHET_CORE/platform"),g=t("PHET_CORE/Timer"),A=t("SCENERY/nodes/Rectangle"),E=t("JOIST/Profiler"),b=t("SCENERY/input/Input"),S=t("JOIST/LookAndFeel"),v=t("JOIST/ScreenshotGenerator"),C=t("PHETCOMMON/util/StringUtils"),y=t("JOIST/packageJSON"),w=t("JOIST/PhetButton"),R=t("JOIST/joist"),T=t("string!JOIST/titlePattern");return R.register("Sim",e),i(m,e,{showPopup:function(t,e){e&&this.modalNodeStack.push(t),this.topLayer.addChild(t),b.pushFocusContext(t.getTrails()[0])},hidePopup:function(t,e){e&&this.modalNodeStack.remove(t),b.popFocusContext(t.getTrails()[0]),this.topLayer.removeChild(t)},resizeToWindow:function(){this.resize(window.innerWidth,window.innerHeight)},resize:function(t,e){var i=this,o=Math.min(t/a.LAYOUT_BOUNDS.width,e/a.LAYOUT_BOUNDS.height);this.barrierRectangle.rectWidth=t/o,this.barrierRectangle.rectHeight=e/o;var l=o*s.NAVIGATION_BAR_SIZE.height;i.navigationBar.layout(o,t,l),i.navigationBar.y=e-l,i.display.setSize(new r(t,e));var h=e-i.navigationBar.height;_.each(i.screens,function(e){e.view.layout(t,h)}),i.topLayer.setScaleMagnitude(o),i.homeScreen&&i.homeScreen.view.layout(t,e),p.mobileSafari&&window.scrollTo(0,0),this.scale=o,this.bounds=new n(0,0,t,e),this.screenBounds=new n(0,0,t,h),this.trigger("resized",this.bounds,this.screenBounds,this.scale)},start:function(){h.polyfillRequestAnimationFrame(),phet.chipper.getQueryParameter("profiler")&&E.start(this),this.boundRunAnimationLoop(),phet.chipper.getQueryParameter("postMessageOnLoad")&&window.parent&&window.parent.postMessage(JSON.stringify({type:"load",url:window.location.href}),"*")},destroy:function(){this.destroyed=!0;var t=this.display.domElement;t.parentNode&&t.parentNode.removeChild(t)},disableRequestAnimationFrame:function(){this.boundRunAnimationLoop=function(){}},runAnimationLoop:function(){this.destroyed||window.requestAnimationFrame(this.boundRunAnimationLoop);var t=Date.now(),e=-1===this.lastTime?1e3/60:t-this.lastTime;this.lastTime=t;var i=e/1e3;this.stepSimulation(i)},stepSimulation:function(t){var e;this.trigger0("frameStarted"),this.frameCounter++,this.frameCounter%1e3===0&&(this.heartbeatDiv.innerHTML=Math.random()),this.options.fuzzMouse?this.display.fuzzMouseEvents(this.fuzzMouseAverage):this.options.fuzzTouches||this.options.batchEvents&&(this.active?this.display._input.fireBatchedEvents():this.display._input.clearBatchedEvents()),this.active&&(this.showHomeScreen||(e=this.screens[this.screenIndex],e.model.step&&t&&e.model.step(t),e.view.step&&e.view.step(t)),g.step(t),window.TWEEN&&window.TWEEN.update()),this.display.updateDisplay(),this.trigger1("frameCompleted",t)}})}),i("JOIST/checkNamespaces",["require","JOIST/joist"],function(t){"use strict";var e=t("JOIST/joist"),i=function(){return};return e.register("checkNamespaces",i),i}),i("JOIST/SimLauncher",["require","JOIST/checkNamespaces","JOIST/joist"],function(t){"use strict";var e=t("JOIST/checkNamespaces"),i=t("JOIST/joist"),n={launch:function(t){function i(){$("#splash").remove(),t()}window.phet.joist=window.phet.joist||{},window.phet.joist.launchCalled=!0;var n=[],r=0;if(window.phetImages)for(var s=0;s