{ "version":3, "file":"waud.js", "sourceRoot":"file:///", "sources":["/projects/waud/src/AudioManager.hx","/projects/waud/src/BaseSound.hx","/usr/local/lib/haxe/std/js/_std/EReg.hx","/projects/waud/src/HTML5Sound.hx","/usr/local/lib/haxe/std/js/_std/HxOverrides.hx","/usr/local/lib/haxe/std/js/_std/Reflect.hx","/usr/local/lib/haxe/std/js/_std/Std.hx","/usr/local/lib/haxe/std/js/_std/Type.hx","/projects/waud/src/Waud.hx","/projects/waud/src/WaudFocusManager.hx","/projects/waud/src/WaudSound.hx","/projects/waud/src/WaudUtils.hx","/projects/waud/src/WebAudioAPISound.hx","/usr/local/lib/haxe/std/haxe/Timer.hx","/usr/local/lib/haxe/std/js/_std/haxe/ds/StringMap.hx","/usr/local/lib/haxe/std/js/Boot.hx"], "sourcesContent":["import js.html.AudioElement;\nimport js.html.SourceElement;\nimport js.html.audio.AudioBufferSourceNode;\nimport js.html.audio.AudioContext;\nimport js.Browser;\n\nclass AudioManager {\n\n\t/**\n\t* Audio Types.\n\t*\n\t* @property types\n\t* @protected\n\t* @type {Map}\n\t*/\n\tpublic var types:Map;\n\n\t/**\n\t* Audio Context instance.\n\t*\n\t* @property audioContext\n\t* @protected\n\t* @type {AudioContext}\n\t*/\n\tpublic var audioContext(default, null):AudioContext;\n\n\t/**\n\t* Audio buffer list.\n\t*\n\t* @property bufferList\n\t* @protected\n\t* @type {Map}\n\t*/\n\tpublic var bufferList:Map;\n\n\t/**\n\t* Audio Context Class determined based on the browser type. Refer {{#crossLink \"AudioManager/checkWebAudioAPISupport:method\"}}{{/crossLink}} method.\n\t*\n\t* @property AudioContextClass\n\t* @static\n\t* @private\n\t* @type {AudioContext|webkitAudioContext}\n\t*/\n\tstatic var AudioContextClass:Dynamic;\n\n\tstatic inline var AUDIO_CONTEXT:String = \"this.audioContext\";\n\n\t/**\n\t* Audio Manager class instantiated in {{#crossLink \"Waud/init:method\"}}Waud.init{{/crossLink}} method.\n\t*\n\t* @class AudioManager\n\t* @constructor\n\t* @example\n\t* \t\tWaud.audioManager\n\t*/\n\tpublic function new() {\n\t\tbufferList = new Map();\n\n\t\ttypes = new Map();\n\t\ttypes.set(\"mp3\", \"audio/mpeg\");\n\t\ttypes.set(\"ogg\", \"audio/ogg\");\n\t\ttypes.set(\"wav\", \"audio/wav\");\n\t\ttypes.set(\"aac\", \"audio/aac\");\n\t\ttypes.set(\"m4a\", \"audio/x-m4a\");\n\t}\n\n\t/**\n\t* Function to check web audio api support.\n\t*\n\t* Used by {{#crossLink \"Waud/init:method\"}}Waud.init{{/crossLink}} method.\n\t*\n\t* @method checkWebAudioAPISupport\n\t*/\n\tpublic function checkWebAudioAPISupport():Bool {\n\t\tif (Reflect.field(Browser.window, \"AudioContext\") != null) {\n\t\t\tAudioContextClass = Reflect.field(Browser.window, \"AudioContext\");\n\t\t\treturn true;\n\t\t}\n\t\telse if (Reflect.field(Browser.window, \"webkitAudioContext\") != null) {\n\t\t\tAudioContextClass = Reflect.field(Browser.window, \"webkitAudioContext\");\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t* Function to unlock audio on `touchend` event.\n\t*\n\t* Used by {{#crossLink \"Waud/enableTouchUnlock:method\"}}Waud.enableTouchUnlock{{/crossLink}} method.\n\t*\n\t* @method unlockAudio\n\t*/\n\tpublic function unlockAudio() {\n\t\tif (audioContext != null) {\n\t\t\tvar bfr = audioContext.createBuffer(1, 1, Waud.preferredSampleRate);\n\t\t\tvar src:AudioBufferSourceNode = audioContext.createBufferSource();\n\t\t\tsrc.buffer = bfr;\n\t\t\tsrc.connect(audioContext.destination);\n\t\t\tif (Reflect.field(src, \"start\") != null) src.start(0);\n\t\t\telse untyped __js__(\"src\").noteOn(0);\n\t\t\tif (src.onended != null) src.onended = _unlockCallback;\n\t\t\telse haxe.Timer.delay(_unlockCallback, 1);\n\t\t}\n\t\telse {\n\t\t\tvar audio:AudioElement = Browser.document.createAudioElement();\n\t\t\tvar source:SourceElement = Browser.document.createSourceElement();\n\t\t\tsource.src = \"data:audio/wave;base64,UklGRjIAAABXQVZFZm10IBIAAAABAAEAQB8AAEAfAAABAAgAAABmYWN0BAAAAAAAAABkYXRhAAAAAA==\";\n\t\t\taudio.appendChild(source);\n\t\t\tBrowser.document.appendChild(audio);\n\t\t\taudio.play();\n\t\t\t_unlockCallback();\n\t\t}\n\t}\n\n\tinline function _unlockCallback() {\n\t\tif (Waud.__touchUnlockCallback != null) Waud.__touchUnlockCallback();\n\t\tWaud.dom.ontouchend = null;\n\t}\n\n\t/**\n\t* Function to create audio context.\n\t*\n\t* Used by {{#crossLink \"Waud/init:method\"}}Waud.init{{/crossLink}} method.\n\t*\n\t* @method createAudioContext\n\t* @return AudioContext\n\t*/\n\tpublic function createAudioContext():AudioContext {\n\t\tif (audioContext == null) {\n\t\t\ttry {\n\t\t\t\tif (AudioContextClass != null) audioContext = cast Type.createInstance(AudioContextClass, []);\n\t\t\t}\n\t\t\tcatch (e:Dynamic) {\n\t\t\t\taudioContext = null;\n\t\t\t}\n\t\t}\n\t\treturn audioContext;\n\t}\n\n\t/**\n\t* Function to close audio context and reset all variables.\n\t*\n\t* Used by {{#crossLink \"Waud/destroy:method\"}}Waud.destroy{{/crossLink}} method.\n\t*\n\t* @method destroy\n\t*/\n\tpublic function destroy() {\n\t\tif (audioContext != null && untyped __js__(AUDIO_CONTEXT).close != null && untyped __js__(AUDIO_CONTEXT).close != \"\") {\n\t\t\tuntyped __js__(AUDIO_CONTEXT).close();\n\t\t}\n\t\taudioContext = null;\n\t\tbufferList = null;\n\t\ttypes = null;\n\t}\n\n\t/**\n\t* This function suspends the progression of time in the audio context, temporarily halting audio hardware access and reducing CPU/battery usage in the process.\n\t* This is useful if you want an application to power down the audio hardware when it will not be using an audio context for a while.\n\t*\n\t* @method suspendContext\n\t* @example\n\t* Waud.audioManager.suspendContext();\n\t*/\n\tpublic function suspendContext() {\n\t\tif (audioContext != null) {\n\t\t\tif (untyped __js__(AUDIO_CONTEXT).suspend != null) untyped __js__(AUDIO_CONTEXT).suspend();\n\t\t}\n\t}\n\n\t/**\n\t* This function resumes the progression of time in an audio context that has previously been suspended.\n\t*\n\t* @method resumeContext\n\t* @example\n\t* Waud.audioManager.resumeContext();\n\t*/\n\tpublic function resumeContext() {\n\t\tif (audioContext != null) {\n\t\t\tif (untyped __js__(AUDIO_CONTEXT).resume != null) untyped __js__(AUDIO_CONTEXT).resume();\n\t\t}\n\t}\n}","@:keep class BaseSound {\n\n\tpublic var isSpriteSound:Bool;\n\tpublic var url:String;\n\n\tvar _options:WaudSoundOptions;\n\tvar _isLoaded:Bool;\n\tvar _isPlaying:Bool;\n\tvar _muted:Bool;\n\n\tpublic function new(sndUrl:String, ?options:WaudSoundOptions = null) {\n\t\tif (sndUrl == null || sndUrl == \"\") {\n\t\t\ttrace(\"invalid sound url\");\n\t\t\treturn;\n\t\t}\n\t\tif (Waud.audioManager == null) {\n\t\t\ttrace(\"initialise Waud using Waud.init() before loading sounds\");\n\t\t\treturn;\n\t\t}\n\t\tisSpriteSound = false;\n\t\turl = sndUrl;\n\t\t_isLoaded = false;\n\t\t_isPlaying = false;\n\t\t_muted = false;\n\t\tif (options == null) options = {};\n\n\t\toptions.autoplay = (options.autoplay != null) ? options.autoplay : Waud.defaults.autoplay;\n\t\toptions.webaudio = (options.webaudio != null) ? options.webaudio : Waud.defaults.webaudio;\n\t\toptions.preload = (options.preload != null) ? options.preload : Waud.defaults.preload;\n\t\toptions.loop = (options.loop != null) ? options.loop : Waud.defaults.loop;\n\t\toptions.volume = (options.volume != null && options.volume >= 0 && options.volume <= 1) ? options.volume : Waud.defaults.volume;\n\t\toptions.onload = (options.onload != null) ? options.onload : Waud.defaults.onload;\n\t\toptions.onend = (options.onend != null) ? options.onend : Waud.defaults.onend;\n\t\toptions.onerror = (options.onerror != null) ? options.onerror : Waud.defaults.onerror;\n\n\t\t_options = options;\n\t}\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class EReg {\n\n\tvar r : HaxeRegExp;\n\n\tpublic function new( r : String, opt : String ) : Void {\n\t\topt = opt.split(\"u\").join(\"\"); // 'u' (utf8) depends on page encoding\n\t\tthis.r = new HaxeRegExp(r, opt);\n\t}\n\n\tpublic function match( s : String ) : Bool {\n\t\tif( r.global ) r.lastIndex = 0;\n\t\tr.m = r.exec(s);\n\t\tr.s = s;\n\t\treturn (r.m != null);\n\t}\n\n\tpublic function matched( n : Int ) : String {\n\t\treturn if( r.m != null && n >= 0 && n < r.m.length ) r.m[n] else throw \"EReg::matched\";\n\t}\n\n\tpublic function matchedLeft() : String {\n\t\tif( r.m == null ) throw \"No string matched\";\n\t\treturn r.s.substr(0,r.m.index);\n\t}\n\n\tpublic function matchedRight() : String {\n\t\tif( r.m == null ) throw \"No string matched\";\n\t\tvar sz = r.m.index+r.m[0].length;\n\t\treturn r.s.substr(sz,r.s.length-sz);\n\t}\n\n\tpublic function matchedPos() : { pos : Int, len : Int } {\n\t\tif( r.m == null ) throw \"No string matched\";\n\t\treturn { pos : r.m.index, len : r.m[0].length };\n\t}\n\n\tpublic function matchSub( s : String, pos : Int, len : Int = -1):Bool {\n\t\treturn if (r.global) {\n\t\t\tr.lastIndex = pos;\n\t\t\tr.m = r.exec(len < 0 ? s : s.substr(0, pos + len));\n\t\t\tvar b = r.m != null;\n\t\t\tif (b) {\n\t\t\t\tr.s = s;\n\t\t\t}\n\t\t\tb;\n\t\t} else {\n\t\t\t// TODO: check some ^/$ related corner cases\n\t\t\tvar b = match( len < 0 ? s.substr(pos) : s.substr(pos,len) );\n\t\t\tif (b) {\n\t\t\t\tr.s = s;\n\t\t\t\tr.m.index += pos;\n\t\t\t}\n\t\t\tb;\n\t\t}\n\t}\n\n\tpublic function split( s : String ) : Array {\n\t\t// we can't use directly s.split because it's ignoring the 'g' flag\n\t\tvar d = \"#__delim__#\";\n\t\treturn untyped s.replace(r,d).split(d);\n\t}\n\n\tpublic function replace( s : String, by : String ) : String {\n\t\treturn untyped s.replace(r,by);\n\t}\n\n\tpublic function map( s : String, f : EReg -> String ) : String {\n\t\tvar offset = 0;\n\t\tvar buf = new StringBuf();\n\t\tdo {\n\t\t\tif (offset >= s.length)\n\t\t\t\tbreak;\n\t\t\telse if (!matchSub(s, offset)) {\n\t\t\t\tbuf.add(s.substr(offset));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvar p = matchedPos();\n\t\t\tbuf.add(s.substr(offset, p.pos - offset));\n\t\t\tbuf.add(f(this));\n\t\t\tif (p.len == 0) {\n\t\t\t\tbuf.add(s.substr(p.pos, 1));\n\t\t\t\toffset = p.pos + 1;\n\t\t\t}\n\t\t\telse\n\t\t\t\toffset = p.pos + p.len;\n\t\t} while (r.global);\n\t\tif (!r.global && offset > 0 && offset < s.length)\n\t\t\tbuf.add(s.substr(offset));\n\t\treturn buf.toString();\n\t}\n}\n\n@:native(\"RegExp\")\nprivate extern class HaxeRegExp extends js.RegExp {\n\tvar m:js.RegExp.RegExpMatch;\n\tvar s:String;\n}\n","import haxe.Timer;\nimport js.html.SourceElement;\nimport js.html.AudioElement;\n\n@:keep class HTML5Sound extends BaseSound implements IWaudSound {\n\n\tvar _snd:AudioElement;\n\tvar _src:SourceElement;\n\tvar _tmr:Timer;\n\n\tpublic function new(url:String, ?options:WaudSoundOptions = null) {\n\t\t#if debug trace(\"using html5 audio - \" + url); #end\n\t\tsuper(url, options);\n\t\t_snd = Waud.dom.createAudioElement();\n\t\t_addSource(url);\n\t\tif (_options.preload) load();\n\t}\n\n\tpublic function load(?callback:IWaudSound -> Void):IWaudSound {\n\t\tif (!_isLoaded) {\n\t\t\t_snd.autoplay = _options.autoplay;\n\t\t\t_snd.loop = _options.loop;\n\t\t\t_snd.volume = _options.volume;\n\n\t\t\tif (callback != null) _options.onload = callback;\n\n\t\t\tif (_options.preload) _snd.preload = \"auto\";\n\t\t\telse _snd.preload = \"metadata\"; //none\n\n\t\t\tif (_options.onload != null) {\n\t\t\t\t_isLoaded = true;\n\t\t\t\t_snd.onloadeddata = function() {\n\t\t\t\t\t_options.onload(this);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t_snd.onplaying = function() {\n\t\t\t\t_isPlaying = true;\n\t\t\t}\n\n\t\t\t_snd.onended = function() {\n\t\t\t\t_isPlaying = false;\n\t\t\t\tif (_options.onend != null) _options.onend(this);\n\t\t\t}\n\n\t\t\tif (_options.onerror != null) {\n\t\t\t\t_snd.onerror = function() {\n\t\t\t\t\t_options.onerror(this);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t_snd.load();\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tfunction _addSource(url:String):SourceElement {\n\t\t_src = Waud.dom.createSourceElement();\n\t\t_src.src = url;\n\n\t\tif (Waud.audioManager.types.get(_getExt(url)) != null) _src.type = Waud.audioManager.types.get(_getExt(url));\n\t\t_snd.appendChild(_src);\n\n\t\treturn _src;\n\t}\n\n\tfunction _getExt(filename:String):String {\n\t\treturn filename.split(\".\").pop();\n\t}\n\n\tpublic function setVolume(val:Float) {\n\t\tif (val >= 0 && val <= 1) _options.volume = val;\n\t\tif (!_isLoaded) return;\n\t\t_snd.volume = _options.volume;\n\t}\n\n\tpublic function getVolume():Float {\n\t\treturn _options.volume;\n\t}\n\n\tpublic function mute(val:Bool) {\n\t\tif (!_isLoaded) return;\n\t\t_snd.muted = val;\n\t\tif (WaudUtils.isiOS()) {\n\t\t\tif (val && isPlaying()) {\n\t\t\t\t_muted = true;\n\t\t\t\t_snd.pause();\n\t\t\t}\n\t\t\telse if (_muted) {\n\t\t\t\t_muted = false;\n\t\t\t\t_snd.play();\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function play(?spriteName:String, ?soundProps:AudioSpriteSoundProperties):Int {\n\t\tif (!_isLoaded || _snd == null) {\n\t\t\ttrace(\"sound not loaded\");\n\t\t\treturn -1;\n\t\t}\n\t\tif (_muted) return -1;\n\t\tif (isSpriteSound && soundProps != null) {\n\t\t\t_snd.currentTime = soundProps.start;\n\t\t\tif (_tmr != null) _tmr.stop();\n\t\t\t_tmr = Timer.delay(function() {\n\t\t\t\tif (soundProps.loop != null && soundProps.loop) {\n\t\t\t\t\tplay(spriteName, soundProps);\n\t\t\t\t}\n\t\t\t\telse stop();\n\t\t\t},\n\t\t\tMath.ceil(soundProps.duration * 1000));\n\t\t}\n\t\tif (!_isPlaying) _snd.play();\n\t\treturn 0;\n\t}\n\n\tpublic function isPlaying():Bool {\n\t\treturn _isPlaying;\n\t}\n\n\tpublic function loop(val:Bool) {\n\t\tif (!_isLoaded || _snd == null) return;\n\t\t_snd.loop = val;\n\t}\n\n\tpublic function stop() {\n\t\tif (!_isLoaded || _snd == null) return;\n\t\t_snd.pause();\n\t\t_snd.currentTime = 0;\n\t\t_isPlaying = false;\n\t}\n\n\tpublic function pause() {\n\t\tif (!_isLoaded || _snd == null) return;\n\t\t_snd.pause();\n\t\t_isPlaying = false;\n\t}\n\n\tpublic function onEnd(callback:IWaudSound -> Void):IWaudSound {\n\t\t_options.onend = callback;\n\t\treturn this;\n\t}\n\n\tpublic function onLoad(callback:IWaudSound -> Void):IWaudSound {\n\t\t_options.onload = callback;\n\t\treturn this;\n\t}\n\n\tpublic function onError(callback:IWaudSound -> Void):IWaudSound {\n\t\t_options.onerror = callback;\n\t\treturn this;\n\t}\n\n\tpublic function destroy() {\n\t\tif (_snd != null) {\n\t\t\t_snd.pause();\n\t\t\t_snd.removeChild(_src);\n\t\t\t_src = null;\n\t\t\t_snd = null;\n\t\t}\n\t\t_isPlaying = false;\n\t}\n}","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:noDoc\nclass HxOverrides {\n\n\tstatic function dateStr( date :Date ) : String {\n\t\tvar m = date.getMonth() + 1;\n\t\tvar d = date.getDate();\n\t\tvar h = date.getHours();\n\t\tvar mi = date.getMinutes();\n\t\tvar s = date.getSeconds();\n\t\treturn date.getFullYear()\n\t\t\t+\"-\"+(if( m < 10 ) \"0\"+m else \"\"+m)\n\t\t\t+\"-\"+(if( d < 10 ) \"0\"+d else \"\"+d)\n\t\t\t+\" \"+(if( h < 10 ) \"0\"+h else \"\"+h)\n\t\t\t+\":\"+(if( mi < 10 ) \"0\"+mi else \"\"+mi)\n\t\t\t+\":\"+(if( s < 10 ) \"0\"+s else \"\"+s);\n\t}\n\n\tstatic function strDate( s : String ) : Date {\n\t\tswitch( s.length ) {\n\t\tcase 8: // hh:mm:ss\n\t\t\tvar k = s.split(\":\");\n\t\t\tvar d : Date = untyped __new__(Date);\n\t\t\tuntyped d[\"setTime\"](0);\n\t\t\tuntyped d[\"setUTCHours\"](k[0]);\n\t\t\tuntyped d[\"setUTCMinutes\"](k[1]);\n\t\t\tuntyped d[\"setUTCSeconds\"](k[2]);\n\t\t\treturn d;\n\t\tcase 10: // YYYY-MM-DD\n\t\t\tvar k = s.split(\"-\");\n\t\t\treturn new Date(cast k[0],cast untyped k[1] - 1,cast k[2],0,0,0);\n\t\tcase 19: // YYYY-MM-DD hh:mm:ss\n\t\t\tvar k = s.split(\" \");\n\t\t\tvar y = k[0].split(\"-\");\n\t\t\tvar t = k[1].split(\":\");\n\t\t\treturn new Date(cast y[0],cast untyped y[1] - 1,cast y[2],cast t[0],cast t[1],cast t[2]);\n\t\tdefault:\n\t\t\tthrow \"Invalid date format : \" + s;\n\t\t}\n\t}\n\n\tstatic function cca( s : String, index : Int ) : Null {\n\t\tvar x = (cast s).charCodeAt(index);\n\t\tif( x != x ) // fast isNaN\n\t\t\treturn untyped undefined; // isNaN will still return true\n\t\treturn x;\n\t}\n\n\tstatic function substr( s : String, pos : Int, ?len : Int ) : String {\n\t\tif( pos != null && pos != 0 && len != null && len < 0 ) return \"\";\n\t\tif( len == null ) len = s.length;\n\t\tif( pos < 0 ){\n\t\t\tpos = s.length + pos;\n\t\t\tif( pos < 0 ) pos = 0;\n\t\t}else if( len < 0 ){\n\t\t\tlen = s.length + len - pos;\n\t\t}\n\n\t\treturn (untyped s).substr(pos, len);\n\t}\n\n\tstatic function indexOf( a : Array, obj : T, i : Int) {\n\t\tvar len = a.length;\n\t\tif (i < 0) {\n\t\t\ti += len;\n\t\t\tif (i < 0) i = 0;\n\t\t}\n\t\twhile (i < len)\n\t\t{\n\t\t\tif (untyped __js__(\"a[i] === obj\"))\n\t\t\t\treturn i;\n\t\t\ti++;\n\t\t}\n\t\treturn -1;\n\t}\n\n\tstatic function lastIndexOf( a : Array, obj : T, i : Int) {\n\t\tvar len = a.length;\n\t\tif (i >= len)\n\t\t\ti = len - 1;\n\t\telse if (i < 0)\n\t\t\ti += len;\n\t\twhile (i >= 0)\n\t\t{\n\t\t\tif (untyped __js__(\"a[i] === obj\"))\n\t\t\t\treturn i;\n\t\t\ti--;\n\t\t}\n\t\treturn -1;\n\t}\n\n\tstatic function remove( a : Array, obj : T ) {\n\t\tvar i = a.indexOf(obj);\n\t\tif( i == -1 ) return false;\n\t\ta.splice(i,1);\n\t\treturn true;\n\t}\n\n\tstatic function iter( a : Array ) : Iterator untyped {\n\t\treturn {\n\t\t\tcur : 0,\n\t\t\tarr : a,\n\t\t\thasNext : function() {\n\t\t\t\treturn __this__.cur < __this__.arr.length;\n\t\t\t},\n\t\t\tnext : function() {\n\t\t\t\treturn __this__.arr[__this__.cur++];\n\t\t\t}\n\t\t};\n\t}\n\n\tstatic function __init__() untyped {\n#if !js_es5\n\t\t__feature__('HxOverrides.indexOf', if( Array.prototype.indexOf ) __js__(\"HxOverrides\").indexOf = function(a,o,i) return Array.prototype.indexOf.call(a, o, i));\n\t\t__feature__('HxOverrides.lastIndexOf', if( Array.prototype.lastIndexOf ) __js__(\"HxOverrides\").lastIndexOf = function(a,o,i) return Array.prototype.lastIndexOf.call(a, o, i));\n#end\n\t}\n\n}\n","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n@:coreApi class Reflect {\n\n\tpublic inline static function hasField( o : Dynamic, field : String ) : Bool {\n\t\treturn untyped __js__('Object').prototype.hasOwnProperty.call(o, field);\n\t}\n\n\tpublic static function field( o : Dynamic, field : String ) : Dynamic {\n\t\ttry return untyped o[field] catch( e : Dynamic ) return null;\n\t}\n\n\tpublic inline static function setField( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\to[field] = value;\n\t}\n\n\tpublic static inline function getProperty( o : Dynamic, field : String ) : Dynamic untyped {\n\t\tvar tmp;\n\t\treturn if( o == null ) __define_feature__(\"Reflect.getProperty\",null) else if( o.__properties__ && (tmp=o.__properties__[\"get_\"+field]) ) o[tmp]() else o[field];\n\t}\n\n\tpublic static inline function setProperty( o : Dynamic, field : String, value : Dynamic ) : Void untyped {\n\t\tvar tmp;\n\t\tif( o.__properties__ && (tmp=o.__properties__[\"set_\"+field]) ) o[tmp](value) else o[field] = __define_feature__(\"Reflect.setProperty\",value);\n\t}\n\n\tpublic inline static function callMethod( o : Dynamic, func : haxe.Constraints.Function, args : Array ) : Dynamic untyped {\n\t\treturn func.apply(o,args);\n\t}\n\n\tpublic static function fields( o : Dynamic ) : Array {\n\t\tvar a = [];\n\t\tif (o != null) untyped {\n\t\t\tvar hasOwnProperty = __js__('Object').prototype.hasOwnProperty;\n\t\t\t__js__(\"for( var f in o ) {\");\n\t\t\tif( f != \"__id__\" && f != \"hx__closures__\" && hasOwnProperty.call(o, f) ) a.push(f);\n\t\t\t__js__(\"}\");\n\t\t}\n\t\treturn a;\n\t}\n\n\tpublic static function isFunction( f : Dynamic ) : Bool untyped {\n\t\treturn __js__(\"typeof(f)\") == \"function\" && !(js.Boot.isClass(f) || js.Boot.isEnum(f));\n\t}\n\n\tpublic static function compare( a : T, b : T ) : Int {\n\t\treturn ( a == b ) ? 0 : (((cast a) > (cast b)) ? 1 : -1);\n\t}\n\n\tpublic static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : Bool {\n\t\tif( f1 == f2 )\n\t\t\treturn true;\n\t\tif( !isFunction(f1) || !isFunction(f2) )\n\t\t\treturn false;\n\t\treturn f1.scope == f2.scope && f1.method == f2.method && f1.method != null;\n\t}\n\n\tpublic static function isObject( v : Dynamic ) : Bool untyped {\n\t\tif( v == null )\n\t\t\treturn false;\n\t\tvar t = __js__(\"typeof(v)\");\n\t\treturn (t == \"string\" || (t == \"object\" && v.__enum__ == null)) || (t == \"function\" && (js.Boot.isClass(v) || js.Boot.isEnum(v)) != null);\n\t}\n\n\tpublic static function isEnumValue( v : Dynamic ) : Bool {\n\t\treturn v != null && v.__enum__ != null;\n\t}\n\n\tpublic static function deleteField( o : Dynamic, field : String ) : Bool untyped {\n\t\tif( !hasField(o,field) ) return false;\n\t\t__js__(\"delete\")(o[field]);\n\t\treturn true;\n\t}\n\n\tpublic static function copy( o : T ) : T {\n\t\tvar o2 : Dynamic = {};\n\t\tfor( f in Reflect.fields(o) )\n\t\t\tReflect.setField(o2,f,Reflect.field(o,f));\n\t\treturn o2;\n\t}\n\n\t@:overload(function( f : Array -> Void ) : Dynamic {})\n\tpublic static function makeVarArgs( f : Array -> Dynamic ) : Dynamic {\n\t\treturn function() {\n\t\t\tvar a = untyped Array.prototype.slice.call(__js__(\"arguments\"));\n\t\t\treturn f(a);\n\t\t};\n\t}\n\n}\n","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport js.Boot;\n\n@:keepInit\n@:coreApi class Std {\n\n\tpublic static inline function is( v : Dynamic, t : Dynamic ) : Bool {\n\t\treturn untyped js.Boot.__instanceof(v,t);\n\t}\n\n\tpublic static inline function instance( value : T, c : Class ) : S {\n\t\treturn untyped __instanceof__(value, c) ? cast value : null;\n\t}\n\n\tpublic static function string( s : Dynamic ) : String {\n\t\treturn untyped js.Boot.__string_rec(s,\"\");\n\t}\n\n\tpublic static inline function int( x : Float ) : Int {\n\t\treturn (cast x) | 0;\n\t}\n\n\tpublic static function parseInt( x : String ) : Null {\n\t\tvar v = untyped __js__(\"parseInt\")(x, 10);\n\t\t// parse again if hexadecimal\n\t\tif( v == 0 && (x.charCodeAt(1) == 'x'.code || x.charCodeAt(1) == 'X'.code) )\n\t\t\tv = untyped __js__(\"parseInt\")(x);\n\t\tif( untyped __js__(\"isNaN\")(v) )\n\t\t\treturn null;\n\t\treturn cast v;\n\t}\n\n\tpublic static inline function parseFloat( x : String ) : Float {\n\t\treturn untyped __js__(\"parseFloat\")(x);\n\t}\n\n\tpublic static function random( x : Int ) : Int {\n\t\treturn untyped x <= 0 ? 0 : Math.floor(Math.random()*x);\n\t}\n\n\tstatic function __init__() : Void untyped {\n\t\t__feature__(\"js.Boot.getClass\",String.prototype.__class__ = __feature__(\"Type.resolveClass\",$hxClasses[\"String\"] = String,String));\n\t\t__feature__(\"js.Boot.isClass\",String.__name__ = __feature__(\"Type.getClassName\",[\"String\"],true));\n\t\t__feature__(\"Type.resolveClass\",$hxClasses[\"Array\"] = Array);\n\t\t__feature__(\"js.Boot.isClass\",Array.__name__ = __feature__(\"Type.getClassName\",[\"Array\"],true));\n\t\t__feature__(\"Date.*\", {\n\t\t\t__feature__(\"js.Boot.getClass\",__js__('Date').prototype.__class__ = __feature__(\"Type.resolveClass\",$hxClasses[\"Date\"] = __js__('Date'),__js__('Date')));\n\t\t\t__feature__(\"js.Boot.isClass\",__js__('Date').__name__ = [\"Date\"]);\n\t\t});\n\t\t__feature__(\"Int.*\",{\n\t\t\tvar Int = __feature__(\"Type.resolveClass\", $hxClasses[\"Int\"] = { __name__ : [\"Int\"] }, { __name__ : [\"Int\"] });\n\t\t});\n\t\t__feature__(\"Dynamic.*\",{\n\t\t\tvar Dynamic = __feature__(\"Type.resolveClass\", $hxClasses[\"Dynamic\"] = { __name__ : [\"Dynamic\"] }, { __name__ : [\"Dynamic\"] });\n\t\t});\n\t\t__feature__(\"Float.*\",{\n\t\t\tvar Float = __feature__(\"Type.resolveClass\", $hxClasses[\"Float\"] = __js__(\"Number\"), __js__(\"Number\"));\n\t\t\tFloat.__name__ = [\"Float\"];\n\t\t});\n\t\t__feature__(\"Bool.*\",{\n\t\t\tvar Bool = __feature__(\"Type.resolveEnum\",$hxClasses[\"Bool\"] = __js__(\"Boolean\"), __js__(\"Boolean\"));\n\t\t\tBool.__ename__ = [\"Bool\"];\n\t\t});\n\t\t__feature__(\"Class.*\",{\n\t\t\tvar Class = __feature__(\"Type.resolveClass\", $hxClasses[\"Class\"] = { __name__ : [\"Class\"] }, { __name__ : [\"Class\"] });\n\t\t});\n\t\t__feature__(\"Enum.*\",{\n\t\t\tvar Enum = {};\n\t\t});\n\t\t__feature__(\"Void.*\",{\n\t\t\tvar Void = __feature__(\"Type.resolveEnum\", $hxClasses[\"Void\"] = { __ename__ : [\"Void\"] }, { __ename__ : [\"Void\"] });\n\t\t});\n\n#if !js_es5\n\t\t__feature__(\"Array.map\",\n\t\t\tif( Array.prototype.map == null )\n\t\t\t\tArray.prototype.map = function(f) {\n\t\t\t\t\tvar a = [];\n\t\t\t\t\tfor( i in 0...__this__.length )\n\t\t\t\t\t\ta[i] = f(__this__[i]);\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t);\n\t\t__feature__(\"Array.filter\",\n\t\t\tif( Array.prototype.filter == null )\n\t\t\t\tArray.prototype.filter = function(f) {\n\t\t\t\t\tvar a = [];\n\t\t\t\t\tfor( i in 0...__this__.length ) {\n\t\t\t\t\t\tvar e = __this__[i];\n\t\t\t\t\t\tif( f(e) ) a.push(e);\n\t\t\t\t\t}\n\t\t\t\t\treturn a;\n\t\t\t\t}\n\t\t);\n#end\n\t}\n\n}\n","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nenum ValueType {\n\tTNull;\n\tTInt;\n\tTFloat;\n\tTBool;\n\tTObject;\n\tTFunction;\n\tTClass( c : Class );\n\tTEnum( e : Enum );\n\tTUnknown;\n}\n\n@:coreApi class Type {\n\n\tpublic static inline function getClass( o : T ) : Class {\n\t\treturn if (o == null) null else @:privateAccess js.Boot.getClass(o);\n\t}\n\n\tpublic static function getEnum( o : EnumValue ) : Enum untyped {\n\t\tif( o == null )\n\t\t\treturn null;\n\t\treturn o.__enum__;\n\t}\n\n\tpublic static function getSuperClass( c : Class ) : Class untyped {\n\t\treturn c.__super__;\n\t}\n\n\n\tpublic static function getClassName( c : Class ) : String {\n\t\tvar a : Array = untyped c.__name__;\n\t\tif (a == null)\n\t\t\treturn null;\n\t\treturn a.join(\".\");\n\t}\n\n\tpublic static function getEnumName( e : Enum ) : String {\n\t\tvar a : Array = untyped e.__ename__;\n\t\treturn a.join(\".\");\n\t}\n\n\tpublic static function resolveClass( name : String ) : Class untyped {\n\t\tvar cl : Class = $hxClasses[name];\n\t\t// ensure that this is a class\n\t\tif( cl == null || !js.Boot.isClass(cl) )\n\t\t\treturn null;\n\t\treturn cl;\n\t}\n\n\tpublic static function resolveEnum( name : String ) : Enum untyped {\n\t\tvar e : Dynamic = $hxClasses[name];\n\t\t// ensure that this is an enum\n\t\tif( e == null || !js.Boot.isEnum(e) )\n\t\t\treturn null;\n\t\treturn e;\n\t}\n\n\tpublic static function createInstance( cl : Class, args : Array ) : T untyped {\n\t\tswitch( args.length ) {\n\t\tcase 0:\n\t\t\treturn __new__(cl);\n\t\tcase 1:\n\t\t\treturn __new__(cl,args[0]);\n\t\tcase 2:\n\t\t\treturn __new__(cl,args[0],args[1]);\n\t\tcase 3:\n\t\t\treturn __new__(cl,args[0],args[1],args[2]);\n\t\tcase 4:\n\t\t\treturn __new__(cl,args[0],args[1],args[2],args[3]);\n\t\tcase 5:\n\t\t\treturn __new__(cl,args[0],args[1],args[2],args[3],args[4]);\n\t\tcase 6:\n\t\t\treturn __new__(cl,args[0],args[1],args[2],args[3],args[4],args[5]);\n\t\tcase 7:\n\t\t\treturn __new__(cl,args[0],args[1],args[2],args[3],args[4],args[5],args[6]);\n\t\tcase 8:\n\t\t\treturn __new__(cl,args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);\n\t\tdefault:\n\t\t\tthrow \"Too many arguments\";\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic static function createEmptyInstance( cl : Class ) : T untyped {\n\t\t__js__(\"function empty() {}; empty.prototype = cl.prototype\");\n\t\treturn __js__(\"new empty()\");\n\t}\n\n\tpublic static function createEnum( e : Enum, constr : String, ?params : Array ) : T {\n\t\tvar f:Dynamic = Reflect.field(e,constr);\n\t\tif( f == null ) throw \"No such constructor \"+constr;\n\t\tif( Reflect.isFunction(f) ) {\n\t\t\tif( params == null ) throw \"Constructor \"+constr+\" need parameters\";\n\t\t\treturn Reflect.callMethod(e,f,params);\n\t\t}\n\t\tif( params != null && params.length != 0 )\n\t\t\tthrow \"Constructor \"+constr+\" does not need parameters\";\n\t\treturn f;\n\t}\n\n\tpublic static function createEnumIndex( e : Enum, index : Int, ?params : Array ) : T {\n\t\tvar c : String = (untyped e.__constructs__)[index];\n\t\tif( c == null ) throw index+\" is not a valid enum constructor index\";\n\t\treturn createEnum(e,c,params);\n\t}\n\n\tpublic static function getInstanceFields( c : Class ) : Array {\n\t\tvar a = [];\n\t\tuntyped __js__(\"for(var i in c.prototype) a.push(i)\");\n\t\ta.remove(\"__class__\");\n\t\ta.remove(\"__properties__\");\n\t\treturn a;\n\t}\n\n\tpublic static function getClassFields( c : Class ) : Array {\n\t\tvar a = Reflect.fields(c);\n\t\ta.remove(\"__name__\");\n\t\ta.remove(\"__interfaces__\");\n\t\ta.remove(\"__properties__\");\n\t\ta.remove(\"__super__\");\n\t\ta.remove(\"__meta__\");\n\t\ta.remove(\"prototype\");\n\t\treturn a;\n\t}\n\n\tpublic static function getEnumConstructs( e : Enum ) : Array {\n\t\tvar a : Array = untyped e.__constructs__;\n\t\treturn a.copy();\n\t}\n\n\tpublic static function typeof( v : Dynamic ) : ValueType untyped {\n\t\tswitch( __js__(\"typeof\")(v) ) {\n\t\tcase \"boolean\": return TBool;\n\t\tcase \"string\": return TClass(String);\n\t\tcase \"number\":\n\t\t\t// this should handle all cases : NaN, +/-Inf and Floats outside range\n\t\t\tif( Math.ceil(v) == v%2147483648.0 )\n\t\t\t\treturn TInt;\n\t\t\treturn TFloat;\n\t\tcase \"object\":\n\t\t\tif( v == null )\n\t\t\t\treturn TNull;\n\t\t\tvar e = v.__enum__;\n\t\t\tif( e != null )\n\t\t\t\treturn TEnum(e);\n\t\t\tvar c = js.Boot.getClass(v);\n\t\t\tif( c != null )\n\t\t\t\treturn TClass(c);\n\t\t\treturn TObject;\n\t\tcase \"function\":\n\t\t\tif( js.Boot.isClass(v) || js.Boot.isEnum(v) )\n\t\t\t\treturn TObject;\n\t\t\treturn TFunction;\n\t\tcase \"undefined\":\n\t\t\treturn TNull;\n\t\tdefault:\n\t\t\treturn TUnknown;\n\t\t}\n\t}\n\n\tpublic static function enumEq( a : T, b : T ) : Bool untyped {\n\t\tif( a == b )\n\t\t\treturn true;\n\t\ttry {\n\t\t\tif( a[0] != b[0] )\n\t\t\t\treturn false;\n\t\t\tfor( i in 2...a.length )\n\t\t\t\tif( !enumEq(a[i],b[i]) )\n\t\t\t\t\treturn false;\n\t\t\tvar e = a.__enum__;\n\t\t\tif( e != b.__enum__ || e == null )\n\t\t\t\treturn false;\n\t\t} catch( e : Dynamic ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic inline static function enumConstructor( e : EnumValue ) : String {\n\t\treturn untyped e[0];\n\t}\n\n\tpublic inline static function enumParameters( e : EnumValue ) : Array {\n\t\treturn untyped e.slice(2);\n\t}\n\n\tpublic inline static function enumIndex( e : EnumValue ) : Int {\n\t\treturn untyped e[1];\n\t}\n\n\tpublic static function allEnums( e : Enum ) : Array {\n\t\treturn untyped e.__empty_constructs__;\n\t}\n\n}\n\n","import js.html.audio.AudioContext;\nimport js.html.HTMLDocument;\nimport js.html.AudioElement;\nimport js.Browser;\n\n/**\n* Web Audio Library with HTML5 audio fallback.\n*\n* @class Waud\n*/\n@:expose @:keep class Waud {\n\n\tstatic inline var PROBABLY:String = \"probably\";\n\tstatic inline var MAYBE:String = \"maybe\";\n\n\t/**\n\t* Tells whether to use web audio api or not.\n\t*\n\t* You can use this to enable/disable web audio globally for all sounds.\n\t*\n\t* Note that you can also enable/disable web audio individually for each sound instance.\n\t*\n\t* @property useWebAudio\n\t* @static\n\t* @type {Bool}\n\t* @default true\n\t* @example\n \t* Waud.useWebAudio = false;\n\t*/\n\tpublic static var useWebAudio:Bool = true;\n\n\t/**\n\t* Tells whether web audio api is supported or not.\n\t*\n\t* @property isWebAudioSupported\n\t* @static\n\t* @type {Bool}\n\t* @readOnly\n\t* @example\n \t* Waud.isWebAudioSupported;\n\t*/\n\tpublic static var isWebAudioSupported(default, null):Bool;\n\n\t/**\n\t* Tells whether html5 audio is supported or not.\n\t*\n\t* @property isHTML5AudioSupported\n\t* @static\n\t* @type {Bool}\n\t* @readOnly\n\t* @example\n \t* Waud.isHTML5AudioSupported;\n\t*/\n\tpublic static var isHTML5AudioSupported(default, null):Bool;\n\n\t/**\n\t* Defaults properties used on sound.\n\t*\n\t* @property defaults\n\t* @static\n\t* @type {WaudSoundOptions}\n\t* @default { autoplay: false, loop: false, preload: true, webaudio: true, volume: 1 }\n\t* @example\n \t* Waud.defaults = { volume: 0.5, autoplay: true, preload: false };\n\t*/\n\tpublic static var defaults:WaudSoundOptions = {\n\t\tautoplay: false,\n\t\tloop: false,\n\t\tpreload: true,\n\t\twebaudio: true,\n\t\tvolume: 1\n\t};\n\n\t/**\n\t* Holds all the sounds that are loaded.\n\t*\n\t* @property sounds\n\t* @static\n\t* @type {Map}\n\t* @readOnly\n\t* @example\n \t* Waud.sounds.get(\"url\");\n\t*/\n\tpublic static var sounds(default, null):Map;\n\n\t/**\n\t* Preferred sample rate used when creating buffer on audio context.\n\t*\n\t* It is recommended to use audio files with same sample rate and set the value used here.\n\t*\n\t* @property preferredSampleRate\n\t* @static\n\t* @type {Int}\n\t* @default 44100\n\t* @example\n \t* Waud.preferredSampleRate = 22050;\n\t*/\n\tpublic static var preferredSampleRate:Int = 44100;\n\n\t/**\n\t* Audio Manager instance.\n\t*\n\t* @property audioManager\n\t* @static\n\t* @type {AudioManager}\n\t* @readOnly\n\t*/\n\tpublic static var audioManager(default, null):AudioManager;\n\n\t/**\n\t* Audio Context reference.\n\t*\n\t* @property audioContext\n\t* @static\n\t* @type {AudioContext}\n\t* @readOnly\n\t*/\n\tpublic static var audioContext:AudioContext;\n\n\t/**\n\t* Document dom element used for appending sounds and touch events.\n\t*\n\t* @property dom\n\t* @static\n\t* @type {document}\n\t*/\n\tpublic static var dom(default, null):HTMLDocument;\n\n\t/**\n\t* State of audio, muted or not.\n\t*\n\t* @property isMuted\n\t* @static\n\t* @type {Bool}\n\t* @readOnly\n\t* @default false\n\t* @example\n \t* Waud.isMuted;\n\t*/\n\tpublic static var isMuted(default, null):Bool = false;\n\n\t/**\n\t* Touch unlock callback reference.\n\t*\n\t* @property __touchUnlockCallback\n\t* @static\n\t* @protected\n\t* @type {Function}\n\t*/\n\tpublic static var __touchUnlockCallback:Void -> Void;\n\n\t/**\n\t* Audio element used to check audio support.\n\t*\n\t* @property __audioElement\n\t* @static\n\t* @private\n\t* @type {AudioElement}\n\t* @readOnly\n\t*/\n\tstatic var __audioElement:AudioElement;\n\n\t/**\n\t* Focus Manager reference used for `autoMute` functionality.\n\t*\n\t* @property _focusManager\n\t* @static\n\t* @private\n\t* @type {WaudFocusManager}\n\t* @readOnly\n\t*/\n\tstatic var _focusManager:WaudFocusManager;\n\n\t/**\n\t* To initialise the library, make sure you call this first.\n\t*\n\t* You can also pass an optional parent DOM element to it where all the HTML5 sounds will be appended\n\t* and also used for touch events to unlock audio on iOS devices.\n\t*\n\t* @static\n\t* @method init\n\t* @param {HTMLDocument} [d = document]\n\t* @example\n \t* Waud.init();\n\t*/\n\tpublic static function init(?d:HTMLDocument) {\n\t\tif (__audioElement == null) {\n\t\t\tif (d == null) d = Browser.document;\n\t\t\tdom = d;\n\t\t\t__audioElement = dom.createAudioElement();\n\t\t\tif (Waud.audioManager == null) Waud.audioManager = new AudioManager();\n\t\t\tisWebAudioSupported = Waud.audioManager.checkWebAudioAPISupport();\n\t\t\tisHTML5AudioSupported = (Reflect.field(Browser.window, \"Audio\") != null);\n\n\t\t\tif (isWebAudioSupported) audioContext = Waud.audioManager.createAudioContext();\n\n\t\t\tsounds = new Map();\n\t\t}\n\t}\n\n\t/**\n\t* Helper function to automatically mute audio when the browser window is not in focus.\n\t*\n\t* Will un-mute when the window gains focus.\n\t*\n\t* @static\n\t* @method autoMute\n\t* @example\n \t* Waud.autoMute();\n\t*/\n\tpublic static function autoMute() {\n\t\tvar blur = function() {\n\t\t\tif (sounds != null) for (sound in sounds) sound.mute(true);\n\t\t};\n\n\t\tvar focus = function() {\n\t\t\tif (!isMuted && sounds != null) for (sound in sounds) sound.mute(false);\n\t\t};\n\n\t\t_focusManager = new WaudFocusManager();\n\t\t_focusManager.focus = focus;\n\t\t_focusManager.blur = blur;\n\t}\n\n\t/**\n\t* Helper function to unlock audio on iOS devices.\n\t*\n\t* You can pass an optional callback which will be triggered on `touchend` event.\n\t*\n\t* @static\n\t* @method enableTouchUnlock\n\t* @param {Function} [callback] - Optional callback that triggers after touch unlock.\n\t* @example\n \t* Waud.enableTouchUnlock(callback);\n\t*/\n\tpublic static function enableTouchUnlock(?callback:Void -> Void) {\n\t\t__touchUnlockCallback = callback;\n\t\tdom.ontouchend = Waud.audioManager.unlockAudio;\n\t}\n\n\t/**\n\t* Helper function to mute all the sounds.\n\t*\n\t* @static\n\t* @method mute\n\t* @param {Bool} [val = true]\n\t* @example\n\t* Waud.mute();\n \t* Waud.mute(true);\n \t* Waud.mute(false);\n\t*/\n\tpublic static function mute(?val:Bool = true) {\n\t\tisMuted = val;\n\t\tif (sounds != null) for (sound in sounds) sound.mute(val);\n\t}\n\n\t/**\n\t* Helper function to stop all the sounds.\n\t*\n\t* @static\n\t* @method stop\n\t* @example\n\t* Waud.stop();\n\t*/\n\tpublic static function stop() {\n\t\tif (sounds != null) for (sound in sounds) sound.stop();\n\t}\n\n\t/**\n\t* Helper function to pause all the sounds.\n\t*\n\t* @static\n\t* @method pause\n\t* @example\n\t* Waud.pause();\n\t*/\n\tpublic static function pause() {\n\t\tif (sounds != null) for (sound in sounds) sound.pause();\n\t}\n\n\t/**\n\t* Returns a string with all the format support information.\n\t*\n\t* @static\n\t* @method getFormatSupportString\n\t* @return {String} support string `OGG: probably, WAV: probably, MP3: probably, AAC: probably, M4A: maybe` (example)\n\t* @example\n\t* Waud.getFormatSupportString();\n\t*/\n\tpublic static function getFormatSupportString():String {\n\t\tvar support:String = \"OGG: \" + __audioElement.canPlayType('audio/ogg; codecs=\"vorbis\"');\n\t\tsupport += \", WAV: \" + __audioElement.canPlayType('audio/wav; codecs=\"1\"');\n\t\tsupport += \", MP3: \" + __audioElement.canPlayType('audio/mpeg;');\n\t\tsupport += \", AAC: \" + __audioElement.canPlayType('audio/aac;');\n\t\tsupport += \", M4A: \" + __audioElement.canPlayType('audio/x-m4a;');\n\t\treturn support;\n\t}\n\n\t/**\n\t* Function to check whether audio is supported or not.\n\t*\n\t* @static\n\t* @method isSupported\n\t* @return {Bool} true or false\n\t* @example\n\t* Waud.isSupported();\n\t*/\n\tpublic static function isSupported():Bool {\n\t\tif (isWebAudioSupported == null || isHTML5AudioSupported == null) {\n\t\t\tisWebAudioSupported = Waud.audioManager.checkWebAudioAPISupport();\n\t\t\tisHTML5AudioSupported = (Reflect.field(Browser.window, \"Audio\") != null);\n\t\t}\n\t\treturn (isWebAudioSupported || isHTML5AudioSupported);\n\t}\n\n\t/**\n\t* Function to check `ogg` format support.\n\t*\n\t* @static\n\t* @method isOGGSupported\n\t* @return {Bool} true or false\n\t* @example\n\t* Waud.isOGGSupported();\n\t*/\n\tpublic static function isOGGSupported():Bool {\n\t\tvar canPlay = __audioElement.canPlayType('audio/ogg; codecs=\"vorbis\"');\n\t\treturn (isHTML5AudioSupported && canPlay != null && (canPlay == PROBABLY || canPlay == MAYBE));\n\t}\n\n\t/**\n\t* Function to check `wav` format support.\n\t*\n\t* @static\n\t* @method isWAVSupported\n\t* @return {Bool} true or false\n\t* @example\n\t* Waud.isWAVSupported();\n\t*/\n\tpublic static function isWAVSupported():Bool {\n\t\tvar canPlay = __audioElement.canPlayType('audio/wav; codecs=\"1\"');\n\t\treturn (isHTML5AudioSupported && canPlay != null && (canPlay == PROBABLY || canPlay == MAYBE));\n\t}\n\n\t/**\n\t* Function to check `mp3` format support.\n\t*\n\t* @static\n\t* @method isMP3Supported\n\t* @return {Bool} true or false\n\t* @example\n\t* Waud.isMP3Supported();\n\t*/\n\tpublic static function isMP3Supported():Bool {\n\t\tvar canPlay = __audioElement.canPlayType('audio/mpeg;');\n\t\treturn (isHTML5AudioSupported && canPlay != null && (canPlay == PROBABLY || canPlay == MAYBE));\n\t}\n\n\t/**\n\t* Function to check `aac` format support.\n\t*\n\t* @static\n\t* @method isAACSupported\n\t* @return {Bool} true or false\n\t* @example\n\t* Waud.isAACSupported();\n\t*/\n\tpublic static function isAACSupported():Bool {\n\t\tvar canPlay = __audioElement.canPlayType('audio/aac;');\n\t\treturn (isHTML5AudioSupported && canPlay != null && (canPlay == PROBABLY || canPlay == MAYBE));\n\t}\n\n\t/**\n\t* Function to check `m4a` format support.\n\t*\n\t* @static\n\t* @method isM4ASupported\n\t* @return {Bool} true or false\n\t* @example\n\t* Waud.isM4ASupported();\n\t*/\n\tpublic static function isM4ASupported():Bool {\n\t\tvar canPlay = __audioElement.canPlayType('audio/x-m4a;');\n\t\treturn (isHTML5AudioSupported && canPlay != null && (canPlay == PROBABLY || canPlay == MAYBE));\n\t}\n\n\t/**\n\t* Function to destroy audio context.\n\t*\n\t* @static\n\t* @method destroy\n\t* @example\n\t* Waud.destroy();\n\t*/\n\tpublic static function destroy() {\n\t\tif (sounds != null) for (sound in sounds) sound.destroy();\n\t\tsounds = null;\n\t\tif (Waud.audioManager != null) Waud.audioManager.destroy();\n\t\tWaud.audioManager = null;\n\t\tWaud.audioContext = null;\n\t\t__audioElement = null;\n\t\tif (_focusManager != null) {\n\t\t\t_focusManager.clearEvents();\n\t\t\t_focusManager.blur = null;\n\t\t\t_focusManager.focus = null;\n\t\t}\n\t}\n}","import js.Browser;\n\n@:expose @:keep class WaudFocusManager {\n\n\tstatic inline var FOCUS_STATE:String = \"focus\";\n\tstatic inline var BLUR_STATE:String = \"blur\";\n\tstatic inline var ON_FOCUS:String = \"onfocus\";\n\tstatic inline var ON_BLUR:String = \"onblur\";\n\tstatic inline var PAGE_SHOW:String = \"pageshow\";\n\tstatic inline var PAGE_HIDE:String = \"pagehide\";\n\tstatic inline var WINDOW:String = \"window\";\n\tstatic inline var DOCUMENT:String = \"document\";\n\n\t/**\n\t* Focus callback function.\n\t*\n\t* @property focus\n\t* @type {Function}\n\t* @example\n \t* fm.focus = onFocus;\n\t*/\n\tpublic var focus:Void -> Void;\n\n\t/**\n\t* Blur callback function.\n\t*\n\t* @property blur\n\t* @type {Function}\n\t* @example\n \t* fm.blur = onBlur;\n\t*/\n\tpublic var blur:Void -> Void;\n\n\tvar _hidden:String;\n\tvar _visibilityChange:String;\n\tvar _currentState:String;\n\n\t/**\n\t* Cross-browser utility class used to mute/unmute audio on focus on/off events. Used when **Waud.autoMute()** is called.\n\t*\n\t* This can also be used as a standalone utility class to handle focus on/off events.\n\t*\n\t* @class WaudFocusManager\n\t* @constructor\n\t* @example\n\t* \t\tvar fm = new WaudFocusManager();\n\t* \t\tfm.focus = onFocus;\n\t* \t\tfm.blur = onBlur;\n\t*/\n\tpublic function new() {\n\t\t_hidden = \"\";\n\t\t_visibilityChange = \"\";\n\t\t_currentState = \"\";\n\n\t\tif (Reflect.field(Browser.document, \"hidden\") != null) {\n\t\t\t_hidden = \"hidden\";\n\t\t\t_visibilityChange = \"visibilitychange\";\n\t\t}\n\t\telse if (Reflect.field(Browser.document, \"mozHidden\") != null) {\n\t\t\t_hidden = \"mozHidden\";\n\t\t\t_visibilityChange = \"mozvisibilitychange\";\n\t\t}\n\t\telse if (Reflect.field(Browser.document, \"msHidden\") != null) {\n\t\t\t_hidden = \"msHidden\";\n\t\t\t_visibilityChange = \"msvisibilitychange\";\n\t\t}\n\t\telse if (Reflect.field(Browser.document, \"webkitHidden\") != null) {\n\t\t\t_hidden = \"webkitHidden\";\n\t\t\t_visibilityChange = \"webkitvisibilitychange\";\n\t\t}\n\n\t\tif (Reflect.field(Browser.window, \"addEventListener\") != null) {\n\t\t\tuntyped __js__(WINDOW).addEventListener(FOCUS_STATE, _focus);\n\t\t\tuntyped __js__(WINDOW).addEventListener(BLUR_STATE, _blur);\n\t\t\tuntyped __js__(WINDOW).addEventListener(PAGE_SHOW, _focus);\n\t\t\tuntyped __js__(WINDOW).addEventListener(PAGE_HIDE, _blur);\n\t\t\tuntyped __js__(DOCUMENT).addEventListener(_visibilityChange, _handleVisibilityChange);\n\t\t}\n\t\telse if (Reflect.field(Browser.window, \"attachEvent\") != null) {\n\t\t\tuntyped __js__(WINDOW).attachEvent(ON_FOCUS, _focus);\n\t\t\tuntyped __js__(WINDOW).attachEvent(ON_BLUR, _blur);\n\t\t\tuntyped __js__(WINDOW).attachEvent(PAGE_SHOW, _focus);\n\t\t\tuntyped __js__(WINDOW).attachEvent(PAGE_HIDE, _blur);\n\t\t\tuntyped __js__(DOCUMENT).attachEvent(_visibilityChange, _handleVisibilityChange);\n\t\t}\n\t\telse {\n\t\t\tBrowser.window.onload = function () {\n\t\t\t\tBrowser.window.onfocus = _focus;\n\t\t\t\tBrowser.window.onblur = _blur;\n\t\t\t\tBrowser.window.onpageshow = _focus;\n\t\t\t\tBrowser.window.onpagehide = _blur;\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t* Function to handle visibility change event.\n\t*\n\t* @private\n\t* @method _handleVisibilityChange\n\t*/\n\tfunction _handleVisibilityChange() {\n\t\tif (Reflect.field(Browser.document, _hidden) != null && Reflect.field(Browser.document, _hidden) && blur != null) blur();\n\t\telse if (focus != null) focus();\n\t}\n\n\t/**\n\t* Function to trigger focus callback.\n\t*\n\t* @private\n\t* @method _focus\n\t*/\n\tfunction _focus() {\n\t\tif (_currentState != FOCUS_STATE && focus != null) focus();\n\t\t_currentState = FOCUS_STATE;\n\t}\n\n\t/**\n\t* Function to trigger blur callback.\n\t*\n\t* @private\n\t* @method _blur\n\t*/\n\tfunction _blur() {\n\t\tif (_currentState != BLUR_STATE && blur != null) blur();\n\t\t_currentState = BLUR_STATE;\n\t}\n\n\t/**\n\t* Function to clear focus manager events.\n\t*\n\t* @method clearEvents\n\t* @example\n\t* fm.clearEvents();\n\t*/\n\tpublic function clearEvents() {\n\t\tif (Reflect.field(Browser.window, \"removeEventListener\") != null) {\n\t\t\tuntyped __js__(WINDOW).removeEventListener(FOCUS_STATE, _focus);\n\t\t\tuntyped __js__(WINDOW).removeEventListener(BLUR_STATE, _blur);\n\t\t\tuntyped __js__(WINDOW).removeEventListener(PAGE_SHOW, _focus);\n\t\t\tuntyped __js__(WINDOW).removeEventListener(PAGE_HIDE, _blur);\n\t\t\tuntyped __js__(WINDOW).removeEventListener(_visibilityChange, _handleVisibilityChange);\n\t\t}\n\t\telse if (Reflect.field(Browser.window, \"removeEvent\") != null) {\n\t\t\tuntyped __js__(WINDOW).removeEvent(ON_FOCUS, _focus);\n\t\t\tuntyped __js__(WINDOW).removeEvent(ON_BLUR, _blur);\n\t\t\tuntyped __js__(WINDOW).removeEvent(PAGE_SHOW, _focus);\n\t\t\tuntyped __js__(WINDOW).removeEvent(PAGE_HIDE, _blur);\n\t\t\tuntyped __js__(WINDOW).removeEvent(_visibilityChange, _handleVisibilityChange);\n\t\t}\n\t\telse {\n\t\t\tBrowser.window.onfocus = null;\n\t\t\tBrowser.window.onblur = null;\n\t\t\tBrowser.window.onpageshow = null;\n\t\t\tBrowser.window.onpagehide = null;\n\t\t}\n\t}\n}","import js.html.XMLHttpRequest;\nimport haxe.Json;\n\n@:expose @:keep class WaudSound implements IWaudSound {\n\n\t/**\n\t* Indicates if the sound is sprite sound or normal sound.\n\t*\n\t* @property isSpriteSound\n\t* @type {Bool}\n\t* @readOnly\n\t* @example\n \t* snd.isSpriteSound;\n\t*/\n\tpublic var isSpriteSound:Bool;\n\n\t/**\n\t* Sound url.\n\t*\n\t* @property url\n\t* @type {String}\n\t* @readOnly\n\t* @example\n \t* snd.url;\n\t*/\n\tpublic var url:String;\n\n\tvar _snd:IWaudSound;\n\tvar _options:WaudSoundOptions;\n\tvar _spriteData:AudioSprite;\n\n\t/**\n\t* Class to automatically use web audio api with HTML5 audio fallback.\n\t*\n\t* @class WaudSound\n\t* @constructor\n\t* @param {String} url - Can be audio file path or JSON file for audio sprite.\n\t* @param {WaudSoundOptions} [options] - Sound options.\n\t* @example\n\t* \t\t// MP3 Sound\n\t* \t\tvar snd = new WaudSound(\"assets/loop.mp3\", { autoplay: false, loop: true, volume: 0.5, onload: _playBgSound });\n\t*\n\t* \t\t// Force HTML5 Audio\n\t* \t\tvar snd = new WaudSound(\"assets/loop.mp3\", { webaudio: false });\n\t*\n\t* \t\t// Audio Sprite\n\t* \t\tvar audSprite = new WaudSound(\"assets/sprite.json\");\n\t* \t\taudSprite.play(\"glass\");\n\t*/\n\tpublic function new(url:String, ?options:WaudSoundOptions = null) {\n\t\tif (Waud.audioManager == null) {\n\t\t\ttrace(\"initialise Waud using Waud.init() before loading sounds\");\n\t\t\treturn;\n\t\t}\n\n\t\t_options = options;\n\n\t\tif (url.indexOf(\".json\") > 0) {\n\t\t\tisSpriteSound = true;\n\t\t\t_loadSpriteJson(url);\n\t\t}\n\t\telse {\n\t\t\tisSpriteSound = false;\n\t\t\t_init(url);\n\t\t}\n\n\t\tWaud.sounds.set(url, this);\n\t}\n\n\t/**\n\t* Function to load audio sprite JSON.\n\t*\n\t* @private\n\t* @method _loadSpriteJson\n\t* @param {String} url - Audio Sprite JSON path.\n\t*/\n\tfunction _loadSpriteJson(jsonUrl:String) {\n\t\tvar xobj = new XMLHttpRequest();\n\t\txobj.overrideMimeType(\"application/json\");\n\t\txobj.open(\"GET\", jsonUrl, true);\n\t\txobj.onreadystatechange = function() {\n\t\t\tif (xobj.readyState == 4 && xobj.status == 200) {\n\t\t\t\t_spriteData = Json.parse(xobj.response);\n\t\t\t\t_init(_spriteData.src);\n\t\t\t}\n\t\t};\n\t\txobj.send(null);\n\t}\n\n\t/**\n\t* Function to initialize sound.\n\t*\n\t* @private\n\t* @method _init\n\t* @param {String} url - Audio file path.\n\t*/\n\tfunction _init(soundUrl:String) {\n\t\turl = soundUrl;\n\t\tif (Waud.isWebAudioSupported && Waud.useWebAudio && (_options == null || _options.webaudio == null || _options.webaudio)) {\n\t\t\t_snd = new WebAudioAPISound(url, _options);\n\t\t}\n\t\telse if (Waud.isHTML5AudioSupported) {\n\t\t\t_snd = new HTML5Sound(url, _options);\n\t\t}\n\t\telse {\n\t\t\ttrace(\"no audio support in this browser\");\n\t\t\treturn;\n\t\t}\n\n\t\t_snd.isSpriteSound = isSpriteSound;\n\t}\n\n\t/**\n\t* Function to set sound volume.\n\t*\n\t* @method setVolume\n\t* @param {Float} val - Should be between 0 and 1.\n\t* @example\n\t* snd.setVolume(0.5);\n\t*/\n\tpublic function setVolume(val:Float) {\n\t\tif (_snd == null) return;\n\t\t_snd.setVolume(val);\n\t}\n\n\t/**\n\t* Function to get sound volume.\n\t*\n\t* @method getVolume\n\t* @return {Float} between 0 and 1\n\t* @example\n\t* snd.getVolume();\n\t*/\n\tpublic function getVolume():Float {\n\t\tif (_snd == null) return 0;\n\t\treturn _snd.getVolume();\n\t}\n\n\t/**\n\t* Function to mute sound.\n\t*\n\t* @method mute\n\t* @param {Bool} val\n\t* @example\n\t* snd.mute(true);\n\t*/\n\tpublic function mute(val:Bool) {\n\t\tif (_snd == null) return;\n\t\t_snd.mute(val);\n\t}\n\n\t/**\n\t* Function to manually load the sound if `preload` was set to `false` with optional onload callback.\n\t*\n\t* @method load\n\t* @param {Function} [callback] - onload callback function.\n\t* @return {IWaudSound} sound instance\n\t* @example\n\t* snd.load();\n\t* snd.load(callback);\n\t*/\n\tpublic function load(?callback:IWaudSound -> Void):IWaudSound {\n\t\tif (_snd == null) return null;\n\t\t_snd.load(callback);\n\t\treturn this;\n\t}\n\n\t/**\n\t* Function to play the sound with optional sprite name when using audio sprite.\n\t*\n\t* @method play\n\t* @param {String} [spriteName] - Sprite name to play.\n\t* @return {Int} sound id\n\t* @example\n\t* snd.play();\n\t* snd.play(\"bell\");\n\t*/\n\tpublic function play(?spriteName:String, ?soundProps:AudioSpriteSoundProperties = null):Int {\n\t\tif (_snd == null) return null;\n\t\tif (spriteName != null) {\n\t\t\tfor (snd in _spriteData.sprite) {\n\t\t\t\tif (snd.name == spriteName) {\n\t\t\t\t\tsoundProps = snd;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn _snd.play(spriteName, soundProps);\n\t}\n\n\t/**\n\t* Function to check if the sound is playing or not.\n\t*\n\t* @method isPlaying\n\t* @return {Bool} true or false\n\t* @example\n\t* snd.isPlaying();\n\t*/\n\tpublic function isPlaying():Bool {\n\t\tif (_snd == null) return false;\n\t\treturn _snd.isPlaying();\n\t}\n\n\t/**\n\t* Function to loop or unloop sound.\n\t*\n\t* @method loop\n\t* @param {Bool} val\n\t* @example\n\t* snd.loop(true);\n\t*/\n\tpublic function loop(val:Bool) {\n\t\tif (_snd == null) return;\n\t\t_snd.loop(val);\n\t}\n\n\t/**\n\t* Function to stop sound.\n\t*\n\t* @method stop\n\t* @example\n\t* snd.stop();\n\t*/\n\tpublic function stop() {\n\t\tif (_snd == null) return;\n\t\t_snd.stop();\n\t}\n\n\t/**\n\t* Function to pause sound.\n\t*\n\t* @method pause\n\t* @example\n\t* snd.pause();\n\t*/\n\tpublic function pause() {\n\t\tif (_snd == null) return;\n\t\t_snd.pause();\n\t}\n\n\t/**\n\t* Function to add callback that triggers when the sound finishes playing.\n\t*\n\t* @method onEnd\n\t* @param {Function} callback - Callback function.\n\t* @return {IWaudSound} sound instance\n\t* @example\n\t* snd.onEnd(callback);\n\t*/\n\tpublic function onEnd(callback:IWaudSound -> Void):IWaudSound {\n\t\tif (_snd == null) return null;\n\t\t_snd.onEnd(callback);\n\t\treturn this;\n\t}\n\n\t/**\n\t* Function to add callback that triggers when the sound is loaded.\n\t*\n\t* @method onLoad\n\t* @param {Function} callback - Callback function.\n\t* @return {IWaudSound} sound instance\n\t* @example\n\t* snd.onLoad(callback);\n\t*/\n\tpublic function onLoad(callback:IWaudSound -> Void):IWaudSound {\n\t\tif (_snd == null) return null;\n\t\t_snd.onLoad(callback);\n\t\treturn this;\n\t}\n\n\t/**\n\t* Function to add callback that triggers when the sound fails to load or if it fails to decode when using web audio.\n\t*\n\t* @method onError\n\t* @param {Function} callback - Callback function.\n\t* @return {IWaudSound} sound instance\n\t* @example\n\t* snd.onError(callback);\n\t*/\n\tpublic function onError(callback:IWaudSound -> Void):IWaudSound {\n\t\tif (_snd == null) return null;\n\t\t_snd.onError(callback);\n\t\treturn this;\n\t}\n\n\t/**\n\t* Function to destroy sound.\n\t*\n\t* @method destroy\n\t* @example\n\t* snd.destroy();\n\t*/\n\tpublic function destroy() {\n\t\tif (_snd == null) return;\n\t\t_snd.destroy();\n\t\t_snd = null;\n\t}\n}","import js.Browser;\n\n/**\n* Collection of Browser Utility Functions.\n*\n* @class WaudUtils\n*/\n@:expose @:keep class WaudUtils {\n\n\t/**\n\t* Function to check if the device is **Android** or not.\n\t*\n\t* @static\n\t* @method isAndroid\n\t* @return {Bool} true or false\n\t* @example\n\t* Waud.isAndroid();\n\t*/\n\tpublic static function isAndroid(?ua:String):Bool {\n\t\tif (ua == null) ua = Browser.navigator.userAgent;\n\t\treturn ~/Android/i.match(ua);\n\t}\n\n\t/**\n\t* Function to check if the device is **iOS** or not.\n\t*\n\t* @static\n\t* @method isiOS\n\t* @return {Bool} true or false\n\t* @example\n\t* Waud.isiOS();\n\t*/\n\tpublic static function isiOS(?ua:String):Bool {\n\t\tif (ua == null) ua = Browser.navigator.userAgent;\n\t\treturn ~/(iPad|iPhone|iPod)/i.match(ua);\n\t}\n\n\t/**\n\t* Function to check if the device is **Windows Phone** or not.\n\t*\n\t* @static\n\t* @method isWindowsPhone\n\t* @return {Bool} true or false\n\t* @example\n\t* Waud.isWindowsPhone();\n\t*/\n\tpublic static function isWindowsPhone(?ua:String):Bool {\n\t\tif (ua == null) ua = Browser.navigator.userAgent;\n\t\treturn ~/(IEMobile|Windows Phone)/i.match(ua);\n\t}\n\n\t/**\n\t* Function to check if the device is **Firefox** or not.\n\t*\n\t* @static\n\t* @method isFirefox\n\t* @return {Bool} true or false\n\t* @example\n\t* Waud.isFirefox();\n\t*/\n\tpublic static function isFirefox(?ua:String):Bool {\n\t\tif (ua == null) ua = Browser.navigator.userAgent;\n\t\treturn ~/Firefox/i.match(ua);\n\t}\n\n\t/**\n\t* Function to check if the device is **Opera** or not.\n\t*\n\t* @static\n\t* @method isOpera\n\t* @return {Bool} true or false\n\t* @example\n\t* Waud.isOpera();\n\t*/\n\tpublic static function isOpera(?ua:String):Bool {\n\t\tif (ua == null) ua = Browser.navigator.userAgent;\n\t\treturn ~/Opera/i.match(ua) || Reflect.field(Browser.window, \"opera\") != null;\n\t}\n\n\t/**\n\t* Function to check if the device is **Chrome** or not.\n\t*\n\t* @static\n\t* @method isChrome\n\t* @return {Bool} true or false\n\t* @example\n\t* Waud.isChrome();\n\t*/\n\tpublic static function isChrome(?ua:String):Bool {\n\t\tif (ua == null) ua = Browser.navigator.userAgent;\n\t\treturn ~/Chrome/i.match(ua);\n\t}\n\n\t/**\n\t* Function to check if the device is **Safari** or not.\n\t*\n\t* @static\n\t* @method isSafari\n\t* @return {Bool} true or false\n\t* @example\n\t* Waud.isSafari();\n\t*/\n\tpublic static function isSafari(?ua:String):Bool {\n\t\tif (ua == null) ua = Browser.navigator.userAgent;\n\t\treturn ~/Safari/i.match(ua);\n\t}\n\n\t/**\n\t* Function to check if the device is **mobile** or not.\n\t*\n\t* @static\n\t* @method isMobile\n\t* @return {Bool} true or false\n\t* @example\n\t* Waud.isMobile();\n\t*/\n\tpublic static function isMobile(?ua:String):Bool {\n\t\tif (ua == null) ua = Browser.navigator.userAgent;\n\t\treturn ~/(iPad|iPhone|iPod|Android|webOS|BlackBerry|Windows Phone|IEMobile)/i.match(ua);\n\t}\n\n\t/**\n\t* Function to get the **iOS** version.\n\t*\n\t* @static\n\t* @method getiOSVersion\n\t* @return {Array} [9,0,1]\n\t* @example\n\t* Waud.getiOSVersion();\n\t*/\n\tpublic static function getiOSVersion(?ua:String):Array {\n\t\tif (ua == null) ua = Browser.navigator.userAgent;\n\t\tvar v:EReg = ~/[0-9_]+?[0-9_]+?[0-9_]+/i;\n\t\tvar matched:Array = [];\n\t\tif (v.match(ua)) {\n\t\t\tvar match:Array = v.matched(0).split(\"_\");\n\t\t\tmatched = [for (i in match) Std.parseInt(i)];\n\t\t}\n\t\treturn matched;\n\t}\n}","import js.html.XMLHttpRequestResponseType;\nimport js.html.XMLHttpRequest;\nimport js.html.audio.GainNode;\nimport js.html.audio.AudioBufferSourceNode;\nimport js.html.audio.AudioBuffer;\n\n@:keep class WebAudioAPISound extends BaseSound implements IWaudSound {\n\n\tvar _srcNodes:Array;\n\tvar _gainNodes:Array;\n\tvar _manager:AudioManager;\n\tvar _snd:AudioBufferSourceNode;\n\tvar _gainNode:GainNode;\n\tvar _playStartTime:Float;\n\tvar _pauseTime:Float;\n\n\tpublic function new(url:String, ?options:WaudSoundOptions = null) {\n\t\t#if debug trace(\"using web audio - \" + url); #end\n\t\tsuper(url, options);\n\t\t_playStartTime = 0;\n\t\t_pauseTime = 0;\n\t\t_srcNodes = [];\n\t\t_gainNodes = [];\n\t\t_manager = Waud.audioManager;\n\t\tif (_options.preload) load();\n\t}\n\n\tfunction _onSoundLoaded(evt) {\n\t\t_manager.audioContext.decodeAudioData(evt.target.response, _decodeSuccess, _error);\n\t}\n\n\tfunction _decodeSuccess(buffer:AudioBuffer) {\n\t\tif (buffer == null) {\n\t\t\ttrace(\"empty buffer: \" + url);\n\t\t\t_error();\n\t\t\treturn;\n\t\t}\n\t\t_manager.bufferList.set(url, buffer);\n\t\t_isLoaded = true;\n\t\tif (_options.onload != null) _options.onload(this);\n\t\tif (_options.autoplay) play();\n\t}\n\n\tinline function _error() {\n\t\tif (_options.onerror != null) _options.onerror(this);\n\t}\n\n\tfunction _makeSource(buffer:AudioBuffer):AudioBufferSourceNode {\n\t\tvar source:AudioBufferSourceNode = _manager.audioContext.createBufferSource();\n\t\tsource.buffer = buffer;\n\t\tif (untyped __js__(\"this._manager.audioContext\").createGain != null) _gainNode = _manager.audioContext.createGain();\n\t\telse _gainNode = untyped __js__(\"this._manager.audioContext\").createGainNode();\n\t\tsource.connect(_gainNode);\n\t\t_gainNode.connect(_manager.audioContext.destination);\n\t\t_srcNodes.push(source);\n\t\t_gainNodes.push(_gainNode);\n\t\treturn source;\n\t}\n\n\tpublic function load(?callback:IWaudSound -> Void):IWaudSound {\n\t\tif (!_isLoaded) {\n\t\t\tvar request = new XMLHttpRequest();\n\t\t\trequest.open(\"GET\", url, true);\n\t\t\trequest.responseType = XMLHttpRequestResponseType.ARRAYBUFFER;\n\t\t\trequest.onload = _onSoundLoaded;\n\t\t\trequest.onerror = _error;\n\t\t\trequest.send();\n\n\t\t\tif (callback != null) _options.onload = callback;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tpublic function play(?spriteName:String, ?soundProps:AudioSpriteSoundProperties):Int {\n\t\tif (!_isLoaded) {\n\t\t\ttrace(\"sound not loaded\");\n\t\t\treturn -1;\n\t\t}\n\t\tif (_muted) return -1;\n\t\tvar start:Float = 0;\n\t\tvar end:Float = -1;\n\t\tif (isSpriteSound && soundProps != null) {\n\t\t\tstart = soundProps.start + _pauseTime;\n\t\t\tend = soundProps.duration;\n\t\t}\n\t\tvar buffer = _manager.bufferList.get(url);\n\t\tif (buffer != null) {\n\t\t\t_snd = _makeSource(buffer);\n\t\t\tif (start >= 0 && end > -1) {\n\t\t\t\tif (Reflect.field(_snd, \"start\") != null) _snd.start(0, start, end);\n\t\t\t\telse {\n\t\t\t\t\tuntyped __js__(\"this._snd\").noteGrainOn(0, start, end);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t_snd.loop = _options.loop;\n\t\t\t\tif (Reflect.field(_snd, \"start\") != null) _snd.start(0);\n\t\t\t\telse untyped __js__(\"this._snd\").noteGrainOn(0, _pauseTime, _snd.buffer.duration);\n\t\t\t}\n\n\t\t\t_playStartTime = _manager.audioContext.currentTime;\n\t\t\t_isPlaying = true;\n\t\t\t_snd.onended = function() {\n\t\t\t\tif (_pauseTime == 0) {\n\t\t\t\t\tif (isSpriteSound && soundProps != null && soundProps.loop && start >= 0 && end > -1) {\n\t\t\t\t\t\tplay(spriteName, soundProps);\n\t\t\t\t\t}\n\t\t\t\t\t_isPlaying = false;\n\t\t\t\t\tif (_options.onend != null) _options.onend(this);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t_gainNode.gain.value = _options.volume;\n\n\t\treturn _srcNodes.indexOf(_snd);\n\t}\n\n\tpublic function isPlaying():Bool {\n\t\treturn _isPlaying;\n\t}\n\n\tpublic function loop(val:Bool) {\n\t\tif (_snd == null || !_isLoaded) return;\n\t\t_snd.loop = val;\n\t}\n\n\tpublic function setVolume(val:Float) {\n\t\t_options.volume = val;\n\t\tif (_gainNode == null || !_isLoaded) return;\n\t\t_gainNode.gain.value = _options.volume;\n\t}\n\n\tpublic function getVolume():Float {\n\t\treturn _options.volume;\n\t}\n\n\tpublic function mute(val:Bool) {\n\t\t_muted = val;\n\t\tif (_gainNode == null || !_isLoaded) return;\n\t\tif (val) _gainNode.gain.value = 0;\n\t\telse _gainNode.gain.value = _options.volume;\n\t}\n\n\tpublic function stop() {\n\t\t_pauseTime = 0;\n\t\tif (_snd == null || !_isLoaded || !_isPlaying) return;\n\t\tdestroy();\n\t}\n\n\tpublic function pause() {\n\t\tif (_snd == null || !_isLoaded || !_isPlaying) return;\n\t\tdestroy();\n\t\t_pauseTime += _manager.audioContext.currentTime - _playStartTime;\n\t}\n\n\tpublic function onEnd(callback:IWaudSound -> Void):IWaudSound {\n\t\t_options.onend = callback;\n\t\treturn this;\n\t}\n\n\tpublic function onLoad(callback:IWaudSound -> Void):IWaudSound {\n\t\t_options.onload = callback;\n\t\treturn this;\n\t}\n\n\tpublic function onError(callback:IWaudSound -> Void):IWaudSound {\n\t\t_options.onerror = callback;\n\t\treturn this;\n\t}\n\n\tpublic function destroy() {\n\t\tfor (src in _srcNodes) {\n\t\t\tif (Reflect.field(src, \"stop\") != null) src.stop(0);\n\t\t\telse if (Reflect.field(src, \"noteOff\") != null) {\n\t\t\t\ttry {\n\t\t\t\t\tuntyped __js__(\"this.src\").noteOff(0);\n\t\t\t\t}\n\t\t\t\tcatch (e:Dynamic) {}\n\t\t\t}\n\t\t\tsrc.disconnect();\n\t\t\tsrc = null;\n\t\t}\n\t\tfor (gain in _gainNodes) {\n\t\t\tgain.disconnect();\n\t\t\tgain = null;\n\t\t}\n\t\t_srcNodes = [];\n\t\t_gainNodes = [];\n\n\t\t_isPlaying = false;\n\t}\n}","/*\n * Copyright (C)2005-2013 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\npackage haxe;\n\n/**\n\tThe Timer class allows you to create asynchronous timers on platforms that\n\tsupport events.\n\n\tThe intended usage is to create an instance of the Timer class with a given\n\tinterval, set its run() method to a custom function to be invoked and\n\teventually call stop() to stop the Timer.\n\n\tNote that a running Timer may or may not prevent the program to exit\n\tautomatically when main() returns.\n\n\tIt is also possible to extend this class and override its run() method in\n\tthe child class.\n**/\nclass Timer {\n\t#if (flash || js || java || python)\n\n\t#if (flash || js)\n\t\tprivate var id : Null;\n\t#elseif java\n\t\tprivate var timer : java.util.Timer;\n\t\tprivate var task : java.util.TimerTask;\n\t#end\n\n\t/**\n\t\tCreates a new timer that will run every `time_ms` milliseconds.\n\n\t\tAfter creating the Timer instance, it calls `this].run` repeatedly,\n\t\twith delays of `time_ms` milliseconds, until `this.stop` is called.\n\n\t\tThe first invocation occurs after `time_ms` milliseconds, not\n\t\timmediately.\n\n\t\tThe accuracy of this may be platform-dependent.\n\t**/\n\tpublic function new( time_ms : Int ){\n\t\t#if flash\n\t\t\tvar me = this;\n\t\t\tid = untyped __global__[\"flash.utils.setInterval\"](function() { me.run(); },time_ms);\n\t\t#elseif js\n\t\t\tvar me = this;\n\t\t\tid = untyped setInterval(function() me.run(),time_ms);\n\t\t#elseif java\n\t\t\ttimer = new java.util.Timer();\n\t\t\ttimer.scheduleAtFixedRate(task = new TimerTask(this), haxe.Int64.ofInt(time_ms), haxe.Int64.ofInt(time_ms));\n\t\t#end\n\t}\n\n\t/**\n\t\tStops `this` Timer.\n\n\t\tAfter calling this method, no additional invocations of `this.run`\n\t\twill occur.\n\n\t\tIt is not possible to restart `this` Timer once stopped.\n\t**/\n\tpublic function stop() {\n\t\t#if (flash || js)\n\t\t\tif( id == null )\n\t\t\t\treturn;\n\t\t\t#if flash\n\t\t\t\tuntyped __global__[\"flash.utils.clearInterval\"](id);\n\t\t\t#elseif js\n\t\t\t\tuntyped clearInterval(id);\n\t\t\t#end\n\t\t\tid = null;\n\t\t#elseif java\n\t\t\ttimer.cancel();\n\t\t\ttimer = null;\n\t\t\ttask = null;\n\t\t#end\n\t}\n\n\t/**\n\t\tThis method is invoked repeatedly on `this` Timer.\n\n\t\tIt can be overridden in a subclass, or rebound directly to a custom\n\t\tfunction:\n\t\t\tvar timer = new haxe.Timer(1000); // 1000ms delay\n\t\t\ttimer.run = function() { ... }\n\n\t\tOnce bound, it can still be rebound to different functions until `this`\n\t\tTimer is stopped through a call to `this.stop`.\n\t**/\n\tpublic dynamic function run() {\n\n\t}\n\n\t/**\n\t\tInvokes `f` after `time_ms` milliseconds.\n\n\t\tThis is a convenience function for creating a new Timer instance with\n\t\t`time_ms` as argument, binding its run() method to `f` and then stopping\n\t\t`this` Timer upon the first invocation.\n\n\t\tIf `f` is null, the result is unspecified.\n\t**/\n\tpublic static function delay( f : Void -> Void, time_ms : Int ) {\n\t\tvar t = new haxe.Timer(time_ms);\n\t\tt.run = function() {\n\t\t\tt.stop();\n\t\t\tf();\n\t\t};\n\t\treturn t;\n\t}\n\n\t#end\n\n\t/**\n\t\tMeasures the time it takes to execute `f`, in seconds with fractions.\n\n\t\tThis is a convenience function for calculating the difference between\n\t\tTimer.stamp() before and after the invocation of `f`.\n\n\t\tThe difference is passed as argument to Log.trace(), with \"s\" appended\n\t\tto denote the unit. The optional `pos` argument is passed through.\n\n\t\tIf `f` is null, the result is unspecified.\n\t**/\n\tpublic static function measure( f : Void -> T, ?pos : PosInfos ) : T {\n\t\tvar t0 = stamp();\n\t\tvar r = f();\n\t\tLog.trace((stamp() - t0) + \"s\", pos);\n\t\treturn r;\n\t}\n\n\t/**\n\t\tReturns a timestamp, in seconds with fractions.\n\n\t\tThe value itself might differ depending on platforms, only differences\n\t\tbetween two values make sense.\n\t**/\n\tpublic static function stamp() : Float {\n\t\t#if flash\n\t\t\treturn flash.Lib.getTimer() / 1000;\n\t\t#elseif (neko || php)\n\t\t\treturn Sys.time();\n\t\t#elseif js\n\t\t\treturn Date.now().getTime() / 1000;\n\t\t#elseif cpp\n\t\t\treturn untyped __global__.__time_stamp();\n\t\t#elseif sys\n\t\t\treturn Sys.time();\n\t\t#else\n\t\t\treturn 0;\n\t\t#end\n\t}\n\n}\n\n#if java\n@:nativeGen\nprivate class TimerTask extends java.util.TimerTask {\n\tvar timer:Timer;\n\tpublic function new(timer:Timer):Void {\n\t\tsuper();\n\t\tthis.timer = timer;\n\t}\n\n\t@:overload override public function run():Void {\n\t\ttimer.run();\n\t}\n}\n#end\n","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\npackage haxe.ds;\n\nprivate class StringMapIterator {\n\tvar map : StringMap;\n\tvar keys : Array;\n\tvar index : Int;\n\tvar count : Int;\n\tpublic inline function new(map:StringMap, keys:Array) {\n\t\tthis.map = map;\n\t\tthis.keys = keys;\n\t\tthis.index = 0;\n\t\tthis.count = keys.length;\n\t}\n\tpublic inline function hasNext() {\n\t\treturn index < count;\n\t}\n\tpublic inline function next() {\n\t\treturn map.get(keys[index++]);\n\t}\n}\n\n@:coreApi class StringMap implements haxe.Constraints.IMap {\n\n\tprivate var h : Dynamic;\n\tprivate var rh : Dynamic;\n\n\tpublic inline function new() : Void {\n\t\th = {};\n\t}\n\n\tinline function isReserved(key:String) : Bool {\n\t\treturn untyped __js__(\"__map_reserved\")[key] != null;\n\t}\n\n\tpublic inline function set( key : String, value : T ) : Void {\n\t\tif( isReserved(key) )\n\t\t\tsetReserved(key, value);\n\t\telse\n\t\t\th[cast key] = value;\n\t}\n\n\tpublic inline function get( key : String ) : Null {\n\t\tif( isReserved(key) )\n\t\t\treturn getReserved(key);\n\t\treturn h[cast key];\n\t}\n\n\tpublic inline function exists( key : String ) : Bool {\n\t\tif( isReserved(key) )\n\t\t\treturn existsReserved(key);\n\t\treturn h.hasOwnProperty(key);\n\t}\n\n\tfunction setReserved( key : String, value : T ) : Void {\n\t\tif( rh == null ) rh = {};\n\t\trh[cast \"$\"+key] = value;\n\t}\n\n\tfunction getReserved( key : String ) : Null {\n\t\treturn rh == null ? null : rh[cast \"$\"+key];\n\t}\n\n\tfunction existsReserved( key : String ) : Bool {\n\t\tif( rh == null ) return false;\n\t\treturn untyped rh.hasOwnProperty(\"$\"+key);\n\t}\n\n\tpublic function remove( key : String ) : Bool {\n\t\tif( isReserved(key) ) {\n\t\t\tkey = \"$\" + key;\n\t\t\tif( rh == null || !rh.hasOwnProperty(key) ) return false;\n\t\t\tuntyped __js__(\"delete\")(rh[key]);\n\t\t\treturn true;\n\t\t} else {\n\t\t\tif( !h.hasOwnProperty(key) )\n\t\t\t\treturn false;\n\t\t\tuntyped __js__(\"delete\")(h[key]);\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tpublic function keys() : Iterator {\n\t\treturn arrayKeys().iterator();\n\t}\n\t\n\tfunction arrayKeys() : Array {\n\t\tvar out = [];\n\t\tuntyped {\n\t\t\t__js__(\"for( var key in this.h ) {\");\n\t\t\t\tif( h.hasOwnProperty(key) )\n\t\t\t\t\tout.push(key);\n\t\t\t__js__(\"}\");\n\t\t}\n\t\tif( rh != null ) untyped {\n\t\t\t__js__(\"for( var key in this.rh ) {\");\n\t\t\t\tif( key.charCodeAt(0) == \"$\".code )\n\t\t\t\t\tout.push(key.substr(1));\n\t\t\t__js__(\"}\");\n\t\t}\n\t\treturn out;\n\t}\n\n\tpublic inline function iterator() : Iterator {\n\t\treturn new StringMapIterator(this, arrayKeys());\n\t}\n\n\tpublic function toString() : String {\n\t\tvar s = new StringBuf();\n\t\ts.add(\"{\");\n\t\tvar keys = arrayKeys();\n\t\tfor( i in 0...keys.length ) {\n\t\t\tvar k = keys[i];\n\t\t\ts.add(k);\n\t\t\ts.add(\" => \");\n\t\t\ts.add(Std.string(get(k)));\n\t\t\tif( i < keys.length )\n\t\t\t\ts.add(\", \");\n\t\t}\n\t\ts.add(\"}\");\n\t\treturn s.toString();\n\t}\n\n\tstatic function __init__() : Void {\n\t\tuntyped __js__(\"var __map_reserved = {}\");\n\t}\n\n}\n","/*\n * Copyright (C)2005-2012 Haxe Foundation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\npackage js;\n\nprivate class HaxeError extends js.Error {\n\n\tvar val:Dynamic;\n\n\tpublic function new(val:Dynamic) untyped {\n\t\tsuper();\n\t\tthis.val = __define_feature__(\"js.Boot.HaxeError\", val);\n\t\tthis.message = String(val);\n\t\tif (js.Error.captureStackTrace) js.Error.captureStackTrace(this, HaxeError);\n\t}\n}\n\n@:dox(hide)\nclass Boot {\n\n\tprivate static function __unhtml(s : String) {\n\t\treturn s.split(\"&\").join(\"&\").split(\"<\").join(\"<\").split(\">\").join(\">\");\n\t}\n\n\tprivate static function __trace(v,i : haxe.PosInfos) {\n\t\tuntyped {\n\t\t\tvar msg = if( i != null ) i.fileName+\":\"+i.lineNumber+\": \" else \"\";\n\t\t\t#if jsfl\n\t\t\tmsg += __string_rec(v,\"\");\n\t\t\tfl.trace(msg);\n\t\t\t#else\n\t\t\tmsg += __string_rec(v, \"\");\n\t\t\tif( i != null && i.customParams != null )\n\t\t\t\tfor( v in i.customParams )\n\t\t\t\t\tmsg += \",\" + __string_rec(v, \"\");\n\t\t\tvar d;\n\t\t\tif( __js__(\"typeof\")(document) != \"undefined\" && (d = document.getElementById(\"haxe:trace\")) != null )\n\t\t\t\td.innerHTML += __unhtml(msg)+\"
\";\n\t\t\telse if( __js__(\"typeof console\") != \"undefined\" && __js__(\"console\").log != null )\n\t\t\t\t__js__(\"console\").log(msg);\n\t\t\t#end\n\t\t}\n\t}\n\n\tprivate static function __clear_trace() {\n\t\tuntyped {\n\t\t\t#if jsfl\n\t\t\tfl.outputPanel.clear();\n\t\t\t#else\n\t\t\tvar d = document.getElementById(\"haxe:trace\");\n\t\t\tif( d != null )\n\t\t\t\td.innerHTML = \"\";\n\t\t\t#end\n\t\t}\n\t}\n\n\tstatic inline function isClass(o:Dynamic) : Bool {\n\t\treturn untyped __define_feature__(\"js.Boot.isClass\", o.__name__);\n\t}\n\n\tstatic inline function isEnum(e:Dynamic) : Bool {\n\t\treturn untyped __define_feature__(\"js.Boot.isEnum\", e.__ename__);\n\t}\n\n\tstatic function getClass(o:Dynamic) : Dynamic {\n\t\tif (Std.is(o, Array))\n\t\t\treturn Array;\n\t\telse {\n\t\t\tvar cl = untyped __define_feature__(\"js.Boot.getClass\", o.__class__);\n\t\t\tif (cl != null)\n\t\t\t\treturn cl;\n\t\t\tvar name = __nativeClassName(o);\n\t\t\tif (name != null)\n\t\t\t\treturn __resolveNativeClass(name);\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t@:ifFeature(\"has_enum\")\n\tprivate static function __string_rec(o,s:String) {\n\t\tuntyped {\n\t\t\tif( o == null )\n\t\t\t return \"null\";\n\t\t\tif( s.length >= 5 )\n\t\t\t\treturn \"<...>\"; // too much deep recursion\n\t\t\tvar t = __js__(\"typeof(o)\");\n\t\t\tif( t == \"function\" && (isClass(o) || isEnum(o)) )\n\t\t\t\tt = \"object\";\n\t\t\tswitch( t ) {\n\t\t\tcase \"object\":\n\t\t\t\tif( __js__(\"o instanceof Array\") ) {\n\t\t\t\t\tif( o.__enum__ ) {\n\t\t\t\t\t\tif( o.length == 2 )\n\t\t\t\t\t\t\treturn o[0];\n\t\t\t\t\t\tvar str = o[0]+\"(\";\n\t\t\t\t\t\ts += \"\\t\";\n\t\t\t\t\t\tfor( i in 2...o.length ) {\n\t\t\t\t\t\t\tif( i != 2 )\n\t\t\t\t\t\t\t\tstr += \",\" + __string_rec(o[i],s);\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tstr += __string_rec(o[i],s);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn str + \")\";\n\t\t\t\t\t}\n\t\t\t\t\tvar l = o.length;\n\t\t\t\t\tvar i;\n\t\t\t\t\tvar str = \"[\";\n\t\t\t\t\ts += \"\\t\";\n\t\t\t\t\tfor( i in 0...l )\n\t\t\t\t\t\tstr += (if (i > 0) \",\" else \"\")+__string_rec(o[i],s);\n\t\t\t\t\tstr += \"]\";\n\t\t\t\t\treturn str;\n\t\t\t\t}\n\t\t\t\tvar tostr;\n\t\t\t\ttry {\n\t\t\t\t\ttostr = untyped o.toString;\n\t\t\t\t} catch( e : Dynamic ) {\n\t\t\t\t\t// strange error on IE\n\t\t\t\t\treturn \"???\";\n\t\t\t\t}\n\t\t\t\tif( tostr != null && tostr != __js__(\"Object.toString\") && __typeof__(tostr) == \"function\" ) {\n\t\t\t\t\tvar s2 = o.toString();\n\t\t\t\t\tif( s2 != \"[object Object]\")\n\t\t\t\t\t\treturn s2;\n\t\t\t\t}\n\t\t\t\tvar k : String = null;\n\t\t\t\tvar str = \"{\\n\";\n\t\t\t\ts += \"\\t\";\n\t\t\t\tvar hasp = (o.hasOwnProperty != null);\n\t\t\t\t__js__(\"for( var k in o ) {\");\n\t\t\t\t\tif( hasp && !o.hasOwnProperty(k) )\n\t\t\t\t\t\t__js__(\"continue\");\n\t\t\t\t\tif( k == \"prototype\" || k == \"__class__\" || k == \"__super__\" || k == \"__interfaces__\" || k == \"__properties__\" )\n\t\t\t\t\t\t__js__(\"continue\");\n\t\t\t\t\tif( str.length != 2 )\n\t\t\t\t\t\tstr += \", \\n\";\n\t\t\t\t\tstr += s + k + \" : \"+__string_rec(o[k],s);\n\t\t\t\t__js__(\"}\");\n\t\t\t\ts = s.substring(1);\n\t\t\t\tstr += \"\\n\" + s + \"}\";\n\t\t\t\treturn str;\n\t\t\tcase \"function\":\n\t\t\t\treturn \"\";\n\t\t\tcase \"string\":\n\t\t\t\treturn o;\n\t\t\tdefault:\n\t\t\t\treturn String(o);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static function __interfLoop(cc : Dynamic,cl : Dynamic) {\n\t\tif( cc == null )\n\t\t\treturn false;\n\t\tif( cc == cl )\n\t\t\treturn true;\n\t\tvar intf : Dynamic = cc.__interfaces__;\n\t\tif( intf != null )\n\t\t\tfor( i in 0...intf.length ) {\n\t\t\t\tvar i : Dynamic = intf[i];\n\t\t\t\tif( i == cl || __interfLoop(i,cl) )\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\treturn __interfLoop(cc.__super__,cl);\n\t}\n\n\t@:ifFeature(\"typed_catch\") private static function __instanceof(o : Dynamic,cl : Dynamic) {\n\t\tif( cl == null )\n\t\t\treturn false;\n\t\tswitch( cl ) {\n\t\tcase Int:\n\t\t\treturn (untyped __js__(\"(o|0) === o\"));\n\t\tcase Float:\n\t\t\treturn (untyped __js__(\"typeof\"))(o) == \"number\";\n\t\tcase Bool:\n\t\t\treturn (untyped __js__(\"typeof\"))(o) == \"boolean\";\n\t\tcase String:\n\t\t\treturn (untyped __js__(\"typeof\"))(o) == \"string\";\n\t\tcase Array:\n\t\t\treturn (untyped __js__(\"(o instanceof Array)\")) && o.__enum__ == null;\n\t\tcase Dynamic:\n\t\t\treturn true;\n\t\tdefault:\n\t\t\tif( o != null ) {\n\t\t\t\t// Check if o is an instance of a Haxe class or a native JS object\n\t\t\t\tif( (untyped __js__(\"typeof\"))(cl) == \"function\" ) {\n\t\t\t\t\tif( untyped __js__(\"o instanceof cl\") )\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tif( __interfLoop(getClass(o),cl) )\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse if ( (untyped __js__(\"typeof\"))(cl) == \"object\" && __isNativeObj(cl) ) {\n\t\t\t\t\tif( untyped __js__(\"o instanceof cl\") )\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// do not use isClass/isEnum here\n\t\t\tuntyped __feature__(\"Class.*\",if( cl == Class && o.__name__ != null ) return true);\n\t\t\tuntyped __feature__(\"Enum.*\",if( cl == Enum && o.__ename__ != null ) return true);\n\t\t\treturn o.__enum__ == cl;\n\t\t}\n\t}\n\n\t@:ifFeature(\"typed_cast\") private static function __cast(o : Dynamic, t : Dynamic) {\n\t\tif (__instanceof(o, t)) return o;\n\t\telse throw \"Cannot cast \" +Std.string(o) + \" to \" +Std.string(t);\n\t}\n\n\tstatic var __toStr = untyped __js__(\"{}.toString\");\n\t// get native JS [[Class]]\n\tstatic function __nativeClassName(o:Dynamic):String {\n\t\tvar name = untyped __toStr.call(o).slice(8, -1);\n\t\t// exclude general Object and Function\n\t\t// also exclude Math and JSON, because instanceof cannot be called on them\n\t\tif (name == \"Object\" || name == \"Function\" || name == \"Math\" || name == \"JSON\")\n\t\t\treturn null;\n\t\treturn name;\n\t}\n\n\t// check for usable native JS object\n\tstatic function __isNativeObj(o:Dynamic):Bool {\n\t\treturn __nativeClassName(o) != null;\n\t}\n\n\t// resolve native JS class in the global scope:\n\tstatic function __resolveNativeClass(name:String) {\n\t\treturn untyped js.Lib.global[name];\n\t}\n\n}\n"], "names":[], "mappings":";;;;;;;eAuDO,JAAe;CACrB,EAAa;CAEb,EAAQ;CACR,AAAU,AAAO;CACjB,AAAU,AAAO;CACjB,AAAU,AAAO;CACjB,AAAU,AAAO;CACjB,AAAU,AAAO;;;yBAUX,dAAwC;EAC9C,AAAI,DAAc,AAAgB,GAAmB,HAAM;GAC1D,AAAoB,FAAc,AAAgB;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