@eva/plugin-ui 2.1.0-beta.1 → 2.1.0-beta.10
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/README.md +4 -4
- package/dist/EVA.plugin.ui.js +1370 -140
- package/dist/EVA.plugin.ui.min.js +1 -1
- package/dist/plugin-ui.cjs.js +1139 -138
- package/dist/plugin-ui.cjs.prod.js +1 -1
- package/dist/plugin-ui.d.ts +318 -66
- package/dist/plugin-ui.esm.js +1139 -140
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@eva/eva.js"),n=require("@eva/plugin-renderer-graphics"),i=require("pixi.js"),a=require("@pixi/ui");exports.UIShapeType=void 0,(e=exports.UIShapeType||(exports.UIShapeType={})).RECT="rect",e.CIRCLE="circle",e.ELLIPSE="ellipse",e.ROUNDED_RECT="roundedRect";class r extends t.Component{constructor(){super(...arguments),this.componentName="UI",this.shapes=[]}static getInspectorMetadata(){const e=[{name:"fill",type:"color",isArray:!1},{name:"stroke",type:"color",isArray:!1},{name:"lineWidth",type:"number",isArray:!1},{name:"alpha",type:"number",isArray:!1},{name:"x",type:"number",isArray:!1},{name:"y",type:"number",isArray:!1},{name:"width",type:"number",isArray:!1},{name:"height",type:"number",isArray:!1},{name:"radius",type:"number",isArray:!1}];return{name:r.componentName,type:"object",isArray:!1,isFolder:!0,children:[{name:"componentName",type:"string",isArray:!1},{name:"shapes",type:"object",isArray:!0,children:[{name:"type",type:"string",isArray:!1},{name:"style",type:"object",isArray:!1,children:e}]},{name:"type",type:"string",isArray:!1},{name:"style",type:"object",isArray:!1,children:e}]}}init(e){var t;e&&(this.componentName=null!==(t=e.componentName)&&void 0!==t?t:this.componentName,e.shapes?this.shapes=e.shapes:e.type&&e.style&&(this.shapes=[{type:e.type,style:e.style}]))}awake(){this.redraw()}start(){this.redraw(),queueMicrotask(()=>this.redraw())}parseLinearGradient(e){const t=e.match(/linear-gradient\s*\(\s*([^,]+),\s*(.+)\)/);if(!t)return null;const n=t[1].trim(),i=parseFloat(n),a=[],r=t[2].split(/,(?![^(]*\))/);for(const e of r){const t=e.trim().match(/(.+?)\s+(\d+)%/);if(t){const e=t[1].trim(),n=parseFloat(t[2])/100;a.push({color:e,position:n})}}return{angle:i,colorStops:a}}createGradient(e,t,n,a,r=0,s=0){let l=0,o=0,d=0,c=0;if(0===e)l=.5,o=1,d=.5,c=0;else if(90===e)l=0,o=.5,d=1,c=.5;else if(180===e)l=.5,o=0,d=.5,c=1;else if(270===e)l=1,o=.5,d=0,c=.5;else{const t=(90-e)*(Math.PI/180),i=.5,r=.5,s=Math.max(n,a),p=Math.sqrt(n*n+a*a)/(2*s);l=i-Math.cos(t)*p,o=r-Math.sin(t)*p,d=i+Math.cos(t)*p,c=r+Math.sin(t)*p}const p=new i.FillGradient(l,o,d,c);return t.forEach(e=>{p.addColorStop(e.position,e.color)}),p}getShapeBounds(e,t){const n=t.x||0,i=t.y||0;switch(e){case exports.UIShapeType.RECT:case exports.UIShapeType.ROUNDED_RECT:return{width:t.width,height:t.height,x:n,y:i};case exports.UIShapeType.CIRCLE:return{width:2*t.radius,height:2*t.radius,x:n,y:i};case exports.UIShapeType.ELLIPSE:return{width:t.width,height:t.height,x:n,y:i};default:return{width:100,height:100,x:n,y:i}}}redraw(){if(!this.gameObject)return;let e=this.gameObject.getComponent("Graphics");e||(e=this.gameObject.addComponent(new n.Graphics));const t=e.graphics;t?(t.clear(),this.shapes.forEach(e=>{this.drawShape(t,e.type,e.style)})):console.warn("Graphics component has no graphics instance")}drawShape(e,t,n){switch(void 0!==n.alpha&&(e.alpha=n.alpha),n.stroke&&void 0!==n.lineWidth?e.setStrokeStyle({color:n.stroke,width:n.lineWidth}):n.stroke&&e.setStrokeStyle({color:n.stroke,width:1}),t){case exports.UIShapeType.RECT:this.drawRect(e,n);break;case exports.UIShapeType.CIRCLE:this.drawCircle(e,n);break;case exports.UIShapeType.ELLIPSE:this.drawEllipse(e,n);break;case exports.UIShapeType.ROUNDED_RECT:this.drawRoundedRect(e,n);break;default:console.warn(`Unknown shape type: ${t}`)}if(n.fill)if("string"==typeof n.fill&&n.fill.includes("linear-gradient")){const i=this.parseLinearGradient(n.fill);if(i){const a=this.getShapeBounds(t,n),r=this.createGradient(i.angle,i.colorStops,a.width,a.height,a.x,a.y);e.fill(r)}else console.warn(`Failed to parse gradient: ${n.fill}`),e.fill("#000000")}else e.fill(n.fill)}drawRect(e,t){const n=t.x||0,i=t.y||0;e.rect(n,i,t.width,t.height)}drawCircle(e,t){const n=t.x||0,i=t.y||0;e.circle(n,i,t.radius)}drawEllipse(e,t){const n=t.x||0,i=t.y||0;e.ellipse(n,i,t.width/2,t.height/2)}drawRoundedRect(e,t){const n=t.x||0,i=t.y||0,a=t.radius||0;e.roundRect(n,i,t.width,t.height,a)}addShape(e,t){this.shapes.push({type:e,style:t}),this.redraw()}clearShapes(){this.shapes=[],this.redraw()}updateShape(e,t,n){e>=0&&e<this.shapes.length&&(this.shapes[e]={type:t,style:n},this.redraw())}removeShape(e){e>=0&&e<this.shapes.length&&(this.shapes.splice(e,1),this.redraw())}getShapeCount(){return this.shapes.length}getShape(e){return e>=0&&e<this.shapes.length?this.shapes[e]:null}setAlpha(e){this.shapes.forEach(t=>{t.style.alpha=e}),this.redraw()}setFill(e){this.shapes.forEach(t=>{t.style.fill=e}),this.redraw()}setStroke(e,t=1){this.shapes.forEach(n=>{n.style.stroke=e,n.style.lineWidth=t}),this.redraw()}}function s(e,t){var n,i,a;if(!e||!t)return null;const r=function(e){var t,n,i,a,r,s;const l=null===(n=(t=e).getSystem)||void 0===n?void 0:n.call(t,"Renderer");if(l)return l;const o=null!==(i=e.systems)&&void 0!==i?i:[];for(const e of o){const t=null!==(r=null===(a=null==e?void 0:e.constructor)||void 0===a?void 0:a.systemName)&&void 0!==r?r:null===(s=null==e?void 0:e.constructor)||void 0===s?void 0:s.name;if("Renderer"===t||"RendererSystem"===t)return e;if("Renderer"===(null==e?void 0:e.name)||"RendererSystem"===(null==e?void 0:e.name))return e;if(null==e?void 0:e.containerManager)return e}return null}(e),s=null!==(n=null==r?void 0:r.containerManager)&&void 0!==n?n:null===(i=null==r?void 0:r.rendererManager)||void 0===i?void 0:i.containerManager;return(null==s?void 0:s.getContainer)&&null!==(a=s.getContainer(t.id))&&void 0!==a?a:null}function l(e,t,n){const i=s(e,t);if(!i)return!1;try{return n.parent&&n.parent!==i&&n.parent.removeChild(n),"function"==typeof i.addChildAt?i.addChildAt(n,0):i.addChild(n),!0}catch(e){return!1}}function o(e,t,n){if(!n)return;const i=s(e,t);try{i&&n.parent===i&&i.removeChild(n),"function"==typeof n.destroy&&n.destroy({children:!0})}catch(e){}}function d(e,t,n,i=4){const a=s(e,t);a?n(a):i<=0||queueMicrotask(()=>d(e,t,n,i-1))}function c(e,t,n){var a;if(!n)return null;if("entityName"in n){const i=function(e,t){var n,i,a;if("function"==typeof e.findChildByName)try{const n=e.findChildByName(t);if(n)return n}catch(e){}const r=null!==(i=null===(n=e.transform)||void 0===n?void 0:n.children)&&void 0!==i?i:[];for(const e of r)if((null===(a=null==e?void 0:e.gameObject)||void 0===a?void 0:a.name)===t)return e.gameObject;return null}(t,n.entityName);if(i){const t=s(e,i);if(t){try{t.parent&&t.parent.removeChild(t)}catch(e){}return t}}return n.fallback?c(e,t,n.fallback):null}if("ui"in n)return null!==(a=function(e){var t,n,a;if(!e||!e.type)return null;const r=new i.Graphics,{style:s}=e,l=null!==(t=s.width)&&void 0!==t?t:0,o=null!==(n=s.height)&&void 0!==n?n:0,d=null!==(a=s.radius)&&void 0!==a?a:0;switch(e.type){case"rect":r.rect(0,0,l,o);break;case"roundedRect":r.roundRect(0,0,l,o,d);break;case"circle":r.circle(d,d,d);break;case"ellipse":r.ellipse(l/2,o/2,l/2,o/2)}void 0!==s.fill&&r.fill(s.fill);void 0!==s.stroke&&void 0!==s.lineWidth&&(r.setStrokeStyle({color:s.stroke,width:s.lineWidth}),r.stroke());void 0!==s.alpha&&(r.alpha=s.alpha);return r}(n.ui))&&void 0!==a?a:n.fallback?c(e,t,n.fallback):null;if("texture"in n){const a=function(e,t){var n,a;const r=null!==(n=null==e?void 0:e.resource)&&void 0!==n?n:null;if(null===(a=null==r?void 0:r.instances)||void 0===a?void 0:a[t]){const e=r.instances[t];if(e instanceof i.Texture)return e;if((null==e?void 0:e.image)instanceof i.Texture)return e.image}try{return i.Texture.from(t)}catch(e){return null}}(e,n.texture);return a?new i.Sprite(a):n.fallback?c(e,t,n.fallback):null}if("color"in n)try{const e=new i.Graphics;return n.radius&&n.radius>0?e.roundRect(0,0,n.width,n.height,n.radius):e.rect(0,0,n.width,n.height),e.fill(n.color),e}catch(e){return console.error("[view-resolver] color view create failed",e),null}return null}r.componentName="UI";class p extends t.Component{constructor(){super(...arguments),this.toggleCount=0,this.pressCount=0,this.hoverCount=0,this.changeCount=0,this.updateCount=0,this.selectCount=0,this.focused=!1}init(e){e&&this.applyParams(e)}applyDeclarativeProps(e,t){this.applyParams(e)}applyParams(e){const t=this.constructor.__def;if(t)for(const[n,i]of Object.entries(t.fields)){if(!(n in e))continue;const t=e[n];if(void 0!==t)switch(i.kind){case"scalar":case"opaque":this[n]=t;break;case"shallowMerge":this[n]=Object.assign(Object.assign({},this[n]),t);break;case"arrayCopy":Array.isArray(t)&&(this[n]=t.slice());break;case"tuple":!Array.isArray(t)||i.tupleLength&&t.length!==i.tupleLength||(this[n]=t.slice())}}}}function u(e){const t=e.name;class n extends p{constructor(n){super(n),this.componentName=t;for(const[t,n]of Object.entries(e.fields))void 0!==n.default?this[t]=h(n.default):t in this||(this[t]=void 0)}static getInspectorMetadata(){return function(e){const t=[];for(const[n,i]of Object.entries(e.fields))i.inspector&&t.push(Object.assign(Object.assign({},i.inspector),{name:i.inspector.name||n}));return{name:e.name,type:"object",isArray:!1,isFolder:!0,children:t}}(e)}}const i=n;i.componentName=t,i.__def=e;try{Object.defineProperty(i,"name",{value:t})}catch(e){}if(e.mixin)for(const[t,i]of Object.entries(e.mixin))n.prototype[t]=i;return i}function h(e){return null===e||"object"!=typeof e?e:Array.isArray(e)?e.slice():Object.assign({},e)}const f={kind:"scalar",default:!0,inspector:{name:"enabled",type:"boolean"}},m={kind:"scalar",inspector:{name:"bindToStore",type:"string"}};function g(){const[e,t]=this.valueRange;if(t<=e)return 0;return(Math.max(e,Math.min(t,this.value))-e)/(t-e)*100}function y(e){if(void 0!==e)return"string"==typeof e?parseInt(e.replace("#",""),16):e}const v={name:"Button",signalPrefix:"button",pixiClass:a.ButtonContainer,fields:{enabled:f,view:{kind:"opaque",inspector:{name:"view",type:"object"}}},views:{kind:"single",key:"view",required:!0},positional:!0,optionsBuilder:(e,t)=>[t.single],postCreate:(e,t)=>{e.enabled=t.enabled},signalMap:e=>({press:()=>(e.pressCount+=1,{}),down:!0,up:!0,hover:!0}),syncOnChange:(e,t)=>{e.enabled=t.enabled}},b={name:"FancyButton",signalPrefix:"fancybutton",pixiClass:a.FancyButton,fields:{enabled:f,state:{kind:"scalar",default:"default",inspector:{name:"state",type:"string"}},selected:{kind:"scalar",default:!1,inspector:{name:"selected",type:"boolean"}},text:{kind:"scalar",inspector:{name:"text",type:"string"}},padding:{kind:"scalar",inspector:{name:"padding",type:"number"}},selectedTint:{kind:"scalar",default:"#FFD680",inspector:{name:"selectedTint",type:"color"}},views:{kind:"shallowMerge",default:{},inspector:{name:"views",type:"object",isFolder:!0,children:[{name:"default",type:"object"},{name:"hover",type:"object"},{name:"pressed",type:"object"},{name:"disabled",type:"object"}]}},offset:{kind:"shallowMerge",default:{}},textOffset:{kind:"shallowMerge",default:{}},nineSliceSprite:{kind:"opaque"}},views:{kind:"object",folder:"views",keys:[{name:"default",required:!1},{name:"hover",required:!1},{name:"pressed",required:!1},{name:"disabled",required:!1}]},optionsBuilder:(e,t)=>{var n,i,a,r;const s={text:e.text,padding:e.padding,offset:e.offset,textOffset:e.textOffset,nineSliceSprite:e.nineSliceSprite};return(null===(n=t.object)||void 0===n?void 0:n.default)&&(s.defaultView=t.object.default),(null===(i=t.object)||void 0===i?void 0:i.hover)&&(s.hoverView=t.object.hover),(null===(a=t.object)||void 0===a?void 0:a.pressed)&&(s.pressedView=t.object.pressed),(null===(r=t.object)||void 0===r?void 0:r.disabled)&&(s.disabledView=t.object.disabled),s},postCreate:(e,t)=>{e.enabled=t.enabled,t.selected&&k(e,t)},signalMap:e=>({press:()=>(e.pressCount+=1,{}),hover:()=>(e.hoverCount+=1,{}),down:!0,up:!0}),syncOnChange:(e,t)=>{e.enabled=t.enabled,void 0!==t.text&&e.text!==t.text&&(e.text=t.text),void 0!==t.padding&&e.padding!==t.padding&&(e.padding=t.padding),k(e,t)}};function k(e,t){try{const n=e.defaultView;n&&"tint"in n&&(n.tint=t.selected?t.selectedTint:16777215)}catch(e){}}const x={name:"CheckBox",signalPrefix:"checkbox",pixiClass:a.CheckBox,fields:{enabled:f,checked:{kind:"scalar",default:!1,inspector:{name:"checked",type:"boolean"}},text:{kind:"scalar",inspector:{name:"text",type:"string"}},bindToStore:m,views:{kind:"shallowMerge",default:{},inspector:{name:"views",type:"object",isFolder:!0,children:[{name:"checked",type:"object"},{name:"unchecked",type:"object"}]}},disabledStyle:{kind:"shallowMerge",default:{alpha:.4,scale:1}}},views:{kind:"object",folder:"views",keys:[{name:"checked",required:!0},{name:"unchecked",required:!0}]},optionsBuilder:(e,t)=>({style:{checked:t.object.checked,unchecked:t.object.unchecked},text:e.text,checked:e.checked}),signalMap:e=>({check:t=>(e.checked=t,e.toggleCount+=1,{value:t})}),syncOnChange:(e,t)=>{e.checked!==t.checked&&(e.checked=t.checked)}},w={name:"Switcher",signalPrefix:"switcher",pixiClass:a.Switcher,fields:{active:{kind:"scalar",default:0,inspector:{name:"active",type:"number"}},views:{kind:"arrayCopy",default:[]},triggerEvent:{kind:"scalar",default:"onPress",inspector:{name:"triggerEvent",type:"string"}},bindToStore:m},views:{kind:"array",key:"views",minLength:2},positional:!0,optionsBuilder:(e,t)=>[t.array,e.triggerEvent,e.active],signalMap:e=>({change:t=>(e.active="number"==typeof t?t:t?1:0,e.changeCount+=1,{active:e.active})}),syncOnChange:(e,t)=>{e.active!==t.active&&(e.active=t.active)}},C={name:"Slider",signalPrefix:"slider",pixiClass:a.Slider,fields:{enabled:f,value:{kind:"scalar",default:0,inspector:{name:"value",type:"number"}},min:{kind:"scalar",default:0,inspector:{name:"min",type:"number"}},max:{kind:"scalar",default:100,inspector:{name:"max",type:"number"}},step:{kind:"scalar",default:1,inspector:{name:"step",type:"number"}},orientation:{kind:"scalar",default:"horizontal",inspector:{name:"orientation",type:"string"}},showValue:{kind:"scalar",default:!1,inspector:{name:"showValue",type:"boolean"}},views:{kind:"shallowMerge",default:{}},bindToStore:m},views:{kind:"object",folder:"views",keys:[{name:"bg",required:!0},{name:"fill",required:!0},{name:"thumb",required:!0}]},optionsBuilder:(e,t)=>(S(t.object.thumb),{bg:t.object.bg,fill:t.object.fill,slider:t.object.thumb,min:e.min,max:e.max,step:e.step,value:e.value,showValue:e.showValue}),signalMap:e=>({update:t=>(e.value=t,e.updateCount+=1,{value:t}),change:t=>(e.value=t,e.changeCount+=1,{value:t})}),syncOnChange:(e,t)=>{e.value!==t.value&&(e.value=t.value)}};function S(e){var t,n,i,a;if(!e)return;if(e.anchor)return;let r=0;try{const a=null===(t=e.getBounds)||void 0===t?void 0:t.call(e);r=null!==(i=null!==(n=null==a?void 0:a.height)&&void 0!==n?n:e.height)&&void 0!==i?i:0}catch(t){r=null!==(a=e.height)&&void 0!==a?a:0}r>0&&e.pivot&&e.pivot.set(0,r/2)}const _={name:"DoubleSlider",signalPrefix:"doubleslider",pixiClass:a.DoubleSlider,fields:{enabled:f,value1:{kind:"scalar",default:0,inspector:{name:"value1",type:"number"}},value2:{kind:"scalar",default:100,inspector:{name:"value2",type:"number"}},min:{kind:"scalar",default:0,inspector:{name:"min",type:"number"}},max:{kind:"scalar",default:100,inspector:{name:"max",type:"number"}},step:{kind:"scalar",default:1},showValue:{kind:"scalar",default:!1,inspector:{name:"showValue",type:"boolean"}},views:{kind:"shallowMerge",default:{}},bindToStore1:{kind:"scalar"},bindToStore2:{kind:"scalar"}},views:{kind:"object",folder:"views",keys:[{name:"bg",required:!0},{name:"fill",required:!0},{name:"slider1",required:!0},{name:"slider2",required:!0}]},optionsBuilder:(e,t)=>(S(t.object.slider1),S(t.object.slider2),{bg:t.object.bg,fill:t.object.fill,slider1:t.object.slider1,slider2:t.object.slider2,min:e.min,max:e.max,value1:e.value1,value2:e.value2,showValue:e.showValue}),signalMap:e=>({update:(t,n)=>(e.value1=t,e.value2=n,e.updateCount+=1,{value1:t,value2:n}),change:(t,n)=>(e.value1=t,e.value2=n,e.changeCount+=1,{value1:t,value2:n})}),syncOnChange:(e,t)=>{e.value1!==t.value1&&(e.value1=t.value1),e.value2!==t.value2&&(e.value2=t.value2)}},M={name:"ProgressBar",signalPrefix:"progressbar",pixiClass:a.ProgressBar,fields:{value:{kind:"scalar",default:0,inspector:{name:"value",type:"number"}},valueRange:{kind:"tuple",tupleLength:2,default:[0,100],inspector:{name:"valueRange",type:"number",isArray:!0}},bgView:{kind:"opaque"},fillView:{kind:"opaque"},nineSliceSprite:{kind:"opaque"},fillPaddings:{kind:"shallowMerge",default:{}},bindToStore:m},views:{kind:"object",folder:"__progress_views__",keys:[]},optionsBuilder:(e,t)=>({bg:e.__resolved_bg,fill:e.__resolved_fill,fillPaddings:e.fillPaddings,progress:P(e)}),syncOnChange:(e,t)=>{const n=P(t);e.progress!==n&&(e.progress=n)},mixin:{getProgressPct:g}};function P(e){const[t,n]=e.valueRange;if(n<=t)return 0;return(Math.max(t,Math.min(n,e.value))-t)/(n-t)*100}const j={name:"CircularProgressBar",signalPrefix:"circularprogressbar",pixiClass:a.CircularProgressBar,fields:{value:{kind:"scalar",default:0,inspector:{name:"value",type:"number"}},valueRange:{kind:"tuple",tupleLength:2,default:[0,100],inspector:{name:"valueRange",type:"number",isArray:!0}},radius:{kind:"scalar",default:60,inspector:{name:"radius",type:"number"}},lineWidth:{kind:"scalar",default:12,inspector:{name:"lineWidth",type:"number"}},startAngle:{kind:"scalar",default:-90,inspector:{name:"startAngle",type:"number",step:5}},backgroundColor:{kind:"scalar",default:"#1f2937",inspector:{name:"backgroundColor",type:"color"}},fillColor:{kind:"scalar",default:"#22c55e",inspector:{name:"fillColor",type:"color"}},backgroundAlpha:{kind:"scalar",default:1,inspector:{name:"backgroundAlpha",type:"number",step:.05}},fillAlpha:{kind:"scalar",default:1,inspector:{name:"fillAlpha",type:"number",step:.05}},bindToStore:m},optionsBuilder:e=>({radius:e.radius,lineWidth:e.lineWidth,backgroundColor:e.backgroundColor,fillColor:e.fillColor,backgroundAlpha:e.backgroundAlpha,fillAlpha:e.fillAlpha,value:P(e)}),syncOnChange:(e,t)=>{const n=P(t);e.progress!==n&&(e.progress=n)},mixin:{getProgressPct:g}},O={name:"Input",signalPrefix:"input",pixiClass:a.Input,fields:{enabled:f,value:{kind:"scalar",default:"",inspector:{name:"value",type:"string"}},placeholder:{kind:"scalar",default:"",inspector:{name:"placeholder",type:"string"}},maxLength:{kind:"scalar",default:100,inspector:{name:"maxLength",type:"number"}},secure:{kind:"scalar",default:!1,inspector:{name:"secure",type:"boolean"}},align:{kind:"scalar",default:"left",inspector:{name:"align",type:"string"}},padding:{kind:"tuple",tupleLength:4,default:[8,8,8,8]},textStyle:{kind:"shallowMerge",default:{fontFamily:"Arial",fontSize:16,fill:"#222"}},bgView:{kind:"opaque"},nineSliceSprite:{kind:"opaque"},cleanOnFocus:{kind:"scalar",default:!1,inspector:{name:"cleanOnFocus",type:"boolean"}},addMask:{kind:"scalar",default:!1,inspector:{name:"addMask",type:"boolean"}},bindToStore:m},views:{kind:"single",key:"bgView",required:!0},optionsBuilder:(e,t)=>({bg:t.single,textStyle:e.textStyle,placeholder:e.placeholder,value:e.value,maxLength:e.maxLength,secure:e.secure,align:e.align,padding:e.padding,cleanOnFocus:e.cleanOnFocus,nineSliceSprite:e.nineSliceSprite,addMask:e.addMask}),signalMap:e=>({change:t=>(e.value=t,e.changeCount+=1,{value:t}),enter:e=>({value:e})}),syncOnChange:(e,t)=>{e.value!==t.value&&(e.value=t.value)}},R={name:"List",signalPrefix:"list",pixiClass:a.List,fields:{type:{kind:"scalar",default:"vertical",inspector:{name:"type",type:"string"}},elementsMargin:{kind:"scalar",default:0,inspector:{name:"elementsMargin",type:"number"}},padding:{kind:"scalar"},vertPadding:{kind:"scalar"},horPadding:{kind:"scalar"},topPadding:{kind:"scalar"},bottomPadding:{kind:"scalar"},leftPadding:{kind:"scalar"},rightPadding:{kind:"scalar"},maxWidth:{kind:"scalar"},maxHeight:{kind:"scalar"},itemsChildName:{kind:"scalar",default:"items"}},optionsBuilder:(e,t)=>{var n;return{type:e.type,elementsMargin:e.elementsMargin,padding:e.padding,vertPadding:e.vertPadding,horPadding:e.horPadding,topPadding:e.topPadding,bottomPadding:e.bottomPadding,leftPadding:e.leftPadding,rightPadding:e.rightPadding,maxWidth:e.maxWidth,maxHeight:e.maxHeight,children:null!==(n=e.__resolved_items)&&void 0!==n?n:[]}},syncOnChange:(e,t)=>{e.type!==t.type&&(e.type=t.type),e.elementsMargin!==t.elementsMargin&&(e.elementsMargin=t.elementsMargin),"function"==typeof e.arrangeChildren&&e.arrangeChildren()}},B={name:"ScrollBox",signalPrefix:"scrollbox",pixiClass:a.ScrollBox,fields:{width:{kind:"scalar",default:320,inspector:{name:"width",type:"number"}},height:{kind:"scalar",default:240,inspector:{name:"height",type:"number"}},direction:{kind:"scalar",default:"vertical",inspector:{name:"direction",type:"string"}},contentChildName:{kind:"scalar",default:"content"},background:{kind:"scalar",default:1118481,inspector:{name:"background",type:"color"}},radius:{kind:"scalar",default:0,inspector:{name:"radius",type:"number"}},elementsMargin:{kind:"scalar",default:0},disableDynamicRendering:{kind:"scalar",default:!1},disableEasing:{kind:"scalar",default:!1,inspector:{name:"disableEasing",type:"boolean"}},padding:{kind:"scalar",default:0},inertia:{kind:"scalar",default:!0},inertiaDecay:{kind:"scalar",default:.92},bounceFactor:{kind:"scalar",default:.18}},mixin:{applyOffset(){},getBounds:()=>({minX:0,maxX:0,minY:0,maxY:0})},optionsBuilder:(e,t)=>{var n,i;return{width:e.width,height:e.height,type:null!==(n={horizontal:"horizontal",vertical:"vertical",both:"bidirectional"}[e.direction])&&void 0!==n?n:"vertical",background:e.background,radius:e.radius,elementsMargin:e.elementsMargin,padding:e.padding,disableEasing:e.disableEasing,disableDynamicRendering:e.disableDynamicRendering,items:null!==(i=e.__resolved_items)&&void 0!==i?i:[]}},signalMap:()=>({scroll:e=>({value:e})}),syncOnChange:(e,t)=>{if("function"==typeof e.resize)try{e.resize(t.width,t.height)}catch(e){}}},E={name:"Select",signalPrefix:"select",pixiClass:a.Select,fields:{items:{kind:"arrayCopy",default:[]},selectedIndex:{kind:"scalar",default:-1,inspector:{name:"selectedIndex",type:"number"}},placeholder:{kind:"scalar",default:"",inspector:{name:"placeholder",type:"string"}},closedView:{kind:"opaque"},openView:{kind:"opaque"},textStyle:{kind:"shallowMerge",default:{fontFamily:"Arial",fontSize:14,fill:"#222"}},nineSliceSprite:{kind:"opaque"},bindToStore:m},views:{kind:"object",folder:"__select_views__",keys:[]},optionsBuilder:e=>{var t;return{closedBG:e.__resolved_closedView,openBG:e.__resolved_openView,textStyle:e.textStyle,items:{items:(null!==(t=e.items)&&void 0!==t?t:[]).map(e=>e.text),backgroundColor:0,hoverColor:6710886,width:200,height:30,textStyle:e.textStyle,radius:4},selected:e.selectedIndex>=0?e.selectedIndex:void 0,nineSliceSprite:e.nineSliceSprite}},signalMap:e=>({select:(t,n)=>(e.selectedIndex=t,e.selectCount+=1,{index:t,text:n})})},I={name:"Dialog",signalPrefix:"dialog",pixiClass:a.Dialog,fields:{open:{kind:"scalar",default:!1,inspector:{name:"open",type:"boolean"}},title:{kind:"scalar",inspector:{name:"title",type:"string"}},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}},padding:{kind:"scalar",inspector:{name:"padding",type:"number"}},backdropColor:{kind:"scalar",default:0,inspector:{name:"backdropColor",type:"color"}},backdropAlpha:{kind:"scalar",default:.5,inspector:{name:"backdropAlpha",type:"number",step:.05}},backdropView:{kind:"opaque"},backgroundView:{kind:"opaque"},closeOnBackdropClick:{kind:"scalar",default:!0,inspector:{name:"closeOnBackdropClick",type:"boolean"}},contentChildName:{kind:"scalar",default:"content",inspector:{name:"contentChildName",type:"string"}},nineSliceSprite:{kind:"opaque"},bindToStore:m},optionsBuilder:e=>{var t;return{backdrop:e.__resolved_backdropView,backdropColor:y(e.backdropColor),backdropAlpha:e.backdropAlpha,background:null!==(t=e.__resolved_backgroundView)&&void 0!==t?t:new i.Container,title:e.title,width:e.width,height:e.height,padding:e.padding,closeOnBackdropClick:e.closeOnBackdropClick,nineSliceSprite:e.nineSliceSprite}},postCreate:(e,t)=>{t.open&&"function"==typeof e.open&&e.open()},signalMap:e=>({close:()=>(e.open=!1,{}),select:(e,t)=>({index:e,text:t})}),syncOnChange:(e,t)=>{t.open&&!e.isOpen&&"function"==typeof e.open?e.open():!t.open&&e.isOpen&&"function"==typeof e.close&&e.close()}},A={name:"MaskedFrame",signalPrefix:"maskedframe",pixiClass:a.MaskedFrame,fields:{targetView:{kind:"opaque"},maskView:{kind:"opaque"},borderView:{kind:"opaque"}},optionsBuilder:e=>({target:e.__resolved_targetView,mask:e.__resolved_maskView,borderWidth:0,borderColor:0})},V=u(v),T=u(b),N=u(x),q=u(w),G=u(C),D=u(_),F=u(M),U=u(j),L=u(O),W=u(R),Y=u(B),$=u(E),z=u(I),H=u(A),X={Button:v,FancyButton:b,CheckBox:x,Switcher:w,Slider:C,DoubleSlider:_,ProgressBar:M,CircularProgressBar:j,Input:O,List:R,ScrollBox:B,Select:E,Dialog:I,MaskedFrame:A};class J extends t.Component{constructor(){super(...arguments),this.componentName="RadioGroup",this.direction="vertical",this.elementsMargin=4,this.boundCheckBoxes=[]}static getInspectorMetadata(){return{name:J.componentName,type:"object",isArray:!1,isFolder:!0,children:[{name:"selectedId",type:"string",isArray:!1},{name:"direction",type:"string",isArray:!1},{name:"elementsMargin",type:"number",isArray:!1},{name:"childNames",type:"string",isArray:!0}]}}init(e){e&&this.applyParams(e)}applyDeclarativeProps(e,t){this.applyParams(e)}applySelection(){for(const{name:e,cb:t}of this.boundCheckBoxes){const n=e===this.selectedId;t.checked!==n&&(t.checked=n)}}applyParams(e){"string"==typeof e.selectedId&&(this.selectedId=e.selectedId),Array.isArray(e.childNames)&&(this.childNames=e.childNames.slice()),e.direction&&(this.direction=e.direction),"number"==typeof e.elementsMargin&&(this.elementsMargin=e.elementsMargin)}}function K(e,t,n){const i=[],{go:a,prefix:r,emitToMx:s=!0}=t;for(const[t,l]of Object.entries(n)){const n=Q(e,t);if(!n)continue;const o=n.connect((...e)=>{var n,i,o,d,c;const p=!0===l?e[0]:Z(l,e),u="object"==typeof p&&null!==p?Object.assign({entityName:a.name},p):{entityName:a.name,value:p};try{null===(i=(n=a).emit)||void 0===i||i.call(n,t,u)}catch(e){}try{null===(d=(o=a).emit)||void 0===d||d.call(o,`${r}:${t}`,u)}catch(e){}if(s){const e="undefined"!=typeof globalThis?globalThis.mx:void 0;if(null===(c=null==e?void 0:e.event)||void 0===c?void 0:c.emit)try{e.event.emit(`${r}:${t}`,u)}catch(e){}}});i.push(()=>{try{o.disconnect()}catch(e){}})}return i}function Q(e,t){const n=[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`,`on${t.charAt(0).toUpperCase()}${t.slice(1)}Change`];for(const t of n){const n=null==e?void 0:e[t];if(n&&"function"==typeof n.connect)return n}return null}function Z(e,t){var n;try{return null!==(n=e(...t))&&void 0!==n?n:{}}catch(e){return{}}}J.componentName="RadioGroup","function"==typeof SuppressedError&&SuppressedError;let ee=class extends t.System{constructor(){super(...arguments),this.name="UISystem",this.instances=new Map,this.signalCleanups=new Map,this.radioGroupInstances=new Map}get checkBoxInstances(){let e=this.instances.get("CheckBox");return e||(e=new Map,this.instances.set("CheckBox",e)),e}update(e){var t,n,i;const a=null!==(i=null===(n=null===(t=this.componentObserver)||void 0===t?void 0:t.clear)||void 0===n?void 0:n.call(t))&&void 0!==i?i:[];for(const e of a)this.componentChanged(e)}componentChanged(e){const t=e.componentName;if("UI"===t)return this.handleUI(e);if("RadioGroup"===t)return this.handleRadioGroup(e);const n=X[t];return n?this.handleGeneric(n,e):void 0}handleUI(e){if(e.type===t.OBSERVER_TYPE.ADD||e.type===t.OBSERVER_TYPE.CHANGE){const t=e.component;"function"==typeof t.redraw&&t.redraw()}}handleGeneric(e,n){var i;const a=n.component,r=a.gameObject;if(!r)return;const s=this.getInstanceMap(e.name);if(n.type===t.OBSERVER_TYPE.ADD)d(this.gameRef(r),r,()=>this.attachGeneric(e,a,r,s));else if(n.type===t.OBSERVER_TYPE.CHANGE){const t=s.get(r.id);if(!t)return void d(this.gameRef(r),r,()=>this.attachGeneric(e,a,r,s));null===(i=e.syncOnChange)||void 0===i||i.call(e,t,a)}else n.type===t.OBSERVER_TYPE.REMOVE&&this.detachGeneric(r.id,s,r)}attachGeneric(e,t,n,i){var a,r,o,d,p,u,h;if(i.has(n.id))return;const f=this.gameRef(n),m=function(e,t,n,i){var a,r;if(!i)return{};switch(i.kind){case"single":{const a=n[i.key],r=c(e,t,a);return i.required&&!r?null:{single:r}}case"object":{const r=null!==(a=n[i.folder])&&void 0!==a?a:{},s={};for(const{name:n,required:a}of i.keys){const i=c(e,t,r[n]);if(a&&!i)return null;s[n]=i}return{object:s}}case"array":{const a=(null!==(r=n[i.key])&&void 0!==r?r:[]).map(n=>c(e,t,n)).filter(Boolean);return a.length<i.minLength?null:{array:a}}}}(f,n,t,e.views);if(e.views&&null===m)return;if(function(e,t,n,i){switch(e){case"ProgressBar":t.__resolved_bg=c(n,i,t.bgView),t.__resolved_fill=c(n,i,t.fillView);break;case"Select":t.__resolved_closedView=c(n,i,t.closedView),t.__resolved_openView=c(n,i,t.openView);break;case"Dialog":t.__resolved_backdropView=c(n,i,t.backdropView),t.__resolved_backgroundView=c(n,i,t.backgroundView);break;case"MaskedFrame":t.__resolved_targetView=c(n,i,t.targetView),t.__resolved_maskView=c(n,i,t.maskView)}}(e.name,t,f,n),!function(e,t){switch(e){case"ProgressBar":return!(!t.__resolved_bg||!t.__resolved_fill);case"Select":return!(!t.__resolved_closedView||!t.__resolved_openView);case"Dialog":default:return!0;case"MaskedFrame":return!(!t.__resolved_targetView||!t.__resolved_maskView)}}(e.name,t))return;if("List"===e.name||"ScrollBox"===e.name){const i="List"===e.name?t.itemsChildName:t.contentChildName;t.__resolved_items=function(e,t,n){var i,a,r;const l=[],o=ne(t,n);if(!o)return l;const d=(null===(i=o.transform)||void 0===i?void 0:i.children)||[];for(const t of d){const n=null==t?void 0:t.gameObject;if(!n)continue;const i=s(e,n);if(i){try{null===(r=null===(a=i.parent)||void 0===a?void 0:a.removeChild)||void 0===r||r.call(a,i)}catch(e){}l.push(i)}}return l}(f,n,i)}const g=e.optionsBuilder(t,null!=m?m:{}),y=e.positional?new e.pixiClass(...g):new e.pixiClass(g);if(null===(a=e.postCreate)||void 0===a||a.call(e,y,t),i.set(n.id,y),l(f,n,y),"Dialog"===e.name){const e=ne(n,null!==(r=t.contentChildName)&&void 0!==r?r:"content");if(e){const t=s(f,e);if(t)try{null===(d=(o=y).addChild)||void 0===d||d.call(o,t)}catch(e){}}}if("MaskedFrame"===e.name&&t.borderView){const e=c(f,n,t.borderView);if(e)try{null===(u=(p=y).addChild)||void 0===u||u.call(p,e)}catch(e){}}if(e.signalMap){const i=K(y,{go:n,prefix:e.signalPrefix},e.signalMap(t));this.signalCleanups.set(n.id,i)}null===(h=e.onAttachedExtra)||void 0===h||h.call(e,y,t,n,f)}detachGeneric(e,t,n){const i=t.get(e);o(this.gameRef(n),n,i),t.delete(e);const a=this.signalCleanups.get(e);a&&(a.forEach(e=>e()),this.signalCleanups.delete(e))}handleRadioGroup(e){const n=e.component,i=n.gameObject;if(i)if(e.type===t.OBSERVER_TYPE.ADD)d(this.gameRef(i),i,()=>queueMicrotask(()=>this.attachRadioGroup(n)));else if(e.type===t.OBSERVER_TYPE.CHANGE)n.applySelection();else if(e.type===t.OBSERVER_TYPE.REMOVE){const e=this.radioGroupInstances.get(i.id);o(this.gameRef(i),i,e),this.radioGroupInstances.delete(i.id);const t=this.signalCleanups.get(i.id);t&&(t.forEach(e=>e()),this.signalCleanups.delete(i.id))}}attachRadioGroup(e){var t,n,i,r,s;const o=e.gameObject,d=this.gameRef(o);if(!o||this.radioGroupInstances.has(o.id))return;e.boundCheckBoxes=[];const c=[],p=[],u=(null===(t=o.transform)||void 0===t?void 0:t.children)||[];for(const t of u){const a=null==t?void 0:t.gameObject;if(!a)continue;if(e.childNames&&!e.childNames.includes(a.name))continue;const s=null===(n=a.getComponent)||void 0===n?void 0:n.call(a,"CheckBox");if(!s)continue;const l=this.checkBoxInstances.get(a.id);if(l){try{null===(r=null===(i=l.parent)||void 0===i?void 0:i.removeChild)||void 0===r||r.call(i,l)}catch(e){}c.push(l),p.push(a.name),e.boundCheckBoxes.push({name:a.name,cb:s})}}if(0===c.length)return;const h=e.selectedId?Math.max(0,p.indexOf(e.selectedId)):0,f=new a.RadioGroup({items:c,type:null!==(s={horizontal:"horizontal",vertical:"vertical",bidirectional:"bidirectional"}[e.direction])&&void 0!==s?s:"vertical",elementsMargin:e.elementsMargin,selectedItem:h});this.radioGroupInstances.set(o.id,f),l(d,o,f);const m=K(f,{go:o,prefix:"radiogroup"},{change:(t,n)=>{var i;const a=null!==(i=p[t])&&void 0!==i?i:n;return e.selectedId=a,{selectedId:e.selectedId,index:t}}});this.signalCleanups.set(o.id,m)}getInstanceMap(e){let t=this.instances.get(e);return t||(t=new Map,this.instances.set(e,t)),t}gameRef(e){var t,n,i;const a=this.game;return a||(e&&null!==(i=null!==(t=e.game)&&void 0!==t?t:null===(n=e.scene)||void 0===n?void 0:n.game)&&void 0!==i?i:null)}};ee.systemName="UISystem",ee=function(e,t,n,i){var a,r=arguments.length,s=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(s=(r<3?a(s):r>3?a(t,n,s):a(t,n))||s);return r>3&&s&&Object.defineProperty(t,n,s),s}([t.decorators.componentObserver(function(){const e={UI:[{prop:["shapes"],deep:!0}],RadioGroup:[{prop:["selectedId"],deep:!1},{prop:["direction"],deep:!1},{prop:["elementsMargin"],deep:!1}]};for(const[t,n]of Object.entries(X)){const i=[];for(const[e,t]of Object.entries(n.fields)){const n="shallowMerge"===t.kind||"tuple"===t.kind||"arrayCopy"===t.kind;i.push({prop:[e],deep:n})}e[t]=i}return e}())],ee);var te=ee;function ne(e,t){var n,i;if(!e)return null;if("function"==typeof e.findChildByName)try{const n=e.findChildByName(t);if(n)return n}catch(e){}const a=(null===(n=e.transform)||void 0===n?void 0:n.children)||[];for(const e of a)if((null===(i=null==e?void 0:e.gameObject)||void 0===i?void 0:i.name)===t)return e.gameObject;return null}exports.Button=V,exports.COMPONENT_DEFINITIONS=X,exports.CheckBox=N,exports.CircularProgressBar=U,exports.Dialog=z,exports.DoubleSlider=D,exports.FancyButton=T,exports.Input=L,exports.List=W,exports.MaskedFrame=H,exports.PixiUiComponent=p,exports.PluginUiSystem=te,exports.ProgressBar=F,exports.RadioGroup=J,exports.ScrollBox=Y,exports.Select=$,exports.Slider=G,exports.Switcher=q,exports.UI=r,exports.UISystem=te,exports.defineUiComponent=u;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@eva/eva.js"),i=require("@eva/plugin-renderer-graphics"),n=require("pixi.js"),a=require("@pixi/ui");exports.ShapeType=void 0,(e=exports.ShapeType||(exports.ShapeType={})).RECT="rect",e.CIRCLE="circle",e.ELLIPSE="ellipse",e.ROUNDED_RECT="roundedRect";const o=exports.ShapeType;class l extends t.Component{constructor(){super(...arguments),this.componentName="Shape",this.shapes=[]}static getInspectorMetadata(){const e=[{name:"fill",type:"color",isArray:!1},{name:"stroke",type:"color",isArray:!1},{name:"lineWidth",type:"number",isArray:!1},{name:"alpha",type:"number",isArray:!1},{name:"x",type:"number",isArray:!1},{name:"y",type:"number",isArray:!1},{name:"width",type:"number",isArray:!1},{name:"height",type:"number",isArray:!1},{name:"radius",type:"number",isArray:!1}];return{name:l.componentName,type:"object",isArray:!1,isFolder:!0,children:[{name:"componentName",type:"string",isArray:!1},{name:"shapes",type:"object",isArray:!0,children:[{name:"type",type:"string",isArray:!1},{name:"style",type:"object",isArray:!1,children:e}]},{name:"type",type:"string",isArray:!1},{name:"style",type:"object",isArray:!1,children:e}]}}init(e){var t;e&&(this.componentName=null!==(t=e.componentName)&&void 0!==t?t:this.componentName,e.shapes?this.shapes=e.shapes:e.type&&e.style&&(this.shapes=[{type:e.type,style:e.style}]))}awake(){this.redraw()}start(){this.redraw(),queueMicrotask(()=>this.redraw())}parseLinearGradient(e){const t=e.match(/linear-gradient\s*\(\s*([^,]+),\s*(.+)\)/);if(!t)return null;const i=t[1].trim(),n=parseFloat(i),a=[],o=t[2].split(/,(?![^(]*\))/);for(const e of o){const t=e.trim().match(/(.+?)\s+(\d+)%/);if(t){const e=t[1].trim(),i=parseFloat(t[2])/100;a.push({color:e,position:i})}}return{angle:n,colorStops:a}}createGradient(e,t,i,a,o=0,l=0){let r=0,s=0,d=0,c=0;if(0===e)r=.5,s=1,d=.5,c=0;else if(90===e)r=0,s=.5,d=1,c=.5;else if(180===e)r=.5,s=0,d=.5,c=1;else if(270===e)r=1,s=.5,d=0,c=.5;else{const t=(90-e)*(Math.PI/180),n=.5,o=.5,l=Math.max(i,a),u=Math.sqrt(i*i+a*a)/(2*l);r=n-Math.cos(t)*u,s=o-Math.sin(t)*u,d=n+Math.cos(t)*u,c=o+Math.sin(t)*u}const u=new n.FillGradient(r,s,d,c);return t.forEach(e=>{u.addColorStop(e.position,e.color)}),u}getShapeBounds(e,t){const i=t.x||0,n=t.y||0;switch(e){case exports.ShapeType.RECT:case exports.ShapeType.ROUNDED_RECT:return{width:t.width,height:t.height,x:i,y:n};case exports.ShapeType.CIRCLE:return{width:2*t.radius,height:2*t.radius,x:i,y:n};case exports.ShapeType.ELLIPSE:return{width:t.width,height:t.height,x:i,y:n};default:return{width:100,height:100,x:i,y:n}}}redraw(){if(!this.gameObject)return;let e=this.gameObject.getComponent("Graphics");e||(e=this.gameObject.addComponent(new i.Graphics));const t=e.graphics;t?(t.clear(),this.shapes.forEach(e=>{this.drawShape(t,e.type,e.style)})):console.warn("Graphics component has no graphics instance")}drawShape(e,t,i){var n;switch(void 0!==i.alpha&&(e.alpha=i.alpha),t){case exports.ShapeType.RECT:this.drawRect(e,i);break;case exports.ShapeType.CIRCLE:this.drawCircle(e,i);break;case exports.ShapeType.ELLIPSE:this.drawEllipse(e,i);break;case exports.ShapeType.ROUNDED_RECT:this.drawRoundedRect(e,i);break;default:console.warn(`Unknown shape type: ${t}`)}if(void 0!==i.fill)if("string"==typeof i.fill&&i.fill.includes("linear-gradient")){const n=this.parseLinearGradient(i.fill);if(n){const a=this.getShapeBounds(t,i),o=this.createGradient(n.angle,n.colorStops,a.width,a.height,a.x,a.y);e.fill(o)}else console.warn(`Failed to parse gradient: ${i.fill}`),e.fill("#000000")}else e.fill(i.fill);void 0!==i.stroke&&e.stroke({color:i.stroke,width:null!==(n=i.lineWidth)&&void 0!==n?n:1})}drawRect(e,t){const i=t.x||0,n=t.y||0;e.rect(i,n,t.width,t.height)}drawCircle(e,t){const i=t.x||0,n=t.y||0;e.circle(i,n,t.radius)}drawEllipse(e,t){const i=t.x||0,n=t.y||0;e.ellipse(i,n,t.width/2,t.height/2)}drawRoundedRect(e,t){const i=t.x||0,n=t.y||0,a=t.radius||0;e.roundRect(i,n,t.width,t.height,a)}addShape(e,t){this.shapes.push({type:e,style:t}),this.redraw()}clearShapes(){this.shapes=[],this.redraw()}updateShape(e,t,i){e>=0&&e<this.shapes.length&&(this.shapes[e]={type:t,style:i},this.redraw())}removeShape(e){e>=0&&e<this.shapes.length&&(this.shapes.splice(e,1),this.redraw())}getShapeCount(){return this.shapes.length}getShape(e){return e>=0&&e<this.shapes.length?this.shapes[e]:null}setAlpha(e){this.shapes.forEach(t=>{t.style.alpha=e}),this.redraw()}setFill(e){this.shapes.forEach(t=>{t.style.fill=e}),this.redraw()}setStroke(e,t=1){this.shapes.forEach(i=>{i.style.stroke=e,i.style.lineWidth=t}),this.redraw()}}function r(e,t){var i,n,a;if(!e||!t)return null;const o=function(e){var t,i,n,a,o,l;const r=null===(i=(t=e).getSystem)||void 0===i?void 0:i.call(t,"Renderer");if(r)return r;const s=null!==(n=e.systems)&&void 0!==n?n:[];for(const e of s){const t=null!==(o=null===(a=null==e?void 0:e.constructor)||void 0===a?void 0:a.systemName)&&void 0!==o?o:null===(l=null==e?void 0:e.constructor)||void 0===l?void 0:l.name;if("Renderer"===t||"RendererSystem"===t)return e;if("Renderer"===(null==e?void 0:e.name)||"RendererSystem"===(null==e?void 0:e.name))return e;if(null==e?void 0:e.containerManager)return e}return null}(e),l=null!==(i=null==o?void 0:o.containerManager)&&void 0!==i?i:null===(n=null==o?void 0:o.rendererManager)||void 0===n?void 0:n.containerManager;return(null==l?void 0:l.getContainer)&&null!==(a=l.getContainer(t.id))&&void 0!==a?a:null}function s(e,t,i){const n=r(e,t);if(!n)return!1;try{return i.parent&&i.parent!==n&&i.parent.removeChild(i),"function"==typeof n.addChildAt?n.addChildAt(i,0):n.addChild(i),!0}catch(e){return!1}}function d(e,t,i){if(!i)return;const n=r(e,t);try{n&&i.parent===n&&n.removeChild(i),"function"==typeof i.destroy&&i.destroy({children:!0})}catch(e){}}function c(e,t,i,n=4){const a=r(e,t);a?i(a):n<=0||queueMicrotask(()=>c(e,t,i,n-1))}function u(e,t,i){var a,o;if(!i)return null;if("entityName"in i){const a=function(e,t){var i,n,a;if("function"==typeof e.findChildByName)try{const i=e.findChildByName(t);if(i)return i}catch(e){}const o=null!==(n=null===(i=e.transform)||void 0===i?void 0:i.children)&&void 0!==n?n:[];for(const e of o)if((null===(a=null==e?void 0:e.gameObject)||void 0===a?void 0:a.name)===t)return e.gameObject;return null}(t,i.entityName);if(a){const t=r(e,a);if(t){try{t.parent&&t.parent.removeChild(t)}catch(e){}return function(e,t){const i=new n.Container;return i.label=t?`${t}:view-ref`:"plugin-ui-view-ref",i.addChild(e),i}(t,a.name)}}return i.fallback?u(e,t,i.fallback):null}if("shape"in i)return null!==(a=f(i.shape))&&void 0!==a?a:i.fallback?u(e,t,i.fallback):null;if("ui"in i)return null!==(o=f(i.ui))&&void 0!==o?o:i.fallback?u(e,t,i.fallback):null;if("texture"in i){const a=p(e,i.texture);return a?new n.Sprite(a):i.fallback?u(e,t,i.fallback):null}if("color"in i)try{const e=new n.Graphics;return i.radius&&i.radius>0?e.roundRect(0,0,i.width,i.height,i.radius):e.rect(0,0,i.width,i.height),e.fill(i.color),e}catch(e){return console.error("[view-resolver] color view create failed",e),null}return null}function h(e,t,i){if(!e)return e;const n=function(e){return{top:v(null==e?void 0:e.top),right:v(null==e?void 0:e.right),bottom:v(null==e?void 0:e.bottom),left:v(null==e?void 0:e.left)}}(t);if(0===n.top&&0===n.right&&0===n.bottom&&0===n.left)return e;const a=e.fallback?h(e.fallback,n,i):void 0;if("color"in e){const t=g(e.width,n.left+n.right),i=g(e.height,n.top+n.bottom);return Object.assign(Object.assign(Object.assign({},e),{width:t,height:i,radius:y(e.radius,t,i)}),a?{fallback:a}:{})}return"shape"in e?Object.assign(Object.assign(Object.assign({},e),{shape:b(e.shape,n,i)}),a?{fallback:a}:{}):"ui"in e?Object.assign(Object.assign(Object.assign({},e),{ui:b(e.ui,n,i)}),a?{fallback:a}:{}):a?Object.assign(Object.assign({},e),{fallback:a}):e}function p(e,t){var i,a,o;const l=null!==(i=null==e?void 0:e.resource)&&void 0!==i?i:null;if(null===(a=null==l?void 0:l.instances)||void 0===a?void 0:a[t]){const e=l.instances[t];if(e instanceof n.Texture)return e;if((null==e?void 0:e.image)instanceof n.Texture)return e.image}try{return null!==(o=n.Texture.from(t))&&void 0!==o?o:null}catch(e){return null}}function f(e){var t,i,a,o,l;if(!e||!e.type)return null;const r=new n.Graphics,{style:s}=e,d=null!==(t=s.x)&&void 0!==t?t:0,c=null!==(i=s.y)&&void 0!==i?i:0,u=null!==(a=s.width)&&void 0!==a?a:0,h=null!==(o=s.height)&&void 0!==o?o:0,p=null!==(l=s.radius)&&void 0!==l?l:0;switch(e.type){case"rect":!function(e,t,i,n,a){const o=e;if("function"==typeof o.rect)return void o.rect(t,i,n,a);o.drawRect(t,i,n,a)}(r,d,c,u,h);break;case"roundedRect":!function(e,t,i,n,a,o){const l=e;if("function"==typeof l.roundRect)return void l.roundRect(t,i,n,a,o);l.drawRoundedRect(t,i,n,a,o)}(r,d,c,u,h,p);break;case"circle":!function(e,t,i,n){const a=e;if("function"==typeof a.circle)return void a.circle(t,i,n);a.drawCircle(t,i,n)}(r,d+p,c+p,p);break;case"ellipse":!function(e,t,i,n,a){const o=e;if("function"==typeof o.ellipse)return void o.ellipse(t,i,n,a);o.drawEllipse(t,i,n,a)}(r,d+u/2,c+h/2,u/2,h/2)}void 0!==s.fill&&r.fill(s.fill),void 0!==s.stroke&&void 0!==s.lineWidth?r.stroke({color:s.stroke,width:s.lineWidth}):void 0!==s.stroke&&r.stroke({color:s.stroke,width:1}),void 0!==s.alpha&&(r.alpha=s.alpha);try{Object.defineProperty(r,"clone",{value:()=>{var t;return null!==(t=f(e))&&void 0!==t?t:new n.Graphics},configurable:!0})}catch(e){}return r}function v(e){return"number"==typeof e&&Number.isFinite(e)?Math.max(0,e):0}function g(e,t){return Math.max(0,e-t)}function m(e,t,i){return"number"==typeof e?g(e,i):"number"==typeof t?g(t,i):e}function y(e,t,i){if("number"!=typeof e||!Number.isFinite(e))return e;const n=[e];return"number"==typeof t&&n.push(t/2),"number"==typeof i&&n.push(i/2),Math.max(0,Math.min(...n))}function b(e,t,i){var n;const a=null!==(n=e.style)&&void 0!==n?n:{},o=m(a.width,null==i?void 0:i.width,t.left+t.right),l=m(a.height,null==i?void 0:i.height,t.top+t.bottom),r=y(a.radius,o,l);return Object.assign(Object.assign({},e),{style:Object.assign(Object.assign(Object.assign(Object.assign({},a),void 0!==o?{width:o}:{}),void 0!==l?{height:l}:{}),void 0!==r?{radius:r}:{})})}l.componentName="Shape";class k extends t.Component{constructor(){super(...arguments),this.toggleCount=0,this.pressCount=0,this.downCount=0,this.upCount=0,this.hoverCount=0,this.outCount=0,this.upOutCount=0,this.changeCount=0,this.updateCount=0,this.selectCount=0,this.lastSignal="idle",this.visualState="default",this.focused=!1,this.__evaExplicitFields=new Set}init(e){e&&this.applyParams(e)}applyDeclarativeProps(e,t){this.applyParams(e)}applyParams(e){const t=this.constructor.__def;if(t)for(const[i,n]of Object.entries(t.fields)){if(!(i in e))continue;const t=e[i];if(void 0!==t)switch(this.__evaExplicitFields.add(i),n.kind){case"scalar":case"opaque":this[i]=t;break;case"shallowMerge":this[i]=Object.assign(Object.assign({},this[i]),t);break;case"arrayCopy":Array.isArray(t)&&(this[i]=t.slice());break;case"tuple":!Array.isArray(t)||n.tupleLength&&t.length!==n.tupleLength||(this[i]=t.slice())}}}}function x(e){const t=e.name;class i extends k{constructor(i){super(i),this.componentName=t;for(const[t,i]of Object.entries(e.fields))void 0!==i.default?this[t]=w(i.default):t in this||(this[t]=void 0)}static getInspectorMetadata(){return function(e){const t=[];for(const[i,n]of Object.entries(e.fields))n.inspector&&t.push(Object.assign(Object.assign({},n.inspector),{name:n.inspector.name||i}));return{name:e.name,type:"object",isArray:!1,isFolder:!0,children:t}}(e)}}const n=i;n.componentName=t,n.__def=e;try{Object.defineProperty(n,"name",{value:t})}catch(e){}if(e.mixin)for(const[t,n]of Object.entries(e.mixin))i.prototype[t]=n;return n}function w(e){return null===e||"object"!=typeof e?e:Array.isArray(e)?e.slice():Object.assign({},e)}function S(e,t={}){var i;const n=null===(i=null==e?void 0:e.transform)||void 0===i?void 0:i.size;if(!n)return null;const a=B(n.width,t.allowZero),o=B(n.height,t.allowZero);return void 0===a&&void 0===o?null:{width:a,height:o}}function C(e){if(!e)return!1;const t=e.__evaExplicitFields;return t&&"function"==typeof t.has?t.has("width")||t.has("height"):void 0!==e.width||void 0!==e.height}function _(e,t,i,n,a){const o=S(n,{allowZero:"transform-change"===a});if(!o)return!1;const l={componentName:e.name,component:i,gameObject:n,source:a};return e.applySize?e.applySize(t,o,null!=i?i:{},l):O(t,o),!0}function O(e,t){if(!e||!t)return;const i=B(t.width,!0),n=B(t.height,!0);if(void 0===i&&void 0===n)return;const a=null!=i?i:P(e,"width"),o=null!=n?n:P(e,"height");let l=!1;if("function"==typeof e.setSize&&void 0!==a&&void 0!==o)try{e.setSize(a,o),l=!0}catch(e){l=!1}l||(void 0!==i&&(e.width=i),void 0!==n&&(e.height=n)),M(e)}function M(e){var t,i,n,a;try{null===(i=null===(t=null==e?void 0:e.list)||void 0===t?void 0:t.arrangeChildren)||void 0===i||i.call(t)}catch(e){}try{null===(n=null==e?void 0:e.arrangeChildren)||void 0===n||n.call(e)}catch(e){}try{null===(a=null==e?void 0:e.resize)||void 0===a||a.call(e,!0)}catch(e){}}function B(e,t=!1){const i=Number(e);if(Number.isFinite(i)&&!(t?i<0:i<=0))return i}function P(e,t){const i=Number(null==e?void 0:e[t]);return Number.isFinite(i)&&i>=0?i:void 0}const j={kind:"scalar",default:!0,inspector:{name:"enabled",type:"boolean"}},T={kind:"scalar",inspector:{name:"bindToStore",type:"string"}};function V(){const[e,t]=this.valueRange;if(t<=e)return 0;return(Math.max(e,Math.min(t,this.value))-e)/(t-e)*100}function R(e){if(void 0!==e)return"string"==typeof e?parseInt(e.replace("#",""),16):e}const A={name:"Button",signalPrefix:"button",pixiClass:a.ButtonContainer,fields:{enabled:j,view:{kind:"opaque",inspector:{name:"view",type:"object"}}},views:{kind:"single",key:"view",required:!0},positional:!0,optionsBuilder:(e,t)=>[t.single],postCreate:(e,t)=>{e.enabled=t.enabled},signalMap:e=>({press:()=>(e.pressCount+=1,e.lastSignal="press",e.visualState="default",{pressCount:e.pressCount,lastSignal:e.lastSignal,visualState:e.visualState}),down:()=>(e.downCount+=1,e.lastSignal="down",e.visualState="pressed",{downCount:e.downCount,lastSignal:e.lastSignal,visualState:e.visualState}),up:()=>(e.upCount+=1,e.lastSignal="up",e.visualState="default",{upCount:e.upCount,lastSignal:e.lastSignal,visualState:e.visualState}),hover:()=>(e.hoverCount+=1,e.lastSignal="hover",e.visualState="hover",{hoverCount:e.hoverCount,lastSignal:e.lastSignal,visualState:e.visualState}),out:()=>(e.outCount+=1,e.lastSignal="out",e.visualState="default",{outCount:e.outCount,lastSignal:e.lastSignal,visualState:e.visualState}),upOut:()=>(e.upOutCount+=1,e.lastSignal="upOut",e.visualState="default",{upOutCount:e.upOutCount,lastSignal:e.lastSignal,visualState:e.visualState})}),syncOnChange:(e,t)=>{e.enabled=t.enabled}},E={name:"FancyButton",signalPrefix:"fancybutton",pixiClass:a.FancyButton,fields:{enabled:j,state:{kind:"scalar",default:"default",inspector:{name:"state",type:"string"}},selected:{kind:"scalar",default:!1,inspector:{name:"selected",type:"boolean"}},text:{kind:"scalar",inspector:{name:"text",type:"string"}},padding:{kind:"scalar",inspector:{name:"padding",type:"number"}},selectedTint:{kind:"scalar",default:"#FFD680",inspector:{name:"selectedTint",type:"color"}},views:{kind:"shallowMerge",default:{},inspector:{name:"views",type:"object",isFolder:!0,children:[{name:"default",type:"object"},{name:"hover",type:"object"},{name:"pressed",type:"object"},{name:"disabled",type:"object"},{name:"icon",type:"object"}]}},offset:{kind:"shallowMerge",default:{}},textOffset:{kind:"shallowMerge",default:{}},iconOffset:{kind:"shallowMerge",default:{}},nineSliceSprite:{kind:"opaque"},textStyle:{kind:"shallowMerge",default:{}},textClass:{kind:"scalar",default:"text"},bitmapFontName:{kind:"scalar",default:"TitleFont"},defaultTextScale:{kind:"opaque"},defaultIconScale:{kind:"opaque"},defaultTextAnchor:{kind:"opaque"},defaultIconAnchor:{kind:"opaque"},anchor:{kind:"scalar"},anchorX:{kind:"scalar"},anchorY:{kind:"scalar"},scale:{kind:"scalar"},animations:{kind:"opaque"},contentFittingMode:{kind:"scalar"},ignoreRefitting:{kind:"scalar"},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}}},views:{kind:"object",folder:"views",keys:[{name:"default",required:!1},{name:"hover",required:!1},{name:"pressed",required:!1},{name:"disabled",required:!1},{name:"icon",required:!1}]},optionsBuilder:(e,t)=>{var i,n,a,o,l;const r={text:N(e),padding:e.padding,offset:e.offset,textOffset:e.textOffset,iconOffset:e.iconOffset,nineSliceSprite:e.nineSliceSprite,defaultTextScale:e.defaultTextScale,defaultIconScale:e.defaultIconScale,defaultTextAnchor:e.defaultTextAnchor,defaultIconAnchor:e.defaultIconAnchor,anchor:e.anchor,anchorX:e.anchorX,anchorY:e.anchorY,scale:e.scale,animations:e.animations,contentFittingMode:e.contentFittingMode,ignoreRefitting:e.ignoreRefitting};return(null===(i=t.object)||void 0===i?void 0:i.default)&&(r.defaultView=q(e,"default",t.object.default)),(null===(n=t.object)||void 0===n?void 0:n.hover)&&(r.hoverView=q(e,"hover",t.object.hover)),(null===(a=t.object)||void 0===a?void 0:a.pressed)&&(r.pressedView=q(e,"pressed",t.object.pressed)),(null===(o=t.object)||void 0===o?void 0:o.disabled)&&(r.disabledView=q(e,"disabled",t.object.disabled)),(null===(l=t.object)||void 0===l?void 0:l.icon)&&(r.icon=t.object.icon),r},postCreate:(e,t)=>{e.enabled=t.enabled,t.state&&"function"==typeof e.setState&&e.setState(t.state,!0),I(e,t),$(e,t),t.selected&&z(e,t)},signalMap:e=>({press:()=>(e.pressCount+=1,{}),hover:()=>(e.hoverCount+=1,{}),down:!0,up:!0}),syncOnChange:(e,t)=>{e.enabled=t.enabled,void 0!==t.text&&e.text!==t.text&&(e.text=t.text),void 0!==t.padding&&e.padding!==t.padding&&(e.padding=t.padding),void 0!==t.textOffset&&(e.textOffset=t.textOffset),void 0!==t.iconOffset&&(e.iconOffset=t.iconOffset),void 0!==t.defaultTextScale&&(e.defaultTextScale=t.defaultTextScale),void 0!==t.defaultIconScale&&(e.defaultIconScale=t.defaultIconScale),void 0!==t.defaultTextAnchor&&(e.defaultTextAnchor=t.defaultTextAnchor),void 0!==t.defaultIconAnchor&&(e.defaultIconAnchor=t.defaultIconAnchor),void 0!==t.contentFittingMode&&(e.contentFittingMode=t.contentFittingMode),void 0!==t.ignoreRefitting&&e.options&&(e.options.ignoreRefitting=t.ignoreRefitting),t.state&&"function"==typeof e.setState&&e.setState(t.state,!0),I(e,t),$(e,t),z(e,t)}};function I(e,t){var i,n,a,o,l,r,s;if(!(void 0!==t.anchor||void 0!==t.anchorX||void 0!==t.anchorY)||!(null===(i=null==e?void 0:e.anchor)||void 0===i?void 0:i.set))return;const d=null!==(o=null!==(a=null!==(n=t.anchorX)&&void 0!==n?n:t.anchor)&&void 0!==a?a:e.anchor.x)&&void 0!==o?o:0,c=null!==(s=null!==(r=null!==(l=t.anchorY)&&void 0!==l?l:t.anchor)&&void 0!==r?r:e.anchor.y)&&void 0!==s?s:0;try{e.anchor.set(d,c)}catch(e){}}function N(e){var t,i,a;if(void 0===e.text)return;const o=String(e.text);if("html"===e.textClass)return new n.HTMLText({text:o,style:e.textStyle});if("bitmap"===e.textClass){const l=null!==(t=e.bitmapFontName)&&void 0!==t?t:"TitleFont";return function(e,t){if(F.has(e))return;try{n.BitmapFontManager.install({name:e,style:null!=t?t:{}})}catch(e){}F.add(e)}(l,e.textStyle),new n.BitmapText({text:o,style:{fontFamily:l,fontSize:null!==(a=null===(i=e.textStyle)||void 0===i?void 0:i.fontSize)&&void 0!==a?a:40}})}return e.textStyle&&Object.keys(e.textStyle).length>0?new n.Text({text:o,style:e.textStyle}):e.text}const F=new Set;function q(e,t,i){var n;const a=null===(n=e.views)||void 0===n?void 0:n[t];return e.nineSliceSprite&&a&&"texture"in a?H(a.texture):i}function z(e,t){try{const i=e.defaultView;i&&"tint"in i&&(i.tint=t.selected?t.selectedTint:16777215)}catch(e){}}const D={name:"CheckBox",signalPrefix:"checkbox",pixiClass:a.CheckBox,fields:{enabled:j,checked:{kind:"scalar",default:!1,inspector:{name:"checked",type:"boolean"}},text:{kind:"scalar",inspector:{name:"text",type:"string"}},bindToStore:T,views:{kind:"shallowMerge",default:{},inspector:{name:"views",type:"object",isFolder:!0,children:[{name:"checked",type:"object"},{name:"unchecked",type:"object"}]}},textStyle:{kind:"shallowMerge",default:{fill:16777215}},textOffset:{kind:"shallowMerge",default:{}},disabledStyle:{kind:"shallowMerge",default:{alpha:.4,scale:1}}},views:{kind:"object",folder:"views",keys:[{name:"checked",required:!0},{name:"unchecked",required:!0}]},optionsBuilder:(e,t)=>({style:{checked:t.object.checked,unchecked:t.object.unchecked,text:e.textStyle,textOffset:e.textOffset},text:e.text,checked:e.checked}),signalMap:e=>({check:t=>(e.checked=t,e.toggleCount+=1,{value:t})}),syncOnChange:(e,t)=>{e.checked!==t.checked&&(e.checked=t.checked),void 0!==t.text&&e.text!==t.text&&(e.text=t.text),function(e,t){var i,n,a;const o=e.style;if(!o||!t.textStyle&&!t.textOffset)return;const l=Object.assign(Object.assign({},o),{text:null!==(i=t.textStyle)&&void 0!==i?i:o.text,textOffset:null!==(n=t.textOffset)&&void 0!==n?n:o.textOffset});e._style=l,e.labelText&&t.textStyle&&(e.labelText.style=t.textStyle);try{null===(a=e.alignText)||void 0===a||a.call(e)}catch(e){}}(e,t)}},G={name:"Switcher",signalPrefix:"switcher",pixiClass:a.Switcher,fields:{active:{kind:"scalar",default:0,inspector:{name:"active",type:"number"}},views:{kind:"arrayCopy",default:[]},triggerEvent:{kind:"scalar",default:"onPress",inspector:{name:"triggerEvent",type:"string"}},bindToStore:T},views:{kind:"array",key:"views",minLength:2},positional:!0,optionsBuilder:(e,t)=>[t.array,e.triggerEvent,e.active],signalMap:e=>({change:t=>(e.active="number"==typeof t?t:t?1:0,e.changeCount+=1,{active:e.active})}),syncOnChange:(e,t)=>{e.active!==t.active&&(e.active=t.active),void 0!==t.triggerEvent&&(e.triggerEvents=t.triggerEvent)}},L={name:"Slider",signalPrefix:"slider",pixiClass:a.Slider,fields:{enabled:j,value:{kind:"scalar",default:0,inspector:{name:"value",type:"number"}},min:{kind:"scalar",default:0,inspector:{name:"min",type:"number"}},max:{kind:"scalar",default:100,inspector:{name:"max",type:"number"}},step:{kind:"scalar",default:1,inspector:{name:"step",type:"number"}},orientation:{kind:"scalar",default:"horizontal",inspector:{name:"orientation",type:"string"}},showValue:{kind:"scalar",default:!1,inspector:{name:"showValue",type:"boolean"}},views:{kind:"shallowMerge",default:{}},nineSliceSprite:{kind:"opaque"},fillPaddings:{kind:"shallowMerge",default:{}},valueTextStyle:{kind:"shallowMerge",default:{fill:16777215}},valueTextOffset:{kind:"shallowMerge",default:{}},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}},bindToStore:T},views:{kind:"object",folder:"views",keys:[{name:"bg",required:!0},{name:"fill",required:!0},{name:"thumb",required:!0}]},optionsBuilder:(e,t)=>{var i,n,a;return{bg:Y(null===(i=e.views)||void 0===i?void 0:i.bg,t.object.bg),fill:Y(null===(n=e.views)||void 0===n?void 0:n.fill,t.object.fill),slider:Y(null===(a=e.views)||void 0===a?void 0:a.thumb,t.object.thumb),min:e.min,max:e.max,step:e.step,value:e.value,showValue:e.showValue,fillPaddings:e.fillPaddings,nineSliceSprite:e.nineSliceSprite,valueTextStyle:e.valueTextStyle,valueTextOffset:e.valueTextOffset}},postCreate:(e,t)=>$(e,t),signalMap:e=>({update:t=>(e.value=t,e.updateCount+=1,{value:t}),change:t=>(e.value=t,e.changeCount+=1,{value:t})}),syncOnChange:(e,t)=>{e.value!==t.value&&(e.value=t.value),$(e,t)}},W={name:"DoubleSlider",signalPrefix:"doubleslider",pixiClass:a.DoubleSlider,fields:{enabled:j,value1:{kind:"scalar",default:0,inspector:{name:"value1",type:"number"}},value2:{kind:"scalar",default:100,inspector:{name:"value2",type:"number"}},min:{kind:"scalar",default:0,inspector:{name:"min",type:"number"}},max:{kind:"scalar",default:100,inspector:{name:"max",type:"number"}},step:{kind:"scalar",default:1},showValue:{kind:"scalar",default:!1,inspector:{name:"showValue",type:"boolean"}},views:{kind:"shallowMerge",default:{}},nineSliceSprite:{kind:"opaque"},fillPaddings:{kind:"shallowMerge",default:{}},valueTextStyle:{kind:"shallowMerge",default:{fill:16777215}},valueTextOffset:{kind:"shallowMerge",default:{}},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}},bindToStore1:{kind:"scalar"},bindToStore2:{kind:"scalar"}},views:{kind:"object",folder:"views",keys:[{name:"bg",required:!0},{name:"fill",required:!0},{name:"slider1",required:!0},{name:"slider2",required:!0}]},optionsBuilder:(e,t)=>{var i,n,a,o;return{bg:Y(null===(i=e.views)||void 0===i?void 0:i.bg,t.object.bg),fill:Y(null===(n=e.views)||void 0===n?void 0:n.fill,t.object.fill),slider1:Y(null===(a=e.views)||void 0===a?void 0:a.slider1,t.object.slider1),slider2:Y(null===(o=e.views)||void 0===o?void 0:o.slider2,t.object.slider2),min:e.min,max:e.max,step:e.step,value1:e.value1,value2:e.value2,showValue:e.showValue,fillPaddings:e.fillPaddings,nineSliceSprite:e.nineSliceSprite,valueTextStyle:e.valueTextStyle,valueTextOffset:e.valueTextOffset}},postCreate:(e,t)=>$(e,t),signalMap:e=>({update:(t,i)=>(e.value1=t,e.value2=i,e.updateCount+=1,{value1:t,value2:i}),change:(t,i)=>(e.value1=t,e.value2=i,e.changeCount+=1,{value1:t,value2:i})}),syncOnChange:(e,t)=>{e.value1!==t.value1&&(e.value1=t.value1),e.value2!==t.value2&&(e.value2=t.value2),$(e,t)}},U={name:"ProgressBar",signalPrefix:"progressbar",pixiClass:a.ProgressBar,fields:{value:{kind:"scalar",default:0,inspector:{name:"value",type:"number"}},valueRange:{kind:"tuple",tupleLength:2,default:[0,100],inspector:{name:"valueRange",type:"number",isArray:!0}},bgView:{kind:"opaque"},fillView:{kind:"opaque"},nineSliceSprite:{kind:"opaque"},fillPaddings:{kind:"shallowMerge",default:{}},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}},bindToStore:T},views:{kind:"object",folder:"__progress_views__",keys:[]},optionsBuilder:(e,t)=>({bg:e.__resolved_bg_view,fill:e.__resolved_fill_view,fillPaddings:e.fillPaddings,nineSliceSprite:e.nineSliceSprite,progress:X(e)}),postCreate:(e,t)=>$(e,t),syncOnChange:(e,t)=>{const i=X(t);e.progress!==i&&(e.progress=i),$(e,t)},mixin:{getProgressPct:V}};function Y(e,t){return e&&"texture"in e?H(e.texture):t}function H(e){var t;return null!==(t=p(void 0,e))&&void 0!==t?t:e}function $(e,t){var i,n;if(void 0===t.width&&void 0===t.height)return;const a=null!==(i=t.width)&&void 0!==i?i:e.width,o=null!==(n=t.height)&&void 0!==n?n:e.height;if("function"==typeof e.setSize)try{return void e.setSize(a,o)}catch(e){}void 0!==t.width&&(e.width=t.width),void 0!==t.height&&(e.height=t.height)}function X(e){const[t,i]=e.valueRange;if(i<=t)return 0;return(Math.max(t,Math.min(i,e.value))-t)/(i-t)*100}const Z={name:"CircularProgressBar",signalPrefix:"circularprogressbar",pixiClass:a.CircularProgressBar,fields:{value:{kind:"scalar",default:0,inspector:{name:"value",type:"number"}},valueRange:{kind:"tuple",tupleLength:2,default:[0,100],inspector:{name:"valueRange",type:"number",isArray:!0}},radius:{kind:"scalar",default:60,inspector:{name:"radius",type:"number"}},lineWidth:{kind:"scalar",default:12,inspector:{name:"lineWidth",type:"number"}},startAngle:{kind:"scalar",default:-90,inspector:{name:"startAngle",type:"number",step:5}},backgroundColor:{kind:"scalar",default:"#1f2937",inspector:{name:"backgroundColor",type:"color"}},fillColor:{kind:"scalar",default:"#22c55e",inspector:{name:"fillColor",type:"color"}},backgroundAlpha:{kind:"scalar",default:1,inspector:{name:"backgroundAlpha",type:"number",step:.05}},fillAlpha:{kind:"scalar",default:1,inspector:{name:"fillAlpha",type:"number",step:.05}},cap:{kind:"scalar",inspector:{name:"cap",type:"string"}},rotation:{kind:"scalar",default:0},offset:{kind:"shallowMerge",default:{}},bindToStore:T},optionsBuilder:e=>({radius:e.radius,lineWidth:e.lineWidth,backgroundColor:e.backgroundColor,fillColor:e.fillColor,backgroundAlpha:e.backgroundAlpha,fillAlpha:e.fillAlpha,cap:e.cap,value:X(e)}),postCreate:(e,t)=>J(e,t),syncOnChange:(e,t)=>{const i=X(t);e.progress!==i&&(e.progress=i),J(e,t)},mixin:{getProgressPct:V}};function J(e,t){var i,n;void 0!==t.rotation&&(e.rotation=t.rotation),t.offset&&(e.x=null!==(i=t.offset.x)&&void 0!==i?i:0,e.y=null!==(n=t.offset.y)&&void 0!==n?n:0)}const K={name:"Input",signalPrefix:"input",pixiClass:a.Input,fields:{enabled:j,value:{kind:"scalar",default:"",inspector:{name:"value",type:"string"}},placeholder:{kind:"scalar",default:"",inspector:{name:"placeholder",type:"string"}},maxLength:{kind:"scalar",default:100,inspector:{name:"maxLength",type:"number"}},secure:{kind:"scalar",default:!1,inspector:{name:"secure",type:"boolean"}},align:{kind:"scalar",default:"left",inspector:{name:"align",type:"string"}},padding:{kind:"tuple",tupleLength:4,default:[8,8,8,8]},textStyle:{kind:"shallowMerge",default:{fontFamily:"Arial",fontSize:16,fill:"#222"}},bgView:{kind:"opaque"},nineSliceSprite:{kind:"opaque"},cleanOnFocus:{kind:"scalar",default:!1,inspector:{name:"cleanOnFocus",type:"boolean"}},addMask:{kind:"scalar",default:!1,inspector:{name:"addMask",type:"boolean"}},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}},bindToStore:T},views:{kind:"single",key:"bgView",required:!0},optionsBuilder:(e,t)=>{return{bg:(i=e.bgView,n=t.single,a=e.nineSliceSprite,a&&i&&"texture"in i?H(i.texture):n),textStyle:e.textStyle,placeholder:e.placeholder,value:e.value,maxLength:e.maxLength,secure:e.secure,align:e.align,padding:e.padding,cleanOnFocus:e.cleanOnFocus,nineSliceSprite:e.nineSliceSprite,addMask:e.addMask};var i,n,a},postCreate:(e,t)=>{e.enabled=t.enabled,$(e,t)},signalMap:e=>({change:t=>(e.value=t,e.changeCount+=1,{value:t}),enter:e=>({value:e})}),syncOnChange:(e,t)=>{e.value!==t.value&&(e.value=t.value),e.enabled!==t.enabled&&(e.enabled=t.enabled),$(e,t)}},Q={name:"List",signalPrefix:"list",pixiClass:a.List,fields:{type:{kind:"scalar",default:"vertical",inspector:{name:"type",type:"string"}},elementsMargin:{kind:"scalar",default:0,inspector:{name:"elementsMargin",type:"number"}},padding:{kind:"scalar"},vertPadding:{kind:"scalar"},horPadding:{kind:"scalar"},topPadding:{kind:"scalar"},bottomPadding:{kind:"scalar"},leftPadding:{kind:"scalar"},rightPadding:{kind:"scalar"},maxWidth:{kind:"scalar"},maxHeight:{kind:"scalar"},itemsChildName:{kind:"scalar",default:"items"}},optionsBuilder:(e,t)=>({type:e.type,elementsMargin:e.elementsMargin,padding:e.padding,vertPadding:e.vertPadding,horPadding:e.horPadding,topPadding:e.topPadding,bottomPadding:e.bottomPadding,leftPadding:e.leftPadding,rightPadding:e.rightPadding,maxWidth:e.maxWidth,maxHeight:e.maxHeight}),postCreate:(e,t)=>{var i;for(const n of null!==(i=t.__resolved_items)&&void 0!==i?i:[])try{e.addChild(n)}catch(e){}"function"==typeof e.arrangeChildren&&e.arrangeChildren()},syncOnChange:(e,t)=>{e.type!==t.type&&(e.type=t.type),e.elementsMargin!==t.elementsMargin&&(e.elementsMargin=t.elementsMargin),"function"==typeof e.arrangeChildren&&e.arrangeChildren()},applySize:function(e,t){const i=B(t.width,!0),n=B(t.height,!0);if(void 0!==i)try{e.maxWidth=i}catch(e){}if(void 0!==n)try{e.maxHeight=n}catch(e){}M(e)}},ee={name:"ScrollBox",signalPrefix:"scrollbox",pixiClass:a.ScrollBox,fields:{width:{kind:"scalar",default:320,inspector:{name:"width",type:"number"}},height:{kind:"scalar",default:240,inspector:{name:"height",type:"number"}},direction:{kind:"scalar",default:"vertical",inspector:{name:"direction",type:"string"}},contentChildName:{kind:"scalar",default:"content"},background:{kind:"scalar",inspector:{name:"background",type:"color"}},radius:{kind:"scalar",default:0,inspector:{name:"radius",type:"number"}},elementsMargin:{kind:"scalar",default:0},disableDynamicRendering:{kind:"scalar",default:!1},disableEasing:{kind:"scalar",default:!1,inspector:{name:"disableEasing",type:"boolean"}},padding:{kind:"scalar",default:0},vertPadding:{kind:"scalar"},horPadding:{kind:"scalar"},topPadding:{kind:"scalar"},bottomPadding:{kind:"scalar"},leftPadding:{kind:"scalar"},rightPadding:{kind:"scalar"},globalScroll:{kind:"scalar",default:!0},shiftScroll:{kind:"scalar",default:!1},proximityRange:{kind:"scalar"},proximityDebounce:{kind:"scalar"},inertia:{kind:"scalar",default:!0},inertiaDecay:{kind:"scalar",default:.92},bounceFactor:{kind:"scalar",default:.18}},mixin:{applyOffset(){},getBounds:()=>({minX:0,maxX:0,minY:0,maxY:0})},optionsBuilder:(e,t)=>{var i;return{width:e.width,height:e.height,type:null!==(i={horizontal:"horizontal",vertical:"vertical",both:"bidirectional"}[e.direction])&&void 0!==i?i:"vertical",background:e.background,radius:e.radius,elementsMargin:e.elementsMargin,padding:e.padding,vertPadding:e.vertPadding,horPadding:e.horPadding,topPadding:e.topPadding,bottomPadding:e.bottomPadding,leftPadding:e.leftPadding,rightPadding:e.rightPadding,disableEasing:e.disableEasing,disableDynamicRendering:e.disableDynamicRendering,globalScroll:e.globalScroll,shiftScroll:e.shiftScroll,proximityRange:e.proximityRange,proximityDebounce:e.proximityDebounce}},signalMap:()=>({scroll:e=>({value:e})}),postCreate:(e,t)=>{var i,n;if("function"==typeof e.addItems)try{e.addItems(null!==(i=t.__resolved_items)&&void 0!==i?i:[])}catch(e){}if("function"==typeof(null===(n=e.list)||void 0===n?void 0:n.arrangeChildren)&&e.list.arrangeChildren(),"function"==typeof e.resize)try{e.resize()}catch(e){}},syncOnChange:(e,t)=>{$(e,t)}},te={name:"Select",signalPrefix:"select",pixiClass:a.Select,fields:{items:{kind:"arrayCopy",default:[]},selectedIndex:{kind:"scalar",default:-1,inspector:{name:"selectedIndex",type:"number"}},placeholder:{kind:"scalar",default:"",inspector:{name:"placeholder",type:"string"}},closedView:{kind:"opaque"},openView:{kind:"opaque"},textStyle:{kind:"shallowMerge",default:{fontFamily:"Arial",fontSize:14,fill:"#222"}},nineSliceSprite:{kind:"opaque"},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}},radius:{kind:"scalar",default:4},visibleItems:{kind:"scalar"},itemWidth:{kind:"scalar"},itemHeight:{kind:"scalar"},itemBackgroundColor:{kind:"scalar",default:0},itemHoverColor:{kind:"scalar",default:6710886},selectedTextOffset:{kind:"shallowMerge",default:{}},scrollBox:{kind:"shallowMerge",default:{}},textClass:{kind:"scalar",default:"text"},open:{kind:"scalar",default:!1},bindToStore:T},views:{kind:"object",folder:"__select_views__",keys:[]},optionsBuilder:e=>{var t,i,a,o,l;return{closedBG:e.__resolved_closedView,openBG:e.__resolved_openView,textStyle:e.textStyle,TextClass:"html"===e.textClass?n.HTMLText:void 0,selectedTextOffset:e.selectedTextOffset,items:{items:(null!==(t=e.items)&&void 0!==t?t:[]).map(e=>e.text),backgroundColor:e.itemBackgroundColor,hoverColor:e.itemHoverColor,width:null!==(a=null!==(i=e.itemWidth)&&void 0!==i?i:e.width)&&void 0!==a?a:200,height:null!==(l=null!==(o=e.itemHeight)&&void 0!==o?o:e.height)&&void 0!==l?l:30,textStyle:e.textStyle,TextClass:"html"===e.textClass?n.HTMLText:void 0,radius:e.radius},selected:e.selectedIndex>=0?e.selectedIndex:void 0,visibleItems:e.visibleItems,scrollBox:Object.assign({width:e.width,height:e.height&&e.visibleItems?e.height*e.visibleItems:void 0,radius:e.radius},e.scrollBox),nineSliceSprite:e.nineSliceSprite}},postCreate:(e,t)=>{t.open&&"function"==typeof e.open&&e.open()},signalMap:e=>({select:(t,i)=>(e.selectedIndex=t,e.selectCount+=1,{index:t,text:i})}),syncOnChange:(e,t)=>{t.open&&"function"==typeof e.open&&e.open(),t.open||"function"!=typeof e.close||e.close()}},ie={name:"Dialog",signalPrefix:"dialog",pixiClass:a.Dialog,fields:{open:{kind:"scalar",default:!1,inspector:{name:"open",type:"boolean"}},title:{kind:"scalar",inspector:{name:"title",type:"string"}},width:{kind:"scalar",inspector:{name:"width",type:"number"}},height:{kind:"scalar",inspector:{name:"height",type:"number"}},padding:{kind:"scalar",inspector:{name:"padding",type:"number"}},backdropColor:{kind:"scalar",default:0,inspector:{name:"backdropColor",type:"color"}},backdropAlpha:{kind:"scalar",default:.5,inspector:{name:"backdropAlpha",type:"number",step:.05}},backdropView:{kind:"opaque"},backgroundView:{kind:"opaque"},closeOnBackdropClick:{kind:"scalar",default:!0,inspector:{name:"closeOnBackdropClick",type:"boolean"}},contentChildName:{kind:"scalar",default:"content",inspector:{name:"contentChildName",type:"string"}},nineSliceSprite:{kind:"opaque"},titleStyle:{kind:"shallowMerge",default:{}},content:{kind:"scalar"},contentStyle:{kind:"shallowMerge",default:{}},contentButtons:{kind:"arrayCopy",default:[]},contentCheckBoxes:{kind:"arrayCopy",default:[]},buttons:{kind:"arrayCopy",default:[]},buttonList:{kind:"shallowMerge",default:{}},buttonListOffset:{kind:"shallowMerge",default:{}},scrollBox:{kind:"shallowMerge",default:{}},animations:{kind:"opaque"},bindToStore:T},optionsBuilder:e=>{var t;const i=e.nineSliceSprite&&e.backgroundView&&"texture"in e.backgroundView?e.backgroundView.texture:null!==(t=e.__resolved_background_view)&&void 0!==t?t:new n.Container;return{backdrop:e.__resolved_backdropView,backdropColor:R(e.backdropColor),backdropAlpha:e.backdropAlpha,background:i,title:le(e.title,e.titleStyle),content:re(e),buttons:se(e.buttons),buttonList:e.buttonList,scrollBox:e.scrollBox,width:e.width,height:e.height,padding:e.padding,closeOnBackdropClick:e.closeOnBackdropClick,nineSliceSprite:e.nineSliceSprite,animations:e.animations}},postCreate:(e,t)=>{ae(e,t),t.open&&"function"==typeof e.open&&e.open()},applySize:function(e,t,i){var n,a,o,l,r,s,d,c,u,h,p,f,v,g,m,y,b,k,x,w,S;const C=ne(null!==(a=null!==(n=t.width)&&void 0!==n?n:i.width)&&void 0!==a?a:null===(o=null==e?void 0:e.options)||void 0===o?void 0:o.width),_=ne(null!==(r=null!==(l=t.height)&&void 0!==l?l:i.height)&&void 0!==r?r:null===(s=null==e?void 0:e.options)||void 0===s?void 0:s.height);if(void 0===C&&void 0===_)return;e.options=null!==(d=e.options)&&void 0!==d?d:{},void 0!==C&&(e.options.width=C);void 0!==_&&(e.options.height=_);const O=null!=C?C:Number(e.options.width)||Number(null===(c=e.innerView)||void 0===c?void 0:c.width)||0,M=null!=_?_:Number(e.options.height)||Number(null===(u=e.innerView)||void 0===u?void 0:u.height)||0,B=Number(null!==(p=null!==(h=i.padding)&&void 0!==h?h:e.options.padding)&&void 0!==p?p:20)||20;if(e.innerView)if(void 0!==C&&(e.innerView.width=C),void 0!==_&&(e.innerView.height=_),"anchor"in e.innerView&&(null===(f=e.innerView.anchor)||void 0===f?void 0:f.set))e.innerView.anchor.set(.5,.5);else try{null===(g=null===(v=e.innerView.pivot)||void 0===v?void 0:v.set)||void 0===g||g.call(v,O/2,M/2)}catch(e){}e.titleText&&(e.titleText.x=O/2,e.titleText.y=B);const P=Number(null===(m=e.titleText)||void 0===m?void 0:m.height)||0,j=Number(null===(y=e.buttonContainer)||void 0===y?void 0:y.height)||0;e.buttonContainer&&(e.buttonContainer.x=O/2-(Number(e.buttonContainer.width)||0)/2,e.buttonContainer.y=M-B-j);if(e.scrollBox){e.scrollBox.x=B,e.scrollBox.y=B+P;const t=null===(b=i.scrollBox)||void 0===b?void 0:b.size,n=null!==(k=ne(null==t?void 0:t.width))&&void 0!==k?k:Math.max(0,O-2*B),a=null!==(x=ne(null==t?void 0:t.height))&&void 0!==x?x:Math.max(0,M-2*B-P-j);"function"==typeof e.scrollBox.setSize?e.scrollBox.setSize(n,a):(e.scrollBox.width=n,e.scrollBox.height=a);try{null===(S=(w=e.scrollBox).resize)||void 0===S||S.call(w,!0)}catch(e){}}ae(e,Object.assign(Object.assign({},i),{width:O,height:M}))},onAttachedExtra:(e,t,i)=>{!function(e,t,i){const n=t.__dialogContentButtons;if(!Array.isArray(n)||0===n.length||e.__evaDialogContentButtonPressesWired)return;e.__evaDialogContentButtonPressesWired=!0,e.__evaDialogContentButtonPressCleanups=n.map(n=>{var a;const o=null===(a=n.button)||void 0===a?void 0:a.onPress;if(!o||"function"!=typeof o.connect)return;const l=o.connect(()=>{var a,o,l,r;const s=null!==(o=null!==(a=n.params.value)&&void 0!==a?a:n.params.text)&&void 0!==o?o:n.index;t.selectedContentIndex=n.index,t.selectedContentValue=s,t.selectCount=(null!==(l=t.selectCount)&&void 0!==l?l:0)+1,t.lastSignal="select",function(e,t){var i,n,a;const o=Object.assign({entityName:null==e?void 0:e.name},t);try{null===(i=null==e?void 0:e.emit)||void 0===i||i.call(e,"select",o)}catch(e){}try{null===(n=null==e?void 0:e.emit)||void 0===n||n.call(e,"dialog:select",o)}catch(e){}const l="undefined"!=typeof globalThis?globalThis.mx:void 0;if(null===(a=null==l?void 0:l.event)||void 0===a?void 0:a.emit)try{l.event.emit("dialog:select",o)}catch(e){}}(i,{index:n.index,text:String(null!==(r=n.params.text)&&void 0!==r?r:""),value:s}),n.params.closeOnPress&&"function"==typeof e.close&&e.close();const d=Number(n.params.reopenDelay);Number.isFinite(d)&&d>=0&&"function"==typeof e.open&&setTimeout(()=>{try{e.open()}catch(e){}},d)});return()=>{try{l.disconnect()}catch(e){}}}).filter(Boolean)}(e,t,i)},signalMap:e=>({close:()=>(e.open=!1,{}),select:(e,t)=>({index:e,text:t})}),syncOnChange:(e,t)=>{ae(e,t),t.open&&!e.isOpen&&"function"==typeof e.open?e.open():!t.open&&e.isOpen&&"function"==typeof e.close&&e.close()}};function ne(e){const t=Number(e);return Number.isFinite(t)&&t>0?t:void 0}function ae(e,t){var i,n;const a=null==e?void 0:e.innerView,o=null==e?void 0:e.contentView;(null==a?void 0:a.anchor)&&o&&t.width&&t.height&&(o.x=-t.width/2,o.y=-t.height/2),oe(e,"buttonListOffset",e.buttonContainer,t.buttonListOffset),oe(e,"scrollBoxOffset",e.scrollBox,null===(i=t.scrollBox)||void 0===i?void 0:i.offset),function(e,t){var i,n,a;const o=null==e?void 0:e.scrollBox;if(!o)return;const l=null!==(i=e.__evaDialogBaseScrollBoxSize)&&void 0!==i?i:{width:o.width,height:o.height};e.__evaDialogBaseScrollBoxSize=l;const r=e.__evaDialogAppliedScrollBoxSize;if(!t&&!r)return;const s=null!==(n=null==t?void 0:t.width)&&void 0!==n?n:l.width,d=null!==(a=null==t?void 0:t.height)&&void 0!==a?a:l.height;"function"==typeof o.setSize?o.setSize(s,d):(o.width=s,o.height=d);"function"==typeof o.resize&&o.resize(!0);e.__evaDialogAppliedScrollBoxSize=!!t}(e,null===(n=t.scrollBox)||void 0===n?void 0:n.size)}function oe(e,t,i,n){var a,o,l,r;if(!i)return;const s=null!==(a=e.__evaDialogAppliedOffsets)&&void 0!==a?a:{},d=null!==(o=s[t])&&void 0!==o?o:{x:0,y:0},c={x:null!==(l=null==n?void 0:n.x)&&void 0!==l?l:0,y:null!==(r=null==n?void 0:n.y)&&void 0!==r?r:0};i.x+=c.x-d.x,i.y+=c.y-d.y,e.__evaDialogAppliedOffsets=Object.assign(Object.assign({},s),{[t]:c})}function le(e,t){if(void 0!==e)return t&&Object.keys(t).length>0?new n.Text({text:e,style:t}):e}function re(e){var t,i;if(null===(t=e.contentButtons)||void 0===t?void 0:t.length){const t=[],i=e.contentButtons.map((e,i)=>{const n=new a.FancyButton(de(e));return $(n,e),void 0!==e.disabled&&(n.enabled=!e.disabled),t.push({button:n,params:e,index:i}),n});return e.__dialogContentButtons=t,i}return(null===(i=e.contentCheckBoxes)||void 0===i?void 0:i.length)?e.contentCheckBoxes.map(e=>new a.CheckBox(function(e){var t,i,a,o,l,r;const s=null!==(t=e.size)&&void 0!==t?t:30,d=null!==(i=e.radius)&&void 0!==i?i:5,c=null!==(a=e.strokeColor)&&void 0!==a?a:he,u=null!==(o=e.strokeWidth)&&void 0!==o?o:2;return{style:{unchecked:(new n.Graphics).roundRect(0,0,s,s,d).fill(null!==(l=e.uncheckedColor)&&void 0!==l?l:"#3e3f40").stroke({color:c,width:u}),checked:(new n.Graphics).roundRect(0,0,s,s,d).fill(null!==(r=e.checkedColor)&&void 0!==r?r:ue).stroke({color:c,width:u}),text:e.textStyle},text:e.text,checked:e.checked}}(e))):le(e.content,e.contentStyle)}function se(e){if(null==e?void 0:e.length)return e.map(e=>{const t=de(e),i=void 0!==e.disabled||!(!e.nineSliceSprite||void 0===e.width&&void 0===e.height);if("button"===e.kind||!i)return t;const n=new a.FancyButton(t);return $(n,e),n.enabled=!e.disabled,n})}function de(e){var t,i,n,o,l,r,s,d,c,u;if("button"===e.kind)return function(e){var t,i,n,o,l,r;const s=null!==(t=e.width)&&void 0!==t?t:110,d=null!==(i=e.height)&&void 0!==i?i:48,c=null!==(n=e.radius)&&void 0!==n?n:12,u=pe(s,d,c,null!==(o=e.color)&&void 0!==o?o:ue),h=le(e.text,e.textStyle);if(h){h.x=s/2,h.y=d/2;try{null===(r=null===(l=h.anchor)||void 0===l?void 0:l.set)||void 0===r||r.call(l,.5)}catch(e){}u.addChild(h)}const p=new a.Button(u);void 0!==e.disabled&&(p.enabled=!e.disabled);return p}(e);const h=null!==(t=e.width)&&void 0!==t?t:110,p=null!==(i=e.height)&&void 0!==i?i:48,f=null!==(n=e.radius)&&void 0!==n?n:12,v=null!==(o=e.color)&&void 0!==o?o:ue;return{text:le(e.text,e.textStyle),defaultView:null!==(l=ce(e.defaultView))&&void 0!==l?l:pe(h,p,f,v),hoverView:null!==(r=ce(e.hoverView))&&void 0!==r?r:pe(h,p,f,null!==(s=e.hoverColor)&&void 0!==s?s:v),pressedView:null!==(d=ce(e.pressedView))&&void 0!==d?d:pe(h,p,f,null!==(c=e.pressedColor)&&void 0!==c?c:v),disabledView:null!==(u=ce(e.disabledView))&&void 0!==u?u:e.disabledColor?pe(h,p,f,e.disabledColor):void 0,nineSliceSprite:e.nineSliceSprite,enabled:void 0===e.disabled?void 0:!e.disabled,animations:e.animations}}function ce(e){return e?H(e):void 0}const ue="#e91e63",he="#ffffff";function pe(e,t,i,a){return(new n.Graphics).roundRect(0,0,e,t,i).fill(a)}const fe={name:"MaskedFrame",signalPrefix:"maskedframe",pixiClass:a.MaskedFrame,fields:{targetView:{kind:"opaque"},maskView:{kind:"opaque"},borderView:{kind:"opaque"},borderWidth:{kind:"scalar",default:0,inspector:{name:"borderWidth",type:"number"}},borderColor:{kind:"scalar",default:0,inspector:{name:"borderColor",type:"color"}}},optionsBuilder:e=>({target:e.__resolved_target_view,mask:e.__resolved_mask_view,borderWidth:e.borderWidth,borderColor:e.borderColor})},ve=x(A),ge=x(E),me=x(D),ye=x(G),be=x(L),ke=x(W),xe=x(U),we=x(Z),Se=x(K),Ce=x(Q),_e=x(ee),Oe=x(te),Me=x(ie),Be=x(fe),Pe={Button:A,FancyButton:E,CheckBox:D,Switcher:G,Slider:L,DoubleSlider:W,ProgressBar:U,CircularProgressBar:Z,Input:K,List:Q,ScrollBox:ee,Select:te,Dialog:ie,MaskedFrame:fe};class je extends t.Component{constructor(){super(...arguments),this.componentName="RadioGroup",this.selectedId=void 0,this.direction="vertical",this.elementsMargin=4,this.boundCheckBoxes=[]}static getInspectorMetadata(){return{name:je.componentName,type:"object",isArray:!1,isFolder:!0,children:[{name:"selectedId",type:"string",isArray:!1},{name:"direction",type:"string",isArray:!1},{name:"elementsMargin",type:"number",isArray:!1},{name:"childNames",type:"string",isArray:!0}]}}init(e){e&&this.applyParams(e)}applyDeclarativeProps(e,t){this.applyParams(e)}applySelection(){for(const{name:e,cb:t}of this.boundCheckBoxes){const i=e===this.selectedId;t.checked!==i&&(t.checked=i)}}applyParams(e){"string"==typeof e.selectedId&&(this.selectedId=e.selectedId),Array.isArray(e.childNames)&&(this.childNames=e.childNames.slice()),e.direction&&(this.direction=e.direction),"number"==typeof e.elementsMargin&&(this.elementsMargin=e.elementsMargin)}}function Te(e,t,i){const n=[],{go:a,prefix:o,emitToMx:l=!0}=t;for(const[t,r]of Object.entries(i)){const i=Ve(e,t);if(!i)continue;const s=i.connect((...e)=>{var i,n,s,d,c;const u=!0===r?e[0]:Re(r,e),h="object"==typeof u&&null!==u?Object.assign({entityName:a.name},u):{entityName:a.name,value:u};try{null===(n=(i=a).emit)||void 0===n||n.call(i,t,h)}catch(e){}try{null===(d=(s=a).emit)||void 0===d||d.call(s,`${o}:${t}`,h)}catch(e){}if(l){const e="undefined"!=typeof globalThis?globalThis.mx:void 0;if(null===(c=null==e?void 0:e.event)||void 0===c?void 0:c.emit)try{e.event.emit(`${o}:${t}`,h)}catch(e){}}});n.push(()=>{try{s.disconnect()}catch(e){}})}return n}function Ve(e,t){const i=[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`,`on${t.charAt(0).toUpperCase()}${t.slice(1)}Change`];for(const t of i){const i=null==e?void 0:e[t];if(i&&"function"==typeof i.connect)return i}return null}function Re(e,t){var i;try{return null!==(i=e(...t))&&void 0!==i?i:{}}catch(e){return{}}}je.componentName="RadioGroup","function"==typeof SuppressedError&&SuppressedError;let Ae=class extends t.System{constructor(){super(...arguments),this.name="UISystem",this.instances=new Map,this.signalCleanups=new Map,this.transformSizeAuthorities=new Set,this.radioGroupInstances=new Map}get checkBoxInstances(){let e=this.instances.get("CheckBox");return e||(e=new Map,this.instances.set("CheckBox",e)),e}update(e){var t,i,n;const a=null!==(n=null===(i=null===(t=this.componentObserver)||void 0===t?void 0:t.clear)||void 0===i?void 0:i.call(t))&&void 0!==n?n:[];for(const e of a)this.componentChanged(e)}componentChanged(e){const t=e.componentName;if("Transform"===t)return this.handleTransformSizeChanged(e);if(function(e){return"Shape"===e||"UI"===e||"UIComponent"===e}(t))return this.handleShape(e);if("RadioGroup"===t)return this.handleRadioGroup(e);const i=Pe[t];return i?this.handleGeneric(i,e):void 0}handleShape(e){if(e.type===t.OBSERVER_TYPE.ADD||e.type===t.OBSERVER_TYPE.CHANGE){const t=e.component;"function"==typeof t.redraw&&t.redraw()}}handleGeneric(e,i){var n;const a=i.component,o=a.gameObject;if(!o)return;const l=this.getInstanceMap(e.name);if(i.type===t.OBSERVER_TYPE.ADD)c(this.gameRef(o),o,()=>this.attachGeneric(e,a,o,l));else if(i.type===t.OBSERVER_TYPE.CHANGE){const t=l.get(o.id);if(!t)return void c(this.gameRef(o),o,()=>this.attachGeneric(e,a,o,l));null===(n=e.syncOnChange)||void 0===n||n.call(e,t,a),this.transformSizeAuthorities.has(o.id)&&_(e,t,a,o,"component-change")}else i.type===t.OBSERVER_TYPE.REMOVE&&this.detachGeneric(o.id,l,o)}attachGeneric(e,t,i,n){var a,o,l,d,c,p,f,v,g;if(n.has(i.id))return;const m=this.gameRef(i),y=function(e,t,i,n){var a,o;if(!n)return{};switch(n.kind){case"single":{const a=i[n.key],o=u(e,t,a);return n.required&&!o?null:{single:o}}case"object":{const o=null!==(a=i[n.folder])&&void 0!==a?a:{},l={};for(const{name:i,required:a}of n.keys){const n=u(e,t,o[i]);if(a&&!n)return null;l[i]=n}return{object:l}}case"array":{const a=(null!==(o=i[n.key])&&void 0!==o?o:[]).map(i=>u(e,t,i)).filter(Boolean);return a.length<n.minLength?null:{array:a}}}}(m,i,t,e.views);if(e.views&&null===y)return;if(function(e,t,i,n){switch(e){case"ProgressBar":{const e=t.nineSliceSprite?t.fillView:h(t.fillView,t.fillPaddings,{width:t.width,height:t.height});t.__resolved_bg=u(i,n,t.bgView),t.__resolved_fill=u(i,n,e),t.__resolved_bg_view=t.nineSliceSprite&&t.bgView&&"texture"in t.bgView?t.bgView.texture:t.__resolved_bg,t.__resolved_fill_view=t.nineSliceSprite&&t.fillView&&"texture"in t.fillView?t.fillView.texture:t.__resolved_fill;break}case"Select":t.__resolved_closedView=u(i,n,t.closedView),t.__resolved_openView=u(i,n,t.openView);break;case"Dialog":t.__resolved_backdropView=u(i,n,t.backdropView),t.__resolved_backgroundView=u(i,n,t.backgroundView),t.__resolved_background_view=t.nineSliceSprite&&t.backgroundView&&"texture"in t.backgroundView?t.backgroundView.texture:t.__resolved_backgroundView;break;case"MaskedFrame":t.__resolved_targetView=u(i,n,t.targetView),t.__resolved_maskView=u(i,n,t.maskView),t.__resolved_target_view=t.targetView&&"texture"in t.targetView?t.targetView.texture:t.__resolved_targetView,t.__resolved_mask_view=t.maskView&&"texture"in t.maskView?t.maskView.texture:t.__resolved_maskView}}(e.name,t,m,i),!function(e,t){switch(e){case"ProgressBar":return!(!t.__resolved_bg_view||!t.__resolved_fill_view);case"Select":return!(!t.__resolved_closedView||!t.__resolved_openView);case"Dialog":default:return!0;case"MaskedFrame":return!(!t.__resolved_target_view||!t.__resolved_mask_view)}}(e.name,t))return;if("List"===e.name||"ScrollBox"===e.name){const l="List"===e.name?t.itemsChildName:t.contentChildName;t.__resolved_items=function(e,t,i){var n,a,o;const l=[],s=Fe(t,i);if(!s)return l;const d=(null===(n=s.transform)||void 0===n?void 0:n.children)||[];for(const t of d){const i=null==t?void 0:t.gameObject;if(!i)continue;const n=r(e,i);if(n){if(n.width<=0||n.height<=0)continue;try{null===(o=null===(a=n.parent)||void 0===a?void 0:a.removeChild)||void 0===o||o.call(a,n)}catch(e){}l.push(Ie(n,i))}}return l}(m,i,l);const s=function(e,t){var i,n,a;const o=Fe(e,t);return null!==(a=null===(n=null===(i=null==o?void 0:o.transform)||void 0===i?void 0:i.children)||void 0===n?void 0:n.length)&&void 0!==a?a:0}(i,l);if(s>0&&t.__resolved_items.length<s&&(null!==(a=t.__collect_retry)&&void 0!==a?a:0)<10)return t.__collect_retry=(null!==(o=t.__collect_retry)&&void 0!==o?o:0)+1,void requestAnimationFrame(()=>this.attachGeneric(e,t,i,n))}const b=this.applyTransientTransformSize(t,i),k=e.optionsBuilder(t,null!=y?y:{}),x=e.positional?new e.pixiClass(...k):new e.pixiClass(k);if(null===(l=e.postCreate)||void 0===l||l.call(e,x,t),this.transformSizeAuthorities.has(i.id)||!C(t)){_(e,x,t,i,"initial-transform")&&this.transformSizeAuthorities.add(i.id)}if(n.set(i.id,x),s(m,i,x),"Dialog"===e.name){const e=Fe(i,null!==(d=t.contentChildName)&&void 0!==d?d:"content");if(e){const t=r(m,e);if(t)try{null===(p=(c=x).addChild)||void 0===p||p.call(c,t)}catch(e){}}}if("MaskedFrame"===e.name&&t.borderView){const e=u(m,i,t.borderView);if(e)try{null===(v=(f=x).addChild)||void 0===v||v.call(f,e)}catch(e){}}if(e.signalMap){const n=Te(x,{go:i,prefix:e.signalPrefix},e.signalMap(t));this.signalCleanups.set(i.id,n)}null===(g=e.onAttachedExtra)||void 0===g||g.call(e,x,t,i,m),b()}detachGeneric(e,t,i){const n=t.get(e);d(this.gameRef(i),i,n),t.delete(e);const a=this.signalCleanups.get(e);a&&(a.forEach(e=>e()),this.signalCleanups.delete(e))}handleRadioGroup(e){const i=e.component,n=i.gameObject;if(n)if(e.type===t.OBSERVER_TYPE.ADD)c(this.gameRef(n),n,()=>queueMicrotask(()=>this.attachRadioGroup(i)));else if(e.type===t.OBSERVER_TYPE.CHANGE)i.applySelection();else if(e.type===t.OBSERVER_TYPE.REMOVE){const e=this.radioGroupInstances.get(n.id);d(this.gameRef(n),n,e),this.radioGroupInstances.delete(n.id);const t=this.signalCleanups.get(n.id);t&&(t.forEach(e=>e()),this.signalCleanups.delete(n.id))}}attachRadioGroup(e){var t,i,n,o,l;const r=e.gameObject,d=this.gameRef(r);if(!r||this.radioGroupInstances.has(r.id))return;e.boundCheckBoxes=[];const c=[],u=[],h=(null===(t=r.transform)||void 0===t?void 0:t.children)||[];for(const t of h){const a=null==t?void 0:t.gameObject;if(!a)continue;if(e.childNames&&!e.childNames.includes(a.name))continue;const l=null===(i=a.getComponent)||void 0===i?void 0:i.call(a,"CheckBox");if(!l)continue;const r=this.checkBoxInstances.get(a.id);if(r){try{null===(o=null===(n=r.parent)||void 0===n?void 0:n.removeChild)||void 0===o||o.call(n,r)}catch(e){}c.push(r),u.push(a.name),e.boundCheckBoxes.push({name:a.name,cb:l})}}if(0===c.length)return;const p=e.selectedId?Math.max(0,u.indexOf(e.selectedId)):0,f=new a.RadioGroup({items:c,type:null!==(l={horizontal:"horizontal",vertical:"vertical",bidirectional:"bidirectional"}[e.direction])&&void 0!==l?l:"vertical",elementsMargin:e.elementsMargin,selectedItem:p});if(this.transformSizeAuthorities.has(r.id)){const e=S(r,{allowZero:!0});e&&O(f,e)}this.radioGroupInstances.set(r.id,f),s(d,r,f);const v=Te(f,{go:r,prefix:"radiogroup"},{change:(t,i)=>{var n;const a=null!==(n=u[t])&&void 0!==n?n:i;return e.selectedId=a,{selectedId:e.selectedId,index:t}}});this.signalCleanups.set(r.id,v)}getInstanceMap(e){let t=this.instances.get(e);return t||(t=new Map,this.instances.set(e,t)),t}gameRef(e){var t,i,n;const a=this.game;return a||(e&&null!==(n=null!==(t=e.game)&&void 0!==t?t:null===(i=e.scene)||void 0===i?void 0:i.game)&&void 0!==n?n:null)}handleTransformSizeChanged(e){var i,n;if(e.type!==t.OBSERVER_TYPE.CHANGE)return;const a=e.component,o=null!==(i=e.gameObject)&&void 0!==i?i:null==a?void 0:a.gameObject;if(!o)return;let l=!1;for(const[e,t]of Object.entries(Pe)){const i=null===(n=this.instances.get(e))||void 0===n?void 0:n.get(o.id);if(!i)continue;_(t,i,qe(o,e),o,"transform-change")&&(l=!0)}const r=this.radioGroupInstances.get(o.id);if(r){const e=S(o,{allowZero:!0});e&&(O(r,e),l=!0)}l&&this.transformSizeAuthorities.add(o.id),this.relayoutLayoutInstances()}relayoutLayoutInstances(){for(const e of["List","ScrollBox"]){const t=this.instances.get(e);if(t)for(const e of t.values())M(e)}}applyTransientTransformSize(e,t){if(C(e))return()=>{};const i=S(t);if(!i)return()=>{};const n=Object.prototype.hasOwnProperty.call(e,"width"),a=Object.prototype.hasOwnProperty.call(e,"height"),o=e.width,l=e.height;return void 0!==i.width&&(e.width=i.width),void 0!==i.height&&(e.height=i.height),()=>{n?e.width=o:delete e.width,a?e.height=l:delete e.height}}};Ae.systemName="UISystem",Ae=function(e,t,i,n){var a,o=arguments.length,l=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,n);else for(var r=e.length-1;r>=0;r--)(a=e[r])&&(l=(o<3?a(l):o>3?a(t,i,l):a(t,i))||l);return o>3&&l&&Object.defineProperty(t,i,l),l}([t.decorators.componentObserver(function(){const e={Transform:[{prop:["size"],deep:!0}],Shape:[{prop:["shapes"],deep:!0}],UI:[{prop:["shapes"],deep:!0}],UIComponent:[{prop:["shapes"],deep:!0}],RadioGroup:[{prop:["selectedId"],deep:!1},{prop:["direction"],deep:!1},{prop:["elementsMargin"],deep:!1}]};for(const[t,i]of Object.entries(Pe)){const n=[];for(const[e,t]of Object.entries(i.fields)){const i="shallowMerge"===t.kind||"tuple"===t.kind||"arrayCopy"===t.kind;n.push({prop:[e],deep:i})}e[t]=n}return e}())],Ae);var Ee=Ae;function Ie(e,t){const i=new n.Container,a=null==t?void 0:t.name;return i.label=a?`${a}:layout-item`:"plugin-ui-layout-item",i.addChild(e),Object.defineProperty(i,"width",{get:()=>Ne(t,e,"width"),set:()=>{},configurable:!0}),Object.defineProperty(i,"height",{get:()=>Ne(t,e,"height"),set:()=>{},configurable:!0}),i}function Ne(e,t,i){var n,a;const o=Number(null===(a=null===(n=null==e?void 0:e.transform)||void 0===n?void 0:n.size)||void 0===a?void 0:a[i]);if(Number.isFinite(o)&&o>0)return o;const l=Number(null==t?void 0:t[i]);return Number.isFinite(l)?l:0}function Fe(e,t){var i,n;if(!e)return null;if("function"==typeof e.findChildByName)try{const i=e.findChildByName(t);if(i)return i}catch(e){}const a=(null===(i=e.transform)||void 0===i?void 0:i.children)||[];for(const e of a)if((null===(n=null==e?void 0:e.gameObject)||void 0===n?void 0:n.name)===t)return e.gameObject;return null}function qe(e,t){var i;try{return null===(i=null==e?void 0:e.getComponent)||void 0===i?void 0:i.call(e,t)}catch(e){return}}exports.Button=ve,exports.COMPONENT_DEFINITIONS=Pe,exports.CheckBox=me,exports.CircularProgressBar=we,exports.Dialog=Me,exports.DoubleSlider=ke,exports.FancyButton=ge,exports.Input=Se,exports.List=Ce,exports.MaskedFrame=Be,exports.PixiUiComponent=k,exports.PluginUiSystem=Ee,exports.ProgressBar=xe,exports.RadioGroup=je,exports.ScrollBox=_e,exports.Select=Oe,exports.Shape=l,exports.Slider=be,exports.Switcher=ye,exports.UI=l,exports.UIShapeType=o,exports.UISystem=Ee,exports.defineUiComponent=x;
|