uil 4.0.2 → 4.0.3
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 +5 -1
- package/build/uil.js +29 -42
- package/build/uil.min.js +1 -1
- package/build/uil.module.js +41 -56
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<p align="center"><a href="http://lo-th.github.io/uil/"><img src="http://lo-th.github.io/uil/examples/assets/uil.jpg"/></a><br>UIL v4.0</p>
|
|
1
|
+
<p align="center"><a href="http://lo-th.github.io/uil/"><img src="http://lo-th.github.io/uil/examples/assets/uil.jpg"/></a><br>UIL v4.0.2</p>
|
|
2
2
|
|
|
3
3
|
uil.js is a lightweight ui for javascript with a complete 3d display support.<br>
|
|
4
4
|
totally customizable, only 6 events, auto resize<br>
|
|
@@ -55,3 +55,7 @@ ui.clear();
|
|
|
55
55
|
[**uil to three**](http://lo-th.github.io/uil/examples/uil_3d.html)
|
|
56
56
|
|
|
57
57
|
[**uil to three 2**](http://lo-th.github.io/uil/examples/uil_3d_2.html)
|
|
58
|
+
|
|
59
|
+
**7 - uil is on npm**
|
|
60
|
+
```sh
|
|
61
|
+
npm i uil
|
package/build/uil.js
CHANGED
|
@@ -1961,26 +1961,25 @@
|
|
|
1961
1961
|
// ----------------------
|
|
1962
1962
|
|
|
1963
1963
|
|
|
1964
|
-
|
|
1964
|
+
dispose() {
|
|
1965
1965
|
if (this.isListen) Roots.removeListen(this);
|
|
1966
1966
|
Tools.clear(this.c[0]);
|
|
1967
1967
|
|
|
1968
|
-
if (
|
|
1969
|
-
if (this.
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
if (this.isUI) this.main.clearOne(this);else document.body.removeChild(this.c[0]);
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
if (!this.isUI) Roots.remove(this);
|
|
1968
|
+
if (this.target !== null) {
|
|
1969
|
+
if (this.group !== null) this.group.clearOne(this);else this.target.removeChild(this.c[0]);
|
|
1970
|
+
} else {
|
|
1971
|
+
if (this.isUI) this.main.clearOne(this);else document.body.removeChild(this.c[0]);
|
|
1976
1972
|
}
|
|
1977
1973
|
|
|
1974
|
+
if (!this.isUI) Roots.remove(this);
|
|
1978
1975
|
this.c = null;
|
|
1979
1976
|
this.s = null;
|
|
1980
1977
|
this.callback = null;
|
|
1981
1978
|
this.target = null;
|
|
1982
1979
|
this.isListen = false;
|
|
1983
|
-
}
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
clear() {} // ----------------------
|
|
1984
1983
|
// change size
|
|
1985
1984
|
// ----------------------
|
|
1986
1985
|
|
|
@@ -2112,7 +2111,7 @@
|
|
|
2112
2111
|
|
|
2113
2112
|
display(v) {
|
|
2114
2113
|
v = v || false;
|
|
2115
|
-
this.s[0].display = v ? this.useFlex
|
|
2114
|
+
this.s[0].visibility = v ? 'visible' : 'hidden'; //this.s[0].display = v ? (this.useFlex? 'flex':'block') : 'none'
|
|
2116
2115
|
} // ----------------------
|
|
2117
2116
|
// resize height
|
|
2118
2117
|
// ----------------------
|
|
@@ -2313,7 +2312,7 @@
|
|
|
2313
2312
|
this.value = o.value || '';
|
|
2314
2313
|
this.values = o.value || this.txt;
|
|
2315
2314
|
if (o.values) this.values = o.values;
|
|
2316
|
-
this.onName = o.onName ||
|
|
2315
|
+
this.onName = o.onName || null;
|
|
2317
2316
|
this.on = false;
|
|
2318
2317
|
this.customSize = o.forceWidth || -1;
|
|
2319
2318
|
if (typeof this.values === 'string') this.values = [this.values];
|
|
@@ -2352,15 +2351,15 @@
|
|
|
2352
2351
|
if (this.isDragButton) {
|
|
2353
2352
|
this.lng++;
|
|
2354
2353
|
this.initDrager();
|
|
2355
|
-
}
|
|
2354
|
+
} //if( this.onName !== '' ) this.values[0] = this.on;
|
|
2355
|
+
|
|
2356
2356
|
|
|
2357
|
-
if (this.onName !== '') this.values[0] = this.on;
|
|
2358
2357
|
this.init();
|
|
2359
2358
|
}
|
|
2360
2359
|
|
|
2361
2360
|
onOff() {
|
|
2362
2361
|
this.on = !this.on;
|
|
2363
|
-
this.
|
|
2362
|
+
this.label(this.on ? this.onName : this.txt);
|
|
2364
2363
|
}
|
|
2365
2364
|
|
|
2366
2365
|
testZone(e) {
|
|
@@ -2385,6 +2384,7 @@
|
|
|
2385
2384
|
|
|
2386
2385
|
if (this.res !== -1) {
|
|
2387
2386
|
if (this.value === this.values[this.res] && this.unselectable) this.value = '';else this.value = this.values[this.res];
|
|
2387
|
+
if (this.onName !== null) this.onOff();
|
|
2388
2388
|
if (!this.isLoadButton) this.send();
|
|
2389
2389
|
}
|
|
2390
2390
|
|
|
@@ -3787,10 +3787,20 @@
|
|
|
3787
3787
|
|
|
3788
3788
|
|
|
3789
3789
|
remove(n) {
|
|
3790
|
-
if (n.
|
|
3790
|
+
if (n.dispose) n.dispose();
|
|
3791
3791
|
} // clear all iner
|
|
3792
3792
|
|
|
3793
3793
|
|
|
3794
|
+
dispose() {
|
|
3795
|
+
this.clear();
|
|
3796
|
+
if (this.isUI) this.main.calc();
|
|
3797
|
+
super.dispose(); //Proto.prototype.clear.call( this );
|
|
3798
|
+
}
|
|
3799
|
+
|
|
3800
|
+
clear() {
|
|
3801
|
+
this.empty();
|
|
3802
|
+
}
|
|
3803
|
+
|
|
3794
3804
|
empty() {
|
|
3795
3805
|
this.close();
|
|
3796
3806
|
let i = this.uis.length,
|
|
@@ -3839,23 +3849,6 @@
|
|
|
3839
3849
|
this.parentHeight();
|
|
3840
3850
|
}
|
|
3841
3851
|
|
|
3842
|
-
clear() {
|
|
3843
|
-
this.empty();
|
|
3844
|
-
if (this.isUI) this.main.calc(-(this.h + 1));
|
|
3845
|
-
Proto.prototype.clear.call(this);
|
|
3846
|
-
}
|
|
3847
|
-
|
|
3848
|
-
clearGroup() {
|
|
3849
|
-
this.empty();
|
|
3850
|
-
/*this.close();
|
|
3851
|
-
let i = this.uis.length;
|
|
3852
|
-
while(i--){
|
|
3853
|
-
this.uis[i].clear();
|
|
3854
|
-
}
|
|
3855
|
-
this.uis = [];
|
|
3856
|
-
this.h = this.baseH;*/
|
|
3857
|
-
}
|
|
3858
|
-
|
|
3859
3852
|
calcUis() {
|
|
3860
3853
|
if (!this.isOpen) this.h = this.baseH;else this.h = Roots.calcUis(this.uis, this.zone, this.zone.y + this.baseH) + this.baseH;
|
|
3861
3854
|
this.s[0].height = this.h + 'px'; //console.log('G', this.h)
|
|
@@ -6906,7 +6899,7 @@
|
|
|
6906
6899
|
while (i--) {
|
|
6907
6900
|
item = this.uis.pop();
|
|
6908
6901
|
this.inner.removeChild(item.c[0]);
|
|
6909
|
-
item.
|
|
6902
|
+
item.dispose(); //this.uis[i].clear()
|
|
6910
6903
|
}
|
|
6911
6904
|
|
|
6912
6905
|
this.uis = [];
|
|
@@ -6918,13 +6911,7 @@
|
|
|
6918
6911
|
}
|
|
6919
6912
|
|
|
6920
6913
|
clear() {
|
|
6921
|
-
this.empty();
|
|
6922
|
-
|
|
6923
|
-
/*let i = this.uis.length;
|
|
6924
|
-
while( i-- ) this.uis[i].clear();
|
|
6925
|
-
this.uis = [];
|
|
6926
|
-
Roots.listens = [];
|
|
6927
|
-
this.calc( -this.h );*/
|
|
6914
|
+
this.empty();
|
|
6928
6915
|
}
|
|
6929
6916
|
|
|
6930
6917
|
dispose() {
|
|
@@ -7063,7 +7050,7 @@
|
|
|
7063
7050
|
|
|
7064
7051
|
}
|
|
7065
7052
|
|
|
7066
|
-
const REVISION = '4.0.
|
|
7053
|
+
const REVISION = '4.0.3';
|
|
7067
7054
|
|
|
7068
7055
|
exports.Gui = Gui;
|
|
7069
7056
|
exports.Proto = Proto;
|
package/build/uil.min.js
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Copyright 2010-2021 Uil.js Authors
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
|
-
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports):"function"==typeof define&&define.amd?define(["exports"],s):s((t="undefined"!=typeof globalThis?globalThis:t||self).UIL={})}(this,(function(t){"use strict";const s={ui:[],dom:null,ID:null,lock:!1,wlock:!1,current:-1,needReZone:!0,isEventsInit:!1,isLeave:!1,downTime:0,prevTime:0,prevDefault:["contextmenu","wheel"],pointerEvent:["pointerdown","pointermove","pointerup"],eventOut:["pointercancel","pointerout","pointerleave"],xmlserializer:null,tmpTime:null,tmpImage:null,oldCursor:"auto",input:null,parent:null,firstImput:!0,hiddenImput:null,hiddenSizer:null,hasFocus:!1,startInput:!1,inputRange:[0,0],cursorId:0,str:"",pos:0,startX:-1,moveX:-1,debugInput:!1,isLoop:!1,listens:[],e:{type:null,clientX:0,clientY:0,keyCode:NaN,key:null,delta:0},isMobile:!1,now:null,getTime:function(){return self.performance&&self.performance.now?self.performance.now.bind(performance):Date.now},add:function(t){s.ui.push(t),s.getZone(t),s.isEventsInit||s.initEvents()},testMobile:function(){let t=navigator.userAgent;return!!(t.match(/Android/i)||t.match(/webOS/i)||t.match(/iPhone/i)||t.match(/iPad/i)||t.match(/iPod/i)||t.match(/BlackBerry/i)||t.match(/Windows Phone/i))},remove:function(t){let i=s.ui.indexOf(t);-1!==i&&(s.removeListen(t),s.ui.splice(i,1)),0===s.ui.length&&s.removeEvents()},initEvents:function(){if(s.isEventsInit)return;let t=document.body;s.isMobile=s.testMobile(),s.now=s.getTime(),s.isMobile?t.style.touchAction="none":t.addEventListener("wheel",s,{passive:!1}),t.addEventListener("pointercancel",s),t.addEventListener("pointerleave",s),t.addEventListener("pointermove",s),t.addEventListener("pointerdown",s),t.addEventListener("pointerup",s),t.addEventListener("keydown",s,!1),t.addEventListener("keyup",s,!1),window.addEventListener("resize",s.resize,!1),s.isEventsInit=!0,s.dom=t},removeEvents:function(){if(!s.isEventsInit)return;let t=document.body;s.isMobile||t.removeEventListener("wheel",s),t.removeEventListener("pointercancel",s),t.removeEventListener("pointerleave",s),t.removeEventListener("pointermove",s),t.removeEventListener("pointerdown",s),t.removeEventListener("pointerup",s),t.removeEventListener("keydown",s),t.removeEventListener("keyup",s),window.removeEventListener("resize",s.resize),s.isEventsInit=!1},resize:function(){s.needReZone=!0;let t,i=s.ui.length;for(;i--;)t=s.ui[i],t.isGui&&!t.isCanvasOnly&&t.autoResize&&t.calc()},out:function(){console.log("im am out"),s.clearOldID()},in:function(){console.log("im am in")},fakeUp:function(){this.handleEvent({type:"pointerup"})},handleEvent:function(t){-1!==s.prevDefault.indexOf(t.type)&&t.preventDefault(),s.findZone();let i=s.e,e=!1;"keydown"===t.type&&s.keydown(t),"keyup"===t.type&&s.keyup(t),"wheel"===t.type?i.delta=t.deltaY>0?1:-1:i.delta=0;let h=t.pointerType;if(i.clientX=("touch"===h?t.pageX:t.clientX)||0,i.clientY=("touch"===h?t.pageY:t.clientY)||0,i.type=t.type,-1!==s.eventOut.indexOf(t.type)&&(e=!0,i.type="mouseup"),"pointerleave"===t.type&&(s.isLeave=!0),"pointerdown"===t.type&&(i.type="mousedown"),"pointerup"===t.type&&(i.type="mouseup"),"pointermove"===t.type&&(s.isLeave&&(s.isLeave=!1,s.resize()),i.type="mousemove"),"mousedown"===i.type){if(s.downTime=s.now(),s.downTime-s.prevTime<200)return s.selectAll(),!1;s.prevTime=s.downTime}"mousedown"===i.type&&s.clearInput(),"mousedown"===i.type&&(s.lock=!0),"mouseup"===i.type&&(s.lock=!1),s.isMobile&&"mousedown"===i.type&&s.findID(i),"mousemove"!==i.type||s.lock||s.findID(i),null!==s.ID&&(s.ID.isCanvasOnly&&(i.clientX=s.ID.mouse.x,i.clientY=s.ID.mouse.y),s.ID.handleEvent(i)),s.isMobile&&"mouseup"===i.type&&s.clearOldID(),e&&s.clearOldID()},findID:function(t){let i,e,h,o=s.ui.length,n=-1;for(;o--;)if(i=s.ui[o],i.isCanvasOnly?(e=i.mouse.x,h=i.mouse.y):(e=t.clientX,h=t.clientY),s.onZone(i,e,h)){n=o,n!==s.current&&(s.clearOldID(),s.current=n,s.ID=i);break}-1===n&&s.clearOldID()},clearOldID:function(){s.ID&&(s.current=-1,s.ID.reset(),s.ID=null,s.cursor())},calcUis:function(t,i,e){let h,o,n=t.length,r=0,l=0,a=0,c=1;for(;n--;)h=t[l],l++,h.isGroup&&h.calcUis(),h.zone.w=h.w,h.zone.h=h.h,c=h.margin,h.autoWidth?(r=0,h.zone.x=i.x,h.zone.y=e,e+=h.h+c,a+=h.h+c):(0===r&&(a+=h.h+c),h.zone.x=i.x+r,h.zone.y=e,o=s.getWidth(h),o&&(h.zone.w=h.w=o),r+=h.zone.w,r>=i.w&&(e+=h.h+c,r=0));return a},findTarget:function(t,i){let e=t.length;for(;e--;)if(s.onZone(t[e],i.clientX,i.clientY))return e;return-1},findZone:function(t){if(s.needReZone||t){for(var i,e=s.ui.length;e--;)i=s.ui[e],s.getZone(i),i.isGui&&i.calcUis();s.needReZone=!1}},onZone:function(t,s,i){if(void 0===s||void 0===i)return!1;let e=t.zone,h=s-e.x,o=i-e.y,n=h>=0&&o>=0&&h<=e.w&&o<=e.h;return n?t.local.set(h,o):t.local.neg(),n},getWidth:function(t){return t.getDom().offsetWidth},getZone:function(t){if(t.isCanvasOnly)return;let s=t.getDom().getBoundingClientRect();t.zone={x:s.left,y:s.top,w:s.width,h:s.height}},cursor:function(t){(t=t||"auto")!==s.oldCursor&&(document.body.style.cursor=t,s.oldCursor=t)},toCanvas:function(t,i,e,h){if(s.xmlserializer||(s.xmlserializer=new XMLSerializer),h&&null!==s.tmpTime&&(clearTimeout(s.tmpTime),s.tmpTime=null),null!==s.tmpTime)return;s.lock&&(s.tmpTime=setTimeout((function(){s.tmpTime=null}),10));let o=!1;i===t.canvas.width&&e===t.canvas.height||(o=!0),null===s.tmpImage&&(s.tmpImage=new Image);let n=s.tmpImage,r=s.xmlserializer.serializeToString(t.content),l='<svg xmlns="http://www.w3.org/2000/svg" width="'+i+'" height="'+e+'"><foreignObject style="pointer-events: none; left:0;" width="100%" height="100%">'+r+"</foreignObject></svg>";n.onload=function(){let s=t.canvas.getContext("2d");o?(t.canvas.width=i,t.canvas.height=e):s.clearRect(0,0,i,e),s.drawImage(this,0,0),t.onDraw()},n.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(l),n.crossOrigin=""},setHidden:function(){null===s.hiddenImput&&(s.hiddenImput=document.createElement("input"),s.hiddenImput.type="text",s.hiddenSizer=document.createElement("div"),document.body.appendChild(s.hiddenImput),document.body.appendChild(s.hiddenSizer));let t=s.debugInput?"":"opacity:0; zIndex:0;",i=s.parent.css.txtselect+"padding:0; width:auto; height:auto; left:10px; top:auto; color:#FFF; background:#000;"+t;s.hiddenImput.style.cssText=i+"bottom:10px;"+(s.debugInput?"":"transform:scale(0);"),s.hiddenSizer.style.cssText=i+"bottom:40px;",s.hiddenImput.style.width=s.input.clientWidth+"px",s.hiddenImput.value=s.str,s.hiddenSizer.innerHTML=s.str,s.hasFocus=!0},clearHidden:function(t){null!==s.hiddenImput&&(s.hasFocus=!1)},clickPos:function(t){let i=s.str.length,e=0,h=0;for(;i--&&(e+=s.textWidth(s.str[h]),!(e>=t));)h++;return h},upInput:function(t,i){if(null===s.parent)return!1;let e=!1;if(i){let i=s.clickPos(t);if(s.moveX=i,-1===s.startX)s.startX=i,s.cursorId=i,s.inputRange=[s.startX,s.startX];else{s.moveX!==s.startX&&(s.startX>s.moveX?s.inputRange=[s.moveX,s.startX]:s.inputRange=[s.startX,s.moveX])}e=!0}else-1!==s.startX&&(s.hasFocus=!0,s.hiddenImput.focus(),s.hiddenImput.selectionStart=s.inputRange[0],s.hiddenImput.selectionEnd=s.inputRange[1],s.startX=-1,e=!0);return e&&s.selectParent(),e},selectAll:function(){s.parent&&(s.str=s.input.textContent,s.inputRange=[0,s.str.length],s.hasFocus=!0,s.hiddenImput.focus(),s.hiddenImput.selectionStart=s.inputRange[0],s.hiddenImput.selectionEnd=s.inputRange[1],s.cursorId=s.inputRange[1],s.selectParent())},selectParent:function(){var t=s.textWidth(s.str.substring(0,s.cursorId)),i=s.textWidth(s.str.substring(0,s.inputRange[0])),e=s.textWidth(s.str.substring(s.inputRange[0],s.inputRange[1]));s.parent.select(t,i,e,s.hiddenSizer.innerHTML)},textWidth:function(t){return null===s.hiddenSizer?0:(t=t.replace(/ /g," "),s.hiddenSizer.innerHTML=t,s.hiddenSizer.clientWidth)},clearInput:function(){null!==s.parent&&(s.firstImput||s.parent.validate(!0),s.clearHidden(),s.parent.unselect(),s.input.style.background=s.parent.colors.back,s.input.style.borderColor=s.parent.colors.border,s.parent.isEdit=!1,s.input=null,s.parent=null,s.str="",s.firstImput=!0)},setInput:function(t,i){s.clearInput(),s.input=t,s.parent=i,s.input.style.background=s.parent.colors.backoff,s.input.style.borderColor=s.parent.colors.select,s.str=s.input.textContent,s.setHidden()},keydown:function(t){if(null===s.parent)return;let i=t.which;t.shiftKey,s.firstImput=!1,s.hasFocus&&(window.focus(),s.hiddenImput.focus()),s.parent.isEdit=!0,13===i?s.clearInput():s.input.isNum?t.keyCode>47&&t.keyCode<58||t.keyCode>95&&t.keyCode<106||190===t.keyCode||110===t.keyCode||8===t.keyCode||109===t.keyCode?s.hiddenImput.readOnly=!1:s.hiddenImput.readOnly=!0:s.hiddenImput.readOnly=!1},keyup:function(t){null!==s.parent&&(s.str=s.hiddenImput.value,s.parent.allEqual?s.parent.sameStr(s.str):s.input.textContent=s.str,s.cursorId=s.hiddenImput.selectionStart,s.inputRange=[s.hiddenImput.selectionStart,s.hiddenImput.selectionEnd],s.selectParent(),s.parent.validate())},loop:function(){s.isLoop&&requestAnimationFrame(s.loop),s.update()},update:function(){let t=s.listens.length;for(;t--;)s.listens[t].listening()},removeListen:function(t){let i=s.listens.indexOf(t);-1!==i&&s.listens.splice(i,1),0===s.listens.length&&(s.isLoop=!1)},addListen:function(t){return-1===s.listens.indexOf(t)&&(s.listens.push(t),s.isLoop||(s.isLoop=!0,s.loop()),!0)}},i=s,e={transition:.2,frag:document.createDocumentFragment(),colorRing:null,joystick_0:null,joystick_1:null,circular:null,knob:null,pad2d:null,svgns:"http://www.w3.org/2000/svg",links:"http://www.w3.org/1999/xlink",htmls:"http://www.w3.org/1999/xhtml",DOM_SIZE:["height","width","top","left","bottom","right","margin-left","margin-right","margin-top","margin-bottom"],SVG_TYPE_D:["pattern","defs","transform","stop","animate","radialGradient","linearGradient","animateMotion","use","filter","feColorMatrix"],SVG_TYPE_G:["svg","rect","circle","path","polygon","text","g","line","foreignObject"],PI:Math.PI,TwoPI:2*Math.PI,pi90:.5*Math.PI,pi60:Math.PI/3,torad:Math.PI/180,todeg:180/Math.PI,clamp:function(t,s,i){return t=(t=t<s?s:t)>i?i:t},size:{w:240,h:20,p:30,s:8},defineColor:function(t,s=e.colors){let i={...s},h=["fontFamily","fontWeight","fontShadow","fontSize"],o=!1;t.font&&(t.fontFamily=t.font),t.shadow&&(t.fontShadow=t.shadow),t.weight&&(t.fontWeight=t.weight),t.fontColor&&(t.text=t.fontColor),t.color&&(t.text=t.color),t.text&&(i.text=t.text,t.fontColor||t.color||(i.title=e.ColorLuma(t.text,-.25),i.titleoff=e.ColorLuma(t.text,-.5)),i.textOver=e.ColorLuma(t.text,.25),i.textSelect=e.ColorLuma(t.text,.5)),t.button&&(i.button=t.button,i.border=e.ColorLuma(t.button,.1),i.overoff=e.ColorLuma(t.button,.2)),t.select&&(i.select=t.select,i.over=e.ColorLuma(t.select,-.1)),t.itemBg&&(t.back=t.itemBg),t.back&&(i.back=t.back,i.backoff=e.ColorLuma(t.back,-.1)),t.fontSelect&&(i.textSelect=t.fontSelect),t.groupBorder&&(i.gborder=t.groupBorder),t.transparent&&(t.bg="none"),t.bg&&(i.background=i.backgroundOver=t.bg),t.bgOver&&(i.backgroundOver=t.bgOver);for(let s in i)t[s]&&(i[s]=t[s]);for(let s in t)-1!==h.indexOf(s)&&(o=!0);return o&&e.defineText(i),i},colors:{content:"none",background:"rgba(50,50,50,0.3)",backgroundOver:"rgba(50,50,50,0.4)",title:"#CCC",titleoff:"#BBB",text:"#DDD",textOver:"#EEE",textSelect:"#FFF",back:"rgba(0,0,0,0.2)",backoff:"rgba(0,0,0,0.3)",border:"#4c4c4c",borderSize:1,gborder:"none",button:"#3c3c3c",overoff:"#5c5c5c",over:"#024699",select:"#308AFF",action:"#FF3300",fontFamily:"Consolas,monaco,monospace",fontWeight:"normal",fontShadow:"#000",fontSize:12,radius:4,hide:"rgba(0,0,0,0)"},css:{basic:"position:absolute; pointer-events:none; box-sizing:border-box; margin:0; padding:0; overflow:hidden; -o-user-select:none; -ms-user-select:none; -khtml-user-select:none; -webkit-user-select:none; -moz-user-select:none;",button:"display:flex; justify-content:center; align-items:center; text-align:center;"},svgs:{group:"M 7 7 L 7 8 8 8 8 7 7 7 M 5 7 L 5 8 6 8 6 7 5 7 M 3 7 L 3 8 4 8 4 7 3 7 M 7 5 L 7 6 8 6 8 5 7 5 M 6 6 L 6 5 5 5 5 6 6 6 M 7 3 L 7 4 8 4 8 3 7 3 M 6 4 L 6 3 5 3 5 4 6 4 M 3 5 L 3 6 4 6 4 5 3 5 M 3 3 L 3 4 4 4 4 3 3 3 Z",arrow:"M 3 8 L 8 5 3 2 3 8 Z",arrowDown:"M 5 8 L 8 3 2 3 5 8 Z",arrowUp:"M 5 2 L 2 7 8 7 5 2 Z",solid:"M 13 10 L 13 1 4 1 1 4 1 13 10 13 13 10 M 11 3 L 11 9 9 11 3 11 3 5 5 3 11 3 Z",body:"M 13 10 L 13 1 4 1 1 4 1 13 10 13 13 10 M 11 3 L 11 9 9 11 3 11 3 5 5 3 11 3 M 5 4 L 4 5 4 10 9 10 10 9 10 4 5 4 Z",vehicle:"M 13 6 L 11 1 3 1 1 6 1 13 3 13 3 11 11 11 11 13 13 13 13 6 M 2.4 6 L 4 2 10 2 11.6 6 2.4 6 M 12 8 L 12 10 10 10 10 8 12 8 M 4 8 L 4 10 2 10 2 8 4 8 Z",articulation:"M 13 9 L 12 9 9 2 9 1 5 1 5 2 2 9 1 9 1 13 5 13 5 9 4 9 6 5 8 5 10 9 9 9 9 13 13 13 13 9 Z",character:"M 13 4 L 12 3 9 4 5 4 2 3 1 4 5 6 5 8 4 13 6 13 7 9 8 13 10 13 9 8 9 6 13 4 M 6 1 L 6 3 8 3 8 1 6 1 Z",terrain:"M 13 8 L 12 7 Q 9.06 -3.67 5.95 4.85 4.04 3.27 2 7 L 1 8 7 13 13 8 M 3 8 Q 3.78 5.420 5.4 6.6 5.20 7.25 5 8 L 7 8 Q 8.39 -0.16 11 8 L 7 11 3 8 Z",joint:"M 7.7 7.7 Q 8 7.45 8 7 8 6.6 7.7 6.3 7.45 6 7 6 6.6 6 6.3 6.3 6 6.6 6 7 6 7.45 6.3 7.7 6.6 8 7 8 7.45 8 7.7 7.7 M 3.35 8.65 L 1 11 3 13 5.35 10.65 Q 6.1 11 7 11 8.28 11 9.25 10.25 L 7.8 8.8 Q 7.45 9 7 9 6.15 9 5.55 8.4 5 7.85 5 7 5 6.54 5.15 6.15 L 3.7 4.7 Q 3 5.712 3 7 3 7.9 3.35 8.65 M 10.25 9.25 Q 11 8.28 11 7 11 6.1 10.65 5.35 L 13 3 11 1 8.65 3.35 Q 7.9 3 7 3 5.7 3 4.7 3.7 L 6.15 5.15 Q 6.54 5 7 5 7.85 5 8.4 5.55 9 6.15 9 7 9 7.45 8.8 7.8 L 10.25 9.25 Z",ray:"M 9 11 L 5 11 5 12 9 12 9 11 M 12 5 L 11 5 11 9 12 9 12 5 M 11.5 10 Q 10.9 10 10.45 10.45 10 10.9 10 11.5 10 12.2 10.45 12.55 10.9 13 11.5 13 12.2 13 12.55 12.55 13 12.2 13 11.5 13 10.9 12.55 10.45 12.2 10 11.5 10 M 9 10 L 10 9 2 1 1 2 9 10 Z",collision:"M 11 12 L 13 10 10 7 13 4 11 2 7.5 5.5 9 7 7.5 8.5 11 12 M 3 2 L 1 4 4 7 1 10 3 12 8 7 3 2 Z",map:"M 13 1 L 1 1 1 13 13 13 13 1 M 12 2 L 12 7 7 7 7 12 2 12 2 7 7 7 7 2 12 2 Z",material:"M 13 1 L 1 1 1 13 13 13 13 1 M 12 2 L 12 7 7 7 7 12 2 12 2 7 7 7 7 2 12 2 Z",texture:"M 13 4 L 13 1 1 1 1 4 5 4 5 13 9 13 9 4 13 4 Z",object:"M 10 1 L 7 4 4 1 1 1 1 13 4 13 4 5 7 8 10 5 10 13 13 13 13 1 10 1 Z",none:"M 9 5 L 5 5 5 9 9 9 9 5 Z",cursor:"M 4 7 L 1 10 1 12 2 13 4 13 7 10 9 14 14 0 0 5 4 7 Z"},getImput:function(){return!!i.input},setStyle:function(t){for(var s in t)e.colors[s]&&(e.colors[s]=t[s]);e.setText()},defineText:function(t){e.setText(t.fontSize,t.text,t.fontFamily,t.fontShadow,t.fontWeight)},setText:function(t,s,i,h,o){let n=e.colors;void 0===i&&(i=n.fontFamily),void 0===t&&(t=n.fontSize),void 0===h&&(h=n.fontShadow),void 0===o&&(o=n.fontWeight),void 0===s&&(s=n.text);e.css.txt=e.css.basic+"display:flex; justify-content:left; align-items:center; text-align:left;font-family:"+i+"; font-weight:"+o+"; font-size:"+t+"px; color:"+n.text+"; padding:0px 10px; left:0; top:2px; height:16px; width:100px; overflow:hidden; white-space: nowrap;","none"!==h&&(e.css.txt+=" text-shadow: 1px 1px 1px "+h+";"),e.css.txtselect=e.css.txt+"padding:0px 4px; border:1px dashed "+n.border+";",e.css.item=e.css.txt+" position:relative; margin-bottom:1px; display:block; padding:2px 4px;"},cloneCss:function(){return{...e.css}},clone:function(t){return t.cloneNode(!0)},setSvg:function(t,s,i,e,h){-1===e?t.setAttributeNS(null,s,i):void 0!==h?t.childNodes[e||0].childNodes[h||0].setAttributeNS(null,s,i):t.childNodes[e||0].setAttributeNS(null,s,i)},setCss:function(t,s){for(let i in s)-1!==e.DOM_SIZE.indexOf(i)?t.style[i]=s[i]+"px":t.style[i]=s[i]},set:function(t,s){for(let i in s)"txt"===i&&(t.textContent=s[i]),"link"===i?t.setAttributeNS(e.links,"xlink:href",s[i]):t.setAttributeNS(null,i,s[i])},get:function(t,s){if(void 0===s)return t;if(!isNaN(s))return t.childNodes[s];if(s instanceof Array){if(2===s.length)return t.childNodes[s[0]].childNodes[s[1]];if(3===s.length)return t.childNodes[s[0]].childNodes[s[1]].childNodes[s[2]]}},dom:function(t,s,i,h,o){return t=t||"div",-1!==e.SVG_TYPE_D.indexOf(t)||-1!==e.SVG_TYPE_G.indexOf(t)?"svg"===t?(h=document.createElementNS(e.svgns,"svg"),e.set(h,i)):(void 0===h&&(h=document.createElementNS(e.svgns,"svg")),e.addAttributes(h,t,i,o)):h=void 0===h?document.createElementNS(e.htmls,t):h.appendChild(document.createElementNS(e.htmls,t)),s&&(h.style.cssText=s),void 0===o?h:h.childNodes[o||0]},addAttributes:function(t,s,i,h){let o=document.createElementNS(e.svgns,s);return e.set(o,i),e.get(t,h).appendChild(o),-1!==e.SVG_TYPE_G.indexOf(s)&&(o.style.pointerEvents="none"),o},clear:function(t){for(e.purge(t);t.firstChild;)t.firstChild.firstChild&&e.clear(t.firstChild),t.removeChild(t.firstChild)},purge:function(t){let s,i,h=t.attributes;if(h)for(s=h.length;s--;)i=h[s].name,"function"==typeof t[i]&&(t[i]=null);if(h=t.childNodes,h)for(s=h.length;s--;)e.purge(t.childNodes[s])},addSVGGlowEffect:function(){if(null!==document.getElementById("UILGlow"))return;let t=e.initUILEffects(),s=e.addAttributes(t,"filter",{id:"UILGlow",x:"-20%",y:"-20%",width:"140%",height:"140%"});e.addAttributes(s,"feGaussianBlur",{in:"SourceGraphic",stdDeviation:"3",result:"uilBlur"});let i=e.addAttributes(s,"feMerge",{});for(let t=0;t<=3;t++)e.addAttributes(i,"feMergeNode",{in:"uilBlur"});e.addAttributes(i,"feMergeNode",{in:"SourceGraphic"})},initUILEffects:function(){let t=document.getElementById("UILSVGEffects");return null===t&&(t=e.dom("svg",void 0,{id:"UILSVGEffects",width:"0",height:"0"}),document.body.appendChild(t)),t},ColorLuma:function(t,s){"n"===t&&(t="#000"),(t=String(t).replace(/[^0-9a-f]/gi,"")).length<6&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),s=s||0;let i,e,h="#";for(e=0;e<3;e++)i=parseInt(t.substr(2*e,2),16),i=Math.round(Math.min(Math.max(0,i+i*s),255)).toString(16),h+=("00"+i).substr(i.length);return h},findDeepInver:function(t){return.3*t[0]+.59*t[1]+.11*t[2]<=.6},lerpColor:function(t,s,i){let e={};for(let h=0;h<3;h++)e[h]=t[h]+(s[h]-t[h])*i;return e},hexToHtml:function(t){return"#"+("000000"+(t=void 0===t?0:t).toString(16)).substr(-6)},htmlToHex:function(t){return t.toUpperCase().replace("#","0x")},u255:function(t,s){return parseInt(t.substring(s,s+2),16)/255},u16:function(t,s){return parseInt(t.substring(s,s+1),16)/15},unpack:function(t){return 7==t.length?[e.u255(t,1),e.u255(t,3),e.u255(t,5)]:4==t.length?[e.u16(t,1),e.u16(t,2),e.u16(t,3)]:void 0},p255:function(t){let s=Math.round(255*t).toString(16);return s.length<2&&(s="0"+s),s},pack:function(t){return"#"+e.p255(t[0])+e.p255(t[1])+e.p255(t[2])},htmlRgb:function(t){return"rgb("+Math.round(255*t[0])+","+Math.round(255*t[1])+","+Math.round(255*t[2])+")"},pad:function(t){return 1==t.length&&(t="0"+t),t},rgbToHex:function(t){let s=Math.round(255*t[0]).toString(16),i=Math.round(255*t[1]).toString(16),h=Math.round(255*t[2]).toString(16);return"#"+e.pad(s)+e.pad(i)+e.pad(h)},hueToRgb:function(t,s,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(s-t)*i:i<.5?s:i<2/3?t+6*(s-t)*(2/3-i):t},rgbToHsl:function(t){let s=t[0],i=t[1],e=t[2],h=Math.min(s,i,e),o=Math.max(s,i,e),n=o-h,r=0,l=0,a=(h+o)/2;return a>0&&a<1&&(l=n/(a<.5?2*a:2-2*a)),n>0&&(o==s&&o!=i&&(r+=(i-e)/n),o==i&&o!=e&&(r+=2+(e-s)/n),o==e&&o!=s&&(r+=4+(s-i)/n),r/=6),[r,l,a]},hslToRgb:function(t){let s,i,h=t[0],o=t[1],n=t[2];return 0===o?[n,n,n]:(i=n<=.5?n*(o+1):n+o-n*o,s=2*n-i,[e.hueToRgb(s,i,h+.33333),e.hueToRgb(s,i,h),e.hueToRgb(s,i,h-.33333)])},makeGradiant:function(t,s,i,h){e.dom(t,null,s,i,0);let o,n=i.childNodes[0].childNodes.length-1;for(let t=0;t<h.length;t++)o=h[t],e.dom("stop",null,{offset:o[0]+"%","stop-color":o[1],"stop-opacity":o[2]},i,[0,n])},makePad:function(t){let s=256,i=e.dom("svg",e.css.basic+"position:relative;",{viewBox:"0 0 256 256",width:s,height:s,preserveAspectRatio:"none"}),o=200,n=28;h.dom("rect","",{x:n,y:n,width:o,height:o,fill:e.colors.back},i),h.dom("rect","",{x:38,y:38,width:180,height:180,fill:e.colors.button},i),h.dom("line","",{x1:38,y1:128,x2:218,y2:128,stroke:e.colors.back,"stroke-width":2},i),h.dom("line","",{x1:128,x2:128,y1:38,y2:218,stroke:e.colors.back,"stroke-width":2},i),h.dom("circle","",{cx:128,cy:128,r:5,stroke:e.colors.text,"stroke-width":5,fill:"none"},i),e.pad2d=i},makeKnob:function(t){let s=128,i=e.dom("svg",e.css.basic+"position:relative;",{viewBox:"0 0 128 "+s,width:s,height:s,preserveAspectRatio:"none"});e.dom("circle","",{cx:64,cy:64,r:34,fill:e.colors.button,stroke:"rgba(0,0,0,0.3)","stroke-width":8},i),e.dom("path","",{d:"",stroke:e.colors.text,"stroke-width":4,fill:"none","stroke-linecap":"round"},i),e.dom("circle","",{cx:64,cy:64,r:41,stroke:"rgba(0,0,0,0.1)","stroke-width":7,fill:"none"},i),e.dom("path","",{d:"",stroke:"rgba(255,255,255,0.3)","stroke-width":2,fill:"none","stroke-linecap":"round","stroke-opacity":.5},i),e.knob=i},makeCircular:function(t){let s=128,i=e.dom("svg",e.css.basic+"position:relative;",{viewBox:"0 0 128 "+s,width:s,height:s,preserveAspectRatio:"none"});e.dom("circle","",{cx:64,cy:64,r:40,stroke:"rgba(0,0,0,0.1)","stroke-width":10,fill:"none"},i),e.dom("path","",{d:"",stroke:e.colors.text,"stroke-width":7,fill:"none","stroke-linecap":"butt"},i),e.circular=i},makeJoystick:function(t){let s,i=128,h=Math.floor(49),o=Math.floor(.6*h),n=e.dom("svg",e.css.basic+"position:relative;",{viewBox:"0 0 128 "+i,width:i,height:i,preserveAspectRatio:"none"});if(e.dom("defs",null,{},n),e.dom("g",null,{},n),0===t){s=[[40,"rgb(0,0,0)",.3],[80,"rgb(0,0,0)",0],[90,"rgb(50,50,50)",.4],[100,"rgb(50,50,50)",0]],e.makeGradiant("radialGradient",{id:"grad",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},n,s),s=[[60,"rgb(0,0,0)",.5],[100,"rgb(0,0,0)",0]],e.makeGradiant("radialGradient",{id:"gradS",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},n,s);let t=["rgb(40,40,40)","rgb(48,48,48)","rgb(30,30,30)"],i=["rgb(1,90,197)","rgb(3,95,207)","rgb(0,65,167)"];s=[[30,t[0],1],[60,t[1],1],[80,t[1],1],[100,t[2],1]],e.makeGradiant("radialGradient",{id:"gradIn",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},n,s),s=[[30,i[0],1],[60,i[1],1],[80,i[1],1],[100,i[2],1]],e.makeGradiant("radialGradient",{id:"gradIn2",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},n,s),e.dom("circle","",{cx:64,cy:64,r:h,fill:"url(#grad)"},n),e.dom("circle","",{cx:69,cy:74,r:o+10,fill:"url(#gradS)"},n),e.dom("circle","",{cx:64,cy:64,r:o,fill:"url(#gradIn)"},n),e.joystick_0=n}else s=[[69,"rgb(0,0,0)",0],[70,"rgb(0,0,0)",.3],[100,"rgb(0,0,0)",0]],e.makeGradiant("radialGradient",{id:"gradX",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},n,s),e.dom("circle","",{cx:64,cy:64,r:h,fill:"none",stroke:"rgba(100,100,100,0.25)","stroke-width":"4"},n),e.dom("circle","",{cx:64,cy:64,r:o+14,fill:"url(#gradX)"},n),e.dom("circle","",{cx:64,cy:64,r:o,fill:"none",stroke:"rgb(100,100,100)","stroke-width":"4"},n),e.joystick_1=n},makeColorRing:function(){let t=256,s=e.dom("svg",e.css.basic+"position:relative;",{viewBox:"0 0 256 "+t,width:t,height:t,preserveAspectRatio:"none"});e.dom("defs",null,{},s),e.dom("g",null,{},s);let i,h,o,n,r,l,a,c,d,u=128,p=8/113/24*Math.PI,m=0,g=[];for(l=0;l<=24;++l){if(o=l/24,n=o*e.TwoPI,i=.5*(m+n),h=1/Math.cos(.5*(n-m)),r=[Math.sin(m),-Math.cos(m),Math.sin(i)*h,-Math.cos(i)*h,Math.sin(n),-Math.cos(n)],g[1]=e.rgbToHex(e.hslToRgb([o,1,.5])),l>0){for(a=6;a--;)r[a]=(113*r[a]+u).toFixed(2);c=" M"+r[0]+" "+r[1]+" Q"+r[2]+" "+r[3]+" "+r[4]+" "+r[5],d=[[0,g[0],1],[100,g[1],1]],e.makeGradiant("linearGradient",{id:"G"+l,x1:r[0],y1:r[1],x2:r[4],y2:r[5],gradientUnits:"userSpaceOnUse"},s,d),e.dom("path","",{d:c,"stroke-width":30,stroke:"url(#G"+l+")","stroke-linecap":"butt"},s,1)}m=n-p,g[0]=g[1]}d=[[0,"#FFFFFF",1],[50,"#FFFFFF",0],[50,"#000000",0],[100,"#000000",1]],e.makeGradiant("linearGradient",{id:"GL0",x1:0,y1:u-84.9,x2:0,y2:212.9,gradientUnits:"userSpaceOnUse"},s,d),d=[[0,"#7f7f7f",1],[50,"#7f7f7f",.5],[100,"#7f7f7f",0]],e.makeGradiant("linearGradient",{id:"GL1",x1:78.95,y1:0,x2:226,y2:0,gradientUnits:"userSpaceOnUse"},s,d),e.dom("g",null,{"transform-origin":"128px 128px",transform:"rotate(0)"},s),e.dom("polygon","",{points:"78.95 43.1 78.95 212.85 226 128",fill:"red"},s,2),e.dom("polygon","",{points:"78.95 43.1 78.95 212.85 226 128",fill:"url(#GL1)","stroke-width":1,stroke:"url(#GL1)"},s,2),e.dom("polygon","",{points:"78.95 43.1 78.95 212.85 226 128",fill:"url(#GL0)","stroke-width":1,stroke:"url(#GL0)"},s,2),e.dom("path","",{d:"M 255.75 136.5 Q 256 132.3 256 128 256 123.7 255.75 119.5 L 241 128 255.75 136.5 Z",fill:"none","stroke-width":2,stroke:"#000"},s,2),e.dom("circle","",{cx:128,cy:128,r:6,"stroke-width":2,stroke:"#000",fill:"none"},s),e.colorRing=s},icon:function(t,s,i){i=i||40;let h=["<svg xmlns='"+e.svgns+"' version='1.1' xmlns:xlink='"+e.htmls+"' style='pointer-events:none;' preserveAspectRatio='xMinYMax meet' x='0px' y='0px' width='"+i+"px' height='"+i+"px' viewBox='0 0 256 256'><g>"];switch(t){case"logo":h[1]="<path id='logoin' fill='"+s+"' stroke='none' d='"+e.logoFill_d+"'/>";break;case"neo":h[1]="<path id='logoin' fill='"+s+"' stroke='none' d='"+e.logo_neo+"'/>";break;case"github":h[1]="<path id='logoin' fill='"+s+"' stroke='none' d='"+e.logo_github+"'/>";break;case"save":h[1]="<path stroke='"+s+"' stroke-width='4' stroke-linejoin='round' stroke-linecap='round' fill='none' d='M 26.125 17 L 20 22.95 14.05 17 M 20 9.95 L 20 22.95'/><path stroke='"+s,h[1]+="' stroke-width='2.5' stroke-linejoin='round' stroke-linecap='round' fill='none' d='M 32.6 23 L 32.6 25.5 Q 32.6 28.5 29.6 28.5 L 10.6 28.5 Q 7.6 28.5 7.6 25.5 L 7.6 23'/>"}return h[2]="</g></svg>",h.join("\n")},logoFill_d:"\n\t\tM 171 150.75 L 171 33.25 155.5 33.25 155.5 150.75 Q 155.5 162.2 147.45 170.2 139.45 178.25 128 178.25 116.6 178.25 108.55 170.2 100.5 162.2 100.5 150.75 \n\t\tL 100.5 33.25 85 33.25 85 150.75 Q 85 168.65 97.55 181.15 110.15 193.75 128 193.75 145.9 193.75 158.4 181.15 171 168.65 171 150.75 \n\t\tM 200 33.25 L 184 33.25 184 150.8 Q 184 174.1 167.6 190.4 151.3 206.8 128 206.8 104.75 206.8 88.3 190.4 72 174.1 72 150.8 L 72 33.25 56 33.25 56 150.75 \n\t\tQ 56 180.55 77.05 201.6 98.2 222.75 128 222.75 157.8 222.75 178.9 201.6 200 180.55 200 150.75 L 200 33.25 Z\n\t\t",logo_github:"\n\t\tM 180.5 70 Q 186.3 82.4 181.55 96.55 196.5 111.5 189.7 140.65 183.65 168.35 146 172.7 152.5 178.7 152.55 185.9 L 152.55 218.15 Q 152.84 224.56 159.15 223.3 \n\t\t159.21 223.3 159.25 223.3 181.14 216.25 198.7 198.7 228 169.4 228 128 228 86.6 198.7 57.3 169.4 28 128 28 86.6 28 57.3 57.3 28 86.6 28 128 28 169.4 57.3 198.7 74.85 \n\t\t216.25 96.75 223.3 96.78 223.3 96.8 223.3 103.16 224.54 103.45 218.15 L 103.45 200 Q 82.97 203.1 75.1 196.35 69.85 191.65 68.4 185.45 64.27 177.055 59.4 174.15 49.20 \n\t\t166.87 60.8 167.8 69.85 169.61 75.7 180 81.13 188.09 90 188.55 98.18 188.86 103.45 185.9 103.49 178.67 110 172.7 72.33 168.33 66.3 140.65 59.48 111.49 74.45 96.55 69.7 \n\t\t82.41 75.5 70 84.87 68.74 103.15 80 115.125 76.635 128 76.85 140.85 76.65 152.85 80 171.1 68.75 180.5 70 Z\n\t\t",logo_neo:"\n\t\tM 219 52 L 206 52 206 166 Q 206 183.4 193.75 195.65 181.4 208 164 208 146.6 208 134.35 195.65 122 183.4 122 166 L 122 90 Q 122 77.6 113.15 68.85 104.4 60 92 60 79.55 \n\t\t60 70.75 68.85 62 77.6 62 90 L 62 204 75 204 75 90 Q 75 83 79.95 78 84.95 73 92 73 99 73 104 78 109 83 109 90 L 109 166 Q 109 188.8 125.15 204.85 141.2 221 164 221 \n\t\t186.75 221 202.95 204.85 219 188.8 219 166 L 219 52 M 194 52 L 181 52 181 166 Q 181 173 176.05 178 171.05 183 164 183 157 183 152 178 147 173 147 166 L 147 90 Q 147 \n\t\t67.2 130.85 51.15 114.8 35 92 35 69.25 35 53.05 51.15 37 67.2 37 90 L 37 204 50 204 50 90 Q 50 72.6 62.25 60.35 74.6 48 92 48 109.4 48 121.65 60.35 134 72.6 134 90 L \n\t\t134 166 Q 134 178.4 142.85 187.15 151.6 196 164 196 176.45 196 185.25 187.15 194 178.4 194 166 L 194 52 Z\n\t\t"};e.setText();const h=e;class o{constructor(t=0,s=0){this.x=t,this.y=s}set(t,s){return this.x=t,this.y=s,this}divide(t){return this.x/=t.x,this.y/=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divideScalar(t){return this.multiplyScalar(1/t)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}angle(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t}addScalar(t){return this.x+=t,this.y+=t,this}negate(){return this.x*=-1,this.y*=-1,this}neg(){return this.x=-1,this.y=-1,this}isZero(){return 0===this.x&&0===this.y}copy(t){return this.x=t.x,this.y=t.y,this}equals(t){return t.x===this.x&&t.y===this.y}nearEquals(t,s){return t.x.toFixed(s)===this.x.toFixed(s)&&t.y.toFixed(s)===this.y.toFixed(s)}lerp(t,s){return null===t?(this.x-=this.x*s,this.y-=this.y*s):(this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s),this}}class n{constructor(t={}){this.lock=t.lock||!1,this.neverlock=!1,this.isSpace=t.isSpace||!1,this.main=t.main||null,this.isUI=t.isUI||!1,this.group=t.group||null,this.isListen=!1,this.isSelectable=void 0!==t.selectable&&t.selectable,this.unselectable=void 0!==t.unselect?t.unselect:this.isSelectable,this.ontop=!!t.ontop&&t.ontop,this.css=this.main?this.main.css:h.css,this.colors=h.defineColor(t,this.main?this.group?this.group.colors:this.main.colors:h.colors),this.svgs=h.svgs,this.zone={x:0,y:0,w:0,h:0},this.local=(new o).neg(),this.isCanvasOnly=!1,this.isSelect=!1,this.p=void 0!==t.p?t.p:h.size.p,this.w=this.isUI?this.main.size.w:h.size.w,void 0!==t.w&&(this.w=t.w),this.h=this.isUI?this.main.size.h:h.size.h,void 0!==t.h&&(this.h=t.h),this.isSpace?this.lock=!0:this.h=this.h<11?11:this.h,this.autoWidth=t.auto||!0,this.isOpen=!1,this.radius=t.radius||this.colors.radius,this.transition=t.transition||h.transition,this.isNumber=!1,this.noNeg=t.noNeg||!1,this.allEqual=t.allEqual||!1,this.mono=!1,this.isEdit=!1,this.simple=t.simple||!1,this.simple&&(this.sa=0),this.setSize(this.w),void 0!==t.sa&&(this.sa=t.sa),void 0!==t.sb&&(this.sb=t.sb),this.simple&&(this.sb=this.w-this.sa),this.sc=void 0===t.sc?47:t.sc,this.objectLink=null,this.isSend=!1,this.val=null,this.txt=t.name||"",this.name=t.rename||this.txt,this.target=t.target||null,this.callback=void 0===t.callback?null:t.callback,this.endCallback=null,this.openCallback=void 0===t.openCallback?null:t.openCallback,this.closeCallback=void 0===t.closeCallback?null:t.closeCallback,null===this.callback&&this.isUI&&null!==this.main.callback&&(this.callback=this.group?this.group.callback:this.main.callback),this.c=[],this.s=[],this.useFlex=!!this.isUI&&this.main.useFlex;let s=this.useFlex?"disply:flex; justify-content:center; align-items:center; text-align:center; flex: 1 100%;":"float:left;";if(this.c[0]=h.dom("div",this.css.basic+s+"position:relative; height:20px;"),this.s[0]=this.c[0].style,this.margin=t.margin||1,this.isUI&&this.margin&&(this.s[0].boxSizing="content-box",.5*this.margin===Math.floor(.5*this.margin)?(this.s[0].borderTop=.5*this.margin+"px solid transparent",this.s[0].borderBottom=.5*this.margin+"px solid transparent"):this.s[0].borderBottom=this.margin+"px solid transparent"),this.simple||(this.c[1]=h.dom("div",this.css.txt),this.s[1]=this.c[1].style,this.c[1].textContent=this.name,this.s[1].color=this.lock?this.colors.titleoff:this.colors.title),t.pos){this.s[0].position="absolute";for(let s in t.pos)this.s[0][s]=t.pos[s];this.mono=!0}t.css&&(this.s[0].cssText=t.css)}init(){this.zone.h=this.h,this.zone.w=this.w;let t=this.s,s=this.c;t[0].height=this.h+"px",this.isUI&&(t[0].background=this.colors.background),!this.autoWidth&&this.useFlex?(t[0].flex="1 0 auto",t[0].minWidth=this.minw+"px",t[0].textAlign="center"):this.isUI&&(t[0].width="100%"),void 0!==s[1]&&this.autoWidth&&(t[1]=s[1].style,t[1].height=this.h-4+"px",t[1].lineHeight=this.h-8+"px");let e=h.frag;for(let i=1,h=s.length;i!==h;i++)void 0!==s[i]&&(e.appendChild(s[i]),t[i]=s[i].style);let o=null!==this.target?this.target:this.isUI?this.main.inner:document.body;this.ontop?o.insertAdjacentElement("afterbegin",s[0]):o.appendChild(s[0]),s[0].appendChild(e),this.rSize(),this.isUI||(this.c[0].style.pointerEvents="auto",i.add(this)),this.baseH&&this.transition&&this.isUI&&(this.c[0].style.transition="height "+this.transition+"s ease-out")}dom(t,s,i,e,o){return h.dom(t,s,i,e,o)}setSvg(t,s,i,e,o){h.setSvg(t,s,i,e,o)}setCss(t,s){h.setCss(t,s)}clamp(t,s,i){return h.clamp(t,s,i)}getColorRing(){return h.colorRing||h.makeColorRing(),h.clone(h.colorRing)}getJoystick(t){return h["joystick_"+t]||h.makeJoystick(t),h.clone(h["joystick_"+t])}getCircular(t){return h.circular||h.makeCircular(t),h.clone(h.circular)}getKnob(t){return h.knob||h.makeKnob(t),h.clone(h.knob)}getPad2d(t){return h.pad2d||h.makePad(t),h.clone(h.pad2d)}cursor(t){i.cursor(t)}update(){}reset(){}getDom(){return this.c[0]}uiout(){this.lock||this.s&&(this.s[0].background=this.colors.background)}uiover(){this.lock||this.s&&(this.s[0].background=this.colors.backgroundOver)}rename(t){void 0!==this.c[1]&&(this.c[1].textContent=t)}listen(){return this.isListen=i.addListen(this),this}listening(){null!==this.objectLink&&(this.isSend||this.isEdit||this.setValue(this.objectLink[this.val]))}setValue(t){this.isNumber?this.value=this.numValue(t):this.value=t,this.update()}onChange(t){if(!this.isSpace)return this.callback=t||null,this}onFinishChange(t){if(!this.isSpace)return this.callback=null,this.endCallback=t,this}onOpen(t){return this.openCallback=t,this}onClose(t){return this.closeCallback=t,this}send(t){(t=t||this.value)instanceof Array&&1===t.length&&(t=t[0]),this.isSend=!0,null!==this.objectLink&&(this.objectLink[this.val]=t),this.callback&&this.callback(t,this.val),this.isSend=!1}sendEnd(t){(t=t||this.value)instanceof Array&&1===t.length&&(t=t[0]),this.endCallback&&this.endCallback(t),null!==this.objectLink&&(this.objectLink[this.val]=t)}clear(t){this.isListen&&i.removeListen(this),h.clear(this.c[0]),t||(null!==this.target?null!==this.group?this.group.clearOne(this):this.target.removeChild(this.c[0]):this.isUI?this.main.clearOne(this):document.body.removeChild(this.c[0]),this.isUI||i.remove(this)),this.c=null,this.s=null,this.callback=null,this.target=null,this.isListen=!1}getWidth(){let t=i.getWidth(this);t&&(this.w=t)}setSize(t){if(this.autoWidth)if(this.w=t,this.simple)this.sb=this.w-this.sa;else{let t=this.w*(this.p/100);this.sa=Math.floor(t+10),this.sb=Math.floor(this.w-t-20)}}rSize(){this.autoWidth&&(this.isUI||(this.s[0].width=this.w+"px"),this.simple||(this.s[1].width=this.sa+"px"))}setTypeNumber(t){let s;switch(this.isNumber=!0,this.value=0,void 0!==t.value&&("string"==typeof t.value?this.value=1*t.value:this.value=t.value),this.min=void 0===t.min?-1/0:t.min,this.max=void 0===t.max?1/0:t.max,this.precision=void 0===t.precision?2:t.precision,this.precision){case 0:s=1;break;case 1:s=.1;break;case 2:s=.01;break;case 3:s=.001;break;case 4:s=1e-4;break;case 5:s=1e-5}this.step=void 0===t.step?s:t.step,this.range=this.max-this.min,this.value=this.numValue(this.value)}numValue(t){return this.noNeg&&(t=Math.abs(t)),1*Math.min(this.max,Math.max(this.min,t)).toFixed(this.precision)}handleEvent(t){if(!this.lock)return this.neverlock&&(i.lock=!1),this[t.type]?this[t.type](t):console.error(t.type,"this type of event no existe !")}wheel(t){return!1}mousedown(t){return!1}mousemove(t){return!1}mouseup(t){return!1}keydown(t){return!1}keyup(t){return!1}setReferency(t,s){this.objectLink=t,this.val=s}display(t){t=t||!1,this.s[0].display=t?this.useFlex?"flex":"block":"none"}open(){this.isOpen||(this.isOpen=!0,this.openCallback&&this.openCallback())}close(){this.isOpen&&(this.isOpen=!1,this.closeCallback&&this.closeCallback())}needZone(){i.needReZone=!0}rezone(){i.needReZone=!0}select(){}unselect(){}setInput(t){i.setInput(t,this)}upInput(t,s){return i.upInput(t,s)}selected(t){this.isSelect=t||!1}}class r extends n{constructor(t={}){super(t),this.value=t.value||!1,this.model=void 0!==t.mode?t.mode:0,this.onName=t.rename||this.txt,t.onName&&(t.onname=t.onName),t.onname&&(this.onName=t.onname),this.inh=t.inh||Math.floor(.8*this.h),this.inw=t.inw||36;let s=this.colors;if(0===this.model){let t=Math.floor(.5*this.h)-.5*(this.inh-2);this.c[2]=this.dom("div",this.css.basic+"background:"+s.inputBg+"; height:"+(this.inh-2)+"px; width:"+this.inw+"px; top:"+t+"px; border-radius:10px; border:2px solid "+s.back),this.c[3]=this.dom("div",this.css.basic+"height:"+(this.inh-6)+"px; width:16px; top:"+(t+2)+"px; border-radius:10px; background:"+s.button+";")}else this.p=0,void 0!==this.c[1]&&(this.c[1].textContent=""),this.c[2]=this.dom("div",this.css.txt+this.css.button+"top:1px; background:"+s.button+"; height:"+(this.h-2)+"px; border:1px solid "+s.border+"; border-radius:"+this.radius+"px;");this.stat=-1,this.init(),this.update()}mousedown(t){return this.value=!this.value,this.update(!0),this.mousemove(t)}mousemove(t){return this.cursor("pointer"),this.mode(!0)}reset(){return this.cursor(),this.mode()}mode(t){let s,i,e,h=!1,o=this.colors,n=this.value;if(e=t?n?4:3:n?2:1,this.stat!==e){if(this.stat=e,0!==this.model){switch(s=this.s[2],e){case 1:s.color=o.text,s.background=o.button;break;case 2:s.color=o.textSelect,s.background=o.select;break;case 3:s.color=o.textOver,s.background=o.overoff;break;case 4:s.color=o.textOver,s.background=o.over}this.c[2].innerHTML=n?this.onName:this.name}else{switch(s=this.s[2],i=this.s[3],e){case 1:s.background=s.borderColor=o.back,i.background=o.button;break;case 2:s.background=s.borderColor=o.select,i.background=o.button;break;case 3:s.background=s.borderColor=o.back,i.background=o.overoff;break;case 4:s.background=s.borderColor=o.select,i.background=o.over}this.s[3].marginLeft=n?"17px":"2px",this.c[1].textContent=n?this.onName:this.name}h=!0}return h}update(t){this.mode(),t&&this.send()}rSize(){super.rSize();let t=this.s,s=this.w-10-this.inw;0===this.model?(t[2].left=s+"px",t[3].left=s+"px"):(t[2].left=this.sa+"px",t[2].width=this.w-20+"px")}}class l extends n{constructor(t={}){super(t),this.value=t.value||"",this.values=t.value||this.txt,t.values&&(this.values=t.values),this.onName=t.onName||"",this.on=!1,this.customSize=t.forceWidth||-1,"string"==typeof this.values&&(this.values=[this.values]),this.isDown=!1,this.neverlock=!0,this.isLoadButton=t.loader||!1,this.isDragButton=t.drag||!1,this.res=0,this.isDragButton&&(this.isLoadButton=!0),this.lng=this.values.length,this.tmp=[],this.stat=[];let s,i=this.colors;for(let t=0;t<this.lng;t++)s=!1,this.values[t]===this.value&&this.isSelectable&&(s=!0),this.c[t+2]=this.dom("div",this.css.txt+this.css.button+"top:1px; height:"+(this.h-2)+"px; border:"+i.borderSize+"px solid "+i.border+"; border-radius:"+this.radius+"px;"),this.c[t+2].style.background=s?i.select:i.button,this.c[t+2].style.color=s?i.textSelect:i.text,this.c[t+2].innerHTML=this.values[t],this.stat[t]=s?3:1;t.value&&t.values?this.txt||(this.p=0):(void 0!==this.c[1]&&(this.c[1].textContent=""),this.p=void 0!==t.p?t.p:0),this.isLoadButton&&this.initLoader(),this.isDragButton&&(this.lng++,this.initDrager()),""!==this.onName&&(this.values[0]=this.on),this.init()}onOff(){this.on=!this.on,this.c[2].innerHTML=this.on?this.onName:this.txt}testZone(t){let s=this.local;if(-1===s.x&&-1===s.y)return-1;let i=this.lng,e=this.tmp;for(;i--;)if(s.x>e[i][0]&&s.x<e[i][2])return i;return-1}mouseup(t){return!!this.isDown&&(this.isDown=!1,-1!==this.res&&(this.value===this.values[this.res]&&this.unselectable?this.value="":this.value=this.values[this.res],this.isLoadButton||this.send()),this.mousemove(t))}mousedown(t){return!this.isDown&&(this.isDown=!0,this.mousemove(t))}mousemove(t){let s=!1;return this.res=this.testZone(t),-1!==this.res?(this.cursor("pointer"),s=this.modes(this.isDown?3:2,this.res)):s=this.reset(),s}modes(t=1,s=-1){let i,e,h=this.lng,o=!1;for(;h--;)e=t,i=!!this.isSelectable&&this.values[h]===this.value,h===s?i&&2===e&&(e=3):(e=1,i&&(e=4)),o=this.mode(e,h);return o}mode(t,s){let i=!1,e=this.colors,h=this.s,o=s+2;if(this.stat[s]!==t){switch(this.stat[s]=t,t){case 1:h[o].color=e.text,h[o].background=e.button;break;case 2:h[o].color=e.textOver,h[o].background=e.overoff;break;case 3:h[o].color=e.textOver,h[o].background=e.over;break;case 4:h[o].color=e.textSelect,h[o].background=e.select}i=!0}return i}reset(){return this.res=-1,this.cursor(),this.modes()}dragover(t){t.preventDefault(),this.s[4].borderColor=this.colors.select,this.s[4].color=this.colors.select}dragend(t){t.preventDefault(),this.s[4].borderColor=this.color.text,this.s[4].color=this.color.text}drop(t){t.preventDefault(),this.dragend(t),this.fileSelect(t.dataTransfer.files[0])}initDrager(){this.c[4]=this.dom("div",this.css.txt+" text-align:center; line-height:"+(this.h-8)+"px; border:1px dashed "+this.color.text+"; top:2px;\theight:"+(this.h-4)+"px; border-radius:"+this.radius+"px; pointer-events:auto;"),this.c[4].textContent="DRAG",this.c[4].addEventListener("dragover",function(t){this.dragover(t)}.bind(this),!1),this.c[4].addEventListener("dragend",function(t){this.dragend(t)}.bind(this),!1),this.c[4].addEventListener("dragleave",function(t){this.dragend(t)}.bind(this),!1),this.c[4].addEventListener("drop",function(t){this.drop(t)}.bind(this),!1)}initLoader(){this.c[3]=this.dom("input",this.css.basic+"top:0px; opacity:0; height:"+this.h+"px; pointer-events:auto; cursor:pointer;"),this.c[3].name="loader",this.c[3].type="file",this.c[3].addEventListener("change",function(t){this.fileSelect(t.target.files[0])}.bind(this),!1)}fileSelect(t){if(void 0===t)return;let s=new FileReader,i=t.name,e=i.substring(i.lastIndexOf(".")+1,i.length);-1!==["png","jpg","mp4","webm","ogg"].indexOf(e)?s.readAsDataURL(t):-1!==["sea","z","hex","bvh","BVH","glb"].indexOf(e)?s.readAsArrayBuffer(t):s.readAsText(t),s.onload=function(t){this.callback&&this.callback(t.target.result,i,e)}.bind(this)}label(t,s){s=s||2,this.c[s].textContent=t}icon(t,s=0,i=2){return this.s[i].padding=s+"px 0px",this.c[i].innerHTML=t,this}rSize(){super.rSize();let t=this.s,s=this.sb,i=this.sa,e=this.lng,h=Math.floor((s-3*(e-1))/e);for(-1!==this.customSize&&(h=this.customSize);e--;)this.tmp[e]=[Math.floor(i+h*e+3*e),h],this.tmp[e][2]=this.tmp[e][0]+this.tmp[e][1],t[e+2].left=this.tmp[e][0]+"px",t[e+2].width=this.tmp[e][1]+"px";this.isDragButton&&(t[4].left=i+h+3+"px",t[4].width=h+"px"),this.isLoadButton&&(t[3].left=i+"px",t[3].width=h+"px")}}class a extends n{constructor(t={}){super(t),this.isCyclic=t.cyclic||!1,this.model=t.stype||0,void 0!==t.mode&&(this.model=t.mode),this.autoWidth=!1,this.minw=this.w,this.diam=t.diam||this.w,this.setTypeNumber(t),this.twoPi=h.TwoPI,this.pi90=h.pi90,this.offset=new o,this.h=t.h||this.w+10,this.top=0,this.c[0].style.width=this.w+"px",void 0!==this.c[1]&&(this.c[1].style.width="100%",this.c[1].style.justifyContent="center",this.top=10,this.h+=10),this.percent=0,this.cmode=0;let s=this.colors;this.c[2]=this.dom("div",this.css.txt+"justify-content:center; top:"+(this.h-20)+"px; width:100%; color:"+s.text),this.c[3]=this.getCircular(),this.setSvg(this.c[3],"stroke",s.back,0),this.setSvg(this.c[3],"d",this.makePath(),1),this.setSvg(this.c[3],"stroke",s.text,1),this.setSvg(this.c[3],"viewBox","0 0 "+this.diam+" "+this.diam),this.setCss(this.c[3],{width:this.diam,height:this.diam,left:0,top:this.top}),this.init(),this.update()}mode(t){if(this.cmode===t)return!1;let s,i=this.colors;switch(t){case 0:this.s[2].color=i.text,this.setSvg(this.c[3],"stroke",i.back,0),s=this.model>0?h.pack(h.lerpColor(h.unpack(h.ColorLuma(i.text,-.75)),h.unpack(i.text),this.percent)):i.text,this.setSvg(this.c[3],"stroke",s,1);break;case 1:this.s[2].color=i.textOver,this.setSvg(this.c[3],"stroke",i.backoff,0),s=this.model>0?h.pack(h.lerpColor(h.unpack(h.ColorLuma(i.text,-.75)),h.unpack(i.text),this.percent)):i.textOver,this.setSvg(this.c[3],"stroke",s,1)}return this.cmode=t,!0}reset(){this.isDown=!1}testZone(t){let s=this.local;return-1===s.x&&-1===s.y?"":s.y<=this.c[1].offsetHeight?"title":s.y>this.h-this.c[2].offsetHeight?"text":"circular"}mouseup(t){return this.isDown=!1,this.sendEnd(),this.mode(0)}mousedown(t){return this.isDown=!0,this.old=this.value,this.oldr=null,this.mousemove(t),this.mode(1)}mousemove(t){if(!this.isDown)return;let s=this.offset;if(s.x=.5*this.w-(t.clientX-this.zone.x),s.y=.5*this.diam-(t.clientY-this.zone.y-this.top),this.r=s.angle()-this.pi90,this.r=(this.r%this.twoPi+this.twoPi)%this.twoPi,null!==this.oldr){let t=this.r-this.oldr;this.r=Math.abs(t)>Math.PI?this.oldr:this.r,t>6&&(this.r=0),t<-6&&(this.r=this.twoPi)}let i=1/this.twoPi,e=this.r*i,h=this.range*e+this.min-this.old;(h>=this.step||h<=this.step)&&(h=~~(h/this.step),this.value=this.numValue(this.old+h*this.step),this.update(!0),this.old=this.value,this.oldr=this.r)}wheel(t){if("circular"===this.testZone(t)){let s=this.value-this.step*t.delta;return s>this.max?s=this.isCyclic?this.min:this.max:s<this.min&&(s=this.isCyclic?this.max:this.min),this.setValue(s),this.old=s,this.update(!0),!0}return!1}makePath(){let t=40,s=this.percent*this.twoPi-.001,i=t+t*Math.sin(s)+24,e=t-t*Math.cos(s)+24;return"M 64,24 A 40,40 0 "+(s>Math.PI?1:0)+" 1 "+i+","+e}update(t){if(this.c[2].textContent=this.value,this.percent=(this.value-this.min)/this.range,this.setSvg(this.c[3],"d",this.makePath(),1),this.model>0){let t=this.colors,s=h.pack(h.lerpColor(h.unpack(h.ColorLuma(t.text,-.75)),h.unpack(t.text),this.percent));this.setSvg(this.c[3],"stroke",s,1)}t&&this.send()}}class c extends n{constructor(t={}){super(t),this.ctype=t.ctype||"hex",this.wfixe=256,this.cw=this.sb>256?256:this.sb,null!=t.cw&&(this.cw=t.cw),this.side=t.side||"down",this.up="down"===this.side?0:1,this.baseH=this.h,this.offset=new o,this.decal=new o,this.pp=new o,this.c[2]=this.dom("div",this.css.txt+"height:"+(this.h-4)+"px;border-radius:"+this.radius+"px; line-height:"+(this.h-8)+"px;"),this.s[2]=this.c[2].style,this.s[2].textShadow="none",this.up&&(this.s[2].top="auto",this.s[2].bottom="2px"),this.c[3]=this.getColorRing(),this.c[3].style.visibility="hidden",this.hsl=null,this.value="#ffffff",void 0!==t.value&&(t.value instanceof Array?this.value=h.rgbToHex(t.value):isNaN(t.value)?this.value=t.value:this.value=h.hexToHtml(t.value)),this.bcolor=null,this.isDown=!1,this.fistDown=!1,this.notext=t.notext||!1,this.tr=98,this.tsl=Math.sqrt(3)*this.tr,this.hue=0,this.d=256,this.setColor(this.value),this.init(),void 0!==t.open&&this.open()}testZone(t,s){let i=this.local;return-1===i.x&&-1===i.y?"":this.up&&this.isOpen?i.y>this.wfixe?"title":"color":i.y<this.baseH+2?"title":this.isOpen?"color":void 0}mouseup(t){this.isDown=!1,this.d=256}mousedown(t){let s=this.testZone(t.clientX,t.clientY);if("title"===s)return this.isOpen?this.close():this.open(),!0;"color"===s&&(this.isDown=!0,this.fistDown=!0,this.mousemove(t))}mousemove(t){let s,i,e,o,n,r,l,a,c,d=this.testZone(t.clientX,t.clientY),u=h;if("title"===d&&this.cursor("pointer"),"color"===d&&(s=this.offset,s.x=t.clientX-(this.zone.x+this.decal.x+this.mid),s.y=t.clientY-(this.zone.y+this.decal.y+this.mid),i=s.length()*this.ratio,c=s.angle(),c<0&&(c+=2*u.PI),i<128?this.cursor("crosshair"):this.isDown||this.cursor(),this.isDown&&(this.fistDown&&(this.d=i,this.fistDown=!1),this.d<128)))if(this.d>this.tr)e=(c+u.pi90)/u.TwoPI,this.hue=(e+1)%1,this.setHSL([(e+1)%1,this.hsl[1],this.hsl[2]]);else{l=s.x*this.ratio,a=s.y*this.ratio;let t=this.hue*u.TwoPI+u.PI;t<0&&(t+=2*u.PI),r=Math.atan2(-a,l),r<0&&(r+=2*u.PI);let i=(r+u.pi90+u.TwoPI+t)%u.TwoPI,e=i%(2/3*u.PI)-u.pi60,h=.5*this.tr,c=Math.tan(e)*h,d=Math.sqrt(l*l+a*a),p=Math.sqrt(h*h+c*c);if(d>p){let s=Math.tan(e)*d,o=Math.atan(s/p);o>u.pi60?o=u.pi60:o<-u.pi60&&(o=-u.pi60),r+=o-e,i=(r+u.pi90+u.TwoPI+t)%u.TwoPI,e=i%(2/3*u.PI)-u.pi60,c=Math.tan(e)*h,d=p=Math.sqrt(h*h+c*c)}n=Math.sin(i)*d/this.tsl+.5;let m=1-2*Math.abs(n-.5);o=(Math.cos(i)*d+this.tr/2)/(1.5*this.tr)/m,o=u.clamp(o,0,1),this.setHSL([this.hsl[0],o,n])}}setHeight(){this.h=this.isOpen?this.wfixe+this.baseH+5:this.baseH,this.s[0].height=this.h+"px",this.zone.h=this.h}parentHeight(t){null!==this.group?this.group.calc(t):this.isUI&&this.main.calc(t)}open(){super.open(),this.setHeight(),this.up&&(this.zone.y-=this.wfixe+5);let t=this.h-this.baseH;this.s[3].visibility="visible",this.parentHeight(t)}close(){super.close(),this.up&&(this.zone.y+=this.wfixe+5);let t=this.h-this.baseH;this.setHeight(),this.s[3].visibility="hidden",this.parentHeight(-t)}update(t){let s=h.rgbToHex(h.hslToRgb([this.hsl[0],1,.5]));this.moveMarkers(),this.value=this.bcolor,this.setSvg(this.c[3],"fill",s,2,0),this.s[2].background=this.bcolor,this.notext||(this.c[2].textContent=h.htmlToHex(this.bcolor)),this.invert=h.findDeepInver(this.rgb),this.s[2].color=this.invert?"#fff":"#000",t&&("array"===this.ctype&&this.send(this.rgb),"rgb"===this.ctype&&this.send(h.htmlRgb(this.rgb)),"hex"===this.ctype&&this.send(h.htmlToHex(this.value)),"html"===this.ctype&&this.send())}setValue(t){t instanceof Array?this.value=h.rgbToHex(t):isNaN(t)?this.value=t:this.value=h.hexToHtml(t),this.setColor(this.value),this.update()}setColor(t){let s=h.unpack(t);return this.bcolor!==t&&s&&(this.bcolor=t,this.rgb=s,this.hsl=h.rgbToHsl(this.rgb),this.hue=this.hsl[0],this.update()),this}setHSL(t){return this.hsl=t,this.rgb=h.hslToRgb(t),this.bcolor=h.rgbToHex(this.rgb),this.update(!0),this}moveMarkers(){let t=this.pp,s=h;this.invert;let i=this.hsl[0]*s.TwoPI,e=2/3*s.PI,o=this.tr,n=this.hsl[0],r=this.hsl[1],l=this.hsl[2],a=(i-s.pi90)*s.todeg;n=-i+s.pi90;let c=Math.cos(n)*o,d=-Math.sin(n)*o,u=Math.cos(n-e)*o,p=-Math.sin(n-e)*o,m=Math.cos(n+e)*o,g=-Math.sin(n+e)*o,x=(u+m)/2,v=(p+g)/2;i=(1-2*Math.abs(l-.5))*r;let f=u+(m-u)*l+(c-x)*i,b=p+(g-p)*l+(d-v)*i;t.set(f,b).addScalar(128),this.setSvg(this.c[3],"transform","rotate("+a+" )",2),this.setSvg(this.c[3],"cx",t.x,3),this.setSvg(this.c[3],"cy",t.y,3),this.setSvg(this.c[3],"stroke",this.invert?"#fff":"#000",2,3),this.setSvg(this.c[3],"stroke",this.invert?"#fff":"#000",3),this.setSvg(this.c[3],"fill",this.bcolor,3)}rSize(){super.rSize();let t=this.s;t[2].width=this.sb+"px",t[2].left=this.sa+"px",this.rSizeColor(this.cw),this.decal.x=Math.floor(.5*(this.w-this.wfixe))}rSizeColor(t){if(t===this.wfixe)return;this.wfixe=t;let s=this.s;this.decal.y="up"===this.side?2:this.baseH+2,this.mid=Math.floor(.5*this.wfixe),this.setSvg(this.c[3],"viewBox","0 0 "+this.wfixe+" "+this.wfixe),s[3].width=this.wfixe+"px",s[3].height=this.wfixe+"px",s[3].top=this.decal.y+"px",this.ratio=256/this.wfixe,this.square=1/(this.wfixe/256*60),this.setHeight()}}class d extends n{constructor(t={}){super(t),this.round=Math.round,this.baseH=this.h,this.hplus=t.hplus||50,this.res=t.res||40,this.l=1,this.precision=t.precision||0,this.custom=t.custom||!1,this.names=t.names||["FPS","MS"];let s=t.cc||["220,220,220","255,255,0"];this.adding=t.adding||!1,this.range=t.range||[165,100,100],this.alpha=t.alpha||.25,this.values=[],this.points=[],this.textDisplay=[],this.custom||(this.now=i.getTime(),this.startTime=0,this.prevTime=0,this.frames=0,this.ms=0,this.fps=0,this.mem=0,this.mm=0,this.isMem=!(!self.performance||!self.performance.memory),this.isMem&&(this.names.push("MEM"),s.push("0,255,255")),this.txt=t.name||"Fps");let e=Math.floor(.5*this.h)-6;this.c[1].textContent=this.txt,this.c[0].style.cursor="pointer",this.c[0].style.pointerEvents="auto";let h="display:none; left:10px; top:"+this.h+"px; height:"+(this.hplus-8)+"px; box-sizing:border-box; background: rgba(0, 0, 0, 0.2); border:1px solid "+this.colors.border+";";0!==this.radius&&(h+="border-radius:"+this.radius+"px;"),this.c[2]=this.dom("path",this.css.basic+h,{}),this.c[2].setAttribute("viewBox","0 0 "+this.res+" 50"),this.c[2].setAttribute("height","100%"),this.c[2].setAttribute("width","100%"),this.c[2].setAttribute("preserveAspectRatio","none"),this.c[3]=this.dom("path",this.css.basic+"position:absolute; width:10px; height:10px; left:4px; top:"+e+"px;",{d:this.svgs.arrow,fill:this.colors.text,stroke:"none"}),this.c[4]=this.dom("div",this.css.txt+"position:absolute; left:10px; top:"+(this.h+2)+"px; display:none; width:100%; text-align:center;"),t.bottomLine&&(this.c[4]=this.dom("div",this.css.basic+"width:100%; bottom:0px; height:1px; background: rgba(255, 255, 255, 0.2);")),this.isShow=!1;let o=this.s;o[1].marginLeft="10px",o[1].lineHeight=this.h-4,o[1].color=this.colors.text,o[1].fontWeight="bold",0!==this.radius&&(o[0].borderRadius=this.radius+"px"),"none"!==this.colors.gborder&&(o[0].border="1px solid "+this.colors.gborder);let n=0;for(n=0;n<this.names.length;n++){let t=[],i=this.res+1;for(;i--;)t.push(50);this.range[n]=1/this.range[n]*49,this.points.push(t),this.values.push(0),this.textDisplay.push("<span style='color:rgb("+s[n]+")'> "+this.names[n]+" ")}for(n=this.names.length;n--;)this.dom("path",null,{fill:"rgba("+s[n]+","+this.alpha+")","stroke-width":1,stroke:"rgba("+s[n]+",1)","vector-effect":"non-scaling-stroke"},this.c[2]);this.init()}mousedown(t){this.isShow?this.close():this.open()}tick(t){this.values=t,this.isShow&&(this.drawGraph(),this.upText())}makePath(t){let s="";s+="M -1 50";for(let i=0;i<this.res+1;i++)s+=" L "+i+" "+t[i];return s+=" L "+(this.res+1)+" 50",s}upText(t){let s=t||this.values,i="";for(let t=0,e=this.names.length;t<e;t++)i+=this.textDisplay[t]+s[t].toFixed(this.precision)+"</span>";this.c[4].innerHTML=i}drawGraph(){let t,s=this.c[2],i=this.names.length,e=0,h=0;for(;i--;)t=this.adding?(this.values[h]+e)*this.range[h]:this.values[h]*this.range[h],this.points[h].shift(),this.points[h].push(50-t),this.setSvg(s,"d",this.makePath(this.points[h]),i+1),e+=this.values[h],h++}open(){super.open(),this.h=this.hplus+this.baseH,this.setSvg(this.c[3],"d",this.svgs.arrowDown),null!==this.group?this.group.calc(this.hplus):this.isUI&&this.main.calc(this.hplus),this.s[0].height=this.h+"px",this.s[2].display="block",this.s[4].display="block",this.isShow=!0,this.custom||i.addListen(this)}close(){super.close(),this.h=this.baseH,this.setSvg(this.c[3],"d",this.svgs.arrow),null!==this.group?this.group.calc(-this.hplus):this.isUI&&this.main.calc(-this.hplus),this.s[0].height=this.h+"px",this.s[2].display="none",this.s[4].display="none",this.isShow=!1,this.custom||i.removeListen(this),this.c[4].innerHTML=""}begin(){this.startTime=this.now()}end(){let t=this.now();if(this.ms=t-this.startTime,this.frames++,t>this.prevTime+1e3&&(this.fps=this.round(1e3*this.frames/(t-this.prevTime)),this.prevTime=t,this.frames=0,this.isMem)){let t=performance.memory.usedJSHeapSize,s=performance.memory.jsHeapSizeLimit;this.mem=this.round(954e-9*t),this.mm=t/s}return this.values=[this.fps,this.ms,this.mm],this.drawGraph(),this.upText([this.fps,this.ms,this.mem]),t}listening(){this.custom||(this.startTime=this.end())}rSize(){let t=this.s,s=this.w;t[0].width=s+"px",t[1].width=s+"px",t[2].left="10px",t[2].width=s-20+"px",t[4].width=s-20+"px"}}class u extends n{constructor(t={}){super(t),this.value=void 0!==t.value?t.value:[0,0,0],this.lng=this.value.length,this.precision=void 0!==t.precision?t.precision:2,this.multiplicator=t.multiplicator||1,this.neg=t.neg||!1,this.line=void 0===t.line||t.line,this.autoWidth=void 0===t.autoWidth||t.autoWidth,this.isNumber=!1,this.isDown=!1,this.h=t.h||138,this.rh=this.h-10,this.top=0,this.c[0].style.width=this.w+"px",void 0!==this.c[1]&&(this.c[1].style.width=this.w+"px",this.autoWidth||(this.c[1].style.width="100%",this.c[1].style.justifyContent="center"),this.top=10,this.h+=10),this.gh=this.rh-28,this.gw=this.w-28,this.c[2]=this.dom("div",this.css.txt+"display:block; text-align:center; padding:0px 0px; top:"+(this.h-20)+"px; left:14px; width:"+this.gw+"px;\tcolor:"+this.colors.text),this.c[2].innerHTML=this.valueToHtml();let s=this.dom("svg",this.css.basic,{viewBox:"0 0 "+this.w+" "+this.rh,width:this.w,height:this.rh,preserveAspectRatio:"none"});this.setCss(s,{width:this.w,height:this.rh,left:0,top:this.top}),this.dom("path","",{d:"",stroke:this.colors.text,"stroke-width":2,fill:"none","stroke-linecap":"butt"},s),this.dom("rect","",{x:10,y:10,width:this.gw+8,height:this.gh+8,stroke:"rgba(0,0,0,0.3)","stroke-width":1,fill:"none"},s),this.iw=(this.gw-4*(this.lng-1))/this.lng;let i=[];this.cMode=[],this.v=[];for(let t=0;t<this.lng;t++)i[t]=[14+t*this.iw+4*t,this.iw],i[t][2]=i[t][0]+i[t][1],this.cMode[t]=0,this.neg?this.v[t]=.5*(1+this.value[t]/this.multiplicator):this.v[t]=this.value[t]/this.multiplicator,this.dom("rect","",{x:i[t][0],y:14,width:i[t][1],height:1,fill:this.colors.text,"fill-opacity":.3},s);this.tmp=i,this.c[3]=s,this.init(),void 0!==this.c[1]&&(this.c[1].style.top="0px",this.c[1].style.height="20px",this.s[1].lineHeight="15px"),this.update(!1)}setValue(t){this.value=t,this.lng=this.value.length;for(var s=0;s<this.lng;s++)this.neg?this.v[s]=.5*(1+t[s]/this.multiplicator):this.v[s]=t[s]/this.multiplicator;this.update()}valueToHtml(){let t=this.lng,s=0,i='<table style="width:100%;"><tr>',e="width:"+100/this.lng+"%;";for(;t--;)s===this.lng-1?i+="<td style="+e+">"+this.value[s]+"</td></tr></table>":i+="<td style="+e+">"+this.value[s]+"</td>",s++;return i}updateSVG(){this.line&&this.setSvg(this.c[3],"d",this.makePath(),0);for(let t=0;t<this.lng;t++)this.setSvg(this.c[3],"height",this.v[t]*this.gh,t+2),this.setSvg(this.c[3],"y",this.gh-this.v[t]*this.gh+14,t+2),this.neg?this.value[t]=1*((2*this.v[t]-1)*this.multiplicator).toFixed(this.precision):this.value[t]=1*(this.v[t]*this.multiplicator).toFixed(this.precision);this.c[2].innerHTML=this.valueToHtml()}testZone(t){let s=this.local;if(-1===s.x&&-1===s.y)return"";let i=this.lng,e=this.tmp;if(s.y>this.top&&s.y<this.h-20)for(;i--;)if(s.x>e[i][0]&&s.x<e[i][2])return i;return""}mode(t,s){if(t===this.cMode[s])return!1;let i;switch(t){case 0:i=.3;break;case 1:i=.6;break;case 2:i=1}return this.reset(),this.setSvg(this.c[3],"fill-opacity",i,s+2),this.cMode[s]=t,!0}reset(){let t=!1,s=this.lng;for(;s--;)0!==this.cMode[s]&&(this.cMode[s]=0,this.setSvg(this.c[3],"fill-opacity",.3,s+2),t=!0);return t}mouseup(t){if(this.isDown=!1,-1!==this.current)return this.reset()}mousedown(t){return this.isDown=!0,this.mousemove(t)}mousemove(t){let s=!1,i=this.testZone(t);return""===i?s=this.reset():(s=this.mode(this.isDown?2:1,i),this.isDown&&(this.v[i]=this.clamp(1-(t.clientY-this.zone.y-this.top-10)/this.gh,0,1),this.update(!0))),s}update(t){this.updateSVG(),t&&this.send()}makePath(){let t,s,i,e,h,o,n="";for(let r=0;r<this.lng;r++)t=this.gh-this.v[r]*this.gh+14,s=14+r*this.iw+4*r,e=s+.5*this.iw,i=s+this.iw,n+=0===r?"M "+s+" "+t+" T "+e+" "+t:" C "+h+" "+o+","+s+" "+t+","+e+" "+t,r===this.lng-1&&(n+=" T "+i+" "+t),h=i,o=t;return n}rSize(){super.rSize();let t=this.s;void 0!==this.c[1]&&(t[1].width=this.w+"px"),t[3].width=this.w+"px";let s=this.w-28,i=(s-4*(this.lng-1))/this.lng,e=[];t[2].width=s+"px";for(let t=0;t<this.lng;t++)e[t]=[14+t*i+4*t,i],e[t][2]=e[t][0]+e[t][1];this.tmp=e}}class p extends n{constructor(t={}){super(t),this.isGroup=!0,this.ADD=t.add,this.uis=[],this.isEmpty=!0,this.autoHeight=!0,this.current=-1,this.targetIn=null,this.decal=0,this.baseH=this.h;let s=Math.floor(.5*this.h)-6;this.isLine=void 0!==t.line&&t.line,this.decal=0,t.group&&(this.decal=t.group.decal?t.group.decal:0,this.decal+=6),this.useFlex=!0;let i=this.useFlex?"display:flex; flex-flow: row wrap;":"";this.c[2]=this.dom("div",this.css.basic+i+"width:100%; left:0; height:auto; overflow:hidden; top:"+this.h+"px"),this.c[3]=this.dom("path",this.css.basic+"position:absolute; width:10px; height:10px; left:0; top:"+s+"px;",{d:this.svgs.group,fill:this.colors.text,stroke:"none"}),this.c[4]=this.dom("path",this.css.basic+"position:absolute; width:10px; height:10px; left:"+(4+this.decal)+"px; top:"+s+"px;",{d:this.svgs.arrow,fill:this.colors.text,stroke:"none"}),this.isLine&&(this.c[5]=this.dom("div",this.css.basic+"background:rgba(255, 255, 255, 0.2); width:100%; left:0; height:1px; bottom:0px"));let e=this.s;e[0].height=this.h+"px",e[1].height=this.h+"px",this.c[1].name="group",e[1].marginLeft=10+this.decal+"px",e[1].lineHeight=this.h-4,e[1].color=this.colors.text,e[1].fontWeight="bold",0!==this.radius&&(e[0].borderRadius=this.radius+"px"),this.init(),this.setBG(t.bg),void 0!==t.open&&this.open()}testZone(t){let s=this.local;if(-1===s.x&&-1===s.y)return"";let i="";return s.y<this.baseH?i="title":this.isOpen&&(i="content"),i}clearTarget(){return-1!==this.current&&(this.targetIn.uiout(),this.targetIn.reset(),this.current=-1,this.targetIn=null,this.cursor(),!0)}reset(){this.clearTarget()}handleEvent(t){let s=t.type,e=!1,h=!1,o=this.testZone(t);if(o){switch(o){case"content":this.cursor(),i.isMobile&&"mousedown"===s&&this.getNext(t,e),this.targetIn&&(h=this.targetIn.handleEvent(t)),i.lock||this.getNext(t,e);break;case"title":this.cursor("pointer"),"mousedown"===s&&(this.isOpen?this.close():this.open())}return this.isDown&&(e=!0),h&&(e=!0),e}}getNext(t,s){let e=i.findTarget(this.uis,t);e!==this.current&&(this.clearTarget(),this.current=e),-1!==e&&(this.targetIn=this.uis[this.current],this.targetIn.uiover())}setBG(t){void 0!==t&&(this.colors.background=t),this.c[0].style.background=this.colors.background;let s=this.uis.length;for(;s--;)this.uis[s].setBG(this.colors.background)}add(){let t=arguments;"object"==typeof t[1]?(t[1].isUI=this.isUI,t[1].target=this.c[2],t[1].main=this.main,t[1].group=this):"string"==typeof arguments[1]&&(void 0===t[2]?[].push.call(t,{isUI:!0,target:this.c[2],main:this.main}):(t[2].isUI=!0,t[2].target=this.c[2],t[2].main=this.main,t[2].group=this));let s=this.ADD.apply(this,t);return this.uis.push(s),this.isEmpty=!1,s}remove(t){t.clear&&t.clear()}empty(){this.close();let t,s=this.uis.length;for(;s--;)t=this.uis.pop(),this.c[2].removeChild(t.c[0]),t.clear(!0);this.isEmpty=!0,this.h=this.baseH}clearOne(t){let s=this.uis.indexOf(t);-1!==s&&(this.calc(-(this.uis[s].h+1)),this.c[2].removeChild(this.uis[s].c[0]),this.uis.splice(s,1),0===this.uis.length&&(this.isEmpty=!0,this.close()))}open(){super.open(),this.setSvg(this.c[4],"d",this.svgs.arrowDown),this.rSizeContent(),this.h,this.baseH,this.parentHeight()}close(){super.close(),this.h,this.baseH,this.setSvg(this.c[4],"d",this.svgs.arrow),this.h=this.baseH,this.s[0].height=this.h+"px",this.parentHeight()}clear(){this.empty(),this.isUI&&this.main.calc(-(this.h+1)),n.prototype.clear.call(this)}clearGroup(){this.empty()}calcUis(){this.isOpen?this.h=i.calcUis(this.uis,this.zone,this.zone.y+this.baseH)+this.baseH:this.h=this.baseH,this.s[0].height=this.h+"px"}parentHeight(t){null!==this.group?this.group.calc(t):this.isUI&&this.main.calc(t)}calc(t){this.isOpen&&(this.isUI?this.main.calc():this.calcUis(),this.s[0].height=this.h+"px")}rSizeContent(){let t=this.uis.length;for(;t--;)this.uis[t].setSize(this.w),this.uis[t].rSize()}rSize(){super.rSize();let t=this.s;t[3].left=this.sa+this.sb-17+"px",t[1].width=this.w+"px",t[2].width=this.w+"px",this.isOpen&&this.rSizeContent()}}class m extends n{constructor(t={}){super(t),this.autoWidth=!1,this.value=[0,0],this.minw=this.w,this.diam=t.diam||this.w,this.joyType="analogique",this.model=void 0!==t.mode?t.mode:0,this.precision=t.precision||2,this.multiplicator=t.multiplicator||1,this.pos=new o,this.tmp=new o,this.interval=null,this.distance=.5*this.diam*.25,this.h=t.h||this.w+10,this.top=0,this.c[0].style.width=this.w+"px",void 0!==this.c[1]&&(this.c[1].style.width="100%",this.c[1].style.justifyContent="center",this.top=10,this.h+=10);let s=this.colors;this.c[2]=this.dom("div",this.css.txt+"justify-content:center; top:"+(this.h-20)+"px; width:100%; color:"+s.text),this.c[2].textContent=this.value,this.c[3]=this.getJoystick(this.model),this.setSvg(this.c[3],"viewBox","0 0 "+this.diam+" "+this.diam),this.setCss(this.c[3],{width:this.diam,height:this.diam,left:0,top:this.top}),this.ratio=128/this.w,this.init(),this.update(!1)}mode(t){let s=this.colors;switch(t){case 0:0===this.model?(this.setSvg(this.c[3],"fill","url(#gradIn)",4),this.setSvg(this.c[3],"stroke","#000",4)):(this.setSvg(this.c[3],"stroke","rgba(100,100,100,0.25)",2),this.setSvg(this.c[3],"stroke","#666",4),this.setSvg(this.c[3],"fill","none",4));break;case 1:0===this.model?(this.setSvg(this.c[3],"fill","url(#gradIn2)",4),this.setSvg(this.c[3],"stroke","rgba(0,0,0,0)",4)):(this.setSvg(this.c[3],"stroke","rgba(48,138,255,0.25)",2),this.setSvg(this.c[3],"stroke",s.select,4),this.setSvg(this.c[3],"fill","rgba(48,138,255,0.25)",4))}}addInterval(){null!==this.interval&&this.stopInterval(),this.pos.isZero()||(this.interval=setInterval(function(){this.update()}.bind(this),10))}stopInterval(){null!==this.interval&&(clearInterval(this.interval),this.interval=null)}reset(){this.addInterval(),this.mode(0)}mouseup(t){this.addInterval(),this.isDown=!1}mousedown(t){this.isDown=!0,this.mousemove(t),this.mode(2)}mousemove(t){if(this.mode(1),!this.isDown)return;if(this.tmp.x=.5*this.w-(t.clientX-this.zone.x),this.tmp.y=.5*this.diam-(t.clientY-this.zone.y-this.top),this.tmp.length()>this.distance){let t=Math.atan2(this.tmp.x,this.tmp.y);this.tmp.x=Math.sin(t)*this.distance,this.tmp.y=Math.cos(t)*this.distance}this.pos.copy(this.tmp).divideScalar(this.distance).negate(),this.update()}setValue(t){void 0===t&&(t=[0,0]),this.pos.set(t[0]||0,t[1]||0),this.updateSVG()}update(t){void 0===t&&(t=!0),null!==this.interval&&(this.isDown||(this.pos.lerp(null,.3),this.pos.x=Math.abs(this.pos.x)<.01?0:this.pos.x,this.pos.y=Math.abs(this.pos.y)<.01?0:this.pos.y,this.isUI&&this.main.isCanvas&&this.main.draw())),this.updateSVG(),t&&this.send(),this.pos.isZero()&&this.stopInterval()}updateSVG(){let t=.5*this.diam- -this.pos.x*this.distance,s=.5*this.diam- -this.pos.y*this.distance;if(0===this.model){let i=t+5*this.pos.x+5,e=s+5*this.pos.y+10;this.setSvg(this.c[3],"cx",i*this.ratio,3),this.setSvg(this.c[3],"cy",e*this.ratio,3)}else this.setSvg(this.c[3],"cx",t*this.ratio,3),this.setSvg(this.c[3],"cy",s*this.ratio,3);this.setSvg(this.c[3],"cx",t*this.ratio,4),this.setSvg(this.c[3],"cy",s*this.ratio,4),this.value[0]=1*(this.pos.x*this.multiplicator).toFixed(this.precision),this.value[1]=1*(this.pos.y*this.multiplicator).toFixed(this.precision),this.c[2].textContent=this.value}clear(){this.stopInterval(),super.clear()}}class g extends n{constructor(t={}){super(t),this.isCyclic=t.cyclic||!1,this.model=t.stype||0,void 0!==t.mode&&(this.model=t.mode),this.autoWidth=!1,this.setTypeNumber(t),this.minw=this.w,this.diam=t.diam||this.w,this.mPI=.8*Math.PI,this.toDeg=180/Math.PI,this.cirRange=2*this.mPI,this.offset=new o,this.h=t.h||this.w+10,this.top=0,this.c[0].style.width=this.w+"px",void 0!==this.c[1]&&(this.c[1].style.width="100%",this.c[1].style.justifyContent="center",this.top=10,this.h+=10),this.percent=0,this.cmode=0;let s=this.colors;this.c[2]=this.dom("div",this.css.txt+"justify-content:center; top:"+(this.h-20)+"px; width:100%; color:"+s.text),this.c[3]=this.getKnob(),this.setSvg(this.c[3],"fill",s.button,0),this.setSvg(this.c[3],"stroke",s.text,1),this.setSvg(this.c[3],"stroke",s.text,3),this.setSvg(this.c[3],"d",this.makeGrad(),3),this.setSvg(this.c[3],"viewBox","0 0 "+this.diam+" "+this.diam),this.setCss(this.c[3],{width:this.diam,height:this.diam,left:0,top:this.top}),this.model>0&&(h.dom("path","",{d:"",stroke:s.text,"stroke-width":2,fill:"none","stroke-linecap":"round"},this.c[3]),2==this.model&&(h.addSVGGlowEffect(),this.setSvg(this.c[3],"style",'filter: url("#UILGlow");',4))),this.r=0,this.init(),this.update()}mode(t){let s=this.colors;if(this.cmode===t)return!1;switch(t){case 0:this.s[2].color=s.text,this.setSvg(this.c[3],"fill",s.button,0),this.setSvg(this.c[3],"stroke",s.text,1);break;case 1:this.s[2].color=s.textOver,this.setSvg(this.c[3],"fill",s.select,0),this.setSvg(this.c[3],"stroke",s.textOver,1)}return this.cmode=t,!0}testZone(t){let s=this.local;return-1===s.x&&-1===s.y?"":s.y<=this.c[1].offsetHeight?"title":s.y>this.h-this.c[2].offsetHeight?"text":"knob"}mouseup(t){return this.isDown=!1,this.sendEnd(),this.mode(0)}mousedown(t){return this.isDown=!0,this.old=this.value,this.oldr=null,this.mousemove(t),this.mode(1)}mousemove(t){if(!this.isDown)return;let s=this.offset;s.x=.5*this.w-(t.clientX-this.zone.x),s.y=.5*this.diam-(t.clientY-this.zone.y-this.top),this.r=-Math.atan2(s.x,s.y),null!==this.oldr&&(this.r=Math.abs(this.r-this.oldr)>Math.PI?this.oldr:this.r),this.r=this.r>this.mPI?this.mPI:this.r,this.r=this.r<-this.mPI?-this.mPI:this.r;let i=1/this.cirRange,e=(this.r+this.mPI)*i,h=this.range*e+this.min-this.old;(h>=this.step||h<=this.step)&&(h=Math.floor(h/this.step),this.value=this.numValue(this.old+h*this.step),this.update(!0),this.old=this.value,this.oldr=this.r)}wheel(t){if("knob"===this.testZone(t)){let s=this.value-this.step*t.delta;return s>this.max?s=this.isCyclic?this.min:this.max:s<this.min&&(s=this.isCyclic?this.max:this.min),this.setValue(s),this.old=s,this.update(!0),!0}return!1}makeGrad(){let t,s,i,e,h,o,n,r="",l=64,a=Math.PI+this.mPI,c=Math.PI-this.mPI;this.step>5?(s=this.range/this.step,t=(a-c)/s):(t=(a-c)/l*2,s=32);for(let c=0;c<=s;++c)i=a-t*c,e=l+44*Math.sin(i),h=l+44*Math.cos(i),o=l+40*Math.sin(i),n=l+40*Math.cos(i),r+="M"+e+" "+h+" L"+o+" "+n+" ";return r}update(t){this.c[2].textContent=this.value,this.percent=(this.value-this.min)/this.range;let s=Math.PI+this.mPI,i=this.percent*this.cirRange-this.mPI,e=Math.sin(i),o=Math.cos(i),n=25*e+64,r=-25*o+64,l=20*e+64,a=-20*o+64;if(this.setSvg(this.c[3],"d","M "+n+" "+r+" L "+l+" "+a,1),this.model>0){let t=36*Math.sin(s)+64,n=36*Math.cos(s)+64,r=36*e+64,l=-36*o+64,a=i<=Math.PI-this.mPI?0:1;this.setSvg(this.c[3],"d","M "+t+","+n+" A 36,36 1 "+a+" 1 "+r+","+l,4);let c=h.pack(h.lerpColor(h.unpack(h.ColorLuma(this.colors.text,-.75)),h.unpack(this.colors.text),this.percent));this.setSvg(this.c[3],"stroke",c,4)}t&&this.send()}}class x extends n{constructor(t={}){super(t),this.path=t.path||"",this.format=t.format||"",this.isWithImage=""!==this.path,this.preLoadComplete=!1,this.tmpImage={},this.tmpUrl=[];let s=t.align||"center",i=t.scrollSize||10;this.ss=i+1,this.sMode=0,this.tMode=0,this.listOnly=t.listOnly||!1,this.staticTop=t.staticTop||!1,this.isSelectable=this.listOnly,void 0!==t.select&&(t.selectable=t.select),void 0!==t.selectable&&(this.isSelectable=t.selectable),""===this.txt&&(this.p=0);let e=Math.floor(.5*this.h)-5,h=this.colors;if(this.c[2]=this.dom("div",this.css.basic+"top:0; display:none; border-radius:"+this.radius+"px;"),this.c[3]=this.dom("div",this.css.item+"position:absolute; text-align:"+s+"; line-height:"+(this.h-4)+"px; top:1px; background:"+h.button+"; height:"+(this.h-2)+"px; border:1px solid "+h.border+"; border-radius:"+this.radius+"px;"),this.c[4]=this.dom("path",this.css.basic+"position:absolute; width:10px; height:10px; top:"+e+"px;",{d:this.svgs.arrow,fill:h.text,stroke:"none"}),this.scrollerBack=this.dom("div",this.css.basic+"right:0px; width:"+i+"px; background:"+h.back+"; display:none;"),this.scroller=this.dom("div",this.css.basic+"right:"+.5*(i-.25*i)+"px; width:"+.25*i+"px; background:"+h.text+"; display:none; "),this.c[3].style.color=h.text,this.list=[],this.refObject=null,t.list)if(t.list instanceof Array)this.list=t.list;else{this.refObject=t.list;for(let t in this.refObject)this.list.push(t)}this.items=[],this.prevName="",this.baseH=this.h,this.itemHeight=t.itemHeight||this.h-3,this.full=t.full||!1,this.py=0,this.ww=this.sb,this.scroll=!1,this.isDown=!1,this.current=null,this.side=t.side||"down",this.up="down"===this.side?0:1,this.up?(this.c[2].style.top="auto",this.c[3].style.top="auto",this.c[4].style.top="auto",this.c[2].style.bottom=this.h-2+"px",this.c[3].style.bottom="1px",this.c[4].style.bottom=e+"px"):this.c[2].style.top=this.baseH+"px",this.listIn=this.dom("div",this.css.basic+"left:0; top:0; width:100%; background:none;"),this.listIn.name="list",this.topList=0,this.c[2].appendChild(this.listIn),this.c[2].appendChild(this.scrollerBack),this.c[2].appendChild(this.scroller),void 0!==t.value?isNaN(t.value)?this.value=t.value:this.value=this.list[t.value]:this.value=this.list[0],this.isOpenOnStart=t.open||!1,this.listOnly&&(this.baseH=5,this.c[3].style.display="none",this.c[4].style.display="none",this.c[2].style.top=this.baseH+"px",this.isOpenOnStart=!0),this.miniCanvas=t.miniCanvas||!1,this.canvasBg=t.canvasBg||"rgba(0,0,0,0)",this.imageSize=t.imageSize||[20,20],this.drag=t.drag||!1,this.dragout=t.dragout||!1,this.dragstart=t.dragstart||null,this.dragend=t.dragend||null,this.isWithImage&&this.preloadImage(),this.setList(this.list),this.init(),this.isOpenOnStart&&this.open(!0)}preloadImage(){this.preLoadComplete=!1,this.tmpImage={};for(let t=0;t<this.list.length;t++)this.tmpUrl.push(this.list[t]);this.loadOne()}nextImg(){this.tmpUrl.shift(),0===this.tmpUrl.length?(this.preLoadComplete=!0,this.addImages()):this.loadOne()}loadOne(){let t=this,s=this.tmpUrl[0],i=document.createElement("img");i.style.cssText="position:absolute; width:"+t.imageSize[0]+"px; height:"+t.imageSize[1]+"px",i.setAttribute("src",this.path+s+this.format),i.addEventListener("load",(function(){t.imageSize[2]=i.width,t.imageSize[3]=i.height,t.tmpImage[s]=i,t.nextImg()}))}testZone(t){let s=this.local;if(-1===s.x&&-1===s.y)return"";if(this.up&&this.isOpen){if(s.y>this.h-this.baseH)return"title";if(this.scroll&&s.x>this.sa+this.sb-this.ss)return"scroll";if(s.x>this.sa)return this.testItems(s.y-this.baseH)}else{if(s.y<this.baseH+2)return"title";if(this.isOpen){if(this.scroll&&s.x>this.sa+this.sb-this.ss)return"scroll";if(s.x>this.sa)return this.testItems(s.y-this.baseH)}}return""}testItems(t){let s,i,e,h="",o=this.items.length;for(;o--;)if(s=this.items[o],i=s.posy+this.topList,e=s.posy+this.itemHeight+1+this.topList,t>=i&&t<=e)return h="item"+o,this.modeItem(0),this.current=s,this.modeItem(1),h;return h}modeItem(t){if(!this.current)return;this.current.select&&0===t&&(t=2);let s=this.colors;switch(t){case 0:this.current.style.background=s.back,this.current.style.color=s.text;break;case 1:this.current.style.background=s.over,this.current.style.color=s.textOver;break;case 2:this.current.style.background=s.select,this.current.style.color=s.textSelect}}unSelected(){this.current&&(this.modeItem(0),this.current=null)}selected(){this.current&&(this.resetItems(),this.modeItem(2),this.current.select=!0)}resetItems(){let t=this.items.length;for(;t--;)this.items[t].select=!1,this.items[t].style.background=this.colors.back,this.items[t].style.color=this.colors.text}mouseup(t){this.isDown=!1}mousedown(t){let s=this.testZone(t);return!!s&&("scroll"===s?(this.isDown=!0,this.mousemove(t)):"title"===s?(this.modeTitle(2),this.listOnly||(this.isOpen?this.close():this.open())):this.current&&(this.value=this.list[this.current.id],this.isSelectable&&this.selected(),this.send(null!==this.refObject?this.refObject[this.list[this.current.id]]:this.value),this.listOnly||(this.close(),this.setTopItem())),!0)}mousemove(t){let s=!1,i=this.testZone(t);if(!i)return s;if("title"===i)this.unSelected(),this.modeTitle(1),this.cursor("pointer");else if("scroll"===i){if(this.cursor("s-resize"),this.modeScroll(1),this.isDown){this.modeScroll(2);let s=this.zone.y+this.baseH-2;this.update(t.clientY-s-.5*this.sh)}}else this.modeTitle(0),this.modeScroll(0),this.cursor("pointer");return i!==this.prevName&&(s=!0),this.prevName=i,s}wheel(t){return"title"!==this.testZone(t)&&(this.py+=10*t.delta,this.update(this.py),!0)}reset(){this.prevName="",this.unSelected(),this.modeTitle(0),this.modeScroll(0)}modeScroll(t){if(t===this.sMode)return;let s=this.scroller.style,i=this.colors;switch(t){case 0:s.background=i.text;break;case 1:case 2:s.background=i.select}this.sMode=t}modeTitle(t){if(t===this.tMode)return;let s=this.s,i=this.colors;switch(t){case 0:s[3].color=i.text,s[3].background=i.button;break;case 1:s[3].color=i.textOver,s[3].background=i.overoff;break;case 2:s[3].color=i.textSelect,s[3].background=i.overoff}this.tMode=t}clearList(){for(;this.listIn.children.length;)this.listIn.removeChild(this.listIn.lastChild);this.items=[]}setList(t){let s,e;this.clearList(),this.list=t,this.length=this.list.length,this.maxItem=this.full?this.length:5,this.maxItem=this.length<this.maxItem?this.length:this.maxItem,this.maxHeight=this.maxItem*(this.itemHeight+1)+2,this.max=this.length*(this.itemHeight+1)+2,this.ratio=this.maxHeight/this.max,this.sh=this.maxHeight*this.ratio,this.range=this.maxHeight-this.sh,this.c[2].style.height=this.maxHeight+"px",this.scrollerBack.style.height=this.maxHeight+"px",this.scroller.style.height=this.sh+"px",this.max>this.maxHeight&&(this.ww=this.sb-this.ss,this.scroll=!0),this.miniCanvas&&(this.tmpCanvas=document.createElement("canvas"),this.tmpCanvas.width=this.imageSize[0],this.tmpCanvas.height=this.imageSize[1],this.tmpCtx=this.tmpCanvas.getContext("2d"),this.tmpCtx.fillStyle=this.canvasBg,this.tmpCtx.fillRect(0,0,this.imageSize[0],this.imageSize[1]));for(let t=0;t<this.length;t++){if(e=this.list[t],s=this.dom("div",this.css.item+"width:"+this.ww+"px; height:"+this.itemHeight+"px; line-height:"+(this.itemHeight-5)+"px; color:"+this.colors.text+"; background:"+this.colors.back+";"),s.name="item"+t,s.id=t,s.select=!1,s.posy=(this.itemHeight+1)*t,this.listIn.appendChild(s),this.items.push(s),e===this.value&&(this.current=s),this.isWithImage||(s.textContent=e),this.miniCanvas){let t=new Image;t.src=this.tmpCanvas.toDataURL(),t.style.cssText="position:relative; pointer-events:none; display:inline-block; float:left; margin-left:0px; margin-right:5px; top:2px",s.appendChild(t),this.tmpImage[e]=t}this.dragout&&(s.img=this.tmpImage[e],s.style.pointerEvents="auto",s.draggable="true",s.addEventListener("dragstart",this.dragstart||function(){}),s.addEventListener("drag",this.drag||function(){}),s.addEventListener("dragleave",(function(){i.fakeUp()})),s.addEventListener("dragend",this.dragend||function(){}.bind(this)))}this.setTopItem(),this.isSelectable&&this.selected()}drawImage(t,s,i,e,h,o){this.tmpCtx.clearRect(0,0,this.imageSize[0],this.imageSize[1]),this.tmpCtx.drawImage(s,i,e,h,o,0,0,this.imageSize[0],this.imageSize[1]),this.tmpImage[t].src=this.tmpCanvas.toDataURL()}addImages(){let t=this.list.length;for(let s=0;s<t;s++)this.items[s].appendChild(this.tmpImage[this.list[s]]);this.setTopItem()}setValue(t){isNaN(t)?this.value=t:this.value=this.list[t],this.setTopItem()}setTopItem(){if(!this.staticTop){if(this.isWithImage){if(!this.preLoadComplete)return;this.c[3].children.length||(this.canvas=document.createElement("canvas"),this.canvas.width=this.imageSize[0],this.canvas.height=this.imageSize[1],this.canvas.style.cssText="position:absolute; top:0px; left:0px;",this.ctx=this.canvas.getContext("2d"),this.c[3].appendChild(this.canvas)),this.tmpImage[this.value],this.ctx.drawImage(this.tmpImage[this.value],0,0,this.imageSize[2],this.imageSize[3],0,0,this.imageSize[0],this.imageSize[1])}else this.c[3].textContent=this.value;this.miniCanvas&&(this.c[3].children.length||(this.canvas=document.createElement("canvas"),this.canvas.width=this.imageSize[0],this.canvas.height=this.imageSize[1],this.h,this.imageSize[1],this.canvas.style.cssText="position:relative; pointer-events:none; display:inline-block; float:left; margin-left:0px; margin-right:5px; top:2px",this.ctx=this.canvas.getContext("2d"),this.c[3].style.textAlign="left",this.c[3].appendChild(this.canvas)),this.ctx.drawImage(this.tmpImage[this.value],0,0))}}update(t){this.scroll&&(t=(t=t<0?0:t)>this.range?this.range:t,this.topList=-Math.floor(t/this.ratio),this.listIn.style.top=this.topList+"px",this.scroller.style.top=Math.floor(t)+"px",this.py=t)}parentHeight(t){null!==this.group?this.group.calc(t):this.isUI&&this.main.calc(t)}open(t){super.open(),this.update(0),this.h=this.maxHeight+this.baseH+5,this.scroll?(this.scroller.style.display="block",this.scrollerBack.style.display="block"):(this.topList=0,this.h=this.baseH+5+this.max,this.scroller.style.display="none",this.scrollerBack.style.display="none"),this.s[0].height=this.h+"px",this.s[2].display="block",this.up?(this.zone.y-=this.h-(this.baseH-10),this.setSvg(this.c[4],"d",this.svgs.arrowUp)):this.setSvg(this.c[4],"d",this.svgs.arrowDown),this.rSizeContent();let s=this.h-this.baseH;this.zone.h=this.h,t||this.parentHeight(s)}close(){super.close(),this.up&&(this.zone.y+=this.h-(this.baseH-10));let t=this.h-this.baseH;this.h=this.baseH,this.s[0].height=this.h+"px",this.s[2].display="none",this.setSvg(this.c[4],"d",this.svgs.arrow),this.zone.h=this.h,this.parentHeight(-t)}text(t){this.c[3].textContent=t}rSizeContent(){let t=this.length;for(;t--;)this.listIn.children[t].style.width=this.ww+"px"}rSize(){super.rSize();let t=this.s,s=this.sb,i=this.sa;void 0!==t[2]&&(t[2].width=s+"px",t[2].left=i+"px",t[3].width=s+"px",t[3].left=i+"px",t[4].left=i+s-17+"px",this.ww=s,this.max>this.maxHeight&&(this.ww=s-this.ss),this.isOpen&&this.rSizeContent())}}class v extends n{constructor(t={}){super(t),this.setTypeNumber(t),this.allway=t.allway||!1,this.isDown=!1,this.value=[0],this.multy=1,this.invmulty=1,this.isSingle=!0,this.isAngle=!1,this.isVector=!1,t.isAngle&&(this.isAngle=!0,this.multy=h.torad,this.invmulty=h.todeg),this.isDrag=t.drag||!1,void 0!==t.value&&(isNaN(t.value)?t.value instanceof Array?(this.value=t.value,this.isSingle=!1):t.value instanceof Object&&(this.value=[],void 0!==t.value.x&&(this.value[0]=t.value.x),void 0!==t.value.y&&(this.value[1]=t.value.y),void 0!==t.value.z&&(this.value[2]=t.value.z),void 0!==t.value.w&&(this.value[3]=t.value.w),this.isVector=!0,this.isSingle=!1):this.value=[t.value]),this.lng=this.value.length,this.tmp=[],this.current=-1,this.prev={x:0,y:0,d:0,v:0};let s=this.colors;this.c[2]=this.dom("div",this.css.basic+" background:"+s.select+"; top:4px; width:0px; height:"+(this.h-8)+"px;"),this.cMode=[];let i=this.lng;for(;i--;)this.isAngle&&(this.value[i]=(180*this.value[i]/Math.PI).toFixed(this.precision)),this.c[3+i]=this.dom("div",this.css.txtselect+" height:"+(this.h-4)+"px; color:"+s.text+"; background:"+s.back+"; borderColor:"+s.border+"; border-radius:"+this.radius+"px;"),t.center&&(this.c[2+i].style.textAlign="center"),this.c[3+i].textContent=this.value[i],this.c[3+i].style.color=this.colors.text,this.c[3+i].isNum=!0,this.cMode[i]=0;this.selectId=3+this.lng,this.c[this.selectId]=this.dom("div",this.css.txtselect+"position:absolute; top:4px; height:"+(this.h-8)+"px; padding:0px 0px; width:0px; color:"+s.textSelect+"; background:"+s.select+"; border:none; border-radius:0px;"),this.cursorId=4+this.lng,this.c[this.cursorId]=this.dom("div",this.css.basic+"top:4px; height:"+(this.h-8)+"px; width:0px; background:"+s.text+";"),this.init()}testZone(t){let s=this.local;if(-1===s.x&&-1===s.y)return"";let i=this.lng,e=this.tmp;for(;i--;)if(s.x>e[i][0]&&s.x<e[i][2])return i;return""}mousedown(t){let s=this.testZone(t);return!this.isDown&&(this.isDown=!0,""!==s&&(this.current=s,this.prev={x:t.clientX,y:t.clientY,d:0,v:this.isSingle?parseFloat(this.value):parseFloat(this.value[this.current])},this.setInput(this.c[3+this.current])),this.mousemove(t))}mouseup(t){return!!this.isDown&&(this.isDown=!1,this.prev={x:0,y:0,d:0,v:0},this.mousemove(t))}mousemove(t){let s=!1,i=0;if(""===this.testZone(t)?this.cursor():this.isDrag?this.cursor(-1!==this.current?"move":"pointer"):this.cursor("text"),!this.isDrag)return this.isDown&&(i=t.clientX-this.zone.x-3),-1!==this.current&&(i-=this.tmp[this.current][0]),this.upInput(i,this.isDown);if(-1!==this.current){this.prev.d+=t.clientX-this.prev.x-(t.clientY-this.prev.y);let i=this.prev.v+this.prev.d*this.step;this.value[this.current]=this.numValue(i),this.c[3+this.current].textContent=this.value[this.current],this.validate(),this.prev.x=t.clientX,this.prev.y=t.clientY,s=!0}return s}reset(){return!1}setValue(t){this.isVector?(void 0!==t.x&&(this.value[0]=t.x),void 0!==t.y&&(this.value[1]=t.y),void 0!==t.z&&(this.value[2]=t.z),void 0!==t.w&&(this.value[3]=t.w)):this.isSingle?this.value=[t]:this.value=t,this.update()}sameStr(t){let s=this.value.length;for(;s--;)this.c[3+s].textContent=t}update(t){let s=this.value.length;for(;s--;)this.value[s]=this.numValue(this.value[s]*this.invmulty),this.c[3+s].textContent=this.value[s];t&&this.send()}send(t){t=t||this.value,this.isSend=!0,null!==this.objectLink&&(this.isVector?this.objectLink[this.val].fromArray(t):this.objectLink[this.val]=t),this.callback&&this.callback(t,this.val),this.isSend=!1}select(t,s,i,e){let h=this.s,o=-1!==this.current?this.tmp[this.current][0]+5:0;h[this.cursorId].width="1px",h[this.cursorId].left=o+t+"px",h[this.selectId].left=o+s+"px",h[this.selectId].width=i+"px",this.c[this.selectId].innerHTML=e}unselect(){let t=this.s;t&&(this.c[this.selectId].innerHTML="",t[this.selectId].width="0px",t[this.cursorId].width="0px")}validate(t){let s=[],i=this.lng;for(this.allway&&(t=!0);i--;){if(isNaN(this.c[3+i].textContent))this.c[3+i].textContent=this.value[i];else{let t=this.numValue(this.c[3+i].textContent);this.c[3+i].textContent=t,this.value[i]=t}s[i]=this.value[i]*this.multy}t&&(this.isSingle?this.send(s[0]):this.send(s))}rSize(){super.rSize();let t=Math.floor((this.sb+5)/this.lng)-5,s=this.s,i=this.lng;for(;i--;)this.tmp[i]=[Math.floor(this.sa+t*i+5*i),t],this.tmp[i][2]=this.tmp[i][0]+this.tmp[i][1],s[3+i].left=this.tmp[i][0]+"px",s[3+i].width=this.tmp[i][1]+"px"}}class f extends n{constructor(t={}){super(t),this.setTypeNumber(t),this.model=t.stype||0,void 0!==t.mode&&(this.model=t.mode),this.isDown=!1,this.isOver=!1,this.allway=t.allway||!1,this.isDeg=t.isDeg||!1,this.isCyclic=t.cyclic||!1,this.firstImput=!1;let s=this.colors;if(this.c[2]=this.dom("div",this.css.txtselect+"border:none; background:none; width:47px; color:"+s.text+";"),this.c[3]=this.dom("div",this.css.basic+" top:0; height:"+this.h+"px;"),this.c[4]=this.dom("div",this.css.basic+"background:"+s.back+"; top:2px; height:"+(this.h-4)+"px;"),this.c[5]=this.dom("div",this.css.basic+"left:4px; top:5px; height:"+(this.h-10)+"px; background:"+s.text+";"),this.c[2].isNum=!0,this.c[2].style.height=this.h-2+"px",this.c[2].style.lineHeight=this.h-10+"px",0!==this.model){let t=4,i=8,e=this.h-4,h=20;2===this.model&&(t=4,i=8,h=2,e=.5*(this.h-4)),3===this.model&&(this.c[5].style.visible="none"),this.c[4].style.borderRadius=t+"px",this.c[4].style.height=i+"px",this.c[4].style.top=.5*this.h-t+"px",this.c[5].style.borderRadius=.5*t+"px",this.c[5].style.height=t+"px",this.c[5].style.top=.5*this.h-.5*t+"px",this.c[6]=this.dom("div",this.css.basic+"border-radius:"+h+"px; margin-left:"+.5*-e+"px; border:1px solid "+s.border+"; background:"+s.button+"; left:4px; top:2px; height:"+(this.h-4)+"px; width:"+e+"px;")}this.init()}testZone(t){let s=this.local;return-1===s.x&&-1===s.y?"":s.x>=this.txl?"text":s.x>=this.sa?"scroll":""}mouseup(t){this.isDown&&(this.isDown=!1)}mousedown(t){let s=this.testZone(t);return!!s&&("scroll"===s&&(this.isDown=!0,this.old=this.value,this.mousemove(t)),!0)}mousemove(t){let s=!1;if("scroll"===this.testZone(t)?(this.mode(1),this.cursor("w-resize")):this.cursor(),this.isDown){let i=(t.clientX-(this.zone.x+this.sa)-3)/this.ww*this.range+this.min-this.old;(i>=this.step||i<=this.step)&&(i=Math.floor(i/this.step),this.value=this.numValue(this.old+i*this.step),this.update(!0),this.old=this.value),s=!0}return s}wheel(t){if("scroll"===this.testZone(t)){let s=this.value-this.step*t.delta;return s>this.max?s=this.isCyclic?this.min:this.max:s<this.min&&(s=this.isCyclic?this.max:this.min),this.setValue(s),this.old=s,this.update(!0),!0}return!1}validate(){let t=this.c[2].textContent;isNaN(t)?this.c[2].textContent=this.value+(this.isDeg?"°":""):(this.value=this.numValue(t),this.update(!0))}reset(){this.isDown=!1,this.mode(0)}mode(t){let s=this.s,i=this.colors;switch(t){case 0:s[2].color=i.text,s[4].background=i.back,s[5].background=i.text;break;case 1:s[2].color=i.textOver,s[4].background=i.back,s[5].background=i.textOver}}update(t){let s=Math.floor(this.ww*((this.value-this.min)/this.range));3!==this.model&&(this.s[5].width=s+"px"),this.s[6]&&(this.s[6].left=this.sa+s+3+"px"),this.c[2].textContent=this.value+(this.isDeg?"°":""),t&&this.send()}rSize(){super.rSize();let t=this.sb-this.sc;this.ww=t-6;let s=this.sc;!this.isUI&&this.simple||(s=this.sc+10),this.txl=this.w-s+2;let i=this.s;i[2].width=this.sc-6+"px",i[2].left=this.txl+4+"px",i[3].left=this.sa+"px",i[3].width=t+"px",i[4].left=this.sa+"px",i[4].width=t+"px",i[5].left=this.sa+3+"px",this.update()}}class b extends n{constructor(t={}){super(t),this.cmode=0,this.value=t.value||"",this.placeHolder=t.placeHolder||"",this.allway=t.allway||!1,this.editable=void 0===t.edit||t.edit,this.isDown=!1;let s=this.colors;this.c[2]=this.dom("div",this.css.txtselect+"height:"+(this.h-4)+"px; color:"+s.text+"; background:"+s.back+"; borderColor:"+s.border+"; border-radius:"+this.radius+"px;"),this.c[2].textContent=this.value,this.c[3]=this.dom("div",this.css.txtselect+"position:absolute; top:4px; height:"+(this.h-8)+"px; padding:0px 0px; width:0px; color:"+s.textSelect+"; background:"+s.select+"; border:none; border-radius:0px;"),this.c[4]=this.dom("div",this.css.basic+"top:4px; height:"+(this.h-8)+"px; width:0px; background:"+s.text+";"),this.c[5]=this.dom("div",this.css.txtselect+"height:"+(this.h-4)+"px; justify-content: center; font-style: italic; color:"+s.border+";"),""===this.value&&(this.c[5].textContent=this.placeHolder),this.init()}testZone(t){let s=this.local;return-1===s.x&&-1===s.y?"":s.x>=this.sa?"text":""}mouseup(t){if(this.editable)return!!this.isDown&&(this.isDown=!1,this.mousemove(t))}mousedown(t){if(!this.editable)return;let s=this.testZone(t);return!this.isDown&&(this.isDown=!0,"text"===s&&this.setInput(this.c[2]),this.mousemove(t))}mousemove(t){if(!this.editable)return;let s=0;return"text"===this.testZone(t)?this.cursor("text"):this.cursor(),this.isDown&&(s=t.clientX-this.zone.x),this.upInput(s-this.sa-3,this.isDown)}update(){this.c[2].textContent=this.value}reset(){this.cursor()}select(t,s,i,e){let h=this.s,o=this.sa+5;h[4].width="1px",h[4].left=o+s+"px",h[3].left=o+s+"px",h[3].width=i+"px",this.c[3].innerHTML=e}unselect(){let t=this.s;t&&(t[3].width="0px",this.c[3].innerHTML="t",t[4].width="0px")}validate(t){this.allway&&(t=!0),this.value=this.c[2].textContent,""!==this.value?this.c[5].textContent="":this.c[5].textContent=this.placeHolder,t&&this.send()}rSize(){super.rSize();let t=this.s;t[2].left=this.sa+"px",t[2].width=this.sb+"px",t[5].left=this.sa+"px",t[5].width=this.sb+"px"}}class w extends n{constructor(t={}){super(t);let s=t.prefix||"";this.c[2]=this.dom("div",this.css.txt+"justify-content:right; width:60px; line-height:"+(this.h-8)+"px; color:"+this.colors.text),31===this.h&&(this.s[0].height=this.h+"px",this.s[1].top="8px",this.c[2].style.top="8px");let i=this.s;i[1].justifyContent=t.align||"left",i[1].fontWeight=t.fontWeight||"bold",this.c[1].textContent=this.txt.substring(0,1).toUpperCase()+this.txt.substring(1).replace("-"," "),this.c[2].textContent=s,this.init()}text(t){this.c[1].textContent=t}text2(t){this.c[2].textContent=t}rSize(){super.rSize(),this.s[1].width=this.w+"px",this.s[2].left=this.w+"px"}setColor(t){this.s[1].color=t,this.s[2].color=t}}class y extends n{constructor(t={}){super(t),this.value=t.value||"",this.isDown=!1,this.onActif=t.onActif||function(){},t.prefix,this.c[2]=this.dom("div",this.css.txt+this.css.button+" top:1px; background:"+this.colors.button+"; height:"+(this.h-2)+"px; border:"+this.colors.buttonBorder+"; border-radius:15px; width:30px; left:10px;"),this.c[2].style.color=this.fontColor,this.c[3]=this.dom("div",this.css.txtselect+"height:"+(this.h-4)+"px; background:"+this.colors.inputBg+"; borderColor:"+this.colors.inputBorder+"; border-radius:"+this.radius+"px;"),this.c[3].textContent=this.value;let s=Math.floor(.5*this.h)-7;this.c[4]=this.dom("path",this.css.basic+"position:absolute; width:14px; height:14px; left:5px; top:"+s+"px;",{d:this.svgs.cursor,fill:this.fontColor,stroke:"none"}),this.stat=1,this.isActif=!1,this.init()}testZone(t){let s=this.local;return-1===s.x&&-1===s.y?"":s.x>this.sa&&s.x<this.sa+30?"over":"0"}mouseup(t){return!!this.isDown&&(this.isDown=!1,this.mousemove(t))}mousedown(t){return!!this.testZone(t)&&(this.isDown=!0,this.mousemove(t))}mousemove(t){let s=!1;return"over"===this.testZone(t)?(this.cursor("pointer"),s=this.mode(this.isDown?3:2)):s=this.reset(),s}apply(t){(t=t||"")!==this.value&&(this.value=t,this.c[3].textContent=this.value,this.send()),this.mode(1)}update(){this.mode(3)}mode(t){let s=!1,i=this.colors;if(this.stat!==t){switch(1===t&&(this.isActif=!1),3===t&&(this.isActif?this.isActif=!1:(this.isActif=!0,t=4,this.onActif(this))),2===t&&this.isActif&&(t=4),this.stat=t,t){case 1:this.s[2].color=i.text,this.s[2].background=i.button;break;case 2:this.s[2].color=i.textOver,this.s[2].background=i.over;break;case 3:this.s[2].color=i.textSelect,this.s[2].background=i.select;break;case 4:this.s[2].color=i.textSelect,this.s[2].background=i.action}s=!0}return s}reset(){return this.cursor(),this.mode(this.isActif?4:1)}text(t){this.c[3].textContent=t}rSize(){super.rSize();let t=this.s;t[2].left=this.sa+"px",t[3].left=this.sa+40+"px",t[3].width=this.sb-40+"px",t[4].left=this.sa+8+"px"}}class k extends l{constructor(t={}){void 0===t.selectable&&(t.selectable=!0),super(t)}}class S extends n{constructor(t={}){t.isSpace=!0,t.margin=0,t.h||(t.h=10),super(t),this.init()}}class I extends n{constructor(t={}){super(t),this.p=100,this.value=this.txt,this.status=1,this.itype=t.itype||"none",this.val=this.itype,this.graph=this.svgs[this.itype];let s=Math.floor(.5*this.h)-7;this.c[2]=this.dom("path",this.css.basic+"position:absolute; width:14px; height:14px; left:5px; top:"+s+"px;",{d:this.graph,fill:this.colors.text,stroke:"none"}),this.s[1].marginLeft="20px",this.init()}mousemove(t){this.cursor("pointer")}mousedown(t){return this.isUI&&this.main.resetItem(),this.selected(!0),this.send(),!0}uiout(){this.isSelect?this.mode(3):this.mode(1)}uiover(){this.isSelect?this.mode(4):this.mode(2)}update(){}mode(t){let s=!1;if(this.status!==t){this.status=t;let i=this.s,e=this.colors;switch(t){case 1:this.status=1,i[1].color=e.text,i[0].background="none";break;case 2:this.status=2,i[1].color=e.textOver,i[0].background=e.back;break;case 3:this.status=3,i[1].color=e.textSelect,i[0].background=e.select;break;case 4:this.status=4,i[1].color=e.textOver,i[0].background=e.over}s=!0}return s}reset(){this.cursor()}selected(t){this.isSelect&&this.mode(1),this.isSelect=t||!1,this.isSelect&&this.mode(3)}}class C extends n{constructor(t={}){super(t),this.values=t.values||[],"string"==typeof this.values&&(this.values=[this.values]),this.lng=this.values.length,this.value=t.value||null,this.isSelectable=t.selectable||!1,this.spaces=t.spaces||[5,3],this.bsize=t.bsize||[90,20],t.h&&(this.bsize[1]=t.h),this.bsizeMax=this.bsize[0],this.tmp=[],this.stat=[],this.grid=[2,Math.round(.5*this.lng)],this.h=this.grid[1]*(this.bsize[1]+this.spaces[1])+this.spaces[1],this.c[1].textContent="",this.c[2]=this.dom("table",this.css.basic+"width:100%; top:"+(this.spaces[1]-2)+"px; height:auto; border-collapse:separate; border:none; border-spacing: "+(this.spaces[0]-2)+"px "+(this.spaces[1]-2)+"px;");let s,i,e,h,o=0;this.res=-1,this.isDown=!1,this.neverlock=!0,this.buttons=[],this.stat=[],this.tmpX=[],this.tmpY=[];let n=this.colors;for(let t=0;t<this.grid[1];t++){e=this.c[2].insertRow(),e.style.cssText="pointer-events:none;";for(let t=0;t<this.grid[0];t++)i=e.insertCell(),i.style.cssText="pointer-events:none;",this.values[o]?(h=!1,this.values[o]===this.value&&this.isSelectable&&(h=!0),s=document.createElement("div"),s.style.cssText=this.css.txt+this.css.button+"position:static; width:"+this.bsize[0]+"px; height:"+this.bsize[1]+"px; border:"+n.borderSize+"px solid "+n.border+"; left:auto; right:auto; border-radius:"+this.radius+"px;",s.style.background=h?n.select:n.button,s.style.color=h?n.textSelect:n.text,s.innerHTML=this.values[o],i.appendChild(s),this.buttons.push(s),this.stat.push(1)):(s=document.createElement("div"),s.style.cssText=this.css.txt+"position:static; width:"+this.bsize[0]+"px; height:"+this.bsize[1]+"px; text-align:center; left:auto; right:auto; background:none;",i.appendChild(s)),s.style.cssText+=0===t?"float:right;":"float:left;",o++}this.init()}testZone(t){let s=this.local;if(-1===s.x&&-1===s.y)return-1;let i=this.tmpX,e=this.tmpY,h=-1,o=-1,n=-1,r=this.grid[0];for(;r--;)s.x>i[r][0]&&s.x<i[r][1]&&(o=r);for(r=this.grid[1];r--;)s.y>e[r][0]&&s.y<e[r][1]&&(n=r);return-1!==o&&-1!==n&&(h=o+2*n,h>this.lng-1&&(h=-1)),h}mouseup(t){return!!this.isDown&&(this.isDown=!1,-1!==this.res&&(this.value=this.values[this.res],this.send()),this.mousemove(t))}mousedown(t){return!this.isDown&&(this.isDown=!0,this.mousemove(t))}mousemove(t){let s=!1;return this.res=this.testZone(t),-1!==this.res?(this.cursor("pointer"),s=this.modes(this.isDown?3:2,this.res)):s=this.reset(),s}modes(t=1,s=-1){let i,e,h=this.lng,o=!1;for(;h--;)e=t,i=!!this.isSelectable&&this.values[h]===this.value,h===s?i&&2===e&&(e=3):(e=1,i&&(e=4)),this.mode(e,h)&&(o=!0);return o}mode(t,s){let i=!1,e=this.colors,h=this.buttons,o=s;if(this.stat[s]!==t){switch(this.stat[s]=t,t){case 1:h[o].style.color=e.text,h[o].style.background=e.button;break;case 2:h[o].style.color=e.textOver,h[o].style.background=e.overoff;break;case 3:h[o].style.color=e.textOver,h[o].style.background=e.over;break;case 4:h[o].style.color=e.textSelect,h[o].style.background=e.select}i=!0}return i}reset(){return this.res=-1,this.cursor(),this.modes()}label(t,s){this.buttons[s].textContent=t}icon(t,s,i){this.buttons[i].style.padding=(s||0)+"px 0px",this.buttons[i].innerHTML=t}testW(){let t=!1;if(3*this.spaces[0]+2*this.bsizeMax>this.w?(this.bsize[0]=.5*(this.w-3*this.spaces[0]),t=!0):this.bsize[0]!==this.bsizeMax&&(this.bsize[0]=this.bsizeMax,t=!0),!t)return;let s=this.buttons.length;for(;s--;)this.buttons[s].style.width=this.bsize[0]+"px"}rSize(){let t;super.rSize(),this.testW(),this.tmpX=[],this.tmpY=[];for(let s=0;s<this.grid[0];s++)0===s?(t=.5*this.w-.5*this.spaces[0],this.tmpX.push([t-this.bsize[0],t])):(t=.5*this.w+.5*this.spaces[0],this.tmpX.push([t,t+this.bsize[0]]));t=this.spaces[1];for(let s=0;s<this.grid[1];s++)this.tmpY.push([t,t+this.bsize[1]]),t+=this.bsize[1]+this.spaces[1]}}class M extends n{constructor(t={}){super(t),this.autoWidth=!1,this.minw=this.w,this.diam=t.diam||this.w,this.pos=new o(0,0),this.maxPos=90,this.model=t.stype||0,void 0!==t.mode&&(this.model=t.mode),this.min=void 0===t.min?-1:t.min,this.max=void 0===t.max?1:t.max,this.range=.5*(this.max-this.min),this.cmode=0,this.precision=void 0===t.precision?2:t.precision,this.value=Array.isArray(t.value)&&2==t.value.length?t.value:[0,0],this.h=t.h||this.w+10,this.top=0,this.c[0].style.width=this.w+"px",void 0!==this.c[1]&&(this.c[1].style.width="100%",this.c[1].style.justifyContent="center",this.top=10,this.h+=10);let s=this.colors;this.c[2]=this.dom("div",this.css.txt+"justify-content:center; top:"+(this.h-20)+"px; width:100%; color:"+s.text),this.c[2].textContent=this.value;let i=this.getPad2d();this.setSvg(i,"fill",s.back,0),this.setSvg(i,"fill",s.button,1),this.setSvg(i,"stroke",s.back,2),this.setSvg(i,"stroke",s.back,3),this.setSvg(i,"stroke",s.text,4),this.setSvg(i,"viewBox","0 0 "+this.diam+" "+this.diam),this.setCss(i,{width:this.diam,height:this.diam,left:0,top:this.top}),this.c[3]=i,this.init(),this.setValue()}testZone(t){let s=this.local;return-1===s.x&&-1===s.y?"":s.y<=this.c[1].offsetHeight?"title":s.y>this.h-this.c[2].offsetHeight?"text":"pad"}mouseup(t){return this.isDown=!1,this.mode(0)}mousedown(t){if("pad"===this.testZone(t))return this.isDown=!0,this.mousemove(t),this.mode(1)}mousemove(t){if(!this.isDown)return;let s=.5*this.w-(t.clientX-this.zone.x),i=.5*this.diam-(t.clientY-this.zone.y-this.top),e=256/this.diam;s=-s*e,i=-i*e,s=h.clamp(s,-this.maxPos,this.maxPos),i=h.clamp(i,-this.maxPos,this.maxPos),this.setPos([s,i]),this.update(!0)}mode(t){if(this.cmode===t)return!1;let s=this.colors;switch(t){case 0:this.s[2].color=s.text,this.setSvg(this.c[3],"fill",s.back,0),this.setSvg(this.c[3],"fill",s.button,1),this.setSvg(this.c[3],"stroke",s.back,2),this.setSvg(this.c[3],"stroke",s.back,3),this.setSvg(this.c[3],"stroke",s.text,4);break;case 1:this.s[2].color=s.textSelect,this.setSvg(this.c[3],"fill",s.backoff,0),this.setSvg(this.c[3],"fill",s.overoff,1),this.setSvg(this.c[3],"stroke",s.backoff,2),this.setSvg(this.c[3],"stroke",s.backoff,3),this.setSvg(this.c[3],"stroke",s.textSelect,4)}return this.cmode=t,!0}update(t){this.c[2].textContent=this.value,this.updateSVG(),t&&this.send()}updateSVG(){1==this.model&&(this.setSvg(this.c[3],"y1",this.pos.y,2),this.setSvg(this.c[3],"y2",this.pos.y,2),this.setSvg(this.c[3],"x1",this.pos.x,3),this.setSvg(this.c[3],"x2",this.pos.x,3)),this.setSvg(this.c[3],"cx",this.pos.x,4),this.setSvg(this.c[3],"cy",this.pos.y,4)}setPos(t){this.pos.set(t[0]+128,t[1]+128);let s=1/this.maxPos;this.value[0]=(t[0]*s*this.range).toFixed(this.precision),this.value[1]=(t[1]*s*this.range).toFixed(this.precision)}setValue(t,s=!1){void 0===t&&(t=this.value),this.value[0]=1*Math.min(this.max,Math.max(this.min,t[0])).toFixed(this.precision),this.value[1]=1*Math.min(this.max,Math.max(this.min,t[1])).toFixed(this.precision),this.pos.set(this.value[0]/this.range*this.maxPos+128,this.value[1]/this.range*this.maxPos+128),this.update(s)}}const z=function(){let t,s,i=arguments,e=!1,h=null;"string"==typeof i[0]?(t=i[0],s=i[1]||{}):"object"==typeof i[0]&&(e=!0,void 0===i[2]&&[].push.call(i,{}),t=i[2].type?i[2].type:"slide",s=i[2],s.name=i[1],"list"===t?s.list=i[0][i[1]]:s.value=i[0][i[1]]);let o=t.toLowerCase();switch("group"===o&&(s.add=z),o){case"bool":h=new r(s);break;case"button":h=new l(s);break;case"circular":h=new a(s);break;case"color":h=new c(s);break;case"fps":h=new d(s);break;case"graph":h=new u(s);break;case"group":h=new p(s);break;case"joystick":h=new m(s);break;case"knob":h=new g(s);break;case"list":h=new x(s);break;case"numeric":case"number":h=new v(s);break;case"slide":h=new f(s);break;case"textInput":case"string":h=new b(s);break;case"title":case"text":h=new w(s);break;case"select":h=new y(s);break;case"selector":h=new k(s);break;case"empty":case"space":h=new S(s);break;case"item":h=new I(s);break;case"grid":h=new C(s);break;case"pad2d":case"pad":h=new M(s)}if(null!==h)return e&&h.setReferency(i[0],i[1]),h};t.Gui=class{constructor(t={}){this.isGui=!0,this.name="gui",this.canvas=null,this.screen=null,this.plane=t.plane||null,this.isEmpty=!0,t.config&&(t.colors=t.config),t.colors?this.setConfig(t.colors):this.colors=h.defineColor(t),this.css=h.cloneCss(),this.isReset=!0,this.tmpAdd=null,this.isCanvas=t.isCanvas||!1,this.isCanvasOnly=!1,this.callback=void 0===t.callback?null:t.callback,this.forceHeight=t.maxHeight||0,this.lockHeight=t.lockHeight||!1,this.isItemMode=void 0!==t.itemMode&&t.itemMode,this.cn="",this.size=h.size,void 0!==t.p&&(this.size.p=t.p),void 0!==t.w&&(this.size.w=t.w),void 0!==t.h&&(this.size.h=t.h),void 0!==t.s&&(this.size.s=t.s),this.size.h=this.size.h<11?11:this.size.h,this.local=(new o).neg(),this.zone={x:0,y:0,w:this.size.w,h:0},this.mouse=(new o).neg(),this.h=0,this.sw=0,this.isWithClose=void 0===t.close||t.close,this.bh=this.isWithClose?this.size.h:0,this.autoResize=void 0===t.autoResize||t.autoResize,this.isCenter=t.center||!1,this.cssGui=void 0!==t.css?t.css:this.isCenter?"":"right:10px;",this.isOpen=void 0===t.open||t.open,this.isDown=!1,this.isScroll=!1,this.uis=[],this.current=-1,this.target=null,this.decal=0,this.ratio=1,this.oy=0,this.isNewTarget=!1;let s=this.colors;this.content=h.dom("div",this.css.basic+" width:0px; height:auto; top:0px; background:"+s.content+"; "+this.cssGui),this.innerContent=h.dom("div",this.css.basic+"width:100%; top:0; left:0; height:auto; overflow:hidden;"),this.content.appendChild(this.innerContent),this.useFlex=!0;let e=this.useFlex?"display:flex; flex-flow: row wrap;":"";this.inner=h.dom("div",this.css.basic+e+"width:100%; left:0; "),this.innerContent.appendChild(this.inner),this.scrollBG=h.dom("div",this.css.basic+"right:0; top:0; width:"+(this.size.s-1)+"px; height:10px; display:none; background:"+s.background+";"),this.content.appendChild(this.scrollBG),this.scroll=h.dom("div",this.css.basic+"background:"+s.button+"; right:2px; top:0; width:"+(this.size.s-4)+"px; height:10px;"),this.scrollBG.appendChild(this.scroll),this.bottomText=t.bottomText||["open","close"];let n=s.radius;this.bottom=h.dom("div",this.css.txt+"width:100%; top:auto; bottom:0; left:0; border-bottom-right-radius:"+n+"px; border-bottom-left-radius:"+n+"px; justify-content:center; height:"+this.bh+"px; line-height:"+(this.bh-5)+"px; color:"+s.text+";"),this.content.appendChild(this.bottom),this.bottom.textContent=this.isOpen?this.bottomText[1]:this.bottomText[0],this.bottom.style.background=s.background,this.parent=void 0!==t.parent?t.parent:null,this.parent=void 0!==t.target?t.target:this.parent,null!==this.parent||this.isCanvas||(this.parent=document.body),null!==this.parent&&this.parent.appendChild(this.content),this.isCanvas&&null===this.parent&&(this.isCanvasOnly=!0),this.isCanvasOnly?t.transition=0:this.content.style.pointerEvents="auto",this.transition=t.transition||h.transition,this.transition&&setTimeout(this.addTransition.bind(this),0),this.setWidth(),this.isCanvas&&this.makeCanvas(),i.add(this)}setTop(t,s){this.content.style.top=t+"px",void 0!==s&&(this.forceHeight=s),this.calc(),i.needReZone=!0}addTransition(){this.transition&&!this.isCanvas&&(this.innerContent.style.transition="height "+this.transition+"s ease-out",this.content.style.transition="height "+this.transition+"s ease-out",this.bottom.style.transition="top "+this.transition+"s ease-out")}onDraw(){}makeCanvas(){this.canvas=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.canvas.width=this.zone.w,this.canvas.height=this.forceHeight?this.forceHeight:this.zone.h}draw(t){if(null===this.canvas)return;let s=this.zone.w,e=this.forceHeight?this.forceHeight:this.zone.h;i.toCanvas(this,s,e,t)}getDom(){return this.content}noMouse(){this.mouse.neg()}setMouse(t,s=!0){s?this.mouse.set(Math.round(t.x*this.canvas.width),this.canvas.height-Math.round(t.y*this.canvas.height)):this.mouse.set(Math.round(t.x*this.canvas.width),Math.round(t.y*this.canvas.height))}setConfig(t){h.setText(),this.colors=h.defineColor(t)}setColors(t){for(let s in t)this.colors[s]&&(this.colors[s]=t[s])}setText(t,s,i,e){h.setText(t,s,i,e)}hide(t){this.content.style.display=t?"none":"block"}onChange(t){return this.callback=t||null,this}mode(t){let s=!1,e=this.colors;if(t!==this.cn){switch(this.cn=t,t){case"def":i.cursor(),this.scroll.style.background=e.button,this.bottom.style.background=e.background,this.bottom.style.color=e.text;break;case"scrollOver":i.cursor("ns-resize"),this.scroll.style.background=e.select;break;case"scrollDown":this.scroll.style.background=e.select;break;case"bottomOver":i.cursor("pointer"),this.bottom.style.background=e.backgroundOver,this.bottom.style.color=e.textOver}s=!0}return s}clearTarget(){return-1!==this.current&&(this.target.uiout(),this.target.reset(),this.target=null,this.current=-1,i.cursor(),!0)}testZone(t){let s=this.local;if(-1===s.x&&-1===s.y)return"";this.isReset=!1;let i="",e=this.isScroll?this.zone.w-this.size.s:this.zone.w;return i=s.y>this.zone.h-this.bh&&s.y<this.zone.h?"bottom":s.x>e?"scroll":"content",i}handleEvent(t){let s=t.type,e=!1,h=!1,o=this.testZone(t);if("mouseup"===s&&this.isDown&&(this.isDown=!1),"mousedown"!==s||this.isDown||(this.isDown=!0),this.isDown&&this.isNewTarget&&(i.clearInput(),this.isNewTarget=!1),o){switch(o){case"content":t.clientY=this.isScroll?t.clientY+this.decal:t.clientY,i.isMobile&&"mousedown"===s&&this.getNext(t,e),this.target&&(h=this.target.handleEvent(t)),"mousemove"===s&&(e=this.mode("def")),"wheel"===s&&!h&&this.isScroll&&(e=this.onWheel(t)),i.lock||this.getNext(t,e);break;case"bottom":this.clearTarget(),"mousemove"===s&&(e=this.mode("bottomOver")),"mousedown"===s&&(this.isOpen=!this.isOpen,this.bottom.textContent=this.isOpen?this.bottomText[1]:this.bottomText[0],this.calc(),this.mode("def"),e=!0);break;case"scroll":this.clearTarget(),"mousemove"===s&&(e=this.mode("scrollOver")),"mousedown"===s&&(e=this.mode("scrollDown")),"wheel"===s&&(e=this.onWheel(t)),this.isDown&&this.update(t.clientY-this.zone.y-.5*this.sh)}this.isDown&&(e=!0),h&&(e=!0),"keyup"===s&&(e=!0),"keydown"===s&&(e=!0),e&&this.draw()}}getNext(t,s){let e=i.findTarget(this.uis,t);e!==this.current&&(this.clearTarget(),this.current=e,this.isNewTarget=!0),-1!==e&&(this.target=this.uis[this.current],this.target.uiover())}onWheel(t){return this.oy+=20*t.delta,this.update(this.oy),!0}reset(t){if(this.isReset)return;this.mouse.neg(),this.isDown=!1;let s=this.mode("def"),i=this.clearTarget();(s||i)&&this.draw(!0),this.isReset=!0}add(){let t=arguments,s=!1;"object"==typeof t[1]?(t[1].isUI=!0,t[1].main=this,s=!!t[1].ontop&&t[1].ontop):"string"==typeof t[1]&&(void 0===t[2]?[].push.call(t,{isUI:!0,main:this}):(t[2].isUI=!0,t[2].main=this,s=!!t[1].ontop&&t[1].ontop));let i=z.apply(this,t);if(null!==i)return s?this.uis.unshift(i):this.uis.push(i),this.calc(),this.isEmpty=!1,i}remove(t){t.clear&&t.clear()}clearOne(t){let s=this.uis.indexOf(t);-1!==s&&(this.inner.removeChild(this.uis[s].c[0]),this.uis.splice(s,1),this.calc())}empty(){let t,s=this.uis.length;for(;s--;)t=this.uis.pop(),this.inner.removeChild(t.c[0]),t.clear(!0);this.uis=[],this.isEmpty=!0,this.calc()}clear(){this.empty()}dispose(){this.clear(),null!==this.parent&&this.parent.removeChild(this.content),i.remove(this)}resetItem(){if(!this.isItemMode)return;let t=this.uis.length;for(;t--;)this.uis[t].selected()}setItem(t){if(!this.isItemMode)return;if(t=t||"",this.resetItem(),!t)return void this.update(0);let s=this.uis.length;for(;s--;)this.uis[s].value===t&&(this.uis[s].selected(!0),this.isScroll&&this.update(s*(this.uis[s].h+1)*this.ratio))}upScroll(t){this.sw=t?this.size.s:0,this.oy=t?this.oy:0,this.scrollBG.style.display=t?"block":"none",t&&(this.total=this.h,this.maxView=this.maxHeight,this.ratio=this.maxView/this.total,this.sh=this.maxView*this.ratio,this.range=this.maxView-this.sh,this.oy=h.clamp(this.oy,0,this.range),this.scrollBG.style.height=this.maxView+"px",this.scroll.style.height=this.sh+"px"),this.setItemWidth(this.zone.w-this.sw),this.update(this.oy)}update(t){t=h.clamp(t,0,this.range),this.decal=Math.floor(t/this.ratio),this.inner.style.top=-this.decal+"px",this.scroll.style.top=Math.floor(t)+"px",this.oy=t}calcUis(){return i.calcUis(this.uis,this.zone,this.zone.y)}calc(){clearTimeout(this.tmp),this.tmp=setTimeout(this.setHeight.bind(this),10)}setHeight(){if(this.tmp&&clearTimeout(this.tmp),this.zone.h=this.bh,this.isScroll=!1,this.isOpen){this.h=this.calcUis();let t=this.forceHeight?this.forceHeight+this.zone.y:window.innerHeight;this.maxHeight=t-this.zone.y-this.bh,this.h-this.maxHeight>1?(this.isScroll=!0,this.zone.h=this.maxHeight+this.bh):this.zone.h=this.h+this.bh}this.upScroll(this.isScroll),this.innerContent.style.height=this.zone.h-this.bh+"px",this.content.style.height=this.zone.h+"px",this.bottom.style.top=this.zone.h-this.bh+"px",this.forceHeight&&this.lockHeight&&(this.content.style.height=this.forceHeight+"px"),this.isCanvas&&this.draw(!0)}rezone(){i.needReZone=!0}setWidth(t){t&&(this.zone.w=t),this.zone.w=Math.floor(this.zone.w),this.content.style.width=this.zone.w+"px",this.isCenter&&(this.content.style.marginLeft=-Math.floor(.5*this.zone.w)+"px"),this.setItemWidth(this.zone.w-this.sw)}setItemWidth(t){let s=this.uis.length;for(;s--;)this.uis[s].setSize(t),this.uis[s].rSize()}},t.Proto=n,t.REVISION="4.0.2",t.Tools=h,t.add=z,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
6
|
+
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports):"function"==typeof define&&define.amd?define(["exports"],s):s((t="undefined"!=typeof globalThis?globalThis:t||self).UIL={})}(this,(function(t){"use strict";const s={ui:[],dom:null,ID:null,lock:!1,wlock:!1,current:-1,needReZone:!0,isEventsInit:!1,isLeave:!1,downTime:0,prevTime:0,prevDefault:["contextmenu","wheel"],pointerEvent:["pointerdown","pointermove","pointerup"],eventOut:["pointercancel","pointerout","pointerleave"],xmlserializer:null,tmpTime:null,tmpImage:null,oldCursor:"auto",input:null,parent:null,firstImput:!0,hiddenImput:null,hiddenSizer:null,hasFocus:!1,startInput:!1,inputRange:[0,0],cursorId:0,str:"",pos:0,startX:-1,moveX:-1,debugInput:!1,isLoop:!1,listens:[],e:{type:null,clientX:0,clientY:0,keyCode:NaN,key:null,delta:0},isMobile:!1,now:null,getTime:function(){return self.performance&&self.performance.now?self.performance.now.bind(performance):Date.now},add:function(t){s.ui.push(t),s.getZone(t),s.isEventsInit||s.initEvents()},testMobile:function(){let t=navigator.userAgent;return!!(t.match(/Android/i)||t.match(/webOS/i)||t.match(/iPhone/i)||t.match(/iPad/i)||t.match(/iPod/i)||t.match(/BlackBerry/i)||t.match(/Windows Phone/i))},remove:function(t){let i=s.ui.indexOf(t);-1!==i&&(s.removeListen(t),s.ui.splice(i,1)),0===s.ui.length&&s.removeEvents()},initEvents:function(){if(s.isEventsInit)return;let t=document.body;s.isMobile=s.testMobile(),s.now=s.getTime(),s.isMobile?t.style.touchAction="none":t.addEventListener("wheel",s,{passive:!1}),t.addEventListener("pointercancel",s),t.addEventListener("pointerleave",s),t.addEventListener("pointermove",s),t.addEventListener("pointerdown",s),t.addEventListener("pointerup",s),t.addEventListener("keydown",s,!1),t.addEventListener("keyup",s,!1),window.addEventListener("resize",s.resize,!1),s.isEventsInit=!0,s.dom=t},removeEvents:function(){if(!s.isEventsInit)return;let t=document.body;s.isMobile||t.removeEventListener("wheel",s),t.removeEventListener("pointercancel",s),t.removeEventListener("pointerleave",s),t.removeEventListener("pointermove",s),t.removeEventListener("pointerdown",s),t.removeEventListener("pointerup",s),t.removeEventListener("keydown",s),t.removeEventListener("keyup",s),window.removeEventListener("resize",s.resize),s.isEventsInit=!1},resize:function(){s.needReZone=!0;let t,i=s.ui.length;for(;i--;)t=s.ui[i],t.isGui&&!t.isCanvasOnly&&t.autoResize&&t.calc()},out:function(){console.log("im am out"),s.clearOldID()},in:function(){console.log("im am in")},fakeUp:function(){this.handleEvent({type:"pointerup"})},handleEvent:function(t){-1!==s.prevDefault.indexOf(t.type)&&t.preventDefault(),s.findZone();let i=s.e,e=!1;"keydown"===t.type&&s.keydown(t),"keyup"===t.type&&s.keyup(t),"wheel"===t.type?i.delta=t.deltaY>0?1:-1:i.delta=0;let h=t.pointerType;if(i.clientX=("touch"===h?t.pageX:t.clientX)||0,i.clientY=("touch"===h?t.pageY:t.clientY)||0,i.type=t.type,-1!==s.eventOut.indexOf(t.type)&&(e=!0,i.type="mouseup"),"pointerleave"===t.type&&(s.isLeave=!0),"pointerdown"===t.type&&(i.type="mousedown"),"pointerup"===t.type&&(i.type="mouseup"),"pointermove"===t.type&&(s.isLeave&&(s.isLeave=!1,s.resize()),i.type="mousemove"),"mousedown"===i.type){if(s.downTime=s.now(),s.downTime-s.prevTime<200)return s.selectAll(),!1;s.prevTime=s.downTime}"mousedown"===i.type&&s.clearInput(),"mousedown"===i.type&&(s.lock=!0),"mouseup"===i.type&&(s.lock=!1),s.isMobile&&"mousedown"===i.type&&s.findID(i),"mousemove"!==i.type||s.lock||s.findID(i),null!==s.ID&&(s.ID.isCanvasOnly&&(i.clientX=s.ID.mouse.x,i.clientY=s.ID.mouse.y),s.ID.handleEvent(i)),s.isMobile&&"mouseup"===i.type&&s.clearOldID(),e&&s.clearOldID()},findID:function(t){let i,e,h,o=s.ui.length,n=-1;for(;o--;)if(i=s.ui[o],i.isCanvasOnly?(e=i.mouse.x,h=i.mouse.y):(e=t.clientX,h=t.clientY),s.onZone(i,e,h)){n=o,n!==s.current&&(s.clearOldID(),s.current=n,s.ID=i);break}-1===n&&s.clearOldID()},clearOldID:function(){s.ID&&(s.current=-1,s.ID.reset(),s.ID=null,s.cursor())},calcUis:function(t,i,e){let h,o,n=t.length,r=0,l=0,a=0,c=1;for(;n--;)h=t[l],l++,h.isGroup&&h.calcUis(),h.zone.w=h.w,h.zone.h=h.h,c=h.margin,h.autoWidth?(r=0,h.zone.x=i.x,h.zone.y=e,e+=h.h+c,a+=h.h+c):(0===r&&(a+=h.h+c),h.zone.x=i.x+r,h.zone.y=e,o=s.getWidth(h),o&&(h.zone.w=h.w=o),r+=h.zone.w,r>=i.w&&(e+=h.h+c,r=0));return a},findTarget:function(t,i){let e=t.length;for(;e--;)if(s.onZone(t[e],i.clientX,i.clientY))return e;return-1},findZone:function(t){if(s.needReZone||t){for(var i,e=s.ui.length;e--;)i=s.ui[e],s.getZone(i),i.isGui&&i.calcUis();s.needReZone=!1}},onZone:function(t,s,i){if(void 0===s||void 0===i)return!1;let e=t.zone,h=s-e.x,o=i-e.y,n=h>=0&&o>=0&&h<=e.w&&o<=e.h;return n?t.local.set(h,o):t.local.neg(),n},getWidth:function(t){return t.getDom().offsetWidth},getZone:function(t){if(t.isCanvasOnly)return;let s=t.getDom().getBoundingClientRect();t.zone={x:s.left,y:s.top,w:s.width,h:s.height}},cursor:function(t){(t=t||"auto")!==s.oldCursor&&(document.body.style.cursor=t,s.oldCursor=t)},toCanvas:function(t,i,e,h){if(s.xmlserializer||(s.xmlserializer=new XMLSerializer),h&&null!==s.tmpTime&&(clearTimeout(s.tmpTime),s.tmpTime=null),null!==s.tmpTime)return;s.lock&&(s.tmpTime=setTimeout((function(){s.tmpTime=null}),10));let o=!1;i===t.canvas.width&&e===t.canvas.height||(o=!0),null===s.tmpImage&&(s.tmpImage=new Image);let n=s.tmpImage,r=s.xmlserializer.serializeToString(t.content),l='<svg xmlns="http://www.w3.org/2000/svg" width="'+i+'" height="'+e+'"><foreignObject style="pointer-events: none; left:0;" width="100%" height="100%">'+r+"</foreignObject></svg>";n.onload=function(){let s=t.canvas.getContext("2d");o?(t.canvas.width=i,t.canvas.height=e):s.clearRect(0,0,i,e),s.drawImage(this,0,0),t.onDraw()},n.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(l),n.crossOrigin=""},setHidden:function(){null===s.hiddenImput&&(s.hiddenImput=document.createElement("input"),s.hiddenImput.type="text",s.hiddenSizer=document.createElement("div"),document.body.appendChild(s.hiddenImput),document.body.appendChild(s.hiddenSizer));let t=s.debugInput?"":"opacity:0; zIndex:0;",i=s.parent.css.txtselect+"padding:0; width:auto; height:auto; left:10px; top:auto; color:#FFF; background:#000;"+t;s.hiddenImput.style.cssText=i+"bottom:10px;"+(s.debugInput?"":"transform:scale(0);"),s.hiddenSizer.style.cssText=i+"bottom:40px;",s.hiddenImput.style.width=s.input.clientWidth+"px",s.hiddenImput.value=s.str,s.hiddenSizer.innerHTML=s.str,s.hasFocus=!0},clearHidden:function(t){null!==s.hiddenImput&&(s.hasFocus=!1)},clickPos:function(t){let i=s.str.length,e=0,h=0;for(;i--&&(e+=s.textWidth(s.str[h]),!(e>=t));)h++;return h},upInput:function(t,i){if(null===s.parent)return!1;let e=!1;if(i){let i=s.clickPos(t);if(s.moveX=i,-1===s.startX)s.startX=i,s.cursorId=i,s.inputRange=[s.startX,s.startX];else{s.moveX!==s.startX&&(s.startX>s.moveX?s.inputRange=[s.moveX,s.startX]:s.inputRange=[s.startX,s.moveX])}e=!0}else-1!==s.startX&&(s.hasFocus=!0,s.hiddenImput.focus(),s.hiddenImput.selectionStart=s.inputRange[0],s.hiddenImput.selectionEnd=s.inputRange[1],s.startX=-1,e=!0);return e&&s.selectParent(),e},selectAll:function(){s.parent&&(s.str=s.input.textContent,s.inputRange=[0,s.str.length],s.hasFocus=!0,s.hiddenImput.focus(),s.hiddenImput.selectionStart=s.inputRange[0],s.hiddenImput.selectionEnd=s.inputRange[1],s.cursorId=s.inputRange[1],s.selectParent())},selectParent:function(){var t=s.textWidth(s.str.substring(0,s.cursorId)),i=s.textWidth(s.str.substring(0,s.inputRange[0])),e=s.textWidth(s.str.substring(s.inputRange[0],s.inputRange[1]));s.parent.select(t,i,e,s.hiddenSizer.innerHTML)},textWidth:function(t){return null===s.hiddenSizer?0:(t=t.replace(/ /g," "),s.hiddenSizer.innerHTML=t,s.hiddenSizer.clientWidth)},clearInput:function(){null!==s.parent&&(s.firstImput||s.parent.validate(!0),s.clearHidden(),s.parent.unselect(),s.input.style.background=s.parent.colors.back,s.input.style.borderColor=s.parent.colors.border,s.parent.isEdit=!1,s.input=null,s.parent=null,s.str="",s.firstImput=!0)},setInput:function(t,i){s.clearInput(),s.input=t,s.parent=i,s.input.style.background=s.parent.colors.backoff,s.input.style.borderColor=s.parent.colors.select,s.str=s.input.textContent,s.setHidden()},keydown:function(t){if(null===s.parent)return;let i=t.which;t.shiftKey,s.firstImput=!1,s.hasFocus&&(window.focus(),s.hiddenImput.focus()),s.parent.isEdit=!0,13===i?s.clearInput():s.input.isNum?t.keyCode>47&&t.keyCode<58||t.keyCode>95&&t.keyCode<106||190===t.keyCode||110===t.keyCode||8===t.keyCode||109===t.keyCode?s.hiddenImput.readOnly=!1:s.hiddenImput.readOnly=!0:s.hiddenImput.readOnly=!1},keyup:function(t){null!==s.parent&&(s.str=s.hiddenImput.value,s.parent.allEqual?s.parent.sameStr(s.str):s.input.textContent=s.str,s.cursorId=s.hiddenImput.selectionStart,s.inputRange=[s.hiddenImput.selectionStart,s.hiddenImput.selectionEnd],s.selectParent(),s.parent.validate())},loop:function(){s.isLoop&&requestAnimationFrame(s.loop),s.update()},update:function(){let t=s.listens.length;for(;t--;)s.listens[t].listening()},removeListen:function(t){let i=s.listens.indexOf(t);-1!==i&&s.listens.splice(i,1),0===s.listens.length&&(s.isLoop=!1)},addListen:function(t){return-1===s.listens.indexOf(t)&&(s.listens.push(t),s.isLoop||(s.isLoop=!0,s.loop()),!0)}},i=s,e={transition:.2,frag:document.createDocumentFragment(),colorRing:null,joystick_0:null,joystick_1:null,circular:null,knob:null,pad2d:null,svgns:"http://www.w3.org/2000/svg",links:"http://www.w3.org/1999/xlink",htmls:"http://www.w3.org/1999/xhtml",DOM_SIZE:["height","width","top","left","bottom","right","margin-left","margin-right","margin-top","margin-bottom"],SVG_TYPE_D:["pattern","defs","transform","stop","animate","radialGradient","linearGradient","animateMotion","use","filter","feColorMatrix"],SVG_TYPE_G:["svg","rect","circle","path","polygon","text","g","line","foreignObject"],PI:Math.PI,TwoPI:2*Math.PI,pi90:.5*Math.PI,pi60:Math.PI/3,torad:Math.PI/180,todeg:180/Math.PI,clamp:function(t,s,i){return t=(t=t<s?s:t)>i?i:t},size:{w:240,h:20,p:30,s:8},defineColor:function(t,s=e.colors){let i={...s},h=["fontFamily","fontWeight","fontShadow","fontSize"],o=!1;t.font&&(t.fontFamily=t.font),t.shadow&&(t.fontShadow=t.shadow),t.weight&&(t.fontWeight=t.weight),t.fontColor&&(t.text=t.fontColor),t.color&&(t.text=t.color),t.text&&(i.text=t.text,t.fontColor||t.color||(i.title=e.ColorLuma(t.text,-.25),i.titleoff=e.ColorLuma(t.text,-.5)),i.textOver=e.ColorLuma(t.text,.25),i.textSelect=e.ColorLuma(t.text,.5)),t.button&&(i.button=t.button,i.border=e.ColorLuma(t.button,.1),i.overoff=e.ColorLuma(t.button,.2)),t.select&&(i.select=t.select,i.over=e.ColorLuma(t.select,-.1)),t.itemBg&&(t.back=t.itemBg),t.back&&(i.back=t.back,i.backoff=e.ColorLuma(t.back,-.1)),t.fontSelect&&(i.textSelect=t.fontSelect),t.groupBorder&&(i.gborder=t.groupBorder),t.transparent&&(t.bg="none"),t.bg&&(i.background=i.backgroundOver=t.bg),t.bgOver&&(i.backgroundOver=t.bgOver);for(let s in i)t[s]&&(i[s]=t[s]);for(let s in t)-1!==h.indexOf(s)&&(o=!0);return o&&e.defineText(i),i},colors:{content:"none",background:"rgba(50,50,50,0.3)",backgroundOver:"rgba(50,50,50,0.4)",title:"#CCC",titleoff:"#BBB",text:"#DDD",textOver:"#EEE",textSelect:"#FFF",back:"rgba(0,0,0,0.2)",backoff:"rgba(0,0,0,0.3)",border:"#4c4c4c",borderSize:1,gborder:"none",button:"#3c3c3c",overoff:"#5c5c5c",over:"#024699",select:"#308AFF",action:"#FF3300",fontFamily:"Consolas,monaco,monospace",fontWeight:"normal",fontShadow:"#000",fontSize:12,radius:4,hide:"rgba(0,0,0,0)"},css:{basic:"position:absolute; pointer-events:none; box-sizing:border-box; margin:0; padding:0; overflow:hidden; -o-user-select:none; -ms-user-select:none; -khtml-user-select:none; -webkit-user-select:none; -moz-user-select:none;",button:"display:flex; justify-content:center; align-items:center; text-align:center;"},svgs:{group:"M 7 7 L 7 8 8 8 8 7 7 7 M 5 7 L 5 8 6 8 6 7 5 7 M 3 7 L 3 8 4 8 4 7 3 7 M 7 5 L 7 6 8 6 8 5 7 5 M 6 6 L 6 5 5 5 5 6 6 6 M 7 3 L 7 4 8 4 8 3 7 3 M 6 4 L 6 3 5 3 5 4 6 4 M 3 5 L 3 6 4 6 4 5 3 5 M 3 3 L 3 4 4 4 4 3 3 3 Z",arrow:"M 3 8 L 8 5 3 2 3 8 Z",arrowDown:"M 5 8 L 8 3 2 3 5 8 Z",arrowUp:"M 5 2 L 2 7 8 7 5 2 Z",solid:"M 13 10 L 13 1 4 1 1 4 1 13 10 13 13 10 M 11 3 L 11 9 9 11 3 11 3 5 5 3 11 3 Z",body:"M 13 10 L 13 1 4 1 1 4 1 13 10 13 13 10 M 11 3 L 11 9 9 11 3 11 3 5 5 3 11 3 M 5 4 L 4 5 4 10 9 10 10 9 10 4 5 4 Z",vehicle:"M 13 6 L 11 1 3 1 1 6 1 13 3 13 3 11 11 11 11 13 13 13 13 6 M 2.4 6 L 4 2 10 2 11.6 6 2.4 6 M 12 8 L 12 10 10 10 10 8 12 8 M 4 8 L 4 10 2 10 2 8 4 8 Z",articulation:"M 13 9 L 12 9 9 2 9 1 5 1 5 2 2 9 1 9 1 13 5 13 5 9 4 9 6 5 8 5 10 9 9 9 9 13 13 13 13 9 Z",character:"M 13 4 L 12 3 9 4 5 4 2 3 1 4 5 6 5 8 4 13 6 13 7 9 8 13 10 13 9 8 9 6 13 4 M 6 1 L 6 3 8 3 8 1 6 1 Z",terrain:"M 13 8 L 12 7 Q 9.06 -3.67 5.95 4.85 4.04 3.27 2 7 L 1 8 7 13 13 8 M 3 8 Q 3.78 5.420 5.4 6.6 5.20 7.25 5 8 L 7 8 Q 8.39 -0.16 11 8 L 7 11 3 8 Z",joint:"M 7.7 7.7 Q 8 7.45 8 7 8 6.6 7.7 6.3 7.45 6 7 6 6.6 6 6.3 6.3 6 6.6 6 7 6 7.45 6.3 7.7 6.6 8 7 8 7.45 8 7.7 7.7 M 3.35 8.65 L 1 11 3 13 5.35 10.65 Q 6.1 11 7 11 8.28 11 9.25 10.25 L 7.8 8.8 Q 7.45 9 7 9 6.15 9 5.55 8.4 5 7.85 5 7 5 6.54 5.15 6.15 L 3.7 4.7 Q 3 5.712 3 7 3 7.9 3.35 8.65 M 10.25 9.25 Q 11 8.28 11 7 11 6.1 10.65 5.35 L 13 3 11 1 8.65 3.35 Q 7.9 3 7 3 5.7 3 4.7 3.7 L 6.15 5.15 Q 6.54 5 7 5 7.85 5 8.4 5.55 9 6.15 9 7 9 7.45 8.8 7.8 L 10.25 9.25 Z",ray:"M 9 11 L 5 11 5 12 9 12 9 11 M 12 5 L 11 5 11 9 12 9 12 5 M 11.5 10 Q 10.9 10 10.45 10.45 10 10.9 10 11.5 10 12.2 10.45 12.55 10.9 13 11.5 13 12.2 13 12.55 12.55 13 12.2 13 11.5 13 10.9 12.55 10.45 12.2 10 11.5 10 M 9 10 L 10 9 2 1 1 2 9 10 Z",collision:"M 11 12 L 13 10 10 7 13 4 11 2 7.5 5.5 9 7 7.5 8.5 11 12 M 3 2 L 1 4 4 7 1 10 3 12 8 7 3 2 Z",map:"M 13 1 L 1 1 1 13 13 13 13 1 M 12 2 L 12 7 7 7 7 12 2 12 2 7 7 7 7 2 12 2 Z",material:"M 13 1 L 1 1 1 13 13 13 13 1 M 12 2 L 12 7 7 7 7 12 2 12 2 7 7 7 7 2 12 2 Z",texture:"M 13 4 L 13 1 1 1 1 4 5 4 5 13 9 13 9 4 13 4 Z",object:"M 10 1 L 7 4 4 1 1 1 1 13 4 13 4 5 7 8 10 5 10 13 13 13 13 1 10 1 Z",none:"M 9 5 L 5 5 5 9 9 9 9 5 Z",cursor:"M 4 7 L 1 10 1 12 2 13 4 13 7 10 9 14 14 0 0 5 4 7 Z"},getImput:function(){return!!i.input},setStyle:function(t){for(var s in t)e.colors[s]&&(e.colors[s]=t[s]);e.setText()},defineText:function(t){e.setText(t.fontSize,t.text,t.fontFamily,t.fontShadow,t.fontWeight)},setText:function(t,s,i,h,o){let n=e.colors;void 0===i&&(i=n.fontFamily),void 0===t&&(t=n.fontSize),void 0===h&&(h=n.fontShadow),void 0===o&&(o=n.fontWeight),void 0===s&&(s=n.text);e.css.txt=e.css.basic+"display:flex; justify-content:left; align-items:center; text-align:left;font-family:"+i+"; font-weight:"+o+"; font-size:"+t+"px; color:"+n.text+"; padding:0px 10px; left:0; top:2px; height:16px; width:100px; overflow:hidden; white-space: nowrap;","none"!==h&&(e.css.txt+=" text-shadow: 1px 1px 1px "+h+";"),e.css.txtselect=e.css.txt+"padding:0px 4px; border:1px dashed "+n.border+";",e.css.item=e.css.txt+" position:relative; margin-bottom:1px; display:block; padding:2px 4px;"},cloneCss:function(){return{...e.css}},clone:function(t){return t.cloneNode(!0)},setSvg:function(t,s,i,e,h){-1===e?t.setAttributeNS(null,s,i):void 0!==h?t.childNodes[e||0].childNodes[h||0].setAttributeNS(null,s,i):t.childNodes[e||0].setAttributeNS(null,s,i)},setCss:function(t,s){for(let i in s)-1!==e.DOM_SIZE.indexOf(i)?t.style[i]=s[i]+"px":t.style[i]=s[i]},set:function(t,s){for(let i in s)"txt"===i&&(t.textContent=s[i]),"link"===i?t.setAttributeNS(e.links,"xlink:href",s[i]):t.setAttributeNS(null,i,s[i])},get:function(t,s){if(void 0===s)return t;if(!isNaN(s))return t.childNodes[s];if(s instanceof Array){if(2===s.length)return t.childNodes[s[0]].childNodes[s[1]];if(3===s.length)return t.childNodes[s[0]].childNodes[s[1]].childNodes[s[2]]}},dom:function(t,s,i,h,o){return t=t||"div",-1!==e.SVG_TYPE_D.indexOf(t)||-1!==e.SVG_TYPE_G.indexOf(t)?"svg"===t?(h=document.createElementNS(e.svgns,"svg"),e.set(h,i)):(void 0===h&&(h=document.createElementNS(e.svgns,"svg")),e.addAttributes(h,t,i,o)):h=void 0===h?document.createElementNS(e.htmls,t):h.appendChild(document.createElementNS(e.htmls,t)),s&&(h.style.cssText=s),void 0===o?h:h.childNodes[o||0]},addAttributes:function(t,s,i,h){let o=document.createElementNS(e.svgns,s);return e.set(o,i),e.get(t,h).appendChild(o),-1!==e.SVG_TYPE_G.indexOf(s)&&(o.style.pointerEvents="none"),o},clear:function(t){for(e.purge(t);t.firstChild;)t.firstChild.firstChild&&e.clear(t.firstChild),t.removeChild(t.firstChild)},purge:function(t){let s,i,h=t.attributes;if(h)for(s=h.length;s--;)i=h[s].name,"function"==typeof t[i]&&(t[i]=null);if(h=t.childNodes,h)for(s=h.length;s--;)e.purge(t.childNodes[s])},addSVGGlowEffect:function(){if(null!==document.getElementById("UILGlow"))return;let t=e.initUILEffects(),s=e.addAttributes(t,"filter",{id:"UILGlow",x:"-20%",y:"-20%",width:"140%",height:"140%"});e.addAttributes(s,"feGaussianBlur",{in:"SourceGraphic",stdDeviation:"3",result:"uilBlur"});let i=e.addAttributes(s,"feMerge",{});for(let t=0;t<=3;t++)e.addAttributes(i,"feMergeNode",{in:"uilBlur"});e.addAttributes(i,"feMergeNode",{in:"SourceGraphic"})},initUILEffects:function(){let t=document.getElementById("UILSVGEffects");return null===t&&(t=e.dom("svg",void 0,{id:"UILSVGEffects",width:"0",height:"0"}),document.body.appendChild(t)),t},ColorLuma:function(t,s){"n"===t&&(t="#000"),(t=String(t).replace(/[^0-9a-f]/gi,"")).length<6&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),s=s||0;let i,e,h="#";for(e=0;e<3;e++)i=parseInt(t.substr(2*e,2),16),i=Math.round(Math.min(Math.max(0,i+i*s),255)).toString(16),h+=("00"+i).substr(i.length);return h},findDeepInver:function(t){return.3*t[0]+.59*t[1]+.11*t[2]<=.6},lerpColor:function(t,s,i){let e={};for(let h=0;h<3;h++)e[h]=t[h]+(s[h]-t[h])*i;return e},hexToHtml:function(t){return"#"+("000000"+(t=void 0===t?0:t).toString(16)).substr(-6)},htmlToHex:function(t){return t.toUpperCase().replace("#","0x")},u255:function(t,s){return parseInt(t.substring(s,s+2),16)/255},u16:function(t,s){return parseInt(t.substring(s,s+1),16)/15},unpack:function(t){return 7==t.length?[e.u255(t,1),e.u255(t,3),e.u255(t,5)]:4==t.length?[e.u16(t,1),e.u16(t,2),e.u16(t,3)]:void 0},p255:function(t){let s=Math.round(255*t).toString(16);return s.length<2&&(s="0"+s),s},pack:function(t){return"#"+e.p255(t[0])+e.p255(t[1])+e.p255(t[2])},htmlRgb:function(t){return"rgb("+Math.round(255*t[0])+","+Math.round(255*t[1])+","+Math.round(255*t[2])+")"},pad:function(t){return 1==t.length&&(t="0"+t),t},rgbToHex:function(t){let s=Math.round(255*t[0]).toString(16),i=Math.round(255*t[1]).toString(16),h=Math.round(255*t[2]).toString(16);return"#"+e.pad(s)+e.pad(i)+e.pad(h)},hueToRgb:function(t,s,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(s-t)*i:i<.5?s:i<2/3?t+6*(s-t)*(2/3-i):t},rgbToHsl:function(t){let s=t[0],i=t[1],e=t[2],h=Math.min(s,i,e),o=Math.max(s,i,e),n=o-h,r=0,l=0,a=(h+o)/2;return a>0&&a<1&&(l=n/(a<.5?2*a:2-2*a)),n>0&&(o==s&&o!=i&&(r+=(i-e)/n),o==i&&o!=e&&(r+=2+(e-s)/n),o==e&&o!=s&&(r+=4+(s-i)/n),r/=6),[r,l,a]},hslToRgb:function(t){let s,i,h=t[0],o=t[1],n=t[2];return 0===o?[n,n,n]:(i=n<=.5?n*(o+1):n+o-n*o,s=2*n-i,[e.hueToRgb(s,i,h+.33333),e.hueToRgb(s,i,h),e.hueToRgb(s,i,h-.33333)])},makeGradiant:function(t,s,i,h){e.dom(t,null,s,i,0);let o,n=i.childNodes[0].childNodes.length-1;for(let t=0;t<h.length;t++)o=h[t],e.dom("stop",null,{offset:o[0]+"%","stop-color":o[1],"stop-opacity":o[2]},i,[0,n])},makePad:function(t){let s=256,i=e.dom("svg",e.css.basic+"position:relative;",{viewBox:"0 0 256 256",width:s,height:s,preserveAspectRatio:"none"}),o=200,n=28;h.dom("rect","",{x:n,y:n,width:o,height:o,fill:e.colors.back},i),h.dom("rect","",{x:38,y:38,width:180,height:180,fill:e.colors.button},i),h.dom("line","",{x1:38,y1:128,x2:218,y2:128,stroke:e.colors.back,"stroke-width":2},i),h.dom("line","",{x1:128,x2:128,y1:38,y2:218,stroke:e.colors.back,"stroke-width":2},i),h.dom("circle","",{cx:128,cy:128,r:5,stroke:e.colors.text,"stroke-width":5,fill:"none"},i),e.pad2d=i},makeKnob:function(t){let s=128,i=e.dom("svg",e.css.basic+"position:relative;",{viewBox:"0 0 128 "+s,width:s,height:s,preserveAspectRatio:"none"});e.dom("circle","",{cx:64,cy:64,r:34,fill:e.colors.button,stroke:"rgba(0,0,0,0.3)","stroke-width":8},i),e.dom("path","",{d:"",stroke:e.colors.text,"stroke-width":4,fill:"none","stroke-linecap":"round"},i),e.dom("circle","",{cx:64,cy:64,r:41,stroke:"rgba(0,0,0,0.1)","stroke-width":7,fill:"none"},i),e.dom("path","",{d:"",stroke:"rgba(255,255,255,0.3)","stroke-width":2,fill:"none","stroke-linecap":"round","stroke-opacity":.5},i),e.knob=i},makeCircular:function(t){let s=128,i=e.dom("svg",e.css.basic+"position:relative;",{viewBox:"0 0 128 "+s,width:s,height:s,preserveAspectRatio:"none"});e.dom("circle","",{cx:64,cy:64,r:40,stroke:"rgba(0,0,0,0.1)","stroke-width":10,fill:"none"},i),e.dom("path","",{d:"",stroke:e.colors.text,"stroke-width":7,fill:"none","stroke-linecap":"butt"},i),e.circular=i},makeJoystick:function(t){let s,i=128,h=Math.floor(49),o=Math.floor(.6*h),n=e.dom("svg",e.css.basic+"position:relative;",{viewBox:"0 0 128 "+i,width:i,height:i,preserveAspectRatio:"none"});if(e.dom("defs",null,{},n),e.dom("g",null,{},n),0===t){s=[[40,"rgb(0,0,0)",.3],[80,"rgb(0,0,0)",0],[90,"rgb(50,50,50)",.4],[100,"rgb(50,50,50)",0]],e.makeGradiant("radialGradient",{id:"grad",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},n,s),s=[[60,"rgb(0,0,0)",.5],[100,"rgb(0,0,0)",0]],e.makeGradiant("radialGradient",{id:"gradS",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},n,s);let t=["rgb(40,40,40)","rgb(48,48,48)","rgb(30,30,30)"],i=["rgb(1,90,197)","rgb(3,95,207)","rgb(0,65,167)"];s=[[30,t[0],1],[60,t[1],1],[80,t[1],1],[100,t[2],1]],e.makeGradiant("radialGradient",{id:"gradIn",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},n,s),s=[[30,i[0],1],[60,i[1],1],[80,i[1],1],[100,i[2],1]],e.makeGradiant("radialGradient",{id:"gradIn2",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},n,s),e.dom("circle","",{cx:64,cy:64,r:h,fill:"url(#grad)"},n),e.dom("circle","",{cx:69,cy:74,r:o+10,fill:"url(#gradS)"},n),e.dom("circle","",{cx:64,cy:64,r:o,fill:"url(#gradIn)"},n),e.joystick_0=n}else s=[[69,"rgb(0,0,0)",0],[70,"rgb(0,0,0)",.3],[100,"rgb(0,0,0)",0]],e.makeGradiant("radialGradient",{id:"gradX",cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"},n,s),e.dom("circle","",{cx:64,cy:64,r:h,fill:"none",stroke:"rgba(100,100,100,0.25)","stroke-width":"4"},n),e.dom("circle","",{cx:64,cy:64,r:o+14,fill:"url(#gradX)"},n),e.dom("circle","",{cx:64,cy:64,r:o,fill:"none",stroke:"rgb(100,100,100)","stroke-width":"4"},n),e.joystick_1=n},makeColorRing:function(){let t=256,s=e.dom("svg",e.css.basic+"position:relative;",{viewBox:"0 0 256 "+t,width:t,height:t,preserveAspectRatio:"none"});e.dom("defs",null,{},s),e.dom("g",null,{},s);let i,h,o,n,r,l,a,c,d,u=128,p=8/113/24*Math.PI,m=0,g=[];for(l=0;l<=24;++l){if(o=l/24,n=o*e.TwoPI,i=.5*(m+n),h=1/Math.cos(.5*(n-m)),r=[Math.sin(m),-Math.cos(m),Math.sin(i)*h,-Math.cos(i)*h,Math.sin(n),-Math.cos(n)],g[1]=e.rgbToHex(e.hslToRgb([o,1,.5])),l>0){for(a=6;a--;)r[a]=(113*r[a]+u).toFixed(2);c=" M"+r[0]+" "+r[1]+" Q"+r[2]+" "+r[3]+" "+r[4]+" "+r[5],d=[[0,g[0],1],[100,g[1],1]],e.makeGradiant("linearGradient",{id:"G"+l,x1:r[0],y1:r[1],x2:r[4],y2:r[5],gradientUnits:"userSpaceOnUse"},s,d),e.dom("path","",{d:c,"stroke-width":30,stroke:"url(#G"+l+")","stroke-linecap":"butt"},s,1)}m=n-p,g[0]=g[1]}d=[[0,"#FFFFFF",1],[50,"#FFFFFF",0],[50,"#000000",0],[100,"#000000",1]],e.makeGradiant("linearGradient",{id:"GL0",x1:0,y1:u-84.9,x2:0,y2:212.9,gradientUnits:"userSpaceOnUse"},s,d),d=[[0,"#7f7f7f",1],[50,"#7f7f7f",.5],[100,"#7f7f7f",0]],e.makeGradiant("linearGradient",{id:"GL1",x1:78.95,y1:0,x2:226,y2:0,gradientUnits:"userSpaceOnUse"},s,d),e.dom("g",null,{"transform-origin":"128px 128px",transform:"rotate(0)"},s),e.dom("polygon","",{points:"78.95 43.1 78.95 212.85 226 128",fill:"red"},s,2),e.dom("polygon","",{points:"78.95 43.1 78.95 212.85 226 128",fill:"url(#GL1)","stroke-width":1,stroke:"url(#GL1)"},s,2),e.dom("polygon","",{points:"78.95 43.1 78.95 212.85 226 128",fill:"url(#GL0)","stroke-width":1,stroke:"url(#GL0)"},s,2),e.dom("path","",{d:"M 255.75 136.5 Q 256 132.3 256 128 256 123.7 255.75 119.5 L 241 128 255.75 136.5 Z",fill:"none","stroke-width":2,stroke:"#000"},s,2),e.dom("circle","",{cx:128,cy:128,r:6,"stroke-width":2,stroke:"#000",fill:"none"},s),e.colorRing=s},icon:function(t,s,i){i=i||40;let h=["<svg xmlns='"+e.svgns+"' version='1.1' xmlns:xlink='"+e.htmls+"' style='pointer-events:none;' preserveAspectRatio='xMinYMax meet' x='0px' y='0px' width='"+i+"px' height='"+i+"px' viewBox='0 0 256 256'><g>"];switch(t){case"logo":h[1]="<path id='logoin' fill='"+s+"' stroke='none' d='"+e.logoFill_d+"'/>";break;case"neo":h[1]="<path id='logoin' fill='"+s+"' stroke='none' d='"+e.logo_neo+"'/>";break;case"github":h[1]="<path id='logoin' fill='"+s+"' stroke='none' d='"+e.logo_github+"'/>";break;case"save":h[1]="<path stroke='"+s+"' stroke-width='4' stroke-linejoin='round' stroke-linecap='round' fill='none' d='M 26.125 17 L 20 22.95 14.05 17 M 20 9.95 L 20 22.95'/><path stroke='"+s,h[1]+="' stroke-width='2.5' stroke-linejoin='round' stroke-linecap='round' fill='none' d='M 32.6 23 L 32.6 25.5 Q 32.6 28.5 29.6 28.5 L 10.6 28.5 Q 7.6 28.5 7.6 25.5 L 7.6 23'/>"}return h[2]="</g></svg>",h.join("\n")},logoFill_d:"\n\t\tM 171 150.75 L 171 33.25 155.5 33.25 155.5 150.75 Q 155.5 162.2 147.45 170.2 139.45 178.25 128 178.25 116.6 178.25 108.55 170.2 100.5 162.2 100.5 150.75 \n\t\tL 100.5 33.25 85 33.25 85 150.75 Q 85 168.65 97.55 181.15 110.15 193.75 128 193.75 145.9 193.75 158.4 181.15 171 168.65 171 150.75 \n\t\tM 200 33.25 L 184 33.25 184 150.8 Q 184 174.1 167.6 190.4 151.3 206.8 128 206.8 104.75 206.8 88.3 190.4 72 174.1 72 150.8 L 72 33.25 56 33.25 56 150.75 \n\t\tQ 56 180.55 77.05 201.6 98.2 222.75 128 222.75 157.8 222.75 178.9 201.6 200 180.55 200 150.75 L 200 33.25 Z\n\t\t",logo_github:"\n\t\tM 180.5 70 Q 186.3 82.4 181.55 96.55 196.5 111.5 189.7 140.65 183.65 168.35 146 172.7 152.5 178.7 152.55 185.9 L 152.55 218.15 Q 152.84 224.56 159.15 223.3 \n\t\t159.21 223.3 159.25 223.3 181.14 216.25 198.7 198.7 228 169.4 228 128 228 86.6 198.7 57.3 169.4 28 128 28 86.6 28 57.3 57.3 28 86.6 28 128 28 169.4 57.3 198.7 74.85 \n\t\t216.25 96.75 223.3 96.78 223.3 96.8 223.3 103.16 224.54 103.45 218.15 L 103.45 200 Q 82.97 203.1 75.1 196.35 69.85 191.65 68.4 185.45 64.27 177.055 59.4 174.15 49.20 \n\t\t166.87 60.8 167.8 69.85 169.61 75.7 180 81.13 188.09 90 188.55 98.18 188.86 103.45 185.9 103.49 178.67 110 172.7 72.33 168.33 66.3 140.65 59.48 111.49 74.45 96.55 69.7 \n\t\t82.41 75.5 70 84.87 68.74 103.15 80 115.125 76.635 128 76.85 140.85 76.65 152.85 80 171.1 68.75 180.5 70 Z\n\t\t",logo_neo:"\n\t\tM 219 52 L 206 52 206 166 Q 206 183.4 193.75 195.65 181.4 208 164 208 146.6 208 134.35 195.65 122 183.4 122 166 L 122 90 Q 122 77.6 113.15 68.85 104.4 60 92 60 79.55 \n\t\t60 70.75 68.85 62 77.6 62 90 L 62 204 75 204 75 90 Q 75 83 79.95 78 84.95 73 92 73 99 73 104 78 109 83 109 90 L 109 166 Q 109 188.8 125.15 204.85 141.2 221 164 221 \n\t\t186.75 221 202.95 204.85 219 188.8 219 166 L 219 52 M 194 52 L 181 52 181 166 Q 181 173 176.05 178 171.05 183 164 183 157 183 152 178 147 173 147 166 L 147 90 Q 147 \n\t\t67.2 130.85 51.15 114.8 35 92 35 69.25 35 53.05 51.15 37 67.2 37 90 L 37 204 50 204 50 90 Q 50 72.6 62.25 60.35 74.6 48 92 48 109.4 48 121.65 60.35 134 72.6 134 90 L \n\t\t134 166 Q 134 178.4 142.85 187.15 151.6 196 164 196 176.45 196 185.25 187.15 194 178.4 194 166 L 194 52 Z\n\t\t"};e.setText();const h=e;class o{constructor(t=0,s=0){this.x=t,this.y=s}set(t,s){return this.x=t,this.y=s,this}divide(t){return this.x/=t.x,this.y/=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divideScalar(t){return this.multiplyScalar(1/t)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}angle(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t}addScalar(t){return this.x+=t,this.y+=t,this}negate(){return this.x*=-1,this.y*=-1,this}neg(){return this.x=-1,this.y=-1,this}isZero(){return 0===this.x&&0===this.y}copy(t){return this.x=t.x,this.y=t.y,this}equals(t){return t.x===this.x&&t.y===this.y}nearEquals(t,s){return t.x.toFixed(s)===this.x.toFixed(s)&&t.y.toFixed(s)===this.y.toFixed(s)}lerp(t,s){return null===t?(this.x-=this.x*s,this.y-=this.y*s):(this.x+=(t.x-this.x)*s,this.y+=(t.y-this.y)*s),this}}class n{constructor(t={}){this.lock=t.lock||!1,this.neverlock=!1,this.isSpace=t.isSpace||!1,this.main=t.main||null,this.isUI=t.isUI||!1,this.group=t.group||null,this.isListen=!1,this.isSelectable=void 0!==t.selectable&&t.selectable,this.unselectable=void 0!==t.unselect?t.unselect:this.isSelectable,this.ontop=!!t.ontop&&t.ontop,this.css=this.main?this.main.css:h.css,this.colors=h.defineColor(t,this.main?this.group?this.group.colors:this.main.colors:h.colors),this.svgs=h.svgs,this.zone={x:0,y:0,w:0,h:0},this.local=(new o).neg(),this.isCanvasOnly=!1,this.isSelect=!1,this.p=void 0!==t.p?t.p:h.size.p,this.w=this.isUI?this.main.size.w:h.size.w,void 0!==t.w&&(this.w=t.w),this.h=this.isUI?this.main.size.h:h.size.h,void 0!==t.h&&(this.h=t.h),this.isSpace?this.lock=!0:this.h=this.h<11?11:this.h,this.autoWidth=t.auto||!0,this.isOpen=!1,this.radius=t.radius||this.colors.radius,this.transition=t.transition||h.transition,this.isNumber=!1,this.noNeg=t.noNeg||!1,this.allEqual=t.allEqual||!1,this.mono=!1,this.isEdit=!1,this.simple=t.simple||!1,this.simple&&(this.sa=0),this.setSize(this.w),void 0!==t.sa&&(this.sa=t.sa),void 0!==t.sb&&(this.sb=t.sb),this.simple&&(this.sb=this.w-this.sa),this.sc=void 0===t.sc?47:t.sc,this.objectLink=null,this.isSend=!1,this.val=null,this.txt=t.name||"",this.name=t.rename||this.txt,this.target=t.target||null,this.callback=void 0===t.callback?null:t.callback,this.endCallback=null,this.openCallback=void 0===t.openCallback?null:t.openCallback,this.closeCallback=void 0===t.closeCallback?null:t.closeCallback,null===this.callback&&this.isUI&&null!==this.main.callback&&(this.callback=this.group?this.group.callback:this.main.callback),this.c=[],this.s=[],this.useFlex=!!this.isUI&&this.main.useFlex;let s=this.useFlex?"disply:flex; justify-content:center; align-items:center; text-align:center; flex: 1 100%;":"float:left;";if(this.c[0]=h.dom("div",this.css.basic+s+"position:relative; height:20px;"),this.s[0]=this.c[0].style,this.margin=t.margin||1,this.isUI&&this.margin&&(this.s[0].boxSizing="content-box",.5*this.margin===Math.floor(.5*this.margin)?(this.s[0].borderTop=.5*this.margin+"px solid transparent",this.s[0].borderBottom=.5*this.margin+"px solid transparent"):this.s[0].borderBottom=this.margin+"px solid transparent"),this.simple||(this.c[1]=h.dom("div",this.css.txt),this.s[1]=this.c[1].style,this.c[1].textContent=this.name,this.s[1].color=this.lock?this.colors.titleoff:this.colors.title),t.pos){this.s[0].position="absolute";for(let s in t.pos)this.s[0][s]=t.pos[s];this.mono=!0}t.css&&(this.s[0].cssText=t.css)}init(){this.zone.h=this.h,this.zone.w=this.w;let t=this.s,s=this.c;t[0].height=this.h+"px",this.isUI&&(t[0].background=this.colors.background),!this.autoWidth&&this.useFlex?(t[0].flex="1 0 auto",t[0].minWidth=this.minw+"px",t[0].textAlign="center"):this.isUI&&(t[0].width="100%"),void 0!==s[1]&&this.autoWidth&&(t[1]=s[1].style,t[1].height=this.h-4+"px",t[1].lineHeight=this.h-8+"px");let e=h.frag;for(let i=1,h=s.length;i!==h;i++)void 0!==s[i]&&(e.appendChild(s[i]),t[i]=s[i].style);let o=null!==this.target?this.target:this.isUI?this.main.inner:document.body;this.ontop?o.insertAdjacentElement("afterbegin",s[0]):o.appendChild(s[0]),s[0].appendChild(e),this.rSize(),this.isUI||(this.c[0].style.pointerEvents="auto",i.add(this)),this.baseH&&this.transition&&this.isUI&&(this.c[0].style.transition="height "+this.transition+"s ease-out")}dom(t,s,i,e,o){return h.dom(t,s,i,e,o)}setSvg(t,s,i,e,o){h.setSvg(t,s,i,e,o)}setCss(t,s){h.setCss(t,s)}clamp(t,s,i){return h.clamp(t,s,i)}getColorRing(){return h.colorRing||h.makeColorRing(),h.clone(h.colorRing)}getJoystick(t){return h["joystick_"+t]||h.makeJoystick(t),h.clone(h["joystick_"+t])}getCircular(t){return h.circular||h.makeCircular(t),h.clone(h.circular)}getKnob(t){return h.knob||h.makeKnob(t),h.clone(h.knob)}getPad2d(t){return h.pad2d||h.makePad(t),h.clone(h.pad2d)}cursor(t){i.cursor(t)}update(){}reset(){}getDom(){return this.c[0]}uiout(){this.lock||this.s&&(this.s[0].background=this.colors.background)}uiover(){this.lock||this.s&&(this.s[0].background=this.colors.backgroundOver)}rename(t){void 0!==this.c[1]&&(this.c[1].textContent=t)}listen(){return this.isListen=i.addListen(this),this}listening(){null!==this.objectLink&&(this.isSend||this.isEdit||this.setValue(this.objectLink[this.val]))}setValue(t){this.isNumber?this.value=this.numValue(t):this.value=t,this.update()}onChange(t){if(!this.isSpace)return this.callback=t||null,this}onFinishChange(t){if(!this.isSpace)return this.callback=null,this.endCallback=t,this}onOpen(t){return this.openCallback=t,this}onClose(t){return this.closeCallback=t,this}send(t){(t=t||this.value)instanceof Array&&1===t.length&&(t=t[0]),this.isSend=!0,null!==this.objectLink&&(this.objectLink[this.val]=t),this.callback&&this.callback(t,this.val),this.isSend=!1}sendEnd(t){(t=t||this.value)instanceof Array&&1===t.length&&(t=t[0]),this.endCallback&&this.endCallback(t),null!==this.objectLink&&(this.objectLink[this.val]=t)}dispose(){this.isListen&&i.removeListen(this),h.clear(this.c[0]),null!==this.target?null!==this.group?this.group.clearOne(this):this.target.removeChild(this.c[0]):this.isUI?this.main.clearOne(this):document.body.removeChild(this.c[0]),this.isUI||i.remove(this),this.c=null,this.s=null,this.callback=null,this.target=null,this.isListen=!1}clear(){}getWidth(){let t=i.getWidth(this);t&&(this.w=t)}setSize(t){if(this.autoWidth)if(this.w=t,this.simple)this.sb=this.w-this.sa;else{let t=this.w*(this.p/100);this.sa=Math.floor(t+10),this.sb=Math.floor(this.w-t-20)}}rSize(){this.autoWidth&&(this.isUI||(this.s[0].width=this.w+"px"),this.simple||(this.s[1].width=this.sa+"px"))}setTypeNumber(t){let s;switch(this.isNumber=!0,this.value=0,void 0!==t.value&&("string"==typeof t.value?this.value=1*t.value:this.value=t.value),this.min=void 0===t.min?-1/0:t.min,this.max=void 0===t.max?1/0:t.max,this.precision=void 0===t.precision?2:t.precision,this.precision){case 0:s=1;break;case 1:s=.1;break;case 2:s=.01;break;case 3:s=.001;break;case 4:s=1e-4;break;case 5:s=1e-5}this.step=void 0===t.step?s:t.step,this.range=this.max-this.min,this.value=this.numValue(this.value)}numValue(t){return this.noNeg&&(t=Math.abs(t)),1*Math.min(this.max,Math.max(this.min,t)).toFixed(this.precision)}handleEvent(t){if(!this.lock)return this.neverlock&&(i.lock=!1),this[t.type]?this[t.type](t):console.error(t.type,"this type of event no existe !")}wheel(t){return!1}mousedown(t){return!1}mousemove(t){return!1}mouseup(t){return!1}keydown(t){return!1}keyup(t){return!1}setReferency(t,s){this.objectLink=t,this.val=s}display(t){t=t||!1,this.s[0].visibility=t?"visible":"hidden"}open(){this.isOpen||(this.isOpen=!0,this.openCallback&&this.openCallback())}close(){this.isOpen&&(this.isOpen=!1,this.closeCallback&&this.closeCallback())}needZone(){i.needReZone=!0}rezone(){i.needReZone=!0}select(){}unselect(){}setInput(t){i.setInput(t,this)}upInput(t,s){return i.upInput(t,s)}selected(t){this.isSelect=t||!1}}class r extends n{constructor(t={}){super(t),this.value=t.value||!1,this.model=void 0!==t.mode?t.mode:0,this.onName=t.rename||this.txt,t.onName&&(t.onname=t.onName),t.onname&&(this.onName=t.onname),this.inh=t.inh||Math.floor(.8*this.h),this.inw=t.inw||36;let s=this.colors;if(0===this.model){let t=Math.floor(.5*this.h)-.5*(this.inh-2);this.c[2]=this.dom("div",this.css.basic+"background:"+s.inputBg+"; height:"+(this.inh-2)+"px; width:"+this.inw+"px; top:"+t+"px; border-radius:10px; border:2px solid "+s.back),this.c[3]=this.dom("div",this.css.basic+"height:"+(this.inh-6)+"px; width:16px; top:"+(t+2)+"px; border-radius:10px; background:"+s.button+";")}else this.p=0,void 0!==this.c[1]&&(this.c[1].textContent=""),this.c[2]=this.dom("div",this.css.txt+this.css.button+"top:1px; background:"+s.button+"; height:"+(this.h-2)+"px; border:1px solid "+s.border+"; border-radius:"+this.radius+"px;");this.stat=-1,this.init(),this.update()}mousedown(t){return this.value=!this.value,this.update(!0),this.mousemove(t)}mousemove(t){return this.cursor("pointer"),this.mode(!0)}reset(){return this.cursor(),this.mode()}mode(t){let s,i,e,h=!1,o=this.colors,n=this.value;if(e=t?n?4:3:n?2:1,this.stat!==e){if(this.stat=e,0!==this.model){switch(s=this.s[2],e){case 1:s.color=o.text,s.background=o.button;break;case 2:s.color=o.textSelect,s.background=o.select;break;case 3:s.color=o.textOver,s.background=o.overoff;break;case 4:s.color=o.textOver,s.background=o.over}this.c[2].innerHTML=n?this.onName:this.name}else{switch(s=this.s[2],i=this.s[3],e){case 1:s.background=s.borderColor=o.back,i.background=o.button;break;case 2:s.background=s.borderColor=o.select,i.background=o.button;break;case 3:s.background=s.borderColor=o.back,i.background=o.overoff;break;case 4:s.background=s.borderColor=o.select,i.background=o.over}this.s[3].marginLeft=n?"17px":"2px",this.c[1].textContent=n?this.onName:this.name}h=!0}return h}update(t){this.mode(),t&&this.send()}rSize(){super.rSize();let t=this.s,s=this.w-10-this.inw;0===this.model?(t[2].left=s+"px",t[3].left=s+"px"):(t[2].left=this.sa+"px",t[2].width=this.w-20+"px")}}class l extends n{constructor(t={}){super(t),this.value=t.value||"",this.values=t.value||this.txt,t.values&&(this.values=t.values),this.onName=t.onName||null,this.on=!1,this.customSize=t.forceWidth||-1,"string"==typeof this.values&&(this.values=[this.values]),this.isDown=!1,this.neverlock=!0,this.isLoadButton=t.loader||!1,this.isDragButton=t.drag||!1,this.res=0,this.isDragButton&&(this.isLoadButton=!0),this.lng=this.values.length,this.tmp=[],this.stat=[];let s,i=this.colors;for(let t=0;t<this.lng;t++)s=!1,this.values[t]===this.value&&this.isSelectable&&(s=!0),this.c[t+2]=this.dom("div",this.css.txt+this.css.button+"top:1px; height:"+(this.h-2)+"px; border:"+i.borderSize+"px solid "+i.border+"; border-radius:"+this.radius+"px;"),this.c[t+2].style.background=s?i.select:i.button,this.c[t+2].style.color=s?i.textSelect:i.text,this.c[t+2].innerHTML=this.values[t],this.stat[t]=s?3:1;t.value&&t.values?this.txt||(this.p=0):(void 0!==this.c[1]&&(this.c[1].textContent=""),this.p=void 0!==t.p?t.p:0),this.isLoadButton&&this.initLoader(),this.isDragButton&&(this.lng++,this.initDrager()),this.init()}onOff(){this.on=!this.on,this.label(this.on?this.onName:this.txt)}testZone(t){let s=this.local;if(-1===s.x&&-1===s.y)return-1;let i=this.lng,e=this.tmp;for(;i--;)if(s.x>e[i][0]&&s.x<e[i][2])return i;return-1}mouseup(t){return!!this.isDown&&(this.isDown=!1,-1!==this.res&&(this.value===this.values[this.res]&&this.unselectable?this.value="":this.value=this.values[this.res],null!==this.onName&&this.onOff(),this.isLoadButton||this.send()),this.mousemove(t))}mousedown(t){return!this.isDown&&(this.isDown=!0,this.mousemove(t))}mousemove(t){let s=!1;return this.res=this.testZone(t),-1!==this.res?(this.cursor("pointer"),s=this.modes(this.isDown?3:2,this.res)):s=this.reset(),s}modes(t=1,s=-1){let i,e,h=this.lng,o=!1;for(;h--;)e=t,i=!!this.isSelectable&&this.values[h]===this.value,h===s?i&&2===e&&(e=3):(e=1,i&&(e=4)),o=this.mode(e,h);return o}mode(t,s){let i=!1,e=this.colors,h=this.s,o=s+2;if(this.stat[s]!==t){switch(this.stat[s]=t,t){case 1:h[o].color=e.text,h[o].background=e.button;break;case 2:h[o].color=e.textOver,h[o].background=e.overoff;break;case 3:h[o].color=e.textOver,h[o].background=e.over;break;case 4:h[o].color=e.textSelect,h[o].background=e.select}i=!0}return i}reset(){return this.res=-1,this.cursor(),this.modes()}dragover(t){t.preventDefault(),this.s[4].borderColor=this.colors.select,this.s[4].color=this.colors.select}dragend(t){t.preventDefault(),this.s[4].borderColor=this.color.text,this.s[4].color=this.color.text}drop(t){t.preventDefault(),this.dragend(t),this.fileSelect(t.dataTransfer.files[0])}initDrager(){this.c[4]=this.dom("div",this.css.txt+" text-align:center; line-height:"+(this.h-8)+"px; border:1px dashed "+this.color.text+"; top:2px;\theight:"+(this.h-4)+"px; border-radius:"+this.radius+"px; pointer-events:auto;"),this.c[4].textContent="DRAG",this.c[4].addEventListener("dragover",function(t){this.dragover(t)}.bind(this),!1),this.c[4].addEventListener("dragend",function(t){this.dragend(t)}.bind(this),!1),this.c[4].addEventListener("dragleave",function(t){this.dragend(t)}.bind(this),!1),this.c[4].addEventListener("drop",function(t){this.drop(t)}.bind(this),!1)}initLoader(){this.c[3]=this.dom("input",this.css.basic+"top:0px; opacity:0; height:"+this.h+"px; pointer-events:auto; cursor:pointer;"),this.c[3].name="loader",this.c[3].type="file",this.c[3].addEventListener("change",function(t){this.fileSelect(t.target.files[0])}.bind(this),!1)}fileSelect(t){if(void 0===t)return;let s=new FileReader,i=t.name,e=i.substring(i.lastIndexOf(".")+1,i.length);-1!==["png","jpg","mp4","webm","ogg"].indexOf(e)?s.readAsDataURL(t):-1!==["sea","z","hex","bvh","BVH","glb"].indexOf(e)?s.readAsArrayBuffer(t):s.readAsText(t),s.onload=function(t){this.callback&&this.callback(t.target.result,i,e)}.bind(this)}label(t,s){s=s||2,this.c[s].textContent=t}icon(t,s=0,i=2){return this.s[i].padding=s+"px 0px",this.c[i].innerHTML=t,this}rSize(){super.rSize();let t=this.s,s=this.sb,i=this.sa,e=this.lng,h=Math.floor((s-3*(e-1))/e);for(-1!==this.customSize&&(h=this.customSize);e--;)this.tmp[e]=[Math.floor(i+h*e+3*e),h],this.tmp[e][2]=this.tmp[e][0]+this.tmp[e][1],t[e+2].left=this.tmp[e][0]+"px",t[e+2].width=this.tmp[e][1]+"px";this.isDragButton&&(t[4].left=i+h+3+"px",t[4].width=h+"px"),this.isLoadButton&&(t[3].left=i+"px",t[3].width=h+"px")}}class a extends n{constructor(t={}){super(t),this.isCyclic=t.cyclic||!1,this.model=t.stype||0,void 0!==t.mode&&(this.model=t.mode),this.autoWidth=!1,this.minw=this.w,this.diam=t.diam||this.w,this.setTypeNumber(t),this.twoPi=h.TwoPI,this.pi90=h.pi90,this.offset=new o,this.h=t.h||this.w+10,this.top=0,this.c[0].style.width=this.w+"px",void 0!==this.c[1]&&(this.c[1].style.width="100%",this.c[1].style.justifyContent="center",this.top=10,this.h+=10),this.percent=0,this.cmode=0;let s=this.colors;this.c[2]=this.dom("div",this.css.txt+"justify-content:center; top:"+(this.h-20)+"px; width:100%; color:"+s.text),this.c[3]=this.getCircular(),this.setSvg(this.c[3],"stroke",s.back,0),this.setSvg(this.c[3],"d",this.makePath(),1),this.setSvg(this.c[3],"stroke",s.text,1),this.setSvg(this.c[3],"viewBox","0 0 "+this.diam+" "+this.diam),this.setCss(this.c[3],{width:this.diam,height:this.diam,left:0,top:this.top}),this.init(),this.update()}mode(t){if(this.cmode===t)return!1;let s,i=this.colors;switch(t){case 0:this.s[2].color=i.text,this.setSvg(this.c[3],"stroke",i.back,0),s=this.model>0?h.pack(h.lerpColor(h.unpack(h.ColorLuma(i.text,-.75)),h.unpack(i.text),this.percent)):i.text,this.setSvg(this.c[3],"stroke",s,1);break;case 1:this.s[2].color=i.textOver,this.setSvg(this.c[3],"stroke",i.backoff,0),s=this.model>0?h.pack(h.lerpColor(h.unpack(h.ColorLuma(i.text,-.75)),h.unpack(i.text),this.percent)):i.textOver,this.setSvg(this.c[3],"stroke",s,1)}return this.cmode=t,!0}reset(){this.isDown=!1}testZone(t){let s=this.local;return-1===s.x&&-1===s.y?"":s.y<=this.c[1].offsetHeight?"title":s.y>this.h-this.c[2].offsetHeight?"text":"circular"}mouseup(t){return this.isDown=!1,this.sendEnd(),this.mode(0)}mousedown(t){return this.isDown=!0,this.old=this.value,this.oldr=null,this.mousemove(t),this.mode(1)}mousemove(t){if(!this.isDown)return;let s=this.offset;if(s.x=.5*this.w-(t.clientX-this.zone.x),s.y=.5*this.diam-(t.clientY-this.zone.y-this.top),this.r=s.angle()-this.pi90,this.r=(this.r%this.twoPi+this.twoPi)%this.twoPi,null!==this.oldr){let t=this.r-this.oldr;this.r=Math.abs(t)>Math.PI?this.oldr:this.r,t>6&&(this.r=0),t<-6&&(this.r=this.twoPi)}let i=1/this.twoPi,e=this.r*i,h=this.range*e+this.min-this.old;(h>=this.step||h<=this.step)&&(h=~~(h/this.step),this.value=this.numValue(this.old+h*this.step),this.update(!0),this.old=this.value,this.oldr=this.r)}wheel(t){if("circular"===this.testZone(t)){let s=this.value-this.step*t.delta;return s>this.max?s=this.isCyclic?this.min:this.max:s<this.min&&(s=this.isCyclic?this.max:this.min),this.setValue(s),this.old=s,this.update(!0),!0}return!1}makePath(){let t=40,s=this.percent*this.twoPi-.001,i=t+t*Math.sin(s)+24,e=t-t*Math.cos(s)+24;return"M 64,24 A 40,40 0 "+(s>Math.PI?1:0)+" 1 "+i+","+e}update(t){if(this.c[2].textContent=this.value,this.percent=(this.value-this.min)/this.range,this.setSvg(this.c[3],"d",this.makePath(),1),this.model>0){let t=this.colors,s=h.pack(h.lerpColor(h.unpack(h.ColorLuma(t.text,-.75)),h.unpack(t.text),this.percent));this.setSvg(this.c[3],"stroke",s,1)}t&&this.send()}}class c extends n{constructor(t={}){super(t),this.ctype=t.ctype||"hex",this.wfixe=256,this.cw=this.sb>256?256:this.sb,null!=t.cw&&(this.cw=t.cw),this.side=t.side||"down",this.up="down"===this.side?0:1,this.baseH=this.h,this.offset=new o,this.decal=new o,this.pp=new o,this.c[2]=this.dom("div",this.css.txt+"height:"+(this.h-4)+"px;border-radius:"+this.radius+"px; line-height:"+(this.h-8)+"px;"),this.s[2]=this.c[2].style,this.s[2].textShadow="none",this.up&&(this.s[2].top="auto",this.s[2].bottom="2px"),this.c[3]=this.getColorRing(),this.c[3].style.visibility="hidden",this.hsl=null,this.value="#ffffff",void 0!==t.value&&(t.value instanceof Array?this.value=h.rgbToHex(t.value):isNaN(t.value)?this.value=t.value:this.value=h.hexToHtml(t.value)),this.bcolor=null,this.isDown=!1,this.fistDown=!1,this.notext=t.notext||!1,this.tr=98,this.tsl=Math.sqrt(3)*this.tr,this.hue=0,this.d=256,this.setColor(this.value),this.init(),void 0!==t.open&&this.open()}testZone(t,s){let i=this.local;return-1===i.x&&-1===i.y?"":this.up&&this.isOpen?i.y>this.wfixe?"title":"color":i.y<this.baseH+2?"title":this.isOpen?"color":void 0}mouseup(t){this.isDown=!1,this.d=256}mousedown(t){let s=this.testZone(t.clientX,t.clientY);if("title"===s)return this.isOpen?this.close():this.open(),!0;"color"===s&&(this.isDown=!0,this.fistDown=!0,this.mousemove(t))}mousemove(t){let s,i,e,o,n,r,l,a,c,d=this.testZone(t.clientX,t.clientY),u=h;if("title"===d&&this.cursor("pointer"),"color"===d&&(s=this.offset,s.x=t.clientX-(this.zone.x+this.decal.x+this.mid),s.y=t.clientY-(this.zone.y+this.decal.y+this.mid),i=s.length()*this.ratio,c=s.angle(),c<0&&(c+=2*u.PI),i<128?this.cursor("crosshair"):this.isDown||this.cursor(),this.isDown&&(this.fistDown&&(this.d=i,this.fistDown=!1),this.d<128)))if(this.d>this.tr)e=(c+u.pi90)/u.TwoPI,this.hue=(e+1)%1,this.setHSL([(e+1)%1,this.hsl[1],this.hsl[2]]);else{l=s.x*this.ratio,a=s.y*this.ratio;let t=this.hue*u.TwoPI+u.PI;t<0&&(t+=2*u.PI),r=Math.atan2(-a,l),r<0&&(r+=2*u.PI);let i=(r+u.pi90+u.TwoPI+t)%u.TwoPI,e=i%(2/3*u.PI)-u.pi60,h=.5*this.tr,c=Math.tan(e)*h,d=Math.sqrt(l*l+a*a),p=Math.sqrt(h*h+c*c);if(d>p){let s=Math.tan(e)*d,o=Math.atan(s/p);o>u.pi60?o=u.pi60:o<-u.pi60&&(o=-u.pi60),r+=o-e,i=(r+u.pi90+u.TwoPI+t)%u.TwoPI,e=i%(2/3*u.PI)-u.pi60,c=Math.tan(e)*h,d=p=Math.sqrt(h*h+c*c)}n=Math.sin(i)*d/this.tsl+.5;let m=1-2*Math.abs(n-.5);o=(Math.cos(i)*d+this.tr/2)/(1.5*this.tr)/m,o=u.clamp(o,0,1),this.setHSL([this.hsl[0],o,n])}}setHeight(){this.h=this.isOpen?this.wfixe+this.baseH+5:this.baseH,this.s[0].height=this.h+"px",this.zone.h=this.h}parentHeight(t){null!==this.group?this.group.calc(t):this.isUI&&this.main.calc(t)}open(){super.open(),this.setHeight(),this.up&&(this.zone.y-=this.wfixe+5);let t=this.h-this.baseH;this.s[3].visibility="visible",this.parentHeight(t)}close(){super.close(),this.up&&(this.zone.y+=this.wfixe+5);let t=this.h-this.baseH;this.setHeight(),this.s[3].visibility="hidden",this.parentHeight(-t)}update(t){let s=h.rgbToHex(h.hslToRgb([this.hsl[0],1,.5]));this.moveMarkers(),this.value=this.bcolor,this.setSvg(this.c[3],"fill",s,2,0),this.s[2].background=this.bcolor,this.notext||(this.c[2].textContent=h.htmlToHex(this.bcolor)),this.invert=h.findDeepInver(this.rgb),this.s[2].color=this.invert?"#fff":"#000",t&&("array"===this.ctype&&this.send(this.rgb),"rgb"===this.ctype&&this.send(h.htmlRgb(this.rgb)),"hex"===this.ctype&&this.send(h.htmlToHex(this.value)),"html"===this.ctype&&this.send())}setValue(t){t instanceof Array?this.value=h.rgbToHex(t):isNaN(t)?this.value=t:this.value=h.hexToHtml(t),this.setColor(this.value),this.update()}setColor(t){let s=h.unpack(t);return this.bcolor!==t&&s&&(this.bcolor=t,this.rgb=s,this.hsl=h.rgbToHsl(this.rgb),this.hue=this.hsl[0],this.update()),this}setHSL(t){return this.hsl=t,this.rgb=h.hslToRgb(t),this.bcolor=h.rgbToHex(this.rgb),this.update(!0),this}moveMarkers(){let t=this.pp,s=h;this.invert;let i=this.hsl[0]*s.TwoPI,e=2/3*s.PI,o=this.tr,n=this.hsl[0],r=this.hsl[1],l=this.hsl[2],a=(i-s.pi90)*s.todeg;n=-i+s.pi90;let c=Math.cos(n)*o,d=-Math.sin(n)*o,u=Math.cos(n-e)*o,p=-Math.sin(n-e)*o,m=Math.cos(n+e)*o,g=-Math.sin(n+e)*o,x=(u+m)/2,v=(p+g)/2;i=(1-2*Math.abs(l-.5))*r;let f=u+(m-u)*l+(c-x)*i,b=p+(g-p)*l+(d-v)*i;t.set(f,b).addScalar(128),this.setSvg(this.c[3],"transform","rotate("+a+" )",2),this.setSvg(this.c[3],"cx",t.x,3),this.setSvg(this.c[3],"cy",t.y,3),this.setSvg(this.c[3],"stroke",this.invert?"#fff":"#000",2,3),this.setSvg(this.c[3],"stroke",this.invert?"#fff":"#000",3),this.setSvg(this.c[3],"fill",this.bcolor,3)}rSize(){super.rSize();let t=this.s;t[2].width=this.sb+"px",t[2].left=this.sa+"px",this.rSizeColor(this.cw),this.decal.x=Math.floor(.5*(this.w-this.wfixe))}rSizeColor(t){if(t===this.wfixe)return;this.wfixe=t;let s=this.s;this.decal.y="up"===this.side?2:this.baseH+2,this.mid=Math.floor(.5*this.wfixe),this.setSvg(this.c[3],"viewBox","0 0 "+this.wfixe+" "+this.wfixe),s[3].width=this.wfixe+"px",s[3].height=this.wfixe+"px",s[3].top=this.decal.y+"px",this.ratio=256/this.wfixe,this.square=1/(this.wfixe/256*60),this.setHeight()}}class d extends n{constructor(t={}){super(t),this.round=Math.round,this.baseH=this.h,this.hplus=t.hplus||50,this.res=t.res||40,this.l=1,this.precision=t.precision||0,this.custom=t.custom||!1,this.names=t.names||["FPS","MS"];let s=t.cc||["220,220,220","255,255,0"];this.adding=t.adding||!1,this.range=t.range||[165,100,100],this.alpha=t.alpha||.25,this.values=[],this.points=[],this.textDisplay=[],this.custom||(this.now=i.getTime(),this.startTime=0,this.prevTime=0,this.frames=0,this.ms=0,this.fps=0,this.mem=0,this.mm=0,this.isMem=!(!self.performance||!self.performance.memory),this.isMem&&(this.names.push("MEM"),s.push("0,255,255")),this.txt=t.name||"Fps");let e=Math.floor(.5*this.h)-6;this.c[1].textContent=this.txt,this.c[0].style.cursor="pointer",this.c[0].style.pointerEvents="auto";let h="display:none; left:10px; top:"+this.h+"px; height:"+(this.hplus-8)+"px; box-sizing:border-box; background: rgba(0, 0, 0, 0.2); border:1px solid "+this.colors.border+";";0!==this.radius&&(h+="border-radius:"+this.radius+"px;"),this.c[2]=this.dom("path",this.css.basic+h,{}),this.c[2].setAttribute("viewBox","0 0 "+this.res+" 50"),this.c[2].setAttribute("height","100%"),this.c[2].setAttribute("width","100%"),this.c[2].setAttribute("preserveAspectRatio","none"),this.c[3]=this.dom("path",this.css.basic+"position:absolute; width:10px; height:10px; left:4px; top:"+e+"px;",{d:this.svgs.arrow,fill:this.colors.text,stroke:"none"}),this.c[4]=this.dom("div",this.css.txt+"position:absolute; left:10px; top:"+(this.h+2)+"px; display:none; width:100%; text-align:center;"),t.bottomLine&&(this.c[4]=this.dom("div",this.css.basic+"width:100%; bottom:0px; height:1px; background: rgba(255, 255, 255, 0.2);")),this.isShow=!1;let o=this.s;o[1].marginLeft="10px",o[1].lineHeight=this.h-4,o[1].color=this.colors.text,o[1].fontWeight="bold",0!==this.radius&&(o[0].borderRadius=this.radius+"px"),"none"!==this.colors.gborder&&(o[0].border="1px solid "+this.colors.gborder);let n=0;for(n=0;n<this.names.length;n++){let t=[],i=this.res+1;for(;i--;)t.push(50);this.range[n]=1/this.range[n]*49,this.points.push(t),this.values.push(0),this.textDisplay.push("<span style='color:rgb("+s[n]+")'> "+this.names[n]+" ")}for(n=this.names.length;n--;)this.dom("path",null,{fill:"rgba("+s[n]+","+this.alpha+")","stroke-width":1,stroke:"rgba("+s[n]+",1)","vector-effect":"non-scaling-stroke"},this.c[2]);this.init()}mousedown(t){this.isShow?this.close():this.open()}tick(t){this.values=t,this.isShow&&(this.drawGraph(),this.upText())}makePath(t){let s="";s+="M -1 50";for(let i=0;i<this.res+1;i++)s+=" L "+i+" "+t[i];return s+=" L "+(this.res+1)+" 50",s}upText(t){let s=t||this.values,i="";for(let t=0,e=this.names.length;t<e;t++)i+=this.textDisplay[t]+s[t].toFixed(this.precision)+"</span>";this.c[4].innerHTML=i}drawGraph(){let t,s=this.c[2],i=this.names.length,e=0,h=0;for(;i--;)t=this.adding?(this.values[h]+e)*this.range[h]:this.values[h]*this.range[h],this.points[h].shift(),this.points[h].push(50-t),this.setSvg(s,"d",this.makePath(this.points[h]),i+1),e+=this.values[h],h++}open(){super.open(),this.h=this.hplus+this.baseH,this.setSvg(this.c[3],"d",this.svgs.arrowDown),null!==this.group?this.group.calc(this.hplus):this.isUI&&this.main.calc(this.hplus),this.s[0].height=this.h+"px",this.s[2].display="block",this.s[4].display="block",this.isShow=!0,this.custom||i.addListen(this)}close(){super.close(),this.h=this.baseH,this.setSvg(this.c[3],"d",this.svgs.arrow),null!==this.group?this.group.calc(-this.hplus):this.isUI&&this.main.calc(-this.hplus),this.s[0].height=this.h+"px",this.s[2].display="none",this.s[4].display="none",this.isShow=!1,this.custom||i.removeListen(this),this.c[4].innerHTML=""}begin(){this.startTime=this.now()}end(){let t=this.now();if(this.ms=t-this.startTime,this.frames++,t>this.prevTime+1e3&&(this.fps=this.round(1e3*this.frames/(t-this.prevTime)),this.prevTime=t,this.frames=0,this.isMem)){let t=performance.memory.usedJSHeapSize,s=performance.memory.jsHeapSizeLimit;this.mem=this.round(954e-9*t),this.mm=t/s}return this.values=[this.fps,this.ms,this.mm],this.drawGraph(),this.upText([this.fps,this.ms,this.mem]),t}listening(){this.custom||(this.startTime=this.end())}rSize(){let t=this.s,s=this.w;t[0].width=s+"px",t[1].width=s+"px",t[2].left="10px",t[2].width=s-20+"px",t[4].width=s-20+"px"}}class u extends n{constructor(t={}){super(t),this.value=void 0!==t.value?t.value:[0,0,0],this.lng=this.value.length,this.precision=void 0!==t.precision?t.precision:2,this.multiplicator=t.multiplicator||1,this.neg=t.neg||!1,this.line=void 0===t.line||t.line,this.autoWidth=void 0===t.autoWidth||t.autoWidth,this.isNumber=!1,this.isDown=!1,this.h=t.h||138,this.rh=this.h-10,this.top=0,this.c[0].style.width=this.w+"px",void 0!==this.c[1]&&(this.c[1].style.width=this.w+"px",this.autoWidth||(this.c[1].style.width="100%",this.c[1].style.justifyContent="center"),this.top=10,this.h+=10),this.gh=this.rh-28,this.gw=this.w-28,this.c[2]=this.dom("div",this.css.txt+"display:block; text-align:center; padding:0px 0px; top:"+(this.h-20)+"px; left:14px; width:"+this.gw+"px;\tcolor:"+this.colors.text),this.c[2].innerHTML=this.valueToHtml();let s=this.dom("svg",this.css.basic,{viewBox:"0 0 "+this.w+" "+this.rh,width:this.w,height:this.rh,preserveAspectRatio:"none"});this.setCss(s,{width:this.w,height:this.rh,left:0,top:this.top}),this.dom("path","",{d:"",stroke:this.colors.text,"stroke-width":2,fill:"none","stroke-linecap":"butt"},s),this.dom("rect","",{x:10,y:10,width:this.gw+8,height:this.gh+8,stroke:"rgba(0,0,0,0.3)","stroke-width":1,fill:"none"},s),this.iw=(this.gw-4*(this.lng-1))/this.lng;let i=[];this.cMode=[],this.v=[];for(let t=0;t<this.lng;t++)i[t]=[14+t*this.iw+4*t,this.iw],i[t][2]=i[t][0]+i[t][1],this.cMode[t]=0,this.neg?this.v[t]=.5*(1+this.value[t]/this.multiplicator):this.v[t]=this.value[t]/this.multiplicator,this.dom("rect","",{x:i[t][0],y:14,width:i[t][1],height:1,fill:this.colors.text,"fill-opacity":.3},s);this.tmp=i,this.c[3]=s,this.init(),void 0!==this.c[1]&&(this.c[1].style.top="0px",this.c[1].style.height="20px",this.s[1].lineHeight="15px"),this.update(!1)}setValue(t){this.value=t,this.lng=this.value.length;for(var s=0;s<this.lng;s++)this.neg?this.v[s]=.5*(1+t[s]/this.multiplicator):this.v[s]=t[s]/this.multiplicator;this.update()}valueToHtml(){let t=this.lng,s=0,i='<table style="width:100%;"><tr>',e="width:"+100/this.lng+"%;";for(;t--;)s===this.lng-1?i+="<td style="+e+">"+this.value[s]+"</td></tr></table>":i+="<td style="+e+">"+this.value[s]+"</td>",s++;return i}updateSVG(){this.line&&this.setSvg(this.c[3],"d",this.makePath(),0);for(let t=0;t<this.lng;t++)this.setSvg(this.c[3],"height",this.v[t]*this.gh,t+2),this.setSvg(this.c[3],"y",this.gh-this.v[t]*this.gh+14,t+2),this.neg?this.value[t]=1*((2*this.v[t]-1)*this.multiplicator).toFixed(this.precision):this.value[t]=1*(this.v[t]*this.multiplicator).toFixed(this.precision);this.c[2].innerHTML=this.valueToHtml()}testZone(t){let s=this.local;if(-1===s.x&&-1===s.y)return"";let i=this.lng,e=this.tmp;if(s.y>this.top&&s.y<this.h-20)for(;i--;)if(s.x>e[i][0]&&s.x<e[i][2])return i;return""}mode(t,s){if(t===this.cMode[s])return!1;let i;switch(t){case 0:i=.3;break;case 1:i=.6;break;case 2:i=1}return this.reset(),this.setSvg(this.c[3],"fill-opacity",i,s+2),this.cMode[s]=t,!0}reset(){let t=!1,s=this.lng;for(;s--;)0!==this.cMode[s]&&(this.cMode[s]=0,this.setSvg(this.c[3],"fill-opacity",.3,s+2),t=!0);return t}mouseup(t){if(this.isDown=!1,-1!==this.current)return this.reset()}mousedown(t){return this.isDown=!0,this.mousemove(t)}mousemove(t){let s=!1,i=this.testZone(t);return""===i?s=this.reset():(s=this.mode(this.isDown?2:1,i),this.isDown&&(this.v[i]=this.clamp(1-(t.clientY-this.zone.y-this.top-10)/this.gh,0,1),this.update(!0))),s}update(t){this.updateSVG(),t&&this.send()}makePath(){let t,s,i,e,h,o,n="";for(let r=0;r<this.lng;r++)t=this.gh-this.v[r]*this.gh+14,s=14+r*this.iw+4*r,e=s+.5*this.iw,i=s+this.iw,n+=0===r?"M "+s+" "+t+" T "+e+" "+t:" C "+h+" "+o+","+s+" "+t+","+e+" "+t,r===this.lng-1&&(n+=" T "+i+" "+t),h=i,o=t;return n}rSize(){super.rSize();let t=this.s;void 0!==this.c[1]&&(t[1].width=this.w+"px"),t[3].width=this.w+"px";let s=this.w-28,i=(s-4*(this.lng-1))/this.lng,e=[];t[2].width=s+"px";for(let t=0;t<this.lng;t++)e[t]=[14+t*i+4*t,i],e[t][2]=e[t][0]+e[t][1];this.tmp=e}}class p extends n{constructor(t={}){super(t),this.isGroup=!0,this.ADD=t.add,this.uis=[],this.isEmpty=!0,this.autoHeight=!0,this.current=-1,this.targetIn=null,this.decal=0,this.baseH=this.h;let s=Math.floor(.5*this.h)-6;this.isLine=void 0!==t.line&&t.line,this.decal=0,t.group&&(this.decal=t.group.decal?t.group.decal:0,this.decal+=6),this.useFlex=!0;let i=this.useFlex?"display:flex; flex-flow: row wrap;":"";this.c[2]=this.dom("div",this.css.basic+i+"width:100%; left:0; height:auto; overflow:hidden; top:"+this.h+"px"),this.c[3]=this.dom("path",this.css.basic+"position:absolute; width:10px; height:10px; left:0; top:"+s+"px;",{d:this.svgs.group,fill:this.colors.text,stroke:"none"}),this.c[4]=this.dom("path",this.css.basic+"position:absolute; width:10px; height:10px; left:"+(4+this.decal)+"px; top:"+s+"px;",{d:this.svgs.arrow,fill:this.colors.text,stroke:"none"}),this.isLine&&(this.c[5]=this.dom("div",this.css.basic+"background:rgba(255, 255, 255, 0.2); width:100%; left:0; height:1px; bottom:0px"));let e=this.s;e[0].height=this.h+"px",e[1].height=this.h+"px",this.c[1].name="group",e[1].marginLeft=10+this.decal+"px",e[1].lineHeight=this.h-4,e[1].color=this.colors.text,e[1].fontWeight="bold",0!==this.radius&&(e[0].borderRadius=this.radius+"px"),this.init(),this.setBG(t.bg),void 0!==t.open&&this.open()}testZone(t){let s=this.local;if(-1===s.x&&-1===s.y)return"";let i="";return s.y<this.baseH?i="title":this.isOpen&&(i="content"),i}clearTarget(){return-1!==this.current&&(this.targetIn.uiout(),this.targetIn.reset(),this.current=-1,this.targetIn=null,this.cursor(),!0)}reset(){this.clearTarget()}handleEvent(t){let s=t.type,e=!1,h=!1,o=this.testZone(t);if(o){switch(o){case"content":this.cursor(),i.isMobile&&"mousedown"===s&&this.getNext(t,e),this.targetIn&&(h=this.targetIn.handleEvent(t)),i.lock||this.getNext(t,e);break;case"title":this.cursor("pointer"),"mousedown"===s&&(this.isOpen?this.close():this.open())}return this.isDown&&(e=!0),h&&(e=!0),e}}getNext(t,s){let e=i.findTarget(this.uis,t);e!==this.current&&(this.clearTarget(),this.current=e),-1!==e&&(this.targetIn=this.uis[this.current],this.targetIn.uiover())}setBG(t){void 0!==t&&(this.colors.background=t),this.c[0].style.background=this.colors.background;let s=this.uis.length;for(;s--;)this.uis[s].setBG(this.colors.background)}add(){let t=arguments;"object"==typeof t[1]?(t[1].isUI=this.isUI,t[1].target=this.c[2],t[1].main=this.main,t[1].group=this):"string"==typeof arguments[1]&&(void 0===t[2]?[].push.call(t,{isUI:!0,target:this.c[2],main:this.main}):(t[2].isUI=!0,t[2].target=this.c[2],t[2].main=this.main,t[2].group=this));let s=this.ADD.apply(this,t);return this.uis.push(s),this.isEmpty=!1,s}remove(t){t.dispose&&t.dispose()}dispose(){this.clear(),this.isUI&&this.main.calc(),super.dispose()}clear(){this.empty()}empty(){this.close();let t,s=this.uis.length;for(;s--;)t=this.uis.pop(),this.c[2].removeChild(t.c[0]),t.clear(!0);this.isEmpty=!0,this.h=this.baseH}clearOne(t){let s=this.uis.indexOf(t);-1!==s&&(this.calc(-(this.uis[s].h+1)),this.c[2].removeChild(this.uis[s].c[0]),this.uis.splice(s,1),0===this.uis.length&&(this.isEmpty=!0,this.close()))}open(){super.open(),this.setSvg(this.c[4],"d",this.svgs.arrowDown),this.rSizeContent(),this.h,this.baseH,this.parentHeight()}close(){super.close(),this.h,this.baseH,this.setSvg(this.c[4],"d",this.svgs.arrow),this.h=this.baseH,this.s[0].height=this.h+"px",this.parentHeight()}calcUis(){this.isOpen?this.h=i.calcUis(this.uis,this.zone,this.zone.y+this.baseH)+this.baseH:this.h=this.baseH,this.s[0].height=this.h+"px"}parentHeight(t){null!==this.group?this.group.calc(t):this.isUI&&this.main.calc(t)}calc(t){this.isOpen&&(this.isUI?this.main.calc():this.calcUis(),this.s[0].height=this.h+"px")}rSizeContent(){let t=this.uis.length;for(;t--;)this.uis[t].setSize(this.w),this.uis[t].rSize()}rSize(){super.rSize();let t=this.s;t[3].left=this.sa+this.sb-17+"px",t[1].width=this.w+"px",t[2].width=this.w+"px",this.isOpen&&this.rSizeContent()}}class m extends n{constructor(t={}){super(t),this.autoWidth=!1,this.value=[0,0],this.minw=this.w,this.diam=t.diam||this.w,this.joyType="analogique",this.model=void 0!==t.mode?t.mode:0,this.precision=t.precision||2,this.multiplicator=t.multiplicator||1,this.pos=new o,this.tmp=new o,this.interval=null,this.distance=.5*this.diam*.25,this.h=t.h||this.w+10,this.top=0,this.c[0].style.width=this.w+"px",void 0!==this.c[1]&&(this.c[1].style.width="100%",this.c[1].style.justifyContent="center",this.top=10,this.h+=10);let s=this.colors;this.c[2]=this.dom("div",this.css.txt+"justify-content:center; top:"+(this.h-20)+"px; width:100%; color:"+s.text),this.c[2].textContent=this.value,this.c[3]=this.getJoystick(this.model),this.setSvg(this.c[3],"viewBox","0 0 "+this.diam+" "+this.diam),this.setCss(this.c[3],{width:this.diam,height:this.diam,left:0,top:this.top}),this.ratio=128/this.w,this.init(),this.update(!1)}mode(t){let s=this.colors;switch(t){case 0:0===this.model?(this.setSvg(this.c[3],"fill","url(#gradIn)",4),this.setSvg(this.c[3],"stroke","#000",4)):(this.setSvg(this.c[3],"stroke","rgba(100,100,100,0.25)",2),this.setSvg(this.c[3],"stroke","#666",4),this.setSvg(this.c[3],"fill","none",4));break;case 1:0===this.model?(this.setSvg(this.c[3],"fill","url(#gradIn2)",4),this.setSvg(this.c[3],"stroke","rgba(0,0,0,0)",4)):(this.setSvg(this.c[3],"stroke","rgba(48,138,255,0.25)",2),this.setSvg(this.c[3],"stroke",s.select,4),this.setSvg(this.c[3],"fill","rgba(48,138,255,0.25)",4))}}addInterval(){null!==this.interval&&this.stopInterval(),this.pos.isZero()||(this.interval=setInterval(function(){this.update()}.bind(this),10))}stopInterval(){null!==this.interval&&(clearInterval(this.interval),this.interval=null)}reset(){this.addInterval(),this.mode(0)}mouseup(t){this.addInterval(),this.isDown=!1}mousedown(t){this.isDown=!0,this.mousemove(t),this.mode(2)}mousemove(t){if(this.mode(1),!this.isDown)return;if(this.tmp.x=.5*this.w-(t.clientX-this.zone.x),this.tmp.y=.5*this.diam-(t.clientY-this.zone.y-this.top),this.tmp.length()>this.distance){let t=Math.atan2(this.tmp.x,this.tmp.y);this.tmp.x=Math.sin(t)*this.distance,this.tmp.y=Math.cos(t)*this.distance}this.pos.copy(this.tmp).divideScalar(this.distance).negate(),this.update()}setValue(t){void 0===t&&(t=[0,0]),this.pos.set(t[0]||0,t[1]||0),this.updateSVG()}update(t){void 0===t&&(t=!0),null!==this.interval&&(this.isDown||(this.pos.lerp(null,.3),this.pos.x=Math.abs(this.pos.x)<.01?0:this.pos.x,this.pos.y=Math.abs(this.pos.y)<.01?0:this.pos.y,this.isUI&&this.main.isCanvas&&this.main.draw())),this.updateSVG(),t&&this.send(),this.pos.isZero()&&this.stopInterval()}updateSVG(){let t=.5*this.diam- -this.pos.x*this.distance,s=.5*this.diam- -this.pos.y*this.distance;if(0===this.model){let i=t+5*this.pos.x+5,e=s+5*this.pos.y+10;this.setSvg(this.c[3],"cx",i*this.ratio,3),this.setSvg(this.c[3],"cy",e*this.ratio,3)}else this.setSvg(this.c[3],"cx",t*this.ratio,3),this.setSvg(this.c[3],"cy",s*this.ratio,3);this.setSvg(this.c[3],"cx",t*this.ratio,4),this.setSvg(this.c[3],"cy",s*this.ratio,4),this.value[0]=1*(this.pos.x*this.multiplicator).toFixed(this.precision),this.value[1]=1*(this.pos.y*this.multiplicator).toFixed(this.precision),this.c[2].textContent=this.value}clear(){this.stopInterval(),super.clear()}}class g extends n{constructor(t={}){super(t),this.isCyclic=t.cyclic||!1,this.model=t.stype||0,void 0!==t.mode&&(this.model=t.mode),this.autoWidth=!1,this.setTypeNumber(t),this.minw=this.w,this.diam=t.diam||this.w,this.mPI=.8*Math.PI,this.toDeg=180/Math.PI,this.cirRange=2*this.mPI,this.offset=new o,this.h=t.h||this.w+10,this.top=0,this.c[0].style.width=this.w+"px",void 0!==this.c[1]&&(this.c[1].style.width="100%",this.c[1].style.justifyContent="center",this.top=10,this.h+=10),this.percent=0,this.cmode=0;let s=this.colors;this.c[2]=this.dom("div",this.css.txt+"justify-content:center; top:"+(this.h-20)+"px; width:100%; color:"+s.text),this.c[3]=this.getKnob(),this.setSvg(this.c[3],"fill",s.button,0),this.setSvg(this.c[3],"stroke",s.text,1),this.setSvg(this.c[3],"stroke",s.text,3),this.setSvg(this.c[3],"d",this.makeGrad(),3),this.setSvg(this.c[3],"viewBox","0 0 "+this.diam+" "+this.diam),this.setCss(this.c[3],{width:this.diam,height:this.diam,left:0,top:this.top}),this.model>0&&(h.dom("path","",{d:"",stroke:s.text,"stroke-width":2,fill:"none","stroke-linecap":"round"},this.c[3]),2==this.model&&(h.addSVGGlowEffect(),this.setSvg(this.c[3],"style",'filter: url("#UILGlow");',4))),this.r=0,this.init(),this.update()}mode(t){let s=this.colors;if(this.cmode===t)return!1;switch(t){case 0:this.s[2].color=s.text,this.setSvg(this.c[3],"fill",s.button,0),this.setSvg(this.c[3],"stroke",s.text,1);break;case 1:this.s[2].color=s.textOver,this.setSvg(this.c[3],"fill",s.select,0),this.setSvg(this.c[3],"stroke",s.textOver,1)}return this.cmode=t,!0}testZone(t){let s=this.local;return-1===s.x&&-1===s.y?"":s.y<=this.c[1].offsetHeight?"title":s.y>this.h-this.c[2].offsetHeight?"text":"knob"}mouseup(t){return this.isDown=!1,this.sendEnd(),this.mode(0)}mousedown(t){return this.isDown=!0,this.old=this.value,this.oldr=null,this.mousemove(t),this.mode(1)}mousemove(t){if(!this.isDown)return;let s=this.offset;s.x=.5*this.w-(t.clientX-this.zone.x),s.y=.5*this.diam-(t.clientY-this.zone.y-this.top),this.r=-Math.atan2(s.x,s.y),null!==this.oldr&&(this.r=Math.abs(this.r-this.oldr)>Math.PI?this.oldr:this.r),this.r=this.r>this.mPI?this.mPI:this.r,this.r=this.r<-this.mPI?-this.mPI:this.r;let i=1/this.cirRange,e=(this.r+this.mPI)*i,h=this.range*e+this.min-this.old;(h>=this.step||h<=this.step)&&(h=Math.floor(h/this.step),this.value=this.numValue(this.old+h*this.step),this.update(!0),this.old=this.value,this.oldr=this.r)}wheel(t){if("knob"===this.testZone(t)){let s=this.value-this.step*t.delta;return s>this.max?s=this.isCyclic?this.min:this.max:s<this.min&&(s=this.isCyclic?this.max:this.min),this.setValue(s),this.old=s,this.update(!0),!0}return!1}makeGrad(){let t,s,i,e,h,o,n,r="",l=64,a=Math.PI+this.mPI,c=Math.PI-this.mPI;this.step>5?(s=this.range/this.step,t=(a-c)/s):(t=(a-c)/l*2,s=32);for(let c=0;c<=s;++c)i=a-t*c,e=l+44*Math.sin(i),h=l+44*Math.cos(i),o=l+40*Math.sin(i),n=l+40*Math.cos(i),r+="M"+e+" "+h+" L"+o+" "+n+" ";return r}update(t){this.c[2].textContent=this.value,this.percent=(this.value-this.min)/this.range;let s=Math.PI+this.mPI,i=this.percent*this.cirRange-this.mPI,e=Math.sin(i),o=Math.cos(i),n=25*e+64,r=-25*o+64,l=20*e+64,a=-20*o+64;if(this.setSvg(this.c[3],"d","M "+n+" "+r+" L "+l+" "+a,1),this.model>0){let t=36*Math.sin(s)+64,n=36*Math.cos(s)+64,r=36*e+64,l=-36*o+64,a=i<=Math.PI-this.mPI?0:1;this.setSvg(this.c[3],"d","M "+t+","+n+" A 36,36 1 "+a+" 1 "+r+","+l,4);let c=h.pack(h.lerpColor(h.unpack(h.ColorLuma(this.colors.text,-.75)),h.unpack(this.colors.text),this.percent));this.setSvg(this.c[3],"stroke",c,4)}t&&this.send()}}class x extends n{constructor(t={}){super(t),this.path=t.path||"",this.format=t.format||"",this.isWithImage=""!==this.path,this.preLoadComplete=!1,this.tmpImage={},this.tmpUrl=[];let s=t.align||"center",i=t.scrollSize||10;this.ss=i+1,this.sMode=0,this.tMode=0,this.listOnly=t.listOnly||!1,this.staticTop=t.staticTop||!1,this.isSelectable=this.listOnly,void 0!==t.select&&(t.selectable=t.select),void 0!==t.selectable&&(this.isSelectable=t.selectable),""===this.txt&&(this.p=0);let e=Math.floor(.5*this.h)-5,h=this.colors;if(this.c[2]=this.dom("div",this.css.basic+"top:0; display:none; border-radius:"+this.radius+"px;"),this.c[3]=this.dom("div",this.css.item+"position:absolute; text-align:"+s+"; line-height:"+(this.h-4)+"px; top:1px; background:"+h.button+"; height:"+(this.h-2)+"px; border:1px solid "+h.border+"; border-radius:"+this.radius+"px;"),this.c[4]=this.dom("path",this.css.basic+"position:absolute; width:10px; height:10px; top:"+e+"px;",{d:this.svgs.arrow,fill:h.text,stroke:"none"}),this.scrollerBack=this.dom("div",this.css.basic+"right:0px; width:"+i+"px; background:"+h.back+"; display:none;"),this.scroller=this.dom("div",this.css.basic+"right:"+.5*(i-.25*i)+"px; width:"+.25*i+"px; background:"+h.text+"; display:none; "),this.c[3].style.color=h.text,this.list=[],this.refObject=null,t.list)if(t.list instanceof Array)this.list=t.list;else{this.refObject=t.list;for(let t in this.refObject)this.list.push(t)}this.items=[],this.prevName="",this.baseH=this.h,this.itemHeight=t.itemHeight||this.h-3,this.full=t.full||!1,this.py=0,this.ww=this.sb,this.scroll=!1,this.isDown=!1,this.current=null,this.side=t.side||"down",this.up="down"===this.side?0:1,this.up?(this.c[2].style.top="auto",this.c[3].style.top="auto",this.c[4].style.top="auto",this.c[2].style.bottom=this.h-2+"px",this.c[3].style.bottom="1px",this.c[4].style.bottom=e+"px"):this.c[2].style.top=this.baseH+"px",this.listIn=this.dom("div",this.css.basic+"left:0; top:0; width:100%; background:none;"),this.listIn.name="list",this.topList=0,this.c[2].appendChild(this.listIn),this.c[2].appendChild(this.scrollerBack),this.c[2].appendChild(this.scroller),void 0!==t.value?isNaN(t.value)?this.value=t.value:this.value=this.list[t.value]:this.value=this.list[0],this.isOpenOnStart=t.open||!1,this.listOnly&&(this.baseH=5,this.c[3].style.display="none",this.c[4].style.display="none",this.c[2].style.top=this.baseH+"px",this.isOpenOnStart=!0),this.miniCanvas=t.miniCanvas||!1,this.canvasBg=t.canvasBg||"rgba(0,0,0,0)",this.imageSize=t.imageSize||[20,20],this.drag=t.drag||!1,this.dragout=t.dragout||!1,this.dragstart=t.dragstart||null,this.dragend=t.dragend||null,this.isWithImage&&this.preloadImage(),this.setList(this.list),this.init(),this.isOpenOnStart&&this.open(!0)}preloadImage(){this.preLoadComplete=!1,this.tmpImage={};for(let t=0;t<this.list.length;t++)this.tmpUrl.push(this.list[t]);this.loadOne()}nextImg(){this.tmpUrl.shift(),0===this.tmpUrl.length?(this.preLoadComplete=!0,this.addImages()):this.loadOne()}loadOne(){let t=this,s=this.tmpUrl[0],i=document.createElement("img");i.style.cssText="position:absolute; width:"+t.imageSize[0]+"px; height:"+t.imageSize[1]+"px",i.setAttribute("src",this.path+s+this.format),i.addEventListener("load",(function(){t.imageSize[2]=i.width,t.imageSize[3]=i.height,t.tmpImage[s]=i,t.nextImg()}))}testZone(t){let s=this.local;if(-1===s.x&&-1===s.y)return"";if(this.up&&this.isOpen){if(s.y>this.h-this.baseH)return"title";if(this.scroll&&s.x>this.sa+this.sb-this.ss)return"scroll";if(s.x>this.sa)return this.testItems(s.y-this.baseH)}else{if(s.y<this.baseH+2)return"title";if(this.isOpen){if(this.scroll&&s.x>this.sa+this.sb-this.ss)return"scroll";if(s.x>this.sa)return this.testItems(s.y-this.baseH)}}return""}testItems(t){let s,i,e,h="",o=this.items.length;for(;o--;)if(s=this.items[o],i=s.posy+this.topList,e=s.posy+this.itemHeight+1+this.topList,t>=i&&t<=e)return h="item"+o,this.modeItem(0),this.current=s,this.modeItem(1),h;return h}modeItem(t){if(!this.current)return;this.current.select&&0===t&&(t=2);let s=this.colors;switch(t){case 0:this.current.style.background=s.back,this.current.style.color=s.text;break;case 1:this.current.style.background=s.over,this.current.style.color=s.textOver;break;case 2:this.current.style.background=s.select,this.current.style.color=s.textSelect}}unSelected(){this.current&&(this.modeItem(0),this.current=null)}selected(){this.current&&(this.resetItems(),this.modeItem(2),this.current.select=!0)}resetItems(){let t=this.items.length;for(;t--;)this.items[t].select=!1,this.items[t].style.background=this.colors.back,this.items[t].style.color=this.colors.text}mouseup(t){this.isDown=!1}mousedown(t){let s=this.testZone(t);return!!s&&("scroll"===s?(this.isDown=!0,this.mousemove(t)):"title"===s?(this.modeTitle(2),this.listOnly||(this.isOpen?this.close():this.open())):this.current&&(this.value=this.list[this.current.id],this.isSelectable&&this.selected(),this.send(null!==this.refObject?this.refObject[this.list[this.current.id]]:this.value),this.listOnly||(this.close(),this.setTopItem())),!0)}mousemove(t){let s=!1,i=this.testZone(t);if(!i)return s;if("title"===i)this.unSelected(),this.modeTitle(1),this.cursor("pointer");else if("scroll"===i){if(this.cursor("s-resize"),this.modeScroll(1),this.isDown){this.modeScroll(2);let s=this.zone.y+this.baseH-2;this.update(t.clientY-s-.5*this.sh)}}else this.modeTitle(0),this.modeScroll(0),this.cursor("pointer");return i!==this.prevName&&(s=!0),this.prevName=i,s}wheel(t){return"title"!==this.testZone(t)&&(this.py+=10*t.delta,this.update(this.py),!0)}reset(){this.prevName="",this.unSelected(),this.modeTitle(0),this.modeScroll(0)}modeScroll(t){if(t===this.sMode)return;let s=this.scroller.style,i=this.colors;switch(t){case 0:s.background=i.text;break;case 1:case 2:s.background=i.select}this.sMode=t}modeTitle(t){if(t===this.tMode)return;let s=this.s,i=this.colors;switch(t){case 0:s[3].color=i.text,s[3].background=i.button;break;case 1:s[3].color=i.textOver,s[3].background=i.overoff;break;case 2:s[3].color=i.textSelect,s[3].background=i.overoff}this.tMode=t}clearList(){for(;this.listIn.children.length;)this.listIn.removeChild(this.listIn.lastChild);this.items=[]}setList(t){let s,e;this.clearList(),this.list=t,this.length=this.list.length,this.maxItem=this.full?this.length:5,this.maxItem=this.length<this.maxItem?this.length:this.maxItem,this.maxHeight=this.maxItem*(this.itemHeight+1)+2,this.max=this.length*(this.itemHeight+1)+2,this.ratio=this.maxHeight/this.max,this.sh=this.maxHeight*this.ratio,this.range=this.maxHeight-this.sh,this.c[2].style.height=this.maxHeight+"px",this.scrollerBack.style.height=this.maxHeight+"px",this.scroller.style.height=this.sh+"px",this.max>this.maxHeight&&(this.ww=this.sb-this.ss,this.scroll=!0),this.miniCanvas&&(this.tmpCanvas=document.createElement("canvas"),this.tmpCanvas.width=this.imageSize[0],this.tmpCanvas.height=this.imageSize[1],this.tmpCtx=this.tmpCanvas.getContext("2d"),this.tmpCtx.fillStyle=this.canvasBg,this.tmpCtx.fillRect(0,0,this.imageSize[0],this.imageSize[1]));for(let t=0;t<this.length;t++){if(e=this.list[t],s=this.dom("div",this.css.item+"width:"+this.ww+"px; height:"+this.itemHeight+"px; line-height:"+(this.itemHeight-5)+"px; color:"+this.colors.text+"; background:"+this.colors.back+";"),s.name="item"+t,s.id=t,s.select=!1,s.posy=(this.itemHeight+1)*t,this.listIn.appendChild(s),this.items.push(s),e===this.value&&(this.current=s),this.isWithImage||(s.textContent=e),this.miniCanvas){let t=new Image;t.src=this.tmpCanvas.toDataURL(),t.style.cssText="position:relative; pointer-events:none; display:inline-block; float:left; margin-left:0px; margin-right:5px; top:2px",s.appendChild(t),this.tmpImage[e]=t}this.dragout&&(s.img=this.tmpImage[e],s.style.pointerEvents="auto",s.draggable="true",s.addEventListener("dragstart",this.dragstart||function(){}),s.addEventListener("drag",this.drag||function(){}),s.addEventListener("dragleave",(function(){i.fakeUp()})),s.addEventListener("dragend",this.dragend||function(){}.bind(this)))}this.setTopItem(),this.isSelectable&&this.selected()}drawImage(t,s,i,e,h,o){this.tmpCtx.clearRect(0,0,this.imageSize[0],this.imageSize[1]),this.tmpCtx.drawImage(s,i,e,h,o,0,0,this.imageSize[0],this.imageSize[1]),this.tmpImage[t].src=this.tmpCanvas.toDataURL()}addImages(){let t=this.list.length;for(let s=0;s<t;s++)this.items[s].appendChild(this.tmpImage[this.list[s]]);this.setTopItem()}setValue(t){isNaN(t)?this.value=t:this.value=this.list[t],this.setTopItem()}setTopItem(){if(!this.staticTop){if(this.isWithImage){if(!this.preLoadComplete)return;this.c[3].children.length||(this.canvas=document.createElement("canvas"),this.canvas.width=this.imageSize[0],this.canvas.height=this.imageSize[1],this.canvas.style.cssText="position:absolute; top:0px; left:0px;",this.ctx=this.canvas.getContext("2d"),this.c[3].appendChild(this.canvas)),this.tmpImage[this.value],this.ctx.drawImage(this.tmpImage[this.value],0,0,this.imageSize[2],this.imageSize[3],0,0,this.imageSize[0],this.imageSize[1])}else this.c[3].textContent=this.value;this.miniCanvas&&(this.c[3].children.length||(this.canvas=document.createElement("canvas"),this.canvas.width=this.imageSize[0],this.canvas.height=this.imageSize[1],this.h,this.imageSize[1],this.canvas.style.cssText="position:relative; pointer-events:none; display:inline-block; float:left; margin-left:0px; margin-right:5px; top:2px",this.ctx=this.canvas.getContext("2d"),this.c[3].style.textAlign="left",this.c[3].appendChild(this.canvas)),this.ctx.drawImage(this.tmpImage[this.value],0,0))}}update(t){this.scroll&&(t=(t=t<0?0:t)>this.range?this.range:t,this.topList=-Math.floor(t/this.ratio),this.listIn.style.top=this.topList+"px",this.scroller.style.top=Math.floor(t)+"px",this.py=t)}parentHeight(t){null!==this.group?this.group.calc(t):this.isUI&&this.main.calc(t)}open(t){super.open(),this.update(0),this.h=this.maxHeight+this.baseH+5,this.scroll?(this.scroller.style.display="block",this.scrollerBack.style.display="block"):(this.topList=0,this.h=this.baseH+5+this.max,this.scroller.style.display="none",this.scrollerBack.style.display="none"),this.s[0].height=this.h+"px",this.s[2].display="block",this.up?(this.zone.y-=this.h-(this.baseH-10),this.setSvg(this.c[4],"d",this.svgs.arrowUp)):this.setSvg(this.c[4],"d",this.svgs.arrowDown),this.rSizeContent();let s=this.h-this.baseH;this.zone.h=this.h,t||this.parentHeight(s)}close(){super.close(),this.up&&(this.zone.y+=this.h-(this.baseH-10));let t=this.h-this.baseH;this.h=this.baseH,this.s[0].height=this.h+"px",this.s[2].display="none",this.setSvg(this.c[4],"d",this.svgs.arrow),this.zone.h=this.h,this.parentHeight(-t)}text(t){this.c[3].textContent=t}rSizeContent(){let t=this.length;for(;t--;)this.listIn.children[t].style.width=this.ww+"px"}rSize(){super.rSize();let t=this.s,s=this.sb,i=this.sa;void 0!==t[2]&&(t[2].width=s+"px",t[2].left=i+"px",t[3].width=s+"px",t[3].left=i+"px",t[4].left=i+s-17+"px",this.ww=s,this.max>this.maxHeight&&(this.ww=s-this.ss),this.isOpen&&this.rSizeContent())}}class v extends n{constructor(t={}){super(t),this.setTypeNumber(t),this.allway=t.allway||!1,this.isDown=!1,this.value=[0],this.multy=1,this.invmulty=1,this.isSingle=!0,this.isAngle=!1,this.isVector=!1,t.isAngle&&(this.isAngle=!0,this.multy=h.torad,this.invmulty=h.todeg),this.isDrag=t.drag||!1,void 0!==t.value&&(isNaN(t.value)?t.value instanceof Array?(this.value=t.value,this.isSingle=!1):t.value instanceof Object&&(this.value=[],void 0!==t.value.x&&(this.value[0]=t.value.x),void 0!==t.value.y&&(this.value[1]=t.value.y),void 0!==t.value.z&&(this.value[2]=t.value.z),void 0!==t.value.w&&(this.value[3]=t.value.w),this.isVector=!0,this.isSingle=!1):this.value=[t.value]),this.lng=this.value.length,this.tmp=[],this.current=-1,this.prev={x:0,y:0,d:0,v:0};let s=this.colors;this.c[2]=this.dom("div",this.css.basic+" background:"+s.select+"; top:4px; width:0px; height:"+(this.h-8)+"px;"),this.cMode=[];let i=this.lng;for(;i--;)this.isAngle&&(this.value[i]=(180*this.value[i]/Math.PI).toFixed(this.precision)),this.c[3+i]=this.dom("div",this.css.txtselect+" height:"+(this.h-4)+"px; color:"+s.text+"; background:"+s.back+"; borderColor:"+s.border+"; border-radius:"+this.radius+"px;"),t.center&&(this.c[2+i].style.textAlign="center"),this.c[3+i].textContent=this.value[i],this.c[3+i].style.color=this.colors.text,this.c[3+i].isNum=!0,this.cMode[i]=0;this.selectId=3+this.lng,this.c[this.selectId]=this.dom("div",this.css.txtselect+"position:absolute; top:4px; height:"+(this.h-8)+"px; padding:0px 0px; width:0px; color:"+s.textSelect+"; background:"+s.select+"; border:none; border-radius:0px;"),this.cursorId=4+this.lng,this.c[this.cursorId]=this.dom("div",this.css.basic+"top:4px; height:"+(this.h-8)+"px; width:0px; background:"+s.text+";"),this.init()}testZone(t){let s=this.local;if(-1===s.x&&-1===s.y)return"";let i=this.lng,e=this.tmp;for(;i--;)if(s.x>e[i][0]&&s.x<e[i][2])return i;return""}mousedown(t){let s=this.testZone(t);return!this.isDown&&(this.isDown=!0,""!==s&&(this.current=s,this.prev={x:t.clientX,y:t.clientY,d:0,v:this.isSingle?parseFloat(this.value):parseFloat(this.value[this.current])},this.setInput(this.c[3+this.current])),this.mousemove(t))}mouseup(t){return!!this.isDown&&(this.isDown=!1,this.prev={x:0,y:0,d:0,v:0},this.mousemove(t))}mousemove(t){let s=!1,i=0;if(""===this.testZone(t)?this.cursor():this.isDrag?this.cursor(-1!==this.current?"move":"pointer"):this.cursor("text"),!this.isDrag)return this.isDown&&(i=t.clientX-this.zone.x-3),-1!==this.current&&(i-=this.tmp[this.current][0]),this.upInput(i,this.isDown);if(-1!==this.current){this.prev.d+=t.clientX-this.prev.x-(t.clientY-this.prev.y);let i=this.prev.v+this.prev.d*this.step;this.value[this.current]=this.numValue(i),this.c[3+this.current].textContent=this.value[this.current],this.validate(),this.prev.x=t.clientX,this.prev.y=t.clientY,s=!0}return s}reset(){return!1}setValue(t){this.isVector?(void 0!==t.x&&(this.value[0]=t.x),void 0!==t.y&&(this.value[1]=t.y),void 0!==t.z&&(this.value[2]=t.z),void 0!==t.w&&(this.value[3]=t.w)):this.isSingle?this.value=[t]:this.value=t,this.update()}sameStr(t){let s=this.value.length;for(;s--;)this.c[3+s].textContent=t}update(t){let s=this.value.length;for(;s--;)this.value[s]=this.numValue(this.value[s]*this.invmulty),this.c[3+s].textContent=this.value[s];t&&this.send()}send(t){t=t||this.value,this.isSend=!0,null!==this.objectLink&&(this.isVector?this.objectLink[this.val].fromArray(t):this.objectLink[this.val]=t),this.callback&&this.callback(t,this.val),this.isSend=!1}select(t,s,i,e){let h=this.s,o=-1!==this.current?this.tmp[this.current][0]+5:0;h[this.cursorId].width="1px",h[this.cursorId].left=o+t+"px",h[this.selectId].left=o+s+"px",h[this.selectId].width=i+"px",this.c[this.selectId].innerHTML=e}unselect(){let t=this.s;t&&(this.c[this.selectId].innerHTML="",t[this.selectId].width="0px",t[this.cursorId].width="0px")}validate(t){let s=[],i=this.lng;for(this.allway&&(t=!0);i--;){if(isNaN(this.c[3+i].textContent))this.c[3+i].textContent=this.value[i];else{let t=this.numValue(this.c[3+i].textContent);this.c[3+i].textContent=t,this.value[i]=t}s[i]=this.value[i]*this.multy}t&&(this.isSingle?this.send(s[0]):this.send(s))}rSize(){super.rSize();let t=Math.floor((this.sb+5)/this.lng)-5,s=this.s,i=this.lng;for(;i--;)this.tmp[i]=[Math.floor(this.sa+t*i+5*i),t],this.tmp[i][2]=this.tmp[i][0]+this.tmp[i][1],s[3+i].left=this.tmp[i][0]+"px",s[3+i].width=this.tmp[i][1]+"px"}}class f extends n{constructor(t={}){super(t),this.setTypeNumber(t),this.model=t.stype||0,void 0!==t.mode&&(this.model=t.mode),this.isDown=!1,this.isOver=!1,this.allway=t.allway||!1,this.isDeg=t.isDeg||!1,this.isCyclic=t.cyclic||!1,this.firstImput=!1;let s=this.colors;if(this.c[2]=this.dom("div",this.css.txtselect+"border:none; background:none; width:47px; color:"+s.text+";"),this.c[3]=this.dom("div",this.css.basic+" top:0; height:"+this.h+"px;"),this.c[4]=this.dom("div",this.css.basic+"background:"+s.back+"; top:2px; height:"+(this.h-4)+"px;"),this.c[5]=this.dom("div",this.css.basic+"left:4px; top:5px; height:"+(this.h-10)+"px; background:"+s.text+";"),this.c[2].isNum=!0,this.c[2].style.height=this.h-2+"px",this.c[2].style.lineHeight=this.h-10+"px",0!==this.model){let t=4,i=8,e=this.h-4,h=20;2===this.model&&(t=4,i=8,h=2,e=.5*(this.h-4)),3===this.model&&(this.c[5].style.visible="none"),this.c[4].style.borderRadius=t+"px",this.c[4].style.height=i+"px",this.c[4].style.top=.5*this.h-t+"px",this.c[5].style.borderRadius=.5*t+"px",this.c[5].style.height=t+"px",this.c[5].style.top=.5*this.h-.5*t+"px",this.c[6]=this.dom("div",this.css.basic+"border-radius:"+h+"px; margin-left:"+.5*-e+"px; border:1px solid "+s.border+"; background:"+s.button+"; left:4px; top:2px; height:"+(this.h-4)+"px; width:"+e+"px;")}this.init()}testZone(t){let s=this.local;return-1===s.x&&-1===s.y?"":s.x>=this.txl?"text":s.x>=this.sa?"scroll":""}mouseup(t){this.isDown&&(this.isDown=!1)}mousedown(t){let s=this.testZone(t);return!!s&&("scroll"===s&&(this.isDown=!0,this.old=this.value,this.mousemove(t)),!0)}mousemove(t){let s=!1;if("scroll"===this.testZone(t)?(this.mode(1),this.cursor("w-resize")):this.cursor(),this.isDown){let i=(t.clientX-(this.zone.x+this.sa)-3)/this.ww*this.range+this.min-this.old;(i>=this.step||i<=this.step)&&(i=Math.floor(i/this.step),this.value=this.numValue(this.old+i*this.step),this.update(!0),this.old=this.value),s=!0}return s}wheel(t){if("scroll"===this.testZone(t)){let s=this.value-this.step*t.delta;return s>this.max?s=this.isCyclic?this.min:this.max:s<this.min&&(s=this.isCyclic?this.max:this.min),this.setValue(s),this.old=s,this.update(!0),!0}return!1}validate(){let t=this.c[2].textContent;isNaN(t)?this.c[2].textContent=this.value+(this.isDeg?"°":""):(this.value=this.numValue(t),this.update(!0))}reset(){this.isDown=!1,this.mode(0)}mode(t){let s=this.s,i=this.colors;switch(t){case 0:s[2].color=i.text,s[4].background=i.back,s[5].background=i.text;break;case 1:s[2].color=i.textOver,s[4].background=i.back,s[5].background=i.textOver}}update(t){let s=Math.floor(this.ww*((this.value-this.min)/this.range));3!==this.model&&(this.s[5].width=s+"px"),this.s[6]&&(this.s[6].left=this.sa+s+3+"px"),this.c[2].textContent=this.value+(this.isDeg?"°":""),t&&this.send()}rSize(){super.rSize();let t=this.sb-this.sc;this.ww=t-6;let s=this.sc;!this.isUI&&this.simple||(s=this.sc+10),this.txl=this.w-s+2;let i=this.s;i[2].width=this.sc-6+"px",i[2].left=this.txl+4+"px",i[3].left=this.sa+"px",i[3].width=t+"px",i[4].left=this.sa+"px",i[4].width=t+"px",i[5].left=this.sa+3+"px",this.update()}}class b extends n{constructor(t={}){super(t),this.cmode=0,this.value=t.value||"",this.placeHolder=t.placeHolder||"",this.allway=t.allway||!1,this.editable=void 0===t.edit||t.edit,this.isDown=!1;let s=this.colors;this.c[2]=this.dom("div",this.css.txtselect+"height:"+(this.h-4)+"px; color:"+s.text+"; background:"+s.back+"; borderColor:"+s.border+"; border-radius:"+this.radius+"px;"),this.c[2].textContent=this.value,this.c[3]=this.dom("div",this.css.txtselect+"position:absolute; top:4px; height:"+(this.h-8)+"px; padding:0px 0px; width:0px; color:"+s.textSelect+"; background:"+s.select+"; border:none; border-radius:0px;"),this.c[4]=this.dom("div",this.css.basic+"top:4px; height:"+(this.h-8)+"px; width:0px; background:"+s.text+";"),this.c[5]=this.dom("div",this.css.txtselect+"height:"+(this.h-4)+"px; justify-content: center; font-style: italic; color:"+s.border+";"),""===this.value&&(this.c[5].textContent=this.placeHolder),this.init()}testZone(t){let s=this.local;return-1===s.x&&-1===s.y?"":s.x>=this.sa?"text":""}mouseup(t){if(this.editable)return!!this.isDown&&(this.isDown=!1,this.mousemove(t))}mousedown(t){if(!this.editable)return;let s=this.testZone(t);return!this.isDown&&(this.isDown=!0,"text"===s&&this.setInput(this.c[2]),this.mousemove(t))}mousemove(t){if(!this.editable)return;let s=0;return"text"===this.testZone(t)?this.cursor("text"):this.cursor(),this.isDown&&(s=t.clientX-this.zone.x),this.upInput(s-this.sa-3,this.isDown)}update(){this.c[2].textContent=this.value}reset(){this.cursor()}select(t,s,i,e){let h=this.s,o=this.sa+5;h[4].width="1px",h[4].left=o+s+"px",h[3].left=o+s+"px",h[3].width=i+"px",this.c[3].innerHTML=e}unselect(){let t=this.s;t&&(t[3].width="0px",this.c[3].innerHTML="t",t[4].width="0px")}validate(t){this.allway&&(t=!0),this.value=this.c[2].textContent,""!==this.value?this.c[5].textContent="":this.c[5].textContent=this.placeHolder,t&&this.send()}rSize(){super.rSize();let t=this.s;t[2].left=this.sa+"px",t[2].width=this.sb+"px",t[5].left=this.sa+"px",t[5].width=this.sb+"px"}}class w extends n{constructor(t={}){super(t);let s=t.prefix||"";this.c[2]=this.dom("div",this.css.txt+"justify-content:right; width:60px; line-height:"+(this.h-8)+"px; color:"+this.colors.text),31===this.h&&(this.s[0].height=this.h+"px",this.s[1].top="8px",this.c[2].style.top="8px");let i=this.s;i[1].justifyContent=t.align||"left",i[1].fontWeight=t.fontWeight||"bold",this.c[1].textContent=this.txt.substring(0,1).toUpperCase()+this.txt.substring(1).replace("-"," "),this.c[2].textContent=s,this.init()}text(t){this.c[1].textContent=t}text2(t){this.c[2].textContent=t}rSize(){super.rSize(),this.s[1].width=this.w+"px",this.s[2].left=this.w+"px"}setColor(t){this.s[1].color=t,this.s[2].color=t}}class y extends n{constructor(t={}){super(t),this.value=t.value||"",this.isDown=!1,this.onActif=t.onActif||function(){},t.prefix,this.c[2]=this.dom("div",this.css.txt+this.css.button+" top:1px; background:"+this.colors.button+"; height:"+(this.h-2)+"px; border:"+this.colors.buttonBorder+"; border-radius:15px; width:30px; left:10px;"),this.c[2].style.color=this.fontColor,this.c[3]=this.dom("div",this.css.txtselect+"height:"+(this.h-4)+"px; background:"+this.colors.inputBg+"; borderColor:"+this.colors.inputBorder+"; border-radius:"+this.radius+"px;"),this.c[3].textContent=this.value;let s=Math.floor(.5*this.h)-7;this.c[4]=this.dom("path",this.css.basic+"position:absolute; width:14px; height:14px; left:5px; top:"+s+"px;",{d:this.svgs.cursor,fill:this.fontColor,stroke:"none"}),this.stat=1,this.isActif=!1,this.init()}testZone(t){let s=this.local;return-1===s.x&&-1===s.y?"":s.x>this.sa&&s.x<this.sa+30?"over":"0"}mouseup(t){return!!this.isDown&&(this.isDown=!1,this.mousemove(t))}mousedown(t){return!!this.testZone(t)&&(this.isDown=!0,this.mousemove(t))}mousemove(t){let s=!1;return"over"===this.testZone(t)?(this.cursor("pointer"),s=this.mode(this.isDown?3:2)):s=this.reset(),s}apply(t){(t=t||"")!==this.value&&(this.value=t,this.c[3].textContent=this.value,this.send()),this.mode(1)}update(){this.mode(3)}mode(t){let s=!1,i=this.colors;if(this.stat!==t){switch(1===t&&(this.isActif=!1),3===t&&(this.isActif?this.isActif=!1:(this.isActif=!0,t=4,this.onActif(this))),2===t&&this.isActif&&(t=4),this.stat=t,t){case 1:this.s[2].color=i.text,this.s[2].background=i.button;break;case 2:this.s[2].color=i.textOver,this.s[2].background=i.over;break;case 3:this.s[2].color=i.textSelect,this.s[2].background=i.select;break;case 4:this.s[2].color=i.textSelect,this.s[2].background=i.action}s=!0}return s}reset(){return this.cursor(),this.mode(this.isActif?4:1)}text(t){this.c[3].textContent=t}rSize(){super.rSize();let t=this.s;t[2].left=this.sa+"px",t[3].left=this.sa+40+"px",t[3].width=this.sb-40+"px",t[4].left=this.sa+8+"px"}}class k extends l{constructor(t={}){void 0===t.selectable&&(t.selectable=!0),super(t)}}class S extends n{constructor(t={}){t.isSpace=!0,t.margin=0,t.h||(t.h=10),super(t),this.init()}}class I extends n{constructor(t={}){super(t),this.p=100,this.value=this.txt,this.status=1,this.itype=t.itype||"none",this.val=this.itype,this.graph=this.svgs[this.itype];let s=Math.floor(.5*this.h)-7;this.c[2]=this.dom("path",this.css.basic+"position:absolute; width:14px; height:14px; left:5px; top:"+s+"px;",{d:this.graph,fill:this.colors.text,stroke:"none"}),this.s[1].marginLeft="20px",this.init()}mousemove(t){this.cursor("pointer")}mousedown(t){return this.isUI&&this.main.resetItem(),this.selected(!0),this.send(),!0}uiout(){this.isSelect?this.mode(3):this.mode(1)}uiover(){this.isSelect?this.mode(4):this.mode(2)}update(){}mode(t){let s=!1;if(this.status!==t){this.status=t;let i=this.s,e=this.colors;switch(t){case 1:this.status=1,i[1].color=e.text,i[0].background="none";break;case 2:this.status=2,i[1].color=e.textOver,i[0].background=e.back;break;case 3:this.status=3,i[1].color=e.textSelect,i[0].background=e.select;break;case 4:this.status=4,i[1].color=e.textOver,i[0].background=e.over}s=!0}return s}reset(){this.cursor()}selected(t){this.isSelect&&this.mode(1),this.isSelect=t||!1,this.isSelect&&this.mode(3)}}class C extends n{constructor(t={}){super(t),this.values=t.values||[],"string"==typeof this.values&&(this.values=[this.values]),this.lng=this.values.length,this.value=t.value||null,this.isSelectable=t.selectable||!1,this.spaces=t.spaces||[5,3],this.bsize=t.bsize||[90,20],t.h&&(this.bsize[1]=t.h),this.bsizeMax=this.bsize[0],this.tmp=[],this.stat=[],this.grid=[2,Math.round(.5*this.lng)],this.h=this.grid[1]*(this.bsize[1]+this.spaces[1])+this.spaces[1],this.c[1].textContent="",this.c[2]=this.dom("table",this.css.basic+"width:100%; top:"+(this.spaces[1]-2)+"px; height:auto; border-collapse:separate; border:none; border-spacing: "+(this.spaces[0]-2)+"px "+(this.spaces[1]-2)+"px;");let s,i,e,h,o=0;this.res=-1,this.isDown=!1,this.neverlock=!0,this.buttons=[],this.stat=[],this.tmpX=[],this.tmpY=[];let n=this.colors;for(let t=0;t<this.grid[1];t++){e=this.c[2].insertRow(),e.style.cssText="pointer-events:none;";for(let t=0;t<this.grid[0];t++)i=e.insertCell(),i.style.cssText="pointer-events:none;",this.values[o]?(h=!1,this.values[o]===this.value&&this.isSelectable&&(h=!0),s=document.createElement("div"),s.style.cssText=this.css.txt+this.css.button+"position:static; width:"+this.bsize[0]+"px; height:"+this.bsize[1]+"px; border:"+n.borderSize+"px solid "+n.border+"; left:auto; right:auto; border-radius:"+this.radius+"px;",s.style.background=h?n.select:n.button,s.style.color=h?n.textSelect:n.text,s.innerHTML=this.values[o],i.appendChild(s),this.buttons.push(s),this.stat.push(1)):(s=document.createElement("div"),s.style.cssText=this.css.txt+"position:static; width:"+this.bsize[0]+"px; height:"+this.bsize[1]+"px; text-align:center; left:auto; right:auto; background:none;",i.appendChild(s)),s.style.cssText+=0===t?"float:right;":"float:left;",o++}this.init()}testZone(t){let s=this.local;if(-1===s.x&&-1===s.y)return-1;let i=this.tmpX,e=this.tmpY,h=-1,o=-1,n=-1,r=this.grid[0];for(;r--;)s.x>i[r][0]&&s.x<i[r][1]&&(o=r);for(r=this.grid[1];r--;)s.y>e[r][0]&&s.y<e[r][1]&&(n=r);return-1!==o&&-1!==n&&(h=o+2*n,h>this.lng-1&&(h=-1)),h}mouseup(t){return!!this.isDown&&(this.isDown=!1,-1!==this.res&&(this.value=this.values[this.res],this.send()),this.mousemove(t))}mousedown(t){return!this.isDown&&(this.isDown=!0,this.mousemove(t))}mousemove(t){let s=!1;return this.res=this.testZone(t),-1!==this.res?(this.cursor("pointer"),s=this.modes(this.isDown?3:2,this.res)):s=this.reset(),s}modes(t=1,s=-1){let i,e,h=this.lng,o=!1;for(;h--;)e=t,i=!!this.isSelectable&&this.values[h]===this.value,h===s?i&&2===e&&(e=3):(e=1,i&&(e=4)),this.mode(e,h)&&(o=!0);return o}mode(t,s){let i=!1,e=this.colors,h=this.buttons,o=s;if(this.stat[s]!==t){switch(this.stat[s]=t,t){case 1:h[o].style.color=e.text,h[o].style.background=e.button;break;case 2:h[o].style.color=e.textOver,h[o].style.background=e.overoff;break;case 3:h[o].style.color=e.textOver,h[o].style.background=e.over;break;case 4:h[o].style.color=e.textSelect,h[o].style.background=e.select}i=!0}return i}reset(){return this.res=-1,this.cursor(),this.modes()}label(t,s){this.buttons[s].textContent=t}icon(t,s,i){this.buttons[i].style.padding=(s||0)+"px 0px",this.buttons[i].innerHTML=t}testW(){let t=!1;if(3*this.spaces[0]+2*this.bsizeMax>this.w?(this.bsize[0]=.5*(this.w-3*this.spaces[0]),t=!0):this.bsize[0]!==this.bsizeMax&&(this.bsize[0]=this.bsizeMax,t=!0),!t)return;let s=this.buttons.length;for(;s--;)this.buttons[s].style.width=this.bsize[0]+"px"}rSize(){let t;super.rSize(),this.testW(),this.tmpX=[],this.tmpY=[];for(let s=0;s<this.grid[0];s++)0===s?(t=.5*this.w-.5*this.spaces[0],this.tmpX.push([t-this.bsize[0],t])):(t=.5*this.w+.5*this.spaces[0],this.tmpX.push([t,t+this.bsize[0]]));t=this.spaces[1];for(let s=0;s<this.grid[1];s++)this.tmpY.push([t,t+this.bsize[1]]),t+=this.bsize[1]+this.spaces[1]}}class M extends n{constructor(t={}){super(t),this.autoWidth=!1,this.minw=this.w,this.diam=t.diam||this.w,this.pos=new o(0,0),this.maxPos=90,this.model=t.stype||0,void 0!==t.mode&&(this.model=t.mode),this.min=void 0===t.min?-1:t.min,this.max=void 0===t.max?1:t.max,this.range=.5*(this.max-this.min),this.cmode=0,this.precision=void 0===t.precision?2:t.precision,this.value=Array.isArray(t.value)&&2==t.value.length?t.value:[0,0],this.h=t.h||this.w+10,this.top=0,this.c[0].style.width=this.w+"px",void 0!==this.c[1]&&(this.c[1].style.width="100%",this.c[1].style.justifyContent="center",this.top=10,this.h+=10);let s=this.colors;this.c[2]=this.dom("div",this.css.txt+"justify-content:center; top:"+(this.h-20)+"px; width:100%; color:"+s.text),this.c[2].textContent=this.value;let i=this.getPad2d();this.setSvg(i,"fill",s.back,0),this.setSvg(i,"fill",s.button,1),this.setSvg(i,"stroke",s.back,2),this.setSvg(i,"stroke",s.back,3),this.setSvg(i,"stroke",s.text,4),this.setSvg(i,"viewBox","0 0 "+this.diam+" "+this.diam),this.setCss(i,{width:this.diam,height:this.diam,left:0,top:this.top}),this.c[3]=i,this.init(),this.setValue()}testZone(t){let s=this.local;return-1===s.x&&-1===s.y?"":s.y<=this.c[1].offsetHeight?"title":s.y>this.h-this.c[2].offsetHeight?"text":"pad"}mouseup(t){return this.isDown=!1,this.mode(0)}mousedown(t){if("pad"===this.testZone(t))return this.isDown=!0,this.mousemove(t),this.mode(1)}mousemove(t){if(!this.isDown)return;let s=.5*this.w-(t.clientX-this.zone.x),i=.5*this.diam-(t.clientY-this.zone.y-this.top),e=256/this.diam;s=-s*e,i=-i*e,s=h.clamp(s,-this.maxPos,this.maxPos),i=h.clamp(i,-this.maxPos,this.maxPos),this.setPos([s,i]),this.update(!0)}mode(t){if(this.cmode===t)return!1;let s=this.colors;switch(t){case 0:this.s[2].color=s.text,this.setSvg(this.c[3],"fill",s.back,0),this.setSvg(this.c[3],"fill",s.button,1),this.setSvg(this.c[3],"stroke",s.back,2),this.setSvg(this.c[3],"stroke",s.back,3),this.setSvg(this.c[3],"stroke",s.text,4);break;case 1:this.s[2].color=s.textSelect,this.setSvg(this.c[3],"fill",s.backoff,0),this.setSvg(this.c[3],"fill",s.overoff,1),this.setSvg(this.c[3],"stroke",s.backoff,2),this.setSvg(this.c[3],"stroke",s.backoff,3),this.setSvg(this.c[3],"stroke",s.textSelect,4)}return this.cmode=t,!0}update(t){this.c[2].textContent=this.value,this.updateSVG(),t&&this.send()}updateSVG(){1==this.model&&(this.setSvg(this.c[3],"y1",this.pos.y,2),this.setSvg(this.c[3],"y2",this.pos.y,2),this.setSvg(this.c[3],"x1",this.pos.x,3),this.setSvg(this.c[3],"x2",this.pos.x,3)),this.setSvg(this.c[3],"cx",this.pos.x,4),this.setSvg(this.c[3],"cy",this.pos.y,4)}setPos(t){this.pos.set(t[0]+128,t[1]+128);let s=1/this.maxPos;this.value[0]=(t[0]*s*this.range).toFixed(this.precision),this.value[1]=(t[1]*s*this.range).toFixed(this.precision)}setValue(t,s=!1){void 0===t&&(t=this.value),this.value[0]=1*Math.min(this.max,Math.max(this.min,t[0])).toFixed(this.precision),this.value[1]=1*Math.min(this.max,Math.max(this.min,t[1])).toFixed(this.precision),this.pos.set(this.value[0]/this.range*this.maxPos+128,this.value[1]/this.range*this.maxPos+128),this.update(s)}}const z=function(){let t,s,i=arguments,e=!1,h=null;"string"==typeof i[0]?(t=i[0],s=i[1]||{}):"object"==typeof i[0]&&(e=!0,void 0===i[2]&&[].push.call(i,{}),t=i[2].type?i[2].type:"slide",s=i[2],s.name=i[1],"list"===t?s.list=i[0][i[1]]:s.value=i[0][i[1]]);let o=t.toLowerCase();switch("group"===o&&(s.add=z),o){case"bool":h=new r(s);break;case"button":h=new l(s);break;case"circular":h=new a(s);break;case"color":h=new c(s);break;case"fps":h=new d(s);break;case"graph":h=new u(s);break;case"group":h=new p(s);break;case"joystick":h=new m(s);break;case"knob":h=new g(s);break;case"list":h=new x(s);break;case"numeric":case"number":h=new v(s);break;case"slide":h=new f(s);break;case"textInput":case"string":h=new b(s);break;case"title":case"text":h=new w(s);break;case"select":h=new y(s);break;case"selector":h=new k(s);break;case"empty":case"space":h=new S(s);break;case"item":h=new I(s);break;case"grid":h=new C(s);break;case"pad2d":case"pad":h=new M(s)}if(null!==h)return e&&h.setReferency(i[0],i[1]),h};t.Gui=class{constructor(t={}){this.isGui=!0,this.name="gui",this.canvas=null,this.screen=null,this.plane=t.plane||null,this.isEmpty=!0,t.config&&(t.colors=t.config),t.colors?this.setConfig(t.colors):this.colors=h.defineColor(t),this.css=h.cloneCss(),this.isReset=!0,this.tmpAdd=null,this.isCanvas=t.isCanvas||!1,this.isCanvasOnly=!1,this.callback=void 0===t.callback?null:t.callback,this.forceHeight=t.maxHeight||0,this.lockHeight=t.lockHeight||!1,this.isItemMode=void 0!==t.itemMode&&t.itemMode,this.cn="",this.size=h.size,void 0!==t.p&&(this.size.p=t.p),void 0!==t.w&&(this.size.w=t.w),void 0!==t.h&&(this.size.h=t.h),void 0!==t.s&&(this.size.s=t.s),this.size.h=this.size.h<11?11:this.size.h,this.local=(new o).neg(),this.zone={x:0,y:0,w:this.size.w,h:0},this.mouse=(new o).neg(),this.h=0,this.sw=0,this.isWithClose=void 0===t.close||t.close,this.bh=this.isWithClose?this.size.h:0,this.autoResize=void 0===t.autoResize||t.autoResize,this.isCenter=t.center||!1,this.cssGui=void 0!==t.css?t.css:this.isCenter?"":"right:10px;",this.isOpen=void 0===t.open||t.open,this.isDown=!1,this.isScroll=!1,this.uis=[],this.current=-1,this.target=null,this.decal=0,this.ratio=1,this.oy=0,this.isNewTarget=!1;let s=this.colors;this.content=h.dom("div",this.css.basic+" width:0px; height:auto; top:0px; background:"+s.content+"; "+this.cssGui),this.innerContent=h.dom("div",this.css.basic+"width:100%; top:0; left:0; height:auto; overflow:hidden;"),this.content.appendChild(this.innerContent),this.useFlex=!0;let e=this.useFlex?"display:flex; flex-flow: row wrap;":"";this.inner=h.dom("div",this.css.basic+e+"width:100%; left:0; "),this.innerContent.appendChild(this.inner),this.scrollBG=h.dom("div",this.css.basic+"right:0; top:0; width:"+(this.size.s-1)+"px; height:10px; display:none; background:"+s.background+";"),this.content.appendChild(this.scrollBG),this.scroll=h.dom("div",this.css.basic+"background:"+s.button+"; right:2px; top:0; width:"+(this.size.s-4)+"px; height:10px;"),this.scrollBG.appendChild(this.scroll),this.bottomText=t.bottomText||["open","close"];let n=s.radius;this.bottom=h.dom("div",this.css.txt+"width:100%; top:auto; bottom:0; left:0; border-bottom-right-radius:"+n+"px; border-bottom-left-radius:"+n+"px; justify-content:center; height:"+this.bh+"px; line-height:"+(this.bh-5)+"px; color:"+s.text+";"),this.content.appendChild(this.bottom),this.bottom.textContent=this.isOpen?this.bottomText[1]:this.bottomText[0],this.bottom.style.background=s.background,this.parent=void 0!==t.parent?t.parent:null,this.parent=void 0!==t.target?t.target:this.parent,null!==this.parent||this.isCanvas||(this.parent=document.body),null!==this.parent&&this.parent.appendChild(this.content),this.isCanvas&&null===this.parent&&(this.isCanvasOnly=!0),this.isCanvasOnly?t.transition=0:this.content.style.pointerEvents="auto",this.transition=t.transition||h.transition,this.transition&&setTimeout(this.addTransition.bind(this),0),this.setWidth(),this.isCanvas&&this.makeCanvas(),i.add(this)}setTop(t,s){this.content.style.top=t+"px",void 0!==s&&(this.forceHeight=s),this.calc(),i.needReZone=!0}addTransition(){this.transition&&!this.isCanvas&&(this.innerContent.style.transition="height "+this.transition+"s ease-out",this.content.style.transition="height "+this.transition+"s ease-out",this.bottom.style.transition="top "+this.transition+"s ease-out")}onDraw(){}makeCanvas(){this.canvas=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.canvas.width=this.zone.w,this.canvas.height=this.forceHeight?this.forceHeight:this.zone.h}draw(t){if(null===this.canvas)return;let s=this.zone.w,e=this.forceHeight?this.forceHeight:this.zone.h;i.toCanvas(this,s,e,t)}getDom(){return this.content}noMouse(){this.mouse.neg()}setMouse(t,s=!0){s?this.mouse.set(Math.round(t.x*this.canvas.width),this.canvas.height-Math.round(t.y*this.canvas.height)):this.mouse.set(Math.round(t.x*this.canvas.width),Math.round(t.y*this.canvas.height))}setConfig(t){h.setText(),this.colors=h.defineColor(t)}setColors(t){for(let s in t)this.colors[s]&&(this.colors[s]=t[s])}setText(t,s,i,e){h.setText(t,s,i,e)}hide(t){this.content.style.display=t?"none":"block"}onChange(t){return this.callback=t||null,this}mode(t){let s=!1,e=this.colors;if(t!==this.cn){switch(this.cn=t,t){case"def":i.cursor(),this.scroll.style.background=e.button,this.bottom.style.background=e.background,this.bottom.style.color=e.text;break;case"scrollOver":i.cursor("ns-resize"),this.scroll.style.background=e.select;break;case"scrollDown":this.scroll.style.background=e.select;break;case"bottomOver":i.cursor("pointer"),this.bottom.style.background=e.backgroundOver,this.bottom.style.color=e.textOver}s=!0}return s}clearTarget(){return-1!==this.current&&(this.target.uiout(),this.target.reset(),this.target=null,this.current=-1,i.cursor(),!0)}testZone(t){let s=this.local;if(-1===s.x&&-1===s.y)return"";this.isReset=!1;let i="",e=this.isScroll?this.zone.w-this.size.s:this.zone.w;return i=s.y>this.zone.h-this.bh&&s.y<this.zone.h?"bottom":s.x>e?"scroll":"content",i}handleEvent(t){let s=t.type,e=!1,h=!1,o=this.testZone(t);if("mouseup"===s&&this.isDown&&(this.isDown=!1),"mousedown"!==s||this.isDown||(this.isDown=!0),this.isDown&&this.isNewTarget&&(i.clearInput(),this.isNewTarget=!1),o){switch(o){case"content":t.clientY=this.isScroll?t.clientY+this.decal:t.clientY,i.isMobile&&"mousedown"===s&&this.getNext(t,e),this.target&&(h=this.target.handleEvent(t)),"mousemove"===s&&(e=this.mode("def")),"wheel"===s&&!h&&this.isScroll&&(e=this.onWheel(t)),i.lock||this.getNext(t,e);break;case"bottom":this.clearTarget(),"mousemove"===s&&(e=this.mode("bottomOver")),"mousedown"===s&&(this.isOpen=!this.isOpen,this.bottom.textContent=this.isOpen?this.bottomText[1]:this.bottomText[0],this.calc(),this.mode("def"),e=!0);break;case"scroll":this.clearTarget(),"mousemove"===s&&(e=this.mode("scrollOver")),"mousedown"===s&&(e=this.mode("scrollDown")),"wheel"===s&&(e=this.onWheel(t)),this.isDown&&this.update(t.clientY-this.zone.y-.5*this.sh)}this.isDown&&(e=!0),h&&(e=!0),"keyup"===s&&(e=!0),"keydown"===s&&(e=!0),e&&this.draw()}}getNext(t,s){let e=i.findTarget(this.uis,t);e!==this.current&&(this.clearTarget(),this.current=e,this.isNewTarget=!0),-1!==e&&(this.target=this.uis[this.current],this.target.uiover())}onWheel(t){return this.oy+=20*t.delta,this.update(this.oy),!0}reset(t){if(this.isReset)return;this.mouse.neg(),this.isDown=!1;let s=this.mode("def"),i=this.clearTarget();(s||i)&&this.draw(!0),this.isReset=!0}add(){let t=arguments,s=!1;"object"==typeof t[1]?(t[1].isUI=!0,t[1].main=this,s=!!t[1].ontop&&t[1].ontop):"string"==typeof t[1]&&(void 0===t[2]?[].push.call(t,{isUI:!0,main:this}):(t[2].isUI=!0,t[2].main=this,s=!!t[1].ontop&&t[1].ontop));let i=z.apply(this,t);if(null!==i)return s?this.uis.unshift(i):this.uis.push(i),this.calc(),this.isEmpty=!1,i}remove(t){t.clear&&t.clear()}clearOne(t){let s=this.uis.indexOf(t);-1!==s&&(this.inner.removeChild(this.uis[s].c[0]),this.uis.splice(s,1),this.calc())}empty(){let t,s=this.uis.length;for(;s--;)t=this.uis.pop(),this.inner.removeChild(t.c[0]),t.dispose();this.uis=[],this.isEmpty=!0,this.calc()}clear(){this.empty()}dispose(){this.clear(),null!==this.parent&&this.parent.removeChild(this.content),i.remove(this)}resetItem(){if(!this.isItemMode)return;let t=this.uis.length;for(;t--;)this.uis[t].selected()}setItem(t){if(!this.isItemMode)return;if(t=t||"",this.resetItem(),!t)return void this.update(0);let s=this.uis.length;for(;s--;)this.uis[s].value===t&&(this.uis[s].selected(!0),this.isScroll&&this.update(s*(this.uis[s].h+1)*this.ratio))}upScroll(t){this.sw=t?this.size.s:0,this.oy=t?this.oy:0,this.scrollBG.style.display=t?"block":"none",t&&(this.total=this.h,this.maxView=this.maxHeight,this.ratio=this.maxView/this.total,this.sh=this.maxView*this.ratio,this.range=this.maxView-this.sh,this.oy=h.clamp(this.oy,0,this.range),this.scrollBG.style.height=this.maxView+"px",this.scroll.style.height=this.sh+"px"),this.setItemWidth(this.zone.w-this.sw),this.update(this.oy)}update(t){t=h.clamp(t,0,this.range),this.decal=Math.floor(t/this.ratio),this.inner.style.top=-this.decal+"px",this.scroll.style.top=Math.floor(t)+"px",this.oy=t}calcUis(){return i.calcUis(this.uis,this.zone,this.zone.y)}calc(){clearTimeout(this.tmp),this.tmp=setTimeout(this.setHeight.bind(this),10)}setHeight(){if(this.tmp&&clearTimeout(this.tmp),this.zone.h=this.bh,this.isScroll=!1,this.isOpen){this.h=this.calcUis();let t=this.forceHeight?this.forceHeight+this.zone.y:window.innerHeight;this.maxHeight=t-this.zone.y-this.bh,this.h-this.maxHeight>1?(this.isScroll=!0,this.zone.h=this.maxHeight+this.bh):this.zone.h=this.h+this.bh}this.upScroll(this.isScroll),this.innerContent.style.height=this.zone.h-this.bh+"px",this.content.style.height=this.zone.h+"px",this.bottom.style.top=this.zone.h-this.bh+"px",this.forceHeight&&this.lockHeight&&(this.content.style.height=this.forceHeight+"px"),this.isCanvas&&this.draw(!0)}rezone(){i.needReZone=!0}setWidth(t){t&&(this.zone.w=t),this.zone.w=Math.floor(this.zone.w),this.content.style.width=this.zone.w+"px",this.isCenter&&(this.content.style.marginLeft=-Math.floor(.5*this.zone.w)+"px"),this.setItemWidth(this.zone.w-this.sw)}setItemWidth(t){let s=this.uis.length;for(;s--;)this.uis[s].setSize(t),this.uis[s].rSize()}},t.Proto=n,t.REVISION="4.0.3",t.Tools=h,t.add=z,Object.defineProperty(t,"__esModule",{value:!0})}));
|
package/build/uil.module.js
CHANGED
|
@@ -2265,31 +2265,27 @@ class Proto {
|
|
|
2265
2265
|
// ----------------------
|
|
2266
2266
|
// clear node
|
|
2267
2267
|
// ----------------------
|
|
2268
|
-
|
|
2269
|
-
|
|
2268
|
+
|
|
2269
|
+
dispose(){
|
|
2270
2270
|
|
|
2271
2271
|
if( this.isListen ) Roots.removeListen( this );
|
|
2272
2272
|
|
|
2273
2273
|
Tools.clear( this.c[0] );
|
|
2274
2274
|
|
|
2275
|
-
if(
|
|
2275
|
+
if( this.target !== null ){
|
|
2276
2276
|
|
|
2277
|
-
if( this.
|
|
2277
|
+
if( this.group !== null ) this.group.clearOne( this );
|
|
2278
|
+
else this.target.removeChild( this.c[0] );
|
|
2278
2279
|
|
|
2279
|
-
|
|
2280
|
-
else this.target.removeChild( this.c[0] );
|
|
2281
|
-
|
|
2282
|
-
} else {
|
|
2283
|
-
|
|
2284
|
-
if( this.isUI ) this.main.clearOne( this );
|
|
2285
|
-
else document.body.removeChild( this.c[0] );
|
|
2286
|
-
|
|
2287
|
-
}
|
|
2280
|
+
} else {
|
|
2288
2281
|
|
|
2289
|
-
if(
|
|
2282
|
+
if( this.isUI ) this.main.clearOne( this );
|
|
2283
|
+
else document.body.removeChild( this.c[0] );
|
|
2290
2284
|
|
|
2291
2285
|
}
|
|
2292
2286
|
|
|
2287
|
+
if( !this.isUI ) Roots.remove( this );
|
|
2288
|
+
|
|
2293
2289
|
this.c = null;
|
|
2294
2290
|
this.s = null;
|
|
2295
2291
|
this.callback = null;
|
|
@@ -2297,6 +2293,10 @@ class Proto {
|
|
|
2297
2293
|
this.isListen = false;
|
|
2298
2294
|
|
|
2299
2295
|
}
|
|
2296
|
+
|
|
2297
|
+
clear() {
|
|
2298
|
+
|
|
2299
|
+
}
|
|
2300
2300
|
|
|
2301
2301
|
// ----------------------
|
|
2302
2302
|
// change size
|
|
@@ -2428,7 +2428,8 @@ class Proto {
|
|
|
2428
2428
|
display( v ) {
|
|
2429
2429
|
|
|
2430
2430
|
v = v || false;
|
|
2431
|
-
this.s[0].
|
|
2431
|
+
this.s[0].visibility = v ? 'visible' : 'hidden';
|
|
2432
|
+
//this.s[0].display = v ? (this.useFlex? 'flex':'block') : 'none'
|
|
2432
2433
|
|
|
2433
2434
|
}
|
|
2434
2435
|
|
|
@@ -2659,7 +2660,7 @@ class Button extends Proto {
|
|
|
2659
2660
|
|
|
2660
2661
|
|
|
2661
2662
|
|
|
2662
|
-
this.onName = o.onName ||
|
|
2663
|
+
this.onName = o.onName || null;
|
|
2663
2664
|
|
|
2664
2665
|
this.on = false;
|
|
2665
2666
|
|
|
@@ -2709,16 +2710,16 @@ class Button extends Proto {
|
|
|
2709
2710
|
this.initDrager();
|
|
2710
2711
|
}
|
|
2711
2712
|
|
|
2712
|
-
if( this.onName !== '' ) this.values[0] = this.on;
|
|
2713
|
+
//if( this.onName !== '' ) this.values[0] = this.on;
|
|
2713
2714
|
|
|
2714
2715
|
this.init();
|
|
2715
2716
|
|
|
2716
2717
|
}
|
|
2717
2718
|
|
|
2718
|
-
onOff
|
|
2719
|
+
onOff() {
|
|
2719
2720
|
|
|
2720
2721
|
this.on = !this.on;
|
|
2721
|
-
this.
|
|
2722
|
+
this.label( this.on ? this.onName : this.txt );
|
|
2722
2723
|
|
|
2723
2724
|
}
|
|
2724
2725
|
|
|
@@ -2750,6 +2751,7 @@ class Button extends Proto {
|
|
|
2750
2751
|
if( this.res !== -1 ){
|
|
2751
2752
|
if( this.value === this.values[this.res] && this.unselectable ) this.value = '';
|
|
2752
2753
|
else this.value = this.values[this.res];
|
|
2754
|
+
if( this.onName !== null ) this.onOff();
|
|
2753
2755
|
if( !this.isLoadButton ) this.send();
|
|
2754
2756
|
}
|
|
2755
2757
|
|
|
@@ -4490,7 +4492,7 @@ class Group extends Proto {
|
|
|
4490
4492
|
|
|
4491
4493
|
}
|
|
4492
4494
|
|
|
4493
|
-
add
|
|
4495
|
+
add() {
|
|
4494
4496
|
|
|
4495
4497
|
let a = arguments;
|
|
4496
4498
|
|
|
@@ -4528,12 +4530,28 @@ class Group extends Proto {
|
|
|
4528
4530
|
|
|
4529
4531
|
remove ( n ) {
|
|
4530
4532
|
|
|
4531
|
-
if( n.
|
|
4533
|
+
if( n.dispose ) n.dispose();
|
|
4532
4534
|
|
|
4533
4535
|
}
|
|
4534
4536
|
|
|
4535
4537
|
// clear all iner
|
|
4536
4538
|
|
|
4539
|
+
dispose() {
|
|
4540
|
+
|
|
4541
|
+
this.clear();
|
|
4542
|
+
if( this.isUI ) this.main.calc();
|
|
4543
|
+
|
|
4544
|
+
super.dispose();
|
|
4545
|
+
//Proto.prototype.clear.call( this );
|
|
4546
|
+
|
|
4547
|
+
}
|
|
4548
|
+
|
|
4549
|
+
clear() {
|
|
4550
|
+
|
|
4551
|
+
this.empty();
|
|
4552
|
+
|
|
4553
|
+
}
|
|
4554
|
+
|
|
4537
4555
|
empty () {
|
|
4538
4556
|
|
|
4539
4557
|
this.close();
|
|
@@ -4601,29 +4619,6 @@ class Group extends Proto {
|
|
|
4601
4619
|
|
|
4602
4620
|
}
|
|
4603
4621
|
|
|
4604
|
-
clear () {
|
|
4605
|
-
|
|
4606
|
-
this.empty();
|
|
4607
|
-
if( this.isUI ) this.main.calc( -( this.h + 1 ));
|
|
4608
|
-
Proto.prototype.clear.call( this );
|
|
4609
|
-
|
|
4610
|
-
}
|
|
4611
|
-
|
|
4612
|
-
clearGroup () {
|
|
4613
|
-
|
|
4614
|
-
this.empty();
|
|
4615
|
-
|
|
4616
|
-
/*this.close();
|
|
4617
|
-
|
|
4618
|
-
let i = this.uis.length;
|
|
4619
|
-
while(i--){
|
|
4620
|
-
this.uis[i].clear();
|
|
4621
|
-
}
|
|
4622
|
-
this.uis = [];
|
|
4623
|
-
this.h = this.baseH;*/
|
|
4624
|
-
|
|
4625
|
-
}
|
|
4626
|
-
|
|
4627
4622
|
calcUis () {
|
|
4628
4623
|
|
|
4629
4624
|
if( !this.isOpen ) this.h = this.baseH;
|
|
@@ -8419,7 +8414,7 @@ class Gui {
|
|
|
8419
8414
|
while( i-- ){
|
|
8420
8415
|
item = this.uis.pop();
|
|
8421
8416
|
this.inner.removeChild( item.c[0] );
|
|
8422
|
-
item.
|
|
8417
|
+
item.dispose();
|
|
8423
8418
|
|
|
8424
8419
|
//this.uis[i].clear()
|
|
8425
8420
|
}
|
|
@@ -8439,16 +8434,6 @@ class Gui {
|
|
|
8439
8434
|
|
|
8440
8435
|
this.empty();
|
|
8441
8436
|
|
|
8442
|
-
//this.callback = null;
|
|
8443
|
-
|
|
8444
|
-
/*let i = this.uis.length;
|
|
8445
|
-
while( i-- ) this.uis[i].clear();
|
|
8446
|
-
|
|
8447
|
-
this.uis = [];
|
|
8448
|
-
Roots.listens = [];
|
|
8449
|
-
|
|
8450
|
-
this.calc( -this.h );*/
|
|
8451
|
-
|
|
8452
8437
|
}
|
|
8453
8438
|
|
|
8454
8439
|
dispose() {
|
|
@@ -8643,6 +8628,6 @@ class Gui {
|
|
|
8643
8628
|
|
|
8644
8629
|
}
|
|
8645
8630
|
|
|
8646
|
-
const REVISION = '4.0.
|
|
8631
|
+
const REVISION = '4.0.3';
|
|
8647
8632
|
|
|
8648
8633
|
export { Gui, Proto, REVISION, Tools, add };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uil",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "JavaScript gui library",
|
|
5
5
|
"main": "build/uil.js",
|
|
6
6
|
"repository": "lo-th/uil",
|
|
@@ -16,16 +16,15 @@
|
|
|
16
16
|
],
|
|
17
17
|
"directories": {
|
|
18
18
|
"doc": "docs",
|
|
19
|
-
"example": "examples"
|
|
20
|
-
"test": "test"
|
|
19
|
+
"example": "examples"
|
|
21
20
|
},
|
|
22
21
|
"eslintConfig": {
|
|
23
22
|
"extends": "mdcs"
|
|
24
23
|
},
|
|
25
24
|
"scripts": {
|
|
26
|
-
"build": "rollup -c utils/
|
|
27
|
-
"dev": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/
|
|
28
|
-
"start": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/
|
|
25
|
+
"build": "rollup -c utils/rollup.config.js",
|
|
26
|
+
"dev": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/rollup.config.js -w -m inline\" \"servez -p 8111 --index\"",
|
|
27
|
+
"start": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/rollup.config.js -w -m inline\" \"http-server -c-1 -p 8111 -o index.html\""
|
|
29
28
|
},
|
|
30
29
|
"keywords": [
|
|
31
30
|
"uil",
|