vizor_2d 1.3.3 → 1.3.5

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.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see vizor_2d.min.js.LICENSE.txt */
2
- var t,e,i={5870:(t,e,i)=>{i.d(e,{A:()=>f});var n=i(1601),r=i.n(n),s=i(6314),o=i.n(s),a=i(4417),l=i.n(a),h=new URL(i(4002),i.b),c=new URL(i(2653),i.b),u=o()(r()),d=l()(h),p=l()(c);u.push([t.id,`.choices{position:relative;overflow:hidden;margin-bottom:var(--choices-guttering, 24px);font-size:var(--choices-font-size-lg, 16px)}.choices:focus{outline:0}.choices:last-child{margin-bottom:0}.choices.is-open{overflow:visible}.choices.is-disabled :is(.choices__inner,.choices__input){background-color:var(--choices-bg-color-disabled, #eaeaea);cursor:not-allowed!important;-webkit-user-select:none;user-select:none}.choices.is-disabled .choices__item{cursor:not-allowed;color:var(--choices-item-disabled-color, #fff)}.choices [hidden]{position:absolute;inset:0;pointer-events:none;opacity:0}.choices[data-type*=select-one]{cursor:pointer}.choices[data-type*=select-one] .choices__inner{padding-bottom:var(--choices-inner-one-padding, 7.5px)}.choices[data-type*=select-one] .choices__input{display:block;width:var(--choices-width, 100%);padding:var(--choices-dropdown-item-padding, 10px);border-bottom:var(--choices-base-border, 1px solid) var(--choices-keyline-color, #ddd);background-color:var(--choices-bg-color-dropdown, #fff);margin:0}.choices[data-type*=select-one] .choices__button{background-image:var(--choices-icon-cross-inverse, url(${d}));padding:0;background-size:8px;position:absolute;top:50%;right:0;margin-top:-10px;margin-right:25px;height:20px;width:20px;border-radius:10em;opacity:.25}.choices[data-type*=select-one] .choices__button:is(:hover,:focus){opacity:var(--choices-button-opacity-hover, 1)}.choices[data-type*=select-one] .choices__button:focus{box-shadow:0 0 0 2px var(--choices-highlight-color, #005F75)}.choices[data-type*=select-one] .choices__item[data-placeholder] .choices__button{display:none}.choices[data-type*=select-one]::after{content:"";height:0;width:0;border-style:solid;border-color:var(--choices-text-color, #333) transparent transparent transparent;border-width:var(--choices-arrow-size, 5px);position:absolute;right:var(--choices-arrow-right, 11.5px);top:50%;margin-top:var(--choices-arrow-margin-top, -2.5px);pointer-events:none}.choices[data-type*=select-one].is-open::after{border-color:transparent transparent var(--choices-text-color, #333);margin-top:var(--choices-arrow-margin-top-open, -7.5px)}.choices[data-type*=select-one][dir=rtl]::after{left:11.5px;right:auto}.choices[data-type*=select-one][dir=rtl] .choices__button{right:auto;left:0;margin-left:25px;margin-right:0}.choices:is([data-type*=select-multiple],[data-type*=text]) .choices__inner{cursor:text}.choices:is([data-type*=select-multiple],[data-type*=text]) .choices__button{position:relative;display:inline-block;margin:0 calc(var(--choices-button-offset, 8px)*-.5)0 var(--choices-button-offset, 8px);padding-left:calc(var(--choices-button-offset, 8px)*2);border-left:1px solid color-mix(in srgb,var(--choices-primary-color, #005F75) 90%,var(--choices-darken, black));background-image:var(--choices-icon-cross, url(${p}));background-size:var(--choices-button-dimension, 8px);width:var(--choices-button-dimension, 8px);line-height:var(--choices-button-line-height, 1);border-radius:var(--choices-button-border-radius, 0);opacity:var(--choices-button-opacity, 0.75)}.choices:is([data-type*=select-multiple],[data-type*=text]) .choices__button:is(:hover,:focus){--choices-button-opacity:var(--choices-button-opacity-hover, 1)}.choices__inner{display:inline-block;vertical-align:top;width:var(--choices-width, 100%);background-color:var(--choices-bg-color, #f9f9f9);padding:var(--choices-inner-padding, 7.5px 7.5px 3.75px);border:var(--choices-base-border, 1px solid) var(--choices-keyline-color, #ddd);border-radius:var(--choices-border-radius, 2.5px);font-size:var(--choices-font-size-md, 14px);min-height:var(--choices-input-height, 44px);overflow:hidden}.is-focused .choices__inner,.is-open .choices__inner{border-color:color-mix(in srgb,var(--choices-keyline-color, #ddd) 85%,var(--choices-darken, black))}.is-open .choices__inner{border-radius:var(--choices-border-radius, 2.5px) var(--choices-border-radius, 2.5px)0 0}.is-invalid .choices__inner{border-color:var(--choices-invalid-color, #d33141)}.is-flipped.is-open .choices__inner{border-radius:0 0 var(--choices-border-radius, 2.5px) var(--choices-border-radius, 2.5px)}.choices__list{margin:0;padding-left:0;list-style:none}.choices__list--single{display:inline-block;padding:var(--choices-list-single-padding, 4px 16px 4px 4px)}[dir=rtl] .choices__list--single{padding-right:4px;padding-left:16px}.choices__list--single,.choices__list--single .choices__item{width:var(--choices-width, 100%)}.choices__list--multiple{display:inline}.choices__list--multiple .choices__item{display:inline-block;vertical-align:middle;border-radius:var(--choices-border-radius-item, 20px);padding:var(--choices-multiple-item-padding, 4px 10px);font-size:var(--choices-font-size-sm, 12px);font-weight:500;margin-right:var(--choices-multiple-item-margin, 3.75px);margin-bottom:var(--choices-multiple-item-margin, 3.75px);background-color:var(--choices-primary-color, #005F75);border:1px solid color-mix(in srgb,var(--choices-primary-color, #005F75) 95%,var(--choices-darken, black));color:var(--choices-item-color, #fff);word-break:break-all;box-sizing:border-box}.choices__list--multiple .choices__item[data-deletable]{padding-right:5px}[dir=rtl] .choices__list--multiple .choices__item{margin-right:0;margin-left:var(--choices-multiple-item-margin, 3.75px)}.choices__list--multiple .choices__item.is-highlighted{background-color:color-mix(in srgb,var(--choices-primary-color, #005F75) 95%,var(--choices-darken, black));border:1px solid color-mix(in srgb,var(--choices-primary-color, #005F75) 90%,var(--choices-darken, black))}.is-disabled .choices__list--multiple .choices__item{background-color:color-mix(in srgb,var(--choices-disabled-color, #eaeaea) 75%,var(--choices-darken, black));border:1px solid color-mix(in srgb,var(--choices-disabled-color, #eaeaea) 65%,var(--choices-darken, black))}.choices__list--dropdown,.choices__list[aria-expanded]{display:none;z-index:var(--choices-z-index, 1);position:absolute;width:var(--choices-width, 100%);background-color:var(--choices-bg-color-dropdown, #fff);border:var(--choices-base-border, 1px solid) var(--choices-keyline-color, #ddd);top:100%;margin-top:-1px;border-bottom-left-radius:var(--choices-border-radius, 2.5px);border-bottom-right-radius:var(--choices-border-radius, 2.5px);overflow:hidden;word-break:break-all}.is-active.choices__list--dropdown,.is-active.choices__list[aria-expanded]{display:block}.is-open .choices__list--dropdown,.is-open .choices__list[aria-expanded]{border-color:color-mix(in srgb,var(--choices-keyline-color, #ddd) 85%,var(--choices-darken, black))}.is-flipped .choices__list--dropdown,.is-flipped .choices__list[aria-expanded]{top:auto;bottom:100%;margin-top:0;margin-bottom:-1px;border-radius:.25rem .25rem 0 0}.choices__list--dropdown .choices__list,.choices__list[aria-expanded] .choices__list{position:relative;max-height:300px;overflow:auto;-webkit-overflow-scrolling:touch;will-change:scroll-position}.choices__list--dropdown .choices__item,.choices__list[aria-expanded] .choices__item{position:relative;padding:var(--choices-dropdown-item-padding, 10px);font-size:var(--choices-font-size-md, 14px)}[dir=rtl] .choices__list--dropdown .choices__item,[dir=rtl] .choices__list[aria-expanded] .choices__item{text-align:right}@media (min-width:640px){.choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text],.choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]{padding-right:100px}.choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text]::after,.choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]::after{content:attr(data-select-text);font-size:var(--choices-font-size-sm, 12px);position:absolute;right:10px;top:50%;transform:translateY(-50%)}[dir=rtl] .choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text],[dir=rtl] .choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]{text-align:right;padding-left:100px;padding-right:10px}[dir=rtl] .choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text]::after,[dir=rtl] .choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]::after{right:auto;left:10px}}.choices__list--dropdown .choices__item--selectable.is-selected::after,.choices__list[aria-expanded] .choices__item--selectable.is-selected::after{content:none!important}.choices__list--dropdown .choices__item--selectable.is-highlighted,.choices__list--dropdown .choices__item--selectable.is-selected,.choices__list[aria-expanded] .choices__item--selectable.is-highlighted,.choices__list[aria-expanded] .choices__item--selectable.is-selected{background-color:var(--choices-highlighted-color, #f2f2f2)}.choices__item{cursor:default}.choices__item--selectable{cursor:pointer}.choices__item--disabled{cursor:not-allowed;-webkit-user-select:none;user-select:none;opacity:.5}.choices__heading{font-weight:600;font-size:12px;padding:10px;border-bottom:1px solid color-mix(in srgb,var(--choices-keyline-color, #ddd) 90%,var(--choices-lighten, white));color:gray}.choices__button{text-indent:-9999px;appearance:none;border:0;background-color:transparent;background-repeat:no-repeat;background-position:center;cursor:pointer}.choices__button:focus,.choices__input:focus{outline:0}.choices__input{display:inline-block;vertical-align:baseline;background-color:var(--choices-bg-color, #f9f9f9);font-size:var(--choices-font-size-md, 14px);margin-bottom:var(--choices-input-margin-bottom, 5px);border:0;border-radius:0;max-width:var(--choices-width, 100%);padding:var(--choices-input-padding, 4px 0 4px 2px)}.choices__input::-webkit-search-cancel-button,.choices__input::-webkit-search-decoration,.choices__input::-webkit-search-results-button,.choices__input::-webkit-search-results-decoration{display:none}.choices__input::-ms-clear,.choices__input::-ms-reveal{display:none;width:0;height:0}[dir=rtl] .choices__input{padding-right:2px;padding-left:0}.choices__placeholder{opacity:var(--choices-placeholder-opacity, 0.5)}`,""]);const f=u},6314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i="",n=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),n&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),n&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i})).join("")},e.i=function(t,i,n,r,s){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(n)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var h=0;h<t.length;h++){var c=[].concat(t[h]);n&&o[c[0]]||(void 0!==s&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=s),i&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=i):c[2]=i),r&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=r):c[4]="".concat(r)),e.push(c))}},e}},4417:t=>{t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},1601:t=>{t.exports=function(t){return t[1]}},8133:t=>{t.exports=function(t){var r=[];return t.replace(i,(function(t,i,s){var o=i.toLowerCase();for(s=function(t){var e=t.match(n);return e?e.map(Number):[]}(s),"m"==o&&s.length>2&&(r.push([i].concat(s.splice(0,2))),o="l",i="m"==i?"l":"L");;){if(s.length==e[o])return s.unshift(i),r.push(s);if(s.length<e[o])throw new Error("malformed path data");r.push([i].concat(s.splice(0,e[o])))}})),r};var e={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=/([astvzqmhlc])([^astvzqmhlc]*)/gi;var n=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi},5585:t=>{var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||t,o),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,s=n.length,o=new Array(s);r<s;r++)o[r]=n[r].fn;return o},a.prototype.listenerCount=function(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,r,s,o){var a=i?i+t:t;if(!this._events[a])return!1;var l,h,c=this._events[a],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,r),!0;case 5:return c.fn.call(c.context,e,n,r,s),!0;case 6:return c.fn.call(c.context,e,n,r,s,o),!0}for(h=1,l=new Array(u-1);h<u;h++)l[h-1]=arguments[h];c.fn.apply(c.context,l)}else{var d,p=c.length;for(h=0;h<p;h++)switch(c[h].once&&this.removeListener(t,c[h].fn,void 0,!0),u){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,e);break;case 3:c[h].fn.call(c[h].context,e,n);break;case 4:c[h].fn.call(c[h].context,e,n,r);break;default:if(!l)for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];c[h].fn.apply(c[h].context,l)}}return!0},a.prototype.on=function(t,e,i){return s(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return s(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,n,r){var s=i?i+t:t;if(!this._events[s])return this;if(!e)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==e||r&&!a.once||n&&a.context!==n||o(this,s);else{for(var l=0,h=[],c=a.length;l<c;l++)(a[l].fn!==e||r&&!a[l].once||n&&a[l].context!==n)&&h.push(a[l]);h.length?this._events[s]=1===h.length?h[0]:h:o(this,s)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&o(this,e)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,t.exports=a},5072:t=>{var e=[];function i(t){for(var i=-1,n=0;n<e.length;n++)if(e[n].identifier===t){i=n;break}return i}function n(t,n){for(var s={},o=[],a=0;a<t.length;a++){var l=t[a],h=n.base?l[0]+n.base:l[0],c=s[h]||0,u="".concat(h," ").concat(c);s[h]=c+1;var d=i(u),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(p);else{var f=r(p,n);n.byIndex=a,e.splice(a,0,{identifier:u,updater:f,references:1})}o.push(u)}return o}function r(t,e){var i=e.domAPI(e);i.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;i.update(t=e)}else i.remove()}}t.exports=function(t,r){var s=n(t=t||[],r=r||{});return function(t){t=t||[];for(var o=0;o<s.length;o++){var a=i(s[o]);e[a].references--}for(var l=n(t,r),h=0;h<s.length;h++){var c=i(s[h]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}s=l}}},7659:t=>{var e={};t.exports=function(t,i){var n=function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},540:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},5056:(t,e,i)=>{t.exports=function(t){var e=i.nc;e&&t.setAttribute("nonce",e)}},7825:t=>{t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(i){!function(t,e,i){var n="";i.supports&&(n+="@supports (".concat(i.supports,") {")),i.media&&(n+="@media ".concat(i.media," {"));var r=void 0!==i.layer;r&&(n+="@layer".concat(i.layer.length>0?" ".concat(i.layer):""," {")),n+=i.css,r&&(n+="}"),i.media&&(n+="}"),i.supports&&(n+="}");var s=i.sourceMap;s&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleTagTransform(n,t,e.options)}(e,t,i)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},1113:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},4002:t=>{t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg=="},2653:t=>{t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg=="},2406:(t,e,i)=>{i.d(e,{z:()=>n});const n=(t,e,i=!1)=>(Array.isArray(t)||(t=[t]),e?t.map((t=>"string"==typeof t||i?e(t):t)):t)},2577:(t,e,i)=>{i.d(e,{Q:()=>O});var n={grad:.9,turn:360,rad:360/(2*Math.PI)},r=function(t){return"string"==typeof t?t.length>0:"number"==typeof t},s=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=Math.pow(10,e)),Math.round(i*t)/i+0},o=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=1),t>i?i:t>e?t:e},a=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},l=function(t){return{r:o(t.r,0,255),g:o(t.g,0,255),b:o(t.b,0,255),a:o(t.a)}},h=function(t){return{r:s(t.r),g:s(t.g),b:s(t.b),a:s(t.a,3)}},c=/^#([0-9a-f]{3,8})$/i,u=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},d=function(t){var e=t.r,i=t.g,n=t.b,r=t.a,s=Math.max(e,i,n),o=s-Math.min(e,i,n),a=o?s===e?(i-n)/o:s===i?2+(n-e)/o:4+(e-i)/o:0;return{h:60*(a<0?a+6:a),s:s?o/s*100:0,v:s/255*100,a:r}},p=function(t){var e=t.h,i=t.s,n=t.v,r=t.a;e=e/360*6,i/=100,n/=100;var s=Math.floor(e),o=n*(1-i),a=n*(1-(e-s)*i),l=n*(1-(1-e+s)*i),h=s%6;return{r:255*[n,a,o,o,l,n][h],g:255*[l,n,n,a,o,o][h],b:255*[o,o,l,n,n,a][h],a:r}},f=function(t){return{h:a(t.h),s:o(t.s,0,100),l:o(t.l,0,100),a:o(t.a)}},m=function(t){return{h:s(t.h),s:s(t.s),l:s(t.l),a:s(t.a,3)}},y=function(t){return p((i=(e=t).s,{h:e.h,s:(i*=((n=e.l)<50?n:100-n)/100)>0?2*i/(n+i)*100:0,v:n+i,a:e.a}));var e,i,n},g=function(t){return{h:(e=d(t)).h,s:(r=(200-(i=e.s))*(n=e.v)/100)>0&&r<200?i*n/100/(r<=100?r:200-r)*100:0,l:r/2,a:e.a};var e,i,n,r},v=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,b=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,x=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,w={string:[[function(t){var e=c.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:4===t.length?s(parseInt(t[3]+t[3],16)/255,2):1}:6===t.length||8===t.length?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:8===t.length?s(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=x.exec(t)||_.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:l({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:void 0===e[7]?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=v.exec(t)||b.exec(t);if(!e)return null;var i,r,s=f({h:(i=e[1],r=e[2],void 0===r&&(r="deg"),Number(i)*(n[r]||1)),s:Number(e[3]),l:Number(e[4]),a:void 0===e[5]?1:Number(e[5])/(e[6]?100:1)});return y(s)},"hsl"]],object:[[function(t){var e=t.r,i=t.g,n=t.b,s=t.a,o=void 0===s?1:s;return r(e)&&r(i)&&r(n)?l({r:Number(e),g:Number(i),b:Number(n),a:Number(o)}):null},"rgb"],[function(t){var e=t.h,i=t.s,n=t.l,s=t.a,o=void 0===s?1:s;if(!r(e)||!r(i)||!r(n))return null;var a=f({h:Number(e),s:Number(i),l:Number(n),a:Number(o)});return y(a)},"hsl"],[function(t){var e=t.h,i=t.s,n=t.v,s=t.a,l=void 0===s?1:s;if(!r(e)||!r(i)||!r(n))return null;var h=function(t){return{h:a(t.h),s:o(t.s,0,100),v:o(t.v,0,100),a:o(t.a)}}({h:Number(e),s:Number(i),v:Number(n),a:Number(l)});return p(h)},"hsv"]]},S=function(t,e){for(var i=0;i<e.length;i++){var n=e[i][0](t);if(n)return[n,e[i][1]]}return[null,void 0]},C=function(t){return"string"==typeof t?S(t.trim(),w.string):"object"==typeof t&&null!==t?S(t,w.object):[null,void 0]},A=function(t,e){var i=g(t);return{h:i.h,s:o(i.s+100*e,0,100),l:i.l,a:i.a}},E=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},M=function(t,e){var i=g(t);return{h:i.h,s:i.s,l:o(i.l+100*e,0,100),a:i.a}},T=function(){function t(t){this.parsed=C(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return null!==this.parsed},t.prototype.brightness=function(){return s(E(this.rgba),2)},t.prototype.isDark=function(){return E(this.rgba)<.5},t.prototype.isLight=function(){return E(this.rgba)>=.5},t.prototype.toHex=function(){return e=(t=h(this.rgba)).r,i=t.g,n=t.b,o=(r=t.a)<1?u(s(255*r)):"","#"+u(e)+u(i)+u(n)+o;var t,e,i,n,r,o},t.prototype.toRgb=function(){return h(this.rgba)},t.prototype.toRgbString=function(){return e=(t=h(this.rgba)).r,i=t.g,n=t.b,(r=t.a)<1?"rgba("+e+", "+i+", "+n+", "+r+")":"rgb("+e+", "+i+", "+n+")";var t,e,i,n,r},t.prototype.toHsl=function(){return m(g(this.rgba))},t.prototype.toHslString=function(){return e=(t=m(g(this.rgba))).h,i=t.s,n=t.l,(r=t.a)<1?"hsla("+e+", "+i+"%, "+n+"%, "+r+")":"hsl("+e+", "+i+"%, "+n+"%)";var t,e,i,n,r},t.prototype.toHsv=function(){return t=d(this.rgba),{h:s(t.h),s:s(t.s),v:s(t.v),a:s(t.a,3)};var t},t.prototype.invert=function(){return k({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},t.prototype.saturate=function(t){return void 0===t&&(t=.1),k(A(this.rgba,t))},t.prototype.desaturate=function(t){return void 0===t&&(t=.1),k(A(this.rgba,-t))},t.prototype.grayscale=function(){return k(A(this.rgba,-1))},t.prototype.lighten=function(t){return void 0===t&&(t=.1),k(M(this.rgba,t))},t.prototype.darken=function(t){return void 0===t&&(t=.1),k(M(this.rgba,-t))},t.prototype.rotate=function(t){return void 0===t&&(t=15),this.hue(this.hue()+t)},t.prototype.alpha=function(t){return"number"==typeof t?k({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):s(this.rgba.a,3);var e},t.prototype.hue=function(t){var e=g(this.rgba);return"number"==typeof t?k({h:t,s:e.s,l:e.l,a:e.a}):s(e.h)},t.prototype.isEqual=function(t){return this.toHex()===k(t).toHex()},t}(),k=function(t){return t instanceof T?t:new T(t)},P=[];!function(t){t.forEach((function(t){P.indexOf(t)<0&&(t(T,w),P.push(t))}))}([function(t,e){var i={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},n={};for(var r in i)n[i[r]]=r;var s={};t.prototype.toName=function(e){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var r,o,a=n[this.toHex()];if(a)return a;if(null==e?void 0:e.closest){var l=this.toRgb(),h=1/0,c="black";if(!s.length)for(var u in i)s[u]=new t(i[u]).toRgb();for(var d in i){var p=(r=l,o=s[d],Math.pow(r.r-o.r,2)+Math.pow(r.g-o.g,2)+Math.pow(r.b-o.b,2));p<h&&(h=p,c=d)}return c}},e.string.push([function(e){var n=e.toLowerCase(),r="transparent"===n?"#0000":i[n];return r?new t(r).toRgb():null},"name"])}]);const I=class t{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(e){if(e instanceof t)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(null===e)throw new Error("Cannot set Color#value to null");null!==this._value&&this._isSourceEqual(this._value,e)||(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return"string"==typeof t||"number"==typeof t||t instanceof Number||null===t?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):"object"==typeof t&&null!==t?{...t}:t}_isSourceEqual(t,e){const i=typeof t;if(i!==typeof e)return!1;if("number"===i||"string"===i||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length===e.length&&t.every(((t,i)=>t===e[i]));if(null!==t&&null!==e){const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>t[i]===e[i]))}return t===e}toRgba(){const[t,e,i,n]=this._components;return{r:t,g:e,b:i,a:n}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,n]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(255*e),t[1]=Math.round(255*i),t[2]=Math.round(255*n),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[e,i,n,r]=this._components;return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[e,i,n]=this._components;return t[0]=e,t[1]=i,t[2]=n,t}toNumber(){return this._int}toBgrNumber(){const[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(65280&t)+((255&t)<<16)}multiply(e){const[i,n,r,s]=t._temp.setValue(e)._components;return this._components[0]*=i,this._components[1]*=n,this._components[2]*=r,this._components[3]*=s,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(1===t)return(255<<24)+this._int;if(0===t)return e?0:this._int;let i=this._int>>16&255,n=this._int>>8&255,r=255&this._int;return e&&(i=i*t+.5|0,n=n*t+.5|0,r=r*t+.5|0),(255*t<<24)+(i<<16)+(n<<8)+r}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(255*this._components[3]).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this._value=null,this}_normalize(e){let i,n,r,s;if(("number"==typeof e||e instanceof Number)&&e>=0&&e<=16777215){i=(e>>16&255)/255,n=(e>>8&255)/255,r=(255&e)/255,s=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[i,n,r,s=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[i,n,r,s=255]=e,i/=255,n/=255,r/=255,s/=255;else if("string"==typeof e||"object"==typeof e){if("string"==typeof e){const i=t.HEX_PATTERN.exec(e);i&&(e=`#${i[2]}`)}const o=k(e);o.isValid()&&(({r:i,g:n,b:r,a:s}=o.rgba),i/=255,n/=255,r/=255)}if(void 0===i)throw new Error(`Unable to convert color ${e}`);this._components[0]=i,this._components[1]=n,this._components[2]=r,this._components[3]=s,this._refreshInt()}_refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(255*t<<16)+(255*e<<8)+(255*i|0)}_clamp(t,e=0,i=1){return"number"==typeof t?Math.min(Math.max(t,e),i):(t.forEach(((n,r)=>{t[r]=Math.min(Math.max(n,e),i)})),t)}static isColorLike(e){return"number"==typeof e||"string"==typeof e||e instanceof Number||e instanceof t||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||void 0!==e.r&&void 0!==e.g&&void 0!==e.b||void 0!==e.r&&void 0!==e.g&&void 0!==e.b&&void 0!==e.a||void 0!==e.h&&void 0!==e.s&&void 0!==e.l||void 0!==e.h&&void 0!==e.s&&void 0!==e.l&&void 0!==e.a||void 0!==e.h&&void 0!==e.s&&void 0!==e.v||void 0!==e.h&&void 0!==e.s&&void 0!==e.v&&void 0!==e.a}};I.shared=new I,I._temp=new I,I.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let O=I},1761:(t,e,i)=>{i.d(e,{e:()=>s});const n={createCanvas:(t,e)=>{const i=document.createElement("canvas");return i.width=t,i.height=e,i},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>(new DOMParser).parseFromString(t,"text/xml")};let r=n;const s={get:()=>r,set(t){r=t}}},8507:(t,e,i)=>{i.d(e,{Ag:()=>n,XO:()=>o});var n=(t=>(t.Application="application",t.WebGLPipes="webgl-pipes",t.WebGLPipesAdaptor="webgl-pipes-adaptor",t.WebGLSystem="webgl-system",t.WebGPUPipes="webgpu-pipes",t.WebGPUPipesAdaptor="webgpu-pipes-adaptor",t.WebGPUSystem="webgpu-system",t.CanvasSystem="canvas-system",t.CanvasPipesAdaptor="canvas-pipes-adaptor",t.CanvasPipes="canvas-pipes",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t.MaskEffect="mask-effect",t.BlendMode="blend-mode",t.TextureSource="texture-source",t.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(n||{});const r=t=>{if("function"==typeof t||"object"==typeof t&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={..."object"!=typeof t.extension?{type:t.extension}:t.extension,ref:t}}if("object"!=typeof t)throw new Error("Invalid extension type");return"string"==typeof(t={...t}).type&&(t.type=[t.type]),t},s=(t,e)=>r(t).priority??e,o={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(r).forEach((t=>{t.type.forEach((e=>this._removeHandlers[e]?.(t)))})),this},add(...t){return t.map(r).forEach((t=>{t.type.forEach((e=>{const i=this._addHandlers,n=this._queue;i[e]?i[e]?.(t):(n[e]=n[e]||[],n[e]?.push(t))}))})),this},handle(t,e,i){const n=this._addHandlers,r=this._removeHandlers;if(n[t]||r[t])throw new Error(`Extension type ${t} already has a handler`);n[t]=e,r[t]=i;const s=this._queue;return s[t]&&(s[t]?.forEach((t=>e(t))),delete s[t]),this},handleByMap(t,e){return this.handle(t,(t=>{t.name&&(e[t.name]=t.ref)}),(t=>{t.name&&delete e[t.name]}))},handleByNamedList(t,e,i=-1){return this.handle(t,(t=>{e.findIndex((e=>e.name===t.name))>=0||(e.push({name:t.name,value:t.ref}),e.sort(((t,e)=>s(e.value,i)-s(t.value,i))))}),(t=>{const i=e.findIndex((e=>e.name===t.name));-1!==i&&e.splice(i,1)}))},handleByList(t,e,i=-1){return this.handle(t,(t=>{e.includes(t.ref)||(e.push(t.ref),e.sort(((t,e)=>s(e,i)-s(t,i))))}),(t=>{const i=e.indexOf(t.ref);-1!==i&&e.splice(i,1)}))},mixin(t,...e){for(const i of e)Object.defineProperties(t.prototype,Object.getOwnPropertyDescriptors(i))}}},9049:(t,e,i)=>{i.d(e,{a:()=>n});class n{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}},9313:(t,e,i)=>{i.d(e,{u:()=>s});var n=i(1652),r=i(5101);class s{constructor(t=1,e=0,i=0,n=1,r=0,s=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=n,this.tx=r,this.ty=s}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,n,r,s){return this.a=t,this.b=e,this.c=i,this.d=n,this.tx=r,this.ty=s,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new r.b;const i=t.x,n=t.y;return e.x=this.a*i+this.c*n+this.tx,e.y=this.b*i+this.d*n+this.ty,e}applyInverse(t,e){e=e||new r.b;const i=this.a,n=this.b,s=this.c,o=this.d,a=this.tx,l=this.ty,h=1/(i*o+s*-n),c=t.x,u=t.y;return e.x=o*h*c+-s*h*u+(l*s-a*o)*h,e.y=i*h*u+-n*h*c+(-l*i+a*n)*h,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a,r=this.c,s=this.tx;return this.a=n*e-this.b*i,this.b=n*i+this.b*e,this.c=r*e-this.d*i,this.d=r*i+this.d*e,this.tx=s*e-this.ty*i,this.ty=s*i+this.ty*e,this}append(t){const e=this.a,i=this.b,n=this.c,r=this.d;return this.a=t.a*e+t.b*n,this.b=t.a*i+t.b*r,this.c=t.c*e+t.d*n,this.d=t.c*i+t.d*r,this.tx=t.tx*e+t.ty*n+this.tx,this.ty=t.tx*i+t.ty*r+this.ty,this}appendFrom(t,e){const i=t.a,n=t.b,r=t.c,s=t.d,o=t.tx,a=t.ty,l=e.a,h=e.b,c=e.c,u=e.d;return this.a=i*l+n*c,this.b=i*h+n*u,this.c=r*l+s*c,this.d=r*h+s*u,this.tx=o*l+a*c+e.tx,this.ty=o*h+a*u+e.ty,this}setTransform(t,e,i,n,r,s,o,a,l){return this.a=Math.cos(o+l)*r,this.b=Math.sin(o+l)*r,this.c=-Math.sin(o-a)*s,this.d=Math.cos(o-a)*s,this.tx=t-(i*this.a+n*this.c),this.ty=e-(i*this.b+n*this.d),this}prepend(t){const e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){const e=this.a,i=this.c;this.a=e*t.a+this.b*t.c,this.b=e*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,r=this.c,s=this.d,o=t.pivot,a=-Math.atan2(-r,s),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(n.TO-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(r*r+s*s),t.position.x=this.tx+(o.x*e+o.y*r),t.position.y=this.ty+(o.x*i+o.y*s),t}invert(){const t=this.a,e=this.b,i=this.c,n=this.d,r=this.tx,s=t*n-e*i;return this.a=n/s,this.b=-e/s,this.c=-i/s,this.d=t/s,this.tx=(i*this.ty-n*r)/s,this.ty=-(t*this.ty-e*r)/s,this}isIdentity(){return 1===this.a&&0===this.b&&0===this.c&&1===this.d&&0===this.tx&&0===this.ty}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new s;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return a.identity()}static get shared(){return o.identity()}}const o=new s,a=new s},2079:(t,e,i)=>{i.d(e,{E:()=>u});var n=i(9313);const r=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],s=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],o=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],a=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],l=[],h=[],c=Math.sign;!function(){for(let t=0;t<16;t++){const e=[];l.push(e);for(let i=0;i<16;i++){const n=c(r[t]*r[i]+o[t]*s[i]),l=c(s[t]*r[i]+a[t]*s[i]),h=c(r[t]*o[i]+o[t]*a[i]),u=c(s[t]*o[i]+a[t]*a[i]);for(let t=0;t<16;t++)if(r[t]===n&&s[t]===l&&o[t]===h&&a[t]===u){e.push(t);break}}}for(let t=0;t<16;t++){const e=new n.u;e.set(r[t],s[t],o[t],a[t],0,0),h.push(e)}}();const u={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:t=>r[t],uY:t=>s[t],vX:t=>o[t],vY:t=>a[t],inv:t=>8&t?15&t:7&-t,add:(t,e)=>l[t][e],sub:(t,e)=>l[t][u.inv(e)],rotate180:t=>4^t,isVertical:t=>2==(3&t),byDirection:(t,e)=>2*Math.abs(t)<=Math.abs(e)?e>=0?u.S:u.N:2*Math.abs(e)<=Math.abs(t)?t>0?u.E:u.W:e>0?t>0?u.SE:u.SW:t>0?u.NE:u.NW,matrixAppendRotationInv:(t,e,i=0,n=0,r=0,s=0)=>{const o=h[u.inv(e)],a=o.a,l=o.b,c=o.c,d=o.d,p=i-Math.min(0,a*r,c*s,a*r+c*s),f=n-Math.min(0,l*r,d*s,l*r+d*s),m=t.a,y=t.b,g=t.c,v=t.d;t.a=a*m+l*g,t.b=a*y+l*v,t.c=c*m+d*g,t.d=c*y+d*v,t.tx=p*m+f*g+t.tx,t.ty=p*y+f*v+t.ty},transformRectCoords:(t,e,i,n)=>{const{x:r,y:s,width:o,height:a}=t,{x:l,y:h,width:c,height:d}=e;return i===u.E?(n.set(r+l,s+h,o,a),n):i===u.S?n.set(c-s-a+l,r+h,a,o):i===u.W?n.set(c-r-o+l,d-s-a+h,o,a):i===u.N?n.set(s+l,d-r-o+h,a,o):n.set(r+l,s+h,o,a)}}},1652:(t,e,i)=>{i.d(e,{TO:()=>n,Td:()=>s,bO:()=>r});const n=2*Math.PI,r=180/Math.PI,s=Math.PI/180},9939:(t,e,i)=>{function n(t){return t+=0===t?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function r(t){return!(t&t-1||!t)}i.d(e,{U5:()=>n,f3:()=>r})},2812:(t,e,i)=>{i.d(e,{o:()=>n});class n{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new n(t??this._observer,this._x,this._y)}set(t=0,e=t){return this._x===t&&this._y===e||(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}},5101:(t,e,i)=>{i.d(e,{b:()=>n});class n{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new n(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return r.x=0,r.y=0,r}}const r=new n},6125:(t,e,i)=>{i.d(e,{j:()=>r});var n=i(9252);class r{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let n=this.x-t,r=this.y-e;return n*=n,r*=r,n+r<=i}strokeContains(t,e,i,n=.5){if(0===this.radius)return!1;const r=this.x-t,s=this.y-e,o=this.radius,a=(1-n)*i,l=Math.sqrt(r*r+s*s);return l<=o+a&&l>o-(i-a)}getBounds(t){return t||(t=new n.M),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=2*this.radius,t.height=2*this.radius,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}},9252:(t,e,i)=>{i.d(e,{M:()=>s});var n=i(5101);const r=[new n.b,new n.b,new n.b,new n.b];class s{constructor(t=0,e=0,i=0,n=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(n)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new s(0,0,0,0)}clone(){return new s(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height)}strokeContains(t,e,i,n=.5){const{width:r,height:s}=this;if(r<=0||s<=0)return!1;const o=this.x,a=this.y,l=i*(1-n),h=i-l;return t>=o-l&&t<=o+r+l&&e>=a-l&&e<=a+s+l&&!(t>o+h&&t<o+r-h&&e>a+h&&e<a+s-h)}intersects(t,e){if(!e){const e=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=e)return!1;const i=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>i}const i=this.left,n=this.right,s=this.top,o=this.bottom;if(n<=i||o<=s)return!1;const a=r[0].set(t.left,t.top),l=r[1].set(t.left,t.bottom),h=r[2].set(t.right,t.top),c=r[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(0===u)return!1;if(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=i||Math.min(a.x,l.x,h.x,c.x)>=n||Math.max(a.y,l.y,h.y,c.y)<=s||Math.min(a.y,l.y,h.y,c.y)>=o)return!1;const d=u*(l.y-a.y),p=u*(a.x-l.x),f=d*i+p*s,m=d*n+p*s,y=d*i+p*o,g=d*n+p*o;if(Math.max(f,m,y,g)<=d*a.x+p*a.y||Math.min(f,m,y,g)>=d*c.x+p*c.y)return!1;const v=u*(a.y-h.y),b=u*(h.x-a.x),x=v*i+b*s,_=v*n+b*s,w=v*i+b*o,S=v*n+b*o;return!(Math.max(x,_,w,S)<=v*a.x+b*a.y||Math.min(x,_,w,S)>=v*c.x+b*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),n=Math.max(this.y,t.y),r=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=n,this.height=Math.max(r-n,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,n=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=n-this.y,this}scale(t,e=t){return this.x*=t,this.y*=e,this.width*=t,this.height*=e,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),n=Math.min(this.y,t.y),r=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=n,this.height=r-n,this}getBounds(t){return t||(t=new s),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const e=t.x,i=t.y,n=t.x+t.width,r=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<this.y+this.height&&n>=this.x&&n<this.x+this.width&&r>=this.y&&r<this.y+this.height}set(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}},6512:(t,e,i)=>{i.d(e,{u:()=>s});const n=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function r(t){let e="";for(let i=0;i<t;++i)i>0&&(e+="\nelse "),i<t-1&&(e+=`if(test == ${i}.0){}`);return e}function s(t,e){if(0===t)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const i=e.createShader(e.FRAGMENT_SHADER);try{for(;;){const s=n.replace(/%forloop%/gi,r(t));if(e.shaderSource(i,s),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))break;t=t/2|0}}finally{e.deleteShader(i)}return t}},341:(t,e,i)=>{i.d(e,{w:()=>o});var n=i(3513),r=i(5589);const s={};function o(t,e,i){let o=2166136261;for(let i=0;i<e;i++)o^=t[i].uid,o=Math.imul(o,16777619),o>>>=0;return s[o]||function(t,e,i,o){const a={};let l=0;for(let i=0;i<o;i++){const n=i<e?t[i]:r.g.EMPTY.source;a[l++]=n.source,a[l++]=n.style}const h=new n.T(a);return s[i]=h,h}(t,e,o,i)}},2043:(t,e,i)=>{i.d(e,{J:()=>N});var n=i(8507),r=i(133);class s{constructor(t){"number"==typeof t?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}var o=i(4670),a=i(6083),l=i(6736),h=i(1957);function c(t,e){return"no-premultiply-alpha"===e.alphaMode&&h.Q[t]||t}var u=i(3804),d=i(6512);let p=null;class f{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}class m{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new f,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null,this.elements=null}}const y=[];let g=0;function v(){return g>0?y[--g]:new m}function b(t){t.elements=null,y[g++]=t}a.L.register({clear:()=>{if(y.length>0)for(const t of y)t&&t.destroy();y.length=0,g=0}});let x=0;const _=class t{constructor(e){this.uid=(0,r.L)("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],(e={...t.defaultOptions,...e}).maxTextures||((0,o.t6)("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=function(){if(p)return p;const t=(0,u.W)();return p=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),p=(0,d.u)(p,t),t.getExtension("WEBGL_lose_context")?.loseContext(),p}());const{maxTextures:i,attributesInitialSize:n,indicesInitialSize:a}=e;this.attributeBuffer=new s(4*n),this.indexBuffer=new Uint16Array(a),this.maxTextures=i}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)b(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){const i=t._batch.textures.ids[e._source.uid];return!(!i&&0!==i)&&(t._textureId=i,t.texture=e,!0)}updateElement(t){this.dirty=!0;const e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){const e=this._elements;if(!e[this.elementStart])return;let i=v(),n=i.textures;n.clear();const r=e[this.elementStart];let s=c(r.blendMode,r.texture._source),o=r.topology;4*this.attributeSize>this.attributeBuffer.size&&this._resizeAttributeBuffer(4*this.attributeSize),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const a=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,h=this.indexBuffer;let u=this._batchIndexSize,d=this._batchIndexStart,p="startBatch",f=[];const m=this.maxTextures;for(let r=this.elementStart;r<this.elementSize;++r){const y=e[r];e[r]=null;const g=y.texture._source,b=c(y.blendMode,g),_=s!==b||o!==y.topology;g._batchTick!==x||_?(g._batchTick=x,(n.count>=m||_)&&(this._finishBatch(i,d,u-d,n,s,o,t,p,f),p="renderBatch",d=u,s=b,o=y.topology,i=v(),n=i.textures,n.clear(),f=[],++x),y._textureId=g._textureBindLocation=n.count,n.ids[g.uid]=n.count,n.textures[n.count++]=g,y._batch=i,f.push(y),u+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,a,l,y._attributeStart,y._textureId),this.packQuadIndex(h,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,a,l,y._attributeStart,y._textureId),this.packIndex(y,h,y._indexStart,y._attributeStart/this.vertexSize))):(y._textureId=g._textureBindLocation,u+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,a,l,y._attributeStart,y._textureId),this.packQuadIndex(h,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,a,l,y._attributeStart,y._textureId),this.packIndex(y,h,y._indexStart,y._attributeStart/this.vertexSize)),y._batch=i,f.push(y))}n.count>0&&(this._finishBatch(i,d,u-d,n,s,o,t,p,f),d=u,++x),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,i,n,r,s,o,a,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=a,t.batcher=this,t.textures=n,t.blendMode=r,t.topology=s,t.start=e,t.size=i,t.elements=l,++x,this.batches[this.batchIndex++]=t,o.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){4*t<=this.attributeBuffer.size||this._resizeAttributeBuffer(4*t)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,2*this.attributeBuffer.size),i=new s(e);(0,l.W)(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){const e=this.indexBuffer;let i=Math.max(t,1.5*e.length);i+=i%2;const n=i>65535?new Uint32Array(i):new Uint16Array(i);if(n.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let t=0;t<e.length;t++)n[t]=e[t];else(0,l.W)(e.buffer,n.buffer);this.indexBuffer=n}packQuadIndex(t,e,i){t[e]=i+0,t[e+1]=i+1,t[e+2]=i+2,t[e+3]=i+0,t[e+4]=i+2,t[e+5]=i+3}packIndex(t,e,i,n){const r=t.indices,s=t.indexSize,o=t.indexOffset,a=t.attributeOffset;for(let t=0;t<s;t++)e[i++]=n+r[t+o]-a}destroy(t={}){if(null!==this.batches){for(let t=0;t<this.batchIndex;t++)b(this.batches[t]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,t.shader&&(this.shader?.destroy(),this.shader=null);for(let t=0;t<this._elements.length;t++)this._elements[t]&&(this._elements[t]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};_.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let w=_;var S=i(949),C=i(1132),A=i(6011);const E=new Float32Array(1),M=new Uint32Array(1);class T extends A.V{constructor(){const t=new S.h({data:E,label:"attribute-batch-buffer",usage:C.S.VERTEX|C.S.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:24,offset:0},aUV:{buffer:t,format:"float32x2",stride:24,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:24,offset:16},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:24,offset:20}},indexBuffer:new S.h({data:M,label:"index-batch-buffer",usage:C.S.INDEX|C.S.COPY_DST,shrinkToFit:!1})})}}var k=i(5611),P=i(4459),I=i(4e3),O=i(6665),R=i(6040),L=i(8475);class j extends L.M{constructor(t){super({glProgram:(0,k.I)({name:"batch",bits:[P.a,(0,I.P)(t),O.m]}),gpuProgram:(0,k.v)({name:"batch",bits:[P.F,(0,I._)(t),O.b]}),resources:{batchSamplers:(0,R.n)(t)}}),this.maxTextures=t}}let D=null;const F=class t extends w{constructor(e){super(e),this.geometry=new T,this.name=t.extension.name,this.vertexSize=6,D??(D=new j(e.maxTextures)),this.shader=D}packAttributes(t,e,i,n,r){const s=r<<16|65535&t.roundPixels,o=t.transform,a=o.a,l=o.b,h=o.c,c=o.d,u=o.tx,d=o.ty,{positions:p,uvs:f}=t,m=t.color,y=t.attributeOffset,g=y+t.attributeSize;for(let t=y;t<g;t++){const r=2*t,o=p[r],y=p[r+1];e[n++]=a*o+h*y+u,e[n++]=c*y+l*o+d,e[n++]=f[r],e[n++]=f[r+1],i[n++]=m,i[n++]=s}}packQuadAttributes(t,e,i,n,r){const s=t.texture,o=t.transform,a=o.a,l=o.b,h=o.c,c=o.d,u=o.tx,d=o.ty,p=t.bounds,f=p.maxX,m=p.minX,y=p.maxY,g=p.minY,v=s.uvs,b=t.color,x=r<<16|65535&t.roundPixels;e[n+0]=a*m+h*g+u,e[n+1]=c*g+l*m+d,e[n+2]=v.x0,e[n+3]=v.y0,i[n+4]=b,i[n+5]=x,e[n+6]=a*f+h*g+u,e[n+7]=c*g+l*f+d,e[n+8]=v.x1,e[n+9]=v.y1,i[n+10]=b,i[n+11]=x,e[n+12]=a*f+h*y+u,e[n+13]=c*y+l*f+d,e[n+14]=v.x2,e[n+15]=v.y2,i[n+16]=b,i[n+17]=x,e[n+18]=a*m+h*y+u,e[n+19]=c*y+l*m+d,e[n+20]=v.x3,e[n+21]=v.y3,i[n+22]=b,i[n+23]=x}_updateMaxTextures(t){this.shader.maxTextures!==t&&(D=new j(t),this.shader=D)}destroy(){this.shader=null,super.destroy()}};F.extension={type:[n.Ag.Batcher],name:"default"};let N=F},5611:(t,e,i)=>{i.d(e,{I:()=>M,v:()=>E});var n=i(9113),r=i(3012),s=i(268);function o(t,e,i){if(t)for(const n in t){const r=e[n.toLocaleLowerCase()];if(r){let e=t[n];"header"===n&&(e=e.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),i&&r.push(`//----${i}----//`),r.push(e)}else(0,s.R)(`${n} placement hook does not exist in shader`)}}const a=/\{\{(.*?)\}\}/g;function l(t){const e={};return(t.match(a)?.map((t=>t.replace(/[{()}]/g,"")))??[]).forEach((t=>{e[t]=[]})),e}function h(t,e){let i;const n=/@in\s+([^;]+);/g;for(;null!==(i=n.exec(t));)e.push(i[1])}function c(t,e,i=!1){const n=[];h(e,n),t.forEach((t=>{t.header&&h(t.header,n)}));const r=n;i&&r.sort();const s=r.map(((t,e)=>` @location(${e}) ${t},`)).join("\n");let o=e.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`\n${s}\n`),o}function u(t,e){let i;const n=/@out\s+([^;]+);/g;for(;null!==(i=n.exec(t));)e.push(i[1])}function d(t,e){let i=t;for(const t in e){const n=e[t];i=n.join("\n").length?i.replace(`{{${t}}}`,`//-----${t} START-----//\n${n.join("\n")}\n//----${t} FINISH----//`):i.replace(`{{${t}}}`,"")}return i}const p=Object.create(null),f=new Map;let m=0;function y({template:t,bits:e}){const i=v(t,e);if(p[i])return p[i];const{vertex:n,fragment:r}=function(t,e){const i=e.map((t=>t.vertex)).filter((t=>!!t)),n=e.map((t=>t.fragment)).filter((t=>!!t));let r=c(i,t.vertex,!0);r=function(t,e){const i=[];u(e,i),t.forEach((t=>{t.header&&u(t.header,i)}));let n=0;const r=i.sort().map((t=>t.indexOf("builtin")>-1?t:`@location(${n++}) ${t}`)).join(",\n"),s=i.sort().map((t=>{return` var ${e=t,e.replace(/@.*?\s+/g,"")};`;var e})).join("\n"),o=`return VSOutput(\n ${i.sort().map((t=>` ${function(t){const e=/\b(\w+)\s*:/g.exec(t);return e?e[1]:""}(t)}`)).join(",\n")});`;let a=e.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`\n${r}\n`),a=a.replace("{{start}}",`\n${s}\n`),a=a.replace("{{return}}",`\n${o}\n`),a}(i,r);const s=c(n,t.fragment,!0);return{vertex:r,fragment:s}}(t,e);return p[i]=b(n,r,e),p[i]}function g({template:t,bits:e}){const i=v(t,e);return p[i]||(p[i]=b(t.vertex,t.fragment,e)),p[i]}function v(t,e){return e.map((t=>(f.has(t)||f.set(t,m++),f.get(t)))).sort(((t,e)=>t-e)).join("-")+t.vertex+t.fragment}function b(t,e,i){const n=l(t),r=l(e);return i.forEach((t=>{o(t.vertex,n,t.name),o(t.fragment,r,t.name)})),{vertex:d(t,n),fragment:d(e,r)}}const x="\n @in aPosition: vec2<f32>;\n @in aUV: vec2<f32>;\n\n @out @builtin(position) vPosition: vec4<f32>;\n @out vUV : vec2<f32>;\n @out vColor : vec4<f32>;\n\n {{header}}\n\n struct VSOutput {\n {{struct}}\n };\n\n @vertex\n fn main( {{in}} ) -> VSOutput {\n\n var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;\n var modelMatrix = mat3x3<f32>(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n );\n var position = aPosition;\n var uv = aUV;\n\n {{start}}\n\n vColor = vec4<f32>(1., 1., 1., 1.);\n\n {{main}}\n\n vUV = uv;\n\n var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;\n\n vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);\n\n vColor *= globalUniforms.uWorldColorAlpha;\n\n {{end}}\n\n {{return}}\n };\n",_="\n @in vUV : vec2<f32>;\n @in vColor : vec4<f32>;\n\n {{header}}\n\n @fragment\n fn main(\n {{in}}\n ) -> @location(0) vec4<f32> {\n\n {{start}}\n\n var outColor:vec4<f32>;\n\n {{main}}\n\n var finalColor:vec4<f32> = outColor * vColor;\n\n {{end}}\n\n return finalColor;\n };\n",w="\n in vec2 aPosition;\n in vec2 aUV;\n\n out vec4 vColor;\n out vec2 vUV;\n\n {{header}}\n\n void main(void){\n\n mat3 worldTransformMatrix = uWorldTransformMatrix;\n mat3 modelMatrix = mat3(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n );\n vec2 position = aPosition;\n vec2 uv = aUV;\n\n {{start}}\n\n vColor = vec4(1.);\n\n {{main}}\n\n vUV = uv;\n\n mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;\n\n gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n\n vColor *= uWorldColorAlpha;\n\n {{end}}\n }\n",S="\n\n in vec4 vColor;\n in vec2 vUV;\n\n out vec4 finalColor;\n\n {{header}}\n\n void main(void) {\n\n {{start}}\n\n vec4 outColor;\n\n {{main}}\n\n finalColor = outColor * vColor;\n\n {{end}}\n }\n",C={name:"global-uniforms-bit",vertex:{header:"\n struct GlobalUniforms {\n uProjectionMatrix:mat3x3<f32>,\n uWorldTransformMatrix:mat3x3<f32>,\n uWorldColorAlpha: vec4<f32>,\n uResolution: vec2<f32>,\n }\n\n @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;\n "}},A={name:"global-uniforms-bit",vertex:{header:"\n uniform mat3 uProjectionMatrix;\n uniform mat3 uWorldTransformMatrix;\n uniform vec4 uWorldColorAlpha;\n uniform vec2 uResolution;\n "}};function E({bits:t,name:e}){const i=y({template:{fragment:_,vertex:x},bits:[C,...t]});return r.B.from({name:e,vertex:{source:i.vertex,entryPoint:"main"},fragment:{source:i.fragment,entryPoint:"main"}})}function M({bits:t,name:e}){return new n.M({name:e,...g({template:{vertex:w,fragment:S},bits:[A,...t]})})}},4459:(t,e,i)=>{i.d(e,{F:()=>n,a:()=>r});const n={name:"color-bit",vertex:{header:"\n @in aColor: vec4<f32>;\n ",main:"\n vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);\n "}},r={name:"color-bit",vertex:{header:"\n in vec4 aColor;\n ",main:"\n vColor *= vec4(aColor.rgb * aColor.a, aColor.a);\n "}}},4e3:(t,e,i)=>{i.d(e,{P:()=>h,_:()=>o});const n={};function r(t){const e=[];if(1===t)e.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let i=0;for(let n=0;n<t;n++)e.push(`@group(1) @binding(${i++}) var textureSource${n+1}: texture_2d<f32>;`),e.push(`@group(1) @binding(${i++}) var textureSampler${n+1}: sampler;`)}return e.join("\n")}function s(t){const e=[];if(1===t)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let i=0;i<t;i++)i===t-1?e.push(" default:{"):e.push(` case ${i}:{`),e.push(` outColor = textureSampleGrad(textureSource${i+1}, textureSampler${i+1}, vUV, uvDx, uvDy);`),e.push(" break;}");e.push("}")}return e.join("\n")}function o(t){return n[t]||(n[t]={name:"texture-batch-bit",vertex:{header:"\n @in aTextureIdAndRound: vec2<u32>;\n @out @interpolate(flat) vTextureId : u32;\n ",main:"\n vTextureId = aTextureIdAndRound.y;\n ",end:"\n if(aTextureIdAndRound.x == 1)\n {\n vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);\n }\n "},fragment:{header:`\n @in @interpolate(flat) vTextureId: u32;\n\n ${r(t)}\n `,main:`\n var uvDx = dpdx(vUV);\n var uvDy = dpdy(vUV);\n\n ${s(t)}\n `}}),n[t]}const a={};function l(t){const e=[];for(let i=0;i<t;i++)i>0&&e.push("else"),i<t-1&&e.push(`if(vTextureId < ${i}.5)`),e.push("{"),e.push(`\toutColor = texture(uTextures[${i}], vUV);`),e.push("}");return e.join("\n")}function h(t){return a[t]||(a[t]={name:"texture-batch-bit",vertex:{header:"\n in vec2 aTextureIdAndRound;\n out float vTextureId;\n\n ",main:"\n vTextureId = aTextureIdAndRound.y;\n ",end:"\n if(aTextureIdAndRound.x == 1.)\n {\n gl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n }\n "},fragment:{header:`\n in float vTextureId;\n\n uniform sampler2D uTextures[${t}];\n\n `,main:`\n\n ${l(t)}\n `}}),a[t]}},6665:(t,e,i)=>{i.d(e,{b:()=>n,m:()=>r});const n={name:"round-pixels-bit",vertex:{header:"\n fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>\n {\n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n }\n "}},r={name:"round-pixels-bit",vertex:{header:"\n vec2 roundPixels(vec2 position, vec2 targetSize)\n {\n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n }\n "}}},5753:(t,e,i)=>{var n=i(8507),r=i(6844),s=i(9636),o=i(9443);const a=new s.c;function l(t,e,i){const n=a;t.measurable=!0,(0,o.f)(t,i,n),e.addBoundsMask(n),t.measurable=!1}var h=i(7269),c=i(2208),u=i(268);function d(t,e,i){const n=c.o.get();t.measurable=!0;const r=c.u.get().identity(),s=p(t,i,r);(0,h.n)(t,n,s),t.measurable=!1,e.addBoundsMask(n),c.u.return(r),c.o.return(n)}function p(t,e,i){return t?(t!==e&&(p(t.parent,e,i),t.updateLocalTransform(),i.append(t.localTransform)),i):((0,u.R)("Mask bounds, renderable is not inside the root container"),i)}class f{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof r.k),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){null!==this.mask&&(this.mask.measurable=!0,this.mask=null)}addBounds(t,e){this.inverse||l(this.mask,t,e)}addLocalBounds(t,e){d(this.mask,t,e)}containsPoint(t,e){return e(this.mask,t)}destroy(){this.reset()}static test(t){return t instanceof r.k}}f.extension=n.Ag.MaskEffect;class m{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return"number"==typeof t}}m.extension=n.Ag.MaskEffect;var y=i(5559);class g{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){null!==this.mask&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(t,e){l(this.mask,t,e)}addLocalBounds(t,e){d(this.mask,t,e)}containsPoint(t,e){return e(this.mask,t)}destroy(){this.reset()}static test(t){return t instanceof y.mc}}g.extension=n.Ag.MaskEffect;var v=i(4195),b=i(4884),x=i(8293),_=i(7309),w=i(1761);let S;var C=i(583);const A=class t extends C.v{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...t.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=!1!==e.autoPlay,this.alphaMode=e.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),!1!==e.autoLoad&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=_.R.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await async function(){return S??(S=(async()=>{const t=w.e.get().createCanvas(1,1).getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise((t=>{const e=document.createElement("video");e.onloadeddata=()=>t(e),e.onerror=()=>t(null),e.autoplay=!1,e.crossOrigin="anonymous",e.preload="auto",e.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",e.load()}));if(!e)return"premultiply-alpha-on-upload";const i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);const n=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,n),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const r=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,r),t.deleteFramebuffer(n),t.deleteTexture(i),t.getExtension("WEBGL_lose_context")?.loseContext(),r[0]<=r[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),S}(),this._load=new Promise(((i,n)=>{this.isValid?i(this):(this._resolve=i,this._reject=n,void 0!==e.preloadTimeoutMs&&(this._preloadTimeout=setTimeout((()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))}))),t.load())})),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(_.R.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),null===this._videoFrameRequestCallbackHandle&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(null!==this._videoFrameRequestCallbackHandle&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(_.R.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(null!==this._videoFrameRequestCallbackHandle&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(_.R.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};A.extension=n.Ag.TextureSource,A.defaultOptions={...C.v.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},A.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let E=A;i(9726);n.XO.add(f,m,g,E,x.b,b.q,v.P)},1257:(t,e,i)=>{i.d(e,{u:()=>n});var n=(t=>(t[t.NONE=0]="NONE",t[t.COLOR=16384]="COLOR",t[t.STENCIL=1024]="STENCIL",t[t.DEPTH=256]="DEPTH",t[t.COLOR_DEPTH=16640]="COLOR_DEPTH",t[t.COLOR_STENCIL=17408]="COLOR_STENCIL",t[t.DEPTH_STENCIL=1280]="DEPTH_STENCIL",t[t.ALL=17664]="ALL",t))(n||{})},9113:(t,e,i)=>{i.d(e,{M:()=>d});var n=i(7952),r=i(3804);let s;function o(){if(!s){s="mediump";const t=(0,r.W)();if(t&&t.getShaderPrecisionFormat){const e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);s=e.precision?"highp":"mediump"}}return s}const a={},l={};const h={stripVersion:function(t,e){return e?t.replace("#version 300 es",""):t},ensurePrecision:function(t,e,i){const n=i?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if("precision"!==t.substring(0,9)){let r=i?e.requestedFragmentPrecision:e.requestedVertexPrecision;return"highp"===r&&"highp"!==n&&(r="mediump"),`precision ${r} float;\n${t}`}return"highp"!==n&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t},addProgramDefines:function(t,e,i){return e?t:i?`\n\n #ifdef GL_ES // This checks if it is WebGL1\n #define in varying\n #define finalColor gl_FragColor\n #define texture texture2D\n #endif\n ${t=t.replace("out vec4 finalColor;","")}\n `:`\n\n #ifdef GL_ES // This checks if it is WebGL1\n #define in attribute\n #define out varying\n #endif\n ${t}\n `},setProgramName:function(t,{name:e="pixi-program"},i=!0){e=e.replace(/\s+/g,"-");const n=i?a:l;return n[e+=i?"-fragment":"-vertex"]?(n[e]++,e+=`-${n[e]}`):n[e]=1,-1!==t.indexOf("#define SHADER_NAME")?t:`${`#define SHADER_NAME ${e}`}\n${t}`},insertVersion:function(t,e){return e?`#version 300 es\n${t}`:t}},c=Object.create(null),u=class t{constructor(e){const i=-1!==(e={...t.defaultOptions,...e}).fragment.indexOf("#version 300 es"),r={stripVersion:i,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:o()},setProgramName:{name:e.name},addProgramDefines:i,insertVersion:i};let s=e.fragment,a=e.vertex;Object.keys(h).forEach((t=>{const e=r[t];s=h[t](s,e,!0),a=h[t](a,e,!1)})),this.fragment=s,this.vertex=a,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=(0,n.X)(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null,c[this._cacheKey]=null}static from(e){const i=`${e.vertex}:${e.fragment}`;return c[i]||(c[i]=new t(e),c[i]._cacheKey=i),c[i]}};u.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let d=u},6040:(t,e,i)=>{i.d(e,{n:()=>s});var n=i(5811);const r={};function s(t){let e=r[t];if(e)return e;const i=new Int32Array(t);for(let e=0;e<t;e++)i[e]=e;return e=r[t]=new n.k({uTextures:{value:i,type:"i32",size:t}},{isStatic:!0}),e}},3804:(t,e,i)=>{i.d(e,{W:()=>s});var n=i(1761);let r;function s(){if(!r||r?.isContextLost()){const t=n.e.get().createCanvas();r=t.getContext("webgl",{})}return r}},3513:(t,e,i)=>{i.d(e,{T:()=>n});class n{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const i in t){const n=t[i];this.setResource(n,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){const i=this.resources[e];t!==i&&(i?.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t,e){const i=this.resources;for(const n in i)i[n]._gcLastUsed=t,i[n]._touched=e}destroy(){const t=this.resources;for(const e in t){const i=t[e];i?.off?.("change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){this._dirty=!0,t.destroyed?this.destroy():this._updateKey()}}},3012:(t,e,i)=>{i.d(e,{B:()=>u});var n=i(7952),r=i(8306);const s={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},o=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function a(t,e){let i;for(;null!==(i=o.exec(t));){const t=s[i[3]]??"float32";e[i[2]]={location:parseInt(i[1],10),format:t,stride:(0,r.m)(t).stride,offset:0,instance:!1,start:0}}o.lastIndex=0}function l(t){const e=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,n=/var(<[^>]+>)? (\w+)/,r=/:\s*([\w<>]+)/,s=/(\w+)\s*:\s*([\w\<\>]+)/g,o=/struct\s+(\w+)/,a=t.match(/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g)?.map((t=>({group:parseInt(t.match(e)[1],10),binding:parseInt(t.match(i)[1],10),name:t.match(n)[2],isUniform:"<uniform>"===t.match(n)[1],type:t.match(r)[1]})));if(!a)return{groups:[],structs:[]};const l=t.match(/struct\s+(\w+)\s*{([^}]+)}/g)?.map((t=>{const e=t.match(o)[1],i=t.match(s).reduce(((t,e)=>{const[i,n]=e.split(":");return t[i.trim()]=n.trim(),t}),{});return i?{name:e,members:i}:null})).filter((({name:t})=>a.some((e=>e.type===t||e.type.includes(`<${t}>`)))))??[];return{groups:a,structs:l}}var h=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(h||{});const c=Object.create(null);class u{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:e,vertex:i,layout:n,gpuLayout:r,name:s}=t;if(this.name=s,this.fragment=e,this.vertex=i,e.source===i.source){const t=l(e.source);this.structsAndGroups=t}else{const t=l(i.source),n=l(e.source);this.structsAndGroups=function(t,e){const i=new Set,n=new Set;return{structs:[...t.structs,...e.structs].filter((t=>!i.has(t.name)&&(i.add(t.name),!0))),groups:[...t.groups,...e.groups].filter((t=>{const e=`${t.name}-${t.binding}`;return!n.has(e)&&(n.add(e),!0)}))}}(t,n)}this.layout=n??function({groups:t}){const e=[];for(let i=0;i<t.length;i++){const n=t[i];e[n.group]||(e[n.group]={}),e[n.group][n.name]=n.binding}return e}(this.structsAndGroups),this.gpuLayout=r??function({groups:t}){const e=[];for(let i=0;i<t.length;i++){const n=t[i];e[n.group]||(e[n.group]=[]),n.isUniform?e[n.group].push({binding:n.binding,visibility:h.VERTEX|h.FRAGMENT,buffer:{type:"uniform"}}):"sampler"===n.type?e[n.group].push({binding:n.binding,visibility:h.FRAGMENT,sampler:{type:"filtering"}}):"texture_2d"===n.type||n.type.startsWith("texture_2d<")?e[n.group].push({binding:n.binding,visibility:h.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):"texture_2d_array"===n.type||n.type.startsWith("texture_2d_array<")?e[n.group].push({binding:n.binding,visibility:h.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):("texture_cube"===n.type||n.type.startsWith("texture_cube<"))&&e[n.group].push({binding:n.binding,visibility:h.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let t=0;t<e.length;t++)e[t]||(e[t]=[]);return e}(this.structsAndGroups),this.autoAssignGlobalUniforms=!(void 0===this.layout[0]?.globalUniforms),this.autoAssignLocalUniforms=!(void 0===this.layout[1]?.localUniforms),this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=(0,n.X)(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=function({source:t,entryPoint:e}){const i={},n=function(t){return t.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}(t),r=n.indexOf(`fn ${e}(`);if(-1===r)return i;const s=n.indexOf("->",r);if(-1===s)return i;const o=n.substring(r,s);if(a(o,i),0===Object.keys(i).length){const t=o.match(/\(\s*\w+\s*:\s*(\w+)/);if(t){const e=t[1],r=new RegExp(`struct\\s+${e}\\s*\\{([^}]+)\\}`,"s"),s=n.match(r);s&&a(s[1],i)}}return i}(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,c[this._cacheKey]=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return c[e]||(c[e]=new u(t),c[e]._cacheKey=e),c[e]}}},949:(t,e,i)=>{i.d(e,{h:()=>o});var n=i(8875),r=i(133),s=i(1132);class o extends n.A{constructor(t){let{data:e,size:i}=t;const{usage:n,label:s,shrinkToFit:o}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=(0,r.L)("buffer"),this._resourceType="buffer",this._resourceId=(0,r.L)("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i??(i=e?.byteLength);const a=!!e;this.descriptor={size:i,usage:n,mappedAtCreation:a,label:s},this.shrinkToFit=o??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&s.S.STATIC)}set static(t){t?this.descriptor.usage|=s.S.STATIC:this.descriptor.usage&=~s.S.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t)return void(i&&this.emit("update",this));const n=this._data;this._data=t,this._dataInt32=null,n&&n.length===t.length||!this.shrinkToFit&&n&&t.byteLength<n.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=(0,r.L)("resource"),this.emit("change",this))}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}},1132:(t,e,i)=>{i.d(e,{S:()=>n});var n=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(n||{})},6736:(t,e,i)=>{function n(t,e,i,n){if(i??(i=0),n??(n=Math.min(t.byteLength-i,e.byteLength)),7&i||7&n)if(3&i||3&n)new Uint8Array(e).set(new Uint8Array(t,i,n));else{const r=n/4;new Float32Array(e,0,r).set(new Float32Array(t,i,r))}else{const r=n/8;new Float64Array(e,0,r).set(new Float64Array(t,i,r))}}i.d(e,{W:()=>n})},6011:(t,e,i)=>{i.d(e,{V:()=>h});var n=i(8875),r=i(9636),s=i(133),o=i(949),a=i(1132);function l(t,e){if(!(t instanceof o.h)){let i=e?a.S.INDEX:a.S.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),i=a.S.INDEX|a.S.COPY_DST):(t=new Float32Array(t),i=a.S.VERTEX|a.S.COPY_DST)),t=new o.h({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:i})}return t}class h extends n.A{constructor(t={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=(0,s.L)("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new r.c,this._boundsDirty=!0;const{attributes:e,indexBuffer:i,topology:n}=t;if(this.buffers=[],this.attributes={},e)for(const t in e)this.addAttribute(t,e[t]);this.instanceCount=t.instanceCount??1,i&&this.addIndex(i),this.topology=n||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){const i=function(t){return(t instanceof o.h||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=l(t.buffer,!1),t}(e);-1===this.buffers.indexOf(i.buffer)&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=i}addIndex(t){this.indexBuffer=l(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,function(t,e,i){const n=t.getAttribute(e);if(!n)return i.minX=0,i.minY=0,i.maxX=0,i.maxY=0,i;const r=n.buffer.data;let s=1/0,o=1/0,a=-1/0,l=-1/0;const h=r.BYTES_PER_ELEMENT,c=(n.offset||0)/h,u=(n.stride||8)/h;for(let t=c;t<r.length;t+=u){const e=r[t],i=r[t+1];e>a&&(a=e),i>l&&(l=i),e<s&&(s=e),i<o&&(o=i)}return i.minX=s,i.minY=o,i.maxX=a,i.maxY=l,i}(this,"aPosition",this._bounds)):this._bounds}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach((t=>t.destroy())),this.unload(),this.indexBuffer?.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}},8306:(t,e,i)=>{i.d(e,{m:()=>r});const n={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function r(t){return n[t]??n.float32}},848:(t,e,i)=>{i.d(e,{L:()=>r});var n=i(133);class r{constructor(){this.uid=(0,n.L)("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}},8475:(t,e,i)=>{i.d(e,{M:()=>c});var n=i(8875),r=i(133),s=i(9113),o=i(3513),a=i(3012),l=i(5099),h=i(5811);class c extends n.A{constructor(t){super(),this.uid=(0,r.L)("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:e,glProgram:i,groups:n,resources:s,compatibleRenderers:a,groupMap:c}=t;this.gpuProgram=e,this.glProgram=i,void 0===a&&(a=0,e&&(a|=l.W.WEBGPU),i&&(a|=l.W.WEBGL)),this.compatibleRenderers=a;const u={};if(s||n||(s={}),s&&n)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&n&&!c)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&n&&c)for(const t in c)for(const e in c[t]){const i=c[t][e];u[i]={group:t,binding:e,name:i}}else if(e&&n&&!c){const t=e.structsAndGroups.groups;c={},t.forEach((t=>{c[t.group]=c[t.group]||{},c[t.group][t.binding]=t.name,u[t.name]=t}))}else if(s){if(n={},c={},e){e.structsAndGroups.groups.forEach((t=>{c[t.group]=c[t.group]||{},c[t.group][t.binding]=t.name,u[t.name]=t}))}let t=0;for(const e in s)u[e]||(n[99]||(n[99]=new o.T,this._ownedBindGroups.push(n[99])),u[e]={group:99,binding:t,name:e},c[99]=c[99]||{},c[99][t]=e,t++);for(const t in s){const e=t;let i=s[t];i.source||i._resourceType||(i=new h.k(i));const r=u[e];r&&(n[r.group]||(n[r.group]=new o.T,this._ownedBindGroups.push(n[r.group])),n[r.group].setResource(i,r.binding))}}this.groups=n,this._uniformBindMap=c,this.resources=this._buildResourceAccessor(n,u)}addResource(t,e,i){var n,r;(n=this._uniformBindMap)[e]||(n[e]={}),(r=this._uniformBindMap[e])[i]||(r[i]=t),this.groups[e]||(this.groups[e]=new o.T,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const i={};for(const n in e){const r=e[n];Object.defineProperty(i,r.name,{get:()=>t[r.group].getResource(r.binding),set(e){t[r.group].setResource(e,r.binding)}})}return i}destroy(t=!1){this._destroyed||(this._destroyed=!0,this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach((t=>{t.destroy()})),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(t){const{gpu:e,gl:i,...n}=t;let r,o;return e&&(r=a.B.from(e)),i&&(o=s.M.from(i)),new c({gpuProgram:r,glProgram:o,...n})}}},5811:(t,e,i)=>{i.d(e,{k:()=>h});var n=i(133),r=i(7952);const s=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],o=s.reduce(((t,e)=>(t[e]=!0,t)),{});function a(t,e){switch(t){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const l=class t{constructor(e,i){this._touched=0,this.uid=(0,n.L)("uniform"),this._resourceType="uniformGroup",this._resourceId=(0,n.L)("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,i={...t.defaultOptions,...i},this.uniformStructures=e;const l={};for(const t in e){const i=e[t];if(i.name=t,i.size=i.size??1,!o[i.type]){const t=i.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(t){const[,e,n]=t;throw new Error(`Uniform type ${i.type} is not supported. Use type: '${e}', size: ${n} instead.`)}throw new Error(`Uniform type ${i.type} is not supported. Supported uniform types are: ${s.join(", ")}`)}i.value??(i.value=a(i.type,i.size)),l[t]=i.value}this.uniforms=l,this._dirtyId=1,this.ubo=i.ubo,this.isStatic=i.isStatic,this._signature=(0,r.X)(Object.keys(l).map((t=>`${t}-${e[t].type}`)).join("-"),"uniform-group")}update(){this._dirtyId++}};l.defaultOptions={ubo:!1,isStatic:!1};let h=l},7547:(t,e,i)=>{i.d(e,{U:()=>s});const n={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},r=class t{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(1&this.data)}set blend(t){!!(1&this.data)!==t&&(this.data^=1)}get offsets(){return!!(2&this.data)}set offsets(t){!!(2&this.data)!==t&&(this.data^=2)}set cullMode(t){"none"!==t?(this.culling=!0,this.clockwiseFrontFace="front"===t):this.culling=!1}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(4&this.data)}set culling(t){!!(4&this.data)!==t&&(this.data^=4)}get depthTest(){return!!(8&this.data)}set depthTest(t){!!(8&this.data)!==t&&(this.data^=8)}get depthMask(){return!!(32&this.data)}set depthMask(t){!!(32&this.data)!==t&&(this.data^=32)}get clockwiseFrontFace(){return!!(16&this.data)}set clockwiseFrontFace(t){!!(16&this.data)!==t&&(this.data^=16)}get blendMode(){return this._blendMode}set blendMode(t){this.blend="none"!==t,this._blendMode=t,this._blendModeId=n[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const e=new t;return e.depthTest=!1,e.blend=!0,e}};r.default2d=r.for2d();let s=r},1957:(t,e,i)=>{i.d(e,{K:()=>r,Q:()=>n});const n={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var r=(t=>(t[t.DISABLED=0]="DISABLED",t[t.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",t[t.MASK_ACTIVE=2]="MASK_ACTIVE",t[t.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",t[t.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",t[t.NONE=5]="NONE",t))(r||{})},800:(t,e,i)=>{i.d(e,{k:()=>g});var n=i(2577),r=i(8507);const s=[];async function o(t){if(!t)for(let t=0;t<s.length;t++){const e=s[t];if(e.value.test())return void await e.value.load()}}r.XO.handleByNamedList(r.Ag.Environment,s);var a=i(5559),l=i(4577),h=i(133),c=i(4670),u=i(6083),d=i(1257),p=i(7729),f=i(8875);const m=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],y=class t extends f.A{constructor(t){super(),this.tick=0,this.uid=(0,h.L)("renderer"),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const e=[...m,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(e={}){const i=!0===e.skipExtensionImports||!1===e.manageImports;await o(i),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const t in this._systemsHash){e={...this._systemsHash[t].constructor.defaultOptions,...e}}e={...t.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let t=0;t<this.runners.init.items.length;t++)await this.runners.init.items[t].init(e);this._initOptions=e}render(t,e){this.tick++;let i=t;if(i instanceof a.mc&&(i={container:i},e&&((0,c.t6)(c.lj,"passing a second argument is deprecated, please use render options instead"),i.target=e.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){const t=Array.isArray(i.clearColor)&&4===i.clearColor.length;i.clearColor=t?i.clearColor:n.Q.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.visible&&(i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i))}resize(t,e,i){const n=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),void 0!==i&&i!==n&&this.runners.resolutionChange.emit(i)}clear(t={}){t.target||(t.target=this.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=d.u.ALL);const{clear:e,clearColor:i,target:r,mipLevel:s,layer:o}=t;n.Q.shared.setValue(i??this.background.colorRgba),this.renderTarget.clear(r,e,n.Q.shared.toArray(),s??0,o??0)}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach((t=>{this.runners[t]=new p.C(t)}))}_addSystems(t){let e;for(e in t){const i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const t in this.runners)this.runners[t].add(i);return this}_addPipes(t,e){const i=e.reduce(((t,e)=>(t[e.name]=e.value,t)),{});t.forEach((t=>{const e=t.value,n=t.name,r=i[n];this.renderPipes[n]=new e(this,r?new r:null),this.runners.destroy.add(this.renderPipes[n])}))}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),(!0===t||"object"==typeof t&&t.releaseGlobalResources)&&u.L.release(),Object.values(this.runners).forEach((t=>{t.destroy()})),this._systemsHash=null,this.renderPipes=null,this.removeAllListeners()}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!(0,l.f)())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};y.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let g=y},7729:(t,e,i)=>{i.d(e,{C:()=>n});class n{constructor(t){this.items=[],this._name=t}emit(t,e,i,n,r,s,o,a){const{name:l,items:h}=this;for(let c=0,u=h.length;c<u;c++)h[c][l](t,e,i,n,r,s,o,a);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return-1!==e&&this.items.splice(e,1),this}contains(t){return-1!==this.items.indexOf(t)}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return 0===this.items.length}get name(){return this._name}}},7608:(t,e,i)=>{i.d(e,{N:()=>o});var n=i(1761),r=i(9939),s=i(6083);const o=new class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const i=n.e.get().createCanvas();i.width=t,i.height=e;const r=i.getContext("2d");return{canvas:i,context:r}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6);const n=((t=(0,r.U5)(t))<<17)+((e=(0,r.U5)(e))<<1);this._canvasPool[n]||(this._canvasPool[n]=[]);let s=this._canvasPool[n].pop();return s||(s=this._createCanvasAndContext(t,e)),s}returnCanvasAndContext(t){const e=t.canvas,{width:i,height:n}=e,r=(i<<17)+(n<<1);t.context.resetTransform(),t.context.clearRect(0,0,i,n),this._canvasPool[r].push(t)}clear(){this._canvasPool={}}};s.L.register(o)},5589:(t,e,i)=>{i.d(e,{g:()=>d});var n=i(8875),r=i(2079),s=i(9252),o=i(133),a=i(4670);const l=()=>{};var h=i(4195),c=i(583),u=i(1196);class d extends n.A{constructor({source:t,label:e,frame:i,orig:n,trim:r,defaultAnchor:a,defaultBorders:l,rotate:h,dynamic:u}={}){if(super(),this.uid=(0,o.L)("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new s.M,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new c.v,this.noFrame=!i,i)this.frame.copyFrom(i);else{const{width:t,height:e}=this._source;this.frame.width=t,this.frame.height=e}this.orig=n||this.frame,this.trim=r,this.rotate=h??0,this.defaultAnchor=a,this.defaultBorders=l,this.destroyed=!1,this.dynamic=u||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new u.N(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:i,height:n}=this._source,s=e.x/i,o=e.y/n,a=e.width/i,l=e.height/n;let h=this.rotate;if(h){const e=a/2,i=l/2,n=s+e,c=o+i;h=r.E.add(h,r.E.NW),t.x0=n+e*r.E.uX(h),t.y0=c+i*r.E.uY(h),h=r.E.add(h,2),t.x1=n+e*r.E.uX(h),t.y1=c+i*r.E.uY(h),h=r.E.add(h,2),t.x2=n+e*r.E.uX(h),t.y2=c+i*r.E.uY(h),h=r.E.add(h,2),t.x3=n+e*r.E.uX(h),t.y3=c+i*r.E.uY(h)}else t.x0=s,t.y0=o,t.x1=s+a,t.y1=o,t.x2=s+a,t.y2=o+l,t.x3=s,t.y3=o+l}destroy(t=!1){this._source&&(this._source.off("resize",this.update,this),t&&(this._source.destroy(),this._source=null)),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return(0,a.t6)(a.lj,"Texture.baseTexture is now Texture.source"),this._source}}d.EMPTY=new d({label:"EMPTY",source:new c.v({label:"EMPTY"})}),d.EMPTY.destroy=l,d.WHITE=new d({source:new h.P({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),d.WHITE.destroy=l},1196:(t,e,i)=>{i.d(e,{N:()=>s});var n=i(9313);const r=new n.u;class s{constructor(t,e){this.mapCoord=new n.u,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===e?t.width<10?0:.5:e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){void 0===e&&(e=t);const i=this.mapCoord;for(let n=0;n<t.length;n+=2){const r=t[n],s=t[n+1];e[n]=r*i.a+s*i.c+i.tx,e[n+1]=r*i.b+s*i.d+i.ty}return e}update(){const t=this._texture;this._updateID++;const e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);const i=t.orig,n=t.trim;n&&(r.set(i.width/n.width,0,0,i.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(r));const s=t.source,o=this.uClampFrame,a=this.clampMargin/s._resolution,l=this.clampOffset/s._resolution;return o[0]=(t.frame.x+a+l)/s.width,o[1]=(t.frame.y+a+l)/s.height,o[2]=(t.frame.x+t.frame.width-a+l)/s.width,o[3]=(t.frame.y+t.frame.height-a+l)/s.height,this.uClampOffset[0]=this.clampOffset/s.pixelWidth,this.uClampOffset[1]=this.clampOffset/s.pixelHeight,this.isSimple=t.frame.width===s.width&&t.frame.height===s.height&&0===t.rotate,!0}}},2437:(t,e,i)=>{i.d(e,{W:()=>h});var n=i(9939),r=i(6083),s=i(583),o=i(5589),a=i(218);let l=0;const h=new class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new a.n(this.textureOptions)}createTexture(t,e,i,n){const r=new s.v({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1,autoGenerateMipmaps:n});return new o.g({source:r,label:"texturePool_"+l++})}getOptimalTexture(t,e,i=1,r,s=!1){let o=Math.ceil(t*i-1e-6),a=Math.ceil(e*i-1e-6);o=(0,n.U5)(o),a=(0,n.U5)(a);const l=(o<<17)+(a<<2)+((s?1:0)<<1)+(r?1:0);this._texturePool[l]||(this._texturePool[l]=[]);let h=this._texturePool[l].pop();return h||(h=this.createTexture(o,a,r,s)),h.source._resolution=i,h.source.width=o/i,h.source.height=a/i,h.source.pixelWidth=o,h.source.pixelHeight=a,h.frame.x=0,h.frame.y=0,h.frame.width=t,h.frame.height=e,h.updateUvs(),this._poolKeyHash[h.uid]=l,h}getSameSizeTexture(t,e=!1){const i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t,e=!1){const i=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[i].push(t)}clear(t){if(t=!1!==t)for(const t in this._texturePool){const e=this._texturePool[t];if(e)for(let t=0;t<e.length;t++)e[t].destroy(!0)}this._texturePool={}}};r.L.register(h)},218:(t,e,i)=>{i.d(e,{n:()=>l});var n=i(8875),r=i(133),s=i(4670);const o=Object.create(null);const a=class t extends n.A{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...t.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){(0,s.t6)(s.lj,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this._sharedResourceId=null,this.emit("change",this)}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=function(t){const e=o[t];return void 0===e&&(o[t]=(0,r.L)("resource")),e}(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};a.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let l=a},4195:(t,e,i)=>{i.d(e,{P:()=>s});var n=i(8507),r=i(583);class s extends r.v{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let i=t.format;i||(i=e instanceof Float32Array?"rgba32float":e instanceof Int32Array||e instanceof Uint32Array?"rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?"rgba16uint":(Int8Array,"bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}s.extension=n.Ag.TextureSource},4884:(t,e,i)=>{i.d(e,{q:()=>o});var n=i(1761),r=i(8507),s=i(583);class o extends s.v{constructor(t){t.resource||(t.resource=n.e.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),this.resource.width===this.pixelWidth&&this.resource.height===this.pixelHeight||(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){const n=super.resize(t,e,i);return n&&this.resizeCanvas(),n}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}o.extension=r.Ag.TextureSource},8293:(t,e,i)=>{i.d(e,{b:()=>s});var n=i(8507),r=i(583);class s extends r.v{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}s.extension=n.Ag.TextureSource},583:(t,e,i)=>{i.d(e,{v:()=>h});var n=i(8875),r=i(9939),s=i(2698),o=i(133),a=i(218);const l=class t extends n.A{constructor(e={}){super(),this.options=e,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=(0,o.L)("textureSource"),this._resourceType="textureSource",this._resourceId=(0,o.L)("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.viewDimension="2d",this.arrayLayerCount=1,this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...t.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=e.format,this.dimension=e.dimensions,this.viewDimension=e.viewDimension??e.dimensions,this.arrayLayerCount=e.arrayLayerCount,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new a.n((0,s.S)(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(t){this._style.maxAnisotropy=t}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=(0,o.L)("resource"),this.emit("change",this),this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy?.();this._gpuData=Object.create(null)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);const n=Math.round(t*i),r=Math.round(e*i);return this.width=n/i,this.height=r/i,this._resolution=i,(this.pixelWidth!==n||this.pixelHeight!==r)&&(this._refreshPOT(),this.pixelWidth=n,this.pixelHeight=r,this.emit("resize",this),this._resourceId=(0,o.L)("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=(0,r.f3)(this.pixelWidth)&&(0,r.f3)(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};l.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",viewDimension:"2d",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let h=l},9726:(t,e,i)=>{var n=i(268),r=i(2406);const s=new class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||(0,n.R)(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=(0,r.z)(t);let s;for(let t=0;t<this.parsers.length;t++){const n=this.parsers[t];if(n.test(e)){s=n.getCacheableAssets(i,e);break}}const o=new Map(Object.entries(s||{}));s||i.forEach((t=>{o.set(t,e)}));const a=[...o.keys()],l={cacheKeys:a,keys:i};i.forEach((t=>{this._cacheMap.set(t,l)})),a.forEach((t=>{const i=s?s[t]:e;this._cache.has(t)&&this._cache.get(t)!==i&&(0,n.R)("[Cache] already has key:",t),this._cache.set(t,o.get(t))}))}remove(t){if(!this._cacheMap.has(t))return void(0,n.R)(`[Assets] Asset id ${t} was not found in the Cache`);const e=this._cacheMap.get(t);e.cacheKeys.forEach((t=>{this._cache.delete(t)})),e.keys.forEach((t=>{this._cacheMap.delete(t)}))}get parsers(){return this._parsers}};var o=i(8507),a=i(583),l=i(5589);const h=[];function c(t={}){const e=t&&t.resource,i=e?t.resource:t,n=e?t:{resource:t};for(let t=0;t<h.length;t++){const e=h[t];if(e.test(i))return new e(n)}throw new Error(`Could not find a source type for resource: ${n.resource}`)}o.XO.handleByList(o.Ag.TextureSource,h),l.g.from=function(t,e=!1){return"string"==typeof t?s.get(t):t instanceof a.v?new l.g({source:t}):function(t={},e=!1){const i=t&&t.resource,n=i?t.resource:t,r=i?t:{resource:t};if(!e&&s.has(n))return s.get(n);const o=new l.g({source:c(r)});return o.on("destroy",(()=>{s.has(n)&&s.remove(n)})),e||s.set(n,o),o}(t,e)},a.v.from=c},7952:(t,e,i)=>{i.d(e,{X:()=>s});const n=Object.create(null),r=Object.create(null);function s(t,e){let i=r[t];return void 0===i&&(void 0===n[e]&&(n[e]=1),r[t]=i=n[e]++),i}},5099:(t,e,i)=>{i.d(e,{W:()=>n});var n=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.CANVAS=4]="CANVAS",t[t.BOTH=3]="BOTH",t))(n||{})},5559:(t,e,i)=>{i.d(e,{mc:()=>H,u:()=>W,ig:()=>z,fR:()=>U});var n=i(8875),r=i(2577);var s=i(8507),o=i(9313),a=i(1652),l=i(2812),h=i(133),c=i(4670),u=i(268),d=i(8655);const p={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(t){"boolean"==typeof t&&!1===t?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(!0===t?{}:t))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(t){(0,c.t6)("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}};var f=i(9903);const m={allowChildren:!0,removeChildren(t=0,e){const i=e??this.children.length,n=i-t,r=[];if(n>0&&n<=i){for(let e=i-1;e>=t;e--){const t=this.children[e];t&&(r.push(t),t.parent=null)}(0,f.d)(this.children,t,i);const e=this.renderGroup||this.parentRenderGroup;e&&e.removeChildren(r);for(let t=0;t<r.length;++t){const e=r[t];e.parentRenderLayer?.detach(e),this.emit("childRemoved",e,this,t),r[t].emit("removed",this)}return r.length>0&&this._didViewChangeTick++,r}if(0===n&&0===this.children.length)return r;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(t){const e=this.getChildAt(t);return this.removeChild(e)},getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]},setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(t),this.addChildAt(t,e)},getChildIndex(t){const e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(t,e){this.allowChildren||(0,c.t6)(c.lj,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:i}=this;if(e<0||e>i.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${i.length}`);const n=t.parent===this;if(t.parent){const i=t.parent.children.indexOf(t);if(n){if(i===e)return t;t.parent.children.splice(i,1)}else t.removeFromParent()}e===i.length?i.push(t):i.splice(e,0,t),t.parent=this,t.didChange=!0,t._updateFlags=15;const r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(t),this.sortableChildren&&(this.sortDirty=!0),n||(this.emit("childAdded",t,this,e),t.emit("added",this)),t},swapChildren(t,e){if(t===e)return;const i=this.getChildIndex(t),n=this.getChildIndex(e);this.children[i]=e,this.children[n]=t;const r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...t){return 1===t.length?this.reparentChildAt(t[0],this.children.length):(t.forEach((t=>this.reparentChildAt(t,this.children.length))),t[0])},reparentChildAt(t,e){if(t.parent===this)return this.setChildIndex(t,e),t;const i=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);const n=this.worldTransform.clone();return n.invert(),i.prepend(n),t.setFromMatrix(i),t},replaceChild(t,e){t.updateLocalTransform(),this.addChildAt(e,this.getChildIndex(t)),e.setFromMatrix(t.localTransform),e.updateLocalTransform(),this.removeChild(t)}},y={collectRenderables(t,e,i){this.parentRenderLayer&&this.parentRenderLayer!==i||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(t,e,i):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,t):this.collectRenderablesWithEffects(t,e,i))},collectRenderablesSimple(t,e,i){const n=this.children,r=n.length;for(let s=0;s<r;s++)n[s].collectRenderables(t,e,i)},collectRenderablesWithEffects(t,e,i){const{renderPipes:n}=e;for(let e=0;e<this.effects.length;e++){const i=this.effects[e];n[i.pipe].push(i,this,t)}this.collectRenderablesSimple(t,e,i);for(let e=this.effects.length-1;e>=0;e--){const i=this.effects[e];n[i.pipe].pop(i,this,t)}}};var g=i(9049);const v=new class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach((t=>{this.add({test:t.test,maskClass:t})})))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){const i=this._tests[e];if(i.test(t))return d.Z.get(i.maskClass,t)}return t}returnMaskEffect(t){d.Z.return(t)}};s.XO.handleByList(s.Ag.MaskEffect,v._effectClasses);const b={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){const t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0)},addEffect(t){-1===this.effects.indexOf(t)&&(this.effects.push(t),this.effects.sort(((t,e)=>t.priority-e.priority)),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(t){const e=this.effects.indexOf(t);-1!==e&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(t){const e=this._maskEffect;e?.mask!==t&&(e&&(this.removeEffect(e),v.returnMaskEffect(e),this._maskEffect=null),null!=t&&(this._maskEffect=v.getMaskEffect(t),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},setMask(t){this._maskOptions={...this._maskOptions,...t},t.mask&&(this.mask=t.mask),this._markStructureAsChanged()},set filters(t){!Array.isArray(t)&&t&&(t=[t]);const e=this._filterEffect||(this._filterEffect=new g.a),i=t?.length>0,n=i!==e.filters?.length>0;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),n&&(i?this.addEffect(e):(this.removeEffect(e),e.filters=t??null))},get filters(){return this._filterEffect?.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new g.a),this._filterEffect.filterArea=t},get filterArea(){return this._filterEffect?.filterArea}},x={label:null,get name(){return(0,c.t6)(c.lj,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){(0,c.t6)(c.lj,"Container.name property has been removed, use Container.label instead"),this.label=t},getChildByName(t,e=!1){return this.getChildByLabel(t,e)},getChildByLabel(t,e=!1){const i=this.children;for(let e=0;e<i.length;e++){const n=i[e];if(n.label===t||t instanceof RegExp&&t.test(n.label))return n}if(e)for(let e=0;e<i.length;e++){const n=i[e].getChildByLabel(t,!0);if(n)return n}return null},getChildrenByLabel(t,e=!1,i=[]){const n=this.children;for(let e=0;e<n.length;e++){const r=n[e];(r.label===t||t instanceof RegExp&&t.test(r.label))&&i.push(r)}if(e)for(let e=0;e<n.length;e++)n[e].getChildrenByLabel(t,!0,i);return i}};var _=i(9636),w=i(2208);const S=new o.u,C={getFastGlobalBounds(t,e){e||(e=new _.c),e.clear(),this._getGlobalBoundsRecursive(!!t,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);const i=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(i.worldTransform),e},_getGlobalBoundsRecursive(t,e,i){let n=e;if(t&&this.parentRenderLayer&&this.parentRenderLayer!==i)return;if(7!==this.localDisplayStatus||!this.measurable)return;const r=!!this.effects.length;if((this.renderGroup||r)&&(n=w.o.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const t=this.bounds;n.addFrame(t.minX,t.minY,t.maxX,t.maxY,this.groupTransform)}const e=this.children;for(let r=0;r<e.length;r++)e[r]._getGlobalBoundsRecursive(t,n,i)}if(r){let t=!1;const i=this.renderGroup||this.parentRenderGroup;for(let e=0;e<this.effects.length;e++)this.effects[e].addBounds&&(t||(t=!0,n.applyMatrix(i.worldTransform)),this.effects[e].addBounds(n,!0));t&&n.applyMatrix(i.worldTransform.copyTo(S).invert()),e.addBounds(n),w.o.return(n)}else this.renderGroup&&(e.addBounds(n,this.relativeGroupTransform),w.o.return(n))}};var A=i(198),E=i(9443),M=i(7269);function T(t,e){const i=t.children;for(let t=0;t<i.length;t++){const n=i[t],r=n.uid,s=(65535&n._didViewChangeTick)<<16|65535&n._didContainerChangeTick,o=e.index;e.data[o]===r&&e.data[o+1]===s||(e.data[e.index]=r,e.data[e.index+1]=s,e.didChange=!0),e.index=o+2,n.children.length&&T(n,e)}return e.didChange}const k=new o.u,P={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){const i=Math.sign(this.scale.x)||1;this.scale.x=0!==e?t/e*i:i},_setHeight(t,e){const i=Math.sign(this.scale.y)||1;this.scale.y=0!==e?t/e*i:i},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new _.c});const t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),T(this,t),t.didChange&&(0,M.n)(this,t.localBounds,k),t.localBounds},getBounds(t,e){return(0,E.f)(this,t,e||new _.c)}},I={_onRender:null,set onRender(t){const e=this.renderGroup||this.parentRenderGroup;if(!t)return this._onRender&&e?.removeOnRender(this),void(this._onRender=null);this._onRender||e?.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}},O={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(R))}};function R(t,e){return t._zIndex-e._zIndex}var L=i(5101);const j={getGlobalPosition(t=new L.b,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,i=!1){const n=this.getGlobalTransform(w.u.get(),i);return e=n.apply(t,e),w.u.return(n),e},toLocal(t,e,i,n){e&&(t=e.toGlobal(t,i,n));const r=this.getGlobalTransform(w.u.get(),n);return i=r.applyInverse(t,i),w.u.return(r),i}};var D=i(3284);const F=new l.o(null),N=new l.o(null),B=new l.o(null,1,1),G=new l.o(null),z=1,W=2,U=4;class H extends n.A{constructor(t={}){super(),this.uid=(0,h.L)("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new o.u,this.relativeGroupTransform=new o.u,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new l.o(this,0,0),this._scale=B,this._pivot=N,this._origin=G,this._skew=F,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],function(t,e,i={}){for(const n in e)i[n]||void 0===e[n]||(t[n]=e[n])}(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach((t=>this.addChild(t))),t.parent?.addChild(this)}static mixin(t){(0,c.t6)("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),s.XO.mixin(H,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=4095&t}get _didChangeId(){return 4095&this._didContainerChangeTick|(4095&this._didViewChangeTick)<<12}addChild(...t){if(this.allowChildren||(0,c.t6)(c.lj,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let e=0;e<t.length;e++)this.addChild(t[e]);return t[0]}const e=t[0],i=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),i&&(i.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,i&&i.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,0!==e._zIndex&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let e=0;e<t.length;e++)this.removeChild(t[e]);return t[0]}const e=t[0],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,this.didChange||(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=d.Z.get(D.m,this),this.groupTransform=o.u.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t?.removeChild(this),d.Z.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&0===this.effects.length}get worldTransform(){return this._worldTransform||(this._worldTransform=new o.u),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*a.bO}set angle(t){this.rotation=t*a.Td}get pivot(){return this._pivot===N&&(this._pivot=new l.o(this,0,0)),this._pivot}set pivot(t){this._pivot===N&&(this._pivot=new l.o(this,0,0),this._origin!==G&&(0,u.R)("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),"number"==typeof t?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===F&&(this._skew=new l.o(this,0,0)),this._skew}set skew(t){this._skew===F&&(this._skew=new l.o(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===B&&(this._scale=new l.o(this,1,1)),this._scale}set scale(t){this._scale===B&&(this._scale=new l.o(this,0,0)),"string"==typeof t&&(t=parseFloat(t)),"number"==typeof t?this._scale.set(t):this._scale.copyFrom(t)}get origin(){return this._origin===G&&(this._origin=new l.o(this,0,0)),this._origin}set origin(t){this._origin===G&&(this._origin=new l.o(this,0,0),this._pivot!==N&&(0,u.R)("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),"number"==typeof t?this._origin.set(t):this._origin.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){const i=this.getLocalBounds();"object"==typeof t?(e=t.height??t.width,t=t.width):e??(e=t),void 0!==t&&this._setWidth(t,i.width),void 0!==e&&this._setHeight(e,i.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set("number"==typeof t.x?t.x:this.position.x,"number"==typeof t.y?t.y:this.position.y),this.scale.set("number"==typeof t.scaleX?t.scaleX||1:this.scale.x,"number"==typeof t.scaleY?t.scaleY||1:this.scale.y),this.rotation="number"==typeof t.rotation?t.rotation:this.rotation,this.skew.set("number"==typeof t.skewX?t.skewX:this.skew.x,"number"==typeof t.skewY?t.skewY:this.skew.y),this.pivot.set("number"==typeof t.pivotX?t.pivotX:this.pivot.x,"number"==typeof t.pivotY?t.pivotY:this.pivot.y),this.origin.set("number"==typeof t.originX?t.originX:this.origin.x,"number"==typeof t.originY?t.originY:this.origin.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,i=this._scale,n=this._pivot,r=this._origin,s=this._position,o=i._x,a=i._y,l=n._x,h=n._y,c=-r._x,u=-r._y;e.a=this._cx*o,e.b=this._sx*o,e.c=this._cy*a,e.d=this._sy*a,e.tx=s._x-(l*e.a+h*e.c)+(c*e.a+u*e.c)-c,e.ty=s._y-(l*e.b+h*e.d)+(c*e.b+u*e.d)-u}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=z,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const e=r.Q.shared.setValue(t??16777215).toBgrNumber();e!==this.localColor&&(this.localColor=e,this._updateFlags|=z,this._onUpdate())}get tint(){return(0,A.D)(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=W,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(2&this.localDisplayStatus)}set visible(t){const e=t?2:0;(2&this.localDisplayStatus)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=U,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",t))}get culled(){return!(4&this.localDisplayStatus)}set culled(t){const e=t?0:4;(4&this.localDisplayStatus)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=U,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(1&this.localDisplayStatus)}set renderable(t){const e=t?1:0;(1&this.localDisplayStatus)!==e&&(this._updateFlags|=U,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return 7===this.localDisplayStatus&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;let e;this.destroyed=!0,this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners();if(("boolean"==typeof t?t:t?.children)&&e)for(let i=0;i<e.length;++i)e[i].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}}s.XO.mixin(H,m,C,j,I,P,b,x,O,{cullArea:null,cullable:!1,cullableChildren:!0},p,A.R,y)},3284:(t,e,i)=>{i.d(e,{m:()=>o});var n=i(9313),r=i(848),s=i(2437);class o{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new n.u,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new r.L,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let t=0;t<e.length;t++){const i=e[t];i._updateFlags=15,this.addChild(i)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(s.W.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const t=this._parentCacheAsTextureRenderGroup;t&&!t.textureNeedsUpdate&&t.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){const e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup)return void this.addRenderGroupChild(t.renderGroup);t._onRender&&this.addOnRender(t);const e=t.children;for(let t=0;t<e.length;t++)this.addChild(e[t])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup)return void this._removeRenderGroupChild(t.renderGroup);const e=t.children;for(let t=0;t<e.length;t++)this.removeChild(e[t])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return 7===this.root.localDisplayStatus&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const e=this.root.children;for(let i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const i=t.children;for(let t=0;t<i.length;t++)this._getChildren(i[t],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return 1&this._matrixDirty?(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new n.u),this._inverseWorldTransform.copyFrom(this.worldTransform).invert()):this._inverseWorldTransform}get textureOffsetInverseTransform(){return 2&this._matrixDirty?(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new n.u),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y)):this._textureOffsetInverseTransform}get inverseParentTextureTransform(){if(!(4&this._matrixDirty))return this._inverseParentTextureTransform;this._matrixDirty&=-5;const t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new n.u),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}},9636:(t,e,i)=>{i.d(e,{c:()=>o});var n=i(9313),r=i(9252);const s=new n.u;class o{constructor(t=1/0,e=1/0,i=-1/0,n=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=s,this.minX=t,this.minY=e,this.maxX=i,this.maxY=n}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new r.M);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=s,this}set(t,e,i,n){this.minX=t,this.minY=e,this.maxX=i,this.maxY=n}addFrame(t,e,i,n,r){r||(r=this.matrix);const s=r.a,o=r.b,a=r.c,l=r.d,h=r.tx,c=r.ty;let u=this.minX,d=this.minY,p=this.maxX,f=this.maxY,m=s*t+a*e+h,y=o*t+l*e+c;m<u&&(u=m),y<d&&(d=y),m>p&&(p=m),y>f&&(f=y),m=s*i+a*e+h,y=o*i+l*e+c,m<u&&(u=m),y<d&&(d=y),m>p&&(p=m),y>f&&(f=y),m=s*t+a*n+h,y=o*t+l*n+c,m<u&&(u=m),y<d&&(d=y),m>p&&(p=m),y>f&&(f=y),m=s*i+a*n+h,y=o*i+l*n+c,m<u&&(u=m),y<d&&(d=y),m>p&&(p=m),y>f&&(f=y),this.minX=u,this.minY=d,this.maxX=p,this.maxY=f}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const e=this.minX,i=this.minY,n=this.maxX,r=this.maxY,{a:s,b:o,c:a,d:l,tx:h,ty:c}=t;let u=s*e+a*i+h,d=o*e+l*i+c;this.minX=u,this.minY=d,this.maxX=u,this.maxY=d,u=s*n+a*i+h,d=o*n+l*i+c,this.minX=u<this.minX?u:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=u>this.maxX?u:this.maxX,this.maxY=d>this.maxY?d:this.maxY,u=s*e+a*r+h,d=o*e+l*r+c,this.minX=u<this.minX?u:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=u>this.maxX?u:this.maxX,this.maxY=d>this.maxY?d:this.maxY,u=s*n+a*r+h,d=o*n+l*r+c,this.minX=u<this.minX?u:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=u>this.maxX?u:this.maxX,this.maxY=d>this.maxY?d:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,n){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),this.maxY>n&&(this.maxY=n),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new o(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,i,n){let r=this.minX,s=this.minY,o=this.maxX,a=this.maxY;n||(n=this.matrix);const l=n.a,h=n.b,c=n.c,u=n.d,d=n.tx,p=n.ty;for(let n=e;n<i;n+=2){const e=t[n],i=t[n+1],f=l*e+c*i+d,m=h*e+u*i+p;r=f<r?f:r,s=m<s?m:s,o=f>o?f:o,a=m>a?m:a}this.minX=r,this.minY=s,this.maxX=o,this.maxY=a}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}},9443:(t,e,i)=>{i.d(e,{E:()=>a,f:()=>s});var n=i(9313),r=i(2208);function s(t,e,i){let s,l;return i.clear(),t.parent?e?s=t.parent.worldTransform:(l=r.u.get().identity(),s=a(t,l)):s=n.u.IDENTITY,o(t,i,s,e),l&&r.u.return(l),i.isValid||i.set(0,0,0,0),i}function o(t,e,i,s){if(!t.visible||!t.measurable)return;let a;s?a=t.worldTransform:(t.updateLocalTransform(),a=r.u.get(),a.appendFrom(t.localTransform,i));const l=e,h=!!t.effects.length;if(h&&(e=r.o.get().clear()),t.boundsArea)e.addRect(t.boundsArea,a);else{const i=t.bounds;i&&!i.isEmpty()&&(e.matrix=a,e.addBounds(i));for(let i=0;i<t.children.length;i++)o(t.children[i],e,a,s)}if(h){for(let i=0;i<t.effects.length;i++)t.effects[i].addBounds?.(e);l.addBounds(e,n.u.IDENTITY),r.o.return(e)}s||r.u.return(a)}function a(t,e){const i=t.parent;return i&&(a(i,e),i.updateLocalTransform(),e.append(i.localTransform)),e}},7269:(t,e,i)=>{i.d(e,{n:()=>s});var n=i(9313),r=i(2208);function s(t,e,i){return e.clear(),i||(i=n.u.IDENTITY),o(t,e,i,t,!0),e.isValid||e.set(0,0,0,0),e}function o(t,e,i,s,a){let l;if(a)l=r.u.get(),l=i.copyTo(l);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();const e=t.localTransform;l=r.u.get(),l.appendFrom(e,i)}const h=e,c=!!t.effects.length;if(c&&(e=r.o.get().clear()),t.boundsArea)e.addRect(t.boundsArea,l);else{t.renderPipeId&&(e.matrix=l,e.addBounds(t.bounds));const i=t.children;for(let t=0;t<i.length;t++)o(i[t],e,l,s,!1)}if(c){for(let i=0;i<t.effects.length;i++)t.effects[i].addLocalBounds?.(e,s);h.addBounds(e,n.u.IDENTITY),r.o.return(e)}r.u.return(l)}},2208:(t,e,i)=>{i.d(e,{o:()=>a,u:()=>o});var n=i(9313),r=i(8655),s=i(9636);const o=r.Z.getPool(n.u),a=r.Z.getPool(s.c)},198:(t,e,i)=>{i.d(e,{D:()=>a,R:()=>l});var n=i(9313),r=i(9443),s=i(2208),o=i(753);function a(t){return((255&t)<<16)+(65280&t)+(t>>16&255)}const l={getGlobalAlpha(t){if(t)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,i=this.parent;for(;i;)e*=i.alpha,i=i.parent;return e},getGlobalTransform(t=new n.u,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();const i=(0,r.E)(this,s.u.get().identity());return t.appendFrom(this.localTransform,i),s.u.return(i),t},getGlobalTint(t){if(t)return this.renderGroup?a(this.renderGroup.worldColor):this.parentRenderGroup?a((0,o.j)(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,i=this.parent;for(;i;)e=(0,o.j)(e,i.localColor),i=i.parent;return a(e)}}},2698:(t,e,i)=>{function n(t){const e={};for(const i in t)void 0!==t[i]&&(e[i]=t[i]);return e}i.d(e,{S:()=>n})},753:(t,e,i)=>{i.d(e,{j:()=>s});var n=i(4676);const r=16777215;function s(t,e){return t===r?e:e===r?t:(0,n.u)(t,e)}},4676:(t,e,i)=>{function n(t,e){if(16777215===t||!e)return e;if(16777215===e||!t)return t;return(((t>>16&255)*(e>>16&255)/255|0)<<16)+(((t>>8&255)*(e>>8&255)/255|0)<<8)+((255&t)*(255&e)/255|0)}i.d(e,{u:()=>n})},2760:(t,e,i)=>{function n(t,e,i){const n=(t>>24&255)/255;e[i++]=(255&t)/255*n,e[i++]=(t>>8&255)/255*n,e[i++]=(t>>16&255)/255*n,e[i++]=n}i.d(e,{V:()=>n})},6954:(t,e,i)=>{i.d(e,{G:()=>o});var n=i(9313),r=i(4676);const s=new n.u;class o{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|65280&t|(255&t)<<16,i=this.renderable;return i?(0,r.u)(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(255*this.alpha<<24)}get transform(){return this.renderable?.groupTransform||s}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}},4663:(t,e,i)=>{i.d(e,{A:()=>_});var n=i(4670),r=i(4985),s=i(8393),o=i(8507),a=i(848),l=i(4334);class h{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class c{constructor(){this.instructions=new a.L}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const u=class t{constructor(t){this._renderer=t,this._managedContexts=new l.s({renderer:t,type:"resource",name:"graphicsContext"})}init(e){t.defaultOptions.bezierSmoothness=e?.bezierSmoothness??t.defaultOptions.bezierSmoothness}getContextRenderData(t){return this.getGpuContext(t).graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=t._gpuData,i=!!e[this._renderer.uid],n=e[this._renderer.uid]||this._initContext(t);return!t.dirty&&i||(i&&n.reset(),n.isBatchable=!1,t.dirty=!1),n}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=new c;return this.getGpuContext(t).graphicsData=e,e.init(),e}_initContext(t){const e=new h;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};u.extension={type:[o.Ag.CanvasSystem],name:"graphicsContext"},u.defaultOptions={bezierSmoothness:.5};let d=u;var p=i(7547);class f{constructor(t,e){this.state=p.U.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new l.s({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){return!1}addRenderable(t,e){this._managedGraphics.add(t),this.renderer.renderPipes.batch.break(e),e.add(t)}updateRenderable(t){}execute(t){t.isRenderable&&this._adaptor.execute(this,t)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}}f.extension={type:[o.Ag.CanvasPipes],name:"graphics"};var m=i(378),y=i(8655),g=i(2760),v=i(6954);class b{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach((t=>{y.Z.return(t)})),this.batches.length=0}}class x{constructor(t,e){this.state=p.U.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new l.s({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){const e=t.context,i=!!t._gpuData,n=this.renderer.graphicsContext.updateGpuContext(e);return!(!n.isBatchable&&i===n.isBatchable)}addRenderable(t,e){const i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const e=this._getGpuDataForRenderable(t).batches;for(let t=0;t<e.length;t++){const i=e[t];i._batcher.updateElement(i)}}execute(t){if(!t.isRenderable)return;const e=this.renderer,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;const n=i.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const r=n.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=e._roundPixels|t._roundPixels,(0,g.V)(t.groupColorAlpha,r.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=this._getGpuDataForRenderable(t),i=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),i.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){const i=this.renderer.renderPipes.batch,n=this._getGpuDataForRenderable(t).batches;for(let t=0;t<n.length;t++){const r=n[t];i.addToBatch(r,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){const e=new b;return t._gpuData[this.renderer.uid]=e,this._managedGraphics.add(t),e}_updateBatchesForRenderable(t,e){const i=t.context,n=this.renderer.graphicsContext.getGpuContext(i),r=this.renderer._roundPixels|t._roundPixels;e.batches=n.batches.map((e=>{const i=y.Z.get(v.G);return e.copyTo(i),i.renderable=t,i.roundPixels=r,i}))}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}x.extension={type:[o.Ag.WebGLPipes,o.Ag.WebGPUPipes],name:"graphics"},o.XO.add(f),o.XO.add(x),o.XO.add(d),o.XO.add(m.GH);class _ extends r.l{constructor(t){t instanceof s.T&&(t={context:t});const{context:e,roundPixels:i,...n}=t||{};super({label:"Graphics",...n}),this.renderPipeId="graphics",e?this.context=e:(this.context=this._ownedContext=new s.T,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=i??!1}set context(t){t!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=t,this._context.on("update",this.onViewUpdate,this),this._context.on("unload",this.unload,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):!0!==t&&!0!==t?.context||this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_onTouch(t){this._gcLastUsed=t,this._context._gcLastUsed=t}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){if(t)return new _(this._context.clone());this._ownedContext=null;return new _(this._context)}lineStyle(t,e,i){(0,n.t6)(n.lj,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const r={};return t&&(r.width=t),e&&(r.color=e),i&&(r.alpha=i),this.context.strokeStyle=r,this}beginFill(t,e){(0,n.t6)(n.lj,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const i={};return void 0!==t&&(i.color=t),void 0!==e&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){(0,n.t6)(n.lj,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const t=this.context.strokeStyle;return t.width===s.T.defaultStrokeStyle.width&&t.color===s.T.defaultStrokeStyle.color&&t.alpha===s.T.defaultStrokeStyle.alpha||this.context.stroke(),this}drawCircle(...t){return(0,n.t6)(n.lj,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return(0,n.t6)(n.lj,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return(0,n.t6)(n.lj,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return(0,n.t6)(n.lj,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return(0,n.t6)(n.lj,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return(0,n.t6)(n.lj,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}},8393:(t,e,i)=>{i.d(e,{T:()=>ht});var n=i(8875),r=i(2577),s=i(9313),o=i(5101),a=i(5589),l=i(133),h=i(4670),c=i(9636),u=i(268),d=i(8133);var p=i(6125),f=i(9252);class m{constructor(t=0,e=0,i=0,n=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=n}clone(){return new m(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,n=(e-this.y)/this.halfHeight;return i*=i,n*=n,i+n<=1}strokeContains(t,e,i,n=.5){const{halfWidth:r,halfHeight:s}=this;if(r<=0||s<=0)return!1;const o=i*(1-n),a=i-o,l=r-a,h=s-a,c=r+o,u=s+o,d=t-this.x,p=e-this.y;return d*d/(l*l)+p*p/(h*h)>1&&d*d/(c*c)+p*p/(u*u)<=1}getBounds(t){return t||(t=new f.M),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=2*this.halfWidth,t.height=2*this.halfHeight,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function y(t,e,i,n,r,s){const o=r-i,a=s-n,l=o*o+a*a;let h,c,u=-1;0!==l&&(u=((t-i)*o+(e-n)*a)/l),u<0?(h=i,c=n):u>1?(h=r,c=s):(h=i+u*o,c=n+u*a);const d=t-h,p=e-c;return d*d+p*p}class g{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if("number"!=typeof e[0]){const t=[];for(let i=0,n=e.length;i<n;i++)t.push(e[i].x,e[i].y);e=t}this.points=e,this.closePath=!0}isClockwise(){let t=0;const e=this.points,i=e.length;for(let n=0;n<i;n+=2){const r=e[n],s=e[n+1];t+=(e[(n+2)%i]-r)*(e[(n+3)%i]+s)}return t<0}containsPolygon(t){const e=this.getBounds(undefined),i=t.getBounds(undefined);if(!e.containsRect(i))return!1;const n=t.points;for(let t=0;t<n.length;t+=2){const e=n[t],i=n[t+1];if(!this.contains(e,i))return!1}return!0}clone(){const t=this.points.slice(),e=new g(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1;const n=this.points.length/2;for(let r=0,s=n-1;r<n;s=r++){const n=this.points[2*r],o=this.points[2*r+1],a=this.points[2*s],l=this.points[2*s+1];o>e!=l>e&&t<(e-o)/(l-o)*(a-n)+n&&(i=!i)}return i}strokeContains(t,e,i,n=.5){const r=i*i,s=r*(1-n),o=r-s,{points:a}=this,l=a.length-(this.closePath?0:2);for(let i=0;i<l;i+=2){const n=a[i],r=a[i+1],l=a[(i+2)%a.length],h=a[(i+3)%a.length];if(y(t,e,n,r,l,h)<=(Math.sign((l-n)*(e-r)-(h-r)*(t-n))<0?o:s))return!0}return!1}getBounds(t){t||(t=new f.M);const e=this.points;let i=1/0,n=-1/0,r=1/0,s=-1/0;for(let t=0,o=e.length;t<o;t+=2){const o=e[t],a=e[t+1];i=o<i?o:i,n=o>n?o:n,r=a<r?a:r,s=a>s?a:s}return t.x=i,t.width=n-i,t.y=r,t.height=s-r,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce(((t,e)=>`${t}, ${e}`),"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return(0,h.t6)("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return(0,h.t6)("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const v=(t,e,i,n,r,s,o)=>{const a=t-i,l=e-n,h=Math.sqrt(a*a+l*l);return h>=r-s&&h<=r+o};class b{constructor(t=0,e=0,i=0,n=0,r=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=n,this.radius=r}getBounds(t){return t||(t=new f.M),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new b(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let n=t-(this.x+i),r=e-(this.y+i);const s=i*i;if(n*n+r*r<=s)return!0;if(n=t-(this.x+this.width-i),n*n+r*r<=s)return!0;if(r=e-(this.y+this.height-i),n*n+r*r<=s)return!0;if(n=t-(this.x+i),n*n+r*r<=s)return!0}return!1}strokeContains(t,e,i,n=.5){const{x:r,y:s,width:o,height:a,radius:l}=this,h=i*(1-n),c=i-h,u=r+l,d=s+l,p=r+o,f=s+a;return(t>=r-h&&t<=r+c||t>=p-c&&t<=p+h)&&e>=d&&e<=d+(a-2*l)||((e>=s-h&&e<=s+c||e>=f-c&&e<=f+h)&&t>=u&&t<=u+(o-2*l)||(t<u&&e<d&&v(t,e,u,d,l,c,h)||t>p-l&&e<d&&v(t,e,p-l,d,l,c,h)||t>p-l&&e>f-l&&v(t,e,p-l,f-l,l,c,h)||t<u&&e>f-l&&v(t,e,u,f-l,l,c,h)))}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}var x=i(378);const _=8,w=1.1920929e-7,S=1,C=.01,A=0,E=0;function M(t,e,i,n,r,s,o,a,l,h){const c=Math.min(.99,Math.max(0,h??x.GH.defaultOptions.bezierSmoothness));let u=(S-c)/1;return u*=u,function(t,e,i,n,r,s,o,a,l,h){T(t,e,i,n,r,s,o,a,l,h,0),l.push(o,a)}(e,i,n,r,s,o,a,l,t,u),t}function T(t,e,i,n,r,s,o,a,l,h,c){if(c>_)return;const u=Math.PI,d=(t+i)/2,p=(e+n)/2,f=(i+r)/2,m=(n+s)/2,y=(r+o)/2,g=(s+a)/2,v=(d+f)/2,b=(p+m)/2,x=(f+y)/2,S=(m+g)/2,M=(v+x)/2,k=(b+S)/2;if(c>0){let c=o-t,d=a-e;const p=Math.abs((i-o)*d-(n-a)*c),f=Math.abs((r-o)*d-(s-a)*c);let m,y;if(p>w&&f>w){if((p+f)*(p+f)<=h*(c*c+d*d)){if(A<C)return void l.push(M,k);const h=Math.atan2(s-n,r-i);if(m=Math.abs(h-Math.atan2(n-e,i-t)),y=Math.abs(Math.atan2(a-s,o-r)-h),m>=u&&(m=2*u-m),y>=u&&(y=2*u-y),m+y<A)return void l.push(M,k);if(0!==E){if(m>E)return void l.push(i,n);if(y>E)return void l.push(r,s)}}}else if(p>w){if(p*p<=h*(c*c+d*d)){if(A<C)return void l.push(M,k);if(m=Math.abs(Math.atan2(s-n,r-i)-Math.atan2(n-e,i-t)),m>=u&&(m=2*u-m),m<A)return l.push(i,n),void l.push(r,s);if(0!==E&&m>E)return void l.push(i,n)}}else if(f>w){if(f*f<=h*(c*c+d*d)){if(A<C)return void l.push(M,k);if(m=Math.abs(Math.atan2(a-s,o-r)-Math.atan2(s-n,r-i)),m>=u&&(m=2*u-m),m<A)return l.push(i,n),void l.push(r,s);if(0!==E&&m>E)return void l.push(r,s)}}else if(c=M-(t+o)/2,d=k-(e+a)/2,c*c+d*d<=h)return void l.push(M,k)}T(t,e,d,p,v,b,M,k,l,h,c+1),T(M,k,x,S,y,g,o,a,l,h,c+1)}const k=8,P=1.1920929e-7,I=.01,O=0;function R(t,e,i,n,r,s,o,a){let l=(1-Math.min(.99,Math.max(0,a??x.GH.defaultOptions.bezierSmoothness)))/1;return l*=l,function(t,e,i,n,r,s,o,a){L(o,t,e,i,n,r,s,a,0),o.push(r,s)}(e,i,n,r,s,o,t,l),t}function L(t,e,i,n,r,s,o,a,l){if(l>k)return;const h=Math.PI,c=(e+n)/2,u=(i+r)/2,d=(n+s)/2,p=(r+o)/2,f=(c+d)/2,m=(u+p)/2;let y=s-e,g=o-i;const v=Math.abs((n-s)*g-(r-o)*y);if(v>P){if(v*v<=a*(y*y+g*g)){if(O<I)return void t.push(f,m);let a=Math.abs(Math.atan2(o-r,s-n)-Math.atan2(r-i,n-e));if(a>=h&&(a=2*h-a),a<O)return void t.push(f,m)}}else if(y=f-(e+s)/2,g=m-(i+o)/2,y*y+g*g<=a)return void t.push(f,m);L(t,e,i,c,u,f,m,a,l+1),L(t,f,m,d,p,s,o,a,l+1)}function j(t,e,i,n,r,s,o,a){let l=Math.abs(r-s);(!o&&r>s||o&&s>r)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(n,1/3)*(l/Math.PI))));let h=l/(a=Math.max(a,3)),c=r;h*=o?-1:1;for(let r=0;r<a+1;r++){const r=e+Math.cos(c)*n,s=i+Math.sin(c)*n;t.push(r,s),c+=h}}const D=2*Math.PI,F={centerX:0,centerY:0,ang1:0,ang2:0},N=({x:t,y:e},i,n,r,s,o,a,l)=>{const h=r*(t*=i)-s*(e*=n),c=s*t+r*e;return l.x=h+o,l.y=c+a,l};function B(t,e){const i=-1.5707963267948966===e?-.551915024494:4/3*Math.tan(e/4),n=1.5707963267948966===e?.551915024494:i,r=Math.cos(t),s=Math.sin(t),o=Math.cos(t+e),a=Math.sin(t+e);return[{x:r-s*n,y:s+r*n},{x:o+a*n,y:a-o*n},{x:o,y:a}]}const G=(t,e,i,n)=>{let r=t*i+e*n;return r>1&&(r=1),r<-1&&(r=-1),(t*n-e*i<0?-1:1)*Math.acos(r)};function z(t,e,i,n,r,s,o,a=0,l=0,h=0){if(0===s||0===o)return;const c=Math.sin(a*D/360),u=Math.cos(a*D/360),d=u*(e-n)/2+c*(i-r)/2,p=-c*(e-n)/2+u*(i-r)/2;if(0===d&&0===p)return;s=Math.abs(s),o=Math.abs(o);const f=Math.pow(d,2)/Math.pow(s,2)+Math.pow(p,2)/Math.pow(o,2);f>1&&(s*=Math.sqrt(f),o*=Math.sqrt(f)),((t,e,i,n,r,s,o,a,l,h,c,u,d)=>{const p=Math.pow(r,2),f=Math.pow(s,2),m=Math.pow(c,2),y=Math.pow(u,2);let g=p*f-p*y-f*m;g<0&&(g=0),g/=p*y+f*m,g=Math.sqrt(g)*(o===a?-1:1);const v=g*r/s*u,b=g*-s/r*c,x=h*v-l*b+(t+i)/2,_=l*v+h*b+(e+n)/2,w=(c-v)/r,S=(u-b)/s,C=(-c-v)/r,A=(-u-b)/s,E=G(1,0,w,S);let M=G(w,S,C,A);0===a&&M>0&&(M-=D),1===a&&M<0&&(M+=D),d.centerX=x,d.centerY=_,d.ang1=E,d.ang2=M})(e,i,n,r,s,o,l,h,c,u,d,p,F);let{ang1:m,ang2:y}=F;const{centerX:g,centerY:v}=F;let b=Math.abs(y)/(D/4);Math.abs(1-b)<1e-7&&(b=1);const x=Math.max(Math.ceil(b),1);y/=x;let _=t[t.length-2],w=t[t.length-1];const S={x:0,y:0};for(let e=0;e<x;e++){const e=B(m,y),{x:i,y:n}=N(e[0],s,o,u,c,g,v,S),{x:r,y:a}=N(e[1],s,o,u,c,g,v,S),{x:l,y:h}=N(e[2],s,o,u,c,g,v,S);M(t,_,w,i,n,r,a,l,h),_=l,w=h,m+=y}}const W=new f.M;class U{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new c.c,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const i=this._currentPoly.points,n=i[i.length-2],r=i[i.length-1];return n===t&&r===e||i.push(t,e),this}arc(t,e,i,n,r,s){this._ensurePoly(!1);return j(this._currentPoly.points,t,e,i,n,r,s),this}arcTo(t,e,i,n,r){this._ensurePoly();return function(t,e,i,n,r,s){const o=t[t.length-2],a=t[t.length-1]-i,l=o-e,h=r-i,c=n-e,u=Math.abs(a*c-l*h);if(u<1e-8||0===s)return void(t[t.length-2]===e&&t[t.length-1]===i||t.push(e,i));const d=a*a+l*l,p=h*h+c*c,f=a*h+l*c,m=s*Math.sqrt(d)/u,y=s*Math.sqrt(p)/u,g=m*f/d,v=y*f/p,b=m*c+y*l,x=m*h+y*a,_=l*(y+g),w=a*(y+g),S=c*(m+v),C=h*(m+v);j(t,b+e,x+i,s,Math.atan2(w-x,_-b),Math.atan2(C-x,S-b),l*h>c*a)}(this._currentPoly.points,t,e,i,n,r),this}arcToSvg(t,e,i,n,r,s,o){return z(this._currentPoly.points,this._currentPoly.lastX,this._currentPoly.lastY,s,o,t,e,i,n,r),this}bezierCurveTo(t,e,i,n,r,s,o){this._ensurePoly();const a=this._currentPoly;return M(this._currentPoly.points,a.lastX,a.lastY,t,e,i,n,r,s,o),this}quadraticCurveTo(t,e,i,n,r){this._ensurePoly();const s=this._currentPoly;return R(this._currentPoly.points,s.lastX,s.lastY,t,e,i,n,r),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0)).transform(e);const i=this.shapePrimitives,n=i.length;for(let e=0;e<t.instructions.length;e++){const i=t.instructions[e];this[i.action](...i.data)}if(t.checkForHoles&&i.length-n>1){let t=null;for(let e=n;e<i.length;e++){const n=i[e];if("polygon"===n.shape.type){const r=n.shape,s=t?.shape;s&&s.containsPolygon(r)?(t.holes||(t.holes=[]),t.holes.push(n),i.copyWithin(e,e+1),i.length--,e--):t=n}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,n,r){return this.drawShape(new f.M(t,e,i,n),r),this}circle(t,e,i,n){return this.drawShape(new p.j(t,e,i),n),this}poly(t,e,i){const n=new g(t);return n.closePath=e,this.drawShape(n,i),this}regularPoly(t,e,i,n,r=0,s){n=Math.max(0|n,3);const o=-1*Math.PI/2+r,a=2*Math.PI/n,l=[];for(let r=0;r<n;r++){const n=o-r*a;l.push(t+i*Math.cos(n),e+i*Math.sin(n))}return this.poly(l,!0,s),this}roundPoly(t,e,i,n,r,s=0,o){if(n=Math.max(0|n,3),r<=0)return this.regularPoly(t,e,i,n,s);const a=i*Math.sin(Math.PI/n)-.001;r=Math.min(r,a);const l=-1*Math.PI/2+s,h=2*Math.PI/n,c=(n-2)*Math.PI/n/2;for(let s=0;s<n;s++){const n=s*h+l,a=t+i*Math.cos(n),u=e+i*Math.sin(n),d=n+Math.PI+c,p=n-Math.PI-c,f=a+r*Math.cos(d),m=u+r*Math.sin(d),y=a+r*Math.cos(p),g=u+r*Math.sin(p);0===s?this.moveTo(f,m):this.lineTo(f,m),this.quadraticCurveTo(a,u,y,g,o)}return this.closePath()}roundShape(t,e,i=!1,n){return t.length<3?this:(i?function(t,e,i,n){const r=(t,e)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),s=(t,e,i)=>({x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i}),o=e.length;for(let a=0;a<o;a++){const l=e[(a+1)%o],h=l.radius??i;if(h<=0){0===a?t.moveTo(l.x,l.y):t.lineTo(l.x,l.y);continue}const c=e[a],u=e[(a+2)%o],d=r(c,l);let p;p=d<1e-4?l:s(l,c,Math.min(d/2,h)/d);const f=r(u,l);let m;m=f<1e-4?l:s(l,u,Math.min(f/2,h)/f),0===a?t.moveTo(p.x,p.y):t.lineTo(p.x,p.y),t.quadraticCurveTo(l.x,l.y,m.x,m.y,n)}}(this,t,e,n):function(t,e,i){const n=(t,e)=>{const i=e.x-t.x,n=e.y-t.y,r=Math.sqrt(i*i+n*n);return{len:r,nx:i/r,ny:n/r}},r=(e,i)=>{0===e?t.moveTo(i.x,i.y):t.lineTo(i.x,i.y)};let s=e[e.length-1];for(let o=0;o<e.length;o++){const a=e[o%e.length],l=a.radius??i;if(l<=0){r(o,a),s=a;continue}const h=e[(o+1)%e.length],c=n(a,s),u=n(a,h);if(c.len<1e-4||u.len<1e-4){r(o,a),s=a;continue}let d=Math.asin(c.nx*u.ny-c.ny*u.nx),p=1,f=!1;c.nx*u.nx-c.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,p=-1,f=!0):d>0&&(p=-1,f=!0);const m=d/2;let y,g=Math.abs(Math.cos(m)*l/Math.sin(m));g>Math.min(c.len/2,u.len/2)?(g=Math.min(c.len/2,u.len/2),y=Math.abs(g*Math.sin(m)/Math.cos(m))):y=l;const v=a.x+u.nx*g+-u.ny*y*p,b=a.y+u.ny*g+u.nx*y*p,x=Math.atan2(c.ny,c.nx)+Math.PI/2*p,_=Math.atan2(u.ny,u.nx)-Math.PI/2*p;0===o&&t.moveTo(v+Math.cos(x)*y,b+Math.sin(x)*y),t.arc(v,b,y,x,_,f),s=a}}(this,t,e),this.closePath())}filletRect(t,e,i,n,r){if(0===r)return this.rect(t,e,i,n);const s=Math.min(i,n)/2,o=Math.min(s,Math.max(-s,r)),a=t+i,l=e+n,h=o<0?-o:0,c=Math.abs(o);return this.moveTo(t,e+c).arcTo(t+h,e+h,t+c,e,c).lineTo(a-c,e).arcTo(a-h,e+h,a,e+c,c).lineTo(a,l-c).arcTo(a-h,l-h,t+i-c,l,c).lineTo(t+c,l).arcTo(t+h,l-h,t,l-c,c).closePath()}chamferRect(t,e,i,n,r,s){if(r<=0)return this.rect(t,e,i,n);const o=Math.min(r,Math.min(i,n)/2),a=t+i,l=e+n,h=[t+o,e,a-o,e,a,e+o,a,l-o,a-o,l,t+o,l,t,l-o,t,e+o];for(let t=h.length-1;t>=2;t-=2)h[t]===h[t-2]&&h[t-1]===h[t-3]&&h.splice(t-1,2);return this.poly(h,!0,s)}ellipse(t,e,i,n,r){return this.drawShape(new m(t,e,i,n),r),this}roundRect(t,e,i,n,r,s){return this.drawShape(new b(t,e,i,n,r),s),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new g,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new g,t)){const t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let e=t.shape.x,i=t.shape.y;if(t.transform&&!t.transform.isIdentity()){const n=t.transform,r=e;e=n.a*e+n.c*i+n.tx,i=n.b*r+n.d*i+n.ty}this._currentPoly.points.push(e,i)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let i=0;i<e.length;i++){const n=e[i],r=n.shape.getBounds(W);n.transform?t.addRect(r,n.transform):t.addRect(r)}return t}}class H{constructor(t,e=!1){this.instructions=[],this.uid=(0,l.L)("graphicsPath"),this._dirty=!0,this.checkForHoles=e,"string"==typeof t?function(t,e){const i=d(t),n=[];let r=null,s=0,o=0;for(let t=0;t<i.length;t++){const a=i[t],l=a[0],h=a;switch(l){case"M":s=h[1],o=h[2],e.moveTo(s,o);break;case"m":s+=h[1],o+=h[2],e.moveTo(s,o);break;case"H":s=h[1],e.lineTo(s,o);break;case"h":s+=h[1],e.lineTo(s,o);break;case"V":o=h[1],e.lineTo(s,o);break;case"v":o+=h[1],e.lineTo(s,o);break;case"L":s=h[1],o=h[2],e.lineTo(s,o);break;case"l":s+=h[1],o+=h[2],e.lineTo(s,o);break;case"C":s=h[5],o=h[6],e.bezierCurveTo(h[1],h[2],h[3],h[4],s,o);break;case"c":e.bezierCurveTo(s+h[1],o+h[2],s+h[3],o+h[4],s+h[5],o+h[6]),s+=h[5],o+=h[6];break;case"S":s=h[3],o=h[4],e.bezierCurveToShort(h[1],h[2],s,o);break;case"s":e.bezierCurveToShort(s+h[1],o+h[2],s+h[3],o+h[4]),s+=h[3],o+=h[4];break;case"Q":s=h[3],o=h[4],e.quadraticCurveTo(h[1],h[2],s,o);break;case"q":e.quadraticCurveTo(s+h[1],o+h[2],s+h[3],o+h[4]),s+=h[3],o+=h[4];break;case"T":s=h[1],o=h[2],e.quadraticCurveToShort(s,o);break;case"t":s+=h[1],o+=h[2],e.quadraticCurveToShort(s,o);break;case"A":s=h[6],o=h[7],e.arcToSvg(h[1],h[2],h[3],h[4],h[5],s,o);break;case"a":s+=h[6],o+=h[7],e.arcToSvg(h[1],h[2],h[3],h[4],h[5],s,o);break;case"Z":case"z":e.closePath(),n.length>0&&(r=n.pop(),r?(s=r.startX,o=r.startY):(s=0,o=0)),r=null;break;default:(0,u.R)(`Unknown SVG path command: ${l}`)}"Z"!==l&&"z"!==l&&null===r&&(r={startX:s,startY:o},n.push(r))}}(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new U(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,i,n,r){const s=this.instructions[this.instructions.length-1],a=this.getLastPoint(o.b.shared);let l=0,h=0;if(s&&"bezierCurveTo"===s.action){l=s.data[2],h=s.data[3];const t=a.x,e=a.y;l=t+(t-l),h=e+(e-h)}else l=a.x,h=a.y;return this.instructions.push({action:"bezierCurveTo",data:[l,h,t,e,i,n,r]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,i){const n=this.instructions[this.instructions.length-1],r=this.getLastPoint(o.b.shared);let s=0,a=0;if(n&&"quadraticCurveTo"===n.action){s=n.data[0],a=n.data[1];const t=r.x,e=r.y;s=t+(t-s),a=e+(e-a)}else s=r.x,a=r.y;return this.instructions.push({action:"quadraticCurveTo",data:[s,a,t,e,i]}),this._dirty=!0,this}rect(t,e,i,n,r){return this.instructions.push({action:"rect",data:[t,e,i,n,r]}),this._dirty=!0,this}circle(t,e,i,n){return this.instructions.push({action:"circle",data:[t,e,i,n]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,i,n,r,s,o){r||(r=n/2);const a=-1*Math.PI/2+s,l=2*i,h=2*Math.PI/l,c=[];for(let i=0;i<l;i++){const s=i%2?r:n,o=i*h+a;c.push(t+s*Math.cos(o),e+s*Math.sin(o))}return this.poly(c,!0,o),this}clone(t=!1){const e=new H;if(e.checkForHoles=this.checkForHoles,t)for(let t=0;t<this.instructions.length;t++){const i=this.instructions[t];e.instructions.push({action:i.action,data:i.data.slice()})}else e.instructions=this.instructions.slice();return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,i=t.b,n=t.c,r=t.d,s=t.tx,o=t.ty;let a=0,l=0,h=0,c=0,d=0,p=0,f=0,m=0;for(let y=0;y<this.instructions.length;y++){const g=this.instructions[y],v=g.data;switch(g.action){case"moveTo":case"lineTo":a=v[0],l=v[1],v[0]=e*a+n*l+s,v[1]=i*a+r*l+o;break;case"bezierCurveTo":h=v[0],c=v[1],d=v[2],p=v[3],a=v[4],l=v[5],v[0]=e*h+n*c+s,v[1]=i*h+r*c+o,v[2]=e*d+n*p+s,v[3]=i*d+r*p+o,v[4]=e*a+n*l+s,v[5]=i*a+r*l+o;break;case"quadraticCurveTo":h=v[0],c=v[1],a=v[2],l=v[3],v[0]=e*h+n*c+s,v[1]=i*h+r*c+o,v[2]=e*a+n*l+s,v[3]=i*a+r*l+o;break;case"arcToSvg":a=v[5],l=v[6],f=v[0],m=v[1],v[0]=e*f+n*m,v[1]=i*f+r*m,v[5]=e*a+n*l+s,v[6]=i*a+r*l+o;break;case"circle":v[4]=V(v[3],t);break;case"rect":v[4]=V(v[4],t);break;case"ellipse":v[8]=V(v[8],t);break;case"roundRect":v[5]=V(v[5],t);break;case"addPath":v[0].transform(t);break;case"poly":v[2]=V(v[2],t);break;default:(0,u.R)("unknown transform action",g.action)}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;"closePath"===i.action;){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t)}return t}}function V(t,e){return t?t.prepend(e):e.clone()}var X=i(7276);function Y(t,e,i){const n=t.getAttribute(e);return n?Number(n):i}function $(t){const e=Y(t,"x1",0),i=Y(t,"y1",0),n=Y(t,"x2",1),s=Y(t,"y2",0),o=t.getAttribute("gradientUnits")||"objectBoundingBox",a=new X._(e,i,n,s,"objectBoundingBox"===o?"local":"global");for(let e=0;e<t.children.length;e++){const i=t.children[e],n=Y(i,"offset",0),s=r.Q.shared.setValue(i.getAttribute("stop-color")).toNumber();a.addColorStop(n,s)}return a}function q(t){return(0,u.R)("[SVG Parser] Radial gradients are not yet supported"),new X._(0,0,1,0)}function K(t){const e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}const Z={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};function Q(t,e){const i=t.getAttribute("style"),n={},r={},s={strokeStyle:n,fillStyle:r,useFill:!1,useStroke:!1};for(const i in Z){const n=t.getAttribute(i);n&&J(e,s,i,n.trim())}if(i){const t=i.split(";");for(let i=0;i<t.length;i++){const n=t[i].trim(),[r,o]=n.split(":");Z[r]&&J(e,s,r,o.trim())}}return{strokeStyle:s.useStroke?n:null,fillStyle:s.useFill?r:null,useFill:s.useFill,useStroke:s.useStroke}}function J(t,e,i,n){switch(i){case"stroke":if("none"!==n){if(n.startsWith("url(")){const i=K(n);e.strokeStyle.fill=t.defs[i]}else e.strokeStyle.color=r.Q.shared.setValue(n).toNumber();e.useStroke=!0}break;case"stroke-width":e.strokeStyle.width=Number(n);break;case"fill":if("none"!==n){if(n.startsWith("url(")){const i=K(n);e.fillStyle.fill=t.defs[i]}else e.fillStyle.color=r.Q.shared.setValue(n).toNumber();e.useFill=!0}break;case"fill-opacity":e.fillStyle.alpha=Number(n);break;case"stroke-opacity":e.strokeStyle.alpha=Number(n);break;case"opacity":e.fillStyle.alpha=Number(n),e.strokeStyle.alpha=Number(n)}}function tt(t){const e=t.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!e||e.length<4)return 0;const i=e.map(Number),n=[],r=[];for(let t=0;t<i.length;t+=2)t+1<i.length&&(n.push(i[t]),r.push(i[t+1]));if(0===n.length||0===r.length)return 0;const s=Math.min(...n),o=Math.max(...n),a=Math.min(...r);return(o-s)*(Math.max(...r)-a)}function et(t,e){const i=new H(t,!1);for(const t of i.instructions)e.instructions.push(t)}function it(t,e){if("string"==typeof t){const e=document.createElement("div");e.innerHTML=t.trim(),t=e.querySelector("svg")}const i={context:e,defs:{},path:new H};!function(t,e){const i=t.querySelectorAll("defs");for(let t=0;t<i.length;t++){const n=i[t];for(let t=0;t<n.children.length;t++){const i=n.children[t];switch(i.nodeName.toLowerCase()){case"lineargradient":e.defs[i.id]=$(i);break;case"radialgradient":e.defs[i.id]=q()}}}}(t,i);const n=t.children,{fillStyle:r,strokeStyle:s}=Q(t,i);for(let t=0;t<n.length;t++){const e=n[t];"defs"!==e.nodeName.toLowerCase()&&nt(e,i,r,s)}return e}function nt(t,e,i,n){const r=t.children,{fillStyle:s,strokeStyle:o}=Q(t,e);s&&i?i={...i,...s}:s&&(i=s),o&&n?n={...n,...o}:o&&(n=o);const a=!i&&!n;let l,h,c,d,p,f,m,y,g,v,b,x,_,w,S,C,A;switch(a&&(i={color:0}),t.nodeName.toLowerCase()){case"path":{w=t.getAttribute("d");const r=t.getAttribute("fill-rule"),s=w.split(/(?=[Mm])/).filter((t=>t.trim().length>0)),o="evenodd"===r,a=s.length>1;if(o&&a){const t=s.map((t=>({path:t,area:tt(t)})));t.sort(((t,e)=>e.area-t.area));const r=s.length>3||!function(t){if(t.length<=2)return!0;const e=t.map((t=>t.area)).sort(((t,e)=>e-t)),[i,n]=e,r=e[e.length-1];return!(i/n>3&&n/r<2)}(t);if(r)for(let r=0;r<t.length;r++){const s=t[r],o=0===r;e.context.beginPath();const a=new H(void 0,!0);et(s.path,a),e.context.path(a),o?(i&&e.context.fill(i),n&&e.context.stroke(n)):e.context.cut()}else for(let r=0;r<t.length;r++){const s=t[r],o=r%2==1;e.context.beginPath();const a=new H(void 0,!0);et(s.path,a),e.context.path(a),o?e.context.cut():(i&&e.context.fill(i),n&&e.context.stroke(n))}}else{S=new H(w,!r||"evenodd"===r),e.context.path(S),i&&e.context.fill(i),n&&e.context.stroke(n)}break}case"circle":m=Y(t,"cx",0),y=Y(t,"cy",0),g=Y(t,"r",0),e.context.ellipse(m,y,g,g),i&&e.context.fill(i),n&&e.context.stroke(n);break;case"rect":l=Y(t,"x",0),h=Y(t,"y",0),C=Y(t,"width",0),A=Y(t,"height",0),v=Y(t,"rx",0),b=Y(t,"ry",0),v||b?e.context.roundRect(l,h,C,A,v||b):e.context.rect(l,h,C,A),i&&e.context.fill(i),n&&e.context.stroke(n);break;case"ellipse":m=Y(t,"cx",0),y=Y(t,"cy",0),v=Y(t,"rx",0),b=Y(t,"ry",0),e.context.beginPath(),e.context.ellipse(m,y,v,b),i&&e.context.fill(i),n&&e.context.stroke(n);break;case"line":c=Y(t,"x1",0),d=Y(t,"y1",0),p=Y(t,"x2",0),f=Y(t,"y2",0),e.context.beginPath(),e.context.moveTo(c,d),e.context.lineTo(p,f),n&&e.context.stroke(n);break;case"polygon":_=t.getAttribute("points"),x=_.match(/-?\d+/g).map((t=>parseInt(t,10))),e.context.poly(x,!0),i&&e.context.fill(i),n&&e.context.stroke(n);break;case"polyline":_=t.getAttribute("points"),x=_.match(/-?\d+/g).map((t=>parseInt(t,10))),e.context.poly(x,!1),n&&e.context.stroke(n);break;case"g":case"svg":break;default:(0,u.R)(`[SVG parser] <${t.nodeName}> elements unsupported`)}a&&(i=null);for(let t=0;t<r.length;t++)nt(r[t],e,i,n)}var rt=i(990);function st(t,e){let i=1;const n=t.shapePath.shapePrimitives;for(let t=0;t<n.length;t++){const r=n[t].shape;if("polygon"!==r.type)continue;const s=r.points,o=s.length;if(o<6)continue;const a=r.closePath;for(let t=0;t<o;t+=2){if(!a&&(0===t||t===o-2))continue;const n=(t-2+o)%o,r=(t+2)%o,l=s[n],h=s[n+1],c=s[t],u=s[t+1],d=l-c,p=h-u,f=s[r]-c,m=s[r+1]-u,y=d*d+p*p,g=f*f+m*m;if(y<1e-12||g<1e-12)continue;let v=(d*f+p*m)/Math.sqrt(y*g);v<-1?v=-1:v>1&&(v=1);const b=Math.sqrt(.5*(1-v));if(b<1e-6)continue;const x=Math.min(1/b,e);x>i&&(i=x)}}return i}const ot=new o.b,at=new s.u,lt=class t extends n.A{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=(0,l.L)("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new H,this._transform=new s.u,this._fillStyle={...t.defaultFillStyle},this._strokeStyle={...t.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new c.c,this._boundsDirty=!0}clone(){const e=new t;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=(0,rt.w)(e,t.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=(0,rt.T)(e,t.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=(0,rt.w)(e,t.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=(0,rt.w)(e,t.defaultStrokeStyle),this}texture(t,e,i,n,s,o){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:n||0,dw:s||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e||0===e?r.Q.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new H,this}fill(e,i){let n;const r=this.instructions[this.instructions.length-1];return n=0===this._tick&&"stroke"===r?.action?r.data.path:this._activePath.clone(),n?(null!=e&&(void 0!==i&&"number"==typeof e&&((0,h.t6)(h.lj,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:i}),this._fillStyle=(0,rt.w)(e,t.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:n}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(o.b.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(e){let i;const n=this.instructions[this.instructions.length-1];return i=0===this._tick&&"fill"===n?.action?n.data.path:this._activePath.clone(),i?(null!=e&&(this._strokeStyle=(0,rt.T)(e,t.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){const e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&("stroke"===e.action||"fill"===e.action)){if(!e.data.hole){e.data.hole=i;break}e.data.hole.addPath(i)}}return this._initNextPathLocation(),this}arc(t,e,i,n,r,s){this._tick++;const o=this._transform;return this._activePath.arc(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,i,n,r,s),this}arcTo(t,e,i,n,r){this._tick++;const s=this._transform;return this._activePath.arcTo(s.a*t+s.c*e+s.tx,s.b*t+s.d*e+s.ty,s.a*i+s.c*n+s.tx,s.b*i+s.d*n+s.ty,r),this}arcToSvg(t,e,i,n,r,s,o){this._tick++;const a=this._transform;return this._activePath.arcToSvg(t,e,i,n,r,a.a*s+a.c*o+a.tx,a.b*s+a.d*o+a.ty),this}bezierCurveTo(t,e,i,n,r,s,o){this._tick++;const a=this._transform;return this._activePath.bezierCurveTo(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,a.a*i+a.c*n+a.tx,a.b*i+a.d*n+a.ty,a.a*r+a.c*s+a.tx,a.b*r+a.d*s+a.ty,o),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,i,n){return this._tick++,this._activePath.ellipse(t,e,i,n,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;const i=this._transform,n=this._activePath.instructions,r=i.a*t+i.c*e+i.tx,s=i.b*t+i.d*e+i.ty;return 1===n.length&&"moveTo"===n[0].action?(n[0].data[0]=r,n[0].data[1]=s,this):(this._activePath.moveTo(r,s),this)}quadraticCurveTo(t,e,i,n,r){this._tick++;const s=this._transform;return this._activePath.quadraticCurveTo(s.a*t+s.c*e+s.tx,s.b*t+s.d*e+s.ty,s.a*i+s.c*n+s.tx,s.b*i+s.d*n+s.ty,r),this}rect(t,e,i,n){return this._tick++,this._activePath.rect(t,e,i,n,this._transform.clone()),this}roundRect(t,e,i,n,r){return this._tick++,this._activePath.roundRect(t,e,i,n,r,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,n,r=0,s){return this._tick++,this._activePath.regularPoly(t,e,i,n,r,s),this}roundPoly(t,e,i,n,r,s){return this._tick++,this._activePath.roundPoly(t,e,i,n,r,s),this}roundShape(t,e,i,n){return this._tick++,this._activePath.roundShape(t,e,i,n),this}filletRect(t,e,i,n,r){return this._tick++,this._activePath.filletRect(t,e,i,n,r),this}chamferRect(t,e,i,n,r,s){return this._tick++,this._activePath.chamferRect(t,e,i,n,r,s),this}star(t,e,i,n,r=0,s=0){return this._tick++,this._activePath.star(t,e,i,n,r,s,this._transform.clone()),this}svg(t){return this._tick++,it(t,this),this}restore(){const t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,i,n,r,o){return t instanceof s.u?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,n,r,o),this)}transform(t,e,i,n,r,o){return t instanceof s.u?(this._transform.append(t),this):(at.set(t,e,i,n,r,o),this._transform.append(at),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this._boundsDirty=!0,this.dirty=!0,this.emit("update",this,16)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const i=this.instructions[e],n=i.action;if("fill"===n){const e=i.data;t.addBounds(e.path.bounds)}else if("texture"===n){const e=i.data;t.addFrame(e.dx,e.dy,e.dx+e.dw,e.dy+e.dh,e.transform)}if("stroke"===n){const e=i.data,n=e.style.alignment;let r=e.style.width*(1-n);"miter"===e.style.join&&(r*=st(e.path,e.style.miterLimit));const s=e.path.bounds;t.addFrame(s.minX-r,s.minY-r,s.maxX+r,s.maxY+r)}}return t.isValid||t.set(0,0,0,0),t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;const e=this.instructions;let i=!1;for(let n=0;n<e.length;n++){const r=e[n],s=r.data,o=s.path;if(!r.action||!o)continue;const a=s.style,l=o.shapePath.shapePrimitives;for(let e=0;e<l.length;e++){const n=l[e].shape;if(!a||!n)continue;const o=l[e].transform,h=o?o.applyInverse(t,ot):t;if("fill"===r.action)i=n.contains(h.x,h.y);else{const t=a;i=n.strokeContains(h.x,h.y,t.width,t.alignment)}const c=s.hole;if(c){const t=c.shapePath?.shapePrimitives;if(t)for(let e=0;e<t.length;e++)t[e].shape.contains(h.x,h.y)&&(i=!1)}if(i)return!0}}return i}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),this.emit("destroy",this),this.removeAllListeners();if("boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(e)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(e))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};lt.defaultFillStyle={color:16777215,alpha:1,texture:a.g.WHITE,matrix:null,fill:null,textureSpace:"local"},lt.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:a.g.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let ht=lt},378:(t,e,i)=>{i.d(e,{GH:()=>f});var n=i(8507),r=i(341),s=i(2043),o=i(848),a=i(4334),l=i(4670),h=i(8655),c=i(2801);class u{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach((t=>{h.Z.return(t)})),this.graphicsData&&h.Z.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}}class d{constructor(){this.instructions=new o.L}init(t){const e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new s.J({maxTextures:e}),this.instructions.reset()}get geometry(){return(0,l.t6)(l.Ek,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}}const p=class t{constructor(t){this._renderer=t,this._managedContexts=new a.s({renderer:t,type:"resource",name:"graphicsContext"})}init(e){t.defaultOptions.bezierSmoothness=e?.bezierSmoothness??t.defaultOptions.bezierSmoothness}getContextRenderData(t){return t._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=!!t._gpuData[this._renderer.uid],i=t._gpuData[this._renderer.uid]||this._initContext(t);if(t.dirty||!e){e&&i.reset(),(0,c.M)(t,i);const n=t.batchMode;t.customShader||"no-batch"===n?i.isBatchable=!1:i.isBatchable="auto"!==n||i.geometryData.vertices.length<400,t.dirty=!1}return i}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=h.Z.get(d,{maxTextures:this._renderer.limits.maxBatchableTextures}),i=t._gpuData[this._renderer.uid],{batches:n,geometryData:s}=i;i.graphicsData=e;const o=s.vertices.length,a=s.indices.length;for(let t=0;t<n.length;t++)n[t].applyTransform=!1;const l=e.batcher;l.ensureAttributeBuffer(o),l.ensureIndexBuffer(a),l.begin();for(let t=0;t<n.length;t++){const e=n[t];l.add(e)}l.finish(e.instructions);const c=l.geometry;c.indexBuffer.setDataWithSize(l.indexBuffer,l.indexSize,!0),c.buffers[0].setDataWithSize(l.attributeBuffer.float32View,l.attributeSize,!0);const u=l.batches;for(let t=0;t<u.length;t++){const e=u[t];e.bindGroup=(0,r.w)(e.textures.textures,e.textures.count,this._renderer.limits.maxBatchableTextures)}return e}_initContext(t){const e=new u;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};p.extension={type:[n.Ag.WebGLSystem,n.Ag.WebGPUSystem],name:"graphicsContext"},p.defaultOptions={bezierSmoothness:.5};let f=p},115:(t,e,i)=>{i.d(e,{h:()=>a});var n=i(5101),r=i(4928);function s(t,e,i,n,r,s,o,a){let l,h;o?(l=n,h=-i):(l=-n,h=i);const c=t-i*r+l,u=e-n*r+h,d=t+i*s+l,p=e+n*s+h;return a.push(c,u),a.push(d,p),2}function o(t,e,i,n,r,s,o,a){const l=i-t,h=n-e;let c=Math.atan2(l,h),u=Math.atan2(r-t,s-e);a&&c<u?c+=2*Math.PI:!a&&c>u&&(u+=2*Math.PI);let d=c;const p=u-c,f=Math.abs(p),m=Math.sqrt(l*l+h*h),y=1+(15*f*Math.sqrt(m)/Math.PI|0),g=p/y;if(d+=g,a){o.push(t,e),o.push(i,n);for(let i=1,n=d;i<y;i++,n+=g)o.push(t,e),o.push(t+Math.sin(n)*m,e+Math.cos(n)*m);o.push(t,e),o.push(r,s)}else{o.push(i,n),o.push(t,e);for(let i=1,n=d;i<y;i++,n+=g)o.push(t+Math.sin(n)*m,e+Math.cos(n)*m),o.push(t,e);o.push(r,s),o.push(t,e)}return 2*y}function a(t,e,i,a,l,h){const c=r.B;if(0===t.length)return;const u=e;let d=u.alignment;if(.5!==e.alignment){let e=function(t){const e=t.length;if(e<6)return 1;let i=0;for(let n=0,r=t[e-2],s=t[e-1];n<e;n+=2){const e=t[n],o=t[n+1];i+=(e-r)*(o+s),r=e,s=o}return i<0?-1:1}(t);i&&(e*=-1),d=(d-.5)*e+.5}const p=new n.b(t[0],t[1]),f=new n.b(t[t.length-2],t[t.length-1]),m=a,y=Math.abs(p.x-f.x)<c&&Math.abs(p.y-f.y)<c;if(m){t=t.slice(),y&&(t.pop(),t.pop(),f.set(t[t.length-2],t[t.length-1]));const e=.5*(p.x+f.x),i=.5*(f.y+p.y);t.unshift(e,i),t.push(e,i)}const g=l,v=t.length/2;let b=t.length;const x=g.length/2,_=u.width/2,w=_*_,S=u.miterLimit*u.miterLimit;let C=t[0],A=t[1],E=t[2],M=t[3],T=0,k=0,P=-(A-M),I=C-E,O=0,R=0,L=Math.sqrt(P*P+I*I);P/=L,I/=L,P*=_,I*=_;const j=2*(1-d),D=2*d;m||("round"===u.cap?b+=o(C-P*(j-D)*.5,A-I*(j-D)*.5,C-P*j,A-I*j,C+P*D,A+I*D,g,!0)+2:"square"===u.cap&&(b+=s(C,A,P,I,j,D,!0,g))),g.push(C-P*j,A-I*j),g.push(C+P*D,A+I*D);for(let e=1;e<v-1;++e){C=t[2*(e-1)],A=t[2*(e-1)+1],E=t[2*e],M=t[2*e+1],T=t[2*(e+1)],k=t[2*(e+1)+1],P=-(A-M),I=C-E,L=Math.sqrt(P*P+I*I),P/=L,I/=L,P*=_,I*=_,O=-(M-k),R=E-T,L=Math.sqrt(O*O+R*R),O/=L,R/=L,O*=_,R*=_;const i=E-C,n=A-M,r=E-T,s=k-M,a=i*r+n*s,l=n*r-s*i,h=l<0;if(Math.abs(l)<.001*Math.abs(a)){g.push(E-P*j,M-I*j),g.push(E+P*D,M+I*D),a>=0&&("round"===u.join?b+=o(E,M,E-P*j,M-I*j,E-O*j,M-R*j,g,!1)+4:b+=2,g.push(E-O*D,M-R*D),g.push(E+O*j,M+R*j));continue}const c=(-P+C)*(-I+M)-(-P+E)*(-I+A),d=(-O+T)*(-R+M)-(-O+E)*(-R+k),p=(i*d-r*c)/l,f=(s*c-n*d)/l,m=(p-E)*(p-E)+(f-M)*(f-M),y=E+(p-E)*j,v=M+(f-M)*j,x=E-(p-E)*D,F=M-(f-M)*D,N=h?j:D;m<=Math.min(i*i+n*n,r*r+s*s)+N*N*w?"bevel"===u.join||m/w>S?(h?(g.push(y,v),g.push(E+P*D,M+I*D),g.push(y,v),g.push(E+O*D,M+R*D)):(g.push(E-P*j,M-I*j),g.push(x,F),g.push(E-O*j,M-R*j),g.push(x,F)),b+=2):"round"===u.join?h?(g.push(y,v),g.push(E+P*D,M+I*D),b+=o(E,M,E+P*D,M+I*D,E+O*D,M+R*D,g,!0)+4,g.push(y,v),g.push(E+O*D,M+R*D)):(g.push(E-P*j,M-I*j),g.push(x,F),b+=o(E,M,E-P*j,M-I*j,E-O*j,M-R*j,g,!1)+4,g.push(E-O*j,M-R*j),g.push(x,F)):(g.push(y,v),g.push(x,F)):(g.push(E-P*j,M-I*j),g.push(E+P*D,M+I*D),"round"===u.join?b+=h?o(E,M,E+P*D,M+I*D,E+O*D,M+R*D,g,!0)+2:o(E,M,E-P*j,M-I*j,E-O*j,M-R*j,g,!1)+2:"miter"===u.join&&m/w<=S&&(h?(g.push(x,F),g.push(x,F)):(g.push(y,v),g.push(y,v)),b+=2),g.push(E-O*j,M-R*j),g.push(E+O*D,M+R*D),b+=2)}C=t[2*(v-2)],A=t[2*(v-2)+1],E=t[2*(v-1)],M=t[2*(v-1)+1],P=-(A-M),I=C-E,L=Math.sqrt(P*P+I*I),P/=L,I/=L,P*=_,I*=_,g.push(E-P*j,M-I*j),g.push(E+P*D,M+I*D),m||("round"===u.cap?b+=o(E-P*(j-D)*.5,M-I*(j-D)*.5,E-P*j,M-I*j,E+P*D,M+I*D,g,!1)+2:"square"===u.cap&&(b+=s(E,M,P,I,j,D,!1,g)));const F=r.I*r.I;for(let t=x;t<b+x-2;++t)C=g[2*t],A=g[2*t+1],E=g[2*(t+1)],M=g[2*(t+1)+1],T=g[2*(t+2)],k=g[2*(t+2)+1],Math.abs(C*(M-k)+E*(k-A)+T*(A-M))<F||h.push(t,t+1,t+2)}},4928:(t,e,i)=>{i.d(e,{B:()=>n,I:()=>r});const n=1e-4,r=1e-4},7276:(t,e,i)=>{i.d(e,{_:()=>p});var n=i(2577),r=i(1761),s=i(9313),o=i(8293),a=i(5589),l=i(133),h=i(4670),c=i(2698);const u=[{offset:0,color:"white"},{offset:1,color:"black"}],d=class t{constructor(...e){this.uid=(0,l.L)("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let i=function(t){let e=t[0]??{};("number"==typeof e||t[1])&&((0,h.t6)("8.5.2","use options object instead"),e={type:"linear",start:{x:t[0],y:t[1]},end:{x:t[2],y:t[3]},textureSpace:t[4],textureSize:t[5]??p.defaultLinearOptions.textureSize});return e}(e);i={..."radial"===i.type?t.defaultRadialOptions:t.defaultLinearOptions,...(0,c.S)(i)},this._textureSize=i.textureSize,this._wrapMode=i.wrapMode,"radial"===i.type?(this.center=i.center,this.outerCenter=i.outerCenter??this.center,this.innerRadius=i.innerRadius,this.outerRadius=i.outerRadius,this.scale=i.scale,this.rotation=i.rotation):(this.start=i.start,this.end=i.end),this.textureSpace=i.textureSpace,this.type=i.type,i.colorStops.forEach((t=>{this.addColorStop(t.offset,t.color)}))}addColorStop(t,e){return this.colorStops.push({offset:t,color:n.Q.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:n}=this.end,r=i-t,l=n-e;const h=r<0||l<0;if("clamp-to-edge"===this._wrapMode){if(r<0){const e=t;t=i,i=e,r*=-1}if(l<0){const t=e;e=n,n=t,l*=-1}}const c=this.colorStops.length?this.colorStops:u,d=this._textureSize,{canvas:p,context:y}=m(d,1),g=h?y.createLinearGradient(this._textureSize,0,0,0):y.createLinearGradient(0,0,this._textureSize,0);f(g,c),y.fillStyle=g,y.fillRect(0,0,d,1),this.texture=new a.g({source:new o.b({resource:p,addressMode:this._wrapMode})});const v=Math.sqrt(r*r+l*l),b=Math.atan2(l,r),x=new s.u;x.scale(v/d,1),x.rotate(b),x.translate(t,e),"local"===this.textureSpace&&x.scale(d,d),this.transform=x}buildGradient(){this.texture||this._tick++,"linear"===this.type?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const t=this.colorStops.length?this.colorStops:u,e=this._textureSize,{canvas:i,context:n}=m(e,e),{x:r,y:l}=this.center,{x:h,y:c}=this.outerCenter,d=this.innerRadius,p=this.outerRadius,y=h-p,g=c-p,v=e/(2*p),b=(r-y)*v,x=(l-g)*v,_=n.createRadialGradient(b,x,d*v,(h-y)*v,(c-g)*v,p*v);f(_,t),n.fillStyle=t[t.length-1].color,n.fillRect(0,0,e,e),n.fillStyle=_,n.translate(b,x),n.rotate(this.rotation),n.scale(1,this.scale),n.translate(-b,-x),n.fillRect(0,0,e,e),this.texture=new a.g({source:new o.b({resource:i,addressMode:this._wrapMode})});const w=new s.u;w.scale(1/v,1/v),w.translate(y,g),"local"===this.textureSpace&&w.scale(e,e),this.transform=w}destroy(){this.texture?.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};d.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"},d.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let p=d;function f(t,e){for(let i=0;i<e.length;i++){const n=e[i];t.addColorStop(n.offset,n.color)}}function m(t,e){const i=r.e.get().createCanvas(t,e),n=i.getContext("2d");return{canvas:i,context:n}}},2806:(t,e,i)=>{i.d(e,{m:()=>o});var n=i(9313),r=i(133);const s={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class o{constructor(t,e){this.uid=(0,r.L)("fillPattern"),this._tick=0,this.transform=new n.u,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=s[e].addressModeU,t.source.style.addressModeV=s[e].addressModeV)}setTransform(t){const e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._tick++}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture=t,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}},2801:(t,e,i)=>{i.d(e,{M:()=>Q,y:()=>q});var n=i(8507),r=i(9313),s=i(9252);function o(t,e,i,n,r){const s=e.a,o=e.b,a=e.c,l=e.d,h=e.tx,c=e.ty;i||(i=0),n||(n=2),r||(r=t.length/n-i);let u=i*n;for(let e=0;e<r;e++){const e=t[u],i=t[u+1];t[u]=s*e+a*i+h,t[u+1]=o*e+l*i+c,u+=n}}var a=i(5589),l=i(8655),h=i(6954);const c={extension:{type:n.Ag.ShapeBuilder,name:"circle"},build(t,e){let i,n,r,s,o,a;if("circle"===t.type){const e=t;if(o=a=e.radius,o<=0)return!1;i=e.x,n=e.y,r=s=0}else if("ellipse"===t.type){const e=t;if(o=e.halfWidth,a=e.halfHeight,o<=0||a<=0)return!1;i=e.x,n=e.y,r=s=0}else{const e=t,l=e.width/2,h=e.height/2;i=e.x+l,n=e.y+h,o=a=Math.max(0,Math.min(e.radius,Math.min(l,h))),r=l-o,s=h-a}if(r<0||s<0)return!1;const l=Math.ceil(2.3*Math.sqrt(o+a)),h=8*l+(r?4:0)+(s?4:0);if(0===h)return!1;if(0===l)return e[0]=e[6]=i+r,e[1]=e[3]=n+s,e[2]=e[4]=i-r,e[5]=e[7]=n-s,!0;let c=0,u=4*l+(r?2:0)+2,d=u,p=h,f=r+o,m=s,y=i+f,g=i-f,v=n+m;if(e[c++]=y,e[c++]=v,e[--u]=v,e[--u]=g,s){const t=n-m;e[d++]=g,e[d++]=t,e[--p]=t,e[--p]=y}for(let t=1;t<l;t++){const h=Math.PI/2*(t/l),f=r+Math.cos(h)*o,m=s+Math.sin(h)*a,y=i+f,g=i-f,v=n+m,b=n-m;e[c++]=y,e[c++]=v,e[--u]=v,e[--u]=g,e[d++]=g,e[d++]=b,e[--p]=b,e[--p]=y}f=r,m=s+a,y=i+f,g=i-f,v=n+m;const b=n-m;return e[c++]=y,e[c++]=v,e[--p]=b,e[--p]=y,r&&(e[c++]=g,e[c++]=v,e[--p]=b,e[--p]=g),!0},triangulate(t,e,i,n,r,s){if(0===t.length)return;let o=0,a=0;for(let e=0;e<t.length;e+=2)o+=t[e],a+=t[e+1];o/=t.length/2,a/=t.length/2;let l=n;e[l*i]=o,e[l*i+1]=a;const h=l++;for(let n=0;n<t.length;n+=2)e[l*i]=t[n],e[l*i+1]=t[n+1],n>0&&(r[s++]=l,r[s++]=h,r[s++]=l-1),l++;r[s++]=h+1,r[s++]=h,r[s++]=l-1}},u={...c,extension:{...c.extension,name:"ellipse"}},d={...c,extension:{...c.extension,name:"roundedRectangle"}};var p=i(115),f=i(4928);function m(t,e,i=2){const n=e&&e.length,r=n?e[0]*i:t.length;let s=y(t,0,r,i,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,h;if(n&&(s=function(t,e,i,n){const r=[];for(let i=0,s=e.length;i<s;i++){const o=y(t,e[i]*n,i<s-1?e[i+1]*n:t.length,n,!1);o===o.next&&(o.steiner=!0),r.push(M(o))}r.sort(S);for(let t=0;t<r.length;t++)i=C(r[t],i);return i}(t,e,s,i)),t.length>80*i){a=t[0],l=t[1];let e=a,n=l;for(let s=i;s<r;s+=i){const i=t[s],r=t[s+1];i<a&&(a=i),r<l&&(l=r),i>e&&(e=i),r>n&&(n=r)}h=Math.max(e-a,n-l),h=0!==h?32767/h:0}return v(s,o,i,a,l,h,0),o}function y(t,e,i,n,r){let s;if(r===z(t,e,i,n)>0)for(let r=e;r<i;r+=n)s=N(r/n|0,t[r],t[r+1],s);else for(let r=i-n;r>=e;r-=n)s=N(r/n|0,t[r],t[r+1],s);return s&&O(s,s.next)&&(B(s),s=s.next),s}function g(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!O(n,n.next)&&0!==I(n.prev,n,n.next))n=n.next;else{if(B(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function v(t,e,i,n,r,s,o){if(!t)return;!o&&s&&function(t,e,i,n){let r=t;do{0===r.z&&(r.z=E(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i=1;do{let n,r=t;t=null;let s=null;for(e=0;r;){e++;let o=r,a=0;for(let t=0;t<i&&(a++,o=o.nextZ,o);t++);let l=i;for(;a>0||l>0&&o;)0!==a&&(0===l||!o||r.z<=o.z)?(n=r,r=r.nextZ,a--):(n=o,o=o.nextZ,l--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;r=o}s.nextZ=null,i*=2}while(e>1)}(r)}(t,n,r,s);let a=t;for(;t.prev!==t.next;){const l=t.prev,h=t.next;if(s?x(t,n,r,s):b(t))e.push(l.i,t.i,h.i),B(t),t=h.next,a=h.next;else if((t=h)===a){o?1===o?v(t=_(g(t),e),e,i,n,r,s,2):2===o&&w(t,e,i,n,r,s):v(g(t),e,i,n,r,s,1);break}}}function b(t){const e=t.prev,i=t,n=t.next;if(I(e,i,n)>=0)return!1;const r=e.x,s=i.x,o=n.x,a=e.y,l=i.y,h=n.y,c=Math.min(r,s,o),u=Math.min(a,l,h),d=Math.max(r,s,o),p=Math.max(a,l,h);let f=n.next;for(;f!==e;){if(f.x>=c&&f.x<=d&&f.y>=u&&f.y<=p&&k(r,a,s,l,o,h,f.x,f.y)&&I(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function x(t,e,i,n){const r=t.prev,s=t,o=t.next;if(I(r,s,o)>=0)return!1;const a=r.x,l=s.x,h=o.x,c=r.y,u=s.y,d=o.y,p=Math.min(a,l,h),f=Math.min(c,u,d),m=Math.max(a,l,h),y=Math.max(c,u,d),g=E(p,f,e,i,n),v=E(m,y,e,i,n);let b=t.prevZ,x=t.nextZ;for(;b&&b.z>=g&&x&&x.z<=v;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=y&&b!==r&&b!==o&&k(a,c,l,u,h,d,b.x,b.y)&&I(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,x.x>=p&&x.x<=m&&x.y>=f&&x.y<=y&&x!==r&&x!==o&&k(a,c,l,u,h,d,x.x,x.y)&&I(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;b&&b.z>=g;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=y&&b!==r&&b!==o&&k(a,c,l,u,h,d,b.x,b.y)&&I(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;x&&x.z<=v;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=y&&x!==r&&x!==o&&k(a,c,l,u,h,d,x.x,x.y)&&I(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function _(t,e){let i=t;do{const n=i.prev,r=i.next.next;!O(n,r)&&R(n,i,i.next,r)&&D(n,r)&&D(r,n)&&(e.push(n.i,i.i,r.i),B(i),B(i.next),i=t=r),i=i.next}while(i!==t);return g(i)}function w(t,e,i,n,r,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&P(o,t)){let a=F(o,t);return o=g(o,o.next),a=g(a,a.next),v(o,e,i,n,r,s,0),void v(a,e,i,n,r,s,0)}t=t.next}o=o.next}while(o!==t)}function S(t,e){let i=t.x-e.x;if(0===i&&(i=t.y-e.y,0===i)){i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return i}function C(t,e){const i=function(t,e){let i=e;const n=t.x,r=t.y;let s,o=-1/0;if(O(t,i))return i;do{if(O(t,i.next))return i.next;if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>o&&(o=t,s=i.x<i.next.x?i:i.next,t===n))return s}i=i.next}while(i!==e);if(!s)return null;const a=s,l=s.x,h=s.y;let c=1/0;i=s;do{if(n>=i.x&&i.x>=l&&n!==i.x&&T(r<h?n:o,r,l,h,r<h?o:n,r,i.x,i.y)){const e=Math.abs(r-i.y)/(n-i.x);D(i,t)&&(e<c||e===c&&(i.x>s.x||i.x===s.x&&A(s,i)))&&(s=i,c=e)}i=i.next}while(i!==a);return s}(t,e);if(!i)return e;const n=F(i,t);return g(n,n.next),g(i,i.next)}function A(t,e){return I(t.prev,t,e.prev)<0&&I(e.next,t,t.next)<0}function E(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function M(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function T(t,e,i,n,r,s,o,a){return(r-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(n-a)>=(i-o)*(e-a)&&(i-o)*(s-a)>=(r-o)*(n-a)}function k(t,e,i,n,r,s,o,a){return!(t===o&&e===a)&&T(t,e,i,n,r,s,o,a)}function P(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&R(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(D(t,e)&&D(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(I(t.prev,t,e.prev)||I(t,e.prev,e))||O(t,e)&&I(t.prev,t,t.next)>0&&I(e.prev,e,e.next)>0)}function I(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function O(t,e){return t.x===e.x&&t.y===e.y}function R(t,e,i,n){const r=j(I(t,e,i)),s=j(I(t,e,n)),o=j(I(i,n,t)),a=j(I(i,n,e));return r!==s&&o!==a||(!(0!==r||!L(t,i,e))||(!(0!==s||!L(t,n,e))||(!(0!==o||!L(i,t,n))||!(0!==a||!L(i,e,n)))))}function L(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function j(t){return t>0?1:t<0?-1:0}function D(t,e){return I(t.prev,t,t.next)<0?I(t,e,t.next)>=0&&I(t,t.prev,e)>=0:I(t,e,t.prev)<0||I(t,t.next,e)<0}function F(t,e){const i=G(t.i,t.x,t.y),n=G(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function N(t,e,i,n){const r=G(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function B(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function G(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function z(t,e,i,n){let r=0;for(let s=e,o=i-n;s<i;s+=n)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}i(8875);const W=m.default||m;function U(t,e,i,n,r,s,o){const a=W(t,e,2);if(!a)return;for(let t=0;t<a.length;t+=3)s[o++]=a[t]+r,s[o++]=a[t+1]+r,s[o++]=a[t+2]+r;let l=r*n;for(let e=0;e<t.length;e+=2)i[l]=t[e],i[l+1]=t[e+1],l+=n}const H=[],V={extension:{type:n.Ag.ShapeBuilder,name:"polygon"},build(t,e){for(let i=0;i<t.points.length;i++)e[i]=t.points[i];return!0},triangulate(t,e,i,n,r,s){U(t,H,e,i,n,r,s)}},X={extension:{type:n.Ag.ShapeBuilder,name:"rectangle"},build(t,e){const i=t,n=i.x,r=i.y,s=i.width,o=i.height;return s>0&&o>0&&(e[0]=n,e[1]=r,e[2]=n+s,e[3]=r,e[4]=n+s,e[5]=r+o,e[6]=n,e[7]=r+o,!0)},triangulate(t,e,i,n,r,s){let o=0;e[(n*=i)+o]=t[0],e[n+o+1]=t[1],o+=i,e[n+o]=t[2],e[n+o+1]=t[3],o+=i,e[n+o]=t[6],e[n+o+1]=t[7],o+=i,e[n+o]=t[4],e[n+o+1]=t[5],o+=i;const a=n/i;r[s++]=a,r[s++]=a+1,r[s++]=a+2,r[s++]=a+1,r[s++]=a+3,r[s++]=a+2}},Y={extension:{type:n.Ag.ShapeBuilder,name:"triangle"},build:(t,e)=>(e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,!0),triangulate(t,e,i,n,r,s){let o=0;e[(n*=i)+o]=t[0],e[n+o+1]=t[1],o+=i,e[n+o]=t[2],e[n+o+1]=t[3],o+=i,e[n+o]=t[4],e[n+o+1]=t[5];const a=n/i;r[s++]=a,r[s++]=a+1,r[s++]=a+2}};var $=i(2413);const q={};n.XO.handleByMap(n.Ag.ShapeBuilder,q),n.XO.add(X,V,Y,c,u,d);const K=new s.M,Z=new r.u;function Q(t,e){const{geometryData:i,batches:n}=e;n.length=0,i.indices.length=0,i.vertices.length=0,i.uvs.length=0;for(let e=0;e<t.instructions.length;e++){const r=t.instructions[e];if("texture"===r.action)J(r.data,n,i);else if("fill"===r.action||"stroke"===r.action){const t="stroke"===r.action,e=r.data.path.shapePath,s=r.data.style,o=r.data.hole;t&&o&&tt(o.shapePath,s,!0,n,i),o&&(e.shapePrimitives[e.shapePrimitives.length-1].holes=o.shapePath.shapePrimitives),tt(e,s,t,n,i)}}}function J(t,e,i){const n=[],r=q.rectangle,s=K;s.x=t.dx,s.y=t.dy,s.width=t.dw,s.height=t.dh;const a=t.transform;if(!r.build(s,n))return;const{vertices:c,uvs:u,indices:d}=i,p=d.length,f=c.length/2;a&&o(n,a),r.triangulate(n,c,2,f,d,p);const m=t.image,y=m.uvs;u.push(y.x0,y.y0,y.x1,y.y1,y.x3,y.y3,y.x2,y.y2);const g=l.Z.get(h.G);g.indexOffset=p,g.indexSize=d.length-p,g.attributeOffset=f,g.attributeSize=c.length/2-f,g.baseColor=t.style,g.alpha=t.alpha,g.texture=m,g.geometryData=i,e.push(g)}function tt(t,e,i,n,r){const{vertices:s,uvs:c,indices:u}=r;t.shapePrimitives.forEach((({shape:t,transform:d,holes:m})=>{const y=[],g=q[t.type];if(!g.build(t,y))return;const v=u.length,b=s.length/2;let x="triangle-list";if(d&&o(y,d),i){const i=t.closePath??!0,n=e;n.pixelLine?(!function(t,e,i,n){const r=f.B;if(0===t.length)return;const s=t[0],o=t[1],a=t[t.length-2],l=t[t.length-1],h=e||Math.abs(s-a)<r&&Math.abs(o-l)<r,c=i,u=t.length/2,d=c.length/2;for(let e=0;e<u;e++)c.push(t[2*e]),c.push(t[2*e+1]);for(let t=0;t<u-1;t++)n.push(d+t,d+t+1);h&&n.push(d+u-1,d)}(y,i,s,u),x="line-list"):(0,p.h)(y,n,!1,i,s,u)}else if(m){const t=[],e=y.slice();(function(t){const e=[];for(let i=0;i<t.length;i++){const n=t[i].shape,r=[];q[n.type].build(n,r)&&e.push(r)}return e})(m).forEach((i=>{t.push(e.length/2),e.push(...i)})),U(e,t,s,2,b,u,v)}else g.triangulate(y,s,2,b,u,v);const _=c.length/2,w=e.texture;if(w!==a.g.WHITE){const i=(0,$.Y)(Z,e,t,d);!function(t,e,i,n,r,s,o,a=null){let l=0;i*=e,r*=s;const h=a.a,c=a.b,u=a.c,d=a.d,p=a.tx,f=a.ty;for(;l<o;){const o=t[i],a=t[i+1];n[r]=h*o+u*a+p,n[r+1]=c*o+d*a+f,r+=s,i+=e,l++}}(s,2,b,c,_,2,s.length/2-b,i)}else!function(t,e,i,n){let r=0;for(e*=i;r<n;)t[e]=0,t[e+1]=0,e+=i,r++}(c,_,2,s.length/2-b);const S=l.Z.get(h.G);S.indexOffset=v,S.indexSize=u.length-v,S.attributeOffset=b,S.attributeSize=s.length/2-b,S.baseColor=e.color,S.alpha=e.alpha,S.texture=w,S.geometryData=r,S.topology=x,n.push(S)}))}},990:(t,e,i)=>{i.d(e,{T:()=>d,w:()=>u});var n=i(2577),r=i(5589),s=i(7276),o=i(2806);function a(t){return t instanceof o.m}function l(t){return t instanceof s._}function h(t,e,i){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...i,...t}}function c(t,e,i){return e.buildGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...i,...t}}function u(t,e){if(null==t)return null;const i={},s=t;return function(t){return n.Q.isColorLike(t)}(t)?function(t,e,i){const s=n.Q.shared.setValue(e??0);return t.color=s.toNumber(),t.alpha=1===s.alpha?i.alpha:s.alpha,t.texture=r.g.WHITE,{...i,...t}}(i,t,e):function(t){return t instanceof r.g}(t)?function(t,e,i){return t.texture=e,{...i,...t}}(i,t,e):a(t)?h(i,t,e):l(t)?c(i,t,e):s.fill&&a(s.fill)?h(s,s.fill,e):s.fill&&l(s.fill)?c(s,s.fill,e):function(t,e){const i={...e,...t},r=n.Q.shared.setValue(i.color);return i.alpha*=r.alpha,i.color=r.toNumber(),i}(s,e)}function d(t,e){const{width:i,alignment:n,miterLimit:r,cap:s,join:o,pixelLine:a,...l}=e,h=u(t,l);return h?{width:i,alignment:n,miterLimit:r,cap:s,join:o,pixelLine:a,...h}:null}},2413:(t,e,i)=>{i.d(e,{Y:()=>l});var n=i(9313),r=i(9252),s=i(7276);const o=new n.u,a=new r.M;function l(t,e,i,n){const r=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if("local"===e.textureSpace){const t=i.getBounds(a);e.width&&t.pad(e.width);const{x:n,y:s}=t,o=1/t.width,l=1/t.height,h=-n*o,c=-s*l,u=r.a,d=r.b,p=r.c,f=r.d;r.a*=o,r.b*=o,r.c*=l,r.d*=l,r.tx=h*u+c*p+r.tx,r.ty=h*d+c*f+r.ty}else r.translate(e.texture.frame.x,e.texture.frame.y),r.scale(1/e.texture.source.width,1/e.texture.source.height);const l=e.texture.source.style;return e.fill instanceof s._||"clamp-to-edge"!==l.addressMode||(l.addressMode="repeat",l.update()),n&&r.append(o.copyFrom(n).invert()),r}},8422:(t,e,i)=>{i.d(e,{K:()=>n});class n{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}destroy(){this.reset()}}},6844:(t,e,i)=>{i.d(e,{k:()=>l});var n=i(2812),r=i(5589),s=i(2048),o=i(4670),a=i(4985);class l extends a.l{constructor(t=r.g.EMPTY){t instanceof r.g&&(t={texture:t});const{texture:e=r.g.EMPTY,anchor:i,roundPixels:s,width:o,height:a,...l}=t;super({label:"Sprite",...l}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new n.o({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,void 0!==o&&(this.width=o),void 0!==a&&(this.height=a)}static from(t,e=!1){return t instanceof r.g?new l(t):new l(r.g.from(t,e))}set texture(t){t||(t=r.g.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return(0,s.y)(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return(0,o.t6)("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const t=this._anchor,e=this._texture,i=this._bounds,{width:n,height:r}=e.orig;i.minX=-t._x*n,i.maxX=i.minX+n,i.minY=-t._y*r,i.maxY=i.minY+r}destroy(t=!1){super.destroy(t);if("boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.textureSource;this._texture.destroy(e)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){"object"==typeof t?(e=t.height??t.width,t=t.width):e??(e=t),void 0!==t&&this._setWidth(t,this._texture.orig.width),void 0!==e&&this._setHeight(e,this._texture.orig.height)}}},4985:(t,e,i)=>{i.d(e,{l:()=>s});var n=i(9636),r=i(5559);class s extends r.mc{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new n.c(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=t.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const e=this.bounds,{x:i,y:n}=t;return i>=e.minX&&i<=e.maxX&&n>=e.minY&&n<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(t){this.unload(),super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,i){const{renderPipes:n}=e;n.blendMode.pushBlendMode(this,this.groupBlendMode,t);const r=n[this.renderPipeId];r?.addRenderable&&r.addRenderable(this,t),this.didViewUpdate=!1;const s=this.children,o=s.length;for(let n=0;n<o;n++)s[n].collectRenderables(t,e,i);n.blendMode.popBlendMode(t)}}},6312:(t,e,i)=>{var n=i(8507),r=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(r||{}),s=i(268),o=i(1761);function a(t){if("string"!=typeof t)throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function l(t){return t.split("?")[0].split("#")[0]}const h={toPosix(t){return e="\\",i="/",t.replace(new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),i);var e,i},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl:t=>/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t),isBlobUrl:t=>t.startsWith("blob:"),hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){a(t),t=this.toPosix(t);const e=/^file:\/\/\//.exec(t);if(e)return e[0];const i=/^[^/:]+:\/{0,2}/.exec(t);return i?i[0]:""},toAbsolute(t,e,i){if(a(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const n=l(this.toPosix(e??o.e.get().getBaseUrl())),r=l(this.toPosix(i??this.rootname(n)));if((t=this.toPosix(t)).startsWith("/"))return h.join(r,t.slice(1));return this.isAbsolute(t)?t:this.join(n,t)},normalize(t){if(a(t),0===t.length)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;let e="";const i=(t=this.toPosix(t)).startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const n=t.endsWith("/");return(t=function(t,e){let i="",n=0,r=-1,s=0,o=-1;for(let a=0;a<=t.length;++a){if(a<t.length)o=t.charCodeAt(a);else{if(47===o)break;o=47}if(47===o){if(r===a-1||1===s);else if(r!==a-1&&2===s){if(i.length<2||2!==n||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){const t=i.lastIndexOf("/");if(t!==i.length-1){-1===t?(i="",n=0):(i=i.slice(0,t),n=i.length-1-i.lastIndexOf("/")),r=a,s=0;continue}}else if(2===i.length||1===i.length){i="",n=0,r=a,s=0;continue}e&&(i.length>0?i+="/..":i="..",n=2)}else i.length>0?i+=`/${t.slice(r+1,a)}`:i=t.slice(r+1,a),n=a-r-1;r=a,s=0}else 46===o&&-1!==s?++s:s=-1}return i}(t,!1)).length>0&&n&&(t+="/"),i?`/${t}`:e+t},isAbsolute(t){return a(t),t=this.toPosix(t),!!this.hasProtocol(t)||t.startsWith("/")},join(...t){if(0===t.length)return".";let e;for(let i=0;i<t.length;++i){const n=t[i];if(a(n),n.length>0)if(void 0===e)e=n;else{const r=t[i-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?e+=`/../${n}`:e+=`/${n}`}}return void 0===e?".":this.normalize(e)},dirname(t){if(a(t),0===t.length)return".";let e=(t=this.toPosix(t)).charCodeAt(0);const i=47===e;let n=-1,r=!0;const s=this.getProtocol(t),o=t;for(let i=(t=t.slice(s.length)).length-1;i>=1;--i)if(e=t.charCodeAt(i),47===e){if(!r){n=i;break}}else r=!1;return-1===n?i?"/":this.isUrl(o)?s+t:s:i&&1===n?"//":s+t.slice(0,n)},rootname(t){a(t);let e="";if(e=(t=this.toPosix(t)).startsWith("/")?"/":this.getProtocol(t),this.isUrl(t)){const i=t.indexOf("/",e.length);e=-1!==i?t.slice(0,i):t,e.endsWith("/")||(e+="/")}return e},basename(t,e){a(t),e&&a(e),t=l(this.toPosix(t));let i,n=0,r=-1,s=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let o=e.length-1,a=-1;for(i=t.length-1;i>=0;--i){const l=t.charCodeAt(i);if(47===l){if(!s){n=i+1;break}}else-1===a&&(s=!1,a=i+1),o>=0&&(l===e.charCodeAt(o)?-1==--o&&(r=i):(o=-1,r=a))}return n===r?r=a:-1===r&&(r=t.length),t.slice(n,r)}for(i=t.length-1;i>=0;--i)if(47===t.charCodeAt(i)){if(!s){n=i+1;break}}else-1===r&&(s=!1,r=i+1);return-1===r?"":t.slice(n,r)},extname(t){a(t);let e=-1,i=0,n=-1,r=!0,s=0;for(let o=(t=l(this.toPosix(t))).length-1;o>=0;--o){const a=t.charCodeAt(o);if(47!==a)-1===n&&(r=!1,n=o+1),46===a?-1===e?e=o:1!==s&&(s=1):-1!==e&&(s=-1);else if(!r){i=o+1;break}}return-1===e||-1===n||0===s||1===s&&e===n-1&&e===i+1?"":t.slice(e,n)},parse(t){a(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;let i=(t=l(this.toPosix(t))).charCodeAt(0);const n=this.isAbsolute(t);let r;e.root=this.rootname(t),r=n||this.hasProtocol(t)?1:0;let s=-1,o=0,h=-1,c=!0,u=t.length-1,d=0;for(;u>=r;--u)if(i=t.charCodeAt(u),47!==i)-1===h&&(c=!1,h=u+1),46===i?-1===s?s=u:1!==d&&(d=1):-1!==s&&(d=-1);else if(!c){o=u+1;break}return-1===s||-1===h||0===d||1===d&&s===h-1&&s===o+1?-1!==h&&(e.base=e.name=0===o&&n?t.slice(1,h):t.slice(o,h)):(0===o&&n?(e.name=t.slice(1,s),e.base=t.slice(1,h)):(e.name=t.slice(o,s),e.base=t.slice(o,h)),e.ext=t.slice(s,h)),e.dir=this.dirname(t),e},sep:"/",delimiter:":",joinExtensions:[".html"]};var c=i(2406);function u(t,e,i,n,r){const s=e[i];for(let o=0;o<s.length;o++){const a=s[o];i<e.length-1?u(t.replace(n[i],a),e,i+1,n,r):r.push(t.replace(n[i],a))}}function d(t){const e=t.match(/\{(.*?)\}/g),i=[];if(e){const n=[];e.forEach((t=>{const e=t.substring(1,t.length-1).split(",");n.push(e)})),u(t,n,0,e,i)}else i.push(t);return i}const p=t=>!Array.isArray(t);class f{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,"bar"!==this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar")))throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach((t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))})),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if("string"==typeof t)this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}}getAlias(t){const{alias:e,src:i}=t;return(0,c.z)(e||i,(t=>"string"==typeof t?t:Array.isArray(t)?t.map((t=>t?.src??t)):t?.src?t.src:t),!0)}removeAlias(t,e){this._assetMap[t]&&(e&&e!==this._resolverHash[t]||(delete this._resolverHash[t],delete this._assetMap[t]))}addManifest(t){this._manifest&&(0,s.R)("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach((t=>{this.addBundle(t.name,t.assets)}))}addBundle(t,e){const i=[];let n=e;Array.isArray(e)||(n=Object.entries(e).map((([t,e])=>"string"==typeof e||Array.isArray(e)?{alias:t,src:e}:{alias:t,...e}))),n.forEach((e=>{const n=e.src,r=e.alias;let s;if("string"==typeof r){const e=this._createBundleAssetId(t,r);i.push(e),s=[r,e]}else{const e=r.map((e=>this._createBundleAssetId(t,e)));i.push(...e),s=[...r,...e]}this.add({...e,alias:s,src:n})})),this._bundles[t]=i}add(t){const e=[];let i;Array.isArray(t)?e.push(...t):e.push(t),i=t=>{this.hasKey(t)&&(0,s.R)(`[Resolver] already has key: ${t} overwriting`)};(0,c.z)(e).forEach((t=>{const{src:e}=t;let{data:n,format:r,loadParser:s,parser:o}=t;const a=(0,c.z)(e).map((t=>"string"==typeof t?d(t):Array.isArray(t)?t:[t])),l=this.getAlias(t);Array.isArray(l)?l.forEach(i):i(l);const h=[],u=t=>{const e=this._parsers.find((e=>e.test(t)));return{src:t,...e?.parse(t)}};a.forEach((e=>{e.forEach((e=>{let i={};if("object"!=typeof e?i=u(e):(n=e.data??n,r=e.format??r,(e.loadParser||e.parser)&&(s=e.loadParser??s,o=e.parser??o),i={...u(e.src),...e}),!l)throw new Error(`[Resolver] alias is undefined for this asset: ${i.src}`);i=this._buildResolvedAsset(i,{aliases:l,data:n,format:r,loadParser:s,parser:o,progressSize:t.progressSize}),h.push(i)}))})),l.forEach((t=>{this._assetMap[t]=h}))}))}resolveBundle(t){const e=p(t);t=(0,c.z)(t);const i={};return t.forEach((t=>{const e=this._bundles[t];if(e){const n=this.resolve(e),r={};for(const e in n){const i=n[e];r[this._extractAssetIdFromBundle(t,e)]=i}i[t]=r}})),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if("string"!=typeof t){const t={};for(const i in e)t[i]=e[i].src;return t}return e.src}resolve(t){const e=p(t);t=(0,c.z)(t);const i={};return t.forEach((t=>{if(!this._resolverHash[t])if(this._assetMap[t]){let e=this._assetMap[t];const i=this._getPreferredOrder(e);i?.priority.forEach((t=>{i.params[t].forEach((i=>{const n=e.filter((e=>!!e[t]&&e[t]===i));n.length&&(e=n)}))})),this._resolverHash[t]=e[0]}else this._resolverHash[t]=this._buildResolvedAsset({alias:[t],src:t},{});i[t]=this._resolverHash[t]})),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[e],n=this._preferredOrder.find((t=>t.params.format.includes(i.format)));if(n)return n}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;return`${t}${/\?/.test(t)?"&":"?"}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){const{aliases:i,data:n,loadParser:r,parser:s,format:o,progressSize:a}=e;return(this._basePath||this._rootPath)&&(t.src=h.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...n||{},...t.data},t.loadParser=r??t.loadParser,t.parser=s??t.parser,t.format=o??t.format??t.src.split(".").pop().split("?").shift().split("#").shift(),void 0!==a&&(t.progressSize=a),t}}f.RETINA_PREFIX=/@([0-9\.]+)x/;const m=(t,e)=>{const i=e.split("?")[1];return i&&(t+=`?${i}`),t};var y=i(5589),g=i(9252),v=i(583);const b=class t{constructor(t,e){this.linkedSheets=[];let i=t;t?.source instanceof v.v&&(i={texture:t,data:e});const{texture:n,data:r,cachePrefix:s=""}=i;this.cachePrefix=s,this._texture=n instanceof y.g?n:null,this.textureSource=n.source,this.textures={},this.animations={},this.data=r;const o=parseFloat(r.meta.scale);o?(this.resolution=o,n.source.resolution=this.resolution):this.resolution=n.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise((e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=t.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()}))}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(e,i=!1){let n=e;const r=i?1/0:t.BATCH_SIZE;for(;n-e<r&&n<this._frameKeys.length;){const t=this._frameKeys[n],e=this._frames[t],i=e.frame;if(i){let n=null,r=null;const s=!1!==e.trimmed&&e.sourceSize?e.sourceSize:e.frame,o=new g.M(0,0,Math.floor(s.w)/this.resolution,Math.floor(s.h)/this.resolution);n=e.rotated?new g.M(Math.floor(i.x)/this.resolution,Math.floor(i.y)/this.resolution,Math.floor(i.h)/this.resolution,Math.floor(i.w)/this.resolution):new g.M(Math.floor(i.x)/this.resolution,Math.floor(i.y)/this.resolution,Math.floor(i.w)/this.resolution,Math.floor(i.h)/this.resolution),!1!==e.trimmed&&e.spriteSourceSize&&(r=new g.M(Math.floor(e.spriteSourceSize.x)/this.resolution,Math.floor(e.spriteSourceSize.y)/this.resolution,Math.floor(i.w)/this.resolution,Math.floor(i.h)/this.resolution)),this.textures[t]=new y.g({source:this.textureSource,frame:n,orig:o,trim:r,rotate:e.rotated?2:0,defaultAnchor:e.anchor,defaultBorders:e.borders,label:t.toString()})}n++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const n=t[e][i];this.animations[e].push(this.textures[n])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*t.BATCH_SIZE),this._batchIndex++,setTimeout((()=>{this._batchIndex*t.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())}),0)}destroy(t=!1){for(const t in this.textures)this.textures[t].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};b.BATCH_SIZE=1e3;let x=b;const _=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function w(t,e,i){const n={};if(t.forEach((t=>{n[t]=e})),Object.keys(e.textures).forEach((t=>{n[`${e.cachePrefix}${t}`]=e.textures[t]})),!i){const i=h.dirname(t[0]);e.linkedSheets.forEach(((t,r)=>{const s=w([`${i}/${e.data.meta.related_multi_packs[r]}`],t,!0);Object.assign(n,s)}))}return n}const S={extension:n.Ag.Asset,cache:{test:t=>t instanceof x,getCacheableAssets:(t,e)=>w(t,e,!1)},resolver:{extension:{type:n.Ag.ResolveParser,name:"resolveSpritesheet"},test:t=>{const e=t.split("?")[0].split("."),i=e.pop(),n=e.pop();return"json"===i&&_.includes(n)},parse:t=>{const e=t.split(".");return{resolution:parseFloat(f.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:n.Ag.LoadParser,priority:r.Normal,name:"spritesheetLoader"},testParse:async(t,e)=>".json"===h.extname(e.src).toLowerCase()&&!!t.frames,async parse(t,e,i){const{texture:n,imageFilename:r,textureOptions:s,cachePrefix:o}=e?.data??{};let a,l=h.dirname(e.src);if(l&&l.lastIndexOf("/")!==l.length-1&&(l+="/"),n instanceof y.g)a=n;else{const n=m(l+(r??t.meta.image),e.src);a=(await i.load([{src:n,data:s}]))[n]}const c=new x({texture:a.source,data:t,cachePrefix:o});await c.parse();const u=t?.meta?.related_multi_packs;if(Array.isArray(u)){const t=[];for(const n of u){if("string"!=typeof n)continue;let r=l+n;e.data?.ignoreMultiPack||(r=m(r,e.src),t.push(i.load({src:r,data:{textureOptions:s,ignoreMultiPack:!0}})))}const n=await Promise.all(t);c.linkedSheets=n,n.forEach((t=>{t.linkedSheets=[c].concat(c.linkedSheets.filter((e=>e!==t)))}))}return c},async unload(t,e,i){await i.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}};n.XO.add(S)},7309:(t,e,i)=>{i.d(e,{R:()=>o});var n=i(4458);class r{constructor(t,e=null,i=0,n=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=n}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const s=class t{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new r(null,null,1/0),this.deltaMS=1/t.targetFPMS,this.elapsedMS=1/t.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&null===this._requestId&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=n.d.NORMAL){return this._addListener(new r(t,e,i))}addOnce(t,e,i=n.d.NORMAL){return this._addListener(new r(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}else t.connect(i);return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i=i.match(t,e)?i.destroy():i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let i;if(e>this.lastTime){if(i=this.elapsedMS=e-this.lastTime,i>this._maxElapsedMS&&(i=this._maxElapsedMS),i*=this.speed,this._minElapsedMS){const t=e-this._lastFrame|0;if(t<this._minElapsedMS)return;this._lastFrame=e-t%this._minElapsedMS}this.deltaMS=i,this.deltaTime=this.deltaMS*t.targetFPMS;const n=this._head;let r=n.next;for(;r;)r=r.emit(this);n.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const i=Math.min(Math.max(0,e)/1e3,t.targetFPMS);this._maxElapsedMS=1/i,this._minElapsedMS&&e>this.maxFPS&&(this.maxFPS=e)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){0===t?this._minElapsedMS=0:(t<this.minFPS&&(this.minFPS=t),this._minElapsedMS=1/(t/1e3))}static get shared(){if(!t._shared){const e=t._shared=new t;e.autoStart=!0,e._protected=!0}return t._shared}static get system(){if(!t._system){const e=t._system=new t;e.autoStart=!0,e._protected=!0}return t._system}};s.targetFPMS=.06;let o=s},4458:(t,e,i)=>{i.d(e,{d:()=>n});var n=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(n||{})},4577:(t,e,i)=>{let n;function r(){if("boolean"==typeof n)return n;try{const t=new Function("param1","param2","param3","return param1[param2] === param3;");n=!0===t({a:"b"},"a","b")}catch(t){n=!1}return n}i.d(e,{f:()=>r})},2571:(t,e,i)=>{i.d(e,{xv:()=>n});i(8875);const n="8.17.1"},4334:(t,e,i)=>{i.d(e,{s:()=>n});class n{constructor(t){this.items=Object.create(null);const{renderer:e,type:i,onUnload:n,priority:r,name:s}=t;this._renderer=e,e.gc.addResourceHash(this,"items",i,r??0),this._onUnload=n,this.name=s}add(t){return!this.items[t.uid]&&(this.items[t.uid]=t,t.once("unload",this.remove,this),t._gcLastUsed=this._renderer.gc.now,!0)}remove(t,...e){if(!this.items[t.uid])return;const i=t._gpuData[this._renderer.uid];i&&(this._onUnload?.(t,...e),i.destroy(),t._gpuData[this._renderer.uid]=null,this.items[t.uid]=null)}removeAll(...t){Object.values(this.items).forEach((e=>e&&this.remove(e,...t)))}destroy(...t){this.removeAll(...t),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}},9903:(t,e,i)=>{function n(t,e,i){const n=t.length;let r;if(e>=n||0===i)return;const s=n-(i=e+i>n?n-e:i);for(r=e;r<s;++r)t[r]=t[r+i];t.length=s}i.d(e,{d:()=>n})},133:(t,e,i)=>{i.d(e,{L:()=>r});const n={default:-1};function r(t="default"){return void 0===n[t]&&(n[t]=-1),++n[t]}},2048:(t,e,i)=>{function n(t,e,i){const{width:n,height:r}=i.orig,s=i.trim;if(s){const i=s.width,o=s.height;t.minX=s.x-e._x*n,t.maxX=t.minX+i,t.minY=s.y-e._y*r,t.maxY=t.minY+o}else t.minX=-e._x*n,t.maxX=t.minX+n,t.minY=-e._y*r,t.maxY=t.minY+r}i.d(e,{y:()=>n})},7073:(t,e,i)=>{i.d(e,{M:()=>s,d:()=>o});var n=i(8507),r=i(2571);class s{static init(){globalThis.__PIXI_APP_INIT__?.(this,r.xv)}static destroy(){}}s.extension=n.Ag.Application;class o{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,r.xv)}destroy(){this._renderer=null}}o.extension={type:[n.Ag.WebGLSystem,n.Ag.WebGPUSystem],name:"initHook",priority:-10}},4670:(t,e,i)=>{i.d(e,{Ek:()=>s,lj:()=>r,t6:()=>a});const n=new Set,r="8.0.0",s="8.3.4",o={quiet:!1,noColor:!1},a=(t,e,i=3)=>{if(o.quiet||n.has(e))return;let r=(new Error).stack;const s=`${e}\nDeprecated since v${t}`,a="function"==typeof console.groupCollapsed&&!o.noColor;void 0===r?console.warn("PixiJS Deprecation Warning: ",s):(r=r.split("\n").splice(i).join("\n"),a?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",s),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",s),console.warn(r))),n.add(e)};Object.defineProperties(a,{quiet:{get:()=>o.quiet,set:t=>{o.quiet=t},enumerable:!0,configurable:!1},noColor:{get:()=>o.noColor,set:t=>{o.noColor=t},enumerable:!0,configurable:!1}})},268:(t,e,i)=>{i.d(e,{R:()=>s});let n=0;const r=500;function s(...t){n!==r&&(n++,n===r?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}},6083:(t,e,i)=>{i.d(e,{L:()=>n});const n={_registeredResources:new Set,register(t){this._registeredResources.add(t)},unregister(t){this._registeredResources.delete(t)},release(){this._registeredResources.forEach((t=>t.clear()))},get registeredCount(){return this._registeredResources.size},isRegistered(t){return this._registeredResources.has(t)},reset(){this._registeredResources.clear()}}},8655:(t,e,i)=>{i.d(e,{Z:()=>s});var n=i(6083);class r{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:(e=new this._classType,this._count++),e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let t=0;t<this._index;t++)this._pool[t].destroy();this._pool.length=0,this._count=0,this._index=0}}const s=new class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new r(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach((e=>{const i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}})),t}clear(){this._poolsByClass.forEach((t=>t.clear())),this._poolsByClass.clear()}};n.L.register(s)},8875:(t,e,i)=>{i.d(e,{A:()=>n});const n=i(5585)}},n={};function r(t){var e=n[t];if(void 0!==e)return e.exports;var s=n[t]={id:t,exports:{}};return i[t](s,s.exports,r),s.exports}r.m=i,r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.f={},r.e=t=>Promise.all(Object.keys(r.f).reduce(((e,i)=>(r.f[i](t,e),e)),[])),r.u=t=>t+".vizor_2d.min.js",r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t={},e="vizor_2d:",r.l=(i,n,s,o)=>{if(t[i])t[i].push(n);else{var a,l;if(void 0!==s)for(var h=document.getElementsByTagName("script"),c=0;c<h.length;c++){var u=h[c];if(u.getAttribute("src")==i||u.getAttribute("data-webpack")==e+s){a=u;break}}a||(l=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",e+s),a.src=i),t[i]=[n];var d=(e,n)=>{a.onerror=a.onload=null,clearTimeout(p);var r=t[i];if(delete t[i],a.parentNode&&a.parentNode.removeChild(a),r&&r.forEach((t=>t(n))),e)return e(n)},p=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),l&&document.head.appendChild(a)}},r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;if("string"==typeof import.meta.url&&(t=import.meta.url),!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=t})(),(()=>{r.b=document.baseURI||self.location.href;var t={792:0};r.f.j=(e,i)=>{var n=r.o(t,e)?t[e]:void 0;if(0!==n)if(n)i.push(n[2]);else{var s=new Promise(((i,r)=>n=t[e]=[i,r]));i.push(n[2]=s);var o=r.p+r.u(e),a=new Error;r.l(o,(i=>{if(r.o(t,e)&&(0!==(n=t[e])&&(t[e]=void 0),n)){var s=i&&("load"===i.type?"missing":i.type),o=i&&i.target&&i.target.src;a.message="Loading chunk "+e+" failed.\n("+s+": "+o+")",a.name="ChunkLoadError",a.type=s,a.request=o,n[1](a)}}),"chunk-"+e,e)}};var e=(e,i)=>{var n,s,[o,a,l]=i,h=0;if(o.some((e=>0!==t[e]))){for(n in a)r.o(a,n)&&(r.m[n]=a[n]);if(l)l(r)}for(e&&e(i);h<o.length;h++)s=o[h],r.o(t,s)&&t[s]&&t[s][0](),t[s]=0},i=self.webpackChunkvizor_2d=self.webpackChunkvizor_2d||[];i.forEach(e.bind(null,0)),i.push=e.bind(null,i.push.bind(i))})(),r.nc=void 0;var s={};function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,l(n.key),n)}}function l(t){var e=function(t,e){if("object"!=o(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==o(e)?e:e+""}r.d(s,{A5:()=>Bo,oY:()=>co,W_:()=>go,vY:()=>mn,TI:()=>jo,ey:()=>Vo,sV:()=>To});var h=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return e=t,n=[{key:"build",value:function(e){if(!e)return function(){return!0};switch(e.op){case"and":var i=e.rules.map((function(e){return t.build(e)}));return function(t){return i.every((function(e){return e(t)}))};case"or":var n=e.rules.map((function(e){return t.build(e)}));return function(t){return n.some((function(e){return e(t)}))};case"not":var r=t.build(e.rule);return function(t){return!r(t)};case"eq":return function(t){var i;return(null===(i=t.data)||void 0===i?void 0:i[e.field])===e.value};case"neq":return function(t){var i;return(null===(i=t.data)||void 0===i?void 0:i[e.field])!==e.value};case"gt":return function(t){var i;return(null===(i=t.data)||void 0===i?void 0:i[e.field])>e.value};case"lt":return function(t){var i;return(null===(i=t.data)||void 0===i?void 0:i[e.field])<e.value};case"gte":return function(t){var i;return(null===(i=t.data)||void 0===i?void 0:i[e.field])>=e.value};case"lte":return function(t){var i;return(null===(i=t.data)||void 0===i?void 0:i[e.field])<=e.value};case"regex":var s=new RegExp(e.value);return function(t){var i,n=null===(i=t.data)||void 0===i?void 0:i[e.field];return s.test(String(null!=n?n:""))};case"in":return function(t){var i;return e.value.includes(null===(i=t.data)||void 0===i?void 0:i[e.field])};case"exists":return function(t){return e.field in(t.data||{})};default:return console.warn("Unknown rule:",e),function(){return!0}}}}],(i=null)&&a(e.prototype,i),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,i,n}();function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function u(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||p(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=p(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function p(t,e){if(t){if("string"==typeof t)return f(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?f(t,e):void 0}}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function m(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,y(n.key),n)}}function y(t){var e=function(t,e){if("object"!=c(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==c(e)?e:e+""}var g=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.attractionStrength=.15,this.repulsionStrength=200,this.damping=.98,this.minDist=20,this.planetRadius=60,this.planetRepulsion=2,this.orbitStrength=0,this.collisionPadding=2,this.collisionIterations=2,this.velocityEpsilon=.01,this.energyThreshold=.1,this.cooling=.999,this.minStrength=.001},e=[{key:"setModel",value:function(t){this.model=t}},{key:"resolveMoonCollisions",value:function(t){for(var e=0;e<this.collisionIterations;e++)for(var i=0;i<t.length;i++)for(var n=i+1;n<t.length;n++){var r=t[i],s=t[n],o=r.radius||10,a=s.radius||10,l=s.x-r.x,h=s.y-r.y,c=Math.sqrt(l*l+h*h)||1e-4,u=o+a+this.collisionPadding;if(c<u){var d=l/c,p=h/c,f=.5*(u-c);r.fixed||(r.x-=d*f,r.y-=p*f),s.fixed||(s.x+=d*f,s.y+=p*f)}}}},{key:"step",value:function(){var t,e=this,i=this.model.getNodes(),n=i.filter((function(t){return"moon"===t.type})),r=i.filter((function(t){return"planet"===t.type})),s=d(n);try{for(s.s();!(t=s.n()).done;){var o=t.value;o.vx*=this.damping,o.vy*=this.damping}}catch(t){s.e(t)}finally{s.f()}for(var a=0;a<n.length;a++)for(var l=a+1;l<n.length;l++){var h=n[a],c=n[l],p=h.x-c.x,f=h.y-c.y,m=Math.sqrt(p*p+f*f)||.01;m=Math.max(m,this.minDist);var y=this.repulsionStrength/(m*m),g=p/m*y,v=f/m*y;h.fixed||(h.vx+=g,h.vy+=v),c.fixed||(c.vx-=g,c.vy-=v)}var b,x=d(r);try{var _=function(){var t=b.value,i=n.filter((function(e){return t.rule(e)}));if(0===i.length)return 1;if(t.sumField?t.sumTotal=i.reduce((function(e,i){var n,r=Number(null===(n=i.data)||void 0===n?void 0:n[t.sumField]);return e+(isNaN(r)?0:r)}),0):t.sumTotal=null,t.vector){var r,s={x:t.x,y:t.y},o=t.direction,a=t.length,l=t.scalarField,h=i.map((function(t){return t.data[l]})).filter((function(t){return null!=t})),c=Math.min.apply(Math,u(h)),p=Math.max.apply(Math,u(h)),f=d(i);try{for(f.s();!(r=f.n()).done;){var m=r.value,y=m.data[l];null==y&&(y=c);var g=p>c?(y-c)/(p-c):.5;m.x=s.x+o.x*a*g,m.y=s.y+o.y*a*g}}catch(t){f.e(t)}finally{f.f()}}else{var v,x=d(i);try{for(x.s();!(v=x.n()).done;){var _=v.value,w=t.x-_.x,S=t.y-_.y,C=Math.sqrt(w*w+S*S)||.01;C=Math.max(C,e.minDist);var A=100,E=w/C,M=S/C,T=e.attractionStrength*(C-A)*.5+.05*C;_.fixed||(_.vx+=E*T,_.vy+=M*T,_.vx+=.5*E,_.vy+=.5*M);var k=.85+.15*Math.min(1,C/A);_.vx*=k,_.vy*=k,_.vx*E+_.vy*M<0&&(_.vx*=.7,_.vy*=.7),C<3&&(_.x=t.x+E*A,_.y=t.y+M*A,_.vx=0,_.vy=0),C<102&&Math.abs(_.vx)<.05&&Math.abs(_.vy)<.05&&(_.vx=0,_.vy=0),0!==e.orbitStrength&&(_.vx+=-S/C*e.orbitStrength,_.vy+=w/C*e.orbitStrength)}}catch(t){x.e(t)}finally{x.f()}}};for(x.s();!(b=x.n()).done;)_()}catch(t){x.e(t)}finally{x.f()}var w,S=d(r);try{for(S.s();!(w=S.n()).done;){var C,A=w.value,E=d(n);try{for(E.s();!(C=E.n()).done;){var M=C.value,T=M.x-A.x,k=M.y-A.y,P=Math.sqrt(T*T+k*k)||.01;if(P<this.planetRadius){var I=this.planetRadius-P,O=T/P*I*this.planetRepulsion,R=k/P*I*this.planetRepulsion;M.fixed||(M.vx+=O,M.vy+=R)}}}catch(t){E.e(t)}finally{E.f()}}}catch(t){S.e(t)}finally{S.f()}var L,j=this.bounds||{minX:-1/0,maxX:1/0,minY:-1/0,maxY:1/0},D=0,F=d(n);try{for(F.s();!(L=F.n()).done;){var N=L.value;N.fixed||(N.x+=N.vx,N.y+=N.vy,N.x=Math.max(j.minX,Math.min(j.maxX,N.x)),N.y=Math.max(j.minY,Math.min(j.maxY,N.y)),N.vx*=.9,N.vy*=.9,Math.abs(N.vx)<this.velocityEpsilon&&(N.vx=0),Math.abs(N.vy)<this.velocityEpsilon&&(N.vy=0),D+=Math.abs(N.vx)+Math.abs(N.vy))}}catch(t){F.e(t)}finally{F.f()}this.resolveMoonCollisions(n);var B,G=D>=this.energyThreshold,z=d(n);try{for(z.s();!(B=z.n()).done;)B.value.dirty=G}catch(t){z.e(t)}finally{z.f()}if(!G){var W,U=d(n);try{for(U.s();!(W=U.n()).done;){var H=W.value;H.vx=0,H.vy=0}}catch(t){U.e(t)}finally{U.f()}}D<5&&(this.attractionStrength=Math.max(this.minStrength,.95*this.attractionStrength),this.repulsionStrength=Math.max(this.minStrength,.95*this.repulsionStrength))}}],e&&m(t.prototype,e),i&&m(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function b(t){return function(t){if(Array.isArray(t))return w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=_(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function _(t,e){if(t){if("string"==typeof t)return w(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?w(t,e):void 0}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function S(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,C(n.key),n)}}function C(t){var e=function(t,e){if("object"!=v(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=v(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==v(e)?e:e+""}var A=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.attractionStrength=.05,this.repulsionStrength=200,this.damping=.9,this.minDist=20,this.minDistSq=this.minDist*this.minDist,this.planetRadius=60,this.planetRepulsion=2,this.orbitStrength=0,this.cellSize=80,this.maxNeighbors=15},e=[{key:"setModel",value:function(t){this.model=t}},{key:"_buildGrid",value:function(t){var e,i=new Map,n=x(t);try{for(n.s();!(e=n.n()).done;){var r=e.value,s=Math.floor(r.x/this.cellSize),o=Math.floor(r.y/this.cellSize),a=s+","+o;i.has(a)||i.set(a,[]),i.get(a).push(r),r._cellX=s,r._cellY=o}}catch(t){n.e(t)}finally{n.f()}return i}},{key:"_getNeighbors",value:function(t,e){for(var i=[],n=-1;n<=1;n++)for(var r=-1;r<=1;r++){var s=e._cellX+n+","+(e._cellY+r),o=t.get(s);if(o){var a,l=x(o);try{for(l.s();!(a=l.n()).done;){var h=a.value;if(h!==e&&(i.push(h),i.length>=this.maxNeighbors))return i}}catch(t){l.e(t)}finally{l.f()}}}return i}},{key:"step",value:function(){var t=this,e=this.model.getNodes(),i=e.filter((function(t){return"moon"===t.type})),n=e.filter((function(t){return"planet"===t.type})),r=this.bounds;if(r){var s,o=x(i);try{for(o.s();!(s=o.n()).done;){var a=s.value;a.vx*=this.damping,a.vy*=this.damping}}catch(t){o.e(t)}finally{o.f()}var l,h=this._buildGrid(i),c=x(i);try{for(c.s();!(l=c.n()).done;){var u,d=l.value,p=x(this._getNeighbors(h,d));try{for(p.s();!(u=p.n()).done;){var f=u.value,m=d.x-f.x,y=d.y-f.y,g=m*m+y*y;g<this.minDistSq&&(g=this.minDistSq);var v=this.repulsionStrength/g,_=Math.sqrt(g),w=m/_*v,S=y/_*v;d.fixed||(d.vx+=w,d.vy+=S)}}catch(t){p.e(t)}finally{p.f()}}}catch(t){c.e(t)}finally{c.f()}var C,A=x(n);try{var E=function(){var e=C.value,n=i.filter((function(t){return e.rule(t)}));if(0===n.length)return 1;if(e.vector){var r,s={x:e.x,y:e.y},o=e.direction,a=e.length,l=e.scalarField,h=n.map((function(t){return t.data[l]})).filter((function(t){return null!=t})),c=Math.min.apply(Math,b(h)),u=Math.max.apply(Math,b(h)),d=x(n);try{for(d.s();!(r=d.n()).done;){var p=r.value,f=p.data[l];null==f&&(f=c);var m=u>c?(f-c)/(u-c):.5;p.x=s.x+o.x*a*m,p.y=s.y+o.y*a*m}}catch(t){d.e(t)}finally{d.f()}}else{var y,g=x(n);try{for(g.s();!(y=g.n()).done;){var v=y.value,_=e.x-v.x,w=e.y-v.y,S=_*_+w*w;S<t.minDistSq&&(S=t.minDistSq);var A=Math.sqrt(S),E=t.attractionStrength*A;v.fixed||(v.vx+=_/A*E,v.vy+=w/A*E),0!==t.orbitStrength&&(v.vx+=-w/A*t.orbitStrength,v.vy+=_/A*t.orbitStrength)}}catch(t){g.e(t)}finally{g.f()}}};for(A.s();!(C=A.n()).done;)E()}catch(t){A.e(t)}finally{A.f()}var M,T=x(n);try{for(T.s();!(M=T.n()).done;){var k,P=M.value,I=x(i);try{for(I.s();!(k=I.n()).done;){var O=k.value,R=O.x-P.x,L=O.y-P.y,j=Math.sqrt(R*R+L*L)||.01;if(j<this.planetRadius){var D=this.planetRadius-j,F=R/j*D*this.planetRepulsion,N=L/j*D*this.planetRepulsion;O.fixed||(O.vx+=F,O.vy+=N)}}}catch(t){I.e(t)}finally{I.f()}}}catch(t){T.e(t)}finally{T.f()}var B,G=x(i);try{for(G.s();!(B=G.n()).done;){var z=B.value;z.fixed||(z.x+=z.vx,z.y+=z.vy,z.x=Math.max(r.minX,Math.min(r.maxX,z.x)),z.y=Math.max(r.minY,Math.min(r.maxY,z.y)))}}catch(t){G.e(t)}finally{G.f()}}}}],e&&S(t.prototype,e),i&&S(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function E(t){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E(t)}function M(t){return function(t){if(Array.isArray(t))return P(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||k(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=k(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function k(t,e){if(t){if("string"==typeof t)return P(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?P(t,e):void 0}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function I(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,O(n.key),n)}}function O(t){var e=function(t,e){if("object"!=E(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=E(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==E(e)?e:e+""}var R=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.innerRadius=20,this.outerRadius=300,this.turns=4,this.spread=1,this.smoothing=.15,this.angleOffset=0,this.arcStep=12,this.wobbleStrength=2,this.wobbleFrequency=2,this.wobbleSpeed=.02,this.wobbleThreshold=3e3},e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this,i=this.model.getNodes(),n=i.filter((function(t){return"moon"===t.type})),r=T(i.filter((function(t){return"planet"===t.type})));try{var s=function(){var i=t.value,r=i.scalarField;if(!r)return 0;var s=n.filter((function(t){return i.rule(t)}));if(0===s.length)return 0;var o,a=1/0,l=-1/0,h=T(s);try{for(h.s();!(o=h.n()).done;){var c=o.value.data[r];null!=c&&(c<a&&(a=c),c>l&&(l=c))}}catch(t){h.e(t)}finally{h.f()}if(a===1/0||l===-1/0)return 0;i._sorted&&!i._dirty||(i._sorted=M(s).sort((function(t,e){var i,n;return(null!==(i=t.data[r])&&void 0!==i?i:a)-(null!==(n=e.data[r])&&void 0!==n?n:a)})),i._sorted.forEach((function(t,e){t._spiralIndex=e})),i._dirty=!1);var u,d=i._sorted,p=d.length<e.wobbleThreshold,f=T(d);try{for(f.s();!(u=f.n()).done;){var m=u.value,y=m.data[r];null==y&&(y=a);var g=l>a?(y-a)/(l-a):.5,v=e.angleOffset+g*e.turns*Math.PI*2,b=e.innerRadius+g*(e.outerRadius-e.innerRadius)*e.spread,x=m._spiralIndex||0,_=v+x*(e.arcStep/(b+1)),w=b+.5*x,S=0;p&&(void 0===m._spiralPhase&&(m._spiralPhase=Math.random()*Math.PI*2),m._spiralPhase+=e.wobbleSpeed,S=Math.sin(m._spiralPhase*e.wobbleFrequency)*e.wobbleStrength);var C=i.x+Math.cos(_)*(w+S),A=i.y+Math.sin(_)*(w+S);m.x+=(C-m.x)*e.smoothing,m.y+=(A-m.y)*e.smoothing}}catch(t){f.e(t)}finally{f.f()}};for(r.s();!(t=r.n()).done;)s()}catch(t){r.e(t)}finally{r.f()}}}],e&&I(t.prototype,e),i&&I(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function L(t){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},L(t)}function j(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=F(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function D(t){return function(t){if(Array.isArray(t))return N(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||F(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(t,e){if(t){if("string"==typeof t)return N(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?N(t,e):void 0}}function N(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function B(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function G(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,W(n.key),n)}}function z(t,e,i){return e&&G(t.prototype,e),i&&G(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function W(t){var e=function(t,e){if("object"!=L(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=L(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==L(e)?e:e+""}var U=function(){return z((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.min,n=void 0===i?0:i,r=e.max,s=void 0===r?1:r,o=e.start,a=void 0===o?0:o,l=e.end,h=void 0===l?100:l,c=e.invert,u=void 0!==c&&c;B(this,t),this.min=n,this.max=s,this.start=a,this.end=h,this.invert=u}),[{key:"map",value:function(t){var e=this.max>this.min?(t-this.min)/(this.max-this.min):.5;return this.invert&&(e=1-e),this.start+e*(this.end-this.start)}}])}(),H=function(){return z((function t(){B(this,t),this.smoothing=.2,this.padding=40,this.jitter=10}),[{key:"setModel",value:function(t){this.model=t}},{key:"_mapCategorical",value:function(t){var e=D(new Set(t)),i=new Map;return e.forEach((function(t,e){return i.set(t,e)})),i}},{key:"step",value:function(){var t=this,e=this.model.getNodes(),i=e.filter((function(t){return"moon"===t.type})),n=e.filter((function(t){return"vector"===t.type})),r=this.bounds;if(r){var s,o=r.minY+this.padding,a=r.maxY-this.padding,l=r.minX+this.padding,h=r.maxX-this.padding,c=j(n);try{var u=function(){var e,n,r=s.value,c=r.scalarField;if(!c)return 0;var u=i.filter((function(t){return r.rule(t)}));if(!u.length)return 0;var d,p,f,m,y=[],g=!0,v=j(u);try{for(v.s();!(d=v.n()).done;){var b=d.value,x=b.data[c];if(null!=x){var _=Number(x);isNaN(_)&&(g=!1),b._value=g?_:x,y.push(b._value)}}}catch(t){v.e(t)}finally{v.f()}if(!y.length)return 0;if(g)p=Math.min.apply(Math,y),f=Math.max.apply(Math,y);else{p=0,f=(m=t._mapCategorical(y)).size-1;var w,S=j(u);try{for(S.s();!(w=S.n()).done;){var C=w.value;C._value=m.get(C._value)}}catch(t){S.e(t)}finally{S.f()}}var A=new U({min:p,max:f,start:l,end:h}),E=new U({min:p,max:f,start:o,end:a});u.sort((function(t,e){var i,n;return(null!==(i=t._value)&&void 0!==i?i:0)-(null!==(n=e._value)&&void 0!==n?n:0)}));for(var M=0!==(null===(e=r.direction)||void 0===e?void 0:e.x),T=0!==(null===(n=r.direction)||void 0===n?void 0:n.y),k=u.length,P=(h-l)/Math.max(1,k-1),I=(a-o)/Math.max(1,k-1),O=0;O<k;O++){var R,L=u[O],D=null!==(R=L._value)&&void 0!==R?R:p,F=L.x,N=L.y;if(M)F=.7*(l+O*P)+.3*A.map(D),N=L.y+(Math.random()-.5)*t.jitter;if(T)N=.7*(o+O*I)+.3*E.map(D),F=L.x+(Math.random()-.5)*t.jitter;L.x+=(F-L.x)*t.smoothing,L.y+=(N-L.y)*t.smoothing}};for(c.s();!(s=c.n()).done;)u()}catch(t){c.e(t)}finally{c.f()}}}}])}();function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function X(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=$(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function Y(t){return function(t){if(Array.isArray(t))return q(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||$(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(t,e){if(t){if("string"==typeof t)return q(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?q(t,e):void 0}}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function K(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Z(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,J(n.key),n)}}function Q(t,e,i){return e&&Z(t.prototype,e),i&&Z(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function J(t){var e=function(t,e){if("object"!=V(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=V(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==V(e)?e:e+""}var tt=function(){return Q((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.min,n=void 0===i?0:i,r=e.max,s=void 0===r?1:r,o=e.start,a=void 0===o?0:o,l=e.end,h=void 0===l?100:l,c=e.invert,u=void 0!==c&&c;K(this,t),this.min=n,this.max=s,this.start=a,this.end=h,this.invert=u}),[{key:"map",value:function(t){var e=this.max>this.min?(t-this.min)/(this.max-this.min):.5;return this.invert&&(e=1-e),this.start+e*(this.end-this.start)}}])}(),et=function(){return Q((function t(){K(this,t),this.smoothing=.2,this.padding=40,this.jitter=10,this.repulsion=.8,this.minDist=25,this.iterations=1}),[{key:"setModel",value:function(t){this.model=t}},{key:"_mapCategorical",value:function(t){var e=Y(new Set(t)),i=new Map;return e.forEach((function(t,e){return i.set(t,e)})),i}},{key:"step",value:function(){var t=this,e=this.model.getNodes(),i=e.filter((function(t){return"moon"===t.type})),n=e.filter((function(t){return"vector"===t.type})),r=this.bounds;if(r){var s,o=r.minY+this.padding,a=r.maxY-this.padding,l=r.minX+this.padding,h=r.maxX-this.padding,c=X(n);try{var u=function(){var e,n,r=s.value,c=r.scalarField;if(!c)return 0;var u=i.filter((function(t){return r.rule(t)}));if(!u.length)return 0;var d,p,f,m,y=[],g=!0,v=X(u);try{for(v.s();!(d=v.n()).done;){var b=d.value,x=b.data[c];if(null!=x){var _=Number(x);isNaN(_)&&(g=!1),b._value=g?_:x,y.push(b._value)}}}catch(t){v.e(t)}finally{v.f()}if(!y.length)return 0;if(g)p=Math.min.apply(Math,y),f=Math.max.apply(Math,y);else{p=0,f=(m=t._mapCategorical(y)).size-1;var w,S=X(u);try{for(S.s();!(w=S.n()).done;){var C=w.value;C._value=m.get(C._value)}}catch(t){S.e(t)}finally{S.f()}}var A=new tt({min:p,max:f,start:l,end:h}),E=new tt({min:p,max:f,start:o,end:a});u.sort((function(t,e){var i,n;return(null!==(i=t._value)&&void 0!==i?i:0)-(null!==(n=e._value)&&void 0!==n?n:0)}));for(var M=0!==(null===(e=r.direction)||void 0===e?void 0:e.x),T=0!==(null===(n=r.direction)||void 0===n?void 0:n.y),k=u.length,P=(Math.max(1,k-1),Math.max(1,k-1),0);P<k;P++){var I,O=u[P],R=null!==(I=O._value)&&void 0!==I?I:p,L=O.x,j=O.y;if(M){L=A.map(R),j=O.y+(Math.random()-.5)*t.jitter}if(T){j=E.map(R),L=O.x+(Math.random()-.5)*t.jitter}O.x+=(L-O.x)*t.smoothing,O.y+=(j-O.y)*t.smoothing}for(var D=0;D<t.iterations;D++)for(var F=0;F<k-1;F++){var N=u[F],B=u[F+1],G=B.x-N.x,z=B.y-N.y;if(!(Math.abs(G)>t.minDist&&Math.abs(z)>t.minDist)){var W=Math.sqrt(G*G+z*z)||1e-4;if(W<t.minDist){var U=(t.minDist-W)/W;if(M){var H=z*U*.5*t.repulsion;N.y-=H,B.y+=H}if(T){var V=G*U*.5*t.repulsion;N.x-=V,B.x+=V}}}}};for(c.s();!(s=c.n()).done;)u()}catch(t){c.e(t)}finally{c.f()}}}}])}();function it(t){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},it(t)}function nt(t){return function(t){if(Array.isArray(t))return st(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||rt(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rt(t,e){if(t){if("string"==typeof t)return st(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?st(t,e):void 0}}function st(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function ot(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,at(n.key),n)}}function at(t){var e=function(t,e){if("object"!=it(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=it(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==it(e)?e:e+""}var lt=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.innerRadius=20,this.outerRadius=300,this.turns=4,this.spread=1,this.smoothing=.15,this.angleOffset=0,this.jitter=.002,this.wobbleStrength=2,this.wobbleFrequency=2},e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this,i=this.model.getNodes(),n=i.filter((function(t){return"moon"===t.type})),r=function(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=rt(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}(i.filter((function(t){return"planet"===t.type})));try{var s=function(){var i=t.value,r=i.scalarField;if(!r)return 0;var s=n.filter((function(t){return i.rule(t)}));if(0===s.length)return 0;s.sort((function(t,e){var i,n;return(null!==(i=t.data[r])&&void 0!==i?i:0)-(null!==(n=e.data[r])&&void 0!==n?n:0)}));var o=s.map((function(t){return t.data[r]})).filter((function(t){return null!=t}));if(0===o.length)return 0;var a=Math.min.apply(Math,nt(o)),l=Math.max.apply(Math,nt(o));s.forEach((function(t,n){var s=t.data[r];null==s&&(s=a);var o=l>a?(s-a)/(l-a):.5,h=e.angleOffset+o*e.turns*Math.PI*2,c=e.innerRadius+o*(e.outerRadius-e.innerRadius)*e.spread;void 0===t._spiralPhase&&(t._spiralPhase=Math.random()*Math.PI*2),t._spiralPhase+=.02;var u=Math.sin(t._spiralPhase*e.wobbleFrequency)*e.wobbleStrength,d=i.x+Math.cos(h)*(c+u),p=i.y+Math.sin(h)*(c+u);Math.random(),e.jitter,t.x+=(d-t.x)*e.smoothing,t.y+=(p-t.y)*e.smoothing}))};for(r.s();!(t=r.n()).done;)s()}catch(t){r.e(t)}finally{r.f()}}}],e&&ot(t.prototype,e),i&&ot(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function ht(t){return ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ht(t)}function ct(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return ut(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ut(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function ut(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function dt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,pt(n.key),n)}}function pt(t){var e=function(t,e){if("object"!=ht(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=ht(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ht(e)?e:e+""}var ft=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.innerRadius=50,this.outerRadius=240,this.angularSpeed=.002,this.smoothing=.15,this.wobbleStrength=2,this.wobbleFrequency=2,this.angleJitter=.002},e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this,i=this.model.getNodes(),n=i.filter((function(t){return"moon"===t.type})),r=ct(i.filter((function(t){return"planet"===t.type})));try{var s=function(){var i=t.value;i._orbits=[];var r=i.scalarField;if(!r)return 0;var s=n.filter((function(t){return i.rule(t)}));if(!s.length)return 0;var o={};s.forEach((function(t){var e=null!=t.data[r]?t.data[r]:"__null__";o[e]||(o[e]=[]),o[e].push(t)}));var a=Object.keys(o),l=a.length;a.forEach((function(t,n){var r=o[t],s=e.innerRadius+n/(l-1||1)*(e.outerRadius-e.innerRadius);i._orbits.push({value:t,radius:s,count:r.length}),r.forEach((function(t,n){void 0===t._orbitAngle&&(t._orbitAngle=Math.random()*Math.PI*2),t._orbitAngle+=e.angularSpeed;var r=Math.sin(t._orbitAngle*e.wobbleFrequency)*e.wobbleStrength,o=i.x+Math.cos(t._orbitAngle)*(s+r),a=i.y+Math.sin(t._orbitAngle)*(s+r);t._orbitAngle+=(Math.random()-.5)*e.angleJitter,t.x+=(o-t.x)*e.smoothing,t.y+=(a-t.y)*e.smoothing}))}))};for(r.s();!(t=r.n()).done;)s()}catch(t){r.e(t)}finally{r.f()}}}],e&&dt(t.prototype,e),i&&dt(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function mt(t){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(t)}function yt(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return gt(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?gt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function gt(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function vt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,bt(n.key),n)}}function bt(t){var e=function(t,e){if("object"!=mt(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==mt(e)?e:e+""}var xt=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gravity=.05,this.damping=.999,this.restitution=.7,this.friction=.98,this.radius=10},(e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this.model.getNodes().filter((function(t){return"moon"===t.type})),i=this.bounds,n=i.maxY,r=yt(e);try{for(r.s();!(t=r.n()).done;){var s=t.value;if(!s.fixed){if(s.vy+=this.gravity,s.x+=s.vx,s.y+=s.vy,s.y+this.radius>n){s.y=n-this.radius,s.vy*=-this.restitution,s.vx*=this.friction;var o=.6*(Math.random()-.5),a=.4*Math.abs(s.vy);s.vx+=Math.sin(o)*a}s.x-this.radius<i.minX&&(s.x=i.minX+this.radius,s.vx*=-this.restitution),s.x+this.radius>i.maxX&&(s.x=i.maxX-this.radius,s.vx*=-this.restitution),s.vx*=this.damping,s.vy*=this.damping}}}catch(t){r.e(t)}finally{r.f()}}}])&&vt(t.prototype,e),i&&vt(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function _t(t){return _t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_t(t)}function wt(t){return function(t){if(Array.isArray(t))return Ct(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||St(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function St(t,e){if(t){if("string"==typeof t)return Ct(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ct(t,e):void 0}}function Ct(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function At(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Et(n.key),n)}}function Et(t){var e=function(t,e){if("object"!=_t(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=_t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_t(e)?e:e+""}var Mt=function(){return t=function t(e,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.view=e,this.model=i,this.main=null,this.selected=new Set,this._bindViewEvents()},e=[{key:"_bindViewEvents",value:function(){var t=this;this.view.onNodeClick=function(e){t._inspectNode(e)},this.view.interaction.onNodeRightClick=function(e){var i=e.node,n=e.global,r=(e.ev,t.view.app.canvas.getBoundingClientRect());console.log("CLICKEDDD",i);var s=r.left+n.x,o=r.top+n.y;t.view.selectedNodes.size>1?t._showGroupContextMenu(s,o,i):t._showContextMenu(s,o,i)},this.view.interaction.onStageRightClick=function(e){var i=t.view.app.canvas.getBoundingClientRect();console.log("CLICKEDDD");var n=i.left+e.x,r=i.top+e.y;t.view.selectedNodes.size>1?t._showGroupContextMenu(n,r,null):t._showGraphContextMenu(n,r)},this.view.onNodeDragStart=function(t){t.vx=0,t.vy=0,t.fixed=!0},this.view.onNodeDragMove=function(t,e){t.x=e.x,t.y=e.y},this.view.onNodeDragEnd=function(t){t.fixed=!1},this.view.interaction.onBackgroundPointerDown=function(){t._hideContextMenu(),t._hideGraphContextMenu()},this.view.onSelectionChange=function(e){console.log("Selected nodes:",e),t._refreshFormulaNodes()}}},{key:"_showGraphContextMenu",value:function(t,e){var i=this;this._hideGraphContextMenu();var n=document.createElement("div");n.className="context-menu";var r=this.view.app.canvas.parentElement,s=r.getBoundingClientRect();n.style.position="absolute",n.style.left="".concat(t-s.left,"px"),n.style.top="".concat(e-s.top,"px"),n.style.background="#2b2b2b",n.style.color="#fff",n.style.padding="6px",n.style.borderRadius="8px",n.style.zIndex=1e3,n.style.minWidth="160px",n.style.boxShadow="0 4px 12px rgba(0,0,0,0.4)",n.style.fontSize="13px",n.style.userSelect="none";var o=function(t,e){var i=document.createElement("div");return i.textContent=t,i.style.padding="8px 12px",i.style.borderRadius="6px",i.style.cursor="pointer",i.style.transition="background 0.15s",i.addEventListener("mouseenter",(function(){i.style.background="#3a3a3a"})),i.addEventListener("mouseleave",(function(){i.style.background="transparent"})),i.addEventListener("click",e),i};n.appendChild(o("⏸ Freeze Graph",(function(){var t,e;null===(t=(e=i.main).pauseGraph)||void 0===t||t.call(e),i._hideGraphContextMenu()}))),n.appendChild(o("▶ Resume Graph",(function(){var t,e;null===(t=(e=i.main).resumeGraph)||void 0===t||t.call(e),i._hideGraphContextMenu()}))),n.appendChild(o("| Remove Y Axis",(function(){i.model.removeYVectors(),i._hideGraphContextMenu()}))),n.appendChild(o("- Remove X Axis",(function(){i.model.removeXVectors(),i._hideGraphContextMenu()}))),n.appendChild(o("hide this menu",(function(){i._hideGraphContextMenu()}))),r.appendChild(n);var a=n.getBoundingClientRect(),l=t-s.left,h=e-s.top;l+a.width>s.width&&(l=s.width-a.width-4),h+a.height>s.height&&(h=s.height-a.height-4),l=Math.max(4,l),h=Math.max(4,h),n.style.left="".concat(l,"px"),n.style.top="".concat(h,"px"),this._graphContextMenu=n}},{key:"_inspectNode",value:function(t){var e=document.getElementById("inspector");e||((e=document.createElement("div")).id="inspector",document.body.appendChild(e)),e.innerHTML="\n <pre>".concat(JSON.stringify(t.data,null,2),"</pre>\n ")}},{key:"_hideGraphContextMenu",value:function(){this._graphContextMenu&&(this._graphContextMenu.remove(),this._graphContextMenu=null)}},{key:"_showContextMenu",value:function(t,e,i){var n=this;this._hideContextMenu();var r=document.createElement("div");r.className="context-menu";var s=this.view.app.canvas.parentElement,o=s.getBoundingClientRect();r.style.position="absolute",r.style.left="".concat(t-o.left,"px"),r.style.top="".concat(e-o.top,"px"),r.style.background="#2b2b2b",r.style.color="#fff",r.style.padding="6px",r.style.borderRadius="8px",r.style.zIndex=1e3,r.style.minWidth="140px",r.style.boxShadow="0 4px 12px rgba(0,0,0,0.4)",r.style.fontSize="13px",r.style.userSelect="none";var a=function(t,e){var i=document.createElement("div");return i.textContent=t,i.style.padding="8px 12px",i.style.borderRadius="6px",i.style.cursor="pointer",i.style.transition="background 0.15s",i.addEventListener("mouseenter",(function(){i.style.background="#3a3a3a"})),i.addEventListener("mouseleave",(function(){i.style.background="transparent"})),i.addEventListener("click",e),i};r.appendChild(a("🗑 Delete Node",(function(){n._deleteNode(i),n._hideContextMenu()})));var l=document.createElement("div");l.style.height="1px",l.style.background="#444",l.style.margin="4px 0",r.appendChild(l),r.appendChild(a("🔍 Inspect",(function(){var t,e;null===(t=(e=n.main).onNodeInspect)||void 0===t||t.call(e,i),n._hideContextMenu()}))),s.appendChild(r),r.style.visibility="hidden",r.style.left="0px",r.style.top="0px";var h=r.getBoundingClientRect(),c=t-o.left,u=e-o.top,d=o.width,p=o.height;c+h.width>d&&(c=d-h.width-4),u+h.height>p&&(u=p-h.height-4),c=Math.max(4,c),u=Math.max(4,u),r.style.left="".concat(c,"px"),r.style.top="".concat(u,"px"),r.style.visibility="visible",this._contextMenu=r}},{key:"_hideContextMenu",value:function(){this._contextMenu&&(this._contextMenu.remove(),this._contextMenu=null),this._hideGroupContextMenu()}},{key:"_showGroupContextMenu",value:function(t,e,i){var n=this;this._hideGroupContextMenu();var r=document.createElement("div");r.className="context-menu";var s=this.view.app.canvas.parentElement,o=s.getBoundingClientRect();r.style.position="absolute",r.style.left="".concat(t-o.left,"px"),r.style.top="".concat(e-o.top,"px"),r.style.background="#2b2b2b",r.style.color="#fff",r.style.padding="6px",r.style.borderRadius="8px",r.style.zIndex=1e3,r.style.minWidth="140px",r.style.boxShadow="0 4px 12px rgba(0,0,0,0.4)",r.style.fontSize="13px",r.style.userSelect="none";var a=function(t,e){var i=document.createElement("div");return i.textContent=t,i.style.padding="8px 12px",i.style.borderRadius="6px",i.style.cursor="pointer",i.style.transition="background 0.15s",i.addEventListener("mouseenter",(function(){i.style.background="#3a3a3a"})),i.addEventListener("mouseleave",(function(){i.style.background="transparent"})),i.addEventListener("click",e),i};r.appendChild(a("🗑 Delete Selected Nodes",(function(){for(var t=0,e=wt(n.view.selectedNodes);t<e.length;t++){var i=e[t];n._deleteNode(i)}n.view.selectedNodes.clear(),n.view.renderer.updateSelection(n.view.selectedNodes),n._hideGroupContextMenu()})));var l=document.createElement("div");l.style.height="1px",l.style.background="#444",l.style.margin="4px 0",r.appendChild(l),r.appendChild(a("🔍 Inspect Selection",(function(){var t,e;null===(t=(e=n.main).onGroupInspect)||void 0===t||t.call(e,n.view.getSelectedMoons()),n._hideGroupContextMenu()}))),s.appendChild(r),this._groupContextMenu=r}},{key:"_hideGroupContextMenu",value:function(){this._groupContextMenu&&(this._groupContextMenu.remove(),this._groupContextMenu=null)}},{key:"_deleteNode",value:function(t){var e,i,n;this.model.deleteNode(t.id),this.view.renderer.remove(t.id),null===(e=this.view.selectedNodes)||void 0===e||e.delete(t),this.view.renderer.updateSelection(this.view.selectedNodes),null===(i=(n=this.view).onSelectionChange)||void 0===i||i.call(n,this.view.selectedNodes),this._hideContextMenu()}},{key:"_highlight",value:function(t){var e=this.view.graphicsMap.get(t);e&&(e.tint=16711680)}},{key:"_refreshFormulaNodes",value:function(){var t,e=this.model.getNodes(),i=e.filter((function(t){return"formula"!==t.type})),n=wt(this.view.selectedNodes).filter((function(t){return"formula"!==t.type})),r={sum:function(t,e){return t.reduce((function(t,i){var n;return t+Number((null===(n=i.data)||void 0===n?void 0:n[e])||0)}),0)},count:function(t){return t.length},avg:function(t,e){return t.length?r.sum(t,e)/t.length:0},min:function(t,e){return t.length?Math.min.apply(Math,wt(t.map((function(t){var i;return Number((null===(i=t.data)||void 0===i?void 0:i[e])||0)})))):0},max:function(t,e){return t.length?Math.max.apply(Math,wt(t.map((function(t){var i;return Number((null===(i=t.data)||void 0===i?void 0:i[e])||0)})))):0}},s=function(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=St(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}(e);try{for(s.s();!(t=s.n()).done;){var o=t.value;if("formula"===o.type){console.log("refreshing".node);var a="selected"===o.scope?n:i,l=r[o.formula]||r.sum;o.value=l(a,o.scalarField)}}}catch(t){s.e(t)}finally{s.f()}}}],e&&At(t.prototype,e),i&&At(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}(),Tt=r(8507);const kt={extension:{type:Tt.Ag.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.all([r.e(859),r.e(397)]).then(r.bind(r,8397))}},Pt={extension:{type:Tt.Ag.Environment,name:"webworker",priority:0},test:()=>"undefined"!=typeof self&&void 0!==self.WorkerGlobalScope,load:async()=>{await Promise.all([r.e(859),r.e(162)]).then(r.bind(r,2162))}};r(5753),r(6312);var It=r(1761),Ot=r(800);let Rt,Lt;async function jt(t={}){return void 0!==Lt||(Lt=await(async()=>{const e=It.e.get().getNavigator().gpu;if(!e)return!1;try{const i=await e.requestAdapter(t);return await i.requestDevice(),!0}catch(t){return!1}})()),Lt}const Dt=["webgl","webgpu","canvas"];var Ft=r(5559),Nt=r(7073),Bt=r(4670);class Gt{static init(t){Object.defineProperty(this,"resizeTo",{configurable:!0,set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame((()=>this.resize())))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;let t,e;if(this._cancelResize(),this._resizeTo===globalThis.window)t=globalThis.innerWidth,e=globalThis.innerHeight;else{const{clientWidth:i,clientHeight:n}=this._resizeTo;t=i,e=n}this.renderer.resize(t,e),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Gt.extension=Tt.Ag.Application;var zt=r(4458),Wt=r(7309);class Ut{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{configurable:!0,set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,zt.d.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Wt.R.shared:new Wt.R,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Ut.extension=Tt.Ag.Application,Tt.XO.add(Gt),Tt.XO.add(Ut);const Ht=class t{constructor(...t){this.stage=new Ft.mc,void 0!==t[0]&&(0,Bt.t6)(Bt.lj,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.stage||(this.stage=new Ft.mc),this.renderer=await async function(t){let e,i=[];t.preference?(i.push(t.preference),Dt.forEach((e=>{e!==t.preference&&i.push(e)}))):i=Dt.slice();let n={};for(let o=0;o<i.length;o++){const a=i[o];if("webgpu"===a&&await jt()){const{WebGPURenderer:i}=await Promise.all([r.e(468),r.e(866)]).then(r.bind(r,9866));e=i,n={...t,...t.webgpu};break}if("webgl"===a&&(s=t.failIfMajorPerformanceCaveat??Ot.k.defaultOptions.failIfMajorPerformanceCaveat,void 0!==Rt||(Rt=(()=>{const t={stencil:!0,failIfMajorPerformanceCaveat:s??Ot.k.defaultOptions.failIfMajorPerformanceCaveat};try{if(!It.e.get().getWebGLRenderingContext())return!1;let e=It.e.get().createCanvas().getContext("webgl",t);const i=!!e?.getContextAttributes()?.stencil;if(e){const t=e.getExtension("WEBGL_lose_context");t&&t.loseContext()}return e=null,i}catch(t){return!1}})()),Rt)){const{WebGLRenderer:i}=await Promise.all([r.e(468),r.e(132)]).then(r.bind(r,4132));e=i,n={...t,...t.webgl};break}if("canvas"===a){const{CanvasRenderer:i}=await Promise.all([r.e(468),r.e(851)]).then(r.bind(r,6851));e=i,n={...t,...t.canvasOptions};break}}var s;if(delete n.webgpu,delete n.webgl,delete n.canvasOptions,!e)throw new Error("No available renderer for the current environment");const o=new e;return await o.init(n),o}(e),t._plugins.forEach((t=>{t.init.call(this,e)}))}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return(0,Bt.t6)(Bt.lj,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,i=!1){const n=t._plugins.slice(0);n.reverse(),n.forEach((t=>{t.destroy.call(this)})),this.stage.destroy(i),this.stage=null,this.renderer.destroy(e),this.renderer=null}};Ht._plugins=[];let Vt=Ht;Tt.XO.handleByList(Tt.Ag.Application,Vt._plugins),Tt.XO.add(Nt.M);var Xt=r(6125),Yt=r(9252),$t=(r(9726),r(4663)),qt=r(583),Kt=r(218),Zt=r(2812),Qt=r(4985);class Jt extends Qt.l{constructor(t,e){const{text:i,resolution:n,style:r,anchor:s,width:o,height:a,roundPixels:l,...h}=t;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=r,this.resolution=n??null,this.allowChildren=!1,this._anchor=new Zt.o({_onUpdate:()=>{this.onViewUpdate()}}),s&&(this.anchor=s),this.roundPixels=l??!1,void 0!==o&&(this.width=o),void 0!==a&&(this.height=a)}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=null===t,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){"object"==typeof t?(e=t.height??t.width,t=t.width):e??(e=t),void 0!==t&&this._setWidth(t,this.bounds.width),void 0!==e&&this._setHeight(e,this.bounds.height)}containsPoint(t){const e=this.bounds.width,i=this.bounds.height,n=-e*this.anchor.x;let r=0;return t.x>=n&&t.x<=n+e&&(r=-i*this.anchor.y,t.y>=r&&t.y<=r+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,("boolean"==typeof t?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}}var te=r(2577),ee=r(7608),ie=r(9939);let ne=null,re=null;function se(t,e,i){for(let n=0,r=4*i*e;n<e;++n,r+=4)if(0!==t[r+3])return!1;return!0}function oe(t,e,i,n,r){const s=4*e;for(let e=n,o=n*s+4*i;e<=r;++e,o+=s)if(0!==t[o+3])return!1;return!0}function ae(...t){let e=t[0];e.canvas||(e={canvas:t[0],resolution:t[1]});const{canvas:i}=e,n=Math.min(e.resolution??1,1),r=e.width??i.width,s=e.height??i.height;let o=e.output;if(function(t,e){ne||(ne=It.e.get().createCanvas(256,128),re=ne.getContext("2d",{willReadFrequently:!0}),re.globalCompositeOperation="copy",re.globalAlpha=1),(ne.width<t||ne.height<e)&&(ne.width=(0,ie.U5)(t),ne.height=(0,ie.U5)(e))}(r,s),!re)throw new TypeError("Failed to get canvas 2D context");re.drawImage(i,0,0,r,s,0,0,r*n,s*n);const a=re.getImageData(0,0,r,s).data;let l=0,h=0,c=r-1,u=s-1;for(;h<s&&se(a,r,h);)++h;if(h===s)return Yt.M.EMPTY;for(;se(a,r,u);)--u;for(;oe(a,r,l,h,u);)++l;for(;oe(a,r,c,h,u);)--c;return++c,++u,re.globalCompositeOperation="source-over",re.strokeRect(l,h,c-l,u-h),re.globalCompositeOperation="copy",o??(o=new Yt.M),o.set(l/n,h/n,(c-l)/n,(u-h)/n),o}class le{constructor(t=0,e=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){const e=new Array(t.length);for(let i=0;i<t.length;i++){const n=t[i];e[i]=[n,this.get(n)]}return e}evict(t=!1){if(t||this.size>0){const t=this.first;delete this.items[t.key],0==--this.size?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){const e=this.items[t];if(void 0!==e)return this.ttl>0&&e.expiry<=Date.now()?void this.delete(t):(this.moveToEnd(e),e.value)}has(t){return t in this.items}moveToEnd(t){this.last!==t&&(null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),t.prev=this.last,t.next=null,null!==this.last&&(this.last.next=t),this.last=t,null===this.first&&(this.first=t))}keys(){const t=new Array(this.size);let e=this.first,i=0;for(;null!==e;)t[i++]=e.key,e=e.next;return t}setWithEvicted(t,e,i=this.resetTtl){let n=null;if(this.has(t))this.set(t,e,!0,i);else{this.max>0&&this.size===this.max&&(n={...this.first},this.evict(!0));let i=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e};1==++this.size?this.first=i:this.last.next=i,this.last=i}return n}set(t,e,i=!1,n=this.resetTtl){let r=this.items[t];return i||void 0!==r?(r.value=e,!1===i&&n&&(r.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(r)):(this.max>0&&this.size===this.max&&this.evict(!0),r=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},1==++this.size?this.first=r:this.last.next=r,this.last=r),this}values(t=this.keys()){const e=new Array(t.length);for(let i=0;i<t.length;i++)e[i]=this.get(t[i]);return e}}function he(t){return!!t.tagStyles&&Object.keys(t.tagStyles).length>0}function ce(t){return t.includes("<")}function ue(t,e){const i=[],n=e.tagStyles;if(!he(e)||!ce(t))return i.push({text:t,style:e}),i;const r=[e],s=[];let o="",a=0;for(;a<t.length;){const e=t[a];if("<"===e){const c=t.indexOf(">",a);if(-1===c){o+=e,a++;continue}const u=t.slice(a+1,c);if(u.startsWith("/")){const e=u.slice(1).trim();if(s.length>0&&s[s.length-1]===e){o.length>0&&(i.push({text:o,style:r[r.length-1]}),o=""),r.pop(),s.pop(),a=c+1;continue}o+=t.slice(a,c+1),a=c+1;continue}{const e=u.trim();if(n[e]){o.length>0&&(i.push({text:o,style:r[r.length-1]}),o="");const t=r[r.length-1],u=(l=t,h=n[e],l.clone().assign(h));r.push(u),s.push(e),a=c+1;continue}o+=t.slice(a,c+1),a=c+1;continue}}o+=e,a++}var l,h;return o.length>0&&i.push({text:o,style:r[r.length-1]}),i}const de=new Set([10,13]),pe=new Set([9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]),fe=(new Set([9,32]),new Set([45,8208,8211,8212,173])),me=/(\r\n|\r|\n)/,ye=/(?:\r\n|\r|\n)/;function ge(t){return"string"==typeof t&&de.has(t.charCodeAt(0))}function ve(t,e){return"string"==typeof t&&pe.has(t.charCodeAt(0))}function be(t){return"string"==typeof t&&fe.has(t.charCodeAt(0))}function xe(t){return"normal"===t||"pre-line"===t}function _e(t){return"normal"===t}function we(t){if("string"!=typeof t)return"";let e=t.length-1;for(;e>=0&&ve(t[e]);)e--;return e<t.length-1?t.slice(0,e+1):t}function Se(t){const e=[],i=[];if("string"!=typeof t)return e;for(let n=0;n<t.length;n++){const r=t[n],s=t[n+1];ve(r)||ge(r)?(i.length>0&&(e.push(i.join("")),i.length=0),"\r"===r&&"\n"===s?(e.push("\r\n"),n++):e.push(r)):(i.push(r),be(r)&&s&&!ve(s)&&!ge(s)&&(e.push(i.join("")),i.length=0))}return i.length>0&&e.push(i.join("")),e}function Ce(t,e,i,n){const r=i(t),s=[];for(let i=0;i<r.length;i++){let o=r[i],a=o,l=1;for(;r[i+l];){const s=r[i+l];if(n(a,s,t,i,e))break;o+=s,a=s,l++}i+=l-1,s.push(o)}return s}const Ae=/\r\n|\r|\n/g;function Ee(t,e,i,n,r,s,o,a){const l=ue(t,e);if(_e(e.whiteSpace))for(let t=0;t<l.length;t++){const e=l[t];l[t]={text:e.text.replace(Ae," "),style:e.style}}const h=[];let c=[];for(const t of l){const e=t.text.split(me);for(let i=0;i<e.length;i++){const n=e[i];"\r\n"===n||"\r"===n||"\n"===n?(h.push(c),c=[]):n.length>0&&c.push({text:n,style:t.style})}}(c.length>0||0===h.length)&&h.push(c);const u=i?function(t,e,i,n,r,s){const{letterSpacing:o,whiteSpace:a,wordWrapWidth:l,breakWords:h}=e,c=xe(a),u=l+o,d={};let p="";const f=(t,e)=>{const r=`${t}|${e.styleKey}`;let s=d[r];if(void 0===s){const o=e._fontString;o!==p&&(i.font=o,p=o),s=n(t,e.letterSpacing,i)+e.letterSpacing,d[r]=s}return s},m=[];for(const e of t){const t=Me(e),i=m.length,n=e=>{let i=0,n=e;do{const{token:e,style:r}=t[n];i+=f(e,r),n++}while(n<t.length&&t[n].continuesFromPrevious);return i},o=e=>{const i=[];let n=e;do{i.push({token:t[n].token,style:t[n].style}),n++}while(n<t.length&&t[n].continuesFromPrevious);return i};let a=[],l=0,d=!c,p=null;const y=()=>{p&&p.text.length>0&&a.push(p),p=null},g=()=>{if(y(),a.length>0){const t=a[a.length-1];t.text=we(t.text),0===t.text.length&&a.pop()}m.push(a),a=[],l=0,d=!1};for(let e=0;e<t.length;e++){const{token:i,style:v,continuesFromPrevious:b}=t[e],x=f(i,v);if(c){const t=ve(i),e=p?.text[p.text.length-1]??a[a.length-1]?.text.slice(-1)??"",n=!!e&&ve(e);if(t&&n)continue}const _=!b,w=_?n(e):x;if(w>u&&_)if(l>0&&g(),h){const t=o(e);for(let e=0;e<t.length;e++){const i=t[e].token,n=t[e].style,o=Ce(i,h,s,r);for(const t of o){const e=f(t,n);e+l>u&&g(),p&&p.style===n?p.text+=t:(y(),p={text:t,style:n}),l+=e}}e+=t.length-1}else{const t=o(e);y(),m.push(t.map((t=>({text:t.token,style:t.style})))),d=!1,e+=t.length-1}else if(w+l>u&&_){if(ve(i)){d=!1;continue}g(),p={text:i,style:v},l=x}else if(b&&!h)p&&p.style===v?p.text+=i:(y(),p={text:i,style:v}),l+=x;else{const t=ve(i);if(0===l&&t&&!d)continue;p&&p.style===v?p.text+=i:(y(),p={text:i,style:v}),l+=x}}if(y(),a.length>0){const t=a[a.length-1];t.text=we(t.text),0===t.text.length&&a.pop()}(a.length>0||m.length===i)&&m.push(a)}return m}(h,e,n,r,o,a):h,d=[],p=[],f=[],m=[],y=[];let g=0;const v=s(e._fontString);0===v.fontSize&&(v.fontSize=e.fontSize,v.ascent=e.fontSize);let b="",x=!!e.dropShadow,_=e._stroke?.width||0;for(const t of u){let i=0,o=v.ascent,a=v.descent,l="";for(const e of t){const t=e.style._fontString,h=s(t);t!==b&&(n.font=t,b=t);i+=r(e.text,e.style.letterSpacing,n),o=Math.max(o,h.ascent),a=Math.max(a,h.descent),l+=e.text;const c=e.style._stroke?.width||0;c>_&&(_=c),!x&&e.style.dropShadow&&(x=!0)}0===t.length&&(o=v.ascent,a=v.descent),d.push(i),p.push(o),f.push(a),y.push(l);const h=e.lineHeight||o+a;m.push(h+e.leading),g=Math.max(g,i)}const w=_,S=(i&&"left"!==e.align?Math.max(g,e.wordWrapWidth):g)+w+(e.dropShadow?e.dropShadow.distance:0);let C=0;for(let t=0;t<m.length;t++)C+=m[t];C=Math.max(C,m[0]+w);return{width:S,height:C+(e.dropShadow?e.dropShadow.distance:0),lines:y,lineWidths:d,lineHeight:(e.lineHeight||v.fontSize)+e.leading,maxLineWidth:g,fontProperties:v,runsByLine:u,lineAscents:p,lineDescents:f,lineHeights:m,hasDropShadow:x}}function Me(t){const e=[];let i=!1;for(const n of t){const t=Se(n.text);let r=!0;for(const s of t){const t=ve(s)||ge(s),o=r&&i&&!t;e.push({token:s,style:n.style,continuesFromPrevious:o}),i=!t,r=!1}}return e}const Te={willReadFrequently:!0};function ke(t,e,i,n,r){let s=i[t];return"number"!=typeof s&&(s=r(t,e,n)+e,i[t]=s),s}const Pe={willReadFrequently:!0},Ie=class t{static get experimentalLetterSpacingSupported(){let e=t._experimentalLetterSpacingSupported;if(void 0===e){const i=It.e.get().getCanvasRenderingContext2D().prototype;e=t._experimentalLetterSpacingSupported="letterSpacing"in i||"textLetterSpacing"in i}return e}constructor(t,e,i,n,r,s,o,a,l,h){this.text=t,this.style=e,this.width=i,this.height=n,this.lines=r,this.lineWidths=s,this.lineHeight=o,this.maxLineWidth=a,this.fontProperties=l,h&&(this.runsByLine=h.runsByLine,this.lineAscents=h.lineAscents,this.lineDescents=h.lineDescents,this.lineHeights=h.lineHeights,this.hasDropShadow=h.hasDropShadow)}static measureText(e=" ",i,n=t._canvas,r=i.wordWrap){const s=`${e}-${i.styleKey}-wordWrap-${r}`;if(t._measurementCache.has(s))return t._measurementCache.get(s);if(he(i)&&ce(e)){const n=Ee(e,i,r,t._context,t._measureText,t.measureFont,t.canBreakChars,t.wordWrapSplit),o=new t(e,i,n.width,n.height,n.lines,n.lineWidths,n.lineHeight,n.maxLineWidth,n.fontProperties,{runsByLine:n.runsByLine,lineAscents:n.lineAscents,lineDescents:n.lineDescents,lineHeights:n.lineHeights,hasDropShadow:n.hasDropShadow});return t._measurementCache.set(s,o),o}const o=i._fontString,a=t.measureFont(o);0===a.fontSize&&(a.fontSize=i.fontSize,a.ascent=i.fontSize,a.descent=0);const l=t._context;l.font=o;const h=(r?t._wordWrap(e,i,n):e).split(ye),c=new Array(h.length);let u=0;for(let e=0;e<h.length;e++){const n=t._measureText(h[e],i.letterSpacing,l);c[e]=n,u=Math.max(u,n)}const d=i._stroke?.width??0,p=i.lineHeight||a.fontSize,f=t._getAlignWidth(u,i,r),m=t._adjustWidthForStyle(f,i),y=Math.max(p,a.fontSize+d)+(h.length-1)*(p+i.leading),g=t._adjustHeightForStyle(y,i),v=new t(e,i,m,g,h,c,p+i.leading,u,a);return t._measurementCache.set(s,v),v}static _adjustWidthForStyle(t,e){let i=t+(e._stroke?.width||0);return e.dropShadow&&(i+=e.dropShadow.distance),i}static _adjustHeightForStyle(t,e){let i=t;return e.dropShadow&&(i+=e.dropShadow.distance),i}static _getAlignWidth(t,e,i){return i&&"left"!==e.align?Math.max(t,e.wordWrapWidth):t}static _measureText(e,i,n){let r=!1;t.experimentalLetterSpacingSupported&&(t.experimentalLetterSpacing?(n.letterSpacing=`${i}px`,n.textLetterSpacing=`${i}px`,r=!0):(n.letterSpacing="0px",n.textLetterSpacing="0px"));const s=n.measureText(e);let o=s.width;const a=-(s.actualBoundingBoxLeft??0);let l=(s.actualBoundingBoxRight??0)-a;if(o>0)if(r)o-=i,l-=i;else{const n=(t.graphemeSegmenter(e).length-1)*i;o+=n,l+=n}return Math.max(o,l)}static _wordWrap(e,i,n=t._canvas){return function(t,e,i,n,r,s,o){const a=i.getContext("2d",Te);a.font=e._fontString;let l=0,h="";const c=[],u=Object.create(null),{letterSpacing:d,whiteSpace:p}=e,f=xe(p),m=_e(p);let y=!f;const g=e.wordWrapWidth+d,v=Se(t);for(let t=0;t<v.length;t++){let i=v[t];if(ge(i)){if(!m){c.push(we(h)),y=!f,h="",l=0;continue}i=" "}if(f){const t=ve(i),e=ve(h[h.length-1]);if(t&&e)continue}const p=ke(i,d,u,a,n);if(p>g)if(""!==h&&(c.push(we(h)),h="",l=0),r(i,e.breakWords)){const t=Ce(i,e.breakWords,o,s);for(const e of t){const t=ke(e,d,u,a,n);t+l>g&&(c.push(we(h)),y=!1,h="",l=0),h+=e,l+=t}}else h.length>0&&(c.push(we(h)),h="",l=0),c.push(we(i)),y=!1,h="",l=0;else p+l>g&&(y=!1,c.push(we(h)),h="",l=0),(h.length>0||!ve(i)||y)&&(h+=i,l+=p)}const b=we(h);return b.length>0&&c.push(b),c.join("\n")}(e,i,n,t._measureText,t.canBreakWords,t.canBreakChars,t.wordWrapSplit)}static isBreakingSpace(t,e){return ve(t)}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,n,r){return!0}static wordWrapSplit(e){return t.graphemeSegmenter(e)}static measureFont(e){if(t._fonts[e])return t._fonts[e];const i=t._context;i.font=e;const n=i.measureText(t.METRICS_STRING+t.BASELINE_SYMBOL),r=n.actualBoundingBoxAscent??0,s=n.actualBoundingBoxDescent??0,o={ascent:r,descent:s,fontSize:r+s};return t._fonts[e]=o,o}static clearMetrics(e=""){e?delete t._fonts[e]:t._fonts={}}static get _canvas(){if(!t.__canvas){let e;try{const i=new OffscreenCanvas(0,0),n=i.getContext("2d",Pe);if(n?.measureText)return t.__canvas=i,i;e=It.e.get().createCanvas()}catch(t){e=It.e.get().createCanvas()}e.width=e.height=10,t.__canvas=e}return t.__canvas}static get _context(){return t.__context||(t.__context=t._canvas.getContext("2d",Pe)),t.__context}};Ie.METRICS_STRING="|ÉqÅ",Ie.BASELINE_SYMBOL="M",Ie.BASELINE_MULTIPLIER=1.4,Ie.HEIGHT_MULTIPLIER=2,Ie.graphemeSegmenter=(()=>{if("function"==typeof Intl?.Segmenter){const t=new Intl.Segmenter;return e=>{const i=t.segment(e),n=[];let r=0;for(const t of i)n[r++]=t.segment;return n}}return t=>[...t]})(),Ie.experimentalLetterSpacing=!1,Ie._fonts={},Ie._measurementCache=function(t=1e3,e=0,i=!1){if(isNaN(t)||t<0)throw new TypeError("Invalid max value");if(isNaN(e)||e<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof i)throw new TypeError("Invalid resetTtl value");return new le(t,e,i)}(1e3);let Oe=Ie;const Re=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function Le(t){const e="number"==typeof t.fontSize?`${t.fontSize}px`:t.fontSize;let i=t.fontFamily;Array.isArray(t.fontFamily)||(i=t.fontFamily.split(","));for(let t=i.length-1;t>=0;t--){let e=i[t].trim();/([\"\'])[^\'\"]+\1/.test(e)||Re.includes(e)||(e=`"${e}"`),i[t]=e}return`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${e} ${i.join(",")}`}var je=r(9313),De=r(5589),Fe=r(268),Ne=r(7276),Be=r(2806);const Ge=1e5;function ze(t,e,i,n=0,r=0,s=0){if(t.texture===De.g.WHITE&&!t.fill)return te.Q.shared.setValue(t.color).setAlpha(t.alpha??1).toHexa();if(!t.fill){const i=e.createPattern(t.texture.source.resource,"repeat"),n=t.matrix.copyTo(je.u.shared);return n.scale(t.texture.source.pixelWidth,t.texture.source.pixelHeight),i.setTransform(n),i}if(t.fill instanceof Be.m){const i=t.fill,n=e.createPattern(i.texture.source.resource,"repeat"),r=i.transform.copyTo(je.u.shared);return r.scale(i.texture.source.pixelWidth,i.texture.source.pixelHeight),n.setTransform(r),n}if(t.fill instanceof Ne._){const o=t.fill,a="linear"===o.type,l="local"===o.textureSpace;let h,c=1,u=1;l&&i&&(c=i.width+n,u=i.height+n);let d=!1;if(a){const{start:t,end:i}=o;h=e.createLinearGradient(t.x*c+r,t.y*u+s,i.x*c+r,i.y*u+s),d=Math.abs(i.x-t.x)<Math.abs(.1*(i.y-t.y))}else{const{center:t,innerRadius:i,outerCenter:n,outerRadius:a}=o;h=e.createRadialGradient(t.x*c+r,t.y*u+s,i*c,n.x*c+r,n.y*u+s,a*c)}if(d&&l&&i){const t=i.lineHeight/u;for(let e=0;e<i.lines.length;e++){const r=(e*i.lineHeight+n/2)/u;o.colorStops.forEach((e=>{let i=r+e.offset*t;i=Math.max(0,Math.min(1,i)),h.addColorStop(Math.floor(i*Ge)/Ge,te.Q.shared.setValue(e.color).toHex())}))}}else o.colorStops.forEach((t=>{h.addColorStop(t.offset,te.Q.shared.setValue(t.color).toHex())}));return h}return(0,Fe.R)("FillStyle not recognised",t),"red"}const We=new Yt.M;function Ue(t){let e=0;for(let i=0;i<t.length;i++)32===t.charCodeAt(i)&&e++;return e}const He=new class{getCanvasAndContext(t){const{text:e,style:i,resolution:n=1}=t,r=i._getFinalPadding(),s=Oe.measureText(e||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+2*r)*n),a=Math.ceil(Math.ceil(Math.max(1,s.height)+2*r)*n),l=ee.N.getOptimalCanvasAndContext(o,a);this._renderTextToCanvas(i,r,n,l,s);return{canvasAndContext:l,frame:i.trim?ae({canvas:l.canvas,width:o,height:a,resolution:1,output:We}):We.set(0,0,o,a)}}returnCanvasAndContext(t){ee.N.returnCanvasAndContext(t)}_renderTextToCanvas(t,e,i,n,r){if(r.runsByLine&&r.runsByLine.length>0)return void this._renderTaggedTextToCanvas(r,t,e,i,n);const{canvas:s,context:o}=n,a=Le(t),l=r.lines,h=r.lineHeight,c=r.lineWidths,u=r.maxLineWidth,d=r.fontProperties,p=s.height;if(o.resetTransform(),o.scale(i,i),o.textBaseline=t.textBaseline,t._stroke?.width){const e=t._stroke;o.lineWidth=e.width,o.miterLimit=e.miterLimit,o.lineJoin=e.join,o.lineCap=e.cap}let f,m;o.font=a;const y=t.dropShadow?2:1,g=t.wordWrap?Math.max(t.wordWrapWidth,u):u,v=(t._stroke?.width??0)/2;let b=(h-d.fontSize)/2;h-d.fontSize<0&&(b=0);for(let s=0;s<y;++s){const a=t.dropShadow&&0===s,u=a?Math.ceil(Math.max(1,p)+2*e):0,y=u*i;if(a)this._setupDropShadow(o,t,i,y);else{const i=t._gradientBounds,n=t._gradientOffset;if(i){const s={width:i.width,height:i.height,lineHeight:i.height,lines:r.lines};this._setFillAndStrokeStyles(o,t,s,e,v,n?.x??0,n?.y??0)}else n?this._setFillAndStrokeStyles(o,t,r,e,v,n.x,n.y):this._setFillAndStrokeStyles(o,t,r,e,v);o.shadowColor="rgba(0,0,0,0)"}for(let i=0;i<l.length;i++){f=v,m=v+i*h+d.ascent+b,f+=this._getAlignmentOffset(c[i],g,t.align);let r=0;if("justify"===t.align&&t.wordWrap&&i<l.length-1){const t=Ue(l[i]);t>0&&(r=(g-c[i])/t)}t._stroke?.width&&this._drawLetterSpacing(l[i],t,n,f+e,m+e-u,!0,r),void 0!==t._fill&&this._drawLetterSpacing(l[i],t,n,f+e,m+e-u,!1,r)}}}_renderTaggedTextToCanvas(t,e,i,n,r){const{canvas:s,context:o}=r,{runsByLine:a,lineWidths:l,maxLineWidth:h,lineAscents:c,lineHeights:u,hasDropShadow:d}=t,p=s.height;o.resetTransform(),o.scale(n,n),o.textBaseline=e.textBaseline;const f=d?2:1,m=e.wordWrap?Math.max(e.wordWrapWidth,h):h;let y=e._stroke?.width??0;for(const t of a)for(const e of t){const t=e.style._stroke?.width??0;t>y&&(y=t)}const g=y/2,v=[];for(let t=0;t<a.length;t++){const e=a[t],i=[];for(const t of e){const e=Le(t.style);o.font=e,i.push({width:Oe._measureText(t.text,t.style.letterSpacing,o),font:e})}v.push(i)}for(let t=0;t<f;++t){const s=d&&0===t,h=s?Math.ceil(Math.max(1,p)+2*i):0,f=h*n;s||(o.shadowColor="rgba(0,0,0,0)");let y=g;for(let t=0;t<a.length;t++){const d=a[t],p=l[t],b=c[t],x=u[t],_=v[t];let w=g;w+=this._getAlignmentOffset(p,m,e.align);let S=0;if("justify"===e.align&&e.wordWrap&&t<a.length-1){let t=0;for(const e of d)t+=Ue(e.text);t>0&&(S=(m-p)/t)}const C=y+b;let A=w+i;for(let t=0;t<d.length;t++){const e=d[t],{width:a,font:l}=_[t];if(o.font=l,o.textBaseline=e.style.textBaseline,e.style._stroke?.width){const t=e.style._stroke;if(o.lineWidth=t.width,o.miterLimit=t.miterLimit,o.lineJoin=t.join,o.lineCap=t.cap,s){if(!e.style.dropShadow){A+=a+Ue(e.text)*S;continue}this._setupDropShadow(o,e.style,n,f)}else{const n=Oe.measureFont(l),r=e.style.lineHeight||n.fontSize,s={width:a,height:r,lineHeight:r,lines:[e.text]};o.strokeStyle=ze(t,o,s,2*i,A-i,y)}this._drawLetterSpacing(e.text,e.style,r,A,C+i-h,!0,S)}A+=a+Ue(e.text)*S}A=w+i;for(let t=0;t<d.length;t++){const e=d[t],{width:a,font:l}=_[t];if(o.font=l,o.textBaseline=e.style.textBaseline,void 0!==e.style._fill){if(s){if(!e.style.dropShadow){A+=a+Ue(e.text)*S;continue}this._setupDropShadow(o,e.style,n,f)}else{const t=Oe.measureFont(l),n=e.style.lineHeight||t.fontSize,r={width:a,height:n,lineHeight:n,lines:[e.text]};o.fillStyle=ze(e.style._fill,o,r,2*i,A-i,y)}this._drawLetterSpacing(e.text,e.style,r,A,C+i-h,!1,S)}A+=a+Ue(e.text)*S}y+=x}}}_setFillAndStrokeStyles(t,e,i,n,r,s=0,o=0){if(t.fillStyle=e._fill?ze(e._fill,t,i,2*n,s,o):null,e._stroke?.width){const a=r+2*n;t.strokeStyle=ze(e._stroke,t,i,a,s,o)}}_setupDropShadow(t,e,i,n){t.fillStyle="black",t.strokeStyle="black";const r=e.dropShadow,s=r.color,o=r.alpha;t.shadowColor=te.Q.shared.setValue(s).setAlpha(o).toRgbaString();const a=r.blur*i,l=r.distance*i;t.shadowBlur=a,t.shadowOffsetX=Math.cos(r.angle)*l,t.shadowOffsetY=Math.sin(r.angle)*l+n}_getAlignmentOffset(t,e,i){return"right"===i?e-t:"center"===i?(e-t)/2:0}_drawLetterSpacing(t,e,i,n,r,s=!1,o=0){const{context:a}=i,l=e.letterSpacing;let h=!1;if(Oe.experimentalLetterSpacingSupported&&(Oe.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,h=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),(0===l||h)&&0===o)return void(s?a.strokeText(t,n,r):a.fillText(t,n,r));if(0!==o&&(0===l||h)){const e=t.split(" ");let i=n;const l=a.measureText(" ").width;for(let t=0;t<e.length;t++)s?a.strokeText(e[t],i,r):a.fillText(e[t],i,r),i+=a.measureText(e[t]).width+l+o;return}let c=n;const u=Oe.graphemeSegmenter(t);let d=a.measureText(t).width,p=0;for(let t=0;t<u.length;++t){const e=u[t];s?a.strokeText(e,c,r):a.fillText(e,c,r);let i="";for(let e=t+1;e<u.length;++e)i+=u[e];p=a.measureText(i).width,c+=d-p+l," "===e&&(c+=o),d=p}}};var Ve=r(8875),Xe=r(133),Ye=r(8393),$e=r(990);const qe=class t extends Ve.A{constructor(e={}){super(),this.uid=(0,Xe.L)("textStyle"),this._tick=0,this._cachedFontString=null,function(t){const e=t;if("boolean"==typeof e.dropShadow&&e.dropShadow){const i=Ke.defaultDropShadow;t.dropShadow={alpha:e.dropShadowAlpha??i.alpha,angle:e.dropShadowAngle??i.angle,blur:e.dropShadowBlur??i.blur,color:e.dropShadowColor??i.color,distance:e.dropShadowDistance??i.distance}}if(void 0!==e.strokeThickness){(0,Bt.t6)(Bt.lj,"strokeThickness is now a part of stroke");const i=e.stroke;let n={};if(te.Q.isColorLike(i))n.color=i;else if(i instanceof Ne._||i instanceof Be.m)n.fill=i;else{if(!Object.hasOwnProperty.call(i,"color")&&!Object.hasOwnProperty.call(i,"fill"))throw new Error("Invalid stroke value.");n=i}t.stroke={...n,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){if((0,Bt.t6)(Bt.lj,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(e.fill)||0===e.fill.length)throw new Error("Invalid fill value. Expected an array of colors for gradient fill.");e.fill.length!==e.fillGradientStops.length&&(0,Fe.R)("The number of fill colors must match the number of fill gradient stops.");const i=new Ne._({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),n=e.fillGradientStops.slice(),r=e.fill.map((t=>te.Q.shared.setValue(t).toNumber()));n.forEach(((t,e)=>{i.addColorStop(t,r[e])})),t.fill={fill:i}}}(e);e instanceof t&&(e=e._toObject());const i={...t.defaultTextStyle,...e};for(const t in i){this[t]=i[t]}this._tagStyles=e.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.update())}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(e){this._dropShadow!==e&&(this._dropShadow=null!==e&&"object"==typeof e?this._createProxy({...t.defaultDropShadow,...e}):e?this._createProxy({...t.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.update())}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize="string"==typeof t?parseInt(t,10):t,this.update())}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.update())}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.update())}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.update())}get filters(){return this._filters}set filters(t){this._filters!==t&&(this._filters=Object.freeze(t),this.update())}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.update())}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Ye.T.defaultFillStyle,...t},(()=>{this._fill=(0,$e.w)({...this._originalFill},Ye.T.defaultFillStyle)}))),this._fill=(0,$e.w)(0===t?"black":t,Ye.T.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Ye.T.defaultStrokeStyle,...t},(()=>{this._stroke=(0,$e.T)({...this._originalStroke},Ye.T.defaultStrokeStyle)}))),this._stroke=(0,$e.T)(t,Ye.T.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(t){this._tagStyles!==t&&(this._tagStyles=t??void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){const e=t.defaultTextStyle;for(const t in e)this[t]=e[t]}assign(t){for(const e in t){this[e]=t[e]}return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return null===this._cachedFontString&&(this._cachedFontString=Le(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new t(this._toObject())}_getFinalPadding(){let t=0;if(this._filters)for(let e=0;e<this._filters.length;e++)t+=this._filters[e].padding;return Math.max(this._padding,t)}destroy(t=!1){this.removeAllListeners();if("boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(e),this._originalFill?.texture&&this._originalFill.texture.destroy(e),this._stroke?.texture&&this._stroke.texture.destroy(e),this._originalStroke?.texture&&this._originalStroke.texture.destroy(e)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(t,i,n)=>(t[i]===n||(t[i]=n,e?.(i,n),this.update()),!0)})}_isFillStyle(t){return null!==(t??null)&&!(te.Q.isColorLike(t)||t instanceof Ne._||t instanceof Be.m)}};qe.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},qe.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Ke=qe;var Ze=r(4334),Qe=r(2048);var Je=r(8422);class ti extends Je.K{}class ei{constructor(t){this._renderer=t,t.runners.resolutionChange.add(this),this._managedTexts=new Ze.s({renderer:t,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(const t in this._managedTexts.items){const e=this._managedTexts.items[t];e?._autoResolution&&e.onViewUpdate()}}validateRenderable(t){const e=this._getGpuText(t),i=t.styleKey;return e.currentKey!==i||t._didTextUpdate}addRenderable(t,e){const i=this._getGpuText(t);if(t._didTextUpdate){const e=t._autoResolution?this._renderer.resolution:t.resolution;i.currentKey===t.styleKey&&t._resolution===e||this._updateGpuText(t),t._didTextUpdate=!1,function(t,e){const{texture:i,bounds:n}=t,r=e._style._getFinalPadding();(0,Qe.y)(n,e._anchor,i);const s=e._anchor._x*r*2,o=e._anchor._y*r*2;n.minX-=r-s,n.minY-=r-o,n.maxX-=r-s,n.maxY-=r-o}(i,t)}this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._getGpuText(t);e._batcher.updateElement(e)}_updateGpuText(t){const e=this._getGpuText(t);e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t.styleKey}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){const e=new ti;return e.currentKey="--",e.renderable=t,e.transform=t.groupTransform,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,this._managedTexts.add(t),e}onTextUnload(t){const e=t._gpuData[this._renderer.uid];if(!e)return;const{canvasText:i}=this._renderer;i.getReferenceCount(e.currentKey)>0?i.decreaseReferenceCount(e.currentKey):e.texture&&i.returnTexture(e.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}ei.extension={type:[Tt.Ag.WebGLPipes,Tt.Ag.WebGPUPipes,Tt.Ag.CanvasPipes],name:"text"};var ii=r(2437);const ni=new(r(9636).c);class ri{constructor(t,e){this._activeTextures={},this._renderer=t,this._retainCanvasContext=e}getTexture(t,e,i,n){"string"==typeof t&&((0,Bt.t6)("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof Ke||(t.style=new Ke(t.style)),t.textureStyle instanceof Kt.n||(t.textureStyle=new Kt.n(t.textureStyle)),"string"!=typeof t.text&&(t.text=t.text.toString());const{text:r,style:s,textureStyle:o,autoGenerateMipmaps:a}=t,l=t.resolution??this._renderer.resolution,{frame:h,canvasAndContext:c}=He.getCanvasAndContext({text:r,style:s,resolution:l}),u=function(t,e,i,n,r=!1){const s=ni;s.minX=0,s.minY=0,s.maxX=t.width/n|0,s.maxY=t.height/n|0;const o=ii.W.getOptimalTexture(s.width,s.height,n,!1,r);return o.source.uploadMethodId="image",o.source.resource=t,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=e/n,o.frame.height=i/n,o.source.emit("update",o.source),o.updateUvs(),o}(c.canvas,h.width,h.height,l,a);if(o&&(u.source.style=o),s.trim&&(h.pad(s.padding),u.frame.copyFrom(h),u.frame.scale(1/l),u.updateUvs()),s.filters){const t=this._applyFilters(u,s.filters);return this.returnTexture(u),He.returnCanvasAndContext(c),t}return this._renderer.texture.initSource(u._source),this._retainCanvasContext||He.returnCanvasAndContext(c),u}returnTexture(t){const e=t.source,i=e.resource;if(this._retainCanvasContext&&i?.getContext){const t=i.getContext("2d");t&&He.returnCanvasAndContext({canvas:i,context:t})}e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",ii.W.returnTexture(t,!0)}renderTextToCanvas(){(0,Bt.t6)("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;const e=t.styleKey;if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;const i=this.getTexture({text:t.text,style:t.style,resolution:t._resolution,textureStyle:t.textureStyle,autoGenerateMipmaps:t.autoGenerateMipmaps});return this._activeTextures[e]={texture:i,usageCount:1},i}decreaseReferenceCount(t){const e=this._activeTextures[t];e&&(e.usageCount--,0===e.usageCount&&(this.returnTexture(e.texture),this._activeTextures[t]=null))}getReferenceCount(t){return this._activeTextures[t]?.usageCount??0}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}_applyFilters(t,e){const i=this._renderer.renderTarget.renderTarget,n=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(i,!1),n}destroy(){this._renderer=null;for(const t in this._activeTextures)this._activeTextures[t]&&this.returnTexture(this._activeTextures[t].texture);this._activeTextures=null}}class si extends ri{constructor(t){super(t,!0)}}si.extension={type:[Tt.Ag.CanvasSystem],name:"canvasText"};class oi extends ri{constructor(t){super(t,!1)}}oi.extension={type:[Tt.Ag.WebGLSystem,Tt.Ag.WebGPUSystem],name:"canvasText"},Tt.XO.add(si),Tt.XO.add(oi),Tt.XO.add(ei);class ai extends Jt{constructor(...t){const e=function(t,e){let i=t[0]??{};return("string"==typeof i||t[1])&&((0,Bt.t6)(Bt.lj,`use new ${e}({ text: "hi!", style }) instead`),i={text:i,style:t[1]}),i}(t,"Text");super(e,Ke),this.renderPipeId="text",e.textureStyle&&(this.textureStyle=e.textureStyle instanceof Kt.n?e.textureStyle:new Kt.n(e.textureStyle)),this.autoGenerateMipmaps=e.autoGenerateMipmaps??qt.v.defaultOptions.autoGenerateMipmaps}updateBounds(){const t=this._bounds,e=this._anchor;let i=0,n=0;if(this._style.trim){const{frame:t,canvasAndContext:e}=He.getCanvasAndContext({text:this.text,style:this._style,resolution:1});He.returnCanvasAndContext(e),i=t.width,n=t.height}else{const t=Oe.measureText(this._text,this._style);i=t.width,n=t.height}t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*n,t.maxY=t.minY+n}}function li(t){return li="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},li(t)}function hi(t){return function(t){if(Array.isArray(t))return di(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ui(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ci(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||ui(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ui(t,e){if(t){if("string"==typeof t)return di(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?di(t,e):void 0}}function di(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function pi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fi(n.key),n)}}function fi(t){var e=function(t,e){if("object"!=li(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=li(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==li(e)?e:e+""}Tt.XO.add(kt,Pt);var mi=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.map=new Map},e=[{key:"get",value:function(t){return this.map.get(t)}},{key:"set",value:function(t,e){this.map.set(t,e)}},{key:"has",value:function(t){return this.map.has(t)}},{key:"delete",value:function(t){var e,i=this.map.get(t);null!=i&&i.parent&&i.parent.removeChild(i),null==i||null===(e=i.destroy)||void 0===e||e.call(i),this.map.delete(t)}},{key:"clearDead",value:function(t){var e,i=function(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=ui(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}(this.map);try{for(i.s();!(e=i.n()).done;){var n=ci(e.value,1)[0],r=n.split("_")[0];t.has(r)||this.delete(n)}}catch(t){i.e(t)}finally{i.f()}}},{key:"forEach",value:function(t){this.map.forEach(t)}},{key:"deleteNode",value:function(t){for(var e=0,i=hi(this.map.keys());e<i.length;e++){var n=i[e];(n===t||n.startsWith(t+"_"))&&this.delete(n)}}}],e&&pi(t.prototype,e),i&&pi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function yi(t){return yi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yi(t)}function gi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,vi(n.key),n)}}function vi(t){var e=function(t,e){if("object"!=yi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=yi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==yi(e)?e:e+""}var bi=function(){return t=function t(e,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.registry=i,this.selection=n,this.interaction=s,this.labelRenderer=o,this.colorResolver="function"==typeof r?r:function(){return 16777215},this.formulaHitPadding=12},(e=[{key:"render",value:function(t){var e;this.ensure(t),this.ensureHalo(t),this.update(t),this.updateHalo(t),null===(e=this.labelRenderer)||void 0===e||e.render(t)}},{key:"ensure",value:function(t){var e=this.registry.get(t.id);return e||((e=new $t.A).eventMode="static",e.cursor="pointer",e.nodeRef=t,this.drawShape(e,t),this.world.addChild(e),this.interaction.bindNode(e,t),this.registry.set(t.id,e),e)}},{key:"ensureHalo",value:function(t){var e="".concat(t.id,"_halo"),i=this.registry.get(e);return i||((i=new $t.A).eventMode="none",i.visible=!1,i.nodeRef=t,this.world.addChildAt(i,0),this.registry.set(e,i),i)}},{key:"update",value:function(t){var e=this.registry.get(t.id);if(e){this.drawShape(e,t),e.x=t.x,e.y=t.y;var i=this.colorResolver(t);e.tint=null!=i?i:16777215,e.visible=!1!==t.visible}}},{key:"updateHalo",value:function(t){var e=this.registry.get("".concat(t.id,"_halo"));if(e){e.clear();var i=this.selection.has(t);if(e.visible=i,i){if("formula"===t.type){var n=this.getFormulaWidth(t),r=this.getFormulaHeight();e.roundRect(-n/2-6,-r/2-6,n+12,r+12,8).stroke({width:2,color:16777215,alpha:.9})}else{var s=this.getRadius(t)+6;e.circle(0,0,s).stroke({width:3,color:16777215,alpha:.9})}e.x=t.x,e.y=t.y}}}},{key:"drawShape",value:function(t,e){t.clear();var i="planet"===e.type?16763904:"formula"===e.type?1973790:16777215;if("formula"===e.type){var n=this.getFormulaWidth(e),r=this.getFormulaHeight(),s=this.formulaHitPadding;return t.roundRect(-n/2,-r/2,n,r,6).fill(i).stroke({color:16777215,width:1,alpha:.3}),void(t.hitArea=new Yt.M(-n/2-s,-r/2-s,n+2*s,r+2*s))}var o=this.getRadius(e);t.circle(0,0,o).fill(i),t.hitArea=new Xt.j(0,0,o+4)}},{key:"getFormulaWidth",value:function(t){var e=t.label||"";return Math.max(120,8*e.length+24)}},{key:"getFormulaHeight",value:function(){return 40}},{key:"getRadius",value:function(t){switch(t.type){case"planet":return 40;case"formula":return 20;default:return 6}}},{key:"updateSelection",value:function(t){this.selection=t}}])&&gi(t.prototype,e),i&&gi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function xi(t){return xi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xi(t)}function _i(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return wi(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?wi(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function wi(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Si(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ci(n.key),n)}}function Ci(t){var e=function(t,e){if("object"!=xi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=xi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==xi(e)?e:e+""}var Ai=function(){return t=function t(e,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.registry=i},(e=[{key:"render",value:function(t){var e;if("planet"===t.type){var i=t.id+"_orbits",n=this.registry.get(i);n||((n=new $t.A).eventMode="none",this.world.addChildAt(n,0),this.registry.set(i,n)),n.clear();var r,s=_i(null!==(e=t._orbits)&&void 0!==e?e:[]);try{for(s.s();!(r=s.n()).done;){var o=r.value;n.circle(0,0,o.radius).stroke({width:1,color:16777215,alpha:.2})}}catch(t){s.e(t)}finally{s.f()}n.x=t.x,n.y=t.y}}}])&&Si(t.prototype,e),i&&Si(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Ei(t){return Ei="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ei(t)}function Mi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ti(n.key),n)}}function Ti(t){var e=function(t,e){if("object"!=Ei(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Ei(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ei(e)?e:e+""}var ki=function(){return t=function t(e,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.uiLayer=e,this.registry=i},(e=[{key:"render",value:function(t){var e,i,n,r,s="".concat(t.id,"_axis"),o=this.registry.get(s);o||((o=new $t.A).nodeRef=t,o.eventMode="static",o.cursor="pointer",this.uiLayer.addChild(o),this.registry.set(s,o)),o.clear();var a=0===(null===(e=t.direction)||void 0===e?void 0:e.x)&&1===(null===(i=t.direction)||void 0===i?void 0:i.y),l=1===(null===(n=t.direction)||void 0===n?void 0:n.x)&&0===(null===(r=t.direction)||void 0===r?void 0:r.y);a?this.renderYAxis(o):l?this.renderXAxis(o):this.renderArrowVector(o,t)}},{key:"renderXAxis",value:function(t){var e,i,n=(null===(e=this.uiLayer.parent.renderer)||void 0===e?void 0:e.width)||800,r=(null===(i=this.uiLayer.parent.renderer)||void 0===i?void 0:i.height)||600,s=n-40;t.rect(0,0,s,2).fill(16777215),t.moveTo(s-10,-6).lineTo(s,1).lineTo(s-10,8).fill(16777215),t.x=20,t.y=r-20}},{key:"renderYAxis",value:function(t){var e,i=(null===(e=this.uiLayer.parent.renderer)||void 0===e?void 0:e.height)||600,n=i-40;t.rect(0,-n,2,n).fill(16777215),t.moveTo(-6,10-n).lineTo(1,-n).lineTo(8,10-n).fill(16777215),t.x=20,t.y=i-20}},{key:"renderArrowVector",value:function(t,e){var i=e.direction.x*e.length,n=e.direction.y*e.length,r=Math.sqrt(i*i+n*n),s=Math.atan2(n,i);t.rect(0,-1,r,2).fill(16755200),t.moveTo(r,0).lineTo(r-10,-5).lineTo(r-10,5).fill(16755200),t.x=e.x,t.y=e.y,t.rotation=s}}])&&Mi(t.prototype,e),i&&Mi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Pi(t){return Pi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pi(t)}function Ii(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Oi(n.key),n)}}function Oi(t){var e=function(t,e){if("object"!=Pi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Pi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Pi(e)?e:e+""}var Ri=function(){return t=function t(e,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.registry=i},(e=[{key:"render",value:function(t){if("planet"===t.type||"formula"===t.type){var e="".concat(t.id,"_label"),i=this.registry.get(e);if(i||((i=new ai({text:"",style:{fill:16777215,fontSize:"formula"===t.type?14:12,align:"center"}})).anchor.set(.5),this.world.addChild(i),this.registry.set(e,i)),"formula"===t.type){var n=t.label||t.id,r=Number(t.value||0).toLocaleString();i.text="".concat(n,": ").concat(r)}else i.text=t.label||t.id;i.x=t.x,i.y=t.y}}}])&&Ii(t.prototype,e),i&&Ii(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Li(t){return Li="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Li(t)}function ji(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return Di(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Di(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function Di(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Fi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ni(n.key),n)}}function Ni(t){var e=function(t,e){if("object"!=Li(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Li(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Li(e)?e:e+""}var Bi=function(){return t=function t(e){var i=e.world,n=e.uiLayer,r=e.registry,s=e.selection,o=e.interaction,a=e.colorResolver;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var l=new Ri(i,r);this.nodeRenderer=new bi(i,r,s,a,o,l),this.orbitRenderer=new Ai(i,r),this.vectorRenderer=new ki(n,r),this.liveNodeIds=new Set,this.registry=r},(e=[{key:"render",value:function(t){var e,i=ji(t.getNodes());try{for(i.s();!(e=i.n()).done;){var n=e.value;"vector"!==n.type?(this.nodeRenderer.render(n),"planet"===n.type&&(n.dirty=!0,this.orbitRenderer.render(n))):(n.dirty=!0,this.vectorRenderer.render(n))}}catch(t){i.e(t)}finally{i.f()}}},{key:"updateSelection",value:function(t){this.nodeRenderer.updateSelection(t)}},{key:"remove",value:function(t){var e="string"==typeof t?t:t.id;this.registry.deleteNode(e)}}])&&Fi(t.prototype,e),i&&Fi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Gi(t){return Gi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gi(t)}function zi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Wi(n.key),n)}}function Wi(t){var e=function(t,e){if("object"!=Gi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Gi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Gi(e)?e:e+""}var Ui=function(){return t=function t(e){var i,n,r,s=this,o=e.app,a=e.world,l=e.registry,h=e.selection,c=e.minScale,u=void 0===c?.1:c,d=e.maxScale,p=void 0===d?10:d;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),i=this,r=function(){var t,e,i,n,r=null===(t=s.dragTarget)||void 0===t?void 0:t.nodeRef;s.isRightClick||(s.dragging||!r||s.isBoxSelecting||((null===(e=s.lastPointer)||void 0===e||null===(e=e.originalEvent)||void 0===e?void 0:e.shiftKey)?s.selection.has(r)?s.selection.delete(r):s.selection.add(r):(s.selection.clear(),s.selection.add(r)),null===(i=s.onSelectionChange)||void 0===i||i.call(s,s.selection)),!s.pointerDownOnStage||s.didDrag||s.dragTarget||(s.selection.clear(),null===(n=s.onSelectionChange)||void 0===n||n.call(s,s.selection)),s.finishBoxSelect()),s.resetPointerState()},(n=Wi(n="onPointerUp"))in i?Object.defineProperty(i,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[n]=r,this.app=o,this.world=a,this.registry=l,this.selection=h,this.dragTarget=null,this.startPos=null,this.dragging=!1,this.isRightClick=!1,this.isBoxSelecting=!1,this.boxStart=null,this.box=null,this.lastPointer=null,this.minScale=u,this.maxScale=p,this.isPanning=!1,this.panLast=null,this.pointers=new Map,this.lastDist=null,this.pointerDownOnStage=!1,this.didDrag=!1},e=[{key:"enable",value:function(){this.initBoxGraphics(),this.enablePointerSystem(),this.enableWheelZoom(),this.enablePinchZoom(),this.enableResize(),this.bindNodes()}},{key:"screenToWorld",value:function(t,e){return{x:(t-this.world.x)/this.world.scale.x,y:(e-this.world.y)/this.world.scale.y}}},{key:"initBoxGraphics",value:function(){this.box=new $t.A,this.app.stage.addChild(this.box)}},{key:"enablePointerSystem",value:function(){var t=this,e=this.app.stage;e.eventMode="static",e.hitArea=this.app.screen,e.on("pointerdown",(function(i){var n,r,s=i.target===e;if(t.lastPointer={x:i.global.x,y:i.global.y},s){if(t.pointerDownOnStage=!0,t.didDrag=!1,null===(n=i.originalEvent)||void 0===n?void 0:n.shiftKey)return t.isBoxSelecting=!0,t.boxStart={x:i.global.x,y:i.global.y},t.isPanning=!1,t.panLast=null,void t.box.clear();t.isPanning=!0,t.panLast={x:i.global.x,y:i.global.y},t.isBoxSelecting=!1,null===(r=t.onBackgroundPointerDown)||void 0===r||r.call(t)}})),e.on("pointermove",(function(e){if(t.lastPointer={x:e.global.x,y:e.global.y},t.isBoxSelecting){var i=Math.min(t.boxStart.x,e.global.x),n=Math.min(t.boxStart.y,e.global.y),r=Math.abs(e.global.x-t.boxStart.x),s=Math.abs(e.global.y-t.boxStart.y);return t.box.clear(),t.box.rect(i,n,r,s),t.box.fill({color:43775,alpha:.15}),void t.box.stroke({color:43775,width:1})}if(t.isPanning&&t.panLast&&!t.dragTarget){var o=e.global.x-t.panLast.x,a=e.global.y-t.panLast.y;return t.world.x+=o,t.world.y+=a,t.panLast={x:e.global.x,y:e.global.y},void(t.didDrag=!0)}if(t.dragTarget&&t.startPos){var l=e.global.x-t.startPos.x,h=e.global.y-t.startPos.y;if(Math.sqrt(l*l+h*h)>5&&(t.dragging=!0),t.dragging){var c=t.dragTarget.nodeRef;if(!c)return;var u=t.screenToWorld(e.global.x,e.global.y);c.x=u.x,c.y=u.y,t.didDrag=!0}}})),e.on("rightdown",(function(i){var n;i.target===e&&(t.isRightClick=!0,null===(n=t.onStageRightClick)||void 0===n||n.call(t,{x:i.global.x,y:i.global.y,world:t.screenToWorld(i.global.x,i.global.y),originalEvent:i.originalEvent}))})),e.on("pointerup",this.onPointerUp),e.on("pointerupoutside",this.onPointerUp)}},{key:"resetPointerState",value:function(){this.dragTarget=null,this.startPos=null,this.dragging=!1,this.isPanning=!1,this.panLast=null,this.pointerDownOnStage=!1,this.didDrag=!1,this.isRightClick=!1}},{key:"finishBoxSelect",value:function(){var t,e=this;if(this.isBoxSelecting){var i=this.lastPointer||this.boxStart,n=Math.min(this.boxStart.x,i.x),r=Math.max(this.boxStart.x,i.x),s=Math.min(this.boxStart.y,i.y),o=Math.max(this.boxStart.y,i.y),a=this.screenToWorld(n,s),l=this.screenToWorld(r,o),h=Math.min(a.x,l.x),c=Math.max(a.x,l.x),u=Math.min(a.y,l.y),d=Math.max(a.y,l.y);this.selection.clear(),this.registry.forEach((function(t){var i=t.nodeRef;i&&i.x>=h&&i.x<=c&&i.y>=u&&i.y<=d&&e.selection.add(i)})),this.box.clear(),this.isBoxSelecting=!1,null===(t=this.onSelectionChange)||void 0===t||t.call(this,this.selection)}}},{key:"enableWheelZoom",value:function(){var t=this,e=this.app.canvas;e.addEventListener("wheel",(function(i){i.preventDefault();var n=e.getBoundingClientRect(),r=i.clientX-n.left,s=i.clientY-n.top,o=i.deltaY>0?.9:1.1;t.zoomAt(r,s,o)}),{passive:!1})}},{key:"zoomAt",value:function(t,e,i){var n=this.screenToWorld(t,e);this.world.scale.x*=i,this.world.scale.y*=i,this.world.scale.x=Math.max(this.minScale,Math.min(this.maxScale,this.world.scale.x)),this.world.scale.y=Math.max(this.minScale,Math.min(this.maxScale,this.world.scale.y)),this.world.x=t-n.x*this.world.scale.x,this.world.y=e-n.y*this.world.scale.y}},{key:"enablePinchZoom",value:function(){var t=this;this.app.canvas.addEventListener("pointermove",(function(e){if(t.pointers.has(e.pointerId)&&(t.pointers.set(e.pointerId,e),2===t.pointers.size)){var i=Array.from(t.pointers.values()),n=i[0].clientX-i[1].clientX,r=i[0].clientY-i[1].clientY,s=Math.sqrt(n*n+r*r),o=(i[0].clientX+i[1].clientX)/2,a=(i[0].clientY+i[1].clientY)/2;t.lastDist?(t.zoomAt(o,a,s/t.lastDist),t.lastDist=s):t.lastDist=s}}))}},{key:"enableResize",value:function(){var t=this,e=this.app.canvas.parentElement;this.resizeObserver=new ResizeObserver((function(){var i=e.clientWidth,n=e.clientHeight;t.app.renderer.resize(i,n)})),this.resizeObserver.observe(e)}},{key:"bindNode",value:function(t){var e=this;t.eventMode="static",t.cursor="pointer",t.on("pointerdown",(function(i){i.stopPropagation(),e.dragTarget=t,e.startPos={x:i.global.x,y:i.global.y},e.dragging=!1,e.isBoxSelecting=!1,e.isPanning=!1,e.panLast=null,e.didDrag=!1,t.nodeRef.dirty=!0})),t.on("rightdown",(function(i){var n;i.stopPropagation(),e.isRightClick=!0;var r=t.nodeRef;null===(n=e.onNodeRightClick)||void 0===n||n.call(e,{node:r,global:i.global,ev:i.originalEvent})}))}},{key:"bindNodes",value:function(){var t=this;this.registry.forEach((function(e){t.bindNode(e)}))}}],e&&zi(t.prototype,e),i&&zi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Hi(t){return Hi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hi(t)}function Vi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Xi(n.key),n)}}function Xi(t){var e=function(t,e){if("object"!=Hi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Hi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Hi(e)?e:e+""}var Yi=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.container=e,this.init()},e=[{key:"init",value:function(){var t=this,e=document.createElement("div");e.className="info-window",Object.assign(e.style,{position:"absolute",top:"0",right:"0",width:"250px",height:"100%",background:"rgba(30, 30, 30, 0.85)",color:"#fff",padding:"12px",boxSizing:"border-box",backdropFilter:"blur(6px)",borderLeft:"1px solid rgba(255,255,255,0.1)",display:"none",zIndex:"999"});var i=document.createElement("div");i.textContent="✕",Object.assign(i.style,{position:"absolute",top:"8px",right:"10px",cursor:"pointer",fontSize:"14px",opacity:"0.7",padding:"2px 6px",borderRadius:"4px",transition:"all 0.15s"}),i.addEventListener("mouseenter",(function(){i.style.background="#444",i.style.opacity="1"})),i.addEventListener("mouseleave",(function(){i.style.background="transparent",i.style.opacity="0.7"})),i.addEventListener("click",(function(){t.hide()})),e.appendChild(i);var n=document.createElement("div");n.style.marginTop="24px",e.appendChild(n),"static"===window.getComputedStyle(this.container).position&&(this.container.style.position="relative"),this.container.appendChild(e),this.panel=e,this.content=n}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.panel.style.display="block",t&&(this.content.innerHTML=t)}},{key:"showWithDrag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return[]};this.show(),this.content.innerHTML="";var i=document.createElement("div");i.textContent="⠿ Drag selection",i.draggable=!0,Object.assign(i.style,{cursor:"grab",padding:"6px 8px",marginBottom:"8px",background:"#3a3a3a",borderRadius:"6px",fontSize:"12px",textAlign:"center"}),i.addEventListener("dragstart",(function(t){var n={type:"graph-nodes",data:e()};console.log("payload",n);var r=JSON.stringify(n);t.dataTransfer.setData("application/json",r),t.dataTransfer.setData("text/plain",r),i.style.opacity="0.5"})),i.addEventListener("dragend",(function(){i.style.opacity="1"}));var n=document.createElement("div");n.innerHTML=t,this.content.appendChild(i),this.content.appendChild(n)}},{key:"hide",value:function(){this.panel.style.display="none"}},{key:"clear",value:function(){this.content.innerHTML=""}},{key:"getElement",value:function(){return this.panel}}],e&&Vi(t.prototype,e),i&&Vi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function $i(t){return $i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$i(t)}function qi(){qi=function(){return e};var t,e={},i=Object.prototype,n=i.hasOwnProperty,r=Object.defineProperty||function(t,e,i){t[e]=i.value},s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function h(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(t){h=function(t,e,i){return t[e]=i}}function c(t,e,i,n){var s=e&&e.prototype instanceof g?e:g,o=Object.create(s.prototype),a=new P(n||[]);return r(o,"_invoke",{value:E(t,i,a)}),o}function u(t,e,i){try{return{type:"normal",arg:t.call(e,i)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var d="suspendedStart",p="suspendedYield",f="executing",m="completed",y={};function g(){}function v(){}function b(){}var x={};h(x,o,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(I([])));w&&w!==i&&n.call(w,o)&&(x=w);var S=b.prototype=g.prototype=Object.create(x);function C(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function i(r,s,o,a){var l=u(t[r],t,s);if("throw"!==l.type){var h=l.arg,c=h.value;return c&&"object"==$i(c)&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){i("next",t,o,a)}),(function(t){i("throw",t,o,a)})):e.resolve(c).then((function(t){h.value=t,o(h)}),(function(t){return i("throw",t,o,a)}))}a(l.arg)}var s;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return s=s?s.then(r,r):r()}})}function E(e,i,n){var r=d;return function(s,o){if(r===f)throw Error("Generator is already running");if(r===m){if("throw"===s)throw o;return{value:t,done:!0}}for(n.method=s,n.arg=o;;){var a=n.delegate;if(a){var l=M(a,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=f;var h=u(e,i,n);if("normal"===h.type){if(r=n.done?m:p,h.arg===y)continue;return{value:h.arg,done:n.done}}"throw"===h.type&&(r=m,n.method="throw",n.arg=h.arg)}}}function M(e,i){var n=i.method,r=e.iterator[n];if(r===t)return i.delegate=null,"throw"===n&&e.iterator.return&&(i.method="return",i.arg=t,M(e,i),"throw"===i.method)||"return"!==n&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var s=u(r,e.iterator,i.arg);if("throw"===s.type)return i.method="throw",i.arg=s.arg,i.delegate=null,y;var o=s.arg;return o?o.done?(i[e.resultName]=o.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=t),i.delegate=null,y):o:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,y)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function I(e){if(e||""===e){var i=e[o];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,s=function i(){for(;++r<e.length;)if(n.call(e,r))return i.value=e[r],i.done=!1,i;return i.value=t,i.done=!0,i};return s.next=s}}throw new TypeError($i(e)+" is not iterable")}return v.prototype=b,r(S,"constructor",{value:b,configurable:!0}),r(b,"constructor",{value:v,configurable:!0}),v.displayName=h(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,h(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},C(A.prototype),h(A.prototype,a,(function(){return this})),e.AsyncIterator=A,e.async=function(t,i,n,r,s){void 0===s&&(s=Promise);var o=new A(c(t,i,n,r),s);return e.isGeneratorFunction(i)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},C(S),h(S,l,"Generator"),h(S,o,(function(){return this})),h(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),i=[];for(var n in e)i.push(n);return i.reverse(),function t(){for(;i.length;){var n=i.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=I,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var i in this)"t"===i.charAt(0)&&n.call(this,i)&&!isNaN(+i.slice(1))&&(this[i]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var i=this;function r(n,r){return a.type="throw",a.arg=e,i.next=n,r&&(i.method="next",i.arg=t),!!r}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var l=n.call(o,"catchLoc"),h=n.call(o,"finallyLoc");if(l&&h){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!h)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var s=r;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=t,o.arg=e,s?(this.method="next",this.next=s.finallyLoc,y):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),k(i),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var n=i.completion;if("throw"===n.type){var r=n.arg;k(i)}return r}}throw Error("illegal catch attempt")},delegateYield:function(e,i,n){return this.delegate={iterator:I(e),resultName:i,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function Ki(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function Zi(t){return function(){var e=this,i=arguments;return new Promise((function(n,r){var s=t.apply(e,i);function o(t){Ki(s,n,r,o,a,"next",t)}function a(t){Ki(s,n,r,o,a,"throw",t)}o(void 0)}))}}function Qi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,tn(n.key),n)}}function Ji(t,e,i){return(e=tn(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function tn(t){var e=function(t,e){if("object"!=$i(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=$i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$i(e)?e:e+""}var en=function(){function t(e){var i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Ji(this,"getSelectedMoons",(function(){return console.log("regresando seleccion"),i.selectedNodes})),Ji(this,"getSelectedNodes",(function(){return Array.from(i.getSelectedMoons()).map((function(t){return t.data}))})),this.container=e,this.selectedNodes=new Set,this.minScale=.1,this.maxScale=10}return e=t,i=[{key:"init",value:(s=Zi(qi().mark((function t(){var e=this;return qi().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.app=new Vt,t.next=3,this.app.init({resizeTo:this.container,background:1973790});case 3:this.container.appendChild(this.app.canvas),this.world=new Ft.mc,this.uiLayer=new Ft.mc,this.app.stage.addChild(this.world),this.app.stage.addChild(this.uiLayer),this.registry=new mi,this.interaction=new Ui({app:this.app,world:this.world,viewport:this.viewport,registry:this.registry,selection:this.selectedNodes}),this.interaction.enable(),this.renderer=new Bi({world:this.world,uiLayer:this.uiLayer,registry:this.registry,selection:this.selectedNodes,interaction:this.interaction,colorResolver:function(t){var i,n,r;return null!==(i=null===(n=e.model)||void 0===n||null===(r=n.getNodeColor)||void 0===r?void 0:r.call(n,t))&&void 0!==i?i:16777215}}),this.infoWindow=new Yi(this.container),this.bindEvents();case 14:case"end":return t.stop()}}),t,this)}))),function(){return s.apply(this,arguments)})},{key:"bindEvents",value:function(){var t=this;this.interaction.onSelectionChange=function(e){var i;t.renderer.updateSelection(e),null===(i=t.onSelectionChange)||void 0===i||i.call(t,e)},this.interaction.onNodeClick=function(e){var i;null===(i=t.onNodeClick)||void 0===i||i.call(t,e)},this.interaction.onNodeRightClick=function(e){var i;null===(i=t.onNodeRightClick)||void 0===i||i.call(t,e)},this.interaction.onBackgroundRightClick=function(e){var i;null===(i=t.onBackgroundRightClick)||void 0===i||i.call(t,e)}}},{key:"render",value:function(t){this.renderer.render(t)}},{key:"renderGraph",value:function(t){this.render(t)}},{key:"center",value:function(t,e){this.viewport.center(t,e)}},{key:"screenToWorld",value:function(t,e){return this.interaction.screenToWorld(t,e)}},{key:"showInfo",value:function(t){this.infoWindow.show(t)}},{key:"showInfoWindow",value:function(t){this.infoWindow.show(t)}},{key:"hideInfo",value:function(){this.infoWindow.hide()}},{key:"toWorld",value:function(t,e){return this.interaction.screenToWorld(t,e)}},{key:"getWorldBounds",value:function(){var t=this.app.canvas,e=this.toWorld(0,0),i=this.toWorld(t.width,t.height);return{minX:e.x,minY:e.y,maxX:i.x,maxY:i.y}}},{key:"_getNodeAtPosition",value:function(t,e){var i=null;return this.registry.forEach((function(n){var r=n.nodeRef;if(r){var s=r.radius||("planet"===r.type?40:10),o=t-r.x,a=e-r.y;o*o+a*a<=s*s&&(i=r)}})),i}},{key:"showInfoWindowWithDrag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.infoWindow.showWithDrag(t,this.getSelectedNodes)}}],n=[{key:"create",value:(r=Zi(qi().mark((function e(i){var n;return qi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new t(i),e.next=3,n.init();case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)}))),function(t){return r.apply(this,arguments)})}],i&&Qi(e.prototype,i),n&&Qi(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,i,n,r,s}();function nn(t){return nn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nn(t)}function rn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,sn(n.key),n)}}function sn(t){var e=function(t,e){if("object"!=nn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=nn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==nn(e)?e:e+""}var on=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.nodes=new Map,this.edges=[]},(e=[{key:"addNode",value:function(t){this.nodes.set(t.id,{id:t.id,type:t.type||"moon",x:t.x||0,y:t.y||0,vx:0,vy:0,data:t.data||{},rule:t.rule||null})}},{key:"addMoon",value:function(t){var e=t.id,i=t.x,n=t.y,r=t.data;this.nodes.set(e,{id:e,type:"moon",x:i,y:n,vx:0,vy:0,data:r})}},{key:"addPlanet",value:function(t){var e=t.id,i=t.x,n=t.y,r=t.rule,s=t.scalarField,o=t.label;this.nodes.set(e,{id:e,type:"planet",x:i,y:n,vx:0,vy:0,rule:r,scalarField:s,label:o})}},{key:"addFormula",value:function(t){var e=t.id,i=t.x,n=t.y,r=t.scope,s=t.scalarField,o=t.label,a=t.formula;this.nodes.set(e,{id:e,type:"formula",x:i,y:n,vx:0,vy:0,scope:r,scalarField:s,label:o,formula:a})}},{key:"addVector",value:function(t){var e=t.id,i=t.x,n=t.y,r=t.direction,s=t.length,o=t.scalarField,a=t.rule,l=Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))||1,h={x:r.x/l,y:r.y/l};this.nodes.set(e,{id:e,type:"vector",vector:!0,x:i,y:n,direction:h,length:s||200,scalarField:o,rule:a,vx:0,vy:0})}},{key:"removeYVectors",value:function(){var t=this,e=[];this.nodes.forEach((function(t,i){"vector"===t.type&&t.direction&&Math.abs(t.direction.x)<1e-4&&Math.abs(t.direction.y)>1e-4&&e.push(i)})),e.forEach((function(e){return t.deleteNode(e)}))}},{key:"removeXVectors",value:function(){var t=this,e=[];this.nodes.forEach((function(t,i){"vector"===t.type&&t.direction&&Math.abs(t.direction.y)<1e-4&&Math.abs(t.direction.x)>1e-4&&e.push(i)})),e.forEach((function(e){return t.deleteNode(e)}))}},{key:"addEdge",value:function(t,e){this.edges.push({source:t,target:e})}},{key:"getNode",value:function(t){return this.nodes.get(t)}},{key:"getNodes",value:function(){return Array.from(this.nodes.values())}},{key:"deleteNode",value:function(t){this.nodes.delete(t),this.edges=this.edges.filter((function(e){return e.source!==t&&e.target!==t}))}},{key:"addColorRule",value:function(t){this.colorRules||(this.colorRules=[]),this.colorRules.push(t)}},{key:"getNodeColor",value:function(t){if(!this.colorRules||0===this.colorRules.length)return null;for(var e=this.colorRules.length-1;e>=0;e--){var i,n=this.colorRules[e],r=null===(i=t.data)||void 0===i?void 0:i[n.field];if(null!=r){if(void 0!==n.equals&&r===n.equals)return n.color;if(void 0!==n.gt&&Number(r)>n.gt)return n.color;if(void 0!==n.lt&&Number(r)<n.lt)return n.color}}return null}}])&&rn(t.prototype,e),i&&rn(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function an(t){return an="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},an(t)}function ln(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return hn(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?hn(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function cn(){cn=function(){return e};var t,e={},i=Object.prototype,n=i.hasOwnProperty,r=Object.defineProperty||function(t,e,i){t[e]=i.value},s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function h(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(t){h=function(t,e,i){return t[e]=i}}function c(t,e,i,n){var s=e&&e.prototype instanceof g?e:g,o=Object.create(s.prototype),a=new P(n||[]);return r(o,"_invoke",{value:E(t,i,a)}),o}function u(t,e,i){try{return{type:"normal",arg:t.call(e,i)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var d="suspendedStart",p="suspendedYield",f="executing",m="completed",y={};function g(){}function v(){}function b(){}var x={};h(x,o,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(I([])));w&&w!==i&&n.call(w,o)&&(x=w);var S=b.prototype=g.prototype=Object.create(x);function C(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function i(r,s,o,a){var l=u(t[r],t,s);if("throw"!==l.type){var h=l.arg,c=h.value;return c&&"object"==an(c)&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){i("next",t,o,a)}),(function(t){i("throw",t,o,a)})):e.resolve(c).then((function(t){h.value=t,o(h)}),(function(t){return i("throw",t,o,a)}))}a(l.arg)}var s;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return s=s?s.then(r,r):r()}})}function E(e,i,n){var r=d;return function(s,o){if(r===f)throw Error("Generator is already running");if(r===m){if("throw"===s)throw o;return{value:t,done:!0}}for(n.method=s,n.arg=o;;){var a=n.delegate;if(a){var l=M(a,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=f;var h=u(e,i,n);if("normal"===h.type){if(r=n.done?m:p,h.arg===y)continue;return{value:h.arg,done:n.done}}"throw"===h.type&&(r=m,n.method="throw",n.arg=h.arg)}}}function M(e,i){var n=i.method,r=e.iterator[n];if(r===t)return i.delegate=null,"throw"===n&&e.iterator.return&&(i.method="return",i.arg=t,M(e,i),"throw"===i.method)||"return"!==n&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var s=u(r,e.iterator,i.arg);if("throw"===s.type)return i.method="throw",i.arg=s.arg,i.delegate=null,y;var o=s.arg;return o?o.done?(i[e.resultName]=o.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=t),i.delegate=null,y):o:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,y)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function I(e){if(e||""===e){var i=e[o];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,s=function i(){for(;++r<e.length;)if(n.call(e,r))return i.value=e[r],i.done=!1,i;return i.value=t,i.done=!0,i};return s.next=s}}throw new TypeError(an(e)+" is not iterable")}return v.prototype=b,r(S,"constructor",{value:b,configurable:!0}),r(b,"constructor",{value:v,configurable:!0}),v.displayName=h(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,h(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},C(A.prototype),h(A.prototype,a,(function(){return this})),e.AsyncIterator=A,e.async=function(t,i,n,r,s){void 0===s&&(s=Promise);var o=new A(c(t,i,n,r),s);return e.isGeneratorFunction(i)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},C(S),h(S,l,"Generator"),h(S,o,(function(){return this})),h(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),i=[];for(var n in e)i.push(n);return i.reverse(),function t(){for(;i.length;){var n=i.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=I,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var i in this)"t"===i.charAt(0)&&n.call(this,i)&&!isNaN(+i.slice(1))&&(this[i]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var i=this;function r(n,r){return a.type="throw",a.arg=e,i.next=n,r&&(i.method="next",i.arg=t),!!r}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var l=n.call(o,"catchLoc"),h=n.call(o,"finallyLoc");if(l&&h){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!h)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var s=r;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=t,o.arg=e,s?(this.method="next",this.next=s.finallyLoc,y):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),k(i),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var n=i.completion;if("throw"===n.type){var r=n.arg;k(i)}return r}}throw Error("illegal catch attempt")},delegateYield:function(e,i,n){return this.delegate={iterator:I(e),resultName:i,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function un(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function dn(t){return function(){var e=this,i=arguments;return new Promise((function(n,r){var s=t.apply(e,i);function o(t){un(s,n,r,o,a,"next",t)}function a(t){un(s,n,r,o,a,"throw",t)}o(void 0)}))}}function pn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fn(n.key),n)}}function fn(t){var e=function(t,e){if("object"!=an(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=an(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==an(e)?e:e+""}var mn=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.container=e.contentContainer,this.algorithms={rule:g,rule_fast:A,gravity:xt,orbits:ft,spiral:lt,spiral_no:R,vertical:H,sorter_no_col:et}}return e=t,i=[{key:"_init",value:(s=dn(cn().mark((function t(){var e=this;return cn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,en.create(this.container);case 2:this.view=t.sent,this.view.app.renderer.events.cursorStyles.default="default",this.view.app.renderer.events.domElement.addEventListener("contextmenu",(function(t){t.preventDefault()})),this.model=new on,this.view.model=this.model,this.controller=new Mt(this.view,this.model),this.controller.main=this,this._enableDrop(),this.algo=new xt,this.algo.setModel(this.model),this.view.app.ticker.add((function(){e.algo.bounds=e.view.getWorldBounds(),e.algo.model.viewportWidth=e.view.width,e.algo.model.viewportHeight=e.view.height,e.isPaused||e.algo.step(),e.view.renderGraph(e.model)}));case 13:case"end":return t.stop()}}),t,this)}))),function(){return s.apply(this,arguments)})},{key:"pauseGraph",value:function(){this.isPaused=!0}},{key:"resumeGraph",value:function(){this.isPaused=!1}},{key:"setAlgorithm",value:function(t){this.algo=t}},{key:"addMoonData",value:function(t){var e=t.id,i=t.x,n=t.y,r=t.data,s=void 0===r?{}:r,o=t.fixed,a=void 0!==o&&o;if(this.model&&this.view){var l=this.view.app.screen.width,h=this.view.app.screen.height,c=void 0!==i?i:Math.random()*l,u=void 0!==n?n:Math.random()*h;this.model.addMoon({id:e,x:c,y:u,data:s,fixed:a}),this.view.renderGraph(this.model)}}},{key:"addRandomMoons",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=["male","female"],i=["a","b","c"],n=0;n<t;n++){var r=crypto.randomUUID(),s=e[Math.floor(Math.random()*e.length)],o=Math.floor(80*Math.random())+1,a=i[Math.floor(Math.random()*i.length)];this.addMoonData({id:r,data:{sex:s,age:o,class:a}})}}},{key:"_dropDataset",value:function(t,e){var i=this;t.forEach((function(t,n){var r=t.id||"moon_".concat(Date.now(),"_").concat(n),s=Math.random()*Math.PI*2,o=200*Math.random(),a=e.x+Math.cos(s)*o,l=e.y+Math.sin(s)*o;i.model.addMoon({id:r,x:a,y:l,data:t})})),this.model.changed=!0}},{key:"_setAlgorithmByName",value:function(t){var e=this.algorithms[t];if(e){var i=new e;i.setModel(this.model),this.setAlgorithm(i)}else console.warn("Unknown algorithm:",t)}},{key:"_enableDrop",value:function(){var t=this,e=this.view.app.view;e.addEventListener("dragover",(function(t){return t.preventDefault()})),e.addEventListener("drop",(function(i){i.preventDefault();var n=e.getBoundingClientRect(),r=i.clientX-n.left,s=i.clientY-n.top,o=t.view.toWorld(r,s),a=(t.view._getNodeAtPosition(o.x,o.y),i.dataTransfer.getData("application/json"));if(a){var l=JSON.parse(a);if("table"!==l.type&&"graph-nodes"!==l.type)if("algorithm"!==l.type){if("color-rule"===l.type)return console.log("dropped color",l),void t.model.addColorRule({field:l.field,equals:l.equals,gt:l.gt,lt:l.lt,color:l.color});if("planet"===l.type){var c=h.build(l.rule);t.model.addPlanet({id:"p_"+Date.now(),x:o.x,y:o.y,rule:c,label:l.label,scalarField:l.scalarField})}if("scalarField"===l.type){var u=t.view._getNodeAtPosition(o.x,o.y);if(u&&"planet"===u.type)return u.scalarFields=u.scalarFields||[],u.scalarFields.includes(l.field)||u.scalarFields.push(l.field),void(u.scalarField=l.field)}if("sumField"===l.type&&t.model.addFormula({id:"f_"+Date.now(),x:o.x,y:o.y,scope:"all",label:"Edad",scalarField:"Edad",formula:"count"}),t.controller._refreshFormulaNodes(),"vector"===l.type){var d=h.build(l.rule);t.model.addVector({id:"p_"+Date.now(),x:o.x,y:o.y,direction:l.direction,length:l.length,scalarField:l.scalarField,rule:d})}}else t._setAlgorithmByName(l.name);else t._dropDataset(l.data,o)}}))}},{key:"getFormatedNode",value:function(t){if("planet"==t.type){var e=t.sumField?"Sum of ".concat(t.sumField):"",i=t.sumTotal?"Sum of ".concat(t.sumField," : ").concat(this.view.formatMoney(t.sumTotal)," "):"";return'\n <h3 style="margin-top:0">ATTRACTOR</h3>\n <div style="font-size:12px; line-height:1.4">\n Attracts nodes with : '.concat(t.label," <br/>\n ").concat(e," </br>\n ").concat(i,"\n </div>\n ")}var n=Object.entries(t);return'\n <h3 style="margin-top:0">'.concat(t.nombre||t.name||t.label||"Node",'</h3>\n <div style="font-size:12px; line-height:1.4">\n ').concat(n.map((function(t){var e,i=ln(t,2),n=i[0],r=i[1];return'\n <div style="display:flex; justify-content:space-between; margin-bottom:4px;">\n <span style="opacity:0.7">'.concat(n,'</span>\n <span style="text-align:right; margin-left:10px;">').concat(null==(e=r)||""===e||"NULL"===e?"<span style='opacity:0.5'>—</span>":e,"</span>\n </div>\n ")})).join(""),"\n </div>\n ")}}],n=[{key:"create",value:(r=dn(cn().mark((function e(i){var n;return cn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new t(i),e.next=3,n._init();case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)}))),function(t){return r.apply(this,arguments)})}],i&&pn(e.prototype,i),n&&pn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,i,n,r,s}(),yn=function(t,e){return yn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},yn(t,e)};function gn(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}yn(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var vn=function(){return vn=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},vn.apply(this,arguments)};function bn(t,e,i){if(i||2===arguments.length)for(var n,r=0,s=e.length;r<s;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var xn,_n="ADD_CHOICE",wn="REMOVE_CHOICE",Sn="FILTER_CHOICES",Cn="ACTIVATE_CHOICES",An="CLEAR_CHOICES",En="ADD_GROUP",Mn="ADD_ITEM",Tn="REMOVE_ITEM",kn="HIGHLIGHT_ITEM",Pn="showDropdown",In="hideDropdown",On="change",Rn="choice",Ln="search",jn="addItem",Dn="removeItem",Fn="highlightItem",Nn="highlightChoice",Bn="unhighlightItem",Gn=9,zn=16,Wn=46,Un=8,Hn=13,Vn=65,Xn=27,Yn=38,$n=40,qn=33,Kn=34,Zn=["fuseOptions","classNames"],Qn="text",Jn="select-one",tr="select-multiple",er=function(t){return{type:_n,choice:t}},ir=function(t){return{type:Mn,item:t}},nr=function(t){return{type:Tn,item:t}},rr=function(t,e){return{type:kn,item:t,highlighted:e}},sr=function(t){return Array.from({length:t},(function(){return(t=0,e=36,Math.floor(Math.random()*(e-t)+t)).toString(36);var t,e})).join("")},or=function(t,e,i){return void 0===i&&(i=1),i>0?e.scrollTop+e.offsetHeight>=t.offsetTop+t.offsetHeight:t.offsetTop>=e.scrollTop},ar=function(t){if("string"!=typeof t){if(null==t)return"";if("object"==typeof t){if("raw"in t)return ar(t.raw);if("trusted"in t)return t.trusted}return t}return t.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/'/g,"&#039;").replace(/"/g,"&quot;")},lr=(xn=document.createElement("div"),function(t){xn.innerHTML=t.trim();for(var e=xn.children[0];xn.firstChild;)xn.removeChild(xn.firstChild);return e}),hr=function(t){return"function"==typeof t?t():t},cr=function(t){if("string"==typeof t)return t;if("object"==typeof t){if("trusted"in t)return t.trusted;if("raw"in t)return t.raw}return""},ur=function(t){if("string"==typeof t)return t;if("object"==typeof t){if("escaped"in t)return t.escaped;if("trusted"in t)return t.trusted}return""},dr=function(t,e){return{id:t.id,highlighted:t.highlighted,labelClass:t.labelClass,labelDescription:cr(t.labelDescription),customProperties:t.customProperties,disabled:t.disabled,active:t.active,label:t.label,placeholder:t.placeholder,value:t.value,groupValue:t.group?t.group.label:void 0,element:t.element,keyCode:e}},pr=function(t,e,i){return"function"==typeof t?t(ar(e),cr(e),i):t},fr=function(t,e){return t?ur(e):ar(e)},mr=function(t,e,i){t.innerHTML=fr(e,i)},yr=function(t,e){return t.rank-e.rank},gr=function(t){return Array.isArray(t)?t:[t]},vr=function(t){return t&&Array.isArray(t)?t.map((function(t){return".".concat(t)})).join(""):".".concat(t)},br=function(t,e){var i;(i=t.classList).add.apply(i,gr(e))},xr=function(t,e){var i;(i=t.classList).remove.apply(i,gr(e))},_r=function(t){if(void 0!==t)try{return JSON.parse(t)}catch(e){return t}return{}},wr=function(){function t(t){var e=t.element,i=t.type,n=t.classNames;this.element=e,this.classNames=n,this.type=i,this.isActive=!1}return t.prototype.show=function(){return br(this.element,this.classNames.activeState),this.element.setAttribute("aria-expanded","true"),this.isActive=!0,this},t.prototype.hide=function(){return xr(this.element,this.classNames.activeState),this.element.setAttribute("aria-expanded","false"),this.isActive=!1,this},t}(),Sr=function(){function t(t){var e=t.element,i=t.type,n=t.classNames,r=t.position;this.element=e,this.classNames=n,this.type=i,this.position=r,this.isOpen=!1,this.isFlipped=!1,this.isDisabled=!1,this.isLoading=!1}return t.prototype.shouldFlip=function(t,e){var i=!1;return"auto"===this.position?i=this.element.getBoundingClientRect().top-e>=0&&!window.matchMedia("(min-height: ".concat(t+1,"px)")).matches:"top"===this.position&&(i=!0),i},t.prototype.setActiveDescendant=function(t){this.element.setAttribute("aria-activedescendant",t)},t.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},t.prototype.open=function(t,e){br(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(t,e)&&(br(this.element,this.classNames.flippedState),this.isFlipped=!0)},t.prototype.close=function(){xr(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(xr(this.element,this.classNames.flippedState),this.isFlipped=!1)},t.prototype.addFocusState=function(){br(this.element,this.classNames.focusState)},t.prototype.removeFocusState=function(){xr(this.element,this.classNames.focusState)},t.prototype.addInvalidState=function(){br(this.element,this.classNames.invalidState)},t.prototype.removeInvalidState=function(){xr(this.element,this.classNames.invalidState)},t.prototype.enable=function(){xr(this.element,this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),this.type===Jn&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1},t.prototype.disable=function(){br(this.element,this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),this.type===Jn&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0},t.prototype.wrap=function(t){var e=this.element,i=t.parentNode;i&&(t.nextSibling?i.insertBefore(e,t.nextSibling):i.appendChild(e)),e.appendChild(t)},t.prototype.unwrap=function(t){var e=this.element,i=e.parentNode;i&&(i.insertBefore(t,e),i.removeChild(e))},t.prototype.addLoadingState=function(){br(this.element,this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0},t.prototype.removeLoadingState=function(){xr(this.element,this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1},t}(),Cr=function(){function t(t){var e=t.element,i=t.type,n=t.classNames,r=t.preventPaste;this.element=e,this.type=i,this.classNames=n,this.preventPaste=r,this.isFocussed=this.element.isEqualNode(document.activeElement),this.isDisabled=e.disabled,this._onPaste=this._onPaste.bind(this),this._onInput=this._onInput.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this)}return Object.defineProperty(t.prototype,"placeholder",{set:function(t){this.element.placeholder=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.element.value},set:function(t){this.element.value=t},enumerable:!1,configurable:!0}),t.prototype.addEventListeners=function(){var t=this.element;t.addEventListener("paste",this._onPaste),t.addEventListener("input",this._onInput,{passive:!0}),t.addEventListener("focus",this._onFocus,{passive:!0}),t.addEventListener("blur",this._onBlur,{passive:!0})},t.prototype.removeEventListeners=function(){var t=this.element;t.removeEventListener("input",this._onInput),t.removeEventListener("paste",this._onPaste),t.removeEventListener("focus",this._onFocus),t.removeEventListener("blur",this._onBlur)},t.prototype.enable=function(){this.element.removeAttribute("disabled"),this.isDisabled=!1},t.prototype.disable=function(){this.element.setAttribute("disabled",""),this.isDisabled=!0},t.prototype.focus=function(){this.isFocussed||this.element.focus()},t.prototype.blur=function(){this.isFocussed&&this.element.blur()},t.prototype.clear=function(t){return void 0===t&&(t=!0),this.element.value="",t&&this.setWidth(),this},t.prototype.setWidth=function(){var t=this.element;t.style.minWidth="".concat(t.placeholder.length+1,"ch"),t.style.width="".concat(t.value.length+1,"ch")},t.prototype.setActiveDescendant=function(t){this.element.setAttribute("aria-activedescendant",t)},t.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},t.prototype._onInput=function(){this.type!==Jn&&this.setWidth()},t.prototype._onPaste=function(t){this.preventPaste&&t.preventDefault()},t.prototype._onFocus=function(){this.isFocussed=!0},t.prototype._onBlur=function(){this.isFocussed=!1},t}(),Ar=function(){function t(t){var e=t.element;this.element=e,this.scrollPos=this.element.scrollTop,this.height=this.element.offsetHeight}return t.prototype.prepend=function(t){var e=this.element.firstElementChild;e?this.element.insertBefore(t,e):this.element.append(t)},t.prototype.scrollToTop=function(){this.element.scrollTop=0},t.prototype.scrollToChildElement=function(t,e){var i=this;if(t){var n=this.element.offsetHeight,r=this.element.scrollTop+n,s=t.offsetHeight,o=t.offsetTop+s,a=e>0?this.element.scrollTop+o-r:t.offsetTop;requestAnimationFrame((function(){i._animateScroll(a,e)}))}},t.prototype._scrollDown=function(t,e,i){var n=(i-t)/e,r=n>1?n:1;this.element.scrollTop=t+r},t.prototype._scrollUp=function(t,e,i){var n=(t-i)/e,r=n>1?n:1;this.element.scrollTop=t-r},t.prototype._animateScroll=function(t,e){var i=this,n=this.element.scrollTop,r=!1;e>0?(this._scrollDown(n,4,t),n<t&&(r=!0)):(this._scrollUp(n,4,t),n>t&&(r=!0)),r&&requestAnimationFrame((function(){i._animateScroll(t,e)}))},t}(),Er=function(){function t(t){var e=t.element,i=t.classNames;this.element=e,this.classNames=i,this.isDisabled=!1}return Object.defineProperty(t.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.element.value},set:function(t){this.element.setAttribute("value",t),this.element.value=t},enumerable:!1,configurable:!0}),t.prototype.conceal=function(){var t=this.element;br(t,this.classNames.input),t.hidden=!0,t.tabIndex=-1;var e=t.getAttribute("style");e&&t.setAttribute("data-choice-orig-style",e),t.setAttribute("data-choice","active")},t.prototype.reveal=function(){var t=this.element;xr(t,this.classNames.input),t.hidden=!1,t.removeAttribute("tabindex");var e=t.getAttribute("data-choice-orig-style");e?(t.removeAttribute("data-choice-orig-style"),t.setAttribute("style",e)):t.removeAttribute("style"),t.removeAttribute("data-choice")},t.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},t.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},t.prototype.triggerEvent=function(t,e){!function(t,e,i){void 0===i&&(i=null);var n=new CustomEvent(e,{detail:i,bubbles:!0,cancelable:!0});t.dispatchEvent(n)}(this.element,t,e||{})},t}(),Mr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return gn(e,t),e}(Er),Tr=function(t,e){return void 0===e&&(e=!0),void 0===t?e:!!t},kr=function(t){if("string"==typeof t&&(t=t.split(" ").filter((function(t){return t.length}))),Array.isArray(t)&&t.length)return t},Pr=function(t,e,i){if(void 0===i&&(i=!0),"string"==typeof t){var n=ar(t);return Pr({value:t,label:i||n===t?t:{escaped:n,raw:t},selected:!0},!1)}var r=t;if("choices"in r){if(!e)throw new TypeError("optGroup is not allowed");var s=r,o=s.choices.map((function(t){return Pr(t,!1)}));return{id:0,label:cr(s.label)||s.value,active:!!o.length,disabled:!!s.disabled,choices:o}}var a=r;return{id:0,group:null,score:0,rank:0,value:a.value,label:a.label||a.value,active:Tr(a.active),selected:Tr(a.selected,!1),disabled:Tr(a.disabled,!1),placeholder:Tr(a.placeholder,!1),highlighted:!1,labelClass:kr(a.labelClass),labelDescription:a.labelDescription,customProperties:a.customProperties}},Ir=function(t){return"SELECT"===t.tagName},Or=function(t){function e(e){var i=e.element,n=e.classNames,r=e.template,s=e.extractPlaceholder,o=t.call(this,{element:i,classNames:n})||this;return o.template=r,o.extractPlaceholder=s,o}return gn(e,t),Object.defineProperty(e.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),e.prototype.addOptions=function(t){var e=this,i=document.createDocumentFragment();t.forEach((function(t){var n=t;if(!n.element){var r=e.template(n);i.appendChild(r),n.element=r}})),this.element.appendChild(i)},e.prototype.optionsAsChoices=function(){var t=this,e=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach((function(i){!function(t){return"OPTION"===t.tagName}(i)?function(t){return"OPTGROUP"===t.tagName}(i)&&e.push(t._optgroupToChoice(i)):e.push(t._optionToChoice(i))})),e},e.prototype._optionToChoice=function(t){return!t.hasAttribute("value")&&t.hasAttribute("placeholder")&&(t.setAttribute("value",""),t.value=""),{id:0,group:null,score:0,rank:0,value:t.value,label:t.label,element:t,active:!0,selected:this.extractPlaceholder?t.selected:t.hasAttribute("selected"),disabled:t.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(!t.value||t.hasAttribute("placeholder")),labelClass:void 0!==t.dataset.labelClass?kr(t.dataset.labelClass):void 0,labelDescription:void 0!==t.dataset.labelDescription?{trusted:t.dataset.labelDescription}:void 0,customProperties:_r(t.dataset.customProperties)}},e.prototype._optgroupToChoice=function(t){var e=this,i=t.querySelectorAll("option"),n=Array.from(i).map((function(t){return e._optionToChoice(t)}));return{id:0,label:t.label||"",element:t,active:!!n.length,disabled:t.disabled,choices:n}},e}(Er),Rr={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,closeDropdownOnSelect:"auto",singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(t){return!!t&&""!==t},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!1,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchDisabledChoices:!1,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,shouldSort:!0,shouldSortItems:!1,sorter:function(t,e){var i=t.value,n=t.label,r=void 0===n?i:n,s=e.value,o=e.label,a=void 0===o?s:o;return cr(r).localeCompare(cr(a),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,placeholder:!0,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",searchRenderSelectedChoices:!0,loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",uniqueItemText:"Only unique values can be added",customAddItemText:"Only values matching specific conditions can be added",addItemText:function(t){return'Press Enter to add <b>"'.concat(t,'"</b>')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(t,e,i){return"Remove item: ".concat(i?ar(i.label):t)},maxItemText:function(t){return"Only ".concat(t," values can be added")},valueComparer:function(t,e){return t===e},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],placeholder:["choices__placeholder"],group:["choices__group"],groupHeading:["choices__heading"],button:["choices__button"],activeState:["is-active"],focusState:["is-focused"],openState:["is-open"],disabledState:["is-disabled"],highlightedState:["is-highlighted"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],invalidState:["is-invalid"],notice:["choices__notice"],addChoice:["choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},Lr=function(t){var e=t.itemEl;e&&(e.remove(),t.itemEl=void 0)};var jr={groups:function(t,e){var i=t,n=!0;switch(e.type){case En:i.push(e.group);break;case An:i=[];break;default:n=!1}return{state:i,update:n}},items:function(t,e,i){var n=t,r=!0;switch(e.type){case Mn:e.item.selected=!0,(s=e.item.element)&&(s.selected=!0,s.setAttribute("selected","")),n.push(e.item);break;case Tn:var s;if(e.item.selected=!1,s=e.item.element){s.selected=!1,s.removeAttribute("selected");var o=s.parentElement;o&&Ir(o)&&o.type===Jn&&(o.value="")}Lr(e.item),n=n.filter((function(t){return t.id!==e.item.id}));break;case wn:Lr(e.choice),n=n.filter((function(t){return t.id!==e.choice.id}));break;case kn:var a=e.highlighted,l=n.find((function(t){return t.id===e.item.id}));l&&l.highlighted!==a&&(l.highlighted=a,i&&function(t,e,i){var n=t.itemEl;n&&(xr(n,i),br(n,e))}(l,a?i.classNames.highlightedState:i.classNames.selectedState,a?i.classNames.selectedState:i.classNames.highlightedState));break;default:r=!1}return{state:n,update:r}},choices:function(t,e,i){var n=t,r=!0;switch(e.type){case _n:n.push(e.choice);break;case wn:e.choice.choiceEl=void 0,e.choice.group&&(e.choice.group.choices=e.choice.group.choices.filter((function(t){return t.id!==e.choice.id}))),n=n.filter((function(t){return t.id!==e.choice.id}));break;case Mn:case Tn:e.item.choiceEl=void 0;break;case Sn:var s=[];e.results.forEach((function(t){s[t.item.id]=t})),n.forEach((function(t){var e=s[t.id];void 0!==e?(t.score=e.score,t.rank=e.rank,t.active=!0):(t.score=0,t.rank=0,t.active=!1),i&&i.appendGroupInSearch&&(t.choiceEl=void 0)}));break;case Cn:n.forEach((function(t){t.active=e.active,i&&i.appendGroupInSearch&&(t.choiceEl=void 0)}));break;case An:n=[];break;default:r=!1}return{state:n,update:r}}},Dr=function(){function t(t){this._state=this.defaultState,this._listeners=[],this._txn=0,this._context=t}return Object.defineProperty(t.prototype,"defaultState",{get:function(){return{groups:[],items:[],choices:[]}},enumerable:!1,configurable:!0}),t.prototype.changeSet=function(t){return{groups:t,items:t,choices:t}},t.prototype.reset=function(){this._state=this.defaultState;var t=this.changeSet(!0);this._txn?this._changeSet=t:this._listeners.forEach((function(e){return e(t)}))},t.prototype.subscribe=function(t){return this._listeners.push(t),this},t.prototype.dispatch=function(t){var e=this,i=this._state,n=!1,r=this._changeSet||this.changeSet(!1);Object.keys(jr).forEach((function(s){var o=jr[s](i[s],t,e._context);o.update&&(n=!0,r[s]=!0,i[s]=o.state)})),n&&(this._txn?this._changeSet=r:this._listeners.forEach((function(t){return t(r)})))},t.prototype.withTxn=function(t){this._txn++;try{t()}finally{if(this._txn=Math.max(0,this._txn-1),!this._txn){var e=this._changeSet;e&&(this._changeSet=void 0,this._listeners.forEach((function(t){return t(e)})))}}},Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"items",{get:function(){return this.state.items},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightedActiveItems",{get:function(){return this.items.filter((function(t){return t.active&&t.highlighted}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"choices",{get:function(){return this.state.choices},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"activeChoices",{get:function(){return this.choices.filter((function(t){return t.active}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"searchableChoices",{get:function(){var t=this._context;return this.choices.filter((function(e){return!e.placeholder&&(t.searchDisabledChoices||!e.disabled)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"groups",{get:function(){return this.state.groups},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"activeGroups",{get:function(){var t=this;return this.state.groups.filter((function(e){var i=e.active&&!e.disabled,n=t.state.choices.some((function(t){return t.active&&!t.disabled}));return i&&n}),[])},enumerable:!1,configurable:!0}),t.prototype.inTxn=function(){return this._txn>0},t.prototype.getChoiceById=function(t){return this.activeChoices.find((function(e){return e.id===t}))},t.prototype.getGroupById=function(t){return this.groups.find((function(e){return e.id===t}))},t}(),Fr="no-choices",Nr="no-results",Br="add-choice",Gr="";function zr(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Wr(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Ur(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Wr(Object(i),!0).forEach((function(e){zr(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Wr(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Hr(t){return Array.isArray?Array.isArray(t):"[object Array]"===Zr(t)}function Vr(t){return"string"==typeof t}function Xr(t){return"number"==typeof t}function Yr(t){return!0===t||!1===t||function(t){return $r(t)&&null!==t}(t)&&"[object Boolean]"==Zr(t)}function $r(t){return"object"==typeof t}function qr(t){return null!=t}function Kr(t){return!t.trim().length}function Zr(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Qr=t=>`Missing ${t} property in key`,Jr=t=>`Property 'weight' in key '${t}' must be a positive integer`,ts=Object.prototype.hasOwnProperty;class es{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach((t=>{let i=is(t);this._keys.push(i),this._keyMap[i.id]=i,e+=i.weight})),this._keys.forEach((t=>{t.weight/=e}))}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function is(t){let e=null,i=null,n=null,r=1,s=null;if(Vr(t)||Hr(t))n=t,e=ns(t),i=rs(t);else{if(!ts.call(t,"name"))throw new Error(Qr("name"));const o=t.name;if(n=o,ts.call(t,"weight")&&(r=t.weight,r<=0))throw new Error(Jr(o));e=ns(o),i=rs(o),s=t.getFn}return{path:e,id:i,weight:r,src:n,getFn:s}}function ns(t){return Hr(t)?t:t.split(".")}function rs(t){return Hr(t)?t.join("."):t}const ss={useExtendedSearch:!1,getFn:function(t,e){let i=[],n=!1;const r=(t,e,s)=>{if(qr(t))if(e[s]){const o=t[e[s]];if(!qr(o))return;if(s===e.length-1&&(Vr(o)||Xr(o)||Yr(o)))i.push(function(t){return null==t?"":function(t){if("string"==typeof t)return t;let e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}(o));else if(Hr(o)){n=!0;for(let t=0,i=o.length;t<i;t+=1)r(o[t],e,s+1)}else e.length&&r(o,e,s+1)}else i.push(t)};return r(t,Vr(e)?e.split("."):e,0),n?i:i[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var os=Ur(Ur(Ur(Ur({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1}),{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1}),{location:0,threshold:.6,distance:100}),ss);const as=/[^ ]+/g;class ls{constructor({getFn:t=os.getFn,fieldNormWeight:e=os.fieldNormWeight}={}){this.norm=function(t=1,e=3){const i=new Map,n=Math.pow(10,e);return{get(e){const r=e.match(as).length;if(i.has(r))return i.get(r);const s=1/Math.pow(r,.5*t),o=parseFloat(Math.round(s*n)/n);return i.set(r,o),o},clear(){i.clear()}}}(e,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach(((t,e)=>{this._keysMap[t.id]=e}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,Vr(this.docs[0])?this.docs.forEach(((t,e)=>{this._addString(t,e)})):this.docs.forEach(((t,e)=>{this._addObject(t,e)})),this.norm.clear())}add(t){const e=this.size();Vr(t)?this._addString(t,e):this._addObject(t,e)}removeAt(t){this.records.splice(t,1);for(let e=t,i=this.size();e<i;e+=1)this.records[e].i-=1}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_addString(t,e){if(!qr(t)||Kr(t))return;let i={v:t,i:e,n:this.norm.get(t)};this.records.push(i)}_addObject(t,e){let i={i:e,$:{}};this.keys.forEach(((e,n)=>{let r=e.getFn?e.getFn(t):this.getFn(t,e.path);if(qr(r))if(Hr(r)){let t=[];const e=[{nestedArrIndex:-1,value:r}];for(;e.length;){const{nestedArrIndex:i,value:n}=e.pop();if(qr(n))if(Vr(n)&&!Kr(n)){let e={v:n,i,n:this.norm.get(n)};t.push(e)}else Hr(n)&&n.forEach(((t,i)=>{e.push({nestedArrIndex:i,value:t})}))}i.$[n]=t}else if(Vr(r)&&!Kr(r)){let t={v:r,n:this.norm.get(r)};i.$[n]=t}})),this.records.push(i)}toJSON(){return{keys:this.keys,records:this.records}}}function hs(t,e,{getFn:i=os.getFn,fieldNormWeight:n=os.fieldNormWeight}={}){const r=new ls({getFn:i,fieldNormWeight:n});return r.setKeys(t.map(is)),r.setSources(e),r.create(),r}function cs(t,{errors:e=0,currentLocation:i=0,expectedLocation:n=0,distance:r=os.distance,ignoreLocation:s=os.ignoreLocation}={}){const o=e/t.length;if(s)return o;const a=Math.abs(n-i);return r?o+a/r:a?1:o}const us=32;function ds(t,e,i,{location:n=os.location,distance:r=os.distance,threshold:s=os.threshold,findAllMatches:o=os.findAllMatches,minMatchCharLength:a=os.minMatchCharLength,includeMatches:l=os.includeMatches,ignoreLocation:h=os.ignoreLocation}={}){if(e.length>us)throw new Error(`Pattern length exceeds max of ${us}.`);const c=e.length,u=t.length,d=Math.max(0,Math.min(n,u));let p=s,f=d;const m=a>1||l,y=m?Array(u):[];let g;for(;(g=t.indexOf(e,f))>-1;){let t=cs(e,{currentLocation:g,expectedLocation:d,distance:r,ignoreLocation:h});if(p=Math.min(t,p),f=g+c,m){let t=0;for(;t<c;)y[g+t]=1,t+=1}}f=-1;let v=[],b=1,x=c+u;const _=1<<c-1;for(let n=0;n<c;n+=1){let s=0,a=x;for(;s<a;){cs(e,{errors:n,currentLocation:d+a,expectedLocation:d,distance:r,ignoreLocation:h})<=p?s=a:x=a,a=Math.floor((x-s)/2+s)}x=a;let l=Math.max(1,d-a+1),g=o?u:Math.min(d+a,u)+c,w=Array(g+2);w[g+1]=(1<<n)-1;for(let s=g;s>=l;s-=1){let o=s-1,a=i[t.charAt(o)];if(m&&(y[o]=+!!a),w[s]=(w[s+1]<<1|1)&a,n&&(w[s]|=(v[s+1]|v[s])<<1|1|v[s+1]),w[s]&_&&(b=cs(e,{errors:n,currentLocation:o,expectedLocation:d,distance:r,ignoreLocation:h}),b<=p)){if(p=b,f=o,f<=d)break;l=Math.max(1,2*d-f)}}if(cs(e,{errors:n+1,currentLocation:d,expectedLocation:d,distance:r,ignoreLocation:h})>p)break;v=w}const w={isMatch:f>=0,score:Math.max(.001,b)};if(m){const t=function(t=[],e=os.minMatchCharLength){let i=[],n=-1,r=-1,s=0;for(let o=t.length;s<o;s+=1){let o=t[s];o&&-1===n?n=s:o||-1===n||(r=s-1,r-n+1>=e&&i.push([n,r]),n=-1)}return t[s-1]&&s-n>=e&&i.push([n,s-1]),i}(y,a);t.length?l&&(w.indices=t):w.isMatch=!1}return w}function ps(t){let e={};for(let i=0,n=t.length;i<n;i+=1){const r=t.charAt(i);e[r]=(e[r]||0)|1<<n-i-1}return e}class fs{constructor(t,{location:e=os.location,threshold:i=os.threshold,distance:n=os.distance,includeMatches:r=os.includeMatches,findAllMatches:s=os.findAllMatches,minMatchCharLength:o=os.minMatchCharLength,isCaseSensitive:a=os.isCaseSensitive,ignoreLocation:l=os.ignoreLocation}={}){if(this.options={location:e,threshold:i,distance:n,includeMatches:r,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:a,ignoreLocation:l},this.pattern=a?t:t.toLowerCase(),this.chunks=[],!this.pattern.length)return;const h=(t,e)=>{this.chunks.push({pattern:t,alphabet:ps(t),startIndex:e})},c=this.pattern.length;if(c>us){let t=0;const e=c%us,i=c-e;for(;t<i;)h(this.pattern.substr(t,us),t),t+=us;if(e){const t=c-us;h(this.pattern.substr(t),t)}}else h(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,includeMatches:i}=this.options;if(e||(t=t.toLowerCase()),this.pattern===t){let e={isMatch:!0,score:0};return i&&(e.indices=[[0,t.length-1]]),e}const{location:n,distance:r,threshold:s,findAllMatches:o,minMatchCharLength:a,ignoreLocation:l}=this.options;let h=[],c=0,u=!1;this.chunks.forEach((({pattern:e,alphabet:d,startIndex:p})=>{const{isMatch:f,score:m,indices:y}=ds(t,e,d,{location:n+p,distance:r,threshold:s,findAllMatches:o,minMatchCharLength:a,includeMatches:i,ignoreLocation:l});f&&(u=!0),c+=m,f&&y&&(h=[...h,...y])}));let d={isMatch:u,score:u?c/this.chunks.length:1};return u&&i&&(d.indices=h),d}}class ms{constructor(t){this.pattern=t}static isMultiMatch(t){return ys(t,this.multiRegex)}static isSingleMatch(t){return ys(t,this.singleRegex)}search(){}}function ys(t,e){const i=t.match(e);return i?i[1]:null}class gs extends ms{constructor(t,{location:e=os.location,threshold:i=os.threshold,distance:n=os.distance,includeMatches:r=os.includeMatches,findAllMatches:s=os.findAllMatches,minMatchCharLength:o=os.minMatchCharLength,isCaseSensitive:a=os.isCaseSensitive,ignoreLocation:l=os.ignoreLocation}={}){super(t),this._bitapSearch=new fs(t,{location:e,threshold:i,distance:n,includeMatches:r,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:a,ignoreLocation:l})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class vs extends ms{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e,i=0;const n=[],r=this.pattern.length;for(;(e=t.indexOf(this.pattern,i))>-1;)i=e+r,n.push([e,i-1]);const s=!!n.length;return{isMatch:s,score:s?0:1,indices:n}}}const bs=[class extends ms{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const e=t===this.pattern;return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}},vs,class extends ms{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const e=t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}},class extends ms{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const e=!t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends ms{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const e=!t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends ms{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const e=t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[t.length-this.pattern.length,t.length-1]}}},class extends ms{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const e=-1===t.indexOf(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},gs],xs=bs.length,_s=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const ws=new Set([gs.type,vs.type]);class Ss{constructor(t,{isCaseSensitive:e=os.isCaseSensitive,includeMatches:i=os.includeMatches,minMatchCharLength:n=os.minMatchCharLength,ignoreLocation:r=os.ignoreLocation,findAllMatches:s=os.findAllMatches,location:o=os.location,threshold:a=os.threshold,distance:l=os.distance}={}){this.query=null,this.options={isCaseSensitive:e,includeMatches:i,minMatchCharLength:n,findAllMatches:s,ignoreLocation:r,location:o,threshold:a,distance:l},this.pattern=e?t:t.toLowerCase(),this.query=function(t,e={}){return t.split("|").map((t=>{let i=t.trim().split(_s).filter((t=>t&&!!t.trim())),n=[];for(let t=0,r=i.length;t<r;t+=1){const r=i[t];let s=!1,o=-1;for(;!s&&++o<xs;){const t=bs[o];let i=t.isMultiMatch(r);i&&(n.push(new t(i,e)),s=!0)}if(!s)for(o=-1;++o<xs;){const t=bs[o];let i=t.isSingleMatch(r);if(i){n.push(new t(i,e));break}}}return n}))}(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:i,isCaseSensitive:n}=this.options;t=n?t:t.toLowerCase();let r=0,s=[],o=0;for(let n=0,a=e.length;n<a;n+=1){const a=e[n];s.length=0,r=0;for(let e=0,n=a.length;e<n;e+=1){const n=a[e],{isMatch:l,indices:h,score:c}=n.search(t);if(!l){o=0,r=0,s.length=0;break}if(r+=1,o+=c,i){const t=n.constructor.type;ws.has(t)?s=[...s,...h]:s.push(h)}}if(r){let t={isMatch:!0,score:o/r};return i&&(t.indices=s),t}}return{isMatch:!1,score:1}}}const Cs=[];function As(t,e){for(let i=0,n=Cs.length;i<n;i+=1){let n=Cs[i];if(n.condition(t,e))return new n(t,e)}return new fs(t,e)}const Es="$and",Ms="$or",Ts="$path",ks="$val",Ps=t=>!(!t[Es]&&!t[Ms]),Is=t=>({[Es]:Object.keys(t).map((e=>({[e]:t[e]})))});function Os(t,e,{auto:i=!0}={}){const n=t=>{let r=Object.keys(t);const s=(t=>!!t[Ts])(t);if(!s&&r.length>1&&!Ps(t))return n(Is(t));if((t=>!Hr(t)&&$r(t)&&!Ps(t))(t)){const n=s?t[Ts]:r[0],o=s?t[ks]:t[n];if(!Vr(o))throw new Error((t=>`Invalid value for key ${t}`)(n));const a={keyId:rs(n),pattern:o};return i&&(a.searcher=As(o,e)),a}let o={children:[],operator:r[0]};return r.forEach((e=>{const i=t[e];Hr(i)&&i.forEach((t=>{o.children.push(n(t))}))})),o};return Ps(t)||(t=Is(t)),n(t)}function Rs(t,e){const i=t.matches;e.matches=[],qr(i)&&i.forEach((t=>{if(!qr(t.indices)||!t.indices.length)return;const{indices:i,value:n}=t;let r={indices:i,value:n};t.key&&(r.key=t.key.src),t.idx>-1&&(r.refIndex=t.idx),e.matches.push(r)}))}function Ls(t,e){e.score=t.score}class js{constructor(t,e={},i){this.options=Ur(Ur({},os),e),this.options.useExtendedSearch,this._keyStore=new es(this.options.keys),this.setCollection(t,i)}setCollection(t,e){if(this._docs=t,e&&!(e instanceof ls))throw new Error("Incorrect 'index' type");this._myIndex=e||hs(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){qr(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const e=[];for(let i=0,n=this._docs.length;i<n;i+=1){const r=this._docs[i];t(r,i)&&(this.removeAt(i),i-=1,n-=1,e.push(r))}return e}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:e=-1}={}){const{includeMatches:i,includeScore:n,shouldSort:r,sortFn:s,ignoreFieldNorm:o}=this.options;let a=Vr(t)?Vr(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return function(t,{ignoreFieldNorm:e=os.ignoreFieldNorm}){t.forEach((t=>{let i=1;t.matches.forEach((({key:t,norm:n,score:r})=>{const s=t?t.weight:null;i*=Math.pow(0===r&&s?Number.EPSILON:r,(s||1)*(e?1:n))})),t.score=i}))}(a,{ignoreFieldNorm:o}),r&&a.sort(s),Xr(e)&&e>-1&&(a=a.slice(0,e)),function(t,e,{includeMatches:i=os.includeMatches,includeScore:n=os.includeScore}={}){const r=[];return i&&r.push(Rs),n&&r.push(Ls),t.map((t=>{const{idx:i}=t,n={item:e[i],refIndex:i};return r.length&&r.forEach((e=>{e(t,n)})),n}))}(a,this._docs,{includeMatches:i,includeScore:n})}_searchStringList(t){const e=As(t,this.options),{records:i}=this._myIndex,n=[];return i.forEach((({v:t,i,n:r})=>{if(!qr(t))return;const{isMatch:s,score:o,indices:a}=e.searchIn(t);s&&n.push({item:t,idx:i,matches:[{score:o,value:t,norm:r,indices:a}]})})),n}_searchLogical(t){const e=Os(t,this.options),i=(t,e,n)=>{if(!t.children){const{keyId:i,searcher:r}=t,s=this._findMatches({key:this._keyStore.get(i),value:this._myIndex.getValueForItemAtKeyId(e,i),searcher:r});return s&&s.length?[{idx:n,item:e,matches:s}]:[]}const r=[];for(let s=0,o=t.children.length;s<o;s+=1){const o=t.children[s],a=i(o,e,n);if(a.length)r.push(...a);else if(t.operator===Es)return[]}return r},n=this._myIndex.records,r={},s=[];return n.forEach((({$:t,i:n})=>{if(qr(t)){let o=i(e,t,n);o.length&&(r[n]||(r[n]={idx:n,item:t,matches:[]},s.push(r[n])),o.forEach((({matches:t})=>{r[n].matches.push(...t)})))}})),s}_searchObjectList(t){const e=As(t,this.options),{keys:i,records:n}=this._myIndex,r=[];return n.forEach((({$:t,i:n})=>{if(!qr(t))return;let s=[];i.forEach(((i,n)=>{s.push(...this._findMatches({key:i,value:t[n],searcher:e}))})),s.length&&r.push({idx:n,item:t,matches:s})})),r}_findMatches({key:t,value:e,searcher:i}){if(!qr(e))return[];let n=[];if(Hr(e))e.forEach((({v:e,i:r,n:s})=>{if(!qr(e))return;const{isMatch:o,score:a,indices:l}=i.searchIn(e);o&&n.push({score:a,key:t,value:e,idx:r,norm:s,indices:l})}));else{const{v:r,n:s}=e,{isMatch:o,score:a,indices:l}=i.searchIn(r);o&&n.push({score:a,key:t,value:r,norm:s,indices:l})}return n}}js.version="7.0.0",js.createIndex=hs,js.parseIndex=function(t,{getFn:e=os.getFn,fieldNormWeight:i=os.fieldNormWeight}={}){const{keys:n,records:r}=t,s=new ls({getFn:e,fieldNormWeight:i});return s.setKeys(n),s.setIndexRecords(r),s},js.config=os,js.parseQuery=Os,function(...t){Cs.push(...t)}(Ss);var Ds=function(){function t(t){this._haystack=[],this._fuseOptions=vn(vn({},t.fuseOptions),{keys:bn([],t.searchFields,!0),includeMatches:!0})}return t.prototype.index=function(t){this._haystack=t,this._fuse&&this._fuse.setCollection(t)},t.prototype.reset=function(){this._haystack=[],this._fuse=void 0},t.prototype.isEmptyIndex=function(){return!this._haystack.length},t.prototype.search=function(t){return this._fuse||(this._fuse=new js(this._haystack,this._fuseOptions)),this._fuse.search(t).map((function(t,e){return{item:t.item,score:t.score||0,rank:e+1}}))},t}();var Fs=function(t,e,i){var n=t.dataset,r=e.customProperties,s=e.labelClass,o=e.labelDescription;s&&(n.labelClass=gr(s).join(" ")),o&&(n.labelDescription=cr(o)),i&&r&&("string"==typeof r?n.customProperties=r:"object"!=typeof r||function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(r)||(n.customProperties=JSON.stringify(r)))},Ns=function(t,e,i){var n=e&&t.querySelector("label[for='".concat(e,"']")),r=n&&n.innerText;r&&i.setAttribute("aria-label",r)},Bs={containerOuter:function(t,e,i,n,r,s,o){var a=t.classNames.containerOuter,l=document.createElement("div");return br(l,a),l.dataset.type=s,e&&(l.dir=e),n&&(l.tabIndex=0),i&&(l.setAttribute("role",r?"combobox":"listbox"),r?l.setAttribute("aria-autocomplete","list"):o||Ns(this._docRoot,this.passedElement.element.id,l),l.setAttribute("aria-haspopup","true"),l.setAttribute("aria-expanded","false")),o&&l.setAttribute("aria-labelledby",o),l},containerInner:function(t){var e=t.classNames.containerInner,i=document.createElement("div");return br(i,e),i},itemList:function(t,e){var i=t.searchEnabled,n=t.classNames,r=n.list,s=n.listSingle,o=n.listItems,a=document.createElement("div");return br(a,r),br(a,e?s:o),this._isSelectElement&&i&&a.setAttribute("role","listbox"),a},placeholder:function(t,e){var i=t.allowHTML,n=t.classNames.placeholder,r=document.createElement("div");return br(r,n),mr(r,i,e),r},item:function(t,e,i){var n=t.allowHTML,r=t.removeItemButtonAlignLeft,s=t.removeItemIconText,o=t.removeItemLabelText,a=t.classNames,l=a.item,h=a.button,c=a.highlightedState,u=a.itemSelectable,d=a.placeholder,p=cr(e.value),f=document.createElement("div");if(br(f,l),e.labelClass){var m=document.createElement("span");mr(m,n,e.label),br(m,e.labelClass),f.appendChild(m)}else mr(f,n,e.label);if(f.dataset.item="",f.dataset.id=e.id,f.dataset.value=p,Fs(f,e,!0),(e.disabled||this.containerOuter.isDisabled)&&f.setAttribute("aria-disabled","true"),this._isSelectElement&&(f.setAttribute("aria-selected","true"),f.setAttribute("role","option")),e.placeholder&&(br(f,d),f.dataset.placeholder=""),br(f,e.highlighted?c:u),i){e.disabled&&xr(f,u),f.dataset.deletable="";var y=document.createElement("button");y.type="button",br(y,h);var g=dr(e);mr(y,!0,pr(s,e.value,g));var v=pr(o,e.value,g);v&&y.setAttribute("aria-label",v),y.dataset.button="",r?f.insertAdjacentElement("afterbegin",y):f.appendChild(y)}return f},choiceList:function(t,e){var i=t.classNames.list,n=document.createElement("div");return br(n,i),e||n.setAttribute("aria-multiselectable","true"),n.setAttribute("role","listbox"),n},choiceGroup:function(t,e){var i=t.allowHTML,n=t.classNames,r=n.group,s=n.groupHeading,o=n.itemDisabled,a=e.id,l=e.label,h=e.disabled,c=cr(l),u=document.createElement("div");br(u,r),h&&br(u,o),u.setAttribute("role","group"),u.dataset.group="",u.dataset.id=a,u.dataset.value=c,h&&u.setAttribute("aria-disabled","true");var d=document.createElement("div");return br(d,s),mr(d,i,l||""),u.appendChild(d),u},choice:function(t,e,i,n){var r=t.allowHTML,s=t.classNames,o=s.item,a=s.itemChoice,l=s.itemSelectable,h=s.selectedState,c=s.itemDisabled,u=s.description,d=s.placeholder,p=e.label,f=cr(e.value),m=document.createElement("div");m.id=e.elementId,br(m,o),br(m,a),n&&"string"==typeof p&&(p=fr(r,p),p={trusted:p+=" (".concat(n,")")});var y=m;if(e.labelClass){var g=document.createElement("span");mr(g,r,p),br(g,e.labelClass),y=g,m.appendChild(g)}else mr(m,r,p);if(e.labelDescription){var v="".concat(e.elementId,"-description");y.setAttribute("aria-describedby",v);var b=document.createElement("span");mr(b,r,e.labelDescription),b.id=v,br(b,u),m.appendChild(b)}return e.selected&&br(m,h),e.placeholder&&br(m,d),m.setAttribute("role",e.group?"treeitem":"option"),m.dataset.choice="",m.dataset.id=e.id,m.dataset.value=f,i&&(m.dataset.selectText=i),e.group&&(m.dataset.groupId="".concat(e.group.id)),Fs(m,e,!1),e.disabled?(br(m,c),m.dataset.choiceDisabled="",m.setAttribute("aria-disabled","true")):(br(m,l),m.dataset.choiceSelectable="",m.setAttribute("aria-selected",e.selected?"true":"false")),m},input:function(t,e){var i=t.classNames,n=i.input,r=i.inputCloned,s=t.labelId,o=document.createElement("input");return o.type="search",br(o,n),br(o,r),o.autocomplete="off",o.autocapitalize="off",o.spellcheck=!1,o.setAttribute("aria-autocomplete","list"),e?o.setAttribute("aria-label",e):s||Ns(this._docRoot,this.passedElement.element.id,o),o},dropdown:function(t){var e=t.classNames,i=e.list,n=e.listDropdown,r=document.createElement("div");return br(r,i),br(r,n),r.setAttribute("aria-expanded","false"),r},notice:function(t,e,i){var n=t.classNames,r=n.item,s=n.itemChoice,o=n.addChoice,a=n.noResults,l=n.noChoices,h=n.notice;void 0===i&&(i=Gr);var c=document.createElement("div");switch(mr(c,!0,e),br(c,r),br(c,s),br(c,h),i){case Br:br(c,o);break;case Nr:br(c,a);break;case Fr:br(c,l)}return i===Br&&(c.dataset.choiceSelectable="",c.dataset.choice=""),c},option:function(t){var e=cr(t.label),i=new Option(e,t.value,!1,t.selected);return Fs(i,t,!0),i.disabled=t.disabled,t.selected&&i.setAttribute("selected",""),i}},Gs="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,zs={},Ws=function(t){if(t)return t.dataset.id?parseInt(t.dataset.id,10):void 0},Us="[data-choice-selectable]",Hs=function(){function t(e,i){void 0===e&&(e="[data-choice]"),void 0===i&&(i={});var n=this;this.initialisedOK=void 0,this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0;var r=t.defaults;this.config=vn(vn(vn({},r.allOptions),r.options),i),Zn.forEach((function(t){n.config[t]=vn(vn(vn({},r.allOptions[t]),r.options[t]),i[t])}));var s=this.config;s.silent||this._validateConfig();var o=s.shadowRoot||document.documentElement;this._docRoot=o;var a="string"==typeof e?o.querySelector(e):e;if(!a||"object"!=typeof a||"INPUT"!==a.tagName&&!Ir(a)){if(!a&&"string"==typeof e)throw TypeError("Selector ".concat(e," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}var l=a.type,h=l===Qn;(h||1!==s.maxItemCount)&&(s.singleModeForMultiSelect=!1),s.singleModeForMultiSelect&&(l=tr);var c=l===Jn,u=l===tr,d=c||u;if(this._elementType=l,this._isTextElement=h,this._isSelectOneElement=c,this._isSelectMultipleElement=u,this._isSelectElement=c||u,this._canAddUserChoices=h&&s.addItems||d&&s.addChoices,"boolean"!=typeof s.renderSelectedChoices&&(s.renderSelectedChoices="always"===s.renderSelectedChoices||c),"auto"===s.closeDropdownOnSelect?s.closeDropdownOnSelect=h||c||s.singleModeForMultiSelect:s.closeDropdownOnSelect=Tr(s.closeDropdownOnSelect),s.placeholder&&(s.placeholderValue?this._hasNonChoicePlaceholder=!0:a.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,s.placeholderValue=a.dataset.placeholder)),i.addItemFilter&&"function"!=typeof i.addItemFilter){var p=i.addItemFilter instanceof RegExp?i.addItemFilter:new RegExp(i.addItemFilter);s.addItemFilter=p.test.bind(p)}if(this._isTextElement)this.passedElement=new Mr({element:a,classNames:s.classNames});else{var f=a;this.passedElement=new Or({element:f,classNames:s.classNames,template:function(t){return n._templates.option(t)},extractPlaceholder:s.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new Dr(s),this._currentValue="",s.searchEnabled=!h&&s.searchEnabled,this._canSearch=s.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(t,e){var i=t.id||t.name&&"".concat(t.name,"-").concat(sr(2))||sr(4);return i=i.replace(/(:|\.|\[|\]|,)/g,""),"".concat(e,"-").concat(i)}(a,"choices-"),this._direction=a.dir,!this._direction){var m=window.getComputedStyle(a).direction;m!==window.getComputedStyle(document.documentElement).direction&&(this._direction=m)}if(this._idNames={itemChoice:"item-choice"},this._templates=r.templates,this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.bind(this),this._onClick=this._onClick.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseOver=this._onMouseOver.bind(this),this._onFormReset=this._onFormReset.bind(this),this._onSelectKey=this._onSelectKey.bind(this),this._onEnterKey=this._onEnterKey.bind(this),this._onEscapeKey=this._onEscapeKey.bind(this),this._onDirectionKey=this._onDirectionKey.bind(this),this._onDeleteKey=this._onDeleteKey.bind(this),this._onChange=this._onChange.bind(this),this._onInvalid=this._onInvalid.bind(this),this.passedElement.isActive)return s.silent||console.warn("Trying to initialise Choices on element already initialised",{element:e}),this.initialised=!0,void(this.initialisedOK=!1);this.init(),this._initialItems=this._store.items.map((function(t){return t.value}))}return Object.defineProperty(t,"defaults",{get:function(){return Object.preventExtensions({get options(){return zs},get allOptions(){return Rr},get templates(){return Bs}})},enumerable:!1,configurable:!0}),t.prototype.init=function(){if(!this.initialised&&void 0===this.initialisedOK){var t;this._searcher=(t=this.config,new Ds(t)),this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),this._isTextElement&&!this.config.addItems||this.passedElement.element.hasAttribute("disabled")||this.passedElement.element.closest("fieldset:disabled")?this.disable():(this.enable(),this._addEventListeners()),this._initStore(),this.initialised=!0,this.initialisedOK=!0;var e=this.config.callbackOnInit;"function"==typeof e&&e.call(this)}},t.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this._store._listeners=[],this.clearStore(!1),this._stopSearch(),this._templates=t.defaults.templates,this.initialised=!1,this.initialisedOK=void 0)},t.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},t.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},t.prototype.highlightItem=function(t,e){if(void 0===e&&(e=!0),!t||!t.id)return this;var i=this._store.items.find((function(e){return e.id===t.id}));return!i||i.highlighted||(this._store.dispatch(rr(i,!0)),e&&this.passedElement.triggerEvent(Fn,dr(i))),this},t.prototype.unhighlightItem=function(t,e){if(void 0===e&&(e=!0),!t||!t.id)return this;var i=this._store.items.find((function(e){return e.id===t.id}));return i&&i.highlighted?(this._store.dispatch(rr(i,!1)),e&&this.passedElement.triggerEvent(Bn,dr(i)),this):this},t.prototype.highlightAll=function(){var t=this;return this._store.withTxn((function(){t._store.items.forEach((function(e){e.highlighted||(t._store.dispatch(rr(e,!0)),t.passedElement.triggerEvent(Fn,dr(e)))}))})),this},t.prototype.unhighlightAll=function(){var t=this;return this._store.withTxn((function(){t._store.items.forEach((function(e){e.highlighted&&(t._store.dispatch(rr(e,!1)),t.passedElement.triggerEvent(Fn,dr(e)))}))})),this},t.prototype.removeActiveItemsByValue=function(t){var e=this;return this._store.withTxn((function(){e._store.items.filter((function(e){return e.value===t})).forEach((function(t){return e._removeItem(t)}))})),this},t.prototype.removeActiveItems=function(t){var e=this;return this._store.withTxn((function(){e._store.items.filter((function(e){return e.id!==t})).forEach((function(t){return e._removeItem(t)}))})),this},t.prototype.removeHighlightedItems=function(t){var e=this;return void 0===t&&(t=!1),this._store.withTxn((function(){e._store.highlightedActiveItems.forEach((function(i){e._removeItem(i),t&&e._triggerChange(i.value)}))})),this},t.prototype.showDropdown=function(t){var e=this;return this.dropdown.isActive||(void 0===t&&(t=!this._canSearch),requestAnimationFrame((function(){e.dropdown.show();var i=e.dropdown.element.getBoundingClientRect();e.containerOuter.open(i.bottom,i.height),t||e.input.focus(),e.passedElement.triggerEvent(Pn);var n=e.choiceList.element.querySelector(vr(e.config.classNames.selectedState));null===n||or(n,e.choiceList.element)||n.scrollIntoView()}))),this},t.prototype.hideDropdown=function(t){var e=this;return this.dropdown.isActive?(this._removeHighlightedChoices(),requestAnimationFrame((function(){e.dropdown.hide(),e.containerOuter.close(),!t&&e._canSearch&&(e.input.removeActiveDescendant(),e.input.blur()),e.passedElement.triggerEvent(In)})),this):this},t.prototype.getValue=function(t){var e=this._store.items.map((function(e){return t?e.value:dr(e)}));return this._isSelectOneElement||this.config.singleModeForMultiSelect?e[0]:e},t.prototype.setValue=function(t){var e=this;return this.initialisedOK?(this._store.withTxn((function(){t.forEach((function(t){t&&e._addChoice(Pr(t,!1))}))})),this._searcher.reset(),this):(this._warnChoicesInitFailed("setValue"),this)},t.prototype.setChoiceByValue=function(t){var e=this;return this.initialisedOK?(this._isTextElement||(this._store.withTxn((function(){(Array.isArray(t)?t:[t]).forEach((function(t){return e._findAndSelectChoiceByValue(t)})),e.unhighlightAll()})),this._searcher.reset()),this):(this._warnChoicesInitFailed("setChoiceByValue"),this)},t.prototype.setChoices=function(t,e,i,n,r,s){var o=this;if(void 0===t&&(t=[]),void 0===e&&(e="value"),void 0===i&&(i="label"),void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===s&&(s=!1),!this.initialisedOK)return this._warnChoicesInitFailed("setChoices"),this;if(!this._isSelectElement)throw new TypeError("setChoices can't be used with INPUT based Choices");if("string"!=typeof e||!e)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if("function"==typeof t){var a=t(this);if("function"==typeof Promise&&a instanceof Promise)return new Promise((function(t){return requestAnimationFrame(t)})).then((function(){return o._handleLoadingState(!0)})).then((function(){return a})).then((function(t){return o.setChoices(t,e,i,n,r,s)})).catch((function(t){o.config.silent||console.error(t)})).then((function(){return o._handleLoadingState(!1)})).then((function(){return o}));if(!Array.isArray(a))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof a));return this.setChoices(a,e,i,!1)}if(!Array.isArray(t))throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices");return this.containerOuter.removeLoadingState(),this._store.withTxn((function(){r&&(o._isSearching=!1),n&&o.clearChoices(!0,s);var a="value"===e,l="label"===i;t.forEach((function(t){if("choices"in t){var n=t;l||(n=vn(vn({},n),{label:n[i]})),o._addGroup(Pr(n,!0))}else{var r=t;l&&a||(r=vn(vn({},r),{value:r[e],label:r[i]}));var s=Pr(r,!1);o._addChoice(s),s.placeholder&&!o._hasNonChoicePlaceholder&&(o._placeholderValue=ur(s.label))}})),o.unhighlightAll()})),this._searcher.reset(),this},t.prototype.refresh=function(t,e,i){var n=this;return void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=!1),this._isSelectElement?(this._store.withTxn((function(){var r=n.passedElement.optionsAsChoices(),s={};i||n._store.items.forEach((function(t){t.id&&t.active&&t.selected&&(s[t.value]=!0)})),n.clearStore(!1);var o=function(t){i?n._store.dispatch(nr(t)):s[t.value]&&(t.selected=!0)};r.forEach((function(t){"choices"in t?t.choices.forEach(o):o(t)})),n._addPredefinedChoices(r,e,t),n._isSearching&&n._searchChoices(n.input.value)})),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a <select> element"),this)},t.prototype.removeChoice=function(t){var e=this._store.choices.find((function(e){return e.value===t}));return e?(this._clearNotice(),this._store.dispatch(function(t){return{type:wn,choice:t}}(e)),this._searcher.reset(),e.selected&&this.passedElement.triggerEvent(Dn,dr(e)),this):this},t.prototype.clearChoices=function(t,e){var i=this;return void 0===t&&(t=!0),void 0===e&&(e=!1),t&&(e?this.passedElement.element.replaceChildren(""):this.passedElement.element.querySelectorAll(":not([selected])").forEach((function(t){t.remove()}))),this.itemList.element.replaceChildren(""),this.choiceList.element.replaceChildren(""),this._clearNotice(),this._store.withTxn((function(){var t=e?[]:i._store.items;i._store.reset(),t.forEach((function(t){i._store.dispatch(er(t)),i._store.dispatch(ir(t))}))})),this._searcher.reset(),this},t.prototype.clearStore=function(t){return void 0===t&&(t=!0),this.clearChoices(t,!0),this._stopSearch(),this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this},t.prototype.clearInput=function(){var t=!this._isSelectOneElement;return this.input.clear(t),this._stopSearch(),this},t.prototype._validateConfig=function(){var t,e,i,n,r=this.config,s=(t=r,e=Rr,i=Object.keys(t).sort(),n=Object.keys(e).sort(),i.filter((function(t){return n.indexOf(t)<0})));s.length&&console.warn("Unknown config option(s) passed",s.join(", ")),r.allowHTML&&r.allowHtmlUserInput&&(r.addItems&&console.warn("Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks"),r.addChoices&&console.warn("Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks"))},t.prototype._render=function(t){void 0===t&&(t={choices:!0,groups:!0,items:!0}),this._store.inTxn()||(this._isSelectElement&&(t.choices||t.groups)&&this._renderChoices(),t.items&&this._renderItems())},t.prototype._renderChoices=function(){var t=this;if(this._canAddItems()){var e=this.config,i=this._isSearching,n=this._store,r=n.activeGroups,s=n.activeChoices,o=i?e.searchResultLimit:e.renderChoiceLimit;if(this._isSelectElement){var a=s.filter((function(t){return!t.element}));a.length&&this.passedElement.addOptions(a)}var l=document.createDocumentFragment(),h=function(t){return t.filter((function(t){return!t.placeholder&&(i?(e.searchRenderSelectedChoices||!t.selected)&&!!t.rank:e.renderSelectedChoices||!t.selected)}))},c=e.appendGroupInSearch&&i,u=!1,d=null,p=function(n,r){i?n.sort(yr):e.shouldSort&&n.sort(e.sorter);var s=n.length;s=!r&&o>0&&s>o?o:s,s--,n.every((function(n,r){var o=n.choiceEl||t._templates.choice(e,n,e.itemSelectText,c&&n.group?n.group.label:void 0);return n.choiceEl=o,l.appendChild(o),i||!n.selected?u=!0:d||(d=o),r<s}))};s.length&&(e.resetScrollPosition&&requestAnimationFrame((function(){return t.choiceList.scrollToTop()})),this._hasNonChoicePlaceholder||i||!this._isSelectOneElement||p(s.filter((function(t){return t.placeholder&&!t.group})),!1),r.length&&!i?(e.shouldSort&&r.sort(e.sorter),p(s.filter((function(t){return!t.placeholder&&!t.group})),!1),r.forEach((function(e){var i=h(e.choices);if(i.length){if(e.label){var n=e.groupEl||t._templates.choiceGroup(t.config,e);e.groupEl=n,n.remove(),l.appendChild(n)}p(i,!0)}}))):p(h(s),!1)),u||!i&&l.children.length&&e.renderSelectedChoices||(this._notice||(this._notice={text:hr(i?e.noResultsText:e.noChoicesText),type:i?Nr:Fr}),l.replaceChildren("")),this._renderNotice(l),this.choiceList.element.replaceChildren(l),this._highlightChoice(d)}},t.prototype._renderItems=function(){var t=this,e=this._store.items||[],i=this.itemList.element,n=this.config,r=document.createDocumentFragment(),s=function(t){return i.querySelector('[data-item][data-id="'.concat(t.id,'"]'))},o=function(e){var i=e.itemEl;i&&i.parentElement||(i=s(e)||t._templates.item(n,e,n.removeItemButton),e.itemEl=i,r.appendChild(i))};e.forEach(o);var a=!!r.childNodes.length;if(this._isSelectOneElement){var l=i.children.length;if(a||l>1){var h=i.querySelector(vr(n.classNames.placeholder));h&&h.remove()}else a||l||!this._placeholderValue||(a=!0,o(Pr({selected:!0,value:"",label:this._placeholderValue,placeholder:!0},!1)))}a&&(i.append(r),n.shouldSortItems&&!this._isSelectOneElement&&(e.sort(n.sorter),e.forEach((function(t){var e=s(t);e&&(e.remove(),r.append(e))})),i.append(r))),this._isTextElement&&(this.passedElement.value=e.map((function(t){return t.value})).join(n.delimiter))},t.prototype._displayNotice=function(t,e,i){void 0===i&&(i=!0);var n=this._notice;n&&(n.type===e&&n.text===t||n.type===Br&&(e===Nr||e===Fr))?i&&this.showDropdown(!0):(this._clearNotice(),this._notice=t?{text:t,type:e}:void 0,this._renderNotice(),i&&t&&this.showDropdown(!0))},t.prototype._clearNotice=function(){if(this._notice){var t=this.choiceList.element.querySelector(vr(this.config.classNames.notice));t&&t.remove(),this._notice=void 0}},t.prototype._renderNotice=function(t){var e=this._notice;if(e){var i=this._templates.notice(this.config,e.text,e.type);t?t.append(i):this.choiceList.prepend(i)}},t.prototype._getChoiceForOutput=function(t,e){return dr(t,e)},t.prototype._triggerChange=function(t){null!=t&&this.passedElement.triggerEvent(On,{value:t})},t.prototype._handleButtonAction=function(t){var e=this,i=this._store.items;if(i.length&&this.config.removeItems&&this.config.removeItemButton){var n=t&&Ws(t.closest("[data-id]")),r=n&&i.find((function(t){return t.id===n}));r&&this._store.withTxn((function(){if(e._removeItem(r),e._triggerChange(r.value),e._isSelectOneElement&&!e._hasNonChoicePlaceholder){var t=(e.config.shouldSort?e._store.choices.reverse():e._store.choices).find((function(t){return t.placeholder}));t&&(e._addItem(t),e.unhighlightAll(),t.value&&e._triggerChange(t.value))}}))}},t.prototype._handleItemAction=function(t,e){var i=this;void 0===e&&(e=!1);var n=this._store.items;if(n.length&&this.config.removeItems&&!this._isSelectOneElement){var r=Ws(t);r&&(n.forEach((function(t){t.id!==r||t.highlighted?!e&&t.highlighted&&i.unhighlightItem(t):i.highlightItem(t)})),this.input.focus())}},t.prototype._handleChoiceAction=function(t){var e=this,i=Ws(t),n=i&&this._store.getChoiceById(i);if(!n||n.disabled)return!1;var r=this.dropdown.isActive;if(!n.selected){if(!this._canAddItems())return!0;this._store.withTxn((function(){e._addItem(n,!0,!0),e.clearInput(),e.unhighlightAll()})),this._triggerChange(n.value)}return r&&this.config.closeDropdownOnSelect&&(this.hideDropdown(!0),this.containerOuter.element.focus()),!0},t.prototype._handleBackspace=function(t){var e=this.config;if(e.removeItems&&t.length){var i=t[t.length-1],n=t.some((function(t){return t.highlighted}));e.editItems&&!n&&i?(this.input.value=i.value,this.input.setWidth(),this._removeItem(i),this._triggerChange(i.value)):(n||this.highlightItem(i,!1),this.removeHighlightedItems(!0))}},t.prototype._loadChoices=function(){var t,e=this,i=this.config;if(this._isTextElement){if(this._presetChoices=i.items.map((function(t){return Pr(t,!1)})),this.passedElement.value){var n=this.passedElement.value.split(i.delimiter).map((function(t){return Pr(t,!1,e.config.allowHtmlUserInput)}));this._presetChoices=this._presetChoices.concat(n)}this._presetChoices.forEach((function(t){t.selected=!0}))}else if(this._isSelectElement){this._presetChoices=i.choices.map((function(t){return Pr(t,!0)}));var r=this.passedElement.optionsAsChoices();r&&(t=this._presetChoices).push.apply(t,r)}},t.prototype._handleLoadingState=function(t){void 0===t&&(t=!0);var e=this.itemList.element;t?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?e.replaceChildren(this._templates.placeholder(this.config,this.config.loadingText)):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?(e.replaceChildren(""),this._render()):this.input.placeholder=this._placeholderValue||"")},t.prototype._handleSearch=function(t){if(this.input.isFocussed)if(null!=t&&t.length>=this.config.searchFloor){var e=this.config.searchChoices?this._searchChoices(t):0;null!==e&&this.passedElement.triggerEvent(Ln,{value:t,resultCount:e})}else this._store.choices.some((function(t){return!t.active}))&&this._stopSearch()},t.prototype._canAddItems=function(){var t=this.config,e=t.maxItemCount,i=t.maxItemText;return!t.singleModeForMultiSelect&&e>0&&e<=this._store.items.length?(this.choiceList.element.replaceChildren(""),this._notice=void 0,this._displayNotice("function"==typeof i?i(e):i,Br),!1):(this._notice&&this._notice.type===Br&&this._clearNotice(),!0)},t.prototype._canCreateItem=function(t){var e=this.config,i=!0,n="";if((i&&"function"==typeof e.addItemFilter&&!e.addItemFilter(t)&&(i=!1,n=pr(e.customAddItemText,t,void 0)),i)&&this._store.choices.find((function(i){return e.valueComparer(i.value,t)}))){if(this._isSelectElement)return this._displayNotice("",Br),!1;e.duplicateItemsAllowed||(i=!1,n=pr(e.uniqueItemText,t,void 0))}return i&&(n=pr(e.addItemText,t,void 0)),n&&this._displayNotice(n,Br),i},t.prototype._searchChoices=function(t){var e=t.trim().replace(/\s{2,}/," ");if(!e.length||e===this._currentValue)return null;var i=this._searcher;i.isEmptyIndex()&&i.index(this._store.searchableChoices);var n=i.search(e);this._currentValue=e,this._highlightPosition=0,this._isSearching=!0;var r=this._notice;return(r&&r.type)!==Br&&(n.length?this._clearNotice():this._displayNotice(hr(this.config.noResultsText),Nr)),this._store.dispatch(function(t){return{type:Sn,results:t}}(n)),n.length},t.prototype._stopSearch=function(){this._isSearching&&(this._currentValue="",this._isSearching=!1,this._clearNotice(),this._store.dispatch({type:Cn,active:!0}),this.passedElement.triggerEvent(Ln,{value:"",resultCount:0}))},t.prototype._addEventListeners=function(){var t=this._docRoot,e=this.containerOuter.element,i=this.input.element,n=this.passedElement.element;t.addEventListener("touchend",this._onTouchEnd,!0),e.addEventListener("keydown",this._onKeyDown,!0),e.addEventListener("mousedown",this._onMouseDown,!0),t.addEventListener("click",this._onClick,{passive:!0}),t.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(e.addEventListener("focus",this._onFocus,{passive:!0}),e.addEventListener("blur",this._onBlur,{passive:!0})),i.addEventListener("keyup",this._onKeyUp,{passive:!0}),i.addEventListener("input",this._onInput,{passive:!0}),i.addEventListener("focus",this._onFocus,{passive:!0}),i.addEventListener("blur",this._onBlur,{passive:!0}),i.form&&i.form.addEventListener("reset",this._onFormReset,{passive:!0}),n.hasAttribute("required")&&(n.addEventListener("change",this._onChange,{passive:!0}),n.addEventListener("invalid",this._onInvalid,{passive:!0})),this.input.addEventListeners()},t.prototype._removeEventListeners=function(){var t=this._docRoot,e=this.containerOuter.element,i=this.input.element,n=this.passedElement.element;t.removeEventListener("touchend",this._onTouchEnd,!0),e.removeEventListener("keydown",this._onKeyDown,!0),e.removeEventListener("mousedown",this._onMouseDown,!0),t.removeEventListener("click",this._onClick),t.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(e.removeEventListener("focus",this._onFocus),e.removeEventListener("blur",this._onBlur)),i.removeEventListener("keyup",this._onKeyUp),i.removeEventListener("input",this._onInput),i.removeEventListener("focus",this._onFocus),i.removeEventListener("blur",this._onBlur),i.form&&i.form.removeEventListener("reset",this._onFormReset),n.hasAttribute("required")&&(n.removeEventListener("change",this._onChange),n.removeEventListener("invalid",this._onInvalid)),this.input.removeEventListeners()},t.prototype._onKeyDown=function(t){var e=t.keyCode,i=this.dropdown.isActive,n=1===t.key.length||2===t.key.length&&t.key.charCodeAt(0)>=55296||"Unidentified"===t.key;switch(this._isTextElement||i||e===Xn||e===Gn||e===zn||(this.showDropdown(),!this.input.isFocussed&&n&&(this.input.value+=t.key," "===t.key&&t.preventDefault())),e){case Vn:return this._onSelectKey(t,this.itemList.element.hasChildNodes());case Hn:return this._onEnterKey(t,i);case Xn:return this._onEscapeKey(t,i);case Yn:case qn:case $n:case Kn:return this._onDirectionKey(t,i);case Un:case Wn:return this._onDeleteKey(t,this._store.items,this.input.isFocussed)}},t.prototype._onKeyUp=function(){this._canSearch=this.config.searchEnabled},t.prototype._onInput=function(){var t=this.input.value;t?this._canAddItems()&&(this._canSearch&&this._handleSearch(t),this._canAddUserChoices&&(this._canCreateItem(t),this._isSelectElement&&(this._highlightPosition=0,this._highlightChoice()))):this._isTextElement?this.hideDropdown(!0):this._stopSearch()},t.prototype._onSelectKey=function(t,e){(t.ctrlKey||t.metaKey)&&e&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},t.prototype._onEnterKey=function(t,e){var i=this,n=this.input.value,r=t.target;if(t.preventDefault(),r&&r.hasAttribute("data-button"))this._handleButtonAction(r);else if(e){var s=this.dropdown.element.querySelector(vr(this.config.classNames.highlightedState));if(!s||!this._handleChoiceAction(s))if(r&&n){if(this._canAddItems()){var o=!1;this._store.withTxn((function(){if(!(o=i._findAndSelectChoiceByValue(n,!0))){if(!i._canAddUserChoices)return;if(!i._canCreateItem(n))return;i._addChoice(Pr(n,!1,i.config.allowHtmlUserInput),!0,!0),o=!0}i.clearInput(),i.unhighlightAll()})),o&&(this._triggerChange(n),this.config.closeDropdownOnSelect&&this.hideDropdown(!0))}}else this.hideDropdown(!0)}else(this._isSelectElement||this._notice)&&this.showDropdown()},t.prototype._onEscapeKey=function(t,e){e&&(t.stopPropagation(),this.hideDropdown(!0),this._stopSearch(),this.containerOuter.element.focus())},t.prototype._onDirectionKey=function(t,e){var i=t.keyCode;if(e||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var n=i===$n||i===Kn?1:-1,r=void 0;if(t.metaKey||i===Kn||i===qn)r=n>0?this.dropdown.element.querySelector("".concat(Us,":last-of-type")):this.dropdown.element.querySelector(Us);else{var s=this.dropdown.element.querySelector(vr(this.config.classNames.highlightedState));r=s?function(t,e,i){void 0===i&&(i=1);for(var n="".concat(i>0?"next":"previous","ElementSibling"),r=t[n];r;){if(r.matches(e))return r;r=r[n]}return null}(s,Us,n):this.dropdown.element.querySelector(Us)}r&&(or(r,this.choiceList.element,n)||this.choiceList.scrollToChildElement(r,n),this._highlightChoice(r)),t.preventDefault()}},t.prototype._onDeleteKey=function(t,e,i){this._isSelectOneElement||t.target.value||!i||(this._handleBackspace(e),t.preventDefault())},t.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},t.prototype._onTouchEnd=function(t){var e=(t||t.touches[0]).target;this._wasTap&&this.containerOuter.element.contains(e)&&((e===this.containerOuter.element||e===this.containerInner.element)&&(this._isTextElement?this.input.focus():this._isSelectMultipleElement&&this.showDropdown()),t.stopPropagation());this._wasTap=!0},t.prototype._onMouseDown=function(t){var e=t.target;if(e instanceof Element){if(Gs&&this.choiceList.element.contains(e)){var i=this.choiceList.element.firstElementChild;this._isScrollingOnIe="ltr"===this._direction?t.offsetX>=i.offsetWidth:t.offsetX<i.offsetLeft}if(e!==this.input.element){var n=e.closest("[data-button],[data-item],[data-choice]");n instanceof HTMLElement&&("button"in n.dataset?this._handleButtonAction(n):"item"in n.dataset?this._handleItemAction(n,t.shiftKey):"choice"in n.dataset&&this._handleChoiceAction(n)),t.preventDefault()}}},t.prototype._onMouseOver=function(t){var e=t.target;e instanceof HTMLElement&&"choice"in e.dataset&&this._highlightChoice(e)},t.prototype._onClick=function(t){var e=t.target,i=this.containerOuter;i.element.contains(e)?this.dropdown.isActive||i.isDisabled?this._isSelectOneElement&&e!==this.input.element&&!this.dropdown.element.contains(e)&&this.hideDropdown():this._isTextElement?document.activeElement!==this.input.element&&this.input.focus():(this.showDropdown(),i.element.focus()):(i.removeFocusState(),this.hideDropdown(!0),this.unhighlightAll())},t.prototype._onFocus=function(t){var e=t.target,i=this.containerOuter;if(e&&i.element.contains(e)){var n=e===this.input.element;this._isTextElement?n&&i.addFocusState():this._isSelectMultipleElement?n&&(this.showDropdown(!0),i.addFocusState()):(i.addFocusState(),n&&this.showDropdown(!0))}},t.prototype._onBlur=function(t){var e=t.target,i=this.containerOuter;e&&i.element.contains(e)&&!this._isScrollingOnIe?e===this.input.element?(i.removeFocusState(),this.hideDropdown(!0),(this._isTextElement||this._isSelectMultipleElement)&&this.unhighlightAll()):e===this.containerOuter.element&&(i.removeFocusState(),this.config.searchEnabled||this.hideDropdown(!0)):(this._isScrollingOnIe=!1,this.input.element.focus())},t.prototype._onFormReset=function(){var t=this;this._store.withTxn((function(){t.clearInput(),t.hideDropdown(),t.refresh(!1,!1,!0),t._initialItems.length&&t.setChoiceByValue(t._initialItems)}))},t.prototype._onChange=function(t){t.target.checkValidity()&&this.containerOuter.removeInvalidState()},t.prototype._onInvalid=function(){this.containerOuter.addInvalidState()},t.prototype._removeHighlightedChoices=function(){var t=this.config.classNames.highlightedState;Array.from(this.dropdown.element.querySelectorAll(vr(t))).forEach((function(e){xr(e,t),e.setAttribute("aria-selected","false")}))},t.prototype._highlightChoice=function(t){void 0===t&&(t=null);var e=Array.from(this.dropdown.element.querySelectorAll(Us));if(e.length){var i=t,n=this.config.classNames.highlightedState;this._removeHighlightedChoices(),i?this._highlightPosition=e.indexOf(i):(i=e.length>this._highlightPosition?e[this._highlightPosition]:e[e.length-1])||(i=e[0]),br(i,n),i.setAttribute("aria-selected","true"),this.passedElement.triggerEvent(Nn,{el:i}),this.dropdown.isActive&&(this.input.setActiveDescendant(i.id),this.containerOuter.setActiveDescendant(i.id))}},t.prototype._addItem=function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),!t.id)throw new TypeError("item.id must be set before _addItem is called for a choice/item");if((this.config.singleModeForMultiSelect||this._isSelectOneElement)&&this.removeActiveItems(t.id),this._store.dispatch(ir(t)),e){var n=dr(t);this.passedElement.triggerEvent(jn,n),i&&this.passedElement.triggerEvent(Rn,n)}},t.prototype._removeItem=function(t){if(t.id){this._store.dispatch(nr(t));var e=this._notice;e&&e.type===Fr&&this._clearNotice(),this.passedElement.triggerEvent(Dn,dr(t))}},t.prototype._addChoice=function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t.id)throw new TypeError("Can not re-add a choice which has already been added");var n=this.config;if(n.duplicateItemsAllowed||!this._store.choices.find((function(e){return n.valueComparer(e.value,t.value)}))){this._lastAddedChoiceId++,t.id=this._lastAddedChoiceId,t.elementId="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(t.id);var r=n.prependValue,s=n.appendValue;r&&(t.value=r+t.value),s&&(t.value+=s.toString()),(r||s)&&t.element&&(t.element.value=t.value),this._clearNotice(),this._store.dispatch(er(t)),t.selected&&this._addItem(t,e,i)}},t.prototype._addGroup=function(t,e){var i=this;if(void 0===e&&(e=!0),t.id)throw new TypeError("Can not re-add a group which has already been added");this._store.dispatch(function(t){return{type:En,group:t}}(t)),t.choices&&(this._lastAddedGroupId++,t.id=this._lastAddedGroupId,t.choices.forEach((function(n){n.group=t,t.disabled&&(n.disabled=!0),i._addChoice(n,e)})))},t.prototype._createTemplates=function(){var t=this,e=this.config.callbackOnCreateTemplates,i={};"function"==typeof e&&(i=e.call(this,lr,fr,gr));var n={};Object.keys(this._templates).forEach((function(e){n[e]=e in i?i[e].bind(t):t._templates[e].bind(t)})),this._templates=n},t.prototype._createElements=function(){var t=this._templates,e=this.config,i=this._isSelectOneElement,n=e.position,r=e.classNames,s=this._elementType;this.containerOuter=new Sr({element:t.containerOuter(e,this._direction,this._isSelectElement,i,e.searchEnabled,s,e.labelId),classNames:r,type:s,position:n}),this.containerInner=new Sr({element:t.containerInner(e),classNames:r,type:s,position:n}),this.input=new Cr({element:t.input(e,this._placeholderValue),classNames:r,type:s,preventPaste:!e.paste}),this.choiceList=new Ar({element:t.choiceList(e,i)}),this.itemList=new Ar({element:t.itemList(e,i)}),this.dropdown=new wr({element:t.dropdown(e),classNames:r,type:s})},t.prototype._createStructure=function(){var t=this,e=t.containerInner,i=t.containerOuter,n=t.passedElement,r=this.dropdown.element;n.conceal(),e.wrap(n.element),i.wrap(e.element),i.element.appendChild(e.element),i.element.appendChild(r),e.element.appendChild(this.itemList.element),r.appendChild(this.choiceList.element),this._isSelectOneElement?(this.input.placeholder=this.config.searchPlaceholderValue||"",this.config.searchEnabled&&r.insertBefore(this.input.element,r.firstChild)):(this._isSelectMultipleElement&&!this.config.searchEnabled||e.element.appendChild(this.input.element),this._placeholderValue&&(this.input.placeholder=this._placeholderValue),this.input.setWidth()),this._highlightPosition=0,this._isSearching=!1},t.prototype._initStore=function(){var t=this;this._store.subscribe(this._render).withTxn((function(){t._addPredefinedChoices(t._presetChoices,t._isSelectOneElement&&!t._hasNonChoicePlaceholder,!1)})),(!this._store.choices.length||this._isSelectOneElement&&this._hasNonChoicePlaceholder)&&this._render()},t.prototype._addPredefinedChoices=function(t,e,i){var n=this;(void 0===e&&(e=!1),void 0===i&&(i=!0),e)&&(-1===t.findIndex((function(t){return t.selected}))&&t.some((function(t){return!t.disabled&&!("choices"in t)&&(t.selected=!0,!0)})));t.forEach((function(t){"choices"in t?n._isSelectElement&&n._addGroup(t,i):n._addChoice(t,i)}))},t.prototype._findAndSelectChoiceByValue=function(t,e){var i=this;void 0===e&&(e=!1);var n=this._store.choices.find((function(e){return i.config.valueComparer(e.value,t)}));return!(!n||n.disabled||n.selected)&&(this._addItem(n,!0,e),!0)},t.prototype._generatePlaceholderValue=function(){var t=this.config;if(!t.placeholder)return null;if(this._hasNonChoicePlaceholder)return t.placeholderValue;if(this._isSelectElement){var e=this.passedElement.placeholderOption;return e?e.text:null}return null},t.prototype._warnChoicesInitFailed=function(t){if(!this.config.silent){if(!this.initialised)throw new TypeError("".concat(t," called on a non-initialised instance of Choices"));if(!this.initialisedOK)throw new TypeError("".concat(t," called for an element which has multiple instances of Choices initialised on it"))}},t.version="11.2.1",t}(),Vs=r(5072),Xs=r.n(Vs),Ys=r(7825),$s=r.n(Ys),qs=r(7659),Ks=r.n(qs),Zs=r(5056),Qs=r.n(Zs),Js=r(540),to=r.n(Js),eo=r(1113),io=r.n(eo),no=r(5870),ro={};ro.styleTagTransform=io(),ro.setAttributes=Qs(),ro.insert=Ks().bind(null,"head"),ro.domAPI=$s(),ro.insertStyleElement=to();Xs()(no.A,ro);no.A&&no.A.locals&&no.A.locals;function so(t){return so="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},so(t)}function oo(t){return function(t){if(Array.isArray(t))return ao(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ao(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ao(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ao(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function lo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ho(n.key),n)}}function ho(t){var e=function(t,e){if("object"!=so(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=so(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==so(e)?e:e+""}var co=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP JSON HERE",this._initDrop(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"120px"})}},{key:"_createToolbox",value:function(){var t=this;this.toolbox=document.createElement("div"),Object.assign(this.toolbox.style,{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"}),this.counter=document.createElement("div"),this.counter.textContent="Records: 0",Object.assign(this.counter.style,{fontFamily:"sans-serif",fontSize:"13px",color:"#555"});var e=document.createElement("div");this.clearBtn=document.createElement("button"),this.clearBtn.textContent="Clear",this.clearBtn.disabled=!0,this.clearBtn.addEventListener("click",(function(){t._renderBase()})),e.appendChild(this.clearBtn),this.toolbox.appendChild(this.counter),this.toolbox.appendChild(e),this.container.appendChild(this.toolbox)}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888",fontFamily:"sans-serif",pointerEvents:"none",userSelect:"none"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"_hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"_initDrop",value:function(){var t=this;this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background=""})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="";var i=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain");if(i)try{var n=JSON.parse(i).data;Array.isArray(n)?t.render(n):t._showPlaceholder()}catch(e){console.error("Invalid JSON dropped",e),t._showPlaceholder()}else t._showPlaceholder()}))}},{key:"render",value:function(t){var e=this;if(Array.isArray(t)&&0!==t.length){this.data=t,this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._hidePlaceholder(),this.clearBtn.disabled=!1,this.counter.textContent="Records: ".concat(t.length);var i=document.createElement("table");Object.assign(i.style,{borderCollapse:"separate",borderSpacing:"0 4px",width:"100%",fontFamily:"sans-serif",fontSize:"14px"});var n=document.createElement("thead"),r=document.createElement("tr");["Field","# Variants","Values","Attractor",,"Orbit","Sum","Split UP","Split Right","Histogram","Color"].forEach((function(t){var e=document.createElement("th");e.textContent=t,Object.assign(e.style,{border:"none",padding:"6px",background:"#eaeaea",textAlign:"left"}),r.appendChild(e)})),n.appendChild(r),i.appendChild(n);var s=document.createElement("tbody");Object.keys(t[0]).forEach((function(i,n){var r=t.map((function(t){return t[i]})).filter((function(t){return null!=t}));if(r.length){var o=e._detectType(r),a=oo(new Set(r)),l=document.createElement("tr"),h=document.createElement("td");h.textContent=i,Object.assign(h.style,{border:"none",padding:"6px",fontWeight:"bold"});var c=document.createElement("td");c.textContent=a.length,Object.assign(c.style,{border:"none",padding:"6px",textAlign:"center"});var u=document.createElement("td");Object.assign(u.style,{border:"none",padding:"6px"});var d=null;if("categorical"===o){var p=document.createElement("select");a.forEach((function(t){var e=document.createElement("option");e.value=t,e.textContent=t,p.appendChild(e)})),u.appendChild(p),new Hs(p,{searchEnabled:!0,itemSelectText:"",shouldSort:!1});var f=p.closest(".choices");if(f){Object.assign(f.style,{minWidth:"180px",maxWidth:"220px"});var m=f.querySelector(".choices__inner");m&&Object.assign(m.style,{background:"#f8fafc",border:"1px solid #cbd5e1",borderRadius:"8px",minHeight:"34px",padding:"4px 8px",fontSize:"13px"});var y=f.querySelector(".choices__list--dropdown");y&&Object.assign(y.style,{border:"1px solid #cbd5e1",borderRadius:"8px",background:"#ffffff",boxShadow:"0 4px 10px rgba(0,0,0,0.08)"})}d=a[0],p.addEventListener("change",(function(t){d=p.value,console.log("SELECTED V",d)}))}else{var g=r.map((function(t){return Number(t)})).filter((function(t){return!isNaN(t)}));u.textContent=g.length?"min: ".concat(Math.min.apply(Math,oo(g))," | max: ").concat(Math.max.apply(Math,oo(g))):"No numeric data"}var v=function(t,e){var i=document.createElement("td"),n=document.createElement("div");n.setAttribute("draggable","true"),Object.assign(n.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",borderRadius:"6px",cursor:"grab"});var r=document.createElement("i");return r.className=t,r.style.pointerEvents="none",n.appendChild(r),n.addEventListener("dragstart",(function(t){var i=e(),n=JSON.stringify(i,null,2);t.dataTransfer.setData("application/json",n),t.dataTransfer.setData("text/plain",n)})),i.appendChild(n),i},b=document.createElement("td");Object.assign(b.style,{border:"none",padding:"6px",textAlign:"center"});var x="#ff0000",_=document.createElement("input");_.type="color",_.value=x,_.addEventListener("input",(function(t){x=t.target.value}));var w=document.createElement("div");w.setAttribute("draggable","true"),Object.assign(w.style,{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"6px",cursor:"grab",marginLeft:"6px"});var S=document.createElement("i");S.className="fa-solid fa-palette",S.style.pointerEvents="none",w.appendChild(S),w.addEventListener("dragstart",(function(t){var e,n={type:"color-rule",field:i,equals:d,color:(e=x,parseInt(e.replace("#","0x"),16))},r=JSON.stringify(n,null,2);t.dataTransfer.setData("application/json",r),t.dataTransfer.setData("text/plain",r)})),b.appendChild(_),b.appendChild(w);var C=v("fa-solid fa-magnet",(function(){return e._buildAttractorPayload(i,d)})),A=document.createElement("td"),E=document.createElement("div");E.setAttribute("draggable","true"),E.textContent="🪐",Object.assign(E.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"6px",cursor:"grab",fontSize:"14px",userSelect:"none"}),E.addEventListener("dragstart",(function(t){var e={type:"scalarField",field:i},n=JSON.stringify(e);t.dataTransfer.setData("application/json",n),t.dataTransfer.setData("text/plain",n)})),A.appendChild(E);var M=document.createElement("td"),T=document.createElement("div");T.setAttribute("draggable","true"),T.textContent="∑",Object.assign(T.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"6px",cursor:"grab",fontSize:"14px",userSelect:"none"}),T.addEventListener("dragstart",(function(t){var e={type:"sumField",field:i},n=JSON.stringify(e);t.dataTransfer.setData("application/json",n),t.dataTransfer.setData("text/plain",n)})),M.appendChild(T);var k=v("fa-solid fa-arrow-up",(function(){return e._buildSplitterPayload(i,"up")})),P=v("fa-solid fa-arrow-right",(function(){return e._buildSplitterPayload(i,"right")})),I=v("fa-solid fa-chart-column",(function(){return e._buildHistogramPayload(i)}));l.appendChild(h),l.appendChild(c),l.appendChild(u),l.appendChild(C),l.appendChild(A),l.appendChild(M),l.appendChild(k),l.appendChild(P),l.appendChild(I),l.appendChild(b);var O=l.querySelectorAll("td"),R=n%2==0?"#dbeafe":"#ffffff";O.forEach((function(t){t.style.background=R})),s.appendChild(l)}})),i.appendChild(s);var o=document.createElement("div");Object.assign(o.style,{position:"absolute",top:"42px",left:"0",right:"0",bottom:"0",overflow:"auto",padding:"10px",boxSizing:"border-box"}),o.appendChild(i),this.container.appendChild(o)}else this._showPlaceholder()}},{key:"_buildAttractorPayload",value:function(t,e){return{type:"planet",label:e,rule:{op:"and",rules:[{field:t,op:"eq",value:e}]}}}},{key:"_buildSplitterPayload",value:function(t,e){var i={type:"vector",vector:!0,scalarField:t,direction:"up"==e?{x:0,y:1}:{x:1,y:0},length:1200,rule:{op:"and",rules:[]}};return console.log("vector",i),i}},{key:"_buildHistogramPayloadOLD",value:function(t){var e={};return this.data.forEach((function(i){var n=i[t];n||(n="EMPTY"),e[n]=(e[n]||0)+1})),{type:"histogram",field:t,data:Object.keys(e).map((function(t){return{value:t,count:e[t]}}))}}},{key:"_buildHistogramPayload",value:function(t){return{type:"histogram",field:t,data:this.data}}},{key:"_detectType",value:function(t){var e=t.filter((function(t){return""!==t&&null!=t}));return e.length&&e.map(Number).filter((function(t){return!isNaN(t)})).length===e.length?"scalar":"categorical"}}],e&&lo(t.prototype,e),i&&lo(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function uo(t){return uo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uo(t)}function po(t){return function(t){if(Array.isArray(t))return fo(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return fo(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?fo(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fo(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function mo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,yo(n.key),n)}}function yo(t){var e=function(t,e){if("object"!=uo(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=uo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==uo(e)?e:e+""}var go=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP JSON HERE",this._initDrop(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"120px"})}},{key:"_createToolbox",value:function(){var t=this;this.toolbox=document.createElement("div"),Object.assign(this.toolbox.style,{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"}),this.counter=document.createElement("div"),this.counter.textContent="Records: 0",Object.assign(this.counter.style,{fontFamily:"sans-serif",fontSize:"13px",color:"#555"});var e=document.createElement("div");this.clearBtn=document.createElement("button"),this.clearBtn.textContent="Clear",this.clearBtn.disabled=!0,this.clearBtn.addEventListener("click",(function(){t._renderBase()})),e.appendChild(this.clearBtn),this.toolbox.appendChild(this.counter),this.toolbox.appendChild(e),this.container.appendChild(this.toolbox)}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888",fontFamily:"sans-serif",pointerEvents:"none",userSelect:"none"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"_hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"_initDrop",value:function(){var t=this;this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background=""})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="";var i=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain");if(i)try{var n=JSON.parse(i).data;Array.isArray(n)?t.render(n):t._showPlaceholder()}catch(e){console.error("Invalid JSON dropped",e),t._showPlaceholder()}else t._showPlaceholder()}))}},{key:"render",value:function(t){var e=this;if(Array.isArray(t)&&0!==t.length){this.data=t,this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._hidePlaceholder(),this.clearBtn.disabled=!1,this.counter.textContent="Records: ".concat(t.length);var i=document.createElement("table");Object.assign(i.style,{borderCollapse:"separate",borderSpacing:"0 4px",width:"100%",fontFamily:"sans-serif",fontSize:"14px"});var n=document.createElement("thead"),r=document.createElement("tr");["Field","# Variants","Values"].forEach((function(t){var e=document.createElement("th");e.textContent=t,Object.assign(e.style,{border:"none",padding:"6px",background:"#eaeaea",textAlign:"left"}),r.appendChild(e)})),n.appendChild(r),i.appendChild(n);var s=document.createElement("tbody");Object.keys(t[0]).forEach((function(i,n){var r=t.map((function(t){return t[i]})).filter((function(t){return null!=t}));if(r.length){var o=e._detectType(r),a=po(new Set(r)),l=document.createElement("tr"),h=document.createElement("td");h.textContent=i,h.setAttribute("draggable","true"),Object.assign(h.style,{border:"none",padding:"6px 10px",fontWeight:"bold",cursor:"grab",userSelect:"none"}),h.addEventListener("dragstart",(function(t){var n=e._buildHistogramPayload(i),r=JSON.stringify(n,null,2);t.dataTransfer.setData("application/json",r),t.dataTransfer.setData("text/plain",r),t.dataTransfer.effectAllowed="copy",h.style.opacity="0.5"})),h.addEventListener("dragend",(function(){h.style.opacity="1"})),h.addEventListener("mouseenter",(function(){h.style.textDecoration="underline"})),h.addEventListener("mouseleave",(function(){h.style.textDecoration="none"}));var c=document.createElement("td");c.textContent=a.length,Object.assign(c.style,{border:"none",padding:"6px",textAlign:"center"});var u=document.createElement("td");if(Object.assign(u.style,{border:"none",padding:"6px"}),"categorical"===o){var d=document.createElement("select");a.forEach((function(t){var e=document.createElement("option");e.value=t,e.textContent=t,d.appendChild(e)})),u.appendChild(d),new Hs(d,{searchEnabled:!0,itemSelectText:"",shouldSort:!1});var p=d.closest(".choices");if(p){Object.assign(p.style,{minWidth:"180px",maxWidth:"220px",marginBottom:"0"});var f=p.querySelector(".choices__inner");f&&Object.assign(f.style,{background:"#f8fafc",border:"1px solid #cbd5e1",borderRadius:"8px",minHeight:"34px",padding:"4px 8px",fontSize:"13px"});var m=p.querySelector(".choices__list--dropdown");m&&Object.assign(m.style,{border:"1px solid #cbd5e1",borderRadius:"8px",background:"#ffffff",boxShadow:"0 4px 10px rgba(0,0,0,0.08)"})}d.addEventListener("change",(function(){console.log("SELECTED V",d.value)}))}else{var y=r.map((function(t){return Number(t)})).filter((function(t){return!isNaN(t)}));u.textContent=y.length?"min: ".concat(Math.min.apply(Math,po(y))," | max: ").concat(Math.max.apply(Math,po(y))):"No numeric data"}l.appendChild(h),l.appendChild(c),l.appendChild(u);var g=n%2==0?"#dbeafe":"#ffffff";l.querySelectorAll("td").forEach((function(t){t.style.background=g})),h.title='Drag "'.concat(i,'"'),s.appendChild(l)}})),i.appendChild(s);var o=document.createElement("div");Object.assign(o.style,{position:"absolute",top:"42px",left:"0",right:"0",bottom:"0",overflow:"auto",padding:"10px",boxSizing:"border-box"}),o.appendChild(i),this.container.appendChild(o)}else this._showPlaceholder()}},{key:"_buildHistogramPayload",value:function(t){return{type:"dimension",field:t,data:this.data}}},{key:"_detectType",value:function(t){var e=t.filter((function(t){return""!==t&&null!=t}));return e.length&&e.map(Number).filter((function(t){return!isNaN(t)})).length===e.length?"scalar":"categorical"}}],e&&mo(t.prototype,e),i&&mo(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function vo(t){return vo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vo(t)}function bo(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function xo(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?bo(Object(i),!0).forEach((function(e){_o(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):bo(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function _o(t,e,i){return(e=Mo(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function wo(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||Co(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function So(t){return function(t){if(Array.isArray(t))return Ao(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Co(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Co(t,e){if(t){if("string"==typeof t)return Ao(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ao(t,e):void 0}}function Ao(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Eo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Mo(n.key),n)}}function Mo(t){var e=function(t,e){if("object"!=vo(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=vo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vo(e)?e:e+""}var To=function(){return t=function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container element is required");this.container=e,this.placeholderText=i.placeholder||"PASTE DATA HERE",this.data=[],this.sortState={field:null,direction:"asc"},this.filters={},this.handlePaste=this.handlePaste.bind(this),this._initStyles(),this.init()},e=[{key:"init",value:function(){var t=this;this.container.setAttribute("contenteditable","true"),this.container.style.display="flex",this.container.style.flexDirection="column",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.container.style.background="#fff",this.container.style.border="1px solid #e5e7eb",this.container.style.borderRadius="8px",this.createPlaceholder(),this.showPlaceholder(),this.container.addEventListener("paste",this.handlePaste),this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background="#fff"})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="#fff",t.handleDrop(e)})),this.container.addEventListener("mousedown",(function(t){t.target.closest("[draggable='true']")&&t.stopPropagation()}))}},{key:"_initStyles",value:function(){this.styles={table:{width:"max-content",minwidth:"100%",height:"90%",borderCollapse:"separate",borderSpacing:"0",fontFamily:"system-ui, sans-serif",fontSize:"13px"},th:{padding:"10px 8px",background:"#f9fafb",borderBottom:"1px solid #e5e7eb",textAlign:"left",fontWeight:"600",color:"#374151",position:"sticky",top:"0",zIndex:"5"},td:{padding:"8px",borderBottom:"1px solid #f1f5f9",color:"#111827"},trHover:{background:"#f9fafb"},trAlt:{background:"#fcfcfd"},input:{width:"100%",border:"1px solid #d1d5db",borderRadius:"4px",padding:"4px",fontSize:"13px"},select:{marginTop:"4px",border:"1px solid #d1d5db",borderRadius:"4px",fontSize:"11px",padding:"2px"}}}},{key:"_setStyle",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.assign(t.style,e)}},{key:"handlePaste",value:function(t){t.preventDefault();var e=(t.clipboardData||window.clipboardData).getData("text");if(e){var i=this.parseTSV(e),n=this.toJSON(i);this.data=this.mergeData(this.data,n),this.render()}}},{key:"handleDrop",value:function(t){var e=t.dataTransfer.getData("application/json")||t.dataTransfer.getData("text/plain");if(e){var i;console.log("dropping");try{i=JSON.parse(e)}catch(t){return void console.error("Invalid JSON dropped",t)}("table"===i.type&&Array.isArray(i.data)||"graph-nodes"===i.type&&Array.isArray(i.data))&&this._dropTableData(i.data)}}},{key:"_dropTableData",value:function(t){this.data=this.mergeData(this.data,t),this.render()}},{key:"render",value:function(){this.container.innerHTML="",this.container.style.display="grid",this.container.style.gridTemplateRows="auto 1fr",this.container.style.height="100%",this.container.style.minWidth="0",this.container.style.overflow="hidden";var t=this.createToolbox();t.style.gridRow="1";var e=document.createElement("div");e.style.gridRow="2",e.style.width="100%",e.style.height="90%",e.style.overflowX="auto",e.style.overflowY="auto",e.style.minWidth="0",e.style.minHeight="0";var i=this.createTableFromJSON(this.getProcessedData());i.style.width="max-content",e.appendChild(i),this.container.appendChild(t),this.container.appendChild(e),this.hidePlaceholder()}},{key:"getProcessedData",value:function(){var t=So(this.data);return Object.entries(this.filters).forEach((function(e){var i=wo(e,2),n=i[0],r=i[1];r&&(t=t.filter((function(t){return(t[n]||"")===r})))})),this.sortState.field&&(t=this._sortData(t,this.sortState.field,this.sortState.direction)),t}},{key:"_sortData",value:function(t,e,i){var n="asc"===i?1:-1;return So(t).map((function(t,e){return{item:t,index:e}})).sort((function(t,i){var r,s,o=null!==(r=t.item[e])&&void 0!==r?r:"",a=null!==(s=i.item[e])&&void 0!==s?s:"",l=parseFloat(o),h=parseFloat(a);return isNaN(l)||isNaN(h)?o.toString().localeCompare(a.toString())*n:(l-h)*n})).map((function(t){return t.item}))}},{key:"createTableFromJSON",value:function(t){var e=this,i=document.createElement("table");this._setStyle(i,this.styles.table);var n=document.createElement("thead"),r=document.createElement("tbody"),s=Array.from(this.data.reduce((function(t,e){return Object.keys(e).forEach((function(e){return t.add(e)})),t}),new Set)),o=document.createElement("tr");return s.forEach((function(t){var i=document.createElement("th"),n=e.sortState.field===t?"asc"===e.sortState.direction?" ▲":" ▼":"",r=document.createElement("div");r.textContent=t+n;var s=document.createElement("select"),a=So(new Set(e.data.map((function(e){return e[t]})).filter((function(t){return""!==t})))),l=document.createElement("option");l.value="",l.textContent="All",s.appendChild(l),a.forEach((function(t){var e=document.createElement("option");e.value=t,e.textContent=t,s.appendChild(e)})),s.value=e.filters[t]||"";var h=Math.min(120,Math.max(60,8*t.length));s.style.width=h+"px",e._setStyle(s,e.styles.select),s.onchange=function(i){e.filters[t]=i.target.value,e.render()},r.onclick=function(){e.sortState.field===t?e.sortState.direction="asc"===e.sortState.direction?"desc":"asc":(e.sortState.field=t,e.sortState.direction="asc"),e.render()},i.appendChild(r),i.appendChild(s),e._setStyle(i,e.styles.th),o.appendChild(i)})),n.appendChild(o),t.forEach((function(t,i){var n=document.createElement("tr");i%2==0&&e._setStyle(n,e.styles.trAlt),n.onmouseenter=function(){return e._setStyle(n,e.styles.trHover)},n.onmouseleave=function(){return n.style.background=i%2==0?"#fcfcfd":""},s.forEach((function(i){var r=document.createElement("td");e._setStyle(r,e.styles.td),r.textContent=t[i]||"",r.onclick=function(){var n=document.createElement("input");e._setStyle(n,e.styles.input),n.value=t[i]||"",r.innerHTML="",r.appendChild(n),n.focus();var s=function(){t[i]=n.value,e.render()};n.onblur=s,n.onkeydown=function(t){"Enter"===t.key&&s()}},n.appendChild(r)})),r.appendChild(n)})),i.appendChild(n),i.appendChild(r),i}},{key:"createToolbox",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{display:"flex",gap:"10px",padding:"8px",borderBottom:"1px solid #e5e7eb",background:"#fafafa",alignItems:"center"});var i=document.createElement("button");i.textContent="Clear",Object.assign(i.style,{padding:"4px 8px",border:"1px solid #d1d5db",borderRadius:"4px",background:"#fff",cursor:"pointer"}),i.onclick=function(){return t.clear()};var n=document.createElement("div");n.setAttribute("draggable","true"),n.title="Drag JSON",Object.assign(n.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"1px solid #d1d5db",borderRadius:"6px",background:"#fff",cursor:"grab",userSelect:"none"});var r=document.createElement("span");r.textContent="⤴",r.style.pointerEvents="none",n.appendChild(r),n.addEventListener("mousedown",(function(){n.style.cursor="grabbing"})),n.addEventListener("mouseup",(function(){n.style.cursor="grab"})),n.addEventListener("dragstart",(function(e){var i={type:"table",data:t.getProcessedData()},r=JSON.stringify(i);e.dataTransfer.effectAllowed="copy",e.dataTransfer.setData("application/json",r),e.dataTransfer.setData("text/plain",r);var s=n.cloneNode(!0);s.style.position="absolute",s.style.top="-1000px",document.body.appendChild(s),e.dataTransfer.setDragImage(s,16,16),setTimeout((function(){return document.body.removeChild(s)}),0)}));var s=document.createElement("button");return s.textContent="Copy",Object.assign(s.style,{padding:"4px 8px",border:"1px solid #d1d5db",borderRadius:"4px",background:"#fff",cursor:"pointer"}),s.onclick=function(){return t.copyToClipboard()},e.appendChild(i),e.appendChild(s),e.appendChild(n),e}},{key:"parseTSV",value:function(t){return t.trim().split("\n").map((function(t){return t.split("\t")}))}},{key:"toJSON",value:function(t){var e=t[0];return t.slice(1).map((function(t){var i={};return e.forEach((function(e,n){return i[e]=t[n]||""})),i}))}},{key:"mergeData",value:function(t,e){if(!t.length)return e;var i=new Map;return t.forEach((function(t){return t.id&&i.set(t.id,xo({},t))})),e.forEach((function(t){t.id&&(i.has(t.id)?Object.assign(i.get(t.id),t):i.set(t.id,xo({},t)))})),Array.from(i.values())}},{key:"createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"10px",left:"10px",color:"#9ca3af"}),this.container.appendChild(this.placeholder)}},{key:"showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"clear",value:function(){this.data=[],this.filters={},this.sortState={field:null,direction:"asc"},this.container.innerHTML="",this.createPlaceholder(),this.showPlaceholder()}},{key:"copyToClipboard",value:function(){var t=this.getProcessedData();if(t.length){var e=Array.from(t.reduce((function(t,e){return Object.keys(e).forEach((function(e){return t.add(e)})),t}),new Set)),i=[e.join("\t")].concat(So(t.map((function(t){return e.map((function(e){var i;return null!==(i=t[e])&&void 0!==i?i:""})).join("\t")})))).join("\n");navigator.clipboard.writeText(i).then((function(){console.log("Copied to clipboard")})).catch((function(t){console.error("Clipboard copy failed",t)}))}}}],e&&Eo(t.prototype,e),i&&Eo(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function ko(t){return ko="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ko(t)}function Po(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Io(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Po(Object(i),!0).forEach((function(e){Oo(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Po(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Oo(t,e,i){return(e=Lo(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ro(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Lo(n.key),n)}}function Lo(t){var e=function(t,e){if("object"!=ko(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=ko(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ko(e)?e:e+""}var jo=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP HISTOGRAM HERE",this.currentPayload=null,this.sortAscending=!1,this._initDrop(),this._initResize(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._createTooltip(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"200px"})}},{key:"_createToolbox",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{display:"flex",justifyContent:"flex-end",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"});var i=document.createElement("button");i.textContent="Clear",i.addEventListener("click",(function(){t.currentPayload=null,t._renderBase()}));var n=document.createElement("button");n.textContent="Sort ↑",n.addEventListener("click",(function(){t.sortAscending=!t.sortAscending,n.textContent=t.sortAscending?"Sort ↓":"Sort ↑",t.currentPayload&&t._drawChart(t.currentPayload)})),e.appendChild(n),e.appendChild(i),this.container.appendChild(e)}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888",fontFamily:"sans-serif",pointerEvents:"none"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"_hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"_aggregateData",value:function(t,e,i){var n=this,r={};return t.forEach((function(t){var s=t[e];if(s||(s="EMPTY"),r[s]||(r[s]=0),i){var o=n._parseNumber(t[i]);r[s]+=o}else r[s]+=1})),Object.keys(r).map((function(t){return{value:t,count:r[t]}}))}},{key:"_createTooltip",value:function(){this.tooltip=document.createElement("div"),Object.assign(this.tooltip.style,{position:"absolute",pointerEvents:"none",background:"rgba(0,0,0,0.75)",color:"#fff",padding:"6px 8px",borderRadius:"4px",fontSize:"12px",fontFamily:"sans-serif",opacity:"0",transition:"opacity 0.2s"}),this.container.appendChild(this.tooltip)}},{key:"_showTooltip",value:function(t,e,i){this.tooltip.innerHTML=i,this.tooltip.style.left=t+10+"px",this.tooltip.style.top=e+10+"px",this.tooltip.style.opacity="1"}},{key:"_hideTooltip",value:function(){this.tooltip.style.opacity="0"}},{key:"_initResize",value:function(){var t=this;this._handleResize=function(e){var i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:150;return function(){for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];clearTimeout(i),i=setTimeout((function(){return e.apply(t,s)}),n)}}((function(){t.currentPayload&&t._drawChart(t.currentPayload)})),this.resizeObserver=new ResizeObserver(this._handleResize),this.resizeObserver.observe(this.container)}},{key:"_initDrop",value:function(){var t=this;this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background=""})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="";var i=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain");if(i)try{var n=JSON.parse(i);if("histogram"===n.type&&Array.isArray(n.data))return void t.render(Io(Io({},n),{},{sumField:null}));if("sumField"===n.type&&t.currentPayload)return console.log("Dropped ",n),t.currentPayload.sumField=n.field,void t._drawChart(t.currentPayload)}catch(t){console.error("Invalid drop JSON",t)}}))}},{key:"render",value:function(t){this.currentPayload=Io(Io({},t),{},{sumField:t.sumField||null}),this.container.innerHTML="",this._createToolbox(),this._createTooltip(),this._hidePlaceholder(),this.chartWrapper=document.createElement("div"),this.chartWrapper.style.width="100%",this.chartWrapper.style.height="100%",this.chartWrapper.style.padding="10px",this.container.appendChild(this.chartWrapper),this._drawChart(this.currentPayload)}},{key:"_parseNumber",value:function(t){if(null==t)return 0;var e=String(t).replace(/,/g,""),i=Number(e);return isNaN(i)?0:i}},{key:"_drawChart",value:function(t){var e=this;if(this.chartWrapper){this.chartWrapper.innerHTML="";var i=this.container.getBoundingClientRect(),n=i.width-20,r=Math.max(200,i.height-60),s=30,o=20,a=80,l=50,h=d3.select(this.chartWrapper).append("svg").attr("width",n).attr("height",r),c=n-l-o,u=r-s-a,d=h.append("g").attr("transform","translate(".concat(l,",").concat(s,")")),p=this._aggregateData(t.data,t.field,t.sumField);this.sortAscending&&p.sort((function(t,e){return t.count-e.count}));var f=d3.scaleBand().domain(p.map((function(t){return t.value}))).range([0,c]).padding(.1),m=d3.scaleLinear().domain([0,d3.max(p,(function(t){return t.count}))]).nice().range([u,0]);d.selectAll(".bar").data(p,(function(t){return t.value})).enter().append("rect").attr("class","bar").attr("x",(function(t){return f(t.value)})).attr("width",f.bandwidth()).attr("y",u).attr("height",0).attr("fill","#69b3a2").on("mousemove",(function(i,n){e._showTooltip(i.offsetX,i.offsetY,"<b>".concat(n.value,"</b><br/>").concat(t.sumField?"Sum":"Count",": ").concat(n.count))})).on("mouseleave",(function(){return e._hideTooltip()})).transition().duration(600).attr("y",(function(t){return m(t.count)})).attr("height",(function(t){return u-m(t.count)})),d.append("g").attr("transform","translate(0, ".concat(u,")")).call(d3.axisBottom(f).tickFormat((function(t){var e,i=p.find((function(e){return e.value===t}));return"".concat(t," (").concat(null!==(e=null==i?void 0:i.count)&&void 0!==e?e:0,")")}))).selectAll("text").attr("transform","rotate(-30)").style("text-anchor","end"),d.append("g").call(d3.axisLeft(m)),h.append("text").attr("x",n/2).attr("y",20).attr("text-anchor","middle").style("font-family","sans-serif").style("font-size","14px").text("Histogram: ".concat(t.field))}}}],e&&Ro(t.prototype,e),i&&Ro(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Do(t){return Do="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Do(t)}function Fo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,No(n.key),n)}}function No(t){var e=function(t,e){if("object"!=Do(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Do(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Do(e)?e:e+""}var Bo=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container required");this.container=e,this.days=["Lun","Mar","Mie","Jue","Vie","Sab","Dom"],this.hours=["09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00"],this.selected={},this._injectStyles(),this._render(),this._buildGrid(),this._bindEvents()},(e=[{key:"_injectStyles",value:function(){if(!document.getElementById("availability-survey-styles")){var t=document.createElement("style");t.id="availability-survey-styles",t.textContent="\n .as-card {\n max-width: 900px;\n margin: auto;\n background: white;\n padding: 20px;\n border-radius: 16px;\n box-shadow: 0 8px 24px rgba(0,0,0,0.08);\n font-family: sans-serif;\n\n display: flex;\n flex-direction: column;\n height: 100%; /* 🔥 important */\n }\n\n .as-title {\n margin-bottom: 6px;\n }\n\n .as-subtitle {\n color: #666;\n margin-bottom: 16px;\n font-size: 14px;\n }\n\n .as-input-group {\n margin-bottom: 16px;\n }\n\n .as-card input {\n padding: 8px 10px;\n border: 1px solid #ddd;\n border-radius: 8px;\n width: 220px;\n font-size: 14px;\n }\n\n .as-grid-wrapper {\n overflow: auto;\n border-radius: 12px;\n -webkit-overflow-scrolling: touch;\n\n flex: 1; /* 🔥 fills space */\n min-height: 0; /* 🔥 required for iOS */\n }\n\n .as-grid {\n display: grid;\n grid-template-columns: 80px repeat(7, minmax(70px, 1fr));\n min-width: 600px;\n border: 1px solid #e5e7eb;\n }\n\n .as-cell {\n border: 1px solid #eef0f4;\n height: 42px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 13px;\n transition: all 0.12s ease;\n user-select: none;\n }\n\n .as-header {\n font-weight: 600;\n background: #f1f5f9;\n cursor: default;\n }\n\n .as-time {\n background: #f9fafb;\n color: #555;\n font-size: 12px;\n cursor: default;\n }\n\n /* hover only when NOT clicking */\n body:not(.as-clicking) .as-cell:not(.as-active):hover {\n background: #eef4ff;\n }\n\n .as-active {\n background: #1e40af;\n color: white;\n font-weight: bold;\n }\n\n .as-cell:active {\n transform: scale(0.96);\n }\n\n .as-card button {\n margin-top: 16px;\n padding: 10px 16px;\n border: none;\n border-radius: 10px;\n background: #3b82f6;\n color: white;\n font-size: 14px;\n cursor: pointer;\n box-shadow: 0 4px 12px rgba(59,130,246,0.3);\n margin-top: 12px;\n flex-shrink: 0; \n }\n\n .as-card button:hover {\n background: #2563eb;\n }\n\n .as-header {\n position: sticky;\n top: 0;\n z-index: 2;\n }\n\n\n .as-time {\n position: sticky;\n left: 0;\n z-index: 1;\n background: #f9fafb;\n }\n\n ",document.head.appendChild(t)}}},{key:"_render",value:function(){this.container.innerHTML="",this.card=document.createElement("div"),this.card.className="as-card",this.title=document.createElement("h1"),this.title.className="as-title",this.title.textContent="Encuesta de Disponibilidad 🎶",this.subtitle=document.createElement("div"),this.subtitle.className="as-subtitle",this.subtitle.textContent="Pon tu nombre y da click en los horarios que te acomoden para el ensayo",this.inputGroup=document.createElement("div"),this.inputGroup.className="as-input-group",this.input=document.createElement("input"),this.input.placeholder="Pon tu Nombre",this.gridWrapper=document.createElement("div"),this.gridWrapper.className="as-grid-wrapper",this.grid=document.createElement("div"),this.grid.className="as-grid",this.gridWrapper.appendChild(this.grid),this.button=document.createElement("button"),this.button.textContent="Enviar",this.inputGroup.appendChild(this.input),this.card.appendChild(this.title),this.card.appendChild(this.subtitle),this.card.appendChild(this.inputGroup),this.card.appendChild(this.gridWrapper),this.card.appendChild(this.button),this.container.appendChild(this.card)}},{key:"_buildGrid",value:function(){var t=this;this.grid.appendChild(document.createElement("div")),this.days.forEach((function(e){var i=document.createElement("div");i.textContent=e,i.className="as-cell as-header",t.grid.appendChild(i)})),this.hours.forEach((function(e){var i=document.createElement("div");i.textContent=e,i.className="as-cell as-time",t.grid.appendChild(i),t.days.forEach((function(i){var n="".concat(i,"-").concat(e),r=document.createElement("div");r.className="as-cell",r.addEventListener("click",(function(){var e=!t.selected[n];t.selected[n]=e,r.classList.toggle("as-active",e),r.textContent=e?"✓":""})),t.grid.appendChild(r)}))}))}},{key:"_bindEvents",value:function(){var t=this;document.addEventListener("mousedown",(function(){document.body.classList.add("as-clicking")})),document.addEventListener("mouseup",(function(){document.body.classList.remove("as-clicking")})),this.button.addEventListener("click",(function(){var e=t.input.value||"Anonymous";if(0!==Object.values(t.selected).filter(Boolean).length){var i={name:e,availability:t.selected};alert("Gracias !!!"),t.onSubmit&&t.onSubmit(i)}else alert("Please select at least one time slot")}))}}])&&Fo(t.prototype,e),i&&Fo(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Go(t){return Go="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Go(t)}function zo(t){return function(t){if(Array.isArray(t))return Wo(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Wo(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Wo(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Wo(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Uo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ho(n.key),n)}}function Ho(t){var e=function(t,e){if("object"!=Go(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Go(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Go(e)?e:e+""}var Vo=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP DATA HERE",this.currentPayload=null,this.selectedFields=[],this.sortAscending=!1,this.zoomLevel=1,this.minZoom=.6,this.maxZoom=2,this.panX=0,this.panY=0,this.isPanning=!1,this._initDrop(),this._initResize(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._createTooltip(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"200px",overflow:"hidden"})}},{key:"_createToolbox",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{display:"flex",justifyContent:"space-between",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"}),this.fieldsContainer=document.createElement("div"),this.fieldsContainer.style.display="flex",this.fieldsContainer.style.gap="6px";var i=document.createElement("div"),n=document.createElement("button");n.textContent="Sort ↑",n.onclick=function(){t.sortAscending=!t.sortAscending,n.textContent=t.sortAscending?"Sort ↓":"Sort ↑",t.currentPayload&&t._drawChart(t.currentPayload)};var r=document.createElement("button");r.textContent="Clear",r.onclick=function(){t.currentPayload=null,t.selectedFields=[],t._renderBase()},i.appendChild(n),i.appendChild(r),e.appendChild(this.fieldsContainer),e.appendChild(i),this.container.appendChild(e)}},{key:"_renderFieldChips",value:function(){var t=this;this.fieldsContainer.innerHTML="",this.selectedFields.forEach((function(e,i){var n=document.createElement("div");Object.assign(n.style,{padding:"2px 6px",background:"#e0e0e0",borderRadius:"4px",fontSize:"11px",display:"flex",alignItems:"center",gap:"4px"}),n.innerHTML="".concat(e," ✕"),n.onclick=function(){t.selectedFields.splice(i,1),t._renderFieldChips(),t._drawChart(t.currentPayload)},t.fieldsContainer.appendChild(n)}))}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder.style.display="block"}},{key:"_hidePlaceholder",value:function(){this.placeholder.style.display="none"}},{key:"_createTooltip",value:function(){this.tooltip=document.createElement("div"),Object.assign(this.tooltip.style,{position:"absolute",background:"#000",color:"#fff",padding:"4px 6px",fontSize:"11px",borderRadius:"4px",opacity:0,pointerEvents:"none"}),this.container.appendChild(this.tooltip)}},{key:"_showTooltip",value:function(t,e,i){this.tooltip.innerHTML=i,this.tooltip.style.left=t+10+"px",this.tooltip.style.top=e+10+"px",this.tooltip.style.opacity=1}},{key:"_hideTooltip",value:function(){this.tooltip.style.opacity=0}},{key:"_initResize",value:function(){var t=this;new ResizeObserver((function(){t.currentPayload&&t._drawChart(t.currentPayload)})).observe(this.container)}},{key:"_initInteractions",value:function(){var t=this;this.container.onwheel=function(e){e.preventDefault(),t.zoomLevel+=.0015*-e.deltaY,t.zoomLevel=Math.max(t.minZoom,Math.min(t.maxZoom,t.zoomLevel)),t._applyTransform()},this.container.onmousedown=function(e){t.isPanning=!0,t.startX=e.clientX-t.panX,t.startY=e.clientY-t.panY,t.container.style.cursor="grabbing"},window.onmousemove=function(e){t.isPanning&&(t.panX=e.clientX-t.startX,t.panY=e.clientY-t.startY,t._applyTransform())},window.onmouseup=function(){t.isPanning=!1,t.container.style.cursor="default"}}},{key:"_applyTransform",value:function(){this.grid.style.transform="translate(".concat(this.panX,"px, ").concat(this.panY,"px) scale(").concat(this.zoomLevel,")")}},{key:"_initDrop",value:function(){var t=this;this.container.ondragover=function(t){return t.preventDefault()},this.container.ondrop=function(e){e.preventDefault();var i=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain"),n=JSON.parse(i);"histogram"===n.type&&(t.selectedFields=[],t.render(n)),"sumField"===n.type&&(t.selectedFields.includes(n.field)||t.selectedFields.push(n.field),t._renderFieldChips(),t._drawChart(t.currentPayload))}}},{key:"render",value:function(t){this.currentPayload=t,this.container.innerHTML="",this._createToolbox(),this._createTooltip(),this.chartWrapper=document.createElement("div"),this.chartWrapper.style.height="100%",this.chartWrapper.style.background="#f5f7fa",this.chartWrapper.style.padding="12px",this.container.appendChild(this.chartWrapper),this._drawChart(t)}},{key:"_parseNumber",value:function(t){return Number(String(t).replace(/,/g,""))||0}},{key:"_buildSeries",value:function(t){var e=this;return this.selectedFields.map((function(i){return{field:i,value:e._parseNumber(t[i])}}))}},{key:"_drawChart",value:function(t){var e=this;if(this.chartWrapper.innerHTML="",this.selectedFields.length){var i=zo(t.data);if(this.sortAscending){var n=this.selectedFields.at(-1);i.sort((function(t,i){return e._parseNumber(t[n])-e._parseNumber(i[n])}))}this.grid=document.createElement("div"),Object.assign(this.grid.style,{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:"12px",transformOrigin:"0 0"}),this.chartWrapper.appendChild(this.grid),this._initInteractions(),i.forEach((function(i){var n,r,s=document.createElement("div");s.onmouseenter=function(){s.style.transform="translateY(-2px)",s.style.boxShadow="0 4px 14px rgba(0,0,0,0.12)"},s.onmouseleave=function(){s.style.transform="translateY(0)",s.style.boxShadow="0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06)"};var o=e._buildSeries(i),a=(null===(n=o[0])||void 0===n?void 0:n.value)||0,l=(null===(r=o.at(-1))||void 0===r?void 0:r.value)||0,h=0===a?0:(l-a)/a*100,c=document.createElement("div");Object.assign(c.style,{display:"flex",justifyContent:"space-between",alignItems:"center"});var u=document.createElement("div");u.textContent=i[t.field],u.style.fontSize="12px",u.style.fontWeight="600",u.style.color="#333",u.style.letterSpacing="0.2px";var d=document.createElement("div");d.textContent="".concat(h.toFixed(1),"%"),d.style.fontSize="10px",d.style.padding="3px 8px",d.style.borderRadius="999px",d.style.fontWeight="600",d.style.border="1px solid rgba(0,0,0,0.05)",d.style.background=h>=0?"#e3f2fd":"#ffebee",d.style.color=h>=0?"#1976d2":"#e53935",c.appendChild(u),c.appendChild(d),Object.assign(s.style,{background:"#ffffff",padding:"10px 12px",borderRadius:"10px",border:"1px solid rgba(0,0,0,0.06)",borderTop:"3px solid ".concat(h>=0?"#1976d2":"#e53935"),boxShadow:"0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06)",display:"flex",flexDirection:"column",gap:"6px",transition:"all 0.15s ease",cursor:"pointer"}),s.appendChild(c);for(var p=d3.select(s).append("svg").attr("width","100%").attr("height",100).append("g").attr("transform","translate(30,10)"),f=d3.scalePoint().domain(e.selectedFields).range([0,160]),m=d3.scaleLinear().domain([0,d3.max(o,(function(t){return t.value}))]).range([70,0]),y=0;y<o.length-1;y++){var g=o[y],v=o[y+1],b=v.value>=g.value?"#1976d2":"#e53935";p.append("line").attr("x1",f(g.field)).attr("y1",m(g.value)).attr("x2",f(v.field)).attr("y2",m(v.value)).attr("stroke",b).attr("stroke-width",2)}p.selectAll("circle").data(o).enter().append("circle").attr("cx",(function(t){return f(t.field)})).attr("cy",(function(t){return m(t.value)})).attr("r",2).attr("fill","#333"),e.grid.appendChild(s)}))}}}],e&&Uo(t.prototype,e),i&&Uo(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}(),Xo=s.A5,Yo=s.oY,$o=s.W_,qo=s.vY,Ko=s.TI,Zo=s.ey,Qo=s.sV;export{Xo as AvailabilitySurvey,Yo as DataInspector,$o as DataInspectorBasic,qo as vi_2dGRAP,Ko as vi_HistogramViewer,Zo as vi_MiniChartViewer,Qo as vi_PasteTable};
2
+ var t,e,i={5870:(t,e,i)=>{i.d(e,{A:()=>f});var n=i(1601),r=i.n(n),s=i(6314),o=i.n(s),a=i(4417),l=i.n(a),h=new URL(i(4002),i.b),c=new URL(i(2653),i.b),u=o()(r()),d=l()(h),p=l()(c);u.push([t.id,`.choices{position:relative;overflow:hidden;margin-bottom:var(--choices-guttering, 24px);font-size:var(--choices-font-size-lg, 16px)}.choices:focus{outline:0}.choices:last-child{margin-bottom:0}.choices.is-open{overflow:visible}.choices.is-disabled :is(.choices__inner,.choices__input){background-color:var(--choices-bg-color-disabled, #eaeaea);cursor:not-allowed!important;-webkit-user-select:none;user-select:none}.choices.is-disabled .choices__item{cursor:not-allowed;color:var(--choices-item-disabled-color, #fff)}.choices [hidden]{position:absolute;inset:0;pointer-events:none;opacity:0}.choices[data-type*=select-one]{cursor:pointer}.choices[data-type*=select-one] .choices__inner{padding-bottom:var(--choices-inner-one-padding, 7.5px)}.choices[data-type*=select-one] .choices__input{display:block;width:var(--choices-width, 100%);padding:var(--choices-dropdown-item-padding, 10px);border-bottom:var(--choices-base-border, 1px solid) var(--choices-keyline-color, #ddd);background-color:var(--choices-bg-color-dropdown, #fff);margin:0}.choices[data-type*=select-one] .choices__button{background-image:var(--choices-icon-cross-inverse, url(${d}));padding:0;background-size:8px;position:absolute;top:50%;right:0;margin-top:-10px;margin-right:25px;height:20px;width:20px;border-radius:10em;opacity:.25}.choices[data-type*=select-one] .choices__button:is(:hover,:focus){opacity:var(--choices-button-opacity-hover, 1)}.choices[data-type*=select-one] .choices__button:focus{box-shadow:0 0 0 2px var(--choices-highlight-color, #005F75)}.choices[data-type*=select-one] .choices__item[data-placeholder] .choices__button{display:none}.choices[data-type*=select-one]::after{content:"";height:0;width:0;border-style:solid;border-color:var(--choices-text-color, #333) transparent transparent transparent;border-width:var(--choices-arrow-size, 5px);position:absolute;right:var(--choices-arrow-right, 11.5px);top:50%;margin-top:var(--choices-arrow-margin-top, -2.5px);pointer-events:none}.choices[data-type*=select-one].is-open::after{border-color:transparent transparent var(--choices-text-color, #333);margin-top:var(--choices-arrow-margin-top-open, -7.5px)}.choices[data-type*=select-one][dir=rtl]::after{left:11.5px;right:auto}.choices[data-type*=select-one][dir=rtl] .choices__button{right:auto;left:0;margin-left:25px;margin-right:0}.choices:is([data-type*=select-multiple],[data-type*=text]) .choices__inner{cursor:text}.choices:is([data-type*=select-multiple],[data-type*=text]) .choices__button{position:relative;display:inline-block;margin:0 calc(var(--choices-button-offset, 8px)*-.5)0 var(--choices-button-offset, 8px);padding-left:calc(var(--choices-button-offset, 8px)*2);border-left:1px solid color-mix(in srgb,var(--choices-primary-color, #005F75) 90%,var(--choices-darken, black));background-image:var(--choices-icon-cross, url(${p}));background-size:var(--choices-button-dimension, 8px);width:var(--choices-button-dimension, 8px);line-height:var(--choices-button-line-height, 1);border-radius:var(--choices-button-border-radius, 0);opacity:var(--choices-button-opacity, 0.75)}.choices:is([data-type*=select-multiple],[data-type*=text]) .choices__button:is(:hover,:focus){--choices-button-opacity:var(--choices-button-opacity-hover, 1)}.choices__inner{display:inline-block;vertical-align:top;width:var(--choices-width, 100%);background-color:var(--choices-bg-color, #f9f9f9);padding:var(--choices-inner-padding, 7.5px 7.5px 3.75px);border:var(--choices-base-border, 1px solid) var(--choices-keyline-color, #ddd);border-radius:var(--choices-border-radius, 2.5px);font-size:var(--choices-font-size-md, 14px);min-height:var(--choices-input-height, 44px);overflow:hidden}.is-focused .choices__inner,.is-open .choices__inner{border-color:color-mix(in srgb,var(--choices-keyline-color, #ddd) 85%,var(--choices-darken, black))}.is-open .choices__inner{border-radius:var(--choices-border-radius, 2.5px) var(--choices-border-radius, 2.5px)0 0}.is-invalid .choices__inner{border-color:var(--choices-invalid-color, #d33141)}.is-flipped.is-open .choices__inner{border-radius:0 0 var(--choices-border-radius, 2.5px) var(--choices-border-radius, 2.5px)}.choices__list{margin:0;padding-left:0;list-style:none}.choices__list--single{display:inline-block;padding:var(--choices-list-single-padding, 4px 16px 4px 4px)}[dir=rtl] .choices__list--single{padding-right:4px;padding-left:16px}.choices__list--single,.choices__list--single .choices__item{width:var(--choices-width, 100%)}.choices__list--multiple{display:inline}.choices__list--multiple .choices__item{display:inline-block;vertical-align:middle;border-radius:var(--choices-border-radius-item, 20px);padding:var(--choices-multiple-item-padding, 4px 10px);font-size:var(--choices-font-size-sm, 12px);font-weight:500;margin-right:var(--choices-multiple-item-margin, 3.75px);margin-bottom:var(--choices-multiple-item-margin, 3.75px);background-color:var(--choices-primary-color, #005F75);border:1px solid color-mix(in srgb,var(--choices-primary-color, #005F75) 95%,var(--choices-darken, black));color:var(--choices-item-color, #fff);word-break:break-all;box-sizing:border-box}.choices__list--multiple .choices__item[data-deletable]{padding-right:5px}[dir=rtl] .choices__list--multiple .choices__item{margin-right:0;margin-left:var(--choices-multiple-item-margin, 3.75px)}.choices__list--multiple .choices__item.is-highlighted{background-color:color-mix(in srgb,var(--choices-primary-color, #005F75) 95%,var(--choices-darken, black));border:1px solid color-mix(in srgb,var(--choices-primary-color, #005F75) 90%,var(--choices-darken, black))}.is-disabled .choices__list--multiple .choices__item{background-color:color-mix(in srgb,var(--choices-disabled-color, #eaeaea) 75%,var(--choices-darken, black));border:1px solid color-mix(in srgb,var(--choices-disabled-color, #eaeaea) 65%,var(--choices-darken, black))}.choices__list--dropdown,.choices__list[aria-expanded]{display:none;z-index:var(--choices-z-index, 1);position:absolute;width:var(--choices-width, 100%);background-color:var(--choices-bg-color-dropdown, #fff);border:var(--choices-base-border, 1px solid) var(--choices-keyline-color, #ddd);top:100%;margin-top:-1px;border-bottom-left-radius:var(--choices-border-radius, 2.5px);border-bottom-right-radius:var(--choices-border-radius, 2.5px);overflow:hidden;word-break:break-all}.is-active.choices__list--dropdown,.is-active.choices__list[aria-expanded]{display:block}.is-open .choices__list--dropdown,.is-open .choices__list[aria-expanded]{border-color:color-mix(in srgb,var(--choices-keyline-color, #ddd) 85%,var(--choices-darken, black))}.is-flipped .choices__list--dropdown,.is-flipped .choices__list[aria-expanded]{top:auto;bottom:100%;margin-top:0;margin-bottom:-1px;border-radius:.25rem .25rem 0 0}.choices__list--dropdown .choices__list,.choices__list[aria-expanded] .choices__list{position:relative;max-height:300px;overflow:auto;-webkit-overflow-scrolling:touch;will-change:scroll-position}.choices__list--dropdown .choices__item,.choices__list[aria-expanded] .choices__item{position:relative;padding:var(--choices-dropdown-item-padding, 10px);font-size:var(--choices-font-size-md, 14px)}[dir=rtl] .choices__list--dropdown .choices__item,[dir=rtl] .choices__list[aria-expanded] .choices__item{text-align:right}@media (min-width:640px){.choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text],.choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]{padding-right:100px}.choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text]::after,.choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]::after{content:attr(data-select-text);font-size:var(--choices-font-size-sm, 12px);position:absolute;right:10px;top:50%;transform:translateY(-50%)}[dir=rtl] .choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text],[dir=rtl] .choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]{text-align:right;padding-left:100px;padding-right:10px}[dir=rtl] .choices__list--dropdown .choices__item--selectable.is-highlighted[data-select-text]::after,[dir=rtl] .choices__list[aria-expanded] .choices__item--selectable.is-highlighted[data-select-text]::after{right:auto;left:10px}}.choices__list--dropdown .choices__item--selectable.is-selected::after,.choices__list[aria-expanded] .choices__item--selectable.is-selected::after{content:none!important}.choices__list--dropdown .choices__item--selectable.is-highlighted,.choices__list--dropdown .choices__item--selectable.is-selected,.choices__list[aria-expanded] .choices__item--selectable.is-highlighted,.choices__list[aria-expanded] .choices__item--selectable.is-selected{background-color:var(--choices-highlighted-color, #f2f2f2)}.choices__item{cursor:default}.choices__item--selectable{cursor:pointer}.choices__item--disabled{cursor:not-allowed;-webkit-user-select:none;user-select:none;opacity:.5}.choices__heading{font-weight:600;font-size:12px;padding:10px;border-bottom:1px solid color-mix(in srgb,var(--choices-keyline-color, #ddd) 90%,var(--choices-lighten, white));color:gray}.choices__button{text-indent:-9999px;appearance:none;border:0;background-color:transparent;background-repeat:no-repeat;background-position:center;cursor:pointer}.choices__button:focus,.choices__input:focus{outline:0}.choices__input{display:inline-block;vertical-align:baseline;background-color:var(--choices-bg-color, #f9f9f9);font-size:var(--choices-font-size-md, 14px);margin-bottom:var(--choices-input-margin-bottom, 5px);border:0;border-radius:0;max-width:var(--choices-width, 100%);padding:var(--choices-input-padding, 4px 0 4px 2px)}.choices__input::-webkit-search-cancel-button,.choices__input::-webkit-search-decoration,.choices__input::-webkit-search-results-button,.choices__input::-webkit-search-results-decoration{display:none}.choices__input::-ms-clear,.choices__input::-ms-reveal{display:none;width:0;height:0}[dir=rtl] .choices__input{padding-right:2px;padding-left:0}.choices__placeholder{opacity:var(--choices-placeholder-opacity, 0.5)}`,""]);const f=u},6314:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i="",n=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),n&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),n&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i})).join("")},e.i=function(t,i,n,r,s){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(n)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var h=0;h<t.length;h++){var c=[].concat(t[h]);n&&o[c[0]]||(void 0!==s&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=s),i&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=i):c[2]=i),r&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=r):c[4]="".concat(r)),e.push(c))}},e}},4417:t=>{t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},1601:t=>{t.exports=function(t){return t[1]}},8133:t=>{t.exports=function(t){var r=[];return t.replace(i,(function(t,i,s){var o=i.toLowerCase();for(s=function(t){var e=t.match(n);return e?e.map(Number):[]}(s),"m"==o&&s.length>2&&(r.push([i].concat(s.splice(0,2))),o="l",i="m"==i?"l":"L");;){if(s.length==e[o])return s.unshift(i),r.push(s);if(s.length<e[o])throw new Error("malformed path data");r.push([i].concat(s.splice(0,e[o])))}})),r};var e={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=/([astvzqmhlc])([^astvzqmhlc]*)/gi;var n=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi},5585:t=>{var e=Object.prototype.hasOwnProperty,i="~";function n(){}function r(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,s||t,o),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,r=[];if(0===this._eventsCount)return r;for(n in t=this._events)e.call(t,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,s=n.length,o=new Array(s);r<s;r++)o[r]=n[r].fn;return o},a.prototype.listenerCount=function(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,r,s,o){var a=i?i+t:t;if(!this._events[a])return!1;var l,h,c=this._events[a],u=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,r),!0;case 5:return c.fn.call(c.context,e,n,r,s),!0;case 6:return c.fn.call(c.context,e,n,r,s,o),!0}for(h=1,l=new Array(u-1);h<u;h++)l[h-1]=arguments[h];c.fn.apply(c.context,l)}else{var d,p=c.length;for(h=0;h<p;h++)switch(c[h].once&&this.removeListener(t,c[h].fn,void 0,!0),u){case 1:c[h].fn.call(c[h].context);break;case 2:c[h].fn.call(c[h].context,e);break;case 3:c[h].fn.call(c[h].context,e,n);break;case 4:c[h].fn.call(c[h].context,e,n,r);break;default:if(!l)for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];c[h].fn.apply(c[h].context,l)}}return!0},a.prototype.on=function(t,e,i){return s(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return s(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,n,r){var s=i?i+t:t;if(!this._events[s])return this;if(!e)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==e||r&&!a.once||n&&a.context!==n||o(this,s);else{for(var l=0,h=[],c=a.length;l<c;l++)(a[l].fn!==e||r&&!a[l].once||n&&a[l].context!==n)&&h.push(a[l]);h.length?this._events[s]=1===h.length?h[0]:h:o(this,s)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&o(this,e)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,t.exports=a},5072:t=>{var e=[];function i(t){for(var i=-1,n=0;n<e.length;n++)if(e[n].identifier===t){i=n;break}return i}function n(t,n){for(var s={},o=[],a=0;a<t.length;a++){var l=t[a],h=n.base?l[0]+n.base:l[0],c=s[h]||0,u="".concat(h," ").concat(c);s[h]=c+1;var d=i(u),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(p);else{var f=r(p,n);n.byIndex=a,e.splice(a,0,{identifier:u,updater:f,references:1})}o.push(u)}return o}function r(t,e){var i=e.domAPI(e);i.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;i.update(t=e)}else i.remove()}}t.exports=function(t,r){var s=n(t=t||[],r=r||{});return function(t){t=t||[];for(var o=0;o<s.length;o++){var a=i(s[o]);e[a].references--}for(var l=n(t,r),h=0;h<s.length;h++){var c=i(s[h]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}s=l}}},7659:t=>{var e={};t.exports=function(t,i){var n=function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},540:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},5056:(t,e,i)=>{t.exports=function(t){var e=i.nc;e&&t.setAttribute("nonce",e)}},7825:t=>{t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(i){!function(t,e,i){var n="";i.supports&&(n+="@supports (".concat(i.supports,") {")),i.media&&(n+="@media ".concat(i.media," {"));var r=void 0!==i.layer;r&&(n+="@layer".concat(i.layer.length>0?" ".concat(i.layer):""," {")),n+=i.css,r&&(n+="}"),i.media&&(n+="}"),i.supports&&(n+="}");var s=i.sourceMap;s&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleTagTransform(n,t,e.options)}(e,t,i)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},1113:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},4002:t=>{t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg=="},2653:t=>{t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg=="},2406:(t,e,i)=>{i.d(e,{z:()=>n});const n=(t,e,i=!1)=>(Array.isArray(t)||(t=[t]),e?t.map((t=>"string"==typeof t||i?e(t):t)):t)},2577:(t,e,i)=>{i.d(e,{Q:()=>I});var n={grad:.9,turn:360,rad:360/(2*Math.PI)},r=function(t){return"string"==typeof t?t.length>0:"number"==typeof t},s=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=Math.pow(10,e)),Math.round(i*t)/i+0},o=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=1),t>i?i:t>e?t:e},a=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},l=function(t){return{r:o(t.r,0,255),g:o(t.g,0,255),b:o(t.b,0,255),a:o(t.a)}},h=function(t){return{r:s(t.r),g:s(t.g),b:s(t.b),a:s(t.a,3)}},c=/^#([0-9a-f]{3,8})$/i,u=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},d=function(t){var e=t.r,i=t.g,n=t.b,r=t.a,s=Math.max(e,i,n),o=s-Math.min(e,i,n),a=o?s===e?(i-n)/o:s===i?2+(n-e)/o:4+(e-i)/o:0;return{h:60*(a<0?a+6:a),s:s?o/s*100:0,v:s/255*100,a:r}},p=function(t){var e=t.h,i=t.s,n=t.v,r=t.a;e=e/360*6,i/=100,n/=100;var s=Math.floor(e),o=n*(1-i),a=n*(1-(e-s)*i),l=n*(1-(1-e+s)*i),h=s%6;return{r:255*[n,a,o,o,l,n][h],g:255*[l,n,n,a,o,o][h],b:255*[o,o,l,n,n,a][h],a:r}},f=function(t){return{h:a(t.h),s:o(t.s,0,100),l:o(t.l,0,100),a:o(t.a)}},m=function(t){return{h:s(t.h),s:s(t.s),l:s(t.l),a:s(t.a,3)}},y=function(t){return p((i=(e=t).s,{h:e.h,s:(i*=((n=e.l)<50?n:100-n)/100)>0?2*i/(n+i)*100:0,v:n+i,a:e.a}));var e,i,n},g=function(t){return{h:(e=d(t)).h,s:(r=(200-(i=e.s))*(n=e.v)/100)>0&&r<200?i*n/100/(r<=100?r:200-r)*100:0,l:r/2,a:e.a};var e,i,n,r},v=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,b=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,x=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,w={string:[[function(t){var e=c.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:4===t.length?s(parseInt(t[3]+t[3],16)/255,2):1}:6===t.length||8===t.length?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:8===t.length?s(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=x.exec(t)||_.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:l({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:void 0===e[7]?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=v.exec(t)||b.exec(t);if(!e)return null;var i,r,s=f({h:(i=e[1],r=e[2],void 0===r&&(r="deg"),Number(i)*(n[r]||1)),s:Number(e[3]),l:Number(e[4]),a:void 0===e[5]?1:Number(e[5])/(e[6]?100:1)});return y(s)},"hsl"]],object:[[function(t){var e=t.r,i=t.g,n=t.b,s=t.a,o=void 0===s?1:s;return r(e)&&r(i)&&r(n)?l({r:Number(e),g:Number(i),b:Number(n),a:Number(o)}):null},"rgb"],[function(t){var e=t.h,i=t.s,n=t.l,s=t.a,o=void 0===s?1:s;if(!r(e)||!r(i)||!r(n))return null;var a=f({h:Number(e),s:Number(i),l:Number(n),a:Number(o)});return y(a)},"hsl"],[function(t){var e=t.h,i=t.s,n=t.v,s=t.a,l=void 0===s?1:s;if(!r(e)||!r(i)||!r(n))return null;var h=function(t){return{h:a(t.h),s:o(t.s,0,100),v:o(t.v,0,100),a:o(t.a)}}({h:Number(e),s:Number(i),v:Number(n),a:Number(l)});return p(h)},"hsv"]]},S=function(t,e){for(var i=0;i<e.length;i++){var n=e[i][0](t);if(n)return[n,e[i][1]]}return[null,void 0]},C=function(t){return"string"==typeof t?S(t.trim(),w.string):"object"==typeof t&&null!==t?S(t,w.object):[null,void 0]},E=function(t,e){var i=g(t);return{h:i.h,s:o(i.s+100*e,0,100),l:i.l,a:i.a}},k=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},A=function(t,e){var i=g(t);return{h:i.h,s:i.s,l:o(i.l+100*e,0,100),a:i.a}},T=function(){function t(t){this.parsed=C(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return null!==this.parsed},t.prototype.brightness=function(){return s(k(this.rgba),2)},t.prototype.isDark=function(){return k(this.rgba)<.5},t.prototype.isLight=function(){return k(this.rgba)>=.5},t.prototype.toHex=function(){return e=(t=h(this.rgba)).r,i=t.g,n=t.b,o=(r=t.a)<1?u(s(255*r)):"","#"+u(e)+u(i)+u(n)+o;var t,e,i,n,r,o},t.prototype.toRgb=function(){return h(this.rgba)},t.prototype.toRgbString=function(){return e=(t=h(this.rgba)).r,i=t.g,n=t.b,(r=t.a)<1?"rgba("+e+", "+i+", "+n+", "+r+")":"rgb("+e+", "+i+", "+n+")";var t,e,i,n,r},t.prototype.toHsl=function(){return m(g(this.rgba))},t.prototype.toHslString=function(){return e=(t=m(g(this.rgba))).h,i=t.s,n=t.l,(r=t.a)<1?"hsla("+e+", "+i+"%, "+n+"%, "+r+")":"hsl("+e+", "+i+"%, "+n+"%)";var t,e,i,n,r},t.prototype.toHsv=function(){return t=d(this.rgba),{h:s(t.h),s:s(t.s),v:s(t.v),a:s(t.a,3)};var t},t.prototype.invert=function(){return M({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},t.prototype.saturate=function(t){return void 0===t&&(t=.1),M(E(this.rgba,t))},t.prototype.desaturate=function(t){return void 0===t&&(t=.1),M(E(this.rgba,-t))},t.prototype.grayscale=function(){return M(E(this.rgba,-1))},t.prototype.lighten=function(t){return void 0===t&&(t=.1),M(A(this.rgba,t))},t.prototype.darken=function(t){return void 0===t&&(t=.1),M(A(this.rgba,-t))},t.prototype.rotate=function(t){return void 0===t&&(t=15),this.hue(this.hue()+t)},t.prototype.alpha=function(t){return"number"==typeof t?M({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):s(this.rgba.a,3);var e},t.prototype.hue=function(t){var e=g(this.rgba);return"number"==typeof t?M({h:t,s:e.s,l:e.l,a:e.a}):s(e.h)},t.prototype.isEqual=function(t){return this.toHex()===M(t).toHex()},t}(),M=function(t){return t instanceof T?t:new T(t)},P=[];!function(t){t.forEach((function(t){P.indexOf(t)<0&&(t(T,w),P.push(t))}))}([function(t,e){var i={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},n={};for(var r in i)n[i[r]]=r;var s={};t.prototype.toName=function(e){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var r,o,a=n[this.toHex()];if(a)return a;if(null==e?void 0:e.closest){var l=this.toRgb(),h=1/0,c="black";if(!s.length)for(var u in i)s[u]=new t(i[u]).toRgb();for(var d in i){var p=(r=l,o=s[d],Math.pow(r.r-o.r,2)+Math.pow(r.g-o.g,2)+Math.pow(r.b-o.b,2));p<h&&(h=p,c=d)}return c}},e.string.push([function(e){var n=e.toLowerCase(),r="transparent"===n?"#0000":i[n];return r?new t(r).toRgb():null},"name"])}]);const O=class t{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(e){if(e instanceof t)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(null===e)throw new Error("Cannot set Color#value to null");null!==this._value&&this._isSourceEqual(this._value,e)||(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return"string"==typeof t||"number"==typeof t||t instanceof Number||null===t?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):"object"==typeof t&&null!==t?{...t}:t}_isSourceEqual(t,e){const i=typeof t;if(i!==typeof e)return!1;if("number"===i||"string"===i||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length===e.length&&t.every(((t,i)=>t===e[i]));if(null!==t&&null!==e){const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>t[i]===e[i]))}return t===e}toRgba(){const[t,e,i,n]=this._components;return{r:t,g:e,b:i,a:n}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,n]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(255*e),t[1]=Math.round(255*i),t[2]=Math.round(255*n),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[e,i,n,r]=this._components;return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[e,i,n]=this._components;return t[0]=e,t[1]=i,t[2]=n,t}toNumber(){return this._int}toBgrNumber(){const[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(65280&t)+((255&t)<<16)}multiply(e){const[i,n,r,s]=t._temp.setValue(e)._components;return this._components[0]*=i,this._components[1]*=n,this._components[2]*=r,this._components[3]*=s,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(1===t)return(255<<24)+this._int;if(0===t)return e?0:this._int;let i=this._int>>16&255,n=this._int>>8&255,r=255&this._int;return e&&(i=i*t+.5|0,n=n*t+.5|0,r=r*t+.5|0),(255*t<<24)+(i<<16)+(n<<8)+r}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(255*this._components[3]).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this._value=null,this}_normalize(e){let i,n,r,s;if(("number"==typeof e||e instanceof Number)&&e>=0&&e<=16777215){i=(e>>16&255)/255,n=(e>>8&255)/255,r=(255&e)/255,s=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[i,n,r,s=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[i,n,r,s=255]=e,i/=255,n/=255,r/=255,s/=255;else if("string"==typeof e||"object"==typeof e){if("string"==typeof e){const i=t.HEX_PATTERN.exec(e);i&&(e=`#${i[2]}`)}const o=M(e);o.isValid()&&(({r:i,g:n,b:r,a:s}=o.rgba),i/=255,n/=255,r/=255)}if(void 0===i)throw new Error(`Unable to convert color ${e}`);this._components[0]=i,this._components[1]=n,this._components[2]=r,this._components[3]=s,this._refreshInt()}_refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(255*t<<16)+(255*e<<8)+(255*i|0)}_clamp(t,e=0,i=1){return"number"==typeof t?Math.min(Math.max(t,e),i):(t.forEach(((n,r)=>{t[r]=Math.min(Math.max(n,e),i)})),t)}static isColorLike(e){return"number"==typeof e||"string"==typeof e||e instanceof Number||e instanceof t||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||void 0!==e.r&&void 0!==e.g&&void 0!==e.b||void 0!==e.r&&void 0!==e.g&&void 0!==e.b&&void 0!==e.a||void 0!==e.h&&void 0!==e.s&&void 0!==e.l||void 0!==e.h&&void 0!==e.s&&void 0!==e.l&&void 0!==e.a||void 0!==e.h&&void 0!==e.s&&void 0!==e.v||void 0!==e.h&&void 0!==e.s&&void 0!==e.v&&void 0!==e.a}};O.shared=new O,O._temp=new O,O.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let I=O},1761:(t,e,i)=>{i.d(e,{e:()=>s});const n={createCanvas:(t,e)=>{const i=document.createElement("canvas");return i.width=t,i.height=e,i},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>(new DOMParser).parseFromString(t,"text/xml")};let r=n;const s={get:()=>r,set(t){r=t}}},8507:(t,e,i)=>{i.d(e,{Ag:()=>n,XO:()=>o});var n=(t=>(t.Application="application",t.WebGLPipes="webgl-pipes",t.WebGLPipesAdaptor="webgl-pipes-adaptor",t.WebGLSystem="webgl-system",t.WebGPUPipes="webgpu-pipes",t.WebGPUPipesAdaptor="webgpu-pipes-adaptor",t.WebGPUSystem="webgpu-system",t.CanvasSystem="canvas-system",t.CanvasPipesAdaptor="canvas-pipes-adaptor",t.CanvasPipes="canvas-pipes",t.Asset="asset",t.LoadParser="load-parser",t.ResolveParser="resolve-parser",t.CacheParser="cache-parser",t.DetectionParser="detection-parser",t.MaskEffect="mask-effect",t.BlendMode="blend-mode",t.TextureSource="texture-source",t.Environment="environment",t.ShapeBuilder="shape-builder",t.Batcher="batcher",t))(n||{});const r=t=>{if("function"==typeof t||"object"==typeof t&&t.extension){if(!t.extension)throw new Error("Extension class must have an extension object");t={..."object"!=typeof t.extension?{type:t.extension}:t.extension,ref:t}}if("object"!=typeof t)throw new Error("Invalid extension type");return"string"==typeof(t={...t}).type&&(t.type=[t.type]),t},s=(t,e)=>r(t).priority??e,o={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(r).forEach((t=>{t.type.forEach((e=>this._removeHandlers[e]?.(t)))})),this},add(...t){return t.map(r).forEach((t=>{t.type.forEach((e=>{const i=this._addHandlers,n=this._queue;i[e]?i[e]?.(t):(n[e]=n[e]||[],n[e]?.push(t))}))})),this},handle(t,e,i){const n=this._addHandlers,r=this._removeHandlers;if(n[t]||r[t])throw new Error(`Extension type ${t} already has a handler`);n[t]=e,r[t]=i;const s=this._queue;return s[t]&&(s[t]?.forEach((t=>e(t))),delete s[t]),this},handleByMap(t,e){return this.handle(t,(t=>{t.name&&(e[t.name]=t.ref)}),(t=>{t.name&&delete e[t.name]}))},handleByNamedList(t,e,i=-1){return this.handle(t,(t=>{e.findIndex((e=>e.name===t.name))>=0||(e.push({name:t.name,value:t.ref}),e.sort(((t,e)=>s(e.value,i)-s(t.value,i))))}),(t=>{const i=e.findIndex((e=>e.name===t.name));-1!==i&&e.splice(i,1)}))},handleByList(t,e,i=-1){return this.handle(t,(t=>{e.includes(t.ref)||(e.push(t.ref),e.sort(((t,e)=>s(e,i)-s(t,i))))}),(t=>{const i=e.indexOf(t.ref);-1!==i&&e.splice(i,1)}))},mixin(t,...e){for(const i of e)Object.defineProperties(t.prototype,Object.getOwnPropertyDescriptors(i))}}},9049:(t,e,i)=>{i.d(e,{a:()=>n});class n{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}},9313:(t,e,i)=>{i.d(e,{u:()=>s});var n=i(1652),r=i(5101);class s{constructor(t=1,e=0,i=0,n=1,r=0,s=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=n,this.tx=r,this.ty=s}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,n,r,s){return this.a=t,this.b=e,this.c=i,this.d=n,this.tx=r,this.ty=s,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new r.b;const i=t.x,n=t.y;return e.x=this.a*i+this.c*n+this.tx,e.y=this.b*i+this.d*n+this.ty,e}applyInverse(t,e){e=e||new r.b;const i=this.a,n=this.b,s=this.c,o=this.d,a=this.tx,l=this.ty,h=1/(i*o+s*-n),c=t.x,u=t.y;return e.x=o*h*c+-s*h*u+(l*s-a*o)*h,e.y=i*h*u+-n*h*c+(-l*i+a*n)*h,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.a,r=this.c,s=this.tx;return this.a=n*e-this.b*i,this.b=n*i+this.b*e,this.c=r*e-this.d*i,this.d=r*i+this.d*e,this.tx=s*e-this.ty*i,this.ty=s*i+this.ty*e,this}append(t){const e=this.a,i=this.b,n=this.c,r=this.d;return this.a=t.a*e+t.b*n,this.b=t.a*i+t.b*r,this.c=t.c*e+t.d*n,this.d=t.c*i+t.d*r,this.tx=t.tx*e+t.ty*n+this.tx,this.ty=t.tx*i+t.ty*r+this.ty,this}appendFrom(t,e){const i=t.a,n=t.b,r=t.c,s=t.d,o=t.tx,a=t.ty,l=e.a,h=e.b,c=e.c,u=e.d;return this.a=i*l+n*c,this.b=i*h+n*u,this.c=r*l+s*c,this.d=r*h+s*u,this.tx=o*l+a*c+e.tx,this.ty=o*h+a*u+e.ty,this}setTransform(t,e,i,n,r,s,o,a,l){return this.a=Math.cos(o+l)*r,this.b=Math.sin(o+l)*r,this.c=-Math.sin(o-a)*s,this.d=Math.cos(o-a)*s,this.tx=t-(i*this.a+n*this.c),this.ty=e-(i*this.b+n*this.d),this}prepend(t){const e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){const e=this.a,i=this.c;this.a=e*t.a+this.b*t.c,this.b=e*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,r=this.c,s=this.d,o=t.pivot,a=-Math.atan2(-r,s),l=Math.atan2(i,e),h=Math.abs(a+l);return h<1e-5||Math.abs(n.TO-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(r*r+s*s),t.position.x=this.tx+(o.x*e+o.y*r),t.position.y=this.ty+(o.x*i+o.y*s),t}invert(){const t=this.a,e=this.b,i=this.c,n=this.d,r=this.tx,s=t*n-e*i;return this.a=n/s,this.b=-e/s,this.c=-i/s,this.d=t/s,this.tx=(i*this.ty-n*r)/s,this.ty=-(t*this.ty-e*r)/s,this}isIdentity(){return 1===this.a&&0===this.b&&0===this.c&&1===this.d&&0===this.tx&&0===this.ty}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new s;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return a.identity()}static get shared(){return o.identity()}}const o=new s,a=new s},2079:(t,e,i)=>{i.d(e,{E:()=>u});var n=i(9313);const r=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],s=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],o=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],a=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],l=[],h=[],c=Math.sign;!function(){for(let t=0;t<16;t++){const e=[];l.push(e);for(let i=0;i<16;i++){const n=c(r[t]*r[i]+o[t]*s[i]),l=c(s[t]*r[i]+a[t]*s[i]),h=c(r[t]*o[i]+o[t]*a[i]),u=c(s[t]*o[i]+a[t]*a[i]);for(let t=0;t<16;t++)if(r[t]===n&&s[t]===l&&o[t]===h&&a[t]===u){e.push(t);break}}}for(let t=0;t<16;t++){const e=new n.u;e.set(r[t],s[t],o[t],a[t],0,0),h.push(e)}}();const u={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:t=>r[t],uY:t=>s[t],vX:t=>o[t],vY:t=>a[t],inv:t=>8&t?15&t:7&-t,add:(t,e)=>l[t][e],sub:(t,e)=>l[t][u.inv(e)],rotate180:t=>4^t,isVertical:t=>2==(3&t),byDirection:(t,e)=>2*Math.abs(t)<=Math.abs(e)?e>=0?u.S:u.N:2*Math.abs(e)<=Math.abs(t)?t>0?u.E:u.W:e>0?t>0?u.SE:u.SW:t>0?u.NE:u.NW,matrixAppendRotationInv:(t,e,i=0,n=0,r=0,s=0)=>{const o=h[u.inv(e)],a=o.a,l=o.b,c=o.c,d=o.d,p=i-Math.min(0,a*r,c*s,a*r+c*s),f=n-Math.min(0,l*r,d*s,l*r+d*s),m=t.a,y=t.b,g=t.c,v=t.d;t.a=a*m+l*g,t.b=a*y+l*v,t.c=c*m+d*g,t.d=c*y+d*v,t.tx=p*m+f*g+t.tx,t.ty=p*y+f*v+t.ty},transformRectCoords:(t,e,i,n)=>{const{x:r,y:s,width:o,height:a}=t,{x:l,y:h,width:c,height:d}=e;return i===u.E?(n.set(r+l,s+h,o,a),n):i===u.S?n.set(c-s-a+l,r+h,a,o):i===u.W?n.set(c-r-o+l,d-s-a+h,o,a):i===u.N?n.set(s+l,d-r-o+h,a,o):n.set(r+l,s+h,o,a)}}},1652:(t,e,i)=>{i.d(e,{TO:()=>n,Td:()=>s,bO:()=>r});const n=2*Math.PI,r=180/Math.PI,s=Math.PI/180},9939:(t,e,i)=>{function n(t){return t+=0===t?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function r(t){return!(t&t-1||!t)}i.d(e,{U5:()=>n,f3:()=>r})},2812:(t,e,i)=>{i.d(e,{o:()=>n});class n{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new n(t??this._observer,this._x,this._y)}set(t=0,e=t){return this._x===t&&this._y===e||(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}},5101:(t,e,i)=>{i.d(e,{b:()=>n});class n{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new n(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return r.x=0,r.y=0,r}}const r=new n},6125:(t,e,i)=>{i.d(e,{j:()=>r});var n=i(9252);class r{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new r(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let n=this.x-t,r=this.y-e;return n*=n,r*=r,n+r<=i}strokeContains(t,e,i,n=.5){if(0===this.radius)return!1;const r=this.x-t,s=this.y-e,o=this.radius,a=(1-n)*i,l=Math.sqrt(r*r+s*s);return l<=o+a&&l>o-(i-a)}getBounds(t){return t||(t=new n.M),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=2*this.radius,t.height=2*this.radius,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}},9252:(t,e,i)=>{i.d(e,{M:()=>s});var n=i(5101);const r=[new n.b,new n.b,new n.b,new n.b];class s{constructor(t=0,e=0,i=0,n=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(n)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new s(0,0,0,0)}clone(){return new s(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height)}strokeContains(t,e,i,n=.5){const{width:r,height:s}=this;if(r<=0||s<=0)return!1;const o=this.x,a=this.y,l=i*(1-n),h=i-l;return t>=o-l&&t<=o+r+l&&e>=a-l&&e<=a+s+l&&!(t>o+h&&t<o+r-h&&e>a+h&&e<a+s-h)}intersects(t,e){if(!e){const e=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=e)return!1;const i=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>i}const i=this.left,n=this.right,s=this.top,o=this.bottom;if(n<=i||o<=s)return!1;const a=r[0].set(t.left,t.top),l=r[1].set(t.left,t.bottom),h=r[2].set(t.right,t.top),c=r[3].set(t.right,t.bottom);if(h.x<=a.x||l.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(0===u)return!1;if(e.apply(a,a),e.apply(l,l),e.apply(h,h),e.apply(c,c),Math.max(a.x,l.x,h.x,c.x)<=i||Math.min(a.x,l.x,h.x,c.x)>=n||Math.max(a.y,l.y,h.y,c.y)<=s||Math.min(a.y,l.y,h.y,c.y)>=o)return!1;const d=u*(l.y-a.y),p=u*(a.x-l.x),f=d*i+p*s,m=d*n+p*s,y=d*i+p*o,g=d*n+p*o;if(Math.max(f,m,y,g)<=d*a.x+p*a.y||Math.min(f,m,y,g)>=d*c.x+p*c.y)return!1;const v=u*(a.y-h.y),b=u*(h.x-a.x),x=v*i+b*s,_=v*n+b*s,w=v*i+b*o,S=v*n+b*o;return!(Math.max(x,_,w,S)<=v*a.x+b*a.y||Math.min(x,_,w,S)>=v*c.x+b*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),n=Math.max(this.y,t.y),r=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=n,this.height=Math.max(r-n,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,n=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=n-this.y,this}scale(t,e=t){return this.x*=t,this.y*=e,this.width*=t,this.height*=e,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),n=Math.min(this.y,t.y),r=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=n,this.height=r-n,this}getBounds(t){return t||(t=new s),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const e=t.x,i=t.y,n=t.x+t.width,r=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<this.y+this.height&&n>=this.x&&n<this.x+this.width&&r>=this.y&&r<this.y+this.height}set(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}},6512:(t,e,i)=>{i.d(e,{u:()=>s});const n=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n");function r(t){let e="";for(let i=0;i<t;++i)i>0&&(e+="\nelse "),i<t-1&&(e+=`if(test == ${i}.0){}`);return e}function s(t,e){if(0===t)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const i=e.createShader(e.FRAGMENT_SHADER);try{for(;;){const s=n.replace(/%forloop%/gi,r(t));if(e.shaderSource(i,s),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))break;t=t/2|0}}finally{e.deleteShader(i)}return t}},341:(t,e,i)=>{i.d(e,{w:()=>o});var n=i(3513),r=i(5589);const s={};function o(t,e,i){let o=2166136261;for(let i=0;i<e;i++)o^=t[i].uid,o=Math.imul(o,16777619),o>>>=0;return s[o]||function(t,e,i,o){const a={};let l=0;for(let i=0;i<o;i++){const n=i<e?t[i]:r.g.EMPTY.source;a[l++]=n.source,a[l++]=n.style}const h=new n.T(a);return s[i]=h,h}(t,e,o,i)}},2043:(t,e,i)=>{i.d(e,{J:()=>F});var n=i(8507),r=i(133);class s{constructor(t){"number"==typeof t?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}var o=i(4670),a=i(6083),l=i(6736),h=i(1957);function c(t,e){return"no-premultiply-alpha"===e.alphaMode&&h.Q[t]||t}var u=i(3804),d=i(6512);let p=null;class f{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}class m{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new f,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null,this.elements=null}}const y=[];let g=0;function v(){return g>0?y[--g]:new m}function b(t){t.elements=null,y[g++]=t}a.L.register({clear:()=>{if(y.length>0)for(const t of y)t&&t.destroy();y.length=0,g=0}});let x=0;const _=class t{constructor(e){this.uid=(0,r.L)("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],(e={...t.defaultOptions,...e}).maxTextures||((0,o.t6)("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),e.maxTextures=function(){if(p)return p;const t=(0,u.W)();return p=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),p=(0,d.u)(p,t),t.getExtension("WEBGL_lose_context")?.loseContext(),p}());const{maxTextures:i,attributesInitialSize:n,indicesInitialSize:a}=e;this.attributeBuffer=new s(4*n),this.indexBuffer=new Uint16Array(a),this.maxTextures=i}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)b(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){const i=t._batch.textures.ids[e._source.uid];return!(!i&&0!==i)&&(t._textureId=i,t.texture=e,!0)}updateElement(t){this.dirty=!0;const e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){const e=this._elements;if(!e[this.elementStart])return;let i=v(),n=i.textures;n.clear();const r=e[this.elementStart];let s=c(r.blendMode,r.texture._source),o=r.topology;4*this.attributeSize>this.attributeBuffer.size&&this._resizeAttributeBuffer(4*this.attributeSize),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const a=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,h=this.indexBuffer;let u=this._batchIndexSize,d=this._batchIndexStart,p="startBatch",f=[];const m=this.maxTextures;for(let r=this.elementStart;r<this.elementSize;++r){const y=e[r];e[r]=null;const g=y.texture._source,b=c(y.blendMode,g),_=s!==b||o!==y.topology;g._batchTick!==x||_?(g._batchTick=x,(n.count>=m||_)&&(this._finishBatch(i,d,u-d,n,s,o,t,p,f),p="renderBatch",d=u,s=b,o=y.topology,i=v(),n=i.textures,n.clear(),f=[],++x),y._textureId=g._textureBindLocation=n.count,n.ids[g.uid]=n.count,n.textures[n.count++]=g,y._batch=i,f.push(y),u+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,a,l,y._attributeStart,y._textureId),this.packQuadIndex(h,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,a,l,y._attributeStart,y._textureId),this.packIndex(y,h,y._indexStart,y._attributeStart/this.vertexSize))):(y._textureId=g._textureBindLocation,u+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,a,l,y._attributeStart,y._textureId),this.packQuadIndex(h,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,a,l,y._attributeStart,y._textureId),this.packIndex(y,h,y._indexStart,y._attributeStart/this.vertexSize)),y._batch=i,f.push(y))}n.count>0&&(this._finishBatch(i,d,u-d,n,s,o,t,p,f),d=u,++x),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,i,n,r,s,o,a,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=a,t.batcher=this,t.textures=n,t.blendMode=r,t.topology=s,t.start=e,t.size=i,t.elements=l,++x,this.batches[this.batchIndex++]=t,o.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){4*t<=this.attributeBuffer.size||this._resizeAttributeBuffer(4*t)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,2*this.attributeBuffer.size),i=new s(e);(0,l.W)(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){const e=this.indexBuffer;let i=Math.max(t,1.5*e.length);i+=i%2;const n=i>65535?new Uint32Array(i):new Uint16Array(i);if(n.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let t=0;t<e.length;t++)n[t]=e[t];else(0,l.W)(e.buffer,n.buffer);this.indexBuffer=n}packQuadIndex(t,e,i){t[e]=i+0,t[e+1]=i+1,t[e+2]=i+2,t[e+3]=i+0,t[e+4]=i+2,t[e+5]=i+3}packIndex(t,e,i,n){const r=t.indices,s=t.indexSize,o=t.indexOffset,a=t.attributeOffset;for(let t=0;t<s;t++)e[i++]=n+r[t+o]-a}destroy(t={}){if(null!==this.batches){for(let t=0;t<this.batchIndex;t++)b(this.batches[t]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,t.shader&&(this.shader?.destroy(),this.shader=null);for(let t=0;t<this._elements.length;t++)this._elements[t]&&(this._elements[t]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};_.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let w=_;var S=i(949),C=i(1132),E=i(6011);const k=new Float32Array(1),A=new Uint32Array(1);class T extends E.V{constructor(){const t=new S.h({data:k,label:"attribute-batch-buffer",usage:C.S.VERTEX|C.S.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:24,offset:0},aUV:{buffer:t,format:"float32x2",stride:24,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:24,offset:16},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:24,offset:20}},indexBuffer:new S.h({data:A,label:"index-batch-buffer",usage:C.S.INDEX|C.S.COPY_DST,shrinkToFit:!1})})}}var M=i(5611),P=i(4459),O=i(4e3),I=i(6665),L=i(6040),R=i(8475);class j extends R.M{constructor(t){super({glProgram:(0,M.I)({name:"batch",bits:[P.a,(0,O.P)(t),I.m]}),gpuProgram:(0,M.v)({name:"batch",bits:[P.F,(0,O._)(t),I.b]}),resources:{batchSamplers:(0,L.n)(t)}}),this.maxTextures=t}}let D=null;const N=class t extends w{constructor(e){super(e),this.geometry=new T,this.name=t.extension.name,this.vertexSize=6,D??(D=new j(e.maxTextures)),this.shader=D}packAttributes(t,e,i,n,r){const s=r<<16|65535&t.roundPixels,o=t.transform,a=o.a,l=o.b,h=o.c,c=o.d,u=o.tx,d=o.ty,{positions:p,uvs:f}=t,m=t.color,y=t.attributeOffset,g=y+t.attributeSize;for(let t=y;t<g;t++){const r=2*t,o=p[r],y=p[r+1];e[n++]=a*o+h*y+u,e[n++]=c*y+l*o+d,e[n++]=f[r],e[n++]=f[r+1],i[n++]=m,i[n++]=s}}packQuadAttributes(t,e,i,n,r){const s=t.texture,o=t.transform,a=o.a,l=o.b,h=o.c,c=o.d,u=o.tx,d=o.ty,p=t.bounds,f=p.maxX,m=p.minX,y=p.maxY,g=p.minY,v=s.uvs,b=t.color,x=r<<16|65535&t.roundPixels;e[n+0]=a*m+h*g+u,e[n+1]=c*g+l*m+d,e[n+2]=v.x0,e[n+3]=v.y0,i[n+4]=b,i[n+5]=x,e[n+6]=a*f+h*g+u,e[n+7]=c*g+l*f+d,e[n+8]=v.x1,e[n+9]=v.y1,i[n+10]=b,i[n+11]=x,e[n+12]=a*f+h*y+u,e[n+13]=c*y+l*f+d,e[n+14]=v.x2,e[n+15]=v.y2,i[n+16]=b,i[n+17]=x,e[n+18]=a*m+h*y+u,e[n+19]=c*y+l*m+d,e[n+20]=v.x3,e[n+21]=v.y3,i[n+22]=b,i[n+23]=x}_updateMaxTextures(t){this.shader.maxTextures!==t&&(D=new j(t),this.shader=D)}destroy(){this.shader=null,super.destroy()}};N.extension={type:[n.Ag.Batcher],name:"default"};let F=N},5611:(t,e,i)=>{i.d(e,{I:()=>A,v:()=>k});var n=i(9113),r=i(3012),s=i(268);function o(t,e,i){if(t)for(const n in t){const r=e[n.toLocaleLowerCase()];if(r){let e=t[n];"header"===n&&(e=e.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),i&&r.push(`//----${i}----//`),r.push(e)}else(0,s.R)(`${n} placement hook does not exist in shader`)}}const a=/\{\{(.*?)\}\}/g;function l(t){const e={};return(t.match(a)?.map((t=>t.replace(/[{()}]/g,"")))??[]).forEach((t=>{e[t]=[]})),e}function h(t,e){let i;const n=/@in\s+([^;]+);/g;for(;null!==(i=n.exec(t));)e.push(i[1])}function c(t,e,i=!1){const n=[];h(e,n),t.forEach((t=>{t.header&&h(t.header,n)}));const r=n;i&&r.sort();const s=r.map(((t,e)=>` @location(${e}) ${t},`)).join("\n");let o=e.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`\n${s}\n`),o}function u(t,e){let i;const n=/@out\s+([^;]+);/g;for(;null!==(i=n.exec(t));)e.push(i[1])}function d(t,e){let i=t;for(const t in e){const n=e[t];i=n.join("\n").length?i.replace(`{{${t}}}`,`//-----${t} START-----//\n${n.join("\n")}\n//----${t} FINISH----//`):i.replace(`{{${t}}}`,"")}return i}const p=Object.create(null),f=new Map;let m=0;function y({template:t,bits:e}){const i=v(t,e);if(p[i])return p[i];const{vertex:n,fragment:r}=function(t,e){const i=e.map((t=>t.vertex)).filter((t=>!!t)),n=e.map((t=>t.fragment)).filter((t=>!!t));let r=c(i,t.vertex,!0);r=function(t,e){const i=[];u(e,i),t.forEach((t=>{t.header&&u(t.header,i)}));let n=0;const r=i.sort().map((t=>t.indexOf("builtin")>-1?t:`@location(${n++}) ${t}`)).join(",\n"),s=i.sort().map((t=>{return` var ${e=t,e.replace(/@.*?\s+/g,"")};`;var e})).join("\n"),o=`return VSOutput(\n ${i.sort().map((t=>` ${function(t){const e=/\b(\w+)\s*:/g.exec(t);return e?e[1]:""}(t)}`)).join(",\n")});`;let a=e.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`\n${r}\n`),a=a.replace("{{start}}",`\n${s}\n`),a=a.replace("{{return}}",`\n${o}\n`),a}(i,r);const s=c(n,t.fragment,!0);return{vertex:r,fragment:s}}(t,e);return p[i]=b(n,r,e),p[i]}function g({template:t,bits:e}){const i=v(t,e);return p[i]||(p[i]=b(t.vertex,t.fragment,e)),p[i]}function v(t,e){return e.map((t=>(f.has(t)||f.set(t,m++),f.get(t)))).sort(((t,e)=>t-e)).join("-")+t.vertex+t.fragment}function b(t,e,i){const n=l(t),r=l(e);return i.forEach((t=>{o(t.vertex,n,t.name),o(t.fragment,r,t.name)})),{vertex:d(t,n),fragment:d(e,r)}}const x="\n @in aPosition: vec2<f32>;\n @in aUV: vec2<f32>;\n\n @out @builtin(position) vPosition: vec4<f32>;\n @out vUV : vec2<f32>;\n @out vColor : vec4<f32>;\n\n {{header}}\n\n struct VSOutput {\n {{struct}}\n };\n\n @vertex\n fn main( {{in}} ) -> VSOutput {\n\n var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;\n var modelMatrix = mat3x3<f32>(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n );\n var position = aPosition;\n var uv = aUV;\n\n {{start}}\n\n vColor = vec4<f32>(1., 1., 1., 1.);\n\n {{main}}\n\n vUV = uv;\n\n var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;\n\n vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);\n\n vColor *= globalUniforms.uWorldColorAlpha;\n\n {{end}}\n\n {{return}}\n };\n",_="\n @in vUV : vec2<f32>;\n @in vColor : vec4<f32>;\n\n {{header}}\n\n @fragment\n fn main(\n {{in}}\n ) -> @location(0) vec4<f32> {\n\n {{start}}\n\n var outColor:vec4<f32>;\n\n {{main}}\n\n var finalColor:vec4<f32> = outColor * vColor;\n\n {{end}}\n\n return finalColor;\n };\n",w="\n in vec2 aPosition;\n in vec2 aUV;\n\n out vec4 vColor;\n out vec2 vUV;\n\n {{header}}\n\n void main(void){\n\n mat3 worldTransformMatrix = uWorldTransformMatrix;\n mat3 modelMatrix = mat3(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n );\n vec2 position = aPosition;\n vec2 uv = aUV;\n\n {{start}}\n\n vColor = vec4(1.);\n\n {{main}}\n\n vUV = uv;\n\n mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;\n\n gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n\n vColor *= uWorldColorAlpha;\n\n {{end}}\n }\n",S="\n\n in vec4 vColor;\n in vec2 vUV;\n\n out vec4 finalColor;\n\n {{header}}\n\n void main(void) {\n\n {{start}}\n\n vec4 outColor;\n\n {{main}}\n\n finalColor = outColor * vColor;\n\n {{end}}\n }\n",C={name:"global-uniforms-bit",vertex:{header:"\n struct GlobalUniforms {\n uProjectionMatrix:mat3x3<f32>,\n uWorldTransformMatrix:mat3x3<f32>,\n uWorldColorAlpha: vec4<f32>,\n uResolution: vec2<f32>,\n }\n\n @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;\n "}},E={name:"global-uniforms-bit",vertex:{header:"\n uniform mat3 uProjectionMatrix;\n uniform mat3 uWorldTransformMatrix;\n uniform vec4 uWorldColorAlpha;\n uniform vec2 uResolution;\n "}};function k({bits:t,name:e}){const i=y({template:{fragment:_,vertex:x},bits:[C,...t]});return r.B.from({name:e,vertex:{source:i.vertex,entryPoint:"main"},fragment:{source:i.fragment,entryPoint:"main"}})}function A({bits:t,name:e}){return new n.M({name:e,...g({template:{vertex:w,fragment:S},bits:[E,...t]})})}},4459:(t,e,i)=>{i.d(e,{F:()=>n,a:()=>r});const n={name:"color-bit",vertex:{header:"\n @in aColor: vec4<f32>;\n ",main:"\n vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);\n "}},r={name:"color-bit",vertex:{header:"\n in vec4 aColor;\n ",main:"\n vColor *= vec4(aColor.rgb * aColor.a, aColor.a);\n "}}},4e3:(t,e,i)=>{i.d(e,{P:()=>h,_:()=>o});const n={};function r(t){const e=[];if(1===t)e.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let i=0;for(let n=0;n<t;n++)e.push(`@group(1) @binding(${i++}) var textureSource${n+1}: texture_2d<f32>;`),e.push(`@group(1) @binding(${i++}) var textureSampler${n+1}: sampler;`)}return e.join("\n")}function s(t){const e=[];if(1===t)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let i=0;i<t;i++)i===t-1?e.push(" default:{"):e.push(` case ${i}:{`),e.push(` outColor = textureSampleGrad(textureSource${i+1}, textureSampler${i+1}, vUV, uvDx, uvDy);`),e.push(" break;}");e.push("}")}return e.join("\n")}function o(t){return n[t]||(n[t]={name:"texture-batch-bit",vertex:{header:"\n @in aTextureIdAndRound: vec2<u32>;\n @out @interpolate(flat) vTextureId : u32;\n ",main:"\n vTextureId = aTextureIdAndRound.y;\n ",end:"\n if(aTextureIdAndRound.x == 1)\n {\n vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);\n }\n "},fragment:{header:`\n @in @interpolate(flat) vTextureId: u32;\n\n ${r(t)}\n `,main:`\n var uvDx = dpdx(vUV);\n var uvDy = dpdy(vUV);\n\n ${s(t)}\n `}}),n[t]}const a={};function l(t){const e=[];for(let i=0;i<t;i++)i>0&&e.push("else"),i<t-1&&e.push(`if(vTextureId < ${i}.5)`),e.push("{"),e.push(`\toutColor = texture(uTextures[${i}], vUV);`),e.push("}");return e.join("\n")}function h(t){return a[t]||(a[t]={name:"texture-batch-bit",vertex:{header:"\n in vec2 aTextureIdAndRound;\n out float vTextureId;\n\n ",main:"\n vTextureId = aTextureIdAndRound.y;\n ",end:"\n if(aTextureIdAndRound.x == 1.)\n {\n gl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n }\n "},fragment:{header:`\n in float vTextureId;\n\n uniform sampler2D uTextures[${t}];\n\n `,main:`\n\n ${l(t)}\n `}}),a[t]}},6665:(t,e,i)=>{i.d(e,{b:()=>n,m:()=>r});const n={name:"round-pixels-bit",vertex:{header:"\n fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>\n {\n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n }\n "}},r={name:"round-pixels-bit",vertex:{header:"\n vec2 roundPixels(vec2 position, vec2 targetSize)\n {\n return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n }\n "}}},5753:(t,e,i)=>{var n=i(8507),r=i(6844),s=i(9636),o=i(9443);const a=new s.c;function l(t,e,i){const n=a;t.measurable=!0,(0,o.f)(t,i,n),e.addBoundsMask(n),t.measurable=!1}var h=i(7269),c=i(2208),u=i(268);function d(t,e,i){const n=c.o.get();t.measurable=!0;const r=c.u.get().identity(),s=p(t,i,r);(0,h.n)(t,n,s),t.measurable=!1,e.addBoundsMask(n),c.u.return(r),c.o.return(n)}function p(t,e,i){return t?(t!==e&&(p(t.parent,e,i),t.updateLocalTransform(),i.append(t.localTransform)),i):((0,u.R)("Mask bounds, renderable is not inside the root container"),i)}class f{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof r.k),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){null!==this.mask&&(this.mask.measurable=!0,this.mask=null)}addBounds(t,e){this.inverse||l(this.mask,t,e)}addLocalBounds(t,e){d(this.mask,t,e)}containsPoint(t,e){return e(this.mask,t)}destroy(){this.reset()}static test(t){return t instanceof r.k}}f.extension=n.Ag.MaskEffect;class m{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return"number"==typeof t}}m.extension=n.Ag.MaskEffect;var y=i(5559);class g{constructor(t){this.priority=0,this.pipe="stencilMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){null!==this.mask&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(t,e){l(this.mask,t,e)}addLocalBounds(t,e){d(this.mask,t,e)}containsPoint(t,e){return e(this.mask,t)}destroy(){this.reset()}static test(t){return t instanceof y.mc}}g.extension=n.Ag.MaskEffect;var v=i(4195),b=i(4884),x=i(8293),_=i(7309),w=i(1761);let S;var C=i(583);const E=class t extends C.v{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...t.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=!1!==e.autoPlay,this.alphaMode=e.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),!1!==e.autoLoad&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=_.R.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await async function(){return S??(S=(async()=>{const t=w.e.get().createCanvas(1,1).getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise((t=>{const e=document.createElement("video");e.onloadeddata=()=>t(e),e.onerror=()=>t(null),e.autoplay=!1,e.crossOrigin="anonymous",e.preload="auto",e.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",e.load()}));if(!e)return"premultiply-alpha-on-upload";const i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);const n=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,n),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const r=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,r),t.deleteFramebuffer(n),t.deleteTexture(i),t.getExtension("WEBGL_lose_context")?.loseContext(),r[0]<=r[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),S}(),this._load=new Promise(((i,n)=>{this.isValid?i(this):(this._resolve=i,this._reject=n,void 0!==e.preloadTimeoutMs&&(this._preloadTimeout=setTimeout((()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))}))),t.load())})),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(_.R.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),null===this._videoFrameRequestCallbackHandle&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(null!==this._videoFrameRequestCallbackHandle&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(_.R.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(null!==this._videoFrameRequestCallbackHandle&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(_.R.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};E.extension=n.Ag.TextureSource,E.defaultOptions={...C.v.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},E.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let k=E;i(9726);n.XO.add(f,m,g,k,x.b,b.q,v.P)},1257:(t,e,i)=>{i.d(e,{u:()=>n});var n=(t=>(t[t.NONE=0]="NONE",t[t.COLOR=16384]="COLOR",t[t.STENCIL=1024]="STENCIL",t[t.DEPTH=256]="DEPTH",t[t.COLOR_DEPTH=16640]="COLOR_DEPTH",t[t.COLOR_STENCIL=17408]="COLOR_STENCIL",t[t.DEPTH_STENCIL=1280]="DEPTH_STENCIL",t[t.ALL=17664]="ALL",t))(n||{})},9113:(t,e,i)=>{i.d(e,{M:()=>d});var n=i(7952),r=i(3804);let s;function o(){if(!s){s="mediump";const t=(0,r.W)();if(t&&t.getShaderPrecisionFormat){const e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);s=e.precision?"highp":"mediump"}}return s}const a={},l={};const h={stripVersion:function(t,e){return e?t.replace("#version 300 es",""):t},ensurePrecision:function(t,e,i){const n=i?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if("precision"!==t.substring(0,9)){let r=i?e.requestedFragmentPrecision:e.requestedVertexPrecision;return"highp"===r&&"highp"!==n&&(r="mediump"),`precision ${r} float;\n${t}`}return"highp"!==n&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t},addProgramDefines:function(t,e,i){return e?t:i?`\n\n #ifdef GL_ES // This checks if it is WebGL1\n #define in varying\n #define finalColor gl_FragColor\n #define texture texture2D\n #endif\n ${t=t.replace("out vec4 finalColor;","")}\n `:`\n\n #ifdef GL_ES // This checks if it is WebGL1\n #define in attribute\n #define out varying\n #endif\n ${t}\n `},setProgramName:function(t,{name:e="pixi-program"},i=!0){e=e.replace(/\s+/g,"-");const n=i?a:l;return n[e+=i?"-fragment":"-vertex"]?(n[e]++,e+=`-${n[e]}`):n[e]=1,-1!==t.indexOf("#define SHADER_NAME")?t:`${`#define SHADER_NAME ${e}`}\n${t}`},insertVersion:function(t,e){return e?`#version 300 es\n${t}`:t}},c=Object.create(null),u=class t{constructor(e){const i=-1!==(e={...t.defaultOptions,...e}).fragment.indexOf("#version 300 es"),r={stripVersion:i,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:o()},setProgramName:{name:e.name},addProgramDefines:i,insertVersion:i};let s=e.fragment,a=e.vertex;Object.keys(h).forEach((t=>{const e=r[t];s=h[t](s,e,!0),a=h[t](a,e,!1)})),this.fragment=s,this.vertex=a,this.transformFeedbackVaryings=e.transformFeedbackVaryings,this._key=(0,n.X)(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null,c[this._cacheKey]=null}static from(e){const i=`${e.vertex}:${e.fragment}`;return c[i]||(c[i]=new t(e),c[i]._cacheKey=i),c[i]}};u.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let d=u},6040:(t,e,i)=>{i.d(e,{n:()=>s});var n=i(5811);const r={};function s(t){let e=r[t];if(e)return e;const i=new Int32Array(t);for(let e=0;e<t;e++)i[e]=e;return e=r[t]=new n.k({uTextures:{value:i,type:"i32",size:t}},{isStatic:!0}),e}},3804:(t,e,i)=>{i.d(e,{W:()=>s});var n=i(1761);let r;function s(){if(!r||r?.isContextLost()){const t=n.e.get().createCanvas();r=t.getContext("webgl",{})}return r}},3513:(t,e,i)=>{i.d(e,{T:()=>n});class n{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const i in t){const n=t[i];this.setResource(n,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){const i=this.resources[e];t!==i&&(i?.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t,e){const i=this.resources;for(const n in i)i[n]._gcLastUsed=t,i[n]._touched=e}destroy(){const t=this.resources;for(const e in t){const i=t[e];i?.off?.("change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){this._dirty=!0,t.destroyed?this.destroy():this._updateKey()}}},3012:(t,e,i)=>{i.d(e,{B:()=>u});var n=i(7952),r=i(8306);const s={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},o=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function a(t,e){let i;for(;null!==(i=o.exec(t));){const t=s[i[3]]??"float32";e[i[2]]={location:parseInt(i[1],10),format:t,stride:(0,r.m)(t).stride,offset:0,instance:!1,start:0}}o.lastIndex=0}function l(t){const e=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,n=/var(<[^>]+>)? (\w+)/,r=/:\s*([\w<>]+)/,s=/(\w+)\s*:\s*([\w\<\>]+)/g,o=/struct\s+(\w+)/,a=t.match(/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g)?.map((t=>({group:parseInt(t.match(e)[1],10),binding:parseInt(t.match(i)[1],10),name:t.match(n)[2],isUniform:"<uniform>"===t.match(n)[1],type:t.match(r)[1]})));if(!a)return{groups:[],structs:[]};const l=t.match(/struct\s+(\w+)\s*{([^}]+)}/g)?.map((t=>{const e=t.match(o)[1],i=t.match(s).reduce(((t,e)=>{const[i,n]=e.split(":");return t[i.trim()]=n.trim(),t}),{});return i?{name:e,members:i}:null})).filter((({name:t})=>a.some((e=>e.type===t||e.type.includes(`<${t}>`)))))??[];return{groups:a,structs:l}}var h=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(h||{});const c=Object.create(null);class u{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:e,vertex:i,layout:n,gpuLayout:r,name:s}=t;if(this.name=s,this.fragment=e,this.vertex=i,e.source===i.source){const t=l(e.source);this.structsAndGroups=t}else{const t=l(i.source),n=l(e.source);this.structsAndGroups=function(t,e){const i=new Set,n=new Set;return{structs:[...t.structs,...e.structs].filter((t=>!i.has(t.name)&&(i.add(t.name),!0))),groups:[...t.groups,...e.groups].filter((t=>{const e=`${t.name}-${t.binding}`;return!n.has(e)&&(n.add(e),!0)}))}}(t,n)}this.layout=n??function({groups:t}){const e=[];for(let i=0;i<t.length;i++){const n=t[i];e[n.group]||(e[n.group]={}),e[n.group][n.name]=n.binding}return e}(this.structsAndGroups),this.gpuLayout=r??function({groups:t}){const e=[];for(let i=0;i<t.length;i++){const n=t[i];e[n.group]||(e[n.group]=[]),n.isUniform?e[n.group].push({binding:n.binding,visibility:h.VERTEX|h.FRAGMENT,buffer:{type:"uniform"}}):"sampler"===n.type?e[n.group].push({binding:n.binding,visibility:h.FRAGMENT,sampler:{type:"filtering"}}):"texture_2d"===n.type||n.type.startsWith("texture_2d<")?e[n.group].push({binding:n.binding,visibility:h.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):"texture_2d_array"===n.type||n.type.startsWith("texture_2d_array<")?e[n.group].push({binding:n.binding,visibility:h.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):("texture_cube"===n.type||n.type.startsWith("texture_cube<"))&&e[n.group].push({binding:n.binding,visibility:h.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let t=0;t<e.length;t++)e[t]||(e[t]=[]);return e}(this.structsAndGroups),this.autoAssignGlobalUniforms=!(void 0===this.layout[0]?.globalUniforms),this.autoAssignLocalUniforms=!(void 0===this.layout[1]?.localUniforms),this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=(0,n.X)(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=function({source:t,entryPoint:e}){const i={},n=function(t){return t.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}(t),r=n.indexOf(`fn ${e}(`);if(-1===r)return i;const s=n.indexOf("->",r);if(-1===s)return i;const o=n.substring(r,s);if(a(o,i),0===Object.keys(i).length){const t=o.match(/\(\s*\w+\s*:\s*(\w+)/);if(t){const e=t[1],r=new RegExp(`struct\\s+${e}\\s*\\{([^}]+)\\}`,"s"),s=n.match(r);s&&a(s[1],i)}}return i}(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,c[this._cacheKey]=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return c[e]||(c[e]=new u(t),c[e]._cacheKey=e),c[e]}}},949:(t,e,i)=>{i.d(e,{h:()=>o});var n=i(8875),r=i(133),s=i(1132);class o extends n.A{constructor(t){let{data:e,size:i}=t;const{usage:n,label:s,shrinkToFit:o}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=(0,r.L)("buffer"),this._resourceType="buffer",this._resourceId=(0,r.L)("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i??(i=e?.byteLength);const a=!!e;this.descriptor={size:i,usage:n,mappedAtCreation:a,label:s},this.shrinkToFit=o??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&s.S.STATIC)}set static(t){t?this.descriptor.usage|=s.S.STATIC:this.descriptor.usage&=~s.S.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t)return void(i&&this.emit("update",this));const n=this._data;this._data=t,this._dataInt32=null,n&&n.length===t.length||!this.shrinkToFit&&n&&t.byteLength<n.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=(0,r.L)("resource"),this.emit("change",this))}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}},1132:(t,e,i)=>{i.d(e,{S:()=>n});var n=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(n||{})},6736:(t,e,i)=>{function n(t,e,i,n){if(i??(i=0),n??(n=Math.min(t.byteLength-i,e.byteLength)),7&i||7&n)if(3&i||3&n)new Uint8Array(e).set(new Uint8Array(t,i,n));else{const r=n/4;new Float32Array(e,0,r).set(new Float32Array(t,i,r))}else{const r=n/8;new Float64Array(e,0,r).set(new Float64Array(t,i,r))}}i.d(e,{W:()=>n})},6011:(t,e,i)=>{i.d(e,{V:()=>h});var n=i(8875),r=i(9636),s=i(133),o=i(949),a=i(1132);function l(t,e){if(!(t instanceof o.h)){let i=e?a.S.INDEX:a.S.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),i=a.S.INDEX|a.S.COPY_DST):(t=new Float32Array(t),i=a.S.VERTEX|a.S.COPY_DST)),t=new o.h({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:i})}return t}class h extends n.A{constructor(t={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=(0,s.L)("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new r.c,this._boundsDirty=!0;const{attributes:e,indexBuffer:i,topology:n}=t;if(this.buffers=[],this.attributes={},e)for(const t in e)this.addAttribute(t,e[t]);this.instanceCount=t.instanceCount??1,i&&this.addIndex(i),this.topology=n||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){const i=function(t){return(t instanceof o.h||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=l(t.buffer,!1),t}(e);-1===this.buffers.indexOf(i.buffer)&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=i}addIndex(t){this.indexBuffer=l(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,function(t,e,i){const n=t.getAttribute(e);if(!n)return i.minX=0,i.minY=0,i.maxX=0,i.maxY=0,i;const r=n.buffer.data;let s=1/0,o=1/0,a=-1/0,l=-1/0;const h=r.BYTES_PER_ELEMENT,c=(n.offset||0)/h,u=(n.stride||8)/h;for(let t=c;t<r.length;t+=u){const e=r[t],i=r[t+1];e>a&&(a=e),i>l&&(l=i),e<s&&(s=e),i<o&&(o=i)}return i.minX=s,i.minY=o,i.maxX=a,i.maxY=l,i}(this,"aPosition",this._bounds)):this._bounds}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach((t=>t.destroy())),this.unload(),this.indexBuffer?.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}},8306:(t,e,i)=>{i.d(e,{m:()=>r});const n={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function r(t){return n[t]??n.float32}},848:(t,e,i)=>{i.d(e,{L:()=>r});var n=i(133);class r{constructor(){this.uid=(0,n.L)("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}},8475:(t,e,i)=>{i.d(e,{M:()=>c});var n=i(8875),r=i(133),s=i(9113),o=i(3513),a=i(3012),l=i(5099),h=i(5811);class c extends n.A{constructor(t){super(),this.uid=(0,r.L)("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:e,glProgram:i,groups:n,resources:s,compatibleRenderers:a,groupMap:c}=t;this.gpuProgram=e,this.glProgram=i,void 0===a&&(a=0,e&&(a|=l.W.WEBGPU),i&&(a|=l.W.WEBGL)),this.compatibleRenderers=a;const u={};if(s||n||(s={}),s&&n)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&n&&!c)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&n&&c)for(const t in c)for(const e in c[t]){const i=c[t][e];u[i]={group:t,binding:e,name:i}}else if(e&&n&&!c){const t=e.structsAndGroups.groups;c={},t.forEach((t=>{c[t.group]=c[t.group]||{},c[t.group][t.binding]=t.name,u[t.name]=t}))}else if(s){if(n={},c={},e){e.structsAndGroups.groups.forEach((t=>{c[t.group]=c[t.group]||{},c[t.group][t.binding]=t.name,u[t.name]=t}))}let t=0;for(const e in s)u[e]||(n[99]||(n[99]=new o.T,this._ownedBindGroups.push(n[99])),u[e]={group:99,binding:t,name:e},c[99]=c[99]||{},c[99][t]=e,t++);for(const t in s){const e=t;let i=s[t];i.source||i._resourceType||(i=new h.k(i));const r=u[e];r&&(n[r.group]||(n[r.group]=new o.T,this._ownedBindGroups.push(n[r.group])),n[r.group].setResource(i,r.binding))}}this.groups=n,this._uniformBindMap=c,this.resources=this._buildResourceAccessor(n,u)}addResource(t,e,i){var n,r;(n=this._uniformBindMap)[e]||(n[e]={}),(r=this._uniformBindMap[e])[i]||(r[i]=t),this.groups[e]||(this.groups[e]=new o.T,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const i={};for(const n in e){const r=e[n];Object.defineProperty(i,r.name,{get:()=>t[r.group].getResource(r.binding),set(e){t[r.group].setResource(e,r.binding)}})}return i}destroy(t=!1){this._destroyed||(this._destroyed=!0,this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach((t=>{t.destroy()})),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(t){const{gpu:e,gl:i,...n}=t;let r,o;return e&&(r=a.B.from(e)),i&&(o=s.M.from(i)),new c({gpuProgram:r,glProgram:o,...n})}}},5811:(t,e,i)=>{i.d(e,{k:()=>h});var n=i(133),r=i(7952);const s=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],o=s.reduce(((t,e)=>(t[e]=!0,t)),{});function a(t,e){switch(t){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const l=class t{constructor(e,i){this._touched=0,this.uid=(0,n.L)("uniform"),this._resourceType="uniformGroup",this._resourceId=(0,n.L)("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,i={...t.defaultOptions,...i},this.uniformStructures=e;const l={};for(const t in e){const i=e[t];if(i.name=t,i.size=i.size??1,!o[i.type]){const t=i.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(t){const[,e,n]=t;throw new Error(`Uniform type ${i.type} is not supported. Use type: '${e}', size: ${n} instead.`)}throw new Error(`Uniform type ${i.type} is not supported. Supported uniform types are: ${s.join(", ")}`)}i.value??(i.value=a(i.type,i.size)),l[t]=i.value}this.uniforms=l,this._dirtyId=1,this.ubo=i.ubo,this.isStatic=i.isStatic,this._signature=(0,r.X)(Object.keys(l).map((t=>`${t}-${e[t].type}`)).join("-"),"uniform-group")}update(){this._dirtyId++}};l.defaultOptions={ubo:!1,isStatic:!1};let h=l},7547:(t,e,i)=>{i.d(e,{U:()=>s});const n={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},r=class t{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(1&this.data)}set blend(t){!!(1&this.data)!==t&&(this.data^=1)}get offsets(){return!!(2&this.data)}set offsets(t){!!(2&this.data)!==t&&(this.data^=2)}set cullMode(t){"none"!==t?(this.culling=!0,this.clockwiseFrontFace="front"===t):this.culling=!1}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(4&this.data)}set culling(t){!!(4&this.data)!==t&&(this.data^=4)}get depthTest(){return!!(8&this.data)}set depthTest(t){!!(8&this.data)!==t&&(this.data^=8)}get depthMask(){return!!(32&this.data)}set depthMask(t){!!(32&this.data)!==t&&(this.data^=32)}get clockwiseFrontFace(){return!!(16&this.data)}set clockwiseFrontFace(t){!!(16&this.data)!==t&&(this.data^=16)}get blendMode(){return this._blendMode}set blendMode(t){this.blend="none"!==t,this._blendMode=t,this._blendModeId=n[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const e=new t;return e.depthTest=!1,e.blend=!0,e}};r.default2d=r.for2d();let s=r},1957:(t,e,i)=>{i.d(e,{K:()=>r,Q:()=>n});const n={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var r=(t=>(t[t.DISABLED=0]="DISABLED",t[t.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",t[t.MASK_ACTIVE=2]="MASK_ACTIVE",t[t.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",t[t.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",t[t.NONE=5]="NONE",t))(r||{})},800:(t,e,i)=>{i.d(e,{k:()=>g});var n=i(2577),r=i(8507);const s=[];async function o(t){if(!t)for(let t=0;t<s.length;t++){const e=s[t];if(e.value.test())return void await e.value.load()}}r.XO.handleByNamedList(r.Ag.Environment,s);var a=i(5559),l=i(4577),h=i(133),c=i(4670),u=i(6083),d=i(1257),p=i(7729),f=i(8875);const m=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],y=class t extends f.A{constructor(t){super(),this.tick=0,this.uid=(0,h.L)("renderer"),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const e=[...m,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(e={}){const i=!0===e.skipExtensionImports||!1===e.manageImports;await o(i),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const t in this._systemsHash){e={...this._systemsHash[t].constructor.defaultOptions,...e}}e={...t.defaultOptions,...e},this._roundPixels=e.roundPixels?1:0;for(let t=0;t<this.runners.init.items.length;t++)await this.runners.init.items[t].init(e);this._initOptions=e}render(t,e){this.tick++;let i=t;if(i instanceof a.mc&&(i={container:i},e&&((0,c.t6)(c.lj,"passing a second argument is deprecated, please use render options instead"),i.target=e.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){const t=Array.isArray(i.clearColor)&&4===i.clearColor.length;i.clearColor=t?i.clearColor:n.Q.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.visible&&(i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i))}resize(t,e,i){const n=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),void 0!==i&&i!==n&&this.runners.resolutionChange.emit(i)}clear(t={}){t.target||(t.target=this.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=d.u.ALL);const{clear:e,clearColor:i,target:r,mipLevel:s,layer:o}=t;n.Q.shared.setValue(i??this.background.colorRgba),this.renderTarget.clear(r,e,n.Q.shared.toArray(),s??0,o??0)}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach((t=>{this.runners[t]=new p.C(t)}))}_addSystems(t){let e;for(e in t){const i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const t in this.runners)this.runners[t].add(i);return this}_addPipes(t,e){const i=e.reduce(((t,e)=>(t[e.name]=e.value,t)),{});t.forEach((t=>{const e=t.value,n=t.name,r=i[n];this.renderPipes[n]=new e(this,r?new r:null),this.runners.destroy.add(this.renderPipes[n])}))}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),(!0===t||"object"==typeof t&&t.releaseGlobalResources)&&u.L.release(),Object.values(this.runners).forEach((t=>{t.destroy()})),this._systemsHash=null,this.renderPipes=null,this.removeAllListeners()}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!(0,l.f)())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};y.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let g=y},7729:(t,e,i)=>{i.d(e,{C:()=>n});class n{constructor(t){this.items=[],this._name=t}emit(t,e,i,n,r,s,o,a){const{name:l,items:h}=this;for(let c=0,u=h.length;c<u;c++)h[c][l](t,e,i,n,r,s,o,a);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return-1!==e&&this.items.splice(e,1),this}contains(t){return-1!==this.items.indexOf(t)}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return 0===this.items.length}get name(){return this._name}}},7608:(t,e,i)=>{i.d(e,{N:()=>o});var n=i(1761),r=i(9939),s=i(6083);const o=new class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const i=n.e.get().createCanvas();i.width=t,i.height=e;const r=i.getContext("2d");return{canvas:i,context:r}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6);const n=((t=(0,r.U5)(t))<<17)+((e=(0,r.U5)(e))<<1);this._canvasPool[n]||(this._canvasPool[n]=[]);let s=this._canvasPool[n].pop();return s||(s=this._createCanvasAndContext(t,e)),s}returnCanvasAndContext(t){const e=t.canvas,{width:i,height:n}=e,r=(i<<17)+(n<<1);t.context.resetTransform(),t.context.clearRect(0,0,i,n),this._canvasPool[r].push(t)}clear(){this._canvasPool={}}};s.L.register(o)},5589:(t,e,i)=>{i.d(e,{g:()=>d});var n=i(8875),r=i(2079),s=i(9252),o=i(133),a=i(4670);const l=()=>{};var h=i(4195),c=i(583),u=i(1196);class d extends n.A{constructor({source:t,label:e,frame:i,orig:n,trim:r,defaultAnchor:a,defaultBorders:l,rotate:h,dynamic:u}={}){if(super(),this.uid=(0,o.L)("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new s.M,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new c.v,this.noFrame=!i,i)this.frame.copyFrom(i);else{const{width:t,height:e}=this._source;this.frame.width=t,this.frame.height=e}this.orig=n||this.frame,this.trim=r,this.rotate=h??0,this.defaultAnchor=a,this.defaultBorders=l,this.destroyed=!1,this.dynamic=u||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new u.N(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:i,height:n}=this._source,s=e.x/i,o=e.y/n,a=e.width/i,l=e.height/n;let h=this.rotate;if(h){const e=a/2,i=l/2,n=s+e,c=o+i;h=r.E.add(h,r.E.NW),t.x0=n+e*r.E.uX(h),t.y0=c+i*r.E.uY(h),h=r.E.add(h,2),t.x1=n+e*r.E.uX(h),t.y1=c+i*r.E.uY(h),h=r.E.add(h,2),t.x2=n+e*r.E.uX(h),t.y2=c+i*r.E.uY(h),h=r.E.add(h,2),t.x3=n+e*r.E.uX(h),t.y3=c+i*r.E.uY(h)}else t.x0=s,t.y0=o,t.x1=s+a,t.y1=o,t.x2=s+a,t.y2=o+l,t.x3=s,t.y3=o+l}destroy(t=!1){this._source&&(this._source.off("resize",this.update,this),t&&(this._source.destroy(),this._source=null)),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return(0,a.t6)(a.lj,"Texture.baseTexture is now Texture.source"),this._source}}d.EMPTY=new d({label:"EMPTY",source:new c.v({label:"EMPTY"})}),d.EMPTY.destroy=l,d.WHITE=new d({source:new h.P({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),d.WHITE.destroy=l},1196:(t,e,i)=>{i.d(e,{N:()=>s});var n=i(9313);const r=new n.u;class s{constructor(t,e){this.mapCoord=new n.u,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===e?t.width<10?0:.5:e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){void 0===e&&(e=t);const i=this.mapCoord;for(let n=0;n<t.length;n+=2){const r=t[n],s=t[n+1];e[n]=r*i.a+s*i.c+i.tx,e[n+1]=r*i.b+s*i.d+i.ty}return e}update(){const t=this._texture;this._updateID++;const e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);const i=t.orig,n=t.trim;n&&(r.set(i.width/n.width,0,0,i.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(r));const s=t.source,o=this.uClampFrame,a=this.clampMargin/s._resolution,l=this.clampOffset/s._resolution;return o[0]=(t.frame.x+a+l)/s.width,o[1]=(t.frame.y+a+l)/s.height,o[2]=(t.frame.x+t.frame.width-a+l)/s.width,o[3]=(t.frame.y+t.frame.height-a+l)/s.height,this.uClampOffset[0]=this.clampOffset/s.pixelWidth,this.uClampOffset[1]=this.clampOffset/s.pixelHeight,this.isSimple=t.frame.width===s.width&&t.frame.height===s.height&&0===t.rotate,!0}}},2437:(t,e,i)=>{i.d(e,{W:()=>h});var n=i(9939),r=i(6083),s=i(583),o=i(5589),a=i(218);let l=0;const h=new class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new a.n(this.textureOptions)}createTexture(t,e,i,n){const r=new s.v({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1,autoGenerateMipmaps:n});return new o.g({source:r,label:"texturePool_"+l++})}getOptimalTexture(t,e,i=1,r,s=!1){let o=Math.ceil(t*i-1e-6),a=Math.ceil(e*i-1e-6);o=(0,n.U5)(o),a=(0,n.U5)(a);const l=(o<<17)+(a<<2)+((s?1:0)<<1)+(r?1:0);this._texturePool[l]||(this._texturePool[l]=[]);let h=this._texturePool[l].pop();return h||(h=this.createTexture(o,a,r,s)),h.source._resolution=i,h.source.width=o/i,h.source.height=a/i,h.source.pixelWidth=o,h.source.pixelHeight=a,h.frame.x=0,h.frame.y=0,h.frame.width=t,h.frame.height=e,h.updateUvs(),this._poolKeyHash[h.uid]=l,h}getSameSizeTexture(t,e=!1){const i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t,e=!1){const i=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[i].push(t)}clear(t){if(t=!1!==t)for(const t in this._texturePool){const e=this._texturePool[t];if(e)for(let t=0;t<e.length;t++)e[t].destroy(!0)}this._texturePool={}}};r.L.register(h)},218:(t,e,i)=>{i.d(e,{n:()=>l});var n=i(8875),r=i(133),s=i(4670);const o=Object.create(null);const a=class t extends n.A{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...t.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){(0,s.t6)(s.lj,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this._sharedResourceId=null,this.emit("change",this)}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=function(t){const e=o[t];return void 0===e&&(o[t]=(0,r.L)("resource")),e}(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};a.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let l=a},4195:(t,e,i)=>{i.d(e,{P:()=>s});var n=i(8507),r=i(583);class s extends r.v{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let i=t.format;i||(i=e instanceof Float32Array?"rgba32float":e instanceof Int32Array||e instanceof Uint32Array?"rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?"rgba16uint":(Int8Array,"bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}s.extension=n.Ag.TextureSource},4884:(t,e,i)=>{i.d(e,{q:()=>o});var n=i(1761),r=i(8507),s=i(583);class o extends s.v{constructor(t){t.resource||(t.resource=n.e.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),this.resource.width===this.pixelWidth&&this.resource.height===this.pixelHeight||(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){const n=super.resize(t,e,i);return n&&this.resizeCanvas(),n}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}o.extension=r.Ag.TextureSource},8293:(t,e,i)=>{i.d(e,{b:()=>s});var n=i(8507),r=i(583);class s extends r.v{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}s.extension=n.Ag.TextureSource},583:(t,e,i)=>{i.d(e,{v:()=>h});var n=i(8875),r=i(9939),s=i(2698),o=i(133),a=i(218);const l=class t extends n.A{constructor(e={}){super(),this.options=e,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=(0,o.L)("textureSource"),this._resourceType="textureSource",this._resourceId=(0,o.L)("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.viewDimension="2d",this.arrayLayerCount=1,this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...t.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=e.format,this.dimension=e.dimensions,this.viewDimension=e.viewDimension??e.dimensions,this.arrayLayerCount=e.arrayLayerCount,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new a.n((0,s.S)(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(t){this._style.maxAnisotropy=t}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=(0,o.L)("resource"),this.emit("change",this),this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy?.();this._gpuData=Object.create(null)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);const n=Math.round(t*i),r=Math.round(e*i);return this.width=n/i,this.height=r/i,this._resolution=i,(this.pixelWidth!==n||this.pixelHeight!==r)&&(this._refreshPOT(),this.pixelWidth=n,this.pixelHeight=r,this.emit("resize",this),this._resourceId=(0,o.L)("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=(0,r.f3)(this.pixelWidth)&&(0,r.f3)(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};l.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",viewDimension:"2d",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let h=l},9726:(t,e,i)=>{var n=i(268),r=i(2406);const s=new class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||(0,n.R)(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=(0,r.z)(t);let s;for(let t=0;t<this.parsers.length;t++){const n=this.parsers[t];if(n.test(e)){s=n.getCacheableAssets(i,e);break}}const o=new Map(Object.entries(s||{}));s||i.forEach((t=>{o.set(t,e)}));const a=[...o.keys()],l={cacheKeys:a,keys:i};i.forEach((t=>{this._cacheMap.set(t,l)})),a.forEach((t=>{const i=s?s[t]:e;this._cache.has(t)&&this._cache.get(t)!==i&&(0,n.R)("[Cache] already has key:",t),this._cache.set(t,o.get(t))}))}remove(t){if(!this._cacheMap.has(t))return void(0,n.R)(`[Assets] Asset id ${t} was not found in the Cache`);const e=this._cacheMap.get(t);e.cacheKeys.forEach((t=>{this._cache.delete(t)})),e.keys.forEach((t=>{this._cacheMap.delete(t)}))}get parsers(){return this._parsers}};var o=i(8507),a=i(583),l=i(5589);const h=[];function c(t={}){const e=t&&t.resource,i=e?t.resource:t,n=e?t:{resource:t};for(let t=0;t<h.length;t++){const e=h[t];if(e.test(i))return new e(n)}throw new Error(`Could not find a source type for resource: ${n.resource}`)}o.XO.handleByList(o.Ag.TextureSource,h),l.g.from=function(t,e=!1){return"string"==typeof t?s.get(t):t instanceof a.v?new l.g({source:t}):function(t={},e=!1){const i=t&&t.resource,n=i?t.resource:t,r=i?t:{resource:t};if(!e&&s.has(n))return s.get(n);const o=new l.g({source:c(r)});return o.on("destroy",(()=>{s.has(n)&&s.remove(n)})),e||s.set(n,o),o}(t,e)},a.v.from=c},7952:(t,e,i)=>{i.d(e,{X:()=>s});const n=Object.create(null),r=Object.create(null);function s(t,e){let i=r[t];return void 0===i&&(void 0===n[e]&&(n[e]=1),r[t]=i=n[e]++),i}},5099:(t,e,i)=>{i.d(e,{W:()=>n});var n=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.CANVAS=4]="CANVAS",t[t.BOTH=3]="BOTH",t))(n||{})},5559:(t,e,i)=>{i.d(e,{mc:()=>H,u:()=>U,ig:()=>z,fR:()=>W});var n=i(8875),r=i(2577);var s=i(8507),o=i(9313),a=i(1652),l=i(2812),h=i(133),c=i(4670),u=i(268),d=i(8655);const p={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(t){"boolean"==typeof t&&!1===t?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(!0===t?{}:t))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(t){(0,c.t6)("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(t)}};var f=i(9903);const m={allowChildren:!0,removeChildren(t=0,e){const i=e??this.children.length,n=i-t,r=[];if(n>0&&n<=i){for(let e=i-1;e>=t;e--){const t=this.children[e];t&&(r.push(t),t.parent=null)}(0,f.d)(this.children,t,i);const e=this.renderGroup||this.parentRenderGroup;e&&e.removeChildren(r);for(let t=0;t<r.length;++t){const e=r[t];e.parentRenderLayer?.detach(e),this.emit("childRemoved",e,this,t),r[t].emit("removed",this)}return r.length>0&&this._didViewChangeTick++,r}if(0===n&&0===this.children.length)return r;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(t){const e=this.getChildAt(t);return this.removeChild(e)},getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]},setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(t),this.addChildAt(t,e)},getChildIndex(t){const e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(t,e){this.allowChildren||(0,c.t6)(c.lj,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:i}=this;if(e<0||e>i.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${i.length}`);const n=t.parent===this;if(t.parent){const i=t.parent.children.indexOf(t);if(n){if(i===e)return t;t.parent.children.splice(i,1)}else t.removeFromParent()}e===i.length?i.push(t):i.splice(e,0,t),t.parent=this,t.didChange=!0,t._updateFlags=15;const r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(t),this.sortableChildren&&(this.sortDirty=!0),n||(this.emit("childAdded",t,this,e),t.emit("added",this)),t},swapChildren(t,e){if(t===e)return;const i=this.getChildIndex(t),n=this.getChildIndex(e);this.children[i]=e,this.children[n]=t;const r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...t){return 1===t.length?this.reparentChildAt(t[0],this.children.length):(t.forEach((t=>this.reparentChildAt(t,this.children.length))),t[0])},reparentChildAt(t,e){if(t.parent===this)return this.setChildIndex(t,e),t;const i=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);const n=this.worldTransform.clone();return n.invert(),i.prepend(n),t.setFromMatrix(i),t},replaceChild(t,e){t.updateLocalTransform(),this.addChildAt(e,this.getChildIndex(t)),e.setFromMatrix(t.localTransform),e.updateLocalTransform(),this.removeChild(t)}},y={collectRenderables(t,e,i){this.parentRenderLayer&&this.parentRenderLayer!==i||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(t,e,i):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,t):this.collectRenderablesWithEffects(t,e,i))},collectRenderablesSimple(t,e,i){const n=this.children,r=n.length;for(let s=0;s<r;s++)n[s].collectRenderables(t,e,i)},collectRenderablesWithEffects(t,e,i){const{renderPipes:n}=e;for(let e=0;e<this.effects.length;e++){const i=this.effects[e];n[i.pipe].push(i,this,t)}this.collectRenderablesSimple(t,e,i);for(let e=this.effects.length-1;e>=0;e--){const i=this.effects[e];n[i.pipe].pop(i,this,t)}}};var g=i(9049);const v=new class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach((t=>{this.add({test:t.test,maskClass:t})})))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){const i=this._tests[e];if(i.test(t))return d.Z.get(i.maskClass,t)}return t}returnMaskEffect(t){d.Z.return(t)}};s.XO.handleByList(s.Ag.MaskEffect,v._effectClasses);const b={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){const t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0)},addEffect(t){-1===this.effects.indexOf(t)&&(this.effects.push(t),this.effects.sort(((t,e)=>t.priority-e.priority)),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(t){const e=this.effects.indexOf(t);-1!==e&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(t){const e=this._maskEffect;e?.mask!==t&&(e&&(this.removeEffect(e),v.returnMaskEffect(e),this._maskEffect=null),null!=t&&(this._maskEffect=v.getMaskEffect(t),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},setMask(t){this._maskOptions={...this._maskOptions,...t},t.mask&&(this.mask=t.mask),this._markStructureAsChanged()},set filters(t){!Array.isArray(t)&&t&&(t=[t]);const e=this._filterEffect||(this._filterEffect=new g.a),i=t?.length>0,n=i!==e.filters?.length>0;t=Array.isArray(t)?t.slice(0):t,e.filters=Object.freeze(t),n&&(i?this.addEffect(e):(this.removeEffect(e),e.filters=t??null))},get filters(){return this._filterEffect?.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new g.a),this._filterEffect.filterArea=t},get filterArea(){return this._filterEffect?.filterArea}},x={label:null,get name(){return(0,c.t6)(c.lj,"Container.name property has been removed, use Container.label instead"),this.label},set name(t){(0,c.t6)(c.lj,"Container.name property has been removed, use Container.label instead"),this.label=t},getChildByName(t,e=!1){return this.getChildByLabel(t,e)},getChildByLabel(t,e=!1){const i=this.children;for(let e=0;e<i.length;e++){const n=i[e];if(n.label===t||t instanceof RegExp&&t.test(n.label))return n}if(e)for(let e=0;e<i.length;e++){const n=i[e].getChildByLabel(t,!0);if(n)return n}return null},getChildrenByLabel(t,e=!1,i=[]){const n=this.children;for(let e=0;e<n.length;e++){const r=n[e];(r.label===t||t instanceof RegExp&&t.test(r.label))&&i.push(r)}if(e)for(let e=0;e<n.length;e++)n[e].getChildrenByLabel(t,!0,i);return i}};var _=i(9636),w=i(2208);const S=new o.u,C={getFastGlobalBounds(t,e){e||(e=new _.c),e.clear(),this._getGlobalBoundsRecursive(!!t,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);const i=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(i.worldTransform),e},_getGlobalBoundsRecursive(t,e,i){let n=e;if(t&&this.parentRenderLayer&&this.parentRenderLayer!==i)return;if(7!==this.localDisplayStatus||!this.measurable)return;const r=!!this.effects.length;if((this.renderGroup||r)&&(n=w.o.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const t=this.bounds;n.addFrame(t.minX,t.minY,t.maxX,t.maxY,this.groupTransform)}const e=this.children;for(let r=0;r<e.length;r++)e[r]._getGlobalBoundsRecursive(t,n,i)}if(r){let t=!1;const i=this.renderGroup||this.parentRenderGroup;for(let e=0;e<this.effects.length;e++)this.effects[e].addBounds&&(t||(t=!0,n.applyMatrix(i.worldTransform)),this.effects[e].addBounds(n,!0));t&&n.applyMatrix(i.worldTransform.copyTo(S).invert()),e.addBounds(n),w.o.return(n)}else this.renderGroup&&(e.addBounds(n,this.relativeGroupTransform),w.o.return(n))}};var E=i(198),k=i(9443),A=i(7269);function T(t,e){const i=t.children;for(let t=0;t<i.length;t++){const n=i[t],r=n.uid,s=(65535&n._didViewChangeTick)<<16|65535&n._didContainerChangeTick,o=e.index;e.data[o]===r&&e.data[o+1]===s||(e.data[e.index]=r,e.data[e.index+1]=s,e.didChange=!0),e.index=o+2,n.children.length&&T(n,e)}return e.didChange}const M=new o.u,P={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){const i=Math.sign(this.scale.x)||1;this.scale.x=0!==e?t/e*i:i},_setHeight(t,e){const i=Math.sign(this.scale.y)||1;this.scale.y=0!==e?t/e*i:i},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new _.c});const t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),T(this,t),t.didChange&&(0,A.n)(this,t.localBounds,M),t.localBounds},getBounds(t,e){return(0,k.f)(this,t,e||new _.c)}},O={_onRender:null,set onRender(t){const e=this.renderGroup||this.parentRenderGroup;if(!t)return this._onRender&&e?.removeOnRender(this),void(this._onRender=null);this._onRender||e?.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}},I={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(L))}};function L(t,e){return t._zIndex-e._zIndex}var R=i(5101);const j={getGlobalPosition(t=new R.b,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,i=!1){const n=this.getGlobalTransform(w.u.get(),i);return e=n.apply(t,e),w.u.return(n),e},toLocal(t,e,i,n){e&&(t=e.toGlobal(t,i,n));const r=this.getGlobalTransform(w.u.get(),n);return i=r.applyInverse(t,i),w.u.return(r),i}};var D=i(3284);const N=new l.o(null),F=new l.o(null),B=new l.o(null,1,1),G=new l.o(null),z=1,U=2,W=4;class H extends n.A{constructor(t={}){super(),this.uid=(0,h.L)("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new o.u,this.relativeGroupTransform=new o.u,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new l.o(this,0,0),this._scale=B,this._pivot=F,this._origin=G,this._skew=N,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],function(t,e,i={}){for(const n in e)i[n]||void 0===e[n]||(t[n]=e[n])}(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach((t=>this.addChild(t))),t.parent?.addChild(this)}static mixin(t){(0,c.t6)("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),s.XO.mixin(H,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=4095&t}get _didChangeId(){return 4095&this._didContainerChangeTick|(4095&this._didViewChangeTick)<<12}addChild(...t){if(this.allowChildren||(0,c.t6)(c.lj,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let e=0;e<t.length;e++)this.addChild(t[e]);return t[0]}const e=t[0],i=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),i&&(i.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,i&&i.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,0!==e._zIndex&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let e=0;e<t.length;e++)this.removeChild(t[e]);return t[0]}const e=t[0],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,this.didChange||(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=d.Z.get(D.m,this),this.groupTransform=o.u.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t?.removeChild(this),d.Z.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&0===this.effects.length}get worldTransform(){return this._worldTransform||(this._worldTransform=new o.u),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*a.bO}set angle(t){this.rotation=t*a.Td}get pivot(){return this._pivot===F&&(this._pivot=new l.o(this,0,0)),this._pivot}set pivot(t){this._pivot===F&&(this._pivot=new l.o(this,0,0),this._origin!==G&&(0,u.R)("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),"number"==typeof t?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===N&&(this._skew=new l.o(this,0,0)),this._skew}set skew(t){this._skew===N&&(this._skew=new l.o(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===B&&(this._scale=new l.o(this,1,1)),this._scale}set scale(t){this._scale===B&&(this._scale=new l.o(this,0,0)),"string"==typeof t&&(t=parseFloat(t)),"number"==typeof t?this._scale.set(t):this._scale.copyFrom(t)}get origin(){return this._origin===G&&(this._origin=new l.o(this,0,0)),this._origin}set origin(t){this._origin===G&&(this._origin=new l.o(this,0,0),this._pivot!==F&&(0,u.R)("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),"number"==typeof t?this._origin.set(t):this._origin.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){const i=this.getLocalBounds();"object"==typeof t?(e=t.height??t.width,t=t.width):e??(e=t),void 0!==t&&this._setWidth(t,i.width),void 0!==e&&this._setHeight(e,i.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set("number"==typeof t.x?t.x:this.position.x,"number"==typeof t.y?t.y:this.position.y),this.scale.set("number"==typeof t.scaleX?t.scaleX||1:this.scale.x,"number"==typeof t.scaleY?t.scaleY||1:this.scale.y),this.rotation="number"==typeof t.rotation?t.rotation:this.rotation,this.skew.set("number"==typeof t.skewX?t.skewX:this.skew.x,"number"==typeof t.skewY?t.skewY:this.skew.y),this.pivot.set("number"==typeof t.pivotX?t.pivotX:this.pivot.x,"number"==typeof t.pivotY?t.pivotY:this.pivot.y),this.origin.set("number"==typeof t.originX?t.originX:this.origin.x,"number"==typeof t.originY?t.originY:this.origin.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,i=this._scale,n=this._pivot,r=this._origin,s=this._position,o=i._x,a=i._y,l=n._x,h=n._y,c=-r._x,u=-r._y;e.a=this._cx*o,e.b=this._sx*o,e.c=this._cy*a,e.d=this._sy*a,e.tx=s._x-(l*e.a+h*e.c)+(c*e.a+u*e.c)-c,e.ty=s._y-(l*e.b+h*e.d)+(c*e.b+u*e.d)-u}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=z,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const e=r.Q.shared.setValue(t??16777215).toBgrNumber();e!==this.localColor&&(this.localColor=e,this._updateFlags|=z,this._onUpdate())}get tint(){return(0,E.D)(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=U,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(2&this.localDisplayStatus)}set visible(t){const e=t?2:0;(2&this.localDisplayStatus)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=W,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",t))}get culled(){return!(4&this.localDisplayStatus)}set culled(t){const e=t?0:4;(4&this.localDisplayStatus)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=W,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(1&this.localDisplayStatus)}set renderable(t){const e=t?1:0;(1&this.localDisplayStatus)!==e&&(this._updateFlags|=W,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return 7===this.localDisplayStatus&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;let e;this.destroyed=!0,this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners();if(("boolean"==typeof t?t:t?.children)&&e)for(let i=0;i<e.length;++i)e[i].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}}s.XO.mixin(H,m,C,j,O,P,b,x,I,{cullArea:null,cullable:!1,cullableChildren:!0},p,E.R,y)},3284:(t,e,i)=>{i.d(e,{m:()=>o});var n=i(9313),r=i(848),s=i(2437);class o{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new n.u,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new r.L,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let t=0;t<e.length;t++){const i=e[t];i._updateFlags=15,this.addChild(i)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(s.W.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const t=this._parentCacheAsTextureRenderGroup;t&&!t.textureNeedsUpdate&&t.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){const e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup)return void this.addRenderGroupChild(t.renderGroup);t._onRender&&this.addOnRender(t);const e=t.children;for(let t=0;t<e.length;t++)this.addChild(e[t])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup)return void this._removeRenderGroupChild(t.renderGroup);const e=t.children;for(let t=0;t<e.length;t++)this.removeChild(e[t])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return 7===this.root.localDisplayStatus&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const e=this.root.children;for(let i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const i=t.children;for(let t=0;t<i.length;t++)this._getChildren(i[t],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return 1&this._matrixDirty?(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new n.u),this._inverseWorldTransform.copyFrom(this.worldTransform).invert()):this._inverseWorldTransform}get textureOffsetInverseTransform(){return 2&this._matrixDirty?(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new n.u),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y)):this._textureOffsetInverseTransform}get inverseParentTextureTransform(){if(!(4&this._matrixDirty))return this._inverseParentTextureTransform;this._matrixDirty&=-5;const t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new n.u),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}},9636:(t,e,i)=>{i.d(e,{c:()=>o});var n=i(9313),r=i(9252);const s=new n.u;class o{constructor(t=1/0,e=1/0,i=-1/0,n=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=s,this.minX=t,this.minY=e,this.maxX=i,this.maxY=n}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new r.M);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=s,this}set(t,e,i,n){this.minX=t,this.minY=e,this.maxX=i,this.maxY=n}addFrame(t,e,i,n,r){r||(r=this.matrix);const s=r.a,o=r.b,a=r.c,l=r.d,h=r.tx,c=r.ty;let u=this.minX,d=this.minY,p=this.maxX,f=this.maxY,m=s*t+a*e+h,y=o*t+l*e+c;m<u&&(u=m),y<d&&(d=y),m>p&&(p=m),y>f&&(f=y),m=s*i+a*e+h,y=o*i+l*e+c,m<u&&(u=m),y<d&&(d=y),m>p&&(p=m),y>f&&(f=y),m=s*t+a*n+h,y=o*t+l*n+c,m<u&&(u=m),y<d&&(d=y),m>p&&(p=m),y>f&&(f=y),m=s*i+a*n+h,y=o*i+l*n+c,m<u&&(u=m),y<d&&(d=y),m>p&&(p=m),y>f&&(f=y),this.minX=u,this.minY=d,this.maxX=p,this.maxY=f}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const e=this.minX,i=this.minY,n=this.maxX,r=this.maxY,{a:s,b:o,c:a,d:l,tx:h,ty:c}=t;let u=s*e+a*i+h,d=o*e+l*i+c;this.minX=u,this.minY=d,this.maxX=u,this.maxY=d,u=s*n+a*i+h,d=o*n+l*i+c,this.minX=u<this.minX?u:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=u>this.maxX?u:this.maxX,this.maxY=d>this.maxY?d:this.maxY,u=s*e+a*r+h,d=o*e+l*r+c,this.minX=u<this.minX?u:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=u>this.maxX?u:this.maxX,this.maxY=d>this.maxY?d:this.maxY,u=s*n+a*r+h,d=o*n+l*r+c,this.minX=u<this.minX?u:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=u>this.maxX?u:this.maxX,this.maxY=d>this.maxY?d:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,n){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),this.maxY>n&&(this.maxY=n),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new o(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,i,n){let r=this.minX,s=this.minY,o=this.maxX,a=this.maxY;n||(n=this.matrix);const l=n.a,h=n.b,c=n.c,u=n.d,d=n.tx,p=n.ty;for(let n=e;n<i;n+=2){const e=t[n],i=t[n+1],f=l*e+c*i+d,m=h*e+u*i+p;r=f<r?f:r,s=m<s?m:s,o=f>o?f:o,a=m>a?m:a}this.minX=r,this.minY=s,this.maxX=o,this.maxY=a}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}},9443:(t,e,i)=>{i.d(e,{E:()=>a,f:()=>s});var n=i(9313),r=i(2208);function s(t,e,i){let s,l;return i.clear(),t.parent?e?s=t.parent.worldTransform:(l=r.u.get().identity(),s=a(t,l)):s=n.u.IDENTITY,o(t,i,s,e),l&&r.u.return(l),i.isValid||i.set(0,0,0,0),i}function o(t,e,i,s){if(!t.visible||!t.measurable)return;let a;s?a=t.worldTransform:(t.updateLocalTransform(),a=r.u.get(),a.appendFrom(t.localTransform,i));const l=e,h=!!t.effects.length;if(h&&(e=r.o.get().clear()),t.boundsArea)e.addRect(t.boundsArea,a);else{const i=t.bounds;i&&!i.isEmpty()&&(e.matrix=a,e.addBounds(i));for(let i=0;i<t.children.length;i++)o(t.children[i],e,a,s)}if(h){for(let i=0;i<t.effects.length;i++)t.effects[i].addBounds?.(e);l.addBounds(e,n.u.IDENTITY),r.o.return(e)}s||r.u.return(a)}function a(t,e){const i=t.parent;return i&&(a(i,e),i.updateLocalTransform(),e.append(i.localTransform)),e}},7269:(t,e,i)=>{i.d(e,{n:()=>s});var n=i(9313),r=i(2208);function s(t,e,i){return e.clear(),i||(i=n.u.IDENTITY),o(t,e,i,t,!0),e.isValid||e.set(0,0,0,0),e}function o(t,e,i,s,a){let l;if(a)l=r.u.get(),l=i.copyTo(l);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();const e=t.localTransform;l=r.u.get(),l.appendFrom(e,i)}const h=e,c=!!t.effects.length;if(c&&(e=r.o.get().clear()),t.boundsArea)e.addRect(t.boundsArea,l);else{t.renderPipeId&&(e.matrix=l,e.addBounds(t.bounds));const i=t.children;for(let t=0;t<i.length;t++)o(i[t],e,l,s,!1)}if(c){for(let i=0;i<t.effects.length;i++)t.effects[i].addLocalBounds?.(e,s);h.addBounds(e,n.u.IDENTITY),r.o.return(e)}r.u.return(l)}},2208:(t,e,i)=>{i.d(e,{o:()=>a,u:()=>o});var n=i(9313),r=i(8655),s=i(9636);const o=r.Z.getPool(n.u),a=r.Z.getPool(s.c)},198:(t,e,i)=>{i.d(e,{D:()=>a,R:()=>l});var n=i(9313),r=i(9443),s=i(2208),o=i(753);function a(t){return((255&t)<<16)+(65280&t)+(t>>16&255)}const l={getGlobalAlpha(t){if(t)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,i=this.parent;for(;i;)e*=i.alpha,i=i.parent;return e},getGlobalTransform(t=new n.u,e){if(e)return t.copyFrom(this.worldTransform);this.updateLocalTransform();const i=(0,r.E)(this,s.u.get().identity());return t.appendFrom(this.localTransform,i),s.u.return(i),t},getGlobalTint(t){if(t)return this.renderGroup?a(this.renderGroup.worldColor):this.parentRenderGroup?a((0,o.j)(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,i=this.parent;for(;i;)e=(0,o.j)(e,i.localColor),i=i.parent;return a(e)}}},2698:(t,e,i)=>{function n(t){const e={};for(const i in t)void 0!==t[i]&&(e[i]=t[i]);return e}i.d(e,{S:()=>n})},753:(t,e,i)=>{i.d(e,{j:()=>s});var n=i(4676);const r=16777215;function s(t,e){return t===r?e:e===r?t:(0,n.u)(t,e)}},4676:(t,e,i)=>{function n(t,e){if(16777215===t||!e)return e;if(16777215===e||!t)return t;return(((t>>16&255)*(e>>16&255)/255|0)<<16)+(((t>>8&255)*(e>>8&255)/255|0)<<8)+((255&t)*(255&e)/255|0)}i.d(e,{u:()=>n})},2760:(t,e,i)=>{function n(t,e,i){const n=(t>>24&255)/255;e[i++]=(255&t)/255*n,e[i++]=(t>>8&255)/255*n,e[i++]=(t>>16&255)/255*n,e[i++]=n}i.d(e,{V:()=>n})},6954:(t,e,i)=>{i.d(e,{G:()=>o});var n=i(9313),r=i(4676);const s=new n.u;class o{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|65280&t|(255&t)<<16,i=this.renderable;return i?(0,r.u)(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(255*this.alpha<<24)}get transform(){return this.renderable?.groupTransform||s}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}},4663:(t,e,i)=>{i.d(e,{A:()=>_});var n=i(4670),r=i(4985),s=i(8393),o=i(8507),a=i(848),l=i(4334);class h{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class c{constructor(){this.instructions=new a.L}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const u=class t{constructor(t){this._renderer=t,this._managedContexts=new l.s({renderer:t,type:"resource",name:"graphicsContext"})}init(e){t.defaultOptions.bezierSmoothness=e?.bezierSmoothness??t.defaultOptions.bezierSmoothness}getContextRenderData(t){return this.getGpuContext(t).graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=t._gpuData,i=!!e[this._renderer.uid],n=e[this._renderer.uid]||this._initContext(t);return!t.dirty&&i||(i&&n.reset(),n.isBatchable=!1,t.dirty=!1),n}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=new c;return this.getGpuContext(t).graphicsData=e,e.init(),e}_initContext(t){const e=new h;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};u.extension={type:[o.Ag.CanvasSystem],name:"graphicsContext"},u.defaultOptions={bezierSmoothness:.5};let d=u;var p=i(7547);class f{constructor(t,e){this.state=p.U.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new l.s({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){return!1}addRenderable(t,e){this._managedGraphics.add(t),this.renderer.renderPipes.batch.break(e),e.add(t)}updateRenderable(t){}execute(t){t.isRenderable&&this._adaptor.execute(this,t)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}}f.extension={type:[o.Ag.CanvasPipes],name:"graphics"};var m=i(378),y=i(8655),g=i(2760),v=i(6954);class b{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach((t=>{y.Z.return(t)})),this.batches.length=0}}class x{constructor(t,e){this.state=p.U.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new l.s({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){const e=t.context,i=!!t._gpuData,n=this.renderer.graphicsContext.updateGpuContext(e);return!(!n.isBatchable&&i===n.isBatchable)}addRenderable(t,e){const i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const e=this._getGpuDataForRenderable(t).batches;for(let t=0;t<e.length;t++){const i=e[t];i._batcher.updateElement(i)}}execute(t){if(!t.isRenderable)return;const e=this.renderer,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;const n=i.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const r=n.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=e._roundPixels|t._roundPixels,(0,g.V)(t.groupColorAlpha,r.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=this._getGpuDataForRenderable(t),i=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),i.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){const i=this.renderer.renderPipes.batch,n=this._getGpuDataForRenderable(t).batches;for(let t=0;t<n.length;t++){const r=n[t];i.addToBatch(r,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){const e=new b;return t._gpuData[this.renderer.uid]=e,this._managedGraphics.add(t),e}_updateBatchesForRenderable(t,e){const i=t.context,n=this.renderer.graphicsContext.getGpuContext(i),r=this.renderer._roundPixels|t._roundPixels;e.batches=n.batches.map((e=>{const i=y.Z.get(v.G);return e.copyTo(i),i.renderable=t,i.roundPixels=r,i}))}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}x.extension={type:[o.Ag.WebGLPipes,o.Ag.WebGPUPipes],name:"graphics"},o.XO.add(f),o.XO.add(x),o.XO.add(d),o.XO.add(m.GH);class _ extends r.l{constructor(t){t instanceof s.T&&(t={context:t});const{context:e,roundPixels:i,...n}=t||{};super({label:"Graphics",...n}),this.renderPipeId="graphics",e?this.context=e:(this.context=this._ownedContext=new s.T,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=i??!1}set context(t){t!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=t,this._context.on("update",this.onViewUpdate,this),this._context.on("unload",this.unload,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):!0!==t&&!0!==t?.context||this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_onTouch(t){this._gcLastUsed=t,this._context._gcLastUsed=t}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){if(t)return new _(this._context.clone());this._ownedContext=null;return new _(this._context)}lineStyle(t,e,i){(0,n.t6)(n.lj,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const r={};return t&&(r.width=t),e&&(r.color=e),i&&(r.alpha=i),this.context.strokeStyle=r,this}beginFill(t,e){(0,n.t6)(n.lj,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const i={};return void 0!==t&&(i.color=t),void 0!==e&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){(0,n.t6)(n.lj,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const t=this.context.strokeStyle;return t.width===s.T.defaultStrokeStyle.width&&t.color===s.T.defaultStrokeStyle.color&&t.alpha===s.T.defaultStrokeStyle.alpha||this.context.stroke(),this}drawCircle(...t){return(0,n.t6)(n.lj,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return(0,n.t6)(n.lj,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return(0,n.t6)(n.lj,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return(0,n.t6)(n.lj,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return(0,n.t6)(n.lj,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return(0,n.t6)(n.lj,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}},8393:(t,e,i)=>{i.d(e,{T:()=>ht});var n=i(8875),r=i(2577),s=i(9313),o=i(5101),a=i(5589),l=i(133),h=i(4670),c=i(9636),u=i(268),d=i(8133);var p=i(6125),f=i(9252);class m{constructor(t=0,e=0,i=0,n=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=n}clone(){return new m(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,n=(e-this.y)/this.halfHeight;return i*=i,n*=n,i+n<=1}strokeContains(t,e,i,n=.5){const{halfWidth:r,halfHeight:s}=this;if(r<=0||s<=0)return!1;const o=i*(1-n),a=i-o,l=r-a,h=s-a,c=r+o,u=s+o,d=t-this.x,p=e-this.y;return d*d/(l*l)+p*p/(h*h)>1&&d*d/(c*c)+p*p/(u*u)<=1}getBounds(t){return t||(t=new f.M),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=2*this.halfWidth,t.height=2*this.halfHeight,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function y(t,e,i,n,r,s){const o=r-i,a=s-n,l=o*o+a*a;let h,c,u=-1;0!==l&&(u=((t-i)*o+(e-n)*a)/l),u<0?(h=i,c=n):u>1?(h=r,c=s):(h=i+u*o,c=n+u*a);const d=t-h,p=e-c;return d*d+p*p}class g{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if("number"!=typeof e[0]){const t=[];for(let i=0,n=e.length;i<n;i++)t.push(e[i].x,e[i].y);e=t}this.points=e,this.closePath=!0}isClockwise(){let t=0;const e=this.points,i=e.length;for(let n=0;n<i;n+=2){const r=e[n],s=e[n+1];t+=(e[(n+2)%i]-r)*(e[(n+3)%i]+s)}return t<0}containsPolygon(t){const e=this.getBounds(undefined),i=t.getBounds(undefined);if(!e.containsRect(i))return!1;const n=t.points;for(let t=0;t<n.length;t+=2){const e=n[t],i=n[t+1];if(!this.contains(e,i))return!1}return!0}clone(){const t=this.points.slice(),e=new g(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1;const n=this.points.length/2;for(let r=0,s=n-1;r<n;s=r++){const n=this.points[2*r],o=this.points[2*r+1],a=this.points[2*s],l=this.points[2*s+1];o>e!=l>e&&t<(e-o)/(l-o)*(a-n)+n&&(i=!i)}return i}strokeContains(t,e,i,n=.5){const r=i*i,s=r*(1-n),o=r-s,{points:a}=this,l=a.length-(this.closePath?0:2);for(let i=0;i<l;i+=2){const n=a[i],r=a[i+1],l=a[(i+2)%a.length],h=a[(i+3)%a.length];if(y(t,e,n,r,l,h)<=(Math.sign((l-n)*(e-r)-(h-r)*(t-n))<0?o:s))return!0}return!1}getBounds(t){t||(t=new f.M);const e=this.points;let i=1/0,n=-1/0,r=1/0,s=-1/0;for(let t=0,o=e.length;t<o;t+=2){const o=e[t],a=e[t+1];i=o<i?o:i,n=o>n?o:n,r=a<r?a:r,s=a>s?a:s}return t.x=i,t.width=n-i,t.y=r,t.height=s-r,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce(((t,e)=>`${t}, ${e}`),"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return(0,h.t6)("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return(0,h.t6)("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const v=(t,e,i,n,r,s,o)=>{const a=t-i,l=e-n,h=Math.sqrt(a*a+l*l);return h>=r-s&&h<=r+o};class b{constructor(t=0,e=0,i=0,n=0,r=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=n,this.radius=r}getBounds(t){return t||(t=new f.M),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new b(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let n=t-(this.x+i),r=e-(this.y+i);const s=i*i;if(n*n+r*r<=s)return!0;if(n=t-(this.x+this.width-i),n*n+r*r<=s)return!0;if(r=e-(this.y+this.height-i),n*n+r*r<=s)return!0;if(n=t-(this.x+i),n*n+r*r<=s)return!0}return!1}strokeContains(t,e,i,n=.5){const{x:r,y:s,width:o,height:a,radius:l}=this,h=i*(1-n),c=i-h,u=r+l,d=s+l,p=r+o,f=s+a;return(t>=r-h&&t<=r+c||t>=p-c&&t<=p+h)&&e>=d&&e<=d+(a-2*l)||((e>=s-h&&e<=s+c||e>=f-c&&e<=f+h)&&t>=u&&t<=u+(o-2*l)||(t<u&&e<d&&v(t,e,u,d,l,c,h)||t>p-l&&e<d&&v(t,e,p-l,d,l,c,h)||t>p-l&&e>f-l&&v(t,e,p-l,f-l,l,c,h)||t<u&&e>f-l&&v(t,e,u,f-l,l,c,h)))}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}var x=i(378);const _=8,w=1.1920929e-7,S=1,C=.01,E=0,k=0;function A(t,e,i,n,r,s,o,a,l,h){const c=Math.min(.99,Math.max(0,h??x.GH.defaultOptions.bezierSmoothness));let u=(S-c)/1;return u*=u,function(t,e,i,n,r,s,o,a,l,h){T(t,e,i,n,r,s,o,a,l,h,0),l.push(o,a)}(e,i,n,r,s,o,a,l,t,u),t}function T(t,e,i,n,r,s,o,a,l,h,c){if(c>_)return;const u=Math.PI,d=(t+i)/2,p=(e+n)/2,f=(i+r)/2,m=(n+s)/2,y=(r+o)/2,g=(s+a)/2,v=(d+f)/2,b=(p+m)/2,x=(f+y)/2,S=(m+g)/2,A=(v+x)/2,M=(b+S)/2;if(c>0){let c=o-t,d=a-e;const p=Math.abs((i-o)*d-(n-a)*c),f=Math.abs((r-o)*d-(s-a)*c);let m,y;if(p>w&&f>w){if((p+f)*(p+f)<=h*(c*c+d*d)){if(E<C)return void l.push(A,M);const h=Math.atan2(s-n,r-i);if(m=Math.abs(h-Math.atan2(n-e,i-t)),y=Math.abs(Math.atan2(a-s,o-r)-h),m>=u&&(m=2*u-m),y>=u&&(y=2*u-y),m+y<E)return void l.push(A,M);if(0!==k){if(m>k)return void l.push(i,n);if(y>k)return void l.push(r,s)}}}else if(p>w){if(p*p<=h*(c*c+d*d)){if(E<C)return void l.push(A,M);if(m=Math.abs(Math.atan2(s-n,r-i)-Math.atan2(n-e,i-t)),m>=u&&(m=2*u-m),m<E)return l.push(i,n),void l.push(r,s);if(0!==k&&m>k)return void l.push(i,n)}}else if(f>w){if(f*f<=h*(c*c+d*d)){if(E<C)return void l.push(A,M);if(m=Math.abs(Math.atan2(a-s,o-r)-Math.atan2(s-n,r-i)),m>=u&&(m=2*u-m),m<E)return l.push(i,n),void l.push(r,s);if(0!==k&&m>k)return void l.push(r,s)}}else if(c=A-(t+o)/2,d=M-(e+a)/2,c*c+d*d<=h)return void l.push(A,M)}T(t,e,d,p,v,b,A,M,l,h,c+1),T(A,M,x,S,y,g,o,a,l,h,c+1)}const M=8,P=1.1920929e-7,O=.01,I=0;function L(t,e,i,n,r,s,o,a){let l=(1-Math.min(.99,Math.max(0,a??x.GH.defaultOptions.bezierSmoothness)))/1;return l*=l,function(t,e,i,n,r,s,o,a){R(o,t,e,i,n,r,s,a,0),o.push(r,s)}(e,i,n,r,s,o,t,l),t}function R(t,e,i,n,r,s,o,a,l){if(l>M)return;const h=Math.PI,c=(e+n)/2,u=(i+r)/2,d=(n+s)/2,p=(r+o)/2,f=(c+d)/2,m=(u+p)/2;let y=s-e,g=o-i;const v=Math.abs((n-s)*g-(r-o)*y);if(v>P){if(v*v<=a*(y*y+g*g)){if(I<O)return void t.push(f,m);let a=Math.abs(Math.atan2(o-r,s-n)-Math.atan2(r-i,n-e));if(a>=h&&(a=2*h-a),a<I)return void t.push(f,m)}}else if(y=f-(e+s)/2,g=m-(i+o)/2,y*y+g*g<=a)return void t.push(f,m);R(t,e,i,c,u,f,m,a,l+1),R(t,f,m,d,p,s,o,a,l+1)}function j(t,e,i,n,r,s,o,a){let l=Math.abs(r-s);(!o&&r>s||o&&s>r)&&(l=2*Math.PI-l),a||(a=Math.max(6,Math.floor(6*Math.pow(n,1/3)*(l/Math.PI))));let h=l/(a=Math.max(a,3)),c=r;h*=o?-1:1;for(let r=0;r<a+1;r++){const r=e+Math.cos(c)*n,s=i+Math.sin(c)*n;t.push(r,s),c+=h}}const D=2*Math.PI,N={centerX:0,centerY:0,ang1:0,ang2:0},F=({x:t,y:e},i,n,r,s,o,a,l)=>{const h=r*(t*=i)-s*(e*=n),c=s*t+r*e;return l.x=h+o,l.y=c+a,l};function B(t,e){const i=-1.5707963267948966===e?-.551915024494:4/3*Math.tan(e/4),n=1.5707963267948966===e?.551915024494:i,r=Math.cos(t),s=Math.sin(t),o=Math.cos(t+e),a=Math.sin(t+e);return[{x:r-s*n,y:s+r*n},{x:o+a*n,y:a-o*n},{x:o,y:a}]}const G=(t,e,i,n)=>{let r=t*i+e*n;return r>1&&(r=1),r<-1&&(r=-1),(t*n-e*i<0?-1:1)*Math.acos(r)};function z(t,e,i,n,r,s,o,a=0,l=0,h=0){if(0===s||0===o)return;const c=Math.sin(a*D/360),u=Math.cos(a*D/360),d=u*(e-n)/2+c*(i-r)/2,p=-c*(e-n)/2+u*(i-r)/2;if(0===d&&0===p)return;s=Math.abs(s),o=Math.abs(o);const f=Math.pow(d,2)/Math.pow(s,2)+Math.pow(p,2)/Math.pow(o,2);f>1&&(s*=Math.sqrt(f),o*=Math.sqrt(f)),((t,e,i,n,r,s,o,a,l,h,c,u,d)=>{const p=Math.pow(r,2),f=Math.pow(s,2),m=Math.pow(c,2),y=Math.pow(u,2);let g=p*f-p*y-f*m;g<0&&(g=0),g/=p*y+f*m,g=Math.sqrt(g)*(o===a?-1:1);const v=g*r/s*u,b=g*-s/r*c,x=h*v-l*b+(t+i)/2,_=l*v+h*b+(e+n)/2,w=(c-v)/r,S=(u-b)/s,C=(-c-v)/r,E=(-u-b)/s,k=G(1,0,w,S);let A=G(w,S,C,E);0===a&&A>0&&(A-=D),1===a&&A<0&&(A+=D),d.centerX=x,d.centerY=_,d.ang1=k,d.ang2=A})(e,i,n,r,s,o,l,h,c,u,d,p,N);let{ang1:m,ang2:y}=N;const{centerX:g,centerY:v}=N;let b=Math.abs(y)/(D/4);Math.abs(1-b)<1e-7&&(b=1);const x=Math.max(Math.ceil(b),1);y/=x;let _=t[t.length-2],w=t[t.length-1];const S={x:0,y:0};for(let e=0;e<x;e++){const e=B(m,y),{x:i,y:n}=F(e[0],s,o,u,c,g,v,S),{x:r,y:a}=F(e[1],s,o,u,c,g,v,S),{x:l,y:h}=F(e[2],s,o,u,c,g,v,S);A(t,_,w,i,n,r,a,l,h),_=l,w=h,m+=y}}const U=new f.M;class W{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new c.c,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const i=this._currentPoly.points,n=i[i.length-2],r=i[i.length-1];return n===t&&r===e||i.push(t,e),this}arc(t,e,i,n,r,s){this._ensurePoly(!1);return j(this._currentPoly.points,t,e,i,n,r,s),this}arcTo(t,e,i,n,r){this._ensurePoly();return function(t,e,i,n,r,s){const o=t[t.length-2],a=t[t.length-1]-i,l=o-e,h=r-i,c=n-e,u=Math.abs(a*c-l*h);if(u<1e-8||0===s)return void(t[t.length-2]===e&&t[t.length-1]===i||t.push(e,i));const d=a*a+l*l,p=h*h+c*c,f=a*h+l*c,m=s*Math.sqrt(d)/u,y=s*Math.sqrt(p)/u,g=m*f/d,v=y*f/p,b=m*c+y*l,x=m*h+y*a,_=l*(y+g),w=a*(y+g),S=c*(m+v),C=h*(m+v);j(t,b+e,x+i,s,Math.atan2(w-x,_-b),Math.atan2(C-x,S-b),l*h>c*a)}(this._currentPoly.points,t,e,i,n,r),this}arcToSvg(t,e,i,n,r,s,o){return z(this._currentPoly.points,this._currentPoly.lastX,this._currentPoly.lastY,s,o,t,e,i,n,r),this}bezierCurveTo(t,e,i,n,r,s,o){this._ensurePoly();const a=this._currentPoly;return A(this._currentPoly.points,a.lastX,a.lastY,t,e,i,n,r,s,o),this}quadraticCurveTo(t,e,i,n,r){this._ensurePoly();const s=this._currentPoly;return L(this._currentPoly.points,s.lastX,s.lastY,t,e,i,n,r),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0)).transform(e);const i=this.shapePrimitives,n=i.length;for(let e=0;e<t.instructions.length;e++){const i=t.instructions[e];this[i.action](...i.data)}if(t.checkForHoles&&i.length-n>1){let t=null;for(let e=n;e<i.length;e++){const n=i[e];if("polygon"===n.shape.type){const r=n.shape,s=t?.shape;s&&s.containsPolygon(r)?(t.holes||(t.holes=[]),t.holes.push(n),i.copyWithin(e,e+1),i.length--,e--):t=n}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,n,r){return this.drawShape(new f.M(t,e,i,n),r),this}circle(t,e,i,n){return this.drawShape(new p.j(t,e,i),n),this}poly(t,e,i){const n=new g(t);return n.closePath=e,this.drawShape(n,i),this}regularPoly(t,e,i,n,r=0,s){n=Math.max(0|n,3);const o=-1*Math.PI/2+r,a=2*Math.PI/n,l=[];for(let r=0;r<n;r++){const n=o-r*a;l.push(t+i*Math.cos(n),e+i*Math.sin(n))}return this.poly(l,!0,s),this}roundPoly(t,e,i,n,r,s=0,o){if(n=Math.max(0|n,3),r<=0)return this.regularPoly(t,e,i,n,s);const a=i*Math.sin(Math.PI/n)-.001;r=Math.min(r,a);const l=-1*Math.PI/2+s,h=2*Math.PI/n,c=(n-2)*Math.PI/n/2;for(let s=0;s<n;s++){const n=s*h+l,a=t+i*Math.cos(n),u=e+i*Math.sin(n),d=n+Math.PI+c,p=n-Math.PI-c,f=a+r*Math.cos(d),m=u+r*Math.sin(d),y=a+r*Math.cos(p),g=u+r*Math.sin(p);0===s?this.moveTo(f,m):this.lineTo(f,m),this.quadraticCurveTo(a,u,y,g,o)}return this.closePath()}roundShape(t,e,i=!1,n){return t.length<3?this:(i?function(t,e,i,n){const r=(t,e)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),s=(t,e,i)=>({x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i}),o=e.length;for(let a=0;a<o;a++){const l=e[(a+1)%o],h=l.radius??i;if(h<=0){0===a?t.moveTo(l.x,l.y):t.lineTo(l.x,l.y);continue}const c=e[a],u=e[(a+2)%o],d=r(c,l);let p;p=d<1e-4?l:s(l,c,Math.min(d/2,h)/d);const f=r(u,l);let m;m=f<1e-4?l:s(l,u,Math.min(f/2,h)/f),0===a?t.moveTo(p.x,p.y):t.lineTo(p.x,p.y),t.quadraticCurveTo(l.x,l.y,m.x,m.y,n)}}(this,t,e,n):function(t,e,i){const n=(t,e)=>{const i=e.x-t.x,n=e.y-t.y,r=Math.sqrt(i*i+n*n);return{len:r,nx:i/r,ny:n/r}},r=(e,i)=>{0===e?t.moveTo(i.x,i.y):t.lineTo(i.x,i.y)};let s=e[e.length-1];for(let o=0;o<e.length;o++){const a=e[o%e.length],l=a.radius??i;if(l<=0){r(o,a),s=a;continue}const h=e[(o+1)%e.length],c=n(a,s),u=n(a,h);if(c.len<1e-4||u.len<1e-4){r(o,a),s=a;continue}let d=Math.asin(c.nx*u.ny-c.ny*u.nx),p=1,f=!1;c.nx*u.nx-c.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,p=-1,f=!0):d>0&&(p=-1,f=!0);const m=d/2;let y,g=Math.abs(Math.cos(m)*l/Math.sin(m));g>Math.min(c.len/2,u.len/2)?(g=Math.min(c.len/2,u.len/2),y=Math.abs(g*Math.sin(m)/Math.cos(m))):y=l;const v=a.x+u.nx*g+-u.ny*y*p,b=a.y+u.ny*g+u.nx*y*p,x=Math.atan2(c.ny,c.nx)+Math.PI/2*p,_=Math.atan2(u.ny,u.nx)-Math.PI/2*p;0===o&&t.moveTo(v+Math.cos(x)*y,b+Math.sin(x)*y),t.arc(v,b,y,x,_,f),s=a}}(this,t,e),this.closePath())}filletRect(t,e,i,n,r){if(0===r)return this.rect(t,e,i,n);const s=Math.min(i,n)/2,o=Math.min(s,Math.max(-s,r)),a=t+i,l=e+n,h=o<0?-o:0,c=Math.abs(o);return this.moveTo(t,e+c).arcTo(t+h,e+h,t+c,e,c).lineTo(a-c,e).arcTo(a-h,e+h,a,e+c,c).lineTo(a,l-c).arcTo(a-h,l-h,t+i-c,l,c).lineTo(t+c,l).arcTo(t+h,l-h,t,l-c,c).closePath()}chamferRect(t,e,i,n,r,s){if(r<=0)return this.rect(t,e,i,n);const o=Math.min(r,Math.min(i,n)/2),a=t+i,l=e+n,h=[t+o,e,a-o,e,a,e+o,a,l-o,a-o,l,t+o,l,t,l-o,t,e+o];for(let t=h.length-1;t>=2;t-=2)h[t]===h[t-2]&&h[t-1]===h[t-3]&&h.splice(t-1,2);return this.poly(h,!0,s)}ellipse(t,e,i,n,r){return this.drawShape(new m(t,e,i,n),r),this}roundRect(t,e,i,n,r,s){return this.drawShape(new b(t,e,i,n,r),s),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new g,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new g,t)){const t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let e=t.shape.x,i=t.shape.y;if(t.transform&&!t.transform.isIdentity()){const n=t.transform,r=e;e=n.a*e+n.c*i+n.tx,i=n.b*r+n.d*i+n.ty}this._currentPoly.points.push(e,i)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let i=0;i<e.length;i++){const n=e[i],r=n.shape.getBounds(U);n.transform?t.addRect(r,n.transform):t.addRect(r)}return t}}class H{constructor(t,e=!1){this.instructions=[],this.uid=(0,l.L)("graphicsPath"),this._dirty=!0,this.checkForHoles=e,"string"==typeof t?function(t,e){const i=d(t),n=[];let r=null,s=0,o=0;for(let t=0;t<i.length;t++){const a=i[t],l=a[0],h=a;switch(l){case"M":s=h[1],o=h[2],e.moveTo(s,o);break;case"m":s+=h[1],o+=h[2],e.moveTo(s,o);break;case"H":s=h[1],e.lineTo(s,o);break;case"h":s+=h[1],e.lineTo(s,o);break;case"V":o=h[1],e.lineTo(s,o);break;case"v":o+=h[1],e.lineTo(s,o);break;case"L":s=h[1],o=h[2],e.lineTo(s,o);break;case"l":s+=h[1],o+=h[2],e.lineTo(s,o);break;case"C":s=h[5],o=h[6],e.bezierCurveTo(h[1],h[2],h[3],h[4],s,o);break;case"c":e.bezierCurveTo(s+h[1],o+h[2],s+h[3],o+h[4],s+h[5],o+h[6]),s+=h[5],o+=h[6];break;case"S":s=h[3],o=h[4],e.bezierCurveToShort(h[1],h[2],s,o);break;case"s":e.bezierCurveToShort(s+h[1],o+h[2],s+h[3],o+h[4]),s+=h[3],o+=h[4];break;case"Q":s=h[3],o=h[4],e.quadraticCurveTo(h[1],h[2],s,o);break;case"q":e.quadraticCurveTo(s+h[1],o+h[2],s+h[3],o+h[4]),s+=h[3],o+=h[4];break;case"T":s=h[1],o=h[2],e.quadraticCurveToShort(s,o);break;case"t":s+=h[1],o+=h[2],e.quadraticCurveToShort(s,o);break;case"A":s=h[6],o=h[7],e.arcToSvg(h[1],h[2],h[3],h[4],h[5],s,o);break;case"a":s+=h[6],o+=h[7],e.arcToSvg(h[1],h[2],h[3],h[4],h[5],s,o);break;case"Z":case"z":e.closePath(),n.length>0&&(r=n.pop(),r?(s=r.startX,o=r.startY):(s=0,o=0)),r=null;break;default:(0,u.R)(`Unknown SVG path command: ${l}`)}"Z"!==l&&"z"!==l&&null===r&&(r={startX:s,startY:o},n.push(r))}}(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new W(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,i,n,r){const s=this.instructions[this.instructions.length-1],a=this.getLastPoint(o.b.shared);let l=0,h=0;if(s&&"bezierCurveTo"===s.action){l=s.data[2],h=s.data[3];const t=a.x,e=a.y;l=t+(t-l),h=e+(e-h)}else l=a.x,h=a.y;return this.instructions.push({action:"bezierCurveTo",data:[l,h,t,e,i,n,r]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,i){const n=this.instructions[this.instructions.length-1],r=this.getLastPoint(o.b.shared);let s=0,a=0;if(n&&"quadraticCurveTo"===n.action){s=n.data[0],a=n.data[1];const t=r.x,e=r.y;s=t+(t-s),a=e+(e-a)}else s=r.x,a=r.y;return this.instructions.push({action:"quadraticCurveTo",data:[s,a,t,e,i]}),this._dirty=!0,this}rect(t,e,i,n,r){return this.instructions.push({action:"rect",data:[t,e,i,n,r]}),this._dirty=!0,this}circle(t,e,i,n){return this.instructions.push({action:"circle",data:[t,e,i,n]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,i,n,r,s,o){r||(r=n/2);const a=-1*Math.PI/2+s,l=2*i,h=2*Math.PI/l,c=[];for(let i=0;i<l;i++){const s=i%2?r:n,o=i*h+a;c.push(t+s*Math.cos(o),e+s*Math.sin(o))}return this.poly(c,!0,o),this}clone(t=!1){const e=new H;if(e.checkForHoles=this.checkForHoles,t)for(let t=0;t<this.instructions.length;t++){const i=this.instructions[t];e.instructions.push({action:i.action,data:i.data.slice()})}else e.instructions=this.instructions.slice();return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,i=t.b,n=t.c,r=t.d,s=t.tx,o=t.ty;let a=0,l=0,h=0,c=0,d=0,p=0,f=0,m=0;for(let y=0;y<this.instructions.length;y++){const g=this.instructions[y],v=g.data;switch(g.action){case"moveTo":case"lineTo":a=v[0],l=v[1],v[0]=e*a+n*l+s,v[1]=i*a+r*l+o;break;case"bezierCurveTo":h=v[0],c=v[1],d=v[2],p=v[3],a=v[4],l=v[5],v[0]=e*h+n*c+s,v[1]=i*h+r*c+o,v[2]=e*d+n*p+s,v[3]=i*d+r*p+o,v[4]=e*a+n*l+s,v[5]=i*a+r*l+o;break;case"quadraticCurveTo":h=v[0],c=v[1],a=v[2],l=v[3],v[0]=e*h+n*c+s,v[1]=i*h+r*c+o,v[2]=e*a+n*l+s,v[3]=i*a+r*l+o;break;case"arcToSvg":a=v[5],l=v[6],f=v[0],m=v[1],v[0]=e*f+n*m,v[1]=i*f+r*m,v[5]=e*a+n*l+s,v[6]=i*a+r*l+o;break;case"circle":v[4]=V(v[3],t);break;case"rect":v[4]=V(v[4],t);break;case"ellipse":v[8]=V(v[8],t);break;case"roundRect":v[5]=V(v[5],t);break;case"addPath":v[0].transform(t);break;case"poly":v[2]=V(v[2],t);break;default:(0,u.R)("unknown transform action",g.action)}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;"closePath"===i.action;){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t)}return t}}function V(t,e){return t?t.prepend(e):e.clone()}var X=i(7276);function Y(t,e,i){const n=t.getAttribute(e);return n?Number(n):i}function $(t){const e=Y(t,"x1",0),i=Y(t,"y1",0),n=Y(t,"x2",1),s=Y(t,"y2",0),o=t.getAttribute("gradientUnits")||"objectBoundingBox",a=new X._(e,i,n,s,"objectBoundingBox"===o?"local":"global");for(let e=0;e<t.children.length;e++){const i=t.children[e],n=Y(i,"offset",0),s=r.Q.shared.setValue(i.getAttribute("stop-color")).toNumber();a.addColorStop(n,s)}return a}function q(t){return(0,u.R)("[SVG Parser] Radial gradients are not yet supported"),new X._(0,0,1,0)}function K(t){const e=t.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return e?e[1]:""}const Z={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};function J(t,e){const i=t.getAttribute("style"),n={},r={},s={strokeStyle:n,fillStyle:r,useFill:!1,useStroke:!1};for(const i in Z){const n=t.getAttribute(i);n&&Q(e,s,i,n.trim())}if(i){const t=i.split(";");for(let i=0;i<t.length;i++){const n=t[i].trim(),[r,o]=n.split(":");Z[r]&&Q(e,s,r,o.trim())}}return{strokeStyle:s.useStroke?n:null,fillStyle:s.useFill?r:null,useFill:s.useFill,useStroke:s.useStroke}}function Q(t,e,i,n){switch(i){case"stroke":if("none"!==n){if(n.startsWith("url(")){const i=K(n);e.strokeStyle.fill=t.defs[i]}else e.strokeStyle.color=r.Q.shared.setValue(n).toNumber();e.useStroke=!0}break;case"stroke-width":e.strokeStyle.width=Number(n);break;case"fill":if("none"!==n){if(n.startsWith("url(")){const i=K(n);e.fillStyle.fill=t.defs[i]}else e.fillStyle.color=r.Q.shared.setValue(n).toNumber();e.useFill=!0}break;case"fill-opacity":e.fillStyle.alpha=Number(n);break;case"stroke-opacity":e.strokeStyle.alpha=Number(n);break;case"opacity":e.fillStyle.alpha=Number(n),e.strokeStyle.alpha=Number(n)}}function tt(t){const e=t.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!e||e.length<4)return 0;const i=e.map(Number),n=[],r=[];for(let t=0;t<i.length;t+=2)t+1<i.length&&(n.push(i[t]),r.push(i[t+1]));if(0===n.length||0===r.length)return 0;const s=Math.min(...n),o=Math.max(...n),a=Math.min(...r);return(o-s)*(Math.max(...r)-a)}function et(t,e){const i=new H(t,!1);for(const t of i.instructions)e.instructions.push(t)}function it(t,e){if("string"==typeof t){const e=document.createElement("div");e.innerHTML=t.trim(),t=e.querySelector("svg")}const i={context:e,defs:{},path:new H};!function(t,e){const i=t.querySelectorAll("defs");for(let t=0;t<i.length;t++){const n=i[t];for(let t=0;t<n.children.length;t++){const i=n.children[t];switch(i.nodeName.toLowerCase()){case"lineargradient":e.defs[i.id]=$(i);break;case"radialgradient":e.defs[i.id]=q()}}}}(t,i);const n=t.children,{fillStyle:r,strokeStyle:s}=J(t,i);for(let t=0;t<n.length;t++){const e=n[t];"defs"!==e.nodeName.toLowerCase()&&nt(e,i,r,s)}return e}function nt(t,e,i,n){const r=t.children,{fillStyle:s,strokeStyle:o}=J(t,e);s&&i?i={...i,...s}:s&&(i=s),o&&n?n={...n,...o}:o&&(n=o);const a=!i&&!n;let l,h,c,d,p,f,m,y,g,v,b,x,_,w,S,C,E;switch(a&&(i={color:0}),t.nodeName.toLowerCase()){case"path":{w=t.getAttribute("d");const r=t.getAttribute("fill-rule"),s=w.split(/(?=[Mm])/).filter((t=>t.trim().length>0)),o="evenodd"===r,a=s.length>1;if(o&&a){const t=s.map((t=>({path:t,area:tt(t)})));t.sort(((t,e)=>e.area-t.area));const r=s.length>3||!function(t){if(t.length<=2)return!0;const e=t.map((t=>t.area)).sort(((t,e)=>e-t)),[i,n]=e,r=e[e.length-1];return!(i/n>3&&n/r<2)}(t);if(r)for(let r=0;r<t.length;r++){const s=t[r],o=0===r;e.context.beginPath();const a=new H(void 0,!0);et(s.path,a),e.context.path(a),o?(i&&e.context.fill(i),n&&e.context.stroke(n)):e.context.cut()}else for(let r=0;r<t.length;r++){const s=t[r],o=r%2==1;e.context.beginPath();const a=new H(void 0,!0);et(s.path,a),e.context.path(a),o?e.context.cut():(i&&e.context.fill(i),n&&e.context.stroke(n))}}else{S=new H(w,!r||"evenodd"===r),e.context.path(S),i&&e.context.fill(i),n&&e.context.stroke(n)}break}case"circle":m=Y(t,"cx",0),y=Y(t,"cy",0),g=Y(t,"r",0),e.context.ellipse(m,y,g,g),i&&e.context.fill(i),n&&e.context.stroke(n);break;case"rect":l=Y(t,"x",0),h=Y(t,"y",0),C=Y(t,"width",0),E=Y(t,"height",0),v=Y(t,"rx",0),b=Y(t,"ry",0),v||b?e.context.roundRect(l,h,C,E,v||b):e.context.rect(l,h,C,E),i&&e.context.fill(i),n&&e.context.stroke(n);break;case"ellipse":m=Y(t,"cx",0),y=Y(t,"cy",0),v=Y(t,"rx",0),b=Y(t,"ry",0),e.context.beginPath(),e.context.ellipse(m,y,v,b),i&&e.context.fill(i),n&&e.context.stroke(n);break;case"line":c=Y(t,"x1",0),d=Y(t,"y1",0),p=Y(t,"x2",0),f=Y(t,"y2",0),e.context.beginPath(),e.context.moveTo(c,d),e.context.lineTo(p,f),n&&e.context.stroke(n);break;case"polygon":_=t.getAttribute("points"),x=_.match(/-?\d+/g).map((t=>parseInt(t,10))),e.context.poly(x,!0),i&&e.context.fill(i),n&&e.context.stroke(n);break;case"polyline":_=t.getAttribute("points"),x=_.match(/-?\d+/g).map((t=>parseInt(t,10))),e.context.poly(x,!1),n&&e.context.stroke(n);break;case"g":case"svg":break;default:(0,u.R)(`[SVG parser] <${t.nodeName}> elements unsupported`)}a&&(i=null);for(let t=0;t<r.length;t++)nt(r[t],e,i,n)}var rt=i(990);function st(t,e){let i=1;const n=t.shapePath.shapePrimitives;for(let t=0;t<n.length;t++){const r=n[t].shape;if("polygon"!==r.type)continue;const s=r.points,o=s.length;if(o<6)continue;const a=r.closePath;for(let t=0;t<o;t+=2){if(!a&&(0===t||t===o-2))continue;const n=(t-2+o)%o,r=(t+2)%o,l=s[n],h=s[n+1],c=s[t],u=s[t+1],d=l-c,p=h-u,f=s[r]-c,m=s[r+1]-u,y=d*d+p*p,g=f*f+m*m;if(y<1e-12||g<1e-12)continue;let v=(d*f+p*m)/Math.sqrt(y*g);v<-1?v=-1:v>1&&(v=1);const b=Math.sqrt(.5*(1-v));if(b<1e-6)continue;const x=Math.min(1/b,e);x>i&&(i=x)}}return i}const ot=new o.b,at=new s.u,lt=class t extends n.A{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=(0,l.L)("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new H,this._transform=new s.u,this._fillStyle={...t.defaultFillStyle},this._strokeStyle={...t.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new c.c,this._boundsDirty=!0}clone(){const e=new t;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle={...this._fillStyle},e._strokeStyle={...this._strokeStyle},e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=(0,rt.w)(e,t.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=(0,rt.T)(e,t.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=(0,rt.w)(e,t.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=(0,rt.w)(e,t.defaultStrokeStyle),this}texture(t,e,i,n,s,o){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:n||0,dw:s||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e||0===e?r.Q.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new H,this}fill(e,i){let n;const r=this.instructions[this.instructions.length-1];return n=0===this._tick&&"stroke"===r?.action?r.data.path:this._activePath.clone(),n?(null!=e&&(void 0!==i&&"number"==typeof e&&((0,h.t6)(h.lj,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),e={color:e,alpha:i}),this._fillStyle=(0,rt.w)(e,t.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:n}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(o.b.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(e){let i;const n=this.instructions[this.instructions.length-1];return i=0===this._tick&&"fill"===n?.action?n.data.path:this._activePath.clone(),i?(null!=e&&(this._strokeStyle=(0,rt.T)(e,t.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){const e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&("stroke"===e.action||"fill"===e.action)){if(!e.data.hole){e.data.hole=i;break}e.data.hole.addPath(i)}}return this._initNextPathLocation(),this}arc(t,e,i,n,r,s){this._tick++;const o=this._transform;return this._activePath.arc(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,i,n,r,s),this}arcTo(t,e,i,n,r){this._tick++;const s=this._transform;return this._activePath.arcTo(s.a*t+s.c*e+s.tx,s.b*t+s.d*e+s.ty,s.a*i+s.c*n+s.tx,s.b*i+s.d*n+s.ty,r),this}arcToSvg(t,e,i,n,r,s,o){this._tick++;const a=this._transform;return this._activePath.arcToSvg(t,e,i,n,r,a.a*s+a.c*o+a.tx,a.b*s+a.d*o+a.ty),this}bezierCurveTo(t,e,i,n,r,s,o){this._tick++;const a=this._transform;return this._activePath.bezierCurveTo(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,a.a*i+a.c*n+a.tx,a.b*i+a.d*n+a.ty,a.a*r+a.c*s+a.tx,a.b*r+a.d*s+a.ty,o),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,i,n){return this._tick++,this._activePath.ellipse(t,e,i,n,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;const i=this._transform,n=this._activePath.instructions,r=i.a*t+i.c*e+i.tx,s=i.b*t+i.d*e+i.ty;return 1===n.length&&"moveTo"===n[0].action?(n[0].data[0]=r,n[0].data[1]=s,this):(this._activePath.moveTo(r,s),this)}quadraticCurveTo(t,e,i,n,r){this._tick++;const s=this._transform;return this._activePath.quadraticCurveTo(s.a*t+s.c*e+s.tx,s.b*t+s.d*e+s.ty,s.a*i+s.c*n+s.tx,s.b*i+s.d*n+s.ty,r),this}rect(t,e,i,n){return this._tick++,this._activePath.rect(t,e,i,n,this._transform.clone()),this}roundRect(t,e,i,n,r){return this._tick++,this._activePath.roundRect(t,e,i,n,r,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,n,r=0,s){return this._tick++,this._activePath.regularPoly(t,e,i,n,r,s),this}roundPoly(t,e,i,n,r,s){return this._tick++,this._activePath.roundPoly(t,e,i,n,r,s),this}roundShape(t,e,i,n){return this._tick++,this._activePath.roundShape(t,e,i,n),this}filletRect(t,e,i,n,r){return this._tick++,this._activePath.filletRect(t,e,i,n,r),this}chamferRect(t,e,i,n,r,s){return this._tick++,this._activePath.chamferRect(t,e,i,n,r,s),this}star(t,e,i,n,r=0,s=0){return this._tick++,this._activePath.star(t,e,i,n,r,s,this._transform.clone()),this}svg(t){return this._tick++,it(t,this),this}restore(){const t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,i,n,r,o){return t instanceof s.u?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,n,r,o),this)}transform(t,e,i,n,r,o){return t instanceof s.u?(this._transform.append(t),this):(at.set(t,e,i,n,r,o),this._transform.append(at),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this._boundsDirty=!0,this.dirty=!0,this.emit("update",this,16)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const i=this.instructions[e],n=i.action;if("fill"===n){const e=i.data;t.addBounds(e.path.bounds)}else if("texture"===n){const e=i.data;t.addFrame(e.dx,e.dy,e.dx+e.dw,e.dy+e.dh,e.transform)}if("stroke"===n){const e=i.data,n=e.style.alignment;let r=e.style.width*(1-n);"miter"===e.style.join&&(r*=st(e.path,e.style.miterLimit));const s=e.path.bounds;t.addFrame(s.minX-r,s.minY-r,s.maxX+r,s.maxY+r)}}return t.isValid||t.set(0,0,0,0),t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;const e=this.instructions;let i=!1;for(let n=0;n<e.length;n++){const r=e[n],s=r.data,o=s.path;if(!r.action||!o)continue;const a=s.style,l=o.shapePath.shapePrimitives;for(let e=0;e<l.length;e++){const n=l[e].shape;if(!a||!n)continue;const o=l[e].transform,h=o?o.applyInverse(t,ot):t;if("fill"===r.action)i=n.contains(h.x,h.y);else{const t=a;i=n.strokeContains(h.x,h.y,t.width,t.alignment)}const c=s.hole;if(c){const t=c.shapePath?.shapePrimitives;if(t)for(let e=0;e<t.length;e++)t[e].shape.contains(h.x,h.y)&&(i=!1)}if(i)return!0}}return i}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),this.emit("destroy",this),this.removeAllListeners();if("boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(e)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(e))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};lt.defaultFillStyle={color:16777215,alpha:1,texture:a.g.WHITE,matrix:null,fill:null,textureSpace:"local"},lt.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:a.g.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let ht=lt},378:(t,e,i)=>{i.d(e,{GH:()=>f});var n=i(8507),r=i(341),s=i(2043),o=i(848),a=i(4334),l=i(4670),h=i(8655),c=i(2801);class u{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach((t=>{h.Z.return(t)})),this.graphicsData&&h.Z.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}}class d{constructor(){this.instructions=new o.L}init(t){const e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new s.J({maxTextures:e}),this.instructions.reset()}get geometry(){return(0,l.t6)(l.Ek,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}}const p=class t{constructor(t){this._renderer=t,this._managedContexts=new a.s({renderer:t,type:"resource",name:"graphicsContext"})}init(e){t.defaultOptions.bezierSmoothness=e?.bezierSmoothness??t.defaultOptions.bezierSmoothness}getContextRenderData(t){return t._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=!!t._gpuData[this._renderer.uid],i=t._gpuData[this._renderer.uid]||this._initContext(t);if(t.dirty||!e){e&&i.reset(),(0,c.M)(t,i);const n=t.batchMode;t.customShader||"no-batch"===n?i.isBatchable=!1:i.isBatchable="auto"!==n||i.geometryData.vertices.length<400,t.dirty=!1}return i}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=h.Z.get(d,{maxTextures:this._renderer.limits.maxBatchableTextures}),i=t._gpuData[this._renderer.uid],{batches:n,geometryData:s}=i;i.graphicsData=e;const o=s.vertices.length,a=s.indices.length;for(let t=0;t<n.length;t++)n[t].applyTransform=!1;const l=e.batcher;l.ensureAttributeBuffer(o),l.ensureIndexBuffer(a),l.begin();for(let t=0;t<n.length;t++){const e=n[t];l.add(e)}l.finish(e.instructions);const c=l.geometry;c.indexBuffer.setDataWithSize(l.indexBuffer,l.indexSize,!0),c.buffers[0].setDataWithSize(l.attributeBuffer.float32View,l.attributeSize,!0);const u=l.batches;for(let t=0;t<u.length;t++){const e=u[t];e.bindGroup=(0,r.w)(e.textures.textures,e.textures.count,this._renderer.limits.maxBatchableTextures)}return e}_initContext(t){const e=new u;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};p.extension={type:[n.Ag.WebGLSystem,n.Ag.WebGPUSystem],name:"graphicsContext"},p.defaultOptions={bezierSmoothness:.5};let f=p},115:(t,e,i)=>{i.d(e,{h:()=>a});var n=i(5101),r=i(4928);function s(t,e,i,n,r,s,o,a){let l,h;o?(l=n,h=-i):(l=-n,h=i);const c=t-i*r+l,u=e-n*r+h,d=t+i*s+l,p=e+n*s+h;return a.push(c,u),a.push(d,p),2}function o(t,e,i,n,r,s,o,a){const l=i-t,h=n-e;let c=Math.atan2(l,h),u=Math.atan2(r-t,s-e);a&&c<u?c+=2*Math.PI:!a&&c>u&&(u+=2*Math.PI);let d=c;const p=u-c,f=Math.abs(p),m=Math.sqrt(l*l+h*h),y=1+(15*f*Math.sqrt(m)/Math.PI|0),g=p/y;if(d+=g,a){o.push(t,e),o.push(i,n);for(let i=1,n=d;i<y;i++,n+=g)o.push(t,e),o.push(t+Math.sin(n)*m,e+Math.cos(n)*m);o.push(t,e),o.push(r,s)}else{o.push(i,n),o.push(t,e);for(let i=1,n=d;i<y;i++,n+=g)o.push(t+Math.sin(n)*m,e+Math.cos(n)*m),o.push(t,e);o.push(r,s),o.push(t,e)}return 2*y}function a(t,e,i,a,l,h){const c=r.B;if(0===t.length)return;const u=e;let d=u.alignment;if(.5!==e.alignment){let e=function(t){const e=t.length;if(e<6)return 1;let i=0;for(let n=0,r=t[e-2],s=t[e-1];n<e;n+=2){const e=t[n],o=t[n+1];i+=(e-r)*(o+s),r=e,s=o}return i<0?-1:1}(t);i&&(e*=-1),d=(d-.5)*e+.5}const p=new n.b(t[0],t[1]),f=new n.b(t[t.length-2],t[t.length-1]),m=a,y=Math.abs(p.x-f.x)<c&&Math.abs(p.y-f.y)<c;if(m){t=t.slice(),y&&(t.pop(),t.pop(),f.set(t[t.length-2],t[t.length-1]));const e=.5*(p.x+f.x),i=.5*(f.y+p.y);t.unshift(e,i),t.push(e,i)}const g=l,v=t.length/2;let b=t.length;const x=g.length/2,_=u.width/2,w=_*_,S=u.miterLimit*u.miterLimit;let C=t[0],E=t[1],k=t[2],A=t[3],T=0,M=0,P=-(E-A),O=C-k,I=0,L=0,R=Math.sqrt(P*P+O*O);P/=R,O/=R,P*=_,O*=_;const j=2*(1-d),D=2*d;m||("round"===u.cap?b+=o(C-P*(j-D)*.5,E-O*(j-D)*.5,C-P*j,E-O*j,C+P*D,E+O*D,g,!0)+2:"square"===u.cap&&(b+=s(C,E,P,O,j,D,!0,g))),g.push(C-P*j,E-O*j),g.push(C+P*D,E+O*D);for(let e=1;e<v-1;++e){C=t[2*(e-1)],E=t[2*(e-1)+1],k=t[2*e],A=t[2*e+1],T=t[2*(e+1)],M=t[2*(e+1)+1],P=-(E-A),O=C-k,R=Math.sqrt(P*P+O*O),P/=R,O/=R,P*=_,O*=_,I=-(A-M),L=k-T,R=Math.sqrt(I*I+L*L),I/=R,L/=R,I*=_,L*=_;const i=k-C,n=E-A,r=k-T,s=M-A,a=i*r+n*s,l=n*r-s*i,h=l<0;if(Math.abs(l)<.001*Math.abs(a)){g.push(k-P*j,A-O*j),g.push(k+P*D,A+O*D),a>=0&&("round"===u.join?b+=o(k,A,k-P*j,A-O*j,k-I*j,A-L*j,g,!1)+4:b+=2,g.push(k-I*D,A-L*D),g.push(k+I*j,A+L*j));continue}const c=(-P+C)*(-O+A)-(-P+k)*(-O+E),d=(-I+T)*(-L+A)-(-I+k)*(-L+M),p=(i*d-r*c)/l,f=(s*c-n*d)/l,m=(p-k)*(p-k)+(f-A)*(f-A),y=k+(p-k)*j,v=A+(f-A)*j,x=k-(p-k)*D,N=A-(f-A)*D,F=h?j:D;m<=Math.min(i*i+n*n,r*r+s*s)+F*F*w?"bevel"===u.join||m/w>S?(h?(g.push(y,v),g.push(k+P*D,A+O*D),g.push(y,v),g.push(k+I*D,A+L*D)):(g.push(k-P*j,A-O*j),g.push(x,N),g.push(k-I*j,A-L*j),g.push(x,N)),b+=2):"round"===u.join?h?(g.push(y,v),g.push(k+P*D,A+O*D),b+=o(k,A,k+P*D,A+O*D,k+I*D,A+L*D,g,!0)+4,g.push(y,v),g.push(k+I*D,A+L*D)):(g.push(k-P*j,A-O*j),g.push(x,N),b+=o(k,A,k-P*j,A-O*j,k-I*j,A-L*j,g,!1)+4,g.push(k-I*j,A-L*j),g.push(x,N)):(g.push(y,v),g.push(x,N)):(g.push(k-P*j,A-O*j),g.push(k+P*D,A+O*D),"round"===u.join?b+=h?o(k,A,k+P*D,A+O*D,k+I*D,A+L*D,g,!0)+2:o(k,A,k-P*j,A-O*j,k-I*j,A-L*j,g,!1)+2:"miter"===u.join&&m/w<=S&&(h?(g.push(x,N),g.push(x,N)):(g.push(y,v),g.push(y,v)),b+=2),g.push(k-I*j,A-L*j),g.push(k+I*D,A+L*D),b+=2)}C=t[2*(v-2)],E=t[2*(v-2)+1],k=t[2*(v-1)],A=t[2*(v-1)+1],P=-(E-A),O=C-k,R=Math.sqrt(P*P+O*O),P/=R,O/=R,P*=_,O*=_,g.push(k-P*j,A-O*j),g.push(k+P*D,A+O*D),m||("round"===u.cap?b+=o(k-P*(j-D)*.5,A-O*(j-D)*.5,k-P*j,A-O*j,k+P*D,A+O*D,g,!1)+2:"square"===u.cap&&(b+=s(k,A,P,O,j,D,!1,g)));const N=r.I*r.I;for(let t=x;t<b+x-2;++t)C=g[2*t],E=g[2*t+1],k=g[2*(t+1)],A=g[2*(t+1)+1],T=g[2*(t+2)],M=g[2*(t+2)+1],Math.abs(C*(A-M)+k*(M-E)+T*(E-A))<N||h.push(t,t+1,t+2)}},4928:(t,e,i)=>{i.d(e,{B:()=>n,I:()=>r});const n=1e-4,r=1e-4},7276:(t,e,i)=>{i.d(e,{_:()=>p});var n=i(2577),r=i(1761),s=i(9313),o=i(8293),a=i(5589),l=i(133),h=i(4670),c=i(2698);const u=[{offset:0,color:"white"},{offset:1,color:"black"}],d=class t{constructor(...e){this.uid=(0,l.L)("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let i=function(t){let e=t[0]??{};("number"==typeof e||t[1])&&((0,h.t6)("8.5.2","use options object instead"),e={type:"linear",start:{x:t[0],y:t[1]},end:{x:t[2],y:t[3]},textureSpace:t[4],textureSize:t[5]??p.defaultLinearOptions.textureSize});return e}(e);i={..."radial"===i.type?t.defaultRadialOptions:t.defaultLinearOptions,...(0,c.S)(i)},this._textureSize=i.textureSize,this._wrapMode=i.wrapMode,"radial"===i.type?(this.center=i.center,this.outerCenter=i.outerCenter??this.center,this.innerRadius=i.innerRadius,this.outerRadius=i.outerRadius,this.scale=i.scale,this.rotation=i.rotation):(this.start=i.start,this.end=i.end),this.textureSpace=i.textureSpace,this.type=i.type,i.colorStops.forEach((t=>{this.addColorStop(t.offset,t.color)}))}addColorStop(t,e){return this.colorStops.push({offset:t,color:n.Q.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:n}=this.end,r=i-t,l=n-e;const h=r<0||l<0;if("clamp-to-edge"===this._wrapMode){if(r<0){const e=t;t=i,i=e,r*=-1}if(l<0){const t=e;e=n,n=t,l*=-1}}const c=this.colorStops.length?this.colorStops:u,d=this._textureSize,{canvas:p,context:y}=m(d,1),g=h?y.createLinearGradient(this._textureSize,0,0,0):y.createLinearGradient(0,0,this._textureSize,0);f(g,c),y.fillStyle=g,y.fillRect(0,0,d,1),this.texture=new a.g({source:new o.b({resource:p,addressMode:this._wrapMode})});const v=Math.sqrt(r*r+l*l),b=Math.atan2(l,r),x=new s.u;x.scale(v/d,1),x.rotate(b),x.translate(t,e),"local"===this.textureSpace&&x.scale(d,d),this.transform=x}buildGradient(){this.texture||this._tick++,"linear"===this.type?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const t=this.colorStops.length?this.colorStops:u,e=this._textureSize,{canvas:i,context:n}=m(e,e),{x:r,y:l}=this.center,{x:h,y:c}=this.outerCenter,d=this.innerRadius,p=this.outerRadius,y=h-p,g=c-p,v=e/(2*p),b=(r-y)*v,x=(l-g)*v,_=n.createRadialGradient(b,x,d*v,(h-y)*v,(c-g)*v,p*v);f(_,t),n.fillStyle=t[t.length-1].color,n.fillRect(0,0,e,e),n.fillStyle=_,n.translate(b,x),n.rotate(this.rotation),n.scale(1,this.scale),n.translate(-b,-x),n.fillRect(0,0,e,e),this.texture=new a.g({source:new o.b({resource:i,addressMode:this._wrapMode})});const w=new s.u;w.scale(1/v,1/v),w.translate(y,g),"local"===this.textureSpace&&w.scale(e,e),this.transform=w}destroy(){this.texture?.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};d.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"},d.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let p=d;function f(t,e){for(let i=0;i<e.length;i++){const n=e[i];t.addColorStop(n.offset,n.color)}}function m(t,e){const i=r.e.get().createCanvas(t,e),n=i.getContext("2d");return{canvas:i,context:n}}},2806:(t,e,i)=>{i.d(e,{m:()=>o});var n=i(9313),r=i(133);const s={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class o{constructor(t,e){this.uid=(0,r.L)("fillPattern"),this._tick=0,this.transform=new n.u,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=s[e].addressModeU,t.source.style.addressModeV=s[e].addressModeV)}setTransform(t){const e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._tick++}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture=t,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}},2801:(t,e,i)=>{i.d(e,{M:()=>J,y:()=>q});var n=i(8507),r=i(9313),s=i(9252);function o(t,e,i,n,r){const s=e.a,o=e.b,a=e.c,l=e.d,h=e.tx,c=e.ty;i||(i=0),n||(n=2),r||(r=t.length/n-i);let u=i*n;for(let e=0;e<r;e++){const e=t[u],i=t[u+1];t[u]=s*e+a*i+h,t[u+1]=o*e+l*i+c,u+=n}}var a=i(5589),l=i(8655),h=i(6954);const c={extension:{type:n.Ag.ShapeBuilder,name:"circle"},build(t,e){let i,n,r,s,o,a;if("circle"===t.type){const e=t;if(o=a=e.radius,o<=0)return!1;i=e.x,n=e.y,r=s=0}else if("ellipse"===t.type){const e=t;if(o=e.halfWidth,a=e.halfHeight,o<=0||a<=0)return!1;i=e.x,n=e.y,r=s=0}else{const e=t,l=e.width/2,h=e.height/2;i=e.x+l,n=e.y+h,o=a=Math.max(0,Math.min(e.radius,Math.min(l,h))),r=l-o,s=h-a}if(r<0||s<0)return!1;const l=Math.ceil(2.3*Math.sqrt(o+a)),h=8*l+(r?4:0)+(s?4:0);if(0===h)return!1;if(0===l)return e[0]=e[6]=i+r,e[1]=e[3]=n+s,e[2]=e[4]=i-r,e[5]=e[7]=n-s,!0;let c=0,u=4*l+(r?2:0)+2,d=u,p=h,f=r+o,m=s,y=i+f,g=i-f,v=n+m;if(e[c++]=y,e[c++]=v,e[--u]=v,e[--u]=g,s){const t=n-m;e[d++]=g,e[d++]=t,e[--p]=t,e[--p]=y}for(let t=1;t<l;t++){const h=Math.PI/2*(t/l),f=r+Math.cos(h)*o,m=s+Math.sin(h)*a,y=i+f,g=i-f,v=n+m,b=n-m;e[c++]=y,e[c++]=v,e[--u]=v,e[--u]=g,e[d++]=g,e[d++]=b,e[--p]=b,e[--p]=y}f=r,m=s+a,y=i+f,g=i-f,v=n+m;const b=n-m;return e[c++]=y,e[c++]=v,e[--p]=b,e[--p]=y,r&&(e[c++]=g,e[c++]=v,e[--p]=b,e[--p]=g),!0},triangulate(t,e,i,n,r,s){if(0===t.length)return;let o=0,a=0;for(let e=0;e<t.length;e+=2)o+=t[e],a+=t[e+1];o/=t.length/2,a/=t.length/2;let l=n;e[l*i]=o,e[l*i+1]=a;const h=l++;for(let n=0;n<t.length;n+=2)e[l*i]=t[n],e[l*i+1]=t[n+1],n>0&&(r[s++]=l,r[s++]=h,r[s++]=l-1),l++;r[s++]=h+1,r[s++]=h,r[s++]=l-1}},u={...c,extension:{...c.extension,name:"ellipse"}},d={...c,extension:{...c.extension,name:"roundedRectangle"}};var p=i(115),f=i(4928);function m(t,e,i=2){const n=e&&e.length,r=n?e[0]*i:t.length;let s=y(t,0,r,i,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,h;if(n&&(s=function(t,e,i,n){const r=[];for(let i=0,s=e.length;i<s;i++){const o=y(t,e[i]*n,i<s-1?e[i+1]*n:t.length,n,!1);o===o.next&&(o.steiner=!0),r.push(A(o))}r.sort(S);for(let t=0;t<r.length;t++)i=C(r[t],i);return i}(t,e,s,i)),t.length>80*i){a=t[0],l=t[1];let e=a,n=l;for(let s=i;s<r;s+=i){const i=t[s],r=t[s+1];i<a&&(a=i),r<l&&(l=r),i>e&&(e=i),r>n&&(n=r)}h=Math.max(e-a,n-l),h=0!==h?32767/h:0}return v(s,o,i,a,l,h,0),o}function y(t,e,i,n,r){let s;if(r===z(t,e,i,n)>0)for(let r=e;r<i;r+=n)s=F(r/n|0,t[r],t[r+1],s);else for(let r=i-n;r>=e;r-=n)s=F(r/n|0,t[r],t[r+1],s);return s&&I(s,s.next)&&(B(s),s=s.next),s}function g(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!I(n,n.next)&&0!==O(n.prev,n,n.next))n=n.next;else{if(B(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function v(t,e,i,n,r,s,o){if(!t)return;!o&&s&&function(t,e,i,n){let r=t;do{0===r.z&&(r.z=k(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i=1;do{let n,r=t;t=null;let s=null;for(e=0;r;){e++;let o=r,a=0;for(let t=0;t<i&&(a++,o=o.nextZ,o);t++);let l=i;for(;a>0||l>0&&o;)0!==a&&(0===l||!o||r.z<=o.z)?(n=r,r=r.nextZ,a--):(n=o,o=o.nextZ,l--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;r=o}s.nextZ=null,i*=2}while(e>1)}(r)}(t,n,r,s);let a=t;for(;t.prev!==t.next;){const l=t.prev,h=t.next;if(s?x(t,n,r,s):b(t))e.push(l.i,t.i,h.i),B(t),t=h.next,a=h.next;else if((t=h)===a){o?1===o?v(t=_(g(t),e),e,i,n,r,s,2):2===o&&w(t,e,i,n,r,s):v(g(t),e,i,n,r,s,1);break}}}function b(t){const e=t.prev,i=t,n=t.next;if(O(e,i,n)>=0)return!1;const r=e.x,s=i.x,o=n.x,a=e.y,l=i.y,h=n.y,c=Math.min(r,s,o),u=Math.min(a,l,h),d=Math.max(r,s,o),p=Math.max(a,l,h);let f=n.next;for(;f!==e;){if(f.x>=c&&f.x<=d&&f.y>=u&&f.y<=p&&M(r,a,s,l,o,h,f.x,f.y)&&O(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function x(t,e,i,n){const r=t.prev,s=t,o=t.next;if(O(r,s,o)>=0)return!1;const a=r.x,l=s.x,h=o.x,c=r.y,u=s.y,d=o.y,p=Math.min(a,l,h),f=Math.min(c,u,d),m=Math.max(a,l,h),y=Math.max(c,u,d),g=k(p,f,e,i,n),v=k(m,y,e,i,n);let b=t.prevZ,x=t.nextZ;for(;b&&b.z>=g&&x&&x.z<=v;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=y&&b!==r&&b!==o&&M(a,c,l,u,h,d,b.x,b.y)&&O(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,x.x>=p&&x.x<=m&&x.y>=f&&x.y<=y&&x!==r&&x!==o&&M(a,c,l,u,h,d,x.x,x.y)&&O(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;b&&b.z>=g;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=y&&b!==r&&b!==o&&M(a,c,l,u,h,d,b.x,b.y)&&O(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;x&&x.z<=v;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=y&&x!==r&&x!==o&&M(a,c,l,u,h,d,x.x,x.y)&&O(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function _(t,e){let i=t;do{const n=i.prev,r=i.next.next;!I(n,r)&&L(n,i,i.next,r)&&D(n,r)&&D(r,n)&&(e.push(n.i,i.i,r.i),B(i),B(i.next),i=t=r),i=i.next}while(i!==t);return g(i)}function w(t,e,i,n,r,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&P(o,t)){let a=N(o,t);return o=g(o,o.next),a=g(a,a.next),v(o,e,i,n,r,s,0),void v(a,e,i,n,r,s,0)}t=t.next}o=o.next}while(o!==t)}function S(t,e){let i=t.x-e.x;if(0===i&&(i=t.y-e.y,0===i)){i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return i}function C(t,e){const i=function(t,e){let i=e;const n=t.x,r=t.y;let s,o=-1/0;if(I(t,i))return i;do{if(I(t,i.next))return i.next;if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>o&&(o=t,s=i.x<i.next.x?i:i.next,t===n))return s}i=i.next}while(i!==e);if(!s)return null;const a=s,l=s.x,h=s.y;let c=1/0;i=s;do{if(n>=i.x&&i.x>=l&&n!==i.x&&T(r<h?n:o,r,l,h,r<h?o:n,r,i.x,i.y)){const e=Math.abs(r-i.y)/(n-i.x);D(i,t)&&(e<c||e===c&&(i.x>s.x||i.x===s.x&&E(s,i)))&&(s=i,c=e)}i=i.next}while(i!==a);return s}(t,e);if(!i)return e;const n=N(i,t);return g(n,n.next),g(i,i.next)}function E(t,e){return O(t.prev,t,e.prev)<0&&O(e.next,t,t.next)<0}function k(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function A(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function T(t,e,i,n,r,s,o,a){return(r-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(n-a)>=(i-o)*(e-a)&&(i-o)*(s-a)>=(r-o)*(n-a)}function M(t,e,i,n,r,s,o,a){return!(t===o&&e===a)&&T(t,e,i,n,r,s,o,a)}function P(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&L(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(D(t,e)&&D(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(O(t.prev,t,e.prev)||O(t,e.prev,e))||I(t,e)&&O(t.prev,t,t.next)>0&&O(e.prev,e,e.next)>0)}function O(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function I(t,e){return t.x===e.x&&t.y===e.y}function L(t,e,i,n){const r=j(O(t,e,i)),s=j(O(t,e,n)),o=j(O(i,n,t)),a=j(O(i,n,e));return r!==s&&o!==a||(!(0!==r||!R(t,i,e))||(!(0!==s||!R(t,n,e))||(!(0!==o||!R(i,t,n))||!(0!==a||!R(i,e,n)))))}function R(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function j(t){return t>0?1:t<0?-1:0}function D(t,e){return O(t.prev,t,t.next)<0?O(t,e,t.next)>=0&&O(t,t.prev,e)>=0:O(t,e,t.prev)<0||O(t,t.next,e)<0}function N(t,e){const i=G(t.i,t.x,t.y),n=G(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function F(t,e,i,n){const r=G(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function B(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function G(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function z(t,e,i,n){let r=0;for(let s=e,o=i-n;s<i;s+=n)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}i(8875);const U=m.default||m;function W(t,e,i,n,r,s,o){const a=U(t,e,2);if(!a)return;for(let t=0;t<a.length;t+=3)s[o++]=a[t]+r,s[o++]=a[t+1]+r,s[o++]=a[t+2]+r;let l=r*n;for(let e=0;e<t.length;e+=2)i[l]=t[e],i[l+1]=t[e+1],l+=n}const H=[],V={extension:{type:n.Ag.ShapeBuilder,name:"polygon"},build(t,e){for(let i=0;i<t.points.length;i++)e[i]=t.points[i];return!0},triangulate(t,e,i,n,r,s){W(t,H,e,i,n,r,s)}},X={extension:{type:n.Ag.ShapeBuilder,name:"rectangle"},build(t,e){const i=t,n=i.x,r=i.y,s=i.width,o=i.height;return s>0&&o>0&&(e[0]=n,e[1]=r,e[2]=n+s,e[3]=r,e[4]=n+s,e[5]=r+o,e[6]=n,e[7]=r+o,!0)},triangulate(t,e,i,n,r,s){let o=0;e[(n*=i)+o]=t[0],e[n+o+1]=t[1],o+=i,e[n+o]=t[2],e[n+o+1]=t[3],o+=i,e[n+o]=t[6],e[n+o+1]=t[7],o+=i,e[n+o]=t[4],e[n+o+1]=t[5],o+=i;const a=n/i;r[s++]=a,r[s++]=a+1,r[s++]=a+2,r[s++]=a+1,r[s++]=a+3,r[s++]=a+2}},Y={extension:{type:n.Ag.ShapeBuilder,name:"triangle"},build:(t,e)=>(e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,!0),triangulate(t,e,i,n,r,s){let o=0;e[(n*=i)+o]=t[0],e[n+o+1]=t[1],o+=i,e[n+o]=t[2],e[n+o+1]=t[3],o+=i,e[n+o]=t[4],e[n+o+1]=t[5];const a=n/i;r[s++]=a,r[s++]=a+1,r[s++]=a+2}};var $=i(2413);const q={};n.XO.handleByMap(n.Ag.ShapeBuilder,q),n.XO.add(X,V,Y,c,u,d);const K=new s.M,Z=new r.u;function J(t,e){const{geometryData:i,batches:n}=e;n.length=0,i.indices.length=0,i.vertices.length=0,i.uvs.length=0;for(let e=0;e<t.instructions.length;e++){const r=t.instructions[e];if("texture"===r.action)Q(r.data,n,i);else if("fill"===r.action||"stroke"===r.action){const t="stroke"===r.action,e=r.data.path.shapePath,s=r.data.style,o=r.data.hole;t&&o&&tt(o.shapePath,s,!0,n,i),o&&(e.shapePrimitives[e.shapePrimitives.length-1].holes=o.shapePath.shapePrimitives),tt(e,s,t,n,i)}}}function Q(t,e,i){const n=[],r=q.rectangle,s=K;s.x=t.dx,s.y=t.dy,s.width=t.dw,s.height=t.dh;const a=t.transform;if(!r.build(s,n))return;const{vertices:c,uvs:u,indices:d}=i,p=d.length,f=c.length/2;a&&o(n,a),r.triangulate(n,c,2,f,d,p);const m=t.image,y=m.uvs;u.push(y.x0,y.y0,y.x1,y.y1,y.x3,y.y3,y.x2,y.y2);const g=l.Z.get(h.G);g.indexOffset=p,g.indexSize=d.length-p,g.attributeOffset=f,g.attributeSize=c.length/2-f,g.baseColor=t.style,g.alpha=t.alpha,g.texture=m,g.geometryData=i,e.push(g)}function tt(t,e,i,n,r){const{vertices:s,uvs:c,indices:u}=r;t.shapePrimitives.forEach((({shape:t,transform:d,holes:m})=>{const y=[],g=q[t.type];if(!g.build(t,y))return;const v=u.length,b=s.length/2;let x="triangle-list";if(d&&o(y,d),i){const i=t.closePath??!0,n=e;n.pixelLine?(!function(t,e,i,n){const r=f.B;if(0===t.length)return;const s=t[0],o=t[1],a=t[t.length-2],l=t[t.length-1],h=e||Math.abs(s-a)<r&&Math.abs(o-l)<r,c=i,u=t.length/2,d=c.length/2;for(let e=0;e<u;e++)c.push(t[2*e]),c.push(t[2*e+1]);for(let t=0;t<u-1;t++)n.push(d+t,d+t+1);h&&n.push(d+u-1,d)}(y,i,s,u),x="line-list"):(0,p.h)(y,n,!1,i,s,u)}else if(m){const t=[],e=y.slice();(function(t){const e=[];for(let i=0;i<t.length;i++){const n=t[i].shape,r=[];q[n.type].build(n,r)&&e.push(r)}return e})(m).forEach((i=>{t.push(e.length/2),e.push(...i)})),W(e,t,s,2,b,u,v)}else g.triangulate(y,s,2,b,u,v);const _=c.length/2,w=e.texture;if(w!==a.g.WHITE){const i=(0,$.Y)(Z,e,t,d);!function(t,e,i,n,r,s,o,a=null){let l=0;i*=e,r*=s;const h=a.a,c=a.b,u=a.c,d=a.d,p=a.tx,f=a.ty;for(;l<o;){const o=t[i],a=t[i+1];n[r]=h*o+u*a+p,n[r+1]=c*o+d*a+f,r+=s,i+=e,l++}}(s,2,b,c,_,2,s.length/2-b,i)}else!function(t,e,i,n){let r=0;for(e*=i;r<n;)t[e]=0,t[e+1]=0,e+=i,r++}(c,_,2,s.length/2-b);const S=l.Z.get(h.G);S.indexOffset=v,S.indexSize=u.length-v,S.attributeOffset=b,S.attributeSize=s.length/2-b,S.baseColor=e.color,S.alpha=e.alpha,S.texture=w,S.geometryData=r,S.topology=x,n.push(S)}))}},990:(t,e,i)=>{i.d(e,{T:()=>d,w:()=>u});var n=i(2577),r=i(5589),s=i(7276),o=i(2806);function a(t){return t instanceof o.m}function l(t){return t instanceof s._}function h(t,e,i){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,{...i,...t}}function c(t,e,i){return e.buildGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,t.textureSpace=e.textureSpace,{...i,...t}}function u(t,e){if(null==t)return null;const i={},s=t;return function(t){return n.Q.isColorLike(t)}(t)?function(t,e,i){const s=n.Q.shared.setValue(e??0);return t.color=s.toNumber(),t.alpha=1===s.alpha?i.alpha:s.alpha,t.texture=r.g.WHITE,{...i,...t}}(i,t,e):function(t){return t instanceof r.g}(t)?function(t,e,i){return t.texture=e,{...i,...t}}(i,t,e):a(t)?h(i,t,e):l(t)?c(i,t,e):s.fill&&a(s.fill)?h(s,s.fill,e):s.fill&&l(s.fill)?c(s,s.fill,e):function(t,e){const i={...e,...t},r=n.Q.shared.setValue(i.color);return i.alpha*=r.alpha,i.color=r.toNumber(),i}(s,e)}function d(t,e){const{width:i,alignment:n,miterLimit:r,cap:s,join:o,pixelLine:a,...l}=e,h=u(t,l);return h?{width:i,alignment:n,miterLimit:r,cap:s,join:o,pixelLine:a,...h}:null}},2413:(t,e,i)=>{i.d(e,{Y:()=>l});var n=i(9313),r=i(9252),s=i(7276);const o=new n.u,a=new r.M;function l(t,e,i,n){const r=e.matrix?t.copyFrom(e.matrix).invert():t.identity();if("local"===e.textureSpace){const t=i.getBounds(a);e.width&&t.pad(e.width);const{x:n,y:s}=t,o=1/t.width,l=1/t.height,h=-n*o,c=-s*l,u=r.a,d=r.b,p=r.c,f=r.d;r.a*=o,r.b*=o,r.c*=l,r.d*=l,r.tx=h*u+c*p+r.tx,r.ty=h*d+c*f+r.ty}else r.translate(e.texture.frame.x,e.texture.frame.y),r.scale(1/e.texture.source.width,1/e.texture.source.height);const l=e.texture.source.style;return e.fill instanceof s._||"clamp-to-edge"!==l.addressMode||(l.addressMode="repeat",l.update()),n&&r.append(o.copyFrom(n).invert()),r}},8422:(t,e,i)=>{i.d(e,{K:()=>n});class n{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}destroy(){this.reset()}}},6844:(t,e,i)=>{i.d(e,{k:()=>l});var n=i(2812),r=i(5589),s=i(2048),o=i(4670),a=i(4985);class l extends a.l{constructor(t=r.g.EMPTY){t instanceof r.g&&(t={texture:t});const{texture:e=r.g.EMPTY,anchor:i,roundPixels:s,width:o,height:a,...l}=t;super({label:"Sprite",...l}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new n.o({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,void 0!==o&&(this.width=o),void 0!==a&&(this.height=a)}static from(t,e=!1){return t instanceof r.g?new l(t):new l(r.g.from(t,e))}set texture(t){t||(t=r.g.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return(0,s.y)(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return(0,o.t6)("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const t=this._anchor,e=this._texture,i=this._bounds,{width:n,height:r}=e.orig;i.minX=-t._x*n,i.maxX=i.minX+n,i.minY=-t._y*r,i.maxY=i.minY+r}destroy(t=!1){super.destroy(t);if("boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.textureSource;this._texture.destroy(e)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){"object"==typeof t?(e=t.height??t.width,t=t.width):e??(e=t),void 0!==t&&this._setWidth(t,this._texture.orig.width),void 0!==e&&this._setHeight(e,this._texture.orig.height)}}},4985:(t,e,i)=>{i.d(e,{l:()=>s});var n=i(9636),r=i(5559);class s extends r.mc{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new n.c(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=t.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const e=this.bounds,{x:i,y:n}=t;return i>=e.minX&&i<=e.maxX&&n>=e.minY&&n<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(t){this.unload(),super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,i){const{renderPipes:n}=e;n.blendMode.pushBlendMode(this,this.groupBlendMode,t);const r=n[this.renderPipeId];r?.addRenderable&&r.addRenderable(this,t),this.didViewUpdate=!1;const s=this.children,o=s.length;for(let n=0;n<o;n++)s[n].collectRenderables(t,e,i);n.blendMode.popBlendMode(t)}}},6312:(t,e,i)=>{var n=i(8507),r=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(r||{}),s=i(268),o=i(1761);function a(t){if("string"!=typeof t)throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function l(t){return t.split("?")[0].split("#")[0]}const h={toPosix(t){return e="\\",i="/",t.replace(new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),i);var e,i},isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl:t=>/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t),isBlobUrl:t=>t.startsWith("blob:"),hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){a(t),t=this.toPosix(t);const e=/^file:\/\/\//.exec(t);if(e)return e[0];const i=/^[^/:]+:\/{0,2}/.exec(t);return i?i[0]:""},toAbsolute(t,e,i){if(a(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const n=l(this.toPosix(e??o.e.get().getBaseUrl())),r=l(this.toPosix(i??this.rootname(n)));if((t=this.toPosix(t)).startsWith("/"))return h.join(r,t.slice(1));return this.isAbsolute(t)?t:this.join(n,t)},normalize(t){if(a(t),0===t.length)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;let e="";const i=(t=this.toPosix(t)).startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const n=t.endsWith("/");return(t=function(t,e){let i="",n=0,r=-1,s=0,o=-1;for(let a=0;a<=t.length;++a){if(a<t.length)o=t.charCodeAt(a);else{if(47===o)break;o=47}if(47===o){if(r===a-1||1===s);else if(r!==a-1&&2===s){if(i.length<2||2!==n||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){const t=i.lastIndexOf("/");if(t!==i.length-1){-1===t?(i="",n=0):(i=i.slice(0,t),n=i.length-1-i.lastIndexOf("/")),r=a,s=0;continue}}else if(2===i.length||1===i.length){i="",n=0,r=a,s=0;continue}e&&(i.length>0?i+="/..":i="..",n=2)}else i.length>0?i+=`/${t.slice(r+1,a)}`:i=t.slice(r+1,a),n=a-r-1;r=a,s=0}else 46===o&&-1!==s?++s:s=-1}return i}(t,!1)).length>0&&n&&(t+="/"),i?`/${t}`:e+t},isAbsolute(t){return a(t),t=this.toPosix(t),!!this.hasProtocol(t)||t.startsWith("/")},join(...t){if(0===t.length)return".";let e;for(let i=0;i<t.length;++i){const n=t[i];if(a(n),n.length>0)if(void 0===e)e=n;else{const r=t[i-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?e+=`/../${n}`:e+=`/${n}`}}return void 0===e?".":this.normalize(e)},dirname(t){if(a(t),0===t.length)return".";let e=(t=this.toPosix(t)).charCodeAt(0);const i=47===e;let n=-1,r=!0;const s=this.getProtocol(t),o=t;for(let i=(t=t.slice(s.length)).length-1;i>=1;--i)if(e=t.charCodeAt(i),47===e){if(!r){n=i;break}}else r=!1;return-1===n?i?"/":this.isUrl(o)?s+t:s:i&&1===n?"//":s+t.slice(0,n)},rootname(t){a(t);let e="";if(e=(t=this.toPosix(t)).startsWith("/")?"/":this.getProtocol(t),this.isUrl(t)){const i=t.indexOf("/",e.length);e=-1!==i?t.slice(0,i):t,e.endsWith("/")||(e+="/")}return e},basename(t,e){a(t),e&&a(e),t=l(this.toPosix(t));let i,n=0,r=-1,s=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let o=e.length-1,a=-1;for(i=t.length-1;i>=0;--i){const l=t.charCodeAt(i);if(47===l){if(!s){n=i+1;break}}else-1===a&&(s=!1,a=i+1),o>=0&&(l===e.charCodeAt(o)?-1==--o&&(r=i):(o=-1,r=a))}return n===r?r=a:-1===r&&(r=t.length),t.slice(n,r)}for(i=t.length-1;i>=0;--i)if(47===t.charCodeAt(i)){if(!s){n=i+1;break}}else-1===r&&(s=!1,r=i+1);return-1===r?"":t.slice(n,r)},extname(t){a(t);let e=-1,i=0,n=-1,r=!0,s=0;for(let o=(t=l(this.toPosix(t))).length-1;o>=0;--o){const a=t.charCodeAt(o);if(47!==a)-1===n&&(r=!1,n=o+1),46===a?-1===e?e=o:1!==s&&(s=1):-1!==e&&(s=-1);else if(!r){i=o+1;break}}return-1===e||-1===n||0===s||1===s&&e===n-1&&e===i+1?"":t.slice(e,n)},parse(t){a(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;let i=(t=l(this.toPosix(t))).charCodeAt(0);const n=this.isAbsolute(t);let r;e.root=this.rootname(t),r=n||this.hasProtocol(t)?1:0;let s=-1,o=0,h=-1,c=!0,u=t.length-1,d=0;for(;u>=r;--u)if(i=t.charCodeAt(u),47!==i)-1===h&&(c=!1,h=u+1),46===i?-1===s?s=u:1!==d&&(d=1):-1!==s&&(d=-1);else if(!c){o=u+1;break}return-1===s||-1===h||0===d||1===d&&s===h-1&&s===o+1?-1!==h&&(e.base=e.name=0===o&&n?t.slice(1,h):t.slice(o,h)):(0===o&&n?(e.name=t.slice(1,s),e.base=t.slice(1,h)):(e.name=t.slice(o,s),e.base=t.slice(o,h)),e.ext=t.slice(s,h)),e.dir=this.dirname(t),e},sep:"/",delimiter:":",joinExtensions:[".html"]};var c=i(2406);function u(t,e,i,n,r){const s=e[i];for(let o=0;o<s.length;o++){const a=s[o];i<e.length-1?u(t.replace(n[i],a),e,i+1,n,r):r.push(t.replace(n[i],a))}}function d(t){const e=t.match(/\{(.*?)\}/g),i=[];if(e){const n=[];e.forEach((t=>{const e=t.substring(1,t.length-1).split(",");n.push(e)})),u(t,n,0,e,i)}else i.push(t);return i}const p=t=>!Array.isArray(t);class f{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,"bar"!==this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar")))throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach((t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))})),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if("string"==typeof t)this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}}getAlias(t){const{alias:e,src:i}=t;return(0,c.z)(e||i,(t=>"string"==typeof t?t:Array.isArray(t)?t.map((t=>t?.src??t)):t?.src?t.src:t),!0)}removeAlias(t,e){this._assetMap[t]&&(e&&e!==this._resolverHash[t]||(delete this._resolverHash[t],delete this._assetMap[t]))}addManifest(t){this._manifest&&(0,s.R)("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach((t=>{this.addBundle(t.name,t.assets)}))}addBundle(t,e){const i=[];let n=e;Array.isArray(e)||(n=Object.entries(e).map((([t,e])=>"string"==typeof e||Array.isArray(e)?{alias:t,src:e}:{alias:t,...e}))),n.forEach((e=>{const n=e.src,r=e.alias;let s;if("string"==typeof r){const e=this._createBundleAssetId(t,r);i.push(e),s=[r,e]}else{const e=r.map((e=>this._createBundleAssetId(t,e)));i.push(...e),s=[...r,...e]}this.add({...e,alias:s,src:n})})),this._bundles[t]=i}add(t){const e=[];let i;Array.isArray(t)?e.push(...t):e.push(t),i=t=>{this.hasKey(t)&&(0,s.R)(`[Resolver] already has key: ${t} overwriting`)};(0,c.z)(e).forEach((t=>{const{src:e}=t;let{data:n,format:r,loadParser:s,parser:o}=t;const a=(0,c.z)(e).map((t=>"string"==typeof t?d(t):Array.isArray(t)?t:[t])),l=this.getAlias(t);Array.isArray(l)?l.forEach(i):i(l);const h=[],u=t=>{const e=this._parsers.find((e=>e.test(t)));return{src:t,...e?.parse(t)}};a.forEach((e=>{e.forEach((e=>{let i={};if("object"!=typeof e?i=u(e):(n=e.data??n,r=e.format??r,(e.loadParser||e.parser)&&(s=e.loadParser??s,o=e.parser??o),i={...u(e.src),...e}),!l)throw new Error(`[Resolver] alias is undefined for this asset: ${i.src}`);i=this._buildResolvedAsset(i,{aliases:l,data:n,format:r,loadParser:s,parser:o,progressSize:t.progressSize}),h.push(i)}))})),l.forEach((t=>{this._assetMap[t]=h}))}))}resolveBundle(t){const e=p(t);t=(0,c.z)(t);const i={};return t.forEach((t=>{const e=this._bundles[t];if(e){const n=this.resolve(e),r={};for(const e in n){const i=n[e];r[this._extractAssetIdFromBundle(t,e)]=i}i[t]=r}})),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if("string"!=typeof t){const t={};for(const i in e)t[i]=e[i].src;return t}return e.src}resolve(t){const e=p(t);t=(0,c.z)(t);const i={};return t.forEach((t=>{if(!this._resolverHash[t])if(this._assetMap[t]){let e=this._assetMap[t];const i=this._getPreferredOrder(e);i?.priority.forEach((t=>{i.params[t].forEach((i=>{const n=e.filter((e=>!!e[t]&&e[t]===i));n.length&&(e=n)}))})),this._resolverHash[t]=e[0]}else this._resolverHash[t]=this._buildResolvedAsset({alias:[t],src:t},{});i[t]=this._resolverHash[t]})),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[e],n=this._preferredOrder.find((t=>t.params.format.includes(i.format)));if(n)return n}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;return`${t}${/\?/.test(t)?"&":"?"}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){const{aliases:i,data:n,loadParser:r,parser:s,format:o,progressSize:a}=e;return(this._basePath||this._rootPath)&&(t.src=h.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...n||{},...t.data},t.loadParser=r??t.loadParser,t.parser=s??t.parser,t.format=o??t.format??t.src.split(".").pop().split("?").shift().split("#").shift(),void 0!==a&&(t.progressSize=a),t}}f.RETINA_PREFIX=/@([0-9\.]+)x/;const m=(t,e)=>{const i=e.split("?")[1];return i&&(t+=`?${i}`),t};var y=i(5589),g=i(9252),v=i(583);const b=class t{constructor(t,e){this.linkedSheets=[];let i=t;t?.source instanceof v.v&&(i={texture:t,data:e});const{texture:n,data:r,cachePrefix:s=""}=i;this.cachePrefix=s,this._texture=n instanceof y.g?n:null,this.textureSource=n.source,this.textures={},this.animations={},this.data=r;const o=parseFloat(r.meta.scale);o?(this.resolution=o,n.source.resolution=this.resolution):this.resolution=n.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise((e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=t.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()}))}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(e,i=!1){let n=e;const r=i?1/0:t.BATCH_SIZE;for(;n-e<r&&n<this._frameKeys.length;){const t=this._frameKeys[n],e=this._frames[t],i=e.frame;if(i){let n=null,r=null;const s=!1!==e.trimmed&&e.sourceSize?e.sourceSize:e.frame,o=new g.M(0,0,Math.floor(s.w)/this.resolution,Math.floor(s.h)/this.resolution);n=e.rotated?new g.M(Math.floor(i.x)/this.resolution,Math.floor(i.y)/this.resolution,Math.floor(i.h)/this.resolution,Math.floor(i.w)/this.resolution):new g.M(Math.floor(i.x)/this.resolution,Math.floor(i.y)/this.resolution,Math.floor(i.w)/this.resolution,Math.floor(i.h)/this.resolution),!1!==e.trimmed&&e.spriteSourceSize&&(r=new g.M(Math.floor(e.spriteSourceSize.x)/this.resolution,Math.floor(e.spriteSourceSize.y)/this.resolution,Math.floor(i.w)/this.resolution,Math.floor(i.h)/this.resolution)),this.textures[t]=new y.g({source:this.textureSource,frame:n,orig:o,trim:r,rotate:e.rotated?2:0,defaultAnchor:e.anchor,defaultBorders:e.borders,label:t.toString()})}n++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const n=t[e][i];this.animations[e].push(this.textures[n])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*t.BATCH_SIZE),this._batchIndex++,setTimeout((()=>{this._batchIndex*t.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())}),0)}destroy(t=!1){for(const t in this.textures)this.textures[t].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};b.BATCH_SIZE=1e3;let x=b;const _=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function w(t,e,i){const n={};if(t.forEach((t=>{n[t]=e})),Object.keys(e.textures).forEach((t=>{n[`${e.cachePrefix}${t}`]=e.textures[t]})),!i){const i=h.dirname(t[0]);e.linkedSheets.forEach(((t,r)=>{const s=w([`${i}/${e.data.meta.related_multi_packs[r]}`],t,!0);Object.assign(n,s)}))}return n}const S={extension:n.Ag.Asset,cache:{test:t=>t instanceof x,getCacheableAssets:(t,e)=>w(t,e,!1)},resolver:{extension:{type:n.Ag.ResolveParser,name:"resolveSpritesheet"},test:t=>{const e=t.split("?")[0].split("."),i=e.pop(),n=e.pop();return"json"===i&&_.includes(n)},parse:t=>{const e=t.split(".");return{resolution:parseFloat(f.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:n.Ag.LoadParser,priority:r.Normal,name:"spritesheetLoader"},testParse:async(t,e)=>".json"===h.extname(e.src).toLowerCase()&&!!t.frames,async parse(t,e,i){const{texture:n,imageFilename:r,textureOptions:s,cachePrefix:o}=e?.data??{};let a,l=h.dirname(e.src);if(l&&l.lastIndexOf("/")!==l.length-1&&(l+="/"),n instanceof y.g)a=n;else{const n=m(l+(r??t.meta.image),e.src);a=(await i.load([{src:n,data:s}]))[n]}const c=new x({texture:a.source,data:t,cachePrefix:o});await c.parse();const u=t?.meta?.related_multi_packs;if(Array.isArray(u)){const t=[];for(const n of u){if("string"!=typeof n)continue;let r=l+n;e.data?.ignoreMultiPack||(r=m(r,e.src),t.push(i.load({src:r,data:{textureOptions:s,ignoreMultiPack:!0}})))}const n=await Promise.all(t);c.linkedSheets=n,n.forEach((t=>{t.linkedSheets=[c].concat(c.linkedSheets.filter((e=>e!==t)))}))}return c},async unload(t,e,i){await i.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}};n.XO.add(S)},7309:(t,e,i)=>{i.d(e,{R:()=>o});var n=i(4458);class r{constructor(t,e=null,i=0,n=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=n}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const s=class t{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new r(null,null,1/0),this.deltaMS=1/t.targetFPMS,this.elapsedMS=1/t.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&null===this._requestId&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=n.d.NORMAL){return this._addListener(new r(t,e,i))}addOnce(t,e,i=n.d.NORMAL){return this._addListener(new r(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}else t.connect(i);return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i=i.match(t,e)?i.destroy():i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let i;if(e>this.lastTime){if(i=this.elapsedMS=e-this.lastTime,i>this._maxElapsedMS&&(i=this._maxElapsedMS),i*=this.speed,this._minElapsedMS){const t=e-this._lastFrame|0;if(t<this._minElapsedMS)return;this._lastFrame=e-t%this._minElapsedMS}this.deltaMS=i,this.deltaTime=this.deltaMS*t.targetFPMS;const n=this._head;let r=n.next;for(;r;)r=r.emit(this);n.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const i=Math.min(Math.max(0,e)/1e3,t.targetFPMS);this._maxElapsedMS=1/i,this._minElapsedMS&&e>this.maxFPS&&(this.maxFPS=e)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){0===t?this._minElapsedMS=0:(t<this.minFPS&&(this.minFPS=t),this._minElapsedMS=1/(t/1e3))}static get shared(){if(!t._shared){const e=t._shared=new t;e.autoStart=!0,e._protected=!0}return t._shared}static get system(){if(!t._system){const e=t._system=new t;e.autoStart=!0,e._protected=!0}return t._system}};s.targetFPMS=.06;let o=s},4458:(t,e,i)=>{i.d(e,{d:()=>n});var n=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(n||{})},4577:(t,e,i)=>{let n;function r(){if("boolean"==typeof n)return n;try{const t=new Function("param1","param2","param3","return param1[param2] === param3;");n=!0===t({a:"b"},"a","b")}catch(t){n=!1}return n}i.d(e,{f:()=>r})},2571:(t,e,i)=>{i.d(e,{xv:()=>n});i(8875);const n="8.17.1"},4334:(t,e,i)=>{i.d(e,{s:()=>n});class n{constructor(t){this.items=Object.create(null);const{renderer:e,type:i,onUnload:n,priority:r,name:s}=t;this._renderer=e,e.gc.addResourceHash(this,"items",i,r??0),this._onUnload=n,this.name=s}add(t){return!this.items[t.uid]&&(this.items[t.uid]=t,t.once("unload",this.remove,this),t._gcLastUsed=this._renderer.gc.now,!0)}remove(t,...e){if(!this.items[t.uid])return;const i=t._gpuData[this._renderer.uid];i&&(this._onUnload?.(t,...e),i.destroy(),t._gpuData[this._renderer.uid]=null,this.items[t.uid]=null)}removeAll(...t){Object.values(this.items).forEach((e=>e&&this.remove(e,...t)))}destroy(...t){this.removeAll(...t),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}},9903:(t,e,i)=>{function n(t,e,i){const n=t.length;let r;if(e>=n||0===i)return;const s=n-(i=e+i>n?n-e:i);for(r=e;r<s;++r)t[r]=t[r+i];t.length=s}i.d(e,{d:()=>n})},133:(t,e,i)=>{i.d(e,{L:()=>r});const n={default:-1};function r(t="default"){return void 0===n[t]&&(n[t]=-1),++n[t]}},2048:(t,e,i)=>{function n(t,e,i){const{width:n,height:r}=i.orig,s=i.trim;if(s){const i=s.width,o=s.height;t.minX=s.x-e._x*n,t.maxX=t.minX+i,t.minY=s.y-e._y*r,t.maxY=t.minY+o}else t.minX=-e._x*n,t.maxX=t.minX+n,t.minY=-e._y*r,t.maxY=t.minY+r}i.d(e,{y:()=>n})},7073:(t,e,i)=>{i.d(e,{M:()=>s,d:()=>o});var n=i(8507),r=i(2571);class s{static init(){globalThis.__PIXI_APP_INIT__?.(this,r.xv)}static destroy(){}}s.extension=n.Ag.Application;class o{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,r.xv)}destroy(){this._renderer=null}}o.extension={type:[n.Ag.WebGLSystem,n.Ag.WebGPUSystem],name:"initHook",priority:-10}},4670:(t,e,i)=>{i.d(e,{Ek:()=>s,lj:()=>r,t6:()=>a});const n=new Set,r="8.0.0",s="8.3.4",o={quiet:!1,noColor:!1},a=(t,e,i=3)=>{if(o.quiet||n.has(e))return;let r=(new Error).stack;const s=`${e}\nDeprecated since v${t}`,a="function"==typeof console.groupCollapsed&&!o.noColor;void 0===r?console.warn("PixiJS Deprecation Warning: ",s):(r=r.split("\n").splice(i).join("\n"),a?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",s),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",s),console.warn(r))),n.add(e)};Object.defineProperties(a,{quiet:{get:()=>o.quiet,set:t=>{o.quiet=t},enumerable:!0,configurable:!1},noColor:{get:()=>o.noColor,set:t=>{o.noColor=t},enumerable:!0,configurable:!1}})},268:(t,e,i)=>{i.d(e,{R:()=>s});let n=0;const r=500;function s(...t){n!==r&&(n++,n===r?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}},6083:(t,e,i)=>{i.d(e,{L:()=>n});const n={_registeredResources:new Set,register(t){this._registeredResources.add(t)},unregister(t){this._registeredResources.delete(t)},release(){this._registeredResources.forEach((t=>t.clear()))},get registeredCount(){return this._registeredResources.size},isRegistered(t){return this._registeredResources.has(t)},reset(){this._registeredResources.clear()}}},8655:(t,e,i)=>{i.d(e,{Z:()=>s});var n=i(6083);class r{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:(e=new this._classType,this._count++),e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let t=0;t<this._index;t++)this._pool[t].destroy();this._pool.length=0,this._count=0,this._index=0}}const s=new class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new r(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach((e=>{const i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}})),t}clear(){this._poolsByClass.forEach((t=>t.clear())),this._poolsByClass.clear()}};n.L.register(s)},8875:(t,e,i)=>{i.d(e,{A:()=>n});const n=i(5585)}},n={};function r(t){var e=n[t];if(void 0!==e)return e.exports;var s=n[t]={id:t,exports:{}};return i[t](s,s.exports,r),s.exports}r.m=i,r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.f={},r.e=t=>Promise.all(Object.keys(r.f).reduce(((e,i)=>(r.f[i](t,e),e)),[])),r.u=t=>t+".vizor_2d.min.js",r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t={},e="vizor_2d:",r.l=(i,n,s,o)=>{if(t[i])t[i].push(n);else{var a,l;if(void 0!==s)for(var h=document.getElementsByTagName("script"),c=0;c<h.length;c++){var u=h[c];if(u.getAttribute("src")==i||u.getAttribute("data-webpack")==e+s){a=u;break}}a||(l=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",e+s),a.src=i),t[i]=[n];var d=(e,n)=>{a.onerror=a.onload=null,clearTimeout(p);var r=t[i];if(delete t[i],a.parentNode&&a.parentNode.removeChild(a),r&&r.forEach((t=>t(n))),e)return e(n)},p=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),l&&document.head.appendChild(a)}},r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;if("string"==typeof import.meta.url&&(t=import.meta.url),!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=t})(),(()=>{r.b=document.baseURI||self.location.href;var t={792:0};r.f.j=(e,i)=>{var n=r.o(t,e)?t[e]:void 0;if(0!==n)if(n)i.push(n[2]);else{var s=new Promise(((i,r)=>n=t[e]=[i,r]));i.push(n[2]=s);var o=r.p+r.u(e),a=new Error;r.l(o,(i=>{if(r.o(t,e)&&(0!==(n=t[e])&&(t[e]=void 0),n)){var s=i&&("load"===i.type?"missing":i.type),o=i&&i.target&&i.target.src;a.message="Loading chunk "+e+" failed.\n("+s+": "+o+")",a.name="ChunkLoadError",a.type=s,a.request=o,n[1](a)}}),"chunk-"+e,e)}};var e=(e,i)=>{var n,s,[o,a,l]=i,h=0;if(o.some((e=>0!==t[e]))){for(n in a)r.o(a,n)&&(r.m[n]=a[n]);if(l)l(r)}for(e&&e(i);h<o.length;h++)s=o[h],r.o(t,s)&&t[s]&&t[s][0](),t[s]=0},i=self.webpackChunkvizor_2d=self.webpackChunkvizor_2d||[];i.forEach(e.bind(null,0)),i.push=e.bind(null,i.push.bind(i))})(),r.nc=void 0;var s={};function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,l(n.key),n)}}function l(t){var e=function(t,e){if("object"!=o(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==o(e)?e:e+""}r.d(s,{A5:()=>ea,oY:()=>co,W_:()=>go,vY:()=>mn,jz:()=>Ho,TI:()=>Zo,ey:()=>aa,sV:()=>To});var h=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return e=t,n=[{key:"build",value:function(e){if(!e)return function(){return!0};switch(e.op){case"and":var i=e.rules.map((function(e){return t.build(e)}));return function(t){return i.every((function(e){return e(t)}))};case"or":var n=e.rules.map((function(e){return t.build(e)}));return function(t){return n.some((function(e){return e(t)}))};case"not":var r=t.build(e.rule);return function(t){return!r(t)};case"eq":return function(t){var i;return(null===(i=t.data)||void 0===i?void 0:i[e.field])===e.value};case"neq":return function(t){var i;return(null===(i=t.data)||void 0===i?void 0:i[e.field])!==e.value};case"gt":return function(t){var i;return(null===(i=t.data)||void 0===i?void 0:i[e.field])>e.value};case"lt":return function(t){var i;return(null===(i=t.data)||void 0===i?void 0:i[e.field])<e.value};case"gte":return function(t){var i;return(null===(i=t.data)||void 0===i?void 0:i[e.field])>=e.value};case"lte":return function(t){var i;return(null===(i=t.data)||void 0===i?void 0:i[e.field])<=e.value};case"regex":var s=new RegExp(e.value);return function(t){var i,n=null===(i=t.data)||void 0===i?void 0:i[e.field];return s.test(String(null!=n?n:""))};case"in":return function(t){var i;return e.value.includes(null===(i=t.data)||void 0===i?void 0:i[e.field])};case"exists":return function(t){return e.field in(t.data||{})};default:return console.warn("Unknown rule:",e),function(){return!0}}}}],(i=null)&&a(e.prototype,i),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,i,n}();function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function u(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||p(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=p(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function p(t,e){if(t){if("string"==typeof t)return f(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?f(t,e):void 0}}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function m(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,y(n.key),n)}}function y(t){var e=function(t,e){if("object"!=c(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==c(e)?e:e+""}var g=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.attractionStrength=.15,this.repulsionStrength=200,this.damping=.98,this.minDist=20,this.planetRadius=60,this.planetRepulsion=2,this.orbitStrength=0,this.collisionPadding=2,this.collisionIterations=2,this.velocityEpsilon=.01,this.energyThreshold=.1,this.cooling=.999,this.minStrength=.001},e=[{key:"setModel",value:function(t){this.model=t}},{key:"resolveMoonCollisions",value:function(t){for(var e=0;e<this.collisionIterations;e++)for(var i=0;i<t.length;i++)for(var n=i+1;n<t.length;n++){var r=t[i],s=t[n],o=r.radius||10,a=s.radius||10,l=s.x-r.x,h=s.y-r.y,c=Math.sqrt(l*l+h*h)||1e-4,u=o+a+this.collisionPadding;if(c<u){var d=l/c,p=h/c,f=.5*(u-c);r.fixed||(r.x-=d*f,r.y-=p*f),s.fixed||(s.x+=d*f,s.y+=p*f)}}}},{key:"step",value:function(){var t,e=this,i=this.model.getNodes(),n=i.filter((function(t){return"moon"===t.type})),r=i.filter((function(t){return"planet"===t.type})),s=d(n);try{for(s.s();!(t=s.n()).done;){var o=t.value;o.vx*=this.damping,o.vy*=this.damping}}catch(t){s.e(t)}finally{s.f()}for(var a=0;a<n.length;a++)for(var l=a+1;l<n.length;l++){var h=n[a],c=n[l],p=h.x-c.x,f=h.y-c.y,m=Math.sqrt(p*p+f*f)||.01;m=Math.max(m,this.minDist);var y=this.repulsionStrength/(m*m),g=p/m*y,v=f/m*y;h.fixed||(h.vx+=g,h.vy+=v),c.fixed||(c.vx-=g,c.vy-=v)}var b,x=d(r);try{var _=function(){var t=b.value,i=n.filter((function(e){return t.rule(e)}));if(0===i.length)return 1;if(t.sumField?t.sumTotal=i.reduce((function(e,i){var n,r=Number(null===(n=i.data)||void 0===n?void 0:n[t.sumField]);return e+(isNaN(r)?0:r)}),0):t.sumTotal=null,t.vector){var r,s={x:t.x,y:t.y},o=t.direction,a=t.length,l=t.scalarField,h=i.map((function(t){return t.data[l]})).filter((function(t){return null!=t})),c=Math.min.apply(Math,u(h)),p=Math.max.apply(Math,u(h)),f=d(i);try{for(f.s();!(r=f.n()).done;){var m=r.value,y=m.data[l];null==y&&(y=c);var g=p>c?(y-c)/(p-c):.5;m.x=s.x+o.x*a*g,m.y=s.y+o.y*a*g}}catch(t){f.e(t)}finally{f.f()}}else{var v,x=d(i);try{for(x.s();!(v=x.n()).done;){var _=v.value,w=t.x-_.x,S=t.y-_.y,C=Math.sqrt(w*w+S*S)||.01;C=Math.max(C,e.minDist);var E=100,k=w/C,A=S/C,T=e.attractionStrength*(C-E)*.5+.05*C;_.fixed||(_.vx+=k*T,_.vy+=A*T,_.vx+=.5*k,_.vy+=.5*A);var M=.85+.15*Math.min(1,C/E);_.vx*=M,_.vy*=M,_.vx*k+_.vy*A<0&&(_.vx*=.7,_.vy*=.7),C<3&&(_.x=t.x+k*E,_.y=t.y+A*E,_.vx=0,_.vy=0),C<102&&Math.abs(_.vx)<.05&&Math.abs(_.vy)<.05&&(_.vx=0,_.vy=0),0!==e.orbitStrength&&(_.vx+=-S/C*e.orbitStrength,_.vy+=w/C*e.orbitStrength)}}catch(t){x.e(t)}finally{x.f()}}};for(x.s();!(b=x.n()).done;)_()}catch(t){x.e(t)}finally{x.f()}var w,S=d(r);try{for(S.s();!(w=S.n()).done;){var C,E=w.value,k=d(n);try{for(k.s();!(C=k.n()).done;){var A=C.value,T=A.x-E.x,M=A.y-E.y,P=Math.sqrt(T*T+M*M)||.01;if(P<this.planetRadius){var O=this.planetRadius-P,I=T/P*O*this.planetRepulsion,L=M/P*O*this.planetRepulsion;A.fixed||(A.vx+=I,A.vy+=L)}}}catch(t){k.e(t)}finally{k.f()}}}catch(t){S.e(t)}finally{S.f()}var R,j=this.bounds||{minX:-1/0,maxX:1/0,minY:-1/0,maxY:1/0},D=0,N=d(n);try{for(N.s();!(R=N.n()).done;){var F=R.value;F.fixed||(F.x+=F.vx,F.y+=F.vy,F.x=Math.max(j.minX,Math.min(j.maxX,F.x)),F.y=Math.max(j.minY,Math.min(j.maxY,F.y)),F.vx*=.9,F.vy*=.9,Math.abs(F.vx)<this.velocityEpsilon&&(F.vx=0),Math.abs(F.vy)<this.velocityEpsilon&&(F.vy=0),D+=Math.abs(F.vx)+Math.abs(F.vy))}}catch(t){N.e(t)}finally{N.f()}this.resolveMoonCollisions(n);var B,G=D>=this.energyThreshold,z=d(n);try{for(z.s();!(B=z.n()).done;)B.value.dirty=G}catch(t){z.e(t)}finally{z.f()}if(!G){var U,W=d(n);try{for(W.s();!(U=W.n()).done;){var H=U.value;H.vx=0,H.vy=0}}catch(t){W.e(t)}finally{W.f()}}D<5&&(this.attractionStrength=Math.max(this.minStrength,.95*this.attractionStrength),this.repulsionStrength=Math.max(this.minStrength,.95*this.repulsionStrength))}}],e&&m(t.prototype,e),i&&m(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function b(t){return function(t){if(Array.isArray(t))return w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=_(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function _(t,e){if(t){if("string"==typeof t)return w(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?w(t,e):void 0}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function S(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,C(n.key),n)}}function C(t){var e=function(t,e){if("object"!=v(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=v(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==v(e)?e:e+""}var E=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.attractionStrength=.05,this.repulsionStrength=200,this.damping=.9,this.minDist=20,this.minDistSq=this.minDist*this.minDist,this.planetRadius=60,this.planetRepulsion=2,this.orbitStrength=0,this.cellSize=80,this.maxNeighbors=15},e=[{key:"setModel",value:function(t){this.model=t}},{key:"_buildGrid",value:function(t){var e,i=new Map,n=x(t);try{for(n.s();!(e=n.n()).done;){var r=e.value,s=Math.floor(r.x/this.cellSize),o=Math.floor(r.y/this.cellSize),a=s+","+o;i.has(a)||i.set(a,[]),i.get(a).push(r),r._cellX=s,r._cellY=o}}catch(t){n.e(t)}finally{n.f()}return i}},{key:"_getNeighbors",value:function(t,e){for(var i=[],n=-1;n<=1;n++)for(var r=-1;r<=1;r++){var s=e._cellX+n+","+(e._cellY+r),o=t.get(s);if(o){var a,l=x(o);try{for(l.s();!(a=l.n()).done;){var h=a.value;if(h!==e&&(i.push(h),i.length>=this.maxNeighbors))return i}}catch(t){l.e(t)}finally{l.f()}}}return i}},{key:"step",value:function(){var t=this,e=this.model.getNodes(),i=e.filter((function(t){return"moon"===t.type})),n=e.filter((function(t){return"planet"===t.type})),r=this.bounds;if(r){var s,o=x(i);try{for(o.s();!(s=o.n()).done;){var a=s.value;a.vx*=this.damping,a.vy*=this.damping}}catch(t){o.e(t)}finally{o.f()}var l,h=this._buildGrid(i),c=x(i);try{for(c.s();!(l=c.n()).done;){var u,d=l.value,p=x(this._getNeighbors(h,d));try{for(p.s();!(u=p.n()).done;){var f=u.value,m=d.x-f.x,y=d.y-f.y,g=m*m+y*y;g<this.minDistSq&&(g=this.minDistSq);var v=this.repulsionStrength/g,_=Math.sqrt(g),w=m/_*v,S=y/_*v;d.fixed||(d.vx+=w,d.vy+=S)}}catch(t){p.e(t)}finally{p.f()}}}catch(t){c.e(t)}finally{c.f()}var C,E=x(n);try{var k=function(){var e=C.value,n=i.filter((function(t){return e.rule(t)}));if(0===n.length)return 1;if(e.vector){var r,s={x:e.x,y:e.y},o=e.direction,a=e.length,l=e.scalarField,h=n.map((function(t){return t.data[l]})).filter((function(t){return null!=t})),c=Math.min.apply(Math,b(h)),u=Math.max.apply(Math,b(h)),d=x(n);try{for(d.s();!(r=d.n()).done;){var p=r.value,f=p.data[l];null==f&&(f=c);var m=u>c?(f-c)/(u-c):.5;p.x=s.x+o.x*a*m,p.y=s.y+o.y*a*m}}catch(t){d.e(t)}finally{d.f()}}else{var y,g=x(n);try{for(g.s();!(y=g.n()).done;){var v=y.value,_=e.x-v.x,w=e.y-v.y,S=_*_+w*w;S<t.minDistSq&&(S=t.minDistSq);var E=Math.sqrt(S),k=t.attractionStrength*E;v.fixed||(v.vx+=_/E*k,v.vy+=w/E*k),0!==t.orbitStrength&&(v.vx+=-w/E*t.orbitStrength,v.vy+=_/E*t.orbitStrength)}}catch(t){g.e(t)}finally{g.f()}}};for(E.s();!(C=E.n()).done;)k()}catch(t){E.e(t)}finally{E.f()}var A,T=x(n);try{for(T.s();!(A=T.n()).done;){var M,P=A.value,O=x(i);try{for(O.s();!(M=O.n()).done;){var I=M.value,L=I.x-P.x,R=I.y-P.y,j=Math.sqrt(L*L+R*R)||.01;if(j<this.planetRadius){var D=this.planetRadius-j,N=L/j*D*this.planetRepulsion,F=R/j*D*this.planetRepulsion;I.fixed||(I.vx+=N,I.vy+=F)}}}catch(t){O.e(t)}finally{O.f()}}}catch(t){T.e(t)}finally{T.f()}var B,G=x(i);try{for(G.s();!(B=G.n()).done;){var z=B.value;z.fixed||(z.x+=z.vx,z.y+=z.vy,z.x=Math.max(r.minX,Math.min(r.maxX,z.x)),z.y=Math.max(r.minY,Math.min(r.maxY,z.y)))}}catch(t){G.e(t)}finally{G.f()}}}}],e&&S(t.prototype,e),i&&S(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function k(t){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function A(t){return function(t){if(Array.isArray(t))return P(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||M(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=M(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function M(t,e){if(t){if("string"==typeof t)return P(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?P(t,e):void 0}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function O(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,I(n.key),n)}}function I(t){var e=function(t,e){if("object"!=k(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=k(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==k(e)?e:e+""}var L=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.innerRadius=20,this.outerRadius=300,this.turns=4,this.spread=1,this.smoothing=.15,this.angleOffset=0,this.arcStep=12,this.wobbleStrength=2,this.wobbleFrequency=2,this.wobbleSpeed=.02,this.wobbleThreshold=3e3},e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this,i=this.model.getNodes(),n=i.filter((function(t){return"moon"===t.type})),r=T(i.filter((function(t){return"planet"===t.type})));try{var s=function(){var i=t.value,r=i.scalarField;if(!r)return 0;var s=n.filter((function(t){return i.rule(t)}));if(0===s.length)return 0;var o,a=1/0,l=-1/0,h=T(s);try{for(h.s();!(o=h.n()).done;){var c=o.value.data[r];null!=c&&(c<a&&(a=c),c>l&&(l=c))}}catch(t){h.e(t)}finally{h.f()}if(a===1/0||l===-1/0)return 0;i._sorted&&!i._dirty||(i._sorted=A(s).sort((function(t,e){var i,n;return(null!==(i=t.data[r])&&void 0!==i?i:a)-(null!==(n=e.data[r])&&void 0!==n?n:a)})),i._sorted.forEach((function(t,e){t._spiralIndex=e})),i._dirty=!1);var u,d=i._sorted,p=d.length<e.wobbleThreshold,f=T(d);try{for(f.s();!(u=f.n()).done;){var m=u.value,y=m.data[r];null==y&&(y=a);var g=l>a?(y-a)/(l-a):.5,v=e.angleOffset+g*e.turns*Math.PI*2,b=e.innerRadius+g*(e.outerRadius-e.innerRadius)*e.spread,x=m._spiralIndex||0,_=v+x*(e.arcStep/(b+1)),w=b+.5*x,S=0;p&&(void 0===m._spiralPhase&&(m._spiralPhase=Math.random()*Math.PI*2),m._spiralPhase+=e.wobbleSpeed,S=Math.sin(m._spiralPhase*e.wobbleFrequency)*e.wobbleStrength);var C=i.x+Math.cos(_)*(w+S),E=i.y+Math.sin(_)*(w+S);m.x+=(C-m.x)*e.smoothing,m.y+=(E-m.y)*e.smoothing}}catch(t){f.e(t)}finally{f.f()}};for(r.s();!(t=r.n()).done;)s()}catch(t){r.e(t)}finally{r.f()}}}],e&&O(t.prototype,e),i&&O(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function R(t){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(t)}function j(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=N(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function D(t){return function(t){if(Array.isArray(t))return F(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||N(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(t,e){if(t){if("string"==typeof t)return F(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?F(t,e):void 0}}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function B(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function G(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,U(n.key),n)}}function z(t,e,i){return e&&G(t.prototype,e),i&&G(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function U(t){var e=function(t,e){if("object"!=R(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=R(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==R(e)?e:e+""}var W=function(){return z((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.min,n=void 0===i?0:i,r=e.max,s=void 0===r?1:r,o=e.start,a=void 0===o?0:o,l=e.end,h=void 0===l?100:l,c=e.invert,u=void 0!==c&&c;B(this,t),this.min=n,this.max=s,this.start=a,this.end=h,this.invert=u}),[{key:"map",value:function(t){var e=this.max>this.min?(t-this.min)/(this.max-this.min):.5;return this.invert&&(e=1-e),this.start+e*(this.end-this.start)}}])}(),H=function(){return z((function t(){B(this,t),this.smoothing=.2,this.padding=40,this.jitter=10}),[{key:"setModel",value:function(t){this.model=t}},{key:"_mapCategorical",value:function(t){var e=D(new Set(t)),i=new Map;return e.forEach((function(t,e){return i.set(t,e)})),i}},{key:"step",value:function(){var t=this,e=this.model.getNodes(),i=e.filter((function(t){return"moon"===t.type})),n=e.filter((function(t){return"vector"===t.type})),r=this.bounds;if(r){var s,o=r.minY+this.padding,a=r.maxY-this.padding,l=r.minX+this.padding,h=r.maxX-this.padding,c=j(n);try{var u=function(){var e,n,r=s.value,c=r.scalarField;if(!c)return 0;var u=i.filter((function(t){return r.rule(t)}));if(!u.length)return 0;var d,p,f,m,y=[],g=!0,v=j(u);try{for(v.s();!(d=v.n()).done;){var b=d.value,x=b.data[c];if(null!=x){var _=Number(x);isNaN(_)&&(g=!1),b._value=g?_:x,y.push(b._value)}}}catch(t){v.e(t)}finally{v.f()}if(!y.length)return 0;if(g)p=Math.min.apply(Math,y),f=Math.max.apply(Math,y);else{p=0,f=(m=t._mapCategorical(y)).size-1;var w,S=j(u);try{for(S.s();!(w=S.n()).done;){var C=w.value;C._value=m.get(C._value)}}catch(t){S.e(t)}finally{S.f()}}var E=new W({min:p,max:f,start:l,end:h}),k=new W({min:p,max:f,start:o,end:a});u.sort((function(t,e){var i,n;return(null!==(i=t._value)&&void 0!==i?i:0)-(null!==(n=e._value)&&void 0!==n?n:0)}));for(var A=0!==(null===(e=r.direction)||void 0===e?void 0:e.x),T=0!==(null===(n=r.direction)||void 0===n?void 0:n.y),M=u.length,P=(h-l)/Math.max(1,M-1),O=(a-o)/Math.max(1,M-1),I=0;I<M;I++){var L,R=u[I],D=null!==(L=R._value)&&void 0!==L?L:p,N=R.x,F=R.y;if(A)N=.7*(l+I*P)+.3*E.map(D),F=R.y+(Math.random()-.5)*t.jitter;if(T)F=.7*(o+I*O)+.3*k.map(D),N=R.x+(Math.random()-.5)*t.jitter;R.x+=(N-R.x)*t.smoothing,R.y+=(F-R.y)*t.smoothing}};for(c.s();!(s=c.n()).done;)u()}catch(t){c.e(t)}finally{c.f()}}}}])}();function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function X(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=$(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function Y(t){return function(t){if(Array.isArray(t))return q(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||$(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(t,e){if(t){if("string"==typeof t)return q(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?q(t,e):void 0}}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function K(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Z(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Q(n.key),n)}}function J(t,e,i){return e&&Z(t.prototype,e),i&&Z(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function Q(t){var e=function(t,e){if("object"!=V(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=V(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==V(e)?e:e+""}var tt=function(){return J((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.min,n=void 0===i?0:i,r=e.max,s=void 0===r?1:r,o=e.start,a=void 0===o?0:o,l=e.end,h=void 0===l?100:l,c=e.invert,u=void 0!==c&&c;K(this,t),this.min=n,this.max=s,this.start=a,this.end=h,this.invert=u}),[{key:"map",value:function(t){var e=this.max>this.min?(t-this.min)/(this.max-this.min):.5;return this.invert&&(e=1-e),this.start+e*(this.end-this.start)}}])}(),et=function(){return J((function t(){K(this,t),this.smoothing=.2,this.padding=40,this.jitter=10,this.repulsion=.8,this.minDist=25,this.iterations=1}),[{key:"setModel",value:function(t){this.model=t}},{key:"_mapCategorical",value:function(t){var e=Y(new Set(t)),i=new Map;return e.forEach((function(t,e){return i.set(t,e)})),i}},{key:"step",value:function(){var t=this,e=this.model.getNodes(),i=e.filter((function(t){return"moon"===t.type})),n=e.filter((function(t){return"vector"===t.type})),r=this.bounds;if(r){var s,o=r.minY+this.padding,a=r.maxY-this.padding,l=r.minX+this.padding,h=r.maxX-this.padding,c=X(n);try{var u=function(){var e,n,r=s.value,c=r.scalarField;if(!c)return 0;var u=i.filter((function(t){return r.rule(t)}));if(!u.length)return 0;var d,p,f,m,y=[],g=!0,v=X(u);try{for(v.s();!(d=v.n()).done;){var b=d.value,x=b.data[c];if(null!=x){var _=Number(x);isNaN(_)&&(g=!1),b._value=g?_:x,y.push(b._value)}}}catch(t){v.e(t)}finally{v.f()}if(!y.length)return 0;if(g)p=Math.min.apply(Math,y),f=Math.max.apply(Math,y);else{p=0,f=(m=t._mapCategorical(y)).size-1;var w,S=X(u);try{for(S.s();!(w=S.n()).done;){var C=w.value;C._value=m.get(C._value)}}catch(t){S.e(t)}finally{S.f()}}var E=new tt({min:p,max:f,start:l,end:h}),k=new tt({min:p,max:f,start:o,end:a});u.sort((function(t,e){var i,n;return(null!==(i=t._value)&&void 0!==i?i:0)-(null!==(n=e._value)&&void 0!==n?n:0)}));for(var A=0!==(null===(e=r.direction)||void 0===e?void 0:e.x),T=0!==(null===(n=r.direction)||void 0===n?void 0:n.y),M=u.length,P=(Math.max(1,M-1),Math.max(1,M-1),0);P<M;P++){var O,I=u[P],L=null!==(O=I._value)&&void 0!==O?O:p,R=I.x,j=I.y;if(A){R=E.map(L),j=I.y+(Math.random()-.5)*t.jitter}if(T){j=k.map(L),R=I.x+(Math.random()-.5)*t.jitter}I.x+=(R-I.x)*t.smoothing,I.y+=(j-I.y)*t.smoothing}for(var D=0;D<t.iterations;D++)for(var N=0;N<M-1;N++){var F=u[N],B=u[N+1],G=B.x-F.x,z=B.y-F.y;if(!(Math.abs(G)>t.minDist&&Math.abs(z)>t.minDist)){var U=Math.sqrt(G*G+z*z)||1e-4;if(U<t.minDist){var W=(t.minDist-U)/U;if(A){var H=z*W*.5*t.repulsion;F.y-=H,B.y+=H}if(T){var V=G*W*.5*t.repulsion;F.x-=V,B.x+=V}}}}};for(c.s();!(s=c.n()).done;)u()}catch(t){c.e(t)}finally{c.f()}}}}])}();function it(t){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},it(t)}function nt(t){return function(t){if(Array.isArray(t))return st(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||rt(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rt(t,e){if(t){if("string"==typeof t)return st(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?st(t,e):void 0}}function st(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function ot(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,at(n.key),n)}}function at(t){var e=function(t,e){if("object"!=it(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=it(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==it(e)?e:e+""}var lt=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.innerRadius=20,this.outerRadius=300,this.turns=4,this.spread=1,this.smoothing=.15,this.angleOffset=0,this.jitter=.002,this.wobbleStrength=2,this.wobbleFrequency=2},e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this,i=this.model.getNodes(),n=i.filter((function(t){return"moon"===t.type})),r=function(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=rt(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}(i.filter((function(t){return"planet"===t.type})));try{var s=function(){var i=t.value,r=i.scalarField;if(!r)return 0;var s=n.filter((function(t){return i.rule(t)}));if(0===s.length)return 0;s.sort((function(t,e){var i,n;return(null!==(i=t.data[r])&&void 0!==i?i:0)-(null!==(n=e.data[r])&&void 0!==n?n:0)}));var o=s.map((function(t){return t.data[r]})).filter((function(t){return null!=t}));if(0===o.length)return 0;var a=Math.min.apply(Math,nt(o)),l=Math.max.apply(Math,nt(o));s.forEach((function(t,n){var s=t.data[r];null==s&&(s=a);var o=l>a?(s-a)/(l-a):.5,h=e.angleOffset+o*e.turns*Math.PI*2,c=e.innerRadius+o*(e.outerRadius-e.innerRadius)*e.spread;void 0===t._spiralPhase&&(t._spiralPhase=Math.random()*Math.PI*2),t._spiralPhase+=.02;var u=Math.sin(t._spiralPhase*e.wobbleFrequency)*e.wobbleStrength,d=i.x+Math.cos(h)*(c+u),p=i.y+Math.sin(h)*(c+u);Math.random(),e.jitter,t.x+=(d-t.x)*e.smoothing,t.y+=(p-t.y)*e.smoothing}))};for(r.s();!(t=r.n()).done;)s()}catch(t){r.e(t)}finally{r.f()}}}],e&&ot(t.prototype,e),i&&ot(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function ht(t){return ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ht(t)}function ct(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return ut(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ut(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function ut(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function dt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,pt(n.key),n)}}function pt(t){var e=function(t,e){if("object"!=ht(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=ht(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ht(e)?e:e+""}var ft=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.innerRadius=50,this.outerRadius=240,this.angularSpeed=.002,this.smoothing=.15,this.wobbleStrength=2,this.wobbleFrequency=2,this.angleJitter=.002},e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this,i=this.model.getNodes(),n=i.filter((function(t){return"moon"===t.type})),r=ct(i.filter((function(t){return"planet"===t.type})));try{var s=function(){var i=t.value;i._orbits=[];var r=i.scalarField;if(!r)return 0;var s=n.filter((function(t){return i.rule(t)}));if(!s.length)return 0;var o={};s.forEach((function(t){var e=null!=t.data[r]?t.data[r]:"__null__";o[e]||(o[e]=[]),o[e].push(t)}));var a=Object.keys(o),l=a.length;a.forEach((function(t,n){var r=o[t],s=e.innerRadius+n/(l-1||1)*(e.outerRadius-e.innerRadius);i._orbits.push({value:t,radius:s,count:r.length}),r.forEach((function(t,n){void 0===t._orbitAngle&&(t._orbitAngle=Math.random()*Math.PI*2),t._orbitAngle+=e.angularSpeed;var r=Math.sin(t._orbitAngle*e.wobbleFrequency)*e.wobbleStrength,o=i.x+Math.cos(t._orbitAngle)*(s+r),a=i.y+Math.sin(t._orbitAngle)*(s+r);t._orbitAngle+=(Math.random()-.5)*e.angleJitter,t.x+=(o-t.x)*e.smoothing,t.y+=(a-t.y)*e.smoothing}))}))};for(r.s();!(t=r.n()).done;)s()}catch(t){r.e(t)}finally{r.f()}}}],e&&dt(t.prototype,e),i&&dt(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function mt(t){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(t)}function yt(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return gt(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?gt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function gt(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function vt(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,bt(n.key),n)}}function bt(t){var e=function(t,e){if("object"!=mt(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==mt(e)?e:e+""}var xt=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.gravity=.05,this.damping=.999,this.restitution=.7,this.friction=.98,this.radius=10},(e=[{key:"setModel",value:function(t){this.model=t}},{key:"step",value:function(){var t,e=this.model.getNodes().filter((function(t){return"moon"===t.type})),i=this.bounds,n=i.maxY,r=yt(e);try{for(r.s();!(t=r.n()).done;){var s=t.value;if(!s.fixed){if(s.vy+=this.gravity,s.x+=s.vx,s.y+=s.vy,s.y+this.radius>n){s.y=n-this.radius,s.vy*=-this.restitution,s.vx*=this.friction;var o=.6*(Math.random()-.5),a=.4*Math.abs(s.vy);s.vx+=Math.sin(o)*a}s.x-this.radius<i.minX&&(s.x=i.minX+this.radius,s.vx*=-this.restitution),s.x+this.radius>i.maxX&&(s.x=i.maxX-this.radius,s.vx*=-this.restitution),s.vx*=this.damping,s.vy*=this.damping}}}catch(t){r.e(t)}finally{r.f()}}}])&&vt(t.prototype,e),i&&vt(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function _t(t){return _t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_t(t)}function wt(t){return function(t){if(Array.isArray(t))return Ct(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||St(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function St(t,e){if(t){if("string"==typeof t)return Ct(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ct(t,e):void 0}}function Ct(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Et(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,kt(n.key),n)}}function kt(t){var e=function(t,e){if("object"!=_t(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=_t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_t(e)?e:e+""}var At=function(){return t=function t(e,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.view=e,this.model=i,this.main=null,this.selected=new Set,this._bindViewEvents()},e=[{key:"_bindViewEvents",value:function(){var t=this;this.view.onNodeClick=function(e){t._inspectNode(e)},this.view.interaction.onNodeRightClick=function(e){var i=e.node,n=e.global,r=(e.ev,t.view.app.canvas.getBoundingClientRect());console.log("CLICKEDDD",i);var s=r.left+n.x,o=r.top+n.y;t.view.selectedNodes.size>1?t._showGroupContextMenu(s,o,i):t._showContextMenu(s,o,i)},this.view.interaction.onStageRightClick=function(e){var i=t.view.app.canvas.getBoundingClientRect();console.log("CLICKEDDD");var n=i.left+e.x,r=i.top+e.y;t.view.selectedNodes.size>1?t._showGroupContextMenu(n,r,null):t._showGraphContextMenu(n,r)},this.view.onNodeDragStart=function(t){t.vx=0,t.vy=0,t.fixed=!0},this.view.onNodeDragMove=function(t,e){t.x=e.x,t.y=e.y},this.view.onNodeDragEnd=function(t){t.fixed=!1},this.view.interaction.onBackgroundPointerDown=function(){t._hideContextMenu(),t._hideGraphContextMenu()},this.view.onSelectionChange=function(e){console.log("Selected nodes:",e),t._refreshFormulaNodes()}}},{key:"_showGraphContextMenu",value:function(t,e){var i=this;this._hideGraphContextMenu();var n=document.createElement("div");n.className="context-menu";var r=this.view.app.canvas.parentElement,s=r.getBoundingClientRect();n.style.position="absolute",n.style.left="".concat(t-s.left,"px"),n.style.top="".concat(e-s.top,"px"),n.style.background="#2b2b2b",n.style.color="#fff",n.style.padding="6px",n.style.borderRadius="8px",n.style.zIndex=1e3,n.style.minWidth="160px",n.style.boxShadow="0 4px 12px rgba(0,0,0,0.4)",n.style.fontSize="13px",n.style.userSelect="none";var o=function(t,e){var i=document.createElement("div");return i.textContent=t,i.style.padding="8px 12px",i.style.borderRadius="6px",i.style.cursor="pointer",i.style.transition="background 0.15s",i.addEventListener("mouseenter",(function(){i.style.background="#3a3a3a"})),i.addEventListener("mouseleave",(function(){i.style.background="transparent"})),i.addEventListener("click",e),i};n.appendChild(o("⏸ Freeze Graph",(function(){var t,e;null===(t=(e=i.main).pauseGraph)||void 0===t||t.call(e),i._hideGraphContextMenu()}))),n.appendChild(o("▶ Resume Graph",(function(){var t,e;null===(t=(e=i.main).resumeGraph)||void 0===t||t.call(e),i._hideGraphContextMenu()}))),n.appendChild(o("| Remove Y Axis",(function(){i.model.removeYVectors(),i._hideGraphContextMenu()}))),n.appendChild(o("- Remove X Axis",(function(){i.model.removeXVectors(),i._hideGraphContextMenu()}))),n.appendChild(o("hide this menu",(function(){i._hideGraphContextMenu()}))),r.appendChild(n);var a=n.getBoundingClientRect(),l=t-s.left,h=e-s.top;l+a.width>s.width&&(l=s.width-a.width-4),h+a.height>s.height&&(h=s.height-a.height-4),l=Math.max(4,l),h=Math.max(4,h),n.style.left="".concat(l,"px"),n.style.top="".concat(h,"px"),this._graphContextMenu=n}},{key:"_inspectNode",value:function(t){var e=document.getElementById("inspector");e||((e=document.createElement("div")).id="inspector",document.body.appendChild(e)),e.innerHTML="\n <pre>".concat(JSON.stringify(t.data,null,2),"</pre>\n ")}},{key:"_hideGraphContextMenu",value:function(){this._graphContextMenu&&(this._graphContextMenu.remove(),this._graphContextMenu=null)}},{key:"_showContextMenu",value:function(t,e,i){var n=this;this._hideContextMenu();var r=document.createElement("div");r.className="context-menu";var s=this.view.app.canvas.parentElement,o=s.getBoundingClientRect();r.style.position="absolute",r.style.left="".concat(t-o.left,"px"),r.style.top="".concat(e-o.top,"px"),r.style.background="#2b2b2b",r.style.color="#fff",r.style.padding="6px",r.style.borderRadius="8px",r.style.zIndex=1e3,r.style.minWidth="140px",r.style.boxShadow="0 4px 12px rgba(0,0,0,0.4)",r.style.fontSize="13px",r.style.userSelect="none";var a=function(t,e){var i=document.createElement("div");return i.textContent=t,i.style.padding="8px 12px",i.style.borderRadius="6px",i.style.cursor="pointer",i.style.transition="background 0.15s",i.addEventListener("mouseenter",(function(){i.style.background="#3a3a3a"})),i.addEventListener("mouseleave",(function(){i.style.background="transparent"})),i.addEventListener("click",e),i};r.appendChild(a("🗑 Delete Node",(function(){n._deleteNode(i),n._hideContextMenu()})));var l=document.createElement("div");l.style.height="1px",l.style.background="#444",l.style.margin="4px 0",r.appendChild(l),r.appendChild(a("🔍 Inspect",(function(){var t,e;null===(t=(e=n.main).onNodeInspect)||void 0===t||t.call(e,i),n._hideContextMenu()}))),s.appendChild(r),r.style.visibility="hidden",r.style.left="0px",r.style.top="0px";var h=r.getBoundingClientRect(),c=t-o.left,u=e-o.top,d=o.width,p=o.height;c+h.width>d&&(c=d-h.width-4),u+h.height>p&&(u=p-h.height-4),c=Math.max(4,c),u=Math.max(4,u),r.style.left="".concat(c,"px"),r.style.top="".concat(u,"px"),r.style.visibility="visible",this._contextMenu=r}},{key:"_hideContextMenu",value:function(){this._contextMenu&&(this._contextMenu.remove(),this._contextMenu=null),this._hideGroupContextMenu()}},{key:"_showGroupContextMenu",value:function(t,e,i){var n=this;this._hideGroupContextMenu();var r=document.createElement("div");r.className="context-menu";var s=this.view.app.canvas.parentElement,o=s.getBoundingClientRect();r.style.position="absolute",r.style.left="".concat(t-o.left,"px"),r.style.top="".concat(e-o.top,"px"),r.style.background="#2b2b2b",r.style.color="#fff",r.style.padding="6px",r.style.borderRadius="8px",r.style.zIndex=1e3,r.style.minWidth="140px",r.style.boxShadow="0 4px 12px rgba(0,0,0,0.4)",r.style.fontSize="13px",r.style.userSelect="none";var a=function(t,e){var i=document.createElement("div");return i.textContent=t,i.style.padding="8px 12px",i.style.borderRadius="6px",i.style.cursor="pointer",i.style.transition="background 0.15s",i.addEventListener("mouseenter",(function(){i.style.background="#3a3a3a"})),i.addEventListener("mouseleave",(function(){i.style.background="transparent"})),i.addEventListener("click",e),i};r.appendChild(a("🗑 Delete Selected Nodes",(function(){for(var t=0,e=wt(n.view.selectedNodes);t<e.length;t++){var i=e[t];n._deleteNode(i)}n.view.selectedNodes.clear(),n.view.renderer.updateSelection(n.view.selectedNodes),n._hideGroupContextMenu()})));var l=document.createElement("div");l.style.height="1px",l.style.background="#444",l.style.margin="4px 0",r.appendChild(l),r.appendChild(a("🔍 Inspect Selection",(function(){var t,e;null===(t=(e=n.main).onGroupInspect)||void 0===t||t.call(e,n.view.getSelectedMoons()),n._hideGroupContextMenu()}))),s.appendChild(r),this._groupContextMenu=r}},{key:"_hideGroupContextMenu",value:function(){this._groupContextMenu&&(this._groupContextMenu.remove(),this._groupContextMenu=null)}},{key:"_deleteNode",value:function(t){var e,i,n;this.model.deleteNode(t.id),this.view.renderer.remove(t.id),null===(e=this.view.selectedNodes)||void 0===e||e.delete(t),this.view.renderer.updateSelection(this.view.selectedNodes),null===(i=(n=this.view).onSelectionChange)||void 0===i||i.call(n,this.view.selectedNodes),this._hideContextMenu()}},{key:"_highlight",value:function(t){var e=this.view.graphicsMap.get(t);e&&(e.tint=16711680)}},{key:"_refreshFormulaNodes",value:function(){var t,e=this.model.getNodes(),i=e.filter((function(t){return"formula"!==t.type})),n=wt(this.view.selectedNodes).filter((function(t){return"formula"!==t.type})),r={sum:function(t,e){return t.reduce((function(t,i){var n;return t+Number((null===(n=i.data)||void 0===n?void 0:n[e])||0)}),0)},count:function(t){return t.length},avg:function(t,e){return t.length?r.sum(t,e)/t.length:0},min:function(t,e){return t.length?Math.min.apply(Math,wt(t.map((function(t){var i;return Number((null===(i=t.data)||void 0===i?void 0:i[e])||0)})))):0},max:function(t,e){return t.length?Math.max.apply(Math,wt(t.map((function(t){var i;return Number((null===(i=t.data)||void 0===i?void 0:i[e])||0)})))):0}},s=function(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=St(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}(e);try{for(s.s();!(t=s.n()).done;){var o=t.value;if("formula"===o.type){console.log("refreshing".node);var a="selected"===o.scope?n:i,l=r[o.formula]||r.sum;o.value=l(a,o.scalarField)}}}catch(t){s.e(t)}finally{s.f()}}}],e&&Et(t.prototype,e),i&&Et(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}(),Tt=r(8507);const Mt={extension:{type:Tt.Ag.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.all([r.e(859),r.e(397)]).then(r.bind(r,8397))}},Pt={extension:{type:Tt.Ag.Environment,name:"webworker",priority:0},test:()=>"undefined"!=typeof self&&void 0!==self.WorkerGlobalScope,load:async()=>{await Promise.all([r.e(859),r.e(162)]).then(r.bind(r,2162))}};r(5753),r(6312);var Ot=r(1761),It=r(800);let Lt,Rt;async function jt(t={}){return void 0!==Rt||(Rt=await(async()=>{const e=Ot.e.get().getNavigator().gpu;if(!e)return!1;try{const i=await e.requestAdapter(t);return await i.requestDevice(),!0}catch(t){return!1}})()),Rt}const Dt=["webgl","webgpu","canvas"];var Nt=r(5559),Ft=r(7073),Bt=r(4670);class Gt{static init(t){Object.defineProperty(this,"resizeTo",{configurable:!0,set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame((()=>this.resize())))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;let t,e;if(this._cancelResize(),this._resizeTo===globalThis.window)t=globalThis.innerWidth,e=globalThis.innerHeight;else{const{clientWidth:i,clientHeight:n}=this._resizeTo;t=i,e=n}this.renderer.resize(t,e),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Gt.extension=Tt.Ag.Application;var zt=r(4458),Ut=r(7309);class Wt{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{configurable:!0,set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,zt.d.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Ut.R.shared:new Ut.R,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Wt.extension=Tt.Ag.Application,Tt.XO.add(Gt),Tt.XO.add(Wt);const Ht=class t{constructor(...t){this.stage=new Nt.mc,void 0!==t[0]&&(0,Bt.t6)(Bt.lj,"Application constructor options are deprecated, please use Application.init() instead.")}async init(e){e={...e},this.stage||(this.stage=new Nt.mc),this.renderer=await async function(t){let e,i=[];t.preference?(i.push(t.preference),Dt.forEach((e=>{e!==t.preference&&i.push(e)}))):i=Dt.slice();let n={};for(let o=0;o<i.length;o++){const a=i[o];if("webgpu"===a&&await jt()){const{WebGPURenderer:i}=await Promise.all([r.e(468),r.e(866)]).then(r.bind(r,9866));e=i,n={...t,...t.webgpu};break}if("webgl"===a&&(s=t.failIfMajorPerformanceCaveat??It.k.defaultOptions.failIfMajorPerformanceCaveat,void 0!==Lt||(Lt=(()=>{const t={stencil:!0,failIfMajorPerformanceCaveat:s??It.k.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Ot.e.get().getWebGLRenderingContext())return!1;let e=Ot.e.get().createCanvas().getContext("webgl",t);const i=!!e?.getContextAttributes()?.stencil;if(e){const t=e.getExtension("WEBGL_lose_context");t&&t.loseContext()}return e=null,i}catch(t){return!1}})()),Lt)){const{WebGLRenderer:i}=await Promise.all([r.e(468),r.e(132)]).then(r.bind(r,4132));e=i,n={...t,...t.webgl};break}if("canvas"===a){const{CanvasRenderer:i}=await Promise.all([r.e(468),r.e(851)]).then(r.bind(r,6851));e=i,n={...t,...t.canvasOptions};break}}var s;if(delete n.webgpu,delete n.webgl,delete n.canvasOptions,!e)throw new Error("No available renderer for the current environment");const o=new e;return await o.init(n),o}(e),t._plugins.forEach((t=>{t.init.call(this,e)}))}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return(0,Bt.t6)(Bt.lj,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,i=!1){const n=t._plugins.slice(0);n.reverse(),n.forEach((t=>{t.destroy.call(this)})),this.stage.destroy(i),this.stage=null,this.renderer.destroy(e),this.renderer=null}};Ht._plugins=[];let Vt=Ht;Tt.XO.handleByList(Tt.Ag.Application,Vt._plugins),Tt.XO.add(Ft.M);var Xt=r(6125),Yt=r(9252),$t=(r(9726),r(4663)),qt=r(583),Kt=r(218),Zt=r(2812),Jt=r(4985);class Qt extends Jt.l{constructor(t,e){const{text:i,resolution:n,style:r,anchor:s,width:o,height:a,roundPixels:l,...h}=t;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=r,this.resolution=n??null,this.allowChildren=!1,this._anchor=new Zt.o({_onUpdate:()=>{this.onViewUpdate()}}),s&&(this.anchor=s),this.roundPixels=l??!1,void 0!==o&&(this.width=o),void 0!==a&&(this.height=a)}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=null===t,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){"object"==typeof t?(e=t.height??t.width,t=t.width):e??(e=t),void 0!==t&&this._setWidth(t,this.bounds.width),void 0!==e&&this._setHeight(e,this.bounds.height)}containsPoint(t){const e=this.bounds.width,i=this.bounds.height,n=-e*this.anchor.x;let r=0;return t.x>=n&&t.x<=n+e&&(r=-i*this.anchor.y,t.y>=r&&t.y<=r+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,("boolean"==typeof t?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}}var te=r(2577),ee=r(7608),ie=r(9939);let ne=null,re=null;function se(t,e,i){for(let n=0,r=4*i*e;n<e;++n,r+=4)if(0!==t[r+3])return!1;return!0}function oe(t,e,i,n,r){const s=4*e;for(let e=n,o=n*s+4*i;e<=r;++e,o+=s)if(0!==t[o+3])return!1;return!0}function ae(...t){let e=t[0];e.canvas||(e={canvas:t[0],resolution:t[1]});const{canvas:i}=e,n=Math.min(e.resolution??1,1),r=e.width??i.width,s=e.height??i.height;let o=e.output;if(function(t,e){ne||(ne=Ot.e.get().createCanvas(256,128),re=ne.getContext("2d",{willReadFrequently:!0}),re.globalCompositeOperation="copy",re.globalAlpha=1),(ne.width<t||ne.height<e)&&(ne.width=(0,ie.U5)(t),ne.height=(0,ie.U5)(e))}(r,s),!re)throw new TypeError("Failed to get canvas 2D context");re.drawImage(i,0,0,r,s,0,0,r*n,s*n);const a=re.getImageData(0,0,r,s).data;let l=0,h=0,c=r-1,u=s-1;for(;h<s&&se(a,r,h);)++h;if(h===s)return Yt.M.EMPTY;for(;se(a,r,u);)--u;for(;oe(a,r,l,h,u);)++l;for(;oe(a,r,c,h,u);)--c;return++c,++u,re.globalCompositeOperation="source-over",re.strokeRect(l,h,c-l,u-h),re.globalCompositeOperation="copy",o??(o=new Yt.M),o.set(l/n,h/n,(c-l)/n,(u-h)/n),o}class le{constructor(t=0,e=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,null!==e.prev&&(e.prev.next=e.next),null!==e.next&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){const e=new Array(t.length);for(let i=0;i<t.length;i++){const n=t[i];e[i]=[n,this.get(n)]}return e}evict(t=!1){if(t||this.size>0){const t=this.first;delete this.items[t.key],0==--this.size?(this.first=null,this.last=null):(this.first=t.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){const e=this.items[t];if(void 0!==e)return this.ttl>0&&e.expiry<=Date.now()?void this.delete(t):(this.moveToEnd(e),e.value)}has(t){return t in this.items}moveToEnd(t){this.last!==t&&(null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),t.prev=this.last,t.next=null,null!==this.last&&(this.last.next=t),this.last=t,null===this.first&&(this.first=t))}keys(){const t=new Array(this.size);let e=this.first,i=0;for(;null!==e;)t[i++]=e.key,e=e.next;return t}setWithEvicted(t,e,i=this.resetTtl){let n=null;if(this.has(t))this.set(t,e,!0,i);else{this.max>0&&this.size===this.max&&(n={...this.first},this.evict(!0));let i=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e};1==++this.size?this.first=i:this.last.next=i,this.last=i}return n}set(t,e,i=!1,n=this.resetTtl){let r=this.items[t];return i||void 0!==r?(r.value=e,!1===i&&n&&(r.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(r)):(this.max>0&&this.size===this.max&&this.evict(!0),r=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},1==++this.size?this.first=r:this.last.next=r,this.last=r),this}values(t=this.keys()){const e=new Array(t.length);for(let i=0;i<t.length;i++)e[i]=this.get(t[i]);return e}}function he(t){return!!t.tagStyles&&Object.keys(t.tagStyles).length>0}function ce(t){return t.includes("<")}function ue(t,e){const i=[],n=e.tagStyles;if(!he(e)||!ce(t))return i.push({text:t,style:e}),i;const r=[e],s=[];let o="",a=0;for(;a<t.length;){const e=t[a];if("<"===e){const c=t.indexOf(">",a);if(-1===c){o+=e,a++;continue}const u=t.slice(a+1,c);if(u.startsWith("/")){const e=u.slice(1).trim();if(s.length>0&&s[s.length-1]===e){o.length>0&&(i.push({text:o,style:r[r.length-1]}),o=""),r.pop(),s.pop(),a=c+1;continue}o+=t.slice(a,c+1),a=c+1;continue}{const e=u.trim();if(n[e]){o.length>0&&(i.push({text:o,style:r[r.length-1]}),o="");const t=r[r.length-1],u=(l=t,h=n[e],l.clone().assign(h));r.push(u),s.push(e),a=c+1;continue}o+=t.slice(a,c+1),a=c+1;continue}}o+=e,a++}var l,h;return o.length>0&&i.push({text:o,style:r[r.length-1]}),i}const de=new Set([10,13]),pe=new Set([9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]),fe=(new Set([9,32]),new Set([45,8208,8211,8212,173])),me=/(\r\n|\r|\n)/,ye=/(?:\r\n|\r|\n)/;function ge(t){return"string"==typeof t&&de.has(t.charCodeAt(0))}function ve(t,e){return"string"==typeof t&&pe.has(t.charCodeAt(0))}function be(t){return"string"==typeof t&&fe.has(t.charCodeAt(0))}function xe(t){return"normal"===t||"pre-line"===t}function _e(t){return"normal"===t}function we(t){if("string"!=typeof t)return"";let e=t.length-1;for(;e>=0&&ve(t[e]);)e--;return e<t.length-1?t.slice(0,e+1):t}function Se(t){const e=[],i=[];if("string"!=typeof t)return e;for(let n=0;n<t.length;n++){const r=t[n],s=t[n+1];ve(r)||ge(r)?(i.length>0&&(e.push(i.join("")),i.length=0),"\r"===r&&"\n"===s?(e.push("\r\n"),n++):e.push(r)):(i.push(r),be(r)&&s&&!ve(s)&&!ge(s)&&(e.push(i.join("")),i.length=0))}return i.length>0&&e.push(i.join("")),e}function Ce(t,e,i,n){const r=i(t),s=[];for(let i=0;i<r.length;i++){let o=r[i],a=o,l=1;for(;r[i+l];){const s=r[i+l];if(n(a,s,t,i,e))break;o+=s,a=s,l++}i+=l-1,s.push(o)}return s}const Ee=/\r\n|\r|\n/g;function ke(t,e,i,n,r,s,o,a){const l=ue(t,e);if(_e(e.whiteSpace))for(let t=0;t<l.length;t++){const e=l[t];l[t]={text:e.text.replace(Ee," "),style:e.style}}const h=[];let c=[];for(const t of l){const e=t.text.split(me);for(let i=0;i<e.length;i++){const n=e[i];"\r\n"===n||"\r"===n||"\n"===n?(h.push(c),c=[]):n.length>0&&c.push({text:n,style:t.style})}}(c.length>0||0===h.length)&&h.push(c);const u=i?function(t,e,i,n,r,s){const{letterSpacing:o,whiteSpace:a,wordWrapWidth:l,breakWords:h}=e,c=xe(a),u=l+o,d={};let p="";const f=(t,e)=>{const r=`${t}|${e.styleKey}`;let s=d[r];if(void 0===s){const o=e._fontString;o!==p&&(i.font=o,p=o),s=n(t,e.letterSpacing,i)+e.letterSpacing,d[r]=s}return s},m=[];for(const e of t){const t=Ae(e),i=m.length,n=e=>{let i=0,n=e;do{const{token:e,style:r}=t[n];i+=f(e,r),n++}while(n<t.length&&t[n].continuesFromPrevious);return i},o=e=>{const i=[];let n=e;do{i.push({token:t[n].token,style:t[n].style}),n++}while(n<t.length&&t[n].continuesFromPrevious);return i};let a=[],l=0,d=!c,p=null;const y=()=>{p&&p.text.length>0&&a.push(p),p=null},g=()=>{if(y(),a.length>0){const t=a[a.length-1];t.text=we(t.text),0===t.text.length&&a.pop()}m.push(a),a=[],l=0,d=!1};for(let e=0;e<t.length;e++){const{token:i,style:v,continuesFromPrevious:b}=t[e],x=f(i,v);if(c){const t=ve(i),e=p?.text[p.text.length-1]??a[a.length-1]?.text.slice(-1)??"",n=!!e&&ve(e);if(t&&n)continue}const _=!b,w=_?n(e):x;if(w>u&&_)if(l>0&&g(),h){const t=o(e);for(let e=0;e<t.length;e++){const i=t[e].token,n=t[e].style,o=Ce(i,h,s,r);for(const t of o){const e=f(t,n);e+l>u&&g(),p&&p.style===n?p.text+=t:(y(),p={text:t,style:n}),l+=e}}e+=t.length-1}else{const t=o(e);y(),m.push(t.map((t=>({text:t.token,style:t.style})))),d=!1,e+=t.length-1}else if(w+l>u&&_){if(ve(i)){d=!1;continue}g(),p={text:i,style:v},l=x}else if(b&&!h)p&&p.style===v?p.text+=i:(y(),p={text:i,style:v}),l+=x;else{const t=ve(i);if(0===l&&t&&!d)continue;p&&p.style===v?p.text+=i:(y(),p={text:i,style:v}),l+=x}}if(y(),a.length>0){const t=a[a.length-1];t.text=we(t.text),0===t.text.length&&a.pop()}(a.length>0||m.length===i)&&m.push(a)}return m}(h,e,n,r,o,a):h,d=[],p=[],f=[],m=[],y=[];let g=0;const v=s(e._fontString);0===v.fontSize&&(v.fontSize=e.fontSize,v.ascent=e.fontSize);let b="",x=!!e.dropShadow,_=e._stroke?.width||0;for(const t of u){let i=0,o=v.ascent,a=v.descent,l="";for(const e of t){const t=e.style._fontString,h=s(t);t!==b&&(n.font=t,b=t);i+=r(e.text,e.style.letterSpacing,n),o=Math.max(o,h.ascent),a=Math.max(a,h.descent),l+=e.text;const c=e.style._stroke?.width||0;c>_&&(_=c),!x&&e.style.dropShadow&&(x=!0)}0===t.length&&(o=v.ascent,a=v.descent),d.push(i),p.push(o),f.push(a),y.push(l);const h=e.lineHeight||o+a;m.push(h+e.leading),g=Math.max(g,i)}const w=_,S=(i&&"left"!==e.align?Math.max(g,e.wordWrapWidth):g)+w+(e.dropShadow?e.dropShadow.distance:0);let C=0;for(let t=0;t<m.length;t++)C+=m[t];C=Math.max(C,m[0]+w);return{width:S,height:C+(e.dropShadow?e.dropShadow.distance:0),lines:y,lineWidths:d,lineHeight:(e.lineHeight||v.fontSize)+e.leading,maxLineWidth:g,fontProperties:v,runsByLine:u,lineAscents:p,lineDescents:f,lineHeights:m,hasDropShadow:x}}function Ae(t){const e=[];let i=!1;for(const n of t){const t=Se(n.text);let r=!0;for(const s of t){const t=ve(s)||ge(s),o=r&&i&&!t;e.push({token:s,style:n.style,continuesFromPrevious:o}),i=!t,r=!1}}return e}const Te={willReadFrequently:!0};function Me(t,e,i,n,r){let s=i[t];return"number"!=typeof s&&(s=r(t,e,n)+e,i[t]=s),s}const Pe={willReadFrequently:!0},Oe=class t{static get experimentalLetterSpacingSupported(){let e=t._experimentalLetterSpacingSupported;if(void 0===e){const i=Ot.e.get().getCanvasRenderingContext2D().prototype;e=t._experimentalLetterSpacingSupported="letterSpacing"in i||"textLetterSpacing"in i}return e}constructor(t,e,i,n,r,s,o,a,l,h){this.text=t,this.style=e,this.width=i,this.height=n,this.lines=r,this.lineWidths=s,this.lineHeight=o,this.maxLineWidth=a,this.fontProperties=l,h&&(this.runsByLine=h.runsByLine,this.lineAscents=h.lineAscents,this.lineDescents=h.lineDescents,this.lineHeights=h.lineHeights,this.hasDropShadow=h.hasDropShadow)}static measureText(e=" ",i,n=t._canvas,r=i.wordWrap){const s=`${e}-${i.styleKey}-wordWrap-${r}`;if(t._measurementCache.has(s))return t._measurementCache.get(s);if(he(i)&&ce(e)){const n=ke(e,i,r,t._context,t._measureText,t.measureFont,t.canBreakChars,t.wordWrapSplit),o=new t(e,i,n.width,n.height,n.lines,n.lineWidths,n.lineHeight,n.maxLineWidth,n.fontProperties,{runsByLine:n.runsByLine,lineAscents:n.lineAscents,lineDescents:n.lineDescents,lineHeights:n.lineHeights,hasDropShadow:n.hasDropShadow});return t._measurementCache.set(s,o),o}const o=i._fontString,a=t.measureFont(o);0===a.fontSize&&(a.fontSize=i.fontSize,a.ascent=i.fontSize,a.descent=0);const l=t._context;l.font=o;const h=(r?t._wordWrap(e,i,n):e).split(ye),c=new Array(h.length);let u=0;for(let e=0;e<h.length;e++){const n=t._measureText(h[e],i.letterSpacing,l);c[e]=n,u=Math.max(u,n)}const d=i._stroke?.width??0,p=i.lineHeight||a.fontSize,f=t._getAlignWidth(u,i,r),m=t._adjustWidthForStyle(f,i),y=Math.max(p,a.fontSize+d)+(h.length-1)*(p+i.leading),g=t._adjustHeightForStyle(y,i),v=new t(e,i,m,g,h,c,p+i.leading,u,a);return t._measurementCache.set(s,v),v}static _adjustWidthForStyle(t,e){let i=t+(e._stroke?.width||0);return e.dropShadow&&(i+=e.dropShadow.distance),i}static _adjustHeightForStyle(t,e){let i=t;return e.dropShadow&&(i+=e.dropShadow.distance),i}static _getAlignWidth(t,e,i){return i&&"left"!==e.align?Math.max(t,e.wordWrapWidth):t}static _measureText(e,i,n){let r=!1;t.experimentalLetterSpacingSupported&&(t.experimentalLetterSpacing?(n.letterSpacing=`${i}px`,n.textLetterSpacing=`${i}px`,r=!0):(n.letterSpacing="0px",n.textLetterSpacing="0px"));const s=n.measureText(e);let o=s.width;const a=-(s.actualBoundingBoxLeft??0);let l=(s.actualBoundingBoxRight??0)-a;if(o>0)if(r)o-=i,l-=i;else{const n=(t.graphemeSegmenter(e).length-1)*i;o+=n,l+=n}return Math.max(o,l)}static _wordWrap(e,i,n=t._canvas){return function(t,e,i,n,r,s,o){const a=i.getContext("2d",Te);a.font=e._fontString;let l=0,h="";const c=[],u=Object.create(null),{letterSpacing:d,whiteSpace:p}=e,f=xe(p),m=_e(p);let y=!f;const g=e.wordWrapWidth+d,v=Se(t);for(let t=0;t<v.length;t++){let i=v[t];if(ge(i)){if(!m){c.push(we(h)),y=!f,h="",l=0;continue}i=" "}if(f){const t=ve(i),e=ve(h[h.length-1]);if(t&&e)continue}const p=Me(i,d,u,a,n);if(p>g)if(""!==h&&(c.push(we(h)),h="",l=0),r(i,e.breakWords)){const t=Ce(i,e.breakWords,o,s);for(const e of t){const t=Me(e,d,u,a,n);t+l>g&&(c.push(we(h)),y=!1,h="",l=0),h+=e,l+=t}}else h.length>0&&(c.push(we(h)),h="",l=0),c.push(we(i)),y=!1,h="",l=0;else p+l>g&&(y=!1,c.push(we(h)),h="",l=0),(h.length>0||!ve(i)||y)&&(h+=i,l+=p)}const b=we(h);return b.length>0&&c.push(b),c.join("\n")}(e,i,n,t._measureText,t.canBreakWords,t.canBreakChars,t.wordWrapSplit)}static isBreakingSpace(t,e){return ve(t)}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,n,r){return!0}static wordWrapSplit(e){return t.graphemeSegmenter(e)}static measureFont(e){if(t._fonts[e])return t._fonts[e];const i=t._context;i.font=e;const n=i.measureText(t.METRICS_STRING+t.BASELINE_SYMBOL),r=n.actualBoundingBoxAscent??0,s=n.actualBoundingBoxDescent??0,o={ascent:r,descent:s,fontSize:r+s};return t._fonts[e]=o,o}static clearMetrics(e=""){e?delete t._fonts[e]:t._fonts={}}static get _canvas(){if(!t.__canvas){let e;try{const i=new OffscreenCanvas(0,0),n=i.getContext("2d",Pe);if(n?.measureText)return t.__canvas=i,i;e=Ot.e.get().createCanvas()}catch(t){e=Ot.e.get().createCanvas()}e.width=e.height=10,t.__canvas=e}return t.__canvas}static get _context(){return t.__context||(t.__context=t._canvas.getContext("2d",Pe)),t.__context}};Oe.METRICS_STRING="|ÉqÅ",Oe.BASELINE_SYMBOL="M",Oe.BASELINE_MULTIPLIER=1.4,Oe.HEIGHT_MULTIPLIER=2,Oe.graphemeSegmenter=(()=>{if("function"==typeof Intl?.Segmenter){const t=new Intl.Segmenter;return e=>{const i=t.segment(e),n=[];let r=0;for(const t of i)n[r++]=t.segment;return n}}return t=>[...t]})(),Oe.experimentalLetterSpacing=!1,Oe._fonts={},Oe._measurementCache=function(t=1e3,e=0,i=!1){if(isNaN(t)||t<0)throw new TypeError("Invalid max value");if(isNaN(e)||e<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof i)throw new TypeError("Invalid resetTtl value");return new le(t,e,i)}(1e3);let Ie=Oe;const Le=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function Re(t){const e="number"==typeof t.fontSize?`${t.fontSize}px`:t.fontSize;let i=t.fontFamily;Array.isArray(t.fontFamily)||(i=t.fontFamily.split(","));for(let t=i.length-1;t>=0;t--){let e=i[t].trim();/([\"\'])[^\'\"]+\1/.test(e)||Le.includes(e)||(e=`"${e}"`),i[t]=e}return`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${e} ${i.join(",")}`}var je=r(9313),De=r(5589),Ne=r(268),Fe=r(7276),Be=r(2806);const Ge=1e5;function ze(t,e,i,n=0,r=0,s=0){if(t.texture===De.g.WHITE&&!t.fill)return te.Q.shared.setValue(t.color).setAlpha(t.alpha??1).toHexa();if(!t.fill){const i=e.createPattern(t.texture.source.resource,"repeat"),n=t.matrix.copyTo(je.u.shared);return n.scale(t.texture.source.pixelWidth,t.texture.source.pixelHeight),i.setTransform(n),i}if(t.fill instanceof Be.m){const i=t.fill,n=e.createPattern(i.texture.source.resource,"repeat"),r=i.transform.copyTo(je.u.shared);return r.scale(i.texture.source.pixelWidth,i.texture.source.pixelHeight),n.setTransform(r),n}if(t.fill instanceof Fe._){const o=t.fill,a="linear"===o.type,l="local"===o.textureSpace;let h,c=1,u=1;l&&i&&(c=i.width+n,u=i.height+n);let d=!1;if(a){const{start:t,end:i}=o;h=e.createLinearGradient(t.x*c+r,t.y*u+s,i.x*c+r,i.y*u+s),d=Math.abs(i.x-t.x)<Math.abs(.1*(i.y-t.y))}else{const{center:t,innerRadius:i,outerCenter:n,outerRadius:a}=o;h=e.createRadialGradient(t.x*c+r,t.y*u+s,i*c,n.x*c+r,n.y*u+s,a*c)}if(d&&l&&i){const t=i.lineHeight/u;for(let e=0;e<i.lines.length;e++){const r=(e*i.lineHeight+n/2)/u;o.colorStops.forEach((e=>{let i=r+e.offset*t;i=Math.max(0,Math.min(1,i)),h.addColorStop(Math.floor(i*Ge)/Ge,te.Q.shared.setValue(e.color).toHex())}))}}else o.colorStops.forEach((t=>{h.addColorStop(t.offset,te.Q.shared.setValue(t.color).toHex())}));return h}return(0,Ne.R)("FillStyle not recognised",t),"red"}const Ue=new Yt.M;function We(t){let e=0;for(let i=0;i<t.length;i++)32===t.charCodeAt(i)&&e++;return e}const He=new class{getCanvasAndContext(t){const{text:e,style:i,resolution:n=1}=t,r=i._getFinalPadding(),s=Ie.measureText(e||" ",i),o=Math.ceil(Math.ceil(Math.max(1,s.width)+2*r)*n),a=Math.ceil(Math.ceil(Math.max(1,s.height)+2*r)*n),l=ee.N.getOptimalCanvasAndContext(o,a);this._renderTextToCanvas(i,r,n,l,s);return{canvasAndContext:l,frame:i.trim?ae({canvas:l.canvas,width:o,height:a,resolution:1,output:Ue}):Ue.set(0,0,o,a)}}returnCanvasAndContext(t){ee.N.returnCanvasAndContext(t)}_renderTextToCanvas(t,e,i,n,r){if(r.runsByLine&&r.runsByLine.length>0)return void this._renderTaggedTextToCanvas(r,t,e,i,n);const{canvas:s,context:o}=n,a=Re(t),l=r.lines,h=r.lineHeight,c=r.lineWidths,u=r.maxLineWidth,d=r.fontProperties,p=s.height;if(o.resetTransform(),o.scale(i,i),o.textBaseline=t.textBaseline,t._stroke?.width){const e=t._stroke;o.lineWidth=e.width,o.miterLimit=e.miterLimit,o.lineJoin=e.join,o.lineCap=e.cap}let f,m;o.font=a;const y=t.dropShadow?2:1,g=t.wordWrap?Math.max(t.wordWrapWidth,u):u,v=(t._stroke?.width??0)/2;let b=(h-d.fontSize)/2;h-d.fontSize<0&&(b=0);for(let s=0;s<y;++s){const a=t.dropShadow&&0===s,u=a?Math.ceil(Math.max(1,p)+2*e):0,y=u*i;if(a)this._setupDropShadow(o,t,i,y);else{const i=t._gradientBounds,n=t._gradientOffset;if(i){const s={width:i.width,height:i.height,lineHeight:i.height,lines:r.lines};this._setFillAndStrokeStyles(o,t,s,e,v,n?.x??0,n?.y??0)}else n?this._setFillAndStrokeStyles(o,t,r,e,v,n.x,n.y):this._setFillAndStrokeStyles(o,t,r,e,v);o.shadowColor="rgba(0,0,0,0)"}for(let i=0;i<l.length;i++){f=v,m=v+i*h+d.ascent+b,f+=this._getAlignmentOffset(c[i],g,t.align);let r=0;if("justify"===t.align&&t.wordWrap&&i<l.length-1){const t=We(l[i]);t>0&&(r=(g-c[i])/t)}t._stroke?.width&&this._drawLetterSpacing(l[i],t,n,f+e,m+e-u,!0,r),void 0!==t._fill&&this._drawLetterSpacing(l[i],t,n,f+e,m+e-u,!1,r)}}}_renderTaggedTextToCanvas(t,e,i,n,r){const{canvas:s,context:o}=r,{runsByLine:a,lineWidths:l,maxLineWidth:h,lineAscents:c,lineHeights:u,hasDropShadow:d}=t,p=s.height;o.resetTransform(),o.scale(n,n),o.textBaseline=e.textBaseline;const f=d?2:1,m=e.wordWrap?Math.max(e.wordWrapWidth,h):h;let y=e._stroke?.width??0;for(const t of a)for(const e of t){const t=e.style._stroke?.width??0;t>y&&(y=t)}const g=y/2,v=[];for(let t=0;t<a.length;t++){const e=a[t],i=[];for(const t of e){const e=Re(t.style);o.font=e,i.push({width:Ie._measureText(t.text,t.style.letterSpacing,o),font:e})}v.push(i)}for(let t=0;t<f;++t){const s=d&&0===t,h=s?Math.ceil(Math.max(1,p)+2*i):0,f=h*n;s||(o.shadowColor="rgba(0,0,0,0)");let y=g;for(let t=0;t<a.length;t++){const d=a[t],p=l[t],b=c[t],x=u[t],_=v[t];let w=g;w+=this._getAlignmentOffset(p,m,e.align);let S=0;if("justify"===e.align&&e.wordWrap&&t<a.length-1){let t=0;for(const e of d)t+=We(e.text);t>0&&(S=(m-p)/t)}const C=y+b;let E=w+i;for(let t=0;t<d.length;t++){const e=d[t],{width:a,font:l}=_[t];if(o.font=l,o.textBaseline=e.style.textBaseline,e.style._stroke?.width){const t=e.style._stroke;if(o.lineWidth=t.width,o.miterLimit=t.miterLimit,o.lineJoin=t.join,o.lineCap=t.cap,s){if(!e.style.dropShadow){E+=a+We(e.text)*S;continue}this._setupDropShadow(o,e.style,n,f)}else{const n=Ie.measureFont(l),r=e.style.lineHeight||n.fontSize,s={width:a,height:r,lineHeight:r,lines:[e.text]};o.strokeStyle=ze(t,o,s,2*i,E-i,y)}this._drawLetterSpacing(e.text,e.style,r,E,C+i-h,!0,S)}E+=a+We(e.text)*S}E=w+i;for(let t=0;t<d.length;t++){const e=d[t],{width:a,font:l}=_[t];if(o.font=l,o.textBaseline=e.style.textBaseline,void 0!==e.style._fill){if(s){if(!e.style.dropShadow){E+=a+We(e.text)*S;continue}this._setupDropShadow(o,e.style,n,f)}else{const t=Ie.measureFont(l),n=e.style.lineHeight||t.fontSize,r={width:a,height:n,lineHeight:n,lines:[e.text]};o.fillStyle=ze(e.style._fill,o,r,2*i,E-i,y)}this._drawLetterSpacing(e.text,e.style,r,E,C+i-h,!1,S)}E+=a+We(e.text)*S}y+=x}}}_setFillAndStrokeStyles(t,e,i,n,r,s=0,o=0){if(t.fillStyle=e._fill?ze(e._fill,t,i,2*n,s,o):null,e._stroke?.width){const a=r+2*n;t.strokeStyle=ze(e._stroke,t,i,a,s,o)}}_setupDropShadow(t,e,i,n){t.fillStyle="black",t.strokeStyle="black";const r=e.dropShadow,s=r.color,o=r.alpha;t.shadowColor=te.Q.shared.setValue(s).setAlpha(o).toRgbaString();const a=r.blur*i,l=r.distance*i;t.shadowBlur=a,t.shadowOffsetX=Math.cos(r.angle)*l,t.shadowOffsetY=Math.sin(r.angle)*l+n}_getAlignmentOffset(t,e,i){return"right"===i?e-t:"center"===i?(e-t)/2:0}_drawLetterSpacing(t,e,i,n,r,s=!1,o=0){const{context:a}=i,l=e.letterSpacing;let h=!1;if(Ie.experimentalLetterSpacingSupported&&(Ie.experimentalLetterSpacing?(a.letterSpacing=`${l}px`,a.textLetterSpacing=`${l}px`,h=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),(0===l||h)&&0===o)return void(s?a.strokeText(t,n,r):a.fillText(t,n,r));if(0!==o&&(0===l||h)){const e=t.split(" ");let i=n;const l=a.measureText(" ").width;for(let t=0;t<e.length;t++)s?a.strokeText(e[t],i,r):a.fillText(e[t],i,r),i+=a.measureText(e[t]).width+l+o;return}let c=n;const u=Ie.graphemeSegmenter(t);let d=a.measureText(t).width,p=0;for(let t=0;t<u.length;++t){const e=u[t];s?a.strokeText(e,c,r):a.fillText(e,c,r);let i="";for(let e=t+1;e<u.length;++e)i+=u[e];p=a.measureText(i).width,c+=d-p+l," "===e&&(c+=o),d=p}}};var Ve=r(8875),Xe=r(133),Ye=r(8393),$e=r(990);const qe=class t extends Ve.A{constructor(e={}){super(),this.uid=(0,Xe.L)("textStyle"),this._tick=0,this._cachedFontString=null,function(t){const e=t;if("boolean"==typeof e.dropShadow&&e.dropShadow){const i=Ke.defaultDropShadow;t.dropShadow={alpha:e.dropShadowAlpha??i.alpha,angle:e.dropShadowAngle??i.angle,blur:e.dropShadowBlur??i.blur,color:e.dropShadowColor??i.color,distance:e.dropShadowDistance??i.distance}}if(void 0!==e.strokeThickness){(0,Bt.t6)(Bt.lj,"strokeThickness is now a part of stroke");const i=e.stroke;let n={};if(te.Q.isColorLike(i))n.color=i;else if(i instanceof Fe._||i instanceof Be.m)n.fill=i;else{if(!Object.hasOwnProperty.call(i,"color")&&!Object.hasOwnProperty.call(i,"fill"))throw new Error("Invalid stroke value.");n=i}t.stroke={...n,width:e.strokeThickness}}if(Array.isArray(e.fillGradientStops)){if((0,Bt.t6)(Bt.lj,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(e.fill)||0===e.fill.length)throw new Error("Invalid fill value. Expected an array of colors for gradient fill.");e.fill.length!==e.fillGradientStops.length&&(0,Ne.R)("The number of fill colors must match the number of fill gradient stops.");const i=new Fe._({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),n=e.fillGradientStops.slice(),r=e.fill.map((t=>te.Q.shared.setValue(t).toNumber()));n.forEach(((t,e)=>{i.addColorStop(t,r[e])})),t.fill={fill:i}}}(e);e instanceof t&&(e=e._toObject());const i={...t.defaultTextStyle,...e};for(const t in i){this[t]=i[t]}this._tagStyles=e.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.update())}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(e){this._dropShadow!==e&&(this._dropShadow=null!==e&&"object"==typeof e?this._createProxy({...t.defaultDropShadow,...e}):e?this._createProxy({...t.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.update())}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize="string"==typeof t?parseInt(t,10):t,this.update())}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.update())}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.update())}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.update())}get filters(){return this._filters}set filters(t){this._filters!==t&&(this._filters=Object.freeze(t),this.update())}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.update())}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...Ye.T.defaultFillStyle,...t},(()=>{this._fill=(0,$e.w)({...this._originalFill},Ye.T.defaultFillStyle)}))),this._fill=(0,$e.w)(0===t?"black":t,Ye.T.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Ye.T.defaultStrokeStyle,...t},(()=>{this._stroke=(0,$e.T)({...this._originalStroke},Ye.T.defaultStrokeStyle)}))),this._stroke=(0,$e.T)(t,Ye.T.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(t){this._tagStyles!==t&&(this._tagStyles=t??void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){const e=t.defaultTextStyle;for(const t in e)this[t]=e[t]}assign(t){for(const e in t){this[e]=t[e]}return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return null===this._cachedFontString&&(this._cachedFontString=Re(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new t(this._toObject())}_getFinalPadding(){let t=0;if(this._filters)for(let e=0;e<this._filters.length;e++)t+=this._filters[e].padding;return Math.max(this._padding,t)}destroy(t=!1){this.removeAllListeners();if("boolean"==typeof t?t:t?.texture){const e="boolean"==typeof t?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(e),this._originalFill?.texture&&this._originalFill.texture.destroy(e),this._stroke?.texture&&this._stroke.texture.destroy(e),this._originalStroke?.texture&&this._originalStroke.texture.destroy(e)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(t,i,n)=>(t[i]===n||(t[i]=n,e?.(i,n),this.update()),!0)})}_isFillStyle(t){return null!==(t??null)&&!(te.Q.isColorLike(t)||t instanceof Fe._||t instanceof Be.m)}};qe.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},qe.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Ke=qe;var Ze=r(4334),Je=r(2048);var Qe=r(8422);class ti extends Qe.K{}class ei{constructor(t){this._renderer=t,t.runners.resolutionChange.add(this),this._managedTexts=new Ze.s({renderer:t,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(const t in this._managedTexts.items){const e=this._managedTexts.items[t];e?._autoResolution&&e.onViewUpdate()}}validateRenderable(t){const e=this._getGpuText(t),i=t.styleKey;return e.currentKey!==i||t._didTextUpdate}addRenderable(t,e){const i=this._getGpuText(t);if(t._didTextUpdate){const e=t._autoResolution?this._renderer.resolution:t.resolution;i.currentKey===t.styleKey&&t._resolution===e||this._updateGpuText(t),t._didTextUpdate=!1,function(t,e){const{texture:i,bounds:n}=t,r=e._style._getFinalPadding();(0,Je.y)(n,e._anchor,i);const s=e._anchor._x*r*2,o=e._anchor._y*r*2;n.minX-=r-s,n.minY-=r-o,n.maxX-=r-s,n.maxY-=r-o}(i,t)}this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._getGpuText(t);e._batcher.updateElement(e)}_updateGpuText(t){const e=this._getGpuText(t);e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t.styleKey}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){const e=new ti;return e.currentKey="--",e.renderable=t,e.transform=t.groupTransform,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,this._managedTexts.add(t),e}onTextUnload(t){const e=t._gpuData[this._renderer.uid];if(!e)return;const{canvasText:i}=this._renderer;i.getReferenceCount(e.currentKey)>0?i.decreaseReferenceCount(e.currentKey):e.texture&&i.returnTexture(e.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}ei.extension={type:[Tt.Ag.WebGLPipes,Tt.Ag.WebGPUPipes,Tt.Ag.CanvasPipes],name:"text"};var ii=r(2437);const ni=new(r(9636).c);class ri{constructor(t,e){this._activeTextures={},this._renderer=t,this._retainCanvasContext=e}getTexture(t,e,i,n){"string"==typeof t&&((0,Bt.t6)("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof Ke||(t.style=new Ke(t.style)),t.textureStyle instanceof Kt.n||(t.textureStyle=new Kt.n(t.textureStyle)),"string"!=typeof t.text&&(t.text=t.text.toString());const{text:r,style:s,textureStyle:o,autoGenerateMipmaps:a}=t,l=t.resolution??this._renderer.resolution,{frame:h,canvasAndContext:c}=He.getCanvasAndContext({text:r,style:s,resolution:l}),u=function(t,e,i,n,r=!1){const s=ni;s.minX=0,s.minY=0,s.maxX=t.width/n|0,s.maxY=t.height/n|0;const o=ii.W.getOptimalTexture(s.width,s.height,n,!1,r);return o.source.uploadMethodId="image",o.source.resource=t,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=e/n,o.frame.height=i/n,o.source.emit("update",o.source),o.updateUvs(),o}(c.canvas,h.width,h.height,l,a);if(o&&(u.source.style=o),s.trim&&(h.pad(s.padding),u.frame.copyFrom(h),u.frame.scale(1/l),u.updateUvs()),s.filters){const t=this._applyFilters(u,s.filters);return this.returnTexture(u),He.returnCanvasAndContext(c),t}return this._renderer.texture.initSource(u._source),this._retainCanvasContext||He.returnCanvasAndContext(c),u}returnTexture(t){const e=t.source,i=e.resource;if(this._retainCanvasContext&&i?.getContext){const t=i.getContext("2d");t&&He.returnCanvasAndContext({canvas:i,context:t})}e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",ii.W.returnTexture(t,!0)}renderTextToCanvas(){(0,Bt.t6)("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;const e=t.styleKey;if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;const i=this.getTexture({text:t.text,style:t.style,resolution:t._resolution,textureStyle:t.textureStyle,autoGenerateMipmaps:t.autoGenerateMipmaps});return this._activeTextures[e]={texture:i,usageCount:1},i}decreaseReferenceCount(t){const e=this._activeTextures[t];e&&(e.usageCount--,0===e.usageCount&&(this.returnTexture(e.texture),this._activeTextures[t]=null))}getReferenceCount(t){return this._activeTextures[t]?.usageCount??0}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}_applyFilters(t,e){const i=this._renderer.renderTarget.renderTarget,n=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(i,!1),n}destroy(){this._renderer=null;for(const t in this._activeTextures)this._activeTextures[t]&&this.returnTexture(this._activeTextures[t].texture);this._activeTextures=null}}class si extends ri{constructor(t){super(t,!0)}}si.extension={type:[Tt.Ag.CanvasSystem],name:"canvasText"};class oi extends ri{constructor(t){super(t,!1)}}oi.extension={type:[Tt.Ag.WebGLSystem,Tt.Ag.WebGPUSystem],name:"canvasText"},Tt.XO.add(si),Tt.XO.add(oi),Tt.XO.add(ei);class ai extends Qt{constructor(...t){const e=function(t,e){let i=t[0]??{};return("string"==typeof i||t[1])&&((0,Bt.t6)(Bt.lj,`use new ${e}({ text: "hi!", style }) instead`),i={text:i,style:t[1]}),i}(t,"Text");super(e,Ke),this.renderPipeId="text",e.textureStyle&&(this.textureStyle=e.textureStyle instanceof Kt.n?e.textureStyle:new Kt.n(e.textureStyle)),this.autoGenerateMipmaps=e.autoGenerateMipmaps??qt.v.defaultOptions.autoGenerateMipmaps}updateBounds(){const t=this._bounds,e=this._anchor;let i=0,n=0;if(this._style.trim){const{frame:t,canvasAndContext:e}=He.getCanvasAndContext({text:this.text,style:this._style,resolution:1});He.returnCanvasAndContext(e),i=t.width,n=t.height}else{const t=Ie.measureText(this._text,this._style);i=t.width,n=t.height}t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*n,t.maxY=t.minY+n}}function li(t){return li="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},li(t)}function hi(t){return function(t){if(Array.isArray(t))return di(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ui(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ci(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||ui(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ui(t,e){if(t){if("string"==typeof t)return di(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?di(t,e):void 0}}function di(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function pi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fi(n.key),n)}}function fi(t){var e=function(t,e){if("object"!=li(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=li(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==li(e)?e:e+""}Tt.XO.add(Mt,Pt);var mi=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.map=new Map},e=[{key:"get",value:function(t){return this.map.get(t)}},{key:"set",value:function(t,e){this.map.set(t,e)}},{key:"has",value:function(t){return this.map.has(t)}},{key:"delete",value:function(t){var e,i=this.map.get(t);null!=i&&i.parent&&i.parent.removeChild(i),null==i||null===(e=i.destroy)||void 0===e||e.call(i),this.map.delete(t)}},{key:"clearDead",value:function(t){var e,i=function(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=ui(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}(this.map);try{for(i.s();!(e=i.n()).done;){var n=ci(e.value,1)[0],r=n.split("_")[0];t.has(r)||this.delete(n)}}catch(t){i.e(t)}finally{i.f()}}},{key:"forEach",value:function(t){this.map.forEach(t)}},{key:"deleteNode",value:function(t){for(var e=0,i=hi(this.map.keys());e<i.length;e++){var n=i[e];(n===t||n.startsWith(t+"_"))&&this.delete(n)}}}],e&&pi(t.prototype,e),i&&pi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function yi(t){return yi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yi(t)}function gi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,vi(n.key),n)}}function vi(t){var e=function(t,e){if("object"!=yi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=yi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==yi(e)?e:e+""}var bi=function(){return t=function t(e,i,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.registry=i,this.selection=n,this.interaction=s,this.labelRenderer=o,this.colorResolver="function"==typeof r?r:function(){return 16777215},this.formulaHitPadding=12},(e=[{key:"render",value:function(t){var e;this.ensure(t),this.ensureHalo(t),this.update(t),this.updateHalo(t),null===(e=this.labelRenderer)||void 0===e||e.render(t)}},{key:"ensure",value:function(t){var e=this.registry.get(t.id);return e||((e=new $t.A).eventMode="static",e.cursor="pointer",e.nodeRef=t,this.drawShape(e,t),this.world.addChild(e),this.interaction.bindNode(e,t),this.registry.set(t.id,e),e)}},{key:"ensureHalo",value:function(t){var e="".concat(t.id,"_halo"),i=this.registry.get(e);return i||((i=new $t.A).eventMode="none",i.visible=!1,i.nodeRef=t,this.world.addChildAt(i,0),this.registry.set(e,i),i)}},{key:"update",value:function(t){var e=this.registry.get(t.id);if(e){this.drawShape(e,t),e.x=t.x,e.y=t.y;var i=this.colorResolver(t);e.tint=null!=i?i:16777215,e.visible=!1!==t.visible}}},{key:"updateHalo",value:function(t){var e=this.registry.get("".concat(t.id,"_halo"));if(e){e.clear();var i=this.selection.has(t);if(e.visible=i,i){if("formula"===t.type){var n=this.getFormulaWidth(t),r=this.getFormulaHeight();e.roundRect(-n/2-6,-r/2-6,n+12,r+12,8).stroke({width:2,color:16777215,alpha:.9})}else{var s=this.getRadius(t)+6;e.circle(0,0,s).stroke({width:3,color:16777215,alpha:.9})}e.x=t.x,e.y=t.y}}}},{key:"drawShape",value:function(t,e){t.clear();var i="planet"===e.type?16763904:"formula"===e.type?1973790:16777215;if("formula"===e.type){var n=this.getFormulaWidth(e),r=this.getFormulaHeight(),s=this.formulaHitPadding;return t.roundRect(-n/2,-r/2,n,r,6).fill(i).stroke({color:16777215,width:1,alpha:.3}),void(t.hitArea=new Yt.M(-n/2-s,-r/2-s,n+2*s,r+2*s))}var o=this.getRadius(e);t.circle(0,0,o).fill(i),t.hitArea=new Xt.j(0,0,o+4)}},{key:"getFormulaWidth",value:function(t){var e=t.label||"";return Math.max(120,8*e.length+24)}},{key:"getFormulaHeight",value:function(){return 40}},{key:"getRadius",value:function(t){switch(t.type){case"planet":return 40;case"formula":return 20;default:return 6}}},{key:"updateSelection",value:function(t){this.selection=t}}])&&gi(t.prototype,e),i&&gi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function xi(t){return xi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xi(t)}function _i(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return wi(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?wi(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function wi(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Si(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ci(n.key),n)}}function Ci(t){var e=function(t,e){if("object"!=xi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=xi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==xi(e)?e:e+""}var Ei=function(){return t=function t(e,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.registry=i},(e=[{key:"render",value:function(t){var e;if("planet"===t.type){var i=t.id+"_orbits",n=this.registry.get(i);n||((n=new $t.A).eventMode="none",this.world.addChildAt(n,0),this.registry.set(i,n)),n.clear();var r,s=_i(null!==(e=t._orbits)&&void 0!==e?e:[]);try{for(s.s();!(r=s.n()).done;){var o=r.value;n.circle(0,0,o.radius).stroke({width:1,color:16777215,alpha:.2})}}catch(t){s.e(t)}finally{s.f()}n.x=t.x,n.y=t.y}}}])&&Si(t.prototype,e),i&&Si(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function ki(t){return ki="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ki(t)}function Ai(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ti(n.key),n)}}function Ti(t){var e=function(t,e){if("object"!=ki(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=ki(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ki(e)?e:e+""}var Mi=function(){return t=function t(e,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.uiLayer=e,this.registry=i},(e=[{key:"render",value:function(t){var e,i,n,r,s="".concat(t.id,"_axis"),o=this.registry.get(s);o||((o=new $t.A).nodeRef=t,o.eventMode="static",o.cursor="pointer",this.uiLayer.addChild(o),this.registry.set(s,o)),o.clear();var a=0===(null===(e=t.direction)||void 0===e?void 0:e.x)&&1===(null===(i=t.direction)||void 0===i?void 0:i.y),l=1===(null===(n=t.direction)||void 0===n?void 0:n.x)&&0===(null===(r=t.direction)||void 0===r?void 0:r.y);a?this.renderYAxis(o):l?this.renderXAxis(o):this.renderArrowVector(o,t)}},{key:"renderXAxis",value:function(t){var e,i,n=(null===(e=this.uiLayer.parent.renderer)||void 0===e?void 0:e.width)||800,r=(null===(i=this.uiLayer.parent.renderer)||void 0===i?void 0:i.height)||600,s=n-40;t.rect(0,0,s,2).fill(16777215),t.moveTo(s-10,-6).lineTo(s,1).lineTo(s-10,8).fill(16777215),t.x=20,t.y=r-20}},{key:"renderYAxis",value:function(t){var e,i=(null===(e=this.uiLayer.parent.renderer)||void 0===e?void 0:e.height)||600,n=i-40;t.rect(0,-n,2,n).fill(16777215),t.moveTo(-6,10-n).lineTo(1,-n).lineTo(8,10-n).fill(16777215),t.x=20,t.y=i-20}},{key:"renderArrowVector",value:function(t,e){var i=e.direction.x*e.length,n=e.direction.y*e.length,r=Math.sqrt(i*i+n*n),s=Math.atan2(n,i);t.rect(0,-1,r,2).fill(16755200),t.moveTo(r,0).lineTo(r-10,-5).lineTo(r-10,5).fill(16755200),t.x=e.x,t.y=e.y,t.rotation=s}}])&&Ai(t.prototype,e),i&&Ai(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Pi(t){return Pi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pi(t)}function Oi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ii(n.key),n)}}function Ii(t){var e=function(t,e){if("object"!=Pi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Pi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Pi(e)?e:e+""}var Li=function(){return t=function t(e,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.registry=i},(e=[{key:"render",value:function(t){if("planet"===t.type||"formula"===t.type){var e="".concat(t.id,"_label"),i=this.registry.get(e);if(i||((i=new ai({text:"",style:{fill:16777215,fontSize:"formula"===t.type?14:12,align:"center"}})).anchor.set(.5),this.world.addChild(i),this.registry.set(e,i)),"formula"===t.type){var n=t.label||t.id,r=Number(t.value||0).toLocaleString();i.text="".concat(n,": ").concat(r)}else i.text=t.label||t.id;i.x=t.x,i.y=t.y}}}])&&Oi(t.prototype,e),i&&Oi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Ri(t){return Ri="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ri(t)}function ji(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return Di(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Di(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){a=!0,s=t},f:function(){try{o||null==i.return||i.return()}finally{if(a)throw s}}}}function Di(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Ni(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Fi(n.key),n)}}function Fi(t){var e=function(t,e){if("object"!=Ri(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Ri(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ri(e)?e:e+""}var Bi=function(){return t=function t(e){var i=e.world,n=e.uiLayer,r=e.registry,s=e.selection,o=e.interaction,a=e.colorResolver;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var l=new Li(i,r);this.nodeRenderer=new bi(i,r,s,a,o,l),this.orbitRenderer=new Ei(i,r),this.vectorRenderer=new Mi(n,r),this.liveNodeIds=new Set,this.registry=r},(e=[{key:"render",value:function(t){var e,i=ji(t.getNodes());try{for(i.s();!(e=i.n()).done;){var n=e.value;"vector"!==n.type?(this.nodeRenderer.render(n),"planet"===n.type&&(n.dirty=!0,this.orbitRenderer.render(n))):(n.dirty=!0,this.vectorRenderer.render(n))}}catch(t){i.e(t)}finally{i.f()}}},{key:"updateSelection",value:function(t){this.nodeRenderer.updateSelection(t)}},{key:"remove",value:function(t){var e="string"==typeof t?t:t.id;this.registry.deleteNode(e)}}])&&Ni(t.prototype,e),i&&Ni(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Gi(t){return Gi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gi(t)}function zi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ui(n.key),n)}}function Ui(t){var e=function(t,e){if("object"!=Gi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Gi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Gi(e)?e:e+""}var Wi=function(){return t=function t(e){var i,n,r,s=this,o=e.app,a=e.world,l=e.registry,h=e.selection,c=e.minScale,u=void 0===c?.1:c,d=e.maxScale,p=void 0===d?10:d;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),i=this,r=function(){var t,e,i,n,r=null===(t=s.dragTarget)||void 0===t?void 0:t.nodeRef;s.isRightClick||(s.dragging||!r||s.isBoxSelecting||((null===(e=s.lastPointer)||void 0===e||null===(e=e.originalEvent)||void 0===e?void 0:e.shiftKey)?s.selection.has(r)?s.selection.delete(r):s.selection.add(r):(s.selection.clear(),s.selection.add(r)),null===(i=s.onSelectionChange)||void 0===i||i.call(s,s.selection)),!s.pointerDownOnStage||s.didDrag||s.dragTarget||(s.selection.clear(),null===(n=s.onSelectionChange)||void 0===n||n.call(s,s.selection)),s.finishBoxSelect()),s.resetPointerState()},(n=Ui(n="onPointerUp"))in i?Object.defineProperty(i,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[n]=r,this.app=o,this.world=a,this.registry=l,this.selection=h,this.dragTarget=null,this.startPos=null,this.dragging=!1,this.isRightClick=!1,this.isBoxSelecting=!1,this.boxStart=null,this.box=null,this.lastPointer=null,this.minScale=u,this.maxScale=p,this.isPanning=!1,this.panLast=null,this.pointers=new Map,this.lastDist=null,this.pointerDownOnStage=!1,this.didDrag=!1},e=[{key:"enable",value:function(){this.initBoxGraphics(),this.enablePointerSystem(),this.enableWheelZoom(),this.enablePinchZoom(),this.enableResize(),this.bindNodes()}},{key:"screenToWorld",value:function(t,e){return{x:(t-this.world.x)/this.world.scale.x,y:(e-this.world.y)/this.world.scale.y}}},{key:"initBoxGraphics",value:function(){this.box=new $t.A,this.app.stage.addChild(this.box)}},{key:"enablePointerSystem",value:function(){var t=this,e=this.app.stage;e.eventMode="static",e.hitArea=this.app.screen,e.on("pointerdown",(function(i){var n,r,s=i.target===e;if(t.lastPointer={x:i.global.x,y:i.global.y},s){if(t.pointerDownOnStage=!0,t.didDrag=!1,null===(n=i.originalEvent)||void 0===n?void 0:n.shiftKey)return t.isBoxSelecting=!0,t.boxStart={x:i.global.x,y:i.global.y},t.isPanning=!1,t.panLast=null,void t.box.clear();t.isPanning=!0,t.panLast={x:i.global.x,y:i.global.y},t.isBoxSelecting=!1,null===(r=t.onBackgroundPointerDown)||void 0===r||r.call(t)}})),e.on("pointermove",(function(e){if(t.lastPointer={x:e.global.x,y:e.global.y},t.isBoxSelecting){var i=Math.min(t.boxStart.x,e.global.x),n=Math.min(t.boxStart.y,e.global.y),r=Math.abs(e.global.x-t.boxStart.x),s=Math.abs(e.global.y-t.boxStart.y);return t.box.clear(),t.box.rect(i,n,r,s),t.box.fill({color:43775,alpha:.15}),void t.box.stroke({color:43775,width:1})}if(t.isPanning&&t.panLast&&!t.dragTarget){var o=e.global.x-t.panLast.x,a=e.global.y-t.panLast.y;return t.world.x+=o,t.world.y+=a,t.panLast={x:e.global.x,y:e.global.y},void(t.didDrag=!0)}if(t.dragTarget&&t.startPos){var l=e.global.x-t.startPos.x,h=e.global.y-t.startPos.y;if(Math.sqrt(l*l+h*h)>5&&(t.dragging=!0),t.dragging){var c=t.dragTarget.nodeRef;if(!c)return;var u=t.screenToWorld(e.global.x,e.global.y);c.x=u.x,c.y=u.y,t.didDrag=!0}}})),e.on("rightdown",(function(i){var n;i.target===e&&(t.isRightClick=!0,null===(n=t.onStageRightClick)||void 0===n||n.call(t,{x:i.global.x,y:i.global.y,world:t.screenToWorld(i.global.x,i.global.y),originalEvent:i.originalEvent}))})),e.on("pointerup",this.onPointerUp),e.on("pointerupoutside",this.onPointerUp)}},{key:"resetPointerState",value:function(){this.dragTarget=null,this.startPos=null,this.dragging=!1,this.isPanning=!1,this.panLast=null,this.pointerDownOnStage=!1,this.didDrag=!1,this.isRightClick=!1}},{key:"finishBoxSelect",value:function(){var t,e=this;if(this.isBoxSelecting){var i=this.lastPointer||this.boxStart,n=Math.min(this.boxStart.x,i.x),r=Math.max(this.boxStart.x,i.x),s=Math.min(this.boxStart.y,i.y),o=Math.max(this.boxStart.y,i.y),a=this.screenToWorld(n,s),l=this.screenToWorld(r,o),h=Math.min(a.x,l.x),c=Math.max(a.x,l.x),u=Math.min(a.y,l.y),d=Math.max(a.y,l.y);this.selection.clear(),this.registry.forEach((function(t){var i=t.nodeRef;i&&i.x>=h&&i.x<=c&&i.y>=u&&i.y<=d&&e.selection.add(i)})),this.box.clear(),this.isBoxSelecting=!1,null===(t=this.onSelectionChange)||void 0===t||t.call(this,this.selection)}}},{key:"enableWheelZoom",value:function(){var t=this,e=this.app.canvas;e.addEventListener("wheel",(function(i){i.preventDefault();var n=e.getBoundingClientRect(),r=i.clientX-n.left,s=i.clientY-n.top,o=i.deltaY>0?.9:1.1;t.zoomAt(r,s,o)}),{passive:!1})}},{key:"zoomAt",value:function(t,e,i){var n=this.screenToWorld(t,e);this.world.scale.x*=i,this.world.scale.y*=i,this.world.scale.x=Math.max(this.minScale,Math.min(this.maxScale,this.world.scale.x)),this.world.scale.y=Math.max(this.minScale,Math.min(this.maxScale,this.world.scale.y)),this.world.x=t-n.x*this.world.scale.x,this.world.y=e-n.y*this.world.scale.y}},{key:"enablePinchZoom",value:function(){var t=this;this.app.canvas.addEventListener("pointermove",(function(e){if(t.pointers.has(e.pointerId)&&(t.pointers.set(e.pointerId,e),2===t.pointers.size)){var i=Array.from(t.pointers.values()),n=i[0].clientX-i[1].clientX,r=i[0].clientY-i[1].clientY,s=Math.sqrt(n*n+r*r),o=(i[0].clientX+i[1].clientX)/2,a=(i[0].clientY+i[1].clientY)/2;t.lastDist?(t.zoomAt(o,a,s/t.lastDist),t.lastDist=s):t.lastDist=s}}))}},{key:"enableResize",value:function(){var t=this,e=this.app.canvas.parentElement;this.resizeObserver=new ResizeObserver((function(){var i=e.clientWidth,n=e.clientHeight;t.app.renderer.resize(i,n)})),this.resizeObserver.observe(e)}},{key:"bindNode",value:function(t){var e=this;t.eventMode="static",t.cursor="pointer",t.on("pointerdown",(function(i){i.stopPropagation(),e.dragTarget=t,e.startPos={x:i.global.x,y:i.global.y},e.dragging=!1,e.isBoxSelecting=!1,e.isPanning=!1,e.panLast=null,e.didDrag=!1,t.nodeRef.dirty=!0})),t.on("rightdown",(function(i){var n;i.stopPropagation(),e.isRightClick=!0;var r=t.nodeRef;null===(n=e.onNodeRightClick)||void 0===n||n.call(e,{node:r,global:i.global,ev:i.originalEvent})}))}},{key:"bindNodes",value:function(){var t=this;this.registry.forEach((function(e){t.bindNode(e)}))}}],e&&zi(t.prototype,e),i&&zi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Hi(t){return Hi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hi(t)}function Vi(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Xi(n.key),n)}}function Xi(t){var e=function(t,e){if("object"!=Hi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Hi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Hi(e)?e:e+""}var Yi=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.container=e,this.init()},e=[{key:"init",value:function(){var t=this,e=document.createElement("div");e.className="info-window",Object.assign(e.style,{position:"absolute",top:"0",right:"0",width:"250px",height:"100%",background:"rgba(30, 30, 30, 0.85)",color:"#fff",padding:"12px",boxSizing:"border-box",backdropFilter:"blur(6px)",borderLeft:"1px solid rgba(255,255,255,0.1)",display:"none",zIndex:"999"});var i=document.createElement("div");i.textContent="✕",Object.assign(i.style,{position:"absolute",top:"8px",right:"10px",cursor:"pointer",fontSize:"14px",opacity:"0.7",padding:"2px 6px",borderRadius:"4px",transition:"all 0.15s"}),i.addEventListener("mouseenter",(function(){i.style.background="#444",i.style.opacity="1"})),i.addEventListener("mouseleave",(function(){i.style.background="transparent",i.style.opacity="0.7"})),i.addEventListener("click",(function(){t.hide()})),e.appendChild(i);var n=document.createElement("div");n.style.marginTop="24px",e.appendChild(n),"static"===window.getComputedStyle(this.container).position&&(this.container.style.position="relative"),this.container.appendChild(e),this.panel=e,this.content=n}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.panel.style.display="block",t&&(this.content.innerHTML=t)}},{key:"showWithDrag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return[]};this.show(),this.content.innerHTML="";var i=document.createElement("div");i.textContent="⠿ Drag selection",i.draggable=!0,Object.assign(i.style,{cursor:"grab",padding:"6px 8px",marginBottom:"8px",background:"#3a3a3a",borderRadius:"6px",fontSize:"12px",textAlign:"center"}),i.addEventListener("dragstart",(function(t){var n={type:"graph-nodes",data:e()};console.log("payload",n);var r=JSON.stringify(n);t.dataTransfer.setData("application/json",r),t.dataTransfer.setData("text/plain",r),i.style.opacity="0.5"})),i.addEventListener("dragend",(function(){i.style.opacity="1"}));var n=document.createElement("div");n.innerHTML=t,this.content.appendChild(i),this.content.appendChild(n)}},{key:"hide",value:function(){this.panel.style.display="none"}},{key:"clear",value:function(){this.content.innerHTML=""}},{key:"getElement",value:function(){return this.panel}}],e&&Vi(t.prototype,e),i&&Vi(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function $i(t){return $i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$i(t)}function qi(){qi=function(){return e};var t,e={},i=Object.prototype,n=i.hasOwnProperty,r=Object.defineProperty||function(t,e,i){t[e]=i.value},s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function h(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(t){h=function(t,e,i){return t[e]=i}}function c(t,e,i,n){var s=e&&e.prototype instanceof g?e:g,o=Object.create(s.prototype),a=new P(n||[]);return r(o,"_invoke",{value:k(t,i,a)}),o}function u(t,e,i){try{return{type:"normal",arg:t.call(e,i)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var d="suspendedStart",p="suspendedYield",f="executing",m="completed",y={};function g(){}function v(){}function b(){}var x={};h(x,o,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(O([])));w&&w!==i&&n.call(w,o)&&(x=w);var S=b.prototype=g.prototype=Object.create(x);function C(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function i(r,s,o,a){var l=u(t[r],t,s);if("throw"!==l.type){var h=l.arg,c=h.value;return c&&"object"==$i(c)&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){i("next",t,o,a)}),(function(t){i("throw",t,o,a)})):e.resolve(c).then((function(t){h.value=t,o(h)}),(function(t){return i("throw",t,o,a)}))}a(l.arg)}var s;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return s=s?s.then(r,r):r()}})}function k(e,i,n){var r=d;return function(s,o){if(r===f)throw Error("Generator is already running");if(r===m){if("throw"===s)throw o;return{value:t,done:!0}}for(n.method=s,n.arg=o;;){var a=n.delegate;if(a){var l=A(a,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=f;var h=u(e,i,n);if("normal"===h.type){if(r=n.done?m:p,h.arg===y)continue;return{value:h.arg,done:n.done}}"throw"===h.type&&(r=m,n.method="throw",n.arg=h.arg)}}}function A(e,i){var n=i.method,r=e.iterator[n];if(r===t)return i.delegate=null,"throw"===n&&e.iterator.return&&(i.method="return",i.arg=t,A(e,i),"throw"===i.method)||"return"!==n&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var s=u(r,e.iterator,i.arg);if("throw"===s.type)return i.method="throw",i.arg=s.arg,i.delegate=null,y;var o=s.arg;return o?o.done?(i[e.resultName]=o.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=t),i.delegate=null,y):o:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,y)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function O(e){if(e||""===e){var i=e[o];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,s=function i(){for(;++r<e.length;)if(n.call(e,r))return i.value=e[r],i.done=!1,i;return i.value=t,i.done=!0,i};return s.next=s}}throw new TypeError($i(e)+" is not iterable")}return v.prototype=b,r(S,"constructor",{value:b,configurable:!0}),r(b,"constructor",{value:v,configurable:!0}),v.displayName=h(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,h(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},C(E.prototype),h(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,i,n,r,s){void 0===s&&(s=Promise);var o=new E(c(t,i,n,r),s);return e.isGeneratorFunction(i)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},C(S),h(S,l,"Generator"),h(S,o,(function(){return this})),h(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),i=[];for(var n in e)i.push(n);return i.reverse(),function t(){for(;i.length;){var n=i.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=O,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!e)for(var i in this)"t"===i.charAt(0)&&n.call(this,i)&&!isNaN(+i.slice(1))&&(this[i]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var i=this;function r(n,r){return a.type="throw",a.arg=e,i.next=n,r&&(i.method="next",i.arg=t),!!r}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var l=n.call(o,"catchLoc"),h=n.call(o,"finallyLoc");if(l&&h){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!h)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var s=r;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=t,o.arg=e,s?(this.method="next",this.next=s.finallyLoc,y):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),M(i),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var n=i.completion;if("throw"===n.type){var r=n.arg;M(i)}return r}}throw Error("illegal catch attempt")},delegateYield:function(e,i,n){return this.delegate={iterator:O(e),resultName:i,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function Ki(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function Zi(t){return function(){var e=this,i=arguments;return new Promise((function(n,r){var s=t.apply(e,i);function o(t){Ki(s,n,r,o,a,"next",t)}function a(t){Ki(s,n,r,o,a,"throw",t)}o(void 0)}))}}function Ji(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,tn(n.key),n)}}function Qi(t,e,i){return(e=tn(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function tn(t){var e=function(t,e){if("object"!=$i(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=$i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$i(e)?e:e+""}var en=function(){function t(e){var i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Qi(this,"getSelectedMoons",(function(){return console.log("regresando seleccion"),i.selectedNodes})),Qi(this,"getSelectedNodes",(function(){return Array.from(i.getSelectedMoons()).map((function(t){return t.data}))})),this.container=e,this.selectedNodes=new Set,this.minScale=.1,this.maxScale=10}return e=t,i=[{key:"init",value:(s=Zi(qi().mark((function t(){var e=this;return qi().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.app=new Vt,t.next=3,this.app.init({resizeTo:this.container,background:1973790});case 3:this.container.appendChild(this.app.canvas),this.world=new Nt.mc,this.uiLayer=new Nt.mc,this.app.stage.addChild(this.world),this.app.stage.addChild(this.uiLayer),this.registry=new mi,this.interaction=new Wi({app:this.app,world:this.world,viewport:this.viewport,registry:this.registry,selection:this.selectedNodes}),this.interaction.enable(),this.renderer=new Bi({world:this.world,uiLayer:this.uiLayer,registry:this.registry,selection:this.selectedNodes,interaction:this.interaction,colorResolver:function(t){var i,n,r;return null!==(i=null===(n=e.model)||void 0===n||null===(r=n.getNodeColor)||void 0===r?void 0:r.call(n,t))&&void 0!==i?i:16777215}}),this.infoWindow=new Yi(this.container),this.bindEvents();case 14:case"end":return t.stop()}}),t,this)}))),function(){return s.apply(this,arguments)})},{key:"bindEvents",value:function(){var t=this;this.interaction.onSelectionChange=function(e){var i;t.renderer.updateSelection(e),null===(i=t.onSelectionChange)||void 0===i||i.call(t,e)},this.interaction.onNodeClick=function(e){var i;null===(i=t.onNodeClick)||void 0===i||i.call(t,e)},this.interaction.onNodeRightClick=function(e){var i;null===(i=t.onNodeRightClick)||void 0===i||i.call(t,e)},this.interaction.onBackgroundRightClick=function(e){var i;null===(i=t.onBackgroundRightClick)||void 0===i||i.call(t,e)}}},{key:"render",value:function(t){this.renderer.render(t)}},{key:"renderGraph",value:function(t){this.render(t)}},{key:"center",value:function(t,e){this.viewport.center(t,e)}},{key:"screenToWorld",value:function(t,e){return this.interaction.screenToWorld(t,e)}},{key:"showInfo",value:function(t){this.infoWindow.show(t)}},{key:"showInfoWindow",value:function(t){this.infoWindow.show(t)}},{key:"hideInfo",value:function(){this.infoWindow.hide()}},{key:"toWorld",value:function(t,e){return this.interaction.screenToWorld(t,e)}},{key:"getWorldBounds",value:function(){var t=this.app.canvas,e=this.toWorld(0,0),i=this.toWorld(t.width,t.height);return{minX:e.x,minY:e.y,maxX:i.x,maxY:i.y}}},{key:"_getNodeAtPosition",value:function(t,e){var i=null;return this.registry.forEach((function(n){var r=n.nodeRef;if(r){var s=r.radius||("planet"===r.type?40:10),o=t-r.x,a=e-r.y;o*o+a*a<=s*s&&(i=r)}})),i}},{key:"showInfoWindowWithDrag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.infoWindow.showWithDrag(t,this.getSelectedNodes)}}],n=[{key:"create",value:(r=Zi(qi().mark((function e(i){var n;return qi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new t(i),e.next=3,n.init();case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)}))),function(t){return r.apply(this,arguments)})}],i&&Ji(e.prototype,i),n&&Ji(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,i,n,r,s}();function nn(t){return nn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nn(t)}function rn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,sn(n.key),n)}}function sn(t){var e=function(t,e){if("object"!=nn(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=nn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==nn(e)?e:e+""}var on=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.nodes=new Map,this.edges=[]},(e=[{key:"addNode",value:function(t){this.nodes.set(t.id,{id:t.id,type:t.type||"moon",x:t.x||0,y:t.y||0,vx:0,vy:0,data:t.data||{},rule:t.rule||null})}},{key:"addMoon",value:function(t){var e=t.id,i=t.x,n=t.y,r=t.data;this.nodes.set(e,{id:e,type:"moon",x:i,y:n,vx:0,vy:0,data:r})}},{key:"addPlanet",value:function(t){var e=t.id,i=t.x,n=t.y,r=t.rule,s=t.scalarField,o=t.label;this.nodes.set(e,{id:e,type:"planet",x:i,y:n,vx:0,vy:0,rule:r,scalarField:s,label:o})}},{key:"addFormula",value:function(t){var e=t.id,i=t.x,n=t.y,r=t.scope,s=t.scalarField,o=t.label,a=t.formula;this.nodes.set(e,{id:e,type:"formula",x:i,y:n,vx:0,vy:0,scope:r,scalarField:s,label:o,formula:a})}},{key:"addVector",value:function(t){var e=t.id,i=t.x,n=t.y,r=t.direction,s=t.length,o=t.scalarField,a=t.rule,l=Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))||1,h={x:r.x/l,y:r.y/l};this.nodes.set(e,{id:e,type:"vector",vector:!0,x:i,y:n,direction:h,length:s||200,scalarField:o,rule:a,vx:0,vy:0})}},{key:"removeYVectors",value:function(){var t=this,e=[];this.nodes.forEach((function(t,i){"vector"===t.type&&t.direction&&Math.abs(t.direction.x)<1e-4&&Math.abs(t.direction.y)>1e-4&&e.push(i)})),e.forEach((function(e){return t.deleteNode(e)}))}},{key:"removeXVectors",value:function(){var t=this,e=[];this.nodes.forEach((function(t,i){"vector"===t.type&&t.direction&&Math.abs(t.direction.y)<1e-4&&Math.abs(t.direction.x)>1e-4&&e.push(i)})),e.forEach((function(e){return t.deleteNode(e)}))}},{key:"addEdge",value:function(t,e){this.edges.push({source:t,target:e})}},{key:"getNode",value:function(t){return this.nodes.get(t)}},{key:"getNodes",value:function(){return Array.from(this.nodes.values())}},{key:"deleteNode",value:function(t){this.nodes.delete(t),this.edges=this.edges.filter((function(e){return e.source!==t&&e.target!==t}))}},{key:"addColorRule",value:function(t){this.colorRules||(this.colorRules=[]),this.colorRules.push(t)}},{key:"getNodeColor",value:function(t){if(!this.colorRules||0===this.colorRules.length)return null;for(var e=this.colorRules.length-1;e>=0;e--){var i,n=this.colorRules[e],r=null===(i=t.data)||void 0===i?void 0:i[n.field];if(null!=r){if(void 0!==n.equals&&r===n.equals)return n.color;if(void 0!==n.gt&&Number(r)>n.gt)return n.color;if(void 0!==n.lt&&Number(r)<n.lt)return n.color}}return null}}])&&rn(t.prototype,e),i&&rn(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function an(t){return an="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},an(t)}function ln(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return hn(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?hn(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hn(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function cn(){cn=function(){return e};var t,e={},i=Object.prototype,n=i.hasOwnProperty,r=Object.defineProperty||function(t,e,i){t[e]=i.value},s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function h(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(t){h=function(t,e,i){return t[e]=i}}function c(t,e,i,n){var s=e&&e.prototype instanceof g?e:g,o=Object.create(s.prototype),a=new P(n||[]);return r(o,"_invoke",{value:k(t,i,a)}),o}function u(t,e,i){try{return{type:"normal",arg:t.call(e,i)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var d="suspendedStart",p="suspendedYield",f="executing",m="completed",y={};function g(){}function v(){}function b(){}var x={};h(x,o,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(O([])));w&&w!==i&&n.call(w,o)&&(x=w);var S=b.prototype=g.prototype=Object.create(x);function C(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function i(r,s,o,a){var l=u(t[r],t,s);if("throw"!==l.type){var h=l.arg,c=h.value;return c&&"object"==an(c)&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){i("next",t,o,a)}),(function(t){i("throw",t,o,a)})):e.resolve(c).then((function(t){h.value=t,o(h)}),(function(t){return i("throw",t,o,a)}))}a(l.arg)}var s;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return s=s?s.then(r,r):r()}})}function k(e,i,n){var r=d;return function(s,o){if(r===f)throw Error("Generator is already running");if(r===m){if("throw"===s)throw o;return{value:t,done:!0}}for(n.method=s,n.arg=o;;){var a=n.delegate;if(a){var l=A(a,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=f;var h=u(e,i,n);if("normal"===h.type){if(r=n.done?m:p,h.arg===y)continue;return{value:h.arg,done:n.done}}"throw"===h.type&&(r=m,n.method="throw",n.arg=h.arg)}}}function A(e,i){var n=i.method,r=e.iterator[n];if(r===t)return i.delegate=null,"throw"===n&&e.iterator.return&&(i.method="return",i.arg=t,A(e,i),"throw"===i.method)||"return"!==n&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var s=u(r,e.iterator,i.arg);if("throw"===s.type)return i.method="throw",i.arg=s.arg,i.delegate=null,y;var o=s.arg;return o?o.done?(i[e.resultName]=o.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=t),i.delegate=null,y):o:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,y)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function O(e){if(e||""===e){var i=e[o];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,s=function i(){for(;++r<e.length;)if(n.call(e,r))return i.value=e[r],i.done=!1,i;return i.value=t,i.done=!0,i};return s.next=s}}throw new TypeError(an(e)+" is not iterable")}return v.prototype=b,r(S,"constructor",{value:b,configurable:!0}),r(b,"constructor",{value:v,configurable:!0}),v.displayName=h(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,h(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},C(E.prototype),h(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,i,n,r,s){void 0===s&&(s=Promise);var o=new E(c(t,i,n,r),s);return e.isGeneratorFunction(i)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},C(S),h(S,l,"Generator"),h(S,o,(function(){return this})),h(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),i=[];for(var n in e)i.push(n);return i.reverse(),function t(){for(;i.length;){var n=i.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=O,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!e)for(var i in this)"t"===i.charAt(0)&&n.call(this,i)&&!isNaN(+i.slice(1))&&(this[i]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var i=this;function r(n,r){return a.type="throw",a.arg=e,i.next=n,r&&(i.method="next",i.arg=t),!!r}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var l=n.call(o,"catchLoc"),h=n.call(o,"finallyLoc");if(l&&h){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!h)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var s=r;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=t,o.arg=e,s?(this.method="next",this.next=s.finallyLoc,y):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),M(i),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var n=i.completion;if("throw"===n.type){var r=n.arg;M(i)}return r}}throw Error("illegal catch attempt")},delegateYield:function(e,i,n){return this.delegate={iterator:O(e),resultName:i,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function un(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function dn(t){return function(){var e=this,i=arguments;return new Promise((function(n,r){var s=t.apply(e,i);function o(t){un(s,n,r,o,a,"next",t)}function a(t){un(s,n,r,o,a,"throw",t)}o(void 0)}))}}function pn(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fn(n.key),n)}}function fn(t){var e=function(t,e){if("object"!=an(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=an(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==an(e)?e:e+""}var mn=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.container=e.contentContainer,this.algorithms={rule:g,rule_fast:E,gravity:xt,orbits:ft,spiral:lt,spiral_no:L,vertical:H,sorter_no_col:et}}return e=t,i=[{key:"_init",value:(s=dn(cn().mark((function t(){var e=this;return cn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,en.create(this.container);case 2:this.view=t.sent,this.view.app.renderer.events.cursorStyles.default="default",this.view.app.renderer.events.domElement.addEventListener("contextmenu",(function(t){t.preventDefault()})),this.model=new on,this.view.model=this.model,this.controller=new At(this.view,this.model),this.controller.main=this,this._enableDrop(),this.algo=new xt,this.algo.setModel(this.model),this.view.app.ticker.add((function(){e.algo.bounds=e.view.getWorldBounds(),e.algo.model.viewportWidth=e.view.width,e.algo.model.viewportHeight=e.view.height,e.isPaused||e.algo.step(),e.view.renderGraph(e.model)}));case 13:case"end":return t.stop()}}),t,this)}))),function(){return s.apply(this,arguments)})},{key:"pauseGraph",value:function(){this.isPaused=!0}},{key:"resumeGraph",value:function(){this.isPaused=!1}},{key:"setAlgorithm",value:function(t){this.algo=t}},{key:"addMoonData",value:function(t){var e=t.id,i=t.x,n=t.y,r=t.data,s=void 0===r?{}:r,o=t.fixed,a=void 0!==o&&o;if(this.model&&this.view){var l=this.view.app.screen.width,h=this.view.app.screen.height,c=void 0!==i?i:Math.random()*l,u=void 0!==n?n:Math.random()*h;this.model.addMoon({id:e,x:c,y:u,data:s,fixed:a}),this.view.renderGraph(this.model)}}},{key:"addRandomMoons",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=["male","female"],i=["a","b","c"],n=0;n<t;n++){var r=crypto.randomUUID(),s=e[Math.floor(Math.random()*e.length)],o=Math.floor(80*Math.random())+1,a=i[Math.floor(Math.random()*i.length)];this.addMoonData({id:r,data:{sex:s,age:o,class:a}})}}},{key:"_dropDataset",value:function(t,e){var i=this;t.forEach((function(t,n){var r=t.id||"moon_".concat(Date.now(),"_").concat(n),s=Math.random()*Math.PI*2,o=200*Math.random(),a=e.x+Math.cos(s)*o,l=e.y+Math.sin(s)*o;i.model.addMoon({id:r,x:a,y:l,data:t})})),this.model.changed=!0}},{key:"_setAlgorithmByName",value:function(t){var e=this.algorithms[t];if(e){var i=new e;i.setModel(this.model),this.setAlgorithm(i)}else console.warn("Unknown algorithm:",t)}},{key:"_enableDrop",value:function(){var t=this,e=this.view.app.view;e.addEventListener("dragover",(function(t){return t.preventDefault()})),e.addEventListener("drop",(function(i){i.preventDefault();var n=e.getBoundingClientRect(),r=i.clientX-n.left,s=i.clientY-n.top,o=t.view.toWorld(r,s),a=(t.view._getNodeAtPosition(o.x,o.y),i.dataTransfer.getData("application/json"));if(a){var l=JSON.parse(a);if("table"!==l.type&&"graph-nodes"!==l.type)if("algorithm"!==l.type){if("color-rule"===l.type)return console.log("dropped color",l),void t.model.addColorRule({field:l.field,equals:l.equals,gt:l.gt,lt:l.lt,color:l.color});if("planet"===l.type){var c=h.build(l.rule);t.model.addPlanet({id:"p_"+Date.now(),x:o.x,y:o.y,rule:c,label:l.label,scalarField:l.scalarField})}if("scalarField"===l.type){var u=t.view._getNodeAtPosition(o.x,o.y);if(u&&"planet"===u.type)return u.scalarFields=u.scalarFields||[],u.scalarFields.includes(l.field)||u.scalarFields.push(l.field),void(u.scalarField=l.field)}if("sumField"===l.type&&t.model.addFormula({id:"f_"+Date.now(),x:o.x,y:o.y,scope:"all",label:"Edad",scalarField:"Edad",formula:"count"}),t.controller._refreshFormulaNodes(),"vector"===l.type){var d=h.build(l.rule);t.model.addVector({id:"p_"+Date.now(),x:o.x,y:o.y,direction:l.direction,length:l.length,scalarField:l.scalarField,rule:d})}}else t._setAlgorithmByName(l.name);else t._dropDataset(l.data,o)}}))}},{key:"getFormatedNode",value:function(t){if("planet"==t.type){var e=t.sumField?"Sum of ".concat(t.sumField):"",i=t.sumTotal?"Sum of ".concat(t.sumField," : ").concat(this.view.formatMoney(t.sumTotal)," "):"";return'\n <h3 style="margin-top:0">ATTRACTOR</h3>\n <div style="font-size:12px; line-height:1.4">\n Attracts nodes with : '.concat(t.label," <br/>\n ").concat(e," </br>\n ").concat(i,"\n </div>\n ")}var n=Object.entries(t);return'\n <h3 style="margin-top:0">'.concat(t.nombre||t.name||t.label||"Node",'</h3>\n <div style="font-size:12px; line-height:1.4">\n ').concat(n.map((function(t){var e,i=ln(t,2),n=i[0],r=i[1];return'\n <div style="display:flex; justify-content:space-between; margin-bottom:4px;">\n <span style="opacity:0.7">'.concat(n,'</span>\n <span style="text-align:right; margin-left:10px;">').concat(null==(e=r)||""===e||"NULL"===e?"<span style='opacity:0.5'>—</span>":e,"</span>\n </div>\n ")})).join(""),"\n </div>\n ")}}],n=[{key:"create",value:(r=dn(cn().mark((function e(i){var n;return cn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new t(i),e.next=3,n._init();case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)}))),function(t){return r.apply(this,arguments)})}],i&&pn(e.prototype,i),n&&pn(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,i,n,r,s}(),yn=function(t,e){return yn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},yn(t,e)};function gn(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}yn(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var vn=function(){return vn=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},vn.apply(this,arguments)};function bn(t,e,i){if(i||2===arguments.length)for(var n,r=0,s=e.length;r<s;r++)!n&&r in e||(n||(n=Array.prototype.slice.call(e,0,r)),n[r]=e[r]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var xn,_n="ADD_CHOICE",wn="REMOVE_CHOICE",Sn="FILTER_CHOICES",Cn="ACTIVATE_CHOICES",En="CLEAR_CHOICES",kn="ADD_GROUP",An="ADD_ITEM",Tn="REMOVE_ITEM",Mn="HIGHLIGHT_ITEM",Pn="showDropdown",On="hideDropdown",In="change",Ln="choice",Rn="search",jn="addItem",Dn="removeItem",Nn="highlightItem",Fn="highlightChoice",Bn="unhighlightItem",Gn=9,zn=16,Un=46,Wn=8,Hn=13,Vn=65,Xn=27,Yn=38,$n=40,qn=33,Kn=34,Zn=["fuseOptions","classNames"],Jn="text",Qn="select-one",tr="select-multiple",er=function(t){return{type:_n,choice:t}},ir=function(t){return{type:An,item:t}},nr=function(t){return{type:Tn,item:t}},rr=function(t,e){return{type:Mn,item:t,highlighted:e}},sr=function(t){return Array.from({length:t},(function(){return(t=0,e=36,Math.floor(Math.random()*(e-t)+t)).toString(36);var t,e})).join("")},or=function(t,e,i){return void 0===i&&(i=1),i>0?e.scrollTop+e.offsetHeight>=t.offsetTop+t.offsetHeight:t.offsetTop>=e.scrollTop},ar=function(t){if("string"!=typeof t){if(null==t)return"";if("object"==typeof t){if("raw"in t)return ar(t.raw);if("trusted"in t)return t.trusted}return t}return t.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/'/g,"&#039;").replace(/"/g,"&quot;")},lr=(xn=document.createElement("div"),function(t){xn.innerHTML=t.trim();for(var e=xn.children[0];xn.firstChild;)xn.removeChild(xn.firstChild);return e}),hr=function(t){return"function"==typeof t?t():t},cr=function(t){if("string"==typeof t)return t;if("object"==typeof t){if("trusted"in t)return t.trusted;if("raw"in t)return t.raw}return""},ur=function(t){if("string"==typeof t)return t;if("object"==typeof t){if("escaped"in t)return t.escaped;if("trusted"in t)return t.trusted}return""},dr=function(t,e){return{id:t.id,highlighted:t.highlighted,labelClass:t.labelClass,labelDescription:cr(t.labelDescription),customProperties:t.customProperties,disabled:t.disabled,active:t.active,label:t.label,placeholder:t.placeholder,value:t.value,groupValue:t.group?t.group.label:void 0,element:t.element,keyCode:e}},pr=function(t,e,i){return"function"==typeof t?t(ar(e),cr(e),i):t},fr=function(t,e){return t?ur(e):ar(e)},mr=function(t,e,i){t.innerHTML=fr(e,i)},yr=function(t,e){return t.rank-e.rank},gr=function(t){return Array.isArray(t)?t:[t]},vr=function(t){return t&&Array.isArray(t)?t.map((function(t){return".".concat(t)})).join(""):".".concat(t)},br=function(t,e){var i;(i=t.classList).add.apply(i,gr(e))},xr=function(t,e){var i;(i=t.classList).remove.apply(i,gr(e))},_r=function(t){if(void 0!==t)try{return JSON.parse(t)}catch(e){return t}return{}},wr=function(){function t(t){var e=t.element,i=t.type,n=t.classNames;this.element=e,this.classNames=n,this.type=i,this.isActive=!1}return t.prototype.show=function(){return br(this.element,this.classNames.activeState),this.element.setAttribute("aria-expanded","true"),this.isActive=!0,this},t.prototype.hide=function(){return xr(this.element,this.classNames.activeState),this.element.setAttribute("aria-expanded","false"),this.isActive=!1,this},t}(),Sr=function(){function t(t){var e=t.element,i=t.type,n=t.classNames,r=t.position;this.element=e,this.classNames=n,this.type=i,this.position=r,this.isOpen=!1,this.isFlipped=!1,this.isDisabled=!1,this.isLoading=!1}return t.prototype.shouldFlip=function(t,e){var i=!1;return"auto"===this.position?i=this.element.getBoundingClientRect().top-e>=0&&!window.matchMedia("(min-height: ".concat(t+1,"px)")).matches:"top"===this.position&&(i=!0),i},t.prototype.setActiveDescendant=function(t){this.element.setAttribute("aria-activedescendant",t)},t.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},t.prototype.open=function(t,e){br(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(t,e)&&(br(this.element,this.classNames.flippedState),this.isFlipped=!0)},t.prototype.close=function(){xr(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(xr(this.element,this.classNames.flippedState),this.isFlipped=!1)},t.prototype.addFocusState=function(){br(this.element,this.classNames.focusState)},t.prototype.removeFocusState=function(){xr(this.element,this.classNames.focusState)},t.prototype.addInvalidState=function(){br(this.element,this.classNames.invalidState)},t.prototype.removeInvalidState=function(){xr(this.element,this.classNames.invalidState)},t.prototype.enable=function(){xr(this.element,this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),this.type===Qn&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1},t.prototype.disable=function(){br(this.element,this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),this.type===Qn&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0},t.prototype.wrap=function(t){var e=this.element,i=t.parentNode;i&&(t.nextSibling?i.insertBefore(e,t.nextSibling):i.appendChild(e)),e.appendChild(t)},t.prototype.unwrap=function(t){var e=this.element,i=e.parentNode;i&&(i.insertBefore(t,e),i.removeChild(e))},t.prototype.addLoadingState=function(){br(this.element,this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0},t.prototype.removeLoadingState=function(){xr(this.element,this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1},t}(),Cr=function(){function t(t){var e=t.element,i=t.type,n=t.classNames,r=t.preventPaste;this.element=e,this.type=i,this.classNames=n,this.preventPaste=r,this.isFocussed=this.element.isEqualNode(document.activeElement),this.isDisabled=e.disabled,this._onPaste=this._onPaste.bind(this),this._onInput=this._onInput.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this)}return Object.defineProperty(t.prototype,"placeholder",{set:function(t){this.element.placeholder=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.element.value},set:function(t){this.element.value=t},enumerable:!1,configurable:!0}),t.prototype.addEventListeners=function(){var t=this.element;t.addEventListener("paste",this._onPaste),t.addEventListener("input",this._onInput,{passive:!0}),t.addEventListener("focus",this._onFocus,{passive:!0}),t.addEventListener("blur",this._onBlur,{passive:!0})},t.prototype.removeEventListeners=function(){var t=this.element;t.removeEventListener("input",this._onInput),t.removeEventListener("paste",this._onPaste),t.removeEventListener("focus",this._onFocus),t.removeEventListener("blur",this._onBlur)},t.prototype.enable=function(){this.element.removeAttribute("disabled"),this.isDisabled=!1},t.prototype.disable=function(){this.element.setAttribute("disabled",""),this.isDisabled=!0},t.prototype.focus=function(){this.isFocussed||this.element.focus()},t.prototype.blur=function(){this.isFocussed&&this.element.blur()},t.prototype.clear=function(t){return void 0===t&&(t=!0),this.element.value="",t&&this.setWidth(),this},t.prototype.setWidth=function(){var t=this.element;t.style.minWidth="".concat(t.placeholder.length+1,"ch"),t.style.width="".concat(t.value.length+1,"ch")},t.prototype.setActiveDescendant=function(t){this.element.setAttribute("aria-activedescendant",t)},t.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},t.prototype._onInput=function(){this.type!==Qn&&this.setWidth()},t.prototype._onPaste=function(t){this.preventPaste&&t.preventDefault()},t.prototype._onFocus=function(){this.isFocussed=!0},t.prototype._onBlur=function(){this.isFocussed=!1},t}(),Er=function(){function t(t){var e=t.element;this.element=e,this.scrollPos=this.element.scrollTop,this.height=this.element.offsetHeight}return t.prototype.prepend=function(t){var e=this.element.firstElementChild;e?this.element.insertBefore(t,e):this.element.append(t)},t.prototype.scrollToTop=function(){this.element.scrollTop=0},t.prototype.scrollToChildElement=function(t,e){var i=this;if(t){var n=this.element.offsetHeight,r=this.element.scrollTop+n,s=t.offsetHeight,o=t.offsetTop+s,a=e>0?this.element.scrollTop+o-r:t.offsetTop;requestAnimationFrame((function(){i._animateScroll(a,e)}))}},t.prototype._scrollDown=function(t,e,i){var n=(i-t)/e,r=n>1?n:1;this.element.scrollTop=t+r},t.prototype._scrollUp=function(t,e,i){var n=(t-i)/e,r=n>1?n:1;this.element.scrollTop=t-r},t.prototype._animateScroll=function(t,e){var i=this,n=this.element.scrollTop,r=!1;e>0?(this._scrollDown(n,4,t),n<t&&(r=!0)):(this._scrollUp(n,4,t),n>t&&(r=!0)),r&&requestAnimationFrame((function(){i._animateScroll(t,e)}))},t}(),kr=function(){function t(t){var e=t.element,i=t.classNames;this.element=e,this.classNames=i,this.isDisabled=!1}return Object.defineProperty(t.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return this.element.value},set:function(t){this.element.setAttribute("value",t),this.element.value=t},enumerable:!1,configurable:!0}),t.prototype.conceal=function(){var t=this.element;br(t,this.classNames.input),t.hidden=!0,t.tabIndex=-1;var e=t.getAttribute("style");e&&t.setAttribute("data-choice-orig-style",e),t.setAttribute("data-choice","active")},t.prototype.reveal=function(){var t=this.element;xr(t,this.classNames.input),t.hidden=!1,t.removeAttribute("tabindex");var e=t.getAttribute("data-choice-orig-style");e?(t.removeAttribute("data-choice-orig-style"),t.setAttribute("style",e)):t.removeAttribute("style"),t.removeAttribute("data-choice")},t.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},t.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},t.prototype.triggerEvent=function(t,e){!function(t,e,i){void 0===i&&(i=null);var n=new CustomEvent(e,{detail:i,bubbles:!0,cancelable:!0});t.dispatchEvent(n)}(this.element,t,e||{})},t}(),Ar=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return gn(e,t),e}(kr),Tr=function(t,e){return void 0===e&&(e=!0),void 0===t?e:!!t},Mr=function(t){if("string"==typeof t&&(t=t.split(" ").filter((function(t){return t.length}))),Array.isArray(t)&&t.length)return t},Pr=function(t,e,i){if(void 0===i&&(i=!0),"string"==typeof t){var n=ar(t);return Pr({value:t,label:i||n===t?t:{escaped:n,raw:t},selected:!0},!1)}var r=t;if("choices"in r){if(!e)throw new TypeError("optGroup is not allowed");var s=r,o=s.choices.map((function(t){return Pr(t,!1)}));return{id:0,label:cr(s.label)||s.value,active:!!o.length,disabled:!!s.disabled,choices:o}}var a=r;return{id:0,group:null,score:0,rank:0,value:a.value,label:a.label||a.value,active:Tr(a.active),selected:Tr(a.selected,!1),disabled:Tr(a.disabled,!1),placeholder:Tr(a.placeholder,!1),highlighted:!1,labelClass:Mr(a.labelClass),labelDescription:a.labelDescription,customProperties:a.customProperties}},Or=function(t){return"SELECT"===t.tagName},Ir=function(t){function e(e){var i=e.element,n=e.classNames,r=e.template,s=e.extractPlaceholder,o=t.call(this,{element:i,classNames:n})||this;return o.template=r,o.extractPlaceholder=s,o}return gn(e,t),Object.defineProperty(e.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),e.prototype.addOptions=function(t){var e=this,i=document.createDocumentFragment();t.forEach((function(t){var n=t;if(!n.element){var r=e.template(n);i.appendChild(r),n.element=r}})),this.element.appendChild(i)},e.prototype.optionsAsChoices=function(){var t=this,e=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach((function(i){!function(t){return"OPTION"===t.tagName}(i)?function(t){return"OPTGROUP"===t.tagName}(i)&&e.push(t._optgroupToChoice(i)):e.push(t._optionToChoice(i))})),e},e.prototype._optionToChoice=function(t){return!t.hasAttribute("value")&&t.hasAttribute("placeholder")&&(t.setAttribute("value",""),t.value=""),{id:0,group:null,score:0,rank:0,value:t.value,label:t.label,element:t,active:!0,selected:this.extractPlaceholder?t.selected:t.hasAttribute("selected"),disabled:t.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(!t.value||t.hasAttribute("placeholder")),labelClass:void 0!==t.dataset.labelClass?Mr(t.dataset.labelClass):void 0,labelDescription:void 0!==t.dataset.labelDescription?{trusted:t.dataset.labelDescription}:void 0,customProperties:_r(t.dataset.customProperties)}},e.prototype._optgroupToChoice=function(t){var e=this,i=t.querySelectorAll("option"),n=Array.from(i).map((function(t){return e._optionToChoice(t)}));return{id:0,label:t.label||"",element:t,active:!!n.length,disabled:t.disabled,choices:n}},e}(kr),Lr={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,closeDropdownOnSelect:"auto",singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(t){return!!t&&""!==t},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!1,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchDisabledChoices:!1,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,shouldSort:!0,shouldSortItems:!1,sorter:function(t,e){var i=t.value,n=t.label,r=void 0===n?i:n,s=e.value,o=e.label,a=void 0===o?s:o;return cr(r).localeCompare(cr(a),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,placeholder:!0,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",searchRenderSelectedChoices:!0,loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",uniqueItemText:"Only unique values can be added",customAddItemText:"Only values matching specific conditions can be added",addItemText:function(t){return'Press Enter to add <b>"'.concat(t,'"</b>')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(t,e,i){return"Remove item: ".concat(i?ar(i.label):t)},maxItemText:function(t){return"Only ".concat(t," values can be added")},valueComparer:function(t,e){return t===e},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],placeholder:["choices__placeholder"],group:["choices__group"],groupHeading:["choices__heading"],button:["choices__button"],activeState:["is-active"],focusState:["is-focused"],openState:["is-open"],disabledState:["is-disabled"],highlightedState:["is-highlighted"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],invalidState:["is-invalid"],notice:["choices__notice"],addChoice:["choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},Rr=function(t){var e=t.itemEl;e&&(e.remove(),t.itemEl=void 0)};var jr={groups:function(t,e){var i=t,n=!0;switch(e.type){case kn:i.push(e.group);break;case En:i=[];break;default:n=!1}return{state:i,update:n}},items:function(t,e,i){var n=t,r=!0;switch(e.type){case An:e.item.selected=!0,(s=e.item.element)&&(s.selected=!0,s.setAttribute("selected","")),n.push(e.item);break;case Tn:var s;if(e.item.selected=!1,s=e.item.element){s.selected=!1,s.removeAttribute("selected");var o=s.parentElement;o&&Or(o)&&o.type===Qn&&(o.value="")}Rr(e.item),n=n.filter((function(t){return t.id!==e.item.id}));break;case wn:Rr(e.choice),n=n.filter((function(t){return t.id!==e.choice.id}));break;case Mn:var a=e.highlighted,l=n.find((function(t){return t.id===e.item.id}));l&&l.highlighted!==a&&(l.highlighted=a,i&&function(t,e,i){var n=t.itemEl;n&&(xr(n,i),br(n,e))}(l,a?i.classNames.highlightedState:i.classNames.selectedState,a?i.classNames.selectedState:i.classNames.highlightedState));break;default:r=!1}return{state:n,update:r}},choices:function(t,e,i){var n=t,r=!0;switch(e.type){case _n:n.push(e.choice);break;case wn:e.choice.choiceEl=void 0,e.choice.group&&(e.choice.group.choices=e.choice.group.choices.filter((function(t){return t.id!==e.choice.id}))),n=n.filter((function(t){return t.id!==e.choice.id}));break;case An:case Tn:e.item.choiceEl=void 0;break;case Sn:var s=[];e.results.forEach((function(t){s[t.item.id]=t})),n.forEach((function(t){var e=s[t.id];void 0!==e?(t.score=e.score,t.rank=e.rank,t.active=!0):(t.score=0,t.rank=0,t.active=!1),i&&i.appendGroupInSearch&&(t.choiceEl=void 0)}));break;case Cn:n.forEach((function(t){t.active=e.active,i&&i.appendGroupInSearch&&(t.choiceEl=void 0)}));break;case En:n=[];break;default:r=!1}return{state:n,update:r}}},Dr=function(){function t(t){this._state=this.defaultState,this._listeners=[],this._txn=0,this._context=t}return Object.defineProperty(t.prototype,"defaultState",{get:function(){return{groups:[],items:[],choices:[]}},enumerable:!1,configurable:!0}),t.prototype.changeSet=function(t){return{groups:t,items:t,choices:t}},t.prototype.reset=function(){this._state=this.defaultState;var t=this.changeSet(!0);this._txn?this._changeSet=t:this._listeners.forEach((function(e){return e(t)}))},t.prototype.subscribe=function(t){return this._listeners.push(t),this},t.prototype.dispatch=function(t){var e=this,i=this._state,n=!1,r=this._changeSet||this.changeSet(!1);Object.keys(jr).forEach((function(s){var o=jr[s](i[s],t,e._context);o.update&&(n=!0,r[s]=!0,i[s]=o.state)})),n&&(this._txn?this._changeSet=r:this._listeners.forEach((function(t){return t(r)})))},t.prototype.withTxn=function(t){this._txn++;try{t()}finally{if(this._txn=Math.max(0,this._txn-1),!this._txn){var e=this._changeSet;e&&(this._changeSet=void 0,this._listeners.forEach((function(t){return t(e)})))}}},Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"items",{get:function(){return this.state.items},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"highlightedActiveItems",{get:function(){return this.items.filter((function(t){return t.active&&t.highlighted}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"choices",{get:function(){return this.state.choices},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"activeChoices",{get:function(){return this.choices.filter((function(t){return t.active}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"searchableChoices",{get:function(){var t=this._context;return this.choices.filter((function(e){return!e.placeholder&&(t.searchDisabledChoices||!e.disabled)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"groups",{get:function(){return this.state.groups},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"activeGroups",{get:function(){var t=this;return this.state.groups.filter((function(e){var i=e.active&&!e.disabled,n=t.state.choices.some((function(t){return t.active&&!t.disabled}));return i&&n}),[])},enumerable:!1,configurable:!0}),t.prototype.inTxn=function(){return this._txn>0},t.prototype.getChoiceById=function(t){return this.activeChoices.find((function(e){return e.id===t}))},t.prototype.getGroupById=function(t){return this.groups.find((function(e){return e.id===t}))},t}(),Nr="no-choices",Fr="no-results",Br="add-choice",Gr="";function zr(t,e,i){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ur(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Wr(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ur(Object(i),!0).forEach((function(e){zr(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ur(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Hr(t){return Array.isArray?Array.isArray(t):"[object Array]"===Zr(t)}function Vr(t){return"string"==typeof t}function Xr(t){return"number"==typeof t}function Yr(t){return!0===t||!1===t||function(t){return $r(t)&&null!==t}(t)&&"[object Boolean]"==Zr(t)}function $r(t){return"object"==typeof t}function qr(t){return null!=t}function Kr(t){return!t.trim().length}function Zr(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Jr=t=>`Missing ${t} property in key`,Qr=t=>`Property 'weight' in key '${t}' must be a positive integer`,ts=Object.prototype.hasOwnProperty;class es{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach((t=>{let i=is(t);this._keys.push(i),this._keyMap[i.id]=i,e+=i.weight})),this._keys.forEach((t=>{t.weight/=e}))}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function is(t){let e=null,i=null,n=null,r=1,s=null;if(Vr(t)||Hr(t))n=t,e=ns(t),i=rs(t);else{if(!ts.call(t,"name"))throw new Error(Jr("name"));const o=t.name;if(n=o,ts.call(t,"weight")&&(r=t.weight,r<=0))throw new Error(Qr(o));e=ns(o),i=rs(o),s=t.getFn}return{path:e,id:i,weight:r,src:n,getFn:s}}function ns(t){return Hr(t)?t:t.split(".")}function rs(t){return Hr(t)?t.join("."):t}const ss={useExtendedSearch:!1,getFn:function(t,e){let i=[],n=!1;const r=(t,e,s)=>{if(qr(t))if(e[s]){const o=t[e[s]];if(!qr(o))return;if(s===e.length-1&&(Vr(o)||Xr(o)||Yr(o)))i.push(function(t){return null==t?"":function(t){if("string"==typeof t)return t;let e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}(o));else if(Hr(o)){n=!0;for(let t=0,i=o.length;t<i;t+=1)r(o[t],e,s+1)}else e.length&&r(o,e,s+1)}else i.push(t)};return r(t,Vr(e)?e.split("."):e,0),n?i:i[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var os=Wr(Wr(Wr(Wr({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1}),{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1}),{location:0,threshold:.6,distance:100}),ss);const as=/[^ ]+/g;class ls{constructor({getFn:t=os.getFn,fieldNormWeight:e=os.fieldNormWeight}={}){this.norm=function(t=1,e=3){const i=new Map,n=Math.pow(10,e);return{get(e){const r=e.match(as).length;if(i.has(r))return i.get(r);const s=1/Math.pow(r,.5*t),o=parseFloat(Math.round(s*n)/n);return i.set(r,o),o},clear(){i.clear()}}}(e,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach(((t,e)=>{this._keysMap[t.id]=e}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,Vr(this.docs[0])?this.docs.forEach(((t,e)=>{this._addString(t,e)})):this.docs.forEach(((t,e)=>{this._addObject(t,e)})),this.norm.clear())}add(t){const e=this.size();Vr(t)?this._addString(t,e):this._addObject(t,e)}removeAt(t){this.records.splice(t,1);for(let e=t,i=this.size();e<i;e+=1)this.records[e].i-=1}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_addString(t,e){if(!qr(t)||Kr(t))return;let i={v:t,i:e,n:this.norm.get(t)};this.records.push(i)}_addObject(t,e){let i={i:e,$:{}};this.keys.forEach(((e,n)=>{let r=e.getFn?e.getFn(t):this.getFn(t,e.path);if(qr(r))if(Hr(r)){let t=[];const e=[{nestedArrIndex:-1,value:r}];for(;e.length;){const{nestedArrIndex:i,value:n}=e.pop();if(qr(n))if(Vr(n)&&!Kr(n)){let e={v:n,i,n:this.norm.get(n)};t.push(e)}else Hr(n)&&n.forEach(((t,i)=>{e.push({nestedArrIndex:i,value:t})}))}i.$[n]=t}else if(Vr(r)&&!Kr(r)){let t={v:r,n:this.norm.get(r)};i.$[n]=t}})),this.records.push(i)}toJSON(){return{keys:this.keys,records:this.records}}}function hs(t,e,{getFn:i=os.getFn,fieldNormWeight:n=os.fieldNormWeight}={}){const r=new ls({getFn:i,fieldNormWeight:n});return r.setKeys(t.map(is)),r.setSources(e),r.create(),r}function cs(t,{errors:e=0,currentLocation:i=0,expectedLocation:n=0,distance:r=os.distance,ignoreLocation:s=os.ignoreLocation}={}){const o=e/t.length;if(s)return o;const a=Math.abs(n-i);return r?o+a/r:a?1:o}const us=32;function ds(t,e,i,{location:n=os.location,distance:r=os.distance,threshold:s=os.threshold,findAllMatches:o=os.findAllMatches,minMatchCharLength:a=os.minMatchCharLength,includeMatches:l=os.includeMatches,ignoreLocation:h=os.ignoreLocation}={}){if(e.length>us)throw new Error(`Pattern length exceeds max of ${us}.`);const c=e.length,u=t.length,d=Math.max(0,Math.min(n,u));let p=s,f=d;const m=a>1||l,y=m?Array(u):[];let g;for(;(g=t.indexOf(e,f))>-1;){let t=cs(e,{currentLocation:g,expectedLocation:d,distance:r,ignoreLocation:h});if(p=Math.min(t,p),f=g+c,m){let t=0;for(;t<c;)y[g+t]=1,t+=1}}f=-1;let v=[],b=1,x=c+u;const _=1<<c-1;for(let n=0;n<c;n+=1){let s=0,a=x;for(;s<a;){cs(e,{errors:n,currentLocation:d+a,expectedLocation:d,distance:r,ignoreLocation:h})<=p?s=a:x=a,a=Math.floor((x-s)/2+s)}x=a;let l=Math.max(1,d-a+1),g=o?u:Math.min(d+a,u)+c,w=Array(g+2);w[g+1]=(1<<n)-1;for(let s=g;s>=l;s-=1){let o=s-1,a=i[t.charAt(o)];if(m&&(y[o]=+!!a),w[s]=(w[s+1]<<1|1)&a,n&&(w[s]|=(v[s+1]|v[s])<<1|1|v[s+1]),w[s]&_&&(b=cs(e,{errors:n,currentLocation:o,expectedLocation:d,distance:r,ignoreLocation:h}),b<=p)){if(p=b,f=o,f<=d)break;l=Math.max(1,2*d-f)}}if(cs(e,{errors:n+1,currentLocation:d,expectedLocation:d,distance:r,ignoreLocation:h})>p)break;v=w}const w={isMatch:f>=0,score:Math.max(.001,b)};if(m){const t=function(t=[],e=os.minMatchCharLength){let i=[],n=-1,r=-1,s=0;for(let o=t.length;s<o;s+=1){let o=t[s];o&&-1===n?n=s:o||-1===n||(r=s-1,r-n+1>=e&&i.push([n,r]),n=-1)}return t[s-1]&&s-n>=e&&i.push([n,s-1]),i}(y,a);t.length?l&&(w.indices=t):w.isMatch=!1}return w}function ps(t){let e={};for(let i=0,n=t.length;i<n;i+=1){const r=t.charAt(i);e[r]=(e[r]||0)|1<<n-i-1}return e}class fs{constructor(t,{location:e=os.location,threshold:i=os.threshold,distance:n=os.distance,includeMatches:r=os.includeMatches,findAllMatches:s=os.findAllMatches,minMatchCharLength:o=os.minMatchCharLength,isCaseSensitive:a=os.isCaseSensitive,ignoreLocation:l=os.ignoreLocation}={}){if(this.options={location:e,threshold:i,distance:n,includeMatches:r,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:a,ignoreLocation:l},this.pattern=a?t:t.toLowerCase(),this.chunks=[],!this.pattern.length)return;const h=(t,e)=>{this.chunks.push({pattern:t,alphabet:ps(t),startIndex:e})},c=this.pattern.length;if(c>us){let t=0;const e=c%us,i=c-e;for(;t<i;)h(this.pattern.substr(t,us),t),t+=us;if(e){const t=c-us;h(this.pattern.substr(t),t)}}else h(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,includeMatches:i}=this.options;if(e||(t=t.toLowerCase()),this.pattern===t){let e={isMatch:!0,score:0};return i&&(e.indices=[[0,t.length-1]]),e}const{location:n,distance:r,threshold:s,findAllMatches:o,minMatchCharLength:a,ignoreLocation:l}=this.options;let h=[],c=0,u=!1;this.chunks.forEach((({pattern:e,alphabet:d,startIndex:p})=>{const{isMatch:f,score:m,indices:y}=ds(t,e,d,{location:n+p,distance:r,threshold:s,findAllMatches:o,minMatchCharLength:a,includeMatches:i,ignoreLocation:l});f&&(u=!0),c+=m,f&&y&&(h=[...h,...y])}));let d={isMatch:u,score:u?c/this.chunks.length:1};return u&&i&&(d.indices=h),d}}class ms{constructor(t){this.pattern=t}static isMultiMatch(t){return ys(t,this.multiRegex)}static isSingleMatch(t){return ys(t,this.singleRegex)}search(){}}function ys(t,e){const i=t.match(e);return i?i[1]:null}class gs extends ms{constructor(t,{location:e=os.location,threshold:i=os.threshold,distance:n=os.distance,includeMatches:r=os.includeMatches,findAllMatches:s=os.findAllMatches,minMatchCharLength:o=os.minMatchCharLength,isCaseSensitive:a=os.isCaseSensitive,ignoreLocation:l=os.ignoreLocation}={}){super(t),this._bitapSearch=new fs(t,{location:e,threshold:i,distance:n,includeMatches:r,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:a,ignoreLocation:l})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class vs extends ms{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e,i=0;const n=[],r=this.pattern.length;for(;(e=t.indexOf(this.pattern,i))>-1;)i=e+r,n.push([e,i-1]);const s=!!n.length;return{isMatch:s,score:s?0:1,indices:n}}}const bs=[class extends ms{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const e=t===this.pattern;return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}},vs,class extends ms{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const e=t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}},class extends ms{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const e=!t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends ms{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const e=!t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},class extends ms{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const e=t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[t.length-this.pattern.length,t.length-1]}}},class extends ms{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const e=-1===t.indexOf(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}},gs],xs=bs.length,_s=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const ws=new Set([gs.type,vs.type]);class Ss{constructor(t,{isCaseSensitive:e=os.isCaseSensitive,includeMatches:i=os.includeMatches,minMatchCharLength:n=os.minMatchCharLength,ignoreLocation:r=os.ignoreLocation,findAllMatches:s=os.findAllMatches,location:o=os.location,threshold:a=os.threshold,distance:l=os.distance}={}){this.query=null,this.options={isCaseSensitive:e,includeMatches:i,minMatchCharLength:n,findAllMatches:s,ignoreLocation:r,location:o,threshold:a,distance:l},this.pattern=e?t:t.toLowerCase(),this.query=function(t,e={}){return t.split("|").map((t=>{let i=t.trim().split(_s).filter((t=>t&&!!t.trim())),n=[];for(let t=0,r=i.length;t<r;t+=1){const r=i[t];let s=!1,o=-1;for(;!s&&++o<xs;){const t=bs[o];let i=t.isMultiMatch(r);i&&(n.push(new t(i,e)),s=!0)}if(!s)for(o=-1;++o<xs;){const t=bs[o];let i=t.isSingleMatch(r);if(i){n.push(new t(i,e));break}}}return n}))}(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:i,isCaseSensitive:n}=this.options;t=n?t:t.toLowerCase();let r=0,s=[],o=0;for(let n=0,a=e.length;n<a;n+=1){const a=e[n];s.length=0,r=0;for(let e=0,n=a.length;e<n;e+=1){const n=a[e],{isMatch:l,indices:h,score:c}=n.search(t);if(!l){o=0,r=0,s.length=0;break}if(r+=1,o+=c,i){const t=n.constructor.type;ws.has(t)?s=[...s,...h]:s.push(h)}}if(r){let t={isMatch:!0,score:o/r};return i&&(t.indices=s),t}}return{isMatch:!1,score:1}}}const Cs=[];function Es(t,e){for(let i=0,n=Cs.length;i<n;i+=1){let n=Cs[i];if(n.condition(t,e))return new n(t,e)}return new fs(t,e)}const ks="$and",As="$or",Ts="$path",Ms="$val",Ps=t=>!(!t[ks]&&!t[As]),Os=t=>({[ks]:Object.keys(t).map((e=>({[e]:t[e]})))});function Is(t,e,{auto:i=!0}={}){const n=t=>{let r=Object.keys(t);const s=(t=>!!t[Ts])(t);if(!s&&r.length>1&&!Ps(t))return n(Os(t));if((t=>!Hr(t)&&$r(t)&&!Ps(t))(t)){const n=s?t[Ts]:r[0],o=s?t[Ms]:t[n];if(!Vr(o))throw new Error((t=>`Invalid value for key ${t}`)(n));const a={keyId:rs(n),pattern:o};return i&&(a.searcher=Es(o,e)),a}let o={children:[],operator:r[0]};return r.forEach((e=>{const i=t[e];Hr(i)&&i.forEach((t=>{o.children.push(n(t))}))})),o};return Ps(t)||(t=Os(t)),n(t)}function Ls(t,e){const i=t.matches;e.matches=[],qr(i)&&i.forEach((t=>{if(!qr(t.indices)||!t.indices.length)return;const{indices:i,value:n}=t;let r={indices:i,value:n};t.key&&(r.key=t.key.src),t.idx>-1&&(r.refIndex=t.idx),e.matches.push(r)}))}function Rs(t,e){e.score=t.score}class js{constructor(t,e={},i){this.options=Wr(Wr({},os),e),this.options.useExtendedSearch,this._keyStore=new es(this.options.keys),this.setCollection(t,i)}setCollection(t,e){if(this._docs=t,e&&!(e instanceof ls))throw new Error("Incorrect 'index' type");this._myIndex=e||hs(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){qr(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const e=[];for(let i=0,n=this._docs.length;i<n;i+=1){const r=this._docs[i];t(r,i)&&(this.removeAt(i),i-=1,n-=1,e.push(r))}return e}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:e=-1}={}){const{includeMatches:i,includeScore:n,shouldSort:r,sortFn:s,ignoreFieldNorm:o}=this.options;let a=Vr(t)?Vr(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return function(t,{ignoreFieldNorm:e=os.ignoreFieldNorm}){t.forEach((t=>{let i=1;t.matches.forEach((({key:t,norm:n,score:r})=>{const s=t?t.weight:null;i*=Math.pow(0===r&&s?Number.EPSILON:r,(s||1)*(e?1:n))})),t.score=i}))}(a,{ignoreFieldNorm:o}),r&&a.sort(s),Xr(e)&&e>-1&&(a=a.slice(0,e)),function(t,e,{includeMatches:i=os.includeMatches,includeScore:n=os.includeScore}={}){const r=[];return i&&r.push(Ls),n&&r.push(Rs),t.map((t=>{const{idx:i}=t,n={item:e[i],refIndex:i};return r.length&&r.forEach((e=>{e(t,n)})),n}))}(a,this._docs,{includeMatches:i,includeScore:n})}_searchStringList(t){const e=Es(t,this.options),{records:i}=this._myIndex,n=[];return i.forEach((({v:t,i,n:r})=>{if(!qr(t))return;const{isMatch:s,score:o,indices:a}=e.searchIn(t);s&&n.push({item:t,idx:i,matches:[{score:o,value:t,norm:r,indices:a}]})})),n}_searchLogical(t){const e=Is(t,this.options),i=(t,e,n)=>{if(!t.children){const{keyId:i,searcher:r}=t,s=this._findMatches({key:this._keyStore.get(i),value:this._myIndex.getValueForItemAtKeyId(e,i),searcher:r});return s&&s.length?[{idx:n,item:e,matches:s}]:[]}const r=[];for(let s=0,o=t.children.length;s<o;s+=1){const o=t.children[s],a=i(o,e,n);if(a.length)r.push(...a);else if(t.operator===ks)return[]}return r},n=this._myIndex.records,r={},s=[];return n.forEach((({$:t,i:n})=>{if(qr(t)){let o=i(e,t,n);o.length&&(r[n]||(r[n]={idx:n,item:t,matches:[]},s.push(r[n])),o.forEach((({matches:t})=>{r[n].matches.push(...t)})))}})),s}_searchObjectList(t){const e=Es(t,this.options),{keys:i,records:n}=this._myIndex,r=[];return n.forEach((({$:t,i:n})=>{if(!qr(t))return;let s=[];i.forEach(((i,n)=>{s.push(...this._findMatches({key:i,value:t[n],searcher:e}))})),s.length&&r.push({idx:n,item:t,matches:s})})),r}_findMatches({key:t,value:e,searcher:i}){if(!qr(e))return[];let n=[];if(Hr(e))e.forEach((({v:e,i:r,n:s})=>{if(!qr(e))return;const{isMatch:o,score:a,indices:l}=i.searchIn(e);o&&n.push({score:a,key:t,value:e,idx:r,norm:s,indices:l})}));else{const{v:r,n:s}=e,{isMatch:o,score:a,indices:l}=i.searchIn(r);o&&n.push({score:a,key:t,value:r,norm:s,indices:l})}return n}}js.version="7.0.0",js.createIndex=hs,js.parseIndex=function(t,{getFn:e=os.getFn,fieldNormWeight:i=os.fieldNormWeight}={}){const{keys:n,records:r}=t,s=new ls({getFn:e,fieldNormWeight:i});return s.setKeys(n),s.setIndexRecords(r),s},js.config=os,js.parseQuery=Is,function(...t){Cs.push(...t)}(Ss);var Ds=function(){function t(t){this._haystack=[],this._fuseOptions=vn(vn({},t.fuseOptions),{keys:bn([],t.searchFields,!0),includeMatches:!0})}return t.prototype.index=function(t){this._haystack=t,this._fuse&&this._fuse.setCollection(t)},t.prototype.reset=function(){this._haystack=[],this._fuse=void 0},t.prototype.isEmptyIndex=function(){return!this._haystack.length},t.prototype.search=function(t){return this._fuse||(this._fuse=new js(this._haystack,this._fuseOptions)),this._fuse.search(t).map((function(t,e){return{item:t.item,score:t.score||0,rank:e+1}}))},t}();var Ns=function(t,e,i){var n=t.dataset,r=e.customProperties,s=e.labelClass,o=e.labelDescription;s&&(n.labelClass=gr(s).join(" ")),o&&(n.labelDescription=cr(o)),i&&r&&("string"==typeof r?n.customProperties=r:"object"!=typeof r||function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(r)||(n.customProperties=JSON.stringify(r)))},Fs=function(t,e,i){var n=e&&t.querySelector("label[for='".concat(e,"']")),r=n&&n.innerText;r&&i.setAttribute("aria-label",r)},Bs={containerOuter:function(t,e,i,n,r,s,o){var a=t.classNames.containerOuter,l=document.createElement("div");return br(l,a),l.dataset.type=s,e&&(l.dir=e),n&&(l.tabIndex=0),i&&(l.setAttribute("role",r?"combobox":"listbox"),r?l.setAttribute("aria-autocomplete","list"):o||Fs(this._docRoot,this.passedElement.element.id,l),l.setAttribute("aria-haspopup","true"),l.setAttribute("aria-expanded","false")),o&&l.setAttribute("aria-labelledby",o),l},containerInner:function(t){var e=t.classNames.containerInner,i=document.createElement("div");return br(i,e),i},itemList:function(t,e){var i=t.searchEnabled,n=t.classNames,r=n.list,s=n.listSingle,o=n.listItems,a=document.createElement("div");return br(a,r),br(a,e?s:o),this._isSelectElement&&i&&a.setAttribute("role","listbox"),a},placeholder:function(t,e){var i=t.allowHTML,n=t.classNames.placeholder,r=document.createElement("div");return br(r,n),mr(r,i,e),r},item:function(t,e,i){var n=t.allowHTML,r=t.removeItemButtonAlignLeft,s=t.removeItemIconText,o=t.removeItemLabelText,a=t.classNames,l=a.item,h=a.button,c=a.highlightedState,u=a.itemSelectable,d=a.placeholder,p=cr(e.value),f=document.createElement("div");if(br(f,l),e.labelClass){var m=document.createElement("span");mr(m,n,e.label),br(m,e.labelClass),f.appendChild(m)}else mr(f,n,e.label);if(f.dataset.item="",f.dataset.id=e.id,f.dataset.value=p,Ns(f,e,!0),(e.disabled||this.containerOuter.isDisabled)&&f.setAttribute("aria-disabled","true"),this._isSelectElement&&(f.setAttribute("aria-selected","true"),f.setAttribute("role","option")),e.placeholder&&(br(f,d),f.dataset.placeholder=""),br(f,e.highlighted?c:u),i){e.disabled&&xr(f,u),f.dataset.deletable="";var y=document.createElement("button");y.type="button",br(y,h);var g=dr(e);mr(y,!0,pr(s,e.value,g));var v=pr(o,e.value,g);v&&y.setAttribute("aria-label",v),y.dataset.button="",r?f.insertAdjacentElement("afterbegin",y):f.appendChild(y)}return f},choiceList:function(t,e){var i=t.classNames.list,n=document.createElement("div");return br(n,i),e||n.setAttribute("aria-multiselectable","true"),n.setAttribute("role","listbox"),n},choiceGroup:function(t,e){var i=t.allowHTML,n=t.classNames,r=n.group,s=n.groupHeading,o=n.itemDisabled,a=e.id,l=e.label,h=e.disabled,c=cr(l),u=document.createElement("div");br(u,r),h&&br(u,o),u.setAttribute("role","group"),u.dataset.group="",u.dataset.id=a,u.dataset.value=c,h&&u.setAttribute("aria-disabled","true");var d=document.createElement("div");return br(d,s),mr(d,i,l||""),u.appendChild(d),u},choice:function(t,e,i,n){var r=t.allowHTML,s=t.classNames,o=s.item,a=s.itemChoice,l=s.itemSelectable,h=s.selectedState,c=s.itemDisabled,u=s.description,d=s.placeholder,p=e.label,f=cr(e.value),m=document.createElement("div");m.id=e.elementId,br(m,o),br(m,a),n&&"string"==typeof p&&(p=fr(r,p),p={trusted:p+=" (".concat(n,")")});var y=m;if(e.labelClass){var g=document.createElement("span");mr(g,r,p),br(g,e.labelClass),y=g,m.appendChild(g)}else mr(m,r,p);if(e.labelDescription){var v="".concat(e.elementId,"-description");y.setAttribute("aria-describedby",v);var b=document.createElement("span");mr(b,r,e.labelDescription),b.id=v,br(b,u),m.appendChild(b)}return e.selected&&br(m,h),e.placeholder&&br(m,d),m.setAttribute("role",e.group?"treeitem":"option"),m.dataset.choice="",m.dataset.id=e.id,m.dataset.value=f,i&&(m.dataset.selectText=i),e.group&&(m.dataset.groupId="".concat(e.group.id)),Ns(m,e,!1),e.disabled?(br(m,c),m.dataset.choiceDisabled="",m.setAttribute("aria-disabled","true")):(br(m,l),m.dataset.choiceSelectable="",m.setAttribute("aria-selected",e.selected?"true":"false")),m},input:function(t,e){var i=t.classNames,n=i.input,r=i.inputCloned,s=t.labelId,o=document.createElement("input");return o.type="search",br(o,n),br(o,r),o.autocomplete="off",o.autocapitalize="off",o.spellcheck=!1,o.setAttribute("aria-autocomplete","list"),e?o.setAttribute("aria-label",e):s||Fs(this._docRoot,this.passedElement.element.id,o),o},dropdown:function(t){var e=t.classNames,i=e.list,n=e.listDropdown,r=document.createElement("div");return br(r,i),br(r,n),r.setAttribute("aria-expanded","false"),r},notice:function(t,e,i){var n=t.classNames,r=n.item,s=n.itemChoice,o=n.addChoice,a=n.noResults,l=n.noChoices,h=n.notice;void 0===i&&(i=Gr);var c=document.createElement("div");switch(mr(c,!0,e),br(c,r),br(c,s),br(c,h),i){case Br:br(c,o);break;case Fr:br(c,a);break;case Nr:br(c,l)}return i===Br&&(c.dataset.choiceSelectable="",c.dataset.choice=""),c},option:function(t){var e=cr(t.label),i=new Option(e,t.value,!1,t.selected);return Ns(i,t,!0),i.disabled=t.disabled,t.selected&&i.setAttribute("selected",""),i}},Gs="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,zs={},Us=function(t){if(t)return t.dataset.id?parseInt(t.dataset.id,10):void 0},Ws="[data-choice-selectable]",Hs=function(){function t(e,i){void 0===e&&(e="[data-choice]"),void 0===i&&(i={});var n=this;this.initialisedOK=void 0,this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0;var r=t.defaults;this.config=vn(vn(vn({},r.allOptions),r.options),i),Zn.forEach((function(t){n.config[t]=vn(vn(vn({},r.allOptions[t]),r.options[t]),i[t])}));var s=this.config;s.silent||this._validateConfig();var o=s.shadowRoot||document.documentElement;this._docRoot=o;var a="string"==typeof e?o.querySelector(e):e;if(!a||"object"!=typeof a||"INPUT"!==a.tagName&&!Or(a)){if(!a&&"string"==typeof e)throw TypeError("Selector ".concat(e," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}var l=a.type,h=l===Jn;(h||1!==s.maxItemCount)&&(s.singleModeForMultiSelect=!1),s.singleModeForMultiSelect&&(l=tr);var c=l===Qn,u=l===tr,d=c||u;if(this._elementType=l,this._isTextElement=h,this._isSelectOneElement=c,this._isSelectMultipleElement=u,this._isSelectElement=c||u,this._canAddUserChoices=h&&s.addItems||d&&s.addChoices,"boolean"!=typeof s.renderSelectedChoices&&(s.renderSelectedChoices="always"===s.renderSelectedChoices||c),"auto"===s.closeDropdownOnSelect?s.closeDropdownOnSelect=h||c||s.singleModeForMultiSelect:s.closeDropdownOnSelect=Tr(s.closeDropdownOnSelect),s.placeholder&&(s.placeholderValue?this._hasNonChoicePlaceholder=!0:a.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,s.placeholderValue=a.dataset.placeholder)),i.addItemFilter&&"function"!=typeof i.addItemFilter){var p=i.addItemFilter instanceof RegExp?i.addItemFilter:new RegExp(i.addItemFilter);s.addItemFilter=p.test.bind(p)}if(this._isTextElement)this.passedElement=new Ar({element:a,classNames:s.classNames});else{var f=a;this.passedElement=new Ir({element:f,classNames:s.classNames,template:function(t){return n._templates.option(t)},extractPlaceholder:s.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new Dr(s),this._currentValue="",s.searchEnabled=!h&&s.searchEnabled,this._canSearch=s.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(t,e){var i=t.id||t.name&&"".concat(t.name,"-").concat(sr(2))||sr(4);return i=i.replace(/(:|\.|\[|\]|,)/g,""),"".concat(e,"-").concat(i)}(a,"choices-"),this._direction=a.dir,!this._direction){var m=window.getComputedStyle(a).direction;m!==window.getComputedStyle(document.documentElement).direction&&(this._direction=m)}if(this._idNames={itemChoice:"item-choice"},this._templates=r.templates,this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.bind(this),this._onClick=this._onClick.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseOver=this._onMouseOver.bind(this),this._onFormReset=this._onFormReset.bind(this),this._onSelectKey=this._onSelectKey.bind(this),this._onEnterKey=this._onEnterKey.bind(this),this._onEscapeKey=this._onEscapeKey.bind(this),this._onDirectionKey=this._onDirectionKey.bind(this),this._onDeleteKey=this._onDeleteKey.bind(this),this._onChange=this._onChange.bind(this),this._onInvalid=this._onInvalid.bind(this),this.passedElement.isActive)return s.silent||console.warn("Trying to initialise Choices on element already initialised",{element:e}),this.initialised=!0,void(this.initialisedOK=!1);this.init(),this._initialItems=this._store.items.map((function(t){return t.value}))}return Object.defineProperty(t,"defaults",{get:function(){return Object.preventExtensions({get options(){return zs},get allOptions(){return Lr},get templates(){return Bs}})},enumerable:!1,configurable:!0}),t.prototype.init=function(){if(!this.initialised&&void 0===this.initialisedOK){var t;this._searcher=(t=this.config,new Ds(t)),this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),this._isTextElement&&!this.config.addItems||this.passedElement.element.hasAttribute("disabled")||this.passedElement.element.closest("fieldset:disabled")?this.disable():(this.enable(),this._addEventListeners()),this._initStore(),this.initialised=!0,this.initialisedOK=!0;var e=this.config.callbackOnInit;"function"==typeof e&&e.call(this)}},t.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this._store._listeners=[],this.clearStore(!1),this._stopSearch(),this._templates=t.defaults.templates,this.initialised=!1,this.initialisedOK=void 0)},t.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},t.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},t.prototype.highlightItem=function(t,e){if(void 0===e&&(e=!0),!t||!t.id)return this;var i=this._store.items.find((function(e){return e.id===t.id}));return!i||i.highlighted||(this._store.dispatch(rr(i,!0)),e&&this.passedElement.triggerEvent(Nn,dr(i))),this},t.prototype.unhighlightItem=function(t,e){if(void 0===e&&(e=!0),!t||!t.id)return this;var i=this._store.items.find((function(e){return e.id===t.id}));return i&&i.highlighted?(this._store.dispatch(rr(i,!1)),e&&this.passedElement.triggerEvent(Bn,dr(i)),this):this},t.prototype.highlightAll=function(){var t=this;return this._store.withTxn((function(){t._store.items.forEach((function(e){e.highlighted||(t._store.dispatch(rr(e,!0)),t.passedElement.triggerEvent(Nn,dr(e)))}))})),this},t.prototype.unhighlightAll=function(){var t=this;return this._store.withTxn((function(){t._store.items.forEach((function(e){e.highlighted&&(t._store.dispatch(rr(e,!1)),t.passedElement.triggerEvent(Nn,dr(e)))}))})),this},t.prototype.removeActiveItemsByValue=function(t){var e=this;return this._store.withTxn((function(){e._store.items.filter((function(e){return e.value===t})).forEach((function(t){return e._removeItem(t)}))})),this},t.prototype.removeActiveItems=function(t){var e=this;return this._store.withTxn((function(){e._store.items.filter((function(e){return e.id!==t})).forEach((function(t){return e._removeItem(t)}))})),this},t.prototype.removeHighlightedItems=function(t){var e=this;return void 0===t&&(t=!1),this._store.withTxn((function(){e._store.highlightedActiveItems.forEach((function(i){e._removeItem(i),t&&e._triggerChange(i.value)}))})),this},t.prototype.showDropdown=function(t){var e=this;return this.dropdown.isActive||(void 0===t&&(t=!this._canSearch),requestAnimationFrame((function(){e.dropdown.show();var i=e.dropdown.element.getBoundingClientRect();e.containerOuter.open(i.bottom,i.height),t||e.input.focus(),e.passedElement.triggerEvent(Pn);var n=e.choiceList.element.querySelector(vr(e.config.classNames.selectedState));null===n||or(n,e.choiceList.element)||n.scrollIntoView()}))),this},t.prototype.hideDropdown=function(t){var e=this;return this.dropdown.isActive?(this._removeHighlightedChoices(),requestAnimationFrame((function(){e.dropdown.hide(),e.containerOuter.close(),!t&&e._canSearch&&(e.input.removeActiveDescendant(),e.input.blur()),e.passedElement.triggerEvent(On)})),this):this},t.prototype.getValue=function(t){var e=this._store.items.map((function(e){return t?e.value:dr(e)}));return this._isSelectOneElement||this.config.singleModeForMultiSelect?e[0]:e},t.prototype.setValue=function(t){var e=this;return this.initialisedOK?(this._store.withTxn((function(){t.forEach((function(t){t&&e._addChoice(Pr(t,!1))}))})),this._searcher.reset(),this):(this._warnChoicesInitFailed("setValue"),this)},t.prototype.setChoiceByValue=function(t){var e=this;return this.initialisedOK?(this._isTextElement||(this._store.withTxn((function(){(Array.isArray(t)?t:[t]).forEach((function(t){return e._findAndSelectChoiceByValue(t)})),e.unhighlightAll()})),this._searcher.reset()),this):(this._warnChoicesInitFailed("setChoiceByValue"),this)},t.prototype.setChoices=function(t,e,i,n,r,s){var o=this;if(void 0===t&&(t=[]),void 0===e&&(e="value"),void 0===i&&(i="label"),void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===s&&(s=!1),!this.initialisedOK)return this._warnChoicesInitFailed("setChoices"),this;if(!this._isSelectElement)throw new TypeError("setChoices can't be used with INPUT based Choices");if("string"!=typeof e||!e)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if("function"==typeof t){var a=t(this);if("function"==typeof Promise&&a instanceof Promise)return new Promise((function(t){return requestAnimationFrame(t)})).then((function(){return o._handleLoadingState(!0)})).then((function(){return a})).then((function(t){return o.setChoices(t,e,i,n,r,s)})).catch((function(t){o.config.silent||console.error(t)})).then((function(){return o._handleLoadingState(!1)})).then((function(){return o}));if(!Array.isArray(a))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof a));return this.setChoices(a,e,i,!1)}if(!Array.isArray(t))throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices");return this.containerOuter.removeLoadingState(),this._store.withTxn((function(){r&&(o._isSearching=!1),n&&o.clearChoices(!0,s);var a="value"===e,l="label"===i;t.forEach((function(t){if("choices"in t){var n=t;l||(n=vn(vn({},n),{label:n[i]})),o._addGroup(Pr(n,!0))}else{var r=t;l&&a||(r=vn(vn({},r),{value:r[e],label:r[i]}));var s=Pr(r,!1);o._addChoice(s),s.placeholder&&!o._hasNonChoicePlaceholder&&(o._placeholderValue=ur(s.label))}})),o.unhighlightAll()})),this._searcher.reset(),this},t.prototype.refresh=function(t,e,i){var n=this;return void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=!1),this._isSelectElement?(this._store.withTxn((function(){var r=n.passedElement.optionsAsChoices(),s={};i||n._store.items.forEach((function(t){t.id&&t.active&&t.selected&&(s[t.value]=!0)})),n.clearStore(!1);var o=function(t){i?n._store.dispatch(nr(t)):s[t.value]&&(t.selected=!0)};r.forEach((function(t){"choices"in t?t.choices.forEach(o):o(t)})),n._addPredefinedChoices(r,e,t),n._isSearching&&n._searchChoices(n.input.value)})),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a <select> element"),this)},t.prototype.removeChoice=function(t){var e=this._store.choices.find((function(e){return e.value===t}));return e?(this._clearNotice(),this._store.dispatch(function(t){return{type:wn,choice:t}}(e)),this._searcher.reset(),e.selected&&this.passedElement.triggerEvent(Dn,dr(e)),this):this},t.prototype.clearChoices=function(t,e){var i=this;return void 0===t&&(t=!0),void 0===e&&(e=!1),t&&(e?this.passedElement.element.replaceChildren(""):this.passedElement.element.querySelectorAll(":not([selected])").forEach((function(t){t.remove()}))),this.itemList.element.replaceChildren(""),this.choiceList.element.replaceChildren(""),this._clearNotice(),this._store.withTxn((function(){var t=e?[]:i._store.items;i._store.reset(),t.forEach((function(t){i._store.dispatch(er(t)),i._store.dispatch(ir(t))}))})),this._searcher.reset(),this},t.prototype.clearStore=function(t){return void 0===t&&(t=!0),this.clearChoices(t,!0),this._stopSearch(),this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this},t.prototype.clearInput=function(){var t=!this._isSelectOneElement;return this.input.clear(t),this._stopSearch(),this},t.prototype._validateConfig=function(){var t,e,i,n,r=this.config,s=(t=r,e=Lr,i=Object.keys(t).sort(),n=Object.keys(e).sort(),i.filter((function(t){return n.indexOf(t)<0})));s.length&&console.warn("Unknown config option(s) passed",s.join(", ")),r.allowHTML&&r.allowHtmlUserInput&&(r.addItems&&console.warn("Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks"),r.addChoices&&console.warn("Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks"))},t.prototype._render=function(t){void 0===t&&(t={choices:!0,groups:!0,items:!0}),this._store.inTxn()||(this._isSelectElement&&(t.choices||t.groups)&&this._renderChoices(),t.items&&this._renderItems())},t.prototype._renderChoices=function(){var t=this;if(this._canAddItems()){var e=this.config,i=this._isSearching,n=this._store,r=n.activeGroups,s=n.activeChoices,o=i?e.searchResultLimit:e.renderChoiceLimit;if(this._isSelectElement){var a=s.filter((function(t){return!t.element}));a.length&&this.passedElement.addOptions(a)}var l=document.createDocumentFragment(),h=function(t){return t.filter((function(t){return!t.placeholder&&(i?(e.searchRenderSelectedChoices||!t.selected)&&!!t.rank:e.renderSelectedChoices||!t.selected)}))},c=e.appendGroupInSearch&&i,u=!1,d=null,p=function(n,r){i?n.sort(yr):e.shouldSort&&n.sort(e.sorter);var s=n.length;s=!r&&o>0&&s>o?o:s,s--,n.every((function(n,r){var o=n.choiceEl||t._templates.choice(e,n,e.itemSelectText,c&&n.group?n.group.label:void 0);return n.choiceEl=o,l.appendChild(o),i||!n.selected?u=!0:d||(d=o),r<s}))};s.length&&(e.resetScrollPosition&&requestAnimationFrame((function(){return t.choiceList.scrollToTop()})),this._hasNonChoicePlaceholder||i||!this._isSelectOneElement||p(s.filter((function(t){return t.placeholder&&!t.group})),!1),r.length&&!i?(e.shouldSort&&r.sort(e.sorter),p(s.filter((function(t){return!t.placeholder&&!t.group})),!1),r.forEach((function(e){var i=h(e.choices);if(i.length){if(e.label){var n=e.groupEl||t._templates.choiceGroup(t.config,e);e.groupEl=n,n.remove(),l.appendChild(n)}p(i,!0)}}))):p(h(s),!1)),u||!i&&l.children.length&&e.renderSelectedChoices||(this._notice||(this._notice={text:hr(i?e.noResultsText:e.noChoicesText),type:i?Fr:Nr}),l.replaceChildren("")),this._renderNotice(l),this.choiceList.element.replaceChildren(l),this._highlightChoice(d)}},t.prototype._renderItems=function(){var t=this,e=this._store.items||[],i=this.itemList.element,n=this.config,r=document.createDocumentFragment(),s=function(t){return i.querySelector('[data-item][data-id="'.concat(t.id,'"]'))},o=function(e){var i=e.itemEl;i&&i.parentElement||(i=s(e)||t._templates.item(n,e,n.removeItemButton),e.itemEl=i,r.appendChild(i))};e.forEach(o);var a=!!r.childNodes.length;if(this._isSelectOneElement){var l=i.children.length;if(a||l>1){var h=i.querySelector(vr(n.classNames.placeholder));h&&h.remove()}else a||l||!this._placeholderValue||(a=!0,o(Pr({selected:!0,value:"",label:this._placeholderValue,placeholder:!0},!1)))}a&&(i.append(r),n.shouldSortItems&&!this._isSelectOneElement&&(e.sort(n.sorter),e.forEach((function(t){var e=s(t);e&&(e.remove(),r.append(e))})),i.append(r))),this._isTextElement&&(this.passedElement.value=e.map((function(t){return t.value})).join(n.delimiter))},t.prototype._displayNotice=function(t,e,i){void 0===i&&(i=!0);var n=this._notice;n&&(n.type===e&&n.text===t||n.type===Br&&(e===Fr||e===Nr))?i&&this.showDropdown(!0):(this._clearNotice(),this._notice=t?{text:t,type:e}:void 0,this._renderNotice(),i&&t&&this.showDropdown(!0))},t.prototype._clearNotice=function(){if(this._notice){var t=this.choiceList.element.querySelector(vr(this.config.classNames.notice));t&&t.remove(),this._notice=void 0}},t.prototype._renderNotice=function(t){var e=this._notice;if(e){var i=this._templates.notice(this.config,e.text,e.type);t?t.append(i):this.choiceList.prepend(i)}},t.prototype._getChoiceForOutput=function(t,e){return dr(t,e)},t.prototype._triggerChange=function(t){null!=t&&this.passedElement.triggerEvent(In,{value:t})},t.prototype._handleButtonAction=function(t){var e=this,i=this._store.items;if(i.length&&this.config.removeItems&&this.config.removeItemButton){var n=t&&Us(t.closest("[data-id]")),r=n&&i.find((function(t){return t.id===n}));r&&this._store.withTxn((function(){if(e._removeItem(r),e._triggerChange(r.value),e._isSelectOneElement&&!e._hasNonChoicePlaceholder){var t=(e.config.shouldSort?e._store.choices.reverse():e._store.choices).find((function(t){return t.placeholder}));t&&(e._addItem(t),e.unhighlightAll(),t.value&&e._triggerChange(t.value))}}))}},t.prototype._handleItemAction=function(t,e){var i=this;void 0===e&&(e=!1);var n=this._store.items;if(n.length&&this.config.removeItems&&!this._isSelectOneElement){var r=Us(t);r&&(n.forEach((function(t){t.id!==r||t.highlighted?!e&&t.highlighted&&i.unhighlightItem(t):i.highlightItem(t)})),this.input.focus())}},t.prototype._handleChoiceAction=function(t){var e=this,i=Us(t),n=i&&this._store.getChoiceById(i);if(!n||n.disabled)return!1;var r=this.dropdown.isActive;if(!n.selected){if(!this._canAddItems())return!0;this._store.withTxn((function(){e._addItem(n,!0,!0),e.clearInput(),e.unhighlightAll()})),this._triggerChange(n.value)}return r&&this.config.closeDropdownOnSelect&&(this.hideDropdown(!0),this.containerOuter.element.focus()),!0},t.prototype._handleBackspace=function(t){var e=this.config;if(e.removeItems&&t.length){var i=t[t.length-1],n=t.some((function(t){return t.highlighted}));e.editItems&&!n&&i?(this.input.value=i.value,this.input.setWidth(),this._removeItem(i),this._triggerChange(i.value)):(n||this.highlightItem(i,!1),this.removeHighlightedItems(!0))}},t.prototype._loadChoices=function(){var t,e=this,i=this.config;if(this._isTextElement){if(this._presetChoices=i.items.map((function(t){return Pr(t,!1)})),this.passedElement.value){var n=this.passedElement.value.split(i.delimiter).map((function(t){return Pr(t,!1,e.config.allowHtmlUserInput)}));this._presetChoices=this._presetChoices.concat(n)}this._presetChoices.forEach((function(t){t.selected=!0}))}else if(this._isSelectElement){this._presetChoices=i.choices.map((function(t){return Pr(t,!0)}));var r=this.passedElement.optionsAsChoices();r&&(t=this._presetChoices).push.apply(t,r)}},t.prototype._handleLoadingState=function(t){void 0===t&&(t=!0);var e=this.itemList.element;t?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?e.replaceChildren(this._templates.placeholder(this.config,this.config.loadingText)):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?(e.replaceChildren(""),this._render()):this.input.placeholder=this._placeholderValue||"")},t.prototype._handleSearch=function(t){if(this.input.isFocussed)if(null!=t&&t.length>=this.config.searchFloor){var e=this.config.searchChoices?this._searchChoices(t):0;null!==e&&this.passedElement.triggerEvent(Rn,{value:t,resultCount:e})}else this._store.choices.some((function(t){return!t.active}))&&this._stopSearch()},t.prototype._canAddItems=function(){var t=this.config,e=t.maxItemCount,i=t.maxItemText;return!t.singleModeForMultiSelect&&e>0&&e<=this._store.items.length?(this.choiceList.element.replaceChildren(""),this._notice=void 0,this._displayNotice("function"==typeof i?i(e):i,Br),!1):(this._notice&&this._notice.type===Br&&this._clearNotice(),!0)},t.prototype._canCreateItem=function(t){var e=this.config,i=!0,n="";if((i&&"function"==typeof e.addItemFilter&&!e.addItemFilter(t)&&(i=!1,n=pr(e.customAddItemText,t,void 0)),i)&&this._store.choices.find((function(i){return e.valueComparer(i.value,t)}))){if(this._isSelectElement)return this._displayNotice("",Br),!1;e.duplicateItemsAllowed||(i=!1,n=pr(e.uniqueItemText,t,void 0))}return i&&(n=pr(e.addItemText,t,void 0)),n&&this._displayNotice(n,Br),i},t.prototype._searchChoices=function(t){var e=t.trim().replace(/\s{2,}/," ");if(!e.length||e===this._currentValue)return null;var i=this._searcher;i.isEmptyIndex()&&i.index(this._store.searchableChoices);var n=i.search(e);this._currentValue=e,this._highlightPosition=0,this._isSearching=!0;var r=this._notice;return(r&&r.type)!==Br&&(n.length?this._clearNotice():this._displayNotice(hr(this.config.noResultsText),Fr)),this._store.dispatch(function(t){return{type:Sn,results:t}}(n)),n.length},t.prototype._stopSearch=function(){this._isSearching&&(this._currentValue="",this._isSearching=!1,this._clearNotice(),this._store.dispatch({type:Cn,active:!0}),this.passedElement.triggerEvent(Rn,{value:"",resultCount:0}))},t.prototype._addEventListeners=function(){var t=this._docRoot,e=this.containerOuter.element,i=this.input.element,n=this.passedElement.element;t.addEventListener("touchend",this._onTouchEnd,!0),e.addEventListener("keydown",this._onKeyDown,!0),e.addEventListener("mousedown",this._onMouseDown,!0),t.addEventListener("click",this._onClick,{passive:!0}),t.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(e.addEventListener("focus",this._onFocus,{passive:!0}),e.addEventListener("blur",this._onBlur,{passive:!0})),i.addEventListener("keyup",this._onKeyUp,{passive:!0}),i.addEventListener("input",this._onInput,{passive:!0}),i.addEventListener("focus",this._onFocus,{passive:!0}),i.addEventListener("blur",this._onBlur,{passive:!0}),i.form&&i.form.addEventListener("reset",this._onFormReset,{passive:!0}),n.hasAttribute("required")&&(n.addEventListener("change",this._onChange,{passive:!0}),n.addEventListener("invalid",this._onInvalid,{passive:!0})),this.input.addEventListeners()},t.prototype._removeEventListeners=function(){var t=this._docRoot,e=this.containerOuter.element,i=this.input.element,n=this.passedElement.element;t.removeEventListener("touchend",this._onTouchEnd,!0),e.removeEventListener("keydown",this._onKeyDown,!0),e.removeEventListener("mousedown",this._onMouseDown,!0),t.removeEventListener("click",this._onClick),t.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(e.removeEventListener("focus",this._onFocus),e.removeEventListener("blur",this._onBlur)),i.removeEventListener("keyup",this._onKeyUp),i.removeEventListener("input",this._onInput),i.removeEventListener("focus",this._onFocus),i.removeEventListener("blur",this._onBlur),i.form&&i.form.removeEventListener("reset",this._onFormReset),n.hasAttribute("required")&&(n.removeEventListener("change",this._onChange),n.removeEventListener("invalid",this._onInvalid)),this.input.removeEventListeners()},t.prototype._onKeyDown=function(t){var e=t.keyCode,i=this.dropdown.isActive,n=1===t.key.length||2===t.key.length&&t.key.charCodeAt(0)>=55296||"Unidentified"===t.key;switch(this._isTextElement||i||e===Xn||e===Gn||e===zn||(this.showDropdown(),!this.input.isFocussed&&n&&(this.input.value+=t.key," "===t.key&&t.preventDefault())),e){case Vn:return this._onSelectKey(t,this.itemList.element.hasChildNodes());case Hn:return this._onEnterKey(t,i);case Xn:return this._onEscapeKey(t,i);case Yn:case qn:case $n:case Kn:return this._onDirectionKey(t,i);case Wn:case Un:return this._onDeleteKey(t,this._store.items,this.input.isFocussed)}},t.prototype._onKeyUp=function(){this._canSearch=this.config.searchEnabled},t.prototype._onInput=function(){var t=this.input.value;t?this._canAddItems()&&(this._canSearch&&this._handleSearch(t),this._canAddUserChoices&&(this._canCreateItem(t),this._isSelectElement&&(this._highlightPosition=0,this._highlightChoice()))):this._isTextElement?this.hideDropdown(!0):this._stopSearch()},t.prototype._onSelectKey=function(t,e){(t.ctrlKey||t.metaKey)&&e&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},t.prototype._onEnterKey=function(t,e){var i=this,n=this.input.value,r=t.target;if(t.preventDefault(),r&&r.hasAttribute("data-button"))this._handleButtonAction(r);else if(e){var s=this.dropdown.element.querySelector(vr(this.config.classNames.highlightedState));if(!s||!this._handleChoiceAction(s))if(r&&n){if(this._canAddItems()){var o=!1;this._store.withTxn((function(){if(!(o=i._findAndSelectChoiceByValue(n,!0))){if(!i._canAddUserChoices)return;if(!i._canCreateItem(n))return;i._addChoice(Pr(n,!1,i.config.allowHtmlUserInput),!0,!0),o=!0}i.clearInput(),i.unhighlightAll()})),o&&(this._triggerChange(n),this.config.closeDropdownOnSelect&&this.hideDropdown(!0))}}else this.hideDropdown(!0)}else(this._isSelectElement||this._notice)&&this.showDropdown()},t.prototype._onEscapeKey=function(t,e){e&&(t.stopPropagation(),this.hideDropdown(!0),this._stopSearch(),this.containerOuter.element.focus())},t.prototype._onDirectionKey=function(t,e){var i=t.keyCode;if(e||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var n=i===$n||i===Kn?1:-1,r=void 0;if(t.metaKey||i===Kn||i===qn)r=n>0?this.dropdown.element.querySelector("".concat(Ws,":last-of-type")):this.dropdown.element.querySelector(Ws);else{var s=this.dropdown.element.querySelector(vr(this.config.classNames.highlightedState));r=s?function(t,e,i){void 0===i&&(i=1);for(var n="".concat(i>0?"next":"previous","ElementSibling"),r=t[n];r;){if(r.matches(e))return r;r=r[n]}return null}(s,Ws,n):this.dropdown.element.querySelector(Ws)}r&&(or(r,this.choiceList.element,n)||this.choiceList.scrollToChildElement(r,n),this._highlightChoice(r)),t.preventDefault()}},t.prototype._onDeleteKey=function(t,e,i){this._isSelectOneElement||t.target.value||!i||(this._handleBackspace(e),t.preventDefault())},t.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},t.prototype._onTouchEnd=function(t){var e=(t||t.touches[0]).target;this._wasTap&&this.containerOuter.element.contains(e)&&((e===this.containerOuter.element||e===this.containerInner.element)&&(this._isTextElement?this.input.focus():this._isSelectMultipleElement&&this.showDropdown()),t.stopPropagation());this._wasTap=!0},t.prototype._onMouseDown=function(t){var e=t.target;if(e instanceof Element){if(Gs&&this.choiceList.element.contains(e)){var i=this.choiceList.element.firstElementChild;this._isScrollingOnIe="ltr"===this._direction?t.offsetX>=i.offsetWidth:t.offsetX<i.offsetLeft}if(e!==this.input.element){var n=e.closest("[data-button],[data-item],[data-choice]");n instanceof HTMLElement&&("button"in n.dataset?this._handleButtonAction(n):"item"in n.dataset?this._handleItemAction(n,t.shiftKey):"choice"in n.dataset&&this._handleChoiceAction(n)),t.preventDefault()}}},t.prototype._onMouseOver=function(t){var e=t.target;e instanceof HTMLElement&&"choice"in e.dataset&&this._highlightChoice(e)},t.prototype._onClick=function(t){var e=t.target,i=this.containerOuter;i.element.contains(e)?this.dropdown.isActive||i.isDisabled?this._isSelectOneElement&&e!==this.input.element&&!this.dropdown.element.contains(e)&&this.hideDropdown():this._isTextElement?document.activeElement!==this.input.element&&this.input.focus():(this.showDropdown(),i.element.focus()):(i.removeFocusState(),this.hideDropdown(!0),this.unhighlightAll())},t.prototype._onFocus=function(t){var e=t.target,i=this.containerOuter;if(e&&i.element.contains(e)){var n=e===this.input.element;this._isTextElement?n&&i.addFocusState():this._isSelectMultipleElement?n&&(this.showDropdown(!0),i.addFocusState()):(i.addFocusState(),n&&this.showDropdown(!0))}},t.prototype._onBlur=function(t){var e=t.target,i=this.containerOuter;e&&i.element.contains(e)&&!this._isScrollingOnIe?e===this.input.element?(i.removeFocusState(),this.hideDropdown(!0),(this._isTextElement||this._isSelectMultipleElement)&&this.unhighlightAll()):e===this.containerOuter.element&&(i.removeFocusState(),this.config.searchEnabled||this.hideDropdown(!0)):(this._isScrollingOnIe=!1,this.input.element.focus())},t.prototype._onFormReset=function(){var t=this;this._store.withTxn((function(){t.clearInput(),t.hideDropdown(),t.refresh(!1,!1,!0),t._initialItems.length&&t.setChoiceByValue(t._initialItems)}))},t.prototype._onChange=function(t){t.target.checkValidity()&&this.containerOuter.removeInvalidState()},t.prototype._onInvalid=function(){this.containerOuter.addInvalidState()},t.prototype._removeHighlightedChoices=function(){var t=this.config.classNames.highlightedState;Array.from(this.dropdown.element.querySelectorAll(vr(t))).forEach((function(e){xr(e,t),e.setAttribute("aria-selected","false")}))},t.prototype._highlightChoice=function(t){void 0===t&&(t=null);var e=Array.from(this.dropdown.element.querySelectorAll(Ws));if(e.length){var i=t,n=this.config.classNames.highlightedState;this._removeHighlightedChoices(),i?this._highlightPosition=e.indexOf(i):(i=e.length>this._highlightPosition?e[this._highlightPosition]:e[e.length-1])||(i=e[0]),br(i,n),i.setAttribute("aria-selected","true"),this.passedElement.triggerEvent(Fn,{el:i}),this.dropdown.isActive&&(this.input.setActiveDescendant(i.id),this.containerOuter.setActiveDescendant(i.id))}},t.prototype._addItem=function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),!t.id)throw new TypeError("item.id must be set before _addItem is called for a choice/item");if((this.config.singleModeForMultiSelect||this._isSelectOneElement)&&this.removeActiveItems(t.id),this._store.dispatch(ir(t)),e){var n=dr(t);this.passedElement.triggerEvent(jn,n),i&&this.passedElement.triggerEvent(Ln,n)}},t.prototype._removeItem=function(t){if(t.id){this._store.dispatch(nr(t));var e=this._notice;e&&e.type===Nr&&this._clearNotice(),this.passedElement.triggerEvent(Dn,dr(t))}},t.prototype._addChoice=function(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t.id)throw new TypeError("Can not re-add a choice which has already been added");var n=this.config;if(n.duplicateItemsAllowed||!this._store.choices.find((function(e){return n.valueComparer(e.value,t.value)}))){this._lastAddedChoiceId++,t.id=this._lastAddedChoiceId,t.elementId="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(t.id);var r=n.prependValue,s=n.appendValue;r&&(t.value=r+t.value),s&&(t.value+=s.toString()),(r||s)&&t.element&&(t.element.value=t.value),this._clearNotice(),this._store.dispatch(er(t)),t.selected&&this._addItem(t,e,i)}},t.prototype._addGroup=function(t,e){var i=this;if(void 0===e&&(e=!0),t.id)throw new TypeError("Can not re-add a group which has already been added");this._store.dispatch(function(t){return{type:kn,group:t}}(t)),t.choices&&(this._lastAddedGroupId++,t.id=this._lastAddedGroupId,t.choices.forEach((function(n){n.group=t,t.disabled&&(n.disabled=!0),i._addChoice(n,e)})))},t.prototype._createTemplates=function(){var t=this,e=this.config.callbackOnCreateTemplates,i={};"function"==typeof e&&(i=e.call(this,lr,fr,gr));var n={};Object.keys(this._templates).forEach((function(e){n[e]=e in i?i[e].bind(t):t._templates[e].bind(t)})),this._templates=n},t.prototype._createElements=function(){var t=this._templates,e=this.config,i=this._isSelectOneElement,n=e.position,r=e.classNames,s=this._elementType;this.containerOuter=new Sr({element:t.containerOuter(e,this._direction,this._isSelectElement,i,e.searchEnabled,s,e.labelId),classNames:r,type:s,position:n}),this.containerInner=new Sr({element:t.containerInner(e),classNames:r,type:s,position:n}),this.input=new Cr({element:t.input(e,this._placeholderValue),classNames:r,type:s,preventPaste:!e.paste}),this.choiceList=new Er({element:t.choiceList(e,i)}),this.itemList=new Er({element:t.itemList(e,i)}),this.dropdown=new wr({element:t.dropdown(e),classNames:r,type:s})},t.prototype._createStructure=function(){var t=this,e=t.containerInner,i=t.containerOuter,n=t.passedElement,r=this.dropdown.element;n.conceal(),e.wrap(n.element),i.wrap(e.element),i.element.appendChild(e.element),i.element.appendChild(r),e.element.appendChild(this.itemList.element),r.appendChild(this.choiceList.element),this._isSelectOneElement?(this.input.placeholder=this.config.searchPlaceholderValue||"",this.config.searchEnabled&&r.insertBefore(this.input.element,r.firstChild)):(this._isSelectMultipleElement&&!this.config.searchEnabled||e.element.appendChild(this.input.element),this._placeholderValue&&(this.input.placeholder=this._placeholderValue),this.input.setWidth()),this._highlightPosition=0,this._isSearching=!1},t.prototype._initStore=function(){var t=this;this._store.subscribe(this._render).withTxn((function(){t._addPredefinedChoices(t._presetChoices,t._isSelectOneElement&&!t._hasNonChoicePlaceholder,!1)})),(!this._store.choices.length||this._isSelectOneElement&&this._hasNonChoicePlaceholder)&&this._render()},t.prototype._addPredefinedChoices=function(t,e,i){var n=this;(void 0===e&&(e=!1),void 0===i&&(i=!0),e)&&(-1===t.findIndex((function(t){return t.selected}))&&t.some((function(t){return!t.disabled&&!("choices"in t)&&(t.selected=!0,!0)})));t.forEach((function(t){"choices"in t?n._isSelectElement&&n._addGroup(t,i):n._addChoice(t,i)}))},t.prototype._findAndSelectChoiceByValue=function(t,e){var i=this;void 0===e&&(e=!1);var n=this._store.choices.find((function(e){return i.config.valueComparer(e.value,t)}));return!(!n||n.disabled||n.selected)&&(this._addItem(n,!0,e),!0)},t.prototype._generatePlaceholderValue=function(){var t=this.config;if(!t.placeholder)return null;if(this._hasNonChoicePlaceholder)return t.placeholderValue;if(this._isSelectElement){var e=this.passedElement.placeholderOption;return e?e.text:null}return null},t.prototype._warnChoicesInitFailed=function(t){if(!this.config.silent){if(!this.initialised)throw new TypeError("".concat(t," called on a non-initialised instance of Choices"));if(!this.initialisedOK)throw new TypeError("".concat(t," called for an element which has multiple instances of Choices initialised on it"))}},t.version="11.2.1",t}(),Vs=r(5072),Xs=r.n(Vs),Ys=r(7825),$s=r.n(Ys),qs=r(7659),Ks=r.n(qs),Zs=r(5056),Js=r.n(Zs),Qs=r(540),to=r.n(Qs),eo=r(1113),io=r.n(eo),no=r(5870),ro={};ro.styleTagTransform=io(),ro.setAttributes=Js(),ro.insert=Ks().bind(null,"head"),ro.domAPI=$s(),ro.insertStyleElement=to();Xs()(no.A,ro);no.A&&no.A.locals&&no.A.locals;function so(t){return so="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},so(t)}function oo(t){return function(t){if(Array.isArray(t))return ao(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ao(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ao(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ao(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function lo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ho(n.key),n)}}function ho(t){var e=function(t,e){if("object"!=so(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=so(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==so(e)?e:e+""}var co=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP JSON HERE",this._initDrop(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"120px"})}},{key:"_createToolbox",value:function(){var t=this;this.toolbox=document.createElement("div"),Object.assign(this.toolbox.style,{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"}),this.counter=document.createElement("div"),this.counter.textContent="Records: 0",Object.assign(this.counter.style,{fontFamily:"sans-serif",fontSize:"13px",color:"#555"});var e=document.createElement("div");this.clearBtn=document.createElement("button"),this.clearBtn.textContent="Clear",this.clearBtn.disabled=!0,this.clearBtn.addEventListener("click",(function(){t._renderBase()})),e.appendChild(this.clearBtn),this.toolbox.appendChild(this.counter),this.toolbox.appendChild(e),this.container.appendChild(this.toolbox)}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888",fontFamily:"sans-serif",pointerEvents:"none",userSelect:"none"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"_hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"_initDrop",value:function(){var t=this;this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background=""})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="";var i=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain");if(i)try{var n=JSON.parse(i).data;Array.isArray(n)?t.render(n):t._showPlaceholder()}catch(e){console.error("Invalid JSON dropped",e),t._showPlaceholder()}else t._showPlaceholder()}))}},{key:"render",value:function(t){var e=this;if(Array.isArray(t)&&0!==t.length){this.data=t,this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._hidePlaceholder(),this.clearBtn.disabled=!1,this.counter.textContent="Records: ".concat(t.length);var i=document.createElement("table");Object.assign(i.style,{borderCollapse:"separate",borderSpacing:"0 4px",width:"100%",fontFamily:"sans-serif",fontSize:"14px"});var n=document.createElement("thead"),r=document.createElement("tr");["Field","# Variants","Values","Attractor",,"Orbit","Sum","Split UP","Split Right","Histogram","Color"].forEach((function(t){var e=document.createElement("th");e.textContent=t,Object.assign(e.style,{border:"none",padding:"6px",background:"#eaeaea",textAlign:"left"}),r.appendChild(e)})),n.appendChild(r),i.appendChild(n);var s=document.createElement("tbody");Object.keys(t[0]).forEach((function(i,n){var r=t.map((function(t){return t[i]})).filter((function(t){return null!=t}));if(r.length){var o=e._detectType(r),a=oo(new Set(r)),l=document.createElement("tr"),h=document.createElement("td");h.textContent=i,Object.assign(h.style,{border:"none",padding:"6px",fontWeight:"bold"});var c=document.createElement("td");c.textContent=a.length,Object.assign(c.style,{border:"none",padding:"6px",textAlign:"center"});var u=document.createElement("td");Object.assign(u.style,{border:"none",padding:"6px"});var d=null;if("categorical"===o){var p=document.createElement("select");a.forEach((function(t){var e=document.createElement("option");e.value=t,e.textContent=t,p.appendChild(e)})),u.appendChild(p),new Hs(p,{searchEnabled:!0,itemSelectText:"",shouldSort:!1});var f=p.closest(".choices");if(f){Object.assign(f.style,{minWidth:"180px",maxWidth:"220px"});var m=f.querySelector(".choices__inner");m&&Object.assign(m.style,{background:"#f8fafc",border:"1px solid #cbd5e1",borderRadius:"8px",minHeight:"34px",padding:"4px 8px",fontSize:"13px"});var y=f.querySelector(".choices__list--dropdown");y&&Object.assign(y.style,{border:"1px solid #cbd5e1",borderRadius:"8px",background:"#ffffff",boxShadow:"0 4px 10px rgba(0,0,0,0.08)"})}d=a[0],p.addEventListener("change",(function(t){d=p.value,console.log("SELECTED V",d)}))}else{var g=r.map((function(t){return Number(t)})).filter((function(t){return!isNaN(t)}));u.textContent=g.length?"min: ".concat(Math.min.apply(Math,oo(g))," | max: ").concat(Math.max.apply(Math,oo(g))):"No numeric data"}var v=function(t,e){var i=document.createElement("td"),n=document.createElement("div");n.setAttribute("draggable","true"),Object.assign(n.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",borderRadius:"6px",cursor:"grab"});var r=document.createElement("i");return r.className=t,r.style.pointerEvents="none",n.appendChild(r),n.addEventListener("dragstart",(function(t){var i=e(),n=JSON.stringify(i,null,2);t.dataTransfer.setData("application/json",n),t.dataTransfer.setData("text/plain",n)})),i.appendChild(n),i},b=document.createElement("td");Object.assign(b.style,{border:"none",padding:"6px",textAlign:"center"});var x="#ff0000",_=document.createElement("input");_.type="color",_.value=x,_.addEventListener("input",(function(t){x=t.target.value}));var w=document.createElement("div");w.setAttribute("draggable","true"),Object.assign(w.style,{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"6px",cursor:"grab",marginLeft:"6px"});var S=document.createElement("i");S.className="fa-solid fa-palette",S.style.pointerEvents="none",w.appendChild(S),w.addEventListener("dragstart",(function(t){var e,n={type:"color-rule",field:i,equals:d,color:(e=x,parseInt(e.replace("#","0x"),16))},r=JSON.stringify(n,null,2);t.dataTransfer.setData("application/json",r),t.dataTransfer.setData("text/plain",r)})),b.appendChild(_),b.appendChild(w);var C=v("fa-solid fa-magnet",(function(){return e._buildAttractorPayload(i,d)})),E=document.createElement("td"),k=document.createElement("div");k.setAttribute("draggable","true"),k.textContent="🪐",Object.assign(k.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"6px",cursor:"grab",fontSize:"14px",userSelect:"none"}),k.addEventListener("dragstart",(function(t){var e={type:"scalarField",field:i},n=JSON.stringify(e);t.dataTransfer.setData("application/json",n),t.dataTransfer.setData("text/plain",n)})),E.appendChild(k);var A=document.createElement("td"),T=document.createElement("div");T.setAttribute("draggable","true"),T.textContent="∑",Object.assign(T.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"6px",cursor:"grab",fontSize:"14px",userSelect:"none"}),T.addEventListener("dragstart",(function(t){var e={type:"sumField",field:i},n=JSON.stringify(e);t.dataTransfer.setData("application/json",n),t.dataTransfer.setData("text/plain",n)})),A.appendChild(T);var M=v("fa-solid fa-arrow-up",(function(){return e._buildSplitterPayload(i,"up")})),P=v("fa-solid fa-arrow-right",(function(){return e._buildSplitterPayload(i,"right")})),O=v("fa-solid fa-chart-column",(function(){return e._buildHistogramPayload(i)}));l.appendChild(h),l.appendChild(c),l.appendChild(u),l.appendChild(C),l.appendChild(E),l.appendChild(A),l.appendChild(M),l.appendChild(P),l.appendChild(O),l.appendChild(b);var I=l.querySelectorAll("td"),L=n%2==0?"#dbeafe":"#ffffff";I.forEach((function(t){t.style.background=L})),s.appendChild(l)}})),i.appendChild(s);var o=document.createElement("div");Object.assign(o.style,{position:"absolute",top:"42px",left:"0",right:"0",bottom:"0",overflow:"auto",padding:"10px",boxSizing:"border-box"}),o.appendChild(i),this.container.appendChild(o)}else this._showPlaceholder()}},{key:"_buildAttractorPayload",value:function(t,e){return{type:"planet",label:e,rule:{op:"and",rules:[{field:t,op:"eq",value:e}]}}}},{key:"_buildSplitterPayload",value:function(t,e){var i={type:"vector",vector:!0,scalarField:t,direction:"up"==e?{x:0,y:1}:{x:1,y:0},length:1200,rule:{op:"and",rules:[]}};return console.log("vector",i),i}},{key:"_buildHistogramPayloadOLD",value:function(t){var e={};return this.data.forEach((function(i){var n=i[t];n||(n="EMPTY"),e[n]=(e[n]||0)+1})),{type:"histogram",field:t,data:Object.keys(e).map((function(t){return{value:t,count:e[t]}}))}}},{key:"_buildHistogramPayload",value:function(t){return{type:"histogram",field:t,data:this.data}}},{key:"_detectType",value:function(t){var e=t.filter((function(t){return""!==t&&null!=t}));return e.length&&e.map(Number).filter((function(t){return!isNaN(t)})).length===e.length?"scalar":"categorical"}}],e&&lo(t.prototype,e),i&&lo(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function uo(t){return uo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uo(t)}function po(t){return function(t){if(Array.isArray(t))return fo(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return fo(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?fo(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fo(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function mo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,yo(n.key),n)}}function yo(t){var e=function(t,e){if("object"!=uo(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=uo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==uo(e)?e:e+""}var go=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP JSON HERE",this._initDrop(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"120px"})}},{key:"_createToolbox",value:function(){var t=this;this.toolbox=document.createElement("div"),Object.assign(this.toolbox.style,{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"}),this.counter=document.createElement("div"),this.counter.textContent="Records: 0",Object.assign(this.counter.style,{fontFamily:"sans-serif",fontSize:"13px",color:"#555"});var e=document.createElement("div");this.clearBtn=document.createElement("button"),this.clearBtn.textContent="Clear",this.clearBtn.disabled=!0,this.clearBtn.addEventListener("click",(function(){t._renderBase()})),e.appendChild(this.clearBtn),this.toolbox.appendChild(this.counter),this.toolbox.appendChild(e),this.container.appendChild(this.toolbox)}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888",fontFamily:"sans-serif",pointerEvents:"none",userSelect:"none"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"_hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"_initDrop",value:function(){var t=this;this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background=""})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="";var i=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain");if(i)try{var n=JSON.parse(i).data;Array.isArray(n)?t.render(n):t._showPlaceholder()}catch(e){console.error("Invalid JSON dropped",e),t._showPlaceholder()}else t._showPlaceholder()}))}},{key:"render",value:function(t){var e=this;if(Array.isArray(t)&&0!==t.length){this.data=t,this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._hidePlaceholder(),this.clearBtn.disabled=!1,this.counter.textContent="Records: ".concat(t.length);var i=document.createElement("table");Object.assign(i.style,{borderCollapse:"separate",borderSpacing:"0 4px",width:"100%",fontFamily:"sans-serif",fontSize:"14px"});var n=document.createElement("thead"),r=document.createElement("tr");["Field","# Variants","Values"].forEach((function(t){var e=document.createElement("th");e.textContent=t,Object.assign(e.style,{border:"none",padding:"6px",background:"#eaeaea",textAlign:"left"}),r.appendChild(e)})),n.appendChild(r),i.appendChild(n);var s=document.createElement("tbody");Object.keys(t[0]).forEach((function(i,n){var r=t.map((function(t){return t[i]})).filter((function(t){return null!=t}));if(r.length){var o=e._detectType(r),a=po(new Set(r)),l=document.createElement("tr"),h=document.createElement("td");h.textContent=i,h.setAttribute("draggable","true"),Object.assign(h.style,{border:"none",padding:"6px 10px",fontWeight:"bold",cursor:"grab",userSelect:"none"}),h.addEventListener("dragstart",(function(t){var n=e._buildHistogramPayload(i),r=JSON.stringify(n,null,2);t.dataTransfer.setData("application/json",r),t.dataTransfer.setData("text/plain",r),t.dataTransfer.effectAllowed="copy",h.style.opacity="0.5"})),h.addEventListener("dragend",(function(){h.style.opacity="1"})),h.addEventListener("mouseenter",(function(){h.style.textDecoration="underline"})),h.addEventListener("mouseleave",(function(){h.style.textDecoration="none"}));var c=document.createElement("td");c.textContent=a.length,Object.assign(c.style,{border:"none",padding:"6px",textAlign:"center"});var u=document.createElement("td");if(Object.assign(u.style,{border:"none",padding:"6px"}),"categorical"===o){var d=document.createElement("select");a.forEach((function(t){var e=document.createElement("option");e.value=t,e.textContent=t,d.appendChild(e)})),u.appendChild(d),new Hs(d,{searchEnabled:!0,itemSelectText:"",shouldSort:!1});var p=d.closest(".choices");if(p){Object.assign(p.style,{minWidth:"180px",maxWidth:"220px",marginBottom:"0"});var f=p.querySelector(".choices__inner");f&&Object.assign(f.style,{background:"#f8fafc",border:"1px solid #cbd5e1",borderRadius:"8px",minHeight:"34px",padding:"4px 8px",fontSize:"13px"});var m=p.querySelector(".choices__list--dropdown");m&&Object.assign(m.style,{border:"1px solid #cbd5e1",borderRadius:"8px",background:"#ffffff",boxShadow:"0 4px 10px rgba(0,0,0,0.08)"})}d.addEventListener("change",(function(){console.log("SELECTED V",d.value)}))}else{var y=r.map((function(t){return Number(t)})).filter((function(t){return!isNaN(t)}));u.textContent=y.length?"min: ".concat(Math.min.apply(Math,po(y))," | max: ").concat(Math.max.apply(Math,po(y))):"No numeric data"}l.appendChild(h),l.appendChild(c),l.appendChild(u);var g=n%2==0?"#dbeafe":"#ffffff";l.querySelectorAll("td").forEach((function(t){t.style.background=g})),h.title='Drag "'.concat(i,'"'),s.appendChild(l)}})),i.appendChild(s);var o=document.createElement("div");Object.assign(o.style,{position:"absolute",top:"42px",left:"0",right:"0",bottom:"0",overflow:"auto",padding:"10px",boxSizing:"border-box"}),o.appendChild(i),this.container.appendChild(o)}else this._showPlaceholder()}},{key:"_buildHistogramPayload",value:function(t){var e=po(new Set(this.data.map((function(e){return e[t]})).filter((function(t){return null!=t&&""!==t}))));return{type:"histogram",field:t,data:e}}},{key:"_detectType",value:function(t){var e=t.filter((function(t){return""!==t&&null!=t}));return e.length&&e.map(Number).filter((function(t){return!isNaN(t)})).length===e.length?"scalar":"categorical"}}],e&&mo(t.prototype,e),i&&mo(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function vo(t){return vo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vo(t)}function bo(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function xo(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?bo(Object(i),!0).forEach((function(e){_o(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):bo(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function _o(t,e,i){return(e=Ao(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function wo(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,r,s,o,a=[],l=!0,h=!1;try{if(s=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){h=!0,r=t}finally{try{if(!l&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(h)throw r}}return a}}(t,e)||Co(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function So(t){return function(t){if(Array.isArray(t))return Eo(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Co(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Co(t,e){if(t){if("string"==typeof t)return Eo(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Eo(t,e):void 0}}function Eo(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function ko(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ao(n.key),n)}}function Ao(t){var e=function(t,e){if("object"!=vo(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=vo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==vo(e)?e:e+""}var To=function(){return t=function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container element is required");this.container=e,this.placeholderText=i.placeholder||"PASTE DATA HERE",this.data=[],this.sortState={field:null,direction:"asc"},this.filters={},this.handlePaste=this.handlePaste.bind(this),this._initStyles(),this.init()},e=[{key:"init",value:function(){var t=this;this.container.setAttribute("contenteditable","true"),this.container.style.display="flex",this.container.style.flexDirection="column",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.container.style.background="#fff",this.container.style.border="1px solid #e5e7eb",this.container.style.borderRadius="8px",this.createPlaceholder(),this.showPlaceholder(),this.container.addEventListener("paste",this.handlePaste),this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background="#fff"})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="#fff",t.handleDrop(e)})),this.container.addEventListener("mousedown",(function(t){t.target.closest("[draggable='true']")&&t.stopPropagation()}))}},{key:"_initStyles",value:function(){this.styles={table:{width:"max-content",minwidth:"100%",height:"90%",borderCollapse:"separate",borderSpacing:"0",fontFamily:"system-ui, sans-serif",fontSize:"13px"},th:{padding:"10px 8px",background:"#f9fafb",borderBottom:"1px solid #e5e7eb",textAlign:"left",fontWeight:"600",color:"#374151",position:"sticky",top:"0",zIndex:"5"},td:{padding:"8px",borderBottom:"1px solid #f1f5f9",color:"#111827"},trHover:{background:"#f9fafb"},trAlt:{background:"#fcfcfd"},input:{width:"100%",border:"1px solid #d1d5db",borderRadius:"4px",padding:"4px",fontSize:"13px"},select:{marginTop:"4px",border:"1px solid #d1d5db",borderRadius:"4px",fontSize:"11px",padding:"2px"}}}},{key:"_setStyle",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object.assign(t.style,e)}},{key:"handlePaste",value:function(t){t.preventDefault();var e=(t.clipboardData||window.clipboardData).getData("text");if(e){var i=this.parseTSV(e),n=this.toJSON(i);this.data=this.mergeData(this.data,n),this.render()}}},{key:"handleDrop",value:function(t){var e=t.dataTransfer.getData("application/json")||t.dataTransfer.getData("text/plain");if(e){var i;console.log("dropping");try{i=JSON.parse(e)}catch(t){return void console.error("Invalid JSON dropped",t)}("table"===i.type&&Array.isArray(i.data)||"graph-nodes"===i.type&&Array.isArray(i.data))&&this._dropTableData(i.data)}}},{key:"_dropTableData",value:function(t){this.data=this.mergeData(this.data,t),this.render()}},{key:"render",value:function(){this.container.innerHTML="",this.container.style.display="grid",this.container.style.gridTemplateRows="auto 1fr",this.container.style.height="100%",this.container.style.minWidth="0",this.container.style.overflow="hidden";var t=this.createToolbox();t.style.gridRow="1";var e=document.createElement("div");e.style.gridRow="2",e.style.width="100%",e.style.height="90%",e.style.overflowX="auto",e.style.overflowY="auto",e.style.minWidth="0",e.style.minHeight="0";var i=this.createTableFromJSON(this.getProcessedData());i.style.width="max-content",e.appendChild(i),this.container.appendChild(t),this.container.appendChild(e),this.hidePlaceholder()}},{key:"getProcessedData",value:function(){var t=So(this.data);return Object.entries(this.filters).forEach((function(e){var i=wo(e,2),n=i[0],r=i[1];r&&(t=t.filter((function(t){return(t[n]||"")===r})))})),this.sortState.field&&(t=this._sortData(t,this.sortState.field,this.sortState.direction)),t}},{key:"_sortData",value:function(t,e,i){var n="asc"===i?1:-1;return So(t).map((function(t,e){return{item:t,index:e}})).sort((function(t,i){var r,s,o=null!==(r=t.item[e])&&void 0!==r?r:"",a=null!==(s=i.item[e])&&void 0!==s?s:"",l=parseFloat(o),h=parseFloat(a);return isNaN(l)||isNaN(h)?o.toString().localeCompare(a.toString())*n:(l-h)*n})).map((function(t){return t.item}))}},{key:"createTableFromJSON",value:function(t){var e=this,i=document.createElement("table");this._setStyle(i,this.styles.table);var n=document.createElement("thead"),r=document.createElement("tbody"),s=Array.from(this.data.reduce((function(t,e){return Object.keys(e).forEach((function(e){return t.add(e)})),t}),new Set)),o=document.createElement("tr");return s.forEach((function(t){var i=document.createElement("th"),n=e.sortState.field===t?"asc"===e.sortState.direction?" ▲":" ▼":"",r=document.createElement("div");r.textContent=t+n;var s=document.createElement("select"),a=So(new Set(e.data.map((function(e){return e[t]})).filter((function(t){return""!==t})))),l=document.createElement("option");l.value="",l.textContent="All",s.appendChild(l),a.forEach((function(t){var e=document.createElement("option");e.value=t,e.textContent=t,s.appendChild(e)})),s.value=e.filters[t]||"";var h=Math.min(120,Math.max(60,8*t.length));s.style.width=h+"px",e._setStyle(s,e.styles.select),s.onchange=function(i){e.filters[t]=i.target.value,e.render()},r.onclick=function(){e.sortState.field===t?e.sortState.direction="asc"===e.sortState.direction?"desc":"asc":(e.sortState.field=t,e.sortState.direction="asc"),e.render()},i.appendChild(r),i.appendChild(s),e._setStyle(i,e.styles.th),o.appendChild(i)})),n.appendChild(o),t.forEach((function(t,i){var n=document.createElement("tr");i%2==0&&e._setStyle(n,e.styles.trAlt),n.onmouseenter=function(){return e._setStyle(n,e.styles.trHover)},n.onmouseleave=function(){return n.style.background=i%2==0?"#fcfcfd":""},s.forEach((function(i){var r=document.createElement("td");e._setStyle(r,e.styles.td),r.textContent=t[i]||"",r.onclick=function(){var n=document.createElement("input");e._setStyle(n,e.styles.input),n.value=t[i]||"",r.innerHTML="",r.appendChild(n),n.focus();var s=function(){t[i]=n.value,e.render()};n.onblur=s,n.onkeydown=function(t){"Enter"===t.key&&s()}},n.appendChild(r)})),r.appendChild(n)})),i.appendChild(n),i.appendChild(r),i}},{key:"createToolbox",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{display:"flex",gap:"10px",padding:"8px",borderBottom:"1px solid #e5e7eb",background:"#fafafa",alignItems:"center"});var i=document.createElement("button");i.textContent="Clear",Object.assign(i.style,{padding:"4px 8px",border:"1px solid #d1d5db",borderRadius:"4px",background:"#fff",cursor:"pointer"}),i.onclick=function(){return t.clear()};var n=document.createElement("div");n.setAttribute("draggable","true"),n.title="Drag JSON",Object.assign(n.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"1px solid #d1d5db",borderRadius:"6px",background:"#fff",cursor:"grab",userSelect:"none"});var r=document.createElement("span");r.textContent="⤴",r.style.pointerEvents="none",n.appendChild(r),n.addEventListener("mousedown",(function(){n.style.cursor="grabbing"})),n.addEventListener("mouseup",(function(){n.style.cursor="grab"})),n.addEventListener("dragstart",(function(e){var i={type:"table",data:t.getProcessedData()},r=JSON.stringify(i);e.dataTransfer.effectAllowed="copy",e.dataTransfer.setData("application/json",r),e.dataTransfer.setData("text/plain",r);var s=n.cloneNode(!0);s.style.position="absolute",s.style.top="-1000px",document.body.appendChild(s),e.dataTransfer.setDragImage(s,16,16),setTimeout((function(){return document.body.removeChild(s)}),0)}));var s=document.createElement("button");return s.textContent="Copy",Object.assign(s.style,{padding:"4px 8px",border:"1px solid #d1d5db",borderRadius:"4px",background:"#fff",cursor:"pointer"}),s.onclick=function(){return t.copyToClipboard()},e.appendChild(i),e.appendChild(s),e.appendChild(n),e}},{key:"parseTSV",value:function(t){return t.trim().split("\n").map((function(t){return t.split("\t")}))}},{key:"toJSON",value:function(t){var e=t[0];return t.slice(1).map((function(t){var i={};return e.forEach((function(e,n){return i[e]=t[n]||""})),i}))}},{key:"mergeData",value:function(t,e){if(!t.length)return e;var i=new Map;return t.forEach((function(t){return t.id&&i.set(t.id,xo({},t))})),e.forEach((function(t){t.id&&(i.has(t.id)?Object.assign(i.get(t.id),t):i.set(t.id,xo({},t)))})),Array.from(i.values())}},{key:"createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"10px",left:"10px",color:"#9ca3af"}),this.container.appendChild(this.placeholder)}},{key:"showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"clear",value:function(){this.data=[],this.filters={},this.sortState={field:null,direction:"asc"},this.container.innerHTML="",this.createPlaceholder(),this.showPlaceholder()}},{key:"copyToClipboard",value:function(){var t=this.getProcessedData();if(t.length){var e=Array.from(t.reduce((function(t,e){return Object.keys(e).forEach((function(e){return t.add(e)})),t}),new Set)),i=[e.join("\t")].concat(So(t.map((function(t){return e.map((function(e){var i;return null!==(i=t[e])&&void 0!==i?i:""})).join("\t")})))).join("\n");navigator.clipboard.writeText(i).then((function(){console.log("Copied to clipboard")})).catch((function(t){console.error("Clipboard copy failed",t)}))}}}],e&&ko(t.prototype,e),i&&ko(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Mo(t){return function(t){if(Array.isArray(t))return Po(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Po(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Po(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Po(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function Oo(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Io(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Oo(Object(i),!0).forEach((function(e){Lo(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Oo(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Lo(t,e,i){return(e=Bo(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ro(t){return Ro="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ro(t)}function jo(){jo=function(){return e};var t,e={},i=Object.prototype,n=i.hasOwnProperty,r=Object.defineProperty||function(t,e,i){t[e]=i.value},s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function h(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(t){h=function(t,e,i){return t[e]=i}}function c(t,e,i,n){var s=e&&e.prototype instanceof g?e:g,o=Object.create(s.prototype),a=new P(n||[]);return r(o,"_invoke",{value:k(t,i,a)}),o}function u(t,e,i){try{return{type:"normal",arg:t.call(e,i)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var d="suspendedStart",p="suspendedYield",f="executing",m="completed",y={};function g(){}function v(){}function b(){}var x={};h(x,o,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(O([])));w&&w!==i&&n.call(w,o)&&(x=w);var S=b.prototype=g.prototype=Object.create(x);function C(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function i(r,s,o,a){var l=u(t[r],t,s);if("throw"!==l.type){var h=l.arg,c=h.value;return c&&"object"==Ro(c)&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){i("next",t,o,a)}),(function(t){i("throw",t,o,a)})):e.resolve(c).then((function(t){h.value=t,o(h)}),(function(t){return i("throw",t,o,a)}))}a(l.arg)}var s;r(this,"_invoke",{value:function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return s=s?s.then(r,r):r()}})}function k(e,i,n){var r=d;return function(s,o){if(r===f)throw Error("Generator is already running");if(r===m){if("throw"===s)throw o;return{value:t,done:!0}}for(n.method=s,n.arg=o;;){var a=n.delegate;if(a){var l=A(a,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===d)throw r=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=f;var h=u(e,i,n);if("normal"===h.type){if(r=n.done?m:p,h.arg===y)continue;return{value:h.arg,done:n.done}}"throw"===h.type&&(r=m,n.method="throw",n.arg=h.arg)}}}function A(e,i){var n=i.method,r=e.iterator[n];if(r===t)return i.delegate=null,"throw"===n&&e.iterator.return&&(i.method="return",i.arg=t,A(e,i),"throw"===i.method)||"return"!==n&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var s=u(r,e.iterator,i.arg);if("throw"===s.type)return i.method="throw",i.arg=s.arg,i.delegate=null,y;var o=s.arg;return o?o.done?(i[e.resultName]=o.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=t),i.delegate=null,y):o:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,y)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function M(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function O(e){if(e||""===e){var i=e[o];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,s=function i(){for(;++r<e.length;)if(n.call(e,r))return i.value=e[r],i.done=!1,i;return i.value=t,i.done=!0,i};return s.next=s}}throw new TypeError(Ro(e)+" is not iterable")}return v.prototype=b,r(S,"constructor",{value:b,configurable:!0}),r(b,"constructor",{value:v,configurable:!0}),v.displayName=h(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,h(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},C(E.prototype),h(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,i,n,r,s){void 0===s&&(s=Promise);var o=new E(c(t,i,n,r),s);return e.isGeneratorFunction(i)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},C(S),h(S,l,"Generator"),h(S,o,(function(){return this})),h(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),i=[];for(var n in e)i.push(n);return i.reverse(),function t(){for(;i.length;){var n=i.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=O,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!e)for(var i in this)"t"===i.charAt(0)&&n.call(this,i)&&!isNaN(+i.slice(1))&&(this[i]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var i=this;function r(n,r){return a.type="throw",a.arg=e,i.next=n,r&&(i.method="next",i.arg=t),!!r}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var l=n.call(o,"catchLoc"),h=n.call(o,"finallyLoc");if(l&&h){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!h)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var s=r;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=t,o.arg=e,s?(this.method="next",this.next=s.finallyLoc,y):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),M(i),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var n=i.completion;if("throw"===n.type){var r=n.arg;M(i)}return r}}throw Error("illegal catch attempt")},delegateYield:function(e,i,n){return this.delegate={iterator:O(e),resultName:i,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function Do(t,e,i,n,r,s,o){try{var a=t[s](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,r)}function No(t){return function(){var e=this,i=arguments;return new Promise((function(n,r){var s=t.apply(e,i);function o(t){Do(s,n,r,o,a,"next",t)}function a(t){Do(s,n,r,o,a,"throw",t)}o(void 0)}))}}function Fo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Bo(n.key),n)}}function Bo(t){var e=function(t,e){if("object"!=Ro(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Ro(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Ro(e)?e:e+""}function Go(t,e,i){return e=Uo(e),function(t,e){if(e&&("object"==Ro(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,zo()?Reflect.construct(e,i||[],Uo(t).constructor):e.apply(t,i))}function zo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(zo=function(){return!!t})()}function Uo(t){return Uo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Uo(t)}function Wo(t,e){return Wo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Wo(t,e)}var Ho=function(){function t(e){var i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),(i=Go(this,t,[e,n])).datasetName=n.name||"",i.jsonLoader=n.jsonLoader||null,i.onSave=n.onSave||null,i.onInspect=n.onInspect||null,i.onDesign=n.onDesign||null,i.activeSource="paste",i.render(),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Wo(t,e)}(t,To),e=t,i=[{key:"render",value:function(){this.container.innerHTML="",Object.assign(this.container.style,{display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",width:"100%",height:"100%",minWidth:"0",minHeight:"0",position:"relative",overflow:"hidden",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",boxSizing:"border-box"});var t=this.createSourceBar(),e=this.createDatasetBar(),i=document.createElement("div");if(Object.assign(i.style,{width:"100%",height:"100%",minWidth:"0",minHeight:"0",overflowX:"auto",overflowY:"auto",background:"#ffffff",position:"relative"}),this.data&&this.data.length){var n=this.createTableFromJSON(this.getProcessedData());n.style.width="max-content",n.style.minWidth="100%",i.appendChild(n)}else{var r=document.createElement("div");r.innerHTML='\n <div style="\n display:flex;\n flex-direction:column;\n align-items:center;\n justify-content:center;\n gap:10px;\n height:100%;\n color:#888;\n font-family:system-ui,sans-serif;\n ">\n\n <i\n class="fa-solid fa-table"\n style="font-size:32px">\n </i>\n\n <div style="\n font-size:14px;\n color:#666;\n ">\n PASTE DATA HERE\n </div>\n\n <div style="\n font-size:11px;\n color:#999;\n ">\n or load JSON / Google Sheet\n </div>\n\n </div>\n ',i.appendChild(r)}this.container.append(t,e,i)}},{key:"createSourceBar",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",boxSizing:"border-box",padding:"4px",gap:"10px",background:"#3b3b3b",borderBottom:"1px solid #555555"});var i=document.createElement("div");i.innerHTML="\n <div>Data Sources:</div>\n ",Object.assign(i.style,{width:"120px",height:"36px",color:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center",gap:"7px",fontSize:"15px",flexShrink:"0"});var n=this.createToolbarButton({icon:"fa-solid fa-copy",text:"Paste Data",active:"paste"===this.activeSource});n.onclick=function(){t.activeSource="paste",t.updateSourceButtons(e,n),t.container.focus()};var r=this.createToolbarButton({icon:"fa-solid fa-link",text:"Json URL",active:"json"===this.activeSource});r.onclick=function(){t.activeSource="json",t.updateSourceButtons(e,r),t.showURLInput({title:"Load JSON URL",placeholder:"https://server.com/data.json",buttonText:"Load JSON",onLoad:function(e){return t.loadJSON(e)}})};var s=this.createToolbarButton({icon:"fa-solid fa-table",text:"Google Sheet",active:"sheet"===this.activeSource});return s.onclick=function(){t.activeSource="sheet",t.updateSourceButtons(e,s),t.showGoogleSheetInput()},e.append(i,n,r,s),e}},{key:"extractSpreadsheetId",value:function(t){if(!t)return"";var e=t.trim(),i=e.match(/\/spreadsheets\/d\/([^/]+)/);return i&&i[1]?i[1]:e}},{key:"showGoogleSheetInput",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{position:"absolute",inset:"0",background:"rgba(0,0,0,.65)",zIndex:"1000",display:"flex",alignItems:"center",justifyContent:"center"});var i=document.createElement("div");Object.assign(i.style,{width:"500px",maxWidth:"90%",padding:"16px",boxSizing:"border-box",background:"#3b3b3b",border:"1px solid #666666",borderRadius:"10px",boxShadow:"0 10px 30px rgba(0,0,0,.5)"});var n=document.createElement("div");n.textContent="Load Google Sheet",Object.assign(n.style,{color:"#ffffff",fontSize:"14px",marginBottom:"14px"});var r=function(t){var e=document.createElement("input");return e.type="text",e.placeholder=t,Object.assign(e.style,{width:"100%",height:"36px",boxSizing:"border-box",padding:"8px 12px",marginBottom:"10px",color:"#ffffff",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",outline:"none",fontSize:"12px"}),e.addEventListener("paste",(function(t){return t.stopPropagation()})),e.addEventListener("mousedown",(function(t){return t.stopPropagation()})),e},s=r("Spreadsheet ID or Google Sheet URL"),o=r("Sheet Name (example: clientes)"),a=document.createElement("div");Object.assign(a.style,{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"4px"});var l=this.createToolbarButton({icon:"fa-solid fa-xmark",text:"Cancel",width:"90px"}),h=this.createToolbarButton({icon:"fa-solid fa-download",text:"Load Sheet",width:"110px",active:!0});l.onclick=function(){e.remove()},h.onclick=No(jo().mark((function i(){var n,r;return jo().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(n=s.value.trim(),r=o.value.trim(),n){i.next=5;break}return alert("Enter a Spreadsheet ID or URL."),i.abrupt("return");case 5:if(r){i.next=8;break}return alert("Enter the Sheet Name."),i.abrupt("return");case 8:return h.disabled=!0,h.style.opacity="0.5",i.prev=10,i.next=13,t.loadSheet(n,r);case 13:e.remove(),i.next=20;break;case 16:i.prev=16,i.t0=i.catch(10),console.error("Google Sheet error:",i.t0),alert(i.t0.message||"Unable to load Google Sheet.");case 20:return i.prev=20,h.disabled=!1,h.style.opacity="1",i.finish(20);case 24:case"end":return i.stop()}}),i,null,[[10,16,20,24]])}))),o.onkeydown=function(t){"Enter"===t.key&&h.click(),"Escape"===t.key&&e.remove()},s.onkeydown=function(t){"Escape"===t.key&&e.remove()},a.append(l,h),i.append(n,s,o,a),e.appendChild(i),this.container.appendChild(e),s.focus()}},{key:"createDatasetBar",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",boxSizing:"border-box",padding:"4px",gap:"10px",background:"#3b3b3b",borderBottom:"1px solid #555555"});var i=document.createElement("input");i.type="text",i.placeholder="Data Set Name",i.value=this.datasetName||"",Object.assign(i.style,{flex:"1",minWidth:"0",boxSizing:"border-box",padding:"8px 12px",height:"36px",fontSize:"12px",color:"#ffffff",backgroundColor:"#1e1e1e",border:"1px solid #555555",borderRadius:"9px",outline:"none"}),i.oninput=function(e){t.datasetName=e.target.value},i.addEventListener("paste",(function(t){t.stopPropagation()})),i.addEventListener("mousedown",(function(t){t.stopPropagation()}));var n=document.createElement("div");Object.assign(n.style,{display:"flex",flexDirection:"row",alignItems:"center",gap:"6px",flexShrink:"0"});var r=this.createToolbarButton({icon:"fa-solid fa-trash",text:"Clear",width:"80px",active:!0});r.title="Clear table",r.onclick=function(){t.clear()};var s=this.createToolbarButton({icon:"fa-solid fa-copy",text:"Copy",width:"80px",active:!0});s.title="Copy table data",s.onclick=function(){t.copyToClipboard()};var o=this.createToolbarButton({icon:"fa-solid fa-up-right-from-square",text:"Drag",width:"80px",active:!0});o.title="Drag table data",o.setAttribute("draggable","true"),o.addEventListener("mousedown",(function(t){t.stopPropagation(),o.style.cursor="grabbing"})),o.addEventListener("mouseup",(function(){o.style.cursor="grab"})),o.addEventListener("dragend",(function(){o.style.cursor="grab"})),o.addEventListener("dragstart",(function(e){var i={type:"table",name:t.datasetName,data:t.getProcessedData()},n=JSON.stringify(i);e.dataTransfer.effectAllowed="copy",e.dataTransfer.setData("application/json",n),e.dataTransfer.setData("text/plain",n);var r=o.cloneNode(!0);Object.assign(r.style,{position:"absolute",top:"-1000px",left:"-1000px",pointerEvents:"none"}),document.body.appendChild(r),e.dataTransfer.setDragImage(r,16,16),setTimeout((function(){r.parentNode&&r.parentNode.removeChild(r)}),0)}));var a=this.createToolbarButton({icon:"fa-solid fa-floppy-disk",text:"Save",width:"80px",active:!0});a.onclick=function(){t.saveDataset()};var l=this.createToolbarButton({icon:"fa-solid fa-magnifying-glass-chart",text:"Inspect",width:"100px",active:!0});return l.onclick=function(){t.onInspect&&t.onInspect({name:t.datasetName,data:t.data,processedData:t.getProcessedData(),table:t})},n.append(r,s,o,a,l),e.append(i,n),e}},{key:"createToolbarButton",value:function(t){var e=t.icon,i=t.text,n=t.width,r=void 0===n?"120px":n,s=t.active,o=void 0!==s&&s,a=document.createElement("button");return a.innerHTML='\n\n <span style="\n font-size:16px;\n pointer-events:none;\n ">\n\n <i class="'.concat(e,'"></i>\n\n </span>\n\n <span style="\n pointer-events:none;\n ">\n ').concat(i,"\n </span>\n\n "),Object.assign(a.style,{width:r,height:"36px",backgroundColor:o?"#000000":"#3d3d3d",color:o?"#ffffff":"#949494",border:"1px solid #666666",borderRadius:"9px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"7px",fontSize:"11px",flexShrink:"0",boxSizing:"border-box"}),a.dataset.sourceButton="true",a}},{key:"updateSourceButtons",value:function(t,e){t.querySelectorAll("[data-source-button]").forEach((function(t){var i=t===e;t.style.backgroundColor=i?"#000000":"#3d3d3d",t.style.color=i?"#ffffff":"#949494"}))}},{key:"showURLInput",value:function(t){var e=t.title,i=t.placeholder,n=t.buttonText,r=void 0===n?"Load":n,s=t.onLoad,o=document.createElement("div");Object.assign(o.style,{position:"absolute",inset:"0",background:"rgba(0,0,0,.65)",zIndex:"1000",display:"flex",alignItems:"center",justifyContent:"center"});var a=document.createElement("div");Object.assign(a.style,{width:"500px",maxWidth:"90%",padding:"16px",boxSizing:"border-box",background:"#3b3b3b",border:"1px solid #666666",borderRadius:"10px",boxShadow:"0 10px 30px rgba(0,0,0,.5)"});var l=document.createElement("div");l.textContent=e,Object.assign(l.style,{color:"#ffffff",fontSize:"14px",marginBottom:"10px"});var h=document.createElement("input");h.type="text",h.placeholder=i,Object.assign(h.style,{width:"100%",height:"36px",boxSizing:"border-box",padding:"8px 12px",color:"#ffffff",background:"#1e1e1e",border:"1px solid #555555",borderRadius:"8px",outline:"none",fontSize:"12px"}),h.addEventListener("paste",(function(t){return t.stopPropagation()})),h.addEventListener("mousedown",(function(t){return t.stopPropagation()}));var c=document.createElement("div");Object.assign(c.style,{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"12px"});var u=this.createToolbarButton({icon:"fa-solid fa-xmark",text:"Cancel",width:"90px"}),d=this.createToolbarButton({icon:"fa-solid fa-download",text:r,width:"110px",active:!0});u.onclick=function(){o.remove()},d.onclick=No(jo().mark((function t(){var e;return jo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=h.value.trim()){t.next=3;break}return t.abrupt("return");case 3:return d.disabled=!0,d.style.opacity="0.5",t.prev=5,t.next=8,s(e);case 8:o.remove(),t.next=15;break;case 11:t.prev=11,t.t0=t.catch(5),console.error("Data loading error:",t.t0),alert(t.t0.message||"Unable to load data");case 15:return t.prev=15,d.disabled=!1,d.style.opacity="1",t.finish(15);case 19:case"end":return t.stop()}}),t,null,[[5,11,15,19]])}))),h.onkeydown=function(t){"Enter"===t.key&&d.click(),"Escape"===t.key&&o.remove()},c.append(u,d),a.append(l,h,c),o.appendChild(a),this.container.appendChild(o),h.focus()}},{key:"handlePaste",value:function(t){var e=t.target;if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)){t.preventDefault();var i=(t.clipboardData||window.clipboardData).getData("text");if(i){var n=this.parseTSV(i);if(n.length){var r=this.toJSON(n);this.appendData(r)}}}}},{key:"setData",value:function(t){var e=this.normalizeData(t);return this.data=e,this.filters={},this.sortState={field:null,direction:"asc"},this.render(),this.data}},{key:"appendData",value:function(t){var e=this.normalizeData(t);return this.data=this.mergeData(this.data||[],e),this.render(),this.data}},{key:"normalizeData",value:function(t){if(null==t)return[];var e=t;if(!Array.isArray(e)&&e&&Array.isArray(e.data)&&(e=e.data),!Array.isArray(e)&&e&&Array.isArray(e.rows)&&(e=e.rows),!Array.isArray(e))throw new Error("Data source must return an array of objects.");return e.length&&Array.isArray(e[0])?this.toJSON(e):e.map((function(t){return t&&"object"===Ro(t)&&!Array.isArray(t)?Io({},t):{value:t}}))}},{key:"loadJSON",value:(o=No(jo().mark((function t(e){var i,n;return jo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.jsonLoader){t.next=6;break}return t.next=3,this.jsonLoader(e,this);case 3:i=t.sent,t.next=14;break;case 6:return t.next=8,fetch(e);case 8:if((n=t.sent).ok){t.next=11;break}throw new Error("HTTP ".concat(n.status," - ").concat(n.statusText));case 11:return t.next=13,n.json();case 13:i=t.sent;case 14:return this.activeSource="json",t.abrupt("return",this.setData(i));case 16:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"loadSheet",value:(s=No(jo().mark((function t(e,i){var n,r,s,o,a,l,h,c;return jo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.extractSpreadsheetId(e),r={data:{data_source:{config:{SPREADSHEET_ID:n,SHEET_NAME:i}}}},console.log("Google Sheet request:",r),t.next=5,fetch("https://server.vizor.studio/api/get_data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});case 5:if((s=t.sent).ok){t.next=11;break}return t.next=9,s.text();case 9:throw o=t.sent,new Error("Google Sheet request failed (".concat(s.status,"): ").concat(o));case 11:return t.next=13,s.json();case 13:if(a=t.sent,console.log("Google Sheet response:",a),!a||"error"!==a.status){t.next=18;break}throw c=(null===(l=a.data)||void 0===l?void 0:l.message)||(null===(h=a.data)||void 0===h?void 0:h.error)||"Unable to load Google Sheet.",new Error(c);case 18:return this.activeSource="sheet",t.abrupt("return",this.setData(a));case 20:case"end":return t.stop()}}),t,this)}))),function(t,e){return s.apply(this,arguments)})},{key:"mergeData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t.length)return e.map((function(t){return Io({},t)}));if(!e.length)return t.map((function(t){return Io({},t)}));var i=t.every((function(t){return void 0!==t.id&&null!==t.id&&""!==t.id})),n=e.every((function(t){return void 0!==t.id&&null!==t.id&&""!==t.id}));if(!i||!n)return[].concat(Mo(t.map((function(t){return Io({},t)}))),Mo(e.map((function(t){return Io({},t)}))));var r=new Map;return t.forEach((function(t){r.set(t.id,Io({},t))})),e.forEach((function(t){r.has(t.id)?Object.assign(r.get(t.id),t):r.set(t.id,Io({},t))})),Array.from(r.values())}},{key:"saveDataset",value:(r=No(jo().mark((function t(){var e;return jo().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.datasetName.trim()){t.next=4;break}return alert("Please enter a Data Set Name."),t.abrupt("return",null);case 4:if(e=this.getDataset(),!this.onSave){t.next=8;break}return t.next=8,this.onSave(e,this);case 8:return t.abrupt("return",e);case 9:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"getDataset",value:function(){return{name:this.datasetName,source:this.activeSource,data:this.data,processedData:this.getProcessedData(),columns:this.getColumns(),rowCount:this.data.length}}},{key:"getColumns",value:function(){return Array.from((this.data||[]).reduce((function(t,e){return Object.keys(e).forEach((function(e){return t.add(e)})),t}),new Set))}},{key:"setDatasetName",value:function(t){this.datasetName=t||"",this.render()}},{key:"getDatasetName",value:function(){return this.datasetName}},{key:"clear",value:function(){this.data=[],this.filters={},this.sortState={field:null,direction:"asc"},this.activeSource="paste",this.render()}}],i&&Fo(e.prototype,i),n&&Fo(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,i,n,r,s,o}();function Vo(t){return Vo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vo(t)}function Xo(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Yo(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Xo(Object(i),!0).forEach((function(e){$o(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Xo(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function $o(t,e,i){return(e=Ko(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function qo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ko(n.key),n)}}function Ko(t){var e=function(t,e){if("object"!=Vo(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Vo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Vo(e)?e:e+""}var Zo=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP HISTOGRAM HERE",this.currentPayload=null,this.sortAscending=!1,this._initDrop(),this._initResize(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._createTooltip(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"200px"})}},{key:"_createToolbox",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{display:"flex",justifyContent:"flex-end",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"});var i=document.createElement("button");i.textContent="Clear",i.addEventListener("click",(function(){t.currentPayload=null,t._renderBase()}));var n=document.createElement("button");n.textContent="Sort ↑",n.addEventListener("click",(function(){t.sortAscending=!t.sortAscending,n.textContent=t.sortAscending?"Sort ↓":"Sort ↑",t.currentPayload&&t._drawChart(t.currentPayload)})),e.appendChild(n),e.appendChild(i),this.container.appendChild(e)}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888",fontFamily:"sans-serif",pointerEvents:"none"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="block")}},{key:"_hidePlaceholder",value:function(){this.placeholder&&(this.placeholder.style.display="none")}},{key:"_aggregateData",value:function(t,e,i){var n=this,r={};return t.forEach((function(t){var s=t[e];if(s||(s="EMPTY"),r[s]||(r[s]=0),i){var o=n._parseNumber(t[i]);r[s]+=o}else r[s]+=1})),Object.keys(r).map((function(t){return{value:t,count:r[t]}}))}},{key:"_createTooltip",value:function(){this.tooltip=document.createElement("div"),Object.assign(this.tooltip.style,{position:"absolute",pointerEvents:"none",background:"rgba(0,0,0,0.75)",color:"#fff",padding:"6px 8px",borderRadius:"4px",fontSize:"12px",fontFamily:"sans-serif",opacity:"0",transition:"opacity 0.2s"}),this.container.appendChild(this.tooltip)}},{key:"_showTooltip",value:function(t,e,i){this.tooltip.innerHTML=i,this.tooltip.style.left=t+10+"px",this.tooltip.style.top=e+10+"px",this.tooltip.style.opacity="1"}},{key:"_hideTooltip",value:function(){this.tooltip.style.opacity="0"}},{key:"_initResize",value:function(){var t=this;this._handleResize=function(e){var i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:150;return function(){for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];clearTimeout(i),i=setTimeout((function(){return e.apply(t,s)}),n)}}((function(){t.currentPayload&&t._drawChart(t.currentPayload)})),this.resizeObserver=new ResizeObserver(this._handleResize),this.resizeObserver.observe(this.container)}},{key:"_initDrop",value:function(){var t=this;this.container.addEventListener("dragover",(function(e){e.preventDefault(),t.container.style.background="#f0f8ff"})),this.container.addEventListener("dragleave",(function(){t.container.style.background=""})),this.container.addEventListener("drop",(function(e){e.preventDefault(),t.container.style.background="";var i=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain");if(i)try{var n=JSON.parse(i);if("histogram"===n.type&&Array.isArray(n.data))return void t.render(Yo(Yo({},n),{},{sumField:null}));if("sumField"===n.type&&t.currentPayload)return console.log("Dropped ",n),t.currentPayload.sumField=n.field,void t._drawChart(t.currentPayload)}catch(t){console.error("Invalid drop JSON",t)}}))}},{key:"render",value:function(t){this.currentPayload=Yo(Yo({},t),{},{sumField:t.sumField||null}),this.container.innerHTML="",this._createToolbox(),this._createTooltip(),this._hidePlaceholder(),this.chartWrapper=document.createElement("div"),this.chartWrapper.style.width="100%",this.chartWrapper.style.height="100%",this.chartWrapper.style.padding="10px",this.container.appendChild(this.chartWrapper),this._drawChart(this.currentPayload)}},{key:"_parseNumber",value:function(t){if(null==t)return 0;var e=String(t).replace(/,/g,""),i=Number(e);return isNaN(i)?0:i}},{key:"_drawChart",value:function(t){var e=this;if(this.chartWrapper){this.chartWrapper.innerHTML="";var i=this.container.getBoundingClientRect(),n=i.width-20,r=Math.max(200,i.height-60),s=30,o=20,a=80,l=50,h=d3.select(this.chartWrapper).append("svg").attr("width",n).attr("height",r),c=n-l-o,u=r-s-a,d=h.append("g").attr("transform","translate(".concat(l,",").concat(s,")")),p=this._aggregateData(t.data,t.field,t.sumField);this.sortAscending&&p.sort((function(t,e){return t.count-e.count}));var f=d3.scaleBand().domain(p.map((function(t){return t.value}))).range([0,c]).padding(.1),m=d3.scaleLinear().domain([0,d3.max(p,(function(t){return t.count}))]).nice().range([u,0]);d.selectAll(".bar").data(p,(function(t){return t.value})).enter().append("rect").attr("class","bar").attr("x",(function(t){return f(t.value)})).attr("width",f.bandwidth()).attr("y",u).attr("height",0).attr("fill","#69b3a2").on("mousemove",(function(i,n){e._showTooltip(i.offsetX,i.offsetY,"<b>".concat(n.value,"</b><br/>").concat(t.sumField?"Sum":"Count",": ").concat(n.count))})).on("mouseleave",(function(){return e._hideTooltip()})).transition().duration(600).attr("y",(function(t){return m(t.count)})).attr("height",(function(t){return u-m(t.count)})),d.append("g").attr("transform","translate(0, ".concat(u,")")).call(d3.axisBottom(f).tickFormat((function(t){var e,i=p.find((function(e){return e.value===t}));return"".concat(t," (").concat(null!==(e=null==i?void 0:i.count)&&void 0!==e?e:0,")")}))).selectAll("text").attr("transform","rotate(-30)").style("text-anchor","end"),d.append("g").call(d3.axisLeft(m)),h.append("text").attr("x",n/2).attr("y",20).attr("text-anchor","middle").style("font-family","sans-serif").style("font-size","14px").text("Histogram: ".concat(t.field))}}}],e&&qo(t.prototype,e),i&&qo(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function Jo(t){return Jo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jo(t)}function Qo(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ta(n.key),n)}}function ta(t){var e=function(t,e){if("object"!=Jo(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=Jo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Jo(e)?e:e+""}var ea=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container required");this.container=e,this.days=["Lun","Mar","Mie","Jue","Vie","Sab","Dom"],this.hours=["09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00"],this.selected={},this._injectStyles(),this._render(),this._buildGrid(),this._bindEvents()},(e=[{key:"_injectStyles",value:function(){if(!document.getElementById("availability-survey-styles")){var t=document.createElement("style");t.id="availability-survey-styles",t.textContent="\n .as-card {\n max-width: 900px;\n margin: auto;\n background: white;\n padding: 20px;\n border-radius: 16px;\n box-shadow: 0 8px 24px rgba(0,0,0,0.08);\n font-family: sans-serif;\n\n display: flex;\n flex-direction: column;\n height: 100%; /* 🔥 important */\n }\n\n .as-title {\n margin-bottom: 6px;\n }\n\n .as-subtitle {\n color: #666;\n margin-bottom: 16px;\n font-size: 14px;\n }\n\n .as-input-group {\n margin-bottom: 16px;\n }\n\n .as-card input {\n padding: 8px 10px;\n border: 1px solid #ddd;\n border-radius: 8px;\n width: 220px;\n font-size: 14px;\n }\n\n .as-grid-wrapper {\n overflow: auto;\n border-radius: 12px;\n -webkit-overflow-scrolling: touch;\n\n flex: 1; /* 🔥 fills space */\n min-height: 0; /* 🔥 required for iOS */\n }\n\n .as-grid {\n display: grid;\n grid-template-columns: 80px repeat(7, minmax(70px, 1fr));\n min-width: 600px;\n border: 1px solid #e5e7eb;\n }\n\n .as-cell {\n border: 1px solid #eef0f4;\n height: 42px;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 13px;\n transition: all 0.12s ease;\n user-select: none;\n }\n\n .as-header {\n font-weight: 600;\n background: #f1f5f9;\n cursor: default;\n }\n\n .as-time {\n background: #f9fafb;\n color: #555;\n font-size: 12px;\n cursor: default;\n }\n\n /* hover only when NOT clicking */\n body:not(.as-clicking) .as-cell:not(.as-active):hover {\n background: #eef4ff;\n }\n\n .as-active {\n background: #1e40af;\n color: white;\n font-weight: bold;\n }\n\n .as-cell:active {\n transform: scale(0.96);\n }\n\n .as-card button {\n margin-top: 16px;\n padding: 10px 16px;\n border: none;\n border-radius: 10px;\n background: #3b82f6;\n color: white;\n font-size: 14px;\n cursor: pointer;\n box-shadow: 0 4px 12px rgba(59,130,246,0.3);\n margin-top: 12px;\n flex-shrink: 0; \n }\n\n .as-card button:hover {\n background: #2563eb;\n }\n\n .as-header {\n position: sticky;\n top: 0;\n z-index: 2;\n }\n\n\n .as-time {\n position: sticky;\n left: 0;\n z-index: 1;\n background: #f9fafb;\n }\n\n ",document.head.appendChild(t)}}},{key:"_render",value:function(){this.container.innerHTML="",this.card=document.createElement("div"),this.card.className="as-card",this.title=document.createElement("h1"),this.title.className="as-title",this.title.textContent="Encuesta de Disponibilidad 🎶",this.subtitle=document.createElement("div"),this.subtitle.className="as-subtitle",this.subtitle.textContent="Pon tu nombre y da click en los horarios que te acomoden para el ensayo",this.inputGroup=document.createElement("div"),this.inputGroup.className="as-input-group",this.input=document.createElement("input"),this.input.placeholder="Pon tu Nombre",this.gridWrapper=document.createElement("div"),this.gridWrapper.className="as-grid-wrapper",this.grid=document.createElement("div"),this.grid.className="as-grid",this.gridWrapper.appendChild(this.grid),this.button=document.createElement("button"),this.button.textContent="Enviar",this.inputGroup.appendChild(this.input),this.card.appendChild(this.title),this.card.appendChild(this.subtitle),this.card.appendChild(this.inputGroup),this.card.appendChild(this.gridWrapper),this.card.appendChild(this.button),this.container.appendChild(this.card)}},{key:"_buildGrid",value:function(){var t=this;this.grid.appendChild(document.createElement("div")),this.days.forEach((function(e){var i=document.createElement("div");i.textContent=e,i.className="as-cell as-header",t.grid.appendChild(i)})),this.hours.forEach((function(e){var i=document.createElement("div");i.textContent=e,i.className="as-cell as-time",t.grid.appendChild(i),t.days.forEach((function(i){var n="".concat(i,"-").concat(e),r=document.createElement("div");r.className="as-cell",r.addEventListener("click",(function(){var e=!t.selected[n];t.selected[n]=e,r.classList.toggle("as-active",e),r.textContent=e?"✓":""})),t.grid.appendChild(r)}))}))}},{key:"_bindEvents",value:function(){var t=this;document.addEventListener("mousedown",(function(){document.body.classList.add("as-clicking")})),document.addEventListener("mouseup",(function(){document.body.classList.remove("as-clicking")})),this.button.addEventListener("click",(function(){var e=t.input.value||"Anonymous";if(0!==Object.values(t.selected).filter(Boolean).length){var i={name:e,availability:t.selected};alert("Gracias !!!"),t.onSubmit&&t.onSubmit(i)}else alert("Please select at least one time slot")}))}}])&&Qo(t.prototype,e),i&&Qo(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}();function ia(t){return ia="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ia(t)}function na(t){return function(t){if(Array.isArray(t))return ra(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ra(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ra(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ra(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function sa(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,oa(n.key),n)}}function oa(t){var e=function(t,e){if("object"!=ia(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=ia(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ia(e)?e:e+""}var aa=function(){return t=function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new Error("Container is required");this.container=e,this.placeholderText="DROP DATA HERE",this.currentPayload=null,this.selectedFields=[],this.sortAscending=!1,this.zoomLevel=1,this.minZoom=.6,this.maxZoom=2,this.panX=0,this.panY=0,this.isPanning=!1,this._initDrop(),this._initResize(),this._renderBase()},e=[{key:"_renderBase",value:function(){this.container.innerHTML="",this._createToolbox(),this._createPlaceholder(),this._createTooltip(),this._showPlaceholder(),Object.assign(this.container.style,{position:"relative",border:"2px dashed #ccc",minHeight:"200px",overflow:"hidden"})}},{key:"_createToolbox",value:function(){var t=this,e=document.createElement("div");Object.assign(e.style,{display:"flex",justifyContent:"space-between",padding:"8px",borderBottom:"1px solid #ddd",background:"#f9f9f9"}),this.fieldsContainer=document.createElement("div"),this.fieldsContainer.style.display="flex",this.fieldsContainer.style.gap="6px";var i=document.createElement("div"),n=document.createElement("button");n.textContent="Sort ↑",n.onclick=function(){t.sortAscending=!t.sortAscending,n.textContent=t.sortAscending?"Sort ↓":"Sort ↑",t.currentPayload&&t._drawChart(t.currentPayload)};var r=document.createElement("button");r.textContent="Clear",r.onclick=function(){t.currentPayload=null,t.selectedFields=[],t._renderBase()},i.appendChild(n),i.appendChild(r),e.appendChild(this.fieldsContainer),e.appendChild(i),this.container.appendChild(e)}},{key:"_renderFieldChips",value:function(){var t=this;this.fieldsContainer.innerHTML="",this.selectedFields.forEach((function(e,i){var n=document.createElement("div");Object.assign(n.style,{padding:"2px 6px",background:"#e0e0e0",borderRadius:"4px",fontSize:"11px",display:"flex",alignItems:"center",gap:"4px"}),n.innerHTML="".concat(e," ✕"),n.onclick=function(){t.selectedFields.splice(i,1),t._renderFieldChips(),t._drawChart(t.currentPayload)},t.fieldsContainer.appendChild(n)}))}},{key:"_createPlaceholder",value:function(){this.placeholder=document.createElement("div"),this.placeholder.textContent=this.placeholderText,Object.assign(this.placeholder.style,{position:"absolute",top:"60%",left:"50%",transform:"translate(-50%, -50%)",color:"#888"}),this.container.appendChild(this.placeholder)}},{key:"_showPlaceholder",value:function(){this.placeholder.style.display="block"}},{key:"_hidePlaceholder",value:function(){this.placeholder.style.display="none"}},{key:"_createTooltip",value:function(){this.tooltip=document.createElement("div"),Object.assign(this.tooltip.style,{position:"absolute",background:"#000",color:"#fff",padding:"4px 6px",fontSize:"11px",borderRadius:"4px",opacity:0,pointerEvents:"none"}),this.container.appendChild(this.tooltip)}},{key:"_showTooltip",value:function(t,e,i){this.tooltip.innerHTML=i,this.tooltip.style.left=t+10+"px",this.tooltip.style.top=e+10+"px",this.tooltip.style.opacity=1}},{key:"_hideTooltip",value:function(){this.tooltip.style.opacity=0}},{key:"_initResize",value:function(){var t=this;new ResizeObserver((function(){t.currentPayload&&t._drawChart(t.currentPayload)})).observe(this.container)}},{key:"_initInteractions",value:function(){var t=this;this.container.onwheel=function(e){e.preventDefault(),t.zoomLevel+=.0015*-e.deltaY,t.zoomLevel=Math.max(t.minZoom,Math.min(t.maxZoom,t.zoomLevel)),t._applyTransform()},this.container.onmousedown=function(e){t.isPanning=!0,t.startX=e.clientX-t.panX,t.startY=e.clientY-t.panY,t.container.style.cursor="grabbing"},window.onmousemove=function(e){t.isPanning&&(t.panX=e.clientX-t.startX,t.panY=e.clientY-t.startY,t._applyTransform())},window.onmouseup=function(){t.isPanning=!1,t.container.style.cursor="default"}}},{key:"_applyTransform",value:function(){this.grid.style.transform="translate(".concat(this.panX,"px, ").concat(this.panY,"px) scale(").concat(this.zoomLevel,")")}},{key:"_initDrop",value:function(){var t=this;this.container.ondragover=function(t){return t.preventDefault()},this.container.ondrop=function(e){e.preventDefault();var i=e.dataTransfer.getData("application/json")||e.dataTransfer.getData("text/plain"),n=JSON.parse(i);"histogram"===n.type&&(t.selectedFields=[],t.render(n)),"sumField"===n.type&&(t.selectedFields.includes(n.field)||t.selectedFields.push(n.field),t._renderFieldChips(),t._drawChart(t.currentPayload))}}},{key:"render",value:function(t){this.currentPayload=t,this.container.innerHTML="",this._createToolbox(),this._createTooltip(),this.chartWrapper=document.createElement("div"),this.chartWrapper.style.height="100%",this.chartWrapper.style.background="#f5f7fa",this.chartWrapper.style.padding="12px",this.container.appendChild(this.chartWrapper),this._drawChart(t)}},{key:"_parseNumber",value:function(t){return Number(String(t).replace(/,/g,""))||0}},{key:"_buildSeries",value:function(t){var e=this;return this.selectedFields.map((function(i){return{field:i,value:e._parseNumber(t[i])}}))}},{key:"_drawChart",value:function(t){var e=this;if(this.chartWrapper.innerHTML="",this.selectedFields.length){var i=na(t.data);if(this.sortAscending){var n=this.selectedFields.at(-1);i.sort((function(t,i){return e._parseNumber(t[n])-e._parseNumber(i[n])}))}this.grid=document.createElement("div"),Object.assign(this.grid.style,{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:"12px",transformOrigin:"0 0"}),this.chartWrapper.appendChild(this.grid),this._initInteractions(),i.forEach((function(i){var n,r,s=document.createElement("div");s.onmouseenter=function(){s.style.transform="translateY(-2px)",s.style.boxShadow="0 4px 14px rgba(0,0,0,0.12)"},s.onmouseleave=function(){s.style.transform="translateY(0)",s.style.boxShadow="0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06)"};var o=e._buildSeries(i),a=(null===(n=o[0])||void 0===n?void 0:n.value)||0,l=(null===(r=o.at(-1))||void 0===r?void 0:r.value)||0,h=0===a?0:(l-a)/a*100,c=document.createElement("div");Object.assign(c.style,{display:"flex",justifyContent:"space-between",alignItems:"center"});var u=document.createElement("div");u.textContent=i[t.field],u.style.fontSize="12px",u.style.fontWeight="600",u.style.color="#333",u.style.letterSpacing="0.2px";var d=document.createElement("div");d.textContent="".concat(h.toFixed(1),"%"),d.style.fontSize="10px",d.style.padding="3px 8px",d.style.borderRadius="999px",d.style.fontWeight="600",d.style.border="1px solid rgba(0,0,0,0.05)",d.style.background=h>=0?"#e3f2fd":"#ffebee",d.style.color=h>=0?"#1976d2":"#e53935",c.appendChild(u),c.appendChild(d),Object.assign(s.style,{background:"#ffffff",padding:"10px 12px",borderRadius:"10px",border:"1px solid rgba(0,0,0,0.06)",borderTop:"3px solid ".concat(h>=0?"#1976d2":"#e53935"),boxShadow:"0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06)",display:"flex",flexDirection:"column",gap:"6px",transition:"all 0.15s ease",cursor:"pointer"}),s.appendChild(c);for(var p=d3.select(s).append("svg").attr("width","100%").attr("height",100).append("g").attr("transform","translate(30,10)"),f=d3.scalePoint().domain(e.selectedFields).range([0,160]),m=d3.scaleLinear().domain([0,d3.max(o,(function(t){return t.value}))]).range([70,0]),y=0;y<o.length-1;y++){var g=o[y],v=o[y+1],b=v.value>=g.value?"#1976d2":"#e53935";p.append("line").attr("x1",f(g.field)).attr("y1",m(g.value)).attr("x2",f(v.field)).attr("y2",m(v.value)).attr("stroke",b).attr("stroke-width",2)}p.selectAll("circle").data(o).enter().append("circle").attr("cx",(function(t){return f(t.field)})).attr("cy",(function(t){return m(t.value)})).attr("r",2).attr("fill","#333"),e.grid.appendChild(s)}))}}}],e&&sa(t.prototype,e),i&&sa(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,i}(),la=s.A5,ha=s.oY,ca=s.W_,ua=s.vY,da=s.jz,pa=s.TI,fa=s.ey,ma=s.sV;export{la as AvailabilitySurvey,ha as DataInspector,ca as DataInspectorBasic,ua as vi_2dGRAP,da as vi_ExtendedPasteTable,pa as vi_HistogramViewer,fa as vi_MiniChartViewer,ma as vi_PasteTable};