litegui.ts 1.0.0

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.
Files changed (113) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +109 -0
  3. package/dist/@types/Inspector/index.d.ts +462 -0
  4. package/dist/@types/Inspector/index.d.ts.map +1 -0
  5. package/dist/@types/globals/index.d.ts +10 -0
  6. package/dist/@types/globals/index.d.ts.map +1 -0
  7. package/dist/Pickr/pickr.es5.min.js +3 -0
  8. package/dist/Pickr/pickr.es5.min.js.map +1 -0
  9. package/dist/Pickr/pickr.min.js +3 -0
  10. package/dist/Pickr/pickr.min.js.map +1 -0
  11. package/dist/Pickr/themes/classic.min.css +2 -0
  12. package/dist/Pickr/themes/monolith.min.css +2 -0
  13. package/dist/Pickr/themes/nano.min.css +2 -0
  14. package/dist/area.d.ts +277 -0
  15. package/dist/area.d.ts.map +1 -0
  16. package/dist/console.d.ts +27 -0
  17. package/dist/console.d.ts.map +1 -0
  18. package/dist/core.d.ts +438 -0
  19. package/dist/core.d.ts.map +1 -0
  20. package/dist/dialog.d.ts +369 -0
  21. package/dist/dialog.d.ts.map +1 -0
  22. package/dist/dragger.d.ts +132 -0
  23. package/dist/dragger.d.ts.map +1 -0
  24. package/dist/index.d.ts +17 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/inspector/array.d.ts +76 -0
  27. package/dist/inspector/array.d.ts.map +1 -0
  28. package/dist/inspector/button.d.ts +62 -0
  29. package/dist/inspector/button.d.ts.map +1 -0
  30. package/dist/inspector/checkbox.d.ts +50 -0
  31. package/dist/inspector/checkbox.d.ts.map +1 -0
  32. package/dist/inspector/color.d.ts +43 -0
  33. package/dist/inspector/color.d.ts.map +1 -0
  34. package/dist/inspector/combo.d.ts +76 -0
  35. package/dist/inspector/combo.d.ts.map +1 -0
  36. package/dist/inspector/dataTree.d.ts +20 -0
  37. package/dist/inspector/dataTree.d.ts.map +1 -0
  38. package/dist/inspector/file.d.ts +57 -0
  39. package/dist/inspector/file.d.ts.map +1 -0
  40. package/dist/inspector/flag.d.ts +36 -0
  41. package/dist/inspector/flag.d.ts.map +1 -0
  42. package/dist/inspector/icon.d.ts +60 -0
  43. package/dist/inspector/icon.d.ts.map +1 -0
  44. package/dist/inspector/index.d.ts +24 -0
  45. package/dist/inspector/index.d.ts.map +1 -0
  46. package/dist/inspector/info.d.ts +47 -0
  47. package/dist/inspector/info.d.ts.map +1 -0
  48. package/dist/inspector/inspector.d.ts +350 -0
  49. package/dist/inspector/inspector.d.ts.map +1 -0
  50. package/dist/inspector/line.d.ts +20 -0
  51. package/dist/inspector/line.d.ts.map +1 -0
  52. package/dist/inspector/list.d.ts +153 -0
  53. package/dist/inspector/list.d.ts.map +1 -0
  54. package/dist/inspector/number.d.ts +85 -0
  55. package/dist/inspector/number.d.ts.map +1 -0
  56. package/dist/inspector/pad.d.ts +66 -0
  57. package/dist/inspector/pad.d.ts.map +1 -0
  58. package/dist/inspector/seperator.d.ts +15 -0
  59. package/dist/inspector/seperator.d.ts.map +1 -0
  60. package/dist/inspector/slider.d.ts +55 -0
  61. package/dist/inspector/slider.d.ts.map +1 -0
  62. package/dist/inspector/string.d.ts +71 -0
  63. package/dist/inspector/string.d.ts.map +1 -0
  64. package/dist/inspector/stringButton.d.ts +45 -0
  65. package/dist/inspector/stringButton.d.ts.map +1 -0
  66. package/dist/inspector/tags.d.ts +53 -0
  67. package/dist/inspector/tags.d.ts.map +1 -0
  68. package/dist/inspector/textArea.d.ts +48 -0
  69. package/dist/inspector/textArea.d.ts.map +1 -0
  70. package/dist/inspector/tree.d.ts +41 -0
  71. package/dist/inspector/tree.d.ts.map +1 -0
  72. package/dist/inspector/vector.d.ts +64 -0
  73. package/dist/inspector/vector.d.ts.map +1 -0
  74. package/dist/litegui.css +2 -0
  75. package/dist/litegui.css.map +1 -0
  76. package/dist/litegui.d.ts +439 -0
  77. package/dist/litegui.d.ts.map +1 -0
  78. package/dist/litegui.js +11898 -0
  79. package/dist/litegui.js.map +1 -0
  80. package/dist/litegui.mini.js +1 -0
  81. package/dist/menubar.d.ts +279 -0
  82. package/dist/menubar.d.ts.map +1 -0
  83. package/dist/panel.d.ts +124 -0
  84. package/dist/panel.d.ts.map +1 -0
  85. package/dist/table.d.ts +105 -0
  86. package/dist/table.d.ts.map +1 -0
  87. package/dist/tabs.d.ts +426 -0
  88. package/dist/tabs.d.ts.map +1 -0
  89. package/dist/utilities.d.ts +508 -0
  90. package/dist/utilities.d.ts.map +1 -0
  91. package/dist/widgets/button.d.ts +33 -0
  92. package/dist/widgets/button.d.ts.map +1 -0
  93. package/dist/widgets/checkbox.d.ts +36 -0
  94. package/dist/widgets/checkbox.d.ts.map +1 -0
  95. package/dist/widgets/complexList.d.ts +83 -0
  96. package/dist/widgets/complexList.d.ts.map +1 -0
  97. package/dist/widgets/contextMenu.d.ts +97 -0
  98. package/dist/widgets/contextMenu.d.ts.map +1 -0
  99. package/dist/widgets/index.d.ts +10 -0
  100. package/dist/widgets/index.d.ts.map +1 -0
  101. package/dist/widgets/lineEditor.d.ts +112 -0
  102. package/dist/widgets/lineEditor.d.ts.map +1 -0
  103. package/dist/widgets/list.d.ts +59 -0
  104. package/dist/widgets/list.d.ts.map +1 -0
  105. package/dist/widgets/listBox.d.ts +47 -0
  106. package/dist/widgets/listBox.d.ts.map +1 -0
  107. package/dist/widgets/searchBox.d.ts +43 -0
  108. package/dist/widgets/searchBox.d.ts.map +1 -0
  109. package/dist/widgets/slider.d.ts +61 -0
  110. package/dist/widgets/slider.d.ts.map +1 -0
  111. package/dist/widgets/tree.d.ts +348 -0
  112. package/dist/widgets/tree.d.ts.map +1 -0
  113. package/package.json +81 -0
@@ -0,0 +1 @@
1
+ var LiteGUI;(()=>{var t={3931(t){var e;self,e=()=>(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.d(e,{default:()=>_});var n={};function i(t,e,n,i,o={}){e instanceof HTMLCollection||e instanceof NodeList?e=Array.from(e):Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]);for(const s of e)for(const e of n)s[t](e,i,{capture:!1,...o});return Array.prototype.slice.call(arguments,1)}t.r(n),t.d(n,{adjustableInputNumbers:()=>d,createElementFromString:()=>r,createFromTemplate:()=>l,eventPath:()=>a,off:()=>s,on:()=>o,resolveElement:()=>c});const o=i.bind(null,"addEventListener"),s=i.bind(null,"removeEventListener");function r(t){const e=document.createElement("div");return e.innerHTML=t.trim(),e.firstElementChild}function l(t){const e=(t,e)=>{const n=t.getAttribute(e);return t.removeAttribute(e),n},n=(t,i={})=>{const o=e(t,":obj"),s=e(t,":ref"),r=o?i[o]={}:i;s&&(i[s]=t);for(const i of Array.from(t.children)){const t=e(i,":arr"),o=n(i,t?{}:r);t&&(r[t]||(r[t]=[])).push(Object.keys(o).length?o:i)}return i};return n(r(t))}function a(t){let e=t.path||t.composedPath&&t.composedPath();if(e)return e;let n=t.target.parentElement;for(e=[t.target,n];n=n.parentElement;)e.push(n);return e.push(document,window),e}function c(t){return t instanceof Element?t:"string"==typeof t?t.split(/>>/g).reduce((t,e,n,i)=>(t=t.querySelector(e),n<i.length-1?t.shadowRoot:t),document):null}function d(t,e=t=>t){function n(n){const i=[.001,.01,.1][Number(n.shiftKey||2*n.ctrlKey)]*(n.deltaY<0?1:-1);let o=0,s=t.selectionStart;t.value=t.value.replace(/[\d.]+/g,(t,n)=>n<=s&&n+t.length>=s?(s=n,e(Number(t),i,o)):(o++,t)),t.focus(),t.setSelectionRange(s,s),n.preventDefault(),t.dispatchEvent(new Event("input"))}o(t,"focus",()=>o(window,"wheel",n,{passive:!1})),o(t,"blur",()=>s(window,"wheel",n))}const{min:u,max:h,floor:p,round:g}=Math;function m(t,e,n){e/=100,n/=100;const i=p(t=t/360*6),o=t-i,s=n*(1-e),r=n*(1-o*e),l=n*(1-(1-o)*e),a=i%6;return[255*[n,r,s,s,l,n][a],255*[l,n,n,r,s,s][a],255*[s,s,l,n,n,r][a]]}function f(t,e,n){const i=(2-(e/=100))*(n/=100)/2;return 0!==i&&(e=1===i?0:i<.5?e*n/(2*i):e*n/(2-2*i)),[t,100*e,100*i]}function v(t,e,n){const i=u(t/=255,e/=255,n/=255),o=h(t,e,n),s=o-i;let r,l;if(0===s)r=l=0;else{l=s/o;const i=((o-t)/6+s/2)/s,a=((o-e)/6+s/2)/s,c=((o-n)/6+s/2)/s;t===o?r=c-a:e===o?r=1/3+i-c:n===o&&(r=2/3+a-i),r<0?r+=1:r>1&&(r-=1)}return[360*r,100*l,100*o]}function y(t,e,n,i){return e/=100,n/=100,[...v(255*(1-u(1,(t/=100)*(1-(i/=100))+i)),255*(1-u(1,e*(1-i)+i)),255*(1-u(1,n*(1-i)+i)))]}function b(t,e,n){e/=100;const i=2*(e*=(n/=100)<.5?n:1-n)/(n+e)*100,o=100*(n+e);return[t,isNaN(i)?0:i,o]}function w(t){return v(...t.match(/.{2}/g).map(t=>parseInt(t,16)))}function C(t=0,e=0,n=0,i=1){const o=(t,e)=>(n=-1)=>e(~n?t.map(t=>Number(t.toFixed(n))):t),s={h:t,s:e,v:n,a:i,toHSVA(){const t=[s.h,s.s,s.v,s.a];return t.toString=o(t,t=>`hsva(${t[0]}, ${t[1]}%, ${t[2]}%, ${s.a})`),t},toHSLA(){const t=[...f(s.h,s.s,s.v),s.a];return t.toString=o(t,t=>`hsla(${t[0]}, ${t[1]}%, ${t[2]}%, ${s.a})`),t},toRGBA(){const t=[...m(s.h,s.s,s.v),s.a];return t.toString=o(t,t=>`rgba(${t[0]}, ${t[1]}, ${t[2]}, ${s.a})`),t},toCMYK(){const t=function(t,e,n){const i=m(t,e,n),o=i[0]/255,s=i[1]/255,r=i[2]/255,l=u(1-o,1-s,1-r);return[100*(1===l?0:(1-o-l)/(1-l)),100*(1===l?0:(1-s-l)/(1-l)),100*(1===l?0:(1-r-l)/(1-l)),100*l]}(s.h,s.s,s.v);return t.toString=o(t,t=>`cmyk(${t[0]}%, ${t[1]}%, ${t[2]}%, ${t[3]}%)`),t},toHEXA(){const t=function(t,e,n){return m(t,e,n).map(t=>g(t).toString(16).padStart(2,"0"))}(s.h,s.s,s.v),e=s.a>=1?"":Number((255*s.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return e&&t.push(e),t.toString=()=>`#${t.join("").toUpperCase()}`,t},clone:()=>C(s.h,s.s,s.v,s.a)};return s}const L=t=>Math.max(Math.min(t,1),0);function S(t){const e={options:Object.assign({lock:null,onchange:()=>0,onstop:()=>0},t),_keyboard(t){const{options:n}=e,{type:i,key:o}=t;if(document.activeElement===n.wrapper){const{lock:n}=e.options,s="ArrowUp"===o,r="ArrowRight"===o,l="ArrowDown"===o,a="ArrowLeft"===o;if("keydown"===i&&(s||r||l||a)){let i=0,o=0;"v"===n?i=s||r?1:-1:"h"===n?i=s||r?-1:1:(o=s?-1:l?1:0,i=a?-1:r?1:0),e.update(L(e.cache.x+.01*i),L(e.cache.y+.01*o)),t.preventDefault()}else o.startsWith("Arrow")&&(e.options.onstop(),t.preventDefault())}},_tapstart(t){o(document,["mouseup","touchend","touchcancel"],e._tapstop),o(document,["mousemove","touchmove"],e._tapmove),t.cancelable&&t.preventDefault(),e._tapmove(t)},_tapmove(t){const{options:n,cache:i}=e,{lock:o,element:s,wrapper:r}=n,l=r.getBoundingClientRect();let a=0,c=0;if(t){const e=t&&t.touches&&t.touches[0];a=t?(e||t).clientX:0,c=t?(e||t).clientY:0,a<l.left?a=l.left:a>l.left+l.width&&(a=l.left+l.width),c<l.top?c=l.top:c>l.top+l.height&&(c=l.top+l.height),a-=l.left,c-=l.top}else i&&(a=i.x*l.width,c=i.y*l.height);"h"!==o&&(s.style.left=`calc(${a/l.width*100}% - ${s.offsetWidth/2}px)`),"v"!==o&&(s.style.top=`calc(${c/l.height*100}% - ${s.offsetHeight/2}px)`),e.cache={x:a/l.width,y:c/l.height};const d=L(a/l.width),u=L(c/l.height);switch(o){case"v":return n.onchange(d);case"h":return n.onchange(u);default:return n.onchange(d,u)}},_tapstop(){e.options.onstop(),s(document,["mouseup","touchend","touchcancel"],e._tapstop),s(document,["mousemove","touchmove"],e._tapmove)},trigger(){e._tapmove()},update(t=0,n=0){const{left:i,top:o,width:s,height:r}=e.options.wrapper.getBoundingClientRect();"h"===e.options.lock&&(n=t),e._tapmove({clientX:i+s*t,clientY:o+r*n})},destroy(){const{options:t,_tapstart:n,_keyboard:i}=e;s(document,["keydown","keyup"],i),s([t.wrapper,t.element],"mousedown",n),s([t.wrapper,t.element],"touchstart",n,{passive:!1})}},{options:n,_tapstart:i,_keyboard:r}=e;return o([n.wrapper,n.element],"mousedown",i),o([n.wrapper,n.element],"touchstart",i,{passive:!1}),o(document,["keydown","keyup"],r),e}function x(t={}){t=Object.assign({onchange:()=>0,className:"",elements:[]},t);const e=o(t.elements,"click",e=>{t.elements.forEach(n=>n.classList[e.target===n?"add":"remove"](t.className)),t.onchange(e),e.stopPropagation()});return{destroy:()=>s(...e)}}const I={variantFlipOrder:{start:"sme",middle:"mse",end:"ems"},positionFlipOrder:{top:"tbrl",right:"rltb",bottom:"btrl",left:"lrbt"},position:"bottom",margin:8,padding:0};class _{static utils=n;static version="1.9.1";static I18N_DEFAULTS={"ui:dialog":"color picker dialog","btn:toggle":"toggle color picker dialog","btn:swatch":"color swatch","btn:last-color":"use previous color","btn:save":"Save","btn:cancel":"Cancel","btn:clear":"Clear","aria:btn:save":"save and close","aria:btn:cancel":"cancel and close","aria:btn:clear":"clear and close","aria:input":"color input field","aria:palette":"color selection area","aria:hue":"hue selection slider","aria:opacity":"selection slider"};static DEFAULT_OPTIONS={appClass:null,theme:"classic",useAsButton:!1,padding:8,disabled:!1,comparison:!0,closeOnScroll:!1,outputPrecision:0,lockOpacity:!1,autoReposition:!0,container:"body",components:{interaction:{}},i18n:{},swatches:null,inline:!1,sliders:null,default:"#42445a",defaultRepresentation:null,position:"bottom-middle",adjustableNumbers:!0,showAlways:!1,closeWithKey:"Escape"};_initializingActive=!0;_recalc=!0;_nanopop=null;_root=null;_color=C();_lastColor=C();_swatchColors=[];_setupAnimationFrame=null;_eventListener={init:[],save:[],hide:[],show:[],clear:[],change:[],changestop:[],cancel:[],swatchselect:[]};constructor(t){this.options=t=Object.assign({..._.DEFAULT_OPTIONS},t);const{swatches:e,components:n,theme:i,sliders:o,lockOpacity:s,padding:r}=t;["nano","monolith"].includes(i)&&!o&&(t.sliders="h"),n.interaction||(n.interaction={});const{preview:l,opacity:a,hue:c,palette:d}=n;n.opacity=!s&&a,n.palette=d||l||a||c,this._preBuild(),this._buildComponents(),this._bindEvents(),this._finalBuild(),e&&e.length&&e.forEach(t=>this.addSwatch(t));const{button:u,app:h}=this._root;this._nanopop=((t,e,n)=>{const i="object"!=typeof t||t instanceof HTMLElement?{reference:t,popper:e,...n}:t;return{update(t=i){const{reference:e,popper:n}=Object.assign(i,t);if(!n||!e)throw new Error("Popper- or reference-element missing.");return((t,e,n)=>{const{container:i,arrow:o,margin:s,padding:r,position:l,variantFlipOrder:a,positionFlipOrder:c}={container:document.documentElement.getBoundingClientRect(),...I,...n},{left:d,top:u}=e.style;e.style.left="0",e.style.top="0";const h=t.getBoundingClientRect(),p=e.getBoundingClientRect(),g={t:h.top-p.height-s,b:h.bottom+s,r:h.right+s,l:h.left-p.width-s},m={vs:h.left,vm:h.left+h.width/2-p.width/2,ve:h.left+h.width-p.width,hs:h.top,hm:h.bottom-h.height/2-p.height/2,he:h.bottom-p.height},[f,v="middle"]=l.split("-"),y=c[f],b=a[v],{top:w,left:C,bottom:L,right:S}=i;for(const t of y){const n="t"===t||"b"===t;let i=g[t];const[s,l]=n?["top","left"]:["left","top"],[a,c]=n?[p.height,p.width]:[p.width,p.height],[d,u]=n?[L,S]:[S,L],[f,v]=n?[w,C]:[C,w];if(!(i<f||i+a+r>d))for(const d of b){let g=m[(n?"v":"h")+d];if(!(g<v||g+c+r>u)){if(g-=p[l],i-=p[s],e.style[l]=`${g}px`,e.style[s]=`${i}px`,o){const e=n?h.width/2:h.height/2,r=c/2,u=e>r,p=g+{s:u?r:e,m:r,e:u?r:c-e}[d],m=i+{t:a,b:0,r:0,l:a}[t];o.style[l]=`${p}px`,o.style[s]=`${m}px`}return t+d}}}return e.style.left=d,e.style.top=u,null})(e,n,i)}}})(u,h,{margin:r}),u.setAttribute("role","button"),u.setAttribute("aria-label",this._t("btn:toggle"));const p=this;this._setupAnimationFrame=requestAnimationFrame(function e(){if(!h.offsetWidth)return requestAnimationFrame(e);p.setColor(t.default),p._rePositioningPicker(),t.defaultRepresentation&&(p._representation=t.defaultRepresentation,p.setColorRepresentation(p._representation)),t.showAlways&&p.show(),p._initializingActive=!1,p._emit("init")})}static create=t=>new _(t);_preBuild(){const{options:t}=this;for(const e of["el","container"])t[e]=c(t[e]);this._root=(t=>{const{components:e,useAsButton:n,inline:i,appClass:o,theme:s,lockOpacity:r}=t.options,a=t=>t?"":'style="display:none" hidden',c=e=>t._t(e),d=l(`\n <div :ref="root" class="pickr">\n\n ${n?"":'<button type="button" :ref="button" class="pcr-button"></button>'}\n\n <div :ref="app" class="pcr-app ${o||""}" data-theme="${s}" ${i?'style="position: unset"':""} aria-label="${c("ui:dialog")}" role="window">\n <div class="pcr-selection" ${a(e.palette)}>\n <div :obj="preview" class="pcr-color-preview" ${a(e.preview)}>\n <button type="button" :ref="lastColor" class="pcr-last-color" aria-label="${c("btn:last-color")}"></button>\n <div :ref="currentColor" class="pcr-current-color"></div>\n </div>\n\n <div :obj="palette" class="pcr-color-palette">\n <div :ref="picker" class="pcr-picker"></div>\n <div :ref="palette" class="pcr-palette" tabindex="0" aria-label="${c("aria:palette")}" role="listbox"></div>\n </div>\n\n <div :obj="hue" class="pcr-color-chooser" ${a(e.hue)}>\n <div :ref="picker" class="pcr-picker"></div>\n <div :ref="slider" class="pcr-hue pcr-slider" tabindex="0" aria-label="${c("aria:hue")}" role="slider"></div>\n </div>\n\n <div :obj="opacity" class="pcr-color-opacity" ${a(e.opacity)}>\n <div :ref="picker" class="pcr-picker"></div>\n <div :ref="slider" class="pcr-opacity pcr-slider" tabindex="0" aria-label="${c("aria:opacity")}" role="slider"></div>\n </div>\n </div>\n\n <div class="pcr-swatches ${e.palette?"":"pcr-last"}" :ref="swatches"></div>\n\n <div :obj="interaction" class="pcr-interaction" ${a(Object.keys(e.interaction).length)}>\n <input :ref="result" class="pcr-result" type="text" spellcheck="false" ${a(e.interaction.input)} aria-label="${c("aria:input")}">\n\n <input :arr="options" class="pcr-type" data-type="HEXA" value="${r?"HEX":"HEXA"}" type="button" ${a(e.interaction.hex)}>\n <input :arr="options" class="pcr-type" data-type="RGBA" value="${r?"RGB":"RGBA"}" type="button" ${a(e.interaction.rgba)}>\n <input :arr="options" class="pcr-type" data-type="HSLA" value="${r?"HSL":"HSLA"}" type="button" ${a(e.interaction.hsla)}>\n <input :arr="options" class="pcr-type" data-type="HSVA" value="${r?"HSV":"HSVA"}" type="button" ${a(e.interaction.hsva)}>\n <input :arr="options" class="pcr-type" data-type="CMYK" value="CMYK" type="button" ${a(e.interaction.cmyk)}>\n\n <input :ref="save" class="pcr-save" value="${c("btn:save")}" type="button" ${a(e.interaction.save)} aria-label="${c("aria:btn:save")}">\n <input :ref="cancel" class="pcr-cancel" value="${c("btn:cancel")}" type="button" ${a(e.interaction.cancel)} aria-label="${c("aria:btn:cancel")}">\n <input :ref="clear" class="pcr-clear" value="${c("btn:clear")}" type="button" ${a(e.interaction.clear)} aria-label="${c("aria:btn:clear")}">\n </div>\n </div>\n </div>\n `),u=d.interaction;return u.options.find(t=>!t.hidden&&!t.classList.add("active")),u.type=()=>u.options.find(t=>t.classList.contains("active")),d})(this),t.useAsButton&&(this._root.button=t.el),t.container.appendChild(this._root.root)}_finalBuild(){const t=this.options,e=this._root;if(t.container.removeChild(e.root),t.inline){const n=t.el.parentElement;t.el.nextSibling?n.insertBefore(e.app,t.el.nextSibling):n.appendChild(e.app)}else t.container.appendChild(e.app);t.useAsButton?t.inline&&t.el.remove():t.el.parentNode.replaceChild(e.root,t.el),t.disabled&&this.disable(),t.comparison||(e.button.style.transition="none",t.useAsButton||(e.preview.lastColor.style.transition="none")),this.hide()}_buildComponents(){const t=this,e=this.options.components,n=(t.options.sliders||"v").repeat(2),[i,o]=n.match(/^[vh]+$/g)?n:[],s=()=>this._color||(this._color=this._lastColor.clone()),r={palette:S({element:t._root.palette.picker,wrapper:t._root.palette.palette,onstop:()=>t._emit("changestop","slider",t),onchange(n,i){if(!e.palette)return;const o=s(),{_root:r,options:l}=t,{lastColor:a,currentColor:c}=r.preview;t._recalc&&(o.s=100*n,o.v=100-100*i,o.v<0&&(o.v=0),t._updateOutput("slider"));const d=o.toRGBA().toString(0);this.element.style.background=d,this.wrapper.style.background=`\n linear-gradient(to top, rgba(0, 0, 0, ${o.a}), transparent),\n linear-gradient(to left, hsla(${o.h}, 100%, 50%, ${o.a}), rgba(255, 255, 255, ${o.a}))\n `,l.comparison?l.useAsButton||t._lastColor||a.style.setProperty("--pcr-color",d):(r.button.style.setProperty("--pcr-color",d),r.button.classList.remove("clear"));const u=o.toHEXA().toString();for(const{el:e,color:n}of t._swatchColors)e.classList[u===n.toHEXA().toString()?"add":"remove"]("pcr-active");c.style.setProperty("--pcr-color",d)}}),hue:S({lock:"v"===o?"h":"v",element:t._root.hue.picker,wrapper:t._root.hue.slider,onstop:()=>t._emit("changestop","slider",t),onchange(n){if(!e.hue||!e.palette)return;const i=s();t._recalc&&(i.h=360*n),this.element.style.backgroundColor=`hsl(${i.h}, 100%, 50%)`,r.palette.trigger()}}),opacity:S({lock:"v"===i?"h":"v",element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onstop:()=>t._emit("changestop","slider",t),onchange(n){if(!e.opacity||!e.palette)return;const i=s();t._recalc&&(i.a=Math.round(100*n)/100),this.element.style.background=`rgba(0, 0, 0, ${i.a})`,r.palette.trigger()}}),selectable:x({elements:t._root.interaction.options,className:"active",onchange(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._recalc&&t._updateOutput("swatch")}})};this._components=r}_bindEvents(){const{_root:t,options:e}=this,n=[o(t.interaction.clear,"click",()=>this._clearColor()),o([t.interaction.cancel,t.preview.lastColor],"click",()=>{this.setHSVA(...(this._lastColor||this._color).toHSVA(),!0),this._emit("cancel")}),o(t.interaction.save,"click",()=>{!this.applyColor()&&!e.showAlways&&this.hide()}),o(t.interaction.result,["keyup","input"],t=>{this.setColor(t.target.value,!0)&&!this._initializingActive&&(this._emit("change",this._color,"input",this),this._emit("changestop","input",this)),t.stopImmediatePropagation()}),o(t.interaction.result,["focus","blur"],t=>{this._recalc="blur"===t.type,this._recalc&&this._updateOutput(null)}),o([t.palette.palette,t.palette.picker,t.hue.slider,t.hue.picker,t.opacity.slider,t.opacity.picker],["mousedown","touchstart"],()=>this._recalc=!0,{passive:!0})];if(!e.showAlways){const i=e.closeWithKey;n.push(o(t.button,"click",()=>this.isOpen()?this.hide():this.show()),o(document,"keyup",t=>this.isOpen()&&(t.key===i||t.code===i)&&this.hide()),o(document,["touchstart","mousedown"],e=>{this.isOpen()&&!a(e).some(e=>e===t.app||e===t.button)&&this.hide()},{capture:!0}))}if(e.adjustableNumbers){const e={rgba:[255,255,255,1],hsva:[360,100,100,1],hsla:[360,100,100,1],cmyk:[100,100,100,100]};d(t.interaction.result,(t,n,i)=>{const o=e[this.getColorRepresentation().toLowerCase()];if(o){const e=o[i],s=t+(e>=100?1e3*n:n);return s<=0?0:Number((s<e?s:e).toPrecision(3))}return t})}if(e.autoReposition&&!e.inline){let t=null;const i=this;n.push(o(window,["scroll","resize"],()=>{i.isOpen()&&(e.closeOnScroll&&i.hide(),null===t?(t=setTimeout(()=>t=null,100),requestAnimationFrame(function e(){i._rePositioningPicker(),null!==t&&requestAnimationFrame(e)})):(clearTimeout(t),t=setTimeout(()=>t=null,100)))},{capture:!0}))}this._eventBindings=n}_rePositioningPicker(){const{options:t}=this;if(!t.inline&&!this._nanopop.update({container:document.body.getBoundingClientRect(),position:t.position})){const t=this._root.app,e=t.getBoundingClientRect();t.style.top=(window.innerHeight-e.height)/2+"px",t.style.left=(window.innerWidth-e.width)/2+"px"}}_updateOutput(t){const{_root:e,_color:n,options:i}=this;if(e.interaction.type()){const t=`to${e.interaction.type().getAttribute("data-type")}`;e.interaction.result.value="function"==typeof n[t]?n[t]().toString(i.outputPrecision):""}!this._initializingActive&&this._recalc&&this._emit("change",n,t,this)}_clearColor(t=!1){const{_root:e,options:n}=this;n.useAsButton||e.button.style.setProperty("--pcr-color","rgba(0, 0, 0, 0.15)"),e.button.classList.add("clear"),n.showAlways||this.hide(),this._lastColor=null,this._initializingActive||t||(this._emit("save",null),this._emit("clear"))}_parseLocalColor(t){const{values:e,type:n,a:i}=function(t){t=t.match(/^[a-zA-Z]+$/)?function(t){if("black"===t.toLowerCase())return"#000";const e=document.createElement("canvas").getContext("2d");return e.fillStyle=t,"#000"===e.fillStyle?null:e.fillStyle}(t):t;const e={cmyk:/^cmyk\D+([\d.]+)\D+([\d.]+)\D+([\d.]+)\D+([\d.]+)/i,rgba:/^rgba?\D+([\d.]+)(%?)\D+([\d.]+)(%?)\D+([\d.]+)(%?)\D*?(([\d.]+)(%?)|$)/i,hsla:/^hsla?\D+([\d.]+)\D+([\d.]+)\D+([\d.]+)\D*?(([\d.]+)(%?)|$)/i,hsva:/^hsva?\D+([\d.]+)\D+([\d.]+)\D+([\d.]+)\D*?(([\d.]+)(%?)|$)/i,hexa:/^#?(([\dA-Fa-f]{3,4})|([\dA-Fa-f]{6})|([\dA-Fa-f]{8}))$/i},n=t=>t.map(t=>/^(|\d+)\.\d+|\d+$/.test(t)?Number(t):void 0);let i;t:for(const o in e)if(i=e[o].exec(t))switch(o){case"cmyk":{const[,t,e,s,r]=n(i);if(t>100||e>100||s>100||r>100)break t;return{values:y(t,e,s,r),type:o}}case"rgba":{let[,t,,e,,s,,,r]=n(i);if(t="%"===i[2]?t/100*255:t,e="%"===i[4]?e/100*255:e,s="%"===i[6]?s/100*255:s,r="%"===i[9]?r/100:r,t>255||e>255||s>255||r<0||r>1)break t;return{values:[...v(t,e,s),r],a:r,type:o}}case"hexa":{let[,t]=i;4!==t.length&&3!==t.length||(t=t.split("").map(t=>t+t).join(""));const e=t.substring(0,6);let n=t.substring(6);return n=n?parseInt(n,16)/255:void 0,{values:[...w(e),n],a:n,type:o}}case"hsla":{let[,t,e,s,,r]=n(i);if(r="%"===i[6]?r/100:r,t>360||e>100||s>100||r<0||r>1)break t;return{values:[...b(t,e,s),r],a:r,type:o}}case"hsva":{let[,t,e,s,,r]=n(i);if(r="%"===i[6]?r/100:r,t>360||e>100||s>100||r<0||r>1)break t;return{values:[t,e,s,r],a:r,type:o}}}return{values:null,type:null}}(t),{lockOpacity:o}=this.options,s=void 0!==i&&1!==i;return e&&3===e.length&&(e[3]=void 0),{values:!e||o&&s?null:e,type:n}}_t(t){return this.options.i18n[t]||_.I18N_DEFAULTS[t]}_emit(t,...e){this._eventListener[t].forEach(t=>t(...e,this))}on(t,e){return this._eventListener[t].push(e),this}off(t,e){const n=this._eventListener[t]||[],i=n.indexOf(e);return~i&&n.splice(i,1),this}addSwatch(t){const{values:e}=this._parseLocalColor(t);if(e){const{_swatchColors:t,_root:n}=this,i=C(...e),s=r(`<button type="button" style="--pcr-color: ${i.toRGBA().toString(0)}" aria-label="${this._t("btn:swatch")}"/>`);return n.swatches.appendChild(s),t.push({el:s,color:i}),this._eventBindings.push(o(s,"click",()=>{this.setHSVA(...i.toHSVA(),!0),this._emit("swatchselect",i),this._emit("change",i,"swatch",this)})),!0}return!1}removeSwatch(t){const e=this._swatchColors[t];if(e){const{el:n}=e;return this._root.swatches.removeChild(n),this._swatchColors.splice(t,1),!0}return!1}applyColor(t=!1){const{preview:e,button:n}=this._root,i=this._color.toRGBA().toString(0);return e.lastColor.style.setProperty("--pcr-color",i),this.options.useAsButton||n.style.setProperty("--pcr-color",i),n.classList.remove("clear"),this._lastColor=this._color.clone(),this._initializingActive||t||this._emit("save",this._color),this}destroy(){cancelAnimationFrame(this._setupAnimationFrame),this._eventBindings.forEach(t=>s(...t)),Object.keys(this._components).forEach(t=>this._components[t].destroy())}destroyAndRemove(){this.destroy();const{root:t,app:e}=this._root;t.parentElement&&t.parentElement.removeChild(t),e.parentElement.removeChild(e),Object.keys(this).forEach(t=>this[t]=null)}hide(){return!!this.isOpen()&&(this._root.app.classList.remove("visible"),this._emit("hide"),!0)}show(){return!this.options.disabled&&!this.isOpen()&&(this._root.app.classList.add("visible"),this._rePositioningPicker(),this._emit("show",this._color),this)}isOpen(){return this._root.app.classList.contains("visible")}setHSVA(t=360,e=0,n=0,i=1,o=!1){const s=this._recalc;if(this._recalc=!1,t<0||t>360||e<0||e>100||n<0||n>100||i<0||i>1)return!1;this._color=C(t,e,n,i);const{hue:r,opacity:l,palette:a}=this._components;return r.update(t/360),l.update(i),a.update(e/100,1-n/100),o||this.applyColor(),s&&this._updateOutput(),this._recalc=s,!0}setColor(t,e=!1){if(null===t)return this._clearColor(e),!0;const{values:n,type:i}=this._parseLocalColor(t);if(n){const t=i.toUpperCase(),{options:o}=this._root.interaction,s=o.find(e=>e.getAttribute("data-type")===t);if(s&&!s.hidden)for(const t of o)t.classList[t===s?"add":"remove"]("active");return!!this.setHSVA(...n,e)&&this.setColorRepresentation(t)}return!1}setColorRepresentation(t){return t=t.toUpperCase(),!!this._root.interaction.options.find(e=>e.getAttribute("data-type").startsWith(t)&&!e.click())}getColorRepresentation(){return this._representation}getColor(){return this._color}getSelectedColor(){return this._lastColor}getRoot(){return this._root}disable(){return this.hide(),this.options.disabled=!0,this._root.button.classList.add("disabled"),this}enable(){return this.options.disabled=!1,this._root.button.classList.remove("disabled"),this}}return e.default})(),t.exports=e()},5775(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Split=e.Area=void 0;const i=n(1969),o=n(3252);class s{constructor(t={}){const e=document.createElement("div");e.className="litearea",(null==t?void 0:t.id)&&(e.id=t.id),(null==t?void 0:t.className)&&(e.className+=` ${t.className}`),this.root=e,this.root.litearea=this;let n=(null==t?void 0:t.width)||"100%",o=(null==t?void 0:t.height)||"100%";"number"==typeof n&&n<0&&(n=`calc( 100% - ${Math.abs(n)}px)`),"number"==typeof o&&o<0&&(o=`calc( 100% - ${Math.abs(o)}px)`),e.style.width="number"==typeof n?`${n}px`:n,e.style.height="number"==typeof o?`${o}px`:o,this.options=t,this._computedSize=[this.root.offsetWidth,this.root.offsetHeight];const s=document.createElement("div");(null==t?void 0:t.contentId)&&(s.id=t.contentId),s.className="liteareacontent",s.style.width="100%",s.style.height="100%",this.root.appendChild(s),this.content=s,this.splitDirection="none",this.sections=[],(null==t?void 0:t.autoresize)&&i.LiteGUI.bind(i.LiteGUI,"resized",()=>{this.onResize()})}getSection(t){return t=null!=t?t:0,this.sections.length>t?this.sections[t]:null}onResize(t){const e=[this.root.offsetWidth,this.root.offsetHeight];t&&this._computedSize&&e[0]==this._computedSize[0]&&e[1]==this._computedSize[1]||this.sendResizeEvent(t)}sendResizeEvent(t){if(this.sections.length)for(const e in this.sections){this.sections[e].onResize(t)}else for(let t=0;t<this.root.childNodes.length;t++){const e=this.root.childNodes[t];e.litearea?e.litearea.onResize():i.LiteGUI.trigger(e,"resize")}i.LiteGUI.sizeToCSS(),this.options.onResize&&this.options.onResize()}get getWidth(){return this.root.offsetWidth}get getHeight(){return this.root.offsetHeight}get isVisible(){return"none"!=this.root.style.display}adjustHeight(){if(!this.root.parentNode)return void console.error("Cannot adjust height of LiteGUI.Area without parent");const t=this.root.parentNode.offsetHeight,e=this.root.getClientRects()[0].top+t;this.root.style.height="calc( 100% - "+e+"px )"}split(t,e,n){if("string"!=typeof t)throw"First parameter must be a string: 'vertical' or 'horizontal'";if("vertical"!=t&&"horizontal"!=t)throw"First parameter must be a string: 'vertical' or 'horizontal'";if(e=null!=e?e:["50%",null],this.sections.length)throw"cannot split twice";const i=new s({contentId:this.content.id});i.root.style.display="inline-block";const o=new s;o.root.style.display="inline-block";let r,l,a="";const c=t=>{const e=this.root.ownerDocument;e.addEventListener("mousemove",u),e.addEventListener("mouseup",h),d[0]=t.pageX,d[1]=t.pageY,t.stopPropagation(),t.preventDefault()};if(n&&(a=` - ${s.splitbarSize+2}px`,r=document.createElement("div"),r.className=`litesplitbar ${t}`,"vertical"==t?r.style.height=`${s.splitbarSize}px`:r.style.width=`${s.splitbarSize}px`,this.splitbar=r,r.addEventListener("mousedown",c)),"vertical"==t)if(i.root.style.width="100%",o.root.style.width="100%",null==e[0]){let t=e[1];"number"==typeof t&&(t=`${e[1]}px`),i.root.style.height=`calc( 100% - ${t+a} )`,o.root.style.height=t,o.size=t,l=i}else if(null==e[1]){let t=e[0];"number"==typeof t&&(t=`${e[0]}px`),i.root.style.height=t,i.size=t,o.root.style.height=`calc( 100% - ${t+a} )`,l=o}else{let t=e[0];"number"==typeof t&&(t=`${e[0]}px`);let n=e[1];"number"==typeof n&&(n=`${e[1]}px`),i.root.style.height=t,i.size=t,o.root.style.height=n,o.size=n}else if(i.root.style.height="100%",o.root.style.height="100%",null==e[0]){let t=e[1];"number"==typeof t&&(t=`${e[1]}px`),i.root.style.width=`calc( 100% - ${t+a} )`,o.root.style.width=t,o.size=e[1],l=i}else if(null==e[1]){let t=e[0];"number"==typeof t&&(t=`${e[0]}px`),i.root.style.width=t,i.size=t,o.root.style.width=`calc( 100% - ${t+a} )`,l=o}else{let t=e[0];"number"==typeof t&&(t=`${e[0]}px`);let n=e[1];"number"==typeof n&&(n=`${e[1]}px`),i.root.style.width=t,i.size=t,o.root.style.width=n,o.size=n}i.root.removeChild(i.content),i.root.appendChild(this.content),i.content=this.content,this.root.appendChild(i.root),r&&this.root.appendChild(r),this.root.appendChild(o.root),this.sections=[i,o],this.dynamicSection=l,this.direction=t;const d=[0,0],u=e=>{"horizontal"==t?d[0]!=e.pageX&&this.moveSplit(d[0]-e.pageX):"vertical"==t&&d[1]!=e.pageY&&this.moveSplit(e.pageY-d[1]),d[0]=e.pageX,d[1]=e.pageY,e.stopPropagation(),e.preventDefault()},h=t=>{const e=this.root.ownerDocument;e.removeEventListener("mousemove",u),e.removeEventListener("mouseup",h),this.onResize(t)}}hide(){this.root.style.display="none"}show(){this.root.style.display="block"}showSection(t){let e=this.sections[t],n=0;if(!e||"none"==e.root.style.display){n="horizontal"==this.direction?e.root.style.width:e.root.style.height,-1!=n.indexOf("calc")&&(n="50%");for(const i in this.sections)e=this.sections[i],i==t.toString()?e.root.style.display="inline-block":"horizontal"==this.direction?e.root.style.width=`calc( 100% - ${n} - 5px)`:e.root.style.height=`calc( 100% - ${n} - 5px)`;this.splitbar&&(this.splitbar.style.display="inline-block"),this.sendResizeEvent()}}hideSection(t){for(const e in this.sections){const n=this.sections[e];e==t.toString()?n.root.style.display="none":"horizontal"==this.direction?n.root.style.width="100%":n.root.style.height="100%"}this.splitbar&&(this.splitbar.style.display="none"),this.sendResizeEvent()}moveSplit(t){var e,n;if(!this.sections)return;const i=this.sections[0],r=this.sections[1],l=` - ${s.splitbarSize}px`,a=null!==(n=null===(e=this.options)||void 0===e?void 0:e.minSplitSize)&&void 0!==n?n:10;if("horizontal"==this.direction)if(this.dynamicSection==i){let e=r.root.offsetWidth+t;e<a&&(e=a),i.root.style.width=`calc( 100% - ${e}px ${l} )`,r.root.style.width=`${e}px`}else{let e=i.root.offsetWidth-t;e<a&&(e=a),r.root.style.width=`calc( 100% - ${e}px ${l} )`,i.root.style.width=`${e}px`}else if("vertical"==this.direction)if(this.dynamicSection==i){let e=r.root.offsetHeight-t;e<a&&(e=a),i.root.style.height=`calc( 100% - ${e}px ${l} )`,r.root.style.height=`${e}px`}else{let e=i.root.offsetHeight+t;e<a&&(e=a),r.root.style.height=`calc( 100% - ${e}px ${l} )`,i.root.style.height=`${e}px`}(0,o.Trigger)(this.root,"split_moved");const c=this.root.querySelectorAll(".litearea");for(let t=0;t<c.length;++t)(0,o.Trigger)(c[t],"split_moved")}addEventListener(t,e,n){return this.root.addEventListener(t,e,n)}setAreaSize(t,e){const n=`${e+s.splitbarSize}px`;t.root.style.width=`calc( 100% - ${n} )`}merge(t){if(0==this.sections.length)throw"not splitted";const e=this.sections[t||0];this.root.appendChild(e.content),this.content=e.content,this.root.removeChild(this.sections[0].root),this.root.removeChild(this.sections[1].root),this.sections=[],this._computedSize=[],this.onResize()}add(t){if("string"==typeof t){const e=document.createElement("div");e.innerHTML=t,t=e}this.content.appendChild("root"in t?t.root:t)}query(t){return this.root.querySelector(t)}}e.Area=s,s.VERTICAL="vertical",s.HORIZONTAL="horizontal",s.splitbarSize=4;e.Split=class{constructor(t,e){var n,i;e=null!=e?e:{};const o=document.createElement("div");this.root=o,e.id&&(o.id=e.id),o.className="litesplit "+(e.vertical?"vsplit":"hsplit"),this.sections=[];for(const s in t){const r=t[s],l=document.createElement("div");if(l.className=`Zsplit-section split${s}`,"number"==typeof r)e.vertical?l.style.height=`${r.toFixed(1)}%`:l.style.width=`${r.toFixed(1)}%`;else if("string"==typeof r)e.vertical?l.style.height=r:l.style.width=r;else if(r.id&&(l.id=r.id),e.vertical){const t=null!==(n=r.height)&&void 0!==n?n:"100%";l.style.height="number"==typeof t?`${t.toFixed(1)}%`:t}else{const t=null!==(i=r.width)&&void 0!==i?i:"100%";l.style.width="number"==typeof t?`${t.toFixed(1)}%`:t}l.add=function(t){this.appendChild("root"in t?t.root:t)},this.sections.push(l),o.appendChild(l)}e.parent&&("root"in e.parent?e.parent.root.appendChild(o):e.parent.appendChild(o))}getSection(t){return this.sections[t]}}},2737(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Console=void 0;e.Console=class{constructor(t){var e,n;(t=null!=t?t:{prompt:">"}).prompt=null!==(e=t.prompt)&&void 0!==e?e:">",this.options=t,this.root=document.createElement("div"),this.root.className="liteconsole",this.root.innerHTML="<div class='log'></div><div class='foot'><input type='text'/></div>",this.logElement=this.root.querySelector(".log"),this.input=this.root.querySelector("input"),null===(n=this.input)||void 0===n||n.addEventListener("keydown",this.processKeyDown.bind(this)),this._prompt=this.options.prompt,this.history=[],this._historyOffset=0}processKeyDown(t){if(!this._inputBlocked&&this.input){switch(t.key){case"Enter":{const t=this.input.value.trim();this.addMessage(this._prompt+t,"me",!0),this.input.value="",this.history.push(t),this.history.length>10&&this.history.shift(),this.onProcessCommand(t),this._historyOffset=0;break}case"ArrowUp":case"ArrowDown":{this._historyOffset+="ArrowUp"==t.key?-1:1,this._historyOffset>0?this._historyOffset=0:this._historyOffset<-this.history.length&&(this._historyOffset=-this.history.length);const e=this.history.length+this._historyOffset;if(e<0)return;e>=this.history.length?this.input.value="":this.input.value=this.history[e];break}case"Tab":this.input.value=this.onAutocomplete(this.input.value);break;default:return}t.preventDefault(),t.stopPropagation()}}addMessage(t,e,n=!0){const i=this.logElement;let o=null;function s(t){o=document.createElement("pre"),n?o.innerText=t:o.innerHTML=t,o.className="msg",e&&(o.className+=" "+e),i.appendChild(o),i.children.length>1e3&&i.removeChild(i.children[0])}if(Array.isArray(t))for(let e=0;e<t.length;++e)s(t[e]);else s("string"!=typeof t?JSON.stringify(t,null,""):t);if(this.logElement.scrollTop=1e6,o)return o.update=function(t){this.innerHTML=t}.bind(o),o}log(...t){const e=t.join(",");return this.addMessage(e,"msglog")}warn(...t){const e=t.join(",");return this.addMessage(e,"msgwarn")}error(...t){const e=t.join(",");return this.addMessage(e,"msgerror")}clear(){this.logElement&&(this.logElement.innerHTML="")}onAutocomplete(t){return t}onProcessCommand(t){console.log(t)}}},1969(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LiteGUI=e.Core=e.SpecialCode=void 0;const i=n(5775),o=n(4606),s=n(736),r=n(4586),l=n(1994),a=n(7138),c=n(2737),d=n(796),u=n(8334),h=n(708),p=n(5460),g=n(3252);var m;!function(t){t.close="&#10005;",t.navicon="&#9776;",t.refresh="&#8634;",t.gear="&#9881;",t.openFolder="&#128194;",t.download="&#11123;",t.tick="&#10003;",t.trash="&#128465;"}(m||(e.SpecialCode=m={}));class f{constructor(){this.panels={},this.windows=[],this.Area=i.Area,this.Split=i.Split,this.Menubar=s.Menubar,this.Dialog=o.Dialog,this.Panel=r.Panel,this.Button=a.Button,this.SearchBox=a.SearchBox,this.ContextMenu=a.ContextMenu,this.Checkbox=a.Checkbox,this.ListBox=a.ListBox,this.List=a.List,this.Slider=a.Slider,this.LineEditor=a.LineEditor,this.ComplexList=a.ComplexList,this.Tabs=l.Tabs,this.Tree=d.Tree,this.Console=c.Console,this.Inspector=u.Inspector,this.Dragger=h.Dragger,this.Table=p.Table,this.SpecialCode=m,this.trigger=g.Trigger,this.bind=g.Bind,this.unbind=g.Unbind,this.removeClass=g.RemoveClass,this.remove=g.RemoveElement,this.getById=g.GetById,this.isCursorOverElement=g.IsCursorOverElement,this.getRect=g.GetRect,this.toClipboard=g.ToClipboard,this.addCSS=g.AddCSS,this.requireCSS=g.RequireCSS,this.request=g.Request,this.requestText=g.RequestText,this.requestJSON=g.RequestJSON,this.requestBinary=g.RequestBinary,this.requireScript=g.RequireScript,this.requireScriptSerial=g.RequireScriptSerial,this.createElement=g.CreateElement,this.createListItem=g.CreateListItem,this.createButton=g.CreateButton,this.getParents=g.GetParents,this.newWindow=g.NewWindow,this.showMessage=g.ShowMessage,this.popup=g.PopupDialog,this.alert=g.AlertDialog,this.confirm=g.ConfirmDialog,this.prompt=g.PromptDialog,this.choice=g.ChoiceDialog,this.downloadURL=g.DownloadURL,this.downloadFile=g.DownloadFile,this.getUrlVars=g.GetUrlVars,this.getUrlVar=g.GetUrlVar,this.focus=g.FocusElement,this.blur=g.BlurElement,this.draggable=g.Draggable,this.cloneObject=g.CloneObject,this.safeName=g.SafeName,this.htmlEncode=g.HTMLEncode,this.htmlDecode=g.HTMLDecode,this.sizeToCSS=g.SizeToCSS,this.getElementWindow=g.GetElementWindow,this.createDropArea=g.CreateDropArea}init(t){var e;if((t=null!=t?t:{}).container&&(this.container=null!==(e=document.getElementById(t.container))&&void 0!==e?e:void 0),this.container||(this.container=document.body),t.wrapped){const t=document.createElement("div");t.style.position="relative",t.style.overflow="hidden",this.root=t,this.container.appendChild(t);const e=document.createElement("div");this.content=e,this.root.appendChild(e),this.root.classList.contains("fullscreen")&&window.addEventListener("resize",()=>{this.maximizeWindow()})}else this.root=this.content=this.container;t.width&&t.height&&this.setWindowSize(t.width,t.height),this.root.className="litegui-wrap fullscreen",this.content.className="litegui-maincontent";const n=this.modalBackground=document.createElement("div");this.modalBackground.className="litemodalbg",this.root.appendChild(this.modalBackground),n.style.display="none",t.menubar&&this.createMenubar(),t.callback&&t.callback(),window.addEventListener("beforeunload",()=>{for(let t=0;t<this.windows.length;++t)this.windows[t].close();this.windows=[]})}add(t){var e;null===(e=this.content)||void 0===e||e.appendChild("root"in t?t.root:t)}createMenubar(){this.menubar=new e.LiteGUI.Menubar("mainmenubar"),this.add(this.menubar)}setWindowSize(t,e){var n,i,o,s;const r=null===(n=this.root)||void 0===n?void 0:n.style;if(t&&e)r.width=t+"px",r.height=e+"px",r.boxShadow="0 0 4px black",null===(i=this.root)||void 0===i||i.classList.remove("fullscreen");else{if(null===(o=this.root)||void 0===o?void 0:o.classList.contains("fullscreen"))return;null===(s=this.root)||void 0===s||s.classList.add("fullscreen"),r.width="100%",r.height="100%",r.boxShadow="0 0 0"}this.root&&this.trigger(this.root,"resized",void 0)}maximizeWindow(){this.setWindowSize(void 0,void 0)}setCursor(t){this.root&&(this.root.style.cursor=t)}newDiv(t,e){return this.createElement("div",t,e,void 0,void 0)}showModalBackground(t){this.modalBackground&&(this.modalBackground.style.display=t?"block":"none")}}e.Core=f,Object.defineProperty(String.prototype,"template",{value:function(t,e){let n=this;const i=/{{([^}}]+)?}}/g;let o;for(;o;){const s=e?new Function(`with(this) { try { return ${o[1]} } catch(e) { return 'error';} }`).call(t):t[o[1]];n=n.replace(o[0],s),o=i.exec(n)}return n},enumerable:!1}),e.LiteGUI=new f},4606(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Dialog=void 0;const i=n(1969);class o{constructor(t){var e,n,s,r;if(this.resizable=!1,this.draggable=!1,this._minimized=[],"string"==typeof t){t={id:t}}t=null!=t?t:{},this.root=document.createElement("div"),this.width=t.width,this.height=t.height,this.minWidth=null!==(e=t.minWidth)&&void 0!==e?e:150,this.minHeight=null!==(n=t.minHeight)&&void 0!==n?n:100;const l=document.createElement("div");t.id&&(l.id=t.id),l.className=`litedialog ${null!==(s=t.className)&&void 0!==s?s:""}`,l.dialog=this;let a="";if(t.title&&(a+=`<div class='panel-header'>${t.title}</div><div class='buttons'>`,t.minimize&&(a+="<button class='litebutton mini-button minimize-button'>-</button>",a+="<button class='litebutton mini-button maximize-button' style='display:none'></button>"),t.hide&&(a+="<button class='litebutton mini-button hide-button'></button>"),t.detachable&&(a+="<button class='litebutton mini-button detach-button'></button>"),(t.close||t.closable)&&(a+=`<button class='litebutton mini-button close-button'>${i.SpecialCode.close}</button>`),a+="</div>"),a+=`<div class='content'>${null!==(r=t.content)&&void 0!==r?r:""}</div>`,a+="<div class='panel-footer'></div>",l.innerHTML=a,this.root=l,this.header=l.querySelector(".panel-header"),this.content=l.querySelector(".content"),this.footer=l.querySelector(".panel-footer"),t.fullContent&&(this.content.style.width="100%",this.content.style.height=t.title?`calc( 100% - ${o.TITLE_HEIGHT} )`:"100%"),t.buttons)for(const e of t.buttons)this.addButton(e.name,e);1==t.scroll&&(this.content.style.overflow="auto");const c=l.querySelector(".close-button");c&&c.addEventListener("click",this.close.bind(this));const d=l.querySelector(".maximize-button");d&&d.addEventListener("click",this.maximize.bind(this));const u=l.querySelector(".minimize-button");null==u||u.addEventListener("click",this.minimize.bind(this));const h=l.querySelector(".hide-button");null==h||h.addEventListener("click",this.hide.bind(this));const p=l.querySelector(".detach-button");if(null==p||p.addEventListener("click",()=>{this.detachWindow(void 0,void 0)}),this.enableProperties(t),this.root.addEventListener("DOMNodeInsertedIntoDocument",()=>{this.onAttachedToDOM&&this.onAttachedToDOM(),this.onResize&&this.onResize()}),this.root.addEventListener("DOMNodeRemovedFromDocument",()=>{this.onDetachedFromDOM&&this.onDetachedFromDOM()}),t.attach||t.parent){let e=null;t.parent&&(e="string"==typeof t.parent?document.querySelector(t.parent):t.parent),e||(e=i.LiteGUI.root),null==e||e.appendChild(this.root),this.center()}}getDialog(t){const e=document.getElementById(t);if(e)return e.dialog}add(t){var e;t.root&&(null===(e=this.content)||void 0===e||e.appendChild(t.root))}enableProperties(t){t=null!=t?t:{};const e=this.root;if(e.style.position="absolute",e.style.minWidth=this.minWidth+"px",e.style.minHeight=this.minHeight+"px",this.width&&(e.style.width=this.width+"px"),this.height&&("number"==typeof this.height?e.style.height=this.height+"px":-1!=this.height.indexOf("%")&&(e.style.height=this.height),this.content.style.height="calc( "+this.height+"px - 24px )"),e.style.boxShadow="0 0 3px black",t.draggable){this.draggable=!0;const t=e.querySelector(".panel-header");t&&i.LiteGUI.draggable(e,t,()=>{this.bringToFront()},()=>{},()=>!this._minimized.includes(this))}t.resizable&&this.setResizable()}setResizable(){var t;if(this.resizable)return;const e=this.root;this.resizable=!0;const n=this.footer;n&&(n.style.minHeight="4px",n.classList.add("resizable"));const o=document.createElement("div");o.className="resizable-corner",null===(t=this.root)||void 0===t||t.appendChild(o);const s=[0,0];let r=!1;const l=t=>{const n=t.target;if("mousedown"==t.type)document.body.addEventListener("mousemove",l),document.body.addEventListener("mouseup",l),r=n==o,s[0]=t.pageX,s[1]=t.pageY;else if("mousemove"==t.type){const n=i.LiteGUI.getRect(e),o=n.width,l=o-(s[0]-t.pageX),a=n.height,c=a-(s[1]-t.pageY);r&&(e.style.width=l+"px"),e.style.height=c+"px",s[0]=t.pageX,s[1]=t.pageY,this.content.style.height="calc( 100% - 24px )",!this.onResize||o==l&&a==c||this.onResize(t,l,c)}else"mouseup"==t.type&&(document.body.removeEventListener("mousemove",l),document.body.removeEventListener("mouseup",l),r=!1);return t.preventDefault(),t.stopPropagation(),!1};null==n||n.addEventListener("mousedown",l),o.addEventListener("mousedown",l,!0)}dockTo(t,e,n){if(null==t)return;e=null!=e?e:"full";const o=this.root;if(o.style.top="0",o.style.left="0",o.style.boxShadow="0 0 0","full"==e?(o.style.position="relative",o.style.width="100%",o.style.height="100%",this.content.style.width="100%",this.content.style.height="calc(100% - "+(null!=n?n:i.LiteGUI.Panel.TITLE_HEIGHT)+")",this.content.style.overflow="auto"):"left"==e||"right"==e?(o.style.position="absolute",o.style.top="0",o.style[e]="0",o.style.width=this.width+"px",o.style.height="100%",this.content.style.height="calc(100% - "+(null!=n?n:i.LiteGUI.Panel.TITLE_HEIGHT)+")",this.content.style.overflow="auto","right"==e&&(o.style.left="auto",o.style.right="0")):"bottom"!=e&&"top"!=e||(o.style.width="100%",o.style.height=this.height+"px","bottom"==e&&(o.style.bottom="0",o.style.top="auto")),this.draggable&&i.LiteGUI.draggable(o),"string"==typeof t){const e=document.querySelector(t);e&&e.appendChild(o)}else t&&"content"in t?t.content.appendChild(o):t&&"root"in t?t.root.appendChild(o):t&&"appendChild"in t&&t.appendChild(o)}addButton(t,e){var n;null==e&&(e={}),e.constructor===Function&&(e={callback:e});const i=e,o=document.createElement("button");o.className="litebutton",null!=t&&(o.innerHTML=t),"string"==typeof i.className&&(o.className+=" "+i.className),null===(n=this.root)||void 0===n||n.querySelector(".panel-footer").appendChild(o);return o.addEventListener("click",(()=>{i.callback&&i.callback(o),i.close&&this.close()}).bind(o)),o}close(){i.LiteGUI.remove(this.root),i.LiteGUI.trigger(this.root,"closed",this),this.onClose&&this.onClose(),this._dialogWindow&&(this._dialogWindow.close(),this._dialogWindow=void 0)}highlight(t=100){var e;this.root.style.outline="1px solid white";const n=this.root.ownerDocument,i=null!==(e=n.defaultView)&&void 0!==e?e:n.parentWindow;null==i||i.focus(),setTimeout(()=>{this.root.style.outline=null},t)}minimize(){var t;if(this._minimized.length)return;if(this._oldBox=null===(t=this.root)||void 0===t?void 0:t.getBoundingClientRect(),!this.root.querySelector(".content"))return;this.root.querySelector(".content").style.display="none";const e=this.root.querySelector(".minimize-button");e&&(e.style.display="none");const n=this.root.querySelector(".maximize-button");n&&(n.style.display=""),this.root.style.width=i.LiteGUI.Dialog.MINIMIZED_WIDTH+"px";i.LiteGUI.bind(this.root,"closed",t=>{const e=t.target;this._minimized.splice(this._minimized.indexOf(e),1),this.arrangeMinimized()}),this._minimized.push(this),this.arrangeMinimized(),i.LiteGUI.trigger(this.root,"minimizing")}arrangeMinimized(){var t;for(const e in this._minimized){const n=this._minimized[e],o=n.root.parentNode,s=(null!==(t=null==o?void 0:o.getBoundingClientRect().height)&&void 0!==t?t:20)-20;n.root.style.left=(i.LiteGUI.Dialog.MINIMIZED_WIDTH*parseInt(e)).toString(),n.root.style.top=s+"px"}}maximize(){if(0==this._minimized.length)return;this._minimized=[],this.content.style.display="",i.LiteGUI.draggable(this.root),this._oldBox&&(this.root.style.left=this._oldBox.left+"px",this.root.style.top=this._oldBox.top+"px",this.root.style.width=this._oldBox.width+"px",this.root.style.height=this._oldBox.height+"px");const t=this.root.querySelector(".minimize-button");t&&(t.style.display="");const e=this.root.querySelector(".maximize-button");e&&(e.style.display="none"),this._minimized.splice(this._minimized.indexOf(this),1),this.arrangeMinimized(),i.LiteGUI.trigger(this.root,"maximizing")}makeModal(){var t;i.LiteGUI.showModalBackground(!0),null===(t=i.LiteGUI.modalBackground)||void 0===t||t.appendChild(this.root),this.show(),this.center(),i.LiteGUI.bind(this.root,"closed",function(){i.LiteGUI.showModalBackground(!1)})}bringToFront(){const t=this.root.parentNode;t&&(t.removeChild(this.root),t.appendChild(this.root))}show(t){var e,n;if(!this.root.parentNode){if(t){const i=t;(null!==(e=i.querySelector(".litegui-wrap"))&&void 0!==e?e:i.body).appendChild(this.root);(null!==(n=i.defaultView)&&void 0!==n?n:i.parentWindow).focus()}else i.LiteGUI.add(this);this.center()}this._isWindowDetached||(this.root.style.display="",i.LiteGUI.trigger(this.root,"shown"))}hide(){this.root.style.display="none",i.LiteGUI.trigger(this.root,"hidden")}fadeIn(t=1e3,e=100){this.root.style.display="",this.root.style.opacity="0",setTimeout(()=>{this.root.style.transition=`opacity ${t}ms`,this.root.style.opacity="1"},e)}setPosition(t,e){this.root.parentNode||console.warn("LiteGUI.Dialog: Cannot set position of dialog if it is not in the DOM"),this.root.style.position="absolute",this.root.style.left=t+"px",this.root.style.top=e+"px"}setSize(t,e){this.root.style.width="number"==typeof t?t+"px":t,this.root.style.height="number"==typeof e?e+"px":e}setTitle(t){this.header&&(this.header.innerHTML=t)}center(){if(!this.root.parentNode)return;this.root.style.position="absolute";const t=this.root.offsetWidth,e=this.root.offsetHeight,n=this.root.parentNode,i=n.offsetWidth,o=n.offsetHeight;this.root.style.left=Math.floor(.5*(i-t))+"px",this.root.style.top=Math.floor(.5*(o-e))+"px"}adjustSize(t=0,e){if(this.content.style.height="auto",0==this.content.offsetHeight&&!e)return void setTimeout(()=>{this.adjustSize(t,!0)},1);let n=0;const i=this.root.querySelector(".panel-footer");i&&(n+=i.offsetHeight);const o=this.content.offsetWidth,s=this.content.offsetHeight+20+t+n;this.setSize(o,s)}clear(){this.content.innerHTML=""}detachWindow(t,e){var n;if(this._minimized.length>0&&this.maximize(),this._dialogWindow)return;const o=this.root.getClientRects()[0],s=o.width,r=o.height;let l="Window";this.header&&(l=null!==(n=this.header.textContent)&&void 0!==n?n:"");const a=window.open("","","width="+s+", height="+r+", location=no, status=no, menubar=no, titlebar=no, fullscreen=yes");a.document.writeln("<head><title>"+l+"</title>"),this._dialogWindow=a;const c=document.querySelectorAll("link[rel='stylesheet'],style");for(let t=0;t<c.length;t++)a.document.writeln(c[t].outerHTML);return a.document.writeln("</head><body></body>"),a.document.close(),a.onbeforeunload=function(){const t=i.LiteGUI.windows.indexOf(a);-1!=t&&i.LiteGUI.windows.splice(t,1),e&&e()},a.document.body.appendChild(this.content),this.root.style.display="none",this._oldHeight=this.content.style.height,this.content.style.height="100%",i.LiteGUI.windows.push(a),t&&t(),a}reattachWindow(t){if(!this._dialogWindow)return;this.root.appendChild(this.content),this.root.style.display="",this._oldHeight&&(this.content.style.height=this._oldHeight,this._oldHeight=void 0),this._dialogWindow.close();const e=i.LiteGUI.windows.indexOf(this._dialogWindow);-1!=e&&i.LiteGUI.windows.splice(e,1),this._dialogWindow=void 0,t&&t()}showAll(){var t;const e=document.body.querySelectorAll("litedialog");for(let n=0;n<e.length;n++){null===(t=e[n].dialog)||void 0===t||t.show()}}hideAll(){var t;const e=document.body.querySelectorAll("litedialog");for(let n=0;n<e.length;n++){null===(t=e[n].dialog)||void 0===t||t.hide()}}closeAll(){var t;const e=document.body.querySelectorAll("litedialog");for(let n=0;n<e.length;n++){null===(t=e[n].dialog)||void 0===t||t.close()}}}e.Dialog=o,o.TITLE_HEIGHT="20px",o.MINIMIZED_WIDTH=200},708(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Dragger=void 0;const i=n(1969);e.Dragger=class{constructor(t,e){var n,o;this.dragging=!1,"string"==typeof(t=null!=t?t:0)?t=parseFloat(t):"number"!=typeof t&&(t=0),this.value=t,this.options=e=null!=e?e:{};const s=null!==(n=e.precision)&&void 0!==n?n:3,r=document.createElement("div");r.className=`dragger ${e.extraClass}`,this.root=r;const l=document.createElement("span");l.className=`inputfield ${e.extraClass} ${e.full?"full":""}`,e.disabled&&(l.className+=" disabled"),r.appendChild(l);const a=e.draggerClass||"full",c=document.createElement("input");c.className=`text number ${a}`,c.value=t.toFixed(s)+(e.units?e.units:""),c.tabIndex=null!==(o=e.tabIndex)&&void 0!==o?o:0,this.input=c,r.input=c,e.disabled&&(c.disabled=!0),e.tabIndex&&(c.tabIndex=e.tabIndex),l.appendChild(c),c.addEventListener("keydown",t=>{switch(t.key){case"ArrowUp":g(1,t);break;case"ArrowDown":g(-1,t);break;default:return!1}return t.stopPropagation(),t.preventDefault(),!0});const d=document.createElement("div");d.className="drag_widget",e.disabled&&(d.className+=" disabled"),l.appendChild(d),r.dragger=d;d.addEventListener("mousedown",t=>{u=c.ownerDocument,u.removeEventListener("mousemove",h),u.removeEventListener("mouseup",p),e.disabled||(r.requestPointerLock&&r.requestPointerLock(),u.addEventListener("mousemove",h),u.addEventListener("mouseup",p),d.data=[t.screenX,t.screenY],this.dragging=!0,i.LiteGUI.trigger(r,"start_dragging")),t.stopPropagation(),t.preventDefault()});c.addEventListener("wheel",function(t){if(document.activeElement!==c)return;g((t.deltaY?-t.deltaY/3:0)>0?1:-1,t),t.stopPropagation(),t.preventDefault()}.bind(c),!1);let u=null;function h(t){let n=[t.screenX-(d.data?d.data[0]:0),(d.data?d.data[1]:0)-t.screenY];void 0!==t.movementX&&(n=[t.movementX,-t.movementY]),d.data=[t.screenX,t.screenY];return g(n[e.horizontal?0:1],t),t.stopPropagation(),t.preventDefault(),!1}const p=t=>{this.dragging=!1,i.LiteGUI.trigger(r,"stop_dragging");const e=u||document;return u=null,e.removeEventListener("mousemove",h),e.removeEventListener("mouseup",p),e.exitPointerLock&&e.exitPointerLock(),i.LiteGUI.trigger(d,"blur"),t.stopPropagation(),t.preventDefault(),!1};function g(t,n){let o=t;e.linear||(o=o>0?Math.pow(o,1.2):-1*Math.pow(Math.abs(o),1.2));let r=e.step?e.step:1;n&&n.shiftKey?r*=10:n&&n.ctrlKey&&(r*=.1);let l=parseFloat(c.value)+o*r;"number"==typeof e.max&&l>e.max&&(l=e.max),"number"==typeof e.min&&l<e.min&&(l=e.min),c.value=l.toFixed(s),e.units&&(c.value+=e.units),i.LiteGUI.trigger(c,"change")}}setRange(t,e){this.options.min=t,this.options.max=e}setValue(t,e){let n;this.value="string"==typeof t?parseFloat(t):t,n=this.options.precision?this.value.toFixed(this.options.precision):this.value.toString(),this.options.units&&(n+=this.options.units),this.input.value=n,e||i.LiteGUI.trigger(this.input,"change")}getValue(){return this.value}}},3859(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddArray=s;const i=n(7387),o=n(1969);function s(t,e,n,i={}){var s,r;const l=null!==(s=i.dataType)&&void 0!==s?s:"string",a=null!==(r=i.maxItems)&&void 0!==r?r:100,c=t=>{switch(t){case"number":case"slide":return 0;case"string":case"text":case"textarea":return"";case"boolean":case"checkbox":return!1;case"vec2":case"vector2":return[0,0];case"vec3":case"vector3":return[0,0,0];case"vec4":case"vector 4":return[0,0,0,0];case"color":return[1,1,1];default:return null}},d=t.createWidget(e,void 0,Object.assign(Object.assign({},i),{width:"100%"}));d.className+=" array-widget";const u=document.createElement("div");u.className="array-header";const h=document.createElement("span");h.className="wname",h.innerText=e,h.title=e,i.nameWidth&&(h.style.width=o.LiteGUI.sizeToCSS(i.nameWidth)),u.appendChild(h);const p=document.createElement("div");p.className="array-controls";const g=document.createElement("button");g.className="litebutton",g.innerText="+",g.addEventListener("click",()=>{var t;const e=null!==(t=c(l))&&void 0!==t?t:"";Array.isArray(e)?n.push([...e]):n.push(e),w(),b(n.length-1)});const m=document.createElement("button");let f;m.className="litebutton",m.innerText="-",m.addEventListener("click",()=>{n.length>0&&(n.length=n.length-1,w(),b(n.length))}),p.appendChild(g),p.appendChild(m),i.showLength&&(f=document.createElement("input"),f.type="text",f.className="array-length",f.value=n.length.toString(),f.addEventListener("change",t=>{var e;const i=parseInt(t.target.value);if(!isNaN(i)){if(i>n.length)for(let t=n.length;t<i;++t){const t=null!==(e=c(l))&&void 0!==e?e:"";Array.isArray(t)?n.push([...t]):n.push(t)}else n.length=Math.max(0,i);w(),b()}}),p.appendChild(f)),u.appendChild(p),d.innerHTML="",d.appendChild(u);const v=document.createElement("div");v.className="wcontainer array-items",d.value=n,d.appendChild(v),t.appendWidget(d);const y=function(t,e){t.value[t.index]=e,b(t.index)},b=(o=-1)=>{f&&(f.value=n.length.toString()),i.callback&&i.callback(n,o),t.onWidgetChange(d,e,n,i)},w=function(){var e;const o=Math.min(n.length,a);f&&(f.value=n.length.toString()),v.innerHTML="";const s=t.widgetsPerRow;t.widgetsPerRow=1;for(let s=0;s<o;++s){if(void 0===n[s]){const t=null!==(e=c(l))&&void 0!==e?e:"";Array.isArray(t)?n[s]=[...t]:n[s]=t}const o=n[s],r=document.createElement("div");r.className="array-row",r.innerHTML=`<span class='row-index'>${s}</span><span class='row-cell'></span><button style='width: 30px;' class='litebutton single row-trash'></button>`,v.appendChild(r);const a=r.querySelector(".row-cell"),d=Object.assign(Object.assign({},i.dataOptions),{widgetParent:a,callback:y.bind(void 0,{value:n,index:s})});t.add(l,void 0,o,d);const u=r.querySelector(".row-trash");u&&u.addEventListener("click",()=>{n&&n.length>s&&(n.splice(s,1),w(),b(-1))})}t.widgetsPerRow=s};return w(),d.setValue=function(t){if(void 0===t||!Array.isArray(t))return;const e=t;this.value=e,n.length=0;for(let t=0;t<e.length;++t)n[t]=e[t];w()},d.getValue=function(){return this.value},d}i.Inspector.prototype.addArray=function(t,e,n){return s(this,t,e,n)},i.Inspector.widgetConstructors.array="addArray"},236(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddButton=s,e.AddButtons=r;const i=n(1969),o=n(7387);function s(t,e,n,o){var s,r,l;const a=t.processOptions(o);n=null!=(n=null!==(s=a.buttonText)&&void 0!==s?s:n)?n:"",e=null!=e?e:n;const c=t.getValueName(e,a);a.widgetName||(a.widgetName=c);let d="";e||(d="single"),a.micro&&(d+=" micro");let u="";a.disabled&&(u="disabled='disabled'");const h=null!==(l=null===(r=a.title)||void 0===r?void 0:r.toString())&&void 0!==l?l:"",p=t.createWidget(e,"<button tabIndex='"+t.tabIndex+"' "+u+"></button>",a);t.tabIndex++;const g=p.querySelector("button");return g.setAttribute("title",h),g.className="litebutton "+d,g.innerHTML=n,g.addEventListener("click",o=>{t.onWidgetChange(p,e,g.innerHTML,a,!1,o),i.LiteGUI.trigger(g,"wclick",n)}),t.appendWidget(p,a),p.wclick=function(t){a.disabled||i.LiteGUI.bind(p,"wclick",t)},p.setValue=function(t){void 0!==t&&"string"==typeof t&&(g.innerHTML=t)},p.disable=function(){g.disabled=!0},p.enable=function(){g.disabled=!1},t.processElement(p,a),p}function r(t,e,n,i){const o=t.processOptions(i);n=null!=n?n:[];const s=t.getValueName(e,o);o.widgetName||(o.widgetName=s);let r="";const l=`calc( ${(100/n.length).toFixed(3)}% - 4px )`,a=`width: ${l}; width: -moz-${l}; width: -webkit-${l}; margin: 2px;`;for(const e in n){let i="";o.title&&(i=Array.isArray(o.title)?o.title[e]:o.title),r+=`<button class='litebutton' title='${i}' tabIndex='${t.tabIndex}' style='${a}'>${n[e]}</button>`,t.tabIndex++}const c=t.createWidget(e,r,o),d=c.querySelectorAll("button"),u=function(e,n){t.onWidgetChange(c,s,e.innerHTML,o,!1,n)};for(let t=0;t<d.length;++t){const e=d[t];e.addEventListener("click",u.bind(void 0,e))}return t.appendWidget(c,o),t.processElement(c,o),c}o.Inspector.prototype.addButton=function(t,e,n){return s(this,t,e,n)},o.Inspector.prototype.addButtons=function(t,e,n){return r(this,t,e,n)},o.Inspector.widgetConstructors.button="addButton",o.Inspector.widgetConstructors.buttons="addButtons"},3189(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddCheckbox=s;const i=n(1969),o=n(7387);function s(t,e,n,o){var s,r,l,a;n=null!=n&&n,o=null!=o?o:{};const c=t.getValueName(e,o);t.values.set(c,n);const d=null!==(r=null!==(s=o.labelOn)&&void 0!==s?s:o.label)&&void 0!==r?r:"on",u=null!==(a=null!==(l=o.labelOff)&&void 0!==l?l:o.label)&&void 0!==a?a:"off",h=n?d:u,p=t.createWidget(e,`<span class='inputfield'><span tabIndex='${t.tabIndex}' class='fixed flag checkbox ${n?"on":"off"}'>${h}</span></span>`,o);t.tabIndex++;const g=p.querySelector(".wcontent .checkbox");return g.addEventListener("keypress",t=>{"Space"!==t.code&&" "!==t.key||i.LiteGUI.trigger(g,"click")}),p.addEventListener("click",()=>{n=!n,p.querySelector("span.flag").innerHTML=n?d:u,n?g.classList.add("on"):g.classList.remove("on"),t.onWidgetChange(p,c,n,o)}),p.getValue=function(){return n},p.setValue=(e,o)=>{void 0!==e&&"boolean"==typeof e&&n!=e&&(n=e,t.values.set(c,e),o||i.LiteGUI.trigger(g,"click"))},t.appendWidget(p,o),t.processElement(p,o),p}o.Inspector.prototype.addCheckbox=function(t,e,n){return s(this,t,e,n)},o.Inspector.widgetConstructors.checkbox="addCheckbox",o.Inspector.widgetConstructors.boolean="addCheckbox"},7461(t,e,n){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.AddColor=a;const o=n(3252),s=n(1969),r=n(7387),l=i(n(3931));function a(t,e,n=[0,0,0,255],i={}){var a;3===n.length&&(n=n.concat(255)),t.values.set(e,n);const c=t.processOptions(i);let d=`<div class='input_container' style='display: inline-block; width: calc(100% - 4px);'><input tabIndex='${t.tabIndex}' id='colorpicker-${e}' class='color' value='${n[0]},${n[1]},${n[2]},${n[3]}' ${c.disabled?"disabled":""}/></div>`;t.tabIndex++,c.showRGB&&(d+=`<span class='rgb-color'>${r.Inspector.parseColor(n.concat())}</span>`);const u=t.createWidget(e,d,c);t.appendWidget(u,c);const h=u.querySelector("input.color"),p=new l.default({el:h,theme:"nano",default:(0,o.RGBAToHEXA)(n),components:{preview:!0,opacity:null!==(a=c.opacityControl)&&void 0!==a&&a,hue:!0,interaction:{hex:!0,rgba:!0,hsla:!1,hsva:!1,cmyk:!1,input:!0,clear:!1,cancel:!0,save:!0}},position:"bottom-start",disabled:c.disabled}),g=n=>{if(!n)return;const i=n.toRGBA();i[3]=255*i[3];const o=n.toHEXA().toString(),l=u.querySelector(".rgb-color");l&&(l.innerHTML=r.Inspector.parseColor(i.concat())),t.values.set(e,i.concat());const a=[i.concat(),o];s.LiteGUI.trigger(u,"wbeforechange",a),c.callback?c.callback.call(u,i.concat(),o):c.onChange&&c.onChange.call(u,i.concat(),o),s.LiteGUI.trigger(u,"wchange",a),t.onChange&&t.onChange(e,i.concat(),u)};return p.on("save",t=>{g(t),p.hide()}),p.on("change",t=>{g(t)}),u.setValue=function(t,e){if(void 0===t||!Array.isArray(t)||t.length<3)return;const n=t,i=`rgba(${n[0]},${n[1]},${n[2]},${n.length>3?n[3]:255})`;if(p.setColor(i),!e){const t=p.getColor();g(t)}},u.getValue=function(){return t.values.get(e)},t.processElement(u,c),u}r.Inspector.prototype.addColor=function(t,e,n){return a(this,t,e,n)},r.Inspector.widgetConstructors.color="addColor"},8788(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddCombo=s,e.AddComboButtons=r;const i=n(1969),o=n(7387);function s(t,e,n,i){var o;n=null!=n?n:"",i=null!=i?i:{};const s=t.getValueName(e,i);t.values.set(s,n),t.tabIndex++;const r=i.disabled?"disabled":"",l=t.createWidget(e,"<span class='inputfield full inputcombo "+r+"'></span>",i);l.options=i;let a=null!==(o=i.values)&&void 0!==o?o:[];const c="<select tabIndex='"+t.tabIndex+"' "+r+" class='"+r+"'></select>";l.querySelector("span.inputcombo").innerHTML=c,u(a);let d=!1;function u(t,e){a=t,e&&(n=e);let i="";for(const t in a)i+="<option value='"+t+"' "+(a[t]==n?" selected":"")+" data-index='"+t+"'>"+a[t]+"</option>";l.querySelector("select").innerHTML=i}return l.querySelector(".wcontent select").addEventListener("change",e=>{const o=e.target.value;n=o,d||t.onWidgetChange(l,s,n,i)}),l.getValue=function(){return n},l.setValue=function(t,e){var i;if(void 0===t||"string"!=typeof t)return;n=t;const o=l.querySelector("select"),s=o.querySelectorAll("option"),r=null!==(i=a.indexOf(t))&&void 0!==i?i:-1;if(-1!=r){d=null!=e&&e;for(const t in s){const e=s[t];if(!e||!e.dataset)continue;const n=e.dataset.index;n&&parseFloat(n)==r?(e.selected=!0,o.selectedIndex=r):e.removeAttribute("selected")}d=!1}},l.setOptionValues=u,t.appendWidget(l,i),t.processElement(l,i),l}function r(t,e,n,o){n=null!=n?n:"",o=null!=o?o:{};const s=t.getValueName(e,o);t.values.set(s,n);let r="";if(o.values)for(const t in o.values)r+=`<button class='wcombobutton ${n==o.values[t]?"selected":""}' data-name='${o.values[t]}'>${o.values[t]}</button>`;const l=t.createWidget(e,r,o),a=l.querySelectorAll(".wcontent button");return l.buttons=a,i.LiteGUI.bind(a,"click",e=>{const n=e.target,i=n.innerHTML;t.values.set(s,i);const r=l.querySelectorAll(".selected");for(let t=0;t<r.length;++t)r[t].classList.remove("selected");n.classList.add("selected"),t.onWidgetChange(l,s,i,o)}),t.appendWidget(l,o),t.processElement(l,o),l}o.Inspector.prototype.addCombo=function(t,e,n){return s(this,t,e,n)},o.Inspector.prototype.addComboButtons=function(t,e,n){return r(this,t,e,n)},o.Inspector.widgetConstructors.combo="addCombo",o.Inspector.widgetConstructors.enum="addCombo",o.Inspector.widgetConstructors.dropdown="addCombo",o.Inspector.widgetConstructors.combobuttons="addComboButtons"},3280(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddDataTree=o;const i=n(7387);function o(t,e,n,i){const o=t.createWidget(e,"<div class='wtree'></div>",i),s=o.querySelector(".wtree");if(s)return function t(e,n){for(const i in n){const o=document.createElement("div");o.className="treenode";const s=n[i];if("object"!=typeof s||Array.isArray(s))o.innerHTML=`<span class='itemname'>${i}</span><span class='itemvalue'>${s}</span>`;else{o.innerHTML=`<span class='itemname'>${i}</span><span class='itemcontent'></span>`;const e=o.querySelector(".itemcontent");if(null==e)throw new Error("TreeNode wasn't properly created");t(e,s)}e.appendChild(o)}}(s,n),i&&i.height&&(s.style.height="number"==typeof i.height?i.height+"px":i.height,s.style.overflow="auto"),t.appendWidget(o,i),o}i.Inspector.prototype.addDataTree=function(t,e,n){return o(this,t,e,n)},i.Inspector.widgetConstructors.datatable="addDataTree"},7246(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddFile=o;const i=n(7387);function o(t,e,n,i){t.values.set(e,{name:null!=n?n:""});const o=t.processOptions(i),s=t.createWidget(e,"<span class='inputfield full whidden' style='width: calc(100% - 26px)'><span class='filename'></span></span><button class='litebutton' style='width:20px; margin-left: 2px;'>...</button><input type='file' size='100' class='file' value='"+n+"'/>",o);s.querySelector(".wcontent").style.position="relative";const r=s.querySelector(".wcontent input");o.accept&&(r.accept="string"==typeof o.accept?o.accept:o.accept.toString());const l=s.querySelector(".wcontent .filename");return n&&(l.innerText=n),r.addEventListener("change",n=>{if(!n||!n.target)return;const i=n.target;if(!i.files)return;if(!i.files.length)return l.innerText="",void t.onWidgetChange(s,e,void 0,o);const r=i.files[0];if(r.files=i.files,o.generateURL&&(r.url=URL.createObjectURL(i.files[0])),l.innerText=r.name,o.readFile){const n=new FileReader;n.onload=n=>{var i;r.data=null===(i=n.target)||void 0===i?void 0:i.result,t.onWidgetChange(s,e,r,o)},"binary"==o.readFile?n.readAsArrayBuffer(r):"data_url"==o.readFile?n.readAsDataURL(r):n.readAsText(r)}else t.onWidgetChange(s,e,r,o)}),t.appendWidget(s,o),s}i.Inspector.prototype.addFile=function(t,e,n){return o(this,t,e,n)},i.Inspector.widgetConstructors.file="addFile"},9266(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddFlags=o;const i=n(7387);function o(t,e,n,i){var o;i=null!=i?i:{};const s={};for(const t in e)s[t]=e[t];if(n)for(const t in n)void 0===s[t]&&(s[t]=null!==(o=n[t])&&void 0!==o&&o);let r;"default"in i&&(r=i.default);const l=[];for(const n in s){let o;o=n in i?i[n]:r||i;const a=Object.assign({},o);a.callback=function(t){e[n]=t},l.push(t.addCheckbox(n,s[n],a))}return l}i.Inspector.prototype.addFlags=function(t,e,n){return o(this,t,e,n)},i.Inspector.widgetConstructors.flags="addFlags"},5885(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddIcon=s;const i=n(1969),o=n(7387);function s(t,e,n,o){var s,r,l,a,c,d;const u=t.processOptions(o);e=null!=e?e:"",n=null!=n&&n;const h=null!==(s=u.imageURL)&&void 0!==s?s:"",p=null!==(l=null!==(r=u.width)&&void 0!==r?r:u.size)&&void 0!==l?l:20,g=null!==(c=null!==(a=u.height)&&void 0!==a?a:u.size)&&void 0!==c?c:20,m=t.createWidget(e,`<span class='icon' ${u.title?`title='${u.title}'`:""} tabIndex='${t.tabIndex}'></span>`,u);t.tabIndex++;const f=m.querySelector("span.wcontent"),v=m.querySelector("span.icon");let y=null!==(d=u.x)&&void 0!==d?d:0;u.index&&(y=u.index*-p);const b=n?g:0;return m.style.margin="0 2px",m.style.padding="0",f.style.margin="0",f.style.padding="0",v.style.display="inline-block",v.style.cursor="pointer",v.style.width=`${p}px`,v.style.height=`${g}px`,h&&(v.style.backgroundImage=`url('${h}')`),v.style.backgroundSize="contain",v.style.backgroundPosition=`${y}px ${b}px`,v.addEventListener("mousedown",o=>{o.preventDefault(),n=!n;const s=t.onWidgetChange(m,e,n,u);i.LiteGUI.trigger(m,"wclick",n),void 0!==s&&(n=s);const r=n?g:0;v.style.backgroundPosition=`${y}px ${r}px`,!1===u.toggle&&setTimeout(()=>{v.style.backgroundPosition=`${y}px 0px`,n=!1},200)}),t.appendWidget(m,o),m.setValue=(i,o)=>{if(void 0===i||"boolean"!=typeof i)return;const s=(n=i)?g:0;v.style.backgroundPosition=`${y}px ${s}px`,o||t.onWidgetChange(m,e,n,u)},m.getValue=function(){return n},t.processElement(m,u),m}o.Inspector.prototype.addIcon=function(t,e,n){return s(this,t,e,n)},o.Inspector.widgetConstructors.icon="addIcon"},8334(t,e,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,o)}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),o(n(7387),e),o(n(6653),e),o(n(236),e),o(n(3189),e),o(n(7461),e),o(n(8788),e),o(n(7246),e),o(n(9266),e),o(n(5885),e),o(n(9024),e),o(n(5844),e),o(n(1261),e),o(n(4703),e),o(n(6177),e),o(n(2985),e),o(n(9373),e),o(n(2478),e),o(n(1095),e),o(n(8306),e),o(n(5549),e),o(n(4464),e),o(n(3280),e),o(n(3859),e)},9024(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddInfo=s;const i=n(1969),o=n(7387);function s(t,e,n,o){var s,r,l;n=null!=n?n:"",o=null!=o?o:{};const a=t.getValueName(e,o);let c;t.values.set(a,n),void 0!==e?c=t.createWidget(e,n,o):(c=document.createElement("div"),o.className&&(c.className=o.className),c.innerHTML=`<span class='winfo'>${n}</span>`);const d=null!==(s=c.querySelector(".winfo"))&&void 0!==s?s:c.querySelector(".wcontent");o.callback&&c.addEventListener("click",o.callback.bind(c)),c.setValue=function(e){if(void 0===e||"string"!=typeof e&&"number"!=typeof e&&"boolean"!=typeof e)return;const n=e.toString();d&&(d.innerHTML=n),t.values.set(a,e)};let u=c.querySelector("span.info_content");return u||(u=c.querySelector(".winfo")),c.content=u,o.width&&(c.style.width=null!==(r=i.LiteGUI.sizeToCSS(o.width))&&void 0!==r?r:"0",c.style.display="inline-block",e||(d.style.margin="2px")),o.height&&(u.style.height=null!==(l=i.LiteGUI.sizeToCSS(o.height))&&void 0!==l?l:"0",u.style.overflow="auto"),c.scrollToBottom=function(){u.scrollTop=u.offsetTop},c.add=function(t){u.appendChild(t)},c.getValue=function(){return t.values.get(a)},t.appendWidget(c,o),t.processElement(c,o),c}o.Inspector.prototype.addInfo=function(t,e,n){return s(this,t,e,n)},o.Inspector.widgetConstructors.info="addInfo"},7387(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Inspector=void 0;const i=n(3252);class o{constructor(t){var e,n;this.sections=[],this.values=new Map,this.widgets=[],this.widgetsByName=new Map,this.rowNumber=0,this.oneLine=null,this._currentContainerStack=[],this.name="",this.emptyWidgetIndex=0,this.options=null!=t?t:{};const o=document.createElement("DIV");this.root=o,this.root.className=`inspector ${this.options.full?"full":""}${null!==(e=this.options.className)&&void 0!==e?e:""}`,this.root.id=null!==(n=this.options.id)&&void 0!==n?n:"",this.options.oneLine&&(this.oneLine=!0,this.root.className+=" one_line"),this.addEmptyContainer({}),this.tabIndex=Math.floor(1e4*Math.random()),this.options.width&&(this.root.style.width=(0,i.SizeToCSS)(this.options.width).toString()),this.options.height&&(this.root.style.height=(0,i.SizeToCSS)(this.options.height).toString(),this.options.oneLine||(this.root.style.overflow="auto")),this.options.nameWidth&&(this.nameWidth=this.options.nameWidth),this.options.widgetsWidth&&(this.widgetsWidth=this.options.widgetsWidth),this.options.noscroll&&(this.root.style.overflow="hidden"),this.options.onChange&&(this.onChange=this.options.onChange),this.options.parent&&this.appendTo(this.options.parent),this.className=this.root.className,this.widgetsPerRow=this.options.widgetsPerRow||1}getValues(){const t=new Map;for(const e in this.widgetsByName){const n=this.widgetsByName.get(e);if(n&&n.getValue){const i=n.getValue();t.set(e,i)}}return t}setValues(t){for(const e in t){const n=this.widgetsByName.get(e);n&&n.setValue&&n.setValue(t[e])}}appendTo(t,e){t&&("string"!=typeof t||(t=document.querySelector(t)))&&(e?t.insertBefore(this.root,t.firstChild):t.appendChild(this.root))}clear(){for((0,i.PurgeElement)(this.root);this.root.hasChildNodes();)this.root.removeChild(this.root.lastChild);this.root.className=this.className,this.rowNumber=0,this.values.clear(),this.widgets=[],this.widgetsByName.clear(),this.sections=[],this.currentSection=void 0,this._currentContainer=void 0,this._currentContainerStack=[],this.addEmptyContainer()}refresh(){this.onRefresh&&this.onRefresh()}appendWidget(t,e){var n,i;const o=null!==(i=null!==(n=(e=null!=e?e:{}).widgetParent)&&void 0!==n?n:this._currentContainer)&&void 0!==i?i:this.root;e.replace&&e.replace.parentNode?e.replace.parentNode.replaceChild(t,e.replace):(t.section=this.currentSection,o.appendChild(t))}pushContainer(t){if(this._currentContainerStack){if(-1!=this._currentContainerStack.indexOf(t))return void console.warn("Container already in the stack");this._currentContainerStack.push(t)}else this._currentContainerStack=[t];this._currentContainer=t}isContainerInStack(t){return!!this._currentContainerStack&&-1!=this._currentContainerStack.indexOf(t)}popContainer(t){if(this.rowNumber=0,this._currentContainerStack&&this._currentContainerStack.length){if(t){let e=this._currentContainerStack.pop();for(;e&&e!=t;)e=this._currentContainerStack.pop()}else this._currentContainerStack.pop();this._currentContainer=this._currentContainerStack[this._currentContainerStack.length-1]}else this._currentContainer=void 0}setup(t){for(const e in t){const n=t[e];this.add(n.type,n.name,n.value,n.options)}}getWidget(t){return t.constructor===Number?this.widgets[t]:this.widgetsByName.get(t)}inspectInstance(t,e,n,o){if(!t)return;const s=t;if(!e){const n=t;e=n.getProperties?n.getProperties():(0,i.CollectProperties)(t)}const r=s.constructor;!n&&r&&"properties"in r&&(n=r.properties);let l={};if("getInspectorProperties"in t&&"function"==typeof t.getInspectorProperties)l=t.getInspectorProperties();else if(e)for(const o in e){if(n&&n[o]){l[o]=(0,i.CloneInsides)(n[o]);continue}const s=e[o];if(r&&"@"+o in r){const t=r["@"+o];if(t&&"widget"in t&&!t.widget)continue;l[o]=(0,i.CloneInsides)(t)}else if(t["@"+o])l[o]=t["@"+o];else{if(null==o)continue;switch(typeof s){case"number":l[o]={type:"number",step:.1};break;case"string":l[o]={type:"string"};break;case"boolean":l[o]={type:"boolean"};break;default:if(s&&Array.isArray(s)){const t=s[0]&&"number"==typeof s[0];switch(s.length){case 2:l[o]={type:t?"vec2":"array",step:.1};break;case 3:l[o]={type:t?"vec3":"array",step:.1};break;case 4:l[o]={type:t?"vec4":"array",step:.1};break;default:l[o]={type:"array"}}}}}}if(o)for(const t in o)l[o[t]]=void 0;if(r&&"properties_order"in r){const t=r.properties_order,e={};for(const n in t){const i=t[n];l[i]?e[i]=l[i]:console.warn("property not found in instance:",i)}for(const t in l)e[t]||(e[t]=l[t]);l=e}return this.showProperties(t,l)}showProperties(t,e,n){for(const o in e){let s=o;if(n&&n.includes(s))continue;if(!e[o])continue;const r=e[o];if(r.name&&(r.varname=o,s=r.name,n&&n.includes(s)))continue;if(!r.callback){const e={instance:t,name:s,options:r};"function"!=r.type&&(r.callback=i.AssignValue.bind(e))}if(!r.onUpdate){const e={instance:t,name:s};r.onUpdate=function(){return e.instance[e.name]}}r.instance=t;const l=r.widget||r.type||"string";this.onAddProperty&&this.onAddProperty(l,t,s,t[s],r),this.add(l,s,t[s],r)}if("widgets"in t.constructor){const e=t.constructor.widgets;for(const t in e){const n=e[t];this.add(n.widget,n.name,n.value,n)}}"onShowProperties"in t&&"function"==typeof t.onShowProperties&&t.onShowProperties(this),"onShowProperties"in t.constructor&&"function"==typeof t.constructor.onShowProperties&&t.constructor.onShowProperties(t,this)}createWidget(t,e,n){var o,s,r,l,a,c,d,u;n=null!=n?n:{},e=null!=e?e:"";const h=document.createElement("DIV");h.className="widget "+(null!==(o=n.className)&&void 0!==o?o:""),h.inspector=this,h.options=n,h.name="string"!=typeof t||t.includes("_EMPTY_")?void 0:t,this.rowNumber+=this.widgetsPerRow,this.rowNumber%2==0&&(h.className+=" even");const p=null!==(s=n.width)&&void 0!==s?s:this.widgetsWidth;if(p){const t=(0,i.SizeToCSS)(p);h.style.width=t?t.toString():`calc(${(0,i.SizeToCSS)(p)})`,h.style.minWidth="auto"}const g=null!==(r=n.height)&&void 0!==r?r:this.height;if(g){const t=(0,i.SizeToCSS)(g);h.style.height=t?t.toString():`calc(${(0,i.SizeToCSS)(g)})`,h.style.minHeight="auto"}this.widgets.push(h),(n.widgetName||t)&&this.widgetsByName.set(null!==(a=null!==(l=n.widgetName)&&void 0!==l?l:t)&&void 0!==a?a:"",h),1!=this.widgetsPerRow&&(n.width||(h.style.width=(100/this.widgetsPerRow).toFixed(2)+"%"),h.style.display="inline-block");let m="",f="";if(null!=t&&(this.nameWidth||n.nameWidth)&&!this.oneLine){const t=(0,i.SizeToCSS)(null!==(d=null!==(c=n.nameWidth)&&void 0!==c?c:this.nameWidth)&&void 0!==d?d:void 0);m=`style='width: calc(${t} - 0px); width: -webkit-calc(${t} - 0px); width: -moz-calc(${t} - 0px); '`,f=`style='width: calc( 100% - ${t}); width: -webkit-calc(100% - ${t}); width: -moz-calc( 100% - ${t}); '`}n.nameWidth&&(m=`style='width: ${(0,i.SizeToCSS)(n.nameWidth)} '`),n.contentWidth&&(f=`style='width: ${(0,i.SizeToCSS)(n.contentWidth)} '`);let v="",y="wcontent ";if(null==t)y+=" full";else{let e="";n.preTitle&&(e=n.preTitle);let i=t;n.title&&(i=n.title);const o=this.oneLine?"":"<span class='filling'></span>";v+=""===t?`<span class='wname' title='${i}' ${m}>${e}</span>`:`<span class='wname' title='${i}' ${m}>${e}${t}${o}</span>`}switch(typeof e){case"string":case"number":case"boolean":h.innerHTML=`${v}<span class='info_content ${y}' ${f}>${e}</span>`;break;default:{h.innerHTML=`${v}<span class='info_content ${y}' ${f}></span>`;const t=h.querySelector("span.info_content");t&&t.appendChild(e);break}}return h.content=null!==(u=h.querySelector("span.info_content"))&&void 0!==u?u:void 0,h.remove=function(){this.parentNode&&this.parentNode.removeChild(this)},h}onWidgetChange(t,e,n,o,s,r){const l=t.section;let a;if(o.skipWChange||(l&&(0,i.Trigger)(l,"wbeforechange",n),(0,i.Trigger)(t,"wbeforechange",n)),this.values.set(e,n),o.callback)if(s&&Array.isArray(n)){a=o.callback.apply(t,n)}else{a=o.callback.call(t,n,r)}return o.skipWChange||(l&&(0,i.Trigger)(l,"wchange",n),(0,i.Trigger)(t,"wchange",n)),this.onChange&&this.onChange(e,n,t),a}getValueName(t,e){return e=null!=e?e:{},void 0===t&&void 0===e.widgetName&&(t="_EMPTY_NAME_WIDGET_"+this.emptyWidgetIndex++),null!=t?t:e.widgetName}static registerWidget(t,e){o.widgetConstructors[t.toLowerCase()]=e}static unregisterWidget(t){o.widgetConstructors[t.toLowerCase()]&&delete o.widgetConstructors[t.toLowerCase()]}add(t,e,n,i){var s;(i=null!=i?i:{}).type&&(t=i.type),i.name&&(e=i.name),i.value&&(n=i.value);let r=o.widgetConstructors[null!==(s=null==t?void 0:t.toLowerCase())&&void 0!==s?s:"null"];if(r){if("string"==typeof r){const t=o.prototype[r];if(!t)return void console.warn("LiteGUI.Inspector: Widget method not found:",r);r=t}if("function"==typeof r)return"function"==typeof r?r.call(this,e,n,i):void 0;console.warn("LiteGUI.Inspector: Widget method not found or not a function:",t,r)}else console.warn("LiteGUI.Inspector: Widget not found: "+t)}getValue(t){return this.values.get(t)}applyOptions(t,e){var n,o;t&&e&&(e.className&&(t.className+=" "+e.className),e.id&&(t.id=e.id),e.width&&(t.style.width=null!==(n=(0,i.SizeToCSS)(e.width))&&void 0!==n?n:"0px"),e.height&&(t.style.height=null!==(o=(0,i.SizeToCSS)(e.height))&&void 0!==o?o:"0px"))}_doNothing(){}addEmptyContainer(t){t=null!=t?t:{};const e=this.startContainer(t);return this.endContainer(),e}startContainer(t){var e;const n=document.createElement("DIV");return n.className="wcontainer",this.applyOptions(n,t),this.rowNumber=0,this.appendWidget(n),this.pushContainer(n),t.widgetPerRow&&(this.widgetsPerRow=t.widgetPerRow),t.height&&(n.style.height=null!==(e=(0,i.SizeToCSS)(t.height))&&void 0!==e?e:"0px",n.style.overflow="auto"),n.refresh=function(){n.onRefresh&&n.onRefresh.call(this,n)},n}endContainer(){this.popContainer()}addSection(t,e){var n,i,o;null==e&&(e={}),this.currentSection&&this.currentSection.end();const s=document.createElement("DIV");s.className="wsection",t||(s.className+=" notitle"),e.className&&(s.className+=" "+e.className),e.collapsed&&!e.noCollapse&&(s.className+=" collapsed"),e.id&&(s.id=null!==(n=e.id)&&void 0!==n?n:""),e.instance&&(s.instance=null!==(i=e.instance)&&void 0!==i?i:{});let r="";if(t&&(r+=`<div class='wsectiontitle'>${e.noCollapse?"":"<span class='switch-section-button'></span>"}${t}</div>`),r+="<div class='wsectioncontent'></div>",s.innerHTML=r,s.lastContainerStack=this._currentContainerStack.concat(),this.root.appendChild(s),this.sections.push(s),s.sectionTitle=s.querySelector(".wsectiontitle"),t&&!e.noCollapse&&(null===(o=s.sectionTitle)||void 0===o||o.addEventListener("click",t=>{if("button"==t.target.localName)return;s.classList.toggle("collapsed");const n=s.querySelector(".wsectioncontent");n.style.display="none"===n.style.display?"":"none",e.callback&&e.callback.call(s,s.classList.contains("collapsed"))})),e.collapsed&&!e.noCollapse){s.querySelector(".wsectioncontent").style.display="none"}return this.setCurrentSection(s),e.widgetsPerRow&&(this.widgetsPerRow=e.widgetsPerRow),s.refresh=function(){s.onRefresh&&s.onRefresh.call(this,s)},s.end=()=>{if(this.currentSection!=s)return;this._currentContainerStack=s.lastContainerStack,this._currentContainer=void 0;const t=s.querySelector(".wsectioncontent");t&&(this.isContainerInStack(t)&&this.popContainer(t),this.currentSection=void 0)},s}setCurrentSection(t){if(this.currentSection==t)return;this.currentSection=t;const e=t.parentNode;if(!e)return;this.popContainer(e);const n=t.querySelector(".wsectioncontent");n&&this.pushContainer(n)}getCurrentSection(){for(let t=this._currentContainerStack.length-1;t>=0;--t){const e=this._currentContainerStack[t];if(e.classList.contains("wsectioncontent"))return e.parentNode}return null}endCurrentSection(){this.currentSection&&this.currentSection.end()}beginGroup(t,e){var n;const o=document.createElement("DIV");o.className="wgroup",t=null!=t?t:"",e=null!=e?e:{},o.innerHTML=`<div class='wgroupheader ${e.title?"wtitle":""}'><span class='switch-section-button'></span>${t}</div>`,o.group=!0;const s=document.createElement("DIV");s.className="wgroupcontent",e.collapsed&&(s.style.display="none"),e.height&&(s.style.height=(0,i.SizeToCSS)(e.height)),e.scrollable&&(s.style.overflow="auto"),o.appendChild(s);let r=null!==(n=e.collapsed)&&void 0!==n&&n;const l=o.querySelector(".wgroupheader");if(!l)throw new Error("Header not found");return r&&l.classList.add("collapsed"),l.addEventListener("click",t=>{const e=o.querySelector(".wgroupcontent").style;e.display="none"===e.display?"":"none",r=!r,r?l.classList.add("collapsed"):l.classList.remove("collapsed"),t.preventDefault()}),this.appendWidget(o,e),this.pushContainer(s),o}endGroup(){do{this.popContainer()}while(this._currentContainer&&!this._currentContainer.classList.contains("wgroupcontent"))}addTitle(t,e){e=this.processOptions(e);const n=document.createElement("DIV");let i=`<span class='wtitle'><span class='text'>${t}</span>`;return e.help&&(i+=`<span class='help'><div class='help-content'>${e.help}</div></span>`),i+="</span>",n.innerHTML=i,n.setValue=function(t){if("string"!=typeof t)return;const e=this.querySelector(".text");e&&(e.innerHTML=t)},this.rowNumber=0,this.appendWidget(n,e),n}scrollTo(t){var e;const n=this.root.querySelector(`#${t}`);if(!n)return;const i=this.root.offsetTop,o=n.offsetTop-i;(null===(e=this.root.parentNode)||void 0===e?void 0:e.parentNode)&&(this.root.parentNode.parentNode.scrollTop=o)}processOptions(t){return"function"==typeof t?{callback:t}:null!=t?t:{}}processElement(t,e){e.onUpdate&&t.setValue&&(t.onWidgetUpdate=function(){var n;t.setValue(null===(n=e.onUpdate)||void 0===n?void 0:n.call(t),!0)})}updateWidgets(){for(let t=0;t<this.widgets.length;++t){const e=this.widgets[t];e.onWidgetUpdate&&e.onWidgetUpdate(e)}}static parseColor(t){return"<span style='color: #FAAAA'>"+t[0].toFixed(2)+"</span>,<span style='color: #AFAAA'>"+t[1].toFixed(2)+"</span>,<span style='color: #AAFAA'>"+t[2].toFixed(2)+"</span>,<span style='color: #AAAAF'>"+t[3].toFixed(2)+"</span>"}}e.Inspector=o,o.widgetConstructors={null:"doNothing",undefined:"doNothing",title:"addTitle"}},8306(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddLineEditor=r;const i=n(1969),o=n(7387),s=n(7138);function r(t,e,n,o){t.values.set(e,n);const r=t.createWidget(e,"<span class='line-editor'></span>",o);r.style.width="100%";const l=new s.LineEditor(n,o),a=r.querySelector("span.line-editor");return null==a||a.appendChild(l.root),i.LiteGUI.bind(l,"change",n=>{const s=n.target;i.LiteGUI.trigger(r,"wbeforechange",s.valuesArray),o.callback&&o.callback.call(r,s.valuesArray,n),i.LiteGUI.trigger(r,"wchange",s.valuesArray),t.onWidgetChange(r,e,s.valuesArray,o)}),t.appendWidget(r,o),r}o.Inspector.prototype.addLineEditor=function(t,e,n){return r(this,t,e,null!=n?n:{})},o.Inspector.widgetConstructors.line="addLineEditor"},5844(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddList=s;const i=n(1969),o=n(7387);function s(t,e,n,o){n=null!=n?n:[],o=null!=o?o:{};const s=t.getValueName(e,o);let r="";o.height&&(r="style='height: 100%; overflow: auto;'");const l=`<ul class='lite-list' ${r} tabIndex='${t.tabIndex}'><ul>`;t.tabIndex++;const a=t.createWidget(e,`<span class='inputfield full ${o.disabled?"disabled":""}' style='height: 100%;'>${l}</span>`,o);a.querySelector(".info_content").style.height="100%",a.querySelector(".lite-list");const c=a.querySelector(".inputfield");c.style.height="100%",c.style.paddingBottom="0.2em";const d=a.querySelectorAll("ul"),u=function(e){const s=a.querySelector("li.selected");if(s){if("Enter"==e.code){if(!s)return;let e=s.dataset.pos;if(null==e)return;e="string"==typeof e?parseFloat(e):0;const i=n[e];o.onDoubleClick&&o.onDoubleClick.call(t,i)}else if("ArrowDown"==e.code){const t=s.nextSibling;t&&i.LiteGUI.trigger(t,"click"),s.scrollIntoView({block:"end",behavior:"smooth"})}else{if("ArrowUp"!=e.code)return;{const t=s.previousSibling;t&&i.LiteGUI.trigger(t,"click"),s.scrollIntoView({block:"end",behavior:"smooth"})}}return e.preventDefault(),e.stopPropagation(),!0}},h=e=>{const r=e.target;if(o.multiSelection)r.classList.toggle("selected");else{const t=a.querySelectorAll("li");for(let e=0;e<t.length;++e)t[e].classList.remove("selected");r.classList.add("selected")}let l=r.dataset.pos;if(null==l)return;l="string"==typeof l?parseFloat(l):0;const c=n[l];t.onWidgetChange(a,s,c,o),i.LiteGUI.trigger(a,"wadded",c)},p=function(e){let i=e.target.dataset.pos;if(null==i)return;i="string"==typeof i?parseFloat(i):0;const s=n[i];o.onDoubleClick&&o.onDoubleClick.call(t,s)},g=function(){document.addEventListener("keydown",u,!0)},m=function(){document.removeEventListener("keydown",u,!0)};for(let t=0;t<d.length;++t){const e=d[t];e.addEventListener("focus",g),e.addEventListener("blur",m)}function f(t,e,n){var s,r,l;const a=n;let c="",d=null,u="";"string"==typeof t||"number"==typeof t?c=t.toString():(c=null!==(l=null!==(r=null!==(s=t.content)&&void 0!==s?s:t.title)&&void 0!==r?r:t.name)&&void 0!==l?l:n,d=t.style,t.icon&&(u=`<img src='${t.icon}' class='icon' /> `),t.selected&&(e=!0));let g=c;g=g.replace(/<(?:.|\n)*?>/gm,"");const m=document.createElement("li");return m.classList.add(`item-${i.LiteGUI.safeName(null!=a?a:"")}`),e&&m.classList.add("selected"),m.dataset.name=g,m.dataset.pos=a,m.value=t,d&&m.setAttribute("style",d),m.innerHTML=u+c,m.addEventListener("click",h),o.onDoubleClick&&m.addEventListener("dblclick",p),m}a.updateItems=function(t,e){var s;!(e=null!=e?e:o.selected)&&t.length>0&&(e=null!==(s=t[0])&&void 0!==s?s:""),n=t;const r=this.querySelector("ul");if(r.innerHTML="",n)for(const t in n){const i=f(n[t],e==n[t],t);r.appendChild(i)}const l=r.querySelectorAll("li");i.LiteGUI.bind(l,"click",{handleEvent:h})},a.addItem=function(t,e){n.push(t);const i=this.querySelector("ul"),o=f(t,e);i.appendChild(o)},a.removeItem=function(t){const e=a.querySelectorAll(".wcontent li");for(let n=0;n<e.length;n++)e[n].dataset.name==t&&i.LiteGUI.remove(e[n])},a.updateItems(n,o.selected),t.appendWidget(a,o),a.getSelected=function(){const t=[],e=this.querySelectorAll("ul li.selected");for(let n=0;n<e.length;++n)t.push(e[n].dataset.name);return t},a.getByIndex=function(t){return this.querySelectorAll("ul li")[t]},a.selectIndex=function(t,e){const n=this.querySelectorAll("ul li");for(let i=0;i<n.length;++i){const o=n[i];i==t?o.classList.add("selected"):e||o.classList.remove("selected")}return n[t]},a.deselectIndex=function(t){const e=this.querySelectorAll("ul li")[t];return e&&e.classList.remove("selected"),e},a.scrollToIndex=function(t){const e=this.querySelectorAll("ul li")[t];e&&(this.scrollTop=e.offsetTop)},a.selectAll=function(){const t=this.querySelectorAll("ul li");for(let e=0;e<t.length;++e){const n=t[e];n.classList.contains("selected")||i.LiteGUI.trigger(n,"click")}},a.deselectAll=function(){const t=this.querySelectorAll("ul li");for(let e=0;e<t.length;++e){const n=t[e];n.classList.contains("selected")&&i.LiteGUI.trigger(n,"click")}},a.setValue=function(t){void 0!==t&&Array.isArray(t)&&this.updateItems(t)},a.getNumberOfItems=function(){return this.querySelectorAll("ul li").length},a.filter=function(t,e){const n=this.querySelectorAll("ul li");let i,o=!1;if("string"==typeof t){const n=t;e&&n.toLowerCase(),o=!0,i=function(t){return-1!=(e?t:t.toLowerCase()).indexOf(n)}}for(let e=0;e<n.length;++e){const s=n[e];if(null==t){s.style.display="";continue}let r=s.value;o&&"string"!=typeof r&&i?(r=s.innerHTML,i(r,s,s.classList.contains("selected"))?s.style.display="":s.style.display="none"):"string"!=typeof t&&(t(r,s,s.classList.contains("selected"))?s.style.display="":s.style.display="none")}},a.selectByFilter=function(t){const e=this.querySelectorAll("ul li");for(let n=0;n<e.length;++n){const i=e[n],o=t(i.value,i,i.classList.contains("selected"));!0===o?i.classList.add("selected"):!1===o&&i.classList.remove("selected")}};const v=a.getSelected();return v.length>0&&(o.multiSelection?t.values.set(s,v):t.values.set(s,v[0])),o.height&&(a.scrollTop=0),t.processElement(a,o),a}o.Inspector.prototype.addList=function(t,e,n){return s(this,t,e,n)},o.Inspector.widgetConstructors.list="addList"},1261(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddNumber=r;const i=n(7387),o=n(708),s=n(3252);function r(t,e,n,i){var r,l;n=null!=n?n:0,i=null!=i?i:{};const a=t.getValueName(e,i);t.values.set(a,n);const c=t.createWidget(e,"",i);t.appendWidget(c,i),i.extraClass="full",i.tabIndex=t.tabIndex,i.fullNumWidth=!0,i.precision=null!==(r=i.precision)&&void 0!==r?r:2,i.step=null!==(l=i.step)&&void 0!==l?l:0==i.precision?1:.1,t.tabIndex++;const d=new o.Dragger(n,i);d.root.style.width="calc( 100% - 1px )",c.querySelector(".wcontent").appendChild(d.root);d.root.addEventListener("start_dragging",function(t){t.preCallback&&t.preCallback.call(c)}.bind(void 0,i)),c.dragger=d,i.disabled&&d.input.setAttribute("disabled","disabled");const u=c.querySelector("input");return u.addEventListener("change",e=>{const n=e.target;if((0,s.Trigger)(c,"wbeforechange",n.value),t.values.set(a,n.value),null!=i&&"function"!=typeof i){if(i.onChange&&d.dragging){const t=i.onChange.call(c,parseFloat(n.value));"number"==typeof t&&(n.value=t.toString())}else if((i.onChange||i.callback)&&!d.dragging){let t;i.callback?t=i.callback.call(c,parseFloat(n.value)):i.onChange&&(t=i.onChange.call(c,parseFloat(n.value))),"number"==typeof t&&(n.value=t.toString())}(0,s.Trigger)(c,"wchange",n.value),t.onChange&&t.onChange(a,n.value,c)}}),d.root.addEventListener("stop_dragging",()=>{(0,s.Trigger)(u,"change")}),c.setValue=function(t,e){var n;if(null==i||"function"==typeof i)return;if(void 0===t||"number"!=typeof t&&"string"!=typeof t)return;let o="string"==typeof t?parseFloat(t):t;i.precision&&(o=parseFloat(o.toFixed(i.precision)));let r=o.toString();r+=null!==(n=i.units)&&void 0!==n?n:"",u.value!=r&&(u.value=r,e||(0,s.Trigger)(u,"change"))},c.setRange=function(t,e){d.setRange(t,e)},c.getValue=function(){return parseFloat(u.value)},c.focus=function(){(0,s.FocusElement)(u)},c.disable=function(){u.disabled=!0},c.enable=function(){u.disabled=!1},t.processElement(c,i),c}i.Inspector.prototype.addNumber=function(t,e,n){return r(this,t,e,n)},i.Inspector.widgetConstructors.number="addNumber"},4703(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddPad=s;const i=n(1969),o=n(7387);function s(t,e,n=[0,0],o={}){var s,r,l,a,c,d,u,h,p;"function"==typeof o&&(o={callback:o});const g=t.getValueName(e,o);t.values.set(g,n);const m=t.createWidget(e,"",o);o.step=null!==(s=o.step)&&void 0!==s?s:.1,o.tabIndex=t.tabIndex,o.full=!0,t.tabIndex++;const f=null!==(l=null!==(r=o.minX)&&void 0!==r?r:o.min)&&void 0!==l?l:0,v=null!==(c=null!==(a=o.minY)&&void 0!==a?a:o.min)&&void 0!==c?c:0,y=null!==(u=null!==(d=o.maxX)&&void 0!==d?d:o.max)&&void 0!==u?u:1,b=null!==(p=null!==(h=o.maxY)&&void 0!==h?h:o.max)&&void 0!==p?p:1,w=m.querySelector(".wcontent"),C=document.createElement("div");C.className="litepad",w.appendChild(C),C.style.width="100%",C.style.height="100px",o.background&&(C.style.backgroundImage=`url('${o.background}')`,C.style.backgroundSize="100%",C.style.backgroundRepeat="no-repeat");const L=document.createElement("div");function S(e){var n;const s=C.getBoundingClientRect(),r=e.pageX-s.left,l=e.pageY-s.top;e.preventDefault(),e.stopPropagation();let a=r/s.width,c=l/s.height;a=a*(y-f)+f,c=c*(b-v)+f;const d=[a,c];if(i.LiteGUI.trigger(m,"wbeforechange",[d]),m.setValue(d),o&&o.callback){const t=null===(n=o.callback)||void 0===n?void 0:n.call(m,d);t&&t.length>=2&&m.setValue(t)}i.LiteGUI.trigger(m,"wchange",[d]),t.onChange&&t.onChange(g,d,m)}function x(t){t.preventDefault(),t.stopPropagation(),document.body.removeEventListener("mousemove",S),document.body.removeEventListener("mouseup",x)}return L.className="litepad-handler",C.appendChild(L),o.tabIndex=t.tabIndex,t.tabIndex++,C.addEventListener("mousedown",function(t){t.preventDefault(),t.stopPropagation(),document.body.addEventListener("mousemove",S),document.body.addEventListener("mouseup",x)}),m.setValue=function(t){if(void 0===t||!Array.isArray(t)||t.length<2)return;if("number"!=typeof t[0]||"number"!=typeof t[1])return;const e=C.getBoundingClientRect();let n=(t[0]-f)/(y-f),i=(t[1]-v)/(b-v);n=Math.max(0,Math.min(n,1)),i=Math.max(0,Math.min(i,1));const o=(e.width-10)/e.width*100,s=(e.height-10)/e.height*100;L.style.left=`${(n*o).toFixed(1)}%`,L.style.top=`${(i*s).toFixed(1)}%`},t.appendWidget(m,o),m.setValue(n),t.processElement(m,o),m}o.Inspector.prototype.addPad=function(t,e,n){return s(this,t,e,n)},o.Inspector.widgetConstructors.pad="addPad"},5549(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddSeparator=o;const i=n(7387);function o(t){const e=document.createElement("DIV");return e.className="separator",t.appendWidget(e),e}i.Inspector.prototype.addSeparator=function(){return o(this)},i.Inspector.widgetConstructors.separator="addSeparator"},6177(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddSlider=s;const i=n(7138),o=n(7387);function s(t,e,n,o){var s,r;n=null!=n?n:0,(o=null!=o?o:{}).min=null!==(s=o.min)&&void 0!==s?s:0,o.max=null!==(r=o.max)&&void 0!==r?r:1,o.step=o.step||.01;const l=t.getValueName(e,o);t.values.set(l,n);const a=t.createWidget(e,"<span class='inputfield full'>\n<input tabIndex='"+t.tabIndex+"' type='text' class='slider-text fixed liteslider-value' value='' /><span class='slider-container'></span></span>",o),c=a.querySelector(".slider-container"),d=new i.Slider(n,o);a.slider=d,c.appendChild(d.root);const u=a.querySelector(".slider-text");return u.value=n.toString(),u.addEventListener("change",()=>{const e=parseFloat(u.value);n=e,d.setValue(e),t.onWidgetChange(a,l,e,o)}),d.onChange=e=>{u.value=e.toString(),t.onWidgetChange(a,l,e,o)},t.appendWidget(a,o),a.setValue=function(t,e){void 0!==t&&"number"==typeof t&&(n=t,d.setValue(t,e))},a.getValue=function(){return n},t.processElement(a,o),a}o.Inspector.prototype.addSlider=function(t,e,n){return s(this,t,e,n)},o.Inspector.widgetConstructors.slider="addSlider"},6653(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddString=s;const i=n(3252),o=n(7387);function s(t,e,n,o){n=null!=n?n:"",o=null!=o?o:{};const s=t.getValueName(e,o);t.values.set(s,n);const r=o.password?"password":"text",l=o.focus?"autofocus":"",a=o.disabled?"disabled":"",c=t.createWidget(e,"<span class='inputfield full "+a+"'><input type='"+r+"' tabIndex='"+t.tabIndex+"' "+l+" class='text string' value='"+n+"' "+a+"/></span>",o),d=c.querySelector(".wcontent input");return o.placeHolder&&d.setAttribute("placeHolder",o.placeHolder),"right"==o.align&&(d.style.direction="rtl"),d.addEventListener(o.immediate?"keyup":"change",e=>{const n=e.target.value,i=t.onWidgetChange(c,s,n,o);void 0!==i&&(d.value=i)}),o.onEnter&&d.addEventListener("keydown",n=>{if("Enter"===n.key){const i=n.target.value;t.onWidgetChange(c,e,i,o),o.onEnter&&o.onEnter(),n.preventDefault()}}),t.tabIndex+=1,c.setIcon=function(t){t?(d.style.background=`transparent url('${t}') no-repeat left 4px center`,d.style.paddingLeft="1.7em"):(d.style.background="",d.style.paddingLeft="")},o.icon&&c.setIcon(o.icon),c.setValue=function(t,e){void 0!==t&&t!==d.value&&"string"==typeof t&&(d.value=t,e||(0,i.Trigger)(d,"change"))},c.getValue=function(){return d.value},c.focus=function(){var t;null===(t=this.querySelector("input"))||void 0===t||t.focus()},c.disable=function(){d.disabled=!0},c.enable=function(){d.disabled=!1},t.appendWidget(c,o),t.processElement(c,o),c}o.Inspector.prototype.addString=function(t,e,n){return s(this,t,e,n)},o.Inspector.widgetConstructors.string="addString",o.Inspector.widgetConstructors.text="addString"},2985(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddStringButton=s;const i=n(3252),o=n(7387);function s(t,e,n,o){var s,r,l;n=null!=n?n:"",o=null!=o?o:{};const a=t.getValueName(e,o);t.values.set(a,n);const c=t.createWidget(e,`<span class='inputfield button'><input type='text' tabIndex='${t.tabIndex}' class='text string' value='' ${o.disabled?"disabled":""}/></span><button class='micro'>${null!==(s=o.button)&&void 0!==s?s:"..."}</button>`,o),d=c.querySelector(".wcontent input");d.value=n,d.addEventListener("change",e=>{const n=t.onWidgetChange(c,a,e.target.value,o);void 0!==n&&(d.value=n)}),o.disabled&&d.setAttribute("disabled","disabled");const u=c.querySelector(".wcontent button");if(c.setIcon=function(t){var e;t?(u.innerHTML="",u.style.backgroundColor="transparent",u.style.backgroundImage=`url('${t}')`,u.style.backgroundRepeat="no-repeat",u.style.backgroundPosition="center",u.style.backgroundSize="contain",u.style.paddingLeft="",u.style.width="2em",u.style.minWidth="2em",u.style.height="100%",u.style.minHeight="1.5em",u.style.padding="0",u.style.flexShrink="0"):(u.style.backgroundColor="",u.style.backgroundImage="",u.style.backgroundRepeat="",u.style.backgroundPosition="",u.style.backgroundSize="",u.style.paddingLeft="",u.innerHTML=null!==(e=o.button)&&void 0!==e?e:"...")},u.addEventListener("click",t=>{o.onClick&&o.onClick.call(c,d.value,t)}),o.buttonWidth=null!==(r=o.buttonWidth)&&void 0!==r?r:"auto",o.buttonWidth){const t=c.querySelector(".wcontent");if("auto"===o.buttonWidth||"fit-content"===o.buttonWidth){t.style.display="flex",t.style.alignItems="center";const e=c.querySelector(".inputfield");e.style.width="auto",e.style.flexGrow="1",u.style.width="auto",u.style.whiteSpace="nowrap",u.style.padding="0 10px",u.style.margin="0 0 0 4px"}else{u.style.width=null!==(l=(0,i.SizeToCSS)(o.buttonWidth))&&void 0!==l?l:"0px";c.querySelector(".inputfield").style.width=`calc( 100% - ${u.style.width} - 6px)`}}return t.tabIndex+=1,t.appendWidget(c,o),c.setValue=function(t,e){void 0!==t&&t!==d.value&&"string"==typeof t&&(d.value=t,e||(0,i.Trigger)(d,"change"))},c.disable=function(){d.disabled=!0,u.disabled=!0},c.enable=function(){d.disabled=!1,u.disabled=!1},c.getValue=function(){return d.value},c.focus=function(){(0,i.FocusElement)(d)},t.processElement(c,o),o.icon&&c.setIcon(o.icon),c}o.Inspector.prototype.addStringButton=function(t,e,n){return s(this,t,e,n)},o.Inspector.widgetConstructors.stringbutton="addStringButton"},9373(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddTags=s;const i=n(1969),o=n(7387);function s(t,e,n,o){n=null!=n?n:[],o=null!=o?o:{};const s=t.getValueName(e,o);t.values.set(s,{});const r=t.createWidget(e,"<div class='wtagswrapper'><input type='text' class='wtaginput inputfield' placeholder='Add tag...'/><div class='wtagscontainer'></div></div>",o);r.tags={};const l=r.querySelector(".wtagscontainer"),a=r.querySelector(".wtaginput");if(a.addEventListener("keydown",t=>{"Enter"===t.key&&(t.preventDefault(),t.stopPropagation(),a.value&&(c(a.value),a.value=""))}),n)for(const t in n)c(n[t]);function c(t){if(void 0!==r.tags[t])return;r.tags[t]=!0;const e=document.createElement("div");e.data=t,e.className="wtag",e.innerHTML=`${t}<span class='close'>X</span>`,e.addEventListener("click",n=>{n.target.classList.contains("close")||(r.tags[t]=!r.tags[t],r.tags[t]?e.classList.remove("disabled"):e.classList.add("disabled"),d())}),e.querySelector(".close").addEventListener("click",t=>{t.stopPropagation();const n=e.data;delete r.tags[n],i.LiteGUI.remove(e),i.LiteGUI.trigger(r,"wremoved",n),d()}),l.appendChild(e),d(),i.LiteGUI.trigger(r,"wadded",t)}function d(){t.values.set(s,r.tags),o.callback&&o.callback.call(r,r.tags),i.LiteGUI.trigger(r,"wchange",r.tags),t.onChange&&t.onChange(s,r.tags,r)}return t.appendWidget(r,o),t.processElement(r,o),r}o.Inspector.prototype.addTags=function(t,e,n){return s(this,t,e,n)},o.Inspector.widgetConstructors.tags="addTags"},2478(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddTextArea=s;const i=n(1969),o=n(7387);function s(t,e,n,o){n=null!=n?n:"";const s=null!=o?o:{},r=t.getValueName(e,s);t.values.set(r,n);const l=s.disabled?"disabled":"",a=t.createWidget(e,"<span class='inputfield textarea "+l+"'><textarea tabIndex='"+t.tabIndex+"' "+l+"></textarea></span>",s);t.tabIndex++;const c=a.querySelector(".wcontent textarea");return c.value=n,s.placeHolder&&c.setAttribute("placeHolder",s.placeHolder),c.addEventListener(s.immediate?"keyup":"change",e=>{var n;t.onWidgetChange(a,r,null===(n=e.target)||void 0===n?void 0:n.value,s,!1,e)}),s.onKeyDown&&c.addEventListener("keydown",s.onKeyDown),s.height&&(c.style.height="calc( "+i.LiteGUI.sizeToCSS(s.height)+" - 5px )"),t.appendWidget(a,s),a.setValue=function(t,e){void 0!==t&&"string"==typeof t&&t!=c.value&&(n=t,c.value=t,e||i.LiteGUI.trigger(c,"change"))},a.getValue=function(){return c.value},a.focus=function(){i.LiteGUI.focus(c)},a.disable=function(){c.disabled=!0},a.enable=function(){c.disabled=!1},t.processElement(a,s),a}o.Inspector.prototype.addTextArea=function(t,e,n){return s(this,t,e,n)},o.Inspector.widgetConstructors.textarea="addTextArea"},4464(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddTree=s;const i=n(1969),o=n(7387);function s(t,e,n,o={}){const s=t.createWidget(e,"<div class='wtree inputfield full'></div>",o),r=s.querySelector(".wtree");if(!r)return;o.height&&(r.style.height="number"==typeof o.height?o.height+"px":o.height,r.style.overflow="auto");const l=s.tree=new i.LiteGUI.Tree(n,o.treeOptions);return l.onItemSelected=function(t,e){o.callback&&o.callback.call(s,e,t)},r.appendChild(l.root),s.setValue=function(t){t&&"object"==typeof t&&!Array.isArray(t)&&l.updateTree(t)},t.appendWidget(s,o),t.processElement(s,o),s}o.Inspector.prototype.addTree=function(t,e,n){return s(this,t,e,n)},o.Inspector.widgetConstructors.tree="addTree"},1095(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AddVector=s;const i=n(1969),o=n(7387);function s(t,e,n,o={}){var s;const r=t.getValueName(e,o);t.values.set(r,n);const l=t.createWidget(e,"",o),a=n.length;o.step=null!==(s=o.step)&&void 0!==s?s:.1,o.tabIndex=t.tabIndex,o.fullVector=!0,o.step||(o.step=.1),t.tabIndex++;const c=l.draggers=[],d=function(t){o.preCallback&&o.preCallback(t)};for(let e=0;e<n.length;e++){const s=new i.LiteGUI.Dragger(n[e],o);s.root.style.marginLeft="0",s.root.style.width="calc( 25% - 1px )",l.querySelector(".wcontent").appendChild(s.root),o.tabIndex=t.tabIndex,t.tabIndex++,s.root.addEventListener("start_dragging",d),c.push(s)}const u=l.querySelectorAll("input"),h=e=>{let n=[];for(let t=0;t<u.length;t++)n.push(parseFloat(u[t].value));i.LiteGUI.trigger(l,"wbeforechange",[n]),t.values.set(r,n);const s=e.target.dragger;if(o.onChange&&s.dragging){const t=o.onChange.call(l,n);if(Array.isArray(t)&&t.length>=a){for(let e=0;e<u.length;e++)u[e].value=t[e].toString();n=t}}else if((o.onChange||o.callback)&&!s.dragging){let t;if(o.callback?t=o.callback.call(l,n):o.onChange&&(t=o.onChange.call(l,n)),Array.isArray(t)&&t.length>=a){for(let e=0;e<u.length;e++)u[e].value=t[e].toString();n=t}}i.LiteGUI.trigger(l,"wchange",[n]),t.onChange&&t.onChange(r,n,l)},p=function(t){i.LiteGUI.trigger(t,"change")};for(let t=0;t<u.length;++t){const e=c[t],n=u[t];n.dragger=e,n.addEventListener("change",h),e.root.addEventListener("stop_dragging",p.bind(void 0,n))}return t.appendWidget(l,o),l.setValue=function(t,e){if(void 0===t||!Array.isArray(t))return;const n=t;for(let t=0;t<c.length;t++)c[t].setValue(n[t],null!=e?e:t<c.length-1)},l.setRange=function(t,e){for(const n in c)c[n].setRange(t,e)},t.processElement(l,o),l}o.Inspector.prototype.addVector=function(t,e,n){return s(this,t,e,n)},o.Inspector.prototype.addVector2=function(t,e,n){return s(this,t,e=null!=e?e:[0,0],n=null!=n?n:{})},o.Inspector.prototype.addVector3=function(t,e,n){return s(this,t,e=null!=e?e:[0,0,0],n=null!=n?n:{})},o.Inspector.prototype.addVector4=function(t,e,n){return s(this,t,e=null!=e?e:[0,0,0,0],n=null!=n?n:{})},o.Inspector.widgetConstructors.vector="addVector",o.Inspector.widgetConstructors.vec2="addVector2",o.Inspector.widgetConstructors.vector2="addVector2",o.Inspector.widgetConstructors.vec3="addVector3",o.Inspector.widgetConstructors.vector3="addVector3",o.Inspector.widgetConstructors.vec4="addVector4",o.Inspector.widgetConstructors.vector4="addVector4"},736(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Menubar=void 0;const i=n(1969);e.Menubar=class{constructor(t,e){this.options=null!=e?e:{autoOpen:!1,sortEntries:!1},this.menu=[],this.panels=[],this.root=document.createElement("div"),this.root.id=t,this.root.className="litemenubar",this.content=document.createElement("ul"),this.root.appendChild(this.content),this.isOpen=!1,this.autoOpen=this.options.autoOpen,this.sortEntries=this.options.sortEntries,this.closingTime=500}clear(){this.content.innerHTML="",this.menu=[],this.panels=[]}attachToPanel(t){t.content.insertBefore(this.root,t.content.firstChild)}add(t,e={}){this.data="function"==typeof e?{callback:e}:e;const n=this.menu.length,i=t.split("/");let o,s=0,r=0,l=this.menu;for(;l;){if(s>5)throw"Error: Menubar too deep";if(l.length==r){const t={name:"",parent:o,children:[],data:void 0,disable:function(){this.data&&(this.data.disabled=!0)},enable:function(){this.data&&(this.data.disabled=void 0)}};if(o=t,s==i.length-1&&(t.data=this.data),t.name=i[s],l.push(t),s++,s==i.length)break;t.children=[],l=t.children,r=0;continue}if(l[r]&&i[s]==l[r].name){if(s<i.length-1){o=l[r],null!=l[r].children&&(l=l[r].children),r=0,s++;continue}console.warn(`Warning: Adding menu that already exists: ${t}`);break}r++}n!=this.menu.length&&this.updateMenu()}remove(t){const e=this.findMenu(t);if(e){if(Array.isArray(e))return console.warn("Can't remove an entire list");if(e.parent&&e.parent.children){const t=e.parent.children.indexOf(e);if(-1!=t&&(e.parent.children.splice(t,1),this.isOpen)){this.hidePanels();const t=new PointerEvent("click",{view:window,bubbles:!0,cancelable:!0,clientX:0,clientY:0});e.parent.element&&this.showMenu(e.parent,t,e.parent.element)}}else{const t=this.menu.indexOf(e);-1!=t&&(this.menu.splice(t,1),this.isOpen&&this.hidePanels())}}}separator(t,e){const n=this.findMenu(t);if(n)return Array.isArray(n)?console.warn("Can't separate an entire list"):void(n.children&&n.children.push({name:"",children:void 0,data:void 0,separator:!0,order:null!=e?e:10}))}findMenu(t){const e=t.split("/");let n=0,i=0,o=this.menu;for(;n<=5;){if(n==e.length)return o;if(o.length<=i)return;if("*"==e[n])return o[i].children;if(e[n]!=o[i].name)i++;else{if(n==e.length-1)return o[i];o[i].children&&(o=o[i].children),i=0,n++}}}updateMenu(){this.content.innerHTML="";const t=(t,e)=>{const n=t,i=n.data;i&&i.data&&i.data.callback&&"function"==typeof i.data.callback&&i.data.callback(i.data),!this.isOpen&&i?(this.isOpen=!0,this.showMenu(i,e,n)):(this.isOpen=!1,this.hidePanels())},e=(t,e)=>{if(this.hidePanels(),this.isOpen||this.autoOpen){const n=t;n.data&&this.showMenu(n.data,e,n)}};for(const n in this.menu){const i=document.createElement("li");i.innerHTML="<span class='icon'></span><span class='name'>"+this.menu[n].name+"</span>",this.content.appendChild(i),i.data=this.menu[n],this.menu[n].element=i,i.addEventListener("click",t.bind(void 0,i)),i.addEventListener("mouseover",e.bind(void 0,i))}}hidePanels(){if(this.panels.length){this.isOpen=!1;for(const t in this.panels)i.LiteGUI.remove(this.panels[t]);this.panels=[]}}showMenu(t,e,n,i=!1){if(this.isOpen=!0,i||this.hidePanels(),!t.children||!t.children.length)return;this.closingByLeave&&clearInterval(this.closingByLeave);const o=document.createElement("div");o.className="litemenubar-panel";const s=[];for(const e in t.children)s.push(t.children[e]);this.sortEntries&&s.sort((t,e)=>{let n=10,i=10;const o=t,s=e;return o&&null!=o.order&&(n=o.order),o&&o.separator&&null!=o.order&&(n=o.order),s&&null!=s.order&&(i=s.order),s&&s.separator&&null!=s.order&&(i=s.order),n-i});const r=(e,o)=>{var s,r;const l=e,a=l.data;if(a&&a.data){if(a.data.disabled)return;if(a.data.instance&&a.data.property)if("checkbox"==a.data.type)a.data.instance[a.data.property]=!a.data.instance[a.data.property],a.data.instance[a.data.property]?l.classList.add("checked"):l.classList.remove("checked");else if("value"in a.data){const t=a.data.property;t&&(a.data.instance[t]=null!==(s=a.data.value)&&void 0!==s&&s)}null!=a.data.checkbox&&(a.data.checkbox=!a.data.checkbox,a.data.checkbox?l.classList.add("checked"):l.classList.remove("checked")),a.data&&"function"==typeof a.data.callback&&a.data.callback(a.data)}a&&a.children&&a.children.length?this.showMenu(a,o,l,!0):a&&!(null===(r=a.data)||void 0===r?void 0:r.keepOpen)?(this.isOpen=!1,this.hidePanels()):(this.isOpen=!1,this.hidePanels(),this.isOpen=!0,this.showMenu(t,o,n,i))};for(const t in s){const e=document.createElement("p"),n=s[t];e.className="litemenu-entry "+(e.children?" submenu":"");const i=n.children&&n.children.length;if(i&&e.classList.add("has_submenu"),n&&n.name?e.innerHTML="<span class='icon'></span><span class='name'>"+n.name+(i?"<span class='more'>+</span>":"")+"</span>":e.classList.add("separator"),e.data=n,e.data.data){const t=e.data.data;("checkbox"==t.type&&t.instance&&t.property&&1==t.instance[t.property]||1==t.checkbox||t.instance&&t.property&&"value"in t&&t.instance[t.property]==t.value||"function"==typeof t.isChecked&&t.isChecked(t.instance,t))&&(e.className+=" checked"),t.disabled&&(e.className+=" disabled")}e.addEventListener("click",r.bind(void 0,e)),e.addEventListener("mouseenter",()=>{(this.autoOpen||e.data&&e.data.data&&e.data.data.autoOpen)&&e.classList.contains("has_submenu")&&e.click()}),o.appendChild(e)}o.addEventListener("mouseleave",()=>{this.closingByLeave&&clearInterval(this.closingByLeave),this.closingByLeave=setTimeout(()=>{this.isOpen=!1,this.hidePanels()},this.closingTime)}),o.addEventListener("mouseenter",()=>{this.closingByLeave&&clearInterval(this.closingByLeave),this.closingByLeave=null});const l=n.getBoundingClientRect();i?(o.style.left=l.right-5+"px",o.style.top=l.top-4+"px"):(o.style.left=`${l.left}px`,o.style.top=`${l.bottom}px`),this.panels.push(o),document.body.appendChild(o)}}},4586(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Panel=void 0;const i=n(3252),o=n(1969);class s{constructor(t,e){var n,s,r;if("string"!=typeof t){const i=t;t=null!==(n=i.id)&&void 0!==n?n:"",e||null==i||(e=i)}const l=this.options=e=null!=e?e:{},a=this.root=document.createElement("div");a.id=t,a.className=`litepanel ${null!==(s=l.className)&&void 0!==s?s:""}`,a.panel=this;let c="";if(l.title||l.close){let t="";l.title&&(t+=`${l.title}`),l.close&&(t+=`<div class='buttons'><button class='litebutton mini-button close-button'>${o.SpecialCode.close}</button></div>`),c+=`<div class='panel-header'>${t}</div>`}if(c+=`<div class='content'>${null!==(r=l.content)&&void 0!==r?r:""}</div>`,c+="<div class='panel-footer'></div>",a.innerHTML=c,(l.title||l.close)&&(this._header=this.root.querySelector(".panel-header"),l.close)){const t=this._header.querySelector(".close-button");t&&t.addEventListener("click",this.close.bind(this))}this.content=this.root.querySelector(".content"),this._footer=this.root.querySelector(".panel-footer"),l.width&&(this.root.style.width=(0,i.SizeToCSS)(l.width)),l.height&&(this.root.style.height=(0,i.SizeToCSS)(l.height)),l.position&&(this.root.style.position="absolute",this.root.style.left=(0,i.SizeToCSS)(l.position[0]),this.root.style.top=(0,i.SizeToCSS)(l.position[1])),1==l.scrollable&&(this.content.style.overflow="auto"),l.hide&&this.hide()}add(t){this.content.appendChild("root"in t?t.root:t)}show(){this.root.style.display="",(0,i.Trigger)(this.root,"shown")}hide(){this.root.style.display="none",(0,i.Trigger)(this.root,"hidden")}close(){this.root.parentNode&&this.root.parentNode.removeChild(this.root),(0,i.Trigger)(this.root,"closed")}clear(){const t=this.content;for(;null!=t.firstChild;)t.removeChild(t.firstChild)}}e.Panel=s,s.TITLE_HEIGHT="20px"},5460(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Table=void 0;const i=n(3252);e.Table=class{constructor(t){t=null!=t?t:{},this.root=document.createElement("table"),this.root.classList.add("litetable"),this.columns=[],this.columnFields=[],this.rows=[],this.data=[],this._mustUpdateHeader=!0,t.scrollable&&(this.root.style.overflow="auto"),t.height&&(this.root.style.height=(0,i.SizeToCSS)(t.height)),t.columns&&this.setColumns(t.columns),t.rows&&t.data&&this.setRows(t.data)}setRows(t,e=!1){this.data=t,this.updateContent(e)}addRow(t,e){const n=document.createElement("tr");for(let e=0;e<this.columnFields.length;++e){const i=document.createElement("td");let o;o=Array.isArray(t)?t[e]:t[this.columnFields[e]],o=null!=o?o:"",i.innerHTML=o,this.value=this.columnFields[e];const s=this.columns[e];if(void 0===s)break;s.className&&(i.className=s.className),s.width&&(i.style.width=s.width),n.appendChild(i)}return this.root.appendChild(n),this.rows.push(n),e||this.data.push(t),n}updateRow(t,e){this.data[t]=e;const n=this.rows[t];if(!n)return;const i=n.querySelectorAll("td");for(let t=0;t<i.length;++t){const n=this.columns[t];let o;o=Array.isArray(e)?e[t]:e[n.field],o=null!=o?o:"",i[t].innerHTML=o}return n}updateCell(t,e,n){const i=this.rows[t];if(!i)return;const o=i.childNodes[e];return o?(o.innerHTML=n,o):void 0}setColumns(t){this.columns.length=0,this.columnFields.length=0;const e=Math.floor(100/t.length).toFixed(1)+"%",n=[];for(let o=0;o<t.length;++o){let s=t[o];if(null==s)continue;"string"!=typeof s&&"number"!=typeof s||(s={name:String(s)});const r=s,l={name:r.name||"",width:(0,i.SizeToCSS)(r.width||e),field:(r.field||r.name||"").toLowerCase(),className:r.className};o==t.length-1?l.width=`calc( 100% - ( ${n.join(" + ")}) )`:n.push(l.width),this.columns.push(l),this.columnFields.push(l.field)}this._mustUpdateHeader=!0,this.updateContent()}updateContent(t=!1){if(this.root.innerHTML="",this._mustUpdateHeader){this.header=document.createElement("tr");for(let t=0;t<this.columns.length;++t){const e=this.columns[t],n=document.createElement("th");n.innerHTML=e.name,e.width&&(n.style.width=e.width),e.tableElement=n,this.header.appendChild(n)}this._mustUpdateHeader=!1}if(this.root.appendChild(this.header),this.data)if(this.data.length!=this.rows.length&&(t=!1),t)for(let t=0;t<this.rows.length;++t){const e=this.data[t],n=this.updateRow(t,e);this.root.appendChild(n)}else{this.rows.length=0;for(let t=0;t<this.data.length;++t){const e=this.data[t];this.addRow(e,!0)}}}}},1994(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Tabs=e.TabInfo=void 0;const i=n(1969),o=n(3252);class s{constructor(t,e,n,i){this.id=t,this.tab=e,this.content=n,this.title=i}add(t){t&&this.content.appendChild("root"in t?t.root:t)}setTitle(t){this.title.innerHTML=t}click(){(0,o.Trigger)(this.tab,"click")}}e.TabInfo=s;class r{constructor(t){var e;this.tabs={},this.plusTabCallbacks=[];const n=null!=t?t:{};this.options=n;const i=this.mode=null!==(e=n.mode)&&void 0!==e?e:"horizontal",o=document.createElement("div");n.id&&(o.id=n.id),o.className="litetabs "+i,o.tabs=this,this.root=o,this.currentTab=-1,this.previousTab=-1,"horizontal"==i?n.size&&("full"==n.size?this.root.style.height="100%":this.root.style.height=n.size.toString()):"vertical"==i&&n.size&&("full"==n.size?this.root.style.width="100%":this.root.style.width=n.size.toString()),n.width&&(this.root.style.width=n.width.constructor===Number?n.width.toFixed(0)+"px":n.width.toString()),n.height&&(this.root.style.height=n.height.constructor===Number?n.height.toFixed(0)+"px":n.height.toString());const s=document.createElement("ul");s.className="wtabcontainer","vertical"==i?s.style.width=r.TABS_WIDTH+"px":s.style.height=r.TABS_HEIGHT+"px",s.addEventListener("wheel",this.onMouseWheel),this.list=s,this.root.appendChild(this.list),this.tabsRoot=s,this.tabsByIndex=[],n.addPlusTab&&this.createPlusTab(),n.parent&&this.appendTo(n.parent)}onMouseWheel(t){t.deltaY&&(this.list.scrollLeft+=t.deltaY)}show(){this.root.style.display="block"}hide(){this.root.style.display="none"}getCurrentTab(){if(this.currentTab>-1&&this.tabsByIndex[this.currentTab])return this.tabsByIndex[this.currentTab].tab}getCurrentTabId(){if(this.currentTab>-1&&this.tabsByIndex[this.currentTab])return this.tabsByIndex[this.currentTab].id}getPreviousTab(){if(this.previousTab>-1&&this.tabsByIndex[this.previousTab])return this.tabsByIndex[this.previousTab].tab}appendTo(t,e){if("string"==typeof t){const e=document.querySelector(t);if(!e)return void console.warn("Tabs.appendTo: element not found "+t);t=e}e?t.prepend(this.root):t.appendChild(this.root)}getTab(t){if(t in this.tabs)return this.tabs[t]}getTabByIndex(t){return this.tabsByIndex[t]}getNumOfTabs(){return this.tabsByIndex.length}getTabContent(t){const e=this.getTab(t);if(e)return e.content}getIndexOfTab(t){for(let e=0;e<this.tabsByIndex.length;e++){const n=this.tabsByIndex[e];if(n&&n.id==t)return e}return-1}getIndexOfNodeList(t){const e=this.getTab(t);if(!e)return-1;for(let t=0;t<this.list.childNodes.length;t++)if(this.list.childNodes[t]==e.tab)return t;return-1}addTab(t,e){var n,l,a;"function"==typeof e&&(e={callback:e});const c=null!=e?e:{};t=null!=t?t:"rand_"+(1e6*Math.random()|0);const d=document.createElement("li"),u=t.replace(/ /gi,"_");if(d.className=`wtab wtab-${u}`,d.dataset.id=t,d.innerHTML=`<span class='tabtitle'>${null!==(n=c.title)&&void 0!==n?n:t}</span>`,c.button&&(d.className+=" button "),c.tabClassName&&(d.className+=c.tabClassName),c.bigicon&&(d.innerHTML=`<img class='tabbigicon' src='${c.bigicon}'/>`+d.innerHTML),c.closable&&(d.innerHTML+=`<span class='tabclose'>${i.SpecialCode.close}</span>`,null===(l=d.querySelector("span.tabclose"))||void 0===l||l.addEventListener("click",e=>{this.removeTab(t),e.preventDefault(),e.stopPropagation()},!0)),void 0!==c.index){const t=this.list.childNodes[c.index];t?this.list.insertBefore(d,t):this.list.appendChild(d)}else this.plusTab?this.list.insertBefore(d,this.plusTab.tab):this.list.appendChild(d);if(c.tabWidth&&(d.style.width="number"==typeof c.tabWidth?`${c.tabWidth.toFixed(0)}px`:c.tabWidth.toString(),d.style.minWidth="0"),this.options.autoswitch){d.classList.add("autoswitch");const t=t=>{const e=t.target;this._timeoutMouseOver&&clearTimeout(this._timeoutMouseOver),this._timeoutMouseOver=setTimeout(()=>{(0,o.Trigger)(e,"click"),this._timeoutMouseOver=void 0},500)};d.addEventListener("dragenter",t),d.addEventListener("dragleave",()=>{this._timeoutMouseOver&&(clearTimeout(this._timeoutMouseOver),this._timeoutMouseOver=void 0)})}const h=document.createElement("div");if(c.id&&(h.id=c.id),h.className=`wtabcontent wtabcontent-${u} ${null!==(a=c.className)&&void 0!==a?a:""}`,h.dataset.id=t,h.style.display="none","horizontal"==this.mode?c.size&&(h.style.overflow="auto","full"==c.size?(h.style.width="100%",h.style.height=`calc( 100% - ${r.TABS_HEIGHT}px )`):h.style.height=c.size.toString()):"vertical"==this.mode&&c.size&&(h.style.overflow="auto","full"==c.size?(h.style.height="100%",h.style.width=`calc( 100% - ${r.TABS_WIDTH}px )`):h.style.width=c.size.toString()),void 0!==c.width&&(h.style.width="string"==typeof c.width?c.width:`${c.width}px`),void 0!==c.height&&(h.style.height="string"==typeof c.height?c.height:`${c.height}px`),c.content&&("string"==typeof c.content?h.innerHTML=c.content:h.appendChild(c.content)),this.root.appendChild(h),c.button){const t=t=>{if(!t.target)return;const e=d.dataset.id;"string"==typeof e&&c.callback&&c.callback(e,t)};d.addEventListener("click",t.bind(d))}else d.addEventListener("click",this._onTabClicked.bind(this,d));d.options=e,d.tabs=this;const p=d.querySelector("span.tabtitle"),g=new s(t,d,h,p);d.info=g,c.onClose&&(g.onClose=c.onClose);const m=this.tabsByIndex.length;return this.tabsByIndex[m]=g,this.tabs[t]=g,this.recomputeTabsByIndex(),d.addEventListener("contextmenu",t=>(2!=t.button||(t.preventDefault(),c.onContextCall&&c.onContextCall(g)),!1)),this.options.allowRename&&d.addEventListener("dblclick",()=>{const t=d.querySelector(".tabtitle");if(!t)return;const e=t.innerText;t.style.display="none";const n=document.createElement("input");n.type="text",n.value=e,n.className="tab-rename-input",n.style.width="80px";let i=!1;const o=()=>{if(i)return;i=!0;const e=n.value.trim();e&&(t.innerText=e),n.remove(),t.style.display=""};n.addEventListener("keydown",e=>{if("Enter"===e.key)o();else if("Escape"===e.key){if(i)return;i=!0,n.remove(),t.style.display=""}}),n.addEventListener("blur",()=>{o()}),d.insertBefore(n,t),n.focus()}),1!=c.selected&&null!=this.selected||this.selectTab(t,c.skipCallbacks),g}getPlusTab(){return this.plusTab}addPlusTab(t){this.addPlusTabCallback(t)}createPlusTab(){this.plusTab||(this.plusTab=this.addTab("plus_tab",{title:"+",tabWidth:20,button:!0,tabClassName:"wtabplus",callback:this.onPlusTabClick.bind(this),skipCallbacks:!0}),this.list.appendChild(this.plusTab.tab))}addPlusTabCallback(t){this.plusTab||this.createPlusTab(),this.plusTabCallbacks.push(t)}removePlusTabCallback(t){const e=this.plusTabCallbacks.indexOf(t);e>-1&&this.plusTabCallbacks.splice(e,1)}onPlusTabClick(t,e){this.createGhostTab();for(const n of this.plusTabCallbacks)n(t,e)}createGhostTab(){const t=document.createElement("li");t.className="wtab wtabghost";const e=document.createElement("input");e.type="text",e.placeholder="New Tab",e.className="wtabghostinput",t.appendChild(e),this.plusTab?this.list.insertBefore(t,this.plusTab.tab):this.list.appendChild(t);let n=!1;const i=()=>{if(n)return;n=!0;const i=e.value.trim();i&&this.addTab(null,{title:i,selected:!0}),t.remove()},o=()=>{n||(n=!0,t.remove())};e.addEventListener("keydown",t=>{"Enter"===t.key?i():"Escape"===t.key&&o()}),e.addEventListener("blur",()=>{e.value.trim()?i():o()}),e.focus()}addButtonTab(t,e,n){return this.addTab(t,{title:e,button:!0,callback:n,skipCallbacks:!0})}_onTabClicked(t,e){var n;if(t.selected)return;if(!t.parentNode)return;const i=this.options;if(!this)throw"tabs not found";if(i.onCanOpen&&0==i.onCanOpen(t))return;const s=t.dataset.id;if(-1!=this.currentTab&&this.tabsByIndex[this.currentTab].id!=s&&this.tabsByIndex[this.currentTab].content&&(null===(n=t.options)||void 0===n?void 0:n.onLeave)){const e=this.tabsByIndex[this.currentTab];t.options.onLeave(e)}let r=null;for(const t in this.tabs){const e=this.tabs[t];e.id==s?(e.selected=!0,e.content.style.display="",r=e.content):(e.selected=!1,e.content.style.display="none")}const l=this.list.querySelectorAll("li.wtab");for(const t of l)t.classList.remove("selected"),t.selected=!1;t.selected=!0,t.classList.add("selected"),this.previousTab=this.currentTab,this.currentTab=this.getIndexOfTab(s),e&&("string"==typeof s&&(i.callback&&i.callback(s,e),t.options&&t.options.callback&&t.options.callback(s,e)),(0,o.Trigger)(this.root,"wchange",[s,r]),this.onchange&&this.onchange(s,r)),this.selected=s}selectTab(t,e=!1){if(!t)return;const n=this.list.querySelectorAll("li.wtab");for(const i of n)if(t==i.dataset.id){this._onTabClicked(i,!e);break}}setTabVisibility(t,e){const n=this.getTab(t);n&&(n.tab.style.display=e?"":"none",n.content.style.display=e?"":"none")}recomputeTabsByIndex(){this.tabsByIndex=[];for(const t in this.tabs){const e=this.tabs[t];let n=0,i=e.tab.previousSibling;for(;i;)n++,i=i.previousSibling;this.tabsByIndex[n]=e}}removeTab(t){const e=this.getTab(t);if(!e)return void console.warn(`tab not found: ${t}`);e.onClose&&e.onClose(e),e.tab.parentNode&&e.tab.parentNode.removeChild(e.tab),e.content.parentNode&&e.content.parentNode.removeChild(e.content);const n=this.getIndexOfTab(t);this.tabsByIndex.splice(n,1),delete this.tabs[t],this.recomputeTabsByIndex()}removeAllTabs(t=!1){const e=[];for(const t in this.tabs)e.push(this.tabs[t]);for(const n in e){const i=e[n];if(i==this.plusTab&&t)continue;i.tab.parentNode&&i.tab.parentNode.removeChild(i.tab),i.content.parentNode&&i.content.parentNode.removeChild(i.content);const o=this.getIndexOfTab(i.id);this.tabsByIndex.splice(o,1),delete this.tabs[i.id]}this.recomputeTabsByIndex()}clear(){this.removeAllTabs()}hideTab(t){this.setTabVisibility(t,!1)}showTab(t){this.setTabVisibility(t,!0)}transferTab(t,e,n=0){const i=this.getTab(t);if(!i)return;e.tabs[t]=i,0!==n?e.list.insertBefore(i.tab,e.list.childNodes[n]):e.list.appendChild(i.tab),e.root.appendChild(i.content),delete this.tabs[t],this.tabsByIndex.splice(this.getIndexOfTab(t),1);let o="";for(const t in this.tabs)if(o=t,o)break;o&&this.selectTab(o),i.tab.selected=!1,e.recomputeTabsByIndex(),e.selectTab(t)}detachTab(t,e,n){const i=this.getIndexOfNodeList(t);if(!this.tabs[t])return;const o=window.open("","","width=800, height=600, location=no, status=no, menubar=no, titlebar=no, fullscreen=yes");if(!o)return;o.document.writeln(`<head><title>${t}</title>`);const s=document.querySelectorAll("link[rel='stylesheet'],style");for(let t=0;t<s.length;t++)o.document.writeln(s[t].outerHTML);o.document.writeln("</head><body></body>"),o.document.close();const l=new r(this.options);return o.tabs=l,o.onbeforeunload=()=>{l.transferTab(t,this,i),n&&n()},l.list.style.height="20px",o.document.body.appendChild(l.root),this.transferTab(t,l,i),l.tabs[t].tab.selected=!0,this.recomputeTabsByIndex(),e&&e(),o}}e.Tabs=r,r.TABS_WIDTH=64,r.TABS_HEIGHT=26},3252(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PurgeElement=function t(e){const n=e.attributes;let i,o;if(n)for(i=n.length-1;i>=0;i-=1)o=n[i].name,"function"==typeof e[o]&&(e[o]=null);const s=e.childNodes;if(s){const e=s.length;for(let n=0;n<e;n+=1)t(s[n])}},e.CloneInsides=function(t,e){e=null!=e?e:{};for(const n in t)e[n]=t[n];return e},e.FocusElement=function(t){t.focus()},e.BlurElement=function(t){t.blur()},e.AssignValue=function(t,e){var n,i,o;const s=t.instance,r=s[t.name];if(null==r||null==e||"enum"==(null===(n=t.options)||void 0===n?void 0:n.type))s[t.name]=e;else if("number"==typeof r)s[t.name]=parseFloat(e.toString());else if("string"==typeof r)s[t.name]=e;else if(!(e&&e.length&&r&&r.length)||Object.getOwnPropertyDescriptor(s,t.name)&&(null===(i=Object.getOwnPropertyDescriptor(s,t.name))||void 0===i?void 0:i.set)||Object.getOwnPropertyDescriptor(Object.getPrototypeOf(s),t.name)&&(null===(o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(s),t.name))||void 0===o?void 0:o.set))s[t.name]=e;else for(let t=0;t<e.length;++t)r[t]=e[t]},e.CollectProperties=function(t){var e;const n={},i=t;for(const o in i){if("_"==o[0]||"@"==o[0]||"jQuery"==o.substring(0,6))continue;const s=i[o],r=t;s&&"function"==typeof s.constructor&&!(null===(e=r.constructor)||void 0===e?void 0:e[`@${o}`])||(n[o]=s)}return n},e.EscapeHtmlEntities=function(t){return t.replace(/[\u00A0-\u2666<>&]/g,t=>`&${o[t.charCodeAt(0)]||`#${t.charCodeAt(0)}`};`)},e.BeautifyCode=function(t,e,n){e=e||["abstract","else","instanceof","super","boolean","enum","int","switch","break","export","interface","synchronized","byte","extends","let","this","case","false","long","throw","catch","final","native","throws","char","finally","new","transient","class","float","null","true","const","for","package","try","continue","function","private","typeof","debugger","goto","protected","var","default","if","public","void","delete","implements","return","volatile","do","import","short","while","double","in","static","with"],t=(t=(t=(t=(t=(t=t.replace(/\b(\w+)\b/g,t=>-1!=e.indexOf(t)?`<span class='rsv'>${t}</span>`:t)).replace(/\b([0-9]+)\b/g,t=>`<span class='num'>${t}</span>`)).replace(/(\w+\.\w+)/g,t=>{const e=t.split(".");return`<span class='obj'>${e[0]}</span>.<span class='prop'>${e[1]}</span>`})).replace(/(\w+)\(/g,t=>`<span class='prop'>${t.substring(0,t.length-1)}</span>(`)).replace(/("(\\.|[^"])*")/g,t=>`<span class='str'>${t}</span>`)).replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,t=>`<span class='cmnt'>${t.replace(/<[^>]*>/g,"")}</span>`),n||(t=`<style>.obj { color: #79B; } .prop { color: #B97; }\t.str,.num { color: #A79; } .cmnt { color: #798; } .rsv { color: #9AB; } </style>${t}`);return t},e.BeautifyJSON=function(t,e){"object"==typeof t&&(t=JSON.stringify(t));const n=["false","true","null"];t=(t=(t=(t=(t=t.replace(/(\w+)/g,t=>-1!=n.indexOf(t)?`<span class='rsv'>${t}</span>`:t)).replace(/([0-9]+)/g,t=>`<span class='num'>${t}</span>`)).replace(/(\w+\.\w+)/g,t=>{const e=t.split(".");return`<span class='obj'>${e[0]}</span>.<span class='prop'>${e[1]}</span>`})).replace(/("(\\.|[^"])*")/g,t=>`<span class='str'>${t}</span>`)).replace(/(\/\/[a-zA-Z0-9?!()_ ]*)/g,t=>`<span class='cmnt'>${t}</span>`),e||(t=`<style>.obj { color: #79B; } .prop { color: #B97; }\t.str { color: #A79; } .num { color: #B97; } .cmnt { color: #798; } .rsv { color: #9AB; } </style>${t}`);return t},e.DataURItoBlob=function(t){const e=t.indexOf(","),n=atob(t.substring(e+1)),i=new ArrayBuffer(n.length),o=new Uint8Array(i),s=n.length;for(let t=0;t<s;t++)o[t]=n.charCodeAt(t);let r=t.substring(5,e-5);return r=r.substring(0,r.length-7),new Blob([i],{type:r})},e.RGBAToHEXA=function(t){const e=t[0],n=t[1],i=t[2],o=t[3],s=t=>{const e=t.toString(16);return 1===e.length?"0"+e:e},r=Math.round(o).toString(16),l=1===r.length?"0"+r:r;return`#${s(e)}${s(n)}${s(i)}${l}`},e.SizeToCSS=function(t){if(null==t)return;if(t.constructor===String)return t;if("number"==typeof t&&t>=0)return t+"px";return"calc( 100% - "+Math.abs(t)+"px )"},e.Trigger=s,e.RemoveElement=r,e.Bind=function(t,e,n){if(!t)throw"Cannot bind to null";if(!e)throw"Event bind missing";if(!n)throw"Bind callback missing";"string"==typeof t&&(t=document.querySelectorAll(t));function i(t){if(t)if("addEventListener"in t)t.addEventListener(e,n);else if("__events"in t)t.__events.addEventListener(e,n);else{const i=t,o=document.createElement("span");o.widget=t,Object.defineProperty(i,"__events",{enumerable:!1,configurable:!1,writable:!1,value:o}),i.__events.addEventListener(e,n)}}if(Array.isArray(t)||t.constructor===NodeList)for(let e=0;e<t.length;++e)i(t[e]);else i(t)},e.Unbind=function(t,e,n){"removeEventListener"in t?t.removeEventListener(e,n):"__events"in t&&t.__events.removeEventListener(e,n)},e.RemoveClass=function(t,e,n){n||(n=e,e="."+e);const i=(t||document).querySelectorAll(e);for(let t=0;t<i.length;++t)i[t].classList.remove(n)},e.GetById=function(t){return document.getElementById(t)},e.IsCursorOverElement=function(t,e){const n=t.pageX,i=t.pageY,o=e.getBoundingClientRect();if(!o)return!1;if(i>o.top&&i<o.top+o.height&&n>o.left&&n<o.left+o.width)return!0;return!1},e.GetRect=function(t){return t.getBoundingClientRect()},e.ToClipboard=function(t){"string"!=typeof t&&(t=JSON.stringify(t));try{navigator.clipboard.writeText(t).then(()=>{console.log("Saved to clipboard")}).catch(t=>{console.warn("Problem saving to clipboard",t)})}catch(t){console.warn("Oops, unable to copy using the true clipboard",t)}},e.AddCSS=function(t){if(!t)return;if("string"==typeof t){const e=document.createElement("style");return e.innerHTML=t,void document.getElementsByTagName("head")[0].appendChild(e)}for(const e in t)document.body.style[e]=t[e]},e.RequireCSS=function(t,e){"string"==typeof t&&(t=[t]);for(;t.length;){const n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=t.shift(),n.media="all";document.getElementsByTagName("head")[0].appendChild(n),0==t.length&&(n.onload=e)}},e.Request=l,e.RequestText=function(t,e,n){return l({url:t,dataType:"text",success:e,error:n})},e.RequestJSON=function(t,e,n){return l({url:t,dataType:"json",success:e,error:n})},e.RequestBinary=function(t,e,n){return l({url:t,dataType:"binary",success:e,error:n})},e.RequireScript=function(t,e,n,i,o){if(!t)throw"invalid URL";"string"==typeof t&&(t=[t]);let s=t.length;const r=[],l=function(t){s--,r.push(t),s?i&&i(t.originalSrc,t.num):e&&e(r)};for(const e in t){const i=document.createElement("script");i.num=parseInt(e),i.type="text/javascript",i.src=t[i.num]+(o?"?version="+o:""),i.originalSrc=t[i.num],i.async=!1,i.onload=l.bind(void 0,i),n&&(i.onerror=function(t){n(t,this.originalSrc,this.num)}),document.getElementsByTagName("head")[0].appendChild(i)}},e.ShowMessage=a,e.PopupDialog=function(t,e){(e=null!=e?e:{}).minHeight=140,"string"==typeof t&&(t=`<p>${t}</p>`);e.content=t,e.close="fade";const n=new i.Dialog(e);e.closable&&n.addButton("Close",{close:!0});return n.show(),n},e.AlertDialog=function(t,e){var n,i,o;(e=null!=e?e:{}).className="alert",e.title=null!==(n=e.title)&&void 0!==n?n:"Alert",e.width=null!==(i=e.width)&&void 0!==i?i:280,e.height=null!==(o=e.height)&&void 0!==o?o:140,"string"==typeof t&&(t=`<p>${t}</p>`);return r(".litepanel.alert"),a(t,e)},e.ConfirmDialog=function(t,e,n){var i,o;(n=null!=n?n:{}).className="alert",n.title=null!==(i=n.title)&&void 0!==i?i:"Confirm",n.width=null!==(o=n.width)&&void 0!==o?o:280,"string"==typeof t&&(t=`<p>${t}</p>`);t+="<button class='litebutton' data-value='yes' style='width:45%; margin-left: 10px'>Yes</button><button class='litebutton' data-value='no' style='width:45%'>No</button>",n.noclose=!0;const s=a(t,n);s.content.style.paddingBottom="10px";const r=s.content.querySelectorAll("button"),l=t=>{const n="yes"==t.target.dataset.value;s.close(),e&&e(n)};for(let t=0;t<r.length;t++){r[t].addEventListener("click",l)}return r[0].focus(),s},e.PromptDialog=function(t,e,n){var i,o,s;(n=null!=n?n:{}).className="alert",n.title=null!==(i=n.title)&&void 0!==i?i:"Prompt",n.width=null!==(o=n.width)&&void 0!==o?o:280,"string"==typeof t&&(t=`<p>${t}</p>`);const r=null!==(s=n.value)&&void 0!==s?s:"";let l=`<input type='text' value='${r}'/>`;n.textarea&&(l=`<textarea class='textfield' style='width:95%'>${r}</textarea>`);t+=`<p>${l}</p><button class='litebutton' data-value='accept' style='width:45%; margin-left: 10px; margin-bottom: 10px'>Accept</button><button class='litebutton' data-value='cancel' style='width:45%'>Cancel</button>`,n.noclose=!0;const c=a(t,n),d=c.content.querySelectorAll("button"),u=c.content.querySelector("input,textarea"),h=function(t){const n=t.target;let i=u.value;n&&n.dataset&&"cancel"==n.dataset.value&&(i=void 0),c.close(),e&&e(i)};for(let t=0;t<d.length;t++)d[t].addEventListener("click",h);return null==u||u.addEventListener("keydown",function(t){if("Enter"==t.key)return h(t),!1;"Escape"==t.key&&c.close();return},!0),null==u||u.focus(),c},e.ChoiceDialog=function(t,e,n,i){var o,s;(i=null!=i?i:{}).className="alert",i.title=null!==(o=i.title)&&void 0!==o?o:"Select one option",i.width=null!==(s=i.width)&&void 0!==s?s:280,"string"==typeof t&&(t=`<p>${t}</p>`);for(const n in e){t+=`<button class='litebutton' data-value='${n}' style='width:45%; margin-left: 10px'>${"string"==typeof e[n]?e[n]:e[n].content}</button>`}i.noclose=!0;const r=a(t,i);r.content.style.paddingBottom="10px";const l=r.content.querySelectorAll("button"),c=t=>{const i=t.target,o=e[i.dataset.value];r.close(),n&&n(o)};for(let t=0;t<l.length;t++)l[t].onclick=c;return r},e.RequireScriptSerial=function(t,e,n){"string"==typeof t&&(t=[t]);const i=[];!function o(){const s=document.createElement("script");s.type="text/javascript",s.src=t.shift(),s.onload=function(){if(t.length)return n&&n(t[0],t.length),void o();i.push(this),e&&e(i)},document.getElementsByTagName("head")[0].appendChild(s)}()},e.CreateElement=function(t,e,n,i,o){const s=document.createElement(t);if(e){const t=e.split(" ");for(let e=0;e<t.length;e++)"."==t[e][0]?s.classList.add(t[e].substring(1)):"#"==t[e][0]?s.id=t[e].substring(1):s.id=t[e]}s.root=s,n&&(s.innerHTML=n);if(s.add=function(t){this.appendChild("root"in t?t.root:t)},i)if("string"==typeof i)s.setAttribute("style",i);else for(const t in i)s.style[t]=i[t];if(o)for(const t in o)s.addEventListener(t,o[t]);return s},e.CreateListItem=function(t,e,n){let i=document.createElement("span");i.innerHTML=t;const o=i.childNodes[0];if(!o)throw"Error creating list item";if(i=o,e)for(const t in e){const n=i.querySelector(t);n&&(n.innerText=e[t])}if(n)for(const t in n){const e=n[t];"string"==typeof e&&(i.style[t]=e)}return i},e.CreateButton=function(t,e,n,i){const o=document.createElement("button");if(o.className="litegui litebutton button",t){const e=t.split(" ");for(let t=0;t<e.length;t++)"."==e[t][0]?o.classList.add(e[t].substring(1)):"#"==e[t][0]?o.id=e[t].substring(1):o.id=e[t]}o.root=o,void 0!==e&&(o.innerHTML=e);n&&(o.onclick=n);if(i)if("string"==typeof i)o.setAttribute("style",i);else for(const t in i)o.style[t]=i[t];return o},e.GetParents=function(t){const e=[];let n=t.parentElement;for(;null!==n;)t.nodeType===Node.ELEMENT_NODE&&(e.push(t),n=n.parentElement);return e},e.NewWindow=function(t,e,n,i){var o;i=null!=i?i:{};const s=window.open("","",`width=${e}, height=${n}, location=no, status=no, menubar=no, titlebar=no, fullscreen=yes`);s.document.writeln(`<html><head><title>${t}</title>`);const r=document.querySelectorAll("link[rel='stylesheet'],style");for(let t=0;t<r.length;t++)s.document.writeln(r[t].outerHTML);if(i.scripts){const t=document.querySelectorAll("script");for(let e=0;e<t.length;e++)t[e].src&&s.document.writeln(t[e].outerHTML)}const l=null!==(o=i.content)&&void 0!==o?o:"";return s.document.writeln(`</head><body>${l}</body></html>`),s.document.close(),s},e.DownloadURL=function(t,e){const n=document.createElement("a");n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)},e.DownloadFile=function(t,e,n){if(!e)return void console.warn("No file provided to download");n||(n=e.constructor===String?"text/plain":"application/octet-stream");let i=null;i=e instanceof File||e instanceof Blob?e:new Blob([e],{type:n});const o=URL.createObjectURL(i),s=document.createElement("a");s.setAttribute("href",o),s.setAttribute("download",t),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>{URL.revokeObjectURL(o)},6e4)},e.GetUrlVars=c,e.GetUrlVar=function(t){return c()[t]},e.Draggable=function(t,e,n,i,o){(e=null!=e?e:t).addEventListener("mousedown",function e(d){if("mousedown"==d.type)return l||(l=t.getClientRects()[0],a=l?l.left:0,c=l?l.top:0),o&&0==o(t,d)?(d.stopPropagation(),!1):(s=d.clientX,r=d.clientY,document.addEventListener("mousemove",e),document.addEventListener("mouseup",e),n&&n(t,d),d.stopPropagation(),!1);if("mouseup"==d.type)return document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",e),void(i&&i(t,d));if("mousemove"==d.type){const e=d.clientX-s,n=d.clientY-r;s=d.clientX,r=d.clientY,a+=e,c+=n,t.style.left=a+"px",t.style.top=c+"px"}return}),e.style.cursor="move";let s=0,r=0,l=t.getClientRects()[0],a=l?l.left:0,c=l?l.top:0;t.style.position="absolute",t.style.left=a+"px",t.style.top=c+"px"},e.CloneObject=function(t,e){const n="object"!=typeof e?{}:e;for(const e in t){if("_"==e[0]||"jQuery"==e.substring(0,5))continue;const i=t[e];if(null==i)n[e]=null;else{if("function"==typeof i)continue;if("number"==typeof i||"string"==typeof i)n[e]=i;else if("object"==typeof i&&"constructor"in i&&i.constructor==Float32Array)n[e]=Array.from(i);else if(Array.isArray(i))n[e]&&n[e].constructor==Float32Array?n[e].set(i):n[e]=JSON.parse(JSON.stringify(i));else try{n[e]=JSON.parse(JSON.stringify(i))}catch(t){console.error(t)}}}return n},e.SafeName=function(t){return String(t).replace(/[\s.]/g,"")},e.HTMLEncode=function(t){const e=document.createElement("div");return e.innerHTML=t,e.innerText},e.HTMLDecode=function(t){const e=document.createElement("div");return e.innerText=t,e.innerHTML},e.GetElementWindow=function(t){const e=t.ownerDocument;return e.defaultView||e.parentWindow},e.CreateDropArea=function(t,e,n,i){function o(e){t.addEventListener("dragexit",o),t.addEventListener("dragover",o),t.addEventListener("drop",s),e.stopPropagation(),e.preventDefault(),"dragenter"==e.type&&n&&n(e,t),"dragexit"==e.type&&i&&i(e,t)}function s(n){let i;return n.stopPropagation(),n.preventDefault(),t.removeEventListener("dragexit",o),t.removeEventListener("dragover",o),t.removeEventListener("drop",s),e&&(i=e(n)),!!i&&(n.stopPropagation(),n.stopImmediatePropagation(),!0)}t.addEventListener("dragenter",o)};const i=n(4606);const o={34:"quot",38:"amp",39:"apos",60:"lt",62:"gt",160:"nbsp",161:"iexcl",162:"cent",163:"pound",164:"curren",165:"yen",166:"brvbar",167:"sect",168:"uml",169:"copy",170:"ordf",171:"laquo",172:"not",173:"shy",174:"reg",175:"macr",176:"deg",177:"plusmn",178:"sup2",179:"sup3",180:"acute",181:"micro",182:"para",183:"middot",184:"cedil",185:"sup1",186:"ordm",187:"raquo",188:"frac14",189:"frac12",190:"frac34",191:"iquest",192:"Agrave",193:"Aacute",194:"Acirc",195:"Atilde",196:"Auml",197:"Aring",198:"AElig",199:"Ccedil",200:"Egrave",201:"Eacute",202:"Ecirc",203:"Euml",204:"Igrave",205:"Iacute",206:"Icirc",207:"Iuml",208:"ETH",209:"Ntilde",210:"Ograve",211:"Oacute",212:"Ocirc",213:"Otilde",214:"Ouml",215:"times",216:"Oslash",217:"Ugrave",218:"Uacute",219:"Ucirc",220:"Uuml",221:"Yacute",222:"THORN",223:"szlig",224:"agrave",225:"aacute",226:"acirc",227:"atilde",228:"auml",229:"aring",230:"aelig",231:"ccedil",232:"egrave",233:"eacute",234:"ecirc",235:"euml",236:"igrave",237:"iacute",238:"icirc",239:"iuml",240:"eth",241:"ntilde",242:"ograve",243:"oacute",244:"ocirc",245:"otilde",246:"ouml",247:"divide",248:"oslash",249:"ugrave",250:"uacute",251:"ucirc",252:"uuml",253:"yacute",254:"thorn",255:"yuml",402:"fnof",913:"Alpha",914:"Beta",915:"Gamma",916:"Delta",917:"Epsilon",918:"Zeta",919:"Eta",920:"Theta",921:"Iota",922:"Kappa",923:"Lambda",924:"Mu",925:"Nu",926:"Xi",927:"Omicron",928:"Pi",929:"Rho",931:"Sigma",932:"Tau",933:"Upsilon",934:"Phi",935:"Chi",936:"Psi",937:"Omega",945:"alpha",946:"beta",947:"gamma",948:"delta",949:"epsilon",950:"zeta",951:"eta",952:"theta",953:"iota",954:"kappa",955:"lambda",956:"mu",957:"nu",958:"xi",959:"omicron",960:"pi",961:"rho",962:"sigmaf",963:"sigma",964:"tau",965:"upsilon",966:"phi",967:"chi",968:"psi",969:"omega",977:"thetasym",978:"upsih",982:"piv",8226:"bull",8230:"hellip",8242:"prime",8243:"Prime",8254:"oline",8260:"frasl",8472:"weierp",8465:"image",8476:"real",8482:"trade",8501:"alefsym",8592:"larr",8593:"uarr",8594:"rarr",8595:"darr",8596:"harr",8629:"crarr",8656:"lArr",8657:"uArr",8658:"rArr",8659:"dArr",8660:"hArr",8704:"forall",8706:"part",8707:"exist",8709:"empty",8711:"nabla",8712:"isin",8713:"notin",8715:"ni",8719:"prod",8721:"sum",8722:"minus",8727:"lowast",8730:"radic",8733:"prop",8734:"infin",8736:"ang",8743:"and",8744:"or",8745:"cap",8746:"cup",8747:"int",8756:"there4",8764:"sim",8773:"cong",8776:"asymp",8800:"ne",8801:"equiv",8804:"le",8805:"ge",8834:"sub",8835:"sup",8836:"nsub",8838:"sube",8839:"supe",8853:"oplus",8855:"otimes",8869:"perp",8901:"sdot",8968:"lceil",8969:"rceil",8970:"lfloor",8971:"rfloor",9001:"lang",9002:"rang",9674:"loz",9824:"spades",9827:"clubs",9829:"hearts",9830:"diams",338:"OElig",339:"oelig",352:"Scaron",353:"scaron",376:"Yuml",710:"circ",732:"tilde",8194:"ensp",8195:"emsp",8201:"thinsp",8204:"zwnj",8205:"zwj",8206:"lrm",8207:"rlm",8211:"ndash",8212:"mdash",8216:"lsquo",8217:"rsquo",8218:"sbquo",8220:"ldquo",8221:"rdquo",8222:"bdquo",8224:"dagger",8225:"Dagger",8240:"permil",8249:"lsaquo",8250:"rsaquo",8364:"euro"};function s(t,e,n){const i=new CustomEvent(e,{detail:n});return t&&"object"==typeof t?("dispatchEvent"in t?t.dispatchEvent(i):"__events"in t&&t.__events.dispatchEvent(i),i):i}function r(t){var e,n,i;if(t)if("string"==typeof t){const e=document.querySelectorAll(t);for(let t=0;t<e.length;++t){const n=e[t];n&&n.parentNode&&n.parentNode.removeChild(n)}}else if(Array.isArray(t)||t instanceof NodeList)for(const e in t)r(t[e]);else"root"in t?null===(n=null===(e=t.root)||void 0===e?void 0:e.parentNode)||void 0===n||n.removeChild(t.root):"parentNode"in t&&(null===(i=t.parentNode)||void 0===i||i.removeChild(t))}function l(t){var e;let n=null!==(e=t.dataType)&&void 0!==e?e:"text";"json"==n||"xml"==n?n="text":"binary"==n&&(n="arraybuffer",t.mimeType="application/octet-stream");const i=new XMLHttpRequest;i.open(t.data?"POST":"GET",t.url,!0),n&&(i.responseType=n),t.mimeType&&i.overrideMimeType(t.mimeType),t.nocache&&i.setRequestHeader("Cache-Control","no-cache"),i.onload=function(){let e=this.response;if(200!=this.status){const e="Error "+this.status;return t.error&&t.error(e),void s(i,"fail",this.status)}if("json"==t.dataType)try{e=JSON.parse(e)}catch(e){if(!t.error)throw e;t.error(e)}else if("xml"==t.dataType)try{e=(new DOMParser).parseFromString(e,"text/xml")}catch(e){if(!t.error)throw e;t.error(e)}t.success&&t.success.call(this,e,this)},i.onerror=function(e){t.error&&t.error(e)};const o=new FormData;if(t.data)for(const e in t.data)o.append(e,t.data[e]);return i.send(o),i}function a(t,e){var n;(e=null!=e?e:{}).title=null!==(n=e.title)&&void 0!==n?n:"Attention",e.content=t,e.close="fade";const o=new i.Dialog(e);return e.closable&&o.addButton("Close",{close:!0}),o.makeModal(),o}function c(){const t=[];let e;const n=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(let i=0;i<n.length;i++)e=n[i].split("="),t.push(e[0]),t[e[0]]=e[1];return t}},1736(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Button=void 0;e.Button=class{constructor(t,e={}){"function"==typeof e&&(e={callback:e});const n=document.createElement("div");n.className="litegui button",this.root=n;const i=document.createElement("button");i.className="litebutton",this.content=i,n.appendChild(i),i.innerHTML=t,i.addEventListener("click",()=>{this.click()}),e.callback&&(this.callback=e.callback)}click(){this.callback&&this.callback()}}},4889(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Checkbox=void 0;e.Checkbox=class{constructor(t,e){this.value=t;const n=this.root=document.createElement("span");n.className="litecheckbox inputfield",n.dataset.value=t.toString();const i=this.element=document.createElement("span");i.className="fixed flag checkbox "+(t?"on":"off"),n.appendChild(i),n.addEventListener("click",this.onClick.bind(this)),this.onChange=e}setValue(t){this.value!==t&&this.root&&this.element&&this.root.dataset.value!=t.toString()&&(this.root.dataset.value=t.toString(),t?(this.element.classList.remove("off"),this.element.classList.add("on")):(this.element.classList.remove("on"),this.element.classList.add("off")),this.value=t,this.onChange(t))}getValue(){return"true"==this.root.dataset.value}onClick(){this.setValue("true"!=this.root.dataset.value)}}},966(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ComplexList=void 0;const i=n(1969);e.ComplexList=class{constructor(t={}){var e;this.options=t,this.root=document.createElement("div"),this.root.className="litecomplexlist",this.itemCode=this.options.itemCode||"<div class='listitem'><span class='tick'><span>"+i.SpecialCode.tick+"</span></span><span class='title'></span><button class='trash'>"+i.SpecialCode.close+"</button></div>",this.options.height&&(this.root.style.height=null!==(e=i.LiteGUI.sizeToCSS(this.options.height))&&void 0!==e?e:""),this.onItemSelected=t.onItemSelected,this.onItemToggled=t.onItemToggled,this.onItemRemoved=t.onItemRemoved}addTitle(t){const e=i.LiteGUI.createElement("div",".listtitle",t);return this.root.appendChild(e),e}addHTML(t,e){const n=i.LiteGUI.createElement("div",".listtext",t);return e&&n.addEventListener("mousedown",e),this.root.appendChild(n),n}clear(){this.root.innerHTML=""}addItem(t,e,n,o){var s;const r=null!=e?e:"object"==typeof t&&null!==(s=t.content||t.name)&&void 0!==s?s:"",l=i.LiteGUI.createListItem(this.itemCode,{".title":r});if(l.item=t,n&&l.classList.add("enabled"),!o){const t=l.querySelector(".trash");t&&(t.style.display="none")}l.addEventListener("mousedown",e=>{e.preventDefault(),l.setSelected(!0),this.onItemSelected&&this.onItemSelected(t,l)});const a=l.querySelector(".tick");a&&a.addEventListener("mousedown",e=>{e.preventDefault(),l.classList.toggle("enabled"),this.onItemToggled&&this.onItemToggled(t,l,l.classList.contains("enabled"))});const c=l.querySelector(".trash");return c&&c.addEventListener("mousedown",e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),l.remove(),this.onItemRemoved&&this.onItemRemoved(t,l)}),l.setContent=function(t,e){const n=l.querySelector(".title");n&&(e?n.innerHTML=t:n.innerText=t)},l.toggleEnabled=function(){l.classList.toggle("enabled")},l.setSelected=t=>{i.LiteGUI.removeClass(this.root,"selected"),t?l.classList.add("selected"):l.classList.remove("selected"),this.selected=l.item},l.show=function(){this.style.display=""},l.hide=function(){this.style.display="none"},this.root.appendChild(l),l}}},7962(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ContextMenu=void 0;const i=n(1969);e.ContextMenu=class{constructor(t,e){var n,i;e=null!=e?e:{},this.options=e,e.parentMenu&&(e.parentMenu.constructor!==this.constructor?(console.error("parentMenu must be of class ContextMenu, ignoring it"),e.parentMenu=void 0):(this.parentMenu=e.parentMenu,this.parentMenu.lock=!0,this.parentMenu.currentSubmenu=this)),e.event&&"PointerEvent"!==e.event.constructor.name&&"MouseEvent"!==e.event.constructor.name&&"CustomEvent"!==e.event.constructor.name&&(console.error("Event passed to ContextMenu is not of type PointerEvent, MouseEvent or CustomEvent. Ignoring it."),e.event=void 0);const o=document.createElement("div");if(o.className="litecontextmenu litemenubar-panel",o.style.minWidth="100px",o.style.minHeight="100px",o.style.pointerEvents="none",setTimeout(()=>{o.style.pointerEvents="auto"},100),o.addEventListener("mouseup",t=>(t.preventDefault(),!0),!0),o.addEventListener("contextmenu",t=>(2!=t.button||t.preventDefault(),!1),!0),o.addEventListener("mousedown",t=>2==t.button&&(this.close.bind(this,t),t.preventDefault(),!0),!0),this.root=o,e.title){const t=document.createElement("div");t.className="litemenu-title",t.innerHTML=e.title,o.appendChild(t)}if(t){let n,i=[];t&&!Array.isArray(t)?(i=Object.keys(t),n=i.length):n=t.length;for(let o=0;o<n;o++){let n,s;Array.isArray(t)?(n=o.toString(),s=t[o]):(n=i[o],s=t[n]),this.addItem(n,s,e)}}o.addEventListener("mouseleave",t=>{!this.lock&&this.root&&(this.closingTimer&&clearTimeout(this.closingTimer),this.closingTimer=setTimeout(this.close.bind(this,t),500))}),o.addEventListener("mouseenter",()=>{this.closingTimer&&clearTimeout(this.closingTimer)}),o.addEventListener("wheel",function(t){const e=parseInt(o.style.top);return o.style.top=(e+.1*t.deltaY).toFixed()+"px",t.preventDefault(),!0},!0);let s=document;e.event&&e.event.target&&e.event.target.ownerDocument&&(s=e.event.target.ownerDocument),s.body.appendChild(o);let r=null!==(n=e.left)&&void 0!==n?n:0,l=null!==(i=e.top)&&void 0!==i?i:0;if(e.event)if("PointerEvent"!==e.event.constructor.name&&"MouseEvent"!==e.event.constructor.name&&"CustomEvent"!==e.event.constructor.name)console.warn("Event passed to ContextMenu is not of type PointerEvent"),e.event=void 0;else{if(r=e.event.pageX-10,l=e.event.pageY-10,e.title&&(l-=20),e.parentMenu){const t=e.parentMenu.root.getBoundingClientRect();r=t.left+t.width}const t=document.body.getBoundingClientRect(),n=o.getBoundingClientRect();r>t.width-n.width-10&&(r=t.width-n.width-10),l>t.height-n.height-10&&(l=t.height-n.height-10)}o.style.left=r+"px",o.style.top=l+"px"}close(t,e){this.root.parentNode&&this.root.parentNode.removeChild(this.root),this.parentMenu&&!e&&(this.parentMenu.lock=!1,this.parentMenu.currentSubmenu=void 0,void 0===t?this.parentMenu.close(t):t&&!i.LiteGUI.isCursorOverElement(t,this.parentMenu.root)&&i.LiteGUI.trigger(this.parentMenu.root,"mouseleave",t)),this.currentSubmenu&&this.currentSubmenu.close(t,!0),this.closingTimer&&clearTimeout(this.closingTimer)}getTopMenu(){return this.options.parentMenu?this.options.parentMenu.getTopMenu():this}getFirstEvent(){return this.options.parentMenu?this.options.parentMenu.getFirstEvent():this.options.event}addItem(t,e,n){var o;n=null!=n?n:{};const s=document.createElement("div");s.className="litemenu-entry submenu";let r=!1;e?"function"==typeof e?(s.innerHTML=t,s.dataset.value=t,s.onclick=e):"string"==typeof e?(s.innerHTML=e,s.dataset.value=e,s.classList.add("disabled")):e&&(s.innerHTML=null!==(o=e.title)&&void 0!==o?o:"",e.disabled&&(r=!0,s.classList.add("disabled")),(e.submenu||e.hasSubmenu)&&s.classList.add("has_submenu"),s.value=e):s.classList.add("separator"),this.root.appendChild(s);const l=t=>{const e=s.value;let o=!0;if(this.currentSubmenu&&this.currentSubmenu.close(t),n&&n.callback){n.callback.call(this,t,null!=e?e:{},this,n)&&(o=!1)}if(e){if(e.callback&&!(null==n?void 0:n.ignoreItemCallbacks)&&!0!==e.disabled){!0===e.callback.call(this,t,e,this,n)&&(o=!1)}if(e.submenu){if(!e.submenu.options)throw"ContextMenu submenu needs options";new i.LiteGUI.ContextMenu([e.submenu.options],{callback:e.submenu.options.callback,ignoreItemCallbacks:e.submenu.options.ignoreItemCallbacks,title:e.submenu.options.title,event:t,parentMenu:this,autoOpen:null==n?void 0:n.autoOpen}),o=!1}}o&&!this.lock&&this.close(t,!0)},a=t=>{const e=s.value;e&&e.hasSubmenu&&l.call(s,t)};return r||s.addEventListener("click",l.bind(s)),n&&n.autoOpen&&s.addEventListener("mouseenter",a.bind(s)),s}}},7138(t,e,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,o)}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),o(n(7507),e),o(n(3688),e),o(n(966),e),o(n(7962),e),o(n(4889),e),o(n(1736),e),o(n(3143),e),o(n(5327),e),o(n(2077),e)},7507(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LineEditor=void 0;const i=n(3252);e.LineEditor=class{constructor(t,e={}){var n,i,o,s,r,l,a,c,d,u,h,p,g;this.mouseMoveBind=this.onMouseMove.bind(this),this.mouseUpBind=this.onMouseUp.bind(this),this.options=e;const m=this.root=document.createElement("div");m.className="curve "+(null!==(n=this.options.extraClass)&&void 0!==n?n:""),m.style.minHeight="50px",m.style.width=null!==(o=null===(i=this.options.width)||void 0===i?void 0:i.toString())&&void 0!==o?o:"100%",m.bgColor=null!==(s=this.options.bgColor)&&void 0!==s?s:"#222",m.pointsColor=null!==(r=this.options.pointsColor)&&void 0!==r?r:"#5AF",m.lineColor=null!==(l=this.options.lineColor)&&void 0!==l?l:"#444",m.valuesArray=null!=t?t:[],m.xRange=null!==(a=this.options.xRange)&&void 0!==a?a:[0,1],m.yRange=null!==(c=this.options.yRange)&&void 0!==c?c:[0,1],m.defaultY=null!==(d=this.options.defaultY)&&void 0!==d?d:.5,m.noTrespassing=null!==(u=this.options.noTrespassing)&&void 0!==u&&u,m.showSamples=null!==(h=this.options.showSamples)&&void 0!==h?h:0,m.options=e,m.style.minWidth="50px",m.style.minHeight="20px";const f=this.canvas=document.createElement("canvas");f.width=null!==(p=this.options.width)&&void 0!==p?p:200,f.height=null!==(g=this.options.height)&&void 0!==g?g:50,m.appendChild(f),m.canvas=f,m.addEventListener("mousedown",this.onMouseDown.bind(this)),this.selected=-1,this.lastMousePos=[0,0],this.redraw()}getValueAt(t){if(t<this.root.xRange[0]||t>this.root.xRange[1])return this.root.defaultY;let e,n=[this.root.xRange[0],this.root.defaultY],i=0;for(let o=0;o<this.root.valuesArray.length;o++){if(e=this.root.valuesArray[o],t==e[0])return e[1];if(t<e[0])return i=(t-n[0])/(e[0]-n[0]),n[1]*(1-i)+e[1]*i;n=e}return e=[this.root.xRange[1],this.root.defaultY],i=(t-n[0])/(e[0]-n[0]),n[1]*(1-i)+e[1]*i}resample(t){const e=[],n=(this.root.xRange[1]-this.root.xRange[0])/t;for(let t=this.root.xRange[0];t<=this.root.xRange[1];t+=n){const n=this.getValueAt(t);n&&e.push(n)}return e}addValue(t){for(let e=0;e<this.root.valuesArray.length;e++){if(!(this.root.valuesArray[e][0]<t[0]))return this.root.valuesArray.splice(e,0,t),void this.redraw()}this.root.valuesArray.push(t),this.redraw()}convert(t){return[this.canvas.width*((this.root.xRange[1]-this.root.xRange[0])*t[0]+this.root.xRange[0]),this.canvas.height*((this.root.yRange[1]-this.root.yRange[0])*t[1]+this.root.yRange[0])]}deconvert(t){return[(t[0]/this.canvas.width-this.root.xRange[0])/(this.root.xRange[1]-this.root.xRange[0]),(t[1]/this.canvas.height-this.root.yRange[0])/(this.root.yRange[1]-this.root.yRange[0])]}redraw(){if(!this.canvas||!this.canvas.parentNode)return;const t=this.canvas.getBoundingClientRect();t&&this.canvas.width!=t.width&&t.width&&t.width<1e3&&(this.canvas.width=t.width),t&&this.canvas.height!=t.height&&t.height&&t.height<1e3&&(this.canvas.height=t.height);const e=this.canvas.getContext("2d");if(!e)return;e.setTransform(1,0,0,1,0,0),e.translate(0,this.canvas.height),e.scale(1,-1),e.fillStyle=this.root.bgColor,e.fillRect(0,0,this.canvas.width,this.canvas.height),e.strokeStyle=this.root.lineColor,e.beginPath();let n=this.convert([this.root.xRange[0],this.root.defaultY]);e.moveTo(n[0],n[1]);for(const t in this.root.valuesArray){const i=this.root.valuesArray[parseInt(t)];n=this.convert(i),e.lineTo(n[0],n[1])}n=this.convert([this.root.xRange[1],this.root.defaultY]),e.lineTo(n[0],n[1]),e.stroke();for(let t=0;t<this.root.valuesArray.length;t+=1){const i=this.root.valuesArray[t];n=this.convert(i),this.selected==t?e.fillStyle="white":e.fillStyle=this.root.pointsColor,e.beginPath(),e.arc(n[0],n[1],this.selected==t?4:2,0,2*Math.PI),e.fill()}if(this.root.showSamples){const t=this.resample(this.root.showSamples);e.fillStyle="#888";for(let i=0;i<t.length;i+=1){const o=[i*((this.root.xRange[1]-this.root.xRange[0])/this.root.showSamples)+this.root.xRange[0],t[i]];n=this.convert(o),e.beginPath(),e.arc(n[0],n[1],2,0,2*Math.PI),e.fill()}}}onMouseDown(t){document.addEventListener("mousemove",this.mouseMoveBind),document.addEventListener("mouseup",this.mouseUpBind);const e=this.canvas.getBoundingClientRect(),n=t.clientX-e.left,i=t.clientY-e.top;if(this.selected=this.computeSelected(n,this.canvas.height-i),-1==this.selected){const t=this.deconvert([n,this.canvas.height-i]);this.root.valuesArray.push(t),this.sortValues(),this.selected=this.root.valuesArray.indexOf(t)}this.lastMousePos=[n,i],this.redraw(),t.preventDefault(),t.stopPropagation()}onMouseMove(t){const e=this.canvas.getBoundingClientRect();let n=t.clientX-e.left,i=t.clientY-e.top;if(n<0?n=0:n>this.canvas.width&&(n=this.canvas.width),i<0?i=0:i>this.canvas.height&&(i=this.canvas.height),-1!=this.selected&&this.distance([t.clientX-e.left,t.clientY-e.top],[n,i])>.5*this.canvas.height)return this.root.valuesArray.splice(this.selected,1),void this.onMouseUp(t);const o=this.lastMousePos[0]-n,s=this.lastMousePos[1]-i,r=this.deconvert([-o,s]);if(-1!=this.selected){let t=this.root.xRange[0],e=this.root.xRange[1];this.root.noTrespassing&&(this.selected>0&&(t=this.root.valuesArray[this.selected-1][0]),this.selected<this.root.valuesArray.length-1&&(e=this.root.valuesArray[this.selected+1][0]));const n=this.root.valuesArray[this.selected];n[0]+=r[0],n[1]+=r[1],n[0]<t?n[0]=t:n[0]>e&&(n[0]=e),n[1]<this.root.yRange[0]?n[1]=this.root.yRange[0]:n[1]>this.root.yRange[1]&&(n[1]=this.root.yRange[1])}this.sortValues(),this.redraw(),this.lastMousePos[0]=n,this.lastMousePos[1]=i,this.onChange(),t.preventDefault(),t.stopPropagation()}onMouseUp(t){this.selected=-1,this.redraw(),document.removeEventListener("mousemove",this.mouseMoveBind),document.removeEventListener("mouseup",this.mouseUpBind),this.onChange(),t.preventDefault(),t.stopPropagation()}onResize(){this.redraw()}onChange(){this.options.callback?this.options.callback.call(this.root,this.root.valuesArray):(0,i.Trigger)(this.root,"change")}distance(t,e){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))}computeSelected(t,e){let n=1e5;let i=-1;for(let o=0;o<this.root.valuesArray.length;o++){const s=this.root.valuesArray[o],r=this.convert(s);if(r.length>=2){const s=this.distance([t,e],r);s<n&&s<8&&(n=s,i=o)}}return i}sortValues(){let t;-1!=this.selected&&(t=this.root.valuesArray[this.selected]),this.root.valuesArray.sort((t,e)=>t[0]-e[0]),t&&(this.selected=this.root.valuesArray.indexOf(t))}}},3688(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.List=void 0;const i=n(3252);e.List=class{constructor(t,e,n){n=n||{};const o=this.root=document.createElement("ul");o.id=t,o.className="litelist",this.callback=n.callback;const s=t=>{const e=t.target;if(!e)return;const n=o.querySelectorAll(".list-item.selected");for(let t=0;t<n.length;++t)n[t].classList.remove("selected");e.classList.add("selected"),(0,i.Trigger)(this.root,"wchanged",e),this.callback&&this.callback(e.data)};for(const t in e){const n=document.createElement("li");n.className="list-item",n.data=e[t],n.dataset.value=e[t].toString();let i="";const r=e[t];"string"==typeof r?i=r+"<span class='arrow'></span>":(i=(r.name||r.title||"")+"<span class='arrow'></span>",r.id&&(n.id=r.id)),n.innerHTML=i,n.addEventListener("click",s.bind(n)),o.appendChild(n)}n.parent&&("root"in n.parent?n.parent.root.appendChild(o):"appendChild"in n.parent&&n.parent.appendChild(o))}getSelectedItem(){return this.root.querySelector(".list-item.selected")}setSelectedItem(t){const e=this.root.querySelectorAll(".list-item");for(let n=0;n<e.length;n++){const o=e[n];if(o.data==t||"string"!=typeof o.data&&o.data.id==t){(0,i.Trigger)(o,"click");break}}}}},3143(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ListBox=void 0;e.ListBox=class{constructor(t,e){this.stopPropagation=!1;const n=document.createElement("span");this.root=n,n.parent=this,n.listBox=this,n.className="listbox "+(t?"listopen":"listclosed"),n.innerHTML=t?"&#9660;":"&#9658;",n.dataset.value=t?"open":"closed",n.onclick=function(t){n.setValue("open"!=n.dataset.value),n.parent.stopPropagation&&t.stopPropagation()},n.onchange=function(){var t;e(null!==(t=n.dataset.value)&&void 0!==t?t:"closed")},n.setEmpty=function(t){t?this.classList.add("empty"):this.classList.remove("empty")},n.setValue=function(t){this.dataset.value!=(t?"open":"closed")&&(t?(this.dataset.value="open",this.innerHTML="&#9660;",this.classList.add("listopen"),this.classList.remove("listclosed")):(this.dataset.value="closed",this.innerHTML="&#9658;",this.classList.remove("listopen"),this.classList.add("listclosed")),e&&e(this.dataset.value))},n.expand=function(){this.setValue(!0)},n.collapse=function(){this.setValue(!1)}}setValue(t){this.root.setValue(t)}getValue(){return this.root.dataset.value}}},5327(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SearchBox=void 0;e.SearchBox=class{constructor(t="",e={}){var n;this.options=e,this.value=t;const i=document.createElement("div");i.className="litegui searchbox";const o=null!==(n=e.placeholder)&&void 0!==n?n:"Search";i.innerHTML=`<input value='${t}' placeholder='${o}'/>`,this.input=i.querySelector("input"),this.root=i,this.input.onchange=()=>{const t=this.input.value;e.callback&&e.callback(t)}}setValue(t){this.input.value=t,this.input.onchange&&this.input.onchange(new Event("change"))}getValue(){return this.input.value}}},2077(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Slider=void 0;const i=n(3252);e.Slider=class{constructor(t,e){this.mouseMoveBind=this.onMouseMove.bind(this),this.mouseUpBind=this.onMouseUp.bind(this),this.options=null!=e?e:{};const n=this.root=document.createElement("div");this.value=t,n.className="liteslider",this.docBinded=n.ownerDocument,this.root.addEventListener("mousedown",this.onMouseDown.bind(this)),this.setValue(t)}setFromX(t){var e,n;const i=this.root.getBoundingClientRect();if(!i)return;const o=t/i.width,s=null!==(e=this.options.min)&&void 0!==e?e:0,r=(null!==(n=this.options.max)&&void 0!==n?n:1)-s;this.setValue(r*o+s)}onMouseDown(t){let e;t.offsetX?e=t.offsetX:t.layerX&&(e=t.layerX),this.setFromX(e),this.docBinded&&(this.root.addEventListener("mousemove",this.mouseMoveBind,!1),this.root.addEventListener("mouseup",this.mouseUpBind,!1),t.preventDefault(),t.stopPropagation())}onMouseMove(t){const e=this.root.getBoundingClientRect();if(!e)return;const n=(void 0===t.x?t.pageX:t.x)-e.left;return this.setFromX(n),"function"==typeof t.preventDefault&&t.preventDefault(),!1}onMouseUp(t){return!!this.docBinded&&(this.root.removeEventListener("mousemove",this.mouseMoveBind,!1),this.root.removeEventListener("mouseup",this.mouseUpBind,!1),"function"==typeof t.preventDefault&&t.preventDefault(),!1)}setValue(t,e=!1){const n=this.options.min||0,o=this.options.max||1;t<n?t=n:t>o&&(t=o);const s=(100*((t-n)/(o-n))).toFixed(1)+"%",r="calc("+s+" + 2px)";this.root.style.background="linear-gradient(to right, #999 "+s+", #FC0 "+s+", #FC0 "+r+", #333 "+r+")",t!=this.value&&(this.value=t,e||((0,i.Trigger)(this.root,"change",t),this.onChange&&this.onChange(t)))}}},796(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Tree=void 0;const i=n(3252),o=n(7138);class s{constructor(t,e){this._skipScroll=!1,e=null!=e?e:{};const n=document.createElement("div");this.root=n,e.id&&(n.id=e.id),n.className="litetree",this.tree=t,e=null!=e?e:{allowRename:!1,allowDrag:!0,allowMultiSelection:!1},this.options=e,this.indentOffset=e.indentOffset||0,e.height&&(this.root.style.height="string"==typeof e.height?e.height:Math.round(e.height)+"px"),this.collapsedDepth=3,null!=e.collapsed_depth&&(this.collapsedDepth=e.collapsed_depth),n.addEventListener("click",t=>{t.target==this.root&&this.onBackgroundClicked&&this.onBackgroundClicked(t,this)}),n.addEventListener("contextmenu",t=>(2!=t.button||(this.onContextMenu&&this.onContextMenu(t),t.preventDefault()),!1));const i=this.createAndInsert(t,e);if(!i)throw"Error in LiteGUI.Tree, createAndInsert returned null";i.className+=" root_item",this.rootItem=i}updateTree(t){this.root.innerHTML="";const e=this.createAndInsert(t,this.options);e?(e.className+=" root_item",this.rootItem=e):this.rootItem=void 0}insertItem(t,e,n,i={}){if(!e){const t=this.root.childNodes[0];t&&(e=t.dataset.itemID)}const o=this.createAndInsert(t,i,e,n);if(e){const t=this._findElement(e);t&&this._updateListBox(t)}return o}createAndInsert(t,e,n,i){var o;let s,r=-1;"string"==typeof n&&(r=this._findElementIndex(n));let l=0;-1!=r&&(s=this.root.childNodes[r],l=parseInt(null!==(o=s.dataset.level)&&void 0!==o?o:"0")+1);const a=this.createTreeItem(t,e,l.toString());if(!a)return;a.parentId=null!=n?n:"0";if(this.getItem(a.dataset.itemID)&&console.warn("There another item with the same ID in this tree"),-1==r?this.root.appendChild(a):this._insertInside(a,r,i),s&&n&&!this._isNodeChildrenVisible(n)&&a.classList.add("hidden"),"children"in t&&Array.isArray(t.children))for(const n of t.children)"id"in n&&this.createAndInsert(n,e,a.dataset.itemID);return this._updateListBox(a,e,l),e&&e.selected&&this._markAsSelected(a,!0),a}_insertInside(t,e,n,i){var o,r;const l=this.root.childNodes[e];if(!l)throw`No parent node found, index: ${e}, nodes: ${this.root.childNodes.length}`;const a=parseInt(null!==(o=l.dataset.level)&&void 0!==o?o:"0"),c=void 0!==i?i:a+1,d=t.querySelector(".indentblock");d&&(d.style.paddingLeft=(c+this.indentOffset)*s.INDENT+"px"),t.dataset.level=c.toString();const u=Array.from(t.classList);for(const e of u)e.startsWith("ltree-level-")&&t.classList.remove(e);t.classList.add("ltree-level-"+c);for(let i=e+1;i<this.root.childNodes.length;++i){const e=this.root.childNodes[i];if(!e.classList||!e.classList.contains("ltreeitem"))continue;const o=parseInt(null!==(r=e.dataset.level)&&void 0!==r?r:"");if(o==c&&n)n--;else if(o<c||0===n&&o===c)return void this.root.insertBefore(t,e)}this.root.appendChild(t)}createTreeItem(t,e,n){if(!t)return void console.error("Tree item cannot be null");const o=t instanceof HTMLElement;e=null!=e?e:this.options;const s=document.createElement("li");if(s.className="ltreeitem","id"in t&&"string"==typeof t.id){const e=t.id.replace(/\s/g,"_");s.className+=` ltreeitem-${e}`,s.dataset.itemID=t.id}if("dataset"in t&&"object"==typeof t.dataset)for(const e in t.dataset){const n=t.dataset;"string"==typeof n[e]&&(s.dataset[e]=n[e])}o&&t.data?s.data=t.data:s.data=t,void 0!==n&&(s.dataset.level=n,s.classList.add("ltree-level-"+n));const r=document.createElement("div");r.className="ltreeitemtitle","className"in t&&"string"==typeof t.className&&(r.className+=` ${t.className}`),r.innerHTML="<span class='precontent'></span><span class='indentblock'></span><span class='collapsebox'></span><span class='incontent'></span><span class='postcontent'></span>";const l="content"in t?t.content:"id"in t?t.id:"",a=r.querySelector(".incontent");if(a&&(a.innerHTML=l),"preContent"in t&&"string"==typeof t.preContent){const e=r.querySelector(".precontent");e&&(e.innerHTML=t.preContent)}if("postContent"in t&&"string"==typeof t.postContent){const e=r.querySelector(".postcontent");e&&(e.innerHTML=t.postContent)}s.appendChild(r),s.titleElement=r,"visible"in t&&!1===t.visible&&(s.style.display="none");const c=s;c.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation();const n=c,s=n.titleElement;if(!(null==s?void 0:s.isEditing)){if(e.ctrlKey&&this.options.allowMultiSelection){if(this._isNodeSelected(n))return n.classList.remove("selected"),void(0,i.Trigger)(this.root,"item_remove_from_selection",{item:n,data:n.data});this._markAsSelected(n,!0),(0,i.Trigger)(this.root,"item_add_to_selection",{item:n,data:n.data});let e=!1;o&&t.callback&&(e=t.callback.call(this,n)),!e&&this.onItemAddToSelection&&this.onItemAddToSelection(n.data,n)}if(e.shiftKey&&this.options.allowMultiSelection){const t=this.getSelectedItem();if(!t)return;if(t===n)return;const e=Array.prototype.slice.call(t.parentNode.children),o=e.indexOf(t),s=e.indexOf(n),r=s>o?e.slice(o,s):e.slice(s,o);for(let t=0;t<r.length;++t){const e=r[t];this._markAsSelected(e,!0),(0,i.Trigger)(this.root,"item_add_to_selection",{item:e,data:e.data})}}else{this._markAsSelected(n),this._skipScroll=!0,(0,i.Trigger)(this.root,"item_selected",{item:n,data:n.data});let e=!1;o&&t.callback&&(e=t.callback.call(this,n)),!e&&this.onItemSelected&&this.onItemSelected(n.data,n),this._skipScroll=!1}}}).bind(c)),c.addEventListener("dblclick",(t=>{const e=c,n=e.titleElement.querySelector(".incontent");if((0,i.Trigger)(this.root,"item_dblclicked",e),!n.isEditing&&this.options.allowRename){n.isEditing=!0,n.oldName=n.innerHTML;const o=n;n.innerHTML=`<input type='text' value='${n.innerHTML}' />`;const s=n.querySelector("input");s&&(s.addEventListener("blur",t=>{var n;const s=null==t?void 0:t.target,r=s&&null!==(n=s.value)&&void 0!==n?n:"";setTimeout(()=>{o.innerHTML=r},1),delete o.isEditing,(0,i.Trigger)(this.root,"item_renamed",{oldName:o.oldName,newName:r,item:e,data:e.data}),delete o.oldName}),s.addEventListener("keydown",t=>{"Enter"==t.key&&s.blur()}),s.focus()),t.preventDefault()}t.preventDefault(),t.stopPropagation()}).bind(c));c.addEventListener("contextmenu",t=>{const e=c;if(t.preventDefault(),t.stopPropagation(),2==t.button)return!!this.onItemContextMenu&&this.onItemContextMenu(t,{item:e,data:e.data})});const d=r;this.options.allowDrag&&(d.draggable=!0,d.addEventListener("dragstart",e=>{var n,i,o;if(null===(n=e.dataTransfer)||void 0===n||n.setData("itemID",d.parentNode&&"dataset"in d.parentNode&&d.parentNode.dataset&&null!==(i=d.parentNode.dataset.itemID)&&void 0!==i?i:""),t.onDragData){const n=t.onDragData();if(n)for(const t in n)null===(o=e.dataTransfer)||void 0===o||o.setData(t,n[t])}}));let u=0;return d.addEventListener("dragenter",e=>{if(e.preventDefault(),"skipDrag"in t&&t.skipDrag)return!1;0==u&&r.classList.add("dragover"),u++}),d.addEventListener("dragleave",t=>{t.preventDefault(),u--,0==u&&r.classList.remove("dragover")}),d.addEventListener("dragover",function(t){t.preventDefault()}),d.addEventListener("drop",e=>{var n;const o=e.target;if(d.classList.remove("dragover"),e.preventDefault(),u=0,"skipDrag"in t&&t.skipDrag)return!1;const s=null===(n=e.dataTransfer)||void 0===n?void 0:n.getData("itemID"),r=o.closest("li");if(!s)return(0,i.Trigger)(this.root,"drop_on_item",{item:o,event:e}),void(this.onDropItem&&r&&this.onDropItem(e,r.data));if(!r||!("dataset"in r))return;const l=r.dataset.itemID;l&&(!this.onMoveItem||this.onMoveItem&&0!=this.onMoveItem(this.getItem(s),this.getItem(l)))&&this.moveItem(s,l)&&(0,i.Trigger)(this.root,"item_moved",{item:this.getItem(s),parent_item:this.getItem(l)}),this.onDropItem&&this.onDropItem(e,r.data)}),s}filterByName(t){var e;for(let n=0;n<this.root.childNodes.length;++n){const i=this.root.childNodes[n];if(!i.classList||!i.classList.contains("ltreeitem"))continue;const o=i.querySelector(".incontent");if(!o)continue;const r=o.innerHTML.toLowerCase();if(t&&-1==r.indexOf(t.toLowerCase()))i.classList.add("filtered");else{i.data&&i.data.visible&&i.classList.remove("filtered");const n=i.querySelector(".indentblock");n&&(n.style.paddingLeft=t?"0px":(parseInt(null!==(e=i.dataset.level)&&void 0!==e?e:"")+this.indentOffset)*s.INDENT+"px")}}}filterByRule(t,e){var n;if(!t)throw"filterByRule requires a callback";for(let i=0;i<this.root.childNodes.length;++i){const o=this.root.childNodes[i];if(!o.classList||!o.classList.contains("ltreeitem"))continue;const r=o.querySelector(".incontent");if(r)if(t(o.data,r,e)){o.data&&!1!==o.data.visible&&o.classList.remove("filtered");const t=o.querySelector(".indentblock");t&&(t.style.paddingLeft=e?"0px":(parseInt(null!==(n=o.dataset.level)&&void 0!==n?n:"")+this.indentOffset)*s.INDENT+"px")}else o.classList.add("filtered")}}getItem(t){if(t){if("string"!=typeof t&&t.classList)return t;for(let e=0;e<this.root.childNodes.length;++e){const n=this.root.childNodes[e];if(n.classList&&n.classList.contains("ltreeitem")&&n.dataset.itemID===t)return n}}}expandItem(t,e){const n=this.getItem(t);if(!n)return;if("string"==typeof n)return;if(!n.listBox)return;if(n.listBox.setValue(!0),!e)return;const i=this.getParent(n);i&&this.expandItem(i,e)}collapseItem(t){const e=this.getItem(t);e&&e.listBox&&e.listBox.setValue(!1)}isInsideArea(t){const e="string"==typeof t?this.getItem(t):t;if(!e)return!1;const n=this.root.getClientRects();if(!n.length)return!1;const i=n[0].height,o=e.offsetTop;return this.root.scrollTop<o&&o<this.root.scrollTop+i}scrollToItem(t){var e;if(!(t="string"==typeof t?this.getItem(t):t))return;const n=this.root.parentNode;if(!n)return;const i=n.getBoundingClientRect(),o=i.height;if(!i)return;const r=(parseInt(null!==(e=t.dataset.level)&&void 0!==e?e:"0")+this.indentOffset)*s.INDENT+50;n.scrollTop=t.offsetTop-.5*o|0,.75*i.width<r?n.scrollLeft=r:n.scrollLeft=0}setSelectedItem(t,e,n){if(!t)return void this._unmarkAllAsSelected();const o=this.getItem(t);return o?o.classList.contains("selected")?void 0:(this._markAsSelected(o),e&&!this._skipScroll&&this.scrollToItem(o),this.expandItem(o,!0),n&&(0,i.Trigger)(o,"click"),o):null}addItemToSelection(t){if(!t)return;const e=this.getItem(t);return e?(this._markAsSelected(e,!0),e):null}removeItemFromSelection(t){if(!t)return;const e=this.getItem(t);if(!e)return null;e.classList.remove("selected")}getSelectedItem(){return this.root.querySelector(".ltreeitem.selected")}getSelectedItems(){return this.root.querySelectorAll(".ltreeitem.selected")}isItemSelected(t){const e=this.getItem(t);return!!e&&this._isNodeSelected(e)}getChildren(t,e=!1){return"string"!=typeof t&&(t=t.dataset.itemID),this._findChildElements(t,e)}getParent(t){const e=this.getItem(t);if(e)return this.getItem(e.parentId)}getAncestors(t,e){e=null!=e?e:[];const n=this.getItem(t);return n?(e.push(n),this.getAncestors(n.parentId,e)):e}isAncestor(t,e){const n=this.getItem(t);if(!n)return!1;const i=this.getItem(e),o=this.getItem(n.parentId);return!!o&&(o==i||this.isAncestor(o,e))}moveItem(t,e){var n,i,o,s;if(t===e)return!1;const r=this.getItem(t),l=this.getItem(e);if(!l||!r)return!1;if(this.isAncestor(l,r))return!1;const a=parseInt(null!==(n=l.dataset.level)&&void 0!==n?n:"0"),c=this.getParent(r);if(!c)return console.error("node parent not found by id, maybe id has changed"),!1;const d=a-parseInt(null!==(i=c.dataset.level)&&void 0!==i?i:"0");if(l==c)return!1;r.parentId=e;const u=this.getChildren(r);if(u){u.unshift(r);for(let t=0;t<u.length;t++)u[t].parentNode.removeChild(u[t]);for(let t=0;t<u.length;t++){const e=u[t],n=parseInt(null!==(o=e.dataset.level)&&void 0!==o?o:"0")+d;e.dataset.level=n.toString()}for(let t=0;t<u.length;t++){const e=u[t];let n=-1;n=e===r?this._findElementIndex(l):this._findElementIndex(e.parentId),-1!==n?this._insertInside(e,n,999999,parseInt(null!==(s=e.dataset.level)&&void 0!==s?s:"0")):console.error("Parent not found for reinsertion",e)}}return this._updateListBox(l),c&&this._updateListBox(c),!0}removeItem(t,e){let n=t;if("string"==typeof t&&(n=this.getItem(t)),!n)return!1;const i=this.getParent(n);let o=null;if(e&&(o=this.getChildren(n)),this.root.removeChild(n),o)for(let t=0;t<o.length;t++)this.root.removeChild(o[t]);return i&&this._updateListBox(i),!0}updateItem(t,e){var n;const i=this.getItem(t);if(!i)return!1;const o=e instanceof HTMLElement;if(i.data=o?i.data:e,o&&e.id&&(i.id=e.id),o&&e.content){const t=null===(n=i.titleElement)||void 0===n?void 0:n.querySelector(".incontent");t&&(t.innerHTML=e.content)}return!0}updateItemId(t,e){const n=this.getItem(t);if(!n)return!1;const i=this.getChildren(t,!0);if(n.id=e,!i)return!1;for(let t=0;t<i.length;++t){i[t].parentId=e}return!0}clear(t){if(!t)return void(this.root.innerHTML="");const e=this.root.querySelectorAll(".ltreeitem");for(let t=1;t<e.length;t++){const n=e[t];this.root.removeChild(n)}}getNodeByIndex(t){return this.root.querySelectorAll(".ltreeitem")[t]}_isNodeChildrenVisible(t){var e;const n=this.getItem(t);if(!n)return!1;if(n.classList.contains("hidden"))return!1;const i=n.querySelector(".listbox");return!i||"closed"!=(null===(e=i.listBox)||void 0===e?void 0:e.getValue())}_findElement(t){if(!t||"string"!=typeof t)throw"findElement param must be string with item id";for(let e=0;e<this.root.childNodes.length;++e){const n=this.root.childNodes[e];if(n.classList&&n.classList.contains("ltreeitem")&&n.classList.contains("ltreeitem-"+t))return n}}_findElementIndex(t){for(let e=0;e<this.root.childNodes.length;++e){const n=this.root.childNodes[e];if(n.classList&&n.classList.contains("ltreeitem"))if("string"==typeof t){if(n.dataset.itemID===t)return e}else if(n===t)return e}return-1}_findElementLastChildIndex(t){var e,n;if(-1==t)return-1;const i=parseInt(null!==(e=this.root.childNodes[t].dataset.level)&&void 0!==e?e:"0");for(let e=t+1;e<this.root.childNodes.length;++e){const t=this.root.childNodes[e];if(!t.classList||!t.classList.contains("ltreeitem"))continue;if(parseInt(null!==(n=t.dataset.level)&&void 0!==n?n:"0")==i)return e}return-1}_findChildElements(t,e){var n,i;const o=this._findElementIndex(t);if(-1==o)return;const s=this.root.childNodes[o],r=parseInt(null!==(n=s.dataset.level)&&void 0!==n?n:"0"),l=[];for(let t=o+1;t<this.root.childNodes.length;++t){const n=this.root.childNodes[t];if(!n.classList||!n.classList.contains("ltreeitem"))continue;const o=parseInt(null!==(i=n.dataset.level)&&void 0!==i?i:"0");if(!(e&&o>r+1)){if(o<=r)return l;l.push(n)}}return l}_unmarkAllAsSelected(){this.root.classList.remove("selected");const t=this.root.querySelectorAll(".ltreeitem.selected");if(t)for(let e=0;e<t.length;e++)t[e].classList.remove("selected");const e=this.root.querySelectorAll(".ltreeitem.semiselected");for(let t=0;t<e.length;t++)e[t].classList.remove("semiselected")}_isNodeSelected(t){return!!t.classList.contains("selected")}_markAsSelected(t,e=!1){if(t.classList.contains("selected"))return;e||this._unmarkAllAsSelected(),t.classList.add("selected");let n=this.getParent(t);const i=[];for(;n&&-1==i.indexOf(n);)n.classList.add("semiselected"),i.push(n),n=this.getParent(n)}_updateListBox(t,e,n=0){var s,r,l,a,c;if(!t)return;if(!t.listBox){const e=null===(s=t.titleElement)||void 0===s?void 0:s.querySelector(".collapsebox");if(!e)return;const n=new o.ListBox(!0,e=>{this._onClickBox(t),(0,i.Trigger)(this.root,"item_collapse_change",{item:t,data:e})}),r=n.root;r&&(n.stopPropagation=!0,r.setEmpty(!0),e.appendChild(r),t.listBox=r)}(e&&e.collapsed||n>=this.collapsedDepth)&&(null===(r=t.listBox)||void 0===r||r.collapse());const d=this.getChildren(null!==(l=t.dataset.itemID)&&void 0!==l?l:"");d&&(d.length?null===(a=t.listBox)||void 0===a||a.setEmpty(!1):null===(c=t.listBox)||void 0===c||c.setEmpty(!0))}_onClickBox(t){const e=this.getChildren(t);if(e)for(let t=0;t<e.length;++t){const n=e[t],i=this.getParent(n);let o=!0;i&&(o=this._isNodeChildrenVisible(i)),o?n.classList.remove("hidden"):n.classList.add("hidden")}}}e.Tree=s,s.INDENT=20}},e={};var n=function n(i){var o=e[i];if(void 0!==o)return o.exports;var s=e[i]={exports:{}};return t[i].call(s.exports,s,s.exports,n),s.exports}(1969);LiteGUI=n.LiteGUI})();