@awayfl/avm1
Version:
Virtual machine for executing AS1 and AS2 code
1 lines • 259 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@awayfl/swf-loader"),require("@awayjs/stage"),require("@awayjs/scene"),require("@awayjs/materials"),require("@awayjs/core"),require("@awayjs/graphics"),require("@awayjs/renderer"),require("@awayjs/view")):"function"==typeof define&&define.amd?define(["exports","@awayfl/swf-loader","@awayjs/stage","@awayjs/scene","@awayjs/materials","@awayjs/core","@awayjs/graphics","@awayjs/renderer","@awayjs/view"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).AwayflAvm1={},t.AwayflSwfLoader,t.AwayjsStage,t.AwayjsScene,t.AwayjsMaterials,t.AwayjsCore,t.AwayjsGraphics,t.AwayjsRenderer,t.AwayjsView)}(this,(function(t,e,n,o,r,i,a,s,l){"use strict";var c=function(t,e){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},c(t,e)};function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}c(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var p=function(){return p=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},p.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var h=function(t,e,n,o,r){this.flags=t,this.value=e,this.get=n,this.set=o,this.watcher=r},d=function(t){function n(e){var n=t.call(this)||this;n.initialDepth=0,n.scriptRefsToChilds={},n._isGhost=!1,n._avm1Context=e,n._ownProperties=Object.create(null),n.scriptRefsToChilds={},n._prototype=null,n._blockedByScript=!1,n._ctBlockedByScript=!1,n._visibilityByScript=!1;var o=n,r=new h(131,null,{alCall:function(t,e){return o.alPrototype}},{alCall:function(t,e){o.alPrototype=e[0]}});return n.alSetOwnProperty("__proto__",r),n}return u(n,t),Object.defineProperty(n.prototype,"isGhost",{get:function(){return this._isGhost},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"eventObserver",{get:function(){return this._eventObserver},set:function(t){this._eventObserver=t},enumerable:!1,configurable:!0}),n.prototype.makeGhost=function(){this.deleteOwnProperties(),this.alPut("__proto__",null),this._isGhost=!0},n.prototype.dispose=function(){},n.prototype.updateFilters=function(t){},n.prototype.isBlockedByScript=function(){return this._blockedByScript},n.prototype.isColorTransformByScript=function(){return this._ctBlockedByScript},n.prototype.isVisibilityByScript=function(){return this._visibilityByScript},n.prototype.initAdapter=function(){},n.prototype.freeFromScript=function(){this.protoTypeChanged=!1,this._blockedByScript=!1,this._ctBlockedByScript=!1,this._visibilityByScript=!1},n.prototype.clone=function(){return new n(this._avm1Context)},Object.defineProperty(n.prototype,"context",{get:function(){return this._avm1Context},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"alPrototype",{get:function(){return this._prototype},set:function(t){for(var e=t;e;){if(e===this)return;e=e.alPrototype}this._prototype=t},enumerable:!1,configurable:!0}),n.prototype.alGetPrototypeProperty=function(){return this.alGet("prototype")},n.prototype.alSetOwnPrototypeProperty=function(t){this.alSetOwnProperty("prototype",new h(65,t))},n.prototype.alGetConstructorProperty=function(){return this.alGet("__constructor__")},n.prototype.alSetOwnConstructorProperty=function(t){this.alSetOwnProperty("__constructor__",new h(65,t))},n.prototype._debugEscapeProperty=function(t){var e=this.context,n=Je(e,t);return e.isPropertyCaseSensitive||(n=n.toLowerCase()),"$Bg"+n},n.prototype.alGetOwnProperty=function(t){return this._isGhost?null:("string"!=typeof t||this.context.isPropertyCaseSensitive||(t=t.toLowerCase()),e.release||e.Debug.assert(Qe(this.context,t)),this._ownProperties[t])},n.prototype.alSetOwnProperty=function(t,n){if(!this._isGhost){var o=this.context.normalizeName(t);n.originalName||this.context.isPropertyCaseSensitive||(n.originalName=t),e.release||(e.Debug.assert(n instanceof h),e.Debug.assert(!n.owningObject||n.owningObject===this),n.owningObject=this,64&n.flags&&!(1&n.flags)&&Object.defineProperty(this,this._debugEscapeProperty(o),{value:n.value,enumerable:!0,configurable:!0})),this._ownProperties[o]=n}},n.prototype.alHasOwnProperty=function(t){if(this._isGhost)return!1;var e=this.context.normalizeName(t);return!!this._ownProperties[e]},n.prototype.alDeleteOwnProperty=function(t){var n=this.context.normalizeName(t);delete this._ownProperties[n],e.release||delete this[this._debugEscapeProperty(t)]},n.prototype.deleteOwnProperties=function(){for(var t=this.alGetOwnPropertiesKeys(),e=0;e<t.length;e++)this.alDeleteOwnProperty(t[e])},n.prototype.alGetOwnPropertiesKeys=function(){var t,n=[];if(this._isGhost)return n;if(this.context.isPropertyCaseSensitive)for(var o in this._ownProperties)1&(t=this._ownProperties[o]).flags||n.push(o);else for(var r in this._ownProperties)t=this._ownProperties[r],e.release||e.Debug.assert("originalName"in t),1&t.flags||n.push(t.originalName);return n},n.prototype.alGetProperty=function(t){if(this._isGhost)return null;var e=this.alGetOwnProperty(t);return e||(this._prototype?this._prototype.alGetProperty(t):void 0)},n.prototype.alGet=function(t){if(!this._isGhost){var n=this.context.normalizeName(t),o=this.alGetProperty(n);if(o){if(64&o.flags)return o.value;e.release||e.Debug.assert(!!(128&o.flags));var r=o.get;return r?r.alCall(this):void 0}}},n.prototype.alCanPut=function(t){if(this._isGhost)return!1;var e=this.alGetOwnProperty(t);if(e)return 128&e.flags?!!e.set:!(4&e.flags);var n=this._prototype;return!n||n.alCanPut(t)},n.prototype.alPut=function(t,n){if(!this._isGhost){var o=t;if(t=this.context.normalizeName(t),n&&"object"==typeof n&&"symbol"===n.avmType&&"this"!=t&&"_parent"!=t&&!n.dynamicallyCreated&&n.adaptee&&n.adaptee.parent&&n.adaptee.parent.adapter&&n.adaptee.parent.adapter.scriptRefsToChilds&&(n.adaptee.parent.adapter.scriptRefsToChilds[n.adaptee.name]={obj:this,name:t}),this.alCanPut(t)){var r=this.alGetOwnProperty(t);if(r&&64&r.flags)return r.watcher&&(n=r.watcher.callback.alCall(this,[r.watcher.name,r.value,n,r.watcher.userData])),void(t in this._ownProperties?r.value=n:this.alSetOwnProperty(o,new h(r.flags,n)));if(void 0!==n||"_x"!=t&&"_y"!=t&&"_xscale"!=t&&"_yscale"!=t&&"_width"!=t&&"_height"!=t){var i=this.alGetProperty(t);if(i&&128&i.flags){if(i.watcher){var a=i.get?i.get.alCall(this):void 0;n=i.watcher.callback.alCall(this,[i.watcher.name,a,n,i.watcher.userData])}var s=i.set;e.release||e.Debug.assert(s),s.alCall(this,[n])}else if(i&&i.watcher&&(e.release||e.Debug.assert(64&i.flags),n=i.watcher.callback.alCall(this,[i.watcher.name,i.value,n,i.watcher.userData])),n&&n.isTextVar){n=n.value,(l=new h(i?i.flags:64,n)).isTextVar=!0,this.alSetOwnProperty(o,l)}else{var l=new h(i?i.flags:64,n);this.alSetOwnProperty(o,l)}}}}},n.prototype.alHasProperty=function(t){return!this._isGhost&&!!this.alGetProperty(t)},n.prototype.alDeleteProperty=function(t){var e=this.alGetOwnProperty(t);return!e||!(2&e.flags)&&(this.alDeleteOwnProperty(t),!0)},n.prototype.alAddPropertyWatcher=function(t,e,n){if(this._isGhost)return!1;var o=this.alGetProperty(t);return!!o&&(o.watcher={name:t,callback:e,userData:n},!0)},n.prototype.alRemotePropertyWatcher=function(t){var e=this.alGetProperty(t);return!(!e||!e.watcher)&&(e.watcher=void 0,!0)},n.prototype.alDefaultValue=function(t){if(void 0===t&&(t=0),1===t){var n=this.alGet(this.context.normalizeName("toString"));if(an(n))return n.alCall(this);if(an(o=this.alGet(this.context.normalizeName("valueOf"))))return o.alCall(this)}else{var o;if(e.release||e.Debug.assert(0===t),an(o=this.alGet(this.context.normalizeName("valueOf"))))return o.alCall(this);var r=this.alGet(this.context.normalizeName("toString"));if(an(r))return r.alCall(this)}return this},n.prototype.alGetKeys=function(){if(this._isGhost)return[];var t=this.alGetOwnPropertiesKeys(),e=this._prototype;if(!e)return t;var n=e.alGetKeys();if(0===t.length)return n;var o,r=this.context;if(r.isPropertyCaseSensitive){var i=Object.create(null),a=t.length;for(o=0;o<a;o++)i[t[o]]=!0;var s=n.length;for(o=0;o<s;o++)i[n[o]]=!0;return Object.getOwnPropertyNames(i)}var l=[t,n],c=Object.create(null),u=[],p=void 0,h=void 0,d=void 0;for(o=0;o<l.length;o++){p=l[o];for(var f=0;f<p.length;f++)h=p[f],c[d=r.normalizeName(h)]||(c[d]=!0,u.push(h))}return u},n}((function(){})),f=function(t){function e(e){var n=t.call(this,e)||this;return n.alPrototype=e.builtins.Function.alGetPrototypeProperty(),n.isOnEnter=!1,n}return u(e,t),e.prototype.alConstruct=function(t){throw new Error("not implemented AVM1Function.alConstruct")},e.prototype.alCall=function(t,e){throw new Error("not implemented AVM1Function.alCall")},e.prototype.toJSFunction=function(t){void 0===t&&(t=null);var e=this,n=this.context;return function(){var o=Array.prototype.slice.call(arguments,0);return n.executeFunction(e,t,o)}},e}(d);function v(t){if(!t)return new i.Point(0,0);var e,n,o=t.context;return t instanceof d&&(e=nn(o,t.alGet("x")),n=nn(o,t.alGet("y"))),new i.Point(e,n)}function y(t,e){e.alPut("x",t.x),e.alPut("y",t.y)}var g=function(t){function e(e,n,o){var r=t.call(this,e)||this;return r.alPrototype=e.globals.Point.alGetPrototypeProperty(),r.alPut("x",n),r.alPut("y",o),r}return u(e,t),e.fromAS3Point=function(t,n){return new e(t,n.x,n.y)},e}(d),m=function(t){function e(e){var n=t.call(this,e)||this;return hn(n,{prototype:{value:new b(e,n)},distance:{value:n.distance,writable:!0},interpolate:{value:n.interpolate,writable:!0},polar:{value:n.polar,writable:!0}}),n}return u(e,t),e.prototype.alCall=function(t,e){return this.alConstruct(e)},e.prototype.alConstruct=function(t){return t&&t.length>0?new g(this.context,t[0],t[1]):new g(this.context,0,0)},e.prototype.distance=function(t,e){return i.Point.distance(v(t),v(e))},e.prototype.interpolate=function(t,e,n){n=ze(this.context,n);var o=i.Point.interpolate(v(t),v(e),n);return g.fromAS3Point(this.context,o)},e.prototype.polar=function(t,e){return t=ze(this.context,t),e=ze(this.context,e),g.fromAS3Point(this.context,i.Point.polar(t,e))},e}(f),b=function(t){function e(e,n){var o=t.call(this,e)||this;return o.alPrototype=e.builtins.Object.alGetPrototypeProperty(),hn(o,{constructor:{value:n,writable:!0},length:{get:o.getLength},add:{value:o.add,writable:!0},clone:{value:o.clone,writable:!0},equals:{value:o.equals,writable:!0},normalize:{value:o.normalize,writable:!0},offset:{value:o.offset,writable:!0},subtract:{value:o.subtract,writable:!0},toString:{value:o._toString,writable:!0}}),o}return u(e,t),e.prototype.getLength=function(){return v(this).length},e.prototype.add=function(t){return g.fromAS3Point(this.context,v(this).add(v(t)))},e.prototype.clone=function(){var t=new g(this.context);return this instanceof d&&(t.alPut("x",this.alGet("x")),t.alPut("y",this.alGet("y"))),t},e.prototype.equals=function(t){return v(this).equals(v(t))},e.prototype.normalize=function(t){t=ze(this.context,t);var e=v(this);e.normalize(t),y(e,this)},e.prototype.offset=function(t,e){t=ze(this.context,t),e=ze(this.context,e);var n=v(this);n.offset(t,e),y(n,this)},e.prototype.subtract=function(t){return g.fromAS3Point(this.context,v(this).subtract(v(t)))},e.prototype._toString=function(){return"(x="+this.alGet("x")+", y="+this.alGet("y")+")"},e}(d);function _(t){var e,n,o,r,a=t.context;return t instanceof d&&(e=nn(a,t.alGet("x")),n=nn(a,t.alGet("y")),o=nn(a,t.alGet("width")),r=nn(a,t.alGet("height"))),new i.Rectangle(e,n,o,r)}function x(t,e){e.alPut("x",t.x),e.alPut("y",t.y),e.alPut("width",t.width),e.alPut("height",t.height)}var w=function(t){function e(e,n,o,r,i){var a=t.call(this,e)||this;return a.alPrototype=e.globals.Rectangle.alGetPrototypeProperty(),a.alPut("x",n),a.alPut("y",o),a.alPut("width",r),a.alPut("height",i),a}return u(e,t),e.fromAS3Rectangle=function(t,n){return new e(t,n.x,n.y,n.width,n.height)},e}(d),A=function(t){function e(e){var n=t.call(this,e)||this;return hn(n,{prototype:{value:new S(e,n)}}),n}return u(e,t),e.prototype.alConstruct=function(t){return t&&t.length>0?new w(this.context,t[0],t[1],t[2],t[3]):new w(this.context,0,0,0,0)},e}(f),S=function(t){function e(e,n){var o=t.call(this,e)||this;return o.alPrototype=e.builtins.Object.alGetPrototypeProperty(),hn(o,{constructor:{value:n,writable:!0},bottom:{get:o.getBottom,set:o.setBottom},bottomRight:{get:o.getBottomRight,set:o.setBottomRight},left:{get:o.getLeft,set:o.setLeft},right:{get:o.getRight,set:o.setRight},size:{get:o.getSize,set:o.setSize},top:{get:o.getTop,set:o.setTop},topLeft:{get:o.getTopLeft,set:o.setTopLeft},clone:{value:o.clone,writable:!0},contains:{value:o.contains,writable:!0},containsPoint:{value:o.containsPoint,writable:!0},containsRectangle:{value:o.containsRectangle,writable:!0},equals:{value:o.equals,writable:!0},inflate:{value:o.inflate,writable:!0},inflatePoint:{value:o.inflatePoint,writable:!0},intersection:{value:o.intersection,writable:!0},intersects:{value:o.intersects,writable:!0},isEmpty:{value:o.isEmpty,writable:!0},offset:{value:o.offset,writable:!0},offsetPoint:{value:o.offsetPoint,writable:!0},setEmpty:{value:o.setEmpty,writable:!0},toString:{value:o._toString,writable:!0},union:{value:o.union,writable:!0}}),o}return u(e,t),e.prototype.getBottom=function(){return ze(this.context,this.alGet("y"))+ze(this.context,this.alGet("height"))},e.prototype.setBottom=function(t){this.alPut("height",ze(this.context,t)-ze(this.context,this.alGet("y")))},e.prototype.getBottomRight=function(){return new g(this.context,e.prototype.getRight.call(this),e.prototype.getBottom.call(this))},e.prototype.setBottomRight=function(t){e.prototype.setRight.call(this,t.alGet("x")),e.prototype.setBottom.call(this,t.alGet("y"))},e.prototype.getLeft=function(){return ze(this.context,this.alGet("x"))},e.prototype.setLeft=function(t){this.alPut("x",ze(this.context,t))},e.prototype.getSize=function(){return new g(this.context,this.alGet("width"),this.alGet("height"))},e.prototype.setSize=function(t){this.alPut("width",t.alGet("x")),this.alPut("height",t.alGet("y"))},e.prototype.getRight=function(){return ze(this.context,this.alGet("x"))+ze(this.context,this.alGet("width"))},e.prototype.setRight=function(t){this.alPut("width",ze(this.context,t)-ze(this.context,this.alGet("x")))},e.prototype.getTop=function(){return ze(this.context,this.alGet("y"))},e.prototype.setTop=function(t){this.alPut("y",ze(this.context,t))},e.prototype.getTopLeft=function(){return new g(this.context,e.prototype.getLeft.call(this),e.prototype.getTop.call(this))},e.prototype.setTopLeft=function(t){e.prototype.setLeft.call(this,t.alGet("x")),e.prototype.setTop.call(this,t.alGet("y"))},e.prototype.clone=function(){var t=new w(this.context);return this instanceof d&&(t.alPut("x",this.alGet("x")),t.alPut("y",this.alGet("y")),t.alPut("width",this.alGet("width")),t.alPut("height",this.alGet("height"))),t},e.prototype.contains=function(t,e){return t=ze(this.context,t),e=ze(this.context,e),_(this).contains(t,e)},e.prototype.containsPoint=function(t){var e=_(this),n=v(t);return e.containsPoint(n)},e.prototype.containsRectangle=function(t){var e=_(this),n=_(t);return e.containsRect(n)},e.prototype.equals=function(t){var e=_(this),n=_(t);return e.equals(n)},e.prototype.inflate=function(t,e){t=ze(this.context,t),e=ze(this.context,e);var n=_(this);n.inflate(t,e),x(n,this)},e.prototype.inflatePoint=function(t){var e=_(this),n=v(t);e.inflatePoint(n),x(e,this)},e.prototype.intersection=function(t){var e=_(this),n=_(t);return w.fromAS3Rectangle(this.context,e.intersection(n))},e.prototype.intersects=function(t){var e=_(this),n=_(t);return e.intersects(n)},e.prototype.isEmpty=function(){return _(this).isEmpty()},e.prototype.offset=function(t,e){t=ze(this.context,t),e=ze(this.context,e);var n=_(this);n.offset(t,e),x(n,this)},e.prototype.offsetPoint=function(t){var e=_(this),n=v(t);e.offsetPoint(n),x(e,this)},e.prototype.setEmpty=function(){this.alPut("x",0),this.alPut("y",0),this.alPut("width",0),this.alPut("height",0)},e.prototype._toString=function(){return"(x="+this.alGet("x")+", y="+this.alGet("y")+", w="+this.alGet("width")+", h="+this.alGet("height")+")"},e.prototype.union=function(t){var e=_(this),n=_(t);return w.fromAS3Rectangle(this.context,e.union(n))},e}(d);function C(t,e){return void 0===t?e:t}function M(t){var e=t.context;return t instanceof P?new i.ColorTransform(nn(e,C(t._rawData[0],1)),nn(e,C(t._rawData[1],1)),nn(e,C(t._rawData[2],1)),nn(e,C(t._rawData[3],1)),nn(e,C(t._rawData[4],0)),nn(e,C(t._rawData[5],0)),nn(e,C(t._rawData[6],0)),nn(e,C(t._rawData[7],0))):new i.ColorTransform(1,1,1,1,0,0,0,0)}var P=function(t){function e(e,n,o,r,i,a,s,l,c){void 0===n&&(n=1),void 0===o&&(o=1),void 0===r&&(r=1),void 0===i&&(i=1),void 0===a&&(a=0),void 0===s&&(s=0),void 0===l&&(l=0),void 0===c&&(c=0);var u=t.call(this,e)||this;return u._rawData=[n,o,r,i,a,s,l,c],u.alPrototype=e.globals.ColorTransform.alGetPrototypeProperty(),hn(u,{rgb:{get:u.getRgb,set:u.setRgb},ra:{get:u.getRM,set:u.setRM},ga:{get:u.getGM,set:u.setGM},ba:{get:u.getBM,set:u.setBM},aa:{get:u.getAM,set:u.setAM},rb:{get:u.getRO,set:u.setRO},gb:{get:u.getGO,set:u.setGO},bb:{get:u.getBO,set:u.setBO},ab:{get:u.getAO,set:u.setAO},redMultiplier:{get:u.getRedMultiplier,set:u.setRedMultiplier},greenMultiplier:{get:u.getGreenMultiplier,set:u.setGreenMultiplier},blueMultiplier:{get:u.getBlueMultiplier,set:u.setBlueMultiplier},alphaMultiplier:{get:u.getAlphaMultiplier,set:u.setAlphaMultiplier},redOffset:{get:u.getRedOffset,set:u.setRedOffset},greenOffset:{get:u.getGreenOffset,set:u.setGreenOffset},blueOffset:{get:u.getBlueOffset,set:u.setBlueOffset},alphaOffset:{get:u.getAlphaOffset,set:u.setAlphaOffset},concat:{value:u.concat,writable:!0},toString:{value:u._toString,writable:!0}}),u}return u(e,t),e.prototype.getRedMultiplier=function(){return this._rawData[0]},e.prototype.setRedMultiplier=function(t){this._rawData[0]=t},e.prototype.getGreenMultiplier=function(){return this._rawData[1]},e.prototype.setGreenMultiplier=function(t){this._rawData[1]=t},e.prototype.getBlueMultiplier=function(){return this._rawData[2]},e.prototype.setBlueMultiplier=function(t){this._rawData[2]=t},e.prototype.getAlphaMultiplier=function(){return this._rawData[3]},e.prototype.setAlphaMultiplier=function(t){this._rawData[3]=t},e.prototype.getRedOffset=function(){return this._rawData[4]},e.prototype.setRedOffset=function(t){this._rawData[4]=t},e.prototype.getGreenOffset=function(){return this._rawData[5]},e.prototype.setGreenOffset=function(t){this._rawData[5]=t},e.prototype.getBlueOffset=function(){return this._rawData[6]},e.prototype.setBlueOffset=function(t){this._rawData[6]=t},e.prototype.getAlphaOffset=function(){return this._rawData[7]},e.prototype.setAlphaOffset=function(t){this._rawData[7]=t},e.prototype.getRM=function(){return 100*this._rawData[0]},e.prototype.setRM=function(t){this._rawData[0]=t/100},e.prototype.getGM=function(){return 100*this._rawData[1]},e.prototype.setGM=function(t){this._rawData[1]=t/100},e.prototype.getBM=function(){return 100*this._rawData[2]},e.prototype.setBM=function(t){this._rawData[2]=t/100},e.prototype.getAM=function(){return 100*this._rawData[3]},e.prototype.setAM=function(t){this._rawData[3]=t/100},e.prototype.getRO=function(){return this._rawData[4]},e.prototype.setRO=function(t){this._rawData[4]=t},e.prototype.getGO=function(){return this._rawData[5]},e.prototype.setGO=function(t){this._rawData[5]=t},e.prototype.getBO=function(){return this._rawData[6]},e.prototype.setBO=function(t){this._rawData[6]=t},e.prototype.getAO=function(){return this._rawData[7]},e.prototype.setAO=function(t){this._rawData[7]=t},e.prototype.getRgb=function(){return this._rawData[4]<<16|this._rawData[5]<<8|this._rawData[6]},e.prototype.setRgb=function(t){var e=i.ColorUtils.float32ColorToARGB(t);this._rawData[4]=e[1],this._rawData[5]=e[2],this._rawData[6]=e[3],this._rawData[0]=0,this._rawData[1]=0,this._rawData[2]=0},e.prototype.concat=function(t){console.warn("AVM1ColorTransform concat is not implemented")},e.prototype._toString=function(){return"[object Object]"},e.fromAwayColorTransform=function(t,n){return new e(t,n.redMultiplier,n.greenMultiplier,n.blueMultiplier,n.alphaMultiplier,n.redOffset,n.greenOffset,n.blueOffset,n.alphaOffset)},e}(d),T=function(t){function e(e){var n=t.call(this,e)||this;return hn(n,{prototype:{value:new N(e,n)}}),n}return u(e,t),e.prototype.alConstruct=function(t){var e=Object.create(P.prototype);return t=t||[],P.apply(e,[this.context].concat(t)),e},e}(f),N=function(t){function e(e,n){var o=t.call(this,e)||this;return o.alPrototype=e.builtins.Object.alGetPrototypeProperty(),hn(o,{constructor:{value:n,writable:!0}}),o}return u(e,t),e}(d);function D(t){var e,n,o,r,a,s,l=t.context;return t instanceof d&&(e=nn(l,t.alGet("a")),n=nn(l,t.alGet("b")),o=nn(l,t.alGet("c")),r=nn(l,t.alGet("d")),a=nn(l,t.alGet("tx")),s=nn(l,t.alGet("ty"))),new i.Matrix(e,n,o,r,a,s)}function E(t,e){e.alPut("a",t.a),e.alPut("b",t.b),e.alPut("c",t.c),e.alPut("d",t.d),e.alPut("tx",t.tx),e.alPut("ty",t.ty)}var O=function(t){function e(e,n,o,r,i,a,s){void 0===n&&(n=1),void 0===o&&(o=0),void 0===r&&(r=0),void 0===i&&(i=1),void 0===a&&(a=0),void 0===s&&(s=0);var l=t.call(this,e)||this;return l.alPrototype=e.globals.Matrix.alGetPrototypeProperty(),l.alPut("a",n),l.alPut("b",o),l.alPut("c",r),l.alPut("d",i),l.alPut("tx",a),l.alPut("ty",s),l}return u(e,t),e.fromAS3Matrix=function(t,n){return new e(t,n.a,n.b,n.c,n.d,n.tx,n.ty)},e}(d),L=function(t){function e(e){var n=t.call(this,e)||this;return hn(n,{prototype:{value:new k(e,n)}}),n}return u(e,t),e.prototype.alConstruct=function(t){return t&&t.length>0?new O(this.context,t[0],t[1],t[2],t[3],t[4],t[5]):new O(this.context)},e}(f),k=function(t){function e(e,n){var o=t.call(this,e)||this;return o.alPrototype=e.builtins.Object.alGetPrototypeProperty(),hn(o,{constructor:{value:n,writable:!0},clone:{value:o.clone,writable:!0},concat:{value:o.concat,writable:!0},createBox:{value:o.createBox,writable:!0},createGradientBox:{value:o.createGradientBox,writable:!0},deltaTransformPoint:{value:o.deltaTransformPoint,writable:!0},identity:{value:o.identity,writable:!0},invert:{value:o.invert,writable:!0},rotate:{value:o.rotate,writable:!0},scale:{value:o.scale,writable:!0},toString:{value:o._toString,writable:!0},transformPoint:{value:o.transformPoint,writable:!0},translate:{value:o.translate,writable:!0}}),o}return u(e,t),e.prototype.clone=function(){var t=new O(this.context);return this instanceof d&&(t.alPut("a",this.alGet("a")),t.alPut("b",this.alGet("b")),t.alPut("c",this.alGet("c")),t.alPut("d",this.alGet("d")),t.alPut("tx",this.alGet("tx")),t.alPut("ty",this.alGet("ty"))),t},e.prototype.concat=function(t){var e=D(this),n=D(t);e.concat(n),E(e,this)},e.prototype.createBox=function(t,e,n,o,r){void 0===n&&(n=0),void 0===o&&(o=0),void 0===r&&(r=0),t=nn(this.context,t),e=nn(this.context,e),n=nn(this.context,n),o=nn(this.context,o),r=nn(this.context,r);var i=D(this);i.createBox(t,e,n,o,r),E(i,this)},e.prototype.createGradientBox=function(t,e,n,o,r){void 0===n&&(n=0),void 0===o&&(o=0),void 0===r&&(r=0),t=nn(this.context,t),e=nn(this.context,e),n=nn(this.context,n),o=nn(this.context,o),r=nn(this.context,r);var i=D(this);i.createGradientBox(t,e,n,o,r),E(i,this)},e.prototype.deltaTransformPoint=function(t){var e=v(t),n=D(this);return g.fromAS3Point(this.context,n.deltaTransformPoint(e))},e.prototype.identity=function(){this.alPut("a",1),this.alPut("b",0),this.alPut("c",0),this.alPut("d",1),this.alPut("tx",0),this.alPut("ty",0)},e.prototype.invert=function(){var t=D(this);t.invert(),E(t,this)},e.prototype.rotate=function(t){t=nn(this.context,t);var e=D(this);e.rotate(t),E(e,this)},e.prototype.scale=function(t,e){t=nn(this.context,t),e=nn(this.context,e);var n=D(this);n.scale(t,e),E(n,this)},e.prototype._toString=function(){return D(this).toString()},e.prototype.transformPoint=function(t){var e=v(t),n=D(this);return g.fromAS3Point(this.context,n.transformPoint(e))},e.prototype.translate=function(t,e){t=nn(this.context,t),e=nn(this.context,e);var n=D(this);n.translate(t,e),E(n,this)},e}(d),F=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return u(n,t),n.createAVM1Class=function(t){var e=new n(t);return xn(t,e,n.prototype,["align#","displayState#","fullScreenSourceRect#","height#","scaleMode#","showMenu#","width#"],!1),e},n.bindStage=function(t,e,o,r,i){e.avmStage=o,e.avm1Handler=r,n.avmStage=o},n.prototype.getAlign=function(){return this.avmStage.align},n.prototype.setAlign=function(t){this.avmStage.align=t},n.prototype.getDisplayState=function(){return this.avmStage.displayState},n.prototype.setDisplayState=function(t){this.avmStage.displayState=t},n.prototype.getFullScreenSourceRect=function(){return e.release||console.log("not implemented AVM1Stage.getFullScreenSourceRect"),null},n.prototype.setFullScreenSourceRect=function(t){e.release||console.log("not implemented AVM1Stage.setFullScreenSourceRect")},n.prototype.getHeight=function(){return this.avmStage.stageHeight},n.prototype.getScaleMode=function(){return this.avmStage.scaleMode},n.prototype.setScaleMode=function(t){this.avmStage.scaleMode=t},n.prototype.getShowMenu=function(){return e.release||console.log("not implemented AVM1Stage.getShowMenu"),null},n.prototype.setShowMenu=function(t){e.release||console.log("not implemented AVM1Stage.setShowMenu")},n.prototype.getWidth=function(){return this.avmStage.stageWidth},n}(d);function I(t){return t instanceof B?t.as3BitmapData:null}var V,B=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._linkedBillboards=[],e._isSymbolSource=!1,e}return u(e,t),e.createAVM1Class=function(t){return wn(t,!0,e,["loadBitmap"],["height#","rectangle#","transparent#","width#","applyFilter","clone","colorTransform","compare","copyChannel","copyPixels","dispose","draw","fillRect","floodFill","generateFilterRect","getColorBoundsRect","getPixel","getPixel32","hitTest","merge","noise","paletteMap","perlinNoise","pixelDissolve","scroll","setPixel","setPixel32","threshold"],null,e.prototype.avm1Constructor)},e.prototype.getBillboard=function(t,e){var n=a.MaterialManager.getMaterialForBitmap(this.adaptee),r=new o.Billboard(n,t,e);return this._linkedBillboards.push(r),r},Object.defineProperty(e.prototype,"as3BitmapData",{get:function(){return this.adaptee},enumerable:!1,configurable:!0}),e.prototype.avm1Constructor=function(t,e,n,r){t=ze(this.context,t),e=ze(this.context,e),n=arguments.length<3||We(this.context,n),r=arguments.length<4?4294967295:Ke(this.context,r),isNaN(t*e)||t*e==0||(this.adaptee=o.SceneImage2D.getImage(t,e,n,r,!1,F.avmStage.view.stage))},e.fromAS3BitmapData=function(t,n){var o=new e(t);return o.alPrototype=t.globals.BitmapData.alGetPrototypeProperty(),o.adaptee=n,o},e.loadBitmap=function(t,r){r=Je(t,r);for(var a,s=i.AssetLibrary.getBundle(),l=0,c=Object.keys(s._assetDictionary);l<c.length;l++){var u=c[l];if(a=s.getAsset(r,u))break}if(!a||!a.isAsset(n.BitmapImage2D))return console.warn("[AVM1 BitmapData] Missing bitmap:",r),null;var p=o.SceneImage2D.getImage(a.width,a.height,a.transparent,null,null,F.avmStage.view.stage);p.copyPixels(a,p.rect,new i.Point(0,0));var h=new e(t);return h.alPrototype=t.globals.BitmapData.alGetPrototypeProperty(),h.adaptee=p,h._isSymbolSource=!0,h},e.prototype.getHeight=function(){return this.adaptee?this.adaptee.height:0},e.prototype.getRectangle=function(){var t=this.adaptee;return t?new w(this.context,0,0,t.width,t.height):new w(this.context,0,0,0,0)},e.prototype.getTransparent=function(){return!this.adaptee||this.adaptee.transparent},e.prototype.getWidth=function(){return this.adaptee?this.adaptee.width:0},e.prototype.applyFilter=function(t,e,n,o){return console.warn("[avm1/AVM1BitmapData] - applyFilter not implemented"),0},e.prototype.clone=function(){var t=new e(this.context);return t.alPrototype=this.context.globals.BitmapData.alGetPrototypeProperty(),t.adaptee=this.adaptee?this.adaptee.clone():null,t._isSymbolSource=this._isSymbolSource,t},e.prototype.colorTransform=function(t,e){var n=_(t),o=M(e);this.adaptee.colorTransform(n,o)},e.prototype.compare=function(t){return t instanceof e&&(console.warn("[avm1/AVM1BitmapData] - compare not implemented"),!0)},e.prototype.copyChannel=function(t,e,n,o,r){var i=t.as3BitmapData;if(this.adaptee&&i){var a=_(e),s=v(n);o=nn(this.context,o),r=nn(this.context,r),this.adaptee.copyChannel(i,a,s,o,r)}},e.prototype.copyPixels=function(t,e,n,o,r,i){if(t){var a=this.adaptee,s=t.as3BitmapData;if(this.adaptee&&s){var l=_(e),c=v(n),u=o?o.as3BitmapData:null,p=r?v(r):null;i=We(this.context,i),a.copyPixels(s,l,c,u,p,i)}}else console.warn("[AVM1BitmapData::copyPixels] Empty source!")},e.prototype.dispose=function(){if(this.adaptee){for(var t=0,e=this._linkedBillboards;t<e.length;t++){var n=e[t];n.parent&&n.parent.removeChild(n)}this._linkedBillboards=[],this._isSymbolSource||this.adaptee.dispose(),this.adaptee=null}},e.prototype.draw=function(t,e,n,o,r,i){if(this.adaptee)if(t){var a=t;if("string"!=typeof t||(a=this.context.resolveTarget(t))){var s=a.adaptee,l=e?D(e):null,c=n?M(n):null,u=r?_(r):null;o=(o="number"==typeof o?yn[o]:en(this.context,o))||null,i=We(this.context,i),a._locked=!0,this.as3BitmapData.draw(s,l,c,o,u,i),a._locked=!1}else console.warn("[AVM1BitmapData::draw] Source ".concat(t," not resolved!"))}else console.warn("[AVM1BitmapData::draw] Empty source!")},e.prototype.fillRect=function(t,e){if(this.adaptee){var n=_(t);e=Ke(this.context,e),this.as3BitmapData.fillRect(n,e)}},e.prototype.floodFill=function(t,e,n){t=nn(this.context,t),e=nn(this.context,e),n=Ke(this.context,n),this.as3BitmapData.floodFill(t,e,n)},e.prototype.generateFilterRect=function(t,e){console.warn("[avm1/AVM1BitmapData] - generateFilterRect not implemented")},e.prototype.getColorBoundsRect=function(t,e,n){var o;if(void 0===n&&(n=!0),this.adaptee){t=Ke(this.context,t)>>>0,e=Ke(this.context,e)>>>0,n=We(this.context,n);var r=null===(o=this.as3BitmapData)||void 0===o?void 0:o.getColorBoundsRect(t,e,n);return r?new w(this.context,r.x,r.y,r.width,r.height):null}},e.prototype.getPixel=function(t,e){return this.adaptee?this.adaptee.getPixel(t,e):0},e.prototype.getPixel32=function(t,e){return this.adaptee?this.adaptee.getPixel32(t,e):0},e.prototype.hitTest=function(t,e,n,o,r){return console.warn("[avm1/AVM1BitmapData] - hitTest not implemented"),!1},e.prototype.merge=function(t,e,n,o,r,i,a){var s=t.as3BitmapData;if(this.adaptee&&s){var l=_(e),c=v(n);o=Ke(this.context,o),r=Ke(this.context,r),i=Ke(this.context,i),a=Ke(this.context,a),this.as3BitmapData.merge(s,l,c,o,r,i,a)}},e.prototype.noise=function(t,e,n,o,r){t=Ke(this.context,t),e=arguments.length<2?0:Ke(this.context,e),n=arguments.length<3?255:Ke(this.context,n),o=arguments.length<4?7:Ke(this.context,o),r=!(arguments.length<5)&&We(this.context,r),console.warn("[avm1/AVM1BitmapData] - noise not implemented")},e.prototype.paletteMap=function(t,e,n,o,r,i,a){console.warn("[avm1/AVM1BitmapData] - paletteMap not implemented")},e.prototype.perlinNoise=function(t,e,n,o,r,i,a,s,l){t=nn(this.context,t),e=nn(this.context,e),n=nn(this.context,n),o=nn(this.context,o),r=We(this.context,r),i=We(this.context,i),a=void 0===a?7:nn(this.context,a),s=We(this.context,s),console.warn("[avm1/AVM1BitmapData] - perlinNoise not implemented")},e.prototype.pixelDissolve=function(t,e,n,o,r,i){var a=_(e);return o=arguments.length<4?0:Ke(this.context,o),r=arguments.length<5?a.width*a.height/30:Ke(this.context,r),i=arguments.length<6?0:Ke(this.context,i),console.warn("[avm1/AVM1BitmapData] - pixelDissolve not implemented"),0},e.prototype.scroll=function(t,e){if(t=0|nn(this.context,t),e=0|nn(this.context,e),(t||e)&&this.adaptee){var n=this.as3BitmapData;n.copyPixels(n,n.rect,new i.Point(t,e),null,null,!1)}},e.prototype.setPixel=function(t,e,n){this.adaptee&&(t=nn(this.context,t),e=nn(this.context,e),n=Ke(this.context,n),this.adaptee.setPixel(t,e,n))},e.prototype.setPixel32=function(t,e,n){this.adaptee&&(t=nn(this.context,t),e=nn(this.context,e),n=Ke(this.context,n),this.adaptee.setPixel32(t,e,n))},e.prototype.threshold=function(t,e,n,o,r,i,a,s){var l=this.as3BitmapData,c=t.as3BitmapData;if(this.adaptee&&c){var u=_(e),p=v(n);return o=en(this.context,o),r=Ke(this.context,r)>>>0,i=arguments.length<6?0:Ke(this.context,i),a=arguments.length<7?4294967295:Ke(this.context,a),s=!(arguments.length<8)&&We(this.context,s),l.threshold(c,u,p,o,r,i,a,s),0}},e}(d);!function(t){t[t._x=0]="_x",t[t._y=1]="_y",t[t._xscale=2]="_xscale",t[t._yscale=3]="_yscale",t[t._currentframe=4]="_currentframe",t[t._totalframes=5]="_totalframes",t[t._alpha=6]="_alpha",t[t._visible=7]="_visible",t[t._width=8]="_width",t[t._height=9]="_height",t[t._rotation=10]="_rotation",t[t._target=11]="_target",t[t._framesloaded=12]="_framesloaded",t[t._name=13]="_name",t[t._droptarget=14]="_droptarget",t[t._url=15]="_url",t[t._highquality=16]="_highquality",t[t._focusrect=17]="_focusrect",t[t._soundbuftime=18]="_soundbuftime",t[t._quality=19]="_quality",t[t._xmouse=20]="_xmouse",t[t._ymouse=21]="_ymouse"}(V||(V={}));var G,R,U,j,H=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return u(n,t),n.createAVM1Class=function(t){var e=["align#","blockIndent#","bold#","bullet#","color#","font#","getTextExtent","indent#","italic#","kerning#","leading#","leftMargin#","letterSpacing#","rightMargin#","size#","tabStops#","target#","adaptee#","underline#","url#"],o=wn(t,!0,n,[],e,null,n.prototype.avm1Constructor),r=o.alGetPrototypeProperty(),i=null;return e.forEach((function(t){"#"===t[t.length-1]&&(t=t.slice(0,-1)),(i=r.alGetOwnProperty(t)).flags&=-2,r.alSetOwnProperty(t,i)})),o},n.createFromNative=function(t,e){var o=t.globals.TextFormat,r=new n(t);return r.alPrototype=o.alGetPrototypeProperty(),r.adaptee=e,r},n.prototype.alPut=function(e,n){"font"==e&&this.setFont(n),t.prototype.alPut.call(this,e,n)},n.prototype.avm1Constructor=function(t,e,n,r,i,a,s,l,c,u,p,h,d){var f=this.context;t=null==t?null:Je(f,t),e=null==e?null:ze(f,e),n=null==n?null:ze(f,n),r=null==r?null:We(f,r),i=null==i?null:We(f,i),a=null==a?null:We(f,a),s=null==s?null:Je(f,s),l=null==l?null:Je(f,l),c=null==c?null:Je(f,c),u=null==u?null:ze(f,u),p=null==p?null:ze(f,p),h=null==h?null:ze(f,h),d=null==d?null:ze(f,d);var v=new o.TextFormat(t,e,n,r,i,a,s,l,c,u,p,h,d);this.adaptee=v},n.alInitStatic=function(t){var e=new o.TextField;e.multiline=!0,this._measureTextField=e},n.prototype.getAdaptee=function(){return this.adaptee.id},n.prototype.setAdaptee=function(t){},n.prototype.getAlign=function(){return this.adaptee.align},n.prototype.setAlign=function(t){var e=Je(this.context,t);""==e&&(e="center"),this.adaptee.align=e},n.prototype.getBlockIndent=function(){return e.notImplemented("AVM1TextFormat.getBlockIndent"),this.adaptee.blockIndent},n.prototype.setBlockIndent=function(t){e.notImplemented("AVM1TextFormat.setBlockIndent"),this.adaptee.blockIndent=ze(this.context,t)},n.prototype.getBold=function(){return this.adaptee.bold},n.prototype.setBold=function(t){this.adaptee.bold=We(this.context,t)},n.prototype.getBullet=function(){return e.notImplemented("AVM1TextFormat.getBullet"),this.adaptee.bullet},n.prototype.setBullet=function(t){e.notImplemented("AVM1TextFormat.setBullet"),this.adaptee.bullet=We(this.context,t)},n.prototype.getColor=function(){return this.adaptee.color},n.prototype.setColor=function(t){this.adaptee.color=ze(this.context,t)},n.prototype.getFont=function(){return this.adaptee.font_name},n.prototype.setFont=function(t){this.adaptee.font_name=Je(this.context,t)},n.prototype.getIndent=function(){return this.adaptee.indent},n.prototype.setIndent=function(t){this.adaptee.indent=ze(this.context,t)},n.prototype.getItalic=function(){return this.adaptee.italic},n.prototype.setItalic=function(t){this.adaptee.italic=We(this.context,t)},n.prototype.getKerning=function(){return e.notImplemented("AVM1TextFormat.getKerning"),this.adaptee.kerning},n.prototype.setKerning=function(t){e.notImplemented("AVM1TextFormat.setKerning"),this.adaptee.kerning=We(this.context,t)},n.prototype.getLeading=function(){return this.adaptee.leading},n.prototype.setLeading=function(t){this.adaptee.leading=ze(this.context,t)},n.prototype.getLeftMargin=function(){return this.adaptee.leftMargin},n.prototype.setLeftMargin=function(t){this.adaptee.leftMargin=ze(this.context,t)},n.prototype.getLetterSpacing=function(){return this.adaptee.letterSpacing},n.prototype.setLetterSpacing=function(t){this.adaptee.letterSpacing=ze(this.context,t)},n.prototype.getRightMargin=function(){return this.adaptee.rightMargin},n.prototype.setRightMargin=function(t){this.adaptee.rightMargin=ze(this.context,t)},n.prototype.getSize=function(){return this.adaptee.size},n.prototype.setSize=function(t){this.adaptee.size=ze(this.context,t)},n.prototype.getTabStops=function(){return e.notImplemented("AVM1TextFormat.getTabStops"),new De(this.context,this.adaptee.tabStops)},n.prototype.setTabStops=function(t){var e=this;this.adaptee.tabStops=De.mapToJSArray(t,(function(t){return ze(e.context,t)}))},n.prototype.getTarget=function(){return e.notImplemented("AVM1TextFormat.getTarget"),""},n.prototype.setTarget=function(t){e.notImplemented("AVM1TextFormat.setTarget")},n.prototype.getTextExtent=function(t,o){e.notImplemented("AVM1TextFormat.getTextExtent"),t=en(this.context,t),o=+o;var r=this.context.getStaticState(n)._measureTextField;!isNaN(o)&&o>0?(r.width=o+4,r.wordWrap=!0):r.wordWrap=!1,r.newTextFormat=this.adaptee,r.text=t;var i=$e(this.context),a=r.textWidth,s=r.textHeight;return i.alPut("width",a),i.alPut("height",s),i.alPut("textFieldWidth",a+4),i.alPut("textFieldHeight",s+4),i},n.prototype.getUnderline=function(){return e.notImplemented("AVM1TextFormat.getUnderline"),this.adaptee.underline},n.prototype.setUnderline=function(t){e.notImplemented("AVM1TextFormat.setUnderline"),this.adaptee.underline=We(this.context,t)},n.prototype.getUrl=function(){return e.notImplemented("AVM1TextFormat.getUrl"),this.adaptee.url},n.prototype.setUrl=function(t){e.notImplemented("AVM1TextFormat.setUrl"),this.adaptee.url=Je(this.context,t)},n}(d),X=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return u(e,t),e.createAVM1Class=function(t){return wn(t,!1,e,["BACKSPACE","CAPSLOCK","CONTROL","DELETEKEY","DOWN","END","ENTER","ESCAPE","HOME","INSERT","LEFT","PGDN","PGUP","RIGHT","SHIFT","SPACE","TAB","UP","isDown","getCode","getAscii"],[])},e.alInitStatic=function(t){this._keyStates=[],this._lastKeyCode=0},e.bindStage=function(t,n,o,r){e.keyDownDelegate&&r.removeEventListener("keydown",e.keyDownDelegate),e.keyUpDelegate&&r.removeEventListener("keyup",e.keyUpDelegate),e.keyDownDelegate=function(o){var r=t.getStaticState(e);r._lastKeyCode=o.keyCode,r._keyStates[o.keyCode]=1,sn(n,"broadcastMessage",["onKeyDown"])},e.keyUpDelegate=function(o){var r=t.getStaticState(e);r._lastKeyCode=o.keyCode,delete r._keyStates[o.keyCode],sn(n,"broadcastMessage",["onKeyUp"])},r.addEventListener("keydown",e.keyDownDelegate),r.addEventListener("keyup",e.keyUpDelegate)},e.isDown=function(t,n){return!!t.getStaticState(e)._keyStates[n]},e.getCode=function(t){return t.getStaticState(e)._lastKeyCode},e.getAscii=function(t){return t.getStaticState(e)._lastKeyCode},e.BACKSPACE=8,e.CAPSLOCK=20,e.CONTROL=17,e.DELETEKEY=46,e.DOWN=40,e.END=35,e.ENTER=13,e.ESCAPE=27,e.HOME=36,e.INSERT=45,e.LEFT=37,e.PGDN=34,e.PGUP=33,e.RIGHT=39,e.SHIFT=16,e.SPACE=32,e.TAB=9,e.UP=38,e.keyDownDelegate=null,e.keyUpDelegate=null,e}(d),q=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return u(e,t),e.createAVM1Class=function(t){return wn(t,!0,e,[],["matrix#","concatenatedMatrix#","colorTransform#","pixelBounds#"],null,e.prototype.avm1Constructor)},Object.defineProperty(e.prototype,"as3Transform",{get:function(){return this._targetAwayObject.transform},enumerable:!1,configurable:!0}),e.prototype.avm1Constructor=function(t){this._target=this.context.resolveTarget(t),this._targetAwayObject=this._target.adaptee},e.prototype.getMatrix=function(){var t=this._targetAwayObject.transform;return O.fromAS3Matrix(this.context,t.matrix)},e.prototype.setMatrix=function(t){this._targetAwayObject.transform.matrix=D(t)},e.prototype.getConcatenatedMatrix=function(){var t=this._target.node.getMatrix3D()._rawData;return new O(this.context,t[0],t[1],t[4],t[5],t[12],t[13])},e.prototype.getColorTransform=function(){var t=this._targetAwayObject.transform;return P.fromAwayColorTransform(this.context,t.colorTransform)},e.prototype.setColorTransform=function(t){this._targetAwayObject.transform.colorTransform=M(t)},e.prototype.getPixelBounds=function(){var t=this._targetAwayObject.transform;return w.fromAS3Rectangle(this.context,t.pixelBounds)},e}(d);!function(t){t[t.DISPLACEMENT=8]="DISPLACEMENT"}(j||(j={}));var W=p(p({},e.FilterType),j),z=((G={})[W.DROPSHADOW]="DropShadowFilter",G[W.GLOW]="GlowFilter",G[W.BEVEL]="BevelFilter",G[W.GRADIENTGLOW]="GradientGlowFilter",G[W.GRADIENTBEVEL]="GradientBevelFilter",G[W.BLUR]="BlurFilter",G[W.CONVOLUTION]="ConvolutionFilter",G[W.COLORMATRIX]="ColorMatrixFilter",G[W.DISPLACEMENT]="DisplacementMapFilter",G),Y=((R={})[W.DROPSHADOW]="dropShadow",R[W.GLOW]="glow",R[W.BEVEL]="bevel",R[W.GRADIENTGLOW]="gradientGlow",R[W.GRADIENTBEVEL]="bevel",R[W.BLUR]="blur",R[W.CONVOLUTION]="convolution",R[W.COLORMATRIX]="colorMatrix",R[W.DISPLACEMENT]="displacement",R),K=((U={})[W.DROPSHADOW]=function(t){var e=t.colors[0]>>>8,n=(255&t.colors[0])/255,o=180*t.angle/Math.PI,r=!t.compositeSource;return{distance:t.distance,angle:o,color:e,alpha:n,blurX:t.blurX,blurY:t.blurY,strength:t.strength,quality:t.quality,inner:t.inner,knockout:t.knockout,hideObject:r}},U[W.GLOW]=function(t){return{color:t.colors[0]>>>8,alpha:(255&t.colors[0])/255,blurX:t.blurX,blurY:t.blurY,strength:t.strength,quality:t.quality,inner:t.inner,knockout:t.knockout}},U[W.BEVEL]=function(t){var e=t.colors[0]>>>8,n=(255&t.colors[0])/255,o=t.colors[1]>>>8,r=(255&t.colors[1])/255,i="outer";t.onTop?i="full":t.inner&&(i="inner");var a=180*t.angle/Math.PI;return{distance:t.distance,angle:a,highlightColor:e,highlightAlpha:n,shadowColor:o,shadowAlpha:r,blurX:t.blurX,blurY:t.blurY,strength:t.strength,quality:t.quality,type:i,knockout:t.knockout}},U[W.GRADIENTGLOW]=function(t){return null},U[W.GRADIENTBEVEL]=function(t){return null},U[W.BLUR]=function(t){return{blurX:t.blurX,blurY:t.blurY,quality:t.quality}},U[W.CONVOLUTION]=function(t){return null},U[W.COLORMATRIX]=function(t){return{matrix:t.matrix}},U),J=function(t){function e(e){var n=t.call(this,e)||this;return n.alSetOwnPrototypeProperty(new Q(e,n)),n}return u(e,t),e.prototype.alConstruct=function(t){var e=new d(this.context);return e.alPrototype=this.alGetPrototypeProperty(),e},e}(f),Q=function(t){function e(e,n){var o=t.call(this,e)||this;return hn(o,{constructor:{value:n,writable:!0},clone:{value:o.clone,writable:!0}}),o}return u(e,t),e.prototype.clone=function(){var t=new d(this.context);return t.alPrototype=this.alGetPrototypeProperty(),t},e}(d);function Z(t,e,n,o,r){var i=z[o];function a(e){var n=new d(t);n.alPrototype=l;for(var o=0;o<r.length;o+=2)n.alPut(r[o],tt(t,e[r[o]],r[o+1]));return n}var s=n.alGetPrototypeProperty(),l=Object.create(Q.prototype);d.call(l,t),l.alPrototype=s;var c=Object.create(J.prototype);f.call(c,t),c.alSetOwnPrototypeProperty(l),c.alConstruct=function(e){var n=new d(t);if(n.alPrototype=l,e)for(var o=0;o<e.length;o++)n.alPut(r[o<<1],e[o]);return n},hn(l,{constructor:{value:c,writable:!0},clone:{value:function(){var e=new d(t);e.alPrototype=l;for(var n=0;n<r.length;n+=2)e.alPut(r[n],this.alGet(r[n]));return e},writable:!0}}),l.asFilterConverter={toAS3Filter:function(e){for(var n={filterName:i,filterType:o},a=0;a<r.length;a+=2){var s=e.alGet(r[a]);void 0!==s&&(n[r[a]]=$(t,s,r[a+1]))}return n},fromAS3Filter:a,fromTimelineFilter:function(t){var e=K[t.type],n=e?e(t):null;if(n)return a(n);console.warn("[AVM1 FILTER] Timeline filter converter not implemented for:",Y[t.type])},getAS3Class:null},e.alPut(i,c)}function $(t,e,n){switch(n){case"String":return Je(t,e);case"Boolean":return We(t,e);case"Number":return ze(t,e);case"Numbers":var o=[];if(e)for(var r=0,i=e.alGet("length");r<i;r++)o[r]=ze(t,e.alGet(r));return o;case"BitmapData":return I(e);case"Point":return v(e);default:console.warn("Filters","Unknown convertFromAS3Field type: "+n)}}function tt(t,e,n){switch(n){case"String":case"Boolean":case"Number":return e;case"Numbers":var o=[];if(e)for(var r=0,i=e.length;r<i;r++)o[r]=+e[r];return new De(t,o);case"BitmapData":return B.fromAS3BitmapData(t,e);case"Point":return g.fromAS3Point(t,e);default:console.warn("Filters","Unknown convertFromAS3Field type: "+n)}}function et(t,e){for(var n=e?e.alPrototype:null;n&&!n.asFilterConverter;)n=n.alPrototype;if(n)return n.asFilterConverter.toAS3Filter(e)}var nt=e.shumwayOptions.register(new e.OptionSet("AVM1")),ot=nt.register(new e.Option("t1","traceAvm1","boolean",!1,"trace AVM1 execution")),rt=nt.register(new e.Option("e1","errorsAvm1","boolean",!1,"fail on AVM1 warnings and errors")),it=nt.register(new e.Option("w1","warningsAvm1","boolean",!0,"Emit messages for AVM1 warnings and errors")),at=nt.register(new e.Option("ha1","nohangAvm1","boolean",!1,"disable fail on AVM1 hang")),st=nt.register(new e.Option("ca1","compileAvm1","boolean",!0,"compiles AVM1 code")),lt=nt.register(new e.Option("da1","debugAvm1","boolean",!1,"allows AVM1 code debugging"));nt.register(new e.Option("cw1","wellknownAvm1","boolean",!0,"Replaces well-known actions patterns instead of compilation"));var ct=i.ConfigManager.instance.addStore("avm1",{LAZY_EVENT_REGISTERING:!0}),ut=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.hasSwappedDepth=!1,e.dynamicallyCreated=!1,e._filterModels=[],e._eventsMap={},e._eventsListeners={},e._eventHandlers={},e.enabled=!0,e}return u(n,t),n.CompleteEventRegistering=function(){var t=n.LAZY_EVENT_QUEUE.slice();n.LAZY_EVENT_QUEUE=[];for(var e=0,o=t;e<o.length;e++){var r=o[e];r.target.addEventListenerOnAdapter(r.event,r.callback,r.eventProps)}},n.prototype.initAVM1SymbolInstance=function(t,n){this.constructorHasRun=!0,this.avmType="symbol",this.scriptRefsToChilds={},this._mouseListenerCount=0,this._avm1Context=t,this._ownProperties=Object.create(null),this._eventsListeners={},this._prototype=null;var o=this;this._onClipEventsListeners=[];var r=new h(131,null,{alCall:function(t,e){return o.alPrototype}},{alCall:function(t,e){o.alPrototype=e[0]}});this.alSetOwnProperty("__proto__",r),e.release||e.assert(n),this.adaptee=n,this.node=F.avmStage.view.getNode(this.adaptee);var i=n.name,a=this.get_parent();i&&a&&a._addChildName(this,i)},n.prototype.bindEvents=function(t,e){var n=this;this._events=t,t.forEach((function(t){var e=t.propertyName=n.context.normalizeName(t.propertyName);n._eventsMap[e]=t,n._updateEvent(t)}))},n.prototype.unbindEvents=function(){var t=this;this._events.forEach((function(e){t.context.unregisterEventPropertyObserver(e.propertyName,t),t._removeEventListener(e)})),this._events=null,this._eventsMap=null,this._eventsListeners=null,this._eventHandlers=null},n.prototype._initEventsHandlers=function(){throw"AVM1SymbolBase _initEventsHandlers must be overwritten"},n.prototype.updateEventByPropName=function(t){this._eventsMap?this._eventsMap[t]&&this._updateEvent(this._eventsMap[t]):(this._initEventsHandlers(),console.log("no eventsmap set",this))},n.prototype.updateAllEvents=function(){this._events.forEach((function(t){this._updateEvent(t)}),this)},n.prototype._updateEvent=function(t){!function(t,e,n){if(e.alHasProperty(n)&&e.alGet(n)instanceof f)return!0;if(e.alHasProperty(n)&&e._ownProperties[n]&&e._ownProperties[n].value)return!0;var o=e.alGet("_listeners");if(!(o instanceof De))return!1;return o.value.some((function(t){return t instanceof d&&t.alHasProperty(n)}))}(this.context,this,t.propertyName)?this._removeEventListener(t):this._addEventListener(t)},n.prototype._addOnClipEventListener=function(t,e,o){void 0===e&&(e=null),void 0===o&&(o=null),t.propertyName=this.context.normalizeName(t.propertyName),!this.enabled&&t.allowDisable||(ct.LAZY_EVENT_REGISTERING?n.LAZY_EVENT_QUEUE.push({target:this,event:t,callback:e,eventProps:o}):(this._onClipEventsListeners.push({event:t,callback:e}),this.addEventListenerOnAdapter(t,e,o)))},n.prototype._addEventListener=function(t,e){void 0===e&&(e=null);var n=this.context.normalizeName(t.propertyName),o=this._eventsListeners[n];o&&this.removeEventListenerOnAdapter(t,o);var r=this;o||(o=e||function(){var t=null;"onchanged"==n.toLowerCase()&&(t=[r]),function(t,e,n,o){void 0===o&&(o=null);var r=e.alGet(n);r instanceof f&&("onenterframe"==n.toLowerCase()&&(r.isOnEnter=!0),t.executeFunction(r,e,o));var i=e.alGet("_listeners");if(i instanceof De){var a=null;i.value.forEach((function(r){r instanceof d&&(a=r.alGet(n))instanceof f&&t.executeFunction(a,e,o)}))}}(this.context,this,n,t)}.bind(this),this._eventsListeners[n]=o,this._eventHandlers[n]=t),!this.enabled&&t.allowDisable||this.addEventListenerOnAdapter(t,o)},n.prototype.addEventListenerOnAdapter=function(t,e,n){(void 0===n&&(n=null),t.stageEvent)?this.context.globals.Stage.avm1Handler.addAVM1EventListener(this.adaptee,t.eventName,e,n):(this.adaptee.addEventListener(t.eventName,e),this._updateMouseEnabled(t,!0))},n.prototype.removeEventListenerOnAdapter=function(t,e){if(t.stageEvent){var n=this.context.globals.Stage.avm1Handler;n&&n.removeAVM1EventListener(this.adaptee,t.eventName,e)}else this.adaptee.removeEventListener(t.eventName,e),this._updateMouseEnabled(t,!1)},n.prototype._updateMouseEnabled=function(t,e){this.adaptee.isAVMScene||t.isMouse&&(e?(this._mouseListenerCount++,this.adaptee.mouseEnabled=!0,this.adaptee.mouseChildren=!1):(this._mouseListenerCount--,this._mouseListenerCount<=0&&(this._mouseListenerCount=0,this.adaptee.mouseEnabled=!1,this.adaptee.mouseChildren=!0)))},n.prototype.freeFromScript=function(){for(var e in