@equinor/esv-intersection 1.7.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +2 -2
- package/dist/index.js +2 -2
- package/dist/index.umd.js +89 -104
- package/dist/interfaces.d.ts +2 -4
- package/dist/layers/CasingLayer.d.ts +1 -1
- package/dist/layers/CementLayer.d.ts +1 -1
- package/dist/layers/CompletionLayer.d.ts +4 -2
- package/dist/layers/GeomodelLayerV2.d.ts +3 -3
- package/dist/layers/HoleSizeLayer.d.ts +1 -1
- package/dist/layers/WellboreBaseComponentLayer.d.ts +2 -2
- package/dist/layers/base/PixiLayer.d.ts +12 -2
- package/package.json +8 -8
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("url")):"function"==typeof define&&define.amd?define(["exports","url"],factory):factory((global="undefined"!=typeof globalThis?globalThis:global||self).Vector2={},global.url)}(this,(function(exports,url){"use strict";
|
|
1
|
+
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("url")):"function"==typeof define&&define.amd?define(["exports","url"],factory):factory((global="undefined"!=typeof globalThis?globalThis:global||self).Vector2={},global.url$1)}(this,(function(exports,url$1){"use strict";
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -12,50 +12,51 @@
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */function __extends(d,b){if("function"!=typeof b&&null!==b)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var __assign=function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)};function __awaiter(thisArg,_arguments,P,generator){return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P((function(resolve){resolve(value)}))).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))}function __generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}function __spreadArray(to,from){for(var i=0,il=from.length,j=to.length;i<il;i++,j++)to[j]=from[i];return to}var defaultOptions={order:1,layerOpacity:1,interactive:!1},Layer=function(){function Layer(id,options){this._referenceSystem=null,this._interactive=!1,this._id=id||"layer-"+Math.floor(1e3*Math.random());var opts=options||defaultOptions;this._order=opts.order||1,this._options=__assign({},opts),this.loading=!1,this._element=null,this._opacity=opts.layerOpacity||1,this._visible=!0,this._interactive=opts.interactive||!1,options&&options.data&&this.setData(options.data),this._referenceSystem=options&&options.referenceSystem,this.onMount=this.onMount.bind(this),this.onUnmount=this.onUnmount.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onRescale=this.onRescale.bind(this),this.onResize=this.onResize.bind(this),this.onOrderChanged=this.onOrderChanged.bind(this),this.onOpacityChanged=this.onOpacityChanged.bind(this),this.setVisibility=this.setVisibility.bind(this)}return Object.defineProperty(Layer.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"element",{get:function(){return this._element},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"options",{get:function(){return this._options},set:function(options){this._options=options},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"isLoading",{get:function(){return this.loading},set:function(loading){this.loading=loading},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"opacity",{get:function(){return this._opacity},set:function(opacity){this._opacity=opacity,this.onOpacityChanged(opacity)},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"order",{get:function(){return this._order},set:function(order){this._order=order,this.onOrderChanged(order)},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"interactive",{get:function(){return this._interactive},set:function(shouldBeInteractive){this._interactive=shouldBeInteractive,this.onInteractivityChanged(shouldBeInteractive)},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"referenceSystem",{get:function(){return this._referenceSystem},set:function(referenceSystem){this._referenceSystem=referenceSystem},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"data",{get:function(){return this.getData()},set:function(data){this.setData(data)},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"isVisible",{get:function(){return this._visible},enumerable:!1,configurable:!0}),Layer.prototype.getData=function(){return this._data},Layer.prototype.setData=function(data){this._data=data,this.element&&this.onUpdate({data:data})},Layer.prototype.clearData=function(includeReferenceSystem){void 0===includeReferenceSystem&&(includeReferenceSystem=!0),this._data=null,includeReferenceSystem&&(this.referenceSystem=null),this.onUpdate({})},Layer.prototype.setVisibility=function(visible){this._visible=visible},Layer.prototype.onMount=function(event){this._element=event.elm,this._options.onMount&&this._options.onMount(event,this)},Layer.prototype.onUnmount=function(event){this._options.onUnmount&&this._options.onUnmount(event,this)},Layer.prototype.onResize=function(event){this._options.onResize&&this._options.onResize(event,this)},Layer.prototype.onUpdate=function(event){event.data&&(this._data=event.data),this._options.onUpdate&&this._options.onUpdate(event,this)},Layer.prototype.onRescale=function(event){this.optionsRescale(event)},Layer.prototype.optionsRescale=function(event){this._options.onRescale&&this._options.onRescale(event,this)},Layer.prototype.onOpacityChanged=function(opacity){},Layer.prototype.onOrderChanged=function(order){},Layer.prototype.onInteractivityChanged=function(interactive){},Layer}(),CanvasLayer=function(_super){function CanvasLayer(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(CanvasLayer,_super),CanvasLayer.prototype.onOpacityChanged=function(opacity){this.canvas&&this.updateStyle()},CanvasLayer.prototype.onOrderChanged=function(order){this.canvas&&this.updateStyle()},CanvasLayer.prototype.onInteractivityChanged=function(interactive){this.canvas&&this.updateStyle()},CanvasLayer.prototype.setVisibility=function(visible){_super.prototype.setVisibility.call(this,visible),this.canvas&&this.updateStyle(visible)},CanvasLayer.prototype.updateStyle=function(visible){var visibility=visible||this.isVisible?"visible":"hidden",interactive=this.interactive?"auto":"none";this.canvas.setAttribute("style","position:absolute;pointer-events:"+interactive+";z-index:"+this.order+";opacity:"+this.opacity+";visibility:"+visibility)},CanvasLayer.prototype.onMount=function(event){_super.prototype.onMount.call(this,event);var canvas,elm=event.elm,width=event.width||parseInt(elm.getAttribute("width"),10)||200,height=event.height||parseInt(elm.getAttribute("height"),10)||300;this.elm=elm,this.canvas||(canvas=document.createElement("canvas"),this.canvas=canvas,event.elm.appendChild(canvas)),this.canvas.setAttribute("id",""+this.id),this.canvas.setAttribute("width",width+"px"),this.canvas.setAttribute("height",height+"px"),this.canvas.setAttribute("class","canvas-layer"),this.updateStyle(),this.ctx=this.canvas.getContext("2d")},CanvasLayer.prototype.onUnmount=function(){_super.prototype.onUnmount.call(this),this.canvas.remove(),this.canvas=null},CanvasLayer.prototype.onResize=function(event){var ctx=this.ctx,width=event.width,height=event.height;ctx.canvas.setAttribute("width",width+"px"),ctx.canvas.setAttribute("height",height+"px")},CanvasLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event)},CanvasLayer.prototype.resetTransform=function(){this.ctx.resetTransform()},CanvasLayer.prototype.setTransform=function(event){this.resetTransform();var flippedX=event.xBounds[0]>event.xBounds[1],flippedY=event.yBounds[0]>event.yBounds[1];this.ctx.translate(event.xScale(0),event.yScale(0)),this.ctx.scale(event.xRatio*(flippedX?-1:1),event.yRatio*(flippedY?-1:1))},CanvasLayer.prototype.clearCanvas=function(){var ctx=this.ctx,canvas=this.canvas;ctx.save(),ctx.resetTransform(),ctx.clearRect(0,0,canvas.width,canvas.height),ctx.restore()},CanvasLayer}(Layer),defaultOptions$1={minorColor:"lightgray",majorColor:"gray",minorWidth:.25,majorWidth:.75},GridLayer=function(_super){function GridLayer(id,options){var _this=_super.call(this,id,options)||this;return _this._offsetX=0,_this._offsetY=0,_this.options=__assign(__assign({},_this.options),options||defaultOptions$1),_this.render=_this.render.bind(_this),_this}return __extends(GridLayer,_super),GridLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.render(event)},GridLayer.prototype.onRescale=function(event){_super.prototype.onRescale.call(this,event),this.render(event)},GridLayer.prototype.render=function(event){var ctx=this.ctx,_a=this.options,minorWidth=_a.minorWidth,minorColor=_a.minorColor,majorWidth=_a.majorWidth,majorColor=_a.majorColor;if(ctx&&(this.clearCanvas(),event.xScale||event.yScale)){var xScale=event.xScale.copy(),yScale=event.yScale.copy(),xDomain=xScale.domain(),yDomain=yScale.domain(),offsetX=this.offsetX,offsetY=this.offsetY;xScale.domain([xDomain[0]-offsetX,xDomain[1]-offsetX]),yScale.domain([yDomain[0]-offsetY,yDomain[1]-offsetY]);var _b=xScale.range(),rx1=_b[0],rx2=_b[1],_c=yScale.range(),ry1=_c[0],ry2=_c[1];ctx.lineWidth=minorWidth||.25,ctx.strokeStyle=minorColor||"lightgray";var xminticks=this.mapMinorTicks(xScale.ticks()),yminticks=this.mapMinorTicks(yScale.ticks());this.renderTicksX(xScale,xminticks,ry1,ry2),this.renderTicksY(yScale,yminticks,rx1,rx2),ctx.lineWidth=majorWidth||.75,ctx.strokeStyle=majorColor||"gray",this.renderTicksX(xScale,xScale.ticks(),ry1,ry2),this.renderTicksY(yScale,yScale.ticks(),rx1,rx2),ctx.restore()}},GridLayer.prototype.renderTicksX=function(xscale,xticks,ry1,ry2){var _this=this;xticks.forEach((function(tx){var x=xscale(tx);_this.ctx.beginPath(),_this.ctx.moveTo(x,ry1),_this.ctx.lineTo(x,ry2),_this.ctx.stroke()}))},GridLayer.prototype.renderTicksY=function(yscale,yticks,rx1,rx2){var _this=this;yticks.forEach((function(ty){var y=yscale(ty);_this.ctx.beginPath(),_this.ctx.moveTo(rx1,y),_this.ctx.lineTo(rx2,y),_this.ctx.stroke()}))},GridLayer.prototype.mapMinorTicks=function(ticks){var xminticks=[];return ticks.length>=2&&(xminticks=ticks.map((function(v){return v+(ticks[1]-ticks[0])/2}))).pop(),xminticks},Object.defineProperty(GridLayer.prototype,"offsetX",{get:function(){return this._offsetX},set:function(offset){this._offsetX=offset},enumerable:!1,configurable:!0}),Object.defineProperty(GridLayer.prototype,"offsetY",{get:function(){return this._offsetY},set:function(offset){this._offsetY=offset},enumerable:!1,configurable:!0}),GridLayer}(CanvasLayer),xhtml="http://www.w3.org/1999/xhtml",namespaces={svg:"http://www.w3.org/2000/svg",xhtml:xhtml,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function namespace(name){var prefix=name+="",i=prefix.indexOf(":");return i>=0&&"xmlns"!==(prefix=name.slice(0,i))&&(name=name.slice(i+1)),namespaces.hasOwnProperty(prefix)?{space:namespaces[prefix],local:name}:name}function creatorInherit(name){return function(){var document=this.ownerDocument,uri=this.namespaceURI;return uri===xhtml&&document.documentElement.namespaceURI===xhtml?document.createElement(name):document.createElementNS(uri,name)}}function creatorFixed(fullname){return function(){return this.ownerDocument.createElementNS(fullname.space,fullname.local)}}function creator(name){var fullname=namespace(name);return(fullname.local?creatorFixed:creatorInherit)(fullname)}function none(){}function selector(selector){return null==selector?none:function(){return this.querySelector(selector)}}function array(x){return null==x?[]:Array.isArray(x)?x:Array.from(x)}function empty(){return[]}function selectorAll(selector){return null==selector?empty:function(){return this.querySelectorAll(selector)}}function matcher(selector){return function(){return this.matches(selector)}}function childMatcher(selector){return function(node){return node.matches(selector)}}var find=Array.prototype.find;function childFirst(){return this.firstElementChild}var filter=Array.prototype.filter;function children(){return Array.from(this.children)}function sparse(update){return new Array(update.length)}function EnterNode(parent,datum){this.ownerDocument=parent.ownerDocument,this.namespaceURI=parent.namespaceURI,this._next=null,this._parent=parent,this.__data__=datum}function constant(x){return function(){return x}}function bindIndex(parent,group,enter,update,exit,data){for(var node,i=0,groupLength=group.length,dataLength=data.length;i<dataLength;++i)(node=group[i])?(node.__data__=data[i],update[i]=node):enter[i]=new EnterNode(parent,data[i]);for(;i<groupLength;++i)(node=group[i])&&(exit[i]=node)}function bindKey(parent,group,enter,update,exit,data,key){var i,node,keyValue,nodeByKeyValue=new Map,groupLength=group.length,dataLength=data.length,keyValues=new Array(groupLength);for(i=0;i<groupLength;++i)(node=group[i])&&(keyValues[i]=keyValue=key.call(node,node.__data__,i,group)+"",nodeByKeyValue.has(keyValue)?exit[i]=node:nodeByKeyValue.set(keyValue,node));for(i=0;i<dataLength;++i)keyValue=key.call(parent,data[i],i,data)+"",(node=nodeByKeyValue.get(keyValue))?(update[i]=node,node.__data__=data[i],nodeByKeyValue.delete(keyValue)):enter[i]=new EnterNode(parent,data[i]);for(i=0;i<groupLength;++i)(node=group[i])&&nodeByKeyValue.get(keyValues[i])===node&&(exit[i]=node)}function datum(node){return node.__data__}function arraylike(data){return"object"==typeof data&&"length"in data?data:Array.from(data)}function ascending(a,b){return a<b?-1:a>b?1:a>=b?0:NaN}function attrRemove(name){return function(){this.removeAttribute(name)}}function attrRemoveNS(fullname){return function(){this.removeAttributeNS(fullname.space,fullname.local)}}function attrConstant(name,value){return function(){this.setAttribute(name,value)}}function attrConstantNS(fullname,value){return function(){this.setAttributeNS(fullname.space,fullname.local,value)}}function attrFunction(name,value){return function(){var v=value.apply(this,arguments);null==v?this.removeAttribute(name):this.setAttribute(name,v)}}function attrFunctionNS(fullname,value){return function(){var v=value.apply(this,arguments);null==v?this.removeAttributeNS(fullname.space,fullname.local):this.setAttributeNS(fullname.space,fullname.local,v)}}function defaultView(node){return node.ownerDocument&&node.ownerDocument.defaultView||node.document&&node||node.defaultView}function styleRemove(name){return function(){this.style.removeProperty(name)}}function styleConstant(name,value,priority){return function(){this.style.setProperty(name,value,priority)}}function styleFunction(name,value,priority){return function(){var v=value.apply(this,arguments);null==v?this.style.removeProperty(name):this.style.setProperty(name,v,priority)}}function styleValue(node,name){return node.style.getPropertyValue(name)||defaultView(node).getComputedStyle(node,null).getPropertyValue(name)}function propertyRemove(name){return function(){delete this[name]}}function propertyConstant(name,value){return function(){this[name]=value}}function propertyFunction(name,value){return function(){var v=value.apply(this,arguments);null==v?delete this[name]:this[name]=v}}function classArray(string){return string.trim().split(/^|\s+/)}function classList(node){return node.classList||new ClassList(node)}function ClassList(node){this._node=node,this._names=classArray(node.getAttribute("class")||"")}function classedAdd(node,names){for(var list=classList(node),i=-1,n=names.length;++i<n;)list.add(names[i])}function classedRemove(node,names){for(var list=classList(node),i=-1,n=names.length;++i<n;)list.remove(names[i])}function classedTrue(names){return function(){classedAdd(this,names)}}function classedFalse(names){return function(){classedRemove(this,names)}}function classedFunction(names,value){return function(){(value.apply(this,arguments)?classedAdd:classedRemove)(this,names)}}function textRemove(){this.textContent=""}function textConstant(value){return function(){this.textContent=value}}function textFunction(value){return function(){var v=value.apply(this,arguments);this.textContent=null==v?"":v}}function htmlRemove(){this.innerHTML=""}function htmlConstant(value){return function(){this.innerHTML=value}}function htmlFunction(value){return function(){var v=value.apply(this,arguments);this.innerHTML=null==v?"":v}}function raise(){this.nextSibling&&this.parentNode.appendChild(this)}function lower(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function constantNull(){return null}function remove(){var parent=this.parentNode;parent&&parent.removeChild(this)}function selection_cloneShallow(){var clone=this.cloneNode(!1),parent=this.parentNode;return parent?parent.insertBefore(clone,this.nextSibling):clone}function selection_cloneDeep(){var clone=this.cloneNode(!0),parent=this.parentNode;return parent?parent.insertBefore(clone,this.nextSibling):clone}function parseTypenames(typenames){return typenames.trim().split(/^|\s+/).map((function(t){var name="",i=t.indexOf(".");return i>=0&&(name=t.slice(i+1),t=t.slice(0,i)),{type:t,name:name}}))}function onRemove(typename){return function(){var on=this.__on;if(on){for(var o,j=0,i=-1,m=on.length;j<m;++j)o=on[j],typename.type&&o.type!==typename.type||o.name!==typename.name?on[++i]=o:this.removeEventListener(o.type,o.listener,o.options);++i?on.length=i:delete this.__on}}}function onAdd(typename,value,options){return function(){var o,on=this.__on,listener=function(listener){return function(event){listener.call(this,event,this.__data__)}}(value);if(on)for(var j=0,m=on.length;j<m;++j)if((o=on[j]).type===typename.type&&o.name===typename.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=listener,o.options=options),void(o.value=value);this.addEventListener(typename.type,listener,options),o={type:typename.type,name:typename.name,value:value,listener:listener,options:options},on?on.push(o):this.__on=[o]}}function dispatchEvent(node,type,params){var window=defaultView(node),event=window.CustomEvent;"function"==typeof event?event=new event(type,params):(event=window.document.createEvent("Event"),params?(event.initEvent(type,params.bubbles,params.cancelable),event.detail=params.detail):event.initEvent(type,!1,!1)),node.dispatchEvent(event)}function dispatchConstant(type,params){return function(){return dispatchEvent(this,type,params)}}function dispatchFunction(type,params){return function(){return dispatchEvent(this,type,params.apply(this,arguments))}}EnterNode.prototype={constructor:EnterNode,appendChild:function(child){return this._parent.insertBefore(child,this._next)},insertBefore:function(child,next){return this._parent.insertBefore(child,next)},querySelector:function(selector){return this._parent.querySelector(selector)},querySelectorAll:function(selector){return this._parent.querySelectorAll(selector)}},ClassList.prototype={add:function(name){this._names.indexOf(name)<0&&(this._names.push(name),this._node.setAttribute("class",this._names.join(" ")))},remove:function(name){var i=this._names.indexOf(name);i>=0&&(this._names.splice(i,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(name){return this._names.indexOf(name)>=0}};var root=[null];function Selection(groups,parents){this._groups=groups,this._parents=parents}function selection(){return new Selection([[document.documentElement]],root)}function select(selector){return"string"==typeof selector?new Selection([[document.querySelector(selector)]],[document.documentElement]):new Selection([[selector]],root)}function pointer(event,node){if(event=function(event){let sourceEvent;for(;sourceEvent=event.sourceEvent;)event=sourceEvent;return event}(event),void 0===node&&(node=event.currentTarget),node){var svg=node.ownerSVGElement||node;if(svg.createSVGPoint){var point=svg.createSVGPoint();return point.x=event.clientX,point.y=event.clientY,[(point=point.matrixTransform(node.getScreenCTM().inverse())).x,point.y]}if(node.getBoundingClientRect){var rect=node.getBoundingClientRect();return[event.clientX-rect.left-node.clientLeft,event.clientY-rect.top-node.clientTop]}}return[event.pageX,event.pageY]}Selection.prototype=selection.prototype={constructor:Selection,select:function(select){"function"!=typeof select&&(select=selector(select));for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j<m;++j)for(var node,subnode,group=groups[j],n=group.length,subgroup=subgroups[j]=new Array(n),i=0;i<n;++i)(node=group[i])&&(subnode=select.call(node,node.__data__,i,group))&&("__data__"in node&&(subnode.__data__=node.__data__),subgroup[i]=subnode);return new Selection(subgroups,this._parents)},selectAll:function(select){select="function"==typeof select?function(select){return function(){return array(select.apply(this,arguments))}}(select):selectorAll(select);for(var groups=this._groups,m=groups.length,subgroups=[],parents=[],j=0;j<m;++j)for(var node,group=groups[j],n=group.length,i=0;i<n;++i)(node=group[i])&&(subgroups.push(select.call(node,node.__data__,i,group)),parents.push(node));return new Selection(subgroups,parents)},selectChild:function(match){return this.select(null==match?childFirst:function(match){return function(){return find.call(this.children,match)}}("function"==typeof match?match:childMatcher(match)))},selectChildren:function(match){return this.selectAll(null==match?children:function(match){return function(){return filter.call(this.children,match)}}("function"==typeof match?match:childMatcher(match)))},filter:function(match){"function"!=typeof match&&(match=matcher(match));for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j<m;++j)for(var node,group=groups[j],n=group.length,subgroup=subgroups[j]=[],i=0;i<n;++i)(node=group[i])&&match.call(node,node.__data__,i,group)&&subgroup.push(node);return new Selection(subgroups,this._parents)},data:function(value,key){if(!arguments.length)return Array.from(this,datum);var bind=key?bindKey:bindIndex,parents=this._parents,groups=this._groups;"function"!=typeof value&&(value=constant(value));for(var m=groups.length,update=new Array(m),enter=new Array(m),exit=new Array(m),j=0;j<m;++j){var parent=parents[j],group=groups[j],groupLength=group.length,data=arraylike(value.call(parent,parent&&parent.__data__,j,parents)),dataLength=data.length,enterGroup=enter[j]=new Array(dataLength),updateGroup=update[j]=new Array(dataLength),exitGroup=exit[j]=new Array(groupLength);bind(parent,group,enterGroup,updateGroup,exitGroup,data,key);for(var previous,next,i0=0,i1=0;i0<dataLength;++i0)if(previous=enterGroup[i0]){for(i0>=i1&&(i1=i0+1);!(next=updateGroup[i1])&&++i1<dataLength;);previous._next=next||null}}return(update=new Selection(update,parents))._enter=enter,update._exit=exit,update},enter:function(){return new Selection(this._enter||this._groups.map(sparse),this._parents)},exit:function(){return new Selection(this._exit||this._groups.map(sparse),this._parents)},join:function(onenter,onupdate,onexit){var enter=this.enter(),update=this,exit=this.exit();return"function"==typeof onenter?(enter=onenter(enter))&&(enter=enter.selection()):enter=enter.append(onenter+""),null!=onupdate&&(update=onupdate(update))&&(update=update.selection()),null==onexit?exit.remove():onexit(exit),enter&&update?enter.merge(update).order():update},merge:function(context){for(var selection=context.selection?context.selection():context,groups0=this._groups,groups1=selection._groups,m0=groups0.length,m1=groups1.length,m=Math.min(m0,m1),merges=new Array(m0),j=0;j<m;++j)for(var node,group0=groups0[j],group1=groups1[j],n=group0.length,merge=merges[j]=new Array(n),i=0;i<n;++i)(node=group0[i]||group1[i])&&(merge[i]=node);for(;j<m0;++j)merges[j]=groups0[j];return new Selection(merges,this._parents)},selection:function(){return this},order:function(){for(var groups=this._groups,j=-1,m=groups.length;++j<m;)for(var node,group=groups[j],i=group.length-1,next=group[i];--i>=0;)(node=group[i])&&(next&&4^node.compareDocumentPosition(next)&&next.parentNode.insertBefore(node,next),next=node);return this},sort:function(compare){function compareNode(a,b){return a&&b?compare(a.__data__,b.__data__):!a-!b}compare||(compare=ascending);for(var groups=this._groups,m=groups.length,sortgroups=new Array(m),j=0;j<m;++j){for(var node,group=groups[j],n=group.length,sortgroup=sortgroups[j]=new Array(n),i=0;i<n;++i)(node=group[i])&&(sortgroup[i]=node);sortgroup.sort(compareNode)}return new Selection(sortgroups,this._parents).order()},call:function(){var callback=arguments[0];return arguments[0]=this,callback.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var groups=this._groups,j=0,m=groups.length;j<m;++j)for(var group=groups[j],i=0,n=group.length;i<n;++i){var node=group[i];if(node)return node}return null},size:function(){let size=0;for(const node of this)++size;return size},empty:function(){return!this.node()},each:function(callback){for(var groups=this._groups,j=0,m=groups.length;j<m;++j)for(var node,group=groups[j],i=0,n=group.length;i<n;++i)(node=group[i])&&callback.call(node,node.__data__,i,group);return this},attr:function(name,value){var fullname=namespace(name);if(arguments.length<2){var node=this.node();return fullname.local?node.getAttributeNS(fullname.space,fullname.local):node.getAttribute(fullname)}return this.each((null==value?fullname.local?attrRemoveNS:attrRemove:"function"==typeof value?fullname.local?attrFunctionNS:attrFunction:fullname.local?attrConstantNS:attrConstant)(fullname,value))},style:function(name,value,priority){return arguments.length>1?this.each((null==value?styleRemove:"function"==typeof value?styleFunction:styleConstant)(name,value,null==priority?"":priority)):styleValue(this.node(),name)},property:function(name,value){return arguments.length>1?this.each((null==value?propertyRemove:"function"==typeof value?propertyFunction:propertyConstant)(name,value)):this.node()[name]},classed:function(name,value){var names=classArray(name+"");if(arguments.length<2){for(var list=classList(this.node()),i=-1,n=names.length;++i<n;)if(!list.contains(names[i]))return!1;return!0}return this.each(("function"==typeof value?classedFunction:value?classedTrue:classedFalse)(names,value))},text:function(value){return arguments.length?this.each(null==value?textRemove:("function"==typeof value?textFunction:textConstant)(value)):this.node().textContent},html:function(value){return arguments.length?this.each(null==value?htmlRemove:("function"==typeof value?htmlFunction:htmlConstant)(value)):this.node().innerHTML},raise:function(){return this.each(raise)},lower:function(){return this.each(lower)},append:function(name){var create="function"==typeof name?name:creator(name);return this.select((function(){return this.appendChild(create.apply(this,arguments))}))},insert:function(name,before){var create="function"==typeof name?name:creator(name),select=null==before?constantNull:"function"==typeof before?before:selector(before);return this.select((function(){return this.insertBefore(create.apply(this,arguments),select.apply(this,arguments)||null)}))},remove:function(){return this.each(remove)},clone:function(deep){return this.select(deep?selection_cloneDeep:selection_cloneShallow)},datum:function(value){return arguments.length?this.property("__data__",value):this.node().__data__},on:function(typename,value,options){var i,t,typenames=parseTypenames(typename+""),n=typenames.length;if(!(arguments.length<2)){for(on=value?onAdd:onRemove,i=0;i<n;++i)this.each(on(typenames[i],value,options));return this}var on=this.node().__on;if(on)for(var o,j=0,m=on.length;j<m;++j)for(i=0,o=on[j];i<n;++i)if((t=typenames[i]).type===o.type&&t.name===o.name)return o.value},dispatch:function(type,params){return this.each(("function"==typeof params?dispatchFunction:dispatchConstant)(type,params))},[Symbol.iterator]:function*(){for(var groups=this._groups,j=0,m=groups.length;j<m;++j)for(var node,group=groups[j],i=0,n=group.length;i<n;++i)(node=group[i])&&(yield node)}};var SVGLayer=function(_super){function SVGLayer(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(SVGLayer,_super),SVGLayer.prototype.onMount=function(event){_super.prototype.onMount.call(this,event);var elm=event.elm,width=event.width||parseInt(elm.getAttribute("width"),10)||200,height=event.height||parseInt(elm.getAttribute("height"),10)||300;this.elm||(this.elm=select(elm).append("svg"),this.elm.attr("id",""+this.id),this.elm.attr("class","svg-layer")),this.elm.attr("height",height).attr("width",width);var interactive=this.interactive?"auto":"none";this.elm.style("position","absolute").style("pointer-events",interactive).style("opacity",this.opacity).style("z-index",this.order)},SVGLayer.prototype.onUnmount=function(){_super.prototype.onUnmount.call(this),this.elm.remove(),this.elm=null},SVGLayer.prototype.onResize=function(event){this.elm&&(_super.prototype.onResize.call(this,event),this.elm.attr("height",event.height).attr("width",event.width))},SVGLayer.prototype.setVisibility=function(visible){_super.prototype.setVisibility.call(this,visible),this.elm&&this.elm.attr("visibility",visible?"visible":"hidden")},SVGLayer.prototype.onOpacityChanged=function(opacity){this.elm&&this.elm.style("opacity",opacity)},SVGLayer.prototype.onOrderChanged=function(order){this.elm&&this.elm.style("z-index",order)},SVGLayer.prototype.onInteractivityChanged=function(shouldBeInteractive){if(this.elm){var interactive=shouldBeInteractive?"auto":"none";this.elm.style("pointer-events",interactive)}},SVGLayer}(Layer),HTMLLayer=function(_super){function HTMLLayer(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(HTMLLayer,_super),HTMLLayer.prototype.onMount=function(event){_super.prototype.onMount.call(this,event);var elm=event.elm,width=event.width||parseInt(elm.getAttribute("width"),10)||200,height=event.height||parseInt(elm.getAttribute("height"),10)||300;this.elm||(this.elm=select(elm).append("div"),this.elm.attr("id",""+this.id),this.elm.attr("class","html-layer"));var interactive=this.interactive?"auto":"none";this.elm.style("position","absolute").style("height",height+"px").style("width",width+"px").style("opacity",this.opacity).style("overflow","hidden").style("pointer-events",interactive).style("z-index",this.order)},HTMLLayer.prototype.onUnmount=function(){_super.prototype.onUnmount.call(this),this.elm.remove(),this.elm=null},HTMLLayer.prototype.onResize=function(event){this.elm&&(_super.prototype.onResize.call(this,event),this.elm.style("height",event.height+"px").style("width",event.width+"px"))},HTMLLayer.prototype.setVisibility=function(visible){_super.prototype.setVisibility.call(this,visible),this.elm&&this.elm.attr("visibility",visible?"visible":"hidden")},HTMLLayer.prototype.onOpacityChanged=function(opacity){this.elm&&this.elm.style("opacity",opacity)},HTMLLayer.prototype.onOrderChanged=function(order){this.elm&&this.elm.style("z-index",order)},HTMLLayer.prototype.onInteractivityChanged=function(shouldBeInteractive){if(this.elm){var interactive=shouldBeInteractive?"auto":"none";this.elm.style("pointer-events",interactive)}},HTMLLayer}(Layer),pi=Math.PI,tau=2*pi,tauEpsilon=tau-1e-6;function Path(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function path(){return new Path}function constant$1(x){return function(){return x}}Path.prototype=path.prototype={constructor:Path,moveTo:function(x,y){this._+="M"+(this._x0=this._x1=+x)+","+(this._y0=this._y1=+y)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(x,y){this._+="L"+(this._x1=+x)+","+(this._y1=+y)},quadraticCurveTo:function(x1,y1,x,y){this._+="Q"+ +x1+","+ +y1+","+(this._x1=+x)+","+(this._y1=+y)},bezierCurveTo:function(x1,y1,x2,y2,x,y){this._+="C"+ +x1+","+ +y1+","+ +x2+","+ +y2+","+(this._x1=+x)+","+(this._y1=+y)},arcTo:function(x1,y1,x2,y2,r){x1=+x1,y1=+y1,x2=+x2,y2=+y2,r=+r;var x0=this._x1,y0=this._y1,x21=x2-x1,y21=y2-y1,x01=x0-x1,y01=y0-y1,l01_2=x01*x01+y01*y01;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=x1)+","+(this._y1=y1);else if(l01_2>1e-6)if(Math.abs(y01*x21-y21*x01)>1e-6&&r){var x20=x2-x0,y20=y2-y0,l21_2=x21*x21+y21*y21,l20_2=x20*x20+y20*y20,l21=Math.sqrt(l21_2),l01=Math.sqrt(l01_2),l=r*Math.tan((pi-Math.acos((l21_2+l01_2-l20_2)/(2*l21*l01)))/2),t01=l/l01,t21=l/l21;Math.abs(t01-1)>1e-6&&(this._+="L"+(x1+t01*x01)+","+(y1+t01*y01)),this._+="A"+r+","+r+",0,0,"+ +(y01*x20>x01*y20)+","+(this._x1=x1+t21*x21)+","+(this._y1=y1+t21*y21)}else this._+="L"+(this._x1=x1)+","+(this._y1=y1);else;},arc:function(x,y,r,a0,a1,ccw){x=+x,y=+y,ccw=!!ccw;var dx=(r=+r)*Math.cos(a0),dy=r*Math.sin(a0),x0=x+dx,y0=y+dy,cw=1^ccw,da=ccw?a0-a1:a1-a0;if(r<0)throw new Error("negative radius: "+r);null===this._x1?this._+="M"+x0+","+y0:(Math.abs(this._x1-x0)>1e-6||Math.abs(this._y1-y0)>1e-6)&&(this._+="L"+x0+","+y0),r&&(da<0&&(da=da%tau+tau),da>tauEpsilon?this._+="A"+r+","+r+",0,1,"+cw+","+(x-dx)+","+(y-dy)+"A"+r+","+r+",0,1,"+cw+","+(this._x1=x0)+","+(this._y1=y0):da>1e-6&&(this._+="A"+r+","+r+",0,"+ +(da>=pi)+","+cw+","+(this._x1=x+r*Math.cos(a1))+","+(this._y1=y+r*Math.sin(a1))))},rect:function(x,y,w,h){this._+="M"+(this._x0=this._x1=+x)+","+(this._y0=this._y1=+y)+"h"+ +w+"v"+ +h+"h"+-w+"Z"},toString:function(){return this._}};function Linear(context){this._context=context}function curveLinear(context){return new Linear(context)}function x(p){return p[0]}function y(p){return p[1]}function line(x$1,y$1){var defined=constant$1(!0),context=null,curve=curveLinear,output=null;function line(data){var i,d,buffer,n=(data=function(x){return"object"==typeof x&&"length"in x?x:Array.from(x)}(data)).length,defined0=!1;for(null==context&&(output=curve(buffer=path())),i=0;i<=n;++i)!(i<n&&defined(d=data[i],i,data))===defined0&&((defined0=!defined0)?output.lineStart():output.lineEnd()),defined0&&output.point(+x$1(d,i,data),+y$1(d,i,data));if(buffer)return output=null,buffer+""||null}return x$1="function"==typeof x$1?x$1:void 0===x$1?x:constant$1(x$1),y$1="function"==typeof y$1?y$1:void 0===y$1?y:constant$1(y$1),line.x=function(_){return arguments.length?(x$1="function"==typeof _?_:constant$1(+_),line):x$1},line.y=function(_){return arguments.length?(y$1="function"==typeof _?_:constant$1(+_),line):y$1},line.defined=function(_){return arguments.length?(defined="function"==typeof _?_:constant$1(!!_),line):defined},line.curve=function(_){return arguments.length?(curve=_,null!=context&&(output=curve(context)),line):curve},line.context=function(_){return arguments.length?(null==_?context=output=null:output=curve(context=_),line):context},line}function noop(){}function point(that,x,y){that._context.bezierCurveTo((2*that._x0+that._x1)/3,(2*that._y0+that._y1)/3,(that._x0+2*that._x1)/3,(that._y0+2*that._y1)/3,(that._x0+4*that._x1+x)/6,(that._y0+4*that._y1+y)/6)}function Basis(context){this._context=context}function curveBasis(context){return new Basis(context)}function BasisClosed(context){this._context=context}function curveBasisClosed(context){return new BasisClosed(context)}function Bundle(context,beta){this._basis=new Basis(context),this._beta=beta}Linear.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(x,y){switch(x=+x,y=+y,this._point){case 0:this._point=1,this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;default:this._context.lineTo(x,y)}}},Basis.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:point(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(x,y){switch(x=+x,y=+y,this._point){case 0:this._point=1,this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:point(this,x,y)}this._x0=this._x1,this._x1=x,this._y0=this._y1,this._y1=y}},BasisClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(x,y){switch(x=+x,y=+y,this._point){case 0:this._point=1,this._x2=x,this._y2=y;break;case 1:this._point=2,this._x3=x,this._y3=y;break;case 2:this._point=3,this._x4=x,this._y4=y,this._context.moveTo((this._x0+4*this._x1+x)/6,(this._y0+4*this._y1+y)/6);break;default:point(this,x,y)}this._x0=this._x1,this._x1=x,this._y0=this._y1,this._y1=y}},Bundle.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var x=this._x,y=this._y,j=x.length-1;if(j>0)for(var t,x0=x[0],y0=y[0],dx=x[j]-x0,dy=y[j]-y0,i=-1;++i<=j;)t=i/j,this._basis.point(this._beta*x[i]+(1-this._beta)*(x0+t*dx),this._beta*y[i]+(1-this._beta)*(y0+t*dy));this._x=this._y=null,this._basis.lineEnd()},point:function(x,y){this._x.push(+x),this._y.push(+y)}};var curveBundle=function custom(beta){function bundle(context){return 1===beta?new Basis(context):new Bundle(context,beta)}return bundle.beta=function(beta){return custom(+beta)},bundle}(.85);function point$1(that,x,y){that._context.bezierCurveTo(that._x1+that._k*(that._x2-that._x0),that._y1+that._k*(that._y2-that._y0),that._x2+that._k*(that._x1-x),that._y2+that._k*(that._y1-y),that._x2,that._y2)}function Cardinal(context,tension){this._context=context,this._k=(1-tension)/6}Cardinal.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:point$1(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(x,y){switch(x=+x,y=+y,this._point){case 0:this._point=1,this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2,this._x1=x,this._y1=y;break;case 2:this._point=3;default:point$1(this,x,y)}this._x0=this._x1,this._x1=this._x2,this._x2=x,this._y0=this._y1,this._y1=this._y2,this._y2=y}};var curveCardinal=function custom(tension){function cardinal(context){return new Cardinal(context,tension)}return cardinal.tension=function(tension){return custom(+tension)},cardinal}(0);function CatmullRom(context,alpha){this._context=context,this._alpha=alpha}CatmullRom.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(x,y){if(x=+x,y=+y,this._point){var x23=this._x2-x,y23=this._y2-y;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(x23*x23+y23*y23,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;break;case 2:this._point=3;default:!function(that,x,y){var x1=that._x1,y1=that._y1,x2=that._x2,y2=that._y2;if(that._l01_a>1e-12){var a=2*that._l01_2a+3*that._l01_a*that._l12_a+that._l12_2a,n=3*that._l01_a*(that._l01_a+that._l12_a);x1=(x1*a-that._x0*that._l12_2a+that._x2*that._l01_2a)/n,y1=(y1*a-that._y0*that._l12_2a+that._y2*that._l01_2a)/n}if(that._l23_a>1e-12){var b=2*that._l23_2a+3*that._l23_a*that._l12_a+that._l12_2a,m=3*that._l23_a*(that._l23_a+that._l12_a);x2=(x2*b+that._x1*that._l23_2a-x*that._l12_2a)/m,y2=(y2*b+that._y1*that._l23_2a-y*that._l12_2a)/m}that._context.bezierCurveTo(x1,y1,x2,y2,that._x2,that._y2)}(this,x,y)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=x,this._y0=this._y1,this._y1=this._y2,this._y2=y}};var curveCatmullRom=function custom(alpha){function catmullRom(context){return alpha?new CatmullRom(context,alpha):new Cardinal(context,0)}return catmullRom.alpha=function(alpha){return custom(+alpha)},catmullRom}(.5);function sign(x){return x<0?-1:1}function slope3(that,x2,y2){var h0=that._x1-that._x0,h1=x2-that._x1,s0=(that._y1-that._y0)/(h0||h1<0&&-0),s1=(y2-that._y1)/(h1||h0<0&&-0),p=(s0*h1+s1*h0)/(h0+h1);return(sign(s0)+sign(s1))*Math.min(Math.abs(s0),Math.abs(s1),.5*Math.abs(p))||0}function slope2(that,t){var h=that._x1-that._x0;return h?(3*(that._y1-that._y0)/h-t)/2:t}function point$3(that,t0,t1){var x0=that._x0,y0=that._y0,x1=that._x1,y1=that._y1,dx=(x1-x0)/3;that._context.bezierCurveTo(x0+dx,y0+dx*t0,x1-dx,y1-dx*t1,x1,y1)}function MonotoneX(context){this._context=context}function MonotoneY(context){this._context=new ReflectContext(context)}function ReflectContext(context){this._context=context}function monotoneX(context){return new MonotoneX(context)}function monotoneY(context){return new MonotoneY(context)}function Natural(context){this._context=context}function controlPoints(x){var i,m,n=x.length-1,a=new Array(n),b=new Array(n),r=new Array(n);for(a[0]=0,b[0]=2,r[0]=x[0]+2*x[1],i=1;i<n-1;++i)a[i]=1,b[i]=4,r[i]=4*x[i]+2*x[i+1];for(a[n-1]=2,b[n-1]=7,r[n-1]=8*x[n-1]+x[n],i=1;i<n;++i)m=a[i]/b[i-1],b[i]-=m,r[i]-=m*r[i-1];for(a[n-1]=r[n-1]/b[n-1],i=n-2;i>=0;--i)a[i]=(r[i]-a[i+1])/b[i];for(b[n-1]=(x[n]+a[n-1])/2,i=0;i<n-1;++i)b[i]=2*x[i+1]-a[i+1];return[a,b]}function curveNatural(context){return new Natural(context)}function Step(context,t){this._context=context,this._t=t}function curveStep(context){return new Step(context,.5)}function stepBefore(context){return new Step(context,0)}function stepAfter(context){return new Step(context,1)}MonotoneX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:point$3(this,this._t0,slope2(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(x,y){var t1=NaN;if(y=+y,(x=+x)!==this._x1||y!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;break;case 2:this._point=3,point$3(this,slope2(this,t1=slope3(this,x,y)),t1);break;default:point$3(this,this._t0,t1=slope3(this,x,y))}this._x0=this._x1,this._x1=x,this._y0=this._y1,this._y1=y,this._t0=t1}}},(MonotoneY.prototype=Object.create(MonotoneX.prototype)).point=function(x,y){MonotoneX.prototype.point.call(this,y,x)},ReflectContext.prototype={moveTo:function(x,y){this._context.moveTo(y,x)},closePath:function(){this._context.closePath()},lineTo:function(x,y){this._context.lineTo(y,x)},bezierCurveTo:function(x1,y1,x2,y2,x,y){this._context.bezierCurveTo(y1,x1,y2,x2,y,x)}},Natural.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var x=this._x,y=this._y,n=x.length;if(n)if(this._line?this._context.lineTo(x[0],y[0]):this._context.moveTo(x[0],y[0]),2===n)this._context.lineTo(x[1],y[1]);else for(var px=controlPoints(x),py=controlPoints(y),i0=0,i1=1;i1<n;++i0,++i1)this._context.bezierCurveTo(px[0][i0],py[0][i0],px[1][i0],py[1][i0],x[i1],y[i1]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(x,y){this._x.push(+x),this._y.push(+y)}},Step.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(x,y){switch(x=+x,y=+y,this._point){case 0:this._point=1,this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,y),this._context.lineTo(x,y);else{var x1=this._x*(1-this._t)+x*this._t;this._context.lineTo(x1,this._y),this._context.lineTo(x1,y)}}this._x=x,this._y=y}};var WellborepathLayer=function(_super){function WellborepathLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.options=__assign(__assign({},_this.options),options),_this.render=_this.render.bind(_this),_this}return __extends(WellborepathLayer,_super),WellborepathLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.render()},WellborepathLayer.prototype.onRescale=function(event){_super.prototype.onRescale.call(this,event),this.elm&&(this.rescaleEvent=event,this.render())},WellborepathLayer.prototype.render=function(){var _a=this.options,strokeWidth=_a.strokeWidth,stroke=_a.stroke;if(this.elm){this.elm.select("g").remove();var data=this.data||this.referenceSystem&&this.referenceSystem.projectedPath;data&&this.rescaleEvent&&this.elm.append("g").attr("class","well-path").append("path").attr("d",this.renderWellborePath(data)).attr("stroke-width",strokeWidth||"2px").attr("stroke",stroke||"red").attr("fill","none")}},WellborepathLayer.prototype.renderWellborePath=function(data){var curveFactory,_a=this.rescaleEvent,xScale=_a.xScale,yScale=_a.yScale,transformedData=data.map((function(d){return[xScale(d[0]),yScale(d[1])]})),_b=this.options,curveType=_b.curveType,tension=_b.tension;switch(curveType){default:case"curveCatmullRom":curveFactory=curveCatmullRom.alpha(tension||.7);break;case"curveLinear":curveFactory=curveLinear;break;case"curveBasis":curveFactory=curveBasis;break;case"curveBasisClosed":curveFactory=curveBasisClosed;break;case"curveBundle":curveFactory=curveBundle.beta(tension||1);break;case"curveCardinal":curveFactory=curveCardinal.tension(tension||.9);break;case"curveMonotoneX":curveFactory=monotoneX;break;case"curveMonotoneY":curveFactory=monotoneY;break;case"curveNatural":curveFactory=curveNatural;break;case"curveStep":curveFactory=curveStep;break;case"curveStepAfter":curveFactory=stepAfter;break;case"curveStepBefore":curveFactory=stepBefore}return line().curve(curveFactory)(transformedData)},WellborepathLayer}(SVGLayer),commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(fn,module){return fn(module={exports:{}},module.exports),module.exports}var promise=createCommonjsModule((function(module,exports){!function(global){var NativePromise=global.Promise,nativePromiseSupported=NativePromise&&"resolve"in NativePromise&&"reject"in NativePromise&&"all"in NativePromise&&"race"in NativePromise&&function(){var resolve;return new NativePromise((function(r){resolve=r})),"function"==typeof resolve}();exports?(exports.Promise=nativePromiseSupported?NativePromise:Promise,exports.Polyfill=Promise):nativePromiseSupported||(global.Promise=Promise);var NOOP=function(){};function isArray(value){return"[object Array]"===Object.prototype.toString.call(value)}var asyncTimer,asyncSetTimer="undefined"!=typeof setImmediate?setImmediate:setTimeout,asyncQueue=[];function asyncFlush(){for(var i=0;i<asyncQueue.length;i++)asyncQueue[i][0](asyncQueue[i][1]);asyncQueue=[],asyncTimer=!1}function asyncCall(callback,arg){asyncQueue.push([callback,arg]),asyncTimer||(asyncTimer=!0,asyncSetTimer(asyncFlush,0))}function invokeCallback(subscriber){var owner=subscriber.owner,settled=owner.state_,value=owner.data_,callback=subscriber[settled],promise=subscriber.then;if("function"==typeof callback){settled="fulfilled";try{value=callback(value)}catch(e){reject(promise,e)}}handleThenable(promise,value)||("fulfilled"===settled&&resolve(promise,value),"rejected"===settled&&reject(promise,value))}function handleThenable(promise,value){var resolved;try{if(promise===value)throw new TypeError("A promises callback cannot return that same promise.");if(value&&("function"==typeof value||"object"==typeof value)){var then=value.then;if("function"==typeof then)return then.call(value,(function(val){resolved||(resolved=!0,value!==val?resolve(promise,val):fulfill(promise,val))}),(function(reason){resolved||(resolved=!0,reject(promise,reason))})),!0}}catch(e){return resolved||reject(promise,e),!0}return!1}function resolve(promise,value){promise!==value&&handleThenable(promise,value)||fulfill(promise,value)}function fulfill(promise,value){"pending"===promise.state_&&(promise.state_="sealed",promise.data_=value,asyncCall(publishFulfillment,promise))}function reject(promise,reason){"pending"===promise.state_&&(promise.state_="sealed",promise.data_=reason,asyncCall(publishRejection,promise))}function publish(promise){var callbacks=promise.then_;promise.then_=void 0;for(var i=0;i<callbacks.length;i++)invokeCallback(callbacks[i])}function publishFulfillment(promise){promise.state_="fulfilled",publish(promise)}function publishRejection(promise){promise.state_="rejected",publish(promise)}function Promise(resolver){if("function"!=typeof resolver)throw new TypeError("Promise constructor takes a function argument");if(this instanceof Promise==!1)throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this.then_=[],function(resolver,promise){function rejectPromise(reason){reject(promise,reason)}try{resolver((function(value){resolve(promise,value)}),rejectPromise)}catch(e){rejectPromise(e)}}(resolver,this)}Promise.prototype={constructor:Promise,state_:"pending",then_:null,data_:void 0,then:function(onFulfillment,onRejection){var subscriber={owner:this,then:new this.constructor(NOOP),fulfilled:onFulfillment,rejected:onRejection};return"fulfilled"===this.state_||"rejected"===this.state_?asyncCall(invokeCallback,subscriber):this.then_.push(subscriber),subscriber.then},catch:function(onRejection){return this.then(null,onRejection)}},Promise.all=function(promises){if(!isArray(promises))throw new TypeError("You must pass an array to Promise.all().");return new this((function(resolve,reject){var results=[],remaining=0;function resolver(index){return remaining++,function(value){results[index]=value,--remaining||resolve(results)}}for(var promise,i=0;i<promises.length;i++)(promise=promises[i])&&"function"==typeof promise.then?promise.then(resolver(i),reject):results[i]=promise;remaining||resolve(results)}))},Promise.race=function(promises){if(!isArray(promises))throw new TypeError("You must pass an array to Promise.race().");return new this((function(resolve,reject){for(var promise,i=0;i<promises.length;i++)(promise=promises[i])&&"function"==typeof promise.then?promise.then(resolve,reject):resolve(promise)}))},Promise.resolve=function(value){return value&&"object"==typeof value&&value.constructor===this?value:new this((function(resolve){resolve(value)}))},Promise.reject=function(reason){return new this((function(resolve,reject){reject(reason)}))}}("undefined"!=typeof window?window:void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:commonjsGlobal)}));promise.Promise;var promise_2=promise.Polyfill,getOwnPropertySymbols=Object.getOwnPropertySymbols,hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;
|
|
15
|
+
***************************************************************************** */var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(d[p]=b[p])},extendStatics(d,b)};function __extends(d,b){if("function"!=typeof b&&null!==b)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t},__assign.apply(this,arguments)};function __awaiter(thisArg,_arguments,P,generator){return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P((function(resolve){resolve(value)}))).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))}function __generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}function __spreadArray(to,from){for(var i=0,il=from.length,j=to.length;i<il;i++,j++)to[j]=from[i];return to}var defaultOptions={order:1,layerOpacity:1,interactive:!1},Layer=function(){function Layer(id,options){this._referenceSystem=null,this._interactive=!1,this._id=id||"layer-"+Math.floor(1e3*Math.random());var opts=options||defaultOptions;this._order=opts.order||1,this._options=__assign({},opts),this.loading=!1,this._element=null,this._opacity=opts.layerOpacity||1,this._visible=!0,this._interactive=opts.interactive||!1,options&&options.data&&this.setData(options.data),this._referenceSystem=options&&options.referenceSystem,this.onMount=this.onMount.bind(this),this.onUnmount=this.onUnmount.bind(this),this.onUpdate=this.onUpdate.bind(this),this.onRescale=this.onRescale.bind(this),this.onResize=this.onResize.bind(this),this.onOrderChanged=this.onOrderChanged.bind(this),this.onOpacityChanged=this.onOpacityChanged.bind(this),this.setVisibility=this.setVisibility.bind(this)}return Object.defineProperty(Layer.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"element",{get:function(){return this._element},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"options",{get:function(){return this._options},set:function(options){this._options=options},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"isLoading",{get:function(){return this.loading},set:function(loading){this.loading=loading},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"opacity",{get:function(){return this._opacity},set:function(opacity){this._opacity=opacity,this.onOpacityChanged(opacity)},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"order",{get:function(){return this._order},set:function(order){this._order=order,this.onOrderChanged(order)},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"interactive",{get:function(){return this._interactive},set:function(shouldBeInteractive){this._interactive=shouldBeInteractive,this.onInteractivityChanged(shouldBeInteractive)},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"referenceSystem",{get:function(){return this._referenceSystem},set:function(referenceSystem){this._referenceSystem=referenceSystem},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"data",{get:function(){return this.getData()},set:function(data){this.setData(data)},enumerable:!1,configurable:!0}),Object.defineProperty(Layer.prototype,"isVisible",{get:function(){return this._visible},enumerable:!1,configurable:!0}),Layer.prototype.getData=function(){return this._data},Layer.prototype.setData=function(data){this._data=data,this.element&&this.onUpdate({data:data})},Layer.prototype.clearData=function(includeReferenceSystem){void 0===includeReferenceSystem&&(includeReferenceSystem=!0),this._data=null,includeReferenceSystem&&(this.referenceSystem=null),this.onUpdate({})},Layer.prototype.setVisibility=function(visible){this._visible=visible},Layer.prototype.onMount=function(event){this._element=event.elm,this._options.onMount&&this._options.onMount(event,this)},Layer.prototype.onUnmount=function(event){this._options.onUnmount&&this._options.onUnmount(event,this)},Layer.prototype.onResize=function(event){this._options.onResize&&this._options.onResize(event,this)},Layer.prototype.onUpdate=function(event){event.data&&(this._data=event.data),this._options.onUpdate&&this._options.onUpdate(event,this)},Layer.prototype.onRescale=function(event){this.optionsRescale(event)},Layer.prototype.optionsRescale=function(event){this._options.onRescale&&this._options.onRescale(event,this)},Layer.prototype.onOpacityChanged=function(opacity){},Layer.prototype.onOrderChanged=function(order){},Layer.prototype.onInteractivityChanged=function(interactive){},Layer}(),CanvasLayer=function(_super){function CanvasLayer(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(CanvasLayer,_super),CanvasLayer.prototype.onOpacityChanged=function(opacity){this.canvas&&this.updateStyle()},CanvasLayer.prototype.onOrderChanged=function(order){this.canvas&&this.updateStyle()},CanvasLayer.prototype.onInteractivityChanged=function(interactive){this.canvas&&this.updateStyle()},CanvasLayer.prototype.setVisibility=function(visible){_super.prototype.setVisibility.call(this,visible),this.canvas&&this.updateStyle(visible)},CanvasLayer.prototype.updateStyle=function(visible){var visibility=visible||this.isVisible?"visible":"hidden",interactive=this.interactive?"auto":"none";this.canvas.setAttribute("style","position:absolute;pointer-events:"+interactive+";z-index:"+this.order+";opacity:"+this.opacity+";visibility:"+visibility)},CanvasLayer.prototype.onMount=function(event){_super.prototype.onMount.call(this,event);var canvas,elm=event.elm,width=event.width||parseInt(elm.getAttribute("width"),10)||200,height=event.height||parseInt(elm.getAttribute("height"),10)||300;this.elm=elm,this.canvas||(canvas=document.createElement("canvas"),this.canvas=canvas,event.elm.appendChild(canvas)),this.canvas.setAttribute("id",""+this.id),this.canvas.setAttribute("width",width+"px"),this.canvas.setAttribute("height",height+"px"),this.canvas.setAttribute("class","canvas-layer"),this.updateStyle(),this.ctx=this.canvas.getContext("2d")},CanvasLayer.prototype.onUnmount=function(){_super.prototype.onUnmount.call(this),this.canvas.remove(),this.canvas=null},CanvasLayer.prototype.onResize=function(event){var ctx=this.ctx,width=event.width,height=event.height;ctx.canvas.setAttribute("width",width+"px"),ctx.canvas.setAttribute("height",height+"px")},CanvasLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event)},CanvasLayer.prototype.resetTransform=function(){this.ctx.resetTransform()},CanvasLayer.prototype.setTransform=function(event){this.resetTransform();var flippedX=event.xBounds[0]>event.xBounds[1],flippedY=event.yBounds[0]>event.yBounds[1];this.ctx.translate(event.xScale(0),event.yScale(0)),this.ctx.scale(event.xRatio*(flippedX?-1:1),event.yRatio*(flippedY?-1:1))},CanvasLayer.prototype.clearCanvas=function(){var ctx=this.ctx,canvas=this.canvas;ctx.save(),ctx.resetTransform(),ctx.clearRect(0,0,canvas.width,canvas.height),ctx.restore()},CanvasLayer}(Layer),defaultOptions$1={minorColor:"lightgray",majorColor:"gray",minorWidth:.25,majorWidth:.75},GridLayer=function(_super){function GridLayer(id,options){var _this=_super.call(this,id,options)||this;return _this._offsetX=0,_this._offsetY=0,_this.options=__assign(__assign({},_this.options),options||defaultOptions$1),_this.render=_this.render.bind(_this),_this}return __extends(GridLayer,_super),GridLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.render(event)},GridLayer.prototype.onRescale=function(event){_super.prototype.onRescale.call(this,event),this.render(event)},GridLayer.prototype.render=function(event){var ctx=this.ctx,_a=this.options,minorWidth=_a.minorWidth,minorColor=_a.minorColor,majorWidth=_a.majorWidth,majorColor=_a.majorColor;if(ctx&&(this.clearCanvas(),event.xScale||event.yScale)){var xScale=event.xScale.copy(),yScale=event.yScale.copy(),xDomain=xScale.domain(),yDomain=yScale.domain(),offsetX=this.offsetX,offsetY=this.offsetY;xScale.domain([xDomain[0]-offsetX,xDomain[1]-offsetX]),yScale.domain([yDomain[0]-offsetY,yDomain[1]-offsetY]);var _b=xScale.range(),rx1=_b[0],rx2=_b[1],_c=yScale.range(),ry1=_c[0],ry2=_c[1];ctx.lineWidth=minorWidth||.25,ctx.strokeStyle=minorColor||"lightgray";var xminticks=this.mapMinorTicks(xScale.ticks()),yminticks=this.mapMinorTicks(yScale.ticks());this.renderTicksX(xScale,xminticks,ry1,ry2),this.renderTicksY(yScale,yminticks,rx1,rx2),ctx.lineWidth=majorWidth||.75,ctx.strokeStyle=majorColor||"gray",this.renderTicksX(xScale,xScale.ticks(),ry1,ry2),this.renderTicksY(yScale,yScale.ticks(),rx1,rx2),ctx.restore()}},GridLayer.prototype.renderTicksX=function(xscale,xticks,ry1,ry2){var _this=this;xticks.forEach((function(tx){var x=xscale(tx);_this.ctx.beginPath(),_this.ctx.moveTo(x,ry1),_this.ctx.lineTo(x,ry2),_this.ctx.stroke()}))},GridLayer.prototype.renderTicksY=function(yscale,yticks,rx1,rx2){var _this=this;yticks.forEach((function(ty){var y=yscale(ty);_this.ctx.beginPath(),_this.ctx.moveTo(rx1,y),_this.ctx.lineTo(rx2,y),_this.ctx.stroke()}))},GridLayer.prototype.mapMinorTicks=function(ticks){var xminticks=[];return ticks.length>=2&&(xminticks=ticks.map((function(v){return v+(ticks[1]-ticks[0])/2}))).pop(),xminticks},Object.defineProperty(GridLayer.prototype,"offsetX",{get:function(){return this._offsetX},set:function(offset){this._offsetX=offset},enumerable:!1,configurable:!0}),Object.defineProperty(GridLayer.prototype,"offsetY",{get:function(){return this._offsetY},set:function(offset){this._offsetY=offset},enumerable:!1,configurable:!0}),GridLayer}(CanvasLayer),xhtml="http://www.w3.org/1999/xhtml",namespaces={svg:"http://www.w3.org/2000/svg",xhtml:xhtml,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function namespace(name){var prefix=name+="",i=prefix.indexOf(":");return i>=0&&"xmlns"!==(prefix=name.slice(0,i))&&(name=name.slice(i+1)),namespaces.hasOwnProperty(prefix)?{space:namespaces[prefix],local:name}:name}function creatorInherit(name){return function(){var document=this.ownerDocument,uri=this.namespaceURI;return uri===xhtml&&document.documentElement.namespaceURI===xhtml?document.createElement(name):document.createElementNS(uri,name)}}function creatorFixed(fullname){return function(){return this.ownerDocument.createElementNS(fullname.space,fullname.local)}}function creator(name){var fullname=namespace(name);return(fullname.local?creatorFixed:creatorInherit)(fullname)}function none(){}function selector(selector){return null==selector?none:function(){return this.querySelector(selector)}}function array(x){return null==x?[]:Array.isArray(x)?x:Array.from(x)}function empty(){return[]}function selectorAll(selector){return null==selector?empty:function(){return this.querySelectorAll(selector)}}function matcher(selector){return function(){return this.matches(selector)}}function childMatcher(selector){return function(node){return node.matches(selector)}}var find=Array.prototype.find;function childFirst(){return this.firstElementChild}var filter=Array.prototype.filter;function children(){return Array.from(this.children)}function sparse(update){return new Array(update.length)}function EnterNode(parent,datum){this.ownerDocument=parent.ownerDocument,this.namespaceURI=parent.namespaceURI,this._next=null,this._parent=parent,this.__data__=datum}function constant(x){return function(){return x}}function bindIndex(parent,group,enter,update,exit,data){for(var node,i=0,groupLength=group.length,dataLength=data.length;i<dataLength;++i)(node=group[i])?(node.__data__=data[i],update[i]=node):enter[i]=new EnterNode(parent,data[i]);for(;i<groupLength;++i)(node=group[i])&&(exit[i]=node)}function bindKey(parent,group,enter,update,exit,data,key){var i,node,keyValue,nodeByKeyValue=new Map,groupLength=group.length,dataLength=data.length,keyValues=new Array(groupLength);for(i=0;i<groupLength;++i)(node=group[i])&&(keyValues[i]=keyValue=key.call(node,node.__data__,i,group)+"",nodeByKeyValue.has(keyValue)?exit[i]=node:nodeByKeyValue.set(keyValue,node));for(i=0;i<dataLength;++i)keyValue=key.call(parent,data[i],i,data)+"",(node=nodeByKeyValue.get(keyValue))?(update[i]=node,node.__data__=data[i],nodeByKeyValue.delete(keyValue)):enter[i]=new EnterNode(parent,data[i]);for(i=0;i<groupLength;++i)(node=group[i])&&nodeByKeyValue.get(keyValues[i])===node&&(exit[i]=node)}function datum(node){return node.__data__}function arraylike(data){return"object"==typeof data&&"length"in data?data:Array.from(data)}function ascending(a,b){return a<b?-1:a>b?1:a>=b?0:NaN}function attrRemove(name){return function(){this.removeAttribute(name)}}function attrRemoveNS(fullname){return function(){this.removeAttributeNS(fullname.space,fullname.local)}}function attrConstant(name,value){return function(){this.setAttribute(name,value)}}function attrConstantNS(fullname,value){return function(){this.setAttributeNS(fullname.space,fullname.local,value)}}function attrFunction(name,value){return function(){var v=value.apply(this,arguments);null==v?this.removeAttribute(name):this.setAttribute(name,v)}}function attrFunctionNS(fullname,value){return function(){var v=value.apply(this,arguments);null==v?this.removeAttributeNS(fullname.space,fullname.local):this.setAttributeNS(fullname.space,fullname.local,v)}}function defaultView(node){return node.ownerDocument&&node.ownerDocument.defaultView||node.document&&node||node.defaultView}function styleRemove(name){return function(){this.style.removeProperty(name)}}function styleConstant(name,value,priority){return function(){this.style.setProperty(name,value,priority)}}function styleFunction(name,value,priority){return function(){var v=value.apply(this,arguments);null==v?this.style.removeProperty(name):this.style.setProperty(name,v,priority)}}function styleValue(node,name){return node.style.getPropertyValue(name)||defaultView(node).getComputedStyle(node,null).getPropertyValue(name)}function propertyRemove(name){return function(){delete this[name]}}function propertyConstant(name,value){return function(){this[name]=value}}function propertyFunction(name,value){return function(){var v=value.apply(this,arguments);null==v?delete this[name]:this[name]=v}}function classArray(string){return string.trim().split(/^|\s+/)}function classList(node){return node.classList||new ClassList(node)}function ClassList(node){this._node=node,this._names=classArray(node.getAttribute("class")||"")}function classedAdd(node,names){for(var list=classList(node),i=-1,n=names.length;++i<n;)list.add(names[i])}function classedRemove(node,names){for(var list=classList(node),i=-1,n=names.length;++i<n;)list.remove(names[i])}function classedTrue(names){return function(){classedAdd(this,names)}}function classedFalse(names){return function(){classedRemove(this,names)}}function classedFunction(names,value){return function(){(value.apply(this,arguments)?classedAdd:classedRemove)(this,names)}}function textRemove(){this.textContent=""}function textConstant(value){return function(){this.textContent=value}}function textFunction(value){return function(){var v=value.apply(this,arguments);this.textContent=null==v?"":v}}function htmlRemove(){this.innerHTML=""}function htmlConstant(value){return function(){this.innerHTML=value}}function htmlFunction(value){return function(){var v=value.apply(this,arguments);this.innerHTML=null==v?"":v}}function raise(){this.nextSibling&&this.parentNode.appendChild(this)}function lower(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function constantNull(){return null}function remove(){var parent=this.parentNode;parent&&parent.removeChild(this)}function selection_cloneShallow(){var clone=this.cloneNode(!1),parent=this.parentNode;return parent?parent.insertBefore(clone,this.nextSibling):clone}function selection_cloneDeep(){var clone=this.cloneNode(!0),parent=this.parentNode;return parent?parent.insertBefore(clone,this.nextSibling):clone}function parseTypenames(typenames){return typenames.trim().split(/^|\s+/).map((function(t){var name="",i=t.indexOf(".");return i>=0&&(name=t.slice(i+1),t=t.slice(0,i)),{type:t,name:name}}))}function onRemove(typename){return function(){var on=this.__on;if(on){for(var o,j=0,i=-1,m=on.length;j<m;++j)o=on[j],typename.type&&o.type!==typename.type||o.name!==typename.name?on[++i]=o:this.removeEventListener(o.type,o.listener,o.options);++i?on.length=i:delete this.__on}}}function onAdd(typename,value,options){return function(){var o,on=this.__on,listener=function(listener){return function(event){listener.call(this,event,this.__data__)}}(value);if(on)for(var j=0,m=on.length;j<m;++j)if((o=on[j]).type===typename.type&&o.name===typename.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=listener,o.options=options),void(o.value=value);this.addEventListener(typename.type,listener,options),o={type:typename.type,name:typename.name,value:value,listener:listener,options:options},on?on.push(o):this.__on=[o]}}function dispatchEvent(node,type,params){var window=defaultView(node),event=window.CustomEvent;"function"==typeof event?event=new event(type,params):(event=window.document.createEvent("Event"),params?(event.initEvent(type,params.bubbles,params.cancelable),event.detail=params.detail):event.initEvent(type,!1,!1)),node.dispatchEvent(event)}function dispatchConstant(type,params){return function(){return dispatchEvent(this,type,params)}}function dispatchFunction(type,params){return function(){return dispatchEvent(this,type,params.apply(this,arguments))}}EnterNode.prototype={constructor:EnterNode,appendChild:function(child){return this._parent.insertBefore(child,this._next)},insertBefore:function(child,next){return this._parent.insertBefore(child,next)},querySelector:function(selector){return this._parent.querySelector(selector)},querySelectorAll:function(selector){return this._parent.querySelectorAll(selector)}},ClassList.prototype={add:function(name){this._names.indexOf(name)<0&&(this._names.push(name),this._node.setAttribute("class",this._names.join(" ")))},remove:function(name){var i=this._names.indexOf(name);i>=0&&(this._names.splice(i,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(name){return this._names.indexOf(name)>=0}};var root=[null];function Selection(groups,parents){this._groups=groups,this._parents=parents}function selection(){return new Selection([[document.documentElement]],root)}function select(selector){return"string"==typeof selector?new Selection([[document.querySelector(selector)]],[document.documentElement]):new Selection([[selector]],root)}function pointer(event,node){if(event=function(event){let sourceEvent;for(;sourceEvent=event.sourceEvent;)event=sourceEvent;return event}(event),void 0===node&&(node=event.currentTarget),node){var svg=node.ownerSVGElement||node;if(svg.createSVGPoint){var point=svg.createSVGPoint();return point.x=event.clientX,point.y=event.clientY,[(point=point.matrixTransform(node.getScreenCTM().inverse())).x,point.y]}if(node.getBoundingClientRect){var rect=node.getBoundingClientRect();return[event.clientX-rect.left-node.clientLeft,event.clientY-rect.top-node.clientTop]}}return[event.pageX,event.pageY]}Selection.prototype=selection.prototype={constructor:Selection,select:function(select){"function"!=typeof select&&(select=selector(select));for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j<m;++j)for(var node,subnode,group=groups[j],n=group.length,subgroup=subgroups[j]=new Array(n),i=0;i<n;++i)(node=group[i])&&(subnode=select.call(node,node.__data__,i,group))&&("__data__"in node&&(subnode.__data__=node.__data__),subgroup[i]=subnode);return new Selection(subgroups,this._parents)},selectAll:function(select){select="function"==typeof select?function(select){return function(){return array(select.apply(this,arguments))}}(select):selectorAll(select);for(var groups=this._groups,m=groups.length,subgroups=[],parents=[],j=0;j<m;++j)for(var node,group=groups[j],n=group.length,i=0;i<n;++i)(node=group[i])&&(subgroups.push(select.call(node,node.__data__,i,group)),parents.push(node));return new Selection(subgroups,parents)},selectChild:function(match){return this.select(null==match?childFirst:function(match){return function(){return find.call(this.children,match)}}("function"==typeof match?match:childMatcher(match)))},selectChildren:function(match){return this.selectAll(null==match?children:function(match){return function(){return filter.call(this.children,match)}}("function"==typeof match?match:childMatcher(match)))},filter:function(match){"function"!=typeof match&&(match=matcher(match));for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j<m;++j)for(var node,group=groups[j],n=group.length,subgroup=subgroups[j]=[],i=0;i<n;++i)(node=group[i])&&match.call(node,node.__data__,i,group)&&subgroup.push(node);return new Selection(subgroups,this._parents)},data:function(value,key){if(!arguments.length)return Array.from(this,datum);var bind=key?bindKey:bindIndex,parents=this._parents,groups=this._groups;"function"!=typeof value&&(value=constant(value));for(var m=groups.length,update=new Array(m),enter=new Array(m),exit=new Array(m),j=0;j<m;++j){var parent=parents[j],group=groups[j],groupLength=group.length,data=arraylike(value.call(parent,parent&&parent.__data__,j,parents)),dataLength=data.length,enterGroup=enter[j]=new Array(dataLength),updateGroup=update[j]=new Array(dataLength),exitGroup=exit[j]=new Array(groupLength);bind(parent,group,enterGroup,updateGroup,exitGroup,data,key);for(var previous,next,i0=0,i1=0;i0<dataLength;++i0)if(previous=enterGroup[i0]){for(i0>=i1&&(i1=i0+1);!(next=updateGroup[i1])&&++i1<dataLength;);previous._next=next||null}}return(update=new Selection(update,parents))._enter=enter,update._exit=exit,update},enter:function(){return new Selection(this._enter||this._groups.map(sparse),this._parents)},exit:function(){return new Selection(this._exit||this._groups.map(sparse),this._parents)},join:function(onenter,onupdate,onexit){var enter=this.enter(),update=this,exit=this.exit();return"function"==typeof onenter?(enter=onenter(enter))&&(enter=enter.selection()):enter=enter.append(onenter+""),null!=onupdate&&(update=onupdate(update))&&(update=update.selection()),null==onexit?exit.remove():onexit(exit),enter&&update?enter.merge(update).order():update},merge:function(context){for(var selection=context.selection?context.selection():context,groups0=this._groups,groups1=selection._groups,m0=groups0.length,m1=groups1.length,m=Math.min(m0,m1),merges=new Array(m0),j=0;j<m;++j)for(var node,group0=groups0[j],group1=groups1[j],n=group0.length,merge=merges[j]=new Array(n),i=0;i<n;++i)(node=group0[i]||group1[i])&&(merge[i]=node);for(;j<m0;++j)merges[j]=groups0[j];return new Selection(merges,this._parents)},selection:function(){return this},order:function(){for(var groups=this._groups,j=-1,m=groups.length;++j<m;)for(var node,group=groups[j],i=group.length-1,next=group[i];--i>=0;)(node=group[i])&&(next&&4^node.compareDocumentPosition(next)&&next.parentNode.insertBefore(node,next),next=node);return this},sort:function(compare){function compareNode(a,b){return a&&b?compare(a.__data__,b.__data__):!a-!b}compare||(compare=ascending);for(var groups=this._groups,m=groups.length,sortgroups=new Array(m),j=0;j<m;++j){for(var node,group=groups[j],n=group.length,sortgroup=sortgroups[j]=new Array(n),i=0;i<n;++i)(node=group[i])&&(sortgroup[i]=node);sortgroup.sort(compareNode)}return new Selection(sortgroups,this._parents).order()},call:function(){var callback=arguments[0];return arguments[0]=this,callback.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var groups=this._groups,j=0,m=groups.length;j<m;++j)for(var group=groups[j],i=0,n=group.length;i<n;++i){var node=group[i];if(node)return node}return null},size:function(){let size=0;for(const node of this)++size;return size},empty:function(){return!this.node()},each:function(callback){for(var groups=this._groups,j=0,m=groups.length;j<m;++j)for(var node,group=groups[j],i=0,n=group.length;i<n;++i)(node=group[i])&&callback.call(node,node.__data__,i,group);return this},attr:function(name,value){var fullname=namespace(name);if(arguments.length<2){var node=this.node();return fullname.local?node.getAttributeNS(fullname.space,fullname.local):node.getAttribute(fullname)}return this.each((null==value?fullname.local?attrRemoveNS:attrRemove:"function"==typeof value?fullname.local?attrFunctionNS:attrFunction:fullname.local?attrConstantNS:attrConstant)(fullname,value))},style:function(name,value,priority){return arguments.length>1?this.each((null==value?styleRemove:"function"==typeof value?styleFunction:styleConstant)(name,value,null==priority?"":priority)):styleValue(this.node(),name)},property:function(name,value){return arguments.length>1?this.each((null==value?propertyRemove:"function"==typeof value?propertyFunction:propertyConstant)(name,value)):this.node()[name]},classed:function(name,value){var names=classArray(name+"");if(arguments.length<2){for(var list=classList(this.node()),i=-1,n=names.length;++i<n;)if(!list.contains(names[i]))return!1;return!0}return this.each(("function"==typeof value?classedFunction:value?classedTrue:classedFalse)(names,value))},text:function(value){return arguments.length?this.each(null==value?textRemove:("function"==typeof value?textFunction:textConstant)(value)):this.node().textContent},html:function(value){return arguments.length?this.each(null==value?htmlRemove:("function"==typeof value?htmlFunction:htmlConstant)(value)):this.node().innerHTML},raise:function(){return this.each(raise)},lower:function(){return this.each(lower)},append:function(name){var create="function"==typeof name?name:creator(name);return this.select((function(){return this.appendChild(create.apply(this,arguments))}))},insert:function(name,before){var create="function"==typeof name?name:creator(name),select=null==before?constantNull:"function"==typeof before?before:selector(before);return this.select((function(){return this.insertBefore(create.apply(this,arguments),select.apply(this,arguments)||null)}))},remove:function(){return this.each(remove)},clone:function(deep){return this.select(deep?selection_cloneDeep:selection_cloneShallow)},datum:function(value){return arguments.length?this.property("__data__",value):this.node().__data__},on:function(typename,value,options){var i,t,typenames=parseTypenames(typename+""),n=typenames.length;if(!(arguments.length<2)){for(on=value?onAdd:onRemove,i=0;i<n;++i)this.each(on(typenames[i],value,options));return this}var on=this.node().__on;if(on)for(var o,j=0,m=on.length;j<m;++j)for(i=0,o=on[j];i<n;++i)if((t=typenames[i]).type===o.type&&t.name===o.name)return o.value},dispatch:function(type,params){return this.each(("function"==typeof params?dispatchFunction:dispatchConstant)(type,params))},[Symbol.iterator]:function*(){for(var groups=this._groups,j=0,m=groups.length;j<m;++j)for(var node,group=groups[j],i=0,n=group.length;i<n;++i)(node=group[i])&&(yield node)}};var SVGLayer=function(_super){function SVGLayer(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(SVGLayer,_super),SVGLayer.prototype.onMount=function(event){_super.prototype.onMount.call(this,event);var elm=event.elm,width=event.width||parseInt(elm.getAttribute("width"),10)||200,height=event.height||parseInt(elm.getAttribute("height"),10)||300;this.elm||(this.elm=select(elm).append("svg"),this.elm.attr("id",""+this.id),this.elm.attr("class","svg-layer")),this.elm.attr("height",height).attr("width",width);var interactive=this.interactive?"auto":"none";this.elm.style("position","absolute").style("pointer-events",interactive).style("opacity",this.opacity).style("z-index",this.order)},SVGLayer.prototype.onUnmount=function(){_super.prototype.onUnmount.call(this),this.elm.remove(),this.elm=null},SVGLayer.prototype.onResize=function(event){this.elm&&(_super.prototype.onResize.call(this,event),this.elm.attr("height",event.height).attr("width",event.width))},SVGLayer.prototype.setVisibility=function(visible){_super.prototype.setVisibility.call(this,visible),this.elm&&this.elm.attr("visibility",visible?"visible":"hidden")},SVGLayer.prototype.onOpacityChanged=function(opacity){this.elm&&this.elm.style("opacity",opacity)},SVGLayer.prototype.onOrderChanged=function(order){this.elm&&this.elm.style("z-index",order)},SVGLayer.prototype.onInteractivityChanged=function(shouldBeInteractive){if(this.elm){var interactive=shouldBeInteractive?"auto":"none";this.elm.style("pointer-events",interactive)}},SVGLayer}(Layer),HTMLLayer=function(_super){function HTMLLayer(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(HTMLLayer,_super),HTMLLayer.prototype.onMount=function(event){_super.prototype.onMount.call(this,event);var elm=event.elm,width=event.width||parseInt(elm.getAttribute("width"),10)||200,height=event.height||parseInt(elm.getAttribute("height"),10)||300;this.elm||(this.elm=select(elm).append("div"),this.elm.attr("id",""+this.id),this.elm.attr("class","html-layer"));var interactive=this.interactive?"auto":"none";this.elm.style("position","absolute").style("height",height+"px").style("width",width+"px").style("opacity",this.opacity).style("overflow","hidden").style("pointer-events",interactive).style("z-index",this.order)},HTMLLayer.prototype.onUnmount=function(){_super.prototype.onUnmount.call(this),this.elm.remove(),this.elm=null},HTMLLayer.prototype.onResize=function(event){this.elm&&(_super.prototype.onResize.call(this,event),this.elm.style("height",event.height+"px").style("width",event.width+"px"))},HTMLLayer.prototype.setVisibility=function(visible){_super.prototype.setVisibility.call(this,visible),this.elm&&this.elm.attr("visibility",visible?"visible":"hidden")},HTMLLayer.prototype.onOpacityChanged=function(opacity){this.elm&&this.elm.style("opacity",opacity)},HTMLLayer.prototype.onOrderChanged=function(order){this.elm&&this.elm.style("z-index",order)},HTMLLayer.prototype.onInteractivityChanged=function(shouldBeInteractive){if(this.elm){var interactive=shouldBeInteractive?"auto":"none";this.elm.style("pointer-events",interactive)}},HTMLLayer}(Layer),pi=Math.PI,tau=2*pi,tauEpsilon=tau-1e-6;function Path(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function path(){return new Path}function constant$1(x){return function(){return x}}Path.prototype=path.prototype={constructor:Path,moveTo:function(x,y){this._+="M"+(this._x0=this._x1=+x)+","+(this._y0=this._y1=+y)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(x,y){this._+="L"+(this._x1=+x)+","+(this._y1=+y)},quadraticCurveTo:function(x1,y1,x,y){this._+="Q"+ +x1+","+ +y1+","+(this._x1=+x)+","+(this._y1=+y)},bezierCurveTo:function(x1,y1,x2,y2,x,y){this._+="C"+ +x1+","+ +y1+","+ +x2+","+ +y2+","+(this._x1=+x)+","+(this._y1=+y)},arcTo:function(x1,y1,x2,y2,r){x1=+x1,y1=+y1,x2=+x2,y2=+y2,r=+r;var x0=this._x1,y0=this._y1,x21=x2-x1,y21=y2-y1,x01=x0-x1,y01=y0-y1,l01_2=x01*x01+y01*y01;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=x1)+","+(this._y1=y1);else if(l01_2>1e-6)if(Math.abs(y01*x21-y21*x01)>1e-6&&r){var x20=x2-x0,y20=y2-y0,l21_2=x21*x21+y21*y21,l20_2=x20*x20+y20*y20,l21=Math.sqrt(l21_2),l01=Math.sqrt(l01_2),l=r*Math.tan((pi-Math.acos((l21_2+l01_2-l20_2)/(2*l21*l01)))/2),t01=l/l01,t21=l/l21;Math.abs(t01-1)>1e-6&&(this._+="L"+(x1+t01*x01)+","+(y1+t01*y01)),this._+="A"+r+","+r+",0,0,"+ +(y01*x20>x01*y20)+","+(this._x1=x1+t21*x21)+","+(this._y1=y1+t21*y21)}else this._+="L"+(this._x1=x1)+","+(this._y1=y1);else;},arc:function(x,y,r,a0,a1,ccw){x=+x,y=+y,ccw=!!ccw;var dx=(r=+r)*Math.cos(a0),dy=r*Math.sin(a0),x0=x+dx,y0=y+dy,cw=1^ccw,da=ccw?a0-a1:a1-a0;if(r<0)throw new Error("negative radius: "+r);null===this._x1?this._+="M"+x0+","+y0:(Math.abs(this._x1-x0)>1e-6||Math.abs(this._y1-y0)>1e-6)&&(this._+="L"+x0+","+y0),r&&(da<0&&(da=da%tau+tau),da>tauEpsilon?this._+="A"+r+","+r+",0,1,"+cw+","+(x-dx)+","+(y-dy)+"A"+r+","+r+",0,1,"+cw+","+(this._x1=x0)+","+(this._y1=y0):da>1e-6&&(this._+="A"+r+","+r+",0,"+ +(da>=pi)+","+cw+","+(this._x1=x+r*Math.cos(a1))+","+(this._y1=y+r*Math.sin(a1))))},rect:function(x,y,w,h){this._+="M"+(this._x0=this._x1=+x)+","+(this._y0=this._y1=+y)+"h"+ +w+"v"+ +h+"h"+-w+"Z"},toString:function(){return this._}};function Linear(context){this._context=context}function curveLinear(context){return new Linear(context)}function x(p){return p[0]}function y(p){return p[1]}function line(x$1,y$1){var defined=constant$1(!0),context=null,curve=curveLinear,output=null;function line(data){var i,d,buffer,n=(data=function(x){return"object"==typeof x&&"length"in x?x:Array.from(x)}(data)).length,defined0=!1;for(null==context&&(output=curve(buffer=path())),i=0;i<=n;++i)!(i<n&&defined(d=data[i],i,data))===defined0&&((defined0=!defined0)?output.lineStart():output.lineEnd()),defined0&&output.point(+x$1(d,i,data),+y$1(d,i,data));if(buffer)return output=null,buffer+""||null}return x$1="function"==typeof x$1?x$1:void 0===x$1?x:constant$1(x$1),y$1="function"==typeof y$1?y$1:void 0===y$1?y:constant$1(y$1),line.x=function(_){return arguments.length?(x$1="function"==typeof _?_:constant$1(+_),line):x$1},line.y=function(_){return arguments.length?(y$1="function"==typeof _?_:constant$1(+_),line):y$1},line.defined=function(_){return arguments.length?(defined="function"==typeof _?_:constant$1(!!_),line):defined},line.curve=function(_){return arguments.length?(curve=_,null!=context&&(output=curve(context)),line):curve},line.context=function(_){return arguments.length?(null==_?context=output=null:output=curve(context=_),line):context},line}function noop(){}function point(that,x,y){that._context.bezierCurveTo((2*that._x0+that._x1)/3,(2*that._y0+that._y1)/3,(that._x0+2*that._x1)/3,(that._y0+2*that._y1)/3,(that._x0+4*that._x1+x)/6,(that._y0+4*that._y1+y)/6)}function Basis(context){this._context=context}function curveBasis(context){return new Basis(context)}function BasisClosed(context){this._context=context}function curveBasisClosed(context){return new BasisClosed(context)}function Bundle(context,beta){this._basis=new Basis(context),this._beta=beta}Linear.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(x,y){switch(x=+x,y=+y,this._point){case 0:this._point=1,this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;default:this._context.lineTo(x,y)}}},Basis.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:point(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(x,y){switch(x=+x,y=+y,this._point){case 0:this._point=1,this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:point(this,x,y)}this._x0=this._x1,this._x1=x,this._y0=this._y1,this._y1=y}},BasisClosed.prototype={areaStart:noop,areaEnd:noop,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(x,y){switch(x=+x,y=+y,this._point){case 0:this._point=1,this._x2=x,this._y2=y;break;case 1:this._point=2,this._x3=x,this._y3=y;break;case 2:this._point=3,this._x4=x,this._y4=y,this._context.moveTo((this._x0+4*this._x1+x)/6,(this._y0+4*this._y1+y)/6);break;default:point(this,x,y)}this._x0=this._x1,this._x1=x,this._y0=this._y1,this._y1=y}},Bundle.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var x=this._x,y=this._y,j=x.length-1;if(j>0)for(var t,x0=x[0],y0=y[0],dx=x[j]-x0,dy=y[j]-y0,i=-1;++i<=j;)t=i/j,this._basis.point(this._beta*x[i]+(1-this._beta)*(x0+t*dx),this._beta*y[i]+(1-this._beta)*(y0+t*dy));this._x=this._y=null,this._basis.lineEnd()},point:function(x,y){this._x.push(+x),this._y.push(+y)}};var curveBundle=function custom(beta){function bundle(context){return 1===beta?new Basis(context):new Bundle(context,beta)}return bundle.beta=function(beta){return custom(+beta)},bundle}(.85);function point$1(that,x,y){that._context.bezierCurveTo(that._x1+that._k*(that._x2-that._x0),that._y1+that._k*(that._y2-that._y0),that._x2+that._k*(that._x1-x),that._y2+that._k*(that._y1-y),that._x2,that._y2)}function Cardinal(context,tension){this._context=context,this._k=(1-tension)/6}Cardinal.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:point$1(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(x,y){switch(x=+x,y=+y,this._point){case 0:this._point=1,this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2,this._x1=x,this._y1=y;break;case 2:this._point=3;default:point$1(this,x,y)}this._x0=this._x1,this._x1=this._x2,this._x2=x,this._y0=this._y1,this._y1=this._y2,this._y2=y}};var curveCardinal=function custom(tension){function cardinal(context){return new Cardinal(context,tension)}return cardinal.tension=function(tension){return custom(+tension)},cardinal}(0);function CatmullRom(context,alpha){this._context=context,this._alpha=alpha}CatmullRom.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(x,y){if(x=+x,y=+y,this._point){var x23=this._x2-x,y23=this._y2-y;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(x23*x23+y23*y23,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;break;case 2:this._point=3;default:!function(that,x,y){var x1=that._x1,y1=that._y1,x2=that._x2,y2=that._y2;if(that._l01_a>1e-12){var a=2*that._l01_2a+3*that._l01_a*that._l12_a+that._l12_2a,n=3*that._l01_a*(that._l01_a+that._l12_a);x1=(x1*a-that._x0*that._l12_2a+that._x2*that._l01_2a)/n,y1=(y1*a-that._y0*that._l12_2a+that._y2*that._l01_2a)/n}if(that._l23_a>1e-12){var b=2*that._l23_2a+3*that._l23_a*that._l12_a+that._l12_2a,m=3*that._l23_a*(that._l23_a+that._l12_a);x2=(x2*b+that._x1*that._l23_2a-x*that._l12_2a)/m,y2=(y2*b+that._y1*that._l23_2a-y*that._l12_2a)/m}that._context.bezierCurveTo(x1,y1,x2,y2,that._x2,that._y2)}(this,x,y)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=x,this._y0=this._y1,this._y1=this._y2,this._y2=y}};var curveCatmullRom=function custom(alpha){function catmullRom(context){return alpha?new CatmullRom(context,alpha):new Cardinal(context,0)}return catmullRom.alpha=function(alpha){return custom(+alpha)},catmullRom}(.5);function sign(x){return x<0?-1:1}function slope3(that,x2,y2){var h0=that._x1-that._x0,h1=x2-that._x1,s0=(that._y1-that._y0)/(h0||h1<0&&-0),s1=(y2-that._y1)/(h1||h0<0&&-0),p=(s0*h1+s1*h0)/(h0+h1);return(sign(s0)+sign(s1))*Math.min(Math.abs(s0),Math.abs(s1),.5*Math.abs(p))||0}function slope2(that,t){var h=that._x1-that._x0;return h?(3*(that._y1-that._y0)/h-t)/2:t}function point$3(that,t0,t1){var x0=that._x0,y0=that._y0,x1=that._x1,y1=that._y1,dx=(x1-x0)/3;that._context.bezierCurveTo(x0+dx,y0+dx*t0,x1-dx,y1-dx*t1,x1,y1)}function MonotoneX(context){this._context=context}function MonotoneY(context){this._context=new ReflectContext(context)}function ReflectContext(context){this._context=context}function monotoneX(context){return new MonotoneX(context)}function monotoneY(context){return new MonotoneY(context)}function Natural(context){this._context=context}function controlPoints(x){var i,m,n=x.length-1,a=new Array(n),b=new Array(n),r=new Array(n);for(a[0]=0,b[0]=2,r[0]=x[0]+2*x[1],i=1;i<n-1;++i)a[i]=1,b[i]=4,r[i]=4*x[i]+2*x[i+1];for(a[n-1]=2,b[n-1]=7,r[n-1]=8*x[n-1]+x[n],i=1;i<n;++i)m=a[i]/b[i-1],b[i]-=m,r[i]-=m*r[i-1];for(a[n-1]=r[n-1]/b[n-1],i=n-2;i>=0;--i)a[i]=(r[i]-a[i+1])/b[i];for(b[n-1]=(x[n]+a[n-1])/2,i=0;i<n-1;++i)b[i]=2*x[i+1]-a[i+1];return[a,b]}function curveNatural(context){return new Natural(context)}function Step(context,t){this._context=context,this._t=t}function curveStep(context){return new Step(context,.5)}function stepBefore(context){return new Step(context,0)}function stepAfter(context){return new Step(context,1)}MonotoneX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:point$3(this,this._t0,slope2(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(x,y){var t1=NaN;if(y=+y,(x=+x)!==this._x1||y!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;break;case 2:this._point=3,point$3(this,slope2(this,t1=slope3(this,x,y)),t1);break;default:point$3(this,this._t0,t1=slope3(this,x,y))}this._x0=this._x1,this._x1=x,this._y0=this._y1,this._y1=y,this._t0=t1}}},(MonotoneY.prototype=Object.create(MonotoneX.prototype)).point=function(x,y){MonotoneX.prototype.point.call(this,y,x)},ReflectContext.prototype={moveTo:function(x,y){this._context.moveTo(y,x)},closePath:function(){this._context.closePath()},lineTo:function(x,y){this._context.lineTo(y,x)},bezierCurveTo:function(x1,y1,x2,y2,x,y){this._context.bezierCurveTo(y1,x1,y2,x2,y,x)}},Natural.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var x=this._x,y=this._y,n=x.length;if(n)if(this._line?this._context.lineTo(x[0],y[0]):this._context.moveTo(x[0],y[0]),2===n)this._context.lineTo(x[1],y[1]);else for(var px=controlPoints(x),py=controlPoints(y),i0=0,i1=1;i1<n;++i0,++i1)this._context.bezierCurveTo(px[0][i0],py[0][i0],px[1][i0],py[1][i0],x[i1],y[i1]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(x,y){this._x.push(+x),this._y.push(+y)}},Step.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(x,y){switch(x=+x,y=+y,this._point){case 0:this._point=1,this._line?this._context.lineTo(x,y):this._context.moveTo(x,y);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,y),this._context.lineTo(x,y);else{var x1=this._x*(1-this._t)+x*this._t;this._context.lineTo(x1,this._y),this._context.lineTo(x1,y)}}this._x=x,this._y=y}};var WellborepathLayer=function(_super){function WellborepathLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.options=__assign(__assign({},_this.options),options),_this.render=_this.render.bind(_this),_this}return __extends(WellborepathLayer,_super),WellborepathLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.render()},WellborepathLayer.prototype.onRescale=function(event){_super.prototype.onRescale.call(this,event),this.elm&&(this.rescaleEvent=event,this.render())},WellborepathLayer.prototype.render=function(){var _a=this.options,strokeWidth=_a.strokeWidth,stroke=_a.stroke;if(this.elm){this.elm.select("g").remove();var data=this.data||this.referenceSystem&&this.referenceSystem.projectedPath;data&&this.rescaleEvent&&this.elm.append("g").attr("class","well-path").append("path").attr("d",this.renderWellborePath(data)).attr("stroke-width",strokeWidth||"2px").attr("stroke",stroke||"red").attr("fill","none")}},WellborepathLayer.prototype.renderWellborePath=function(data){var curveFactory,_a=this.rescaleEvent,xScale=_a.xScale,yScale=_a.yScale,transformedData=data.map((function(d){return[xScale(d[0]),yScale(d[1])]})),_b=this.options,curveType=_b.curveType,tension=_b.tension;switch(curveType){default:case"curveCatmullRom":curveFactory=curveCatmullRom.alpha(tension||.7);break;case"curveLinear":curveFactory=curveLinear;break;case"curveBasis":curveFactory=curveBasis;break;case"curveBasisClosed":curveFactory=curveBasisClosed;break;case"curveBundle":curveFactory=curveBundle.beta(tension||1);break;case"curveCardinal":curveFactory=curveCardinal.tension(tension||.9);break;case"curveMonotoneX":curveFactory=monotoneX;break;case"curveMonotoneY":curveFactory=monotoneY;break;case"curveNatural":curveFactory=curveNatural;break;case"curveStep":curveFactory=curveStep;break;case"curveStepAfter":curveFactory=stepAfter;break;case"curveStepBefore":curveFactory=stepBefore}return line().curve(curveFactory)(transformedData)},WellborepathLayer}(SVGLayer);var setTimeoutFunc=setTimeout;function isArray(x){return Boolean(x&&void 0!==x.length)}function noop$1(){}function Promise$1(fn){if(!(this instanceof Promise$1))throw new TypeError("Promises must be constructed via new");if("function"!=typeof fn)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],doResolve(fn,this)}function handle(self,deferred){for(;3===self._state;)self=self._value;0!==self._state?(self._handled=!0,Promise$1._immediateFn((function(){var cb=1===self._state?deferred.onFulfilled:deferred.onRejected;if(null!==cb){var ret;try{ret=cb(self._value)}catch(e){return void reject(deferred.promise,e)}resolve(deferred.promise,ret)}else(1===self._state?resolve:reject)(deferred.promise,self._value)}))):self._deferreds.push(deferred)}function resolve(self,newValue){try{if(newValue===self)throw new TypeError("A promise cannot be resolved with itself.");if(newValue&&("object"==typeof newValue||"function"==typeof newValue)){var then=newValue.then;if(newValue instanceof Promise$1)return self._state=3,self._value=newValue,void finale(self);if("function"==typeof then)return void doResolve((fn=then,thisArg=newValue,function(){fn.apply(thisArg,arguments)}),self)}self._state=1,self._value=newValue,finale(self)}catch(e){reject(self,e)}var fn,thisArg}function reject(self,newValue){self._state=2,self._value=newValue,finale(self)}function finale(self){2===self._state&&0===self._deferreds.length&&Promise$1._immediateFn((function(){self._handled||Promise$1._unhandledRejectionFn(self._value)}));for(var i=0,len=self._deferreds.length;i<len;i++)handle(self,self._deferreds[i]);self._deferreds=null}function Handler(onFulfilled,onRejected,promise){this.onFulfilled="function"==typeof onFulfilled?onFulfilled:null,this.onRejected="function"==typeof onRejected?onRejected:null,this.promise=promise}function doResolve(fn,self){var done=!1;try{fn((function(value){done||(done=!0,resolve(self,value))}),(function(reason){done||(done=!0,reject(self,reason))}))}catch(ex){if(done)return;done=!0,reject(self,ex)}}Promise$1.prototype.catch=function(onRejected){return this.then(null,onRejected)},Promise$1.prototype.then=function(onFulfilled,onRejected){var prom=new this.constructor(noop$1);return handle(this,new Handler(onFulfilled,onRejected,prom)),prom},Promise$1.prototype.finally=function(callback){var constructor=this.constructor;return this.then((function(value){return constructor.resolve(callback()).then((function(){return value}))}),(function(reason){return constructor.resolve(callback()).then((function(){return constructor.reject(reason)}))}))},Promise$1.all=function(arr){return new Promise$1((function(resolve,reject){if(!isArray(arr))return reject(new TypeError("Promise.all accepts an array"));var args=Array.prototype.slice.call(arr);if(0===args.length)return resolve([]);var remaining=args.length;function res(i,val){try{if(val&&("object"==typeof val||"function"==typeof val)){var then=val.then;if("function"==typeof then)return void then.call(val,(function(val){res(i,val)}),reject)}args[i]=val,0==--remaining&&resolve(args)}catch(ex){reject(ex)}}for(var i=0;i<args.length;i++)res(i,args[i])}))},Promise$1.allSettled=function(arr){return new this((function(resolve,reject){if(!arr||void 0===arr.length)return reject(new TypeError(typeof arr+" "+arr+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var args=Array.prototype.slice.call(arr);if(0===args.length)return resolve([]);var remaining=args.length;function res(i,val){if(val&&("object"==typeof val||"function"==typeof val)){var then=val.then;if("function"==typeof then)return void then.call(val,(function(val){res(i,val)}),(function(e){args[i]={status:"rejected",reason:e},0==--remaining&&resolve(args)}))}args[i]={status:"fulfilled",value:val},0==--remaining&&resolve(args)}for(var i=0;i<args.length;i++)res(i,args[i])}))},Promise$1.resolve=function(value){return value&&"object"==typeof value&&value.constructor===Promise$1?value:new Promise$1((function(resolve){resolve(value)}))},Promise$1.reject=function(value){return new Promise$1((function(resolve,reject){reject(value)}))},Promise$1.race=function(arr){return new Promise$1((function(resolve,reject){if(!isArray(arr))return reject(new TypeError("Promise.race accepts an array"));for(var i=0,len=arr.length;i<len;i++)Promise$1.resolve(arr[i]).then(resolve,reject)}))},Promise$1._immediateFn="function"==typeof setImmediate&&function(fn){setImmediate(fn)}||function(fn){setTimeoutFunc(fn,0)},Promise$1._unhandledRejectionFn=function(err){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",err)};
|
|
16
16
|
/*
|
|
17
17
|
object-assign
|
|
18
18
|
(c) Sindre Sorhus
|
|
19
19
|
@license MIT
|
|
20
|
-
*/
|
|
20
|
+
*/
|
|
21
|
+
var getOwnPropertySymbols=Object.getOwnPropertySymbols,hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;function toObject(val){if(null==val)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(val)}var objectAssign=function(){try{if(!Object.assign)return!1;var test1=new String("abc");if(test1[5]="de","5"===Object.getOwnPropertyNames(test1)[0])return!1;for(var test2={},i=0;i<10;i++)test2["_"+String.fromCharCode(i)]=i;if("0123456789"!==Object.getOwnPropertyNames(test2).map((function(n){return test2[n]})).join(""))return!1;var test3={};return"abcdefghijklmnopqrst".split("").forEach((function(letter){test3[letter]=letter})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},test3)).join("")}catch(err){return!1}}()?Object.assign:function(target,source){for(var from,symbols,to=toObject(target),s=1;s<arguments.length;s++){for(var key in from=Object(arguments[s]))hasOwnProperty.call(from,key)&&(to[key]=from[key]);if(getOwnPropertySymbols){symbols=getOwnPropertySymbols(from);for(var i=0;i<symbols.length;i++)propIsEnumerable.call(from,symbols[i])&&(to[symbols[i]]=from[symbols[i]])}}return to};
|
|
21
22
|
/*!
|
|
22
|
-
* @pixi/polyfill -
|
|
23
|
-
* Compiled
|
|
23
|
+
* @pixi/polyfill - v6.4.2
|
|
24
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
24
25
|
*
|
|
25
26
|
* @pixi/polyfill is licensed under the MIT License.
|
|
26
27
|
* http://www.opensource.org/licenses/mit-license
|
|
27
|
-
*/
|
|
28
|
+
*/"undefined"==typeof globalThis&&("undefined"!=typeof self?self.globalThis=self:"undefined"!=typeof global&&(global.globalThis=global)),globalThis.Promise||(globalThis.Promise=Promise$1),Object.assign||(Object.assign=objectAssign);if(Date.now&&Date.prototype.getTime||(Date.now=function(){return(new Date).getTime()}),!globalThis.performance||!globalThis.performance.now){var startTime_1=Date.now();globalThis.performance||(globalThis.performance={}),globalThis.performance.now=function(){return Date.now()-startTime_1}}for(var lastTime=Date.now(),vendors=["ms","moz","webkit","o"],x$1=0;x$1<vendors.length&&!globalThis.requestAnimationFrame;++x$1){var p=vendors[x$1];globalThis.requestAnimationFrame=globalThis[p+"RequestAnimationFrame"],globalThis.cancelAnimationFrame=globalThis[p+"CancelAnimationFrame"]||globalThis[p+"CancelRequestAnimationFrame"]}globalThis.requestAnimationFrame||(globalThis.requestAnimationFrame=function(callback){if("function"!=typeof callback)throw new TypeError(callback+"is not a function");var currentTime=Date.now(),delay=16+lastTime-currentTime;return delay<0&&(delay=0),lastTime=currentTime,globalThis.self.setTimeout((function(){lastTime=Date.now(),callback(performance.now())}),delay)}),globalThis.cancelAnimationFrame||(globalThis.cancelAnimationFrame=function(id){return clearTimeout(id)}),Math.sign||(Math.sign=function(x){return 0===(x=Number(x))||isNaN(x)?x:x>0?1:-1}),Number.isInteger||(Number.isInteger=function(value){return"number"==typeof value&&isFinite(value)&&Math.floor(value)===value}),globalThis.ArrayBuffer||(globalThis.ArrayBuffer=Array),globalThis.Float32Array||(globalThis.Float32Array=Array),globalThis.Uint32Array||(globalThis.Uint32Array=Array),globalThis.Uint16Array||(globalThis.Uint16Array=Array),globalThis.Uint8Array||(globalThis.Uint8Array=Array),globalThis.Int32Array||(globalThis.Int32Array=Array);var appleIphone=/iPhone/i,appleIpod=/iPod/i,appleTablet=/iPad/i,appleUniversal=/\biOS-universal(?:.+)Mac\b/i,androidPhone=/\bAndroid(?:.+)Mobile\b/i,androidTablet=/Android/i,amazonPhone=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,amazonTablet=/Silk/i,windowsPhone=/Windows Phone/i,windowsTablet=/\bWindows(?:.+)ARM\b/i,otherBlackBerry=/BlackBerry/i,otherBlackBerry10=/BB10/i,otherOpera=/Opera Mini/i,otherChrome=/\b(CriOS|Chrome)(?:.+)Mobile/i,otherFirefox=/Mobile(?:.+)Firefox\b/i,isAppleTabletOnIos13=function(navigator){return void 0!==navigator&&"MacIntel"===navigator.platform&&"number"==typeof navigator.maxTouchPoints&&navigator.maxTouchPoints>1&&"undefined"==typeof MSStream};
|
|
28
29
|
/*!
|
|
29
|
-
* @pixi/settings -
|
|
30
|
-
* Compiled
|
|
30
|
+
* @pixi/settings - v6.4.2
|
|
31
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
31
32
|
*
|
|
32
33
|
* @pixi/settings is licensed under the MIT License.
|
|
33
34
|
* http://www.opensource.org/licenses/mit-license
|
|
34
35
|
*/
|
|
35
|
-
var isMobile$1=function(param){var nav={userAgent:"",platform:"",maxTouchPoints:0};param||"undefined"==typeof navigator?"string"==typeof param?nav.userAgent=param:param&¶m.userAgent&&(nav={userAgent:param.userAgent,platform:param.platform,maxTouchPoints:param.maxTouchPoints||0}):nav={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var userAgent=nav.userAgent,tmp=userAgent.split("[FBAN");void 0!==tmp[1]&&(userAgent=tmp[0]),void 0!==(tmp=userAgent.split("Twitter"))[1]&&(userAgent=tmp[0]);var match=function(userAgent){return function(regex){return regex.test(userAgent)}}(userAgent),result={apple:{phone:match(appleIphone)&&!match(windowsPhone),ipod:match(appleIpod),tablet:!match(appleIphone)&&(match(appleTablet)||isAppleTabletOnIos13(nav))&&!match(windowsPhone),universal:match(appleUniversal),device:(match(appleIphone)||match(appleIpod)||match(appleTablet)||match(appleUniversal)||isAppleTabletOnIos13(nav))&&!match(windowsPhone)},amazon:{phone:match(amazonPhone),tablet:!match(amazonPhone)&&match(amazonTablet),device:match(amazonPhone)||match(amazonTablet)},android:{phone:!match(windowsPhone)&&match(amazonPhone)||!match(windowsPhone)&&match(androidPhone),tablet:!match(windowsPhone)&&!match(amazonPhone)&&!match(androidPhone)&&(match(amazonTablet)||match(androidTablet)),device:!match(windowsPhone)&&(match(amazonPhone)||match(amazonTablet)||match(androidPhone)||match(androidTablet))||match(/\bokhttp\b/i)},windows:{phone:match(windowsPhone),tablet:match(windowsTablet),device:match(windowsPhone)||match(windowsTablet)},other:{blackberry:match(otherBlackBerry),blackberry10:match(otherBlackBerry10),opera:match(otherOpera),firefox:match(otherFirefox),chrome:match(otherChrome),device:match(otherBlackBerry)||match(otherBlackBerry10)||match(otherOpera)||match(otherFirefox)||match(otherChrome)},any:!1,phone:!1,tablet:!1};return result.any=result.apple.device||result.android.device||result.windows.device||result.other.device,result.phone=result.apple.phone||result.android.phone||result.windows.phone,result.tablet=result.apple.tablet||result.android.tablet||result.windows.tablet,result}(window.navigator);var ENV,RENDERER_TYPE,BUFFER_BITS,BLEND_MODES,DRAW_MODES,FORMATS,TARGETS,TYPES,SCALE_MODES,WRAP_MODES,MIPMAP_MODES,ALPHA_MODES,CLEAR_MODES,GC_MODES,PRECISION,MASK_TYPES,MSAA_QUALITY,settings={MIPMAP_TEXTURES:1,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,SPRITE_MAX_TEXTURES:function(max){var allowMax=!0;if(isMobile$1.tablet||isMobile$1.phone){var match;if(isMobile$1.apple.device)if(match=navigator.userAgent.match(/OS (\d+)_(\d+)?/))parseInt(match[1],10)<11&&(allowMax=!1);if(isMobile$1.android.device)if(match=navigator.userAgent.match(/Android\s([0-9.]*)/))parseInt(match[1],10)<7&&(allowMax=!1)}return allowMax?max:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,transparent:!1,backgroundColor:0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:0,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:33071,SCALE_MODE:1,PRECISION_VERTEX:"highp",PRECISION_FRAGMENT:isMobile$1.apple.device?"highp":"mediump",CAN_UPLOAD_SAME_BUFFER:!isMobile$1.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},eventemitter3=createCommonjsModule((function(module){var has=Object.prototype.hasOwnProperty,prefix="~";function Events(){}function EE(fn,context,once){this.fn=fn,this.context=context,this.once=once||!1}function addListener(emitter,event,fn,context,once){if("function"!=typeof fn)throw new TypeError("The listener must be a function");var listener=new EE(fn,context||emitter,once),evt=prefix?prefix+event:event;return emitter._events[evt]?emitter._events[evt].fn?emitter._events[evt]=[emitter._events[evt],listener]:emitter._events[evt].push(listener):(emitter._events[evt]=listener,emitter._eventsCount++),emitter}function clearEvent(emitter,evt){0==--emitter._eventsCount?emitter._events=new Events:delete emitter._events[evt]}function EventEmitter(){this._events=new Events,this._eventsCount=0}Object.create&&(Events.prototype=Object.create(null),(new Events).__proto__||(prefix=!1)),EventEmitter.prototype.eventNames=function(){var events,name,names=[];if(0===this._eventsCount)return names;for(name in events=this._events)has.call(events,name)&&names.push(prefix?name.slice(1):name);return Object.getOwnPropertySymbols?names.concat(Object.getOwnPropertySymbols(events)):names},EventEmitter.prototype.listeners=function(event){var evt=prefix?prefix+event:event,handlers=this._events[evt];if(!handlers)return[];if(handlers.fn)return[handlers.fn];for(var i=0,l=handlers.length,ee=new Array(l);i<l;i++)ee[i]=handlers[i].fn;return ee},EventEmitter.prototype.listenerCount=function(event){var evt=prefix?prefix+event:event,listeners=this._events[evt];return listeners?listeners.fn?1:listeners.length:0},EventEmitter.prototype.emit=function(event,a1,a2,a3,a4,a5){var evt=prefix?prefix+event:event;if(!this._events[evt])return!1;var args,i,listeners=this._events[evt],len=arguments.length;if(listeners.fn){switch(listeners.once&&this.removeListener(event,listeners.fn,void 0,!0),len){case 1:return listeners.fn.call(listeners.context),!0;case 2:return listeners.fn.call(listeners.context,a1),!0;case 3:return listeners.fn.call(listeners.context,a1,a2),!0;case 4:return listeners.fn.call(listeners.context,a1,a2,a3),!0;case 5:return listeners.fn.call(listeners.context,a1,a2,a3,a4),!0;case 6:return listeners.fn.call(listeners.context,a1,a2,a3,a4,a5),!0}for(i=1,args=new Array(len-1);i<len;i++)args[i-1]=arguments[i];listeners.fn.apply(listeners.context,args)}else{var j,length=listeners.length;for(i=0;i<length;i++)switch(listeners[i].once&&this.removeListener(event,listeners[i].fn,void 0,!0),len){case 1:listeners[i].fn.call(listeners[i].context);break;case 2:listeners[i].fn.call(listeners[i].context,a1);break;case 3:listeners[i].fn.call(listeners[i].context,a1,a2);break;case 4:listeners[i].fn.call(listeners[i].context,a1,a2,a3);break;default:if(!args)for(j=1,args=new Array(len-1);j<len;j++)args[j-1]=arguments[j];listeners[i].fn.apply(listeners[i].context,args)}}return!0},EventEmitter.prototype.on=function(event,fn,context){return addListener(this,event,fn,context,!1)},EventEmitter.prototype.once=function(event,fn,context){return addListener(this,event,fn,context,!0)},EventEmitter.prototype.removeListener=function(event,fn,context,once){var evt=prefix?prefix+event:event;if(!this._events[evt])return this;if(!fn)return clearEvent(this,evt),this;var listeners=this._events[evt];if(listeners.fn)listeners.fn!==fn||once&&!listeners.once||context&&listeners.context!==context||clearEvent(this,evt);else{for(var i=0,events=[],length=listeners.length;i<length;i++)(listeners[i].fn!==fn||once&&!listeners[i].once||context&&listeners[i].context!==context)&&events.push(listeners[i]);events.length?this._events[evt]=1===events.length?events[0]:events:clearEvent(this,evt)}return this},EventEmitter.prototype.removeAllListeners=function(event){var evt;return event?(evt=prefix?prefix+event:event,this._events[evt]&&clearEvent(this,evt)):(this._events=new Events,this._eventsCount=0),this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.addListener=EventEmitter.prototype.on,EventEmitter.prefixed=prefix,EventEmitter.EventEmitter=EventEmitter,module.exports=EventEmitter})),earcut_1=earcut,default_1=earcut;function earcut(data,holeIndices,dim){dim=dim||2;var minX,minY,maxX,maxY,x,y,invSize,hasHoles=holeIndices&&holeIndices.length,outerLen=hasHoles?holeIndices[0]*dim:data.length,outerNode=linkedList(data,0,outerLen,dim,!0),triangles=[];if(!outerNode||outerNode.next===outerNode.prev)return triangles;if(hasHoles&&(outerNode=function(data,holeIndices,outerNode,dim){var i,len,list,queue=[];for(i=0,len=holeIndices.length;i<len;i++)(list=linkedList(data,holeIndices[i]*dim,i<len-1?holeIndices[i+1]*dim:data.length,dim,!1))===list.next&&(list.steiner=!0),queue.push(getLeftmost(list));for(queue.sort(compareX),i=0;i<queue.length;i++)outerNode=filterPoints(outerNode=eliminateHole(queue[i],outerNode),outerNode.next);return outerNode}(data,holeIndices,outerNode,dim)),data.length>80*dim){minX=maxX=data[0],minY=maxY=data[1];for(var i=dim;i<outerLen;i+=dim)(x=data[i])<minX&&(minX=x),(y=data[i+1])<minY&&(minY=y),x>maxX&&(maxX=x),y>maxY&&(maxY=y);invSize=0!==(invSize=Math.max(maxX-minX,maxY-minY))?1/invSize:0}return earcutLinked(outerNode,triangles,dim,minX,minY,invSize),triangles}function linkedList(data,start,end,dim,clockwise){var i,last;if(clockwise===signedArea(data,start,end,dim)>0)for(i=start;i<end;i+=dim)last=insertNode(i,data[i],data[i+1],last);else for(i=end-dim;i>=start;i-=dim)last=insertNode(i,data[i],data[i+1],last);return last&&equals(last,last.next)&&(removeNode(last),last=last.next),last}function filterPoints(start,end){if(!start)return start;end||(end=start);var again,p=start;do{if(again=!1,p.steiner||!equals(p,p.next)&&0!==area(p.prev,p,p.next))p=p.next;else{if(removeNode(p),(p=end=p.prev)===p.next)break;again=!0}}while(again||p!==end);return end}function earcutLinked(ear,triangles,dim,minX,minY,invSize,pass){if(ear){!pass&&invSize&&function(start,minX,minY,invSize){var p=start;do{null===p.z&&(p.z=zOrder(p.x,p.y,minX,minY,invSize)),p.prevZ=p.prev,p.nextZ=p.next,p=p.next}while(p!==start);p.prevZ.nextZ=null,p.prevZ=null,function(list){var i,p,q,e,tail,numMerges,pSize,qSize,inSize=1;do{for(p=list,list=null,tail=null,numMerges=0;p;){for(numMerges++,q=p,pSize=0,i=0;i<inSize&&(pSize++,q=q.nextZ);i++);for(qSize=inSize;pSize>0||qSize>0&&q;)0!==pSize&&(0===qSize||!q||p.z<=q.z)?(e=p,p=p.nextZ,pSize--):(e=q,q=q.nextZ,qSize--),tail?tail.nextZ=e:list=e,e.prevZ=tail,tail=e;p=q}tail.nextZ=null,inSize*=2}while(numMerges>1)}(p)}(ear,minX,minY,invSize);for(var prev,next,stop=ear;ear.prev!==ear.next;)if(prev=ear.prev,next=ear.next,invSize?isEarHashed(ear,minX,minY,invSize):isEar(ear))triangles.push(prev.i/dim),triangles.push(ear.i/dim),triangles.push(next.i/dim),removeNode(ear),ear=next.next,stop=next.next;else if((ear=next)===stop){pass?1===pass?earcutLinked(ear=cureLocalIntersections(filterPoints(ear),triangles,dim),triangles,dim,minX,minY,invSize,2):2===pass&&splitEarcut(ear,triangles,dim,minX,minY,invSize):earcutLinked(filterPoints(ear),triangles,dim,minX,minY,invSize,1);break}}}function isEar(ear){var a=ear.prev,b=ear,c=ear.next;if(area(a,b,c)>=0)return!1;for(var p=ear.next.next;p!==ear.prev;){if(pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function isEarHashed(ear,minX,minY,invSize){var a=ear.prev,b=ear,c=ear.next;if(area(a,b,c)>=0)return!1;for(var minTX=a.x<b.x?a.x<c.x?a.x:c.x:b.x<c.x?b.x:c.x,minTY=a.y<b.y?a.y<c.y?a.y:c.y:b.y<c.y?b.y:c.y,maxTX=a.x>b.x?a.x>c.x?a.x:c.x:b.x>c.x?b.x:c.x,maxTY=a.y>b.y?a.y>c.y?a.y:c.y:b.y>c.y?b.y:c.y,minZ=zOrder(minTX,minTY,minX,minY,invSize),maxZ=zOrder(maxTX,maxTY,minX,minY,invSize),p=ear.prevZ,n=ear.nextZ;p&&p.z>=minZ&&n&&n.z<=maxZ;){if(p!==ear.prev&&p!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,n!==ear.prev&&n!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,n.x,n.y)&&area(n.prev,n,n.next)>=0)return!1;n=n.nextZ}for(;p&&p.z>=minZ;){if(p!==ear.prev&&p!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;n&&n.z<=maxZ;){if(n!==ear.prev&&n!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,n.x,n.y)&&area(n.prev,n,n.next)>=0)return!1;n=n.nextZ}return!0}function cureLocalIntersections(start,triangles,dim){var p=start;do{var a=p.prev,b=p.next.next;!equals(a,b)&&intersects(a,p,p.next,b)&&locallyInside(a,b)&&locallyInside(b,a)&&(triangles.push(a.i/dim),triangles.push(p.i/dim),triangles.push(b.i/dim),removeNode(p),removeNode(p.next),p=start=b),p=p.next}while(p!==start);return filterPoints(p)}function splitEarcut(start,triangles,dim,minX,minY,invSize){var a=start;do{for(var b=a.next.next;b!==a.prev;){if(a.i!==b.i&&isValidDiagonal(a,b)){var c=splitPolygon(a,b);return a=filterPoints(a,a.next),c=filterPoints(c,c.next),earcutLinked(a,triangles,dim,minX,minY,invSize),void earcutLinked(c,triangles,dim,minX,minY,invSize)}b=b.next}a=a.next}while(a!==start)}function compareX(a,b){return a.x-b.x}function eliminateHole(hole,outerNode){var bridge=function(hole,outerNode){var m,p=outerNode,hx=hole.x,hy=hole.y,qx=-1/0;do{if(hy<=p.y&&hy>=p.next.y&&p.next.y!==p.y){var x=p.x+(hy-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(x<=hx&&x>qx){if(qx=x,x===hx){if(hy===p.y)return p;if(hy===p.next.y)return p.next}m=p.x<p.next.x?p:p.next}}p=p.next}while(p!==outerNode);if(!m)return null;if(hx===qx)return m;var tan,stop=m,mx=m.x,my=m.y,tanMin=1/0;p=m;do{hx>=p.x&&p.x>=mx&&hx!==p.x&&pointInTriangle(hy<my?hx:qx,hy,mx,my,hy<my?qx:hx,hy,p.x,p.y)&&(tan=Math.abs(hy-p.y)/(hx-p.x),locallyInside(p,hole)&&(tan<tanMin||tan===tanMin&&(p.x>m.x||p.x===m.x&§orContainsSector(m,p)))&&(m=p,tanMin=tan)),p=p.next}while(p!==stop);return m}(hole,outerNode);if(!bridge)return outerNode;var bridgeReverse=splitPolygon(bridge,hole),filteredBridge=filterPoints(bridge,bridge.next);return filterPoints(bridgeReverse,bridgeReverse.next),outerNode===bridge?filteredBridge:outerNode}function sectorContainsSector(m,p){return area(m.prev,m,p.prev)<0&&area(p.next,m,m.next)<0}function zOrder(x,y,minX,minY,invSize){return(x=1431655765&((x=858993459&((x=252645135&((x=16711935&((x=32767*(x-minX)*invSize)|x<<8))|x<<4))|x<<2))|x<<1))|(y=1431655765&((y=858993459&((y=252645135&((y=16711935&((y=32767*(y-minY)*invSize)|y<<8))|y<<4))|y<<2))|y<<1))<<1}function getLeftmost(start){var p=start,leftmost=start;do{(p.x<leftmost.x||p.x===leftmost.x&&p.y<leftmost.y)&&(leftmost=p),p=p.next}while(p!==start);return leftmost}function pointInTriangle(ax,ay,bx,by,cx,cy,px,py){return(cx-px)*(ay-py)-(ax-px)*(cy-py)>=0&&(ax-px)*(by-py)-(bx-px)*(ay-py)>=0&&(bx-px)*(cy-py)-(cx-px)*(by-py)>=0}function isValidDiagonal(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!function(a,b){var p=a;do{if(p.i!==a.i&&p.next.i!==a.i&&p.i!==b.i&&p.next.i!==b.i&&intersects(p,p.next,a,b))return!0;p=p.next}while(p!==a);return!1}(a,b)&&(locallyInside(a,b)&&locallyInside(b,a)&&function(a,b){var p=a,inside=!1,px=(a.x+b.x)/2,py=(a.y+b.y)/2;do{p.y>py!=p.next.y>py&&p.next.y!==p.y&&px<(p.next.x-p.x)*(py-p.y)/(p.next.y-p.y)+p.x&&(inside=!inside),p=p.next}while(p!==a);return inside}(a,b)&&(area(a.prev,a,b.prev)||area(a,b.prev,b))||equals(a,b)&&area(a.prev,a,a.next)>0&&area(b.prev,b,b.next)>0)}function area(p,q,r){return(q.y-p.y)*(r.x-q.x)-(q.x-p.x)*(r.y-q.y)}function equals(p1,p2){return p1.x===p2.x&&p1.y===p2.y}function intersects(p1,q1,p2,q2){var o1=sign$1(area(p1,q1,p2)),o2=sign$1(area(p1,q1,q2)),o3=sign$1(area(p2,q2,p1)),o4=sign$1(area(p2,q2,q1));return o1!==o2&&o3!==o4||(!(0!==o1||!onSegment(p1,p2,q1))||(!(0!==o2||!onSegment(p1,q2,q1))||(!(0!==o3||!onSegment(p2,p1,q2))||!(0!==o4||!onSegment(p2,q1,q2)))))}function onSegment(p,q,r){return q.x<=Math.max(p.x,r.x)&&q.x>=Math.min(p.x,r.x)&&q.y<=Math.max(p.y,r.y)&&q.y>=Math.min(p.y,r.y)}function sign$1(num){return num>0?1:num<0?-1:0}function locallyInside(a,b){return area(a.prev,a,a.next)<0?area(a,b,a.next)>=0&&area(a,a.prev,b)>=0:area(a,b,a.prev)<0||area(a,a.next,b)<0}function splitPolygon(a,b){var a2=new Node(a.i,a.x,a.y),b2=new Node(b.i,b.x,b.y),an=a.next,bp=b.prev;return a.next=b,b.prev=a,a2.next=an,an.prev=a2,b2.next=a2,a2.prev=b2,bp.next=b2,b2.prev=bp,b2}function insertNode(i,x,y,last){var p=new Node(i,x,y);return last?(p.next=last.next,p.prev=last,last.next.prev=p,last.next=p):(p.prev=p,p.next=p),p}function removeNode(p){p.next.prev=p.prev,p.prev.next=p.next,p.prevZ&&(p.prevZ.nextZ=p.nextZ),p.nextZ&&(p.nextZ.prevZ=p.prevZ)}function Node(i,x,y){this.i=i,this.x=x,this.y=y,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(data,start,end,dim){for(var sum=0,i=start,j=end-dim;i<end;i+=dim)sum+=(data[j]-data[i])*(data[i+1]+data[j+1]),j=i;return sum}earcut.deviation=function(data,holeIndices,dim,triangles){var hasHoles=holeIndices&&holeIndices.length,outerLen=hasHoles?holeIndices[0]*dim:data.length,polygonArea=Math.abs(signedArea(data,0,outerLen,dim));if(hasHoles)for(var i=0,len=holeIndices.length;i<len;i++){var start=holeIndices[i]*dim,end=i<len-1?holeIndices[i+1]*dim:data.length;polygonArea-=Math.abs(signedArea(data,start,end,dim))}var trianglesArea=0;for(i=0;i<triangles.length;i+=3){var a=triangles[i]*dim,b=triangles[i+1]*dim,c=triangles[i+2]*dim;trianglesArea+=Math.abs((data[a]-data[c])*(data[b+1]-data[a+1])-(data[a]-data[b])*(data[c+1]-data[a+1]))}return 0===polygonArea&&0===trianglesArea?0:Math.abs((trianglesArea-polygonArea)/polygonArea)},earcut.flatten=function(data){for(var dim=data[0][0].length,result={vertices:[],holes:[],dimensions:dim},holeIndex=0,i=0;i<data.length;i++){for(var j=0;j<data[i].length;j++)for(var d=0;d<dim;d++)result.vertices.push(data[i][j][d]);i>0&&(holeIndex+=data[i-1].length,result.holes.push(holeIndex))}return result},earcut_1.default=default_1,function(ENV){ENV[ENV.WEBGL_LEGACY=0]="WEBGL_LEGACY",ENV[ENV.WEBGL=1]="WEBGL",ENV[ENV.WEBGL2=2]="WEBGL2"}(ENV||(ENV={})),function(RENDERER_TYPE){RENDERER_TYPE[RENDERER_TYPE.UNKNOWN=0]="UNKNOWN",RENDERER_TYPE[RENDERER_TYPE.WEBGL=1]="WEBGL",RENDERER_TYPE[RENDERER_TYPE.CANVAS=2]="CANVAS"}(RENDERER_TYPE||(RENDERER_TYPE={})),function(BUFFER_BITS){BUFFER_BITS[BUFFER_BITS.COLOR=16384]="COLOR",BUFFER_BITS[BUFFER_BITS.DEPTH=256]="DEPTH",BUFFER_BITS[BUFFER_BITS.STENCIL=1024]="STENCIL"}(BUFFER_BITS||(BUFFER_BITS={})),function(BLEND_MODES){BLEND_MODES[BLEND_MODES.NORMAL=0]="NORMAL",BLEND_MODES[BLEND_MODES.ADD=1]="ADD",BLEND_MODES[BLEND_MODES.MULTIPLY=2]="MULTIPLY",BLEND_MODES[BLEND_MODES.SCREEN=3]="SCREEN",BLEND_MODES[BLEND_MODES.OVERLAY=4]="OVERLAY",BLEND_MODES[BLEND_MODES.DARKEN=5]="DARKEN",BLEND_MODES[BLEND_MODES.LIGHTEN=6]="LIGHTEN",BLEND_MODES[BLEND_MODES.COLOR_DODGE=7]="COLOR_DODGE",BLEND_MODES[BLEND_MODES.COLOR_BURN=8]="COLOR_BURN",BLEND_MODES[BLEND_MODES.HARD_LIGHT=9]="HARD_LIGHT",BLEND_MODES[BLEND_MODES.SOFT_LIGHT=10]="SOFT_LIGHT",BLEND_MODES[BLEND_MODES.DIFFERENCE=11]="DIFFERENCE",BLEND_MODES[BLEND_MODES.EXCLUSION=12]="EXCLUSION",BLEND_MODES[BLEND_MODES.HUE=13]="HUE",BLEND_MODES[BLEND_MODES.SATURATION=14]="SATURATION",BLEND_MODES[BLEND_MODES.COLOR=15]="COLOR",BLEND_MODES[BLEND_MODES.LUMINOSITY=16]="LUMINOSITY",BLEND_MODES[BLEND_MODES.NORMAL_NPM=17]="NORMAL_NPM",BLEND_MODES[BLEND_MODES.ADD_NPM=18]="ADD_NPM",BLEND_MODES[BLEND_MODES.SCREEN_NPM=19]="SCREEN_NPM",BLEND_MODES[BLEND_MODES.NONE=20]="NONE",BLEND_MODES[BLEND_MODES.SRC_OVER=0]="SRC_OVER",BLEND_MODES[BLEND_MODES.SRC_IN=21]="SRC_IN",BLEND_MODES[BLEND_MODES.SRC_OUT=22]="SRC_OUT",BLEND_MODES[BLEND_MODES.SRC_ATOP=23]="SRC_ATOP",BLEND_MODES[BLEND_MODES.DST_OVER=24]="DST_OVER",BLEND_MODES[BLEND_MODES.DST_IN=25]="DST_IN",BLEND_MODES[BLEND_MODES.DST_OUT=26]="DST_OUT",BLEND_MODES[BLEND_MODES.DST_ATOP=27]="DST_ATOP",BLEND_MODES[BLEND_MODES.ERASE=26]="ERASE",BLEND_MODES[BLEND_MODES.SUBTRACT=28]="SUBTRACT",BLEND_MODES[BLEND_MODES.XOR=29]="XOR"}(BLEND_MODES||(BLEND_MODES={})),function(DRAW_MODES){DRAW_MODES[DRAW_MODES.POINTS=0]="POINTS",DRAW_MODES[DRAW_MODES.LINES=1]="LINES",DRAW_MODES[DRAW_MODES.LINE_LOOP=2]="LINE_LOOP",DRAW_MODES[DRAW_MODES.LINE_STRIP=3]="LINE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLES=4]="TRIANGLES",DRAW_MODES[DRAW_MODES.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(DRAW_MODES||(DRAW_MODES={})),function(FORMATS){FORMATS[FORMATS.RGBA=6408]="RGBA",FORMATS[FORMATS.RGB=6407]="RGB",FORMATS[FORMATS.ALPHA=6406]="ALPHA",FORMATS[FORMATS.LUMINANCE=6409]="LUMINANCE",FORMATS[FORMATS.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",FORMATS[FORMATS.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",FORMATS[FORMATS.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(FORMATS||(FORMATS={})),function(TARGETS){TARGETS[TARGETS.TEXTURE_2D=3553]="TEXTURE_2D",TARGETS[TARGETS.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",TARGETS[TARGETS.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(TARGETS||(TARGETS={})),function(TYPES){TYPES[TYPES.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",TYPES[TYPES.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",TYPES[TYPES.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",TYPES[TYPES.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",TYPES[TYPES.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",TYPES[TYPES.FLOAT=5126]="FLOAT",TYPES[TYPES.HALF_FLOAT=36193]="HALF_FLOAT"}(TYPES||(TYPES={})),function(SCALE_MODES){SCALE_MODES[SCALE_MODES.NEAREST=0]="NEAREST",SCALE_MODES[SCALE_MODES.LINEAR=1]="LINEAR"}(SCALE_MODES||(SCALE_MODES={})),function(WRAP_MODES){WRAP_MODES[WRAP_MODES.CLAMP=33071]="CLAMP",WRAP_MODES[WRAP_MODES.REPEAT=10497]="REPEAT",WRAP_MODES[WRAP_MODES.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(WRAP_MODES||(WRAP_MODES={})),function(MIPMAP_MODES){MIPMAP_MODES[MIPMAP_MODES.OFF=0]="OFF",MIPMAP_MODES[MIPMAP_MODES.POW2=1]="POW2",MIPMAP_MODES[MIPMAP_MODES.ON=2]="ON"}(MIPMAP_MODES||(MIPMAP_MODES={})),function(ALPHA_MODES){ALPHA_MODES[ALPHA_MODES.NPM=0]="NPM",ALPHA_MODES[ALPHA_MODES.UNPACK=1]="UNPACK",ALPHA_MODES[ALPHA_MODES.PMA=2]="PMA",ALPHA_MODES[ALPHA_MODES.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA"}(ALPHA_MODES||(ALPHA_MODES={})),function(CLEAR_MODES){CLEAR_MODES[CLEAR_MODES.NO=0]="NO",CLEAR_MODES[CLEAR_MODES.YES=1]="YES",CLEAR_MODES[CLEAR_MODES.AUTO=2]="AUTO",CLEAR_MODES[CLEAR_MODES.BLEND=0]="BLEND",CLEAR_MODES[CLEAR_MODES.CLEAR=1]="CLEAR",CLEAR_MODES[CLEAR_MODES.BLIT=2]="BLIT"}(CLEAR_MODES||(CLEAR_MODES={})),function(GC_MODES){GC_MODES[GC_MODES.AUTO=0]="AUTO",GC_MODES[GC_MODES.MANUAL=1]="MANUAL"}(GC_MODES||(GC_MODES={})),function(PRECISION){PRECISION.LOW="lowp",PRECISION.MEDIUM="mediump",PRECISION.HIGH="highp"}(PRECISION||(PRECISION={})),function(MASK_TYPES){MASK_TYPES[MASK_TYPES.NONE=0]="NONE",MASK_TYPES[MASK_TYPES.SCISSOR=1]="SCISSOR",MASK_TYPES[MASK_TYPES.STENCIL=2]="STENCIL",MASK_TYPES[MASK_TYPES.SPRITE=3]="SPRITE"}(MASK_TYPES||(MASK_TYPES={})),function(MSAA_QUALITY){MSAA_QUALITY[MSAA_QUALITY.NONE=0]="NONE",MSAA_QUALITY[MSAA_QUALITY.LOW=2]="LOW",MSAA_QUALITY[MSAA_QUALITY.MEDIUM=4]="MEDIUM",MSAA_QUALITY[MSAA_QUALITY.HIGH=8]="HIGH"}(MSAA_QUALITY||(MSAA_QUALITY={})),
|
|
36
|
+
var ENV,RENDERER_TYPE,BUFFER_BITS,BLEND_MODES,DRAW_MODES,FORMATS,TARGETS,TYPES,SAMPLER_TYPES,SCALE_MODES,WRAP_MODES,MIPMAP_MODES,ALPHA_MODES,CLEAR_MODES,GC_MODES,PRECISION,MASK_TYPES,MSAA_QUALITY,BUFFER_TYPE,isMobile$1=function(param){var nav={userAgent:"",platform:"",maxTouchPoints:0};param||"undefined"==typeof navigator?"string"==typeof param?nav.userAgent=param:param&¶m.userAgent&&(nav={userAgent:param.userAgent,platform:param.platform,maxTouchPoints:param.maxTouchPoints||0}):nav={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var userAgent=nav.userAgent,tmp=userAgent.split("[FBAN");void 0!==tmp[1]&&(userAgent=tmp[0]),void 0!==(tmp=userAgent.split("Twitter"))[1]&&(userAgent=tmp[0]);var match=function(userAgent){return function(regex){return regex.test(userAgent)}}(userAgent),result={apple:{phone:match(appleIphone)&&!match(windowsPhone),ipod:match(appleIpod),tablet:!match(appleIphone)&&(match(appleTablet)||isAppleTabletOnIos13(nav))&&!match(windowsPhone),universal:match(appleUniversal),device:(match(appleIphone)||match(appleIpod)||match(appleTablet)||match(appleUniversal)||isAppleTabletOnIos13(nav))&&!match(windowsPhone)},amazon:{phone:match(amazonPhone),tablet:!match(amazonPhone)&&match(amazonTablet),device:match(amazonPhone)||match(amazonTablet)},android:{phone:!match(windowsPhone)&&match(amazonPhone)||!match(windowsPhone)&&match(androidPhone),tablet:!match(windowsPhone)&&!match(amazonPhone)&&!match(androidPhone)&&(match(amazonTablet)||match(androidTablet)),device:!match(windowsPhone)&&(match(amazonPhone)||match(amazonTablet)||match(androidPhone)||match(androidTablet))||match(/\bokhttp\b/i)},windows:{phone:match(windowsPhone),tablet:match(windowsTablet),device:match(windowsPhone)||match(windowsTablet)},other:{blackberry:match(otherBlackBerry),blackberry10:match(otherBlackBerry10),opera:match(otherOpera),firefox:match(otherFirefox),chrome:match(otherChrome),device:match(otherBlackBerry)||match(otherBlackBerry10)||match(otherOpera)||match(otherFirefox)||match(otherChrome)},any:!1,phone:!1,tablet:!1};return result.any=result.apple.device||result.android.device||result.windows.device||result.other.device,result.phone=result.apple.phone||result.android.phone||result.windows.phone,result.tablet=result.apple.tablet||result.android.tablet||result.windows.tablet,result}(globalThis.navigator);!function(ENV){ENV[ENV.WEBGL_LEGACY=0]="WEBGL_LEGACY",ENV[ENV.WEBGL=1]="WEBGL",ENV[ENV.WEBGL2=2]="WEBGL2"}(ENV||(ENV={})),function(RENDERER_TYPE){RENDERER_TYPE[RENDERER_TYPE.UNKNOWN=0]="UNKNOWN",RENDERER_TYPE[RENDERER_TYPE.WEBGL=1]="WEBGL",RENDERER_TYPE[RENDERER_TYPE.CANVAS=2]="CANVAS"}(RENDERER_TYPE||(RENDERER_TYPE={})),function(BUFFER_BITS){BUFFER_BITS[BUFFER_BITS.COLOR=16384]="COLOR",BUFFER_BITS[BUFFER_BITS.DEPTH=256]="DEPTH",BUFFER_BITS[BUFFER_BITS.STENCIL=1024]="STENCIL"}(BUFFER_BITS||(BUFFER_BITS={})),function(BLEND_MODES){BLEND_MODES[BLEND_MODES.NORMAL=0]="NORMAL",BLEND_MODES[BLEND_MODES.ADD=1]="ADD",BLEND_MODES[BLEND_MODES.MULTIPLY=2]="MULTIPLY",BLEND_MODES[BLEND_MODES.SCREEN=3]="SCREEN",BLEND_MODES[BLEND_MODES.OVERLAY=4]="OVERLAY",BLEND_MODES[BLEND_MODES.DARKEN=5]="DARKEN",BLEND_MODES[BLEND_MODES.LIGHTEN=6]="LIGHTEN",BLEND_MODES[BLEND_MODES.COLOR_DODGE=7]="COLOR_DODGE",BLEND_MODES[BLEND_MODES.COLOR_BURN=8]="COLOR_BURN",BLEND_MODES[BLEND_MODES.HARD_LIGHT=9]="HARD_LIGHT",BLEND_MODES[BLEND_MODES.SOFT_LIGHT=10]="SOFT_LIGHT",BLEND_MODES[BLEND_MODES.DIFFERENCE=11]="DIFFERENCE",BLEND_MODES[BLEND_MODES.EXCLUSION=12]="EXCLUSION",BLEND_MODES[BLEND_MODES.HUE=13]="HUE",BLEND_MODES[BLEND_MODES.SATURATION=14]="SATURATION",BLEND_MODES[BLEND_MODES.COLOR=15]="COLOR",BLEND_MODES[BLEND_MODES.LUMINOSITY=16]="LUMINOSITY",BLEND_MODES[BLEND_MODES.NORMAL_NPM=17]="NORMAL_NPM",BLEND_MODES[BLEND_MODES.ADD_NPM=18]="ADD_NPM",BLEND_MODES[BLEND_MODES.SCREEN_NPM=19]="SCREEN_NPM",BLEND_MODES[BLEND_MODES.NONE=20]="NONE",BLEND_MODES[BLEND_MODES.SRC_OVER=0]="SRC_OVER",BLEND_MODES[BLEND_MODES.SRC_IN=21]="SRC_IN",BLEND_MODES[BLEND_MODES.SRC_OUT=22]="SRC_OUT",BLEND_MODES[BLEND_MODES.SRC_ATOP=23]="SRC_ATOP",BLEND_MODES[BLEND_MODES.DST_OVER=24]="DST_OVER",BLEND_MODES[BLEND_MODES.DST_IN=25]="DST_IN",BLEND_MODES[BLEND_MODES.DST_OUT=26]="DST_OUT",BLEND_MODES[BLEND_MODES.DST_ATOP=27]="DST_ATOP",BLEND_MODES[BLEND_MODES.ERASE=26]="ERASE",BLEND_MODES[BLEND_MODES.SUBTRACT=28]="SUBTRACT",BLEND_MODES[BLEND_MODES.XOR=29]="XOR"}(BLEND_MODES||(BLEND_MODES={})),function(DRAW_MODES){DRAW_MODES[DRAW_MODES.POINTS=0]="POINTS",DRAW_MODES[DRAW_MODES.LINES=1]="LINES",DRAW_MODES[DRAW_MODES.LINE_LOOP=2]="LINE_LOOP",DRAW_MODES[DRAW_MODES.LINE_STRIP=3]="LINE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLES=4]="TRIANGLES",DRAW_MODES[DRAW_MODES.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(DRAW_MODES||(DRAW_MODES={})),function(FORMATS){FORMATS[FORMATS.RGBA=6408]="RGBA",FORMATS[FORMATS.RGB=6407]="RGB",FORMATS[FORMATS.RG=33319]="RG",FORMATS[FORMATS.RED=6403]="RED",FORMATS[FORMATS.RGBA_INTEGER=36249]="RGBA_INTEGER",FORMATS[FORMATS.RGB_INTEGER=36248]="RGB_INTEGER",FORMATS[FORMATS.RG_INTEGER=33320]="RG_INTEGER",FORMATS[FORMATS.RED_INTEGER=36244]="RED_INTEGER",FORMATS[FORMATS.ALPHA=6406]="ALPHA",FORMATS[FORMATS.LUMINANCE=6409]="LUMINANCE",FORMATS[FORMATS.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",FORMATS[FORMATS.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",FORMATS[FORMATS.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(FORMATS||(FORMATS={})),function(TARGETS){TARGETS[TARGETS.TEXTURE_2D=3553]="TEXTURE_2D",TARGETS[TARGETS.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",TARGETS[TARGETS.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(TARGETS||(TARGETS={})),function(TYPES){TYPES[TYPES.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",TYPES[TYPES.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",TYPES[TYPES.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",TYPES[TYPES.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",TYPES[TYPES.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",TYPES[TYPES.UNSIGNED_INT=5125]="UNSIGNED_INT",TYPES[TYPES.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",TYPES[TYPES.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",TYPES[TYPES.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",TYPES[TYPES.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",TYPES[TYPES.BYTE=5120]="BYTE",TYPES[TYPES.SHORT=5122]="SHORT",TYPES[TYPES.INT=5124]="INT",TYPES[TYPES.FLOAT=5126]="FLOAT",TYPES[TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",TYPES[TYPES.HALF_FLOAT=36193]="HALF_FLOAT"}(TYPES||(TYPES={})),function(SAMPLER_TYPES){SAMPLER_TYPES[SAMPLER_TYPES.FLOAT=0]="FLOAT",SAMPLER_TYPES[SAMPLER_TYPES.INT=1]="INT",SAMPLER_TYPES[SAMPLER_TYPES.UINT=2]="UINT"}(SAMPLER_TYPES||(SAMPLER_TYPES={})),function(SCALE_MODES){SCALE_MODES[SCALE_MODES.NEAREST=0]="NEAREST",SCALE_MODES[SCALE_MODES.LINEAR=1]="LINEAR"}(SCALE_MODES||(SCALE_MODES={})),function(WRAP_MODES){WRAP_MODES[WRAP_MODES.CLAMP=33071]="CLAMP",WRAP_MODES[WRAP_MODES.REPEAT=10497]="REPEAT",WRAP_MODES[WRAP_MODES.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(WRAP_MODES||(WRAP_MODES={})),function(MIPMAP_MODES){MIPMAP_MODES[MIPMAP_MODES.OFF=0]="OFF",MIPMAP_MODES[MIPMAP_MODES.POW2=1]="POW2",MIPMAP_MODES[MIPMAP_MODES.ON=2]="ON",MIPMAP_MODES[MIPMAP_MODES.ON_MANUAL=3]="ON_MANUAL"}(MIPMAP_MODES||(MIPMAP_MODES={})),function(ALPHA_MODES){ALPHA_MODES[ALPHA_MODES.NPM=0]="NPM",ALPHA_MODES[ALPHA_MODES.UNPACK=1]="UNPACK",ALPHA_MODES[ALPHA_MODES.PMA=2]="PMA",ALPHA_MODES[ALPHA_MODES.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"}(ALPHA_MODES||(ALPHA_MODES={})),function(CLEAR_MODES){CLEAR_MODES[CLEAR_MODES.NO=0]="NO",CLEAR_MODES[CLEAR_MODES.YES=1]="YES",CLEAR_MODES[CLEAR_MODES.AUTO=2]="AUTO",CLEAR_MODES[CLEAR_MODES.BLEND=0]="BLEND",CLEAR_MODES[CLEAR_MODES.CLEAR=1]="CLEAR",CLEAR_MODES[CLEAR_MODES.BLIT=2]="BLIT"}(CLEAR_MODES||(CLEAR_MODES={})),function(GC_MODES){GC_MODES[GC_MODES.AUTO=0]="AUTO",GC_MODES[GC_MODES.MANUAL=1]="MANUAL"}(GC_MODES||(GC_MODES={})),function(PRECISION){PRECISION.LOW="lowp",PRECISION.MEDIUM="mediump",PRECISION.HIGH="highp"}(PRECISION||(PRECISION={})),function(MASK_TYPES){MASK_TYPES[MASK_TYPES.NONE=0]="NONE",MASK_TYPES[MASK_TYPES.SCISSOR=1]="SCISSOR",MASK_TYPES[MASK_TYPES.STENCIL=2]="STENCIL",MASK_TYPES[MASK_TYPES.SPRITE=3]="SPRITE"}(MASK_TYPES||(MASK_TYPES={})),function(MSAA_QUALITY){MSAA_QUALITY[MSAA_QUALITY.NONE=0]="NONE",MSAA_QUALITY[MSAA_QUALITY.LOW=2]="LOW",MSAA_QUALITY[MSAA_QUALITY.MEDIUM=4]="MEDIUM",MSAA_QUALITY[MSAA_QUALITY.HIGH=8]="HIGH"}(MSAA_QUALITY||(MSAA_QUALITY={})),function(BUFFER_TYPE){BUFFER_TYPE[BUFFER_TYPE.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",BUFFER_TYPE[BUFFER_TYPE.ARRAY_BUFFER=34962]="ARRAY_BUFFER",BUFFER_TYPE[BUFFER_TYPE.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"}(BUFFER_TYPE||(BUFFER_TYPE={}));var settings={MIPMAP_TEXTURES:MIPMAP_MODES.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:MSAA_QUALITY.NONE,SPRITE_MAX_TEXTURES:function(max){var allowMax=!0;if(isMobile$1.tablet||isMobile$1.phone){var match;if(isMobile$1.apple.device)if(match=navigator.userAgent.match(/OS (\d+)_(\d+)?/))parseInt(match[1],10)<11&&(allowMax=!1);if(isMobile$1.android.device)if(match=navigator.userAgent.match(/Android\s([0-9.]*)/))parseInt(match[1],10)<7&&(allowMax=!1)}return allowMax?max:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:GC_MODES.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:WRAP_MODES.CLAMP,SCALE_MODE:SCALE_MODES.LINEAR,PRECISION_VERTEX:PRECISION.HIGH,PRECISION_FRAGMENT:isMobile$1.apple.device?PRECISION.HIGH:PRECISION.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!isMobile$1.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var ENV$1,RENDERER_TYPE$1,BUFFER_BITS$1,BLEND_MODES$1,DRAW_MODES$1,FORMATS$1,TARGETS$1,TYPES$1,SAMPLER_TYPES$1,SCALE_MODES$1,WRAP_MODES$1,MIPMAP_MODES$1,ALPHA_MODES$1,CLEAR_MODES$1,GC_MODES$1,PRECISION$1,MASK_TYPES$1,MSAA_QUALITY$1,BUFFER_TYPE$1,eventemitter3=function(fn,module){return fn(module={exports:{}},module.exports),module.exports}((function(module){var has=Object.prototype.hasOwnProperty,prefix="~";function Events(){}function EE(fn,context,once){this.fn=fn,this.context=context,this.once=once||!1}function addListener(emitter,event,fn,context,once){if("function"!=typeof fn)throw new TypeError("The listener must be a function");var listener=new EE(fn,context||emitter,once),evt=prefix?prefix+event:event;return emitter._events[evt]?emitter._events[evt].fn?emitter._events[evt]=[emitter._events[evt],listener]:emitter._events[evt].push(listener):(emitter._events[evt]=listener,emitter._eventsCount++),emitter}function clearEvent(emitter,evt){0==--emitter._eventsCount?emitter._events=new Events:delete emitter._events[evt]}function EventEmitter(){this._events=new Events,this._eventsCount=0}Object.create&&(Events.prototype=Object.create(null),(new Events).__proto__||(prefix=!1)),EventEmitter.prototype.eventNames=function(){var events,name,names=[];if(0===this._eventsCount)return names;for(name in events=this._events)has.call(events,name)&&names.push(prefix?name.slice(1):name);return Object.getOwnPropertySymbols?names.concat(Object.getOwnPropertySymbols(events)):names},EventEmitter.prototype.listeners=function(event){var evt=prefix?prefix+event:event,handlers=this._events[evt];if(!handlers)return[];if(handlers.fn)return[handlers.fn];for(var i=0,l=handlers.length,ee=new Array(l);i<l;i++)ee[i]=handlers[i].fn;return ee},EventEmitter.prototype.listenerCount=function(event){var evt=prefix?prefix+event:event,listeners=this._events[evt];return listeners?listeners.fn?1:listeners.length:0},EventEmitter.prototype.emit=function(event,a1,a2,a3,a4,a5){var evt=prefix?prefix+event:event;if(!this._events[evt])return!1;var args,i,listeners=this._events[evt],len=arguments.length;if(listeners.fn){switch(listeners.once&&this.removeListener(event,listeners.fn,void 0,!0),len){case 1:return listeners.fn.call(listeners.context),!0;case 2:return listeners.fn.call(listeners.context,a1),!0;case 3:return listeners.fn.call(listeners.context,a1,a2),!0;case 4:return listeners.fn.call(listeners.context,a1,a2,a3),!0;case 5:return listeners.fn.call(listeners.context,a1,a2,a3,a4),!0;case 6:return listeners.fn.call(listeners.context,a1,a2,a3,a4,a5),!0}for(i=1,args=new Array(len-1);i<len;i++)args[i-1]=arguments[i];listeners.fn.apply(listeners.context,args)}else{var j,length=listeners.length;for(i=0;i<length;i++)switch(listeners[i].once&&this.removeListener(event,listeners[i].fn,void 0,!0),len){case 1:listeners[i].fn.call(listeners[i].context);break;case 2:listeners[i].fn.call(listeners[i].context,a1);break;case 3:listeners[i].fn.call(listeners[i].context,a1,a2);break;case 4:listeners[i].fn.call(listeners[i].context,a1,a2,a3);break;default:if(!args)for(j=1,args=new Array(len-1);j<len;j++)args[j-1]=arguments[j];listeners[i].fn.apply(listeners[i].context,args)}}return!0},EventEmitter.prototype.on=function(event,fn,context){return addListener(this,event,fn,context,!1)},EventEmitter.prototype.once=function(event,fn,context){return addListener(this,event,fn,context,!0)},EventEmitter.prototype.removeListener=function(event,fn,context,once){var evt=prefix?prefix+event:event;if(!this._events[evt])return this;if(!fn)return clearEvent(this,evt),this;var listeners=this._events[evt];if(listeners.fn)listeners.fn!==fn||once&&!listeners.once||context&&listeners.context!==context||clearEvent(this,evt);else{for(var i=0,events=[],length=listeners.length;i<length;i++)(listeners[i].fn!==fn||once&&!listeners[i].once||context&&listeners[i].context!==context)&&events.push(listeners[i]);events.length?this._events[evt]=1===events.length?events[0]:events:clearEvent(this,evt)}return this},EventEmitter.prototype.removeAllListeners=function(event){var evt;return event?(evt=prefix?prefix+event:event,this._events[evt]&&clearEvent(this,evt)):(this._events=new Events,this._eventsCount=0),this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.addListener=EventEmitter.prototype.on,EventEmitter.prefixed=prefix,EventEmitter.EventEmitter=EventEmitter,module.exports=EventEmitter})),earcut_1=earcut,default_1=earcut;function earcut(data,holeIndices,dim){dim=dim||2;var minX,minY,maxX,maxY,x,y,invSize,hasHoles=holeIndices&&holeIndices.length,outerLen=hasHoles?holeIndices[0]*dim:data.length,outerNode=linkedList(data,0,outerLen,dim,!0),triangles=[];if(!outerNode||outerNode.next===outerNode.prev)return triangles;if(hasHoles&&(outerNode=function(data,holeIndices,outerNode,dim){var i,len,list,queue=[];for(i=0,len=holeIndices.length;i<len;i++)(list=linkedList(data,holeIndices[i]*dim,i<len-1?holeIndices[i+1]*dim:data.length,dim,!1))===list.next&&(list.steiner=!0),queue.push(getLeftmost(list));for(queue.sort(compareX),i=0;i<queue.length;i++)outerNode=filterPoints(outerNode=eliminateHole(queue[i],outerNode),outerNode.next);return outerNode}(data,holeIndices,outerNode,dim)),data.length>80*dim){minX=maxX=data[0],minY=maxY=data[1];for(var i=dim;i<outerLen;i+=dim)(x=data[i])<minX&&(minX=x),(y=data[i+1])<minY&&(minY=y),x>maxX&&(maxX=x),y>maxY&&(maxY=y);invSize=0!==(invSize=Math.max(maxX-minX,maxY-minY))?1/invSize:0}return earcutLinked(outerNode,triangles,dim,minX,minY,invSize),triangles}function linkedList(data,start,end,dim,clockwise){var i,last;if(clockwise===signedArea(data,start,end,dim)>0)for(i=start;i<end;i+=dim)last=insertNode(i,data[i],data[i+1],last);else for(i=end-dim;i>=start;i-=dim)last=insertNode(i,data[i],data[i+1],last);return last&&equals(last,last.next)&&(removeNode(last),last=last.next),last}function filterPoints(start,end){if(!start)return start;end||(end=start);var again,p=start;do{if(again=!1,p.steiner||!equals(p,p.next)&&0!==area(p.prev,p,p.next))p=p.next;else{if(removeNode(p),(p=end=p.prev)===p.next)break;again=!0}}while(again||p!==end);return end}function earcutLinked(ear,triangles,dim,minX,minY,invSize,pass){if(ear){!pass&&invSize&&function(start,minX,minY,invSize){var p=start;do{null===p.z&&(p.z=zOrder(p.x,p.y,minX,minY,invSize)),p.prevZ=p.prev,p.nextZ=p.next,p=p.next}while(p!==start);p.prevZ.nextZ=null,p.prevZ=null,function(list){var i,p,q,e,tail,numMerges,pSize,qSize,inSize=1;do{for(p=list,list=null,tail=null,numMerges=0;p;){for(numMerges++,q=p,pSize=0,i=0;i<inSize&&(pSize++,q=q.nextZ);i++);for(qSize=inSize;pSize>0||qSize>0&&q;)0!==pSize&&(0===qSize||!q||p.z<=q.z)?(e=p,p=p.nextZ,pSize--):(e=q,q=q.nextZ,qSize--),tail?tail.nextZ=e:list=e,e.prevZ=tail,tail=e;p=q}tail.nextZ=null,inSize*=2}while(numMerges>1)}(p)}(ear,minX,minY,invSize);for(var prev,next,stop=ear;ear.prev!==ear.next;)if(prev=ear.prev,next=ear.next,invSize?isEarHashed(ear,minX,minY,invSize):isEar(ear))triangles.push(prev.i/dim),triangles.push(ear.i/dim),triangles.push(next.i/dim),removeNode(ear),ear=next.next,stop=next.next;else if((ear=next)===stop){pass?1===pass?earcutLinked(ear=cureLocalIntersections(filterPoints(ear),triangles,dim),triangles,dim,minX,minY,invSize,2):2===pass&&splitEarcut(ear,triangles,dim,minX,minY,invSize):earcutLinked(filterPoints(ear),triangles,dim,minX,minY,invSize,1);break}}}function isEar(ear){var a=ear.prev,b=ear,c=ear.next;if(area(a,b,c)>=0)return!1;for(var p=ear.next.next;p!==ear.prev;){if(pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function isEarHashed(ear,minX,minY,invSize){var a=ear.prev,b=ear,c=ear.next;if(area(a,b,c)>=0)return!1;for(var minTX=a.x<b.x?a.x<c.x?a.x:c.x:b.x<c.x?b.x:c.x,minTY=a.y<b.y?a.y<c.y?a.y:c.y:b.y<c.y?b.y:c.y,maxTX=a.x>b.x?a.x>c.x?a.x:c.x:b.x>c.x?b.x:c.x,maxTY=a.y>b.y?a.y>c.y?a.y:c.y:b.y>c.y?b.y:c.y,minZ=zOrder(minTX,minTY,minX,minY,invSize),maxZ=zOrder(maxTX,maxTY,minX,minY,invSize),p=ear.prevZ,n=ear.nextZ;p&&p.z>=minZ&&n&&n.z<=maxZ;){if(p!==ear.prev&&p!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,n!==ear.prev&&n!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,n.x,n.y)&&area(n.prev,n,n.next)>=0)return!1;n=n.nextZ}for(;p&&p.z>=minZ;){if(p!==ear.prev&&p!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;n&&n.z<=maxZ;){if(n!==ear.prev&&n!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,n.x,n.y)&&area(n.prev,n,n.next)>=0)return!1;n=n.nextZ}return!0}function cureLocalIntersections(start,triangles,dim){var p=start;do{var a=p.prev,b=p.next.next;!equals(a,b)&&intersects(a,p,p.next,b)&&locallyInside(a,b)&&locallyInside(b,a)&&(triangles.push(a.i/dim),triangles.push(p.i/dim),triangles.push(b.i/dim),removeNode(p),removeNode(p.next),p=start=b),p=p.next}while(p!==start);return filterPoints(p)}function splitEarcut(start,triangles,dim,minX,minY,invSize){var a=start;do{for(var b=a.next.next;b!==a.prev;){if(a.i!==b.i&&isValidDiagonal(a,b)){var c=splitPolygon(a,b);return a=filterPoints(a,a.next),c=filterPoints(c,c.next),earcutLinked(a,triangles,dim,minX,minY,invSize),void earcutLinked(c,triangles,dim,minX,minY,invSize)}b=b.next}a=a.next}while(a!==start)}function compareX(a,b){return a.x-b.x}function eliminateHole(hole,outerNode){var bridge=function(hole,outerNode){var m,p=outerNode,hx=hole.x,hy=hole.y,qx=-1/0;do{if(hy<=p.y&&hy>=p.next.y&&p.next.y!==p.y){var x=p.x+(hy-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(x<=hx&&x>qx){if(qx=x,x===hx){if(hy===p.y)return p;if(hy===p.next.y)return p.next}m=p.x<p.next.x?p:p.next}}p=p.next}while(p!==outerNode);if(!m)return null;if(hx===qx)return m;var tan,stop=m,mx=m.x,my=m.y,tanMin=1/0;p=m;do{hx>=p.x&&p.x>=mx&&hx!==p.x&&pointInTriangle(hy<my?hx:qx,hy,mx,my,hy<my?qx:hx,hy,p.x,p.y)&&(tan=Math.abs(hy-p.y)/(hx-p.x),locallyInside(p,hole)&&(tan<tanMin||tan===tanMin&&(p.x>m.x||p.x===m.x&§orContainsSector(m,p)))&&(m=p,tanMin=tan)),p=p.next}while(p!==stop);return m}(hole,outerNode);if(!bridge)return outerNode;var bridgeReverse=splitPolygon(bridge,hole),filteredBridge=filterPoints(bridge,bridge.next);return filterPoints(bridgeReverse,bridgeReverse.next),outerNode===bridge?filteredBridge:outerNode}function sectorContainsSector(m,p){return area(m.prev,m,p.prev)<0&&area(p.next,m,m.next)<0}function zOrder(x,y,minX,minY,invSize){return(x=1431655765&((x=858993459&((x=252645135&((x=16711935&((x=32767*(x-minX)*invSize)|x<<8))|x<<4))|x<<2))|x<<1))|(y=1431655765&((y=858993459&((y=252645135&((y=16711935&((y=32767*(y-minY)*invSize)|y<<8))|y<<4))|y<<2))|y<<1))<<1}function getLeftmost(start){var p=start,leftmost=start;do{(p.x<leftmost.x||p.x===leftmost.x&&p.y<leftmost.y)&&(leftmost=p),p=p.next}while(p!==start);return leftmost}function pointInTriangle(ax,ay,bx,by,cx,cy,px,py){return(cx-px)*(ay-py)-(ax-px)*(cy-py)>=0&&(ax-px)*(by-py)-(bx-px)*(ay-py)>=0&&(bx-px)*(cy-py)-(cx-px)*(by-py)>=0}function isValidDiagonal(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!function(a,b){var p=a;do{if(p.i!==a.i&&p.next.i!==a.i&&p.i!==b.i&&p.next.i!==b.i&&intersects(p,p.next,a,b))return!0;p=p.next}while(p!==a);return!1}(a,b)&&(locallyInside(a,b)&&locallyInside(b,a)&&function(a,b){var p=a,inside=!1,px=(a.x+b.x)/2,py=(a.y+b.y)/2;do{p.y>py!=p.next.y>py&&p.next.y!==p.y&&px<(p.next.x-p.x)*(py-p.y)/(p.next.y-p.y)+p.x&&(inside=!inside),p=p.next}while(p!==a);return inside}(a,b)&&(area(a.prev,a,b.prev)||area(a,b.prev,b))||equals(a,b)&&area(a.prev,a,a.next)>0&&area(b.prev,b,b.next)>0)}function area(p,q,r){return(q.y-p.y)*(r.x-q.x)-(q.x-p.x)*(r.y-q.y)}function equals(p1,p2){return p1.x===p2.x&&p1.y===p2.y}function intersects(p1,q1,p2,q2){var o1=sign$1(area(p1,q1,p2)),o2=sign$1(area(p1,q1,q2)),o3=sign$1(area(p2,q2,p1)),o4=sign$1(area(p2,q2,q1));return o1!==o2&&o3!==o4||(!(0!==o1||!onSegment(p1,p2,q1))||(!(0!==o2||!onSegment(p1,q2,q1))||(!(0!==o3||!onSegment(p2,p1,q2))||!(0!==o4||!onSegment(p2,q1,q2)))))}function onSegment(p,q,r){return q.x<=Math.max(p.x,r.x)&&q.x>=Math.min(p.x,r.x)&&q.y<=Math.max(p.y,r.y)&&q.y>=Math.min(p.y,r.y)}function sign$1(num){return num>0?1:num<0?-1:0}function locallyInside(a,b){return area(a.prev,a,a.next)<0?area(a,b,a.next)>=0&&area(a,a.prev,b)>=0:area(a,b,a.prev)<0||area(a,a.next,b)<0}function splitPolygon(a,b){var a2=new Node(a.i,a.x,a.y),b2=new Node(b.i,b.x,b.y),an=a.next,bp=b.prev;return a.next=b,b.prev=a,a2.next=an,an.prev=a2,b2.next=a2,a2.prev=b2,bp.next=b2,b2.prev=bp,b2}function insertNode(i,x,y,last){var p=new Node(i,x,y);return last?(p.next=last.next,p.prev=last,last.next.prev=p,last.next=p):(p.prev=p,p.next=p),p}function removeNode(p){p.next.prev=p.prev,p.prev.next=p.next,p.prevZ&&(p.prevZ.nextZ=p.nextZ),p.nextZ&&(p.nextZ.prevZ=p.prevZ)}function Node(i,x,y){this.i=i,this.x=x,this.y=y,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(data,start,end,dim){for(var sum=0,i=start,j=end-dim;i<end;i+=dim)sum+=(data[j]-data[i])*(data[i+1]+data[j+1]),j=i;return sum}earcut.deviation=function(data,holeIndices,dim,triangles){var hasHoles=holeIndices&&holeIndices.length,outerLen=hasHoles?holeIndices[0]*dim:data.length,polygonArea=Math.abs(signedArea(data,0,outerLen,dim));if(hasHoles)for(var i=0,len=holeIndices.length;i<len;i++){var start=holeIndices[i]*dim,end=i<len-1?holeIndices[i+1]*dim:data.length;polygonArea-=Math.abs(signedArea(data,start,end,dim))}var trianglesArea=0;for(i=0;i<triangles.length;i+=3){var a=triangles[i]*dim,b=triangles[i+1]*dim,c=triangles[i+2]*dim;trianglesArea+=Math.abs((data[a]-data[c])*(data[b+1]-data[a+1])-(data[a]-data[b])*(data[c+1]-data[a+1]))}return 0===polygonArea&&0===trianglesArea?0:Math.abs((trianglesArea-polygonArea)/polygonArea)},earcut.flatten=function(data){for(var dim=data[0][0].length,result={vertices:[],holes:[],dimensions:dim},holeIndex=0,i=0;i<data.length;i++){for(var j=0;j<data[i].length;j++)for(var d=0;d<dim;d++)result.vertices.push(data[i][j][d]);i>0&&(holeIndex+=data[i-1].length,result.holes.push(holeIndex))}return result},earcut_1.default=default_1,function(ENV){ENV[ENV.WEBGL_LEGACY=0]="WEBGL_LEGACY",ENV[ENV.WEBGL=1]="WEBGL",ENV[ENV.WEBGL2=2]="WEBGL2"}(ENV$1||(ENV$1={})),function(RENDERER_TYPE){RENDERER_TYPE[RENDERER_TYPE.UNKNOWN=0]="UNKNOWN",RENDERER_TYPE[RENDERER_TYPE.WEBGL=1]="WEBGL",RENDERER_TYPE[RENDERER_TYPE.CANVAS=2]="CANVAS"}(RENDERER_TYPE$1||(RENDERER_TYPE$1={})),function(BUFFER_BITS){BUFFER_BITS[BUFFER_BITS.COLOR=16384]="COLOR",BUFFER_BITS[BUFFER_BITS.DEPTH=256]="DEPTH",BUFFER_BITS[BUFFER_BITS.STENCIL=1024]="STENCIL"}(BUFFER_BITS$1||(BUFFER_BITS$1={})),function(BLEND_MODES){BLEND_MODES[BLEND_MODES.NORMAL=0]="NORMAL",BLEND_MODES[BLEND_MODES.ADD=1]="ADD",BLEND_MODES[BLEND_MODES.MULTIPLY=2]="MULTIPLY",BLEND_MODES[BLEND_MODES.SCREEN=3]="SCREEN",BLEND_MODES[BLEND_MODES.OVERLAY=4]="OVERLAY",BLEND_MODES[BLEND_MODES.DARKEN=5]="DARKEN",BLEND_MODES[BLEND_MODES.LIGHTEN=6]="LIGHTEN",BLEND_MODES[BLEND_MODES.COLOR_DODGE=7]="COLOR_DODGE",BLEND_MODES[BLEND_MODES.COLOR_BURN=8]="COLOR_BURN",BLEND_MODES[BLEND_MODES.HARD_LIGHT=9]="HARD_LIGHT",BLEND_MODES[BLEND_MODES.SOFT_LIGHT=10]="SOFT_LIGHT",BLEND_MODES[BLEND_MODES.DIFFERENCE=11]="DIFFERENCE",BLEND_MODES[BLEND_MODES.EXCLUSION=12]="EXCLUSION",BLEND_MODES[BLEND_MODES.HUE=13]="HUE",BLEND_MODES[BLEND_MODES.SATURATION=14]="SATURATION",BLEND_MODES[BLEND_MODES.COLOR=15]="COLOR",BLEND_MODES[BLEND_MODES.LUMINOSITY=16]="LUMINOSITY",BLEND_MODES[BLEND_MODES.NORMAL_NPM=17]="NORMAL_NPM",BLEND_MODES[BLEND_MODES.ADD_NPM=18]="ADD_NPM",BLEND_MODES[BLEND_MODES.SCREEN_NPM=19]="SCREEN_NPM",BLEND_MODES[BLEND_MODES.NONE=20]="NONE",BLEND_MODES[BLEND_MODES.SRC_OVER=0]="SRC_OVER",BLEND_MODES[BLEND_MODES.SRC_IN=21]="SRC_IN",BLEND_MODES[BLEND_MODES.SRC_OUT=22]="SRC_OUT",BLEND_MODES[BLEND_MODES.SRC_ATOP=23]="SRC_ATOP",BLEND_MODES[BLEND_MODES.DST_OVER=24]="DST_OVER",BLEND_MODES[BLEND_MODES.DST_IN=25]="DST_IN",BLEND_MODES[BLEND_MODES.DST_OUT=26]="DST_OUT",BLEND_MODES[BLEND_MODES.DST_ATOP=27]="DST_ATOP",BLEND_MODES[BLEND_MODES.ERASE=26]="ERASE",BLEND_MODES[BLEND_MODES.SUBTRACT=28]="SUBTRACT",BLEND_MODES[BLEND_MODES.XOR=29]="XOR"}(BLEND_MODES$1||(BLEND_MODES$1={})),function(DRAW_MODES){DRAW_MODES[DRAW_MODES.POINTS=0]="POINTS",DRAW_MODES[DRAW_MODES.LINES=1]="LINES",DRAW_MODES[DRAW_MODES.LINE_LOOP=2]="LINE_LOOP",DRAW_MODES[DRAW_MODES.LINE_STRIP=3]="LINE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLES=4]="TRIANGLES",DRAW_MODES[DRAW_MODES.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(DRAW_MODES$1||(DRAW_MODES$1={})),function(FORMATS){FORMATS[FORMATS.RGBA=6408]="RGBA",FORMATS[FORMATS.RGB=6407]="RGB",FORMATS[FORMATS.RG=33319]="RG",FORMATS[FORMATS.RED=6403]="RED",FORMATS[FORMATS.RGBA_INTEGER=36249]="RGBA_INTEGER",FORMATS[FORMATS.RGB_INTEGER=36248]="RGB_INTEGER",FORMATS[FORMATS.RG_INTEGER=33320]="RG_INTEGER",FORMATS[FORMATS.RED_INTEGER=36244]="RED_INTEGER",FORMATS[FORMATS.ALPHA=6406]="ALPHA",FORMATS[FORMATS.LUMINANCE=6409]="LUMINANCE",FORMATS[FORMATS.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",FORMATS[FORMATS.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",FORMATS[FORMATS.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(FORMATS$1||(FORMATS$1={})),function(TARGETS){TARGETS[TARGETS.TEXTURE_2D=3553]="TEXTURE_2D",TARGETS[TARGETS.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",TARGETS[TARGETS.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(TARGETS$1||(TARGETS$1={})),function(TYPES){TYPES[TYPES.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",TYPES[TYPES.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",TYPES[TYPES.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",TYPES[TYPES.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",TYPES[TYPES.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",TYPES[TYPES.UNSIGNED_INT=5125]="UNSIGNED_INT",TYPES[TYPES.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",TYPES[TYPES.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",TYPES[TYPES.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",TYPES[TYPES.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",TYPES[TYPES.BYTE=5120]="BYTE",TYPES[TYPES.SHORT=5122]="SHORT",TYPES[TYPES.INT=5124]="INT",TYPES[TYPES.FLOAT=5126]="FLOAT",TYPES[TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",TYPES[TYPES.HALF_FLOAT=36193]="HALF_FLOAT"}(TYPES$1||(TYPES$1={})),function(SAMPLER_TYPES){SAMPLER_TYPES[SAMPLER_TYPES.FLOAT=0]="FLOAT",SAMPLER_TYPES[SAMPLER_TYPES.INT=1]="INT",SAMPLER_TYPES[SAMPLER_TYPES.UINT=2]="UINT"}(SAMPLER_TYPES$1||(SAMPLER_TYPES$1={})),function(SCALE_MODES){SCALE_MODES[SCALE_MODES.NEAREST=0]="NEAREST",SCALE_MODES[SCALE_MODES.LINEAR=1]="LINEAR"}(SCALE_MODES$1||(SCALE_MODES$1={})),function(WRAP_MODES){WRAP_MODES[WRAP_MODES.CLAMP=33071]="CLAMP",WRAP_MODES[WRAP_MODES.REPEAT=10497]="REPEAT",WRAP_MODES[WRAP_MODES.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(WRAP_MODES$1||(WRAP_MODES$1={})),function(MIPMAP_MODES){MIPMAP_MODES[MIPMAP_MODES.OFF=0]="OFF",MIPMAP_MODES[MIPMAP_MODES.POW2=1]="POW2",MIPMAP_MODES[MIPMAP_MODES.ON=2]="ON",MIPMAP_MODES[MIPMAP_MODES.ON_MANUAL=3]="ON_MANUAL"}(MIPMAP_MODES$1||(MIPMAP_MODES$1={})),function(ALPHA_MODES){ALPHA_MODES[ALPHA_MODES.NPM=0]="NPM",ALPHA_MODES[ALPHA_MODES.UNPACK=1]="UNPACK",ALPHA_MODES[ALPHA_MODES.PMA=2]="PMA",ALPHA_MODES[ALPHA_MODES.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"}(ALPHA_MODES$1||(ALPHA_MODES$1={})),function(CLEAR_MODES){CLEAR_MODES[CLEAR_MODES.NO=0]="NO",CLEAR_MODES[CLEAR_MODES.YES=1]="YES",CLEAR_MODES[CLEAR_MODES.AUTO=2]="AUTO",CLEAR_MODES[CLEAR_MODES.BLEND=0]="BLEND",CLEAR_MODES[CLEAR_MODES.CLEAR=1]="CLEAR",CLEAR_MODES[CLEAR_MODES.BLIT=2]="BLIT"}(CLEAR_MODES$1||(CLEAR_MODES$1={})),function(GC_MODES){GC_MODES[GC_MODES.AUTO=0]="AUTO",GC_MODES[GC_MODES.MANUAL=1]="MANUAL"}(GC_MODES$1||(GC_MODES$1={})),function(PRECISION){PRECISION.LOW="lowp",PRECISION.MEDIUM="mediump",PRECISION.HIGH="highp"}(PRECISION$1||(PRECISION$1={})),function(MASK_TYPES){MASK_TYPES[MASK_TYPES.NONE=0]="NONE",MASK_TYPES[MASK_TYPES.SCISSOR=1]="SCISSOR",MASK_TYPES[MASK_TYPES.STENCIL=2]="STENCIL",MASK_TYPES[MASK_TYPES.SPRITE=3]="SPRITE"}(MASK_TYPES$1||(MASK_TYPES$1={})),function(MSAA_QUALITY){MSAA_QUALITY[MSAA_QUALITY.NONE=0]="NONE",MSAA_QUALITY[MSAA_QUALITY.LOW=2]="LOW",MSAA_QUALITY[MSAA_QUALITY.MEDIUM=4]="MEDIUM",MSAA_QUALITY[MSAA_QUALITY.HIGH=8]="HIGH"}(MSAA_QUALITY$1||(MSAA_QUALITY$1={})),function(BUFFER_TYPE){BUFFER_TYPE[BUFFER_TYPE.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",BUFFER_TYPE[BUFFER_TYPE.ARRAY_BUFFER=34962]="ARRAY_BUFFER",BUFFER_TYPE[BUFFER_TYPE.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"}(BUFFER_TYPE$1||(BUFFER_TYPE$1={}));
|
|
36
37
|
/*!
|
|
37
|
-
* @pixi/utils -
|
|
38
|
-
* Compiled
|
|
38
|
+
* @pixi/utils - v6.4.2
|
|
39
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
39
40
|
*
|
|
40
41
|
* @pixi/utils is licensed under the MIT License.
|
|
41
42
|
* http://www.opensource.org/licenses/mit-license
|
|
42
43
|
*/
|
|
43
|
-
settings.RETINA_PREFIX=/@([0-9\.]+)x/,settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!
|
|
44
|
+
var url={parse:url$1.parse,format:url$1.format,resolve:url$1.resolve};settings.RETINA_PREFIX=/@([0-9\.]+)x/,settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var supported,saidHello=!1;var cssColorNames={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function hex2rgb(hex,out){return void 0===out&&(out=[]),out[0]=(hex>>16&255)/255,out[1]=(hex>>8&255)/255,out[2]=(255&hex)/255,out}function hex2string(hex){var hexString=hex.toString(16);return"#"+(hexString="000000".substring(0,6-hexString.length)+hexString)}function string2hex(string){return"string"==typeof string&&"#"===(string=cssColorNames[string.toLowerCase()]||string)[0]&&(string=string.slice(1)),parseInt(string,16)}var premultiplyBlendMode=function(){for(var pm=[],npm=[],i=0;i<32;i++)pm[i]=i,npm[i]=i;pm[BLEND_MODES$1.NORMAL_NPM]=BLEND_MODES$1.NORMAL,pm[BLEND_MODES$1.ADD_NPM]=BLEND_MODES$1.ADD,pm[BLEND_MODES$1.SCREEN_NPM]=BLEND_MODES$1.SCREEN,npm[BLEND_MODES$1.NORMAL]=BLEND_MODES$1.NORMAL_NPM,npm[BLEND_MODES$1.ADD]=BLEND_MODES$1.ADD_NPM,npm[BLEND_MODES$1.SCREEN]=BLEND_MODES$1.SCREEN_NPM;var array=[];return array.push(npm),array.push(pm),array}();function correctBlendMode(blendMode,premultiplied){return premultiplyBlendMode[premultiplied?1:0][blendMode]}function premultiplyTint(tint,alpha){if(1===alpha)return(255*alpha<<24)+tint;if(0===alpha)return 0;var R=tint>>16&255,G=tint>>8&255,B=255∭return(255*alpha<<24)+((R=R*alpha+.5|0)<<16)+((G=G*alpha+.5|0)<<8)+(B=B*alpha+.5|0)}function premultiplyTintToRgba(tint,alpha,out,premultiply){return(out=out||new Float32Array(4))[0]=(tint>>16&255)/255,out[1]=(tint>>8&255)/255,out[2]=(255&tint)/255,(premultiply||void 0===premultiply)&&(out[0]*=alpha,out[1]*=alpha,out[2]*=alpha),out[3]=alpha,out}function getBufferType(array){if(4===array.BYTES_PER_ELEMENT)return array instanceof Float32Array?"Float32Array":array instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===array.BYTES_PER_ELEMENT){if(array instanceof Uint16Array)return"Uint16Array"}else if(1===array.BYTES_PER_ELEMENT&&array instanceof Uint8Array)return"Uint8Array";return null}function nextPow2(v){return v+=0===v?1:0,--v,v|=v>>>1,v|=v>>>2,v|=v>>>4,v|=v>>>8,(v|=v>>>16)+1}function isPow2(v){return!(v&v-1||!v)}function log2(v){var r=(v>65535?1:0)<<4,shift=((v>>>=r)>255?1:0)<<3;return r|=shift,r|=shift=((v>>>=shift)>15?1:0)<<2,(r|=shift=((v>>>=shift)>3?1:0)<<1)|(v>>>=shift)>>1}function removeItems(arr,startIdx,removeCount){var i,length=arr.length;if(!(startIdx>=length||0===removeCount)){var len=length-(removeCount=startIdx+removeCount>length?length-startIdx:removeCount);for(i=startIdx;i<len;++i)arr[i]=arr[i+removeCount];arr.length=len}}function sign$2(n){return 0===n?0:n<0?-1:1}var nextUid=0;function uid(){return++nextUid}var warnings={};function deprecation(version,message,ignoreDepth){if(void 0===ignoreDepth&&(ignoreDepth=3),!warnings[message]){var stack=(new Error).stack;void 0===stack?console.warn("PixiJS Deprecation Warning: ",message+"\nDeprecated since v"+version):(stack=stack.split("\n").splice(ignoreDepth).join("\n"),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",message+"\nDeprecated since v"+version),console.warn(stack),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",message+"\nDeprecated since v"+version),console.warn(stack))),warnings[message]=!0}}var tempAnchor,ProgramCache={},TextureCache=Object.create(null),BaseTextureCache=Object.create(null),CanvasRenderTarget=function(){function CanvasRenderTarget(width,height,resolution){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.resolution=resolution||settings.RESOLUTION,this.resize(width,height)}return CanvasRenderTarget.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},CanvasRenderTarget.prototype.resize=function(desiredWidth,desiredHeight){this.canvas.width=Math.round(desiredWidth*this.resolution),this.canvas.height=Math.round(desiredHeight*this.resolution)},CanvasRenderTarget.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(CanvasRenderTarget.prototype,"width",{get:function(){return this.canvas.width},set:function(val){this.canvas.width=Math.round(val)},enumerable:!1,configurable:!0}),Object.defineProperty(CanvasRenderTarget.prototype,"height",{get:function(){return this.canvas.height},set:function(val){this.canvas.height=Math.round(val)},enumerable:!1,configurable:!0}),CanvasRenderTarget}();function determineCrossOrigin(url$1,loc){if(void 0===loc&&(loc=globalThis.location),0===url$1.indexOf("data:"))return"";loc=loc||globalThis.location,tempAnchor||(tempAnchor=document.createElement("a")),tempAnchor.href=url$1;var parsedUrl=url.parse(tempAnchor.href),samePort=!parsedUrl.port&&""===loc.port||parsedUrl.port===loc.port;return parsedUrl.hostname===loc.hostname&&samePort&&parsedUrl.protocol===loc.protocol?"":"anonymous"}function getResolutionOfUrl(url,defaultValue){var resolution=settings.RETINA_PREFIX.exec(url);return resolution?parseFloat(resolution[1]):void 0!==defaultValue?defaultValue:1}
|
|
44
45
|
/*!
|
|
45
|
-
* @pixi/math -
|
|
46
|
-
* Compiled
|
|
46
|
+
* @pixi/math - v6.4.2
|
|
47
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
47
48
|
*
|
|
48
49
|
* @pixi/math is licensed under the MIT License.
|
|
49
50
|
* http://www.opensource.org/licenses/mit-license
|
|
50
|
-
*/var SHAPES,PI_2=2*Math.PI,RAD_TO_DEG=180/Math.PI,DEG_TO_RAD=Math.PI/180;!function(SHAPES){SHAPES[SHAPES.POLY=0]="POLY",SHAPES[SHAPES.RECT=1]="RECT",SHAPES[SHAPES.CIRC=2]="CIRC",SHAPES[SHAPES.ELIP=3]="ELIP",SHAPES[SHAPES.RREC=4]="RREC"}(SHAPES||(SHAPES={}));var Rectangle=function(){function Rectangle(x,y,width,height){void 0===x&&(x=0),void 0===y&&(y=0),void 0===width&&(width=0),void 0===height&&(height=0),this.x=Number(x),this.y=Number(y),this.width=Number(width),this.height=Number(height),this.type=SHAPES.RECT}return Object.defineProperty(Rectangle.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(Rectangle.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(Rectangle.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(Rectangle.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(Rectangle,"EMPTY",{get:function(){return new Rectangle(0,0,0,0)},enumerable:!1,configurable:!0}),Rectangle.prototype.clone=function(){return new Rectangle(this.x,this.y,this.width,this.height)},Rectangle.prototype.copyFrom=function(rectangle){return this.x=rectangle.x,this.y=rectangle.y,this.width=rectangle.width,this.height=rectangle.height,this},Rectangle.prototype.copyTo=function(rectangle){return rectangle.x=this.x,rectangle.y=this.y,rectangle.width=this.width,rectangle.height=this.height,rectangle},Rectangle.prototype.contains=function(x,y){return!(this.width<=0||this.height<=0)&&(x>=this.x&&x<this.x+this.width&&y>=this.y&&y<this.y+this.height)},Rectangle.prototype.pad=function(paddingX,paddingY){return void 0===paddingX&&(paddingX=0),void 0===paddingY&&(paddingY=paddingX),this.x-=paddingX,this.y-=paddingY,this.width+=2*paddingX,this.height+=2*paddingY,this},Rectangle.prototype.fit=function(rectangle){var x1=Math.max(this.x,rectangle.x),x2=Math.min(this.x+this.width,rectangle.x+rectangle.width),y1=Math.max(this.y,rectangle.y),y2=Math.min(this.y+this.height,rectangle.y+rectangle.height);return this.x=x1,this.width=Math.max(x2-x1,0),this.y=y1,this.height=Math.max(y2-y1,0),this},Rectangle.prototype.ceil=function(resolution,eps){void 0===resolution&&(resolution=1),void 0===eps&&(eps=.001);var x2=Math.ceil((this.x+this.width-eps)*resolution)/resolution,y2=Math.ceil((this.y+this.height-eps)*resolution)/resolution;return this.x=Math.floor((this.x+eps)*resolution)/resolution,this.y=Math.floor((this.y+eps)*resolution)/resolution,this.width=x2-this.x,this.height=y2-this.y,this},Rectangle.prototype.enlarge=function(rectangle){var x1=Math.min(this.x,rectangle.x),x2=Math.max(this.x+this.width,rectangle.x+rectangle.width),y1=Math.min(this.y,rectangle.y),y2=Math.max(this.y+this.height,rectangle.y+rectangle.height);return this.x=x1,this.width=x2-x1,this.y=y1,this.height=y2-y1,this},Rectangle}(),Circle=function(){function Circle(x,y,radius){void 0===x&&(x=0),void 0===y&&(y=0),void 0===radius&&(radius=0),this.x=x,this.y=y,this.radius=radius,this.type=SHAPES.CIRC}return Circle.prototype.clone=function(){return new Circle(this.x,this.y,this.radius)},Circle.prototype.contains=function(x,y){if(this.radius<=0)return!1;var r2=this.radius*this.radius,dx=this.x-x,dy=this.y-y;return(dx*=dx)+(dy*=dy)<=r2},Circle.prototype.getBounds=function(){return new Rectangle(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},Circle}(),Ellipse=function(){function Ellipse(x,y,halfWidth,halfHeight){void 0===x&&(x=0),void 0===y&&(y=0),void 0===halfWidth&&(halfWidth=0),void 0===halfHeight&&(halfHeight=0),this.x=x,this.y=y,this.width=halfWidth,this.height=halfHeight,this.type=SHAPES.ELIP}return Ellipse.prototype.clone=function(){return new Ellipse(this.x,this.y,this.width,this.height)},Ellipse.prototype.contains=function(x,y){if(this.width<=0||this.height<=0)return!1;var normx=(x-this.x)/this.width,normy=(y-this.y)/this.height;return(normx*=normx)+(normy*=normy)<=1},Ellipse.prototype.getBounds=function(){return new Rectangle(this.x-this.width,this.y-this.height,this.width,this.height)},Ellipse}(),Polygon=function(){function Polygon(){for(var arguments$1=arguments,points=[],_i=0;_i<arguments.length;_i++)points[_i]=arguments$1[_i];var flat=Array.isArray(points[0])?points[0]:points;if("number"!=typeof flat[0]){for(var p=[],i=0,il=flat.length;i<il;i++)p.push(flat[i].x,flat[i].y);flat=p}this.points=flat,this.type=SHAPES.POLY,this.closeStroke=!0}return Polygon.prototype.clone=function(){var polygon=new Polygon(this.points.slice());return polygon.closeStroke=this.closeStroke,polygon},Polygon.prototype.contains=function(x,y){for(var inside=!1,length=this.points.length/2,i=0,j=length-1;i<length;j=i++){var xi=this.points[2*i],yi=this.points[2*i+1],xj=this.points[2*j],yj=this.points[2*j+1];yi>y!=yj>y&&x<(y-yi)/(yj-yi)*(xj-xi)+xi&&(inside=!inside)}return inside},Polygon}(),RoundedRectangle=function(){function RoundedRectangle(x,y,width,height,radius){void 0===x&&(x=0),void 0===y&&(y=0),void 0===width&&(width=0),void 0===height&&(height=0),void 0===radius&&(radius=20),this.x=x,this.y=y,this.width=width,this.height=height,this.radius=radius,this.type=SHAPES.RREC}return RoundedRectangle.prototype.clone=function(){return new RoundedRectangle(this.x,this.y,this.width,this.height,this.radius)},RoundedRectangle.prototype.contains=function(x,y){if(this.width<=0||this.height<=0)return!1;if(x>=this.x&&x<=this.x+this.width&&y>=this.y&&y<=this.y+this.height){if(y>=this.y+this.radius&&y<=this.y+this.height-this.radius||x>=this.x+this.radius&&x<=this.x+this.width-this.radius)return!0;var dx=x-(this.x+this.radius),dy=y-(this.y+this.radius),radius2=this.radius*this.radius;if(dx*dx+dy*dy<=radius2)return!0;if((dx=x-(this.x+this.width-this.radius))*dx+dy*dy<=radius2)return!0;if(dx*dx+(dy=y-(this.y+this.height-this.radius))*dy<=radius2)return!0;if((dx=x-(this.x+this.radius))*dx+dy*dy<=radius2)return!0}return!1},RoundedRectangle}(),Point=function(){function Point(x,y){void 0===x&&(x=0),void 0===y&&(y=0),this.x=x,this.y=y}return Point.prototype.clone=function(){return new Point(this.x,this.y)},Point.prototype.copyFrom=function(p){return this.set(p.x,p.y),this},Point.prototype.copyTo=function(p){return p.set(this.x,this.y),p},Point.prototype.equals=function(p){return p.x===this.x&&p.y===this.y},Point.prototype.set=function(x,y){return void 0===x&&(x=0),void 0===y&&(y=x),this.x=x,this.y=y,this},Point}(),ObservablePoint=function(){function ObservablePoint(cb,scope,x,y){void 0===x&&(x=0),void 0===y&&(y=0),this._x=x,this._y=y,this.cb=cb,this.scope=scope}return ObservablePoint.prototype.clone=function(cb,scope){return void 0===cb&&(cb=this.cb),void 0===scope&&(scope=this.scope),new ObservablePoint(cb,scope,this._x,this._y)},ObservablePoint.prototype.set=function(x,y){return void 0===x&&(x=0),void 0===y&&(y=x),this._x===x&&this._y===y||(this._x=x,this._y=y,this.cb.call(this.scope)),this},ObservablePoint.prototype.copyFrom=function(p){return this._x===p.x&&this._y===p.y||(this._x=p.x,this._y=p.y,this.cb.call(this.scope)),this},ObservablePoint.prototype.copyTo=function(p){return p.set(this._x,this._y),p},ObservablePoint.prototype.equals=function(p){return p.x===this._x&&p.y===this._y},Object.defineProperty(ObservablePoint.prototype,"x",{get:function(){return this._x},set:function(value){this._x!==value&&(this._x=value,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(ObservablePoint.prototype,"y",{get:function(){return this._y},set:function(value){this._y!==value&&(this._y=value,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),ObservablePoint}(),Matrix=function(){function Matrix(a,b,c,d,tx,ty){void 0===a&&(a=1),void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=1),void 0===tx&&(tx=0),void 0===ty&&(ty=0),this.array=null,this.a=a,this.b=b,this.c=c,this.d=d,this.tx=tx,this.ty=ty}return Matrix.prototype.fromArray=function(array){this.a=array[0],this.b=array[1],this.c=array[3],this.d=array[4],this.tx=array[2],this.ty=array[5]},Matrix.prototype.set=function(a,b,c,d,tx,ty){return this.a=a,this.b=b,this.c=c,this.d=d,this.tx=tx,this.ty=ty,this},Matrix.prototype.toArray=function(transpose,out){this.array||(this.array=new Float32Array(9));var array=out||this.array;return transpose?(array[0]=this.a,array[1]=this.b,array[2]=0,array[3]=this.c,array[4]=this.d,array[5]=0,array[6]=this.tx,array[7]=this.ty,array[8]=1):(array[0]=this.a,array[1]=this.c,array[2]=this.tx,array[3]=this.b,array[4]=this.d,array[5]=this.ty,array[6]=0,array[7]=0,array[8]=1),array},Matrix.prototype.apply=function(pos,newPos){newPos=newPos||new Point;var x=pos.x,y=pos.y;return newPos.x=this.a*x+this.c*y+this.tx,newPos.y=this.b*x+this.d*y+this.ty,newPos},Matrix.prototype.applyInverse=function(pos,newPos){newPos=newPos||new Point;var id=1/(this.a*this.d+this.c*-this.b),x=pos.x,y=pos.y;return newPos.x=this.d*id*x+-this.c*id*y+(this.ty*this.c-this.tx*this.d)*id,newPos.y=this.a*id*y+-this.b*id*x+(-this.ty*this.a+this.tx*this.b)*id,newPos},Matrix.prototype.translate=function(x,y){return this.tx+=x,this.ty+=y,this},Matrix.prototype.scale=function(x,y){return this.a*=x,this.d*=y,this.c*=x,this.b*=y,this.tx*=x,this.ty*=y,this},Matrix.prototype.rotate=function(angle){var cos=Math.cos(angle),sin=Math.sin(angle),a1=this.a,c1=this.c,tx1=this.tx;return this.a=a1*cos-this.b*sin,this.b=a1*sin+this.b*cos,this.c=c1*cos-this.d*sin,this.d=c1*sin+this.d*cos,this.tx=tx1*cos-this.ty*sin,this.ty=tx1*sin+this.ty*cos,this},Matrix.prototype.append=function(matrix){var a1=this.a,b1=this.b,c1=this.c,d1=this.d;return this.a=matrix.a*a1+matrix.b*c1,this.b=matrix.a*b1+matrix.b*d1,this.c=matrix.c*a1+matrix.d*c1,this.d=matrix.c*b1+matrix.d*d1,this.tx=matrix.tx*a1+matrix.ty*c1+this.tx,this.ty=matrix.tx*b1+matrix.ty*d1+this.ty,this},Matrix.prototype.setTransform=function(x,y,pivotX,pivotY,scaleX,scaleY,rotation,skewX,skewY){return this.a=Math.cos(rotation+skewY)*scaleX,this.b=Math.sin(rotation+skewY)*scaleX,this.c=-Math.sin(rotation-skewX)*scaleY,this.d=Math.cos(rotation-skewX)*scaleY,this.tx=x-(pivotX*this.a+pivotY*this.c),this.ty=y-(pivotX*this.b+pivotY*this.d),this},Matrix.prototype.prepend=function(matrix){var tx1=this.tx;if(1!==matrix.a||0!==matrix.b||0!==matrix.c||1!==matrix.d){var a1=this.a,c1=this.c;this.a=a1*matrix.a+this.b*matrix.c,this.b=a1*matrix.b+this.b*matrix.d,this.c=c1*matrix.a+this.d*matrix.c,this.d=c1*matrix.b+this.d*matrix.d}return this.tx=tx1*matrix.a+this.ty*matrix.c+matrix.tx,this.ty=tx1*matrix.b+this.ty*matrix.d+matrix.ty,this},Matrix.prototype.decompose=function(transform){var a=this.a,b=this.b,c=this.c,d=this.d,skewX=-Math.atan2(-c,d),skewY=Math.atan2(b,a),delta=Math.abs(skewX+skewY);return delta<1e-5||Math.abs(PI_2-delta)<1e-5?(transform.rotation=skewY,transform.skew.x=transform.skew.y=0):(transform.rotation=0,transform.skew.x=skewX,transform.skew.y=skewY),transform.scale.x=Math.sqrt(a*a+b*b),transform.scale.y=Math.sqrt(c*c+d*d),transform.position.x=this.tx,transform.position.y=this.ty,transform},Matrix.prototype.invert=function(){var a1=this.a,b1=this.b,c1=this.c,d1=this.d,tx1=this.tx,n=a1*d1-b1*c1;return this.a=d1/n,this.b=-b1/n,this.c=-c1/n,this.d=a1/n,this.tx=(c1*this.ty-d1*tx1)/n,this.ty=-(a1*this.ty-b1*tx1)/n,this},Matrix.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},Matrix.prototype.clone=function(){var matrix=new Matrix;return matrix.a=this.a,matrix.b=this.b,matrix.c=this.c,matrix.d=this.d,matrix.tx=this.tx,matrix.ty=this.ty,matrix},Matrix.prototype.copyTo=function(matrix){return matrix.a=this.a,matrix.b=this.b,matrix.c=this.c,matrix.d=this.d,matrix.tx=this.tx,matrix.ty=this.ty,matrix},Matrix.prototype.copyFrom=function(matrix){return this.a=matrix.a,this.b=matrix.b,this.c=matrix.c,this.d=matrix.d,this.tx=matrix.tx,this.ty=matrix.ty,this},Object.defineProperty(Matrix,"IDENTITY",{get:function(){return new Matrix},enumerable:!1,configurable:!0}),Object.defineProperty(Matrix,"TEMP_MATRIX",{get:function(){return new Matrix},enumerable:!1,configurable:!0}),Matrix}(),ux=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],uy=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],vx=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vy=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],rotationCayley=[],rotationMatrices=[],signum=Math.sign;!function(){for(var i=0;i<16;i++){var row=[];rotationCayley.push(row);for(var j=0;j<16;j++)for(var _ux=signum(ux[i]*ux[j]+vx[i]*uy[j]),_uy=signum(uy[i]*ux[j]+vy[i]*uy[j]),_vx=signum(ux[i]*vx[j]+vx[i]*vy[j]),_vy=signum(uy[i]*vx[j]+vy[i]*vy[j]),k=0;k<16;k++)if(ux[k]===_ux&&uy[k]===_uy&&vx[k]===_vx&&vy[k]===_vy){row.push(k);break}}for(i=0;i<16;i++){var mat=new Matrix;mat.set(ux[i],uy[i],vx[i],vy[i],0,0),rotationMatrices.push(mat)}}();var groupD8={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(ind){return ux[ind]},uY:function(ind){return uy[ind]},vX:function(ind){return vx[ind]},vY:function(ind){return vy[ind]},inv:function(rotation){return 8&rotation?15&rotation:7&-rotation},add:function(rotationSecond,rotationFirst){return rotationCayley[rotationSecond][rotationFirst]},sub:function(rotationSecond,rotationFirst){return rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]},rotate180:function(rotation){return 4^rotation},isVertical:function(rotation){return 2==(3&rotation)},byDirection:function(dx,dy){return 2*Math.abs(dx)<=Math.abs(dy)?dy>=0?groupD8.S:groupD8.N:2*Math.abs(dy)<=Math.abs(dx)?dx>0?groupD8.E:groupD8.W:dy>0?dx>0?groupD8.SE:groupD8.SW:dx>0?groupD8.NE:groupD8.NW},matrixAppendRotationInv:function(matrix,rotation,tx,ty){void 0===tx&&(tx=0),void 0===ty&&(ty=0);var mat=rotationMatrices[groupD8.inv(rotation)];mat.tx=tx,mat.ty=ty,matrix.append(mat)}},Transform=function(){function Transform(){this.worldTransform=new Matrix,this.localTransform=new Matrix,this.position=new ObservablePoint(this.onChange,this,0,0),this.scale=new ObservablePoint(this.onChange,this,1,1),this.pivot=new ObservablePoint(this.onChange,this,0,0),this.skew=new ObservablePoint(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return Transform.prototype.onChange=function(){this._localID++},Transform.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},Transform.prototype.updateLocalTransform=function(){var lt=this.localTransform;this._localID!==this._currentLocalID&&(lt.a=this._cx*this.scale.x,lt.b=this._sx*this.scale.x,lt.c=this._cy*this.scale.y,lt.d=this._sy*this.scale.y,lt.tx=this.position.x-(this.pivot.x*lt.a+this.pivot.y*lt.c),lt.ty=this.position.y-(this.pivot.x*lt.b+this.pivot.y*lt.d),this._currentLocalID=this._localID,this._parentID=-1)},Transform.prototype.updateTransform=function(parentTransform){var lt=this.localTransform;if(this._localID!==this._currentLocalID&&(lt.a=this._cx*this.scale.x,lt.b=this._sx*this.scale.x,lt.c=this._cy*this.scale.y,lt.d=this._sy*this.scale.y,lt.tx=this.position.x-(this.pivot.x*lt.a+this.pivot.y*lt.c),lt.ty=this.position.y-(this.pivot.x*lt.b+this.pivot.y*lt.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==parentTransform._worldID){var pt=parentTransform.worldTransform,wt=this.worldTransform;wt.a=lt.a*pt.a+lt.b*pt.c,wt.b=lt.a*pt.b+lt.b*pt.d,wt.c=lt.c*pt.a+lt.d*pt.c,wt.d=lt.c*pt.b+lt.d*pt.d,wt.tx=lt.tx*pt.a+lt.ty*pt.c+pt.tx,wt.ty=lt.tx*pt.b+lt.ty*pt.d+pt.ty,this._parentID=parentTransform._worldID,this._worldID++}},Transform.prototype.setFromMatrix=function(matrix){matrix.decompose(this),this._localID++},Object.defineProperty(Transform.prototype,"rotation",{get:function(){return this._rotation},set:function(value){this._rotation!==value&&(this._rotation=value,this.updateSkew())},enumerable:!1,configurable:!0}),Transform.IDENTITY=new Transform,Transform}();
|
|
51
|
+
*/var SHAPES,PI_2=2*Math.PI,RAD_TO_DEG=180/Math.PI,DEG_TO_RAD=Math.PI/180;!function(SHAPES){SHAPES[SHAPES.POLY=0]="POLY",SHAPES[SHAPES.RECT=1]="RECT",SHAPES[SHAPES.CIRC=2]="CIRC",SHAPES[SHAPES.ELIP=3]="ELIP",SHAPES[SHAPES.RREC=4]="RREC"}(SHAPES||(SHAPES={}));var Point=function(){function Point(x,y){void 0===x&&(x=0),void 0===y&&(y=0),this.x=0,this.y=0,this.x=x,this.y=y}return Point.prototype.clone=function(){return new Point(this.x,this.y)},Point.prototype.copyFrom=function(p){return this.set(p.x,p.y),this},Point.prototype.copyTo=function(p){return p.set(this.x,this.y),p},Point.prototype.equals=function(p){return p.x===this.x&&p.y===this.y},Point.prototype.set=function(x,y){return void 0===x&&(x=0),void 0===y&&(y=x),this.x=x,this.y=y,this},Point.prototype.toString=function(){return"[@pixi/math:Point x="+this.x+" y="+this.y+"]"},Point}(),tempPoints=[new Point,new Point,new Point,new Point],Rectangle=function(){function Rectangle(x,y,width,height){void 0===x&&(x=0),void 0===y&&(y=0),void 0===width&&(width=0),void 0===height&&(height=0),this.x=Number(x),this.y=Number(y),this.width=Number(width),this.height=Number(height),this.type=SHAPES.RECT}return Object.defineProperty(Rectangle.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(Rectangle.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(Rectangle.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(Rectangle.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(Rectangle,"EMPTY",{get:function(){return new Rectangle(0,0,0,0)},enumerable:!1,configurable:!0}),Rectangle.prototype.clone=function(){return new Rectangle(this.x,this.y,this.width,this.height)},Rectangle.prototype.copyFrom=function(rectangle){return this.x=rectangle.x,this.y=rectangle.y,this.width=rectangle.width,this.height=rectangle.height,this},Rectangle.prototype.copyTo=function(rectangle){return rectangle.x=this.x,rectangle.y=this.y,rectangle.width=this.width,rectangle.height=this.height,rectangle},Rectangle.prototype.contains=function(x,y){return!(this.width<=0||this.height<=0)&&(x>=this.x&&x<this.x+this.width&&y>=this.y&&y<this.y+this.height)},Rectangle.prototype.intersects=function(other,transform){if(!transform){var x0_1=this.x<other.x?other.x:this.x;if((this.right>other.right?other.right:this.right)<=x0_1)return!1;var y0_1=this.y<other.y?other.y:this.y;return(this.bottom>other.bottom?other.bottom:this.bottom)>y0_1}var x0=this.left,x1=this.right,y0=this.top,y1=this.bottom;if(x1<=x0||y1<=y0)return!1;var lt=tempPoints[0].set(other.left,other.top),lb=tempPoints[1].set(other.left,other.bottom),rt=tempPoints[2].set(other.right,other.top),rb=tempPoints[3].set(other.right,other.bottom);if(rt.x<=lt.x||lb.y<=lt.y)return!1;var s=Math.sign(transform.a*transform.d-transform.b*transform.c);if(0===s)return!1;if(transform.apply(lt,lt),transform.apply(lb,lb),transform.apply(rt,rt),transform.apply(rb,rb),Math.max(lt.x,lb.x,rt.x,rb.x)<=x0||Math.min(lt.x,lb.x,rt.x,rb.x)>=x1||Math.max(lt.y,lb.y,rt.y,rb.y)<=y0||Math.min(lt.y,lb.y,rt.y,rb.y)>=y1)return!1;var nx=s*(lb.y-lt.y),ny=s*(lt.x-lb.x),n00=nx*x0+ny*y0,n10=nx*x1+ny*y0,n01=nx*x0+ny*y1,n11=nx*x1+ny*y1;if(Math.max(n00,n10,n01,n11)<=nx*lt.x+ny*lt.y||Math.min(n00,n10,n01,n11)>=nx*rb.x+ny*rb.y)return!1;var mx=s*(lt.y-rt.y),my=s*(rt.x-lt.x),m00=mx*x0+my*y0,m10=mx*x1+my*y0,m01=mx*x0+my*y1,m11=mx*x1+my*y1;return!(Math.max(m00,m10,m01,m11)<=mx*lt.x+my*lt.y||Math.min(m00,m10,m01,m11)>=mx*rb.x+my*rb.y)},Rectangle.prototype.pad=function(paddingX,paddingY){return void 0===paddingX&&(paddingX=0),void 0===paddingY&&(paddingY=paddingX),this.x-=paddingX,this.y-=paddingY,this.width+=2*paddingX,this.height+=2*paddingY,this},Rectangle.prototype.fit=function(rectangle){var x1=Math.max(this.x,rectangle.x),x2=Math.min(this.x+this.width,rectangle.x+rectangle.width),y1=Math.max(this.y,rectangle.y),y2=Math.min(this.y+this.height,rectangle.y+rectangle.height);return this.x=x1,this.width=Math.max(x2-x1,0),this.y=y1,this.height=Math.max(y2-y1,0),this},Rectangle.prototype.ceil=function(resolution,eps){void 0===resolution&&(resolution=1),void 0===eps&&(eps=.001);var x2=Math.ceil((this.x+this.width-eps)*resolution)/resolution,y2=Math.ceil((this.y+this.height-eps)*resolution)/resolution;return this.x=Math.floor((this.x+eps)*resolution)/resolution,this.y=Math.floor((this.y+eps)*resolution)/resolution,this.width=x2-this.x,this.height=y2-this.y,this},Rectangle.prototype.enlarge=function(rectangle){var x1=Math.min(this.x,rectangle.x),x2=Math.max(this.x+this.width,rectangle.x+rectangle.width),y1=Math.min(this.y,rectangle.y),y2=Math.max(this.y+this.height,rectangle.y+rectangle.height);return this.x=x1,this.width=x2-x1,this.y=y1,this.height=y2-y1,this},Rectangle.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},Rectangle}(),Circle=function(){function Circle(x,y,radius){void 0===x&&(x=0),void 0===y&&(y=0),void 0===radius&&(radius=0),this.x=x,this.y=y,this.radius=radius,this.type=SHAPES.CIRC}return Circle.prototype.clone=function(){return new Circle(this.x,this.y,this.radius)},Circle.prototype.contains=function(x,y){if(this.radius<=0)return!1;var r2=this.radius*this.radius,dx=this.x-x,dy=this.y-y;return(dx*=dx)+(dy*=dy)<=r2},Circle.prototype.getBounds=function(){return new Rectangle(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},Circle.prototype.toString=function(){return"[@pixi/math:Circle x="+this.x+" y="+this.y+" radius="+this.radius+"]"},Circle}(),Ellipse=function(){function Ellipse(x,y,halfWidth,halfHeight){void 0===x&&(x=0),void 0===y&&(y=0),void 0===halfWidth&&(halfWidth=0),void 0===halfHeight&&(halfHeight=0),this.x=x,this.y=y,this.width=halfWidth,this.height=halfHeight,this.type=SHAPES.ELIP}return Ellipse.prototype.clone=function(){return new Ellipse(this.x,this.y,this.width,this.height)},Ellipse.prototype.contains=function(x,y){if(this.width<=0||this.height<=0)return!1;var normx=(x-this.x)/this.width,normy=(y-this.y)/this.height;return(normx*=normx)+(normy*=normy)<=1},Ellipse.prototype.getBounds=function(){return new Rectangle(this.x-this.width,this.y-this.height,this.width,this.height)},Ellipse.prototype.toString=function(){return"[@pixi/math:Ellipse x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},Ellipse}(),Polygon=function(){function Polygon(){for(var arguments$1=arguments,points=[],_i=0;_i<arguments.length;_i++)points[_i]=arguments$1[_i];var flat=Array.isArray(points[0])?points[0]:points;if("number"!=typeof flat[0]){for(var p=[],i=0,il=flat.length;i<il;i++)p.push(flat[i].x,flat[i].y);flat=p}this.points=flat,this.type=SHAPES.POLY,this.closeStroke=!0}return Polygon.prototype.clone=function(){var polygon=new Polygon(this.points.slice());return polygon.closeStroke=this.closeStroke,polygon},Polygon.prototype.contains=function(x,y){for(var inside=!1,length=this.points.length/2,i=0,j=length-1;i<length;j=i++){var xi=this.points[2*i],yi=this.points[2*i+1],xj=this.points[2*j],yj=this.points[2*j+1];yi>y!=yj>y&&x<(y-yi)/(yj-yi)*(xj-xi)+xi&&(inside=!inside)}return inside},Polygon.prototype.toString=function(){return"[@pixi/math:PolygoncloseStroke="+this.closeStroke+"points="+this.points.reduce((function(pointsDesc,currentPoint){return pointsDesc+", "+currentPoint}),"")+"]"},Polygon}(),RoundedRectangle=function(){function RoundedRectangle(x,y,width,height,radius){void 0===x&&(x=0),void 0===y&&(y=0),void 0===width&&(width=0),void 0===height&&(height=0),void 0===radius&&(radius=20),this.x=x,this.y=y,this.width=width,this.height=height,this.radius=radius,this.type=SHAPES.RREC}return RoundedRectangle.prototype.clone=function(){return new RoundedRectangle(this.x,this.y,this.width,this.height,this.radius)},RoundedRectangle.prototype.contains=function(x,y){if(this.width<=0||this.height<=0)return!1;if(x>=this.x&&x<=this.x+this.width&&y>=this.y&&y<=this.y+this.height){var radius=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(y>=this.y+radius&&y<=this.y+this.height-radius||x>=this.x+radius&&x<=this.x+this.width-radius)return!0;var dx=x-(this.x+radius),dy=y-(this.y+radius),radius2=radius*radius;if(dx*dx+dy*dy<=radius2)return!0;if((dx=x-(this.x+this.width-radius))*dx+dy*dy<=radius2)return!0;if(dx*dx+(dy=y-(this.y+this.height-radius))*dy<=radius2)return!0;if((dx=x-(this.x+radius))*dx+dy*dy<=radius2)return!0}return!1},RoundedRectangle.prototype.toString=function(){return"[@pixi/math:RoundedRectangle x="+this.x+" y="+this.y+"width="+this.width+" height="+this.height+" radius="+this.radius+"]"},RoundedRectangle}(),ObservablePoint=function(){function ObservablePoint(cb,scope,x,y){void 0===x&&(x=0),void 0===y&&(y=0),this._x=x,this._y=y,this.cb=cb,this.scope=scope}return ObservablePoint.prototype.clone=function(cb,scope){return void 0===cb&&(cb=this.cb),void 0===scope&&(scope=this.scope),new ObservablePoint(cb,scope,this._x,this._y)},ObservablePoint.prototype.set=function(x,y){return void 0===x&&(x=0),void 0===y&&(y=x),this._x===x&&this._y===y||(this._x=x,this._y=y,this.cb.call(this.scope)),this},ObservablePoint.prototype.copyFrom=function(p){return this._x===p.x&&this._y===p.y||(this._x=p.x,this._y=p.y,this.cb.call(this.scope)),this},ObservablePoint.prototype.copyTo=function(p){return p.set(this._x,this._y),p},ObservablePoint.prototype.equals=function(p){return p.x===this._x&&p.y===this._y},ObservablePoint.prototype.toString=function(){return"[@pixi/math:ObservablePoint x=0 y=0 scope="+this.scope+"]"},Object.defineProperty(ObservablePoint.prototype,"x",{get:function(){return this._x},set:function(value){this._x!==value&&(this._x=value,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(ObservablePoint.prototype,"y",{get:function(){return this._y},set:function(value){this._y!==value&&(this._y=value,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),ObservablePoint}(),Matrix=function(){function Matrix(a,b,c,d,tx,ty){void 0===a&&(a=1),void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=1),void 0===tx&&(tx=0),void 0===ty&&(ty=0),this.array=null,this.a=a,this.b=b,this.c=c,this.d=d,this.tx=tx,this.ty=ty}return Matrix.prototype.fromArray=function(array){this.a=array[0],this.b=array[1],this.c=array[3],this.d=array[4],this.tx=array[2],this.ty=array[5]},Matrix.prototype.set=function(a,b,c,d,tx,ty){return this.a=a,this.b=b,this.c=c,this.d=d,this.tx=tx,this.ty=ty,this},Matrix.prototype.toArray=function(transpose,out){this.array||(this.array=new Float32Array(9));var array=out||this.array;return transpose?(array[0]=this.a,array[1]=this.b,array[2]=0,array[3]=this.c,array[4]=this.d,array[5]=0,array[6]=this.tx,array[7]=this.ty,array[8]=1):(array[0]=this.a,array[1]=this.c,array[2]=this.tx,array[3]=this.b,array[4]=this.d,array[5]=this.ty,array[6]=0,array[7]=0,array[8]=1),array},Matrix.prototype.apply=function(pos,newPos){newPos=newPos||new Point;var x=pos.x,y=pos.y;return newPos.x=this.a*x+this.c*y+this.tx,newPos.y=this.b*x+this.d*y+this.ty,newPos},Matrix.prototype.applyInverse=function(pos,newPos){newPos=newPos||new Point;var id=1/(this.a*this.d+this.c*-this.b),x=pos.x,y=pos.y;return newPos.x=this.d*id*x+-this.c*id*y+(this.ty*this.c-this.tx*this.d)*id,newPos.y=this.a*id*y+-this.b*id*x+(-this.ty*this.a+this.tx*this.b)*id,newPos},Matrix.prototype.translate=function(x,y){return this.tx+=x,this.ty+=y,this},Matrix.prototype.scale=function(x,y){return this.a*=x,this.d*=y,this.c*=x,this.b*=y,this.tx*=x,this.ty*=y,this},Matrix.prototype.rotate=function(angle){var cos=Math.cos(angle),sin=Math.sin(angle),a1=this.a,c1=this.c,tx1=this.tx;return this.a=a1*cos-this.b*sin,this.b=a1*sin+this.b*cos,this.c=c1*cos-this.d*sin,this.d=c1*sin+this.d*cos,this.tx=tx1*cos-this.ty*sin,this.ty=tx1*sin+this.ty*cos,this},Matrix.prototype.append=function(matrix){var a1=this.a,b1=this.b,c1=this.c,d1=this.d;return this.a=matrix.a*a1+matrix.b*c1,this.b=matrix.a*b1+matrix.b*d1,this.c=matrix.c*a1+matrix.d*c1,this.d=matrix.c*b1+matrix.d*d1,this.tx=matrix.tx*a1+matrix.ty*c1+this.tx,this.ty=matrix.tx*b1+matrix.ty*d1+this.ty,this},Matrix.prototype.setTransform=function(x,y,pivotX,pivotY,scaleX,scaleY,rotation,skewX,skewY){return this.a=Math.cos(rotation+skewY)*scaleX,this.b=Math.sin(rotation+skewY)*scaleX,this.c=-Math.sin(rotation-skewX)*scaleY,this.d=Math.cos(rotation-skewX)*scaleY,this.tx=x-(pivotX*this.a+pivotY*this.c),this.ty=y-(pivotX*this.b+pivotY*this.d),this},Matrix.prototype.prepend=function(matrix){var tx1=this.tx;if(1!==matrix.a||0!==matrix.b||0!==matrix.c||1!==matrix.d){var a1=this.a,c1=this.c;this.a=a1*matrix.a+this.b*matrix.c,this.b=a1*matrix.b+this.b*matrix.d,this.c=c1*matrix.a+this.d*matrix.c,this.d=c1*matrix.b+this.d*matrix.d}return this.tx=tx1*matrix.a+this.ty*matrix.c+matrix.tx,this.ty=tx1*matrix.b+this.ty*matrix.d+matrix.ty,this},Matrix.prototype.decompose=function(transform){var a=this.a,b=this.b,c=this.c,d=this.d,pivot=transform.pivot,skewX=-Math.atan2(-c,d),skewY=Math.atan2(b,a),delta=Math.abs(skewX+skewY);return delta<1e-5||Math.abs(PI_2-delta)<1e-5?(transform.rotation=skewY,transform.skew.x=transform.skew.y=0):(transform.rotation=0,transform.skew.x=skewX,transform.skew.y=skewY),transform.scale.x=Math.sqrt(a*a+b*b),transform.scale.y=Math.sqrt(c*c+d*d),transform.position.x=this.tx+(pivot.x*a+pivot.y*c),transform.position.y=this.ty+(pivot.x*b+pivot.y*d),transform},Matrix.prototype.invert=function(){var a1=this.a,b1=this.b,c1=this.c,d1=this.d,tx1=this.tx,n=a1*d1-b1*c1;return this.a=d1/n,this.b=-b1/n,this.c=-c1/n,this.d=a1/n,this.tx=(c1*this.ty-d1*tx1)/n,this.ty=-(a1*this.ty-b1*tx1)/n,this},Matrix.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},Matrix.prototype.clone=function(){var matrix=new Matrix;return matrix.a=this.a,matrix.b=this.b,matrix.c=this.c,matrix.d=this.d,matrix.tx=this.tx,matrix.ty=this.ty,matrix},Matrix.prototype.copyTo=function(matrix){return matrix.a=this.a,matrix.b=this.b,matrix.c=this.c,matrix.d=this.d,matrix.tx=this.tx,matrix.ty=this.ty,matrix},Matrix.prototype.copyFrom=function(matrix){return this.a=matrix.a,this.b=matrix.b,this.c=matrix.c,this.d=matrix.d,this.tx=matrix.tx,this.ty=matrix.ty,this},Matrix.prototype.toString=function(){return"[@pixi/math:Matrix a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+"]"},Object.defineProperty(Matrix,"IDENTITY",{get:function(){return new Matrix},enumerable:!1,configurable:!0}),Object.defineProperty(Matrix,"TEMP_MATRIX",{get:function(){return new Matrix},enumerable:!1,configurable:!0}),Matrix}(),ux=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],uy=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],vx=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],vy=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],rotationCayley=[],rotationMatrices=[],signum=Math.sign;!function(){for(var i=0;i<16;i++){var row=[];rotationCayley.push(row);for(var j=0;j<16;j++)for(var _ux=signum(ux[i]*ux[j]+vx[i]*uy[j]),_uy=signum(uy[i]*ux[j]+vy[i]*uy[j]),_vx=signum(ux[i]*vx[j]+vx[i]*vy[j]),_vy=signum(uy[i]*vx[j]+vy[i]*vy[j]),k=0;k<16;k++)if(ux[k]===_ux&&uy[k]===_uy&&vx[k]===_vx&&vy[k]===_vy){row.push(k);break}}for(i=0;i<16;i++){var mat=new Matrix;mat.set(ux[i],uy[i],vx[i],vy[i],0,0),rotationMatrices.push(mat)}}();var groupD8={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(ind){return ux[ind]},uY:function(ind){return uy[ind]},vX:function(ind){return vx[ind]},vY:function(ind){return vy[ind]},inv:function(rotation){return 8&rotation?15&rotation:7&-rotation},add:function(rotationSecond,rotationFirst){return rotationCayley[rotationSecond][rotationFirst]},sub:function(rotationSecond,rotationFirst){return rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]},rotate180:function(rotation){return 4^rotation},isVertical:function(rotation){return 2==(3&rotation)},byDirection:function(dx,dy){return 2*Math.abs(dx)<=Math.abs(dy)?dy>=0?groupD8.S:groupD8.N:2*Math.abs(dy)<=Math.abs(dx)?dx>0?groupD8.E:groupD8.W:dy>0?dx>0?groupD8.SE:groupD8.SW:dx>0?groupD8.NE:groupD8.NW},matrixAppendRotationInv:function(matrix,rotation,tx,ty){void 0===tx&&(tx=0),void 0===ty&&(ty=0);var mat=rotationMatrices[groupD8.inv(rotation)];mat.tx=tx,mat.ty=ty,matrix.append(mat)}},Transform=function(){function Transform(){this.worldTransform=new Matrix,this.localTransform=new Matrix,this.position=new ObservablePoint(this.onChange,this,0,0),this.scale=new ObservablePoint(this.onChange,this,1,1),this.pivot=new ObservablePoint(this.onChange,this,0,0),this.skew=new ObservablePoint(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return Transform.prototype.onChange=function(){this._localID++},Transform.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},Transform.prototype.toString=function(){return"[@pixi/math:Transform position=("+this.position.x+", "+this.position.y+") rotation="+this.rotation+" scale=("+this.scale.x+", "+this.scale.y+") skew=("+this.skew.x+", "+this.skew.y+") ]"},Transform.prototype.updateLocalTransform=function(){var lt=this.localTransform;this._localID!==this._currentLocalID&&(lt.a=this._cx*this.scale.x,lt.b=this._sx*this.scale.x,lt.c=this._cy*this.scale.y,lt.d=this._sy*this.scale.y,lt.tx=this.position.x-(this.pivot.x*lt.a+this.pivot.y*lt.c),lt.ty=this.position.y-(this.pivot.x*lt.b+this.pivot.y*lt.d),this._currentLocalID=this._localID,this._parentID=-1)},Transform.prototype.updateTransform=function(parentTransform){var lt=this.localTransform;if(this._localID!==this._currentLocalID&&(lt.a=this._cx*this.scale.x,lt.b=this._sx*this.scale.x,lt.c=this._cy*this.scale.y,lt.d=this._sy*this.scale.y,lt.tx=this.position.x-(this.pivot.x*lt.a+this.pivot.y*lt.c),lt.ty=this.position.y-(this.pivot.x*lt.b+this.pivot.y*lt.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==parentTransform._worldID){var pt=parentTransform.worldTransform,wt=this.worldTransform;wt.a=lt.a*pt.a+lt.b*pt.c,wt.b=lt.a*pt.b+lt.b*pt.d,wt.c=lt.c*pt.a+lt.d*pt.c,wt.d=lt.c*pt.b+lt.d*pt.d,wt.tx=lt.tx*pt.a+lt.ty*pt.c+pt.tx,wt.ty=lt.tx*pt.b+lt.ty*pt.d+pt.ty,this._parentID=parentTransform._worldID,this._worldID++}},Transform.prototype.setFromMatrix=function(matrix){matrix.decompose(this),this._localID++},Object.defineProperty(Transform.prototype,"rotation",{get:function(){return this._rotation},set:function(value){this._rotation!==value&&(this._rotation=value,this.updateSkew())},enumerable:!1,configurable:!0}),Transform.IDENTITY=new Transform,Transform}();
|
|
51
52
|
/*!
|
|
52
|
-
* @pixi/display -
|
|
53
|
-
* Compiled
|
|
53
|
+
* @pixi/display - v6.4.2
|
|
54
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
54
55
|
*
|
|
55
56
|
* @pixi/display is licensed under the MIT License.
|
|
56
57
|
* http://www.opensource.org/licenses/mit-license
|
|
57
58
|
*/
|
|
58
|
-
settings.SORTABLE_CHILDREN=!1;var Bounds=function(){function Bounds(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return Bounds.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},Bounds.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},Bounds.prototype.getRectangle=function(rect){return this.minX>this.maxX||this.minY>this.maxY?Rectangle.EMPTY:((rect=rect||new Rectangle(0,0,1,1)).x=this.minX,rect.y=this.minY,rect.width=this.maxX-this.minX,rect.height=this.maxY-this.minY,rect)},Bounds.prototype.addPoint=function(point){this.minX=Math.min(this.minX,point.x),this.maxX=Math.max(this.maxX,point.x),this.minY=Math.min(this.minY,point.y),this.maxY=Math.max(this.maxY,point.y)},Bounds.prototype.addQuad=function(vertices){var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY,x=vertices[0],y=vertices[1];minX=x<minX?x:minX,minY=y<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=vertices[2])<minX?x:minX,minY=(y=vertices[3])<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=vertices[4])<minX?x:minX,minY=(y=vertices[5])<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=vertices[6])<minX?x:minX,minY=(y=vertices[7])<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,this.minX=minX,this.minY=minY,this.maxX=maxX,this.maxY=maxY},Bounds.prototype.addFrame=function(transform,x0,y0,x1,y1){this.addFrameMatrix(transform.worldTransform,x0,y0,x1,y1)},Bounds.prototype.addFrameMatrix=function(matrix,x0,y0,x1,y1){var a=matrix.a,b=matrix.b,c=matrix.c,d=matrix.d,tx=matrix.tx,ty=matrix.ty,minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY,x=a*x0+c*y0+tx,y=b*x0+d*y0+ty;minX=x<minX?x:minX,minY=y<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=a*x1+c*y0+tx)<minX?x:minX,minY=(y=b*x1+d*y0+ty)<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=a*x0+c*y1+tx)<minX?x:minX,minY=(y=b*x0+d*y1+ty)<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=a*x1+c*y1+tx)<minX?x:minX,minY=(y=b*x1+d*y1+ty)<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,this.minX=minX,this.minY=minY,this.maxX=maxX,this.maxY=maxY},Bounds.prototype.addVertexData=function(vertexData,beginOffset,endOffset){for(var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY,i=beginOffset;i<endOffset;i+=2){var x=vertexData[i],y=vertexData[i+1];minX=x<minX?x:minX,minY=y<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY}this.minX=minX,this.minY=minY,this.maxX=maxX,this.maxY=maxY},Bounds.prototype.addVertices=function(transform,vertices,beginOffset,endOffset){this.addVerticesMatrix(transform.worldTransform,vertices,beginOffset,endOffset)},Bounds.prototype.addVerticesMatrix=function(matrix,vertices,beginOffset,endOffset,padX,padY){void 0===padX&&(padX=0),void 0===padY&&(padY=padX);for(var a=matrix.a,b=matrix.b,c=matrix.c,d=matrix.d,tx=matrix.tx,ty=matrix.ty,minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY,i=beginOffset;i<endOffset;i+=2){var rawX=vertices[i],rawY=vertices[i+1],x=a*rawX+c*rawY+tx,y=d*rawY+b*rawX+ty;minX=Math.min(minX,x-padX),maxX=Math.max(maxX,x+padX),minY=Math.min(minY,y-padY),maxY=Math.max(maxY,y+padY)}this.minX=minX,this.minY=minY,this.maxX=maxX,this.maxY=maxY},Bounds.prototype.addBounds=function(bounds){var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY;this.minX=bounds.minX<minX?bounds.minX:minX,this.minY=bounds.minY<minY?bounds.minY:minY,this.maxX=bounds.maxX>maxX?bounds.maxX:maxX,this.maxY=bounds.maxY>maxY?bounds.maxY:maxY},Bounds.prototype.addBoundsMask=function(bounds,mask){var _minX=bounds.minX>mask.minX?bounds.minX:mask.minX,_minY=bounds.minY>mask.minY?bounds.minY:mask.minY,_maxX=bounds.maxX<mask.maxX?bounds.maxX:mask.maxX,_maxY=bounds.maxY<mask.maxY?bounds.maxY:mask.maxY;if(_minX<=_maxX&&_minY<=_maxY){var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY;this.minX=_minX<minX?_minX:minX,this.minY=_minY<minY?_minY:minY,this.maxX=_maxX>maxX?_maxX:maxX,this.maxY=_maxY>maxY?_maxY:maxY}},Bounds.prototype.addBoundsMatrix=function(bounds,matrix){this.addFrameMatrix(matrix,bounds.minX,bounds.minY,bounds.maxX,bounds.maxY)},Bounds.prototype.addBoundsArea=function(bounds,area){var _minX=bounds.minX>area.x?bounds.minX:area.x,_minY=bounds.minY>area.y?bounds.minY:area.y,_maxX=bounds.maxX<area.x+area.width?bounds.maxX:area.x+area.width,_maxY=bounds.maxY<area.y+area.height?bounds.maxY:area.y+area.height;if(_minX<=_maxX&&_minY<=_maxY){var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY;this.minX=_minX<minX?_minX:minX,this.minY=_minY<minY?_minY:minY,this.maxX=_maxX>maxX?_maxX:maxX,this.maxY=_maxY>maxY?_maxY:maxY}},Bounds.prototype.pad=function(paddingX,paddingY){void 0===paddingX&&(paddingX=0),void 0===paddingY&&(paddingY=paddingX),this.isEmpty()||(this.minX-=paddingX,this.maxX+=paddingX,this.minY-=paddingY,this.maxY+=paddingY)},Bounds.prototype.addFramePad=function(x0,y0,x1,y1,padX,padY){x0-=padX,y0-=padY,x1+=padX,y1+=padY,this.minX=this.minX<x0?this.minX:x0,this.maxX=this.maxX>x1?this.maxX:x1,this.minY=this.minY<y0?this.minY:y0,this.maxY=this.maxY>y1?this.maxY:y1},Bounds}(),extendStatics$1=function(d,b){return
|
|
59
|
+
settings.SORTABLE_CHILDREN=!1;var Bounds=function(){function Bounds(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return Bounds.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},Bounds.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},Bounds.prototype.getRectangle=function(rect){return this.minX>this.maxX||this.minY>this.maxY?Rectangle.EMPTY:((rect=rect||new Rectangle(0,0,1,1)).x=this.minX,rect.y=this.minY,rect.width=this.maxX-this.minX,rect.height=this.maxY-this.minY,rect)},Bounds.prototype.addPoint=function(point){this.minX=Math.min(this.minX,point.x),this.maxX=Math.max(this.maxX,point.x),this.minY=Math.min(this.minY,point.y),this.maxY=Math.max(this.maxY,point.y)},Bounds.prototype.addPointMatrix=function(matrix,point){var a=matrix.a,b=matrix.b,c=matrix.c,d=matrix.d,tx=matrix.tx,ty=matrix.ty,x=a*point.x+c*point.y+tx,y=b*point.x+d*point.y+ty;this.minX=Math.min(this.minX,x),this.maxX=Math.max(this.maxX,x),this.minY=Math.min(this.minY,y),this.maxY=Math.max(this.maxY,y)},Bounds.prototype.addQuad=function(vertices){var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY,x=vertices[0],y=vertices[1];minX=x<minX?x:minX,minY=y<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=vertices[2])<minX?x:minX,minY=(y=vertices[3])<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=vertices[4])<minX?x:minX,minY=(y=vertices[5])<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=vertices[6])<minX?x:minX,minY=(y=vertices[7])<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,this.minX=minX,this.minY=minY,this.maxX=maxX,this.maxY=maxY},Bounds.prototype.addFrame=function(transform,x0,y0,x1,y1){this.addFrameMatrix(transform.worldTransform,x0,y0,x1,y1)},Bounds.prototype.addFrameMatrix=function(matrix,x0,y0,x1,y1){var a=matrix.a,b=matrix.b,c=matrix.c,d=matrix.d,tx=matrix.tx,ty=matrix.ty,minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY,x=a*x0+c*y0+tx,y=b*x0+d*y0+ty;minX=x<minX?x:minX,minY=y<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=a*x1+c*y0+tx)<minX?x:minX,minY=(y=b*x1+d*y0+ty)<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=a*x0+c*y1+tx)<minX?x:minX,minY=(y=b*x0+d*y1+ty)<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=a*x1+c*y1+tx)<minX?x:minX,minY=(y=b*x1+d*y1+ty)<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,this.minX=minX,this.minY=minY,this.maxX=maxX,this.maxY=maxY},Bounds.prototype.addVertexData=function(vertexData,beginOffset,endOffset){for(var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY,i=beginOffset;i<endOffset;i+=2){var x=vertexData[i],y=vertexData[i+1];minX=x<minX?x:minX,minY=y<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY}this.minX=minX,this.minY=minY,this.maxX=maxX,this.maxY=maxY},Bounds.prototype.addVertices=function(transform,vertices,beginOffset,endOffset){this.addVerticesMatrix(transform.worldTransform,vertices,beginOffset,endOffset)},Bounds.prototype.addVerticesMatrix=function(matrix,vertices,beginOffset,endOffset,padX,padY){void 0===padX&&(padX=0),void 0===padY&&(padY=padX);for(var a=matrix.a,b=matrix.b,c=matrix.c,d=matrix.d,tx=matrix.tx,ty=matrix.ty,minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY,i=beginOffset;i<endOffset;i+=2){var rawX=vertices[i],rawY=vertices[i+1],x=a*rawX+c*rawY+tx,y=d*rawY+b*rawX+ty;minX=Math.min(minX,x-padX),maxX=Math.max(maxX,x+padX),minY=Math.min(minY,y-padY),maxY=Math.max(maxY,y+padY)}this.minX=minX,this.minY=minY,this.maxX=maxX,this.maxY=maxY},Bounds.prototype.addBounds=function(bounds){var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY;this.minX=bounds.minX<minX?bounds.minX:minX,this.minY=bounds.minY<minY?bounds.minY:minY,this.maxX=bounds.maxX>maxX?bounds.maxX:maxX,this.maxY=bounds.maxY>maxY?bounds.maxY:maxY},Bounds.prototype.addBoundsMask=function(bounds,mask){var _minX=bounds.minX>mask.minX?bounds.minX:mask.minX,_minY=bounds.minY>mask.minY?bounds.minY:mask.minY,_maxX=bounds.maxX<mask.maxX?bounds.maxX:mask.maxX,_maxY=bounds.maxY<mask.maxY?bounds.maxY:mask.maxY;if(_minX<=_maxX&&_minY<=_maxY){var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY;this.minX=_minX<minX?_minX:minX,this.minY=_minY<minY?_minY:minY,this.maxX=_maxX>maxX?_maxX:maxX,this.maxY=_maxY>maxY?_maxY:maxY}},Bounds.prototype.addBoundsMatrix=function(bounds,matrix){this.addFrameMatrix(matrix,bounds.minX,bounds.minY,bounds.maxX,bounds.maxY)},Bounds.prototype.addBoundsArea=function(bounds,area){var _minX=bounds.minX>area.x?bounds.minX:area.x,_minY=bounds.minY>area.y?bounds.minY:area.y,_maxX=bounds.maxX<area.x+area.width?bounds.maxX:area.x+area.width,_maxY=bounds.maxY<area.y+area.height?bounds.maxY:area.y+area.height;if(_minX<=_maxX&&_minY<=_maxY){var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY;this.minX=_minX<minX?_minX:minX,this.minY=_minY<minY?_minY:minY,this.maxX=_maxX>maxX?_maxX:maxX,this.maxY=_maxY>maxY?_maxY:maxY}},Bounds.prototype.pad=function(paddingX,paddingY){void 0===paddingX&&(paddingX=0),void 0===paddingY&&(paddingY=paddingX),this.isEmpty()||(this.minX-=paddingX,this.maxX+=paddingX,this.minY-=paddingY,this.maxY+=paddingY)},Bounds.prototype.addFramePad=function(x0,y0,x1,y1,padX,padY){x0-=padX,y0-=padY,x1+=padX,y1+=padY,this.minX=this.minX<x0?this.minX:x0,this.maxX=this.maxX>x1?this.maxX:x1,this.minY=this.minY<y0?this.minY:y0,this.maxY=this.maxY>y1?this.maxY:y1},Bounds}(),extendStatics$1=function(d,b){return extendStatics$1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$1(d,b)};
|
|
59
60
|
/*! *****************************************************************************
|
|
60
61
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
61
62
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -69,23 +70,23 @@ settings.SORTABLE_CHILDREN=!1;var Bounds=function(){function Bounds(){this.minX=
|
|
|
69
70
|
|
|
70
71
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
71
72
|
and limitations under the License.
|
|
72
|
-
***************************************************************************** */function __extends$1(d,b){function __(){this.constructor=d}extendStatics$1(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var DisplayObject=function(_super){function DisplayObject(){var _this=_super.call(this)||this;return _this.tempDisplayObjectParent=null,_this.transform=new Transform,_this.alpha=1,_this.visible=!0,_this.renderable=!0,_this.parent=null,_this.worldAlpha=1,_this._lastSortedIndex=0,_this._zIndex=0,_this.filterArea=null,_this.filters=null,_this._enabledFilters=null,_this._bounds=new Bounds,_this._localBounds=null,_this._boundsID=0,_this._boundsRect=null,_this._localBoundsRect=null,_this._mask=null,_this._destroyed=!1,_this.isSprite=!1,_this.isMask=!1,_this}return __extends$1(DisplayObject,_super),DisplayObject.mixin=function(source){for(var keys=Object.keys(source),i=0;i<keys.length;++i){var propertyName=keys[i];Object.defineProperty(DisplayObject.prototype,propertyName,Object.getOwnPropertyDescriptor(source,propertyName))}},DisplayObject.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},DisplayObject.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},DisplayObject.prototype.getBounds=function(skipUpdate,rect){return skipUpdate||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),rect||(this._boundsRect||(this._boundsRect=new Rectangle),rect=this._boundsRect),this._bounds.getRectangle(rect)},DisplayObject.prototype.getLocalBounds=function(rect){rect||(this._localBoundsRect||(this._localBoundsRect=new Rectangle),rect=this._localBoundsRect),this._localBounds||(this._localBounds=new Bounds);var transformRef=this.transform,parentRef=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var worldBounds=this._bounds,worldBoundsID=this._boundsID;this._bounds=this._localBounds;var bounds=this.getBounds(!1,rect);return this.parent=parentRef,this.transform=transformRef,this._bounds=worldBounds,this._bounds.updateID+=this._boundsID-worldBoundsID,bounds},DisplayObject.prototype.toGlobal=function(position,point,skipUpdate){return void 0===skipUpdate&&(skipUpdate=!1),skipUpdate||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(position,point)},DisplayObject.prototype.toLocal=function(position,from,point,skipUpdate){return from&&(position=from.toGlobal(position,point,skipUpdate)),skipUpdate||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(position,point)},DisplayObject.prototype.setParent=function(container){if(!container||!container.addChild)throw new Error("setParent: Argument must be a Container");return container.addChild(this),container},DisplayObject.prototype.setTransform=function(x,y,scaleX,scaleY,rotation,skewX,skewY,pivotX,pivotY){return void 0===x&&(x=0),void 0===y&&(y=0),void 0===scaleX&&(scaleX=1),void 0===scaleY&&(scaleY=1),void 0===rotation&&(rotation=0),void 0===skewX&&(skewX=0),void 0===skewY&&(skewY=0),void 0===pivotX&&(pivotX=0),void 0===pivotY&&(pivotY=0),this.position.x=x,this.position.y=y,this.scale.x=scaleX||1,this.scale.y=scaleY||1,this.rotation=rotation,this.skew.x=skewX,this.skew.y=skewY,this.pivot.x=pivotX,this.pivot.y=pivotY,this},DisplayObject.prototype.destroy=function(_options){this.parent&&this.parent.removeChild(this),this.removeAllListeners(),this.transform=null,this.parent=null,this._bounds=null,this._mask=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this._destroyed=!0},Object.defineProperty(DisplayObject.prototype,"_tempDisplayObjectParent",{get:function(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new TemporaryDisplayObject),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),DisplayObject.prototype.enableTempParent=function(){var myParent=this.parent;return this.parent=this._tempDisplayObjectParent,myParent},DisplayObject.prototype.disableTempParent=function(cacheParent){this.parent=cacheParent},Object.defineProperty(DisplayObject.prototype,"x",{get:function(){return this.position.x},set:function(value){this.transform.position.x=value},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"y",{get:function(){return this.position.y},set:function(value){this.transform.position.y=value},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"position",{get:function(){return this.transform.position},set:function(value){this.transform.position.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"scale",{get:function(){return this.transform.scale},set:function(value){this.transform.scale.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(value){this.transform.pivot.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"skew",{get:function(){return this.transform.skew},set:function(value){this.transform.skew.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(value){this.transform.rotation=value},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"angle",{get:function(){return this.transform.rotation*RAD_TO_DEG},set:function(value){this.transform.rotation=value*DEG_TO_RAD},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"zIndex",{get:function(){return this._zIndex},set:function(value){this._zIndex=value,this.parent&&(this.parent.sortDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"worldVisible",{get:function(){var item=this;do{if(!item.visible)return!1;item=item.parent}while(item);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(value){var maskObject;this._mask&&((maskObject=this._mask.maskObject||this._mask).renderable=!0,maskObject.isMask=!1);(this._mask=value,this._mask)&&((maskObject=this._mask.maskObject||this._mask).renderable=!1,maskObject.isMask=!0)},enumerable:!1,configurable:!0}),DisplayObject}(eventemitter3),TemporaryDisplayObject=function(_super){function TemporaryDisplayObject(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.sortDirty=null,_this}return __extends$1(TemporaryDisplayObject,_super),TemporaryDisplayObject}(DisplayObject);function sortChildren(a,b){return a.zIndex===b.zIndex?a._lastSortedIndex-b._lastSortedIndex:a.zIndex-b.zIndex}DisplayObject.prototype.displayObjectUpdateTransform=DisplayObject.prototype.updateTransform;var Container=function(_super){function Container(){var _this=_super.call(this)||this;return _this.children=[],_this.sortableChildren=settings.SORTABLE_CHILDREN,_this.sortDirty=!1,_this}return __extends$1(Container,_super),Container.prototype.onChildrenChange=function(_length){},Container.prototype.addChild=function(){for(var arguments$1=arguments,children=[],_i=0;_i<arguments.length;_i++)children[_i]=arguments$1[_i];if(children.length>1)for(var i=0;i<children.length;i++)this.addChild(children[i]);else{var child=children[0];child.parent&&child.parent.removeChild(child),child.parent=this,this.sortDirty=!0,child.transform._parentID=-1,this.children.push(child),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",child,this,this.children.length-1),child.emit("added",this)}return children[0]},Container.prototype.addChildAt=function(child,index){if(index<0||index>this.children.length)throw new Error(child+"addChildAt: The index "+index+" supplied is out of bounds "+this.children.length);return child.parent&&child.parent.removeChild(child),child.parent=this,this.sortDirty=!0,child.transform._parentID=-1,this.children.splice(index,0,child),this._boundsID++,this.onChildrenChange(index),child.emit("added",this),this.emit("childAdded",child,this,index),child},Container.prototype.swapChildren=function(child,child2){if(child!==child2){var index1=this.getChildIndex(child),index2=this.getChildIndex(child2);this.children[index1]=child2,this.children[index2]=child,this.onChildrenChange(index1<index2?index1:index2)}},Container.prototype.getChildIndex=function(child){var index=this.children.indexOf(child);if(-1===index)throw new Error("The supplied DisplayObject must be a child of the caller");return index},Container.prototype.setChildIndex=function(child,index){if(index<0||index>=this.children.length)throw new Error("The index "+index+" supplied is out of bounds "+this.children.length);var currentIndex=this.getChildIndex(child);removeItems(this.children,currentIndex,1),this.children.splice(index,0,child),this.onChildrenChange(index)},Container.prototype.getChildAt=function(index){if(index<0||index>=this.children.length)throw new Error("getChildAt: Index ("+index+") does not exist.");return this.children[index]},Container.prototype.removeChild=function(){for(var arguments$1=arguments,children=[],_i=0;_i<arguments.length;_i++)children[_i]=arguments$1[_i];if(children.length>1)for(var i=0;i<children.length;i++)this.removeChild(children[i]);else{var child=children[0],index=this.children.indexOf(child);if(-1===index)return null;child.parent=null,child.transform._parentID=-1,removeItems(this.children,index,1),this._boundsID++,this.onChildrenChange(index),child.emit("removed",this),this.emit("childRemoved",child,this,index)}return children[0]},Container.prototype.removeChildAt=function(index){var child=this.getChildAt(index);return child.parent=null,child.transform._parentID=-1,removeItems(this.children,index,1),this._boundsID++,this.onChildrenChange(index),child.emit("removed",this),this.emit("childRemoved",child,this,index),child},Container.prototype.removeChildren=function(beginIndex,endIndex){void 0===beginIndex&&(beginIndex=0),void 0===endIndex&&(endIndex=this.children.length);var removed,begin=beginIndex,range=endIndex-begin;if(range>0&&range<=endIndex){removed=this.children.splice(begin,range);for(var i=0;i<removed.length;++i)removed[i].parent=null,removed[i].transform&&(removed[i].transform._parentID=-1);this._boundsID++,this.onChildrenChange(beginIndex);for(i=0;i<removed.length;++i)removed[i].emit("removed",this),this.emit("childRemoved",removed[i],this,i);return removed}if(0===range&&0===this.children.length)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},Container.prototype.sortChildren=function(){for(var sortRequired=!1,i=0,j=this.children.length;i<j;++i){var child=this.children[i];child._lastSortedIndex=i,sortRequired||0===child.zIndex||(sortRequired=!0)}sortRequired&&this.children.length>1&&this.children.sort(sortChildren),this.sortDirty=!1},Container.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var i=0,j=this.children.length;i<j;++i){var child=this.children[i];child.visible&&child.updateTransform()}},Container.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var i=0;i<this.children.length;i++){var child=this.children[i];if(child.visible&&child.renderable)if(child.calculateBounds(),child._mask){var maskObject=child._mask.maskObject||child._mask;maskObject.calculateBounds(),this._bounds.addBoundsMask(child._bounds,maskObject._bounds)}else child.filterArea?this._bounds.addBoundsArea(child._bounds,child.filterArea):this._bounds.addBounds(child._bounds)}this._bounds.updateID=this._boundsID},Container.prototype.getLocalBounds=function(rect,skipChildrenUpdate){void 0===skipChildrenUpdate&&(skipChildrenUpdate=!1);var result=_super.prototype.getLocalBounds.call(this,rect);if(!skipChildrenUpdate)for(var i=0,j=this.children.length;i<j;++i){var child=this.children[i];child.visible&&child.updateTransform()}return result},Container.prototype._calculateBounds=function(){},Container.prototype.render=function(renderer){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable)if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(renderer);else{this._render(renderer);for(var i=0,j=this.children.length;i<j;++i)this.children[i].render(renderer)}},Container.prototype.renderAdvanced=function(renderer){renderer.batch.flush();var filters=this.filters,mask=this._mask;if(filters){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var i=0;i<filters.length;i++)filters[i].enabled&&this._enabledFilters.push(filters[i]);this._enabledFilters.length&&renderer.filter.push(this,this._enabledFilters)}mask&&renderer.mask.push(this,this._mask),this._render(renderer);i=0;for(var j=this.children.length;i<j;i++)this.children[i].render(renderer);renderer.batch.flush(),mask&&renderer.mask.pop(this),filters&&this._enabledFilters&&this._enabledFilters.length&&renderer.filter.pop()},Container.prototype._render=function(_renderer){},Container.prototype.destroy=function(options){_super.prototype.destroy.call(this),this.sortDirty=!1;var destroyChildren="boolean"==typeof options?options:options&&options.children,oldChildren=this.removeChildren(0,this.children.length);if(destroyChildren)for(var i=0;i<oldChildren.length;++i)oldChildren[i].destroy(options)},Object.defineProperty(Container.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(value){var width=this.getLocalBounds().width;this.scale.x=0!==width?value/width:1,this._width=value},enumerable:!1,configurable:!0}),Object.defineProperty(Container.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(value){var height=this.getLocalBounds().height;this.scale.y=0!==height?value/height:1,this._height=value},enumerable:!1,configurable:!0}),Container}(DisplayObject);Container.prototype.containerUpdateTransform=Container.prototype.updateTransform;DisplayObject.mixin({accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1});var UPDATE_PRIORITY,AccessibilityManager=function(){function AccessibilityManager(renderer){this._hookDiv=null,(isMobile$1.tablet||isMobile$1.phone)&&this.createTouchHook();var div=document.createElement("div");div.style.width="100px",div.style.height="100px",div.style.position="absolute",div.style.top="0px",div.style.left="0px",div.style.zIndex=2..toString(),this.div=div,this.pool=[],this.renderId=0,this.debug=!1,this.renderer=renderer,this.children=[],this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._isActive=!1,this._isMobileAccessibility=!1,this.androidUpdateCount=0,this.androidUpdateFrequency=500,window.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(AccessibilityManager.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(AccessibilityManager.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),AccessibilityManager.prototype.createTouchHook=function(){var _this=this,hookDiv=document.createElement("button");hookDiv.style.width="1px",hookDiv.style.height="1px",hookDiv.style.position="absolute",hookDiv.style.top="-1000px",hookDiv.style.left="-1000px",hookDiv.style.zIndex=2..toString(),hookDiv.style.backgroundColor="#FF0000",hookDiv.title="select to enable accessability for this content",hookDiv.addEventListener("focus",(function(){_this._isMobileAccessibility=!0,_this.activate(),_this.destroyTouchHook()})),document.body.appendChild(hookDiv),this._hookDiv=hookDiv},AccessibilityManager.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},AccessibilityManager.prototype.activate=function(){this._isActive||(this._isActive=!0,window.document.addEventListener("mousemove",this._onMouseMove,!0),window.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),this.renderer.view.parentNode&&this.renderer.view.parentNode.appendChild(this.div))},AccessibilityManager.prototype.deactivate=function(){this._isActive&&!this._isMobileAccessibility&&(this._isActive=!1,window.document.removeEventListener("mousemove",this._onMouseMove,!0),window.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),this.div.parentNode&&this.div.parentNode.removeChild(this.div))},AccessibilityManager.prototype.updateAccessibleObjects=function(displayObject){if(displayObject.visible&&displayObject.accessibleChildren){displayObject.accessible&&displayObject.interactive&&(displayObject._accessibleActive||this.addChild(displayObject),displayObject.renderId=this.renderId);for(var children=displayObject.children,i=0;i<children.length;i++)this.updateAccessibleObjects(children[i])}},AccessibilityManager.prototype.update=function(){var now=performance.now();if(!(isMobile$1.android.device&&now<this.androidUpdateCount)&&(this.androidUpdateCount=now+this.androidUpdateFrequency,this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var rect=this.renderer.view.getBoundingClientRect(),resolution=this.renderer.resolution,sx=rect.width/this.renderer.width*resolution,sy=rect.height/this.renderer.height*resolution,div=this.div;div.style.left=rect.left+"px",div.style.top=rect.top+"px",div.style.width=this.renderer.width+"px",div.style.height=this.renderer.height+"px";for(var i=0;i<this.children.length;i++){var child=this.children[i];if(child.renderId!==this.renderId)child._accessibleActive=!1,removeItems(this.children,i,1),this.div.removeChild(child._accessibleDiv),this.pool.push(child._accessibleDiv),child._accessibleDiv=null,i--;else{div=child._accessibleDiv;var hitArea=child.hitArea,wt=child.worldTransform;child.hitArea?(div.style.left=(wt.tx+hitArea.x*wt.a)*sx+"px",div.style.top=(wt.ty+hitArea.y*wt.d)*sy+"px",div.style.width=hitArea.width*wt.a*sx+"px",div.style.height=hitArea.height*wt.d*sy+"px"):(hitArea=child.getBounds(),this.capHitArea(hitArea),div.style.left=hitArea.x*sx+"px",div.style.top=hitArea.y*sy+"px",div.style.width=hitArea.width*sx+"px",div.style.height=hitArea.height*sy+"px",div.title!==child.accessibleTitle&&null!==child.accessibleTitle&&(div.title=child.accessibleTitle),div.getAttribute("aria-label")!==child.accessibleHint&&null!==child.accessibleHint&&div.setAttribute("aria-label",child.accessibleHint)),child.accessibleTitle===div.title&&child.tabIndex===div.tabIndex||(div.title=child.accessibleTitle,div.tabIndex=child.tabIndex,this.debug&&this.updateDebugHTML(div))}}this.renderId++}},AccessibilityManager.prototype.updateDebugHTML=function(div){div.innerHTML="type: "+div.type+"</br> title : "+div.title+"</br> tabIndex: "+div.tabIndex},AccessibilityManager.prototype.capHitArea=function(hitArea){hitArea.x<0&&(hitArea.width+=hitArea.x,hitArea.x=0),hitArea.y<0&&(hitArea.height+=hitArea.y,hitArea.y=0),hitArea.x+hitArea.width>this.renderer.width&&(hitArea.width=this.renderer.width-hitArea.x),hitArea.y+hitArea.height>this.renderer.height&&(hitArea.height=this.renderer.height-hitArea.y)},AccessibilityManager.prototype.addChild=function(displayObject){var div=this.pool.pop();div||((div=document.createElement("button")).style.width="100px",div.style.height="100px",div.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",div.style.position="absolute",div.style.zIndex=2..toString(),div.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?div.setAttribute("aria-live","off"):div.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?div.setAttribute("aria-relevant","additions"):div.setAttribute("aria-relevant","text"),div.addEventListener("click",this._onClick.bind(this)),div.addEventListener("focus",this._onFocus.bind(this)),div.addEventListener("focusout",this._onFocusOut.bind(this))),div.style.pointerEvents=displayObject.accessiblePointerEvents,div.type=displayObject.accessibleType,displayObject.accessibleTitle&&null!==displayObject.accessibleTitle?div.title=displayObject.accessibleTitle:displayObject.accessibleHint&&null!==displayObject.accessibleHint||(div.title="displayObject "+displayObject.tabIndex),displayObject.accessibleHint&&null!==displayObject.accessibleHint&&div.setAttribute("aria-label",displayObject.accessibleHint),this.debug&&this.updateDebugHTML(div),displayObject._accessibleActive=!0,displayObject._accessibleDiv=div,div.displayObject=displayObject,this.children.push(displayObject),this.div.appendChild(displayObject._accessibleDiv),displayObject._accessibleDiv.tabIndex=displayObject.tabIndex},AccessibilityManager.prototype._onClick=function(e){var interactionManager=this.renderer.plugins.interaction;interactionManager.dispatchEvent(e.target.displayObject,"click",interactionManager.eventData),interactionManager.dispatchEvent(e.target.displayObject,"pointertap",interactionManager.eventData),interactionManager.dispatchEvent(e.target.displayObject,"tap",interactionManager.eventData)},AccessibilityManager.prototype._onFocus=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive");var interactionManager=this.renderer.plugins.interaction;interactionManager.dispatchEvent(e.target.displayObject,"mouseover",interactionManager.eventData)},AccessibilityManager.prototype._onFocusOut=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite");var interactionManager=this.renderer.plugins.interaction;interactionManager.dispatchEvent(e.target.displayObject,"mouseout",interactionManager.eventData)},AccessibilityManager.prototype._onKeyDown=function(e){9===e.keyCode&&this.activate()},AccessibilityManager.prototype._onMouseMove=function(e){0===e.movementX&&0===e.movementY||this.deactivate()},AccessibilityManager.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,window.document.removeEventListener("mousemove",this._onMouseMove,!0),window.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},AccessibilityManager}();
|
|
73
|
+
***************************************************************************** */function __extends$1(d,b){function __(){this.constructor=d}extendStatics$1(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var ENV$2,RENDERER_TYPE$2,BUFFER_BITS$2,BLEND_MODES$2,DRAW_MODES$2,FORMATS$2,TARGETS$2,TYPES$2,SAMPLER_TYPES$2,SCALE_MODES$2,WRAP_MODES$2,MIPMAP_MODES$2,ALPHA_MODES$2,CLEAR_MODES$2,GC_MODES$2,PRECISION$2,MASK_TYPES$2,MSAA_QUALITY$2,BUFFER_TYPE$2,DisplayObject=function(_super){function DisplayObject(){var _this=_super.call(this)||this;return _this.tempDisplayObjectParent=null,_this.transform=new Transform,_this.alpha=1,_this.visible=!0,_this.renderable=!0,_this.cullable=!1,_this.cullArea=null,_this.parent=null,_this.worldAlpha=1,_this._lastSortedIndex=0,_this._zIndex=0,_this.filterArea=null,_this.filters=null,_this._enabledFilters=null,_this._bounds=new Bounds,_this._localBounds=null,_this._boundsID=0,_this._boundsRect=null,_this._localBoundsRect=null,_this._mask=null,_this._maskRefCount=0,_this._destroyed=!1,_this.isSprite=!1,_this.isMask=!1,_this}return __extends$1(DisplayObject,_super),DisplayObject.mixin=function(source){for(var keys=Object.keys(source),i=0;i<keys.length;++i){var propertyName=keys[i];Object.defineProperty(DisplayObject.prototype,propertyName,Object.getOwnPropertyDescriptor(source,propertyName))}},Object.defineProperty(DisplayObject.prototype,"destroyed",{get:function(){return this._destroyed},enumerable:!1,configurable:!0}),DisplayObject.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},DisplayObject.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},DisplayObject.prototype.getBounds=function(skipUpdate,rect){return skipUpdate||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),rect||(this._boundsRect||(this._boundsRect=new Rectangle),rect=this._boundsRect),this._bounds.getRectangle(rect)},DisplayObject.prototype.getLocalBounds=function(rect){rect||(this._localBoundsRect||(this._localBoundsRect=new Rectangle),rect=this._localBoundsRect),this._localBounds||(this._localBounds=new Bounds);var transformRef=this.transform,parentRef=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var worldBounds=this._bounds,worldBoundsID=this._boundsID;this._bounds=this._localBounds;var bounds=this.getBounds(!1,rect);return this.parent=parentRef,this.transform=transformRef,this._bounds=worldBounds,this._bounds.updateID+=this._boundsID-worldBoundsID,bounds},DisplayObject.prototype.toGlobal=function(position,point,skipUpdate){return void 0===skipUpdate&&(skipUpdate=!1),skipUpdate||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(position,point)},DisplayObject.prototype.toLocal=function(position,from,point,skipUpdate){return from&&(position=from.toGlobal(position,point,skipUpdate)),skipUpdate||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(position,point)},DisplayObject.prototype.setParent=function(container){if(!container||!container.addChild)throw new Error("setParent: Argument must be a Container");return container.addChild(this),container},DisplayObject.prototype.setTransform=function(x,y,scaleX,scaleY,rotation,skewX,skewY,pivotX,pivotY){return void 0===x&&(x=0),void 0===y&&(y=0),void 0===scaleX&&(scaleX=1),void 0===scaleY&&(scaleY=1),void 0===rotation&&(rotation=0),void 0===skewX&&(skewX=0),void 0===skewY&&(skewY=0),void 0===pivotX&&(pivotX=0),void 0===pivotY&&(pivotY=0),this.position.x=x,this.position.y=y,this.scale.x=scaleX||1,this.scale.y=scaleY||1,this.rotation=rotation,this.skew.x=skewX,this.skew.y=skewY,this.pivot.x=pivotX,this.pivot.y=pivotY,this},DisplayObject.prototype.destroy=function(_options){this.parent&&this.parent.removeChild(this),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()},Object.defineProperty(DisplayObject.prototype,"_tempDisplayObjectParent",{get:function(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new TemporaryDisplayObject),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),DisplayObject.prototype.enableTempParent=function(){var myParent=this.parent;return this.parent=this._tempDisplayObjectParent,myParent},DisplayObject.prototype.disableTempParent=function(cacheParent){this.parent=cacheParent},Object.defineProperty(DisplayObject.prototype,"x",{get:function(){return this.position.x},set:function(value){this.transform.position.x=value},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"y",{get:function(){return this.position.y},set:function(value){this.transform.position.y=value},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"position",{get:function(){return this.transform.position},set:function(value){this.transform.position.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"scale",{get:function(){return this.transform.scale},set:function(value){this.transform.scale.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(value){this.transform.pivot.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"skew",{get:function(){return this.transform.skew},set:function(value){this.transform.skew.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(value){this.transform.rotation=value},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"angle",{get:function(){return this.transform.rotation*RAD_TO_DEG},set:function(value){this.transform.rotation=value*DEG_TO_RAD},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"zIndex",{get:function(){return this._zIndex},set:function(value){this._zIndex=value,this.parent&&(this.parent.sortDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"worldVisible",{get:function(){var item=this;do{if(!item.visible)return!1;item=item.parent}while(item);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(value){if(this._mask!==value){var maskObject;if(this._mask)(maskObject=this._mask.maskObject||this._mask)._maskRefCount--,0===maskObject._maskRefCount&&(maskObject.renderable=!0,maskObject.isMask=!1);if(this._mask=value,this._mask)0===(maskObject=this._mask.maskObject||this._mask)._maskRefCount&&(maskObject.renderable=!1,maskObject.isMask=!0),maskObject._maskRefCount++}},enumerable:!1,configurable:!0}),DisplayObject}(eventemitter3),TemporaryDisplayObject=function(_super){function TemporaryDisplayObject(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.sortDirty=null,_this}return __extends$1(TemporaryDisplayObject,_super),TemporaryDisplayObject}(DisplayObject);function sortChildren(a,b){return a.zIndex===b.zIndex?a._lastSortedIndex-b._lastSortedIndex:a.zIndex-b.zIndex}DisplayObject.prototype.displayObjectUpdateTransform=DisplayObject.prototype.updateTransform,function(ENV){ENV[ENV.WEBGL_LEGACY=0]="WEBGL_LEGACY",ENV[ENV.WEBGL=1]="WEBGL",ENV[ENV.WEBGL2=2]="WEBGL2"}(ENV$2||(ENV$2={})),function(RENDERER_TYPE){RENDERER_TYPE[RENDERER_TYPE.UNKNOWN=0]="UNKNOWN",RENDERER_TYPE[RENDERER_TYPE.WEBGL=1]="WEBGL",RENDERER_TYPE[RENDERER_TYPE.CANVAS=2]="CANVAS"}(RENDERER_TYPE$2||(RENDERER_TYPE$2={})),function(BUFFER_BITS){BUFFER_BITS[BUFFER_BITS.COLOR=16384]="COLOR",BUFFER_BITS[BUFFER_BITS.DEPTH=256]="DEPTH",BUFFER_BITS[BUFFER_BITS.STENCIL=1024]="STENCIL"}(BUFFER_BITS$2||(BUFFER_BITS$2={})),function(BLEND_MODES){BLEND_MODES[BLEND_MODES.NORMAL=0]="NORMAL",BLEND_MODES[BLEND_MODES.ADD=1]="ADD",BLEND_MODES[BLEND_MODES.MULTIPLY=2]="MULTIPLY",BLEND_MODES[BLEND_MODES.SCREEN=3]="SCREEN",BLEND_MODES[BLEND_MODES.OVERLAY=4]="OVERLAY",BLEND_MODES[BLEND_MODES.DARKEN=5]="DARKEN",BLEND_MODES[BLEND_MODES.LIGHTEN=6]="LIGHTEN",BLEND_MODES[BLEND_MODES.COLOR_DODGE=7]="COLOR_DODGE",BLEND_MODES[BLEND_MODES.COLOR_BURN=8]="COLOR_BURN",BLEND_MODES[BLEND_MODES.HARD_LIGHT=9]="HARD_LIGHT",BLEND_MODES[BLEND_MODES.SOFT_LIGHT=10]="SOFT_LIGHT",BLEND_MODES[BLEND_MODES.DIFFERENCE=11]="DIFFERENCE",BLEND_MODES[BLEND_MODES.EXCLUSION=12]="EXCLUSION",BLEND_MODES[BLEND_MODES.HUE=13]="HUE",BLEND_MODES[BLEND_MODES.SATURATION=14]="SATURATION",BLEND_MODES[BLEND_MODES.COLOR=15]="COLOR",BLEND_MODES[BLEND_MODES.LUMINOSITY=16]="LUMINOSITY",BLEND_MODES[BLEND_MODES.NORMAL_NPM=17]="NORMAL_NPM",BLEND_MODES[BLEND_MODES.ADD_NPM=18]="ADD_NPM",BLEND_MODES[BLEND_MODES.SCREEN_NPM=19]="SCREEN_NPM",BLEND_MODES[BLEND_MODES.NONE=20]="NONE",BLEND_MODES[BLEND_MODES.SRC_OVER=0]="SRC_OVER",BLEND_MODES[BLEND_MODES.SRC_IN=21]="SRC_IN",BLEND_MODES[BLEND_MODES.SRC_OUT=22]="SRC_OUT",BLEND_MODES[BLEND_MODES.SRC_ATOP=23]="SRC_ATOP",BLEND_MODES[BLEND_MODES.DST_OVER=24]="DST_OVER",BLEND_MODES[BLEND_MODES.DST_IN=25]="DST_IN",BLEND_MODES[BLEND_MODES.DST_OUT=26]="DST_OUT",BLEND_MODES[BLEND_MODES.DST_ATOP=27]="DST_ATOP",BLEND_MODES[BLEND_MODES.ERASE=26]="ERASE",BLEND_MODES[BLEND_MODES.SUBTRACT=28]="SUBTRACT",BLEND_MODES[BLEND_MODES.XOR=29]="XOR"}(BLEND_MODES$2||(BLEND_MODES$2={})),function(DRAW_MODES){DRAW_MODES[DRAW_MODES.POINTS=0]="POINTS",DRAW_MODES[DRAW_MODES.LINES=1]="LINES",DRAW_MODES[DRAW_MODES.LINE_LOOP=2]="LINE_LOOP",DRAW_MODES[DRAW_MODES.LINE_STRIP=3]="LINE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLES=4]="TRIANGLES",DRAW_MODES[DRAW_MODES.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(DRAW_MODES$2||(DRAW_MODES$2={})),function(FORMATS){FORMATS[FORMATS.RGBA=6408]="RGBA",FORMATS[FORMATS.RGB=6407]="RGB",FORMATS[FORMATS.RG=33319]="RG",FORMATS[FORMATS.RED=6403]="RED",FORMATS[FORMATS.RGBA_INTEGER=36249]="RGBA_INTEGER",FORMATS[FORMATS.RGB_INTEGER=36248]="RGB_INTEGER",FORMATS[FORMATS.RG_INTEGER=33320]="RG_INTEGER",FORMATS[FORMATS.RED_INTEGER=36244]="RED_INTEGER",FORMATS[FORMATS.ALPHA=6406]="ALPHA",FORMATS[FORMATS.LUMINANCE=6409]="LUMINANCE",FORMATS[FORMATS.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",FORMATS[FORMATS.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",FORMATS[FORMATS.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(FORMATS$2||(FORMATS$2={})),function(TARGETS){TARGETS[TARGETS.TEXTURE_2D=3553]="TEXTURE_2D",TARGETS[TARGETS.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",TARGETS[TARGETS.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(TARGETS$2||(TARGETS$2={})),function(TYPES){TYPES[TYPES.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",TYPES[TYPES.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",TYPES[TYPES.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",TYPES[TYPES.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",TYPES[TYPES.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",TYPES[TYPES.UNSIGNED_INT=5125]="UNSIGNED_INT",TYPES[TYPES.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",TYPES[TYPES.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",TYPES[TYPES.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",TYPES[TYPES.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",TYPES[TYPES.BYTE=5120]="BYTE",TYPES[TYPES.SHORT=5122]="SHORT",TYPES[TYPES.INT=5124]="INT",TYPES[TYPES.FLOAT=5126]="FLOAT",TYPES[TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",TYPES[TYPES.HALF_FLOAT=36193]="HALF_FLOAT"}(TYPES$2||(TYPES$2={})),function(SAMPLER_TYPES){SAMPLER_TYPES[SAMPLER_TYPES.FLOAT=0]="FLOAT",SAMPLER_TYPES[SAMPLER_TYPES.INT=1]="INT",SAMPLER_TYPES[SAMPLER_TYPES.UINT=2]="UINT"}(SAMPLER_TYPES$2||(SAMPLER_TYPES$2={})),function(SCALE_MODES){SCALE_MODES[SCALE_MODES.NEAREST=0]="NEAREST",SCALE_MODES[SCALE_MODES.LINEAR=1]="LINEAR"}(SCALE_MODES$2||(SCALE_MODES$2={})),function(WRAP_MODES){WRAP_MODES[WRAP_MODES.CLAMP=33071]="CLAMP",WRAP_MODES[WRAP_MODES.REPEAT=10497]="REPEAT",WRAP_MODES[WRAP_MODES.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(WRAP_MODES$2||(WRAP_MODES$2={})),function(MIPMAP_MODES){MIPMAP_MODES[MIPMAP_MODES.OFF=0]="OFF",MIPMAP_MODES[MIPMAP_MODES.POW2=1]="POW2",MIPMAP_MODES[MIPMAP_MODES.ON=2]="ON",MIPMAP_MODES[MIPMAP_MODES.ON_MANUAL=3]="ON_MANUAL"}(MIPMAP_MODES$2||(MIPMAP_MODES$2={})),function(ALPHA_MODES){ALPHA_MODES[ALPHA_MODES.NPM=0]="NPM",ALPHA_MODES[ALPHA_MODES.UNPACK=1]="UNPACK",ALPHA_MODES[ALPHA_MODES.PMA=2]="PMA",ALPHA_MODES[ALPHA_MODES.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"}(ALPHA_MODES$2||(ALPHA_MODES$2={})),function(CLEAR_MODES){CLEAR_MODES[CLEAR_MODES.NO=0]="NO",CLEAR_MODES[CLEAR_MODES.YES=1]="YES",CLEAR_MODES[CLEAR_MODES.AUTO=2]="AUTO",CLEAR_MODES[CLEAR_MODES.BLEND=0]="BLEND",CLEAR_MODES[CLEAR_MODES.CLEAR=1]="CLEAR",CLEAR_MODES[CLEAR_MODES.BLIT=2]="BLIT"}(CLEAR_MODES$2||(CLEAR_MODES$2={})),function(GC_MODES){GC_MODES[GC_MODES.AUTO=0]="AUTO",GC_MODES[GC_MODES.MANUAL=1]="MANUAL"}(GC_MODES$2||(GC_MODES$2={})),function(PRECISION){PRECISION.LOW="lowp",PRECISION.MEDIUM="mediump",PRECISION.HIGH="highp"}(PRECISION$2||(PRECISION$2={})),function(MASK_TYPES){MASK_TYPES[MASK_TYPES.NONE=0]="NONE",MASK_TYPES[MASK_TYPES.SCISSOR=1]="SCISSOR",MASK_TYPES[MASK_TYPES.STENCIL=2]="STENCIL",MASK_TYPES[MASK_TYPES.SPRITE=3]="SPRITE"}(MASK_TYPES$2||(MASK_TYPES$2={})),function(MSAA_QUALITY){MSAA_QUALITY[MSAA_QUALITY.NONE=0]="NONE",MSAA_QUALITY[MSAA_QUALITY.LOW=2]="LOW",MSAA_QUALITY[MSAA_QUALITY.MEDIUM=4]="MEDIUM",MSAA_QUALITY[MSAA_QUALITY.HIGH=8]="HIGH"}(MSAA_QUALITY$2||(MSAA_QUALITY$2={})),function(BUFFER_TYPE){BUFFER_TYPE[BUFFER_TYPE.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",BUFFER_TYPE[BUFFER_TYPE.ARRAY_BUFFER=34962]="ARRAY_BUFFER",BUFFER_TYPE[BUFFER_TYPE.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"}(BUFFER_TYPE$2||(BUFFER_TYPE$2={}));var Container=function(_super){function Container(){var _this=_super.call(this)||this;return _this.children=[],_this.sortableChildren=settings.SORTABLE_CHILDREN,_this.sortDirty=!1,_this}return __extends$1(Container,_super),Container.prototype.onChildrenChange=function(_length){},Container.prototype.addChild=function(){for(var arguments$1=arguments,children=[],_i=0;_i<arguments.length;_i++)children[_i]=arguments$1[_i];if(children.length>1)for(var i=0;i<children.length;i++)this.addChild(children[i]);else{var child=children[0];child.parent&&child.parent.removeChild(child),child.parent=this,this.sortDirty=!0,child.transform._parentID=-1,this.children.push(child),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",child,this,this.children.length-1),child.emit("added",this)}return children[0]},Container.prototype.addChildAt=function(child,index){if(index<0||index>this.children.length)throw new Error(child+"addChildAt: The index "+index+" supplied is out of bounds "+this.children.length);return child.parent&&child.parent.removeChild(child),child.parent=this,this.sortDirty=!0,child.transform._parentID=-1,this.children.splice(index,0,child),this._boundsID++,this.onChildrenChange(index),child.emit("added",this),this.emit("childAdded",child,this,index),child},Container.prototype.swapChildren=function(child,child2){if(child!==child2){var index1=this.getChildIndex(child),index2=this.getChildIndex(child2);this.children[index1]=child2,this.children[index2]=child,this.onChildrenChange(index1<index2?index1:index2)}},Container.prototype.getChildIndex=function(child){var index=this.children.indexOf(child);if(-1===index)throw new Error("The supplied DisplayObject must be a child of the caller");return index},Container.prototype.setChildIndex=function(child,index){if(index<0||index>=this.children.length)throw new Error("The index "+index+" supplied is out of bounds "+this.children.length);var currentIndex=this.getChildIndex(child);removeItems(this.children,currentIndex,1),this.children.splice(index,0,child),this.onChildrenChange(index)},Container.prototype.getChildAt=function(index){if(index<0||index>=this.children.length)throw new Error("getChildAt: Index ("+index+") does not exist.");return this.children[index]},Container.prototype.removeChild=function(){for(var arguments$1=arguments,children=[],_i=0;_i<arguments.length;_i++)children[_i]=arguments$1[_i];if(children.length>1)for(var i=0;i<children.length;i++)this.removeChild(children[i]);else{var child=children[0],index=this.children.indexOf(child);if(-1===index)return null;child.parent=null,child.transform._parentID=-1,removeItems(this.children,index,1),this._boundsID++,this.onChildrenChange(index),child.emit("removed",this),this.emit("childRemoved",child,this,index)}return children[0]},Container.prototype.removeChildAt=function(index){var child=this.getChildAt(index);return child.parent=null,child.transform._parentID=-1,removeItems(this.children,index,1),this._boundsID++,this.onChildrenChange(index),child.emit("removed",this),this.emit("childRemoved",child,this,index),child},Container.prototype.removeChildren=function(beginIndex,endIndex){void 0===beginIndex&&(beginIndex=0),void 0===endIndex&&(endIndex=this.children.length);var removed,begin=beginIndex,range=endIndex-begin;if(range>0&&range<=endIndex){removed=this.children.splice(begin,range);for(var i=0;i<removed.length;++i)removed[i].parent=null,removed[i].transform&&(removed[i].transform._parentID=-1);this._boundsID++,this.onChildrenChange(beginIndex);for(i=0;i<removed.length;++i)removed[i].emit("removed",this),this.emit("childRemoved",removed[i],this,i);return removed}if(0===range&&0===this.children.length)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},Container.prototype.sortChildren=function(){for(var sortRequired=!1,i=0,j=this.children.length;i<j;++i){var child=this.children[i];child._lastSortedIndex=i,sortRequired||0===child.zIndex||(sortRequired=!0)}sortRequired&&this.children.length>1&&this.children.sort(sortChildren),this.sortDirty=!1},Container.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var i=0,j=this.children.length;i<j;++i){var child=this.children[i];child.visible&&child.updateTransform()}},Container.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var i=0;i<this.children.length;i++){var child=this.children[i];if(child.visible&&child.renderable)if(child.calculateBounds(),child._mask){var maskObject=child._mask.maskObject||child._mask;maskObject.calculateBounds(),this._bounds.addBoundsMask(child._bounds,maskObject._bounds)}else child.filterArea?this._bounds.addBoundsArea(child._bounds,child.filterArea):this._bounds.addBounds(child._bounds)}this._bounds.updateID=this._boundsID},Container.prototype.getLocalBounds=function(rect,skipChildrenUpdate){void 0===skipChildrenUpdate&&(skipChildrenUpdate=!1);var result=_super.prototype.getLocalBounds.call(this,rect);if(!skipChildrenUpdate)for(var i=0,j=this.children.length;i<j;++i){var child=this.children[i];child.visible&&child.updateTransform()}return result},Container.prototype._calculateBounds=function(){},Container.prototype._renderWithCulling=function(renderer){var sourceFrame=renderer.renderTexture.sourceFrame;if(sourceFrame.width>0&&sourceFrame.height>0){var bounds,transform;if(this.cullArea?(bounds=this.cullArea,transform=this.worldTransform):this._render!==Container.prototype._render&&(bounds=this.getBounds(!0)),bounds&&sourceFrame.intersects(bounds,transform))this._render(renderer);else if(this.cullArea)return;for(var i=0,j=this.children.length;i<j;++i){var child=this.children[i],childCullable=child.cullable;child.cullable=childCullable||!this.cullArea,child.render(renderer),child.cullable=childCullable}}},Container.prototype.render=function(renderer){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable)if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(renderer);else if(this.cullable)this._renderWithCulling(renderer);else{this._render(renderer);for(var i=0,j=this.children.length;i<j;++i)this.children[i].render(renderer)}},Container.prototype.renderAdvanced=function(renderer){var filters=this.filters,mask=this._mask;if(filters){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var i=0;i<filters.length;i++)filters[i].enabled&&this._enabledFilters.push(filters[i])}var flush=filters&&this._enabledFilters&&this._enabledFilters.length||mask&&(!mask.isMaskData||mask.enabled&&(mask.autoDetect||mask.type!==MASK_TYPES$2.NONE));if(flush&&renderer.batch.flush(),filters&&this._enabledFilters&&this._enabledFilters.length&&renderer.filter.push(this,this._enabledFilters),mask&&renderer.mask.push(this,this._mask),this.cullable)this._renderWithCulling(renderer);else{this._render(renderer);i=0;for(var j=this.children.length;i<j;++i)this.children[i].render(renderer)}flush&&renderer.batch.flush(),mask&&renderer.mask.pop(this),filters&&this._enabledFilters&&this._enabledFilters.length&&renderer.filter.pop()},Container.prototype._render=function(_renderer){},Container.prototype.destroy=function(options){_super.prototype.destroy.call(this),this.sortDirty=!1;var destroyChildren="boolean"==typeof options?options:options&&options.children,oldChildren=this.removeChildren(0,this.children.length);if(destroyChildren)for(var i=0;i<oldChildren.length;++i)oldChildren[i].destroy(options)},Object.defineProperty(Container.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(value){var width=this.getLocalBounds().width;this.scale.x=0!==width?value/width:1,this._width=value},enumerable:!1,configurable:!0}),Object.defineProperty(Container.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(value){var height=this.getLocalBounds().height;this.scale.y=0!==height?value/height:1,this._height=value},enumerable:!1,configurable:!0}),Container}(DisplayObject);Container.prototype.containerUpdateTransform=Container.prototype.updateTransform;DisplayObject.mixin({accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1});var UPDATE_PRIORITY,AccessibilityManager=function(){function AccessibilityManager(renderer){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(isMobile$1.tablet||isMobile$1.phone)&&this.createTouchHook();var div=document.createElement("div");div.style.width="100px",div.style.height="100px",div.style.position="absolute",div.style.top="0px",div.style.left="0px",div.style.zIndex=2..toString(),this.div=div,this.renderer=renderer,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}return Object.defineProperty(AccessibilityManager.prototype,"isActive",{get:function(){return this._isActive},enumerable:!1,configurable:!0}),Object.defineProperty(AccessibilityManager.prototype,"isMobileAccessibility",{get:function(){return this._isMobileAccessibility},enumerable:!1,configurable:!0}),AccessibilityManager.prototype.createTouchHook=function(){var _this=this,hookDiv=document.createElement("button");hookDiv.style.width="1px",hookDiv.style.height="1px",hookDiv.style.position="absolute",hookDiv.style.top="-1000px",hookDiv.style.left="-1000px",hookDiv.style.zIndex=2..toString(),hookDiv.style.backgroundColor="#FF0000",hookDiv.title="select to enable accessibility for this content",hookDiv.addEventListener("focus",(function(){_this._isMobileAccessibility=!0,_this.activate(),_this.destroyTouchHook()})),document.body.appendChild(hookDiv),this._hookDiv=hookDiv},AccessibilityManager.prototype.destroyTouchHook=function(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)},AccessibilityManager.prototype.activate=function(){var _a;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),null===(_a=this.renderer.view.parentNode)||void 0===_a||_a.appendChild(this.div))},AccessibilityManager.prototype.deactivate=function(){var _a;this._isActive&&!this._isMobileAccessibility&&(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),null===(_a=this.div.parentNode)||void 0===_a||_a.removeChild(this.div))},AccessibilityManager.prototype.updateAccessibleObjects=function(displayObject){if(displayObject.visible&&displayObject.accessibleChildren){displayObject.accessible&&displayObject.interactive&&(displayObject._accessibleActive||this.addChild(displayObject),displayObject.renderId=this.renderId);var children=displayObject.children;if(children)for(var i=0;i<children.length;i++)this.updateAccessibleObjects(children[i])}},AccessibilityManager.prototype.update=function(){var now=performance.now();if(!(isMobile$1.android.device&&now<this.androidUpdateCount)&&(this.androidUpdateCount=now+this.androidUpdateFrequency,this.renderer.renderingToScreen)){this.renderer._lastObjectRendered&&this.updateAccessibleObjects(this.renderer._lastObjectRendered);var _a=this.renderer.view.getBoundingClientRect(),left=_a.left,top=_a.top,width=_a.width,height=_a.height,_b=this.renderer,viewWidth=_b.width,viewHeight=_b.height,resolution=_b.resolution,sx=width/viewWidth*resolution,sy=height/viewHeight*resolution,div=this.div;div.style.left=left+"px",div.style.top=top+"px",div.style.width=viewWidth+"px",div.style.height=viewHeight+"px";for(var i=0;i<this.children.length;i++){var child=this.children[i];if(child.renderId!==this.renderId)child._accessibleActive=!1,removeItems(this.children,i,1),this.div.removeChild(child._accessibleDiv),this.pool.push(child._accessibleDiv),child._accessibleDiv=null,i--;else{div=child._accessibleDiv;var hitArea=child.hitArea,wt=child.worldTransform;child.hitArea?(div.style.left=(wt.tx+hitArea.x*wt.a)*sx+"px",div.style.top=(wt.ty+hitArea.y*wt.d)*sy+"px",div.style.width=hitArea.width*wt.a*sx+"px",div.style.height=hitArea.height*wt.d*sy+"px"):(hitArea=child.getBounds(),this.capHitArea(hitArea),div.style.left=hitArea.x*sx+"px",div.style.top=hitArea.y*sy+"px",div.style.width=hitArea.width*sx+"px",div.style.height=hitArea.height*sy+"px",div.title!==child.accessibleTitle&&null!==child.accessibleTitle&&(div.title=child.accessibleTitle),div.getAttribute("aria-label")!==child.accessibleHint&&null!==child.accessibleHint&&div.setAttribute("aria-label",child.accessibleHint)),child.accessibleTitle===div.title&&child.tabIndex===div.tabIndex||(div.title=child.accessibleTitle,div.tabIndex=child.tabIndex,this.debug&&this.updateDebugHTML(div))}}this.renderId++}},AccessibilityManager.prototype.updateDebugHTML=function(div){div.innerHTML="type: "+div.type+"</br> title : "+div.title+"</br> tabIndex: "+div.tabIndex},AccessibilityManager.prototype.capHitArea=function(hitArea){hitArea.x<0&&(hitArea.width+=hitArea.x,hitArea.x=0),hitArea.y<0&&(hitArea.height+=hitArea.y,hitArea.y=0);var _a=this.renderer,viewWidth=_a.width,viewHeight=_a.height;hitArea.x+hitArea.width>viewWidth&&(hitArea.width=viewWidth-hitArea.x),hitArea.y+hitArea.height>viewHeight&&(hitArea.height=viewHeight-hitArea.y)},AccessibilityManager.prototype.addChild=function(displayObject){var div=this.pool.pop();div||((div=document.createElement("button")).style.width="100px",div.style.height="100px",div.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",div.style.position="absolute",div.style.zIndex=2..toString(),div.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?div.setAttribute("aria-live","off"):div.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?div.setAttribute("aria-relevant","additions"):div.setAttribute("aria-relevant","text"),div.addEventListener("click",this._onClick.bind(this)),div.addEventListener("focus",this._onFocus.bind(this)),div.addEventListener("focusout",this._onFocusOut.bind(this))),div.style.pointerEvents=displayObject.accessiblePointerEvents,div.type=displayObject.accessibleType,displayObject.accessibleTitle&&null!==displayObject.accessibleTitle?div.title=displayObject.accessibleTitle:displayObject.accessibleHint&&null!==displayObject.accessibleHint||(div.title="displayObject "+displayObject.tabIndex),displayObject.accessibleHint&&null!==displayObject.accessibleHint&&div.setAttribute("aria-label",displayObject.accessibleHint),this.debug&&this.updateDebugHTML(div),displayObject._accessibleActive=!0,displayObject._accessibleDiv=div,div.displayObject=displayObject,this.children.push(displayObject),this.div.appendChild(displayObject._accessibleDiv),displayObject._accessibleDiv.tabIndex=displayObject.tabIndex},AccessibilityManager.prototype._onClick=function(e){var interactionManager=this.renderer.plugins.interaction,displayObject=e.target.displayObject,eventData=interactionManager.eventData;interactionManager.dispatchEvent(displayObject,"click",eventData),interactionManager.dispatchEvent(displayObject,"pointertap",eventData),interactionManager.dispatchEvent(displayObject,"tap",eventData)},AccessibilityManager.prototype._onFocus=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive");var interactionManager=this.renderer.plugins.interaction,displayObject=e.target.displayObject,eventData=interactionManager.eventData;interactionManager.dispatchEvent(displayObject,"mouseover",eventData)},AccessibilityManager.prototype._onFocusOut=function(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite");var interactionManager=this.renderer.plugins.interaction,displayObject=e.target.displayObject,eventData=interactionManager.eventData;interactionManager.dispatchEvent(displayObject,"mouseout",eventData)},AccessibilityManager.prototype._onKeyDown=function(e){9===e.keyCode&&this.activate()},AccessibilityManager.prototype._onMouseMove=function(e){0===e.movementX&&0===e.movementY||this.deactivate()},AccessibilityManager.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},AccessibilityManager}();
|
|
73
74
|
/*!
|
|
74
|
-
* @pixi/ticker -
|
|
75
|
-
* Compiled
|
|
75
|
+
* @pixi/ticker - v6.4.2
|
|
76
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
76
77
|
*
|
|
77
78
|
* @pixi/ticker is licensed under the MIT License.
|
|
78
79
|
* http://www.opensource.org/licenses/mit-license
|
|
79
80
|
*/
|
|
80
|
-
settings.TARGET_FPMS=.06,function(UPDATE_PRIORITY){UPDATE_PRIORITY[UPDATE_PRIORITY.INTERACTION=50]="INTERACTION",UPDATE_PRIORITY[UPDATE_PRIORITY.HIGH=25]="HIGH",UPDATE_PRIORITY[UPDATE_PRIORITY.NORMAL=0]="NORMAL",UPDATE_PRIORITY[UPDATE_PRIORITY.LOW=-25]="LOW",UPDATE_PRIORITY[UPDATE_PRIORITY.UTILITY=-50]="UTILITY"}(UPDATE_PRIORITY||(UPDATE_PRIORITY={}));var TickerListener=function(){function TickerListener(fn,context,priority,once){void 0===context&&(context=null),void 0===priority&&(priority=0),void 0===once&&(once=!1),this.fn=fn,this.context=context,this.priority=priority,this.once=once,this.next=null,this.previous=null,this._destroyed=!1}return TickerListener.prototype.match=function(fn,context){return void 0===context&&(context=null),this.fn===fn&&this.context===context},TickerListener.prototype.emit=function(deltaTime){this.fn&&(this.context?this.fn.call(this.context,deltaTime):this.fn(deltaTime));var redirect=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),redirect},TickerListener.prototype.connect=function(previous){this.previous=previous,previous.next&&(previous.next.previous=this),this.next=previous.next,previous.next=this},TickerListener.prototype.destroy=function(hard){void 0===hard&&(hard=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var redirect=this.next;return this.next=hard?null:redirect,this.previous=null,redirect},TickerListener}(),Ticker=function(){function Ticker(){var _this=this;this._head=new TickerListener(null,null,1/0),this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this.autoStart=!1,this.deltaTime=1,this.deltaMS=1/settings.TARGET_FPMS,this.elapsedMS=1/settings.TARGET_FPMS,this.lastTime=-1,this.speed=1,this.started=!1,this._protected=!1,this._lastFrame=-1,this._tick=function(time){_this._requestId=null,_this.started&&(_this.update(time),_this.started&&null===_this._requestId&&_this._head.next&&(_this._requestId=requestAnimationFrame(_this._tick)))}}return Ticker.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},Ticker.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},Ticker.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},Ticker.prototype.add=function(fn,context,priority){return void 0===priority&&(priority=UPDATE_PRIORITY.NORMAL),this._addListener(new TickerListener(fn,context,priority))},Ticker.prototype.addOnce=function(fn,context,priority){return void 0===priority&&(priority=UPDATE_PRIORITY.NORMAL),this._addListener(new TickerListener(fn,context,priority,!0))},Ticker.prototype._addListener=function(listener){var current=this._head.next,previous=this._head;if(current){for(;current;){if(listener.priority>current.priority){listener.connect(previous);break}previous=current,current=current.next}listener.previous||listener.connect(previous)}else listener.connect(previous);return this._startIfPossible(),this},Ticker.prototype.remove=function(fn,context){for(var listener=this._head.next;listener;)listener=listener.match(fn,context)?listener.destroy():listener.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(Ticker.prototype,"count",{get:function(){if(!this._head)return 0;for(var count=0,current=this._head;current=current.next;)count++;return count},enumerable:!1,configurable:!0}),Ticker.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},Ticker.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},Ticker.prototype.destroy=function(){if(!this._protected){this.stop();for(var listener=this._head.next;listener;)listener=listener.destroy(!0);this._head.destroy(),this._head=null}},Ticker.prototype.update=function(currentTime){var elapsedMS;if(void 0===currentTime&&(currentTime=performance.now()),currentTime>this.lastTime){if((elapsedMS=this.elapsedMS=currentTime-this.lastTime)>this._maxElapsedMS&&(elapsedMS=this._maxElapsedMS),elapsedMS*=this.speed,this._minElapsedMS){var delta=currentTime-this._lastFrame|0;if(delta<this._minElapsedMS)return;this._lastFrame=currentTime-delta%this._minElapsedMS}this.deltaMS=elapsedMS,this.deltaTime=this.deltaMS*settings.TARGET_FPMS;for(var head=this._head,listener=head.next;listener;)listener=listener.emit(this.deltaTime);head.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=currentTime},Object.defineProperty(Ticker.prototype,"FPS",{get:function(){return 1e3/this.elapsedMS},enumerable:!1,configurable:!0}),Object.defineProperty(Ticker.prototype,"minFPS",{get:function(){return 1e3/this._maxElapsedMS},set:function(fps){var minFPS=Math.min(this.maxFPS,fps),minFPMS=Math.min(Math.max(0,minFPS)/1e3,settings.TARGET_FPMS);this._maxElapsedMS=1/minFPMS},enumerable:!1,configurable:!0}),Object.defineProperty(Ticker.prototype,"maxFPS",{get:function(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0},set:function(fps){if(0===fps)this._minElapsedMS=0;else{var maxFPS=Math.max(this.minFPS,fps);this._minElapsedMS=1/(maxFPS/1e3)}},enumerable:!1,configurable:!0}),Object.defineProperty(Ticker,"shared",{get:function(){if(!Ticker._shared){var shared=Ticker._shared=new Ticker;shared.autoStart=!0,shared._protected=!0}return Ticker._shared},enumerable:!1,configurable:!0}),Object.defineProperty(Ticker,"system",{get:function(){if(!Ticker._system){var system=Ticker._system=new Ticker;system.autoStart=!0,system._protected=!0}return Ticker._system},enumerable:!1,configurable:!0}),Ticker}(),TickerPlugin=function(){function TickerPlugin(){}return TickerPlugin.init=function(options){var _this=this;options=Object.assign({autoStart:!0,sharedTicker:!1},options),Object.defineProperty(this,"ticker",{set:function(ticker){this._ticker&&this._ticker.remove(this.render,this),this._ticker=ticker,ticker&&ticker.add(this.render,this,UPDATE_PRIORITY.LOW)},get:function(){return this._ticker}}),this.stop=function(){_this._ticker.stop()},this.start=function(){_this._ticker.start()},this._ticker=null,this.ticker=options.sharedTicker?Ticker.shared:new Ticker,options.autoStart&&this.start()},TickerPlugin.destroy=function(){if(this._ticker){var oldTicker=this._ticker;this.ticker=null,oldTicker.destroy()}},TickerPlugin}(),InteractionData=function(){function InteractionData(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new Point,this.target=null,this.originalEvent=null,this.identifier=null,this.isPrimary=!1,this.button=0,this.buttons=0,this.width=0,this.height=0,this.tiltX=0,this.tiltY=0,this.pointerType=null,this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0}return Object.defineProperty(InteractionData.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),InteractionData.prototype.getLocalPosition=function(displayObject,point,globalPos){return displayObject.worldTransform.applyInverse(globalPos||this.global,point)},InteractionData.prototype.copyEvent=function(event){"isPrimary"in event&&event.isPrimary&&(this.isPrimary=!0),this.button="button"in event&&event.button;var buttons="buttons"in event&&event.buttons;this.buttons=Number.isInteger(buttons)?buttons:"which"in event&&event.which,this.width="width"in event&&event.width,this.height="height"in event&&event.height,this.tiltX="tiltX"in event&&event.tiltX,this.tiltY="tiltY"in event&&event.tiltY,this.pointerType="pointerType"in event&&event.pointerType,this.pressure="pressure"in event&&event.pressure,this.rotationAngle="rotationAngle"in event&&event.rotationAngle,this.twist="twist"in event&&event.twist||0,this.tangentialPressure="tangentialPressure"in event&&event.tangentialPressure||0},InteractionData.prototype.reset=function(){this.isPrimary=!1},InteractionData}(),extendStatics$2=function(d,b){return(extendStatics$2=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};var InteractionEvent=function(){function InteractionEvent(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return InteractionEvent.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},InteractionEvent.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},InteractionEvent}(),InteractionTrackingData=function(){function InteractionTrackingData(pointerId){this._pointerId=pointerId,this._flags=InteractionTrackingData.FLAGS.NONE}return InteractionTrackingData.prototype._doSet=function(flag,yn){this._flags=yn?this._flags|flag:this._flags&~flag},Object.defineProperty(InteractionTrackingData.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(InteractionTrackingData.prototype,"flags",{get:function(){return this._flags},set:function(flags){this._flags=flags},enumerable:!1,configurable:!0}),Object.defineProperty(InteractionTrackingData.prototype,"none",{get:function(){return this._flags===InteractionTrackingData.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(InteractionTrackingData.prototype,"over",{get:function(){return 0!=(this._flags&InteractionTrackingData.FLAGS.OVER)},set:function(yn){this._doSet(InteractionTrackingData.FLAGS.OVER,yn)},enumerable:!1,configurable:!0}),Object.defineProperty(InteractionTrackingData.prototype,"rightDown",{get:function(){return 0!=(this._flags&InteractionTrackingData.FLAGS.RIGHT_DOWN)},set:function(yn){this._doSet(InteractionTrackingData.FLAGS.RIGHT_DOWN,yn)},enumerable:!1,configurable:!0}),Object.defineProperty(InteractionTrackingData.prototype,"leftDown",{get:function(){return 0!=(this._flags&InteractionTrackingData.FLAGS.LEFT_DOWN)},set:function(yn){this._doSet(InteractionTrackingData.FLAGS.LEFT_DOWN,yn)},enumerable:!1,configurable:!0}),InteractionTrackingData.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),InteractionTrackingData}(),TreeSearch=function(){function TreeSearch(){this._tempPoint=new Point}return TreeSearch.prototype.recursiveFindHit=function(interactionEvent,displayObject,func,hitTest,interactive){if(!displayObject||!displayObject.visible)return!1;var point=interactionEvent.data.global,hit=!1,interactiveParent=interactive=displayObject.interactive||interactive,hitTestChildren=!0;if(displayObject.hitArea?(hitTest&&(displayObject.worldTransform.applyInverse(point,this._tempPoint),displayObject.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?hit=!0:(hitTest=!1,hitTestChildren=!1)),interactiveParent=!1):displayObject._mask&&hitTest&&(displayObject._mask.containsPoint&&displayObject._mask.containsPoint(point)||(hitTest=!1)),hitTestChildren&&displayObject.interactiveChildren&&displayObject.children)for(var children=displayObject.children,i=children.length-1;i>=0;i--){var child=children[i],childHit=this.recursiveFindHit(interactionEvent,child,func,hitTest,interactiveParent);if(childHit){if(!child.parent)continue;interactiveParent=!1,childHit&&(interactionEvent.target&&(hitTest=!1),hit=!0)}}return interactive&&(hitTest&&!interactionEvent.target&&!displayObject.hitArea&&displayObject.containsPoint&&displayObject.containsPoint(point)&&(hit=!0),displayObject.interactive&&(hit&&!interactionEvent.target&&(interactionEvent.target=displayObject),func&&func(interactionEvent,displayObject,!!hit))),hit},TreeSearch.prototype.findHit=function(interactionEvent,displayObject,func,hitTest){this.recursiveFindHit(interactionEvent,displayObject,func,hitTest,!1)},TreeSearch}(),interactiveTarget={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(value){value?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};DisplayObject.mixin(interactiveTarget);var hitTestEvent={target:null,data:{global:null}},InteractionManager=function(_super){function InteractionManager(renderer,options){var _this=_super.call(this)||this;return options=options||{},_this.renderer=renderer,_this.autoPreventDefault=void 0===options.autoPreventDefault||options.autoPreventDefault,_this.interactionFrequency=options.interactionFrequency||10,_this.mouse=new InteractionData,_this.mouse.identifier=1,_this.mouse.global.set(-999999),_this.activeInteractionData={},_this.activeInteractionData[1]=_this.mouse,_this.interactionDataPool=[],_this.eventData=new InteractionEvent,_this.interactionDOMElement=null,_this.moveWhenInside=!1,_this.eventsAdded=!1,_this.tickerAdded=!1,_this.mouseOverRenderer=!1,_this.supportsTouchEvents="ontouchstart"in window,_this.supportsPointerEvents=!!window.PointerEvent,_this.onPointerUp=_this.onPointerUp.bind(_this),_this.processPointerUp=_this.processPointerUp.bind(_this),_this.onPointerCancel=_this.onPointerCancel.bind(_this),_this.processPointerCancel=_this.processPointerCancel.bind(_this),_this.onPointerDown=_this.onPointerDown.bind(_this),_this.processPointerDown=_this.processPointerDown.bind(_this),_this.onPointerMove=_this.onPointerMove.bind(_this),_this.processPointerMove=_this.processPointerMove.bind(_this),_this.onPointerOut=_this.onPointerOut.bind(_this),_this.processPointerOverOut=_this.processPointerOverOut.bind(_this),_this.onPointerOver=_this.onPointerOver.bind(_this),_this.cursorStyles={default:"inherit",pointer:"pointer"},_this.currentCursorMode=null,_this.cursor=null,_this.resolution=1,_this.delayedEvents=[],_this.search=new TreeSearch,_this._tempDisplayObject=new TemporaryDisplayObject,_this._useSystemTicker=void 0===options.useSystemTicker||options.useSystemTicker,_this.setTargetElement(_this.renderer.view,_this.renderer.resolution),_this}return function(d,b){function __(){this.constructor=d}extendStatics$2(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(InteractionManager,_super),Object.defineProperty(InteractionManager.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(useSystemTicker){this._useSystemTicker=useSystemTicker,useSystemTicker?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(InteractionManager.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),InteractionManager.prototype.hitTest=function(globalPoint,root){return hitTestEvent.target=null,hitTestEvent.data.global=globalPoint,root||(root=this.lastObjectRendered),this.processInteractive(hitTestEvent,root,null,!0),hitTestEvent.target},InteractionManager.prototype.setTargetElement=function(element,resolution){void 0===resolution&&(resolution=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=element,this.resolution=resolution,this.addEvents(),this.addTickerListener()},InteractionManager.prototype.addTickerListener=function(){!this.tickerAdded&&this.interactionDOMElement&&this._useSystemTicker&&(Ticker.system.add(this.tickerUpdate,this,UPDATE_PRIORITY.INTERACTION),this.tickerAdded=!0)},InteractionManager.prototype.removeTickerListener=function(){this.tickerAdded&&(Ticker.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},InteractionManager.prototype.addEvents=function(){if(!this.eventsAdded&&this.interactionDOMElement){var style=this.interactionDOMElement.style;window.navigator.msPointerEnabled?(style.msContentZooming="none",style.msTouchAction="none"):this.supportsPointerEvents&&(style.touchAction="none"),this.supportsPointerEvents?(window.document.addEventListener("pointermove",this.onPointerMove,!0),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,!0),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,!0),window.addEventListener("pointercancel",this.onPointerCancel,!0),window.addEventListener("pointerup",this.onPointerUp,!0)):(window.document.addEventListener("mousemove",this.onPointerMove,!0),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,!0),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,!0),window.addEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,!0),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,!0),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,!0),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,!0)),this.eventsAdded=!0}},InteractionManager.prototype.removeEvents=function(){if(this.eventsAdded&&this.interactionDOMElement){var style=this.interactionDOMElement.style;window.navigator.msPointerEnabled?(style.msContentZooming="",style.msTouchAction=""):this.supportsPointerEvents&&(style.touchAction=""),this.supportsPointerEvents?(window.document.removeEventListener("pointermove",this.onPointerMove,!0),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,!0),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,!0),window.removeEventListener("pointercancel",this.onPointerCancel,!0),window.removeEventListener("pointerup",this.onPointerUp,!0)):(window.document.removeEventListener("mousemove",this.onPointerMove,!0),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,!0),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,!0),window.removeEventListener("mouseup",this.onPointerUp,!0)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,!0),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,!0),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,!0),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,!0)),this.interactionDOMElement=null,this.eventsAdded=!1}},InteractionManager.prototype.tickerUpdate=function(deltaTime){this._deltaTime+=deltaTime,this._deltaTime<this.interactionFrequency||(this._deltaTime=0,this.update())},InteractionManager.prototype.update=function(){if(this.interactionDOMElement)if(this._didMove)this._didMove=!1;else{for(var k in this.cursor=null,this.activeInteractionData)if(this.activeInteractionData.hasOwnProperty(k)){var interactionData=this.activeInteractionData[k];if(interactionData.originalEvent&&"touch"!==interactionData.pointerType){var interactionEvent=this.configureInteractionEventForDOMEvent(this.eventData,interactionData.originalEvent,interactionData);this.processInteractive(interactionEvent,this.lastObjectRendered,this.processPointerOverOut,!0)}}this.setCursorMode(this.cursor)}},InteractionManager.prototype.setCursorMode=function(mode){if(mode=mode||"default",this.currentCursorMode!==mode){this.currentCursorMode=mode;var style=this.cursorStyles[mode];if(style)switch(typeof style){case"string":this.interactionDOMElement.style.cursor=style;break;case"function":style(mode);break;case"object":Object.assign(this.interactionDOMElement.style,style)}else"string"!=typeof mode||Object.prototype.hasOwnProperty.call(this.cursorStyles,mode)||(this.interactionDOMElement.style.cursor=mode)}},InteractionManager.prototype.dispatchEvent=function(displayObject,eventString,eventData){eventData.stopPropagationHint&&displayObject!==eventData.stopsPropagatingAt||(eventData.currentTarget=displayObject,eventData.type=eventString,displayObject.emit(eventString,eventData),displayObject[eventString]&&displayObject[eventString](eventData))},InteractionManager.prototype.delayDispatchEvent=function(displayObject,eventString,eventData){this.delayedEvents.push({displayObject:displayObject,eventString:eventString,eventData:eventData})},InteractionManager.prototype.mapPositionToPoint=function(point,x,y){var rect;rect=this.interactionDOMElement.parentElement?this.interactionDOMElement.getBoundingClientRect():{x:0,y:0,width:0,height:0};var resolutionMultiplier=1/this.resolution;point.x=(x-rect.left)*(this.interactionDOMElement.width/rect.width)*resolutionMultiplier,point.y=(y-rect.top)*(this.interactionDOMElement.height/rect.height)*resolutionMultiplier},InteractionManager.prototype.processInteractive=function(interactionEvent,displayObject,func,hitTest){var hit=this.search.findHit(interactionEvent,displayObject,func,hitTest),delayedEvents=this.delayedEvents;if(!delayedEvents.length)return hit;interactionEvent.stopPropagationHint=!1;var delayedLen=delayedEvents.length;this.delayedEvents=[];for(var i=0;i<delayedLen;i++){var _a=delayedEvents[i],displayObject_1=_a.displayObject,eventString=_a.eventString,eventData=_a.eventData;eventData.stopsPropagatingAt===displayObject_1&&(eventData.stopPropagationHint=!0),this.dispatchEvent(displayObject_1,eventString,eventData)}return hit},InteractionManager.prototype.onPointerDown=function(originalEvent){if(!this.supportsTouchEvents||"touch"!==originalEvent.pointerType){var events=this.normalizeToPointerData(originalEvent);if(this.autoPreventDefault&&events[0].isNormalized)(originalEvent.cancelable||!("cancelable"in originalEvent))&&originalEvent.preventDefault();for(var eventLen=events.length,i=0;i<eventLen;i++){var event=events[i],interactionData=this.getInteractionDataForPointerId(event),interactionEvent=this.configureInteractionEventForDOMEvent(this.eventData,event,interactionData);if(interactionEvent.data.originalEvent=originalEvent,this.processInteractive(interactionEvent,this.lastObjectRendered,this.processPointerDown,!0),this.emit("pointerdown",interactionEvent),"touch"===event.pointerType)this.emit("touchstart",interactionEvent);else if("mouse"===event.pointerType||"pen"===event.pointerType){var isRightButton=2===event.button;this.emit(isRightButton?"rightdown":"mousedown",this.eventData)}}}},InteractionManager.prototype.processPointerDown=function(interactionEvent,displayObject,hit){var data=interactionEvent.data,id=interactionEvent.data.identifier;if(hit)if(displayObject.trackedPointers[id]||(displayObject.trackedPointers[id]=new InteractionTrackingData(id)),this.dispatchEvent(displayObject,"pointerdown",interactionEvent),"touch"===data.pointerType)this.dispatchEvent(displayObject,"touchstart",interactionEvent);else if("mouse"===data.pointerType||"pen"===data.pointerType){var isRightButton=2===data.button;isRightButton?displayObject.trackedPointers[id].rightDown=!0:displayObject.trackedPointers[id].leftDown=!0,this.dispatchEvent(displayObject,isRightButton?"rightdown":"mousedown",interactionEvent)}},InteractionManager.prototype.onPointerComplete=function(originalEvent,cancelled,func){for(var events=this.normalizeToPointerData(originalEvent),eventLen=events.length,eventAppend=originalEvent.target!==this.interactionDOMElement?"outside":"",i=0;i<eventLen;i++){var event=events[i],interactionData=this.getInteractionDataForPointerId(event),interactionEvent=this.configureInteractionEventForDOMEvent(this.eventData,event,interactionData);if(interactionEvent.data.originalEvent=originalEvent,this.processInteractive(interactionEvent,this.lastObjectRendered,func,cancelled||!eventAppend),this.emit(cancelled?"pointercancel":"pointerup"+eventAppend,interactionEvent),"mouse"===event.pointerType||"pen"===event.pointerType){var isRightButton=2===event.button;this.emit(isRightButton?"rightup"+eventAppend:"mouseup"+eventAppend,interactionEvent)}else"touch"===event.pointerType&&(this.emit(cancelled?"touchcancel":"touchend"+eventAppend,interactionEvent),this.releaseInteractionDataForPointerId(event.pointerId))}},InteractionManager.prototype.onPointerCancel=function(event){this.supportsTouchEvents&&"touch"===event.pointerType||this.onPointerComplete(event,!0,this.processPointerCancel)},InteractionManager.prototype.processPointerCancel=function(interactionEvent,displayObject){var data=interactionEvent.data,id=interactionEvent.data.identifier;void 0!==displayObject.trackedPointers[id]&&(delete displayObject.trackedPointers[id],this.dispatchEvent(displayObject,"pointercancel",interactionEvent),"touch"===data.pointerType&&this.dispatchEvent(displayObject,"touchcancel",interactionEvent))},InteractionManager.prototype.onPointerUp=function(event){this.supportsTouchEvents&&"touch"===event.pointerType||this.onPointerComplete(event,!1,this.processPointerUp)},InteractionManager.prototype.processPointerUp=function(interactionEvent,displayObject,hit){var data=interactionEvent.data,id=interactionEvent.data.identifier,trackingData=displayObject.trackedPointers[id],isTouch="touch"===data.pointerType,isMouse="mouse"===data.pointerType||"pen"===data.pointerType,isMouseTap=!1;if(isMouse){var isRightButton=2===data.button,flags=InteractionTrackingData.FLAGS,test=isRightButton?flags.RIGHT_DOWN:flags.LEFT_DOWN,isDown=void 0!==trackingData&&trackingData.flags&test;hit?(this.dispatchEvent(displayObject,isRightButton?"rightup":"mouseup",interactionEvent),isDown&&(this.dispatchEvent(displayObject,isRightButton?"rightclick":"click",interactionEvent),isMouseTap=!0)):isDown&&this.dispatchEvent(displayObject,isRightButton?"rightupoutside":"mouseupoutside",interactionEvent),trackingData&&(isRightButton?trackingData.rightDown=!1:trackingData.leftDown=!1)}hit?(this.dispatchEvent(displayObject,"pointerup",interactionEvent),isTouch&&this.dispatchEvent(displayObject,"touchend",interactionEvent),trackingData&&(isMouse&&!isMouseTap||this.dispatchEvent(displayObject,"pointertap",interactionEvent),isTouch&&(this.dispatchEvent(displayObject,"tap",interactionEvent),trackingData.over=!1))):trackingData&&(this.dispatchEvent(displayObject,"pointerupoutside",interactionEvent),isTouch&&this.dispatchEvent(displayObject,"touchendoutside",interactionEvent)),trackingData&&trackingData.none&&delete displayObject.trackedPointers[id]},InteractionManager.prototype.onPointerMove=function(originalEvent){if(!this.supportsTouchEvents||"touch"!==originalEvent.pointerType){var events=this.normalizeToPointerData(originalEvent);"mouse"!==events[0].pointerType&&"pen"!==events[0].pointerType||(this._didMove=!0,this.cursor=null);for(var eventLen=events.length,i=0;i<eventLen;i++){var event=events[i],interactionData=this.getInteractionDataForPointerId(event),interactionEvent=this.configureInteractionEventForDOMEvent(this.eventData,event,interactionData);interactionEvent.data.originalEvent=originalEvent,this.processInteractive(interactionEvent,this.lastObjectRendered,this.processPointerMove,!0),this.emit("pointermove",interactionEvent),"touch"===event.pointerType&&this.emit("touchmove",interactionEvent),"mouse"!==event.pointerType&&"pen"!==event.pointerType||this.emit("mousemove",interactionEvent)}"mouse"===events[0].pointerType&&this.setCursorMode(this.cursor)}},InteractionManager.prototype.processPointerMove=function(interactionEvent,displayObject,hit){var data=interactionEvent.data,isTouch="touch"===data.pointerType,isMouse="mouse"===data.pointerType||"pen"===data.pointerType;isMouse&&this.processPointerOverOut(interactionEvent,displayObject,hit),this.moveWhenInside&&!hit||(this.dispatchEvent(displayObject,"pointermove",interactionEvent),isTouch&&this.dispatchEvent(displayObject,"touchmove",interactionEvent),isMouse&&this.dispatchEvent(displayObject,"mousemove",interactionEvent))},InteractionManager.prototype.onPointerOut=function(originalEvent){if(!this.supportsTouchEvents||"touch"!==originalEvent.pointerType){var event=this.normalizeToPointerData(originalEvent)[0];"mouse"===event.pointerType&&(this.mouseOverRenderer=!1,this.setCursorMode(null));var interactionData=this.getInteractionDataForPointerId(event),interactionEvent=this.configureInteractionEventForDOMEvent(this.eventData,event,interactionData);interactionEvent.data.originalEvent=event,this.processInteractive(interactionEvent,this.lastObjectRendered,this.processPointerOverOut,!1),this.emit("pointerout",interactionEvent),"mouse"===event.pointerType||"pen"===event.pointerType?this.emit("mouseout",interactionEvent):this.releaseInteractionDataForPointerId(interactionData.identifier)}},InteractionManager.prototype.processPointerOverOut=function(interactionEvent,displayObject,hit){var data=interactionEvent.data,id=interactionEvent.data.identifier,isMouse="mouse"===data.pointerType||"pen"===data.pointerType,trackingData=displayObject.trackedPointers[id];hit&&!trackingData&&(trackingData=displayObject.trackedPointers[id]=new InteractionTrackingData(id)),void 0!==trackingData&&(hit&&this.mouseOverRenderer?(trackingData.over||(trackingData.over=!0,this.delayDispatchEvent(displayObject,"pointerover",interactionEvent),isMouse&&this.delayDispatchEvent(displayObject,"mouseover",interactionEvent)),isMouse&&null===this.cursor&&(this.cursor=displayObject.cursor)):trackingData.over&&(trackingData.over=!1,this.dispatchEvent(displayObject,"pointerout",this.eventData),isMouse&&this.dispatchEvent(displayObject,"mouseout",interactionEvent),trackingData.none&&delete displayObject.trackedPointers[id]))},InteractionManager.prototype.onPointerOver=function(originalEvent){var event=this.normalizeToPointerData(originalEvent)[0],interactionData=this.getInteractionDataForPointerId(event),interactionEvent=this.configureInteractionEventForDOMEvent(this.eventData,event,interactionData);interactionEvent.data.originalEvent=event,"mouse"===event.pointerType&&(this.mouseOverRenderer=!0),this.emit("pointerover",interactionEvent),"mouse"!==event.pointerType&&"pen"!==event.pointerType||this.emit("mouseover",interactionEvent)},InteractionManager.prototype.getInteractionDataForPointerId=function(event){var interactionData,pointerId=event.pointerId;return 1===pointerId||"mouse"===event.pointerType?interactionData=this.mouse:this.activeInteractionData[pointerId]?interactionData=this.activeInteractionData[pointerId]:((interactionData=this.interactionDataPool.pop()||new InteractionData).identifier=pointerId,this.activeInteractionData[pointerId]=interactionData),interactionData.copyEvent(event),interactionData},InteractionManager.prototype.releaseInteractionDataForPointerId=function(pointerId){var interactionData=this.activeInteractionData[pointerId];interactionData&&(delete this.activeInteractionData[pointerId],interactionData.reset(),this.interactionDataPool.push(interactionData))},InteractionManager.prototype.configureInteractionEventForDOMEvent=function(interactionEvent,pointerEvent,interactionData){return interactionEvent.data=interactionData,this.mapPositionToPoint(interactionData.global,pointerEvent.clientX,pointerEvent.clientY),"touch"===pointerEvent.pointerType&&(pointerEvent.globalX=interactionData.global.x,pointerEvent.globalY=interactionData.global.y),interactionData.originalEvent=pointerEvent,interactionEvent.reset(),interactionEvent},InteractionManager.prototype.normalizeToPointerData=function(event){var normalizedEvents=[];if(this.supportsTouchEvents&&event instanceof TouchEvent)for(var i=0,li=event.changedTouches.length;i<li;i++){var touch=event.changedTouches[i];void 0===touch.button&&(touch.button=event.touches.length?1:0),void 0===touch.buttons&&(touch.buttons=event.touches.length?1:0),void 0===touch.isPrimary&&(touch.isPrimary=1===event.touches.length&&"touchstart"===event.type),void 0===touch.width&&(touch.width=touch.radiusX||1),void 0===touch.height&&(touch.height=touch.radiusY||1),void 0===touch.tiltX&&(touch.tiltX=0),void 0===touch.tiltY&&(touch.tiltY=0),void 0===touch.pointerType&&(touch.pointerType="touch"),void 0===touch.pointerId&&(touch.pointerId=touch.identifier||0),void 0===touch.pressure&&(touch.pressure=touch.force||.5),void 0===touch.twist&&(touch.twist=0),void 0===touch.tangentialPressure&&(touch.tangentialPressure=0),void 0===touch.layerX&&(touch.layerX=touch.offsetX=touch.clientX),void 0===touch.layerY&&(touch.layerY=touch.offsetY=touch.clientY),touch.isNormalized=!0,normalizedEvents.push(touch)}else if(!(event instanceof MouseEvent)||this.supportsPointerEvents&&event instanceof window.PointerEvent)normalizedEvents.push(event);else{var tempEvent=event;void 0===tempEvent.isPrimary&&(tempEvent.isPrimary=!0),void 0===tempEvent.width&&(tempEvent.width=1),void 0===tempEvent.height&&(tempEvent.height=1),void 0===tempEvent.tiltX&&(tempEvent.tiltX=0),void 0===tempEvent.tiltY&&(tempEvent.tiltY=0),void 0===tempEvent.pointerType&&(tempEvent.pointerType="mouse"),void 0===tempEvent.pointerId&&(tempEvent.pointerId=1),void 0===tempEvent.pressure&&(tempEvent.pressure=.5),void 0===tempEvent.twist&&(tempEvent.twist=0),void 0===tempEvent.tangentialPressure&&(tempEvent.tangentialPressure=0),tempEvent.isNormalized=!0,normalizedEvents.push(tempEvent)}return normalizedEvents},InteractionManager.prototype.destroy=function(){this.removeEvents(),this.removeTickerListener(),this.removeAllListeners(),this.renderer=null,this.mouse=null,this.eventData=null,this.interactionDOMElement=null,this.onPointerDown=null,this.processPointerDown=null,this.onPointerUp=null,this.processPointerUp=null,this.onPointerCancel=null,this.processPointerCancel=null,this.onPointerMove=null,this.processPointerMove=null,this.onPointerOut=null,this.processPointerOverOut=null,this.onPointerOver=null,this.search=null},InteractionManager}(eventemitter3),Runner=function(){function Runner(name){this.items=[],this._name=name,this._aliasCount=0}return Runner.prototype.emit=function(a0,a1,a2,a3,a4,a5,a6,a7){if(arguments.length>8)throw new Error("max arguments reached");var _a=this,name=_a.name,items=_a.items;this._aliasCount++;for(var i=0,len=items.length;i<len;i++)items[i][name](a0,a1,a2,a3,a4,a5,a6,a7);return items===this.items&&this._aliasCount--,this},Runner.prototype.ensureNonAliasedItems=function(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},Runner.prototype.add=function(item){return item[this._name]&&(this.ensureNonAliasedItems(),this.remove(item),this.items.push(item)),this},Runner.prototype.remove=function(item){var index=this.items.indexOf(item);return-1!==index&&(this.ensureNonAliasedItems(),this.items.splice(index,1)),this},Runner.prototype.contains=function(item){return-1!==this.items.indexOf(item)},Runner.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},Runner.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(Runner.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(Runner.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Runner}();Object.defineProperties(Runner.prototype,{dispatch:{value:Runner.prototype.emit},run:{value:Runner.prototype.emit}}),
|
|
81
|
+
settings.TARGET_FPMS=.06,function(UPDATE_PRIORITY){UPDATE_PRIORITY[UPDATE_PRIORITY.INTERACTION=50]="INTERACTION",UPDATE_PRIORITY[UPDATE_PRIORITY.HIGH=25]="HIGH",UPDATE_PRIORITY[UPDATE_PRIORITY.NORMAL=0]="NORMAL",UPDATE_PRIORITY[UPDATE_PRIORITY.LOW=-25]="LOW",UPDATE_PRIORITY[UPDATE_PRIORITY.UTILITY=-50]="UTILITY"}(UPDATE_PRIORITY||(UPDATE_PRIORITY={}));var TickerListener=function(){function TickerListener(fn,context,priority,once){void 0===context&&(context=null),void 0===priority&&(priority=0),void 0===once&&(once=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=fn,this.context=context,this.priority=priority,this.once=once}return TickerListener.prototype.match=function(fn,context){return void 0===context&&(context=null),this.fn===fn&&this.context===context},TickerListener.prototype.emit=function(deltaTime){this.fn&&(this.context?this.fn.call(this.context,deltaTime):this.fn(deltaTime));var redirect=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),redirect},TickerListener.prototype.connect=function(previous){this.previous=previous,previous.next&&(previous.next.previous=this),this.next=previous.next,previous.next=this},TickerListener.prototype.destroy=function(hard){void 0===hard&&(hard=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var redirect=this.next;return this.next=hard?null:redirect,this.previous=null,redirect},TickerListener}(),Ticker=function(){function Ticker(){var _this=this;this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new TickerListener(null,null,1/0),this.deltaMS=1/settings.TARGET_FPMS,this.elapsedMS=1/settings.TARGET_FPMS,this._tick=function(time){_this._requestId=null,_this.started&&(_this.update(time),_this.started&&null===_this._requestId&&_this._head.next&&(_this._requestId=requestAnimationFrame(_this._tick)))}}return Ticker.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},Ticker.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},Ticker.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},Ticker.prototype.add=function(fn,context,priority){return void 0===priority&&(priority=UPDATE_PRIORITY.NORMAL),this._addListener(new TickerListener(fn,context,priority))},Ticker.prototype.addOnce=function(fn,context,priority){return void 0===priority&&(priority=UPDATE_PRIORITY.NORMAL),this._addListener(new TickerListener(fn,context,priority,!0))},Ticker.prototype._addListener=function(listener){var current=this._head.next,previous=this._head;if(current){for(;current;){if(listener.priority>current.priority){listener.connect(previous);break}previous=current,current=current.next}listener.previous||listener.connect(previous)}else listener.connect(previous);return this._startIfPossible(),this},Ticker.prototype.remove=function(fn,context){for(var listener=this._head.next;listener;)listener=listener.match(fn,context)?listener.destroy():listener.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(Ticker.prototype,"count",{get:function(){if(!this._head)return 0;for(var count=0,current=this._head;current=current.next;)count++;return count},enumerable:!1,configurable:!0}),Ticker.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},Ticker.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},Ticker.prototype.destroy=function(){if(!this._protected){this.stop();for(var listener=this._head.next;listener;)listener=listener.destroy(!0);this._head.destroy(),this._head=null}},Ticker.prototype.update=function(currentTime){var elapsedMS;if(void 0===currentTime&&(currentTime=performance.now()),currentTime>this.lastTime){if((elapsedMS=this.elapsedMS=currentTime-this.lastTime)>this._maxElapsedMS&&(elapsedMS=this._maxElapsedMS),elapsedMS*=this.speed,this._minElapsedMS){var delta=currentTime-this._lastFrame|0;if(delta<this._minElapsedMS)return;this._lastFrame=currentTime-delta%this._minElapsedMS}this.deltaMS=elapsedMS,this.deltaTime=this.deltaMS*settings.TARGET_FPMS;for(var head=this._head,listener=head.next;listener;)listener=listener.emit(this.deltaTime);head.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=currentTime},Object.defineProperty(Ticker.prototype,"FPS",{get:function(){return 1e3/this.elapsedMS},enumerable:!1,configurable:!0}),Object.defineProperty(Ticker.prototype,"minFPS",{get:function(){return 1e3/this._maxElapsedMS},set:function(fps){var minFPS=Math.min(this.maxFPS,fps),minFPMS=Math.min(Math.max(0,minFPS)/1e3,settings.TARGET_FPMS);this._maxElapsedMS=1/minFPMS},enumerable:!1,configurable:!0}),Object.defineProperty(Ticker.prototype,"maxFPS",{get:function(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0},set:function(fps){if(0===fps)this._minElapsedMS=0;else{var maxFPS=Math.max(this.minFPS,fps);this._minElapsedMS=1/(maxFPS/1e3)}},enumerable:!1,configurable:!0}),Object.defineProperty(Ticker,"shared",{get:function(){if(!Ticker._shared){var shared=Ticker._shared=new Ticker;shared.autoStart=!0,shared._protected=!0}return Ticker._shared},enumerable:!1,configurable:!0}),Object.defineProperty(Ticker,"system",{get:function(){if(!Ticker._system){var system=Ticker._system=new Ticker;system.autoStart=!0,system._protected=!0}return Ticker._system},enumerable:!1,configurable:!0}),Ticker}(),TickerPlugin=function(){function TickerPlugin(){}return TickerPlugin.init=function(options){var _this=this;options=Object.assign({autoStart:!0,sharedTicker:!1},options),Object.defineProperty(this,"ticker",{set:function(ticker){this._ticker&&this._ticker.remove(this.render,this),this._ticker=ticker,ticker&&ticker.add(this.render,this,UPDATE_PRIORITY.LOW)},get:function(){return this._ticker}}),this.stop=function(){_this._ticker.stop()},this.start=function(){_this._ticker.start()},this._ticker=null,this.ticker=options.sharedTicker?Ticker.shared:new Ticker,options.autoStart&&this.start()},TickerPlugin.destroy=function(){if(this._ticker){var oldTicker=this._ticker;this.ticker=null,oldTicker.destroy()}},TickerPlugin}(),InteractionData=function(){function InteractionData(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new Point,this.target=null,this.originalEvent=null,this.identifier=null,this.isPrimary=!1,this.button=0,this.buttons=0,this.width=0,this.height=0,this.tiltX=0,this.tiltY=0,this.pointerType=null,this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0}return Object.defineProperty(InteractionData.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),InteractionData.prototype.getLocalPosition=function(displayObject,point,globalPos){return displayObject.worldTransform.applyInverse(globalPos||this.global,point)},InteractionData.prototype.copyEvent=function(event){"isPrimary"in event&&event.isPrimary&&(this.isPrimary=!0),this.button="button"in event&&event.button;var buttons="buttons"in event&&event.buttons;this.buttons=Number.isInteger(buttons)?buttons:"which"in event&&event.which,this.width="width"in event&&event.width,this.height="height"in event&&event.height,this.tiltX="tiltX"in event&&event.tiltX,this.tiltY="tiltY"in event&&event.tiltY,this.pointerType="pointerType"in event&&event.pointerType,this.pressure="pressure"in event&&event.pressure,this.rotationAngle="rotationAngle"in event&&event.rotationAngle,this.twist="twist"in event&&event.twist||0,this.tangentialPressure="tangentialPressure"in event&&event.tangentialPressure||0},InteractionData.prototype.reset=function(){this.isPrimary=!1},InteractionData}(),extendStatics$2=function(d,b){return extendStatics$2=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$2(d,b)};var InteractionEvent=function(){function InteractionEvent(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return InteractionEvent.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},InteractionEvent.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},InteractionEvent}(),InteractionTrackingData=function(){function InteractionTrackingData(pointerId){this._pointerId=pointerId,this._flags=InteractionTrackingData.FLAGS.NONE}return InteractionTrackingData.prototype._doSet=function(flag,yn){this._flags=yn?this._flags|flag:this._flags&~flag},Object.defineProperty(InteractionTrackingData.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(InteractionTrackingData.prototype,"flags",{get:function(){return this._flags},set:function(flags){this._flags=flags},enumerable:!1,configurable:!0}),Object.defineProperty(InteractionTrackingData.prototype,"none",{get:function(){return this._flags===InteractionTrackingData.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(InteractionTrackingData.prototype,"over",{get:function(){return 0!=(this._flags&InteractionTrackingData.FLAGS.OVER)},set:function(yn){this._doSet(InteractionTrackingData.FLAGS.OVER,yn)},enumerable:!1,configurable:!0}),Object.defineProperty(InteractionTrackingData.prototype,"rightDown",{get:function(){return 0!=(this._flags&InteractionTrackingData.FLAGS.RIGHT_DOWN)},set:function(yn){this._doSet(InteractionTrackingData.FLAGS.RIGHT_DOWN,yn)},enumerable:!1,configurable:!0}),Object.defineProperty(InteractionTrackingData.prototype,"leftDown",{get:function(){return 0!=(this._flags&InteractionTrackingData.FLAGS.LEFT_DOWN)},set:function(yn){this._doSet(InteractionTrackingData.FLAGS.LEFT_DOWN,yn)},enumerable:!1,configurable:!0}),InteractionTrackingData.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),InteractionTrackingData}(),TreeSearch=function(){function TreeSearch(){this._tempPoint=new Point}return TreeSearch.prototype.recursiveFindHit=function(interactionEvent,displayObject,func,hitTest,interactive){if(!displayObject||!displayObject.visible)return!1;var point=interactionEvent.data.global,hit=!1,interactiveParent=interactive=displayObject.interactive||interactive,hitTestChildren=!0;if(displayObject.hitArea?(hitTest&&(displayObject.worldTransform.applyInverse(point,this._tempPoint),displayObject.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?hit=!0:(hitTest=!1,hitTestChildren=!1)),interactiveParent=!1):displayObject._mask&&hitTest&&(displayObject._mask.containsPoint&&displayObject._mask.containsPoint(point)||(hitTest=!1)),hitTestChildren&&displayObject.interactiveChildren&&displayObject.children)for(var children=displayObject.children,i=children.length-1;i>=0;i--){var child=children[i],childHit=this.recursiveFindHit(interactionEvent,child,func,hitTest,interactiveParent);if(childHit){if(!child.parent)continue;interactiveParent=!1,childHit&&(interactionEvent.target&&(hitTest=!1),hit=!0)}}return interactive&&(hitTest&&!interactionEvent.target&&!displayObject.hitArea&&displayObject.containsPoint&&displayObject.containsPoint(point)&&(hit=!0),displayObject.interactive&&(hit&&!interactionEvent.target&&(interactionEvent.target=displayObject),func&&func(interactionEvent,displayObject,!!hit))),hit},TreeSearch.prototype.findHit=function(interactionEvent,displayObject,func,hitTest){this.recursiveFindHit(interactionEvent,displayObject,func,hitTest,!1)},TreeSearch}(),interactiveTarget={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(value){value?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};DisplayObject.mixin(interactiveTarget);var hitTestEvent={target:null,data:{global:null}},InteractionManager=function(_super){function InteractionManager(renderer,options){var _this=_super.call(this)||this;return options=options||{},_this.renderer=renderer,_this.autoPreventDefault=void 0===options.autoPreventDefault||options.autoPreventDefault,_this.interactionFrequency=options.interactionFrequency||10,_this.mouse=new InteractionData,_this.mouse.identifier=1,_this.mouse.global.set(-999999),_this.activeInteractionData={},_this.activeInteractionData[1]=_this.mouse,_this.interactionDataPool=[],_this.eventData=new InteractionEvent,_this.interactionDOMElement=null,_this.moveWhenInside=!1,_this.eventsAdded=!1,_this.tickerAdded=!1,_this.mouseOverRenderer=!("PointerEvent"in globalThis),_this.supportsTouchEvents="ontouchstart"in globalThis,_this.supportsPointerEvents=!!globalThis.PointerEvent,_this.onPointerUp=_this.onPointerUp.bind(_this),_this.processPointerUp=_this.processPointerUp.bind(_this),_this.onPointerCancel=_this.onPointerCancel.bind(_this),_this.processPointerCancel=_this.processPointerCancel.bind(_this),_this.onPointerDown=_this.onPointerDown.bind(_this),_this.processPointerDown=_this.processPointerDown.bind(_this),_this.onPointerMove=_this.onPointerMove.bind(_this),_this.processPointerMove=_this.processPointerMove.bind(_this),_this.onPointerOut=_this.onPointerOut.bind(_this),_this.processPointerOverOut=_this.processPointerOverOut.bind(_this),_this.onPointerOver=_this.onPointerOver.bind(_this),_this.cursorStyles={default:"inherit",pointer:"pointer"},_this.currentCursorMode=null,_this.cursor=null,_this.resolution=1,_this.delayedEvents=[],_this.search=new TreeSearch,_this._tempDisplayObject=new TemporaryDisplayObject,_this._eventListenerOptions={capture:!0,passive:!1},_this._useSystemTicker=void 0===options.useSystemTicker||options.useSystemTicker,_this.setTargetElement(_this.renderer.view,_this.renderer.resolution),_this}return function(d,b){function __(){this.constructor=d}extendStatics$2(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(InteractionManager,_super),Object.defineProperty(InteractionManager.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(useSystemTicker){this._useSystemTicker=useSystemTicker,useSystemTicker?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(InteractionManager.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),InteractionManager.prototype.hitTest=function(globalPoint,root){return hitTestEvent.target=null,hitTestEvent.data.global=globalPoint,root||(root=this.lastObjectRendered),this.processInteractive(hitTestEvent,root,null,!0),hitTestEvent.target},InteractionManager.prototype.setTargetElement=function(element,resolution){void 0===resolution&&(resolution=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=element,this.resolution=resolution,this.addEvents(),this.addTickerListener()},InteractionManager.prototype.addTickerListener=function(){!this.tickerAdded&&this.interactionDOMElement&&this._useSystemTicker&&(Ticker.system.add(this.tickerUpdate,this,UPDATE_PRIORITY.INTERACTION),this.tickerAdded=!0)},InteractionManager.prototype.removeTickerListener=function(){this.tickerAdded&&(Ticker.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},InteractionManager.prototype.addEvents=function(){if(!this.eventsAdded&&this.interactionDOMElement){var style=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(style.msContentZooming="none",style.msTouchAction="none"):this.supportsPointerEvents&&(style.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},InteractionManager.prototype.removeEvents=function(){if(this.eventsAdded&&this.interactionDOMElement){var style=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(style.msContentZooming="",style.msTouchAction=""):this.supportsPointerEvents&&(style.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},InteractionManager.prototype.tickerUpdate=function(deltaTime){this._deltaTime+=deltaTime,this._deltaTime<this.interactionFrequency||(this._deltaTime=0,this.update())},InteractionManager.prototype.update=function(){if(this.interactionDOMElement)if(this._didMove)this._didMove=!1;else{for(var k in this.cursor=null,this.activeInteractionData)if(this.activeInteractionData.hasOwnProperty(k)){var interactionData=this.activeInteractionData[k];if(interactionData.originalEvent&&"touch"!==interactionData.pointerType){var interactionEvent=this.configureInteractionEventForDOMEvent(this.eventData,interactionData.originalEvent,interactionData);this.processInteractive(interactionEvent,this.lastObjectRendered,this.processPointerOverOut,!0)}}this.setCursorMode(this.cursor)}},InteractionManager.prototype.setCursorMode=function(mode){mode=mode||"default";var applyStyles=!0;if(globalThis.OffscreenCanvas&&this.interactionDOMElement instanceof OffscreenCanvas&&(applyStyles=!1),this.currentCursorMode!==mode){this.currentCursorMode=mode;var style=this.cursorStyles[mode];if(style)switch(typeof style){case"string":applyStyles&&(this.interactionDOMElement.style.cursor=style);break;case"function":style(mode);break;case"object":applyStyles&&Object.assign(this.interactionDOMElement.style,style)}else applyStyles&&"string"==typeof mode&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,mode)&&(this.interactionDOMElement.style.cursor=mode)}},InteractionManager.prototype.dispatchEvent=function(displayObject,eventString,eventData){eventData.stopPropagationHint&&displayObject!==eventData.stopsPropagatingAt||(eventData.currentTarget=displayObject,eventData.type=eventString,displayObject.emit(eventString,eventData),displayObject[eventString]&&displayObject[eventString](eventData))},InteractionManager.prototype.delayDispatchEvent=function(displayObject,eventString,eventData){this.delayedEvents.push({displayObject:displayObject,eventString:eventString,eventData:eventData})},InteractionManager.prototype.mapPositionToPoint=function(point,x,y){var rect;rect=this.interactionDOMElement.parentElement?this.interactionDOMElement.getBoundingClientRect():{x:0,y:0,width:this.interactionDOMElement.width,height:this.interactionDOMElement.height,left:0,top:0};var resolutionMultiplier=1/this.resolution;point.x=(x-rect.left)*(this.interactionDOMElement.width/rect.width)*resolutionMultiplier,point.y=(y-rect.top)*(this.interactionDOMElement.height/rect.height)*resolutionMultiplier},InteractionManager.prototype.processInteractive=function(interactionEvent,displayObject,func,hitTest){var hit=this.search.findHit(interactionEvent,displayObject,func,hitTest),delayedEvents=this.delayedEvents;if(!delayedEvents.length)return hit;interactionEvent.stopPropagationHint=!1;var delayedLen=delayedEvents.length;this.delayedEvents=[];for(var i=0;i<delayedLen;i++){var _a=delayedEvents[i],displayObject_1=_a.displayObject,eventString=_a.eventString,eventData=_a.eventData;eventData.stopsPropagatingAt===displayObject_1&&(eventData.stopPropagationHint=!0),this.dispatchEvent(displayObject_1,eventString,eventData)}return hit},InteractionManager.prototype.onPointerDown=function(originalEvent){if(!this.supportsTouchEvents||"touch"!==originalEvent.pointerType){var events=this.normalizeToPointerData(originalEvent);if(this.autoPreventDefault&&events[0].isNormalized)(originalEvent.cancelable||!("cancelable"in originalEvent))&&originalEvent.preventDefault();for(var eventLen=events.length,i=0;i<eventLen;i++){var event=events[i],interactionData=this.getInteractionDataForPointerId(event),interactionEvent=this.configureInteractionEventForDOMEvent(this.eventData,event,interactionData);if(interactionEvent.data.originalEvent=originalEvent,this.processInteractive(interactionEvent,this.lastObjectRendered,this.processPointerDown,!0),this.emit("pointerdown",interactionEvent),"touch"===event.pointerType)this.emit("touchstart",interactionEvent);else if("mouse"===event.pointerType||"pen"===event.pointerType){var isRightButton=2===event.button;this.emit(isRightButton?"rightdown":"mousedown",this.eventData)}}}},InteractionManager.prototype.processPointerDown=function(interactionEvent,displayObject,hit){var data=interactionEvent.data,id=interactionEvent.data.identifier;if(hit)if(displayObject.trackedPointers[id]||(displayObject.trackedPointers[id]=new InteractionTrackingData(id)),this.dispatchEvent(displayObject,"pointerdown",interactionEvent),"touch"===data.pointerType)this.dispatchEvent(displayObject,"touchstart",interactionEvent);else if("mouse"===data.pointerType||"pen"===data.pointerType){var isRightButton=2===data.button;isRightButton?displayObject.trackedPointers[id].rightDown=!0:displayObject.trackedPointers[id].leftDown=!0,this.dispatchEvent(displayObject,isRightButton?"rightdown":"mousedown",interactionEvent)}},InteractionManager.prototype.onPointerComplete=function(originalEvent,cancelled,func){for(var events=this.normalizeToPointerData(originalEvent),eventLen=events.length,eventAppend=originalEvent.target!==this.interactionDOMElement?"outside":"",i=0;i<eventLen;i++){var event=events[i],interactionData=this.getInteractionDataForPointerId(event),interactionEvent=this.configureInteractionEventForDOMEvent(this.eventData,event,interactionData);if(interactionEvent.data.originalEvent=originalEvent,this.processInteractive(interactionEvent,this.lastObjectRendered,func,cancelled||!eventAppend),this.emit(cancelled?"pointercancel":"pointerup"+eventAppend,interactionEvent),"mouse"===event.pointerType||"pen"===event.pointerType){var isRightButton=2===event.button;this.emit(isRightButton?"rightup"+eventAppend:"mouseup"+eventAppend,interactionEvent)}else"touch"===event.pointerType&&(this.emit(cancelled?"touchcancel":"touchend"+eventAppend,interactionEvent),this.releaseInteractionDataForPointerId(event.pointerId))}},InteractionManager.prototype.onPointerCancel=function(event){this.supportsTouchEvents&&"touch"===event.pointerType||this.onPointerComplete(event,!0,this.processPointerCancel)},InteractionManager.prototype.processPointerCancel=function(interactionEvent,displayObject){var data=interactionEvent.data,id=interactionEvent.data.identifier;void 0!==displayObject.trackedPointers[id]&&(delete displayObject.trackedPointers[id],this.dispatchEvent(displayObject,"pointercancel",interactionEvent),"touch"===data.pointerType&&this.dispatchEvent(displayObject,"touchcancel",interactionEvent))},InteractionManager.prototype.onPointerUp=function(event){this.supportsTouchEvents&&"touch"===event.pointerType||this.onPointerComplete(event,!1,this.processPointerUp)},InteractionManager.prototype.processPointerUp=function(interactionEvent,displayObject,hit){var data=interactionEvent.data,id=interactionEvent.data.identifier,trackingData=displayObject.trackedPointers[id],isTouch="touch"===data.pointerType,isMouse="mouse"===data.pointerType||"pen"===data.pointerType,isMouseTap=!1;if(isMouse){var isRightButton=2===data.button,flags=InteractionTrackingData.FLAGS,test=isRightButton?flags.RIGHT_DOWN:flags.LEFT_DOWN,isDown=void 0!==trackingData&&trackingData.flags&test;hit?(this.dispatchEvent(displayObject,isRightButton?"rightup":"mouseup",interactionEvent),isDown&&(this.dispatchEvent(displayObject,isRightButton?"rightclick":"click",interactionEvent),isMouseTap=!0)):isDown&&this.dispatchEvent(displayObject,isRightButton?"rightupoutside":"mouseupoutside",interactionEvent),trackingData&&(isRightButton?trackingData.rightDown=!1:trackingData.leftDown=!1)}hit?(this.dispatchEvent(displayObject,"pointerup",interactionEvent),isTouch&&this.dispatchEvent(displayObject,"touchend",interactionEvent),trackingData&&(isMouse&&!isMouseTap||this.dispatchEvent(displayObject,"pointertap",interactionEvent),isTouch&&(this.dispatchEvent(displayObject,"tap",interactionEvent),trackingData.over=!1))):trackingData&&(this.dispatchEvent(displayObject,"pointerupoutside",interactionEvent),isTouch&&this.dispatchEvent(displayObject,"touchendoutside",interactionEvent)),trackingData&&trackingData.none&&delete displayObject.trackedPointers[id]},InteractionManager.prototype.onPointerMove=function(originalEvent){if(!this.supportsTouchEvents||"touch"!==originalEvent.pointerType){var events=this.normalizeToPointerData(originalEvent);"mouse"!==events[0].pointerType&&"pen"!==events[0].pointerType||(this._didMove=!0,this.cursor=null);for(var eventLen=events.length,i=0;i<eventLen;i++){var event=events[i],interactionData=this.getInteractionDataForPointerId(event),interactionEvent=this.configureInteractionEventForDOMEvent(this.eventData,event,interactionData);interactionEvent.data.originalEvent=originalEvent,this.processInteractive(interactionEvent,this.lastObjectRendered,this.processPointerMove,!0),this.emit("pointermove",interactionEvent),"touch"===event.pointerType&&this.emit("touchmove",interactionEvent),"mouse"!==event.pointerType&&"pen"!==event.pointerType||this.emit("mousemove",interactionEvent)}"mouse"===events[0].pointerType&&this.setCursorMode(this.cursor)}},InteractionManager.prototype.processPointerMove=function(interactionEvent,displayObject,hit){var data=interactionEvent.data,isTouch="touch"===data.pointerType,isMouse="mouse"===data.pointerType||"pen"===data.pointerType;isMouse&&this.processPointerOverOut(interactionEvent,displayObject,hit),this.moveWhenInside&&!hit||(this.dispatchEvent(displayObject,"pointermove",interactionEvent),isTouch&&this.dispatchEvent(displayObject,"touchmove",interactionEvent),isMouse&&this.dispatchEvent(displayObject,"mousemove",interactionEvent))},InteractionManager.prototype.onPointerOut=function(originalEvent){if(!this.supportsTouchEvents||"touch"!==originalEvent.pointerType){var event=this.normalizeToPointerData(originalEvent)[0];"mouse"===event.pointerType&&(this.mouseOverRenderer=!1,this.setCursorMode(null));var interactionData=this.getInteractionDataForPointerId(event),interactionEvent=this.configureInteractionEventForDOMEvent(this.eventData,event,interactionData);interactionEvent.data.originalEvent=event,this.processInteractive(interactionEvent,this.lastObjectRendered,this.processPointerOverOut,!1),this.emit("pointerout",interactionEvent),"mouse"===event.pointerType||"pen"===event.pointerType?this.emit("mouseout",interactionEvent):this.releaseInteractionDataForPointerId(interactionData.identifier)}},InteractionManager.prototype.processPointerOverOut=function(interactionEvent,displayObject,hit){var data=interactionEvent.data,id=interactionEvent.data.identifier,isMouse="mouse"===data.pointerType||"pen"===data.pointerType,trackingData=displayObject.trackedPointers[id];hit&&!trackingData&&(trackingData=displayObject.trackedPointers[id]=new InteractionTrackingData(id)),void 0!==trackingData&&(hit&&this.mouseOverRenderer?(trackingData.over||(trackingData.over=!0,this.delayDispatchEvent(displayObject,"pointerover",interactionEvent),isMouse&&this.delayDispatchEvent(displayObject,"mouseover",interactionEvent)),isMouse&&null===this.cursor&&(this.cursor=displayObject.cursor)):trackingData.over&&(trackingData.over=!1,this.dispatchEvent(displayObject,"pointerout",this.eventData),isMouse&&this.dispatchEvent(displayObject,"mouseout",interactionEvent),trackingData.none&&delete displayObject.trackedPointers[id]))},InteractionManager.prototype.onPointerOver=function(originalEvent){var event=this.normalizeToPointerData(originalEvent)[0],interactionData=this.getInteractionDataForPointerId(event),interactionEvent=this.configureInteractionEventForDOMEvent(this.eventData,event,interactionData);interactionEvent.data.originalEvent=event,"mouse"===event.pointerType&&(this.mouseOverRenderer=!0),this.emit("pointerover",interactionEvent),"mouse"!==event.pointerType&&"pen"!==event.pointerType||this.emit("mouseover",interactionEvent)},InteractionManager.prototype.getInteractionDataForPointerId=function(event){var interactionData,pointerId=event.pointerId;return 1===pointerId||"mouse"===event.pointerType?interactionData=this.mouse:this.activeInteractionData[pointerId]?interactionData=this.activeInteractionData[pointerId]:((interactionData=this.interactionDataPool.pop()||new InteractionData).identifier=pointerId,this.activeInteractionData[pointerId]=interactionData),interactionData.copyEvent(event),interactionData},InteractionManager.prototype.releaseInteractionDataForPointerId=function(pointerId){var interactionData=this.activeInteractionData[pointerId];interactionData&&(delete this.activeInteractionData[pointerId],interactionData.reset(),this.interactionDataPool.push(interactionData))},InteractionManager.prototype.configureInteractionEventForDOMEvent=function(interactionEvent,pointerEvent,interactionData){return interactionEvent.data=interactionData,this.mapPositionToPoint(interactionData.global,pointerEvent.clientX,pointerEvent.clientY),"touch"===pointerEvent.pointerType&&(pointerEvent.globalX=interactionData.global.x,pointerEvent.globalY=interactionData.global.y),interactionData.originalEvent=pointerEvent,interactionEvent.reset(),interactionEvent},InteractionManager.prototype.normalizeToPointerData=function(event){var normalizedEvents=[];if(this.supportsTouchEvents&&event instanceof TouchEvent)for(var i=0,li=event.changedTouches.length;i<li;i++){var touch=event.changedTouches[i];void 0===touch.button&&(touch.button=event.touches.length?1:0),void 0===touch.buttons&&(touch.buttons=event.touches.length?1:0),void 0===touch.isPrimary&&(touch.isPrimary=1===event.touches.length&&"touchstart"===event.type),void 0===touch.width&&(touch.width=touch.radiusX||1),void 0===touch.height&&(touch.height=touch.radiusY||1),void 0===touch.tiltX&&(touch.tiltX=0),void 0===touch.tiltY&&(touch.tiltY=0),void 0===touch.pointerType&&(touch.pointerType="touch"),void 0===touch.pointerId&&(touch.pointerId=touch.identifier||0),void 0===touch.pressure&&(touch.pressure=touch.force||.5),void 0===touch.twist&&(touch.twist=0),void 0===touch.tangentialPressure&&(touch.tangentialPressure=0),void 0===touch.layerX&&(touch.layerX=touch.offsetX=touch.clientX),void 0===touch.layerY&&(touch.layerY=touch.offsetY=touch.clientY),touch.isNormalized=!0,normalizedEvents.push(touch)}else if(globalThis.MouseEvent&&(!(event instanceof MouseEvent)||this.supportsPointerEvents&&event instanceof globalThis.PointerEvent))normalizedEvents.push(event);else{var tempEvent=event;void 0===tempEvent.isPrimary&&(tempEvent.isPrimary=!0),void 0===tempEvent.width&&(tempEvent.width=1),void 0===tempEvent.height&&(tempEvent.height=1),void 0===tempEvent.tiltX&&(tempEvent.tiltX=0),void 0===tempEvent.tiltY&&(tempEvent.tiltY=0),void 0===tempEvent.pointerType&&(tempEvent.pointerType="mouse"),void 0===tempEvent.pointerId&&(tempEvent.pointerId=1),void 0===tempEvent.pressure&&(tempEvent.pressure=.5),void 0===tempEvent.twist&&(tempEvent.twist=0),void 0===tempEvent.tangentialPressure&&(tempEvent.tangentialPressure=0),tempEvent.isNormalized=!0,normalizedEvents.push(tempEvent)}return normalizedEvents},InteractionManager.prototype.destroy=function(){this.removeEvents(),this.removeTickerListener(),this.removeAllListeners(),this.renderer=null,this.mouse=null,this.eventData=null,this.interactionDOMElement=null,this.onPointerDown=null,this.processPointerDown=null,this.onPointerUp=null,this.processPointerUp=null,this.onPointerCancel=null,this.processPointerCancel=null,this.onPointerMove=null,this.processPointerMove=null,this.onPointerOut=null,this.processPointerOverOut=null,this.onPointerOver=null,this.search=null},InteractionManager}(eventemitter3),Runner=function(){function Runner(name){this.items=[],this._name=name,this._aliasCount=0}return Runner.prototype.emit=function(a0,a1,a2,a3,a4,a5,a6,a7){if(arguments.length>8)throw new Error("max arguments reached");var _a=this,name=_a.name,items=_a.items;this._aliasCount++;for(var i=0,len=items.length;i<len;i++)items[i][name](a0,a1,a2,a3,a4,a5,a6,a7);return items===this.items&&this._aliasCount--,this},Runner.prototype.ensureNonAliasedItems=function(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},Runner.prototype.add=function(item){return item[this._name]&&(this.ensureNonAliasedItems(),this.remove(item),this.items.push(item)),this},Runner.prototype.remove=function(item){var index=this.items.indexOf(item);return-1!==index&&(this.ensureNonAliasedItems(),this.items.splice(index,1)),this},Runner.prototype.contains=function(item){return-1!==this.items.indexOf(item)},Runner.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},Runner.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(Runner.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(Runner.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Runner}();Object.defineProperties(Runner.prototype,{dispatch:{value:Runner.prototype.emit},run:{value:Runner.prototype.emit}}),
|
|
81
82
|
/*!
|
|
82
|
-
* @pixi/core -
|
|
83
|
-
* Compiled
|
|
83
|
+
* @pixi/core - v6.4.2
|
|
84
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
84
85
|
*
|
|
85
86
|
* @pixi/core is licensed under the MIT License.
|
|
86
87
|
* http://www.opensource.org/licenses/mit-license
|
|
87
88
|
*/
|
|
88
|
-
settings.PREFER_ENV=isMobile$1.any?ENV.WEBGL:ENV.WEBGL2,settings.STRICT_TEXTURE_CACHE=!1;var INSTALLED=[];function autoDetectResource(source,options){if(!source)return null;var extension="";if("string"==typeof source){var result=/\.(\w{3,4})(?:$|\?|#)/i.exec(source);result&&(extension=result[1].toLowerCase())}for(var i=INSTALLED.length-1;i>=0;--i){var ResourcePlugin=INSTALLED[i];if(ResourcePlugin.test&&ResourcePlugin.test(source,extension))return new ResourcePlugin(source,options)}throw new Error("Unrecognized source type to auto-detect Resource")}
|
|
89
|
+
settings.PREFER_ENV=isMobile$1.any?ENV$1.WEBGL:ENV$1.WEBGL2,settings.STRICT_TEXTURE_CACHE=!1;var INSTALLED=[];function autoDetectResource(source,options){if(!source)return null;var extension="";if("string"==typeof source){var result=/\.(\w{3,4})(?:$|\?|#)/i.exec(source);result&&(extension=result[1].toLowerCase())}for(var i=INSTALLED.length-1;i>=0;--i){var ResourcePlugin=INSTALLED[i];if(ResourcePlugin.test&&ResourcePlugin.test(source,extension))return new ResourcePlugin(source,options)}throw new Error("Unrecognized source type to auto-detect Resource")}
|
|
89
90
|
/*! *****************************************************************************
|
|
90
91
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
91
92
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -99,53 +100,38 @@ settings.PREFER_ENV=isMobile$1.any?ENV.WEBGL:ENV.WEBGL2,settings.STRICT_TEXTURE_
|
|
|
99
100
|
|
|
100
101
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
101
102
|
and limitations under the License.
|
|
102
|
-
***************************************************************************** */var extendStatics$3=function(d,b){return(extendStatics$3=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};function __extends$3(d,b){function __(){this.constructor=d}extendStatics$3(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var Resource=function(){function Resource(width,height){void 0===width&&(width=0),void 0===height&&(height=0),this._width=width,this._height=height,this.destroyed=!1,this.internal=!1,this.onResize=new Runner("setRealSize"),this.onUpdate=new Runner("update"),this.onError=new Runner("onError")}return Resource.prototype.bind=function(baseTexture){this.onResize.add(baseTexture),this.onUpdate.add(baseTexture),this.onError.add(baseTexture),(this._width||this._height)&&this.onResize.emit(this._width,this._height)},Resource.prototype.unbind=function(baseTexture){this.onResize.remove(baseTexture),this.onUpdate.remove(baseTexture),this.onError.remove(baseTexture)},Resource.prototype.resize=function(width,height){width===this._width&&height===this._height||(this._width=width,this._height=height,this.onResize.emit(width,height))},Object.defineProperty(Resource.prototype,"valid",{get:function(){return!!this._width&&!!this._height},enumerable:!1,configurable:!0}),Resource.prototype.update=function(){this.destroyed||this.onUpdate.emit()},Resource.prototype.load=function(){return Promise.resolve(this)},Object.defineProperty(Resource.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(Resource.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),Resource.prototype.style=function(_renderer,_baseTexture,_glTexture){return!1},Resource.prototype.dispose=function(){},Resource.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)},Resource.test=function(_source,_extension){return!1},Resource}(),BufferResource=function(_super){function BufferResource(source,options){var _this=this,_a=options||{},width=_a.width,height=_a.height;if(!width||!height)throw new Error("BufferResource width or height invalid");return(_this=_super.call(this,width,height)||this).data=source,_this}return __extends$3(BufferResource,_super),BufferResource.prototype.upload=function(renderer,baseTexture,glTexture){var gl=renderer.gl;return gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,baseTexture.alphaMode===ALPHA_MODES.UNPACK),glTexture.width===baseTexture.width&&glTexture.height===baseTexture.height?gl.texSubImage2D(baseTexture.target,0,0,0,baseTexture.width,baseTexture.height,baseTexture.format,baseTexture.type,this.data):(glTexture.width=baseTexture.width,glTexture.height=baseTexture.height,gl.texImage2D(baseTexture.target,0,glTexture.internalFormat,baseTexture.width,baseTexture.height,0,baseTexture.format,glTexture.type,this.data)),!0},BufferResource.prototype.dispose=function(){this.data=null},BufferResource.test=function(source){return source instanceof Float32Array||source instanceof Uint8Array||source instanceof Uint32Array},BufferResource}(Resource),defaultBufferOptions={scaleMode:SCALE_MODES.NEAREST,format:FORMATS.RGBA,alphaMode:ALPHA_MODES.NPM},BaseTexture=function(_super){function BaseTexture(resource,options){void 0===resource&&(resource=null),void 0===options&&(options=null);var _this=_super.call(this)||this,alphaMode=(options=options||{}).alphaMode,mipmap=options.mipmap,anisotropicLevel=options.anisotropicLevel,scaleMode=options.scaleMode,width=options.width,height=options.height,wrapMode=options.wrapMode,format=options.format,type=options.type,target=options.target,resolution=options.resolution,resourceOptions=options.resourceOptions;return!resource||resource instanceof Resource||((resource=autoDetectResource(resource,resourceOptions)).internal=!0),_this.width=width||0,_this.height=height||0,_this.resolution=resolution||settings.RESOLUTION,_this.mipmap=void 0!==mipmap?mipmap:settings.MIPMAP_TEXTURES,_this.anisotropicLevel=void 0!==anisotropicLevel?anisotropicLevel:settings.ANISOTROPIC_LEVEL,_this.wrapMode=wrapMode||settings.WRAP_MODE,_this.scaleMode=void 0!==scaleMode?scaleMode:settings.SCALE_MODE,_this.format=format||FORMATS.RGBA,_this.type=type||TYPES.UNSIGNED_BYTE,_this.target=target||TARGETS.TEXTURE_2D,_this.alphaMode=void 0!==alphaMode?alphaMode:ALPHA_MODES.UNPACK,void 0!==options.premultiplyAlpha&&(_this.premultiplyAlpha=options.premultiplyAlpha),_this.uid=uid(),_this.touched=0,_this.isPowerOfTwo=!1,_this._refreshPOT(),_this._glTextures={},_this.dirtyId=0,_this.dirtyStyleId=0,_this.cacheId=null,_this.valid=width>0&&height>0,_this.textureCacheIds=[],_this.destroyed=!1,_this.resource=null,_this._batchEnabled=0,_this._batchLocation=0,_this.parentTextureArray=null,_this.setResource(resource),_this}return __extends$3(BaseTexture,_super),Object.defineProperty(BaseTexture.prototype,"realWidth",{get:function(){return Math.ceil(this.width*this.resolution-1e-4)},enumerable:!1,configurable:!0}),Object.defineProperty(BaseTexture.prototype,"realHeight",{get:function(){return Math.ceil(this.height*this.resolution-1e-4)},enumerable:!1,configurable:!0}),BaseTexture.prototype.setStyle=function(scaleMode,mipmap){var dirty;return void 0!==scaleMode&&scaleMode!==this.scaleMode&&(this.scaleMode=scaleMode,dirty=!0),void 0!==mipmap&&mipmap!==this.mipmap&&(this.mipmap=mipmap,dirty=!0),dirty&&this.dirtyStyleId++,this},BaseTexture.prototype.setSize=function(width,height,resolution){return this.resolution=resolution||this.resolution,this.width=width,this.height=height,this._refreshPOT(),this.update(),this},BaseTexture.prototype.setRealSize=function(realWidth,realHeight,resolution){return this.resolution=resolution||this.resolution,this.width=realWidth/this.resolution,this.height=realHeight/this.resolution,this._refreshPOT(),this.update(),this},BaseTexture.prototype._refreshPOT=function(){this.isPowerOfTwo=isPow2(this.realWidth)&&isPow2(this.realHeight)},BaseTexture.prototype.setResolution=function(resolution){var oldResolution=this.resolution;return oldResolution===resolution||(this.resolution=resolution,this.valid&&(this.width=this.width*oldResolution/resolution,this.height=this.height*oldResolution/resolution,this.emit("update",this)),this._refreshPOT()),this},BaseTexture.prototype.setResource=function(resource){if(this.resource===resource)return this;if(this.resource)throw new Error("Resource can be set only once");return resource.bind(this),this.resource=resource,this},BaseTexture.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},BaseTexture.prototype.onError=function(event){this.emit("error",this,event)},BaseTexture.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete BaseTextureCache[this.cacheId],delete TextureCache[this.cacheId],this.cacheId=null),this.dispose(),BaseTexture.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},BaseTexture.prototype.dispose=function(){this.emit("dispose",this)},BaseTexture.prototype.castToBaseTexture=function(){return this},BaseTexture.from=function(source,options,strict){void 0===strict&&(strict=settings.STRICT_TEXTURE_CACHE);var isFrame="string"==typeof source,cacheId=null;isFrame?cacheId=source:(source._pixiId||(source._pixiId="pixiid_"+uid()),cacheId=source._pixiId);var baseTexture=BaseTextureCache[cacheId];if(isFrame&&strict&&!baseTexture)throw new Error('The cacheId "'+cacheId+'" does not exist in BaseTextureCache.');return baseTexture||((baseTexture=new BaseTexture(source,options)).cacheId=cacheId,BaseTexture.addToCache(baseTexture,cacheId)),baseTexture},BaseTexture.fromBuffer=function(buffer,width,height,options){buffer=buffer||new Float32Array(width*height*4);var resource=new BufferResource(buffer,{width:width,height:height}),type=buffer instanceof Float32Array?TYPES.FLOAT:TYPES.UNSIGNED_BYTE;return new BaseTexture(resource,Object.assign(defaultBufferOptions,options||{width:width,height:height,type:type}))},BaseTexture.addToCache=function(baseTexture,id){id&&(-1===baseTexture.textureCacheIds.indexOf(id)&&baseTexture.textureCacheIds.push(id),BaseTextureCache[id]&&console.warn("BaseTexture added to the cache with an id ["+id+"] that already had an entry"),BaseTextureCache[id]=baseTexture)},BaseTexture.removeFromCache=function(baseTexture){if("string"==typeof baseTexture){var baseTextureFromCache=BaseTextureCache[baseTexture];if(baseTextureFromCache){var index=baseTextureFromCache.textureCacheIds.indexOf(baseTexture);return index>-1&&baseTextureFromCache.textureCacheIds.splice(index,1),delete BaseTextureCache[baseTexture],baseTextureFromCache}}else if(baseTexture&&baseTexture.textureCacheIds){for(var i=0;i<baseTexture.textureCacheIds.length;++i)delete BaseTextureCache[baseTexture.textureCacheIds[i]];return baseTexture.textureCacheIds.length=0,baseTexture}return null},BaseTexture._globalBatch=0,BaseTexture}(eventemitter3),AbstractMultiResource=function(_super){function AbstractMultiResource(length,options){var _this=this,_a=options||{},width=_a.width,height=_a.height;(_this=_super.call(this,width,height)||this).items=[],_this.itemDirtyIds=[];for(var i=0;i<length;i++){var partTexture=new BaseTexture;_this.items.push(partTexture),_this.itemDirtyIds.push(-2)}return _this.length=length,_this._load=null,_this.baseTexture=null,_this}return __extends$3(AbstractMultiResource,_super),AbstractMultiResource.prototype.initFromArray=function(resources,options){for(var i=0;i<this.length;i++)resources[i]&&(resources[i].castToBaseTexture?this.addBaseTextureAt(resources[i].castToBaseTexture(),i):resources[i]instanceof Resource?this.addResourceAt(resources[i],i):this.addResourceAt(autoDetectResource(resources[i],options),i))},AbstractMultiResource.prototype.dispose=function(){for(var i=0,len=this.length;i<len;i++)this.items[i].destroy();this.items=null,this.itemDirtyIds=null,this._load=null},AbstractMultiResource.prototype.addResourceAt=function(resource,index){if(!this.items[index])throw new Error("Index "+index+" is out of bounds");return resource.valid&&!this.valid&&this.resize(resource.width,resource.height),this.items[index].setResource(resource),this},AbstractMultiResource.prototype.bind=function(baseTexture){if(null!==this.baseTexture)throw new Error("Only one base texture per TextureArray is allowed");_super.prototype.bind.call(this,baseTexture);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=baseTexture,this.items[i].on("update",baseTexture.update,baseTexture)},AbstractMultiResource.prototype.unbind=function(baseTexture){_super.prototype.unbind.call(this,baseTexture);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=null,this.items[i].off("update",baseTexture.update,baseTexture)},AbstractMultiResource.prototype.load=function(){var _this=this;if(this._load)return this._load;var promises=this.items.map((function(item){return item.resource})).filter((function(item){return item})).map((function(item){return item.load()}));return this._load=Promise.all(promises).then((function(){var _a=_this.items[0],realWidth=_a.realWidth,realHeight=_a.realHeight;return _this.resize(realWidth,realHeight),Promise.resolve(_this)})),this._load},AbstractMultiResource}(Resource),ArrayResource=function(_super){function ArrayResource(source,options){var urls,length,_this=this,_a=options||{},width=_a.width,height=_a.height;return Array.isArray(source)?(urls=source,length=source.length):length=source,_this=_super.call(this,length,{width:width,height:height})||this,urls&&_this.initFromArray(urls,options),_this}return __extends$3(ArrayResource,_super),ArrayResource.prototype.addBaseTextureAt=function(baseTexture,index){if(!baseTexture.resource)throw new Error("ArrayResource does not support RenderTexture");return this.addResourceAt(baseTexture.resource,index),this},ArrayResource.prototype.bind=function(baseTexture){_super.prototype.bind.call(this,baseTexture),baseTexture.target=TARGETS.TEXTURE_2D_ARRAY},ArrayResource.prototype.upload=function(renderer,texture,glTexture){var length=this.length,itemDirtyIds=this.itemDirtyIds,items=this.items,gl=renderer.gl;glTexture.dirtyId<0&&gl.texImage3D(gl.TEXTURE_2D_ARRAY,0,texture.format,this._width,this._height,length,0,texture.format,texture.type,null);for(var i=0;i<length;i++){var item=items[i];itemDirtyIds[i]<item.dirtyId&&(itemDirtyIds[i]=item.dirtyId,item.valid&&gl.texSubImage3D(gl.TEXTURE_2D_ARRAY,0,0,0,i,item.resource.width,item.resource.height,1,texture.format,texture.type,item.resource.source))}return!0},ArrayResource}(AbstractMultiResource),BaseImageResource=function(_super){function BaseImageResource(source){var _this=this,sourceAny=source,width=sourceAny.naturalWidth||sourceAny.videoWidth||sourceAny.width,height=sourceAny.naturalHeight||sourceAny.videoHeight||sourceAny.height;return(_this=_super.call(this,width,height)||this).source=source,_this.noSubImage=!1,_this}return __extends$3(BaseImageResource,_super),BaseImageResource.crossOrigin=function(element,url,crossorigin){void 0===crossorigin&&0!==url.indexOf("data:")?element.crossOrigin=determineCrossOrigin(url):!1!==crossorigin&&(element.crossOrigin="string"==typeof crossorigin?crossorigin:"anonymous")},BaseImageResource.prototype.upload=function(renderer,baseTexture,glTexture,source){var gl=renderer.gl,width=baseTexture.realWidth,height=baseTexture.realHeight;return source=source||this.source,gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,baseTexture.alphaMode===ALPHA_MODES.UNPACK),this.noSubImage||baseTexture.target!==gl.TEXTURE_2D||glTexture.width!==width||glTexture.height!==height?(glTexture.width=width,glTexture.height=height,gl.texImage2D(baseTexture.target,0,baseTexture.format,baseTexture.format,baseTexture.type,source)):gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,baseTexture.format,baseTexture.type,source),!0},BaseImageResource.prototype.update=function(){if(!this.destroyed){var source=this.source,width=source.naturalWidth||source.videoWidth||source.width,height=source.naturalHeight||source.videoHeight||source.height;this.resize(width,height),_super.prototype.update.call(this)}},BaseImageResource.prototype.dispose=function(){this.source=null},BaseImageResource}(Resource),CanvasResource=function(_super){function CanvasResource(){return null!==_super&&_super.apply(this,arguments)||this}return __extends$3(CanvasResource,_super),CanvasResource.test=function(source){var OffscreenCanvas=window.OffscreenCanvas;return!!(OffscreenCanvas&&source instanceof OffscreenCanvas)||source instanceof HTMLCanvasElement},CanvasResource}(BaseImageResource),CubeResource=function(_super){function CubeResource(source,options){var _this=this,_a=options||{},width=_a.width,height=_a.height,autoLoad=_a.autoLoad,linkBaseTexture=_a.linkBaseTexture;if(source&&source.length!==CubeResource.SIDES)throw new Error("Invalid length. Got "+source.length+", expected 6");_this=_super.call(this,6,{width:width,height:height})||this;for(var i=0;i<CubeResource.SIDES;i++)_this.items[i].target=TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X+i;return _this.linkBaseTexture=!1!==linkBaseTexture,source&&_this.initFromArray(source,options),!1!==autoLoad&&_this.load(),_this}return __extends$3(CubeResource,_super),CubeResource.prototype.bind=function(baseTexture){_super.prototype.bind.call(this,baseTexture),baseTexture.target=TARGETS.TEXTURE_CUBE_MAP},CubeResource.prototype.addBaseTextureAt=function(baseTexture,index,linkBaseTexture){if(void 0===linkBaseTexture&&(linkBaseTexture=this.linkBaseTexture),!this.items[index])throw new Error("Index "+index+" is out of bounds");if(!this.linkBaseTexture||baseTexture.parentTextureArray||Object.keys(baseTexture._glTextures).length>0){if(!baseTexture.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(baseTexture.resource,index)}else baseTexture.target=TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X+index,baseTexture.parentTextureArray=this.baseTexture,this.items[index]=baseTexture;return baseTexture.valid&&!this.valid&&this.resize(baseTexture.realWidth,baseTexture.realHeight),this.items[index]=baseTexture,this},CubeResource.prototype.upload=function(renderer,_baseTexture,glTexture){for(var dirty=this.itemDirtyIds,i=0;i<CubeResource.SIDES;i++){var side=this.items[i];dirty[i]<side.dirtyId&&(side.valid&&side.resource?(side.resource.upload(renderer,side,glTexture),dirty[i]=side.dirtyId):dirty[i]<-1&&(renderer.gl.texImage2D(side.target,0,glTexture.internalFormat,_baseTexture.realWidth,_baseTexture.realHeight,0,_baseTexture.format,glTexture.type,null),dirty[i]=-1))}return!0},CubeResource.test=function(source){return Array.isArray(source)&&source.length===CubeResource.SIDES},CubeResource.SIDES=6,CubeResource}(AbstractMultiResource),ImageResource=function(_super){function ImageResource(source,options){var _this=this;if(options=options||{},!(source instanceof HTMLImageElement)){var imageElement=new Image;BaseImageResource.crossOrigin(imageElement,source,options.crossorigin),imageElement.src=source,source=imageElement}return _this=_super.call(this,source)||this,!source.complete&&_this._width&&_this._height&&(_this._width=0,_this._height=0),_this.url=source.src,_this._process=null,_this.preserveBitmap=!1,_this.createBitmap=(void 0!==options.createBitmap?options.createBitmap:settings.CREATE_IMAGE_BITMAP)&&!!window.createImageBitmap,_this.alphaMode="number"==typeof options.alphaMode?options.alphaMode:null,void 0!==options.premultiplyAlpha&&(_this.premultiplyAlpha=options.premultiplyAlpha),_this.bitmap=null,_this._load=null,!1!==options.autoLoad&&_this.load(),_this}return __extends$3(ImageResource,_super),ImageResource.prototype.load=function(createBitmap){var _this=this;return this._load||(void 0!==createBitmap&&(this.createBitmap=createBitmap),this._load=new Promise((function(resolve,reject){var source=_this.source;_this.url=source.src;var completed=function(){_this.destroyed||(source.onload=null,source.onerror=null,_this.resize(source.width,source.height),_this._load=null,_this.createBitmap?resolve(_this.process()):resolve(_this))};source.complete&&source.src?completed():(source.onload=completed,source.onerror=function(event){reject(event),_this.onError.emit(event)})}))),this._load},ImageResource.prototype.process=function(){var _this=this,source=this.source;return null!==this._process?this._process:null===this.bitmap&&window.createImageBitmap?(this._process=window.createImageBitmap(source,0,0,source.width,source.height,{premultiplyAlpha:this.alphaMode===ALPHA_MODES.UNPACK?"premultiply":"none"}).then((function(bitmap){return _this.destroyed?Promise.reject():(_this.bitmap=bitmap,_this.update(),_this._process=null,Promise.resolve(_this))})),this._process):Promise.resolve(this)},ImageResource.prototype.upload=function(renderer,baseTexture,glTexture){if("number"==typeof this.alphaMode&&(baseTexture.alphaMode=this.alphaMode),!this.createBitmap)return _super.prototype.upload.call(this,renderer,baseTexture,glTexture);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(_super.prototype.upload.call(this,renderer,baseTexture,glTexture,this.bitmap),!this.preserveBitmap){var flag=!0,glTextures=baseTexture._glTextures;for(var key in glTextures){var otherTex=glTextures[key];if(otherTex!==glTexture&&otherTex.dirtyId!==baseTexture.dirtyId){flag=!1;break}}flag&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0},ImageResource.prototype.dispose=function(){this.source.onload=null,this.source.onerror=null,_super.prototype.dispose.call(this),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null},ImageResource.test=function(source){return"string"==typeof source||source instanceof HTMLImageElement},ImageResource}(BaseImageResource),SVGResource=function(_super){function SVGResource(sourceBase64,options){var _this=this;return options=options||{},(_this=_super.call(this,document.createElement("canvas"))||this)._width=0,_this._height=0,_this.svg=sourceBase64,_this.scale=options.scale||1,_this._overrideWidth=options.width,_this._overrideHeight=options.height,_this._resolve=null,_this._crossorigin=options.crossorigin,_this._load=null,!1!==options.autoLoad&&_this.load(),_this}return __extends$3(SVGResource,_super),SVGResource.prototype.load=function(){var _this=this;return this._load||(this._load=new Promise((function(resolve){if(_this._resolve=function(){_this.resize(_this.source.width,_this.source.height),resolve(_this)},/^\<svg/.test(_this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");_this.svg="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(_this.svg)))}_this._loadSvg()}))),this._load},SVGResource.prototype._loadSvg=function(){var _this=this,tempImage=new Image;BaseImageResource.crossOrigin(tempImage,this.svg,this._crossorigin),tempImage.src=this.svg,tempImage.onerror=function(event){_this._resolve&&(tempImage.onerror=null,_this.onError.emit(event))},tempImage.onload=function(){if(_this._resolve){var svgWidth=tempImage.width,svgHeight=tempImage.height;if(!svgWidth||!svgHeight)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");var width=svgWidth*_this.scale,height=svgHeight*_this.scale;(_this._overrideWidth||_this._overrideHeight)&&(width=_this._overrideWidth||_this._overrideHeight/svgHeight*svgWidth,height=_this._overrideHeight||_this._overrideWidth/svgWidth*svgHeight),width=Math.round(width),height=Math.round(height);var canvas=_this.source;canvas.width=width,canvas.height=height,canvas._pixiId="canvas_"+uid(),canvas.getContext("2d").drawImage(tempImage,0,0,svgWidth,svgHeight,0,0,width,height),_this._resolve(),_this._resolve=null}}},SVGResource.getSize=function(svgString){var sizeMatch=SVGResource.SVG_SIZE.exec(svgString),size={};return sizeMatch&&(size[sizeMatch[1]]=Math.round(parseFloat(sizeMatch[3])),size[sizeMatch[5]]=Math.round(parseFloat(sizeMatch[7]))),size},SVGResource.prototype.dispose=function(){_super.prototype.dispose.call(this),this._resolve=null,this._crossorigin=null},SVGResource.test=function(source,extension){return"svg"===extension||"string"==typeof source&&/^data:image\/svg\+xml(;(charset=utf8|utf8))?;base64/.test(source)||"string"==typeof source&&0===source.indexOf("<svg")},SVGResource.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,SVGResource}(BaseImageResource),VideoResource=function(_super){function VideoResource(source,options){var _this=this;if(options=options||{},!(source instanceof HTMLVideoElement)){var videoElement=document.createElement("video");videoElement.setAttribute("preload","auto"),videoElement.setAttribute("webkit-playsinline",""),videoElement.setAttribute("playsinline",""),"string"==typeof source&&(source=[source]);var firstSrc=source[0].src||source[0];BaseImageResource.crossOrigin(videoElement,firstSrc,options.crossorigin);for(var i=0;i<source.length;++i){var sourceElement=document.createElement("source"),_a=source[i],src=_a.src,mime=_a.mime,baseSrc=(src=src||source[i]).split("?").shift().toLowerCase(),ext=baseSrc.substr(baseSrc.lastIndexOf(".")+1);mime=mime||VideoResource.MIME_TYPES[ext]||"video/"+ext,sourceElement.src=src,sourceElement.type=mime,videoElement.appendChild(sourceElement)}source=videoElement}return(_this=_super.call(this,source)||this).noSubImage=!0,_this._autoUpdate=!0,_this._isConnectedToTicker=!1,_this._updateFPS=options.updateFPS||0,_this._msToNextUpdate=0,_this.autoPlay=!1!==options.autoPlay,_this._load=null,_this._resolve=null,_this._onCanPlay=_this._onCanPlay.bind(_this),_this._onError=_this._onError.bind(_this),!1!==options.autoLoad&&_this.load(),_this}return __extends$3(VideoResource,_super),VideoResource.prototype.update=function(_deltaTime){if(!this.destroyed){var elapsedMS=Ticker.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-elapsedMS),(!this._updateFPS||this._msToNextUpdate<=0)&&(_super.prototype.update.call(this),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}},VideoResource.prototype.load=function(){var _this=this;if(this._load)return this._load;var source=this.source;return(source.readyState===source.HAVE_ENOUGH_DATA||source.readyState===source.HAVE_FUTURE_DATA)&&source.width&&source.height&&(source.complete=!0),source.addEventListener("play",this._onPlayStart.bind(this)),source.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(source.addEventListener("canplay",this._onCanPlay),source.addEventListener("canplaythrough",this._onCanPlay),source.addEventListener("error",this._onError,!0)),this._load=new Promise((function(resolve){_this.valid?resolve(_this):(_this._resolve=resolve,source.load())})),this._load},VideoResource.prototype._onError=function(event){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(event)},VideoResource.prototype._isSourcePlaying=function(){var source=this.source;return source.currentTime>0&&!1===source.paused&&!1===source.ended&&source.readyState>2},VideoResource.prototype._isSourceReady=function(){var source=this.source;return 3===source.readyState||4===source.readyState},VideoResource.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(Ticker.shared.add(this.update,this),this._isConnectedToTicker=!0)},VideoResource.prototype._onPlayStop=function(){this._isConnectedToTicker&&(Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1)},VideoResource.prototype._onCanPlay=function(){var source=this.source;source.removeEventListener("canplay",this._onCanPlay),source.removeEventListener("canplaythrough",this._onCanPlay);var valid=this.valid;this.resize(source.videoWidth,source.videoHeight),!valid&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&source.play()},VideoResource.prototype.dispose=function(){this._isConnectedToTicker&&Ticker.shared.remove(this.update,this);var source=this.source;source&&(source.removeEventListener("error",this._onError,!0),source.pause(),source.src="",source.load()),_super.prototype.dispose.call(this)},Object.defineProperty(VideoResource.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(value){value!==this._autoUpdate&&(this._autoUpdate=value,!this._autoUpdate&&this._isConnectedToTicker?(Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(Ticker.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(VideoResource.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(value){value!==this._updateFPS&&(this._updateFPS=value)},enumerable:!1,configurable:!0}),VideoResource.test=function(source,extension){return source instanceof HTMLVideoElement||VideoResource.TYPES.indexOf(extension)>-1},VideoResource.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],VideoResource.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},VideoResource}(BaseImageResource),ImageBitmapResource=function(_super){function ImageBitmapResource(){return null!==_super&&_super.apply(this,arguments)||this}return __extends$3(ImageBitmapResource,_super),ImageBitmapResource.test=function(source){return!!window.createImageBitmap&&source instanceof ImageBitmap},ImageBitmapResource}(BaseImageResource);INSTALLED.push(ImageResource,ImageBitmapResource,CanvasResource,VideoResource,SVGResource,BufferResource,CubeResource,ArrayResource);var System=function(){function System(renderer){this.renderer=renderer}return System.prototype.destroy=function(){this.renderer=null},System}(),DepthResource=function(_super){function DepthResource(){return null!==_super&&_super.apply(this,arguments)||this}return __extends$3(DepthResource,_super),DepthResource.prototype.upload=function(renderer,baseTexture,glTexture){var gl=renderer.gl;return gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,baseTexture.alphaMode===ALPHA_MODES.UNPACK),glTexture.width===baseTexture.width&&glTexture.height===baseTexture.height?gl.texSubImage2D(baseTexture.target,0,0,0,baseTexture.width,baseTexture.height,baseTexture.format,baseTexture.type,this.data):(glTexture.width=baseTexture.width,glTexture.height=baseTexture.height,gl.texImage2D(baseTexture.target,0,1===renderer.context.webGLVersion?gl.DEPTH_COMPONENT:gl.DEPTH_COMPONENT16,baseTexture.width,baseTexture.height,0,baseTexture.format,baseTexture.type,this.data)),!0},DepthResource}(BufferResource),Framebuffer=function(){function Framebuffer(width,height){this.width=Math.ceil(width||100),this.height=Math.ceil(height||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Runner("disposeFramebuffer"),this.multisample=MSAA_QUALITY.NONE}return Object.defineProperty(Framebuffer.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),Framebuffer.prototype.addColorTexture=function(index,texture){return void 0===index&&(index=0),this.colorTextures[index]=texture||new BaseTexture(null,{scaleMode:SCALE_MODES.NEAREST,resolution:1,mipmap:MIPMAP_MODES.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},Framebuffer.prototype.addDepthTexture=function(texture){return this.depthTexture=texture||new BaseTexture(new DepthResource(null,{width:this.width,height:this.height}),{scaleMode:SCALE_MODES.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:MIPMAP_MODES.OFF,format:FORMATS.DEPTH_COMPONENT,type:TYPES.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},Framebuffer.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},Framebuffer.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},Framebuffer.prototype.resize=function(width,height){if(width=Math.ceil(width),height=Math.ceil(height),width!==this.width||height!==this.height){this.width=width,this.height=height,this.dirtyId++,this.dirtySize++;for(var i=0;i<this.colorTextures.length;i++){var texture=this.colorTextures[i],resolution=texture.resolution;texture.setSize(width/resolution,height/resolution)}if(this.depthTexture){resolution=this.depthTexture.resolution;this.depthTexture.setSize(width/resolution,height/resolution)}}},Framebuffer.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},Framebuffer.prototype.destroyDepthTexture=function(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)},Framebuffer}(),BaseRenderTexture=function(_super){function BaseRenderTexture(options){var _this=this;if("number"==typeof options){var width_1=arguments[0],height_1=arguments[1],scaleMode=arguments[2],resolution=arguments[3];options={width:width_1,height:height_1,scaleMode:scaleMode,resolution:resolution}}_this=_super.call(this,null,options)||this;var _a=options||{},width=_a.width,height=_a.height;return _this.mipmap=0,_this.width=Math.ceil(width)||100,_this.height=Math.ceil(height)||100,_this.valid=!0,_this.clearColor=[0,0,0,0],_this.framebuffer=new Framebuffer(_this.width*_this.resolution,_this.height*_this.resolution).addColorTexture(0,_this),_this.maskStack=[],_this.filterStack=[{}],_this}return __extends$3(BaseRenderTexture,_super),BaseRenderTexture.prototype.resize=function(width,height){width=Math.ceil(width),height=Math.ceil(height),this.framebuffer.resize(width*this.resolution,height*this.resolution)},BaseRenderTexture.prototype.dispose=function(){this.framebuffer.dispose(),_super.prototype.dispose.call(this)},BaseRenderTexture.prototype.destroy=function(){_super.prototype.destroy.call(this),this.framebuffer.destroyDepthTexture(),this.framebuffer=null},BaseRenderTexture}(BaseTexture),TextureUvs=function(){function TextureUvs(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}return TextureUvs.prototype.set=function(frame,baseFrame,rotate){var tw=baseFrame.width,th=baseFrame.height;if(rotate){var w2=frame.width/2/tw,h2=frame.height/2/th,cX=frame.x/tw+w2,cY=frame.y/th+h2;rotate=groupD8.add(rotate,groupD8.NW),this.x0=cX+w2*groupD8.uX(rotate),this.y0=cY+h2*groupD8.uY(rotate),rotate=groupD8.add(rotate,2),this.x1=cX+w2*groupD8.uX(rotate),this.y1=cY+h2*groupD8.uY(rotate),rotate=groupD8.add(rotate,2),this.x2=cX+w2*groupD8.uX(rotate),this.y2=cY+h2*groupD8.uY(rotate),rotate=groupD8.add(rotate,2),this.x3=cX+w2*groupD8.uX(rotate),this.y3=cY+h2*groupD8.uY(rotate)}else this.x0=frame.x/tw,this.y0=frame.y/th,this.x1=(frame.x+frame.width)/tw,this.y1=frame.y/th,this.x2=(frame.x+frame.width)/tw,this.y2=(frame.y+frame.height)/th,this.x3=frame.x/tw,this.y3=(frame.y+frame.height)/th;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3},TextureUvs}(),DEFAULT_UVS=new TextureUvs,Texture=function(_super){function Texture(baseTexture,frame,orig,trim,rotate,anchor){var _this=_super.call(this)||this;if(_this.noFrame=!1,frame||(_this.noFrame=!0,frame=new Rectangle(0,0,1,1)),baseTexture instanceof Texture&&(baseTexture=baseTexture.baseTexture),_this.baseTexture=baseTexture,_this._frame=frame,_this.trim=trim,_this.valid=!1,_this._uvs=DEFAULT_UVS,_this.uvMatrix=null,_this.orig=orig||frame,_this._rotate=Number(rotate||0),!0===rotate)_this._rotate=2;else if(_this._rotate%2!=0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");return _this.defaultAnchor=anchor?new Point(anchor.x,anchor.y):new Point(0,0),_this._updateID=0,_this.textureCacheIds=[],baseTexture.valid?_this.noFrame?baseTexture.valid&&_this.onBaseTextureUpdated(baseTexture):_this.frame=frame:baseTexture.once("loaded",_this.onBaseTextureUpdated,_this),_this.noFrame&&baseTexture.on("update",_this.onBaseTextureUpdated,_this),_this}return __extends$3(Texture,_super),Texture.prototype.update=function(){this.baseTexture.resource&&this.baseTexture.resource.update()},Texture.prototype.onBaseTextureUpdated=function(baseTexture){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=baseTexture.width,this._frame.height=baseTexture.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)},Texture.prototype.destroy=function(destroyBase){if(this.baseTexture){if(destroyBase){var resource=this.baseTexture;resource&&resource.url&&TextureCache[resource.url]&&Texture.removeFromCache(resource.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,Texture.removeFromCache(this),this.textureCacheIds=null},Texture.prototype.clone=function(){return new Texture(this.baseTexture,this.frame.clone(),this.orig.clone(),this.trim&&this.trim.clone(),this.rotate,this.defaultAnchor)},Texture.prototype.updateUvs=function(){this._uvs===DEFAULT_UVS&&(this._uvs=new TextureUvs),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++},Texture.from=function(source,options,strict){void 0===options&&(options={}),void 0===strict&&(strict=settings.STRICT_TEXTURE_CACHE);var isFrame="string"==typeof source,cacheId=null;isFrame?cacheId=source:(source._pixiId||(source._pixiId="pixiid_"+uid()),cacheId=source._pixiId);var texture=TextureCache[cacheId];if(isFrame&&strict&&!texture)throw new Error('The cacheId "'+cacheId+'" does not exist in TextureCache.');return texture||(options.resolution||(options.resolution=getResolutionOfUrl(source)),(texture=new Texture(new BaseTexture(source,options))).baseTexture.cacheId=cacheId,BaseTexture.addToCache(texture.baseTexture,cacheId),Texture.addToCache(texture,cacheId)),texture},Texture.fromURL=function(url,options){var resourceOptions=Object.assign({autoLoad:!1},null==options?void 0:options.resourceOptions),texture=Texture.from(url,Object.assign({resourceOptions:resourceOptions},options),!1),resource=texture.baseTexture.resource;return texture.baseTexture.valid?Promise.resolve(texture):resource.load().then((function(){return Promise.resolve(texture)}))},Texture.fromBuffer=function(buffer,width,height,options){return new Texture(BaseTexture.fromBuffer(buffer,width,height,options))},Texture.fromLoader=function(source,imageUrl,name){var resource=new ImageResource(source);resource.url=imageUrl;var texture=new Texture(new BaseTexture(resource,{scaleMode:settings.SCALE_MODE,resolution:getResolutionOfUrl(imageUrl)}));return name||(name=imageUrl),BaseTexture.addToCache(texture.baseTexture,name),Texture.addToCache(texture,name),name!==imageUrl&&(BaseTexture.addToCache(texture.baseTexture,imageUrl),Texture.addToCache(texture,imageUrl)),texture},Texture.addToCache=function(texture,id){id&&(-1===texture.textureCacheIds.indexOf(id)&&texture.textureCacheIds.push(id),TextureCache[id]&&console.warn("Texture added to the cache with an id ["+id+"] that already had an entry"),TextureCache[id]=texture)},Texture.removeFromCache=function(texture){if("string"==typeof texture){var textureFromCache=TextureCache[texture];if(textureFromCache){var index=textureFromCache.textureCacheIds.indexOf(texture);return index>-1&&textureFromCache.textureCacheIds.splice(index,1),delete TextureCache[texture],textureFromCache}}else if(texture&&texture.textureCacheIds){for(var i=0;i<texture.textureCacheIds.length;++i)TextureCache[texture.textureCacheIds[i]]===texture&&delete TextureCache[texture.textureCacheIds[i]];return texture.textureCacheIds.length=0,texture}return null},Object.defineProperty(Texture.prototype,"resolution",{get:function(){return this.baseTexture.resolution},enumerable:!1,configurable:!0}),Object.defineProperty(Texture.prototype,"frame",{get:function(){return this._frame},set:function(frame){this._frame=frame,this.noFrame=!1;var x=frame.x,y=frame.y,width=frame.width,height=frame.height,xNotFit=x+width>this.baseTexture.width,yNotFit=y+height>this.baseTexture.height;if(xNotFit||yNotFit){var relationship=xNotFit&&yNotFit?"and":"or",errorX="X: "+x+" + "+width+" = "+(x+width)+" > "+this.baseTexture.width,errorY="Y: "+y+" + "+height+" = "+(y+height)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+errorX+" "+relationship+" "+errorY)}this.valid=width&&height&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=frame),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(Texture.prototype,"rotate",{get:function(){return this._rotate},set:function(rotate){this._rotate=rotate,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(Texture.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(Texture.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),Texture.prototype.castToBaseTexture=function(){return this.baseTexture},Texture}(eventemitter3);function removeAllHandlers(tex){tex.destroy=function(){},tex.on=function(){},tex.once=function(){},tex.emit=function(){}}Texture.EMPTY=new Texture(new BaseTexture),removeAllHandlers(Texture.EMPTY),removeAllHandlers(Texture.EMPTY.baseTexture),Texture.WHITE=function(){var canvas=document.createElement("canvas");canvas.width=16,canvas.height=16;var context=canvas.getContext("2d");return context.fillStyle="white",context.fillRect(0,0,16,16),new Texture(new BaseTexture(new CanvasResource(canvas)))}(),removeAllHandlers(Texture.WHITE),removeAllHandlers(Texture.WHITE.baseTexture);var RenderTexture=function(_super){function RenderTexture(baseRenderTexture,frame){var _this=this,_legacyRenderer=null;if(!(baseRenderTexture instanceof BaseRenderTexture)){var width=arguments[1],height=arguments[2],scaleMode=arguments[3],resolution=arguments[4];console.warn("Please use RenderTexture.create("+width+", "+height+") instead of the ctor directly."),_legacyRenderer=arguments[0],frame=null,baseRenderTexture=new BaseRenderTexture({width:width,height:height,scaleMode:scaleMode,resolution:resolution})}return(_this=_super.call(this,baseRenderTexture,frame)||this).legacyRenderer=_legacyRenderer,_this.valid=!0,_this.filterFrame=null,_this.filterPoolKey=null,_this.updateUvs(),_this}return __extends$3(RenderTexture,_super),Object.defineProperty(RenderTexture.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),RenderTexture.prototype.resize=function(width,height,resizeBaseTexture){void 0===resizeBaseTexture&&(resizeBaseTexture=!0),width=Math.ceil(width),height=Math.ceil(height),this.valid=width>0&&height>0,this._frame.width=this.orig.width=width,this._frame.height=this.orig.height=height,resizeBaseTexture&&this.baseTexture.resize(width,height),this.updateUvs()},RenderTexture.prototype.setResolution=function(resolution){var baseTexture=this.baseTexture;baseTexture.resolution!==resolution&&(baseTexture.setResolution(resolution),this.resize(baseTexture.width,baseTexture.height,!1))},RenderTexture.create=function(options){return"number"==typeof options&&(options={width:options,height:arguments[1],scaleMode:arguments[2],resolution:arguments[3]}),new RenderTexture(new BaseRenderTexture(options))},RenderTexture}(Texture),RenderTexturePool=function(){function RenderTexturePool(textureOptions){this.texturePool={},this.textureOptions=textureOptions||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}return RenderTexturePool.prototype.createTexture=function(realWidth,realHeight){var baseRenderTexture=new BaseRenderTexture(Object.assign({width:realWidth,height:realHeight,resolution:1},this.textureOptions));return new RenderTexture(baseRenderTexture)},RenderTexturePool.prototype.getOptimalTexture=function(minWidth,minHeight,resolution){void 0===resolution&&(resolution=1);var key=RenderTexturePool.SCREEN_KEY;minWidth*=resolution,minHeight*=resolution,this.enableFullScreen&&minWidth===this._pixelsWidth&&minHeight===this._pixelsHeight||(key=(65535&(minWidth=nextPow2(minWidth)))<<16|65535&(minHeight=nextPow2(minHeight))),this.texturePool[key]||(this.texturePool[key]=[]);var renderTexture=this.texturePool[key].pop();return renderTexture||(renderTexture=this.createTexture(minWidth,minHeight)),renderTexture.filterPoolKey=key,renderTexture.setResolution(resolution),renderTexture},RenderTexturePool.prototype.getFilterTexture=function(input,resolution){var filterTexture=this.getOptimalTexture(input.width,input.height,resolution||input.resolution);return filterTexture.filterFrame=input.filterFrame,filterTexture},RenderTexturePool.prototype.returnTexture=function(renderTexture){var key=renderTexture.filterPoolKey;renderTexture.filterFrame=null,this.texturePool[key].push(renderTexture)},RenderTexturePool.prototype.returnFilterTexture=function(renderTexture){this.returnTexture(renderTexture)},RenderTexturePool.prototype.clear=function(destroyTextures){if(destroyTextures=!1!==destroyTextures)for(var i in this.texturePool){var textures=this.texturePool[i];if(textures)for(var j=0;j<textures.length;j++)textures[j].destroy(!0)}this.texturePool={}},RenderTexturePool.prototype.setScreenSize=function(size){if(size.width!==this._pixelsWidth||size.height!==this._pixelsHeight){var screenKey=RenderTexturePool.SCREEN_KEY,textures=this.texturePool[screenKey];if(this.enableFullScreen=size.width>0&&size.height>0,textures)for(var j=0;j<textures.length;j++)textures[j].destroy(!0);this.texturePool[screenKey]=[],this._pixelsWidth=size.width,this._pixelsHeight=size.height}},RenderTexturePool.SCREEN_KEY="screen",RenderTexturePool}(),Attribute=function(){function Attribute(buffer,size,normalized,type,stride,start,instance){void 0===size&&(size=0),void 0===normalized&&(normalized=!1),void 0===type&&(type=5126),this.buffer=buffer,this.size=size,this.normalized=normalized,this.type=type,this.stride=stride,this.start=start,this.instance=instance}return Attribute.prototype.destroy=function(){this.buffer=null},Attribute.from=function(buffer,size,normalized,type,stride){return new Attribute(buffer,size,normalized,type,stride)},Attribute}(),UID=0,Buffer=function(){function Buffer(data,_static,index){void 0===_static&&(_static=!0),void 0===index&&(index=!1),this.data=data||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=index,this.static=_static,this.id=UID++,this.disposeRunner=new Runner("disposeBuffer")}return Buffer.prototype.update=function(data){this.data=data||this.data,this._updateID++},Buffer.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},Buffer.prototype.destroy=function(){this.dispose(),this.data=null},Buffer.from=function(data){return data instanceof Array&&(data=new Float32Array(data)),new Buffer(data)},Buffer}();function getBufferType(array){if(4===array.BYTES_PER_ELEMENT)return array instanceof Float32Array?"Float32Array":array instanceof Uint32Array?"Uint32Array":"Int32Array";if(2===array.BYTES_PER_ELEMENT){if(array instanceof Uint16Array)return"Uint16Array"}else if(1===array.BYTES_PER_ELEMENT&&array instanceof Uint8Array)return"Uint8Array";return null}var map={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array};var byteSizeMap={5126:4,5123:2,5121:1},UID$1=0,map$1={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array},Geometry=function(){function Geometry(buffers,attributes){void 0===buffers&&(buffers=[]),void 0===attributes&&(attributes={}),this.buffers=buffers,this.indexBuffer=null,this.attributes=attributes,this.glVertexArrayObjects={},this.id=UID$1++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Runner("disposeGeometry"),this.refCount=0}return Geometry.prototype.addAttribute=function(id,buffer,size,normalized,type,stride,start,instance){if(void 0===size&&(size=0),void 0===normalized&&(normalized=!1),void 0===instance&&(instance=!1),!buffer)throw new Error("You must pass a buffer when creating an attribute");buffer instanceof Buffer||(buffer instanceof Array&&(buffer=new Float32Array(buffer)),buffer=new Buffer(buffer));var ids=id.split("|");if(ids.length>1){for(var i=0;i<ids.length;i++)this.addAttribute(ids[i],buffer,size,normalized,type);return this}var bufferIndex=this.buffers.indexOf(buffer);return-1===bufferIndex&&(this.buffers.push(buffer),bufferIndex=this.buffers.length-1),this.attributes[id]=new Attribute(bufferIndex,size,normalized,type,stride,start,instance),this.instanced=this.instanced||instance,this},Geometry.prototype.getAttribute=function(id){return this.attributes[id]},Geometry.prototype.getBuffer=function(id){return this.buffers[this.getAttribute(id).buffer]},Geometry.prototype.addIndex=function(buffer){return buffer instanceof Buffer||(buffer instanceof Array&&(buffer=new Uint16Array(buffer)),buffer=new Buffer(buffer)),buffer.index=!0,this.indexBuffer=buffer,-1===this.buffers.indexOf(buffer)&&this.buffers.push(buffer),this},Geometry.prototype.getIndex=function(){return this.indexBuffer},Geometry.prototype.interleave=function(){if(1===this.buffers.length||2===this.buffers.length&&this.indexBuffer)return this;var i,arrays=[],sizes=[],interleavedBuffer=new Buffer;for(i in this.attributes){var attribute=this.attributes[i],buffer=this.buffers[attribute.buffer];arrays.push(buffer.data),sizes.push(attribute.size*byteSizeMap[attribute.type]/4),attribute.buffer=0}for(interleavedBuffer.data=function(arrays,sizes){for(var outSize=0,stride=0,views={},i=0;i<arrays.length;i++)stride+=sizes[i],outSize+=arrays[i].length;var buffer=new ArrayBuffer(4*outSize),out=null,littleOffset=0;for(i=0;i<arrays.length;i++){var size=sizes[i],array=arrays[i],type=getBufferType(array);views[type]||(views[type]=new map[type](buffer)),out=views[type];for(var j=0;j<array.length;j++)out[(j/size|0)*stride+littleOffset+j%size]=array[j];littleOffset+=size}return new Float32Array(buffer)}(arrays,sizes),i=0;i<this.buffers.length;i++)this.buffers[i]!==this.indexBuffer&&this.buffers[i].destroy();return this.buffers=[interleavedBuffer],this.indexBuffer&&this.buffers.push(this.indexBuffer),this},Geometry.prototype.getSize=function(){for(var i in this.attributes){var attribute=this.attributes[i];return this.buffers[attribute.buffer].data.length/(attribute.stride/4||attribute.size)}return 0},Geometry.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},Geometry.prototype.destroy=function(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null},Geometry.prototype.clone=function(){for(var geometry=new Geometry,i=0;i<this.buffers.length;i++)geometry.buffers[i]=new Buffer(this.buffers[i].data.slice(0));for(var i in this.attributes){var attrib=this.attributes[i];geometry.attributes[i]=new Attribute(attrib.buffer,attrib.size,attrib.normalized,attrib.type,attrib.stride,attrib.start,attrib.instance)}return this.indexBuffer&&(geometry.indexBuffer=geometry.buffers[this.buffers.indexOf(this.indexBuffer)],geometry.indexBuffer.index=!0),geometry},Geometry.merge=function(geometries){for(var geometry,geometryOut=new Geometry,arrays=[],sizes=[],offsets=[],i=0;i<geometries.length;i++){geometry=geometries[i];for(var j=0;j<geometry.buffers.length;j++)sizes[j]=sizes[j]||0,sizes[j]+=geometry.buffers[j].data.length,offsets[j]=0}for(i=0;i<geometry.buffers.length;i++)arrays[i]=new(map$1[getBufferType(geometry.buffers[i].data)])(sizes[i]),geometryOut.buffers[i]=new Buffer(arrays[i]);for(i=0;i<geometries.length;i++){geometry=geometries[i];for(j=0;j<geometry.buffers.length;j++)arrays[j].set(geometry.buffers[j].data,offsets[j]),offsets[j]+=geometry.buffers[j].data.length}if(geometryOut.attributes=geometry.attributes,geometry.indexBuffer){geometryOut.indexBuffer=geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)],geometryOut.indexBuffer.index=!0;var offset=0,stride=0,offset2=0,bufferIndexToCount=0;for(i=0;i<geometry.buffers.length;i++)if(geometry.buffers[i]!==geometry.indexBuffer){bufferIndexToCount=i;break}for(var i in geometry.attributes){var attribute=geometry.attributes[i];(0|attribute.buffer)===bufferIndexToCount&&(stride+=attribute.size*byteSizeMap[attribute.type]/4)}for(i=0;i<geometries.length;i++){var indexBufferData=geometries[i].indexBuffer.data;for(j=0;j<indexBufferData.length;j++)geometryOut.indexBuffer.data[j+offset2]+=offset;offset+=geometry.buffers[bufferIndexToCount].data.length/stride,offset2+=indexBufferData.length}}return geometryOut},Geometry}(),Quad=function(_super){function Quad(){var _this=_super.call(this)||this;return _this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2]),_this}return __extends$3(Quad,_super),Quad}(Geometry),QuadUv=function(_super){function QuadUv(){var _this=_super.call(this)||this;return _this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),_this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),_this.vertexBuffer=new Buffer(_this.vertices),_this.uvBuffer=new Buffer(_this.uvs),_this.addAttribute("aVertexPosition",_this.vertexBuffer).addAttribute("aTextureCoord",_this.uvBuffer).addIndex([0,1,2,0,2,3]),_this}return __extends$3(QuadUv,_super),QuadUv.prototype.map=function(targetTextureFrame,destinationFrame){var x=0,y=0;return this.uvs[0]=x,this.uvs[1]=y,this.uvs[2]=x+destinationFrame.width/targetTextureFrame.width,this.uvs[3]=y,this.uvs[4]=x+destinationFrame.width/targetTextureFrame.width,this.uvs[5]=y+destinationFrame.height/targetTextureFrame.height,this.uvs[6]=x,this.uvs[7]=y+destinationFrame.height/targetTextureFrame.height,x=destinationFrame.x,y=destinationFrame.y,this.vertices[0]=x,this.vertices[1]=y,this.vertices[2]=x+destinationFrame.width,this.vertices[3]=y,this.vertices[4]=x+destinationFrame.width,this.vertices[5]=y+destinationFrame.height,this.vertices[6]=x,this.vertices[7]=y+destinationFrame.height,this.invalidate(),this},QuadUv.prototype.invalidate=function(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this},QuadUv}(Geometry),UID$2=0,UniformGroup=function(){function UniformGroup(uniforms,_static){this.uniforms=uniforms,this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=UID$2++,this.static=!!_static}return UniformGroup.prototype.update=function(){this.dirtyId++},UniformGroup.prototype.add=function(name,uniforms,_static){this.uniforms[name]=new UniformGroup(uniforms,_static)},UniformGroup.from=function(uniforms,_static){return new UniformGroup(uniforms,_static)},UniformGroup}(),FilterState=function(){function FilterState(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.sourceFrame=new Rectangle,this.destinationFrame=new Rectangle,this.filters=[]}return FilterState.prototype.clear=function(){this.target=null,this.filters=null,this.renderTexture=null},FilterState}(),FilterSystem=function(_super){function FilterSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.defaultFilterStack=[{}],_this.texturePool=new RenderTexturePool,_this.texturePool.setScreenSize(renderer.view),_this.statePool=[],_this.quad=new Quad,_this.quadUv=new QuadUv,_this.tempRect=new Rectangle,_this.activeState={},_this.globalUniforms=new UniformGroup({outputFrame:_this.tempRect,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),_this.forceClear=!1,_this.useMaxPadding=!1,_this}return __extends$3(FilterSystem,_super),FilterSystem.prototype.push=function(target,filters){for(var renderer=this.renderer,filterStack=this.defaultFilterStack,state=this.statePool.pop()||new FilterState,resolution=filters[0].resolution,padding=filters[0].padding,autoFit=filters[0].autoFit,legacy=filters[0].legacy,i=1;i<filters.length;i++){var filter=filters[i];resolution=Math.min(resolution,filter.resolution),padding=this.useMaxPadding?Math.max(padding,filter.padding):padding+filter.padding,autoFit=autoFit&&filter.autoFit,legacy=legacy||filter.legacy}1===filterStack.length&&(this.defaultFilterStack[0].renderTexture=renderer.renderTexture.current),filterStack.push(state),state.resolution=resolution,state.legacy=legacy,state.target=target,state.sourceFrame.copyFrom(target.filterArea||target.getBounds(!0)),state.sourceFrame.pad(padding),autoFit&&state.sourceFrame.fit(this.renderer.renderTexture.sourceFrame),state.sourceFrame.ceil(resolution),state.renderTexture=this.getOptimalFilterTexture(state.sourceFrame.width,state.sourceFrame.height,resolution),state.filters=filters,state.destinationFrame.width=state.renderTexture.width,state.destinationFrame.height=state.renderTexture.height;var destinationFrame=this.tempRect;destinationFrame.width=state.sourceFrame.width,destinationFrame.height=state.sourceFrame.height,state.renderTexture.filterFrame=state.sourceFrame,renderer.renderTexture.bind(state.renderTexture,state.sourceFrame,destinationFrame),renderer.renderTexture.clear()},FilterSystem.prototype.pop=function(){var filterStack=this.defaultFilterStack,state=filterStack.pop(),filters=state.filters;this.activeState=state;var globalUniforms=this.globalUniforms.uniforms;globalUniforms.outputFrame=state.sourceFrame,globalUniforms.resolution=state.resolution;var inputSize=globalUniforms.inputSize,inputPixel=globalUniforms.inputPixel,inputClamp=globalUniforms.inputClamp;if(inputSize[0]=state.destinationFrame.width,inputSize[1]=state.destinationFrame.height,inputSize[2]=1/inputSize[0],inputSize[3]=1/inputSize[1],inputPixel[0]=inputSize[0]*state.resolution,inputPixel[1]=inputSize[1]*state.resolution,inputPixel[2]=1/inputPixel[0],inputPixel[3]=1/inputPixel[1],inputClamp[0]=.5*inputPixel[2],inputClamp[1]=.5*inputPixel[3],inputClamp[2]=state.sourceFrame.width*inputSize[2]-.5*inputPixel[2],inputClamp[3]=state.sourceFrame.height*inputSize[3]-.5*inputPixel[3],state.legacy){var filterArea=globalUniforms.filterArea;filterArea[0]=state.destinationFrame.width,filterArea[1]=state.destinationFrame.height,filterArea[2]=state.sourceFrame.x,filterArea[3]=state.sourceFrame.y,globalUniforms.filterClamp=globalUniforms.inputClamp}this.globalUniforms.update();var lastState=filterStack[filterStack.length-1];if(state.renderTexture.framebuffer.multisample>1&&this.renderer.framebuffer.blit(),1===filters.length)filters[0].apply(this,state.renderTexture,lastState.renderTexture,CLEAR_MODES.BLEND,state),this.returnFilterTexture(state.renderTexture);else{var flip=state.renderTexture,flop=this.getOptimalFilterTexture(flip.width,flip.height,state.resolution);flop.filterFrame=flip.filterFrame;var i=0;for(i=0;i<filters.length-1;++i){filters[i].apply(this,flip,flop,CLEAR_MODES.CLEAR,state);var t=flip;flip=flop,flop=t}filters[i].apply(this,flip,lastState.renderTexture,CLEAR_MODES.BLEND,state),this.returnFilterTexture(flip),this.returnFilterTexture(flop)}state.clear(),this.statePool.push(state)},FilterSystem.prototype.bindAndClear=function(filterTexture,clearMode){if(void 0===clearMode&&(clearMode=CLEAR_MODES.CLEAR),filterTexture&&filterTexture.filterFrame){var destinationFrame=this.tempRect;destinationFrame.width=filterTexture.filterFrame.width,destinationFrame.height=filterTexture.filterFrame.height,this.renderer.renderTexture.bind(filterTexture,filterTexture.filterFrame,destinationFrame)}else this.renderer.renderTexture.bind(filterTexture);"boolean"==typeof clearMode&&(clearMode=clearMode?CLEAR_MODES.CLEAR:CLEAR_MODES.BLEND,deprecation("5.2.1","Use CLEAR_MODES when using clear applyFilter option")),(clearMode===CLEAR_MODES.CLEAR||clearMode===CLEAR_MODES.BLIT&&this.forceClear)&&this.renderer.renderTexture.clear()},FilterSystem.prototype.applyFilter=function(filter,input,output,clearMode){var renderer=this.renderer;this.bindAndClear(output,clearMode),filter.uniforms.uSampler=input,filter.uniforms.filterGlobals=this.globalUniforms,renderer.state.set(filter.state),renderer.shader.bind(filter),filter.legacy?(this.quadUv.map(input._frame,input.filterFrame),renderer.geometry.bind(this.quadUv),renderer.geometry.draw(DRAW_MODES.TRIANGLES)):(renderer.geometry.bind(this.quad),renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP))},FilterSystem.prototype.calculateSpriteMatrix=function(outputMatrix,sprite){var _a=this.activeState,sourceFrame=_a.sourceFrame,destinationFrame=_a.destinationFrame,orig=sprite._texture.orig,mappedMatrix=outputMatrix.set(destinationFrame.width,0,0,destinationFrame.height,sourceFrame.x,sourceFrame.y),worldTransform=sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);return worldTransform.invert(),mappedMatrix.prepend(worldTransform),mappedMatrix.scale(1/orig.width,1/orig.height),mappedMatrix.translate(sprite.anchor.x,sprite.anchor.y),mappedMatrix},FilterSystem.prototype.destroy=function(){this.texturePool.clear(!1)},FilterSystem.prototype.getOptimalFilterTexture=function(minWidth,minHeight,resolution){return void 0===resolution&&(resolution=1),this.texturePool.getOptimalTexture(minWidth,minHeight,resolution)},FilterSystem.prototype.getFilterTexture=function(input,resolution){if("number"==typeof input){var swap=input;input=resolution,resolution=swap}input=input||this.activeState.renderTexture;var filterTexture=this.texturePool.getOptimalTexture(input.width,input.height,resolution||input.resolution);return filterTexture.filterFrame=input.filterFrame,filterTexture},FilterSystem.prototype.returnFilterTexture=function(renderTexture){this.texturePool.returnTexture(renderTexture)},FilterSystem.prototype.emptyPool=function(){this.texturePool.clear(!0)},FilterSystem.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},FilterSystem}(System),ObjectRenderer=function(){function ObjectRenderer(renderer){this.renderer=renderer}return ObjectRenderer.prototype.flush=function(){},ObjectRenderer.prototype.destroy=function(){this.renderer=null},ObjectRenderer.prototype.start=function(){},ObjectRenderer.prototype.stop=function(){this.flush()},ObjectRenderer.prototype.render=function(_object){},ObjectRenderer}(),BatchSystem=function(_super){function BatchSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.emptyRenderer=new ObjectRenderer(renderer),_this.currentRenderer=_this.emptyRenderer,_this}return __extends$3(BatchSystem,_super),BatchSystem.prototype.setObjectRenderer=function(objectRenderer){this.currentRenderer!==objectRenderer&&(this.currentRenderer.stop(),this.currentRenderer=objectRenderer,this.currentRenderer.start())},BatchSystem.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},BatchSystem.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},BatchSystem.prototype.copyBoundTextures=function(arr,maxTextures){for(var boundTextures=this.renderer.texture.boundTextures,i=maxTextures-1;i>=0;--i)arr[i]=boundTextures[i]||null,arr[i]&&(arr[i]._batchLocation=i)},BatchSystem.prototype.boundArray=function(texArray,boundTextures,batchId,maxTextures){for(var elements=texArray.elements,ids=texArray.ids,count=texArray.count,j=0,i=0;i<count;i++){var tex=elements[i],loc=tex._batchLocation;if(loc>=0&&loc<maxTextures&&boundTextures[loc]===tex)ids[i]=loc;else for(;j<maxTextures;){var bound=boundTextures[j];if(!bound||bound._batchEnabled!==batchId||bound._batchLocation!==j){ids[i]=j,tex._batchLocation=j,boundTextures[j]=tex;break}j++}}},BatchSystem}(System),CONTEXT_UID_COUNTER=0,ContextSystem=function(_super){function ContextSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.webGLVersion=1,_this.extensions={},_this.supports={uint32Indices:!1},_this.handleContextLost=_this.handleContextLost.bind(_this),_this.handleContextRestored=_this.handleContextRestored.bind(_this),renderer.view.addEventListener("webglcontextlost",_this.handleContextLost,!1),renderer.view.addEventListener("webglcontextrestored",_this.handleContextRestored,!1),_this}return __extends$3(ContextSystem,_super),Object.defineProperty(ContextSystem.prototype,"isLost",{get:function(){return!this.gl||this.gl.isContextLost()},enumerable:!1,configurable:!0}),ContextSystem.prototype.contextChange=function(gl){this.gl=gl,this.renderer.gl=gl,this.renderer.CONTEXT_UID=CONTEXT_UID_COUNTER++,gl.isContextLost()&&gl.getExtension("WEBGL_lose_context")&&gl.getExtension("WEBGL_lose_context").restoreContext()},ContextSystem.prototype.initFromContext=function(gl){this.gl=gl,this.validateContext(gl),this.renderer.gl=gl,this.renderer.CONTEXT_UID=CONTEXT_UID_COUNTER++,this.renderer.runners.contextChange.emit(gl)},ContextSystem.prototype.initFromOptions=function(options){var gl=this.createContext(this.renderer.view,options);this.initFromContext(gl)},ContextSystem.prototype.createContext=function(canvas,options){var gl;if(settings.PREFER_ENV>=ENV.WEBGL2&&(gl=canvas.getContext("webgl2",options)),gl)this.webGLVersion=2;else if(this.webGLVersion=1,!(gl=canvas.getContext("webgl",options)||canvas.getContext("experimental-webgl",options)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=gl,this.getExtensions(),this.gl},ContextSystem.prototype.getExtensions=function(){var gl=this.gl;1===this.webGLVersion?Object.assign(this.extensions,{drawBuffers:gl.getExtension("WEBGL_draw_buffers"),depthTexture:gl.getExtension("WEBGL_depth_texture"),loseContext:gl.getExtension("WEBGL_lose_context"),vertexArrayObject:gl.getExtension("OES_vertex_array_object")||gl.getExtension("MOZ_OES_vertex_array_object")||gl.getExtension("WEBKIT_OES_vertex_array_object"),anisotropicFiltering:gl.getExtension("EXT_texture_filter_anisotropic"),uint32ElementIndex:gl.getExtension("OES_element_index_uint"),floatTexture:gl.getExtension("OES_texture_float"),floatTextureLinear:gl.getExtension("OES_texture_float_linear"),textureHalfFloat:gl.getExtension("OES_texture_half_float"),textureHalfFloatLinear:gl.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,{anisotropicFiltering:gl.getExtension("EXT_texture_filter_anisotropic"),colorBufferFloat:gl.getExtension("EXT_color_buffer_float"),floatTextureLinear:gl.getExtension("OES_texture_float_linear")})},ContextSystem.prototype.handleContextLost=function(event){event.preventDefault()},ContextSystem.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},ContextSystem.prototype.destroy=function(){var view=this.renderer.view;view.removeEventListener("webglcontextlost",this.handleContextLost),view.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},ContextSystem.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},ContextSystem.prototype.validateContext=function(gl){var attributes=gl.getContextAttributes(),isWebGl2="WebGL2RenderingContext"in window&&gl instanceof window.WebGL2RenderingContext;isWebGl2&&(this.webGLVersion=2),attributes.stencil||console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var hasuint32=isWebGl2||!!gl.getExtension("OES_element_index_uint");this.supports.uint32Indices=hasuint32,hasuint32||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},ContextSystem}(System),GLFramebuffer=function(framebuffer){this.framebuffer=framebuffer,this.stencil=null,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.multisample=MSAA_QUALITY.NONE,this.msaaBuffer=null,this.blitFramebuffer=null},tempRectangle=new Rectangle,FramebufferSystem=function(_super){function FramebufferSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.managedFramebuffers=[],_this.unknownFramebuffer=new Framebuffer(10,10),_this.msaaSamples=null,_this}return __extends$3(FramebufferSystem,_super),FramebufferSystem.prototype.contextChange=function(){var gl=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new Rectangle,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion){var nativeDrawBuffersExtension_1=this.renderer.context.extensions.drawBuffers,nativeDepthTextureExtension=this.renderer.context.extensions.depthTexture;settings.PREFER_ENV===ENV.WEBGL_LEGACY&&(nativeDrawBuffersExtension_1=null,nativeDepthTextureExtension=null),nativeDrawBuffersExtension_1?gl.drawBuffers=function(activeTextures){return nativeDrawBuffersExtension_1.drawBuffersWEBGL(activeTextures)}:(this.hasMRT=!1,gl.drawBuffers=function(){}),nativeDepthTextureExtension||(this.writeDepthTexture=!1)}else this.msaaSamples=gl.getInternalformatParameter(gl.RENDERBUFFER,gl.RGBA8,gl.SAMPLES)},FramebufferSystem.prototype.bind=function(framebuffer,frame){var gl=this.gl;if(framebuffer){var fbo=framebuffer.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(framebuffer);this.current!==framebuffer&&(this.current=framebuffer,gl.bindFramebuffer(gl.FRAMEBUFFER,fbo.framebuffer)),fbo.dirtyId!==framebuffer.dirtyId&&(fbo.dirtyId=framebuffer.dirtyId,fbo.dirtyFormat!==framebuffer.dirtyFormat?(fbo.dirtyFormat=framebuffer.dirtyFormat,this.updateFramebuffer(framebuffer)):fbo.dirtySize!==framebuffer.dirtySize&&(fbo.dirtySize=framebuffer.dirtySize,this.resizeFramebuffer(framebuffer)));for(var i=0;i<framebuffer.colorTextures.length;i++){var tex=framebuffer.colorTextures[i];this.renderer.texture.unbind(tex.parentTextureArray||tex)}framebuffer.depthTexture&&this.renderer.texture.unbind(framebuffer.depthTexture),frame?this.setViewport(frame.x,frame.y,frame.width,frame.height):this.setViewport(0,0,framebuffer.width,framebuffer.height)}else this.current&&(this.current=null,gl.bindFramebuffer(gl.FRAMEBUFFER,null)),frame?this.setViewport(frame.x,frame.y,frame.width,frame.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},FramebufferSystem.prototype.setViewport=function(x,y,width,height){var v=this.viewport;v.width===width&&v.height===height&&v.x===x&&v.y===y||(v.x=x,v.y=y,v.width=width,v.height=height,this.gl.viewport(x,y,width,height))},Object.defineProperty(FramebufferSystem.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),FramebufferSystem.prototype.clear=function(r,g,b,a,mask){void 0===mask&&(mask=BUFFER_BITS.COLOR|BUFFER_BITS.DEPTH);var gl=this.gl;gl.clearColor(r,g,b,a),gl.clear(mask)},FramebufferSystem.prototype.initFramebuffer=function(framebuffer){var gl=this.gl,fbo=new GLFramebuffer(gl.createFramebuffer());return fbo.multisample=this.detectSamples(framebuffer.multisample),framebuffer.glFramebuffers[this.CONTEXT_UID]=fbo,this.managedFramebuffers.push(framebuffer),framebuffer.disposeRunner.add(this),fbo},FramebufferSystem.prototype.resizeFramebuffer=function(framebuffer){var gl=this.gl,fbo=framebuffer.glFramebuffers[this.CONTEXT_UID];fbo.stencil&&(gl.bindRenderbuffer(gl.RENDERBUFFER,fbo.stencil),gl.renderbufferStorage(gl.RENDERBUFFER,gl.DEPTH_STENCIL,framebuffer.width,framebuffer.height));for(var colorTextures=framebuffer.colorTextures,i=0;i<colorTextures.length;i++)this.renderer.texture.bind(colorTextures[i],0);framebuffer.depthTexture&&this.renderer.texture.bind(framebuffer.depthTexture,0)},FramebufferSystem.prototype.updateFramebuffer=function(framebuffer){var gl=this.gl,fbo=framebuffer.glFramebuffers[this.CONTEXT_UID],count=framebuffer.colorTextures.length;gl.drawBuffers||(count=Math.min(count,1)),fbo.multisample>1&&(fbo.msaaBuffer=gl.createRenderbuffer(),gl.bindRenderbuffer(gl.RENDERBUFFER,fbo.msaaBuffer),gl.renderbufferStorageMultisample(gl.RENDERBUFFER,fbo.multisample,gl.RGBA8,framebuffer.width,framebuffer.height),gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,fbo.msaaBuffer));for(var activeTextures=[],i=0;i<count;i++)if(!(0===i&&fbo.multisample>1)){var texture=framebuffer.colorTextures[i],parentTexture=texture.parentTextureArray||texture;this.renderer.texture.bind(parentTexture,0),gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0+i,texture.target,parentTexture._glTextures[this.CONTEXT_UID].texture,0),activeTextures.push(gl.COLOR_ATTACHMENT0+i)}if((activeTextures.length>1&&gl.drawBuffers(activeTextures),framebuffer.depthTexture)&&this.writeDepthTexture){var depthTexture=framebuffer.depthTexture;this.renderer.texture.bind(depthTexture,0),gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.DEPTH_ATTACHMENT,gl.TEXTURE_2D,depthTexture._glTextures[this.CONTEXT_UID].texture,0)}fbo.stencil||!framebuffer.stencil&&!framebuffer.depth||(fbo.stencil=gl.createRenderbuffer(),gl.bindRenderbuffer(gl.RENDERBUFFER,fbo.stencil),gl.renderbufferStorage(gl.RENDERBUFFER,gl.DEPTH_STENCIL,framebuffer.width,framebuffer.height),framebuffer.depthTexture||gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_STENCIL_ATTACHMENT,gl.RENDERBUFFER,fbo.stencil))},FramebufferSystem.prototype.detectSamples=function(samples){var msaaSamples=this.msaaSamples,res=MSAA_QUALITY.NONE;if(samples<=1||null===msaaSamples)return res;for(var i=0;i<msaaSamples.length;i++)if(msaaSamples[i]<=samples){res=msaaSamples[i];break}return 1===res&&(res=MSAA_QUALITY.NONE),res},FramebufferSystem.prototype.blit=function(framebuffer,sourcePixels,destPixels){var current=this.current,renderer=this.renderer,gl=this.gl,CONTEXT_UID=this.CONTEXT_UID;if(2===renderer.context.webGLVersion&¤t){var fbo=current.glFramebuffers[CONTEXT_UID];if(fbo){if(!framebuffer){if(fbo.multisample<=1)return;fbo.blitFramebuffer||(fbo.blitFramebuffer=new Framebuffer(current.width,current.height),fbo.blitFramebuffer.addColorTexture(0,current.colorTextures[0])),(framebuffer=fbo.blitFramebuffer).width=current.width,framebuffer.height=current.height}sourcePixels||((sourcePixels=tempRectangle).width=current.width,sourcePixels.height=current.height),destPixels||(destPixels=sourcePixels);var sameSize=sourcePixels.width===destPixels.width&&sourcePixels.height===destPixels.height;this.bind(framebuffer),gl.bindFramebuffer(gl.READ_FRAMEBUFFER,fbo.framebuffer),gl.blitFramebuffer(sourcePixels.x,sourcePixels.y,sourcePixels.width,sourcePixels.height,destPixels.x,destPixels.y,destPixels.width,destPixels.height,gl.COLOR_BUFFER_BIT,sameSize?gl.NEAREST:gl.LINEAR)}}},FramebufferSystem.prototype.disposeFramebuffer=function(framebuffer,contextLost){var fbo=framebuffer.glFramebuffers[this.CONTEXT_UID],gl=this.gl;if(fbo){delete framebuffer.glFramebuffers[this.CONTEXT_UID];var index=this.managedFramebuffers.indexOf(framebuffer);index>=0&&this.managedFramebuffers.splice(index,1),framebuffer.disposeRunner.remove(this),contextLost||(gl.deleteFramebuffer(fbo.framebuffer),fbo.stencil&&gl.deleteRenderbuffer(fbo.stencil))}},FramebufferSystem.prototype.disposeAll=function(contextLost){var list=this.managedFramebuffers;this.managedFramebuffers=[];for(var i=0;i<list.length;i++)this.disposeFramebuffer(list[i],contextLost)},FramebufferSystem.prototype.forceStencil=function(){var framebuffer=this.current;if(framebuffer){var fbo=framebuffer.glFramebuffers[this.CONTEXT_UID];if(fbo&&!fbo.stencil){framebuffer.enableStencil();var w=framebuffer.width,h=framebuffer.height,gl=this.gl,stencil=gl.createRenderbuffer();gl.bindRenderbuffer(gl.RENDERBUFFER,stencil),gl.renderbufferStorage(gl.RENDERBUFFER,gl.DEPTH_STENCIL,w,h),fbo.stencil=stencil,gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_STENCIL_ATTACHMENT,gl.RENDERBUFFER,stencil)}}},FramebufferSystem.prototype.reset=function(){this.current=this.unknownFramebuffer,this.viewport=new Rectangle},FramebufferSystem}(System),GLBuffer=function(buffer){this.buffer=buffer||null,this.updateID=-1,this.byteLength=-1,this.refCount=0},byteSizeMap$1={5126:4,5123:2,5121:1},GeometrySystem=function(_super){function GeometrySystem(renderer){var _this=_super.call(this,renderer)||this;return _this._activeGeometry=null,_this._activeVao=null,_this.hasVao=!0,_this.hasInstance=!0,_this.canUseUInt32ElementIndex=!1,_this.managedGeometries={},_this.managedBuffers={},_this}return __extends$3(GeometrySystem,_super),GeometrySystem.prototype.contextChange=function(){this.disposeAll(!0);var gl=this.gl=this.renderer.gl,context=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,2!==context.webGLVersion){var nativeVaoExtension_1=this.renderer.context.extensions.vertexArrayObject;settings.PREFER_ENV===ENV.WEBGL_LEGACY&&(nativeVaoExtension_1=null),nativeVaoExtension_1?(gl.createVertexArray=function(){return nativeVaoExtension_1.createVertexArrayOES()},gl.bindVertexArray=function(vao){return nativeVaoExtension_1.bindVertexArrayOES(vao)},gl.deleteVertexArray=function(vao){return nativeVaoExtension_1.deleteVertexArrayOES(vao)}):(this.hasVao=!1,gl.createVertexArray=function(){return null},gl.bindVertexArray=function(){return null},gl.deleteVertexArray=function(){return null})}if(2!==context.webGLVersion){var instanceExt_1=gl.getExtension("ANGLE_instanced_arrays");instanceExt_1?(gl.vertexAttribDivisor=function(a,b){return instanceExt_1.vertexAttribDivisorANGLE(a,b)},gl.drawElementsInstanced=function(a,b,c,d,e){return instanceExt_1.drawElementsInstancedANGLE(a,b,c,d,e)},gl.drawArraysInstanced=function(a,b,c,d){return instanceExt_1.drawArraysInstancedANGLE(a,b,c,d)}):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===context.webGLVersion||!!context.extensions.uint32ElementIndex},GeometrySystem.prototype.bind=function(geometry,shader){shader=shader||this.renderer.shader.shader;var gl=this.gl,vaos=geometry.glVertexArrayObjects[this.CONTEXT_UID],incRefCount=!1;vaos||(this.managedGeometries[geometry.id]=geometry,geometry.disposeRunner.add(this),geometry.glVertexArrayObjects[this.CONTEXT_UID]=vaos={},incRefCount=!0);var vao=vaos[shader.program.id]||this.initGeometryVao(geometry,shader.program,incRefCount);this._activeGeometry=geometry,this._activeVao!==vao&&(this._activeVao=vao,this.hasVao?gl.bindVertexArray(vao):this.activateVao(geometry,shader.program)),this.updateBuffers()},GeometrySystem.prototype.reset=function(){this.unbind()},GeometrySystem.prototype.updateBuffers=function(){for(var geometry=this._activeGeometry,gl=this.gl,i=0;i<geometry.buffers.length;i++){var buffer=geometry.buffers[i],glBuffer=buffer._glBuffers[this.CONTEXT_UID];if(buffer._updateID!==glBuffer.updateID){glBuffer.updateID=buffer._updateID;var type=buffer.index?gl.ELEMENT_ARRAY_BUFFER:gl.ARRAY_BUFFER;if(gl.bindBuffer(type,glBuffer.buffer),this._boundBuffer=glBuffer,glBuffer.byteLength>=buffer.data.byteLength)gl.bufferSubData(type,0,buffer.data);else{var drawType=buffer.static?gl.STATIC_DRAW:gl.DYNAMIC_DRAW;glBuffer.byteLength=buffer.data.byteLength,gl.bufferData(type,buffer.data,drawType)}}}},GeometrySystem.prototype.checkCompatibility=function(geometry,program){var geometryAttributes=geometry.attributes,shaderAttributes=program.attributeData;for(var j in shaderAttributes)if(!geometryAttributes[j])throw new Error('shader and geometry incompatible, geometry missing the "'+j+'" attribute')},GeometrySystem.prototype.getSignature=function(geometry,program){var attribs=geometry.attributes,shaderAttributes=program.attributeData,strings=["g",geometry.id];for(var i in attribs)shaderAttributes[i]&&strings.push(i);return strings.join("-")},GeometrySystem.prototype.initGeometryVao=function(geometry,program,incRefCount){void 0===incRefCount&&(incRefCount=!0),this.checkCompatibility(geometry,program);var gl=this.gl,CONTEXT_UID=this.CONTEXT_UID,signature=this.getSignature(geometry,program),vaoObjectHash=geometry.glVertexArrayObjects[this.CONTEXT_UID],vao=vaoObjectHash[signature];if(vao)return vaoObjectHash[program.id]=vao,vao;var buffers=geometry.buffers,attributes=geometry.attributes,tempStride={},tempStart={};for(var j in buffers)tempStride[j]=0,tempStart[j]=0;for(var j in attributes)!attributes[j].size&&program.attributeData[j]?attributes[j].size=program.attributeData[j].size:attributes[j].size||console.warn("PIXI Geometry attribute '"+j+"' size cannot be determined (likely the bound shader does not have the attribute)"),tempStride[attributes[j].buffer]+=attributes[j].size*byteSizeMap$1[attributes[j].type];for(var j in attributes){var attribute=attributes[j],attribSize=attribute.size;void 0===attribute.stride&&(tempStride[attribute.buffer]===attribSize*byteSizeMap$1[attribute.type]?attribute.stride=0:attribute.stride=tempStride[attribute.buffer]),void 0===attribute.start&&(attribute.start=tempStart[attribute.buffer],tempStart[attribute.buffer]+=attribSize*byteSizeMap$1[attribute.type])}vao=gl.createVertexArray(),gl.bindVertexArray(vao);for(var i=0;i<buffers.length;i++){var buffer=buffers[i];buffer._glBuffers[CONTEXT_UID]||(buffer._glBuffers[CONTEXT_UID]=new GLBuffer(gl.createBuffer()),this.managedBuffers[buffer.id]=buffer,buffer.disposeRunner.add(this)),incRefCount&&buffer._glBuffers[CONTEXT_UID].refCount++}return this.activateVao(geometry,program),this._activeVao=vao,vaoObjectHash[program.id]=vao,vaoObjectHash[signature]=vao,vao},GeometrySystem.prototype.disposeBuffer=function(buffer,contextLost){if(this.managedBuffers[buffer.id]){delete this.managedBuffers[buffer.id];var glBuffer=buffer._glBuffers[this.CONTEXT_UID],gl=this.gl;buffer.disposeRunner.remove(this),glBuffer&&(contextLost||gl.deleteBuffer(glBuffer.buffer),delete buffer._glBuffers[this.CONTEXT_UID])}},GeometrySystem.prototype.disposeGeometry=function(geometry,contextLost){if(this.managedGeometries[geometry.id]){delete this.managedGeometries[geometry.id];var vaos=geometry.glVertexArrayObjects[this.CONTEXT_UID],gl=this.gl,buffers=geometry.buffers;if(geometry.disposeRunner.remove(this),vaos){for(var i=0;i<buffers.length;i++){var buf=buffers[i]._glBuffers[this.CONTEXT_UID];buf.refCount--,0!==buf.refCount||contextLost||this.disposeBuffer(buffers[i],contextLost)}if(!contextLost)for(var vaoId in vaos)if("g"===vaoId[0]){var vao=vaos[vaoId];this._activeVao===vao&&this.unbind(),gl.deleteVertexArray(vao)}delete geometry.glVertexArrayObjects[this.CONTEXT_UID]}}},GeometrySystem.prototype.disposeAll=function(contextLost){for(var all=Object.keys(this.managedGeometries),i=0;i<all.length;i++)this.disposeGeometry(this.managedGeometries[all[i]],contextLost);all=Object.keys(this.managedBuffers);for(i=0;i<all.length;i++)this.disposeBuffer(this.managedBuffers[all[i]],contextLost)},GeometrySystem.prototype.activateVao=function(geometry,program){var gl=this.gl,CONTEXT_UID=this.CONTEXT_UID,buffers=geometry.buffers,attributes=geometry.attributes;geometry.indexBuffer&&gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,geometry.indexBuffer._glBuffers[CONTEXT_UID].buffer);var lastBuffer=null;for(var j in attributes){var attribute=attributes[j],glBuffer=buffers[attribute.buffer]._glBuffers[CONTEXT_UID];if(program.attributeData[j]){lastBuffer!==glBuffer&&(gl.bindBuffer(gl.ARRAY_BUFFER,glBuffer.buffer),lastBuffer=glBuffer);var location=program.attributeData[j].location;if(gl.enableVertexAttribArray(location),gl.vertexAttribPointer(location,attribute.size,attribute.type||gl.FLOAT,attribute.normalized,attribute.stride,attribute.start),attribute.instance){if(!this.hasInstance)throw new Error("geometry error, GPU Instancing is not supported on this device");gl.vertexAttribDivisor(location,1)}}}},GeometrySystem.prototype.draw=function(type,size,start,instanceCount){var gl=this.gl,geometry=this._activeGeometry;if(geometry.indexBuffer){var byteSize=geometry.indexBuffer.data.BYTES_PER_ELEMENT,glType=2===byteSize?gl.UNSIGNED_SHORT:gl.UNSIGNED_INT;2===byteSize||4===byteSize&&this.canUseUInt32ElementIndex?geometry.instanced?gl.drawElementsInstanced(type,size||geometry.indexBuffer.data.length,glType,(start||0)*byteSize,instanceCount||1):gl.drawElements(type,size||geometry.indexBuffer.data.length,glType,(start||0)*byteSize):console.warn("unsupported index buffer type: uint32")}else geometry.instanced?gl.drawArraysInstanced(type,start,size||geometry.getSize(),instanceCount||1):gl.drawArrays(type,start,size||geometry.getSize());return this},GeometrySystem.prototype.unbind=function(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null},GeometrySystem}(System),MaskData=function(){function MaskData(maskObject){void 0===maskObject&&(maskObject=null),this.type=MASK_TYPES.NONE,this.autoDetect=!0,this.maskObject=maskObject||null,this.pooled=!1,this.isMaskData=!0,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._target=null}return MaskData.prototype.reset=function(){this.pooled&&(this.maskObject=null,this.type=MASK_TYPES.NONE,this.autoDetect=!0),this._target=null},MaskData.prototype.copyCountersOrReset=function(maskAbove){maskAbove?(this._stencilCounter=maskAbove._stencilCounter,this._scissorCounter=maskAbove._scissorCounter,this._scissorRect=maskAbove._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)},MaskData}();function compileShader(gl,type,src){var shader=gl.createShader(type);return gl.shaderSource(shader,src),gl.compileShader(shader),shader}function compileProgram(gl,vertexSrc,fragmentSrc,attributeLocations){var glVertShader=compileShader(gl,gl.VERTEX_SHADER,vertexSrc),glFragShader=compileShader(gl,gl.FRAGMENT_SHADER,fragmentSrc),program=gl.createProgram();if(gl.attachShader(program,glVertShader),gl.attachShader(program,glFragShader),attributeLocations)for(var i in attributeLocations)gl.bindAttribLocation(program,attributeLocations[i],i);return gl.linkProgram(program),gl.getProgramParameter(program,gl.LINK_STATUS)||(gl.getShaderParameter(glVertShader,gl.COMPILE_STATUS)||(console.warn(vertexSrc),console.error(gl.getShaderInfoLog(glVertShader))),gl.getShaderParameter(glFragShader,gl.COMPILE_STATUS)||(console.warn(fragmentSrc),console.error(gl.getShaderInfoLog(glFragShader))),console.error("Pixi.js Error: Could not initialize shader."),console.error("gl.VALIDATE_STATUS",gl.getProgramParameter(program,gl.VALIDATE_STATUS)),console.error("gl.getError()",gl.getError()),""!==gl.getProgramInfoLog(program)&&console.warn("Pixi.js Warning: gl.getProgramInfoLog()",gl.getProgramInfoLog(program)),gl.deleteProgram(program),program=null),gl.deleteShader(glVertShader),gl.deleteShader(glFragShader),program}function booleanArray(size){for(var array=new Array(size),i=0;i<array.length;i++)array[i]=!1;return array}function defaultValue(type,size){switch(type){case"float":return 0;case"vec2":return new Float32Array(2*size);case"vec3":return new Float32Array(3*size);case"vec4":return new Float32Array(4*size);case"int":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*size);case"ivec3":return new Int32Array(3*size);case"ivec4":return new Int32Array(4*size);case"bool":return!1;case"bvec2":return booleanArray(2*size);case"bvec3":return booleanArray(3*size);case"bvec4":return booleanArray(4*size);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var maxFragmentPrecision,unknownContext={},context=unknownContext;function getTestContext(){if(context===unknownContext||context&&context.isContextLost()){var canvas=document.createElement("canvas"),gl=void 0;settings.PREFER_ENV>=ENV.WEBGL2&&(gl=canvas.getContext("webgl2",{})),gl||((gl=canvas.getContext("webgl",{})||canvas.getContext("experimental-webgl",{}))?gl.getExtension("WEBGL_draw_buffers"):gl=null),context=gl}return context}function setPrecision(src,requestedPrecision,maxSupportedPrecision){if("precision"!==src.substring(0,9)){var precision=requestedPrecision;return requestedPrecision===PRECISION.HIGH&&maxSupportedPrecision!==PRECISION.HIGH&&(precision=PRECISION.MEDIUM),"precision "+precision+" float;\n"+src}return maxSupportedPrecision!==PRECISION.HIGH&&"precision highp"===src.substring(0,15)?src.replace("precision highp","precision mediump"):src}var GLSL_TO_SIZE={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function mapSize(type){return GLSL_TO_SIZE[type]}var GL_TABLE=null,GL_TO_GLSL_TYPES={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function mapType(gl,type){if(!GL_TABLE){var typeNames=Object.keys(GL_TO_GLSL_TYPES);GL_TABLE={};for(var i=0;i<typeNames.length;++i){var tn=typeNames[i];GL_TABLE[gl[tn]]=GL_TO_GLSL_TYPES[tn]}}return GL_TABLE[type]}var uniformParsers=[{test:function(data){return"float"===data.type&&1===data.size},code:function(name){return'\n if(uv["'+name+'"] !== ud["'+name+'"].value)\n {\n ud["'+name+'"].value = uv["'+name+'"]\n gl.uniform1f(ud["'+name+'"].location, uv["'+name+'"])\n }\n '}},{test:function(data){return("sampler2D"===data.type||"samplerCube"===data.type||"sampler2DArray"===data.type)&&1===data.size&&!data.isArray},code:function(name){return't = syncData.textureCount++;\n\n renderer.texture.bind(uv["'+name+'"], t);\n\n if(ud["'+name+'"].value !== t)\n {\n ud["'+name+'"].value = t;\n gl.uniform1i(ud["'+name+'"].location, t);\n; // eslint-disable-line max-len\n }'}},{test:function(data,uniform){return"mat3"===data.type&&1===data.size&&void 0!==uniform.a},code:function(name){return'\n gl.uniformMatrix3fv(ud["'+name+'"].location, false, uv["'+name+'"].toArray(true));\n '}},{test:function(data,uniform){return"vec2"===data.type&&1===data.size&&void 0!==uniform.x},code:function(name){return'\n cv = ud["'+name+'"].value;\n v = uv["'+name+'"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud["'+name+'"].location, v.x, v.y);\n }'}},{test:function(data){return"vec2"===data.type&&1===data.size},code:function(name){return'\n cv = ud["'+name+'"].value;\n v = uv["'+name+'"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud["'+name+'"].location, v[0], v[1]);\n }\n '}},{test:function(data,uniform){return"vec4"===data.type&&1===data.size&&void 0!==uniform.width},code:function(name){return'\n cv = ud["'+name+'"].value;\n v = uv["'+name+'"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud["'+name+'"].location, v.x, v.y, v.width, v.height)\n }'}},{test:function(data){return"vec4"===data.type&&1===data.size},code:function(name){return'\n cv = ud["'+name+'"].value;\n v = uv["'+name+'"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud["'+name+'"].location, v[0], v[1], v[2], v[3])\n }'}}],GLSL_TO_SINGLE_SETTERS_CACHED={float:"\n if(cv !== v)\n {\n cv.v = v;\n gl.uniform1f(location, v)\n }",vec2:"\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1])\n }",vec3:"\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }",vec4:"gl.uniform4f(location, v[0], v[1], v[2], v[3])",int:"gl.uniform1i(location, v)",ivec2:"gl.uniform2i(location, v[0], v[1])",ivec3:"gl.uniform3i(location, v[0], v[1], v[2])",ivec4:"gl.uniform4i(location, v[0], v[1], v[2], v[3])",bool:"gl.uniform1i(location, v)",bvec2:"gl.uniform2i(location, v[0], v[1])",bvec3:"gl.uniform3i(location, v[0], v[1], v[2])",bvec4:"gl.uniform4i(location, v[0], v[1], v[2], v[3])",mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:"gl.uniform1i(location, v)",samplerCube:"gl.uniform1i(location, v)",sampler2DArray:"gl.uniform1i(location, v)"},GLSL_TO_ARRAY_SETTERS={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};var unsafeEval,fragTemplate=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function generateIfTestSrc(maxIfs){for(var src="",i=0;i<maxIfs;++i)i>0&&(src+="\nelse "),i<maxIfs-1&&(src+="if(test == "+i+".0){}");return src}var UID$3=0,nameCache={},Program=function(){function Program(vertexSrc,fragmentSrc,name){void 0===name&&(name="pixi-shader"),this.id=UID$3++,this.vertexSrc=vertexSrc||Program.defaultVertexSrc,this.fragmentSrc=fragmentSrc||Program.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),"#version"!==this.vertexSrc.substring(0,8)&&(name=name.replace(/\s+/g,"-"),nameCache[name]?(nameCache[name]++,name+="-"+nameCache[name]):nameCache[name]=1,this.vertexSrc="#define SHADER_NAME "+name+"\n"+this.vertexSrc,this.fragmentSrc="#define SHADER_NAME "+name+"\n"+this.fragmentSrc,this.vertexSrc=setPrecision(this.vertexSrc,settings.PRECISION_VERTEX,PRECISION.HIGH),this.fragmentSrc=setPrecision(this.fragmentSrc,settings.PRECISION_FRAGMENT,function(){if(!maxFragmentPrecision){maxFragmentPrecision=PRECISION.MEDIUM;var gl=getTestContext();if(gl&&gl.getShaderPrecisionFormat){var shaderFragment=gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.HIGH_FLOAT);maxFragmentPrecision=shaderFragment.precision?PRECISION.HIGH:PRECISION.MEDIUM}}return maxFragmentPrecision}())),this.extractData(this.vertexSrc,this.fragmentSrc),this.glPrograms={},this.syncUniforms=null}return Program.prototype.extractData=function(vertexSrc,fragmentSrc){var gl=getTestContext();if(gl){var program=compileProgram(gl,vertexSrc,fragmentSrc);this.attributeData=this.getAttributeData(program,gl),this.uniformData=this.getUniformData(program,gl),gl.deleteProgram(program)}else this.uniformData={},this.attributeData={}},Program.prototype.getAttributeData=function(program,gl){for(var attributes={},attributesArray=[],totalAttributes=gl.getProgramParameter(program,gl.ACTIVE_ATTRIBUTES),i=0;i<totalAttributes;i++){var attribData=gl.getActiveAttrib(program,i),type=mapType(gl,attribData.type),data={type:type,name:attribData.name,size:mapSize(type),location:0};attributes[attribData.name]=data,attributesArray.push(data)}attributesArray.sort((function(a,b){return a.name>b.name?1:-1}));for(i=0;i<attributesArray.length;i++)attributesArray[i].location=i;return attributes},Program.prototype.getUniformData=function(program,gl){for(var uniforms={},totalUniforms=gl.getProgramParameter(program,gl.ACTIVE_UNIFORMS),i=0;i<totalUniforms;i++){var uniformData=gl.getActiveUniform(program,i),name=uniformData.name.replace(/\[.*?\]$/,""),isArray=uniformData.name.match(/\[.*?\]$/),type=mapType(gl,uniformData.type);uniforms[name]={type:type,size:uniformData.size,isArray:isArray,value:defaultValue(type,uniformData.size)}}return uniforms},Object.defineProperty(Program,"defaultVertexSrc",{get:function(){return"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"},enumerable:!1,configurable:!0}),Object.defineProperty(Program,"defaultFragmentSrc",{get:function(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"},enumerable:!1,configurable:!0}),Program.from=function(vertexSrc,fragmentSrc,name){var key=vertexSrc+fragmentSrc,program=ProgramCache[key];return program||(ProgramCache[key]=program=new Program(vertexSrc,fragmentSrc,name)),program},Program}(),Shader=function(){function Shader(program,uniforms){for(var i in this.program=program,this.uniformGroup=uniforms?uniforms instanceof UniformGroup?uniforms:new UniformGroup(uniforms):new UniformGroup({}),program.uniformData)this.uniformGroup.uniforms[i]instanceof Array&&(this.uniformGroup.uniforms[i]=new Float32Array(this.uniformGroup.uniforms[i]))}return Shader.prototype.checkUniformExists=function(name,group){if(group.uniforms[name])return!0;for(var i in group.uniforms){var uniform=group.uniforms[i];if(uniform.group&&this.checkUniformExists(name,uniform))return!0}return!1},Shader.prototype.destroy=function(){this.uniformGroup=null},Object.defineProperty(Shader.prototype,"uniforms",{get:function(){return this.uniformGroup.uniforms},enumerable:!1,configurable:!0}),Shader.from=function(vertexSrc,fragmentSrc,uniforms){return new Shader(Program.from(vertexSrc,fragmentSrc),uniforms)},Shader}(),State=function(){function State(){this.data=0,this.blendMode=BLEND_MODES.NORMAL,this.polygonOffset=0,this.blend=!0}return Object.defineProperty(State.prototype,"blend",{get:function(){return!!(1&this.data)},set:function(value){!!(1&this.data)!==value&&(this.data^=1)},enumerable:!1,configurable:!0}),Object.defineProperty(State.prototype,"offsets",{get:function(){return!!(2&this.data)},set:function(value){!!(2&this.data)!==value&&(this.data^=2)},enumerable:!1,configurable:!0}),Object.defineProperty(State.prototype,"culling",{get:function(){return!!(4&this.data)},set:function(value){!!(4&this.data)!==value&&(this.data^=4)},enumerable:!1,configurable:!0}),Object.defineProperty(State.prototype,"depthTest",{get:function(){return!!(8&this.data)},set:function(value){!!(8&this.data)!==value&&(this.data^=8)},enumerable:!1,configurable:!0}),Object.defineProperty(State.prototype,"clockwiseFrontFace",{get:function(){return!!(16&this.data)},set:function(value){!!(16&this.data)!==value&&(this.data^=16)},enumerable:!1,configurable:!0}),Object.defineProperty(State.prototype,"blendMode",{get:function(){return this._blendMode},set:function(value){this.blend=value!==BLEND_MODES.NONE,this._blendMode=value},enumerable:!1,configurable:!0}),Object.defineProperty(State.prototype,"polygonOffset",{get:function(){return this._polygonOffset},set:function(value){this.offsets=!!value,this._polygonOffset=value},enumerable:!1,configurable:!0}),State.for2d=function(){var state=new State;return state.depthTest=!1,state.blend=!0,state},State}(),Filter=function(_super){function Filter(vertexSrc,fragmentSrc,uniforms){var _this=this,program=Program.from(vertexSrc||Filter.defaultVertexSrc,fragmentSrc||Filter.defaultFragmentSrc);return(_this=_super.call(this,program,uniforms)||this).padding=0,_this.resolution=settings.FILTER_RESOLUTION,_this.enabled=!0,_this.autoFit=!0,_this.legacy=!!_this.program.attributeData.aTextureCoord,_this.state=new State,_this}return __extends$3(Filter,_super),Filter.prototype.apply=function(filterManager,input,output,clearMode,_currentState){filterManager.applyFilter(this,input,output,clearMode)},Object.defineProperty(Filter.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(value){this.state.blendMode=value},enumerable:!1,configurable:!0}),Object.defineProperty(Filter,"defaultVertexSrc",{get:function(){return"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"},enumerable:!1,configurable:!0}),Object.defineProperty(Filter,"defaultFragmentSrc",{get:function(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"},enumerable:!1,configurable:!0}),Filter}(Shader),tempMat=new Matrix,TextureMatrix=function(){function TextureMatrix(texture,clampMargin){this._texture=texture,this.mapCoord=new Matrix,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===clampMargin?.5:clampMargin,this.isSimple=!1}return Object.defineProperty(TextureMatrix.prototype,"texture",{get:function(){return this._texture},set:function(value){this._texture=value,this._textureID=-1},enumerable:!1,configurable:!0}),TextureMatrix.prototype.multiplyUvs=function(uvs,out){void 0===out&&(out=uvs);for(var mat=this.mapCoord,i=0;i<uvs.length;i+=2){var x=uvs[i],y=uvs[i+1];out[i]=x*mat.a+y*mat.c+mat.tx,out[i+1]=x*mat.b+y*mat.d+mat.ty}return out},TextureMatrix.prototype.update=function(forceUpdate){var tex=this._texture;if(!tex||!tex.valid)return!1;if(!forceUpdate&&this._textureID===tex._updateID)return!1;this._textureID=tex._updateID,this._updateID++;var uvs=tex._uvs;this.mapCoord.set(uvs.x1-uvs.x0,uvs.y1-uvs.y0,uvs.x3-uvs.x0,uvs.y3-uvs.y0,uvs.x0,uvs.y0);var orig=tex.orig,trim=tex.trim;trim&&(tempMat.set(orig.width/trim.width,0,0,orig.height/trim.height,-trim.x/trim.width,-trim.y/trim.height),this.mapCoord.append(tempMat));var texBase=tex.baseTexture,frame=this.uClampFrame,margin=this.clampMargin/texBase.resolution,offset=this.clampOffset;return frame[0]=(tex._frame.x+margin+offset)/texBase.width,frame[1]=(tex._frame.y+margin+offset)/texBase.height,frame[2]=(tex._frame.x+tex._frame.width-margin+offset)/texBase.width,frame[3]=(tex._frame.y+tex._frame.height-margin+offset)/texBase.height,this.uClampOffset[0]=offset/texBase.realWidth,this.uClampOffset[1]=offset/texBase.realHeight,this.isSimple=tex._frame.width===texBase.width&&tex._frame.height===texBase.height&&0===tex.rotate,!0},TextureMatrix}(),SpriteMaskFilter=function(_super){function SpriteMaskFilter(sprite){var _this=this,maskMatrix=new Matrix;return _this=_super.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n")||this,sprite.renderable=!1,_this.maskSprite=sprite,_this.maskMatrix=maskMatrix,_this}return __extends$3(SpriteMaskFilter,_super),SpriteMaskFilter.prototype.apply=function(filterManager,input,output,clearMode){var maskSprite=this.maskSprite,tex=maskSprite._texture;tex.valid&&(tex.uvMatrix||(tex.uvMatrix=new TextureMatrix(tex,0)),tex.uvMatrix.update(),this.uniforms.npmAlpha=tex.baseTexture.alphaMode?0:1,this.uniforms.mask=tex,this.uniforms.otherMatrix=filterManager.calculateSpriteMatrix(this.maskMatrix,maskSprite).prepend(tex.uvMatrix.mapCoord),this.uniforms.alpha=maskSprite.worldAlpha,this.uniforms.maskClamp=tex.uvMatrix.uClampFrame,filterManager.applyFilter(this,input,output,clearMode))},SpriteMaskFilter}(Filter),MaskSystem=function(_super){function MaskSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.enableScissor=!1,_this.alphaMaskPool=[],_this.maskDataPool=[],_this.maskStack=[],_this.alphaMaskIndex=0,_this}return __extends$3(MaskSystem,_super),MaskSystem.prototype.setMaskStack=function(maskStack){this.maskStack=maskStack,this.renderer.scissor.setMaskStack(maskStack),this.renderer.stencil.setMaskStack(maskStack)},MaskSystem.prototype.push=function(target,maskDataOrTarget){var maskData=maskDataOrTarget;if(!maskData.isMaskData){var d=this.maskDataPool.pop()||new MaskData;d.pooled=!0,d.maskObject=maskDataOrTarget,maskData=d}switch(maskData.autoDetect&&this.detect(maskData),maskData.copyCountersOrReset(this.maskStack[this.maskStack.length-1]),maskData._target=target,maskData.type){case MASK_TYPES.SCISSOR:this.maskStack.push(maskData),this.renderer.scissor.push(maskData);break;case MASK_TYPES.STENCIL:this.maskStack.push(maskData),this.renderer.stencil.push(maskData);break;case MASK_TYPES.SPRITE:maskData.copyCountersOrReset(null),this.pushSpriteMask(maskData),this.maskStack.push(maskData)}},MaskSystem.prototype.pop=function(target){var maskData=this.maskStack.pop();if(maskData&&maskData._target===target){switch(maskData.type){case MASK_TYPES.SCISSOR:this.renderer.scissor.pop();break;case MASK_TYPES.STENCIL:this.renderer.stencil.pop(maskData.maskObject);break;case MASK_TYPES.SPRITE:this.popSpriteMask()}maskData.reset(),maskData.pooled&&this.maskDataPool.push(maskData)}},MaskSystem.prototype.detect=function(maskData){var maskObject=maskData.maskObject;if(maskObject.isSprite)maskData.type=MASK_TYPES.SPRITE;else if(maskData.type=MASK_TYPES.STENCIL,this.enableScissor&&maskObject.isFastRect&&maskObject.isFastRect()){var matrix=maskObject.worldTransform,rotX=Math.atan2(matrix.b,matrix.a),rotXY=Math.atan2(matrix.d,matrix.c);rotX=Math.round(rotX*(180/Math.PI)*100),rotXY=((rotXY=Math.round(rotXY*(180/Math.PI)*100)-rotX)%18e3+18e3)%18e3,0===(rotX=(rotX%9e3+9e3)%9e3)&&9e3===rotXY&&(maskData.type=MASK_TYPES.SCISSOR)}},MaskSystem.prototype.pushSpriteMask=function(maskData){var maskObject=maskData.maskObject,target=maskData._target,alphaMaskFilter=this.alphaMaskPool[this.alphaMaskIndex];alphaMaskFilter||(alphaMaskFilter=this.alphaMaskPool[this.alphaMaskIndex]=[new SpriteMaskFilter(maskObject)]),alphaMaskFilter[0].resolution=this.renderer.resolution,alphaMaskFilter[0].maskSprite=maskObject;var stashFilterArea=target.filterArea;target.filterArea=maskObject.getBounds(!0),this.renderer.filter.push(target,alphaMaskFilter),target.filterArea=stashFilterArea,this.alphaMaskIndex++},MaskSystem.prototype.popSpriteMask=function(){this.renderer.filter.pop(),this.alphaMaskIndex--},MaskSystem}(System),AbstractMaskSystem=function(_super){function AbstractMaskSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.maskStack=[],_this.glConst=0,_this}return __extends$3(AbstractMaskSystem,_super),AbstractMaskSystem.prototype.getStackLength=function(){return this.maskStack.length},AbstractMaskSystem.prototype.setMaskStack=function(maskStack){var gl=this.renderer.gl,curStackLen=this.getStackLength();this.maskStack=maskStack;var newStackLen=this.getStackLength();newStackLen!==curStackLen&&(0===newStackLen?gl.disable(this.glConst):(gl.enable(this.glConst),this._useCurrent()))},AbstractMaskSystem.prototype._useCurrent=function(){},AbstractMaskSystem.prototype.destroy=function(){_super.prototype.destroy.call(this),this.maskStack=null},AbstractMaskSystem}(System),ScissorSystem=function(_super){function ScissorSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.glConst=WebGLRenderingContext.SCISSOR_TEST,_this}return __extends$3(ScissorSystem,_super),ScissorSystem.prototype.getStackLength=function(){var maskData=this.maskStack[this.maskStack.length-1];return maskData?maskData._scissorCounter:0},ScissorSystem.prototype.push=function(maskData){var maskObject=maskData.maskObject;maskObject.renderable=!0;var prevData=maskData._scissorRect,bounds=maskObject.getBounds(!0),gl=this.renderer.gl;maskObject.renderable=!1,prevData?bounds.fit(prevData):gl.enable(gl.SCISSOR_TEST),maskData._scissorCounter++,maskData._scissorRect=bounds,this._useCurrent()},ScissorSystem.prototype.pop=function(){var gl=this.renderer.gl;this.getStackLength()>0?this._useCurrent():gl.disable(gl.SCISSOR_TEST)},ScissorSystem.prototype._useCurrent=function(){var rect=this.maskStack[this.maskStack.length-1]._scissorRect,rt=this.renderer.renderTexture.current,_a=this.renderer.projection,transform=_a.transform,sourceFrame=_a.sourceFrame,destinationFrame=_a.destinationFrame,resolution=rt?rt.resolution:this.renderer.resolution,x=(rect.x-sourceFrame.x)*resolution+destinationFrame.x,y=(rect.y-sourceFrame.y)*resolution+destinationFrame.y,width=rect.width*resolution,height=rect.height*resolution;transform&&(x+=transform.tx*resolution,y+=transform.ty*resolution),rt||(y=this.renderer.height-height-y),this.renderer.gl.scissor(x,y,width,height)},ScissorSystem}(AbstractMaskSystem),StencilSystem=function(_super){function StencilSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.glConst=WebGLRenderingContext.STENCIL_TEST,_this}return __extends$3(StencilSystem,_super),StencilSystem.prototype.getStackLength=function(){var maskData=this.maskStack[this.maskStack.length-1];return maskData?maskData._stencilCounter:0},StencilSystem.prototype.push=function(maskData){var maskObject=maskData.maskObject,gl=this.renderer.gl,prevMaskCount=maskData._stencilCounter;0===prevMaskCount&&(this.renderer.framebuffer.forceStencil(),gl.enable(gl.STENCIL_TEST)),maskData._stencilCounter++,gl.colorMask(!1,!1,!1,!1),gl.stencilFunc(gl.EQUAL,prevMaskCount,this._getBitwiseMask()),gl.stencilOp(gl.KEEP,gl.KEEP,gl.INCR),maskObject.renderable=!0,maskObject.render(this.renderer),this.renderer.batch.flush(),maskObject.renderable=!1,this._useCurrent()},StencilSystem.prototype.pop=function(maskObject){var gl=this.renderer.gl;0===this.getStackLength()?(gl.disable(gl.STENCIL_TEST),gl.clear(gl.STENCIL_BUFFER_BIT),gl.clearStencil(0)):(gl.colorMask(!1,!1,!1,!1),gl.stencilOp(gl.KEEP,gl.KEEP,gl.DECR),maskObject.renderable=!0,maskObject.render(this.renderer),this.renderer.batch.flush(),maskObject.renderable=!1,this._useCurrent())},StencilSystem.prototype._useCurrent=function(){var gl=this.renderer.gl;gl.colorMask(!0,!0,!0,!0),gl.stencilFunc(gl.EQUAL,this.getStackLength(),this._getBitwiseMask()),gl.stencilOp(gl.KEEP,gl.KEEP,gl.KEEP)},StencilSystem.prototype._getBitwiseMask=function(){return(1<<this.getStackLength())-1},StencilSystem}(AbstractMaskSystem),ProjectionSystem=function(_super){function ProjectionSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.destinationFrame=null,_this.sourceFrame=null,_this.defaultFrame=null,_this.projectionMatrix=new Matrix,_this.transform=null,_this}return __extends$3(ProjectionSystem,_super),ProjectionSystem.prototype.update=function(destinationFrame,sourceFrame,resolution,root){this.destinationFrame=destinationFrame||this.destinationFrame||this.defaultFrame,this.sourceFrame=sourceFrame||this.sourceFrame||destinationFrame,this.calculateProjection(this.destinationFrame,this.sourceFrame,resolution,root),this.transform&&this.projectionMatrix.append(this.transform);var renderer=this.renderer;renderer.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,renderer.globalUniforms.update(),renderer.shader.shader&&renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals)},ProjectionSystem.prototype.calculateProjection=function(_destinationFrame,sourceFrame,_resolution,root){var pm=this.projectionMatrix,sign=root?-1:1;pm.identity(),pm.a=1/sourceFrame.width*2,pm.d=sign*(1/sourceFrame.height*2),pm.tx=-1-sourceFrame.x*pm.a,pm.ty=-sign-sourceFrame.y*pm.d},ProjectionSystem.prototype.setTransform=function(_matrix){},ProjectionSystem}(System),tempRect=new Rectangle,tempRect2=new Rectangle,viewportFrame=new Rectangle,RenderTextureSystem=function(_super){function RenderTextureSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.clearColor=renderer._backgroundColorRgba,_this.defaultMaskStack=[],_this.current=null,_this.sourceFrame=new Rectangle,_this.destinationFrame=new Rectangle,_this}return __extends$3(RenderTextureSystem,_super),RenderTextureSystem.prototype.bind=function(renderTexture,sourceFrame,destinationFrame){void 0===renderTexture&&(renderTexture=null);var baseTexture,framebuffer,resolution,renderer=this.renderer;this.current=renderTexture,renderTexture?(resolution=(baseTexture=renderTexture.baseTexture).resolution,sourceFrame||(tempRect.width=renderTexture.frame.width,tempRect.height=renderTexture.frame.height,sourceFrame=tempRect),destinationFrame||(tempRect2.x=renderTexture.frame.x,tempRect2.y=renderTexture.frame.y,tempRect2.width=sourceFrame.width,tempRect2.height=sourceFrame.height,destinationFrame=tempRect2),framebuffer=baseTexture.framebuffer):(resolution=renderer.resolution,sourceFrame||(tempRect.width=renderer.screen.width,tempRect.height=renderer.screen.height,sourceFrame=tempRect),destinationFrame||((destinationFrame=tempRect).width=sourceFrame.width,destinationFrame.height=sourceFrame.height)),viewportFrame.x=destinationFrame.x*resolution,viewportFrame.y=destinationFrame.y*resolution,viewportFrame.width=destinationFrame.width*resolution,viewportFrame.height=destinationFrame.height*resolution,this.renderer.framebuffer.bind(framebuffer,viewportFrame),this.renderer.projection.update(destinationFrame,sourceFrame,resolution,!framebuffer),renderTexture?this.renderer.mask.setMaskStack(baseTexture.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(sourceFrame),this.destinationFrame.copyFrom(destinationFrame)},RenderTextureSystem.prototype.clear=function(clearColor,mask){clearColor=this.current?clearColor||this.current.baseTexture.clearColor:clearColor||this.clearColor,this.renderer.framebuffer.clear(clearColor[0],clearColor[1],clearColor[2],clearColor[3],mask)},RenderTextureSystem.prototype.resize=function(){this.bind(null)},RenderTextureSystem.prototype.reset=function(){this.bind(null)},RenderTextureSystem}(System),GLProgram=function(){function GLProgram(program,uniformData){this.program=program,this.uniformData=uniformData,this.uniformGroups={}}return GLProgram.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.program=null},GLProgram}(),UID$4=0,defaultSyncData={textureCount:0},ShaderSystem=function(_super){function ShaderSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.destroyed=!1,_this.systemCheck(),_this.gl=null,_this.shader=null,_this.program=null,_this.cache={},_this.id=UID$4++,_this}return __extends$3(ShaderSystem,_super),ShaderSystem.prototype.systemCheck=function(){if(!function(){if("boolean"==typeof unsafeEval)return unsafeEval;try{var func=new Function("param1","param2","param3","return param1[param2] === param3;");unsafeEval=!0===func({a:"b"},"a","b")}catch(e){unsafeEval=!1}return unsafeEval}())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")},ShaderSystem.prototype.contextChange=function(gl){this.gl=gl,this.reset()},ShaderSystem.prototype.bind=function(shader,dontSync){shader.uniforms.globals=this.renderer.globalUniforms;var program=shader.program,glProgram=program.glPrograms[this.renderer.CONTEXT_UID]||this.generateShader(shader);return this.shader=shader,this.program!==program&&(this.program=program,this.gl.useProgram(glProgram.program)),dontSync||(defaultSyncData.textureCount=0,this.syncUniformGroup(shader.uniformGroup,defaultSyncData)),glProgram},ShaderSystem.prototype.setUniforms=function(uniforms){var shader=this.shader.program,glProgram=shader.glPrograms[this.renderer.CONTEXT_UID];shader.syncUniforms(glProgram.uniformData,uniforms,this.renderer)},ShaderSystem.prototype.syncUniformGroup=function(group,syncData){var glProgram=this.getglProgram();group.static&&group.dirtyId===glProgram.uniformGroups[group.id]||(glProgram.uniformGroups[group.id]=group.dirtyId,this.syncUniforms(group,glProgram,syncData))},ShaderSystem.prototype.syncUniforms=function(group,glProgram,syncData){(group.syncUniforms[this.shader.program.id]||this.createSyncGroups(group))(glProgram.uniformData,group.uniforms,this.renderer,syncData)},ShaderSystem.prototype.createSyncGroups=function(group){var id=this.getSignature(group,this.shader.program.uniformData);return this.cache[id]||(this.cache[id]=function(group,uniformData){var funcFragments=["\n var v = null;\n var cv = null\n var t = 0;\n var gl = renderer.gl\n "];for(var i in group.uniforms){var data=uniformData[i];if(data){for(var uniform=group.uniforms[i],parsed=!1,j=0;j<uniformParsers.length;j++)if(uniformParsers[j].test(data,uniform)){funcFragments.push(uniformParsers[j].code(i,uniform)),parsed=!0;break}if(!parsed){var template=(1===data.size?GLSL_TO_SINGLE_SETTERS_CACHED:GLSL_TO_ARRAY_SETTERS)[data.type].replace("location",'ud["'+i+'"].location');funcFragments.push('\n cv = ud["'+i+'"].value;\n v = uv["'+i+'"];\n '+template+";")}}else group.uniforms[i].group&&funcFragments.push('\n renderer.shader.syncUniformGroup(uv["'+i+'"], syncData);\n ')}return new Function("ud","uv","renderer","syncData",funcFragments.join("\n"))}(group,this.shader.program.uniformData)),group.syncUniforms[this.shader.program.id]=this.cache[id],group.syncUniforms[this.shader.program.id]},ShaderSystem.prototype.getSignature=function(group,uniformData){var uniforms=group.uniforms,strings=[];for(var i in uniforms)strings.push(i),uniformData[i]&&strings.push(uniformData[i].type);return strings.join("-")},ShaderSystem.prototype.getglProgram=function(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null},ShaderSystem.prototype.generateShader=function(shader){var gl=this.gl,program=shader.program,attribMap={};for(var i in program.attributeData)attribMap[i]=program.attributeData[i].location;var shaderProgram=compileProgram(gl,program.vertexSrc,program.fragmentSrc,attribMap),uniformData={};for(var i in program.uniformData){var data=program.uniformData[i];uniformData[i]={location:gl.getUniformLocation(shaderProgram,i),value:defaultValue(data.type,data.size)}}var glProgram=new GLProgram(shaderProgram,uniformData);return program.glPrograms[this.renderer.CONTEXT_UID]=glProgram,glProgram},ShaderSystem.prototype.reset=function(){this.program=null,this.shader=null},ShaderSystem.prototype.destroy=function(){this.destroyed=!0},ShaderSystem}(System);var StateSystem=function(_super){function StateSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.gl=null,_this.stateId=0,_this.polygonOffset=0,_this.blendMode=BLEND_MODES.NONE,_this._blendEq=!1,_this.map=[],_this.map[0]=_this.setBlend,_this.map[1]=_this.setOffset,_this.map[2]=_this.setCullFace,_this.map[3]=_this.setDepthTest,_this.map[4]=_this.setFrontFace,_this.checks=[],_this.defaultState=new State,_this.defaultState.blend=!0,_this}return __extends$3(StateSystem,_super),StateSystem.prototype.contextChange=function(gl){this.gl=gl,this.blendModes=function(gl,array){return void 0===array&&(array=[]),array[BLEND_MODES.NORMAL]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.ADD]=[gl.ONE,gl.ONE],array[BLEND_MODES.MULTIPLY]=[gl.DST_COLOR,gl.ONE_MINUS_SRC_ALPHA,gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.SCREEN]=[gl.ONE,gl.ONE_MINUS_SRC_COLOR,gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.OVERLAY]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.DARKEN]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.LIGHTEN]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.COLOR_DODGE]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.COLOR_BURN]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.HARD_LIGHT]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.SOFT_LIGHT]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.DIFFERENCE]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.EXCLUSION]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.HUE]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.SATURATION]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.COLOR]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.LUMINOSITY]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.NONE]=[0,0],array[BLEND_MODES.NORMAL_NPM]=[gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA,gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.ADD_NPM]=[gl.SRC_ALPHA,gl.ONE,gl.ONE,gl.ONE],array[BLEND_MODES.SCREEN_NPM]=[gl.SRC_ALPHA,gl.ONE_MINUS_SRC_COLOR,gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.SRC_IN]=[gl.DST_ALPHA,gl.ZERO],array[BLEND_MODES.SRC_OUT]=[gl.ONE_MINUS_DST_ALPHA,gl.ZERO],array[BLEND_MODES.SRC_ATOP]=[gl.DST_ALPHA,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.DST_OVER]=[gl.ONE_MINUS_DST_ALPHA,gl.ONE],array[BLEND_MODES.DST_IN]=[gl.ZERO,gl.SRC_ALPHA],array[BLEND_MODES.DST_OUT]=[gl.ZERO,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.DST_ATOP]=[gl.ONE_MINUS_DST_ALPHA,gl.SRC_ALPHA],array[BLEND_MODES.XOR]=[gl.ONE_MINUS_DST_ALPHA,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES.SUBTRACT]=[gl.ONE,gl.ONE,gl.ONE,gl.ONE,gl.FUNC_REVERSE_SUBTRACT,gl.FUNC_ADD],array}(gl),this.set(this.defaultState),this.reset()},StateSystem.prototype.set=function(state){if(state=state||this.defaultState,this.stateId!==state.data){for(var diff=this.stateId^state.data,i=0;diff;)1&diff&&this.map[i].call(this,!!(state.data&1<<i)),diff>>=1,i++;this.stateId=state.data}for(i=0;i<this.checks.length;i++)this.checks[i](this,state)},StateSystem.prototype.forceState=function(state){state=state||this.defaultState;for(var i=0;i<this.map.length;i++)this.map[i].call(this,!!(state.data&1<<i));for(i=0;i<this.checks.length;i++)this.checks[i](this,state);this.stateId=state.data},StateSystem.prototype.setBlend=function(value){this.updateCheck(StateSystem.checkBlendMode,value),this.gl[value?"enable":"disable"](this.gl.BLEND)},StateSystem.prototype.setOffset=function(value){this.updateCheck(StateSystem.checkPolygonOffset,value),this.gl[value?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)},StateSystem.prototype.setDepthTest=function(value){this.gl[value?"enable":"disable"](this.gl.DEPTH_TEST)},StateSystem.prototype.setCullFace=function(value){this.gl[value?"enable":"disable"](this.gl.CULL_FACE)},StateSystem.prototype.setFrontFace=function(value){this.gl.frontFace(this.gl[value?"CW":"CCW"])},StateSystem.prototype.setBlendMode=function(value){if(value!==this.blendMode){this.blendMode=value;var mode=this.blendModes[value],gl=this.gl;2===mode.length?gl.blendFunc(mode[0],mode[1]):gl.blendFuncSeparate(mode[0],mode[1],mode[2],mode[3]),6===mode.length?(this._blendEq=!0,gl.blendEquationSeparate(mode[4],mode[5])):this._blendEq&&(this._blendEq=!1,gl.blendEquationSeparate(gl.FUNC_ADD,gl.FUNC_ADD))}},StateSystem.prototype.setPolygonOffset=function(value,scale){this.gl.polygonOffset(value,scale)},StateSystem.prototype.reset=function(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)},StateSystem.prototype.updateCheck=function(func,value){var index=this.checks.indexOf(func);value&&-1===index?this.checks.push(func):value||-1===index||this.checks.splice(index,1)},StateSystem.checkBlendMode=function(system,state){system.setBlendMode(state.blendMode)},StateSystem.checkPolygonOffset=function(system,state){system.setPolygonOffset(1,state.polygonOffset)},StateSystem}(System),TextureGCSystem=function(_super){function TextureGCSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.count=0,_this.checkCount=0,_this.maxIdle=settings.GC_MAX_IDLE,_this.checkCountMax=settings.GC_MAX_CHECK_COUNT,_this.mode=settings.GC_MODE,_this}return __extends$3(TextureGCSystem,_super),TextureGCSystem.prototype.postrender=function(){this.renderer.renderingToScreen&&(this.count++,this.mode!==GC_MODES.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))},TextureGCSystem.prototype.run=function(){for(var tm=this.renderer.texture,managedTextures=tm.managedTextures,wasRemoved=!1,i=0;i<managedTextures.length;i++){var texture=managedTextures[i];!texture.framebuffer&&this.count-texture.touched>this.maxIdle&&(tm.destroyTexture(texture,!0),managedTextures[i]=null,wasRemoved=!0)}if(wasRemoved){var j=0;for(i=0;i<managedTextures.length;i++)null!==managedTextures[i]&&(managedTextures[j++]=managedTextures[i]);managedTextures.length=j}},TextureGCSystem.prototype.unload=function(displayObject){var tm=this.renderer.texture,texture=displayObject._texture;texture&&!texture.framebuffer&&tm.destroyTexture(texture);for(var i=displayObject.children.length-1;i>=0;i--)this.unload(displayObject.children[i])},TextureGCSystem}(System),GLTexture=function(texture){this.texture=texture,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=6408,this.internalFormat=5121},TextureSystem=function(_super){function TextureSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.boundTextures=[],_this.currentLocation=-1,_this.managedTextures=[],_this._unknownBoundTextures=!1,_this.unknownTexture=new BaseTexture,_this}return __extends$3(TextureSystem,_super),TextureSystem.prototype.contextChange=function(){var gl=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion;var maxTextures=gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=maxTextures;for(var i=0;i<maxTextures;i++)this.boundTextures[i]=null;this.emptyTextures={};var emptyTexture2D=new GLTexture(gl.createTexture());gl.bindTexture(gl.TEXTURE_2D,emptyTexture2D.texture),gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[gl.TEXTURE_2D]=emptyTexture2D,this.emptyTextures[gl.TEXTURE_CUBE_MAP]=new GLTexture(gl.createTexture()),gl.bindTexture(gl.TEXTURE_CUBE_MAP,this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);for(i=0;i<6;i++)gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,null);gl.texParameteri(gl.TEXTURE_CUBE_MAP,gl.TEXTURE_MAG_FILTER,gl.LINEAR),gl.texParameteri(gl.TEXTURE_CUBE_MAP,gl.TEXTURE_MIN_FILTER,gl.LINEAR);for(i=0;i<this.boundTextures.length;i++)this.bind(null,i)},TextureSystem.prototype.bind=function(texture,location){void 0===location&&(location=0);var gl=this.gl;if(texture){if((texture=texture.castToBaseTexture()).parentTextureArray)return;if(texture.valid){texture.touched=this.renderer.textureGC.count;var glTexture=texture._glTextures[this.CONTEXT_UID]||this.initTexture(texture);this.boundTextures[location]!==texture&&(this.currentLocation!==location&&(this.currentLocation=location,gl.activeTexture(gl.TEXTURE0+location)),gl.bindTexture(texture.target,glTexture.texture)),glTexture.dirtyId!==texture.dirtyId&&(this.currentLocation!==location&&(this.currentLocation=location,gl.activeTexture(gl.TEXTURE0+location)),this.updateTexture(texture)),this.boundTextures[location]=texture}}else this.currentLocation!==location&&(this.currentLocation=location,gl.activeTexture(gl.TEXTURE0+location)),gl.bindTexture(gl.TEXTURE_2D,this.emptyTextures[gl.TEXTURE_2D].texture),this.boundTextures[location]=null},TextureSystem.prototype.reset=function(){this._unknownBoundTextures=!0,this.currentLocation=-1;for(var i=0;i<this.boundTextures.length;i++)this.boundTextures[i]=this.unknownTexture},TextureSystem.prototype.unbind=function(texture){var gl=this.gl,boundTextures=this.boundTextures;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(var i=0;i<boundTextures.length;i++)boundTextures[i]===this.unknownTexture&&this.bind(null,i)}for(i=0;i<boundTextures.length;i++)boundTextures[i]===texture&&(this.currentLocation!==i&&(gl.activeTexture(gl.TEXTURE0+i),this.currentLocation=i),gl.bindTexture(texture.target,this.emptyTextures[texture.target].texture),boundTextures[i]=null)},TextureSystem.prototype.initTexture=function(texture){var glTexture=new GLTexture(this.gl.createTexture());return glTexture.dirtyId=-1,texture._glTextures[this.CONTEXT_UID]=glTexture,this.managedTextures.push(texture),texture.on("dispose",this.destroyTexture,this),glTexture},TextureSystem.prototype.initTextureType=function(texture,glTexture){if(glTexture.internalFormat=texture.format,glTexture.type=texture.type,2===this.webGLVersion){var gl=this.renderer.gl;texture.type===gl.FLOAT&&texture.format===gl.RGBA&&(glTexture.internalFormat=gl.RGBA32F),texture.type===TYPES.HALF_FLOAT&&(glTexture.type=gl.HALF_FLOAT),glTexture.type===gl.HALF_FLOAT&&texture.format===gl.RGBA&&(glTexture.internalFormat=gl.RGBA16F)}},TextureSystem.prototype.updateTexture=function(texture){var glTexture=texture._glTextures[this.CONTEXT_UID];if(glTexture){var renderer=this.renderer;if(this.initTextureType(texture,glTexture),texture.resource&&texture.resource.upload(renderer,texture,glTexture));else{var width=texture.realWidth,height=texture.realHeight,gl=renderer.gl;(glTexture.width!==width||glTexture.height!==height||glTexture.dirtyId<0)&&(glTexture.width=width,glTexture.height=height,gl.texImage2D(texture.target,0,glTexture.internalFormat,width,height,0,texture.format,glTexture.type,null))}texture.dirtyStyleId!==glTexture.dirtyStyleId&&this.updateTextureStyle(texture),glTexture.dirtyId=texture.dirtyId}},TextureSystem.prototype.destroyTexture=function(texture,skipRemove){var gl=this.gl;if((texture=texture.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(texture),gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture),texture.off("dispose",this.destroyTexture,this),delete texture._glTextures[this.CONTEXT_UID],!skipRemove)){var i=this.managedTextures.indexOf(texture);-1!==i&&removeItems(this.managedTextures,i,1)}},TextureSystem.prototype.updateTextureStyle=function(texture){var glTexture=texture._glTextures[this.CONTEXT_UID];glTexture&&(texture.mipmap!==MIPMAP_MODES.POW2&&2===this.webGLVersion||texture.isPowerOfTwo?glTexture.mipmap=texture.mipmap>=1:glTexture.mipmap=!1,2===this.webGLVersion||texture.isPowerOfTwo?glTexture.wrapMode=texture.wrapMode:glTexture.wrapMode=WRAP_MODES.CLAMP,texture.resource&&texture.resource.style(this.renderer,texture,glTexture)||this.setStyle(texture,glTexture),glTexture.dirtyStyleId=texture.dirtyStyleId)},TextureSystem.prototype.setStyle=function(texture,glTexture){var gl=this.gl;if(glTexture.mipmap&&gl.generateMipmap(texture.target),gl.texParameteri(texture.target,gl.TEXTURE_WRAP_S,glTexture.wrapMode),gl.texParameteri(texture.target,gl.TEXTURE_WRAP_T,glTexture.wrapMode),glTexture.mipmap){gl.texParameteri(texture.target,gl.TEXTURE_MIN_FILTER,texture.scaleMode===SCALE_MODES.LINEAR?gl.LINEAR_MIPMAP_LINEAR:gl.NEAREST_MIPMAP_NEAREST);var anisotropicExt=this.renderer.context.extensions.anisotropicFiltering;if(anisotropicExt&&texture.anisotropicLevel>0&&texture.scaleMode===SCALE_MODES.LINEAR){var level=Math.min(texture.anisotropicLevel,gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));gl.texParameterf(texture.target,anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT,level)}}else gl.texParameteri(texture.target,gl.TEXTURE_MIN_FILTER,texture.scaleMode===SCALE_MODES.LINEAR?gl.LINEAR:gl.NEAREST);gl.texParameteri(texture.target,gl.TEXTURE_MAG_FILTER,texture.scaleMode===SCALE_MODES.LINEAR?gl.LINEAR:gl.NEAREST)},TextureSystem}(System),tempMatrix=new Matrix,Renderer=function(_super){function Renderer(options){var _this=_super.call(this,RENDERER_TYPE.WEBGL,options)||this;return options=_this.options,_this.gl=null,_this.CONTEXT_UID=0,_this.runners={destroy:new Runner("destroy"),contextChange:new Runner("contextChange"),reset:new Runner("reset"),update:new Runner("update"),postrender:new Runner("postrender"),prerender:new Runner("prerender"),resize:new Runner("resize")},_this.globalUniforms=new UniformGroup({projectionMatrix:new Matrix},!0),_this.addSystem(MaskSystem,"mask").addSystem(ContextSystem,"context").addSystem(StateSystem,"state").addSystem(ShaderSystem,"shader").addSystem(TextureSystem,"texture").addSystem(GeometrySystem,"geometry").addSystem(FramebufferSystem,"framebuffer").addSystem(ScissorSystem,"scissor").addSystem(StencilSystem,"stencil").addSystem(ProjectionSystem,"projection").addSystem(TextureGCSystem,"textureGC").addSystem(FilterSystem,"filter").addSystem(RenderTextureSystem,"renderTexture").addSystem(BatchSystem,"batch"),_this.initPlugins(Renderer.__plugins),options.context?_this.context.initFromContext(options.context):_this.context.initFromOptions({alpha:!!_this.transparent,antialias:options.antialias,premultipliedAlpha:_this.transparent&&"notMultiplied"!==_this.transparent,stencil:!0,preserveDrawingBuffer:options.preserveDrawingBuffer,powerPreference:_this.options.powerPreference}),_this.renderingToScreen=!0,function(type){var _a;if(!saidHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var args=["\n %c %c %c PixiJS 5.3.11 - ✰ "+type+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(_a=window.console).log.apply(_a,args)}else window.console&&window.console.log("PixiJS 5.3.11 - "+type+" - http://www.pixijs.com/");saidHello=!0}}(2===_this.context.webGLVersion?"WebGL 2":"WebGL 1"),_this.resize(_this.options.width,_this.options.height),_this}return __extends$3(Renderer,_super),Renderer.create=function(options){if(void 0===supported&&(supported=function(){var contextOptions={stencil:!0,failIfMajorPerformanceCaveat:settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!window.WebGLRenderingContext)return!1;var canvas=document.createElement("canvas"),gl=canvas.getContext("webgl",contextOptions)||canvas.getContext("experimental-webgl",contextOptions),success=!(!gl||!gl.getContextAttributes().stencil);if(gl){var loseContext=gl.getExtension("WEBGL_lose_context");loseContext&&loseContext.loseContext()}return gl=null,success}catch(e){return!1}}()),supported)return new Renderer(options);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},Renderer.prototype.addSystem=function(ClassRef,name){name||(name=ClassRef.name);var system=new ClassRef(this);if(this[name])throw new Error('Whoops! The name "'+name+'" is already in use');for(var i in this[name]=system,this.runners)this.runners[i].add(system);return this},Renderer.prototype.render=function(displayObject,renderTexture,clear,transform,skipUpdateTransform){if(this.renderingToScreen=!renderTexture,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=transform,!this.context.isLost){if(renderTexture||(this._lastObjectRendered=displayObject),!skipUpdateTransform){var cacheParent=displayObject.enableTempParent();displayObject.updateTransform(),displayObject.disableTempParent(cacheParent)}this.renderTexture.bind(renderTexture),this.batch.currentRenderer.start(),(void 0!==clear?clear:this.clearBeforeRender)&&this.renderTexture.clear(),displayObject.render(this),this.batch.currentRenderer.flush(),renderTexture&&renderTexture.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},Renderer.prototype.resize=function(screenWidth,screenHeight){_super.prototype.resize.call(this,screenWidth,screenHeight),this.runners.resize.emit(screenWidth,screenHeight)},Renderer.prototype.reset=function(){return this.runners.reset.emit(),this},Renderer.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},Renderer.prototype.destroy=function(removeView){for(var r in this.runners.destroy.emit(),this.runners)this.runners[r].destroy();_super.prototype.destroy.call(this,removeView),this.gl=null},Renderer.registerPlugin=function(pluginName,ctor){Renderer.__plugins=Renderer.__plugins||{},Renderer.__plugins[pluginName]=ctor},Renderer}(function(_super){function AbstractRenderer(type,options){void 0===type&&(type=RENDERER_TYPE.UNKNOWN);var _this=_super.call(this)||this;return(options=Object.assign({},settings.RENDER_OPTIONS,options)).roundPixels&&(settings.ROUND_PIXELS=options.roundPixels,deprecation("5.0.0","Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS",2)),_this.options=options,_this.type=type,_this.screen=new Rectangle(0,0,options.width,options.height),_this.view=options.view||document.createElement("canvas"),_this.resolution=options.resolution||settings.RESOLUTION,_this.transparent=options.transparent,_this.autoDensity=options.autoDensity||options.autoResize||!1,_this.preserveDrawingBuffer=options.preserveDrawingBuffer,_this.clearBeforeRender=options.clearBeforeRender,_this._backgroundColor=0,_this._backgroundColorRgba=[0,0,0,0],_this._backgroundColorString="#000000",_this.backgroundColor=options.backgroundColor||_this._backgroundColor,_this._lastObjectRendered=null,_this.plugins={},_this}return __extends$3(AbstractRenderer,_super),AbstractRenderer.prototype.initPlugins=function(staticMap){for(var o in staticMap)this.plugins[o]=new staticMap[o](this)},Object.defineProperty(AbstractRenderer.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(AbstractRenderer.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),AbstractRenderer.prototype.resize=function(screenWidth,screenHeight){this.screen.width=screenWidth,this.screen.height=screenHeight,this.view.width=screenWidth*this.resolution,this.view.height=screenHeight*this.resolution,this.autoDensity&&(this.view.style.width=screenWidth+"px",this.view.style.height=screenHeight+"px"),this.emit("resize",screenWidth,screenHeight)},AbstractRenderer.prototype.generateTexture=function(displayObject,scaleMode,resolution,region){0===(region=region||displayObject.getLocalBounds(null,!0)).width&&(region.width=1),0===region.height&&(region.height=1);var renderTexture=RenderTexture.create({width:0|region.width,height:0|region.height,scaleMode:scaleMode,resolution:resolution});return tempMatrix.tx=-region.x,tempMatrix.ty=-region.y,this.render(displayObject,renderTexture,!1,tempMatrix,!!displayObject.parent),renderTexture},AbstractRenderer.prototype.destroy=function(removeView){for(var o in this.plugins)this.plugins[o].destroy(),this.plugins[o]=null;removeView&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);this.plugins=null,this.type=RENDERER_TYPE.UNKNOWN,this.view=null,this.screen=null,this._tempDisplayObjectParent=null,this.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(AbstractRenderer.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(value){this._backgroundColor=value,this._backgroundColorString=hex2string(value),hex2rgb(value,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),AbstractRenderer}(eventemitter3));var defaultFilter="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",BatchDrawCall=function(){this.texArray=null,this.blend=0,this.type=DRAW_MODES.TRIANGLES,this.start=0,this.size=0,this.data=null},BatchTextureArray=function(){function BatchTextureArray(){this.elements=[],this.ids=[],this.count=0}return BatchTextureArray.prototype.clear=function(){for(var i=0;i<this.count;i++)this.elements[i]=null;this.count=0},BatchTextureArray}(),ViewableBuffer=function(){function ViewableBuffer(size){this.rawBinaryData=new ArrayBuffer(size),this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}return Object.defineProperty(ViewableBuffer.prototype,"int8View",{get:function(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View},enumerable:!1,configurable:!0}),Object.defineProperty(ViewableBuffer.prototype,"uint8View",{get:function(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View},enumerable:!1,configurable:!0}),Object.defineProperty(ViewableBuffer.prototype,"int16View",{get:function(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View},enumerable:!1,configurable:!0}),Object.defineProperty(ViewableBuffer.prototype,"uint16View",{get:function(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View},enumerable:!1,configurable:!0}),Object.defineProperty(ViewableBuffer.prototype,"int32View",{get:function(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View},enumerable:!1,configurable:!0}),ViewableBuffer.prototype.view=function(type){return this[type+"View"]},ViewableBuffer.prototype.destroy=function(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null},ViewableBuffer.sizeOf=function(type){switch(type){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(type+" isn't a valid view type")}},ViewableBuffer}(),AbstractBatchRenderer=function(_super){function AbstractBatchRenderer(renderer){var _this=_super.call(this,renderer)||this;return _this.shaderGenerator=null,_this.geometryClass=null,_this.vertexSize=null,_this.state=State.for2d(),_this.size=4*settings.SPRITE_BATCH_SIZE,_this._vertexCount=0,_this._indexCount=0,_this._bufferedElements=[],_this._bufferedTextures=[],_this._bufferSize=0,_this._shader=null,_this._packedGeometries=[],_this._packedGeometryPoolSize=2,_this._flushId=0,_this._aBuffers={},_this._iBuffers={},_this.MAX_TEXTURES=1,_this.renderer.on("prerender",_this.onPrerender,_this),renderer.runners.contextChange.add(_this),_this._dcIndex=0,_this._aIndex=0,_this._iIndex=0,_this._attributeBuffer=null,_this._indexBuffer=null,_this._tempBoundTextures=[],_this}return __extends$3(AbstractBatchRenderer,_super),AbstractBatchRenderer.prototype.contextChange=function(){var gl=this.renderer.gl;settings.PREFER_ENV===ENV.WEBGL_LEGACY?this.MAX_TEXTURES=1:(this.MAX_TEXTURES=Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),settings.SPRITE_MAX_TEXTURES),this.MAX_TEXTURES=function(maxIfs,gl){if(0===maxIfs)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");for(var shader=gl.createShader(gl.FRAGMENT_SHADER);;){var fragmentSrc=fragTemplate.replace(/%forloop%/gi,generateIfTestSrc(maxIfs));if(gl.shaderSource(shader,fragmentSrc),gl.compileShader(shader),gl.getShaderParameter(shader,gl.COMPILE_STATUS))break;maxIfs=maxIfs/2|0}return maxIfs}(this.MAX_TEXTURES,gl)),this._shader=this.shaderGenerator.generateShader(this.MAX_TEXTURES);for(var i=0;i<this._packedGeometryPoolSize;i++)this._packedGeometries[i]=new this.geometryClass;this.initFlushBuffers()},AbstractBatchRenderer.prototype.initFlushBuffers=function(){for(var _drawCallPool=AbstractBatchRenderer._drawCallPool,_textureArrayPool=AbstractBatchRenderer._textureArrayPool,MAX_SPRITES=this.size/4,MAX_TA=Math.floor(MAX_SPRITES/this.MAX_TEXTURES)+1;_drawCallPool.length<MAX_SPRITES;)_drawCallPool.push(new BatchDrawCall);for(;_textureArrayPool.length<MAX_TA;)_textureArrayPool.push(new BatchTextureArray);for(var i=0;i<this.MAX_TEXTURES;i++)this._tempBoundTextures[i]=null},AbstractBatchRenderer.prototype.onPrerender=function(){this._flushId=0},AbstractBatchRenderer.prototype.render=function(element){element._texture.valid&&(this._vertexCount+element.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=element.vertexData.length/2,this._indexCount+=element.indices.length,this._bufferedTextures[this._bufferSize]=element._texture.baseTexture,this._bufferedElements[this._bufferSize++]=element)},AbstractBatchRenderer.prototype.buildTexturesAndDrawCalls=function(){var textures=this._bufferedTextures,MAX_TEXTURES=this.MAX_TEXTURES,textureArrays=AbstractBatchRenderer._textureArrayPool,batch=this.renderer.batch,boundTextures=this._tempBoundTextures,touch=this.renderer.textureGC.count,TICK=++BaseTexture._globalBatch,countTexArrays=0,texArray=textureArrays[0],start=0;batch.copyBoundTextures(boundTextures,MAX_TEXTURES);for(var i=0;i<this._bufferSize;++i){var tex=textures[i];textures[i]=null,tex._batchEnabled!==TICK&&(texArray.count>=MAX_TEXTURES&&(batch.boundArray(texArray,boundTextures,TICK,MAX_TEXTURES),this.buildDrawCalls(texArray,start,i),start=i,texArray=textureArrays[++countTexArrays],++TICK),tex._batchEnabled=TICK,tex.touched=touch,texArray.elements[texArray.count++]=tex)}texArray.count>0&&(batch.boundArray(texArray,boundTextures,TICK,MAX_TEXTURES),this.buildDrawCalls(texArray,start,this._bufferSize),++countTexArrays,++TICK);for(i=0;i<boundTextures.length;i++)boundTextures[i]=null;BaseTexture._globalBatch=TICK},AbstractBatchRenderer.prototype.buildDrawCalls=function(texArray,start,finish){var elements=this._bufferedElements,_attributeBuffer=this._attributeBuffer,_indexBuffer=this._indexBuffer,vertexSize=this.vertexSize,drawCalls=AbstractBatchRenderer._drawCallPool,dcIndex=this._dcIndex,aIndex=this._aIndex,iIndex=this._iIndex,drawCall=drawCalls[dcIndex];drawCall.start=this._iIndex,drawCall.texArray=texArray;for(var i=start;i<finish;++i){var sprite=elements[i],tex=sprite._texture.baseTexture,spriteBlendMode=premultiplyBlendMode[tex.alphaMode?1:0][sprite.blendMode];elements[i]=null,start<i&&drawCall.blend!==spriteBlendMode&&(drawCall.size=iIndex-drawCall.start,start=i,(drawCall=drawCalls[++dcIndex]).texArray=texArray,drawCall.start=iIndex),this.packInterleavedGeometry(sprite,_attributeBuffer,_indexBuffer,aIndex,iIndex),aIndex+=sprite.vertexData.length/2*vertexSize,iIndex+=sprite.indices.length,drawCall.blend=spriteBlendMode}start<finish&&(drawCall.size=iIndex-drawCall.start,++dcIndex),this._dcIndex=dcIndex,this._aIndex=aIndex,this._iIndex=iIndex},AbstractBatchRenderer.prototype.bindAndClearTexArray=function(texArray){for(var textureSystem=this.renderer.texture,j=0;j<texArray.count;j++)textureSystem.bind(texArray.elements[j],texArray.ids[j]),texArray.elements[j]=null;texArray.count=0},AbstractBatchRenderer.prototype.updateGeometry=function(){var packedGeometries=this._packedGeometries,attributeBuffer=this._attributeBuffer,indexBuffer=this._indexBuffer;settings.CAN_UPLOAD_SAME_BUFFER?(packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData),packedGeometries[this._flushId]._indexBuffer.update(indexBuffer),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,packedGeometries[this._flushId]=new this.geometryClass),packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData),packedGeometries[this._flushId]._indexBuffer.update(indexBuffer),this.renderer.geometry.bind(packedGeometries[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)},AbstractBatchRenderer.prototype.drawBatches=function(){for(var dcCount=this._dcIndex,_a=this.renderer,gl=_a.gl,stateSystem=_a.state,drawCalls=AbstractBatchRenderer._drawCallPool,curTexArray=null,i=0;i<dcCount;i++){var _b=drawCalls[i],texArray=_b.texArray,type=_b.type,size=_b.size,start=_b.start,blend=_b.blend;curTexArray!==texArray&&(curTexArray=texArray,this.bindAndClearTexArray(texArray)),this.state.blendMode=blend,stateSystem.set(this.state),gl.drawElements(type,size,gl.UNSIGNED_SHORT,2*start)}},AbstractBatchRenderer.prototype.flush=function(){0!==this._vertexCount&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)},AbstractBatchRenderer.prototype.start=function(){this.renderer.state.set(this.state),this.renderer.shader.bind(this._shader),settings.CAN_UPLOAD_SAME_BUFFER&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])},AbstractBatchRenderer.prototype.stop=function(){this.flush()},AbstractBatchRenderer.prototype.destroy=function(){for(var i=0;i<this._packedGeometryPoolSize;i++)this._packedGeometries[i]&&this._packedGeometries[i].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),_super.prototype.destroy.call(this)},AbstractBatchRenderer.prototype.getAttributeBuffer=function(size){var roundedP2=nextPow2(Math.ceil(size/8)),roundedSizeIndex=log2(roundedP2),roundedSize=8*roundedP2;this._aBuffers.length<=roundedSizeIndex&&(this._iBuffers.length=roundedSizeIndex+1);var buffer=this._aBuffers[roundedSize];return buffer||(this._aBuffers[roundedSize]=buffer=new ViewableBuffer(roundedSize*this.vertexSize*4)),buffer},AbstractBatchRenderer.prototype.getIndexBuffer=function(size){var roundedP2=nextPow2(Math.ceil(size/12)),roundedSizeIndex=log2(roundedP2),roundedSize=12*roundedP2;this._iBuffers.length<=roundedSizeIndex&&(this._iBuffers.length=roundedSizeIndex+1);var buffer=this._iBuffers[roundedSizeIndex];return buffer||(this._iBuffers[roundedSizeIndex]=buffer=new Uint16Array(roundedSize)),buffer},AbstractBatchRenderer.prototype.packInterleavedGeometry=function(element,attributeBuffer,indexBuffer,aIndex,iIndex){for(var uint32View=attributeBuffer.uint32View,float32View=attributeBuffer.float32View,packedVertices=aIndex/this.vertexSize,uvs=element.uvs,indicies=element.indices,vertexData=element.vertexData,textureId=element._texture.baseTexture._batchLocation,alpha=Math.min(element.worldAlpha,1),argb=alpha<1&&element._texture.baseTexture.alphaMode?premultiplyTint(element._tintRGB,alpha):element._tintRGB+(255*alpha<<24),i=0;i<vertexData.length;i+=2)float32View[aIndex++]=vertexData[i],float32View[aIndex++]=vertexData[i+1],float32View[aIndex++]=uvs[i],float32View[aIndex++]=uvs[i+1],uint32View[aIndex++]=argb,float32View[aIndex++]=textureId;for(i=0;i<indicies.length;i++)indexBuffer[iIndex++]=packedVertices+indicies[i]},AbstractBatchRenderer._drawCallPool=[],AbstractBatchRenderer._textureArrayPool=[],AbstractBatchRenderer}(ObjectRenderer),BatchShaderGenerator=function(){function BatchShaderGenerator(vertexSrc,fragTemplate){if(this.vertexSrc=vertexSrc,this.fragTemplate=fragTemplate,this.programCache={},this.defaultGroupCache={},fragTemplate.indexOf("%count%")<0)throw new Error('Fragment template must contain "%count%".');if(fragTemplate.indexOf("%forloop%")<0)throw new Error('Fragment template must contain "%forloop%".')}return BatchShaderGenerator.prototype.generateShader=function(maxTextures){if(!this.programCache[maxTextures]){for(var sampleValues=new Int32Array(maxTextures),i=0;i<maxTextures;i++)sampleValues[i]=i;this.defaultGroupCache[maxTextures]=UniformGroup.from({uSamplers:sampleValues},!0);var fragmentSrc=this.fragTemplate;fragmentSrc=(fragmentSrc=fragmentSrc.replace(/%count%/gi,""+maxTextures)).replace(/%forloop%/gi,this.generateSampleSrc(maxTextures)),this.programCache[maxTextures]=new Program(this.vertexSrc,fragmentSrc)}var uniforms={tint:new Float32Array([1,1,1,1]),translationMatrix:new Matrix,default:this.defaultGroupCache[maxTextures]};return new Shader(this.programCache[maxTextures],uniforms)},BatchShaderGenerator.prototype.generateSampleSrc=function(maxTextures){var src="";src+="\n",src+="\n";for(var i=0;i<maxTextures;i++)i>0&&(src+="\nelse "),i<maxTextures-1&&(src+="if(vTextureId < "+i+".5)"),src+="\n{",src+="\n\tcolor = texture2D(uSamplers["+i+"], vTextureCoord);",src+="\n}";return src+="\n",src+="\n"},BatchShaderGenerator}(),BatchGeometry=function(_super){function BatchGeometry(_static){void 0===_static&&(_static=!1);var _this=_super.call(this)||this;return _this._buffer=new Buffer(null,_static,!1),_this._indexBuffer=new Buffer(null,_static,!0),_this.addAttribute("aVertexPosition",_this._buffer,2,!1,TYPES.FLOAT).addAttribute("aTextureCoord",_this._buffer,2,!1,TYPES.FLOAT).addAttribute("aColor",_this._buffer,4,!0,TYPES.UNSIGNED_BYTE).addAttribute("aTextureId",_this._buffer,1,!0,TYPES.FLOAT).addIndex(_this._indexBuffer),_this}return __extends$3(BatchGeometry,_super),BatchGeometry}(Geometry),defaultVertex$2="precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n",defaultFragment$2="varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n vec4 color;\n %forloop%\n gl_FragColor = color * vColor;\n}\n",BatchRenderer=function(){function BatchPluginFactory(){}return BatchPluginFactory.create=function(options){var _a=Object.assign({vertex:defaultVertex$2,fragment:defaultFragment$2,geometryClass:BatchGeometry,vertexSize:6},options),vertex=_a.vertex,fragment=_a.fragment,vertexSize=_a.vertexSize,geometryClass=_a.geometryClass;return function(_super){function BatchPlugin(renderer){var _this=_super.call(this,renderer)||this;return _this.shaderGenerator=new BatchShaderGenerator(vertex,fragment),_this.geometryClass=geometryClass,_this.vertexSize=vertexSize,_this}return __extends$3(BatchPlugin,_super),BatchPlugin}(AbstractBatchRenderer)},Object.defineProperty(BatchPluginFactory,"defaultVertexSrc",{get:function(){return defaultVertex$2},enumerable:!1,configurable:!0}),Object.defineProperty(BatchPluginFactory,"defaultFragmentTemplate",{get:function(){return defaultFragment$2},enumerable:!1,configurable:!0}),BatchPluginFactory}().create(),Application=function(){function Application(options){var _this=this;options=Object.assign({forceCanvas:!1},options),this.renderer=function(options){return Renderer.create(options)}(options),this.stage=new Container,Application._plugins.forEach((function(plugin){plugin.init.call(_this,options)}))}return Application.registerPlugin=function(plugin){Application._plugins.push(plugin)},Application.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(Application.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(Application.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),Application.prototype.destroy=function(removeView,stageOptions){var _this=this,plugins=Application._plugins.slice(0);plugins.reverse(),plugins.forEach((function(plugin){plugin.destroy.call(_this)})),this.stage.destroy(stageOptions),this.stage=null,this.renderer.destroy(removeView),this.renderer=null},Application}();Application._plugins=[];var ResizePlugin=function(){function ResizePlugin(){}return ResizePlugin.init=function(options){var _this=this;Object.defineProperty(this,"resizeTo",{set:function(dom){window.removeEventListener("resize",this.queueResize),this._resizeTo=dom,dom&&(window.addEventListener("resize",this.queueResize),this.resize())},get:function(){return this._resizeTo}}),this.queueResize=function(){_this._resizeTo&&(_this.cancelResize(),_this._resizeId=requestAnimationFrame((function(){return _this.resize()})))},this.cancelResize=function(){_this._resizeId&&(cancelAnimationFrame(_this._resizeId),_this._resizeId=null)},this.resize=function(){if(_this._resizeTo){var width,height;if(_this.cancelResize(),_this._resizeTo===window)width=window.innerWidth,height=window.innerHeight;else{var _a=_this._resizeTo;width=_a.clientWidth,height=_a.clientHeight}_this.renderer.resize(width,height)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=options.resizeTo||null},ResizePlugin.destroy=function(){window.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},ResizePlugin}();Application.registerPlugin(ResizePlugin);
|
|
103
|
+
***************************************************************************** */var extendStatics$3=function(d,b){return extendStatics$3=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$3(d,b)};function __extends$3(d,b){function __(){this.constructor=d}extendStatics$3(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var __assign$1=function(){return __assign$1=Object.assign||function(t){for(var s,arguments$1=arguments,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments$1[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t},__assign$1.apply(this,arguments)};var Resource=function(){function Resource(width,height){void 0===width&&(width=0),void 0===height&&(height=0),this._width=width,this._height=height,this.destroyed=!1,this.internal=!1,this.onResize=new Runner("setRealSize"),this.onUpdate=new Runner("update"),this.onError=new Runner("onError")}return Resource.prototype.bind=function(baseTexture){this.onResize.add(baseTexture),this.onUpdate.add(baseTexture),this.onError.add(baseTexture),(this._width||this._height)&&this.onResize.emit(this._width,this._height)},Resource.prototype.unbind=function(baseTexture){this.onResize.remove(baseTexture),this.onUpdate.remove(baseTexture),this.onError.remove(baseTexture)},Resource.prototype.resize=function(width,height){width===this._width&&height===this._height||(this._width=width,this._height=height,this.onResize.emit(width,height))},Object.defineProperty(Resource.prototype,"valid",{get:function(){return!!this._width&&!!this._height},enumerable:!1,configurable:!0}),Resource.prototype.update=function(){this.destroyed||this.onUpdate.emit()},Resource.prototype.load=function(){return Promise.resolve(this)},Object.defineProperty(Resource.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(Resource.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),Resource.prototype.style=function(_renderer,_baseTexture,_glTexture){return!1},Resource.prototype.dispose=function(){},Resource.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)},Resource.test=function(_source,_extension){return!1},Resource}(),BufferResource=function(_super){function BufferResource(source,options){var _this=this,_a=options||{},width=_a.width,height=_a.height;if(!width||!height)throw new Error("BufferResource width or height invalid");return(_this=_super.call(this,width,height)||this).data=source,_this}return __extends$3(BufferResource,_super),BufferResource.prototype.upload=function(renderer,baseTexture,glTexture){var gl=renderer.gl;gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,baseTexture.alphaMode===ALPHA_MODES$1.UNPACK);var width=baseTexture.realWidth,height=baseTexture.realHeight;return glTexture.width===width&&glTexture.height===height?gl.texSubImage2D(baseTexture.target,0,0,0,width,height,baseTexture.format,glTexture.type,this.data):(glTexture.width=width,glTexture.height=height,gl.texImage2D(baseTexture.target,0,glTexture.internalFormat,width,height,0,baseTexture.format,glTexture.type,this.data)),!0},BufferResource.prototype.dispose=function(){this.data=null},BufferResource.test=function(source){return source instanceof Float32Array||source instanceof Uint8Array||source instanceof Uint32Array},BufferResource}(Resource),defaultBufferOptions={scaleMode:SCALE_MODES$1.NEAREST,format:FORMATS$1.RGBA,alphaMode:ALPHA_MODES$1.NPM},BaseTexture=function(_super){function BaseTexture(resource,options){void 0===resource&&(resource=null),void 0===options&&(options=null);var _this=_super.call(this)||this,alphaMode=(options=options||{}).alphaMode,mipmap=options.mipmap,anisotropicLevel=options.anisotropicLevel,scaleMode=options.scaleMode,width=options.width,height=options.height,wrapMode=options.wrapMode,format=options.format,type=options.type,target=options.target,resolution=options.resolution,resourceOptions=options.resourceOptions;return!resource||resource instanceof Resource||((resource=autoDetectResource(resource,resourceOptions)).internal=!0),_this.resolution=resolution||settings.RESOLUTION,_this.width=Math.round((width||0)*_this.resolution)/_this.resolution,_this.height=Math.round((height||0)*_this.resolution)/_this.resolution,_this._mipmap=void 0!==mipmap?mipmap:settings.MIPMAP_TEXTURES,_this.anisotropicLevel=void 0!==anisotropicLevel?anisotropicLevel:settings.ANISOTROPIC_LEVEL,_this._wrapMode=wrapMode||settings.WRAP_MODE,_this._scaleMode=void 0!==scaleMode?scaleMode:settings.SCALE_MODE,_this.format=format||FORMATS$1.RGBA,_this.type=type||TYPES$1.UNSIGNED_BYTE,_this.target=target||TARGETS$1.TEXTURE_2D,_this.alphaMode=void 0!==alphaMode?alphaMode:ALPHA_MODES$1.UNPACK,_this.uid=uid(),_this.touched=0,_this.isPowerOfTwo=!1,_this._refreshPOT(),_this._glTextures={},_this.dirtyId=0,_this.dirtyStyleId=0,_this.cacheId=null,_this.valid=width>0&&height>0,_this.textureCacheIds=[],_this.destroyed=!1,_this.resource=null,_this._batchEnabled=0,_this._batchLocation=0,_this.parentTextureArray=null,_this.setResource(resource),_this}return __extends$3(BaseTexture,_super),Object.defineProperty(BaseTexture.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(BaseTexture.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(BaseTexture.prototype,"mipmap",{get:function(){return this._mipmap},set:function(value){this._mipmap!==value&&(this._mipmap=value,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(BaseTexture.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(value){this._scaleMode!==value&&(this._scaleMode=value,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(BaseTexture.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(value){this._wrapMode!==value&&(this._wrapMode=value,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),BaseTexture.prototype.setStyle=function(scaleMode,mipmap){var dirty;return void 0!==scaleMode&&scaleMode!==this.scaleMode&&(this.scaleMode=scaleMode,dirty=!0),void 0!==mipmap&&mipmap!==this.mipmap&&(this.mipmap=mipmap,dirty=!0),dirty&&this.dirtyStyleId++,this},BaseTexture.prototype.setSize=function(desiredWidth,desiredHeight,resolution){return resolution=resolution||this.resolution,this.setRealSize(desiredWidth*resolution,desiredHeight*resolution,resolution)},BaseTexture.prototype.setRealSize=function(realWidth,realHeight,resolution){return this.resolution=resolution||this.resolution,this.width=Math.round(realWidth)/this.resolution,this.height=Math.round(realHeight)/this.resolution,this._refreshPOT(),this.update(),this},BaseTexture.prototype._refreshPOT=function(){this.isPowerOfTwo=isPow2(this.realWidth)&&isPow2(this.realHeight)},BaseTexture.prototype.setResolution=function(resolution){var oldResolution=this.resolution;return oldResolution===resolution||(this.resolution=resolution,this.valid&&(this.width=Math.round(this.width*oldResolution)/resolution,this.height=Math.round(this.height*oldResolution)/resolution,this.emit("update",this)),this._refreshPOT()),this},BaseTexture.prototype.setResource=function(resource){if(this.resource===resource)return this;if(this.resource)throw new Error("Resource can be set only once");return resource.bind(this),this.resource=resource,this},BaseTexture.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},BaseTexture.prototype.onError=function(event){this.emit("error",this,event)},BaseTexture.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete BaseTextureCache[this.cacheId],delete TextureCache[this.cacheId],this.cacheId=null),this.dispose(),BaseTexture.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},BaseTexture.prototype.dispose=function(){this.emit("dispose",this)},BaseTexture.prototype.castToBaseTexture=function(){return this},BaseTexture.from=function(source,options,strict){void 0===strict&&(strict=settings.STRICT_TEXTURE_CACHE);var isFrame="string"==typeof source,cacheId=null;if(isFrame)cacheId=source;else{if(!source._pixiId){var prefix=options&&options.pixiIdPrefix||"pixiid";source._pixiId=prefix+"_"+uid()}cacheId=source._pixiId}var baseTexture=BaseTextureCache[cacheId];if(isFrame&&strict&&!baseTexture)throw new Error('The cacheId "'+cacheId+'" does not exist in BaseTextureCache.');return baseTexture||((baseTexture=new BaseTexture(source,options)).cacheId=cacheId,BaseTexture.addToCache(baseTexture,cacheId)),baseTexture},BaseTexture.fromBuffer=function(buffer,width,height,options){buffer=buffer||new Float32Array(width*height*4);var resource=new BufferResource(buffer,{width:width,height:height}),type=buffer instanceof Float32Array?TYPES$1.FLOAT:TYPES$1.UNSIGNED_BYTE;return new BaseTexture(resource,Object.assign(defaultBufferOptions,options||{width:width,height:height,type:type}))},BaseTexture.addToCache=function(baseTexture,id){id&&(-1===baseTexture.textureCacheIds.indexOf(id)&&baseTexture.textureCacheIds.push(id),BaseTextureCache[id]&&console.warn("BaseTexture added to the cache with an id ["+id+"] that already had an entry"),BaseTextureCache[id]=baseTexture)},BaseTexture.removeFromCache=function(baseTexture){if("string"==typeof baseTexture){var baseTextureFromCache=BaseTextureCache[baseTexture];if(baseTextureFromCache){var index=baseTextureFromCache.textureCacheIds.indexOf(baseTexture);return index>-1&&baseTextureFromCache.textureCacheIds.splice(index,1),delete BaseTextureCache[baseTexture],baseTextureFromCache}}else if(baseTexture&&baseTexture.textureCacheIds){for(var i=0;i<baseTexture.textureCacheIds.length;++i)delete BaseTextureCache[baseTexture.textureCacheIds[i]];return baseTexture.textureCacheIds.length=0,baseTexture}return null},BaseTexture._globalBatch=0,BaseTexture}(eventemitter3),AbstractMultiResource=function(_super){function AbstractMultiResource(length,options){var _this=this,_a=options||{},width=_a.width,height=_a.height;(_this=_super.call(this,width,height)||this).items=[],_this.itemDirtyIds=[];for(var i=0;i<length;i++){var partTexture=new BaseTexture;_this.items.push(partTexture),_this.itemDirtyIds.push(-2)}return _this.length=length,_this._load=null,_this.baseTexture=null,_this}return __extends$3(AbstractMultiResource,_super),AbstractMultiResource.prototype.initFromArray=function(resources,options){for(var i=0;i<this.length;i++)resources[i]&&(resources[i].castToBaseTexture?this.addBaseTextureAt(resources[i].castToBaseTexture(),i):resources[i]instanceof Resource?this.addResourceAt(resources[i],i):this.addResourceAt(autoDetectResource(resources[i],options),i))},AbstractMultiResource.prototype.dispose=function(){for(var i=0,len=this.length;i<len;i++)this.items[i].destroy();this.items=null,this.itemDirtyIds=null,this._load=null},AbstractMultiResource.prototype.addResourceAt=function(resource,index){if(!this.items[index])throw new Error("Index "+index+" is out of bounds");return resource.valid&&!this.valid&&this.resize(resource.width,resource.height),this.items[index].setResource(resource),this},AbstractMultiResource.prototype.bind=function(baseTexture){if(null!==this.baseTexture)throw new Error("Only one base texture per TextureArray is allowed");_super.prototype.bind.call(this,baseTexture);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=baseTexture,this.items[i].on("update",baseTexture.update,baseTexture)},AbstractMultiResource.prototype.unbind=function(baseTexture){_super.prototype.unbind.call(this,baseTexture);for(var i=0;i<this.length;i++)this.items[i].parentTextureArray=null,this.items[i].off("update",baseTexture.update,baseTexture)},AbstractMultiResource.prototype.load=function(){var _this=this;if(this._load)return this._load;var promises=this.items.map((function(item){return item.resource})).filter((function(item){return item})).map((function(item){return item.load()}));return this._load=Promise.all(promises).then((function(){var _a=_this.items[0],realWidth=_a.realWidth,realHeight=_a.realHeight;return _this.resize(realWidth,realHeight),Promise.resolve(_this)})),this._load},AbstractMultiResource}(Resource),ArrayResource=function(_super){function ArrayResource(source,options){var urls,length,_this=this,_a=options||{},width=_a.width,height=_a.height;return Array.isArray(source)?(urls=source,length=source.length):length=source,_this=_super.call(this,length,{width:width,height:height})||this,urls&&_this.initFromArray(urls,options),_this}return __extends$3(ArrayResource,_super),ArrayResource.prototype.addBaseTextureAt=function(baseTexture,index){if(!baseTexture.resource)throw new Error("ArrayResource does not support RenderTexture");return this.addResourceAt(baseTexture.resource,index),this},ArrayResource.prototype.bind=function(baseTexture){_super.prototype.bind.call(this,baseTexture),baseTexture.target=TARGETS$1.TEXTURE_2D_ARRAY},ArrayResource.prototype.upload=function(renderer,texture,glTexture){var length=this.length,itemDirtyIds=this.itemDirtyIds,items=this.items,gl=renderer.gl;glTexture.dirtyId<0&&gl.texImage3D(gl.TEXTURE_2D_ARRAY,0,glTexture.internalFormat,this._width,this._height,length,0,texture.format,glTexture.type,null);for(var i=0;i<length;i++){var item=items[i];itemDirtyIds[i]<item.dirtyId&&(itemDirtyIds[i]=item.dirtyId,item.valid&&gl.texSubImage3D(gl.TEXTURE_2D_ARRAY,0,0,0,i,item.resource.width,item.resource.height,1,texture.format,glTexture.type,item.resource.source))}return!0},ArrayResource}(AbstractMultiResource),BaseImageResource=function(_super){function BaseImageResource(source){var _this=this,sourceAny=source,width=sourceAny.naturalWidth||sourceAny.videoWidth||sourceAny.width,height=sourceAny.naturalHeight||sourceAny.videoHeight||sourceAny.height;return(_this=_super.call(this,width,height)||this).source=source,_this.noSubImage=!1,_this}return __extends$3(BaseImageResource,_super),BaseImageResource.crossOrigin=function(element,url,crossorigin){void 0===crossorigin&&0!==url.indexOf("data:")?element.crossOrigin=determineCrossOrigin(url):!1!==crossorigin&&(element.crossOrigin="string"==typeof crossorigin?crossorigin:"anonymous")},BaseImageResource.prototype.upload=function(renderer,baseTexture,glTexture,source){var gl=renderer.gl,width=baseTexture.realWidth,height=baseTexture.realHeight;if((source=source||this.source)instanceof HTMLImageElement){if(!source.complete||0===source.naturalWidth)return!1}else if(source instanceof HTMLVideoElement&&source.readyState<=1)return!1;return gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,baseTexture.alphaMode===ALPHA_MODES$1.UNPACK),this.noSubImage||baseTexture.target!==gl.TEXTURE_2D||glTexture.width!==width||glTexture.height!==height?(glTexture.width=width,glTexture.height=height,gl.texImage2D(baseTexture.target,0,glTexture.internalFormat,baseTexture.format,glTexture.type,source)):gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,baseTexture.format,glTexture.type,source),!0},BaseImageResource.prototype.update=function(){if(!this.destroyed){var source=this.source,width=source.naturalWidth||source.videoWidth||source.width,height=source.naturalHeight||source.videoHeight||source.height;this.resize(width,height),_super.prototype.update.call(this)}},BaseImageResource.prototype.dispose=function(){this.source=null},BaseImageResource}(Resource),CanvasResource=function(_super){function CanvasResource(source){return _super.call(this,source)||this}return __extends$3(CanvasResource,_super),CanvasResource.test=function(source){var OffscreenCanvas=globalThis.OffscreenCanvas;return!!(OffscreenCanvas&&source instanceof OffscreenCanvas)||globalThis.HTMLCanvasElement&&source instanceof HTMLCanvasElement},CanvasResource}(BaseImageResource),CubeResource=function(_super){function CubeResource(source,options){var _this=this,_a=options||{},width=_a.width,height=_a.height,autoLoad=_a.autoLoad,linkBaseTexture=_a.linkBaseTexture;if(source&&source.length!==CubeResource.SIDES)throw new Error("Invalid length. Got "+source.length+", expected 6");_this=_super.call(this,6,{width:width,height:height})||this;for(var i=0;i<CubeResource.SIDES;i++)_this.items[i].target=TARGETS$1.TEXTURE_CUBE_MAP_POSITIVE_X+i;return _this.linkBaseTexture=!1!==linkBaseTexture,source&&_this.initFromArray(source,options),!1!==autoLoad&&_this.load(),_this}return __extends$3(CubeResource,_super),CubeResource.prototype.bind=function(baseTexture){_super.prototype.bind.call(this,baseTexture),baseTexture.target=TARGETS$1.TEXTURE_CUBE_MAP},CubeResource.prototype.addBaseTextureAt=function(baseTexture,index,linkBaseTexture){if(!this.items[index])throw new Error("Index "+index+" is out of bounds");if(!this.linkBaseTexture||baseTexture.parentTextureArray||Object.keys(baseTexture._glTextures).length>0){if(!baseTexture.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(baseTexture.resource,index)}else baseTexture.target=TARGETS$1.TEXTURE_CUBE_MAP_POSITIVE_X+index,baseTexture.parentTextureArray=this.baseTexture,this.items[index]=baseTexture;return baseTexture.valid&&!this.valid&&this.resize(baseTexture.realWidth,baseTexture.realHeight),this.items[index]=baseTexture,this},CubeResource.prototype.upload=function(renderer,_baseTexture,glTexture){for(var dirty=this.itemDirtyIds,i=0;i<CubeResource.SIDES;i++){var side=this.items[i];dirty[i]<side.dirtyId&&(side.valid&&side.resource?(side.resource.upload(renderer,side,glTexture),dirty[i]=side.dirtyId):dirty[i]<-1&&(renderer.gl.texImage2D(side.target,0,glTexture.internalFormat,_baseTexture.realWidth,_baseTexture.realHeight,0,_baseTexture.format,glTexture.type,null),dirty[i]=-1))}return!0},CubeResource.test=function(source){return Array.isArray(source)&&source.length===CubeResource.SIDES},CubeResource.SIDES=6,CubeResource}(AbstractMultiResource),ImageResource=function(_super){function ImageResource(source,options){var _this=this;if(options=options||{},!(source instanceof HTMLImageElement)){var imageElement=new Image;BaseImageResource.crossOrigin(imageElement,source,options.crossorigin),imageElement.src=source,source=imageElement}return _this=_super.call(this,source)||this,!source.complete&&_this._width&&_this._height&&(_this._width=0,_this._height=0),_this.url=source.src,_this._process=null,_this.preserveBitmap=!1,_this.createBitmap=(void 0!==options.createBitmap?options.createBitmap:settings.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,_this.alphaMode="number"==typeof options.alphaMode?options.alphaMode:null,_this.bitmap=null,_this._load=null,!1!==options.autoLoad&&_this.load(),_this}return __extends$3(ImageResource,_super),ImageResource.prototype.load=function(createBitmap){var _this=this;return this._load||(void 0!==createBitmap&&(this.createBitmap=createBitmap),this._load=new Promise((function(resolve,reject){var source=_this.source;_this.url=source.src;var completed=function(){_this.destroyed||(source.onload=null,source.onerror=null,_this.resize(source.width,source.height),_this._load=null,_this.createBitmap?resolve(_this.process()):resolve(_this))};source.complete&&source.src?completed():(source.onload=completed,source.onerror=function(event){reject(event),_this.onError.emit(event)})}))),this._load},ImageResource.prototype.process=function(){var _this=this,source=this.source;if(null!==this._process)return this._process;if(null!==this.bitmap||!globalThis.createImageBitmap)return Promise.resolve(this);var createImageBitmap=globalThis.createImageBitmap,cors=!source.crossOrigin||"anonymous"===source.crossOrigin;return this._process=fetch(source.src,{mode:cors?"cors":"no-cors"}).then((function(r){return r.blob()})).then((function(blob){return createImageBitmap(blob,0,0,source.width,source.height,{premultiplyAlpha:_this.alphaMode===ALPHA_MODES$1.UNPACK?"premultiply":"none"})})).then((function(bitmap){return _this.destroyed?Promise.reject():(_this.bitmap=bitmap,_this.update(),_this._process=null,Promise.resolve(_this))})),this._process},ImageResource.prototype.upload=function(renderer,baseTexture,glTexture){if("number"==typeof this.alphaMode&&(baseTexture.alphaMode=this.alphaMode),!this.createBitmap)return _super.prototype.upload.call(this,renderer,baseTexture,glTexture);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(_super.prototype.upload.call(this,renderer,baseTexture,glTexture,this.bitmap),!this.preserveBitmap){var flag=!0,glTextures=baseTexture._glTextures;for(var key in glTextures){var otherTex=glTextures[key];if(otherTex!==glTexture&&otherTex.dirtyId!==baseTexture.dirtyId){flag=!1;break}}flag&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0},ImageResource.prototype.dispose=function(){this.source.onload=null,this.source.onerror=null,_super.prototype.dispose.call(this),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null},ImageResource.test=function(source){return"string"==typeof source||source instanceof HTMLImageElement},ImageResource}(BaseImageResource),SVGResource=function(_super){function SVGResource(sourceBase64,options){var _this=this;return options=options||{},(_this=_super.call(this,document.createElement("canvas"))||this)._width=0,_this._height=0,_this.svg=sourceBase64,_this.scale=options.scale||1,_this._overrideWidth=options.width,_this._overrideHeight=options.height,_this._resolve=null,_this._crossorigin=options.crossorigin,_this._load=null,!1!==options.autoLoad&&_this.load(),_this}return __extends$3(SVGResource,_super),SVGResource.prototype.load=function(){var _this=this;return this._load||(this._load=new Promise((function(resolve){if(_this._resolve=function(){_this.resize(_this.source.width,_this.source.height),resolve(_this)},SVGResource.SVG_XML.test(_this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");_this.svg="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(_this.svg)))}_this._loadSvg()}))),this._load},SVGResource.prototype._loadSvg=function(){var _this=this,tempImage=new Image;BaseImageResource.crossOrigin(tempImage,this.svg,this._crossorigin),tempImage.src=this.svg,tempImage.onerror=function(event){_this._resolve&&(tempImage.onerror=null,_this.onError.emit(event))},tempImage.onload=function(){if(_this._resolve){var svgWidth=tempImage.width,svgHeight=tempImage.height;if(!svgWidth||!svgHeight)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");var width=svgWidth*_this.scale,height=svgHeight*_this.scale;(_this._overrideWidth||_this._overrideHeight)&&(width=_this._overrideWidth||_this._overrideHeight/svgHeight*svgWidth,height=_this._overrideHeight||_this._overrideWidth/svgWidth*svgHeight),width=Math.round(width),height=Math.round(height);var canvas=_this.source;canvas.width=width,canvas.height=height,canvas._pixiId="canvas_"+uid(),canvas.getContext("2d").drawImage(tempImage,0,0,svgWidth,svgHeight,0,0,width,height),_this._resolve(),_this._resolve=null}}},SVGResource.getSize=function(svgString){var sizeMatch=SVGResource.SVG_SIZE.exec(svgString),size={};return sizeMatch&&(size[sizeMatch[1]]=Math.round(parseFloat(sizeMatch[3])),size[sizeMatch[5]]=Math.round(parseFloat(sizeMatch[7]))),size},SVGResource.prototype.dispose=function(){_super.prototype.dispose.call(this),this._resolve=null,this._crossorigin=null},SVGResource.test=function(source,extension){return"svg"===extension||"string"==typeof source&&/^data:image\/svg\+xml(;(charset=utf8|utf8))?;base64/.test(source)||"string"==typeof source&&SVGResource.SVG_XML.test(source)},SVGResource.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,SVGResource.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,SVGResource}(BaseImageResource),VideoResource=function(_super){function VideoResource(source,options){var _this=this;if(options=options||{},!(source instanceof HTMLVideoElement)){var videoElement=document.createElement("video");videoElement.setAttribute("preload","auto"),videoElement.setAttribute("webkit-playsinline",""),videoElement.setAttribute("playsinline",""),"string"==typeof source&&(source=[source]);var firstSrc=source[0].src||source[0];BaseImageResource.crossOrigin(videoElement,firstSrc,options.crossorigin);for(var i=0;i<source.length;++i){var sourceElement=document.createElement("source"),_a=source[i],src=_a.src,mime=_a.mime,baseSrc=(src=src||source[i]).split("?").shift().toLowerCase(),ext=baseSrc.slice(baseSrc.lastIndexOf(".")+1);mime=mime||VideoResource.MIME_TYPES[ext]||"video/"+ext,sourceElement.src=src,sourceElement.type=mime,videoElement.appendChild(sourceElement)}source=videoElement}return(_this=_super.call(this,source)||this).noSubImage=!0,_this._autoUpdate=!0,_this._isConnectedToTicker=!1,_this._updateFPS=options.updateFPS||0,_this._msToNextUpdate=0,_this.autoPlay=!1!==options.autoPlay,_this._load=null,_this._resolve=null,_this._onCanPlay=_this._onCanPlay.bind(_this),_this._onError=_this._onError.bind(_this),!1!==options.autoLoad&&_this.load(),_this}return __extends$3(VideoResource,_super),VideoResource.prototype.update=function(_deltaTime){if(!this.destroyed){var elapsedMS=Ticker.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-elapsedMS),(!this._updateFPS||this._msToNextUpdate<=0)&&(_super.prototype.update.call(this),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}},VideoResource.prototype.load=function(){var _this=this;if(this._load)return this._load;var source=this.source;return(source.readyState===source.HAVE_ENOUGH_DATA||source.readyState===source.HAVE_FUTURE_DATA)&&source.width&&source.height&&(source.complete=!0),source.addEventListener("play",this._onPlayStart.bind(this)),source.addEventListener("pause",this._onPlayStop.bind(this)),this._isSourceReady()?this._onCanPlay():(source.addEventListener("canplay",this._onCanPlay),source.addEventListener("canplaythrough",this._onCanPlay),source.addEventListener("error",this._onError,!0)),this._load=new Promise((function(resolve){_this.valid?resolve(_this):(_this._resolve=resolve,source.load())})),this._load},VideoResource.prototype._onError=function(event){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(event)},VideoResource.prototype._isSourcePlaying=function(){var source=this.source;return source.currentTime>0&&!1===source.paused&&!1===source.ended&&source.readyState>2},VideoResource.prototype._isSourceReady=function(){var source=this.source;return 3===source.readyState||4===source.readyState},VideoResource.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(Ticker.shared.add(this.update,this),this._isConnectedToTicker=!0)},VideoResource.prototype._onPlayStop=function(){this._isConnectedToTicker&&(Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1)},VideoResource.prototype._onCanPlay=function(){var source=this.source;source.removeEventListener("canplay",this._onCanPlay),source.removeEventListener("canplaythrough",this._onCanPlay);var valid=this.valid;this.resize(source.videoWidth,source.videoHeight),!valid&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&source.play()},VideoResource.prototype.dispose=function(){this._isConnectedToTicker&&(Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1);var source=this.source;source&&(source.removeEventListener("error",this._onError,!0),source.pause(),source.src="",source.load()),_super.prototype.dispose.call(this)},Object.defineProperty(VideoResource.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(value){value!==this._autoUpdate&&(this._autoUpdate=value,!this._autoUpdate&&this._isConnectedToTicker?(Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(Ticker.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(VideoResource.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(value){value!==this._updateFPS&&(this._updateFPS=value)},enumerable:!1,configurable:!0}),VideoResource.test=function(source,extension){return globalThis.HTMLVideoElement&&source instanceof HTMLVideoElement||VideoResource.TYPES.indexOf(extension)>-1},VideoResource.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],VideoResource.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},VideoResource}(BaseImageResource),ImageBitmapResource=function(_super){function ImageBitmapResource(source){return _super.call(this,source)||this}return __extends$3(ImageBitmapResource,_super),ImageBitmapResource.test=function(source){return!!globalThis.createImageBitmap&&source instanceof ImageBitmap},ImageBitmapResource}(BaseImageResource);INSTALLED.push(ImageResource,ImageBitmapResource,CanvasResource,VideoResource,SVGResource,BufferResource,CubeResource,ArrayResource);var _resources={__proto__:null,Resource:Resource,BaseImageResource:BaseImageResource,INSTALLED:INSTALLED,autoDetectResource:autoDetectResource,AbstractMultiResource:AbstractMultiResource,ArrayResource:ArrayResource,BufferResource:BufferResource,CanvasResource:CanvasResource,CubeResource:CubeResource,ImageResource:ImageResource,SVGResource:SVGResource,VideoResource:VideoResource,ImageBitmapResource:ImageBitmapResource},DepthResource=function(_super){function DepthResource(){return null!==_super&&_super.apply(this,arguments)||this}return __extends$3(DepthResource,_super),DepthResource.prototype.upload=function(renderer,baseTexture,glTexture){var gl=renderer.gl;gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,baseTexture.alphaMode===ALPHA_MODES$1.UNPACK);var width=baseTexture.realWidth,height=baseTexture.realHeight;return glTexture.width===width&&glTexture.height===height?gl.texSubImage2D(baseTexture.target,0,0,0,width,height,baseTexture.format,glTexture.type,this.data):(glTexture.width=width,glTexture.height=height,gl.texImage2D(baseTexture.target,0,glTexture.internalFormat,width,height,0,baseTexture.format,glTexture.type,this.data)),!0},DepthResource}(BufferResource),Framebuffer=function(){function Framebuffer(width,height){this.width=Math.round(width||100),this.height=Math.round(height||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Runner("disposeFramebuffer"),this.multisample=MSAA_QUALITY$1.NONE}return Object.defineProperty(Framebuffer.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),Framebuffer.prototype.addColorTexture=function(index,texture){return void 0===index&&(index=0),this.colorTextures[index]=texture||new BaseTexture(null,{scaleMode:SCALE_MODES$1.NEAREST,resolution:1,mipmap:MIPMAP_MODES$1.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},Framebuffer.prototype.addDepthTexture=function(texture){return this.depthTexture=texture||new BaseTexture(new DepthResource(null,{width:this.width,height:this.height}),{scaleMode:SCALE_MODES$1.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:MIPMAP_MODES$1.OFF,format:FORMATS$1.DEPTH_COMPONENT,type:TYPES$1.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},Framebuffer.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},Framebuffer.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},Framebuffer.prototype.resize=function(width,height){if(width=Math.round(width),height=Math.round(height),width!==this.width||height!==this.height){this.width=width,this.height=height,this.dirtyId++,this.dirtySize++;for(var i=0;i<this.colorTextures.length;i++){var texture=this.colorTextures[i],resolution=texture.resolution;texture.setSize(width/resolution,height/resolution)}if(this.depthTexture){resolution=this.depthTexture.resolution;this.depthTexture.setSize(width/resolution,height/resolution)}}},Framebuffer.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},Framebuffer.prototype.destroyDepthTexture=function(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)},Framebuffer}(),BaseRenderTexture=function(_super){function BaseRenderTexture(options){void 0===options&&(options={});var _this=this;if("number"==typeof options){var width=arguments[0],height=arguments[1],scaleMode=arguments[2],resolution=arguments[3];options={width:width,height:height,scaleMode:scaleMode,resolution:resolution}}return options.width=options.width||100,options.height=options.height||100,options.multisample=void 0!==options.multisample?options.multisample:MSAA_QUALITY$1.NONE,(_this=_super.call(this,null,options)||this).mipmap=MIPMAP_MODES$1.OFF,_this.valid=!0,_this.clearColor=[0,0,0,0],_this.framebuffer=new Framebuffer(_this.realWidth,_this.realHeight).addColorTexture(0,_this),_this.framebuffer.multisample=options.multisample,_this.maskStack=[],_this.filterStack=[{}],_this}return __extends$3(BaseRenderTexture,_super),BaseRenderTexture.prototype.resize=function(desiredWidth,desiredHeight){this.framebuffer.resize(desiredWidth*this.resolution,desiredHeight*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)},BaseRenderTexture.prototype.dispose=function(){this.framebuffer.dispose(),_super.prototype.dispose.call(this)},BaseRenderTexture.prototype.destroy=function(){_super.prototype.destroy.call(this),this.framebuffer.destroyDepthTexture(),this.framebuffer=null},BaseRenderTexture}(BaseTexture),TextureUvs=function(){function TextureUvs(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}return TextureUvs.prototype.set=function(frame,baseFrame,rotate){var tw=baseFrame.width,th=baseFrame.height;if(rotate){var w2=frame.width/2/tw,h2=frame.height/2/th,cX=frame.x/tw+w2,cY=frame.y/th+h2;rotate=groupD8.add(rotate,groupD8.NW),this.x0=cX+w2*groupD8.uX(rotate),this.y0=cY+h2*groupD8.uY(rotate),rotate=groupD8.add(rotate,2),this.x1=cX+w2*groupD8.uX(rotate),this.y1=cY+h2*groupD8.uY(rotate),rotate=groupD8.add(rotate,2),this.x2=cX+w2*groupD8.uX(rotate),this.y2=cY+h2*groupD8.uY(rotate),rotate=groupD8.add(rotate,2),this.x3=cX+w2*groupD8.uX(rotate),this.y3=cY+h2*groupD8.uY(rotate)}else this.x0=frame.x/tw,this.y0=frame.y/th,this.x1=(frame.x+frame.width)/tw,this.y1=frame.y/th,this.x2=(frame.x+frame.width)/tw,this.y2=(frame.y+frame.height)/th,this.x3=frame.x/tw,this.y3=(frame.y+frame.height)/th;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3},TextureUvs.prototype.toString=function(){return"[@pixi/core:TextureUvs x0="+this.x0+" y0="+this.y0+" x1="+this.x1+" y1="+this.y1+" x2="+this.x2+" y2="+this.y2+" x3="+this.x3+" y3="+this.y3+"]"},TextureUvs}(),DEFAULT_UVS=new TextureUvs;function removeAllHandlers(tex){tex.destroy=function(){},tex.on=function(){},tex.once=function(){},tex.emit=function(){}}var Texture=function(_super){function Texture(baseTexture,frame,orig,trim,rotate,anchor){var _this=_super.call(this)||this;if(_this.noFrame=!1,frame||(_this.noFrame=!0,frame=new Rectangle(0,0,1,1)),baseTexture instanceof Texture&&(baseTexture=baseTexture.baseTexture),_this.baseTexture=baseTexture,_this._frame=frame,_this.trim=trim,_this.valid=!1,_this._uvs=DEFAULT_UVS,_this.uvMatrix=null,_this.orig=orig||frame,_this._rotate=Number(rotate||0),!0===rotate)_this._rotate=2;else if(_this._rotate%2!=0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");return _this.defaultAnchor=anchor?new Point(anchor.x,anchor.y):new Point(0,0),_this._updateID=0,_this.textureCacheIds=[],baseTexture.valid?_this.noFrame?baseTexture.valid&&_this.onBaseTextureUpdated(baseTexture):_this.frame=frame:baseTexture.once("loaded",_this.onBaseTextureUpdated,_this),_this.noFrame&&baseTexture.on("update",_this.onBaseTextureUpdated,_this),_this}return __extends$3(Texture,_super),Texture.prototype.update=function(){this.baseTexture.resource&&this.baseTexture.resource.update()},Texture.prototype.onBaseTextureUpdated=function(baseTexture){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=baseTexture.width,this._frame.height=baseTexture.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)},Texture.prototype.destroy=function(destroyBase){if(this.baseTexture){if(destroyBase){var resource=this.baseTexture.resource;resource&&resource.url&&TextureCache[resource.url]&&Texture.removeFromCache(resource.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,Texture.removeFromCache(this),this.textureCacheIds=null},Texture.prototype.clone=function(){var clonedFrame=this._frame.clone(),clonedOrig=this._frame===this.orig?clonedFrame:this.orig.clone(),clonedTexture=new Texture(this.baseTexture,!this.noFrame&&clonedFrame,clonedOrig,this.trim&&this.trim.clone(),this.rotate,this.defaultAnchor);return this.noFrame&&(clonedTexture._frame=clonedFrame),clonedTexture},Texture.prototype.updateUvs=function(){this._uvs===DEFAULT_UVS&&(this._uvs=new TextureUvs),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++},Texture.from=function(source,options,strict){void 0===options&&(options={}),void 0===strict&&(strict=settings.STRICT_TEXTURE_CACHE);var isFrame="string"==typeof source,cacheId=null;if(isFrame)cacheId=source;else if(source instanceof BaseTexture){if(!source.cacheId){var prefix=options&&options.pixiIdPrefix||"pixiid";source.cacheId=prefix+"-"+uid(),BaseTexture.addToCache(source,source.cacheId)}cacheId=source.cacheId}else{if(!source._pixiId){prefix=options&&options.pixiIdPrefix||"pixiid";source._pixiId=prefix+"_"+uid()}cacheId=source._pixiId}var texture=TextureCache[cacheId];if(isFrame&&strict&&!texture)throw new Error('The cacheId "'+cacheId+'" does not exist in TextureCache.');return texture||source instanceof BaseTexture?!texture&&source instanceof BaseTexture&&(texture=new Texture(source),Texture.addToCache(texture,cacheId)):(options.resolution||(options.resolution=getResolutionOfUrl(source)),(texture=new Texture(new BaseTexture(source,options))).baseTexture.cacheId=cacheId,BaseTexture.addToCache(texture.baseTexture,cacheId),Texture.addToCache(texture,cacheId)),texture},Texture.fromURL=function(url,options){var resourceOptions=Object.assign({autoLoad:!1},null==options?void 0:options.resourceOptions),texture=Texture.from(url,Object.assign({resourceOptions:resourceOptions},options),!1),resource=texture.baseTexture.resource;return texture.baseTexture.valid?Promise.resolve(texture):resource.load().then((function(){return Promise.resolve(texture)}))},Texture.fromBuffer=function(buffer,width,height,options){return new Texture(BaseTexture.fromBuffer(buffer,width,height,options))},Texture.fromLoader=function(source,imageUrl,name,options){var baseTexture=new BaseTexture(source,Object.assign({scaleMode:settings.SCALE_MODE,resolution:getResolutionOfUrl(imageUrl)},options)),resource=baseTexture.resource;resource instanceof ImageResource&&(resource.url=imageUrl);var texture=new Texture(baseTexture);return name||(name=imageUrl),BaseTexture.addToCache(texture.baseTexture,name),Texture.addToCache(texture,name),name!==imageUrl&&(BaseTexture.addToCache(texture.baseTexture,imageUrl),Texture.addToCache(texture,imageUrl)),texture.baseTexture.valid?Promise.resolve(texture):new Promise((function(resolve){texture.baseTexture.once("loaded",(function(){return resolve(texture)}))}))},Texture.addToCache=function(texture,id){id&&(-1===texture.textureCacheIds.indexOf(id)&&texture.textureCacheIds.push(id),TextureCache[id]&&console.warn("Texture added to the cache with an id ["+id+"] that already had an entry"),TextureCache[id]=texture)},Texture.removeFromCache=function(texture){if("string"==typeof texture){var textureFromCache=TextureCache[texture];if(textureFromCache){var index=textureFromCache.textureCacheIds.indexOf(texture);return index>-1&&textureFromCache.textureCacheIds.splice(index,1),delete TextureCache[texture],textureFromCache}}else if(texture&&texture.textureCacheIds){for(var i=0;i<texture.textureCacheIds.length;++i)TextureCache[texture.textureCacheIds[i]]===texture&&delete TextureCache[texture.textureCacheIds[i]];return texture.textureCacheIds.length=0,texture}return null},Object.defineProperty(Texture.prototype,"resolution",{get:function(){return this.baseTexture.resolution},enumerable:!1,configurable:!0}),Object.defineProperty(Texture.prototype,"frame",{get:function(){return this._frame},set:function(frame){this._frame=frame,this.noFrame=!1;var x=frame.x,y=frame.y,width=frame.width,height=frame.height,xNotFit=x+width>this.baseTexture.width,yNotFit=y+height>this.baseTexture.height;if(xNotFit||yNotFit){var relationship=xNotFit&&yNotFit?"and":"or",errorX="X: "+x+" + "+width+" = "+(x+width)+" > "+this.baseTexture.width,errorY="Y: "+y+" + "+height+" = "+(y+height)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+errorX+" "+relationship+" "+errorY)}this.valid=width&&height&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=frame),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(Texture.prototype,"rotate",{get:function(){return this._rotate},set:function(rotate){this._rotate=rotate,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(Texture.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(Texture.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),Texture.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(Texture,"EMPTY",{get:function(){return Texture._EMPTY||(Texture._EMPTY=new Texture(new BaseTexture),removeAllHandlers(Texture._EMPTY),removeAllHandlers(Texture._EMPTY.baseTexture)),Texture._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(Texture,"WHITE",{get:function(){if(!Texture._WHITE){var canvas=document.createElement("canvas"),context=canvas.getContext("2d");canvas.width=16,canvas.height=16,context.fillStyle="white",context.fillRect(0,0,16,16),Texture._WHITE=new Texture(new BaseTexture(new CanvasResource(canvas))),removeAllHandlers(Texture._WHITE),removeAllHandlers(Texture._WHITE.baseTexture)}return Texture._WHITE},enumerable:!1,configurable:!0}),Texture}(eventemitter3),RenderTexture=function(_super){function RenderTexture(baseRenderTexture,frame){var _this=_super.call(this,baseRenderTexture,frame)||this;return _this.valid=!0,_this.filterFrame=null,_this.filterPoolKey=null,_this.updateUvs(),_this}return __extends$3(RenderTexture,_super),Object.defineProperty(RenderTexture.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(RenderTexture.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(value){this.framebuffer.multisample=value},enumerable:!1,configurable:!0}),RenderTexture.prototype.resize=function(desiredWidth,desiredHeight,resizeBaseTexture){void 0===resizeBaseTexture&&(resizeBaseTexture=!0);var resolution=this.baseTexture.resolution,width=Math.round(desiredWidth*resolution)/resolution,height=Math.round(desiredHeight*resolution)/resolution;this.valid=width>0&&height>0,this._frame.width=this.orig.width=width,this._frame.height=this.orig.height=height,resizeBaseTexture&&this.baseTexture.resize(width,height),this.updateUvs()},RenderTexture.prototype.setResolution=function(resolution){var baseTexture=this.baseTexture;baseTexture.resolution!==resolution&&(baseTexture.setResolution(resolution),this.resize(baseTexture.width,baseTexture.height,!1))},RenderTexture.create=function(options){for(var arguments$1=arguments,rest=[],_i=1;_i<arguments.length;_i++)rest[_i-1]=arguments$1[_i];return"number"==typeof options&&(deprecation("6.0.0","Arguments (width, height, scaleMode, resolution) have been deprecated."),options={width:options,height:rest[0],scaleMode:rest[1],resolution:rest[2]}),new RenderTexture(new BaseRenderTexture(options))},RenderTexture}(Texture),RenderTexturePool=function(){function RenderTexturePool(textureOptions){this.texturePool={},this.textureOptions=textureOptions||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}return RenderTexturePool.prototype.createTexture=function(realWidth,realHeight,multisample){void 0===multisample&&(multisample=MSAA_QUALITY$1.NONE);var baseRenderTexture=new BaseRenderTexture(Object.assign({width:realWidth,height:realHeight,resolution:1,multisample:multisample},this.textureOptions));return new RenderTexture(baseRenderTexture)},RenderTexturePool.prototype.getOptimalTexture=function(minWidth,minHeight,resolution,multisample){var key;void 0===resolution&&(resolution=1),void 0===multisample&&(multisample=MSAA_QUALITY$1.NONE),minWidth=Math.ceil(minWidth*resolution-1e-6),minHeight=Math.ceil(minHeight*resolution-1e-6),this.enableFullScreen&&minWidth===this._pixelsWidth&&minHeight===this._pixelsHeight?key=multisample>1?-multisample:-1:(key=((65535&(minWidth=nextPow2(minWidth)))<<16|65535&(minHeight=nextPow2(minHeight)))>>>0,multisample>1&&(key+=4294967296*multisample)),this.texturePool[key]||(this.texturePool[key]=[]);var renderTexture=this.texturePool[key].pop();return renderTexture||(renderTexture=this.createTexture(minWidth,minHeight,multisample)),renderTexture.filterPoolKey=key,renderTexture.setResolution(resolution),renderTexture},RenderTexturePool.prototype.getFilterTexture=function(input,resolution,multisample){var filterTexture=this.getOptimalTexture(input.width,input.height,resolution||input.resolution,multisample||MSAA_QUALITY$1.NONE);return filterTexture.filterFrame=input.filterFrame,filterTexture},RenderTexturePool.prototype.returnTexture=function(renderTexture){var key=renderTexture.filterPoolKey;renderTexture.filterFrame=null,this.texturePool[key].push(renderTexture)},RenderTexturePool.prototype.returnFilterTexture=function(renderTexture){this.returnTexture(renderTexture)},RenderTexturePool.prototype.clear=function(destroyTextures){if(destroyTextures=!1!==destroyTextures)for(var i in this.texturePool){var textures=this.texturePool[i];if(textures)for(var j=0;j<textures.length;j++)textures[j].destroy(!0)}this.texturePool={}},RenderTexturePool.prototype.setScreenSize=function(size){if(size.width!==this._pixelsWidth||size.height!==this._pixelsHeight){for(var i in this.enableFullScreen=size.width>0&&size.height>0,this.texturePool)if(Number(i)<0){var textures=this.texturePool[i];if(textures)for(var j=0;j<textures.length;j++)textures[j].destroy(!0);this.texturePool[i]=[]}this._pixelsWidth=size.width,this._pixelsHeight=size.height}},RenderTexturePool.SCREEN_KEY=-1,RenderTexturePool}(),Attribute=function(){function Attribute(buffer,size,normalized,type,stride,start,instance){void 0===size&&(size=0),void 0===normalized&&(normalized=!1),void 0===type&&(type=TYPES$1.FLOAT),this.buffer=buffer,this.size=size,this.normalized=normalized,this.type=type,this.stride=stride,this.start=start,this.instance=instance}return Attribute.prototype.destroy=function(){this.buffer=null},Attribute.from=function(buffer,size,normalized,type,stride){return new Attribute(buffer,size,normalized,type,stride)},Attribute}(),UID$4=0,Buffer=function(){function Buffer(data,_static,index){void 0===_static&&(_static=!0),void 0===index&&(index=!1),this.data=data||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=index,this.static=_static,this.id=UID$4++,this.disposeRunner=new Runner("disposeBuffer")}return Buffer.prototype.update=function(data){data instanceof Array&&(data=new Float32Array(data)),this.data=data||this.data,this._updateID++},Buffer.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},Buffer.prototype.destroy=function(){this.dispose(),this.data=null},Object.defineProperty(Buffer.prototype,"index",{get:function(){return this.type===BUFFER_TYPE$1.ELEMENT_ARRAY_BUFFER},set:function(value){this.type=value?BUFFER_TYPE$1.ELEMENT_ARRAY_BUFFER:BUFFER_TYPE$1.ARRAY_BUFFER},enumerable:!1,configurable:!0}),Buffer.from=function(data){return data instanceof Array&&(data=new Float32Array(data)),new Buffer(data)},Buffer}(),map$1={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array};var byteSizeMap$1={5126:4,5123:2,5121:1},UID$3=0,map={Float32Array:Float32Array,Uint32Array:Uint32Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array},Geometry=function(){function Geometry(buffers,attributes){void 0===buffers&&(buffers=[]),void 0===attributes&&(attributes={}),this.buffers=buffers,this.indexBuffer=null,this.attributes=attributes,this.glVertexArrayObjects={},this.id=UID$3++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Runner("disposeGeometry"),this.refCount=0}return Geometry.prototype.addAttribute=function(id,buffer,size,normalized,type,stride,start,instance){if(void 0===size&&(size=0),void 0===normalized&&(normalized=!1),void 0===instance&&(instance=!1),!buffer)throw new Error("You must pass a buffer when creating an attribute");buffer instanceof Buffer||(buffer instanceof Array&&(buffer=new Float32Array(buffer)),buffer=new Buffer(buffer));var ids=id.split("|");if(ids.length>1){for(var i=0;i<ids.length;i++)this.addAttribute(ids[i],buffer,size,normalized,type);return this}var bufferIndex=this.buffers.indexOf(buffer);return-1===bufferIndex&&(this.buffers.push(buffer),bufferIndex=this.buffers.length-1),this.attributes[id]=new Attribute(bufferIndex,size,normalized,type,stride,start,instance),this.instanced=this.instanced||instance,this},Geometry.prototype.getAttribute=function(id){return this.attributes[id]},Geometry.prototype.getBuffer=function(id){return this.buffers[this.getAttribute(id).buffer]},Geometry.prototype.addIndex=function(buffer){return buffer instanceof Buffer||(buffer instanceof Array&&(buffer=new Uint16Array(buffer)),buffer=new Buffer(buffer)),buffer.type=BUFFER_TYPE$1.ELEMENT_ARRAY_BUFFER,this.indexBuffer=buffer,-1===this.buffers.indexOf(buffer)&&this.buffers.push(buffer),this},Geometry.prototype.getIndex=function(){return this.indexBuffer},Geometry.prototype.interleave=function(){if(1===this.buffers.length||2===this.buffers.length&&this.indexBuffer)return this;var i,arrays=[],sizes=[],interleavedBuffer=new Buffer;for(i in this.attributes){var attribute=this.attributes[i],buffer=this.buffers[attribute.buffer];arrays.push(buffer.data),sizes.push(attribute.size*byteSizeMap$1[attribute.type]/4),attribute.buffer=0}for(interleavedBuffer.data=function(arrays,sizes){for(var outSize=0,stride=0,views={},i=0;i<arrays.length;i++)stride+=sizes[i],outSize+=arrays[i].length;var buffer=new ArrayBuffer(4*outSize),out=null,littleOffset=0;for(i=0;i<arrays.length;i++){var size=sizes[i],array=arrays[i],type=getBufferType(array);views[type]||(views[type]=new map$1[type](buffer)),out=views[type];for(var j=0;j<array.length;j++)out[(j/size|0)*stride+littleOffset+j%size]=array[j];littleOffset+=size}return new Float32Array(buffer)}(arrays,sizes),i=0;i<this.buffers.length;i++)this.buffers[i]!==this.indexBuffer&&this.buffers[i].destroy();return this.buffers=[interleavedBuffer],this.indexBuffer&&this.buffers.push(this.indexBuffer),this},Geometry.prototype.getSize=function(){for(var i in this.attributes){var attribute=this.attributes[i];return this.buffers[attribute.buffer].data.length/(attribute.stride/4||attribute.size)}return 0},Geometry.prototype.dispose=function(){this.disposeRunner.emit(this,!1)},Geometry.prototype.destroy=function(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null},Geometry.prototype.clone=function(){for(var geometry=new Geometry,i=0;i<this.buffers.length;i++)geometry.buffers[i]=new Buffer(this.buffers[i].data.slice(0));for(var i in this.attributes){var attrib=this.attributes[i];geometry.attributes[i]=new Attribute(attrib.buffer,attrib.size,attrib.normalized,attrib.type,attrib.stride,attrib.start,attrib.instance)}return this.indexBuffer&&(geometry.indexBuffer=geometry.buffers[this.buffers.indexOf(this.indexBuffer)],geometry.indexBuffer.type=BUFFER_TYPE$1.ELEMENT_ARRAY_BUFFER),geometry},Geometry.merge=function(geometries){for(var geometry,geometryOut=new Geometry,arrays=[],sizes=[],offsets=[],i=0;i<geometries.length;i++){geometry=geometries[i];for(var j=0;j<geometry.buffers.length;j++)sizes[j]=sizes[j]||0,sizes[j]+=geometry.buffers[j].data.length,offsets[j]=0}for(i=0;i<geometry.buffers.length;i++)arrays[i]=new(map[getBufferType(geometry.buffers[i].data)])(sizes[i]),geometryOut.buffers[i]=new Buffer(arrays[i]);for(i=0;i<geometries.length;i++){geometry=geometries[i];for(j=0;j<geometry.buffers.length;j++)arrays[j].set(geometry.buffers[j].data,offsets[j]),offsets[j]+=geometry.buffers[j].data.length}if(geometryOut.attributes=geometry.attributes,geometry.indexBuffer){geometryOut.indexBuffer=geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)],geometryOut.indexBuffer.type=BUFFER_TYPE$1.ELEMENT_ARRAY_BUFFER;var offset=0,stride=0,offset2=0,bufferIndexToCount=0;for(i=0;i<geometry.buffers.length;i++)if(geometry.buffers[i]!==geometry.indexBuffer){bufferIndexToCount=i;break}for(var i in geometry.attributes){var attribute=geometry.attributes[i];(0|attribute.buffer)===bufferIndexToCount&&(stride+=attribute.size*byteSizeMap$1[attribute.type]/4)}for(i=0;i<geometries.length;i++){var indexBufferData=geometries[i].indexBuffer.data;for(j=0;j<indexBufferData.length;j++)geometryOut.indexBuffer.data[j+offset2]+=offset;offset+=geometries[i].buffers[bufferIndexToCount].data.length/stride,offset2+=indexBufferData.length}}return geometryOut},Geometry}(),Quad=function(_super){function Quad(){var _this=_super.call(this)||this;return _this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2]),_this}return __extends$3(Quad,_super),Quad}(Geometry),QuadUv=function(_super){function QuadUv(){var _this=_super.call(this)||this;return _this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),_this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),_this.vertexBuffer=new Buffer(_this.vertices),_this.uvBuffer=new Buffer(_this.uvs),_this.addAttribute("aVertexPosition",_this.vertexBuffer).addAttribute("aTextureCoord",_this.uvBuffer).addIndex([0,1,2,0,2,3]),_this}return __extends$3(QuadUv,_super),QuadUv.prototype.map=function(targetTextureFrame,destinationFrame){var x=0,y=0;return this.uvs[0]=x,this.uvs[1]=y,this.uvs[2]=x+destinationFrame.width/targetTextureFrame.width,this.uvs[3]=y,this.uvs[4]=x+destinationFrame.width/targetTextureFrame.width,this.uvs[5]=y+destinationFrame.height/targetTextureFrame.height,this.uvs[6]=x,this.uvs[7]=y+destinationFrame.height/targetTextureFrame.height,x=destinationFrame.x,y=destinationFrame.y,this.vertices[0]=x,this.vertices[1]=y,this.vertices[2]=x+destinationFrame.width,this.vertices[3]=y,this.vertices[4]=x+destinationFrame.width,this.vertices[5]=y+destinationFrame.height,this.vertices[6]=x,this.vertices[7]=y+destinationFrame.height,this.invalidate(),this},QuadUv.prototype.invalidate=function(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this},QuadUv}(Geometry),UID$2=0,UniformGroup=function(){function UniformGroup(uniforms,isStatic,isUbo){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=UID$2++,this.static=!!isStatic,this.ubo=!!isUbo,uniforms instanceof Buffer?(this.buffer=uniforms,this.buffer.type=BUFFER_TYPE$1.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=uniforms,this.ubo&&(this.buffer=new Buffer(new Float32Array(1)),this.buffer.type=BUFFER_TYPE$1.UNIFORM_BUFFER,this.autoManage=!0))}return UniformGroup.prototype.update=function(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()},UniformGroup.prototype.add=function(name,uniforms,_static){if(this.ubo)throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them");this.uniforms[name]=new UniformGroup(uniforms,_static)},UniformGroup.from=function(uniforms,_static,_ubo){return new UniformGroup(uniforms,_static,_ubo)},UniformGroup.uboFrom=function(uniforms,_static){return new UniformGroup(uniforms,null==_static||_static,!0)},UniformGroup}(),FilterState=function(){function FilterState(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=MSAA_QUALITY$1.NONE,this.sourceFrame=new Rectangle,this.destinationFrame=new Rectangle,this.bindingSourceFrame=new Rectangle,this.bindingDestinationFrame=new Rectangle,this.filters=[],this.transform=null}return FilterState.prototype.clear=function(){this.target=null,this.filters=null,this.renderTexture=null},FilterState}(),tempPoints$1=[new Point,new Point,new Point,new Point],tempMatrix$2=new Matrix,FilterSystem=function(){function FilterSystem(renderer){this.renderer=renderer,this.defaultFilterStack=[{}],this.texturePool=new RenderTexturePool,this.texturePool.setScreenSize(renderer.view),this.statePool=[],this.quad=new Quad,this.quadUv=new QuadUv,this.tempRect=new Rectangle,this.activeState={},this.globalUniforms=new UniformGroup({outputFrame:new Rectangle,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}return FilterSystem.prototype.push=function(target,filters){for(var _a,_b,renderer=this.renderer,filterStack=this.defaultFilterStack,state=this.statePool.pop()||new FilterState,renderTextureSystem=this.renderer.renderTexture,resolution=filters[0].resolution,multisample=filters[0].multisample,padding=filters[0].padding,autoFit=filters[0].autoFit,legacy=null===(_a=filters[0].legacy)||void 0===_a||_a,i=1;i<filters.length;i++){var filter=filters[i];resolution=Math.min(resolution,filter.resolution),multisample=Math.min(multisample,filter.multisample),padding=this.useMaxPadding?Math.max(padding,filter.padding):padding+filter.padding,autoFit=autoFit&&filter.autoFit,legacy=legacy||null===(_b=filter.legacy)||void 0===_b||_b}1===filterStack.length&&(this.defaultFilterStack[0].renderTexture=renderTextureSystem.current),filterStack.push(state),state.resolution=resolution,state.multisample=multisample,state.legacy=legacy,state.target=target,state.sourceFrame.copyFrom(target.filterArea||target.getBounds(!0)),state.sourceFrame.pad(padding);var sourceFrameProjected=this.tempRect.copyFrom(renderTextureSystem.sourceFrame);renderer.projection.transform&&this.transformAABB(tempMatrix$2.copyFrom(renderer.projection.transform).invert(),sourceFrameProjected),autoFit?(state.sourceFrame.fit(sourceFrameProjected),(state.sourceFrame.width<=0||state.sourceFrame.height<=0)&&(state.sourceFrame.width=0,state.sourceFrame.height=0)):state.sourceFrame.intersects(sourceFrameProjected)||(state.sourceFrame.width=0,state.sourceFrame.height=0),this.roundFrame(state.sourceFrame,renderTextureSystem.current?renderTextureSystem.current.resolution:renderer.resolution,renderTextureSystem.sourceFrame,renderTextureSystem.destinationFrame,renderer.projection.transform),state.renderTexture=this.getOptimalFilterTexture(state.sourceFrame.width,state.sourceFrame.height,resolution,multisample),state.filters=filters,state.destinationFrame.width=state.renderTexture.width,state.destinationFrame.height=state.renderTexture.height;var destinationFrame=this.tempRect;destinationFrame.x=0,destinationFrame.y=0,destinationFrame.width=state.sourceFrame.width,destinationFrame.height=state.sourceFrame.height,state.renderTexture.filterFrame=state.sourceFrame,state.bindingSourceFrame.copyFrom(renderTextureSystem.sourceFrame),state.bindingDestinationFrame.copyFrom(renderTextureSystem.destinationFrame),state.transform=renderer.projection.transform,renderer.projection.transform=null,renderTextureSystem.bind(state.renderTexture,state.sourceFrame,destinationFrame),renderer.framebuffer.clear(0,0,0,0)},FilterSystem.prototype.pop=function(){var filterStack=this.defaultFilterStack,state=filterStack.pop(),filters=state.filters;this.activeState=state;var globalUniforms=this.globalUniforms.uniforms;globalUniforms.outputFrame=state.sourceFrame,globalUniforms.resolution=state.resolution;var inputSize=globalUniforms.inputSize,inputPixel=globalUniforms.inputPixel,inputClamp=globalUniforms.inputClamp;if(inputSize[0]=state.destinationFrame.width,inputSize[1]=state.destinationFrame.height,inputSize[2]=1/inputSize[0],inputSize[3]=1/inputSize[1],inputPixel[0]=Math.round(inputSize[0]*state.resolution),inputPixel[1]=Math.round(inputSize[1]*state.resolution),inputPixel[2]=1/inputPixel[0],inputPixel[3]=1/inputPixel[1],inputClamp[0]=.5*inputPixel[2],inputClamp[1]=.5*inputPixel[3],inputClamp[2]=state.sourceFrame.width*inputSize[2]-.5*inputPixel[2],inputClamp[3]=state.sourceFrame.height*inputSize[3]-.5*inputPixel[3],state.legacy){var filterArea=globalUniforms.filterArea;filterArea[0]=state.destinationFrame.width,filterArea[1]=state.destinationFrame.height,filterArea[2]=state.sourceFrame.x,filterArea[3]=state.sourceFrame.y,globalUniforms.filterClamp=globalUniforms.inputClamp}this.globalUniforms.update();var lastState=filterStack[filterStack.length-1];if(this.renderer.framebuffer.blit(),1===filters.length)filters[0].apply(this,state.renderTexture,lastState.renderTexture,CLEAR_MODES$1.BLEND,state),this.returnFilterTexture(state.renderTexture);else{var flip=state.renderTexture,flop=this.getOptimalFilterTexture(flip.width,flip.height,state.resolution);flop.filterFrame=flip.filterFrame;var i=0;for(i=0;i<filters.length-1;++i){1===i&&state.multisample>1&&((flop=this.getOptimalFilterTexture(flip.width,flip.height,state.resolution)).filterFrame=flip.filterFrame),filters[i].apply(this,flip,flop,CLEAR_MODES$1.CLEAR,state);var t=flip;flip=flop,flop=t}filters[i].apply(this,flip,lastState.renderTexture,CLEAR_MODES$1.BLEND,state),i>1&&state.multisample>1&&this.returnFilterTexture(state.renderTexture),this.returnFilterTexture(flip),this.returnFilterTexture(flop)}state.clear(),this.statePool.push(state)},FilterSystem.prototype.bindAndClear=function(filterTexture,clearMode){void 0===clearMode&&(clearMode=CLEAR_MODES$1.CLEAR);var _a=this.renderer,renderTextureSystem=_a.renderTexture,stateSystem=_a.state;if(filterTexture===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,filterTexture&&filterTexture.filterFrame){var destinationFrame=this.tempRect;destinationFrame.x=0,destinationFrame.y=0,destinationFrame.width=filterTexture.filterFrame.width,destinationFrame.height=filterTexture.filterFrame.height,renderTextureSystem.bind(filterTexture,filterTexture.filterFrame,destinationFrame)}else filterTexture!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?renderTextureSystem.bind(filterTexture):this.renderer.renderTexture.bind(filterTexture,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var autoClear=1&stateSystem.stateId||this.forceClear;(clearMode===CLEAR_MODES$1.CLEAR||clearMode===CLEAR_MODES$1.BLIT&&autoClear)&&this.renderer.framebuffer.clear(0,0,0,0)},FilterSystem.prototype.applyFilter=function(filter,input,output,clearMode){var renderer=this.renderer;renderer.state.set(filter.state),this.bindAndClear(output,clearMode),filter.uniforms.uSampler=input,filter.uniforms.filterGlobals=this.globalUniforms,renderer.shader.bind(filter),filter.legacy=!!filter.program.attributeData.aTextureCoord,filter.legacy?(this.quadUv.map(input._frame,input.filterFrame),renderer.geometry.bind(this.quadUv),renderer.geometry.draw(DRAW_MODES$1.TRIANGLES)):(renderer.geometry.bind(this.quad),renderer.geometry.draw(DRAW_MODES$1.TRIANGLE_STRIP))},FilterSystem.prototype.calculateSpriteMatrix=function(outputMatrix,sprite){var _a=this.activeState,sourceFrame=_a.sourceFrame,destinationFrame=_a.destinationFrame,orig=sprite._texture.orig,mappedMatrix=outputMatrix.set(destinationFrame.width,0,0,destinationFrame.height,sourceFrame.x,sourceFrame.y),worldTransform=sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);return worldTransform.invert(),mappedMatrix.prepend(worldTransform),mappedMatrix.scale(1/orig.width,1/orig.height),mappedMatrix.translate(sprite.anchor.x,sprite.anchor.y),mappedMatrix},FilterSystem.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},FilterSystem.prototype.getOptimalFilterTexture=function(minWidth,minHeight,resolution,multisample){return void 0===resolution&&(resolution=1),void 0===multisample&&(multisample=MSAA_QUALITY$1.NONE),this.texturePool.getOptimalTexture(minWidth,minHeight,resolution,multisample)},FilterSystem.prototype.getFilterTexture=function(input,resolution,multisample){if("number"==typeof input){var swap=input;input=resolution,resolution=swap}input=input||this.activeState.renderTexture;var filterTexture=this.texturePool.getOptimalTexture(input.width,input.height,resolution||input.resolution,multisample||MSAA_QUALITY$1.NONE);return filterTexture.filterFrame=input.filterFrame,filterTexture},FilterSystem.prototype.returnFilterTexture=function(renderTexture){this.texturePool.returnTexture(renderTexture)},FilterSystem.prototype.emptyPool=function(){this.texturePool.clear(!0)},FilterSystem.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},FilterSystem.prototype.transformAABB=function(matrix,rect){var lt=tempPoints$1[0],lb=tempPoints$1[1],rt=tempPoints$1[2],rb=tempPoints$1[3];lt.set(rect.left,rect.top),lb.set(rect.left,rect.bottom),rt.set(rect.right,rect.top),rb.set(rect.right,rect.bottom),matrix.apply(lt,lt),matrix.apply(lb,lb),matrix.apply(rt,rt),matrix.apply(rb,rb);var x0=Math.min(lt.x,lb.x,rt.x,rb.x),y0=Math.min(lt.y,lb.y,rt.y,rb.y),x1=Math.max(lt.x,lb.x,rt.x,rb.x),y1=Math.max(lt.y,lb.y,rt.y,rb.y);rect.x=x0,rect.y=y0,rect.width=x1-x0,rect.height=y1-y0},FilterSystem.prototype.roundFrame=function(frame,resolution,bindingSourceFrame,bindingDestinationFrame,transform){if(!(frame.width<=0||frame.height<=0||bindingSourceFrame.width<=0||bindingSourceFrame.height<=0)){if(transform){var a=transform.a,b=transform.b,c=transform.c,d=transform.d;if((Math.abs(b)>1e-4||Math.abs(c)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(d)>1e-4))return}(transform=transform?tempMatrix$2.copyFrom(transform):tempMatrix$2.identity()).translate(-bindingSourceFrame.x,-bindingSourceFrame.y).scale(bindingDestinationFrame.width/bindingSourceFrame.width,bindingDestinationFrame.height/bindingSourceFrame.height).translate(bindingDestinationFrame.x,bindingDestinationFrame.y),this.transformAABB(transform,frame),frame.ceil(resolution),this.transformAABB(transform.invert(),frame)}},FilterSystem}(),ObjectRenderer=function(){function ObjectRenderer(renderer){this.renderer=renderer}return ObjectRenderer.prototype.flush=function(){},ObjectRenderer.prototype.destroy=function(){this.renderer=null},ObjectRenderer.prototype.start=function(){},ObjectRenderer.prototype.stop=function(){this.flush()},ObjectRenderer.prototype.render=function(_object){},ObjectRenderer}(),BatchSystem=function(){function BatchSystem(renderer){this.renderer=renderer,this.emptyRenderer=new ObjectRenderer(renderer),this.currentRenderer=this.emptyRenderer}return BatchSystem.prototype.setObjectRenderer=function(objectRenderer){this.currentRenderer!==objectRenderer&&(this.currentRenderer.stop(),this.currentRenderer=objectRenderer,this.currentRenderer.start())},BatchSystem.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},BatchSystem.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},BatchSystem.prototype.copyBoundTextures=function(arr,maxTextures){for(var boundTextures=this.renderer.texture.boundTextures,i=maxTextures-1;i>=0;--i)arr[i]=boundTextures[i]||null,arr[i]&&(arr[i]._batchLocation=i)},BatchSystem.prototype.boundArray=function(texArray,boundTextures,batchId,maxTextures){for(var elements=texArray.elements,ids=texArray.ids,count=texArray.count,j=0,i=0;i<count;i++){var tex=elements[i],loc=tex._batchLocation;if(loc>=0&&loc<maxTextures&&boundTextures[loc]===tex)ids[i]=loc;else for(;j<maxTextures;){var bound=boundTextures[j];if(!bound||bound._batchEnabled!==batchId||bound._batchLocation!==j){ids[i]=j,tex._batchLocation=j,boundTextures[j]=tex;break}j++}}},BatchSystem.prototype.destroy=function(){this.renderer=null},BatchSystem}(),CONTEXT_UID_COUNTER=0,ContextSystem=function(){function ContextSystem(renderer){this.renderer=renderer,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this),renderer.view.addEventListener("webglcontextlost",this.handleContextLost,!1),renderer.view.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}return Object.defineProperty(ContextSystem.prototype,"isLost",{get:function(){return!this.gl||this.gl.isContextLost()},enumerable:!1,configurable:!0}),ContextSystem.prototype.contextChange=function(gl){this.gl=gl,this.renderer.gl=gl,this.renderer.CONTEXT_UID=CONTEXT_UID_COUNTER++,gl.isContextLost()&&gl.getExtension("WEBGL_lose_context")&&gl.getExtension("WEBGL_lose_context").restoreContext()},ContextSystem.prototype.initFromContext=function(gl){this.gl=gl,this.validateContext(gl),this.renderer.gl=gl,this.renderer.CONTEXT_UID=CONTEXT_UID_COUNTER++,this.renderer.runners.contextChange.emit(gl)},ContextSystem.prototype.initFromOptions=function(options){var gl=this.createContext(this.renderer.view,options);this.initFromContext(gl)},ContextSystem.prototype.createContext=function(canvas,options){var gl;if(settings.PREFER_ENV>=ENV$1.WEBGL2&&(gl=canvas.getContext("webgl2",options)),gl)this.webGLVersion=2;else if(this.webGLVersion=1,!(gl=canvas.getContext("webgl",options)||canvas.getContext("experimental-webgl",options)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=gl,this.getExtensions(),this.gl},ContextSystem.prototype.getExtensions=function(){var gl=this.gl,common={anisotropicFiltering:gl.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:gl.getExtension("OES_texture_float_linear"),s3tc:gl.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:gl.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:gl.getExtension("WEBGL_compressed_texture_etc"),etc1:gl.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:gl.getExtension("WEBGL_compressed_texture_pvrtc")||gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:gl.getExtension("WEBGL_compressed_texture_atc"),astc:gl.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,common,{drawBuffers:gl.getExtension("WEBGL_draw_buffers"),depthTexture:gl.getExtension("WEBGL_depth_texture"),loseContext:gl.getExtension("WEBGL_lose_context"),vertexArrayObject:gl.getExtension("OES_vertex_array_object")||gl.getExtension("MOZ_OES_vertex_array_object")||gl.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:gl.getExtension("OES_element_index_uint"),floatTexture:gl.getExtension("OES_texture_float"),floatTextureLinear:gl.getExtension("OES_texture_float_linear"),textureHalfFloat:gl.getExtension("OES_texture_half_float"),textureHalfFloatLinear:gl.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,common,{colorBufferFloat:gl.getExtension("EXT_color_buffer_float")})},ContextSystem.prototype.handleContextLost=function(event){event.preventDefault()},ContextSystem.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},ContextSystem.prototype.destroy=function(){var view=this.renderer.view;this.renderer=null,view.removeEventListener("webglcontextlost",this.handleContextLost),view.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},ContextSystem.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},ContextSystem.prototype.validateContext=function(gl){var attributes=gl.getContextAttributes(),isWebGl2="WebGL2RenderingContext"in globalThis&&gl instanceof globalThis.WebGL2RenderingContext;isWebGl2&&(this.webGLVersion=2),attributes&&!attributes.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var hasuint32=isWebGl2||!!gl.getExtension("OES_element_index_uint");this.supports.uint32Indices=hasuint32,hasuint32||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},ContextSystem}(),GLFramebuffer=function(framebuffer){this.framebuffer=framebuffer,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=MSAA_QUALITY$1.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0},tempRectangle=new Rectangle,FramebufferSystem=function(){function FramebufferSystem(renderer){this.renderer=renderer,this.managedFramebuffers=[],this.unknownFramebuffer=new Framebuffer(10,10),this.msaaSamples=null}return FramebufferSystem.prototype.contextChange=function(){var gl=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new Rectangle,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion){var nativeDrawBuffersExtension_1=this.renderer.context.extensions.drawBuffers,nativeDepthTextureExtension=this.renderer.context.extensions.depthTexture;settings.PREFER_ENV===ENV$1.WEBGL_LEGACY&&(nativeDrawBuffersExtension_1=null,nativeDepthTextureExtension=null),nativeDrawBuffersExtension_1?gl.drawBuffers=function(activeTextures){return nativeDrawBuffersExtension_1.drawBuffersWEBGL(activeTextures)}:(this.hasMRT=!1,gl.drawBuffers=function(){}),nativeDepthTextureExtension||(this.writeDepthTexture=!1)}else this.msaaSamples=gl.getInternalformatParameter(gl.RENDERBUFFER,gl.RGBA8,gl.SAMPLES)},FramebufferSystem.prototype.bind=function(framebuffer,frame,mipLevel){void 0===mipLevel&&(mipLevel=0);var gl=this.gl;if(framebuffer){var fbo=framebuffer.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(framebuffer);this.current!==framebuffer&&(this.current=framebuffer,gl.bindFramebuffer(gl.FRAMEBUFFER,fbo.framebuffer)),fbo.mipLevel!==mipLevel&&(framebuffer.dirtyId++,framebuffer.dirtyFormat++,fbo.mipLevel=mipLevel),fbo.dirtyId!==framebuffer.dirtyId&&(fbo.dirtyId=framebuffer.dirtyId,fbo.dirtyFormat!==framebuffer.dirtyFormat?(fbo.dirtyFormat=framebuffer.dirtyFormat,fbo.dirtySize=framebuffer.dirtySize,this.updateFramebuffer(framebuffer,mipLevel)):fbo.dirtySize!==framebuffer.dirtySize&&(fbo.dirtySize=framebuffer.dirtySize,this.resizeFramebuffer(framebuffer)));for(var i=0;i<framebuffer.colorTextures.length;i++){var tex=framebuffer.colorTextures[i];this.renderer.texture.unbind(tex.parentTextureArray||tex)}if(framebuffer.depthTexture&&this.renderer.texture.unbind(framebuffer.depthTexture),frame){var mipWidth=frame.width>>mipLevel,mipHeight=frame.height>>mipLevel,scale=mipWidth/frame.width;this.setViewport(frame.x*scale,frame.y*scale,mipWidth,mipHeight)}else{mipWidth=framebuffer.width>>mipLevel,mipHeight=framebuffer.height>>mipLevel;this.setViewport(0,0,mipWidth,mipHeight)}}else this.current&&(this.current=null,gl.bindFramebuffer(gl.FRAMEBUFFER,null)),frame?this.setViewport(frame.x,frame.y,frame.width,frame.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},FramebufferSystem.prototype.setViewport=function(x,y,width,height){var v=this.viewport;x=Math.round(x),y=Math.round(y),width=Math.round(width),height=Math.round(height),v.width===width&&v.height===height&&v.x===x&&v.y===y||(v.x=x,v.y=y,v.width=width,v.height=height,this.gl.viewport(x,y,width,height))},Object.defineProperty(FramebufferSystem.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),FramebufferSystem.prototype.clear=function(r,g,b,a,mask){void 0===mask&&(mask=BUFFER_BITS$1.COLOR|BUFFER_BITS$1.DEPTH);var gl=this.gl;gl.clearColor(r,g,b,a),gl.clear(mask)},FramebufferSystem.prototype.initFramebuffer=function(framebuffer){var gl=this.gl,fbo=new GLFramebuffer(gl.createFramebuffer());return fbo.multisample=this.detectSamples(framebuffer.multisample),framebuffer.glFramebuffers[this.CONTEXT_UID]=fbo,this.managedFramebuffers.push(framebuffer),framebuffer.disposeRunner.add(this),fbo},FramebufferSystem.prototype.resizeFramebuffer=function(framebuffer){var gl=this.gl,fbo=framebuffer.glFramebuffers[this.CONTEXT_UID];fbo.msaaBuffer&&(gl.bindRenderbuffer(gl.RENDERBUFFER,fbo.msaaBuffer),gl.renderbufferStorageMultisample(gl.RENDERBUFFER,fbo.multisample,gl.RGBA8,framebuffer.width,framebuffer.height)),fbo.stencil&&(gl.bindRenderbuffer(gl.RENDERBUFFER,fbo.stencil),fbo.msaaBuffer?gl.renderbufferStorageMultisample(gl.RENDERBUFFER,fbo.multisample,gl.DEPTH24_STENCIL8,framebuffer.width,framebuffer.height):gl.renderbufferStorage(gl.RENDERBUFFER,gl.DEPTH_STENCIL,framebuffer.width,framebuffer.height));var colorTextures=framebuffer.colorTextures,count=colorTextures.length;gl.drawBuffers||(count=Math.min(count,1));for(var i=0;i<count;i++){var texture=colorTextures[i],parentTexture=texture.parentTextureArray||texture;this.renderer.texture.bind(parentTexture,0)}framebuffer.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(framebuffer.depthTexture,0)},FramebufferSystem.prototype.updateFramebuffer=function(framebuffer,mipLevel){var gl=this.gl,fbo=framebuffer.glFramebuffers[this.CONTEXT_UID],colorTextures=framebuffer.colorTextures,count=colorTextures.length;gl.drawBuffers||(count=Math.min(count,1)),fbo.multisample>1&&this.canMultisampleFramebuffer(framebuffer)?(fbo.msaaBuffer=fbo.msaaBuffer||gl.createRenderbuffer(),gl.bindRenderbuffer(gl.RENDERBUFFER,fbo.msaaBuffer),gl.renderbufferStorageMultisample(gl.RENDERBUFFER,fbo.multisample,gl.RGBA8,framebuffer.width,framebuffer.height),gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,fbo.msaaBuffer)):fbo.msaaBuffer&&(gl.deleteRenderbuffer(fbo.msaaBuffer),fbo.msaaBuffer=null,fbo.blitFramebuffer&&(fbo.blitFramebuffer.dispose(),fbo.blitFramebuffer=null));for(var activeTextures=[],i=0;i<count;i++){var texture=colorTextures[i],parentTexture=texture.parentTextureArray||texture;this.renderer.texture.bind(parentTexture,0),0===i&&fbo.msaaBuffer||(gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0+i,texture.target,parentTexture._glTextures[this.CONTEXT_UID].texture,mipLevel),activeTextures.push(gl.COLOR_ATTACHMENT0+i))}if((activeTextures.length>1&&gl.drawBuffers(activeTextures),framebuffer.depthTexture)&&this.writeDepthTexture){var depthTexture=framebuffer.depthTexture;this.renderer.texture.bind(depthTexture,0),gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.DEPTH_ATTACHMENT,gl.TEXTURE_2D,depthTexture._glTextures[this.CONTEXT_UID].texture,mipLevel)}!framebuffer.stencil&&!framebuffer.depth||framebuffer.depthTexture&&this.writeDepthTexture?fbo.stencil&&(gl.deleteRenderbuffer(fbo.stencil),fbo.stencil=null):(fbo.stencil=fbo.stencil||gl.createRenderbuffer(),gl.bindRenderbuffer(gl.RENDERBUFFER,fbo.stencil),fbo.msaaBuffer?gl.renderbufferStorageMultisample(gl.RENDERBUFFER,fbo.multisample,gl.DEPTH24_STENCIL8,framebuffer.width,framebuffer.height):gl.renderbufferStorage(gl.RENDERBUFFER,gl.DEPTH_STENCIL,framebuffer.width,framebuffer.height),gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_STENCIL_ATTACHMENT,gl.RENDERBUFFER,fbo.stencil))},FramebufferSystem.prototype.canMultisampleFramebuffer=function(framebuffer){return 1!==this.renderer.context.webGLVersion&&framebuffer.colorTextures.length<=1&&!framebuffer.depthTexture},FramebufferSystem.prototype.detectSamples=function(samples){var msaaSamples=this.msaaSamples,res=MSAA_QUALITY$1.NONE;if(samples<=1||null===msaaSamples)return res;for(var i=0;i<msaaSamples.length;i++)if(msaaSamples[i]<=samples){res=msaaSamples[i];break}return 1===res&&(res=MSAA_QUALITY$1.NONE),res},FramebufferSystem.prototype.blit=function(framebuffer,sourcePixels,destPixels){var current=this.current,renderer=this.renderer,gl=this.gl,CONTEXT_UID=this.CONTEXT_UID;if(2===renderer.context.webGLVersion&¤t){var fbo=current.glFramebuffers[CONTEXT_UID];if(fbo){if(!framebuffer){if(!fbo.msaaBuffer)return;var colorTexture=current.colorTextures[0];if(!colorTexture)return;fbo.blitFramebuffer||(fbo.blitFramebuffer=new Framebuffer(current.width,current.height),fbo.blitFramebuffer.addColorTexture(0,colorTexture)),(framebuffer=fbo.blitFramebuffer).colorTextures[0]!==colorTexture&&(framebuffer.colorTextures[0]=colorTexture,framebuffer.dirtyId++,framebuffer.dirtyFormat++),framebuffer.width===current.width&&framebuffer.height===current.height||(framebuffer.width=current.width,framebuffer.height=current.height,framebuffer.dirtyId++,framebuffer.dirtySize++)}sourcePixels||((sourcePixels=tempRectangle).width=current.width,sourcePixels.height=current.height),destPixels||(destPixels=sourcePixels);var sameSize=sourcePixels.width===destPixels.width&&sourcePixels.height===destPixels.height;this.bind(framebuffer),gl.bindFramebuffer(gl.READ_FRAMEBUFFER,fbo.framebuffer),gl.blitFramebuffer(sourcePixels.left,sourcePixels.top,sourcePixels.right,sourcePixels.bottom,destPixels.left,destPixels.top,destPixels.right,destPixels.bottom,gl.COLOR_BUFFER_BIT,sameSize?gl.NEAREST:gl.LINEAR)}}},FramebufferSystem.prototype.disposeFramebuffer=function(framebuffer,contextLost){var fbo=framebuffer.glFramebuffers[this.CONTEXT_UID],gl=this.gl;if(fbo){delete framebuffer.glFramebuffers[this.CONTEXT_UID];var index=this.managedFramebuffers.indexOf(framebuffer);index>=0&&this.managedFramebuffers.splice(index,1),framebuffer.disposeRunner.remove(this),contextLost||(gl.deleteFramebuffer(fbo.framebuffer),fbo.msaaBuffer&&gl.deleteRenderbuffer(fbo.msaaBuffer),fbo.stencil&&gl.deleteRenderbuffer(fbo.stencil)),fbo.blitFramebuffer&&fbo.blitFramebuffer.dispose()}},FramebufferSystem.prototype.disposeAll=function(contextLost){var list=this.managedFramebuffers;this.managedFramebuffers=[];for(var i=0;i<list.length;i++)this.disposeFramebuffer(list[i],contextLost)},FramebufferSystem.prototype.forceStencil=function(){var framebuffer=this.current;if(framebuffer){var fbo=framebuffer.glFramebuffers[this.CONTEXT_UID];if(fbo&&!fbo.stencil){framebuffer.stencil=!0;var w=framebuffer.width,h=framebuffer.height,gl=this.gl,stencil=gl.createRenderbuffer();gl.bindRenderbuffer(gl.RENDERBUFFER,stencil),fbo.msaaBuffer?gl.renderbufferStorageMultisample(gl.RENDERBUFFER,fbo.multisample,gl.DEPTH24_STENCIL8,w,h):gl.renderbufferStorage(gl.RENDERBUFFER,gl.DEPTH_STENCIL,w,h),fbo.stencil=stencil,gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_STENCIL_ATTACHMENT,gl.RENDERBUFFER,stencil)}}},FramebufferSystem.prototype.reset=function(){this.current=this.unknownFramebuffer,this.viewport=new Rectangle},FramebufferSystem.prototype.destroy=function(){this.renderer=null},FramebufferSystem}(),byteSizeMap={5126:4,5123:2,5121:1},GeometrySystem=function(){function GeometrySystem(renderer){this.renderer=renderer,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}return GeometrySystem.prototype.contextChange=function(){this.disposeAll(!0);var gl=this.gl=this.renderer.gl,context=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,2!==context.webGLVersion){var nativeVaoExtension_1=this.renderer.context.extensions.vertexArrayObject;settings.PREFER_ENV===ENV$1.WEBGL_LEGACY&&(nativeVaoExtension_1=null),nativeVaoExtension_1?(gl.createVertexArray=function(){return nativeVaoExtension_1.createVertexArrayOES()},gl.bindVertexArray=function(vao){return nativeVaoExtension_1.bindVertexArrayOES(vao)},gl.deleteVertexArray=function(vao){return nativeVaoExtension_1.deleteVertexArrayOES(vao)}):(this.hasVao=!1,gl.createVertexArray=function(){return null},gl.bindVertexArray=function(){return null},gl.deleteVertexArray=function(){return null})}if(2!==context.webGLVersion){var instanceExt_1=gl.getExtension("ANGLE_instanced_arrays");instanceExt_1?(gl.vertexAttribDivisor=function(a,b){return instanceExt_1.vertexAttribDivisorANGLE(a,b)},gl.drawElementsInstanced=function(a,b,c,d,e){return instanceExt_1.drawElementsInstancedANGLE(a,b,c,d,e)},gl.drawArraysInstanced=function(a,b,c,d){return instanceExt_1.drawArraysInstancedANGLE(a,b,c,d)}):this.hasInstance=!1}this.canUseUInt32ElementIndex=2===context.webGLVersion||!!context.extensions.uint32ElementIndex},GeometrySystem.prototype.bind=function(geometry,shader){shader=shader||this.renderer.shader.shader;var gl=this.gl,vaos=geometry.glVertexArrayObjects[this.CONTEXT_UID],incRefCount=!1;vaos||(this.managedGeometries[geometry.id]=geometry,geometry.disposeRunner.add(this),geometry.glVertexArrayObjects[this.CONTEXT_UID]=vaos={},incRefCount=!0);var vao=vaos[shader.program.id]||this.initGeometryVao(geometry,shader,incRefCount);this._activeGeometry=geometry,this._activeVao!==vao&&(this._activeVao=vao,this.hasVao?gl.bindVertexArray(vao):this.activateVao(geometry,shader.program)),this.updateBuffers()},GeometrySystem.prototype.reset=function(){this.unbind()},GeometrySystem.prototype.updateBuffers=function(){for(var geometry=this._activeGeometry,bufferSystem=this.renderer.buffer,i=0;i<geometry.buffers.length;i++){var buffer=geometry.buffers[i];bufferSystem.update(buffer)}},GeometrySystem.prototype.checkCompatibility=function(geometry,program){var geometryAttributes=geometry.attributes,shaderAttributes=program.attributeData;for(var j in shaderAttributes)if(!geometryAttributes[j])throw new Error('shader and geometry incompatible, geometry missing the "'+j+'" attribute')},GeometrySystem.prototype.getSignature=function(geometry,program){var attribs=geometry.attributes,shaderAttributes=program.attributeData,strings=["g",geometry.id];for(var i in attribs)shaderAttributes[i]&&strings.push(i,shaderAttributes[i].location);return strings.join("-")},GeometrySystem.prototype.initGeometryVao=function(geometry,shader,incRefCount){void 0===incRefCount&&(incRefCount=!0);var gl=this.gl,CONTEXT_UID=this.CONTEXT_UID,bufferSystem=this.renderer.buffer,program=shader.program;program.glPrograms[CONTEXT_UID]||this.renderer.shader.generateProgram(shader),this.checkCompatibility(geometry,program);var signature=this.getSignature(geometry,program),vaoObjectHash=geometry.glVertexArrayObjects[this.CONTEXT_UID],vao=vaoObjectHash[signature];if(vao)return vaoObjectHash[program.id]=vao,vao;var buffers=geometry.buffers,attributes=geometry.attributes,tempStride={},tempStart={};for(var j in buffers)tempStride[j]=0,tempStart[j]=0;for(var j in attributes)!attributes[j].size&&program.attributeData[j]?attributes[j].size=program.attributeData[j].size:attributes[j].size||console.warn("PIXI Geometry attribute '"+j+"' size cannot be determined (likely the bound shader does not have the attribute)"),tempStride[attributes[j].buffer]+=attributes[j].size*byteSizeMap[attributes[j].type];for(var j in attributes){var attribute=attributes[j],attribSize=attribute.size;void 0===attribute.stride&&(tempStride[attribute.buffer]===attribSize*byteSizeMap[attribute.type]?attribute.stride=0:attribute.stride=tempStride[attribute.buffer]),void 0===attribute.start&&(attribute.start=tempStart[attribute.buffer],tempStart[attribute.buffer]+=attribSize*byteSizeMap[attribute.type])}vao=gl.createVertexArray(),gl.bindVertexArray(vao);for(var i=0;i<buffers.length;i++){var buffer=buffers[i];bufferSystem.bind(buffer),incRefCount&&buffer._glBuffers[CONTEXT_UID].refCount++}return this.activateVao(geometry,program),this._activeVao=vao,vaoObjectHash[program.id]=vao,vaoObjectHash[signature]=vao,vao},GeometrySystem.prototype.disposeGeometry=function(geometry,contextLost){var _a;if(this.managedGeometries[geometry.id]){delete this.managedGeometries[geometry.id];var vaos=geometry.glVertexArrayObjects[this.CONTEXT_UID],gl=this.gl,buffers=geometry.buffers,bufferSystem=null===(_a=this.renderer)||void 0===_a?void 0:_a.buffer;if(geometry.disposeRunner.remove(this),vaos){if(bufferSystem)for(var i=0;i<buffers.length;i++){var buf=buffers[i]._glBuffers[this.CONTEXT_UID];buf&&(buf.refCount--,0!==buf.refCount||contextLost||bufferSystem.dispose(buffers[i],contextLost))}if(!contextLost)for(var vaoId in vaos)if("g"===vaoId[0]){var vao=vaos[vaoId];this._activeVao===vao&&this.unbind(),gl.deleteVertexArray(vao)}delete geometry.glVertexArrayObjects[this.CONTEXT_UID]}}},GeometrySystem.prototype.disposeAll=function(contextLost){for(var all=Object.keys(this.managedGeometries),i=0;i<all.length;i++)this.disposeGeometry(this.managedGeometries[all[i]],contextLost)},GeometrySystem.prototype.activateVao=function(geometry,program){var gl=this.gl,CONTEXT_UID=this.CONTEXT_UID,bufferSystem=this.renderer.buffer,buffers=geometry.buffers,attributes=geometry.attributes;geometry.indexBuffer&&bufferSystem.bind(geometry.indexBuffer);var lastBuffer=null;for(var j in attributes){var attribute=attributes[j],buffer=buffers[attribute.buffer],glBuffer=buffer._glBuffers[CONTEXT_UID];if(program.attributeData[j]){lastBuffer!==glBuffer&&(bufferSystem.bind(buffer),lastBuffer=glBuffer);var location=program.attributeData[j].location;if(gl.enableVertexAttribArray(location),gl.vertexAttribPointer(location,attribute.size,attribute.type||gl.FLOAT,attribute.normalized,attribute.stride,attribute.start),attribute.instance){if(!this.hasInstance)throw new Error("geometry error, GPU Instancing is not supported on this device");gl.vertexAttribDivisor(location,1)}}}},GeometrySystem.prototype.draw=function(type,size,start,instanceCount){var gl=this.gl,geometry=this._activeGeometry;if(geometry.indexBuffer){var byteSize=geometry.indexBuffer.data.BYTES_PER_ELEMENT,glType=2===byteSize?gl.UNSIGNED_SHORT:gl.UNSIGNED_INT;2===byteSize||4===byteSize&&this.canUseUInt32ElementIndex?geometry.instanced?gl.drawElementsInstanced(type,size||geometry.indexBuffer.data.length,glType,(start||0)*byteSize,instanceCount||1):gl.drawElements(type,size||geometry.indexBuffer.data.length,glType,(start||0)*byteSize):console.warn("unsupported index buffer type: uint32")}else geometry.instanced?gl.drawArraysInstanced(type,start,size||geometry.getSize(),instanceCount||1):gl.drawArrays(type,start,size||geometry.getSize());return this},GeometrySystem.prototype.unbind=function(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null},GeometrySystem.prototype.destroy=function(){this.renderer=null},GeometrySystem}(),MaskData=function(){function MaskData(maskObject){void 0===maskObject&&(maskObject=null),this.type=MASK_TYPES$1.NONE,this.autoDetect=!0,this.maskObject=maskObject||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=settings.FILTER_MULTISAMPLE,this.enabled=!0,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._target=null}return Object.defineProperty(MaskData.prototype,"filter",{get:function(){return this._filters?this._filters[0]:null},set:function(value){value?this._filters?this._filters[0]=value:this._filters=[value]:this._filters=null},enumerable:!1,configurable:!0}),MaskData.prototype.reset=function(){this.pooled&&(this.maskObject=null,this.type=MASK_TYPES$1.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null},MaskData.prototype.copyCountersOrReset=function(maskAbove){maskAbove?(this._stencilCounter=maskAbove._stencilCounter,this._scissorCounter=maskAbove._scissorCounter,this._scissorRect=maskAbove._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)},MaskData}();function compileShader(gl,type,src){var shader=gl.createShader(type);return gl.shaderSource(shader,src),gl.compileShader(shader),shader}function logPrettyShaderError(gl,shader){var shaderSrc=gl.getShaderSource(shader).split("\n").map((function(line,index){return index+": "+line})),shaderLog=gl.getShaderInfoLog(shader),splitShader=shaderLog.split("\n"),dedupe={},lineNumbers=splitShader.map((function(line){return parseFloat(line.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))})).filter((function(n){return!(!n||dedupe[n])&&(dedupe[n]=!0,!0)})),logArgs=[""];lineNumbers.forEach((function(number){shaderSrc[number-1]="%c"+shaderSrc[number-1]+"%c",logArgs.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")}));var fragmentSourceToLog=shaderSrc.join("\n");logArgs[0]=fragmentSourceToLog,console.error(shaderLog),console.groupCollapsed("click to view full shader code"),console.warn.apply(console,logArgs),console.groupEnd()}function booleanArray(size){for(var array=new Array(size),i=0;i<array.length;i++)array[i]=!1;return array}function defaultValue(type,size){switch(type){case"float":case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"vec2":return new Float32Array(2*size);case"vec3":return new Float32Array(3*size);case"vec4":return new Float32Array(4*size);case"ivec2":return new Int32Array(2*size);case"ivec3":return new Int32Array(3*size);case"ivec4":return new Int32Array(4*size);case"uvec2":return new Uint32Array(2*size);case"uvec3":return new Uint32Array(3*size);case"uvec4":return new Uint32Array(4*size);case"bool":return!1;case"bvec2":return booleanArray(2*size);case"bvec3":return booleanArray(3*size);case"bvec4":return booleanArray(4*size);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var maxFragmentPrecision,unknownContext={},context=unknownContext;function getMaxFragmentPrecision(){if(!maxFragmentPrecision){maxFragmentPrecision=PRECISION$1.MEDIUM;var gl=function(){if(context===unknownContext||context&&context.isContextLost()){var canvas=document.createElement("canvas"),gl=void 0;settings.PREFER_ENV>=ENV$1.WEBGL2&&(gl=canvas.getContext("webgl2",{})),gl||((gl=canvas.getContext("webgl",{})||canvas.getContext("experimental-webgl",{}))?gl.getExtension("WEBGL_draw_buffers"):gl=null),context=gl}return context}();if(gl&&gl.getShaderPrecisionFormat){var shaderFragment=gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.HIGH_FLOAT);maxFragmentPrecision=shaderFragment.precision?PRECISION$1.HIGH:PRECISION$1.MEDIUM}}return maxFragmentPrecision}function setPrecision(src,requestedPrecision,maxSupportedPrecision){if("precision"!==src.substring(0,9)){var precision=requestedPrecision;return requestedPrecision===PRECISION$1.HIGH&&maxSupportedPrecision!==PRECISION$1.HIGH&&(precision=PRECISION$1.MEDIUM),"precision "+precision+" float;\n"+src}return maxSupportedPrecision!==PRECISION$1.HIGH&&"precision highp"===src.substring(0,15)?src.replace("precision highp","precision mediump"):src}var GLSL_TO_SIZE={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function mapSize(type){return GLSL_TO_SIZE[type]}var GL_TABLE=null,GL_TO_GLSL_TYPES={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function mapType(gl,type){if(!GL_TABLE){var typeNames=Object.keys(GL_TO_GLSL_TYPES);GL_TABLE={};for(var i=0;i<typeNames.length;++i){var tn=typeNames[i];GL_TABLE[gl[tn]]=GL_TO_GLSL_TYPES[tn]}}return GL_TABLE[type]}var uniformParsers=[{test:function(data){return"float"===data.type&&1===data.size},code:function(name){return'\n if(uv["'+name+'"] !== ud["'+name+'"].value)\n {\n ud["'+name+'"].value = uv["'+name+'"]\n gl.uniform1f(ud["'+name+'"].location, uv["'+name+'"])\n }\n '}},{test:function(data){return("sampler2D"===data.type||"samplerCube"===data.type||"sampler2DArray"===data.type)&&1===data.size&&!data.isArray},code:function(name){return't = syncData.textureCount++;\n\n renderer.texture.bind(uv["'+name+'"], t);\n\n if(ud["'+name+'"].value !== t)\n {\n ud["'+name+'"].value = t;\n gl.uniform1i(ud["'+name+'"].location, t);\n; // eslint-disable-line max-len\n }'}},{test:function(data,uniform){return"mat3"===data.type&&1===data.size&&void 0!==uniform.a},code:function(name){return'\n gl.uniformMatrix3fv(ud["'+name+'"].location, false, uv["'+name+'"].toArray(true));\n '},codeUbo:function(name){return"\n var "+name+"_matrix = uv."+name+".toArray(true);\n\n data[offset] = "+name+"_matrix[0];\n data[offset+1] = "+name+"_matrix[1];\n data[offset+2] = "+name+"_matrix[2];\n \n data[offset + 4] = "+name+"_matrix[3];\n data[offset + 5] = "+name+"_matrix[4];\n data[offset + 6] = "+name+"_matrix[5];\n \n data[offset + 8] = "+name+"_matrix[6];\n data[offset + 9] = "+name+"_matrix[7];\n data[offset + 10] = "+name+"_matrix[8];\n "}},{test:function(data,uniform){return"vec2"===data.type&&1===data.size&&void 0!==uniform.x},code:function(name){return'\n cv = ud["'+name+'"].value;\n v = uv["'+name+'"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud["'+name+'"].location, v.x, v.y);\n }'},codeUbo:function(name){return"\n v = uv."+name+";\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n "}},{test:function(data){return"vec2"===data.type&&1===data.size},code:function(name){return'\n cv = ud["'+name+'"].value;\n v = uv["'+name+'"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud["'+name+'"].location, v[0], v[1]);\n }\n '}},{test:function(data,uniform){return"vec4"===data.type&&1===data.size&&void 0!==uniform.width},code:function(name){return'\n cv = ud["'+name+'"].value;\n v = uv["'+name+'"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud["'+name+'"].location, v.x, v.y, v.width, v.height)\n }'},codeUbo:function(name){return"\n v = uv."+name+";\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n data[offset+2] = v.width;\n data[offset+3] = v.height;\n "}},{test:function(data){return"vec4"===data.type&&1===data.size},code:function(name){return'\n cv = ud["'+name+'"].value;\n v = uv["'+name+'"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud["'+name+'"].location, v[0], v[1], v[2], v[3])\n }'}}],GLSL_TO_SINGLE_SETTERS_CACHED={float:"\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }",vec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2f(location, v[0], v[1])\n }",vec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }",vec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\n }",int:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1i(location, v);\n }",ivec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }",ivec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }",ivec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",uint:"\n if (cv !== v)\n {\n cu.value = v;\n\n gl.uniform1ui(location, v);\n }",uvec2:"\n if (cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2ui(location, v[0], v[1]);\n }",uvec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3ui(location, v[0], v[1], v[2]);\n }",uvec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n }",bool:"\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1i(location, v);\n }",bvec2:"\n if (cv[0] != v[0] || cv[1] != v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n\n gl.uniform2i(location, v[0], v[1]);\n }",bvec3:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3i(location, v[0], v[1], v[2]);\n }",bvec4:"\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\n }",mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:"gl.uniform1i(location, v)",samplerCube:"gl.uniform1i(location, v)",sampler2DArray:"gl.uniform1i(location, v)"},GLSL_TO_ARRAY_SETTERS={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};var unsafeEval,fragTemplate=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function generateIfTestSrc(maxIfs){for(var src="",i=0;i<maxIfs;++i)i>0&&(src+="\nelse "),i<maxIfs-1&&(src+="if(test == "+i+".0){}");return src}var UID$1=0,nameCache={},Program=function(){function Program(vertexSrc,fragmentSrc,name){void 0===name&&(name="pixi-shader"),this.id=UID$1++,this.vertexSrc=vertexSrc||Program.defaultVertexSrc,this.fragmentSrc=fragmentSrc||Program.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),"#version"!==this.vertexSrc.substring(0,8)&&(name=name.replace(/\s+/g,"-"),nameCache[name]?(nameCache[name]++,name+="-"+nameCache[name]):nameCache[name]=1,this.vertexSrc="#define SHADER_NAME "+name+"\n"+this.vertexSrc,this.fragmentSrc="#define SHADER_NAME "+name+"\n"+this.fragmentSrc,this.vertexSrc=setPrecision(this.vertexSrc,settings.PRECISION_VERTEX,PRECISION$1.HIGH),this.fragmentSrc=setPrecision(this.fragmentSrc,settings.PRECISION_FRAGMENT,getMaxFragmentPrecision())),this.glPrograms={},this.syncUniforms=null}return Object.defineProperty(Program,"defaultVertexSrc",{get:function(){return"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"},enumerable:!1,configurable:!0}),Object.defineProperty(Program,"defaultFragmentSrc",{get:function(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}"},enumerable:!1,configurable:!0}),Program.from=function(vertexSrc,fragmentSrc,name){var key=vertexSrc+fragmentSrc,program=ProgramCache[key];return program||(ProgramCache[key]=program=new Program(vertexSrc,fragmentSrc,name)),program},Program}(),Shader=function(){function Shader(program,uniforms){this.uniformBindCount=0,this.program=program,this.uniformGroup=uniforms?uniforms instanceof UniformGroup?uniforms:new UniformGroup(uniforms):new UniformGroup({})}return Shader.prototype.checkUniformExists=function(name,group){if(group.uniforms[name])return!0;for(var i in group.uniforms){var uniform=group.uniforms[i];if(uniform.group&&this.checkUniformExists(name,uniform))return!0}return!1},Shader.prototype.destroy=function(){this.uniformGroup=null},Object.defineProperty(Shader.prototype,"uniforms",{get:function(){return this.uniformGroup.uniforms},enumerable:!1,configurable:!0}),Shader.from=function(vertexSrc,fragmentSrc,uniforms){return new Shader(Program.from(vertexSrc,fragmentSrc),uniforms)},Shader}(),State=function(){function State(){this.data=0,this.blendMode=BLEND_MODES$1.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}return Object.defineProperty(State.prototype,"blend",{get:function(){return!!(1&this.data)},set:function(value){!!(1&this.data)!==value&&(this.data^=1)},enumerable:!1,configurable:!0}),Object.defineProperty(State.prototype,"offsets",{get:function(){return!!(2&this.data)},set:function(value){!!(2&this.data)!==value&&(this.data^=2)},enumerable:!1,configurable:!0}),Object.defineProperty(State.prototype,"culling",{get:function(){return!!(4&this.data)},set:function(value){!!(4&this.data)!==value&&(this.data^=4)},enumerable:!1,configurable:!0}),Object.defineProperty(State.prototype,"depthTest",{get:function(){return!!(8&this.data)},set:function(value){!!(8&this.data)!==value&&(this.data^=8)},enumerable:!1,configurable:!0}),Object.defineProperty(State.prototype,"depthMask",{get:function(){return!!(32&this.data)},set:function(value){!!(32&this.data)!==value&&(this.data^=32)},enumerable:!1,configurable:!0}),Object.defineProperty(State.prototype,"clockwiseFrontFace",{get:function(){return!!(16&this.data)},set:function(value){!!(16&this.data)!==value&&(this.data^=16)},enumerable:!1,configurable:!0}),Object.defineProperty(State.prototype,"blendMode",{get:function(){return this._blendMode},set:function(value){this.blend=value!==BLEND_MODES$1.NONE,this._blendMode=value},enumerable:!1,configurable:!0}),Object.defineProperty(State.prototype,"polygonOffset",{get:function(){return this._polygonOffset},set:function(value){this.offsets=!!value,this._polygonOffset=value},enumerable:!1,configurable:!0}),State.prototype.toString=function(){return"[@pixi/core:State blendMode="+this.blendMode+" clockwiseFrontFace="+this.clockwiseFrontFace+" culling="+this.culling+" depthMask="+this.depthMask+" polygonOffset="+this.polygonOffset+"]"},State.for2d=function(){var state=new State;return state.depthTest=!1,state.blend=!0,state},State}(),Filter=function(_super){function Filter(vertexSrc,fragmentSrc,uniforms){var _this=this,program=Program.from(vertexSrc||Filter.defaultVertexSrc,fragmentSrc||Filter.defaultFragmentSrc);return(_this=_super.call(this,program,uniforms)||this).padding=0,_this.resolution=settings.FILTER_RESOLUTION,_this.multisample=settings.FILTER_MULTISAMPLE,_this.enabled=!0,_this.autoFit=!0,_this.state=new State,_this}return __extends$3(Filter,_super),Filter.prototype.apply=function(filterManager,input,output,clearMode,_currentState){filterManager.applyFilter(this,input,output,clearMode)},Object.defineProperty(Filter.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(value){this.state.blendMode=value},enumerable:!1,configurable:!0}),Object.defineProperty(Filter.prototype,"resolution",{get:function(){return this._resolution},set:function(value){this._resolution=value},enumerable:!1,configurable:!0}),Object.defineProperty(Filter,"defaultVertexSrc",{get:function(){return"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n"},enumerable:!1,configurable:!0}),Object.defineProperty(Filter,"defaultFragmentSrc",{get:function(){return"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n"},enumerable:!1,configurable:!0}),Filter}(Shader),tempMat=new Matrix,TextureMatrix=function(){function TextureMatrix(texture,clampMargin){this._texture=texture,this.mapCoord=new Matrix,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===clampMargin?.5:clampMargin,this.isSimple=!1}return Object.defineProperty(TextureMatrix.prototype,"texture",{get:function(){return this._texture},set:function(value){this._texture=value,this._textureID=-1},enumerable:!1,configurable:!0}),TextureMatrix.prototype.multiplyUvs=function(uvs,out){void 0===out&&(out=uvs);for(var mat=this.mapCoord,i=0;i<uvs.length;i+=2){var x=uvs[i],y=uvs[i+1];out[i]=x*mat.a+y*mat.c+mat.tx,out[i+1]=x*mat.b+y*mat.d+mat.ty}return out},TextureMatrix.prototype.update=function(forceUpdate){var tex=this._texture;if(!tex||!tex.valid)return!1;if(!forceUpdate&&this._textureID===tex._updateID)return!1;this._textureID=tex._updateID,this._updateID++;var uvs=tex._uvs;this.mapCoord.set(uvs.x1-uvs.x0,uvs.y1-uvs.y0,uvs.x3-uvs.x0,uvs.y3-uvs.y0,uvs.x0,uvs.y0);var orig=tex.orig,trim=tex.trim;trim&&(tempMat.set(orig.width/trim.width,0,0,orig.height/trim.height,-trim.x/trim.width,-trim.y/trim.height),this.mapCoord.append(tempMat));var texBase=tex.baseTexture,frame=this.uClampFrame,margin=this.clampMargin/texBase.resolution,offset=this.clampOffset;return frame[0]=(tex._frame.x+margin+offset)/texBase.width,frame[1]=(tex._frame.y+margin+offset)/texBase.height,frame[2]=(tex._frame.x+tex._frame.width-margin+offset)/texBase.width,frame[3]=(tex._frame.y+tex._frame.height-margin+offset)/texBase.height,this.uClampOffset[0]=offset/texBase.realWidth,this.uClampOffset[1]=offset/texBase.realHeight,this.isSimple=tex._frame.width===texBase.width&&tex._frame.height===texBase.height&&0===tex.rotate,!0},TextureMatrix}(),SpriteMaskFilter=function(_super){function SpriteMaskFilter(vertexSrc,fragmentSrc,uniforms){var _this=this,sprite=null;return"string"!=typeof vertexSrc&&void 0===fragmentSrc&&void 0===uniforms&&(sprite=vertexSrc,vertexSrc=void 0,fragmentSrc=void 0,uniforms=void 0),(_this=_super.call(this,vertexSrc||"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n",fragmentSrc||"varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n",uniforms)||this).maskSprite=sprite,_this.maskMatrix=new Matrix,_this}return __extends$3(SpriteMaskFilter,_super),Object.defineProperty(SpriteMaskFilter.prototype,"maskSprite",{get:function(){return this._maskSprite},set:function(value){this._maskSprite=value,this._maskSprite&&(this._maskSprite.renderable=!1)},enumerable:!1,configurable:!0}),SpriteMaskFilter.prototype.apply=function(filterManager,input,output,clearMode){var maskSprite=this._maskSprite,tex=maskSprite._texture;tex.valid&&(tex.uvMatrix||(tex.uvMatrix=new TextureMatrix(tex,0)),tex.uvMatrix.update(),this.uniforms.npmAlpha=tex.baseTexture.alphaMode?0:1,this.uniforms.mask=tex,this.uniforms.otherMatrix=filterManager.calculateSpriteMatrix(this.maskMatrix,maskSprite).prepend(tex.uvMatrix.mapCoord),this.uniforms.alpha=maskSprite.worldAlpha,this.uniforms.maskClamp=tex.uvMatrix.uClampFrame,filterManager.applyFilter(this,input,output,clearMode))},SpriteMaskFilter}(Filter),MaskSystem=function(){function MaskSystem(renderer){this.renderer=renderer,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}return MaskSystem.prototype.setMaskStack=function(maskStack){this.maskStack=maskStack,this.renderer.scissor.setMaskStack(maskStack),this.renderer.stencil.setMaskStack(maskStack)},MaskSystem.prototype.push=function(target,maskDataOrTarget){var maskData=maskDataOrTarget;if(!maskData.isMaskData){var d=this.maskDataPool.pop()||new MaskData;d.pooled=!0,d.maskObject=maskDataOrTarget,maskData=d}var maskAbove=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null;if(maskData.copyCountersOrReset(maskAbove),maskData.autoDetect&&this.detect(maskData),maskData._target=target,maskData.type!==MASK_TYPES$1.SPRITE&&this.maskStack.push(maskData),maskData.enabled)switch(maskData.type){case MASK_TYPES$1.SCISSOR:this.renderer.scissor.push(maskData);break;case MASK_TYPES$1.STENCIL:this.renderer.stencil.push(maskData);break;case MASK_TYPES$1.SPRITE:maskData.copyCountersOrReset(null),this.pushSpriteMask(maskData)}maskData.type===MASK_TYPES$1.SPRITE&&this.maskStack.push(maskData)},MaskSystem.prototype.pop=function(target){var maskData=this.maskStack.pop();if(maskData&&maskData._target===target){if(maskData.enabled)switch(maskData.type){case MASK_TYPES$1.SCISSOR:this.renderer.scissor.pop();break;case MASK_TYPES$1.STENCIL:this.renderer.stencil.pop(maskData.maskObject);break;case MASK_TYPES$1.SPRITE:this.popSpriteMask(maskData)}if(maskData.reset(),maskData.pooled&&this.maskDataPool.push(maskData),0!==this.maskStack.length){var maskCurrent=this.maskStack[this.maskStack.length-1];maskCurrent.type===MASK_TYPES$1.SPRITE&&maskCurrent._filters&&(maskCurrent._filters[0].maskSprite=maskCurrent.maskObject)}}},MaskSystem.prototype.detect=function(maskData){maskData.maskObject.isSprite?maskData.type=MASK_TYPES$1.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(maskData)?maskData.type=MASK_TYPES$1.SCISSOR:maskData.type=MASK_TYPES$1.STENCIL},MaskSystem.prototype.pushSpriteMask=function(maskData){var _a,_b,maskObject=maskData.maskObject,target=maskData._target,alphaMaskFilter=maskData._filters;alphaMaskFilter||(alphaMaskFilter=this.alphaMaskPool[this.alphaMaskIndex])||(alphaMaskFilter=this.alphaMaskPool[this.alphaMaskIndex]=[new SpriteMaskFilter]);var resolution,multisample,renderer=this.renderer,renderTextureSystem=renderer.renderTexture;if(renderTextureSystem.current){var renderTexture=renderTextureSystem.current;resolution=maskData.resolution||renderTexture.resolution,multisample=null!==(_a=maskData.multisample)&&void 0!==_a?_a:renderTexture.multisample}else resolution=maskData.resolution||renderer.resolution,multisample=null!==(_b=maskData.multisample)&&void 0!==_b?_b:renderer.multisample;alphaMaskFilter[0].resolution=resolution,alphaMaskFilter[0].multisample=multisample,alphaMaskFilter[0].maskSprite=maskObject;var stashFilterArea=target.filterArea;target.filterArea=maskObject.getBounds(!0),renderer.filter.push(target,alphaMaskFilter),target.filterArea=stashFilterArea,maskData._filters||this.alphaMaskIndex++},MaskSystem.prototype.popSpriteMask=function(maskData){this.renderer.filter.pop(),maskData._filters?maskData._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)},MaskSystem.prototype.destroy=function(){this.renderer=null},MaskSystem}(),AbstractMaskSystem=function(){function AbstractMaskSystem(renderer){this.renderer=renderer,this.maskStack=[],this.glConst=0}return AbstractMaskSystem.prototype.getStackLength=function(){return this.maskStack.length},AbstractMaskSystem.prototype.setMaskStack=function(maskStack){var gl=this.renderer.gl,curStackLen=this.getStackLength();this.maskStack=maskStack;var newStackLen=this.getStackLength();newStackLen!==curStackLen&&(0===newStackLen?gl.disable(this.glConst):(gl.enable(this.glConst),this._useCurrent()))},AbstractMaskSystem.prototype._useCurrent=function(){},AbstractMaskSystem.prototype.destroy=function(){this.renderer=null,this.maskStack=null},AbstractMaskSystem}(),tempMatrix$1=new Matrix,ScissorSystem=function(_super){function ScissorSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.glConst=WebGLRenderingContext.SCISSOR_TEST,_this}return __extends$3(ScissorSystem,_super),ScissorSystem.prototype.getStackLength=function(){var maskData=this.maskStack[this.maskStack.length-1];return maskData?maskData._scissorCounter:0},ScissorSystem.prototype.calcScissorRect=function(maskData){if(!maskData._scissorRectLocal){var prevData=maskData._scissorRect,maskObject=maskData.maskObject,renderer=this.renderer,renderTextureSystem=renderer.renderTexture;maskObject.renderable=!0;var rect=maskObject.getBounds();this.roundFrameToPixels(rect,renderTextureSystem.current?renderTextureSystem.current.resolution:renderer.resolution,renderTextureSystem.sourceFrame,renderTextureSystem.destinationFrame,renderer.projection.transform),maskObject.renderable=!1,prevData&&rect.fit(prevData),maskData._scissorRectLocal=rect}},ScissorSystem.isMatrixRotated=function(matrix){if(!matrix)return!1;var a=matrix.a,b=matrix.b,c=matrix.c,d=matrix.d;return(Math.abs(b)>1e-4||Math.abs(c)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(d)>1e-4)},ScissorSystem.prototype.testScissor=function(maskData){var maskObject=maskData.maskObject;if(!maskObject.isFastRect||!maskObject.isFastRect())return!1;if(ScissorSystem.isMatrixRotated(maskObject.worldTransform))return!1;if(ScissorSystem.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(maskData);var rect=maskData._scissorRectLocal;return rect.width>0&&rect.height>0},ScissorSystem.prototype.roundFrameToPixels=function(frame,resolution,bindingSourceFrame,bindingDestinationFrame,transform){ScissorSystem.isMatrixRotated(transform)||((transform=transform?tempMatrix$1.copyFrom(transform):tempMatrix$1.identity()).translate(-bindingSourceFrame.x,-bindingSourceFrame.y).scale(bindingDestinationFrame.width/bindingSourceFrame.width,bindingDestinationFrame.height/bindingSourceFrame.height).translate(bindingDestinationFrame.x,bindingDestinationFrame.y),this.renderer.filter.transformAABB(transform,frame),frame.fit(bindingDestinationFrame),frame.x=Math.round(frame.x*resolution),frame.y=Math.round(frame.y*resolution),frame.width=Math.round(frame.width*resolution),frame.height=Math.round(frame.height*resolution))},ScissorSystem.prototype.push=function(maskData){maskData._scissorRectLocal||this.calcScissorRect(maskData);var gl=this.renderer.gl;maskData._scissorRect||gl.enable(gl.SCISSOR_TEST),maskData._scissorCounter++,maskData._scissorRect=maskData._scissorRectLocal,this._useCurrent()},ScissorSystem.prototype.pop=function(){var gl=this.renderer.gl;this.getStackLength()>0?this._useCurrent():gl.disable(gl.SCISSOR_TEST)},ScissorSystem.prototype._useCurrent=function(){var y,rect=this.maskStack[this.maskStack.length-1]._scissorRect;y=this.renderer.renderTexture.current?rect.y:this.renderer.height-rect.height-rect.y,this.renderer.gl.scissor(rect.x,y,rect.width,rect.height)},ScissorSystem}(AbstractMaskSystem),StencilSystem=function(_super){function StencilSystem(renderer){var _this=_super.call(this,renderer)||this;return _this.glConst=WebGLRenderingContext.STENCIL_TEST,_this}return __extends$3(StencilSystem,_super),StencilSystem.prototype.getStackLength=function(){var maskData=this.maskStack[this.maskStack.length-1];return maskData?maskData._stencilCounter:0},StencilSystem.prototype.push=function(maskData){var maskObject=maskData.maskObject,gl=this.renderer.gl,prevMaskCount=maskData._stencilCounter;0===prevMaskCount&&(this.renderer.framebuffer.forceStencil(),gl.clearStencil(0),gl.clear(gl.STENCIL_BUFFER_BIT),gl.enable(gl.STENCIL_TEST)),maskData._stencilCounter++,gl.colorMask(!1,!1,!1,!1),gl.stencilFunc(gl.EQUAL,prevMaskCount,4294967295),gl.stencilOp(gl.KEEP,gl.KEEP,gl.INCR),maskObject.renderable=!0,maskObject.render(this.renderer),this.renderer.batch.flush(),maskObject.renderable=!1,this._useCurrent()},StencilSystem.prototype.pop=function(maskObject){var gl=this.renderer.gl;0===this.getStackLength()?gl.disable(gl.STENCIL_TEST):(gl.colorMask(!1,!1,!1,!1),gl.stencilOp(gl.KEEP,gl.KEEP,gl.DECR),maskObject.renderable=!0,maskObject.render(this.renderer),this.renderer.batch.flush(),maskObject.renderable=!1,this._useCurrent())},StencilSystem.prototype._useCurrent=function(){var gl=this.renderer.gl;gl.colorMask(!0,!0,!0,!0),gl.stencilFunc(gl.EQUAL,this.getStackLength(),4294967295),gl.stencilOp(gl.KEEP,gl.KEEP,gl.KEEP)},StencilSystem}(AbstractMaskSystem),ProjectionSystem=function(){function ProjectionSystem(renderer){this.renderer=renderer,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Matrix,this.transform=null}return ProjectionSystem.prototype.update=function(destinationFrame,sourceFrame,resolution,root){this.destinationFrame=destinationFrame||this.destinationFrame||this.defaultFrame,this.sourceFrame=sourceFrame||this.sourceFrame||destinationFrame,this.calculateProjection(this.destinationFrame,this.sourceFrame,resolution,root),this.transform&&this.projectionMatrix.append(this.transform);var renderer=this.renderer;renderer.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,renderer.globalUniforms.update(),renderer.shader.shader&&renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals)},ProjectionSystem.prototype.calculateProjection=function(_destinationFrame,sourceFrame,_resolution,root){var pm=this.projectionMatrix,sign=root?-1:1;pm.identity(),pm.a=1/sourceFrame.width*2,pm.d=sign*(1/sourceFrame.height*2),pm.tx=-1-sourceFrame.x*pm.a,pm.ty=-sign-sourceFrame.y*pm.d},ProjectionSystem.prototype.setTransform=function(_matrix){},ProjectionSystem.prototype.destroy=function(){this.renderer=null},ProjectionSystem}(),tempRect=new Rectangle,tempRect2=new Rectangle,RenderTextureSystem=function(){function RenderTextureSystem(renderer){this.renderer=renderer,this.clearColor=renderer._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new Rectangle,this.destinationFrame=new Rectangle,this.viewportFrame=new Rectangle}return RenderTextureSystem.prototype.bind=function(renderTexture,sourceFrame,destinationFrame){void 0===renderTexture&&(renderTexture=null);var baseTexture,framebuffer,resolution,renderer=this.renderer;this.current=renderTexture,renderTexture?(resolution=(baseTexture=renderTexture.baseTexture).resolution,sourceFrame||(tempRect.width=renderTexture.frame.width,tempRect.height=renderTexture.frame.height,sourceFrame=tempRect),destinationFrame||(tempRect2.x=renderTexture.frame.x,tempRect2.y=renderTexture.frame.y,tempRect2.width=sourceFrame.width,tempRect2.height=sourceFrame.height,destinationFrame=tempRect2),framebuffer=baseTexture.framebuffer):(resolution=renderer.resolution,sourceFrame||(tempRect.width=renderer.screen.width,tempRect.height=renderer.screen.height,sourceFrame=tempRect),destinationFrame||((destinationFrame=tempRect).width=sourceFrame.width,destinationFrame.height=sourceFrame.height));var viewportFrame=this.viewportFrame;viewportFrame.x=destinationFrame.x*resolution,viewportFrame.y=destinationFrame.y*resolution,viewportFrame.width=destinationFrame.width*resolution,viewportFrame.height=destinationFrame.height*resolution,renderTexture||(viewportFrame.y=renderer.view.height-(viewportFrame.y+viewportFrame.height)),viewportFrame.ceil(),this.renderer.framebuffer.bind(framebuffer,viewportFrame),this.renderer.projection.update(destinationFrame,sourceFrame,resolution,!framebuffer),renderTexture?this.renderer.mask.setMaskStack(baseTexture.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(sourceFrame),this.destinationFrame.copyFrom(destinationFrame)},RenderTextureSystem.prototype.clear=function(clearColor,mask){clearColor=this.current?clearColor||this.current.baseTexture.clearColor:clearColor||this.clearColor;var destinationFrame=this.destinationFrame,baseFrame=this.current?this.current.baseTexture:this.renderer.screen,clearMask=destinationFrame.width!==baseFrame.width||destinationFrame.height!==baseFrame.height;if(clearMask){var _a=this.viewportFrame,x=_a.x,y=_a.y,width=_a.width,height=_a.height;x=Math.round(x),y=Math.round(y),width=Math.round(width),height=Math.round(height),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(x,y,width,height)}this.renderer.framebuffer.clear(clearColor[0],clearColor[1],clearColor[2],clearColor[3],mask),clearMask&&this.renderer.scissor.pop()},RenderTextureSystem.prototype.resize=function(){this.bind(null)},RenderTextureSystem.prototype.reset=function(){this.bind(null)},RenderTextureSystem.prototype.destroy=function(){this.renderer=null},RenderTextureSystem}();function uboUpdate(_ud,_uv,_renderer,_syncData,buffer){_renderer.buffer.update(buffer)}var UBO_TO_SINGLE_SETTERS={float:"\n data[offset] = v;\n ",vec2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n ",vec3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ",vec4:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ",mat2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ",mat3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ",mat4:"\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n "},GLSL_TO_STD40_SIZE={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function generateUniformBufferSync(group,uniformData){if(!group.autoManage)return{size:0,syncFunc:uboUpdate};for(var usedUniformDatas=function(uniforms,uniformData){var usedUniformDatas=[];for(var i in uniforms)uniformData[i]&&usedUniformDatas.push(uniformData[i]);return usedUniformDatas.sort((function(a,b){return a.index-b.index})),usedUniformDatas}(group.uniforms,uniformData),_a=function(uniformData){for(var uboElements=uniformData.map((function(data){return{data:data,offset:0,dataLen:0,dirty:0}})),size=0,chunkSize=0,offset=0,i=0;i<uboElements.length;i++){var uboElement=uboElements[i];if(size=GLSL_TO_STD40_SIZE[uboElement.data.type],uboElement.data.size>1&&(size=Math.max(size,16)*uboElement.data.size),uboElement.dataLen=size,chunkSize%size!=0&&chunkSize<16){var lineUpValue=chunkSize%size%16;chunkSize+=lineUpValue,offset+=lineUpValue}chunkSize+size>16?(offset=16*Math.ceil(offset/16),uboElement.offset=offset,offset+=size,chunkSize=size):(uboElement.offset=offset,chunkSize+=size,offset+=size)}return{uboElements:uboElements,size:offset=16*Math.ceil(offset/16)}}(usedUniformDatas),uboElements=_a.uboElements,size=_a.size,funcFragments=["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "],i=0;i<uboElements.length;i++){for(var uboElement=uboElements[i],uniform=group.uniforms[uboElement.data.name],name=uboElement.data.name,parsed=!1,j=0;j<uniformParsers.length;j++){var uniformParser=uniformParsers[j];if(uniformParser.codeUbo&&uniformParser.test(uboElement.data,uniform)){funcFragments.push("offset = "+uboElement.offset/4+";",uniformParsers[j].codeUbo(uboElement.data.name,uniform)),parsed=!0;break}}if(!parsed)if(uboElement.data.size>1){var size_1=mapSize(uboElement.data.type),rowSize=Math.max(GLSL_TO_STD40_SIZE[uboElement.data.type]/16,1),elementSize=size_1/rowSize,remainder=(4-elementSize%4)%4;funcFragments.push("\n cv = ud."+name+".value;\n v = uv."+name+";\n offset = "+uboElement.offset/4+";\n\n t = 0;\n\n for(var i=0; i < "+uboElement.data.size*rowSize+"; i++)\n {\n for(var j = 0; j < "+elementSize+"; j++)\n {\n data[offset++] = v[t++];\n }\n offset += "+remainder+";\n }\n\n ")}else{var template=UBO_TO_SINGLE_SETTERS[uboElement.data.type];funcFragments.push("\n cv = ud."+name+".value;\n v = uv."+name+";\n offset = "+uboElement.offset/4+";\n "+template+";\n ")}}return funcFragments.push("\n renderer.buffer.update(buffer);\n "),{size:size,syncFunc:new Function("ud","uv","renderer","syncData","buffer",funcFragments.join("\n"))}}var GLProgram=function(){function GLProgram(program,uniformData){this.program=program,this.uniformData=uniformData,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return GLProgram.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},GLProgram}();function generateProgram(gl,program){var glVertShader=compileShader(gl,gl.VERTEX_SHADER,program.vertexSrc),glFragShader=compileShader(gl,gl.FRAGMENT_SHADER,program.fragmentSrc),webGLProgram=gl.createProgram();if(gl.attachShader(webGLProgram,glVertShader),gl.attachShader(webGLProgram,glFragShader),gl.linkProgram(webGLProgram),gl.getProgramParameter(webGLProgram,gl.LINK_STATUS)||function(gl,program,vertexShader,fragmentShader){gl.getProgramParameter(program,gl.LINK_STATUS)||(gl.getShaderParameter(vertexShader,gl.COMPILE_STATUS)||logPrettyShaderError(gl,vertexShader),gl.getShaderParameter(fragmentShader,gl.COMPILE_STATUS)||logPrettyShaderError(gl,fragmentShader),console.error("PixiJS Error: Could not initialize shader."),""!==gl.getProgramInfoLog(program)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",gl.getProgramInfoLog(program)))}(gl,webGLProgram,glVertShader,glFragShader),program.attributeData=function(program,gl){for(var attributes={},totalAttributes=gl.getProgramParameter(program,gl.ACTIVE_ATTRIBUTES),i=0;i<totalAttributes;i++){var attribData=gl.getActiveAttrib(program,i);if(0!==attribData.name.indexOf("gl_")){var type=mapType(gl,attribData.type),data={type:type,name:attribData.name,size:mapSize(type),location:gl.getAttribLocation(program,attribData.name)};attributes[attribData.name]=data}}return attributes}(webGLProgram,gl),program.uniformData=function(program,gl){for(var uniforms={},totalUniforms=gl.getProgramParameter(program,gl.ACTIVE_UNIFORMS),i=0;i<totalUniforms;i++){var uniformData=gl.getActiveUniform(program,i),name=uniformData.name.replace(/\[.*?\]$/,""),isArray=!!uniformData.name.match(/\[.*?\]$/),type=mapType(gl,uniformData.type);uniforms[name]={name:name,index:i,type:type,size:uniformData.size,isArray:isArray,value:defaultValue(type,uniformData.size)}}return uniforms}(webGLProgram,gl),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(program.vertexSrc)){var keys=Object.keys(program.attributeData);keys.sort((function(a,b){return a>b?1:-1}));for(var i=0;i<keys.length;i++)program.attributeData[keys[i]].location=i,gl.bindAttribLocation(webGLProgram,i,keys[i]);gl.linkProgram(webGLProgram)}gl.deleteShader(glVertShader),gl.deleteShader(glFragShader);var uniformData={};for(var i in program.uniformData){var data=program.uniformData[i];uniformData[i]={location:gl.getUniformLocation(webGLProgram,i),value:defaultValue(data.type,data.size)}}return new GLProgram(webGLProgram,uniformData)}var UID=0,defaultSyncData={textureCount:0,uboCount:0},ShaderSystem=function(){function ShaderSystem(renderer){this.destroyed=!1,this.renderer=renderer,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=UID++}return ShaderSystem.prototype.systemCheck=function(){if(!function(){if("boolean"==typeof unsafeEval)return unsafeEval;try{var func=new Function("param1","param2","param3","return param1[param2] === param3;");unsafeEval=!0===func({a:"b"},"a","b")}catch(e){unsafeEval=!1}return unsafeEval}())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")},ShaderSystem.prototype.contextChange=function(gl){this.gl=gl,this.reset()},ShaderSystem.prototype.bind=function(shader,dontSync){shader.uniforms.globals=this.renderer.globalUniforms;var program=shader.program,glProgram=program.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(shader);return this.shader=shader,this.program!==program&&(this.program=program,this.gl.useProgram(glProgram.program)),dontSync||(defaultSyncData.textureCount=0,defaultSyncData.uboCount=0,this.syncUniformGroup(shader.uniformGroup,defaultSyncData)),glProgram},ShaderSystem.prototype.setUniforms=function(uniforms){var shader=this.shader.program,glProgram=shader.glPrograms[this.renderer.CONTEXT_UID];shader.syncUniforms(glProgram.uniformData,uniforms,this.renderer)},ShaderSystem.prototype.syncUniformGroup=function(group,syncData){var glProgram=this.getGlProgram();group.static&&group.dirtyId===glProgram.uniformDirtyGroups[group.id]||(glProgram.uniformDirtyGroups[group.id]=group.dirtyId,this.syncUniforms(group,glProgram,syncData))},ShaderSystem.prototype.syncUniforms=function(group,glProgram,syncData){(group.syncUniforms[this.shader.program.id]||this.createSyncGroups(group))(glProgram.uniformData,group.uniforms,this.renderer,syncData)},ShaderSystem.prototype.createSyncGroups=function(group){var id=this.getSignature(group,this.shader.program.uniformData,"u");return this.cache[id]||(this.cache[id]=function(group,uniformData){var _a,funcFragments=["\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n "];for(var i in group.uniforms){var data=uniformData[i];if(data){for(var uniform=group.uniforms[i],parsed=!1,j=0;j<uniformParsers.length;j++)if(uniformParsers[j].test(data,uniform)){funcFragments.push(uniformParsers[j].code(i,uniform)),parsed=!0;break}if(!parsed){var template=(1===data.size?GLSL_TO_SINGLE_SETTERS_CACHED:GLSL_TO_ARRAY_SETTERS)[data.type].replace("location",'ud["'+i+'"].location');funcFragments.push('\n cu = ud["'+i+'"];\n cv = cu.value;\n v = uv["'+i+'"];\n '+template+";")}}else(null===(_a=group.uniforms[i])||void 0===_a?void 0:_a.group)&&(group.uniforms[i].ubo?funcFragments.push("\n renderer.shader.syncUniformBufferGroup(uv."+i+", '"+i+"');\n "):funcFragments.push("\n renderer.shader.syncUniformGroup(uv."+i+", syncData);\n "))}return new Function("ud","uv","renderer","syncData",funcFragments.join("\n"))}(group,this.shader.program.uniformData)),group.syncUniforms[this.shader.program.id]=this.cache[id],group.syncUniforms[this.shader.program.id]},ShaderSystem.prototype.syncUniformBufferGroup=function(group,name){var glProgram=this.getGlProgram();if(!group.static||0!==group.dirtyId||!glProgram.uniformGroups[group.id]){group.dirtyId=0;var syncFunc=glProgram.uniformGroups[group.id]||this.createSyncBufferGroup(group,glProgram,name);group.buffer.update(),syncFunc(glProgram.uniformData,group.uniforms,this.renderer,defaultSyncData,group.buffer)}this.renderer.buffer.bindBufferBase(group.buffer,glProgram.uniformBufferBindings[name])},ShaderSystem.prototype.createSyncBufferGroup=function(group,glProgram,name){var gl=this.renderer.gl;this.renderer.buffer.bind(group.buffer);var uniformBlockIndex=this.gl.getUniformBlockIndex(glProgram.program,name);glProgram.uniformBufferBindings[name]=this.shader.uniformBindCount,gl.uniformBlockBinding(glProgram.program,uniformBlockIndex,this.shader.uniformBindCount),this.shader.uniformBindCount++;var id=this.getSignature(group,this.shader.program.uniformData,"ubo"),uboData=this._uboCache[id];if(uboData||(uboData=this._uboCache[id]=generateUniformBufferSync(group,this.shader.program.uniformData)),group.autoManage){var data=new Float32Array(uboData.size/4);group.buffer.update(data)}return glProgram.uniformGroups[group.id]=uboData.syncFunc,glProgram.uniformGroups[group.id]},ShaderSystem.prototype.getSignature=function(group,uniformData,preFix){var uniforms=group.uniforms,strings=[preFix+"-"];for(var i in uniforms)strings.push(i),uniformData[i]&&strings.push(uniformData[i].type);return strings.join("-")},ShaderSystem.prototype.getGlProgram=function(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null},ShaderSystem.prototype.generateProgram=function(shader){var gl=this.gl,program=shader.program,glProgram=generateProgram(gl,program);return program.glPrograms[this.renderer.CONTEXT_UID]=glProgram,glProgram},ShaderSystem.prototype.reset=function(){this.program=null,this.shader=null},ShaderSystem.prototype.destroy=function(){this.renderer=null,this.destroyed=!0},ShaderSystem}();var StateSystem=function(){function StateSystem(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=BLEND_MODES$1.NONE,this._blendEq=!1,this.map=[],this.map[0]=this.setBlend,this.map[1]=this.setOffset,this.map[2]=this.setCullFace,this.map[3]=this.setDepthTest,this.map[4]=this.setFrontFace,this.map[5]=this.setDepthMask,this.checks=[],this.defaultState=new State,this.defaultState.blend=!0}return StateSystem.prototype.contextChange=function(gl){this.gl=gl,this.blendModes=function(gl,array){return void 0===array&&(array=[]),array[BLEND_MODES$1.NORMAL]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.ADD]=[gl.ONE,gl.ONE],array[BLEND_MODES$1.MULTIPLY]=[gl.DST_COLOR,gl.ONE_MINUS_SRC_ALPHA,gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.SCREEN]=[gl.ONE,gl.ONE_MINUS_SRC_COLOR,gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.OVERLAY]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.DARKEN]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.LIGHTEN]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.COLOR_DODGE]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.COLOR_BURN]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.HARD_LIGHT]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.SOFT_LIGHT]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.DIFFERENCE]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.EXCLUSION]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.HUE]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.SATURATION]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.COLOR]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.LUMINOSITY]=[gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.NONE]=[0,0],array[BLEND_MODES$1.NORMAL_NPM]=[gl.SRC_ALPHA,gl.ONE_MINUS_SRC_ALPHA,gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.ADD_NPM]=[gl.SRC_ALPHA,gl.ONE,gl.ONE,gl.ONE],array[BLEND_MODES$1.SCREEN_NPM]=[gl.SRC_ALPHA,gl.ONE_MINUS_SRC_COLOR,gl.ONE,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.SRC_IN]=[gl.DST_ALPHA,gl.ZERO],array[BLEND_MODES$1.SRC_OUT]=[gl.ONE_MINUS_DST_ALPHA,gl.ZERO],array[BLEND_MODES$1.SRC_ATOP]=[gl.DST_ALPHA,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.DST_OVER]=[gl.ONE_MINUS_DST_ALPHA,gl.ONE],array[BLEND_MODES$1.DST_IN]=[gl.ZERO,gl.SRC_ALPHA],array[BLEND_MODES$1.DST_OUT]=[gl.ZERO,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.DST_ATOP]=[gl.ONE_MINUS_DST_ALPHA,gl.SRC_ALPHA],array[BLEND_MODES$1.XOR]=[gl.ONE_MINUS_DST_ALPHA,gl.ONE_MINUS_SRC_ALPHA],array[BLEND_MODES$1.SUBTRACT]=[gl.ONE,gl.ONE,gl.ONE,gl.ONE,gl.FUNC_REVERSE_SUBTRACT,gl.FUNC_ADD],array}(gl),this.set(this.defaultState),this.reset()},StateSystem.prototype.set=function(state){if(state=state||this.defaultState,this.stateId!==state.data){for(var diff=this.stateId^state.data,i=0;diff;)1&diff&&this.map[i].call(this,!!(state.data&1<<i)),diff>>=1,i++;this.stateId=state.data}for(i=0;i<this.checks.length;i++)this.checks[i](this,state)},StateSystem.prototype.forceState=function(state){state=state||this.defaultState;for(var i=0;i<this.map.length;i++)this.map[i].call(this,!!(state.data&1<<i));for(i=0;i<this.checks.length;i++)this.checks[i](this,state);this.stateId=state.data},StateSystem.prototype.setBlend=function(value){this.updateCheck(StateSystem.checkBlendMode,value),this.gl[value?"enable":"disable"](this.gl.BLEND)},StateSystem.prototype.setOffset=function(value){this.updateCheck(StateSystem.checkPolygonOffset,value),this.gl[value?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)},StateSystem.prototype.setDepthTest=function(value){this.gl[value?"enable":"disable"](this.gl.DEPTH_TEST)},StateSystem.prototype.setDepthMask=function(value){this.gl.depthMask(value)},StateSystem.prototype.setCullFace=function(value){this.gl[value?"enable":"disable"](this.gl.CULL_FACE)},StateSystem.prototype.setFrontFace=function(value){this.gl.frontFace(this.gl[value?"CW":"CCW"])},StateSystem.prototype.setBlendMode=function(value){if(value!==this.blendMode){this.blendMode=value;var mode=this.blendModes[value],gl=this.gl;2===mode.length?gl.blendFunc(mode[0],mode[1]):gl.blendFuncSeparate(mode[0],mode[1],mode[2],mode[3]),6===mode.length?(this._blendEq=!0,gl.blendEquationSeparate(mode[4],mode[5])):this._blendEq&&(this._blendEq=!1,gl.blendEquationSeparate(gl.FUNC_ADD,gl.FUNC_ADD))}},StateSystem.prototype.setPolygonOffset=function(value,scale){this.gl.polygonOffset(value,scale)},StateSystem.prototype.reset=function(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)},StateSystem.prototype.updateCheck=function(func,value){var index=this.checks.indexOf(func);value&&-1===index?this.checks.push(func):value||-1===index||this.checks.splice(index,1)},StateSystem.checkBlendMode=function(system,state){system.setBlendMode(state.blendMode)},StateSystem.checkPolygonOffset=function(system,state){system.setPolygonOffset(1,state.polygonOffset)},StateSystem.prototype.destroy=function(){this.gl=null},StateSystem}(),TextureGCSystem=function(){function TextureGCSystem(renderer){this.renderer=renderer,this.count=0,this.checkCount=0,this.maxIdle=settings.GC_MAX_IDLE,this.checkCountMax=settings.GC_MAX_CHECK_COUNT,this.mode=settings.GC_MODE}return TextureGCSystem.prototype.postrender=function(){this.renderer.renderingToScreen&&(this.count++,this.mode!==GC_MODES$1.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))},TextureGCSystem.prototype.run=function(){for(var tm=this.renderer.texture,managedTextures=tm.managedTextures,wasRemoved=!1,i=0;i<managedTextures.length;i++){var texture=managedTextures[i];!texture.framebuffer&&this.count-texture.touched>this.maxIdle&&(tm.destroyTexture(texture,!0),managedTextures[i]=null,wasRemoved=!0)}if(wasRemoved){var j=0;for(i=0;i<managedTextures.length;i++)null!==managedTextures[i]&&(managedTextures[j++]=managedTextures[i]);managedTextures.length=j}},TextureGCSystem.prototype.unload=function(displayObject){var tm=this.renderer.texture,texture=displayObject._texture;texture&&!texture.framebuffer&&tm.destroyTexture(texture);for(var i=displayObject.children.length-1;i>=0;i--)this.unload(displayObject.children[i])},TextureGCSystem.prototype.destroy=function(){this.renderer=null},TextureGCSystem}();var GLTexture=function(texture){this.texture=texture,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=TYPES$1.UNSIGNED_BYTE,this.internalFormat=FORMATS$1.RGBA,this.samplerType=0},TextureSystem=function(){function TextureSystem(renderer){this.renderer=renderer,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new BaseTexture,this.hasIntegerTextures=!1}return TextureSystem.prototype.contextChange=function(){var gl=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function(gl){var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m,_o,_p,_q,_r,_s,_t,_u,_v,_w,_x,table;return"WebGL2RenderingContext"in globalThis&&gl instanceof globalThis.WebGL2RenderingContext?((_a={})[TYPES$1.UNSIGNED_BYTE]=((_b={})[FORMATS$1.RGBA]=gl.RGBA8,_b[FORMATS$1.RGB]=gl.RGB8,_b[FORMATS$1.RG]=gl.RG8,_b[FORMATS$1.RED]=gl.R8,_b[FORMATS$1.RGBA_INTEGER]=gl.RGBA8UI,_b[FORMATS$1.RGB_INTEGER]=gl.RGB8UI,_b[FORMATS$1.RG_INTEGER]=gl.RG8UI,_b[FORMATS$1.RED_INTEGER]=gl.R8UI,_b[FORMATS$1.ALPHA]=gl.ALPHA,_b[FORMATS$1.LUMINANCE]=gl.LUMINANCE,_b[FORMATS$1.LUMINANCE_ALPHA]=gl.LUMINANCE_ALPHA,_b),_a[TYPES$1.BYTE]=((_c={})[FORMATS$1.RGBA]=gl.RGBA8_SNORM,_c[FORMATS$1.RGB]=gl.RGB8_SNORM,_c[FORMATS$1.RG]=gl.RG8_SNORM,_c[FORMATS$1.RED]=gl.R8_SNORM,_c[FORMATS$1.RGBA_INTEGER]=gl.RGBA8I,_c[FORMATS$1.RGB_INTEGER]=gl.RGB8I,_c[FORMATS$1.RG_INTEGER]=gl.RG8I,_c[FORMATS$1.RED_INTEGER]=gl.R8I,_c),_a[TYPES$1.UNSIGNED_SHORT]=((_d={})[FORMATS$1.RGBA_INTEGER]=gl.RGBA16UI,_d[FORMATS$1.RGB_INTEGER]=gl.RGB16UI,_d[FORMATS$1.RG_INTEGER]=gl.RG16UI,_d[FORMATS$1.RED_INTEGER]=gl.R16UI,_d[FORMATS$1.DEPTH_COMPONENT]=gl.DEPTH_COMPONENT16,_d),_a[TYPES$1.SHORT]=((_e={})[FORMATS$1.RGBA_INTEGER]=gl.RGBA16I,_e[FORMATS$1.RGB_INTEGER]=gl.RGB16I,_e[FORMATS$1.RG_INTEGER]=gl.RG16I,_e[FORMATS$1.RED_INTEGER]=gl.R16I,_e),_a[TYPES$1.UNSIGNED_INT]=((_f={})[FORMATS$1.RGBA_INTEGER]=gl.RGBA32UI,_f[FORMATS$1.RGB_INTEGER]=gl.RGB32UI,_f[FORMATS$1.RG_INTEGER]=gl.RG32UI,_f[FORMATS$1.RED_INTEGER]=gl.R32UI,_f[FORMATS$1.DEPTH_COMPONENT]=gl.DEPTH_COMPONENT24,_f),_a[TYPES$1.INT]=((_g={})[FORMATS$1.RGBA_INTEGER]=gl.RGBA32I,_g[FORMATS$1.RGB_INTEGER]=gl.RGB32I,_g[FORMATS$1.RG_INTEGER]=gl.RG32I,_g[FORMATS$1.RED_INTEGER]=gl.R32I,_g),_a[TYPES$1.FLOAT]=((_h={})[FORMATS$1.RGBA]=gl.RGBA32F,_h[FORMATS$1.RGB]=gl.RGB32F,_h[FORMATS$1.RG]=gl.RG32F,_h[FORMATS$1.RED]=gl.R32F,_h[FORMATS$1.DEPTH_COMPONENT]=gl.DEPTH_COMPONENT32F,_h),_a[TYPES$1.HALF_FLOAT]=((_j={})[FORMATS$1.RGBA]=gl.RGBA16F,_j[FORMATS$1.RGB]=gl.RGB16F,_j[FORMATS$1.RG]=gl.RG16F,_j[FORMATS$1.RED]=gl.R16F,_j),_a[TYPES$1.UNSIGNED_SHORT_5_6_5]=((_k={})[FORMATS$1.RGB]=gl.RGB565,_k),_a[TYPES$1.UNSIGNED_SHORT_4_4_4_4]=((_l={})[FORMATS$1.RGBA]=gl.RGBA4,_l),_a[TYPES$1.UNSIGNED_SHORT_5_5_5_1]=((_m={})[FORMATS$1.RGBA]=gl.RGB5_A1,_m),_a[TYPES$1.UNSIGNED_INT_2_10_10_10_REV]=((_o={})[FORMATS$1.RGBA]=gl.RGB10_A2,_o[FORMATS$1.RGBA_INTEGER]=gl.RGB10_A2UI,_o),_a[TYPES$1.UNSIGNED_INT_10F_11F_11F_REV]=((_p={})[FORMATS$1.RGB]=gl.R11F_G11F_B10F,_p),_a[TYPES$1.UNSIGNED_INT_5_9_9_9_REV]=((_q={})[FORMATS$1.RGB]=gl.RGB9_E5,_q),_a[TYPES$1.UNSIGNED_INT_24_8]=((_r={})[FORMATS$1.DEPTH_STENCIL]=gl.DEPTH24_STENCIL8,_r),_a[TYPES$1.FLOAT_32_UNSIGNED_INT_24_8_REV]=((_s={})[FORMATS$1.DEPTH_STENCIL]=gl.DEPTH32F_STENCIL8,_s),table=_a):((_t={})[TYPES$1.UNSIGNED_BYTE]=((_u={})[FORMATS$1.RGBA]=gl.RGBA,_u[FORMATS$1.RGB]=gl.RGB,_u[FORMATS$1.ALPHA]=gl.ALPHA,_u[FORMATS$1.LUMINANCE]=gl.LUMINANCE,_u[FORMATS$1.LUMINANCE_ALPHA]=gl.LUMINANCE_ALPHA,_u),_t[TYPES$1.UNSIGNED_SHORT_5_6_5]=((_v={})[FORMATS$1.RGB]=gl.RGB,_v),_t[TYPES$1.UNSIGNED_SHORT_4_4_4_4]=((_w={})[FORMATS$1.RGBA]=gl.RGBA,_w),_t[TYPES$1.UNSIGNED_SHORT_5_5_5_1]=((_x={})[FORMATS$1.RGBA]=gl.RGBA,_x),table=_t),table}(gl);var maxTextures=gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=maxTextures;for(var i=0;i<maxTextures;i++)this.boundTextures[i]=null;this.emptyTextures={};var emptyTexture2D=new GLTexture(gl.createTexture());gl.bindTexture(gl.TEXTURE_2D,emptyTexture2D.texture),gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[gl.TEXTURE_2D]=emptyTexture2D,this.emptyTextures[gl.TEXTURE_CUBE_MAP]=new GLTexture(gl.createTexture()),gl.bindTexture(gl.TEXTURE_CUBE_MAP,this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);for(i=0;i<6;i++)gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,null);gl.texParameteri(gl.TEXTURE_CUBE_MAP,gl.TEXTURE_MAG_FILTER,gl.LINEAR),gl.texParameteri(gl.TEXTURE_CUBE_MAP,gl.TEXTURE_MIN_FILTER,gl.LINEAR);for(i=0;i<this.boundTextures.length;i++)this.bind(null,i)},TextureSystem.prototype.bind=function(texture,location){void 0===location&&(location=0);var gl=this.gl;if((texture=null==texture?void 0:texture.castToBaseTexture())&&texture.valid&&!texture.parentTextureArray){texture.touched=this.renderer.textureGC.count;var glTexture=texture._glTextures[this.CONTEXT_UID]||this.initTexture(texture);this.boundTextures[location]!==texture&&(this.currentLocation!==location&&(this.currentLocation=location,gl.activeTexture(gl.TEXTURE0+location)),gl.bindTexture(texture.target,glTexture.texture)),glTexture.dirtyId!==texture.dirtyId&&(this.currentLocation!==location&&(this.currentLocation=location,gl.activeTexture(gl.TEXTURE0+location)),this.updateTexture(texture)),this.boundTextures[location]=texture}else this.currentLocation!==location&&(this.currentLocation=location,gl.activeTexture(gl.TEXTURE0+location)),gl.bindTexture(gl.TEXTURE_2D,this.emptyTextures[gl.TEXTURE_2D].texture),this.boundTextures[location]=null},TextureSystem.prototype.reset=function(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(var i=0;i<this.boundTextures.length;i++)this.boundTextures[i]=this.unknownTexture},TextureSystem.prototype.unbind=function(texture){var gl=this.gl,boundTextures=this.boundTextures;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(var i=0;i<boundTextures.length;i++)boundTextures[i]===this.unknownTexture&&this.bind(null,i)}for(i=0;i<boundTextures.length;i++)boundTextures[i]===texture&&(this.currentLocation!==i&&(gl.activeTexture(gl.TEXTURE0+i),this.currentLocation=i),gl.bindTexture(texture.target,this.emptyTextures[texture.target].texture),boundTextures[i]=null)},TextureSystem.prototype.ensureSamplerType=function(maxTextures){var boundTextures=this.boundTextures,hasIntegerTextures=this.hasIntegerTextures,CONTEXT_UID=this.CONTEXT_UID;if(hasIntegerTextures)for(var i=maxTextures-1;i>=0;--i){var tex=boundTextures[i];if(tex)tex._glTextures[CONTEXT_UID].samplerType!==SAMPLER_TYPES$1.FLOAT&&this.renderer.texture.unbind(tex)}},TextureSystem.prototype.initTexture=function(texture){var glTexture=new GLTexture(this.gl.createTexture());return glTexture.dirtyId=-1,texture._glTextures[this.CONTEXT_UID]=glTexture,this.managedTextures.push(texture),texture.on("dispose",this.destroyTexture,this),glTexture},TextureSystem.prototype.initTextureType=function(texture,glTexture){var _a,_b;glTexture.internalFormat=null!==(_b=null===(_a=this.internalFormats[texture.type])||void 0===_a?void 0:_a[texture.format])&&void 0!==_b?_b:texture.format,2===this.webGLVersion&&texture.type===TYPES$1.HALF_FLOAT?glTexture.type=this.gl.HALF_FLOAT:glTexture.type=texture.type},TextureSystem.prototype.updateTexture=function(texture){var glTexture=texture._glTextures[this.CONTEXT_UID];if(glTexture){var renderer=this.renderer;if(this.initTextureType(texture,glTexture),texture.resource&&texture.resource.upload(renderer,texture,glTexture))glTexture.samplerType!==SAMPLER_TYPES$1.FLOAT&&(this.hasIntegerTextures=!0);else{var width=texture.realWidth,height=texture.realHeight,gl=renderer.gl;(glTexture.width!==width||glTexture.height!==height||glTexture.dirtyId<0)&&(glTexture.width=width,glTexture.height=height,gl.texImage2D(texture.target,0,glTexture.internalFormat,width,height,0,texture.format,glTexture.type,null))}texture.dirtyStyleId!==glTexture.dirtyStyleId&&this.updateTextureStyle(texture),glTexture.dirtyId=texture.dirtyId}},TextureSystem.prototype.destroyTexture=function(texture,skipRemove){var gl=this.gl;if((texture=texture.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(texture),gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture),texture.off("dispose",this.destroyTexture,this),delete texture._glTextures[this.CONTEXT_UID],!skipRemove)){var i=this.managedTextures.indexOf(texture);-1!==i&&removeItems(this.managedTextures,i,1)}},TextureSystem.prototype.updateTextureStyle=function(texture){var glTexture=texture._glTextures[this.CONTEXT_UID];glTexture&&(texture.mipmap!==MIPMAP_MODES$1.POW2&&2===this.webGLVersion||texture.isPowerOfTwo?glTexture.mipmap=texture.mipmap>=1:glTexture.mipmap=!1,2===this.webGLVersion||texture.isPowerOfTwo?glTexture.wrapMode=texture.wrapMode:glTexture.wrapMode=WRAP_MODES$1.CLAMP,texture.resource&&texture.resource.style(this.renderer,texture,glTexture)||this.setStyle(texture,glTexture),glTexture.dirtyStyleId=texture.dirtyStyleId)},TextureSystem.prototype.setStyle=function(texture,glTexture){var gl=this.gl;if(glTexture.mipmap&&texture.mipmap!==MIPMAP_MODES$1.ON_MANUAL&&gl.generateMipmap(texture.target),gl.texParameteri(texture.target,gl.TEXTURE_WRAP_S,glTexture.wrapMode),gl.texParameteri(texture.target,gl.TEXTURE_WRAP_T,glTexture.wrapMode),glTexture.mipmap){gl.texParameteri(texture.target,gl.TEXTURE_MIN_FILTER,texture.scaleMode===SCALE_MODES$1.LINEAR?gl.LINEAR_MIPMAP_LINEAR:gl.NEAREST_MIPMAP_NEAREST);var anisotropicExt=this.renderer.context.extensions.anisotropicFiltering;if(anisotropicExt&&texture.anisotropicLevel>0&&texture.scaleMode===SCALE_MODES$1.LINEAR){var level=Math.min(texture.anisotropicLevel,gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));gl.texParameterf(texture.target,anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT,level)}}else gl.texParameteri(texture.target,gl.TEXTURE_MIN_FILTER,texture.scaleMode===SCALE_MODES$1.LINEAR?gl.LINEAR:gl.NEAREST);gl.texParameteri(texture.target,gl.TEXTURE_MAG_FILTER,texture.scaleMode===SCALE_MODES$1.LINEAR?gl.LINEAR:gl.NEAREST)},TextureSystem.prototype.destroy=function(){this.renderer=null},TextureSystem}(),_systems={__proto__:null,FilterSystem:FilterSystem,BatchSystem:BatchSystem,ContextSystem:ContextSystem,FramebufferSystem:FramebufferSystem,GeometrySystem:GeometrySystem,MaskSystem:MaskSystem,ScissorSystem:ScissorSystem,StencilSystem:StencilSystem,ProjectionSystem:ProjectionSystem,RenderTextureSystem:RenderTextureSystem,ShaderSystem:ShaderSystem,StateSystem:StateSystem,TextureGCSystem:TextureGCSystem,TextureSystem:TextureSystem},tempMatrix=new Matrix,AbstractRenderer=function(_super){function AbstractRenderer(type,options){void 0===type&&(type=RENDERER_TYPE$1.UNKNOWN);var _this=_super.call(this)||this;return options=Object.assign({},settings.RENDER_OPTIONS,options),_this.options=options,_this.type=type,_this.screen=new Rectangle(0,0,options.width,options.height),_this.view=options.view||document.createElement("canvas"),_this.resolution=options.resolution||settings.RESOLUTION,_this.useContextAlpha=options.useContextAlpha,_this.autoDensity=!!options.autoDensity,_this.preserveDrawingBuffer=options.preserveDrawingBuffer,_this.clearBeforeRender=options.clearBeforeRender,_this._backgroundColor=0,_this._backgroundColorRgba=[0,0,0,1],_this._backgroundColorString="#000000",_this.backgroundColor=options.backgroundColor||_this._backgroundColor,_this.backgroundAlpha=options.backgroundAlpha,void 0!==options.transparent&&(deprecation("6.0.0","Option transparent is deprecated, please use backgroundAlpha instead."),_this.useContextAlpha=options.transparent,_this.backgroundAlpha=options.transparent?0:1),_this._lastObjectRendered=null,_this.plugins={},_this}return __extends$3(AbstractRenderer,_super),AbstractRenderer.prototype.initPlugins=function(staticMap){for(var o in staticMap)this.plugins[o]=new staticMap[o](this)},Object.defineProperty(AbstractRenderer.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(AbstractRenderer.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),AbstractRenderer.prototype.resize=function(desiredScreenWidth,desiredScreenHeight){this.view.width=Math.round(desiredScreenWidth*this.resolution),this.view.height=Math.round(desiredScreenHeight*this.resolution);var screenWidth=this.view.width/this.resolution,screenHeight=this.view.height/this.resolution;this.screen.width=screenWidth,this.screen.height=screenHeight,this.autoDensity&&(this.view.style.width=screenWidth+"px",this.view.style.height=screenHeight+"px"),this.emit("resize",screenWidth,screenHeight)},AbstractRenderer.prototype.generateTexture=function(displayObject,options,resolution,region){void 0===options&&(options={}),"number"==typeof options&&(deprecation("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),options={scaleMode:options,resolution:resolution,region:region});var manualRegion=options.region,textureOptions=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(null!=s&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&(t[p[i]]=s[p[i]])}return t}(options,["region"]);0===(region=manualRegion||displayObject.getLocalBounds(null,!0)).width&&(region.width=1),0===region.height&&(region.height=1);var renderTexture=RenderTexture.create(__assign$1({width:region.width,height:region.height},textureOptions));return tempMatrix.tx=-region.x,tempMatrix.ty=-region.y,this.render(displayObject,{renderTexture:renderTexture,clear:!1,transform:tempMatrix,skipUpdateTransform:!!displayObject.parent}),renderTexture},AbstractRenderer.prototype.destroy=function(removeView){for(var o in this.plugins)this.plugins[o].destroy(),this.plugins[o]=null;removeView&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);this.plugins=null,this.type=RENDERER_TYPE$1.UNKNOWN,this.view=null,this.screen=null,this._tempDisplayObjectParent=null,this.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(AbstractRenderer.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(value){this._backgroundColor=value,this._backgroundColorString=hex2string(value),hex2rgb(value,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Object.defineProperty(AbstractRenderer.prototype,"backgroundAlpha",{get:function(){return this._backgroundColorRgba[3]},set:function(value){this._backgroundColorRgba[3]=value},enumerable:!1,configurable:!0}),AbstractRenderer}(eventemitter3),GLBuffer=function(buffer){this.buffer=buffer||null,this.updateID=-1,this.byteLength=-1,this.refCount=0},BufferSystem=function(){function BufferSystem(renderer){this.renderer=renderer,this.managedBuffers={},this.boundBufferBases={}}return BufferSystem.prototype.destroy=function(){this.renderer=null},BufferSystem.prototype.contextChange=function(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID},BufferSystem.prototype.bind=function(buffer){var gl=this.gl,CONTEXT_UID=this.CONTEXT_UID,glBuffer=buffer._glBuffers[CONTEXT_UID]||this.createGLBuffer(buffer);gl.bindBuffer(buffer.type,glBuffer.buffer)},BufferSystem.prototype.bindBufferBase=function(buffer,index){var gl=this.gl,CONTEXT_UID=this.CONTEXT_UID;if(this.boundBufferBases[index]!==buffer){var glBuffer=buffer._glBuffers[CONTEXT_UID]||this.createGLBuffer(buffer);this.boundBufferBases[index]=buffer,gl.bindBufferBase(gl.UNIFORM_BUFFER,index,glBuffer.buffer)}},BufferSystem.prototype.bindBufferRange=function(buffer,index,offset){var gl=this.gl,CONTEXT_UID=this.CONTEXT_UID;offset=offset||0;var glBuffer=buffer._glBuffers[CONTEXT_UID]||this.createGLBuffer(buffer);gl.bindBufferRange(gl.UNIFORM_BUFFER,index||0,glBuffer.buffer,256*offset,256)},BufferSystem.prototype.update=function(buffer){var gl=this.gl,CONTEXT_UID=this.CONTEXT_UID,glBuffer=buffer._glBuffers[CONTEXT_UID];if(buffer._updateID!==glBuffer.updateID)if(glBuffer.updateID=buffer._updateID,gl.bindBuffer(buffer.type,glBuffer.buffer),glBuffer.byteLength>=buffer.data.byteLength)gl.bufferSubData(buffer.type,0,buffer.data);else{var drawType=buffer.static?gl.STATIC_DRAW:gl.DYNAMIC_DRAW;glBuffer.byteLength=buffer.data.byteLength,gl.bufferData(buffer.type,buffer.data,drawType)}},BufferSystem.prototype.dispose=function(buffer,contextLost){if(this.managedBuffers[buffer.id]){delete this.managedBuffers[buffer.id];var glBuffer=buffer._glBuffers[this.CONTEXT_UID],gl=this.gl;buffer.disposeRunner.remove(this),glBuffer&&(contextLost||gl.deleteBuffer(glBuffer.buffer),delete buffer._glBuffers[this.CONTEXT_UID])}},BufferSystem.prototype.disposeAll=function(contextLost){for(var all=Object.keys(this.managedBuffers),i=0;i<all.length;i++)this.dispose(this.managedBuffers[all[i]],contextLost)},BufferSystem.prototype.createGLBuffer=function(buffer){var CONTEXT_UID=this.CONTEXT_UID,gl=this.gl;return buffer._glBuffers[CONTEXT_UID]=new GLBuffer(gl.createBuffer()),this.managedBuffers[buffer.id]=buffer,buffer.disposeRunner.add(this),buffer._glBuffers[CONTEXT_UID]},BufferSystem}(),Renderer=function(_super){function Renderer(options){var _this=_super.call(this,RENDERER_TYPE$1.WEBGL,options)||this;return options=_this.options,_this.gl=null,_this.CONTEXT_UID=0,_this.runners={destroy:new Runner("destroy"),contextChange:new Runner("contextChange"),reset:new Runner("reset"),update:new Runner("update"),postrender:new Runner("postrender"),prerender:new Runner("prerender"),resize:new Runner("resize")},_this.runners.contextChange.add(_this),_this.globalUniforms=new UniformGroup({projectionMatrix:new Matrix},!0),_this.addSystem(MaskSystem,"mask").addSystem(ContextSystem,"context").addSystem(StateSystem,"state").addSystem(ShaderSystem,"shader").addSystem(TextureSystem,"texture").addSystem(BufferSystem,"buffer").addSystem(GeometrySystem,"geometry").addSystem(FramebufferSystem,"framebuffer").addSystem(ScissorSystem,"scissor").addSystem(StencilSystem,"stencil").addSystem(ProjectionSystem,"projection").addSystem(TextureGCSystem,"textureGC").addSystem(FilterSystem,"filter").addSystem(RenderTextureSystem,"renderTexture").addSystem(BatchSystem,"batch"),_this.initPlugins(Renderer.__plugins),_this.multisample=void 0,options.context?_this.context.initFromContext(options.context):_this.context.initFromOptions({alpha:!!_this.useContextAlpha,antialias:options.antialias,premultipliedAlpha:_this.useContextAlpha&&"notMultiplied"!==_this.useContextAlpha,stencil:!0,preserveDrawingBuffer:options.preserveDrawingBuffer,powerPreference:_this.options.powerPreference}),_this.renderingToScreen=!0,function(type){var _a;if(!saidHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var args=["\n %c %c %c PixiJS 6.4.2 - ✰ "+type+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(_a=globalThis.console).log.apply(_a,args)}else globalThis.console&&globalThis.console.log("PixiJS 6.4.2 - "+type+" - http://www.pixijs.com/");saidHello=!0}}(2===_this.context.webGLVersion?"WebGL 2":"WebGL 1"),_this.resize(_this.options.width,_this.options.height),_this}return __extends$3(Renderer,_super),Renderer.create=function(options){if(void 0===supported&&(supported=function(){var contextOptions={stencil:!0,failIfMajorPerformanceCaveat:settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!globalThis.WebGLRenderingContext)return!1;var canvas=document.createElement("canvas"),gl=canvas.getContext("webgl",contextOptions)||canvas.getContext("experimental-webgl",contextOptions),success=!(!gl||!gl.getContextAttributes().stencil);if(gl){var loseContext=gl.getExtension("WEBGL_lose_context");loseContext&&loseContext.loseContext()}return gl=null,success}catch(e){return!1}}()),supported)return new Renderer(options);throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.')},Renderer.prototype.contextChange=function(){var samples,gl=this.gl;if(1===this.context.webGLVersion){var framebuffer=gl.getParameter(gl.FRAMEBUFFER_BINDING);gl.bindFramebuffer(gl.FRAMEBUFFER,null),samples=gl.getParameter(gl.SAMPLES),gl.bindFramebuffer(gl.FRAMEBUFFER,framebuffer)}else{framebuffer=gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING);gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER,null),samples=gl.getParameter(gl.SAMPLES),gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER,framebuffer)}samples>=MSAA_QUALITY$1.HIGH?this.multisample=MSAA_QUALITY$1.HIGH:samples>=MSAA_QUALITY$1.MEDIUM?this.multisample=MSAA_QUALITY$1.MEDIUM:samples>=MSAA_QUALITY$1.LOW?this.multisample=MSAA_QUALITY$1.LOW:this.multisample=MSAA_QUALITY$1.NONE},Renderer.prototype.addSystem=function(ClassRef,name){var system=new ClassRef(this);if(this[name])throw new Error('Whoops! The name "'+name+'" is already in use');for(var i in this[name]=system,this.runners)this.runners[i].add(system);return this},Renderer.prototype.render=function(displayObject,options){var renderTexture,clear,transform,skipUpdateTransform;if(options&&(options instanceof RenderTexture?(deprecation("6.0.0","Renderer#render arguments changed, use options instead."),renderTexture=options,clear=arguments[2],transform=arguments[3],skipUpdateTransform=arguments[4]):(renderTexture=options.renderTexture,clear=options.clear,transform=options.transform,skipUpdateTransform=options.skipUpdateTransform)),this.renderingToScreen=!renderTexture,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=transform,!this.context.isLost){if(renderTexture||(this._lastObjectRendered=displayObject),!skipUpdateTransform){var cacheParent=displayObject.enableTempParent();displayObject.updateTransform(),displayObject.disableTempParent(cacheParent)}this.renderTexture.bind(renderTexture),this.batch.currentRenderer.start(),(void 0!==clear?clear:this.clearBeforeRender)&&this.renderTexture.clear(),displayObject.render(this),this.batch.currentRenderer.flush(),renderTexture&&renderTexture.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},Renderer.prototype.generateTexture=function(displayObject,options,resolution,region){void 0===options&&(options={});var renderTexture=_super.prototype.generateTexture.call(this,displayObject,options,resolution,region);return this.framebuffer.blit(),renderTexture},Renderer.prototype.resize=function(desiredScreenWidth,desiredScreenHeight){_super.prototype.resize.call(this,desiredScreenWidth,desiredScreenHeight),this.runners.resize.emit(this.screen.height,this.screen.width)},Renderer.prototype.reset=function(){return this.runners.reset.emit(),this},Renderer.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},Renderer.prototype.destroy=function(removeView){for(var r in this.runners.destroy.emit(),this.runners)this.runners[r].destroy();_super.prototype.destroy.call(this,removeView),this.gl=null},Object.defineProperty(Renderer.prototype,"extract",{get:function(){return deprecation("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),Renderer.registerPlugin=function(pluginName,ctor){Renderer.__plugins=Renderer.__plugins||{},Renderer.__plugins[pluginName]=ctor},Renderer}(AbstractRenderer);function autoDetectRenderer(options){return Renderer.create(options)}var defaultFilterVertex="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",BatchDrawCall=function(){this.texArray=null,this.blend=0,this.type=DRAW_MODES$1.TRIANGLES,this.start=0,this.size=0,this.data=null},BatchTextureArray=function(){function BatchTextureArray(){this.elements=[],this.ids=[],this.count=0}return BatchTextureArray.prototype.clear=function(){for(var i=0;i<this.count;i++)this.elements[i]=null;this.count=0},BatchTextureArray}(),ViewableBuffer=function(){function ViewableBuffer(sizeOrBuffer){"number"==typeof sizeOrBuffer?this.rawBinaryData=new ArrayBuffer(sizeOrBuffer):sizeOrBuffer instanceof Uint8Array?this.rawBinaryData=sizeOrBuffer.buffer:this.rawBinaryData=sizeOrBuffer,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}return Object.defineProperty(ViewableBuffer.prototype,"int8View",{get:function(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View},enumerable:!1,configurable:!0}),Object.defineProperty(ViewableBuffer.prototype,"uint8View",{get:function(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View},enumerable:!1,configurable:!0}),Object.defineProperty(ViewableBuffer.prototype,"int16View",{get:function(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View},enumerable:!1,configurable:!0}),Object.defineProperty(ViewableBuffer.prototype,"uint16View",{get:function(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View},enumerable:!1,configurable:!0}),Object.defineProperty(ViewableBuffer.prototype,"int32View",{get:function(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View},enumerable:!1,configurable:!0}),ViewableBuffer.prototype.view=function(type){return this[type+"View"]},ViewableBuffer.prototype.destroy=function(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null},ViewableBuffer.sizeOf=function(type){switch(type){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(type+" isn't a valid view type")}},ViewableBuffer}(),AbstractBatchRenderer=function(_super){function AbstractBatchRenderer(renderer){var _this=_super.call(this,renderer)||this;return _this.shaderGenerator=null,_this.geometryClass=null,_this.vertexSize=null,_this.state=State.for2d(),_this.size=4*settings.SPRITE_BATCH_SIZE,_this._vertexCount=0,_this._indexCount=0,_this._bufferedElements=[],_this._bufferedTextures=[],_this._bufferSize=0,_this._shader=null,_this._packedGeometries=[],_this._packedGeometryPoolSize=2,_this._flushId=0,_this._aBuffers={},_this._iBuffers={},_this.MAX_TEXTURES=1,_this.renderer.on("prerender",_this.onPrerender,_this),renderer.runners.contextChange.add(_this),_this._dcIndex=0,_this._aIndex=0,_this._iIndex=0,_this._attributeBuffer=null,_this._indexBuffer=null,_this._tempBoundTextures=[],_this}return __extends$3(AbstractBatchRenderer,_super),AbstractBatchRenderer.prototype.contextChange=function(){var gl=this.renderer.gl;settings.PREFER_ENV===ENV$1.WEBGL_LEGACY?this.MAX_TEXTURES=1:(this.MAX_TEXTURES=Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),settings.SPRITE_MAX_TEXTURES),this.MAX_TEXTURES=function(maxIfs,gl){if(0===maxIfs)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");for(var shader=gl.createShader(gl.FRAGMENT_SHADER);;){var fragmentSrc=fragTemplate.replace(/%forloop%/gi,generateIfTestSrc(maxIfs));if(gl.shaderSource(shader,fragmentSrc),gl.compileShader(shader),gl.getShaderParameter(shader,gl.COMPILE_STATUS))break;maxIfs=maxIfs/2|0}return maxIfs}(this.MAX_TEXTURES,gl)),this._shader=this.shaderGenerator.generateShader(this.MAX_TEXTURES);for(var i=0;i<this._packedGeometryPoolSize;i++)this._packedGeometries[i]=new this.geometryClass;this.initFlushBuffers()},AbstractBatchRenderer.prototype.initFlushBuffers=function(){for(var _drawCallPool=AbstractBatchRenderer._drawCallPool,_textureArrayPool=AbstractBatchRenderer._textureArrayPool,MAX_SPRITES=this.size/4,MAX_TA=Math.floor(MAX_SPRITES/this.MAX_TEXTURES)+1;_drawCallPool.length<MAX_SPRITES;)_drawCallPool.push(new BatchDrawCall);for(;_textureArrayPool.length<MAX_TA;)_textureArrayPool.push(new BatchTextureArray);for(var i=0;i<this.MAX_TEXTURES;i++)this._tempBoundTextures[i]=null},AbstractBatchRenderer.prototype.onPrerender=function(){this._flushId=0},AbstractBatchRenderer.prototype.render=function(element){element._texture.valid&&(this._vertexCount+element.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=element.vertexData.length/2,this._indexCount+=element.indices.length,this._bufferedTextures[this._bufferSize]=element._texture.baseTexture,this._bufferedElements[this._bufferSize++]=element)},AbstractBatchRenderer.prototype.buildTexturesAndDrawCalls=function(){var textures=this._bufferedTextures,MAX_TEXTURES=this.MAX_TEXTURES,textureArrays=AbstractBatchRenderer._textureArrayPool,batch=this.renderer.batch,boundTextures=this._tempBoundTextures,touch=this.renderer.textureGC.count,TICK=++BaseTexture._globalBatch,countTexArrays=0,texArray=textureArrays[0],start=0;batch.copyBoundTextures(boundTextures,MAX_TEXTURES);for(var i=0;i<this._bufferSize;++i){var tex=textures[i];textures[i]=null,tex._batchEnabled!==TICK&&(texArray.count>=MAX_TEXTURES&&(batch.boundArray(texArray,boundTextures,TICK,MAX_TEXTURES),this.buildDrawCalls(texArray,start,i),start=i,texArray=textureArrays[++countTexArrays],++TICK),tex._batchEnabled=TICK,tex.touched=touch,texArray.elements[texArray.count++]=tex)}texArray.count>0&&(batch.boundArray(texArray,boundTextures,TICK,MAX_TEXTURES),this.buildDrawCalls(texArray,start,this._bufferSize),++countTexArrays,++TICK);for(i=0;i<boundTextures.length;i++)boundTextures[i]=null;BaseTexture._globalBatch=TICK},AbstractBatchRenderer.prototype.buildDrawCalls=function(texArray,start,finish){var elements=this._bufferedElements,_attributeBuffer=this._attributeBuffer,_indexBuffer=this._indexBuffer,vertexSize=this.vertexSize,drawCalls=AbstractBatchRenderer._drawCallPool,dcIndex=this._dcIndex,aIndex=this._aIndex,iIndex=this._iIndex,drawCall=drawCalls[dcIndex];drawCall.start=this._iIndex,drawCall.texArray=texArray;for(var i=start;i<finish;++i){var sprite=elements[i],tex=sprite._texture.baseTexture,spriteBlendMode=premultiplyBlendMode[tex.alphaMode?1:0][sprite.blendMode];elements[i]=null,start<i&&drawCall.blend!==spriteBlendMode&&(drawCall.size=iIndex-drawCall.start,start=i,(drawCall=drawCalls[++dcIndex]).texArray=texArray,drawCall.start=iIndex),this.packInterleavedGeometry(sprite,_attributeBuffer,_indexBuffer,aIndex,iIndex),aIndex+=sprite.vertexData.length/2*vertexSize,iIndex+=sprite.indices.length,drawCall.blend=spriteBlendMode}start<finish&&(drawCall.size=iIndex-drawCall.start,++dcIndex),this._dcIndex=dcIndex,this._aIndex=aIndex,this._iIndex=iIndex},AbstractBatchRenderer.prototype.bindAndClearTexArray=function(texArray){for(var textureSystem=this.renderer.texture,j=0;j<texArray.count;j++)textureSystem.bind(texArray.elements[j],texArray.ids[j]),texArray.elements[j]=null;texArray.count=0},AbstractBatchRenderer.prototype.updateGeometry=function(){var packedGeometries=this._packedGeometries,attributeBuffer=this._attributeBuffer,indexBuffer=this._indexBuffer;settings.CAN_UPLOAD_SAME_BUFFER?(packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData),packedGeometries[this._flushId]._indexBuffer.update(indexBuffer),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,packedGeometries[this._flushId]=new this.geometryClass),packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData),packedGeometries[this._flushId]._indexBuffer.update(indexBuffer),this.renderer.geometry.bind(packedGeometries[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)},AbstractBatchRenderer.prototype.drawBatches=function(){for(var dcCount=this._dcIndex,_a=this.renderer,gl=_a.gl,stateSystem=_a.state,drawCalls=AbstractBatchRenderer._drawCallPool,curTexArray=null,i=0;i<dcCount;i++){var _b=drawCalls[i],texArray=_b.texArray,type=_b.type,size=_b.size,start=_b.start,blend=_b.blend;curTexArray!==texArray&&(curTexArray=texArray,this.bindAndClearTexArray(texArray)),this.state.blendMode=blend,stateSystem.set(this.state),gl.drawElements(type,size,gl.UNSIGNED_SHORT,2*start)}},AbstractBatchRenderer.prototype.flush=function(){0!==this._vertexCount&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)},AbstractBatchRenderer.prototype.start=function(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES),this.renderer.shader.bind(this._shader),settings.CAN_UPLOAD_SAME_BUFFER&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])},AbstractBatchRenderer.prototype.stop=function(){this.flush()},AbstractBatchRenderer.prototype.destroy=function(){for(var i=0;i<this._packedGeometryPoolSize;i++)this._packedGeometries[i]&&this._packedGeometries[i].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),_super.prototype.destroy.call(this)},AbstractBatchRenderer.prototype.getAttributeBuffer=function(size){var roundedP2=nextPow2(Math.ceil(size/8)),roundedSizeIndex=log2(roundedP2),roundedSize=8*roundedP2;this._aBuffers.length<=roundedSizeIndex&&(this._iBuffers.length=roundedSizeIndex+1);var buffer=this._aBuffers[roundedSize];return buffer||(this._aBuffers[roundedSize]=buffer=new ViewableBuffer(roundedSize*this.vertexSize*4)),buffer},AbstractBatchRenderer.prototype.getIndexBuffer=function(size){var roundedP2=nextPow2(Math.ceil(size/12)),roundedSizeIndex=log2(roundedP2),roundedSize=12*roundedP2;this._iBuffers.length<=roundedSizeIndex&&(this._iBuffers.length=roundedSizeIndex+1);var buffer=this._iBuffers[roundedSizeIndex];return buffer||(this._iBuffers[roundedSizeIndex]=buffer=new Uint16Array(roundedSize)),buffer},AbstractBatchRenderer.prototype.packInterleavedGeometry=function(element,attributeBuffer,indexBuffer,aIndex,iIndex){for(var uint32View=attributeBuffer.uint32View,float32View=attributeBuffer.float32View,packedVertices=aIndex/this.vertexSize,uvs=element.uvs,indicies=element.indices,vertexData=element.vertexData,textureId=element._texture.baseTexture._batchLocation,alpha=Math.min(element.worldAlpha,1),argb=alpha<1&&element._texture.baseTexture.alphaMode?premultiplyTint(element._tintRGB,alpha):element._tintRGB+(255*alpha<<24),i=0;i<vertexData.length;i+=2)float32View[aIndex++]=vertexData[i],float32View[aIndex++]=vertexData[i+1],float32View[aIndex++]=uvs[i],float32View[aIndex++]=uvs[i+1],uint32View[aIndex++]=argb,float32View[aIndex++]=textureId;for(i=0;i<indicies.length;i++)indexBuffer[iIndex++]=packedVertices+indicies[i]},AbstractBatchRenderer._drawCallPool=[],AbstractBatchRenderer._textureArrayPool=[],AbstractBatchRenderer}(ObjectRenderer),BatchShaderGenerator=function(){function BatchShaderGenerator(vertexSrc,fragTemplate){if(this.vertexSrc=vertexSrc,this.fragTemplate=fragTemplate,this.programCache={},this.defaultGroupCache={},fragTemplate.indexOf("%count%")<0)throw new Error('Fragment template must contain "%count%".');if(fragTemplate.indexOf("%forloop%")<0)throw new Error('Fragment template must contain "%forloop%".')}return BatchShaderGenerator.prototype.generateShader=function(maxTextures){if(!this.programCache[maxTextures]){for(var sampleValues=new Int32Array(maxTextures),i=0;i<maxTextures;i++)sampleValues[i]=i;this.defaultGroupCache[maxTextures]=UniformGroup.from({uSamplers:sampleValues},!0);var fragmentSrc=this.fragTemplate;fragmentSrc=(fragmentSrc=fragmentSrc.replace(/%count%/gi,""+maxTextures)).replace(/%forloop%/gi,this.generateSampleSrc(maxTextures)),this.programCache[maxTextures]=new Program(this.vertexSrc,fragmentSrc)}var uniforms={tint:new Float32Array([1,1,1,1]),translationMatrix:new Matrix,default:this.defaultGroupCache[maxTextures]};return new Shader(this.programCache[maxTextures],uniforms)},BatchShaderGenerator.prototype.generateSampleSrc=function(maxTextures){var src="";src+="\n",src+="\n";for(var i=0;i<maxTextures;i++)i>0&&(src+="\nelse "),i<maxTextures-1&&(src+="if(vTextureId < "+i+".5)"),src+="\n{",src+="\n\tcolor = texture2D(uSamplers["+i+"], vTextureCoord);",src+="\n}";return src+="\n",src+="\n"},BatchShaderGenerator}(),BatchGeometry=function(_super){function BatchGeometry(_static){void 0===_static&&(_static=!1);var _this=_super.call(this)||this;return _this._buffer=new Buffer(null,_static,!1),_this._indexBuffer=new Buffer(null,_static,!0),_this.addAttribute("aVertexPosition",_this._buffer,2,!1,TYPES$1.FLOAT).addAttribute("aTextureCoord",_this._buffer,2,!1,TYPES$1.FLOAT).addAttribute("aColor",_this._buffer,4,!0,TYPES$1.UNSIGNED_BYTE).addAttribute("aTextureId",_this._buffer,1,!0,TYPES$1.FLOAT).addIndex(_this._indexBuffer),_this}return __extends$3(BatchGeometry,_super),BatchGeometry}(Geometry),defaultVertex="precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n",defaultFragment="varying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[%count%];\n\nvoid main(void){\n vec4 color;\n %forloop%\n gl_FragColor = color * vColor;\n}\n",BatchPluginFactory=function(){function BatchPluginFactory(){}return BatchPluginFactory.create=function(options){var _a=Object.assign({vertex:defaultVertex,fragment:defaultFragment,geometryClass:BatchGeometry,vertexSize:6},options),vertex=_a.vertex,fragment=_a.fragment,vertexSize=_a.vertexSize,geometryClass=_a.geometryClass;return function(_super){function BatchPlugin(renderer){var _this=_super.call(this,renderer)||this;return _this.shaderGenerator=new BatchShaderGenerator(vertex,fragment),_this.geometryClass=geometryClass,_this.vertexSize=vertexSize,_this}return __extends$3(BatchPlugin,_super),BatchPlugin}(AbstractBatchRenderer)},Object.defineProperty(BatchPluginFactory,"defaultVertexSrc",{get:function(){return defaultVertex},enumerable:!1,configurable:!0}),Object.defineProperty(BatchPluginFactory,"defaultFragmentTemplate",{get:function(){return defaultFragment},enumerable:!1,configurable:!0}),BatchPluginFactory}(),BatchRenderer=BatchPluginFactory.create(),resources={},_loop_1=function(name){Object.defineProperty(resources,name,{get:function(){return deprecation("6.0.0","PIXI.systems."+name+" has moved to PIXI."+name),_resources[name]}})};for(var name in _resources)_loop_1(name);var systems={},_loop_2=function(name){Object.defineProperty(systems,name,{get:function(){return deprecation("6.0.0","PIXI.resources."+name+" has moved to PIXI."+name),_systems[name]}})};for(var name in _systems)_loop_2(name);
|
|
103
104
|
/*!
|
|
104
|
-
* @pixi/
|
|
105
|
-
* Compiled
|
|
105
|
+
* @pixi/app - v6.4.2
|
|
106
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
106
107
|
*
|
|
107
|
-
* @pixi/
|
|
108
|
+
* @pixi/app is licensed under the MIT License.
|
|
108
109
|
* http://www.opensource.org/licenses/mit-license
|
|
109
|
-
*/
|
|
110
|
-
var TEMP_RECT=new Rectangle,Extract=function(){function Extract(renderer){this.renderer=renderer,renderer.extract=this}return Extract.prototype.image=function(target,format,quality){var image=new Image;return image.src=this.base64(target,format,quality),image},Extract.prototype.base64=function(target,format,quality){return this.canvas(target).toDataURL(format,quality)},Extract.prototype.canvas=function(target){var resolution,frame,renderTexture,renderer=this.renderer,flipY=!1,generated=!1;target&&(target instanceof RenderTexture?renderTexture=target:(renderTexture=this.renderer.generateTexture(target),generated=!0)),renderTexture?(resolution=renderTexture.baseTexture.resolution,frame=renderTexture.frame,flipY=!1,renderer.renderTexture.bind(renderTexture)):(resolution=this.renderer.resolution,flipY=!0,(frame=TEMP_RECT).width=this.renderer.width,frame.height=this.renderer.height,renderer.renderTexture.bind(null));var width=Math.floor(frame.width*resolution+1e-4),height=Math.floor(frame.height*resolution+1e-4),canvasBuffer=new CanvasRenderTarget(width,height,1),webglPixels=new Uint8Array(4*width*height),gl=renderer.gl;gl.readPixels(frame.x*resolution,frame.y*resolution,width,height,gl.RGBA,gl.UNSIGNED_BYTE,webglPixels);var canvasData=canvasBuffer.context.getImageData(0,0,width,height);if(Extract.arrayPostDivide(webglPixels,canvasData.data),canvasBuffer.context.putImageData(canvasData,0,0),flipY){var target_1=new CanvasRenderTarget(canvasBuffer.width,canvasBuffer.height,1);target_1.context.scale(1,-1),target_1.context.drawImage(canvasBuffer.canvas,0,-height),canvasBuffer.destroy(),canvasBuffer=target_1}return generated&&renderTexture.destroy(!0),canvasBuffer.canvas},Extract.prototype.pixels=function(target){var resolution,frame,renderTexture,renderer=this.renderer,generated=!1;target&&(target instanceof RenderTexture?renderTexture=target:(renderTexture=this.renderer.generateTexture(target),generated=!0)),renderTexture?(resolution=renderTexture.baseTexture.resolution,frame=renderTexture.frame,renderer.renderTexture.bind(renderTexture)):(resolution=renderer.resolution,(frame=TEMP_RECT).width=renderer.width,frame.height=renderer.height,renderer.renderTexture.bind(null));var width=frame.width*resolution,height=frame.height*resolution,webglPixels=new Uint8Array(4*width*height),gl=renderer.gl;return gl.readPixels(frame.x*resolution,frame.y*resolution,width,height,gl.RGBA,gl.UNSIGNED_BYTE,webglPixels),generated&&renderTexture.destroy(!0),Extract.arrayPostDivide(webglPixels,webglPixels),webglPixels},Extract.prototype.destroy=function(){this.renderer.extract=null,this.renderer=null},Extract.arrayPostDivide=function(pixels,out){for(var i=0;i<pixels.length;i+=4){var alpha=out[i+3]=pixels[i+3];0!==alpha?(out[i]=Math.round(Math.min(255*pixels[i]/alpha,255)),out[i+1]=Math.round(Math.min(255*pixels[i+1]/alpha,255)),out[i+2]=Math.round(Math.min(255*pixels[i+2]/alpha,255))):(out[i]=pixels[i],out[i+1]=pixels[i+1],out[i+2]=pixels[i+2])}},Extract}(),src=(str,opts={})=>{if(!str)return;const o={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?))?((((?:[^?#/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#/]*\.[^?#/.]+(?:[?#]|$)))*\/?)?([^?#/]*))(?:\?([^#]*))?(?:#(.*))?)/}},m=o.parser[opts.strictMode?"strict":"loose"].exec(str),uri={};let i=14;for(;i--;)uri[o.key[i]]=m[i]||"";return uri[o.q.name]={},uri[o.key[12]].replace(o.q.parser,(function($0,$1,$2){$1&&(uri[o.q.name][$1]=$2)})),uri},Signal=function(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}(createCommonjsModule((function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var MiniSignalBinding=function(){function MiniSignalBinding(fn,once,thisArg){void 0===once&&(once=!1),_classCallCheck(this,MiniSignalBinding),this._fn=fn,this._once=once,this._thisArg=thisArg,this._next=this._prev=this._owner=null}return _createClass(MiniSignalBinding,[{key:"detach",value:function(){return null!==this._owner&&(this._owner.detach(this),!0)}}]),MiniSignalBinding}();function _addMiniSignalBinding(self,node){return self._head?(self._tail._next=node,node._prev=self._tail,self._tail=node):(self._head=node,self._tail=node),node._owner=self,node}var MiniSignal=function(){function MiniSignal(){_classCallCheck(this,MiniSignal),this._head=this._tail=void 0}return _createClass(MiniSignal,[{key:"handlers",value:function(){var exists=!(arguments.length<=0||void 0===arguments[0])&&arguments[0],node=this._head;if(exists)return!!node;for(var ee=[];node;)ee.push(node),node=node._next;return ee}},{key:"has",value:function(node){if(!(node instanceof MiniSignalBinding))throw new Error("MiniSignal#has(): First arg must be a MiniSignalBinding object.");return node._owner===this}},{key:"dispatch",value:function(){var node=this._head;if(!node)return!1;for(;node;)node._once&&this.detach(node),node._fn.apply(node._thisArg,arguments),node=node._next;return!0}},{key:"add",value:function(fn){var thisArg=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if("function"!=typeof fn)throw new Error("MiniSignal#add(): First arg must be a Function.");return _addMiniSignalBinding(this,new MiniSignalBinding(fn,!1,thisArg))}},{key:"once",value:function(fn){var thisArg=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if("function"!=typeof fn)throw new Error("MiniSignal#once(): First arg must be a Function.");return _addMiniSignalBinding(this,new MiniSignalBinding(fn,!0,thisArg))}},{key:"detach",value:function(node){if(!(node instanceof MiniSignalBinding))throw new Error("MiniSignal#detach(): First arg must be a MiniSignalBinding object.");return node._owner!==this||(node._prev&&(node._prev._next=node._next),node._next&&(node._next._prev=node._prev),node===this._head?(this._head=node._next,null===node._next&&(this._tail=null)):node===this._tail&&(this._tail=node._prev,this._tail._next=null),node._owner=null),this}},{key:"detachAll",value:function(){var node=this._head;if(!node)return this;for(this._head=this._tail=null;node;)node._owner=null,node=node._next;return this}}]),MiniSignal}();MiniSignal.MiniSignalBinding=MiniSignalBinding,exports.default=MiniSignal,module.exports=exports.default})));
|
|
110
|
+
*/var Application=function(){function Application(options){var _this=this;this.stage=new Container,options=Object.assign({forceCanvas:!1},options),this.renderer=autoDetectRenderer(options),Application._plugins.forEach((function(plugin){plugin.init.call(_this,options)}))}return Application.registerPlugin=function(plugin){Application._plugins.push(plugin)},Application.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(Application.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(Application.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),Application.prototype.destroy=function(removeView,stageOptions){var _this=this,plugins=Application._plugins.slice(0);plugins.reverse(),plugins.forEach((function(plugin){plugin.destroy.call(_this)})),this.stage.destroy(stageOptions),this.stage=null,this.renderer.destroy(removeView),this.renderer=null},Application._plugins=[],Application}(),ResizePlugin=function(){function ResizePlugin(){}return ResizePlugin.init=function(options){var _this=this;Object.defineProperty(this,"resizeTo",{set:function(dom){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=dom,dom&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get:function(){return this._resizeTo}}),this.queueResize=function(){_this._resizeTo&&(_this.cancelResize(),_this._resizeId=requestAnimationFrame((function(){return _this.resize()})))},this.cancelResize=function(){_this._resizeId&&(cancelAnimationFrame(_this._resizeId),_this._resizeId=null)},this.resize=function(){if(_this._resizeTo){var width,height;if(_this.cancelResize(),_this._resizeTo===globalThis.window)width=globalThis.innerWidth,height=globalThis.innerHeight;else{var _a=_this._resizeTo;width=_a.clientWidth,height=_a.clientHeight}_this.renderer.resize(width,height)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=options.resizeTo||null},ResizePlugin.destroy=function(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},ResizePlugin}();Application.registerPlugin(ResizePlugin);
|
|
111
111
|
/*!
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* Compiled Tue, 02 Jul 2019 14:06:18 UTC
|
|
112
|
+
* @pixi/extract - v6.4.2
|
|
113
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
115
114
|
*
|
|
116
|
-
*
|
|
115
|
+
* @pixi/extract is licensed under the MIT License.
|
|
117
116
|
* http://www.opensource.org/licenses/mit-license
|
|
118
117
|
*/
|
|
119
|
-
function _noop(){}function eachSeries(array,iterator,callback,deferNext){var i=0,len=array.length;!function next(err){err||i===len?callback&&callback(err):deferNext?setTimeout((function(){iterator(array[i++],next)}),1):iterator(array[i++],next)}()}function onlyOnce(fn){return function(){if(null===fn)throw new Error("Callback was already called.");var callFn=fn;fn=null,callFn.apply(this,arguments)}}var cache={};function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}var useXdr=!(!window.XDomainRequest||"withCredentials"in new XMLHttpRequest),tempAnchor$1=null;function _noop$1(){}var Resource$1=function(){function Resource(name,url,options){if("string"!=typeof name||"string"!=typeof url)throw new Error("Both name and url are required for constructing a resource.");options=options||{},this._flags=0,this._setFlag(Resource.STATUS_FLAGS.DATA_URL,0===url.indexOf("data:")),this.name=name,this.url=url,this.extension=this._getExtension(),this.data=null,this.crossOrigin=!0===options.crossOrigin?"anonymous":options.crossOrigin,this.timeout=options.timeout||0,this.loadType=options.loadType||this._determineLoadType(),this.xhrType=options.xhrType,this.metadata=options.metadata||{},this.error=null,this.xhr=null,this.children=[],this.type=Resource.TYPE.UNKNOWN,this.progressChunk=0,this._dequeue=_noop$1,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=this.complete.bind(this),this._boundOnError=this._onError.bind(this),this._boundOnProgress=this._onProgress.bind(this),this._boundOnTimeout=this._onTimeout.bind(this),this._boundXhrOnError=this._xhrOnError.bind(this),this._boundXhrOnTimeout=this._xhrOnTimeout.bind(this),this._boundXhrOnAbort=this._xhrOnAbort.bind(this),this._boundXhrOnLoad=this._xhrOnLoad.bind(this),this.onStart=new Signal,this.onProgress=new Signal,this.onComplete=new Signal,this.onAfterMiddleware=new Signal}Resource.setExtensionLoadType=function(extname,loadType){setExtMap(Resource._loadTypeMap,extname,loadType)},Resource.setExtensionXhrType=function(extname,xhrType){setExtMap(Resource._xhrTypeMap,extname,xhrType)};var _proto=Resource.prototype;return _proto.complete=function(){this._clearEvents(),this._finish()},_proto.abort=function(message){if(!this.error){if(this.error=new Error(message),this._clearEvents(),this.xhr)this.xhr.abort();else if(this.xdr)this.xdr.abort();else if(this.data)if(this.data.src)this.data.src=Resource.EMPTY_GIF;else for(;this.data.firstChild;)this.data.removeChild(this.data.firstChild);this._finish()}},_proto.load=function(cb){var _this=this;if(!this.isLoading)if(this.isComplete)cb&&setTimeout((function(){return cb(_this)}),1);else switch(cb&&this.onComplete.once(cb),this._setFlag(Resource.STATUS_FLAGS.LOADING,!0),this.onStart.dispatch(this),!1!==this.crossOrigin&&"string"==typeof this.crossOrigin||(this.crossOrigin=this._determineCrossOrigin(this.url)),this.loadType){case Resource.LOAD_TYPE.IMAGE:this.type=Resource.TYPE.IMAGE,this._loadElement("image");break;case Resource.LOAD_TYPE.AUDIO:this.type=Resource.TYPE.AUDIO,this._loadSourceElement("audio");break;case Resource.LOAD_TYPE.VIDEO:this.type=Resource.TYPE.VIDEO,this._loadSourceElement("video");break;case Resource.LOAD_TYPE.XHR:default:useXdr&&this.crossOrigin?this._loadXdr():this._loadXhr()}},_proto._hasFlag=function(flag){return 0!=(this._flags&flag)},_proto._setFlag=function(flag,value){this._flags=value?this._flags|flag:this._flags&~flag},_proto._clearEvents=function(){clearTimeout(this._elementTimer),this.data&&this.data.removeEventListener&&(this.data.removeEventListener("error",this._boundOnError,!1),this.data.removeEventListener("load",this._boundComplete,!1),this.data.removeEventListener("progress",this._boundOnProgress,!1),this.data.removeEventListener("canplaythrough",this._boundComplete,!1)),this.xhr&&(this.xhr.removeEventListener?(this.xhr.removeEventListener("error",this._boundXhrOnError,!1),this.xhr.removeEventListener("timeout",this._boundXhrOnTimeout,!1),this.xhr.removeEventListener("abort",this._boundXhrOnAbort,!1),this.xhr.removeEventListener("progress",this._boundOnProgress,!1),this.xhr.removeEventListener("load",this._boundXhrOnLoad,!1)):(this.xhr.onerror=null,this.xhr.ontimeout=null,this.xhr.onprogress=null,this.xhr.onload=null))},_proto._finish=function(){if(this.isComplete)throw new Error("Complete called again for an already completed resource.");this._setFlag(Resource.STATUS_FLAGS.COMPLETE,!0),this._setFlag(Resource.STATUS_FLAGS.LOADING,!1),this.onComplete.dispatch(this)},_proto._loadElement=function(type){this.metadata.loadElement?this.data=this.metadata.loadElement:"image"===type&&void 0!==window.Image?this.data=new Image:this.data=document.createElement(type),this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),this.metadata.skipSource||(this.data.src=this.url),this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))},_proto._loadSourceElement=function(type){if(this.metadata.loadElement?this.data=this.metadata.loadElement:"audio"===type&&void 0!==window.Audio?this.data=new Audio:this.data=document.createElement(type),null!==this.data){if(this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),!this.metadata.skipSource)if(navigator.isCocoonJS)this.data.src=Array.isArray(this.url)?this.url[0]:this.url;else if(Array.isArray(this.url))for(var mimeTypes=this.metadata.mimeType,i=0;i<this.url.length;++i)this.data.appendChild(this._createSource(type,this.url[i],Array.isArray(mimeTypes)?mimeTypes[i]:mimeTypes));else{var _mimeTypes=this.metadata.mimeType;this.data.appendChild(this._createSource(type,this.url,Array.isArray(_mimeTypes)?_mimeTypes[0]:_mimeTypes))}this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.data.addEventListener("canplaythrough",this._boundComplete,!1),this.data.load(),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))}else this.abort("Unsupported element: "+type)},_proto._loadXhr=function(){"string"!=typeof this.xhrType&&(this.xhrType=this._determineXhrType());var xhr=this.xhr=new XMLHttpRequest;xhr.open("GET",this.url,!0),xhr.timeout=this.timeout,this.xhrType===Resource.XHR_RESPONSE_TYPE.JSON||this.xhrType===Resource.XHR_RESPONSE_TYPE.DOCUMENT?xhr.responseType=Resource.XHR_RESPONSE_TYPE.TEXT:xhr.responseType=this.xhrType,xhr.addEventListener("error",this._boundXhrOnError,!1),xhr.addEventListener("timeout",this._boundXhrOnTimeout,!1),xhr.addEventListener("abort",this._boundXhrOnAbort,!1),xhr.addEventListener("progress",this._boundOnProgress,!1),xhr.addEventListener("load",this._boundXhrOnLoad,!1),xhr.send()},_proto._loadXdr=function(){"string"!=typeof this.xhrType&&(this.xhrType=this._determineXhrType());var xdr=this.xhr=new XDomainRequest;xdr.timeout=this.timeout||5e3,xdr.onerror=this._boundXhrOnError,xdr.ontimeout=this._boundXhrOnTimeout,xdr.onprogress=this._boundOnProgress,xdr.onload=this._boundXhrOnLoad,xdr.open("GET",this.url,!0),setTimeout((function(){return xdr.send()}),1)},_proto._createSource=function(type,url,mime){mime||(mime=type+"/"+this._getExtension(url));var source=document.createElement("source");return source.src=url,source.type=mime,source},_proto._onError=function(event){this.abort("Failed to load element using: "+event.target.nodeName)},_proto._onProgress=function(event){event&&event.lengthComputable&&this.onProgress.dispatch(this,event.loaded/event.total)},_proto._onTimeout=function(){this.abort("Load timed out.")},_proto._xhrOnError=function(){var xhr=this.xhr;this.abort(reqType(xhr)+" Request failed. Status: "+xhr.status+', text: "'+xhr.statusText+'"')},_proto._xhrOnTimeout=function(){var xhr=this.xhr;this.abort(reqType(xhr)+" Request timed out.")},_proto._xhrOnAbort=function(){var xhr=this.xhr;this.abort(reqType(xhr)+" Request was aborted by the user.")},_proto._xhrOnLoad=function(){var xhr=this.xhr,text="",status=void 0===xhr.status?200:xhr.status;if(""!==xhr.responseType&&"text"!==xhr.responseType&&void 0!==xhr.responseType||(text=xhr.responseText),0===status&&(text.length>0||xhr.responseType===Resource.XHR_RESPONSE_TYPE.BUFFER)?status=200:1223===status&&(status=204),2===(status/100|0)){if(this.xhrType===Resource.XHR_RESPONSE_TYPE.TEXT)this.data=text,this.type=Resource.TYPE.TEXT;else if(this.xhrType===Resource.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(text),this.type=Resource.TYPE.JSON}catch(e){return void this.abort("Error trying to parse loaded json: "+e)}else if(this.xhrType===Resource.XHR_RESPONSE_TYPE.DOCUMENT)try{if(window.DOMParser){var domparser=new DOMParser;this.data=domparser.parseFromString(text,"text/xml")}else{var div=document.createElement("div");div.innerHTML=text,this.data=div}this.type=Resource.TYPE.XML}catch(e){return void this.abort("Error trying to parse loaded xml: "+e)}else this.data=xhr.response||text;this.complete()}else this.abort("["+xhr.status+"] "+xhr.statusText+": "+xhr.responseURL)},_proto._determineCrossOrigin=function(url,loc){if(0===url.indexOf("data:"))return"";if(window.origin!==window.location.origin)return"anonymous";loc=loc||window.location,tempAnchor$1||(tempAnchor$1=document.createElement("a")),tempAnchor$1.href=url;var samePort=!(url=src(tempAnchor$1.href,{strictMode:!0})).port&&""===loc.port||url.port===loc.port,protocol=url.protocol?url.protocol+":":"";return url.host===loc.hostname&&samePort&&protocol===loc.protocol?"":"anonymous"},_proto._determineXhrType=function(){return Resource._xhrTypeMap[this.extension]||Resource.XHR_RESPONSE_TYPE.TEXT},_proto._determineLoadType=function(){return Resource._loadTypeMap[this.extension]||Resource.LOAD_TYPE.XHR},_proto._getExtension=function(){var url=this.url,ext="";if(this.isDataUrl){var slashIndex=url.indexOf("/");ext=url.substring(slashIndex+1,url.indexOf(";",slashIndex))}else{var queryStart=url.indexOf("?"),hashStart=url.indexOf("#"),index=Math.min(queryStart>-1?queryStart:url.length,hashStart>-1?hashStart:url.length);ext=(url=url.substring(0,index)).substring(url.lastIndexOf(".")+1)}return ext.toLowerCase()},_proto._getMimeFromXhrType=function(type){switch(type){case Resource.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case Resource.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case Resource.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case Resource.XHR_RESPONSE_TYPE.JSON:return"application/json";case Resource.XHR_RESPONSE_TYPE.DEFAULT:case Resource.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},_createClass(Resource,[{key:"isDataUrl",get:function(){return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL)}},{key:"isComplete",get:function(){return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE)}},{key:"isLoading",get:function(){return this._hasFlag(Resource.STATUS_FLAGS.LOADING)}}]),Resource}();function setExtMap(map,extname,val){extname&&0===extname.indexOf(".")&&(extname=extname.substring(1)),extname&&(map[extname]=val)}function reqType(xhr){return xhr.toString().replace("object ","")}Resource$1.STATUS_FLAGS={NONE:0,DATA_URL:1,COMPLETE:2,LOADING:4},Resource$1.TYPE={UNKNOWN:0,JSON:1,XML:2,IMAGE:3,AUDIO:4,VIDEO:5,TEXT:6},Resource$1.LOAD_TYPE={XHR:1,IMAGE:2,AUDIO:3,VIDEO:4},Resource$1.XHR_RESPONSE_TYPE={DEFAULT:"text",BUFFER:"arraybuffer",BLOB:"blob",DOCUMENT:"document",JSON:"json",TEXT:"text"},Resource$1._loadTypeMap={gif:Resource$1.LOAD_TYPE.IMAGE,png:Resource$1.LOAD_TYPE.IMAGE,bmp:Resource$1.LOAD_TYPE.IMAGE,jpg:Resource$1.LOAD_TYPE.IMAGE,jpeg:Resource$1.LOAD_TYPE.IMAGE,tif:Resource$1.LOAD_TYPE.IMAGE,tiff:Resource$1.LOAD_TYPE.IMAGE,webp:Resource$1.LOAD_TYPE.IMAGE,tga:Resource$1.LOAD_TYPE.IMAGE,svg:Resource$1.LOAD_TYPE.IMAGE,"svg+xml":Resource$1.LOAD_TYPE.IMAGE,mp3:Resource$1.LOAD_TYPE.AUDIO,ogg:Resource$1.LOAD_TYPE.AUDIO,wav:Resource$1.LOAD_TYPE.AUDIO,mp4:Resource$1.LOAD_TYPE.VIDEO,webm:Resource$1.LOAD_TYPE.VIDEO},Resource$1._xhrTypeMap={xhtml:Resource$1.XHR_RESPONSE_TYPE.DOCUMENT,html:Resource$1.XHR_RESPONSE_TYPE.DOCUMENT,htm:Resource$1.XHR_RESPONSE_TYPE.DOCUMENT,xml:Resource$1.XHR_RESPONSE_TYPE.DOCUMENT,tmx:Resource$1.XHR_RESPONSE_TYPE.DOCUMENT,svg:Resource$1.XHR_RESPONSE_TYPE.DOCUMENT,tsx:Resource$1.XHR_RESPONSE_TYPE.DOCUMENT,gif:Resource$1.XHR_RESPONSE_TYPE.BLOB,png:Resource$1.XHR_RESPONSE_TYPE.BLOB,bmp:Resource$1.XHR_RESPONSE_TYPE.BLOB,jpg:Resource$1.XHR_RESPONSE_TYPE.BLOB,jpeg:Resource$1.XHR_RESPONSE_TYPE.BLOB,tif:Resource$1.XHR_RESPONSE_TYPE.BLOB,tiff:Resource$1.XHR_RESPONSE_TYPE.BLOB,webp:Resource$1.XHR_RESPONSE_TYPE.BLOB,tga:Resource$1.XHR_RESPONSE_TYPE.BLOB,json:Resource$1.XHR_RESPONSE_TYPE.JSON,text:Resource$1.XHR_RESPONSE_TYPE.TEXT,txt:Resource$1.XHR_RESPONSE_TYPE.TEXT,ttf:Resource$1.XHR_RESPONSE_TYPE.BUFFER,otf:Resource$1.XHR_RESPONSE_TYPE.BUFFER},Resource$1.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";var Url=window.URL||window.webkitURL;var index={caching:function(resource,next){var _this=this;cache[resource.url]?(resource.data=cache[resource.url],resource.complete()):resource.onComplete.once((function(){return cache[_this.url]=_this.data})),next()},parsing:function(resource,next){if(resource.data){if(resource.xhr&&resource.xhrType===Resource$1.XHR_RESPONSE_TYPE.BLOB)if(window.Blob&&"string"!=typeof resource.data){if(0===resource.data.type.indexOf("image")){var src=Url.createObjectURL(resource.data);return resource.blob=resource.data,resource.data=new Image,resource.data.src=src,resource.type=Resource$1.TYPE.IMAGE,void(resource.data.onload=function(){Url.revokeObjectURL(src),resource.data.onload=null,next()})}}else{var type=resource.xhr.getResponseHeader("content-type");if(type&&0===type.indexOf("image"))return resource.data=new Image,resource.data.src="data:"+type+";base64,"+function(input){for(var output="",inx=0;inx<input.length;){for(var bytebuffer=[0,0,0],encodedCharIndexes=[0,0,0,0],jnx=0;jnx<bytebuffer.length;++jnx)inx<input.length?bytebuffer[jnx]=255&input.charCodeAt(inx++):bytebuffer[jnx]=0;switch(encodedCharIndexes[0]=bytebuffer[0]>>2,encodedCharIndexes[1]=(3&bytebuffer[0])<<4|bytebuffer[1]>>4,encodedCharIndexes[2]=(15&bytebuffer[1])<<2|bytebuffer[2]>>6,encodedCharIndexes[3]=63&bytebuffer[2],inx-(input.length-1)){case 2:encodedCharIndexes[3]=64,encodedCharIndexes[2]=64;break;case 1:encodedCharIndexes[3]=64}for(var _jnx=0;_jnx<encodedCharIndexes.length;++_jnx)output+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(encodedCharIndexes[_jnx])}return output}(resource.xhr.responseText),resource.type=Resource$1.TYPE.IMAGE,void(resource.data.onload=function(){resource.data.onload=null,next()})}next()}else next()}},rgxExtractUrlHash=/(#[\w-]+)?$/,Loader=function(){function Loader(baseUrl,concurrency){var _this=this;void 0===baseUrl&&(baseUrl=""),void 0===concurrency&&(concurrency=10),this.baseUrl=baseUrl,this.progress=0,this.loading=!1,this.defaultQueryString="",this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(r,d){return _this._loadResource(r,d)},this._queue=function(worker,concurrency){if(null==concurrency)concurrency=1;else if(0===concurrency)throw new Error("Concurrency must not be zero");var workers=0,q={_tasks:[],concurrency:concurrency,saturated:_noop,unsaturated:_noop,buffer:concurrency/4,empty:_noop,drain:_noop,error:_noop,started:!1,paused:!1,push:function(data,callback){_insert(data,!1,callback)},kill:function(){workers=0,q.drain=_noop,q.started=!1,q._tasks=[]},unshift:function(data,callback){_insert(data,!0,callback)},process:function(){for(;!q.paused&&workers<q.concurrency&&q._tasks.length;){var task=q._tasks.shift();0===q._tasks.length&&q.empty(),(workers+=1)===q.concurrency&&q.saturated(),worker(task.data,onlyOnce(_next(task)))}},length:function(){return q._tasks.length},running:function(){return workers},idle:function(){return q._tasks.length+workers===0},pause:function(){!0!==q.paused&&(q.paused=!0)},resume:function(){if(!1!==q.paused){q.paused=!1;for(var w=1;w<=q.concurrency;w++)q.process()}}};function _insert(data,insertAtFront,callback){if(null!=callback&&"function"!=typeof callback)throw new Error("task callback must be a function");if(q.started=!0,null==data&&q.idle())setTimeout((function(){return q.drain()}),1);else{var item={data:data,callback:"function"==typeof callback?callback:_noop};insertAtFront?q._tasks.unshift(item):q._tasks.push(item),setTimeout((function(){return q.process()}),1)}}function _next(task){return function(){workers-=1,task.callback.apply(task,arguments),null!=arguments[0]&&q.error(arguments[0],task.data),workers<=q.concurrency-q.buffer&&q.unsaturated(),q.idle()&&q.drain(),q.process()}}return q}(this._boundLoadResource,concurrency),this._queue.pause(),this.resources={},this.onProgress=new Signal,this.onError=new Signal,this.onLoad=new Signal,this.onStart=new Signal,this.onComplete=new Signal;for(var i=0;i<Loader._defaultBeforeMiddleware.length;++i)this.pre(Loader._defaultBeforeMiddleware[i]);for(var _i=0;_i<Loader._defaultAfterMiddleware.length;++_i)this.use(Loader._defaultAfterMiddleware[_i])}var _proto=Loader.prototype;return _proto.add=function(name,url,options,cb){if(Array.isArray(name)){for(var i=0;i<name.length;++i)this.add(name[i]);return this}if("object"==typeof name&&(cb=url||name.callback||name.onComplete,options=name,url=name.url,name=name.name||name.key||name.url),"string"!=typeof url&&(cb=options,options=url,url=name),"string"!=typeof url)throw new Error("No url passed to add resource to loader.");if("function"==typeof options&&(cb=options,options=null),this.loading&&(!options||!options.parentResource))throw new Error("Cannot add resources while the loader is running.");if(this.resources[name])throw new Error('Resource named "'+name+'" already exists.');if(url=this._prepareUrl(url),this.resources[name]=new Resource$1(name,url,options),"function"==typeof cb&&this.resources[name].onAfterMiddleware.once(cb),this.loading){for(var parent=options.parentResource,incompleteChildren=[],_i2=0;_i2<parent.children.length;++_i2)parent.children[_i2].isComplete||incompleteChildren.push(parent.children[_i2]);var eachChunk=parent.progressChunk*(incompleteChildren.length+1)/(incompleteChildren.length+2);parent.children.push(this.resources[name]),parent.progressChunk=eachChunk;for(var _i3=0;_i3<incompleteChildren.length;++_i3)incompleteChildren[_i3].progressChunk=eachChunk;this.resources[name].progressChunk=eachChunk}return this._queue.push(this.resources[name]),this},_proto.pre=function(fn){return this._beforeMiddleware.push(fn),this},_proto.use=function(fn){return this._afterMiddleware.push(fn),this},_proto.reset=function(){for(var k in this.progress=0,this.loading=!1,this._queue.kill(),this._queue.pause(),this.resources){var res=this.resources[k];res._onLoadBinding&&res._onLoadBinding.detach(),res.isLoading&&res.abort()}return this.resources={},this},_proto.load=function(cb){if("function"==typeof cb&&this.onComplete.once(cb),this.loading)return this;if(this._queue.idle())this._onStart(),this._onComplete();else{for(var chunk=100/this._queue._tasks.length,i=0;i<this._queue._tasks.length;++i)this._queue._tasks[i].data.progressChunk=chunk;this._onStart(),this._queue.resume()}return this},_proto._prepareUrl=function(url){var result,parsedUrl=src(url,{strictMode:!0});if(result=parsedUrl.protocol||!parsedUrl.path||0===url.indexOf("//")?url:this.baseUrl.length&&this.baseUrl.lastIndexOf("/")!==this.baseUrl.length-1&&"/"!==url.charAt(0)?this.baseUrl+"/"+url:this.baseUrl+url,this.defaultQueryString){var hash=rgxExtractUrlHash.exec(result)[0];-1!==(result=result.substr(0,result.length-hash.length)).indexOf("?")?result+="&"+this.defaultQueryString:result+="?"+this.defaultQueryString,result+=hash}return result},_proto._loadResource=function(resource,dequeue){var _this2=this;resource._dequeue=dequeue,eachSeries(this._beforeMiddleware,(function(fn,next){fn.call(_this2,resource,(function(){next(resource.isComplete?{}:null)}))}),(function(){resource.isComplete?_this2._onLoad(resource):(resource._onLoadBinding=resource.onComplete.once(_this2._onLoad,_this2),resource.load())}),!0)},_proto._onStart=function(){this.progress=0,this.loading=!0,this.onStart.dispatch(this)},_proto._onComplete=function(){this.progress=100,this.loading=!1,this.onComplete.dispatch(this,this.resources)},_proto._onLoad=function(resource){var _this3=this;resource._onLoadBinding=null,this._resourcesParsing.push(resource),resource._dequeue(),eachSeries(this._afterMiddleware,(function(fn,next){fn.call(_this3,resource,next)}),(function(){resource.onAfterMiddleware.dispatch(resource),_this3.progress=Math.min(100,_this3.progress+resource.progressChunk),_this3.onProgress.dispatch(_this3,resource),resource.error?_this3.onError.dispatch(resource.error,_this3,resource):_this3.onLoad.dispatch(_this3,resource),_this3._resourcesParsing.splice(_this3._resourcesParsing.indexOf(resource),1),_this3._queue.idle()&&0===_this3._resourcesParsing.length&&_this3._onComplete()}),!0)},_createClass(Loader,[{key:"concurrency",get:function(){return this._queue.concurrency},set:function(concurrency){this._queue.concurrency=concurrency}}]),Loader}();Loader._defaultBeforeMiddleware=[],Loader._defaultAfterMiddleware=[],Loader.pre=function(fn){return Loader._defaultBeforeMiddleware.push(fn),Loader},Loader.use=function(fn){return Loader._defaultAfterMiddleware.push(fn),Loader};
|
|
118
|
+
var appleIphone$1=/iPhone/i,appleIpod$1=/iPod/i,appleTablet$1=/iPad/i,appleUniversal$1=/\biOS-universal(?:.+)Mac\b/i,androidPhone$1=/\bAndroid(?:.+)Mobile\b/i,androidTablet$1=/Android/i,amazonPhone$1=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,amazonTablet$1=/Silk/i,windowsPhone$1=/Windows Phone/i,windowsTablet$1=/\bWindows(?:.+)ARM\b/i,otherBlackBerry$1=/BlackBerry/i,otherBlackBerry10$1=/BB10/i,otherOpera$1=/Opera Mini/i,otherChrome$1=/\b(CriOS|Chrome)(?:.+)Mobile/i,otherFirefox$1=/Mobile(?:.+)Firefox\b/i,isAppleTabletOnIos13$1=function(navigator){return void 0!==navigator&&"MacIntel"===navigator.platform&&"number"==typeof navigator.maxTouchPoints&&navigator.maxTouchPoints>1&&"undefined"==typeof MSStream};
|
|
120
119
|
/*!
|
|
121
|
-
* @pixi/
|
|
122
|
-
* Compiled
|
|
120
|
+
* @pixi/settings - v6.4.2
|
|
121
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
123
122
|
*
|
|
124
|
-
* @pixi/
|
|
123
|
+
* @pixi/settings is licensed under the MIT License.
|
|
125
124
|
* http://www.opensource.org/licenses/mit-license
|
|
126
125
|
*/
|
|
127
|
-
var LoaderResource=Resource$1,extendStatics$4=function(d,b){return(extendStatics$4=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};
|
|
128
|
-
/*! *****************************************************************************
|
|
129
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
130
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
131
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
132
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
133
|
-
|
|
134
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
135
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
136
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
137
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
138
|
-
|
|
139
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
140
|
-
and limitations under the License.
|
|
141
|
-
***************************************************************************** */var TextureLoader=function(){function TextureLoader(){}return TextureLoader.use=function(resource,next){resource.data&&resource.type===Resource$1.TYPE.IMAGE&&(resource.texture=Texture.fromLoader(resource.data,resource.url,resource.name)),next()},TextureLoader}(),Loader$1=function(_super){function Loader(baseUrl,concurrency){for(var _this=_super.call(this,baseUrl,concurrency)||this,i=0;i<Loader._plugins.length;++i){var plugin=Loader._plugins[i],pre=plugin.pre,use=plugin.use;pre&&_this.pre(pre),use&&_this.use(use)}return _this._protected=!1,_this}return function(d,b){function __(){this.constructor=d}extendStatics$4(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(Loader,_super),Loader.prototype.destroy=function(){this._protected||this.reset()},Object.defineProperty(Loader,"shared",{get:function(){var shared=Loader._shared;return shared||((shared=new Loader)._protected=!0,Loader._shared=shared),shared},enumerable:!1,configurable:!0}),Loader.registerPlugin=function(plugin){return Loader._plugins.push(plugin),plugin.add&&plugin.add(),Loader},Loader._plugins=[],Loader}(Loader);Loader$1.registerPlugin({use:index.parsing}),Loader$1.registerPlugin(TextureLoader);var AppLoaderPlugin=function(){function AppLoaderPlugin(){}return AppLoaderPlugin.init=function(options){options=Object.assign({sharedLoader:!1},options),this.loader=options.sharedLoader?Loader$1.shared:new Loader$1},AppLoaderPlugin.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},AppLoaderPlugin}(),extendStatics$5=function(d,b){return(extendStatics$5=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};
|
|
126
|
+
var ENV$1$1,RENDERER_TYPE$1$1,BUFFER_BITS$1$1,BLEND_MODES$1$1,DRAW_MODES$1$1,FORMATS$1$1,TARGETS$1$1,TYPES$1$1,SAMPLER_TYPES$1$1,SCALE_MODES$1$1,WRAP_MODES$1$1,MIPMAP_MODES$1$1,ALPHA_MODES$1$1,CLEAR_MODES$1$1,GC_MODES$1$1,PRECISION$1$1,MASK_TYPES$1$1,MSAA_QUALITY$1$1,BUFFER_TYPE$1$1,isMobile$2=function(param){var nav={userAgent:"",platform:"",maxTouchPoints:0};param||"undefined"==typeof navigator?"string"==typeof param?nav.userAgent=param:param&¶m.userAgent&&(nav={userAgent:param.userAgent,platform:param.platform,maxTouchPoints:param.maxTouchPoints||0}):nav={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var userAgent=nav.userAgent,tmp=userAgent.split("[FBAN");void 0!==tmp[1]&&(userAgent=tmp[0]),void 0!==(tmp=userAgent.split("Twitter"))[1]&&(userAgent=tmp[0]);var match=function(userAgent){return function(regex){return regex.test(userAgent)}}(userAgent),result={apple:{phone:match(appleIphone$1)&&!match(windowsPhone$1),ipod:match(appleIpod$1),tablet:!match(appleIphone$1)&&(match(appleTablet$1)||isAppleTabletOnIos13$1(nav))&&!match(windowsPhone$1),universal:match(appleUniversal$1),device:(match(appleIphone$1)||match(appleIpod$1)||match(appleTablet$1)||match(appleUniversal$1)||isAppleTabletOnIos13$1(nav))&&!match(windowsPhone$1)},amazon:{phone:match(amazonPhone$1),tablet:!match(amazonPhone$1)&&match(amazonTablet$1),device:match(amazonPhone$1)||match(amazonTablet$1)},android:{phone:!match(windowsPhone$1)&&match(amazonPhone$1)||!match(windowsPhone$1)&&match(androidPhone$1),tablet:!match(windowsPhone$1)&&!match(amazonPhone$1)&&!match(androidPhone$1)&&(match(amazonTablet$1)||match(androidTablet$1)),device:!match(windowsPhone$1)&&(match(amazonPhone$1)||match(amazonTablet$1)||match(androidPhone$1)||match(androidTablet$1))||match(/\bokhttp\b/i)},windows:{phone:match(windowsPhone$1),tablet:match(windowsTablet$1),device:match(windowsPhone$1)||match(windowsTablet$1)},other:{blackberry:match(otherBlackBerry$1),blackberry10:match(otherBlackBerry10$1),opera:match(otherOpera$1),firefox:match(otherFirefox$1),chrome:match(otherChrome$1),device:match(otherBlackBerry$1)||match(otherBlackBerry10$1)||match(otherOpera$1)||match(otherFirefox$1)||match(otherChrome$1)},any:!1,phone:!1,tablet:!1};return result.any=result.apple.device||result.android.device||result.windows.device||result.other.device,result.phone=result.apple.phone||result.android.phone||result.windows.phone,result.tablet=result.apple.tablet||result.android.tablet||result.windows.tablet,result}(globalThis.navigator);!function(ENV){ENV[ENV.WEBGL_LEGACY=0]="WEBGL_LEGACY",ENV[ENV.WEBGL=1]="WEBGL",ENV[ENV.WEBGL2=2]="WEBGL2"}(ENV$1$1||(ENV$1$1={})),function(RENDERER_TYPE){RENDERER_TYPE[RENDERER_TYPE.UNKNOWN=0]="UNKNOWN",RENDERER_TYPE[RENDERER_TYPE.WEBGL=1]="WEBGL",RENDERER_TYPE[RENDERER_TYPE.CANVAS=2]="CANVAS"}(RENDERER_TYPE$1$1||(RENDERER_TYPE$1$1={})),function(BUFFER_BITS){BUFFER_BITS[BUFFER_BITS.COLOR=16384]="COLOR",BUFFER_BITS[BUFFER_BITS.DEPTH=256]="DEPTH",BUFFER_BITS[BUFFER_BITS.STENCIL=1024]="STENCIL"}(BUFFER_BITS$1$1||(BUFFER_BITS$1$1={})),function(BLEND_MODES){BLEND_MODES[BLEND_MODES.NORMAL=0]="NORMAL",BLEND_MODES[BLEND_MODES.ADD=1]="ADD",BLEND_MODES[BLEND_MODES.MULTIPLY=2]="MULTIPLY",BLEND_MODES[BLEND_MODES.SCREEN=3]="SCREEN",BLEND_MODES[BLEND_MODES.OVERLAY=4]="OVERLAY",BLEND_MODES[BLEND_MODES.DARKEN=5]="DARKEN",BLEND_MODES[BLEND_MODES.LIGHTEN=6]="LIGHTEN",BLEND_MODES[BLEND_MODES.COLOR_DODGE=7]="COLOR_DODGE",BLEND_MODES[BLEND_MODES.COLOR_BURN=8]="COLOR_BURN",BLEND_MODES[BLEND_MODES.HARD_LIGHT=9]="HARD_LIGHT",BLEND_MODES[BLEND_MODES.SOFT_LIGHT=10]="SOFT_LIGHT",BLEND_MODES[BLEND_MODES.DIFFERENCE=11]="DIFFERENCE",BLEND_MODES[BLEND_MODES.EXCLUSION=12]="EXCLUSION",BLEND_MODES[BLEND_MODES.HUE=13]="HUE",BLEND_MODES[BLEND_MODES.SATURATION=14]="SATURATION",BLEND_MODES[BLEND_MODES.COLOR=15]="COLOR",BLEND_MODES[BLEND_MODES.LUMINOSITY=16]="LUMINOSITY",BLEND_MODES[BLEND_MODES.NORMAL_NPM=17]="NORMAL_NPM",BLEND_MODES[BLEND_MODES.ADD_NPM=18]="ADD_NPM",BLEND_MODES[BLEND_MODES.SCREEN_NPM=19]="SCREEN_NPM",BLEND_MODES[BLEND_MODES.NONE=20]="NONE",BLEND_MODES[BLEND_MODES.SRC_OVER=0]="SRC_OVER",BLEND_MODES[BLEND_MODES.SRC_IN=21]="SRC_IN",BLEND_MODES[BLEND_MODES.SRC_OUT=22]="SRC_OUT",BLEND_MODES[BLEND_MODES.SRC_ATOP=23]="SRC_ATOP",BLEND_MODES[BLEND_MODES.DST_OVER=24]="DST_OVER",BLEND_MODES[BLEND_MODES.DST_IN=25]="DST_IN",BLEND_MODES[BLEND_MODES.DST_OUT=26]="DST_OUT",BLEND_MODES[BLEND_MODES.DST_ATOP=27]="DST_ATOP",BLEND_MODES[BLEND_MODES.ERASE=26]="ERASE",BLEND_MODES[BLEND_MODES.SUBTRACT=28]="SUBTRACT",BLEND_MODES[BLEND_MODES.XOR=29]="XOR"}(BLEND_MODES$1$1||(BLEND_MODES$1$1={})),function(DRAW_MODES){DRAW_MODES[DRAW_MODES.POINTS=0]="POINTS",DRAW_MODES[DRAW_MODES.LINES=1]="LINES",DRAW_MODES[DRAW_MODES.LINE_LOOP=2]="LINE_LOOP",DRAW_MODES[DRAW_MODES.LINE_STRIP=3]="LINE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLES=4]="TRIANGLES",DRAW_MODES[DRAW_MODES.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(DRAW_MODES$1$1||(DRAW_MODES$1$1={})),function(FORMATS){FORMATS[FORMATS.RGBA=6408]="RGBA",FORMATS[FORMATS.RGB=6407]="RGB",FORMATS[FORMATS.RG=33319]="RG",FORMATS[FORMATS.RED=6403]="RED",FORMATS[FORMATS.RGBA_INTEGER=36249]="RGBA_INTEGER",FORMATS[FORMATS.RGB_INTEGER=36248]="RGB_INTEGER",FORMATS[FORMATS.RG_INTEGER=33320]="RG_INTEGER",FORMATS[FORMATS.RED_INTEGER=36244]="RED_INTEGER",FORMATS[FORMATS.ALPHA=6406]="ALPHA",FORMATS[FORMATS.LUMINANCE=6409]="LUMINANCE",FORMATS[FORMATS.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",FORMATS[FORMATS.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",FORMATS[FORMATS.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(FORMATS$1$1||(FORMATS$1$1={})),function(TARGETS){TARGETS[TARGETS.TEXTURE_2D=3553]="TEXTURE_2D",TARGETS[TARGETS.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",TARGETS[TARGETS.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(TARGETS$1$1||(TARGETS$1$1={})),function(TYPES){TYPES[TYPES.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",TYPES[TYPES.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",TYPES[TYPES.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",TYPES[TYPES.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",TYPES[TYPES.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",TYPES[TYPES.UNSIGNED_INT=5125]="UNSIGNED_INT",TYPES[TYPES.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",TYPES[TYPES.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",TYPES[TYPES.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",TYPES[TYPES.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",TYPES[TYPES.BYTE=5120]="BYTE",TYPES[TYPES.SHORT=5122]="SHORT",TYPES[TYPES.INT=5124]="INT",TYPES[TYPES.FLOAT=5126]="FLOAT",TYPES[TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",TYPES[TYPES.HALF_FLOAT=36193]="HALF_FLOAT"}(TYPES$1$1||(TYPES$1$1={})),function(SAMPLER_TYPES){SAMPLER_TYPES[SAMPLER_TYPES.FLOAT=0]="FLOAT",SAMPLER_TYPES[SAMPLER_TYPES.INT=1]="INT",SAMPLER_TYPES[SAMPLER_TYPES.UINT=2]="UINT"}(SAMPLER_TYPES$1$1||(SAMPLER_TYPES$1$1={})),function(SCALE_MODES){SCALE_MODES[SCALE_MODES.NEAREST=0]="NEAREST",SCALE_MODES[SCALE_MODES.LINEAR=1]="LINEAR"}(SCALE_MODES$1$1||(SCALE_MODES$1$1={})),function(WRAP_MODES){WRAP_MODES[WRAP_MODES.CLAMP=33071]="CLAMP",WRAP_MODES[WRAP_MODES.REPEAT=10497]="REPEAT",WRAP_MODES[WRAP_MODES.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(WRAP_MODES$1$1||(WRAP_MODES$1$1={})),function(MIPMAP_MODES){MIPMAP_MODES[MIPMAP_MODES.OFF=0]="OFF",MIPMAP_MODES[MIPMAP_MODES.POW2=1]="POW2",MIPMAP_MODES[MIPMAP_MODES.ON=2]="ON",MIPMAP_MODES[MIPMAP_MODES.ON_MANUAL=3]="ON_MANUAL"}(MIPMAP_MODES$1$1||(MIPMAP_MODES$1$1={})),function(ALPHA_MODES){ALPHA_MODES[ALPHA_MODES.NPM=0]="NPM",ALPHA_MODES[ALPHA_MODES.UNPACK=1]="UNPACK",ALPHA_MODES[ALPHA_MODES.PMA=2]="PMA",ALPHA_MODES[ALPHA_MODES.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"}(ALPHA_MODES$1$1||(ALPHA_MODES$1$1={})),function(CLEAR_MODES){CLEAR_MODES[CLEAR_MODES.NO=0]="NO",CLEAR_MODES[CLEAR_MODES.YES=1]="YES",CLEAR_MODES[CLEAR_MODES.AUTO=2]="AUTO",CLEAR_MODES[CLEAR_MODES.BLEND=0]="BLEND",CLEAR_MODES[CLEAR_MODES.CLEAR=1]="CLEAR",CLEAR_MODES[CLEAR_MODES.BLIT=2]="BLIT"}(CLEAR_MODES$1$1||(CLEAR_MODES$1$1={})),function(GC_MODES){GC_MODES[GC_MODES.AUTO=0]="AUTO",GC_MODES[GC_MODES.MANUAL=1]="MANUAL"}(GC_MODES$1$1||(GC_MODES$1$1={})),function(PRECISION){PRECISION.LOW="lowp",PRECISION.MEDIUM="mediump",PRECISION.HIGH="highp"}(PRECISION$1$1||(PRECISION$1$1={})),function(MASK_TYPES){MASK_TYPES[MASK_TYPES.NONE=0]="NONE",MASK_TYPES[MASK_TYPES.SCISSOR=1]="SCISSOR",MASK_TYPES[MASK_TYPES.STENCIL=2]="STENCIL",MASK_TYPES[MASK_TYPES.SPRITE=3]="SPRITE"}(MASK_TYPES$1$1||(MASK_TYPES$1$1={})),function(MSAA_QUALITY){MSAA_QUALITY[MSAA_QUALITY.NONE=0]="NONE",MSAA_QUALITY[MSAA_QUALITY.LOW=2]="LOW",MSAA_QUALITY[MSAA_QUALITY.MEDIUM=4]="MEDIUM",MSAA_QUALITY[MSAA_QUALITY.HIGH=8]="HIGH"}(MSAA_QUALITY$1$1||(MSAA_QUALITY$1$1={})),function(BUFFER_TYPE){BUFFER_TYPE[BUFFER_TYPE.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",BUFFER_TYPE[BUFFER_TYPE.ARRAY_BUFFER=34962]="ARRAY_BUFFER",BUFFER_TYPE[BUFFER_TYPE.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"}(BUFFER_TYPE$1$1||(BUFFER_TYPE$1$1={}));var settings$1={MIPMAP_TEXTURES:MIPMAP_MODES$1$1.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:MSAA_QUALITY$1$1.NONE,SPRITE_MAX_TEXTURES:function(max){var allowMax=!0;if(isMobile$2.tablet||isMobile$2.phone){var match;if(isMobile$2.apple.device)if(match=navigator.userAgent.match(/OS (\d+)_(\d+)?/))parseInt(match[1],10)<11&&(allowMax=!1);if(isMobile$2.android.device)if(match=navigator.userAgent.match(/Android\s([0-9.]*)/))parseInt(match[1],10)<7&&(allowMax=!1)}return allowMax?max:4}(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:GC_MODES$1$1.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:WRAP_MODES$1$1.CLAMP,SCALE_MODE:SCALE_MODES$1$1.LINEAR,PRECISION_VERTEX:PRECISION$1$1.HIGH,PRECISION_FRAGMENT:isMobile$2.apple.device?PRECISION$1$1.HIGH:PRECISION$1$1.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!isMobile$2.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1,
|
|
142
127
|
/*!
|
|
143
|
-
* @pixi/
|
|
144
|
-
* Compiled
|
|
128
|
+
* @pixi/display - v6.4.2
|
|
129
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
145
130
|
*
|
|
146
|
-
* @pixi/
|
|
131
|
+
* @pixi/display is licensed under the MIT License.
|
|
147
132
|
* http://www.opensource.org/licenses/mit-license
|
|
148
133
|
*/
|
|
134
|
+
SORTABLE_CHILDREN:!1},Bounds$1=function(){function Bounds(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return Bounds.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},Bounds.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},Bounds.prototype.getRectangle=function(rect){return this.minX>this.maxX||this.minY>this.maxY?Rectangle.EMPTY:((rect=rect||new Rectangle(0,0,1,1)).x=this.minX,rect.y=this.minY,rect.width=this.maxX-this.minX,rect.height=this.maxY-this.minY,rect)},Bounds.prototype.addPoint=function(point){this.minX=Math.min(this.minX,point.x),this.maxX=Math.max(this.maxX,point.x),this.minY=Math.min(this.minY,point.y),this.maxY=Math.max(this.maxY,point.y)},Bounds.prototype.addPointMatrix=function(matrix,point){var a=matrix.a,b=matrix.b,c=matrix.c,d=matrix.d,tx=matrix.tx,ty=matrix.ty,x=a*point.x+c*point.y+tx,y=b*point.x+d*point.y+ty;this.minX=Math.min(this.minX,x),this.maxX=Math.max(this.maxX,x),this.minY=Math.min(this.minY,y),this.maxY=Math.max(this.maxY,y)},Bounds.prototype.addQuad=function(vertices){var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY,x=vertices[0],y=vertices[1];minX=x<minX?x:minX,minY=y<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=vertices[2])<minX?x:minX,minY=(y=vertices[3])<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=vertices[4])<minX?x:minX,minY=(y=vertices[5])<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=vertices[6])<minX?x:minX,minY=(y=vertices[7])<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,this.minX=minX,this.minY=minY,this.maxX=maxX,this.maxY=maxY},Bounds.prototype.addFrame=function(transform,x0,y0,x1,y1){this.addFrameMatrix(transform.worldTransform,x0,y0,x1,y1)},Bounds.prototype.addFrameMatrix=function(matrix,x0,y0,x1,y1){var a=matrix.a,b=matrix.b,c=matrix.c,d=matrix.d,tx=matrix.tx,ty=matrix.ty,minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY,x=a*x0+c*y0+tx,y=b*x0+d*y0+ty;minX=x<minX?x:minX,minY=y<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=a*x1+c*y0+tx)<minX?x:minX,minY=(y=b*x1+d*y0+ty)<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=a*x0+c*y1+tx)<minX?x:minX,minY=(y=b*x0+d*y1+ty)<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,minX=(x=a*x1+c*y1+tx)<minX?x:minX,minY=(y=b*x1+d*y1+ty)<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY,this.minX=minX,this.minY=minY,this.maxX=maxX,this.maxY=maxY},Bounds.prototype.addVertexData=function(vertexData,beginOffset,endOffset){for(var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY,i=beginOffset;i<endOffset;i+=2){var x=vertexData[i],y=vertexData[i+1];minX=x<minX?x:minX,minY=y<minY?y:minY,maxX=x>maxX?x:maxX,maxY=y>maxY?y:maxY}this.minX=minX,this.minY=minY,this.maxX=maxX,this.maxY=maxY},Bounds.prototype.addVertices=function(transform,vertices,beginOffset,endOffset){this.addVerticesMatrix(transform.worldTransform,vertices,beginOffset,endOffset)},Bounds.prototype.addVerticesMatrix=function(matrix,vertices,beginOffset,endOffset,padX,padY){void 0===padX&&(padX=0),void 0===padY&&(padY=padX);for(var a=matrix.a,b=matrix.b,c=matrix.c,d=matrix.d,tx=matrix.tx,ty=matrix.ty,minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY,i=beginOffset;i<endOffset;i+=2){var rawX=vertices[i],rawY=vertices[i+1],x=a*rawX+c*rawY+tx,y=d*rawY+b*rawX+ty;minX=Math.min(minX,x-padX),maxX=Math.max(maxX,x+padX),minY=Math.min(minY,y-padY),maxY=Math.max(maxY,y+padY)}this.minX=minX,this.minY=minY,this.maxX=maxX,this.maxY=maxY},Bounds.prototype.addBounds=function(bounds){var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY;this.minX=bounds.minX<minX?bounds.minX:minX,this.minY=bounds.minY<minY?bounds.minY:minY,this.maxX=bounds.maxX>maxX?bounds.maxX:maxX,this.maxY=bounds.maxY>maxY?bounds.maxY:maxY},Bounds.prototype.addBoundsMask=function(bounds,mask){var _minX=bounds.minX>mask.minX?bounds.minX:mask.minX,_minY=bounds.minY>mask.minY?bounds.minY:mask.minY,_maxX=bounds.maxX<mask.maxX?bounds.maxX:mask.maxX,_maxY=bounds.maxY<mask.maxY?bounds.maxY:mask.maxY;if(_minX<=_maxX&&_minY<=_maxY){var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY;this.minX=_minX<minX?_minX:minX,this.minY=_minY<minY?_minY:minY,this.maxX=_maxX>maxX?_maxX:maxX,this.maxY=_maxY>maxY?_maxY:maxY}},Bounds.prototype.addBoundsMatrix=function(bounds,matrix){this.addFrameMatrix(matrix,bounds.minX,bounds.minY,bounds.maxX,bounds.maxY)},Bounds.prototype.addBoundsArea=function(bounds,area){var _minX=bounds.minX>area.x?bounds.minX:area.x,_minY=bounds.minY>area.y?bounds.minY:area.y,_maxX=bounds.maxX<area.x+area.width?bounds.maxX:area.x+area.width,_maxY=bounds.maxY<area.y+area.height?bounds.maxY:area.y+area.height;if(_minX<=_maxX&&_minY<=_maxY){var minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY;this.minX=_minX<minX?_minX:minX,this.minY=_minY<minY?_minY:minY,this.maxX=_maxX>maxX?_maxX:maxX,this.maxY=_maxY>maxY?_maxY:maxY}},Bounds.prototype.pad=function(paddingX,paddingY){void 0===paddingX&&(paddingX=0),void 0===paddingY&&(paddingY=paddingX),this.isEmpty()||(this.minX-=paddingX,this.maxX+=paddingX,this.minY-=paddingY,this.maxY+=paddingY)},Bounds.prototype.addFramePad=function(x0,y0,x1,y1,padX,padY){x0-=padX,y0-=padY,x1+=padX,y1+=padY,this.minX=this.minX<x0?this.minX:x0,this.maxX=this.maxX>x1?this.maxX:x1,this.minY=this.minY<y0?this.minY:y0,this.maxY=this.maxY>y1?this.maxY:y1},Bounds}(),extendStatics$4=function(d,b){return extendStatics$4=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$4(d,b)};function __extends$4(d,b){function __(){this.constructor=d}extendStatics$4(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var ENV$3,RENDERER_TYPE$3,BUFFER_BITS$3,BLEND_MODES$3,DRAW_MODES$3,FORMATS$3,TARGETS$3,TYPES$3,SAMPLER_TYPES$3,SCALE_MODES$3,WRAP_MODES$3,MIPMAP_MODES$3,ALPHA_MODES$3,CLEAR_MODES$3,GC_MODES$3,PRECISION$3,MASK_TYPES$3,MSAA_QUALITY$3,BUFFER_TYPE$3,DisplayObject$1=function(_super){function DisplayObject(){var _this=_super.call(this)||this;return _this.tempDisplayObjectParent=null,_this.transform=new Transform,_this.alpha=1,_this.visible=!0,_this.renderable=!0,_this.cullable=!1,_this.cullArea=null,_this.parent=null,_this.worldAlpha=1,_this._lastSortedIndex=0,_this._zIndex=0,_this.filterArea=null,_this.filters=null,_this._enabledFilters=null,_this._bounds=new Bounds$1,_this._localBounds=null,_this._boundsID=0,_this._boundsRect=null,_this._localBoundsRect=null,_this._mask=null,_this._maskRefCount=0,_this._destroyed=!1,_this.isSprite=!1,_this.isMask=!1,_this}return __extends$4(DisplayObject,_super),DisplayObject.mixin=function(source){for(var keys=Object.keys(source),i=0;i<keys.length;++i){var propertyName=keys[i];Object.defineProperty(DisplayObject.prototype,propertyName,Object.getOwnPropertyDescriptor(source,propertyName))}},Object.defineProperty(DisplayObject.prototype,"destroyed",{get:function(){return this._destroyed},enumerable:!1,configurable:!0}),DisplayObject.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},DisplayObject.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},DisplayObject.prototype.getBounds=function(skipUpdate,rect){return skipUpdate||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),rect||(this._boundsRect||(this._boundsRect=new Rectangle),rect=this._boundsRect),this._bounds.getRectangle(rect)},DisplayObject.prototype.getLocalBounds=function(rect){rect||(this._localBoundsRect||(this._localBoundsRect=new Rectangle),rect=this._localBoundsRect),this._localBounds||(this._localBounds=new Bounds$1);var transformRef=this.transform,parentRef=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var worldBounds=this._bounds,worldBoundsID=this._boundsID;this._bounds=this._localBounds;var bounds=this.getBounds(!1,rect);return this.parent=parentRef,this.transform=transformRef,this._bounds=worldBounds,this._bounds.updateID+=this._boundsID-worldBoundsID,bounds},DisplayObject.prototype.toGlobal=function(position,point,skipUpdate){return void 0===skipUpdate&&(skipUpdate=!1),skipUpdate||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(position,point)},DisplayObject.prototype.toLocal=function(position,from,point,skipUpdate){return from&&(position=from.toGlobal(position,point,skipUpdate)),skipUpdate||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(position,point)},DisplayObject.prototype.setParent=function(container){if(!container||!container.addChild)throw new Error("setParent: Argument must be a Container");return container.addChild(this),container},DisplayObject.prototype.setTransform=function(x,y,scaleX,scaleY,rotation,skewX,skewY,pivotX,pivotY){return void 0===x&&(x=0),void 0===y&&(y=0),void 0===scaleX&&(scaleX=1),void 0===scaleY&&(scaleY=1),void 0===rotation&&(rotation=0),void 0===skewX&&(skewX=0),void 0===skewY&&(skewY=0),void 0===pivotX&&(pivotX=0),void 0===pivotY&&(pivotY=0),this.position.x=x,this.position.y=y,this.scale.x=scaleX||1,this.scale.y=scaleY||1,this.rotation=rotation,this.skew.x=skewX,this.skew.y=skewY,this.pivot.x=pivotX,this.pivot.y=pivotY,this},DisplayObject.prototype.destroy=function(_options){this.parent&&this.parent.removeChild(this),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()},Object.defineProperty(DisplayObject.prototype,"_tempDisplayObjectParent",{get:function(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new TemporaryDisplayObject$1),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),DisplayObject.prototype.enableTempParent=function(){var myParent=this.parent;return this.parent=this._tempDisplayObjectParent,myParent},DisplayObject.prototype.disableTempParent=function(cacheParent){this.parent=cacheParent},Object.defineProperty(DisplayObject.prototype,"x",{get:function(){return this.position.x},set:function(value){this.transform.position.x=value},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"y",{get:function(){return this.position.y},set:function(value){this.transform.position.y=value},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"position",{get:function(){return this.transform.position},set:function(value){this.transform.position.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"scale",{get:function(){return this.transform.scale},set:function(value){this.transform.scale.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(value){this.transform.pivot.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"skew",{get:function(){return this.transform.skew},set:function(value){this.transform.skew.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(value){this.transform.rotation=value},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"angle",{get:function(){return this.transform.rotation*RAD_TO_DEG},set:function(value){this.transform.rotation=value*DEG_TO_RAD},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"zIndex",{get:function(){return this._zIndex},set:function(value){this._zIndex=value,this.parent&&(this.parent.sortDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"worldVisible",{get:function(){var item=this;do{if(!item.visible)return!1;item=item.parent}while(item);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(value){if(this._mask!==value){var maskObject;if(this._mask)(maskObject=this._mask.maskObject||this._mask)._maskRefCount--,0===maskObject._maskRefCount&&(maskObject.renderable=!0,maskObject.isMask=!1);if(this._mask=value,this._mask)0===(maskObject=this._mask.maskObject||this._mask)._maskRefCount&&(maskObject.renderable=!1,maskObject.isMask=!0),maskObject._maskRefCount++}},enumerable:!1,configurable:!0}),DisplayObject}(eventemitter3),TemporaryDisplayObject$1=function(_super){function TemporaryDisplayObject(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.sortDirty=null,_this}return __extends$4(TemporaryDisplayObject,_super),TemporaryDisplayObject}(DisplayObject$1);function sortChildren$1(a,b){return a.zIndex===b.zIndex?a._lastSortedIndex-b._lastSortedIndex:a.zIndex-b.zIndex}DisplayObject$1.prototype.displayObjectUpdateTransform=DisplayObject$1.prototype.updateTransform,function(ENV){ENV[ENV.WEBGL_LEGACY=0]="WEBGL_LEGACY",ENV[ENV.WEBGL=1]="WEBGL",ENV[ENV.WEBGL2=2]="WEBGL2"}(ENV$3||(ENV$3={})),function(RENDERER_TYPE){RENDERER_TYPE[RENDERER_TYPE.UNKNOWN=0]="UNKNOWN",RENDERER_TYPE[RENDERER_TYPE.WEBGL=1]="WEBGL",RENDERER_TYPE[RENDERER_TYPE.CANVAS=2]="CANVAS"}(RENDERER_TYPE$3||(RENDERER_TYPE$3={})),function(BUFFER_BITS){BUFFER_BITS[BUFFER_BITS.COLOR=16384]="COLOR",BUFFER_BITS[BUFFER_BITS.DEPTH=256]="DEPTH",BUFFER_BITS[BUFFER_BITS.STENCIL=1024]="STENCIL"}(BUFFER_BITS$3||(BUFFER_BITS$3={})),function(BLEND_MODES){BLEND_MODES[BLEND_MODES.NORMAL=0]="NORMAL",BLEND_MODES[BLEND_MODES.ADD=1]="ADD",BLEND_MODES[BLEND_MODES.MULTIPLY=2]="MULTIPLY",BLEND_MODES[BLEND_MODES.SCREEN=3]="SCREEN",BLEND_MODES[BLEND_MODES.OVERLAY=4]="OVERLAY",BLEND_MODES[BLEND_MODES.DARKEN=5]="DARKEN",BLEND_MODES[BLEND_MODES.LIGHTEN=6]="LIGHTEN",BLEND_MODES[BLEND_MODES.COLOR_DODGE=7]="COLOR_DODGE",BLEND_MODES[BLEND_MODES.COLOR_BURN=8]="COLOR_BURN",BLEND_MODES[BLEND_MODES.HARD_LIGHT=9]="HARD_LIGHT",BLEND_MODES[BLEND_MODES.SOFT_LIGHT=10]="SOFT_LIGHT",BLEND_MODES[BLEND_MODES.DIFFERENCE=11]="DIFFERENCE",BLEND_MODES[BLEND_MODES.EXCLUSION=12]="EXCLUSION",BLEND_MODES[BLEND_MODES.HUE=13]="HUE",BLEND_MODES[BLEND_MODES.SATURATION=14]="SATURATION",BLEND_MODES[BLEND_MODES.COLOR=15]="COLOR",BLEND_MODES[BLEND_MODES.LUMINOSITY=16]="LUMINOSITY",BLEND_MODES[BLEND_MODES.NORMAL_NPM=17]="NORMAL_NPM",BLEND_MODES[BLEND_MODES.ADD_NPM=18]="ADD_NPM",BLEND_MODES[BLEND_MODES.SCREEN_NPM=19]="SCREEN_NPM",BLEND_MODES[BLEND_MODES.NONE=20]="NONE",BLEND_MODES[BLEND_MODES.SRC_OVER=0]="SRC_OVER",BLEND_MODES[BLEND_MODES.SRC_IN=21]="SRC_IN",BLEND_MODES[BLEND_MODES.SRC_OUT=22]="SRC_OUT",BLEND_MODES[BLEND_MODES.SRC_ATOP=23]="SRC_ATOP",BLEND_MODES[BLEND_MODES.DST_OVER=24]="DST_OVER",BLEND_MODES[BLEND_MODES.DST_IN=25]="DST_IN",BLEND_MODES[BLEND_MODES.DST_OUT=26]="DST_OUT",BLEND_MODES[BLEND_MODES.DST_ATOP=27]="DST_ATOP",BLEND_MODES[BLEND_MODES.ERASE=26]="ERASE",BLEND_MODES[BLEND_MODES.SUBTRACT=28]="SUBTRACT",BLEND_MODES[BLEND_MODES.XOR=29]="XOR"}(BLEND_MODES$3||(BLEND_MODES$3={})),function(DRAW_MODES){DRAW_MODES[DRAW_MODES.POINTS=0]="POINTS",DRAW_MODES[DRAW_MODES.LINES=1]="LINES",DRAW_MODES[DRAW_MODES.LINE_LOOP=2]="LINE_LOOP",DRAW_MODES[DRAW_MODES.LINE_STRIP=3]="LINE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLES=4]="TRIANGLES",DRAW_MODES[DRAW_MODES.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(DRAW_MODES$3||(DRAW_MODES$3={})),function(FORMATS){FORMATS[FORMATS.RGBA=6408]="RGBA",FORMATS[FORMATS.RGB=6407]="RGB",FORMATS[FORMATS.RG=33319]="RG",FORMATS[FORMATS.RED=6403]="RED",FORMATS[FORMATS.RGBA_INTEGER=36249]="RGBA_INTEGER",FORMATS[FORMATS.RGB_INTEGER=36248]="RGB_INTEGER",FORMATS[FORMATS.RG_INTEGER=33320]="RG_INTEGER",FORMATS[FORMATS.RED_INTEGER=36244]="RED_INTEGER",FORMATS[FORMATS.ALPHA=6406]="ALPHA",FORMATS[FORMATS.LUMINANCE=6409]="LUMINANCE",FORMATS[FORMATS.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",FORMATS[FORMATS.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",FORMATS[FORMATS.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(FORMATS$3||(FORMATS$3={})),function(TARGETS){TARGETS[TARGETS.TEXTURE_2D=3553]="TEXTURE_2D",TARGETS[TARGETS.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",TARGETS[TARGETS.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(TARGETS$3||(TARGETS$3={})),function(TYPES){TYPES[TYPES.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",TYPES[TYPES.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",TYPES[TYPES.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",TYPES[TYPES.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",TYPES[TYPES.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",TYPES[TYPES.UNSIGNED_INT=5125]="UNSIGNED_INT",TYPES[TYPES.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",TYPES[TYPES.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",TYPES[TYPES.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",TYPES[TYPES.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",TYPES[TYPES.BYTE=5120]="BYTE",TYPES[TYPES.SHORT=5122]="SHORT",TYPES[TYPES.INT=5124]="INT",TYPES[TYPES.FLOAT=5126]="FLOAT",TYPES[TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",TYPES[TYPES.HALF_FLOAT=36193]="HALF_FLOAT"}(TYPES$3||(TYPES$3={})),function(SAMPLER_TYPES){SAMPLER_TYPES[SAMPLER_TYPES.FLOAT=0]="FLOAT",SAMPLER_TYPES[SAMPLER_TYPES.INT=1]="INT",SAMPLER_TYPES[SAMPLER_TYPES.UINT=2]="UINT"}(SAMPLER_TYPES$3||(SAMPLER_TYPES$3={})),function(SCALE_MODES){SCALE_MODES[SCALE_MODES.NEAREST=0]="NEAREST",SCALE_MODES[SCALE_MODES.LINEAR=1]="LINEAR"}(SCALE_MODES$3||(SCALE_MODES$3={})),function(WRAP_MODES){WRAP_MODES[WRAP_MODES.CLAMP=33071]="CLAMP",WRAP_MODES[WRAP_MODES.REPEAT=10497]="REPEAT",WRAP_MODES[WRAP_MODES.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(WRAP_MODES$3||(WRAP_MODES$3={})),function(MIPMAP_MODES){MIPMAP_MODES[MIPMAP_MODES.OFF=0]="OFF",MIPMAP_MODES[MIPMAP_MODES.POW2=1]="POW2",MIPMAP_MODES[MIPMAP_MODES.ON=2]="ON",MIPMAP_MODES[MIPMAP_MODES.ON_MANUAL=3]="ON_MANUAL"}(MIPMAP_MODES$3||(MIPMAP_MODES$3={})),function(ALPHA_MODES){ALPHA_MODES[ALPHA_MODES.NPM=0]="NPM",ALPHA_MODES[ALPHA_MODES.UNPACK=1]="UNPACK",ALPHA_MODES[ALPHA_MODES.PMA=2]="PMA",ALPHA_MODES[ALPHA_MODES.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"}(ALPHA_MODES$3||(ALPHA_MODES$3={})),function(CLEAR_MODES){CLEAR_MODES[CLEAR_MODES.NO=0]="NO",CLEAR_MODES[CLEAR_MODES.YES=1]="YES",CLEAR_MODES[CLEAR_MODES.AUTO=2]="AUTO",CLEAR_MODES[CLEAR_MODES.BLEND=0]="BLEND",CLEAR_MODES[CLEAR_MODES.CLEAR=1]="CLEAR",CLEAR_MODES[CLEAR_MODES.BLIT=2]="BLIT"}(CLEAR_MODES$3||(CLEAR_MODES$3={})),function(GC_MODES){GC_MODES[GC_MODES.AUTO=0]="AUTO",GC_MODES[GC_MODES.MANUAL=1]="MANUAL"}(GC_MODES$3||(GC_MODES$3={})),function(PRECISION){PRECISION.LOW="lowp",PRECISION.MEDIUM="mediump",PRECISION.HIGH="highp"}(PRECISION$3||(PRECISION$3={})),function(MASK_TYPES){MASK_TYPES[MASK_TYPES.NONE=0]="NONE",MASK_TYPES[MASK_TYPES.SCISSOR=1]="SCISSOR",MASK_TYPES[MASK_TYPES.STENCIL=2]="STENCIL",MASK_TYPES[MASK_TYPES.SPRITE=3]="SPRITE"}(MASK_TYPES$3||(MASK_TYPES$3={})),function(MSAA_QUALITY){MSAA_QUALITY[MSAA_QUALITY.NONE=0]="NONE",MSAA_QUALITY[MSAA_QUALITY.LOW=2]="LOW",MSAA_QUALITY[MSAA_QUALITY.MEDIUM=4]="MEDIUM",MSAA_QUALITY[MSAA_QUALITY.HIGH=8]="HIGH"}(MSAA_QUALITY$3||(MSAA_QUALITY$3={})),function(BUFFER_TYPE){BUFFER_TYPE[BUFFER_TYPE.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",BUFFER_TYPE[BUFFER_TYPE.ARRAY_BUFFER=34962]="ARRAY_BUFFER",BUFFER_TYPE[BUFFER_TYPE.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"}(BUFFER_TYPE$3||(BUFFER_TYPE$3={}));var Container$1=function(_super){function Container(){var _this=_super.call(this)||this;return _this.children=[],_this.sortableChildren=settings$1.SORTABLE_CHILDREN,_this.sortDirty=!1,_this}return __extends$4(Container,_super),Container.prototype.onChildrenChange=function(_length){},Container.prototype.addChild=function(){for(var arguments$1=arguments,children=[],_i=0;_i<arguments.length;_i++)children[_i]=arguments$1[_i];if(children.length>1)for(var i=0;i<children.length;i++)this.addChild(children[i]);else{var child=children[0];child.parent&&child.parent.removeChild(child),child.parent=this,this.sortDirty=!0,child.transform._parentID=-1,this.children.push(child),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",child,this,this.children.length-1),child.emit("added",this)}return children[0]},Container.prototype.addChildAt=function(child,index){if(index<0||index>this.children.length)throw new Error(child+"addChildAt: The index "+index+" supplied is out of bounds "+this.children.length);return child.parent&&child.parent.removeChild(child),child.parent=this,this.sortDirty=!0,child.transform._parentID=-1,this.children.splice(index,0,child),this._boundsID++,this.onChildrenChange(index),child.emit("added",this),this.emit("childAdded",child,this,index),child},Container.prototype.swapChildren=function(child,child2){if(child!==child2){var index1=this.getChildIndex(child),index2=this.getChildIndex(child2);this.children[index1]=child2,this.children[index2]=child,this.onChildrenChange(index1<index2?index1:index2)}},Container.prototype.getChildIndex=function(child){var index=this.children.indexOf(child);if(-1===index)throw new Error("The supplied DisplayObject must be a child of the caller");return index},Container.prototype.setChildIndex=function(child,index){if(index<0||index>=this.children.length)throw new Error("The index "+index+" supplied is out of bounds "+this.children.length);var currentIndex=this.getChildIndex(child);removeItems(this.children,currentIndex,1),this.children.splice(index,0,child),this.onChildrenChange(index)},Container.prototype.getChildAt=function(index){if(index<0||index>=this.children.length)throw new Error("getChildAt: Index ("+index+") does not exist.");return this.children[index]},Container.prototype.removeChild=function(){for(var arguments$1=arguments,children=[],_i=0;_i<arguments.length;_i++)children[_i]=arguments$1[_i];if(children.length>1)for(var i=0;i<children.length;i++)this.removeChild(children[i]);else{var child=children[0],index=this.children.indexOf(child);if(-1===index)return null;child.parent=null,child.transform._parentID=-1,removeItems(this.children,index,1),this._boundsID++,this.onChildrenChange(index),child.emit("removed",this),this.emit("childRemoved",child,this,index)}return children[0]},Container.prototype.removeChildAt=function(index){var child=this.getChildAt(index);return child.parent=null,child.transform._parentID=-1,removeItems(this.children,index,1),this._boundsID++,this.onChildrenChange(index),child.emit("removed",this),this.emit("childRemoved",child,this,index),child},Container.prototype.removeChildren=function(beginIndex,endIndex){void 0===beginIndex&&(beginIndex=0),void 0===endIndex&&(endIndex=this.children.length);var removed,begin=beginIndex,range=endIndex-begin;if(range>0&&range<=endIndex){removed=this.children.splice(begin,range);for(var i=0;i<removed.length;++i)removed[i].parent=null,removed[i].transform&&(removed[i].transform._parentID=-1);this._boundsID++,this.onChildrenChange(beginIndex);for(i=0;i<removed.length;++i)removed[i].emit("removed",this),this.emit("childRemoved",removed[i],this,i);return removed}if(0===range&&0===this.children.length)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},Container.prototype.sortChildren=function(){for(var sortRequired=!1,i=0,j=this.children.length;i<j;++i){var child=this.children[i];child._lastSortedIndex=i,sortRequired||0===child.zIndex||(sortRequired=!0)}sortRequired&&this.children.length>1&&this.children.sort(sortChildren$1),this.sortDirty=!1},Container.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var i=0,j=this.children.length;i<j;++i){var child=this.children[i];child.visible&&child.updateTransform()}},Container.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var i=0;i<this.children.length;i++){var child=this.children[i];if(child.visible&&child.renderable)if(child.calculateBounds(),child._mask){var maskObject=child._mask.maskObject||child._mask;maskObject.calculateBounds(),this._bounds.addBoundsMask(child._bounds,maskObject._bounds)}else child.filterArea?this._bounds.addBoundsArea(child._bounds,child.filterArea):this._bounds.addBounds(child._bounds)}this._bounds.updateID=this._boundsID},Container.prototype.getLocalBounds=function(rect,skipChildrenUpdate){void 0===skipChildrenUpdate&&(skipChildrenUpdate=!1);var result=_super.prototype.getLocalBounds.call(this,rect);if(!skipChildrenUpdate)for(var i=0,j=this.children.length;i<j;++i){var child=this.children[i];child.visible&&child.updateTransform()}return result},Container.prototype._calculateBounds=function(){},Container.prototype._renderWithCulling=function(renderer){var sourceFrame=renderer.renderTexture.sourceFrame;if(sourceFrame.width>0&&sourceFrame.height>0){var bounds,transform;if(this.cullArea?(bounds=this.cullArea,transform=this.worldTransform):this._render!==Container.prototype._render&&(bounds=this.getBounds(!0)),bounds&&sourceFrame.intersects(bounds,transform))this._render(renderer);else if(this.cullArea)return;for(var i=0,j=this.children.length;i<j;++i){var child=this.children[i],childCullable=child.cullable;child.cullable=childCullable||!this.cullArea,child.render(renderer),child.cullable=childCullable}}},Container.prototype.render=function(renderer){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable)if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(renderer);else if(this.cullable)this._renderWithCulling(renderer);else{this._render(renderer);for(var i=0,j=this.children.length;i<j;++i)this.children[i].render(renderer)}},Container.prototype.renderAdvanced=function(renderer){var filters=this.filters,mask=this._mask;if(filters){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var i=0;i<filters.length;i++)filters[i].enabled&&this._enabledFilters.push(filters[i])}var flush=filters&&this._enabledFilters&&this._enabledFilters.length||mask&&(!mask.isMaskData||mask.enabled&&(mask.autoDetect||mask.type!==MASK_TYPES$3.NONE));if(flush&&renderer.batch.flush(),filters&&this._enabledFilters&&this._enabledFilters.length&&renderer.filter.push(this,this._enabledFilters),mask&&renderer.mask.push(this,this._mask),this.cullable)this._renderWithCulling(renderer);else{this._render(renderer);i=0;for(var j=this.children.length;i<j;++i)this.children[i].render(renderer)}flush&&renderer.batch.flush(),mask&&renderer.mask.pop(this),filters&&this._enabledFilters&&this._enabledFilters.length&&renderer.filter.pop()},Container.prototype._render=function(_renderer){},Container.prototype.destroy=function(options){_super.prototype.destroy.call(this),this.sortDirty=!1;var destroyChildren="boolean"==typeof options?options:options&&options.children,oldChildren=this.removeChildren(0,this.children.length);if(destroyChildren)for(var i=0;i<oldChildren.length;++i)oldChildren[i].destroy(options)},Object.defineProperty(Container.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(value){var width=this.getLocalBounds().width;this.scale.x=0!==width?value/width:1,this._width=value},enumerable:!1,configurable:!0}),Object.defineProperty(Container.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(value){var height=this.getLocalBounds().height;this.scale.y=0!==height?value/height:1,this._height=value},enumerable:!1,configurable:!0}),Container}(DisplayObject$1);Container$1.prototype.containerUpdateTransform=Container$1.prototype.updateTransform;var TEMP_RECT=new Rectangle,Extract=function(){function Extract(renderer){this.renderer=renderer}return Extract.prototype.image=function(target,format,quality){var image=new Image;return image.src=this.base64(target,format,quality),image},Extract.prototype.base64=function(target,format,quality){return this.canvas(target).toDataURL(format,quality)},Extract.prototype.canvas=function(target){var resolution,frame,renderTexture,renderer=this.renderer,flipY=!1,generated=!1;target&&(target instanceof RenderTexture?renderTexture=target:(renderTexture=this.renderer.generateTexture(target),generated=!0)),renderTexture?(resolution=renderTexture.baseTexture.resolution,frame=renderTexture.frame,flipY=!1,renderer.renderTexture.bind(renderTexture)):(resolution=this.renderer.resolution,flipY=!0,(frame=TEMP_RECT).width=this.renderer.width,frame.height=this.renderer.height,renderer.renderTexture.bind(null));var width=Math.floor(frame.width*resolution+1e-4),height=Math.floor(frame.height*resolution+1e-4),canvasBuffer=new CanvasRenderTarget(width,height,1),webglPixels=new Uint8Array(4*width*height),gl=renderer.gl;gl.readPixels(frame.x*resolution,frame.y*resolution,width,height,gl.RGBA,gl.UNSIGNED_BYTE,webglPixels);var canvasData=canvasBuffer.context.getImageData(0,0,width,height);if(Extract.arrayPostDivide(webglPixels,canvasData.data),canvasBuffer.context.putImageData(canvasData,0,0),flipY){var target_1=new CanvasRenderTarget(canvasBuffer.width,canvasBuffer.height,1);target_1.context.scale(1,-1),target_1.context.drawImage(canvasBuffer.canvas,0,-height),canvasBuffer.destroy(),canvasBuffer=target_1}return generated&&renderTexture.destroy(!0),canvasBuffer.canvas},Extract.prototype.pixels=function(target,options){var resolution,frame,renderTexture,renderer=this.renderer,generated=!1;target&&(target instanceof RenderTexture?renderTexture=target:target instanceof DisplayObject$1&&(renderTexture=this.renderer.generateTexture(target),generated=!0)),renderTexture?options?(resolution=options.resolution,frame=renderTexture.frame,renderer.renderTexture.bind(renderTexture)):(resolution=renderTexture.baseTexture.resolution,frame=renderTexture.frame,renderer.renderTexture.bind(renderTexture)):options?(resolution=options.resolution,(frame=TEMP_RECT).width=options.width,frame.height=options.height,renderer.renderTexture.bind(null)):(resolution=renderer.resolution,(frame=TEMP_RECT).width=renderer.width,frame.height=renderer.height,renderer.renderTexture.bind(null));var width=frame.width*resolution,height=frame.height*resolution,webglPixels=new Uint8Array(4*width*height),gl=renderer.gl;return gl.readPixels(frame.x*resolution,frame.y*resolution,width,height,gl.RGBA,gl.UNSIGNED_BYTE,webglPixels),generated&&renderTexture.destroy(!0),Extract.arrayPostDivide(webglPixels,webglPixels),webglPixels},Extract.prototype.destroy=function(){this.renderer=null},Extract.arrayPostDivide=function(pixels,out){for(var i=0;i<pixels.length;i+=4){var alpha=out[i+3]=pixels[i+3];0!==alpha?(out[i]=Math.round(Math.min(255*pixels[i]/alpha,255)),out[i+1]=Math.round(Math.min(255*pixels[i+1]/alpha,255)),out[i+2]=Math.round(Math.min(255*pixels[i+2]/alpha,255))):(out[i]=pixels[i],out[i+1]=pixels[i+1],out[i+2]=pixels[i+2])}},Extract}(),SignalBinding=function(){function SignalBinding(fn,once,thisArg){void 0===once&&(once=!1),this._fn=fn,this._once=once,this._thisArg=thisArg,this._next=this._prev=this._owner=null}return SignalBinding.prototype.detach=function(){return null!==this._owner&&(this._owner.detach(this),!0)},SignalBinding}();function _addSignalBinding(self,node){return self._head?(self._tail._next=node,node._prev=self._tail,self._tail=node):(self._head=node,self._tail=node),node._owner=self,node}var useXdr,Signal=function(){function Signal(){this._head=this._tail=void 0}return Signal.prototype.handlers=function(exists){void 0===exists&&(exists=!1);var node=this._head;if(exists)return!!node;for(var ee=[];node;)ee.push(node),node=node._next;return ee},Signal.prototype.has=function(node){if(!(node instanceof SignalBinding))throw new Error("MiniSignal#has(): First arg must be a SignalBinding object.");return node._owner===this},Signal.prototype.dispatch=function(){for(var arguments$1=arguments,args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments$1[_i];var node=this._head;if(!node)return!1;for(;node;)node._once&&this.detach(node),node._fn.apply(node._thisArg,args),node=node._next;return!0},Signal.prototype.add=function(fn,thisArg){if(void 0===thisArg&&(thisArg=null),"function"!=typeof fn)throw new Error("MiniSignal#add(): First arg must be a Function.");return _addSignalBinding(this,new SignalBinding(fn,!1,thisArg))},Signal.prototype.once=function(fn,thisArg){if(void 0===thisArg&&(thisArg=null),"function"!=typeof fn)throw new Error("MiniSignal#once(): First arg must be a Function.");return _addSignalBinding(this,new SignalBinding(fn,!0,thisArg))},Signal.prototype.detach=function(node){if(!(node instanceof SignalBinding))throw new Error("MiniSignal#detach(): First arg must be a SignalBinding object.");return node._owner!==this||(node._prev&&(node._prev._next=node._next),node._next&&(node._next._prev=node._prev),node===this._head?(this._head=node._next,null===node._next&&(this._tail=null)):node===this._tail&&(this._tail=node._prev,this._tail._next=null),node._owner=null),this},Signal.prototype.detachAll=function(){var node=this._head;if(!node)return this;for(this._head=this._tail=null;node;)node._owner=null,node=node._next;return this},Signal}();function parseUri(str,opts){opts=opts||{};for(var o={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},m=o.parser[opts.strictMode?"strict":"loose"].exec(str),uri={},i=14;i--;)uri[o.key[i]]=m[i]||"";return uri[o.q.name]={},uri[o.key[12]].replace(o.q.parser,(function(_t0,t1,t2){t1&&(uri[o.q.name][t1]=t2)})),uri}var tempAnchor$1=null;function _noop$1(){}function setExtMap(map,extname,val){extname&&0===extname.indexOf(".")&&(extname=extname.substring(1)),extname&&(map[extname]=val)}function reqType(xhr){return xhr.toString().replace("object ","")}var LoaderResource=function(){function LoaderResource(name,url,options){if(this._dequeue=_noop$1,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=null,this._boundOnError=null,this._boundOnProgress=null,this._boundOnTimeout=null,this._boundXhrOnError=null,this._boundXhrOnTimeout=null,this._boundXhrOnAbort=null,this._boundXhrOnLoad=null,"string"!=typeof name||"string"!=typeof url)throw new Error("Both name and url are required for constructing a resource.");options=options||{},this._flags=0,this._setFlag(LoaderResource.STATUS_FLAGS.DATA_URL,0===url.indexOf("data:")),this.name=name,this.url=url,this.extension=this._getExtension(),this.data=null,this.crossOrigin=!0===options.crossOrigin?"anonymous":options.crossOrigin,this.timeout=options.timeout||0,this.loadType=options.loadType||this._determineLoadType(),this.xhrType=options.xhrType,this.metadata=options.metadata||{},this.error=null,this.xhr=null,this.children=[],this.type=LoaderResource.TYPE.UNKNOWN,this.progressChunk=0,this._dequeue=_noop$1,this._onLoadBinding=null,this._elementTimer=0,this._boundComplete=this.complete.bind(this),this._boundOnError=this._onError.bind(this),this._boundOnProgress=this._onProgress.bind(this),this._boundOnTimeout=this._onTimeout.bind(this),this._boundXhrOnError=this._xhrOnError.bind(this),this._boundXhrOnTimeout=this._xhrOnTimeout.bind(this),this._boundXhrOnAbort=this._xhrOnAbort.bind(this),this._boundXhrOnLoad=this._xhrOnLoad.bind(this),this.onStart=new Signal,this.onProgress=new Signal,this.onComplete=new Signal,this.onAfterMiddleware=new Signal}return LoaderResource.setExtensionLoadType=function(extname,loadType){setExtMap(LoaderResource._loadTypeMap,extname,loadType)},LoaderResource.setExtensionXhrType=function(extname,xhrType){setExtMap(LoaderResource._xhrTypeMap,extname,xhrType)},Object.defineProperty(LoaderResource.prototype,"isDataUrl",{get:function(){return this._hasFlag(LoaderResource.STATUS_FLAGS.DATA_URL)},enumerable:!1,configurable:!0}),Object.defineProperty(LoaderResource.prototype,"isComplete",{get:function(){return this._hasFlag(LoaderResource.STATUS_FLAGS.COMPLETE)},enumerable:!1,configurable:!0}),Object.defineProperty(LoaderResource.prototype,"isLoading",{get:function(){return this._hasFlag(LoaderResource.STATUS_FLAGS.LOADING)},enumerable:!1,configurable:!0}),LoaderResource.prototype.complete=function(){this._clearEvents(),this._finish()},LoaderResource.prototype.abort=function(message){if(!this.error){if(this.error=new Error(message),this._clearEvents(),this.xhr)this.xhr.abort();else if(this.xdr)this.xdr.abort();else if(this.data)if(this.data.src)this.data.src=LoaderResource.EMPTY_GIF;else for(;this.data.firstChild;)this.data.removeChild(this.data.firstChild);this._finish()}},LoaderResource.prototype.load=function(cb){var _this=this;if(!this.isLoading)if(this.isComplete)cb&&setTimeout((function(){return cb(_this)}),1);else switch(cb&&this.onComplete.once(cb),this._setFlag(LoaderResource.STATUS_FLAGS.LOADING,!0),this.onStart.dispatch(this),!1!==this.crossOrigin&&"string"==typeof this.crossOrigin||(this.crossOrigin=this._determineCrossOrigin(this.url)),this.loadType){case LoaderResource.LOAD_TYPE.IMAGE:this.type=LoaderResource.TYPE.IMAGE,this._loadElement("image");break;case LoaderResource.LOAD_TYPE.AUDIO:this.type=LoaderResource.TYPE.AUDIO,this._loadSourceElement("audio");break;case LoaderResource.LOAD_TYPE.VIDEO:this.type=LoaderResource.TYPE.VIDEO,this._loadSourceElement("video");break;case LoaderResource.LOAD_TYPE.XHR:default:void 0===useXdr&&(useXdr=!(!globalThis.XDomainRequest||"withCredentials"in new XMLHttpRequest)),useXdr&&this.crossOrigin?this._loadXdr():this._loadXhr()}},LoaderResource.prototype._hasFlag=function(flag){return 0!=(this._flags&flag)},LoaderResource.prototype._setFlag=function(flag,value){this._flags=value?this._flags|flag:this._flags&~flag},LoaderResource.prototype._clearEvents=function(){clearTimeout(this._elementTimer),this.data&&this.data.removeEventListener&&(this.data.removeEventListener("error",this._boundOnError,!1),this.data.removeEventListener("load",this._boundComplete,!1),this.data.removeEventListener("progress",this._boundOnProgress,!1),this.data.removeEventListener("canplaythrough",this._boundComplete,!1)),this.xhr&&(this.xhr.removeEventListener?(this.xhr.removeEventListener("error",this._boundXhrOnError,!1),this.xhr.removeEventListener("timeout",this._boundXhrOnTimeout,!1),this.xhr.removeEventListener("abort",this._boundXhrOnAbort,!1),this.xhr.removeEventListener("progress",this._boundOnProgress,!1),this.xhr.removeEventListener("load",this._boundXhrOnLoad,!1)):(this.xhr.onerror=null,this.xhr.ontimeout=null,this.xhr.onprogress=null,this.xhr.onload=null))},LoaderResource.prototype._finish=function(){if(this.isComplete)throw new Error("Complete called again for an already completed resource.");this._setFlag(LoaderResource.STATUS_FLAGS.COMPLETE,!0),this._setFlag(LoaderResource.STATUS_FLAGS.LOADING,!1),this.onComplete.dispatch(this)},LoaderResource.prototype._loadElement=function(type){this.metadata.loadElement?this.data=this.metadata.loadElement:"image"===type&&void 0!==globalThis.Image?this.data=new Image:this.data=document.createElement(type),this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),this.metadata.skipSource||(this.data.src=this.url),this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))},LoaderResource.prototype._loadSourceElement=function(type){if(this.metadata.loadElement?this.data=this.metadata.loadElement:"audio"===type&&void 0!==globalThis.Audio?this.data=new Audio:this.data=document.createElement(type),null!==this.data){if(this.crossOrigin&&(this.data.crossOrigin=this.crossOrigin),!this.metadata.skipSource)if(navigator.isCocoonJS)this.data.src=Array.isArray(this.url)?this.url[0]:this.url;else if(Array.isArray(this.url))for(var mimeTypes=this.metadata.mimeType,i=0;i<this.url.length;++i)this.data.appendChild(this._createSource(type,this.url[i],Array.isArray(mimeTypes)?mimeTypes[i]:mimeTypes));else{mimeTypes=this.metadata.mimeType;this.data.appendChild(this._createSource(type,this.url,Array.isArray(mimeTypes)?mimeTypes[0]:mimeTypes))}this.data.addEventListener("error",this._boundOnError,!1),this.data.addEventListener("load",this._boundComplete,!1),this.data.addEventListener("progress",this._boundOnProgress,!1),this.data.addEventListener("canplaythrough",this._boundComplete,!1),this.data.load(),this.timeout&&(this._elementTimer=setTimeout(this._boundOnTimeout,this.timeout))}else this.abort("Unsupported element: "+type)},LoaderResource.prototype._loadXhr=function(){"string"!=typeof this.xhrType&&(this.xhrType=this._determineXhrType());var xhr=this.xhr=new XMLHttpRequest;"use-credentials"===this.crossOrigin&&(xhr.withCredentials=!0),xhr.open("GET",this.url,!0),xhr.timeout=this.timeout,this.xhrType===LoaderResource.XHR_RESPONSE_TYPE.JSON||this.xhrType===LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT?xhr.responseType=LoaderResource.XHR_RESPONSE_TYPE.TEXT:xhr.responseType=this.xhrType,xhr.addEventListener("error",this._boundXhrOnError,!1),xhr.addEventListener("timeout",this._boundXhrOnTimeout,!1),xhr.addEventListener("abort",this._boundXhrOnAbort,!1),xhr.addEventListener("progress",this._boundOnProgress,!1),xhr.addEventListener("load",this._boundXhrOnLoad,!1),xhr.send()},LoaderResource.prototype._loadXdr=function(){"string"!=typeof this.xhrType&&(this.xhrType=this._determineXhrType());var xdr=this.xhr=new globalThis.XDomainRequest;xdr.timeout=this.timeout||5e3,xdr.onerror=this._boundXhrOnError,xdr.ontimeout=this._boundXhrOnTimeout,xdr.onprogress=this._boundOnProgress,xdr.onload=this._boundXhrOnLoad,xdr.open("GET",this.url,!0),setTimeout((function(){return xdr.send()}),1)},LoaderResource.prototype._createSource=function(type,url,mime){mime||(mime=type+"/"+this._getExtension(url));var source=document.createElement("source");return source.src=url,source.type=mime,source},LoaderResource.prototype._onError=function(event){this.abort("Failed to load element using: "+event.target.nodeName)},LoaderResource.prototype._onProgress=function(event){event&&event.lengthComputable&&this.onProgress.dispatch(this,event.loaded/event.total)},LoaderResource.prototype._onTimeout=function(){this.abort("Load timed out.")},LoaderResource.prototype._xhrOnError=function(){var xhr=this.xhr;this.abort(reqType(xhr)+" Request failed. Status: "+xhr.status+', text: "'+xhr.statusText+'"')},LoaderResource.prototype._xhrOnTimeout=function(){var xhr=this.xhr;this.abort(reqType(xhr)+" Request timed out.")},LoaderResource.prototype._xhrOnAbort=function(){var xhr=this.xhr;this.abort(reqType(xhr)+" Request was aborted by the user.")},LoaderResource.prototype._xhrOnLoad=function(){var xhr=this.xhr,text="",status=void 0===xhr.status?200:xhr.status;if(""!==xhr.responseType&&"text"!==xhr.responseType&&void 0!==xhr.responseType||(text=xhr.responseText),0===status&&(text.length>0||xhr.responseType===LoaderResource.XHR_RESPONSE_TYPE.BUFFER)?status=200:1223===status&&(status=204),2===(status/100|0)){if(this.xhrType===LoaderResource.XHR_RESPONSE_TYPE.TEXT)this.data=text,this.type=LoaderResource.TYPE.TEXT;else if(this.xhrType===LoaderResource.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(text),this.type=LoaderResource.TYPE.JSON}catch(e){return void this.abort("Error trying to parse loaded json: "+e)}else if(this.xhrType===LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)try{if(globalThis.DOMParser){var domparser=new DOMParser;this.data=domparser.parseFromString(text,"text/xml")}else{var div=document.createElement("div");div.innerHTML=text,this.data=div}this.type=LoaderResource.TYPE.XML}catch(e$1){return void this.abort("Error trying to parse loaded xml: "+e$1)}else this.data=xhr.response||text;this.complete()}else this.abort("["+xhr.status+"] "+xhr.statusText+": "+xhr.responseURL)},LoaderResource.prototype._determineCrossOrigin=function(url,loc){if(0===url.indexOf("data:"))return"";if(globalThis.origin!==globalThis.location.origin)return"anonymous";loc=loc||globalThis.location,tempAnchor$1||(tempAnchor$1=document.createElement("a")),tempAnchor$1.href=url;var parsedUrl=parseUri(tempAnchor$1.href,{strictMode:!0}),samePort=!parsedUrl.port&&""===loc.port||parsedUrl.port===loc.port,protocol=parsedUrl.protocol?parsedUrl.protocol+":":"";return parsedUrl.host===loc.hostname&&samePort&&protocol===loc.protocol?"":"anonymous"},LoaderResource.prototype._determineXhrType=function(){return LoaderResource._xhrTypeMap[this.extension]||LoaderResource.XHR_RESPONSE_TYPE.TEXT},LoaderResource.prototype._determineLoadType=function(){return LoaderResource._loadTypeMap[this.extension]||LoaderResource.LOAD_TYPE.XHR},LoaderResource.prototype._getExtension=function(url){void 0===url&&(url=this.url);var ext="";if(this.isDataUrl){var slashIndex=url.indexOf("/");ext=url.substring(slashIndex+1,url.indexOf(";",slashIndex))}else{var queryStart=url.indexOf("?"),hashStart=url.indexOf("#"),index=Math.min(queryStart>-1?queryStart:url.length,hashStart>-1?hashStart:url.length);ext=(url=url.substring(0,index)).substring(url.lastIndexOf(".")+1)}return ext.toLowerCase()},LoaderResource.prototype._getMimeFromXhrType=function(type){switch(type){case LoaderResource.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case LoaderResource.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case LoaderResource.XHR_RESPONSE_TYPE.JSON:return"application/json";case LoaderResource.XHR_RESPONSE_TYPE.DEFAULT:case LoaderResource.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},LoaderResource}();function _noop(){}function onlyOnce(fn){return function(){for(var arguments$1=arguments,args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments$1[_i];if(null===fn)throw new Error("Callback was already called.");var callFn=fn;fn=null,callFn.apply(this,args)}}!function(LoaderResource){var STATUS_FLAGS,TYPE,LOAD_TYPE,XHR_RESPONSE_TYPE;(STATUS_FLAGS=LoaderResource.STATUS_FLAGS||(LoaderResource.STATUS_FLAGS={}))[STATUS_FLAGS.NONE=0]="NONE",STATUS_FLAGS[STATUS_FLAGS.DATA_URL=1]="DATA_URL",STATUS_FLAGS[STATUS_FLAGS.COMPLETE=2]="COMPLETE",STATUS_FLAGS[STATUS_FLAGS.LOADING=4]="LOADING",(TYPE=LoaderResource.TYPE||(LoaderResource.TYPE={}))[TYPE.UNKNOWN=0]="UNKNOWN",TYPE[TYPE.JSON=1]="JSON",TYPE[TYPE.XML=2]="XML",TYPE[TYPE.IMAGE=3]="IMAGE",TYPE[TYPE.AUDIO=4]="AUDIO",TYPE[TYPE.VIDEO=5]="VIDEO",TYPE[TYPE.TEXT=6]="TEXT",(LOAD_TYPE=LoaderResource.LOAD_TYPE||(LoaderResource.LOAD_TYPE={}))[LOAD_TYPE.XHR=1]="XHR",LOAD_TYPE[LOAD_TYPE.IMAGE=2]="IMAGE",LOAD_TYPE[LOAD_TYPE.AUDIO=3]="AUDIO",LOAD_TYPE[LOAD_TYPE.VIDEO=4]="VIDEO",(XHR_RESPONSE_TYPE=LoaderResource.XHR_RESPONSE_TYPE||(LoaderResource.XHR_RESPONSE_TYPE={})).DEFAULT="text",XHR_RESPONSE_TYPE.BUFFER="arraybuffer",XHR_RESPONSE_TYPE.BLOB="blob",XHR_RESPONSE_TYPE.DOCUMENT="document",XHR_RESPONSE_TYPE.JSON="json",XHR_RESPONSE_TYPE.TEXT="text",LoaderResource._loadTypeMap={gif:LoaderResource.LOAD_TYPE.IMAGE,png:LoaderResource.LOAD_TYPE.IMAGE,bmp:LoaderResource.LOAD_TYPE.IMAGE,jpg:LoaderResource.LOAD_TYPE.IMAGE,jpeg:LoaderResource.LOAD_TYPE.IMAGE,tif:LoaderResource.LOAD_TYPE.IMAGE,tiff:LoaderResource.LOAD_TYPE.IMAGE,webp:LoaderResource.LOAD_TYPE.IMAGE,tga:LoaderResource.LOAD_TYPE.IMAGE,svg:LoaderResource.LOAD_TYPE.IMAGE,"svg+xml":LoaderResource.LOAD_TYPE.IMAGE,mp3:LoaderResource.LOAD_TYPE.AUDIO,ogg:LoaderResource.LOAD_TYPE.AUDIO,wav:LoaderResource.LOAD_TYPE.AUDIO,mp4:LoaderResource.LOAD_TYPE.VIDEO,webm:LoaderResource.LOAD_TYPE.VIDEO},LoaderResource._xhrTypeMap={xhtml:LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,html:LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,htm:LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,xml:LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,tmx:LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,svg:LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,tsx:LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,gif:LoaderResource.XHR_RESPONSE_TYPE.BLOB,png:LoaderResource.XHR_RESPONSE_TYPE.BLOB,bmp:LoaderResource.XHR_RESPONSE_TYPE.BLOB,jpg:LoaderResource.XHR_RESPONSE_TYPE.BLOB,jpeg:LoaderResource.XHR_RESPONSE_TYPE.BLOB,tif:LoaderResource.XHR_RESPONSE_TYPE.BLOB,tiff:LoaderResource.XHR_RESPONSE_TYPE.BLOB,webp:LoaderResource.XHR_RESPONSE_TYPE.BLOB,tga:LoaderResource.XHR_RESPONSE_TYPE.BLOB,json:LoaderResource.XHR_RESPONSE_TYPE.JSON,text:LoaderResource.XHR_RESPONSE_TYPE.TEXT,txt:LoaderResource.XHR_RESPONSE_TYPE.TEXT,ttf:LoaderResource.XHR_RESPONSE_TYPE.BUFFER,otf:LoaderResource.XHR_RESPONSE_TYPE.BUFFER},LoaderResource.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="}(LoaderResource||(LoaderResource={}));var AsyncQueueItem=function(data,callback){this.data=data,this.callback=callback},AsyncQueue=function(){function AsyncQueue(worker,concurrency){var _this=this;if(void 0===concurrency&&(concurrency=1),this.workers=0,this.saturated=_noop,this.unsaturated=_noop,this.empty=_noop,this.drain=_noop,this.error=_noop,this.started=!1,this.paused=!1,this._tasks=[],this._insert=function(data,insertAtFront,callback){if(callback&&"function"!=typeof callback)throw new Error("task callback must be a function");if(_this.started=!0,null==data&&_this.idle())setTimeout((function(){return _this.drain()}),1);else{var item=new AsyncQueueItem(data,"function"==typeof callback?callback:_noop);insertAtFront?_this._tasks.unshift(item):_this._tasks.push(item),setTimeout(_this.process,1)}},this.process=function(){for(;!_this.paused&&_this.workers<_this.concurrency&&_this._tasks.length;){var task=_this._tasks.shift();0===_this._tasks.length&&_this.empty(),_this.workers+=1,_this.workers===_this.concurrency&&_this.saturated(),_this._worker(task.data,onlyOnce(_this._next(task)))}},this._worker=worker,0===concurrency)throw new Error("Concurrency must not be zero");this.concurrency=concurrency,this.buffer=concurrency/4}return AsyncQueue.prototype._next=function(task){var _this=this;return function(){for(var arguments$1=arguments,args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments$1[_i];_this.workers-=1,task.callback.apply(task,args),null!=args[0]&&_this.error(args[0],task.data),_this.workers<=_this.concurrency-_this.buffer&&_this.unsaturated(),_this.idle()&&_this.drain(),_this.process()}},AsyncQueue.prototype.push=function(data,callback){this._insert(data,!1,callback)},AsyncQueue.prototype.kill=function(){this.workers=0,this.drain=_noop,this.started=!1,this._tasks=[]},AsyncQueue.prototype.unshift=function(data,callback){this._insert(data,!0,callback)},AsyncQueue.prototype.length=function(){return this._tasks.length},AsyncQueue.prototype.running=function(){return this.workers},AsyncQueue.prototype.idle=function(){return this._tasks.length+this.workers===0},AsyncQueue.prototype.pause=function(){!0!==this.paused&&(this.paused=!0)},AsyncQueue.prototype.resume=function(){if(!1!==this.paused){this.paused=!1;for(var w=1;w<=this.concurrency;w++)this.process()}},AsyncQueue.eachSeries=function(array,iterator,callback,deferNext){var i=0,len=array.length;!function next(err){err||i===len?callback&&callback(err):deferNext?setTimeout((function(){iterator(array[i++],next)}),1):iterator(array[i++],next)}()},AsyncQueue.queue=function(worker,concurrency){return new AsyncQueue(worker,concurrency)},AsyncQueue}(),rgxExtractUrlHash=/(#[\w-]+)?$/,Loader=function(){function Loader(baseUrl,concurrency){var _this=this;void 0===baseUrl&&(baseUrl=""),void 0===concurrency&&(concurrency=10),this.progress=0,this.loading=!1,this.defaultQueryString="",this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(r,d){return _this._loadResource(r,d)},this.resources={},this.baseUrl=baseUrl,this._beforeMiddleware=[],this._afterMiddleware=[],this._resourcesParsing=[],this._boundLoadResource=function(r,d){return _this._loadResource(r,d)},this._queue=AsyncQueue.queue(this._boundLoadResource,concurrency),this._queue.pause(),this.resources={},this.onProgress=new Signal,this.onError=new Signal,this.onLoad=new Signal,this.onStart=new Signal,this.onComplete=new Signal;for(var i=0;i<Loader._plugins.length;++i){var plugin=Loader._plugins[i],pre=plugin.pre,use=plugin.use;pre&&this.pre(pre),use&&this.use(use)}this._protected=!1}return Loader.prototype._add=function(name,url,options,callback){if(this.loading&&(!options||!options.parentResource))throw new Error("Cannot add resources while the loader is running.");if(this.resources[name])throw new Error('Resource named "'+name+'" already exists.');if(url=this._prepareUrl(url),this.resources[name]=new LoaderResource(name,url,options),"function"==typeof callback&&this.resources[name].onAfterMiddleware.once(callback),this.loading){for(var parent=options.parentResource,incompleteChildren=[],i=0;i<parent.children.length;++i)parent.children[i].isComplete||incompleteChildren.push(parent.children[i]);var eachChunk=parent.progressChunk*(incompleteChildren.length+1)/(incompleteChildren.length+2);parent.children.push(this.resources[name]),parent.progressChunk=eachChunk;for(i=0;i<incompleteChildren.length;++i)incompleteChildren[i].progressChunk=eachChunk;this.resources[name].progressChunk=eachChunk}return this._queue.push(this.resources[name]),this},Loader.prototype.pre=function(fn){return this._beforeMiddleware.push(fn),this},Loader.prototype.use=function(fn){return this._afterMiddleware.push(fn),this},Loader.prototype.reset=function(){for(var k in this.progress=0,this.loading=!1,this._queue.kill(),this._queue.pause(),this.resources){var res=this.resources[k];res._onLoadBinding&&res._onLoadBinding.detach(),res.isLoading&&res.abort("loader reset")}return this.resources={},this},Loader.prototype.load=function(cb){if("function"==typeof cb&&this.onComplete.once(cb),this.loading)return this;if(this._queue.idle())this._onStart(),this._onComplete();else{for(var chunk=100/this._queue._tasks.length,i=0;i<this._queue._tasks.length;++i)this._queue._tasks[i].data.progressChunk=chunk;this._onStart(),this._queue.resume()}return this},Object.defineProperty(Loader.prototype,"concurrency",{get:function(){return this._queue.concurrency},set:function(concurrency){this._queue.concurrency=concurrency},enumerable:!1,configurable:!0}),Loader.prototype._prepareUrl=function(url){var result,parsedUrl=parseUri(url,{strictMode:!0});if(result=parsedUrl.protocol||!parsedUrl.path||0===url.indexOf("//")?url:this.baseUrl.length&&this.baseUrl.lastIndexOf("/")!==this.baseUrl.length-1&&"/"!==url.charAt(0)?this.baseUrl+"/"+url:this.baseUrl+url,this.defaultQueryString){var hash=rgxExtractUrlHash.exec(result)[0];-1!==(result=result.slice(0,result.length-hash.length)).indexOf("?")?result+="&"+this.defaultQueryString:result+="?"+this.defaultQueryString,result+=hash}return result},Loader.prototype._loadResource=function(resource,dequeue){var _this=this;resource._dequeue=dequeue,AsyncQueue.eachSeries(this._beforeMiddleware,(function(fn,next){fn.call(_this,resource,(function(){next(resource.isComplete?{}:null)}))}),(function(){resource.isComplete?_this._onLoad(resource):(resource._onLoadBinding=resource.onComplete.once(_this._onLoad,_this),resource.load())}),!0)},Loader.prototype._onStart=function(){this.progress=0,this.loading=!0,this.onStart.dispatch(this)},Loader.prototype._onComplete=function(){this.progress=100,this.loading=!1,this.onComplete.dispatch(this,this.resources)},Loader.prototype._onLoad=function(resource){var _this=this;resource._onLoadBinding=null,this._resourcesParsing.push(resource),resource._dequeue(),AsyncQueue.eachSeries(this._afterMiddleware,(function(fn,next){fn.call(_this,resource,next)}),(function(){resource.onAfterMiddleware.dispatch(resource),_this.progress=Math.min(100,_this.progress+resource.progressChunk),_this.onProgress.dispatch(_this,resource),resource.error?_this.onError.dispatch(resource.error,_this,resource):_this.onLoad.dispatch(_this,resource),_this._resourcesParsing.splice(_this._resourcesParsing.indexOf(resource),1),_this._queue.idle()&&0===_this._resourcesParsing.length&&_this._onComplete()}),!0)},Loader.prototype.destroy=function(){this._protected||this.reset()},Object.defineProperty(Loader,"shared",{get:function(){var shared=Loader._shared;return shared||((shared=new Loader)._protected=!0,Loader._shared=shared),shared},enumerable:!1,configurable:!0}),Loader.registerPlugin=function(plugin){return Loader._plugins.push(plugin),plugin.add&&plugin.add(),Loader},Loader._plugins=[],Loader}();Loader.prototype.add=function(name,url,options,callback){if(Array.isArray(name)){for(var i=0;i<name.length;++i)this.add(name[i]);return this}if("object"==typeof name&&(options=name,callback=url||options.callback||options.onComplete,url=options.url,name=options.name||options.key||options.url),"string"!=typeof url&&(callback=options,options=url,url=name),"string"!=typeof url)throw new Error("No url passed to add resource to loader.");return"function"==typeof options&&(callback=options,options=null),this._add(name,url,options,callback)};var _a$2,INTERNAL_FORMATS,AppLoaderPlugin=function(){function AppLoaderPlugin(){}return AppLoaderPlugin.init=function(options){options=Object.assign({sharedLoader:!1},options),this.loader=options.sharedLoader?Loader.shared:new Loader},AppLoaderPlugin.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},AppLoaderPlugin}(),TextureLoader=function(){function TextureLoader(){}return TextureLoader.add=function(){LoaderResource.setExtensionLoadType("svg",LoaderResource.LOAD_TYPE.XHR),LoaderResource.setExtensionXhrType("svg",LoaderResource.XHR_RESPONSE_TYPE.TEXT)},TextureLoader.use=function(resource,next){if(!resource.data||resource.type!==LoaderResource.TYPE.IMAGE&&"svg"!==resource.extension)next();else{var data=resource.data,url=resource.url,name=resource.name,metadata=resource.metadata;Texture.fromLoader(data,url,name,metadata).then((function(texture){resource.texture=texture,next()})).catch(next)}},TextureLoader}();Loader.registerPlugin({use:function(resource,next){if(resource.data){if(resource.xhr&&resource.xhrType===LoaderResource.XHR_RESPONSE_TYPE.BLOB)if(self.Blob&&"string"!=typeof resource.data){if(0===resource.data.type.indexOf("image")){var Url_1=globalThis.URL||globalThis.webkitURL,src_1=Url_1.createObjectURL(resource.data);return resource.blob=resource.data,resource.data=new Image,resource.data.src=src_1,resource.type=LoaderResource.TYPE.IMAGE,void(resource.data.onload=function(){Url_1.revokeObjectURL(src_1),resource.data.onload=null,next()})}}else{var type=resource.xhr.getResponseHeader("content-type");if(type&&0===type.indexOf("image"))return resource.data=new Image,resource.data.src="data:"+type+";base64,"+function(input){for(var output="",inx=0;inx<input.length;){for(var bytebuffer=[0,0,0],encodedCharIndexes=[0,0,0,0],jnx=0;jnx<bytebuffer.length;++jnx)inx<input.length?bytebuffer[jnx]=255&input.charCodeAt(inx++):bytebuffer[jnx]=0;switch(encodedCharIndexes[0]=bytebuffer[0]>>2,encodedCharIndexes[1]=(3&bytebuffer[0])<<4|bytebuffer[1]>>4,encodedCharIndexes[2]=(15&bytebuffer[1])<<2|bytebuffer[2]>>6,encodedCharIndexes[3]=63&bytebuffer[2],inx-(input.length-1)){case 2:encodedCharIndexes[3]=64,encodedCharIndexes[2]=64;break;case 1:encodedCharIndexes[3]=64}for(jnx=0;jnx<encodedCharIndexes.length;++jnx)output+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(encodedCharIndexes[jnx])}return output}(resource.xhr.responseText),resource.type=LoaderResource.TYPE.IMAGE,void(resource.data.onload=function(){resource.data.onload=null,next()})}next()}else next()}}),Loader.registerPlugin(TextureLoader),function(INTERNAL_FORMATS){INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",INTERNAL_FORMATS[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL"}(INTERNAL_FORMATS||(INTERNAL_FORMATS={}));var INTERNAL_FORMAT_TO_BYTES_PER_PIXEL=((_a$2={})[INTERNAL_FORMATS.COMPRESSED_RGB_S3TC_DXT1_EXT]=.5,_a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT]=.5,_a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT]=1,_a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT]=1,_a$2[INTERNAL_FORMATS.COMPRESSED_SRGB_S3TC_DXT1_EXT]=.5,_a$2[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=.5,_a$2[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=1,_a$2[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=1,_a$2[INTERNAL_FORMATS.COMPRESSED_R11_EAC]=.5,_a$2[INTERNAL_FORMATS.COMPRESSED_SIGNED_R11_EAC]=.5,_a$2[INTERNAL_FORMATS.COMPRESSED_RG11_EAC]=1,_a$2[INTERNAL_FORMATS.COMPRESSED_SIGNED_RG11_EAC]=1,_a$2[INTERNAL_FORMATS.COMPRESSED_RGB8_ETC2]=.5,_a$2[INTERNAL_FORMATS.COMPRESSED_RGBA8_ETC2_EAC]=1,_a$2[INTERNAL_FORMATS.COMPRESSED_SRGB8_ETC2]=.5,_a$2[INTERNAL_FORMATS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=1,_a$2[INTERNAL_FORMATS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,_a$2[INTERNAL_FORMATS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=.5,_a$2[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=.5,_a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=.5,_a$2[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=.25,_a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=.25,_a$2[INTERNAL_FORMATS.COMPRESSED_RGB_ETC1_WEBGL]=.5,_a$2[INTERNAL_FORMATS.COMPRESSED_RGB_ATC_WEBGL]=.5,_a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=1,_a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=1,_a$2),extendStatics$5=function(d,b){return extendStatics$5=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$5(d,b)};
|
|
149
135
|
/*! *****************************************************************************
|
|
150
136
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
151
137
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -159,10 +145,10 @@ var LoaderResource=Resource$1,extendStatics$4=function(d,b){return(extendStatics
|
|
|
159
145
|
|
|
160
146
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
161
147
|
and limitations under the License.
|
|
162
|
-
***************************************************************************** */function __extends$5(d,b){function __(){this.constructor=d}extendStatics$5(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}!function(_super){function ParticleContainer(maxSize,properties,batchSize,autoResize){void 0===maxSize&&(maxSize=1500),void 0===batchSize&&(batchSize=16384),void 0===autoResize&&(autoResize=!1);var _this=_super.call(this)||this;return batchSize>16384&&(batchSize=16384),_this._properties=[!1,!0,!1,!1,!1],_this._maxSize=maxSize,_this._batchSize=batchSize,_this._buffers=null,_this._bufferUpdateIDs=[],_this._updateID=0,_this.interactiveChildren=!1,_this.blendMode=BLEND_MODES.NORMAL,_this.autoResize=autoResize,_this.roundPixels=!0,_this.baseTexture=null,_this.setProperties(properties),_this._tint=0,_this.tintRgb=new Float32Array(4),_this.tint=16777215,_this}__extends$5(ParticleContainer,_super),ParticleContainer.prototype.setProperties=function(properties){properties&&(this._properties[0]="vertices"in properties||"scale"in properties?!!properties.vertices||!!properties.scale:this._properties[0],this._properties[1]="position"in properties?!!properties.position:this._properties[1],this._properties[2]="rotation"in properties?!!properties.rotation:this._properties[2],this._properties[3]="uvs"in properties?!!properties.uvs:this._properties[3],this._properties[4]="tint"in properties||"alpha"in properties?!!properties.tint||!!properties.alpha:this._properties[4])},ParticleContainer.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(ParticleContainer.prototype,"tint",{get:function(){return this._tint},set:function(value){this._tint=value,hex2rgb(value,this.tintRgb)},enumerable:!1,configurable:!0}),ParticleContainer.prototype.render=function(renderer){var _this=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",(function(){return _this.onChildrenChange(0)}))),renderer.batch.setObjectRenderer(renderer.plugins.particle),renderer.plugins.particle.render(this))},ParticleContainer.prototype.onChildrenChange=function(smallestChildIndex){for(var bufferIndex=Math.floor(smallestChildIndex/this._batchSize);this._bufferUpdateIDs.length<bufferIndex;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[bufferIndex]=++this._updateID},ParticleContainer.prototype.dispose=function(){if(this._buffers){for(var i=0;i<this._buffers.length;++i)this._buffers[i].destroy();this._buffers=null}},ParticleContainer.prototype.destroy=function(options){_super.prototype.destroy.call(this,options),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null}}(Container);var LINE_JOIN,LINE_CAP,ParticleBuffer=function(){function ParticleBuffer(properties,dynamicPropertyFlags,size){this.geometry=new Geometry,this.indexBuffer=null,this.size=size,this.dynamicProperties=[],this.staticProperties=[];for(var i=0;i<properties.length;++i){var property=properties[i];property={attributeName:property.attributeName,size:property.size,uploadFunction:property.uploadFunction,type:property.type||TYPES.FLOAT,offset:property.offset},dynamicPropertyFlags[i]?this.dynamicProperties.push(property):this.staticProperties.push(property)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}return ParticleBuffer.prototype.initBuffers=function(){var geometry=this.geometry,dynamicOffset=0;this.indexBuffer=new Buffer(function(size,outBuffer){void 0===outBuffer&&(outBuffer=null);var totalIndices=6*size;if((outBuffer=outBuffer||new Uint16Array(totalIndices)).length!==totalIndices)throw new Error("Out buffer length is incorrect, got "+outBuffer.length+" and expected "+totalIndices);for(var i=0,j=0;i<totalIndices;i+=6,j+=4)outBuffer[i+0]=j+0,outBuffer[i+1]=j+1,outBuffer[i+2]=j+2,outBuffer[i+3]=j+0,outBuffer[i+4]=j+2,outBuffer[i+5]=j+3;return outBuffer}(this.size),!0,!0),geometry.addIndex(this.indexBuffer),this.dynamicStride=0;for(var i=0;i<this.dynamicProperties.length;++i){(property=this.dynamicProperties[i]).offset=dynamicOffset,dynamicOffset+=property.size,this.dynamicStride+=property.size}var dynBuffer=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(dynBuffer),this.dynamicDataUint32=new Uint32Array(dynBuffer),this.dynamicBuffer=new Buffer(this.dynamicData,!1,!1);var staticOffset=0;this.staticStride=0;for(i=0;i<this.staticProperties.length;++i){(property=this.staticProperties[i]).offset=staticOffset,staticOffset+=property.size,this.staticStride+=property.size}var statBuffer=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(statBuffer),this.staticDataUint32=new Uint32Array(statBuffer),this.staticBuffer=new Buffer(this.staticData,!0,!1);for(i=0;i<this.dynamicProperties.length;++i){var property=this.dynamicProperties[i];geometry.addAttribute(property.attributeName,this.dynamicBuffer,0,property.type===TYPES.UNSIGNED_BYTE,property.type,4*this.dynamicStride,4*property.offset)}for(i=0;i<this.staticProperties.length;++i){property=this.staticProperties[i];geometry.addAttribute(property.attributeName,this.staticBuffer,0,property.type===TYPES.UNSIGNED_BYTE,property.type,4*this.staticStride,4*property.offset)}},ParticleBuffer.prototype.uploadDynamic=function(children,startIndex,amount){for(var i=0;i<this.dynamicProperties.length;i++){var property=this.dynamicProperties[i];property.uploadFunction(children,startIndex,amount,property.type===TYPES.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,property.offset)}this.dynamicBuffer._updateID++},ParticleBuffer.prototype.uploadStatic=function(children,startIndex,amount){for(var i=0;i<this.staticProperties.length;i++){var property=this.staticProperties[i];property.uploadFunction(children,startIndex,amount,property.type===TYPES.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,property.offset)}this.staticBuffer._updateID++},ParticleBuffer.prototype.destroy=function(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()},ParticleBuffer}(),ParticleRenderer=function(_super){function ParticleRenderer(renderer){var _this=_super.call(this,renderer)||this;return _this.shader=null,_this.properties=null,_this.tempMatrix=new Matrix,_this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:_this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:_this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:_this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:_this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:TYPES.UNSIGNED_BYTE,uploadFunction:_this.uploadTint,offset:0}],_this.shader=Shader.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n","varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}",{}),_this.state=State.for2d(),_this}return __extends$5(ParticleRenderer,_super),ParticleRenderer.prototype.render=function(container){var children=container.children,maxSize=container._maxSize,batchSize=container._batchSize,renderer=this.renderer,totalChildren=children.length;if(0!==totalChildren){totalChildren>maxSize&&!container.autoResize&&(totalChildren=maxSize);var buffers=container._buffers;buffers||(buffers=container._buffers=this.generateBuffers(container));var baseTexture=children[0]._texture.baseTexture;this.state.blendMode=correctBlendMode(container.blendMode,baseTexture.alphaMode),renderer.state.set(this.state);var gl=renderer.gl,m=container.worldTransform.copyTo(this.tempMatrix);m.prepend(renderer.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=m.toArray(!0),this.shader.uniforms.uColor=function(rgb,alpha,out,premultiply){return out=out||new Float32Array(4),premultiply||void 0===premultiply?(out[0]=rgb[0]*alpha,out[1]=rgb[1]*alpha,out[2]=rgb[2]*alpha):(out[0]=rgb[0],out[1]=rgb[1],out[2]=rgb[2]),out[3]=alpha,out}(container.tintRgb,container.worldAlpha,this.shader.uniforms.uColor,baseTexture.alphaMode),this.shader.uniforms.uSampler=baseTexture,this.renderer.shader.bind(this.shader);for(var updateStatic=!1,i=0,j=0;i<totalChildren;i+=batchSize,j+=1){var amount=totalChildren-i;amount>batchSize&&(amount=batchSize),j>=buffers.length&&buffers.push(this._generateOneMoreBuffer(container));var buffer=buffers[j];buffer.uploadDynamic(children,i,amount);var bid=container._bufferUpdateIDs[j]||0;(updateStatic=updateStatic||buffer._updateID<bid)&&(buffer._updateID=container._updateID,buffer.uploadStatic(children,i,amount)),renderer.geometry.bind(buffer.geometry),gl.drawElements(gl.TRIANGLES,6*amount,gl.UNSIGNED_SHORT,0)}}},ParticleRenderer.prototype.generateBuffers=function(container){for(var buffers=[],size=container._maxSize,batchSize=container._batchSize,dynamicPropertyFlags=container._properties,i=0;i<size;i+=batchSize)buffers.push(new ParticleBuffer(this.properties,dynamicPropertyFlags,batchSize));return buffers},ParticleRenderer.prototype._generateOneMoreBuffer=function(container){var batchSize=container._batchSize,dynamicPropertyFlags=container._properties;return new ParticleBuffer(this.properties,dynamicPropertyFlags,batchSize)},ParticleRenderer.prototype.uploadVertices=function(children,startIndex,amount,array,stride,offset){for(var w0=0,w1=0,h0=0,h1=0,i=0;i<amount;++i){var sprite=children[startIndex+i],texture=sprite._texture,sx=sprite.scale.x,sy=sprite.scale.y,trim=texture.trim,orig=texture.orig;trim?(w0=(w1=trim.x-sprite.anchor.x*orig.width)+trim.width,h0=(h1=trim.y-sprite.anchor.y*orig.height)+trim.height):(w0=orig.width*(1-sprite.anchor.x),w1=orig.width*-sprite.anchor.x,h0=orig.height*(1-sprite.anchor.y),h1=orig.height*-sprite.anchor.y),array[offset]=w1*sx,array[offset+1]=h1*sy,array[offset+stride]=w0*sx,array[offset+stride+1]=h1*sy,array[offset+2*stride]=w0*sx,array[offset+2*stride+1]=h0*sy,array[offset+3*stride]=w1*sx,array[offset+3*stride+1]=h0*sy,offset+=4*stride}},ParticleRenderer.prototype.uploadPosition=function(children,startIndex,amount,array,stride,offset){for(var i=0;i<amount;i++){var spritePosition=children[startIndex+i].position;array[offset]=spritePosition.x,array[offset+1]=spritePosition.y,array[offset+stride]=spritePosition.x,array[offset+stride+1]=spritePosition.y,array[offset+2*stride]=spritePosition.x,array[offset+2*stride+1]=spritePosition.y,array[offset+3*stride]=spritePosition.x,array[offset+3*stride+1]=spritePosition.y,offset+=4*stride}},ParticleRenderer.prototype.uploadRotation=function(children,startIndex,amount,array,stride,offset){for(var i=0;i<amount;i++){var spriteRotation=children[startIndex+i].rotation;array[offset]=spriteRotation,array[offset+stride]=spriteRotation,array[offset+2*stride]=spriteRotation,array[offset+3*stride]=spriteRotation,offset+=4*stride}},ParticleRenderer.prototype.uploadUvs=function(children,startIndex,amount,array,stride,offset){for(var i=0;i<amount;++i){var textureUvs=children[startIndex+i]._texture._uvs;textureUvs?(array[offset]=textureUvs.x0,array[offset+1]=textureUvs.y0,array[offset+stride]=textureUvs.x1,array[offset+stride+1]=textureUvs.y1,array[offset+2*stride]=textureUvs.x2,array[offset+2*stride+1]=textureUvs.y2,array[offset+3*stride]=textureUvs.x3,array[offset+3*stride+1]=textureUvs.y3,offset+=4*stride):(array[offset]=0,array[offset+1]=0,array[offset+stride]=0,array[offset+stride+1]=0,array[offset+2*stride]=0,array[offset+2*stride+1]=0,array[offset+3*stride]=0,array[offset+3*stride+1]=0,offset+=4*stride)}},ParticleRenderer.prototype.uploadTint=function(children,startIndex,amount,array,stride,offset){for(var i=0;i<amount;++i){var sprite=children[startIndex+i],premultiplied=sprite._texture.baseTexture.alphaMode>0,alpha=sprite.alpha,argb=alpha<1&&premultiplied?premultiplyTint(sprite._tintRGB,alpha):sprite._tintRGB+(255*alpha<<24);array[offset]=argb,array[offset+stride]=argb,array[offset+2*stride]=argb,array[offset+3*stride]=argb,offset+=4*stride}},ParticleRenderer.prototype.destroy=function(){_super.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},ParticleRenderer}(ObjectRenderer);!function(LINE_JOIN){LINE_JOIN.MITER="miter",LINE_JOIN.BEVEL="bevel",LINE_JOIN.ROUND="round"}(LINE_JOIN||(LINE_JOIN={})),function(LINE_CAP){LINE_CAP.BUTT="butt",LINE_CAP.ROUND="round",LINE_CAP.SQUARE="square"}(LINE_CAP||(LINE_CAP={}));var GRAPHICS_CURVES={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(length,defaultSegments){if(void 0===defaultSegments&&(defaultSegments=20),!this.adaptive||!length||isNaN(length))return defaultSegments;var result=Math.ceil(length/this.maxLength);return result<this.minSegments?result=this.minSegments:result>this.maxSegments&&(result=this.maxSegments),result}},FillStyle=function(){function FillStyle(){this.color=16777215,this.alpha=1,this.texture=Texture.WHITE,this.matrix=null,this.visible=!1,this.reset()}return FillStyle.prototype.clone=function(){var obj=new FillStyle;return obj.color=this.color,obj.alpha=this.alpha,obj.texture=this.texture,obj.matrix=this.matrix,obj.visible=this.visible,obj},FillStyle.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=Texture.WHITE,this.matrix=null,this.visible=!1},FillStyle.prototype.destroy=function(){this.texture=null,this.matrix=null},FillStyle}(),extendStatics$6=function(d,b){return(extendStatics$6=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};function __extends$6(d,b){function __(){this.constructor=d}extendStatics$6(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var buildPoly={build:function(graphicsData){graphicsData.points=graphicsData.shape.points.slice()},triangulate:function(graphicsData,graphicsGeometry){var points=graphicsData.points,holes=graphicsData.holes,verts=graphicsGeometry.points,indices=graphicsGeometry.indices;if(points.length>=6){for(var holeArray=[],i=0;i<holes.length;i++){var hole=holes[i];holeArray.push(points.length/2),points=points.concat(hole.points)}var triangles=earcut_1(points,holeArray,2);if(!triangles)return;var vertPos=verts.length/2;for(i=0;i<triangles.length;i+=3)indices.push(triangles[i]+vertPos),indices.push(triangles[i+1]+vertPos),indices.push(triangles[i+2]+vertPos);for(i=0;i<points.length;i++)verts.push(points[i])}}},buildCircle={build:function(graphicsData){var width,height,circleData=graphicsData.shape,points=graphicsData.points,x=circleData.x,y=circleData.y;if(points.length=0,graphicsData.type===SHAPES.CIRC)width=circleData.radius,height=circleData.radius;else{var ellipseData=graphicsData.shape;width=ellipseData.width,height=ellipseData.height}if(0!==width&&0!==height){var totalSegs=Math.floor(30*Math.sqrt(circleData.radius))||Math.floor(15*Math.sqrt(width+height));totalSegs/=2.3;for(var seg=2*Math.PI/totalSegs,i=0;i<totalSegs-.5;i++)points.push(x+Math.sin(-seg*i)*width,y+Math.cos(-seg*i)*height);points.push(points[0],points[1])}},triangulate:function(graphicsData,graphicsGeometry){var points=graphicsData.points,verts=graphicsGeometry.points,indices=graphicsGeometry.indices,vertPos=verts.length/2,center=vertPos,circle=graphicsData.shape,matrix=graphicsData.matrix,x=circle.x,y=circle.y;verts.push(graphicsData.matrix?matrix.a*x+matrix.c*y+matrix.tx:x,graphicsData.matrix?matrix.b*x+matrix.d*y+matrix.ty:y);for(var i=0;i<points.length;i+=2)verts.push(points[i],points[i+1]),indices.push(vertPos++,center,vertPos)}};function getPt(n1,n2,perc){return n1+(n2-n1)*perc}function quadraticBezierCurve(fromX,fromY,cpX,cpY,toX,toY,out){void 0===out&&(out=[]);for(var points=out,xa=0,ya=0,xb=0,yb=0,x=0,y=0,i=0,j=0;i<=20;++i)xa=getPt(fromX,cpX,j=i/20),ya=getPt(fromY,cpY,j),xb=getPt(cpX,toX,j),yb=getPt(cpY,toY,j),x=getPt(xa,xb,j),y=getPt(ya,yb,j),points.push(x,y);return points}var buildRoundedRectangle={build:function(graphicsData){var rrectData=graphicsData.shape,points=graphicsData.points,x=rrectData.x,y=rrectData.y,width=rrectData.width,height=rrectData.height,radius=Math.max(0,Math.min(rrectData.radius,Math.min(width,height)/2));points.length=0,radius?(quadraticBezierCurve(x,y+radius,x,y,x+radius,y,points),quadraticBezierCurve(x+width-radius,y,x+width,y,x+width,y+radius,points),quadraticBezierCurve(x+width,y+height-radius,x+width,y+height,x+width-radius,y+height,points),quadraticBezierCurve(x+radius,y+height,x,y+height,x,y+height-radius,points)):points.push(x,y,x+width,y,x+width,y+height,x,y+height)},triangulate:function(graphicsData,graphicsGeometry){for(var points=graphicsData.points,verts=graphicsGeometry.points,indices=graphicsGeometry.indices,vecPos=verts.length/2,triangles=earcut_1(points,null,2),i=0,j=triangles.length;i<j;i+=3)indices.push(triangles[i]+vecPos),indices.push(triangles[i+1]+vecPos),indices.push(triangles[i+2]+vecPos);for(i=0,j=points.length;i<j;i++)verts.push(points[i],points[++i])}};function square(x,y,nx,ny,innerWeight,outerWeight,clockwise,verts){var exx,eyy;clockwise?(exx=ny,eyy=-nx):(exx=-ny,eyy=nx);var eix=x-nx*innerWeight+exx,eiy=y-ny*innerWeight+eyy,eox=x+nx*outerWeight+exx,eoy=y+ny*outerWeight+eyy;return verts.push(eix,eiy),verts.push(eox,eoy),2}function round(cx,cy,sx,sy,ex,ey,verts,clockwise){var cx2p0x=sx-cx,cy2p0y=sy-cy,angle0=Math.atan2(cx2p0x,cy2p0y),angle1=Math.atan2(ex-cx,ey-cy);clockwise&&angle0<angle1?angle0+=2*Math.PI:!clockwise&&angle0>angle1&&(angle1+=2*Math.PI);var startAngle=angle0,angleDiff=angle1-angle0,absAngleDiff=Math.abs(angleDiff),radius=Math.sqrt(cx2p0x*cx2p0x+cy2p0y*cy2p0y),segCount=1+(15*absAngleDiff*Math.sqrt(radius)/Math.PI>>0),angleInc=angleDiff/segCount;if(startAngle+=angleInc,clockwise){verts.push(cx,cy),verts.push(sx,sy);for(var i=1,angle=startAngle;i<segCount;i++,angle+=angleInc)verts.push(cx,cy),verts.push(cx+Math.sin(angle)*radius,cy+Math.cos(angle)*radius);verts.push(cx,cy),verts.push(ex,ey)}else{verts.push(sx,sy),verts.push(cx,cy);for(i=1,angle=startAngle;i<segCount;i++,angle+=angleInc)verts.push(cx+Math.sin(angle)*radius,cy+Math.cos(angle)*radius),verts.push(cx,cy);verts.push(ex,ey),verts.push(cx,cy)}return 2*segCount}function buildLine(graphicsData,graphicsGeometry){graphicsData.lineStyle.native?function(graphicsData,graphicsGeometry){var i=0,shape=graphicsData.shape,points=graphicsData.points||shape.points,closedShape=shape.type!==SHAPES.POLY||shape.closeStroke;if(0!==points.length){var verts=graphicsGeometry.points,indices=graphicsGeometry.indices,length=points.length/2,startIndex=verts.length/2,currentIndex=startIndex;for(verts.push(points[0],points[1]),i=1;i<length;i++)verts.push(points[2*i],points[2*i+1]),indices.push(currentIndex,currentIndex+1),currentIndex++;closedShape&&indices.push(currentIndex,startIndex)}}(graphicsData,graphicsGeometry):function(graphicsData,graphicsGeometry){var shape=graphicsData.shape,points=graphicsData.points||shape.points.slice(),eps=graphicsGeometry.closePointEps;if(0!==points.length){var style=graphicsData.lineStyle,firstPoint=new Point(points[0],points[1]),lastPoint=new Point(points[points.length-2],points[points.length-1]),closedShape=shape.type!==SHAPES.POLY||shape.closeStroke,closedPath=Math.abs(firstPoint.x-lastPoint.x)<eps&&Math.abs(firstPoint.y-lastPoint.y)<eps;if(closedShape){points=points.slice(),closedPath&&(points.pop(),points.pop(),lastPoint.set(points[points.length-2],points[points.length-1]));var midPointX=.5*(firstPoint.x+lastPoint.x),midPointY=.5*(lastPoint.y+firstPoint.y);points.unshift(midPointX,midPointY),points.push(midPointX,midPointY)}var verts=graphicsGeometry.points,length=points.length/2,indexCount=points.length,indexStart=verts.length/2,width=style.width/2,widthSquared=width*width,miterLimitSquared=style.miterLimit*style.miterLimit,x0=points[0],y0=points[1],x1=points[2],y1=points[3],x2=0,y2=0,perpx=-(y0-y1),perpy=x0-x1,perp1x=0,perp1y=0,dist=Math.sqrt(perpx*perpx+perpy*perpy);perpx/=dist,perpy/=dist,perpx*=width,perpy*=width;var ratio=style.alignment,innerWeight=2*(1-ratio),outerWeight=2*ratio;closedShape||(style.cap===LINE_CAP.ROUND?indexCount+=round(x0-perpx*(innerWeight-outerWeight)*.5,y0-perpy*(innerWeight-outerWeight)*.5,x0-perpx*innerWeight,y0-perpy*innerWeight,x0+perpx*outerWeight,y0+perpy*outerWeight,verts,!0)+2:style.cap===LINE_CAP.SQUARE&&(indexCount+=square(x0,y0,perpx,perpy,innerWeight,outerWeight,!0,verts))),verts.push(x0-perpx*innerWeight,y0-perpy*innerWeight),verts.push(x0+perpx*outerWeight,y0+perpy*outerWeight);for(var i=1;i<length-1;++i){x0=points[2*(i-1)],y0=points[2*(i-1)+1],x1=points[2*i],y1=points[2*i+1],x2=points[2*(i+1)],y2=points[2*(i+1)+1],perpx=-(y0-y1),perpy=x0-x1,perpx/=dist=Math.sqrt(perpx*perpx+perpy*perpy),perpy/=dist,perpx*=width,perpy*=width,perp1x=-(y1-y2),perp1y=x1-x2,perp1x/=dist=Math.sqrt(perp1x*perp1x+perp1y*perp1y),perp1y/=dist,perp1x*=width,perp1y*=width;var dx0=x1-x0,dy0=y0-y1,dx1=x1-x2,dy1=y2-y1,cross=dy0*dx1-dy1*dx0,clockwise=cross<0;if(Math.abs(cross)<.1)verts.push(x1-perpx*innerWeight,y1-perpy*innerWeight),verts.push(x1+perpx*outerWeight,y1+perpy*outerWeight);else{var c1=(-perpx+x0)*(-perpy+y1)-(-perpx+x1)*(-perpy+y0),c2=(-perp1x+x2)*(-perp1y+y1)-(-perp1x+x1)*(-perp1y+y2),px=(dx0*c2-dx1*c1)/cross,py=(dy1*c1-dy0*c2)/cross,pdist=(px-x1)*(px-x1)+(py-y1)*(py-y1),imx=x1+(px-x1)*innerWeight,imy=y1+(py-y1)*innerWeight,omx=x1-(px-x1)*outerWeight,omy=y1-(py-y1)*outerWeight,insideWeight=clockwise?innerWeight:outerWeight;pdist<=Math.min(dx0*dx0+dy0*dy0,dx1*dx1+dy1*dy1)+insideWeight*insideWeight*widthSquared?style.join===LINE_JOIN.BEVEL||pdist/widthSquared>miterLimitSquared?(clockwise?(verts.push(imx,imy),verts.push(x1+perpx*outerWeight,y1+perpy*outerWeight),verts.push(imx,imy),verts.push(x1+perp1x*outerWeight,y1+perp1y*outerWeight)):(verts.push(x1-perpx*innerWeight,y1-perpy*innerWeight),verts.push(omx,omy),verts.push(x1-perp1x*innerWeight,y1-perp1y*innerWeight),verts.push(omx,omy)),indexCount+=2):style.join===LINE_JOIN.ROUND?clockwise?(verts.push(imx,imy),verts.push(x1+perpx*outerWeight,y1+perpy*outerWeight),indexCount+=round(x1,y1,x1+perpx*outerWeight,y1+perpy*outerWeight,x1+perp1x*outerWeight,y1+perp1y*outerWeight,verts,!0)+4,verts.push(imx,imy),verts.push(x1+perp1x*outerWeight,y1+perp1y*outerWeight)):(verts.push(x1-perpx*innerWeight,y1-perpy*innerWeight),verts.push(omx,omy),indexCount+=round(x1,y1,x1-perpx*innerWeight,y1-perpy*innerWeight,x1-perp1x*innerWeight,y1-perp1y*innerWeight,verts,!1)+4,verts.push(x1-perp1x*innerWeight,y1-perp1y*innerWeight),verts.push(omx,omy)):(verts.push(imx,imy),verts.push(omx,omy)):(verts.push(x1-perpx*innerWeight,y1-perpy*innerWeight),verts.push(x1+perpx*outerWeight,y1+perpy*outerWeight),style.join===LINE_JOIN.BEVEL||pdist/widthSquared>miterLimitSquared||(style.join===LINE_JOIN.ROUND?indexCount+=clockwise?round(x1,y1,x1+perpx*outerWeight,y1+perpy*outerWeight,x1+perp1x*outerWeight,y1+perp1y*outerWeight,verts,!0)+2:round(x1,y1,x1-perpx*innerWeight,y1-perpy*innerWeight,x1-perp1x*innerWeight,y1-perp1y*innerWeight,verts,!1)+2:(clockwise?(verts.push(omx,omy),verts.push(omx,omy)):(verts.push(imx,imy),verts.push(imx,imy)),indexCount+=2)),verts.push(x1-perp1x*innerWeight,y1-perp1y*innerWeight),verts.push(x1+perp1x*outerWeight,y1+perp1y*outerWeight),indexCount+=2)}}x0=points[2*(length-2)],y0=points[2*(length-2)+1],x1=points[2*(length-1)],perpx=-(y0-(y1=points[2*(length-1)+1])),perpy=x0-x1,perpx/=dist=Math.sqrt(perpx*perpx+perpy*perpy),perpy/=dist,perpx*=width,perpy*=width,verts.push(x1-perpx*innerWeight,y1-perpy*innerWeight),verts.push(x1+perpx*outerWeight,y1+perpy*outerWeight),closedShape||(style.cap===LINE_CAP.ROUND?indexCount+=round(x1-perpx*(innerWeight-outerWeight)*.5,y1-perpy*(innerWeight-outerWeight)*.5,x1-perpx*innerWeight,y1-perpy*innerWeight,x1+perpx*outerWeight,y1+perpy*outerWeight,verts,!1)+2:style.cap===LINE_CAP.SQUARE&&(indexCount+=square(x1,y1,perpx,perpy,innerWeight,outerWeight,!1,verts)));var indices=graphicsGeometry.indices,eps2=GRAPHICS_CURVES.epsilon*GRAPHICS_CURVES.epsilon;for(i=indexStart;i<indexCount+indexStart-2;++i)x0=verts[2*i],y0=verts[2*i+1],x1=verts[2*(i+1)],y1=verts[2*(i+1)+1],x2=verts[2*(i+2)],y2=verts[2*(i+2)+1],Math.abs(x0*(y1-y2)+x1*(y2-y0)+x2*(y0-y1))<eps2||indices.push(i,i+1,i+2)}}(graphicsData,graphicsGeometry)}var _a,Star=function(_super){function Star(x,y,points,radius,innerRadius,rotation){void 0===rotation&&(rotation=0);innerRadius=innerRadius||radius/2;for(var startAngle=-1*Math.PI/2+rotation,len=2*points,delta=PI_2/len,polygon=[],i=0;i<len;i++){var r=i%2?innerRadius:radius,angle=i*delta+startAngle;polygon.push(x+r*Math.cos(angle),y+r*Math.sin(angle))}return _super.call(this,polygon)||this}return __extends$6(Star,_super),Star}(Polygon),ArcUtils=function(){function ArcUtils(){}return ArcUtils.curveTo=function(x1,y1,x2,y2,radius,points){var fromX=points[points.length-2],a1=points[points.length-1]-y1,b1=fromX-x1,a2=y2-y1,b2=x2-x1,mm=Math.abs(a1*b2-b1*a2);if(mm<1e-8||0===radius)return points[points.length-2]===x1&&points[points.length-1]===y1||points.push(x1,y1),null;var dd=a1*a1+b1*b1,cc=a2*a2+b2*b2,tt=a1*a2+b1*b2,k1=radius*Math.sqrt(dd)/mm,k2=radius*Math.sqrt(cc)/mm,j1=k1*tt/dd,j2=k2*tt/cc,cx=k1*b2+k2*b1,cy=k1*a2+k2*a1,px=b1*(k2+j1),py=a1*(k2+j1),qx=b2*(k1+j2),qy=a2*(k1+j2);return{cx:cx+x1,cy:cy+y1,radius:radius,startAngle:Math.atan2(py-cy,px-cx),endAngle:Math.atan2(qy-cy,qx-cx),anticlockwise:b1*a2>b2*a1}},ArcUtils.arc=function(_startX,_startY,cx,cy,radius,startAngle,endAngle,_anticlockwise,points){for(var sweep=endAngle-startAngle,n=GRAPHICS_CURVES._segmentsCount(Math.abs(sweep)*radius,40*Math.ceil(Math.abs(sweep)/PI_2)),theta=sweep/(2*n),theta2=2*theta,cTheta=Math.cos(theta),sTheta=Math.sin(theta),segMinus=n-1,remainder=segMinus%1/segMinus,i=0;i<=segMinus;++i){var angle=theta+startAngle+theta2*(i+remainder*i),c=Math.cos(angle),s=-Math.sin(angle);points.push((cTheta*c+sTheta*s)*radius+cx,(cTheta*-s+sTheta*c)*radius+cy)}},ArcUtils}(),BezierUtils=function(){function BezierUtils(){}return BezierUtils.curveLength=function(fromX,fromY,cpX,cpY,cpX2,cpY2,toX,toY){for(var result=0,t=0,t2=0,t3=0,nt=0,nt2=0,nt3=0,x=0,y=0,dx=0,dy=0,prevX=fromX,prevY=fromY,i=1;i<=10;++i)dx=prevX-(x=(nt3=(nt2=(nt=1-(t=i/10))*nt)*nt)*fromX+3*nt2*t*cpX+3*nt*(t2=t*t)*cpX2+(t3=t2*t)*toX),dy=prevY-(y=nt3*fromY+3*nt2*t*cpY+3*nt*t2*cpY2+t3*toY),prevX=x,prevY=y,result+=Math.sqrt(dx*dx+dy*dy);return result},BezierUtils.curveTo=function(cpX,cpY,cpX2,cpY2,toX,toY,points){var fromX=points[points.length-2],fromY=points[points.length-1];points.length-=2;var n=GRAPHICS_CURVES._segmentsCount(BezierUtils.curveLength(fromX,fromY,cpX,cpY,cpX2,cpY2,toX,toY)),dt=0,dt2=0,dt3=0,t2=0,t3=0;points.push(fromX,fromY);for(var i=1,j=0;i<=n;++i)dt3=(dt2=(dt=1-(j=i/n))*dt)*dt,t3=(t2=j*j)*j,points.push(dt3*fromX+3*dt2*j*cpX+3*dt*t2*cpX2+t3*toX,dt3*fromY+3*dt2*j*cpY+3*dt*t2*cpY2+t3*toY)},BezierUtils}(),QuadraticUtils=function(){function QuadraticUtils(){}return QuadraticUtils.curveLength=function(fromX,fromY,cpX,cpY,toX,toY){var ax=fromX-2*cpX+toX,ay=fromY-2*cpY+toY,bx=2*cpX-2*fromX,by=2*cpY-2*fromY,a=4*(ax*ax+ay*ay),b=4*(ax*bx+ay*by),c=bx*bx+by*by,s=2*Math.sqrt(a+b+c),a2=Math.sqrt(a),a32=2*a*a2,c2=2*Math.sqrt(c),ba=b/a2;return(a32*s+a2*b*(s-c2)+(4*c*a-b*b)*Math.log((2*a2+ba+s)/(ba+c2)))/(4*a32)},QuadraticUtils.curveTo=function(cpX,cpY,toX,toY,points){for(var fromX=points[points.length-2],fromY=points[points.length-1],n=GRAPHICS_CURVES._segmentsCount(QuadraticUtils.curveLength(fromX,fromY,cpX,cpY,toX,toY)),xa=0,ya=0,i=1;i<=n;++i){var j=i/n;xa=fromX+(cpX-fromX)*j,ya=fromY+(cpY-fromY)*j,points.push(xa+(cpX+(toX-cpX)*j-xa)*j,ya+(cpY+(toY-cpY)*j-ya)*j)}},QuadraticUtils}(),BatchPart=function(){function BatchPart(){this.reset()}return BatchPart.prototype.begin=function(style,startIndex,attribStart){this.reset(),this.style=style,this.start=startIndex,this.attribStart=attribStart},BatchPart.prototype.end=function(endIndex,endAttrib){this.attribSize=endAttrib-this.attribStart,this.size=endIndex-this.start},BatchPart.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},BatchPart}(),FILL_COMMANDS=((_a={})[SHAPES.POLY]=buildPoly,_a[SHAPES.CIRC]=buildCircle,_a[SHAPES.ELIP]=buildCircle,_a[SHAPES.RECT]={build:function(graphicsData){var rectData=graphicsData.shape,x=rectData.x,y=rectData.y,width=rectData.width,height=rectData.height,points=graphicsData.points;points.length=0,points.push(x,y,x+width,y,x+width,y+height,x,y+height)},triangulate:function(graphicsData,graphicsGeometry){var points=graphicsData.points,verts=graphicsGeometry.points,vertPos=verts.length/2;verts.push(points[0],points[1],points[2],points[3],points[6],points[7],points[4],points[5]),graphicsGeometry.indices.push(vertPos,vertPos+1,vertPos+2,vertPos+1,vertPos+2,vertPos+3)}},_a[SHAPES.RREC]=buildRoundedRectangle,_a),BATCH_POOL=[],DRAW_CALL_POOL=[],GraphicsData=function(){function GraphicsData(shape,fillStyle,lineStyle,matrix){void 0===fillStyle&&(fillStyle=null),void 0===lineStyle&&(lineStyle=null),void 0===matrix&&(matrix=null),this.shape=shape,this.lineStyle=lineStyle,this.fillStyle=fillStyle,this.matrix=matrix,this.type=shape.type,this.points=[],this.holes=[]}return GraphicsData.prototype.clone=function(){return new GraphicsData(this.shape,this.fillStyle,this.lineStyle,this.matrix)},GraphicsData.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},GraphicsData}(),tmpPoint=new Point,tmpBounds=new Bounds,GraphicsGeometry=function(_super){function GraphicsGeometry(){var _this=_super.call(this)||this;return _this.uvsFloat32=null,_this.indicesUint16=null,_this.points=[],_this.colors=[],_this.uvs=[],_this.indices=[],_this.textureIds=[],_this.graphicsData=[],_this.dirty=0,_this.batchDirty=-1,_this.cacheDirty=-1,_this.clearDirty=0,_this.drawCalls=[],_this.batches=[],_this.shapeIndex=0,_this._bounds=new Bounds,_this.boundsDirty=-1,_this.boundsPadding=0,_this.batchable=!1,_this.indicesUint16=null,_this.uvsFloat32=null,_this.closePointEps=1e-4,_this}return __extends$6(GraphicsGeometry,_super),Object.defineProperty(GraphicsGeometry.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),GraphicsGeometry.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var i=0;i<this.drawCalls.length;i++)this.drawCalls[i].texArray.clear(),DRAW_CALL_POOL.push(this.drawCalls[i]);this.drawCalls.length=0;for(i=0;i<this.batches.length;i++){var batchPart=this.batches[i];batchPart.reset(),BATCH_POOL.push(batchPart)}this.batches.length=0},GraphicsGeometry.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},GraphicsGeometry.prototype.drawShape=function(shape,fillStyle,lineStyle,matrix){void 0===fillStyle&&(fillStyle=null),void 0===lineStyle&&(lineStyle=null),void 0===matrix&&(matrix=null);var data=new GraphicsData(shape,fillStyle,lineStyle,matrix);return this.graphicsData.push(data),this.dirty++,this},GraphicsGeometry.prototype.drawHole=function(shape,matrix){if(void 0===matrix&&(matrix=null),!this.graphicsData.length)return null;var data=new GraphicsData(shape,null,null,matrix),lastShape=this.graphicsData[this.graphicsData.length-1];return data.lineStyle=lastShape.lineStyle,lastShape.holes.push(data),this.dirty++,this},GraphicsGeometry.prototype.destroy=function(){_super.prototype.destroy.call(this);for(var i=0;i<this.graphicsData.length;++i)this.graphicsData[i].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},GraphicsGeometry.prototype.containsPoint=function(point){for(var graphicsData=this.graphicsData,i=0;i<graphicsData.length;++i){var data=graphicsData[i];if(data.fillStyle.visible&&(data.shape&&(data.matrix?data.matrix.applyInverse(point,tmpPoint):tmpPoint.copyFrom(point),data.shape.contains(tmpPoint.x,tmpPoint.y)))){var hitHole=!1;if(data.holes)for(var i_1=0;i_1<data.holes.length;i_1++){if(data.holes[i_1].shape.contains(tmpPoint.x,tmpPoint.y)){hitHole=!0;break}}if(!hitHole)return!0}}return!1},GraphicsGeometry.prototype.updateBatches=function(allow32Indices){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var uvs=this.uvs,graphicsData=this.graphicsData,batchPart=null,currentStyle=null;this.batches.length>0&&(currentStyle=(batchPart=this.batches[this.batches.length-1]).style);for(var i=this.shapeIndex;i<graphicsData.length;i++){this.shapeIndex++;var data=graphicsData[i],fillStyle=data.fillStyle,lineStyle=data.lineStyle;FILL_COMMANDS[data.type].build(data),data.matrix&&this.transformPoints(data.points,data.matrix);for(var j=0;j<2;j++){var style=0===j?fillStyle:lineStyle;if(style.visible){var nextTexture=style.texture.baseTexture,index_1=this.indices.length,attribIndex=this.points.length/2;nextTexture.wrapMode=WRAP_MODES.REPEAT,0===j?this.processFill(data):this.processLine(data);var size=this.points.length/2-attribIndex;0!==size&&(batchPart&&!this._compareStyles(currentStyle,style)&&(batchPart.end(index_1,attribIndex),batchPart=null),batchPart||((batchPart=BATCH_POOL.pop()||new BatchPart).begin(style,index_1,attribIndex),this.batches.push(batchPart),currentStyle=style),this.addUvs(this.points,uvs,style.texture,attribIndex,size,style.matrix))}}}var index=this.indices.length,attrib=this.points.length/2;if(batchPart&&batchPart.end(index,attrib),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var need32=attrib>65535&&allow32Indices;this.indicesUint16=need32?new Uint32Array(this.indices):new Uint16Array(this.indices)}this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},GraphicsGeometry.prototype._compareStyles=function(styleA,styleB){return!(!styleA||!styleB)&&(styleA.texture.baseTexture===styleB.texture.baseTexture&&(styleA.color+styleA.alpha===styleB.color+styleB.alpha&&!!styleA.native==!!styleB.native))},GraphicsGeometry.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var i=0,l=this.graphicsData.length;i<l;i++){var data=this.graphicsData[i],fill=data.fillStyle,line=data.lineStyle;if(fill&&!fill.texture.baseTexture.valid)return!1;if(line&&!line.texture.baseTexture.valid)return!1}return!0},GraphicsGeometry.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var batches=this.batches,i=0,l=batches.length;i<l;i++)for(var batch=batches[i],j=0;j<batch.size;j++){var index=batch.start+j;this.indicesUint16[index]=this.indicesUint16[index]-batch.attribStart}},GraphicsGeometry.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var batches=this.batches,i=0;i<batches.length;i++)if(batches[i].style.native)return!1;return this.points.length<2*GraphicsGeometry.BATCHABLE_SIZE},GraphicsGeometry.prototype.buildDrawCalls=function(){for(var TICK=++BaseTexture._globalBatch,i=0;i<this.drawCalls.length;i++)this.drawCalls[i].texArray.clear(),DRAW_CALL_POOL.push(this.drawCalls[i]);this.drawCalls.length=0;var colors=this.colors,textureIds=this.textureIds,currentGroup=DRAW_CALL_POOL.pop();currentGroup||((currentGroup=new BatchDrawCall).texArray=new BatchTextureArray),currentGroup.texArray.count=0,currentGroup.start=0,currentGroup.size=0,currentGroup.type=DRAW_MODES.TRIANGLES;var textureCount=0,currentTexture=null,textureId=0,native=!1,drawMode=DRAW_MODES.TRIANGLES,index=0;this.drawCalls.push(currentGroup);for(i=0;i<this.batches.length;i++){var data=this.batches[i],style=data.style,nextTexture=style.texture.baseTexture;native!==!!style.native&&(drawMode=(native=!!style.native)?DRAW_MODES.LINES:DRAW_MODES.TRIANGLES,currentTexture=null,textureCount=8,TICK++),currentTexture!==nextTexture&&(currentTexture=nextTexture,nextTexture._batchEnabled!==TICK&&(8===textureCount&&(TICK++,textureCount=0,currentGroup.size>0&&((currentGroup=DRAW_CALL_POOL.pop())||((currentGroup=new BatchDrawCall).texArray=new BatchTextureArray),this.drawCalls.push(currentGroup)),currentGroup.start=index,currentGroup.size=0,currentGroup.texArray.count=0,currentGroup.type=drawMode),nextTexture.touched=1,nextTexture._batchEnabled=TICK,nextTexture._batchLocation=textureCount,nextTexture.wrapMode=10497,currentGroup.texArray.elements[currentGroup.texArray.count++]=nextTexture,textureCount++)),currentGroup.size+=data.size,index+=data.size,textureId=nextTexture._batchLocation,this.addColors(colors,style.color,style.alpha,data.attribSize,data.attribStart),this.addTextureIds(textureIds,textureId,data.attribSize,data.attribStart)}BaseTexture._globalBatch=TICK,this.packAttributes()},GraphicsGeometry.prototype.packAttributes=function(){for(var verts=this.points,uvs=this.uvs,colors=this.colors,textureIds=this.textureIds,glPoints=new ArrayBuffer(3*verts.length*4),f32=new Float32Array(glPoints),u32=new Uint32Array(glPoints),p=0,i=0;i<verts.length/2;i++)f32[p++]=verts[2*i],f32[p++]=verts[2*i+1],f32[p++]=uvs[2*i],f32[p++]=uvs[2*i+1],u32[p++]=colors[i],f32[p++]=textureIds[i];this._buffer.update(glPoints),this._indexBuffer.update(this.indicesUint16)},GraphicsGeometry.prototype.processFill=function(data){data.holes.length?(this.processHoles(data.holes),buildPoly.triangulate(data,this)):FILL_COMMANDS[data.type].triangulate(data,this)},GraphicsGeometry.prototype.processLine=function(data){buildLine(data,this);for(var i=0;i<data.holes.length;i++)buildLine(data.holes[i],this)},GraphicsGeometry.prototype.processHoles=function(holes){for(var i=0;i<holes.length;i++){var hole=holes[i];FILL_COMMANDS[hole.type].build(hole),hole.matrix&&this.transformPoints(hole.points,hole.matrix)}},GraphicsGeometry.prototype.calculateBounds=function(){var bounds=this._bounds,sequenceBounds=tmpBounds,curMatrix=Matrix.IDENTITY;this._bounds.clear(),sequenceBounds.clear();for(var i=0;i<this.graphicsData.length;i++){var data=this.graphicsData[i],shape=data.shape,type=data.type,lineStyle=data.lineStyle,nextMatrix=data.matrix||Matrix.IDENTITY,lineWidth=0;if(lineStyle&&lineStyle.visible){var alignment=lineStyle.alignment;lineWidth=lineStyle.width,type===SHAPES.POLY?lineWidth*=.5+Math.abs(.5-alignment):lineWidth*=Math.max(0,alignment)}if(curMatrix!==nextMatrix&&(sequenceBounds.isEmpty()||(bounds.addBoundsMatrix(sequenceBounds,curMatrix),sequenceBounds.clear()),curMatrix=nextMatrix),type===SHAPES.RECT||type===SHAPES.RREC){var rect=shape;sequenceBounds.addFramePad(rect.x,rect.y,rect.x+rect.width,rect.y+rect.height,lineWidth,lineWidth)}else if(type===SHAPES.CIRC){var circle=shape;sequenceBounds.addFramePad(circle.x,circle.y,circle.x,circle.y,circle.radius+lineWidth,circle.radius+lineWidth)}else if(type===SHAPES.ELIP){var ellipse=shape;sequenceBounds.addFramePad(ellipse.x,ellipse.y,ellipse.x,ellipse.y,ellipse.width+lineWidth,ellipse.height+lineWidth)}else{var poly=shape;bounds.addVerticesMatrix(curMatrix,poly.points,0,poly.points.length,lineWidth,lineWidth)}}sequenceBounds.isEmpty()||bounds.addBoundsMatrix(sequenceBounds,curMatrix),bounds.pad(this.boundsPadding,this.boundsPadding)},GraphicsGeometry.prototype.transformPoints=function(points,matrix){for(var i=0;i<points.length/2;i++){var x=points[2*i],y=points[2*i+1];points[2*i]=matrix.a*x+matrix.c*y+matrix.tx,points[2*i+1]=matrix.b*x+matrix.d*y+matrix.ty}},GraphicsGeometry.prototype.addColors=function(colors,color,alpha,size,offset){void 0===offset&&(offset=0);var rgba=premultiplyTint((color>>16)+(65280&color)+((255&color)<<16),alpha);colors.length=Math.max(colors.length,offset+size);for(var i=0;i<size;i++)colors[offset+i]=rgba},GraphicsGeometry.prototype.addTextureIds=function(textureIds,id,size,offset){void 0===offset&&(offset=0),textureIds.length=Math.max(textureIds.length,offset+size);for(var i=0;i<size;i++)textureIds[offset+i]=id},GraphicsGeometry.prototype.addUvs=function(verts,uvs,texture,start,size,matrix){void 0===matrix&&(matrix=null);for(var index=0,uvsStart=uvs.length,frame=texture.frame;index<size;){var x=verts[2*(start+index)],y=verts[2*(start+index)+1];if(matrix){var nx=matrix.a*x+matrix.c*y+matrix.tx;y=matrix.b*x+matrix.d*y+matrix.ty,x=nx}index++,uvs.push(x/frame.width,y/frame.height)}var baseTexture=texture.baseTexture;(frame.width<baseTexture.width||frame.height<baseTexture.height)&&this.adjustUvs(uvs,texture,uvsStart,size)},GraphicsGeometry.prototype.adjustUvs=function(uvs,texture,start,size){for(var baseTexture=texture.baseTexture,eps=1e-6,finish=start+2*size,frame=texture.frame,scaleX=frame.width/baseTexture.width,scaleY=frame.height/baseTexture.height,offsetX=frame.x/frame.width,offsetY=frame.y/frame.height,minX=Math.floor(uvs[start]+eps),minY=Math.floor(uvs[start+1]+eps),i=start+2;i<finish;i+=2)minX=Math.min(minX,Math.floor(uvs[i]+eps)),minY=Math.min(minY,Math.floor(uvs[i+1]+eps));offsetX-=minX,offsetY-=minY;for(i=start;i<finish;i+=2)uvs[i]=(uvs[i]+offsetX)*scaleX,uvs[i+1]=(uvs[i+1]+offsetY)*scaleY},GraphicsGeometry.BATCHABLE_SIZE=100,GraphicsGeometry}(BatchGeometry),LineStyle=function(_super){function LineStyle(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.width=0,_this.alignment=.5,_this.native=!1,_this.cap=LINE_CAP.BUTT,_this.join=LINE_JOIN.MITER,_this.miterLimit=10,_this}return __extends$6(LineStyle,_super),LineStyle.prototype.clone=function(){var obj=new LineStyle;return obj.color=this.color,obj.alpha=this.alpha,obj.texture=this.texture,obj.matrix=this.matrix,obj.visible=this.visible,obj.width=this.width,obj.alignment=this.alignment,obj.native=this.native,obj.cap=this.cap,obj.join=this.join,obj.miterLimit=this.miterLimit,obj},LineStyle.prototype.reset=function(){_super.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},LineStyle}(FillStyle),temp=new Float32Array(3),DEFAULT_SHADERS={},Graphics=function(_super){function Graphics(geometry){void 0===geometry&&(geometry=null);var _this=_super.call(this)||this;return _this._geometry=geometry||new GraphicsGeometry,_this._geometry.refCount++,_this.shader=null,_this.state=State.for2d(),_this._fillStyle=new FillStyle,_this._lineStyle=new LineStyle,_this._matrix=null,_this._holeMode=!1,_this.currentPath=null,_this.batches=[],_this.batchTint=-1,_this.batchDirty=-1,_this.vertexData=null,_this.pluginName="batch",_this._transformID=-1,_this.tint=16777215,_this.blendMode=BLEND_MODES.NORMAL,_this}return __extends$6(Graphics,_super),Object.defineProperty(Graphics.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),Graphics.prototype.clone=function(){return this.finishPoly(),new Graphics(this._geometry)},Object.defineProperty(Graphics.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(value){this.state.blendMode=value},enumerable:!1,configurable:!0}),Object.defineProperty(Graphics.prototype,"tint",{get:function(){return this._tint},set:function(value){this._tint=value},enumerable:!1,configurable:!0}),Object.defineProperty(Graphics.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(Graphics.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),Graphics.prototype.lineStyle=function(options){if(void 0===options&&(options=null),"number"==typeof options){var args=arguments;options={width:args[0]||0,color:args[1]||0,alpha:void 0!==args[2]?args[2]:1,alignment:void 0!==args[3]?args[3]:.5,native:!!args[4]}}return this.lineTextureStyle(options)},Graphics.prototype.lineTextureStyle=function(options){if("number"==typeof options){deprecation("v5.2.0","Please use object-based options for Graphics#lineTextureStyle");var _a=arguments,width=_a[0],texture=_a[1],color=_a[2],alpha=_a[3],matrix=_a[4],alignment=_a[5],native=_a[6];options={width:width,texture:texture,color:color,alpha:alpha,matrix:matrix,alignment:alignment,native:native},Object.keys(options).forEach((function(key){return void 0===options[key]&&delete options[key]}))}options=Object.assign({width:0,texture:Texture.WHITE,color:options&&options.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:LINE_CAP.BUTT,join:LINE_JOIN.MITER,miterLimit:10},options),this.currentPath&&this.startPoly();var visible=options.width>0&&options.alpha>0;return visible?(options.matrix&&(options.matrix=options.matrix.clone(),options.matrix.invert()),Object.assign(this._lineStyle,{visible:visible},options)):this._lineStyle.reset(),this},Graphics.prototype.startPoly=function(){if(this.currentPath){var points=this.currentPath.points,len=this.currentPath.points.length;len>2&&(this.drawShape(this.currentPath),this.currentPath=new Polygon,this.currentPath.closeStroke=!1,this.currentPath.points.push(points[len-2],points[len-1]))}else this.currentPath=new Polygon,this.currentPath.closeStroke=!1},Graphics.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},Graphics.prototype.moveTo=function(x,y){return this.startPoly(),this.currentPath.points[0]=x,this.currentPath.points[1]=y,this},Graphics.prototype.lineTo=function(x,y){this.currentPath||this.moveTo(0,0);var points=this.currentPath.points,fromX=points[points.length-2],fromY=points[points.length-1];return fromX===x&&fromY===y||points.push(x,y),this},Graphics.prototype._initCurve=function(x,y){void 0===x&&(x=0),void 0===y&&(y=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[x,y]):this.moveTo(x,y)},Graphics.prototype.quadraticCurveTo=function(cpX,cpY,toX,toY){this._initCurve();var points=this.currentPath.points;return 0===points.length&&this.moveTo(0,0),QuadraticUtils.curveTo(cpX,cpY,toX,toY,points),this},Graphics.prototype.bezierCurveTo=function(cpX,cpY,cpX2,cpY2,toX,toY){return this._initCurve(),BezierUtils.curveTo(cpX,cpY,cpX2,cpY2,toX,toY,this.currentPath.points),this},Graphics.prototype.arcTo=function(x1,y1,x2,y2,radius){this._initCurve(x1,y1);var points=this.currentPath.points,result=ArcUtils.curveTo(x1,y1,x2,y2,radius,points);if(result){var cx=result.cx,cy=result.cy,radius_1=result.radius,startAngle=result.startAngle,endAngle=result.endAngle,anticlockwise=result.anticlockwise;this.arc(cx,cy,radius_1,startAngle,endAngle,anticlockwise)}return this},Graphics.prototype.arc=function(cx,cy,radius,startAngle,endAngle,anticlockwise){if(void 0===anticlockwise&&(anticlockwise=!1),startAngle===endAngle)return this;if(!anticlockwise&&endAngle<=startAngle?endAngle+=PI_2:anticlockwise&&startAngle<=endAngle&&(startAngle+=PI_2),0===endAngle-startAngle)return this;var startX=cx+Math.cos(startAngle)*radius,startY=cy+Math.sin(startAngle)*radius,eps=this._geometry.closePointEps,points=this.currentPath?this.currentPath.points:null;if(points){var xDiff=Math.abs(points[points.length-2]-startX),yDiff=Math.abs(points[points.length-1]-startY);xDiff<eps&&yDiff<eps||points.push(startX,startY)}else this.moveTo(startX,startY),points=this.currentPath.points;return ArcUtils.arc(startX,startY,cx,cy,radius,startAngle,endAngle,anticlockwise,points),this},Graphics.prototype.beginFill=function(color,alpha){return void 0===color&&(color=0),void 0===alpha&&(alpha=1),this.beginTextureFill({texture:Texture.WHITE,color:color,alpha:alpha})},Graphics.prototype.beginTextureFill=function(options){if(options instanceof Texture){deprecation("v5.2.0","Please use object-based options for Graphics#beginTextureFill");var _a=arguments,texture=_a[0],color=_a[1],alpha=_a[2],matrix=_a[3];options={texture:texture,color:color,alpha:alpha,matrix:matrix},Object.keys(options).forEach((function(key){return void 0===options[key]&&delete options[key]}))}options=Object.assign({texture:Texture.WHITE,color:16777215,alpha:1,matrix:null},options),this.currentPath&&this.startPoly();var visible=options.alpha>0;return visible?(options.matrix&&(options.matrix=options.matrix.clone(),options.matrix.invert()),Object.assign(this._fillStyle,{visible:visible},options)):this._fillStyle.reset(),this},Graphics.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},Graphics.prototype.drawRect=function(x,y,width,height){return this.drawShape(new Rectangle(x,y,width,height))},Graphics.prototype.drawRoundedRect=function(x,y,width,height,radius){return this.drawShape(new RoundedRectangle(x,y,width,height,radius))},Graphics.prototype.drawCircle=function(x,y,radius){return this.drawShape(new Circle(x,y,radius))},Graphics.prototype.drawEllipse=function(x,y,width,height){return this.drawShape(new Ellipse(x,y,width,height))},Graphics.prototype.drawPolygon=function(){for(var points,arguments$1=arguments,path=[],_i=0;_i<arguments.length;_i++)path[_i]=arguments$1[_i];var closeStroke=!0,poly=path[0];poly.points?(closeStroke=poly.closeStroke,points=poly.points):points=Array.isArray(path[0])?path[0]:path;var shape=new Polygon(points);return shape.closeStroke=closeStroke,this.drawShape(shape),this},Graphics.prototype.drawShape=function(shape){return this._holeMode?this._geometry.drawHole(shape,this._matrix):this._geometry.drawShape(shape,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},Graphics.prototype.drawStar=function(x,y,points,radius,innerRadius,rotation){return void 0===rotation&&(rotation=0),this.drawPolygon(new Star(x,y,points,radius,innerRadius,rotation))},Graphics.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},Graphics.prototype.isFastRect=function(){var data=this._geometry.graphicsData;return 1===data.length&&data[0].shape.type===SHAPES.RECT&&!(data[0].lineStyle.visible&&data[0].lineStyle.width)},Graphics.prototype._render=function(renderer){this.finishPoly();var geometry=this._geometry,hasuint32=renderer.context.supports.uint32Indices;geometry.updateBatches(hasuint32),geometry.batchable?(this.batchDirty!==geometry.batchDirty&&this._populateBatches(),this._renderBatched(renderer)):(renderer.batch.flush(),this._renderDirect(renderer))},Graphics.prototype._populateBatches=function(){var geometry=this._geometry,blendMode=this.blendMode,len=geometry.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=geometry.batchDirty,this.batches.length=len,this.vertexData=new Float32Array(geometry.points);for(var i=0;i<len;i++){var gI=geometry.batches[i],color=gI.style.color,vertexData=new Float32Array(this.vertexData.buffer,4*gI.attribStart*2,2*gI.attribSize),uvs=new Float32Array(geometry.uvsFloat32.buffer,4*gI.attribStart*2,2*gI.attribSize),batch={vertexData:vertexData,blendMode:blendMode,indices:new Uint16Array(geometry.indicesUint16.buffer,2*gI.start,gI.size),uvs:uvs,_batchRGB:hex2rgb(color),_tintRGB:color,_texture:gI.style.texture,alpha:gI.style.alpha,worldAlpha:1};this.batches[i]=batch}},Graphics.prototype._renderBatched=function(renderer){if(this.batches.length){renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var i=0,l=this.batches.length;i<l;i++){var batch=this.batches[i];batch.worldAlpha=this.worldAlpha*batch.alpha,renderer.plugins[this.pluginName].render(batch)}}},Graphics.prototype._renderDirect=function(renderer){var shader=this._resolveDirectShader(renderer),geometry=this._geometry,tint=this.tint,worldAlpha=this.worldAlpha,uniforms=shader.uniforms,drawCalls=geometry.drawCalls;uniforms.translationMatrix=this.transform.worldTransform,uniforms.tint[0]=(tint>>16&255)/255*worldAlpha,uniforms.tint[1]=(tint>>8&255)/255*worldAlpha,uniforms.tint[2]=(255&tint)/255*worldAlpha,uniforms.tint[3]=worldAlpha,renderer.shader.bind(shader),renderer.geometry.bind(geometry,shader),renderer.state.set(this.state);for(var i=0,l=drawCalls.length;i<l;i++)this._renderDrawCallDirect(renderer,geometry.drawCalls[i])},Graphics.prototype._renderDrawCallDirect=function(renderer,drawCall){for(var texArray=drawCall.texArray,type=drawCall.type,size=drawCall.size,start=drawCall.start,groupTextureCount=texArray.count,j=0;j<groupTextureCount;j++)renderer.texture.bind(texArray.elements[j],j);renderer.geometry.draw(type,size,start)},Graphics.prototype._resolveDirectShader=function(renderer){var shader=this.shader,pluginName=this.pluginName;if(!shader){if(!DEFAULT_SHADERS[pluginName]){for(var MAX_TEXTURES=renderer.plugins.batch.MAX_TEXTURES,sampleValues=new Int32Array(MAX_TEXTURES),i=0;i<MAX_TEXTURES;i++)sampleValues[i]=i;var uniforms={tint:new Float32Array([1,1,1,1]),translationMatrix:new Matrix,default:UniformGroup.from({uSamplers:sampleValues},!0)},program=renderer.plugins[pluginName]._shader.program;DEFAULT_SHADERS[pluginName]=new Shader(program,uniforms)}shader=DEFAULT_SHADERS[pluginName]}return shader},Graphics.prototype._calculateBounds=function(){this.finishPoly();var geometry=this._geometry;if(geometry.graphicsData.length){var _a=geometry.bounds,minX=_a.minX,minY=_a.minY,maxX=_a.maxX,maxY=_a.maxY;this._bounds.addFrame(this.transform,minX,minY,maxX,maxY)}},Graphics.prototype.containsPoint=function(point){return this.worldTransform.applyInverse(point,Graphics._TEMP_POINT),this._geometry.containsPoint(Graphics._TEMP_POINT)},Graphics.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var tintRGB=hex2rgb(this.tint,temp),i=0;i<this.batches.length;i++){var batch=this.batches[i],batchTint=batch._batchRGB,color=(tintRGB[0]*batchTint[0]*255<<16)+(tintRGB[1]*batchTint[1]*255<<8)+(0|tintRGB[2]*batchTint[2]*255);batch._tintRGB=(color>>16)+(65280&color)+((255&color)<<16)}}},Graphics.prototype.calculateVertices=function(){var wtID=this.transform._worldID;if(this._transformID!==wtID){this._transformID=wtID;for(var wt=this.transform.worldTransform,a=wt.a,b=wt.b,c=wt.c,d=wt.d,tx=wt.tx,ty=wt.ty,data=this._geometry.points,vertexData=this.vertexData,count=0,i=0;i<data.length;i+=2){var x=data[i],y=data[i+1];vertexData[count++]=a*x+c*y+tx,vertexData[count++]=d*y+b*x+ty}}},Graphics.prototype.closePath=function(){var currentPath=this.currentPath;return currentPath&&(currentPath.closeStroke=!0),this},Graphics.prototype.setMatrix=function(matrix){return this._matrix=matrix,this},Graphics.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},Graphics.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},Graphics.prototype.destroy=function(options){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,_super.prototype.destroy.call(this,options)},Graphics._TEMP_POINT=new Point,Graphics}(Container),extendStatics$7=function(d,b){return(extendStatics$7=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};var TEXT_GRADIENT,tempPoint=new Point,indices=new Uint16Array([0,1,2,0,2,3]),Sprite=function(_super){function Sprite(texture){var _this=_super.call(this)||this;return _this._anchor=new ObservablePoint(_this._onAnchorUpdate,_this,texture?texture.defaultAnchor.x:0,texture?texture.defaultAnchor.y:0),_this._texture=null,_this._width=0,_this._height=0,_this._tint=null,_this._tintRGB=null,_this.tint=16777215,_this.blendMode=BLEND_MODES.NORMAL,_this._cachedTint=16777215,_this.uvs=null,_this.texture=texture||Texture.EMPTY,_this.vertexData=new Float32Array(8),_this.vertexTrimmedData=null,_this._transformID=-1,_this._textureID=-1,_this._transformTrimmedID=-1,_this._textureTrimmedID=-1,_this.indices=indices,_this.pluginName="batch",_this.isSprite=!0,_this._roundPixels=settings.ROUND_PIXELS,_this}return function(d,b){function __(){this.constructor=d}extendStatics$7(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(Sprite,_super),Sprite.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=sign$2(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=sign$2(this.scale.y)*this._height/this._texture.orig.height)},Sprite.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},Sprite.prototype.calculateVertices=function(){var texture=this._texture;if(this._transformID!==this.transform._worldID||this._textureID!==texture._updateID){this._textureID!==texture._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=texture._updateID;var wt=this.transform.worldTransform,a=wt.a,b=wt.b,c=wt.c,d=wt.d,tx=wt.tx,ty=wt.ty,vertexData=this.vertexData,trim=texture.trim,orig=texture.orig,anchor=this._anchor,w0=0,w1=0,h0=0,h1=0;if(trim?(w0=(w1=trim.x-anchor._x*orig.width)+trim.width,h0=(h1=trim.y-anchor._y*orig.height)+trim.height):(w0=(w1=-anchor._x*orig.width)+orig.width,h0=(h1=-anchor._y*orig.height)+orig.height),vertexData[0]=a*w1+c*h1+tx,vertexData[1]=d*h1+b*w1+ty,vertexData[2]=a*w0+c*h1+tx,vertexData[3]=d*h1+b*w0+ty,vertexData[4]=a*w0+c*h0+tx,vertexData[5]=d*h0+b*w0+ty,vertexData[6]=a*w1+c*h0+tx,vertexData[7]=d*h0+b*w1+ty,this._roundPixels)for(var resolution=settings.RESOLUTION,i=0;i<vertexData.length;++i)vertexData[i]=Math.round((vertexData[i]*resolution|0)/resolution)}},Sprite.prototype.calculateTrimmedVertices=function(){if(this.vertexTrimmedData){if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;var texture=this._texture,vertexData=this.vertexTrimmedData,orig=texture.orig,anchor=this._anchor,wt=this.transform.worldTransform,a=wt.a,b=wt.b,c=wt.c,d=wt.d,tx=wt.tx,ty=wt.ty,w1=-anchor._x*orig.width,w0=w1+orig.width,h1=-anchor._y*orig.height,h0=h1+orig.height;vertexData[0]=a*w1+c*h1+tx,vertexData[1]=d*h1+b*w1+ty,vertexData[2]=a*w0+c*h1+tx,vertexData[3]=d*h1+b*w0+ty,vertexData[4]=a*w0+c*h0+tx,vertexData[5]=d*h0+b*w0+ty,vertexData[6]=a*w1+c*h0+tx,vertexData[7]=d*h0+b*w1+ty},Sprite.prototype._render=function(renderer){this.calculateVertices(),renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]),renderer.plugins[this.pluginName].render(this)},Sprite.prototype._calculateBounds=function(){var trim=this._texture.trim,orig=this._texture.orig;!trim||trim.width===orig.width&&trim.height===orig.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))},Sprite.prototype.getLocalBounds=function(rect){return 0===this.children.length?(this._bounds.minX=this._texture.orig.width*-this._anchor._x,this._bounds.minY=this._texture.orig.height*-this._anchor._y,this._bounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._bounds.maxY=this._texture.orig.height*(1-this._anchor._y),rect||(this._localBoundsRect||(this._localBoundsRect=new Rectangle),rect=this._localBoundsRect),this._bounds.getRectangle(rect)):_super.prototype.getLocalBounds.call(this,rect)},Sprite.prototype.containsPoint=function(point){this.worldTransform.applyInverse(point,tempPoint);var width=this._texture.orig.width,height=this._texture.orig.height,x1=-width*this.anchor.x,y1=0;return tempPoint.x>=x1&&tempPoint.x<x1+width&&(y1=-height*this.anchor.y,tempPoint.y>=y1&&tempPoint.y<y1+height)},Sprite.prototype.destroy=function(options){if(_super.prototype.destroy.call(this,options),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,"boolean"==typeof options?options:options&&options.texture){var destroyBaseTexture="boolean"==typeof options?options:options&&options.baseTexture;this._texture.destroy(!!destroyBaseTexture)}this._texture=null},Sprite.from=function(source,options){return new Sprite(source instanceof Texture?source:Texture.from(source,options))},Object.defineProperty(Sprite.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(value){this._roundPixels!==value&&(this._transformID=-1),this._roundPixels=value},enumerable:!1,configurable:!0}),Object.defineProperty(Sprite.prototype,"width",{get:function(){return Math.abs(this.scale.x)*this._texture.orig.width},set:function(value){var s=sign$2(this.scale.x)||1;this.scale.x=s*value/this._texture.orig.width,this._width=value},enumerable:!1,configurable:!0}),Object.defineProperty(Sprite.prototype,"height",{get:function(){return Math.abs(this.scale.y)*this._texture.orig.height},set:function(value){var s=sign$2(this.scale.y)||1;this.scale.y=s*value/this._texture.orig.height,this._height=value},enumerable:!1,configurable:!0}),Object.defineProperty(Sprite.prototype,"anchor",{get:function(){return this._anchor},set:function(value){this._anchor.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(Sprite.prototype,"tint",{get:function(){return this._tint},set:function(value){this._tint=value,this._tintRGB=(value>>16)+(65280&value)+((255&value)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(Sprite.prototype,"texture",{get:function(){return this._texture},set:function(value){this._texture!==value&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=value||Texture.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,value&&(value.baseTexture.valid?this._onTextureUpdate():value.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),Sprite}(Container),extendStatics$8=function(d,b){return(extendStatics$8=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};!function(TEXT_GRADIENT){TEXT_GRADIENT[TEXT_GRADIENT.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",TEXT_GRADIENT[TEXT_GRADIENT.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"}(TEXT_GRADIENT||(TEXT_GRADIENT={}));var defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:TEXT_GRADIENT.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},genericFontFamilies=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],TextStyle=function(){function TextStyle(style){this.styleID=0,this.reset(),deepCopyProperties(this,style,style)}return TextStyle.prototype.clone=function(){var clonedProperties={};return deepCopyProperties(clonedProperties,this,defaultStyle),new TextStyle(clonedProperties)},TextStyle.prototype.reset=function(){deepCopyProperties(this,defaultStyle,defaultStyle)},Object.defineProperty(TextStyle.prototype,"align",{get:function(){return this._align},set:function(align){this._align!==align&&(this._align=align,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"breakWords",{get:function(){return this._breakWords},set:function(breakWords){this._breakWords!==breakWords&&(this._breakWords=breakWords,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(dropShadow){this._dropShadow!==dropShadow&&(this._dropShadow=dropShadow,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(dropShadowAlpha){this._dropShadowAlpha!==dropShadowAlpha&&(this._dropShadowAlpha=dropShadowAlpha,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(dropShadowAngle){this._dropShadowAngle!==dropShadowAngle&&(this._dropShadowAngle=dropShadowAngle,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(dropShadowBlur){this._dropShadowBlur!==dropShadowBlur&&(this._dropShadowBlur=dropShadowBlur,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(dropShadowColor){var outputColor=getColor(dropShadowColor);this._dropShadowColor!==outputColor&&(this._dropShadowColor=outputColor,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(dropShadowDistance){this._dropShadowDistance!==dropShadowDistance&&(this._dropShadowDistance=dropShadowDistance,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fill",{get:function(){return this._fill},set:function(fill){var outputColor=getColor(fill);this._fill!==outputColor&&(this._fill=outputColor,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(fillGradientType){this._fillGradientType!==fillGradientType&&(this._fillGradientType=fillGradientType,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(fillGradientStops){(function(array1,array2){if(!Array.isArray(array1)||!Array.isArray(array2))return!1;if(array1.length!==array2.length)return!1;for(var i=0;i<array1.length;++i)if(array1[i]!==array2[i])return!1;return!0})(this._fillGradientStops,fillGradientStops)||(this._fillGradientStops=fillGradientStops,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(fontFamily){this.fontFamily!==fontFamily&&(this._fontFamily=fontFamily,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fontSize",{get:function(){return this._fontSize},set:function(fontSize){this._fontSize!==fontSize&&(this._fontSize=fontSize,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(fontStyle){this._fontStyle!==fontStyle&&(this._fontStyle=fontStyle,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(fontVariant){this._fontVariant!==fontVariant&&(this._fontVariant=fontVariant,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(fontWeight){this._fontWeight!==fontWeight&&(this._fontWeight=fontWeight,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(letterSpacing){this._letterSpacing!==letterSpacing&&(this._letterSpacing=letterSpacing,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(lineHeight){this._lineHeight!==lineHeight&&(this._lineHeight=lineHeight,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"leading",{get:function(){return this._leading},set:function(leading){this._leading!==leading&&(this._leading=leading,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(lineJoin){this._lineJoin!==lineJoin&&(this._lineJoin=lineJoin,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(miterLimit){this._miterLimit!==miterLimit&&(this._miterLimit=miterLimit,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"padding",{get:function(){return this._padding},set:function(padding){this._padding!==padding&&(this._padding=padding,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"stroke",{get:function(){return this._stroke},set:function(stroke){var outputColor=getColor(stroke);this._stroke!==outputColor&&(this._stroke=outputColor,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(strokeThickness){this._strokeThickness!==strokeThickness&&(this._strokeThickness=strokeThickness,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(textBaseline){this._textBaseline!==textBaseline&&(this._textBaseline=textBaseline,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"trim",{get:function(){return this._trim},set:function(trim){this._trim!==trim&&(this._trim=trim,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(whiteSpace){this._whiteSpace!==whiteSpace&&(this._whiteSpace=whiteSpace,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(wordWrap){this._wordWrap!==wordWrap&&(this._wordWrap=wordWrap,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(wordWrapWidth){this._wordWrapWidth!==wordWrapWidth&&(this._wordWrapWidth=wordWrapWidth,this.styleID++)},enumerable:!1,configurable:!0}),TextStyle.prototype.toFontString=function(){var fontSizeString="number"==typeof this.fontSize?this.fontSize+"px":this.fontSize,fontFamilies=this.fontFamily;Array.isArray(this.fontFamily)||(fontFamilies=this.fontFamily.split(","));for(var i=fontFamilies.length-1;i>=0;i--){var fontFamily=fontFamilies[i].trim();!/([\"\'])[^\'\"]+\1/.test(fontFamily)&&genericFontFamilies.indexOf(fontFamily)<0&&(fontFamily='"'+fontFamily+'"'),fontFamilies[i]=fontFamily}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+fontSizeString+" "+fontFamilies.join(",")},TextStyle}();function getSingleColor(color){return"number"==typeof color?hex2string(color):("string"==typeof color&&0===color.indexOf("0x")&&(color=color.replace("0x","#")),color)}function getColor(color){if(Array.isArray(color)){for(var i=0;i<color.length;++i)color[i]=getSingleColor(color[i]);return color}return getSingleColor(color)}function deepCopyProperties(target,source,propertyObj){for(var prop in propertyObj)Array.isArray(source[prop])?target[prop]=source[prop].slice():target[prop]=source[prop]}var TextMetrics=function(){function TextMetrics(text,style,width,height,lines,lineWidths,lineHeight,maxLineWidth,fontProperties){this.text=text,this.style=style,this.width=width,this.height=height,this.lines=lines,this.lineWidths=lineWidths,this.lineHeight=lineHeight,this.maxLineWidth=maxLineWidth,this.fontProperties=fontProperties}return TextMetrics.measureText=function(text,style,wordWrap,canvas){void 0===canvas&&(canvas=TextMetrics._canvas),wordWrap=null==wordWrap?style.wordWrap:wordWrap;var font=style.toFontString(),fontProperties=TextMetrics.measureFont(font);0===fontProperties.fontSize&&(fontProperties.fontSize=style.fontSize,fontProperties.ascent=style.fontSize);var context=canvas.getContext("2d");context.font=font;for(var lines=(wordWrap?TextMetrics.wordWrap(text,style,canvas):text).split(/(?:\r\n|\r|\n)/),lineWidths=new Array(lines.length),maxLineWidth=0,i=0;i<lines.length;i++){var lineWidth=context.measureText(lines[i]).width+(lines[i].length-1)*style.letterSpacing;lineWidths[i]=lineWidth,maxLineWidth=Math.max(maxLineWidth,lineWidth)}var width=maxLineWidth+style.strokeThickness;style.dropShadow&&(width+=style.dropShadowDistance);var lineHeight=style.lineHeight||fontProperties.fontSize+style.strokeThickness,height=Math.max(lineHeight,fontProperties.fontSize+style.strokeThickness)+(lines.length-1)*(lineHeight+style.leading);return style.dropShadow&&(height+=style.dropShadowDistance),new TextMetrics(text,style,width,height,lines,lineWidths,lineHeight+style.leading,maxLineWidth,fontProperties)},TextMetrics.wordWrap=function(text,style,canvas){void 0===canvas&&(canvas=TextMetrics._canvas);for(var context=canvas.getContext("2d"),width=0,line="",lines="",cache=Object.create(null),letterSpacing=style.letterSpacing,whiteSpace=style.whiteSpace,collapseSpaces=TextMetrics.collapseSpaces(whiteSpace),collapseNewlines=TextMetrics.collapseNewlines(whiteSpace),canPrependSpaces=!collapseSpaces,wordWrapWidth=style.wordWrapWidth+letterSpacing,tokens=TextMetrics.tokenize(text),i=0;i<tokens.length;i++){var token=tokens[i];if(TextMetrics.isNewline(token)){if(!collapseNewlines){lines+=TextMetrics.addLine(line),canPrependSpaces=!collapseSpaces,line="",width=0;continue}token=" "}if(collapseSpaces){var currIsBreakingSpace=TextMetrics.isBreakingSpace(token),lastIsBreakingSpace=TextMetrics.isBreakingSpace(line[line.length-1]);if(currIsBreakingSpace&&lastIsBreakingSpace)continue}var tokenWidth=TextMetrics.getFromCache(token,letterSpacing,cache,context);if(tokenWidth>wordWrapWidth)if(""!==line&&(lines+=TextMetrics.addLine(line),line="",width=0),TextMetrics.canBreakWords(token,style.breakWords))for(var characters=TextMetrics.wordWrapSplit(token),j=0;j<characters.length;j++){for(var char=characters[j],k=1;characters[j+k];){var nextChar=characters[j+k],lastChar=char[char.length-1];if(TextMetrics.canBreakChars(lastChar,nextChar,token,j,style.breakWords))break;char+=nextChar,k++}j+=char.length-1;var characterWidth=TextMetrics.getFromCache(char,letterSpacing,cache,context);characterWidth+width>wordWrapWidth&&(lines+=TextMetrics.addLine(line),canPrependSpaces=!1,line="",width=0),line+=char,width+=characterWidth}else{line.length>0&&(lines+=TextMetrics.addLine(line),line="",width=0);var isLastToken=i===tokens.length-1;lines+=TextMetrics.addLine(token,!isLastToken),canPrependSpaces=!1,line="",width=0}else tokenWidth+width>wordWrapWidth&&(canPrependSpaces=!1,lines+=TextMetrics.addLine(line),line="",width=0),(line.length>0||!TextMetrics.isBreakingSpace(token)||canPrependSpaces)&&(line+=token,width+=tokenWidth)}return lines+=TextMetrics.addLine(line,!1)},TextMetrics.addLine=function(line,newLine){return void 0===newLine&&(newLine=!0),line=TextMetrics.trimRight(line),line=newLine?line+"\n":line},TextMetrics.getFromCache=function(key,letterSpacing,cache,context){var width=cache[key];if("number"!=typeof width){var spacing=key.length*letterSpacing;width=context.measureText(key).width+spacing,cache[key]=width}return width},TextMetrics.collapseSpaces=function(whiteSpace){return"normal"===whiteSpace||"pre-line"===whiteSpace},TextMetrics.collapseNewlines=function(whiteSpace){return"normal"===whiteSpace},TextMetrics.trimRight=function(text){if("string"!=typeof text)return"";for(var i=text.length-1;i>=0;i--){var char=text[i];if(!TextMetrics.isBreakingSpace(char))break;text=text.slice(0,-1)}return text},TextMetrics.isNewline=function(char){return"string"==typeof char&&TextMetrics._newlines.indexOf(char.charCodeAt(0))>=0},TextMetrics.isBreakingSpace=function(char){return"string"==typeof char&&TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0))>=0},TextMetrics.tokenize=function(text){var tokens=[],token="";if("string"!=typeof text)return tokens;for(var i=0;i<text.length;i++){var char=text[i];TextMetrics.isBreakingSpace(char)||TextMetrics.isNewline(char)?(""!==token&&(tokens.push(token),token=""),tokens.push(char)):token+=char}return""!==token&&tokens.push(token),tokens},TextMetrics.canBreakWords=function(_token,breakWords){return breakWords},TextMetrics.canBreakChars=function(_char,_nextChar,_token,_index,_breakWords){return!0},TextMetrics.wordWrapSplit=function(token){return token.split("")},TextMetrics.measureFont=function(font){if(TextMetrics._fonts[font])return TextMetrics._fonts[font];var properties={ascent:0,descent:0,fontSize:0},canvas=TextMetrics._canvas,context=TextMetrics._context;context.font=font;var metricsString=TextMetrics.METRICS_STRING+TextMetrics.BASELINE_SYMBOL,width=Math.ceil(context.measureText(metricsString).width),baseline=Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width),height=2*baseline;baseline=baseline*TextMetrics.BASELINE_MULTIPLIER|0,canvas.width=width,canvas.height=height,context.fillStyle="#f00",context.fillRect(0,0,width,height),context.font=font,context.textBaseline="alphabetic",context.fillStyle="#000",context.fillText(metricsString,0,baseline);var imagedata=context.getImageData(0,0,width,height).data,pixels=imagedata.length,line=4*width,i=0,idx=0,stop=!1;for(i=0;i<baseline;++i){for(var j=0;j<line;j+=4)if(255!==imagedata[idx+j]){stop=!0;break}if(stop)break;idx+=line}for(properties.ascent=baseline-i,idx=pixels-line,stop=!1,i=height;i>baseline;--i){for(j=0;j<line;j+=4)if(255!==imagedata[idx+j]){stop=!0;break}if(stop)break;idx-=line}return properties.descent=i-baseline,properties.fontSize=properties.ascent+properties.descent,TextMetrics._fonts[font]=properties,properties},TextMetrics.clearMetrics=function(font){void 0===font&&(font=""),font?delete TextMetrics._fonts[font]:TextMetrics._fonts={}},TextMetrics}(),canvas=function(){try{var c=new OffscreenCanvas(0,0),context=c.getContext("2d");return context&&context.measureText?c:document.createElement("canvas")}catch(ex){return document.createElement("canvas")}}();canvas.width=canvas.height=10,TextMetrics._canvas=canvas,TextMetrics._context=canvas.getContext("2d"),TextMetrics._fonts={},TextMetrics.METRICS_STRING="|ÉqÅ",TextMetrics.BASELINE_SYMBOL="M",TextMetrics.BASELINE_MULTIPLIER=1.4,TextMetrics._newlines=[10,13],TextMetrics._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Text=function(_super){function Text(text,style,canvas){var _this=this,ownCanvas=!1;canvas||(canvas=document.createElement("canvas"),ownCanvas=!0),canvas.width=3,canvas.height=3;var texture=Texture.from(canvas);return texture.orig=new Rectangle,texture.trim=new Rectangle,(_this=_super.call(this,texture)||this)._ownCanvas=ownCanvas,_this.canvas=canvas,_this.context=_this.canvas.getContext("2d"),_this._resolution=settings.RESOLUTION,_this._autoResolution=!0,_this._text=null,_this._style=null,_this._styleListener=null,_this._font="",_this.text=text,_this.style=style,_this.localStyleID=-1,_this}return function(d,b){function __(){this.constructor=d}extendStatics$8(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(Text,_super),Text.prototype.updateText=function(respectDirty){var style=this._style;if(this.localStyleID!==style.styleID&&(this.dirty=!0,this.localStyleID=style.styleID),this.dirty||!respectDirty){this._font=this._style.toFontString();var linePositionX,linePositionY,context=this.context,measured=TextMetrics.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),width=measured.width,height=measured.height,lines=measured.lines,lineHeight=measured.lineHeight,lineWidths=measured.lineWidths,maxLineWidth=measured.maxLineWidth,fontProperties=measured.fontProperties;this.canvas.width=Math.ceil((Math.max(1,width)+2*style.padding)*this._resolution),this.canvas.height=Math.ceil((Math.max(1,height)+2*style.padding)*this._resolution),context.scale(this._resolution,this._resolution),context.clearRect(0,0,this.canvas.width,this.canvas.height),context.font=this._font,context.lineWidth=style.strokeThickness,context.textBaseline=style.textBaseline,context.lineJoin=style.lineJoin,context.miterLimit=style.miterLimit;for(var passesCount=style.dropShadow?2:1,i=0;i<passesCount;++i){var isShadowPass=style.dropShadow&&0===i,dsOffsetText=isShadowPass?Math.ceil(Math.max(1,height)+2*style.padding):0,dsOffsetShadow=dsOffsetText*this._resolution;if(isShadowPass){context.fillStyle="black",context.strokeStyle="black";var dropShadowColor=style.dropShadowColor,rgb=hex2rgb("number"==typeof dropShadowColor?dropShadowColor:string2hex(dropShadowColor));context.shadowColor="rgba("+255*rgb[0]+","+255*rgb[1]+","+255*rgb[2]+","+style.dropShadowAlpha+")",context.shadowBlur=style.dropShadowBlur,context.shadowOffsetX=Math.cos(style.dropShadowAngle)*style.dropShadowDistance,context.shadowOffsetY=Math.sin(style.dropShadowAngle)*style.dropShadowDistance+dsOffsetShadow}else context.fillStyle=this._generateFillStyle(style,lines,measured),context.strokeStyle=style.stroke,context.shadowColor="black",context.shadowBlur=0,context.shadowOffsetX=0,context.shadowOffsetY=0;for(var i_1=0;i_1<lines.length;i_1++)linePositionX=style.strokeThickness/2,linePositionY=style.strokeThickness/2+i_1*lineHeight+fontProperties.ascent,"right"===style.align?linePositionX+=maxLineWidth-lineWidths[i_1]:"center"===style.align&&(linePositionX+=(maxLineWidth-lineWidths[i_1])/2),style.stroke&&style.strokeThickness&&this.drawLetterSpacing(lines[i_1],linePositionX+style.padding,linePositionY+style.padding-dsOffsetText,!0),style.fill&&this.drawLetterSpacing(lines[i_1],linePositionX+style.padding,linePositionY+style.padding-dsOffsetText)}this.updateTexture()}},Text.prototype.drawLetterSpacing=function(text,x,y,isStroke){void 0===isStroke&&(isStroke=!1);var letterSpacing=this._style.letterSpacing;if(0!==letterSpacing)for(var currentPosition=x,stringArray=Array.from?Array.from(text):text.split(""),previousWidth=this.context.measureText(text).width,currentWidth=0,i=0;i<stringArray.length;++i){var currentChar=stringArray[i];isStroke?this.context.strokeText(currentChar,currentPosition,y):this.context.fillText(currentChar,currentPosition,y),currentPosition+=previousWidth-(currentWidth=this.context.measureText(text.substring(i+1)).width)+letterSpacing,previousWidth=currentWidth}else isStroke?this.context.strokeText(text,x,y):this.context.fillText(text,x,y)},Text.prototype.updateTexture=function(){var canvas=this.canvas;if(this._style.trim){var trimmed=function(canvas){var i,x,y,width=canvas.width,height=canvas.height,context=canvas.getContext("2d"),pixels=context.getImageData(0,0,width,height).data,len=pixels.length,bound={top:null,left:null,right:null,bottom:null},data=null;for(i=0;i<len;i+=4)0!==pixels[i+3]&&(x=i/4%width,y=~~(i/4/width),null===bound.top&&(bound.top=y),(null===bound.left||x<bound.left)&&(bound.left=x),(null===bound.right||bound.right<x)&&(bound.right=x+1),(null===bound.bottom||bound.bottom<y)&&(bound.bottom=y));return null!==bound.top&&(width=bound.right-bound.left,height=bound.bottom-bound.top+1,data=context.getImageData(bound.left,bound.top,width,height)),{height:height,width:width,data:data}}(canvas);trimmed.data&&(canvas.width=trimmed.width,canvas.height=trimmed.height,this.context.putImageData(trimmed.data,0,0))}var texture=this._texture,style=this._style,padding=style.trim?0:style.padding,baseTexture=texture.baseTexture;texture.trim.width=texture._frame.width=Math.ceil(canvas.width/this._resolution),texture.trim.height=texture._frame.height=Math.ceil(canvas.height/this._resolution),texture.trim.x=-padding,texture.trim.y=-padding,texture.orig.width=texture._frame.width-2*padding,texture.orig.height=texture._frame.height-2*padding,this._onTextureUpdate(),baseTexture.setRealSize(canvas.width,canvas.height,this._resolution),this._recursivePostUpdateTransform(),this.dirty=!1},Text.prototype._render=function(renderer){this._autoResolution&&this._resolution!==renderer.resolution&&(this._resolution=renderer.resolution,this.dirty=!0),this.updateText(!0),_super.prototype._render.call(this,renderer)},Text.prototype.getLocalBounds=function(rect){return this.updateText(!0),_super.prototype.getLocalBounds.call(this,rect)},Text.prototype._calculateBounds=function(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)},Text.prototype._generateFillStyle=function(style,lines,metrics){var gradient,fillStyle=style.fill;if(!Array.isArray(fillStyle))return fillStyle;if(1===fillStyle.length)return fillStyle[0];var dropShadowCorrection=style.dropShadow?style.dropShadowDistance:0,padding=style.padding||0,width=Math.ceil(this.canvas.width/this._resolution)-dropShadowCorrection-2*padding,height=Math.ceil(this.canvas.height/this._resolution)-dropShadowCorrection-2*padding,fill=fillStyle.slice(),fillGradientStops=style.fillGradientStops.slice();if(!fillGradientStops.length)for(var lengthPlus1=fill.length+1,i=1;i<lengthPlus1;++i)fillGradientStops.push(i/lengthPlus1);if(fill.unshift(fillStyle[0]),fillGradientStops.unshift(0),fill.push(fillStyle[fillStyle.length-1]),fillGradientStops.push(1),style.fillGradientType===TEXT_GRADIENT.LINEAR_VERTICAL){gradient=this.context.createLinearGradient(width/2,padding,width/2,height+padding);var lastIterationStop=0,gradStopLineHeight=(metrics.fontProperties.fontSize+style.strokeThickness)/height;for(i=0;i<lines.length;i++)for(var thisLineTop=metrics.lineHeight*i,j=0;j<fill.length;j++){var globalStop=thisLineTop/height+("number"==typeof fillGradientStops[j]?fillGradientStops[j]:j/fill.length)*gradStopLineHeight,clampedStop=Math.max(lastIterationStop,globalStop);clampedStop=Math.min(clampedStop,1),gradient.addColorStop(clampedStop,fill[j]),lastIterationStop=clampedStop}}else{gradient=this.context.createLinearGradient(padding,height/2,width+padding,height/2);var totalIterations=fill.length+1,currentIteration=1;for(i=0;i<fill.length;i++){var stop=void 0;stop="number"==typeof fillGradientStops[i]?fillGradientStops[i]:currentIteration/totalIterations,gradient.addColorStop(stop,fill[i]),currentIteration++}}return gradient},Text.prototype.destroy=function(options){"boolean"==typeof options&&(options={children:options}),options=Object.assign({},defaultDestroyOptions,options),_super.prototype.destroy.call(this,options),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(Text.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(value){this.updateText(!0);var s=sign$2(this.scale.x)||1;this.scale.x=s*value/this._texture.orig.width,this._width=value},enumerable:!1,configurable:!0}),Object.defineProperty(Text.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(value){this.updateText(!0);var s=sign$2(this.scale.y)||1;this.scale.y=s*value/this._texture.orig.height,this._height=value},enumerable:!1,configurable:!0}),Object.defineProperty(Text.prototype,"style",{get:function(){return this._style},set:function(style){style=style||{},this._style=style instanceof TextStyle?style:new TextStyle(style),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(Text.prototype,"text",{get:function(){return this._text},set:function(text){text=String(null==text?"":text),this._text!==text&&(this._text=text,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(Text.prototype,"resolution",{get:function(){return this._resolution},set:function(value){this._autoResolution=!1,this._resolution!==value&&(this._resolution=value,this.dirty=!0)},enumerable:!1,configurable:!0}),Text}(Sprite);
|
|
148
|
+
***************************************************************************** */function __extends$5(d,b){function __(){this.constructor=d}extendStatics$5(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}function __generator$1(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}var _a$1,_b$1,BlobResource=function(_super){function BlobResource(source,options){void 0===options&&(options={width:1,height:1,autoLoad:!0});var origin,data,_this=this;return"string"==typeof source?(origin=source,data=new Uint8Array):(origin=null,data=source),(_this=_super.call(this,data,options)||this).origin=origin,_this.buffer=data?new ViewableBuffer(data):null,_this.origin&&!1!==options.autoLoad&&_this.load(),data&&data.length&&(_this.loaded=!0,_this.onBlobLoaded(_this.buffer.rawBinaryData)),_this}return __extends$5(BlobResource,_super),BlobResource.prototype.onBlobLoaded=function(_data){},BlobResource.prototype.load=function(){return thisArg=this,_arguments=void 0,generator=function(){var arrayBuffer;return __generator$1(this,(function(_a){switch(_a.label){case 0:return[4,fetch(this.origin)];case 1:return[4,_a.sent().blob()];case 2:return[4,_a.sent().arrayBuffer()];case 3:return arrayBuffer=_a.sent(),this.data=new Uint32Array(arrayBuffer),this.buffer=new ViewableBuffer(arrayBuffer),this.loaded=!0,this.onBlobLoaded(arrayBuffer),this.update(),[2,this]}}))},new((P=Promise)||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):new P((function(resolve){resolve(result.value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}));var thisArg,_arguments,P,generator},BlobResource}(BufferResource),CompressedTextureResource=function(_super){function CompressedTextureResource(source,options){var _this=_super.call(this,source,options)||this;return _this.format=options.format,_this.levels=options.levels||1,_this._width=options.width,_this._height=options.height,_this._extension=CompressedTextureResource._formatToExtension(_this.format),(options.levelBuffers||_this.buffer)&&(_this._levelBuffers=options.levelBuffers||CompressedTextureResource._createLevelBuffers(source instanceof Uint8Array?source:_this.buffer.uint8View,_this.format,_this.levels,4,4,_this.width,_this.height)),_this}return __extends$5(CompressedTextureResource,_super),CompressedTextureResource.prototype.upload=function(renderer,_texture,_glTexture){var gl=renderer.gl;if(!renderer.context.extensions[this._extension])throw new Error(this._extension+" textures are not supported on the current machine");if(!this._levelBuffers)return!1;for(var i=0,j=this.levels;i<j;i++){var _a=this._levelBuffers[i],levelID=_a.levelID,levelWidth=_a.levelWidth,levelHeight=_a.levelHeight,levelBuffer=_a.levelBuffer;gl.compressedTexImage2D(gl.TEXTURE_2D,levelID,this.format,levelWidth,levelHeight,0,levelBuffer)}return!0},CompressedTextureResource.prototype.onBlobLoaded=function(){this._levelBuffers=CompressedTextureResource._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)},CompressedTextureResource._formatToExtension=function(format){if(format>=33776&&format<=33779)return"s3tc";if(format>=37488&&format<=37497)return"etc";if(format>=35840&&format<=35843)return"pvrtc";if(format>=36196)return"etc1";if(format>=35986&&format<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},CompressedTextureResource._createLevelBuffers=function(buffer,format,levels,blockWidth,blockHeight,imageWidth,imageHeight){for(var buffers=new Array(levels),offset=buffer.byteOffset,levelWidth=imageWidth,levelHeight=imageHeight,alignedLevelWidth=levelWidth+blockWidth-1&~(blockWidth-1),alignedLevelHeight=levelHeight+blockHeight-1&~(blockHeight-1),levelSize=alignedLevelWidth*alignedLevelHeight*INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[format],i=0;i<levels;i++)buffers[i]={levelID:i,levelWidth:levels>1?levelWidth:alignedLevelWidth,levelHeight:levels>1?levelHeight:alignedLevelHeight,levelBuffer:new Uint8Array(buffer.buffer,offset,levelSize)},offset+=levelSize,levelSize=(alignedLevelWidth=(levelWidth=levelWidth>>1||1)+blockWidth-1&~(blockWidth-1))*(alignedLevelHeight=(levelHeight=levelHeight>>1||1)+blockHeight-1&~(blockHeight-1))*INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[format];return buffers},CompressedTextureResource}(BlobResource),CompressedTextureLoader=function(){function CompressedTextureLoader(){}return CompressedTextureLoader.use=function(resource,next){var data=resource.data;if(resource.type===LoaderResource.TYPE.JSON&&data&&data.cacheID&&data.textures){for(var textures=data.textures,textureURL=void 0,fallbackURL=void 0,i=0,j=textures.length;i<j;i++){var texture=textures[i],url_1=texture.src,format=texture.format;if(format||(fallbackURL=url_1),CompressedTextureLoader.textureFormats[format]){textureURL=url_1;break}}if(!(textureURL=textureURL||fallbackURL))return void next(new Error("Cannot load compressed-textures in "+resource.url+", make sure you provide a fallback"));if(textureURL===resource.url)return void next(new Error("URL of compressed texture cannot be the same as the manifest's URL"));var loadOptions={crossOrigin:resource.crossOrigin,metadata:resource.metadata.imageMetadata,parentResource:resource},resourcePath=url.resolve(resource.url.replace(this.baseUrl,""),textureURL),resourceName=data.cacheID;this.add(resourceName,resourcePath,loadOptions,(function(res){if(res.error)next(res.error);else{var _a=res.texture,texture=void 0===_a?null:_a,_b=res.textures,textures=void 0===_b?{}:_b;Object.assign(resource,{texture:texture,textures:textures}),next()}}))}else next()},Object.defineProperty(CompressedTextureLoader,"textureExtensions",{get:function(){if(!CompressedTextureLoader._textureExtensions){var gl=document.createElement("canvas").getContext("webgl");if(!gl)return console.warn("WebGL not available for compressed textures. Silently failing."),{};var extensions={s3tc:gl.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:gl.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:gl.getExtension("WEBGL_compressed_texture_etc"),etc1:gl.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:gl.getExtension("WEBGL_compressed_texture_pvrtc")||gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:gl.getExtension("WEBGL_compressed_texture_atc"),astc:gl.getExtension("WEBGL_compressed_texture_astc")};CompressedTextureLoader._textureExtensions=extensions}return CompressedTextureLoader._textureExtensions},enumerable:!1,configurable:!0}),Object.defineProperty(CompressedTextureLoader,"textureFormats",{get:function(){if(!CompressedTextureLoader._textureFormats){var extensions=CompressedTextureLoader.textureExtensions;for(var extensionName in CompressedTextureLoader._textureFormats={},extensions){var extension=extensions[extensionName];extension&&Object.assign(CompressedTextureLoader._textureFormats,Object.getPrototypeOf(extension))}}return CompressedTextureLoader._textureFormats},enumerable:!1,configurable:!0}),CompressedTextureLoader}();function registerCompressedTextures(url,resources,metadata){var result={textures:{},texture:null};return resources?(resources.map((function(resource){return new Texture(new BaseTexture(resource,Object.assign({mipmap:MIPMAP_MODES$1.OFF,alphaMode:ALPHA_MODES$1.NO_PREMULTIPLIED_ALPHA},metadata)))})).forEach((function(texture,i){var baseTexture=texture.baseTexture,cacheID=url+"-"+(i+1);BaseTexture.addToCache(baseTexture,cacheID),Texture.addToCache(texture,cacheID),0===i&&(BaseTexture.addToCache(baseTexture,url),Texture.addToCache(texture,url),result.texture=texture),result.textures[cacheID]=texture})),result):result}LoaderResource.setExtensionXhrType("dds",LoaderResource.XHR_RESPONSE_TYPE.BUFFER);var DXGI_FORMAT,D3D10_RESOURCE_DIMENSION,DDS_FIELDS_HEIGHT=3,DDS_FIELDS_WIDTH=4,DDS_FIELDS_MIPMAP_COUNT=7,DDS_FIELDS_PIXEL_FORMAT=19,DDS_PF_FIELDS_FOURCC=2,DDS_DX10_FIELDS_DXGI_FORMAT=0,DDS_DX10_FIELDS_RESOURCE_DIMENSION=1,DDS_DX10_FIELDS_MISC_FLAG=2,DDS_DX10_FIELDS_ARRAY_SIZE=3;!function(DXGI_FORMAT){DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",DXGI_FORMAT[DXGI_FORMAT.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT"}(DXGI_FORMAT||(DXGI_FORMAT={})),function(D3D10_RESOURCE_DIMENSION){D3D10_RESOURCE_DIMENSION[D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",D3D10_RESOURCE_DIMENSION[D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",D3D10_RESOURCE_DIMENSION[D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D"}(D3D10_RESOURCE_DIMENSION||(D3D10_RESOURCE_DIMENSION={}));var _a,_b,_c,FOURCC_TO_FORMAT=((_a$1={})[827611204]=INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,_a$1[861165636]=INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,_a$1[894720068]=INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,_a$1),DXGI_TO_FORMAT=((_b$1={})[DXGI_FORMAT.DXGI_FORMAT_BC1_TYPELESS]=INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,_b$1[DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM]=INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,_b$1[DXGI_FORMAT.DXGI_FORMAT_BC2_TYPELESS]=INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,_b$1[DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM]=INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,_b$1[DXGI_FORMAT.DXGI_FORMAT_BC3_TYPELESS]=INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,_b$1[DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM]=INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,_b$1[DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM_SRGB]=INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,_b$1[DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM_SRGB]=INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,_b$1[DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM_SRGB]=INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,_b$1),DDSLoader=function(){function DDSLoader(){}return DDSLoader.use=function(resource,next){if("dds"===resource.extension&&resource.data)try{Object.assign(resource,registerCompressedTextures(resource.name||resource.url,DDSLoader.parse(resource.data),resource.metadata))}catch(err){return void next(err)}next()},DDSLoader.parse=function(arrayBuffer){var data=new Uint32Array(arrayBuffer);if(542327876!==data[0])throw new Error("Invalid DDS file magic word");var header=new Uint32Array(arrayBuffer,0,124/Uint32Array.BYTES_PER_ELEMENT),height=header[DDS_FIELDS_HEIGHT],width=header[DDS_FIELDS_WIDTH],mipmapCount=header[DDS_FIELDS_MIPMAP_COUNT],pixelFormat=new Uint32Array(arrayBuffer,DDS_FIELDS_PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),formatFlags=pixelFormat[1];if(4&formatFlags){var fourCC=pixelFormat[DDS_PF_FIELDS_FOURCC];if(808540228!==fourCC){var internalFormat_1=FOURCC_TO_FORMAT[fourCC],texData=new Uint8Array(arrayBuffer,128);return[new CompressedTextureResource(texData,{format:internalFormat_1,width:width,height:height,levels:mipmapCount})]}var dx10Header=new Uint32Array(data.buffer,128,20/Uint32Array.BYTES_PER_ELEMENT),dxgiFormat=dx10Header[DDS_DX10_FIELDS_DXGI_FORMAT],resourceDimension=dx10Header[DDS_DX10_FIELDS_RESOURCE_DIMENSION],miscFlag=dx10Header[DDS_DX10_FIELDS_MISC_FLAG],arraySize=dx10Header[DDS_DX10_FIELDS_ARRAY_SIZE],internalFormat_2=DXGI_TO_FORMAT[dxgiFormat];if(void 0===internalFormat_2)throw new Error("DDSLoader cannot parse texture data with DXGI format "+dxgiFormat);if(4===miscFlag)throw new Error("DDSLoader does not support cubemap textures");if(resourceDimension===D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSLoader does not supported 3D texture data");var imageBuffers=new Array;if(1===arraySize)imageBuffers.push(new Uint8Array(arrayBuffer,148));else{for(var pixelSize=INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[internalFormat_2],imageSize=0,levelWidth=width,levelHeight=height,i=0;i<mipmapCount;i++){imageSize+=Math.max(1,levelWidth+3&-4)*Math.max(1,levelHeight+3&-4)*pixelSize,levelWidth>>>=1,levelHeight>>>=1}var imageOffset=148;for(i=0;i<arraySize;i++)imageBuffers.push(new Uint8Array(arrayBuffer,imageOffset,imageSize)),imageOffset+=imageSize}return imageBuffers.map((function(buffer){return new CompressedTextureResource(buffer,{format:internalFormat_2,width:width,height:height,levels:mipmapCount})}))}if(64&formatFlags)throw new Error("DDSLoader does not support uncompressed texture data.");if(512&formatFlags)throw new Error("DDSLoader does not supported YUV uncompressed texture data.");if(131072&formatFlags)throw new Error("DDSLoader does not support single-channel (lumninance) texture data!");if(2&formatFlags)throw new Error("DDSLoader does not support single-channel (alpha) texture data!");throw new Error("DDSLoader failed to load a texture file due to an unknown reason!")},DDSLoader}();LoaderResource.setExtensionXhrType("ktx",LoaderResource.XHR_RESPONSE_TYPE.BUFFER);var FILE_IDENTIFIER=[171,75,84,88,32,49,49,187,13,10,26,10],KTX_FIELDS_ENDIANNESS=12,KTX_FIELDS_GL_TYPE=16,KTX_FIELDS_GL_FORMAT=24,KTX_FIELDS_GL_INTERNAL_FORMAT=28,KTX_FIELDS_PIXEL_WIDTH=36,KTX_FIELDS_PIXEL_HEIGHT=40,KTX_FIELDS_PIXEL_DEPTH=44,KTX_FIELDS_NUMBER_OF_ARRAY_ELEMENTS=48,KTX_FIELDS_NUMBER_OF_FACES=52,KTX_FIELDS_NUMBER_OF_MIPMAP_LEVELS=56,KTX_FIELDS_BYTES_OF_KEY_VALUE_DATA=60,TYPES_TO_BYTES_PER_COMPONENT=((_a={})[TYPES$1.UNSIGNED_BYTE]=1,_a[TYPES$1.UNSIGNED_SHORT]=2,_a[TYPES$1.INT]=4,_a[TYPES$1.UNSIGNED_INT]=4,_a[TYPES$1.FLOAT]=4,_a[TYPES$1.HALF_FLOAT]=8,_a),FORMATS_TO_COMPONENTS=((_b={})[FORMATS$1.RGBA]=4,_b[FORMATS$1.RGB]=3,_b[FORMATS$1.RG]=2,_b[FORMATS$1.RED]=1,_b[FORMATS$1.LUMINANCE]=1,_b[FORMATS$1.LUMINANCE_ALPHA]=2,_b[FORMATS$1.ALPHA]=1,_b),TYPES_TO_BYTES_PER_PIXEL=((_c={})[TYPES$1.UNSIGNED_SHORT_4_4_4_4]=2,_c[TYPES$1.UNSIGNED_SHORT_5_5_5_1]=2,_c[TYPES$1.UNSIGNED_SHORT_5_6_5]=2,_c),KTXLoader=function(){function KTXLoader(){}return KTXLoader.use=function(resource,next){if("ktx"===resource.extension&&resource.data)try{var url_1=resource.name||resource.url,_a=KTXLoader.parse(url_1,resource.data),compressed=_a.compressed,uncompressed=_a.uncompressed,kvData_1=_a.kvData;if(compressed){var result=registerCompressedTextures(url_1,compressed,resource.metadata);if(kvData_1&&result.textures)for(var textureId in result.textures)result.textures[textureId].baseTexture.ktxKeyValueData=kvData_1;Object.assign(resource,result)}else if(uncompressed){var textures_1={};uncompressed.forEach((function(image,i){var texture=new Texture(new BaseTexture(image.resource,{mipmap:MIPMAP_MODES$1.OFF,alphaMode:ALPHA_MODES$1.NO_PREMULTIPLIED_ALPHA,type:image.type,format:image.format})),cacheID=url_1+"-"+(i+1);kvData_1&&(texture.baseTexture.ktxKeyValueData=kvData_1),BaseTexture.addToCache(texture.baseTexture,cacheID),Texture.addToCache(texture,cacheID),0===i&&(textures_1[url_1]=texture,BaseTexture.addToCache(texture.baseTexture,url_1),Texture.addToCache(texture,url_1)),textures_1[cacheID]=texture})),Object.assign(resource,{textures:textures_1})}}catch(err){return void next(err)}next()},KTXLoader.parse=function(url,arrayBuffer){var dataView=new DataView(arrayBuffer);if(!KTXLoader.validate(url,dataView))return null;var littleEndian=67305985===dataView.getUint32(KTX_FIELDS_ENDIANNESS,!0),glType=dataView.getUint32(KTX_FIELDS_GL_TYPE,littleEndian),glFormat=dataView.getUint32(KTX_FIELDS_GL_FORMAT,littleEndian),glInternalFormat=dataView.getUint32(KTX_FIELDS_GL_INTERNAL_FORMAT,littleEndian),pixelWidth=dataView.getUint32(KTX_FIELDS_PIXEL_WIDTH,littleEndian),pixelHeight=dataView.getUint32(KTX_FIELDS_PIXEL_HEIGHT,littleEndian)||1,pixelDepth=dataView.getUint32(KTX_FIELDS_PIXEL_DEPTH,littleEndian)||1,numberOfArrayElements=dataView.getUint32(KTX_FIELDS_NUMBER_OF_ARRAY_ELEMENTS,littleEndian)||1,numberOfFaces=dataView.getUint32(KTX_FIELDS_NUMBER_OF_FACES,littleEndian),numberOfMipmapLevels=dataView.getUint32(KTX_FIELDS_NUMBER_OF_MIPMAP_LEVELS,littleEndian),bytesOfKeyValueData=dataView.getUint32(KTX_FIELDS_BYTES_OF_KEY_VALUE_DATA,littleEndian);if(0===pixelHeight||1!==pixelDepth)throw new Error("Only 2D textures are supported");if(1!==numberOfFaces)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(1!==numberOfArrayElements)throw new Error("WebGL does not support array textures");var imagePixelByteSize,alignedWidth=pixelWidth+3&-4,alignedHeight=pixelHeight+3&-4,imageBuffers=new Array(numberOfArrayElements),imagePixels=pixelWidth*pixelHeight;if(0===glType&&(imagePixels=alignedWidth*alignedHeight),void 0===(imagePixelByteSize=0!==glType?TYPES_TO_BYTES_PER_COMPONENT[glType]?TYPES_TO_BYTES_PER_COMPONENT[glType]*FORMATS_TO_COMPONENTS[glFormat]:TYPES_TO_BYTES_PER_PIXEL[glType]:INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[glInternalFormat]))throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");for(var kvData=KTXLoader.loadKeyValueData?KTXLoader.parseKvData(dataView,bytesOfKeyValueData,littleEndian):null,mipByteSize=imagePixels*imagePixelByteSize,mipWidth=pixelWidth,mipHeight=pixelHeight,alignedMipWidth=alignedWidth,alignedMipHeight=alignedHeight,imageOffset=64+bytesOfKeyValueData,mipmapLevel=0;mipmapLevel<numberOfMipmapLevels;mipmapLevel++){for(var imageSize=dataView.getUint32(imageOffset,littleEndian),elementOffset=imageOffset+4,arrayElement=0;arrayElement<numberOfArrayElements;arrayElement++){var mips=imageBuffers[arrayElement];mips||(mips=imageBuffers[arrayElement]=new Array(numberOfMipmapLevels)),mips[mipmapLevel]={levelID:mipmapLevel,levelWidth:numberOfMipmapLevels>1||0!==glType?mipWidth:alignedMipWidth,levelHeight:numberOfMipmapLevels>1||0!==glType?mipHeight:alignedMipHeight,levelBuffer:new Uint8Array(arrayBuffer,elementOffset,mipByteSize)},elementOffset+=mipByteSize}imageOffset=(imageOffset+=imageSize+4)%4!=0?imageOffset+4-imageOffset%4:imageOffset,mipByteSize=(alignedMipWidth=(mipWidth=mipWidth>>1||1)+4-1&-4)*(alignedMipHeight=(mipHeight=mipHeight>>1||1)+4-1&-4)*imagePixelByteSize}return 0!==glType?{uncompressed:imageBuffers.map((function(levelBuffers){var buffer=levelBuffers[0].levelBuffer,convertToInt=!1;return glType===TYPES$1.FLOAT?buffer=new Float32Array(levelBuffers[0].levelBuffer.buffer,levelBuffers[0].levelBuffer.byteOffset,levelBuffers[0].levelBuffer.byteLength/4):glType===TYPES$1.UNSIGNED_INT?(convertToInt=!0,buffer=new Uint32Array(levelBuffers[0].levelBuffer.buffer,levelBuffers[0].levelBuffer.byteOffset,levelBuffers[0].levelBuffer.byteLength/4)):glType===TYPES$1.INT&&(convertToInt=!0,buffer=new Int32Array(levelBuffers[0].levelBuffer.buffer,levelBuffers[0].levelBuffer.byteOffset,levelBuffers[0].levelBuffer.byteLength/4)),{resource:new BufferResource(buffer,{width:levelBuffers[0].levelWidth,height:levelBuffers[0].levelHeight}),type:glType,format:convertToInt?KTXLoader.convertFormatToInteger(glFormat):glFormat}})),kvData:kvData}:{compressed:imageBuffers.map((function(levelBuffers){return new CompressedTextureResource(null,{format:glInternalFormat,width:pixelWidth,height:pixelHeight,levels:numberOfMipmapLevels,levelBuffers:levelBuffers})})),kvData:kvData}},KTXLoader.validate=function(url,dataView){for(var i=0;i<FILE_IDENTIFIER.length;i++)if(dataView.getUint8(i)!==FILE_IDENTIFIER[i])return console.error(url+" is not a valid *.ktx file!"),!1;return!0},KTXLoader.convertFormatToInteger=function(format){switch(format){case FORMATS$1.RGBA:return FORMATS$1.RGBA_INTEGER;case FORMATS$1.RGB:return FORMATS$1.RGB_INTEGER;case FORMATS$1.RG:return FORMATS$1.RG_INTEGER;case FORMATS$1.RED:return FORMATS$1.RED_INTEGER;default:return format}},KTXLoader.parseKvData=function(dataView,bytesOfKeyValueData,littleEndian){for(var kvData=new Map,bytesIntoKeyValueData=0;bytesIntoKeyValueData<bytesOfKeyValueData;){var keyAndValueByteSize=dataView.getUint32(64+bytesIntoKeyValueData,littleEndian),keyAndValueByteOffset=64+bytesIntoKeyValueData+4,valuePadding=3-(keyAndValueByteSize+3)%4;if(0===keyAndValueByteSize||keyAndValueByteSize>bytesOfKeyValueData-bytesIntoKeyValueData){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}for(var keyNulByte=0;keyNulByte<keyAndValueByteSize&&0!==dataView.getUint8(keyAndValueByteOffset+keyNulByte);keyNulByte++);if(-1===keyNulByte){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}var key=(new TextDecoder).decode(new Uint8Array(dataView.buffer,keyAndValueByteOffset,keyNulByte)),value=new DataView(dataView.buffer,keyAndValueByteOffset+keyNulByte+1,keyAndValueByteSize-keyNulByte-1);kvData.set(key,value),bytesIntoKeyValueData+=4+keyAndValueByteSize+valuePadding}return kvData},KTXLoader.loadKeyValueData=!1,KTXLoader}(),extendStatics$6=function(d,b){return extendStatics$6=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$6(d,b)};function __extends$6(d,b){function __(){this.constructor=d}extendStatics$6(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}!function(_super){function ParticleContainer(maxSize,properties,batchSize,autoResize){void 0===maxSize&&(maxSize=1500),void 0===batchSize&&(batchSize=16384),void 0===autoResize&&(autoResize=!1);var _this=_super.call(this)||this;return batchSize>16384&&(batchSize=16384),_this._properties=[!1,!0,!1,!1,!1],_this._maxSize=maxSize,_this._batchSize=batchSize,_this._buffers=null,_this._bufferUpdateIDs=[],_this._updateID=0,_this.interactiveChildren=!1,_this.blendMode=BLEND_MODES$1.NORMAL,_this.autoResize=autoResize,_this.roundPixels=!0,_this.baseTexture=null,_this.setProperties(properties),_this._tint=0,_this.tintRgb=new Float32Array(4),_this.tint=16777215,_this}__extends$6(ParticleContainer,_super),ParticleContainer.prototype.setProperties=function(properties){properties&&(this._properties[0]="vertices"in properties||"scale"in properties?!!properties.vertices||!!properties.scale:this._properties[0],this._properties[1]="position"in properties?!!properties.position:this._properties[1],this._properties[2]="rotation"in properties?!!properties.rotation:this._properties[2],this._properties[3]="uvs"in properties?!!properties.uvs:this._properties[3],this._properties[4]="tint"in properties||"alpha"in properties?!!properties.tint||!!properties.alpha:this._properties[4])},ParticleContainer.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(ParticleContainer.prototype,"tint",{get:function(){return this._tint},set:function(value){this._tint=value,hex2rgb(value,this.tintRgb)},enumerable:!1,configurable:!0}),ParticleContainer.prototype.render=function(renderer){var _this=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",(function(){return _this.onChildrenChange(0)}))),renderer.batch.setObjectRenderer(renderer.plugins.particle),renderer.plugins.particle.render(this))},ParticleContainer.prototype.onChildrenChange=function(smallestChildIndex){for(var bufferIndex=Math.floor(smallestChildIndex/this._batchSize);this._bufferUpdateIDs.length<bufferIndex;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[bufferIndex]=++this._updateID},ParticleContainer.prototype.dispose=function(){if(this._buffers){for(var i=0;i<this._buffers.length;++i)this._buffers[i].destroy();this._buffers=null}},ParticleContainer.prototype.destroy=function(options){_super.prototype.destroy.call(this,options),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null}}(Container);var LINE_JOIN,LINE_CAP,ParticleBuffer=function(){function ParticleBuffer(properties,dynamicPropertyFlags,size){this.geometry=new Geometry,this.indexBuffer=null,this.size=size,this.dynamicProperties=[],this.staticProperties=[];for(var i=0;i<properties.length;++i){var property=properties[i];property={attributeName:property.attributeName,size:property.size,uploadFunction:property.uploadFunction,type:property.type||TYPES$1.FLOAT,offset:property.offset},dynamicPropertyFlags[i]?this.dynamicProperties.push(property):this.staticProperties.push(property)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}return ParticleBuffer.prototype.initBuffers=function(){var geometry=this.geometry,dynamicOffset=0;this.indexBuffer=new Buffer(function(size,outBuffer){void 0===outBuffer&&(outBuffer=null);var totalIndices=6*size;if((outBuffer=outBuffer||new Uint16Array(totalIndices)).length!==totalIndices)throw new Error("Out buffer length is incorrect, got "+outBuffer.length+" and expected "+totalIndices);for(var i=0,j=0;i<totalIndices;i+=6,j+=4)outBuffer[i+0]=j+0,outBuffer[i+1]=j+1,outBuffer[i+2]=j+2,outBuffer[i+3]=j+0,outBuffer[i+4]=j+2,outBuffer[i+5]=j+3;return outBuffer}(this.size),!0,!0),geometry.addIndex(this.indexBuffer),this.dynamicStride=0;for(var i=0;i<this.dynamicProperties.length;++i){(property=this.dynamicProperties[i]).offset=dynamicOffset,dynamicOffset+=property.size,this.dynamicStride+=property.size}var dynBuffer=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(dynBuffer),this.dynamicDataUint32=new Uint32Array(dynBuffer),this.dynamicBuffer=new Buffer(this.dynamicData,!1,!1);var staticOffset=0;this.staticStride=0;for(i=0;i<this.staticProperties.length;++i){(property=this.staticProperties[i]).offset=staticOffset,staticOffset+=property.size,this.staticStride+=property.size}var statBuffer=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(statBuffer),this.staticDataUint32=new Uint32Array(statBuffer),this.staticBuffer=new Buffer(this.staticData,!0,!1);for(i=0;i<this.dynamicProperties.length;++i){var property=this.dynamicProperties[i];geometry.addAttribute(property.attributeName,this.dynamicBuffer,0,property.type===TYPES$1.UNSIGNED_BYTE,property.type,4*this.dynamicStride,4*property.offset)}for(i=0;i<this.staticProperties.length;++i){property=this.staticProperties[i];geometry.addAttribute(property.attributeName,this.staticBuffer,0,property.type===TYPES$1.UNSIGNED_BYTE,property.type,4*this.staticStride,4*property.offset)}},ParticleBuffer.prototype.uploadDynamic=function(children,startIndex,amount){for(var i=0;i<this.dynamicProperties.length;i++){var property=this.dynamicProperties[i];property.uploadFunction(children,startIndex,amount,property.type===TYPES$1.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,property.offset)}this.dynamicBuffer._updateID++},ParticleBuffer.prototype.uploadStatic=function(children,startIndex,amount){for(var i=0;i<this.staticProperties.length;i++){var property=this.staticProperties[i];property.uploadFunction(children,startIndex,amount,property.type===TYPES$1.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,property.offset)}this.staticBuffer._updateID++},ParticleBuffer.prototype.destroy=function(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()},ParticleBuffer}(),ParticleRenderer=function(_super){function ParticleRenderer(renderer){var _this=_super.call(this,renderer)||this;return _this.shader=null,_this.properties=null,_this.tempMatrix=new Matrix,_this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:_this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:_this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:_this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:_this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:TYPES$1.UNSIGNED_BYTE,uploadFunction:_this.uploadTint,offset:0}],_this.shader=Shader.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n","varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}",{}),_this.state=State.for2d(),_this}return __extends$6(ParticleRenderer,_super),ParticleRenderer.prototype.render=function(container){var children=container.children,maxSize=container._maxSize,batchSize=container._batchSize,renderer=this.renderer,totalChildren=children.length;if(0!==totalChildren){totalChildren>maxSize&&!container.autoResize&&(totalChildren=maxSize);var buffers=container._buffers;buffers||(buffers=container._buffers=this.generateBuffers(container));var baseTexture=children[0]._texture.baseTexture;this.state.blendMode=correctBlendMode(container.blendMode,baseTexture.alphaMode),renderer.state.set(this.state);var gl=renderer.gl,m=container.worldTransform.copyTo(this.tempMatrix);m.prepend(renderer.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=m.toArray(!0),this.shader.uniforms.uColor=function(rgb,alpha,out,premultiply){return out=out||new Float32Array(4),premultiply||void 0===premultiply?(out[0]=rgb[0]*alpha,out[1]=rgb[1]*alpha,out[2]=rgb[2]*alpha):(out[0]=rgb[0],out[1]=rgb[1],out[2]=rgb[2]),out[3]=alpha,out}(container.tintRgb,container.worldAlpha,this.shader.uniforms.uColor,baseTexture.alphaMode),this.shader.uniforms.uSampler=baseTexture,this.renderer.shader.bind(this.shader);for(var updateStatic=!1,i=0,j=0;i<totalChildren;i+=batchSize,j+=1){var amount=totalChildren-i;amount>batchSize&&(amount=batchSize),j>=buffers.length&&buffers.push(this._generateOneMoreBuffer(container));var buffer=buffers[j];buffer.uploadDynamic(children,i,amount);var bid=container._bufferUpdateIDs[j]||0;(updateStatic=updateStatic||buffer._updateID<bid)&&(buffer._updateID=container._updateID,buffer.uploadStatic(children,i,amount)),renderer.geometry.bind(buffer.geometry),gl.drawElements(gl.TRIANGLES,6*amount,gl.UNSIGNED_SHORT,0)}}},ParticleRenderer.prototype.generateBuffers=function(container){for(var buffers=[],size=container._maxSize,batchSize=container._batchSize,dynamicPropertyFlags=container._properties,i=0;i<size;i+=batchSize)buffers.push(new ParticleBuffer(this.properties,dynamicPropertyFlags,batchSize));return buffers},ParticleRenderer.prototype._generateOneMoreBuffer=function(container){var batchSize=container._batchSize,dynamicPropertyFlags=container._properties;return new ParticleBuffer(this.properties,dynamicPropertyFlags,batchSize)},ParticleRenderer.prototype.uploadVertices=function(children,startIndex,amount,array,stride,offset){for(var w0=0,w1=0,h0=0,h1=0,i=0;i<amount;++i){var sprite=children[startIndex+i],texture=sprite._texture,sx=sprite.scale.x,sy=sprite.scale.y,trim=texture.trim,orig=texture.orig;trim?(w0=(w1=trim.x-sprite.anchor.x*orig.width)+trim.width,h0=(h1=trim.y-sprite.anchor.y*orig.height)+trim.height):(w0=orig.width*(1-sprite.anchor.x),w1=orig.width*-sprite.anchor.x,h0=orig.height*(1-sprite.anchor.y),h1=orig.height*-sprite.anchor.y),array[offset]=w1*sx,array[offset+1]=h1*sy,array[offset+stride]=w0*sx,array[offset+stride+1]=h1*sy,array[offset+2*stride]=w0*sx,array[offset+2*stride+1]=h0*sy,array[offset+3*stride]=w1*sx,array[offset+3*stride+1]=h0*sy,offset+=4*stride}},ParticleRenderer.prototype.uploadPosition=function(children,startIndex,amount,array,stride,offset){for(var i=0;i<amount;i++){var spritePosition=children[startIndex+i].position;array[offset]=spritePosition.x,array[offset+1]=spritePosition.y,array[offset+stride]=spritePosition.x,array[offset+stride+1]=spritePosition.y,array[offset+2*stride]=spritePosition.x,array[offset+2*stride+1]=spritePosition.y,array[offset+3*stride]=spritePosition.x,array[offset+3*stride+1]=spritePosition.y,offset+=4*stride}},ParticleRenderer.prototype.uploadRotation=function(children,startIndex,amount,array,stride,offset){for(var i=0;i<amount;i++){var spriteRotation=children[startIndex+i].rotation;array[offset]=spriteRotation,array[offset+stride]=spriteRotation,array[offset+2*stride]=spriteRotation,array[offset+3*stride]=spriteRotation,offset+=4*stride}},ParticleRenderer.prototype.uploadUvs=function(children,startIndex,amount,array,stride,offset){for(var i=0;i<amount;++i){var textureUvs=children[startIndex+i]._texture._uvs;textureUvs?(array[offset]=textureUvs.x0,array[offset+1]=textureUvs.y0,array[offset+stride]=textureUvs.x1,array[offset+stride+1]=textureUvs.y1,array[offset+2*stride]=textureUvs.x2,array[offset+2*stride+1]=textureUvs.y2,array[offset+3*stride]=textureUvs.x3,array[offset+3*stride+1]=textureUvs.y3,offset+=4*stride):(array[offset]=0,array[offset+1]=0,array[offset+stride]=0,array[offset+stride+1]=0,array[offset+2*stride]=0,array[offset+2*stride+1]=0,array[offset+3*stride]=0,array[offset+3*stride+1]=0,offset+=4*stride)}},ParticleRenderer.prototype.uploadTint=function(children,startIndex,amount,array,stride,offset){for(var i=0;i<amount;++i){var sprite=children[startIndex+i],premultiplied=sprite._texture.baseTexture.alphaMode>0,alpha=sprite.alpha,argb=alpha<1&&premultiplied?premultiplyTint(sprite._tintRGB,alpha):sprite._tintRGB+(255*alpha<<24);array[offset]=argb,array[offset+stride]=argb,array[offset+2*stride]=argb,array[offset+3*stride]=argb,offset+=4*stride}},ParticleRenderer.prototype.destroy=function(){_super.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},ParticleRenderer}(ObjectRenderer);!function(LINE_JOIN){LINE_JOIN.MITER="miter",LINE_JOIN.BEVEL="bevel",LINE_JOIN.ROUND="round"}(LINE_JOIN||(LINE_JOIN={})),function(LINE_CAP){LINE_CAP.BUTT="butt",LINE_CAP.ROUND="round",LINE_CAP.SQUARE="square"}(LINE_CAP||(LINE_CAP={}));var GRAPHICS_CURVES={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(length,defaultSegments){if(void 0===defaultSegments&&(defaultSegments=20),!this.adaptive||!length||isNaN(length))return defaultSegments;var result=Math.ceil(length/this.maxLength);return result<this.minSegments?result=this.minSegments:result>this.maxSegments&&(result=this.maxSegments),result}},FillStyle=function(){function FillStyle(){this.color=16777215,this.alpha=1,this.texture=Texture.WHITE,this.matrix=null,this.visible=!1,this.reset()}return FillStyle.prototype.clone=function(){var obj=new FillStyle;return obj.color=this.color,obj.alpha=this.alpha,obj.texture=this.texture,obj.matrix=this.matrix,obj.visible=this.visible,obj},FillStyle.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=Texture.WHITE,this.matrix=null,this.visible=!1},FillStyle.prototype.destroy=function(){this.texture=null,this.matrix=null},FillStyle}(),extendStatics$7=function(d,b){return extendStatics$7=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$7(d,b)};function __extends$7(d,b){function __(){this.constructor=d}extendStatics$7(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}function fixOrientation(points,hole){var _a,_b;void 0===hole&&(hole=!1);var m=points.length;if(!(m<6)){for(var area=0,i=0,x1=points[m-2],y1=points[m-1];i<m;i+=2){var x2=points[i],y2=points[i+1];area+=(x2-x1)*(y2+y1),x1=x2,y1=y2}if(!hole&&area>0||hole&&area<=0){var n=m/2;for(i=n+n%2;i<m;i+=2){var i1=m-i-2,i2=m-i-1,i3=i,i4=i+1;_a=[points[i3],points[i1]],points[i1]=_a[0],points[i3]=_a[1],_b=[points[i4],points[i2]],points[i2]=_b[0],points[i4]=_b[1]}}}}var buildPoly={build:function(graphicsData){graphicsData.points=graphicsData.shape.points.slice()},triangulate:function(graphicsData,graphicsGeometry){var points=graphicsData.points,holes=graphicsData.holes,verts=graphicsGeometry.points,indices=graphicsGeometry.indices;if(points.length>=6){fixOrientation(points,!1);for(var holeArray=[],i=0;i<holes.length;i++){var hole=holes[i];fixOrientation(hole.points,!0),holeArray.push(points.length/2),points=points.concat(hole.points)}var triangles=earcut_1(points,holeArray,2);if(!triangles)return;var vertPos=verts.length/2;for(i=0;i<triangles.length;i+=3)indices.push(triangles[i]+vertPos),indices.push(triangles[i+1]+vertPos),indices.push(triangles[i+2]+vertPos);for(i=0;i<points.length;i++)verts.push(points[i])}}},buildCircle={build:function(graphicsData){var x,y,dx,dy,rx,ry,points=graphicsData.points;if(graphicsData.type===SHAPES.CIRC){var circle=graphicsData.shape;x=circle.x,y=circle.y,rx=ry=circle.radius,dx=dy=0}else if(graphicsData.type===SHAPES.ELIP){var ellipse=graphicsData.shape;x=ellipse.x,y=ellipse.y,rx=ellipse.width,ry=ellipse.height,dx=dy=0}else{var roundedRect=graphicsData.shape,halfWidth=roundedRect.width/2,halfHeight=roundedRect.height/2;x=roundedRect.x+halfWidth,y=roundedRect.y+halfHeight,dx=halfWidth-(rx=ry=Math.max(0,Math.min(roundedRect.radius,Math.min(halfWidth,halfHeight)))),dy=halfHeight-ry}if(rx>=0&&ry>=0&&dx>=0&&dy>=0){var n=Math.ceil(2.3*Math.sqrt(rx+ry)),m=8*n+(dx?4:0)+(dy?4:0);if(points.length=m,0!==m){if(0===n)return points.length=8,points[0]=points[6]=x+dx,points[1]=points[3]=y+dy,points[2]=points[4]=x-dx,void(points[5]=points[7]=y-dy);var j1=0,j2=4*n+(dx?2:0)+2,j3=j2,j4=m,x1=x+(x0=dx+rx),x2=x-x0,y1=y+(y0=dy);if(points[j1++]=x1,points[j1++]=y1,points[--j2]=y1,points[--j2]=x2,dy){var y2=y-y0;points[j3++]=x2,points[j3++]=y2,points[--j4]=y2,points[--j4]=x1}for(var i=1;i<n;i++){var a=Math.PI/2*(i/n);x1=x+(x0=dx+Math.cos(a)*rx),x2=x-x0,y1=y+(y0=dy+Math.sin(a)*ry),y2=y-y0;points[j1++]=x1,points[j1++]=y1,points[--j2]=y1,points[--j2]=x2,points[j3++]=x2,points[j3++]=y2,points[--j4]=y2,points[--j4]=x1}var x0,y0;x1=x+(x0=dx),x2=x-x0,y1=y+(y0=dy+ry),y2=y-y0;points[j1++]=x1,points[j1++]=y1,points[--j4]=y2,points[--j4]=x1,dx&&(points[j1++]=x2,points[j1++]=y1,points[--j4]=y2,points[--j4]=x2)}}else points.length=0},triangulate:function(graphicsData,graphicsGeometry){var x,y,points=graphicsData.points,verts=graphicsGeometry.points,indices=graphicsGeometry.indices,vertPos=verts.length/2,center=vertPos;if(graphicsData.type!==SHAPES.RREC){var circle=graphicsData.shape;x=circle.x,y=circle.y}else{var roundedRect=graphicsData.shape;x=roundedRect.x+roundedRect.width/2,y=roundedRect.y+roundedRect.height/2}var matrix=graphicsData.matrix;verts.push(graphicsData.matrix?matrix.a*x+matrix.c*y+matrix.tx:x,graphicsData.matrix?matrix.b*x+matrix.d*y+matrix.ty:y),vertPos++,verts.push(points[0],points[1]);for(var i=2;i<points.length;i+=2)verts.push(points[i],points[i+1]),indices.push(vertPos++,center,vertPos);indices.push(center+1,center,vertPos)}};function getPt(n1,n2,perc){return n1+(n2-n1)*perc}function quadraticBezierCurve(fromX,fromY,cpX,cpY,toX,toY,out){void 0===out&&(out=[]);for(var points=out,xa=0,ya=0,xb=0,yb=0,x=0,y=0,i=0,j=0;i<=20;++i)xa=getPt(fromX,cpX,j=i/20),ya=getPt(fromY,cpY,j),xb=getPt(cpX,toX,j),yb=getPt(cpY,toY,j),x=getPt(xa,xb,j),y=getPt(ya,yb,j),0===i&&points[points.length-2]===x&&points[points.length-1]===y||points.push(x,y);return points}var buildRoundedRectangle={build:function(graphicsData){if(Graphics.nextRoundedRectBehavior)buildCircle.build(graphicsData);else{var rrectData=graphicsData.shape,points=graphicsData.points,x=rrectData.x,y=rrectData.y,width=rrectData.width,height=rrectData.height,radius=Math.max(0,Math.min(rrectData.radius,Math.min(width,height)/2));points.length=0,radius?(quadraticBezierCurve(x,y+radius,x,y,x+radius,y,points),quadraticBezierCurve(x+width-radius,y,x+width,y,x+width,y+radius,points),quadraticBezierCurve(x+width,y+height-radius,x+width,y+height,x+width-radius,y+height,points),quadraticBezierCurve(x+radius,y+height,x,y+height,x,y+height-radius,points)):points.push(x,y,x+width,y,x+width,y+height,x,y+height)}},triangulate:function(graphicsData,graphicsGeometry){if(Graphics.nextRoundedRectBehavior)buildCircle.triangulate(graphicsData,graphicsGeometry);else{for(var points=graphicsData.points,verts=graphicsGeometry.points,indices=graphicsGeometry.indices,vecPos=verts.length/2,triangles=earcut_1(points,null,2),i=0,j=triangles.length;i<j;i+=3)indices.push(triangles[i]+vecPos),indices.push(triangles[i+1]+vecPos),indices.push(triangles[i+2]+vecPos);for(i=0,j=points.length;i<j;i++)verts.push(points[i],points[++i])}}};function square(x,y,nx,ny,innerWeight,outerWeight,clockwise,verts){var exx,eyy;clockwise?(exx=ny,eyy=-nx):(exx=-ny,eyy=nx);var eix=x-nx*innerWeight+exx,eiy=y-ny*innerWeight+eyy,eox=x+nx*outerWeight+exx,eoy=y+ny*outerWeight+eyy;return verts.push(eix,eiy),verts.push(eox,eoy),2}function round(cx,cy,sx,sy,ex,ey,verts,clockwise){var cx2p0x=sx-cx,cy2p0y=sy-cy,angle0=Math.atan2(cx2p0x,cy2p0y),angle1=Math.atan2(ex-cx,ey-cy);clockwise&&angle0<angle1?angle0+=2*Math.PI:!clockwise&&angle0>angle1&&(angle1+=2*Math.PI);var startAngle=angle0,angleDiff=angle1-angle0,absAngleDiff=Math.abs(angleDiff),radius=Math.sqrt(cx2p0x*cx2p0x+cy2p0y*cy2p0y),segCount=1+(15*absAngleDiff*Math.sqrt(radius)/Math.PI>>0),angleInc=angleDiff/segCount;if(startAngle+=angleInc,clockwise){verts.push(cx,cy),verts.push(sx,sy);for(var i=1,angle=startAngle;i<segCount;i++,angle+=angleInc)verts.push(cx,cy),verts.push(cx+Math.sin(angle)*radius,cy+Math.cos(angle)*radius);verts.push(cx,cy),verts.push(ex,ey)}else{verts.push(sx,sy),verts.push(cx,cy);for(i=1,angle=startAngle;i<segCount;i++,angle+=angleInc)verts.push(cx+Math.sin(angle)*radius,cy+Math.cos(angle)*radius),verts.push(cx,cy);verts.push(ex,ey),verts.push(cx,cy)}return 2*segCount}function buildLine(graphicsData,graphicsGeometry){graphicsData.lineStyle.native?function(graphicsData,graphicsGeometry){var i=0,shape=graphicsData.shape,points=graphicsData.points||shape.points,closedShape=shape.type!==SHAPES.POLY||shape.closeStroke;if(0!==points.length){var verts=graphicsGeometry.points,indices=graphicsGeometry.indices,length=points.length/2,startIndex=verts.length/2,currentIndex=startIndex;for(verts.push(points[0],points[1]),i=1;i<length;i++)verts.push(points[2*i],points[2*i+1]),indices.push(currentIndex,currentIndex+1),currentIndex++;closedShape&&indices.push(currentIndex,startIndex)}}(graphicsData,graphicsGeometry):function(graphicsData,graphicsGeometry){var shape=graphicsData.shape,points=graphicsData.points||shape.points.slice(),eps=graphicsGeometry.closePointEps;if(0!==points.length){var style=graphicsData.lineStyle,firstPoint=new Point(points[0],points[1]),lastPoint=new Point(points[points.length-2],points[points.length-1]),closedShape=shape.type!==SHAPES.POLY||shape.closeStroke,closedPath=Math.abs(firstPoint.x-lastPoint.x)<eps&&Math.abs(firstPoint.y-lastPoint.y)<eps;if(closedShape){points=points.slice(),closedPath&&(points.pop(),points.pop(),lastPoint.set(points[points.length-2],points[points.length-1]));var midPointX=.5*(firstPoint.x+lastPoint.x),midPointY=.5*(lastPoint.y+firstPoint.y);points.unshift(midPointX,midPointY),points.push(midPointX,midPointY)}var verts=graphicsGeometry.points,length=points.length/2,indexCount=points.length,indexStart=verts.length/2,width=style.width/2,widthSquared=width*width,miterLimitSquared=style.miterLimit*style.miterLimit,x0=points[0],y0=points[1],x1=points[2],y1=points[3],x2=0,y2=0,perpx=-(y0-y1),perpy=x0-x1,perp1x=0,perp1y=0,dist=Math.sqrt(perpx*perpx+perpy*perpy);perpx/=dist,perpy/=dist,perpx*=width,perpy*=width;var ratio=style.alignment,innerWeight=2*(1-ratio),outerWeight=2*ratio;closedShape||(style.cap===LINE_CAP.ROUND?indexCount+=round(x0-perpx*(innerWeight-outerWeight)*.5,y0-perpy*(innerWeight-outerWeight)*.5,x0-perpx*innerWeight,y0-perpy*innerWeight,x0+perpx*outerWeight,y0+perpy*outerWeight,verts,!0)+2:style.cap===LINE_CAP.SQUARE&&(indexCount+=square(x0,y0,perpx,perpy,innerWeight,outerWeight,!0,verts))),verts.push(x0-perpx*innerWeight,y0-perpy*innerWeight),verts.push(x0+perpx*outerWeight,y0+perpy*outerWeight);for(var i=1;i<length-1;++i){x0=points[2*(i-1)],y0=points[2*(i-1)+1],x1=points[2*i],y1=points[2*i+1],x2=points[2*(i+1)],y2=points[2*(i+1)+1],perpx=-(y0-y1),perpy=x0-x1,perpx/=dist=Math.sqrt(perpx*perpx+perpy*perpy),perpy/=dist,perpx*=width,perpy*=width,perp1x=-(y1-y2),perp1y=x1-x2,perp1x/=dist=Math.sqrt(perp1x*perp1x+perp1y*perp1y),perp1y/=dist,perp1x*=width,perp1y*=width;var dx0=x1-x0,dy0=y0-y1,dx1=x1-x2,dy1=y2-y1,cross=dy0*dx1-dy1*dx0,clockwise=cross<0;if(Math.abs(cross)<.1)verts.push(x1-perpx*innerWeight,y1-perpy*innerWeight),verts.push(x1+perpx*outerWeight,y1+perpy*outerWeight);else{var c1=(-perpx+x0)*(-perpy+y1)-(-perpx+x1)*(-perpy+y0),c2=(-perp1x+x2)*(-perp1y+y1)-(-perp1x+x1)*(-perp1y+y2),px=(dx0*c2-dx1*c1)/cross,py=(dy1*c1-dy0*c2)/cross,pdist=(px-x1)*(px-x1)+(py-y1)*(py-y1),imx=x1+(px-x1)*innerWeight,imy=y1+(py-y1)*innerWeight,omx=x1-(px-x1)*outerWeight,omy=y1-(py-y1)*outerWeight,insideWeight=clockwise?innerWeight:outerWeight;pdist<=Math.min(dx0*dx0+dy0*dy0,dx1*dx1+dy1*dy1)+insideWeight*insideWeight*widthSquared?style.join===LINE_JOIN.BEVEL||pdist/widthSquared>miterLimitSquared?(clockwise?(verts.push(imx,imy),verts.push(x1+perpx*outerWeight,y1+perpy*outerWeight),verts.push(imx,imy),verts.push(x1+perp1x*outerWeight,y1+perp1y*outerWeight)):(verts.push(x1-perpx*innerWeight,y1-perpy*innerWeight),verts.push(omx,omy),verts.push(x1-perp1x*innerWeight,y1-perp1y*innerWeight),verts.push(omx,omy)),indexCount+=2):style.join===LINE_JOIN.ROUND?clockwise?(verts.push(imx,imy),verts.push(x1+perpx*outerWeight,y1+perpy*outerWeight),indexCount+=round(x1,y1,x1+perpx*outerWeight,y1+perpy*outerWeight,x1+perp1x*outerWeight,y1+perp1y*outerWeight,verts,!0)+4,verts.push(imx,imy),verts.push(x1+perp1x*outerWeight,y1+perp1y*outerWeight)):(verts.push(x1-perpx*innerWeight,y1-perpy*innerWeight),verts.push(omx,omy),indexCount+=round(x1,y1,x1-perpx*innerWeight,y1-perpy*innerWeight,x1-perp1x*innerWeight,y1-perp1y*innerWeight,verts,!1)+4,verts.push(x1-perp1x*innerWeight,y1-perp1y*innerWeight),verts.push(omx,omy)):(verts.push(imx,imy),verts.push(omx,omy)):(verts.push(x1-perpx*innerWeight,y1-perpy*innerWeight),verts.push(x1+perpx*outerWeight,y1+perpy*outerWeight),style.join===LINE_JOIN.ROUND?indexCount+=clockwise?round(x1,y1,x1+perpx*outerWeight,y1+perpy*outerWeight,x1+perp1x*outerWeight,y1+perp1y*outerWeight,verts,!0)+2:round(x1,y1,x1-perpx*innerWeight,y1-perpy*innerWeight,x1-perp1x*innerWeight,y1-perp1y*innerWeight,verts,!1)+2:style.join===LINE_JOIN.MITER&&pdist/widthSquared<=miterLimitSquared&&(clockwise?(verts.push(omx,omy),verts.push(omx,omy)):(verts.push(imx,imy),verts.push(imx,imy)),indexCount+=2),verts.push(x1-perp1x*innerWeight,y1-perp1y*innerWeight),verts.push(x1+perp1x*outerWeight,y1+perp1y*outerWeight),indexCount+=2)}}x0=points[2*(length-2)],y0=points[2*(length-2)+1],x1=points[2*(length-1)],perpx=-(y0-(y1=points[2*(length-1)+1])),perpy=x0-x1,perpx/=dist=Math.sqrt(perpx*perpx+perpy*perpy),perpy/=dist,perpx*=width,perpy*=width,verts.push(x1-perpx*innerWeight,y1-perpy*innerWeight),verts.push(x1+perpx*outerWeight,y1+perpy*outerWeight),closedShape||(style.cap===LINE_CAP.ROUND?indexCount+=round(x1-perpx*(innerWeight-outerWeight)*.5,y1-perpy*(innerWeight-outerWeight)*.5,x1-perpx*innerWeight,y1-perpy*innerWeight,x1+perpx*outerWeight,y1+perpy*outerWeight,verts,!1)+2:style.cap===LINE_CAP.SQUARE&&(indexCount+=square(x1,y1,perpx,perpy,innerWeight,outerWeight,!1,verts)));var indices=graphicsGeometry.indices,eps2=GRAPHICS_CURVES.epsilon*GRAPHICS_CURVES.epsilon;for(i=indexStart;i<indexCount+indexStart-2;++i)x0=verts[2*i],y0=verts[2*i+1],x1=verts[2*(i+1)],y1=verts[2*(i+1)+1],x2=verts[2*(i+2)],y2=verts[2*(i+2)+1],Math.abs(x0*(y1-y2)+x1*(y2-y0)+x2*(y0-y1))<eps2||indices.push(i,i+1,i+2)}}(graphicsData,graphicsGeometry)}var _a$3,ArcUtils=function(){function ArcUtils(){}return ArcUtils.curveTo=function(x1,y1,x2,y2,radius,points){var fromX=points[points.length-2],a1=points[points.length-1]-y1,b1=fromX-x1,a2=y2-y1,b2=x2-x1,mm=Math.abs(a1*b2-b1*a2);if(mm<1e-8||0===radius)return points[points.length-2]===x1&&points[points.length-1]===y1||points.push(x1,y1),null;var dd=a1*a1+b1*b1,cc=a2*a2+b2*b2,tt=a1*a2+b1*b2,k1=radius*Math.sqrt(dd)/mm,k2=radius*Math.sqrt(cc)/mm,j1=k1*tt/dd,j2=k2*tt/cc,cx=k1*b2+k2*b1,cy=k1*a2+k2*a1,px=b1*(k2+j1),py=a1*(k2+j1),qx=b2*(k1+j2),qy=a2*(k1+j2);return{cx:cx+x1,cy:cy+y1,radius:radius,startAngle:Math.atan2(py-cy,px-cx),endAngle:Math.atan2(qy-cy,qx-cx),anticlockwise:b1*a2>b2*a1}},ArcUtils.arc=function(_startX,_startY,cx,cy,radius,startAngle,endAngle,_anticlockwise,points){for(var sweep=endAngle-startAngle,n=GRAPHICS_CURVES._segmentsCount(Math.abs(sweep)*radius,40*Math.ceil(Math.abs(sweep)/PI_2)),theta=sweep/(2*n),theta2=2*theta,cTheta=Math.cos(theta),sTheta=Math.sin(theta),segMinus=n-1,remainder=segMinus%1/segMinus,i=0;i<=segMinus;++i){var angle=theta+startAngle+theta2*(i+remainder*i),c=Math.cos(angle),s=-Math.sin(angle);points.push((cTheta*c+sTheta*s)*radius+cx,(cTheta*-s+sTheta*c)*radius+cy)}},ArcUtils}(),BezierUtils=function(){function BezierUtils(){}return BezierUtils.curveLength=function(fromX,fromY,cpX,cpY,cpX2,cpY2,toX,toY){for(var result=0,t=0,t2=0,t3=0,nt=0,nt2=0,nt3=0,x=0,y=0,dx=0,dy=0,prevX=fromX,prevY=fromY,i=1;i<=10;++i)dx=prevX-(x=(nt3=(nt2=(nt=1-(t=i/10))*nt)*nt)*fromX+3*nt2*t*cpX+3*nt*(t2=t*t)*cpX2+(t3=t2*t)*toX),dy=prevY-(y=nt3*fromY+3*nt2*t*cpY+3*nt*t2*cpY2+t3*toY),prevX=x,prevY=y,result+=Math.sqrt(dx*dx+dy*dy);return result},BezierUtils.curveTo=function(cpX,cpY,cpX2,cpY2,toX,toY,points){var fromX=points[points.length-2],fromY=points[points.length-1];points.length-=2;var n=GRAPHICS_CURVES._segmentsCount(BezierUtils.curveLength(fromX,fromY,cpX,cpY,cpX2,cpY2,toX,toY)),dt=0,dt2=0,dt3=0,t2=0,t3=0;points.push(fromX,fromY);for(var i=1,j=0;i<=n;++i)dt3=(dt2=(dt=1-(j=i/n))*dt)*dt,t3=(t2=j*j)*j,points.push(dt3*fromX+3*dt2*j*cpX+3*dt*t2*cpX2+t3*toX,dt3*fromY+3*dt2*j*cpY+3*dt*t2*cpY2+t3*toY)},BezierUtils}(),QuadraticUtils=function(){function QuadraticUtils(){}return QuadraticUtils.curveLength=function(fromX,fromY,cpX,cpY,toX,toY){var ax=fromX-2*cpX+toX,ay=fromY-2*cpY+toY,bx=2*cpX-2*fromX,by=2*cpY-2*fromY,a=4*(ax*ax+ay*ay),b=4*(ax*bx+ay*by),c=bx*bx+by*by,s=2*Math.sqrt(a+b+c),a2=Math.sqrt(a),a32=2*a*a2,c2=2*Math.sqrt(c),ba=b/a2;return(a32*s+a2*b*(s-c2)+(4*c*a-b*b)*Math.log((2*a2+ba+s)/(ba+c2)))/(4*a32)},QuadraticUtils.curveTo=function(cpX,cpY,toX,toY,points){for(var fromX=points[points.length-2],fromY=points[points.length-1],n=GRAPHICS_CURVES._segmentsCount(QuadraticUtils.curveLength(fromX,fromY,cpX,cpY,toX,toY)),xa=0,ya=0,i=1;i<=n;++i){var j=i/n;xa=fromX+(cpX-fromX)*j,ya=fromY+(cpY-fromY)*j,points.push(xa+(cpX+(toX-cpX)*j-xa)*j,ya+(cpY+(toY-cpY)*j-ya)*j)}},QuadraticUtils}(),BatchPart=function(){function BatchPart(){this.reset()}return BatchPart.prototype.begin=function(style,startIndex,attribStart){this.reset(),this.style=style,this.start=startIndex,this.attribStart=attribStart},BatchPart.prototype.end=function(endIndex,endAttrib){this.attribSize=endAttrib-this.attribStart,this.size=endIndex-this.start},BatchPart.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},BatchPart}(),FILL_COMMANDS=((_a$3={})[SHAPES.POLY]=buildPoly,_a$3[SHAPES.CIRC]=buildCircle,_a$3[SHAPES.ELIP]=buildCircle,_a$3[SHAPES.RECT]={build:function(graphicsData){var rectData=graphicsData.shape,x=rectData.x,y=rectData.y,width=rectData.width,height=rectData.height,points=graphicsData.points;points.length=0,points.push(x,y,x+width,y,x+width,y+height,x,y+height)},triangulate:function(graphicsData,graphicsGeometry){var points=graphicsData.points,verts=graphicsGeometry.points,vertPos=verts.length/2;verts.push(points[0],points[1],points[2],points[3],points[6],points[7],points[4],points[5]),graphicsGeometry.indices.push(vertPos,vertPos+1,vertPos+2,vertPos+1,vertPos+2,vertPos+3)}},_a$3[SHAPES.RREC]=buildRoundedRectangle,_a$3),BATCH_POOL=[],DRAW_CALL_POOL=[],GraphicsData=function(){function GraphicsData(shape,fillStyle,lineStyle,matrix){void 0===fillStyle&&(fillStyle=null),void 0===lineStyle&&(lineStyle=null),void 0===matrix&&(matrix=null),this.points=[],this.holes=[],this.shape=shape,this.lineStyle=lineStyle,this.fillStyle=fillStyle,this.matrix=matrix,this.type=shape.type}return GraphicsData.prototype.clone=function(){return new GraphicsData(this.shape,this.fillStyle,this.lineStyle,this.matrix)},GraphicsData.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},GraphicsData}(),tmpPoint=new Point,tmpBounds=new Bounds,GraphicsGeometry=function(_super){function GraphicsGeometry(){var _this=_super.call(this)||this;return _this.closePointEps=1e-4,_this.boundsPadding=0,_this.uvsFloat32=null,_this.indicesUint16=null,_this.batchable=!1,_this.points=[],_this.colors=[],_this.uvs=[],_this.indices=[],_this.textureIds=[],_this.graphicsData=[],_this.drawCalls=[],_this.batchDirty=-1,_this.batches=[],_this.dirty=0,_this.cacheDirty=-1,_this.clearDirty=0,_this.shapeIndex=0,_this._bounds=new Bounds,_this.boundsDirty=-1,_this}return __extends$7(GraphicsGeometry,_super),Object.defineProperty(GraphicsGeometry.prototype,"bounds",{get:function(){return this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),GraphicsGeometry.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var i=0;i<this.drawCalls.length;i++)this.drawCalls[i].texArray.clear(),DRAW_CALL_POOL.push(this.drawCalls[i]);this.drawCalls.length=0;for(i=0;i<this.batches.length;i++){var batchPart=this.batches[i];batchPart.reset(),BATCH_POOL.push(batchPart)}this.batches.length=0},GraphicsGeometry.prototype.clear=function(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},GraphicsGeometry.prototype.drawShape=function(shape,fillStyle,lineStyle,matrix){void 0===fillStyle&&(fillStyle=null),void 0===lineStyle&&(lineStyle=null),void 0===matrix&&(matrix=null);var data=new GraphicsData(shape,fillStyle,lineStyle,matrix);return this.graphicsData.push(data),this.dirty++,this},GraphicsGeometry.prototype.drawHole=function(shape,matrix){if(void 0===matrix&&(matrix=null),!this.graphicsData.length)return null;var data=new GraphicsData(shape,null,null,matrix),lastShape=this.graphicsData[this.graphicsData.length-1];return data.lineStyle=lastShape.lineStyle,lastShape.holes.push(data),this.dirty++,this},GraphicsGeometry.prototype.destroy=function(){_super.prototype.destroy.call(this);for(var i=0;i<this.graphicsData.length;++i)this.graphicsData[i].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null},GraphicsGeometry.prototype.containsPoint=function(point){for(var graphicsData=this.graphicsData,i=0;i<graphicsData.length;++i){var data=graphicsData[i];if(data.fillStyle.visible&&(data.shape&&(data.matrix?data.matrix.applyInverse(point,tmpPoint):tmpPoint.copyFrom(point),data.shape.contains(tmpPoint.x,tmpPoint.y)))){var hitHole=!1;if(data.holes)for(var i_1=0;i_1<data.holes.length;i_1++){if(data.holes[i_1].shape.contains(tmpPoint.x,tmpPoint.y)){hitHole=!0;break}}if(!hitHole)return!0}}return!1},GraphicsGeometry.prototype.updateBatches=function(allow32Indices){if(this.graphicsData.length){if(this.validateBatching()){this.cacheDirty=this.dirty;var uvs=this.uvs,graphicsData=this.graphicsData,batchPart=null,currentStyle=null;this.batches.length>0&&(currentStyle=(batchPart=this.batches[this.batches.length-1]).style);for(var i=this.shapeIndex;i<graphicsData.length;i++){this.shapeIndex++;var data=graphicsData[i],fillStyle=data.fillStyle,lineStyle=data.lineStyle;FILL_COMMANDS[data.type].build(data),data.matrix&&this.transformPoints(data.points,data.matrix),(fillStyle.visible||lineStyle.visible)&&this.processHoles(data.holes);for(var j=0;j<2;j++){var style=0===j?fillStyle:lineStyle;if(style.visible){var nextTexture=style.texture.baseTexture,index_1=this.indices.length,attribIndex=this.points.length/2;nextTexture.wrapMode=WRAP_MODES$1.REPEAT,0===j?this.processFill(data):this.processLine(data);var size=this.points.length/2-attribIndex;0!==size&&(batchPart&&!this._compareStyles(currentStyle,style)&&(batchPart.end(index_1,attribIndex),batchPart=null),batchPart||((batchPart=BATCH_POOL.pop()||new BatchPart).begin(style,index_1,attribIndex),this.batches.push(batchPart),currentStyle=style),this.addUvs(this.points,uvs,style.texture,attribIndex,size,style.matrix))}}}var index=this.indices.length,attrib=this.points.length/2;if(batchPart&&batchPart.end(index,attrib),0!==this.batches.length){if(this.indicesUint16&&this.indices.length===this.indicesUint16.length)this.indicesUint16.set(this.indices);else{var need32=attrib>65535&&allow32Indices;this.indicesUint16=need32?new Uint32Array(this.indices):new Uint16Array(this.indices)}this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},GraphicsGeometry.prototype._compareStyles=function(styleA,styleB){return!(!styleA||!styleB)&&(styleA.texture.baseTexture===styleB.texture.baseTexture&&(styleA.color+styleA.alpha===styleB.color+styleB.alpha&&!!styleA.native==!!styleB.native))},GraphicsGeometry.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var i=0,l=this.graphicsData.length;i<l;i++){var data=this.graphicsData[i],fill=data.fillStyle,line=data.lineStyle;if(fill&&!fill.texture.baseTexture.valid)return!1;if(line&&!line.texture.baseTexture.valid)return!1}return!0},GraphicsGeometry.prototype.packBatches=function(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);for(var batches=this.batches,i=0,l=batches.length;i<l;i++)for(var batch=batches[i],j=0;j<batch.size;j++){var index=batch.start+j;this.indicesUint16[index]=this.indicesUint16[index]-batch.attribStart}},GraphicsGeometry.prototype.isBatchable=function(){if(this.points.length>131070)return!1;for(var batches=this.batches,i=0;i<batches.length;i++)if(batches[i].style.native)return!1;return this.points.length<2*GraphicsGeometry.BATCHABLE_SIZE},GraphicsGeometry.prototype.buildDrawCalls=function(){for(var TICK=++BaseTexture._globalBatch,i=0;i<this.drawCalls.length;i++)this.drawCalls[i].texArray.clear(),DRAW_CALL_POOL.push(this.drawCalls[i]);this.drawCalls.length=0;var colors=this.colors,textureIds=this.textureIds,currentGroup=DRAW_CALL_POOL.pop();currentGroup||((currentGroup=new BatchDrawCall).texArray=new BatchTextureArray),currentGroup.texArray.count=0,currentGroup.start=0,currentGroup.size=0,currentGroup.type=DRAW_MODES$1.TRIANGLES;var textureCount=0,currentTexture=null,textureId=0,native=!1,drawMode=DRAW_MODES$1.TRIANGLES,index=0;this.drawCalls.push(currentGroup);for(i=0;i<this.batches.length;i++){var data=this.batches[i],style=data.style,nextTexture=style.texture.baseTexture;native!==!!style.native&&(drawMode=(native=!!style.native)?DRAW_MODES$1.LINES:DRAW_MODES$1.TRIANGLES,currentTexture=null,textureCount=8,TICK++),currentTexture!==nextTexture&&(currentTexture=nextTexture,nextTexture._batchEnabled!==TICK&&(8===textureCount&&(TICK++,textureCount=0,currentGroup.size>0&&((currentGroup=DRAW_CALL_POOL.pop())||((currentGroup=new BatchDrawCall).texArray=new BatchTextureArray),this.drawCalls.push(currentGroup)),currentGroup.start=index,currentGroup.size=0,currentGroup.texArray.count=0,currentGroup.type=drawMode),nextTexture.touched=1,nextTexture._batchEnabled=TICK,nextTexture._batchLocation=textureCount,nextTexture.wrapMode=WRAP_MODES$1.REPEAT,currentGroup.texArray.elements[currentGroup.texArray.count++]=nextTexture,textureCount++)),currentGroup.size+=data.size,index+=data.size,textureId=nextTexture._batchLocation,this.addColors(colors,style.color,style.alpha,data.attribSize,data.attribStart),this.addTextureIds(textureIds,textureId,data.attribSize,data.attribStart)}BaseTexture._globalBatch=TICK,this.packAttributes()},GraphicsGeometry.prototype.packAttributes=function(){for(var verts=this.points,uvs=this.uvs,colors=this.colors,textureIds=this.textureIds,glPoints=new ArrayBuffer(3*verts.length*4),f32=new Float32Array(glPoints),u32=new Uint32Array(glPoints),p=0,i=0;i<verts.length/2;i++)f32[p++]=verts[2*i],f32[p++]=verts[2*i+1],f32[p++]=uvs[2*i],f32[p++]=uvs[2*i+1],u32[p++]=colors[i],f32[p++]=textureIds[i];this._buffer.update(glPoints),this._indexBuffer.update(this.indicesUint16)},GraphicsGeometry.prototype.processFill=function(data){data.holes.length?buildPoly.triangulate(data,this):FILL_COMMANDS[data.type].triangulate(data,this)},GraphicsGeometry.prototype.processLine=function(data){buildLine(data,this);for(var i=0;i<data.holes.length;i++)buildLine(data.holes[i],this)},GraphicsGeometry.prototype.processHoles=function(holes){for(var i=0;i<holes.length;i++){var hole=holes[i];FILL_COMMANDS[hole.type].build(hole),hole.matrix&&this.transformPoints(hole.points,hole.matrix)}},GraphicsGeometry.prototype.calculateBounds=function(){var bounds=this._bounds,sequenceBounds=tmpBounds,curMatrix=Matrix.IDENTITY;this._bounds.clear(),sequenceBounds.clear();for(var i=0;i<this.graphicsData.length;i++){var data=this.graphicsData[i],shape=data.shape,type=data.type,lineStyle=data.lineStyle,nextMatrix=data.matrix||Matrix.IDENTITY,lineWidth=0;if(lineStyle&&lineStyle.visible&&(lineWidth=lineStyle.width,type!==SHAPES.POLY||data.fillStyle.visible?lineWidth*=Math.max(0,lineStyle.alignment):lineWidth*=Math.max(lineStyle.alignment,1-lineStyle.alignment)),curMatrix!==nextMatrix&&(sequenceBounds.isEmpty()||(bounds.addBoundsMatrix(sequenceBounds,curMatrix),sequenceBounds.clear()),curMatrix=nextMatrix),type===SHAPES.RECT||type===SHAPES.RREC){var rect=shape;sequenceBounds.addFramePad(rect.x,rect.y,rect.x+rect.width,rect.y+rect.height,lineWidth,lineWidth)}else if(type===SHAPES.CIRC){var circle=shape;sequenceBounds.addFramePad(circle.x,circle.y,circle.x,circle.y,circle.radius+lineWidth,circle.radius+lineWidth)}else if(type===SHAPES.ELIP){var ellipse=shape;sequenceBounds.addFramePad(ellipse.x,ellipse.y,ellipse.x,ellipse.y,ellipse.width+lineWidth,ellipse.height+lineWidth)}else{var poly=shape;bounds.addVerticesMatrix(curMatrix,poly.points,0,poly.points.length,lineWidth,lineWidth)}}sequenceBounds.isEmpty()||bounds.addBoundsMatrix(sequenceBounds,curMatrix),bounds.pad(this.boundsPadding,this.boundsPadding)},GraphicsGeometry.prototype.transformPoints=function(points,matrix){for(var i=0;i<points.length/2;i++){var x=points[2*i],y=points[2*i+1];points[2*i]=matrix.a*x+matrix.c*y+matrix.tx,points[2*i+1]=matrix.b*x+matrix.d*y+matrix.ty}},GraphicsGeometry.prototype.addColors=function(colors,color,alpha,size,offset){void 0===offset&&(offset=0);var rgba=premultiplyTint((color>>16)+(65280&color)+((255&color)<<16),alpha);colors.length=Math.max(colors.length,offset+size);for(var i=0;i<size;i++)colors[offset+i]=rgba},GraphicsGeometry.prototype.addTextureIds=function(textureIds,id,size,offset){void 0===offset&&(offset=0),textureIds.length=Math.max(textureIds.length,offset+size);for(var i=0;i<size;i++)textureIds[offset+i]=id},GraphicsGeometry.prototype.addUvs=function(verts,uvs,texture,start,size,matrix){void 0===matrix&&(matrix=null);for(var index=0,uvsStart=uvs.length,frame=texture.frame;index<size;){var x=verts[2*(start+index)],y=verts[2*(start+index)+1];if(matrix){var nx=matrix.a*x+matrix.c*y+matrix.tx;y=matrix.b*x+matrix.d*y+matrix.ty,x=nx}index++,uvs.push(x/frame.width,y/frame.height)}var baseTexture=texture.baseTexture;(frame.width<baseTexture.width||frame.height<baseTexture.height)&&this.adjustUvs(uvs,texture,uvsStart,size)},GraphicsGeometry.prototype.adjustUvs=function(uvs,texture,start,size){for(var baseTexture=texture.baseTexture,eps=1e-6,finish=start+2*size,frame=texture.frame,scaleX=frame.width/baseTexture.width,scaleY=frame.height/baseTexture.height,offsetX=frame.x/frame.width,offsetY=frame.y/frame.height,minX=Math.floor(uvs[start]+eps),minY=Math.floor(uvs[start+1]+eps),i=start+2;i<finish;i+=2)minX=Math.min(minX,Math.floor(uvs[i]+eps)),minY=Math.min(minY,Math.floor(uvs[i+1]+eps));offsetX-=minX,offsetY-=minY;for(i=start;i<finish;i+=2)uvs[i]=(uvs[i]+offsetX)*scaleX,uvs[i+1]=(uvs[i+1]+offsetY)*scaleY},GraphicsGeometry.BATCHABLE_SIZE=100,GraphicsGeometry}(BatchGeometry),LineStyle=function(_super){function LineStyle(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.width=0,_this.alignment=.5,_this.native=!1,_this.cap=LINE_CAP.BUTT,_this.join=LINE_JOIN.MITER,_this.miterLimit=10,_this}return __extends$7(LineStyle,_super),LineStyle.prototype.clone=function(){var obj=new LineStyle;return obj.color=this.color,obj.alpha=this.alpha,obj.texture=this.texture,obj.matrix=this.matrix,obj.visible=this.visible,obj.width=this.width,obj.alignment=this.alignment,obj.native=this.native,obj.cap=this.cap,obj.join=this.join,obj.miterLimit=this.miterLimit,obj},LineStyle.prototype.reset=function(){_super.prototype.reset.call(this),this.color=0,this.alignment=.5,this.width=0,this.native=!1},LineStyle}(FillStyle),temp=new Float32Array(3),DEFAULT_SHADERS={},Graphics=function(_super){function Graphics(geometry){void 0===geometry&&(geometry=null);var _this=_super.call(this)||this;return _this.shader=null,_this.pluginName="batch",_this.currentPath=null,_this.batches=[],_this.batchTint=-1,_this.batchDirty=-1,_this.vertexData=null,_this._fillStyle=new FillStyle,_this._lineStyle=new LineStyle,_this._matrix=null,_this._holeMode=!1,_this.state=State.for2d(),_this._geometry=geometry||new GraphicsGeometry,_this._geometry.refCount++,_this._transformID=-1,_this.tint=16777215,_this.blendMode=BLEND_MODES$1.NORMAL,_this}return __extends$7(Graphics,_super),Object.defineProperty(Graphics.prototype,"geometry",{get:function(){return this._geometry},enumerable:!1,configurable:!0}),Graphics.prototype.clone=function(){return this.finishPoly(),new Graphics(this._geometry)},Object.defineProperty(Graphics.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(value){this.state.blendMode=value},enumerable:!1,configurable:!0}),Object.defineProperty(Graphics.prototype,"tint",{get:function(){return this._tint},set:function(value){this._tint=value},enumerable:!1,configurable:!0}),Object.defineProperty(Graphics.prototype,"fill",{get:function(){return this._fillStyle},enumerable:!1,configurable:!0}),Object.defineProperty(Graphics.prototype,"line",{get:function(){return this._lineStyle},enumerable:!1,configurable:!0}),Graphics.prototype.lineStyle=function(options,color,alpha,alignment,native){return void 0===options&&(options=null),void 0===color&&(color=0),void 0===alpha&&(alpha=1),void 0===alignment&&(alignment=.5),void 0===native&&(native=!1),"number"==typeof options&&(options={width:options,color:color,alpha:alpha,alignment:alignment,native:native}),this.lineTextureStyle(options)},Graphics.prototype.lineTextureStyle=function(options){options=Object.assign({width:0,texture:Texture.WHITE,color:options&&options.texture?16777215:0,alpha:1,matrix:null,alignment:.5,native:!1,cap:LINE_CAP.BUTT,join:LINE_JOIN.MITER,miterLimit:10},options),this.currentPath&&this.startPoly();var visible=options.width>0&&options.alpha>0;return visible?(options.matrix&&(options.matrix=options.matrix.clone(),options.matrix.invert()),Object.assign(this._lineStyle,{visible:visible},options)):this._lineStyle.reset(),this},Graphics.prototype.startPoly=function(){if(this.currentPath){var points=this.currentPath.points,len=this.currentPath.points.length;len>2&&(this.drawShape(this.currentPath),this.currentPath=new Polygon,this.currentPath.closeStroke=!1,this.currentPath.points.push(points[len-2],points[len-1]))}else this.currentPath=new Polygon,this.currentPath.closeStroke=!1},Graphics.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},Graphics.prototype.moveTo=function(x,y){return this.startPoly(),this.currentPath.points[0]=x,this.currentPath.points[1]=y,this},Graphics.prototype.lineTo=function(x,y){this.currentPath||this.moveTo(0,0);var points=this.currentPath.points,fromX=points[points.length-2],fromY=points[points.length-1];return fromX===x&&fromY===y||points.push(x,y),this},Graphics.prototype._initCurve=function(x,y){void 0===x&&(x=0),void 0===y&&(y=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[x,y]):this.moveTo(x,y)},Graphics.prototype.quadraticCurveTo=function(cpX,cpY,toX,toY){this._initCurve();var points=this.currentPath.points;return 0===points.length&&this.moveTo(0,0),QuadraticUtils.curveTo(cpX,cpY,toX,toY,points),this},Graphics.prototype.bezierCurveTo=function(cpX,cpY,cpX2,cpY2,toX,toY){return this._initCurve(),BezierUtils.curveTo(cpX,cpY,cpX2,cpY2,toX,toY,this.currentPath.points),this},Graphics.prototype.arcTo=function(x1,y1,x2,y2,radius){this._initCurve(x1,y1);var points=this.currentPath.points,result=ArcUtils.curveTo(x1,y1,x2,y2,radius,points);if(result){var cx=result.cx,cy=result.cy,radius_1=result.radius,startAngle=result.startAngle,endAngle=result.endAngle,anticlockwise=result.anticlockwise;this.arc(cx,cy,radius_1,startAngle,endAngle,anticlockwise)}return this},Graphics.prototype.arc=function(cx,cy,radius,startAngle,endAngle,anticlockwise){if(void 0===anticlockwise&&(anticlockwise=!1),startAngle===endAngle)return this;if(!anticlockwise&&endAngle<=startAngle?endAngle+=PI_2:anticlockwise&&startAngle<=endAngle&&(startAngle+=PI_2),0===endAngle-startAngle)return this;var startX=cx+Math.cos(startAngle)*radius,startY=cy+Math.sin(startAngle)*radius,eps=this._geometry.closePointEps,points=this.currentPath?this.currentPath.points:null;if(points){var xDiff=Math.abs(points[points.length-2]-startX),yDiff=Math.abs(points[points.length-1]-startY);xDiff<eps&&yDiff<eps||points.push(startX,startY)}else this.moveTo(startX,startY),points=this.currentPath.points;return ArcUtils.arc(startX,startY,cx,cy,radius,startAngle,endAngle,anticlockwise,points),this},Graphics.prototype.beginFill=function(color,alpha){return void 0===color&&(color=0),void 0===alpha&&(alpha=1),this.beginTextureFill({texture:Texture.WHITE,color:color,alpha:alpha})},Graphics.prototype.beginTextureFill=function(options){options=Object.assign({texture:Texture.WHITE,color:16777215,alpha:1,matrix:null},options),this.currentPath&&this.startPoly();var visible=options.alpha>0;return visible?(options.matrix&&(options.matrix=options.matrix.clone(),options.matrix.invert()),Object.assign(this._fillStyle,{visible:visible},options)):this._fillStyle.reset(),this},Graphics.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},Graphics.prototype.drawRect=function(x,y,width,height){return this.drawShape(new Rectangle(x,y,width,height))},Graphics.prototype.drawRoundedRect=function(x,y,width,height,radius){return this.drawShape(new RoundedRectangle(x,y,width,height,radius))},Graphics.prototype.drawCircle=function(x,y,radius){return this.drawShape(new Circle(x,y,radius))},Graphics.prototype.drawEllipse=function(x,y,width,height){return this.drawShape(new Ellipse(x,y,width,height))},Graphics.prototype.drawPolygon=function(){for(var points,arguments$1=arguments,path=[],_i=0;_i<arguments.length;_i++)path[_i]=arguments$1[_i];var closeStroke=!0,poly=path[0];poly.points?(closeStroke=poly.closeStroke,points=poly.points):points=Array.isArray(path[0])?path[0]:path;var shape=new Polygon(points);return shape.closeStroke=closeStroke,this.drawShape(shape),this},Graphics.prototype.drawShape=function(shape){return this._holeMode?this._geometry.drawHole(shape,this._matrix):this._geometry.drawShape(shape,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this},Graphics.prototype.clear=function(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this},Graphics.prototype.isFastRect=function(){var data=this._geometry.graphicsData;return!(1!==data.length||data[0].shape.type!==SHAPES.RECT||data[0].matrix||data[0].holes.length||data[0].lineStyle.visible&&data[0].lineStyle.width)},Graphics.prototype._render=function(renderer){this.finishPoly();var geometry=this._geometry,hasuint32=renderer.context.supports.uint32Indices;geometry.updateBatches(hasuint32),geometry.batchable?(this.batchDirty!==geometry.batchDirty&&this._populateBatches(),this._renderBatched(renderer)):(renderer.batch.flush(),this._renderDirect(renderer))},Graphics.prototype._populateBatches=function(){var geometry=this._geometry,blendMode=this.blendMode,len=geometry.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=geometry.batchDirty,this.batches.length=len,this.vertexData=new Float32Array(geometry.points);for(var i=0;i<len;i++){var gI=geometry.batches[i],color=gI.style.color,vertexData=new Float32Array(this.vertexData.buffer,4*gI.attribStart*2,2*gI.attribSize),uvs=new Float32Array(geometry.uvsFloat32.buffer,4*gI.attribStart*2,2*gI.attribSize),batch={vertexData:vertexData,blendMode:blendMode,indices:new Uint16Array(geometry.indicesUint16.buffer,2*gI.start,gI.size),uvs:uvs,_batchRGB:hex2rgb(color),_tintRGB:color,_texture:gI.style.texture,alpha:gI.style.alpha,worldAlpha:1};this.batches[i]=batch}},Graphics.prototype._renderBatched=function(renderer){if(this.batches.length){renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(var i=0,l=this.batches.length;i<l;i++){var batch=this.batches[i];batch.worldAlpha=this.worldAlpha*batch.alpha,renderer.plugins[this.pluginName].render(batch)}}},Graphics.prototype._renderDirect=function(renderer){var shader=this._resolveDirectShader(renderer),geometry=this._geometry,tint=this.tint,worldAlpha=this.worldAlpha,uniforms=shader.uniforms,drawCalls=geometry.drawCalls;uniforms.translationMatrix=this.transform.worldTransform,uniforms.tint[0]=(tint>>16&255)/255*worldAlpha,uniforms.tint[1]=(tint>>8&255)/255*worldAlpha,uniforms.tint[2]=(255&tint)/255*worldAlpha,uniforms.tint[3]=worldAlpha,renderer.shader.bind(shader),renderer.geometry.bind(geometry,shader),renderer.state.set(this.state);for(var i=0,l=drawCalls.length;i<l;i++)this._renderDrawCallDirect(renderer,geometry.drawCalls[i])},Graphics.prototype._renderDrawCallDirect=function(renderer,drawCall){for(var texArray=drawCall.texArray,type=drawCall.type,size=drawCall.size,start=drawCall.start,groupTextureCount=texArray.count,j=0;j<groupTextureCount;j++)renderer.texture.bind(texArray.elements[j],j);renderer.geometry.draw(type,size,start)},Graphics.prototype._resolveDirectShader=function(renderer){var shader=this.shader,pluginName=this.pluginName;if(!shader){if(!DEFAULT_SHADERS[pluginName]){for(var MAX_TEXTURES=renderer.plugins[pluginName].MAX_TEXTURES,sampleValues=new Int32Array(MAX_TEXTURES),i=0;i<MAX_TEXTURES;i++)sampleValues[i]=i;var uniforms={tint:new Float32Array([1,1,1,1]),translationMatrix:new Matrix,default:UniformGroup.from({uSamplers:sampleValues},!0)},program=renderer.plugins[pluginName]._shader.program;DEFAULT_SHADERS[pluginName]=new Shader(program,uniforms)}shader=DEFAULT_SHADERS[pluginName]}return shader},Graphics.prototype._calculateBounds=function(){this.finishPoly();var geometry=this._geometry;if(geometry.graphicsData.length){var _a=geometry.bounds,minX=_a.minX,minY=_a.minY,maxX=_a.maxX,maxY=_a.maxY;this._bounds.addFrame(this.transform,minX,minY,maxX,maxY)}},Graphics.prototype.containsPoint=function(point){return this.worldTransform.applyInverse(point,Graphics._TEMP_POINT),this._geometry.containsPoint(Graphics._TEMP_POINT)},Graphics.prototype.calculateTints=function(){if(this.batchTint!==this.tint){this.batchTint=this.tint;for(var tintRGB=hex2rgb(this.tint,temp),i=0;i<this.batches.length;i++){var batch=this.batches[i],batchTint=batch._batchRGB,color=(tintRGB[0]*batchTint[0]*255<<16)+(tintRGB[1]*batchTint[1]*255<<8)+(0|tintRGB[2]*batchTint[2]*255);batch._tintRGB=(color>>16)+(65280&color)+((255&color)<<16)}}},Graphics.prototype.calculateVertices=function(){var wtID=this.transform._worldID;if(this._transformID!==wtID){this._transformID=wtID;for(var wt=this.transform.worldTransform,a=wt.a,b=wt.b,c=wt.c,d=wt.d,tx=wt.tx,ty=wt.ty,data=this._geometry.points,vertexData=this.vertexData,count=0,i=0;i<data.length;i+=2){var x=data[i],y=data[i+1];vertexData[count++]=a*x+c*y+tx,vertexData[count++]=d*y+b*x+ty}}},Graphics.prototype.closePath=function(){var currentPath=this.currentPath;return currentPath&&(currentPath.closeStroke=!0,this.finishPoly()),this},Graphics.prototype.setMatrix=function(matrix){return this._matrix=matrix,this},Graphics.prototype.beginHole=function(){return this.finishPoly(),this._holeMode=!0,this},Graphics.prototype.endHole=function(){return this.finishPoly(),this._holeMode=!1,this},Graphics.prototype.destroy=function(options){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,_super.prototype.destroy.call(this,options)},Graphics.nextRoundedRectBehavior=!1,Graphics._TEMP_POINT=new Point,Graphics}(Container),extendStatics$8=function(d,b){return extendStatics$8=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$8(d,b)};var TEXT_GRADIENT,tempPoint=new Point,indices=new Uint16Array([0,1,2,0,2,3]),Sprite=function(_super){function Sprite(texture){var _this=_super.call(this)||this;return _this._anchor=new ObservablePoint(_this._onAnchorUpdate,_this,texture?texture.defaultAnchor.x:0,texture?texture.defaultAnchor.y:0),_this._texture=null,_this._width=0,_this._height=0,_this._tint=null,_this._tintRGB=null,_this.tint=16777215,_this.blendMode=BLEND_MODES$1.NORMAL,_this._cachedTint=16777215,_this.uvs=null,_this.texture=texture||Texture.EMPTY,_this.vertexData=new Float32Array(8),_this.vertexTrimmedData=null,_this._transformID=-1,_this._textureID=-1,_this._transformTrimmedID=-1,_this._textureTrimmedID=-1,_this.indices=indices,_this.pluginName="batch",_this.isSprite=!0,_this._roundPixels=settings.ROUND_PIXELS,_this}return function(d,b){function __(){this.constructor=d}extendStatics$8(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(Sprite,_super),Sprite.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=sign$2(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=sign$2(this.scale.y)*this._height/this._texture.orig.height)},Sprite.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},Sprite.prototype.calculateVertices=function(){var texture=this._texture;if(this._transformID!==this.transform._worldID||this._textureID!==texture._updateID){this._textureID!==texture._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=texture._updateID;var wt=this.transform.worldTransform,a=wt.a,b=wt.b,c=wt.c,d=wt.d,tx=wt.tx,ty=wt.ty,vertexData=this.vertexData,trim=texture.trim,orig=texture.orig,anchor=this._anchor,w0=0,w1=0,h0=0,h1=0;if(trim?(w0=(w1=trim.x-anchor._x*orig.width)+trim.width,h0=(h1=trim.y-anchor._y*orig.height)+trim.height):(w0=(w1=-anchor._x*orig.width)+orig.width,h0=(h1=-anchor._y*orig.height)+orig.height),vertexData[0]=a*w1+c*h1+tx,vertexData[1]=d*h1+b*w1+ty,vertexData[2]=a*w0+c*h1+tx,vertexData[3]=d*h1+b*w0+ty,vertexData[4]=a*w0+c*h0+tx,vertexData[5]=d*h0+b*w0+ty,vertexData[6]=a*w1+c*h0+tx,vertexData[7]=d*h0+b*w1+ty,this._roundPixels)for(var resolution=settings.RESOLUTION,i=0;i<vertexData.length;++i)vertexData[i]=Math.round((vertexData[i]*resolution|0)/resolution)}},Sprite.prototype.calculateTrimmedVertices=function(){if(this.vertexTrimmedData){if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;var texture=this._texture,vertexData=this.vertexTrimmedData,orig=texture.orig,anchor=this._anchor,wt=this.transform.worldTransform,a=wt.a,b=wt.b,c=wt.c,d=wt.d,tx=wt.tx,ty=wt.ty,w1=-anchor._x*orig.width,w0=w1+orig.width,h1=-anchor._y*orig.height,h0=h1+orig.height;vertexData[0]=a*w1+c*h1+tx,vertexData[1]=d*h1+b*w1+ty,vertexData[2]=a*w0+c*h1+tx,vertexData[3]=d*h1+b*w0+ty,vertexData[4]=a*w0+c*h0+tx,vertexData[5]=d*h0+b*w0+ty,vertexData[6]=a*w1+c*h0+tx,vertexData[7]=d*h0+b*w1+ty},Sprite.prototype._render=function(renderer){this.calculateVertices(),renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]),renderer.plugins[this.pluginName].render(this)},Sprite.prototype._calculateBounds=function(){var trim=this._texture.trim,orig=this._texture.orig;!trim||trim.width===orig.width&&trim.height===orig.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))},Sprite.prototype.getLocalBounds=function(rect){return 0===this.children.length?(this._localBounds||(this._localBounds=new Bounds),this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),rect||(this._localBoundsRect||(this._localBoundsRect=new Rectangle),rect=this._localBoundsRect),this._localBounds.getRectangle(rect)):_super.prototype.getLocalBounds.call(this,rect)},Sprite.prototype.containsPoint=function(point){this.worldTransform.applyInverse(point,tempPoint);var width=this._texture.orig.width,height=this._texture.orig.height,x1=-width*this.anchor.x,y1=0;return tempPoint.x>=x1&&tempPoint.x<x1+width&&(y1=-height*this.anchor.y,tempPoint.y>=y1&&tempPoint.y<y1+height)},Sprite.prototype.destroy=function(options){if(_super.prototype.destroy.call(this,options),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,"boolean"==typeof options?options:options&&options.texture){var destroyBaseTexture="boolean"==typeof options?options:options&&options.baseTexture;this._texture.destroy(!!destroyBaseTexture)}this._texture=null},Sprite.from=function(source,options){return new Sprite(source instanceof Texture?source:Texture.from(source,options))},Object.defineProperty(Sprite.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(value){this._roundPixels!==value&&(this._transformID=-1),this._roundPixels=value},enumerable:!1,configurable:!0}),Object.defineProperty(Sprite.prototype,"width",{get:function(){return Math.abs(this.scale.x)*this._texture.orig.width},set:function(value){var s=sign$2(this.scale.x)||1;this.scale.x=s*value/this._texture.orig.width,this._width=value},enumerable:!1,configurable:!0}),Object.defineProperty(Sprite.prototype,"height",{get:function(){return Math.abs(this.scale.y)*this._texture.orig.height},set:function(value){var s=sign$2(this.scale.y)||1;this.scale.y=s*value/this._texture.orig.height,this._height=value},enumerable:!1,configurable:!0}),Object.defineProperty(Sprite.prototype,"anchor",{get:function(){return this._anchor},set:function(value){this._anchor.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(Sprite.prototype,"tint",{get:function(){return this._tint},set:function(value){this._tint=value,this._tintRGB=(value>>16)+(65280&value)+((255&value)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(Sprite.prototype,"texture",{get:function(){return this._texture},set:function(value){this._texture!==value&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=value||Texture.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,value&&(value.baseTexture.valid?this._onTextureUpdate():value.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),Sprite}(Container),extendStatics$9=function(d,b){return extendStatics$9=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$9(d,b)};!function(TEXT_GRADIENT){TEXT_GRADIENT[TEXT_GRADIENT.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",TEXT_GRADIENT[TEXT_GRADIENT.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"}(TEXT_GRADIENT||(TEXT_GRADIENT={}));var defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:TEXT_GRADIENT.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},genericFontFamilies=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],TextStyle=function(){function TextStyle(style){this.styleID=0,this.reset(),deepCopyProperties(this,style,style)}return TextStyle.prototype.clone=function(){var clonedProperties={};return deepCopyProperties(clonedProperties,this,defaultStyle),new TextStyle(clonedProperties)},TextStyle.prototype.reset=function(){deepCopyProperties(this,defaultStyle,defaultStyle)},Object.defineProperty(TextStyle.prototype,"align",{get:function(){return this._align},set:function(align){this._align!==align&&(this._align=align,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"breakWords",{get:function(){return this._breakWords},set:function(breakWords){this._breakWords!==breakWords&&(this._breakWords=breakWords,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(dropShadow){this._dropShadow!==dropShadow&&(this._dropShadow=dropShadow,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(dropShadowAlpha){this._dropShadowAlpha!==dropShadowAlpha&&(this._dropShadowAlpha=dropShadowAlpha,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(dropShadowAngle){this._dropShadowAngle!==dropShadowAngle&&(this._dropShadowAngle=dropShadowAngle,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(dropShadowBlur){this._dropShadowBlur!==dropShadowBlur&&(this._dropShadowBlur=dropShadowBlur,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(dropShadowColor){var outputColor=getColor(dropShadowColor);this._dropShadowColor!==outputColor&&(this._dropShadowColor=outputColor,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(dropShadowDistance){this._dropShadowDistance!==dropShadowDistance&&(this._dropShadowDistance=dropShadowDistance,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fill",{get:function(){return this._fill},set:function(fill){var outputColor=getColor(fill);this._fill!==outputColor&&(this._fill=outputColor,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(fillGradientType){this._fillGradientType!==fillGradientType&&(this._fillGradientType=fillGradientType,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(fillGradientStops){(function(array1,array2){if(!Array.isArray(array1)||!Array.isArray(array2))return!1;if(array1.length!==array2.length)return!1;for(var i=0;i<array1.length;++i)if(array1[i]!==array2[i])return!1;return!0})(this._fillGradientStops,fillGradientStops)||(this._fillGradientStops=fillGradientStops,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(fontFamily){this.fontFamily!==fontFamily&&(this._fontFamily=fontFamily,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fontSize",{get:function(){return this._fontSize},set:function(fontSize){this._fontSize!==fontSize&&(this._fontSize=fontSize,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(fontStyle){this._fontStyle!==fontStyle&&(this._fontStyle=fontStyle,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(fontVariant){this._fontVariant!==fontVariant&&(this._fontVariant=fontVariant,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(fontWeight){this._fontWeight!==fontWeight&&(this._fontWeight=fontWeight,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(letterSpacing){this._letterSpacing!==letterSpacing&&(this._letterSpacing=letterSpacing,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(lineHeight){this._lineHeight!==lineHeight&&(this._lineHeight=lineHeight,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"leading",{get:function(){return this._leading},set:function(leading){this._leading!==leading&&(this._leading=leading,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(lineJoin){this._lineJoin!==lineJoin&&(this._lineJoin=lineJoin,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(miterLimit){this._miterLimit!==miterLimit&&(this._miterLimit=miterLimit,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"padding",{get:function(){return this._padding},set:function(padding){this._padding!==padding&&(this._padding=padding,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"stroke",{get:function(){return this._stroke},set:function(stroke){var outputColor=getColor(stroke);this._stroke!==outputColor&&(this._stroke=outputColor,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(strokeThickness){this._strokeThickness!==strokeThickness&&(this._strokeThickness=strokeThickness,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(textBaseline){this._textBaseline!==textBaseline&&(this._textBaseline=textBaseline,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"trim",{get:function(){return this._trim},set:function(trim){this._trim!==trim&&(this._trim=trim,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(whiteSpace){this._whiteSpace!==whiteSpace&&(this._whiteSpace=whiteSpace,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(wordWrap){this._wordWrap!==wordWrap&&(this._wordWrap=wordWrap,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(TextStyle.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(wordWrapWidth){this._wordWrapWidth!==wordWrapWidth&&(this._wordWrapWidth=wordWrapWidth,this.styleID++)},enumerable:!1,configurable:!0}),TextStyle.prototype.toFontString=function(){var fontSizeString="number"==typeof this.fontSize?this.fontSize+"px":this.fontSize,fontFamilies=this.fontFamily;Array.isArray(this.fontFamily)||(fontFamilies=this.fontFamily.split(","));for(var i=fontFamilies.length-1;i>=0;i--){var fontFamily=fontFamilies[i].trim();!/([\"\'])[^\'\"]+\1/.test(fontFamily)&&genericFontFamilies.indexOf(fontFamily)<0&&(fontFamily='"'+fontFamily+'"'),fontFamilies[i]=fontFamily}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+fontSizeString+" "+fontFamilies.join(",")},TextStyle}();function getSingleColor(color){return"number"==typeof color?hex2string(color):("string"==typeof color&&0===color.indexOf("0x")&&(color=color.replace("0x","#")),color)}function getColor(color){if(Array.isArray(color)){for(var i=0;i<color.length;++i)color[i]=getSingleColor(color[i]);return color}return getSingleColor(color)}function deepCopyProperties(target,source,propertyObj){for(var prop in propertyObj)Array.isArray(source[prop])?target[prop]=source[prop].slice():target[prop]=source[prop]}var TextMetrics=function(){function TextMetrics(text,style,width,height,lines,lineWidths,lineHeight,maxLineWidth,fontProperties){this.text=text,this.style=style,this.width=width,this.height=height,this.lines=lines,this.lineWidths=lineWidths,this.lineHeight=lineHeight,this.maxLineWidth=maxLineWidth,this.fontProperties=fontProperties}return TextMetrics.measureText=function(text,style,wordWrap,canvas){void 0===canvas&&(canvas=TextMetrics._canvas),wordWrap=null==wordWrap?style.wordWrap:wordWrap;var font=style.toFontString(),fontProperties=TextMetrics.measureFont(font);0===fontProperties.fontSize&&(fontProperties.fontSize=style.fontSize,fontProperties.ascent=style.fontSize);var context=canvas.getContext("2d");context.font=font;for(var lines=(wordWrap?TextMetrics.wordWrap(text,style,canvas):text).split(/(?:\r\n|\r|\n)/),lineWidths=new Array(lines.length),maxLineWidth=0,i=0;i<lines.length;i++){var lineWidth=context.measureText(lines[i]).width+(lines[i].length-1)*style.letterSpacing;lineWidths[i]=lineWidth,maxLineWidth=Math.max(maxLineWidth,lineWidth)}var width=maxLineWidth+style.strokeThickness;style.dropShadow&&(width+=style.dropShadowDistance);var lineHeight=style.lineHeight||fontProperties.fontSize+style.strokeThickness,height=Math.max(lineHeight,fontProperties.fontSize+style.strokeThickness)+(lines.length-1)*(lineHeight+style.leading);return style.dropShadow&&(height+=style.dropShadowDistance),new TextMetrics(text,style,width,height,lines,lineWidths,lineHeight+style.leading,maxLineWidth,fontProperties)},TextMetrics.wordWrap=function(text,style,canvas){void 0===canvas&&(canvas=TextMetrics._canvas);for(var context=canvas.getContext("2d"),width=0,line="",lines="",cache=Object.create(null),letterSpacing=style.letterSpacing,whiteSpace=style.whiteSpace,collapseSpaces=TextMetrics.collapseSpaces(whiteSpace),collapseNewlines=TextMetrics.collapseNewlines(whiteSpace),canPrependSpaces=!collapseSpaces,wordWrapWidth=style.wordWrapWidth+letterSpacing,tokens=TextMetrics.tokenize(text),i=0;i<tokens.length;i++){var token=tokens[i];if(TextMetrics.isNewline(token)){if(!collapseNewlines){lines+=TextMetrics.addLine(line),canPrependSpaces=!collapseSpaces,line="",width=0;continue}token=" "}if(collapseSpaces){var currIsBreakingSpace=TextMetrics.isBreakingSpace(token),lastIsBreakingSpace=TextMetrics.isBreakingSpace(line[line.length-1]);if(currIsBreakingSpace&&lastIsBreakingSpace)continue}var tokenWidth=TextMetrics.getFromCache(token,letterSpacing,cache,context);if(tokenWidth>wordWrapWidth)if(""!==line&&(lines+=TextMetrics.addLine(line),line="",width=0),TextMetrics.canBreakWords(token,style.breakWords))for(var characters=TextMetrics.wordWrapSplit(token),j=0;j<characters.length;j++){for(var char=characters[j],k=1;characters[j+k];){var nextChar=characters[j+k],lastChar=char[char.length-1];if(TextMetrics.canBreakChars(lastChar,nextChar,token,j,style.breakWords))break;char+=nextChar,k++}j+=char.length-1;var characterWidth=TextMetrics.getFromCache(char,letterSpacing,cache,context);characterWidth+width>wordWrapWidth&&(lines+=TextMetrics.addLine(line),canPrependSpaces=!1,line="",width=0),line+=char,width+=characterWidth}else{line.length>0&&(lines+=TextMetrics.addLine(line),line="",width=0);var isLastToken=i===tokens.length-1;lines+=TextMetrics.addLine(token,!isLastToken),canPrependSpaces=!1,line="",width=0}else tokenWidth+width>wordWrapWidth&&(canPrependSpaces=!1,lines+=TextMetrics.addLine(line),line="",width=0),(line.length>0||!TextMetrics.isBreakingSpace(token)||canPrependSpaces)&&(line+=token,width+=tokenWidth)}return lines+=TextMetrics.addLine(line,!1)},TextMetrics.addLine=function(line,newLine){return void 0===newLine&&(newLine=!0),line=TextMetrics.trimRight(line),line=newLine?line+"\n":line},TextMetrics.getFromCache=function(key,letterSpacing,cache,context){var width=cache[key];if("number"!=typeof width){var spacing=key.length*letterSpacing;width=context.measureText(key).width+spacing,cache[key]=width}return width},TextMetrics.collapseSpaces=function(whiteSpace){return"normal"===whiteSpace||"pre-line"===whiteSpace},TextMetrics.collapseNewlines=function(whiteSpace){return"normal"===whiteSpace},TextMetrics.trimRight=function(text){if("string"!=typeof text)return"";for(var i=text.length-1;i>=0;i--){var char=text[i];if(!TextMetrics.isBreakingSpace(char))break;text=text.slice(0,-1)}return text},TextMetrics.isNewline=function(char){return"string"==typeof char&&TextMetrics._newlines.indexOf(char.charCodeAt(0))>=0},TextMetrics.isBreakingSpace=function(char,_nextChar){return"string"==typeof char&&TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0))>=0},TextMetrics.tokenize=function(text){var tokens=[],token="";if("string"!=typeof text)return tokens;for(var i=0;i<text.length;i++){var char=text[i],nextChar=text[i+1];TextMetrics.isBreakingSpace(char,nextChar)||TextMetrics.isNewline(char)?(""!==token&&(tokens.push(token),token=""),tokens.push(char)):token+=char}return""!==token&&tokens.push(token),tokens},TextMetrics.canBreakWords=function(_token,breakWords){return breakWords},TextMetrics.canBreakChars=function(_char,_nextChar,_token,_index,_breakWords){return!0},TextMetrics.wordWrapSplit=function(token){return token.split("")},TextMetrics.measureFont=function(font){if(TextMetrics._fonts[font])return TextMetrics._fonts[font];var properties={ascent:0,descent:0,fontSize:0},canvas=TextMetrics._canvas,context=TextMetrics._context;context.font=font;var metricsString=TextMetrics.METRICS_STRING+TextMetrics.BASELINE_SYMBOL,width=Math.ceil(context.measureText(metricsString).width),baseline=Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width),height=Math.ceil(TextMetrics.HEIGHT_MULTIPLIER*baseline);baseline=baseline*TextMetrics.BASELINE_MULTIPLIER|0,canvas.width=width,canvas.height=height,context.fillStyle="#f00",context.fillRect(0,0,width,height),context.font=font,context.textBaseline="alphabetic",context.fillStyle="#000",context.fillText(metricsString,0,baseline);var imagedata=context.getImageData(0,0,width,height).data,pixels=imagedata.length,line=4*width,i=0,idx=0,stop=!1;for(i=0;i<baseline;++i){for(var j=0;j<line;j+=4)if(255!==imagedata[idx+j]){stop=!0;break}if(stop)break;idx+=line}for(properties.ascent=baseline-i,idx=pixels-line,stop=!1,i=height;i>baseline;--i){for(j=0;j<line;j+=4)if(255!==imagedata[idx+j]){stop=!0;break}if(stop)break;idx-=line}return properties.descent=i-baseline,properties.fontSize=properties.ascent+properties.descent,TextMetrics._fonts[font]=properties,properties},TextMetrics.clearMetrics=function(font){void 0===font&&(font=""),font?delete TextMetrics._fonts[font]:TextMetrics._fonts={}},Object.defineProperty(TextMetrics,"_canvas",{get:function(){if(!TextMetrics.__canvas){var canvas=void 0;try{var c=new OffscreenCanvas(0,0),context=c.getContext("2d");if(context&&context.measureText)return TextMetrics.__canvas=c,c;canvas=document.createElement("canvas")}catch(ex){canvas=document.createElement("canvas")}canvas.width=canvas.height=10,TextMetrics.__canvas=canvas}return TextMetrics.__canvas},enumerable:!1,configurable:!0}),Object.defineProperty(TextMetrics,"_context",{get:function(){return TextMetrics.__context||(TextMetrics.__context=TextMetrics._canvas.getContext("2d")),TextMetrics.__context},enumerable:!1,configurable:!0}),TextMetrics}();TextMetrics._fonts={},TextMetrics.METRICS_STRING="|ÉqÅ",TextMetrics.BASELINE_SYMBOL="M",TextMetrics.BASELINE_MULTIPLIER=1.4,TextMetrics.HEIGHT_MULTIPLIER=2,TextMetrics._newlines=[10,13],TextMetrics._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Text=function(_super){function Text(text,style,canvas){var _this=this,ownCanvas=!1;canvas||(canvas=document.createElement("canvas"),ownCanvas=!0),canvas.width=3,canvas.height=3;var texture=Texture.from(canvas);return texture.orig=new Rectangle,texture.trim=new Rectangle,(_this=_super.call(this,texture)||this)._ownCanvas=ownCanvas,_this.canvas=canvas,_this.context=_this.canvas.getContext("2d"),_this._resolution=settings.RESOLUTION,_this._autoResolution=!0,_this._text=null,_this._style=null,_this._styleListener=null,_this._font="",_this.text=text,_this.style=style,_this.localStyleID=-1,_this}return function(d,b){function __(){this.constructor=d}extendStatics$9(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(Text,_super),Text.prototype.updateText=function(respectDirty){var style=this._style;if(this.localStyleID!==style.styleID&&(this.dirty=!0,this.localStyleID=style.styleID),this.dirty||!respectDirty){this._font=this._style.toFontString();var linePositionX,linePositionY,context=this.context,measured=TextMetrics.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),width=measured.width,height=measured.height,lines=measured.lines,lineHeight=measured.lineHeight,lineWidths=measured.lineWidths,maxLineWidth=measured.maxLineWidth,fontProperties=measured.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,width)+2*style.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,height)+2*style.padding)*this._resolution),context.scale(this._resolution,this._resolution),context.clearRect(0,0,this.canvas.width,this.canvas.height),context.font=this._font,context.lineWidth=style.strokeThickness,context.textBaseline=style.textBaseline,context.lineJoin=style.lineJoin,context.miterLimit=style.miterLimit;for(var passesCount=style.dropShadow?2:1,i=0;i<passesCount;++i){var isShadowPass=style.dropShadow&&0===i,dsOffsetText=isShadowPass?Math.ceil(Math.max(1,height)+2*style.padding):0,dsOffsetShadow=dsOffsetText*this._resolution;if(isShadowPass){context.fillStyle="black",context.strokeStyle="black";var dropShadowColor=style.dropShadowColor,rgb=hex2rgb("number"==typeof dropShadowColor?dropShadowColor:string2hex(dropShadowColor)),dropShadowBlur=style.dropShadowBlur*this._resolution,dropShadowDistance=style.dropShadowDistance*this._resolution;context.shadowColor="rgba("+255*rgb[0]+","+255*rgb[1]+","+255*rgb[2]+","+style.dropShadowAlpha+")",context.shadowBlur=dropShadowBlur,context.shadowOffsetX=Math.cos(style.dropShadowAngle)*dropShadowDistance,context.shadowOffsetY=Math.sin(style.dropShadowAngle)*dropShadowDistance+dsOffsetShadow}else context.fillStyle=this._generateFillStyle(style,lines,measured),context.strokeStyle=style.stroke,context.shadowColor="black",context.shadowBlur=0,context.shadowOffsetX=0,context.shadowOffsetY=0;var linePositionYShift=(lineHeight-fontProperties.fontSize)/2;(!Text.nextLineHeightBehavior||lineHeight-fontProperties.fontSize<0)&&(linePositionYShift=0);for(var i_1=0;i_1<lines.length;i_1++)linePositionX=style.strokeThickness/2,linePositionY=style.strokeThickness/2+i_1*lineHeight+fontProperties.ascent+linePositionYShift,"right"===style.align?linePositionX+=maxLineWidth-lineWidths[i_1]:"center"===style.align&&(linePositionX+=(maxLineWidth-lineWidths[i_1])/2),style.stroke&&style.strokeThickness&&this.drawLetterSpacing(lines[i_1],linePositionX+style.padding,linePositionY+style.padding-dsOffsetText,!0),style.fill&&this.drawLetterSpacing(lines[i_1],linePositionX+style.padding,linePositionY+style.padding-dsOffsetText)}this.updateTexture()}},Text.prototype.drawLetterSpacing=function(text,x,y,isStroke){void 0===isStroke&&(isStroke=!1);var letterSpacing=this._style.letterSpacing,supportLetterSpacing=Text.experimentalLetterSpacing&&("letterSpacing"in CanvasRenderingContext2D.prototype||"textLetterSpacing"in CanvasRenderingContext2D.prototype);if(0===letterSpacing||supportLetterSpacing)return supportLetterSpacing&&(this.context.letterSpacing=letterSpacing,this.context.textLetterSpacing=letterSpacing),void(isStroke?this.context.strokeText(text,x,y):this.context.fillText(text,x,y));for(var currentPosition=x,stringArray=Array.from?Array.from(text):text.split(""),previousWidth=this.context.measureText(text).width,currentWidth=0,i=0;i<stringArray.length;++i){var currentChar=stringArray[i];isStroke?this.context.strokeText(currentChar,currentPosition,y):this.context.fillText(currentChar,currentPosition,y);for(var textStr="",j=i+1;j<stringArray.length;++j)textStr+=stringArray[j];currentPosition+=previousWidth-(currentWidth=this.context.measureText(textStr).width)+letterSpacing,previousWidth=currentWidth}},Text.prototype.updateTexture=function(){var canvas=this.canvas;if(this._style.trim){var trimmed=function(canvas){var i,x,y,width=canvas.width,height=canvas.height,context=canvas.getContext("2d"),pixels=context.getImageData(0,0,width,height).data,len=pixels.length,bound={top:null,left:null,right:null,bottom:null},data=null;for(i=0;i<len;i+=4)0!==pixels[i+3]&&(x=i/4%width,y=~~(i/4/width),null===bound.top&&(bound.top=y),(null===bound.left||x<bound.left)&&(bound.left=x),(null===bound.right||bound.right<x)&&(bound.right=x+1),(null===bound.bottom||bound.bottom<y)&&(bound.bottom=y));return null!==bound.top&&(width=bound.right-bound.left,height=bound.bottom-bound.top+1,data=context.getImageData(bound.left,bound.top,width,height)),{height:height,width:width,data:data}}(canvas);trimmed.data&&(canvas.width=trimmed.width,canvas.height=trimmed.height,this.context.putImageData(trimmed.data,0,0))}var texture=this._texture,style=this._style,padding=style.trim?0:style.padding,baseTexture=texture.baseTexture;texture.trim.width=texture._frame.width=canvas.width/this._resolution,texture.trim.height=texture._frame.height=canvas.height/this._resolution,texture.trim.x=-padding,texture.trim.y=-padding,texture.orig.width=texture._frame.width-2*padding,texture.orig.height=texture._frame.height-2*padding,this._onTextureUpdate(),baseTexture.setRealSize(canvas.width,canvas.height,this._resolution),texture.updateUvs(),this.dirty=!1},Text.prototype._render=function(renderer){this._autoResolution&&this._resolution!==renderer.resolution&&(this._resolution=renderer.resolution,this.dirty=!0),this.updateText(!0),_super.prototype._render.call(this,renderer)},Text.prototype.updateTransform=function(){this.updateText(!0),_super.prototype.updateTransform.call(this)},Text.prototype.getBounds=function(skipUpdate,rect){return this.updateText(!0),-1===this._textureID&&(skipUpdate=!1),_super.prototype.getBounds.call(this,skipUpdate,rect)},Text.prototype.getLocalBounds=function(rect){return this.updateText(!0),_super.prototype.getLocalBounds.call(this,rect)},Text.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)},Text.prototype._generateFillStyle=function(style,lines,metrics){var gradient,fillStyle=style.fill;if(!Array.isArray(fillStyle))return fillStyle;if(1===fillStyle.length)return fillStyle[0];var dropShadowCorrection=style.dropShadow?style.dropShadowDistance:0,padding=style.padding||0,width=this.canvas.width/this._resolution-dropShadowCorrection-2*padding,height=this.canvas.height/this._resolution-dropShadowCorrection-2*padding,fill=fillStyle.slice(),fillGradientStops=style.fillGradientStops.slice();if(!fillGradientStops.length)for(var lengthPlus1=fill.length+1,i=1;i<lengthPlus1;++i)fillGradientStops.push(i/lengthPlus1);if(fill.unshift(fillStyle[0]),fillGradientStops.unshift(0),fill.push(fillStyle[fillStyle.length-1]),fillGradientStops.push(1),style.fillGradientType===TEXT_GRADIENT.LINEAR_VERTICAL){gradient=this.context.createLinearGradient(width/2,padding,width/2,height+padding);var textHeight=metrics.fontProperties.fontSize+style.strokeThickness;for(i=0;i<lines.length;i++){var lastLineBottom=metrics.lineHeight*(i-1)+textHeight,thisLineTop=metrics.lineHeight*i,thisLineGradientStart=thisLineTop;i>0&&lastLineBottom>thisLineTop&&(thisLineGradientStart=(thisLineTop+lastLineBottom)/2);var thisLineBottom=thisLineTop+textHeight,nextLineTop=metrics.lineHeight*(i+1),thisLineGradientEnd=thisLineBottom;i+1<lines.length&&nextLineTop<thisLineBottom&&(thisLineGradientEnd=(thisLineBottom+nextLineTop)/2);for(var gradStopLineHeight=(thisLineGradientEnd-thisLineGradientStart)/height,j=0;j<fill.length;j++){var lineStop=0;lineStop="number"==typeof fillGradientStops[j]?fillGradientStops[j]:j/fill.length;var globalStop=Math.min(1,Math.max(0,thisLineGradientStart/height+lineStop*gradStopLineHeight));globalStop=Number(globalStop.toFixed(5)),gradient.addColorStop(globalStop,fill[j])}}}else{gradient=this.context.createLinearGradient(padding,height/2,width+padding,height/2);var totalIterations=fill.length+1,currentIteration=1;for(i=0;i<fill.length;i++){var stop=void 0;stop="number"==typeof fillGradientStops[i]?fillGradientStops[i]:currentIteration/totalIterations,gradient.addColorStop(stop,fill[i]),currentIteration++}}return gradient},Text.prototype.destroy=function(options){"boolean"==typeof options&&(options={children:options}),options=Object.assign({},defaultDestroyOptions,options),_super.prototype.destroy.call(this,options),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(Text.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(value){this.updateText(!0);var s=sign$2(this.scale.x)||1;this.scale.x=s*value/this._texture.orig.width,this._width=value},enumerable:!1,configurable:!0}),Object.defineProperty(Text.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(value){this.updateText(!0);var s=sign$2(this.scale.y)||1;this.scale.y=s*value/this._texture.orig.height,this._height=value},enumerable:!1,configurable:!0}),Object.defineProperty(Text.prototype,"style",{get:function(){return this._style},set:function(style){style=style||{},this._style=style instanceof TextStyle?style:new TextStyle(style),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(Text.prototype,"text",{get:function(){return this._text},set:function(text){text=String(null==text?"":text),this._text!==text&&(this._text=text,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(Text.prototype,"resolution",{get:function(){return this._resolution},set:function(value){this._autoResolution=!1,this._resolution!==value&&(this._resolution=value,this.dirty=!0)},enumerable:!1,configurable:!0}),Text.nextLineHeightBehavior=!1,Text.experimentalLetterSpacing=!1,Text}(Sprite);
|
|
163
149
|
/*!
|
|
164
|
-
* @pixi/prepare -
|
|
165
|
-
* Compiled
|
|
150
|
+
* @pixi/prepare - v6.4.2
|
|
151
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
166
152
|
*
|
|
167
153
|
* @pixi/prepare is licensed under the MIT License.
|
|
168
154
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -182,17 +168,17 @@ settings.UPLOADS_PER_FRAME=4;
|
|
|
182
168
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
183
169
|
and limitations under the License.
|
|
184
170
|
***************************************************************************** */
|
|
185
|
-
var extendStatics$9=function(d,b){return(extendStatics$9=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};var CountLimiter=function(){function CountLimiter(maxItemsPerFrame){this.maxItemsPerFrame=maxItemsPerFrame,this.itemsLeft=0}return CountLimiter.prototype.beginFrame=function(){this.itemsLeft=this.maxItemsPerFrame},CountLimiter.prototype.allowedToUpload=function(){return this.itemsLeft-- >0},CountLimiter}();function findMultipleBaseTextures(item,queue){var result=!1;if(item&&item._textures&&item._textures.length)for(var i=0;i<item._textures.length;i++)if(item._textures[i]instanceof Texture){var baseTexture=item._textures[i].baseTexture;-1===queue.indexOf(baseTexture)&&(queue.push(baseTexture),result=!0)}return result}function findBaseTexture(item,queue){if(item.baseTexture instanceof BaseTexture){var texture=item.baseTexture;return-1===queue.indexOf(texture)&&queue.push(texture),!0}return!1}function findTexture(item,queue){if(item._texture&&item._texture instanceof Texture){var texture=item._texture.baseTexture;return-1===queue.indexOf(texture)&&queue.push(texture),!0}return!1}function drawText(_helper,item){return item instanceof Text&&(item.updateText(!0),!0)}function calculateTextStyle(_helper,item){if(item instanceof TextStyle){var font=item.toFontString();return TextMetrics.measureFont(font),!0}return!1}function findText(item,queue){if(item instanceof Text){-1===queue.indexOf(item.style)&&queue.push(item.style),-1===queue.indexOf(item)&&queue.push(item);var texture=item._texture.baseTexture;return-1===queue.indexOf(texture)&&queue.push(texture),!0}return!1}function findTextStyle(item,queue){return item instanceof TextStyle&&(-1===queue.indexOf(item)&&queue.push(item),!0)}function uploadBaseTextures(renderer,item){return item instanceof BaseTexture&&(item._glTextures[renderer.CONTEXT_UID]||renderer.texture.bind(item),!0)}function uploadGraphics(renderer,item){if(!(item instanceof Graphics))return!1;var geometry=item.geometry;item.finishPoly(),geometry.updateBatches();for(var batches=geometry.batches,i=0;i<batches.length;i++){var texture=batches[i].style.texture;texture&&uploadBaseTextures(renderer,texture.baseTexture)}return geometry.batchable||renderer.geometry.bind(geometry,item._resolveDirectShader(renderer)),!0}function findGraphics(item,queue){return item instanceof Graphics&&(queue.push(item),!0)}var Prepare=function(_super){function Prepare(renderer){var _this=_super.call(this,renderer)||this;return _this.uploadHookHelper=_this.renderer,_this.registerFindHook(findGraphics),_this.registerUploadHook(uploadBaseTextures),_this.registerUploadHook(uploadGraphics),_this}return function(d,b){function __(){this.constructor=d}extendStatics$9(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(Prepare,_super),Prepare}(function(){function BasePrepare(renderer){var _this=this;this.limiter=new CountLimiter(settings.UPLOADS_PER_FRAME),this.renderer=renderer,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=function(){_this.queue&&_this.prepareItems()},this.registerFindHook(findText),this.registerFindHook(findTextStyle),this.registerFindHook(findMultipleBaseTextures),this.registerFindHook(findBaseTexture),this.registerFindHook(findTexture),this.registerUploadHook(drawText),this.registerUploadHook(calculateTextStyle)}return BasePrepare.prototype.upload=function(item,done){"function"==typeof item&&(done=item,item=null),item&&this.add(item),this.queue.length?(done&&this.completes.push(done),this.ticking||(this.ticking=!0,Ticker.system.addOnce(this.tick,this,UPDATE_PRIORITY.UTILITY))):done&&done()},BasePrepare.prototype.tick=function(){setTimeout(this.delayedTick,0)},BasePrepare.prototype.prepareItems=function(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){var item=this.queue[0],uploaded=!1;if(item&&!item._destroyed)for(var i=0,len=this.uploadHooks.length;i<len;i++)if(this.uploadHooks[i](this.uploadHookHelper,item)){this.queue.shift(),uploaded=!0;break}uploaded||this.queue.shift()}if(this.queue.length)Ticker.system.addOnce(this.tick,this,UPDATE_PRIORITY.UTILITY);else{this.ticking=!1;var completes=this.completes.slice(0);this.completes.length=0;for(i=0,len=completes.length;i<len;i++)completes[i]()}},BasePrepare.prototype.registerFindHook=function(addHook){return addHook&&this.addHooks.push(addHook),this},BasePrepare.prototype.registerUploadHook=function(uploadHook){return uploadHook&&this.uploadHooks.push(uploadHook),this},BasePrepare.prototype.add=function(item){for(var i=0,len=this.addHooks.length;i<len&&!this.addHooks[i](item,this.queue);i++);if(item instanceof Container)for(i=item.children.length-1;i>=0;i--)this.add(item.children[i]);return this},BasePrepare.prototype.destroy=function(){this.ticking&&Ticker.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null},BasePrepare}()),Spritesheet=function(){function Spritesheet(texture,data,resolutionFilename){void 0===resolutionFilename&&(resolutionFilename=null),this._texture=texture instanceof Texture?texture:null,this.baseTexture=texture instanceof BaseTexture?texture:this._texture.baseTexture,this.textures={},this.animations={},this.data=data;var resource=this.baseTexture.resource;this.resolution=this._updateResolution(resolutionFilename||(resource?resource.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}return Spritesheet.prototype._updateResolution=function(resolutionFilename){void 0===resolutionFilename&&(resolutionFilename=null);var scale=this.data.meta.scale,resolution=getResolutionOfUrl(resolutionFilename,null);return null===resolution&&(resolution=void 0!==scale?parseFloat(scale):1),1!==resolution&&this.baseTexture.setResolution(resolution),resolution},Spritesheet.prototype.parse=function(callback){this._batchIndex=0,this._callback=callback,this._frameKeys.length<=Spritesheet.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()},Spritesheet.prototype._processFrames=function(initialFrameIndex){for(var frameIndex=initialFrameIndex,maxFrames=Spritesheet.BATCH_SIZE;frameIndex-initialFrameIndex<maxFrames&&frameIndex<this._frameKeys.length;){var i=this._frameKeys[frameIndex],data=this._frames[i],rect=data.frame;if(rect){var frame=null,trim=null,sourceSize=!1!==data.trimmed&&data.sourceSize?data.sourceSize:data.frame,orig=new Rectangle(0,0,Math.floor(sourceSize.w)/this.resolution,Math.floor(sourceSize.h)/this.resolution);frame=data.rotated?new Rectangle(Math.floor(rect.x)/this.resolution,Math.floor(rect.y)/this.resolution,Math.floor(rect.h)/this.resolution,Math.floor(rect.w)/this.resolution):new Rectangle(Math.floor(rect.x)/this.resolution,Math.floor(rect.y)/this.resolution,Math.floor(rect.w)/this.resolution,Math.floor(rect.h)/this.resolution),!1!==data.trimmed&&data.spriteSourceSize&&(trim=new Rectangle(Math.floor(data.spriteSourceSize.x)/this.resolution,Math.floor(data.spriteSourceSize.y)/this.resolution,Math.floor(rect.w)/this.resolution,Math.floor(rect.h)/this.resolution)),this.textures[i]=new Texture(this.baseTexture,frame,orig,trim,data.rotated?2:0,data.anchor),Texture.addToCache(this.textures[i],i)}frameIndex++}},Spritesheet.prototype._processAnimations=function(){var animations=this.data.animations||{};for(var animName in animations){this.animations[animName]=[];for(var i=0;i<animations[animName].length;i++){var frameName=animations[animName][i];this.animations[animName].push(this.textures[frameName])}}},Spritesheet.prototype._parseComplete=function(){var callback=this._callback;this._callback=null,this._batchIndex=0,callback.call(this,this.textures)},Spritesheet.prototype._nextBatch=function(){var _this=this;this._processFrames(this._batchIndex*Spritesheet.BATCH_SIZE),this._batchIndex++,setTimeout((function(){_this._batchIndex*Spritesheet.BATCH_SIZE<_this._frameKeys.length?_this._nextBatch():(_this._processAnimations(),_this._parseComplete())}),0)},Spritesheet.prototype.destroy=function(destroyBase){var _a;for(var i in void 0===destroyBase&&(destroyBase=!1),this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,destroyBase&&(null===(_a=this._texture)||void 0===_a||_a.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null},Spritesheet.BATCH_SIZE=1e3,Spritesheet}(),SpritesheetLoader=function(){function SpritesheetLoader(){}return SpritesheetLoader.use=function(resource,next){var imageResourceName=resource.name+"_image";if(resource.data&&resource.type===LoaderResource.TYPE.JSON&&resource.data.frames&&!this.resources[imageResourceName]){var loadOptions={crossOrigin:resource.crossOrigin,metadata:resource.metadata.imageMetadata,parentResource:resource},resourcePath=SpritesheetLoader.getResourcePath(resource,this.baseUrl);this.add(imageResourceName,resourcePath,loadOptions,(function(res){if(res.error)next(res.error);else{var spritesheet=new Spritesheet(res.texture,resource.data,resource.url);spritesheet.parse((function(){resource.spritesheet=spritesheet,resource.textures=spritesheet.textures,next()}))}}))}else next()},SpritesheetLoader.getResourcePath=function(resource,baseUrl){return resource.isDataUrl?resource.data.meta.image:url__default.default.resolve(resource.url.replace(baseUrl,""),resource.data.meta.image)},SpritesheetLoader}(),extendStatics$a=function(d,b){return(extendStatics$a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};
|
|
171
|
+
var extendStatics$a=function(d,b){return extendStatics$a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$a(d,b)};var CountLimiter=function(){function CountLimiter(maxItemsPerFrame){this.maxItemsPerFrame=maxItemsPerFrame,this.itemsLeft=0}return CountLimiter.prototype.beginFrame=function(){this.itemsLeft=this.maxItemsPerFrame},CountLimiter.prototype.allowedToUpload=function(){return this.itemsLeft-- >0},CountLimiter}();function findMultipleBaseTextures(item,queue){var result=!1;if(item&&item._textures&&item._textures.length)for(var i=0;i<item._textures.length;i++)if(item._textures[i]instanceof Texture){var baseTexture=item._textures[i].baseTexture;-1===queue.indexOf(baseTexture)&&(queue.push(baseTexture),result=!0)}return result}function findBaseTexture(item,queue){if(item.baseTexture instanceof BaseTexture){var texture=item.baseTexture;return-1===queue.indexOf(texture)&&queue.push(texture),!0}return!1}function findTexture(item,queue){if(item._texture&&item._texture instanceof Texture){var texture=item._texture.baseTexture;return-1===queue.indexOf(texture)&&queue.push(texture),!0}return!1}function drawText(_helper,item){return item instanceof Text&&(item.updateText(!0),!0)}function calculateTextStyle(_helper,item){if(item instanceof TextStyle){var font=item.toFontString();return TextMetrics.measureFont(font),!0}return!1}function findText(item,queue){if(item instanceof Text){-1===queue.indexOf(item.style)&&queue.push(item.style),-1===queue.indexOf(item)&&queue.push(item);var texture=item._texture.baseTexture;return-1===queue.indexOf(texture)&&queue.push(texture),!0}return!1}function findTextStyle(item,queue){return item instanceof TextStyle&&(-1===queue.indexOf(item)&&queue.push(item),!0)}function uploadBaseTextures(renderer,item){return item instanceof BaseTexture&&(item._glTextures[renderer.CONTEXT_UID]||renderer.texture.bind(item),!0)}function uploadGraphics(renderer,item){if(!(item instanceof Graphics))return!1;var geometry=item.geometry;item.finishPoly(),geometry.updateBatches();for(var batches=geometry.batches,i=0;i<batches.length;i++){var texture=batches[i].style.texture;texture&&uploadBaseTextures(renderer,texture.baseTexture)}return geometry.batchable||renderer.geometry.bind(geometry,item._resolveDirectShader(renderer)),!0}function findGraphics(item,queue){return item instanceof Graphics&&(queue.push(item),!0)}var Prepare=function(_super){function Prepare(renderer){var _this=_super.call(this,renderer)||this;return _this.uploadHookHelper=_this.renderer,_this.registerFindHook(findGraphics),_this.registerUploadHook(uploadBaseTextures),_this.registerUploadHook(uploadGraphics),_this}return function(d,b){function __(){this.constructor=d}extendStatics$a(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(Prepare,_super),Prepare}(function(){function BasePrepare(renderer){var _this=this;this.limiter=new CountLimiter(settings.UPLOADS_PER_FRAME),this.renderer=renderer,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=function(){_this.queue&&_this.prepareItems()},this.registerFindHook(findText),this.registerFindHook(findTextStyle),this.registerFindHook(findMultipleBaseTextures),this.registerFindHook(findBaseTexture),this.registerFindHook(findTexture),this.registerUploadHook(drawText),this.registerUploadHook(calculateTextStyle)}return BasePrepare.prototype.upload=function(item,done){"function"==typeof item&&(done=item,item=null),item&&this.add(item),this.queue.length?(done&&this.completes.push(done),this.ticking||(this.ticking=!0,Ticker.system.addOnce(this.tick,this,UPDATE_PRIORITY.UTILITY))):done&&done()},BasePrepare.prototype.tick=function(){setTimeout(this.delayedTick,0)},BasePrepare.prototype.prepareItems=function(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){var item=this.queue[0],uploaded=!1;if(item&&!item._destroyed)for(var i=0,len=this.uploadHooks.length;i<len;i++)if(this.uploadHooks[i](this.uploadHookHelper,item)){this.queue.shift(),uploaded=!0;break}uploaded||this.queue.shift()}if(this.queue.length)Ticker.system.addOnce(this.tick,this,UPDATE_PRIORITY.UTILITY);else{this.ticking=!1;var completes=this.completes.slice(0);this.completes.length=0;for(i=0,len=completes.length;i<len;i++)completes[i]()}},BasePrepare.prototype.registerFindHook=function(addHook){return addHook&&this.addHooks.push(addHook),this},BasePrepare.prototype.registerUploadHook=function(uploadHook){return uploadHook&&this.uploadHooks.push(uploadHook),this},BasePrepare.prototype.add=function(item){for(var i=0,len=this.addHooks.length;i<len&&!this.addHooks[i](item,this.queue);i++);if(item instanceof Container)for(i=item.children.length-1;i>=0;i--)this.add(item.children[i]);return this},BasePrepare.prototype.destroy=function(){this.ticking&&Ticker.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null},BasePrepare}()),Spritesheet=function(){function Spritesheet(texture,data,resolutionFilename){void 0===resolutionFilename&&(resolutionFilename=null),this._texture=texture instanceof Texture?texture:null,this.baseTexture=texture instanceof BaseTexture?texture:this._texture.baseTexture,this.textures={},this.animations={},this.data=data;var resource=this.baseTexture.resource;this.resolution=this._updateResolution(resolutionFilename||(resource?resource.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}return Spritesheet.prototype._updateResolution=function(resolutionFilename){void 0===resolutionFilename&&(resolutionFilename=null);var scale=this.data.meta.scale,resolution=getResolutionOfUrl(resolutionFilename,null);return null===resolution&&(resolution=void 0!==scale?parseFloat(scale):1),1!==resolution&&this.baseTexture.setResolution(resolution),resolution},Spritesheet.prototype.parse=function(callback){this._batchIndex=0,this._callback=callback,this._frameKeys.length<=Spritesheet.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()},Spritesheet.prototype._processFrames=function(initialFrameIndex){for(var frameIndex=initialFrameIndex,maxFrames=Spritesheet.BATCH_SIZE;frameIndex-initialFrameIndex<maxFrames&&frameIndex<this._frameKeys.length;){var i=this._frameKeys[frameIndex],data=this._frames[i],rect=data.frame;if(rect){var frame=null,trim=null,sourceSize=!1!==data.trimmed&&data.sourceSize?data.sourceSize:data.frame,orig=new Rectangle(0,0,Math.floor(sourceSize.w)/this.resolution,Math.floor(sourceSize.h)/this.resolution);frame=data.rotated?new Rectangle(Math.floor(rect.x)/this.resolution,Math.floor(rect.y)/this.resolution,Math.floor(rect.h)/this.resolution,Math.floor(rect.w)/this.resolution):new Rectangle(Math.floor(rect.x)/this.resolution,Math.floor(rect.y)/this.resolution,Math.floor(rect.w)/this.resolution,Math.floor(rect.h)/this.resolution),!1!==data.trimmed&&data.spriteSourceSize&&(trim=new Rectangle(Math.floor(data.spriteSourceSize.x)/this.resolution,Math.floor(data.spriteSourceSize.y)/this.resolution,Math.floor(rect.w)/this.resolution,Math.floor(rect.h)/this.resolution)),this.textures[i]=new Texture(this.baseTexture,frame,orig,trim,data.rotated?2:0,data.anchor),Texture.addToCache(this.textures[i],i)}frameIndex++}},Spritesheet.prototype._processAnimations=function(){var animations=this.data.animations||{};for(var animName in animations){this.animations[animName]=[];for(var i=0;i<animations[animName].length;i++){var frameName=animations[animName][i];this.animations[animName].push(this.textures[frameName])}}},Spritesheet.prototype._parseComplete=function(){var callback=this._callback;this._callback=null,this._batchIndex=0,callback.call(this,this.textures)},Spritesheet.prototype._nextBatch=function(){var _this=this;this._processFrames(this._batchIndex*Spritesheet.BATCH_SIZE),this._batchIndex++,setTimeout((function(){_this._batchIndex*Spritesheet.BATCH_SIZE<_this._frameKeys.length?_this._nextBatch():(_this._processAnimations(),_this._parseComplete())}),0)},Spritesheet.prototype.destroy=function(destroyBase){var _a;for(var i in void 0===destroyBase&&(destroyBase=!1),this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,destroyBase&&(null===(_a=this._texture)||void 0===_a||_a.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null},Spritesheet.BATCH_SIZE=1e3,Spritesheet}(),SpritesheetLoader=function(){function SpritesheetLoader(){}return SpritesheetLoader.use=function(resource,next){var _a,_b,loader=this,imageResourceName=resource.name+"_image";if(resource.data&&resource.type===LoaderResource.TYPE.JSON&&resource.data.frames&&!loader.resources[imageResourceName]){var multiPacks=null===(_b=null===(_a=resource.data)||void 0===_a?void 0:_a.meta)||void 0===_b?void 0:_b.related_multi_packs;if(Array.isArray(multiPacks))for(var _loop_1=function(item){if("string"!=typeof item)return"continue";var itemName=item.replace(".json",""),itemUrl=url.resolve(resource.url.replace(loader.baseUrl,""),item);if(loader.resources[itemName]||Object.values(loader.resources).some((function(r){return url.format(url.parse(r.url))===itemUrl})))return"continue";var options={crossOrigin:resource.crossOrigin,loadType:LoaderResource.LOAD_TYPE.XHR,xhrType:LoaderResource.XHR_RESPONSE_TYPE.JSON,parentResource:resource,metadata:resource.metadata};loader.add(itemName,itemUrl,options)},_i=0,multiPacks_1=multiPacks;_i<multiPacks_1.length;_i++){_loop_1(multiPacks_1[_i])}var loadOptions={crossOrigin:resource.crossOrigin,metadata:resource.metadata.imageMetadata,parentResource:resource},resourcePath=SpritesheetLoader.getResourcePath(resource,loader.baseUrl);loader.add(imageResourceName,resourcePath,loadOptions,(function(res){if(res.error)next(res.error);else{var spritesheet=new Spritesheet(res.texture,resource.data,resource.url);spritesheet.parse((function(){resource.spritesheet=spritesheet,resource.textures=spritesheet.textures,next()}))}}))}else next()},SpritesheetLoader.getResourcePath=function(resource,baseUrl){return resource.isDataUrl?resource.data.meta.image:url.resolve(resource.url.replace(baseUrl,""),resource.data.meta.image)},SpritesheetLoader}(),extendStatics$b=function(d,b){return extendStatics$b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$b(d,b)};
|
|
186
172
|
/*!
|
|
187
|
-
* @pixi/spritesheet -
|
|
188
|
-
* Compiled
|
|
173
|
+
* @pixi/spritesheet - v6.4.2
|
|
174
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
189
175
|
*
|
|
190
176
|
* @pixi/spritesheet is licensed under the MIT License.
|
|
191
177
|
* http://www.opensource.org/licenses/mit-license
|
|
192
|
-
*/function __extends$a(d,b){function __(){this.constructor=d}extendStatics$a(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var tempPoint$1=new Point;!function(_super){function TilingSprite(texture,width,height){void 0===width&&(width=100),void 0===height&&(height=100);var _this=_super.call(this,texture)||this;return _this.tileTransform=new Transform,_this._width=width,_this._height=height,_this.uvMatrix=_this.texture.uvMatrix||new TextureMatrix(texture),_this.pluginName="tilingSprite",_this.uvRespectAnchor=!1,_this}__extends$a(TilingSprite,_super),Object.defineProperty(TilingSprite.prototype,"clampMargin",{get:function(){return this.uvMatrix.clampMargin},set:function(value){this.uvMatrix.clampMargin=value,this.uvMatrix.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(TilingSprite.prototype,"tileScale",{get:function(){return this.tileTransform.scale},set:function(value){this.tileTransform.scale.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(TilingSprite.prototype,"tilePosition",{get:function(){return this.tileTransform.position},set:function(value){this.tileTransform.position.copyFrom(value)},enumerable:!1,configurable:!0}),TilingSprite.prototype._onTextureUpdate=function(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215},TilingSprite.prototype._render=function(renderer){var texture=this._texture;texture&&texture.valid&&(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]),renderer.plugins[this.pluginName].render(this))},TilingSprite.prototype._calculateBounds=function(){var minX=this._width*-this._anchor._x,minY=this._height*-this._anchor._y,maxX=this._width*(1-this._anchor._x),maxY=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,minX,minY,maxX,maxY)},TilingSprite.prototype.getLocalBounds=function(rect){return 0===this.children.length?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),rect||(this._localBoundsRect||(this._localBoundsRect=new Rectangle),rect=this._localBoundsRect),this._bounds.getRectangle(rect)):_super.prototype.getLocalBounds.call(this,rect)},TilingSprite.prototype.containsPoint=function(point){this.worldTransform.applyInverse(point,tempPoint$1);var width=this._width,height=this._height,x1=-width*this.anchor._x;if(tempPoint$1.x>=x1&&tempPoint$1.x<x1+width){var y1=-height*this.anchor._y;if(tempPoint$1.y>=y1&&tempPoint$1.y<y1+height)return!0}return!1},TilingSprite.prototype.destroy=function(options){_super.prototype.destroy.call(this,options),this.tileTransform=null,this.uvMatrix=null},TilingSprite.from=function(source,options){return"number"==typeof options&&(deprecation("5.3.0","TilingSprite.from use options instead of width and height args"),options={width:options,height:arguments[2]}),new TilingSprite(Texture.from(source,options),options.width,options.height)},Object.defineProperty(TilingSprite.prototype,"width",{get:function(){return this._width},set:function(value){this._width=value},enumerable:!1,configurable:!0}),Object.defineProperty(TilingSprite.prototype,"height",{get:function(){return this._height},set:function(value){this._height=value},enumerable:!1,configurable:!0})}(Sprite);var vertex$2="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n",tempMat$1=new Matrix,TilingSpriteRenderer=function(_super){function TilingSpriteRenderer(renderer){var _this=_super.call(this,renderer)||this,uniforms={globals:_this.renderer.globalUniforms};return _this.shader=Shader.from(vertex$2,"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture2D(uSampler, coord);\n gl_FragColor = texSample * uColor;\n}\n",uniforms),_this.simpleShader=Shader.from(vertex$2,"varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 texSample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = texSample * uColor;\n}\n",uniforms),_this.quad=new QuadUv,_this.state=State.for2d(),_this}return __extends$a(TilingSpriteRenderer,_super),TilingSpriteRenderer.prototype.render=function(ts){var renderer=this.renderer,quad=this.quad,vertices=quad.vertices;vertices[0]=vertices[6]=ts._width*-ts.anchor.x,vertices[1]=vertices[3]=ts._height*-ts.anchor.y,vertices[2]=vertices[4]=ts._width*(1-ts.anchor.x),vertices[5]=vertices[7]=ts._height*(1-ts.anchor.y),ts.uvRespectAnchor&&((vertices=quad.uvs)[0]=vertices[6]=-ts.anchor.x,vertices[1]=vertices[3]=-ts.anchor.y,vertices[2]=vertices[4]=1-ts.anchor.x,vertices[5]=vertices[7]=1-ts.anchor.y),quad.invalidate();var tex=ts._texture,baseTex=tex.baseTexture,lt=ts.tileTransform.localTransform,uv=ts.uvMatrix,isSimple=baseTex.isPowerOfTwo&&tex.frame.width===baseTex.width&&tex.frame.height===baseTex.height;isSimple&&(baseTex._glTextures[renderer.CONTEXT_UID]?isSimple=baseTex.wrapMode!==WRAP_MODES.CLAMP:baseTex.wrapMode===WRAP_MODES.CLAMP&&(baseTex.wrapMode=WRAP_MODES.REPEAT));var shader=isSimple?this.simpleShader:this.shader,w=tex.width,h=tex.height,W=ts._width,H=ts._height;tempMat$1.set(lt.a*w/W,lt.b*w/H,lt.c*h/W,lt.d*h/H,lt.tx/W,lt.ty/H),tempMat$1.invert(),isSimple?tempMat$1.prepend(uv.mapCoord):(shader.uniforms.uMapCoord=uv.mapCoord.toArray(!0),shader.uniforms.uClampFrame=uv.uClampFrame,shader.uniforms.uClampOffset=uv.uClampOffset),shader.uniforms.uTransform=tempMat$1.toArray(!0),shader.uniforms.uColor=premultiplyTintToRgba(ts.tint,ts.worldAlpha,shader.uniforms.uColor,baseTex.alphaMode),shader.uniforms.translationMatrix=ts.transform.worldTransform.toArray(!0),shader.uniforms.uSampler=tex,renderer.shader.bind(shader),renderer.geometry.bind(quad),this.state.blendMode=correctBlendMode(ts.blendMode,baseTex.alphaMode),renderer.state.set(this.state),renderer.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},TilingSpriteRenderer}(ObjectRenderer),extendStatics$b=function(d,b){return(extendStatics$b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};function __extends$b(d,b){function __(){this.constructor=d}extendStatics$b(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var MeshBatchUvs=function(){function MeshBatchUvs(uvBuffer,uvMatrix){this.uvBuffer=uvBuffer,this.uvMatrix=uvMatrix,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return MeshBatchUvs.prototype.update=function(forceUpdate){if(forceUpdate||this._bufferUpdateId!==this.uvBuffer._updateID||this._textureUpdateId!==this.uvMatrix._updateID){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var data=this.uvBuffer.data;this.data&&this.data.length===data.length||(this.data=new Float32Array(data.length)),this.uvMatrix.multiplyUvs(data,this.data),this._updateID++}},MeshBatchUvs}(),tempPoint$2=new Point,tempPolygon=new Polygon,Mesh=function(_super){function Mesh(geometry,shader,state,drawMode){void 0===drawMode&&(drawMode=DRAW_MODES.TRIANGLES);var _this=_super.call(this)||this;return _this.geometry=geometry,geometry.refCount++,_this.shader=shader,_this.state=state||State.for2d(),_this.drawMode=drawMode,_this.start=0,_this.size=0,_this.uvs=null,_this.indices=null,_this.vertexData=new Float32Array(1),_this.vertexDirty=0,_this._transformID=-1,_this._roundPixels=settings.ROUND_PIXELS,_this.batchUvs=null,_this}return __extends$b(Mesh,_super),Object.defineProperty(Mesh.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Mesh.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Mesh.prototype,"material",{get:function(){return this.shader},set:function(value){this.shader=value},enumerable:!1,configurable:!0}),Object.defineProperty(Mesh.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(value){this.state.blendMode=value},enumerable:!1,configurable:!0}),Object.defineProperty(Mesh.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(value){this._roundPixels!==value&&(this._transformID=-1),this._roundPixels=value},enumerable:!1,configurable:!0}),Object.defineProperty(Mesh.prototype,"tint",{get:function(){return this.shader.tint},set:function(value){this.shader.tint=value},enumerable:!1,configurable:!0}),Object.defineProperty(Mesh.prototype,"texture",{get:function(){return this.shader.texture},set:function(value){this.shader.texture=value},enumerable:!1,configurable:!0}),Mesh.prototype._render=function(renderer){var vertices=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===DRAW_MODES.TRIANGLES&&vertices.length<2*Mesh.BATCHABLE_SIZE?this._renderToBatch(renderer):this._renderDefault(renderer)},Mesh.prototype._renderDefault=function(renderer){var shader=this.shader;shader.alpha=this.worldAlpha,shader.update&&shader.update(),renderer.batch.flush(),shader.program.uniformData.translationMatrix&&(shader.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0)),renderer.shader.bind(shader),renderer.state.set(this.state),renderer.geometry.bind(this.geometry,shader),renderer.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},Mesh.prototype._renderToBatch=function(renderer){var geometry=this.geometry;this.shader.uvMatrix&&(this.shader.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=geometry.indexBuffer.data,this._tintRGB=this.shader._tintRGB,this._texture=this.shader.texture;var pluginName=this.material.pluginName;renderer.batch.setObjectRenderer(renderer.plugins[pluginName]),renderer.plugins[pluginName].render(this)},Mesh.prototype.calculateVertices=function(){var geometry=this.geometry,vertices=geometry.buffers[0].data;if(geometry.vertexDirtyId!==this.vertexDirty||this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID,this.vertexData.length!==vertices.length&&(this.vertexData=new Float32Array(vertices.length));for(var wt=this.transform.worldTransform,a=wt.a,b=wt.b,c=wt.c,d=wt.d,tx=wt.tx,ty=wt.ty,vertexData=this.vertexData,i=0;i<vertexData.length/2;i++){var x=vertices[2*i],y=vertices[2*i+1];vertexData[2*i]=a*x+c*y+tx,vertexData[2*i+1]=b*x+d*y+ty}if(this._roundPixels){var resolution=settings.RESOLUTION;for(i=0;i<vertexData.length;++i)vertexData[i]=Math.round((vertexData[i]*resolution|0)/resolution)}this.vertexDirty=geometry.vertexDirtyId}},Mesh.prototype.calculateUvs=function(){var geomUvs=this.geometry.buffers[1];this.shader.uvMatrix.isSimple?this.uvs=geomUvs.data:(this.batchUvs||(this.batchUvs=new MeshBatchUvs(geomUvs,this.shader.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)},Mesh.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)},Mesh.prototype.containsPoint=function(point){if(!this.getBounds().contains(point.x,point.y))return!1;this.worldTransform.applyInverse(point,tempPoint$2);for(var vertices=this.geometry.getBuffer("aVertexPosition").data,points=tempPolygon.points,indices=this.geometry.getIndex().data,len=indices.length,step=4===this.drawMode?3:1,i=0;i+2<len;i+=step){var ind0=2*indices[i],ind1=2*indices[i+1],ind2=2*indices[i+2];if(points[0]=vertices[ind0],points[1]=vertices[ind0+1],points[2]=vertices[ind1],points[3]=vertices[ind1+1],points[4]=vertices[ind2],points[5]=vertices[ind2+1],tempPolygon.contains(tempPoint$2.x,tempPoint$2.y))return!0}return!1},Mesh.prototype.destroy=function(options){_super.prototype.destroy.call(this,options),this.geometry.refCount--,0===this.geometry.refCount&&this.geometry.dispose(),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null},Mesh.BATCHABLE_SIZE=100,Mesh}(Container),MeshMaterial=function(_super){function MeshMaterial(uSampler,options){var _this=this,uniforms={uSampler:uSampler,alpha:1,uTextureMatrix:Matrix.IDENTITY,uColor:new Float32Array([1,1,1,1])};return(options=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},options)).uniforms&&Object.assign(uniforms,options.uniforms),(_this=_super.call(this,options.program||Program.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n","varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"),uniforms)||this)._colorDirty=!1,_this.uvMatrix=new TextureMatrix(uSampler),_this.batchable=void 0===options.program,_this.pluginName=options.pluginName,_this.tint=options.tint,_this.alpha=options.alpha,_this}return __extends$b(MeshMaterial,_super),Object.defineProperty(MeshMaterial.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(value){this.uniforms.uSampler!==value&&(this.uniforms.uSampler=value,this.uvMatrix.texture=value)},enumerable:!1,configurable:!0}),Object.defineProperty(MeshMaterial.prototype,"alpha",{get:function(){return this._alpha},set:function(value){value!==this._alpha&&(this._alpha=value,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(MeshMaterial.prototype,"tint",{get:function(){return this._tint},set:function(value){value!==this._tint&&(this._tint=value,this._tintRGB=(value>>16)+(65280&value)+((255&value)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),MeshMaterial.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var baseTexture=this.texture.baseTexture;premultiplyTintToRgba(this._tint,this._alpha,this.uniforms.uColor,baseTexture.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},MeshMaterial}(Shader),MeshGeometry=function(_super){function MeshGeometry(vertices,uvs,index){var _this=_super.call(this)||this,verticesBuffer=new Buffer(vertices),uvsBuffer=new Buffer(uvs,!0),indexBuffer=new Buffer(index,!0,!0);return _this.addAttribute("aVertexPosition",verticesBuffer,2,!1,TYPES.FLOAT).addAttribute("aTextureCoord",uvsBuffer,2,!1,TYPES.FLOAT).addIndex(indexBuffer),_this._updateId=-1,_this}return __extends$b(MeshGeometry,_super),Object.defineProperty(MeshGeometry.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),MeshGeometry}(Geometry),extendStatics$c=function(d,b){return(extendStatics$c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};var BitmapFontData=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[]},TextFormat=function(){function TextFormat(){}return TextFormat.test=function(data){return"string"==typeof data&&0===data.indexOf("info face=")},TextFormat.parse=function(txt){var items=txt.match(/^[a-z]+\s+.+$/gm),rawData={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[]};for(var i in items){var name=items[i].match(/^[a-z]+/gm)[0],attributeList=items[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),itemData={};for(var i_1 in attributeList){var split=attributeList[i_1].split("="),key=split[0],strValue=split[1].replace(/"/gm,""),floatValue=parseFloat(strValue),value=isNaN(floatValue)?strValue:floatValue;itemData[key]=value}rawData[name].push(itemData)}var font=new BitmapFontData;return rawData.info.forEach((function(info){return font.info.push({face:info.face,size:parseInt(info.size,10)})})),rawData.common.forEach((function(common){return font.common.push({lineHeight:parseInt(common.lineHeight,10)})})),rawData.page.forEach((function(page){return font.page.push({id:parseInt(page.id,10),file:page.file})})),rawData.char.forEach((function(char){return font.char.push({id:parseInt(char.id,10),page:parseInt(char.page,10),x:parseInt(char.x,10),y:parseInt(char.y,10),width:parseInt(char.width,10),height:parseInt(char.height,10),xoffset:parseInt(char.xoffset,10),yoffset:parseInt(char.yoffset,10),xadvance:parseInt(char.xadvance,10)})})),rawData.kerning.forEach((function(kerning){return font.kerning.push({first:parseInt(kerning.first,10),second:parseInt(kerning.second,10),amount:parseInt(kerning.amount,10)})})),font},TextFormat}(),XMLFormat=function(){function XMLFormat(){}return XMLFormat.test=function(data){return data instanceof XMLDocument&&data.getElementsByTagName("page").length&&null!==data.getElementsByTagName("info")[0].getAttribute("face")},XMLFormat.parse=function(xml){for(var data=new BitmapFontData,info=xml.getElementsByTagName("info"),common=xml.getElementsByTagName("common"),page=xml.getElementsByTagName("page"),char=xml.getElementsByTagName("char"),kerning=xml.getElementsByTagName("kerning"),i=0;i<info.length;i++)data.info.push({face:info[i].getAttribute("face"),size:parseInt(info[i].getAttribute("size"),10)});for(i=0;i<common.length;i++)data.common.push({lineHeight:parseInt(common[i].getAttribute("lineHeight"),10)});for(i=0;i<page.length;i++)data.page.push({id:parseInt(page[i].getAttribute("id"),10)||0,file:page[i].getAttribute("file")});for(i=0;i<char.length;i++){var letter=char[i];data.char.push({id:parseInt(letter.getAttribute("id"),10),page:parseInt(letter.getAttribute("page"),10)||0,x:parseInt(letter.getAttribute("x"),10),y:parseInt(letter.getAttribute("y"),10),width:parseInt(letter.getAttribute("width"),10),height:parseInt(letter.getAttribute("height"),10),xoffset:parseInt(letter.getAttribute("xoffset"),10),yoffset:parseInt(letter.getAttribute("yoffset"),10),xadvance:parseInt(letter.getAttribute("xadvance"),10)})}for(i=0;i<kerning.length;i++)data.kerning.push({first:parseInt(kerning[i].getAttribute("first"),10),second:parseInt(kerning[i].getAttribute("second"),10),amount:parseInt(kerning[i].getAttribute("amount"),10)});return data},XMLFormat}(),XMLStringFormat=function(){function XMLStringFormat(){}return XMLStringFormat.test=function(data){if("string"==typeof data&&data.indexOf("<font>")>-1){var xml=(new self.DOMParser).parseFromString(data,"text/xml");return XMLFormat.test(xml)}return!1},XMLStringFormat.parse=function(xmlTxt){var xml=(new window.DOMParser).parseFromString(xmlTxt,"text/xml");return XMLFormat.parse(xml)},XMLStringFormat}(),formats=[TextFormat,XMLFormat,XMLStringFormat];function autoDetectFormat(data){for(var i=0;i<formats.length;i++)if(formats[i].test(data))return formats[i];return null}function generateFillStyle(canvas,context,style,resolution,lines,metrics){var gradient,fillStyle=style.fill;if(!Array.isArray(fillStyle))return fillStyle;if(1===fillStyle.length)return fillStyle[0];var dropShadowCorrection=style.dropShadow?style.dropShadowDistance:0,padding=style.padding||0,width=Math.ceil(canvas.width/resolution)-dropShadowCorrection-2*padding,height=Math.ceil(canvas.height/resolution)-dropShadowCorrection-2*padding,fill=fillStyle.slice(),fillGradientStops=style.fillGradientStops.slice();if(!fillGradientStops.length)for(var lengthPlus1=fill.length+1,i=1;i<lengthPlus1;++i)fillGradientStops.push(i/lengthPlus1);if(fill.unshift(fillStyle[0]),fillGradientStops.unshift(0),fill.push(fillStyle[fillStyle.length-1]),fillGradientStops.push(1),style.fillGradientType===TEXT_GRADIENT.LINEAR_VERTICAL){gradient=context.createLinearGradient(width/2,padding,width/2,height+padding);var lastIterationStop=0,gradStopLineHeight=(metrics.fontProperties.fontSize+style.strokeThickness)/height;for(i=0;i<lines.length;i++)for(var thisLineTop=metrics.lineHeight*i,j=0;j<fill.length;j++){var globalStop=thisLineTop/height+("number"==typeof fillGradientStops[j]?fillGradientStops[j]:j/fill.length)*gradStopLineHeight,clampedStop=Math.max(lastIterationStop,globalStop);clampedStop=Math.min(clampedStop,1),gradient.addColorStop(clampedStop,fill[j]),lastIterationStop=clampedStop}}else{gradient=context.createLinearGradient(padding,height/2,width+padding,height/2);var totalIterations=fill.length+1,currentIteration=1;for(i=0;i<fill.length;i++){var stop=void 0;stop="number"==typeof fillGradientStops[i]?fillGradientStops[i]:currentIteration/totalIterations,gradient.addColorStop(stop,fill[i]),currentIteration++}}return gradient}function drawGlyph(canvas,context,metrics,x,y,resolution,style){var char=metrics.text,fontProperties=metrics.fontProperties;context.translate(x,y),context.scale(resolution,resolution);var tx=style.strokeThickness/2,ty=-style.strokeThickness/2;context.font=style.toFontString(),context.lineWidth=style.strokeThickness,context.textBaseline=style.textBaseline,context.lineJoin=style.lineJoin,context.miterLimit=style.miterLimit,context.fillStyle=generateFillStyle(canvas,context,style,resolution,[char],metrics),context.strokeStyle=style.stroke,context.font=style.toFontString(),context.lineWidth=style.strokeThickness,context.textBaseline=style.textBaseline,context.lineJoin=style.lineJoin,context.miterLimit=style.miterLimit,context.fillStyle=generateFillStyle(canvas,context,style,resolution,[char],metrics),context.strokeStyle=style.stroke;var dropShadowColor=style.dropShadowColor,rgb=hex2rgb("number"==typeof dropShadowColor?dropShadowColor:string2hex(dropShadowColor));style.dropShadow?(context.shadowColor="rgba("+255*rgb[0]+","+255*rgb[1]+","+255*rgb[2]+","+style.dropShadowAlpha+")",context.shadowBlur=style.dropShadowBlur,context.shadowOffsetX=Math.cos(style.dropShadowAngle)*style.dropShadowDistance,context.shadowOffsetY=Math.sin(style.dropShadowAngle)*style.dropShadowDistance):(context.shadowColor="black",context.shadowBlur=0,context.shadowOffsetX=0,context.shadowOffsetY=0),style.stroke&&style.strokeThickness&&context.strokeText(char,tx,ty+metrics.lineHeight-fontProperties.descent),style.fill&&context.fillText(char,tx,ty+metrics.lineHeight-fontProperties.descent),context.setTransform(1,0,0,1,0,0),context.fillStyle="rgba(0, 0, 0, 0)"}var BitmapFont=function(){function BitmapFont(data,textures,ownsTextures){var info=data.info[0],common=data.common[0],res=getResolutionOfUrl(data.page[0].file),pageTextures={};this._ownsTextures=ownsTextures,this.font=info.face,this.size=info.size,this.lineHeight=common.lineHeight/res,this.chars={},this.pageTextures=pageTextures;for(var i=0;i<data.page.length;i++){var _a=data.page[i],id=_a.id,file=_a.file;pageTextures[id]=textures instanceof Array?textures[i]:textures[file]}for(i=0;i<data.char.length;i++){var _b=data.char[i],page_1=(id=_b.id,_b.page),_c=data.char[i],x=_c.x,y=_c.y,width=_c.width,height=_c.height,xoffset=_c.xoffset,yoffset=_c.yoffset,xadvance=_c.xadvance;y/=res,width/=res,height/=res,xoffset/=res,yoffset/=res,xadvance/=res;var rect=new Rectangle((x/=res)+pageTextures[page_1].frame.x/res,y+pageTextures[page_1].frame.y/res,width,height);this.chars[id]={xOffset:xoffset,yOffset:yoffset,xAdvance:xadvance,kerning:{},texture:new Texture(pageTextures[page_1].baseTexture,rect),page:page_1}}for(i=0;i<data.kerning.length;i++){var _d=data.kerning[i],first=_d.first,second=_d.second,amount=_d.amount;first/=res,second/=res,amount/=res,this.chars[second]&&(this.chars[second].kerning[first]=amount)}}return BitmapFont.prototype.destroy=function(){for(var id in this.chars)this.chars[id].texture.destroy(),this.chars[id].texture=null;for(var id in this.pageTextures)this._ownsTextures&&this.pageTextures[id].destroy(!0),this.pageTextures[id]=null;this.chars=null,this.pageTextures=null},BitmapFont.install=function(data,textures,ownsTextures){var fontData;if(data instanceof BitmapFontData)fontData=data;else{var format=autoDetectFormat(data);if(!format)throw new Error("Unrecognized data format for font.");fontData=format.parse(data)}textures instanceof Texture&&(textures=[textures]);var font=new BitmapFont(fontData,textures,ownsTextures);return BitmapFont.available[font.font]=font,font},BitmapFont.uninstall=function(name){var font=BitmapFont.available[name];if(!font)throw new Error("No font found named '"+name+"'");font.destroy(),delete BitmapFont.available[name]},BitmapFont.from=function(name,textStyle,options){if(!name)throw new Error("[BitmapFont] Property `name` is required.");var _a=Object.assign({},BitmapFont.defaultOptions,options),chars=_a.chars,padding=_a.padding,resolution=_a.resolution,textureWidth=_a.textureWidth,textureHeight=_a.textureHeight,charsList=function(chars){"string"==typeof chars&&(chars=[chars]);for(var result=[],i=0,j=chars.length;i<j;i++){var item=chars[i];if(Array.isArray(item)){if(2!==item.length)throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got "+item.length+".");var startCode=item[0].charCodeAt(0),endCode=item[1].charCodeAt(0);if(endCode<startCode)throw new Error("[BitmapFont]: Invalid character range.");for(var i_1=startCode,j_1=endCode;i_1<=j_1;i_1++)result.push(String.fromCharCode(i_1))}else result.push.apply(result,item.split(""))}if(0===result.length)throw new Error("[BitmapFont]: Empty set when resolving characters.");return result}(chars),style=textStyle instanceof TextStyle?textStyle:new TextStyle(textStyle),lineWidth=textureWidth,fontData=new BitmapFontData;fontData.info[0]={face:style.fontFamily,size:style.fontSize},fontData.common[0]={lineHeight:style.fontSize};for(var canvas,context,baseTexture,positionX=0,positionY=0,maxCharHeight=0,textures=[],i=0;i<charsList.length;i++){canvas||((canvas=document.createElement("canvas")).width=textureWidth,canvas.height=textureHeight,context=canvas.getContext("2d"),baseTexture=new BaseTexture(canvas,{resolution:resolution}),textures.push(new Texture(baseTexture)),fontData.page.push({id:textures.length-1,file:""}));var metrics=TextMetrics.measureText(charsList[i],style,!1,canvas),width=metrics.width,height=Math.ceil(metrics.height),textureGlyphWidth=Math.ceil(("italic"===style.fontStyle?2:1)*width);if(positionY>=textureHeight-height*resolution){if(0===positionY)throw new Error("[BitmapFont] textureHeight "+textureHeight+"px is too small for "+style.fontSize+"px fonts");--i,canvas=null,context=null,baseTexture=null,positionY=0,positionX=0,maxCharHeight=0}else if(maxCharHeight=Math.max(height+metrics.fontProperties.descent,maxCharHeight),textureGlyphWidth*resolution+positionX>=lineWidth)--i,positionY+=maxCharHeight*resolution,positionY=Math.ceil(positionY),positionX=0,maxCharHeight=0;else{drawGlyph(canvas,context,metrics,positionX,positionY,resolution,style);var id=metrics.text.charCodeAt(0);fontData.char.push({id:id,page:textures.length-1,x:positionX/resolution,y:positionY/resolution,width:textureGlyphWidth,height:height,xoffset:0,yoffset:0,xadvance:Math.ceil(width-(style.dropShadow?style.dropShadowDistance:0)-(style.stroke?style.strokeThickness:0))}),positionX+=(textureGlyphWidth+2*padding)*resolution,positionX=Math.ceil(positionX)}}var font=new BitmapFont(fontData,textures,!0);return void 0!==BitmapFont.available[name]&&BitmapFont.uninstall(name),BitmapFont.available[name]=font,font},BitmapFont.ALPHA=[["a","z"],["A","Z"]," "],BitmapFont.NUMERIC=[["0","9"]],BitmapFont.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],BitmapFont.ASCII=[[" ","~"]],BitmapFont.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:BitmapFont.ALPHANUMERIC},BitmapFont.available={},BitmapFont}(),pageMeshDataPool=[],charRenderDataPool=[];!function(_super){function BitmapText(text,style){void 0===style&&(style={});var _this=_super.call(this)||this;_this._tint=16777215,style.font&&(deprecation("5.3.0","PIXI.BitmapText constructor style.font property is deprecated."),_this._upgradeStyle(style));var _a=Object.assign({},BitmapText.styleDefaults,style),align=_a.align,tint=_a.tint,maxWidth=_a.maxWidth,letterSpacing=_a.letterSpacing,fontName=_a.fontName,fontSize=_a.fontSize;if(!BitmapFont.available[fontName])throw new Error('Missing BitmapFont "'+fontName+'"');return _this._activePagesMeshData=[],_this._textWidth=0,_this._textHeight=0,_this._align=align,_this._tint=tint,_this._fontName=fontName,_this._fontSize=fontSize||BitmapFont.available[fontName].size,_this._text=text,_this._maxWidth=maxWidth,_this._maxLineHeight=0,_this._letterSpacing=letterSpacing,_this._anchor=new ObservablePoint((function(){_this.dirty=!0}),_this,0,0),_this._roundPixels=settings.ROUND_PIXELS,_this.dirty=!0,_this._textureCache={},_this}(function(d,b){function __(){this.constructor=d}extendStatics$c(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)})(BitmapText,_super),BitmapText.prototype.updateText=function(){for(var _a,data=BitmapFont.available[this._fontName],scale=this._fontSize/data.size,pos=new Point,chars=[],lineWidths=[],text=this._text.replace(/(?:\r\n|\r)/g,"\n")||" ",textLength=text.length,maxWidth=this._maxWidth*data.size/this._fontSize,prevCharCode=null,lastLineWidth=0,maxLineWidth=0,line=0,lastBreakPos=-1,lastBreakWidth=0,spacesRemoved=0,maxLineHeight=0,i=0;i<textLength;i++){var charCode=text.charCodeAt(i),char=text.charAt(i);if(/(?:\s)/.test(char)&&(lastBreakPos=i,lastBreakWidth=lastLineWidth),"\r"!==char&&"\n"!==char){var charData=data.chars[charCode];if(charData){prevCharCode&&charData.kerning[prevCharCode]&&(pos.x+=charData.kerning[prevCharCode]);var charRenderData=charRenderDataPool.pop()||{texture:Texture.EMPTY,line:0,charCode:0,position:new Point};charRenderData.texture=charData.texture,charRenderData.line=line,charRenderData.charCode=charCode,charRenderData.position.x=pos.x+charData.xOffset+this._letterSpacing/2,charRenderData.position.y=pos.y+charData.yOffset,chars.push(charRenderData),pos.x+=charData.xAdvance+this._letterSpacing,lastLineWidth=pos.x,maxLineHeight=Math.max(maxLineHeight,charData.yOffset+charData.texture.height),prevCharCode=charCode,-1!==lastBreakPos&&maxWidth>0&&pos.x>maxWidth&&(removeItems(chars,1+lastBreakPos-++spacesRemoved,1+i-lastBreakPos),i=lastBreakPos,lastBreakPos=-1,lineWidths.push(lastBreakWidth),maxLineWidth=Math.max(maxLineWidth,lastBreakWidth),line++,pos.x=0,pos.y+=data.lineHeight,prevCharCode=null)}}else lineWidths.push(lastLineWidth),maxLineWidth=Math.max(maxLineWidth,lastLineWidth),++line,++spacesRemoved,pos.x=0,pos.y+=data.lineHeight,prevCharCode=null}var lastChar=text.charAt(text.length-1);"\r"!==lastChar&&"\n"!==lastChar&&(/(?:\s)/.test(lastChar)&&(lastLineWidth=lastBreakWidth),lineWidths.push(lastLineWidth),maxLineWidth=Math.max(maxLineWidth,lastLineWidth));var lineAlignOffsets=[];for(i=0;i<=line;i++){var alignOffset=0;"right"===this._align?alignOffset=maxLineWidth-lineWidths[i]:"center"===this._align&&(alignOffset=(maxLineWidth-lineWidths[i])/2),lineAlignOffsets.push(alignOffset)}var lenChars=chars.length,pagesMeshData={},newPagesMeshData=[],activePagesMeshData=this._activePagesMeshData;for(i=0;i<activePagesMeshData.length;i++)pageMeshDataPool.push(activePagesMeshData[i]);for(i=0;i<lenChars;i++){var baseTextureUid=(texture=chars[i].texture).baseTexture.uid;if(!pagesMeshData[baseTextureUid]){if(!(pageMeshData=pageMeshDataPool.pop())){var geometry=new MeshGeometry,material=new MeshMaterial(Texture.EMPTY);pageMeshData={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:new Mesh(geometry,material),vertices:null,uvs:null,indices:null}}pageMeshData.index=0,pageMeshData.indexCount=0,pageMeshData.vertexCount=0,pageMeshData.uvsCount=0,pageMeshData.total=0;var _textureCache=this._textureCache;_textureCache[baseTextureUid]=_textureCache[baseTextureUid]||new Texture(texture.baseTexture),pageMeshData.mesh.texture=_textureCache[baseTextureUid],pageMeshData.mesh.tint=this._tint,newPagesMeshData.push(pageMeshData),pagesMeshData[baseTextureUid]=pageMeshData}pagesMeshData[baseTextureUid].total++}for(i=0;i<activePagesMeshData.length;i++)-1===newPagesMeshData.indexOf(activePagesMeshData[i])&&this.removeChild(activePagesMeshData[i].mesh);for(i=0;i<newPagesMeshData.length;i++)newPagesMeshData[i].mesh.parent!==this&&this.addChild(newPagesMeshData[i].mesh);for(var i in this._activePagesMeshData=newPagesMeshData,pagesMeshData){var total=(pageMeshData=pagesMeshData[i]).total;if(!((null===(_a=pageMeshData.indices)||void 0===_a?void 0:_a.length)>6*total)||pageMeshData.vertices.length<2*Mesh.BATCHABLE_SIZE)pageMeshData.vertices=new Float32Array(8*total),pageMeshData.uvs=new Float32Array(8*total),pageMeshData.indices=new Uint16Array(6*total);else for(var total_1=pageMeshData.total,vertices=pageMeshData.vertices,i_1=4*total_1*2;i_1<vertices.length;i_1++)vertices[i_1]=0;pageMeshData.mesh.size=6*total}for(i=0;i<lenChars;i++){var offset=(char=chars[i]).position.x+lineAlignOffsets[char.line];this._roundPixels&&(offset=Math.round(offset));var texture,xPos=offset*scale,yPos=char.position.y*scale,pageMesh=pagesMeshData[(texture=char.texture).baseTexture.uid],textureFrame=texture.frame,textureUvs=texture._uvs,index=pageMesh.index++;pageMesh.indices[6*index+0]=0+4*index,pageMesh.indices[6*index+1]=1+4*index,pageMesh.indices[6*index+2]=2+4*index,pageMesh.indices[6*index+3]=0+4*index,pageMesh.indices[6*index+4]=2+4*index,pageMesh.indices[6*index+5]=3+4*index,pageMesh.vertices[8*index+0]=xPos,pageMesh.vertices[8*index+1]=yPos,pageMesh.vertices[8*index+2]=xPos+textureFrame.width*scale,pageMesh.vertices[8*index+3]=yPos,pageMesh.vertices[8*index+4]=xPos+textureFrame.width*scale,pageMesh.vertices[8*index+5]=yPos+textureFrame.height*scale,pageMesh.vertices[8*index+6]=xPos,pageMesh.vertices[8*index+7]=yPos+textureFrame.height*scale,pageMesh.uvs[8*index+0]=textureUvs.x0,pageMesh.uvs[8*index+1]=textureUvs.y0,pageMesh.uvs[8*index+2]=textureUvs.x1,pageMesh.uvs[8*index+3]=textureUvs.y1,pageMesh.uvs[8*index+4]=textureUvs.x2,pageMesh.uvs[8*index+5]=textureUvs.y2,pageMesh.uvs[8*index+6]=textureUvs.x3,pageMesh.uvs[8*index+7]=textureUvs.y3}for(var i in this._textWidth=maxLineWidth*scale,this._textHeight=(pos.y+data.lineHeight)*scale,pagesMeshData){var pageMeshData=pagesMeshData[i];if(0!==this.anchor.x||0!==this.anchor.y)for(var vertexCount=0,anchorOffsetX=this._textWidth*this.anchor.x,anchorOffsetY=this._textHeight*this.anchor.y,i_2=0;i_2<pageMeshData.total;i_2++)pageMeshData.vertices[vertexCount++]-=anchorOffsetX,pageMeshData.vertices[vertexCount++]-=anchorOffsetY,pageMeshData.vertices[vertexCount++]-=anchorOffsetX,pageMeshData.vertices[vertexCount++]-=anchorOffsetY,pageMeshData.vertices[vertexCount++]-=anchorOffsetX,pageMeshData.vertices[vertexCount++]-=anchorOffsetY,pageMeshData.vertices[vertexCount++]-=anchorOffsetX,pageMeshData.vertices[vertexCount++]-=anchorOffsetY;this._maxLineHeight=maxLineHeight*scale;var vertexBuffer=pageMeshData.mesh.geometry.getBuffer("aVertexPosition"),textureBuffer=pageMeshData.mesh.geometry.getBuffer("aTextureCoord"),indexBuffer=pageMeshData.mesh.geometry.getIndex();vertexBuffer.data=pageMeshData.vertices,textureBuffer.data=pageMeshData.uvs,indexBuffer.data=pageMeshData.indices,vertexBuffer.update(),textureBuffer.update(),indexBuffer.update()}for(i=0;i<chars.length;i++)charRenderDataPool.push(chars[i])},BitmapText.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},BitmapText.prototype.getLocalBounds=function(){return this.validate(),_super.prototype.getLocalBounds.call(this)},BitmapText.prototype.validate=function(){this.dirty&&(this.updateText(),this.dirty=!1)},Object.defineProperty(BitmapText.prototype,"tint",{get:function(){return this._tint},set:function(value){if(this._tint!==value){this._tint=value;for(var i=0;i<this._activePagesMeshData.length;i++)this._activePagesMeshData[i].mesh.tint=value}},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"align",{get:function(){return this._align},set:function(value){this._align!==value&&(this._align=value,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"fontName",{get:function(){return this._fontName},set:function(value){if(!BitmapFont.available[value])throw new Error('Missing BitmapFont "'+value+'"');this._fontName!==value&&(this._fontName=value,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"fontSize",{get:function(){return this._fontSize},set:function(value){this._fontSize!==value&&(this._fontSize=value,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"anchor",{get:function(){return this._anchor},set:function(value){"number"==typeof value?this._anchor.set(value):this._anchor.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"text",{get:function(){return this._text},set:function(text){text=String(null==text?"":text),this._text!==text&&(this._text=text,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(value){this._maxWidth!==value&&(this._maxWidth=value,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"maxLineHeight",{get:function(){return this.validate(),this._maxLineHeight},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"textWidth",{get:function(){return this.validate(),this._textWidth},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(value){this._letterSpacing!==value&&(this._letterSpacing=value,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(value){value!==this._roundPixels&&(this._roundPixels=value,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"textHeight",{get:function(){return this.validate(),this._textHeight},enumerable:!1,configurable:!0}),BitmapText.prototype._upgradeStyle=function(style){if("string"==typeof style.font){var valueSplit=style.font.split(" ");style.fontName=1===valueSplit.length?valueSplit[0]:valueSplit.slice(1).join(" "),valueSplit.length>=2&&(style.fontSize=parseInt(valueSplit[0],10))}else style.fontName=style.font.name,style.fontSize="number"==typeof style.font.size?style.font.size:parseInt(style.font.size,10)},BitmapText.prototype.destroy=function(options){var _textureCache=this._textureCache;for(var id in _textureCache){_textureCache[id].destroy(),delete _textureCache[id]}this._textureCache=null,_super.prototype.destroy.call(this,options)},BitmapText.registerFont=function(data,textures){return deprecation("5.3.0","PIXI.BitmapText.registerFont is deprecated, use PIXI.BitmapFont.install"),BitmapFont.install(data,textures)},Object.defineProperty(BitmapText,"fonts",{get:function(){return deprecation("5.3.0","PIXI.BitmapText.fonts is deprecated, use PIXI.BitmapFont.available"),BitmapFont.available},enumerable:!1,configurable:!0}),BitmapText.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0}}(Container);var BitmapFontLoader=function(){function BitmapFontLoader(){}return BitmapFontLoader.add=function(){LoaderResource.setExtensionXhrType("fnt",LoaderResource.XHR_RESPONSE_TYPE.TEXT)},BitmapFontLoader.use=function(resource,next){var format=autoDetectFormat(resource.data);if(format)for(var baseUrl=BitmapFontLoader.getBaseUrl(this,resource),data=format.parse(resource.data),textures={},completed=function(page){textures[page.metadata.pageFile]=page.texture,Object.keys(textures).length===data.page.length&&(resource.bitmapFont=BitmapFont.install(data,textures,!0),next())},i=0;i<data.page.length;++i){var pageFile=data.page[i].file,url=baseUrl+pageFile,exists=!1;for(var name in this.resources){var bitmapResource=this.resources[name];if(bitmapResource.url===url){bitmapResource.metadata.pageFile=pageFile,bitmapResource.texture?completed(bitmapResource):bitmapResource.onAfterMiddleware.add(completed),exists=!0;break}}if(!exists){var options={crossOrigin:resource.crossOrigin,loadType:LoaderResource.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:pageFile},resource.metadata.imageMetadata),parentResource:resource};this.add(url,options,completed)}}else next()},BitmapFontLoader.getBaseUrl=function(loader,resource){var resUrl=resource.isDataUrl?"":BitmapFontLoader.dirname(resource.url);return resource.isDataUrl&&("."===resUrl&&(resUrl=""),loader.baseUrl&&resUrl&&"/"===loader.baseUrl.charAt(loader.baseUrl.length-1)&&(resUrl+="/")),(resUrl=resUrl.replace(loader.baseUrl,""))&&"/"!==resUrl.charAt(resUrl.length-1)&&(resUrl+="/"),resUrl},BitmapFontLoader.dirname=function(url){var dir=url.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return dir===url?".":""===dir?"/":dir},BitmapFontLoader}(),extendStatics$d=function(d,b){return(extendStatics$d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};
|
|
178
|
+
*/function __extends$b(d,b){function __(){this.constructor=d}extendStatics$b(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var tempPoint$1=new Point;!function(_super){function TilingSprite(texture,width,height){void 0===width&&(width=100),void 0===height&&(height=100);var _this=_super.call(this,texture)||this;return _this.tileTransform=new Transform,_this._width=width,_this._height=height,_this.uvMatrix=_this.texture.uvMatrix||new TextureMatrix(texture),_this.pluginName="tilingSprite",_this.uvRespectAnchor=!1,_this}__extends$b(TilingSprite,_super),Object.defineProperty(TilingSprite.prototype,"clampMargin",{get:function(){return this.uvMatrix.clampMargin},set:function(value){this.uvMatrix.clampMargin=value,this.uvMatrix.update(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(TilingSprite.prototype,"tileScale",{get:function(){return this.tileTransform.scale},set:function(value){this.tileTransform.scale.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(TilingSprite.prototype,"tilePosition",{get:function(){return this.tileTransform.position},set:function(value){this.tileTransform.position.copyFrom(value)},enumerable:!1,configurable:!0}),TilingSprite.prototype._onTextureUpdate=function(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215},TilingSprite.prototype._render=function(renderer){var texture=this._texture;texture&&texture.valid&&(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]),renderer.plugins[this.pluginName].render(this))},TilingSprite.prototype._calculateBounds=function(){var minX=this._width*-this._anchor._x,minY=this._height*-this._anchor._y,maxX=this._width*(1-this._anchor._x),maxY=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,minX,minY,maxX,maxY)},TilingSprite.prototype.getLocalBounds=function(rect){return 0===this.children.length?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),rect||(this._localBoundsRect||(this._localBoundsRect=new Rectangle),rect=this._localBoundsRect),this._bounds.getRectangle(rect)):_super.prototype.getLocalBounds.call(this,rect)},TilingSprite.prototype.containsPoint=function(point){this.worldTransform.applyInverse(point,tempPoint$1);var width=this._width,height=this._height,x1=-width*this.anchor._x;if(tempPoint$1.x>=x1&&tempPoint$1.x<x1+width){var y1=-height*this.anchor._y;if(tempPoint$1.y>=y1&&tempPoint$1.y<y1+height)return!0}return!1},TilingSprite.prototype.destroy=function(options){_super.prototype.destroy.call(this,options),this.tileTransform=null,this.uvMatrix=null},TilingSprite.from=function(source,options){return new TilingSprite(source instanceof Texture?source:Texture.from(source,options),options.width,options.height)},Object.defineProperty(TilingSprite.prototype,"width",{get:function(){return this._width},set:function(value){this._width=value},enumerable:!1,configurable:!0}),Object.defineProperty(TilingSprite.prototype,"height",{get:function(){return this._height},set:function(value){this._height=value},enumerable:!1,configurable:!0})}(Sprite);var gl1VertexSrc="#version 100\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n",tempMat$1=new Matrix,TilingSpriteRenderer=function(_super){function TilingSpriteRenderer(renderer){var _this=_super.call(this,renderer)||this;return renderer.runners.contextChange.add(_this),_this.quad=new QuadUv,_this.state=State.for2d(),_this}return __extends$b(TilingSpriteRenderer,_super),TilingSpriteRenderer.prototype.contextChange=function(){var renderer=this.renderer,uniforms={globals:renderer.globalUniforms};this.simpleShader=Shader.from(gl1VertexSrc,"#version 100\n#define SHADER_NAME Tiling-Sprite-Simple-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 texSample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = texSample * uColor;\n}\n",uniforms),this.shader=renderer.context.webGLVersion>1?Shader.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n",uniforms):Shader.from(gl1VertexSrc,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n",uniforms)},TilingSpriteRenderer.prototype.render=function(ts){var renderer=this.renderer,quad=this.quad,vertices=quad.vertices;vertices[0]=vertices[6]=ts._width*-ts.anchor.x,vertices[1]=vertices[3]=ts._height*-ts.anchor.y,vertices[2]=vertices[4]=ts._width*(1-ts.anchor.x),vertices[5]=vertices[7]=ts._height*(1-ts.anchor.y);var anchorX=ts.uvRespectAnchor?ts.anchor.x:0,anchorY=ts.uvRespectAnchor?ts.anchor.y:0;(vertices=quad.uvs)[0]=vertices[6]=-anchorX,vertices[1]=vertices[3]=-anchorY,vertices[2]=vertices[4]=1-anchorX,vertices[5]=vertices[7]=1-anchorY,quad.invalidate();var tex=ts._texture,baseTex=tex.baseTexture,lt=ts.tileTransform.localTransform,uv=ts.uvMatrix,isSimple=baseTex.isPowerOfTwo&&tex.frame.width===baseTex.width&&tex.frame.height===baseTex.height;isSimple&&(baseTex._glTextures[renderer.CONTEXT_UID]?isSimple=baseTex.wrapMode!==WRAP_MODES$1.CLAMP:baseTex.wrapMode===WRAP_MODES$1.CLAMP&&(baseTex.wrapMode=WRAP_MODES$1.REPEAT));var shader=isSimple?this.simpleShader:this.shader,w=tex.width,h=tex.height,W=ts._width,H=ts._height;tempMat$1.set(lt.a*w/W,lt.b*w/H,lt.c*h/W,lt.d*h/H,lt.tx/W,lt.ty/H),tempMat$1.invert(),isSimple?tempMat$1.prepend(uv.mapCoord):(shader.uniforms.uMapCoord=uv.mapCoord.toArray(!0),shader.uniforms.uClampFrame=uv.uClampFrame,shader.uniforms.uClampOffset=uv.uClampOffset),shader.uniforms.uTransform=tempMat$1.toArray(!0),shader.uniforms.uColor=premultiplyTintToRgba(ts.tint,ts.worldAlpha,shader.uniforms.uColor,baseTex.alphaMode),shader.uniforms.translationMatrix=ts.transform.worldTransform.toArray(!0),shader.uniforms.uSampler=tex,renderer.shader.bind(shader),renderer.geometry.bind(quad),this.state.blendMode=correctBlendMode(ts.blendMode,baseTex.alphaMode),renderer.state.set(this.state),renderer.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},TilingSpriteRenderer}(ObjectRenderer),extendStatics$c=function(d,b){return extendStatics$c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$c(d,b)};function __extends$c(d,b){function __(){this.constructor=d}extendStatics$c(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var MeshBatchUvs=function(){function MeshBatchUvs(uvBuffer,uvMatrix){this.uvBuffer=uvBuffer,this.uvMatrix=uvMatrix,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return MeshBatchUvs.prototype.update=function(forceUpdate){if(forceUpdate||this._bufferUpdateId!==this.uvBuffer._updateID||this._textureUpdateId!==this.uvMatrix._updateID){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var data=this.uvBuffer.data;this.data&&this.data.length===data.length||(this.data=new Float32Array(data.length)),this.uvMatrix.multiplyUvs(data,this.data),this._updateID++}},MeshBatchUvs}(),tempPoint$2=new Point,tempPolygon=new Polygon,Mesh=function(_super){function Mesh(geometry,shader,state,drawMode){void 0===drawMode&&(drawMode=DRAW_MODES$1.TRIANGLES);var _this=_super.call(this)||this;return _this.geometry=geometry,_this.shader=shader,_this.state=state||State.for2d(),_this.drawMode=drawMode,_this.start=0,_this.size=0,_this.uvs=null,_this.indices=null,_this.vertexData=new Float32Array(1),_this.vertexDirty=-1,_this._transformID=-1,_this._roundPixels=settings.ROUND_PIXELS,_this.batchUvs=null,_this}return __extends$c(Mesh,_super),Object.defineProperty(Mesh.prototype,"geometry",{get:function(){return this._geometry},set:function(value){this._geometry!==value&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=value,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(Mesh.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(Mesh.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(Mesh.prototype,"material",{get:function(){return this.shader},set:function(value){this.shader=value},enumerable:!1,configurable:!0}),Object.defineProperty(Mesh.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(value){this.state.blendMode=value},enumerable:!1,configurable:!0}),Object.defineProperty(Mesh.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(value){this._roundPixels!==value&&(this._transformID=-1),this._roundPixels=value},enumerable:!1,configurable:!0}),Object.defineProperty(Mesh.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(value){this.shader.tint=value},enumerable:!1,configurable:!0}),Object.defineProperty(Mesh.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(value){this.shader.texture=value},enumerable:!1,configurable:!0}),Mesh.prototype._render=function(renderer){var vertices=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===DRAW_MODES$1.TRIANGLES&&vertices.length<2*Mesh.BATCHABLE_SIZE?this._renderToBatch(renderer):this._renderDefault(renderer)},Mesh.prototype._renderDefault=function(renderer){var shader=this.shader;shader.alpha=this.worldAlpha,shader.update&&shader.update(),renderer.batch.flush(),shader.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),renderer.shader.bind(shader),renderer.state.set(this.state),renderer.geometry.bind(this.geometry,shader),renderer.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},Mesh.prototype._renderToBatch=function(renderer){var geometry=this.geometry,shader=this.shader;shader.uvMatrix&&(shader.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=geometry.indexBuffer.data,this._tintRGB=shader._tintRGB,this._texture=shader.texture;var pluginName=this.material.pluginName;renderer.batch.setObjectRenderer(renderer.plugins[pluginName]),renderer.plugins[pluginName].render(this)},Mesh.prototype.calculateVertices=function(){var verticesBuffer=this.geometry.buffers[0],vertices=verticesBuffer.data,vertexDirtyId=verticesBuffer._updateID;if(vertexDirtyId!==this.vertexDirty||this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID,this.vertexData.length!==vertices.length&&(this.vertexData=new Float32Array(vertices.length));for(var wt=this.transform.worldTransform,a=wt.a,b=wt.b,c=wt.c,d=wt.d,tx=wt.tx,ty=wt.ty,vertexData=this.vertexData,i=0;i<vertexData.length/2;i++){var x=vertices[2*i],y=vertices[2*i+1];vertexData[2*i]=a*x+c*y+tx,vertexData[2*i+1]=b*x+d*y+ty}if(this._roundPixels){var resolution=settings.RESOLUTION;for(i=0;i<vertexData.length;++i)vertexData[i]=Math.round((vertexData[i]*resolution|0)/resolution)}this.vertexDirty=vertexDirtyId}},Mesh.prototype.calculateUvs=function(){var geomUvs=this.geometry.buffers[1],shader=this.shader;shader.uvMatrix.isSimple?this.uvs=geomUvs.data:(this.batchUvs||(this.batchUvs=new MeshBatchUvs(geomUvs,shader.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)},Mesh.prototype._calculateBounds=function(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)},Mesh.prototype.containsPoint=function(point){if(!this.getBounds().contains(point.x,point.y))return!1;this.worldTransform.applyInverse(point,tempPoint$2);for(var vertices=this.geometry.getBuffer("aVertexPosition").data,points=tempPolygon.points,indices=this.geometry.getIndex().data,len=indices.length,step=4===this.drawMode?3:1,i=0;i+2<len;i+=step){var ind0=2*indices[i],ind1=2*indices[i+1],ind2=2*indices[i+2];if(points[0]=vertices[ind0],points[1]=vertices[ind0+1],points[2]=vertices[ind1],points[3]=vertices[ind1+1],points[4]=vertices[ind2],points[5]=vertices[ind2+1],tempPolygon.contains(tempPoint$2.x,tempPoint$2.y))return!0}return!1},Mesh.prototype.destroy=function(options){_super.prototype.destroy.call(this,options),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null},Mesh.BATCHABLE_SIZE=100,Mesh}(Container),MeshMaterial=function(_super){function MeshMaterial(uSampler,options){var _this=this,uniforms={uSampler:uSampler,alpha:1,uTextureMatrix:Matrix.IDENTITY,uColor:new Float32Array([1,1,1,1])};return(options=Object.assign({tint:16777215,alpha:1,pluginName:"batch"},options)).uniforms&&Object.assign(uniforms,options.uniforms),(_this=_super.call(this,options.program||Program.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n","varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"),uniforms)||this)._colorDirty=!1,_this.uvMatrix=new TextureMatrix(uSampler),_this.batchable=void 0===options.program,_this.pluginName=options.pluginName,_this.tint=options.tint,_this.alpha=options.alpha,_this}return __extends$c(MeshMaterial,_super),Object.defineProperty(MeshMaterial.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(value){this.uniforms.uSampler!==value&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!value.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=value,this.uvMatrix.texture=value)},enumerable:!1,configurable:!0}),Object.defineProperty(MeshMaterial.prototype,"alpha",{get:function(){return this._alpha},set:function(value){value!==this._alpha&&(this._alpha=value,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(MeshMaterial.prototype,"tint",{get:function(){return this._tint},set:function(value){value!==this._tint&&(this._tint=value,this._tintRGB=(value>>16)+(65280&value)+((255&value)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),MeshMaterial.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var baseTexture=this.texture.baseTexture;premultiplyTintToRgba(this._tint,this._alpha,this.uniforms.uColor,baseTexture.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},MeshMaterial}(Shader),MeshGeometry=function(_super){function MeshGeometry(vertices,uvs,index){var _this=_super.call(this)||this,verticesBuffer=new Buffer(vertices),uvsBuffer=new Buffer(uvs,!0),indexBuffer=new Buffer(index,!0,!0);return _this.addAttribute("aVertexPosition",verticesBuffer,2,!1,TYPES$1.FLOAT).addAttribute("aTextureCoord",uvsBuffer,2,!1,TYPES$1.FLOAT).addIndex(indexBuffer),_this._updateId=-1,_this}return __extends$c(MeshGeometry,_super),Object.defineProperty(MeshGeometry.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),MeshGeometry}(Geometry),extendStatics$d=function(d,b){return extendStatics$d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$d(d,b)};var BitmapFontData=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]},TextFormat=function(){function TextFormat(){}return TextFormat.test=function(data){return"string"==typeof data&&0===data.indexOf("info face=")},TextFormat.parse=function(txt){var items=txt.match(/^[a-z]+\s+.+$/gm),rawData={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(var i in items){var name=items[i].match(/^[a-z]+/gm)[0],attributeList=items[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),itemData={};for(var i_1 in attributeList){var split=attributeList[i_1].split("="),key=split[0],strValue=split[1].replace(/"/gm,""),floatValue=parseFloat(strValue),value=isNaN(floatValue)?strValue:floatValue;itemData[key]=value}rawData[name].push(itemData)}var font=new BitmapFontData;return rawData.info.forEach((function(info){return font.info.push({face:info.face,size:parseInt(info.size,10)})})),rawData.common.forEach((function(common){return font.common.push({lineHeight:parseInt(common.lineHeight,10)})})),rawData.page.forEach((function(page){return font.page.push({id:parseInt(page.id,10),file:page.file})})),rawData.char.forEach((function(char){return font.char.push({id:parseInt(char.id,10),page:parseInt(char.page,10),x:parseInt(char.x,10),y:parseInt(char.y,10),width:parseInt(char.width,10),height:parseInt(char.height,10),xoffset:parseInt(char.xoffset,10),yoffset:parseInt(char.yoffset,10),xadvance:parseInt(char.xadvance,10)})})),rawData.kerning.forEach((function(kerning){return font.kerning.push({first:parseInt(kerning.first,10),second:parseInt(kerning.second,10),amount:parseInt(kerning.amount,10)})})),rawData.distanceField.forEach((function(df){return font.distanceField.push({distanceRange:parseInt(df.distanceRange,10),fieldType:df.fieldType})})),font},TextFormat}(),XMLFormat=function(){function XMLFormat(){}return XMLFormat.test=function(data){return data instanceof XMLDocument&&data.getElementsByTagName("page").length&&null!==data.getElementsByTagName("info")[0].getAttribute("face")},XMLFormat.parse=function(xml){for(var data=new BitmapFontData,info=xml.getElementsByTagName("info"),common=xml.getElementsByTagName("common"),page=xml.getElementsByTagName("page"),char=xml.getElementsByTagName("char"),kerning=xml.getElementsByTagName("kerning"),distanceField=xml.getElementsByTagName("distanceField"),i=0;i<info.length;i++)data.info.push({face:info[i].getAttribute("face"),size:parseInt(info[i].getAttribute("size"),10)});for(i=0;i<common.length;i++)data.common.push({lineHeight:parseInt(common[i].getAttribute("lineHeight"),10)});for(i=0;i<page.length;i++)data.page.push({id:parseInt(page[i].getAttribute("id"),10)||0,file:page[i].getAttribute("file")});for(i=0;i<char.length;i++){var letter=char[i];data.char.push({id:parseInt(letter.getAttribute("id"),10),page:parseInt(letter.getAttribute("page"),10)||0,x:parseInt(letter.getAttribute("x"),10),y:parseInt(letter.getAttribute("y"),10),width:parseInt(letter.getAttribute("width"),10),height:parseInt(letter.getAttribute("height"),10),xoffset:parseInt(letter.getAttribute("xoffset"),10),yoffset:parseInt(letter.getAttribute("yoffset"),10),xadvance:parseInt(letter.getAttribute("xadvance"),10)})}for(i=0;i<kerning.length;i++)data.kerning.push({first:parseInt(kerning[i].getAttribute("first"),10),second:parseInt(kerning[i].getAttribute("second"),10),amount:parseInt(kerning[i].getAttribute("amount"),10)});for(i=0;i<distanceField.length;i++)data.distanceField.push({fieldType:distanceField[i].getAttribute("fieldType"),distanceRange:parseInt(distanceField[i].getAttribute("distanceRange"),10)});return data},XMLFormat}(),XMLStringFormat=function(){function XMLStringFormat(){}return XMLStringFormat.test=function(data){if("string"==typeof data&&data.indexOf("<font>")>-1){var xml=(new globalThis.DOMParser).parseFromString(data,"text/xml");return XMLFormat.test(xml)}return!1},XMLStringFormat.parse=function(xmlTxt){var xml=(new globalThis.DOMParser).parseFromString(xmlTxt,"text/xml");return XMLFormat.parse(xml)},XMLStringFormat}(),formats=[TextFormat,XMLFormat,XMLStringFormat];function autoDetectFormat(data){for(var i=0;i<formats.length;i++)if(formats[i].test(data))return formats[i];return null}function drawGlyph(canvas,context,metrics,x,y,resolution,style){var char=metrics.text,fontProperties=metrics.fontProperties;context.translate(x,y),context.scale(resolution,resolution);var tx=style.strokeThickness/2,ty=-style.strokeThickness/2;if(context.font=style.toFontString(),context.lineWidth=style.strokeThickness,context.textBaseline=style.textBaseline,context.lineJoin=style.lineJoin,context.miterLimit=style.miterLimit,context.fillStyle=function(canvas,context,style,resolution,lines,metrics){var gradient,fillStyle=style.fill;if(!Array.isArray(fillStyle))return fillStyle;if(1===fillStyle.length)return fillStyle[0];var dropShadowCorrection=style.dropShadow?style.dropShadowDistance:0,padding=style.padding||0,width=canvas.width/resolution-dropShadowCorrection-2*padding,height=canvas.height/resolution-dropShadowCorrection-2*padding,fill=fillStyle.slice(),fillGradientStops=style.fillGradientStops.slice();if(!fillGradientStops.length)for(var lengthPlus1=fill.length+1,i=1;i<lengthPlus1;++i)fillGradientStops.push(i/lengthPlus1);if(fill.unshift(fillStyle[0]),fillGradientStops.unshift(0),fill.push(fillStyle[fillStyle.length-1]),fillGradientStops.push(1),style.fillGradientType===TEXT_GRADIENT.LINEAR_VERTICAL){gradient=context.createLinearGradient(width/2,padding,width/2,height+padding);var lastIterationStop=0,gradStopLineHeight=(metrics.fontProperties.fontSize+style.strokeThickness)/height;for(i=0;i<lines.length;i++)for(var thisLineTop=metrics.lineHeight*i,j=0;j<fill.length;j++){var globalStop=thisLineTop/height+("number"==typeof fillGradientStops[j]?fillGradientStops[j]:j/fill.length)*gradStopLineHeight,clampedStop=Math.max(lastIterationStop,globalStop);clampedStop=Math.min(clampedStop,1),gradient.addColorStop(clampedStop,fill[j]),lastIterationStop=clampedStop}}else{gradient=context.createLinearGradient(padding,height/2,width+padding,height/2);var totalIterations=fill.length+1,currentIteration=1;for(i=0;i<fill.length;i++){var stop=void 0;stop="number"==typeof fillGradientStops[i]?fillGradientStops[i]:currentIteration/totalIterations,gradient.addColorStop(stop,fill[i]),currentIteration++}}return gradient}(canvas,context,style,resolution,[char],metrics),context.strokeStyle=style.stroke,style.dropShadow){var dropShadowColor=style.dropShadowColor,rgb=hex2rgb("number"==typeof dropShadowColor?dropShadowColor:string2hex(dropShadowColor)),dropShadowBlur=style.dropShadowBlur*resolution,dropShadowDistance=style.dropShadowDistance*resolution;context.shadowColor="rgba("+255*rgb[0]+","+255*rgb[1]+","+255*rgb[2]+","+style.dropShadowAlpha+")",context.shadowBlur=dropShadowBlur,context.shadowOffsetX=Math.cos(style.dropShadowAngle)*dropShadowDistance,context.shadowOffsetY=Math.sin(style.dropShadowAngle)*dropShadowDistance}else context.shadowColor="black",context.shadowBlur=0,context.shadowOffsetX=0,context.shadowOffsetY=0;style.stroke&&style.strokeThickness&&context.strokeText(char,tx,ty+metrics.lineHeight-fontProperties.descent),style.fill&&context.fillText(char,tx,ty+metrics.lineHeight-fontProperties.descent),context.setTransform(1,0,0,1,0,0),context.fillStyle="rgba(0, 0, 0, 0)"}function splitTextToCharacters(text){return Array.from?Array.from(text):text.split("")}function extractCharCode(str){return str.codePointAt?str.codePointAt(0):str.charCodeAt(0)}var BitmapFont=function(){function BitmapFont(data,textures,ownsTextures){var _a,_b,info=data.info[0],common=data.common[0],page=data.page[0],distanceField=data.distanceField[0],res=getResolutionOfUrl(page.file),pageTextures={};this._ownsTextures=ownsTextures,this.font=info.face,this.size=info.size,this.lineHeight=common.lineHeight/res,this.chars={},this.pageTextures=pageTextures;for(var i=0;i<data.page.length;i++){var _c=data.page[i],id=_c.id,file=_c.file;pageTextures[id]=textures instanceof Array?textures[i]:textures[file],(null==distanceField?void 0:distanceField.fieldType)&&"none"!==distanceField.fieldType&&(pageTextures[id].baseTexture.alphaMode=ALPHA_MODES$1.NO_PREMULTIPLIED_ALPHA)}for(i=0;i<data.char.length;i++){var _d=data.char[i],page_1=(id=_d.id,_d.page),_e=data.char[i],x=_e.x,y=_e.y,width=_e.width,height=_e.height,xoffset=_e.xoffset,yoffset=_e.yoffset,xadvance=_e.xadvance;y/=res,width/=res,height/=res,xoffset/=res,yoffset/=res,xadvance/=res;var rect=new Rectangle((x/=res)+pageTextures[page_1].frame.x/res,y+pageTextures[page_1].frame.y/res,width,height);this.chars[id]={xOffset:xoffset,yOffset:yoffset,xAdvance:xadvance,kerning:{},texture:new Texture(pageTextures[page_1].baseTexture,rect),page:page_1}}for(i=0;i<data.kerning.length;i++){var _f=data.kerning[i],first=_f.first,second=_f.second,amount=_f.amount;first/=res,second/=res,amount/=res,this.chars[second]&&(this.chars[second].kerning[first]=amount)}this.distanceFieldRange=null==distanceField?void 0:distanceField.distanceRange,this.distanceFieldType=null!==(_b=null===(_a=null==distanceField?void 0:distanceField.fieldType)||void 0===_a?void 0:_a.toLowerCase())&&void 0!==_b?_b:"none"}return BitmapFont.prototype.destroy=function(){for(var id in this.chars)this.chars[id].texture.destroy(),this.chars[id].texture=null;for(var id in this.pageTextures)this._ownsTextures&&this.pageTextures[id].destroy(!0),this.pageTextures[id]=null;this.chars=null,this.pageTextures=null},BitmapFont.install=function(data,textures,ownsTextures){var fontData;if(data instanceof BitmapFontData)fontData=data;else{var format=autoDetectFormat(data);if(!format)throw new Error("Unrecognized data format for font.");fontData=format.parse(data)}textures instanceof Texture&&(textures=[textures]);var font=new BitmapFont(fontData,textures,ownsTextures);return BitmapFont.available[font.font]=font,font},BitmapFont.uninstall=function(name){var font=BitmapFont.available[name];if(!font)throw new Error("No font found named '"+name+"'");font.destroy(),delete BitmapFont.available[name]},BitmapFont.from=function(name,textStyle,options){if(!name)throw new Error("[BitmapFont] Property `name` is required.");var _a=Object.assign({},BitmapFont.defaultOptions,options),chars=_a.chars,padding=_a.padding,resolution=_a.resolution,textureWidth=_a.textureWidth,textureHeight=_a.textureHeight,charsList=function(chars){"string"==typeof chars&&(chars=[chars]);for(var result=[],i=0,j=chars.length;i<j;i++){var item=chars[i];if(Array.isArray(item)){if(2!==item.length)throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got "+item.length+".");var startCode=item[0].charCodeAt(0),endCode=item[1].charCodeAt(0);if(endCode<startCode)throw new Error("[BitmapFont]: Invalid character range.");for(var i_1=startCode,j_1=endCode;i_1<=j_1;i_1++)result.push(String.fromCharCode(i_1))}else result.push.apply(result,splitTextToCharacters(item))}if(0===result.length)throw new Error("[BitmapFont]: Empty set when resolving characters.");return result}(chars),style=textStyle instanceof TextStyle?textStyle:new TextStyle(textStyle),lineWidth=textureWidth,fontData=new BitmapFontData;fontData.info[0]={face:style.fontFamily,size:style.fontSize},fontData.common[0]={lineHeight:style.fontSize};for(var canvas,context,baseTexture,positionX=0,positionY=0,maxCharHeight=0,textures=[],i=0;i<charsList.length;i++){canvas||((canvas=document.createElement("canvas")).width=textureWidth,canvas.height=textureHeight,context=canvas.getContext("2d"),baseTexture=new BaseTexture(canvas,{resolution:resolution}),textures.push(new Texture(baseTexture)),fontData.page.push({id:textures.length-1,file:""}));var metrics=TextMetrics.measureText(charsList[i],style,!1,canvas),width=metrics.width,height=Math.ceil(metrics.height),textureGlyphWidth=Math.ceil(("italic"===style.fontStyle?2:1)*width);if(positionY>=textureHeight-height*resolution){if(0===positionY)throw new Error("[BitmapFont] textureHeight "+textureHeight+"px is too small for "+style.fontSize+"px fonts");--i,canvas=null,context=null,baseTexture=null,positionY=0,positionX=0,maxCharHeight=0}else if(maxCharHeight=Math.max(height+metrics.fontProperties.descent,maxCharHeight),textureGlyphWidth*resolution+positionX>=lineWidth)--i,positionY+=maxCharHeight*resolution,positionY=Math.ceil(positionY),positionX=0,maxCharHeight=0;else{drawGlyph(canvas,context,metrics,positionX,positionY,resolution,style);var id=extractCharCode(metrics.text);fontData.char.push({id:id,page:textures.length-1,x:positionX/resolution,y:positionY/resolution,width:textureGlyphWidth,height:height,xoffset:0,yoffset:0,xadvance:Math.ceil(width-(style.dropShadow?style.dropShadowDistance:0)-(style.stroke?style.strokeThickness:0))}),positionX+=(textureGlyphWidth+2*padding)*resolution,positionX=Math.ceil(positionX)}}i=0;for(var len=charsList.length;i<len;i++)for(var first=charsList[i],j=0;j<len;j++){var second=charsList[j],c1=context.measureText(first).width,c2=context.measureText(second).width,amount=context.measureText(first+second).width-(c1+c2);amount&&fontData.kerning.push({first:extractCharCode(first),second:extractCharCode(second),amount:amount})}var font=new BitmapFont(fontData,textures,!0);return void 0!==BitmapFont.available[name]&&BitmapFont.uninstall(name),BitmapFont.available[name]=font,font},BitmapFont.ALPHA=[["a","z"],["A","Z"]," "],BitmapFont.NUMERIC=[["0","9"]],BitmapFont.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],BitmapFont.ASCII=[[" ","~"]],BitmapFont.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:BitmapFont.ALPHANUMERIC},BitmapFont.available={},BitmapFont}(),pageMeshDataDefaultPageMeshData=[],pageMeshDataMSDFPageMeshData=[],charRenderDataPool=[];!function(_super){function BitmapText(text,style){void 0===style&&(style={});var _this=_super.call(this)||this;_this._tint=16777215;var _a=Object.assign({},BitmapText.styleDefaults,style),align=_a.align,tint=_a.tint,maxWidth=_a.maxWidth,letterSpacing=_a.letterSpacing,fontName=_a.fontName,fontSize=_a.fontSize;if(!BitmapFont.available[fontName])throw new Error('Missing BitmapFont "'+fontName+'"');return _this._activePagesMeshData=[],_this._textWidth=0,_this._textHeight=0,_this._align=align,_this._tint=tint,_this._fontName=fontName,_this._fontSize=fontSize||BitmapFont.available[fontName].size,_this.text=text,_this._maxWidth=maxWidth,_this._maxLineHeight=0,_this._letterSpacing=letterSpacing,_this._anchor=new ObservablePoint((function(){_this.dirty=!0}),_this,0,0),_this._roundPixels=settings.ROUND_PIXELS,_this.dirty=!0,_this._resolution=settings.RESOLUTION,_this._autoResolution=!0,_this._textureCache={},_this}(function(d,b){function __(){this.constructor=d}extendStatics$d(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)})(BitmapText,_super),BitmapText.prototype.updateText=function(){for(var _a,data=BitmapFont.available[this._fontName],scale=this._fontSize/data.size,pos=new Point,chars=[],lineWidths=[],lineSpaces=[],charsInput=splitTextToCharacters(this._text.replace(/(?:\r\n|\r)/g,"\n")||" "),maxWidth=this._maxWidth*data.size/this._fontSize,pageMeshDataPool="none"===data.distanceFieldType?pageMeshDataDefaultPageMeshData:pageMeshDataMSDFPageMeshData,prevCharCode=null,lastLineWidth=0,maxLineWidth=0,line=0,lastBreakPos=-1,lastBreakWidth=0,spacesRemoved=0,maxLineHeight=0,spaceCount=0,i=0;i<charsInput.length;i++){var charCode=extractCharCode(char=charsInput[i]);if(/(?:\s)/.test(char)&&(lastBreakPos=i,lastBreakWidth=lastLineWidth,spaceCount++),"\r"!==char&&"\n"!==char){var charData=data.chars[charCode];if(charData){prevCharCode&&charData.kerning[prevCharCode]&&(pos.x+=charData.kerning[prevCharCode]);var charRenderData=charRenderDataPool.pop()||{texture:Texture.EMPTY,line:0,charCode:0,prevSpaces:0,position:new Point};charRenderData.texture=charData.texture,charRenderData.line=line,charRenderData.charCode=charCode,charRenderData.position.x=pos.x+charData.xOffset+this._letterSpacing/2,charRenderData.position.y=pos.y+charData.yOffset,charRenderData.prevSpaces=spaceCount,chars.push(charRenderData),lastLineWidth=charRenderData.position.x+Math.max(charData.xAdvance,charData.texture.orig.width),pos.x+=charData.xAdvance+this._letterSpacing,maxLineHeight=Math.max(maxLineHeight,charData.yOffset+charData.texture.height),prevCharCode=charCode,-1!==lastBreakPos&&maxWidth>0&&pos.x>maxWidth&&(removeItems(chars,1+lastBreakPos-++spacesRemoved,1+i-lastBreakPos),i=lastBreakPos,lastBreakPos=-1,lineWidths.push(lastBreakWidth),lineSpaces.push(chars.length>0?chars[chars.length-1].prevSpaces:0),maxLineWidth=Math.max(maxLineWidth,lastBreakWidth),line++,pos.x=0,pos.y+=data.lineHeight,prevCharCode=null,spaceCount=0)}}else lineWidths.push(lastLineWidth),lineSpaces.push(-1),maxLineWidth=Math.max(maxLineWidth,lastLineWidth),++line,++spacesRemoved,pos.x=0,pos.y+=data.lineHeight,prevCharCode=null,spaceCount=0}var lastChar=charsInput[charsInput.length-1];"\r"!==lastChar&&"\n"!==lastChar&&(/(?:\s)/.test(lastChar)&&(lastLineWidth=lastBreakWidth),lineWidths.push(lastLineWidth),maxLineWidth=Math.max(maxLineWidth,lastLineWidth),lineSpaces.push(-1));var lineAlignOffsets=[];for(i=0;i<=line;i++){var alignOffset=0;"right"===this._align?alignOffset=maxLineWidth-lineWidths[i]:"center"===this._align?alignOffset=(maxLineWidth-lineWidths[i])/2:"justify"===this._align&&(alignOffset=lineSpaces[i]<0?0:(maxLineWidth-lineWidths[i])/lineSpaces[i]),lineAlignOffsets.push(alignOffset)}var lenChars=chars.length,pagesMeshData={},newPagesMeshData=[],activePagesMeshData=this._activePagesMeshData;for(i=0;i<activePagesMeshData.length;i++)pageMeshDataPool.push(activePagesMeshData[i]);for(i=0;i<lenChars;i++){var baseTextureUid=(texture=chars[i].texture).baseTexture.uid;if(!pagesMeshData[baseTextureUid]){if(!(pageMeshData=pageMeshDataPool.pop())){var geometry=new MeshGeometry,material=void 0,meshBlendMode=void 0;"none"===data.distanceFieldType?(material=new MeshMaterial(Texture.EMPTY),meshBlendMode=BLEND_MODES$1.NORMAL):(material=new MeshMaterial(Texture.EMPTY,{program:Program.from("// Mesh material default fragment\r\nattribute vec2 aVertexPosition;\r\nattribute vec2 aTextureCoord;\r\n\r\nuniform mat3 projectionMatrix;\r\nuniform mat3 translationMatrix;\r\nuniform mat3 uTextureMatrix;\r\n\r\nvarying vec2 vTextureCoord;\r\n\r\nvoid main(void)\r\n{\r\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r\n\r\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r\n}\r\n","// Pixi texture info\r\nvarying vec2 vTextureCoord;\r\nuniform sampler2D uSampler;\r\n\r\n// Tint\r\nuniform vec4 uColor;\r\n\r\n// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r\nuniform float uFWidth;\r\n\r\nvoid main(void) {\r\n\r\n // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r\n vec4 texColor = texture2D(uSampler, vTextureCoord);\r\n\r\n // MSDF\r\n float median = texColor.r + texColor.g + texColor.b -\r\n min(texColor.r, min(texColor.g, texColor.b)) -\r\n max(texColor.r, max(texColor.g, texColor.b));\r\n // SDF\r\n median = min(median, texColor.a);\r\n\r\n float screenPxDistance = uFWidth * (median - 0.5);\r\n float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r\n\r\n}\r\n"),uniforms:{uFWidth:0}}),meshBlendMode=BLEND_MODES$1.NORMAL_NPM);var mesh=new Mesh(geometry,material);mesh.blendMode=meshBlendMode,pageMeshData={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:mesh,vertices:null,uvs:null,indices:null}}pageMeshData.index=0,pageMeshData.indexCount=0,pageMeshData.vertexCount=0,pageMeshData.uvsCount=0,pageMeshData.total=0;var _textureCache=this._textureCache;_textureCache[baseTextureUid]=_textureCache[baseTextureUid]||new Texture(texture.baseTexture),pageMeshData.mesh.texture=_textureCache[baseTextureUid],pageMeshData.mesh.tint=this._tint,newPagesMeshData.push(pageMeshData),pagesMeshData[baseTextureUid]=pageMeshData}pagesMeshData[baseTextureUid].total++}for(i=0;i<activePagesMeshData.length;i++)-1===newPagesMeshData.indexOf(activePagesMeshData[i])&&this.removeChild(activePagesMeshData[i].mesh);for(i=0;i<newPagesMeshData.length;i++)newPagesMeshData[i].mesh.parent!==this&&this.addChild(newPagesMeshData[i].mesh);for(var i in this._activePagesMeshData=newPagesMeshData,pagesMeshData){var total=(pageMeshData=pagesMeshData[i]).total;if(!((null===(_a=pageMeshData.indices)||void 0===_a?void 0:_a.length)>6*total)||pageMeshData.vertices.length<2*Mesh.BATCHABLE_SIZE)pageMeshData.vertices=new Float32Array(8*total),pageMeshData.uvs=new Float32Array(8*total),pageMeshData.indices=new Uint16Array(6*total);else for(var total_1=pageMeshData.total,vertices=pageMeshData.vertices,i_1=4*total_1*2;i_1<vertices.length;i_1++)vertices[i_1]=0;pageMeshData.mesh.size=6*total}for(i=0;i<lenChars;i++){var char,offset=(char=chars[i]).position.x+lineAlignOffsets[char.line]*("justify"===this._align?char.prevSpaces:1);this._roundPixels&&(offset=Math.round(offset));var texture,xPos=offset*scale,yPos=char.position.y*scale,pageMesh=pagesMeshData[(texture=char.texture).baseTexture.uid],textureFrame=texture.frame,textureUvs=texture._uvs,index=pageMesh.index++;pageMesh.indices[6*index+0]=0+4*index,pageMesh.indices[6*index+1]=1+4*index,pageMesh.indices[6*index+2]=2+4*index,pageMesh.indices[6*index+3]=0+4*index,pageMesh.indices[6*index+4]=2+4*index,pageMesh.indices[6*index+5]=3+4*index,pageMesh.vertices[8*index+0]=xPos,pageMesh.vertices[8*index+1]=yPos,pageMesh.vertices[8*index+2]=xPos+textureFrame.width*scale,pageMesh.vertices[8*index+3]=yPos,pageMesh.vertices[8*index+4]=xPos+textureFrame.width*scale,pageMesh.vertices[8*index+5]=yPos+textureFrame.height*scale,pageMesh.vertices[8*index+6]=xPos,pageMesh.vertices[8*index+7]=yPos+textureFrame.height*scale,pageMesh.uvs[8*index+0]=textureUvs.x0,pageMesh.uvs[8*index+1]=textureUvs.y0,pageMesh.uvs[8*index+2]=textureUvs.x1,pageMesh.uvs[8*index+3]=textureUvs.y1,pageMesh.uvs[8*index+4]=textureUvs.x2,pageMesh.uvs[8*index+5]=textureUvs.y2,pageMesh.uvs[8*index+6]=textureUvs.x3,pageMesh.uvs[8*index+7]=textureUvs.y3}for(var i in this._textWidth=maxLineWidth*scale,this._textHeight=(pos.y+data.lineHeight)*scale,pagesMeshData){var pageMeshData=pagesMeshData[i];if(0!==this.anchor.x||0!==this.anchor.y)for(var vertexCount=0,anchorOffsetX=this._textWidth*this.anchor.x,anchorOffsetY=this._textHeight*this.anchor.y,i_2=0;i_2<pageMeshData.total;i_2++)pageMeshData.vertices[vertexCount++]-=anchorOffsetX,pageMeshData.vertices[vertexCount++]-=anchorOffsetY,pageMeshData.vertices[vertexCount++]-=anchorOffsetX,pageMeshData.vertices[vertexCount++]-=anchorOffsetY,pageMeshData.vertices[vertexCount++]-=anchorOffsetX,pageMeshData.vertices[vertexCount++]-=anchorOffsetY,pageMeshData.vertices[vertexCount++]-=anchorOffsetX,pageMeshData.vertices[vertexCount++]-=anchorOffsetY;this._maxLineHeight=maxLineHeight*scale;var vertexBuffer=pageMeshData.mesh.geometry.getBuffer("aVertexPosition"),textureBuffer=pageMeshData.mesh.geometry.getBuffer("aTextureCoord"),indexBuffer=pageMeshData.mesh.geometry.getIndex();vertexBuffer.data=pageMeshData.vertices,textureBuffer.data=pageMeshData.uvs,indexBuffer.data=pageMeshData.indices,vertexBuffer.update(),textureBuffer.update(),indexBuffer.update()}for(i=0;i<chars.length;i++)charRenderDataPool.push(chars[i])},BitmapText.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},BitmapText.prototype._render=function(renderer){this._autoResolution&&this._resolution!==renderer.resolution&&(this._resolution=renderer.resolution,this.dirty=!0);var _a=BitmapFont.available[this._fontName],distanceFieldRange=_a.distanceFieldRange,distanceFieldType=_a.distanceFieldType,size=_a.size;if("none"!==distanceFieldType)for(var _b=this.worldTransform,a=_b.a,b=_b.b,c=_b.c,d=_b.d,dx=Math.sqrt(a*a+b*b),dy=Math.sqrt(c*c+d*d),worldScale=(Math.abs(dx)+Math.abs(dy))/2,fontScale=this._fontSize/size,_i=0,_c=this._activePagesMeshData;_i<_c.length;_i++){_c[_i].mesh.shader.uniforms.uFWidth=worldScale*distanceFieldRange*fontScale*this._resolution}_super.prototype._render.call(this,renderer)},BitmapText.prototype.getLocalBounds=function(){return this.validate(),_super.prototype.getLocalBounds.call(this)},BitmapText.prototype.validate=function(){this.dirty&&(this.updateText(),this.dirty=!1)},Object.defineProperty(BitmapText.prototype,"tint",{get:function(){return this._tint},set:function(value){if(this._tint!==value){this._tint=value;for(var i=0;i<this._activePagesMeshData.length;i++)this._activePagesMeshData[i].mesh.tint=value}},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"align",{get:function(){return this._align},set:function(value){this._align!==value&&(this._align=value,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"fontName",{get:function(){return this._fontName},set:function(value){if(!BitmapFont.available[value])throw new Error('Missing BitmapFont "'+value+'"');this._fontName!==value&&(this._fontName=value,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"fontSize",{get:function(){return this._fontSize},set:function(value){this._fontSize!==value&&(this._fontSize=value,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"anchor",{get:function(){return this._anchor},set:function(value){"number"==typeof value?this._anchor.set(value):this._anchor.copyFrom(value)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"text",{get:function(){return this._text},set:function(text){text=String(null==text?"":text),this._text!==text&&(this._text=text,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(value){this._maxWidth!==value&&(this._maxWidth=value,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"maxLineHeight",{get:function(){return this.validate(),this._maxLineHeight},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"textWidth",{get:function(){return this.validate(),this._textWidth},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(value){this._letterSpacing!==value&&(this._letterSpacing=value,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(value){value!==this._roundPixels&&(this._roundPixels=value,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"textHeight",{get:function(){return this.validate(),this._textHeight},enumerable:!1,configurable:!0}),Object.defineProperty(BitmapText.prototype,"resolution",{get:function(){return this._resolution},set:function(value){this._autoResolution=!1,this._resolution!==value&&(this._resolution=value,this.dirty=!0)},enumerable:!1,configurable:!0}),BitmapText.prototype.destroy=function(options){var _textureCache=this._textureCache;for(var id in _textureCache){_textureCache[id].destroy(),delete _textureCache[id]}this._textureCache=null,_super.prototype.destroy.call(this,options)},BitmapText.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0}}(Container);var BitmapFontLoader=function(){function BitmapFontLoader(){}return BitmapFontLoader.add=function(){LoaderResource.setExtensionXhrType("fnt",LoaderResource.XHR_RESPONSE_TYPE.TEXT)},BitmapFontLoader.use=function(resource,next){var format=autoDetectFormat(resource.data);if(format)for(var baseUrl=BitmapFontLoader.getBaseUrl(this,resource),data=format.parse(resource.data),textures={},completed=function(page){textures[page.metadata.pageFile]=page.texture,Object.keys(textures).length===data.page.length&&(resource.bitmapFont=BitmapFont.install(data,textures,!0),next())},i=0;i<data.page.length;++i){var pageFile=data.page[i].file,url=baseUrl+pageFile,exists=!1;for(var name in this.resources){var bitmapResource=this.resources[name];if(bitmapResource.url===url){bitmapResource.metadata.pageFile=pageFile,bitmapResource.texture?completed(bitmapResource):bitmapResource.onAfterMiddleware.add(completed),exists=!0;break}}if(!exists){var options={crossOrigin:resource.crossOrigin,loadType:LoaderResource.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:pageFile},resource.metadata.imageMetadata),parentResource:resource};this.add(url,options,completed)}}else next()},BitmapFontLoader.getBaseUrl=function(loader,resource){var resUrl=resource.isDataUrl?"":BitmapFontLoader.dirname(resource.url);return resource.isDataUrl&&("."===resUrl&&(resUrl=""),loader.baseUrl&&resUrl&&"/"===loader.baseUrl.charAt(loader.baseUrl.length-1)&&(resUrl+="/")),(resUrl=resUrl.replace(loader.baseUrl,""))&&"/"!==resUrl.charAt(resUrl.length-1)&&(resUrl+="/"),resUrl},BitmapFontLoader.dirname=function(url){var dir=url.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return dir===url?".":""===dir?"/":dir},BitmapFontLoader}(),extendStatics$e=function(d,b){return extendStatics$e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$e(d,b)};
|
|
193
179
|
/*!
|
|
194
|
-
* @pixi/filter-alpha -
|
|
195
|
-
* Compiled
|
|
180
|
+
* @pixi/filter-alpha - v6.4.2
|
|
181
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
196
182
|
*
|
|
197
183
|
* @pixi/filter-alpha is licensed under the MIT License.
|
|
198
184
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -210,10 +196,10 @@ var extendStatics$9=function(d,b){return(extendStatics$9=Object.setPrototypeOf||
|
|
|
210
196
|
|
|
211
197
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
212
198
|
and limitations under the License.
|
|
213
|
-
***************************************************************************** */!function(_super){function AlphaFilter(alpha){void 0===alpha&&(alpha=1);var _this=_super.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n",{uAlpha:1})||this;return _this.alpha=alpha,_this}(function(d,b){function __(){this.constructor=d}extendStatics$
|
|
199
|
+
***************************************************************************** */!function(_super){function AlphaFilter(alpha){void 0===alpha&&(alpha=1);var _this=_super.call(this,"attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n",{uAlpha:1})||this;return _this.alpha=alpha,_this}(function(d,b){function __(){this.constructor=d}extendStatics$e(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)})(AlphaFilter,_super),Object.defineProperty(AlphaFilter.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(value){this.uniforms.uAlpha=value},enumerable:!1,configurable:!0})}(Filter);
|
|
214
200
|
/*!
|
|
215
|
-
* @pixi/filter-blur -
|
|
216
|
-
* Compiled
|
|
201
|
+
* @pixi/filter-blur - v6.4.2
|
|
202
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
217
203
|
*
|
|
218
204
|
* @pixi/filter-blur is licensed under the MIT License.
|
|
219
205
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -232,10 +218,17 @@ var extendStatics$9=function(d,b){return(extendStatics$9=Object.setPrototypeOf||
|
|
|
232
218
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
233
219
|
and limitations under the License.
|
|
234
220
|
***************************************************************************** */
|
|
235
|
-
var extendStatics$e=function(d,b){return(extendStatics$e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};function __extends$e(d,b){function __(){this.constructor=d}extendStatics$e(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var ENV$1,RENDERER_TYPE$1,BUFFER_BITS$1,BLEND_MODES$1,DRAW_MODES$1,FORMATS$1,TARGETS$1,TYPES$1,SCALE_MODES$1,WRAP_MODES$1,MIPMAP_MODES$1,ALPHA_MODES$1,CLEAR_MODES$1,GC_MODES$1,PRECISION$1,MASK_TYPES$1,MSAA_QUALITY$1,GAUSSIAN_VALUES={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},fragTemplate$1=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join("\n");!function(ENV){ENV[ENV.WEBGL_LEGACY=0]="WEBGL_LEGACY",ENV[ENV.WEBGL=1]="WEBGL",ENV[ENV.WEBGL2=2]="WEBGL2"}(ENV$1||(ENV$1={})),function(RENDERER_TYPE){RENDERER_TYPE[RENDERER_TYPE.UNKNOWN=0]="UNKNOWN",RENDERER_TYPE[RENDERER_TYPE.WEBGL=1]="WEBGL",RENDERER_TYPE[RENDERER_TYPE.CANVAS=2]="CANVAS"}(RENDERER_TYPE$1||(RENDERER_TYPE$1={})),function(BUFFER_BITS){BUFFER_BITS[BUFFER_BITS.COLOR=16384]="COLOR",BUFFER_BITS[BUFFER_BITS.DEPTH=256]="DEPTH",BUFFER_BITS[BUFFER_BITS.STENCIL=1024]="STENCIL"}(BUFFER_BITS$1||(BUFFER_BITS$1={})),function(BLEND_MODES){BLEND_MODES[BLEND_MODES.NORMAL=0]="NORMAL",BLEND_MODES[BLEND_MODES.ADD=1]="ADD",BLEND_MODES[BLEND_MODES.MULTIPLY=2]="MULTIPLY",BLEND_MODES[BLEND_MODES.SCREEN=3]="SCREEN",BLEND_MODES[BLEND_MODES.OVERLAY=4]="OVERLAY",BLEND_MODES[BLEND_MODES.DARKEN=5]="DARKEN",BLEND_MODES[BLEND_MODES.LIGHTEN=6]="LIGHTEN",BLEND_MODES[BLEND_MODES.COLOR_DODGE=7]="COLOR_DODGE",BLEND_MODES[BLEND_MODES.COLOR_BURN=8]="COLOR_BURN",BLEND_MODES[BLEND_MODES.HARD_LIGHT=9]="HARD_LIGHT",BLEND_MODES[BLEND_MODES.SOFT_LIGHT=10]="SOFT_LIGHT",BLEND_MODES[BLEND_MODES.DIFFERENCE=11]="DIFFERENCE",BLEND_MODES[BLEND_MODES.EXCLUSION=12]="EXCLUSION",BLEND_MODES[BLEND_MODES.HUE=13]="HUE",BLEND_MODES[BLEND_MODES.SATURATION=14]="SATURATION",BLEND_MODES[BLEND_MODES.COLOR=15]="COLOR",BLEND_MODES[BLEND_MODES.LUMINOSITY=16]="LUMINOSITY",BLEND_MODES[BLEND_MODES.NORMAL_NPM=17]="NORMAL_NPM",BLEND_MODES[BLEND_MODES.ADD_NPM=18]="ADD_NPM",BLEND_MODES[BLEND_MODES.SCREEN_NPM=19]="SCREEN_NPM",BLEND_MODES[BLEND_MODES.NONE=20]="NONE",BLEND_MODES[BLEND_MODES.SRC_OVER=0]="SRC_OVER",BLEND_MODES[BLEND_MODES.SRC_IN=21]="SRC_IN",BLEND_MODES[BLEND_MODES.SRC_OUT=22]="SRC_OUT",BLEND_MODES[BLEND_MODES.SRC_ATOP=23]="SRC_ATOP",BLEND_MODES[BLEND_MODES.DST_OVER=24]="DST_OVER",BLEND_MODES[BLEND_MODES.DST_IN=25]="DST_IN",BLEND_MODES[BLEND_MODES.DST_OUT=26]="DST_OUT",BLEND_MODES[BLEND_MODES.DST_ATOP=27]="DST_ATOP",BLEND_MODES[BLEND_MODES.ERASE=26]="ERASE",BLEND_MODES[BLEND_MODES.SUBTRACT=28]="SUBTRACT",BLEND_MODES[BLEND_MODES.XOR=29]="XOR"}(BLEND_MODES$1||(BLEND_MODES$1={})),function(DRAW_MODES){DRAW_MODES[DRAW_MODES.POINTS=0]="POINTS",DRAW_MODES[DRAW_MODES.LINES=1]="LINES",DRAW_MODES[DRAW_MODES.LINE_LOOP=2]="LINE_LOOP",DRAW_MODES[DRAW_MODES.LINE_STRIP=3]="LINE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLES=4]="TRIANGLES",DRAW_MODES[DRAW_MODES.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(DRAW_MODES$1||(DRAW_MODES$1={})),function(FORMATS){FORMATS[FORMATS.RGBA=6408]="RGBA",FORMATS[FORMATS.RGB=6407]="RGB",FORMATS[FORMATS.ALPHA=6406]="ALPHA",FORMATS[FORMATS.LUMINANCE=6409]="LUMINANCE",FORMATS[FORMATS.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",FORMATS[FORMATS.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",FORMATS[FORMATS.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(FORMATS$1||(FORMATS$1={})),function(TARGETS){TARGETS[TARGETS.TEXTURE_2D=3553]="TEXTURE_2D",TARGETS[TARGETS.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",TARGETS[TARGETS.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(TARGETS$1||(TARGETS$1={})),function(TYPES){TYPES[TYPES.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",TYPES[TYPES.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",TYPES[TYPES.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",TYPES[TYPES.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",TYPES[TYPES.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",TYPES[TYPES.FLOAT=5126]="FLOAT",TYPES[TYPES.HALF_FLOAT=36193]="HALF_FLOAT"}(TYPES$1||(TYPES$1={})),function(SCALE_MODES){SCALE_MODES[SCALE_MODES.NEAREST=0]="NEAREST",SCALE_MODES[SCALE_MODES.LINEAR=1]="LINEAR"}(SCALE_MODES$1||(SCALE_MODES$1={})),function(WRAP_MODES){WRAP_MODES[WRAP_MODES.CLAMP=33071]="CLAMP",WRAP_MODES[WRAP_MODES.REPEAT=10497]="REPEAT",WRAP_MODES[WRAP_MODES.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(WRAP_MODES$1||(WRAP_MODES$1={})),function(MIPMAP_MODES){MIPMAP_MODES[MIPMAP_MODES.OFF=0]="OFF",MIPMAP_MODES[MIPMAP_MODES.POW2=1]="POW2",MIPMAP_MODES[MIPMAP_MODES.ON=2]="ON"}(MIPMAP_MODES$1||(MIPMAP_MODES$1={})),function(ALPHA_MODES){ALPHA_MODES[ALPHA_MODES.NPM=0]="NPM",ALPHA_MODES[ALPHA_MODES.UNPACK=1]="UNPACK",ALPHA_MODES[ALPHA_MODES.PMA=2]="PMA",ALPHA_MODES[ALPHA_MODES.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA"}(ALPHA_MODES$1||(ALPHA_MODES$1={})),function(CLEAR_MODES){CLEAR_MODES[CLEAR_MODES.NO=0]="NO",CLEAR_MODES[CLEAR_MODES.YES=1]="YES",CLEAR_MODES[CLEAR_MODES.AUTO=2]="AUTO",CLEAR_MODES[CLEAR_MODES.BLEND=0]="BLEND",CLEAR_MODES[CLEAR_MODES.CLEAR=1]="CLEAR",CLEAR_MODES[CLEAR_MODES.BLIT=2]="BLIT"}(CLEAR_MODES$1||(CLEAR_MODES$1={})),function(GC_MODES){GC_MODES[GC_MODES.AUTO=0]="AUTO",GC_MODES[GC_MODES.MANUAL=1]="MANUAL"}(GC_MODES$1||(GC_MODES$1={})),function(PRECISION){PRECISION.LOW="lowp",PRECISION.MEDIUM="mediump",PRECISION.HIGH="highp"}(PRECISION$1||(PRECISION$1={})),function(MASK_TYPES){MASK_TYPES[MASK_TYPES.NONE=0]="NONE",MASK_TYPES[MASK_TYPES.SCISSOR=1]="SCISSOR",MASK_TYPES[MASK_TYPES.STENCIL=2]="STENCIL",MASK_TYPES[MASK_TYPES.SPRITE=3]="SPRITE"}(MASK_TYPES$1||(MASK_TYPES$1={})),function(MSAA_QUALITY){MSAA_QUALITY[MSAA_QUALITY.NONE=0]="NONE",MSAA_QUALITY[MSAA_QUALITY.LOW=2]="LOW",MSAA_QUALITY[MSAA_QUALITY.MEDIUM=4]="MEDIUM",MSAA_QUALITY[MSAA_QUALITY.HIGH=8]="HIGH"}(MSAA_QUALITY$1||(MSAA_QUALITY$1={}));var BlurFilterPass=function(_super){function BlurFilterPass(horizontal,strength,quality,resolution,kernelSize){void 0===strength&&(strength=8),void 0===quality&&(quality=4),void 0===resolution&&(resolution=settings.FILTER_RESOLUTION),void 0===kernelSize&&(kernelSize=5);var _this=this,vertSrc=function(kernelSize,x){var template,halfLength=Math.ceil(kernelSize/2),vertSource="\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }",blurLoop="";template=x?"vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":"vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(var i=0;i<kernelSize;i++){var blur=template.replace("%index%",i.toString());blurLoop+=blur=blur.replace("%sampleIndex%",i-(halfLength-1)+".0"),blurLoop+="\n"}return(vertSource=vertSource.replace("%blur%",blurLoop)).replace("%size%",kernelSize.toString())}(kernelSize,horizontal),fragSrc=function(kernelSize){for(var value,kernel=GAUSSIAN_VALUES[kernelSize],halfLength=kernel.length,fragSource=fragTemplate$1,blurLoop="",i=0;i<kernelSize;i++){var blur="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;".replace("%index%",i.toString());value=i,i>=halfLength&&(value=kernelSize-i-1),blurLoop+=blur=blur.replace("%value%",kernel[value].toString()),blurLoop+="\n"}return(fragSource=fragSource.replace("%blur%",blurLoop)).replace("%size%",kernelSize.toString())}(kernelSize);return(_this=_super.call(this,vertSrc,fragSrc)||this).horizontal=horizontal,_this.resolution=resolution,_this._quality=0,_this.quality=quality,_this.blur=strength,_this}return __extends$e(BlurFilterPass,_super),BlurFilterPass.prototype.apply=function(filterManager,input,output,clearMode){if(output?this.horizontal?this.uniforms.strength=1/output.width*(output.width/input.width):this.uniforms.strength=1/output.height*(output.height/input.height):this.horizontal?this.uniforms.strength=1/filterManager.renderer.width*(filterManager.renderer.width/input.width):this.uniforms.strength=1/filterManager.renderer.height*(filterManager.renderer.height/input.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)filterManager.applyFilter(this,input,output,clearMode);else{var renderTarget=filterManager.getFilterTexture(),renderer=filterManager.renderer,flip=input,flop=renderTarget;this.state.blend=!1,filterManager.applyFilter(this,flip,flop,CLEAR_MODES$1.CLEAR);for(var i=1;i<this.passes-1;i++){filterManager.bindAndClear(flip,CLEAR_MODES$1.BLIT),this.uniforms.uSampler=flop;var temp=flop;flop=flip,flip=temp,renderer.shader.bind(this),renderer.geometry.draw(5)}this.state.blend=!0,filterManager.applyFilter(this,flop,output,clearMode),filterManager.returnFilterTexture(renderTarget)}},Object.defineProperty(BlurFilterPass.prototype,"blur",{get:function(){return this.strength},set:function(value){this.padding=1+2*Math.abs(value),this.strength=value},enumerable:!1,configurable:!0}),Object.defineProperty(BlurFilterPass.prototype,"quality",{get:function(){return this._quality},set:function(value){this._quality=value,this.passes=value},enumerable:!1,configurable:!0}),BlurFilterPass}(Filter);!function(_super){function BlurFilter(strength,quality,resolution,kernelSize){void 0===strength&&(strength=8),void 0===quality&&(quality=4),void 0===resolution&&(resolution=settings.FILTER_RESOLUTION),void 0===kernelSize&&(kernelSize=5);var _this=_super.call(this)||this;return _this.blurXFilter=new BlurFilterPass(!0,strength,quality,resolution,kernelSize),_this.blurYFilter=new BlurFilterPass(!1,strength,quality,resolution,kernelSize),_this.resolution=resolution,_this.quality=quality,_this.blur=strength,_this.repeatEdgePixels=!1,_this}__extends$e(BlurFilter,_super),BlurFilter.prototype.apply=function(filterManager,input,output,clearMode){var xStrength=Math.abs(this.blurXFilter.strength),yStrength=Math.abs(this.blurYFilter.strength);if(xStrength&&yStrength){var renderTarget=filterManager.getFilterTexture();this.blurXFilter.apply(filterManager,input,renderTarget,CLEAR_MODES$1.CLEAR),this.blurYFilter.apply(filterManager,renderTarget,output,clearMode),filterManager.returnFilterTexture(renderTarget)}else yStrength?this.blurYFilter.apply(filterManager,input,output,clearMode):this.blurXFilter.apply(filterManager,input,output,clearMode)},BlurFilter.prototype.updatePadding=function(){this._repeatEdgePixels?this.padding=0:this.padding=2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))},Object.defineProperty(BlurFilter.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(value){this.blurXFilter.blur=this.blurYFilter.blur=value,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(BlurFilter.prototype,"quality",{get:function(){return this.blurXFilter.quality},set:function(value){this.blurXFilter.quality=this.blurYFilter.quality=value},enumerable:!1,configurable:!0}),Object.defineProperty(BlurFilter.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(value){this.blurXFilter.blur=value,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(BlurFilter.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(value){this.blurYFilter.blur=value,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(BlurFilter.prototype,"blendMode",{get:function(){return this.blurYFilter.blendMode},set:function(value){this.blurYFilter.blendMode=value},enumerable:!1,configurable:!0}),Object.defineProperty(BlurFilter.prototype,"repeatEdgePixels",{get:function(){return this._repeatEdgePixels},set:function(value){this._repeatEdgePixels=value,this.updatePadding()},enumerable:!1,configurable:!0})}(Filter);
|
|
221
|
+
var extendStatics$f=function(d,b){return extendStatics$f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$f(d,b)};function __extends$f(d,b){function __(){this.constructor=d}extendStatics$f(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var ENV$4,RENDERER_TYPE$4,BUFFER_BITS$4,BLEND_MODES$4,DRAW_MODES$4,FORMATS$4,TARGETS$4,TYPES$4,SAMPLER_TYPES$4,SCALE_MODES$4,WRAP_MODES$4,MIPMAP_MODES$4,ALPHA_MODES$4,CLEAR_MODES$4,GC_MODES$4,PRECISION$4,MASK_TYPES$4,MSAA_QUALITY$4,BUFFER_TYPE$4,GAUSSIAN_VALUES={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},fragTemplate$1=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join("\n");!function(ENV){ENV[ENV.WEBGL_LEGACY=0]="WEBGL_LEGACY",ENV[ENV.WEBGL=1]="WEBGL",ENV[ENV.WEBGL2=2]="WEBGL2"}(ENV$4||(ENV$4={})),function(RENDERER_TYPE){RENDERER_TYPE[RENDERER_TYPE.UNKNOWN=0]="UNKNOWN",RENDERER_TYPE[RENDERER_TYPE.WEBGL=1]="WEBGL",RENDERER_TYPE[RENDERER_TYPE.CANVAS=2]="CANVAS"}(RENDERER_TYPE$4||(RENDERER_TYPE$4={})),function(BUFFER_BITS){BUFFER_BITS[BUFFER_BITS.COLOR=16384]="COLOR",BUFFER_BITS[BUFFER_BITS.DEPTH=256]="DEPTH",BUFFER_BITS[BUFFER_BITS.STENCIL=1024]="STENCIL"}(BUFFER_BITS$4||(BUFFER_BITS$4={})),function(BLEND_MODES){BLEND_MODES[BLEND_MODES.NORMAL=0]="NORMAL",BLEND_MODES[BLEND_MODES.ADD=1]="ADD",BLEND_MODES[BLEND_MODES.MULTIPLY=2]="MULTIPLY",BLEND_MODES[BLEND_MODES.SCREEN=3]="SCREEN",BLEND_MODES[BLEND_MODES.OVERLAY=4]="OVERLAY",BLEND_MODES[BLEND_MODES.DARKEN=5]="DARKEN",BLEND_MODES[BLEND_MODES.LIGHTEN=6]="LIGHTEN",BLEND_MODES[BLEND_MODES.COLOR_DODGE=7]="COLOR_DODGE",BLEND_MODES[BLEND_MODES.COLOR_BURN=8]="COLOR_BURN",BLEND_MODES[BLEND_MODES.HARD_LIGHT=9]="HARD_LIGHT",BLEND_MODES[BLEND_MODES.SOFT_LIGHT=10]="SOFT_LIGHT",BLEND_MODES[BLEND_MODES.DIFFERENCE=11]="DIFFERENCE",BLEND_MODES[BLEND_MODES.EXCLUSION=12]="EXCLUSION",BLEND_MODES[BLEND_MODES.HUE=13]="HUE",BLEND_MODES[BLEND_MODES.SATURATION=14]="SATURATION",BLEND_MODES[BLEND_MODES.COLOR=15]="COLOR",BLEND_MODES[BLEND_MODES.LUMINOSITY=16]="LUMINOSITY",BLEND_MODES[BLEND_MODES.NORMAL_NPM=17]="NORMAL_NPM",BLEND_MODES[BLEND_MODES.ADD_NPM=18]="ADD_NPM",BLEND_MODES[BLEND_MODES.SCREEN_NPM=19]="SCREEN_NPM",BLEND_MODES[BLEND_MODES.NONE=20]="NONE",BLEND_MODES[BLEND_MODES.SRC_OVER=0]="SRC_OVER",BLEND_MODES[BLEND_MODES.SRC_IN=21]="SRC_IN",BLEND_MODES[BLEND_MODES.SRC_OUT=22]="SRC_OUT",BLEND_MODES[BLEND_MODES.SRC_ATOP=23]="SRC_ATOP",BLEND_MODES[BLEND_MODES.DST_OVER=24]="DST_OVER",BLEND_MODES[BLEND_MODES.DST_IN=25]="DST_IN",BLEND_MODES[BLEND_MODES.DST_OUT=26]="DST_OUT",BLEND_MODES[BLEND_MODES.DST_ATOP=27]="DST_ATOP",BLEND_MODES[BLEND_MODES.ERASE=26]="ERASE",BLEND_MODES[BLEND_MODES.SUBTRACT=28]="SUBTRACT",BLEND_MODES[BLEND_MODES.XOR=29]="XOR"}(BLEND_MODES$4||(BLEND_MODES$4={})),function(DRAW_MODES){DRAW_MODES[DRAW_MODES.POINTS=0]="POINTS",DRAW_MODES[DRAW_MODES.LINES=1]="LINES",DRAW_MODES[DRAW_MODES.LINE_LOOP=2]="LINE_LOOP",DRAW_MODES[DRAW_MODES.LINE_STRIP=3]="LINE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLES=4]="TRIANGLES",DRAW_MODES[DRAW_MODES.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(DRAW_MODES$4||(DRAW_MODES$4={})),function(FORMATS){FORMATS[FORMATS.RGBA=6408]="RGBA",FORMATS[FORMATS.RGB=6407]="RGB",FORMATS[FORMATS.RG=33319]="RG",FORMATS[FORMATS.RED=6403]="RED",FORMATS[FORMATS.RGBA_INTEGER=36249]="RGBA_INTEGER",FORMATS[FORMATS.RGB_INTEGER=36248]="RGB_INTEGER",FORMATS[FORMATS.RG_INTEGER=33320]="RG_INTEGER",FORMATS[FORMATS.RED_INTEGER=36244]="RED_INTEGER",FORMATS[FORMATS.ALPHA=6406]="ALPHA",FORMATS[FORMATS.LUMINANCE=6409]="LUMINANCE",FORMATS[FORMATS.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",FORMATS[FORMATS.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",FORMATS[FORMATS.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(FORMATS$4||(FORMATS$4={})),function(TARGETS){TARGETS[TARGETS.TEXTURE_2D=3553]="TEXTURE_2D",TARGETS[TARGETS.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",TARGETS[TARGETS.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(TARGETS$4||(TARGETS$4={})),function(TYPES){TYPES[TYPES.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",TYPES[TYPES.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",TYPES[TYPES.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",TYPES[TYPES.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",TYPES[TYPES.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",TYPES[TYPES.UNSIGNED_INT=5125]="UNSIGNED_INT",TYPES[TYPES.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",TYPES[TYPES.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",TYPES[TYPES.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",TYPES[TYPES.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",TYPES[TYPES.BYTE=5120]="BYTE",TYPES[TYPES.SHORT=5122]="SHORT",TYPES[TYPES.INT=5124]="INT",TYPES[TYPES.FLOAT=5126]="FLOAT",TYPES[TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",TYPES[TYPES.HALF_FLOAT=36193]="HALF_FLOAT"}(TYPES$4||(TYPES$4={})),function(SAMPLER_TYPES){SAMPLER_TYPES[SAMPLER_TYPES.FLOAT=0]="FLOAT",SAMPLER_TYPES[SAMPLER_TYPES.INT=1]="INT",SAMPLER_TYPES[SAMPLER_TYPES.UINT=2]="UINT"}(SAMPLER_TYPES$4||(SAMPLER_TYPES$4={})),function(SCALE_MODES){SCALE_MODES[SCALE_MODES.NEAREST=0]="NEAREST",SCALE_MODES[SCALE_MODES.LINEAR=1]="LINEAR"}(SCALE_MODES$4||(SCALE_MODES$4={})),function(WRAP_MODES){WRAP_MODES[WRAP_MODES.CLAMP=33071]="CLAMP",WRAP_MODES[WRAP_MODES.REPEAT=10497]="REPEAT",WRAP_MODES[WRAP_MODES.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(WRAP_MODES$4||(WRAP_MODES$4={})),function(MIPMAP_MODES){MIPMAP_MODES[MIPMAP_MODES.OFF=0]="OFF",MIPMAP_MODES[MIPMAP_MODES.POW2=1]="POW2",MIPMAP_MODES[MIPMAP_MODES.ON=2]="ON",MIPMAP_MODES[MIPMAP_MODES.ON_MANUAL=3]="ON_MANUAL"}(MIPMAP_MODES$4||(MIPMAP_MODES$4={})),function(ALPHA_MODES){ALPHA_MODES[ALPHA_MODES.NPM=0]="NPM",ALPHA_MODES[ALPHA_MODES.UNPACK=1]="UNPACK",ALPHA_MODES[ALPHA_MODES.PMA=2]="PMA",ALPHA_MODES[ALPHA_MODES.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"}(ALPHA_MODES$4||(ALPHA_MODES$4={})),function(CLEAR_MODES){CLEAR_MODES[CLEAR_MODES.NO=0]="NO",CLEAR_MODES[CLEAR_MODES.YES=1]="YES",CLEAR_MODES[CLEAR_MODES.AUTO=2]="AUTO",CLEAR_MODES[CLEAR_MODES.BLEND=0]="BLEND",CLEAR_MODES[CLEAR_MODES.CLEAR=1]="CLEAR",CLEAR_MODES[CLEAR_MODES.BLIT=2]="BLIT"}(CLEAR_MODES$4||(CLEAR_MODES$4={})),function(GC_MODES){GC_MODES[GC_MODES.AUTO=0]="AUTO",GC_MODES[GC_MODES.MANUAL=1]="MANUAL"}(GC_MODES$4||(GC_MODES$4={})),function(PRECISION){PRECISION.LOW="lowp",PRECISION.MEDIUM="mediump",PRECISION.HIGH="highp"}(PRECISION$4||(PRECISION$4={})),function(MASK_TYPES){MASK_TYPES[MASK_TYPES.NONE=0]="NONE",MASK_TYPES[MASK_TYPES.SCISSOR=1]="SCISSOR",MASK_TYPES[MASK_TYPES.STENCIL=2]="STENCIL",MASK_TYPES[MASK_TYPES.SPRITE=3]="SPRITE"}(MASK_TYPES$4||(MASK_TYPES$4={})),function(MSAA_QUALITY){MSAA_QUALITY[MSAA_QUALITY.NONE=0]="NONE",MSAA_QUALITY[MSAA_QUALITY.LOW=2]="LOW",MSAA_QUALITY[MSAA_QUALITY.MEDIUM=4]="MEDIUM",MSAA_QUALITY[MSAA_QUALITY.HIGH=8]="HIGH"}(MSAA_QUALITY$4||(MSAA_QUALITY$4={})),function(BUFFER_TYPE){BUFFER_TYPE[BUFFER_TYPE.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",BUFFER_TYPE[BUFFER_TYPE.ARRAY_BUFFER=34962]="ARRAY_BUFFER",BUFFER_TYPE[BUFFER_TYPE.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"}(BUFFER_TYPE$4||(BUFFER_TYPE$4={}));var BlurFilterPass=function(_super){function BlurFilterPass(horizontal,strength,quality,resolution,kernelSize){void 0===strength&&(strength=8),void 0===quality&&(quality=4),void 0===resolution&&(resolution=settings.FILTER_RESOLUTION),void 0===kernelSize&&(kernelSize=5);var _this=this,vertSrc=function(kernelSize,x){var template,halfLength=Math.ceil(kernelSize/2),vertSource="\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }",blurLoop="";template=x?"vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":"vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(var i=0;i<kernelSize;i++){var blur=template.replace("%index%",i.toString());blurLoop+=blur=blur.replace("%sampleIndex%",i-(halfLength-1)+".0"),blurLoop+="\n"}return(vertSource=vertSource.replace("%blur%",blurLoop)).replace("%size%",kernelSize.toString())}(kernelSize,horizontal),fragSrc=function(kernelSize){for(var value,kernel=GAUSSIAN_VALUES[kernelSize],halfLength=kernel.length,fragSource=fragTemplate$1,blurLoop="",i=0;i<kernelSize;i++){var blur="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;".replace("%index%",i.toString());value=i,i>=halfLength&&(value=kernelSize-i-1),blurLoop+=blur=blur.replace("%value%",kernel[value].toString()),blurLoop+="\n"}return(fragSource=fragSource.replace("%blur%",blurLoop)).replace("%size%",kernelSize.toString())}
|
|
222
|
+
/*!
|
|
223
|
+
* @pixi/constants - v6.4.2
|
|
224
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
225
|
+
*
|
|
226
|
+
* @pixi/constants is licensed under the MIT License.
|
|
227
|
+
* http://www.opensource.org/licenses/mit-license
|
|
228
|
+
*/(kernelSize);return(_this=_super.call(this,vertSrc,fragSrc)||this).horizontal=horizontal,_this.resolution=resolution,_this._quality=0,_this.quality=quality,_this.blur=strength,_this}return __extends$f(BlurFilterPass,_super),BlurFilterPass.prototype.apply=function(filterManager,input,output,clearMode){if(output?this.horizontal?this.uniforms.strength=1/output.width*(output.width/input.width):this.uniforms.strength=1/output.height*(output.height/input.height):this.horizontal?this.uniforms.strength=1/filterManager.renderer.width*(filterManager.renderer.width/input.width):this.uniforms.strength=1/filterManager.renderer.height*(filterManager.renderer.height/input.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)filterManager.applyFilter(this,input,output,clearMode);else{var renderTarget=filterManager.getFilterTexture(),renderer=filterManager.renderer,flip=input,flop=renderTarget;this.state.blend=!1,filterManager.applyFilter(this,flip,flop,CLEAR_MODES$4.CLEAR);for(var i=1;i<this.passes-1;i++){filterManager.bindAndClear(flip,CLEAR_MODES$4.BLIT),this.uniforms.uSampler=flop;var temp=flop;flop=flip,flip=temp,renderer.shader.bind(this),renderer.geometry.draw(5)}this.state.blend=!0,filterManager.applyFilter(this,flop,output,clearMode),filterManager.returnFilterTexture(renderTarget)}},Object.defineProperty(BlurFilterPass.prototype,"blur",{get:function(){return this.strength},set:function(value){this.padding=1+2*Math.abs(value),this.strength=value},enumerable:!1,configurable:!0}),Object.defineProperty(BlurFilterPass.prototype,"quality",{get:function(){return this._quality},set:function(value){this._quality=value,this.passes=value},enumerable:!1,configurable:!0}),BlurFilterPass}(Filter);!function(_super){function BlurFilter(strength,quality,resolution,kernelSize){void 0===strength&&(strength=8),void 0===quality&&(quality=4),void 0===resolution&&(resolution=settings.FILTER_RESOLUTION),void 0===kernelSize&&(kernelSize=5);var _this=_super.call(this)||this;return _this.blurXFilter=new BlurFilterPass(!0,strength,quality,resolution,kernelSize),_this.blurYFilter=new BlurFilterPass(!1,strength,quality,resolution,kernelSize),_this.resolution=resolution,_this.quality=quality,_this.blur=strength,_this.repeatEdgePixels=!1,_this}__extends$f(BlurFilter,_super),BlurFilter.prototype.apply=function(filterManager,input,output,clearMode){var xStrength=Math.abs(this.blurXFilter.strength),yStrength=Math.abs(this.blurYFilter.strength);if(xStrength&&yStrength){var renderTarget=filterManager.getFilterTexture();this.blurXFilter.apply(filterManager,input,renderTarget,CLEAR_MODES$4.CLEAR),this.blurYFilter.apply(filterManager,renderTarget,output,clearMode),filterManager.returnFilterTexture(renderTarget)}else yStrength?this.blurYFilter.apply(filterManager,input,output,clearMode):this.blurXFilter.apply(filterManager,input,output,clearMode)},BlurFilter.prototype.updatePadding=function(){this._repeatEdgePixels?this.padding=0:this.padding=2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))},Object.defineProperty(BlurFilter.prototype,"blur",{get:function(){return this.blurXFilter.blur},set:function(value){this.blurXFilter.blur=this.blurYFilter.blur=value,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(BlurFilter.prototype,"quality",{get:function(){return this.blurXFilter.quality},set:function(value){this.blurXFilter.quality=this.blurYFilter.quality=value},enumerable:!1,configurable:!0}),Object.defineProperty(BlurFilter.prototype,"blurX",{get:function(){return this.blurXFilter.blur},set:function(value){this.blurXFilter.blur=value,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(BlurFilter.prototype,"blurY",{get:function(){return this.blurYFilter.blur},set:function(value){this.blurYFilter.blur=value,this.updatePadding()},enumerable:!1,configurable:!0}),Object.defineProperty(BlurFilter.prototype,"blendMode",{get:function(){return this.blurYFilter.blendMode},set:function(value){this.blurYFilter.blendMode=value},enumerable:!1,configurable:!0}),Object.defineProperty(BlurFilter.prototype,"repeatEdgePixels",{get:function(){return this._repeatEdgePixels},set:function(value){this._repeatEdgePixels=value,this.updatePadding()},enumerable:!1,configurable:!0})}(Filter);
|
|
236
229
|
/*!
|
|
237
|
-
* @pixi/filter-color-matrix -
|
|
238
|
-
* Compiled
|
|
230
|
+
* @pixi/filter-color-matrix - v6.4.2
|
|
231
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
239
232
|
*
|
|
240
233
|
* @pixi/filter-color-matrix is licensed under the MIT License.
|
|
241
234
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -254,10 +247,10 @@ var extendStatics$e=function(d,b){return(extendStatics$e=Object.setPrototypeOf||
|
|
|
254
247
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
255
248
|
and limitations under the License.
|
|
256
249
|
***************************************************************************** */
|
|
257
|
-
var extendStatics$
|
|
250
|
+
var extendStatics$g=function(d,b){return extendStatics$g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$g(d,b)};var ColorMatrixFilter=function(_super){function ColorMatrixFilter(){var _this=this,uniforms={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};return(_this=_super.call(this,defaultFilterVertex,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n",uniforms)||this).alpha=1,_this}return function(d,b){function __(){this.constructor=d}extendStatics$g(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(ColorMatrixFilter,_super),ColorMatrixFilter.prototype._loadMatrix=function(matrix,multiply){void 0===multiply&&(multiply=!1);var newMatrix=matrix;multiply&&(this._multiply(newMatrix,this.uniforms.m,matrix),newMatrix=this._colorMatrix(newMatrix)),this.uniforms.m=newMatrix},ColorMatrixFilter.prototype._multiply=function(out,a,b){return out[0]=a[0]*b[0]+a[1]*b[5]+a[2]*b[10]+a[3]*b[15],out[1]=a[0]*b[1]+a[1]*b[6]+a[2]*b[11]+a[3]*b[16],out[2]=a[0]*b[2]+a[1]*b[7]+a[2]*b[12]+a[3]*b[17],out[3]=a[0]*b[3]+a[1]*b[8]+a[2]*b[13]+a[3]*b[18],out[4]=a[0]*b[4]+a[1]*b[9]+a[2]*b[14]+a[3]*b[19]+a[4],out[5]=a[5]*b[0]+a[6]*b[5]+a[7]*b[10]+a[8]*b[15],out[6]=a[5]*b[1]+a[6]*b[6]+a[7]*b[11]+a[8]*b[16],out[7]=a[5]*b[2]+a[6]*b[7]+a[7]*b[12]+a[8]*b[17],out[8]=a[5]*b[3]+a[6]*b[8]+a[7]*b[13]+a[8]*b[18],out[9]=a[5]*b[4]+a[6]*b[9]+a[7]*b[14]+a[8]*b[19]+a[9],out[10]=a[10]*b[0]+a[11]*b[5]+a[12]*b[10]+a[13]*b[15],out[11]=a[10]*b[1]+a[11]*b[6]+a[12]*b[11]+a[13]*b[16],out[12]=a[10]*b[2]+a[11]*b[7]+a[12]*b[12]+a[13]*b[17],out[13]=a[10]*b[3]+a[11]*b[8]+a[12]*b[13]+a[13]*b[18],out[14]=a[10]*b[4]+a[11]*b[9]+a[12]*b[14]+a[13]*b[19]+a[14],out[15]=a[15]*b[0]+a[16]*b[5]+a[17]*b[10]+a[18]*b[15],out[16]=a[15]*b[1]+a[16]*b[6]+a[17]*b[11]+a[18]*b[16],out[17]=a[15]*b[2]+a[16]*b[7]+a[17]*b[12]+a[18]*b[17],out[18]=a[15]*b[3]+a[16]*b[8]+a[17]*b[13]+a[18]*b[18],out[19]=a[15]*b[4]+a[16]*b[9]+a[17]*b[14]+a[18]*b[19]+a[19],out},ColorMatrixFilter.prototype._colorMatrix=function(matrix){var m=new Float32Array(matrix);return m[4]/=255,m[9]/=255,m[14]/=255,m[19]/=255,m},ColorMatrixFilter.prototype.brightness=function(b,multiply){var matrix=[b,0,0,0,0,0,b,0,0,0,0,0,b,0,0,0,0,0,1,0];this._loadMatrix(matrix,multiply)},ColorMatrixFilter.prototype.tint=function(color,multiply){var matrix=[(color>>16&255)/255,0,0,0,0,0,(color>>8&255)/255,0,0,0,0,0,(255&color)/255,0,0,0,0,0,1,0];this._loadMatrix(matrix,multiply)},ColorMatrixFilter.prototype.greyscale=function(scale,multiply){var matrix=[scale,scale,scale,0,0,scale,scale,scale,0,0,scale,scale,scale,0,0,0,0,0,1,0];this._loadMatrix(matrix,multiply)},ColorMatrixFilter.prototype.blackAndWhite=function(multiply){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],multiply)},ColorMatrixFilter.prototype.hue=function(rotation,multiply){rotation=(rotation||0)/180*Math.PI;var cosR=Math.cos(rotation),sinR=Math.sin(rotation),w=1/3,sqrW=(0,Math.sqrt)(w),matrix=[cosR+(1-cosR)*w,w*(1-cosR)-sqrW*sinR,w*(1-cosR)+sqrW*sinR,0,0,w*(1-cosR)+sqrW*sinR,cosR+w*(1-cosR),w*(1-cosR)-sqrW*sinR,0,0,w*(1-cosR)-sqrW*sinR,w*(1-cosR)+sqrW*sinR,cosR+w*(1-cosR),0,0,0,0,0,1,0];this._loadMatrix(matrix,multiply)},ColorMatrixFilter.prototype.contrast=function(amount,multiply){var v=(amount||0)+1,o=-.5*(v-1),matrix=[v,0,0,0,o,0,v,0,0,o,0,0,v,0,o,0,0,0,1,0];this._loadMatrix(matrix,multiply)},ColorMatrixFilter.prototype.saturate=function(amount,multiply){void 0===amount&&(amount=0);var x=2*amount/3+1,y=-.5*(x-1),matrix=[x,y,y,0,0,y,x,y,0,0,y,y,x,0,0,0,0,0,1,0];this._loadMatrix(matrix,multiply)},ColorMatrixFilter.prototype.desaturate=function(){this.saturate(-1)},ColorMatrixFilter.prototype.negative=function(multiply){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],multiply)},ColorMatrixFilter.prototype.sepia=function(multiply){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],multiply)},ColorMatrixFilter.prototype.technicolor=function(multiply){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],multiply)},ColorMatrixFilter.prototype.polaroid=function(multiply){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],multiply)},ColorMatrixFilter.prototype.toBGR=function(multiply){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],multiply)},ColorMatrixFilter.prototype.kodachrome=function(multiply){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],multiply)},ColorMatrixFilter.prototype.browni=function(multiply){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],multiply)},ColorMatrixFilter.prototype.vintage=function(multiply){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],multiply)},ColorMatrixFilter.prototype.colorTone=function(desaturation,toned,lightColor,darkColor,multiply){var lR=((lightColor=lightColor||16770432)>>16&255)/255,lG=(lightColor>>8&255)/255,lB=(255&lightColor)/255,dR=((darkColor=darkColor||3375104)>>16&255)/255,dG=(darkColor>>8&255)/255,dB=(255&darkColor)/255,matrix=[.3,.59,.11,0,0,lR,lG,lB,desaturation=desaturation||.2,0,dR,dG,dB,toned=toned||.15,0,lR-dR,lG-dG,lB-dB,0,0];this._loadMatrix(matrix,multiply)},ColorMatrixFilter.prototype.night=function(intensity,multiply){var matrix=[-2*(intensity=intensity||.1),-intensity,0,0,0,-intensity,0,intensity,0,0,0,intensity,2*intensity,0,0,0,0,0,1,0];this._loadMatrix(matrix,multiply)},ColorMatrixFilter.prototype.predator=function(amount,multiply){var matrix=[11.224130630493164*amount,-4.794486999511719*amount,-2.8746118545532227*amount,0*amount,.40342438220977783*amount,-3.6330697536468506*amount,9.193157196044922*amount,-2.951810836791992*amount,0*amount,-1.316135048866272*amount,-3.2184197902679443*amount,-4.2375030517578125*amount,7.476448059082031*amount,0*amount,.8044459223747253*amount,0,0,0,1,0];this._loadMatrix(matrix,multiply)},ColorMatrixFilter.prototype.lsd=function(multiply){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],multiply)},ColorMatrixFilter.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},Object.defineProperty(ColorMatrixFilter.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(value){this.uniforms.m=value},enumerable:!1,configurable:!0}),Object.defineProperty(ColorMatrixFilter.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(value){this.uniforms.uAlpha=value},enumerable:!1,configurable:!0}),ColorMatrixFilter}(Filter);ColorMatrixFilter.prototype.grayscale=ColorMatrixFilter.prototype.greyscale;
|
|
258
251
|
/*!
|
|
259
|
-
* @pixi/filter-displacement -
|
|
260
|
-
* Compiled
|
|
252
|
+
* @pixi/filter-displacement - v6.4.2
|
|
253
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
261
254
|
*
|
|
262
255
|
* @pixi/filter-displacement is licensed under the MIT License.
|
|
263
256
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -276,10 +269,10 @@ var extendStatics$f=function(d,b){return(extendStatics$f=Object.setPrototypeOf||
|
|
|
276
269
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
277
270
|
and limitations under the License.
|
|
278
271
|
***************************************************************************** */
|
|
279
|
-
var extendStatics$
|
|
272
|
+
var extendStatics$h=function(d,b){return extendStatics$h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$h(d,b)};!function(_super){function DisplacementFilter(sprite,scale){var _this=this,maskMatrix=new Matrix;return sprite.renderable=!1,(_this=_super.call(this,"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",{mapSampler:sprite._texture,filterMatrix:maskMatrix,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this).maskSprite=sprite,_this.maskMatrix=maskMatrix,null==scale&&(scale=20),_this.scale=new Point(scale,scale),_this}(function(d,b){function __(){this.constructor=d}extendStatics$h(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)})(DisplacementFilter,_super),DisplacementFilter.prototype.apply=function(filterManager,input,output,clearMode){this.uniforms.filterMatrix=filterManager.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var wt=this.maskSprite.worldTransform,lenX=Math.sqrt(wt.a*wt.a+wt.b*wt.b),lenY=Math.sqrt(wt.c*wt.c+wt.d*wt.d);0!==lenX&&0!==lenY&&(this.uniforms.rotation[0]=wt.a/lenX,this.uniforms.rotation[1]=wt.b/lenX,this.uniforms.rotation[2]=wt.c/lenY,this.uniforms.rotation[3]=wt.d/lenY),filterManager.applyFilter(this,input,output,clearMode)},Object.defineProperty(DisplacementFilter.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(value){this.uniforms.mapSampler=value},enumerable:!1,configurable:!0})}(Filter);
|
|
280
273
|
/*!
|
|
281
|
-
* @pixi/filter-fxaa -
|
|
282
|
-
* Compiled
|
|
274
|
+
* @pixi/filter-fxaa - v6.4.2
|
|
275
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
283
276
|
*
|
|
284
277
|
* @pixi/filter-fxaa is licensed under the MIT License.
|
|
285
278
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -298,10 +291,10 @@ var extendStatics$g=function(d,b){return(extendStatics$g=Object.setPrototypeOf||
|
|
|
298
291
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
299
292
|
and limitations under the License.
|
|
300
293
|
***************************************************************************** */
|
|
301
|
-
var extendStatics$
|
|
294
|
+
var extendStatics$i=function(d,b){return extendStatics$i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$i(d,b)};!function(_super){function FXAAFilter(){return _super.call(this,"\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputSize;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n')||this}(function(d,b){function __(){this.constructor=d}extendStatics$i(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)})(FXAAFilter,_super)}(Filter);
|
|
302
295
|
/*!
|
|
303
|
-
* @pixi/filter-noise -
|
|
304
|
-
* Compiled
|
|
296
|
+
* @pixi/filter-noise - v6.4.2
|
|
297
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
305
298
|
*
|
|
306
299
|
* @pixi/filter-noise is licensed under the MIT License.
|
|
307
300
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -320,34 +313,26 @@ var extendStatics$h=function(d,b){return(extendStatics$h=Object.setPrototypeOf||
|
|
|
320
313
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
321
314
|
and limitations under the License.
|
|
322
315
|
***************************************************************************** */
|
|
323
|
-
var extendStatics$i=function(d,b){return(extendStatics$i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};!function(_super){function NoiseFilter(noise,seed){void 0===noise&&(noise=.5),void 0===seed&&(seed=Math.random());var _this=_super.call(this,defaultFilter,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",{uNoise:0,uSeed:0})||this;return _this.noise=noise,_this.seed=seed,_this}(function(d,b){function __(){this.constructor=d}extendStatics$i(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)})(NoiseFilter,_super),Object.defineProperty(NoiseFilter.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(value){this.uniforms.uNoise=value},enumerable:!1,configurable:!0}),Object.defineProperty(NoiseFilter.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(value){this.uniforms.uSeed=value},enumerable:!1,configurable:!0})}(Filter);
|
|
324
|
-
/*!
|
|
325
|
-
* @pixi/mixin-cache-as-bitmap - v5.3.11
|
|
326
|
-
* Compiled Mon, 01 Nov 2021 16:10:12 UTC
|
|
327
|
-
*
|
|
328
|
-
* @pixi/mixin-cache-as-bitmap is licensed under the MIT License.
|
|
329
|
-
* http://www.opensource.org/licenses/mit-license
|
|
330
|
-
*/
|
|
331
|
-
var _tempMatrix=new Matrix;DisplayObject.prototype._cacheAsBitmap=!1,DisplayObject.prototype._cacheData=null;var CacheData=function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null};Object.defineProperties(DisplayObject.prototype,{cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(value){var data;this._cacheAsBitmap!==value&&(this._cacheAsBitmap=value,value?(this._cacheData||(this._cacheData=new CacheData),(data=this._cacheData).originalRender=this.render,data.originalRenderCanvas=this.renderCanvas,data.originalUpdateTransform=this.updateTransform,data.originalCalculateBounds=this.calculateBounds,data.originalGetLocalBounds=this.getLocalBounds,data.originalDestroy=this.destroy,data.originalContainsPoint=this.containsPoint,data.originalMask=this._mask,data.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((data=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=data.originalRender,this.renderCanvas=data.originalRenderCanvas,this.calculateBounds=data.originalCalculateBounds,this.getLocalBounds=data.originalGetLocalBounds,this.destroy=data.originalDestroy,this.updateTransform=data.originalUpdateTransform,this.containsPoint=data.originalContainsPoint,this._mask=data.originalMask,this.filterArea=data.originalFilterArea))}}}),DisplayObject.prototype._renderCached=function(renderer){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(renderer),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(renderer))},DisplayObject.prototype._initCachedDisplayObject=function(renderer){if(!this._cacheData||!this._cacheData.sprite){var cacheAlpha=this.alpha;this.alpha=1,renderer.batch.flush();var bounds=this.getLocalBounds(null,!0).clone();if(this.filters){var padding=this.filters[0].padding;bounds.pad(padding)}bounds.ceil(settings.RESOLUTION);var cachedRenderTexture=renderer.renderTexture.current,cachedSourceFrame=renderer.renderTexture.sourceFrame.clone(),cachedDestinationFrame=renderer.renderTexture.destinationFrame.clone(),cachedProjectionTransform=renderer.projection.transform,renderTexture=RenderTexture.create({width:bounds.width,height:bounds.height}),textureCacheId="cacheAsBitmap_"+uid();this._cacheData.textureCacheId=textureCacheId,BaseTexture.addToCache(renderTexture.baseTexture,textureCacheId),Texture.addToCache(renderTexture,textureCacheId);var m=this.transform.localTransform.copyTo(_tempMatrix).invert().translate(-bounds.x,-bounds.y);this.render=this._cacheData.originalRender,renderer.render(this,renderTexture,!0,m,!1),renderer.projection.transform=cachedProjectionTransform,renderer.renderTexture.bind(cachedRenderTexture,cachedSourceFrame,cachedDestinationFrame),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var cachedSprite=new Sprite(renderTexture);cachedSprite.transform.worldTransform=this.transform.worldTransform,cachedSprite.anchor.x=-bounds.x/bounds.width,cachedSprite.anchor.y=-bounds.y/bounds.height,cachedSprite.alpha=cacheAlpha,cachedSprite._bounds=this._bounds,this._cacheData.sprite=cachedSprite,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=cachedSprite.containsPoint.bind(cachedSprite)}},DisplayObject.prototype._renderCachedCanvas=function(renderer){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(renderer),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(renderer))},DisplayObject.prototype._initCachedDisplayObjectCanvas=function(renderer){if(!this._cacheData||!this._cacheData.sprite){var bounds=this.getLocalBounds(null,!0),cacheAlpha=this.alpha;this.alpha=1;var cachedRenderTarget=renderer.context,cachedProjectionTransform=renderer._projTransform;bounds.ceil(settings.RESOLUTION);var renderTexture=RenderTexture.create({width:bounds.width,height:bounds.height}),textureCacheId="cacheAsBitmap_"+uid();this._cacheData.textureCacheId=textureCacheId,BaseTexture.addToCache(renderTexture.baseTexture,textureCacheId),Texture.addToCache(renderTexture,textureCacheId);var m=_tempMatrix;this.transform.localTransform.copyTo(m),m.invert(),m.tx-=bounds.x,m.ty-=bounds.y,this.renderCanvas=this._cacheData.originalRenderCanvas,renderer.render(this,renderTexture,!0,m,!1),renderer.context=cachedRenderTarget,renderer._projTransform=cachedProjectionTransform,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var cachedSprite=new Sprite(renderTexture);cachedSprite.transform.worldTransform=this.transform.worldTransform,cachedSprite.anchor.x=-bounds.x/bounds.width,cachedSprite.anchor.y=-bounds.y/bounds.height,cachedSprite.alpha=cacheAlpha,cachedSprite._bounds=this._bounds,this._cacheData.sprite=cachedSprite,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=renderer._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=cachedSprite.containsPoint.bind(cachedSprite)}},DisplayObject.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},DisplayObject.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},DisplayObject.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,BaseTexture.removeFromCache(this._cacheData.textureCacheId),Texture.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},DisplayObject.prototype._cacheAsBitmapDestroy=function(options){this.cacheAsBitmap=!1,this.destroy(options)},
|
|
316
|
+
var extendStatics$j=function(d,b){return extendStatics$j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$j(d,b)};var ENV$5,RENDERER_TYPE$5,BUFFER_BITS$5,BLEND_MODES$5,DRAW_MODES$5,FORMATS$5,TARGETS$5,TYPES$5,SAMPLER_TYPES$5,SCALE_MODES$5,WRAP_MODES$5,MIPMAP_MODES$5,ALPHA_MODES$5,CLEAR_MODES$5,GC_MODES$5,PRECISION$5,MASK_TYPES$5,MSAA_QUALITY$5,BUFFER_TYPE$5;!function(_super){function NoiseFilter(noise,seed){void 0===noise&&(noise=.5),void 0===seed&&(seed=Math.random());var _this=_super.call(this,defaultFilterVertex,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",{uNoise:0,uSeed:0})||this;return _this.noise=noise,_this.seed=seed,_this}(function(d,b){function __(){this.constructor=d}extendStatics$j(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)})(NoiseFilter,_super),Object.defineProperty(NoiseFilter.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(value){this.uniforms.uNoise=value},enumerable:!1,configurable:!0}),Object.defineProperty(NoiseFilter.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(value){this.uniforms.uSeed=value},enumerable:!1,configurable:!0})}(Filter),function(ENV){ENV[ENV.WEBGL_LEGACY=0]="WEBGL_LEGACY",ENV[ENV.WEBGL=1]="WEBGL",ENV[ENV.WEBGL2=2]="WEBGL2"}(ENV$5||(ENV$5={})),function(RENDERER_TYPE){RENDERER_TYPE[RENDERER_TYPE.UNKNOWN=0]="UNKNOWN",RENDERER_TYPE[RENDERER_TYPE.WEBGL=1]="WEBGL",RENDERER_TYPE[RENDERER_TYPE.CANVAS=2]="CANVAS"}(RENDERER_TYPE$5||(RENDERER_TYPE$5={})),function(BUFFER_BITS){BUFFER_BITS[BUFFER_BITS.COLOR=16384]="COLOR",BUFFER_BITS[BUFFER_BITS.DEPTH=256]="DEPTH",BUFFER_BITS[BUFFER_BITS.STENCIL=1024]="STENCIL"}(BUFFER_BITS$5||(BUFFER_BITS$5={})),function(BLEND_MODES){BLEND_MODES[BLEND_MODES.NORMAL=0]="NORMAL",BLEND_MODES[BLEND_MODES.ADD=1]="ADD",BLEND_MODES[BLEND_MODES.MULTIPLY=2]="MULTIPLY",BLEND_MODES[BLEND_MODES.SCREEN=3]="SCREEN",BLEND_MODES[BLEND_MODES.OVERLAY=4]="OVERLAY",BLEND_MODES[BLEND_MODES.DARKEN=5]="DARKEN",BLEND_MODES[BLEND_MODES.LIGHTEN=6]="LIGHTEN",BLEND_MODES[BLEND_MODES.COLOR_DODGE=7]="COLOR_DODGE",BLEND_MODES[BLEND_MODES.COLOR_BURN=8]="COLOR_BURN",BLEND_MODES[BLEND_MODES.HARD_LIGHT=9]="HARD_LIGHT",BLEND_MODES[BLEND_MODES.SOFT_LIGHT=10]="SOFT_LIGHT",BLEND_MODES[BLEND_MODES.DIFFERENCE=11]="DIFFERENCE",BLEND_MODES[BLEND_MODES.EXCLUSION=12]="EXCLUSION",BLEND_MODES[BLEND_MODES.HUE=13]="HUE",BLEND_MODES[BLEND_MODES.SATURATION=14]="SATURATION",BLEND_MODES[BLEND_MODES.COLOR=15]="COLOR",BLEND_MODES[BLEND_MODES.LUMINOSITY=16]="LUMINOSITY",BLEND_MODES[BLEND_MODES.NORMAL_NPM=17]="NORMAL_NPM",BLEND_MODES[BLEND_MODES.ADD_NPM=18]="ADD_NPM",BLEND_MODES[BLEND_MODES.SCREEN_NPM=19]="SCREEN_NPM",BLEND_MODES[BLEND_MODES.NONE=20]="NONE",BLEND_MODES[BLEND_MODES.SRC_OVER=0]="SRC_OVER",BLEND_MODES[BLEND_MODES.SRC_IN=21]="SRC_IN",BLEND_MODES[BLEND_MODES.SRC_OUT=22]="SRC_OUT",BLEND_MODES[BLEND_MODES.SRC_ATOP=23]="SRC_ATOP",BLEND_MODES[BLEND_MODES.DST_OVER=24]="DST_OVER",BLEND_MODES[BLEND_MODES.DST_IN=25]="DST_IN",BLEND_MODES[BLEND_MODES.DST_OUT=26]="DST_OUT",BLEND_MODES[BLEND_MODES.DST_ATOP=27]="DST_ATOP",BLEND_MODES[BLEND_MODES.ERASE=26]="ERASE",BLEND_MODES[BLEND_MODES.SUBTRACT=28]="SUBTRACT",BLEND_MODES[BLEND_MODES.XOR=29]="XOR"}(BLEND_MODES$5||(BLEND_MODES$5={})),function(DRAW_MODES){DRAW_MODES[DRAW_MODES.POINTS=0]="POINTS",DRAW_MODES[DRAW_MODES.LINES=1]="LINES",DRAW_MODES[DRAW_MODES.LINE_LOOP=2]="LINE_LOOP",DRAW_MODES[DRAW_MODES.LINE_STRIP=3]="LINE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLES=4]="TRIANGLES",DRAW_MODES[DRAW_MODES.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",DRAW_MODES[DRAW_MODES.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(DRAW_MODES$5||(DRAW_MODES$5={})),function(FORMATS){FORMATS[FORMATS.RGBA=6408]="RGBA",FORMATS[FORMATS.RGB=6407]="RGB",FORMATS[FORMATS.RG=33319]="RG",FORMATS[FORMATS.RED=6403]="RED",FORMATS[FORMATS.RGBA_INTEGER=36249]="RGBA_INTEGER",FORMATS[FORMATS.RGB_INTEGER=36248]="RGB_INTEGER",FORMATS[FORMATS.RG_INTEGER=33320]="RG_INTEGER",FORMATS[FORMATS.RED_INTEGER=36244]="RED_INTEGER",FORMATS[FORMATS.ALPHA=6406]="ALPHA",FORMATS[FORMATS.LUMINANCE=6409]="LUMINANCE",FORMATS[FORMATS.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",FORMATS[FORMATS.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",FORMATS[FORMATS.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(FORMATS$5||(FORMATS$5={})),function(TARGETS){TARGETS[TARGETS.TEXTURE_2D=3553]="TEXTURE_2D",TARGETS[TARGETS.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",TARGETS[TARGETS.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",TARGETS[TARGETS.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",TARGETS[TARGETS.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(TARGETS$5||(TARGETS$5={})),function(TYPES){TYPES[TYPES.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",TYPES[TYPES.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",TYPES[TYPES.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",TYPES[TYPES.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",TYPES[TYPES.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",TYPES[TYPES.UNSIGNED_INT=5125]="UNSIGNED_INT",TYPES[TYPES.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",TYPES[TYPES.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",TYPES[TYPES.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",TYPES[TYPES.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",TYPES[TYPES.BYTE=5120]="BYTE",TYPES[TYPES.SHORT=5122]="SHORT",TYPES[TYPES.INT=5124]="INT",TYPES[TYPES.FLOAT=5126]="FLOAT",TYPES[TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",TYPES[TYPES.HALF_FLOAT=36193]="HALF_FLOAT"}(TYPES$5||(TYPES$5={})),function(SAMPLER_TYPES){SAMPLER_TYPES[SAMPLER_TYPES.FLOAT=0]="FLOAT",SAMPLER_TYPES[SAMPLER_TYPES.INT=1]="INT",SAMPLER_TYPES[SAMPLER_TYPES.UINT=2]="UINT"}(SAMPLER_TYPES$5||(SAMPLER_TYPES$5={})),function(SCALE_MODES){SCALE_MODES[SCALE_MODES.NEAREST=0]="NEAREST",SCALE_MODES[SCALE_MODES.LINEAR=1]="LINEAR"}(SCALE_MODES$5||(SCALE_MODES$5={})),function(WRAP_MODES){WRAP_MODES[WRAP_MODES.CLAMP=33071]="CLAMP",WRAP_MODES[WRAP_MODES.REPEAT=10497]="REPEAT",WRAP_MODES[WRAP_MODES.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(WRAP_MODES$5||(WRAP_MODES$5={})),function(MIPMAP_MODES){MIPMAP_MODES[MIPMAP_MODES.OFF=0]="OFF",MIPMAP_MODES[MIPMAP_MODES.POW2=1]="POW2",MIPMAP_MODES[MIPMAP_MODES.ON=2]="ON",MIPMAP_MODES[MIPMAP_MODES.ON_MANUAL=3]="ON_MANUAL"}(MIPMAP_MODES$5||(MIPMAP_MODES$5={})),function(ALPHA_MODES){ALPHA_MODES[ALPHA_MODES.NPM=0]="NPM",ALPHA_MODES[ALPHA_MODES.UNPACK=1]="UNPACK",ALPHA_MODES[ALPHA_MODES.PMA=2]="PMA",ALPHA_MODES[ALPHA_MODES.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",ALPHA_MODES[ALPHA_MODES.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",ALPHA_MODES[ALPHA_MODES.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"}(ALPHA_MODES$5||(ALPHA_MODES$5={})),function(CLEAR_MODES){CLEAR_MODES[CLEAR_MODES.NO=0]="NO",CLEAR_MODES[CLEAR_MODES.YES=1]="YES",CLEAR_MODES[CLEAR_MODES.AUTO=2]="AUTO",CLEAR_MODES[CLEAR_MODES.BLEND=0]="BLEND",CLEAR_MODES[CLEAR_MODES.CLEAR=1]="CLEAR",CLEAR_MODES[CLEAR_MODES.BLIT=2]="BLIT"}(CLEAR_MODES$5||(CLEAR_MODES$5={})),function(GC_MODES){GC_MODES[GC_MODES.AUTO=0]="AUTO",GC_MODES[GC_MODES.MANUAL=1]="MANUAL"}(GC_MODES$5||(GC_MODES$5={})),function(PRECISION){PRECISION.LOW="lowp",PRECISION.MEDIUM="mediump",PRECISION.HIGH="highp"}(PRECISION$5||(PRECISION$5={})),function(MASK_TYPES){MASK_TYPES[MASK_TYPES.NONE=0]="NONE",MASK_TYPES[MASK_TYPES.SCISSOR=1]="SCISSOR",MASK_TYPES[MASK_TYPES.STENCIL=2]="STENCIL",MASK_TYPES[MASK_TYPES.SPRITE=3]="SPRITE"}(MASK_TYPES$5||(MASK_TYPES$5={})),function(MSAA_QUALITY){MSAA_QUALITY[MSAA_QUALITY.NONE=0]="NONE",MSAA_QUALITY[MSAA_QUALITY.LOW=2]="LOW",MSAA_QUALITY[MSAA_QUALITY.MEDIUM=4]="MEDIUM",MSAA_QUALITY[MSAA_QUALITY.HIGH=8]="HIGH"}(MSAA_QUALITY$5||(MSAA_QUALITY$5={})),function(BUFFER_TYPE){BUFFER_TYPE[BUFFER_TYPE.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",BUFFER_TYPE[BUFFER_TYPE.ARRAY_BUFFER=34962]="ARRAY_BUFFER",BUFFER_TYPE[BUFFER_TYPE.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"}(BUFFER_TYPE$5||(BUFFER_TYPE$5={}));var _tempMatrix=new Matrix;DisplayObject.prototype._cacheAsBitmap=!1,DisplayObject.prototype._cacheData=null,DisplayObject.prototype._cacheAsBitmapResolution=null,DisplayObject.prototype._cacheAsBitmapMultisample=MSAA_QUALITY$5.NONE;var CacheData=function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null};Object.defineProperties(DisplayObject.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(resolution){resolution!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=resolution,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get:function(){return this._cacheAsBitmapMultisample},set:function(multisample){multisample!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=multisample,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(value){var data;this._cacheAsBitmap!==value&&(this._cacheAsBitmap=value,value?(this._cacheData||(this._cacheData=new CacheData),(data=this._cacheData).originalRender=this.render,data.originalRenderCanvas=this.renderCanvas,data.originalUpdateTransform=this.updateTransform,data.originalCalculateBounds=this.calculateBounds,data.originalGetLocalBounds=this.getLocalBounds,data.originalDestroy=this.destroy,data.originalContainsPoint=this.containsPoint,data.originalMask=this._mask,data.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((data=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=data.originalRender,this.renderCanvas=data.originalRenderCanvas,this.calculateBounds=data.originalCalculateBounds,this.getLocalBounds=data.originalGetLocalBounds,this.destroy=data.originalDestroy,this.updateTransform=data.originalUpdateTransform,this.containsPoint=data.originalContainsPoint,this._mask=data.originalMask,this.filterArea=data.originalFilterArea))}}}),DisplayObject.prototype._renderCached=function(renderer){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(renderer),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(renderer))},DisplayObject.prototype._initCachedDisplayObject=function(renderer){var _a;if(!this._cacheData||!this._cacheData.sprite){var cacheAlpha=this.alpha;this.alpha=1,renderer.batch.flush();var bounds=this.getLocalBounds(null,!0).clone();if(this.filters&&this.filters.length){var padding=this.filters[0].padding;bounds.pad(padding)}bounds.ceil(settings.RESOLUTION);var cachedRenderTexture=renderer.renderTexture.current,cachedSourceFrame=renderer.renderTexture.sourceFrame.clone(),cachedDestinationFrame=renderer.renderTexture.destinationFrame.clone(),cachedProjectionTransform=renderer.projection.transform,renderTexture=RenderTexture.create({width:bounds.width,height:bounds.height,resolution:this.cacheAsBitmapResolution||renderer.resolution,multisample:null!==(_a=this.cacheAsBitmapMultisample)&&void 0!==_a?_a:renderer.multisample}),textureCacheId="cacheAsBitmap_"+uid();this._cacheData.textureCacheId=textureCacheId,BaseTexture.addToCache(renderTexture.baseTexture,textureCacheId),Texture.addToCache(renderTexture,textureCacheId);var m=this.transform.localTransform.copyTo(_tempMatrix).invert().translate(-bounds.x,-bounds.y);this.render=this._cacheData.originalRender,renderer.render(this,{renderTexture:renderTexture,clear:!0,transform:m,skipUpdateTransform:!1}),renderer.framebuffer.blit(),renderer.projection.transform=cachedProjectionTransform,renderer.renderTexture.bind(cachedRenderTexture,cachedSourceFrame,cachedDestinationFrame),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=cacheAlpha;var cachedSprite=new Sprite(renderTexture);cachedSprite.transform.worldTransform=this.transform.worldTransform,cachedSprite.anchor.x=-bounds.x/bounds.width,cachedSprite.anchor.y=-bounds.y/bounds.height,cachedSprite.alpha=cacheAlpha,cachedSprite._bounds=this._bounds,this._cacheData.sprite=cachedSprite,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=cachedSprite.containsPoint.bind(cachedSprite)}},DisplayObject.prototype._renderCachedCanvas=function(renderer){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(renderer),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(renderer))},DisplayObject.prototype._initCachedDisplayObjectCanvas=function(renderer){if(!this._cacheData||!this._cacheData.sprite){var bounds=this.getLocalBounds(null,!0),cacheAlpha=this.alpha;this.alpha=1;var cachedRenderTarget=renderer.context,cachedProjectionTransform=renderer._projTransform;bounds.ceil(settings.RESOLUTION);var renderTexture=RenderTexture.create({width:bounds.width,height:bounds.height}),textureCacheId="cacheAsBitmap_"+uid();this._cacheData.textureCacheId=textureCacheId,BaseTexture.addToCache(renderTexture.baseTexture,textureCacheId),Texture.addToCache(renderTexture,textureCacheId);var m=_tempMatrix;this.transform.localTransform.copyTo(m),m.invert(),m.tx-=bounds.x,m.ty-=bounds.y,this.renderCanvas=this._cacheData.originalRenderCanvas,renderer.render(this,{renderTexture:renderTexture,clear:!0,transform:m,skipUpdateTransform:!1}),renderer.context=cachedRenderTarget,renderer._projTransform=cachedProjectionTransform,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=cacheAlpha;var cachedSprite=new Sprite(renderTexture);cachedSprite.transform.worldTransform=this.transform.worldTransform,cachedSprite.anchor.x=-bounds.x/bounds.width,cachedSprite.anchor.y=-bounds.y/bounds.height,cachedSprite.alpha=cacheAlpha,cachedSprite._bounds=this._bounds,this._cacheData.sprite=cachedSprite,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=renderer._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=cachedSprite.containsPoint.bind(cachedSprite)}},DisplayObject.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},DisplayObject.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},DisplayObject.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,BaseTexture.removeFromCache(this._cacheData.textureCacheId),Texture.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},DisplayObject.prototype._cacheAsBitmapDestroy=function(options){this.cacheAsBitmap=!1,this.destroy(options)},
|
|
332
317
|
/*!
|
|
333
|
-
* @pixi/mixin-get-child-by-name -
|
|
334
|
-
* Compiled
|
|
318
|
+
* @pixi/mixin-get-child-by-name - v6.4.2
|
|
319
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
335
320
|
*
|
|
336
321
|
* @pixi/mixin-get-child-by-name is licensed under the MIT License.
|
|
337
322
|
* http://www.opensource.org/licenses/mit-license
|
|
338
323
|
*/
|
|
339
324
|
DisplayObject.prototype.name=null,Container.prototype.getChildByName=function(name,deep){for(var i=0,j=this.children.length;i<j;i++)if(this.children[i].name===name)return this.children[i];if(deep)for(i=0,j=this.children.length;i<j;i++){if(this.children[i].getChildByName){var target=this.children[i].getChildByName(name,!0);if(target)return target}}return null},
|
|
340
325
|
/*!
|
|
341
|
-
* @pixi/mixin-get-global-position -
|
|
342
|
-
* Compiled
|
|
326
|
+
* @pixi/mixin-get-global-position - v6.4.2
|
|
327
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
343
328
|
*
|
|
344
329
|
* @pixi/mixin-get-global-position is licensed under the MIT License.
|
|
345
330
|
* http://www.opensource.org/licenses/mit-license
|
|
346
331
|
*/
|
|
347
332
|
DisplayObject.prototype.getGlobalPosition=function(point,skipUpdate){return void 0===point&&(point=new Point),void 0===skipUpdate&&(skipUpdate=!1),this.parent?this.parent.toGlobal(this.position,point,skipUpdate):(point.x=this.position.x,point.y=this.position.y),point};
|
|
348
333
|
/*!
|
|
349
|
-
* @pixi/mesh-extras -
|
|
350
|
-
* Compiled
|
|
334
|
+
* @pixi/mesh-extras - v6.4.2
|
|
335
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
351
336
|
*
|
|
352
337
|
* @pixi/mesh-extras is licensed under the MIT License.
|
|
353
338
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -366,10 +351,10 @@ DisplayObject.prototype.getGlobalPosition=function(point,skipUpdate){return void
|
|
|
366
351
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
367
352
|
and limitations under the License.
|
|
368
353
|
***************************************************************************** */
|
|
369
|
-
var extendStatics$j=function(d,b){return(extendStatics$j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};function __extends$j(d,b){function __(){this.constructor=d}extendStatics$j(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var PlaneGeometry=function(_super){function PlaneGeometry(width,height,segWidth,segHeight){void 0===width&&(width=100),void 0===height&&(height=100),void 0===segWidth&&(segWidth=10),void 0===segHeight&&(segHeight=10);var _this=_super.call(this)||this;return _this.segWidth=segWidth,_this.segHeight=segHeight,_this.width=width,_this.height=height,_this.build(),_this}return __extends$j(PlaneGeometry,_super),PlaneGeometry.prototype.build=function(){for(var total=this.segWidth*this.segHeight,verts=[],uvs=[],indices=[],segmentsX=this.segWidth-1,segmentsY=this.segHeight-1,sizeX=this.width/segmentsX,sizeY=this.height/segmentsY,i=0;i<total;i++){var x=i%this.segWidth,y=i/this.segWidth|0;verts.push(x*sizeX,y*sizeY),uvs.push(x/segmentsX,y/segmentsY)}var totalSub=segmentsX*segmentsY;for(i=0;i<totalSub;i++){var xpos=i%segmentsX,ypos=i/segmentsX|0,value=ypos*this.segWidth+xpos,value2=ypos*this.segWidth+xpos+1,value3=(ypos+1)*this.segWidth+xpos,value4=(ypos+1)*this.segWidth+xpos+1;indices.push(value,value2,value3,value2,value4,value3)}this.buffers[0].data=new Float32Array(verts),this.buffers[1].data=new Float32Array(uvs),this.indexBuffer.data=new Uint16Array(indices),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},PlaneGeometry}(MeshGeometry),RopeGeometry=function(_super){function RopeGeometry(width,points,textureScale){void 0===width&&(width=200),void 0===textureScale&&(textureScale=0);var _this=_super.call(this,new Float32Array(4*points.length),new Float32Array(4*points.length),new Uint16Array(6*(points.length-1)))||this;return _this.points=points,_this._width=width,_this.textureScale=textureScale,_this.build(),_this}return __extends$j(RopeGeometry,_super),Object.defineProperty(RopeGeometry.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),RopeGeometry.prototype.build=function(){var points=this.points;if(points){var vertexBuffer=this.getBuffer("aVertexPosition"),uvBuffer=this.getBuffer("aTextureCoord"),indexBuffer=this.getIndex();if(!(points.length<1)){vertexBuffer.data.length/4!==points.length&&(vertexBuffer.data=new Float32Array(4*points.length),uvBuffer.data=new Float32Array(4*points.length),indexBuffer.data=new Uint16Array(6*(points.length-1)));var uvs=uvBuffer.data,indices=indexBuffer.data;uvs[0]=0,uvs[1]=0,uvs[2]=0,uvs[3]=1;for(var amount=0,prev=points[0],textureWidth=this._width*this.textureScale,total=points.length,i=0;i<total;i++){var index=4*i;if(this.textureScale>0){var dx=prev.x-points[i].x,dy=prev.y-points[i].y,distance=Math.sqrt(dx*dx+dy*dy);prev=points[i],amount+=distance/textureWidth}else amount=i/(total-1);uvs[index]=amount,uvs[index+1]=0,uvs[index+2]=amount,uvs[index+3]=1}var indexCount=0;for(i=0;i<total-1;i++){index=2*i;indices[indexCount++]=index,indices[indexCount++]=index+1,indices[indexCount++]=index+2,indices[indexCount++]=index+2,indices[indexCount++]=index+1,indices[indexCount++]=index+3}uvBuffer.update(),indexBuffer.update(),this.updateVertices()}}},RopeGeometry.prototype.updateVertices=function(){var points=this.points;if(!(points.length<1)){for(var nextPoint,lastPoint=points[0],perpX=0,perpY=0,vertices=this.buffers[0].data,total=points.length,i=0;i<total;i++){var point=points[i],index=4*i;perpY=-((nextPoint=i<points.length-1?points[i+1]:point).x-lastPoint.x),perpX=nextPoint.y-lastPoint.y;var perpLength=Math.sqrt(perpX*perpX+perpY*perpY),num=this.textureScale>0?this.textureScale*this._width/2:this._width/2;perpX/=perpLength,perpY/=perpLength,perpX*=num,perpY*=num,vertices[index]=point.x+perpX,vertices[index+1]=point.y+perpY,vertices[index+2]=point.x-perpX,vertices[index+3]=point.y-perpY,lastPoint=point}this.buffers[0].update()}},RopeGeometry.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},RopeGeometry}(MeshGeometry),SimpleRope=function(_super){function SimpleRope(texture,points,textureScale){void 0===textureScale&&(textureScale=0);var _this=this,ropeGeometry=new RopeGeometry(texture.height,points,textureScale),meshMaterial=new MeshMaterial(texture);return textureScale>0&&(texture.baseTexture.wrapMode=WRAP_MODES.REPEAT),(_this=_super.call(this,ropeGeometry,meshMaterial)||this).autoUpdate=!0,_this}return __extends$j(SimpleRope,_super),SimpleRope.prototype._render=function(renderer){var geometry=this.geometry;(this.autoUpdate||geometry._width!==this.shader.texture.height)&&(geometry._width=this.shader.texture.height,geometry.update()),_super.prototype._render.call(this,renderer)},SimpleRope}(Mesh),SimplePlane=function(_super){function SimplePlane(texture,verticesX,verticesY){var _this=this,planeGeometry=new PlaneGeometry(texture.width,texture.height,verticesX,verticesY),meshMaterial=new MeshMaterial(Texture.WHITE);return(_this=_super.call(this,planeGeometry,meshMaterial)||this).texture=texture,_this}return __extends$j(SimplePlane,_super),SimplePlane.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var geometry=this.geometry;geometry.width=this.shader.texture.width,geometry.height=this.shader.texture.height,geometry.build()},Object.defineProperty(SimplePlane.prototype,"texture",{get:function(){return this.shader.texture},set:function(value){this.shader.texture!==value&&(this.shader.texture=value,this._textureID=-1,value.baseTexture.valid?this.textureUpdated():value.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),SimplePlane.prototype._render=function(renderer){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),_super.prototype._render.call(this,renderer)},SimplePlane.prototype.destroy=function(options){this.shader.texture.off("update",this.textureUpdated,this),_super.prototype.destroy.call(this,options)},SimplePlane}(Mesh);!function(_super){function SimpleMesh(texture,vertices,uvs,indices,drawMode){void 0===texture&&(texture=Texture.EMPTY);var _this=this,geometry=new MeshGeometry(vertices,uvs,indices);geometry.getBuffer("aVertexPosition").static=!1;var meshMaterial=new MeshMaterial(texture);return(_this=_super.call(this,geometry,meshMaterial,null,drawMode)||this).autoUpdate=!0,_this}__extends$j(SimpleMesh,_super),Object.defineProperty(SimpleMesh.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(value){this.geometry.getBuffer("aVertexPosition").data=value},enumerable:!1,configurable:!0}),SimpleMesh.prototype._render=function(renderer){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),_super.prototype._render.call(this,renderer)}}(Mesh);!function(_super){function NineSlicePlane(texture,leftWidth,topHeight,rightWidth,bottomHeight){void 0===leftWidth&&(leftWidth=10),void 0===topHeight&&(topHeight=10),void 0===rightWidth&&(rightWidth=10),void 0===bottomHeight&&(bottomHeight=10);var _this=_super.call(this,Texture.WHITE,4,4)||this;return _this._origWidth=texture.orig.width,_this._origHeight=texture.orig.height,_this._width=_this._origWidth,_this._height=_this._origHeight,_this._leftWidth=leftWidth,_this._rightWidth=rightWidth,_this._topHeight=topHeight,_this._bottomHeight=bottomHeight,_this.texture=texture,_this}__extends$j(NineSlicePlane,_super),NineSlicePlane.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(NineSlicePlane.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(value){this.geometry.getBuffer("aVertexPosition").data=value},enumerable:!1,configurable:!0}),NineSlicePlane.prototype.updateHorizontalVertices=function(){var vertices=this.vertices,scale=this._getMinScale();vertices[9]=vertices[11]=vertices[13]=vertices[15]=this._topHeight*scale,vertices[17]=vertices[19]=vertices[21]=vertices[23]=this._height-this._bottomHeight*scale,vertices[25]=vertices[27]=vertices[29]=vertices[31]=this._height},NineSlicePlane.prototype.updateVerticalVertices=function(){var vertices=this.vertices,scale=this._getMinScale();vertices[2]=vertices[10]=vertices[18]=vertices[26]=this._leftWidth*scale,vertices[4]=vertices[12]=vertices[20]=vertices[28]=this._width-this._rightWidth*scale,vertices[6]=vertices[14]=vertices[22]=vertices[30]=this._width},NineSlicePlane.prototype._getMinScale=function(){var w=this._leftWidth+this._rightWidth,scaleW=this._width>w?1:this._width/w,h=this._topHeight+this._bottomHeight,scaleH=this._height>h?1:this._height/h;return Math.min(scaleW,scaleH)},Object.defineProperty(NineSlicePlane.prototype,"width",{get:function(){return this._width},set:function(value){this._width=value,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(NineSlicePlane.prototype,"height",{get:function(){return this._height},set:function(value){this._height=value,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(NineSlicePlane.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(value){this._leftWidth=value,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(NineSlicePlane.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(value){this._rightWidth=value,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(NineSlicePlane.prototype,"topHeight",{get:function(){return this._topHeight},set:function(value){this._topHeight=value,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(NineSlicePlane.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(value){this._bottomHeight=value,this._refresh()},enumerable:!1,configurable:!0}),NineSlicePlane.prototype._refresh=function(){var texture=this.texture,uvs=this.geometry.buffers[1].data;this._origWidth=texture.orig.width,this._origHeight=texture.orig.height;var _uvw=1/this._origWidth,_uvh=1/this._origHeight;uvs[0]=uvs[8]=uvs[16]=uvs[24]=0,uvs[1]=uvs[3]=uvs[5]=uvs[7]=0,uvs[6]=uvs[14]=uvs[22]=uvs[30]=1,uvs[25]=uvs[27]=uvs[29]=uvs[31]=1,uvs[2]=uvs[10]=uvs[18]=uvs[26]=_uvw*this._leftWidth,uvs[4]=uvs[12]=uvs[20]=uvs[28]=1-_uvw*this._rightWidth,uvs[9]=uvs[11]=uvs[13]=uvs[15]=_uvh*this._topHeight,uvs[17]=uvs[19]=uvs[21]=uvs[23]=1-_uvh*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}(SimplePlane);
|
|
354
|
+
var extendStatics$k=function(d,b){return extendStatics$k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$k(d,b)};function __extends$k(d,b){function __(){this.constructor=d}extendStatics$k(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var PlaneGeometry=function(_super){function PlaneGeometry(width,height,segWidth,segHeight){void 0===width&&(width=100),void 0===height&&(height=100),void 0===segWidth&&(segWidth=10),void 0===segHeight&&(segHeight=10);var _this=_super.call(this)||this;return _this.segWidth=segWidth,_this.segHeight=segHeight,_this.width=width,_this.height=height,_this.build(),_this}return __extends$k(PlaneGeometry,_super),PlaneGeometry.prototype.build=function(){for(var total=this.segWidth*this.segHeight,verts=[],uvs=[],indices=[],segmentsX=this.segWidth-1,segmentsY=this.segHeight-1,sizeX=this.width/segmentsX,sizeY=this.height/segmentsY,i=0;i<total;i++){var x=i%this.segWidth,y=i/this.segWidth|0;verts.push(x*sizeX,y*sizeY),uvs.push(x/segmentsX,y/segmentsY)}var totalSub=segmentsX*segmentsY;for(i=0;i<totalSub;i++){var xpos=i%segmentsX,ypos=i/segmentsX|0,value=ypos*this.segWidth+xpos,value2=ypos*this.segWidth+xpos+1,value3=(ypos+1)*this.segWidth+xpos,value4=(ypos+1)*this.segWidth+xpos+1;indices.push(value,value2,value3,value2,value4,value3)}this.buffers[0].data=new Float32Array(verts),this.buffers[1].data=new Float32Array(uvs),this.indexBuffer.data=new Uint16Array(indices),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()},PlaneGeometry}(MeshGeometry),RopeGeometry=function(_super){function RopeGeometry(width,points,textureScale){void 0===width&&(width=200),void 0===textureScale&&(textureScale=0);var _this=_super.call(this,new Float32Array(4*points.length),new Float32Array(4*points.length),new Uint16Array(6*(points.length-1)))||this;return _this.points=points,_this._width=width,_this.textureScale=textureScale,_this.build(),_this}return __extends$k(RopeGeometry,_super),Object.defineProperty(RopeGeometry.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),RopeGeometry.prototype.build=function(){var points=this.points;if(points){var vertexBuffer=this.getBuffer("aVertexPosition"),uvBuffer=this.getBuffer("aTextureCoord"),indexBuffer=this.getIndex();if(!(points.length<1)){vertexBuffer.data.length/4!==points.length&&(vertexBuffer.data=new Float32Array(4*points.length),uvBuffer.data=new Float32Array(4*points.length),indexBuffer.data=new Uint16Array(6*(points.length-1)));var uvs=uvBuffer.data,indices=indexBuffer.data;uvs[0]=0,uvs[1]=0,uvs[2]=0,uvs[3]=1;for(var amount=0,prev=points[0],textureWidth=this._width*this.textureScale,total=points.length,i=0;i<total;i++){var index=4*i;if(this.textureScale>0){var dx=prev.x-points[i].x,dy=prev.y-points[i].y,distance=Math.sqrt(dx*dx+dy*dy);prev=points[i],amount+=distance/textureWidth}else amount=i/(total-1);uvs[index]=amount,uvs[index+1]=0,uvs[index+2]=amount,uvs[index+3]=1}var indexCount=0;for(i=0;i<total-1;i++){index=2*i;indices[indexCount++]=index,indices[indexCount++]=index+1,indices[indexCount++]=index+2,indices[indexCount++]=index+2,indices[indexCount++]=index+1,indices[indexCount++]=index+3}uvBuffer.update(),indexBuffer.update(),this.updateVertices()}}},RopeGeometry.prototype.updateVertices=function(){var points=this.points;if(!(points.length<1)){for(var nextPoint,lastPoint=points[0],perpX=0,perpY=0,vertices=this.buffers[0].data,total=points.length,i=0;i<total;i++){var point=points[i],index=4*i;perpY=-((nextPoint=i<points.length-1?points[i+1]:point).x-lastPoint.x),perpX=nextPoint.y-lastPoint.y;var perpLength=Math.sqrt(perpX*perpX+perpY*perpY),num=this.textureScale>0?this.textureScale*this._width/2:this._width/2;perpX/=perpLength,perpY/=perpLength,perpX*=num,perpY*=num,vertices[index]=point.x+perpX,vertices[index+1]=point.y+perpY,vertices[index+2]=point.x-perpX,vertices[index+3]=point.y-perpY,lastPoint=point}this.buffers[0].update()}},RopeGeometry.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},RopeGeometry}(MeshGeometry),SimpleRope=function(_super){function SimpleRope(texture,points,textureScale){void 0===textureScale&&(textureScale=0);var _this=this,ropeGeometry=new RopeGeometry(texture.height,points,textureScale),meshMaterial=new MeshMaterial(texture);return textureScale>0&&(texture.baseTexture.wrapMode=WRAP_MODES$1.REPEAT),(_this=_super.call(this,ropeGeometry,meshMaterial)||this).autoUpdate=!0,_this}return __extends$k(SimpleRope,_super),SimpleRope.prototype._render=function(renderer){var geometry=this.geometry;(this.autoUpdate||geometry._width!==this.shader.texture.height)&&(geometry._width=this.shader.texture.height,geometry.update()),_super.prototype._render.call(this,renderer)},SimpleRope}(Mesh),SimplePlane=function(_super){function SimplePlane(texture,verticesX,verticesY){var _this=this,planeGeometry=new PlaneGeometry(texture.width,texture.height,verticesX,verticesY),meshMaterial=new MeshMaterial(Texture.WHITE);return(_this=_super.call(this,planeGeometry,meshMaterial)||this).texture=texture,_this.autoResize=!0,_this}return __extends$k(SimplePlane,_super),SimplePlane.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var geometry=this.geometry,_a=this.shader.texture,width=_a.width,height=_a.height;!this.autoResize||geometry.width===width&&geometry.height===height||(geometry.width=this.shader.texture.width,geometry.height=this.shader.texture.height,geometry.build())},Object.defineProperty(SimplePlane.prototype,"texture",{get:function(){return this.shader.texture},set:function(value){this.shader.texture!==value&&(this.shader.texture=value,this._textureID=-1,value.baseTexture.valid?this.textureUpdated():value.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),SimplePlane.prototype._render=function(renderer){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),_super.prototype._render.call(this,renderer)},SimplePlane.prototype.destroy=function(options){this.shader.texture.off("update",this.textureUpdated,this),_super.prototype.destroy.call(this,options)},SimplePlane}(Mesh);!function(_super){function SimpleMesh(texture,vertices,uvs,indices,drawMode){void 0===texture&&(texture=Texture.EMPTY);var _this=this,geometry=new MeshGeometry(vertices,uvs,indices);geometry.getBuffer("aVertexPosition").static=!1;var meshMaterial=new MeshMaterial(texture);return(_this=_super.call(this,geometry,meshMaterial,null,drawMode)||this).autoUpdate=!0,_this}__extends$k(SimpleMesh,_super),Object.defineProperty(SimpleMesh.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(value){this.geometry.getBuffer("aVertexPosition").data=value},enumerable:!1,configurable:!0}),SimpleMesh.prototype._render=function(renderer){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),_super.prototype._render.call(this,renderer)}}(Mesh);!function(_super){function NineSlicePlane(texture,leftWidth,topHeight,rightWidth,bottomHeight){void 0===leftWidth&&(leftWidth=10),void 0===topHeight&&(topHeight=10),void 0===rightWidth&&(rightWidth=10),void 0===bottomHeight&&(bottomHeight=10);var _this=_super.call(this,Texture.WHITE,4,4)||this;return _this._origWidth=texture.orig.width,_this._origHeight=texture.orig.height,_this._width=_this._origWidth,_this._height=_this._origHeight,_this._leftWidth=leftWidth,_this._rightWidth=rightWidth,_this._topHeight=topHeight,_this._bottomHeight=bottomHeight,_this.texture=texture,_this}__extends$k(NineSlicePlane,_super),NineSlicePlane.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(NineSlicePlane.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(value){this.geometry.getBuffer("aVertexPosition").data=value},enumerable:!1,configurable:!0}),NineSlicePlane.prototype.updateHorizontalVertices=function(){var vertices=this.vertices,scale=this._getMinScale();vertices[9]=vertices[11]=vertices[13]=vertices[15]=this._topHeight*scale,vertices[17]=vertices[19]=vertices[21]=vertices[23]=this._height-this._bottomHeight*scale,vertices[25]=vertices[27]=vertices[29]=vertices[31]=this._height},NineSlicePlane.prototype.updateVerticalVertices=function(){var vertices=this.vertices,scale=this._getMinScale();vertices[2]=vertices[10]=vertices[18]=vertices[26]=this._leftWidth*scale,vertices[4]=vertices[12]=vertices[20]=vertices[28]=this._width-this._rightWidth*scale,vertices[6]=vertices[14]=vertices[22]=vertices[30]=this._width},NineSlicePlane.prototype._getMinScale=function(){var w=this._leftWidth+this._rightWidth,scaleW=this._width>w?1:this._width/w,h=this._topHeight+this._bottomHeight,scaleH=this._height>h?1:this._height/h;return Math.min(scaleW,scaleH)},Object.defineProperty(NineSlicePlane.prototype,"width",{get:function(){return this._width},set:function(value){this._width=value,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(NineSlicePlane.prototype,"height",{get:function(){return this._height},set:function(value){this._height=value,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(NineSlicePlane.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(value){this._leftWidth=value,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(NineSlicePlane.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(value){this._rightWidth=value,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(NineSlicePlane.prototype,"topHeight",{get:function(){return this._topHeight},set:function(value){this._topHeight=value,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(NineSlicePlane.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(value){this._bottomHeight=value,this._refresh()},enumerable:!1,configurable:!0}),NineSlicePlane.prototype._refresh=function(){var texture=this.texture,uvs=this.geometry.buffers[1].data;this._origWidth=texture.orig.width,this._origHeight=texture.orig.height;var _uvw=1/this._origWidth,_uvh=1/this._origHeight;uvs[0]=uvs[8]=uvs[16]=uvs[24]=0,uvs[1]=uvs[3]=uvs[5]=uvs[7]=0,uvs[6]=uvs[14]=uvs[22]=uvs[30]=1,uvs[25]=uvs[27]=uvs[29]=uvs[31]=1,uvs[2]=uvs[10]=uvs[18]=uvs[26]=_uvw*this._leftWidth,uvs[4]=uvs[12]=uvs[20]=uvs[28]=1-_uvw*this._rightWidth,uvs[9]=uvs[11]=uvs[13]=uvs[15]=_uvh*this._topHeight,uvs[17]=uvs[19]=uvs[21]=uvs[23]=1-_uvh*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}(SimplePlane);
|
|
370
355
|
/*!
|
|
371
|
-
* @pixi/sprite-animated -
|
|
372
|
-
* Compiled
|
|
356
|
+
* @pixi/sprite-animated - v6.4.2
|
|
357
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
373
358
|
*
|
|
374
359
|
* @pixi/sprite-animated is licensed under the MIT License.
|
|
375
360
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -388,15 +373,15 @@ var extendStatics$j=function(d,b){return(extendStatics$j=Object.setPrototypeOf||
|
|
|
388
373
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
389
374
|
and limitations under the License.
|
|
390
375
|
***************************************************************************** */
|
|
391
|
-
var extendStatics$
|
|
376
|
+
var extendStatics$l=function(d,b){return extendStatics$l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},extendStatics$l(d,b)};!function(_super){function AnimatedSprite(textures,autoUpdate){void 0===autoUpdate&&(autoUpdate=!0);var _this=_super.call(this,textures[0]instanceof Texture?textures[0]:textures[0].texture)||this;return _this._textures=null,_this._durations=null,_this._autoUpdate=autoUpdate,_this._isConnectedToTicker=!1,_this.animationSpeed=1,_this.loop=!0,_this.updateAnchor=!1,_this.onComplete=null,_this.onFrameChange=null,_this.onLoop=null,_this._currentTime=0,_this._playing=!1,_this._previousFrame=null,_this.textures=textures,_this}(function(d,b){function __(){this.constructor=d}extendStatics$l(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)})(AnimatedSprite,_super),AnimatedSprite.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1))},AnimatedSprite.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(Ticker.shared.add(this.update,this,UPDATE_PRIORITY.HIGH),this._isConnectedToTicker=!0))},AnimatedSprite.prototype.gotoAndStop=function(frameNumber){this.stop();var previousFrame=this.currentFrame;this._currentTime=frameNumber,previousFrame!==this.currentFrame&&this.updateTexture()},AnimatedSprite.prototype.gotoAndPlay=function(frameNumber){var previousFrame=this.currentFrame;this._currentTime=frameNumber,previousFrame!==this.currentFrame&&this.updateTexture(),this.play()},AnimatedSprite.prototype.update=function(deltaTime){if(this._playing){var elapsed=this.animationSpeed*deltaTime,previousFrame=this.currentFrame;if(null!==this._durations){var lag=this._currentTime%1*this._durations[this.currentFrame];for(lag+=elapsed/60*1e3;lag<0;)this._currentTime--,lag+=this._durations[this.currentFrame];var sign=Math.sign(this.animationSpeed*deltaTime);for(this._currentTime=Math.floor(this._currentTime);lag>=this._durations[this.currentFrame];)lag-=this._durations[this.currentFrame]*sign,this._currentTime+=sign;this._currentTime+=lag/this._durations[this.currentFrame]}else this._currentTime+=elapsed;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):previousFrame!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<previousFrame||this.animationSpeed<0&&this.currentFrame>previousFrame)&&this.onLoop(),this.updateTexture())}},AnimatedSprite.prototype.updateTexture=function(){var currentFrame=this.currentFrame;this._previousFrame!==currentFrame&&(this._previousFrame=currentFrame,this._texture=this._textures[currentFrame],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},AnimatedSprite.prototype.destroy=function(options){this.stop(),_super.prototype.destroy.call(this,options),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},AnimatedSprite.fromFrames=function(frames){for(var textures=[],i=0;i<frames.length;++i)textures.push(Texture.from(frames[i]));return new AnimatedSprite(textures)},AnimatedSprite.fromImages=function(images){for(var textures=[],i=0;i<images.length;++i)textures.push(Texture.from(images[i]));return new AnimatedSprite(textures)},Object.defineProperty(AnimatedSprite.prototype,"totalFrames",{get:function(){return this._textures.length},enumerable:!1,configurable:!0}),Object.defineProperty(AnimatedSprite.prototype,"textures",{get:function(){return this._textures},set:function(value){if(value[0]instanceof Texture)this._textures=value,this._durations=null;else{this._textures=[],this._durations=[];for(var i=0;i<value.length;i++)this._textures.push(value[i].texture),this._durations.push(value[i].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()},enumerable:!1,configurable:!0}),Object.defineProperty(AnimatedSprite.prototype,"currentFrame",{get:function(){var currentFrame=Math.floor(this._currentTime)%this._textures.length;return currentFrame<0&&(currentFrame+=this._textures.length),currentFrame},enumerable:!1,configurable:!0}),Object.defineProperty(AnimatedSprite.prototype,"playing",{get:function(){return this._playing},enumerable:!1,configurable:!0}),Object.defineProperty(AnimatedSprite.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(value){value!==this._autoUpdate&&(this._autoUpdate=value,!this._autoUpdate&&this._isConnectedToTicker?(Ticker.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(Ticker.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0})}(Sprite),
|
|
392
377
|
/*!
|
|
393
|
-
* pixi.js -
|
|
394
|
-
* Compiled
|
|
378
|
+
* pixi.js - v6.4.2
|
|
379
|
+
* Compiled Thu, 02 Jun 2022 15:39:26 UTC
|
|
395
380
|
*
|
|
396
381
|
* pixi.js is licensed under the MIT License.
|
|
397
382
|
* http://www.opensource.org/licenses/mit-license
|
|
398
383
|
*/
|
|
399
|
-
Renderer.registerPlugin("accessibility",AccessibilityManager),Renderer.registerPlugin("extract",Extract),Renderer.registerPlugin("interaction",InteractionManager),Renderer.registerPlugin("particle",ParticleRenderer),Renderer.registerPlugin("prepare",Prepare),Renderer.registerPlugin("batch",BatchRenderer),Renderer.registerPlugin("tilingSprite",TilingSpriteRenderer),Loader$1.registerPlugin(BitmapFontLoader),Loader$1.registerPlugin(SpritesheetLoader),Application.registerPlugin(TickerPlugin),Application.registerPlugin(AppLoaderPlugin);var PixiLayer=function(_super){function PixiLayer(id,options){return _super.call(this,id,options)||this}return __extends(PixiLayer,_super),PixiLayer.prototype.onMount=function(event){if(_super.prototype.onMount.call(this,event),!this.elm){var container=document.createElement("div");container.setAttribute("id",""+this.id),container.setAttribute("class","webgl-layer"),this.elm=container,this.updateStyle();var elm=event.elm,height=event.height,width=event.width,pixiApplicationOptions=this.options.pixiApplicationOptions,pixiOptions=__assign({width:width||parseInt(this.elm.getAttribute("width"),10)||200,height:height||parseInt(this.elm.getAttribute("height"),10)||300,antialias:!0,transparent:!0,clearBeforeRender:!0,autoResize:!0,preserveDrawingBuffer:!0},pixiApplicationOptions);this.ctx=new Application(pixiOptions),container.appendChild(this.ctx.view),elm.appendChild(container)}},PixiLayer.prototype.onUnmount=function(event){var _a,_b;_super.prototype.onUnmount.call(this,event);var renderType=this.renderType(),glContext=null===(_a=this.ctx.renderer)||void 0===_a?void 0:_a.gl;this.ctx.stop(),this.ctx.destroy(!0,{children:!0,texture:!0,baseTexture:!0}),renderType===RENDERER_TYPE.WEBGL&&(null===(_b=null==glContext?void 0:glContext.getExtension("WEBGL_lose_context"))||void 0===_b||_b.loseContext()),this.elm.remove(),this.elm=null,this.ctx=null},PixiLayer.prototype.onResize=function(event){_super.prototype.onResize.call(this,event),this.ctx.renderer.resize(event.width,event.height)},PixiLayer.prototype.onRescale=function(event){if(_super.prototype.onRescale.call(this,event),this.ctx){var flippedX=event.xBounds[0]>event.xBounds[1],flippedY=event.yBounds[0]>event.yBounds[1];this.ctx.stage.position.set(event.xScale(0),event.yScale(0)),this.ctx.stage.scale.set(event.xRatio*(flippedX?-1:1),event.yRatio*(flippedY?-1:1))}},PixiLayer.prototype.updateStyle=function(visible){var visibility=visible||this.isVisible?"visible":"hidden",interactive=this.interactive?"auto":"none";this.elm.setAttribute("style","position:absolute;pointer-events:"+interactive+";z-index:"+this.order+";opacity:"+this.opacity+";visibility:"+visibility)},PixiLayer.prototype.setVisibility=function(visible){_super.prototype.setVisibility.call(this,visible),this.elm&&this.updateStyle(visible)},PixiLayer.prototype.onOpacityChanged=function(opacity){this.elm&&this.updateStyle()},PixiLayer.prototype.onOrderChanged=function(order){this.elm&&this.updateStyle()},PixiLayer.prototype.onInteractivityChanged=function(interactive){this.elm&&this.updateStyle()},PixiLayer.prototype.renderType=function(){return this.ctx.renderer.type},PixiLayer}(Layer),GeomodelLayerV2=function(_super){function GeomodelLayerV2(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.isRendered=!1,_this.createPolygons=function(data){for(var polygons=[],polygon=null,i=0;i<data.length;i++){var topIsValid=!!data[i][1];topIsValid&&(null===polygon&&(polygon=[]),polygon.push(data[i][0],data[i][1]));var endIsReached=i===data.length-1;if((!topIsValid||endIsReached)&&polygon){for(var j=topIsValid?i:i-1;j>=0&&data[j][1];j--)polygon.push(data[j][0],data[j][2]||1e4);polygons.push(polygon),polygon=null}}return polygons},_this.generateAreaPolygon=function(s){var g=new Graphics;g.lineStyle(1,s.color,1),g.beginFill(s.color),_this.createPolygons(s.data).forEach((function(polygon){return g.drawPolygon(polygon)})),g.endFill(),_this.ctx.stage.addChild(g)},_this.generateSurfaceLine=function(s){var g=new Graphics,d=s.data;g.lineStyle(1,s.color,1,.5,!0);for(var penDown=!1,i=0;i<d.length;i++)d[i][1]?penDown?g.lineTo(d[i][0],d[i][1]):(g.moveTo(d[i][0],d[i][1]),penDown=!0):penDown=!1;_this.ctx.stage.addChild(g)},_this}return __extends(GeomodelLayerV2,_super),GeomodelLayerV2.prototype.onRescale=function(event){_super.prototype.onRescale.call(this,event),this.isRendered||this.render()},GeomodelLayerV2.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.isRendered=!1,this.cleanUpStage(),this.render()},GeomodelLayerV2.prototype.cleanUpStage=function(){this.ctx.stage.children.forEach((function(g){return g.destroy()})),this.ctx.stage.removeChildren()},GeomodelLayerV2.prototype.render=function(){var _this=this,data=this.data;data&&(data.areas.forEach((function(a){return _this.generateAreaPolygon(a)})),data.lines.forEach((function(l){return _this.generateSurfaceLine(l)})),this.isRendered=!0)},GeomodelLayerV2}(PixiLayer),GeomodelLayer=function(_super){function GeomodelLayer(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(GeomodelLayer,_super),GeomodelLayer}(GeomodelLayerV2);function define(constructor,factory,prototype){constructor.prototype=factory.prototype=prototype,prototype.constructor=constructor}function extend(parent,definition){var prototype=Object.create(parent.prototype);for(var key in definition)prototype[key]=definition[key];return prototype}function Color(){}var brighter=1/.7,reI="\\s*([+-]?\\d+)\\s*",reN="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",reP="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",reHex=/^#([0-9a-f]{3,8})$/,reRgbInteger=new RegExp("^rgb\\("+[reI,reI,reI]+"\\)$"),reRgbPercent=new RegExp("^rgb\\("+[reP,reP,reP]+"\\)$"),reRgbaInteger=new RegExp("^rgba\\("+[reI,reI,reI,reN]+"\\)$"),reRgbaPercent=new RegExp("^rgba\\("+[reP,reP,reP,reN]+"\\)$"),reHslPercent=new RegExp("^hsl\\("+[reN,reP,reP]+"\\)$"),reHslaPercent=new RegExp("^hsla\\("+[reN,reP,reP,reN]+"\\)$"),named={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function color_formatHex(){return this.rgb().formatHex()}function color_formatRgb(){return this.rgb().formatRgb()}function color(format){var m,l;return format=(format+"").trim().toLowerCase(),(m=reHex.exec(format))?(l=m[1].length,m=parseInt(m[1],16),6===l?rgbn(m):3===l?new Rgb(m>>8&15|m>>4&240,m>>4&15|240&m,(15&m)<<4|15&m,1):8===l?rgba(m>>24&255,m>>16&255,m>>8&255,(255&m)/255):4===l?rgba(m>>12&15|m>>8&240,m>>8&15|m>>4&240,m>>4&15|240&m,((15&m)<<4|15&m)/255):null):(m=reRgbInteger.exec(format))?new Rgb(m[1],m[2],m[3],1):(m=reRgbPercent.exec(format))?new Rgb(255*m[1]/100,255*m[2]/100,255*m[3]/100,1):(m=reRgbaInteger.exec(format))?rgba(m[1],m[2],m[3],m[4]):(m=reRgbaPercent.exec(format))?rgba(255*m[1]/100,255*m[2]/100,255*m[3]/100,m[4]):(m=reHslPercent.exec(format))?hsla(m[1],m[2]/100,m[3]/100,1):(m=reHslaPercent.exec(format))?hsla(m[1],m[2]/100,m[3]/100,m[4]):named.hasOwnProperty(format)?rgbn(named[format]):"transparent"===format?new Rgb(NaN,NaN,NaN,0):null}function rgbn(n){return new Rgb(n>>16&255,n>>8&255,255&n,1)}function rgba(r,g,b,a){return a<=0&&(r=g=b=NaN),new Rgb(r,g,b,a)}function rgbConvert(o){return o instanceof Color||(o=color(o)),o?new Rgb((o=o.rgb()).r,o.g,o.b,o.opacity):new Rgb}function rgb(r,g,b,opacity){return 1===arguments.length?rgbConvert(r):new Rgb(r,g,b,null==opacity?1:opacity)}function Rgb(r,g,b,opacity){this.r=+r,this.g=+g,this.b=+b,this.opacity=+opacity}function rgb_formatHex(){return"#"+hex(this.r)+hex(this.g)+hex(this.b)}function rgb_formatRgb(){var a=this.opacity;return(1===(a=isNaN(a)?1:Math.max(0,Math.min(1,a)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===a?")":", "+a+")")}function hex(value){return((value=Math.max(0,Math.min(255,Math.round(value)||0)))<16?"0":"")+value.toString(16)}function hsla(h,s,l,a){return a<=0?h=s=l=NaN:l<=0||l>=1?h=s=NaN:s<=0&&(h=NaN),new Hsl(h,s,l,a)}function hslConvert(o){if(o instanceof Hsl)return new Hsl(o.h,o.s,o.l,o.opacity);if(o instanceof Color||(o=color(o)),!o)return new Hsl;if(o instanceof Hsl)return o;var r=(o=o.rgb()).r/255,g=o.g/255,b=o.b/255,min=Math.min(r,g,b),max=Math.max(r,g,b),h=NaN,s=max-min,l=(max+min)/2;return s?(h=r===max?(g-b)/s+6*(g<b):g===max?(b-r)/s+2:(r-g)/s+4,s/=l<.5?max+min:2-max-min,h*=60):s=l>0&&l<1?0:h,new Hsl(h,s,l,o.opacity)}function Hsl(h,s,l,opacity){this.h=+h,this.s=+s,this.l=+l,this.opacity=+opacity}function hsl2rgb(h,m1,m2){return 255*(h<60?m1+(m2-m1)*h/60:h<180?m2:h<240?m1+(m2-m1)*(240-h)/60:m1)}function convertColor(colorStr){var d=color(colorStr).hex();return parseInt(d.replace("#","0x"))}define(Color,color,{copy:function(channels){return Object.assign(new this.constructor,this,channels)},displayable:function(){return this.rgb().displayable()},hex:color_formatHex,formatHex:color_formatHex,formatHsl:function(){return hslConvert(this).formatHsl()},formatRgb:color_formatRgb,toString:color_formatRgb}),define(Rgb,rgb,extend(Color,{brighter:function(k){return k=null==k?brighter:Math.pow(brighter,k),new Rgb(this.r*k,this.g*k,this.b*k,this.opacity)},darker:function(k){return k=null==k?.7:Math.pow(.7,k),new Rgb(this.r*k,this.g*k,this.b*k,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:rgb_formatHex,formatHex:rgb_formatHex,formatRgb:rgb_formatRgb,toString:rgb_formatRgb})),define(Hsl,(function(h,s,l,opacity){return 1===arguments.length?hslConvert(h):new Hsl(h,s,l,null==opacity?1:opacity)}),extend(Color,{brighter:function(k){return k=null==k?brighter:Math.pow(brighter,k),new Hsl(this.h,this.s,this.l*k,this.opacity)},darker:function(k){return k=null==k?.7:Math.pow(.7,k),new Hsl(this.h,this.s,this.l*k,this.opacity)},rgb:function(){var h=this.h%360+360*(this.h<0),s=isNaN(h)||isNaN(this.s)?0:this.s,l=this.l,m2=l+(l<.5?l:1-l)*s,m1=2*l-m2;return new Rgb(hsl2rgb(h>=240?h-240:h+120,m1,m2),hsl2rgb(h,m1,m2),hsl2rgb(h<120?h+240:h-120,m1,m2),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var a=this.opacity;return(1===(a=isNaN(a)?1:Math.max(0,Math.min(1,a)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===a?")":", "+a+")")}}));var GeomodelCanvasLayer=function(_super){function GeomodelCanvasLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.surfaceAreasPaths=[],_this.surfaceLinesPaths=[],_this.maxDepth=1e4,_this.drawPolygonPath=function(color,path){var ctx=_this.ctx;ctx.fillStyle=color,ctx.fill(path)},_this.drawLinePath=function(color,path){var ctx=_this.ctx;ctx.strokeStyle=color,ctx.stroke(path)},_this.createPolygons=function(data){for(var polygons=[],polygon=null,i=0;i<data.length;i++){var topIsValid=!!data[i][1];topIsValid&&(null===polygon&&(polygon=[]),polygon.push(data[i][0],data[i][1]));var endIsReached=i===data.length-1;if((!topIsValid||endIsReached)&&polygon){for(var j=topIsValid?i:i-1;j>=0&&data[j][1];j--)polygon.push(data[j][0],data[j][2]||_this.maxDepth);polygons.push(polygon),polygon=null}}return polygons},_this.generatePolygonPath=function(polygon){var path=new Path2D;path.moveTo(polygon[0],polygon[1]);for(var i=2;i<polygon.length;i+=2)path.lineTo(polygon[i],polygon[i+1]);return path.closePath(),path},_this.generateLinePaths=function(s){for(var paths=[],d=s.data,penDown=!1,path=null,i=0;i<d.length;i++)d[i][1]?penDown?path.lineTo(d[i][0],d[i][1]):((path=new Path2D).moveTo(d[i][0],d[i][1]),penDown=!0):penDown&&(paths.push(path),penDown=!1);return penDown&&paths.push(path),paths},_this.render=_this.render.bind(_this),_this.generateSurfaceAreasPaths=_this.generateSurfaceAreasPaths.bind(_this),_this.generateSurfaceLinesPaths=_this.generateSurfaceLinesPaths.bind(_this),_this.drawPolygonPath=_this.drawPolygonPath.bind(_this),_this.drawLinePath=_this.drawLinePath.bind(_this),_this.updatePaths=_this.updatePaths.bind(_this),_this}return __extends(GeomodelCanvasLayer,_super),Object.defineProperty(GeomodelCanvasLayer.prototype,"data",{get:function(){return _super.prototype.getData.call(this)},set:function(data){this.setData(data)},enumerable:!1,configurable:!0}),GeomodelCanvasLayer.prototype.getData=function(){return _super.prototype.getData.call(this)},GeomodelCanvasLayer.prototype.setData=function(data){_super.prototype.setData.call(this,data)},GeomodelCanvasLayer.prototype.onMount=function(event){_super.prototype.onMount.call(this,event)},GeomodelCanvasLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.updatePaths(),this.render()},GeomodelCanvasLayer.prototype.onRescale=function(event){this.rescaleEvent=event,this.setTransform(this.rescaleEvent),this.render()},GeomodelCanvasLayer.prototype.updatePaths=function(){this.data?(this.generateSurfaceAreasPaths(),this.generateSurfaceLinesPaths()):(this.surfaceAreasPaths=[],this.surfaceLinesPaths=[])},GeomodelCanvasLayer.prototype.render=function(){var _this=this;this.ctx&&this.rescaleEvent&&requestAnimationFrame((function(){_this.clearCanvas(),_this.surfaceAreasPaths.forEach((function(p){return _this.drawPolygonPath(p.color,p.path)})),_this.surfaceLinesPaths.forEach((function(l){return _this.drawLinePath(l.color,l.path)}))}))},GeomodelCanvasLayer.prototype.colorToCSSColor=function(color){return function(color){if("string"==typeof color)return color;var hexString=color.toString(16);return"#"+("000000".substr(0,6-hexString.length)+hexString)}(color)},GeomodelCanvasLayer.prototype.generateSurfaceAreasPaths=function(){var _this=this;this.surfaceAreasPaths=this.data.areas.reduce((function(acc,s){var mapped=_this.createPolygons(s.data).map((function(polygon){return{color:_this.colorToCSSColor(s.color),path:_this.generatePolygonPath(polygon)}}));return acc.push.apply(acc,mapped),acc}),[])},GeomodelCanvasLayer.prototype.generateSurfaceLinesPaths=function(){var _this=this;this.surfaceLinesPaths=this.data.lines.reduce((function(acc,l){var mapped=_this.generateLinePaths(l).map((function(path){return{color:_this.colorToCSSColor(l.color),path:path}}));return acc.push.apply(acc,mapped),acc}),[])},GeomodelCanvasLayer}(CanvasLayer),DEG2RAD=Math.PI/180;function clamp(value,min,max){return void 0===min&&(min=0),void 0===max&&(max=1),value<min?min:value>max?max:value}function seqI(steps){var target=new Array(steps),incr=1/(steps-1);target[0]=0;for(var i=1;i<steps-1;i++)target[i]=i*incr;return target[steps-1]=1,target}function add(a,b,target){void 0===target&&(target=a);for(var i=0;i<a.length;i++)target[i]=a[i]+b[i];return target}function sub(a,b,target){void 0===target&&(target=a);for(var i=0;i<a.length;i++)target[i]=a[i]-b[i];return target}function scale(a,factor,target){void 0===target&&(target=a);for(var i=0;i<a.length;i++)target[i]=a[i]*factor;return target}function magnitude(a){var sq=function(a){for(var sum=0,i=0;i<a.length;i++)sum+=Math.pow(a[i],2);return sum}(a);return 0===sq?sq:Math.sqrt(sq)}function normalize(a,target){void 0===target&&(target=a);var len=magnitude(a);return 0===len?function(value,target){for(var i=0;i<target.length;i++)target[i]=value;return target}(0,target):scale(a,1/len,target)}function isZeroVector(a,epsilon){void 0===epsilon&&(epsilon=0),void 0===epsilon&&(epsilon=0);for(var i=0;i<a.length;i++)if(Math.abs(a[i])>epsilon)return!1;return!0}var RAD2DEG=180/Math.PI,DEG2RAD$1=Math.PI/180;function rotate(v,rad,target){var cr=Math.cos(rad),sr=Math.sin(rad),x=v[0];return target[0]=cr*x-sr*v[1],target[1]=sr*x+cr*v[1],target}function angleRight(v){return Math.atan2(v[1],v[0])}function signedAngle(a,b){var phi=Math.atan2(b[1],b[0])-Math.atan2(a[1],a[0]);return phi>Math.PI?phi-=2*Math.PI:phi<=-Math.PI&&(phi+=2*Math.PI),phi}var Vector2=function(){function Vector2(a){for(var b=[],_i=1;_i<arguments.length;_i++)b[_i-1]=arguments[_i];this.isMutating=!1,this.length=2,"number"==typeof a?"number"==typeof b[0]?(this[0]=a,this[1]=b[0]):(this[0]=a,this[1]=a):"x"in a&&"y"in a?(this[0]=a.x,this[1]=a.y):(this[0]=a[0],this[1]=a[1])}return Object.defineProperty(Vector2.prototype,"x",{get:function(){return this[0]},set:function(value){this[0]=value},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2.prototype,"y",{get:function(){return this[1]},set:function(value){this[1]=value},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2.prototype,"magnitude",{get:function(){return magnitude(this)},set:function(val){scale(this,val/magnitude(this),this)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2.prototype,"mutable",{get:function(){return this.isMutating=!0,this},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2.prototype,"immutable",{get:function(){return this.isMutating=!1,this},enumerable:!0,configurable:!0}),Vector2.prototype.set=function(a,b){return"number"==typeof a?"number"==typeof b?(this[0]=a,this[1]=b):(this[0]=a,this[1]=a):(this[0]=a[0],this[1]=a[1]),this},Vector2.prototype.add=function(a,b){return void 0===b&&(b=0),"number"==typeof a?this.isMutating?add(this,[a,b]):add(this.clone(),[a,b]):this.isMutating?add(this,a):add(this.clone(),a)},Vector2.add=function(a,b){return add(new Vector2(a),b)},Vector2.prototype.sub=function(a,b){return void 0===b&&(b=0),"number"==typeof a?this.isMutating?sub(this,[a,b]):sub(this.clone(),[a,b]):this.isMutating?sub(this,a):sub(this.clone(),a)},Vector2.sub=function(a,b){return sub(new Vector2(a),b)},Vector2.prototype.subFrom=function(a,b){return void 0===b&&(b=0),"number"==typeof a?this.isMutating?(this[0]=a-this[0],this[1]=b-this[1],this):new Vector2(a-this[0],b-this[1]):this.isMutating?(this[0]=a[0]-this[0],this[1]=a[1]-this[1],this):new Vector2(a[0]-this[0],a[1]-this[1])},Vector2.divide=function(v,n){return scale(new Vector2(v),1/n)},Vector2.multiply=function(v,n){return scale(new Vector2(v),n)},Vector2.prototype.scale=function(n){return scale(this,n,this.isMutating?this:Vector2.zero)},Vector2.prototype.rescale=function(n){var len=magnitude(this);return len<=0?this.isMutating?this:Vector2.zero:scale(this,n/len,this.isMutating?this:Vector2.zero)},Vector2.prototype.clampMagnitude=function(n){var len=magnitude(this);return len>n?scale(this,n/len,this.isMutating?this:Vector2.zero):this.isMutating?this:this.clone()},Vector2.prototype.rotate=function(rad){return rotate(this,rad,this.isMutating?this:Vector2.zero)},Vector2.prototype.rotateDeg=function(deg){return rotate(this,deg*DEG2RAD$1,this.isMutating?this:Vector2.zero)},Vector2.prototype.rotate90=function(){return this,target=this.isMutating?this:Vector2.zero,x=this[0],target[0]=-this[1],target[1]=x,target;var target,x},Vector2.prototype.rotate180=function(){return this,(target=this.isMutating?this:Vector2.zero)[0]=-this[0],target[1]=-this[1],target;var target},Vector2.prototype.rotate270=function(){return this,target=this.isMutating?this:Vector2.zero,x=this[0],target[0]=this[1],target[1]=-x,target;var target,x},Vector2.prototype.normalize=function(){return normalize(this)},Vector2.prototype.normalized=function(){return normalize(this,Vector2.zero)},Vector2.distance=function(a,b){return function(a,b){for(var sq=0,i=0;i<a.length;i++)sq+=Math.pow(b[i]-a[i],2);return 0===sq?sq:Math.sqrt(sq)}(a,b)},Vector2.dot=function(a,b){return function(a,b){for(var sum=0,i=0;i<a.length;i++)sum+=a[i]*b[i];return sum}(a,b)},Vector2.cross=function(a,b){return function(a,b){return a[0]*b[1]-a[1]*b[0]}(a,b)},Vector2.angleRight=function(v){return angleRight(v)},Vector2.angleRightDeg=function(v){return angleRight(v)*RAD2DEG},Vector2.angle=function(a,b){return Math.abs(signedAngle(a,b))},Vector2.angleDeg=function(a,b){return Math.abs(signedAngle(a,b))*RAD2DEG},Vector2.signedAngle=function(a,b){return signedAngle(a,b)},Vector2.signedAngleDeg=function(a,b){return signedAngle(a,b)*RAD2DEG},Vector2.lerp=function(a,b,t){return function(a,b,t,target){void 0===target&&(target=a);for(var n=clamp(t,0,1),m=1-n,i=0;i<a.length;i++)target[i]=a[i]*m+b[i]*n;return target}(new Vector2(a),b,t)},Vector2.lerpRot=function(a,b,t){return function(a,b,n,target){return void 0===target&&(target=a),rotate(a,n*signedAngle(a,b),target)}(a,b,t,Vector2.zero)},Vector2.prototype.clone=function(){return new Vector2(this[0],this[1])},Vector2.equals=function(a,b,epsilon){return void 0===epsilon&&(epsilon=0),!(Math.abs(a[0]-b[0])>epsilon||Math.abs(a[1]-b[1])>epsilon)},Vector2.prototype.equals=function(vector,epsilon){return void 0===epsilon&&(epsilon=0),Vector2.equals(this,vector,epsilon)},Vector2.isZeroVector=function(vector,epsilon){return void 0===epsilon&&(epsilon=0),isZeroVector(vector,epsilon)},Vector2.prototype.isZeroVector=function(epsilon){return void 0===epsilon&&(epsilon=0),isZeroVector(this,epsilon)},Vector2.prototype.toArray=function(){return[this[0],this[1]]},Vector2.prototype.modify=function(modifier){return function(a,modifier,target){void 0===target&&(target=a);for(var i=0;i<a.length;i++)target[i]=modifier(a[i],i);return target}(this,modifier)},Vector2.prototype[Symbol.iterator]=function(){var _this=this,i=0;return{next:function(){switch(i++){case 0:return{value:_this[0],done:!1};case 1:return{value:_this[1],done:!1};default:return{value:-1,done:!0}}}}},Object.defineProperty(Vector2,"zero",{get:function(){return new Vector2(0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2,"one",{get:function(){return new Vector2(1,1)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2,"positiveInfinity",{get:function(){return new Vector2(1/0,1/0)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2,"negativeInfinity",{get:function(){return new Vector2(-1/0,-1/0)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2,"up",{get:function(){return new Vector2(0,1)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2,"right",{get:function(){return new Vector2(1,0)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2,"down",{get:function(){return new Vector2(0,-1)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2,"left",{get:function(){return new Vector2(-1,0)},enumerable:!0,configurable:!0}),Vector2}(),constant$2=x=>()=>x;function gamma(y){return 1==(y=+y)?nogamma:function(a,b){return b-a?function(a,b,y){return a=Math.pow(a,y),b=Math.pow(b,y)-a,y=1/y,function(t){return Math.pow(a+t*b,y)}}(a,b,y):constant$2(isNaN(a)?b:a)}}function nogamma(a,b){var d=b-a;return d?function(a,d){return function(t){return a+t*d}}(a,d):constant$2(isNaN(a)?b:a)}var interpolateRgb=function rgbGamma(y){var color=gamma(y);function rgb$1(start,end){var r=color((start=rgb(start)).r,(end=rgb(end)).r),g=color(start.g,end.g),b=color(start.b,end.b),opacity=nogamma(start.opacity,end.opacity);return function(t){return start.r=r(t),start.g=g(t),start.b=b(t),start.opacity=opacity(t),start+""}}return rgb$1.gamma=rgbGamma,rgb$1}(1);function numberArray(a,b){b||(b=[]);var i,n=a?Math.min(b.length,a.length):0,c=b.slice();return function(t){for(i=0;i<n;++i)c[i]=a[i]*(1-t)+b[i]*t;return c}}function genericArray(a,b){var i,nb=b?b.length:0,na=a?Math.min(nb,a.length):0,x=new Array(na),c=new Array(nb);for(i=0;i<na;++i)x[i]=interpolate(a[i],b[i]);for(;i<nb;++i)c[i]=b[i];return function(t){for(i=0;i<na;++i)c[i]=x[i](t);return c}}function date(a,b){var d=new Date;return a=+a,b=+b,function(t){return d.setTime(a*(1-t)+b*t),d}}function interpolateNumber(a,b){return a=+a,b=+b,function(t){return a*(1-t)+b*t}}function object(a,b){var k,i={},c={};for(k in null!==a&&"object"==typeof a||(a={}),null!==b&&"object"==typeof b||(b={}),b)k in a?i[k]=interpolate(a[k],b[k]):c[k]=b[k];return function(t){for(k in i)c[k]=i[k](t);return c}}var reA=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,reB=new RegExp(reA.source,"g");function interpolateString(a,b){var am,bm,bs,bi=reA.lastIndex=reB.lastIndex=0,i=-1,s=[],q=[];for(a+="",b+="";(am=reA.exec(a))&&(bm=reB.exec(b));)(bs=bm.index)>bi&&(bs=b.slice(bi,bs),s[i]?s[i]+=bs:s[++i]=bs),(am=am[0])===(bm=bm[0])?s[i]?s[i]+=bm:s[++i]=bm:(s[++i]=null,q.push({i:i,x:interpolateNumber(am,bm)})),bi=reB.lastIndex;return bi<b.length&&(bs=b.slice(bi),s[i]?s[i]+=bs:s[++i]=bs),s.length<2?q[0]?function(b){return function(t){return b(t)+""}}(q[0].x):function(b){return function(){return b}}(b):(b=q.length,function(t){for(var o,i=0;i<b;++i)s[(o=q[i]).i]=o.x(t);return s.join("")})}function interpolate(a,b){var c,t=typeof b;return null==b||"boolean"===t?constant$2(b):("number"===t?interpolateNumber:"string"===t?(c=color(b))?(b=c,interpolateRgb):interpolateString:b instanceof color?interpolateRgb:b instanceof Date?date:function(x){return ArrayBuffer.isView(x)&&!(x instanceof DataView)}(b)?numberArray:Array.isArray(b)?genericArray:"function"!=typeof b.valueOf&&"function"!=typeof b.toString||isNaN(b)?object:interpolateNumber)(a,b)}function interpolateRound(a,b){return a=+a,b=+b,function(t){return Math.round(a*(1-t)+b*t)}}var svgNode,degrees=180/Math.PI,identity={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function decompose(a,b,c,d,e,f){var scaleX,scaleY,skewX;return(scaleX=Math.sqrt(a*a+b*b))&&(a/=scaleX,b/=scaleX),(skewX=a*c+b*d)&&(c-=a*skewX,d-=b*skewX),(scaleY=Math.sqrt(c*c+d*d))&&(c/=scaleY,d/=scaleY,skewX/=scaleY),a*d<b*c&&(a=-a,b=-b,skewX=-skewX,scaleX=-scaleX),{translateX:e,translateY:f,rotate:Math.atan2(b,a)*degrees,skewX:Math.atan(skewX)*degrees,scaleX:scaleX,scaleY:scaleY}}function interpolateTransform(parse,pxComma,pxParen,degParen){function pop(s){return s.length?s.pop()+" ":""}return function(a,b){var s=[],q=[];return a=parse(a),b=parse(b),function(xa,ya,xb,yb,s,q){if(xa!==xb||ya!==yb){var i=s.push("translate(",null,pxComma,null,pxParen);q.push({i:i-4,x:interpolateNumber(xa,xb)},{i:i-2,x:interpolateNumber(ya,yb)})}else(xb||yb)&&s.push("translate("+xb+pxComma+yb+pxParen)}(a.translateX,a.translateY,b.translateX,b.translateY,s,q),function(a,b,s,q){a!==b?(a-b>180?b+=360:b-a>180&&(a+=360),q.push({i:s.push(pop(s)+"rotate(",null,degParen)-2,x:interpolateNumber(a,b)})):b&&s.push(pop(s)+"rotate("+b+degParen)}(a.rotate,b.rotate,s,q),function(a,b,s,q){a!==b?q.push({i:s.push(pop(s)+"skewX(",null,degParen)-2,x:interpolateNumber(a,b)}):b&&s.push(pop(s)+"skewX("+b+degParen)}(a.skewX,b.skewX,s,q),function(xa,ya,xb,yb,s,q){if(xa!==xb||ya!==yb){var i=s.push(pop(s)+"scale(",null,",",null,")");q.push({i:i-4,x:interpolateNumber(xa,xb)},{i:i-2,x:interpolateNumber(ya,yb)})}else 1===xb&&1===yb||s.push(pop(s)+"scale("+xb+","+yb+")")}(a.scaleX,a.scaleY,b.scaleX,b.scaleY,s,q),a=b=null,function(t){for(var o,i=-1,n=q.length;++i<n;)s[(o=q[i]).i]=o.x(t);return s.join("")}}}var interpolateTransformCss=interpolateTransform((function(value){const m=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(value+"");return m.isIdentity?identity:decompose(m.a,m.b,m.c,m.d,m.e,m.f)}),"px, ","px)","deg)"),interpolateTransformSvg=interpolateTransform((function(value){return null==value?identity:(svgNode||(svgNode=document.createElementNS("http://www.w3.org/2000/svg","g")),svgNode.setAttribute("transform",value),(value=svgNode.transform.baseVal.consolidate())?decompose((value=value.matrix).a,value.b,value.c,value.d,value.e,value.f):identity)}),", ",")",")");function cosh(x){return((x=Math.exp(x))+1/x)/2}var interpolateZoom=function zoomRho(rho,rho2,rho4){function zoom(p0,p1){var i,S,ux0=p0[0],uy0=p0[1],w0=p0[2],ux1=p1[0],uy1=p1[1],w1=p1[2],dx=ux1-ux0,dy=uy1-uy0,d2=dx*dx+dy*dy;if(d2<1e-12)S=Math.log(w1/w0)/rho,i=function(t){return[ux0+t*dx,uy0+t*dy,w0*Math.exp(rho*t*S)]};else{var d1=Math.sqrt(d2),b0=(w1*w1-w0*w0+rho4*d2)/(2*w0*rho2*d1),b1=(w1*w1-w0*w0-rho4*d2)/(2*w1*rho2*d1),r0=Math.log(Math.sqrt(b0*b0+1)-b0),r1=Math.log(Math.sqrt(b1*b1+1)-b1);S=(r1-r0)/rho,i=function(t){var s=t*S,coshr0=cosh(r0),u=w0/(rho2*d1)*(coshr0*function(x){return((x=Math.exp(2*x))-1)/(x+1)}(rho*s+r0)-function(x){return((x=Math.exp(x))-1/x)/2}(r0));return[ux0+u*dx,uy0+u*dy,w0*coshr0/cosh(rho*s+r0)]}}return i.duration=1e3*S*rho/Math.SQRT2,i}return zoom.rho=function(_){var _1=Math.max(.001,+_),_2=_1*_1;return zoomRho(_1,_2,_2*_2)},zoom}(Math.SQRT2,2,4);function ascending$1(a,b){return null==a||null==b?NaN:a<b?-1:a>b?1:a>=b?0:NaN}function bisector(f){let delta=f,compare1=f,compare2=f;function left(a,x,lo=0,hi=a.length){if(lo<hi){if(0!==compare1(x,x))return hi;do{const mid=lo+hi>>>1;compare2(a[mid],x)<0?lo=mid+1:hi=mid}while(lo<hi)}return lo}return 2!==f.length&&(delta=(d,x)=>f(d)-x,compare1=ascending$1,compare2=(d,x)=>ascending$1(f(d),x)),{left:left,center:function(a,x,lo=0,hi=a.length){const i=left(a,x,lo,hi-1);return i>lo&&delta(a[i-1],x)>-delta(a[i],x)?i-1:i},right:function(a,x,lo=0,hi=a.length){if(lo<hi){if(0!==compare1(x,x))return hi;do{const mid=lo+hi>>>1;compare2(a[mid],x)<=0?lo=mid+1:hi=mid}while(lo<hi)}return lo}}}const bisectRight=bisector(ascending$1).right;bisector((function(x){return null===x?NaN:+x})).center;class InternMap extends Map{constructor(entries,key=keyof){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:key}}),null!=entries)for(const[key,value]of entries)this.set(key,value)}get(key){return super.get(intern_get(this,key))}has(key){return super.has(intern_get(this,key))}set(key,value){return super.set(function({_intern:_intern,_key:_key},value){const key=_key(value);return _intern.has(key)?_intern.get(key):(_intern.set(key,value),value)}(this,key),value)}delete(key){return super.delete(function({_intern:_intern,_key:_key},value){const key=_key(value);_intern.has(key)&&(value=_intern.get(value),_intern.delete(key));return value}(this,key))}}function intern_get({_intern:_intern,_key:_key},value){const key=_key(value);return _intern.has(key)?_intern.get(key):value}function keyof(value){return null!==value&&"object"==typeof value?value.valueOf():value}var e10=Math.sqrt(50),e5=Math.sqrt(10),e2=Math.sqrt(2);function tickIncrement(start,stop,count){var step=(stop-start)/Math.max(0,count),power=Math.floor(Math.log(step)/Math.LN10),error=step/Math.pow(10,power);return power>=0?(error>=e10?10:error>=e5?5:error>=e2?2:1)*Math.pow(10,power):-Math.pow(10,-power)/(error>=e10?10:error>=e5?5:error>=e2?2:1)}function transpose(matrix){if(!(n=matrix.length))return[];for(var i=-1,m=function(values,valueof){let min;if(void 0===valueof)for(const value of values)null!=value&&(min>value||void 0===min&&value>=value)&&(min=value);else{let index=-1;for(let value of values)null!=(value=valueof(value,++index,values))&&(min>value||void 0===min&&value>=value)&&(min=value)}return min}(matrix,length),transpose=new Array(m);++i<m;)for(var n,j=-1,row=transpose[i]=new Array(n);++j<n;)row[j]=matrix[j][i];return transpose}function length(d){return d.length}function initRange(domain,range){switch(arguments.length){case 0:break;case 1:this.range(domain);break;default:this.range(range).domain(domain)}return this}const implicit=Symbol("implicit");function number$1(x){return+x}var unit=[0,1];function identity$1(x){return x}function normalize$1(a,b){return(b-=a=+a)?function(x){return(x-a)/b}:function(x){return function(){return x}}(isNaN(b)?NaN:.5)}function bimap(domain,range,interpolate){var d0=domain[0],d1=domain[1],r0=range[0],r1=range[1];return d1<d0?(d0=normalize$1(d1,d0),r0=interpolate(r1,r0)):(d0=normalize$1(d0,d1),r0=interpolate(r0,r1)),function(x){return r0(d0(x))}}function polymap(domain,range,interpolate){var j=Math.min(domain.length,range.length)-1,d=new Array(j),r=new Array(j),i=-1;for(domain[j]<domain[0]&&(domain=domain.slice().reverse(),range=range.slice().reverse());++i<j;)d[i]=normalize$1(domain[i],domain[i+1]),r[i]=interpolate(range[i],range[i+1]);return function(x){var i=bisectRight(domain,x,1,j)-1;return r[i](d[i](x))}}function copy(source,target){return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown())}function transformer(){var transform,untransform,unknown,piecewise,output,input,domain=unit,range=unit,interpolate$1=interpolate,clamp=identity$1;function rescale(){var a,b,t,n=Math.min(domain.length,range.length);return clamp!==identity$1&&(a=domain[0],b=domain[n-1],a>b&&(t=a,a=b,b=t),clamp=function(x){return Math.max(a,Math.min(b,x))}),piecewise=n>2?polymap:bimap,output=input=null,scale}function scale(x){return null==x||isNaN(x=+x)?unknown:(output||(output=piecewise(domain.map(transform),range,interpolate$1)))(transform(clamp(x)))}return scale.invert=function(y){return clamp(untransform((input||(input=piecewise(range,domain.map(transform),interpolateNumber)))(y)))},scale.domain=function(_){return arguments.length?(domain=Array.from(_,number$1),rescale()):domain.slice()},scale.range=function(_){return arguments.length?(range=Array.from(_),rescale()):range.slice()},scale.rangeRound=function(_){return range=Array.from(_),interpolate$1=interpolateRound,rescale()},scale.clamp=function(_){return arguments.length?(clamp=!!_||identity$1,rescale()):clamp!==identity$1},scale.interpolate=function(_){return arguments.length?(interpolate$1=_,rescale()):interpolate$1},scale.unknown=function(_){return arguments.length?(unknown=_,scale):unknown},function(t,u){return transform=t,untransform=u,rescale()}}function continuous(){return transformer()(identity$1,identity$1)}function formatDecimalParts(x,p){if((i=(x=p?x.toExponential(p-1):x.toExponential()).indexOf("e"))<0)return null;var i,coefficient=x.slice(0,i);return[coefficient.length>1?coefficient[0]+coefficient.slice(2):coefficient,+x.slice(i+1)]}function exponent(x){return(x=formatDecimalParts(Math.abs(x)))?x[1]:NaN}var prefixExponent,re=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function formatSpecifier(specifier){if(!(match=re.exec(specifier)))throw new Error("invalid format: "+specifier);var match;return new FormatSpecifier({fill:match[1],align:match[2],sign:match[3],symbol:match[4],zero:match[5],width:match[6],comma:match[7],precision:match[8]&&match[8].slice(1),trim:match[9],type:match[10]})}function FormatSpecifier(specifier){this.fill=void 0===specifier.fill?" ":specifier.fill+"",this.align=void 0===specifier.align?">":specifier.align+"",this.sign=void 0===specifier.sign?"-":specifier.sign+"",this.symbol=void 0===specifier.symbol?"":specifier.symbol+"",this.zero=!!specifier.zero,this.width=void 0===specifier.width?void 0:+specifier.width,this.comma=!!specifier.comma,this.precision=void 0===specifier.precision?void 0:+specifier.precision,this.trim=!!specifier.trim,this.type=void 0===specifier.type?"":specifier.type+""}function formatRounded(x,p){var d=formatDecimalParts(x,p);if(!d)return x+"";var coefficient=d[0],exponent=d[1];return exponent<0?"0."+new Array(-exponent).join("0")+coefficient:coefficient.length>exponent+1?coefficient.slice(0,exponent+1)+"."+coefficient.slice(exponent+1):coefficient+new Array(exponent-coefficient.length+2).join("0")}formatSpecifier.prototype=FormatSpecifier.prototype,FormatSpecifier.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var formatTypes={"%":(x,p)=>(100*x).toFixed(p),b:x=>Math.round(x).toString(2),c:x=>x+"",d:function(x){return Math.abs(x=Math.round(x))>=1e21?x.toLocaleString("en").replace(/,/g,""):x.toString(10)},e:(x,p)=>x.toExponential(p),f:(x,p)=>x.toFixed(p),g:(x,p)=>x.toPrecision(p),o:x=>Math.round(x).toString(8),p:(x,p)=>formatRounded(100*x,p),r:formatRounded,s:function(x,p){var d=formatDecimalParts(x,p);if(!d)return x+"";var coefficient=d[0],exponent=d[1],i=exponent-(prefixExponent=3*Math.max(-8,Math.min(8,Math.floor(exponent/3))))+1,n=coefficient.length;return i===n?coefficient:i>n?coefficient+new Array(i-n+1).join("0"):i>0?coefficient.slice(0,i)+"."+coefficient.slice(i):"0."+new Array(1-i).join("0")+formatDecimalParts(x,Math.max(0,p+i-1))[0]},X:x=>Math.round(x).toString(16).toUpperCase(),x:x=>Math.round(x).toString(16)};function identity$2(x){return x}var locale,format,formatPrefix,map$2=Array.prototype.map,prefixes=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function formatLocale(locale){var grouping,thousands,group=void 0===locale.grouping||void 0===locale.thousands?identity$2:(grouping=map$2.call(locale.grouping,Number),thousands=locale.thousands+"",function(value,width){for(var i=value.length,t=[],j=0,g=grouping[0],length=0;i>0&&g>0&&(length+g+1>width&&(g=Math.max(1,width-length)),t.push(value.substring(i-=g,i+g)),!((length+=g+1)>width));)g=grouping[j=(j+1)%grouping.length];return t.reverse().join(thousands)}),currencyPrefix=void 0===locale.currency?"":locale.currency[0]+"",currencySuffix=void 0===locale.currency?"":locale.currency[1]+"",decimal=void 0===locale.decimal?".":locale.decimal+"",numerals=void 0===locale.numerals?identity$2:function(numerals){return function(value){return value.replace(/[0-9]/g,(function(i){return numerals[+i]}))}}(map$2.call(locale.numerals,String)),percent=void 0===locale.percent?"%":locale.percent+"",minus=void 0===locale.minus?"−":locale.minus+"",nan=void 0===locale.nan?"NaN":locale.nan+"";function newFormat(specifier){var fill=(specifier=formatSpecifier(specifier)).fill,align=specifier.align,sign=specifier.sign,symbol=specifier.symbol,zero=specifier.zero,width=specifier.width,comma=specifier.comma,precision=specifier.precision,trim=specifier.trim,type=specifier.type;"n"===type?(comma=!0,type="g"):formatTypes[type]||(void 0===precision&&(precision=12),trim=!0,type="g"),(zero||"0"===fill&&"="===align)&&(zero=!0,fill="0",align="=");var prefix="$"===symbol?currencyPrefix:"#"===symbol&&/[boxX]/.test(type)?"0"+type.toLowerCase():"",suffix="$"===symbol?currencySuffix:/[%p]/.test(type)?percent:"",formatType=formatTypes[type],maybeSuffix=/[defgprs%]/.test(type);function format(value){var i,n,c,valuePrefix=prefix,valueSuffix=suffix;if("c"===type)valueSuffix=formatType(value)+valueSuffix,value="";else{var valueNegative=(value=+value)<0||1/value<0;if(value=isNaN(value)?nan:formatType(Math.abs(value),precision),trim&&(value=function(s){out:for(var i1,n=s.length,i=1,i0=-1;i<n;++i)switch(s[i]){case".":i0=i1=i;break;case"0":0===i0&&(i0=i),i1=i;break;default:if(!+s[i])break out;i0>0&&(i0=0)}return i0>0?s.slice(0,i0)+s.slice(i1+1):s}(value)),valueNegative&&0==+value&&"+"!==sign&&(valueNegative=!1),valuePrefix=(valueNegative?"("===sign?sign:minus:"-"===sign||"("===sign?"":sign)+valuePrefix,valueSuffix=("s"===type?prefixes[8+prefixExponent/3]:"")+valueSuffix+(valueNegative&&"("===sign?")":""),maybeSuffix)for(i=-1,n=value.length;++i<n;)if(48>(c=value.charCodeAt(i))||c>57){valueSuffix=(46===c?decimal+value.slice(i+1):value.slice(i))+valueSuffix,value=value.slice(0,i);break}}comma&&!zero&&(value=group(value,1/0));var length=valuePrefix.length+value.length+valueSuffix.length,padding=length<width?new Array(width-length+1).join(fill):"";switch(comma&&zero&&(value=group(padding+value,padding.length?width-valueSuffix.length:1/0),padding=""),align){case"<":value=valuePrefix+value+valueSuffix+padding;break;case"=":value=valuePrefix+padding+value+valueSuffix;break;case"^":value=padding.slice(0,length=padding.length>>1)+valuePrefix+value+valueSuffix+padding.slice(length);break;default:value=padding+valuePrefix+value+valueSuffix}return numerals(value)}return precision=void 0===precision?6:/[gprs]/.test(type)?Math.max(1,Math.min(21,precision)):Math.max(0,Math.min(20,precision)),format.toString=function(){return specifier+""},format}return{format:newFormat,formatPrefix:function(specifier,value){var f=newFormat(((specifier=formatSpecifier(specifier)).type="f",specifier)),e=3*Math.max(-8,Math.min(8,Math.floor(exponent(value)/3))),k=Math.pow(10,-e),prefix=prefixes[8+e/3];return function(value){return f(k*value)+prefix}}}}function tickFormat(start,stop,count,specifier){var precision,step=function(start,stop,count){var step0=Math.abs(stop-start)/Math.max(0,count),step1=Math.pow(10,Math.floor(Math.log(step0)/Math.LN10)),error=step0/step1;return error>=e10?step1*=10:error>=e5?step1*=5:error>=e2&&(step1*=2),stop<start?-step1:step1}(start,stop,count);switch((specifier=formatSpecifier(null==specifier?",f":specifier)).type){case"s":var value=Math.max(Math.abs(start),Math.abs(stop));return null!=specifier.precision||isNaN(precision=function(step,value){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(exponent(value)/3)))-exponent(Math.abs(step)))}(step,value))||(specifier.precision=precision),formatPrefix(specifier,value);case"":case"e":case"g":case"p":case"r":null!=specifier.precision||isNaN(precision=function(step,max){return step=Math.abs(step),max=Math.abs(max)-step,Math.max(0,exponent(max)-exponent(step))+1}(step,Math.max(Math.abs(start),Math.abs(stop))))||(specifier.precision=precision-("e"===specifier.type));break;case"f":case"%":null!=specifier.precision||isNaN(precision=function(step){return Math.max(0,-exponent(Math.abs(step)))}(step))||(specifier.precision=precision-2*("%"===specifier.type))}return format(specifier)}function linearish(scale){var domain=scale.domain;return scale.ticks=function(count){var d=domain();return function(start,stop,count){var reverse,n,ticks,step,i=-1;if(count=+count,(start=+start)==(stop=+stop)&&count>0)return[start];if((reverse=stop<start)&&(n=start,start=stop,stop=n),0===(step=tickIncrement(start,stop,count))||!isFinite(step))return[];if(step>0){let r0=Math.round(start/step),r1=Math.round(stop/step);for(r0*step<start&&++r0,r1*step>stop&&--r1,ticks=new Array(n=r1-r0+1);++i<n;)ticks[i]=(r0+i)*step}else{step=-step;let r0=Math.round(start*step),r1=Math.round(stop*step);for(r0/step<start&&++r0,r1/step>stop&&--r1,ticks=new Array(n=r1-r0+1);++i<n;)ticks[i]=(r0+i)/step}return reverse&&ticks.reverse(),ticks}(d[0],d[d.length-1],null==count?10:count)},scale.tickFormat=function(count,specifier){var d=domain();return tickFormat(d[0],d[d.length-1],null==count?10:count,specifier)},scale.nice=function(count){null==count&&(count=10);var prestep,step,d=domain(),i0=0,i1=d.length-1,start=d[i0],stop=d[i1],maxIter=10;for(stop<start&&(step=start,start=stop,stop=step,step=i0,i0=i1,i1=step);maxIter-- >0;){if((step=tickIncrement(start,stop,count))===prestep)return d[i0]=start,d[i1]=stop,domain(d);if(step>0)start=Math.floor(start/step)*step,stop=Math.ceil(stop/step)*step;else{if(!(step<0))break;start=Math.ceil(start*step)/step,stop=Math.floor(stop*step)/step}prestep=step}return scale},scale}function linear$1(){var scale=continuous();return scale.copy=function(){return copy(scale,linear$1())},initRange.apply(scale,arguments),linearish(scale)}function findStratcolumnUnit(units,unitname,path){void 0===path&&(path=[]);var unit=units.find((function(u){return u.identifier.toLowerCase()===unitname.toLowerCase()}));if(unit){var temp_1=unit;do{path.unshift(temp_1),temp_1=units.find((function(u){return u.identifier===temp_1.stratUnitParent}))}while(temp_1);return unit}return null}function getColorFromUnit(unit){return null===unit.colorR||null===unit.colorG||null===unit.colorB?2147483648:unit.colorR<<16|unit.colorG<<8|unit.colorB}locale=formatLocale({thousands:",",grouping:[3],currency:["$",""]}),format=locale.format,formatPrefix=locale.formatPrefix;var unassignedColorScale=function ordinal(){var index=new InternMap,domain=[],range=[],unknown=implicit;function scale(d){let i=index.get(d);if(void 0===i){if(unknown!==implicit)return unknown;index.set(d,i=domain.push(d)-1)}return range[i%range.length]}return scale.domain=function(_){if(!arguments.length)return domain.slice();domain=[],index=new InternMap;for(const value of _)index.has(value)||index.set(value,domain.push(value)-1);return scale},scale.range=function(_){return arguments.length?(range=Array.from(_),scale):range.slice()},scale.unknown=function(_){return arguments.length?(unknown=_,scale):unknown},scale.copy=function(){return ordinal(domain,range).unknown(unknown)},initRange.apply(scale,arguments),scale}().domain([0,100]).range(function(interpolator,n){for(var samples=new Array(n),i=0;i<n;++i)samples[i]=interpolator(i/(n-1));return samples}(interpolateRgb("#e6f1cf","#85906d"),10));function isAnchestor(descendant,candidate,stratColumn){var path=[];return findStratcolumnUnit(stratColumn,descendant.name,path),path.some((function(p){return candidate.name===p.identifier}))}
|
|
384
|
+
Renderer.registerPlugin("accessibility",AccessibilityManager),Renderer.registerPlugin("extract",Extract),Renderer.registerPlugin("interaction",InteractionManager),Renderer.registerPlugin("particle",ParticleRenderer),Renderer.registerPlugin("prepare",Prepare),Renderer.registerPlugin("batch",BatchRenderer),Renderer.registerPlugin("tilingSprite",TilingSpriteRenderer),Loader.registerPlugin(BitmapFontLoader),Loader.registerPlugin(CompressedTextureLoader),Loader.registerPlugin(DDSLoader),Loader.registerPlugin(KTXLoader),Loader.registerPlugin(SpritesheetLoader),Application.registerPlugin(TickerPlugin),Application.registerPlugin(AppLoaderPlugin);var PixiRenderApplication=function(){function PixiRenderApplication(pixiRenderOptions){this.renderer=autoDetectRenderer(pixiRenderOptions),this.stage=new Container}return PixiRenderApplication.prototype.destroy=function(){this.stage.destroy({children:!0,texture:!0,baseTexture:!0}),this.stage=null,this.renderer.destroy(!0),this.renderer=null},Object.defineProperty(PixiRenderApplication.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),PixiRenderApplication.prototype.render=function(){this.renderer.render(this.stage)},PixiRenderApplication}(),PixiLayer=function(_super){function PixiLayer(id,options){return _super.call(this,id,options)||this}return __extends(PixiLayer,_super),PixiLayer.prototype.onMount=function(event){if(_super.prototype.onMount.call(this,event),!this.elm){var container=document.createElement("div");container.setAttribute("id",""+this.id),container.setAttribute("class","webgl-layer"),this.elm=container,this.updateStyle();var elm=event.elm,height=event.height,width=event.width,pixiApplicationOptions=this.options.pixiApplicationOptions,pixiOptions=__assign({width:width||parseInt(this.elm.getAttribute("width"),10)||200,height:height||parseInt(this.elm.getAttribute("height"),10)||300,antialias:!0,backgroundAlpha:0,clearBeforeRender:!0,autoResize:!0,preserveDrawingBuffer:!0},pixiApplicationOptions);this.ctx=new PixiRenderApplication(pixiOptions),container.appendChild(this.ctx.view),elm.appendChild(container)}},PixiLayer.prototype.render=function(){this.ctx.render()},PixiLayer.prototype.onUnmount=function(event){var _a,_b;_super.prototype.onUnmount.call(this,event);var renderType=this.renderType(),glContext=this.ctx.renderer instanceof Renderer?null===(_a=this.ctx.renderer)||void 0===_a?void 0:_a.gl:void 0;this.ctx.destroy(),this.ctx=void 0,renderType===RENDERER_TYPE$1.WEBGL&&glContext&&(null===(_b=null==glContext?void 0:glContext.getExtension("WEBGL_lose_context"))||void 0===_b||_b.loseContext()),this.elm.remove(),this.elm=void 0},PixiLayer.prototype.onResize=function(event){_super.prototype.onResize.call(this,event),this.ctx.renderer.resize(event.width,event.height)},PixiLayer.prototype.onRescale=function(event){if(_super.prototype.onRescale.call(this,event),this.ctx){var flippedX=event.xBounds[0]>event.xBounds[1],flippedY=event.yBounds[0]>event.yBounds[1];this.ctx.stage.position.set(event.xScale(0),event.yScale(0)),this.ctx.stage.scale.set(event.xRatio*(flippedX?-1:1),event.yRatio*(flippedY?-1:1))}},PixiLayer.prototype.updateStyle=function(visible){var visibility=visible||this.isVisible?"visible":"hidden",interactive=this.interactive?"auto":"none";this.elm.setAttribute("style","position:absolute;pointer-events:"+interactive+";z-index:"+this.order+";opacity:"+this.opacity+";visibility:"+visibility)},PixiLayer.prototype.setVisibility=function(visible){_super.prototype.setVisibility.call(this,visible),this.elm&&this.updateStyle(visible)},PixiLayer.prototype.onOpacityChanged=function(opacity){this.elm&&this.updateStyle()},PixiLayer.prototype.onOrderChanged=function(order){this.elm&&this.updateStyle()},PixiLayer.prototype.onInteractivityChanged=function(interactive){this.elm&&this.updateStyle()},PixiLayer.prototype.renderType=function(){return this.ctx.renderer.type},PixiLayer}(Layer),GeomodelLayerV2=function(_super){function GeomodelLayerV2(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.isPreRendered=!1,_this.createPolygons=function(data){for(var polygons=[],polygon=null,i=0;i<data.length;i++){var topIsValid=!!data[i][1];topIsValid&&(null===polygon&&(polygon=[]),polygon.push(data[i][0],data[i][1]));var endIsReached=i===data.length-1;if((!topIsValid||endIsReached)&&polygon){for(var j=topIsValid?i:i-1;j>=0&&data[j][1];j--)polygon.push(data[j][0],data[j][2]||1e4);polygons.push(polygon),polygon=null}}return polygons},_this.generateAreaPolygon=function(s){var g=new Graphics;g.lineStyle(1,s.color,1),g.beginFill(s.color),_this.createPolygons(s.data).forEach((function(polygon){return g.drawPolygon(polygon)})),g.endFill(),_this.ctx.stage.addChild(g)},_this.generateSurfaceLine=function(s){var g=new Graphics,d=s.data;g.lineStyle(1,s.color,1,.5,!0);for(var penDown=!1,i=0;i<d.length;i++)d[i][1]?penDown?g.lineTo(d[i][0],d[i][1]):(g.moveTo(d[i][0],d[i][1]),penDown=!0):penDown=!1;_this.ctx.stage.addChild(g)},_this}return __extends(GeomodelLayerV2,_super),GeomodelLayerV2.prototype.onRescale=function(event){_super.prototype.onRescale.call(this,event),this.isPreRendered||(this.clearStage(),this.preRender()),this.render()},GeomodelLayerV2.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.isPreRendered=!1,this.clearStage(),this.preRender(),this.render()},GeomodelLayerV2.prototype.clearStage=function(){this.ctx.stage.children.forEach((function(g){return g.destroy()})),this.ctx.stage.removeChildren()},GeomodelLayerV2.prototype.preRender=function(){var _this=this,data=this.data;data&&(data.areas.forEach((function(a){return _this.generateAreaPolygon(a)})),data.lines.forEach((function(l){return _this.generateSurfaceLine(l)})),this.isPreRendered=!0)},GeomodelLayerV2}(PixiLayer),GeomodelLayer=function(_super){function GeomodelLayer(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(GeomodelLayer,_super),GeomodelLayer}(GeomodelLayerV2);function define(constructor,factory,prototype){constructor.prototype=factory.prototype=prototype,prototype.constructor=constructor}function extend(parent,definition){var prototype=Object.create(parent.prototype);for(var key in definition)prototype[key]=definition[key];return prototype}function Color(){}var brighter=1/.7,reI="\\s*([+-]?\\d+)\\s*",reN="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",reP="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",reHex=/^#([0-9a-f]{3,8})$/,reRgbInteger=new RegExp("^rgb\\("+[reI,reI,reI]+"\\)$"),reRgbPercent=new RegExp("^rgb\\("+[reP,reP,reP]+"\\)$"),reRgbaInteger=new RegExp("^rgba\\("+[reI,reI,reI,reN]+"\\)$"),reRgbaPercent=new RegExp("^rgba\\("+[reP,reP,reP,reN]+"\\)$"),reHslPercent=new RegExp("^hsl\\("+[reN,reP,reP]+"\\)$"),reHslaPercent=new RegExp("^hsla\\("+[reN,reP,reP,reN]+"\\)$"),named={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function color_formatHex(){return this.rgb().formatHex()}function color_formatRgb(){return this.rgb().formatRgb()}function color(format){var m,l;return format=(format+"").trim().toLowerCase(),(m=reHex.exec(format))?(l=m[1].length,m=parseInt(m[1],16),6===l?rgbn(m):3===l?new Rgb(m>>8&15|m>>4&240,m>>4&15|240&m,(15&m)<<4|15&m,1):8===l?rgba(m>>24&255,m>>16&255,m>>8&255,(255&m)/255):4===l?rgba(m>>12&15|m>>8&240,m>>8&15|m>>4&240,m>>4&15|240&m,((15&m)<<4|15&m)/255):null):(m=reRgbInteger.exec(format))?new Rgb(m[1],m[2],m[3],1):(m=reRgbPercent.exec(format))?new Rgb(255*m[1]/100,255*m[2]/100,255*m[3]/100,1):(m=reRgbaInteger.exec(format))?rgba(m[1],m[2],m[3],m[4]):(m=reRgbaPercent.exec(format))?rgba(255*m[1]/100,255*m[2]/100,255*m[3]/100,m[4]):(m=reHslPercent.exec(format))?hsla(m[1],m[2]/100,m[3]/100,1):(m=reHslaPercent.exec(format))?hsla(m[1],m[2]/100,m[3]/100,m[4]):named.hasOwnProperty(format)?rgbn(named[format]):"transparent"===format?new Rgb(NaN,NaN,NaN,0):null}function rgbn(n){return new Rgb(n>>16&255,n>>8&255,255&n,1)}function rgba(r,g,b,a){return a<=0&&(r=g=b=NaN),new Rgb(r,g,b,a)}function rgbConvert(o){return o instanceof Color||(o=color(o)),o?new Rgb((o=o.rgb()).r,o.g,o.b,o.opacity):new Rgb}function rgb(r,g,b,opacity){return 1===arguments.length?rgbConvert(r):new Rgb(r,g,b,null==opacity?1:opacity)}function Rgb(r,g,b,opacity){this.r=+r,this.g=+g,this.b=+b,this.opacity=+opacity}function rgb_formatHex(){return"#"+hex(this.r)+hex(this.g)+hex(this.b)}function rgb_formatRgb(){var a=this.opacity;return(1===(a=isNaN(a)?1:Math.max(0,Math.min(1,a)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===a?")":", "+a+")")}function hex(value){return((value=Math.max(0,Math.min(255,Math.round(value)||0)))<16?"0":"")+value.toString(16)}function hsla(h,s,l,a){return a<=0?h=s=l=NaN:l<=0||l>=1?h=s=NaN:s<=0&&(h=NaN),new Hsl(h,s,l,a)}function hslConvert(o){if(o instanceof Hsl)return new Hsl(o.h,o.s,o.l,o.opacity);if(o instanceof Color||(o=color(o)),!o)return new Hsl;if(o instanceof Hsl)return o;var r=(o=o.rgb()).r/255,g=o.g/255,b=o.b/255,min=Math.min(r,g,b),max=Math.max(r,g,b),h=NaN,s=max-min,l=(max+min)/2;return s?(h=r===max?(g-b)/s+6*(g<b):g===max?(b-r)/s+2:(r-g)/s+4,s/=l<.5?max+min:2-max-min,h*=60):s=l>0&&l<1?0:h,new Hsl(h,s,l,o.opacity)}function Hsl(h,s,l,opacity){this.h=+h,this.s=+s,this.l=+l,this.opacity=+opacity}function hsl2rgb(h,m1,m2){return 255*(h<60?m1+(m2-m1)*h/60:h<180?m2:h<240?m1+(m2-m1)*(240-h)/60:m1)}function convertColor(colorStr){var d=color(colorStr).hex();return parseInt(d.replace("#","0x"))}define(Color,color,{copy:function(channels){return Object.assign(new this.constructor,this,channels)},displayable:function(){return this.rgb().displayable()},hex:color_formatHex,formatHex:color_formatHex,formatHsl:function(){return hslConvert(this).formatHsl()},formatRgb:color_formatRgb,toString:color_formatRgb}),define(Rgb,rgb,extend(Color,{brighter:function(k){return k=null==k?brighter:Math.pow(brighter,k),new Rgb(this.r*k,this.g*k,this.b*k,this.opacity)},darker:function(k){return k=null==k?.7:Math.pow(.7,k),new Rgb(this.r*k,this.g*k,this.b*k,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:rgb_formatHex,formatHex:rgb_formatHex,formatRgb:rgb_formatRgb,toString:rgb_formatRgb})),define(Hsl,(function(h,s,l,opacity){return 1===arguments.length?hslConvert(h):new Hsl(h,s,l,null==opacity?1:opacity)}),extend(Color,{brighter:function(k){return k=null==k?brighter:Math.pow(brighter,k),new Hsl(this.h,this.s,this.l*k,this.opacity)},darker:function(k){return k=null==k?.7:Math.pow(.7,k),new Hsl(this.h,this.s,this.l*k,this.opacity)},rgb:function(){var h=this.h%360+360*(this.h<0),s=isNaN(h)||isNaN(this.s)?0:this.s,l=this.l,m2=l+(l<.5?l:1-l)*s,m1=2*l-m2;return new Rgb(hsl2rgb(h>=240?h-240:h+120,m1,m2),hsl2rgb(h,m1,m2),hsl2rgb(h<120?h+240:h-120,m1,m2),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var a=this.opacity;return(1===(a=isNaN(a)?1:Math.max(0,Math.min(1,a)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===a?")":", "+a+")")}}));var GeomodelCanvasLayer=function(_super){function GeomodelCanvasLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.surfaceAreasPaths=[],_this.surfaceLinesPaths=[],_this.maxDepth=1e4,_this.drawPolygonPath=function(color,path){var ctx=_this.ctx;ctx.fillStyle=color,ctx.fill(path)},_this.drawLinePath=function(color,path){var ctx=_this.ctx;ctx.strokeStyle=color,ctx.stroke(path)},_this.createPolygons=function(data){for(var polygons=[],polygon=null,i=0;i<data.length;i++){var topIsValid=!!data[i][1];topIsValid&&(null===polygon&&(polygon=[]),polygon.push(data[i][0],data[i][1]));var endIsReached=i===data.length-1;if((!topIsValid||endIsReached)&&polygon){for(var j=topIsValid?i:i-1;j>=0&&data[j][1];j--)polygon.push(data[j][0],data[j][2]||_this.maxDepth);polygons.push(polygon),polygon=null}}return polygons},_this.generatePolygonPath=function(polygon){var path=new Path2D;path.moveTo(polygon[0],polygon[1]);for(var i=2;i<polygon.length;i+=2)path.lineTo(polygon[i],polygon[i+1]);return path.closePath(),path},_this.generateLinePaths=function(s){for(var paths=[],d=s.data,penDown=!1,path=null,i=0;i<d.length;i++)d[i][1]?penDown?path.lineTo(d[i][0],d[i][1]):((path=new Path2D).moveTo(d[i][0],d[i][1]),penDown=!0):penDown&&(paths.push(path),penDown=!1);return penDown&&paths.push(path),paths},_this.render=_this.render.bind(_this),_this.generateSurfaceAreasPaths=_this.generateSurfaceAreasPaths.bind(_this),_this.generateSurfaceLinesPaths=_this.generateSurfaceLinesPaths.bind(_this),_this.drawPolygonPath=_this.drawPolygonPath.bind(_this),_this.drawLinePath=_this.drawLinePath.bind(_this),_this.updatePaths=_this.updatePaths.bind(_this),_this}return __extends(GeomodelCanvasLayer,_super),Object.defineProperty(GeomodelCanvasLayer.prototype,"data",{get:function(){return _super.prototype.getData.call(this)},set:function(data){this.setData(data)},enumerable:!1,configurable:!0}),GeomodelCanvasLayer.prototype.getData=function(){return _super.prototype.getData.call(this)},GeomodelCanvasLayer.prototype.setData=function(data){_super.prototype.setData.call(this,data)},GeomodelCanvasLayer.prototype.onMount=function(event){_super.prototype.onMount.call(this,event)},GeomodelCanvasLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.updatePaths(),this.render()},GeomodelCanvasLayer.prototype.onRescale=function(event){this.rescaleEvent=event,this.setTransform(this.rescaleEvent),this.render()},GeomodelCanvasLayer.prototype.updatePaths=function(){this.data?(this.generateSurfaceAreasPaths(),this.generateSurfaceLinesPaths()):(this.surfaceAreasPaths=[],this.surfaceLinesPaths=[])},GeomodelCanvasLayer.prototype.render=function(){var _this=this;this.ctx&&this.rescaleEvent&&requestAnimationFrame((function(){_this.clearCanvas(),_this.surfaceAreasPaths.forEach((function(p){return _this.drawPolygonPath(p.color,p.path)})),_this.surfaceLinesPaths.forEach((function(l){return _this.drawLinePath(l.color,l.path)}))}))},GeomodelCanvasLayer.prototype.colorToCSSColor=function(color){return function(color){if("string"==typeof color)return color;var hexString=color.toString(16);return"#"+("000000".substr(0,6-hexString.length)+hexString)}(color)},GeomodelCanvasLayer.prototype.generateSurfaceAreasPaths=function(){var _this=this;this.surfaceAreasPaths=this.data.areas.reduce((function(acc,s){var mapped=_this.createPolygons(s.data).map((function(polygon){return{color:_this.colorToCSSColor(s.color),path:_this.generatePolygonPath(polygon)}}));return acc.push.apply(acc,mapped),acc}),[])},GeomodelCanvasLayer.prototype.generateSurfaceLinesPaths=function(){var _this=this;this.surfaceLinesPaths=this.data.lines.reduce((function(acc,l){var mapped=_this.generateLinePaths(l).map((function(path){return{color:_this.colorToCSSColor(l.color),path:path}}));return acc.push.apply(acc,mapped),acc}),[])},GeomodelCanvasLayer}(CanvasLayer),DEG2RAD=Math.PI/180;function clamp(value,min,max){return void 0===min&&(min=0),void 0===max&&(max=1),value<min?min:value>max?max:value}function seqI(steps){var target=new Array(steps),incr=1/(steps-1);target[0]=0;for(var i=1;i<steps-1;i++)target[i]=i*incr;return target[steps-1]=1,target}function add(a,b,target){void 0===target&&(target=a);for(var i=0;i<a.length;i++)target[i]=a[i]+b[i];return target}function sub(a,b,target){void 0===target&&(target=a);for(var i=0;i<a.length;i++)target[i]=a[i]-b[i];return target}function scale(a,factor,target){void 0===target&&(target=a);for(var i=0;i<a.length;i++)target[i]=a[i]*factor;return target}function magnitude(a){var sq=function(a){for(var sum=0,i=0;i<a.length;i++)sum+=Math.pow(a[i],2);return sum}(a);return 0===sq?sq:Math.sqrt(sq)}function normalize(a,target){void 0===target&&(target=a);var len=magnitude(a);return 0===len?function(value,target){for(var i=0;i<target.length;i++)target[i]=value;return target}(0,target):scale(a,1/len,target)}function isZeroVector(a,epsilon){void 0===epsilon&&(epsilon=0),void 0===epsilon&&(epsilon=0);for(var i=0;i<a.length;i++)if(Math.abs(a[i])>epsilon)return!1;return!0}var RAD2DEG=180/Math.PI,DEG2RAD$1=Math.PI/180;function rotate(v,rad,target){var cr=Math.cos(rad),sr=Math.sin(rad),x=v[0];return target[0]=cr*x-sr*v[1],target[1]=sr*x+cr*v[1],target}function angleRight(v){return Math.atan2(v[1],v[0])}function signedAngle(a,b){var phi=Math.atan2(b[1],b[0])-Math.atan2(a[1],a[0]);return phi>Math.PI?phi-=2*Math.PI:phi<=-Math.PI&&(phi+=2*Math.PI),phi}var Vector2=function(){function Vector2(a){for(var b=[],_i=1;_i<arguments.length;_i++)b[_i-1]=arguments[_i];this.isMutating=!1,this.length=2,"number"==typeof a?"number"==typeof b[0]?(this[0]=a,this[1]=b[0]):(this[0]=a,this[1]=a):"x"in a&&"y"in a?(this[0]=a.x,this[1]=a.y):(this[0]=a[0],this[1]=a[1])}return Object.defineProperty(Vector2.prototype,"x",{get:function(){return this[0]},set:function(value){this[0]=value},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2.prototype,"y",{get:function(){return this[1]},set:function(value){this[1]=value},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2.prototype,"magnitude",{get:function(){return magnitude(this)},set:function(val){scale(this,val/magnitude(this),this)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2.prototype,"mutable",{get:function(){return this.isMutating=!0,this},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2.prototype,"immutable",{get:function(){return this.isMutating=!1,this},enumerable:!0,configurable:!0}),Vector2.prototype.set=function(a,b){return"number"==typeof a?"number"==typeof b?(this[0]=a,this[1]=b):(this[0]=a,this[1]=a):(this[0]=a[0],this[1]=a[1]),this},Vector2.prototype.add=function(a,b){return void 0===b&&(b=0),"number"==typeof a?this.isMutating?add(this,[a,b]):add(this.clone(),[a,b]):this.isMutating?add(this,a):add(this.clone(),a)},Vector2.add=function(a,b){return add(new Vector2(a),b)},Vector2.prototype.sub=function(a,b){return void 0===b&&(b=0),"number"==typeof a?this.isMutating?sub(this,[a,b]):sub(this.clone(),[a,b]):this.isMutating?sub(this,a):sub(this.clone(),a)},Vector2.sub=function(a,b){return sub(new Vector2(a),b)},Vector2.prototype.subFrom=function(a,b){return void 0===b&&(b=0),"number"==typeof a?this.isMutating?(this[0]=a-this[0],this[1]=b-this[1],this):new Vector2(a-this[0],b-this[1]):this.isMutating?(this[0]=a[0]-this[0],this[1]=a[1]-this[1],this):new Vector2(a[0]-this[0],a[1]-this[1])},Vector2.divide=function(v,n){return scale(new Vector2(v),1/n)},Vector2.multiply=function(v,n){return scale(new Vector2(v),n)},Vector2.prototype.scale=function(n){return scale(this,n,this.isMutating?this:Vector2.zero)},Vector2.prototype.rescale=function(n){var len=magnitude(this);return len<=0?this.isMutating?this:Vector2.zero:scale(this,n/len,this.isMutating?this:Vector2.zero)},Vector2.prototype.clampMagnitude=function(n){var len=magnitude(this);return len>n?scale(this,n/len,this.isMutating?this:Vector2.zero):this.isMutating?this:this.clone()},Vector2.prototype.rotate=function(rad){return rotate(this,rad,this.isMutating?this:Vector2.zero)},Vector2.prototype.rotateDeg=function(deg){return rotate(this,deg*DEG2RAD$1,this.isMutating?this:Vector2.zero)},Vector2.prototype.rotate90=function(){return this,target=this.isMutating?this:Vector2.zero,x=this[0],target[0]=-this[1],target[1]=x,target;var target,x},Vector2.prototype.rotate180=function(){return this,(target=this.isMutating?this:Vector2.zero)[0]=-this[0],target[1]=-this[1],target;var target},Vector2.prototype.rotate270=function(){return this,target=this.isMutating?this:Vector2.zero,x=this[0],target[0]=this[1],target[1]=-x,target;var target,x},Vector2.prototype.normalize=function(){return normalize(this)},Vector2.prototype.normalized=function(){return normalize(this,Vector2.zero)},Vector2.distance=function(a,b){return function(a,b){for(var sq=0,i=0;i<a.length;i++)sq+=Math.pow(b[i]-a[i],2);return 0===sq?sq:Math.sqrt(sq)}(a,b)},Vector2.dot=function(a,b){return function(a,b){for(var sum=0,i=0;i<a.length;i++)sum+=a[i]*b[i];return sum}(a,b)},Vector2.cross=function(a,b){return function(a,b){return a[0]*b[1]-a[1]*b[0]}(a,b)},Vector2.angleRight=function(v){return angleRight(v)},Vector2.angleRightDeg=function(v){return angleRight(v)*RAD2DEG},Vector2.angle=function(a,b){return Math.abs(signedAngle(a,b))},Vector2.angleDeg=function(a,b){return Math.abs(signedAngle(a,b))*RAD2DEG},Vector2.signedAngle=function(a,b){return signedAngle(a,b)},Vector2.signedAngleDeg=function(a,b){return signedAngle(a,b)*RAD2DEG},Vector2.lerp=function(a,b,t){return function(a,b,t,target){void 0===target&&(target=a);for(var n=clamp(t,0,1),m=1-n,i=0;i<a.length;i++)target[i]=a[i]*m+b[i]*n;return target}(new Vector2(a),b,t)},Vector2.lerpRot=function(a,b,t){return function(a,b,n,target){return void 0===target&&(target=a),rotate(a,n*signedAngle(a,b),target)}(a,b,t,Vector2.zero)},Vector2.prototype.clone=function(){return new Vector2(this[0],this[1])},Vector2.equals=function(a,b,epsilon){return void 0===epsilon&&(epsilon=0),!(Math.abs(a[0]-b[0])>epsilon||Math.abs(a[1]-b[1])>epsilon)},Vector2.prototype.equals=function(vector,epsilon){return void 0===epsilon&&(epsilon=0),Vector2.equals(this,vector,epsilon)},Vector2.isZeroVector=function(vector,epsilon){return void 0===epsilon&&(epsilon=0),isZeroVector(vector,epsilon)},Vector2.prototype.isZeroVector=function(epsilon){return void 0===epsilon&&(epsilon=0),isZeroVector(this,epsilon)},Vector2.prototype.toArray=function(){return[this[0],this[1]]},Vector2.prototype.modify=function(modifier){return function(a,modifier,target){void 0===target&&(target=a);for(var i=0;i<a.length;i++)target[i]=modifier(a[i],i);return target}(this,modifier)},Vector2.prototype[Symbol.iterator]=function(){var _this=this,i=0;return{next:function(){switch(i++){case 0:return{value:_this[0],done:!1};case 1:return{value:_this[1],done:!1};default:return{value:-1,done:!0}}}}},Object.defineProperty(Vector2,"zero",{get:function(){return new Vector2(0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2,"one",{get:function(){return new Vector2(1,1)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2,"positiveInfinity",{get:function(){return new Vector2(1/0,1/0)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2,"negativeInfinity",{get:function(){return new Vector2(-1/0,-1/0)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2,"up",{get:function(){return new Vector2(0,1)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2,"right",{get:function(){return new Vector2(1,0)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2,"down",{get:function(){return new Vector2(0,-1)},enumerable:!0,configurable:!0}),Object.defineProperty(Vector2,"left",{get:function(){return new Vector2(-1,0)},enumerable:!0,configurable:!0}),Vector2}(),constant$2=x=>()=>x;function gamma(y){return 1==(y=+y)?nogamma:function(a,b){return b-a?function(a,b,y){return a=Math.pow(a,y),b=Math.pow(b,y)-a,y=1/y,function(t){return Math.pow(a+t*b,y)}}(a,b,y):constant$2(isNaN(a)?b:a)}}function nogamma(a,b){var d=b-a;return d?function(a,d){return function(t){return a+t*d}}(a,d):constant$2(isNaN(a)?b:a)}var interpolateRgb=function rgbGamma(y){var color=gamma(y);function rgb$1(start,end){var r=color((start=rgb(start)).r,(end=rgb(end)).r),g=color(start.g,end.g),b=color(start.b,end.b),opacity=nogamma(start.opacity,end.opacity);return function(t){return start.r=r(t),start.g=g(t),start.b=b(t),start.opacity=opacity(t),start+""}}return rgb$1.gamma=rgbGamma,rgb$1}(1);function numberArray(a,b){b||(b=[]);var i,n=a?Math.min(b.length,a.length):0,c=b.slice();return function(t){for(i=0;i<n;++i)c[i]=a[i]*(1-t)+b[i]*t;return c}}function genericArray(a,b){var i,nb=b?b.length:0,na=a?Math.min(nb,a.length):0,x=new Array(na),c=new Array(nb);for(i=0;i<na;++i)x[i]=interpolate(a[i],b[i]);for(;i<nb;++i)c[i]=b[i];return function(t){for(i=0;i<na;++i)c[i]=x[i](t);return c}}function date(a,b){var d=new Date;return a=+a,b=+b,function(t){return d.setTime(a*(1-t)+b*t),d}}function interpolateNumber(a,b){return a=+a,b=+b,function(t){return a*(1-t)+b*t}}function object(a,b){var k,i={},c={};for(k in null!==a&&"object"==typeof a||(a={}),null!==b&&"object"==typeof b||(b={}),b)k in a?i[k]=interpolate(a[k],b[k]):c[k]=b[k];return function(t){for(k in i)c[k]=i[k](t);return c}}var reA=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,reB=new RegExp(reA.source,"g");function interpolateString(a,b){var am,bm,bs,bi=reA.lastIndex=reB.lastIndex=0,i=-1,s=[],q=[];for(a+="",b+="";(am=reA.exec(a))&&(bm=reB.exec(b));)(bs=bm.index)>bi&&(bs=b.slice(bi,bs),s[i]?s[i]+=bs:s[++i]=bs),(am=am[0])===(bm=bm[0])?s[i]?s[i]+=bm:s[++i]=bm:(s[++i]=null,q.push({i:i,x:interpolateNumber(am,bm)})),bi=reB.lastIndex;return bi<b.length&&(bs=b.slice(bi),s[i]?s[i]+=bs:s[++i]=bs),s.length<2?q[0]?function(b){return function(t){return b(t)+""}}(q[0].x):function(b){return function(){return b}}(b):(b=q.length,function(t){for(var o,i=0;i<b;++i)s[(o=q[i]).i]=o.x(t);return s.join("")})}function interpolate(a,b){var c,t=typeof b;return null==b||"boolean"===t?constant$2(b):("number"===t?interpolateNumber:"string"===t?(c=color(b))?(b=c,interpolateRgb):interpolateString:b instanceof color?interpolateRgb:b instanceof Date?date:function(x){return ArrayBuffer.isView(x)&&!(x instanceof DataView)}(b)?numberArray:Array.isArray(b)?genericArray:"function"!=typeof b.valueOf&&"function"!=typeof b.toString||isNaN(b)?object:interpolateNumber)(a,b)}function interpolateRound(a,b){return a=+a,b=+b,function(t){return Math.round(a*(1-t)+b*t)}}var svgNode,degrees=180/Math.PI,identity={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function decompose(a,b,c,d,e,f){var scaleX,scaleY,skewX;return(scaleX=Math.sqrt(a*a+b*b))&&(a/=scaleX,b/=scaleX),(skewX=a*c+b*d)&&(c-=a*skewX,d-=b*skewX),(scaleY=Math.sqrt(c*c+d*d))&&(c/=scaleY,d/=scaleY,skewX/=scaleY),a*d<b*c&&(a=-a,b=-b,skewX=-skewX,scaleX=-scaleX),{translateX:e,translateY:f,rotate:Math.atan2(b,a)*degrees,skewX:Math.atan(skewX)*degrees,scaleX:scaleX,scaleY:scaleY}}function interpolateTransform(parse,pxComma,pxParen,degParen){function pop(s){return s.length?s.pop()+" ":""}return function(a,b){var s=[],q=[];return a=parse(a),b=parse(b),function(xa,ya,xb,yb,s,q){if(xa!==xb||ya!==yb){var i=s.push("translate(",null,pxComma,null,pxParen);q.push({i:i-4,x:interpolateNumber(xa,xb)},{i:i-2,x:interpolateNumber(ya,yb)})}else(xb||yb)&&s.push("translate("+xb+pxComma+yb+pxParen)}(a.translateX,a.translateY,b.translateX,b.translateY,s,q),function(a,b,s,q){a!==b?(a-b>180?b+=360:b-a>180&&(a+=360),q.push({i:s.push(pop(s)+"rotate(",null,degParen)-2,x:interpolateNumber(a,b)})):b&&s.push(pop(s)+"rotate("+b+degParen)}(a.rotate,b.rotate,s,q),function(a,b,s,q){a!==b?q.push({i:s.push(pop(s)+"skewX(",null,degParen)-2,x:interpolateNumber(a,b)}):b&&s.push(pop(s)+"skewX("+b+degParen)}(a.skewX,b.skewX,s,q),function(xa,ya,xb,yb,s,q){if(xa!==xb||ya!==yb){var i=s.push(pop(s)+"scale(",null,",",null,")");q.push({i:i-4,x:interpolateNumber(xa,xb)},{i:i-2,x:interpolateNumber(ya,yb)})}else 1===xb&&1===yb||s.push(pop(s)+"scale("+xb+","+yb+")")}(a.scaleX,a.scaleY,b.scaleX,b.scaleY,s,q),a=b=null,function(t){for(var o,i=-1,n=q.length;++i<n;)s[(o=q[i]).i]=o.x(t);return s.join("")}}}var interpolateTransformCss=interpolateTransform((function(value){const m=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(value+"");return m.isIdentity?identity:decompose(m.a,m.b,m.c,m.d,m.e,m.f)}),"px, ","px)","deg)"),interpolateTransformSvg=interpolateTransform((function(value){return null==value?identity:(svgNode||(svgNode=document.createElementNS("http://www.w3.org/2000/svg","g")),svgNode.setAttribute("transform",value),(value=svgNode.transform.baseVal.consolidate())?decompose((value=value.matrix).a,value.b,value.c,value.d,value.e,value.f):identity)}),", ",")",")");function cosh(x){return((x=Math.exp(x))+1/x)/2}var interpolateZoom=function zoomRho(rho,rho2,rho4){function zoom(p0,p1){var i,S,ux0=p0[0],uy0=p0[1],w0=p0[2],ux1=p1[0],uy1=p1[1],w1=p1[2],dx=ux1-ux0,dy=uy1-uy0,d2=dx*dx+dy*dy;if(d2<1e-12)S=Math.log(w1/w0)/rho,i=function(t){return[ux0+t*dx,uy0+t*dy,w0*Math.exp(rho*t*S)]};else{var d1=Math.sqrt(d2),b0=(w1*w1-w0*w0+rho4*d2)/(2*w0*rho2*d1),b1=(w1*w1-w0*w0-rho4*d2)/(2*w1*rho2*d1),r0=Math.log(Math.sqrt(b0*b0+1)-b0),r1=Math.log(Math.sqrt(b1*b1+1)-b1);S=(r1-r0)/rho,i=function(t){var s=t*S,coshr0=cosh(r0),u=w0/(rho2*d1)*(coshr0*function(x){return((x=Math.exp(2*x))-1)/(x+1)}(rho*s+r0)-function(x){return((x=Math.exp(x))-1/x)/2}(r0));return[ux0+u*dx,uy0+u*dy,w0*coshr0/cosh(rho*s+r0)]}}return i.duration=1e3*S*rho/Math.SQRT2,i}return zoom.rho=function(_){var _1=Math.max(.001,+_),_2=_1*_1;return zoomRho(_1,_2,_2*_2)},zoom}(Math.SQRT2,2,4);function ascending$1(a,b){return null==a||null==b?NaN:a<b?-1:a>b?1:a>=b?0:NaN}function descending(a,b){return null==a||null==b?NaN:b<a?-1:b>a?1:b>=a?0:NaN}function bisector(f){let compare1,compare2,delta;function left(a,x,lo=0,hi=a.length){if(lo<hi){if(0!==compare1(x,x))return hi;do{const mid=lo+hi>>>1;compare2(a[mid],x)<0?lo=mid+1:hi=mid}while(lo<hi)}return lo}return 2!==f.length?(compare1=ascending$1,compare2=(d,x)=>ascending$1(f(d),x),delta=(d,x)=>f(d)-x):(compare1=f===ascending$1||f===descending?f:zero$1,compare2=f,delta=f),{left:left,center:function(a,x,lo=0,hi=a.length){const i=left(a,x,lo,hi-1);return i>lo&&delta(a[i-1],x)>-delta(a[i],x)?i-1:i},right:function(a,x,lo=0,hi=a.length){if(lo<hi){if(0!==compare1(x,x))return hi;do{const mid=lo+hi>>>1;compare2(a[mid],x)<=0?lo=mid+1:hi=mid}while(lo<hi)}return lo}}}function zero$1(){return 0}const bisectRight=bisector(ascending$1).right;bisector((function(x){return null===x?NaN:+x})).center;class InternMap extends Map{constructor(entries,key=keyof){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:key}}),null!=entries)for(const[key,value]of entries)this.set(key,value)}get(key){return super.get(intern_get(this,key))}has(key){return super.has(intern_get(this,key))}set(key,value){return super.set(function({_intern:_intern,_key:_key},value){const key=_key(value);return _intern.has(key)?_intern.get(key):(_intern.set(key,value),value)}(this,key),value)}delete(key){return super.delete(function({_intern:_intern,_key:_key},value){const key=_key(value);_intern.has(key)&&(value=_intern.get(value),_intern.delete(key));return value}(this,key))}}function intern_get({_intern:_intern,_key:_key},value){const key=_key(value);return _intern.has(key)?_intern.get(key):value}function keyof(value){return null!==value&&"object"==typeof value?value.valueOf():value}var e10=Math.sqrt(50),e5=Math.sqrt(10),e2=Math.sqrt(2);function tickIncrement(start,stop,count){var step=(stop-start)/Math.max(0,count),power=Math.floor(Math.log(step)/Math.LN10),error=step/Math.pow(10,power);return power>=0?(error>=e10?10:error>=e5?5:error>=e2?2:1)*Math.pow(10,power):-Math.pow(10,-power)/(error>=e10?10:error>=e5?5:error>=e2?2:1)}function transpose(matrix){if(!(n=matrix.length))return[];for(var i=-1,m=function(values,valueof){let min;if(void 0===valueof)for(const value of values)null!=value&&(min>value||void 0===min&&value>=value)&&(min=value);else{let index=-1;for(let value of values)null!=(value=valueof(value,++index,values))&&(min>value||void 0===min&&value>=value)&&(min=value)}return min}(matrix,length),transpose=new Array(m);++i<m;)for(var n,j=-1,row=transpose[i]=new Array(n);++j<n;)row[j]=matrix[j][i];return transpose}function length(d){return d.length}function initRange(domain,range){switch(arguments.length){case 0:break;case 1:this.range(domain);break;default:this.range(range).domain(domain)}return this}const implicit=Symbol("implicit");function number$1(x){return+x}var unit=[0,1];function identity$1(x){return x}function normalize$1(a,b){return(b-=a=+a)?function(x){return(x-a)/b}:function(x){return function(){return x}}(isNaN(b)?NaN:.5)}function bimap(domain,range,interpolate){var d0=domain[0],d1=domain[1],r0=range[0],r1=range[1];return d1<d0?(d0=normalize$1(d1,d0),r0=interpolate(r1,r0)):(d0=normalize$1(d0,d1),r0=interpolate(r0,r1)),function(x){return r0(d0(x))}}function polymap(domain,range,interpolate){var j=Math.min(domain.length,range.length)-1,d=new Array(j),r=new Array(j),i=-1;for(domain[j]<domain[0]&&(domain=domain.slice().reverse(),range=range.slice().reverse());++i<j;)d[i]=normalize$1(domain[i],domain[i+1]),r[i]=interpolate(range[i],range[i+1]);return function(x){var i=bisectRight(domain,x,1,j)-1;return r[i](d[i](x))}}function copy(source,target){return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown())}function transformer(){var transform,untransform,unknown,piecewise,output,input,domain=unit,range=unit,interpolate$1=interpolate,clamp=identity$1;function rescale(){var a,b,t,n=Math.min(domain.length,range.length);return clamp!==identity$1&&(a=domain[0],b=domain[n-1],a>b&&(t=a,a=b,b=t),clamp=function(x){return Math.max(a,Math.min(b,x))}),piecewise=n>2?polymap:bimap,output=input=null,scale}function scale(x){return null==x||isNaN(x=+x)?unknown:(output||(output=piecewise(domain.map(transform),range,interpolate$1)))(transform(clamp(x)))}return scale.invert=function(y){return clamp(untransform((input||(input=piecewise(range,domain.map(transform),interpolateNumber)))(y)))},scale.domain=function(_){return arguments.length?(domain=Array.from(_,number$1),rescale()):domain.slice()},scale.range=function(_){return arguments.length?(range=Array.from(_),rescale()):range.slice()},scale.rangeRound=function(_){return range=Array.from(_),interpolate$1=interpolateRound,rescale()},scale.clamp=function(_){return arguments.length?(clamp=!!_||identity$1,rescale()):clamp!==identity$1},scale.interpolate=function(_){return arguments.length?(interpolate$1=_,rescale()):interpolate$1},scale.unknown=function(_){return arguments.length?(unknown=_,scale):unknown},function(t,u){return transform=t,untransform=u,rescale()}}function continuous(){return transformer()(identity$1,identity$1)}function formatDecimalParts(x,p){if((i=(x=p?x.toExponential(p-1):x.toExponential()).indexOf("e"))<0)return null;var i,coefficient=x.slice(0,i);return[coefficient.length>1?coefficient[0]+coefficient.slice(2):coefficient,+x.slice(i+1)]}function exponent(x){return(x=formatDecimalParts(Math.abs(x)))?x[1]:NaN}var prefixExponent,re=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function formatSpecifier(specifier){if(!(match=re.exec(specifier)))throw new Error("invalid format: "+specifier);var match;return new FormatSpecifier({fill:match[1],align:match[2],sign:match[3],symbol:match[4],zero:match[5],width:match[6],comma:match[7],precision:match[8]&&match[8].slice(1),trim:match[9],type:match[10]})}function FormatSpecifier(specifier){this.fill=void 0===specifier.fill?" ":specifier.fill+"",this.align=void 0===specifier.align?">":specifier.align+"",this.sign=void 0===specifier.sign?"-":specifier.sign+"",this.symbol=void 0===specifier.symbol?"":specifier.symbol+"",this.zero=!!specifier.zero,this.width=void 0===specifier.width?void 0:+specifier.width,this.comma=!!specifier.comma,this.precision=void 0===specifier.precision?void 0:+specifier.precision,this.trim=!!specifier.trim,this.type=void 0===specifier.type?"":specifier.type+""}function formatRounded(x,p){var d=formatDecimalParts(x,p);if(!d)return x+"";var coefficient=d[0],exponent=d[1];return exponent<0?"0."+new Array(-exponent).join("0")+coefficient:coefficient.length>exponent+1?coefficient.slice(0,exponent+1)+"."+coefficient.slice(exponent+1):coefficient+new Array(exponent-coefficient.length+2).join("0")}formatSpecifier.prototype=FormatSpecifier.prototype,FormatSpecifier.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var formatTypes={"%":(x,p)=>(100*x).toFixed(p),b:x=>Math.round(x).toString(2),c:x=>x+"",d:function(x){return Math.abs(x=Math.round(x))>=1e21?x.toLocaleString("en").replace(/,/g,""):x.toString(10)},e:(x,p)=>x.toExponential(p),f:(x,p)=>x.toFixed(p),g:(x,p)=>x.toPrecision(p),o:x=>Math.round(x).toString(8),p:(x,p)=>formatRounded(100*x,p),r:formatRounded,s:function(x,p){var d=formatDecimalParts(x,p);if(!d)return x+"";var coefficient=d[0],exponent=d[1],i=exponent-(prefixExponent=3*Math.max(-8,Math.min(8,Math.floor(exponent/3))))+1,n=coefficient.length;return i===n?coefficient:i>n?coefficient+new Array(i-n+1).join("0"):i>0?coefficient.slice(0,i)+"."+coefficient.slice(i):"0."+new Array(1-i).join("0")+formatDecimalParts(x,Math.max(0,p+i-1))[0]},X:x=>Math.round(x).toString(16).toUpperCase(),x:x=>Math.round(x).toString(16)};function identity$2(x){return x}var locale,format,formatPrefix,map$2=Array.prototype.map,prefixes=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function formatLocale(locale){var grouping,thousands,group=void 0===locale.grouping||void 0===locale.thousands?identity$2:(grouping=map$2.call(locale.grouping,Number),thousands=locale.thousands+"",function(value,width){for(var i=value.length,t=[],j=0,g=grouping[0],length=0;i>0&&g>0&&(length+g+1>width&&(g=Math.max(1,width-length)),t.push(value.substring(i-=g,i+g)),!((length+=g+1)>width));)g=grouping[j=(j+1)%grouping.length];return t.reverse().join(thousands)}),currencyPrefix=void 0===locale.currency?"":locale.currency[0]+"",currencySuffix=void 0===locale.currency?"":locale.currency[1]+"",decimal=void 0===locale.decimal?".":locale.decimal+"",numerals=void 0===locale.numerals?identity$2:function(numerals){return function(value){return value.replace(/[0-9]/g,(function(i){return numerals[+i]}))}}(map$2.call(locale.numerals,String)),percent=void 0===locale.percent?"%":locale.percent+"",minus=void 0===locale.minus?"−":locale.minus+"",nan=void 0===locale.nan?"NaN":locale.nan+"";function newFormat(specifier){var fill=(specifier=formatSpecifier(specifier)).fill,align=specifier.align,sign=specifier.sign,symbol=specifier.symbol,zero=specifier.zero,width=specifier.width,comma=specifier.comma,precision=specifier.precision,trim=specifier.trim,type=specifier.type;"n"===type?(comma=!0,type="g"):formatTypes[type]||(void 0===precision&&(precision=12),trim=!0,type="g"),(zero||"0"===fill&&"="===align)&&(zero=!0,fill="0",align="=");var prefix="$"===symbol?currencyPrefix:"#"===symbol&&/[boxX]/.test(type)?"0"+type.toLowerCase():"",suffix="$"===symbol?currencySuffix:/[%p]/.test(type)?percent:"",formatType=formatTypes[type],maybeSuffix=/[defgprs%]/.test(type);function format(value){var i,n,c,valuePrefix=prefix,valueSuffix=suffix;if("c"===type)valueSuffix=formatType(value)+valueSuffix,value="";else{var valueNegative=(value=+value)<0||1/value<0;if(value=isNaN(value)?nan:formatType(Math.abs(value),precision),trim&&(value=function(s){out:for(var i1,n=s.length,i=1,i0=-1;i<n;++i)switch(s[i]){case".":i0=i1=i;break;case"0":0===i0&&(i0=i),i1=i;break;default:if(!+s[i])break out;i0>0&&(i0=0)}return i0>0?s.slice(0,i0)+s.slice(i1+1):s}(value)),valueNegative&&0==+value&&"+"!==sign&&(valueNegative=!1),valuePrefix=(valueNegative?"("===sign?sign:minus:"-"===sign||"("===sign?"":sign)+valuePrefix,valueSuffix=("s"===type?prefixes[8+prefixExponent/3]:"")+valueSuffix+(valueNegative&&"("===sign?")":""),maybeSuffix)for(i=-1,n=value.length;++i<n;)if(48>(c=value.charCodeAt(i))||c>57){valueSuffix=(46===c?decimal+value.slice(i+1):value.slice(i))+valueSuffix,value=value.slice(0,i);break}}comma&&!zero&&(value=group(value,1/0));var length=valuePrefix.length+value.length+valueSuffix.length,padding=length<width?new Array(width-length+1).join(fill):"";switch(comma&&zero&&(value=group(padding+value,padding.length?width-valueSuffix.length:1/0),padding=""),align){case"<":value=valuePrefix+value+valueSuffix+padding;break;case"=":value=valuePrefix+padding+value+valueSuffix;break;case"^":value=padding.slice(0,length=padding.length>>1)+valuePrefix+value+valueSuffix+padding.slice(length);break;default:value=padding+valuePrefix+value+valueSuffix}return numerals(value)}return precision=void 0===precision?6:/[gprs]/.test(type)?Math.max(1,Math.min(21,precision)):Math.max(0,Math.min(20,precision)),format.toString=function(){return specifier+""},format}return{format:newFormat,formatPrefix:function(specifier,value){var f=newFormat(((specifier=formatSpecifier(specifier)).type="f",specifier)),e=3*Math.max(-8,Math.min(8,Math.floor(exponent(value)/3))),k=Math.pow(10,-e),prefix=prefixes[8+e/3];return function(value){return f(k*value)+prefix}}}}function tickFormat(start,stop,count,specifier){var precision,step=function(start,stop,count){var step0=Math.abs(stop-start)/Math.max(0,count),step1=Math.pow(10,Math.floor(Math.log(step0)/Math.LN10)),error=step0/step1;return error>=e10?step1*=10:error>=e5?step1*=5:error>=e2&&(step1*=2),stop<start?-step1:step1}(start,stop,count);switch((specifier=formatSpecifier(null==specifier?",f":specifier)).type){case"s":var value=Math.max(Math.abs(start),Math.abs(stop));return null!=specifier.precision||isNaN(precision=function(step,value){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(exponent(value)/3)))-exponent(Math.abs(step)))}(step,value))||(specifier.precision=precision),formatPrefix(specifier,value);case"":case"e":case"g":case"p":case"r":null!=specifier.precision||isNaN(precision=function(step,max){return step=Math.abs(step),max=Math.abs(max)-step,Math.max(0,exponent(max)-exponent(step))+1}(step,Math.max(Math.abs(start),Math.abs(stop))))||(specifier.precision=precision-("e"===specifier.type));break;case"f":case"%":null!=specifier.precision||isNaN(precision=function(step){return Math.max(0,-exponent(Math.abs(step)))}(step))||(specifier.precision=precision-2*("%"===specifier.type))}return format(specifier)}function linearish(scale){var domain=scale.domain;return scale.ticks=function(count){var d=domain();return function(start,stop,count){var reverse,n,ticks,step,i=-1;if(count=+count,(start=+start)==(stop=+stop)&&count>0)return[start];if((reverse=stop<start)&&(n=start,start=stop,stop=n),0===(step=tickIncrement(start,stop,count))||!isFinite(step))return[];if(step>0){let r0=Math.round(start/step),r1=Math.round(stop/step);for(r0*step<start&&++r0,r1*step>stop&&--r1,ticks=new Array(n=r1-r0+1);++i<n;)ticks[i]=(r0+i)*step}else{step=-step;let r0=Math.round(start*step),r1=Math.round(stop*step);for(r0/step<start&&++r0,r1/step>stop&&--r1,ticks=new Array(n=r1-r0+1);++i<n;)ticks[i]=(r0+i)/step}return reverse&&ticks.reverse(),ticks}(d[0],d[d.length-1],null==count?10:count)},scale.tickFormat=function(count,specifier){var d=domain();return tickFormat(d[0],d[d.length-1],null==count?10:count,specifier)},scale.nice=function(count){null==count&&(count=10);var prestep,step,d=domain(),i0=0,i1=d.length-1,start=d[i0],stop=d[i1],maxIter=10;for(stop<start&&(step=start,start=stop,stop=step,step=i0,i0=i1,i1=step);maxIter-- >0;){if((step=tickIncrement(start,stop,count))===prestep)return d[i0]=start,d[i1]=stop,domain(d);if(step>0)start=Math.floor(start/step)*step,stop=Math.ceil(stop/step)*step;else{if(!(step<0))break;start=Math.ceil(start*step)/step,stop=Math.floor(stop*step)/step}prestep=step}return scale},scale}function linear$1(){var scale=continuous();return scale.copy=function(){return copy(scale,linear$1())},initRange.apply(scale,arguments),linearish(scale)}function findStratcolumnUnit(units,unitname,path){void 0===path&&(path=[]);var unit=units.find((function(u){return u.identifier.toLowerCase()===unitname.toLowerCase()}));if(unit){var temp_1=unit;do{path.unshift(temp_1),temp_1=units.find((function(u){return u.identifier===temp_1.stratUnitParent}))}while(temp_1);return unit}return null}function getColorFromUnit(unit){return null===unit.colorR||null===unit.colorG||null===unit.colorB?2147483648:unit.colorR<<16|unit.colorG<<8|unit.colorB}locale=formatLocale({thousands:",",grouping:[3],currency:["$",""]}),format=locale.format,formatPrefix=locale.formatPrefix;var unassignedColorScale=function ordinal(){var index=new InternMap,domain=[],range=[],unknown=implicit;function scale(d){let i=index.get(d);if(void 0===i){if(unknown!==implicit)return unknown;index.set(d,i=domain.push(d)-1)}return range[i%range.length]}return scale.domain=function(_){if(!arguments.length)return domain.slice();domain=[],index=new InternMap;for(const value of _)index.has(value)||index.set(value,domain.push(value)-1);return scale},scale.range=function(_){return arguments.length?(range=Array.from(_),scale):range.slice()},scale.unknown=function(_){return arguments.length?(unknown=_,scale):unknown},scale.copy=function(){return ordinal(domain,range).unknown(unknown)},initRange.apply(scale,arguments),scale}().domain([0,100]).range(function(interpolator,n){for(var samples=new Array(n),i=0;i<n;++i)samples[i]=interpolator(i/(n-1));return samples}(interpolateRgb("#e6f1cf","#85906d"),10));function isAnchestor(descendant,candidate,stratColumn){var path=[];return findStratcolumnUnit(stratColumn,descendant.name,path),path.some((function(p){return candidate.name===p.identifier}))}
|
|
400
385
|
/*! *****************************************************************************
|
|
401
386
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
402
387
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -411,4 +396,4 @@ Renderer.registerPlugin("accessibility",AccessibilityManager),Renderer.registerP
|
|
|
411
396
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
412
397
|
and limitations under the License.
|
|
413
398
|
***************************************************************************** */
|
|
414
|
-
var extendStatics$l=function(d,b){return(extendStatics$l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},__assign$1=function(){return(__assign$1=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)};function reduce(v,func,r){void 0===r&&(r=0);for(var i=0;i<v.length;i++)r=func(r,v[i],i);return r}var EPS=Math.pow(2,-42);function cuberoot(x){var y=Math.pow(Math.abs(x),1/3);return x<0?-y:y}function getQuadRoots(a,b,c){if(Math.abs(a)<EPS)return Math.abs(b)<EPS?[]:[-c/b];var D=b*b-4*a*c;return Math.abs(D)<EPS?[-b/(2*a)]:D>0?[(-b+Math.sqrt(D))/(2*a),(-b-Math.sqrt(D))/(2*a)]:[]}function getCoefficients(v0,v1,v2,v3,v,tension){void 0===v&&(v=0),void 0===tension&&(tension=.5);var c=(1-tension)*(v2-v0)*.5,x=(1-tension)*(v3-v1)*.5;return[2*v1-2*v2+c+x,-3*v1+3*v2-2*c-x,c,v1-v]}function solveForT(t,tension,v0,v1,v2,v3){if(Math.abs(t)<EPS)return v1;if(Math.abs(1-t)<EPS)return v2;var t2=t*t,t3=t*t2,_a=getCoefficients(v0,v1,v2,v3,0,tension);return _a[0]*t3+_a[1]*t2+_a[2]*t+_a[3]}function getDerivativeOfT(t,tension,v0,v1,v2,v3){var t2=t*t,_a=getCoefficients(v0,v1,v2,v3,0,tension);return 3*_a[0]*t2+2*_a[1]*t+_a[2]}function distance(p1,p2){return Math.sqrt(reduce(p2,(function(s,c,i){return s+Math.pow(c-p1[i],2)})))}function normalize$2(v){var squared=reduce(v,(function(s,c){return s+Math.pow(c,2)})),l=Math.sqrt(squared);return 0===l?function(v,val){for(var i=0;i<v.length;i++)v[i]=val;return v}(v,0):function(v,func){for(var i=0;i<v.length;i++)v[i]=func(v[i],i);return v}(v,(function(c){return c/l}))}function getControlPoints(idx,points,closed){var p0,p1,p2,p3,maxIndex=points.length-1;return closed?(p0=points[idx-1<0?maxIndex:idx-1],p1=points[idx%points.length],p2=points[(idx+1)%points.length],p3=points[(idx+2)%points.length]):(p0=points[Math.max(0,idx-1)],p1=points[idx],p2=points[Math.min(maxIndex,idx+1)],p3=points[Math.min(maxIndex,idx+2)]),[p0,p1,p2,p3]}function getPointAtT(t,points,options,target){void 0===options&&(options={});var tension=Number.isFinite(options.tension)?options.tension:.5,closed=!!options.closed,func=options.func||solveForT,nPoints=closed?points.length:points.length-1,p=nPoints*t,idx=Math.floor(p),weight=p-idx,_a=getControlPoints(idx,points,closed),p0=_a[0],p1=_a[1],p2=_a[2],p3=_a[3];target=target||new Array(p0.length);for(var i=0;i<p0.length;i++)target[i]=func(weight,tension,p0[i],p1[i],p2[i],p3[i]);return 3===nPoints&&target[1],target}function getTangentAtT(t,points,options,target){void 0===options&&(options={});var tension=Number.isFinite(options.tension)?options.tension:.5,closed=!!options.closed;return 1===tension&&0===t?t+=EPS:1===tension&&1===t&&(t-=EPS),getPointAtT(t,points,{tension:tension,closed:closed,func:getDerivativeOfT},target)}function getArcLengths(points,divisions,options){void 0===options&&(options={});var current,lengths=[],last=getPointAtT(0,points,options),sum=0;divisions=divisions||300,lengths.push(0);for(var p=1;p<=divisions;p++)sum+=distance(current=getPointAtT(p/divisions,points,options),last),lengths.push(sum),last=current;return lengths}function getUtoTmapping(u,arcLengths){for(var comparison,il=arcLengths.length,targetArcLength=u*arcLengths[il-1],low=0,high=il-1,i=0;low<=high;)if((comparison=arcLengths[i=Math.floor(low+(high-low)/2)]-targetArcLength)<0)low=i+1;else{if(!(comparison>0)){high=i;break}high=i-1}if(arcLengths[i=high]===targetArcLength)return i/(il-1);var lengthBefore=arcLengths[i];return(i+(targetArcLength-lengthBefore)/(arcLengths[i+1]-lengthBefore))/(il-1)}function getTtoUmapping(t,arcLengths){if(0===t)return 0;if(1===t)return 1;var al=arcLengths.length-1,totalLength=arcLengths[al],tIdx=t*al,subIdx=Math.floor(tIdx),l1=arcLengths[subIdx];return tIdx===subIdx?l1/totalLength:(l1+(tIdx-subIdx)*(arcLengths[subIdx+1]-l1))/totalLength}function getTAtValue(lookup,tension,v0,v1,v2,v3){var _a=getCoefficients(v0,v1,v2,v3,lookup,tension),a=_a[0],b=_a[1],c=_a[2],d=_a[3];return 0===a&&0===b&&0===c&&0===d?[0]:function(a,b,c,d){if(Math.abs(a)<EPS)return getQuadRoots(b,c,d);var roots,p=(3*a*c-b*b)/(3*a*a),q=(2*b*b*b-9*a*b*c+27*a*a*d)/(27*a*a*a);if(Math.abs(p)<EPS)roots=[cuberoot(-q)];else if(Math.abs(q)<EPS)roots=[0].concat(p<0?[Math.sqrt(-p),-Math.sqrt(-p)]:[]);else{var D=q*q/4+p*p*p/27;if(Math.abs(D)<EPS)roots=[-1.5*q/p,3*q/p];else if(D>0)roots=[(u=cuberoot(-q/2-Math.sqrt(D)))-p/(3*u)];else{var u=2*Math.sqrt(-p/3),t=Math.acos(3*q/p/u)/3,k=2*Math.PI/3;roots=[u*Math.cos(t),u*Math.cos(t-k),u*Math.cos(t-2*k)]}}for(var i=0;i<roots.length;i++)roots[i]-=b/(3*a);return roots}(a,b,c,d).filter((function(t){return t>-EPS&&t<=1+EPS})).map((function(t){return function(value,min,max){return void 0===min&&(min=0),void 0===max&&(max=1),value<min?min:value>max?max:value}(t,0,1)}))}var CurveInterpolator=function(){function CurveInterpolator(points,options){void 0===options&&(options={}),options=__assign$1({tension:.5,arcDivisions:300,closed:!1},options),this._cache={},this._tension=options.tension,this._arcDivisions=options.arcDivisions,this._lmargin=options.lmargin||1-this._tension,this._closed=options.closed,this.points=points}return CurveInterpolator.prototype.getT=function(position){return getUtoTmapping(position,this.arcLengths)},CurveInterpolator.prototype.getPointAt=function(position,target){var options={tension:this.tension,closed:this.closed};return getPointAtT(this.getT(position),this.points,options,target)},CurveInterpolator.prototype.getTangentAt=function(position,target){return void 0===target&&(target=null),normalize$2(getTangentAtT(this.getT(position),this.points,{tension:this.tension,closed:this.closed},target))},CurveInterpolator.prototype.getBoundingBox=function(from,to){if(void 0===from&&(from=0),void 0===to&&(to=1),0===from&&1===to&&this._cache.bbox)return this._cache.bbox;var bbox=function(points,options){void 0===options&&(options={});for(var _a=__assign$1({tension:.5,closed:!1,from:0,to:1,arcLengths:null,arcDivisions:300},options),tension=_a.tension,closed=_a.closed,u0=_a.from,u1=_a.to,arcLengths=_a.arcLengths,arcDivisions=_a.arcDivisions,nPoints=closed?points.length:points.length-1,t0=getUtoTmapping(u0,arcLengths=arcLengths||getArcLengths(points,arcDivisions,{tension:tension,closed:closed})),t1=getUtoTmapping(u1,arcLengths),i0=Math.floor(nPoints*t0),i1=Math.ceil(nPoints*t1),start=getPointAtT(t0,points,{tension:tension,closed:closed}),end=getPointAtT(t1,points,{tension:tension,closed:closed}),min=[],max=[],c=0;c<start.length;c++)min[c]=Math.min(start[c],end[c]),max[c]=Math.max(start[c],end[c]);for(var _loop_1=function(i){var _a=getControlPoints(i-1,points,closed),p0=_a[0],p1=_a[1],p2=_a[2],p3=_a[3];if(i<i1)for(var c=0;c<p2.length;c++)p2[c]<min[c]&&(min[c]=p2[c]),p2[c]>max[c]&&(max[c]=p2[c]);if(tension<1){var w0_1=nPoints*t0-(i-1),w1_1=nPoints*t1-(i-1),valid=function(t){return t>-EPS&&t<=1+EPS&&(i-1!==i0||t>w0_1)&&(i!==i1||t<w1_1)},_loop_2=function(c){var _a=getCoefficients(p0[c],p1[c],p2[c],p3[c],0,tension);getQuadRoots(3*_a[0],2*_a[1],_a[2]).filter(valid).forEach((function(t){var v=solveForT(t,tension,p0[c],p1[c],p2[c],p3[c]);v<min[c]&&(min[c]=v),v>max[c]&&(max[c]=v)}))};for(c=0;c<p0.length;c++)_loop_2(c)}},i=i0+1;i<=i1;i++)_loop_1(i);return{min:min,max:max}}(this.points,{from:from,to:to,tension:this.tension,closed:this.closed,arcLengths:this.arcLengths});return 0===from&&1===to&&(this._cache.bbox=bbox),bbox},CurveInterpolator.prototype.getPoints=function(samples,returnType,from,to){if(void 0===samples&&(samples=100),void 0===from&&(from=0),void 0===to&&(to=1),!samples||samples<=0)throw Error("Invalid arguments passed to getPoints(). You must specify at least 1 sample/segment.");if(!(from<0||to>1||to<from)){for(var pts=[],d=0;d<=samples;d++){var u=0===from&&1===to?d/samples:from+d/samples*(to-from);pts.push(this.getPointAt(u,returnType&&new returnType))}return pts}},CurveInterpolator.prototype.lookup=function(v,axis,max,margin){void 0===axis&&(axis=0),void 0===max&&(max=0),void 0===margin&&(margin=this._lmargin);var matches=function(lookup,points,options){for(var _a=__assign$1({axis:0,tension:.5,closed:!1,margin:.5,max:0,processRefAxis:!1,func:solveForT},options),func=_a.func,axis=_a.axis,tension=_a.tension,closed=_a.closed,margin=_a.margin,max=_a.max,processRefAxis=_a.processRefAxis,k=axis,solutions=[],nPoints=closed?points.length:points.length-1,i=0;i<nPoints;i+=1){var idx=max<0?nPoints-(i+1):i,_b=getControlPoints(idx,points,closed),p0=_b[0],p1=_b[1],p2=_b[2],p3=_b[3],vmin=void 0,vmax=void 0;if(p1[k]<p2[k]?(vmin=p1[k],vmax=p2[k]):(vmin=p2[k],vmax=p1[k]),lookup-margin<=vmax&&lookup+margin>=vmin){var ts=getTAtValue(lookup,tension,p0[k],p1[k],p2[k],p3[k]);max<0?ts.sort((function(a,b){return b-a})):max>=0&&ts.sort((function(a,b){return a-b}));for(var j=0;j<ts.length;j++)if(!(0===ts[j]&&i>0)){for(var coord=[],c=0;c<p0.length;c++){var v;v=c!==k||processRefAxis?func(ts[j],tension,p0[c],p1[c],p2[c],p3[c],idx-1):lookup,coord[c]=v}if(solutions.push(coord),solutions.length===Math.abs(max))return solutions}}}return solutions}(v,this.points,{axis:axis,tension:this.tension,closed:this.closed,max:max,margin:margin});return 1===Math.abs(max)&&1===matches.length?matches[0]:matches},CurveInterpolator.prototype.lookupPositions=function(v,axis,max,margin){return void 0===axis&&(axis=0),void 0===max&&(max=0),void 0===margin&&(margin=this._lmargin),function(lookup,points,options){for(var _a=__assign$1({axis:0,tension:.5,closed:!1,margin:.5,max:0},options),axis=_a.axis,tension=_a.tension,closed=_a.closed,margin=_a.margin,max=_a.max,k=axis,solutions=new Set,arcLengths=options.arcLengths||getArcLengths(points,options.arcDivisions||300,{tension:tension,closed:closed}),nPoints=closed?points.length:points.length-1,i=0;i<nPoints;i+=1){var idx=max<0?points.length-i:i,_b=getControlPoints(idx,points,closed),p0=_b[0],p1=_b[1],p2=_b[2],p3=_b[3],vmin=void 0,vmax=void 0;if(p1[k]<p2[k]?(vmin=p1[k],vmax=p2[k]):(vmin=p2[k],vmax=p1[k]),lookup-margin<=vmax&&lookup+margin>=vmin){var ts=getTAtValue(lookup,tension,p0[k],p1[k],p2[k],p3[k]);max<0?ts.sort((function(a,b){return b-a})):max>=0&&ts.sort((function(a,b){return a-b}));for(var j=0;j<ts.length;j++)if(!(0===ts[j]&&i>0)){var u=getTtoUmapping((ts[j]+idx)/nPoints,arcLengths);if(solutions.add(u),solutions.size===Math.abs(max))return Array.from(solutions)}}}return Array.from(solutions)}(v,this.points,{axis:axis,arcLengths:this.arcLengths,tension:this.tension,closed:this.closed,max:max,margin:margin})},CurveInterpolator.prototype.invalidateCache=function(){var _this=this;return Object.keys(this._cache).forEach((function(key){delete _this._cache[key]})),this},Object.defineProperty(CurveInterpolator.prototype,"points",{get:function(){return this._points},set:function(pts){this._points=pts,this.invalidateCache()},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"tension",{get:function(){return this._tension},set:function(t){t!==this._tension&&(this._tension=t,this.invalidateCache())},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"closed",{get:function(){return this._closed},set:function(isClosed){isClosed!==this._closed&&(this._closed=isClosed,this.invalidateCache())},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"arcDivisions",{get:function(){return this._arcDivisions},set:function(n){n!==this._arcDivisions&&(this._arcDivisions=n,this.invalidateCache())},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"arcLengths",{get:function(){if(this._cache.arcLengths)return this._cache.arcLengths;var arcLengths=getArcLengths(this.points,this.arcDivisions,{tension:this.tension,closed:this.closed});return this._cache.arcLengths=arcLengths,arcLengths},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"length",{get:function(){var lengths=this.arcLengths;return lengths[lengths.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"minX",{get:function(){return this.getBoundingBox().min[0]},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"maxX",{get:function(){return this.getBoundingBox().max[0]},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"minY",{get:function(){return this.getBoundingBox().min[1]},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"maxY",{get:function(){return this.getBoundingBox().max[1]},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"minZ",{get:function(){return this.getBoundingBox().min[2]},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"maxZ",{get:function(){return this.getBoundingBox().max[2]},enumerable:!0,configurable:!0}),CurveInterpolator}();!function(_super){function CurveInterpolator2D(points,tension,arcDivisions,closed){return void 0===tension&&(tension=.5),void 0===arcDivisions&&(arcDivisions=300),void 0===closed&&(closed=!1),_super.call(this,points,{tension:tension,arcDivisions:arcDivisions,closed:closed})||this}(function(d,b){function __(){this.constructor=d}extendStatics$l(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)})(CurveInterpolator2D,_super),CurveInterpolator2D.prototype.x=function(y,max,margin){void 0===max&&(max=0),void 0===margin&&(margin=this._lmargin);var res=this.lookup(y,1,max,margin);return 1===Math.abs(max)?res[0]:res.map((function(d){return d[0]}))},CurveInterpolator2D.prototype.y=function(x,max,margin){void 0===max&&(max=0),void 0===margin&&(margin=this._lmargin);var res=this.lookup(x,0,max,margin);return 1===Math.abs(max)?res[1]:res.map((function(d){return d[1]}))},CurveInterpolator2D.prototype.getNormalAt=function(position,target){return normalize$2(function(v){if(v.length>2)throw Error("Only supported for 2d vectors");var x=-v[1];return v[1]=v[0],v[0]=x,v}(getTangentAtT(this.getT(position),this.points,{tension:this.tension,closed:this.closed},target)))},CurveInterpolator2D.prototype.getAngleAt=function(position){var tan=getTangentAtT(this.getT(position),this.points,{tension:this.tension,closed:this.closed});return Math.atan2(tan[1],tan[0])},CurveInterpolator2D.prototype.getBoundingBox=function(from,to){void 0===from&&(from=0),void 0===to&&(to=1);var bbox=_super.prototype.getBoundingBox.call(this,from,to);return{x1:bbox.min[0],x2:bbox.max[0],y1:bbox.min[1],y2:bbox.max[1],min:bbox.min,max:bbox.max}}}(CurveInterpolator),function(){function Point(x,y,z,w){void 0===x&&(x=0),void 0===y&&(y=0),void 0===z&&(z=null),void 0===w&&(w=null),this.x=x,this.y=y,this.z=z,this.w=w}Object.defineProperty(Point.prototype,0,{get:function(){return this.x},set:function(x){this.x=x},enumerable:!0,configurable:!0}),Object.defineProperty(Point.prototype,1,{get:function(){return this.y},set:function(y){this.y=y},enumerable:!0,configurable:!0}),Object.defineProperty(Point.prototype,2,{get:function(){return this.z},set:function(z){this.z=z},enumerable:!0,configurable:!0}),Object.defineProperty(Point.prototype,3,{get:function(){return this.w},set:function(w){this.w=w},enumerable:!0,configurable:!0}),Object.defineProperty(Point.prototype,"length",{get:function(){return Number.isFinite(this.w)?4:Number.isFinite(this.z)?3:2},enumerable:!0,configurable:!0})}();function simplify(inputArr,maxOffset,maxDistance){var _a;if(void 0===maxOffset&&(maxOffset=.001),void 0===maxDistance&&(maxDistance=10),inputArr.length<=4)return inputArr;for(var _b=inputArr[0],o0=_b[0],o1=_b[1],arr=inputArr.map((function(d){return[d[0]-o0,d[1]-o1]})),_c=arr[0],a0=_c[0],a1=_c[1],sim=[inputArr[0]],i=1;i+1<arr.length;i++){var _d=arr[i],t0=_d[0],t1=_d[1],_e=arr[i+1],b0=_e[0],b1=_e[1];if(b0-t0!=0||b1-t1!=0){var proximity=Math.abs(a0*b1-a1*b0+b0*t1-b1*t0+a1*t0-a0*t1)/Math.sqrt(Math.pow(b0-a0,2)+Math.pow(b1-a1,2)),dir=[a0-t0,a1-t1],len=Math.sqrt(Math.pow(dir[0],2)+Math.pow(dir[1],2));(proximity>maxOffset||len>=maxDistance)&&(sim.push([t0+o0,t1+o1]),a0=(_a=[t0,t1])[0],a1=_a[1])}}var last=arr[arr.length-1];return sim.push([last[0]+o0,last[1]+o1]),sim}function projectCurtain(points,origin,offset){void 0===origin&&(origin=null),void 0===offset&&(offset=0);var p0=origin||points[0],l=0;return points.map((function(p1){var dx=p1[0]-p0[0],dy=p1[1]-p0[1];return l+=Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2)),p0=p1,[offset>0?offset-l:l,p1[2]||0]}))}function findIndexOfSample(data,pos){for(var a=0,b=data.length-1,aPos=data[a][0],bPos=data[b][0];b-a>20;){var splitAt=Math.floor((b+a)/2),splitPos=data[splitAt][0];if(pos>=aPos&&pos<splitPos)bPos=data[b=splitAt][0];else if(pos>=splitPos&&pos<=bPos)aPos=data[a=splitAt][0];else if(pos<=aPos&&pos>splitPos)bPos=data[b=splitAt][0];else{if(!(pos<=splitPos&&pos>=bPos))return-1;aPos=data[a=splitAt][0]}}for(var index=-1,i=a;i<b;i++){var v1=data[i][0],v2=data[i+1][0];if(Math.min(v1,v2)<=pos&&pos<=Math.max(v1,v2)){index=i;break}}return index}function findSampleAtPos(data,pos,topLimit,bottomLimit){void 0===topLimit&&(topLimit=null),void 0===bottomLimit&&(bottomLimit=null);var y=null,index=findIndexOfSample(data,pos);if(-1!==index){var v1=data[index][1],v2=data[index+1][1];if(v2&&v2){var x1=data[index][0],f=(pos-x1)/(data[index+1][0]-x1);y=v1*(1-f)+v2*f,topLimit&&topLimit>y&&(y=topLimit),bottomLimit&&bottomLimit<y&&(y=bottomLimit)}}return y}function mapPick(p,groupName){return{title:p.pickIdentifier||p.identifier,group:groupName,label:p.md+" "+p.mdUnit+" "+p.depthReferencePoint,color:"strat-picks"===groupName?"#227":"rgba(0,0,0,0.8)",md:p.md}}var GeomodelLabelsLayer=function(_super){function GeomodelLabelsLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.defaultMargins=18,_this.defaultMinFontSize=8,_this.defaultMaxFontSize=13,_this.defaultTextColor="black",_this.defaultFont="Arial",_this.isLabelsOnLeftSide=!0,_this.maxFontSizeInWorldCoordinates=70,_this.isXFlipped=!1,_this.areasWithAvgTopDepth=null,_this.drawAreaLabel=function(surfaceArea,nextSurfaceArea,surfaces,i){var data=surfaceArea.data,_a=_this,ctx=_a.ctx,maxFontSizeInWorldCoordinates=_a.maxFontSizeInWorldCoordinates,isXFlipped=_a.isXFlipped,_b=_this.rescaleEvent,xScale=_b.xScale,yScale=_b.yScale,xRatio=_b.xRatio,yRatio=_b.yRatio,zFactor=_b.zFactor,isLabelsOnLeftSide=_this.checkDrawLabelsOnLeftSide(),marginsInWorldCoords=(_this.options.margins||_this.defaultMargins)*(isXFlipped?-1:1)/xRatio,minFontSize=_this.options.minFontSize||_this.defaultMinFontSize,fontSizeInWorldCoords=(_this.options.maxFontSize||_this.defaultMaxFontSize)/yRatio;fontSizeInWorldCoords>maxFontSizeInWorldCoordinates&&(fontSizeInWorldCoords=maxFontSizeInWorldCoordinates)*yRatio<minFontSize&&(fontSizeInWorldCoords=minFontSize/yRatio);var leftEdge=xScale.invert(xScale.range()[0])+marginsInWorldCoords,rightEdge=xScale.invert(xScale.range()[1])-marginsInWorldCoords,_c=_this.getSurfacesAreaEdges(),surfaceAreaLeftEdge=_c[0],surfaceAreaRightEdge=_c[1];ctx.save(),ctx.font=fontSizeInWorldCoords*yRatio+"px "+(_this.options.font||_this.defaultFont);var startPos,labelMetrics=ctx.measureText(surfaceArea.label),labelLengthInWorldCoords=labelMetrics.width/xRatio;if(isLabelsOnLeftSide){var labelRightEdge=leftEdge+(isXFlipped?-labelLengthInWorldCoords:labelLengthInWorldCoords);(!isXFlipped&&labelRightEdge>surfaceAreaRightEdge||isXFlipped&&labelRightEdge<surfaceAreaRightEdge)&&(isLabelsOnLeftSide=!1)}else{var labelLeftEdge=rightEdge+(isXFlipped?labelLengthInWorldCoords:-labelLengthInWorldCoords);(!isXFlipped&&labelLeftEdge<surfaceAreaLeftEdge||isXFlipped&&labelLeftEdge>surfaceAreaLeftEdge)&&(isLabelsOnLeftSide=!0)}startPos=isLabelsOnLeftSide?isXFlipped?Math.min(surfaceAreaLeftEdge,leftEdge):Math.max(surfaceAreaLeftEdge,leftEdge):isXFlipped?Math.max(surfaceAreaRightEdge,rightEdge):Math.min(surfaceAreaRightEdge,rightEdge);var topEdge=yScale.invert(yScale.range()[0]),bottomEdge=yScale.invert(yScale.range()[1]),posStep=labelLengthInWorldCoords/3*.07*(isLabelsOnLeftSide?1:-1)*(isXFlipped?-1:1),dirStep=labelLengthInWorldCoords/5*(isLabelsOnLeftSide?1:-1)*(isXFlipped?-1:1),topData=data.map((function(d){return[d[0],d[1]]})),topPos=_this.calcPos(topData,startPos,3,posStep,topEdge,bottomEdge);if(topPos){var bottomData=data.map((function(d){return[d[0],d[2]]})),bottomPos=_this.calcPos(bottomData,startPos,3,posStep,topEdge,bottomEdge,nextSurfaceArea?nextSurfaceArea.data.map((function(d){return[d[0],d[1]]})):null,surfaces,i);bottomPos||(bottomPos=new Vector2(topPos.x,bottomEdge));var thickness=bottomPos.y-topPos.y;if(thickness<fontSizeInWorldCoords){if(thickness*yRatio<minFontSize)return;fontSizeInWorldCoords=thickness,ctx.font=fontSizeInWorldCoords*yRatio+"px "+(_this.options.font||_this.defaultFont),labelLengthInWorldCoords=(labelMetrics=ctx.measureText(surfaceArea.label)).width/xRatio}var initialDirVec=isLabelsOnLeftSide!==isXFlipped?Vector2.right:Vector2.left,areaDir=_this.calcAreaDir(topData,bottomData,startPos,5,dirStep,initialDirVec,topEdge,bottomEdge,0,Math.PI/4,4,nextSurfaceArea?nextSurfaceArea.data.map((function(d){return[d[0],d[1]]})):null,surfaces,i),scaledAngle=Math.atan(Math.tan(areaDir)*zFactor),textX=startPos,textY=(topPos.y+bottomPos.y)/2,textAngle=isXFlipped?-scaledAngle:scaledAngle;ctx.textAlign=isLabelsOnLeftSide?"left":"right",ctx.translate(xScale(textX),yScale(textY)),ctx.rotate(textAngle),ctx.fillStyle=_this.options.textColor||_this.defaultTextColor,ctx.font=fontSizeInWorldCoords*yRatio+"px "+(_this.options.font||_this.defaultFont),ctx.textBaseline="middle",ctx.fillText(surfaceArea.label,0,0),ctx.restore()}},_this.drawLineLabel=function(s){var _a=_this,ctx=_a.ctx,isXFlipped=_a.isXFlipped,_b=_this.rescaleEvent,xScale=_b.xScale,yScale=_b.yScale,xRatio=_b.xRatio,yRatio=_b.yRatio,zFactor=_b.zFactor,isLabelsOnLeftSide=_this.checkDrawLabelsOnLeftSide(),marginsInWorldCoords=_this.getMarginsInWorldCoordinates(),fontSizeInWorldCoords=(_this.options.maxFontSize||_this.defaultMaxFontSize)/yRatio;ctx.save(),ctx.font=fontSizeInWorldCoords*yRatio+"px "+(_this.options.font||_this.defaultFont);var startPos,labelLengthInWorldCoords=ctx.measureText(s.label).width/xRatio,leftEdge=xScale.invert(xScale.range()[0])+marginsInWorldCoords,rightEdge=xScale.invert(xScale.range()[1])-marginsInWorldCoords,_c=_this.getSurfacesAreaEdges(),surfaceAreaLeftEdge=_c[0],surfaceAreaRightEdge=_c[1];startPos=isLabelsOnLeftSide?isXFlipped?Math.max(surfaceAreaRightEdge,rightEdge):Math.min(surfaceAreaRightEdge,rightEdge):isXFlipped?Math.min(surfaceAreaLeftEdge,leftEdge):Math.max(surfaceAreaLeftEdge,leftEdge);var step=labelLengthInWorldCoords/5*(isLabelsOnLeftSide?-1:1),data=s.data,pos=_this.calcPos(data,startPos,5,step),dir=_this.calcLineDir(data,startPos,5,step,zFactor,isLabelsOnLeftSide?Vector2.left:Vector2.right);if(pos&&dir){var textX=startPos,textY=pos.y-1-fontSizeInWorldCoords/2,textDir=Vector2.angleRight(dir)-(isLabelsOnLeftSide?Math.PI:0);ctx.textAlign=isLabelsOnLeftSide?"right":"left",ctx.translate(xScale(textX),yScale(textY)),ctx.rotate(textDir),ctx.fillStyle=_this.colorToCSSColor(s.color),ctx.textBaseline="middle",ctx.fillText(s.label,0,0),ctx.restore()}},_this.render=_this.render.bind(_this),_this.getMarginsInWorldCoordinates=_this.getMarginsInWorldCoordinates.bind(_this),_this.getSurfacesAreaEdges=_this.getSurfacesAreaEdges.bind(_this),_this.updateXFlipped=_this.updateXFlipped.bind(_this),_this.generateSurfacesWithAvgDepth=_this.generateSurfacesWithAvgDepth.bind(_this),_this}return __extends(GeomodelLabelsLayer,_super),Object.defineProperty(GeomodelLabelsLayer.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),GeomodelLabelsLayer.prototype.setData=function(data){_super.prototype.setData.call(this,data),this.areasWithAvgTopDepth=null},GeomodelLabelsLayer.prototype.generateSurfacesWithAvgDepth=function(){var areas=this.data.areas;this.areasWithAvgTopDepth=areas.reduce((function(acc,area){if(!area.label)return acc;var sumAndCount=area.data.reduce((function(a,d){return null!=d[1]&&(a.sum+=d[1],a.count++),a}),{sum:0,count:0});if(0===sumAndCount.count)return acc;var avgTopDepth=sumAndCount.sum/sumAndCount.count;return acc.push(__assign(__assign({},area),{avgTopDepth:avgTopDepth})),acc}),[])},GeomodelLabelsLayer.prototype.onMount=function(event){_super.prototype.onMount.call(this,event)},GeomodelLabelsLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.render()},GeomodelLabelsLayer.prototype.onRescale=function(event){this.rescaleEvent=event,this.updateXFlipped(),this.resetTransform(),this.render()},GeomodelLabelsLayer.prototype.render=function(){var _this=this;this.rescaleEvent&&requestAnimationFrame((function(){_this.clearCanvas(),_this.data&&(_this.areasWithAvgTopDepth||_this.generateSurfacesWithAvgDepth(),_this.drawAreaLabels(),_this.drawLineLabels())}))},GeomodelLabelsLayer.prototype.drawAreaLabels=function(){var _this=this;this.areasWithAvgTopDepth.forEach((function(s,i,array){var topmostSurfaceNotDrawnYet=array.reduce((function(acc,v,index){return index>i&&(null==acc||v.avgTopDepth<acc.avgTopDepth)&&(acc=v),acc}),null);_this.drawAreaLabel(s,topmostSurfaceNotDrawnYet,array,i)}))},GeomodelLabelsLayer.prototype.drawLineLabels=function(){var _this=this;this.data.lines.filter((function(surfaceLine){return surfaceLine.label})).forEach((function(surfaceLine){return _this.drawLineLabel(surfaceLine)}))},GeomodelLabelsLayer.prototype.colorToCSSColor=function(color){if("string"==typeof color)return color;var hexString=color.toString(16);return"#"+(hexString="000000".substr(0,6-hexString.length)+hexString)},GeomodelLabelsLayer.prototype.calcPos=function(data,offset,count,step,topLimit,bottomLimit,alternativeSurfaceData,surfaces,currentSurfaceIndex){void 0===topLimit&&(topLimit=null),void 0===bottomLimit&&(bottomLimit=null),void 0===alternativeSurfaceData&&(alternativeSurfaceData=null),void 0===surfaces&&(surfaces=null),void 0===currentSurfaceIndex&&(currentSurfaceIndex=null);for(var pos=Vector2.zero.mutable,samples=0,i=0;i<count;i++){var x=offset+i*step,y=findSampleAtPos(data,x,topLimit,bottomLimit);if(y){var alternativeY=this.getAlternativeYValueIfAvailable(x,topLimit,bottomLimit,alternativeSurfaceData,surfaces,currentSurfaceIndex),usedY=alternativeY?Math.min(y,alternativeY):y;pos.add(x,usedY),samples++}}return 0===samples?null:Vector2.divide(pos,samples)},GeomodelLabelsLayer.prototype.getAlternativeYValueIfAvailable=function(x,topLimit,bottomLimit,alternativeSurfaceData,surfaces,currentSurfaceIndex){if(!alternativeSurfaceData)return null;var altY=findSampleAtPos(alternativeSurfaceData,x,topLimit,bottomLimit);if(null==altY&&surfaces&&null!=currentSurfaceIndex)for(var si=currentSurfaceIndex+1;null==altY&&si<surfaces.length;){altY=findSampleAtPos(surfaces[si++].data.map((function(d){return[d[0],d[1]]})),x,topLimit,bottomLimit)}return altY},GeomodelLabelsLayer.prototype.calcLineDir=function(data,offset,count,step,zFactor,initalVector,topLimit,bottomLimit){void 0===initalVector&&(initalVector=Vector2.left),void 0===topLimit&&(topLimit=null),void 0===bottomLimit&&(bottomLimit=null);var dir=initalVector.mutable,startY=findSampleAtPos(data,offset,topLimit,bottomLimit);if(null===startY)return dir;for(var vecAtEnd=new Vector2(offset,startY*zFactor),tmpVec=Vector2.zero.mutable,i=1;i<=count;i++){var x=offset+i*step,y=findSampleAtPos(data,offset,topLimit,bottomLimit);null!==y&&(tmpVec.set(x,y*zFactor),tmpVec.sub(vecAtEnd),dir.add(tmpVec))}return dir},GeomodelLabelsLayer.prototype.calcAreaDir=function(top,bottom,offset,count,step,initalVector,topLimit,bottomLimit,minReductionAngle,maxReductionAngle,angleReductionExponent,alternativeSurfaceBottomData,surfaces,currentSurfaceIndex){void 0===initalVector&&(initalVector=Vector2.left),void 0===topLimit&&(topLimit=null),void 0===bottomLimit&&(bottomLimit=null),void 0===minReductionAngle&&(minReductionAngle=0),void 0===maxReductionAngle&&(maxReductionAngle=Math.PI/4),void 0===angleReductionExponent&&(angleReductionExponent=4),void 0===alternativeSurfaceBottomData&&(alternativeSurfaceBottomData=null),void 0===surfaces&&(surfaces=null),void 0===currentSurfaceIndex&&(currentSurfaceIndex=null);for(var vecAtEnd,angles=[],tmpVec=Vector2.zero.mutable,i=0;i<=count;i++){var x=offset+i*step,topY=findSampleAtPos(top,x,topLimit,bottomLimit),bottomY=findSampleAtPos(bottom,x,topLimit,bottomLimit)||bottomLimit,alternativeBottomY=this.getAlternativeYValueIfAvailable(x,topLimit,bottomLimit,alternativeSurfaceBottomData,surfaces,currentSurfaceIndex),usedBottomY=alternativeBottomY?Math.min(bottomY,alternativeBottomY):bottomY;if(0===i){if(null===topY)return Vector2.angleRight(initalVector);vecAtEnd=new Vector2(offset,(topY+usedBottomY)/2)}else null!==topY?(tmpVec.set(x,(topY+usedBottomY)/2),tmpVec.sub(vecAtEnd),angles.push(Vector2.angleRight(tmpVec))):angles.push(Vector2.angleRight(initalVector))}var refAngle=angles[0],offsetAngles=angles.map((function(d){return d-refAngle})),factors=0;return offsetAngles.reduce((function(acc,v){var ratio=(Math.abs(v)-minReductionAngle)/maxReductionAngle,factor=Math.pow(1-clamp(ratio,0,1),angleReductionExponent);return factors+=factor,acc+v*factor}),0)/factors+refAngle},GeomodelLabelsLayer.prototype.updateXFlipped=function(){var xBounds=this.rescaleEvent.xBounds;this.isXFlipped=xBounds[0]>xBounds[1]},GeomodelLabelsLayer.prototype.getMarginsInWorldCoordinates=function(){var xRatio=this.rescaleEvent.xRatio;return(this.options.margins||this.defaultMargins)*(this.isXFlipped?-1:1)/xRatio},GeomodelLabelsLayer.prototype.getSurfacesAreaEdges=function(){var data=this.data.areas[0].data,maxX=Math.max(data[data.length-1][0],data[0][0]),minX=Math.min(data[0][0],data[data.length-1][0]),marginsInWorldCoords=this.getMarginsInWorldCoordinates(),isXFlipped=this.isXFlipped;return[isXFlipped?maxX+marginsInWorldCoords:minX+marginsInWorldCoords,isXFlipped?minX-marginsInWorldCoords:maxX-marginsInWorldCoords]},GeomodelLabelsLayer.prototype.checkDrawLabelsOnLeftSide=function(){var referenceSystem=this.referenceSystem,isXFlipped=this.isXFlipped;if(!referenceSystem)return!0;var _b=this.rescaleEvent,xScale=_b.xScale,yScale=_b.yScale,xRatio=_b.xRatio,_c=xScale.domain(),dx1=_c[0],dx2=_c[1],_d=yScale.domain(),dy1=_d[0],dy2=_d[1],top=referenceSystem.interpolators.curtain.lookup(dy1,1,0);0===top.length&&(top=[referenceSystem.interpolators.curtain.getPointAt(0)]);var bottom=referenceSystem.interpolators.curtain.lookup(dy2,1,0);0===bottom.length&&(bottom=[referenceSystem.interpolators.curtain.getPointAt(1)]);var maxX=Math.max(top[0][0],bottom[0][0]),minX=Math.min(top[0][0],bottom[0][0]),wbBBox_left=isXFlipped?maxX:minX,wbBBox_right=isXFlipped?minX:maxX,margin=this.getMarginsInWorldCoordinates(),screenLeftEdge=dx1+margin,screenRightEdge=dx2-margin,_e=this.getSurfacesAreaEdges(),surfaceAreaLeftEdge=_e[0],surfaceAreaRightEdge=_e[1],leftLimit=isXFlipped?Math.min(screenLeftEdge,surfaceAreaLeftEdge):Math.max(screenLeftEdge,surfaceAreaLeftEdge),rightLimit=isXFlipped?Math.max(screenRightEdge,surfaceAreaRightEdge):Math.min(screenRightEdge,surfaceAreaRightEdge),spaceOnLeftSide=Math.max(isXFlipped?leftLimit-wbBBox_left:wbBBox_left-leftLimit,0),spaceOnRightSide=Math.max(isXFlipped?wbBBox_right-rightLimit:rightLimit-wbBBox_right,0),spaceOnLeftSideInScreenCoordinates=spaceOnLeftSide*xRatio;return spaceOnLeftSide>spaceOnRightSide||spaceOnLeftSideInScreenCoordinates>200||spaceOnLeftSideInScreenCoordinates<200&&spaceOnRightSide*xRatio<200&&isXFlipped||bottom[1]<dy1},GeomodelLabelsLayer}(CanvasLayer);function pixelsPerUnit(x){var min=x.domain()[0];return Math.abs(x(min+1))}function calcSize(factor,min,max,x){return clamp(pixelsPerUnit(x)*factor,min,max)}function isOverlapping(r1,r2,horizontalPadding,verticalPadding){void 0===horizontalPadding&&(horizontalPadding=4),void 0===verticalPadding&&(verticalPadding=2);var r1x2=r1.x+r1.width+horizontalPadding,r2x2=r2.x+r2.width+horizontalPadding,r1y2=r1.y+r1.height+verticalPadding,r2y2=r2.y+r2.height+verticalPadding;return!(r2.x-horizontalPadding>r1x2||r2.y-verticalPadding>r1y2||r2x2+horizontalPadding<r1.x||r2y2+verticalPadding<r1.y)}function getOverlapOffset(r1,r2,horizontalPadding,verticalPadding){void 0===horizontalPadding&&(horizontalPadding=4),void 0===verticalPadding&&(verticalPadding=2);var r1x2=r1.x+r1.width,r2x2=r2.x+r2.width,r1y2=r1.y+r1.height,r2y2=r2.y+r2.height;return r2.x-horizontalPadding>r1x2||r2.y-verticalPadding>r1y2||r2x2+horizontalPadding<r1.x||r2y2+verticalPadding<r1.y?null:{dx:r1.x+r1.width-r2.x+horizontalPadding,dy:r1.y+r1.height-r2.y+verticalPadding}}var Location_topleft="topleft",Location_topright="topright",Location_bottomleft="bottomleft",Location_bottomright="bottomright",CalloutCanvasLayer=function(_super){function CalloutCanvasLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.groupFilter=null,_this.renderAnnotation=function(title,label,x,y,fontSize,color){_this.renderText(title,x,y-fontSize,fontSize,color,"arial","bold"),_this.renderText(label,x,y,fontSize,color)},_this.renderLine=function(x,y,width,dotX,dotY,color,placeLeft){void 0===placeLeft&&(placeLeft=!0);var ctx=_this.ctx,textX=placeLeft?x:x+width,inverseTextX=placeLeft?x+width:x,textY=y+2;ctx.strokeStyle=color,ctx.lineWidth=1,ctx.beginPath(),ctx.moveTo(dotX,dotY),ctx.lineTo(textX,textY),ctx.lineTo(inverseTextX,textY),ctx.stroke()},_this.minFontSize=options.minFontSize||7,_this.maxFontSize=options.maxFontSize||11,_this.fontSizeFactor=options.fontSizeFactor||7,_this.offsetMin=options.offsetMin||20,_this.offsetMax=options.offsetMax||120,_this.offsetFactor=options.offsetFactor||19,_this}return __extends(CalloutCanvasLayer,_super),CalloutCanvasLayer.prototype.setGroupFilter=function(filter){this.groupFilter=filter,this.callouts=void 0,this.render()},CalloutCanvasLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.callouts=void 0,this.render()},CalloutCanvasLayer.prototype.onRescale=function(event){_super.prototype.onRescale.call(this,event);var isPanning=this.rescaleEvent&&this.rescaleEvent.xRatio===event.xRatio;this.rescaleEvent=event,this.render(isPanning)},CalloutCanvasLayer.prototype.render=function(isPanning){var _this=this;void 0===isPanning&&(isPanning=!1),requestAnimationFrame((function(){if(_this.clearCanvas(),_this.data&&_this.rescaleEvent&&_this.referenceSystem){var _a=_this.rescaleEvent,xScale=_a.xScale,yScale=_a.yScale,xBounds=_a.xBounds,fontSize=calcSize(_this.fontSizeFactor,_this.minFontSize,_this.maxFontSize,xScale);if(!isPanning||!_this.callouts){var _b=_this,data=_b.data,ctx=_b.ctx,groupFilter_1=_b.groupFilter,isLeftToRight=_this.referenceSystem.options.calculateDisplacementFromBottom?xBounds[0]<xBounds[1]:xBounds[0]>xBounds[1];ctx.font="bold "+fontSize+"px arial";var filtered=data.filter((function(d){return!groupFilter_1||groupFilter_1.includes(d.group)})),offset=calcSize(_this.offsetFactor,_this.offsetMin,_this.offsetMax,xScale);_this.callouts=_this.positionCallouts(filtered,isLeftToRight,xScale,yScale,0,fontSize,offset)}_this.callouts.forEach((function(callout){var pos=callout.pos,title=callout.title,color=callout.color,calloutBB={x:xScale(pos.x),y:yScale(pos.y),width:callout.boundingBox.width,height:fontSize,offsetX:callout.dx,offsetY:callout.dy};_this.renderCallout(title,callout.label,calloutBB,color,callout.alignment)}))}}))},CalloutCanvasLayer.prototype.renderText=function(title,x,y,fontSize,color,font,fontStyle){void 0===font&&(font="arial"),void 0===fontStyle&&(fontStyle="normal");var ctx=this.ctx;ctx.font=fontStyle+" "+fontSize+"px "+font,ctx.fillStyle=color,ctx.fillText(title,x,y)},CalloutCanvasLayer.prototype.renderPoint=function(x,y,radius){void 0===radius&&(radius=3);var ctx=this.ctx;ctx.beginPath(),ctx.moveTo(x,y),ctx.arc(x,y,radius,0,2*Math.PI),ctx.fill()},CalloutCanvasLayer.prototype.renderCallout=function(title,label,boundingBox,color,location){var pos=this.getPosition(boundingBox,location),x=pos.x,y=pos.y,height=boundingBox.height,width=boundingBox.width,dotX=boundingBox.x,dotY=boundingBox.y,placeLeft=location===Location_topright||location===Location_bottomright;this.renderAnnotation(title,label,x,y,height,color),this.renderPoint(dotX,dotY),this.renderLine(x,y,width,dotX,dotY,color,placeLeft)},CalloutCanvasLayer.prototype.getPosition=function(boundingBox,location){var x=boundingBox.x,y=boundingBox.y,offsetX=boundingBox.offsetX,offsetY=boundingBox.offsetY,width=boundingBox.width;switch(location){case Location_topleft:return{x:x-width-offsetX,y:y-offsetY};case Location_topright:return{x:x+offsetX,y:y-offsetY};case Location_bottomleft:return{x:x-width-offsetX,y:y+offsetY};case Location_bottomright:return{x:x+offsetX,y:y+offsetY};default:return{x:x,y:y}}},CalloutCanvasLayer.prototype.positionCallouts=function(annotations,isLeftToRight,xScale,yScale,scale,fontSize,offset){var _this=this;if(void 0===offset&&(offset=20),0===annotations.length)return[];var alignment=isLeftToRight?Location_topleft:Location_topright,nodes=annotations.map((function(a){var pos=a.pos?a.pos:_this.referenceSystem.project(a.md);return{title:a.title,label:a.label,color:a.color,pos:{x:pos[0],y:pos[1]},group:a.group,alignment:alignment,boundingBox:_this.getAnnotationBoundingBox(a.title,a.label,pos,xScale,yScale,fontSize),dx:offset,dy:offset}})),top=[nodes[nodes.length-1]],bottom=[];return this.chooseTopOrBottomPosition(nodes,bottom,top),this.adjustTopPositions(top),this.adjustBottomPositions(bottom),nodes},CalloutCanvasLayer.prototype.getAnnotationBoundingBox=function(title,label,pos,xScale,yScale,height){var ctx=this.ctx,ax1=xScale(pos[0]),ay1=yScale(pos[1]),labelWidth=ctx.measureText(label).width,titleWidth=ctx.measureText(title).width;return{x:ax1,y:ay1,width:Math.max(labelWidth,titleWidth),height:2*height+4}},CalloutCanvasLayer.prototype.chooseTopOrBottomPosition=function(nodes,bottom,top){for(var i=nodes.length-2;i>=0;--i){var node=nodes[i],prevNode=top[0];isOverlapping(node.boundingBox,prevNode.boundingBox)?(node.alignment=node.alignment===Location_topleft?Location_bottomright:Location_bottomleft,bottom.push(node),i>0&&top.unshift(nodes[--i])):top.unshift(node)}},CalloutCanvasLayer.prototype.adjustTopPositions=function(top){for(var i=top.length-2;i>=0;--i)for(var currentNode=top[i],j=top.length-1;j>i;--j){var prevNode=top[j],overlap=getOverlapOffset(currentNode.boundingBox,prevNode.boundingBox);overlap&&(currentNode.dy+=overlap.dy,currentNode.boundingBox.y-=overlap.dy)}},CalloutCanvasLayer.prototype.adjustBottomPositions=function(bottom){for(var i=bottom.length-2;i>=0;--i)for(var currentNode=bottom[i],j=bottom.length-1;j>i;--j){var overlap=getOverlapOffset(bottom[j].boundingBox,currentNode.boundingBox);overlap&&(currentNode.dy+=overlap.dy,currentNode.boundingBox.y+=overlap.dy)}},CalloutCanvasLayer}(CanvasLayer),ImageLayer=function(_super){function ImageLayer(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(ImageLayer,_super),ImageLayer.prototype.onMount=function(event){_super.prototype.onMount.call(this,event);var img=document.createElement("img");this.img=img,this.isLoading=!0},ImageLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.img.src=event.url,this.render(event)},ImageLayer.prototype.onRescale=function(event){_super.prototype.onRescale.call(this,event),this.setTransform(event),this.render(event)},ImageLayer.prototype.render=function(event){var _this=this,width=parseInt(this.elm.getAttribute("width"),10),height=parseInt(this.elm.getAttribute("height"),10),xScale=event.xScale,yScale=event.yScale,xRatio=event.xRatio,yRatio=event.yRatio,x=event.x,y=event.y,calcWidth=width*(xRatio||1),calcHeight=height*(yRatio||1);this.clearCanvas(),this.isLoading?this.img.onload=function(){_this.isLoading=!1,_this.ctx.drawImage(_this.img,xScale(x||0),yScale(y||0),calcWidth,calcHeight)}:this.ctx.drawImage(this.img,xScale(x||0),yScale(y||0),calcWidth,calcHeight)},ImageLayer}(CanvasLayer),WellboreBaseComponentLayer=function(_super){function WellboreBaseComponentLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.getMdPoint=function(md){return{point:_this.referenceSystem.project(md),md:md}},_this.getPathForPoints=function(start,end,interestPoints){var pathPoints=_this.referenceSystem.getCurtainPath(start,end),interestMdPoints=interestPoints.filter((function(ip){return!pathPoints.some((function(p){return p.md===ip}))})).map(_this.getMdPoint),points=__spreadArray(__spreadArray([],pathPoints),interestMdPoints);return points.sort((function(a,b){return a.md-b.md})),points},_this.getZFactorScaledPathForPoints=function(start,end,interestPoints){var y=function(y){return y*_this.rescaleEvent.zFactor};return _this.getPathForPoints(start,end,interestPoints).map((function(p){return{point:[p.point[0],y(p.point[1])],md:p.md}}))},_this.drawBigPolygon=function(coords,color){void 0===color&&(color=0);var polygon=new Graphics;return polygon.beginFill(color),polygon.drawPolygon(coords),polygon.endFill(),_this.ctx.stage.addChild(polygon),polygon},_this.drawBigTexturedPolygon=function(coords,t){var polygon=new Graphics;return polygon.beginTextureFill({texture:t}),polygon.drawPolygon(coords),polygon.endFill(),_this.ctx.stage.addChild(polygon),polygon},_this.options=__assign(__assign(__assign({},_this.options),{exaggerationFactor:2}),options),_this.render=_this.render.bind(_this),_this}return __extends(WellboreBaseComponentLayer,_super),WellboreBaseComponentLayer.prototype.onUnmount=function(event){_super.prototype.onUnmount.call(this,event),this._textureCache=null,this.rescaleEvent=null},WellboreBaseComponentLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.clear(),this.render()},WellboreBaseComponentLayer.prototype.onRescale=function(event){var _a,shouldRender=(null===(_a=this.rescaleEvent)||void 0===_a?void 0:_a.zFactor)!==event.zFactor;if(this.rescaleEvent=event,_super.prototype.optionsRescale.call(this,event),this.ctx){var yRatio=this.yRatio(),flippedX=event.xBounds[0]>event.xBounds[1],flippedY=event.yBounds[0]>event.yBounds[1];this.ctx.stage.position.set(event.xScale(0),event.yScale(0)),this.ctx.stage.scale.set(event.xRatio*(flippedX?-1:1),yRatio*(flippedY?-1:1)),shouldRender&&(this.clear(),this.render())}},WellboreBaseComponentLayer.prototype.clear=function(){this.ctx.stage.removeChildren().forEach((function(child){child.destroy()}))},WellboreBaseComponentLayer.prototype.yRatio=function(){var domain=this.rescaleEvent.yScale.domain(),baseYSpan=(domain[1]-domain[0])*this.rescaleEvent.zFactor,baseDomain=[domain[0],domain[0]+baseYSpan];return Math.abs(this.rescaleEvent.height/(baseDomain[1]-baseDomain[0]))},WellboreBaseComponentLayer.prototype.drawRopeWithMask=function(path,maskPolygon,texture){if(0===maskPolygon.length||0===path.length)return null;var rope=new SimpleRope(texture,path,1),mask=new Graphics;mask.beginFill(0),mask.drawPolygon(maskPolygon),mask.endFill(),this.ctx.stage.addChild(mask),rope.mask=mask,this.ctx.stage.addChild(rope)},WellboreBaseComponentLayer.prototype.drawRope=function(path,texture,tint){if(0===path.length)return null;var rope=new SimpleRope(texture,path,1);rope.tint=tint||rope.tint,this.ctx.stage.addChild(rope)},WellboreBaseComponentLayer.prototype.drawOutline=function(leftPath,rightPath,lineColor,lineWidth,close){void 0===lineWidth&&(lineWidth=1),void 0===close&&(close=!1);var leftPathReverse=leftPath.map((function(d){return d.clone()})).reverse(),startPointRight=rightPath[0],startPointLeft=leftPathReverse[0],line=new Graphics;line.lineStyle(lineWidth,lineColor,void 0,1),line.moveTo(startPointRight.x,startPointRight.y),rightPath.forEach((function(p){return line.lineTo(p.x,p.y)})),close||line.moveTo(startPointLeft.x,startPointLeft.y),leftPathReverse.forEach((function(p){return line.lineTo(p.x,p.y)})),close&&line.lineTo(startPointRight.x,startPointRight.y),this.ctx.stage.addChild(line)},WellboreBaseComponentLayer}(PixiLayer),makeTubularPolygon=function(rightPath,leftPath){return __spreadArray(__spreadArray([],leftPath),rightPath.map((function(d){return d.clone()})).reverse())},overlaps=function(top1,bottom1,top2,bottom2){return top1<=bottom2&&top2<=bottom1},cementDiameterChangeDepths=function(cement,bottomOfCement,diameterIntervals){var arrays,arr,topOfCement=cement.toc,diameterChangeDepths=(arrays=diameterIntervals.map((function(d){return[d.start-1e-4,d.start,d.end,d.end+1e-4]})),Array.from(function*(arrays){for(const array of arrays)yield*array}(arrays))).filter((function(d){return d>=topOfCement&&d<=bottomOfCement}));return diameterChangeDepths.push(topOfCement),diameterChangeDepths.push(bottomOfCement),(arr=diameterChangeDepths,Array.from(new Set(arr))).sort((function(a,b){return a-b}))},arrayToVector=function(a){return new Vector2(a[0],a[1])},createNormals=function(points){return points.length<2?[new Vector2(0)]:points.map((function(coord,i,list){if(i<list.length-1){var p=arrayToVector(list[i]),rotate=arrayToVector(list[i+1]).sub(p).rotate90();return n=rotate.normalized()}return n}));var n},offsetPoint=function(point,vector,offset){var v,p=arrayToVector(point);return v=p.add(vector.scale(offset)),new Point(v[0],v[1])},offsetPoints=function(points,vectors,offset){if(points.length!==vectors.length)throw new Error("Number of vectors does not match number of points");return points.map((function(point,index){var vector=vectors[index];return offsetPoint(point,vector,offset)}))},HoleSizeLayer=function(_super){function HoleSizeLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.drawHoleSize=function(holeObject){if(null!=holeObject){var _a=_this.options,exaggerationFactor=_a.exaggerationFactor,firstColor=_a.firstColor,lineColor=_a.lineColor,diameter=holeObject.diameter*exaggerationFactor,radius=diameter/2,pathPoints=_this.getZFactorScaledPathForPoints(holeObject.start,holeObject.end,[holeObject.start,holeObject.end]).map((function(p){return p.point})),normals=createNormals(pathPoints),rightPath=offsetPoints(pathPoints,normals,radius),leftPath=offsetPoints(pathPoints,normals,-radius);if(0!==pathPoints.length){if(_this.renderType()===RENDERER_TYPE.CANVAS){var polygonCoords=makeTubularPolygon(leftPath,rightPath);_this.drawBigPolygon(polygonCoords,convertColor(firstColor))}else{var texture=_this.createTexture(diameter);_this.drawRope(pathPoints.map((function(p){return new Point(p[0],p[1])})),texture)}_this.drawOutline(leftPath,rightPath,lineColor,1,!1)}}},_this.options=__assign(__assign(__assign({},_this.options),{firstColor:"rgb(140, 84, 29)",secondColor:"rgb(238, 227, 216)",lineColor:9127187}),options),_this}return __extends(HoleSizeLayer,_super),HoleSizeLayer.prototype.render=function(){var _this=this,data=this.data;data&&this.rescaleEvent&&this.referenceSystem&&(data.sort((function(a,b){return b.diameter-a.diameter})),this.maxDiameter=data.length>0?data[0].diameter:100,data.forEach((function(hole){return _this.drawHoleSize(hole)})))},HoleSizeLayer.prototype.createTexture=function(diameter){var exaggerationFactor=this.options.exaggerationFactor,height=this.maxDiameter*exaggerationFactor;this._textureCache||(this._textureCache=this.createBaseTexture(16,height));var baseTexture=this._textureCache.baseTexture,sidePadding=Math.floor((height-diameter)/2),frame=new Rectangle(0,sidePadding,16,diameter);return new Texture(baseTexture,frame)},HoleSizeLayer.prototype.createBaseTexture=function(width,height){var _a=this.options,firstColor=_a.firstColor,secondColor=_a.secondColor,canvas=document.createElement("canvas");canvas.width=width,canvas.height=height;var canvasCtx=canvas.getContext("2d");return canvasCtx.fillStyle=function(canvas,canvasCtx,firstColor,secondColor,startPctOffset){var gradient=canvasCtx.createLinearGradient(0,0,0,canvas.height);return gradient.addColorStop(0,firstColor),gradient.addColorStop(.5-startPctOffset,secondColor),gradient.addColorStop(.5+startPctOffset,secondColor),gradient.addColorStop(1,firstColor),gradient}(canvas,canvasCtx,firstColor,secondColor,0),canvasCtx.fillRect(0,0,canvas.width,canvas.height),Texture.from(canvas)},HoleSizeLayer}(WellboreBaseComponentLayer),CasingLayer=function(_super){function CasingLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.prepareCasingRenderObject=function(casing){if(null!=casing){var exaggerationFactor=_this.options.exaggerationFactor,diameter=casing.diameter*exaggerationFactor,radius=diameter/2,innerRadius=casing.innerDiameter*exaggerationFactor/2,pathPoints=_this.getZFactorScaledPathForPoints(casing.start,casing.end,[casing.start,casing.end]).map((function(p){return p.point})),normals=createNormals(pathPoints),rightPath=offsetPoints(pathPoints,normals,radius),leftPath=offsetPoints(pathPoints,normals,-radius);return{pathPoints:pathPoints,polygon:makeTubularPolygon(leftPath,rightPath),leftPath:leftPath,rightPath:rightPath,radius:radius,diameter:diameter,casingWallWidth:Math.abs(radius-innerRadius)}}},_this.drawCasing=function(zippedRenderObject){var _a=_this.options,lineColor=_a.lineColor,solidColor=_a.solidColor,casing=zippedRenderObject[0],_b=zippedRenderObject[1],pathPoints=_b.pathPoints,polygon=_b.polygon,leftPath=_b.leftPath,rightPath=_b.rightPath,radius=_b.radius,diameter=_b.diameter,casingWallWidth=_b.casingWallWidth;if(_this.renderType()===RENDERER_TYPE.CANVAS)_this.drawBigPolygon(polygon,solidColor);else{var texture=_this.createTexture(diameter);_this.drawRope(pathPoints.map((function(p){return new Point(p[0],p[1])})),texture,solidColor)}_this.drawOutline(leftPath,rightPath,lineColor,casingWallWidth,!0),casing.hasShoe&&_this.drawShoe(casing.end,radius)},_this.generateShoe=function(casingEnd,casingRadius,length,width){var start=casingEnd-length,end=casingEnd,points=_this.getZFactorScaledPathForPoints(start,end,[start,end]).map((function(p){return p.point})),normal=createNormals(points),shoeEdge=offsetPoints(points,normal,casingRadius*(width<0?-1:1)),shoeTipPoint=points[points.length-1],shoeTipNormal=normal[normal.length-1],shoeTip=offsetPoint(shoeTipPoint,shoeTipNormal,width);return __spreadArray(__spreadArray([],shoeEdge),[shoeTip])},_this.options=__assign(__assign(__assign({},_this.options),{solidColor:14474460,lineColor:5723991}),options),_this}return __extends(CasingLayer,_super),CasingLayer.prototype.render=function(){var _this=this,data=this.data;if(data&&this.rescaleEvent&&this.referenceSystem){var sortedCasings=data.sort((function(a,b){return b.diameter-a.diameter})),casingRenderObjects=sortedCasings.map((function(casing){return _this.prepareCasingRenderObject(casing)}));(function(){return transpose(arguments)})(sortedCasings,casingRenderObjects).forEach((function(zippedRenderObject){return _this.drawCasing(zippedRenderObject)}))}},CasingLayer.prototype.drawShoe=function(casingEnd,casingRadius){var exaggerationFactor=this.options.exaggerationFactor,shoeWidth=25*exaggerationFactor,shoeLength=12*exaggerationFactor,shoeCoords=this.generateShoe(casingEnd,casingRadius,shoeLength,shoeWidth),shoeCoords2=this.generateShoe(casingEnd,casingRadius,shoeLength,-shoeWidth);this.drawBigPolygon(shoeCoords2),this.drawBigPolygon(shoeCoords)},CasingLayer.prototype.createTexture=function(diameter){return new Texture(Texture.WHITE.baseTexture,null,new Rectangle(0,0,16,diameter))},CasingLayer}(WellboreBaseComponentLayer),CementLayer=function(_super){function CementLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.createCementShape=function(cement,casings,holes){var exaggerationFactor=_this.options.exaggerationFactor,attachedCasings=__spreadArray([cement.casingId],cement.casingIds||[]).filter((function(id){return id})).map((function(casingId){return casings.find((function(casing){return casing.casingId===casingId}))}));if(0===attachedCasings.length||attachedCasings.includes(void 0))throw new Error("Invalid cement data, cement is missing attached casing");attachedCasings.sort((function(a,b){return a.end-b.end}));for(var bottomOfCement=attachedCasings[attachedCasings.length-1].end,_a=function(cement,bottomOfCement,parentCasings,casings,holes){var start=cement.toc,end=bottomOfCement;return{holes:holes.filter((function(h){return overlaps(start,end,h.start,h.end)})),outerCasings:casings.filter((function(c){return!parentCasings.includes(c)})).filter((function(c){return overlaps(start,end,c.start,c.end)}))}}(cement,bottomOfCement,attachedCasings,casings,holes),outerCasings=_a.outerCasings,overlappingHoles=_a.holes,innerDiameterIntervals=attachedCasings,outerDiameterIntervals=__spreadArray(__spreadArray([],outerCasings),overlappingHoles).map((function(d){return{start:d.start,end:d.end}})),diameterAtChangeDepths=cementDiameterChangeDepths(cement,bottomOfCement,__spreadArray(__spreadArray([],innerDiameterIntervals),outerDiameterIntervals)).map(function(innerCasing,nonAttachedCasings,holes){return function(depth){var outerDiameter,innerCasingAtDepth=innerCasing.find((function(casing){return casing.start<=depth&&casing.end>=depth})),innerDiameter=innerCasingAtDepth?innerCasingAtDepth.diameter:0,outerCasings=nonAttachedCasings.filter((function(casing){return casing.innerDiameter>innerDiameter})),holeAtDepth=holes.find((function(hole){return hole.start<=depth&&hole.end>=depth&&hole.diameter>innerDiameter})),outerCasingAtDepth=outerCasings.filter((function(d){return d})).sort((function(a,b){return a.innerDiameter-b.innerDiameter})).find((function(casing){return casing.start<=depth&&casing.end>=depth&&casing.diameter>innerDiameter}));return outerDiameter=outerCasingAtDepth?outerCasingAtDepth.innerDiameter:holeAtDepth?holeAtDepth.diameter-1:100,{md:depth,innerDiameter:innerDiameter,outerDiameter:outerDiameter}}}(attachedCasings,outerCasings,overlappingHoles)),path=_this.getZFactorScaledPathForPoints(cement.toc,bottomOfCement,diameterAtChangeDepths.map((function(d){return d.md}))),normals=createNormals(path.map((function(p){return p.point}))),pathWithNormals=path.map((function(p,i){return __assign(__assign({},p),{normal:normals[i]})})),side1Left=[],side1Right=[],side2Left=[],side2Right=[],previousDepth=diameterAtChangeDepths.shift(),_loop_1=function(depth){var intervalMdPoints=pathWithNormals.filter((function(x){return x.md>=previousDepth.md&&x.md<=depth.md})),intervalPoints=intervalMdPoints.map((function(s){return s.point})),intervalPointNormals=intervalMdPoints.map((function(s){return s.normal})),outerRadius=previousDepth.outerDiameter/2*exaggerationFactor,innerRadius=previousDepth.innerDiameter/2*exaggerationFactor,intervalSide1Left=offsetPoints(intervalPoints,intervalPointNormals,outerRadius),intervalSide1Right=offsetPoints(intervalPoints,intervalPointNormals,innerRadius),intervalSide2Left=offsetPoints(intervalPoints,intervalPointNormals,-innerRadius),intervalSide2Right=offsetPoints(intervalPoints,intervalPointNormals,-outerRadius);side1Left.push.apply(side1Left,intervalSide1Left),side1Right.push.apply(side1Right,intervalSide1Right),side2Left.push.apply(side2Left,intervalSide2Left),side2Right.push.apply(side2Right,intervalSide2Right),previousDepth=depth},_i=0,diameterAtChangeDepths_1=diameterAtChangeDepths;_i<diameterAtChangeDepths_1.length;_i++){_loop_1(diameterAtChangeDepths_1[_i])}var pathPoints=pathWithNormals.map((function(p){return new Point(p.point[0],p.point[1])}));return{leftPolygon:makeTubularPolygon(side1Left,side1Right),rightPolygon:makeTubularPolygon(side2Left,side2Right),path:pathPoints}},_this.options=__assign(__assign(__assign({},_this.options),{firstColor:"#c7b9ab",secondColor:"#5b5b5b"}),options),_this}return __extends(CementLayer,_super),CementLayer.prototype.render=function(){var _this=this;if(this.data&&this.rescaleEvent&&this.referenceSystem){var _a=this.data,cement=_a.cement,casings=_a.casings,holes=_a.holes,cementShapes=cement.map((function(cement){return _this.createCementShape(cement,casings,holes)})),texture=this.createTexture();cementShapes.forEach((function(cementShape){_this.renderType()===RENDERER_TYPE.CANVAS?(_this.drawBigTexturedPolygon(cementShape.leftPolygon,texture),_this.drawBigTexturedPolygon(cementShape.rightPolygon,texture)):(_this.drawRopeWithMask(cementShape.path,cementShape.leftPolygon,texture),_this.drawRopeWithMask(cementShape.path,cementShape.rightPolygon,texture))}))}},CementLayer.prototype.createTexture=function(){if(this._textureCache)return this._textureCache;var _a=this.options,firstColor=_a.firstColor,secondColor=_a.secondColor,canvas=document.createElement("canvas");canvas.width=150,canvas.height=150;var canvasCtx=canvas.getContext("2d");canvasCtx.fillStyle=firstColor,canvasCtx.fillRect(0,0,canvas.width,canvas.height),canvasCtx.lineWidth=1,canvasCtx.fillStyle=secondColor,canvasCtx.beginPath(),canvasCtx.lineWidth=1;for(var i=-canvas.width;i<canvas.width;i++)canvasCtx.moveTo(-canvas.width+10*i,-canvas.height),canvasCtx.lineTo(canvas.width+10*i,canvas.height);return canvasCtx.stroke(),this._textureCache=Texture.from(canvas),this._textureCache},CementLayer}(WellboreBaseComponentLayer),SeismicCanvasLayer=function(_super){function SeismicCanvasLayer(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(SeismicCanvasLayer,_super),SeismicCanvasLayer.prototype.onMount=function(event){_super.prototype.onMount.call(this,event)},SeismicCanvasLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.clearCanvas(),this.render()},SeismicCanvasLayer.prototype.onRescale=function(event){_super.prototype.onRescale.call(this,event),this.setTransform(event),this.render()},SeismicCanvasLayer.prototype.render=function(){if(this.data&&this.ctx&&this.data.image){var ctx=this.ctx,_a=this.data,options=_a.options,image=_a.image;this.clearCanvas(),ctx.drawImage(image,options.x,options.y,options.width,options.height)}},SeismicCanvasLayer}(CanvasLayer),CompletionLayer=function(_super){function CompletionLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.options=__assign(__assign({},_this.options),options),_this.render=_this.render.bind(_this),_this}return __extends(CompletionLayer,_super),CompletionLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.render()},CompletionLayer.prototype.render=function(){var _a,_this=this,wellborePath=this.referenceSystem?this.referenceSystem.projectedPath:[];null!=wellborePath&&((null===(_a=this.data)||void 0===_a?void 0:_a.length)>0?this.data.map((function(d){return _this.generateCompletionItem(wellborePath,d)})):[]).map((function(s){return _this.drawCompletionItem(s)}))},CompletionLayer.prototype.getShape=function(type){var graphics=new Graphics;return graphics.beginFill(3421236),graphics.drawRect(-5,-5,10,10),graphics.endFill(),graphics},CompletionLayer.prototype.getScale=function(type,length,width){return{scaleX:1,scaleY:1}},CompletionLayer.prototype.generateCompletionItem=function(wbp,data){if(this.referenceSystem){var pointTop=this.referenceSystem.project(data.start),pointBottom=this.referenceSystem.project(data.end),rotation=Vector2.angle(pointTop,pointBottom),graphics=this.getShape(data.shape),_a=this.getScale(data.shape,data.start-data.end,data.diameter),scaleX=_a.scaleX,scaleY=_a.scaleY,x=pointTop[0],y=pointTop[1];return graphics.setTransform(x,y,scaleX,scaleY,rotation),{graphics:graphics}}},CompletionLayer.prototype.drawCompletionItem=function(item){this.ctx.stage.addChild(item.graphics)},CompletionLayer}(PixiLayer),noop$1={value:()=>{}};function dispatch(){for(var t,i=0,n=arguments.length,_={};i<n;++i){if(!(t=arguments[i]+"")||t in _||/[\s.]/.test(t))throw new Error("illegal type: "+t);_[t]=[]}return new Dispatch(_)}function Dispatch(_){this._=_}function parseTypenames$1(typenames,types){return typenames.trim().split(/^|\s+/).map((function(t){var name="",i=t.indexOf(".");if(i>=0&&(name=t.slice(i+1),t=t.slice(0,i)),t&&!types.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:name}}))}function get(type,name){for(var c,i=0,n=type.length;i<n;++i)if((c=type[i]).name===name)return c.value}function set(type,name,callback){for(var i=0,n=type.length;i<n;++i)if(type[i].name===name){type[i]=noop$1,type=type.slice(0,i).concat(type.slice(i+1));break}return null!=callback&&type.push({name:name,value:callback}),type}Dispatch.prototype=dispatch.prototype={constructor:Dispatch,on:function(typename,callback){var t,_=this._,T=parseTypenames$1(typename+"",_),i=-1,n=T.length;if(!(arguments.length<2)){if(null!=callback&&"function"!=typeof callback)throw new Error("invalid callback: "+callback);for(;++i<n;)if(t=(typename=T[i]).type)_[t]=set(_[t],typename.name,callback);else if(null==callback)for(t in _)_[t]=set(_[t],typename.name,null);return this}for(;++i<n;)if((t=(typename=T[i]).type)&&(t=get(_[t],typename.name)))return t},copy:function(){var copy={},_=this._;for(var t in _)copy[t]=_[t].slice();return new Dispatch(copy)},call:function(type,that){if((n=arguments.length-2)>0)for(var n,t,args=new Array(n),i=0;i<n;++i)args[i]=arguments[i+2];if(!this._.hasOwnProperty(type))throw new Error("unknown type: "+type);for(i=0,n=(t=this._[type]).length;i<n;++i)t[i].value.apply(that,args)},apply:function(type,that,args){if(!this._.hasOwnProperty(type))throw new Error("unknown type: "+type);for(var t=this._[type],i=0,n=t.length;i<n;++i)t[i].value.apply(that,args)}};const nonpassivecapture={capture:!0,passive:!1};function noevent(event){event.preventDefault(),event.stopImmediatePropagation()}function dragDisable(view){var root=view.document.documentElement,selection=select(view).on("dragstart.drag",noevent,nonpassivecapture);"onselectstart"in root?selection.on("selectstart.drag",noevent,nonpassivecapture):(root.__noselect=root.style.MozUserSelect,root.style.MozUserSelect="none")}function yesdrag(view,noclick){var root=view.document.documentElement,selection=select(view).on("dragstart.drag",null);noclick&&(selection.on("click.drag",noevent,nonpassivecapture),setTimeout((function(){selection.on("click.drag",null)}),0)),"onselectstart"in root?selection.on("selectstart.drag",null):(root.style.MozUserSelect=root.__noselect,delete root.__noselect)}var taskHead,taskTail,frame=0,timeout=0,interval=0,clockLast=0,clockNow=0,clockSkew=0,clock="object"==typeof performance&&performance.now?performance:Date,setFrame="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(f){setTimeout(f,17)};function now(){return clockNow||(setFrame(clearNow),clockNow=clock.now()+clockSkew)}function clearNow(){clockNow=0}function Timer(){this._call=this._time=this._next=null}function timer(callback,delay,time){var t=new Timer;return t.restart(callback,delay,time),t}function wake(){clockNow=(clockLast=clock.now())+clockSkew,frame=timeout=0;try{!function(){now(),++frame;for(var e,t=taskHead;t;)(e=clockNow-t._time)>=0&&t._call.call(void 0,e),t=t._next;--frame}()}finally{frame=0,function(){var t0,t2,t1=taskHead,time=1/0;for(;t1;)t1._call?(time>t1._time&&(time=t1._time),t0=t1,t1=t1._next):(t2=t1._next,t1._next=null,t1=t0?t0._next=t2:taskHead=t2);taskTail=t0,sleep(time)}(),clockNow=0}}function poke(){var now=clock.now(),delay=now-clockLast;delay>1e3&&(clockSkew-=delay,clockLast=now)}function sleep(time){frame||(timeout&&(timeout=clearTimeout(timeout)),time-clockNow>24?(time<1/0&&(timeout=setTimeout(wake,time-clock.now()-clockSkew)),interval&&(interval=clearInterval(interval))):(interval||(clockLast=clock.now(),interval=setInterval(poke,1e3)),frame=1,setFrame(wake)))}function timeout$1(callback,delay,time){var t=new Timer;return delay=null==delay?0:+delay,t.restart((elapsed=>{t.stop(),callback(elapsed+delay)}),delay,time),t}Timer.prototype=timer.prototype={constructor:Timer,restart:function(callback,delay,time){if("function"!=typeof callback)throw new TypeError("callback is not a function");time=(null==time?now():+time)+(null==delay?0:+delay),this._next||taskTail===this||(taskTail?taskTail._next=this:taskHead=this,taskTail=this),this._call=callback,this._time=time,sleep()},stop:function(){this._call&&(this._call=null,this._time=1/0,sleep())}};var emptyOn=dispatch("start","end","cancel","interrupt"),emptyTween=[];function schedule(node,name,id,index,group,timing){var schedules=node.__transition;if(schedules){if(id in schedules)return}else node.__transition={};!function(node,id,self){var tween,schedules=node.__transition;function schedule(elapsed){self.state=1,self.timer.restart(start,self.delay,self.time),self.delay<=elapsed&&start(elapsed-self.delay)}function start(elapsed){var i,j,n,o;if(1!==self.state)return stop();for(i in schedules)if((o=schedules[i]).name===self.name){if(3===o.state)return timeout$1(start);4===o.state?(o.state=6,o.timer.stop(),o.on.call("interrupt",node,node.__data__,o.index,o.group),delete schedules[i]):+i<id&&(o.state=6,o.timer.stop(),o.on.call("cancel",node,node.__data__,o.index,o.group),delete schedules[i])}if(timeout$1((function(){3===self.state&&(self.state=4,self.timer.restart(tick,self.delay,self.time),tick(elapsed))})),self.state=2,self.on.call("start",node,node.__data__,self.index,self.group),2===self.state){for(self.state=3,tween=new Array(n=self.tween.length),i=0,j=-1;i<n;++i)(o=self.tween[i].value.call(node,node.__data__,self.index,self.group))&&(tween[++j]=o);tween.length=j+1}}function tick(elapsed){for(var t=elapsed<self.duration?self.ease.call(null,elapsed/self.duration):(self.timer.restart(stop),self.state=5,1),i=-1,n=tween.length;++i<n;)tween[i].call(node,t);5===self.state&&(self.on.call("end",node,node.__data__,self.index,self.group),stop())}function stop(){for(var i in self.state=6,self.timer.stop(),delete schedules[id],schedules)return;delete node.__transition}schedules[id]=self,self.timer=timer(schedule,0,self.time)}(node,id,{name:name,index:index,group:group,on:emptyOn,tween:emptyTween,time:timing.time,delay:timing.delay,duration:timing.duration,ease:timing.ease,timer:null,state:0})}function init$1(node,id){var schedule=get$1(node,id);if(schedule.state>0)throw new Error("too late; already scheduled");return schedule}function set$1(node,id){var schedule=get$1(node,id);if(schedule.state>3)throw new Error("too late; already running");return schedule}function get$1(node,id){var schedule=node.__transition;if(!schedule||!(schedule=schedule[id]))throw new Error("transition not found");return schedule}function interrupt(node,name){var schedule,active,i,schedules=node.__transition,empty=!0;if(schedules){for(i in name=null==name?null:name+"",schedules)(schedule=schedules[i]).name===name?(active=schedule.state>2&&schedule.state<5,schedule.state=6,schedule.timer.stop(),schedule.on.call(active?"interrupt":"cancel",node,node.__data__,schedule.index,schedule.group),delete schedules[i]):empty=!1;empty&&delete node.__transition}}function tweenRemove(id,name){var tween0,tween1;return function(){var schedule=set$1(this,id),tween=schedule.tween;if(tween!==tween0)for(var i=0,n=(tween1=tween0=tween).length;i<n;++i)if(tween1[i].name===name){(tween1=tween1.slice()).splice(i,1);break}schedule.tween=tween1}}function tweenFunction(id,name,value){var tween0,tween1;if("function"!=typeof value)throw new Error;return function(){var schedule=set$1(this,id),tween=schedule.tween;if(tween!==tween0){tween1=(tween0=tween).slice();for(var t={name:name,value:value},i=0,n=tween1.length;i<n;++i)if(tween1[i].name===name){tween1[i]=t;break}i===n&&tween1.push(t)}schedule.tween=tween1}}function tweenValue(transition,name,value){var id=transition._id;return transition.each((function(){var schedule=set$1(this,id);(schedule.value||(schedule.value={}))[name]=value.apply(this,arguments)})),function(node){return get$1(node,id).value[name]}}function interpolate$1(a,b){var c;return("number"==typeof b?interpolateNumber:b instanceof color?interpolateRgb:(c=color(b))?(b=c,interpolateRgb):interpolateString)(a,b)}function attrRemove$1(name){return function(){this.removeAttribute(name)}}function attrRemoveNS$1(fullname){return function(){this.removeAttributeNS(fullname.space,fullname.local)}}function attrConstant$1(name,interpolate,value1){var string00,interpolate0,string1=value1+"";return function(){var string0=this.getAttribute(name);return string0===string1?null:string0===string00?interpolate0:interpolate0=interpolate(string00=string0,value1)}}function attrConstantNS$1(fullname,interpolate,value1){var string00,interpolate0,string1=value1+"";return function(){var string0=this.getAttributeNS(fullname.space,fullname.local);return string0===string1?null:string0===string00?interpolate0:interpolate0=interpolate(string00=string0,value1)}}function attrFunction$1(name,interpolate,value){var string00,string10,interpolate0;return function(){var string0,string1,value1=value(this);if(null!=value1)return(string0=this.getAttribute(name))===(string1=value1+"")?null:string0===string00&&string1===string10?interpolate0:(string10=string1,interpolate0=interpolate(string00=string0,value1));this.removeAttribute(name)}}function attrFunctionNS$1(fullname,interpolate,value){var string00,string10,interpolate0;return function(){var string0,string1,value1=value(this);if(null!=value1)return(string0=this.getAttributeNS(fullname.space,fullname.local))===(string1=value1+"")?null:string0===string00&&string1===string10?interpolate0:(string10=string1,interpolate0=interpolate(string00=string0,value1));this.removeAttributeNS(fullname.space,fullname.local)}}function attrInterpolate(name,i){return function(t){this.setAttribute(name,i.call(this,t))}}function attrInterpolateNS(fullname,i){return function(t){this.setAttributeNS(fullname.space,fullname.local,i.call(this,t))}}function attrTweenNS(fullname,value){var t0,i0;function tween(){var i=value.apply(this,arguments);return i!==i0&&(t0=(i0=i)&&attrInterpolateNS(fullname,i)),t0}return tween._value=value,tween}function attrTween(name,value){var t0,i0;function tween(){var i=value.apply(this,arguments);return i!==i0&&(t0=(i0=i)&&attrInterpolate(name,i)),t0}return tween._value=value,tween}function delayFunction(id,value){return function(){init$1(this,id).delay=+value.apply(this,arguments)}}function delayConstant(id,value){return value=+value,function(){init$1(this,id).delay=value}}function durationFunction(id,value){return function(){set$1(this,id).duration=+value.apply(this,arguments)}}function durationConstant(id,value){return value=+value,function(){set$1(this,id).duration=value}}function easeConstant(id,value){if("function"!=typeof value)throw new Error;return function(){set$1(this,id).ease=value}}function onFunction(id,name,listener){var on0,on1,sit=function(name){return(name+"").trim().split(/^|\s+/).every((function(t){var i=t.indexOf(".");return i>=0&&(t=t.slice(0,i)),!t||"start"===t}))}(name)?init$1:set$1;return function(){var schedule=sit(this,id),on=schedule.on;on!==on0&&(on1=(on0=on).copy()).on(name,listener),schedule.on=on1}}var Selection$1=selection.prototype.constructor;function styleRemove$1(name){return function(){this.style.removeProperty(name)}}function styleInterpolate(name,i,priority){return function(t){this.style.setProperty(name,i.call(this,t),priority)}}function styleTween(name,value,priority){var t,i0;function tween(){var i=value.apply(this,arguments);return i!==i0&&(t=(i0=i)&&styleInterpolate(name,i,priority)),t}return tween._value=value,tween}function textInterpolate(i){return function(t){this.textContent=i.call(this,t)}}function textTween(value){var t0,i0;function tween(){var i=value.apply(this,arguments);return i!==i0&&(t0=(i0=i)&&textInterpolate(i)),t0}return tween._value=value,tween}var id=0;function Transition(groups,parents,name,id){this._groups=groups,this._parents=parents,this._name=name,this._id=id}function newId(){return++id}var selection_prototype=selection.prototype;Transition.prototype={constructor:Transition,select:function(select){var name=this._name,id=this._id;"function"!=typeof select&&(select=selector(select));for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j<m;++j)for(var node,subnode,group=groups[j],n=group.length,subgroup=subgroups[j]=new Array(n),i=0;i<n;++i)(node=group[i])&&(subnode=select.call(node,node.__data__,i,group))&&("__data__"in node&&(subnode.__data__=node.__data__),subgroup[i]=subnode,schedule(subgroup[i],name,id,i,subgroup,get$1(node,id)));return new Transition(subgroups,this._parents,name,id)},selectAll:function(select){var name=this._name,id=this._id;"function"!=typeof select&&(select=selectorAll(select));for(var groups=this._groups,m=groups.length,subgroups=[],parents=[],j=0;j<m;++j)for(var node,group=groups[j],n=group.length,i=0;i<n;++i)if(node=group[i]){for(var child,children=select.call(node,node.__data__,i,group),inherit=get$1(node,id),k=0,l=children.length;k<l;++k)(child=children[k])&&schedule(child,name,id,k,children,inherit);subgroups.push(children),parents.push(node)}return new Transition(subgroups,parents,name,id)},selectChild:selection_prototype.selectChild,selectChildren:selection_prototype.selectChildren,filter:function(match){"function"!=typeof match&&(match=matcher(match));for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j<m;++j)for(var node,group=groups[j],n=group.length,subgroup=subgroups[j]=[],i=0;i<n;++i)(node=group[i])&&match.call(node,node.__data__,i,group)&&subgroup.push(node);return new Transition(subgroups,this._parents,this._name,this._id)},merge:function(transition){if(transition._id!==this._id)throw new Error;for(var groups0=this._groups,groups1=transition._groups,m0=groups0.length,m1=groups1.length,m=Math.min(m0,m1),merges=new Array(m0),j=0;j<m;++j)for(var node,group0=groups0[j],group1=groups1[j],n=group0.length,merge=merges[j]=new Array(n),i=0;i<n;++i)(node=group0[i]||group1[i])&&(merge[i]=node);for(;j<m0;++j)merges[j]=groups0[j];return new Transition(merges,this._parents,this._name,this._id)},selection:function(){return new Selection$1(this._groups,this._parents)},transition:function(){for(var name=this._name,id0=this._id,id1=newId(),groups=this._groups,m=groups.length,j=0;j<m;++j)for(var node,group=groups[j],n=group.length,i=0;i<n;++i)if(node=group[i]){var inherit=get$1(node,id0);schedule(node,name,id1,i,group,{time:inherit.time+inherit.delay+inherit.duration,delay:0,duration:inherit.duration,ease:inherit.ease})}return new Transition(groups,this._parents,name,id1)},call:selection_prototype.call,nodes:selection_prototype.nodes,node:selection_prototype.node,size:selection_prototype.size,empty:selection_prototype.empty,each:selection_prototype.each,on:function(name,listener){var id=this._id;return arguments.length<2?get$1(this.node(),id).on.on(name):this.each(onFunction(id,name,listener))},attr:function(name,value){var fullname=namespace(name),i="transform"===fullname?interpolateTransformSvg:interpolate$1;return this.attrTween(name,"function"==typeof value?(fullname.local?attrFunctionNS$1:attrFunction$1)(fullname,i,tweenValue(this,"attr."+name,value)):null==value?(fullname.local?attrRemoveNS$1:attrRemove$1)(fullname):(fullname.local?attrConstantNS$1:attrConstant$1)(fullname,i,value))},attrTween:function(name,value){var key="attr."+name;if(arguments.length<2)return(key=this.tween(key))&&key._value;if(null==value)return this.tween(key,null);if("function"!=typeof value)throw new Error;var fullname=namespace(name);return this.tween(key,(fullname.local?attrTweenNS:attrTween)(fullname,value))},style:function(name,value,priority){var i="transform"==(name+="")?interpolateTransformCss:interpolate$1;return null==value?this.styleTween(name,function(name,interpolate){var string00,string10,interpolate0;return function(){var string0=styleValue(this,name),string1=(this.style.removeProperty(name),styleValue(this,name));return string0===string1?null:string0===string00&&string1===string10?interpolate0:interpolate0=interpolate(string00=string0,string10=string1)}}(name,i)).on("end.style."+name,styleRemove$1(name)):"function"==typeof value?this.styleTween(name,function(name,interpolate,value){var string00,string10,interpolate0;return function(){var string0=styleValue(this,name),value1=value(this),string1=value1+"";return null==value1&&(this.style.removeProperty(name),string1=value1=styleValue(this,name)),string0===string1?null:string0===string00&&string1===string10?interpolate0:(string10=string1,interpolate0=interpolate(string00=string0,value1))}}(name,i,tweenValue(this,"style."+name,value))).each(function(id,name){var on0,on1,listener0,remove,key="style."+name,event="end."+key;return function(){var schedule=set$1(this,id),on=schedule.on,listener=null==schedule.value[key]?remove||(remove=styleRemove$1(name)):void 0;on===on0&&listener0===listener||(on1=(on0=on).copy()).on(event,listener0=listener),schedule.on=on1}}(this._id,name)):this.styleTween(name,function(name,interpolate,value1){var string00,interpolate0,string1=value1+"";return function(){var string0=styleValue(this,name);return string0===string1?null:string0===string00?interpolate0:interpolate0=interpolate(string00=string0,value1)}}(name,i,value),priority).on("end.style."+name,null)},styleTween:function(name,value,priority){var key="style."+(name+="");if(arguments.length<2)return(key=this.tween(key))&&key._value;if(null==value)return this.tween(key,null);if("function"!=typeof value)throw new Error;return this.tween(key,styleTween(name,value,null==priority?"":priority))},text:function(value){return this.tween("text","function"==typeof value?function(value){return function(){var value1=value(this);this.textContent=null==value1?"":value1}}(tweenValue(this,"text",value)):function(value){return function(){this.textContent=value}}(null==value?"":value+""))},textTween:function(value){var key="text";if(arguments.length<1)return(key=this.tween(key))&&key._value;if(null==value)return this.tween(key,null);if("function"!=typeof value)throw new Error;return this.tween(key,textTween(value))},remove:function(){return this.on("end.remove",function(id){return function(){var parent=this.parentNode;for(var i in this.__transition)if(+i!==id)return;parent&&parent.removeChild(this)}}(this._id))},tween:function(name,value){var id=this._id;if(name+="",arguments.length<2){for(var t,tween=get$1(this.node(),id).tween,i=0,n=tween.length;i<n;++i)if((t=tween[i]).name===name)return t.value;return null}return this.each((null==value?tweenRemove:tweenFunction)(id,name,value))},delay:function(value){var id=this._id;return arguments.length?this.each(("function"==typeof value?delayFunction:delayConstant)(id,value)):get$1(this.node(),id).delay},duration:function(value){var id=this._id;return arguments.length?this.each(("function"==typeof value?durationFunction:durationConstant)(id,value)):get$1(this.node(),id).duration},ease:function(value){var id=this._id;return arguments.length?this.each(easeConstant(id,value)):get$1(this.node(),id).ease},easeVarying:function(value){if("function"!=typeof value)throw new Error;return this.each(function(id,value){return function(){var v=value.apply(this,arguments);if("function"!=typeof v)throw new Error;set$1(this,id).ease=v}}(this._id,value))},end:function(){var on0,on1,that=this,id=that._id,size=that.size();return new Promise((function(resolve,reject){var cancel={value:reject},end={value:function(){0==--size&&resolve()}};that.each((function(){var schedule=set$1(this,id),on=schedule.on;on!==on0&&((on1=(on0=on).copy())._.cancel.push(cancel),on1._.interrupt.push(cancel),on1._.end.push(end)),schedule.on=on1})),0===size&&resolve()}))},[Symbol.iterator]:selection_prototype[Symbol.iterator]};var defaultTiming={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function inherit(node,id){for(var timing;!(timing=node.__transition)||!(timing=timing[id]);)if(!(node=node.parentNode))throw new Error(`transition ${id} not found`);return timing}selection.prototype.interrupt=function(name){return this.each((function(){interrupt(this,name)}))},selection.prototype.transition=function(name){var id,timing;name instanceof Transition?(id=name._id,name=name._name):(id=newId(),(timing=defaultTiming).time=now(),name=null==name?null:name+"");for(var groups=this._groups,m=groups.length,j=0;j<m;++j)for(var node,group=groups[j],n=group.length,i=0;i<n;++i)(node=group[i])&&schedule(node,name,id,i,group,timing||inherit(node,id));return new Transition(groups,this._parents,name,id)};var constant$3=x=>()=>x;function ZoomEvent(type,{sourceEvent:sourceEvent,target:target,transform:transform,dispatch:dispatch}){Object.defineProperties(this,{type:{value:type,enumerable:!0,configurable:!0},sourceEvent:{value:sourceEvent,enumerable:!0,configurable:!0},target:{value:target,enumerable:!0,configurable:!0},transform:{value:transform,enumerable:!0,configurable:!0},_:{value:dispatch}})}function Transform$1(k,x,y){this.k=k,this.x=x,this.y=y}Transform$1.prototype={constructor:Transform$1,scale:function(k){return 1===k?this:new Transform$1(this.k*k,this.x,this.y)},translate:function(x,y){return 0===x&0===y?this:new Transform$1(this.k,this.x+this.k*x,this.y+this.k*y)},apply:function(point){return[point[0]*this.k+this.x,point[1]*this.k+this.y]},applyX:function(x){return x*this.k+this.x},applyY:function(y){return y*this.k+this.y},invert:function(location){return[(location[0]-this.x)/this.k,(location[1]-this.y)/this.k]},invertX:function(x){return(x-this.x)/this.k},invertY:function(y){return(y-this.y)/this.k},rescaleX:function(x){return x.copy().domain(x.range().map(this.invertX,this).map(x.invert,x))},rescaleY:function(y){return y.copy().domain(y.range().map(this.invertY,this).map(y.invert,y))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var identity$3=new Transform$1(1,0,0);function nopropagation(event){event.stopImmediatePropagation()}function noevent$1(event){event.preventDefault(),event.stopImmediatePropagation()}function defaultFilter$1(event){return!(event.ctrlKey&&"wheel"!==event.type||event.button)}function defaultExtent(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function defaultTransform(){return this.__zoom||identity$3}function defaultWheelDelta(event){return-event.deltaY*(1===event.deltaMode?.05:event.deltaMode?1:.002)*(event.ctrlKey?10:1)}function defaultTouchable(){return navigator.maxTouchPoints||"ontouchstart"in this}function defaultConstrain(transform,extent,translateExtent){var dx0=transform.invertX(extent[0][0])-translateExtent[0][0],dx1=transform.invertX(extent[1][0])-translateExtent[1][0],dy0=transform.invertY(extent[0][1])-translateExtent[0][1],dy1=transform.invertY(extent[1][1])-translateExtent[1][1];return transform.translate(dx1>dx0?(dx0+dx1)/2:Math.min(0,dx0)||Math.max(0,dx1),dy1>dy0?(dy0+dy1)/2:Math.min(0,dy0)||Math.max(0,dy1))}var ZoomPanHandler=function(){function ZoomPanHandler(elm,onRescale,options){void 0===options&&(options={maxZoomLevel:256,minZoomLevel:.1}),this.zoom=null,this.elm=null,this.container=null,this.onRescale=null,this.options=null,this.xBounds=[0,1],this.yBounds=[0,1],this.translateBoundsX=[0,1],this.translateBoundsY=[0,1],this.scaleX=null,this.scaleY=null,this._zFactor=1,this.onZoom=this.onZoom.bind(this),this.container=select(elm),this.options=options,this.onRescale=onRescale,this.onZoom=this.onZoom.bind(this),this.calculateTransform=this.calculateTransform.bind(this),this.applyTransform=this.applyTransform.bind(this),this.recalculateZoomTransform=this.recalculateZoomTransform.bind(this),this.rescale=this.rescale.bind(this),this.adjustToSize=this.adjustToSize.bind(this),this.setViewport=this.setViewport.bind(this),this.currentStateAsEvent=this.currentStateAsEvent.bind(this),this.updateTranslateExtent=this.updateTranslateExtent.bind(this),this.scaleX=linear$1().domain(this.xBounds).range([0,1]),this.scaleY=linear$1().domain(this.yBounds).range([0,1]),this.init()}return Object.defineProperty(ZoomPanHandler.prototype,"width",{get:function(){return this.scaleX.range()[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"height",{get:function(){return this.scaleY.range()[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"xSpan",{get:function(){var xBounds=this.xBounds;return Math.abs(xBounds[1]-xBounds[0])},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"ySpan",{get:function(){var yBounds=this.yBounds;return Math.abs(yBounds[1]-yBounds[0])},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"viewportRatio",{get:function(){return this.width/(this.height||1)},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"xRatio",{get:function(){var domain=this.scaleX.domain();return Math.abs(this.width/(domain[1]-domain[0]))},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"yRatio",{get:function(){var domain=this.scaleY.domain();return Math.abs(this.height/(domain[1]-domain[0]))},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"zFactor",{get:function(){return this._zFactor},set:function(factor){this._zFactor=factor,this.recalculateZoomTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"isXInverted",{get:function(){return this.xBounds[1]<this.xBounds[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"isYInverted",{get:function(){return this.yBounds[1]<this.yBounds[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"enableTranslateExtent",{get:function(){return this._enableTranslateExtent},set:function(enabled){this._enableTranslateExtent=enabled,this.updateTranslateExtent()},enumerable:!1,configurable:!0}),ZoomPanHandler.prototype.updateTranslateExtent=function(){var _a=this,width=_a.width,xSpan=_a.xSpan;_a.ySpan;var zFactor=_a.zFactor,enableTranslateExtent=_a.enableTranslateExtent,translateBoundsX=_a.translateBoundsX,translateBoundsY=_a.translateBoundsY,x1=-1/0,y1=-1/0,x2=1/0,y2=1/0;if(enableTranslateExtent){var ppu=width/xSpan;x1=translateBoundsX[0]*ppu,x2=translateBoundsX[1]*ppu,y1=translateBoundsY[0]*ppu*zFactor,y2=translateBoundsY[1]*ppu*zFactor}this.zoom.translateExtent([[x1,y1],[x2,y2]])},ZoomPanHandler.prototype.currentStateAsEvent=function(){var _a=this,scaleX=_a.scaleX,scaleY=_a.scaleY,xBounds=_a.xBounds,yBounds=_a.yBounds,zFactor=_a.zFactor,viewportRatio=_a.viewportRatio,currentTransform=_a.currentTransform,xRatio=_a.xRatio,yRatio=_a.yRatio,width=_a.width,height=_a.height;return{xScale:scaleX.copy(),yScale:scaleY.copy(),xBounds:xBounds,yBounds:yBounds,zFactor:zFactor,viewportRatio:viewportRatio,xRatio:xRatio,yRatio:yRatio,width:width,height:height,transform:Object.assign({},currentTransform)}},ZoomPanHandler.prototype.rescale=function(){var currentStateAsEvent=this.currentStateAsEvent;this.onRescale(currentStateAsEvent())},ZoomPanHandler.prototype.init=function(){this.zoom=function(){var touchstarting,touchfirst,touchending,filter=defaultFilter$1,extent=defaultExtent,constrain=defaultConstrain,wheelDelta=defaultWheelDelta,touchable=defaultTouchable,scaleExtent=[0,1/0],translateExtent=[[-1/0,-1/0],[1/0,1/0]],duration=250,interpolate=interpolateZoom,listeners=dispatch("start","zoom","end"),clickDistance2=0,tapDistance=10;function zoom(selection){selection.property("__zoom",defaultTransform).on("wheel.zoom",wheeled,{passive:!1}).on("mousedown.zoom",mousedowned).on("dblclick.zoom",dblclicked).filter(touchable).on("touchstart.zoom",touchstarted).on("touchmove.zoom",touchmoved).on("touchend.zoom touchcancel.zoom",touchended).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function scale(transform,k){return(k=Math.max(scaleExtent[0],Math.min(scaleExtent[1],k)))===transform.k?transform:new Transform$1(k,transform.x,transform.y)}function translate(transform,p0,p1){var x=p0[0]-p1[0]*transform.k,y=p0[1]-p1[1]*transform.k;return x===transform.x&&y===transform.y?transform:new Transform$1(transform.k,x,y)}function centroid(extent){return[(+extent[0][0]+ +extent[1][0])/2,(+extent[0][1]+ +extent[1][1])/2]}function schedule(transition,transform,point,event){transition.on("start.zoom",(function(){gesture(this,arguments).event(event).start()})).on("interrupt.zoom end.zoom",(function(){gesture(this,arguments).event(event).end()})).tween("zoom",(function(){var that=this,args=arguments,g=gesture(that,args).event(event),e=extent.apply(that,args),p=null==point?centroid(e):"function"==typeof point?point.apply(that,args):point,w=Math.max(e[1][0]-e[0][0],e[1][1]-e[0][1]),a=that.__zoom,b="function"==typeof transform?transform.apply(that,args):transform,i=interpolate(a.invert(p).concat(w/a.k),b.invert(p).concat(w/b.k));return function(t){if(1===t)t=b;else{var l=i(t),k=w/l[2];t=new Transform$1(k,p[0]-l[0]*k,p[1]-l[1]*k)}g.zoom(null,t)}}))}function gesture(that,args,clean){return!clean&&that.__zooming||new Gesture(that,args)}function Gesture(that,args){this.that=that,this.args=args,this.active=0,this.sourceEvent=null,this.extent=extent.apply(that,args),this.taps=0}function wheeled(event,...args){if(filter.apply(this,arguments)){var g=gesture(this,args).event(event),t=this.__zoom,k=Math.max(scaleExtent[0],Math.min(scaleExtent[1],t.k*Math.pow(2,wheelDelta.apply(this,arguments)))),p=pointer(event);if(g.wheel)g.mouse[0][0]===p[0]&&g.mouse[0][1]===p[1]||(g.mouse[1]=t.invert(g.mouse[0]=p)),clearTimeout(g.wheel);else{if(t.k===k)return;g.mouse=[p,t.invert(p)],interrupt(this),g.start()}noevent$1(event),g.wheel=setTimeout(wheelidled,150),g.zoom("mouse",constrain(translate(scale(t,k),g.mouse[0],g.mouse[1]),g.extent,translateExtent))}function wheelidled(){g.wheel=null,g.end()}}function mousedowned(event,...args){if(!touchending&&filter.apply(this,arguments)){var currentTarget=event.currentTarget,g=gesture(this,args,!0).event(event),v=select(event.view).on("mousemove.zoom",mousemoved,!0).on("mouseup.zoom",mouseupped,!0),p=pointer(event,currentTarget),x0=event.clientX,y0=event.clientY;dragDisable(event.view),nopropagation(event),g.mouse=[p,this.__zoom.invert(p)],interrupt(this),g.start()}function mousemoved(event){if(noevent$1(event),!g.moved){var dx=event.clientX-x0,dy=event.clientY-y0;g.moved=dx*dx+dy*dy>clickDistance2}g.event(event).zoom("mouse",constrain(translate(g.that.__zoom,g.mouse[0]=pointer(event,currentTarget),g.mouse[1]),g.extent,translateExtent))}function mouseupped(event){v.on("mousemove.zoom mouseup.zoom",null),yesdrag(event.view,g.moved),noevent$1(event),g.event(event).end()}}function dblclicked(event,...args){if(filter.apply(this,arguments)){var t0=this.__zoom,p0=pointer(event.changedTouches?event.changedTouches[0]:event,this),p1=t0.invert(p0),k1=t0.k*(event.shiftKey?.5:2),t1=constrain(translate(scale(t0,k1),p0,p1),extent.apply(this,args),translateExtent);noevent$1(event),duration>0?select(this).transition().duration(duration).call(schedule,t1,p0,event):select(this).call(zoom.transform,t1,p0,event)}}function touchstarted(event,...args){if(filter.apply(this,arguments)){var started,i,t,p,touches=event.touches,n=touches.length,g=gesture(this,args,event.changedTouches.length===n).event(event);for(nopropagation(event),i=0;i<n;++i)p=[p=pointer(t=touches[i],this),this.__zoom.invert(p),t.identifier],g.touch0?g.touch1||g.touch0[2]===p[2]||(g.touch1=p,g.taps=0):(g.touch0=p,started=!0,g.taps=1+!!touchstarting);touchstarting&&(touchstarting=clearTimeout(touchstarting)),started&&(g.taps<2&&(touchfirst=p[0],touchstarting=setTimeout((function(){touchstarting=null}),500)),interrupt(this),g.start())}}function touchmoved(event,...args){if(this.__zooming){var i,t,p,l,g=gesture(this,args).event(event),touches=event.changedTouches,n=touches.length;for(noevent$1(event),i=0;i<n;++i)p=pointer(t=touches[i],this),g.touch0&&g.touch0[2]===t.identifier?g.touch0[0]=p:g.touch1&&g.touch1[2]===t.identifier&&(g.touch1[0]=p);if(t=g.that.__zoom,g.touch1){var p0=g.touch0[0],l0=g.touch0[1],p1=g.touch1[0],l1=g.touch1[1],dp=(dp=p1[0]-p0[0])*dp+(dp=p1[1]-p0[1])*dp,dl=(dl=l1[0]-l0[0])*dl+(dl=l1[1]-l0[1])*dl;t=scale(t,Math.sqrt(dp/dl)),p=[(p0[0]+p1[0])/2,(p0[1]+p1[1])/2],l=[(l0[0]+l1[0])/2,(l0[1]+l1[1])/2]}else{if(!g.touch0)return;p=g.touch0[0],l=g.touch0[1]}g.zoom("touch",constrain(translate(t,p,l),g.extent,translateExtent))}}function touchended(event,...args){if(this.__zooming){var i,t,g=gesture(this,args).event(event),touches=event.changedTouches,n=touches.length;for(nopropagation(event),touchending&&clearTimeout(touchending),touchending=setTimeout((function(){touchending=null}),500),i=0;i<n;++i)t=touches[i],g.touch0&&g.touch0[2]===t.identifier?delete g.touch0:g.touch1&&g.touch1[2]===t.identifier&&delete g.touch1;if(g.touch1&&!g.touch0&&(g.touch0=g.touch1,delete g.touch1),g.touch0)g.touch0[1]=this.__zoom.invert(g.touch0[0]);else if(g.end(),2===g.taps&&(t=pointer(t,this),Math.hypot(touchfirst[0]-t[0],touchfirst[1]-t[1])<tapDistance)){var p=select(this).on("dblclick.zoom");p&&p.apply(this,arguments)}}}return zoom.transform=function(collection,transform,point,event){var selection=collection.selection?collection.selection():collection;selection.property("__zoom",defaultTransform),collection!==selection?schedule(collection,transform,point,event):selection.interrupt().each((function(){gesture(this,arguments).event(event).start().zoom(null,"function"==typeof transform?transform.apply(this,arguments):transform).end()}))},zoom.scaleBy=function(selection,k,p,event){zoom.scaleTo(selection,(function(){return this.__zoom.k*("function"==typeof k?k.apply(this,arguments):k)}),p,event)},zoom.scaleTo=function(selection,k,p,event){zoom.transform(selection,(function(){var e=extent.apply(this,arguments),t0=this.__zoom,p0=null==p?centroid(e):"function"==typeof p?p.apply(this,arguments):p,p1=t0.invert(p0),k1="function"==typeof k?k.apply(this,arguments):k;return constrain(translate(scale(t0,k1),p0,p1),e,translateExtent)}),p,event)},zoom.translateBy=function(selection,x,y,event){zoom.transform(selection,(function(){return constrain(this.__zoom.translate("function"==typeof x?x.apply(this,arguments):x,"function"==typeof y?y.apply(this,arguments):y),extent.apply(this,arguments),translateExtent)}),null,event)},zoom.translateTo=function(selection,x,y,p,event){zoom.transform(selection,(function(){var e=extent.apply(this,arguments),t=this.__zoom,p0=null==p?centroid(e):"function"==typeof p?p.apply(this,arguments):p;return constrain(identity$3.translate(p0[0],p0[1]).scale(t.k).translate("function"==typeof x?-x.apply(this,arguments):-x,"function"==typeof y?-y.apply(this,arguments):-y),e,translateExtent)}),p,event)},Gesture.prototype={event:function(event){return event&&(this.sourceEvent=event),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(key,transform){return this.mouse&&"mouse"!==key&&(this.mouse[1]=transform.invert(this.mouse[0])),this.touch0&&"touch"!==key&&(this.touch0[1]=transform.invert(this.touch0[0])),this.touch1&&"touch"!==key&&(this.touch1[1]=transform.invert(this.touch1[0])),this.that.__zoom=transform,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(type){var d=select(this.that).datum();listeners.call(type,this.that,new ZoomEvent(type,{sourceEvent:this.sourceEvent,target:zoom,type:type,transform:this.that.__zoom,dispatch:listeners}),d)}},zoom.wheelDelta=function(_){return arguments.length?(wheelDelta="function"==typeof _?_:constant$3(+_),zoom):wheelDelta},zoom.filter=function(_){return arguments.length?(filter="function"==typeof _?_:constant$3(!!_),zoom):filter},zoom.touchable=function(_){return arguments.length?(touchable="function"==typeof _?_:constant$3(!!_),zoom):touchable},zoom.extent=function(_){return arguments.length?(extent="function"==typeof _?_:constant$3([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),zoom):extent},zoom.scaleExtent=function(_){return arguments.length?(scaleExtent[0]=+_[0],scaleExtent[1]=+_[1],zoom):[scaleExtent[0],scaleExtent[1]]},zoom.translateExtent=function(_){return arguments.length?(translateExtent[0][0]=+_[0][0],translateExtent[1][0]=+_[1][0],translateExtent[0][1]=+_[0][1],translateExtent[1][1]=+_[1][1],zoom):[[translateExtent[0][0],translateExtent[0][1]],[translateExtent[1][0],translateExtent[1][1]]]},zoom.constrain=function(_){return arguments.length?(constrain=_,zoom):constrain},zoom.duration=function(_){return arguments.length?(duration=+_,zoom):duration},zoom.interpolate=function(_){return arguments.length?(interpolate=_,zoom):interpolate},zoom.on=function(){var value=listeners.on.apply(listeners,arguments);return value===listeners?zoom:value},zoom.clickDistance=function(_){return arguments.length?(clickDistance2=(_=+_)*_,zoom):Math.sqrt(clickDistance2)},zoom.tapDistance=function(_){return arguments.length?(tapDistance=+_,zoom):tapDistance},zoom}().scaleExtent([this.options.minZoomLevel,this.options.maxZoomLevel]).on("zoom",this.onZoom),this.container.call(this.zoom)},ZoomPanHandler.prototype.onZoom=function(event){var transform=event.transform;transform&&(this.applyTransform(transform),this.rescale())},ZoomPanHandler.prototype.applyTransform=function(transform){var _a=this,width=_a.width,scaleX=_a.scaleX,scaleY=_a.scaleY,xSpan=_a.xSpan;_a.ySpan;var xBounds=_a.xBounds,yBounds=_a.yBounds,zFactor=_a.zFactor,ratio=this.viewportRatio,isXInverted=this.isXInverted,isYInverted=this.isYInverted,unitsPerPixels=xSpan/(width*transform.k),newXSpan=xSpan/transform.k,newYSpan=newXSpan/zFactor/ratio,shiftx=unitsPerPixels*transform.x,shifty=unitsPerPixels/zFactor*transform.y,dx0=xBounds[0]-(isXInverted?-shiftx:shiftx),dy0=yBounds[0]-(isYInverted?-shifty:shifty);scaleX.domain([dx0,dx0+(isXInverted?-newXSpan:newXSpan)]),scaleY.domain([dy0,dy0+(isYInverted?-newYSpan:newYSpan)]),this.currentTransform=transform},ZoomPanHandler.prototype.setViewport=function(cx,cy,displ,duration){void 0===cx&&(cx=null),void 0===cy&&(cy=null),void 0===displ&&(displ=null),void 0===duration&&(duration=null);var _a=this,zoom=_a.zoom,container=_a.container,calculateTransform=_a.calculateTransform;_a.viewportRatio;var scaleX=_a.scaleX,scaleY=_a.scaleY,isXInverted=_a.isXInverted;if(null===cx||null===displ){var xd=scaleX.domain(),dspan=xd[1]-xd[0];null===cx&&(cx=xd[0]+dspan/2||0),null===displ&&(displ=Math.abs(dspan)||1)}if(null===cy){var yd=scaleY.domain();cy=yd[0]+(yd[1]-yd[0])/2||0}var xdispl=isXInverted?-displ:displ,dx0=cx-xdispl/2,t=calculateTransform(dx0,dx0+xdispl,cy);Number.isFinite(duration)&&duration>0?zoom.transform(container.transition().duration(duration),t):zoom.transform(container,t)},ZoomPanHandler.prototype.setBounds=function(xBounds,yBounds){this.xBounds=xBounds,this.yBounds=yBounds,this.recalculateZoomTransform()},ZoomPanHandler.prototype.setTranslateBounds=function(xBounds,yBounds){this.translateBoundsX=xBounds,this.translateBoundsY=yBounds,this.updateTranslateExtent()},ZoomPanHandler.prototype.adjustToSize=function(width,height,force){void 0===force&&(force=!1);var _a=this,oldWidth=_a.width,oldHeight=_a.height,scaleX=_a.scaleX,scaleY=_a.scaleY,recalculateZoomTransform=_a.recalculateZoomTransform,w=0,h=0;if(void 0===width||"boolean"==typeof width){var _b=this.container.node().getBoundingClientRect();w=_b.containerWidth,h=_b.containerHeight}else w=width,h=height;var newWidth=Math.max(1,w),newHeight=Math.max(1,h);(force||oldWidth!==newWidth||oldHeight!==newHeight)&&(scaleX.range([0,newWidth]),scaleY.range([0,newHeight]),recalculateZoomTransform(),this.onRescale(this.currentStateAsEvent()))},ZoomPanHandler.prototype.calculateTransform=function(dx0,dx1,dy){var _a=this,scaleX=_a.scaleX,xSpan=_a.xSpan,xBounds=_a.xBounds,yBounds=_a.yBounds,zFactor=_a.zFactor,ratio=_a.viewportRatio,isXInverted=_a.isXInverted,isYInverted=_a.isYInverted,_b=scaleX.range(),rx1=_b[0],rx2=_b[1],displ=Math.abs(dx1-dx0),k=xSpan/displ,unitsPerPixels=displ/(rx2-rx1),dy0=dy-(isYInverted?-displ:displ)/zFactor/ratio/2,tx=(xBounds[0]-dx0)/(isXInverted?-unitsPerPixels:unitsPerPixels),ty=(yBounds[0]-dy0)/((isYInverted?-unitsPerPixels:unitsPerPixels)/zFactor);return identity$3.translate(tx,ty).scale(k)},ZoomPanHandler.prototype.recalculateZoomTransform=function(){var _a=this,scaleX=_a.scaleX,scaleY=_a.scaleY,container=_a.container,calculateTransform=_a.calculateTransform,updateTranslateExtent=_a.updateTranslateExtent,_b=scaleX.domain(),dx0=_b[0],dx1=_b[1],_c=scaleY.domain(),dy0=_c[0],transform=calculateTransform(dx0,dx1,dy0+(_c[1]-dy0)/2);updateTranslateExtent(),this.zoom.transform(container,transform)},ZoomPanHandler.prototype.setZoomLevelBoundary=function(zoomlevels){return this.zoom.scaleExtent(zoomlevels),this},ZoomPanHandler.prototype.setMaxZoomLevel=function(zoomlevel){var zoomLevels=this.zoom.scaleExtent();return this.zoom.scaleExtent([zoomLevels[0],zoomlevel]),this},ZoomPanHandler.prototype.setMinZoomLevel=function(zoomlevel){var zoomLevels=this.zoom.scaleExtent();return this.zoom.scaleExtent([zoomlevel,zoomLevels[1]]),this},ZoomPanHandler}();function identity$4(x){return x}function translateX(x){return"translate("+x+",0)"}function translateY(y){return"translate(0,"+y+")"}function number$2(scale){return d=>+scale(d)}function center(scale,offset){return offset=Math.max(0,scale.bandwidth()-2*offset)/2,scale.round()&&(offset=Math.round(offset)),d=>+scale(d)+offset}function entering(){return!this.__axis}function axis(orient,scale){var tickArguments=[],tickValues=null,tickFormat=null,tickSizeInner=6,tickSizeOuter=6,tickPadding=3,offset="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,k=1===orient||4===orient?-1:1,x=4===orient||2===orient?"x":"y",transform=1===orient||3===orient?translateX:translateY;function axis(context){var values=null==tickValues?scale.ticks?scale.ticks.apply(scale,tickArguments):scale.domain():tickValues,format=null==tickFormat?scale.tickFormat?scale.tickFormat.apply(scale,tickArguments):identity$4:tickFormat,spacing=Math.max(tickSizeInner,0)+tickPadding,range=scale.range(),range0=+range[0]+offset,range1=+range[range.length-1]+offset,position=(scale.bandwidth?center:number$2)(scale.copy(),offset),selection=context.selection?context.selection():context,path=selection.selectAll(".domain").data([null]),tick=selection.selectAll(".tick").data(values,scale).order(),tickExit=tick.exit(),tickEnter=tick.enter().append("g").attr("class","tick"),line=tick.select("line"),text=tick.select("text");path=path.merge(path.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),tick=tick.merge(tickEnter),line=line.merge(tickEnter.append("line").attr("stroke","currentColor").attr(x+"2",k*tickSizeInner)),text=text.merge(tickEnter.append("text").attr("fill","currentColor").attr(x,k*spacing).attr("dy",1===orient?"0em":3===orient?"0.71em":"0.32em")),context!==selection&&(path=path.transition(context),tick=tick.transition(context),line=line.transition(context),text=text.transition(context),tickExit=tickExit.transition(context).attr("opacity",1e-6).attr("transform",(function(d){return isFinite(d=position(d))?transform(d+offset):this.getAttribute("transform")})),tickEnter.attr("opacity",1e-6).attr("transform",(function(d){var p=this.parentNode.__axis;return transform((p&&isFinite(p=p(d))?p:position(d))+offset)}))),tickExit.remove(),path.attr("d",4===orient||2===orient?tickSizeOuter?"M"+k*tickSizeOuter+","+range0+"H"+offset+"V"+range1+"H"+k*tickSizeOuter:"M"+offset+","+range0+"V"+range1:tickSizeOuter?"M"+range0+","+k*tickSizeOuter+"V"+offset+"H"+range1+"V"+k*tickSizeOuter:"M"+range0+","+offset+"H"+range1),tick.attr("opacity",1).attr("transform",(function(d){return transform(position(d)+offset)})),line.attr(x+"2",k*tickSizeInner),text.attr(x,k*spacing).text(format),selection.filter(entering).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===orient?"start":4===orient?"end":"middle"),selection.each((function(){this.__axis=position}))}return axis.scale=function(_){return arguments.length?(scale=_,axis):scale},axis.ticks=function(){return tickArguments=Array.from(arguments),axis},axis.tickArguments=function(_){return arguments.length?(tickArguments=null==_?[]:Array.from(_),axis):tickArguments.slice()},axis.tickValues=function(_){return arguments.length?(tickValues=null==_?null:Array.from(_),axis):tickValues&&tickValues.slice()},axis.tickFormat=function(_){return arguments.length?(tickFormat=_,axis):tickFormat},axis.tickSize=function(_){return arguments.length?(tickSizeInner=tickSizeOuter=+_,axis):tickSizeInner},axis.tickSizeInner=function(_){return arguments.length?(tickSizeInner=+_,axis):tickSizeInner},axis.tickSizeOuter=function(_){return arguments.length?(tickSizeOuter=+_,axis):tickSizeOuter},axis.tickPadding=function(_){return arguments.length?(tickPadding=+_,axis):tickPadding},axis.offset=function(_){return arguments.length?(offset=+_,axis):offset},axis}var Axis=function(){function Axis(mainGroup,showLabels,labelXDesc,labelYDesc,unitOfMeasure,options){var _this=this;void 0===showLabels&&(showLabels=!0),this._showLabels=!0,this._offsetX=0,this._offsetY=0,this._flipX=!1,this._flipY=!1,this.visible=!0,this.createOrGet=function(name){var mainGroup=_this.mainGroup,res=mainGroup.select("g."+name);return res.empty()&&(res=mainGroup.append("g").attr("class",name)),res},this.mainGroup=mainGroup,this._showLabels=showLabels,this._labelXDesc=labelXDesc,this._labelYDesc=labelYDesc,this._unitOfMeasure=unitOfMeasure,options&&options.offsetX&&(this._offsetX=options.offsetX),options&&options.offsetX&&(this._offsetY=options.offsetY),options&&options.visible&&(this.visible=options.visible),this.mainGroup.style("pointer-events","none"),this._scaleX=linear$1().domain([0,1]).range([0,1]),this._scaleY=linear$1().domain([0,1]).range([0,1])}return Axis.prototype.renderLabelx=function(){var labelXDesc=this._labelXDesc,unitOfMeasure=this._unitOfMeasure,_showLabels=this._showLabels,width=this._scaleX.range()[1],gx=this.renderGx(),labelx=gx.select("text.axis-labelx");return _showLabels?labelx.empty()&&(labelx=gx.append("text").attr("class","axis-labelx").attr("fill","rgba(0,0,0,0.3)").style("text-anchor","middle").style("font-weight","800").style("font-size","10px").text(labelXDesc+" ("+unitOfMeasure+")")):labelx.remove(),labelx.attr("transform","translate("+width/2+",-4)"),labelx},Axis.prototype.renderLabely=function(){var labelYDesc=this._labelYDesc,unitOfMeasure=this._unitOfMeasure,_showLabels=this._showLabels,height=this._scaleY.range()[1],gy=this.renderGy(),labely=gy.select("text.axis-labely");return _showLabels?(labely.empty()&&(labely=gy.append("text").attr("class","axis-labely").attr("fill","rgba(0,0,0,0.3)").style("text-anchor","middle").style("font-weight","800").style("font-size","10px").text(labelYDesc+" ("+unitOfMeasure+")")),labely.attr("transform","translate(-10,"+height/2+")rotate(90)")):labely.remove(),labely},Axis.prototype.renderGy=function(){var _scaleX=this._scaleX,yAxis=function(scale){return axis(2,scale)}(this._scaleY),width=_scaleX.range()[1],gy=this.createOrGet("y-axis");return gy.call(yAxis),gy.attr("transform","translate("+width+",0)"),gy},Axis.prototype.renderGx=function(){var _scaleX=this._scaleX,_scaleY=this._scaleY,xAxis=function(scale){return axis(3,scale)}(_scaleX),height=_scaleY.range()[1],gx=this.createOrGet("x-axis");return gx.attr("transform","translate(0 "+height+")"),gx.call(xAxis),gx},Axis.prototype.render=function(){this.renderLabelx(),this.renderLabely()},Axis.prototype.onResize=function(event){this.mainGroup.attr("height",event.height+"px").attr("width",event.width+"px")},Axis.prototype.onRescale=function(event){var _scaleX=this._scaleX,_scaleY=this._scaleY,offsetX=this.offsetX,offsetY=this.offsetY,xScale=event.xScale,yScale=event.yScale,xBounds=xScale.domain(),yBounds=yScale.domain(),xRange=xScale.range(),yRange=yScale.range();_scaleX.domain([xBounds[0]-offsetX,xBounds[1]-offsetX]).range(xRange),_scaleY.domain([yBounds[0]-offsetY,yBounds[1]-offsetY]).range(yRange),this.flipX(this._flipX),this.flipY(this._flipY),this.visible&&this.render()},Axis.prototype.show=function(){return this.visible=!0,this.mainGroup.attr("visibility","visible"),this.render(),this},Axis.prototype.hide=function(){return this.visible=!1,this.mainGroup.attr("visibility","hidden"),this},Axis.prototype.flipX=function(flipX){this._flipX=flipX;var domain=this._scaleX.domain(),flip=flipX?-1:1;return this._scaleX.domain([flip*domain[0],flip*domain[1]]),this},Axis.prototype.flipY=function(flipY){this._flipY=flipY;var domain=this._scaleY.domain(),flip=flipY?-1:1;return this._scaleY.domain([flip*domain[0],flip*domain[1]]),this},Axis.prototype.showLabels=function(){return this._showLabels=!0,this.render(),this},Axis.prototype.hideLabels=function(){return this._showLabels=!1,this.render(),this},Axis.prototype.setLabelX=function(label){return this._labelXDesc=label,this},Axis.prototype.setLabelY=function(label){return this._labelYDesc=label,this},Axis.prototype.setUnitOfMeasure=function(uom){return this._unitOfMeasure=uom,this},Axis.prototype.setLabels=function(labelX,labelY,unitOfMeasure){return this._labelXDesc=labelX,this._labelYDesc=labelY,this._unitOfMeasure=unitOfMeasure,this},Object.defineProperty(Axis.prototype,"offsetX",{get:function(){return this._offsetX},set:function(offset){this._offsetX=offset},enumerable:!1,configurable:!0}),Object.defineProperty(Axis.prototype,"offsetY",{get:function(){return this._offsetY},set:function(offset){this._offsetY=offset},enumerable:!1,configurable:!0}),Object.defineProperty(Axis.prototype,"scaleX",{get:function(){return this._scaleX.copy()},enumerable:!1,configurable:!0}),Object.defineProperty(Axis.prototype,"scaleY",{get:function(){return this._scaleY.copy()},enumerable:!1,configurable:!0}),Axis}(),LayerManager=function(){function LayerManager(container,scaleOptions,axisOptions){var _this=this;if(this.layers=[],this.createAxis=function(options){var container=_this.container;_this._svgContainer=select(container).append("div").attr("class","axis").style("position","absolute").style("z-index","10").style("pointer-events","none");var svg=_this._svgContainer.append("svg").attr("height",container.offsetHeight+"px").attr("width",container.offsetWidth+"px");return new Axis(svg,!0,options.xLabel,options.yLabel,options.unitOfMeasure)},this.container=container,this.layerContainer=document.createElement("div"),this.layerContainer.className="layer-container",this.container.appendChild(this.layerContainer),this.adjustToSize(+this.container.getAttribute("width"),+this.container.getAttribute("height")),this._zoomPanHandler=new ZoomPanHandler(container,(function(event){return _this.rescale(event)})),scaleOptions){var xMin=scaleOptions.xMin,xMax=scaleOptions.xMax,yMin=scaleOptions.yMin,yMax=scaleOptions.yMax,xBounds=scaleOptions.xBounds,yBounds=scaleOptions.yBounds;void 0!==xMin&&void 0!==xMax&&void 0!==yMin&&void 0!==yMax&&this._zoomPanHandler.setBounds([xMin,xMax],[yMin,yMax]),xBounds&&yBounds&&this._zoomPanHandler.setBounds(xBounds,yBounds)}else this._zoomPanHandler.setBounds([0,1],[0,1]);axisOptions&&(this._axis=this.createAxis(axisOptions)),this.rescale=this.rescale.bind(this)}return LayerManager.prototype.addLayers=function(layers){var _this=this;return layers.forEach((function(layer){return _this.addLayer(layer)})),this},LayerManager.prototype.getLayers=function(){return this.layers},LayerManager.prototype.clearAllData=function(includeReferenceSystem){return void 0===includeReferenceSystem&&(includeReferenceSystem=!0),this.layers.forEach((function(l){return l.clearData(includeReferenceSystem)})),this},LayerManager.prototype.addLayer=function(layer,params){return this.layers.push(layer),this.initLayer(layer,params),this},LayerManager.prototype.removeLayer=function(layerId){var layer=this.layers.find((function(l){return l.id===layerId}));return layer&&(layer.onUnmount(),this.layers=this.layers.filter((function(l){return l.id!==layerId}))),this},LayerManager.prototype.removeAllLayers=function(){var _this=this;return this.layers.forEach((function(layer){_this.removeLayer(layer.id)})),this},LayerManager.prototype.getLayer=function(layerId){return this.layers.find((function(l){return l.id===layerId}))},LayerManager.prototype.initLayer=function(layer,params){var event={elm:this.layerContainer};layer.onMount(event);var rescaleEvent=this.zoomPanHandler.currentStateAsEvent();if(layer.onUpdate(__assign(__assign({},rescaleEvent),params)),layer.onRescale(rescaleEvent),this._svgContainer){var highestZIndex=this.layers.length>0?this.layers.reduce((function(max,layers){return max.order>layers.order?max:layers})).order:1;this._svgContainer.style("z-index",""+(highestZIndex+1))}return this},LayerManager.prototype.showLayer=function(layerId){var layer=this.getLayer(layerId);return layer.setVisibility(!0),layer.onRescale(this.zoomPanHandler.currentStateAsEvent()),this},LayerManager.prototype.hideLayer=function(layerId){return this.getLayer(layerId).setVisibility(!1),this},LayerManager.prototype.adjustToSize=function(width,height){var layersWidth=Math.max(this._axis?width-40:width,0),layersHeight=Math.max(this._axis?height-30:height,0);if(this._axis){var resizeEvent={width:width,height:height};this._axis.onResize(resizeEvent)}if(this.layers){var resizeEvent_1={width:layersWidth,height:layersHeight};this.layers.forEach((function(layer){return layer.onResize(resizeEvent_1)}))}this._zoomPanHandler&&this._zoomPanHandler.adjustToSize(layersWidth,layersHeight,!0)},LayerManager.prototype.setReferenceSystem=function(irs){this.layers.forEach((function(layer){return layer.referenceSystem=irs}))},LayerManager.prototype.showAxis=function(){return this._axis.show(),this},LayerManager.prototype.hideAxis=function(){return this._axis.hide(),this},LayerManager.prototype.showAxisLabels=function(){return this._axis.showLabels(),this},LayerManager.prototype.hideAxisLabels=function(){return this._axis.hideLabels(),this},LayerManager.prototype.setAxisOffset=function(x,y){return this._axis.offsetX=x,this._axis.offsetY=y,this.layers.filter((function(l){return l instanceof GridLayer})).forEach((function(l){l.offsetX=x,l.offsetY=y})),this},LayerManager.prototype.setXAxisOffset=function(x){return this._axis.offsetX=x,this.layers.filter((function(l){return l instanceof GridLayer})).forEach((function(l){l.offsetX=x})),this},LayerManager.prototype.setYAxisOffset=function(y){return this._axis.offsetY=y,this.layers.filter((function(l){return l instanceof GridLayer})).forEach((function(l){l.offsetY=y})),this},LayerManager.prototype.setZoomLevelBoundary=function(zoomlevels){return this._zoomPanHandler.setZoomLevelBoundary(zoomlevels),this},LayerManager.prototype.setMaxZoomLevel=function(zoomlevel){return this._zoomPanHandler.setMaxZoomLevel(zoomlevel),this},LayerManager.prototype.setMinZoomLevel=function(zoomlevel){return this._zoomPanHandler.setMinZoomLevel(zoomlevel),this},LayerManager.prototype.destroy=function(){return this.removeAllLayers(),this.layerContainer.remove(),this.layerContainer=void 0,this.container=void 0,this.layers=void 0,this._zoomPanHandler=void 0,this._axis=void 0,this._svgContainer=void 0,this},Object.defineProperty(LayerManager.prototype,"zoomPanHandler",{get:function(){return this._zoomPanHandler},enumerable:!1,configurable:!0}),Object.defineProperty(LayerManager.prototype,"axis",{get:function(){return this._axis},enumerable:!1,configurable:!0}),LayerManager.prototype.rescale=function(event){this._axis&&this._axis.onRescale(event),this.layers&&this.layers.forEach((function(layer){return!0===layer.isVisible?layer.onRescale(event):{}}))},LayerManager}(),RootFinder=function(){function RootFinder(){}return RootFinder.newton=function(func,precision,maxIterations,start,minLimit,maxLimit){void 0===precision&&(precision=.01),void 0===maxIterations&&(maxIterations=1e3),void 0===start&&(start=.5),void 0===minLimit&&(minLimit=0),void 0===maxLimit&&(maxLimit=1);for(var h=1e-4,t=start,i=0;i<maxIterations;i++){var v=func(t);if(Math.abs(v)<precision)return clamp(t,minLimit,maxLimit);t-=v/((func(t+h)-v)/h)}return null},RootFinder.bisect=function(func,precision,maxIterations,start,minLimit,maxLimit){void 0===precision&&(precision=.01),void 0===maxIterations&&(maxIterations=1e3),void 0===start&&(start=.5),void 0===minLimit&&(minLimit=0),void 0===maxLimit&&(maxLimit=1);var v,i,tl=minLimit,th=maxLimit,t=start;for(i=0;i<maxIterations;i++){if(v=func(t),Math.abs(v)<precision)return t;v<0?th=t:tl=t,t=(th+tl)/2}return t},RootFinder.findRoot=function(func,precision,maxIterations,start,minLimit,maxLimit){void 0===precision&&(precision=.01),void 0===maxIterations&&(maxIterations=1e3),void 0===start&&(start=.5),void 0===minLimit&&(minLimit=0),void 0===maxLimit&&(maxLimit=1);var t=RootFinder.newton(func,precision,maxIterations,start);return null==t&&(t=RootFinder.bisect(func,precision,maxIterations,start,minLimit,maxLimit)),t},RootFinder}(),ArcLength=function(){function ArcLength(){}return ArcLength.bisect=function(func,minLimit,maxLimit,tolerance,minDepth,maxDepth){void 0===minLimit&&(minLimit=0),void 0===maxLimit&&(maxLimit=1),void 0===tolerance&&(tolerance=.005),void 0===minDepth&&(minDepth=4),void 0===maxDepth&&(maxDepth=10);var calcRec=function(a,b,aVal,bVal,span,tolerance,depth){void 0===depth&&(depth=0);var mid=(a+b)/2,midVal=func(mid),spanA=Vector2.distance(aVal,midVal),spanB=Vector2.distance(midVal,bVal),length=spanA+spanB;if(depth>=minDepth&&Math.abs(length-span)<tolerance||depth>=maxDepth)return length;var tol=tolerance/2,d=depth+1;return calcRec(a,mid,aVal,midVal,spanA,tol,d)+calcRec(mid,b,midVal,bVal,spanB,tol,d)},aVal=func(minLimit),bVal=func(maxLimit),span=Vector2.distance(aVal,bVal);return calcRec(minLimit,maxLimit,aVal,bVal,span,tolerance)},ArcLength.trapezoid=function(func,minLimit,maxLimit,segments){void 0===minLimit&&(minLimit=0),void 0===maxLimit&&(maxLimit=1),void 0===segments&&(segments=1e3);for(var length=0,lastPos=func(minLimit),step=(maxLimit-minLimit)/(segments-1),i=1;i<segments;i++){var pos=func(minLimit+i*step);length+=Vector2.distance(lastPos,pos),lastPos=pos}return length},ArcLength}(),BinarySearch=function(){function BinarySearch(){}return BinarySearch.search=function(values,searchValue){for(var il=0,ih=values.length-1,i=Math.floor(il+ih/2);i>il&&i<ih;){var v=values[i],v1=values[i+1];if(v<=searchValue&&v1>=searchValue)return i;searchValue<v?ih=i:il=i,i=Math.floor(il+ih/2)}return i},BinarySearch}(),ExtendedCurveInterpolator=function(_super){function ExtendedCurveInterpolator(points,options){var _this=_super.call(this,points,options)||this;return _this.arcLengthLookup=[],_this.findTForArcLength=_this.findTForArcLength.bind(_this),_this.findTByRootForArcLength=_this.findTByRootForArcLength.bind(_this),_this.findApproxTForArcLength=_this.findApproxTForArcLength.bind(_this),_this.findTQuickForArcLength=_this.findTQuickForArcLength.bind(_this),_this.generateArcLengthLookup=_this.generateArcLengthLookup.bind(_this),_this.getArcLength=_this.getArcLength.bind(_this),_this.getQuickArcLength=_this.getQuickArcLength.bind(_this),_this.getPointAtArcLength=_this.getPointAtArcLength.bind(_this),_this.getPointAt=_this.getPointAt.bind(_this),_this}return __extends(ExtendedCurveInterpolator,_super),ExtendedCurveInterpolator.prototype.findTForArcLength=function(arcLength,options){return(null==options?void 0:options.approxT)?this.findApproxTForArcLength(arcLength,null==options?void 0:options.normalizedLength):(null==options?void 0:options.quickT)?this.findTQuickForArcLength(arcLength):this.findTByRootForArcLength(arcLength)},ExtendedCurveInterpolator.prototype.findTByRootForArcLength=function(arcLength,tolerance,iterations){var _this=this;return void 0===tolerance&&(tolerance=.01),void 0===iterations&&(iterations=100),arcLength<=0?0:arcLength>=this.length?1:RootFinder.findRoot((function(x){return arcLength-_this.getQuickArcLength(0,x)}),tolerance,iterations,arcLength/this.length)},ExtendedCurveInterpolator.prototype.findApproxTForArcLength=function(arcLength,normalizedLength){return arcLength/(normalizedLength||this.length)},ExtendedCurveInterpolator.prototype.findTQuickForArcLength=function(arcLength){0===this.arcLengthLookup.length&&this.generateArcLengthLookup();var index=BinarySearch.search(this.arcLengthLookup,arcLength),v1=this.arcLengthLookup[index];return(index+(arcLength-v1)/(this.arcLengthLookup[index+1]-v1))/this.arcLengthLookup.length},ExtendedCurveInterpolator.prototype.generateArcLengthLookup=function(segments){void 0===segments&&(segments=1e3);for(var lastPos=this.getPointAt(0),length=0,i=0;i<segments;i++){var pos=this.getPointAt(i/(segments-1));length+=Vector2.distance(lastPos,pos),this.arcLengthLookup.push(length),lastPos=pos}},ExtendedCurveInterpolator.prototype.getArcLength=function(from,to){var _this=this;return void 0===from&&(from=0),void 0===to&&(to=1),0===from&&1===to?this.length:ArcLength.bisect((function(t){return _this.getPointAt(t)}),from,to,.002)},ExtendedCurveInterpolator.prototype.getQuickArcLength=function(from,to){void 0===from&&(from=0),void 0===to&&(to=1);var fromLength=0,toLength=this.length;if(0===this.arcLengthLookup.length&&this.generateArcLengthLookup(),0!==from){var fromIndex=Math.floor(from*this.arcLengthLookup.length),fromLl=this.arcLengthLookup[fromIndex],fromLh=this.arcLengthLookup[fromIndex+1];fromLength=fromLl+from*this.arcLengthLookup.length%this.arcLengthLookup.length*(fromLh-fromLl)}if(1!==to){var toIndex=Math.floor(to*this.arcLengthLookup.length),toLl=this.arcLengthLookup[toIndex],toLh=this.arcLengthLookup[toIndex+1];toLength=toLl+from*this.arcLengthLookup.length%this.arcLengthLookup.length*(toLh-toLl)}return toLength-fromLength},ExtendedCurveInterpolator.prototype.getPointAtArcLength=function(arcLength,options){var t=this.findTForArcLength(arcLength,options);return this.getPointAt(t)},ExtendedCurveInterpolator.prototype.getPointAt=function(t){var tl=clamp(t,0,1);return _super.prototype.getPointAt.call(this,tl)},ExtendedCurveInterpolator}(CurveInterpolator),defaultOptions$2={approxT:!0},IntersectionReferenceSystem=function(){function IntersectionReferenceSystem(path,options){if(this.path=[],this.projectedPath=[],this._offset=0,path.length<1)throw new Error("Missing coordinates");if(path[0]&&3!==path[0].length)throw new Error("Coordinates should be in 3d");this.setPath(path,options),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.getPosition=this.getPosition.bind(this),this.getProjectedLength=this.getProjectedLength.bind(this),this.getTrajectory=this.getTrajectory.bind(this)}return IntersectionReferenceSystem.prototype.setPath=function(path,options){void 0===options&&(options={}),this.options=__assign(__assign({},defaultOptions$2),options);var _a=this.options,arcDivisions=_a.arcDivisions,tension=_a.tension,calculateDisplacementFromBottom=_a.calculateDisplacementFromBottom;this.path=path,this.projectedPath=IntersectionReferenceSystem.toDisplacement(path);var displacement=this.projectedPath[this.projectedPath.length-1][0];this.displacement=displacement,this.interpolators={curve:options.curveInterpolator||new ExtendedCurveInterpolator(path),trajectory:options.trajectoryInterpolator||new ExtendedCurveInterpolator(path.map((function(d){return[d[0],d[1]]})),{tension:tension||.75,arcDivisions:arcDivisions||5e3}),curtain:options.curtainInterpolator||new ExtendedCurveInterpolator(this.projectedPath,{tension:tension||.75,arcDivisions:arcDivisions||5e3})};var trajVector=this.getTrajectoryVector(),negativeTrajVector=trajVector.map((function(d){return-1*d}));calculateDisplacementFromBottom?(this.endVector=negativeTrajVector,this.startVector=trajVector):(this.endVector=trajVector,this.startVector=negativeTrajVector),this._curtainPathCache=void 0},IntersectionReferenceSystem.prototype.project=function(length){var curtain=this.interpolators.curtain,cl=clamp(this.options.calculateDisplacementFromBottom?this.length-(length-this._offset):length-this._offset,0,this.length);return curtain.getPointAtArcLength(cl,this.options)},IntersectionReferenceSystem.prototype.curtainTangent=function(length){var curtain=this.interpolators.curtain,l=length-this._offset,t=curtain.findTForArcLength(l,this.options);return t&&curtain.getTangentAt(t)},IntersectionReferenceSystem.prototype.getCurtainPath=function(start,end){if(!this._curtainPathCache){for(var points=[],prevAngle=2*Math.PI,i=this._offset;i<=this.length+this._offset;i+=.1){var point=this.project(i),angle=Math.atan2(point[1],point[0]);Math.abs(angle-prevAngle)>5e-4&&(points.push({point:point,md:i}),prevAngle=angle)}this._curtainPathCache=points}return this._curtainPathCache.filter((function(p){return p.md>=start&&p.md<=end}))},IntersectionReferenceSystem.prototype.unproject=function(displacement){var _a=this.options,normalizedLength=_a.normalizedLength,displacementFromStart=_a.calculateDisplacementFromBottom?this.displacement-displacement:displacement,length=normalizedLength||this.length;if(displacementFromStart<0)return displacementFromStart;if(displacementFromStart>this.displacement)return length+(displacementFromStart-this.displacement);var ls=this.interpolators.curtain.lookupPositions(displacementFromStart,0,1);return ls&&ls.length?ls[0]*length+this._offset:null},IntersectionReferenceSystem.prototype.getProjectedLength=function(length){var curtain=this.interpolators.curtain,l=this.project(length)[0]/curtain.maxX;return Number.isFinite(l)?clamp(l,0,1):0},IntersectionReferenceSystem.prototype.getPosition=function(length){var trajectory=this.interpolators.trajectory,t=this.getProjectedLength(length);return trajectory.getPointAt(t)},IntersectionReferenceSystem.prototype.getTrajectory=function(steps,from,to){void 0===from&&(from=0),void 0===to&&(to=1);var p0,p3,extensionStart=from<0?-from:0,extensionEnd=to>1?to-1:0,refStart=this.interpolators.trajectory.getPointAt(0),refEnd=this.interpolators.trajectory.getPointAt(1),offset=0,t0=Math.max(0,from),t1=Math.min(1,to),p1=this.interpolators.trajectory.getPointAt(t0),p2=this.interpolators.trajectory.getPointAt(t1);extensionStart?(p0=[refStart[0]+this.startVector[0]*extensionStart*this.displacement,refStart[1]+this.startVector[1]*extensionStart*this.displacement],offset=-Vector2.distance(p0,refStart)):from>0&&(offset=Vector2.distance(p1,refStart)),extensionEnd&&(p3=[refEnd[0]+this.endVector[0]*extensionEnd*this.displacement,refEnd[1]+this.endVector[1]*extensionEnd*this.displacement]);var points=[],tl=to-from,preSteps=Math.floor(extensionStart/tl*steps),curveSteps=Math.ceil((t1-t0)/tl*steps),postSteps=steps-curveSteps-preSteps;if(p0){points.push(p0);for(var i=1;i<preSteps;i++){var f=i/preSteps*extensionStart*this.displacement;points.push([p0[0]-this.startVector[0]*f,p0[1]-this.startVector[1]*f])}}var curvePoints=this.interpolators.trajectory.getPoints(curveSteps-1,null,t0,t1);if(points.push.apply(points,curvePoints),p3){for(i=1;i<postSteps-1;i++){f=i/postSteps*extensionEnd*this.displacement;points.push([p2[0]+this.endVector[0]*f,p2[1]+this.endVector[1]*f])}points.push(p3)}return{points:points,offset:offset}},IntersectionReferenceSystem.prototype.getExtendedTrajectory=function(numPoints,startExtensionLength,endExtensionLength){if(void 0===startExtensionLength&&(startExtensionLength=1e3),void 0===endExtensionLength&&(endExtensionLength=1e3),!isFinite(startExtensionLength)||startExtensionLength<0)throw new Error("Invalid parameter, getExtendedTrajectory() must be called with a valid and positive startExtensionLength parameter");if(!isFinite(endExtensionLength)||endExtensionLength<0)throw new Error("Invalid parameter, getExtendedTrajectory() must be called with a valid and positive endExtensionLength parameter");for(var totalLength=this.displacement+startExtensionLength+endExtensionLength,startExtensionNumPoints=Math.floor(startExtensionLength/totalLength*numPoints),curveSteps=Math.max(Math.ceil(this.displacement/totalLength*numPoints),1),endExtensionNumPoints=numPoints-curveSteps-startExtensionNumPoints,points=[],refStart=new Vector2(this.interpolators.trajectory.getPointAt(0)),startVec=new Vector2(this.startVector),startExtensionStepLength=startExtensionLength/startExtensionNumPoints,i=startExtensionNumPoints;i>0;i--){var f=i*startExtensionStepLength,point=refStart.add(startVec.scale(f));points.push(point.toArray())}points.push.apply(points,this.interpolators.trajectory.getPoints(curveSteps,null,0,1));var refEnd=new Vector2(this.interpolators.trajectory.getPointAt(1)),endVec=new Vector2(this.endVector),endExtensionStepLength=endExtensionLength/(endExtensionNumPoints-1);for(i=1;i<endExtensionNumPoints;i++){f=i*endExtensionStepLength,point=refEnd.add(endVec.scale(f));points.push(point.toArray())}return{points:points,offset:-startExtensionLength}},IntersectionReferenceSystem.prototype.getTrajectoryVector=function(){var _a=this.options,trajectoryAngle=_a.trajectoryAngle,calculateDisplacementFromBottom=_a.calculateDisplacementFromBottom;if(isFinite(trajectoryAngle)){var angleInRad=trajectoryAngle*DEG2RAD;return new Vector2(Math.cos(angleInRad),Math.sin(angleInRad)).toArray()}return IntersectionReferenceSystem.getDirectionVector(this.interpolators.trajectory,calculateDisplacementFromBottom?.001:.999,calculateDisplacementFromBottom?0:1)},IntersectionReferenceSystem.toDisplacement=function(points,offset){void 0===offset&&(offset=0);var p0=points[0],l=0;return points.map((function(p1){var dx=p1[0]-p0[0],dy=p1[1]-p0[1];return l+=Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2)),p0=p1,[offset>0?offset-l:l,p1[2]||0]}))},IntersectionReferenceSystem.getDirectionVector=function(interpolator,from,to){var p1=interpolator.getPointAt(to),p2=interpolator.getPointAt(from);return normalize$2([p1[0]-p2[0],p1[1]-p2[1]])},Object.defineProperty(IntersectionReferenceSystem.prototype,"length",{get:function(){return this.interpolators.curve.length},enumerable:!1,configurable:!0}),Object.defineProperty(IntersectionReferenceSystem.prototype,"offset",{get:function(){return this._offset},set:function(offset){this._curtainPathCache=void 0,this._offset=offset},enumerable:!1,configurable:!0}),IntersectionReferenceSystem}(),Overlay=function(){function Overlay(caller,container){var _this=this;this.elements={},this.listeners={},this.enabled=!0;var con=select(container);this.elm=con.append("div").attr("id","overlay").style("z-index","11").style("position","absolute"),this.source=this.elm.node();var elm=this.elm;elm.on("resize",(function(event){var _a=event.detail,width=_a.width,height=_a.height;elm.style("width",width+"px").style("height",height+"px"),_this.enabled&&Object.keys(_this.listeners).forEach((function(key){var target=_this.elements[key]||null,ops=_this.listeners[key];ops&&ops.onResize&&requestAnimationFrame((function(){return ops.onResize({target:target,source:_this.source,caller:caller,width:width,height:height})}))}))})),elm.on("mousemove",(function(event){if(_this.enabled){var _a=pointer(event,_this.elm.node()),mx=_a[0],my=_a[1];Object.keys(_this.listeners).forEach((function(key){var target=_this.elements[key]||null,ops=_this.listeners[key];ops&&ops.onMouseMove&&requestAnimationFrame((function(){return ops.onMouseMove({x:mx,y:my,target:target,source:_this.source,caller:caller})}))}))}})),elm.on("mouseout",(function(){_this.enabled&&Object.keys(_this.listeners).forEach((function(key){var target=_this.elements[key]||null,ops=_this.listeners[key];ops&&ops.onMouseExit&&requestAnimationFrame((function(){return ops.onMouseExit({target:target,source:_this.source,caller:caller})}))}))}))}return Overlay.prototype.create=function(key,callbacks){var newElm=this.elm.append("div").style("position","relative").style("pointer-events","none").node();return this.elements[key]=newElm,callbacks&&(this.listeners[key]=callbacks),newElm},Overlay.prototype.register=function(key,callbacks){this.listeners[key]=callbacks},Overlay.prototype.remove=function(key){var el=this.elements[key];el&&(select(el).remove(),delete this.elements[key]),delete this.listeners[key]},Overlay.prototype.setZIndex=function(zIndex){this.elm.style("z-index",zIndex)},Overlay.prototype.destroy=function(){this.source.remove()},Overlay}(),Controller=function(){function Controller(options){var container=options.container,axisOptions=options.axisOptions,scaleOptions=options.scaleOptions,referenceSystem=options.referenceSystem,layers=options.layers,path=options.path;this._referenceSystem=referenceSystem||path&&new IntersectionReferenceSystem(path),this._overlay=function(caller,container){return new Overlay(caller,container)}(this,container),this.layerManager=new LayerManager(this._overlay.elm.node(),scaleOptions,axisOptions),layers&&(this.layerManager.addLayers(layers),this.setOverlayZIndex(layers))}return Controller.prototype.setReferenceSystem=function(referenceSystem){return this._referenceSystem=referenceSystem,this.layerManager.setReferenceSystem(referenceSystem),this},Controller.prototype.updatePath=function(path,options){return this.setReferenceSystem(new IntersectionReferenceSystem(path,options)),this},Controller.prototype.clearAllData=function(includeReferenceSystem){return void 0===includeReferenceSystem&&(includeReferenceSystem=!0),this.layerManager.clearAllData(includeReferenceSystem),this},Controller.prototype.addLayer=function(layer,params){return this.layerManager.addLayer(layer,params),this.setOverlayZIndex(this.layerManager.getLayers()),this},Controller.prototype.removeLayer=function(layerId){return this.layerManager.removeLayer(layerId),this},Controller.prototype.removeAllLayers=function(){return this.layerManager.removeAllLayers(),this},Controller.prototype.getLayer=function(layerId){return this.layerManager.getLayer(layerId)},Controller.prototype.showLayer=function(layerId){return this.layerManager.showLayer(layerId),this},Controller.prototype.hideLayer=function(layerId){return this.layerManager.hideLayer(layerId),this},Controller.prototype.adjustToSize=function(width,height){this.layerManager.adjustToSize(width,height);var dimensions={width:Math.max(width-40,0),height:Math.max(height-30,0)};return this.overlay.elm.dispatch("resize",{detail:dimensions,bubbles:!0,cancelable:!0}),this},Controller.prototype.setViewport=function(cx,cy,displacement,duration){return this.zoomPanHandler.setViewport(cx,cy,displacement,duration),this},Controller.prototype.setBounds=function(xBounds,yBounds){return this.zoomPanHandler.setBounds(xBounds,yBounds),this},Controller.prototype.showAxis=function(){return this.layerManager.showAxis(),this},Controller.prototype.hideAxis=function(){return this.layerManager.hideAxis(),this},Controller.prototype.showAxisLabels=function(){return this.layerManager.showAxisLabels(),this},Controller.prototype.hideAxisLabels=function(){return this.layerManager.hideAxisLabels(),this},Controller.prototype.setAxisOffset=function(x,y){return this.layerManager.setAxisOffset(x,y),this},Controller.prototype.setXAxisOffset=function(x){return this.layerManager.setXAxisOffset(x),this},Controller.prototype.setYAxisOffset=function(y){return this.layerManager.setYAxisOffset(y),this},Controller.prototype.setZoomLevelBoundary=function(zoomlevels){return this.zoomPanHandler.setZoomLevelBoundary(zoomlevels),this},Controller.prototype.setMaxZoomLevel=function(zoomlevel){return this.zoomPanHandler.setMaxZoomLevel(zoomlevel),this},Controller.prototype.setMinZoomLevel=function(zoomlevel){return this.zoomPanHandler.setMinZoomLevel(zoomlevel),this},Controller.prototype.destroy=function(){return this.layerManager.destroy(),this._overlay.destroy(),this._referenceSystem=void 0,this.layerManager=void 0,this._overlay=void 0,this},Controller.prototype.getHighestZIndex=function(layers){return layers.length>0?layers.reduce((function(max,layers){return max.order>layers.order?max:layers})).order:1},Controller.prototype.setOverlayZIndex=function(layers){var highestZIndex=this.getHighestZIndex(layers);this.overlay.setZIndex(highestZIndex+2)},Object.defineProperty(Controller.prototype,"overlay",{get:function(){return this._overlay},enumerable:!1,configurable:!0}),Object.defineProperty(Controller.prototype,"referenceSystem",{get:function(){return this._referenceSystem},enumerable:!1,configurable:!0}),Object.defineProperty(Controller.prototype,"zoomPanHandler",{get:function(){return this.layerManager.zoomPanHandler},enumerable:!1,configurable:!0}),Object.defineProperty(Controller.prototype,"axis",{get:function(){return this.layerManager.axis},enumerable:!1,configurable:!0}),Object.defineProperty(Controller.prototype,"currentStateAsEvent",{get:function(){return this.zoomPanHandler.currentStateAsEvent()},enumerable:!1,configurable:!0}),Controller}();exports.Axis=Axis,exports.CalloutCanvasLayer=CalloutCanvasLayer,exports.CanvasLayer=CanvasLayer,exports.CasingLayer=CasingLayer,exports.CementLayer=CementLayer,exports.CompletionLayer=CompletionLayer,exports.Controller=Controller,exports.GeomodelCanvasLayer=GeomodelCanvasLayer,exports.GeomodelLabelsLayer=GeomodelLabelsLayer,exports.GeomodelLayer=GeomodelLayer,exports.GeomodelLayerV2=GeomodelLayerV2,exports.GridLayer=GridLayer,exports.HTMLLayer=HTMLLayer,exports.HoleSizeLayer=HoleSizeLayer,exports.ImageLayer=ImageLayer,exports.IntersectionReferenceSystem=IntersectionReferenceSystem,exports.Layer=Layer,exports.LayerManager=LayerManager,exports.PixiLayer=PixiLayer,exports.SVGLayer=SVGLayer,exports.SeismicCanvasLayer=SeismicCanvasLayer,exports.WellborepathLayer=WellborepathLayer,exports.ZoomPanHandler=ZoomPanHandler,exports.calcSize=calcSize,exports.findIndexOfSample=findIndexOfSample,exports.findSampleAtPos=findSampleAtPos,exports.generateProjectedTrajectory=function(poslog,defaultIntersectionAngle){if(!poslog||0===poslog.length)return[];var points=poslog?poslog.map((function(p){return[p.easting,p.northing,p.tvd,p.md]})):[],interpolator=new CurveInterpolator(points,{tension:.75,arcDivisions:5e3}),displacement=interpolator.length,nPoints=Math.round(10*displacement),path=null,first=(path=nPoints>0?simplify(interpolator.getPoints(nPoints),5e-4,10):[[points[0][0],points[0][1]]])[0],last=path[path.length-1],relativeDist=Vector2.distance(first,last),v=null;if(relativeDist<150){var radCurtainDirection=defaultIntersectionAngle/180*Math.PI;v=new Vector2(Math.cos(radCurtainDirection),Math.sin(radCurtainDirection)).mutable}else v=function(path,threshold){for(var res=Vector2.zero.mutable,len=0,temp=Vector2.zero.mutable,i=0;i<path.length-1;i++){var index=path.length-1-i;if(temp.set(path[index]).sub(path[index-1]),res.add(temp),(len=res.magnitude)>threshold)break}return 0===len?new Vector2([0,0]):res.scale(1/len)}(path,30);var extensionLengthStart=Math.max(0,1e3-displacement),offset=extensionLengthStart+displacement,trajectory=[],firstPoints=[],initial=v.toArray();extensionLengthStart>0&&((firstPoints=seqI(Math.ceil(.1*extensionLengthStart)).map((function(t){return v.set(initial).scale(extensionLengthStart*(1-t)).subFrom(first).toArray()}))).pop(),trajectory.push.apply(trajectory,firstPoints)),trajectory.push.apply(trajectory,path);var endPoints=seqI(Math.ceil(100)).map((function(t){return v.set(initial).scale(1e3*t).add(last).toArray()})).splice(1);return trajectory.push.apply(trajectory,endPoints),Vector2.angleRight(initial),projectCurtain(trajectory,null,offset)},exports.generateProjectedWellborePath=function(poslog){if(!poslog||0===poslog.length)return[];var projection=simplify(projectCurtain(poslog?poslog.map((function(p){return[p.easting,p.northing,p.tvd,p.md]})):[])),offset=projection[projection.length-1][0];return projection.forEach((function(p,i){projection[i][0]=offset-p[0]})),projection},exports.generateSeismicSliceImage=function(data,trajectory,colormap,options){return __awaiter(this,void 0,void 0,(function(){var dp,min,max,absMax,dmin,dmax,domain,length,width,height,colorTable,d,offset,colorFactor,pos,step,val1,val2,i,col,black,opacity,x,index,x1,x2,ratio,y,imageData;return __generator(this,(function(_a){switch(_a.label){case 0:if(!(data&&data.datapoints&&data.datapoints.length>0))return[2];for(dp=data.datapoints,min=(null==options?void 0:options.seismicMin)||(null==options?void 0:options.seismicRange)||dp.reduce((function(val,array){return Math.min.apply(Math,__spreadArray(__spreadArray([],array),[val]))}),0),max=(null==options?void 0:options.seismicMax)||(null==options?void 0:options.seismicRange)||dp.reduce((function(val,array){return Math.max.apply(Math,__spreadArray(__spreadArray([],array),[val]))}),0),absMax=Math.max(Math.abs(min),Math.abs(max)),domain={min:dmin=-absMax,max:dmax=absMax,difference:dmax-dmin},length=trajectory[0][0]-trajectory[trajectory.length-1][0],width=Math.abs(Math.floor(length/5)),height=data.yAxisValues.length,1e3,size=1e3,colorDomain=(colorMap=colormap).map((function(v,i){return i*size/colorMap.length})),colorScale=linear$1().domain(colorDomain).range(colorMap),colorTable=Array.from(new Array(size).keys()).map((function(i){var rgb=color(colorScale(i)).rgb();return[rgb.r,rgb.g,rgb.b]})),d=new Uint8ClampedArray(width*height*4),offset=0,colorFactor=999/domain.difference,pos=(null==options?void 0:options.isLeftToRight)?trajectory[0][0]:trajectory[trajectory.length-1][0],step=length/width*((null==options?void 0:options.isLeftToRight)?-1:1),black=[0,0,0],x=0;x<width;x++){for(offset=4*x,index=findIndexOfSample(trajectory,pos),x1=trajectory[index][0],x2=trajectory[index+1][0],ratio=(pos-x1)/(x2-x1),y=0;y<height;y++)val1=dp[y][index],val2=dp[y][index+1],null==val1||null==val2?(col=black,opacity=0):(i=clamp(~~(i=(val1*(1-ratio)+val2*ratio-domain.min)*colorFactor),0,999),col=colorTable[i],opacity=255),d.set([col[0],col[1],col[2],opacity],offset),offset+=4*width;pos+=step}return imageData=new ImageData(d,width,height),[4,createImageBitmap(imageData,0,0,width,height)];case 1:return[2,_a.sent()]}var colorMap,size,colorDomain,colorScale}))}))},exports.generateSurfaceData=function(trajectory,stratColumn,surfaceData){if(!(trajectory.length<0)){var filteredSurfaces=surfaceData.filter((function(s){return s.data.values})),mappedSurfaces=filteredSurfaces.map((function(s){var displayName=s.visualSettings.displayName;return{name:displayName.replace(/\s(Base|Top)/gi,""),isBase:displayName.toLowerCase().endsWith("base"),values:s.data.values,color:s.visualSettings.colors.crossSection,visualization:s.visualSettings.crossSection.toLowerCase()}})),stratGroups=new Map,stratigraphies=function(mappedSurfaces,stratColumn,stratGroups){var firstUnit=stratColumn&&stratColumn.find((function(d){return 1===d.stratUnitLevel})),defaultGroupName=firstUnit?firstUnit.identifier:"SEABED";return mappedSurfaces.filter((function(d){return"interval"===d.visualization||"none"===d.visualization})).map((function(s){var path=[],stratUnit=findStratcolumnUnit(stratColumn,s.name,path);stratUnit||console.warn("No match for "+s.name+" in strat column");var group=path[0]||stratUnit,groupName=group&&group.identifier||defaultGroupName;return group&&!stratGroups.has(groupName)&&stratGroups.set(groupName,{age:group.topAge,name:group.identifier}),__assign(__assign({},s),{unit:stratUnit,group:groupName})}))}(mappedSurfaces,stratColumn,stratGroups);stratigraphies.sort((function(a,b){if(!a.unit&&!b.unit)return 0;if(!a.unit)return-1;if(!b.unit)return 1;var aAge=a.isBase?a.unit.baseAge:a.unit.topAge,bAge=b.isBase?b.unit.baseAge:b.unit.topAge;return aAge!==bAge?aAge-bAge:a.isBase&&!b.isBase?1:!a.isBase&&b.isBase?-1:a.unit.stratUnitLevel-b.unit.stratUnitLevel}));var lines=function(mappedSurfaces,trajectory){return mappedSurfaces.filter((function(d){return"line"===d.visualization})).map((function(l){return{id:l.name,label:l.name,width:2,color:convertColor(l.color||"black"),data:trajectory.map((function(p,j){return[p[0],l.values[j]]}))}}))}(mappedSurfaces,trajectory),surfaceAreas=function(projection,surfaces,stratColumn){return surfaces.reduce((function(acc,surface,i){if(!surface.isBase){acc[surface.group]||(acc[surface.group]=[]);var baseIndex_1=function(top,index,surfaces,stratColumn){var nextIndex=index+1;if(!surfaces||nextIndex>=surfaces.length)return null;var baseSurfaceIndex=surfaces.findIndex((function(candidate){return candidate.isBase&&candidate.name===top.name}));if(-1!==baseSurfaceIndex)return baseSurfaceIndex;for(var i=nextIndex;i<surfaces.length;i++){var candidate=surfaces[i];if(!candidate.isBase)return i;if(isAnchestor(top,candidate,stratColumn))return i}return null}(surface,i,surfaces,stratColumn);acc[surface.group].push({id:surface.name,label:surface.name,color:surface.unit&&getColorFromUnit(surface.unit)||4294967295,exclude:"none"===surface.visualization||!surface.unit,data:projection.map((function(p,j){var baseValue=null!==surface.values[j]?function(index,surfaces,datapoint){if(!surfaces||!index||index>=surfaces.length)return null;for(var i=index;i<surfaces.length;i++)if(null!==surfaces[i].values[datapoint])return surfaces[i].values[datapoint];return null}(baseIndex_1,surfaces,j):null;return[p[0],surface.values[j],baseValue]}))})}return acc}),{})}(trajectory,stratigraphies,stratColumn);return{lines:lines,areas:__spreadArray(__spreadArray([],function(groups,trajectory){return groups.map((function(g,i){var next=i+1<groups.length?groups[i+1]:null;return{id:g.id,color:convertColor(g.color),data:trajectory.map((function(p,j){return[p[0],g.top[j],next?next.top[j]:null]}))}}))}(function(stratGroups,surfaceAreas){return Array.from(stratGroups.values()).sort((function(a,b){return a.age-b.age})).filter((function(g){var surfaces=surfaceAreas[g.name],isValid=surfaces&&surfaces.length>0;return isValid||console.warn("Intersection surface group '"+g.name+"' has no valid entries and will be discarded."),isValid})).map((function(g,i){var top=surfaceAreas[g.name][0];return{id:g.name,label:g.name,color:unassignedColorScale(i),top:top.data.map((function(d){return d[1]}))}}))}(stratGroups,surfaceAreas),trajectory)),Object.values(surfaceAreas).flat().filter((function(d){return!d.exclude})))}}},exports.getOverlap=function(r1,r2){var r1x2=r1.x+r1.width,r2x2=r2.x+r2.width,r1y2=r1.y+r1.height,r2y2=r2.y+r2.height;return r2.x>r1x2||r2.y>r1y2||r2x2<r1.x||r2y2<r1.y?null:{dx:Math.max(0,Math.min(r1.x+r1.width,r2.x+r2.width)-Math.max(r1.x,r2.x)),dy:Math.max(0,Math.min(r1.y+r1.height,r2.y+r2.height)-Math.max(r1.y,r2.y))}},exports.getOverlapOffset=getOverlapOffset,exports.getPicksData=function(picksData){var formationPicks,unitPicks=picksData.unitPicks,picks=__spreadArray(__spreadArray(__spreadArray([],function(picks){return picks?picks.map((function(p){return mapPick(p,"ref-picks")})):[]}(picksData.nonUnitPicks)),(formationPicks=unitPicks)?formationPicks.filter((function(d){return d.entryPick.md===d.from})).map((function(p){return mapPick(p.entryPick,"strat-picks")})):[]),function(formationPicks){return formationPicks?formationPicks.filter((function(d){return-1===formationPicks.findIndex((function(p){return Math.abs(p.entryPick.md-d.exitPick.md)<.5}))})).map((function(p){return mapPick(p.exitPick,"strat-picks")})).filter((function(obj,i,array){return i===array.findIndex((function(v){return v.title===obj.title&&v.md===obj.md}))})):[]}(unitPicks));return picks.sort((function(a,b){return a.md-b.md})),picks},exports.getSeismicInfo=function(data,trajectory){if(data&&data.datapoints){var minX=trajectory.reduce((function(acc,val){return Math.min(acc,val[0])}),0),maxX=trajectory.reduce((function(acc,val){return Math.max(acc,val[0])}),0),minTvdMsl=data.yAxisValues&&data.yAxisValues[0],maxTvdMsl=data.yAxisValues&&data.yAxisValues[data.yAxisValues.length-1],dp=data.datapoints||[],min=-dp.reduce((function(val,array){return Math.min.apply(Math,__spreadArray(__spreadArray([],array),[val]))}),0),max=dp.reduce((function(val,array){return Math.max.apply(Math,__spreadArray(__spreadArray([],array),[val]))}),0),absMax=Math.max(Math.abs(min),Math.abs(max)),dmin=-absMax;return{minX:minX,maxX:maxX,minTvdMsl:minTvdMsl,maxTvdMsl:maxTvdMsl,domain:{min:dmin,max:absMax,difference:absMax-dmin}}}},exports.isOverlapping=isOverlapping,exports.isOverlappingHorizontally=function(r1,r2){var r1x2=r1.x+r1.width,r2x2=r2.x+r2.width;return!(r2.x>r1x2||r2x2<r1.x)},exports.pixelsPerUnit=pixelsPerUnit,exports.transformFormationData=function(picks,stratColumn){for(var _a=function(picks,stratColumn){var transformed=function(units,res){void 0===res&&(res=[]);for(var i=0;i<units.length;i+=1){var unit={unitName:(u=units[i]).identifier,topSurface:u.top,baseSurface:u.base,ageBase:u.baseAge,ageTop:u.topAge,color:{r:null===u.colorR?255:u.colorR,g:null===u.colorG?255:u.colorG,b:null===u.colorB?255:u.colorB},level:u.stratUnitLevel,lithType:u.lithologyType,parent:u.stratUnitParent};res.push(unit)}var u;return res}(stratColumn),nonUnitPicks=[],joined=[];return picks.forEach((function(p){var matches=transformed.filter((function(u){return-1!==p.pickIdentifier.search(new RegExp("("+u.topSurface+"|"+u.baseSurface+")","i"))}));matches.length>0?matches.forEach((function(u){return joined.push(__assign({md:p.md,tvd:p.tvd,identifier:p.pickIdentifier,confidence:p.confidence,mdUnit:p.mdUnit,depthReferencePoint:p.depthReferencePoint},u))})):nonUnitPicks.push(p)})),{joined:joined,nonUnitPicks:nonUnitPicks}}(picks,stratColumn),joined=_a.joined,nonUnitPicks=_a.nonUnitPicks,itemstack=function(joined){for(var pairs=[],current=null,sorted=joined.filter((function(d){return d.level})).sort((function(a,b){return a.unitName.localeCompare(b.unitName)||a.md-b.md||a.ageTop-b.ageTop})),_loop_1=function(){var _a,pairWithName,top_1,base,name_1=(current=sorted.shift()).identifier,isTop=name_1===current.topSurface,isBase=name_1===current.baseSurface;if(isTop)pairWithName=current.baseSurface;else{if(!isBase)return console.warn("Unable to match "+name_1+" with top or base surface, ignored"),"continue";pairWithName=current.topSurface}var pairWith=sorted.find((function(p){return p.identifier===pairWithName}));if(pairWith)base=isTop?pairWith:current,(top_1=isTop?current:pairWith).md>base.md&&(top_1=(_a=[base,top_1])[0],base=_a[1]),sorted.splice(sorted.indexOf(pairWith),1);else if(console.warn("Unable to find "+pairWithName+" pick for "+name_1),isTop){if(top_1=current,!(base=joined.filter((function(d){return d.level})).sort((function(a,b){return a.md-b.md})).find((function(p){return p.md>top_1.md}))))return console.warn("Unable to find a base pick for "+name_1+" pick at "+top_1.md+", ignored"),"continue";console.warn("Using "+base.identifier+" as base for "+name_1)}else{if(!isBase)return console.warn(name_1+" ignored"),"continue";if(base=current,!(top_1=joined.filter((function(d){return d.level})).sort((function(a,b){return b.md-a.md})).find((function(p){return p.md<base.md}))))return console.warn("Unable to find a top pick for "+name_1+" pick at "+base.md+", ignored"),"continue";console.warn("Using "+top_1.identifier+" as top for "+name_1)}pairs.push({name:top_1.unitName,mdEntry:top_1.md,tvdEntry:top_1.tvd,color:top_1.color,level:top_1.level,entryPick:top_1,mdExit:base.md,tvdExit:base.tvd,exitPick:base,confidenceEntry:top_1.confidence,confidenceExit:base.confidence})};sorted.length>0;)_loop_1();return pairs}(joined).filter((function(d){return d.mdEntry<d.mdExit})).sort((function(a,b){return a.mdEntry-b.mdEntry||a.level-b.level})).reverse(),unitPicks=[],_loop_2=function(){for(var first=itemstack.pop(),group=[];itemstack.length>0&&itemstack[itemstack.length-1].level>first.level;)group.push(itemstack.pop());group.reverse(),group.push(first);var arr=[];group.forEach((function(itm){var gaps=function(from,to,arr){if(0===arr.length)return[[from,to]];for(var gaps=[],d=from,i=0;d<to&&i<arr.length;){var itm=arr[i];itm.from>d&&gaps.push([d,Math.min(itm.from,to)]),d=Math.min(to,Math.max(from,itm.to)),i+=1}return d<to&&gaps.push([d,to]),gaps}(itm.mdEntry,itm.mdExit,arr);arr.push.apply(arr,gaps.map((function(g){return{from:g[0],to:g[1],itm:itm}})))})),arr.sort((function(a,b){return a.from-b.from})),unitPicks.push.apply(unitPicks,arr.map((function(d){return __assign({from:d.from,to:d.to},d.itm)})))};itemstack.length>0;)_loop_2();return{unitPicks:unitPicks,nonUnitPicks:nonUnitPicks}},Object.defineProperty(exports,"__esModule",{value:!0})}));
|
|
399
|
+
var extendStatics$m=function(d,b){return(extendStatics$m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)},__assign$2=function(){return(__assign$2=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)};function reduce(v,func,r){void 0===r&&(r=0);for(var i=0;i<v.length;i++)r=func(r,v[i],i);return r}var EPS=Math.pow(2,-42);function cuberoot(x){var y=Math.pow(Math.abs(x),1/3);return x<0?-y:y}function getQuadRoots(a,b,c){if(Math.abs(a)<EPS)return Math.abs(b)<EPS?[]:[-c/b];var D=b*b-4*a*c;return Math.abs(D)<EPS?[-b/(2*a)]:D>0?[(-b+Math.sqrt(D))/(2*a),(-b-Math.sqrt(D))/(2*a)]:[]}function getCoefficients(v0,v1,v2,v3,v,tension){void 0===v&&(v=0),void 0===tension&&(tension=.5);var c=(1-tension)*(v2-v0)*.5,x=(1-tension)*(v3-v1)*.5;return[2*v1-2*v2+c+x,-3*v1+3*v2-2*c-x,c,v1-v]}function solveForT(t,tension,v0,v1,v2,v3){if(Math.abs(t)<EPS)return v1;if(Math.abs(1-t)<EPS)return v2;var t2=t*t,t3=t*t2,_a=getCoefficients(v0,v1,v2,v3,0,tension);return _a[0]*t3+_a[1]*t2+_a[2]*t+_a[3]}function getDerivativeOfT(t,tension,v0,v1,v2,v3){var t2=t*t,_a=getCoefficients(v0,v1,v2,v3,0,tension);return 3*_a[0]*t2+2*_a[1]*t+_a[2]}function distance(p1,p2){return Math.sqrt(reduce(p2,(function(s,c,i){return s+Math.pow(c-p1[i],2)})))}function normalize$2(v){var squared=reduce(v,(function(s,c){return s+Math.pow(c,2)})),l=Math.sqrt(squared);return 0===l?function(v,val){for(var i=0;i<v.length;i++)v[i]=val;return v}(v,0):function(v,func){for(var i=0;i<v.length;i++)v[i]=func(v[i],i);return v}(v,(function(c){return c/l}))}function getControlPoints(idx,points,closed){var p0,p1,p2,p3,maxIndex=points.length-1;return closed?(p0=points[idx-1<0?maxIndex:idx-1],p1=points[idx%points.length],p2=points[(idx+1)%points.length],p3=points[(idx+2)%points.length]):(p0=points[Math.max(0,idx-1)],p1=points[idx],p2=points[Math.min(maxIndex,idx+1)],p3=points[Math.min(maxIndex,idx+2)]),[p0,p1,p2,p3]}function getPointAtT(t,points,options,target){void 0===options&&(options={});var tension=Number.isFinite(options.tension)?options.tension:.5,closed=!!options.closed,func=options.func||solveForT,nPoints=closed?points.length:points.length-1,p=nPoints*t,idx=Math.floor(p),weight=p-idx,_a=getControlPoints(idx,points,closed),p0=_a[0],p1=_a[1],p2=_a[2],p3=_a[3];target=target||new Array(p0.length);for(var i=0;i<p0.length;i++)target[i]=func(weight,tension,p0[i],p1[i],p2[i],p3[i]);return 3===nPoints&&target[1],target}function getTangentAtT(t,points,options,target){void 0===options&&(options={});var tension=Number.isFinite(options.tension)?options.tension:.5,closed=!!options.closed;return 1===tension&&0===t?t+=EPS:1===tension&&1===t&&(t-=EPS),getPointAtT(t,points,{tension:tension,closed:closed,func:getDerivativeOfT},target)}function getArcLengths(points,divisions,options){void 0===options&&(options={});var current,lengths=[],last=getPointAtT(0,points,options),sum=0;divisions=divisions||300,lengths.push(0);for(var p=1;p<=divisions;p++)sum+=distance(current=getPointAtT(p/divisions,points,options),last),lengths.push(sum),last=current;return lengths}function getUtoTmapping(u,arcLengths){for(var comparison,il=arcLengths.length,targetArcLength=u*arcLengths[il-1],low=0,high=il-1,i=0;low<=high;)if((comparison=arcLengths[i=Math.floor(low+(high-low)/2)]-targetArcLength)<0)low=i+1;else{if(!(comparison>0)){high=i;break}high=i-1}if(arcLengths[i=high]===targetArcLength)return i/(il-1);var lengthBefore=arcLengths[i];return(i+(targetArcLength-lengthBefore)/(arcLengths[i+1]-lengthBefore))/(il-1)}function getTtoUmapping(t,arcLengths){if(0===t)return 0;if(1===t)return 1;var al=arcLengths.length-1,totalLength=arcLengths[al],tIdx=t*al,subIdx=Math.floor(tIdx),l1=arcLengths[subIdx];return tIdx===subIdx?l1/totalLength:(l1+(tIdx-subIdx)*(arcLengths[subIdx+1]-l1))/totalLength}function getTAtValue(lookup,tension,v0,v1,v2,v3){var _a=getCoefficients(v0,v1,v2,v3,lookup,tension),a=_a[0],b=_a[1],c=_a[2],d=_a[3];return 0===a&&0===b&&0===c&&0===d?[0]:function(a,b,c,d){if(Math.abs(a)<EPS)return getQuadRoots(b,c,d);var roots,p=(3*a*c-b*b)/(3*a*a),q=(2*b*b*b-9*a*b*c+27*a*a*d)/(27*a*a*a);if(Math.abs(p)<EPS)roots=[cuberoot(-q)];else if(Math.abs(q)<EPS)roots=[0].concat(p<0?[Math.sqrt(-p),-Math.sqrt(-p)]:[]);else{var D=q*q/4+p*p*p/27;if(Math.abs(D)<EPS)roots=[-1.5*q/p,3*q/p];else if(D>0)roots=[(u=cuberoot(-q/2-Math.sqrt(D)))-p/(3*u)];else{var u=2*Math.sqrt(-p/3),t=Math.acos(3*q/p/u)/3,k=2*Math.PI/3;roots=[u*Math.cos(t),u*Math.cos(t-k),u*Math.cos(t-2*k)]}}for(var i=0;i<roots.length;i++)roots[i]-=b/(3*a);return roots}(a,b,c,d).filter((function(t){return t>-EPS&&t<=1+EPS})).map((function(t){return function(value,min,max){return void 0===min&&(min=0),void 0===max&&(max=1),value<min?min:value>max?max:value}(t,0,1)}))}var CurveInterpolator=function(){function CurveInterpolator(points,options){void 0===options&&(options={}),options=__assign$2({tension:.5,arcDivisions:300,closed:!1},options),this._cache={},this._tension=options.tension,this._arcDivisions=options.arcDivisions,this._lmargin=options.lmargin||1-this._tension,this._closed=options.closed,this.points=points}return CurveInterpolator.prototype.getT=function(position){return getUtoTmapping(position,this.arcLengths)},CurveInterpolator.prototype.getPointAt=function(position,target){var options={tension:this.tension,closed:this.closed};return getPointAtT(this.getT(position),this.points,options,target)},CurveInterpolator.prototype.getTangentAt=function(position,target){return void 0===target&&(target=null),normalize$2(getTangentAtT(this.getT(position),this.points,{tension:this.tension,closed:this.closed},target))},CurveInterpolator.prototype.getBoundingBox=function(from,to){if(void 0===from&&(from=0),void 0===to&&(to=1),0===from&&1===to&&this._cache.bbox)return this._cache.bbox;var bbox=function(points,options){void 0===options&&(options={});for(var _a=__assign$2({tension:.5,closed:!1,from:0,to:1,arcLengths:null,arcDivisions:300},options),tension=_a.tension,closed=_a.closed,u0=_a.from,u1=_a.to,arcLengths=_a.arcLengths,arcDivisions=_a.arcDivisions,nPoints=closed?points.length:points.length-1,t0=getUtoTmapping(u0,arcLengths=arcLengths||getArcLengths(points,arcDivisions,{tension:tension,closed:closed})),t1=getUtoTmapping(u1,arcLengths),i0=Math.floor(nPoints*t0),i1=Math.ceil(nPoints*t1),start=getPointAtT(t0,points,{tension:tension,closed:closed}),end=getPointAtT(t1,points,{tension:tension,closed:closed}),min=[],max=[],c=0;c<start.length;c++)min[c]=Math.min(start[c],end[c]),max[c]=Math.max(start[c],end[c]);for(var _loop_1=function(i){var _a=getControlPoints(i-1,points,closed),p0=_a[0],p1=_a[1],p2=_a[2],p3=_a[3];if(i<i1)for(var c=0;c<p2.length;c++)p2[c]<min[c]&&(min[c]=p2[c]),p2[c]>max[c]&&(max[c]=p2[c]);if(tension<1){var w0_1=nPoints*t0-(i-1),w1_1=nPoints*t1-(i-1),valid=function(t){return t>-EPS&&t<=1+EPS&&(i-1!==i0||t>w0_1)&&(i!==i1||t<w1_1)},_loop_2=function(c){var _a=getCoefficients(p0[c],p1[c],p2[c],p3[c],0,tension);getQuadRoots(3*_a[0],2*_a[1],_a[2]).filter(valid).forEach((function(t){var v=solveForT(t,tension,p0[c],p1[c],p2[c],p3[c]);v<min[c]&&(min[c]=v),v>max[c]&&(max[c]=v)}))};for(c=0;c<p0.length;c++)_loop_2(c)}},i=i0+1;i<=i1;i++)_loop_1(i);return{min:min,max:max}}(this.points,{from:from,to:to,tension:this.tension,closed:this.closed,arcLengths:this.arcLengths});return 0===from&&1===to&&(this._cache.bbox=bbox),bbox},CurveInterpolator.prototype.getPoints=function(samples,returnType,from,to){if(void 0===samples&&(samples=100),void 0===from&&(from=0),void 0===to&&(to=1),!samples||samples<=0)throw Error("Invalid arguments passed to getPoints(). You must specify at least 1 sample/segment.");if(!(from<0||to>1||to<from)){for(var pts=[],d=0;d<=samples;d++){var u=0===from&&1===to?d/samples:from+d/samples*(to-from);pts.push(this.getPointAt(u,returnType&&new returnType))}return pts}},CurveInterpolator.prototype.lookup=function(v,axis,max,margin){void 0===axis&&(axis=0),void 0===max&&(max=0),void 0===margin&&(margin=this._lmargin);var matches=function(lookup,points,options){for(var _a=__assign$2({axis:0,tension:.5,closed:!1,margin:.5,max:0,processRefAxis:!1,func:solveForT},options),func=_a.func,axis=_a.axis,tension=_a.tension,closed=_a.closed,margin=_a.margin,max=_a.max,processRefAxis=_a.processRefAxis,k=axis,solutions=[],nPoints=closed?points.length:points.length-1,i=0;i<nPoints;i+=1){var idx=max<0?nPoints-(i+1):i,_b=getControlPoints(idx,points,closed),p0=_b[0],p1=_b[1],p2=_b[2],p3=_b[3],vmin=void 0,vmax=void 0;if(p1[k]<p2[k]?(vmin=p1[k],vmax=p2[k]):(vmin=p2[k],vmax=p1[k]),lookup-margin<=vmax&&lookup+margin>=vmin){var ts=getTAtValue(lookup,tension,p0[k],p1[k],p2[k],p3[k]);max<0?ts.sort((function(a,b){return b-a})):max>=0&&ts.sort((function(a,b){return a-b}));for(var j=0;j<ts.length;j++)if(!(0===ts[j]&&i>0)){for(var coord=[],c=0;c<p0.length;c++){var v;v=c!==k||processRefAxis?func(ts[j],tension,p0[c],p1[c],p2[c],p3[c],idx-1):lookup,coord[c]=v}if(solutions.push(coord),solutions.length===Math.abs(max))return solutions}}}return solutions}(v,this.points,{axis:axis,tension:this.tension,closed:this.closed,max:max,margin:margin});return 1===Math.abs(max)&&1===matches.length?matches[0]:matches},CurveInterpolator.prototype.lookupPositions=function(v,axis,max,margin){return void 0===axis&&(axis=0),void 0===max&&(max=0),void 0===margin&&(margin=this._lmargin),function(lookup,points,options){for(var _a=__assign$2({axis:0,tension:.5,closed:!1,margin:.5,max:0},options),axis=_a.axis,tension=_a.tension,closed=_a.closed,margin=_a.margin,max=_a.max,k=axis,solutions=new Set,arcLengths=options.arcLengths||getArcLengths(points,options.arcDivisions||300,{tension:tension,closed:closed}),nPoints=closed?points.length:points.length-1,i=0;i<nPoints;i+=1){var idx=max<0?points.length-i:i,_b=getControlPoints(idx,points,closed),p0=_b[0],p1=_b[1],p2=_b[2],p3=_b[3],vmin=void 0,vmax=void 0;if(p1[k]<p2[k]?(vmin=p1[k],vmax=p2[k]):(vmin=p2[k],vmax=p1[k]),lookup-margin<=vmax&&lookup+margin>=vmin){var ts=getTAtValue(lookup,tension,p0[k],p1[k],p2[k],p3[k]);max<0?ts.sort((function(a,b){return b-a})):max>=0&&ts.sort((function(a,b){return a-b}));for(var j=0;j<ts.length;j++)if(!(0===ts[j]&&i>0)){var u=getTtoUmapping((ts[j]+idx)/nPoints,arcLengths);if(solutions.add(u),solutions.size===Math.abs(max))return Array.from(solutions)}}}return Array.from(solutions)}(v,this.points,{axis:axis,arcLengths:this.arcLengths,tension:this.tension,closed:this.closed,max:max,margin:margin})},CurveInterpolator.prototype.invalidateCache=function(){var _this=this;return Object.keys(this._cache).forEach((function(key){delete _this._cache[key]})),this},Object.defineProperty(CurveInterpolator.prototype,"points",{get:function(){return this._points},set:function(pts){this._points=pts,this.invalidateCache()},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"tension",{get:function(){return this._tension},set:function(t){t!==this._tension&&(this._tension=t,this.invalidateCache())},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"closed",{get:function(){return this._closed},set:function(isClosed){isClosed!==this._closed&&(this._closed=isClosed,this.invalidateCache())},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"arcDivisions",{get:function(){return this._arcDivisions},set:function(n){n!==this._arcDivisions&&(this._arcDivisions=n,this.invalidateCache())},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"arcLengths",{get:function(){if(this._cache.arcLengths)return this._cache.arcLengths;var arcLengths=getArcLengths(this.points,this.arcDivisions,{tension:this.tension,closed:this.closed});return this._cache.arcLengths=arcLengths,arcLengths},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"length",{get:function(){var lengths=this.arcLengths;return lengths[lengths.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"minX",{get:function(){return this.getBoundingBox().min[0]},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"maxX",{get:function(){return this.getBoundingBox().max[0]},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"minY",{get:function(){return this.getBoundingBox().min[1]},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"maxY",{get:function(){return this.getBoundingBox().max[1]},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"minZ",{get:function(){return this.getBoundingBox().min[2]},enumerable:!0,configurable:!0}),Object.defineProperty(CurveInterpolator.prototype,"maxZ",{get:function(){return this.getBoundingBox().max[2]},enumerable:!0,configurable:!0}),CurveInterpolator}();!function(_super){function CurveInterpolator2D(points,tension,arcDivisions,closed){return void 0===tension&&(tension=.5),void 0===arcDivisions&&(arcDivisions=300),void 0===closed&&(closed=!1),_super.call(this,points,{tension:tension,arcDivisions:arcDivisions,closed:closed})||this}(function(d,b){function __(){this.constructor=d}extendStatics$m(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)})(CurveInterpolator2D,_super),CurveInterpolator2D.prototype.x=function(y,max,margin){void 0===max&&(max=0),void 0===margin&&(margin=this._lmargin);var res=this.lookup(y,1,max,margin);return 1===Math.abs(max)?res[0]:res.map((function(d){return d[0]}))},CurveInterpolator2D.prototype.y=function(x,max,margin){void 0===max&&(max=0),void 0===margin&&(margin=this._lmargin);var res=this.lookup(x,0,max,margin);return 1===Math.abs(max)?res[1]:res.map((function(d){return d[1]}))},CurveInterpolator2D.prototype.getNormalAt=function(position,target){return normalize$2(function(v){if(v.length>2)throw Error("Only supported for 2d vectors");var x=-v[1];return v[1]=v[0],v[0]=x,v}(getTangentAtT(this.getT(position),this.points,{tension:this.tension,closed:this.closed},target)))},CurveInterpolator2D.prototype.getAngleAt=function(position){var tan=getTangentAtT(this.getT(position),this.points,{tension:this.tension,closed:this.closed});return Math.atan2(tan[1],tan[0])},CurveInterpolator2D.prototype.getBoundingBox=function(from,to){void 0===from&&(from=0),void 0===to&&(to=1);var bbox=_super.prototype.getBoundingBox.call(this,from,to);return{x1:bbox.min[0],x2:bbox.max[0],y1:bbox.min[1],y2:bbox.max[1],min:bbox.min,max:bbox.max}}}(CurveInterpolator),function(){function Point(x,y,z,w){void 0===x&&(x=0),void 0===y&&(y=0),void 0===z&&(z=null),void 0===w&&(w=null),this.x=x,this.y=y,this.z=z,this.w=w}Object.defineProperty(Point.prototype,0,{get:function(){return this.x},set:function(x){this.x=x},enumerable:!0,configurable:!0}),Object.defineProperty(Point.prototype,1,{get:function(){return this.y},set:function(y){this.y=y},enumerable:!0,configurable:!0}),Object.defineProperty(Point.prototype,2,{get:function(){return this.z},set:function(z){this.z=z},enumerable:!0,configurable:!0}),Object.defineProperty(Point.prototype,3,{get:function(){return this.w},set:function(w){this.w=w},enumerable:!0,configurable:!0}),Object.defineProperty(Point.prototype,"length",{get:function(){return Number.isFinite(this.w)?4:Number.isFinite(this.z)?3:2},enumerable:!0,configurable:!0})}();function simplify(inputArr,maxOffset,maxDistance){var _a;if(void 0===maxOffset&&(maxOffset=.001),void 0===maxDistance&&(maxDistance=10),inputArr.length<=4)return inputArr;for(var _b=inputArr[0],o0=_b[0],o1=_b[1],arr=inputArr.map((function(d){return[d[0]-o0,d[1]-o1]})),_c=arr[0],a0=_c[0],a1=_c[1],sim=[inputArr[0]],i=1;i+1<arr.length;i++){var _d=arr[i],t0=_d[0],t1=_d[1],_e=arr[i+1],b0=_e[0],b1=_e[1];if(b0-t0!=0||b1-t1!=0){var proximity=Math.abs(a0*b1-a1*b0+b0*t1-b1*t0+a1*t0-a0*t1)/Math.sqrt(Math.pow(b0-a0,2)+Math.pow(b1-a1,2)),dir=[a0-t0,a1-t1],len=Math.sqrt(Math.pow(dir[0],2)+Math.pow(dir[1],2));(proximity>maxOffset||len>=maxDistance)&&(sim.push([t0+o0,t1+o1]),a0=(_a=[t0,t1])[0],a1=_a[1])}}var last=arr[arr.length-1];return sim.push([last[0]+o0,last[1]+o1]),sim}function projectCurtain(points,origin,offset){void 0===origin&&(origin=null),void 0===offset&&(offset=0);var p0=origin||points[0],l=0;return points.map((function(p1){var dx=p1[0]-p0[0],dy=p1[1]-p0[1];return l+=Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2)),p0=p1,[offset>0?offset-l:l,p1[2]||0]}))}function findIndexOfSample(data,pos){for(var a=0,b=data.length-1,aPos=data[a][0],bPos=data[b][0];b-a>20;){var splitAt=Math.floor((b+a)/2),splitPos=data[splitAt][0];if(pos>=aPos&&pos<splitPos)bPos=data[b=splitAt][0];else if(pos>=splitPos&&pos<=bPos)aPos=data[a=splitAt][0];else if(pos<=aPos&&pos>splitPos)bPos=data[b=splitAt][0];else{if(!(pos<=splitPos&&pos>=bPos))return-1;aPos=data[a=splitAt][0]}}for(var index=-1,i=a;i<b;i++){var v1=data[i][0],v2=data[i+1][0];if(Math.min(v1,v2)<=pos&&pos<=Math.max(v1,v2)){index=i;break}}return index}function findSampleAtPos(data,pos,topLimit,bottomLimit){void 0===topLimit&&(topLimit=null),void 0===bottomLimit&&(bottomLimit=null);var y=null,index=findIndexOfSample(data,pos);if(-1!==index){var v1=data[index][1],v2=data[index+1][1];if(v2&&v2){var x1=data[index][0],f=(pos-x1)/(data[index+1][0]-x1);y=v1*(1-f)+v2*f,topLimit&&topLimit>y&&(y=topLimit),bottomLimit&&bottomLimit<y&&(y=bottomLimit)}}return y}function mapPick(p,groupName){return{title:p.pickIdentifier||p.identifier,group:groupName,label:p.md+" "+p.mdUnit+" "+p.depthReferencePoint,color:"strat-picks"===groupName?"#227":"rgba(0,0,0,0.8)",md:p.md}}var GeomodelLabelsLayer=function(_super){function GeomodelLabelsLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.defaultMargins=18,_this.defaultMinFontSize=8,_this.defaultMaxFontSize=13,_this.defaultTextColor="black",_this.defaultFont="Arial",_this.isLabelsOnLeftSide=!0,_this.maxFontSizeInWorldCoordinates=70,_this.isXFlipped=!1,_this.areasWithAvgTopDepth=null,_this.drawAreaLabel=function(surfaceArea,nextSurfaceArea,surfaces,i){var data=surfaceArea.data,_a=_this,ctx=_a.ctx,maxFontSizeInWorldCoordinates=_a.maxFontSizeInWorldCoordinates,isXFlipped=_a.isXFlipped,_b=_this.rescaleEvent,xScale=_b.xScale,yScale=_b.yScale,xRatio=_b.xRatio,yRatio=_b.yRatio,zFactor=_b.zFactor,isLabelsOnLeftSide=_this.checkDrawLabelsOnLeftSide(),marginsInWorldCoords=(_this.options.margins||_this.defaultMargins)*(isXFlipped?-1:1)/xRatio,minFontSize=_this.options.minFontSize||_this.defaultMinFontSize,fontSizeInWorldCoords=(_this.options.maxFontSize||_this.defaultMaxFontSize)/yRatio;fontSizeInWorldCoords>maxFontSizeInWorldCoordinates&&(fontSizeInWorldCoords=maxFontSizeInWorldCoordinates)*yRatio<minFontSize&&(fontSizeInWorldCoords=minFontSize/yRatio);var leftEdge=xScale.invert(xScale.range()[0])+marginsInWorldCoords,rightEdge=xScale.invert(xScale.range()[1])-marginsInWorldCoords,_c=_this.getSurfacesAreaEdges(),surfaceAreaLeftEdge=_c[0],surfaceAreaRightEdge=_c[1];ctx.save(),ctx.font=fontSizeInWorldCoords*yRatio+"px "+(_this.options.font||_this.defaultFont);var startPos,labelMetrics=ctx.measureText(surfaceArea.label),labelLengthInWorldCoords=labelMetrics.width/xRatio;if(isLabelsOnLeftSide){var labelRightEdge=leftEdge+(isXFlipped?-labelLengthInWorldCoords:labelLengthInWorldCoords);(!isXFlipped&&labelRightEdge>surfaceAreaRightEdge||isXFlipped&&labelRightEdge<surfaceAreaRightEdge)&&(isLabelsOnLeftSide=!1)}else{var labelLeftEdge=rightEdge+(isXFlipped?labelLengthInWorldCoords:-labelLengthInWorldCoords);(!isXFlipped&&labelLeftEdge<surfaceAreaLeftEdge||isXFlipped&&labelLeftEdge>surfaceAreaLeftEdge)&&(isLabelsOnLeftSide=!0)}startPos=isLabelsOnLeftSide?isXFlipped?Math.min(surfaceAreaLeftEdge,leftEdge):Math.max(surfaceAreaLeftEdge,leftEdge):isXFlipped?Math.max(surfaceAreaRightEdge,rightEdge):Math.min(surfaceAreaRightEdge,rightEdge);var topEdge=yScale.invert(yScale.range()[0]),bottomEdge=yScale.invert(yScale.range()[1]),posStep=labelLengthInWorldCoords/3*.07*(isLabelsOnLeftSide?1:-1)*(isXFlipped?-1:1),dirStep=labelLengthInWorldCoords/5*(isLabelsOnLeftSide?1:-1)*(isXFlipped?-1:1),topData=data.map((function(d){return[d[0],d[1]]})),topPos=_this.calcPos(topData,startPos,3,posStep,topEdge,bottomEdge);if(topPos){var bottomData=data.map((function(d){return[d[0],d[2]]})),bottomPos=_this.calcPos(bottomData,startPos,3,posStep,topEdge,bottomEdge,nextSurfaceArea?nextSurfaceArea.data.map((function(d){return[d[0],d[1]]})):null,surfaces,i);bottomPos||(bottomPos=new Vector2(topPos.x,bottomEdge));var thickness=bottomPos.y-topPos.y;if(thickness<fontSizeInWorldCoords){if(thickness*yRatio<minFontSize)return;fontSizeInWorldCoords=thickness,ctx.font=fontSizeInWorldCoords*yRatio+"px "+(_this.options.font||_this.defaultFont),labelLengthInWorldCoords=(labelMetrics=ctx.measureText(surfaceArea.label)).width/xRatio}var initialDirVec=isLabelsOnLeftSide!==isXFlipped?Vector2.right:Vector2.left,areaDir=_this.calcAreaDir(topData,bottomData,startPos,5,dirStep,initialDirVec,topEdge,bottomEdge,0,Math.PI/4,4,nextSurfaceArea?nextSurfaceArea.data.map((function(d){return[d[0],d[1]]})):null,surfaces,i),scaledAngle=Math.atan(Math.tan(areaDir)*zFactor),textX=startPos,textY=(topPos.y+bottomPos.y)/2,textAngle=isXFlipped?-scaledAngle:scaledAngle;ctx.textAlign=isLabelsOnLeftSide?"left":"right",ctx.translate(xScale(textX),yScale(textY)),ctx.rotate(textAngle),ctx.fillStyle=_this.options.textColor||_this.defaultTextColor,ctx.font=fontSizeInWorldCoords*yRatio+"px "+(_this.options.font||_this.defaultFont),ctx.textBaseline="middle",ctx.fillText(surfaceArea.label,0,0),ctx.restore()}},_this.drawLineLabel=function(s){var _a=_this,ctx=_a.ctx,isXFlipped=_a.isXFlipped,_b=_this.rescaleEvent,xScale=_b.xScale,yScale=_b.yScale,xRatio=_b.xRatio,yRatio=_b.yRatio,zFactor=_b.zFactor,isLabelsOnLeftSide=_this.checkDrawLabelsOnLeftSide(),marginsInWorldCoords=_this.getMarginsInWorldCoordinates(),fontSizeInWorldCoords=(_this.options.maxFontSize||_this.defaultMaxFontSize)/yRatio;ctx.save(),ctx.font=fontSizeInWorldCoords*yRatio+"px "+(_this.options.font||_this.defaultFont);var startPos,labelLengthInWorldCoords=ctx.measureText(s.label).width/xRatio,leftEdge=xScale.invert(xScale.range()[0])+marginsInWorldCoords,rightEdge=xScale.invert(xScale.range()[1])-marginsInWorldCoords,_c=_this.getSurfacesAreaEdges(),surfaceAreaLeftEdge=_c[0],surfaceAreaRightEdge=_c[1];startPos=isLabelsOnLeftSide?isXFlipped?Math.max(surfaceAreaRightEdge,rightEdge):Math.min(surfaceAreaRightEdge,rightEdge):isXFlipped?Math.min(surfaceAreaLeftEdge,leftEdge):Math.max(surfaceAreaLeftEdge,leftEdge);var step=labelLengthInWorldCoords/5*(isLabelsOnLeftSide?-1:1),data=s.data,pos=_this.calcPos(data,startPos,5,step),dir=_this.calcLineDir(data,startPos,5,step,zFactor,isLabelsOnLeftSide?Vector2.left:Vector2.right);if(pos&&dir){var textX=startPos,textY=pos.y-1-fontSizeInWorldCoords/2,textDir=Vector2.angleRight(dir)-(isLabelsOnLeftSide?Math.PI:0);ctx.textAlign=isLabelsOnLeftSide?"right":"left",ctx.translate(xScale(textX),yScale(textY)),ctx.rotate(textDir),ctx.fillStyle=_this.colorToCSSColor(s.color),ctx.textBaseline="middle",ctx.fillText(s.label,0,0),ctx.restore()}},_this.render=_this.render.bind(_this),_this.getMarginsInWorldCoordinates=_this.getMarginsInWorldCoordinates.bind(_this),_this.getSurfacesAreaEdges=_this.getSurfacesAreaEdges.bind(_this),_this.updateXFlipped=_this.updateXFlipped.bind(_this),_this.generateSurfacesWithAvgDepth=_this.generateSurfacesWithAvgDepth.bind(_this),_this}return __extends(GeomodelLabelsLayer,_super),Object.defineProperty(GeomodelLabelsLayer.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),GeomodelLabelsLayer.prototype.setData=function(data){_super.prototype.setData.call(this,data),this.areasWithAvgTopDepth=null},GeomodelLabelsLayer.prototype.generateSurfacesWithAvgDepth=function(){var areas=this.data.areas;this.areasWithAvgTopDepth=areas.reduce((function(acc,area){if(!area.label)return acc;var sumAndCount=area.data.reduce((function(a,d){return null!=d[1]&&(a.sum+=d[1],a.count++),a}),{sum:0,count:0});if(0===sumAndCount.count)return acc;var avgTopDepth=sumAndCount.sum/sumAndCount.count;return acc.push(__assign(__assign({},area),{avgTopDepth:avgTopDepth})),acc}),[])},GeomodelLabelsLayer.prototype.onMount=function(event){_super.prototype.onMount.call(this,event)},GeomodelLabelsLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.render()},GeomodelLabelsLayer.prototype.onRescale=function(event){this.rescaleEvent=event,this.updateXFlipped(),this.resetTransform(),this.render()},GeomodelLabelsLayer.prototype.render=function(){var _this=this;this.rescaleEvent&&requestAnimationFrame((function(){_this.clearCanvas(),_this.data&&(_this.areasWithAvgTopDepth||_this.generateSurfacesWithAvgDepth(),_this.drawAreaLabels(),_this.drawLineLabels())}))},GeomodelLabelsLayer.prototype.drawAreaLabels=function(){var _this=this;this.areasWithAvgTopDepth.forEach((function(s,i,array){var topmostSurfaceNotDrawnYet=array.reduce((function(acc,v,index){return index>i&&(null==acc||v.avgTopDepth<acc.avgTopDepth)&&(acc=v),acc}),null);_this.drawAreaLabel(s,topmostSurfaceNotDrawnYet,array,i)}))},GeomodelLabelsLayer.prototype.drawLineLabels=function(){var _this=this;this.data.lines.filter((function(surfaceLine){return surfaceLine.label})).forEach((function(surfaceLine){return _this.drawLineLabel(surfaceLine)}))},GeomodelLabelsLayer.prototype.colorToCSSColor=function(color){if("string"==typeof color)return color;var hexString=color.toString(16);return"#"+(hexString="000000".substr(0,6-hexString.length)+hexString)},GeomodelLabelsLayer.prototype.calcPos=function(data,offset,count,step,topLimit,bottomLimit,alternativeSurfaceData,surfaces,currentSurfaceIndex){void 0===topLimit&&(topLimit=null),void 0===bottomLimit&&(bottomLimit=null),void 0===alternativeSurfaceData&&(alternativeSurfaceData=null),void 0===surfaces&&(surfaces=null),void 0===currentSurfaceIndex&&(currentSurfaceIndex=null);for(var pos=Vector2.zero.mutable,samples=0,i=0;i<count;i++){var x=offset+i*step,y=findSampleAtPos(data,x,topLimit,bottomLimit);if(y){var alternativeY=this.getAlternativeYValueIfAvailable(x,topLimit,bottomLimit,alternativeSurfaceData,surfaces,currentSurfaceIndex),usedY=alternativeY?Math.min(y,alternativeY):y;pos.add(x,usedY),samples++}}return 0===samples?null:Vector2.divide(pos,samples)},GeomodelLabelsLayer.prototype.getAlternativeYValueIfAvailable=function(x,topLimit,bottomLimit,alternativeSurfaceData,surfaces,currentSurfaceIndex){if(!alternativeSurfaceData)return null;var altY=findSampleAtPos(alternativeSurfaceData,x,topLimit,bottomLimit);if(null==altY&&surfaces&&null!=currentSurfaceIndex)for(var si=currentSurfaceIndex+1;null==altY&&si<surfaces.length;){altY=findSampleAtPos(surfaces[si++].data.map((function(d){return[d[0],d[1]]})),x,topLimit,bottomLimit)}return altY},GeomodelLabelsLayer.prototype.calcLineDir=function(data,offset,count,step,zFactor,initalVector,topLimit,bottomLimit){void 0===initalVector&&(initalVector=Vector2.left),void 0===topLimit&&(topLimit=null),void 0===bottomLimit&&(bottomLimit=null);var dir=initalVector.mutable,startY=findSampleAtPos(data,offset,topLimit,bottomLimit);if(null===startY)return dir;for(var vecAtEnd=new Vector2(offset,startY*zFactor),tmpVec=Vector2.zero.mutable,i=1;i<=count;i++){var x=offset+i*step,y=findSampleAtPos(data,offset,topLimit,bottomLimit);null!==y&&(tmpVec.set(x,y*zFactor),tmpVec.sub(vecAtEnd),dir.add(tmpVec))}return dir},GeomodelLabelsLayer.prototype.calcAreaDir=function(top,bottom,offset,count,step,initalVector,topLimit,bottomLimit,minReductionAngle,maxReductionAngle,angleReductionExponent,alternativeSurfaceBottomData,surfaces,currentSurfaceIndex){void 0===initalVector&&(initalVector=Vector2.left),void 0===topLimit&&(topLimit=null),void 0===bottomLimit&&(bottomLimit=null),void 0===minReductionAngle&&(minReductionAngle=0),void 0===maxReductionAngle&&(maxReductionAngle=Math.PI/4),void 0===angleReductionExponent&&(angleReductionExponent=4),void 0===alternativeSurfaceBottomData&&(alternativeSurfaceBottomData=null),void 0===surfaces&&(surfaces=null),void 0===currentSurfaceIndex&&(currentSurfaceIndex=null);for(var vecAtEnd,angles=[],tmpVec=Vector2.zero.mutable,i=0;i<=count;i++){var x=offset+i*step,topY=findSampleAtPos(top,x,topLimit,bottomLimit),bottomY=findSampleAtPos(bottom,x,topLimit,bottomLimit)||bottomLimit,alternativeBottomY=this.getAlternativeYValueIfAvailable(x,topLimit,bottomLimit,alternativeSurfaceBottomData,surfaces,currentSurfaceIndex),usedBottomY=alternativeBottomY?Math.min(bottomY,alternativeBottomY):bottomY;if(0===i){if(null===topY)return Vector2.angleRight(initalVector);vecAtEnd=new Vector2(offset,(topY+usedBottomY)/2)}else null!==topY?(tmpVec.set(x,(topY+usedBottomY)/2),tmpVec.sub(vecAtEnd),angles.push(Vector2.angleRight(tmpVec))):angles.push(Vector2.angleRight(initalVector))}var refAngle=angles[0],offsetAngles=angles.map((function(d){return d-refAngle})),factors=0;return offsetAngles.reduce((function(acc,v){var ratio=(Math.abs(v)-minReductionAngle)/maxReductionAngle,factor=Math.pow(1-clamp(ratio,0,1),angleReductionExponent);return factors+=factor,acc+v*factor}),0)/factors+refAngle},GeomodelLabelsLayer.prototype.updateXFlipped=function(){var xBounds=this.rescaleEvent.xBounds;this.isXFlipped=xBounds[0]>xBounds[1]},GeomodelLabelsLayer.prototype.getMarginsInWorldCoordinates=function(){var xRatio=this.rescaleEvent.xRatio;return(this.options.margins||this.defaultMargins)*(this.isXFlipped?-1:1)/xRatio},GeomodelLabelsLayer.prototype.getSurfacesAreaEdges=function(){var data=this.data.areas[0].data,maxX=Math.max(data[data.length-1][0],data[0][0]),minX=Math.min(data[0][0],data[data.length-1][0]),marginsInWorldCoords=this.getMarginsInWorldCoordinates(),isXFlipped=this.isXFlipped;return[isXFlipped?maxX+marginsInWorldCoords:minX+marginsInWorldCoords,isXFlipped?minX-marginsInWorldCoords:maxX-marginsInWorldCoords]},GeomodelLabelsLayer.prototype.checkDrawLabelsOnLeftSide=function(){var referenceSystem=this.referenceSystem,isXFlipped=this.isXFlipped;if(!referenceSystem)return!0;var _b=this.rescaleEvent,xScale=_b.xScale,yScale=_b.yScale,xRatio=_b.xRatio,_c=xScale.domain(),dx1=_c[0],dx2=_c[1],_d=yScale.domain(),dy1=_d[0],dy2=_d[1],top=referenceSystem.interpolators.curtain.lookup(dy1,1,0);0===top.length&&(top=[referenceSystem.interpolators.curtain.getPointAt(0)]);var bottom=referenceSystem.interpolators.curtain.lookup(dy2,1,0);0===bottom.length&&(bottom=[referenceSystem.interpolators.curtain.getPointAt(1)]);var maxX=Math.max(top[0][0],bottom[0][0]),minX=Math.min(top[0][0],bottom[0][0]),wbBBox_left=isXFlipped?maxX:minX,wbBBox_right=isXFlipped?minX:maxX,margin=this.getMarginsInWorldCoordinates(),screenLeftEdge=dx1+margin,screenRightEdge=dx2-margin,_e=this.getSurfacesAreaEdges(),surfaceAreaLeftEdge=_e[0],surfaceAreaRightEdge=_e[1],leftLimit=isXFlipped?Math.min(screenLeftEdge,surfaceAreaLeftEdge):Math.max(screenLeftEdge,surfaceAreaLeftEdge),rightLimit=isXFlipped?Math.max(screenRightEdge,surfaceAreaRightEdge):Math.min(screenRightEdge,surfaceAreaRightEdge),spaceOnLeftSide=Math.max(isXFlipped?leftLimit-wbBBox_left:wbBBox_left-leftLimit,0),spaceOnRightSide=Math.max(isXFlipped?wbBBox_right-rightLimit:rightLimit-wbBBox_right,0),spaceOnLeftSideInScreenCoordinates=spaceOnLeftSide*xRatio;return spaceOnLeftSide>spaceOnRightSide||spaceOnLeftSideInScreenCoordinates>200||spaceOnLeftSideInScreenCoordinates<200&&spaceOnRightSide*xRatio<200&&isXFlipped||bottom[1]<dy1},GeomodelLabelsLayer}(CanvasLayer);function pixelsPerUnit(x){var min=x.domain()[0];return Math.abs(x(min+1))}function calcSize(factor,min,max,x){return clamp(pixelsPerUnit(x)*factor,min,max)}function isOverlapping(r1,r2,horizontalPadding,verticalPadding){void 0===horizontalPadding&&(horizontalPadding=4),void 0===verticalPadding&&(verticalPadding=2);var r1x2=r1.x+r1.width+horizontalPadding,r2x2=r2.x+r2.width+horizontalPadding,r1y2=r1.y+r1.height+verticalPadding,r2y2=r2.y+r2.height+verticalPadding;return!(r2.x-horizontalPadding>r1x2||r2.y-verticalPadding>r1y2||r2x2+horizontalPadding<r1.x||r2y2+verticalPadding<r1.y)}function getOverlapOffset(r1,r2,horizontalPadding,verticalPadding){void 0===horizontalPadding&&(horizontalPadding=4),void 0===verticalPadding&&(verticalPadding=2);var r1x2=r1.x+r1.width,r2x2=r2.x+r2.width,r1y2=r1.y+r1.height,r2y2=r2.y+r2.height;return r2.x-horizontalPadding>r1x2||r2.y-verticalPadding>r1y2||r2x2+horizontalPadding<r1.x||r2y2+verticalPadding<r1.y?null:{dx:r1.x+r1.width-r2.x+horizontalPadding,dy:r1.y+r1.height-r2.y+verticalPadding}}var Location_topleft="topleft",Location_topright="topright",Location_bottomleft="bottomleft",Location_bottomright="bottomright",CalloutCanvasLayer=function(_super){function CalloutCanvasLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.groupFilter=null,_this.renderAnnotation=function(title,label,x,y,fontSize,color){_this.renderText(title,x,y-fontSize,fontSize,color,"arial","bold"),_this.renderText(label,x,y,fontSize,color)},_this.renderLine=function(x,y,width,dotX,dotY,color,placeLeft){void 0===placeLeft&&(placeLeft=!0);var ctx=_this.ctx,textX=placeLeft?x:x+width,inverseTextX=placeLeft?x+width:x,textY=y+2;ctx.strokeStyle=color,ctx.lineWidth=1,ctx.beginPath(),ctx.moveTo(dotX,dotY),ctx.lineTo(textX,textY),ctx.lineTo(inverseTextX,textY),ctx.stroke()},_this.minFontSize=options.minFontSize||7,_this.maxFontSize=options.maxFontSize||11,_this.fontSizeFactor=options.fontSizeFactor||7,_this.offsetMin=options.offsetMin||20,_this.offsetMax=options.offsetMax||120,_this.offsetFactor=options.offsetFactor||19,_this}return __extends(CalloutCanvasLayer,_super),CalloutCanvasLayer.prototype.setGroupFilter=function(filter){this.groupFilter=filter,this.callouts=void 0,this.render()},CalloutCanvasLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.callouts=void 0,this.render()},CalloutCanvasLayer.prototype.onRescale=function(event){_super.prototype.onRescale.call(this,event);var isPanning=this.rescaleEvent&&this.rescaleEvent.xRatio===event.xRatio;this.rescaleEvent=event,this.render(isPanning)},CalloutCanvasLayer.prototype.render=function(isPanning){var _this=this;void 0===isPanning&&(isPanning=!1),requestAnimationFrame((function(){if(_this.clearCanvas(),_this.data&&_this.rescaleEvent&&_this.referenceSystem){var _a=_this.rescaleEvent,xScale=_a.xScale,yScale=_a.yScale,xBounds=_a.xBounds,fontSize=calcSize(_this.fontSizeFactor,_this.minFontSize,_this.maxFontSize,xScale);if(!isPanning||!_this.callouts){var _b=_this,data=_b.data,ctx=_b.ctx,groupFilter_1=_b.groupFilter,isLeftToRight=_this.referenceSystem.options.calculateDisplacementFromBottom?xBounds[0]<xBounds[1]:xBounds[0]>xBounds[1];ctx.font="bold "+fontSize+"px arial";var filtered=data.filter((function(d){return!groupFilter_1||groupFilter_1.includes(d.group)})),offset=calcSize(_this.offsetFactor,_this.offsetMin,_this.offsetMax,xScale);_this.callouts=_this.positionCallouts(filtered,isLeftToRight,xScale,yScale,0,fontSize,offset)}_this.callouts.forEach((function(callout){var pos=callout.pos,title=callout.title,color=callout.color,calloutBB={x:xScale(pos.x),y:yScale(pos.y),width:callout.boundingBox.width,height:fontSize,offsetX:callout.dx,offsetY:callout.dy};_this.renderCallout(title,callout.label,calloutBB,color,callout.alignment)}))}}))},CalloutCanvasLayer.prototype.renderText=function(title,x,y,fontSize,color,font,fontStyle){void 0===font&&(font="arial"),void 0===fontStyle&&(fontStyle="normal");var ctx=this.ctx;ctx.font=fontStyle+" "+fontSize+"px "+font,ctx.fillStyle=color,ctx.fillText(title,x,y)},CalloutCanvasLayer.prototype.renderPoint=function(x,y,radius){void 0===radius&&(radius=3);var ctx=this.ctx;ctx.beginPath(),ctx.moveTo(x,y),ctx.arc(x,y,radius,0,2*Math.PI),ctx.fill()},CalloutCanvasLayer.prototype.renderCallout=function(title,label,boundingBox,color,location){var pos=this.getPosition(boundingBox,location),x=pos.x,y=pos.y,height=boundingBox.height,width=boundingBox.width,dotX=boundingBox.x,dotY=boundingBox.y,placeLeft=location===Location_topright||location===Location_bottomright;this.renderAnnotation(title,label,x,y,height,color),this.renderPoint(dotX,dotY),this.renderLine(x,y,width,dotX,dotY,color,placeLeft)},CalloutCanvasLayer.prototype.getPosition=function(boundingBox,location){var x=boundingBox.x,y=boundingBox.y,offsetX=boundingBox.offsetX,offsetY=boundingBox.offsetY,width=boundingBox.width;switch(location){case Location_topleft:return{x:x-width-offsetX,y:y-offsetY};case Location_topright:return{x:x+offsetX,y:y-offsetY};case Location_bottomleft:return{x:x-width-offsetX,y:y+offsetY};case Location_bottomright:return{x:x+offsetX,y:y+offsetY};default:return{x:x,y:y}}},CalloutCanvasLayer.prototype.positionCallouts=function(annotations,isLeftToRight,xScale,yScale,scale,fontSize,offset){var _this=this;if(void 0===offset&&(offset=20),0===annotations.length)return[];var alignment=isLeftToRight?Location_topleft:Location_topright,nodes=annotations.map((function(a){var pos=a.pos?a.pos:_this.referenceSystem.project(a.md);return{title:a.title,label:a.label,color:a.color,pos:{x:pos[0],y:pos[1]},group:a.group,alignment:alignment,boundingBox:_this.getAnnotationBoundingBox(a.title,a.label,pos,xScale,yScale,fontSize),dx:offset,dy:offset}})),top=[nodes[nodes.length-1]],bottom=[];return this.chooseTopOrBottomPosition(nodes,bottom,top),this.adjustTopPositions(top),this.adjustBottomPositions(bottom),nodes},CalloutCanvasLayer.prototype.getAnnotationBoundingBox=function(title,label,pos,xScale,yScale,height){var ctx=this.ctx,ax1=xScale(pos[0]),ay1=yScale(pos[1]),labelWidth=ctx.measureText(label).width,titleWidth=ctx.measureText(title).width;return{x:ax1,y:ay1,width:Math.max(labelWidth,titleWidth),height:2*height+4}},CalloutCanvasLayer.prototype.chooseTopOrBottomPosition=function(nodes,bottom,top){for(var i=nodes.length-2;i>=0;--i){var node=nodes[i],prevNode=top[0];isOverlapping(node.boundingBox,prevNode.boundingBox)?(node.alignment=node.alignment===Location_topleft?Location_bottomright:Location_bottomleft,bottom.push(node),i>0&&top.unshift(nodes[--i])):top.unshift(node)}},CalloutCanvasLayer.prototype.adjustTopPositions=function(top){for(var i=top.length-2;i>=0;--i)for(var currentNode=top[i],j=top.length-1;j>i;--j){var prevNode=top[j],overlap=getOverlapOffset(currentNode.boundingBox,prevNode.boundingBox);overlap&&(currentNode.dy+=overlap.dy,currentNode.boundingBox.y-=overlap.dy)}},CalloutCanvasLayer.prototype.adjustBottomPositions=function(bottom){for(var i=bottom.length-2;i>=0;--i)for(var currentNode=bottom[i],j=bottom.length-1;j>i;--j){var overlap=getOverlapOffset(bottom[j].boundingBox,currentNode.boundingBox);overlap&&(currentNode.dy+=overlap.dy,currentNode.boundingBox.y+=overlap.dy)}},CalloutCanvasLayer}(CanvasLayer),ImageLayer=function(_super){function ImageLayer(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(ImageLayer,_super),ImageLayer.prototype.onMount=function(event){_super.prototype.onMount.call(this,event);var img=document.createElement("img");this.img=img,this.isLoading=!0},ImageLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.img.src=event.url,this.render(event)},ImageLayer.prototype.onRescale=function(event){_super.prototype.onRescale.call(this,event),this.setTransform(event),this.render(event)},ImageLayer.prototype.render=function(event){var _this=this,width=parseInt(this.elm.getAttribute("width"),10),height=parseInt(this.elm.getAttribute("height"),10),xScale=event.xScale,yScale=event.yScale,xRatio=event.xRatio,yRatio=event.yRatio,x=event.x,y=event.y,calcWidth=width*(xRatio||1),calcHeight=height*(yRatio||1);this.clearCanvas(),this.isLoading?this.img.onload=function(){_this.isLoading=!1,_this.ctx.drawImage(_this.img,xScale(x||0),yScale(y||0),calcWidth,calcHeight)}:this.ctx.drawImage(this.img,xScale(x||0),yScale(y||0),calcWidth,calcHeight)},ImageLayer}(CanvasLayer),WellboreBaseComponentLayer=function(_super){function WellboreBaseComponentLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.getMdPoint=function(md){return{point:_this.referenceSystem.project(md),md:md}},_this.getPathForPoints=function(start,end,interestPoints){var pathPoints=_this.referenceSystem.getCurtainPath(start,end),uniqueInterestPoints=interestPoints.filter((function(ip){return!pathPoints.some((function(p){return p.md===ip}))})),interestMdPoints=uniqueInterestPoints.map(_this.getMdPoint),points=__spreadArray(__spreadArray([],pathPoints),interestMdPoints);return points.sort((function(a,b){return a.md-b.md})),points},_this.getZFactorScaledPathForPoints=function(start,end,interestPoints){var y=function(y){return y*_this.rescaleEvent.zFactor};return _this.getPathForPoints(start,end,interestPoints).map((function(p){return{point:[p.point[0],y(p.point[1])],md:p.md}}))},_this.drawBigPolygon=function(coords,color){void 0===color&&(color=0);var polygon=new Graphics;return polygon.beginFill(color),polygon.drawPolygon(coords),polygon.endFill(),_this.ctx.stage.addChild(polygon),polygon},_this.drawBigTexturedPolygon=function(coords,t){var polygon=new Graphics;return polygon.beginTextureFill({texture:t}),polygon.drawPolygon(coords),polygon.endFill(),_this.ctx.stage.addChild(polygon),polygon},_this.options=__assign(__assign(__assign({},_this.options),{exaggerationFactor:2}),options),_this.render=_this.render.bind(_this),_this}return __extends(WellboreBaseComponentLayer,_super),WellboreBaseComponentLayer.prototype.onUnmount=function(event){_super.prototype.onUnmount.call(this,event),this._textureCache=null,this.rescaleEvent=null},WellboreBaseComponentLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.clearStage(),this.preRender(),this.render()},WellboreBaseComponentLayer.prototype.onRescale=function(event){var _a,shouldRecalculate=(null===(_a=this.rescaleEvent)||void 0===_a?void 0:_a.zFactor)!==event.zFactor;if(this.rescaleEvent=event,_super.prototype.optionsRescale.call(this,event),this.ctx){var yRatio=this.yRatio(),flippedX=event.xBounds[0]>event.xBounds[1],flippedY=event.yBounds[0]>event.yBounds[1];this.ctx.stage.position.set(event.xScale(0),event.yScale(0)),this.ctx.stage.scale.set(event.xRatio*(flippedX?-1:1),yRatio*(flippedY?-1:1)),shouldRecalculate&&(this.clearStage(),this.preRender()),this.render()}},WellboreBaseComponentLayer.prototype.clearStage=function(){this.ctx.stage.removeChildren().forEach((function(child){child.destroy()}))},WellboreBaseComponentLayer.prototype.yRatio=function(){var domain=this.rescaleEvent.yScale.domain(),baseYSpan=(domain[1]-domain[0])*this.rescaleEvent.zFactor,baseDomain=[domain[0],domain[0]+baseYSpan];return Math.abs(this.rescaleEvent.height/(baseDomain[1]-baseDomain[0]))},WellboreBaseComponentLayer.prototype.drawRopeWithMask=function(path,maskPolygon,texture){if(0===maskPolygon.length||0===path.length)return null;var rope=new SimpleRope(texture,path,1),mask=new Graphics;mask.beginFill(0),mask.drawPolygon(maskPolygon),mask.endFill(),this.ctx.stage.addChild(mask),rope.mask=mask,this.ctx.stage.addChild(rope)},WellboreBaseComponentLayer.prototype.drawRope=function(path,texture,tint){if(0===path.length)return null;var rope=new SimpleRope(texture,path,1);rope.tint=tint||rope.tint,this.ctx.stage.addChild(rope)},WellboreBaseComponentLayer.prototype.drawOutline=function(leftPath,rightPath,lineColor,lineWidth,close){void 0===lineWidth&&(lineWidth=1),void 0===close&&(close=!1);var leftPathReverse=leftPath.map((function(d){return d.clone()})).reverse(),startPointRight=rightPath[0],startPointLeft=leftPathReverse[0],line=new Graphics;line.lineStyle(lineWidth,lineColor,void 0,1),line.moveTo(startPointRight.x,startPointRight.y),rightPath.forEach((function(p){return line.lineTo(p.x,p.y)})),close||line.moveTo(startPointLeft.x,startPointLeft.y),leftPathReverse.forEach((function(p){return line.lineTo(p.x,p.y)})),close&&line.lineTo(startPointRight.x,startPointRight.y),this.ctx.stage.addChild(line)},WellboreBaseComponentLayer}(PixiLayer),makeTubularPolygon=function(rightPath,leftPath){return __spreadArray(__spreadArray([],leftPath),rightPath.map((function(d){return d.clone()})).reverse())},overlaps=function(top1,bottom1,top2,bottom2){return top1<=bottom2&&top2<=bottom1},cementDiameterChangeDepths=function(cement,bottomOfCement,diameterIntervals){var arrays,arr,topOfCement=cement.toc,diameterChangeDepths=(arrays=diameterIntervals.map((function(d){return[d.start-1e-4,d.start,d.end,d.end+1e-4]})),Array.from(function*(arrays){for(const array of arrays)yield*array}(arrays))).filter((function(d){return d>=topOfCement&&d<=bottomOfCement}));return diameterChangeDepths.push(topOfCement),diameterChangeDepths.push(bottomOfCement),(arr=diameterChangeDepths,Array.from(new Set(arr))).sort((function(a,b){return a-b}))},arrayToVector=function(a){return new Vector2(a[0],a[1])},createNormals=function(points){return points.length<2?[new Vector2(0)]:points.map((function(coord,i,list){if(i<list.length-1){var p=arrayToVector(list[i]),rotate=arrayToVector(list[i+1]).sub(p).rotate90();return n=rotate.normalized()}return n}));var n},offsetPoint=function(point,vector,offset){var v,p=arrayToVector(point);return v=p.add(vector.scale(offset)),new Point(v[0],v[1])},offsetPoints=function(points,vectors,offset){if(points.length!==vectors.length)throw new Error("Number of vectors does not match number of points");return points.map((function(point,index){var vector=vectors[index];return offsetPoint(point,vector,offset)}))},HoleSizeLayer=function(_super){function HoleSizeLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.drawHoleSize=function(holeObject){if(null!=holeObject){var _a=_this.options,exaggerationFactor=_a.exaggerationFactor,firstColor=_a.firstColor,lineColor=_a.lineColor,diameter=holeObject.diameter*exaggerationFactor,radius=diameter/2,pathPoints=_this.getZFactorScaledPathForPoints(holeObject.start,holeObject.end,[holeObject.start,holeObject.end]).map((function(p){return p.point})),normals=createNormals(pathPoints),rightPath=offsetPoints(pathPoints,normals,radius),leftPath=offsetPoints(pathPoints,normals,-radius);if(0!==pathPoints.length){if(_this.renderType()===RENDERER_TYPE$1.CANVAS){var polygonCoords=makeTubularPolygon(leftPath,rightPath);_this.drawBigPolygon(polygonCoords,convertColor(firstColor))}else{var texture=_this.createTexture(diameter);_this.drawRope(pathPoints.map((function(p){return new Point(p[0],p[1])})),texture)}_this.drawOutline(leftPath,rightPath,lineColor,1,!1)}}},_this.options=__assign(__assign(__assign({},_this.options),{firstColor:"rgb(140, 84, 29)",secondColor:"rgb(238, 227, 216)",lineColor:9127187}),options),_this}return __extends(HoleSizeLayer,_super),HoleSizeLayer.prototype.preRender=function(){var _this=this,data=this.data;data&&this.rescaleEvent&&this.referenceSystem&&(data.sort((function(a,b){return b.diameter-a.diameter})),this.maxDiameter=data.length>0?data[0].diameter:100,data.forEach((function(hole){return _this.drawHoleSize(hole)})))},HoleSizeLayer.prototype.createTexture=function(diameter){var exaggerationFactor=this.options.exaggerationFactor,height=this.maxDiameter*exaggerationFactor;this._textureCache||(this._textureCache=this.createBaseTexture(16,height));var baseTexture=this._textureCache.baseTexture,sidePadding=Math.floor((height-diameter)/2),frame=new Rectangle(0,sidePadding,16,diameter);return new Texture(baseTexture,frame)},HoleSizeLayer.prototype.createBaseTexture=function(width,height){var _a=this.options,firstColor=_a.firstColor,secondColor=_a.secondColor,canvas=document.createElement("canvas");canvas.width=width,canvas.height=height;var canvasCtx=canvas.getContext("2d");return canvasCtx.fillStyle=function(canvas,canvasCtx,firstColor,secondColor,startPctOffset){var gradient=canvasCtx.createLinearGradient(0,0,0,canvas.height);return gradient.addColorStop(0,firstColor),gradient.addColorStop(.5-startPctOffset,secondColor),gradient.addColorStop(.5+startPctOffset,secondColor),gradient.addColorStop(1,firstColor),gradient}(canvas,canvasCtx,firstColor,secondColor,0),canvasCtx.fillRect(0,0,canvas.width,canvas.height),Texture.from(canvas)},HoleSizeLayer}(WellboreBaseComponentLayer),CasingLayer=function(_super){function CasingLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.prepareCasingRenderObject=function(casing){if(null!=casing){var exaggerationFactor=_this.options.exaggerationFactor,diameter=casing.diameter*exaggerationFactor,radius=diameter/2,innerRadius=casing.innerDiameter*exaggerationFactor/2,pathPoints=_this.getZFactorScaledPathForPoints(casing.start,casing.end,[casing.start,casing.end]).map((function(p){return p.point})),normals=createNormals(pathPoints),rightPath=offsetPoints(pathPoints,normals,radius),leftPath=offsetPoints(pathPoints,normals,-radius);return{pathPoints:pathPoints,polygon:makeTubularPolygon(leftPath,rightPath),leftPath:leftPath,rightPath:rightPath,radius:radius,diameter:diameter,casingWallWidth:Math.abs(radius-innerRadius)}}},_this.drawCasing=function(zippedRenderObject){var _a=_this.options,lineColor=_a.lineColor,solidColor=_a.solidColor,casing=zippedRenderObject[0],_b=zippedRenderObject[1],pathPoints=_b.pathPoints,polygon=_b.polygon,leftPath=_b.leftPath,rightPath=_b.rightPath,radius=_b.radius,diameter=_b.diameter,casingWallWidth=_b.casingWallWidth;if(_this.renderType()===RENDERER_TYPE$1.CANVAS)_this.drawBigPolygon(polygon,solidColor);else{var texture=_this.createTexture(diameter);_this.drawRope(pathPoints.map((function(p){return new Point(p[0],p[1])})),texture,solidColor)}_this.drawOutline(leftPath,rightPath,lineColor,casingWallWidth,!0),casing.hasShoe&&_this.drawShoe(casing.end,radius)},_this.generateShoe=function(casingEnd,casingRadius,length,width){var start=casingEnd-length,end=casingEnd,points=_this.getZFactorScaledPathForPoints(start,end,[start,end]).map((function(p){return p.point})),normal=createNormals(points),shoeEdge=offsetPoints(points,normal,casingRadius*(width<0?-1:1)),shoeTipPoint=points[points.length-1],shoeTipNormal=normal[normal.length-1],shoeTip=offsetPoint(shoeTipPoint,shoeTipNormal,width);return __spreadArray(__spreadArray([],shoeEdge),[shoeTip])},_this.options=__assign(__assign(__assign({},_this.options),{solidColor:14474460,lineColor:5723991}),options),_this}return __extends(CasingLayer,_super),CasingLayer.prototype.preRender=function(){var _this=this,data=this.data;if(data&&this.rescaleEvent&&this.referenceSystem){var sortedCasings=data.sort((function(a,b){return b.diameter-a.diameter})),casingRenderObjects=sortedCasings.map((function(casing){return _this.prepareCasingRenderObject(casing)})),zippedRenderObjects=function(){return transpose(arguments)}(sortedCasings,casingRenderObjects);zippedRenderObjects.forEach((function(zippedRenderObject){return _this.drawCasing(zippedRenderObject)}))}},CasingLayer.prototype.drawShoe=function(casingEnd,casingRadius){var exaggerationFactor=this.options.exaggerationFactor,shoeWidth=25*exaggerationFactor,shoeLength=12*exaggerationFactor,shoeCoords=this.generateShoe(casingEnd,casingRadius,shoeLength,shoeWidth),shoeCoords2=this.generateShoe(casingEnd,casingRadius,shoeLength,-shoeWidth);this.drawBigPolygon(shoeCoords2),this.drawBigPolygon(shoeCoords)},CasingLayer.prototype.createTexture=function(diameter){return new Texture(Texture.WHITE.baseTexture,null,new Rectangle(0,0,16,diameter))},CasingLayer}(WellboreBaseComponentLayer),CementLayer=function(_super){function CementLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.createCementShape=function(cement,casings,holes){var exaggerationFactor=_this.options.exaggerationFactor,casingIds=__spreadArray([cement.casingId],cement.casingIds||[]).filter((function(id){return id})),attachedCasings=casingIds.map((function(casingId){return casings.find((function(casing){return casing.casingId===casingId}))}));if(0===attachedCasings.length||attachedCasings.includes(void 0))throw new Error("Invalid cement data, cement is missing attached casing");attachedCasings.sort((function(a,b){return a.end-b.end}));for(var bottomOfCement=attachedCasings[attachedCasings.length-1].end,_a=function(cement,bottomOfCement,parentCasings,casings,holes){var start=cement.toc,end=bottomOfCement;return{holes:holes.filter((function(h){return overlaps(start,end,h.start,h.end)})),outerCasings:casings.filter((function(c){return!parentCasings.includes(c)})).filter((function(c){return overlaps(start,end,c.start,c.end)}))}}(cement,bottomOfCement,attachedCasings,casings,holes),outerCasings=_a.outerCasings,overlappingHoles=_a.holes,innerDiameterIntervals=attachedCasings,outerDiameterIntervals=__spreadArray(__spreadArray([],outerCasings),overlappingHoles).map((function(d){return{start:d.start,end:d.end}})),diameterAtChangeDepths=cementDiameterChangeDepths(cement,bottomOfCement,__spreadArray(__spreadArray([],innerDiameterIntervals),outerDiameterIntervals)).map(function(innerCasing,nonAttachedCasings,holes){return function(depth){var outerDiameter,innerCasingAtDepth=innerCasing.find((function(casing){return casing.start<=depth&&casing.end>=depth})),innerDiameter=innerCasingAtDepth?innerCasingAtDepth.diameter:0,outerCasings=nonAttachedCasings.filter((function(casing){return casing.innerDiameter>innerDiameter})),holeAtDepth=holes.find((function(hole){return hole.start<=depth&&hole.end>=depth&&hole.diameter>innerDiameter})),outerCasingAtDepth=outerCasings.filter((function(d){return d})).sort((function(a,b){return a.innerDiameter-b.innerDiameter})).find((function(casing){return casing.start<=depth&&casing.end>=depth&&casing.diameter>innerDiameter}));return outerDiameter=outerCasingAtDepth?outerCasingAtDepth.innerDiameter:holeAtDepth?holeAtDepth.diameter-1:100,{md:depth,innerDiameter:innerDiameter,outerDiameter:outerDiameter}}}(attachedCasings,outerCasings,overlappingHoles)),path=_this.getZFactorScaledPathForPoints(cement.toc,bottomOfCement,diameterAtChangeDepths.map((function(d){return d.md}))),normals=createNormals(path.map((function(p){return p.point}))),pathWithNormals=path.map((function(p,i){return __assign(__assign({},p),{normal:normals[i]})})),side1Left=[],side1Right=[],side2Left=[],side2Right=[],previousDepth=diameterAtChangeDepths.shift(),_loop_1=function(depth){var intervalMdPoints=pathWithNormals.filter((function(x){return x.md>=previousDepth.md&&x.md<=depth.md})),intervalPoints=intervalMdPoints.map((function(s){return s.point})),intervalPointNormals=intervalMdPoints.map((function(s){return s.normal})),outerRadius=previousDepth.outerDiameter/2*exaggerationFactor,innerRadius=previousDepth.innerDiameter/2*exaggerationFactor,intervalSide1Left=offsetPoints(intervalPoints,intervalPointNormals,outerRadius),intervalSide1Right=offsetPoints(intervalPoints,intervalPointNormals,innerRadius),intervalSide2Left=offsetPoints(intervalPoints,intervalPointNormals,-innerRadius),intervalSide2Right=offsetPoints(intervalPoints,intervalPointNormals,-outerRadius);side1Left.push.apply(side1Left,intervalSide1Left),side1Right.push.apply(side1Right,intervalSide1Right),side2Left.push.apply(side2Left,intervalSide2Left),side2Right.push.apply(side2Right,intervalSide2Right),previousDepth=depth},_i=0,diameterAtChangeDepths_1=diameterAtChangeDepths;_i<diameterAtChangeDepths_1.length;_i++){_loop_1(diameterAtChangeDepths_1[_i])}var pathPoints=pathWithNormals.map((function(p){return new Point(p.point[0],p.point[1])}));return{leftPolygon:makeTubularPolygon(side1Left,side1Right),rightPolygon:makeTubularPolygon(side2Left,side2Right),path:pathPoints}},_this.options=__assign(__assign(__assign({},_this.options),{firstColor:"#c7b9ab",secondColor:"#5b5b5b"}),options),_this}return __extends(CementLayer,_super),CementLayer.prototype.preRender=function(){var _this=this;if(this.data&&this.rescaleEvent&&this.referenceSystem){var _a=this.data,cement=_a.cement,casings=_a.casings,holes=_a.holes,cementShapes=cement.map((function(cement){return _this.createCementShape(cement,casings,holes)})),texture=this.createTexture();cementShapes.forEach((function(cementShape){_this.renderType()===RENDERER_TYPE$1.CANVAS?(_this.drawBigTexturedPolygon(cementShape.leftPolygon,texture),_this.drawBigTexturedPolygon(cementShape.rightPolygon,texture)):(_this.drawRopeWithMask(cementShape.path,cementShape.leftPolygon,texture),_this.drawRopeWithMask(cementShape.path,cementShape.rightPolygon,texture))}))}},CementLayer.prototype.createTexture=function(){if(this._textureCache)return this._textureCache;var _a=this.options,firstColor=_a.firstColor,secondColor=_a.secondColor,canvas=document.createElement("canvas");canvas.width=150,canvas.height=150;var canvasCtx=canvas.getContext("2d");canvasCtx.fillStyle=firstColor,canvasCtx.fillRect(0,0,canvas.width,canvas.height),canvasCtx.lineWidth=1,canvasCtx.fillStyle=secondColor,canvasCtx.beginPath(),canvasCtx.lineWidth=1;for(var i=-canvas.width;i<canvas.width;i++)canvasCtx.moveTo(-canvas.width+10*i,-canvas.height),canvasCtx.lineTo(canvas.width+10*i,canvas.height);return canvasCtx.stroke(),this._textureCache=Texture.from(canvas),this._textureCache},CementLayer}(WellboreBaseComponentLayer),SeismicCanvasLayer=function(_super){function SeismicCanvasLayer(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(SeismicCanvasLayer,_super),SeismicCanvasLayer.prototype.onMount=function(event){_super.prototype.onMount.call(this,event)},SeismicCanvasLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.clearCanvas(),this.render()},SeismicCanvasLayer.prototype.onRescale=function(event){_super.prototype.onRescale.call(this,event),this.setTransform(event),this.render()},SeismicCanvasLayer.prototype.render=function(){if(this.data&&this.ctx&&this.data.image){var ctx=this.ctx,_a=this.data,options=_a.options,image=_a.image;this.clearCanvas(),ctx.drawImage(image,options.x,options.y,options.width,options.height)}},SeismicCanvasLayer}(CanvasLayer),CompletionLayer=function(_super){function CompletionLayer(id,options){var _this=_super.call(this,id,options)||this;return _this.options=__assign(__assign({},_this.options),options),_this.render=_this.render.bind(_this),_this}return __extends(CompletionLayer,_super),CompletionLayer.prototype.onRescale=function(event){_super.prototype.onRescale.call(this,event),this.clearStage(),this.preRender(),this.render()},CompletionLayer.prototype.onUpdate=function(event){_super.prototype.onUpdate.call(this,event),this.clearStage(),this.preRender(),this.render()},CompletionLayer.prototype.preRender=function(){var _a,_this=this,wellborePath=this.referenceSystem?this.referenceSystem.projectedPath:[];null!=wellborePath&&((null===(_a=this.data)||void 0===_a?void 0:_a.length)>0?this.data.map((function(d){return _this.generateCompletionItem(wellborePath,d)})):[]).map((function(s){return _this.drawCompletionItem(s)}))},CompletionLayer.prototype.clearStage=function(){this.ctx.stage.removeChildren().forEach((function(child){child.destroy()}))},CompletionLayer.prototype.getShape=function(type){var graphics=new Graphics;return graphics.beginFill(3421236),graphics.drawRect(-5,-5,10,10),graphics.endFill(),graphics},CompletionLayer.prototype.getScale=function(type,length,width){return{scaleX:1,scaleY:1}},CompletionLayer.prototype.generateCompletionItem=function(wbp,data){if(this.referenceSystem){var pointTop=this.referenceSystem.project(data.start),pointBottom=this.referenceSystem.project(data.end),rotation=Vector2.angle(pointTop,pointBottom),graphics=this.getShape(data.shape),_a=this.getScale(data.shape,data.start-data.end,data.diameter),scaleX=_a.scaleX,scaleY=_a.scaleY,x=pointTop[0],y=pointTop[1];return graphics.setTransform(x,y,scaleX,scaleY,rotation),{graphics:graphics}}},CompletionLayer.prototype.drawCompletionItem=function(item){this.ctx.stage.addChild(item.graphics)},CompletionLayer}(PixiLayer),noop$2={value:()=>{}};function dispatch(){for(var t,i=0,n=arguments.length,_={};i<n;++i){if(!(t=arguments[i]+"")||t in _||/[\s.]/.test(t))throw new Error("illegal type: "+t);_[t]=[]}return new Dispatch(_)}function Dispatch(_){this._=_}function parseTypenames$1(typenames,types){return typenames.trim().split(/^|\s+/).map((function(t){var name="",i=t.indexOf(".");if(i>=0&&(name=t.slice(i+1),t=t.slice(0,i)),t&&!types.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:name}}))}function get(type,name){for(var c,i=0,n=type.length;i<n;++i)if((c=type[i]).name===name)return c.value}function set(type,name,callback){for(var i=0,n=type.length;i<n;++i)if(type[i].name===name){type[i]=noop$2,type=type.slice(0,i).concat(type.slice(i+1));break}return null!=callback&&type.push({name:name,value:callback}),type}Dispatch.prototype=dispatch.prototype={constructor:Dispatch,on:function(typename,callback){var t,_=this._,T=parseTypenames$1(typename+"",_),i=-1,n=T.length;if(!(arguments.length<2)){if(null!=callback&&"function"!=typeof callback)throw new Error("invalid callback: "+callback);for(;++i<n;)if(t=(typename=T[i]).type)_[t]=set(_[t],typename.name,callback);else if(null==callback)for(t in _)_[t]=set(_[t],typename.name,null);return this}for(;++i<n;)if((t=(typename=T[i]).type)&&(t=get(_[t],typename.name)))return t},copy:function(){var copy={},_=this._;for(var t in _)copy[t]=_[t].slice();return new Dispatch(copy)},call:function(type,that){if((n=arguments.length-2)>0)for(var n,t,args=new Array(n),i=0;i<n;++i)args[i]=arguments[i+2];if(!this._.hasOwnProperty(type))throw new Error("unknown type: "+type);for(i=0,n=(t=this._[type]).length;i<n;++i)t[i].value.apply(that,args)},apply:function(type,that,args){if(!this._.hasOwnProperty(type))throw new Error("unknown type: "+type);for(var t=this._[type],i=0,n=t.length;i<n;++i)t[i].value.apply(that,args)}};const nonpassivecapture={capture:!0,passive:!1};function noevent(event){event.preventDefault(),event.stopImmediatePropagation()}function dragDisable(view){var root=view.document.documentElement,selection=select(view).on("dragstart.drag",noevent,nonpassivecapture);"onselectstart"in root?selection.on("selectstart.drag",noevent,nonpassivecapture):(root.__noselect=root.style.MozUserSelect,root.style.MozUserSelect="none")}function yesdrag(view,noclick){var root=view.document.documentElement,selection=select(view).on("dragstart.drag",null);noclick&&(selection.on("click.drag",noevent,nonpassivecapture),setTimeout((function(){selection.on("click.drag",null)}),0)),"onselectstart"in root?selection.on("selectstart.drag",null):(root.style.MozUserSelect=root.__noselect,delete root.__noselect)}var taskHead,taskTail,frame=0,timeout=0,interval=0,clockLast=0,clockNow=0,clockSkew=0,clock="object"==typeof performance&&performance.now?performance:Date,setFrame="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(f){setTimeout(f,17)};function now(){return clockNow||(setFrame(clearNow),clockNow=clock.now()+clockSkew)}function clearNow(){clockNow=0}function Timer(){this._call=this._time=this._next=null}function timer(callback,delay,time){var t=new Timer;return t.restart(callback,delay,time),t}function wake(){clockNow=(clockLast=clock.now())+clockSkew,frame=timeout=0;try{!function(){now(),++frame;for(var e,t=taskHead;t;)(e=clockNow-t._time)>=0&&t._call.call(void 0,e),t=t._next;--frame}()}finally{frame=0,function(){var t0,t2,t1=taskHead,time=1/0;for(;t1;)t1._call?(time>t1._time&&(time=t1._time),t0=t1,t1=t1._next):(t2=t1._next,t1._next=null,t1=t0?t0._next=t2:taskHead=t2);taskTail=t0,sleep(time)}(),clockNow=0}}function poke(){var now=clock.now(),delay=now-clockLast;delay>1e3&&(clockSkew-=delay,clockLast=now)}function sleep(time){frame||(timeout&&(timeout=clearTimeout(timeout)),time-clockNow>24?(time<1/0&&(timeout=setTimeout(wake,time-clock.now()-clockSkew)),interval&&(interval=clearInterval(interval))):(interval||(clockLast=clock.now(),interval=setInterval(poke,1e3)),frame=1,setFrame(wake)))}function timeout$1(callback,delay,time){var t=new Timer;return delay=null==delay?0:+delay,t.restart((elapsed=>{t.stop(),callback(elapsed+delay)}),delay,time),t}Timer.prototype=timer.prototype={constructor:Timer,restart:function(callback,delay,time){if("function"!=typeof callback)throw new TypeError("callback is not a function");time=(null==time?now():+time)+(null==delay?0:+delay),this._next||taskTail===this||(taskTail?taskTail._next=this:taskHead=this,taskTail=this),this._call=callback,this._time=time,sleep()},stop:function(){this._call&&(this._call=null,this._time=1/0,sleep())}};var emptyOn=dispatch("start","end","cancel","interrupt"),emptyTween=[];function schedule(node,name,id,index,group,timing){var schedules=node.__transition;if(schedules){if(id in schedules)return}else node.__transition={};!function(node,id,self){var tween,schedules=node.__transition;function schedule(elapsed){self.state=1,self.timer.restart(start,self.delay,self.time),self.delay<=elapsed&&start(elapsed-self.delay)}function start(elapsed){var i,j,n,o;if(1!==self.state)return stop();for(i in schedules)if((o=schedules[i]).name===self.name){if(3===o.state)return timeout$1(start);4===o.state?(o.state=6,o.timer.stop(),o.on.call("interrupt",node,node.__data__,o.index,o.group),delete schedules[i]):+i<id&&(o.state=6,o.timer.stop(),o.on.call("cancel",node,node.__data__,o.index,o.group),delete schedules[i])}if(timeout$1((function(){3===self.state&&(self.state=4,self.timer.restart(tick,self.delay,self.time),tick(elapsed))})),self.state=2,self.on.call("start",node,node.__data__,self.index,self.group),2===self.state){for(self.state=3,tween=new Array(n=self.tween.length),i=0,j=-1;i<n;++i)(o=self.tween[i].value.call(node,node.__data__,self.index,self.group))&&(tween[++j]=o);tween.length=j+1}}function tick(elapsed){for(var t=elapsed<self.duration?self.ease.call(null,elapsed/self.duration):(self.timer.restart(stop),self.state=5,1),i=-1,n=tween.length;++i<n;)tween[i].call(node,t);5===self.state&&(self.on.call("end",node,node.__data__,self.index,self.group),stop())}function stop(){for(var i in self.state=6,self.timer.stop(),delete schedules[id],schedules)return;delete node.__transition}schedules[id]=self,self.timer=timer(schedule,0,self.time)}(node,id,{name:name,index:index,group:group,on:emptyOn,tween:emptyTween,time:timing.time,delay:timing.delay,duration:timing.duration,ease:timing.ease,timer:null,state:0})}function init$1(node,id){var schedule=get$1(node,id);if(schedule.state>0)throw new Error("too late; already scheduled");return schedule}function set$1(node,id){var schedule=get$1(node,id);if(schedule.state>3)throw new Error("too late; already running");return schedule}function get$1(node,id){var schedule=node.__transition;if(!schedule||!(schedule=schedule[id]))throw new Error("transition not found");return schedule}function interrupt(node,name){var schedule,active,i,schedules=node.__transition,empty=!0;if(schedules){for(i in name=null==name?null:name+"",schedules)(schedule=schedules[i]).name===name?(active=schedule.state>2&&schedule.state<5,schedule.state=6,schedule.timer.stop(),schedule.on.call(active?"interrupt":"cancel",node,node.__data__,schedule.index,schedule.group),delete schedules[i]):empty=!1;empty&&delete node.__transition}}function tweenRemove(id,name){var tween0,tween1;return function(){var schedule=set$1(this,id),tween=schedule.tween;if(tween!==tween0)for(var i=0,n=(tween1=tween0=tween).length;i<n;++i)if(tween1[i].name===name){(tween1=tween1.slice()).splice(i,1);break}schedule.tween=tween1}}function tweenFunction(id,name,value){var tween0,tween1;if("function"!=typeof value)throw new Error;return function(){var schedule=set$1(this,id),tween=schedule.tween;if(tween!==tween0){tween1=(tween0=tween).slice();for(var t={name:name,value:value},i=0,n=tween1.length;i<n;++i)if(tween1[i].name===name){tween1[i]=t;break}i===n&&tween1.push(t)}schedule.tween=tween1}}function tweenValue(transition,name,value){var id=transition._id;return transition.each((function(){var schedule=set$1(this,id);(schedule.value||(schedule.value={}))[name]=value.apply(this,arguments)})),function(node){return get$1(node,id).value[name]}}function interpolate$1(a,b){var c;return("number"==typeof b?interpolateNumber:b instanceof color?interpolateRgb:(c=color(b))?(b=c,interpolateRgb):interpolateString)(a,b)}function attrRemove$1(name){return function(){this.removeAttribute(name)}}function attrRemoveNS$1(fullname){return function(){this.removeAttributeNS(fullname.space,fullname.local)}}function attrConstant$1(name,interpolate,value1){var string00,interpolate0,string1=value1+"";return function(){var string0=this.getAttribute(name);return string0===string1?null:string0===string00?interpolate0:interpolate0=interpolate(string00=string0,value1)}}function attrConstantNS$1(fullname,interpolate,value1){var string00,interpolate0,string1=value1+"";return function(){var string0=this.getAttributeNS(fullname.space,fullname.local);return string0===string1?null:string0===string00?interpolate0:interpolate0=interpolate(string00=string0,value1)}}function attrFunction$1(name,interpolate,value){var string00,string10,interpolate0;return function(){var string0,string1,value1=value(this);if(null!=value1)return(string0=this.getAttribute(name))===(string1=value1+"")?null:string0===string00&&string1===string10?interpolate0:(string10=string1,interpolate0=interpolate(string00=string0,value1));this.removeAttribute(name)}}function attrFunctionNS$1(fullname,interpolate,value){var string00,string10,interpolate0;return function(){var string0,string1,value1=value(this);if(null!=value1)return(string0=this.getAttributeNS(fullname.space,fullname.local))===(string1=value1+"")?null:string0===string00&&string1===string10?interpolate0:(string10=string1,interpolate0=interpolate(string00=string0,value1));this.removeAttributeNS(fullname.space,fullname.local)}}function attrInterpolate(name,i){return function(t){this.setAttribute(name,i.call(this,t))}}function attrInterpolateNS(fullname,i){return function(t){this.setAttributeNS(fullname.space,fullname.local,i.call(this,t))}}function attrTweenNS(fullname,value){var t0,i0;function tween(){var i=value.apply(this,arguments);return i!==i0&&(t0=(i0=i)&&attrInterpolateNS(fullname,i)),t0}return tween._value=value,tween}function attrTween(name,value){var t0,i0;function tween(){var i=value.apply(this,arguments);return i!==i0&&(t0=(i0=i)&&attrInterpolate(name,i)),t0}return tween._value=value,tween}function delayFunction(id,value){return function(){init$1(this,id).delay=+value.apply(this,arguments)}}function delayConstant(id,value){return value=+value,function(){init$1(this,id).delay=value}}function durationFunction(id,value){return function(){set$1(this,id).duration=+value.apply(this,arguments)}}function durationConstant(id,value){return value=+value,function(){set$1(this,id).duration=value}}function easeConstant(id,value){if("function"!=typeof value)throw new Error;return function(){set$1(this,id).ease=value}}function onFunction(id,name,listener){var on0,on1,sit=function(name){return(name+"").trim().split(/^|\s+/).every((function(t){var i=t.indexOf(".");return i>=0&&(t=t.slice(0,i)),!t||"start"===t}))}(name)?init$1:set$1;return function(){var schedule=sit(this,id),on=schedule.on;on!==on0&&(on1=(on0=on).copy()).on(name,listener),schedule.on=on1}}var Selection$1=selection.prototype.constructor;function styleRemove$1(name){return function(){this.style.removeProperty(name)}}function styleInterpolate(name,i,priority){return function(t){this.style.setProperty(name,i.call(this,t),priority)}}function styleTween(name,value,priority){var t,i0;function tween(){var i=value.apply(this,arguments);return i!==i0&&(t=(i0=i)&&styleInterpolate(name,i,priority)),t}return tween._value=value,tween}function textInterpolate(i){return function(t){this.textContent=i.call(this,t)}}function textTween(value){var t0,i0;function tween(){var i=value.apply(this,arguments);return i!==i0&&(t0=(i0=i)&&textInterpolate(i)),t0}return tween._value=value,tween}var id=0;function Transition(groups,parents,name,id){this._groups=groups,this._parents=parents,this._name=name,this._id=id}function newId(){return++id}var selection_prototype=selection.prototype;Transition.prototype={constructor:Transition,select:function(select){var name=this._name,id=this._id;"function"!=typeof select&&(select=selector(select));for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j<m;++j)for(var node,subnode,group=groups[j],n=group.length,subgroup=subgroups[j]=new Array(n),i=0;i<n;++i)(node=group[i])&&(subnode=select.call(node,node.__data__,i,group))&&("__data__"in node&&(subnode.__data__=node.__data__),subgroup[i]=subnode,schedule(subgroup[i],name,id,i,subgroup,get$1(node,id)));return new Transition(subgroups,this._parents,name,id)},selectAll:function(select){var name=this._name,id=this._id;"function"!=typeof select&&(select=selectorAll(select));for(var groups=this._groups,m=groups.length,subgroups=[],parents=[],j=0;j<m;++j)for(var node,group=groups[j],n=group.length,i=0;i<n;++i)if(node=group[i]){for(var child,children=select.call(node,node.__data__,i,group),inherit=get$1(node,id),k=0,l=children.length;k<l;++k)(child=children[k])&&schedule(child,name,id,k,children,inherit);subgroups.push(children),parents.push(node)}return new Transition(subgroups,parents,name,id)},selectChild:selection_prototype.selectChild,selectChildren:selection_prototype.selectChildren,filter:function(match){"function"!=typeof match&&(match=matcher(match));for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j<m;++j)for(var node,group=groups[j],n=group.length,subgroup=subgroups[j]=[],i=0;i<n;++i)(node=group[i])&&match.call(node,node.__data__,i,group)&&subgroup.push(node);return new Transition(subgroups,this._parents,this._name,this._id)},merge:function(transition){if(transition._id!==this._id)throw new Error;for(var groups0=this._groups,groups1=transition._groups,m0=groups0.length,m1=groups1.length,m=Math.min(m0,m1),merges=new Array(m0),j=0;j<m;++j)for(var node,group0=groups0[j],group1=groups1[j],n=group0.length,merge=merges[j]=new Array(n),i=0;i<n;++i)(node=group0[i]||group1[i])&&(merge[i]=node);for(;j<m0;++j)merges[j]=groups0[j];return new Transition(merges,this._parents,this._name,this._id)},selection:function(){return new Selection$1(this._groups,this._parents)},transition:function(){for(var name=this._name,id0=this._id,id1=newId(),groups=this._groups,m=groups.length,j=0;j<m;++j)for(var node,group=groups[j],n=group.length,i=0;i<n;++i)if(node=group[i]){var inherit=get$1(node,id0);schedule(node,name,id1,i,group,{time:inherit.time+inherit.delay+inherit.duration,delay:0,duration:inherit.duration,ease:inherit.ease})}return new Transition(groups,this._parents,name,id1)},call:selection_prototype.call,nodes:selection_prototype.nodes,node:selection_prototype.node,size:selection_prototype.size,empty:selection_prototype.empty,each:selection_prototype.each,on:function(name,listener){var id=this._id;return arguments.length<2?get$1(this.node(),id).on.on(name):this.each(onFunction(id,name,listener))},attr:function(name,value){var fullname=namespace(name),i="transform"===fullname?interpolateTransformSvg:interpolate$1;return this.attrTween(name,"function"==typeof value?(fullname.local?attrFunctionNS$1:attrFunction$1)(fullname,i,tweenValue(this,"attr."+name,value)):null==value?(fullname.local?attrRemoveNS$1:attrRemove$1)(fullname):(fullname.local?attrConstantNS$1:attrConstant$1)(fullname,i,value))},attrTween:function(name,value){var key="attr."+name;if(arguments.length<2)return(key=this.tween(key))&&key._value;if(null==value)return this.tween(key,null);if("function"!=typeof value)throw new Error;var fullname=namespace(name);return this.tween(key,(fullname.local?attrTweenNS:attrTween)(fullname,value))},style:function(name,value,priority){var i="transform"==(name+="")?interpolateTransformCss:interpolate$1;return null==value?this.styleTween(name,function(name,interpolate){var string00,string10,interpolate0;return function(){var string0=styleValue(this,name),string1=(this.style.removeProperty(name),styleValue(this,name));return string0===string1?null:string0===string00&&string1===string10?interpolate0:interpolate0=interpolate(string00=string0,string10=string1)}}(name,i)).on("end.style."+name,styleRemove$1(name)):"function"==typeof value?this.styleTween(name,function(name,interpolate,value){var string00,string10,interpolate0;return function(){var string0=styleValue(this,name),value1=value(this),string1=value1+"";return null==value1&&(this.style.removeProperty(name),string1=value1=styleValue(this,name)),string0===string1?null:string0===string00&&string1===string10?interpolate0:(string10=string1,interpolate0=interpolate(string00=string0,value1))}}(name,i,tweenValue(this,"style."+name,value))).each(function(id,name){var on0,on1,listener0,remove,key="style."+name,event="end."+key;return function(){var schedule=set$1(this,id),on=schedule.on,listener=null==schedule.value[key]?remove||(remove=styleRemove$1(name)):void 0;on===on0&&listener0===listener||(on1=(on0=on).copy()).on(event,listener0=listener),schedule.on=on1}}(this._id,name)):this.styleTween(name,function(name,interpolate,value1){var string00,interpolate0,string1=value1+"";return function(){var string0=styleValue(this,name);return string0===string1?null:string0===string00?interpolate0:interpolate0=interpolate(string00=string0,value1)}}(name,i,value),priority).on("end.style."+name,null)},styleTween:function(name,value,priority){var key="style."+(name+="");if(arguments.length<2)return(key=this.tween(key))&&key._value;if(null==value)return this.tween(key,null);if("function"!=typeof value)throw new Error;return this.tween(key,styleTween(name,value,null==priority?"":priority))},text:function(value){return this.tween("text","function"==typeof value?function(value){return function(){var value1=value(this);this.textContent=null==value1?"":value1}}(tweenValue(this,"text",value)):function(value){return function(){this.textContent=value}}(null==value?"":value+""))},textTween:function(value){var key="text";if(arguments.length<1)return(key=this.tween(key))&&key._value;if(null==value)return this.tween(key,null);if("function"!=typeof value)throw new Error;return this.tween(key,textTween(value))},remove:function(){return this.on("end.remove",function(id){return function(){var parent=this.parentNode;for(var i in this.__transition)if(+i!==id)return;parent&&parent.removeChild(this)}}(this._id))},tween:function(name,value){var id=this._id;if(name+="",arguments.length<2){for(var t,tween=get$1(this.node(),id).tween,i=0,n=tween.length;i<n;++i)if((t=tween[i]).name===name)return t.value;return null}return this.each((null==value?tweenRemove:tweenFunction)(id,name,value))},delay:function(value){var id=this._id;return arguments.length?this.each(("function"==typeof value?delayFunction:delayConstant)(id,value)):get$1(this.node(),id).delay},duration:function(value){var id=this._id;return arguments.length?this.each(("function"==typeof value?durationFunction:durationConstant)(id,value)):get$1(this.node(),id).duration},ease:function(value){var id=this._id;return arguments.length?this.each(easeConstant(id,value)):get$1(this.node(),id).ease},easeVarying:function(value){if("function"!=typeof value)throw new Error;return this.each(function(id,value){return function(){var v=value.apply(this,arguments);if("function"!=typeof v)throw new Error;set$1(this,id).ease=v}}(this._id,value))},end:function(){var on0,on1,that=this,id=that._id,size=that.size();return new Promise((function(resolve,reject){var cancel={value:reject},end={value:function(){0==--size&&resolve()}};that.each((function(){var schedule=set$1(this,id),on=schedule.on;on!==on0&&((on1=(on0=on).copy())._.cancel.push(cancel),on1._.interrupt.push(cancel),on1._.end.push(end)),schedule.on=on1})),0===size&&resolve()}))},[Symbol.iterator]:selection_prototype[Symbol.iterator]};var defaultTiming={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function inherit(node,id){for(var timing;!(timing=node.__transition)||!(timing=timing[id]);)if(!(node=node.parentNode))throw new Error(`transition ${id} not found`);return timing}selection.prototype.interrupt=function(name){return this.each((function(){interrupt(this,name)}))},selection.prototype.transition=function(name){var id,timing;name instanceof Transition?(id=name._id,name=name._name):(id=newId(),(timing=defaultTiming).time=now(),name=null==name?null:name+"");for(var groups=this._groups,m=groups.length,j=0;j<m;++j)for(var node,group=groups[j],n=group.length,i=0;i<n;++i)(node=group[i])&&schedule(node,name,id,i,group,timing||inherit(node,id));return new Transition(groups,this._parents,name,id)};var constant$3=x=>()=>x;function ZoomEvent(type,{sourceEvent:sourceEvent,target:target,transform:transform,dispatch:dispatch}){Object.defineProperties(this,{type:{value:type,enumerable:!0,configurable:!0},sourceEvent:{value:sourceEvent,enumerable:!0,configurable:!0},target:{value:target,enumerable:!0,configurable:!0},transform:{value:transform,enumerable:!0,configurable:!0},_:{value:dispatch}})}function Transform$1(k,x,y){this.k=k,this.x=x,this.y=y}Transform$1.prototype={constructor:Transform$1,scale:function(k){return 1===k?this:new Transform$1(this.k*k,this.x,this.y)},translate:function(x,y){return 0===x&0===y?this:new Transform$1(this.k,this.x+this.k*x,this.y+this.k*y)},apply:function(point){return[point[0]*this.k+this.x,point[1]*this.k+this.y]},applyX:function(x){return x*this.k+this.x},applyY:function(y){return y*this.k+this.y},invert:function(location){return[(location[0]-this.x)/this.k,(location[1]-this.y)/this.k]},invertX:function(x){return(x-this.x)/this.k},invertY:function(y){return(y-this.y)/this.k},rescaleX:function(x){return x.copy().domain(x.range().map(this.invertX,this).map(x.invert,x))},rescaleY:function(y){return y.copy().domain(y.range().map(this.invertY,this).map(y.invert,y))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var identity$3=new Transform$1(1,0,0);function nopropagation(event){event.stopImmediatePropagation()}function noevent$1(event){event.preventDefault(),event.stopImmediatePropagation()}function defaultFilter(event){return!(event.ctrlKey&&"wheel"!==event.type||event.button)}function defaultExtent(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function defaultTransform(){return this.__zoom||identity$3}function defaultWheelDelta(event){return-event.deltaY*(1===event.deltaMode?.05:event.deltaMode?1:.002)*(event.ctrlKey?10:1)}function defaultTouchable(){return navigator.maxTouchPoints||"ontouchstart"in this}function defaultConstrain(transform,extent,translateExtent){var dx0=transform.invertX(extent[0][0])-translateExtent[0][0],dx1=transform.invertX(extent[1][0])-translateExtent[1][0],dy0=transform.invertY(extent[0][1])-translateExtent[0][1],dy1=transform.invertY(extent[1][1])-translateExtent[1][1];return transform.translate(dx1>dx0?(dx0+dx1)/2:Math.min(0,dx0)||Math.max(0,dx1),dy1>dy0?(dy0+dy1)/2:Math.min(0,dy0)||Math.max(0,dy1))}var ZoomPanHandler=function(){function ZoomPanHandler(elm,onRescale,options){void 0===options&&(options={maxZoomLevel:256,minZoomLevel:.1}),this.zoom=null,this.elm=null,this.container=null,this.onRescale=null,this.options=null,this.xBounds=[0,1],this.yBounds=[0,1],this.translateBoundsX=[0,1],this.translateBoundsY=[0,1],this.scaleX=null,this.scaleY=null,this._zFactor=1,this.onZoom=this.onZoom.bind(this),this.container=select(elm),this.options=options,this.onRescale=onRescale,this.onZoom=this.onZoom.bind(this),this.calculateTransform=this.calculateTransform.bind(this),this.applyTransform=this.applyTransform.bind(this),this.recalculateZoomTransform=this.recalculateZoomTransform.bind(this),this.rescale=this.rescale.bind(this),this.adjustToSize=this.adjustToSize.bind(this),this.setViewport=this.setViewport.bind(this),this.currentStateAsEvent=this.currentStateAsEvent.bind(this),this.updateTranslateExtent=this.updateTranslateExtent.bind(this),this.scaleX=linear$1().domain(this.xBounds).range([0,1]),this.scaleY=linear$1().domain(this.yBounds).range([0,1]),this.init()}return Object.defineProperty(ZoomPanHandler.prototype,"width",{get:function(){return this.scaleX.range()[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"height",{get:function(){return this.scaleY.range()[1]},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"xSpan",{get:function(){var xBounds=this.xBounds;return Math.abs(xBounds[1]-xBounds[0])},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"ySpan",{get:function(){var yBounds=this.yBounds;return Math.abs(yBounds[1]-yBounds[0])},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"viewportRatio",{get:function(){return this.width/(this.height||1)},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"xRatio",{get:function(){var domain=this.scaleX.domain();return Math.abs(this.width/(domain[1]-domain[0]))},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"yRatio",{get:function(){var domain=this.scaleY.domain();return Math.abs(this.height/(domain[1]-domain[0]))},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"zFactor",{get:function(){return this._zFactor},set:function(factor){this._zFactor=factor,this.recalculateZoomTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"isXInverted",{get:function(){return this.xBounds[1]<this.xBounds[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"isYInverted",{get:function(){return this.yBounds[1]<this.yBounds[0]},enumerable:!1,configurable:!0}),Object.defineProperty(ZoomPanHandler.prototype,"enableTranslateExtent",{get:function(){return this._enableTranslateExtent},set:function(enabled){this._enableTranslateExtent=enabled,this.updateTranslateExtent()},enumerable:!1,configurable:!0}),ZoomPanHandler.prototype.updateTranslateExtent=function(){var _a=this,width=_a.width,xSpan=_a.xSpan;_a.ySpan;var zFactor=_a.zFactor,enableTranslateExtent=_a.enableTranslateExtent,translateBoundsX=_a.translateBoundsX,translateBoundsY=_a.translateBoundsY,x1=-1/0,y1=-1/0,x2=1/0,y2=1/0;if(enableTranslateExtent){var ppu=width/xSpan;x1=translateBoundsX[0]*ppu,x2=translateBoundsX[1]*ppu,y1=translateBoundsY[0]*ppu*zFactor,y2=translateBoundsY[1]*ppu*zFactor}this.zoom.translateExtent([[x1,y1],[x2,y2]])},ZoomPanHandler.prototype.currentStateAsEvent=function(){var _a=this,scaleX=_a.scaleX,scaleY=_a.scaleY,xBounds=_a.xBounds,yBounds=_a.yBounds,zFactor=_a.zFactor,viewportRatio=_a.viewportRatio,currentTransform=_a.currentTransform,xRatio=_a.xRatio,yRatio=_a.yRatio,width=_a.width,height=_a.height;return{xScale:scaleX.copy(),yScale:scaleY.copy(),xBounds:xBounds,yBounds:yBounds,zFactor:zFactor,viewportRatio:viewportRatio,xRatio:xRatio,yRatio:yRatio,width:width,height:height,transform:Object.assign({},currentTransform)}},ZoomPanHandler.prototype.rescale=function(){var currentStateAsEvent=this.currentStateAsEvent;this.onRescale(currentStateAsEvent())},ZoomPanHandler.prototype.init=function(){this.zoom=function(){var touchstarting,touchfirst,touchending,filter=defaultFilter,extent=defaultExtent,constrain=defaultConstrain,wheelDelta=defaultWheelDelta,touchable=defaultTouchable,scaleExtent=[0,1/0],translateExtent=[[-1/0,-1/0],[1/0,1/0]],duration=250,interpolate=interpolateZoom,listeners=dispatch("start","zoom","end"),clickDistance2=0,tapDistance=10;function zoom(selection){selection.property("__zoom",defaultTransform).on("wheel.zoom",wheeled,{passive:!1}).on("mousedown.zoom",mousedowned).on("dblclick.zoom",dblclicked).filter(touchable).on("touchstart.zoom",touchstarted).on("touchmove.zoom",touchmoved).on("touchend.zoom touchcancel.zoom",touchended).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function scale(transform,k){return(k=Math.max(scaleExtent[0],Math.min(scaleExtent[1],k)))===transform.k?transform:new Transform$1(k,transform.x,transform.y)}function translate(transform,p0,p1){var x=p0[0]-p1[0]*transform.k,y=p0[1]-p1[1]*transform.k;return x===transform.x&&y===transform.y?transform:new Transform$1(transform.k,x,y)}function centroid(extent){return[(+extent[0][0]+ +extent[1][0])/2,(+extent[0][1]+ +extent[1][1])/2]}function schedule(transition,transform,point,event){transition.on("start.zoom",(function(){gesture(this,arguments).event(event).start()})).on("interrupt.zoom end.zoom",(function(){gesture(this,arguments).event(event).end()})).tween("zoom",(function(){var that=this,args=arguments,g=gesture(that,args).event(event),e=extent.apply(that,args),p=null==point?centroid(e):"function"==typeof point?point.apply(that,args):point,w=Math.max(e[1][0]-e[0][0],e[1][1]-e[0][1]),a=that.__zoom,b="function"==typeof transform?transform.apply(that,args):transform,i=interpolate(a.invert(p).concat(w/a.k),b.invert(p).concat(w/b.k));return function(t){if(1===t)t=b;else{var l=i(t),k=w/l[2];t=new Transform$1(k,p[0]-l[0]*k,p[1]-l[1]*k)}g.zoom(null,t)}}))}function gesture(that,args,clean){return!clean&&that.__zooming||new Gesture(that,args)}function Gesture(that,args){this.that=that,this.args=args,this.active=0,this.sourceEvent=null,this.extent=extent.apply(that,args),this.taps=0}function wheeled(event,...args){if(filter.apply(this,arguments)){var g=gesture(this,args).event(event),t=this.__zoom,k=Math.max(scaleExtent[0],Math.min(scaleExtent[1],t.k*Math.pow(2,wheelDelta.apply(this,arguments)))),p=pointer(event);if(g.wheel)g.mouse[0][0]===p[0]&&g.mouse[0][1]===p[1]||(g.mouse[1]=t.invert(g.mouse[0]=p)),clearTimeout(g.wheel);else{if(t.k===k)return;g.mouse=[p,t.invert(p)],interrupt(this),g.start()}noevent$1(event),g.wheel=setTimeout(wheelidled,150),g.zoom("mouse",constrain(translate(scale(t,k),g.mouse[0],g.mouse[1]),g.extent,translateExtent))}function wheelidled(){g.wheel=null,g.end()}}function mousedowned(event,...args){if(!touchending&&filter.apply(this,arguments)){var currentTarget=event.currentTarget,g=gesture(this,args,!0).event(event),v=select(event.view).on("mousemove.zoom",mousemoved,!0).on("mouseup.zoom",mouseupped,!0),p=pointer(event,currentTarget),x0=event.clientX,y0=event.clientY;dragDisable(event.view),nopropagation(event),g.mouse=[p,this.__zoom.invert(p)],interrupt(this),g.start()}function mousemoved(event){if(noevent$1(event),!g.moved){var dx=event.clientX-x0,dy=event.clientY-y0;g.moved=dx*dx+dy*dy>clickDistance2}g.event(event).zoom("mouse",constrain(translate(g.that.__zoom,g.mouse[0]=pointer(event,currentTarget),g.mouse[1]),g.extent,translateExtent))}function mouseupped(event){v.on("mousemove.zoom mouseup.zoom",null),yesdrag(event.view,g.moved),noevent$1(event),g.event(event).end()}}function dblclicked(event,...args){if(filter.apply(this,arguments)){var t0=this.__zoom,p0=pointer(event.changedTouches?event.changedTouches[0]:event,this),p1=t0.invert(p0),k1=t0.k*(event.shiftKey?.5:2),t1=constrain(translate(scale(t0,k1),p0,p1),extent.apply(this,args),translateExtent);noevent$1(event),duration>0?select(this).transition().duration(duration).call(schedule,t1,p0,event):select(this).call(zoom.transform,t1,p0,event)}}function touchstarted(event,...args){if(filter.apply(this,arguments)){var started,i,t,p,touches=event.touches,n=touches.length,g=gesture(this,args,event.changedTouches.length===n).event(event);for(nopropagation(event),i=0;i<n;++i)p=[p=pointer(t=touches[i],this),this.__zoom.invert(p),t.identifier],g.touch0?g.touch1||g.touch0[2]===p[2]||(g.touch1=p,g.taps=0):(g.touch0=p,started=!0,g.taps=1+!!touchstarting);touchstarting&&(touchstarting=clearTimeout(touchstarting)),started&&(g.taps<2&&(touchfirst=p[0],touchstarting=setTimeout((function(){touchstarting=null}),500)),interrupt(this),g.start())}}function touchmoved(event,...args){if(this.__zooming){var i,t,p,l,g=gesture(this,args).event(event),touches=event.changedTouches,n=touches.length;for(noevent$1(event),i=0;i<n;++i)p=pointer(t=touches[i],this),g.touch0&&g.touch0[2]===t.identifier?g.touch0[0]=p:g.touch1&&g.touch1[2]===t.identifier&&(g.touch1[0]=p);if(t=g.that.__zoom,g.touch1){var p0=g.touch0[0],l0=g.touch0[1],p1=g.touch1[0],l1=g.touch1[1],dp=(dp=p1[0]-p0[0])*dp+(dp=p1[1]-p0[1])*dp,dl=(dl=l1[0]-l0[0])*dl+(dl=l1[1]-l0[1])*dl;t=scale(t,Math.sqrt(dp/dl)),p=[(p0[0]+p1[0])/2,(p0[1]+p1[1])/2],l=[(l0[0]+l1[0])/2,(l0[1]+l1[1])/2]}else{if(!g.touch0)return;p=g.touch0[0],l=g.touch0[1]}g.zoom("touch",constrain(translate(t,p,l),g.extent,translateExtent))}}function touchended(event,...args){if(this.__zooming){var i,t,g=gesture(this,args).event(event),touches=event.changedTouches,n=touches.length;for(nopropagation(event),touchending&&clearTimeout(touchending),touchending=setTimeout((function(){touchending=null}),500),i=0;i<n;++i)t=touches[i],g.touch0&&g.touch0[2]===t.identifier?delete g.touch0:g.touch1&&g.touch1[2]===t.identifier&&delete g.touch1;if(g.touch1&&!g.touch0&&(g.touch0=g.touch1,delete g.touch1),g.touch0)g.touch0[1]=this.__zoom.invert(g.touch0[0]);else if(g.end(),2===g.taps&&(t=pointer(t,this),Math.hypot(touchfirst[0]-t[0],touchfirst[1]-t[1])<tapDistance)){var p=select(this).on("dblclick.zoom");p&&p.apply(this,arguments)}}}return zoom.transform=function(collection,transform,point,event){var selection=collection.selection?collection.selection():collection;selection.property("__zoom",defaultTransform),collection!==selection?schedule(collection,transform,point,event):selection.interrupt().each((function(){gesture(this,arguments).event(event).start().zoom(null,"function"==typeof transform?transform.apply(this,arguments):transform).end()}))},zoom.scaleBy=function(selection,k,p,event){zoom.scaleTo(selection,(function(){return this.__zoom.k*("function"==typeof k?k.apply(this,arguments):k)}),p,event)},zoom.scaleTo=function(selection,k,p,event){zoom.transform(selection,(function(){var e=extent.apply(this,arguments),t0=this.__zoom,p0=null==p?centroid(e):"function"==typeof p?p.apply(this,arguments):p,p1=t0.invert(p0),k1="function"==typeof k?k.apply(this,arguments):k;return constrain(translate(scale(t0,k1),p0,p1),e,translateExtent)}),p,event)},zoom.translateBy=function(selection,x,y,event){zoom.transform(selection,(function(){return constrain(this.__zoom.translate("function"==typeof x?x.apply(this,arguments):x,"function"==typeof y?y.apply(this,arguments):y),extent.apply(this,arguments),translateExtent)}),null,event)},zoom.translateTo=function(selection,x,y,p,event){zoom.transform(selection,(function(){var e=extent.apply(this,arguments),t=this.__zoom,p0=null==p?centroid(e):"function"==typeof p?p.apply(this,arguments):p;return constrain(identity$3.translate(p0[0],p0[1]).scale(t.k).translate("function"==typeof x?-x.apply(this,arguments):-x,"function"==typeof y?-y.apply(this,arguments):-y),e,translateExtent)}),p,event)},Gesture.prototype={event:function(event){return event&&(this.sourceEvent=event),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(key,transform){return this.mouse&&"mouse"!==key&&(this.mouse[1]=transform.invert(this.mouse[0])),this.touch0&&"touch"!==key&&(this.touch0[1]=transform.invert(this.touch0[0])),this.touch1&&"touch"!==key&&(this.touch1[1]=transform.invert(this.touch1[0])),this.that.__zoom=transform,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(type){var d=select(this.that).datum();listeners.call(type,this.that,new ZoomEvent(type,{sourceEvent:this.sourceEvent,target:zoom,type:type,transform:this.that.__zoom,dispatch:listeners}),d)}},zoom.wheelDelta=function(_){return arguments.length?(wheelDelta="function"==typeof _?_:constant$3(+_),zoom):wheelDelta},zoom.filter=function(_){return arguments.length?(filter="function"==typeof _?_:constant$3(!!_),zoom):filter},zoom.touchable=function(_){return arguments.length?(touchable="function"==typeof _?_:constant$3(!!_),zoom):touchable},zoom.extent=function(_){return arguments.length?(extent="function"==typeof _?_:constant$3([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),zoom):extent},zoom.scaleExtent=function(_){return arguments.length?(scaleExtent[0]=+_[0],scaleExtent[1]=+_[1],zoom):[scaleExtent[0],scaleExtent[1]]},zoom.translateExtent=function(_){return arguments.length?(translateExtent[0][0]=+_[0][0],translateExtent[1][0]=+_[1][0],translateExtent[0][1]=+_[0][1],translateExtent[1][1]=+_[1][1],zoom):[[translateExtent[0][0],translateExtent[0][1]],[translateExtent[1][0],translateExtent[1][1]]]},zoom.constrain=function(_){return arguments.length?(constrain=_,zoom):constrain},zoom.duration=function(_){return arguments.length?(duration=+_,zoom):duration},zoom.interpolate=function(_){return arguments.length?(interpolate=_,zoom):interpolate},zoom.on=function(){var value=listeners.on.apply(listeners,arguments);return value===listeners?zoom:value},zoom.clickDistance=function(_){return arguments.length?(clickDistance2=(_=+_)*_,zoom):Math.sqrt(clickDistance2)},zoom.tapDistance=function(_){return arguments.length?(tapDistance=+_,zoom):tapDistance},zoom}().scaleExtent([this.options.minZoomLevel,this.options.maxZoomLevel]).on("zoom",this.onZoom),this.container.call(this.zoom)},ZoomPanHandler.prototype.onZoom=function(event){var transform=event.transform;transform&&(this.applyTransform(transform),this.rescale())},ZoomPanHandler.prototype.applyTransform=function(transform){var _a=this,width=_a.width,scaleX=_a.scaleX,scaleY=_a.scaleY,xSpan=_a.xSpan;_a.ySpan;var xBounds=_a.xBounds,yBounds=_a.yBounds,zFactor=_a.zFactor,ratio=this.viewportRatio,isXInverted=this.isXInverted,isYInverted=this.isYInverted,unitsPerPixels=xSpan/(width*transform.k),newXSpan=xSpan/transform.k,newYSpan=newXSpan/zFactor/ratio,shiftx=unitsPerPixels*transform.x,shifty=unitsPerPixels/zFactor*transform.y,dx0=xBounds[0]-(isXInverted?-shiftx:shiftx),dy0=yBounds[0]-(isYInverted?-shifty:shifty);scaleX.domain([dx0,dx0+(isXInverted?-newXSpan:newXSpan)]),scaleY.domain([dy0,dy0+(isYInverted?-newYSpan:newYSpan)]),this.currentTransform=transform},ZoomPanHandler.prototype.setViewport=function(cx,cy,displ,duration){void 0===cx&&(cx=null),void 0===cy&&(cy=null),void 0===displ&&(displ=null),void 0===duration&&(duration=null);var _a=this,zoom=_a.zoom,container=_a.container,calculateTransform=_a.calculateTransform;_a.viewportRatio;var scaleX=_a.scaleX,scaleY=_a.scaleY,isXInverted=_a.isXInverted;if(null===cx||null===displ){var xd=scaleX.domain(),dspan=xd[1]-xd[0];null===cx&&(cx=xd[0]+dspan/2||0),null===displ&&(displ=Math.abs(dspan)||1)}if(null===cy){var yd=scaleY.domain();cy=yd[0]+(yd[1]-yd[0])/2||0}var xdispl=isXInverted?-displ:displ,dx0=cx-xdispl/2,t=calculateTransform(dx0,dx0+xdispl,cy);Number.isFinite(duration)&&duration>0?zoom.transform(container.transition().duration(duration),t):zoom.transform(container,t)},ZoomPanHandler.prototype.setBounds=function(xBounds,yBounds){this.xBounds=xBounds,this.yBounds=yBounds,this.recalculateZoomTransform()},ZoomPanHandler.prototype.setTranslateBounds=function(xBounds,yBounds){this.translateBoundsX=xBounds,this.translateBoundsY=yBounds,this.updateTranslateExtent()},ZoomPanHandler.prototype.adjustToSize=function(width,height,force){void 0===force&&(force=!1);var _a=this,oldWidth=_a.width,oldHeight=_a.height,scaleX=_a.scaleX,scaleY=_a.scaleY,recalculateZoomTransform=_a.recalculateZoomTransform,w=0,h=0;if(void 0===width||"boolean"==typeof width){var _b=this.container.node().getBoundingClientRect();w=_b.containerWidth,h=_b.containerHeight}else w=width,h=height;var newWidth=Math.max(1,w),newHeight=Math.max(1,h);(force||oldWidth!==newWidth||oldHeight!==newHeight)&&(scaleX.range([0,newWidth]),scaleY.range([0,newHeight]),recalculateZoomTransform(),this.onRescale(this.currentStateAsEvent()))},ZoomPanHandler.prototype.calculateTransform=function(dx0,dx1,dy){var _a=this,scaleX=_a.scaleX,xSpan=_a.xSpan,xBounds=_a.xBounds,yBounds=_a.yBounds,zFactor=_a.zFactor,ratio=_a.viewportRatio,isXInverted=_a.isXInverted,isYInverted=_a.isYInverted,_b=scaleX.range(),rx1=_b[0],rx2=_b[1],displ=Math.abs(dx1-dx0),k=xSpan/displ,unitsPerPixels=displ/(rx2-rx1),dy0=dy-(isYInverted?-displ:displ)/zFactor/ratio/2,tx=(xBounds[0]-dx0)/(isXInverted?-unitsPerPixels:unitsPerPixels),ty=(yBounds[0]-dy0)/((isYInverted?-unitsPerPixels:unitsPerPixels)/zFactor);return identity$3.translate(tx,ty).scale(k)},ZoomPanHandler.prototype.recalculateZoomTransform=function(){var _a=this,scaleX=_a.scaleX,scaleY=_a.scaleY,container=_a.container,calculateTransform=_a.calculateTransform,updateTranslateExtent=_a.updateTranslateExtent,_b=scaleX.domain(),dx0=_b[0],dx1=_b[1],_c=scaleY.domain(),dy0=_c[0],transform=calculateTransform(dx0,dx1,dy0+(_c[1]-dy0)/2);updateTranslateExtent(),this.zoom.transform(container,transform)},ZoomPanHandler.prototype.setZoomLevelBoundary=function(zoomlevels){return this.zoom.scaleExtent(zoomlevels),this},ZoomPanHandler.prototype.setMaxZoomLevel=function(zoomlevel){var zoomLevels=this.zoom.scaleExtent();return this.zoom.scaleExtent([zoomLevels[0],zoomlevel]),this},ZoomPanHandler.prototype.setMinZoomLevel=function(zoomlevel){var zoomLevels=this.zoom.scaleExtent();return this.zoom.scaleExtent([zoomlevel,zoomLevels[1]]),this},ZoomPanHandler}();function identity$4(x){return x}function translateX(x){return"translate("+x+",0)"}function translateY(y){return"translate(0,"+y+")"}function number$2(scale){return d=>+scale(d)}function center(scale,offset){return offset=Math.max(0,scale.bandwidth()-2*offset)/2,scale.round()&&(offset=Math.round(offset)),d=>+scale(d)+offset}function entering(){return!this.__axis}function axis(orient,scale){var tickArguments=[],tickValues=null,tickFormat=null,tickSizeInner=6,tickSizeOuter=6,tickPadding=3,offset="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,k=1===orient||4===orient?-1:1,x=4===orient||2===orient?"x":"y",transform=1===orient||3===orient?translateX:translateY;function axis(context){var values=null==tickValues?scale.ticks?scale.ticks.apply(scale,tickArguments):scale.domain():tickValues,format=null==tickFormat?scale.tickFormat?scale.tickFormat.apply(scale,tickArguments):identity$4:tickFormat,spacing=Math.max(tickSizeInner,0)+tickPadding,range=scale.range(),range0=+range[0]+offset,range1=+range[range.length-1]+offset,position=(scale.bandwidth?center:number$2)(scale.copy(),offset),selection=context.selection?context.selection():context,path=selection.selectAll(".domain").data([null]),tick=selection.selectAll(".tick").data(values,scale).order(),tickExit=tick.exit(),tickEnter=tick.enter().append("g").attr("class","tick"),line=tick.select("line"),text=tick.select("text");path=path.merge(path.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),tick=tick.merge(tickEnter),line=line.merge(tickEnter.append("line").attr("stroke","currentColor").attr(x+"2",k*tickSizeInner)),text=text.merge(tickEnter.append("text").attr("fill","currentColor").attr(x,k*spacing).attr("dy",1===orient?"0em":3===orient?"0.71em":"0.32em")),context!==selection&&(path=path.transition(context),tick=tick.transition(context),line=line.transition(context),text=text.transition(context),tickExit=tickExit.transition(context).attr("opacity",1e-6).attr("transform",(function(d){return isFinite(d=position(d))?transform(d+offset):this.getAttribute("transform")})),tickEnter.attr("opacity",1e-6).attr("transform",(function(d){var p=this.parentNode.__axis;return transform((p&&isFinite(p=p(d))?p:position(d))+offset)}))),tickExit.remove(),path.attr("d",4===orient||2===orient?tickSizeOuter?"M"+k*tickSizeOuter+","+range0+"H"+offset+"V"+range1+"H"+k*tickSizeOuter:"M"+offset+","+range0+"V"+range1:tickSizeOuter?"M"+range0+","+k*tickSizeOuter+"V"+offset+"H"+range1+"V"+k*tickSizeOuter:"M"+range0+","+offset+"H"+range1),tick.attr("opacity",1).attr("transform",(function(d){return transform(position(d)+offset)})),line.attr(x+"2",k*tickSizeInner),text.attr(x,k*spacing).text(format),selection.filter(entering).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===orient?"start":4===orient?"end":"middle"),selection.each((function(){this.__axis=position}))}return axis.scale=function(_){return arguments.length?(scale=_,axis):scale},axis.ticks=function(){return tickArguments=Array.from(arguments),axis},axis.tickArguments=function(_){return arguments.length?(tickArguments=null==_?[]:Array.from(_),axis):tickArguments.slice()},axis.tickValues=function(_){return arguments.length?(tickValues=null==_?null:Array.from(_),axis):tickValues&&tickValues.slice()},axis.tickFormat=function(_){return arguments.length?(tickFormat=_,axis):tickFormat},axis.tickSize=function(_){return arguments.length?(tickSizeInner=tickSizeOuter=+_,axis):tickSizeInner},axis.tickSizeInner=function(_){return arguments.length?(tickSizeInner=+_,axis):tickSizeInner},axis.tickSizeOuter=function(_){return arguments.length?(tickSizeOuter=+_,axis):tickSizeOuter},axis.tickPadding=function(_){return arguments.length?(tickPadding=+_,axis):tickPadding},axis.offset=function(_){return arguments.length?(offset=+_,axis):offset},axis}var Axis=function(){function Axis(mainGroup,showLabels,labelXDesc,labelYDesc,unitOfMeasure,options){var _this=this;void 0===showLabels&&(showLabels=!0),this._showLabels=!0,this._offsetX=0,this._offsetY=0,this._flipX=!1,this._flipY=!1,this.visible=!0,this.createOrGet=function(name){var mainGroup=_this.mainGroup,res=mainGroup.select("g."+name);return res.empty()&&(res=mainGroup.append("g").attr("class",name)),res},this.mainGroup=mainGroup,this._showLabels=showLabels,this._labelXDesc=labelXDesc,this._labelYDesc=labelYDesc,this._unitOfMeasure=unitOfMeasure,options&&options.offsetX&&(this._offsetX=options.offsetX),options&&options.offsetX&&(this._offsetY=options.offsetY),options&&options.visible&&(this.visible=options.visible),this.mainGroup.style("pointer-events","none"),this._scaleX=linear$1().domain([0,1]).range([0,1]),this._scaleY=linear$1().domain([0,1]).range([0,1])}return Axis.prototype.renderLabelx=function(){var labelXDesc=this._labelXDesc,unitOfMeasure=this._unitOfMeasure,_showLabels=this._showLabels,width=this._scaleX.range()[1],gx=this.renderGx(),labelx=gx.select("text.axis-labelx");return _showLabels?labelx.empty()&&(labelx=gx.append("text").attr("class","axis-labelx").attr("fill","rgba(0,0,0,0.3)").style("text-anchor","middle").style("font-weight","800").style("font-size","10px").text(labelXDesc+" ("+unitOfMeasure+")")):labelx.remove(),labelx.attr("transform","translate("+width/2+",-4)"),labelx},Axis.prototype.renderLabely=function(){var labelYDesc=this._labelYDesc,unitOfMeasure=this._unitOfMeasure,_showLabels=this._showLabels,height=this._scaleY.range()[1],gy=this.renderGy(),labely=gy.select("text.axis-labely");return _showLabels?(labely.empty()&&(labely=gy.append("text").attr("class","axis-labely").attr("fill","rgba(0,0,0,0.3)").style("text-anchor","middle").style("font-weight","800").style("font-size","10px").text(labelYDesc+" ("+unitOfMeasure+")")),labely.attr("transform","translate(-10,"+height/2+")rotate(90)")):labely.remove(),labely},Axis.prototype.renderGy=function(){var _scaleX=this._scaleX,yAxis=function(scale){return axis(2,scale)}(this._scaleY),width=_scaleX.range()[1],gy=this.createOrGet("y-axis");return gy.call(yAxis),gy.attr("transform","translate("+width+",0)"),gy},Axis.prototype.renderGx=function(){var _scaleX=this._scaleX,_scaleY=this._scaleY,xAxis=function(scale){return axis(3,scale)}(_scaleX),height=_scaleY.range()[1],gx=this.createOrGet("x-axis");return gx.attr("transform","translate(0 "+height+")"),gx.call(xAxis),gx},Axis.prototype.render=function(){this.renderLabelx(),this.renderLabely()},Axis.prototype.onResize=function(event){this.mainGroup.attr("height",event.height+"px").attr("width",event.width+"px")},Axis.prototype.onRescale=function(event){var _scaleX=this._scaleX,_scaleY=this._scaleY,offsetX=this.offsetX,offsetY=this.offsetY,xScale=event.xScale,yScale=event.yScale,xBounds=xScale.domain(),yBounds=yScale.domain(),xRange=xScale.range(),yRange=yScale.range();_scaleX.domain([xBounds[0]-offsetX,xBounds[1]-offsetX]).range(xRange),_scaleY.domain([yBounds[0]-offsetY,yBounds[1]-offsetY]).range(yRange),this.flipX(this._flipX),this.flipY(this._flipY),this.visible&&this.render()},Axis.prototype.show=function(){return this.visible=!0,this.mainGroup.attr("visibility","visible"),this.render(),this},Axis.prototype.hide=function(){return this.visible=!1,this.mainGroup.attr("visibility","hidden"),this},Axis.prototype.flipX=function(flipX){this._flipX=flipX;var domain=this._scaleX.domain(),flip=flipX?-1:1;return this._scaleX.domain([flip*domain[0],flip*domain[1]]),this},Axis.prototype.flipY=function(flipY){this._flipY=flipY;var domain=this._scaleY.domain(),flip=flipY?-1:1;return this._scaleY.domain([flip*domain[0],flip*domain[1]]),this},Axis.prototype.showLabels=function(){return this._showLabels=!0,this.render(),this},Axis.prototype.hideLabels=function(){return this._showLabels=!1,this.render(),this},Axis.prototype.setLabelX=function(label){return this._labelXDesc=label,this},Axis.prototype.setLabelY=function(label){return this._labelYDesc=label,this},Axis.prototype.setUnitOfMeasure=function(uom){return this._unitOfMeasure=uom,this},Axis.prototype.setLabels=function(labelX,labelY,unitOfMeasure){return this._labelXDesc=labelX,this._labelYDesc=labelY,this._unitOfMeasure=unitOfMeasure,this},Object.defineProperty(Axis.prototype,"offsetX",{get:function(){return this._offsetX},set:function(offset){this._offsetX=offset},enumerable:!1,configurable:!0}),Object.defineProperty(Axis.prototype,"offsetY",{get:function(){return this._offsetY},set:function(offset){this._offsetY=offset},enumerable:!1,configurable:!0}),Object.defineProperty(Axis.prototype,"scaleX",{get:function(){return this._scaleX.copy()},enumerable:!1,configurable:!0}),Object.defineProperty(Axis.prototype,"scaleY",{get:function(){return this._scaleY.copy()},enumerable:!1,configurable:!0}),Axis}(),LayerManager=function(){function LayerManager(container,scaleOptions,axisOptions){var _this=this;if(this.layers=[],this.createAxis=function(options){var container=_this.container;_this._svgContainer=select(container).append("div").attr("class","axis").style("position","absolute").style("z-index","10").style("pointer-events","none");var svg=_this._svgContainer.append("svg").attr("height",container.offsetHeight+"px").attr("width",container.offsetWidth+"px");return new Axis(svg,!0,options.xLabel,options.yLabel,options.unitOfMeasure)},this.container=container,this.layerContainer=document.createElement("div"),this.layerContainer.className="layer-container",this.container.appendChild(this.layerContainer),this.adjustToSize(+this.container.getAttribute("width"),+this.container.getAttribute("height")),this._zoomPanHandler=new ZoomPanHandler(container,(function(event){return _this.rescale(event)})),scaleOptions){var xMin=scaleOptions.xMin,xMax=scaleOptions.xMax,yMin=scaleOptions.yMin,yMax=scaleOptions.yMax,xBounds=scaleOptions.xBounds,yBounds=scaleOptions.yBounds;void 0!==xMin&&void 0!==xMax&&void 0!==yMin&&void 0!==yMax&&this._zoomPanHandler.setBounds([xMin,xMax],[yMin,yMax]),xBounds&&yBounds&&this._zoomPanHandler.setBounds(xBounds,yBounds)}else this._zoomPanHandler.setBounds([0,1],[0,1]);axisOptions&&(this._axis=this.createAxis(axisOptions)),this.rescale=this.rescale.bind(this)}return LayerManager.prototype.addLayers=function(layers){var _this=this;return layers.forEach((function(layer){return _this.addLayer(layer)})),this},LayerManager.prototype.getLayers=function(){return this.layers},LayerManager.prototype.clearAllData=function(includeReferenceSystem){return void 0===includeReferenceSystem&&(includeReferenceSystem=!0),this.layers.forEach((function(l){return l.clearData(includeReferenceSystem)})),this},LayerManager.prototype.addLayer=function(layer,params){return this.layers.push(layer),this.initLayer(layer,params),this},LayerManager.prototype.removeLayer=function(layerId){var layer=this.layers.find((function(l){return l.id===layerId}));return layer&&(layer.onUnmount(),this.layers=this.layers.filter((function(l){return l.id!==layerId}))),this},LayerManager.prototype.removeAllLayers=function(){var _this=this;return this.layers.forEach((function(layer){_this.removeLayer(layer.id)})),this},LayerManager.prototype.getLayer=function(layerId){return this.layers.find((function(l){return l.id===layerId}))},LayerManager.prototype.initLayer=function(layer,params){var event={elm:this.layerContainer};layer.onMount(event);var rescaleEvent=this.zoomPanHandler.currentStateAsEvent();if(layer.onUpdate(__assign(__assign({},rescaleEvent),params)),layer.onRescale(rescaleEvent),this._svgContainer){var highestZIndex=this.layers.length>0?this.layers.reduce((function(max,layers){return max.order>layers.order?max:layers})).order:1;this._svgContainer.style("z-index",""+(highestZIndex+1))}return this},LayerManager.prototype.showLayer=function(layerId){var layer=this.getLayer(layerId);return layer.setVisibility(!0),layer.onRescale(this.zoomPanHandler.currentStateAsEvent()),this},LayerManager.prototype.hideLayer=function(layerId){return this.getLayer(layerId).setVisibility(!1),this},LayerManager.prototype.adjustToSize=function(width,height){var layersWidth=Math.max(this._axis?width-40:width,0),layersHeight=Math.max(this._axis?height-30:height,0);if(this._axis){var resizeEvent={width:width,height:height};this._axis.onResize(resizeEvent)}if(this.layers){var resizeEvent_1={width:layersWidth,height:layersHeight};this.layers.forEach((function(layer){return layer.onResize(resizeEvent_1)}))}this._zoomPanHandler&&this._zoomPanHandler.adjustToSize(layersWidth,layersHeight,!0)},LayerManager.prototype.setReferenceSystem=function(irs){this.layers.forEach((function(layer){return layer.referenceSystem=irs}))},LayerManager.prototype.showAxis=function(){return this._axis.show(),this},LayerManager.prototype.hideAxis=function(){return this._axis.hide(),this},LayerManager.prototype.showAxisLabels=function(){return this._axis.showLabels(),this},LayerManager.prototype.hideAxisLabels=function(){return this._axis.hideLabels(),this},LayerManager.prototype.setAxisOffset=function(x,y){return this._axis.offsetX=x,this._axis.offsetY=y,this.layers.filter((function(l){return l instanceof GridLayer})).forEach((function(l){l.offsetX=x,l.offsetY=y})),this},LayerManager.prototype.setXAxisOffset=function(x){return this._axis.offsetX=x,this.layers.filter((function(l){return l instanceof GridLayer})).forEach((function(l){l.offsetX=x})),this},LayerManager.prototype.setYAxisOffset=function(y){return this._axis.offsetY=y,this.layers.filter((function(l){return l instanceof GridLayer})).forEach((function(l){l.offsetY=y})),this},LayerManager.prototype.setZoomLevelBoundary=function(zoomlevels){return this._zoomPanHandler.setZoomLevelBoundary(zoomlevels),this},LayerManager.prototype.setMaxZoomLevel=function(zoomlevel){return this._zoomPanHandler.setMaxZoomLevel(zoomlevel),this},LayerManager.prototype.setMinZoomLevel=function(zoomlevel){return this._zoomPanHandler.setMinZoomLevel(zoomlevel),this},LayerManager.prototype.destroy=function(){return this.removeAllLayers(),this.layerContainer.remove(),this.layerContainer=void 0,this.container=void 0,this.layers=void 0,this._zoomPanHandler=void 0,this._axis=void 0,this._svgContainer=void 0,this},Object.defineProperty(LayerManager.prototype,"zoomPanHandler",{get:function(){return this._zoomPanHandler},enumerable:!1,configurable:!0}),Object.defineProperty(LayerManager.prototype,"axis",{get:function(){return this._axis},enumerable:!1,configurable:!0}),LayerManager.prototype.rescale=function(event){this._axis&&this._axis.onRescale(event),this.layers&&this.layers.forEach((function(layer){return!0===layer.isVisible?layer.onRescale(event):{}}))},LayerManager}(),RootFinder=function(){function RootFinder(){}return RootFinder.newton=function(func,precision,maxIterations,start,minLimit,maxLimit){void 0===precision&&(precision=.01),void 0===maxIterations&&(maxIterations=1e3),void 0===start&&(start=.5),void 0===minLimit&&(minLimit=0),void 0===maxLimit&&(maxLimit=1);for(var h=1e-4,t=start,i=0;i<maxIterations;i++){var v=func(t);if(Math.abs(v)<precision)return clamp(t,minLimit,maxLimit);t-=v/((func(t+h)-v)/h)}return null},RootFinder.bisect=function(func,precision,maxIterations,start,minLimit,maxLimit){void 0===precision&&(precision=.01),void 0===maxIterations&&(maxIterations=1e3),void 0===start&&(start=.5),void 0===minLimit&&(minLimit=0),void 0===maxLimit&&(maxLimit=1);var v,i,tl=minLimit,th=maxLimit,t=start;for(i=0;i<maxIterations;i++){if(v=func(t),Math.abs(v)<precision)return t;v<0?th=t:tl=t,t=(th+tl)/2}return t},RootFinder.findRoot=function(func,precision,maxIterations,start,minLimit,maxLimit){void 0===precision&&(precision=.01),void 0===maxIterations&&(maxIterations=1e3),void 0===start&&(start=.5),void 0===minLimit&&(minLimit=0),void 0===maxLimit&&(maxLimit=1);var t=RootFinder.newton(func,precision,maxIterations,start);return null==t&&(t=RootFinder.bisect(func,precision,maxIterations,start,minLimit,maxLimit)),t},RootFinder}(),ArcLength=function(){function ArcLength(){}return ArcLength.bisect=function(func,minLimit,maxLimit,tolerance,minDepth,maxDepth){void 0===minLimit&&(minLimit=0),void 0===maxLimit&&(maxLimit=1),void 0===tolerance&&(tolerance=.005),void 0===minDepth&&(minDepth=4),void 0===maxDepth&&(maxDepth=10);var calcRec=function(a,b,aVal,bVal,span,tolerance,depth){void 0===depth&&(depth=0);var mid=(a+b)/2,midVal=func(mid),spanA=Vector2.distance(aVal,midVal),spanB=Vector2.distance(midVal,bVal),length=spanA+spanB;if(depth>=minDepth&&Math.abs(length-span)<tolerance||depth>=maxDepth)return length;var tol=tolerance/2,d=depth+1;return calcRec(a,mid,aVal,midVal,spanA,tol,d)+calcRec(mid,b,midVal,bVal,spanB,tol,d)},aVal=func(minLimit),bVal=func(maxLimit),span=Vector2.distance(aVal,bVal);return calcRec(minLimit,maxLimit,aVal,bVal,span,tolerance)},ArcLength.trapezoid=function(func,minLimit,maxLimit,segments){void 0===minLimit&&(minLimit=0),void 0===maxLimit&&(maxLimit=1),void 0===segments&&(segments=1e3);for(var length=0,lastPos=func(minLimit),step=(maxLimit-minLimit)/(segments-1),i=1;i<segments;i++){var pos=func(minLimit+i*step);length+=Vector2.distance(lastPos,pos),lastPos=pos}return length},ArcLength}(),BinarySearch=function(){function BinarySearch(){}return BinarySearch.search=function(values,searchValue){for(var il=0,ih=values.length-1,i=Math.floor(il+ih/2);i>il&&i<ih;){var v=values[i],v1=values[i+1];if(v<=searchValue&&v1>=searchValue)return i;searchValue<v?ih=i:il=i,i=Math.floor(il+ih/2)}return i},BinarySearch}(),ExtendedCurveInterpolator=function(_super){function ExtendedCurveInterpolator(points,options){var _this=_super.call(this,points,options)||this;return _this.arcLengthLookup=[],_this.findTForArcLength=_this.findTForArcLength.bind(_this),_this.findTByRootForArcLength=_this.findTByRootForArcLength.bind(_this),_this.findApproxTForArcLength=_this.findApproxTForArcLength.bind(_this),_this.findTQuickForArcLength=_this.findTQuickForArcLength.bind(_this),_this.generateArcLengthLookup=_this.generateArcLengthLookup.bind(_this),_this.getArcLength=_this.getArcLength.bind(_this),_this.getQuickArcLength=_this.getQuickArcLength.bind(_this),_this.getPointAtArcLength=_this.getPointAtArcLength.bind(_this),_this.getPointAt=_this.getPointAt.bind(_this),_this}return __extends(ExtendedCurveInterpolator,_super),ExtendedCurveInterpolator.prototype.findTForArcLength=function(arcLength,options){return(null==options?void 0:options.approxT)?this.findApproxTForArcLength(arcLength,null==options?void 0:options.normalizedLength):(null==options?void 0:options.quickT)?this.findTQuickForArcLength(arcLength):this.findTByRootForArcLength(arcLength)},ExtendedCurveInterpolator.prototype.findTByRootForArcLength=function(arcLength,tolerance,iterations){var _this=this;if(void 0===tolerance&&(tolerance=.01),void 0===iterations&&(iterations=100),arcLength<=0)return 0;if(arcLength>=this.length)return 1;var t=RootFinder.findRoot((function(x){return arcLength-_this.getQuickArcLength(0,x)}),tolerance,iterations,arcLength/this.length);return t},ExtendedCurveInterpolator.prototype.findApproxTForArcLength=function(arcLength,normalizedLength){return arcLength/(normalizedLength||this.length)},ExtendedCurveInterpolator.prototype.findTQuickForArcLength=function(arcLength){0===this.arcLengthLookup.length&&this.generateArcLengthLookup();var index=BinarySearch.search(this.arcLengthLookup,arcLength),v1=this.arcLengthLookup[index];return(index+(arcLength-v1)/(this.arcLengthLookup[index+1]-v1))/this.arcLengthLookup.length},ExtendedCurveInterpolator.prototype.generateArcLengthLookup=function(segments){void 0===segments&&(segments=1e3);for(var lastPos=this.getPointAt(0),length=0,i=0;i<segments;i++){var pos=this.getPointAt(i/(segments-1));length+=Vector2.distance(lastPos,pos),this.arcLengthLookup.push(length),lastPos=pos}},ExtendedCurveInterpolator.prototype.getArcLength=function(from,to){var _this=this;return void 0===from&&(from=0),void 0===to&&(to=1),0===from&&1===to?this.length:ArcLength.bisect((function(t){return _this.getPointAt(t)}),from,to,.002)},ExtendedCurveInterpolator.prototype.getQuickArcLength=function(from,to){void 0===from&&(from=0),void 0===to&&(to=1);var fromLength=0,toLength=this.length;if(0===this.arcLengthLookup.length&&this.generateArcLengthLookup(),0!==from){var fromIndex=Math.floor(from*this.arcLengthLookup.length),fromLl=this.arcLengthLookup[fromIndex],fromLh=this.arcLengthLookup[fromIndex+1];fromLength=fromLl+from*this.arcLengthLookup.length%this.arcLengthLookup.length*(fromLh-fromLl)}if(1!==to){var toIndex=Math.floor(to*this.arcLengthLookup.length),toLl=this.arcLengthLookup[toIndex],toLh=this.arcLengthLookup[toIndex+1];toLength=toLl+from*this.arcLengthLookup.length%this.arcLengthLookup.length*(toLh-toLl)}return toLength-fromLength},ExtendedCurveInterpolator.prototype.getPointAtArcLength=function(arcLength,options){var t=this.findTForArcLength(arcLength,options);return this.getPointAt(t)},ExtendedCurveInterpolator.prototype.getPointAt=function(t){var tl=clamp(t,0,1);return _super.prototype.getPointAt.call(this,tl)},ExtendedCurveInterpolator}(CurveInterpolator),defaultOptions$2={approxT:!0},IntersectionReferenceSystem=function(){function IntersectionReferenceSystem(path,options){if(this.path=[],this.projectedPath=[],this._offset=0,path.length<1)throw new Error("Missing coordinates");if(path[0]&&3!==path[0].length)throw new Error("Coordinates should be in 3d");this.setPath(path,options),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.getPosition=this.getPosition.bind(this),this.getProjectedLength=this.getProjectedLength.bind(this),this.getTrajectory=this.getTrajectory.bind(this)}return IntersectionReferenceSystem.prototype.setPath=function(path,options){void 0===options&&(options={}),this.options=__assign(__assign({},defaultOptions$2),options);var _a=this.options,arcDivisions=_a.arcDivisions,tension=_a.tension,calculateDisplacementFromBottom=_a.calculateDisplacementFromBottom;this.path=path,this.projectedPath=IntersectionReferenceSystem.toDisplacement(path);var displacement=this.projectedPath[this.projectedPath.length-1][0];this.displacement=displacement,this.interpolators={curve:options.curveInterpolator||new ExtendedCurveInterpolator(path),trajectory:options.trajectoryInterpolator||new ExtendedCurveInterpolator(path.map((function(d){return[d[0],d[1]]})),{tension:tension||.75,arcDivisions:arcDivisions||5e3}),curtain:options.curtainInterpolator||new ExtendedCurveInterpolator(this.projectedPath,{tension:tension||.75,arcDivisions:arcDivisions||5e3})};var trajVector=this.getTrajectoryVector(),negativeTrajVector=trajVector.map((function(d){return-1*d}));calculateDisplacementFromBottom?(this.endVector=negativeTrajVector,this.startVector=trajVector):(this.endVector=trajVector,this.startVector=negativeTrajVector),this._curtainPathCache=void 0},IntersectionReferenceSystem.prototype.project=function(length){var curtain=this.interpolators.curtain,cl=clamp(this.options.calculateDisplacementFromBottom?this.length-(length-this._offset):length-this._offset,0,this.length);return curtain.getPointAtArcLength(cl,this.options)},IntersectionReferenceSystem.prototype.curtainTangent=function(length){var curtain=this.interpolators.curtain,l=length-this._offset,t=curtain.findTForArcLength(l,this.options);return t&&curtain.getTangentAt(t)},IntersectionReferenceSystem.prototype.getCurtainPath=function(start,end){if(!this._curtainPathCache){for(var points=[],prevAngle=2*Math.PI,i=this._offset;i<=this.length+this._offset;i+=.1){var point=this.project(i),angle=Math.atan2(point[1],point[0]);Math.abs(angle-prevAngle)>5e-4&&(points.push({point:point,md:i}),prevAngle=angle)}this._curtainPathCache=points}return this._curtainPathCache.filter((function(p){return p.md>=start&&p.md<=end}))},IntersectionReferenceSystem.prototype.unproject=function(displacement){var _a=this.options,normalizedLength=_a.normalizedLength,displacementFromStart=_a.calculateDisplacementFromBottom?this.displacement-displacement:displacement,length=normalizedLength||this.length;if(displacementFromStart<0)return displacementFromStart;if(displacementFromStart>this.displacement)return length+(displacementFromStart-this.displacement);var ls=this.interpolators.curtain.lookupPositions(displacementFromStart,0,1);return ls&&ls.length?ls[0]*length+this._offset:null},IntersectionReferenceSystem.prototype.getProjectedLength=function(length){var curtain=this.interpolators.curtain,l=this.project(length)[0]/curtain.maxX;return Number.isFinite(l)?clamp(l,0,1):0},IntersectionReferenceSystem.prototype.getPosition=function(length){var trajectory=this.interpolators.trajectory,t=this.getProjectedLength(length);return trajectory.getPointAt(t)},IntersectionReferenceSystem.prototype.getTrajectory=function(steps,from,to){void 0===from&&(from=0),void 0===to&&(to=1);var p0,p3,extensionStart=from<0?-from:0,extensionEnd=to>1?to-1:0,refStart=this.interpolators.trajectory.getPointAt(0),refEnd=this.interpolators.trajectory.getPointAt(1),offset=0,t0=Math.max(0,from),t1=Math.min(1,to),p1=this.interpolators.trajectory.getPointAt(t0),p2=this.interpolators.trajectory.getPointAt(t1);extensionStart?(p0=[refStart[0]+this.startVector[0]*extensionStart*this.displacement,refStart[1]+this.startVector[1]*extensionStart*this.displacement],offset=-Vector2.distance(p0,refStart)):from>0&&(offset=Vector2.distance(p1,refStart)),extensionEnd&&(p3=[refEnd[0]+this.endVector[0]*extensionEnd*this.displacement,refEnd[1]+this.endVector[1]*extensionEnd*this.displacement]);var points=[],tl=to-from,preSteps=Math.floor(extensionStart/tl*steps),curveSteps=Math.ceil((t1-t0)/tl*steps),postSteps=steps-curveSteps-preSteps;if(p0){points.push(p0);for(var i=1;i<preSteps;i++){var f=i/preSteps*extensionStart*this.displacement;points.push([p0[0]-this.startVector[0]*f,p0[1]-this.startVector[1]*f])}}var curvePoints=this.interpolators.trajectory.getPoints(curveSteps-1,null,t0,t1);if(points.push.apply(points,curvePoints),p3){for(i=1;i<postSteps-1;i++){f=i/postSteps*extensionEnd*this.displacement;points.push([p2[0]+this.endVector[0]*f,p2[1]+this.endVector[1]*f])}points.push(p3)}return{points:points,offset:offset}},IntersectionReferenceSystem.prototype.getExtendedTrajectory=function(numPoints,startExtensionLength,endExtensionLength){if(void 0===startExtensionLength&&(startExtensionLength=1e3),void 0===endExtensionLength&&(endExtensionLength=1e3),!isFinite(startExtensionLength)||startExtensionLength<0)throw new Error("Invalid parameter, getExtendedTrajectory() must be called with a valid and positive startExtensionLength parameter");if(!isFinite(endExtensionLength)||endExtensionLength<0)throw new Error("Invalid parameter, getExtendedTrajectory() must be called with a valid and positive endExtensionLength parameter");for(var totalLength=this.displacement+startExtensionLength+endExtensionLength,startExtensionNumPoints=Math.floor(startExtensionLength/totalLength*numPoints),curveSteps=Math.max(Math.ceil(this.displacement/totalLength*numPoints),1),endExtensionNumPoints=numPoints-curveSteps-startExtensionNumPoints,points=[],refStart=new Vector2(this.interpolators.trajectory.getPointAt(0)),startVec=new Vector2(this.startVector),startExtensionStepLength=startExtensionLength/startExtensionNumPoints,i=startExtensionNumPoints;i>0;i--){var f=i*startExtensionStepLength,point=refStart.add(startVec.scale(f));points.push(point.toArray())}points.push.apply(points,this.interpolators.trajectory.getPoints(curveSteps,null,0,1));var refEnd=new Vector2(this.interpolators.trajectory.getPointAt(1)),endVec=new Vector2(this.endVector),endExtensionStepLength=endExtensionLength/(endExtensionNumPoints-1);for(i=1;i<endExtensionNumPoints;i++){f=i*endExtensionStepLength,point=refEnd.add(endVec.scale(f));points.push(point.toArray())}return{points:points,offset:-startExtensionLength}},IntersectionReferenceSystem.prototype.getTrajectoryVector=function(){var _a=this.options,trajectoryAngle=_a.trajectoryAngle,calculateDisplacementFromBottom=_a.calculateDisplacementFromBottom;if(isFinite(trajectoryAngle)){var angleInRad=trajectoryAngle*DEG2RAD;return new Vector2(Math.cos(angleInRad),Math.sin(angleInRad)).toArray()}return IntersectionReferenceSystem.getDirectionVector(this.interpolators.trajectory,calculateDisplacementFromBottom?.001:.999,calculateDisplacementFromBottom?0:1)},IntersectionReferenceSystem.toDisplacement=function(points,offset){void 0===offset&&(offset=0);var p0=points[0],l=0;return points.map((function(p1){var dx=p1[0]-p0[0],dy=p1[1]-p0[1];return l+=Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2)),p0=p1,[offset>0?offset-l:l,p1[2]||0]}))},IntersectionReferenceSystem.getDirectionVector=function(interpolator,from,to){var p1=interpolator.getPointAt(to),p2=interpolator.getPointAt(from);return normalize$2([p1[0]-p2[0],p1[1]-p2[1]])},Object.defineProperty(IntersectionReferenceSystem.prototype,"length",{get:function(){return this.interpolators.curve.length},enumerable:!1,configurable:!0}),Object.defineProperty(IntersectionReferenceSystem.prototype,"offset",{get:function(){return this._offset},set:function(offset){this._curtainPathCache=void 0,this._offset=offset},enumerable:!1,configurable:!0}),IntersectionReferenceSystem}(),Overlay=function(){function Overlay(caller,container){var _this=this;this.elements={},this.listeners={},this.enabled=!0;var con=select(container);this.elm=con.append("div").attr("id","overlay").style("z-index","11").style("position","absolute"),this.source=this.elm.node();var elm=this.elm;elm.on("resize",(function(event){var _a=event.detail,width=_a.width,height=_a.height;elm.style("width",width+"px").style("height",height+"px"),_this.enabled&&Object.keys(_this.listeners).forEach((function(key){var target=_this.elements[key]||null,ops=_this.listeners[key];ops&&ops.onResize&&requestAnimationFrame((function(){return ops.onResize({target:target,source:_this.source,caller:caller,width:width,height:height})}))}))})),elm.on("mousemove",(function(event){if(_this.enabled){var _a=pointer(event,_this.elm.node()),mx=_a[0],my=_a[1];Object.keys(_this.listeners).forEach((function(key){var target=_this.elements[key]||null,ops=_this.listeners[key];ops&&ops.onMouseMove&&requestAnimationFrame((function(){return ops.onMouseMove({x:mx,y:my,target:target,source:_this.source,caller:caller})}))}))}})),elm.on("mouseout",(function(){_this.enabled&&Object.keys(_this.listeners).forEach((function(key){var target=_this.elements[key]||null,ops=_this.listeners[key];ops&&ops.onMouseExit&&requestAnimationFrame((function(){return ops.onMouseExit({target:target,source:_this.source,caller:caller})}))}))}))}return Overlay.prototype.create=function(key,callbacks){var newElm=this.elm.append("div").style("position","relative").style("pointer-events","none").node();return this.elements[key]=newElm,callbacks&&(this.listeners[key]=callbacks),newElm},Overlay.prototype.register=function(key,callbacks){this.listeners[key]=callbacks},Overlay.prototype.remove=function(key){var el=this.elements[key];el&&(select(el).remove(),delete this.elements[key]),delete this.listeners[key]},Overlay.prototype.setZIndex=function(zIndex){this.elm.style("z-index",zIndex)},Overlay.prototype.destroy=function(){this.source.remove()},Overlay}(),Controller=function(){function Controller(options){var container=options.container,axisOptions=options.axisOptions,scaleOptions=options.scaleOptions,referenceSystem=options.referenceSystem,layers=options.layers,path=options.path;this._referenceSystem=referenceSystem||path&&new IntersectionReferenceSystem(path),this._overlay=function(caller,container){return new Overlay(caller,container)}(this,container),this.layerManager=new LayerManager(this._overlay.elm.node(),scaleOptions,axisOptions),layers&&(this.layerManager.addLayers(layers),this.setOverlayZIndex(layers))}return Controller.prototype.setReferenceSystem=function(referenceSystem){return this._referenceSystem=referenceSystem,this.layerManager.setReferenceSystem(referenceSystem),this},Controller.prototype.updatePath=function(path,options){return this.setReferenceSystem(new IntersectionReferenceSystem(path,options)),this},Controller.prototype.clearAllData=function(includeReferenceSystem){return void 0===includeReferenceSystem&&(includeReferenceSystem=!0),this.layerManager.clearAllData(includeReferenceSystem),this},Controller.prototype.addLayer=function(layer,params){return this.layerManager.addLayer(layer,params),this.setOverlayZIndex(this.layerManager.getLayers()),this},Controller.prototype.removeLayer=function(layerId){return this.layerManager.removeLayer(layerId),this},Controller.prototype.removeAllLayers=function(){return this.layerManager.removeAllLayers(),this},Controller.prototype.getLayer=function(layerId){return this.layerManager.getLayer(layerId)},Controller.prototype.showLayer=function(layerId){return this.layerManager.showLayer(layerId),this},Controller.prototype.hideLayer=function(layerId){return this.layerManager.hideLayer(layerId),this},Controller.prototype.adjustToSize=function(width,height){this.layerManager.adjustToSize(width,height);var dimensions={width:Math.max(width-40,0),height:Math.max(height-30,0)};return this.overlay.elm.dispatch("resize",{detail:dimensions,bubbles:!0,cancelable:!0}),this},Controller.prototype.setViewport=function(cx,cy,displacement,duration){return this.zoomPanHandler.setViewport(cx,cy,displacement,duration),this},Controller.prototype.setBounds=function(xBounds,yBounds){return this.zoomPanHandler.setBounds(xBounds,yBounds),this},Controller.prototype.showAxis=function(){return this.layerManager.showAxis(),this},Controller.prototype.hideAxis=function(){return this.layerManager.hideAxis(),this},Controller.prototype.showAxisLabels=function(){return this.layerManager.showAxisLabels(),this},Controller.prototype.hideAxisLabels=function(){return this.layerManager.hideAxisLabels(),this},Controller.prototype.setAxisOffset=function(x,y){return this.layerManager.setAxisOffset(x,y),this},Controller.prototype.setXAxisOffset=function(x){return this.layerManager.setXAxisOffset(x),this},Controller.prototype.setYAxisOffset=function(y){return this.layerManager.setYAxisOffset(y),this},Controller.prototype.setZoomLevelBoundary=function(zoomlevels){return this.zoomPanHandler.setZoomLevelBoundary(zoomlevels),this},Controller.prototype.setMaxZoomLevel=function(zoomlevel){return this.zoomPanHandler.setMaxZoomLevel(zoomlevel),this},Controller.prototype.setMinZoomLevel=function(zoomlevel){return this.zoomPanHandler.setMinZoomLevel(zoomlevel),this},Controller.prototype.destroy=function(){return this.layerManager.destroy(),this._overlay.destroy(),this._referenceSystem=void 0,this.layerManager=void 0,this._overlay=void 0,this},Controller.prototype.getHighestZIndex=function(layers){return layers.length>0?layers.reduce((function(max,layers){return max.order>layers.order?max:layers})).order:1},Controller.prototype.setOverlayZIndex=function(layers){var highestZIndex=this.getHighestZIndex(layers);this.overlay.setZIndex(highestZIndex+2)},Object.defineProperty(Controller.prototype,"overlay",{get:function(){return this._overlay},enumerable:!1,configurable:!0}),Object.defineProperty(Controller.prototype,"referenceSystem",{get:function(){return this._referenceSystem},enumerable:!1,configurable:!0}),Object.defineProperty(Controller.prototype,"zoomPanHandler",{get:function(){return this.layerManager.zoomPanHandler},enumerable:!1,configurable:!0}),Object.defineProperty(Controller.prototype,"axis",{get:function(){return this.layerManager.axis},enumerable:!1,configurable:!0}),Object.defineProperty(Controller.prototype,"currentStateAsEvent",{get:function(){return this.zoomPanHandler.currentStateAsEvent()},enumerable:!1,configurable:!0}),Controller}();exports.Axis=Axis,exports.CalloutCanvasLayer=CalloutCanvasLayer,exports.CanvasLayer=CanvasLayer,exports.CasingLayer=CasingLayer,exports.CementLayer=CementLayer,exports.CompletionLayer=CompletionLayer,exports.Controller=Controller,exports.GeomodelCanvasLayer=GeomodelCanvasLayer,exports.GeomodelLabelsLayer=GeomodelLabelsLayer,exports.GeomodelLayer=GeomodelLayer,exports.GeomodelLayerV2=GeomodelLayerV2,exports.GridLayer=GridLayer,exports.HTMLLayer=HTMLLayer,exports.HoleSizeLayer=HoleSizeLayer,exports.ImageLayer=ImageLayer,exports.IntersectionReferenceSystem=IntersectionReferenceSystem,exports.Layer=Layer,exports.LayerManager=LayerManager,exports.PixiLayer=PixiLayer,exports.SVGLayer=SVGLayer,exports.SeismicCanvasLayer=SeismicCanvasLayer,exports.WellborepathLayer=WellborepathLayer,exports.ZoomPanHandler=ZoomPanHandler,exports.calcSize=calcSize,exports.findIndexOfSample=findIndexOfSample,exports.findSampleAtPos=findSampleAtPos,exports.generateProjectedTrajectory=function(poslog,defaultIntersectionAngle){if(!poslog||0===poslog.length)return[];var points=poslog?poslog.map((function(p){return[p.easting,p.northing,p.tvd,p.md]})):[],interpolator=new CurveInterpolator(points,{tension:.75,arcDivisions:5e3}),displacement=interpolator.length,nPoints=Math.round(10*displacement),path=null,first=(path=nPoints>0?simplify(interpolator.getPoints(nPoints),5e-4,10):[[points[0][0],points[0][1]]])[0],last=path[path.length-1],relativeDist=Vector2.distance(first,last),v=null;if(relativeDist<150){var radCurtainDirection=defaultIntersectionAngle/180*Math.PI;v=new Vector2(Math.cos(radCurtainDirection),Math.sin(radCurtainDirection)).mutable}else v=function(path,threshold){for(var res=Vector2.zero.mutable,len=0,temp=Vector2.zero.mutable,i=0;i<path.length-1;i++){var index=path.length-1-i;if(temp.set(path[index]).sub(path[index-1]),res.add(temp),(len=res.magnitude)>threshold)break}return 0===len?new Vector2([0,0]):res.scale(1/len)}(path,30);var extensionLengthStart=Math.max(0,1e3-displacement),offset=extensionLengthStart+displacement,trajectory=[],firstPoints=[],initial=v.toArray();extensionLengthStart>0&&((firstPoints=seqI(Math.ceil(.1*extensionLengthStart)).map((function(t){return v.set(initial).scale(extensionLengthStart*(1-t)).subFrom(first).toArray()}))).pop(),trajectory.push.apply(trajectory,firstPoints)),trajectory.push.apply(trajectory,path);var endPoints=seqI(Math.ceil(100)).map((function(t){return v.set(initial).scale(1e3*t).add(last).toArray()})).splice(1);return trajectory.push.apply(trajectory,endPoints),Vector2.angleRight(initial),projectCurtain(trajectory,null,offset)},exports.generateProjectedWellborePath=function(poslog){if(!poslog||0===poslog.length)return[];var points=poslog?poslog.map((function(p){return[p.easting,p.northing,p.tvd,p.md]})):[],projection=simplify(projectCurtain(points)),offset=projection[projection.length-1][0];return projection.forEach((function(p,i){projection[i][0]=offset-p[0]})),projection},exports.generateSeismicSliceImage=function(data,trajectory,colormap,options){return __awaiter(this,void 0,void 0,(function(){var dp,min,max,absMax,dmin,dmax,domain,length,width,height,colorTable,d,offset,colorFactor,pos,step,val1,val2,i,col,black,opacity,x,index,x1,x2,ratio,y,imageData;return __generator(this,(function(_a){switch(_a.label){case 0:if(!(data&&data.datapoints&&data.datapoints.length>0))return[2];for(dp=data.datapoints,min=(null==options?void 0:options.seismicMin)||(null==options?void 0:options.seismicRange)||dp.reduce((function(val,array){return Math.min.apply(Math,__spreadArray(__spreadArray([],array),[val]))}),0),max=(null==options?void 0:options.seismicMax)||(null==options?void 0:options.seismicRange)||dp.reduce((function(val,array){return Math.max.apply(Math,__spreadArray(__spreadArray([],array),[val]))}),0),absMax=Math.max(Math.abs(min),Math.abs(max)),domain={min:dmin=-absMax,max:dmax=absMax,difference:dmax-dmin},length=trajectory[0][0]-trajectory[trajectory.length-1][0],width=Math.abs(Math.floor(length/5)),height=data.yAxisValues.length,1e3,size=1e3,colorDomain=(colorMap=colormap).map((function(v,i){return i*size/colorMap.length})),colorScale=linear$1().domain(colorDomain).range(colorMap),table=Array.from(new Array(size).keys()).map((function(i){var rgb=color(colorScale(i)).rgb();return[rgb.r,rgb.g,rgb.b]})),colorTable=table,d=new Uint8ClampedArray(width*height*4),offset=0,colorFactor=999/domain.difference,pos=(null==options?void 0:options.isLeftToRight)?trajectory[0][0]:trajectory[trajectory.length-1][0],step=length/width*((null==options?void 0:options.isLeftToRight)?-1:1),black=[0,0,0],x=0;x<width;x++){for(offset=4*x,index=findIndexOfSample(trajectory,pos),x1=trajectory[index][0],x2=trajectory[index+1][0],ratio=(pos-x1)/(x2-x1),y=0;y<height;y++)val1=dp[y][index],val2=dp[y][index+1],null==val1||null==val2?(col=black,opacity=0):(i=clamp(~~(i=(val1*(1-ratio)+val2*ratio-domain.min)*colorFactor),0,999),col=colorTable[i],opacity=255),d.set([col[0],col[1],col[2],opacity],offset),offset+=4*width;pos+=step}return imageData=new ImageData(d,width,height),[4,createImageBitmap(imageData,0,0,width,height)];case 1:return[2,_a.sent()]}var colorMap,size,colorDomain,colorScale,table}))}))},exports.generateSurfaceData=function(trajectory,stratColumn,surfaceData){if(!(trajectory.length<0)){var filteredSurfaces=surfaceData.filter((function(s){return s.data.values})),mappedSurfaces=filteredSurfaces.map((function(s){var displayName=s.visualSettings.displayName;return{name:displayName.replace(/\s(Base|Top)/gi,""),isBase:displayName.toLowerCase().endsWith("base"),values:s.data.values,color:s.visualSettings.colors.crossSection,visualization:s.visualSettings.crossSection.toLowerCase()}})),stratGroups=new Map,stratigraphies=function(mappedSurfaces,stratColumn,stratGroups){var firstUnit=stratColumn&&stratColumn.find((function(d){return 1===d.stratUnitLevel})),defaultGroupName=firstUnit?firstUnit.identifier:"SEABED",stratigrafies=mappedSurfaces.filter((function(d){return"interval"===d.visualization||"none"===d.visualization})).map((function(s){var path=[],stratUnit=findStratcolumnUnit(stratColumn,s.name,path);stratUnit||console.warn("No match for "+s.name+" in strat column");var group=path[0]||stratUnit,groupName=group&&group.identifier||defaultGroupName;return group&&!stratGroups.has(groupName)&&stratGroups.set(groupName,{age:group.topAge,name:group.identifier}),__assign(__assign({},s),{unit:stratUnit,group:groupName})}));return stratigrafies}(mappedSurfaces,stratColumn,stratGroups);stratigraphies.sort((function(a,b){if(!a.unit&&!b.unit)return 0;if(!a.unit)return-1;if(!b.unit)return 1;var aAge=a.isBase?a.unit.baseAge:a.unit.topAge,bAge=b.isBase?b.unit.baseAge:b.unit.topAge;return aAge!==bAge?aAge-bAge:a.isBase&&!b.isBase?1:!a.isBase&&b.isBase?-1:a.unit.stratUnitLevel-b.unit.stratUnitLevel}));var lines=function(mappedSurfaces,trajectory){var lines=mappedSurfaces.filter((function(d){return"line"===d.visualization})).map((function(l){return{id:l.name,label:l.name,width:2,color:convertColor(l.color||"black"),data:trajectory.map((function(p,j){return[p[0],l.values[j]]}))}}));return lines}(mappedSurfaces,trajectory),surfaceAreas=function(projection,surfaces,stratColumn){var areas=surfaces.reduce((function(acc,surface,i){if(!surface.isBase){acc[surface.group]||(acc[surface.group]=[]);var baseIndex_1=function(top,index,surfaces,stratColumn){var nextIndex=index+1;if(!surfaces||nextIndex>=surfaces.length)return null;var baseSurfaceIndex=surfaces.findIndex((function(candidate){return candidate.isBase&&candidate.name===top.name}));if(-1!==baseSurfaceIndex)return baseSurfaceIndex;for(var i=nextIndex;i<surfaces.length;i++){var candidate=surfaces[i];if(!candidate.isBase)return i;if(isAnchestor(top,candidate,stratColumn))return i}return null}(surface,i,surfaces,stratColumn);acc[surface.group].push({id:surface.name,label:surface.name,color:surface.unit&&getColorFromUnit(surface.unit)||4294967295,exclude:"none"===surface.visualization||!surface.unit,data:projection.map((function(p,j){var baseValue=null!==surface.values[j]?function(index,surfaces,datapoint){if(!surfaces||!index||index>=surfaces.length)return null;for(var i=index;i<surfaces.length;i++)if(null!==surfaces[i].values[datapoint])return surfaces[i].values[datapoint];return null}(baseIndex_1,surfaces,j):null;return[p[0],surface.values[j],baseValue]}))})}return acc}),{});return areas}(trajectory,stratigraphies,stratColumn),groups=function(stratGroups,surfaceAreas){var groups=Array.from(stratGroups.values()).sort((function(a,b){return a.age-b.age})).filter((function(g){var surfaces=surfaceAreas[g.name],isValid=surfaces&&surfaces.length>0;return isValid||console.warn("Intersection surface group '"+g.name+"' has no valid entries and will be discarded."),isValid})).map((function(g,i){var top=surfaceAreas[g.name][0];return{id:g.name,label:g.name,color:unassignedColorScale(i),top:top.data.map((function(d){return d[1]}))}}));return groups}(stratGroups,surfaceAreas),groupAreas=function(groups,trajectory){var groupAreas=groups.map((function(g,i){var next=i+1<groups.length?groups[i+1]:null;return{id:g.id,color:convertColor(g.color),data:trajectory.map((function(p,j){return[p[0],g.top[j],next?next.top[j]:null]}))}}));return groupAreas}(groups,trajectory);return{lines:lines,areas:__spreadArray(__spreadArray([],groupAreas),Object.values(surfaceAreas).flat().filter((function(d){return!d.exclude})))}}},exports.getOverlap=function(r1,r2){var r1x2=r1.x+r1.width,r2x2=r2.x+r2.width,r1y2=r1.y+r1.height,r2y2=r2.y+r2.height;return r2.x>r1x2||r2.y>r1y2||r2x2<r1.x||r2y2<r1.y?null:{dx:Math.max(0,Math.min(r1.x+r1.width,r2.x+r2.width)-Math.max(r1.x,r2.x)),dy:Math.max(0,Math.min(r1.y+r1.height,r2.y+r2.height)-Math.max(r1.y,r2.y))}},exports.getOverlapOffset=getOverlapOffset,exports.getPicksData=function(picksData){var formationPicks,unitPicks=picksData.unitPicks,picks=__spreadArray(__spreadArray(__spreadArray([],function(picks){return picks?picks.map((function(p){return mapPick(p,"ref-picks")})):[]}(picksData.nonUnitPicks)),(formationPicks=unitPicks)?formationPicks.filter((function(d){return d.entryPick.md===d.from})).map((function(p){return mapPick(p.entryPick,"strat-picks")})):[]),function(formationPicks){return formationPicks?formationPicks.filter((function(d){return-1===formationPicks.findIndex((function(p){return Math.abs(p.entryPick.md-d.exitPick.md)<.5}))})).map((function(p){return mapPick(p.exitPick,"strat-picks")})).filter((function(obj,i,array){return i===array.findIndex((function(v){return v.title===obj.title&&v.md===obj.md}))})):[]}(unitPicks));return picks.sort((function(a,b){return a.md-b.md})),picks},exports.getSeismicInfo=function(data,trajectory){if(data&&data.datapoints){var minX=trajectory.reduce((function(acc,val){return Math.min(acc,val[0])}),0),maxX=trajectory.reduce((function(acc,val){return Math.max(acc,val[0])}),0),minTvdMsl=data.yAxisValues&&data.yAxisValues[0],maxTvdMsl=data.yAxisValues&&data.yAxisValues[data.yAxisValues.length-1],dp=data.datapoints||[],min=-dp.reduce((function(val,array){return Math.min.apply(Math,__spreadArray(__spreadArray([],array),[val]))}),0),max=dp.reduce((function(val,array){return Math.max.apply(Math,__spreadArray(__spreadArray([],array),[val]))}),0),absMax=Math.max(Math.abs(min),Math.abs(max)),dmin=-absMax;return{minX:minX,maxX:maxX,minTvdMsl:minTvdMsl,maxTvdMsl:maxTvdMsl,domain:{min:dmin,max:absMax,difference:absMax-dmin}}}},exports.isOverlapping=isOverlapping,exports.isOverlappingHorizontally=function(r1,r2){var r1x2=r1.x+r1.width,r2x2=r2.x+r2.width;return!(r2.x>r1x2||r2x2<r1.x)},exports.pixelsPerUnit=pixelsPerUnit,exports.transformFormationData=function(picks,stratColumn){for(var _a=function(picks,stratColumn){var transformed=function(units,res){void 0===res&&(res=[]);for(var i=0;i<units.length;i+=1){var unit={unitName:(u=units[i]).identifier,topSurface:u.top,baseSurface:u.base,ageBase:u.baseAge,ageTop:u.topAge,color:{r:null===u.colorR?255:u.colorR,g:null===u.colorG?255:u.colorG,b:null===u.colorB?255:u.colorB},level:u.stratUnitLevel,lithType:u.lithologyType,parent:u.stratUnitParent};res.push(unit)}var u;return res}(stratColumn),nonUnitPicks=[],joined=[];return picks.forEach((function(p){var matches=transformed.filter((function(u){return-1!==p.pickIdentifier.search(new RegExp("("+u.topSurface+"|"+u.baseSurface+")","i"))}));matches.length>0?matches.forEach((function(u){return joined.push(__assign({md:p.md,tvd:p.tvd,identifier:p.pickIdentifier,confidence:p.confidence,mdUnit:p.mdUnit,depthReferencePoint:p.depthReferencePoint},u))})):nonUnitPicks.push(p)})),{joined:joined,nonUnitPicks:nonUnitPicks}}(picks,stratColumn),joined=_a.joined,nonUnitPicks=_a.nonUnitPicks,pairs=function(joined){for(var pairs=[],current=null,sorted=joined.filter((function(d){return d.level})).sort((function(a,b){return a.unitName.localeCompare(b.unitName)||a.md-b.md||a.ageTop-b.ageTop})),_loop_1=function(){var _a,pairWithName,top_1,base,name_1=(current=sorted.shift()).identifier,isTop=name_1===current.topSurface,isBase=name_1===current.baseSurface;if(isTop)pairWithName=current.baseSurface;else{if(!isBase)return console.warn("Unable to match "+name_1+" with top or base surface, ignored"),"continue";pairWithName=current.topSurface}var pairWith=sorted.find((function(p){return p.identifier===pairWithName}));if(pairWith)base=isTop?pairWith:current,(top_1=isTop?current:pairWith).md>base.md&&(top_1=(_a=[base,top_1])[0],base=_a[1]),sorted.splice(sorted.indexOf(pairWith),1);else if(console.warn("Unable to find "+pairWithName+" pick for "+name_1),isTop){if(top_1=current,base=joined.filter((function(d){return d.level})).sort((function(a,b){return a.md-b.md})).find((function(p){return p.md>top_1.md})),!base)return console.warn("Unable to find a base pick for "+name_1+" pick at "+top_1.md+", ignored"),"continue";console.warn("Using "+base.identifier+" as base for "+name_1)}else{if(!isBase)return console.warn(name_1+" ignored"),"continue";if(base=current,top_1=joined.filter((function(d){return d.level})).sort((function(a,b){return b.md-a.md})).find((function(p){return p.md<base.md})),!top_1)return console.warn("Unable to find a top pick for "+name_1+" pick at "+base.md+", ignored"),"continue";console.warn("Using "+top_1.identifier+" as top for "+name_1)}pairs.push({name:top_1.unitName,mdEntry:top_1.md,tvdEntry:top_1.tvd,color:top_1.color,level:top_1.level,entryPick:top_1,mdExit:base.md,tvdExit:base.tvd,exitPick:base,confidenceEntry:top_1.confidence,confidenceExit:base.confidence})};sorted.length>0;)_loop_1();return pairs}(joined),itemstack=pairs.filter((function(d){return d.mdEntry<d.mdExit})).sort((function(a,b){return a.mdEntry-b.mdEntry||a.level-b.level})).reverse(),unitPicks=[],_loop_2=function(){for(var first=itemstack.pop(),group=[];itemstack.length>0&&itemstack[itemstack.length-1].level>first.level;)group.push(itemstack.pop());group.reverse(),group.push(first);var arr=[];group.forEach((function(itm){var gaps=function(from,to,arr){if(0===arr.length)return[[from,to]];for(var gaps=[],d=from,i=0;d<to&&i<arr.length;){var itm=arr[i];itm.from>d&&gaps.push([d,Math.min(itm.from,to)]),d=Math.min(to,Math.max(from,itm.to)),i+=1}return d<to&&gaps.push([d,to]),gaps}(itm.mdEntry,itm.mdExit,arr);arr.push.apply(arr,gaps.map((function(g){return{from:g[0],to:g[1],itm:itm}})))})),arr.sort((function(a,b){return a.from-b.from})),unitPicks.push.apply(unitPicks,arr.map((function(d){return __assign({from:d.from,to:d.to},d.itm)})))};itemstack.length>0;)_loop_2();return{unitPicks:unitPicks,nonUnitPicks:nonUnitPicks}},Object.defineProperty(exports,"__esModule",{value:!0})}));
|