@snabcentr/vue-ui-lib 4.19.4 → 4.19.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.
- package/dist/manifest.json +1 -1
- package/dist/release_notes.tmp +3 -4
- package/dist/sc-vue-ui-lib.js +1 -1
- package/dist/sc-vue-ui-lib.js.map +1 -1
- package/dist/sc-vue-ui-lib.umd.cjs +1 -1
- package/dist/sc-vue-ui-lib.umd.cjs.map +1 -1
- package/dist/src/components/catalog/product-details/product-name.vue.d.ts +1 -1
- package/package.json +1 -1
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
38
38
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
39
39
|
PERFORMANCE OF THIS SOFTWARE.
|
|
40
|
-
***************************************************************************** */var no=function(){return no=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},no.apply(this,arguments)},dp={scale:1,zoom:!0,infiniteZoom:!0,actualSize:!0,showZoomInOutIcons:!1,actualSizeIcons:{zoomIn:"lg-zoom-in",zoomOut:"lg-zoom-out"},enableZoomAfter:300,zoomPluginStrings:{zoomIn:"Zoom in",zoomOut:"Zoom out",viewActualSize:"View actual size"}},In={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},gs=500,up=(function(){function t(e,n){return this.core=e,this.$LG=n,this.settings=no(no({},dp),this.core.settings),this}return t.prototype.buildTemplates=function(){var e=this.settings.showZoomInOutIcons?'<button id="'+this.core.getIdName("lg-zoom-in")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomIn+'" class="lg-zoom-in lg-icon"></button><button id="'+this.core.getIdName("lg-zoom-out")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomOut+'" class="lg-zoom-out lg-icon"></button>':"";this.settings.actualSize&&(e+='<button id="'+this.core.getIdName("lg-actual-size")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.viewActualSize+'" class="'+this.settings.actualSizeIcons.zoomIn+' lg-icon"></button>'),this.core.outer.addClass("lg-use-transition-for-zoom"),this.core.$toolbar.first().append(e)},t.prototype.enableZoom=function(e){var n=this,r=this.settings.enableZoomAfter+e.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&e.detail.delay?r=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){n.isImageSlide(n.core.index)&&(n.core.getSlideItem(e.detail.index).addClass("lg-zoomable"),e.detail.index===n.core.index&&n.setZoomEssentials())},r+30)},t.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(In.slideItemLoad+".zoom",this.enableZoom.bind(this))},t.prototype.getDragCords=function(e){return{x:e.pageX,y:e.pageY}},t.prototype.getSwipeCords=function(e){var n=e.touches[0].pageX,r=e.touches[0].pageY;return{x:n,y:r}},t.prototype.getDragAllowedAxises=function(e,n){if(!this.containerRect)return{allowX:!1,allowY:!1};var r=this.core.getSlideItem(this.core.index).find(".lg-image").first().get(),o=0,s=0,a=r.getBoundingClientRect();e?(o=r.offsetHeight*e,s=r.offsetWidth*e):n?(o=a.height+n*a.height,s=a.width+n*a.width):(o=a.height,s=a.width);var l=o>this.containerRect.height,c=s>this.containerRect.width;return{allowX:c,allowY:l}},t.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},t.prototype.zoomImage=function(e,n,r,o){if(!(!this.containerRect||Math.abs(n)<=0)){var s=this.containerRect.width/2+this.containerRect.left,a=this.containerRect.height/2+this.containerRect.top+this.scrollTop,l,c;e===1&&(this.positionChanged=!1);var d=this.getDragAllowedAxises(0,n),u=d.allowY,h=d.allowX;this.positionChanged&&(l=this.left/(this.scale-n),c=this.top/(this.scale-n),this.pageX=s-l,this.pageY=a-c,this.positionChanged=!1);var f=this.getPossibleSwipeDragCords(n),m,p,g=s-this.pageX,y=a-this.pageY;if(e-n>1){var b=(e-n)/Math.abs(n);g=(n<0?-g:g)+this.left*(b+(n<0?-1:1)),y=(n<0?-y:y)+this.top*(b+(n<0?-1:1)),m=g/b,p=y/b}else{var b=(e-n)*n;m=g*b,p=y*b}r&&(h?this.isBeyondPossibleLeft(m,f.minX)?m=f.minX:this.isBeyondPossibleRight(m,f.maxX)&&(m=f.maxX):e>1&&(m<f.minX?m=f.minX:m>f.maxX&&(m=f.maxX)),u?this.isBeyondPossibleTop(p,f.minY)?p=f.minY:this.isBeyondPossibleBottom(p,f.maxY)&&(p=f.maxY):e>1&&(p<f.minY?p=f.minY:p>f.maxY&&(p=f.maxY))),this.setZoomStyles({x:m,y:p,scale:e}),this.left=m,this.top=p,o&&this.setZoomImageSize()}},t.prototype.resetImageTranslate=function(e){if(this.isImageSlide(e)){var n=this.core.getSlideItem(e).find(".lg-image").first();this.imageReset=!1,n.removeClass("reset-transition reset-transition-y reset-transition-x"),this.core.outer.removeClass("lg-actual-size"),n.css("width","auto").css("height","auto"),setTimeout(function(){n.removeClass("no-transition")},10)}},t.prototype.setZoomImageSize=function(){var e=this,n=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var r=e.getCurrentImageActualSizeScale();e.scale>=r&&(n.addClass("no-transition"),e.imageReset=!0)},gs),setTimeout(function(){var r=e.getCurrentImageActualSizeScale();if(e.scale>=r){var o=e.getDragAllowedAxises(e.scale);n.css("width",n.get().naturalWidth+"px").css("height",n.get().naturalHeight+"px"),e.core.outer.addClass("lg-actual-size"),o.allowX&&o.allowY?n.addClass("reset-transition"):o.allowX&&!o.allowY?n.addClass("reset-transition-x"):!o.allowX&&o.allowY&&n.addClass("reset-transition-y")}},gs+50)},t.prototype.setZoomStyles=function(e){var n=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),r=this.core.getSlideItem(this.core.index).find(".lg-image").first(),o=this.core.outer.find(".lg-current .lg-dummy-img").first();this.scale=e.scale,r.css("transform","scale3d("+e.scale+", "+e.scale+", 1)"),o.css("transform","scale3d("+e.scale+", "+e.scale+", 1)");var s="translate3d("+e.x+"px, "+e.y+"px, 0)";n.css("transform",s)},t.prototype.setActualSize=function(e,n){var r=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var o=this.core.galleryItems[this.core.index];this.resetImageTranslate(e),setTimeout(function(){if(!(!o.src||r.core.outer.hasClass("lg-first-slide-loading"))){var s=r.getCurrentImageActualSizeScale(),a=r.scale;r.core.outer.hasClass("lg-zoomed")?r.scale=1:r.scale=r.getScale(s),r.setPageCords(n),r.beginZoom(r.scale),r.zoomImage(r.scale,r.scale-a,!0,!0)}},50),setTimeout(function(){r.core.outer.removeClass("lg-grabbing").addClass("lg-grab")},60),setTimeout(function(){r.zoomInProgress=!1},gs+110)}},t.prototype.getNaturalWidth=function(e){var n=this.core.getSlideItem(e).find(".lg-image").first(),r=this.core.galleryItems[e].width;return r?parseFloat(r):n.get().naturalWidth},t.prototype.getActualSizeScale=function(e,n){var r,o;return e>=n?(r=e/n,o=r||2):o=1,o},t.prototype.getCurrentImageActualSizeScale=function(){var e=this.core.getSlideItem(this.core.index).find(".lg-image").first(),n=e.get().offsetWidth,r=this.getNaturalWidth(this.core.index)||n;return this.getActualSizeScale(r,n)},t.prototype.getPageCords=function(e){var n={};if(e)n.x=e.pageX||e.touches[0].pageX,n.y=e.pageY||e.touches[0].pageY;else{var r=this.core.$content.get().getBoundingClientRect();n.x=r.width/2+r.left,n.y=r.height/2+this.scrollTop+r.top}return n},t.prototype.setPageCords=function(e){var n=this.getPageCords(e);this.pageX=n.x,this.pageY=n.y},t.prototype.manageActualPixelClassNames=function(){var e=this.core.getElementById("lg-actual-size");e.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},t.prototype.beginZoom=function(e){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),e>1},t.prototype.getScale=function(e){var n=this.getCurrentImageActualSizeScale();return e<1?e=1:e>n&&(e=n),e},t.prototype.init=function(){var e=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var n=null;this.core.outer.on("dblclick.lg",function(r){e.$LG(r.target).hasClass("lg-image")&&e.setActualSize(e.core.index,r)}),this.core.outer.on("touchstart.lg",function(r){var o=e.$LG(r.target);r.touches.length===1&&o.hasClass("lg-image")&&(n?(clearTimeout(n),n=null,r.preventDefault(),e.setActualSize(e.core.index,r)):n=setTimeout(function(){n=null},300))}),this.core.LGel.on(In.containerResize+".zoom "+In.rotateRight+".zoom "+In.rotateLeft+".zoom "+In.flipHorizontal+".zoom "+In.flipVertical+".zoom",function(){if(!(!e.core.lgOpened||!e.isImageSlide(e.core.index)||e.core.touchAction)){var r=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();e.top=0,e.left=0,e.setZoomEssentials(),e.setZoomSwipeStyles(r,{x:0,y:0}),e.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){e.core.lgOpened&&(e.scrollTop=e.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(e.isImageSlide(e.core.index)){var r=0;e.imageReset&&(e.resetImageTranslate(e.core.index),r=50),setTimeout(function(){var o=e.scale-e.settings.scale;o<1&&(o=1),e.beginZoom(o),e.zoomImage(o,-e.settings.scale,!0,!e.settings.infiniteZoom)},r)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){e.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){e.setActualSize(e.core.index)}),this.core.LGel.on(In.beforeOpen+".zoom",function(){e.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(In.afterOpen+".zoom",function(){e.scrollTop=e.$LG(window).scrollTop(),e.pageX=e.core.outer.width()/2,e.pageY=e.core.outer.height()/2+e.scrollTop,e.scale=1}),this.core.LGel.on(In.afterSlide+".zoom",function(r){var o=r.detail.prevIndex;e.scale=1,e.positionChanged=!1,e.zoomInProgress=!1,e.resetZoom(o),e.resetImageTranslate(o),e.isImageSlide(e.core.index)&&e.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},t.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var e=this.scale+this.settings.scale;this.settings.infiniteZoom||(e=this.getScale(e)),this.beginZoom(e),this.zoomImage(e,Math.min(this.settings.scale,e-this.scale),!0,!this.settings.infiniteZoom)}},t.prototype.resetZoom=function(e){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var n=this.core.getElementById("lg-actual-size"),r=this.core.getSlideItem(e!==void 0?e:this.core.index);n.removeClass(this.settings.actualSizeIcons.zoomOut).addClass(this.settings.actualSizeIcons.zoomIn),r.find(".lg-img-wrap").first().removeAttr("style"),r.find(".lg-image").first().removeAttr("style"),this.scale=1,this.left=0,this.top=0,this.setPageCords()},t.prototype.getTouchDistance=function(e){return Math.sqrt((e.touches[0].pageX-e.touches[1].pageX)*(e.touches[0].pageX-e.touches[1].pageX)+(e.touches[0].pageY-e.touches[1].pageY)*(e.touches[0].pageY-e.touches[1].pageY))},t.prototype.pinchZoom=function(){var e=this,n=0,r=!1,o=1,s=0,a=this.core.getSlideItem(this.core.index);this.core.outer.on("touchstart.lg",function(l){if(a=e.core.getSlideItem(e.core.index),!!e.isImageSlide(e.core.index)&&l.touches.length===2){if(l.preventDefault(),e.core.outer.hasClass("lg-first-slide-loading"))return;o=e.scale||1,e.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e.setPageCords(l),e.resetImageTranslate(e.core.index),e.core.touchAction="pinch",n=e.getTouchDistance(l)}}),this.core.$inner.on("touchmove.lg",function(l){if(l.touches.length===2&&e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){l.preventDefault();var c=e.getTouchDistance(l),d=n-c;if(!r&&Math.abs(d)>5&&(r=!0),r){s=e.scale;var u=Math.max(1,o+-d*.02);e.scale=Math.round((u+Number.EPSILON)*100)/100;var h=e.scale-s;e.zoomImage(e.scale,Math.round((h+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(l){if(e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){if(r=!1,n=0,e.scale<=1)e.resetZoom();else{var c=e.getCurrentImageActualSizeScale();if(e.scale>=c){var d=c-e.scale;d===0&&(d=.01),e.zoomImage(c,d,!1,!0)}e.manageActualPixelClassNames(),e.core.outer.addClass("lg-zoomed")}e.core.touchAction=void 0}})},t.prototype.touchendZoom=function(e,n,r,o,s){var a=n.x-e.x,l=n.y-e.y,c=Math.abs(a)/s+1,d=Math.abs(l)/s+1;c>2&&(c+=1),d>2&&(d+=1),a=a*c,l=l*d;var u=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),h={};h.x=this.left+a,h.y=this.top+l;var f=this.getPossibleSwipeDragCords();(Math.abs(a)>15||Math.abs(l)>15)&&(o&&(this.isBeyondPossibleTop(h.y,f.minY)?h.y=f.minY:this.isBeyondPossibleBottom(h.y,f.maxY)&&(h.y=f.maxY)),r&&(this.isBeyondPossibleLeft(h.x,f.minX)?h.x=f.minX:this.isBeyondPossibleRight(h.x,f.maxX)&&(h.x=f.maxX)),o?this.top=h.y:h.y=this.top,r?this.left=h.x:h.x=this.left,this.setZoomSwipeStyles(u,h),this.positionChanged=!0)},t.prototype.getZoomSwipeCords=function(e,n,r,o,s){var a={};if(o){if(a.y=this.top+(n.y-e.y),this.isBeyondPossibleTop(a.y,s.minY)){var l=s.minY-a.y;a.y=s.minY-l/6}else if(this.isBeyondPossibleBottom(a.y,s.maxY)){var c=a.y-s.maxY;a.y=s.maxY+c/6}}else a.y=this.top;if(r){if(a.x=this.left+(n.x-e.x),this.isBeyondPossibleLeft(a.x,s.minX)){var d=s.minX-a.x;a.x=s.minX-d/6}else if(this.isBeyondPossibleRight(a.x,s.maxX)){var u=a.x-s.maxX;a.x=s.maxX+u/6}}else a.x=this.left;return a},t.prototype.isBeyondPossibleLeft=function(e,n){return e>=n},t.prototype.isBeyondPossibleRight=function(e,n){return e<=n},t.prototype.isBeyondPossibleTop=function(e,n){return e>=n},t.prototype.isBeyondPossibleBottom=function(e,n){return e<=n},t.prototype.isImageSlide=function(e){var n=this.core.galleryItems[e];return this.core.getSlideType(n)==="image"},t.prototype.getPossibleSwipeDragCords=function(e){var n=this.core.getSlideItem(this.core.index).find(".lg-image").first(),r=this.core.mediaContainerPosition.bottom,o=n.get().getBoundingClientRect(),s=o.height,a=o.width;e&&(s=s+e*s,a=a+e*a);var l=(s-this.containerRect.height)/2,c=(this.containerRect.height-s)/2+r,d=(a-this.containerRect.width)/2,u=(this.containerRect.width-a)/2,h={minY:l,maxY:c,minX:d,maxX:u};return h},t.prototype.setZoomSwipeStyles=function(e,n){e.css("transform","translate3d("+n.x+"px, "+n.y+"px, 0)")},t.prototype.zoomSwipe=function(){var e=this,n={},r={},o=!1,s=!1,a=!1,l=new Date,c=new Date,d,u,h=this.core.getSlideItem(this.core.index);this.core.$inner.on("touchstart.lg",function(f){if(e.isImageSlide(e.core.index)&&(h=e.core.getSlideItem(e.core.index),(e.$LG(f.target).hasClass("lg-item")||h.get().contains(f.target))&&f.touches.length===1&&e.core.outer.hasClass("lg-zoomed"))){f.preventDefault(),l=new Date,e.core.touchAction="zoomSwipe",u=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var m=e.getDragAllowedAxises(0);a=m.allowY,s=m.allowX,(s||a)&&(n=e.getSwipeCords(f)),d=e.getPossibleSwipeDragCords(),e.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(f){if(f.touches.length===1&&e.core.touchAction==="zoomSwipe"&&(e.$LG(f.target).hasClass("lg-item")||h.get().contains(f.target))){f.preventDefault(),e.core.touchAction="zoomSwipe",r=e.getSwipeCords(f);var m=e.getZoomSwipeCords(n,r,s,a,d);(Math.abs(r.x-n.x)>15||Math.abs(r.y-n.y)>15)&&(o=!0,e.setZoomSwipeStyles(u,m))}}),this.core.$inner.on("touchend.lg",function(f){if(e.core.touchAction==="zoomSwipe"&&(e.$LG(f.target).hasClass("lg-item")||h.get().contains(f.target))){if(f.preventDefault(),e.core.touchAction=void 0,e.core.outer.removeClass("lg-zoom-dragging"),!o)return;o=!1,c=new Date;var m=c.valueOf()-l.valueOf();e.touchendZoom(n,r,s,a,m)}})},t.prototype.zoomDrag=function(){var e=this,n={},r={},o=!1,s=!1,a=!1,l=!1,c,d,u,h;this.core.outer.on("mousedown.lg.zoom",function(f){if(e.isImageSlide(e.core.index)){var m=e.core.getSlideItem(e.core.index);if(e.$LG(f.target).hasClass("lg-item")||m.get().contains(f.target)){c=new Date,h=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var p=e.getDragAllowedAxises(0);l=p.allowY,a=p.allowX,e.core.outer.hasClass("lg-zoomed")&&e.$LG(f.target).hasClass("lg-object")&&(a||l)&&(f.preventDefault(),n=e.getDragCords(f),u=e.getPossibleSwipeDragCords(),o=!0,e.core.outer.removeClass("lg-grab").addClass("lg-grabbing lg-zoom-drag-transition lg-zoom-dragging"))}}}),this.$LG(window).on("mousemove.lg.zoom.global"+this.core.lgId,function(f){if(o){s=!0,r=e.getDragCords(f);var m=e.getZoomSwipeCords(n,r,a,l,u);e.setZoomSwipeStyles(h,m)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(f){if(o){if(d=new Date,o=!1,e.core.outer.removeClass("lg-zoom-dragging"),s&&(n.x!==r.x||n.y!==r.y)){r=e.getDragCords(f);var m=d.valueOf()-c.valueOf();e.touchendZoom(n,r,a,l,m)}s=!1}e.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},t.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},t.prototype.destroy=function(){this.$LG(window).off(".lg.zoom.global"+this.core.lgId),this.core.LGel.off(".lg.zoom"),this.core.LGel.off(".zoom"),clearTimeout(this.zoomableTimeout),this.zoomableTimeout=!1},t})();const fp={ref:"gallery-container",class:"lightgallery-wrapper"},hp={},Rl=i.defineComponent({...hp,__name:"lightgallery",props:{settings:{},onAfterAppendSlide:{type:Function},onInit:{type:Function},onHasVideo:{type:Function},onContainerResize:{type:Function},onAfterAppendSubHtml:{type:Function},onBeforeOpen:{type:Function},onAfterOpen:{type:Function},onSlideItemLoad:{type:Function},onBeforeSlide:{type:Function},onAfterSlide:{type:Function},onPosterClick:{type:Function},onDragStart:{type:Function},onDragMove:{type:Function},onDragEnd:{type:Function},onBeforeNextSlide:{type:Function},onBeforePrevSlide:{type:Function},onBeforeClose:{type:Function},onAfterClose:{type:Function},onRotateLeft:{type:Function},onRotateRight:{type:Function},onFlipHorizontal:{type:Function},onFlipVertical:{type:Function}},setup(t){const e=t,n={lgAfterAppendSlide:e.onAfterAppendSlide,lgInit:e.onInit,lgHasVideo:e.onHasVideo,lgContainerResize:e.onContainerResize,lgAfterAppendSubHtml:e.onAfterAppendSubHtml,lgBeforeOpen:e.onBeforeOpen,lgAfterOpen:e.onAfterOpen,lgSlideItemLoad:e.onSlideItemLoad,lgBeforeSlide:e.onBeforeSlide,lgAfterSlide:e.onAfterSlide,lgPosterClick:e.onPosterClick,lgDragStart:e.onDragStart,lgDragMove:e.onDragMove,lgDragEnd:e.onDragEnd,lgBeforeNextSlide:e.onBeforeNextSlide,lgBeforePrevSlide:e.onBeforePrevSlide,lgBeforeClose:e.onBeforeClose,lgAfterClose:e.onAfterClose,lgRotateLeft:e.onRotateLeft,lgRotateRight:e.onRotateRight,lgFlipHorizontal:e.onFlipHorizontal,lgFlipVertical:e.onFlipVertical},r=i.useTemplateRef("gallery-container"),o=i.ref(null);return i.onMounted(async()=>{if(!r.value)return;const s=await import("lightgallery");o.value=s.default(r.value,{...e.settings}),D.forOwn(n,(a,l)=>{var c;a&&((c=r.value)==null||c.addEventListener(l,a))})}),i.onBeforeUnmount(()=>{var s;o.value&&((s=o.value)==null||s.destroy(),o.value=null)}),(s,a)=>(i.openBlock(),i.createElementBlock("div",fp,[i.renderSlot(s.$slots,"default")],512))}}),gt=class gt{static init(){gt.isInitialized||(gt.isInitialized=!0,gt.windowResizeHandler(),window.addEventListener("resize",gt.windowResizeHandler))}static destroy(){window.removeEventListener("resize",gt.windowResizeHandler),gt.isInitialized=!1}static getDeviceTypeByResolution(){const e=j.useBaseConfigStateStore().config.deviceTypeByResolution;return window.innerWidth<e.tablet?Xe.phone:window.innerWidth<e.laptop?Xe.tablet:Xe.laptop}static initRefDependingOnDeviceResolution(e,n,r){const o=i.ref(r);return gt.setRefValueDependingOnDeviceResolution(o,e,n,r),gt.refsDependingOnDeviceResolution.push({r:o,phoneValue:e,tabletValue:n,defaultValue:r}),o}static isPhoneDevice(){return gt.getDeviceTypeByResolution()===Xe.phone}static isTabletDevice(){return gt.getDeviceTypeByResolution()===Xe.tablet}static isLaptopDevice(){return gt.getDeviceTypeByResolution()===Xe.laptop}static setRefValueDependingOnDeviceResolution(e,n,r,o){switch(gt.getDeviceTypeByResolution()){case Xe.phone:e.value=n;break;case Xe.tablet:e.value=r;break;default:e.value=o;break}}static windowResizeHandler(){D.forEach(gt.refsDependingOnDeviceResolution,e=>{gt.setRefValueDependingOnDeviceResolution(e.r,e.phoneValue,e.tabletValue,e.defaultValue)})}};T(gt,"isInitialized",!1),T(gt,"refsDependingOnDeviceResolution",[]);let et=gt;const mp=["href"],pp=["src","alt"],gp={},El=i.defineComponent({...gp,__name:"image-gallery",props:{images:{}},setup(t,{expose:e}){const n=i.ref(!1),r=i.ref(!1),o=i.ref({plugins:[cp,up],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),s=()=>window.innerWidth*(et.getDeviceTypeByResolution()===Xe.phone?.7:.8),a=i.ref(s()),l=()=>{a.value=s()},c=()=>{n.value=!0};return i.onUnmounted(()=>{window.removeEventListener("resize",l)}),e({show:c}),window.addEventListener("resize",l),(d,u)=>{const h=$l,f=z.NPopover;return i.openBlock(),i.createBlock(f,{trigger:"manual",show:n.value,class:"sc-image",placement:"top-start",onClickoutside:u[3]||(u[3]=()=>{r.value||(n.value=!1)})},{trigger:i.withCtx(()=>[i.createElementVNode("div",{class:"inline-flex",onClick:u[0]||(u[0]=m=>n.value=!n.value)},[i.renderSlot(d.$slots,"default",{},()=>[i.createVNode(h)])])]),default:i.withCtx(()=>[i.createVNode(Rl,{settings:o.value,style:i.normalizeStyle(`max-width: ${a.value}px`),class:"flex flex-row overflow-x-scroll",onAfterOpen:u[1]||(u[1]=()=>{r.value=!0}),onAfterClose:u[2]||(u[2]=()=>{r.value=!1,n.value=!1})},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.images,(m,p)=>(i.openBlock(),i.createElementBlock("a",{key:p,href:m.image},[i.createElementVNode("img",{src:m.preview,alt:`Изображение #${p+1}`},null,8,pp)],8,mp))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),yp={class:"text-sm grid grid-cols-[auto_auto] gap-x-3 gap-y-1 items-baseline"},bp={class:"pr-3"},_p={class:"text-right"},wp={},xp=i.defineComponent({...wp,__name:"product-stock-count",props:{product:{}},setup(t){return(e,n)=>{const r=ps,o=z.NPopover;return i.openBlock(),i.createBlock(o,{trigger:"click",placement:"top-start",class:"sc-stock-count"},{trigger:i.withCtx(()=>[i.renderSlot(e.$slots,"default",{},()=>[i.createVNode(r)])]),default:i.withCtx(()=>[i.createElementVNode("div",yp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.product.stockCount,(s,a)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:a},[i.createElementVNode("span",bp,i.toDisplayString(s.warehouse.name),1),i.createElementVNode("span",_p,[i.createTextVNode(i.toDisplayString(s.count??"В наличии")+" ",1),s.count?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(i.toDisplayString(t.product.unit.name),1)],64)):i.createCommentVNode("",!0)])],64))),128))])]),_:3})}}}),kp={class:"flex flex-row justify-between"},vp={key:0,class:"inline-flex flex-row gap-0.5 mr-2 align-sub"},Cp={key:1},Sp={class:"ml-2 align-sub"},Bp={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},Tp={class:"@container"},Np={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},$p={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},Rp={class:"text-sc-dark-grey"},Ep={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},Pp={class:"text-gray-600"},Fp={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},Vp={key:3,class:"underline decoration-dashed"},Mp={key:4,class:"sc-product-pack whitespace-nowrap"},Ap={class:"text-gray-600"},Ip={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},Op={class:"text-gray-600"},zp={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},Dp={key:0},Lp={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},Hp={},vr=i.defineComponent({...Hp,__name:"product-name",props:{product:{},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showCode:{type:Boolean,default:!0},showProductCosts:{type:[Boolean,Function],default:!1},showPlanningDates:{type:Boolean,default:!0},showPriceHistory:{type:Boolean,default:!1},showCostDate:{type:Boolean,default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},currencyRates:{default:void 0},showAdditionalSaleIcon:{type:Boolean,default:!1},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(t,{expose:e}){const n=t,r=i.computed(()=>D.isFunction(n.showProductCosts)?n.showProductCosts(n.product):n.showProductCosts),o=i.computed(()=>D.sortBy(n.product.priceCoefficients,["coefficient.slug"])),s=i.computed(()=>{var h,f;return(f=(h=n.product)==null?void 0:h.properties)==null?void 0:f.planingIncomingDate}),a=i.useTemplateRef("image-gallery"),l=()=>{var h;(h=a.value)==null||h.show()},c=i.computed(()=>D.isFunction(n.allowNameClick)?n.allowNameClick(n.product):n.allowNameClick),d=i.computed(()=>{var h;return n.showProductAddToCartButton||n.showProductEditButton||n.showProductRequiredButton||(((h=n.productContextButtonsConfig)==null?void 0:h.length)??0)>0}),u=()=>{var h;c.value&&((h=n.eventEmitter)==null||h.emit("product:name-click",{product:n.product,exposedMethods:{showProductImagesPreview:l}}))};return e({showProductImagesPreview:l}),(h,f)=>{var N,w,S,v;const m=ap,p=z.NTooltip,g=Tl,y=rp,b=$l,_=z.NText,k=Nl,x=ps,C=z.NScrollbar;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",kp,[i.createVNode(_,{type:"info",class:"sc-product-name text-balance text-base font-medium"},{default:i.withCtx(()=>{var $,E,A,R;return[($=t.product)!=null&&$.isFavorite||(E=t.product)!=null&&E.isPreviouslyOrdered||t.showAdditionalSaleIcon?(i.openBlock(),i.createElementBlock("div",vp,[((A=t.product)==null?void 0:A.isFavorite)??!1?(i.openBlock(),i.createBlock(p,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(m,{class:"!text-yellow-300"})]),default:i.withCtx(()=>[f[0]||(f[0]=i.createTextVNode(" Избранный товар ",-1))]),_:1})):i.createCommentVNode("",!0),((R=t.product)==null?void 0:R.isPreviouslyOrdered)??!1?(i.openBlock(),i.createBlock(p,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(g,{class:"!text-green-700"})]),default:i.withCtx(()=>[f[1]||(f[1]=i.createTextVNode(" Ранее заказанный товар ",-1))]),_:1})):i.createCommentVNode("",!0),t.showAdditionalSaleIcon?(i.openBlock(),i.createBlock(p,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(y,{class:"!text-green-500"})]),default:i.withCtx(()=>[f[2]||(f[2]=i.createTextVNode(" Дополнительная продажа ",-1))]),_:1})):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.createElementVNode("span",{class:i.normalizeClass({"cursor-pointer":c.value&&t.eventEmitter}),onClick:u},i.toDisplayString(t.product.name),3),t.product.onOrder?(i.openBlock(),i.createElementBlock("span",Cp," [Под заказ] ")):i.createCommentVNode("",!0),i.createElementVNode("span",Sp,[t.product.images&&t.product.images.length>0?(i.openBlock(),i.createBlock(El,{key:0,ref:"image-gallery",images:t.product.images},{default:i.withCtx(()=>[i.createElementVNode("div",Bp,[i.createVNode(b)])]),_:1},8,["images"])):i.createCommentVNode("",!0)])]}),_:1}),d.value?(i.openBlock(),i.createBlock(k,{key:0,product:t.product,"event-emitter":t.eventEmitter,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-edit-button":t.showProductEditButton,"show-product-required-button":t.showProductRequiredButton,"product-context-buttons-config":t.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","show-product-required-button","product-context-buttons-config"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",Tp,[i.createElementVNode("div",Np,[t.product.supplierSku?(i.openBlock(),i.createElementBlock("div",$p,[f[3]||(f[3]=i.createTextVNode(" Артикул производителя/поставщика: ",-1)),i.createElementVNode("span",Rp,i.toDisplayString(t.product.supplierSku),1)])):i.createCommentVNode("",!0),t.showCode?(i.openBlock(),i.createElementBlock("span",Ep,[f[4]||(f[4]=i.createTextVNode(" Артикул: ",-1)),i.createElementVNode("span",Pp,i.toDisplayString(t.product.code),1)])):i.createCommentVNode("",!0),t.product.stockCount&&t.product.stockCount.length>0?(i.openBlock(),i.createBlock(xp,{key:2,product:t.product},{default:i.withCtx(()=>[i.createElementVNode("span",Fp,[f[5]||(f[5]=i.createElementVNode("span",{class:"underline decoration-dashed"},"В наличии",-1)),i.createVNode(x,{class:"mt-0.5"})])]),_:1},8,["product"])):(i.openBlock(),i.createElementBlock("span",Vp," Нет в наличии ")),t.product.pack??((w=(N=t.product)==null?void 0:N.properties)==null?void 0:w.pack)?(i.openBlock(),i.createElementBlock("span",Mp,[f[6]||(f[6]=i.createTextVNode(" Норма упаковки: ",-1)),i.createElementVNode("span",Ap,i.toDisplayString(t.product.pack??((v=(S=t.product)==null?void 0:S.properties)==null?void 0:v.pack)),1)])):i.createCommentVNode("",!0),t.showPlanningDates&&s.value?(i.openBlock(),i.createElementBlock("span",Ip,[f[7]||(f[7]=i.createTextVNode(" Планируемая дата поступления на основной склад: ",-1)),i.createElementVNode("span",Op,i.toDisplayString(s.value),1)])):i.createCommentVNode("",!0)])]),i.createVNode(C,{"x-scrollable":""},{default:i.withCtx(()=>[r.value?(i.openBlock(),i.createElementBlock("div",zp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,$=>(i.openBlock(),i.createBlock(ni,{key:$.coefficient.slug,product:t.product,"cost-field-name":$.coefficient.slug??"","event-emitter":t.eventEmitter,"allow-price-click":t.allowPriceClick,"show-tag":!0,"show-price-history":t.showPriceHistory,"currency-rates":t.currencyRates},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history","currency-rates"]))),128)),i.createVNode(ni,{product:t.product,"event-emitter":t.eventEmitter,"allow-price-click":t.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":t.showCostDate,"show-price-history":t.showPriceHistory,"currency-rates":t.currencyRates,"cost-field-name":"cost","additional-through-field-name":"retailCost",style:{"background-color":"var(--n-merged-td-color)"},class:"sticky right-0 border-0 border-l-2 border-solid border-gray-300 pl-2"},null,8,["product","event-emitter","allow-price-click","show-cost-date","show-price-history","currency-rates"])])):i.createCommentVNode("",!0)]),_:1}),t.showSlugs||t.showProperties?(i.openBlock(),i.createElementBlock("div",Dp,[i.createElementVNode("ul",Lp,[t.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:t.product.id,slug:t.product.slug},($,E)=>(i.openBlock(),i.createElementBlock("li",{key:E}," ("+i.toDisplayString(E)+"): "+i.toDisplayString($),1))),128)):i.createCommentVNode("",!0),t.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(t.product.properties,($,E)=>(i.openBlock(),i.createElementBlock("li",{key:E}," ("+i.toDisplayString(E)+"): "+i.toDisplayString($),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)])}}}),Wp=(t,e,n)=>({key:t,title:e,className:"align-top",resizable:!0,render:r=>i.h(ni,{product:r,costFieldName:t,eventEmitter:n.eventEmitter,allowPriceClick:n.allowPriceClick,currencyRates:n.currencyRates})}),jp=(t,e)=>{if(t.length===0)return[];const n=[],r={};switch(D.isNil(e.isProductItemSelected)||n.push({key:"checkbox",title:"",className:"align-top",width:"32",render:o=>{var s,a;return i.h(z.NCheckbox,{checked:!!((s=e.isProductItemSelected)!=null&&s.call(e,o)),disabled:((a=e.isProductItemSelected)==null?void 0:a.call(e,o))==="disabled",onUpdateChecked:l=>{e.eventEmitter.emit("product:checked",{product:o,checked:l})}})}}),et.getDeviceTypeByResolution()){case Xe.phone:case Xe.tablet:n.push({key:"name",title:"Наименование",className:"align-top",render:o=>i.h(vr,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig})});break;default:n.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:o=>i.h(vr,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,currencyRates:e.currencyRates})}),e.showProductCosts&&(D.forEach(t,o=>{D.forEach(o.priceCoefficients,s=>{r[s.coefficient.slug??""]||(r[s.coefficient.slug??""]=s.coefficient)})}),D.forEach(D.sortBy(r,["slug"]),o=>{n.push(Wp(o.slug??"",o.name,e))}),n.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:o=>i.h(ni,{product:o,costFieldName:"cost",additionalThroughFieldName:"retailCost",eventEmitter:e.eventEmitter,allowPriceClick:e.allowPriceClick,showQuantityUnit:!0,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,currencyRates:e.currencyRates})})),(e.showProductEditButton||e.showProductRequiredButton||e.showProductAddToCartButton||!D.isNil(e.productContextButtonsConfig))&&n.push({key:"actions",title:"",className:"align-top",width:"50",render:o=>i.h(Nl,{product:o,eventEmitter:e.eventEmitter,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,productContextButtonsConfig:e.productContextButtonsConfig})});break}return n},qp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Xp(t,e){return i.openBlock(),i.createElementBlock("svg",qp,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",d:"M296 64h-80a7.91 7.91 0 0 0-8 8v24h96V72a7.91 7.91 0 0 0-8-8"},null,-1),i.createElementVNode("path",{fill:"currentColor",d:"M432 96h-96V72a40 40 0 0 0-40-40h-80a40 40 0 0 0-40 40v24H80a16 16 0 0 0 0 32h17l19 304.92c1.42 26.85 22 47.08 48 47.08h184c26.13 0 46.3-19.78 48-47l19-305h17a16 16 0 0 0 0-32M192.57 416H192a16 16 0 0 1-16-15.43l-8-224a16 16 0 1 1 32-1.14l8 224A16 16 0 0 1 192.57 416M272 400a16 16 0 0 1-32 0V176a16 16 0 0 1 32 0Zm32-304h-96V72a7.91 7.91 0 0 1 8-8h80a7.91 7.91 0 0 1 8 8Zm32 304.57A16 16 0 0 1 320 416h-.58A16 16 0 0 1 304 399.43l8-224a16 16 0 1 1 32 1.14Z"},null,-1)])])}const io=i.markRaw({name:"ion-trash",render:Xp}),Yp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Up(t,e){return i.openBlock(),i.createElementBlock("svg",Yp,[...e[0]||(e[0]=[i.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)])])}const Pl=i.markRaw({name:"ion-plus",render:Up}),Kp={key:0,class:"flex w-fit items-center gap-2"},Gp={key:1,class:"flex flex-wrap gap-1"},Zp={key:0},Qp={key:2},Jp={},Cr=i.defineComponent({...Jp,__name:"configurators-product-info",props:{isProductSearching:{type:Boolean,default:!1},product:{default:void 0},validation:{default:void 0}},setup(t){const e=t,n=i.computed(()=>{var r,o;return(o=(r=e.product)==null?void 0:r.properties)==null?void 0:o.planingProductionDate});return(r,o)=>{const s=z.NSpin,a=z.NText;return t.isProductSearching?(i.openBlock(),i.createElementBlock("div",Kp,[i.createVNode(s,{size:17,class:"w-fit"}),o[0]||(o[0]=i.createElementVNode("div",null,"Выполняется поиск товара ...",-1))])):t.product&&!t.product.isNewRec()?(i.openBlock(),i.createElementBlock("div",Gp,[i.createElementVNode("div",null,i.toDisplayString(t.product.code)+" - "+i.toDisplayString(t.product.name)+" - "+i.toDisplayString(t.product.costRub.toLocaleString())+" ₽ / "+i.toDisplayString(t.product.unit.name),1),n.value?(i.openBlock(),i.createElementBlock("div",Zp,"(Планируемая дата производства: "+i.toDisplayString(n.value)+")",1)):i.createCommentVNode("",!0)])):t.validation?(i.openBlock(),i.createElementBlock("div",Qp,[i.createVNode(a,{type:t.validation.validationStatus},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.validation.feedback),1)]),_:1},8,["type"])])):i.createCommentVNode("",!0)}}}),eg={class:"flex flex-col gap-4"},tg={class:"flex flex-col gap-2"},ng={class:"mt-8 font-bold"},ig={class:"grid grow grid-cols-2 items-start gap-2"},rg={key:2,class:"text-red-500 text-sm"},og={key:3,class:"text-red-500 text-sm mb-2"},sg={class:"flex flex-col gap-4"},ag={key:1},lg={class:"text-lg font-semibold"},cg={class:"flex gap-3"},dg={},ug=i.defineComponent({...dg,__name:"kozyrek-configurator-params-form",props:{value:{},settings:{},previewParams:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},selectTemplateIndex:{}},emits:["update:value","update:params","submit","click:add-line","click:remove-line","click:save-template"],setup(t,{expose:e,emit:n}){var y;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.ref(!1),l=i.ref(D.cloneDeep(r.value)),c=i.computed(()=>{var _,k,x;const b={"configuratorParams.length":[ae.required,ae.min(r.settings.stripMinLength),ae.max(r.settings.stripMaxLength||Number.MAX_VALUE),ae.step(r.settings.lengthStep),We.serverValidation((_=r.validation.length)==null?void 0:_.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),We.serverValidation((k=r.validation.quantity)==null?void 0:k.feedback)],marker:[We.serverValidation((x=r.validation.marker)==null?void 0:x.feedback)]};return D.forEach(l.value.configuratorParams.linesWidths,(C,N)=>{var v;const S=l.value.configuratorParams.linesWidths.length>1?r.settings.minLineWidth:r.settings.stripMinWidth;b[`configuratorParams.linesWidths.${N}`]=[ae.required,ae.min(S),ae.max(r.settings.maxLineWidth),ae.step(r.settings.lineWidthStep),We.serverValidation((v=r.validation[`lines_widths[${N+1}]`])==null?void 0:v.feedback)]}),D.forEach(l.value.configuratorParams.linesAngles,(C,N)=>{var w;b[`configuratorParams.linesAngles.${N}`]=[ae.required,ae.min(r.settings.minLineAngle),ae.max(r.settings.maxLineAngle),ae.step(r.settings.lineAngleStep),We.serverValidation((w=r.validation[`lines_angles[${N+1}]`])==null?void 0:w.feedback)]}),b}),d=i.ref(r.settings.canSetDopProdaga??!1),u=i.computed(()=>{var C;const{length:b}=l.value.configuratorParams,{quantity:_}=l.value,k=((C=l.value.product)==null?void 0:C.costRub)||0;if(!b||!_||k===0)return null;const x=b/1e3;return(k*_*x).toLocaleString("ru-ru",{maximumFractionDigits:2,minimumFractionDigits:2})}),h=i.computed(()=>D.reduce(l.value.configuratorParams.linesWidths,(b,_)=>b+(_||0),0)),f=i.computed(()=>{const b=h.value;return b>=r.settings.stripMinWidth&&b<=r.settings.stripMaxWidth}),m=i.computed(()=>{const{configuratorParams:b}=l.value,_=D.every(b.linesWidths,N=>!!(N&&N>0)),k=D.every(b.linesAngles,N=>!D.isNil(N)),x=!!(l.value.quantity&&l.value.quantity>0),C=b.length>0&&b.length>0;return _&&k&&x&&C&&f.value}),p=()=>{i.nextTick(()=>{var b;(b=s.value)==null||b.validate(_=>{_||(o("update:params",l.value.configuratorParams),g("configuratorParams",l.value.configuratorParams))}).catch(D.noop)})},g=(b,_)=>{const k=new j.OrderItemBase(l.value);k[b]=_,b==="configuratorParams"&&(k.product=new j.ClientProduct),o("update:value",k)};return i.watch(()=>r.previewParams,b=>{l.value.configuratorParams.linesWidths=b.linesWidths,l.value.configuratorParams.linesAngles=b.linesAngles},{deep:!0}),i.watch(()=>r.value,b=>{l.value=D.cloneDeep(b)},{deep:!0}),e({validate:(y=s.value)==null?void 0:y.validate,formReference:s}),(b,_)=>{const k=Pl,x=io,C=z.NCheckbox;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:l.value,rules:c.value,class:"flex flex-col gap-4 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>{var N;return[i.createElementVNode("div",eg,[_[21]||(_[21]=i.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),t.settings.startTailConfigs&&t.settings.startTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(z.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:l.value.configuratorParams.startTailType,"onUpdate:value":[_[0]||(_[0]=w=>l.value.configuratorParams.startTailType=w),p],options:t.settings.startTailConfigs.map(({label:w},S)=>({label:w,value:S})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",tg,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value.configuratorParams.linesAngles,(w,S)=>(i.openBlock(),i.createElementBlock("div",{key:S,class:"flex items-start gap-2"},[i.createElementVNode("div",ng,i.toDisplayString(S+1),1),i.createElementVNode("div",ig,[i.createVNode(i.unref(z.NFormItem),{path:`configuratorParams.linesWidths.${S}`,label:"Ширина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:l.value.configuratorParams.linesWidths[S],"onUpdate:value":[v=>l.value.configuratorParams.linesWidths[S]=v,_[2]||(_[2]=v=>p())],parse:i.unref(lt),"show-button":!1,class:"w-full",onKeydown:_[1]||(_[1]=v=>i.unref(st)(v)),onInput:v=>i.unref(it)(t.validation,`lines_widths[${S+1}]`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(z.NFormItem),{path:`configuratorParams.linesAngles.${S}`,label:"Угол сгиба, °"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:l.value.configuratorParams.linesAngles[S],"onUpdate:value":[v=>l.value.configuratorParams.linesAngles[S]=v,_[4]||(_[4]=v=>p())],parse:i.unref(lt),"show-button":!1,class:"w-full",onKeydown:_[3]||(_[3]=v=>i.unref(st)(v,!0)),onInput:v=>i.unref(it)(t.validation,`lines_angles[${S+1}]`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"])]),i.createVNode(i.unref(z.NFormItem),{label:void 0,"show-feedback":!1,required:!0,class:"shrink-0"},{default:i.withCtx(()=>[t.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,size:"medium",onClick:v=>o("click:add-line",S)},{default:i.withCtx(()=>[i.createVNode(k)]),_:1},8,["onClick"])),t.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:1,disabled:l.value.configuratorParams.linesWidths.length===1,size:"medium",class:"ml-2",onClick:v=>o("click:remove-line",S)},{default:i.withCtx(()=>[i.createVNode(x)]),_:1},8,["disabled","onClick"]))]),_:2},1024)]))),128))]),t.settings.endTailConfigs&&t.settings.endTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(z.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:l.value.configuratorParams.endTailType,"onUpdate:value":[_[5]||(_[5]=w=>l.value.configuratorParams.endTailType=w),p],options:t.settings.endTailConfigs.map(({label:w},S)=>({label:w,value:S})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Cr,{"is-product-searching":t.isProductSearching,product:l.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),f.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",rg," Суммарная ширина участков гиба должна быть от "+i.toDisplayString(t.settings.stripMinWidth)+" до "+i.toDisplayString(t.settings.stripMaxWidth)+" мм., текущая ширина: "+i.toDisplayString(h.value)+" мм. ",1)),m.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",og," Пожалуйста, заполните все обязательные поля корректно. ")),t.settings.allowSaveTemplates&&t.selectTemplateIndex===((N=t.settings.allTemplates)==null?void 0:N.length)-1?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:4,type:"tertiary",class:"self-start",loading:a.value,onClick:_[6]||(_[6]=w=>o("click:save-template"))},{default:i.withCtx(()=>[..._[20]||(_[20]=[i.createTextVNode(" Сохранить шаблон ",-1)])]),_:1},8,["loading"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",sg,[i.createVNode(i.unref(z.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:l.value.configuratorParams.colorSide,"onUpdate:value":[_[7]||(_[7]=w=>l.value.configuratorParams.colorSide=w),p],options:[{label:"Цвет сверху",value:"top"},{label:" Цвет снизу",value:"bottom"}],placeholder:"С какой стороны изделие будет иметь цвет"},null,8,["value"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{path:"configuratorParams.length",label:`Метраж${t.settings.stripMinLength?" от "+t.settings.stripMinLength:""}${t.settings.stripMaxLength?" до "+t.settings.stripMaxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[_[8]||(_[8]=w=>l.value.configuratorParams.length=w),_[11]||(_[11]=w=>p())],parse:i.unref(lt),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:_[9]||(_[9]=w=>i.unref(st)(w)),onInput:_[10]||(_[10]=w=>i.unref(it)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(z.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:l.value.quantity,"onUpdate:value":[_[12]||(_[12]=w=>l.value.quantity=w),_[15]||(_[15]=w=>g("quantity",w??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:_[13]||(_[13]=w=>i.unref(st)(w,!1)),onInput:_[14]||(_[14]=w=>i.unref(it)(t.validation,"quantity")),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:l.value.marker??null,placeholder:"Введите маркировку",onInput:_[16]||(_[16]=w=>i.unref(it)(t.validation,"marker")),"onUpdate:value":_[17]||(_[17]=w=>{l.value.marker=w??null,g("marker",w??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(C,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":_[18]||(_[18]=w=>{l.value.isAdditionalSale=w??!1,g("isAdditionalSale",w??!1)})},{default:i.withCtx(()=>[..._[22]||(_[22]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),u.value?(i.openBlock(),i.createElementBlock("div",ag,[_[23]||(_[23]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",lg,i.toDisplayString(u.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",cg,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!m.value||l.value.product.isNewRec(),type:"primary",class:"self-start",onClick:_[19]||(_[19]=w=>o("submit",l.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(l.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])])]}),_:1},8,["model","rules"])),[[i.unref(ei),()=>o("submit",l.value)]])}}}),Fl=An(ug,[["__scopeId","data-v-ac7f1192"]]);var Vl=Object.defineProperty,fg=Object.defineProperties,hg=Object.getOwnPropertyDescriptors,Ml=Object.getOwnPropertySymbols,mg=Object.prototype.hasOwnProperty,pg=Object.prototype.propertyIsEnumerable,Al=t=>{throw TypeError(t)},ys=(t,e,n)=>e in t?Vl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Sr=(t,e)=>{for(var n in e||(e={}))mg.call(e,n)&&ys(t,n,e[n]);if(Ml)for(var n of Ml(e))pg.call(e,n)&&ys(t,n,e[n]);return t},bs=(t,e)=>fg(t,hg(e)),Il=(t,e)=>{for(var n in e)Vl(t,n,{get:e[n],enumerable:!0})},B=(t,e,n)=>ys(t,typeof e!="symbol"?e+"":e,n),Ol=(t,e,n)=>e.has(t)||Al("Cannot "+n),zt=(t,e,n)=>(Ol(t,e,"read from private field"),n?n.call(t):e.get(t)),zl=(t,e,n)=>e.has(t)?Al("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),gg=(t,e,n,r)=>(Ol(t,e,"write to private field"),e.set(t,n),n),Et={Image:null,isHeadless:!1,shim:function(t,e){return t.tagName=t.nodeName=e||"canvas",t.nodeType=1,t.getAttribute=function(n){return this[n]},t.setAttribute=function(n,r){return this[n]=r,this},t},polyfill:function(t,e){return Et.shim(t),typeof e<"u"&&(Et.Image=e),Et.isHeadless=!0,t}},Dl={};Il(Dl,{Curve:()=>Ui,getAnchorsFromArcData:()=>_g,getComponentOnCubicBezier:()=>Br,getControlPoints:()=>Zl,getCurveBoundingBox:()=>Ul,getCurveFromPoints:()=>Gl,getCurveLength:()=>Yl,getReflection:()=>ks,integrate:()=>Kl,subdivide:()=>xs});var Ll={};Il(Ll,{HALF_PI:()=>ct,NumArray:()=>_n,TWO_PI:()=>tt,decomposeMatrix:()=>bi,getComputedMatrix:()=>_s,getEffectiveStrokeWidth:()=>wn,getPoT:()=>jl,lerp:()=>Pt,mod:()=>rt,setMatrix:()=>Wl,toFixed:()=>Ie});var Ue;typeof window<"u"?Ue=window:typeof global<"u"?Ue=global:typeof self<"u"&&(Ue=self);var Hl,tt=Math.PI*2,ct=Math.PI*.5;function bi(t,e,n,r,o,s){let a;return arguments.length<=1?(a=t.a,e=t.b,n=t.c,r=t.d,o=t.e,s=t.f):a=t,{translateX:o,translateY:s,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(n*n+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function Wl(t){Hl=t}function _s(t,e){e=e&&e.identity()||new Hl;let n=t;const r=[];for(;n&&n._matrix;)r.push(n._matrix),n=n.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Pt(t,e,n){return n*(e-t)+t}var ws=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function jl(t){let e=0;for(;ws[e]&&ws[e]<t;)e++;return ws[e]}function rt(t,e){for(;t<0;)t+=e;return t%e}var _n=Ue.Float32Array||Array,yg=Math.floor;function Ie(t){return yg(t*1e6)/1e6}function wn(t,e){const n=t._linewidth;if(t.strokeAttenuation)return n;e||(e=t.worldMatrix||_s(t));const r=bi(e.elements[0],e.elements[3],e.elements[1],e.elements[4],e.elements[2],e.elements[5]),o=Math.max(Math.abs(r.scaleX),Math.abs(r.scaleY));return o>0?n/o:n}var ie={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},ee=class{constructor(){B(this,"_events",{}),B(this,"_bound",!1)}addEventListener(e,n){return(this._events[e]||(this._events[e]=[])).push(n),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,n){if(!this._events)return this;if(!e&&!n)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(n)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,n!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const n=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...n);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,n,r){const o=this;e&&(s.obj=e,s.name=n,s.handler=r,e.on(n,s));function s(){r.apply(o,arguments)}return o}ignore(e,n,r){return e.off(n,r),this}};B(ee,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),B(ee,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var ql={x:{enumerable:!0,get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this._bound&&this.dispatchEvent(ee.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this._bound&&this.dispatchEvent(ee.Types.change))}}},ln=class gr extends ee{constructor(e=0,n=0){super(),B(this,"_x",0),B(this,"_y",0);for(let r in ql)Object.defineProperty(this,r,ql[r]);this.x=e,this.y=n}static add(e,n){return new gr(e.x+n.x,e.y+n.y)}static sub(e,n){return new gr(e.x-n.x,e.y-n.y)}static subtract(e,n){return gr.sub(e,n)}static ratioBetween(e,n){return(e.x*n.x+e.y*n.y)/(e.length()*n.length())}static angleBetween(e,n){if(arguments.length>=4){const s=arguments[0]-arguments[2],a=arguments[1]-arguments[3];return Math.atan2(a,s)}const r=e.x-n.x,o=e.y-n.y;return Math.atan2(o,r)}static distanceBetween(e,n){return Math.sqrt(gr.distanceBetweenSquared(e,n))}static distanceBetweenSquared(e,n){const r=e.x-n.x,o=e.y-n.y;return r*r+o*o}set(e,n){return this.x=e,this.y=n,this}copy(e){return this.x=e.x,this.y=e.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new gr(this.x,this.y)}add(e,n){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x+=e,this.y+=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x+=e.x,this.y+=e.y):(this.x+=e,this.y+=n),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,n){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x-=e,this.y-=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x-=e.x,this.y-=e.y):(this.x-=e,this.y-=n),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(e){return this.sub.apply(this,arguments)}subtractSelf(e){return this.sub.apply(this,arguments)}multiply(e,n){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x*=e,this.y*=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x*=e.x,this.y*=e.y):(this.x*=e,this.y*=n),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,n){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x/=e,this.y/=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x/=e.x,this.y/=e.y):(this.x/=e,this.y/=n),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(e){return this.divide.apply(this,arguments)}divideScalar(e){return this.divide(e)}negate(){return this.multiply(-1)}dot(e){return this.x*e.x+this.y*e.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,n){return n=typeof n>"u"?1e-4:n,this.distanceTo(e)<n}lerp(e,n){const r=(e.x-this.x)*n+this.x,o=(e.y-this.y)*n+this.y;return this.set(r,o)}isZero(e){return e=typeof e>"u"?1e-4:e,this.length()<e}toString(){return this.x+", "+this.y}toObject(){return{x:Ie(this.x),y:Ie(this.y)}}rotate(e){const n=this.x,r=this.y,o=Math.cos(e),s=Math.sin(e);return this.x=n*o-r*s,this.y=n*s+r*o,this}};B(ln,"zero",new ln),B(ln,"left",new ln(-1,0)),B(ln,"right",new ln(1,0)),B(ln,"up",new ln(0,-1)),B(ln,"down",new ln(0,1));var re=ln,Ne=class fs extends re{constructor(e=0,n=0,r=0,o=0,s=0,a=0,l=ie.move){super(e,n),B(this,"controls",{left:new re,right:new re}),B(this,"_command",ie.move),B(this,"_relative",!0),B(this,"_rx",0),B(this,"_ry",0),B(this,"_xAxisRotation",0),B(this,"_largeArcFlag",0),B(this,"_sweepFlag",1);for(let d in Xl)Object.defineProperty(this,d,Xl[d]);this.command=l,this.relative=!0;const c=fs.makeBroadcast(this);this.controls.left.set(r,o).addEventListener(ee.Types.change,c),this.controls.right.set(s,a).addEventListener(ee.Types.change,c)}static makeBroadcast(e){return n;function n(){e._bound&&e.dispatchEvent(ee.Types.change)}}static fromObject(e){return new fs().copy(e)}copy(e){return this.x=e.x,this.y=e.y,typeof e.command=="string"&&(this.command=e.command),e.controls&&(e.controls.left&&this.controls.left.copy(e.controls.left),e.controls.right&&this.controls.right.copy(e.controls.right)),typeof e.relative=="boolean"&&(this.relative=e.relative),typeof e.rx=="number"&&(this.rx=e.rx),typeof e.ry=="number"&&(this.ry=e.ry),typeof e.xAxisRotation=="number"&&(this.xAxisRotation=e.xAxisRotation),typeof e.largeArcFlag=="number"&&(this.largeArcFlag=e.largeArcFlag),typeof e.sweepFlag=="number"&&(this.sweepFlag=e.sweepFlag),this}clone(){return new fs().copy(this)}toObject(){return{x:Ie(this.x),y:Ie(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Ie(this.rx),ry:Ie(this.ry),xAxisRotation:Ie(this.xAxisRotation),largeArcFlag:Ie(this.largeArcFlag),sweepFlag:Ie(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},Xl={command:{enumerable:!0,get:function(){return this._command},set:function(t){this._command!==t&&(this._command=t,this._bound&&this.dispatchEvent(ee.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(t){this._relative!==!!t&&(this._relative=!!t,this._bound&&this.dispatchEvent(ee.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(t){this._rx!==t&&(this._rx=t,this._bound&&this.dispatchEvent(ee.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(t){this._ry!==t&&(this._ry=t,this._bound&&this.dispatchEvent(ee.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(t){this._xAxisRotation!==t&&(this._xAxisRotation=t,this._bound&&this.dispatchEvent(ee.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(t){this._largeArcFlag!==t&&(this._largeArcFlag=t,this._bound&&this.dispatchEvent(ee.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(t){this._sweepFlag!==t&&(this._sweepFlag=t,this._bound&&this.dispatchEvent(ee.Types.change))}}},bg=0,xt={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.23",PublishDate:"2025-12-22T19:59:24.486Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return bg++}},Ui={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Br(t,e,n,r,o){const s=1-t;return s*s*s*e+3*s*s*t*n+3*s*t*t*r+t*t*t*o}function xs(t,e,n,r,o,s,a,l,c){c=c||Ui.RecursionLimit;const d=c+1;if(Math.abs(t-a)<.001&&Math.abs(e-l)<.001)return[new Ne(a,l)];const u=[];for(let h=0;h<d;h++){const f=h/d,m=Br(f,t,n,o,a),p=Br(f,e,r,s,l);u.push(new Ne(m,p))}return u}function Yl(t,e,n,r,o,s,a,l,c){if(t===n&&e===r&&o===a&&s===l){const y=a-t,b=l-e;return Math.sqrt(y*y+b*b)}const d=9*(n-o)+3*(a-t),u=6*(t+o)-12*n,h=3*(n-t),f=9*(r-s)+3*(l-e),m=6*(e+s)-12*r,p=3*(r-e);function g(y){const b=(d*y+u)*y+h,_=(f*y+m)*y+p;return Math.sqrt(b*b+_*_)}return Kl(g,0,1,c||Ui.RecursionLimit)}function Ul(t,e,n,r,o,s,a,l){const c=[],d=[[],[]];let u,h,f,m,p,g,y,b;for(let C=0;C<2;++C){if(C===0?(h=6*t-12*n+6*o,u=-3*t+9*n-9*o+3*a,f=3*n-3*t):(h=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,f=3*r-3*e),Math.abs(u)<.001){if(Math.abs(h)<.001)continue;m=-f/h,0<m&&m<1&&c.push(m);continue}y=h*h-4*f*u,b=Math.sqrt(y),!(y<0)&&(p=(-h+b)/(2*u),0<p&&p<1&&c.push(p),g=(-h-b)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,k=_,x;for(;_--;)m=c[_],x=1-m,d[0][_]=x*x*x*t+3*x*x*m*n+3*x*m*m*o+m*m*m*a,d[1][_]=x*x*x*e+3*x*x*m*r+3*x*m*m*s+m*m*m*l;return d[0][k]=t,d[1][k]=e,d[0][k+1]=a,d[1][k+1]=l,d[0].length=d[1].length=k+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function Kl(t,e,n,r){let o=Ui.abscissas[r-2],s=Ui.weights[r-2],a=.5*(n-e),l=a+e,c=0,d=r+1>>1,u=r&1?s[c++]*t(l):0;for(;c<d;){const h=a*o[c];u+=s[c++]*(t(l+h)+t(l-h))}return a*u}function Gl(t,e){const n=t.length,r=n-1;for(let o=0;o<n;o++){const s=t[o],a=e?rt(o-1,n):Math.max(o-1,0),l=e?rt(o+1,n):Math.min(o+1,r),c=t[a],d=s,u=t[l];Zl(c,d,u),d.command=o===0?ie.move:ie.curve}}function Zl(t,e,n){const r=re.angleBetween(t,e),o=re.angleBetween(n,e);let s=re.distanceBetween(t,e),a=re.distanceBetween(n,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=ct:l-=ct,e.controls.left.x=Math.cos(l)*s,e.controls.left.y=Math.sin(l)*s,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}function ks(t,e,n){return new re(2*t.x-(e.x+t.x)-(n?t.x:0),2*t.y-(e.y+t.y)-(n?t.y:0))}function _g(t,e,n,r,o,s,a){const l=xt.Resolution;for(let c=0;c<l;c++){let d=(c+1)/l;a&&(d=1-d);const u=d*s+o,h=n*Math.cos(u),f=r*Math.sin(u),m=new Ne(h,f);m.command=ie.line}}var Ql=Array.prototype.slice;function wg(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}var oe={isNaN:function(t){return typeof t=="number"&&t!==+t},isElement:function(t){return!!(t&&t.nodeType===1)},isObject:function(t){const e=typeof t;return e==="function"||e==="object"&&!!t},isFunction:function(t){return typeof t=="function"},extend:function(t){const e=Ql.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let o in r)t[o]=r[o]}return t},defaults:function(t){const e=Ql.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let o in r)t[o]===void 0&&(t[o]=r[o])}return t},each:function(t,e,n){const r=n||this,o=!wg(t)&&Object.keys(t),s=(o||t).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,t[l],l,t)}return t},performance:Ue.performance&&Ue.performance.now?Ue.performance:Date},Yt={hasEventListeners:typeof Ue.addEventListener=="function",bind:function(t,e,n,r){return this.hasEventListeners?t.addEventListener(e,n,!!r):t.attachEvent("on"+e,n),Yt},unbind:function(t,e,n,r){return Yt.hasEventListeners?t.removeEventListeners(e,n,!!r):t.detachEvent("on"+e,n),Yt},getRequestAnimationFrame:function(){const t=["ms","moz","webkit","o"];let e=0,n=Ue.requestAnimationFrame;if(!n){for(let o=0;o<t.length;o++)n=Ue[t[o]+"RequestAnimationFrame"]||n;n=n||r}function r(o,s){const a=new Date().getTime(),l=Math.max(0,16-(a-e)),c=Ue.setTimeout(d,l);e=a+l;function d(){o(a+l)}return c}return n}},Ki=Ue.document?Ue.document.createElement("div"):{};Ki.id="help-two-load",Object.defineProperty(Yt,"temp",{enumerable:!0,get:function(){return oe.isElement(Ki)&&!Ue.document.head.contains(Ki)&&(Ki.style.display="none",Ue.document.head.appendChild(Ki)),Ki}});var Dt=class extends Error{constructor(e){super(),B(this,"name","Two.js"),B(this,"message"),this.message=e}},xg=Ue.devicePixelRatio||1;function kg(t){return t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1}function vs(t){return xg/kg(t)}var ro=class{constructor(){B(this,"map",{})}add(e,n){return this.map[e]=n,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}},kt,ii=class extends Array{constructor(){super(),zl(this,kt,new ee),arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}get _events(){return zt(this,kt)}set _events(e){gg(this,kt,e)}get _bound(){return zt(this,kt)._bound}set _bound(e){zt(this,kt)._bound=e}addEventListener(){var e;return(e=zt(this,kt).addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=zt(this,kt).on)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=zt(this,kt).bind)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=zt(this,kt).removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=zt(this,kt).off)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=zt(this,kt).unbind)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=zt(this,kt).dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=zt(this,kt).trigger)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=zt(this,kt).listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=zt(this,kt).ignore)==null?void 0:e.apply(this,arguments)}pop(){const e=super.pop.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}shift(){const e=super.shift.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}push(){const e=super.push.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}unshift(){const e=super.unshift.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}splice(){const e=super.splice.apply(this,arguments);if(this.trigger(ee.Types.remove,e),arguments.length>2){const n=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(ee.Types.insert,n),this.trigger(ee.Types.order)}return e}sort(){return super.sort.apply(this,arguments),this.trigger(ee.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(ee.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(e,n){const r=[];for(let o=0;o<this.length;o++){const s=this[o];let a;n?a=e.call(n,s,o):a=e(s,o),r.push(a)}return r}};kt=new WeakMap;var Jl=class Dh extends ee{constructor(){super(),B(this,"_flagId",!1),B(this,"_flagClassName",!1),B(this,"_renderer",{}),B(this,"_id",xt.Identifier+xt.uniqueId()),B(this,"_className",""),B(this,"classList",[]);for(let e in ec)Object.defineProperty(this,e,ec[e])}static fromObject(e){const n=new Dh().copy(e);return"id"in e&&(n.id=e.id),n}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(e){return e.renderer&&typeof e.renderer.type=="string"&&(this.renderer.type=e.renderer.type),typeof e.className=="string"&&(this.className=e.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const n=this.renderer.ctx;this._renderer.texture&&(n.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(n.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const e=this._renderer.type;return this._renderer={type:e},this}};B(Jl,"Properties",["renderer","id","className"]);var Gi=Jl,ec={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(t){const e=this._id;t!==this._id&&(this._id=t,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(t){this._className!==t&&(this._flagClassName=!0,this.classList=t.split(/\s+?/),this._className=t)}}},oo,tc={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Ue.document&&(oo=document.createElement("a"));var cn=class Qt extends Gi{constructor(e,n){super(),B(this,"_flagSrc",!1),B(this,"_flagImage",!1),B(this,"_flagVideo",!1),B(this,"_flagLoaded",!1),B(this,"_flagRepeat",!1),B(this,"_flagOffset",!1),B(this,"_flagScale",!1),B(this,"_src",""),B(this,"_image",null),B(this,"_loaded",!1),B(this,"_repeat","no-repeat"),B(this,"_scale",1),B(this,"_offset",null);for(let r in nc)Object.defineProperty(this,r,nc[r]);if(this._renderer.type="texture",this._renderer.flagOffset=vg.bind(this),this._renderer.flagScale=Cg.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new re,typeof n=="function"){const r=(function(){this.unbind(ee.Types.load,r),typeof n=="function"&&n()}).bind(this);this.bind(ee.Types.load,r)}if(typeof e=="string")this.src=e;else if(typeof e=="object"){const r=Object.prototype.toString.call(e);(r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]"||r==="[object HTMLVideoElement]"||r==="[object Image]")&&(this.image=e)}this._update()}fromObject(e){const n=new Qt().copy(e);return"id"in e&&(n.id=e.id),n}static getAbsoluteURL(e){return oo?(oo.href=e,oo.href):e}static loadHeadlessBuffer(e,n){e.image.onload=n,e.image.src=e.src}static getTag(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"}static getImage(e){const n=Qt.getAbsoluteURL(e);if(Qt.ImageRegistry.contains(n))return Qt.ImageRegistry.get(n);let r;return Et.Image?(r=new Et.Image,Et.shim(r,"img")):Ue.document?tc.video.test(n)?r=document.createElement("video"):r=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),r.crossOrigin="anonymous",r.referrerPolicy="no-referrer",r}static load(e,n){let r=e.image,o=Qt.getTag(r);e._flagImage&&(/canvas/i.test(o)?Qt.Register.canvas(e,n):(e._src=!Et.isHeadless&&r.getAttribute("two-src")||r.src,Qt.Register[o](e,n))),e._flagSrc&&(r||(r=Qt.getImage(e.src),e.image=r),o=Qt.getTag(r),Qt.Register[o](e,n))}clone(){const e=new Qt(this.src);return e.repeat=this.repeat,e.offset.copy(this.offset),e.scale=this.scale,e}copy(e){return this.src=e.src,this.repeat=e.repeat,this.offset=typeof e.offset=="number"||e.offset instanceof re?e.offset:new re().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof re?e.scale:new re().copy(e.scale),this}toObject(){const e=super.toObject.call(this);return e.renderer.type="texture",e.src=this.src,e.repeat=this.repeat,e.offset=this.offset.toObject(),e.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),e}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(ee.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Qt.load(this,(function(){this.loaded=!0,this.trigger(ee.Types.change).trigger(ee.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};B(cn,"Properties",["src","loaded","repeat","scale","offset","image"]),B(cn,"RegularExpressions",tc),B(cn,"ImageRegistry",new ro),B(cn,"Register",{canvas:function(t,e){t._src="#"+t.id,cn.ImageRegistry.add(t.src,t.image),typeof e=="function"&&e()},img:function(t,e){const n=t.image,r=function(s){!Et.isHeadless&&n.removeEventListener&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",o,!1)),typeof e=="function"&&e()},o=function(s){throw!Et.isHeadless&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",o,!1)),new Dt("unable to load "+t.src)};typeof n.width=="number"&&n.width>0&&typeof n.height=="number"&&n.height>0?r():!Et.isHeadless&&typeof n.addEventListener=="function"&&(n.addEventListener("load",r,!1),n.addEventListener("error",o,!1)),t._src=cn.getAbsoluteURL(t._src),!(!Et.isHeadless&&n&&n.getAttribute("two-src"))&&(Et.isHeadless||n.setAttribute("two-src",t.src),cn.ImageRegistry.add(t.src,n),Et.isHeadless?cn.loadHeadlessBuffer(t,r):t.image.src=t.src)},video:function(t,e){if(Et.isHeadless)throw new Dt("video textures are not implemented in headless environments.");const n=function(o){t.image.removeEventListener("canplaythrough",n,!1),t.image.removeEventListener("error",r,!1),t.image.width=t.image.videoWidth,t.image.height=t.image.videoHeight,typeof e=="function"&&e()},r=function(o){throw t.image.removeEventListener("canplaythrough",n,!1),t.image.removeEventListener("error",r,!1),new Dt("unable to load "+t.src)};t._src=cn.getAbsoluteURL(t._src),t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),cn.ImageRegistry.add(t.src,t.image)),t.image.readyState>=4?n():(t.image.addEventListener("canplaythrough",n,!1),t.image.addEventListener("error",r,!1),t.image.src=t.src,t.image.load())}});var Oe=cn,nc={src:{enumerable:!0,get:function(){return this._src},set:function(t){this._src=t,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(t){this._loaded=t,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(t){this._repeat=t,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(t){const e=Oe.getTag(t);let n;switch(e){case"canvas":n="#"+t.id;break;default:n=t.src}Oe.ImageRegistry.contains(n)?this._image=Oe.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(ee.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(ee.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof re&&this._scale.unbind(ee.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof re&&this._scale.bind(ee.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function vg(){this._flagOffset=!0}function Cg(){this._flagScale=!0}var Cs=class bn extends Gi{constructor(e,n,r){super(),B(this,"_flagOffset",!0),B(this,"_flagOpacity",!0),B(this,"_flagColor",!0),B(this,"_offset",0),B(this,"_opacity",1),B(this,"_color","#fff");for(let o in ic)Object.defineProperty(this,o,ic[o]);this._renderer.type="stop",this.offset=typeof e=="number"?e:bn.Index<=0?0:1,this.opacity=typeof r=="number"?r:1,this.color=typeof n=="string"?n:bn.Index<=0?"#fff":"#000",bn.Index=(bn.Index+1)%2}static fromObject(e){const n=new bn().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<bn.Properties.length;n++){const r=bn.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new bn;return oe.each(bn.Properties,function(r){n[r]=this[r]},this),e&&e.stops&&e.stops.push(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="stop",oe.each(bn.Properties,n=>{e[n]=this[n]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};B(Cs,"Index",0),B(Cs,"Properties",["offset","opacity","color"]);var ri=Cs,ic={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Ss=class Di extends Gi{constructor(e){super(),B(this,"_flagStops",!1),B(this,"_flagSpread",!1),B(this,"_flagUnits",!1),B(this,"_spread",""),B(this,"_units","");for(let n in rc)Object.defineProperty(this,n,rc[n]);this._renderer.type="gradient",this._renderer.flagStops=Sg.bind(this),this._renderer.bindStops=Bg.bind(this),this._renderer.unbindStops=Tg.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static fromObject(e){let n=e.stops;n&&n.length>0&&(n=n.map(o=>o instanceof ri?o:new ri().copy(o)));const r=new Di(n).copy(e);return"id"in e&&(r.id=e.id),r}clone(e){const n=this.stops.map(o=>o.clone()),r=new Di(n);return oe.each(Di.Properties,o=>{r[o]=this[o]},this),e&&e.add(r),r}copy(e){super.copy.call(this,e);for(let n=0;n<Di.Properties.length;n++){const r=Di.Properties[n];r in e&&(this[r]=e[r])}return this}toObject(){const e={stops:this.stops.map(n=>n.toObject())};return oe.each(Di.Properties,n=>{e[n]=this[n]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};B(Ss,"Stop",ri),B(Ss,"Properties",["spread","stops","units"]);var dt=Ss,rc={spread:{enumerable:!0,get:function(){return this._spread},set:function(t){this._spread=t,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(t){this._units=t,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(t){const e=this._renderer.bindStops,n=this._renderer.unbindStops;this._stops&&this._stops.unbind(ee.Types.insert,e).unbind(ee.Types.remove,n),this._stops=new ii((t||[]).slice(0)),this._stops.bind(ee.Types.insert,e).bind(ee.Types.remove,n),e(this._stops)}}};function Sg(){this._flagStops=!0}function Bg(t){let e=t.length;for(;e--;)t[e].bind(ee.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function Tg(t){let e=t.length;for(;e--;)t[e].unbind(ee.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}var Bs=class Kr extends dt{constructor(e,n,r,o,s){super(s),B(this,"_flagEndPoints",!1),B(this,"_left",null),B(this,"_right",null);for(let a in oc)Object.defineProperty(this,a,oc[a]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Ng.bind(this),this.left=new re,this.right=new re,typeof e=="number"&&(this.left.x=e),typeof n=="number"&&(this.left.y=n),typeof r=="number"&&(this.right.x=r),typeof o=="number"&&(this.right.y=o)}static fromObject(e){const n=new Kr().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Kr.Properties.length;n++){const r=Kr.Properties[n];r in e&&(this[r]=e[r]instanceof re?e[r]:new re().copy(e[r]))}return this}clone(e){const n=this.stops.map(function(o){return o.clone()}),r=new Kr(this.left._x,this.left._y,this.right._x,this.right._y,n);return oe.each(dt.Properties,function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return e.left=this.left.toObject(),e.right=this.right.toObject(),e}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};B(Bs,"Stop",ri),B(Bs,"Properties",["left","right"]);var Ke=Bs,oc={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof re&&this._left.unbind(ee.Types.change,this._renderer.flagEndPoints),this._left=t,this._left.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(t){this._right instanceof re&&this._right.unbind(ee.Types.change,this._renderer.flagEndPoints),this._right=t,this._right.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function Ng(){this._flagEndPoints=!0}var Ts=class Li extends dt{constructor(e,n,r,o,s,a){super(o),B(this,"_flagRadius",!1),B(this,"_flagCenter",!1),B(this,"_flagFocal",!1),B(this,"_radius",0),B(this,"_center",null),B(this,"_focal",null);for(let l in sc)Object.defineProperty(this,l,sc[l]);this._renderer.type="radial-gradient",this._renderer.flagCenter=$g.bind(this),this._renderer.flagFocal=Rg.bind(this),this.center=new re,this.radius=typeof r=="number"?r:1,this.focal=new re,typeof e=="number"&&(this.center.x=e),typeof n=="number"&&(this.center.y=n),this.focal.copy(this.center),typeof s=="number"&&(this.focal.x=s),typeof a=="number"&&(this.focal.y=a)}static fromObject(e){const n=new Li().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Li.Properties.length;n++){const r=Li.Properties[n];r in e&&(/(center|focal)i/.test(r)?this[r]=e[r]instanceof re?e[r]:new re().copy(e[r]):typeof e[r]=="number"&&(this[r]=e[MediaKeySystemAccess]))}return this}clone(e){const n=this.stops.map(function(o){return o.clone()}),r=new Li(this.center._x,this.center._y,this._radius,n,this.focal._x,this.focal._y);return oe.each(dt.Properties.concat(Li.Properties),function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return oe.each(Li.Properties,function(n){e[n]=this[n]},this),e.center=this.center.toObject(),e.focal=this.focal.toObject(),e}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};B(Ts,"Stop",ri),B(Ts,"Properties",["center","radius","focal"]);var Ge=Ts,sc={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(t){this._center&&this._center.unbind(ee.Types.change,this._renderer.flagCenter),this._center=t,this._center.bind(ee.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(t){this._focal&&this._focal.unbind(ee.Types.change,this._renderer.flagFocal),this._focal=t,this._focal.bind(ee.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function $g(){this._flagCenter=!0}function Rg(){this._flagFocal=!0}function ac(t,e){if(e===0||e===1)return!0;const r=t._length*e;let o=0;for(let s=0;s<t._lengths.length;s++){const a=t._lengths[s];if(o>=r)return r-o>=0;o+=a}return!1}function so(t,e){const n=t._length;if(e<=0)return 0;if(e>=n)return t._lengths.length-1;for(let r=0,o=0;r<t._lengths.length;r++){if(o+t._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/t._lengths[r];o+=t._lengths[r]}return-1}function lc(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,f=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(f||t).x,d=(f||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),f&&t._relative&&(s+=t.x,d+=t.y),Yl(r,l,o,c,s,d,a,u,n)}function Ns(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,f=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(f||t).x,d=(f||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),f&&t._relative&&(s+=t.x,d+=t.y),xs(r,l,o,c,s,d,a,u,n)}function _i(t){switch(t.renderer.type){case"texture":return Oe.fromObject(t);case"gradient":return dt.fromObject(t);case"linear-gradient":return Ke.fromObject(t);case"radial-gradient":return Ge.fromObject(t)}return t}var Eg=Math.cos,Pg=Math.sin,cc=Math.tan,$s=[],dc=class Jt extends ee{constructor(e,n,r,o,s,a){super(),B(this,"elements",new _n(9)),B(this,"manual",!1);let l=e;Array.isArray(l)||(l=Array.prototype.slice.call(arguments)),this.identity(),l.length>0&&this.set(l)}static Multiply(e,n,r){if(n.length<=3){const N=e;let w,S,v;const $=n[0]||0,E=n[1]||0,A=n[2]||0;return w=N[0]*$+N[1]*E+N[2]*A,S=N[3]*$+N[4]*E+N[5]*A,v=N[6]*$+N[7]*E+N[8]*A,[w,S,v]}const o=e[0],s=e[1],a=e[2],l=e[3],c=e[4],d=e[5],u=e[6],h=e[7],f=e[8],m=n[0],p=n[1],g=n[2],y=n[3],b=n[4],_=n[5],k=n[6],x=n[7],C=n[8];return r=r||new _n(9),r[0]=o*m+s*y+a*k,r[1]=o*p+s*b+a*x,r[2]=o*g+s*_+a*C,r[3]=l*m+c*y+d*k,r[4]=l*p+c*b+d*x,r[5]=l*g+c*_+d*C,r[6]=u*m+h*y+f*k,r[7]=u*p+h*b+f*x,r[8]=u*g+h*_+f*C,r}static fromObject(e){return new Jt().copy(e)}set(e,n,r,o,s,a,l,c,d){if(typeof n>"u"){const u=e;e=u[0],n=u[1],r=u[2],o=u[3],s=u[4],a=u[5],l=u[6],c=u[7],d=u[8]}return this.elements[0]=e,this.elements[1]=n,this.elements[2]=r,this.elements[3]=o,this.elements[4]=s,this.elements[5]=a,this.elements[6]=l,this.elements[7]=c,this.elements[8]=d,this.trigger(ee.Types.change)}copy(e){return this.elements[0]=e.elements[0],this.elements[1]=e.elements[1],this.elements[2]=e.elements[2],this.elements[3]=e.elements[3],this.elements[4]=e.elements[4],this.elements[5]=e.elements[5],this.elements[6]=e.elements[6],this.elements[7]=e.elements[7],this.elements[8]=e.elements[8],this.manual=e.manual,this.trigger(ee.Types.change)}identity(){return this.elements[0]=Jt.Identity[0],this.elements[1]=Jt.Identity[1],this.elements[2]=Jt.Identity[2],this.elements[3]=Jt.Identity[3],this.elements[4]=Jt.Identity[4],this.elements[5]=Jt.Identity[5],this.elements[6]=Jt.Identity[6],this.elements[7]=Jt.Identity[7],this.elements[8]=Jt.Identity[8],this.trigger(ee.Types.change)}multiply(e,n,r,o,s,a,l,c,d){if(typeof n>"u")return this.elements[0]*=e,this.elements[1]*=e,this.elements[2]*=e,this.elements[3]*=e,this.elements[4]*=e,this.elements[5]*=e,this.elements[6]*=e,this.elements[7]*=e,this.elements[8]*=e,this.trigger(ee.Types.change);if(typeof r>"u"&&(r=1),typeof o>"u"){e=e||0,n=n||0,r=r||0,s=this.elements;const F=s[0]*e+s[1]*n+s[2]*r,H=s[3]*e+s[4]*n+s[5]*r,Q=s[6]*e+s[7]*n+s[8]*r;return[F,H,Q]}const u=this.elements,h=[e,n,r,o,s,a,l,c,d],f=u[0],m=u[1],p=u[2],g=u[3],y=u[4],b=u[5],_=u[6],k=u[7],x=u[8],C=h[0],N=h[1],w=h[2],S=h[3],v=h[4],$=h[5],E=h[6],A=h[7],R=h[8];return this.elements[0]=f*C+m*S+p*E,this.elements[1]=f*N+m*v+p*A,this.elements[2]=f*w+m*$+p*R,this.elements[3]=g*C+y*S+b*E,this.elements[4]=g*N+y*v+b*A,this.elements[5]=g*w+y*$+b*R,this.elements[6]=_*C+k*S+x*E,this.elements[7]=_*N+k*v+x*A,this.elements[8]=_*w+k*$+x*R,this.trigger(ee.Types.change)}inverse(e){const n=this.elements;e=e||new Jt;const r=n[0],o=n[1],s=n[2],a=n[3],l=n[4],c=n[5],d=n[6],u=n[7],h=n[8],f=h*l-c*u,m=-h*a+c*d,p=u*a-l*d;let g=r*f+o*m+s*p;return g?(g=1/g,e.elements[0]=f*g,e.elements[1]=(-h*o+s*u)*g,e.elements[2]=(c*o-s*l)*g,e.elements[3]=m*g,e.elements[4]=(h*r-s*d)*g,e.elements[5]=(-c*r+s*a)*g,e.elements[6]=p*g,e.elements[7]=(-u*r+o*d)*g,e.elements[8]=(l*r-o*a)*g,e):null}scale(e,n){return arguments.length<=1&&(n=e),this.multiply(e,0,0,0,n,0,0,0,1)}rotate(e){const n=Eg(e),r=Pg(e);return this.multiply(n,-r,0,r,n,0,0,0,1)}translate(e,n){return this.multiply(1,0,e,0,1,n,0,0,1)}skewX(e){const n=cc(e);return this.multiply(1,n,0,0,1,0,0,0,1)}skewY(e){const n=cc(e);return this.multiply(1,0,0,n,1,0,0,0,1)}toString(e){return $s.length=0,this.toTransformArray(e,$s),$s.map(Ie).join(" ")}toTransformArray(e,n){const r=this.elements,o=!!n,s=r[0],a=r[1],l=r[2],c=r[3],d=r[4],u=r[5];if(e){const h=r[6],f=r[7],m=r[8];if(o){n[0]=s,n[1]=c,n[2]=h,n[3]=a,n[4]=d,n[5]=f,n[6]=l,n[7]=u,n[8]=m;return}return[s,c,h,a,d,f,l,u,m]}if(o){n[0]=s,n[1]=c,n[2]=a,n[3]=d,n[4]=l,n[5]=u;return}return[s,c,a,d,l,u]}toArray(e,n){const r=this.elements,o=!!n,s=r[0],a=r[1],l=r[2],c=r[3],d=r[4],u=r[5];if(e){const h=r[6],f=r[7],m=r[8];if(o){n[0]=s,n[1]=a,n[2]=l,n[3]=c,n[4]=d,n[5]=u,n[6]=h,n[7]=f,n[8]=m;return}return[s,a,l,c,d,u,h,f,m]}if(o){n[0]=s,n[1]=a,n[2]=l,n[3]=c,n[4]=d,n[5]=u;return}return[s,a,l,c,d,u]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Jt().copy(this)}};B(dc,"Identity",[1,0,0,0,1,0,0,0,1]);var wi=dc;Wl(wi);var uc=class bl extends Gi{constructor(){super(),B(this,"_flagMatrix",!0),B(this,"_flagScale",!1),B(this,"_matrix",null),B(this,"_worldMatrix",null),B(this,"_position",null),B(this,"_rotation",0),B(this,"_scale",1),B(this,"_skewX",0),B(this,"_skewY",0);for(let e in ao)Object.defineProperty(this,e,ao[e]);this._renderer.flagMatrix=fc.bind(this),this.isShape=!0,this.matrix=new wi,this.worldMatrix=new wi,this.position=new re,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const n=new bl().copy(e);return"id"in e&&(n.id=e.id),n}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return ao.position.get.apply(this,arguments)}set translation(e){ao.position.set.apply(this,arguments)}addTo(e){return e.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(e,n,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&"visible"in this&&this.visible===!1||!s&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const a=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const l=this.getBoundingClientRect();return l?e>=l.left-a&&e<=l.right+a&&n>=l.top-a&&n<=l.bottom+a:!1}copy(e){return super.copy.call(this,e),"position"in e&&(e.position instanceof re?this.position=e.position:this.position.copy(e.position)),"rotation"in e&&(this.rotation=e.rotation),"scale"in e&&(this.scale=typeof e.scale=="number"||e.scale instanceof re?e.scale:new re(e.scale.x,e.scale.y)),"skewX"in e&&(this.skewX=e.skewX),"skewY"in e&&(this.skewY=e.skewY),"matrix"in e&&e.matrix.manual&&(this.matrix.copy(e.matrix),this.matrix.manual=!0),this}clone(e){const n=new bl;return n.position.copy(this.position),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);return e.renderer={type:"shape"},e.isShape=!0,e.translation=this.translation.toObject(),e.rotation=this.translation.rotation,e.scale=this.scale instanceof re?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,e.matrix=this.matrix.toObject(),e}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(e){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof re?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),e&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};B(uc,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var On=uc,ao={position:{enumerable:!0,get:function(){return this._position},set:function(t){this._position&&this._position.unbind(ee.Types.change,this._renderer.flagMatrix),this._position=t,this._position.bind(ee.Types.change,this._renderer.flagMatrix),fc.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof re&&this._scale.unbind(ee.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof re&&this._scale.bind(ee.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(t){this._skewX=t,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(t){this._skewY=t,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(t){this._matrix=t,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return _s(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function fc(){this._flagMatrix=!0}var hc=/^(?:none|transparent)$/i,Fg=8,Rs=Number.EPSILON;function zn(t,e){return{x:t,y:e}}function lo(t,e,n=Rs){return Math.abs(t.x-e.x)<=n&&Math.abs(t.y-e.y)<=n}function mc(t,e,n,r){const o=t*n+e*r,s=Math.sqrt(t*t+e*e)*Math.sqrt(n*n+r*r)||1e-12;let a=Math.acos(Math.max(-1,Math.min(1,o/s)));return t*r-e*n<0&&(a=-a),a}function Vg(t,e,n){if(!t)return[zn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[zn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,a=e.largeArcFlag?1:0,l=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=t.x,d=t.y,u=e.x,h=e.y,f=(c-u)/2,m=(d-h)/2,p=Math.cos(s),g=Math.sin(s);let y=p*f+g*m,b=-g*f+p*m,_=r*r,k=o*o;const x=y*y/_+b*b/k;if(x>1){const P=Math.sqrt(x);r*=P,o*=P,_=r*r,k=o*o}const C=_*b*b+k*y*y,N=C===0?0:(_*k-C)/C;let w=Math.sqrt(Math.max(0,N));a===l&&(w=-w);const S=w*r*b/o,v=-w*o*y/r,$=p*S-g*v+(c+u)/2,E=g*S+p*v+(d+h)/2,A=mc(1,0,(y-S)/r,(b-v)/o),R=mc((y-S)/r,(b-v)/o,(-y-S)/r,(-b-v)/o)%tt,F=A+R,H=l===0,Q=(()=>{const P=F-A,V=Math.abs(P)<Number.EPSILON;let M=rt(P,tt);return M<Number.EPSILON&&(M=V?0:tt),H&&!V&&(M=M===tt?-tt:M-tt),M})(),Z=Math.max(xt.Resolution,Math.max(n*2,1)),O=[];for(let P=1;P<=Z;P++){const V=P/Z,M=A+V*Q;let L=$+r*Math.cos(M),Y=E+o*Math.sin(M);if(s!==0){const U=L-$,G=Y-E,q=Math.cos(s),W=Math.sin(s);L=U*q-G*W+$,Y=U*W+G*q+E}O.push(zn(L,Y))}return O}function Mg(t,e=Fg){const n=[],r=[],o=t._renderer&&t._renderer.vertices&&t._renderer.vertices.length>0?t._renderer.vertices:t.vertices;if(!o||o.length===0)return{polygons:n,segments:r};const s=Math.max(1,Math.floor(e));let a=null,l=null,c=null,d=null;const u=(f=!1)=>{if(a){if(f&&l&&c&&!lo(l,c)){const m=zn(l.x,l.y);r.push({a:c,b:m}),a.push(m),c=m}a.length>=3&&l&&c&&lo(l,c)&&n.push(a),a=null,l=null,c=null}},h=f=>{if(!c){c=f,a&&a.push(f);return}lo(c,f)||(r.push({a:c,b:f}),a&&a.push(f),c=f)};for(let f=0;f<o.length;f++){const m=o[f],p=m.command||(f===0?ie.move:ie.line);if(p===ie.move){u(!1);const g=zn(m.x,m.y);a=[g],l=g,c=g,d=m;continue}if(d||(d=o[Math.max(f-1,0)]),p===ie.line)h(zn(m.x,m.y));else if(p===ie.curve){const g=Ns(m,d,s);for(let y=1;y<g.length;y++){const b=g[y];h(zn(b.x,b.y))}h(zn(m.x,m.y))}else if(p===ie.arc){const g=Vg(d,m,s);for(let y=0;y<g.length;y++)h(g[y])}else if(p===ie.close){u(!0),d=m;continue}else h(zn(m.x,m.y));d=m}if(a){const f=!!t._closed||!!t.closed||l&&c&&!lo(l,c);u(f)}return{polygons:n,segments:r}}function Ag(t,e,n){let r=!1;for(let o=0;o<t.length;o++){const s=t[o];if(!s||s.length<3)continue;let a=s.length-1;for(let l=0;l<s.length;l++){const c=s[a],d=s[l];d.y>n!=c.y>n&&e<(c.x-d.x)*(n-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),a=l}}return r}function Ig(t,e,n,r){const o=r.x-n.x,s=r.y-n.y;if(Math.abs(o)<Rs&&Math.abs(s)<Rs){const f=t-n.x,m=e-n.y;return f*f+m*m}const a=((t-n.x)*o+(e-n.y)*s)/(o*o+s*s),l=Math.max(0,Math.min(1,a)),c=n.x+l*o,d=n.y+l*s,u=t-c,h=e-d;return u*u+h*h}function Og(t,e,n){if(!t||t.length===0)return 1/0;let r=1/0;for(let o=0;o<t.length;o++){const s=t[o],a=Ig(e,n,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function zg(t,e){if(typeof e=="boolean")return e;const n=t.fill;return!n&&n!==0?!1:typeof n=="string"?!hc.test(n):!0}function Dg(t,e){const n=typeof t.linewidth=="number"?t.linewidth:t._linewidth||0;if(typeof e=="boolean")return e&&n>0;if(!(n>0))return!1;const r=t.stroke;return!r&&r!==0?!1:typeof r=="string"?!hc.test(r):!0}function Lg(t,e,n,r=0){if(!t)return!1;const o=t.left-r,s=t.right+r,a=t.top-r,l=t.bottom+r;return e>=o&&e<=s&&n>=a&&n<=l}var co=Number.EPSILON;function uo(t){return typeof t.relative!="boolean"||!!t.relative}function dn(t,e,n,r){const o=t.controls;if(!(!o||!o[e])){if(Math.abs(n)<co&&Math.abs(r)<co){uo(t)?o[e].clear():o[e].set(t.x,t.y);return}uo(t)?o[e].set(n,r):o[e].set(t.x+n,t.y+r)}}function Lt(t,e){dn(t,e,0,0)}function Hg(t,e){const n=t.controls;return!n||!n[e]?{x:0,y:0}:uo(t)?{x:n[e].x,y:n[e].y}:{x:n[e].x-t.x,y:n[e].y-t.y}}function Zi(t,e){const n=Hg(t,e);return Math.abs(n.x)>co||Math.abs(n.y)>co}function fo(t){t.command===ie.move||t.command===ie.close||(t.command=Zi(t,"left")||Zi(t,"right")?ie.curve:ie.line)}function pc(t,e){typeof e.relative=="boolean"&&(t.relative=e.relative)}function Wg(t,e){return Zi(e,"right")||Zi(t,"left")||Zi(t,"right")||Zi(e,"left")||t.command===ie.curve||e.command===ie.curve}function Qi(t,e,n){return{x:Pt(t.x,e.x,n),y:Pt(t.y,e.y,n)}}function gc(t,e){const n=t.controls&&t.controls[e];return n?uo(t)?{x:t.x+n.x,y:t.y+n.y}:{x:n.x,y:n.y}:{x:t.x,y:t.y}}function jg(t,e,n){const r=t.controls&&t.controls.right,o=e.controls&&e.controls.left,s={x:t.x,y:t.y},a=r?gc(t,"right"):Sr({},s),l={x:e.x,y:e.y},c=o?gc(e,"left"):Sr({},l),d=Qi(s,a,n),u=Qi(a,c,n),h=Qi(c,l,n),f=Qi(d,u,n),m=Qi(u,h,n),p=Qi(f,m,n),g=new Ne(p.x,p.y);return pc(g,t),dn(g,"left",f.x-p.x,f.y-p.y),dn(g,"right",m.x-p.x,m.y-p.y),g.command=ie.curve,{anchor:g,startOut:d,endIn:h}}function qg(t,e,n,r,o,s){const a=t.length,l=n-e+1;let c=l-1,d=o?Math.min(l,4):1,u=d,h=d;if(r||(u=Math.min(1,e),h=Math.min(1,a-n-1)),c+=u+h,c<=1)return;const f=new Array(c+1);for(let w=0,S=e-u;w<=c;w+=1,S+=1){const v=rt(S,a);f[w]=t[v]}let m=f[0].x+2*f[1].x,p=f[0].y+2*f[1].y,g=2;const y=c-1,b=[m],_=[p],k=[g],x=new Array(c+1),C=new Array(c+1);for(let w=1;w<c;w+=1){const S=w<y,v=S||s?1:2,$=S?4:s?2:7,E=S?4:s?3:8,A=S?2:s?0:1,R=v/g;g=k[w]=$-R,m=b[w]=E*f[w].x+A*f[w+1].x-R*m,p=_[w]=E*f[w].y+A*f[w+1].y-R*p}x[y]=b[y]/k[y],C[y]=_[y]/k[y];for(let w=c-2;w>=0;w-=1)x[w]=(b[w]-x[w+1])/k[w],C[w]=(_[w]-C[w+1])/k[w];x[c]=(3*f[c].x-x[y])/2,C[c]=(3*f[c].y-C[y])/2;const N=c-h;for(let w=u,S=e;w<=N;w+=1,S+=1){const v=rt(S,a),$=t[v],E=x[w]-$.x,A=C[w]-$.y;o||w<N?dn($,"right",E,A):Lt($,"right"),o||w>u?dn($,"left",-E,-A):Lt($,"left"),fo($)}}function Xg(t,e,n,r,o,s){const a=e||t,l=t,c=n||t,d=re.distanceBetween(a,l),u=re.distanceBetween(l,c),h=r===void 0?.5:r,f=Math.pow(d,h),m=Math.pow(u,h),p=f*f,g=m*m;if(!o&&e){const y=2*g+3*m*f+p,b=3*m*(m+f);if(b!==0){const _=(g*a.x+y*l.x-p*c.x)/b-l.x,k=(g*a.y+y*l.y-p*c.y)/b-l.y;dn(t,"left",_,k)}else Lt(t,"left")}else Lt(t,"left");if(!s&&n){const y=2*p+3*f*m+g,b=3*f*(f+m);if(b!==0){const _=(p*c.x+y*l.x-g*a.x)/b-l.x,k=(p*c.y+y*l.y-g*a.y)/b-l.y;dn(t,"right",_,k)}else Lt(t,"right")}else Lt(t,"right");fo(t)}function Yg(t,e,n,r,o,s){if(!(e&&n)){e||Lt(t,"left"),n||Lt(t,"right"),fo(t);return}const a=e,l=t,c=n,d=re.distanceBetween(a,l),u=re.distanceBetween(l,c),h=d+u,f=r===void 0?.4:r,m={x:a.x-c.x,y:a.y-c.y};if(!o&&h!==0){const p=f*d/h;dn(t,"left",m.x*p,m.y*p)}else Lt(t,"left");if(!s&&h!==0){const p=f*d/h-f;dn(t,"right",m.x*p,m.y*p)}else Lt(t,"right");fo(t)}function Ug(t,e,n,r,o,s){const a=s.type,l=s.factor,c=t.length;for(let d=e;d<=n;d+=1){const u=rt(d,c),h=t[u];if(h.command===ie.move){Lt(h,"left"),Lt(h,"right");continue}const f=d===e&&!o?null:d-1,m=d===n&&!o?null:d+1,p=f===null?null:t[rt(f,c)],g=m===null?null:t[rt(m,c)],y=f===null,b=m===null;a==="geometric"?Yg(h,p,g,l,y,b):Xg(h,p,g,l,y,b)}}var Ji=Math.min,er=Math.max,Kg=Math.ceil,Gg=Math.floor,Zg=new re,Qg=new wi,Es=class pi extends On{constructor(e,n,r,o){super(),B(this,"_flagVertices",!0),B(this,"_flagLength",!0),B(this,"_flagFill",!0),B(this,"_flagStroke",!0),B(this,"_flagLinewidth",!0),B(this,"_flagOpacity",!0),B(this,"_flagVisible",!0),B(this,"_flagCap",!0),B(this,"_flagJoin",!0),B(this,"_flagMiter",!0),B(this,"_flagStrokeAttenuation",!0),B(this,"_flagMask",!1),B(this,"_flagClip",!1),B(this,"_length",0),B(this,"_fill","#fff"),B(this,"_stroke","#000"),B(this,"_linewidth",1),B(this,"_opacity",1),B(this,"_visible",!0),B(this,"_cap","round"),B(this,"_join","round"),B(this,"_miter",4),B(this,"_closed",!0),B(this,"_curved",!1),B(this,"_automatic",!0),B(this,"_beginning",0),B(this,"_ending",1),B(this,"_mask",null),B(this,"_clip",!1),B(this,"_dashes",null),B(this,"_strokeAttenuation",!0);for(let s in yc)Object.defineProperty(this,s,yc[s]);this._renderer.type="path",this._renderer.flagVertices=bc.bind(this),this._renderer.bindVertices=_c.bind(this),this._renderer.unbindVertices=wc.bind(this),this._renderer.flagFill=xc.bind(this),this._renderer.flagStroke=kc.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!n,this.curved=!!r,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=e,this.automatic=!o,this.dashes=[],this.dashes.offset=0}static fromObject(e){const n=typeof e.fill=="string"?e.fill:_i(e.fill),r=typeof e.stroke=="string"?e.stroke:_i(e.stroke),o=new pi().copy(bs(Sr({},e),{fill:n,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){if(super.copy.call(this,e),e.vertices){this.vertices=[];for(let n=0;n<e.vertices.length;n++){const r=e.vertices[n];r instanceof Ne?this.vertices.push(e.vertices[n].clone()):this.vertices.push(new Ne().copy(r))}}for(let n=0;n<pi.Properties.length;n++){const r=pi.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new pi;for(let r=0;r<this.vertices.length;r++)n.vertices.push(this.vertices[r].clone());for(let r=0;r<pi.Properties.length;r++){const o=pi.Properties[r];n[o]=this[o]}return n.className=this.className,n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="path",e.vertices=this.vertices.map(n=>n.toObject()),oe.each(pi.Properties,n=>{typeof this[n]<"u"&&(this[n].toObject?e[n]=this[n].toObject():e[n]=this[n])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const n=this.vertices[e];typeof n.unbind=="function"&&n.unbind(),n.controls&&(n.controls.left&&typeof n.controls.left.unbind=="function"&&n.controls.left.unbind(),n.controls.right&&typeof n.controls.right.unbind=="function"&&n.controls.right.unbind())}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const e=this.getBoundingClientRect(!0),n=e.width/2,r=e.height/2,o=e.left+e.width/2,s=e.top+e.height/2;for(let a=0;a<this.vertices.length;a++){const l=this.vertices[a];l.x-=o,l.y-=s,l.x+=n,l.y+=r}return this.mask&&(this.mask.translation.x-=o,this.mask.translation.x+=n,this.mask.translation.y-=s,this.mask.translation.y+=r),this}center(){const e=this.getBoundingClientRect(!0),n=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o];s.x-=n,s.y-=r}return this.mask&&(this.mask.translation.x-=n,this.mask.translation.y-=r),this}getBoundingClientRect(e){let n,r,o,s,a,l,c=1/0,d=-1/0,u=1/0,h=-1/0;if(this._update(!0),n=e?this.matrix:this.worldMatrix,r=(this.linewidth||0)/2,o=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:f,scaleY:m}=bi(n.elements[0],n.elements[3],n.elements[1],n.elements[4],n.elements[2],n.elements[5]);typeof f=="number"&&typeof m=="number"&&(r=Math.max(f,m)*(this.linewidth||0)/2)}else r*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(o<=0)return{width:0,height:0};for(s=0;s<o;s++){l=this._renderer.vertices[s],a=this._renderer.vertices[(s+o-1)%o];const[f,m]=n.multiply(a.x,a.y),[p,g]=n.multiply(l.x,l.y);if(a.controls&&l.controls){let y=a.controls.right.x,b=a.controls.right.y;a.relative&&(y+=a.x,b+=a.y);let[_,k]=n.multiply(y,b),x=l.controls.left.x,C=l.controls.left.y;l.relative&&(x+=l.x,C+=l.y);let[N,w]=n.multiply(x,C);const S=Ul(f,m,_,k,N,w,p,g);u=Ji(S.min.y-r,u),c=Ji(S.min.x-r,c),d=er(S.max.x+r,d),h=er(S.max.y+r,h)}else s<=1&&(u=Ji(m-r,u),c=Ji(f-r,c),d=er(f+r,d),h=er(m+r,h)),u=Ji(g-r,u),c=Ji(p-r,c),d=er(p+r,d),h=er(g+r,h)}return{top:u,left:c,right:d,bottom:h,width:d-c,height:h-u}}contains(e,n,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&this.visible===!1||!s&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const a=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const l=this.getBoundingClientRect();if(!l||e<l.left-a||e>l.right+a||n<l.top-a||n>l.bottom+a)return!1;const c=this.worldMatrix,d=c&&c.inverse(Qg);if(!d)return super.contains(e,n,o);const[u,h]=d.multiply(e,n,1),f=typeof o.precision=="number"&&!Number.isNaN(o.precision)?Math.max(1,Math.floor(o.precision)):8,m=zg(this,o.fill),p=Dg(this,o.stroke),{polygons:g,segments:y}=Mg(this,f);if(m&&g.length>0&&Ag(g,u,h))return!0;if(p&&y.length>0){const b=typeof this.linewidth=="number"?this.linewidth:0;if(b>0&&Og(y,u,h)<=b/2+a)return!0}return!m&&!p?super.contains(e,n,o):m&&g.length===0?super.contains(e,n,o):!1}getPointAt(e,n){let r,o,s,a,l,c,d,u,h,f,m,p,g,y,b,_=this.length*Math.min(Math.max(e,0),1);const k=this.vertices.length,x=k-1;let C=null,N=null;for(let Z=0,O=this._lengths.length,P=0;Z<O;Z++){if(P+this._lengths[Z]>=_){this._closed?(r=rt(Z,k),o=rt(Z-1,k),Z===0&&(r=o,o=Z)):(r=Z,o=Math.min(Math.max(Z-1,0),x)),C=this.vertices[r],N=this.vertices[o],_-=P,this._lengths[Z]!==0?e=_/this._lengths[Z]:e=0;break}P+=this._lengths[Z]}if(C===null||N===null)return null;if(C){if(!N)return C}else return N;b=N.controls&&N.controls.right,y=C.controls&&C.controls.left,l=N.x,f=N.y,c=(b||N).x,m=(b||N).y,d=(y||C).x,p=(y||C).y,u=C.x,g=C.y,b&&N.relative&&(c+=N.x,m+=N.y),y&&C.relative&&(d+=C.x,p+=C.y),a=Br(e,l,c,d,u),h=Br(e,f,m,p,g);const w=Pt(l,c,e),S=Pt(f,m,e),v=Pt(c,d,e),$=Pt(m,p,e),E=Pt(d,u,e),A=Pt(p,g,e),R=Pt(w,v,e),F=Pt(S,$,e),H=Pt(v,E,e),Q=Pt($,A,e);return oe.isObject(n)?(n.x=a,n.y=h,n instanceof Ne&&(n.controls.left.x=R,n.controls.left.y=F,n.controls.right.x=H,n.controls.right.y=Q,(typeof n.relative!="boolean"||n.relative)&&(n.controls.left.x-=a,n.controls.left.y-=h,n.controls.right.x-=a,n.controls.right.y-=h)),n.t=e,n):(s=new Ne(a,h,R-a,F-h,H-a,Q-h,this._curved?ie.curve:ie.line),s.t=e,s)}plot(){if(this.curved)return Gl(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?ie.move:ie.line;return this}smooth(e){const n=e||{},r=n.type||"continuous",o=this._collection,s=o.length;if(s<2)return this;const a=this._closed||s>0&&o[s-1]&&o[s-1].command===ie.close,l=(f,m)=>{if(f==null)return m;if(typeof f=="number"){if(a)return rt(f,s);let g=f;return g<0&&(g+=s),Math.min(Math.max(g,0),s-1)}const p=o.indexOf(f);return p!==-1?p:m},c=a&&n.from===void 0&&n.to===void 0;let d=l(n.from,0),u=l(n.to,s-1);if(d>u)if(a)d-=s;else{const f=d;d=u,u=f}const h=u-d+1;for(let f=0;f<h;f+=1){const m=rt(d+f,s),p=o[m],g=!a&&m===0;p.command===ie.move&&!g&&(p.command=ie.line)}if(r==="continuous"||r==="asymmetric")qg(o,d,u,a,c,r==="asymmetric");else if(r==="catmull-rom"||r==="geometric"){const f={type:r,factor:n.factor};Ug(o,d,u,a,c,f)}else throw new Error(`Path.smooth does not support type "${r}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(e){this._update();const n=this.vertices,r=n.length;if(r<2)return this;const o=[];let s=null,a=null;for(let l=0;l<r;l+=1){const c=n[l];if(!s||c.command===ie.move){const u=c.clone();o.push(u),s=c,a=c;continue}if(Wg(c,s)){const h=Ns(c,s,e).length,f=o[o.length-1];let m=f.clone(),p=c.clone(),g=f,y=0;if(h<=1){const b=c.clone();o.push(b)}else{for(let _=1;_<h;_+=1){const k=_/h,x=1-y,C=x<=Number.EPSILON?k:(k-y)/x,N=jg(m,p,C);dn(g,"right",N.startOut.x-g.x,N.startOut.y-g.y);const w=N.anchor;o.push(w),g=w,m=w.clone(),y=k,dn(p,"left",N.endIn.x-p.x,N.endIn.y-p.y)}const b=c.clone();b.controls.left.copy(p.controls.left),o.push(b)}}else{const u=Ns(c,s,e);for(let f=1;f<u.length;f+=1){const m=u[f];pc(m,s),Lt(m,"left"),Lt(m,"right"),m.command=ie.line,o.push(m)}const h=c.clone();o.push(h)}s=c,c.command===ie.close&&(s=a)}return this._automatic=!1,this._curved=!1,this.vertices=o,this}_updateLength(e,n){n||this._update();const o=this.vertices.length-1;let s=this.vertices[o],a=0;return typeof this._lengths>"u"&&(this._lengths=[]),oe.each(this.vertices,function(l,c){if(c<=0||l.command===ie.move){s=l,this._lengths[c]=0;return}this._lengths[c]=lc(l,s,e),a+=this._lengths[c],s=l},this),this._length=a,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const e=this._collection.length,n=this._closed,r=Math.min(this._beginning,this._ending),o=Math.max(this._beginning,this._ending),s=so(this,r*this._length),a=so(this,o*this._length),l=Kg(s),c=Gg(a);let d,u,h,f,m,p;for(this._renderer.vertices.length=0,p=0;p<e;p++)this._renderer.collection.length<=p&&this._renderer.collection.push(new Ne),p>c&&!u?(m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(o,m),m.command=this._renderer.collection[p].command,this._renderer.vertices.push(m),u=m,h=this._collection[p-1],h&&h.controls&&(m.relative?m.controls.right.clear():m.controls.right.copy(m),h.relative?this._renderer.collection[p-1].controls.right.copy(h.controls.right).lerp(re.zero,1-m.t):this._renderer.collection[p-1].controls.right.copy(h.controls.right).lerp(h,1-m.t))):p>=l&&p<=c&&(m=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(m),p===c&&ac(this,o)?(u=m,!n&&u.controls&&(u.relative?u.controls.right.clear():u.controls.right.copy(u))):p===l&&ac(this,r)&&(d=m,d.command=ie.move,!n&&d.controls&&(d.relative?d.controls.left.clear():d.controls.left.copy(d))));l>0&&!d&&(p=l-1,m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(r,m),m.command=ie.move,this._renderer.vertices.unshift(m),f=this._collection[p+1],f&&f.controls&&(m.controls.left.clear(),f.relative?this._renderer.collection[p+1].controls.left.copy(f.controls.left).lerp(re.zero,m.t):(Zg.copy(f),this._renderer.collection[p+1].controls.left.copy(f.controls.left).lerp(f,m.t))))}return On.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,On.prototype.flagReset.call(this),this}};B(Es,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),B(Es,"Utils",{getCurveLength:lc});var Re=Es,yc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof dt||this._fill instanceof Ke||this._fill instanceof Ge||this._fill instanceof Oe)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof dt||this._fill instanceof Ke||this._fill instanceof Ge||this._fill instanceof Oe)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof dt||this._stroke instanceof Ke||this._stroke instanceof Ge||this._stroke instanceof Oe)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof dt||this._stroke instanceof Ke||this._stroke instanceof Ge||this._stroke instanceof Oe)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=!!t,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t===this._automatic)return;this._automatic=!!t;const e=this._automatic?"ignore":"listen";oe.each(this.vertices,function(n){n[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,n),t instanceof ii?this._collection=t:this._collection=new ii(t||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,n),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,oe.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function bc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function _c(t){let e=t.length;for(;e--;)t[e].bind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function wc(t){let e=t.length;for(;e--;)t[e].unbind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function xc(){this._flagFill=!0}function kc(){this._flagStroke=!0}var vc=class Gr extends Re{constructor(e,n,r,o){const s=[new Ne,new Ne,new Ne,new Ne];super(s,!0,!1,!0),B(this,"_flagWidth",!1),B(this,"_flagHeight",!1),B(this,"_width",0),B(this,"_height",0),B(this,"_origin",null),this._renderer.type="rectangle";for(let a in Cc)Object.defineProperty(this,a,Cc[a]);this.width=typeof r=="number"?r:1,this.height=typeof o=="number"?o:1,this.origin=new re,typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n),this._update()}static fromObject(e){const n=new Gr().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Gr.Properties.length;n++){const r=Gr.Properties[n];r in e&&(typeof e[r]=="number"?this[r]=e[r]:this[r]instanceof re&&this[r].copy(e[r]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const e=this._width/2,n=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Ne),this.vertices[0].set(-e,-n).sub(this._origin).command=ie.move,this.vertices[1].set(e,-n).sub(this._origin).command=ie.line,this.vertices[2].set(e,n).sub(this._origin).command=ie.line,this.vertices[3].set(-e,n).sub(this._origin).command=ie.line,this.vertices[4]&&(this.vertices[4].set(-e,-n).sub(this._origin).command=ie.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const n=new Gr(0,0,this.width,this.height);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix);for(let r=0;r<Re.Properties.length;r++){const o=Re.Properties[r];n[o]instanceof re?n[o].copy(this[o]):n[o]=this[o]}return e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="rectangle",e.width=this.width,e.height=this.height,e.origin=this.origin.toObject(),e}};B(vc,"Properties",["width","height","origin"]);var oi=vc,Cc={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(t){this._origin&&this._origin.unbind(ee.Types.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(ee.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Sc=class Zr extends oi{constructor(e,n,r,o,s,a){super(n,r,0,0),B(this,"_flagTexture",!1),B(this,"_flagColumns",!1),B(this,"_flagRows",!1),B(this,"_flagFrameRate",!1),B(this,"_flagIndex",!1),B(this,"_amount",1),B(this,"_duration",0),B(this,"_startTime",0),B(this,"_playing",!1),B(this,"_firstFrame",0),B(this,"_lastFrame",0),B(this,"_loop",!0),B(this,"_texture",null),B(this,"_columns",1),B(this,"_rows",1),B(this,"_frameRate",0),B(this,"_index",0),B(this,"_origin",null),this._renderer.type="sprite";for(let l in Bc)Object.defineProperty(this,l,Bc[l]);this.noStroke(),this.noFill(),e instanceof Oe?this.texture=e:typeof e=="string"&&(this.texture=new Oe(e)),this.origin=new re,this._update(),typeof o=="number"&&(this.columns=o),typeof s=="number"&&(this.rows=s),typeof a=="number"&&(this.frameRate=a),this.index=0}static fromObject(e){const n=new Zr().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Zr.Properties.length;n++){const r=Zr.Properties[n];r in e&&(this[r]=e[r])}return this}play(e,n,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=oe.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof n=="number"&&(this._lastFrame=n),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(e){const n=new Zr(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&n.play(this._firstFrame,this._lastFrame),n.loop=this.loop,n.firstFrame=this.firstFrame,n.lastFrame=this.lastFrame,e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="sprite",e.texture=this.texture.toObject(),e.columns=this.columns,e.rows=this.rows,e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture,n=this._columns,r=this._rows;let o,s,a,l,c,d,u,h,f;if(e&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=e),e.loaded)){u=e.image.width,h=e.image.height,o=u/n,s=h/r,l=this._amount,this.width!==o&&(this.width=o),this.height!==s&&(this.height=s),this._playing&&this._frameRate>0&&(oe.isNaN(this._lastFrame)&&(this._lastFrame=l-1),a=oe.performance.now()-this._startTime,f=this._lastFrame+1,c=1e3*(f-this._firstFrame)/this._frameRate,this._loop?a=a%c:a=Math.min(a,c),d=Pt(this._firstFrame,f,a/c),d=Math.floor(d),d!==this._index&&(this._index=d,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const m=this._index%n,p=Math.floor(this._index/n),g=-o*m+(u-o)/2,y=-s*p+(h-s)/2;g!==e.offset.x&&(e.offset.x=g),y!==e.offset.y&&(e.offset.y=y)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};B(Sc,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var ho=Sc,Bc={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(t){this._columns=t,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(t){this._rows=t,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}},Ps,Tc=class extends ii{constructor(e){e=Array.isArray(e)?e:Array.prototype.slice.call(arguments),super(e),zl(this,Ps,{}),this.attach(e),this.on(ee.Types.insert,this.attach),this.on(ee.Types.remove,this.detach)}get ids(){return zt(this,Ps)}attach(e){for(let n=0;n<e.length;n++){const r=e[n];r&&r.id&&(this.ids[r.id]=r)}return this}detach(e){for(let n=0;n<e.length;n++)delete this.ids[e[n].id];return this}};Ps=new WeakMap;var Nc=class Hi extends Re{constructor(e,n,r,o,s,a,l){const c=l||xt.Resolution*3,d=[];for(let u=0;u<c;u++)d.push(new Ne);super(d,!0,!1,!0),B(this,"_flagStartAngle",!1),B(this,"_flagEndAngle",!1),B(this,"_flagInnerRadius",!1),B(this,"_flagOuterRadius",!1),B(this,"_startAngle",0),B(this,"_endAngle",tt),B(this,"_innerRadius",0),B(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let u in $c)Object.defineProperty(this,u,$c[u]);typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.startAngle=s),typeof a=="number"&&(this.endAngle=a),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Hi().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Hi.Properties.length;n++){const r=Hi.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const e=this._startAngle,n=this._endAngle,r=this._innerRadius,o=this._outerRadius,s=rt(e,tt)===rt(n,tt),a=r>0,l=this.vertices;let c=a?l.length/2:l.length,d,u=0,h,f,m,p,g,y,b,_,k;for(s?c--:a||(c-=2),h=0,f=c-1;h<c;h++){switch(m=h/f,p=l[u],g=m*(n-e)+e,y=(n-e)/c,b=o*Math.cos(g),_=o*Math.sin(g),h){case 0:d=ie.move;break;default:d=ie.curve}p.command=d,p.x=b,p.y=_,p.controls.left.clear(),p.controls.right.clear(),p.command===ie.curve&&(k=o*y/Math.PI,p.controls.left.x=k*Math.cos(g-ct),p.controls.left.y=k*Math.sin(g-ct),p.controls.right.x=k*Math.cos(g+ct),p.controls.right.y=k*Math.sin(g+ct),h===1&&p.controls.left.multiplyScalar(2),h===f&&p.controls.right.multiplyScalar(2)),u++}if(a){for(s?(l[u].command=ie.close,u++):(c--,f=c-1),h=0;h<c;h++)m=h/f,p=l[u],g=(1-m)*(n-e)+e,y=(n-e)/c,b=r*Math.cos(g),_=r*Math.sin(g),d=ie.curve,h<=0&&(d=s?ie.move:ie.line),p.command=d,p.x=b,p.y=_,p.controls.left.clear(),p.controls.right.clear(),p.command===ie.curve&&(k=r*y/Math.PI,p.controls.left.x=k*Math.cos(g+ct),p.controls.left.y=k*Math.sin(g+ct),p.controls.right.x=k*Math.cos(g-ct),p.controls.right.y=k*Math.sin(g-ct),h===1&&p.controls.left.multiplyScalar(2),h===f&&p.controls.right.multiplyScalar(2)),u++;l[u].copy(l[0]),l[u].command=ie.line}else s||(l[u].command=ie.line,l[u].x=0,l[u].y=0,u++,l[u].copy(l[0]),l[u].command=ie.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(e){const n=this.innerRadius,r=this.outerRadius,o=this.startAngle,s=this.endAngle,a=this.vertices.length,l=new Hi(0,0,n,r,o,s,a);l.translation.copy(this.translation),l.rotation=this.rotation,l.scale=this.scale,l.skewX=this.skewX,l.skewY=this.skewY,this.matrix.manual&&l.matrix.copy(this.matrix);for(let c=0;c<Re.Properties.length;c++){const d=Re.Properties[c];l[d]=this[d]}return e&&e.add(l),l}toObject(){const e=super.toObject.call(this);e.renderer.type="arc-segment";for(let n=0;n<Hi.Properties.length;n++){const r=Hi.Properties[n];e[r]=this[r]}return e}};B(Nc,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var Fs=Nc,$c={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(t){this._startAngle=t,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(t){this._endAngle=t,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}}},Vs=Math.cos,Ms=Math.sin,Rc=class Wi extends Re{constructor(e,n,r,o){const s=o?Math.max(o,2):4,a=[];for(let l=0;l<s;l++)a.push(new Ne(0,0,0,0,0,0));super(a,!0,!0,!0),B(this,"_flagRadius",!1),B(this,"_radius",0),this._renderer.type="circle";for(let l in Ec)Object.defineProperty(this,l,Ec[l]);typeof r=="number"&&(this.radius=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Wi().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Wi.Properties.length;n++){const r=Wi.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagRadius){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const n=4/3*Math.tan(Math.PI/(e*2)),r=this._radius,o=r*n;for(let s=0;s<this.vertices.length;s++){const l=s/e*tt,c=r*Vs(l),d=r*Ms(l),u=o*Vs(l-ct),h=o*Ms(l-ct),f=o*Vs(l+ct),m=o*Ms(l+ct),p=this.vertices[s];p.command=s===0?ie.move:ie.curve,p.set(c,d),p.controls.left.set(u,h),p.controls.right.set(f,m)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const n=new Wi(0,0,this.radius,this.vertices.length);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix);for(let r=0;r<Re.Properties.length;r++){const o=Re.Properties[r];n[o]=this[o]}return e&&e.add(n),n}toObject(){const e=super.toObject.call(this);e.renderer.type="circle";for(let n=0;n<Wi.Properties.length;n++){const r=Wi.Properties[n];e[r]=this[r]}return e}};B(Rc,"Properties",["radius"]);var mo=Rc,Ec={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},As=Math.cos,Is=Math.sin,Pc=class ji extends Re{constructor(e,n,r,o,s){typeof o!="number"&&typeof r=="number"&&(o=r);const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ne);super(l,!0,!0,!0),B(this,"_flagWidth",!1),B(this,"_flagHeight",!1),B(this,"_width",0),B(this,"_height",0),this._renderer.type="ellipse";for(let c in Fc)Object.defineProperty(this,c,Fc[c]);typeof r=="number"&&(this.width=r*2),typeof o=="number"&&(this.height=o*2),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new ji().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<ji.Properties.length;n++){const r=ji.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const n=4/3*Math.tan(Math.PI/(this.vertices.length*2)),r=this._width/2,o=this._height/2;for(let s=0;s<this.vertices.length;s++){const l=s/e*tt,c=r*As(l),d=o*Is(l),u=r*n*As(l-ct),h=o*n*Is(l-ct),f=r*n*As(l+ct),m=o*n*Is(l+ct),p=this.vertices[s];p.command=s===0?ie.move:ie.curve,p.set(c,d),p.controls.left.set(u,h),p.controls.right.set(f,m)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const n=this.width/2,r=this.height/2,o=this.vertices.length,s=new ji(0,0,n,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Re.Properties.length;a++){const l=Re.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="ellipse";for(let n=0;n<ji.Properties.length;n++){const r=ji.Properties[n];e[r]=this[r]}return e}};B(Pc,"Properties",["width","height"]);var po=Pc,Fc={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}}},Jg=Math.ceil,ey=Math.floor,Vc=class gi extends On{constructor(e){super(),B(this,"_flagVertices",!0),B(this,"_flagLength",!0),B(this,"_flagFill",!0),B(this,"_flagStroke",!0),B(this,"_flagLinewidth",!0),B(this,"_flagOpacity",!0),B(this,"_flagVisible",!0),B(this,"_flagSize",!0),B(this,"_flagSizeAttenuation",!0),B(this,"_flagStrokeAttenuation",!0),B(this,"_length",0),B(this,"_fill","#fff"),B(this,"_stroke","#000"),B(this,"_linewidth",1),B(this,"_opacity",1),B(this,"_visible",!0),B(this,"_size",1),B(this,"_sizeAttenuation",!1),B(this,"_beginning",0),B(this,"_ending",1),B(this,"_dashes",null),B(this,"_strokeAttenuation",!0),B(this,"noFill",Re.prototype.noFill),B(this,"noStroke",Re.prototype.noStroke),B(this,"corner",Re.prototype.corner),B(this,"center",Re.prototype.center),B(this,"getBoundingClientRect",Re.prototype.getBoundingClientRect),B(this,"_updateLength",Re.prototype._updateLength);for(let n in Mc)Object.defineProperty(this,n,Mc[n]);this._renderer.type="points",this._renderer.flagVertices=bc.bind(this),this._renderer.bindVertices=_c.bind(this),this._renderer.unbindVertices=wc.bind(this),this._renderer.flagFill=xc.bind(this),this._renderer.flagStroke=kc.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.size=1,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.vertices=e,this.dashes=[],this.dashes.offset=0}static fromObject(e){const n=typeof e.fill=="string"?e.fill:_i(e.fill),r=typeof e.stroke=="string"?e.stroke:_i(e.stroke),o=new gi().copy(bs(Sr({},e),{fill:n,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let n=0;n<e.vertices.length;n++){const r=e.vertices[n];r instanceof Ne?this.vertices.push(e.vertices[n].clone()):this.vertices.push(new Ne().copy(r))}for(let n=0;n<gi.Properties.length;n++){const r=gi.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new gi;for(let r=0;r<this.vertices.length;r++)n.vertices.push(this.vertices[r].clone());for(let r=0;r<gi.Properties.length;r++){const o=gi.Properties[r];n[o]=this[o]}return n.className=this.className,n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="points",e.vertices=this.vertices.map(n=>n.toObject()),oe.each(gi.Properties,function(n){typeof this[n]<"u"&&(this[n].toObject?e[n]=this[n].toObject():e[n]=this[n])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const n=this.vertices[e];typeof n.unbind=="function"&&n.unbind()}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(e){this._update();let n=[];for(let r=0;r<this.vertices.length;r++){const o=this.vertices[r],s=this.vertices[r-1];if(!s)continue;const a=o.x,l=o.y,c=s.x,d=s.y,u=xs(a,l,a,l,c,d,c,d,e);n=n.concat(u)}return this.vertices=n,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const e=Math.min(this._beginning,this._ending),n=Math.max(this._beginning,this._ending),r=so(this,e*this._length),o=so(this,n*this._length),s=Jg(r),a=ey(o);let l=0,c;this._renderer.vertices=[],this._renderer.collection=[];for(let d=0;d<this._collection.length;d++)d>=s&&d<=a&&(c=this._collection[d],this._renderer.collection.push(c),this._renderer.vertices[l*2+0]=c.x,this._renderer.vertices[l*2+1]=c.y,l++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};B(Vc,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);var Os=Vc,Mc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(t){this._sizeAttenuation=t,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof dt||this._fill instanceof Ke||this._fill instanceof Ge||this._fill instanceof Oe)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof dt||this._fill instanceof Ke||this._fill instanceof Ge||this._fill instanceof Oe)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof dt||this._stroke instanceof Ke||this._stroke instanceof Ge||this._stroke instanceof Oe)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof dt||this._stroke instanceof Ke||this._stroke instanceof Ge||this._stroke instanceof Oe)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,n),t instanceof ii?this._collection=t:this._collection=new ii(t||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,n),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}},ty=Math.cos,ny=Math.sin,Ac=class qi extends Re{constructor(e,n,r,o){o=Math.max(o||0,3),super(),B(this,"_flagWidth",!1),B(this,"_flagHeight",!1),B(this,"_flagSides",!1),B(this,"_radius",0),B(this,"_width",0),B(this,"_height",0),B(this,"_sides",0),this._renderer.type="polygon";for(let s in Ic)Object.defineProperty(this,s,Ic[s]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.radius=r),typeof o=="number"&&(this.sides=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new qi().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<qi.Properties.length;n++){const r=qi.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const e=this._sides,n=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<n;o++){const s=(o+.5)/e,a=tt*s+Math.PI/2,l=this._width*ty(a)/2,c=this._height*ny(a)/2;o>=r?this.vertices.push(new Ne(l,c)):this.vertices[o].set(l,c),this.vertices[o].command=o===0?ie.move:ie.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const n=new qi(0,0,0,this.sides);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,n.width=this.width,n.height=this.height,this.matrix.manual&&n.matrix.copy(this.matrix);for(let r=0;r<Re.Properties.length;r++){const o=Re.Properties[r];n[o]=this[o]}return e&&e.add(n),n}toObject(){const e=super.toObject.call(this);e.renderer.type="polygon";for(let n=0;n<qi.Properties.length;n++){const r=qi.Properties[n];e[r]=this[r]}return e}};B(Ac,"Properties",["width","height","sides"]);var zs=Ac,Ic={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this.width=t*2,this.height=t*2}},width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},Oc=class Xi extends Re{constructor(e,n,r,o,s){typeof s>"u"&&typeof r=="number"&&typeof o=="number"&&(s=Math.floor(Math.min(r,o)/12));const a=[];for(let l=0;l<10;l++)a.push(new Ne(0,0,0,0,0,0,l===0?ie.move:ie.curve));super(a),B(this,"_flagWidth",!1),B(this,"_flagHeight",!1),B(this,"_flagRadius",!1),B(this,"_width",0),B(this,"_height",0),B(this,"_radius",12),this._renderer.type="rounded-rectangle";for(let l in zc)Object.defineProperty(this,l,zc[l]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=iy.bind(this),typeof r=="number"&&(this.width=r),typeof o=="number"&&(this.height=o),(typeof s=="number"||s instanceof re)&&(this.radius=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Xi().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Xi.Properties.length;n++){const r=Xi.Properties[n];if(r in e){const o=e[r];/radius/i.test(r)?this[r]=typeof o=="number"||o instanceof re?o:new re().copy(o):typeof o=="number"&&(this[r]=o)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const e=this._width,n=this._height;let r,o;this._radius instanceof re?(r=this._radius.x,o=this._radius.y):(r=this._radius,o=this._radius);let s,a=e/2,l=n/2;s=this.vertices[0],s.x=-(a-r),s.y=-l,s=this.vertices[1],s.x=a-r,s.y=-l,s.controls.left.clear(),s.controls.right.x=r,s.controls.right.y=0,s=this.vertices[2],s.x=a,s.y=-(l-o),s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[3],s.x=a,s.y=l-o,s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=o,s=this.vertices[4],s.x=a-r,s.y=l,s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[5],s.x=-(a-r),s.y=l,s.controls.left.clear(),s.controls.right.x=-r,s.controls.right.y=0,s=this.vertices[6],s.x=-a,s.y=l-o,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[7],s.x=-a,s.y=-(l-o),s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=-o,s=this.vertices[8],s.x=-(a-r),s.y=-l,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[9],s.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const n=this.width,r=this.height,o=this.radius,s=new Xi(0,0,n,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Re.Properties.length;a++){const l=Re.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="rounded-rectangle";for(let n=0;n<Xi.Properties.length;n++){const r=Xi.Properties[n];e[r]=this[r]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}};B(Oc,"Properties",["width","height","radius"]);var go=Oc,zc={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof re&&this._radius.unbind(ee.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof re&&this._radius.bind(ee.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function iy(){this._flagRadius=!0}var ry=Math.cos,oy=Math.sin,Dc=class Yi extends Re{constructor(e,n,r,o,s){arguments.length<=3&&(o=r,r=o/2),(typeof s!="number"||s<=0)&&(s=5),super(),B(this,"_flagInnerRadius",!1),B(this,"_flagOuterRadius",!1),B(this,"_flagSides",!1),B(this,"_innerRadius",0),B(this,"_outerRadius",0),B(this,"_sides",0),this._renderer.type="star";for(let a in Lc)Object.defineProperty(this,a,Lc[a]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Yi().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Yi.Properties.length;n++){const r=Yi.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const e=this._sides*2,n=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<n;o++){const s=(o+.5)/e,a=tt*s,l=(o%2?this._outerRadius:this._innerRadius)/2,c=l*ry(a),d=l*oy(a);o>=r?this.vertices.push(new Ne(c,d)):this.vertices[o].set(c,d),this.vertices[o].command=o===0?ie.move:ie.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const n=this.innerRadius,r=this.outerRadius,o=this.sides,s=new Yi(0,0,n,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Re.Properties.length;a++){const l=Re.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="star";for(let n=0;n<Yi.Properties.length;n++){const r=Yi.Properties[n];e[r]=this[r]}return e}};B(Dc,"Properties",["innerRadius","outerRadius","sides"]);var Ds=Dc,Lc={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},Ls,Hc=Math.min,Wc=Math.max;Ue.document&&(Ls=document.createElement("canvas"));var Hs=class en extends On{constructor(e,n,r,o){super(),B(this,"_flagValue",!0),B(this,"_flagFamily",!0),B(this,"_flagSize",!0),B(this,"_flagLeading",!0),B(this,"_flagAlignment",!0),B(this,"_flagBaseline",!0),B(this,"_flagStyle",!0),B(this,"_flagWeight",!0),B(this,"_flagDecoration",!0),B(this,"_flagFill",!0),B(this,"_flagStroke",!0),B(this,"_flagLinewidth",!0),B(this,"_flagOpacity",!0),B(this,"_flagVisible",!0),B(this,"_flagMask",!1),B(this,"_flagClip",!1),B(this,"_flagDirection",!0),B(this,"_flagStrokeAttenuation",!0),B(this,"_value",""),B(this,"_family","sans-serif"),B(this,"_size",13),B(this,"_leading",17),B(this,"_alignment","center"),B(this,"_baseline","middle"),B(this,"_style","normal"),B(this,"_weight",500),B(this,"_decoration","none"),B(this,"_direction","ltr"),B(this,"_fill","#000"),B(this,"_stroke","none"),B(this,"_linewidth",1),B(this,"_opacity",1),B(this,"_visible",!0),B(this,"_mask",null),B(this,"_clip",!1),B(this,"_dashes",null),B(this,"_strokeAttenuation",!0);for(let s in jc)Object.defineProperty(this,s,jc[s]);if(this._renderer.type="text",this._renderer.flagFill=sy.bind(this),this._renderer.flagStroke=ay.bind(this),this.value=e,typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r),this.dashes=[],this.dashes.offset=0,!oe.isObject(o))return this;for(let s=0;s<en.Properties.length;s++){const a=en.Properties[s];a in o&&(this[a]=o[a])}}static Measure(e){if(Ls){const n=Ls.getContext("2d");n.font=[e._style,e._weight,`${e._size}px/${e._leading}px`,e._family].join(" ");const r=n.measureText(e.value,0,0),o=r.actualBoundingBoxDescent+r.actualBoundingBoxAscent;return{width:r.width,height:o}}else{const n=this.value.length*this.size*en.Ratio,r=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:n,height:r}}}static fromObject(e){const n=typeof e.fill=="string"?e.fill:_i(e.fill),r=typeof e.stroke=="string"?e.stroke:_i(e.stroke),o=new en().copy(bs(Sr({},e),{fill:n,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let n=0;n<en.Properties.length;n++){const r=en.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new en(this.value);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale;for(let r=0;r<en.Properties.length;r++){const o=en.Properties[r];n[o]=this[o]}return this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);e.renderer.type="text";for(let n=0;n<en.Properties.length;n++){const r=en.Properties[n];e[r]=this[r]}return e}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(e){let n,r,o,s,a;this._update(!0),n=e?this.matrix:this.worldMatrix;const{width:l,height:c}=en.Measure(this),d=(this._linewidth||0)/2;switch(this.alignment){case"left":r=-d,o=l+d;break;case"right":r=-(l+d),o=d;break;default:r=-(l/2+d),o=l/2+d}switch(this.baseline){case"middle":s=-(c/2+d),a=c/2+d;break;default:s=-(c+d),a=d}const[u,h]=n.multiply(r,s),[f,m]=n.multiply(r,a),[p,g]=n.multiply(o,s),[y,b]=n.multiply(o,a);return s=Hc(h,m,g,b),r=Hc(u,f,p,y),o=Wc(u,f,p,y),a=Wc(h,m,g,b),{top:s,left:r,right:o,bottom:a,width:o-r,height:a-s}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};B(Hs,"Ratio",.6),B(Hs,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);var xn=Hs,jc={value:{enumerable:!0,get:function(){return this._value},set:function(t){this._value=t,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(t){this._family=t,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(t){this._leading=t,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(t){this._alignment=t,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(t){this._style=t,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(t){this._weight=t,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(t){this._decoration=t,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(t){this._direction=t,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(t){this._baseline=t,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof dt||this._fill instanceof Ke||this._fill instanceof Ge||this._fill instanceof Oe)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof dt||this._fill instanceof Ke||this._fill instanceof Ge||this._fill instanceof Oe)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof dt||this._stroke instanceof Ke||this._stroke instanceof Ge||this._stroke instanceof Oe)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof dt||this._stroke instanceof Ke||this._stroke instanceof Ge||this._stroke instanceof Oe)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,oe.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function sy(){this._flagFill=!0}function ay(){this._flagStroke=!0}var Ws=class yr extends oi{constructor(e,n,r,o){super(n,r,0,0),B(this,"_flagTextures",!1),B(this,"_flagFrameRate",!1),B(this,"_flagIndex",!1),B(this,"_amount",1),B(this,"_duration",0),B(this,"_index",0),B(this,"_startTime",0),B(this,"_playing",!1),B(this,"_firstFrame",0),B(this,"_lastFrame",0),B(this,"_loop",!0),B(this,"_textures",null),B(this,"_frameRate",0),B(this,"_origin",null),this._renderer.type="image-sequence";for(let s in qc)Object.defineProperty(this,s,qc[s]);this._renderer.flagTextures=ly.bind(this),this._renderer.bindTextures=cy.bind(this),this._renderer.unbindTextures=dy.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(Xc.bind(this)):typeof e=="string"&&(this.textures=[Xc(e)]),this.origin=new re,this._update(),typeof o=="number"?this.frameRate=o:this.frameRate=yr.DefaultFrameRate,this.index=0}static fromObject(e){const n=new yr().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<yr.Properties.length;n++){const r=yr.Properties[n];r in e&&(this[r]=e[r])}return this}play(e,n,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=oe.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof n=="number"&&(this._lastFrame=n),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(e){const n=new yr(this.textures,this.translation.x,this.translation.y,this.frameRate);return n._loop=this._loop,this._playing&&n.play(),e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="image-sequence",e.textures=this.textures.map(function(n){return n.toObject()}),e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let e=0;e<this.textures.length;e++){const n=this.textures[e];typeof n.dispose=="function"?n.dispose():typeof n.unbind=="function"&&n.unbind()}return this}_update(){const e=this._textures;let n,r,o,s,a,l,c,d;return e&&(this._flagTextures&&(this._amount=e.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(s=this._amount,oe.isNaN(this._lastFrame)&&(this._lastFrame=s-1),o=oe.performance.now()-this._startTime,d=this._lastFrame+1,a=1e3*(d-this._firstFrame)/this._frameRate,this._loop?o=o%a:o=Math.min(o,a),c=Pt(this._firstFrame,d,o/a),c=Math.floor(c),c!==this._index&&(this._index=c,l=e[this._index],l.loaded&&(n=l.image.width,r=l.image.height,this.width!==n&&(this.width=n),this.height!==r&&(this.height=r),this.fill=l,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof Oe))&&(l=e[this._index],l.loaded&&(n=l.image.width,r=l.image.height,this.width!==n&&(this.width=n),this.height!==r&&(this.height=r)),this.fill=l)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};B(Ws,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),B(Ws,"DefaultFrameRate",30);var js=Ws,qc={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(t){const e=this._renderer.bindTextures,n=this._renderer.unbindTextures;this._textures&&this._textures.unbind(ee.Types.insert,e).unbind(ee.Types.remove,n),this._textures=new ii((t||[]).slice(0)),this._textures.bind(ee.Types.insert,e).bind(ee.Types.remove,n),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}};function ly(){this._flagTextures=!0}function cy(t){let e=t.length;for(;e--;)t[e].bind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function dy(t){let e=t.length;for(;e--;)t[e].unbind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Xc(t){if(t instanceof Oe)return t;if(typeof t=="string")return new Oe(t)}var yo=Math.min,bo=Math.max,uy={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},qs=class an extends On{constructor(e){super(),B(this,"_flagAdditions",!1),B(this,"_flagSubtractions",!1),B(this,"_flagOrder",!1),B(this,"_flagOpacity",!0),B(this,"_flagBeginning",!1),B(this,"_flagEnding",!1),B(this,"_flagLength",!1),B(this,"_flagMask",!1),B(this,"_fill","#fff"),B(this,"_stroke","#000"),B(this,"_linewidth",1),B(this,"_opacity",1),B(this,"_visible",!0),B(this,"_cap","round"),B(this,"_join","round"),B(this,"_miter",4),B(this,"_closed",!0),B(this,"_curved",!1),B(this,"_automatic",!0),B(this,"_beginning",0),B(this,"_ending",1),B(this,"_length",0),B(this,"_mask",null),B(this,"_strokeAttenuation",!0);for(let n in Yc)Object.defineProperty(this,n,Yc[n]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static InsertChildren(e){for(let n=0;n<e.length;n++)Uc.call(this,e[n],this)}static RemoveChildren(e){for(let n=0;n<e.length;n++)Uc.call(this,e[n])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const n=new an;for(let o=0;o<an.Properties.length;o++){const s=an.Properties[o];s in e&&(/(fill|stroke)/i.test(s)?n[s]=typeof e[s]=="string"?e[s]:_i(e[s]):n[s]=e[s])}return"mask"in e&&(n.mask=r(e.mask)),"id"in e&&(n.id=e.id),n.children=e.children.map(r),n;function r(o){if(o&&o.renderer)switch(o.renderer.type){case"arc-segment":return Fs.fromObject(o);case"circle":return mo.fromObject(o);case"element":return Gi.fromObject(o);case"ellipse":return po.fromObject(o);case"group":return an.fromObject(o);case"image":return Image.fromObject(o);case"image-sequence":return js.fromObject(o);case"path":return Re.fromObject(o);case"points":return Os.fromObject(o);case"polygon":return zs.fromObject(o);case"rectangle":return oi.fromObject(o);case"rounded-rectangle":return go.fromObject(o);case"shape":return On.fromObject(o);case"sprite":return ho.fromObject(o);case"star":return Ds.fromObject(o);case"text":return xn.fromObject(o)}return o}}static IsVisible(e,n){if(!n)return!0;let r=e;for(;r;){if(typeof r.visible=="boolean"&&!r.visible||typeof r.opacity=="number"&&r.opacity<=0)return!1;r=r.parent}return!0}static VisitForHitTest(e,n,r,o,s,a,l){const c=e&&e.children;if(!c)return!1;const d=n.results;for(let u=c.length-1;u>=0;u--){const h=c[u];if(!h||!an.IsVisible(h,n.visibleOnly))continue;const f=typeof h.getBoundingClientRect=="function"?h.getBoundingClientRect():null;if(!(f&&!Lg(f,n.x,n.y,a))){if(h instanceof an){if(r&&(!o||o(h))&&typeof h.contains=="function"&&h.contains(n.x,n.y,s)&&(d.push(h),l)||an.VisitForHitTest(h,n,r,o,s,a,l))return!0;continue}if(h instanceof On&&!(o&&!o(h))&&typeof h.contains=="function"&&h.contains(n.x,n.y,s)&&(d.push(h),l))return!0}}return!1}copy(e){super.copy.call(this,e),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let n=0;n<an.Properties.length;n++){const r=an.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new an,r=this.children.map(function(o){return o.clone()});return n.add(r),n.opacity=this.opacity,this.mask&&(n.mask=this.mask),n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.className=this.className,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="group",e.children=[],e.opacity=this.opacity,e.className=this.className,e.mask=this.mask?this.mask.toObject():null,oe.each(this.children,(n,r)=>{e.children[r]=n.toObject()},this),e}dispose(){if(super.dispose(),this.children)for(let e=0;e<this.children.length;e++){const n=this.children[e];typeof n.dispose=="function"&&n.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}getShapesAtPoint(e,n,r){const o=r||{},{results:s,hitOptions:a,context:l,single:c,empty:d}=uy.getShapesAtPoint;s.length=0;const u=o.mode==="deepest"||o.deepest?"deepest":"all",h=o.visibleOnly!==!1,f=!!o.includeGroups,m=typeof o.filter=="function"?o.filter:null,p=typeof o.tolerance=="number"?o.tolerance:0;typeof o.precision=="number"?a.precision=o.precision:delete a.precision,typeof o.fill<"u"?a.fill=o.fill:delete a.fill,typeof o.stroke<"u"?a.stroke=o.stroke:delete a.stroke,a.tolerance=p,a.ignoreVisibility=!h;const g=u==="deepest";if(l.x=e,l.y=n,l.visibleOnly=h,l.results=s,an.VisitForHitTest(this,l,f,m,a,p,g),g){if(s.length>0){const b=s[0];return s.length=0,c[0]=b,c.length=1,c}return d.length=0,d}const y=s.slice();return s.length=0,y}corner(){const e=this.getBoundingClientRect(!0);for(let n=0;n<this.children.length;n++){const r=this.children[n];r.translation.x-=e.left,r.translation.y-=e.top}return this.mask&&(this.mask.translation.x-=e.left,this.mask.translation.y-=e.top),this}center(){const e=this.getBoundingClientRect(!0),n=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.children.length;o++){const s=this.children[o];s.isShape&&(s.translation.x-=n,s.translation.y-=r)}return this.mask&&(this.mask.translation.x-=n,this.mask.translation.y-=r),this}getById(e){let n=null;function r(o){if(o.id===e)return o;if(o.children){if(o.children.ids[e])return o.children.ids[e];for(let s=0;s<o.children.length;s++)if(n=r(o.children[s]),n)return n}return null}return r(this)}getByClassName(e){const n=[];function r(o){if(Array.prototype.indexOf.call(o.classList,e)>=0&&n.push(o),o.children)for(let s=0;s<o.children.length;s++){const a=o.children[s];r(a)}return n}return r(this)}getByType(e){const n=[];function r(o){if(o instanceof e&&n.push(o),o.children)for(let s=0;s<o.children.length;s++){const a=o.children[s];r(a)}return n}return r(this)}add(e){e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let n=0;n<e.length;n++){const r=e[n];if(!(r&&r.id))continue;const o=Array.prototype.indexOf.call(this.children,r);o>=0&&this.children.splice(o,1),this.children.push(r)}return this}remove(e){const n=arguments.length,r=this.parent;if(n<=0&&r)return r.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let o=0;o<e.length;o++){const s=e[o];if(!s||!this.children.ids[s.id])continue;const a=this.children.indexOf(s);a>=0&&this.children.splice(a,1)}return this}getBoundingClientRect(e){let n,r,o,s,a,l;this._update(!0);let c=1/0,d=-1/0,u=1/0,h=-1/0;const f=/texture|gradient/i;r=e?this.matrix:this.worldMatrix;for(let m=0;m<this.children.length;m++){const p=this.children[m];if(!(!p.visible||f.test(p._renderer.type))&&(n=p.getBoundingClientRect(e),o=typeof n.top!="number"||oe.isNaN(n.top)||!isFinite(n.top),s=typeof n.left!="number"||oe.isNaN(n.left)||!isFinite(n.left),a=typeof n.right!="number"||oe.isNaN(n.right)||!isFinite(n.right),l=typeof n.bottom!="number"||oe.isNaN(n.bottom)||!isFinite(n.bottom),!(o||s||a||l)))if(e){const[g,y]=r.multiply(n.left,n.top),[b,_]=r.multiply(n.right,n.top),[k,x]=r.multiply(n.left,n.bottom),[C,N]=r.multiply(n.right,n.bottom);u=yo(y,_,x,N,u),c=yo(g,b,k,C,c),d=bo(g,b,k,C,d),h=bo(y,_,x,N,h)}else u=yo(n.top,u),c=yo(n.left,c),d=bo(n.right,d),h=bo(n.bottom,h)}return{top:u,left:c,right:d,bottom:h,width:d-c,height:h-u}}noFill(){return this.children.forEach(function(e){e.noFill()}),this}noStroke(){return this.children.forEach(function(e){e.noStroke()}),this}subdivide(){const e=arguments;return this.children.forEach(function(n){n.subdivide.apply(n,e)}),this}_update(){let e,n,r;if(this._flagBeginning||this._flagEnding){const o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),a=this.length;let l=0;const c=o*a,d=s*a;for(e=0;e<this.children.length;e++)r=this.children[e],n=r.length,c>l+n?(r.beginning=1,r.ending=1):d<l?(r.beginning=0,r.ending=0):c>l&&c<l+n?(r.beginning=(c-l)/n,r.ending=1):d>l&&d<l+n?(r.beginning=0,r.ending=(d-l)/n):(r.beginning=0,r.ending=1),l+=n}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};B(qs,"Children",Tc),B(qs,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var mt=qs,Yc={visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._flagVisible=this._visible!==t||this._flagVisible,this._visible=t}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!==t||this._flagOpacity,this._opacity=t}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._flagBeginning=this._beginning!==t||this._flagBeginning,this._beginning=t}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._flagEnding=this._ending!==t||this._flagEnding,this._ending=t}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let t=0;t<this.children.length;t++){const e=this.children[t];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){this._fill=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.fill=t}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){this._stroke=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.stroke=t}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.linewidth=t}}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.join=t}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.miter=t}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.cap=t}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.closed=t}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.curved=t}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){this._automatic=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.automatic=t}}},children:{enumerable:!0,get:function(){return this._children},set:function(t){const e=mt.InsertChildren.bind(this),n=mt.RemoveChildren.bind(this),r=mt.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new Tc(t),this._children.bind(ee.Types.insert,e),this._children.bind(ee.Types.remove,n),this._children.bind(ee.Types.order,r),t.length>0&&e(t)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,oe.isObject(t)&&!t.clip&&(t.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.strokeAttenuation!==void 0&&(n.strokeAttenuation=t)}}}};function Uc(t,e){const n=t.parent;let r;if(n===e){o();return}if(n&&n.children.ids[t.id]&&(r=Array.prototype.indexOf.call(n.children,t),n.children.splice(r,1),s()),e){o();return}s(),n._flagAdditions&&n.additions.length===0&&(n._flagAdditions=!1),n._flagSubtractions&&n.subtractions.length===0&&(n._flagSubtractions=!1),delete t.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,t),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,t),r>=0&&e.additions.splice(r,1)),t.parent=e,e.additions.push(t),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(n.additions,t),r>=0&&n.additions.splice(r,1),r=Array.prototype.indexOf.call(n.subtractions,t),r<0&&(n.subtractions.push(t),n._flagSubtractions=!0)}}var _o=class extends Re{constructor(e,n,r,o){const s=[new Ne(e,n),new Ne(r,o)];super(s);for(let a in Kc)Object.defineProperty(this,a,Kc[a]);this.vertices[0].command=ie.move,this.vertices[1].command=ie.line,this.automatic=!1}};B(_o,"Properties",["left","right"]);var Kc={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(oe.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=ie.move;else{const e=new Dt("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(t){if(oe.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=ie.line;else{const e=new Dt("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}},kn={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},fy={start:"left",middle:"center",end:"right"},Gc=["id","class","transform","xmlns","viewBox"],hy=["x","y","width","height","href","xlink:href"];function my(t){return fy[t]}function py(t){const e=t.getAttribute("dominant-baseline"),n=t.getAttribute("alignment-baseline");return e||n}function Tr(t){return t.replace(/svg:/gi,"").toLowerCase()}function Zc(t,e){if(e.x+=t.translateX,e.y+=t.translateY,e.x*=t.scaleX,e.y*=t.scaleY,t.rotation!==0){const n=e.length();e.x=n*Math.cos(t.rotation),e.y=n*Math.sin(t.rotation)}}function gy(t,e){e||(e={});const n=t.split(";");for(let r=0;r<n.length;r++){const o=n[r].split(":"),s=o[0],a=o[1];if(typeof s>"u"||typeof a>"u")continue;const l=s.replace(/\s/g,""),c=a.replace(/\s/g,"");e[l]=c}return e}function yy(t){const e={},n=by(t),r=Math.max(n.length,t.style.length);for(let o=0;o<r;o++){const s=t.style[o],a=n[o];s&&(e[s]=t.style[s]),a&&(e[a]=t.getAttribute(a))}return e}function by(t){const e=t.getAttributeNames();for(let n=0;n<Gc.length;n++){const r=Gc[n],o=Array.prototype.indexOf.call(e,r);o>=0&&e.splice(o,1)}return e}function _y(t,e){const n=e.split(/[\s,]/),r=-parseFloat(n[0]),o=-parseFloat(n[1]),s=parseFloat(n[2]),a=parseFloat(n[3]);if(r&&o)for(let h=0;h<t.children.length;h++){const f=t.children[h];"translation"in f?f.translation.add(r,o):"x"in f?f.x=r:"y"in f&&(f.y=o)}const l=typeof t.x=="number",c=typeof t.y=="number",d=typeof t.width=="number",u=typeof t.height=="number";return l&&(t.translation.x+=t.x),c&&(t.translation.y+=t.y),(d||u)&&(t.scale=new re(1,1)),d&&(t.scale.x=t.width/s),u&&(t.scale.y=t.height/a),t.mask=new oi(0,0,s,a),t.mask.origin.set(-s/2,-a/2),t}function tn(t,e,n){const r={},o={},s={};let a,l,c,d,u,h,f,m,p,g,y,b,_,k,x,C,N;if(t===null)return r;if(Ue.getComputedStyle){const w=Ue.getComputedStyle(t);for(a=w.length;a--;)c=w[a],d=w[c],typeof d<"u"&&(r[c]=d)}for(a=0;a<t.attributes.length;a++)h=t.attributes[a],/style/i.test(h.nodeName)?gy(h.value,s):o[h.nodeName]=h.value;typeof r.opacity<"u"&&(r["stroke-opacity"]=r.opacity,r["fill-opacity"]=r.opacity,delete r.opacity),n&&oe.defaults(r,n),oe.extend(r,s,o),r.visible=!(typeof r.display>"u"&&/none/i.test(r.display))||typeof r.visibility>"u"&&/hidden/i.test(r.visibility);for(c in r)switch(d=r[c],c){case"gradientTransform":if(/none/i.test(d)||(l=t.gradientTransform&&t.gradientTransform.baseVal&&t.gradientTransform.baseVal.length>0?t.gradientTransform.baseVal[0].matrix:t.getCTM?t.getCTM():null,l===null))break;switch(f=bi(l),e._renderer.type){case"linear-gradient":Zc(f,e.left),Zc(f,e.right);break;case"radial-gradient":e.center.x+=f.translateX,e.center.y+=f.translateY,e.focal.x+=f.translateX,e.focal.y+=f.translateY,e.radius*=Math.max(f.scaleX,f.scaleY);break}break;case"transform":if(/none/i.test(d)||(l=t.transform&&t.transform.baseVal&&t.transform.baseVal.length>0?t.transform.baseVal[0].matrix:t.getCTM?t.getCTM():null,l===null))break;f=bi(l),e.translation.set(f.translateX,f.translateY),e.rotation=Math.PI*(f.rotation/180),e.scale=new re(f.scaleX,f.scaleY),m=parseFloat((r.x+"").replace("px")),p=parseFloat((r.y+"").replace("px")),m&&(e.translation.x=m),p&&(e.translation.y=p);break;case"visible":if(e instanceof mt){e._visible=d;break}e.visible=d;break;case"stroke-linecap":if(e instanceof mt){e._cap=d;break}e.cap=d;break;case"stroke-linejoin":if(e instanceof mt){e._join=d;break}e.join=d;break;case"stroke-miterlimit":if(e instanceof mt){e._miter=d;break}e.miter=d;break;case"stroke-width":if(e instanceof mt){e._linewidth=parseFloat(d);break}e.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(e instanceof mt){e._opacity=parseFloat(d);break}e.opacity=parseFloat(d);break;case"clip-path":if(kn.cssBackgroundImage.test(d)&&(g=d.replace(kn.cssBackgroundImage,"$1"),Ye.defs.current&&Ye.defs.current.contains(g)&&(b=Ye.defs.current.get(g),b&&b.childNodes.length>0)))switch(b=b.childNodes[0],_=Tr(b.nodeName),e.mask=Ye[_].call(this,b,{}),e._renderer.type){case"text":case"path":e.position.add(e.mask.position),e.mask.position.clear();break}break;case"fill":case"stroke":u=(e instanceof mt?"_":"")+c,kn.cssBackgroundImage.test(d)?(g=d.replace(kn.cssBackgroundImage,"$1"),Ye.defs.current&&Ye.defs.current.contains(g)?(b=Ye.defs.current.get(g),b.object||(_=Tr(b.nodeName),b.object=Ye[_].call(this,b,{})),b=b.object):(y=xy(this),b=y.getById(g)),e[u]=b):e[u]=d;break;case"id":e.id=d;break;case"class":case"className":e.classList=d.split(" "),e._flagClassName=!0;break;case"x":case"y":if(k=e instanceof dt,x=e instanceof Ke,C=e instanceof Ge,k||x||C)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(N=new Dt("only pixel values are supported with the "+c+" attribute."),console.warn(N.name,N.message)),e.translation[c]=parseFloat(d);break;case"font-family":e instanceof xn&&(e.family=d);break;case"font-size":e instanceof xn&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(N=new Dt("only pixel values are supported with the "+c+" attribute."),console.warn(N.name,N.message)),e.size=parseFloat(d));break;case"font-weight":e instanceof xn&&(e.weight=d);break;case"font-style":e instanceof xn&&(e.style=d);break;case"text-decoration":e instanceof xn&&(e.decoration=d);break;case"line-height":e instanceof xn&&(e.leading=d);break}return Object.keys(t.dataset).length&&(e.dataset=t.dataset),r}function wy(t,e){for(let n=0,r=t.childNodes.length;n<r;n++){const o=t.childNodes[n];!o.id||Tr(t.nodeName)==="#text"||e.add(o.id,o)}}function xy(t){for(;t.parent;)t=t.parent;return t.scene}var Ye={svg:function(t){const e=Ye.defs.current=new ro,n=t.getElementsByTagName("defs");for(let p=0;p<n.length;p++)wy(n[p],e);const r=Ye.g.call(this,t),o=t.getAttribute("viewBox"),s=t.getAttribute("x"),a=t.getAttribute("y"),l=t.getAttribute("width"),c=t.getAttribute("height");r.defs=e;const d=o!==null,u=s!==null,h=a!==null,f=l!==null,m=c!==null;return u&&(r.x=parseFloat(s.replace(kn.unitSuffix,""))),h&&(r.y=parseFloat(a.replace(kn.unitSuffix,""))),f&&(r.width=parseFloat(l.replace(kn.unitSuffix,""))),m&&(r.height=parseFloat(c.replace(kn.unitSuffix,""))),d&&_y(r,o),delete Ye.defs.current,r},defs:function(t){return null},use:function(t,e){let n;const r=t.getAttribute("href")||t.getAttribute("xlink:href");if(!r)return n=new Dt("encountered <use /> with no href."),console.warn(n.name,n.message),null;const o=r.slice(1);if(!Ye.defs.current.contains(o))return n=new Dt("unable to find element for reference "+r+"."),console.warn(n.name,n.message),null;const a=Ye.defs.current.get(o).cloneNode(!0);for(let c=0;c<t.attributes.length;c++){const d=t.attributes[c],u=hy.includes(d.nodeName),h=!a.hasAttribute(d.nodeName);(u||h)&&a.setAttribute(d.nodeName,d.value)}const l=Tr(a.nodeName);return Ye[l].call(this,a,e)},g:function(t,e){const n=new mt;tn.call(this,t,n,e),this.add(n);const r=yy.call(this,t);for(let o=0,s=t.childNodes.length;o<s;o++){const a=t.childNodes[o],l=a.nodeName;if(!l)return;const c=Tr(l);if(c in Ye){const d=Ye[c].call(n,a,r);d&&!d.parent&&n.add(d)}}return n},polygon:function(t,e){let n;typeof t=="string"?n=t:n=t.getAttribute("points");const r=[];n.replace(/(-?[\d.eE-]+)[,|\s](-?[\d.eE-]+)/g,function(s,a,l){r.push(new Ne(parseFloat(a),parseFloat(l)))});const o=new Re(r,!0);return o.stroke="none",o.fill="black",tn.call(this,t,o,e),o},polyline:function(t,e){const n=Ye.polygon.call(this,t,e);return n.closed=!1,n},path:function(t,e){let n;typeof t=="string"?(n=t,t=null):n=t.getAttribute("d");let r=[],o=!1,s=!1;if(n){let l=new Ne,c,d,u=n.match(/[a-df-z][^a-df-z]*/gi);const h=u.length-1;oe.each(u.slice(0),function(f,m){const p=f.slice(1).trim().match(kn.path),g=f[0],y=g.toLowerCase();let b,_,k,x,C;const N=[];switch(m===0&&(u=[]),y){case"h":case"v":p.length>1&&(b=1);break;case"m":case"l":case"t":p.length>2&&(b=2);break;case"s":case"q":p.length>4&&(b=4);break;case"c":p.length>6&&(b=6);break;case"a":p.length>7&&(b=7);break}if(b){for(_=0,k=p.length,C=0;_<k;_+=b){if(x=g,C>0)switch(g){case"m":x="l";break;case"M":x="L";break}N.push(x+p.slice(_,_+b).join(" ")),C++}u=Array.prototype.concat.apply(u,N)}else u.push(f)}),oe.each(u,function(f,m){let p,g,y;const b=f[0],_=b.toLowerCase();d=f.slice(1).trim().match(kn.path),s=b===_;let k,x,C,N,w,S,v,$,E,A,R,F,H,Q,Z,O,P;switch(_){case"z":if(m>=h)o=!0;else{g=l.x,y=l.y,p=new Ne(g,y,void 0,void 0,void 0,void 0,ie.close);for(let V=r.length-1;V>=0;V--){const M=r[V];if(/m/i.test(M.command)){l=M;break}}}break;case"m":case"l":c=void 0,g=parseFloat(d[0]),y=parseFloat(d[1]),p=new Ne(g,y,void 0,void 0,void 0,void 0,/m/i.test(_)?ie.move:ie.line),s&&p.addSelf(l),l=p;break;case"h":case"v":A=/h/i.test(_)?"x":"y",R=/x/i.test(A)?"y":"x",p=new Ne(void 0,void 0,void 0,void 0,void 0,void 0,ie.line),p[A]=parseFloat(d[0]),p[R]=l[R],s&&(p[A]+=l[A]),l=p;break;case"c":case"s":k=l.x,x=l.y,c||(c=new re),/c/i.test(_)?(C=parseFloat(d[0]),N=parseFloat(d[1]),w=parseFloat(d[2]),S=parseFloat(d[3]),v=parseFloat(d[4]),$=parseFloat(d[5])):(E=ks(l,c,s),C=E.x,N=E.y,w=parseFloat(d[0]),S=parseFloat(d[1]),v=parseFloat(d[2]),$=parseFloat(d[3])),s&&(C+=k,N+=x,w+=k,S+=x,v+=k,$+=x),l.controls.right.set(C-l.x,N-l.y),p=new Ne(v,$,w-v,S-$,void 0,void 0,ie.curve),l=p,c=p.controls.left;break;case"t":case"q":k=l.x,x=l.y,c||(c=new re),/q/i.test(_)?(C=parseFloat(d[0]),N=parseFloat(d[1]),w=parseFloat(d[0]),S=parseFloat(d[1]),v=parseFloat(d[2]),$=parseFloat(d[3])):(E=ks(l,c,s),C=E.x,N=E.y,w=E.x,S=E.y,v=parseFloat(d[0]),$=parseFloat(d[1])),s&&(C+=k,N+=x,w+=k,S+=x,v+=k,$+=x),l.controls.right.set((C-l.x)*.33,(N-l.y)*.33),p=new Ne(v,$,w-v,S-$,void 0,void 0,ie.curve),l=p,c=p.controls.left;break;case"a":k=l.x,x=l.y,H=parseFloat(d[0]),Q=parseFloat(d[1]),Z=parseFloat(d[2]),O=parseFloat(d[3]),P=parseFloat(d[4]),v=parseFloat(d[5]),$=parseFloat(d[6]),s&&(v+=k,$+=x),F=new Ne(v,$),F.command=ie.arc,F.rx=H,F.ry=Q,F.xAxisRotation=Z,F.largeArcFlag=O,F.sweepFlag=P,p=F,l=F,c=void 0;break}p&&(Array.isArray(p)?r=r.concat(p):r.push(p))})}n=new Re(r,o,void 0,!0),n.stroke="none",n.fill="black";const a=n.getBoundingClientRect(!0);return a.centroid={x:a.left+a.width/2,y:a.top+a.height/2},oe.each(n.vertices,function(l){l.subSelf(a.centroid)}),tn.call(this,t,n,e),n.translation.addSelf(a.centroid),n},circle:function(t,e){const n=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),o=parseFloat(t.getAttribute("r")),s=new mo(0,0,o);return s.stroke="none",s.fill="black",tn.call(this,t,s,e),s.translation.x=n,s.translation.y=r,s},ellipse:function(t,e){const n=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),o=parseFloat(t.getAttribute("rx")),s=parseFloat(t.getAttribute("ry")),a=new po(0,0,o,s);return a.stroke="none",a.fill="black",tn.call(this,t,a,e),a.translation.x=n,a.translation.y=r,a},rect:function(t,e){const n=parseFloat(t.getAttribute("rx")),r=parseFloat(t.getAttribute("ry"));if(!oe.isNaN(n)||!oe.isNaN(r))return Ye["rounded-rect"](t);const o=parseFloat(t.getAttribute("width")),s=parseFloat(t.getAttribute("height")),a=o/2,l=s/2,c=new oi(0,0,o,s);return c.stroke="none",c.fill="black",tn.call(this,t,c,e),c.translation.x+=a,c.translation.y+=l,c},"rounded-rect":function(t,e){const n=parseFloat(t.getAttribute("rx"))||0,r=parseFloat(t.getAttribute("ry"))||0,o=parseFloat(t.getAttribute("width")),s=parseFloat(t.getAttribute("height")),a=o/2,l=s/2,c=new re(n,r),d=new go(0,0,o,s,c);return d.stroke="none",d.fill="black",tn.call(this,t,d,e),d.translation.x+=a,d.translation.y+=l,d},line:function(t,e){const n=parseFloat(t.getAttribute("x1")),r=parseFloat(t.getAttribute("y1")),o=parseFloat(t.getAttribute("x2")),s=parseFloat(t.getAttribute("y2")),a=new _o(n,r,o,s).noFill();return tn.call(this,t,a,e),a},lineargradient:function(t,e){let n=t.getAttribute("gradientUnits"),r=t.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let o=parseFloat(t.getAttribute("x1")||0),s=parseFloat(t.getAttribute("y1")||0),a=parseFloat(t.getAttribute("x2")||0),l=parseFloat(t.getAttribute("y2")||0);const c=(a+o)/2,d=(l+s)/2;/userSpaceOnUse/i.test(n)&&(o-=c,s-=d,a-=c,l-=d);const u=[];for(let f=0;f<t.children.length;f++){const m=t.children[f];let p=m.getAttribute("offset");/%/gi.test(p)&&(p=parseFloat(p.replace(/%/gi,""))/100),p=parseFloat(p);let g=m.getAttribute("stop-color"),y=m.getAttribute("stop-opacity"),b=m.getAttribute("style"),_;g===null&&(_=b?b.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,g=_&&_.length>1?_[1]:void 0),y===null?(_=b?b.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=_&&_.length>1?parseFloat(_[1]):1):y=parseFloat(y),u.push(new ri(p,g,y))}const h=new Ke(o,s,a,l,u);return h.spread=r,h.units=n,tn.call(this,t,h,e),h},radialgradient:function(t,e){let n=t.getAttribute("gradientUnits"),r=t.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let o=parseFloat(t.getAttribute("cx"))||0,s=parseFloat(t.getAttribute("cy"))||0,a=parseFloat(t.getAttribute("r")),l=parseFloat(t.getAttribute("fx")),c=parseFloat(t.getAttribute("fy"));oe.isNaN(l)&&(l=o),oe.isNaN(c)&&(c=s);const d=Math.abs(o+l)/2,u=Math.abs(s+c)/2;/userSpaceOnUse/i.test(n)&&(o-=d,s-=u,l-=d,c-=u);const h=[];for(let m=0;m<t.children.length;m++){const p=t.children[m];let g=p.getAttribute("offset");/%/gi.test(g)&&(g=parseFloat(g.replace(/%/gi,""))/100),g=parseFloat(g);let y=p.getAttribute("stop-color"),b=p.getAttribute("stop-opacity"),_=p.getAttribute("style"),k;y===null&&(k=_?_.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,y=k&&k.length>1?k[1]:void 0),b===null?(k=_?_.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=k&&k.length>1?parseFloat(k[1]):1):b=parseFloat(b),h.push(new ri(g,y,b))}const f=new Ge(o,s,a,h,l,c);return f.spread=r,f.units=n,tn.call(this,t,f,e),f},text:function(t,e){const n=my(t.getAttribute("text-anchor"))||"left",r=py(t)||"baseline";let o="";t.childNodes.length>0&&t.childNodes[0].tagName==="TSPAN"?o=t.childNodes[0].textContent:o=t.textContent;const s=new xn(o);return tn.call(this,t,s,e),s.alignment=n,s.baseline=r,s},clippath:function(t,e){return Ye.defs.current&&!Ye.defs.current.contains(t.id)&&Ye.defs.current.add(t.id,t),null},image:function(t,e){let n;const r=t.getAttribute("href")||t.getAttribute("xlink:href");if(!r)return n=new Dt("encountered <image /> with no href."),console.warn(n.name,n.message),null;const o=parseFloat(t.getAttribute("x"))||0,s=parseFloat(t.getAttribute("y"))||0,a=parseFloat(t.getAttribute("width")),l=parseFloat(t.getAttribute("height")),c=new ho(r,o,s);return oe.isNaN(a)||(c.width=a),oe.isNaN(l)||(c.height=l),tn.call(this,t,c,e),c}};function Qc(t,e){const n=new XMLHttpRequest;return n.open("GET",t),n.onreadystatechange=function(){n.readyState===4&&n.status===200&&e(n.responseText)},n.send(),n}var Xs=class Mn extends oi{constructor(e,n,r,o,s,a){super(n,r,o||1,s||1),B(this,"_flagTexture",!1),B(this,"_flagMode",!1),B(this,"_texture",null),B(this,"_mode","fill"),this._renderer.type="image";for(let l in ed)Object.defineProperty(this,l,ed[l]);this.noStroke(),this.noFill(),e instanceof Oe?this.texture=e:typeof e=="string"&&(this.texture=new Oe(e)),typeof a=="string"&&(this.mode=a),this._update()}static fromObject(e){const n=new Mn().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Mn.Properties.length;n++){const r=Mn.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new Mn(this.texture,this.translation.x,this.translation.y,this.width,this.height);return e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="image",e.texture=this.texture.toObject(),e.mode=this.mode,e}dispose(){return super.dispose(),this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture;if(e&&(this._flagTexture&&(this.fill=e),e.loaded)){const n=e.image.width,r=e.image.height,o=this.width,s=this.height,a=o/n,l=s/r;switch(this._mode){case Mn.Modes.fill:{const c=Math.max(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="repeat";break}case Mn.Modes.fit:{const c=Math.min(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="no-repeat";break}case Mn.Modes.crop:break;case Mn.Modes.tile:{e.offset.x=(n-o)/2,e.offset.y=(r-s)/2,e.repeat="repeat";break}case Mn.Modes.stretch:default:e.scale=new re(a,l),e.offset.x=0,e.offset.y=0,e.repeat="repeat"}}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagTexture=this._flagMode=!1,this}};B(Xs,"Modes",{fill:"fill",fit:"fit",crop:"crop",tile:"tile",stretch:"stretch"}),B(Xs,"Properties",["texture","mode"]);var Jc=Xs,ed={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},mode:{enumerable:!0,get:function(){return this._mode},set:function(t){this._mode=t,this._flagMode=!0}}},Ys=[],Us=Math.max,ky=Math.min,td=Math.abs,wo=Math.sin,xo=Math.cos,vy=Math.acos,ko=Math.sqrt,Pe={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},baselines:{top:"top",middle:"middle",bottom:"bottom",baseline:"alphabetic"},getRendererType:function(t){return t in Pe?t:"path"},group:{renderChild:function(t){const e=Pe.getRendererType(t._renderer.type);Pe[e].render.call(t,this.ctx,!0,this.clip)},render:function(t){if(!this._visible)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this._matrix.elements,n=this.parent;this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);const r=this._mask,o=vo(e),s=!o||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=t,s&&(t.save(),o||t.transform(e[0],e[3],e[1],e[4],e[2],e[5])),r){const a=Pe.getRendererType(r._renderer.type);Pe[a].render.call(r,t,!0)}if(this._opacity>0&&this._scale!==0)for(let a=0;a<this.children.length;a++){const l=this.children[a],c=Pe.getRendererType(l._renderer.type);Pe[c].render.call(l,t)}return s&&t.restore(),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(t,e,n){let r,o,s,a,l,c,d,u,h,f,m,p,g,y,b,_,k,x,C,N,w,S,v,$,E,A,R,F,H,Q,Z,O,P,V;if(V=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,H=this._mask,Q=this._clip,l=this._opacity*(V||1),c=this._visible,!e&&(!c||Q||l===0))return this;if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,a=this._fill,d=this._cap,u=this._join,h=this._miter,f=this._closed,m=this._renderer.vertices,p=m.length,g=p-1,Z=vo(r),P=this.dashes,Z||(t.save(),t.transform(r[0],r[3],r[1],r[4],r[2],r[5])),H){const K=Pe.getRendererType(H._renderer.type);Pe[K].render.call(H,t,!0)}if(a)if(typeof a=="string")t.fillStyle=a;else{const K=Pe.getRendererType(a._renderer.type);Pe[K].render.call(a,t,this),t.fillStyle=a._renderer.effect}if(o){if(typeof o=="string")t.strokeStyle=o;else{const K=Pe.getRendererType(o._renderer.type);Pe[K].render.call(o,t,this),t.strokeStyle=o._renderer.effect}s&&(t.lineWidth=wn(this)),h&&(t.miterLimit=h),u&&(t.lineJoin=u),!f&&d&&(t.lineCap=d)}typeof l=="number"&&(t.globalAlpha=l),P&&P.length>0&&(t.lineDashOffset=P.offset||0,t.setLineDash(P)),t.beginPath();let M,L,Y,U,G,q,W;for(let K=0;K<p;K++)switch(_=m[K],R=_.x,F=_.y,_.command){case ie.close:t.closePath();break;case ie.arc:M=_.rx,L=_.ry,Y=_.xAxisRotation,U=_.largeArcFlag,G=_.sweepFlag,y=f?rt(K-1,p):Us(K-1,0),b=m[y],q=b.x,W=b.y,Pe.renderSvgArcCommand(t,q,W,M,L,U,G,Y,R,F);break;case ie.curve:y=f?rt(K-1,p):Math.max(K-1,0),b=m[y],v=b.controls&&b.controls.right||re.zero,$=_.controls&&_.controls.left||re.zero,b._relative?(w=v.x+b.x,S=v.y+b.y):(w=v.x,S=v.y),_._relative?(C=$.x+_.x,N=$.y+_.y):(C=$.x,N=$.y),t.bezierCurveTo(w,S,C,N,R,F),K>=g&&f&&(k=x,E=_.controls&&_.controls.right||re.zero,A=k.controls&&k.controls.left||re.zero,_._relative?(w=E.x+_.x,S=E.y+_.y):(w=E.x,S=E.y),k._relative?(C=A.x+k.x,N=A.y+k.y):(C=A.x,N=A.y),R=k.x,F=k.y,t.bezierCurveTo(w,S,C,N,R,F));break;case ie.line:t.lineTo(R,F);break;case ie.move:x=_,t.moveTo(R,F);break}return f&&t.closePath(),!Q&&!n&&(Pe.isHidden.test(a)||(O=a._renderer&&a._renderer.offset,O&&(t.save(),t.translate(-a._renderer.offset.x,-a._renderer.offset.y),t.scale(a._renderer.scale.x,a._renderer.scale.y)),t.fill(),O&&t.restore()),Pe.isHidden.test(o)||(O=o._renderer&&o._renderer.offset,O&&(t.save(),t.translate(-o._renderer.offset.x,-o._renderer.offset.y),t.scale(o._renderer.scale.x,o._renderer.scale.y),t.lineWidth=s/o._renderer.scale.x),t.stroke(),O&&t.restore())),Z||t.restore(),Q&&!n&&t.clip(),P&&P.length>0&&t.setLineDash(Ys),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(t,e,n){let r,o,s,a,l,c,d,u,h,f,m,p,g,y,b,_;if(_=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,l=this._opacity*(_||1),c=this._visible,!e&&(!c||l===0))return this;if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,a=this._fill,u=this._renderer.collection,h=u.length,g=vo(r),b=this.dashes,d=this._size,g||(t.save(),t.transform(r[0],r[3],r[1],r[4],r[2],r[5])),a)if(typeof a=="string")t.fillStyle=a;else{const C=Pe.getRendererType(a._renderer.type);Pe[C].render.call(a,t,this),t.fillStyle=a._renderer.effect}if(o){if(typeof o=="string")t.strokeStyle=o;else{const C=Pe.getRendererType(o._renderer.type);Pe[C].render.call(o,t,this),t.strokeStyle=o._renderer.effect}s&&(t.lineWidth=wn(this))}typeof l=="number"&&(t.globalAlpha=l),b&&b.length>0&&(t.lineDashOffset=b.offset||0,t.setLineDash(b)),t.beginPath();let k=d*.5,x;this._sizeAttenuation||(x=this.worldMatrix.elements,x=bi(x[0],x[3],x[1],x[4],x[2],x[5]),k/=Math.max(x.scaleX,x.scaleY));for(let C=0;C<h;C++)f=u[C],m=f.x,p=f.y,t.moveTo(m+k,p),t.arc(m,p,k,0,tt);return n||(Pe.isHidden.test(a)||(y=a._renderer&&a._renderer.offset,y&&(t.save(),t.translate(-a._renderer.offset.x,-a._renderer.offset.y),t.scale(a._renderer.scale.x,a._renderer.scale.y)),t.fill(),y&&t.restore()),Pe.isHidden.test(o)||(y=o._renderer&&o._renderer.offset,y&&(t.save(),t.translate(-o._renderer.offset.x,-o._renderer.offset.y),t.scale(o._renderer.scale.x,o._renderer.scale.y),t.lineWidth=s/o._renderer.scale.x),t.stroke(),y&&t.restore())),g||t.restore(),b&&b.length>0&&t.setLineDash(Ys),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(t,e,n){const r=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,o=this._opacity*r,s=this._visible,a=this._mask,l=this._clip;if(!e&&(!s||l||o===0))return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const c=this._matrix.elements,d=this._stroke,u=this._linewidth,h=this._fill,f=this._decoration,m=this._direction,p=vo(c),g=h._renderer&&h._renderer.offset&&d._renderer&&d._renderer.offset,y=this.dashes,b=Pe.alignments[this._alignment]||this._alignment,_=Pe.baselines[this._baseline]||this._baseline;let k,x,C,N,w,S,v,$,E,A,R;if(p||(t.save(),t.transform(c[0],c[3],c[1],c[4],c[2],c[5])),a){const F=Pe.getRendererType(a._renderer.type);Pe[F].render.call(a,t,!0)}if(g||(t.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),t.textAlign=b,t.textBaseline=_,t.direction=m,h)if(typeof h=="string")t.fillStyle=h;else{const F=Pe.getRendererType(h._renderer.type);Pe[F].render.call(h,t,this),t.fillStyle=h._renderer.effect}if(d){if(typeof d=="string")t.strokeStyle=d;else{const F=Pe.getRendererType(d._renderer.type);Pe[F].render.call(d,t,this),t.strokeStyle=d._renderer.effect}u&&(t.lineWidth=wn(this))}if(typeof o=="number"&&(t.globalAlpha=o),y&&y.length>0&&(t.lineDashOffset=y.offset||0,t.setLineDash(y)),!l&&!n&&(Pe.isHidden.test(h)||(h._renderer&&h._renderer.offset?(S=h._renderer.scale.x,v=h._renderer.scale.y,t.save(),t.translate(-h._renderer.offset.x,-h._renderer.offset.y),t.scale(S,v),k=this._size/h._renderer.scale.y,x=this._leading/h._renderer.scale.y,t.font=[this._style,this._weight,k+"px/",x+"px",this._family].join(" "),C=h._renderer.offset.x/h._renderer.scale.x,N=h._renderer.offset.y/h._renderer.scale.y,t.fillText(this.value,C,N),t.restore()):t.fillText(this.value,0,0)),Pe.isHidden.test(d)||(d._renderer&&d._renderer.offset?(S=d._renderer.scale.x,v=d._renderer.scale.y,t.save(),t.translate(-d._renderer.offset.x,-d._renderer.offset.y),t.scale(S,v),k=this._size/d._renderer.scale.y,x=this._leading/d._renderer.scale.y,t.font=[this._style,this._weight,k+"px/",x+"px",this._family].join(" "),C=d._renderer.offset.x/d._renderer.scale.x,N=d._renderer.offset.y/d._renderer.scale.y,w=u/d._renderer.scale.x,t.lineWidth=w,t.strokeText(this.value,C,N),t.restore()):t.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(f)){const F=t.measureText(this.value);let H=1;switch(f){case"underline":E=F.actualBoundingBoxDescent,R=F.actualBoundingBoxDescent;break;case"strikethrough":E=0,R=0,H=.5;break}switch(_){case"top":E+=this._size*H,R+=this._size*H;break;case"baseline":case"bottom":E-=this._size*H,R-=this._size*H;break}switch(b){case"left":case"start":$=0,A=F.width;break;case"right":case"end":$=-F.width,A=0;break;default:$=-F.width/2,A=F.width/2}t.lineWidth=Math.max(Math.floor(this._size/15),1),t.strokeStyle=t.fillStyle,t.beginPath(),t.moveTo($,E),t.lineTo(A,R),t.stroke()}return p||t.restore(),l&&!n&&t.clip(),y&&y.length>0&&t.setLineDash(Ys),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(e){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let n,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(n=e.getBoundingClientRect(!0),r=(r-.5)*n.width,o=(o-.5)*n.height,s=(s-.5)*n.width,a=(a-.5)*n.height),this._renderer.effect=t.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(t,e){if(e){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let n,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(n=e.getBoundingClientRect(!0),r=(r-.5)*n.width*.5,o=(o-.5)*n.height*.5,s=(s-.5)*n.width*.5,a=(a-.5)*n.height*.5,l*=Math.min(n.width,n.height)),this._renderer.effect=t.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(t){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=t.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof re||(this._renderer.offset=new re),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,e&&(this._renderer.offset.x+=e.width/2,this._renderer.offset.y+=e.height/2,this._scale instanceof re?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(this._renderer.scale instanceof re||(this._renderer.scale=new re),this._scale instanceof re?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},renderSvgArcCommand:function(t,e,n,r,o,s,a,l,c,d){l=l*Math.PI/180,r=td(r),o=td(o);const u=(e-c)/2,h=(n-d)/2,f=xo(l)*u+wo(l)*h,m=-wo(l)*u+xo(l)*h,p=f*f,g=m*m;let y=r*r,b=o*o;const _=p/y+g/b;if(_>1){const F=ko(_);r=F*r,o=F*o,y=r*r,b=o*o}const k=y*g+b*p,x=(y*b-k)/k;let C=ko(Us(0,x));s===a&&(C=-C);const N=C*r*m/o,w=-C*o*f/r,S=xo(l)*N-wo(l)*w+(e+c)/2,v=wo(l)*N+xo(l)*w+(n+d)/2,$=nd(1,0,(f-N)/r,(m-w)/o),E=nd((f-N)/r,(m-w)/o,(-f-N)/r,(-m-w)/o)%tt,A=$+E;Cy(t,S,v,r,o,$,A,a===0,l)}},vt=class extends ee{constructor(t){super();const e=t.smoothing!==!1;this.domElement=t.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=t.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=e),this.scene=new mt,this.scene.parent=this}setSize(t,e,n){return this.width=t,this.height=e,this.ratio=typeof n>"u"?vs(this.ctx):n,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,this.domElement.style&&oe.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this.trigger(ee.Types.resize,t,e,n)}render(){const t=this.ratio===1;return t||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Pe.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}};B(vt,"Utils",Pe);function Cy(t,e,n,r,o,s,a,l,c){const d=a-s,u=Ui.Tolerance.epsilon,h=Math.abs(d)<u;let f=rt(d,tt);f<u&&(h?f=0:f=tt),l===!0&&!h&&(f===tt?f=-tt:f=f-tt);for(let m=0;m<xt.Resolution;m++){const p=m/(xt.Resolution-1),g=s+p*f;let y=e+r*Math.cos(g),b=n+o*Math.sin(g);if(c!==0){const _=Math.cos(c),k=Math.sin(c),x=y-e,C=b-n;y=x*_-C*k+e,b=x*k+C*_+n}t.lineTo(y,b)}}function nd(t,e,n,r){const o=t*n+e*r,s=ko(t*t+e*e)*ko(n*n+r*r);let a=vy(Us(-1,ky(1,o/s)));return t*r-e*n<0&&(a=-a),a}function vo(t){return t[0]===1&&t[3]===0&&t[1]===0&&t[4]===1&&t[2]===0&&t[5]===0}var ce={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},baselines:{top:"hanging",middle:"middle",bottom:"ideographic",baseline:"alphabetic"},createElement:function(t,e){const n=t,r=document.createElementNS(ce.ns,n);return n==="svg"&&(e=oe.defaults(e||{},{version:ce.version})),e&&Object.keys(e).length>0&&ce.setAttributes(r,e),r},setAttributes:function(t,e){const n=Object.keys(e);for(let r=0;r<n.length;r++)/href/.test(n[r])?t.setAttributeNS(ce.xlink,n[r],e[n[r]]):t.setAttribute(n[r],e[n[r]]);return this},removeAttributes:function(t,e){for(let n in e)t.removeAttribute(n);return this},toString:function(t,e){let n=t.length,r=n-1,o,s="";for(let a=0;a<n;a++){const l=t[a],c=e?rt(a-1,n):Math.max(a-1,0),d=t[c];let u,h,f,m,p,g,y,b,_,k,x,C,N,w,S,v=Ie(l.x),$=Ie(l.y);switch(l.command){case ie.close:u=ie.close;break;case ie.arc:x=l.rx,C=l.ry,N=l.xAxisRotation,w=l.largeArcFlag,S=l.sweepFlag,u=ie.arc+" "+x+" "+C+" "+N+" "+w+" "+S+" "+v+" "+$;break;case ie.curve:y=d.controls&&d.controls.right||re.zero,b=l.controls&&l.controls.left||re.zero,d.relative?(f=Ie(y.x+d.x),m=Ie(y.y+d.y)):(f=Ie(y.x),m=Ie(y.y)),l.relative?(p=Ie(b.x+l.x),g=Ie(b.y+l.y)):(p=Ie(b.x),g=Ie(b.y)),u=(a===0?ie.move:ie.curve)+" "+f+" "+m+" "+p+" "+g+" "+v+" "+$;break;case ie.move:o=l,u=ie.move+" "+v+" "+$;break;default:u=l.command+" "+v+" "+$}a>=r&&e&&(l.command===ie.curve&&(h=o,_=l.controls&&l.controls.right||l,k=h.controls&&h.controls.left||h,l.relative?(f=Ie(_.x+l.x),m=Ie(_.y+l.y)):(f=Ie(_.x),m=Ie(_.y)),h.relative?(p=Ie(k.x+h.x),g=Ie(k.y+h.y)):(p=Ie(k.x),g=Ie(k.y)),v=Ie(h.x),$=Ie(h.y),u+=" C "+f+" "+m+" "+p+" "+g+" "+v+" "+$),l.command!==ie.close&&(u+=" Z")),s+=u+" "}return s},pointsToString:function(t,e){let n="";const r=e*.5;for(let o=0;o<t.length;o++){const s=t[o].x,a=t[o].y-r;n+=ie.move+" "+s+" "+a+" ",n+="a "+r+" "+r+" 0 1 0 0.001 0 Z"}return n},getClip:function(t,e){let n=t._renderer.clip;return n||(n=t._renderer.clip=ce.createElement("clipPath",{"clip-rule":"nonzero"})),n.parentNode===null&&e.defs.appendChild(n),n},getRendererType:function(t){return t in ce?t:"path"},defs:{update:function(t){const{defs:e}=t;if(e._flagUpdate){const n=Array.prototype.slice.call(e.children,0);for(let r=0;r<n.length;r++){const o=n[r],s=o.id,a=`[fill="url(#${s})"],[stroke="url(#${s})"],[clip-path="url(#${s})"]`;t.querySelector(a)||e.removeChild(o)}e._flagUpdate=!1}}},group:{appendChild:function(t){const e=t._renderer.elem;if(!e)return;const n=e.nodeName;!n||/(radial|linear)gradient/i.test(n)||t._clip||this.elem.appendChild(e)},removeChild:function(t){const e=t._renderer.elem;!e||e.parentNode!=this.elem||!e.nodeName||t._clip||this.elem.removeChild(e)},orderChild:function(t){this.elem.appendChild(t._renderer.elem)},renderChild:function(t){const e=ce.getRendererType(t._renderer.type);ce[e].render.call(t,this)},render:function(t){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),this._renderer.elem||(this._renderer.elem=ce.createElement("g",{id:this.id}),t.appendChild(this._renderer.elem));const e=this._matrix.manual||this._flagMatrix,n={domElement:t,elem:this._renderer.elem};e&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let r=0;r<this.children.length;r++){const o=this.children[r],s=ce.getRendererType(o._renderer.type);ce[s].render.call(o,t)}if(this._flagId&&this._renderer.elem.setAttribute("id",this._id),this._flagOpacity&&this._renderer.elem.setAttribute("opacity",this._opacity),this._flagVisible&&this._renderer.elem.setAttribute("display",this._visible?"inline":"none"),this._flagClassName&&this._renderer.elem.setAttribute("class",this.classList.join(" ")),this._flagAdditions&&this.additions.forEach(ce.group.appendChild,n),this._flagSubtractions&&this.subtractions.forEach(ce.group.removeChild,n),this._flagOrder&&this.children.forEach(ce.group.orderChild,n),this._flagMask)if(this._mask){const r=ce.getRendererType(this._mask._renderer.type);ce[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.dataset&&Object.assign(this._renderer.elem.dataset,this.dataset),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(t){if(this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices){const r=ce.toString(this._renderer.vertices,this._closed);e.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ce.getRendererType(this._fill._renderer.type);ce[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ce.getRendererType(this._stroke._renderer.type);ce[r].render.call(this._stroke,t,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=wn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this._flagCap&&(e["stroke-linecap"]=this._cap),this._flagJoin&&(e["stroke-linejoin"]=this._join),this._flagMiter&&(e["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ce.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ce.createElement("path",e),t.appendChild(this._renderer.elem)),this._flagClip){const r=ce.getClip(this,t),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=ce.getRendererType(this._mask._renderer.type);ce[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(t){if(this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let r=this._size;if(!this._sizeAttenuation){const s=this.worldMatrix.elements,a=bi(s[0],s[3],s[1],s[4],s[2],s[5]);r/=Math.max(a.scaleX,a.scaleY)}const o=ce.pointsToString(this._renderer.collection,r);e.d=o}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ce.getRendererType(this._fill._renderer.type);ce[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ce.getRendererType(this._stroke._renderer.type);ce[r].render.call(this._stroke,t,!0)}return this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=wn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ce.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ce.createElement("path",e),t.appendChild(this._renderer.elem)),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(t){this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagFamily&&(e["font-family"]=this._family),this._flagSize&&(e["font-size"]=this._size),this._flagLeading&&(e["line-height"]=this._leading),this._flagAlignment&&(e["text-anchor"]=ce.alignments[this._alignment]||this._alignment),this._flagBaseline&&(e["dominant-baseline"]=ce.baselines[this._baseline]||this._baseline),this._flagStyle&&(e["font-style"]=this._style),this._flagWeight&&(e["font-weight"]=this._weight),this._flagDecoration&&(e["text-decoration"]=this._decoration),this._flagDirection&&(e.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ce.getRendererType(this._fill._renderer.type);ce[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ce.getRendererType(this._stroke._renderer.type);ce[r].render.call(this._stroke,t,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=wn(this)),this._flagOpacity&&(e.opacity=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ce.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ce.createElement("text",e),t.appendChild(this._renderer.elem)),this._flagClip){const r=ce.getClip(this,t),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=ce.getRendererType(this._mask._renderer.type);ce[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(t,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const n={};if(this._flagId&&(n.id=this._id),this._flagEndPoints&&(n.x1=this.left._x,n.y1=this.left._y,n.x2=this.right._x,n.y2=this.right._y),this._flagSpread&&(n.spreadMethod=this._spread),this._flagUnits&&(n.gradientUnits=this._units),this._renderer.elem?ce.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=ce.createElement("linearGradient",n)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],a={};s._flagOffset&&(a.offset=100*s._offset+"%"),s._flagColor&&(a["stop-color"]=s._color),s._flagOpacity&&(a["stop-opacity"]=s._opacity),s._renderer.elem?ce.setAttributes(s._renderer.elem,a):s._renderer.elem=ce.createElement("stop",a),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"radial-gradient":{render:function(t,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const n={};if(this._flagId&&(n.id=this._id),this._flagCenter&&(n.cx=this.center._x,n.cy=this.center._y),this._flagFocal&&(n.fx=this.focal._x,n.fy=this.focal._y),this._flagRadius&&(n.r=this._radius),this._flagSpread&&(n.spreadMethod=this._spread),this._flagUnits&&(n.gradientUnits=this._units),this._renderer.elem?ce.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=ce.createElement("radialGradient",n)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],a={};s._flagOffset&&(a.offset=100*s._offset+"%"),s._flagColor&&(a["stop-color"]=s._color),s._flagOpacity&&(a["stop-opacity"]=s._opacity),s._renderer.elem?ce.setAttributes(s._renderer.elem,a):s._renderer.elem=ce.createElement("stop",a),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},texture:{render:function(t,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const n={},r={x:0,y:0},o=this.image;if(this._flagId&&(n.id=this._id),this._flagLoaded&&this.loaded)switch(o.nodeName.toLowerCase()){case"canvas":r.href=r["xlink:href"]=o.toDataURL("image/png");break;case"img":case"image":r.href=r["xlink:href"]=this.src;break}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(n.x=this._offset.x,n.y=this._offset.y,o&&(n.x-=o.width/2,n.y-=o.height/2,this._scale instanceof re?(n.x*=this._scale.x,n.y*=this._scale.y):(n.x*=this._scale,n.y*=this._scale)),n.x>0&&(n.x*=-1),n.y>0&&(n.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(n.width=0,n.height=0,o)){switch(n.width=o.width,n.height=o.height,this._repeat){case"no-repeat":n.width+=1,n.height+=1;break}this._scale instanceof re?(n.width*=this._scale.x,n.height*=this._scale.y):(n.width*=this._scale,n.height*=this._scale),/no-repeat/i.test(this._repeat)?r.preserveAspectRatio="xMidYMid":r.preserveAspectRatio="none",r.width=n.width,r.height=n.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?ce.setAttributes(this._renderer.image,r):this._renderer.image=ce.createElement("image",r)),this._renderer.elem?Object.keys(n).length!==0&&ce.setAttributes(this._renderer.elem,n):(n.id=this._id,n.patternUnits="userSpaceOnUse",this._renderer.elem=ce.createElement("pattern",n)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},id=class extends ee{constructor(t){super(),this.domElement=t.domElement||ce.createElement("svg"),this.scene=new mt,this.scene.parent=this,this.defs=ce.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(t,e){return this.width=t,this.height=e,ce.setAttributes(this.domElement,{width:t,height:e}),this.trigger(ee.Types.resize,t,e)}render(){return ce.group.render.call(this.scene,this.domElement),ce.defs.update(this.domElement),this}};B(id,"Utils",ce);var nn={create:function(t,e,n){const r=t.createShader(t[n]);if(t.shaderSource(r,e),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const s=t.getShaderInfoLog(r);throw t.deleteShader(r),new Dt("unable to compile shader "+r+": "+s)}return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:`
|
|
40
|
+
***************************************************************************** */var no=function(){return no=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},no.apply(this,arguments)},dp={scale:1,zoom:!0,infiniteZoom:!0,actualSize:!0,showZoomInOutIcons:!1,actualSizeIcons:{zoomIn:"lg-zoom-in",zoomOut:"lg-zoom-out"},enableZoomAfter:300,zoomPluginStrings:{zoomIn:"Zoom in",zoomOut:"Zoom out",viewActualSize:"View actual size"}},In={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},gs=500,up=(function(){function t(e,n){return this.core=e,this.$LG=n,this.settings=no(no({},dp),this.core.settings),this}return t.prototype.buildTemplates=function(){var e=this.settings.showZoomInOutIcons?'<button id="'+this.core.getIdName("lg-zoom-in")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomIn+'" class="lg-zoom-in lg-icon"></button><button id="'+this.core.getIdName("lg-zoom-out")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.zoomOut+'" class="lg-zoom-out lg-icon"></button>':"";this.settings.actualSize&&(e+='<button id="'+this.core.getIdName("lg-actual-size")+'" type="button" aria-label="'+this.settings.zoomPluginStrings.viewActualSize+'" class="'+this.settings.actualSizeIcons.zoomIn+' lg-icon"></button>'),this.core.outer.addClass("lg-use-transition-for-zoom"),this.core.$toolbar.first().append(e)},t.prototype.enableZoom=function(e){var n=this,r=this.settings.enableZoomAfter+e.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&e.detail.delay?r=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){n.isImageSlide(n.core.index)&&(n.core.getSlideItem(e.detail.index).addClass("lg-zoomable"),e.detail.index===n.core.index&&n.setZoomEssentials())},r+30)},t.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(In.slideItemLoad+".zoom",this.enableZoom.bind(this))},t.prototype.getDragCords=function(e){return{x:e.pageX,y:e.pageY}},t.prototype.getSwipeCords=function(e){var n=e.touches[0].pageX,r=e.touches[0].pageY;return{x:n,y:r}},t.prototype.getDragAllowedAxises=function(e,n){if(!this.containerRect)return{allowX:!1,allowY:!1};var r=this.core.getSlideItem(this.core.index).find(".lg-image").first().get(),o=0,s=0,a=r.getBoundingClientRect();e?(o=r.offsetHeight*e,s=r.offsetWidth*e):n?(o=a.height+n*a.height,s=a.width+n*a.width):(o=a.height,s=a.width);var l=o>this.containerRect.height,c=s>this.containerRect.width;return{allowX:c,allowY:l}},t.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},t.prototype.zoomImage=function(e,n,r,o){if(!(!this.containerRect||Math.abs(n)<=0)){var s=this.containerRect.width/2+this.containerRect.left,a=this.containerRect.height/2+this.containerRect.top+this.scrollTop,l,c;e===1&&(this.positionChanged=!1);var d=this.getDragAllowedAxises(0,n),u=d.allowY,h=d.allowX;this.positionChanged&&(l=this.left/(this.scale-n),c=this.top/(this.scale-n),this.pageX=s-l,this.pageY=a-c,this.positionChanged=!1);var f=this.getPossibleSwipeDragCords(n),m,p,g=s-this.pageX,y=a-this.pageY;if(e-n>1){var b=(e-n)/Math.abs(n);g=(n<0?-g:g)+this.left*(b+(n<0?-1:1)),y=(n<0?-y:y)+this.top*(b+(n<0?-1:1)),m=g/b,p=y/b}else{var b=(e-n)*n;m=g*b,p=y*b}r&&(h?this.isBeyondPossibleLeft(m,f.minX)?m=f.minX:this.isBeyondPossibleRight(m,f.maxX)&&(m=f.maxX):e>1&&(m<f.minX?m=f.minX:m>f.maxX&&(m=f.maxX)),u?this.isBeyondPossibleTop(p,f.minY)?p=f.minY:this.isBeyondPossibleBottom(p,f.maxY)&&(p=f.maxY):e>1&&(p<f.minY?p=f.minY:p>f.maxY&&(p=f.maxY))),this.setZoomStyles({x:m,y:p,scale:e}),this.left=m,this.top=p,o&&this.setZoomImageSize()}},t.prototype.resetImageTranslate=function(e){if(this.isImageSlide(e)){var n=this.core.getSlideItem(e).find(".lg-image").first();this.imageReset=!1,n.removeClass("reset-transition reset-transition-y reset-transition-x"),this.core.outer.removeClass("lg-actual-size"),n.css("width","auto").css("height","auto"),setTimeout(function(){n.removeClass("no-transition")},10)}},t.prototype.setZoomImageSize=function(){var e=this,n=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var r=e.getCurrentImageActualSizeScale();e.scale>=r&&(n.addClass("no-transition"),e.imageReset=!0)},gs),setTimeout(function(){var r=e.getCurrentImageActualSizeScale();if(e.scale>=r){var o=e.getDragAllowedAxises(e.scale);n.css("width",n.get().naturalWidth+"px").css("height",n.get().naturalHeight+"px"),e.core.outer.addClass("lg-actual-size"),o.allowX&&o.allowY?n.addClass("reset-transition"):o.allowX&&!o.allowY?n.addClass("reset-transition-x"):!o.allowX&&o.allowY&&n.addClass("reset-transition-y")}},gs+50)},t.prototype.setZoomStyles=function(e){var n=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),r=this.core.getSlideItem(this.core.index).find(".lg-image").first(),o=this.core.outer.find(".lg-current .lg-dummy-img").first();this.scale=e.scale,r.css("transform","scale3d("+e.scale+", "+e.scale+", 1)"),o.css("transform","scale3d("+e.scale+", "+e.scale+", 1)");var s="translate3d("+e.x+"px, "+e.y+"px, 0)";n.css("transform",s)},t.prototype.setActualSize=function(e,n){var r=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var o=this.core.galleryItems[this.core.index];this.resetImageTranslate(e),setTimeout(function(){if(!(!o.src||r.core.outer.hasClass("lg-first-slide-loading"))){var s=r.getCurrentImageActualSizeScale(),a=r.scale;r.core.outer.hasClass("lg-zoomed")?r.scale=1:r.scale=r.getScale(s),r.setPageCords(n),r.beginZoom(r.scale),r.zoomImage(r.scale,r.scale-a,!0,!0)}},50),setTimeout(function(){r.core.outer.removeClass("lg-grabbing").addClass("lg-grab")},60),setTimeout(function(){r.zoomInProgress=!1},gs+110)}},t.prototype.getNaturalWidth=function(e){var n=this.core.getSlideItem(e).find(".lg-image").first(),r=this.core.galleryItems[e].width;return r?parseFloat(r):n.get().naturalWidth},t.prototype.getActualSizeScale=function(e,n){var r,o;return e>=n?(r=e/n,o=r||2):o=1,o},t.prototype.getCurrentImageActualSizeScale=function(){var e=this.core.getSlideItem(this.core.index).find(".lg-image").first(),n=e.get().offsetWidth,r=this.getNaturalWidth(this.core.index)||n;return this.getActualSizeScale(r,n)},t.prototype.getPageCords=function(e){var n={};if(e)n.x=e.pageX||e.touches[0].pageX,n.y=e.pageY||e.touches[0].pageY;else{var r=this.core.$content.get().getBoundingClientRect();n.x=r.width/2+r.left,n.y=r.height/2+this.scrollTop+r.top}return n},t.prototype.setPageCords=function(e){var n=this.getPageCords(e);this.pageX=n.x,this.pageY=n.y},t.prototype.manageActualPixelClassNames=function(){var e=this.core.getElementById("lg-actual-size");e.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},t.prototype.beginZoom=function(e){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),e>1},t.prototype.getScale=function(e){var n=this.getCurrentImageActualSizeScale();return e<1?e=1:e>n&&(e=n),e},t.prototype.init=function(){var e=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var n=null;this.core.outer.on("dblclick.lg",function(r){e.$LG(r.target).hasClass("lg-image")&&e.setActualSize(e.core.index,r)}),this.core.outer.on("touchstart.lg",function(r){var o=e.$LG(r.target);r.touches.length===1&&o.hasClass("lg-image")&&(n?(clearTimeout(n),n=null,r.preventDefault(),e.setActualSize(e.core.index,r)):n=setTimeout(function(){n=null},300))}),this.core.LGel.on(In.containerResize+".zoom "+In.rotateRight+".zoom "+In.rotateLeft+".zoom "+In.flipHorizontal+".zoom "+In.flipVertical+".zoom",function(){if(!(!e.core.lgOpened||!e.isImageSlide(e.core.index)||e.core.touchAction)){var r=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();e.top=0,e.left=0,e.setZoomEssentials(),e.setZoomSwipeStyles(r,{x:0,y:0}),e.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){e.core.lgOpened&&(e.scrollTop=e.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(e.isImageSlide(e.core.index)){var r=0;e.imageReset&&(e.resetImageTranslate(e.core.index),r=50),setTimeout(function(){var o=e.scale-e.settings.scale;o<1&&(o=1),e.beginZoom(o),e.zoomImage(o,-e.settings.scale,!0,!e.settings.infiniteZoom)},r)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){e.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){e.setActualSize(e.core.index)}),this.core.LGel.on(In.beforeOpen+".zoom",function(){e.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(In.afterOpen+".zoom",function(){e.scrollTop=e.$LG(window).scrollTop(),e.pageX=e.core.outer.width()/2,e.pageY=e.core.outer.height()/2+e.scrollTop,e.scale=1}),this.core.LGel.on(In.afterSlide+".zoom",function(r){var o=r.detail.prevIndex;e.scale=1,e.positionChanged=!1,e.zoomInProgress=!1,e.resetZoom(o),e.resetImageTranslate(o),e.isImageSlide(e.core.index)&&e.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},t.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var e=this.scale+this.settings.scale;this.settings.infiniteZoom||(e=this.getScale(e)),this.beginZoom(e),this.zoomImage(e,Math.min(this.settings.scale,e-this.scale),!0,!this.settings.infiniteZoom)}},t.prototype.resetZoom=function(e){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var n=this.core.getElementById("lg-actual-size"),r=this.core.getSlideItem(e!==void 0?e:this.core.index);n.removeClass(this.settings.actualSizeIcons.zoomOut).addClass(this.settings.actualSizeIcons.zoomIn),r.find(".lg-img-wrap").first().removeAttr("style"),r.find(".lg-image").first().removeAttr("style"),this.scale=1,this.left=0,this.top=0,this.setPageCords()},t.prototype.getTouchDistance=function(e){return Math.sqrt((e.touches[0].pageX-e.touches[1].pageX)*(e.touches[0].pageX-e.touches[1].pageX)+(e.touches[0].pageY-e.touches[1].pageY)*(e.touches[0].pageY-e.touches[1].pageY))},t.prototype.pinchZoom=function(){var e=this,n=0,r=!1,o=1,s=0,a=this.core.getSlideItem(this.core.index);this.core.outer.on("touchstart.lg",function(l){if(a=e.core.getSlideItem(e.core.index),!!e.isImageSlide(e.core.index)&&l.touches.length===2){if(l.preventDefault(),e.core.outer.hasClass("lg-first-slide-loading"))return;o=e.scale||1,e.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),e.setPageCords(l),e.resetImageTranslate(e.core.index),e.core.touchAction="pinch",n=e.getTouchDistance(l)}}),this.core.$inner.on("touchmove.lg",function(l){if(l.touches.length===2&&e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){l.preventDefault();var c=e.getTouchDistance(l),d=n-c;if(!r&&Math.abs(d)>5&&(r=!0),r){s=e.scale;var u=Math.max(1,o+-d*.02);e.scale=Math.round((u+Number.EPSILON)*100)/100;var h=e.scale-s;e.zoomImage(e.scale,Math.round((h+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(l){if(e.core.touchAction==="pinch"&&(e.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){if(r=!1,n=0,e.scale<=1)e.resetZoom();else{var c=e.getCurrentImageActualSizeScale();if(e.scale>=c){var d=c-e.scale;d===0&&(d=.01),e.zoomImage(c,d,!1,!0)}e.manageActualPixelClassNames(),e.core.outer.addClass("lg-zoomed")}e.core.touchAction=void 0}})},t.prototype.touchendZoom=function(e,n,r,o,s){var a=n.x-e.x,l=n.y-e.y,c=Math.abs(a)/s+1,d=Math.abs(l)/s+1;c>2&&(c+=1),d>2&&(d+=1),a=a*c,l=l*d;var u=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),h={};h.x=this.left+a,h.y=this.top+l;var f=this.getPossibleSwipeDragCords();(Math.abs(a)>15||Math.abs(l)>15)&&(o&&(this.isBeyondPossibleTop(h.y,f.minY)?h.y=f.minY:this.isBeyondPossibleBottom(h.y,f.maxY)&&(h.y=f.maxY)),r&&(this.isBeyondPossibleLeft(h.x,f.minX)?h.x=f.minX:this.isBeyondPossibleRight(h.x,f.maxX)&&(h.x=f.maxX)),o?this.top=h.y:h.y=this.top,r?this.left=h.x:h.x=this.left,this.setZoomSwipeStyles(u,h),this.positionChanged=!0)},t.prototype.getZoomSwipeCords=function(e,n,r,o,s){var a={};if(o){if(a.y=this.top+(n.y-e.y),this.isBeyondPossibleTop(a.y,s.minY)){var l=s.minY-a.y;a.y=s.minY-l/6}else if(this.isBeyondPossibleBottom(a.y,s.maxY)){var c=a.y-s.maxY;a.y=s.maxY+c/6}}else a.y=this.top;if(r){if(a.x=this.left+(n.x-e.x),this.isBeyondPossibleLeft(a.x,s.minX)){var d=s.minX-a.x;a.x=s.minX-d/6}else if(this.isBeyondPossibleRight(a.x,s.maxX)){var u=a.x-s.maxX;a.x=s.maxX+u/6}}else a.x=this.left;return a},t.prototype.isBeyondPossibleLeft=function(e,n){return e>=n},t.prototype.isBeyondPossibleRight=function(e,n){return e<=n},t.prototype.isBeyondPossibleTop=function(e,n){return e>=n},t.prototype.isBeyondPossibleBottom=function(e,n){return e<=n},t.prototype.isImageSlide=function(e){var n=this.core.galleryItems[e];return this.core.getSlideType(n)==="image"},t.prototype.getPossibleSwipeDragCords=function(e){var n=this.core.getSlideItem(this.core.index).find(".lg-image").first(),r=this.core.mediaContainerPosition.bottom,o=n.get().getBoundingClientRect(),s=o.height,a=o.width;e&&(s=s+e*s,a=a+e*a);var l=(s-this.containerRect.height)/2,c=(this.containerRect.height-s)/2+r,d=(a-this.containerRect.width)/2,u=(this.containerRect.width-a)/2,h={minY:l,maxY:c,minX:d,maxX:u};return h},t.prototype.setZoomSwipeStyles=function(e,n){e.css("transform","translate3d("+n.x+"px, "+n.y+"px, 0)")},t.prototype.zoomSwipe=function(){var e=this,n={},r={},o=!1,s=!1,a=!1,l=new Date,c=new Date,d,u,h=this.core.getSlideItem(this.core.index);this.core.$inner.on("touchstart.lg",function(f){if(e.isImageSlide(e.core.index)&&(h=e.core.getSlideItem(e.core.index),(e.$LG(f.target).hasClass("lg-item")||h.get().contains(f.target))&&f.touches.length===1&&e.core.outer.hasClass("lg-zoomed"))){f.preventDefault(),l=new Date,e.core.touchAction="zoomSwipe",u=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var m=e.getDragAllowedAxises(0);a=m.allowY,s=m.allowX,(s||a)&&(n=e.getSwipeCords(f)),d=e.getPossibleSwipeDragCords(),e.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(f){if(f.touches.length===1&&e.core.touchAction==="zoomSwipe"&&(e.$LG(f.target).hasClass("lg-item")||h.get().contains(f.target))){f.preventDefault(),e.core.touchAction="zoomSwipe",r=e.getSwipeCords(f);var m=e.getZoomSwipeCords(n,r,s,a,d);(Math.abs(r.x-n.x)>15||Math.abs(r.y-n.y)>15)&&(o=!0,e.setZoomSwipeStyles(u,m))}}),this.core.$inner.on("touchend.lg",function(f){if(e.core.touchAction==="zoomSwipe"&&(e.$LG(f.target).hasClass("lg-item")||h.get().contains(f.target))){if(f.preventDefault(),e.core.touchAction=void 0,e.core.outer.removeClass("lg-zoom-dragging"),!o)return;o=!1,c=new Date;var m=c.valueOf()-l.valueOf();e.touchendZoom(n,r,s,a,m)}})},t.prototype.zoomDrag=function(){var e=this,n={},r={},o=!1,s=!1,a=!1,l=!1,c,d,u,h;this.core.outer.on("mousedown.lg.zoom",function(f){if(e.isImageSlide(e.core.index)){var m=e.core.getSlideItem(e.core.index);if(e.$LG(f.target).hasClass("lg-item")||m.get().contains(f.target)){c=new Date,h=e.core.getSlideItem(e.core.index).find(".lg-img-wrap").first();var p=e.getDragAllowedAxises(0);l=p.allowY,a=p.allowX,e.core.outer.hasClass("lg-zoomed")&&e.$LG(f.target).hasClass("lg-object")&&(a||l)&&(f.preventDefault(),n=e.getDragCords(f),u=e.getPossibleSwipeDragCords(),o=!0,e.core.outer.removeClass("lg-grab").addClass("lg-grabbing lg-zoom-drag-transition lg-zoom-dragging"))}}}),this.$LG(window).on("mousemove.lg.zoom.global"+this.core.lgId,function(f){if(o){s=!0,r=e.getDragCords(f);var m=e.getZoomSwipeCords(n,r,a,l,u);e.setZoomSwipeStyles(h,m)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(f){if(o){if(d=new Date,o=!1,e.core.outer.removeClass("lg-zoom-dragging"),s&&(n.x!==r.x||n.y!==r.y)){r=e.getDragCords(f);var m=d.valueOf()-c.valueOf();e.touchendZoom(n,r,a,l,m)}s=!1}e.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},t.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},t.prototype.destroy=function(){this.$LG(window).off(".lg.zoom.global"+this.core.lgId),this.core.LGel.off(".lg.zoom"),this.core.LGel.off(".zoom"),clearTimeout(this.zoomableTimeout),this.zoomableTimeout=!1},t})();const fp={ref:"gallery-container",class:"lightgallery-wrapper"},hp={},Rl=i.defineComponent({...hp,__name:"lightgallery",props:{settings:{},onAfterAppendSlide:{type:Function},onInit:{type:Function},onHasVideo:{type:Function},onContainerResize:{type:Function},onAfterAppendSubHtml:{type:Function},onBeforeOpen:{type:Function},onAfterOpen:{type:Function},onSlideItemLoad:{type:Function},onBeforeSlide:{type:Function},onAfterSlide:{type:Function},onPosterClick:{type:Function},onDragStart:{type:Function},onDragMove:{type:Function},onDragEnd:{type:Function},onBeforeNextSlide:{type:Function},onBeforePrevSlide:{type:Function},onBeforeClose:{type:Function},onAfterClose:{type:Function},onRotateLeft:{type:Function},onRotateRight:{type:Function},onFlipHorizontal:{type:Function},onFlipVertical:{type:Function}},setup(t){const e=t,n={lgAfterAppendSlide:e.onAfterAppendSlide,lgInit:e.onInit,lgHasVideo:e.onHasVideo,lgContainerResize:e.onContainerResize,lgAfterAppendSubHtml:e.onAfterAppendSubHtml,lgBeforeOpen:e.onBeforeOpen,lgAfterOpen:e.onAfterOpen,lgSlideItemLoad:e.onSlideItemLoad,lgBeforeSlide:e.onBeforeSlide,lgAfterSlide:e.onAfterSlide,lgPosterClick:e.onPosterClick,lgDragStart:e.onDragStart,lgDragMove:e.onDragMove,lgDragEnd:e.onDragEnd,lgBeforeNextSlide:e.onBeforeNextSlide,lgBeforePrevSlide:e.onBeforePrevSlide,lgBeforeClose:e.onBeforeClose,lgAfterClose:e.onAfterClose,lgRotateLeft:e.onRotateLeft,lgRotateRight:e.onRotateRight,lgFlipHorizontal:e.onFlipHorizontal,lgFlipVertical:e.onFlipVertical},r=i.useTemplateRef("gallery-container"),o=i.ref(null);return i.onMounted(async()=>{if(!r.value)return;const s=await import("lightgallery");o.value=s.default(r.value,{...e.settings}),D.forOwn(n,(a,l)=>{var c;a&&((c=r.value)==null||c.addEventListener(l,a))})}),i.onBeforeUnmount(()=>{var s;o.value&&((s=o.value)==null||s.destroy(),o.value=null)}),(s,a)=>(i.openBlock(),i.createElementBlock("div",fp,[i.renderSlot(s.$slots,"default")],512))}}),gt=class gt{static init(){gt.isInitialized||(gt.isInitialized=!0,gt.windowResizeHandler(),window.addEventListener("resize",gt.windowResizeHandler))}static destroy(){window.removeEventListener("resize",gt.windowResizeHandler),gt.isInitialized=!1}static getDeviceTypeByResolution(){const e=j.useBaseConfigStateStore().config.deviceTypeByResolution;return window.innerWidth<e.tablet?Xe.phone:window.innerWidth<e.laptop?Xe.tablet:Xe.laptop}static initRefDependingOnDeviceResolution(e,n,r){const o=i.ref(r);return gt.setRefValueDependingOnDeviceResolution(o,e,n,r),gt.refsDependingOnDeviceResolution.push({r:o,phoneValue:e,tabletValue:n,defaultValue:r}),o}static isPhoneDevice(){return gt.getDeviceTypeByResolution()===Xe.phone}static isTabletDevice(){return gt.getDeviceTypeByResolution()===Xe.tablet}static isLaptopDevice(){return gt.getDeviceTypeByResolution()===Xe.laptop}static setRefValueDependingOnDeviceResolution(e,n,r,o){switch(gt.getDeviceTypeByResolution()){case Xe.phone:e.value=n;break;case Xe.tablet:e.value=r;break;default:e.value=o;break}}static windowResizeHandler(){D.forEach(gt.refsDependingOnDeviceResolution,e=>{gt.setRefValueDependingOnDeviceResolution(e.r,e.phoneValue,e.tabletValue,e.defaultValue)})}};T(gt,"isInitialized",!1),T(gt,"refsDependingOnDeviceResolution",[]);let et=gt;const mp=["href"],pp=["src","alt"],gp={},El=i.defineComponent({...gp,__name:"image-gallery",props:{images:{}},setup(t,{expose:e}){const n=i.ref(!1),r=i.ref(!1),o=i.ref({plugins:[cp,up],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),s=()=>window.innerWidth*(et.getDeviceTypeByResolution()===Xe.phone?.7:.8),a=i.ref(s()),l=()=>{a.value=s()},c=()=>{n.value=!0};return i.onUnmounted(()=>{window.removeEventListener("resize",l)}),e({show:c}),window.addEventListener("resize",l),(d,u)=>{const h=$l,f=z.NPopover;return i.openBlock(),i.createBlock(f,{trigger:"manual",show:n.value,class:"sc-image",placement:"top-start",onClickoutside:u[3]||(u[3]=()=>{r.value||(n.value=!1)})},{trigger:i.withCtx(()=>[i.createElementVNode("div",{class:"inline-flex",onClick:u[0]||(u[0]=m=>n.value=!n.value)},[i.renderSlot(d.$slots,"default",{},()=>[i.createVNode(h)])])]),default:i.withCtx(()=>[i.createVNode(Rl,{settings:o.value,style:i.normalizeStyle(`max-width: ${a.value}px`),class:"flex flex-row overflow-x-scroll",onAfterOpen:u[1]||(u[1]=()=>{r.value=!0}),onAfterClose:u[2]||(u[2]=()=>{r.value=!1,n.value=!1})},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.images,(m,p)=>(i.openBlock(),i.createElementBlock("a",{key:p,href:m.image},[i.createElementVNode("img",{src:m.preview,alt:`Изображение #${p+1}`},null,8,pp)],8,mp))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),yp={class:"text-sm grid grid-cols-[auto_auto] gap-x-3 gap-y-1 items-baseline"},bp={class:"pr-3"},_p={class:"text-right"},wp={},xp=i.defineComponent({...wp,__name:"product-stock-count",props:{product:{}},setup(t){return(e,n)=>{const r=ps,o=z.NPopover;return i.openBlock(),i.createBlock(o,{trigger:"click",placement:"top-start",class:"sc-stock-count"},{trigger:i.withCtx(()=>[i.renderSlot(e.$slots,"default",{},()=>[i.createVNode(r)])]),default:i.withCtx(()=>[i.createElementVNode("div",yp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.product.stockCount,(s,a)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:a},[i.createElementVNode("span",bp,i.toDisplayString(s.warehouse.name),1),i.createElementVNode("span",_p,[i.createTextVNode(i.toDisplayString(s.count??"В наличии")+" ",1),s.count?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(i.toDisplayString(t.product.unit.name),1)],64)):i.createCommentVNode("",!0)])],64))),128))])]),_:3})}}}),kp={class:"flex flex-row justify-between"},vp={key:0,class:"inline-flex flex-row gap-0.5 mr-2 align-sub"},Cp={key:1},Sp={class:"ml-2 align-sub"},Bp={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},Tp={class:"@container"},Np={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},$p={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},Rp={class:"text-sc-dark-grey"},Ep={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},Pp={class:"text-gray-600"},Fp={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},Vp={key:3,class:"underline decoration-dashed"},Mp={key:4,class:"sc-product-pack whitespace-nowrap"},Ap={class:"text-gray-600"},Ip={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},Op={class:"text-gray-600"},zp={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},Dp={key:0},Lp={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},Hp={},vr=i.defineComponent({...Hp,__name:"product-name",props:{product:{},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showCode:{type:Boolean,default:!0},showProductCosts:{type:[Boolean,Function],default:!1},showPlanningDates:{type:Boolean,default:!0},showPriceHistory:{type:Boolean,default:!1},showCostDate:{type:Boolean,default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},currencyRates:{default:void 0},showAdditionalSaleIcon:{type:Boolean,default:!1},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(t,{expose:e}){const n=t,r=i.computed(()=>D.isFunction(n.showProductCosts)?n.showProductCosts(n.product):n.showProductCosts),o=i.computed(()=>D.sortBy(n.product.priceCoefficients,["coefficient.slug"])),s=i.computed(()=>{var h,f;return(f=(h=n.product)==null?void 0:h.properties)==null?void 0:f.planingIncomingDate}),a=i.useTemplateRef("image-gallery"),l=()=>{var h;(h=a.value)==null||h.show()},c=i.computed(()=>D.isFunction(n.allowNameClick)?n.allowNameClick(n.product):n.allowNameClick),d=i.computed(()=>{var h;return n.showProductAddToCartButton||n.showProductEditButton||n.showProductRequiredButton||(((h=n.productContextButtonsConfig)==null?void 0:h.length)??0)>0}),u=()=>{var h;c.value&&((h=n.eventEmitter)==null||h.emit("product:name-click",{product:n.product,exposedMethods:{showProductImagesPreview:l}}))};return e({showProductImagesPreview:l}),(h,f)=>{var N,w,S,v;const m=ap,p=z.NTooltip,g=Tl,y=rp,b=$l,_=z.NText,k=Nl,x=ps,C=z.NScrollbar;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",kp,[i.createVNode(_,{type:"info",class:"sc-product-name text-balance text-base font-medium text-black"},{default:i.withCtx(()=>{var $,E,A,R;return[($=t.product)!=null&&$.isFavorite||(E=t.product)!=null&&E.isPreviouslyOrdered||t.showAdditionalSaleIcon?(i.openBlock(),i.createElementBlock("div",vp,[((A=t.product)==null?void 0:A.isFavorite)??!1?(i.openBlock(),i.createBlock(p,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(m,{class:"!text-yellow-300"})]),default:i.withCtx(()=>[f[0]||(f[0]=i.createTextVNode(" Избранный товар ",-1))]),_:1})):i.createCommentVNode("",!0),((R=t.product)==null?void 0:R.isPreviouslyOrdered)??!1?(i.openBlock(),i.createBlock(p,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(g,{class:"!text-green-700"})]),default:i.withCtx(()=>[f[1]||(f[1]=i.createTextVNode(" Ранее заказанный товар ",-1))]),_:1})):i.createCommentVNode("",!0),t.showAdditionalSaleIcon?(i.openBlock(),i.createBlock(p,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(y,{class:"!text-green-500"})]),default:i.withCtx(()=>[f[2]||(f[2]=i.createTextVNode(" Дополнительная продажа ",-1))]),_:1})):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.createElementVNode("span",{class:i.normalizeClass({"cursor-pointer":c.value&&t.eventEmitter}),onClick:u},i.toDisplayString(t.product.name),3),t.product.onOrder?(i.openBlock(),i.createElementBlock("span",Cp," [Под заказ] ")):i.createCommentVNode("",!0),i.createElementVNode("span",Sp,[t.product.images&&t.product.images.length>0?(i.openBlock(),i.createBlock(El,{key:0,ref:"image-gallery",images:t.product.images},{default:i.withCtx(()=>[i.createElementVNode("div",Bp,[i.createVNode(b)])]),_:1},8,["images"])):i.createCommentVNode("",!0)])]}),_:1}),d.value?(i.openBlock(),i.createBlock(k,{key:0,product:t.product,"event-emitter":t.eventEmitter,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-edit-button":t.showProductEditButton,"show-product-required-button":t.showProductRequiredButton,"product-context-buttons-config":t.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","show-product-required-button","product-context-buttons-config"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",Tp,[i.createElementVNode("div",Np,[t.product.supplierSku?(i.openBlock(),i.createElementBlock("div",$p,[f[3]||(f[3]=i.createTextVNode(" Артикул производителя/поставщика: ",-1)),i.createElementVNode("span",Rp,i.toDisplayString(t.product.supplierSku),1)])):i.createCommentVNode("",!0),t.showCode?(i.openBlock(),i.createElementBlock("span",Ep,[f[4]||(f[4]=i.createTextVNode(" Артикул: ",-1)),i.createElementVNode("span",Pp,i.toDisplayString(t.product.code),1)])):i.createCommentVNode("",!0),t.product.stockCount&&t.product.stockCount.length>0?(i.openBlock(),i.createBlock(xp,{key:2,product:t.product},{default:i.withCtx(()=>[i.createElementVNode("span",Fp,[f[5]||(f[5]=i.createElementVNode("span",{class:"underline decoration-dashed"},"В наличии",-1)),i.createVNode(x,{class:"mt-0.5"})])]),_:1},8,["product"])):(i.openBlock(),i.createElementBlock("span",Vp," Нет в наличии ")),t.product.pack??((w=(N=t.product)==null?void 0:N.properties)==null?void 0:w.pack)?(i.openBlock(),i.createElementBlock("span",Mp,[f[6]||(f[6]=i.createTextVNode(" Норма упаковки: ",-1)),i.createElementVNode("span",Ap,i.toDisplayString(t.product.pack??((v=(S=t.product)==null?void 0:S.properties)==null?void 0:v.pack)),1)])):i.createCommentVNode("",!0),t.showPlanningDates&&s.value?(i.openBlock(),i.createElementBlock("span",Ip,[f[7]||(f[7]=i.createTextVNode(" Планируемая дата поступления на основной склад: ",-1)),i.createElementVNode("span",Op,i.toDisplayString(s.value),1)])):i.createCommentVNode("",!0)])]),i.createVNode(C,{"x-scrollable":""},{default:i.withCtx(()=>[r.value?(i.openBlock(),i.createElementBlock("div",zp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,$=>(i.openBlock(),i.createBlock(ni,{key:$.coefficient.slug,product:t.product,"cost-field-name":$.coefficient.slug??"","event-emitter":t.eventEmitter,"allow-price-click":t.allowPriceClick,"show-tag":!0,"show-price-history":t.showPriceHistory,"currency-rates":t.currencyRates},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history","currency-rates"]))),128)),i.createVNode(ni,{product:t.product,"event-emitter":t.eventEmitter,"allow-price-click":t.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":t.showCostDate,"show-price-history":t.showPriceHistory,"currency-rates":t.currencyRates,"cost-field-name":"cost","additional-through-field-name":"retailCost",style:{"background-color":"var(--n-merged-td-color)"},class:"sticky right-0 border-0 border-l-2 border-solid border-gray-300 pl-2"},null,8,["product","event-emitter","allow-price-click","show-cost-date","show-price-history","currency-rates"])])):i.createCommentVNode("",!0)]),_:1}),t.showSlugs||t.showProperties?(i.openBlock(),i.createElementBlock("div",Dp,[i.createElementVNode("ul",Lp,[t.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:t.product.id,slug:t.product.slug},($,E)=>(i.openBlock(),i.createElementBlock("li",{key:E}," ("+i.toDisplayString(E)+"): "+i.toDisplayString($),1))),128)):i.createCommentVNode("",!0),t.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(t.product.properties,($,E)=>(i.openBlock(),i.createElementBlock("li",{key:E}," ("+i.toDisplayString(E)+"): "+i.toDisplayString($),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)])}}}),Wp=(t,e,n)=>({key:t,title:e,className:"align-top",resizable:!0,render:r=>i.h(ni,{product:r,costFieldName:t,eventEmitter:n.eventEmitter,allowPriceClick:n.allowPriceClick,currencyRates:n.currencyRates})}),jp=(t,e)=>{if(t.length===0)return[];const n=[],r={};switch(D.isNil(e.isProductItemSelected)||n.push({key:"checkbox",title:"",className:"align-top",width:"32",render:o=>{var s,a;return i.h(z.NCheckbox,{checked:!!((s=e.isProductItemSelected)!=null&&s.call(e,o)),disabled:((a=e.isProductItemSelected)==null?void 0:a.call(e,o))==="disabled",onUpdateChecked:l=>{e.eventEmitter.emit("product:checked",{product:o,checked:l})}})}}),et.getDeviceTypeByResolution()){case Xe.phone:case Xe.tablet:n.push({key:"name",title:"Наименование",className:"align-top",render:o=>i.h(vr,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig})});break;default:n.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:o=>i.h(vr,{product:o,eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,currencyRates:e.currencyRates})}),e.showProductCosts&&(D.forEach(t,o=>{D.forEach(o.priceCoefficients,s=>{r[s.coefficient.slug??""]||(r[s.coefficient.slug??""]=s.coefficient)})}),D.forEach(D.sortBy(r,["slug"]),o=>{n.push(Wp(o.slug??"",o.name,e))}),n.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:o=>i.h(ni,{product:o,costFieldName:"cost",additionalThroughFieldName:"retailCost",eventEmitter:e.eventEmitter,allowPriceClick:e.allowPriceClick,showQuantityUnit:!0,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,currencyRates:e.currencyRates})})),(e.showProductEditButton||e.showProductRequiredButton||e.showProductAddToCartButton||!D.isNil(e.productContextButtonsConfig))&&n.push({key:"actions",title:"",className:"align-top",width:"50",render:o=>i.h(Nl,{product:o,eventEmitter:e.eventEmitter,showProductAddToCartButton:e.showProductAddToCartButton,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,productContextButtonsConfig:e.productContextButtonsConfig})});break}return n},qp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Xp(t,e){return i.openBlock(),i.createElementBlock("svg",qp,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",d:"M296 64h-80a7.91 7.91 0 0 0-8 8v24h96V72a7.91 7.91 0 0 0-8-8"},null,-1),i.createElementVNode("path",{fill:"currentColor",d:"M432 96h-96V72a40 40 0 0 0-40-40h-80a40 40 0 0 0-40 40v24H80a16 16 0 0 0 0 32h17l19 304.92c1.42 26.85 22 47.08 48 47.08h184c26.13 0 46.3-19.78 48-47l19-305h17a16 16 0 0 0 0-32M192.57 416H192a16 16 0 0 1-16-15.43l-8-224a16 16 0 1 1 32-1.14l8 224A16 16 0 0 1 192.57 416M272 400a16 16 0 0 1-32 0V176a16 16 0 0 1 32 0Zm32-304h-96V72a7.91 7.91 0 0 1 8-8h80a7.91 7.91 0 0 1 8 8Zm32 304.57A16 16 0 0 1 320 416h-.58A16 16 0 0 1 304 399.43l8-224a16 16 0 1 1 32 1.14Z"},null,-1)])])}const io=i.markRaw({name:"ion-trash",render:Xp}),Yp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Up(t,e){return i.openBlock(),i.createElementBlock("svg",Yp,[...e[0]||(e[0]=[i.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)])])}const Pl=i.markRaw({name:"ion-plus",render:Up}),Kp={key:0,class:"flex w-fit items-center gap-2"},Gp={key:1,class:"flex flex-wrap gap-1"},Zp={key:0},Qp={key:2},Jp={},Cr=i.defineComponent({...Jp,__name:"configurators-product-info",props:{isProductSearching:{type:Boolean,default:!1},product:{default:void 0},validation:{default:void 0}},setup(t){const e=t,n=i.computed(()=>{var r,o;return(o=(r=e.product)==null?void 0:r.properties)==null?void 0:o.planingProductionDate});return(r,o)=>{const s=z.NSpin,a=z.NText;return t.isProductSearching?(i.openBlock(),i.createElementBlock("div",Kp,[i.createVNode(s,{size:17,class:"w-fit"}),o[0]||(o[0]=i.createElementVNode("div",null,"Выполняется поиск товара ...",-1))])):t.product&&!t.product.isNewRec()?(i.openBlock(),i.createElementBlock("div",Gp,[i.createElementVNode("div",null,i.toDisplayString(t.product.code)+" - "+i.toDisplayString(t.product.name)+" - "+i.toDisplayString(t.product.costRub.toLocaleString())+" ₽ / "+i.toDisplayString(t.product.unit.name),1),n.value?(i.openBlock(),i.createElementBlock("div",Zp,"(Планируемая дата производства: "+i.toDisplayString(n.value)+")",1)):i.createCommentVNode("",!0)])):t.validation?(i.openBlock(),i.createElementBlock("div",Qp,[i.createVNode(a,{type:t.validation.validationStatus},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.validation.feedback),1)]),_:1},8,["type"])])):i.createCommentVNode("",!0)}}}),eg={class:"flex flex-col gap-4"},tg={class:"flex flex-col gap-2"},ng={class:"mt-8 font-bold"},ig={class:"grid grow grid-cols-2 items-start gap-2"},rg={key:2,class:"text-red-500 text-sm"},og={key:3,class:"text-red-500 text-sm mb-2"},sg={class:"flex flex-col gap-4"},ag={key:1},lg={class:"text-lg font-semibold"},cg={class:"flex gap-3"},dg={},ug=i.defineComponent({...dg,__name:"kozyrek-configurator-params-form",props:{value:{},settings:{},previewParams:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},selectTemplateIndex:{}},emits:["update:value","update:params","submit","click:add-line","click:remove-line","click:save-template"],setup(t,{expose:e,emit:n}){var y;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.ref(!1),l=i.ref(D.cloneDeep(r.value)),c=i.computed(()=>{var _,k,x;const b={"configuratorParams.length":[ae.required,ae.min(r.settings.stripMinLength),ae.max(r.settings.stripMaxLength||Number.MAX_VALUE),ae.step(r.settings.lengthStep),We.serverValidation((_=r.validation.length)==null?void 0:_.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),We.serverValidation((k=r.validation.quantity)==null?void 0:k.feedback)],marker:[We.serverValidation((x=r.validation.marker)==null?void 0:x.feedback)]};return D.forEach(l.value.configuratorParams.linesWidths,(C,N)=>{var v;const S=l.value.configuratorParams.linesWidths.length>1?r.settings.minLineWidth:r.settings.stripMinWidth;b[`configuratorParams.linesWidths.${N}`]=[ae.required,ae.min(S),ae.max(r.settings.maxLineWidth),ae.step(r.settings.lineWidthStep),We.serverValidation((v=r.validation[`lines_widths[${N+1}]`])==null?void 0:v.feedback)]}),D.forEach(l.value.configuratorParams.linesAngles,(C,N)=>{var w;b[`configuratorParams.linesAngles.${N}`]=[ae.required,ae.min(r.settings.minLineAngle),ae.max(r.settings.maxLineAngle),ae.step(r.settings.lineAngleStep),We.serverValidation((w=r.validation[`lines_angles[${N+1}]`])==null?void 0:w.feedback)]}),b}),d=i.ref(r.settings.canSetDopProdaga??!1),u=i.computed(()=>{var C;const{length:b}=l.value.configuratorParams,{quantity:_}=l.value,k=((C=l.value.product)==null?void 0:C.costRub)||0;if(!b||!_||k===0)return null;const x=b/1e3;return(k*_*x).toLocaleString("ru-ru",{maximumFractionDigits:2,minimumFractionDigits:2})}),h=i.computed(()=>D.reduce(l.value.configuratorParams.linesWidths,(b,_)=>b+(_||0),0)),f=i.computed(()=>{const b=h.value;return b>=r.settings.stripMinWidth&&b<=r.settings.stripMaxWidth}),m=i.computed(()=>{const{configuratorParams:b}=l.value,_=D.every(b.linesWidths,N=>!!(N&&N>0)),k=D.every(b.linesAngles,N=>!D.isNil(N)),x=!!(l.value.quantity&&l.value.quantity>0),C=b.length>0&&b.length>0;return _&&k&&x&&C&&f.value}),p=()=>{i.nextTick(()=>{var b;(b=s.value)==null||b.validate(_=>{_||(o("update:params",l.value.configuratorParams),g("configuratorParams",l.value.configuratorParams))}).catch(D.noop)})},g=(b,_)=>{const k=new j.OrderItemBase(l.value);k[b]=_,b==="configuratorParams"&&(k.product=new j.ClientProduct),o("update:value",k)};return i.watch(()=>r.previewParams,b=>{l.value.configuratorParams.linesWidths=b.linesWidths,l.value.configuratorParams.linesAngles=b.linesAngles},{deep:!0}),i.watch(()=>r.value,b=>{l.value=D.cloneDeep(b)},{deep:!0}),e({validate:(y=s.value)==null?void 0:y.validate,formReference:s}),(b,_)=>{const k=Pl,x=io,C=z.NCheckbox;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:l.value,rules:c.value,class:"flex flex-col gap-4 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>{var N;return[i.createElementVNode("div",eg,[_[21]||(_[21]=i.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),t.settings.startTailConfigs&&t.settings.startTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(z.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:l.value.configuratorParams.startTailType,"onUpdate:value":[_[0]||(_[0]=w=>l.value.configuratorParams.startTailType=w),p],options:t.settings.startTailConfigs.map(({label:w},S)=>({label:w,value:S})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",tg,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value.configuratorParams.linesAngles,(w,S)=>(i.openBlock(),i.createElementBlock("div",{key:S,class:"flex items-start gap-2"},[i.createElementVNode("div",ng,i.toDisplayString(S+1),1),i.createElementVNode("div",ig,[i.createVNode(i.unref(z.NFormItem),{path:`configuratorParams.linesWidths.${S}`,label:"Ширина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:l.value.configuratorParams.linesWidths[S],"onUpdate:value":[v=>l.value.configuratorParams.linesWidths[S]=v,_[2]||(_[2]=v=>p())],parse:i.unref(lt),"show-button":!1,class:"w-full",onKeydown:_[1]||(_[1]=v=>i.unref(st)(v)),onInput:v=>i.unref(it)(t.validation,`lines_widths[${S+1}]`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(z.NFormItem),{path:`configuratorParams.linesAngles.${S}`,label:"Угол сгиба, °"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:l.value.configuratorParams.linesAngles[S],"onUpdate:value":[v=>l.value.configuratorParams.linesAngles[S]=v,_[4]||(_[4]=v=>p())],parse:i.unref(lt),"show-button":!1,class:"w-full",onKeydown:_[3]||(_[3]=v=>i.unref(st)(v,!0)),onInput:v=>i.unref(it)(t.validation,`lines_angles[${S+1}]`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","onInput","onFocus"])]),_:2},1032,["path"])]),i.createVNode(i.unref(z.NFormItem),{label:void 0,"show-feedback":!1,required:!0,class:"shrink-0"},{default:i.withCtx(()=>[t.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,size:"medium",onClick:v=>o("click:add-line",S)},{default:i.withCtx(()=>[i.createVNode(k)]),_:1},8,["onClick"])),t.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:1,disabled:l.value.configuratorParams.linesWidths.length===1,size:"medium",class:"ml-2",onClick:v=>o("click:remove-line",S)},{default:i.withCtx(()=>[i.createVNode(x)]),_:1},8,["disabled","onClick"]))]),_:2},1024)]))),128))]),t.settings.endTailConfigs&&t.settings.endTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(z.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:l.value.configuratorParams.endTailType,"onUpdate:value":[_[5]||(_[5]=w=>l.value.configuratorParams.endTailType=w),p],options:t.settings.endTailConfigs.map(({label:w},S)=>({label:w,value:S})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Cr,{"is-product-searching":t.isProductSearching,product:l.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),f.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",rg," Суммарная ширина участков гиба должна быть от "+i.toDisplayString(t.settings.stripMinWidth)+" до "+i.toDisplayString(t.settings.stripMaxWidth)+" мм., текущая ширина: "+i.toDisplayString(h.value)+" мм. ",1)),m.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",og," Пожалуйста, заполните все обязательные поля корректно. ")),t.settings.allowSaveTemplates&&t.selectTemplateIndex===((N=t.settings.allTemplates)==null?void 0:N.length)-1?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:4,type:"tertiary",class:"self-start",loading:a.value,onClick:_[6]||(_[6]=w=>o("click:save-template"))},{default:i.withCtx(()=>[..._[20]||(_[20]=[i.createTextVNode(" Сохранить шаблон ",-1)])]),_:1},8,["loading"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",sg,[i.createVNode(i.unref(z.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:l.value.configuratorParams.colorSide,"onUpdate:value":[_[7]||(_[7]=w=>l.value.configuratorParams.colorSide=w),p],options:[{label:"Цвет сверху",value:"top"},{label:" Цвет снизу",value:"bottom"}],placeholder:"С какой стороны изделие будет иметь цвет"},null,8,["value"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{path:"configuratorParams.length",label:`Метраж${t.settings.stripMinLength?" от "+t.settings.stripMinLength:""}${t.settings.stripMaxLength?" до "+t.settings.stripMaxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[_[8]||(_[8]=w=>l.value.configuratorParams.length=w),_[11]||(_[11]=w=>p())],parse:i.unref(lt),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:_[9]||(_[9]=w=>i.unref(st)(w)),onInput:_[10]||(_[10]=w=>i.unref(it)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(z.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:l.value.quantity,"onUpdate:value":[_[12]||(_[12]=w=>l.value.quantity=w),_[15]||(_[15]=w=>g("quantity",w??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:_[13]||(_[13]=w=>i.unref(st)(w,!1)),onInput:_[14]||(_[14]=w=>i.unref(it)(t.validation,"quantity")),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:l.value.marker??null,placeholder:"Введите маркировку",onInput:_[16]||(_[16]=w=>i.unref(it)(t.validation,"marker")),"onUpdate:value":_[17]||(_[17]=w=>{l.value.marker=w??null,g("marker",w??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(C,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":_[18]||(_[18]=w=>{l.value.isAdditionalSale=w??!1,g("isAdditionalSale",w??!1)})},{default:i.withCtx(()=>[..._[22]||(_[22]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),u.value?(i.openBlock(),i.createElementBlock("div",ag,[_[23]||(_[23]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",lg,i.toDisplayString(u.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",cg,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!m.value||l.value.product.isNewRec(),type:"primary",class:"self-start",onClick:_[19]||(_[19]=w=>o("submit",l.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(l.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])])]}),_:1},8,["model","rules"])),[[i.unref(ei),()=>o("submit",l.value)]])}}}),Fl=An(ug,[["__scopeId","data-v-ac7f1192"]]);var Vl=Object.defineProperty,fg=Object.defineProperties,hg=Object.getOwnPropertyDescriptors,Ml=Object.getOwnPropertySymbols,mg=Object.prototype.hasOwnProperty,pg=Object.prototype.propertyIsEnumerable,Al=t=>{throw TypeError(t)},ys=(t,e,n)=>e in t?Vl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Sr=(t,e)=>{for(var n in e||(e={}))mg.call(e,n)&&ys(t,n,e[n]);if(Ml)for(var n of Ml(e))pg.call(e,n)&&ys(t,n,e[n]);return t},bs=(t,e)=>fg(t,hg(e)),Il=(t,e)=>{for(var n in e)Vl(t,n,{get:e[n],enumerable:!0})},B=(t,e,n)=>ys(t,typeof e!="symbol"?e+"":e,n),Ol=(t,e,n)=>e.has(t)||Al("Cannot "+n),zt=(t,e,n)=>(Ol(t,e,"read from private field"),n?n.call(t):e.get(t)),zl=(t,e,n)=>e.has(t)?Al("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),gg=(t,e,n,r)=>(Ol(t,e,"write to private field"),e.set(t,n),n),Et={Image:null,isHeadless:!1,shim:function(t,e){return t.tagName=t.nodeName=e||"canvas",t.nodeType=1,t.getAttribute=function(n){return this[n]},t.setAttribute=function(n,r){return this[n]=r,this},t},polyfill:function(t,e){return Et.shim(t),typeof e<"u"&&(Et.Image=e),Et.isHeadless=!0,t}},Dl={};Il(Dl,{Curve:()=>Ui,getAnchorsFromArcData:()=>_g,getComponentOnCubicBezier:()=>Br,getControlPoints:()=>Zl,getCurveBoundingBox:()=>Ul,getCurveFromPoints:()=>Gl,getCurveLength:()=>Yl,getReflection:()=>ks,integrate:()=>Kl,subdivide:()=>xs});var Ll={};Il(Ll,{HALF_PI:()=>ct,NumArray:()=>_n,TWO_PI:()=>tt,decomposeMatrix:()=>bi,getComputedMatrix:()=>_s,getEffectiveStrokeWidth:()=>wn,getPoT:()=>jl,lerp:()=>Pt,mod:()=>rt,setMatrix:()=>Wl,toFixed:()=>Ie});var Ue;typeof window<"u"?Ue=window:typeof global<"u"?Ue=global:typeof self<"u"&&(Ue=self);var Hl,tt=Math.PI*2,ct=Math.PI*.5;function bi(t,e,n,r,o,s){let a;return arguments.length<=1?(a=t.a,e=t.b,n=t.c,r=t.d,o=t.e,s=t.f):a=t,{translateX:o,translateY:s,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(n*n+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function Wl(t){Hl=t}function _s(t,e){e=e&&e.identity()||new Hl;let n=t;const r=[];for(;n&&n._matrix;)r.push(n._matrix),n=n.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Pt(t,e,n){return n*(e-t)+t}var ws=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function jl(t){let e=0;for(;ws[e]&&ws[e]<t;)e++;return ws[e]}function rt(t,e){for(;t<0;)t+=e;return t%e}var _n=Ue.Float32Array||Array,yg=Math.floor;function Ie(t){return yg(t*1e6)/1e6}function wn(t,e){const n=t._linewidth;if(t.strokeAttenuation)return n;e||(e=t.worldMatrix||_s(t));const r=bi(e.elements[0],e.elements[3],e.elements[1],e.elements[4],e.elements[2],e.elements[5]),o=Math.max(Math.abs(r.scaleX),Math.abs(r.scaleY));return o>0?n/o:n}var ie={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},ee=class{constructor(){B(this,"_events",{}),B(this,"_bound",!1)}addEventListener(e,n){return(this._events[e]||(this._events[e]=[])).push(n),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,n){if(!this._events)return this;if(!e&&!n)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(n)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,n!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const n=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...n);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,n,r){const o=this;e&&(s.obj=e,s.name=n,s.handler=r,e.on(n,s));function s(){r.apply(o,arguments)}return o}ignore(e,n,r){return e.off(n,r),this}};B(ee,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),B(ee,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var ql={x:{enumerable:!0,get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this._bound&&this.dispatchEvent(ee.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this._bound&&this.dispatchEvent(ee.Types.change))}}},ln=class gr extends ee{constructor(e=0,n=0){super(),B(this,"_x",0),B(this,"_y",0);for(let r in ql)Object.defineProperty(this,r,ql[r]);this.x=e,this.y=n}static add(e,n){return new gr(e.x+n.x,e.y+n.y)}static sub(e,n){return new gr(e.x-n.x,e.y-n.y)}static subtract(e,n){return gr.sub(e,n)}static ratioBetween(e,n){return(e.x*n.x+e.y*n.y)/(e.length()*n.length())}static angleBetween(e,n){if(arguments.length>=4){const s=arguments[0]-arguments[2],a=arguments[1]-arguments[3];return Math.atan2(a,s)}const r=e.x-n.x,o=e.y-n.y;return Math.atan2(o,r)}static distanceBetween(e,n){return Math.sqrt(gr.distanceBetweenSquared(e,n))}static distanceBetweenSquared(e,n){const r=e.x-n.x,o=e.y-n.y;return r*r+o*o}set(e,n){return this.x=e,this.y=n,this}copy(e){return this.x=e.x,this.y=e.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new gr(this.x,this.y)}add(e,n){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x+=e,this.y+=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x+=e.x,this.y+=e.y):(this.x+=e,this.y+=n),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,n){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x-=e,this.y-=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x-=e.x,this.y-=e.y):(this.x-=e,this.y-=n),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(e){return this.sub.apply(this,arguments)}subtractSelf(e){return this.sub.apply(this,arguments)}multiply(e,n){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x*=e,this.y*=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x*=e.x,this.y*=e.y):(this.x*=e,this.y*=n),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,n){return arguments.length<=0?this:(arguments.length<=1?typeof e=="number"?(this.x/=e,this.y/=e):e&&typeof e.x=="number"&&typeof e.y=="number"&&(this.x/=e.x,this.y/=e.y):(this.x/=e,this.y/=n),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(e){return this.divide.apply(this,arguments)}divideScalar(e){return this.divide(e)}negate(){return this.multiply(-1)}dot(e){return this.x*e.x+this.y*e.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,n){return n=typeof n>"u"?1e-4:n,this.distanceTo(e)<n}lerp(e,n){const r=(e.x-this.x)*n+this.x,o=(e.y-this.y)*n+this.y;return this.set(r,o)}isZero(e){return e=typeof e>"u"?1e-4:e,this.length()<e}toString(){return this.x+", "+this.y}toObject(){return{x:Ie(this.x),y:Ie(this.y)}}rotate(e){const n=this.x,r=this.y,o=Math.cos(e),s=Math.sin(e);return this.x=n*o-r*s,this.y=n*s+r*o,this}};B(ln,"zero",new ln),B(ln,"left",new ln(-1,0)),B(ln,"right",new ln(1,0)),B(ln,"up",new ln(0,-1)),B(ln,"down",new ln(0,1));var re=ln,Ne=class fs extends re{constructor(e=0,n=0,r=0,o=0,s=0,a=0,l=ie.move){super(e,n),B(this,"controls",{left:new re,right:new re}),B(this,"_command",ie.move),B(this,"_relative",!0),B(this,"_rx",0),B(this,"_ry",0),B(this,"_xAxisRotation",0),B(this,"_largeArcFlag",0),B(this,"_sweepFlag",1);for(let d in Xl)Object.defineProperty(this,d,Xl[d]);this.command=l,this.relative=!0;const c=fs.makeBroadcast(this);this.controls.left.set(r,o).addEventListener(ee.Types.change,c),this.controls.right.set(s,a).addEventListener(ee.Types.change,c)}static makeBroadcast(e){return n;function n(){e._bound&&e.dispatchEvent(ee.Types.change)}}static fromObject(e){return new fs().copy(e)}copy(e){return this.x=e.x,this.y=e.y,typeof e.command=="string"&&(this.command=e.command),e.controls&&(e.controls.left&&this.controls.left.copy(e.controls.left),e.controls.right&&this.controls.right.copy(e.controls.right)),typeof e.relative=="boolean"&&(this.relative=e.relative),typeof e.rx=="number"&&(this.rx=e.rx),typeof e.ry=="number"&&(this.ry=e.ry),typeof e.xAxisRotation=="number"&&(this.xAxisRotation=e.xAxisRotation),typeof e.largeArcFlag=="number"&&(this.largeArcFlag=e.largeArcFlag),typeof e.sweepFlag=="number"&&(this.sweepFlag=e.sweepFlag),this}clone(){return new fs().copy(this)}toObject(){return{x:Ie(this.x),y:Ie(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Ie(this.rx),ry:Ie(this.ry),xAxisRotation:Ie(this.xAxisRotation),largeArcFlag:Ie(this.largeArcFlag),sweepFlag:Ie(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},Xl={command:{enumerable:!0,get:function(){return this._command},set:function(t){this._command!==t&&(this._command=t,this._bound&&this.dispatchEvent(ee.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(t){this._relative!==!!t&&(this._relative=!!t,this._bound&&this.dispatchEvent(ee.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(t){this._rx!==t&&(this._rx=t,this._bound&&this.dispatchEvent(ee.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(t){this._ry!==t&&(this._ry=t,this._bound&&this.dispatchEvent(ee.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(t){this._xAxisRotation!==t&&(this._xAxisRotation=t,this._bound&&this.dispatchEvent(ee.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(t){this._largeArcFlag!==t&&(this._largeArcFlag=t,this._bound&&this.dispatchEvent(ee.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(t){this._sweepFlag!==t&&(this._sweepFlag=t,this._bound&&this.dispatchEvent(ee.Types.change))}}},bg=0,xt={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.23",PublishDate:"2025-12-22T19:59:24.486Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return bg++}},Ui={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Br(t,e,n,r,o){const s=1-t;return s*s*s*e+3*s*s*t*n+3*s*t*t*r+t*t*t*o}function xs(t,e,n,r,o,s,a,l,c){c=c||Ui.RecursionLimit;const d=c+1;if(Math.abs(t-a)<.001&&Math.abs(e-l)<.001)return[new Ne(a,l)];const u=[];for(let h=0;h<d;h++){const f=h/d,m=Br(f,t,n,o,a),p=Br(f,e,r,s,l);u.push(new Ne(m,p))}return u}function Yl(t,e,n,r,o,s,a,l,c){if(t===n&&e===r&&o===a&&s===l){const y=a-t,b=l-e;return Math.sqrt(y*y+b*b)}const d=9*(n-o)+3*(a-t),u=6*(t+o)-12*n,h=3*(n-t),f=9*(r-s)+3*(l-e),m=6*(e+s)-12*r,p=3*(r-e);function g(y){const b=(d*y+u)*y+h,_=(f*y+m)*y+p;return Math.sqrt(b*b+_*_)}return Kl(g,0,1,c||Ui.RecursionLimit)}function Ul(t,e,n,r,o,s,a,l){const c=[],d=[[],[]];let u,h,f,m,p,g,y,b;for(let C=0;C<2;++C){if(C===0?(h=6*t-12*n+6*o,u=-3*t+9*n-9*o+3*a,f=3*n-3*t):(h=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,f=3*r-3*e),Math.abs(u)<.001){if(Math.abs(h)<.001)continue;m=-f/h,0<m&&m<1&&c.push(m);continue}y=h*h-4*f*u,b=Math.sqrt(y),!(y<0)&&(p=(-h+b)/(2*u),0<p&&p<1&&c.push(p),g=(-h-b)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,k=_,x;for(;_--;)m=c[_],x=1-m,d[0][_]=x*x*x*t+3*x*x*m*n+3*x*m*m*o+m*m*m*a,d[1][_]=x*x*x*e+3*x*x*m*r+3*x*m*m*s+m*m*m*l;return d[0][k]=t,d[1][k]=e,d[0][k+1]=a,d[1][k+1]=l,d[0].length=d[1].length=k+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function Kl(t,e,n,r){let o=Ui.abscissas[r-2],s=Ui.weights[r-2],a=.5*(n-e),l=a+e,c=0,d=r+1>>1,u=r&1?s[c++]*t(l):0;for(;c<d;){const h=a*o[c];u+=s[c++]*(t(l+h)+t(l-h))}return a*u}function Gl(t,e){const n=t.length,r=n-1;for(let o=0;o<n;o++){const s=t[o],a=e?rt(o-1,n):Math.max(o-1,0),l=e?rt(o+1,n):Math.min(o+1,r),c=t[a],d=s,u=t[l];Zl(c,d,u),d.command=o===0?ie.move:ie.curve}}function Zl(t,e,n){const r=re.angleBetween(t,e),o=re.angleBetween(n,e);let s=re.distanceBetween(t,e),a=re.distanceBetween(n,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=ct:l-=ct,e.controls.left.x=Math.cos(l)*s,e.controls.left.y=Math.sin(l)*s,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}function ks(t,e,n){return new re(2*t.x-(e.x+t.x)-(n?t.x:0),2*t.y-(e.y+t.y)-(n?t.y:0))}function _g(t,e,n,r,o,s,a){const l=xt.Resolution;for(let c=0;c<l;c++){let d=(c+1)/l;a&&(d=1-d);const u=d*s+o,h=n*Math.cos(u),f=r*Math.sin(u),m=new Ne(h,f);m.command=ie.line}}var Ql=Array.prototype.slice;function wg(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}var oe={isNaN:function(t){return typeof t=="number"&&t!==+t},isElement:function(t){return!!(t&&t.nodeType===1)},isObject:function(t){const e=typeof t;return e==="function"||e==="object"&&!!t},isFunction:function(t){return typeof t=="function"},extend:function(t){const e=Ql.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let o in r)t[o]=r[o]}return t},defaults:function(t){const e=Ql.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let o in r)t[o]===void 0&&(t[o]=r[o])}return t},each:function(t,e,n){const r=n||this,o=!wg(t)&&Object.keys(t),s=(o||t).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,t[l],l,t)}return t},performance:Ue.performance&&Ue.performance.now?Ue.performance:Date},Yt={hasEventListeners:typeof Ue.addEventListener=="function",bind:function(t,e,n,r){return this.hasEventListeners?t.addEventListener(e,n,!!r):t.attachEvent("on"+e,n),Yt},unbind:function(t,e,n,r){return Yt.hasEventListeners?t.removeEventListeners(e,n,!!r):t.detachEvent("on"+e,n),Yt},getRequestAnimationFrame:function(){const t=["ms","moz","webkit","o"];let e=0,n=Ue.requestAnimationFrame;if(!n){for(let o=0;o<t.length;o++)n=Ue[t[o]+"RequestAnimationFrame"]||n;n=n||r}function r(o,s){const a=new Date().getTime(),l=Math.max(0,16-(a-e)),c=Ue.setTimeout(d,l);e=a+l;function d(){o(a+l)}return c}return n}},Ki=Ue.document?Ue.document.createElement("div"):{};Ki.id="help-two-load",Object.defineProperty(Yt,"temp",{enumerable:!0,get:function(){return oe.isElement(Ki)&&!Ue.document.head.contains(Ki)&&(Ki.style.display="none",Ue.document.head.appendChild(Ki)),Ki}});var Dt=class extends Error{constructor(e){super(),B(this,"name","Two.js"),B(this,"message"),this.message=e}},xg=Ue.devicePixelRatio||1;function kg(t){return t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1}function vs(t){return xg/kg(t)}var ro=class{constructor(){B(this,"map",{})}add(e,n){return this.map[e]=n,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}},kt,ii=class extends Array{constructor(){super(),zl(this,kt,new ee),arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}get _events(){return zt(this,kt)}set _events(e){gg(this,kt,e)}get _bound(){return zt(this,kt)._bound}set _bound(e){zt(this,kt)._bound=e}addEventListener(){var e;return(e=zt(this,kt).addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=zt(this,kt).on)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=zt(this,kt).bind)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=zt(this,kt).removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=zt(this,kt).off)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=zt(this,kt).unbind)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=zt(this,kt).dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=zt(this,kt).trigger)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=zt(this,kt).listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=zt(this,kt).ignore)==null?void 0:e.apply(this,arguments)}pop(){const e=super.pop.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}shift(){const e=super.shift.apply(this,arguments);return this.trigger(ee.Types.remove,[e]),e}push(){const e=super.push.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}unshift(){const e=super.unshift.apply(this,arguments);return this.trigger(ee.Types.insert,arguments),e}splice(){const e=super.splice.apply(this,arguments);if(this.trigger(ee.Types.remove,e),arguments.length>2){const n=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(ee.Types.insert,n),this.trigger(ee.Types.order)}return e}sort(){return super.sort.apply(this,arguments),this.trigger(ee.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(ee.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(e,n){const r=[];for(let o=0;o<this.length;o++){const s=this[o];let a;n?a=e.call(n,s,o):a=e(s,o),r.push(a)}return r}};kt=new WeakMap;var Jl=class Dh extends ee{constructor(){super(),B(this,"_flagId",!1),B(this,"_flagClassName",!1),B(this,"_renderer",{}),B(this,"_id",xt.Identifier+xt.uniqueId()),B(this,"_className",""),B(this,"classList",[]);for(let e in ec)Object.defineProperty(this,e,ec[e])}static fromObject(e){const n=new Dh().copy(e);return"id"in e&&(n.id=e.id),n}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(e){return e.renderer&&typeof e.renderer.type=="string"&&(this.renderer.type=e.renderer.type),typeof e.className=="string"&&(this.className=e.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const n=this.renderer.ctx;this._renderer.texture&&(n.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(n.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const e=this._renderer.type;return this._renderer={type:e},this}};B(Jl,"Properties",["renderer","id","className"]);var Gi=Jl,ec={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(t){const e=this._id;t!==this._id&&(this._id=t,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(t){this._className!==t&&(this._flagClassName=!0,this.classList=t.split(/\s+?/),this._className=t)}}},oo,tc={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Ue.document&&(oo=document.createElement("a"));var cn=class Qt extends Gi{constructor(e,n){super(),B(this,"_flagSrc",!1),B(this,"_flagImage",!1),B(this,"_flagVideo",!1),B(this,"_flagLoaded",!1),B(this,"_flagRepeat",!1),B(this,"_flagOffset",!1),B(this,"_flagScale",!1),B(this,"_src",""),B(this,"_image",null),B(this,"_loaded",!1),B(this,"_repeat","no-repeat"),B(this,"_scale",1),B(this,"_offset",null);for(let r in nc)Object.defineProperty(this,r,nc[r]);if(this._renderer.type="texture",this._renderer.flagOffset=vg.bind(this),this._renderer.flagScale=Cg.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new re,typeof n=="function"){const r=(function(){this.unbind(ee.Types.load,r),typeof n=="function"&&n()}).bind(this);this.bind(ee.Types.load,r)}if(typeof e=="string")this.src=e;else if(typeof e=="object"){const r=Object.prototype.toString.call(e);(r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]"||r==="[object HTMLVideoElement]"||r==="[object Image]")&&(this.image=e)}this._update()}fromObject(e){const n=new Qt().copy(e);return"id"in e&&(n.id=e.id),n}static getAbsoluteURL(e){return oo?(oo.href=e,oo.href):e}static loadHeadlessBuffer(e,n){e.image.onload=n,e.image.src=e.src}static getTag(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"}static getImage(e){const n=Qt.getAbsoluteURL(e);if(Qt.ImageRegistry.contains(n))return Qt.ImageRegistry.get(n);let r;return Et.Image?(r=new Et.Image,Et.shim(r,"img")):Ue.document?tc.video.test(n)?r=document.createElement("video"):r=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),r.crossOrigin="anonymous",r.referrerPolicy="no-referrer",r}static load(e,n){let r=e.image,o=Qt.getTag(r);e._flagImage&&(/canvas/i.test(o)?Qt.Register.canvas(e,n):(e._src=!Et.isHeadless&&r.getAttribute("two-src")||r.src,Qt.Register[o](e,n))),e._flagSrc&&(r||(r=Qt.getImage(e.src),e.image=r),o=Qt.getTag(r),Qt.Register[o](e,n))}clone(){const e=new Qt(this.src);return e.repeat=this.repeat,e.offset.copy(this.offset),e.scale=this.scale,e}copy(e){return this.src=e.src,this.repeat=e.repeat,this.offset=typeof e.offset=="number"||e.offset instanceof re?e.offset:new re().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof re?e.scale:new re().copy(e.scale),this}toObject(){const e=super.toObject.call(this);return e.renderer.type="texture",e.src=this.src,e.repeat=this.repeat,e.offset=this.offset.toObject(),e.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),e}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(ee.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Qt.load(this,(function(){this.loaded=!0,this.trigger(ee.Types.change).trigger(ee.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};B(cn,"Properties",["src","loaded","repeat","scale","offset","image"]),B(cn,"RegularExpressions",tc),B(cn,"ImageRegistry",new ro),B(cn,"Register",{canvas:function(t,e){t._src="#"+t.id,cn.ImageRegistry.add(t.src,t.image),typeof e=="function"&&e()},img:function(t,e){const n=t.image,r=function(s){!Et.isHeadless&&n.removeEventListener&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",o,!1)),typeof e=="function"&&e()},o=function(s){throw!Et.isHeadless&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",o,!1)),new Dt("unable to load "+t.src)};typeof n.width=="number"&&n.width>0&&typeof n.height=="number"&&n.height>0?r():!Et.isHeadless&&typeof n.addEventListener=="function"&&(n.addEventListener("load",r,!1),n.addEventListener("error",o,!1)),t._src=cn.getAbsoluteURL(t._src),!(!Et.isHeadless&&n&&n.getAttribute("two-src"))&&(Et.isHeadless||n.setAttribute("two-src",t.src),cn.ImageRegistry.add(t.src,n),Et.isHeadless?cn.loadHeadlessBuffer(t,r):t.image.src=t.src)},video:function(t,e){if(Et.isHeadless)throw new Dt("video textures are not implemented in headless environments.");const n=function(o){t.image.removeEventListener("canplaythrough",n,!1),t.image.removeEventListener("error",r,!1),t.image.width=t.image.videoWidth,t.image.height=t.image.videoHeight,typeof e=="function"&&e()},r=function(o){throw t.image.removeEventListener("canplaythrough",n,!1),t.image.removeEventListener("error",r,!1),new Dt("unable to load "+t.src)};t._src=cn.getAbsoluteURL(t._src),t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),cn.ImageRegistry.add(t.src,t.image)),t.image.readyState>=4?n():(t.image.addEventListener("canplaythrough",n,!1),t.image.addEventListener("error",r,!1),t.image.src=t.src,t.image.load())}});var Oe=cn,nc={src:{enumerable:!0,get:function(){return this._src},set:function(t){this._src=t,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(t){this._loaded=t,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(t){this._repeat=t,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(t){const e=Oe.getTag(t);let n;switch(e){case"canvas":n="#"+t.id;break;default:n=t.src}Oe.ImageRegistry.contains(n)?this._image=Oe.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(ee.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(ee.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof re&&this._scale.unbind(ee.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof re&&this._scale.bind(ee.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function vg(){this._flagOffset=!0}function Cg(){this._flagScale=!0}var Cs=class bn extends Gi{constructor(e,n,r){super(),B(this,"_flagOffset",!0),B(this,"_flagOpacity",!0),B(this,"_flagColor",!0),B(this,"_offset",0),B(this,"_opacity",1),B(this,"_color","#fff");for(let o in ic)Object.defineProperty(this,o,ic[o]);this._renderer.type="stop",this.offset=typeof e=="number"?e:bn.Index<=0?0:1,this.opacity=typeof r=="number"?r:1,this.color=typeof n=="string"?n:bn.Index<=0?"#fff":"#000",bn.Index=(bn.Index+1)%2}static fromObject(e){const n=new bn().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<bn.Properties.length;n++){const r=bn.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new bn;return oe.each(bn.Properties,function(r){n[r]=this[r]},this),e&&e.stops&&e.stops.push(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="stop",oe.each(bn.Properties,n=>{e[n]=this[n]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};B(Cs,"Index",0),B(Cs,"Properties",["offset","opacity","color"]);var ri=Cs,ic={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Ss=class Di extends Gi{constructor(e){super(),B(this,"_flagStops",!1),B(this,"_flagSpread",!1),B(this,"_flagUnits",!1),B(this,"_spread",""),B(this,"_units","");for(let n in rc)Object.defineProperty(this,n,rc[n]);this._renderer.type="gradient",this._renderer.flagStops=Sg.bind(this),this._renderer.bindStops=Bg.bind(this),this._renderer.unbindStops=Tg.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static fromObject(e){let n=e.stops;n&&n.length>0&&(n=n.map(o=>o instanceof ri?o:new ri().copy(o)));const r=new Di(n).copy(e);return"id"in e&&(r.id=e.id),r}clone(e){const n=this.stops.map(o=>o.clone()),r=new Di(n);return oe.each(Di.Properties,o=>{r[o]=this[o]},this),e&&e.add(r),r}copy(e){super.copy.call(this,e);for(let n=0;n<Di.Properties.length;n++){const r=Di.Properties[n];r in e&&(this[r]=e[r])}return this}toObject(){const e={stops:this.stops.map(n=>n.toObject())};return oe.each(Di.Properties,n=>{e[n]=this[n]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};B(Ss,"Stop",ri),B(Ss,"Properties",["spread","stops","units"]);var dt=Ss,rc={spread:{enumerable:!0,get:function(){return this._spread},set:function(t){this._spread=t,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(t){this._units=t,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(t){const e=this._renderer.bindStops,n=this._renderer.unbindStops;this._stops&&this._stops.unbind(ee.Types.insert,e).unbind(ee.Types.remove,n),this._stops=new ii((t||[]).slice(0)),this._stops.bind(ee.Types.insert,e).bind(ee.Types.remove,n),e(this._stops)}}};function Sg(){this._flagStops=!0}function Bg(t){let e=t.length;for(;e--;)t[e].bind(ee.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function Tg(t){let e=t.length;for(;e--;)t[e].unbind(ee.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}var Bs=class Kr extends dt{constructor(e,n,r,o,s){super(s),B(this,"_flagEndPoints",!1),B(this,"_left",null),B(this,"_right",null);for(let a in oc)Object.defineProperty(this,a,oc[a]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Ng.bind(this),this.left=new re,this.right=new re,typeof e=="number"&&(this.left.x=e),typeof n=="number"&&(this.left.y=n),typeof r=="number"&&(this.right.x=r),typeof o=="number"&&(this.right.y=o)}static fromObject(e){const n=new Kr().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Kr.Properties.length;n++){const r=Kr.Properties[n];r in e&&(this[r]=e[r]instanceof re?e[r]:new re().copy(e[r]))}return this}clone(e){const n=this.stops.map(function(o){return o.clone()}),r=new Kr(this.left._x,this.left._y,this.right._x,this.right._y,n);return oe.each(dt.Properties,function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return e.left=this.left.toObject(),e.right=this.right.toObject(),e}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};B(Bs,"Stop",ri),B(Bs,"Properties",["left","right"]);var Ke=Bs,oc={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof re&&this._left.unbind(ee.Types.change,this._renderer.flagEndPoints),this._left=t,this._left.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(t){this._right instanceof re&&this._right.unbind(ee.Types.change,this._renderer.flagEndPoints),this._right=t,this._right.bind(ee.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function Ng(){this._flagEndPoints=!0}var Ts=class Li extends dt{constructor(e,n,r,o,s,a){super(o),B(this,"_flagRadius",!1),B(this,"_flagCenter",!1),B(this,"_flagFocal",!1),B(this,"_radius",0),B(this,"_center",null),B(this,"_focal",null);for(let l in sc)Object.defineProperty(this,l,sc[l]);this._renderer.type="radial-gradient",this._renderer.flagCenter=$g.bind(this),this._renderer.flagFocal=Rg.bind(this),this.center=new re,this.radius=typeof r=="number"?r:1,this.focal=new re,typeof e=="number"&&(this.center.x=e),typeof n=="number"&&(this.center.y=n),this.focal.copy(this.center),typeof s=="number"&&(this.focal.x=s),typeof a=="number"&&(this.focal.y=a)}static fromObject(e){const n=new Li().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Li.Properties.length;n++){const r=Li.Properties[n];r in e&&(/(center|focal)i/.test(r)?this[r]=e[r]instanceof re?e[r]:new re().copy(e[r]):typeof e[r]=="number"&&(this[r]=e[MediaKeySystemAccess]))}return this}clone(e){const n=this.stops.map(function(o){return o.clone()}),r=new Li(this.center._x,this.center._y,this._radius,n,this.focal._x,this.focal._y);return oe.each(dt.Properties.concat(Li.Properties),function(o){r[o]=this[o]},this),e&&e.add(r),r}toObject(){const e=super.toObject.call(this);return oe.each(Li.Properties,function(n){e[n]=this[n]},this),e.center=this.center.toObject(),e.focal=this.focal.toObject(),e}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(ee.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};B(Ts,"Stop",ri),B(Ts,"Properties",["center","radius","focal"]);var Ge=Ts,sc={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(t){this._center&&this._center.unbind(ee.Types.change,this._renderer.flagCenter),this._center=t,this._center.bind(ee.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(t){this._focal&&this._focal.unbind(ee.Types.change,this._renderer.flagFocal),this._focal=t,this._focal.bind(ee.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function $g(){this._flagCenter=!0}function Rg(){this._flagFocal=!0}function ac(t,e){if(e===0||e===1)return!0;const r=t._length*e;let o=0;for(let s=0;s<t._lengths.length;s++){const a=t._lengths[s];if(o>=r)return r-o>=0;o+=a}return!1}function so(t,e){const n=t._length;if(e<=0)return 0;if(e>=n)return t._lengths.length-1;for(let r=0,o=0;r<t._lengths.length;r++){if(o+t._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/t._lengths[r];o+=t._lengths[r]}return-1}function lc(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,f=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(f||t).x,d=(f||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),f&&t._relative&&(s+=t.x,d+=t.y),Yl(r,l,o,c,s,d,a,u,n)}function Ns(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,f=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(f||t).x,d=(f||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),f&&t._relative&&(s+=t.x,d+=t.y),xs(r,l,o,c,s,d,a,u,n)}function _i(t){switch(t.renderer.type){case"texture":return Oe.fromObject(t);case"gradient":return dt.fromObject(t);case"linear-gradient":return Ke.fromObject(t);case"radial-gradient":return Ge.fromObject(t)}return t}var Eg=Math.cos,Pg=Math.sin,cc=Math.tan,$s=[],dc=class Jt extends ee{constructor(e,n,r,o,s,a){super(),B(this,"elements",new _n(9)),B(this,"manual",!1);let l=e;Array.isArray(l)||(l=Array.prototype.slice.call(arguments)),this.identity(),l.length>0&&this.set(l)}static Multiply(e,n,r){if(n.length<=3){const N=e;let w,S,v;const $=n[0]||0,E=n[1]||0,A=n[2]||0;return w=N[0]*$+N[1]*E+N[2]*A,S=N[3]*$+N[4]*E+N[5]*A,v=N[6]*$+N[7]*E+N[8]*A,[w,S,v]}const o=e[0],s=e[1],a=e[2],l=e[3],c=e[4],d=e[5],u=e[6],h=e[7],f=e[8],m=n[0],p=n[1],g=n[2],y=n[3],b=n[4],_=n[5],k=n[6],x=n[7],C=n[8];return r=r||new _n(9),r[0]=o*m+s*y+a*k,r[1]=o*p+s*b+a*x,r[2]=o*g+s*_+a*C,r[3]=l*m+c*y+d*k,r[4]=l*p+c*b+d*x,r[5]=l*g+c*_+d*C,r[6]=u*m+h*y+f*k,r[7]=u*p+h*b+f*x,r[8]=u*g+h*_+f*C,r}static fromObject(e){return new Jt().copy(e)}set(e,n,r,o,s,a,l,c,d){if(typeof n>"u"){const u=e;e=u[0],n=u[1],r=u[2],o=u[3],s=u[4],a=u[5],l=u[6],c=u[7],d=u[8]}return this.elements[0]=e,this.elements[1]=n,this.elements[2]=r,this.elements[3]=o,this.elements[4]=s,this.elements[5]=a,this.elements[6]=l,this.elements[7]=c,this.elements[8]=d,this.trigger(ee.Types.change)}copy(e){return this.elements[0]=e.elements[0],this.elements[1]=e.elements[1],this.elements[2]=e.elements[2],this.elements[3]=e.elements[3],this.elements[4]=e.elements[4],this.elements[5]=e.elements[5],this.elements[6]=e.elements[6],this.elements[7]=e.elements[7],this.elements[8]=e.elements[8],this.manual=e.manual,this.trigger(ee.Types.change)}identity(){return this.elements[0]=Jt.Identity[0],this.elements[1]=Jt.Identity[1],this.elements[2]=Jt.Identity[2],this.elements[3]=Jt.Identity[3],this.elements[4]=Jt.Identity[4],this.elements[5]=Jt.Identity[5],this.elements[6]=Jt.Identity[6],this.elements[7]=Jt.Identity[7],this.elements[8]=Jt.Identity[8],this.trigger(ee.Types.change)}multiply(e,n,r,o,s,a,l,c,d){if(typeof n>"u")return this.elements[0]*=e,this.elements[1]*=e,this.elements[2]*=e,this.elements[3]*=e,this.elements[4]*=e,this.elements[5]*=e,this.elements[6]*=e,this.elements[7]*=e,this.elements[8]*=e,this.trigger(ee.Types.change);if(typeof r>"u"&&(r=1),typeof o>"u"){e=e||0,n=n||0,r=r||0,s=this.elements;const F=s[0]*e+s[1]*n+s[2]*r,H=s[3]*e+s[4]*n+s[5]*r,Q=s[6]*e+s[7]*n+s[8]*r;return[F,H,Q]}const u=this.elements,h=[e,n,r,o,s,a,l,c,d],f=u[0],m=u[1],p=u[2],g=u[3],y=u[4],b=u[5],_=u[6],k=u[7],x=u[8],C=h[0],N=h[1],w=h[2],S=h[3],v=h[4],$=h[5],E=h[6],A=h[7],R=h[8];return this.elements[0]=f*C+m*S+p*E,this.elements[1]=f*N+m*v+p*A,this.elements[2]=f*w+m*$+p*R,this.elements[3]=g*C+y*S+b*E,this.elements[4]=g*N+y*v+b*A,this.elements[5]=g*w+y*$+b*R,this.elements[6]=_*C+k*S+x*E,this.elements[7]=_*N+k*v+x*A,this.elements[8]=_*w+k*$+x*R,this.trigger(ee.Types.change)}inverse(e){const n=this.elements;e=e||new Jt;const r=n[0],o=n[1],s=n[2],a=n[3],l=n[4],c=n[5],d=n[6],u=n[7],h=n[8],f=h*l-c*u,m=-h*a+c*d,p=u*a-l*d;let g=r*f+o*m+s*p;return g?(g=1/g,e.elements[0]=f*g,e.elements[1]=(-h*o+s*u)*g,e.elements[2]=(c*o-s*l)*g,e.elements[3]=m*g,e.elements[4]=(h*r-s*d)*g,e.elements[5]=(-c*r+s*a)*g,e.elements[6]=p*g,e.elements[7]=(-u*r+o*d)*g,e.elements[8]=(l*r-o*a)*g,e):null}scale(e,n){return arguments.length<=1&&(n=e),this.multiply(e,0,0,0,n,0,0,0,1)}rotate(e){const n=Eg(e),r=Pg(e);return this.multiply(n,-r,0,r,n,0,0,0,1)}translate(e,n){return this.multiply(1,0,e,0,1,n,0,0,1)}skewX(e){const n=cc(e);return this.multiply(1,n,0,0,1,0,0,0,1)}skewY(e){const n=cc(e);return this.multiply(1,0,0,n,1,0,0,0,1)}toString(e){return $s.length=0,this.toTransformArray(e,$s),$s.map(Ie).join(" ")}toTransformArray(e,n){const r=this.elements,o=!!n,s=r[0],a=r[1],l=r[2],c=r[3],d=r[4],u=r[5];if(e){const h=r[6],f=r[7],m=r[8];if(o){n[0]=s,n[1]=c,n[2]=h,n[3]=a,n[4]=d,n[5]=f,n[6]=l,n[7]=u,n[8]=m;return}return[s,c,h,a,d,f,l,u,m]}if(o){n[0]=s,n[1]=c,n[2]=a,n[3]=d,n[4]=l,n[5]=u;return}return[s,c,a,d,l,u]}toArray(e,n){const r=this.elements,o=!!n,s=r[0],a=r[1],l=r[2],c=r[3],d=r[4],u=r[5];if(e){const h=r[6],f=r[7],m=r[8];if(o){n[0]=s,n[1]=a,n[2]=l,n[3]=c,n[4]=d,n[5]=u,n[6]=h,n[7]=f,n[8]=m;return}return[s,a,l,c,d,u,h,f,m]}if(o){n[0]=s,n[1]=a,n[2]=l,n[3]=c,n[4]=d,n[5]=u;return}return[s,a,l,c,d,u]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Jt().copy(this)}};B(dc,"Identity",[1,0,0,0,1,0,0,0,1]);var wi=dc;Wl(wi);var uc=class bl extends Gi{constructor(){super(),B(this,"_flagMatrix",!0),B(this,"_flagScale",!1),B(this,"_matrix",null),B(this,"_worldMatrix",null),B(this,"_position",null),B(this,"_rotation",0),B(this,"_scale",1),B(this,"_skewX",0),B(this,"_skewY",0);for(let e in ao)Object.defineProperty(this,e,ao[e]);this._renderer.flagMatrix=fc.bind(this),this.isShape=!0,this.matrix=new wi,this.worldMatrix=new wi,this.position=new re,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const n=new bl().copy(e);return"id"in e&&(n.id=e.id),n}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return ao.position.get.apply(this,arguments)}set translation(e){ao.position.set.apply(this,arguments)}addTo(e){return e.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(e,n,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&"visible"in this&&this.visible===!1||!s&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const a=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const l=this.getBoundingClientRect();return l?e>=l.left-a&&e<=l.right+a&&n>=l.top-a&&n<=l.bottom+a:!1}copy(e){return super.copy.call(this,e),"position"in e&&(e.position instanceof re?this.position=e.position:this.position.copy(e.position)),"rotation"in e&&(this.rotation=e.rotation),"scale"in e&&(this.scale=typeof e.scale=="number"||e.scale instanceof re?e.scale:new re(e.scale.x,e.scale.y)),"skewX"in e&&(this.skewX=e.skewX),"skewY"in e&&(this.skewY=e.skewY),"matrix"in e&&e.matrix.manual&&(this.matrix.copy(e.matrix),this.matrix.manual=!0),this}clone(e){const n=new bl;return n.position.copy(this.position),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);return e.renderer={type:"shape"},e.isShape=!0,e.translation=this.translation.toObject(),e.rotation=this.translation.rotation,e.scale=this.scale instanceof re?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,e.matrix=this.matrix.toObject(),e}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(e){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof re?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),e&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};B(uc,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var On=uc,ao={position:{enumerable:!0,get:function(){return this._position},set:function(t){this._position&&this._position.unbind(ee.Types.change,this._renderer.flagMatrix),this._position=t,this._position.bind(ee.Types.change,this._renderer.flagMatrix),fc.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof re&&this._scale.unbind(ee.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof re&&this._scale.bind(ee.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(t){this._skewX=t,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(t){this._skewY=t,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(t){this._matrix=t,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return _s(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function fc(){this._flagMatrix=!0}var hc=/^(?:none|transparent)$/i,Fg=8,Rs=Number.EPSILON;function zn(t,e){return{x:t,y:e}}function lo(t,e,n=Rs){return Math.abs(t.x-e.x)<=n&&Math.abs(t.y-e.y)<=n}function mc(t,e,n,r){const o=t*n+e*r,s=Math.sqrt(t*t+e*e)*Math.sqrt(n*n+r*r)||1e-12;let a=Math.acos(Math.max(-1,Math.min(1,o/s)));return t*r-e*n<0&&(a=-a),a}function Vg(t,e,n){if(!t)return[zn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[zn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,a=e.largeArcFlag?1:0,l=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=t.x,d=t.y,u=e.x,h=e.y,f=(c-u)/2,m=(d-h)/2,p=Math.cos(s),g=Math.sin(s);let y=p*f+g*m,b=-g*f+p*m,_=r*r,k=o*o;const x=y*y/_+b*b/k;if(x>1){const P=Math.sqrt(x);r*=P,o*=P,_=r*r,k=o*o}const C=_*b*b+k*y*y,N=C===0?0:(_*k-C)/C;let w=Math.sqrt(Math.max(0,N));a===l&&(w=-w);const S=w*r*b/o,v=-w*o*y/r,$=p*S-g*v+(c+u)/2,E=g*S+p*v+(d+h)/2,A=mc(1,0,(y-S)/r,(b-v)/o),R=mc((y-S)/r,(b-v)/o,(-y-S)/r,(-b-v)/o)%tt,F=A+R,H=l===0,Q=(()=>{const P=F-A,V=Math.abs(P)<Number.EPSILON;let M=rt(P,tt);return M<Number.EPSILON&&(M=V?0:tt),H&&!V&&(M=M===tt?-tt:M-tt),M})(),Z=Math.max(xt.Resolution,Math.max(n*2,1)),O=[];for(let P=1;P<=Z;P++){const V=P/Z,M=A+V*Q;let L=$+r*Math.cos(M),Y=E+o*Math.sin(M);if(s!==0){const U=L-$,G=Y-E,q=Math.cos(s),W=Math.sin(s);L=U*q-G*W+$,Y=U*W+G*q+E}O.push(zn(L,Y))}return O}function Mg(t,e=Fg){const n=[],r=[],o=t._renderer&&t._renderer.vertices&&t._renderer.vertices.length>0?t._renderer.vertices:t.vertices;if(!o||o.length===0)return{polygons:n,segments:r};const s=Math.max(1,Math.floor(e));let a=null,l=null,c=null,d=null;const u=(f=!1)=>{if(a){if(f&&l&&c&&!lo(l,c)){const m=zn(l.x,l.y);r.push({a:c,b:m}),a.push(m),c=m}a.length>=3&&l&&c&&lo(l,c)&&n.push(a),a=null,l=null,c=null}},h=f=>{if(!c){c=f,a&&a.push(f);return}lo(c,f)||(r.push({a:c,b:f}),a&&a.push(f),c=f)};for(let f=0;f<o.length;f++){const m=o[f],p=m.command||(f===0?ie.move:ie.line);if(p===ie.move){u(!1);const g=zn(m.x,m.y);a=[g],l=g,c=g,d=m;continue}if(d||(d=o[Math.max(f-1,0)]),p===ie.line)h(zn(m.x,m.y));else if(p===ie.curve){const g=Ns(m,d,s);for(let y=1;y<g.length;y++){const b=g[y];h(zn(b.x,b.y))}h(zn(m.x,m.y))}else if(p===ie.arc){const g=Vg(d,m,s);for(let y=0;y<g.length;y++)h(g[y])}else if(p===ie.close){u(!0),d=m;continue}else h(zn(m.x,m.y));d=m}if(a){const f=!!t._closed||!!t.closed||l&&c&&!lo(l,c);u(f)}return{polygons:n,segments:r}}function Ag(t,e,n){let r=!1;for(let o=0;o<t.length;o++){const s=t[o];if(!s||s.length<3)continue;let a=s.length-1;for(let l=0;l<s.length;l++){const c=s[a],d=s[l];d.y>n!=c.y>n&&e<(c.x-d.x)*(n-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),a=l}}return r}function Ig(t,e,n,r){const o=r.x-n.x,s=r.y-n.y;if(Math.abs(o)<Rs&&Math.abs(s)<Rs){const f=t-n.x,m=e-n.y;return f*f+m*m}const a=((t-n.x)*o+(e-n.y)*s)/(o*o+s*s),l=Math.max(0,Math.min(1,a)),c=n.x+l*o,d=n.y+l*s,u=t-c,h=e-d;return u*u+h*h}function Og(t,e,n){if(!t||t.length===0)return 1/0;let r=1/0;for(let o=0;o<t.length;o++){const s=t[o],a=Ig(e,n,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function zg(t,e){if(typeof e=="boolean")return e;const n=t.fill;return!n&&n!==0?!1:typeof n=="string"?!hc.test(n):!0}function Dg(t,e){const n=typeof t.linewidth=="number"?t.linewidth:t._linewidth||0;if(typeof e=="boolean")return e&&n>0;if(!(n>0))return!1;const r=t.stroke;return!r&&r!==0?!1:typeof r=="string"?!hc.test(r):!0}function Lg(t,e,n,r=0){if(!t)return!1;const o=t.left-r,s=t.right+r,a=t.top-r,l=t.bottom+r;return e>=o&&e<=s&&n>=a&&n<=l}var co=Number.EPSILON;function uo(t){return typeof t.relative!="boolean"||!!t.relative}function dn(t,e,n,r){const o=t.controls;if(!(!o||!o[e])){if(Math.abs(n)<co&&Math.abs(r)<co){uo(t)?o[e].clear():o[e].set(t.x,t.y);return}uo(t)?o[e].set(n,r):o[e].set(t.x+n,t.y+r)}}function Lt(t,e){dn(t,e,0,0)}function Hg(t,e){const n=t.controls;return!n||!n[e]?{x:0,y:0}:uo(t)?{x:n[e].x,y:n[e].y}:{x:n[e].x-t.x,y:n[e].y-t.y}}function Zi(t,e){const n=Hg(t,e);return Math.abs(n.x)>co||Math.abs(n.y)>co}function fo(t){t.command===ie.move||t.command===ie.close||(t.command=Zi(t,"left")||Zi(t,"right")?ie.curve:ie.line)}function pc(t,e){typeof e.relative=="boolean"&&(t.relative=e.relative)}function Wg(t,e){return Zi(e,"right")||Zi(t,"left")||Zi(t,"right")||Zi(e,"left")||t.command===ie.curve||e.command===ie.curve}function Qi(t,e,n){return{x:Pt(t.x,e.x,n),y:Pt(t.y,e.y,n)}}function gc(t,e){const n=t.controls&&t.controls[e];return n?uo(t)?{x:t.x+n.x,y:t.y+n.y}:{x:n.x,y:n.y}:{x:t.x,y:t.y}}function jg(t,e,n){const r=t.controls&&t.controls.right,o=e.controls&&e.controls.left,s={x:t.x,y:t.y},a=r?gc(t,"right"):Sr({},s),l={x:e.x,y:e.y},c=o?gc(e,"left"):Sr({},l),d=Qi(s,a,n),u=Qi(a,c,n),h=Qi(c,l,n),f=Qi(d,u,n),m=Qi(u,h,n),p=Qi(f,m,n),g=new Ne(p.x,p.y);return pc(g,t),dn(g,"left",f.x-p.x,f.y-p.y),dn(g,"right",m.x-p.x,m.y-p.y),g.command=ie.curve,{anchor:g,startOut:d,endIn:h}}function qg(t,e,n,r,o,s){const a=t.length,l=n-e+1;let c=l-1,d=o?Math.min(l,4):1,u=d,h=d;if(r||(u=Math.min(1,e),h=Math.min(1,a-n-1)),c+=u+h,c<=1)return;const f=new Array(c+1);for(let w=0,S=e-u;w<=c;w+=1,S+=1){const v=rt(S,a);f[w]=t[v]}let m=f[0].x+2*f[1].x,p=f[0].y+2*f[1].y,g=2;const y=c-1,b=[m],_=[p],k=[g],x=new Array(c+1),C=new Array(c+1);for(let w=1;w<c;w+=1){const S=w<y,v=S||s?1:2,$=S?4:s?2:7,E=S?4:s?3:8,A=S?2:s?0:1,R=v/g;g=k[w]=$-R,m=b[w]=E*f[w].x+A*f[w+1].x-R*m,p=_[w]=E*f[w].y+A*f[w+1].y-R*p}x[y]=b[y]/k[y],C[y]=_[y]/k[y];for(let w=c-2;w>=0;w-=1)x[w]=(b[w]-x[w+1])/k[w],C[w]=(_[w]-C[w+1])/k[w];x[c]=(3*f[c].x-x[y])/2,C[c]=(3*f[c].y-C[y])/2;const N=c-h;for(let w=u,S=e;w<=N;w+=1,S+=1){const v=rt(S,a),$=t[v],E=x[w]-$.x,A=C[w]-$.y;o||w<N?dn($,"right",E,A):Lt($,"right"),o||w>u?dn($,"left",-E,-A):Lt($,"left"),fo($)}}function Xg(t,e,n,r,o,s){const a=e||t,l=t,c=n||t,d=re.distanceBetween(a,l),u=re.distanceBetween(l,c),h=r===void 0?.5:r,f=Math.pow(d,h),m=Math.pow(u,h),p=f*f,g=m*m;if(!o&&e){const y=2*g+3*m*f+p,b=3*m*(m+f);if(b!==0){const _=(g*a.x+y*l.x-p*c.x)/b-l.x,k=(g*a.y+y*l.y-p*c.y)/b-l.y;dn(t,"left",_,k)}else Lt(t,"left")}else Lt(t,"left");if(!s&&n){const y=2*p+3*f*m+g,b=3*f*(f+m);if(b!==0){const _=(p*c.x+y*l.x-g*a.x)/b-l.x,k=(p*c.y+y*l.y-g*a.y)/b-l.y;dn(t,"right",_,k)}else Lt(t,"right")}else Lt(t,"right");fo(t)}function Yg(t,e,n,r,o,s){if(!(e&&n)){e||Lt(t,"left"),n||Lt(t,"right"),fo(t);return}const a=e,l=t,c=n,d=re.distanceBetween(a,l),u=re.distanceBetween(l,c),h=d+u,f=r===void 0?.4:r,m={x:a.x-c.x,y:a.y-c.y};if(!o&&h!==0){const p=f*d/h;dn(t,"left",m.x*p,m.y*p)}else Lt(t,"left");if(!s&&h!==0){const p=f*d/h-f;dn(t,"right",m.x*p,m.y*p)}else Lt(t,"right");fo(t)}function Ug(t,e,n,r,o,s){const a=s.type,l=s.factor,c=t.length;for(let d=e;d<=n;d+=1){const u=rt(d,c),h=t[u];if(h.command===ie.move){Lt(h,"left"),Lt(h,"right");continue}const f=d===e&&!o?null:d-1,m=d===n&&!o?null:d+1,p=f===null?null:t[rt(f,c)],g=m===null?null:t[rt(m,c)],y=f===null,b=m===null;a==="geometric"?Yg(h,p,g,l,y,b):Xg(h,p,g,l,y,b)}}var Ji=Math.min,er=Math.max,Kg=Math.ceil,Gg=Math.floor,Zg=new re,Qg=new wi,Es=class pi extends On{constructor(e,n,r,o){super(),B(this,"_flagVertices",!0),B(this,"_flagLength",!0),B(this,"_flagFill",!0),B(this,"_flagStroke",!0),B(this,"_flagLinewidth",!0),B(this,"_flagOpacity",!0),B(this,"_flagVisible",!0),B(this,"_flagCap",!0),B(this,"_flagJoin",!0),B(this,"_flagMiter",!0),B(this,"_flagStrokeAttenuation",!0),B(this,"_flagMask",!1),B(this,"_flagClip",!1),B(this,"_length",0),B(this,"_fill","#fff"),B(this,"_stroke","#000"),B(this,"_linewidth",1),B(this,"_opacity",1),B(this,"_visible",!0),B(this,"_cap","round"),B(this,"_join","round"),B(this,"_miter",4),B(this,"_closed",!0),B(this,"_curved",!1),B(this,"_automatic",!0),B(this,"_beginning",0),B(this,"_ending",1),B(this,"_mask",null),B(this,"_clip",!1),B(this,"_dashes",null),B(this,"_strokeAttenuation",!0);for(let s in yc)Object.defineProperty(this,s,yc[s]);this._renderer.type="path",this._renderer.flagVertices=bc.bind(this),this._renderer.bindVertices=_c.bind(this),this._renderer.unbindVertices=wc.bind(this),this._renderer.flagFill=xc.bind(this),this._renderer.flagStroke=kc.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!n,this.curved=!!r,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=e,this.automatic=!o,this.dashes=[],this.dashes.offset=0}static fromObject(e){const n=typeof e.fill=="string"?e.fill:_i(e.fill),r=typeof e.stroke=="string"?e.stroke:_i(e.stroke),o=new pi().copy(bs(Sr({},e),{fill:n,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){if(super.copy.call(this,e),e.vertices){this.vertices=[];for(let n=0;n<e.vertices.length;n++){const r=e.vertices[n];r instanceof Ne?this.vertices.push(e.vertices[n].clone()):this.vertices.push(new Ne().copy(r))}}for(let n=0;n<pi.Properties.length;n++){const r=pi.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new pi;for(let r=0;r<this.vertices.length;r++)n.vertices.push(this.vertices[r].clone());for(let r=0;r<pi.Properties.length;r++){const o=pi.Properties[r];n[o]=this[o]}return n.className=this.className,n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="path",e.vertices=this.vertices.map(n=>n.toObject()),oe.each(pi.Properties,n=>{typeof this[n]<"u"&&(this[n].toObject?e[n]=this[n].toObject():e[n]=this[n])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const n=this.vertices[e];typeof n.unbind=="function"&&n.unbind(),n.controls&&(n.controls.left&&typeof n.controls.left.unbind=="function"&&n.controls.left.unbind(),n.controls.right&&typeof n.controls.right.unbind=="function"&&n.controls.right.unbind())}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const e=this.getBoundingClientRect(!0),n=e.width/2,r=e.height/2,o=e.left+e.width/2,s=e.top+e.height/2;for(let a=0;a<this.vertices.length;a++){const l=this.vertices[a];l.x-=o,l.y-=s,l.x+=n,l.y+=r}return this.mask&&(this.mask.translation.x-=o,this.mask.translation.x+=n,this.mask.translation.y-=s,this.mask.translation.y+=r),this}center(){const e=this.getBoundingClientRect(!0),n=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o];s.x-=n,s.y-=r}return this.mask&&(this.mask.translation.x-=n,this.mask.translation.y-=r),this}getBoundingClientRect(e){let n,r,o,s,a,l,c=1/0,d=-1/0,u=1/0,h=-1/0;if(this._update(!0),n=e?this.matrix:this.worldMatrix,r=(this.linewidth||0)/2,o=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:f,scaleY:m}=bi(n.elements[0],n.elements[3],n.elements[1],n.elements[4],n.elements[2],n.elements[5]);typeof f=="number"&&typeof m=="number"&&(r=Math.max(f,m)*(this.linewidth||0)/2)}else r*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(o<=0)return{width:0,height:0};for(s=0;s<o;s++){l=this._renderer.vertices[s],a=this._renderer.vertices[(s+o-1)%o];const[f,m]=n.multiply(a.x,a.y),[p,g]=n.multiply(l.x,l.y);if(a.controls&&l.controls){let y=a.controls.right.x,b=a.controls.right.y;a.relative&&(y+=a.x,b+=a.y);let[_,k]=n.multiply(y,b),x=l.controls.left.x,C=l.controls.left.y;l.relative&&(x+=l.x,C+=l.y);let[N,w]=n.multiply(x,C);const S=Ul(f,m,_,k,N,w,p,g);u=Ji(S.min.y-r,u),c=Ji(S.min.x-r,c),d=er(S.max.x+r,d),h=er(S.max.y+r,h)}else s<=1&&(u=Ji(m-r,u),c=Ji(f-r,c),d=er(f+r,d),h=er(m+r,h)),u=Ji(g-r,u),c=Ji(p-r,c),d=er(p+r,d),h=er(g+r,h)}return{top:u,left:c,right:d,bottom:h,width:d-c,height:h-u}}contains(e,n,r){const o=r||{},s=o.ignoreVisibility===!0;if(!s&&this.visible===!1||!s&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const a=typeof o.tolerance=="number"?o.tolerance:0;this._update(!0);const l=this.getBoundingClientRect();if(!l||e<l.left-a||e>l.right+a||n<l.top-a||n>l.bottom+a)return!1;const c=this.worldMatrix,d=c&&c.inverse(Qg);if(!d)return super.contains(e,n,o);const[u,h]=d.multiply(e,n,1),f=typeof o.precision=="number"&&!Number.isNaN(o.precision)?Math.max(1,Math.floor(o.precision)):8,m=zg(this,o.fill),p=Dg(this,o.stroke),{polygons:g,segments:y}=Mg(this,f);if(m&&g.length>0&&Ag(g,u,h))return!0;if(p&&y.length>0){const b=typeof this.linewidth=="number"?this.linewidth:0;if(b>0&&Og(y,u,h)<=b/2+a)return!0}return!m&&!p?super.contains(e,n,o):m&&g.length===0?super.contains(e,n,o):!1}getPointAt(e,n){let r,o,s,a,l,c,d,u,h,f,m,p,g,y,b,_=this.length*Math.min(Math.max(e,0),1);const k=this.vertices.length,x=k-1;let C=null,N=null;for(let Z=0,O=this._lengths.length,P=0;Z<O;Z++){if(P+this._lengths[Z]>=_){this._closed?(r=rt(Z,k),o=rt(Z-1,k),Z===0&&(r=o,o=Z)):(r=Z,o=Math.min(Math.max(Z-1,0),x)),C=this.vertices[r],N=this.vertices[o],_-=P,this._lengths[Z]!==0?e=_/this._lengths[Z]:e=0;break}P+=this._lengths[Z]}if(C===null||N===null)return null;if(C){if(!N)return C}else return N;b=N.controls&&N.controls.right,y=C.controls&&C.controls.left,l=N.x,f=N.y,c=(b||N).x,m=(b||N).y,d=(y||C).x,p=(y||C).y,u=C.x,g=C.y,b&&N.relative&&(c+=N.x,m+=N.y),y&&C.relative&&(d+=C.x,p+=C.y),a=Br(e,l,c,d,u),h=Br(e,f,m,p,g);const w=Pt(l,c,e),S=Pt(f,m,e),v=Pt(c,d,e),$=Pt(m,p,e),E=Pt(d,u,e),A=Pt(p,g,e),R=Pt(w,v,e),F=Pt(S,$,e),H=Pt(v,E,e),Q=Pt($,A,e);return oe.isObject(n)?(n.x=a,n.y=h,n instanceof Ne&&(n.controls.left.x=R,n.controls.left.y=F,n.controls.right.x=H,n.controls.right.y=Q,(typeof n.relative!="boolean"||n.relative)&&(n.controls.left.x-=a,n.controls.left.y-=h,n.controls.right.x-=a,n.controls.right.y-=h)),n.t=e,n):(s=new Ne(a,h,R-a,F-h,H-a,Q-h,this._curved?ie.curve:ie.line),s.t=e,s)}plot(){if(this.curved)return Gl(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?ie.move:ie.line;return this}smooth(e){const n=e||{},r=n.type||"continuous",o=this._collection,s=o.length;if(s<2)return this;const a=this._closed||s>0&&o[s-1]&&o[s-1].command===ie.close,l=(f,m)=>{if(f==null)return m;if(typeof f=="number"){if(a)return rt(f,s);let g=f;return g<0&&(g+=s),Math.min(Math.max(g,0),s-1)}const p=o.indexOf(f);return p!==-1?p:m},c=a&&n.from===void 0&&n.to===void 0;let d=l(n.from,0),u=l(n.to,s-1);if(d>u)if(a)d-=s;else{const f=d;d=u,u=f}const h=u-d+1;for(let f=0;f<h;f+=1){const m=rt(d+f,s),p=o[m],g=!a&&m===0;p.command===ie.move&&!g&&(p.command=ie.line)}if(r==="continuous"||r==="asymmetric")qg(o,d,u,a,c,r==="asymmetric");else if(r==="catmull-rom"||r==="geometric"){const f={type:r,factor:n.factor};Ug(o,d,u,a,c,f)}else throw new Error(`Path.smooth does not support type "${r}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(e){this._update();const n=this.vertices,r=n.length;if(r<2)return this;const o=[];let s=null,a=null;for(let l=0;l<r;l+=1){const c=n[l];if(!s||c.command===ie.move){const u=c.clone();o.push(u),s=c,a=c;continue}if(Wg(c,s)){const h=Ns(c,s,e).length,f=o[o.length-1];let m=f.clone(),p=c.clone(),g=f,y=0;if(h<=1){const b=c.clone();o.push(b)}else{for(let _=1;_<h;_+=1){const k=_/h,x=1-y,C=x<=Number.EPSILON?k:(k-y)/x,N=jg(m,p,C);dn(g,"right",N.startOut.x-g.x,N.startOut.y-g.y);const w=N.anchor;o.push(w),g=w,m=w.clone(),y=k,dn(p,"left",N.endIn.x-p.x,N.endIn.y-p.y)}const b=c.clone();b.controls.left.copy(p.controls.left),o.push(b)}}else{const u=Ns(c,s,e);for(let f=1;f<u.length;f+=1){const m=u[f];pc(m,s),Lt(m,"left"),Lt(m,"right"),m.command=ie.line,o.push(m)}const h=c.clone();o.push(h)}s=c,c.command===ie.close&&(s=a)}return this._automatic=!1,this._curved=!1,this.vertices=o,this}_updateLength(e,n){n||this._update();const o=this.vertices.length-1;let s=this.vertices[o],a=0;return typeof this._lengths>"u"&&(this._lengths=[]),oe.each(this.vertices,function(l,c){if(c<=0||l.command===ie.move){s=l,this._lengths[c]=0;return}this._lengths[c]=lc(l,s,e),a+=this._lengths[c],s=l},this),this._length=a,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const e=this._collection.length,n=this._closed,r=Math.min(this._beginning,this._ending),o=Math.max(this._beginning,this._ending),s=so(this,r*this._length),a=so(this,o*this._length),l=Kg(s),c=Gg(a);let d,u,h,f,m,p;for(this._renderer.vertices.length=0,p=0;p<e;p++)this._renderer.collection.length<=p&&this._renderer.collection.push(new Ne),p>c&&!u?(m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(o,m),m.command=this._renderer.collection[p].command,this._renderer.vertices.push(m),u=m,h=this._collection[p-1],h&&h.controls&&(m.relative?m.controls.right.clear():m.controls.right.copy(m),h.relative?this._renderer.collection[p-1].controls.right.copy(h.controls.right).lerp(re.zero,1-m.t):this._renderer.collection[p-1].controls.right.copy(h.controls.right).lerp(h,1-m.t))):p>=l&&p<=c&&(m=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(m),p===c&&ac(this,o)?(u=m,!n&&u.controls&&(u.relative?u.controls.right.clear():u.controls.right.copy(u))):p===l&&ac(this,r)&&(d=m,d.command=ie.move,!n&&d.controls&&(d.relative?d.controls.left.clear():d.controls.left.copy(d))));l>0&&!d&&(p=l-1,m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(r,m),m.command=ie.move,this._renderer.vertices.unshift(m),f=this._collection[p+1],f&&f.controls&&(m.controls.left.clear(),f.relative?this._renderer.collection[p+1].controls.left.copy(f.controls.left).lerp(re.zero,m.t):(Zg.copy(f),this._renderer.collection[p+1].controls.left.copy(f.controls.left).lerp(f,m.t))))}return On.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,On.prototype.flagReset.call(this),this}};B(Es,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),B(Es,"Utils",{getCurveLength:lc});var Re=Es,yc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof dt||this._fill instanceof Ke||this._fill instanceof Ge||this._fill instanceof Oe)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof dt||this._fill instanceof Ke||this._fill instanceof Ge||this._fill instanceof Oe)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof dt||this._stroke instanceof Ke||this._stroke instanceof Ge||this._stroke instanceof Oe)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof dt||this._stroke instanceof Ke||this._stroke instanceof Ge||this._stroke instanceof Oe)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=!!t,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t===this._automatic)return;this._automatic=!!t;const e=this._automatic?"ignore":"listen";oe.each(this.vertices,function(n){n[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,n),t instanceof ii?this._collection=t:this._collection=new ii(t||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,n),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,oe.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function bc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function _c(t){let e=t.length;for(;e--;)t[e].bind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function wc(t){let e=t.length;for(;e--;)t[e].unbind(ee.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function xc(){this._flagFill=!0}function kc(){this._flagStroke=!0}var vc=class Gr extends Re{constructor(e,n,r,o){const s=[new Ne,new Ne,new Ne,new Ne];super(s,!0,!1,!0),B(this,"_flagWidth",!1),B(this,"_flagHeight",!1),B(this,"_width",0),B(this,"_height",0),B(this,"_origin",null),this._renderer.type="rectangle";for(let a in Cc)Object.defineProperty(this,a,Cc[a]);this.width=typeof r=="number"?r:1,this.height=typeof o=="number"?o:1,this.origin=new re,typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n),this._update()}static fromObject(e){const n=new Gr().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Gr.Properties.length;n++){const r=Gr.Properties[n];r in e&&(typeof e[r]=="number"?this[r]=e[r]:this[r]instanceof re&&this[r].copy(e[r]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const e=this._width/2,n=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Ne),this.vertices[0].set(-e,-n).sub(this._origin).command=ie.move,this.vertices[1].set(e,-n).sub(this._origin).command=ie.line,this.vertices[2].set(e,n).sub(this._origin).command=ie.line,this.vertices[3].set(-e,n).sub(this._origin).command=ie.line,this.vertices[4]&&(this.vertices[4].set(-e,-n).sub(this._origin).command=ie.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const n=new Gr(0,0,this.width,this.height);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix);for(let r=0;r<Re.Properties.length;r++){const o=Re.Properties[r];n[o]instanceof re?n[o].copy(this[o]):n[o]=this[o]}return e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="rectangle",e.width=this.width,e.height=this.height,e.origin=this.origin.toObject(),e}};B(vc,"Properties",["width","height","origin"]);var oi=vc,Cc={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(t){this._origin&&this._origin.unbind(ee.Types.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(ee.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Sc=class Zr extends oi{constructor(e,n,r,o,s,a){super(n,r,0,0),B(this,"_flagTexture",!1),B(this,"_flagColumns",!1),B(this,"_flagRows",!1),B(this,"_flagFrameRate",!1),B(this,"_flagIndex",!1),B(this,"_amount",1),B(this,"_duration",0),B(this,"_startTime",0),B(this,"_playing",!1),B(this,"_firstFrame",0),B(this,"_lastFrame",0),B(this,"_loop",!0),B(this,"_texture",null),B(this,"_columns",1),B(this,"_rows",1),B(this,"_frameRate",0),B(this,"_index",0),B(this,"_origin",null),this._renderer.type="sprite";for(let l in Bc)Object.defineProperty(this,l,Bc[l]);this.noStroke(),this.noFill(),e instanceof Oe?this.texture=e:typeof e=="string"&&(this.texture=new Oe(e)),this.origin=new re,this._update(),typeof o=="number"&&(this.columns=o),typeof s=="number"&&(this.rows=s),typeof a=="number"&&(this.frameRate=a),this.index=0}static fromObject(e){const n=new Zr().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Zr.Properties.length;n++){const r=Zr.Properties[n];r in e&&(this[r]=e[r])}return this}play(e,n,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=oe.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof n=="number"&&(this._lastFrame=n),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(e){const n=new Zr(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&n.play(this._firstFrame,this._lastFrame),n.loop=this.loop,n.firstFrame=this.firstFrame,n.lastFrame=this.lastFrame,e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="sprite",e.texture=this.texture.toObject(),e.columns=this.columns,e.rows=this.rows,e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture,n=this._columns,r=this._rows;let o,s,a,l,c,d,u,h,f;if(e&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=e),e.loaded)){u=e.image.width,h=e.image.height,o=u/n,s=h/r,l=this._amount,this.width!==o&&(this.width=o),this.height!==s&&(this.height=s),this._playing&&this._frameRate>0&&(oe.isNaN(this._lastFrame)&&(this._lastFrame=l-1),a=oe.performance.now()-this._startTime,f=this._lastFrame+1,c=1e3*(f-this._firstFrame)/this._frameRate,this._loop?a=a%c:a=Math.min(a,c),d=Pt(this._firstFrame,f,a/c),d=Math.floor(d),d!==this._index&&(this._index=d,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const m=this._index%n,p=Math.floor(this._index/n),g=-o*m+(u-o)/2,y=-s*p+(h-s)/2;g!==e.offset.x&&(e.offset.x=g),y!==e.offset.y&&(e.offset.y=y)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};B(Sc,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var ho=Sc,Bc={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(t){this._columns=t,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(t){this._rows=t,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}},Ps,Tc=class extends ii{constructor(e){e=Array.isArray(e)?e:Array.prototype.slice.call(arguments),super(e),zl(this,Ps,{}),this.attach(e),this.on(ee.Types.insert,this.attach),this.on(ee.Types.remove,this.detach)}get ids(){return zt(this,Ps)}attach(e){for(let n=0;n<e.length;n++){const r=e[n];r&&r.id&&(this.ids[r.id]=r)}return this}detach(e){for(let n=0;n<e.length;n++)delete this.ids[e[n].id];return this}};Ps=new WeakMap;var Nc=class Hi extends Re{constructor(e,n,r,o,s,a,l){const c=l||xt.Resolution*3,d=[];for(let u=0;u<c;u++)d.push(new Ne);super(d,!0,!1,!0),B(this,"_flagStartAngle",!1),B(this,"_flagEndAngle",!1),B(this,"_flagInnerRadius",!1),B(this,"_flagOuterRadius",!1),B(this,"_startAngle",0),B(this,"_endAngle",tt),B(this,"_innerRadius",0),B(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let u in $c)Object.defineProperty(this,u,$c[u]);typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.startAngle=s),typeof a=="number"&&(this.endAngle=a),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Hi().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Hi.Properties.length;n++){const r=Hi.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const e=this._startAngle,n=this._endAngle,r=this._innerRadius,o=this._outerRadius,s=rt(e,tt)===rt(n,tt),a=r>0,l=this.vertices;let c=a?l.length/2:l.length,d,u=0,h,f,m,p,g,y,b,_,k;for(s?c--:a||(c-=2),h=0,f=c-1;h<c;h++){switch(m=h/f,p=l[u],g=m*(n-e)+e,y=(n-e)/c,b=o*Math.cos(g),_=o*Math.sin(g),h){case 0:d=ie.move;break;default:d=ie.curve}p.command=d,p.x=b,p.y=_,p.controls.left.clear(),p.controls.right.clear(),p.command===ie.curve&&(k=o*y/Math.PI,p.controls.left.x=k*Math.cos(g-ct),p.controls.left.y=k*Math.sin(g-ct),p.controls.right.x=k*Math.cos(g+ct),p.controls.right.y=k*Math.sin(g+ct),h===1&&p.controls.left.multiplyScalar(2),h===f&&p.controls.right.multiplyScalar(2)),u++}if(a){for(s?(l[u].command=ie.close,u++):(c--,f=c-1),h=0;h<c;h++)m=h/f,p=l[u],g=(1-m)*(n-e)+e,y=(n-e)/c,b=r*Math.cos(g),_=r*Math.sin(g),d=ie.curve,h<=0&&(d=s?ie.move:ie.line),p.command=d,p.x=b,p.y=_,p.controls.left.clear(),p.controls.right.clear(),p.command===ie.curve&&(k=r*y/Math.PI,p.controls.left.x=k*Math.cos(g+ct),p.controls.left.y=k*Math.sin(g+ct),p.controls.right.x=k*Math.cos(g-ct),p.controls.right.y=k*Math.sin(g-ct),h===1&&p.controls.left.multiplyScalar(2),h===f&&p.controls.right.multiplyScalar(2)),u++;l[u].copy(l[0]),l[u].command=ie.line}else s||(l[u].command=ie.line,l[u].x=0,l[u].y=0,u++,l[u].copy(l[0]),l[u].command=ie.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(e){const n=this.innerRadius,r=this.outerRadius,o=this.startAngle,s=this.endAngle,a=this.vertices.length,l=new Hi(0,0,n,r,o,s,a);l.translation.copy(this.translation),l.rotation=this.rotation,l.scale=this.scale,l.skewX=this.skewX,l.skewY=this.skewY,this.matrix.manual&&l.matrix.copy(this.matrix);for(let c=0;c<Re.Properties.length;c++){const d=Re.Properties[c];l[d]=this[d]}return e&&e.add(l),l}toObject(){const e=super.toObject.call(this);e.renderer.type="arc-segment";for(let n=0;n<Hi.Properties.length;n++){const r=Hi.Properties[n];e[r]=this[r]}return e}};B(Nc,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var Fs=Nc,$c={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(t){this._startAngle=t,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(t){this._endAngle=t,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}}},Vs=Math.cos,Ms=Math.sin,Rc=class Wi extends Re{constructor(e,n,r,o){const s=o?Math.max(o,2):4,a=[];for(let l=0;l<s;l++)a.push(new Ne(0,0,0,0,0,0));super(a,!0,!0,!0),B(this,"_flagRadius",!1),B(this,"_radius",0),this._renderer.type="circle";for(let l in Ec)Object.defineProperty(this,l,Ec[l]);typeof r=="number"&&(this.radius=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Wi().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Wi.Properties.length;n++){const r=Wi.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagRadius){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const n=4/3*Math.tan(Math.PI/(e*2)),r=this._radius,o=r*n;for(let s=0;s<this.vertices.length;s++){const l=s/e*tt,c=r*Vs(l),d=r*Ms(l),u=o*Vs(l-ct),h=o*Ms(l-ct),f=o*Vs(l+ct),m=o*Ms(l+ct),p=this.vertices[s];p.command=s===0?ie.move:ie.curve,p.set(c,d),p.controls.left.set(u,h),p.controls.right.set(f,m)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const n=new Wi(0,0,this.radius,this.vertices.length);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix);for(let r=0;r<Re.Properties.length;r++){const o=Re.Properties[r];n[o]=this[o]}return e&&e.add(n),n}toObject(){const e=super.toObject.call(this);e.renderer.type="circle";for(let n=0;n<Wi.Properties.length;n++){const r=Wi.Properties[n];e[r]=this[r]}return e}};B(Rc,"Properties",["radius"]);var mo=Rc,Ec={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},As=Math.cos,Is=Math.sin,Pc=class ji extends Re{constructor(e,n,r,o,s){typeof o!="number"&&typeof r=="number"&&(o=r);const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ne);super(l,!0,!0,!0),B(this,"_flagWidth",!1),B(this,"_flagHeight",!1),B(this,"_width",0),B(this,"_height",0),this._renderer.type="ellipse";for(let c in Fc)Object.defineProperty(this,c,Fc[c]);typeof r=="number"&&(this.width=r*2),typeof o=="number"&&(this.height=o*2),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new ji().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<ji.Properties.length;n++){const r=ji.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const n=4/3*Math.tan(Math.PI/(this.vertices.length*2)),r=this._width/2,o=this._height/2;for(let s=0;s<this.vertices.length;s++){const l=s/e*tt,c=r*As(l),d=o*Is(l),u=r*n*As(l-ct),h=o*n*Is(l-ct),f=r*n*As(l+ct),m=o*n*Is(l+ct),p=this.vertices[s];p.command=s===0?ie.move:ie.curve,p.set(c,d),p.controls.left.set(u,h),p.controls.right.set(f,m)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const n=this.width/2,r=this.height/2,o=this.vertices.length,s=new ji(0,0,n,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Re.Properties.length;a++){const l=Re.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="ellipse";for(let n=0;n<ji.Properties.length;n++){const r=ji.Properties[n];e[r]=this[r]}return e}};B(Pc,"Properties",["width","height"]);var po=Pc,Fc={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}}},Jg=Math.ceil,ey=Math.floor,Vc=class gi extends On{constructor(e){super(),B(this,"_flagVertices",!0),B(this,"_flagLength",!0),B(this,"_flagFill",!0),B(this,"_flagStroke",!0),B(this,"_flagLinewidth",!0),B(this,"_flagOpacity",!0),B(this,"_flagVisible",!0),B(this,"_flagSize",!0),B(this,"_flagSizeAttenuation",!0),B(this,"_flagStrokeAttenuation",!0),B(this,"_length",0),B(this,"_fill","#fff"),B(this,"_stroke","#000"),B(this,"_linewidth",1),B(this,"_opacity",1),B(this,"_visible",!0),B(this,"_size",1),B(this,"_sizeAttenuation",!1),B(this,"_beginning",0),B(this,"_ending",1),B(this,"_dashes",null),B(this,"_strokeAttenuation",!0),B(this,"noFill",Re.prototype.noFill),B(this,"noStroke",Re.prototype.noStroke),B(this,"corner",Re.prototype.corner),B(this,"center",Re.prototype.center),B(this,"getBoundingClientRect",Re.prototype.getBoundingClientRect),B(this,"_updateLength",Re.prototype._updateLength);for(let n in Mc)Object.defineProperty(this,n,Mc[n]);this._renderer.type="points",this._renderer.flagVertices=bc.bind(this),this._renderer.bindVertices=_c.bind(this),this._renderer.unbindVertices=wc.bind(this),this._renderer.flagFill=xc.bind(this),this._renderer.flagStroke=kc.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.size=1,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.vertices=e,this.dashes=[],this.dashes.offset=0}static fromObject(e){const n=typeof e.fill=="string"?e.fill:_i(e.fill),r=typeof e.stroke=="string"?e.stroke:_i(e.stroke),o=new gi().copy(bs(Sr({},e),{fill:n,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let n=0;n<e.vertices.length;n++){const r=e.vertices[n];r instanceof Ne?this.vertices.push(e.vertices[n].clone()):this.vertices.push(new Ne().copy(r))}for(let n=0;n<gi.Properties.length;n++){const r=gi.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new gi;for(let r=0;r<this.vertices.length;r++)n.vertices.push(this.vertices[r].clone());for(let r=0;r<gi.Properties.length;r++){const o=gi.Properties[r];n[o]=this[o]}return n.className=this.className,n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="points",e.vertices=this.vertices.map(n=>n.toObject()),oe.each(gi.Properties,function(n){typeof this[n]<"u"&&(this[n].toObject?e[n]=this[n].toObject():e[n]=this[n])},this),e}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let e=0;e<this.vertices.length;e++){const n=this.vertices[e];typeof n.unbind=="function"&&n.unbind()}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(e){this._update();let n=[];for(let r=0;r<this.vertices.length;r++){const o=this.vertices[r],s=this.vertices[r-1];if(!s)continue;const a=o.x,l=o.y,c=s.x,d=s.y,u=xs(a,l,a,l,c,d,c,d,e);n=n.concat(u)}return this.vertices=n,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const e=Math.min(this._beginning,this._ending),n=Math.max(this._beginning,this._ending),r=so(this,e*this._length),o=so(this,n*this._length),s=Jg(r),a=ey(o);let l=0,c;this._renderer.vertices=[],this._renderer.collection=[];for(let d=0;d<this._collection.length;d++)d>=s&&d<=a&&(c=this._collection[d],this._renderer.collection.push(c),this._renderer.vertices[l*2+0]=c.x,this._renderer.vertices[l*2+1]=c.y,l++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};B(Vc,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);var Os=Vc,Mc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(t){this._sizeAttenuation=t,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof dt||this._fill instanceof Ke||this._fill instanceof Ge||this._fill instanceof Oe)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof dt||this._fill instanceof Ke||this._fill instanceof Ge||this._fill instanceof Oe)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof dt||this._stroke instanceof Ke||this._stroke instanceof Ge||this._stroke instanceof Oe)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof dt||this._stroke instanceof Ke||this._stroke instanceof Ge||this._stroke instanceof Oe)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ee.Types.insert,e).unbind(ee.Types.remove,n),t instanceof ii?this._collection=t:this._collection=new ii(t||[]),this._collection.bind(ee.Types.insert,e).bind(ee.Types.remove,n),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}},ty=Math.cos,ny=Math.sin,Ac=class qi extends Re{constructor(e,n,r,o){o=Math.max(o||0,3),super(),B(this,"_flagWidth",!1),B(this,"_flagHeight",!1),B(this,"_flagSides",!1),B(this,"_radius",0),B(this,"_width",0),B(this,"_height",0),B(this,"_sides",0),this._renderer.type="polygon";for(let s in Ic)Object.defineProperty(this,s,Ic[s]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.radius=r),typeof o=="number"&&(this.sides=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new qi().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<qi.Properties.length;n++){const r=qi.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const e=this._sides,n=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<n;o++){const s=(o+.5)/e,a=tt*s+Math.PI/2,l=this._width*ty(a)/2,c=this._height*ny(a)/2;o>=r?this.vertices.push(new Ne(l,c)):this.vertices[o].set(l,c),this.vertices[o].command=o===0?ie.move:ie.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const n=new qi(0,0,0,this.sides);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.skewX=this.skewX,n.skewY=this.skewY,n.width=this.width,n.height=this.height,this.matrix.manual&&n.matrix.copy(this.matrix);for(let r=0;r<Re.Properties.length;r++){const o=Re.Properties[r];n[o]=this[o]}return e&&e.add(n),n}toObject(){const e=super.toObject.call(this);e.renderer.type="polygon";for(let n=0;n<qi.Properties.length;n++){const r=qi.Properties[n];e[r]=this[r]}return e}};B(Ac,"Properties",["width","height","sides"]);var zs=Ac,Ic={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this.width=t*2,this.height=t*2}},width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},Oc=class Xi extends Re{constructor(e,n,r,o,s){typeof s>"u"&&typeof r=="number"&&typeof o=="number"&&(s=Math.floor(Math.min(r,o)/12));const a=[];for(let l=0;l<10;l++)a.push(new Ne(0,0,0,0,0,0,l===0?ie.move:ie.curve));super(a),B(this,"_flagWidth",!1),B(this,"_flagHeight",!1),B(this,"_flagRadius",!1),B(this,"_width",0),B(this,"_height",0),B(this,"_radius",12),this._renderer.type="rounded-rectangle";for(let l in zc)Object.defineProperty(this,l,zc[l]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=iy.bind(this),typeof r=="number"&&(this.width=r),typeof o=="number"&&(this.height=o),(typeof s=="number"||s instanceof re)&&(this.radius=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Xi().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Xi.Properties.length;n++){const r=Xi.Properties[n];if(r in e){const o=e[r];/radius/i.test(r)?this[r]=typeof o=="number"||o instanceof re?o:new re().copy(o):typeof o=="number"&&(this[r]=o)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const e=this._width,n=this._height;let r,o;this._radius instanceof re?(r=this._radius.x,o=this._radius.y):(r=this._radius,o=this._radius);let s,a=e/2,l=n/2;s=this.vertices[0],s.x=-(a-r),s.y=-l,s=this.vertices[1],s.x=a-r,s.y=-l,s.controls.left.clear(),s.controls.right.x=r,s.controls.right.y=0,s=this.vertices[2],s.x=a,s.y=-(l-o),s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[3],s.x=a,s.y=l-o,s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=o,s=this.vertices[4],s.x=a-r,s.y=l,s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[5],s.x=-(a-r),s.y=l,s.controls.left.clear(),s.controls.right.x=-r,s.controls.right.y=0,s=this.vertices[6],s.x=-a,s.y=l-o,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[7],s.x=-a,s.y=-(l-o),s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=-o,s=this.vertices[8],s.x=-(a-r),s.y=-l,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[9],s.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const n=this.width,r=this.height,o=this.radius,s=new Xi(0,0,n,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Re.Properties.length;a++){const l=Re.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="rounded-rectangle";for(let n=0;n<Xi.Properties.length;n++){const r=Xi.Properties[n];e[r]=this[r]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}};B(Oc,"Properties",["width","height","radius"]);var go=Oc,zc={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof re&&this._radius.unbind(ee.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof re&&this._radius.bind(ee.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function iy(){this._flagRadius=!0}var ry=Math.cos,oy=Math.sin,Dc=class Yi extends Re{constructor(e,n,r,o,s){arguments.length<=3&&(o=r,r=o/2),(typeof s!="number"||s<=0)&&(s=5),super(),B(this,"_flagInnerRadius",!1),B(this,"_flagOuterRadius",!1),B(this,"_flagSides",!1),B(this,"_innerRadius",0),B(this,"_outerRadius",0),B(this,"_sides",0),this._renderer.type="star";for(let a in Lc)Object.defineProperty(this,a,Lc[a]);this.closed=!0,this.automatic=!1,typeof r=="number"&&(this.innerRadius=r),typeof o=="number"&&(this.outerRadius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof n=="number"&&(this.translation.y=n)}static fromObject(e){const n=new Yi().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Yi.Properties.length;n++){const r=Yi.Properties[n];r in e&&typeof e[r]=="number"&&(this[r]=e[r])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const e=this._sides*2,n=e+1;let r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(let o=0;o<n;o++){const s=(o+.5)/e,a=tt*s,l=(o%2?this._outerRadius:this._innerRadius)/2,c=l*ry(a),d=l*oy(a);o>=r?this.vertices.push(new Ne(c,d)):this.vertices[o].set(c,d),this.vertices[o].command=o===0?ie.move:ie.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const n=this.innerRadius,r=this.outerRadius,o=this.sides,s=new Yi(0,0,n,r,o);s.translation.copy(this.translation),s.rotation=this.rotation,s.scale=this.scale,s.skewX=this.skewX,s.skewY=this.skewY,this.matrix.manual&&s.matrix.copy(this.matrix);for(let a=0;a<Re.Properties.length;a++){const l=Re.Properties[a];s[l]=this[l]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="star";for(let n=0;n<Yi.Properties.length;n++){const r=Yi.Properties[n];e[r]=this[r]}return e}};B(Dc,"Properties",["innerRadius","outerRadius","sides"]);var Ds=Dc,Lc={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},Ls,Hc=Math.min,Wc=Math.max;Ue.document&&(Ls=document.createElement("canvas"));var Hs=class en extends On{constructor(e,n,r,o){super(),B(this,"_flagValue",!0),B(this,"_flagFamily",!0),B(this,"_flagSize",!0),B(this,"_flagLeading",!0),B(this,"_flagAlignment",!0),B(this,"_flagBaseline",!0),B(this,"_flagStyle",!0),B(this,"_flagWeight",!0),B(this,"_flagDecoration",!0),B(this,"_flagFill",!0),B(this,"_flagStroke",!0),B(this,"_flagLinewidth",!0),B(this,"_flagOpacity",!0),B(this,"_flagVisible",!0),B(this,"_flagMask",!1),B(this,"_flagClip",!1),B(this,"_flagDirection",!0),B(this,"_flagStrokeAttenuation",!0),B(this,"_value",""),B(this,"_family","sans-serif"),B(this,"_size",13),B(this,"_leading",17),B(this,"_alignment","center"),B(this,"_baseline","middle"),B(this,"_style","normal"),B(this,"_weight",500),B(this,"_decoration","none"),B(this,"_direction","ltr"),B(this,"_fill","#000"),B(this,"_stroke","none"),B(this,"_linewidth",1),B(this,"_opacity",1),B(this,"_visible",!0),B(this,"_mask",null),B(this,"_clip",!1),B(this,"_dashes",null),B(this,"_strokeAttenuation",!0);for(let s in jc)Object.defineProperty(this,s,jc[s]);if(this._renderer.type="text",this._renderer.flagFill=sy.bind(this),this._renderer.flagStroke=ay.bind(this),this.value=e,typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r),this.dashes=[],this.dashes.offset=0,!oe.isObject(o))return this;for(let s=0;s<en.Properties.length;s++){const a=en.Properties[s];a in o&&(this[a]=o[a])}}static Measure(e){if(Ls){const n=Ls.getContext("2d");n.font=[e._style,e._weight,`${e._size}px/${e._leading}px`,e._family].join(" ");const r=n.measureText(e.value,0,0),o=r.actualBoundingBoxDescent+r.actualBoundingBoxAscent;return{width:r.width,height:o}}else{const n=this.value.length*this.size*en.Ratio,r=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:n,height:r}}}static fromObject(e){const n=typeof e.fill=="string"?e.fill:_i(e.fill),r=typeof e.stroke=="string"?e.stroke:_i(e.stroke),o=new en().copy(bs(Sr({},e),{fill:n,stroke:r}));return"id"in e&&(o.id=e.id),o}copy(e){super.copy.call(this,e);for(let n=0;n<en.Properties.length;n++){const r=en.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new en(this.value);n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale;for(let r=0;r<en.Properties.length;r++){const o=en.Properties[r];n[o]=this[o]}return this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);e.renderer.type="text";for(let n=0;n<en.Properties.length;n++){const r=en.Properties[n];e[r]=this[r]}return e}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(e){let n,r,o,s,a;this._update(!0),n=e?this.matrix:this.worldMatrix;const{width:l,height:c}=en.Measure(this),d=(this._linewidth||0)/2;switch(this.alignment){case"left":r=-d,o=l+d;break;case"right":r=-(l+d),o=d;break;default:r=-(l/2+d),o=l/2+d}switch(this.baseline){case"middle":s=-(c/2+d),a=c/2+d;break;default:s=-(c+d),a=d}const[u,h]=n.multiply(r,s),[f,m]=n.multiply(r,a),[p,g]=n.multiply(o,s),[y,b]=n.multiply(o,a);return s=Hc(h,m,g,b),r=Hc(u,f,p,y),o=Wc(u,f,p,y),a=Wc(h,m,g,b),{top:s,left:r,right:o,bottom:a,width:o-r,height:a-s}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};B(Hs,"Ratio",.6),B(Hs,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);var xn=Hs,jc={value:{enumerable:!0,get:function(){return this._value},set:function(t){this._value=t,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(t){this._family=t,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(t){this._leading=t,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(t){this._alignment=t,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(t){this._style=t,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(t){this._weight=t,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(t){this._decoration=t,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(t){this._direction=t,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(t){this._baseline=t,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof dt||this._fill instanceof Ke||this._fill instanceof Ge||this._fill instanceof Oe)&&this._fill.unbind(ee.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof dt||this._fill instanceof Ke||this._fill instanceof Ge||this._fill instanceof Oe)&&this._fill.bind(ee.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof dt||this._stroke instanceof Ke||this._stroke instanceof Ge||this._stroke instanceof Oe)&&this._stroke.unbind(ee.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof dt||this._stroke instanceof Ke||this._stroke instanceof Ge||this._stroke instanceof Oe)&&this._stroke.bind(ee.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,oe.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function sy(){this._flagFill=!0}function ay(){this._flagStroke=!0}var Ws=class yr extends oi{constructor(e,n,r,o){super(n,r,0,0),B(this,"_flagTextures",!1),B(this,"_flagFrameRate",!1),B(this,"_flagIndex",!1),B(this,"_amount",1),B(this,"_duration",0),B(this,"_index",0),B(this,"_startTime",0),B(this,"_playing",!1),B(this,"_firstFrame",0),B(this,"_lastFrame",0),B(this,"_loop",!0),B(this,"_textures",null),B(this,"_frameRate",0),B(this,"_origin",null),this._renderer.type="image-sequence";for(let s in qc)Object.defineProperty(this,s,qc[s]);this._renderer.flagTextures=ly.bind(this),this._renderer.bindTextures=cy.bind(this),this._renderer.unbindTextures=dy.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(Xc.bind(this)):typeof e=="string"&&(this.textures=[Xc(e)]),this.origin=new re,this._update(),typeof o=="number"?this.frameRate=o:this.frameRate=yr.DefaultFrameRate,this.index=0}static fromObject(e){const n=new yr().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<yr.Properties.length;n++){const r=yr.Properties[n];r in e&&(this[r]=e[r])}return this}play(e,n,r){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=oe.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof n=="number"&&(this._lastFrame=n),typeof r=="function"?this._onLastFrame=r:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(e){const n=new yr(this.textures,this.translation.x,this.translation.y,this.frameRate);return n._loop=this._loop,this._playing&&n.play(),e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="image-sequence",e.textures=this.textures.map(function(n){return n.toObject()}),e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let e=0;e<this.textures.length;e++){const n=this.textures[e];typeof n.dispose=="function"?n.dispose():typeof n.unbind=="function"&&n.unbind()}return this}_update(){const e=this._textures;let n,r,o,s,a,l,c,d;return e&&(this._flagTextures&&(this._amount=e.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(s=this._amount,oe.isNaN(this._lastFrame)&&(this._lastFrame=s-1),o=oe.performance.now()-this._startTime,d=this._lastFrame+1,a=1e3*(d-this._firstFrame)/this._frameRate,this._loop?o=o%a:o=Math.min(o,a),c=Pt(this._firstFrame,d,o/a),c=Math.floor(c),c!==this._index&&(this._index=c,l=e[this._index],l.loaded&&(n=l.image.width,r=l.image.height,this.width!==n&&(this.width=n),this.height!==r&&(this.height=r),this.fill=l,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof Oe))&&(l=e[this._index],l.loaded&&(n=l.image.width,r=l.image.height,this.width!==n&&(this.width=n),this.height!==r&&(this.height=r)),this.fill=l)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};B(Ws,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),B(Ws,"DefaultFrameRate",30);var js=Ws,qc={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(t){const e=this._renderer.bindTextures,n=this._renderer.unbindTextures;this._textures&&this._textures.unbind(ee.Types.insert,e).unbind(ee.Types.remove,n),this._textures=new ii((t||[]).slice(0)),this._textures.bind(ee.Types.insert,e).bind(ee.Types.remove,n),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}};function ly(){this._flagTextures=!0}function cy(t){let e=t.length;for(;e--;)t[e].bind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function dy(t){let e=t.length;for(;e--;)t[e].unbind(ee.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Xc(t){if(t instanceof Oe)return t;if(typeof t=="string")return new Oe(t)}var yo=Math.min,bo=Math.max,uy={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},qs=class an extends On{constructor(e){super(),B(this,"_flagAdditions",!1),B(this,"_flagSubtractions",!1),B(this,"_flagOrder",!1),B(this,"_flagOpacity",!0),B(this,"_flagBeginning",!1),B(this,"_flagEnding",!1),B(this,"_flagLength",!1),B(this,"_flagMask",!1),B(this,"_fill","#fff"),B(this,"_stroke","#000"),B(this,"_linewidth",1),B(this,"_opacity",1),B(this,"_visible",!0),B(this,"_cap","round"),B(this,"_join","round"),B(this,"_miter",4),B(this,"_closed",!0),B(this,"_curved",!1),B(this,"_automatic",!0),B(this,"_beginning",0),B(this,"_ending",1),B(this,"_length",0),B(this,"_mask",null),B(this,"_strokeAttenuation",!0);for(let n in Yc)Object.defineProperty(this,n,Yc[n]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static InsertChildren(e){for(let n=0;n<e.length;n++)Uc.call(this,e[n],this)}static RemoveChildren(e){for(let n=0;n<e.length;n++)Uc.call(this,e[n])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const n=new an;for(let o=0;o<an.Properties.length;o++){const s=an.Properties[o];s in e&&(/(fill|stroke)/i.test(s)?n[s]=typeof e[s]=="string"?e[s]:_i(e[s]):n[s]=e[s])}return"mask"in e&&(n.mask=r(e.mask)),"id"in e&&(n.id=e.id),n.children=e.children.map(r),n;function r(o){if(o&&o.renderer)switch(o.renderer.type){case"arc-segment":return Fs.fromObject(o);case"circle":return mo.fromObject(o);case"element":return Gi.fromObject(o);case"ellipse":return po.fromObject(o);case"group":return an.fromObject(o);case"image":return Image.fromObject(o);case"image-sequence":return js.fromObject(o);case"path":return Re.fromObject(o);case"points":return Os.fromObject(o);case"polygon":return zs.fromObject(o);case"rectangle":return oi.fromObject(o);case"rounded-rectangle":return go.fromObject(o);case"shape":return On.fromObject(o);case"sprite":return ho.fromObject(o);case"star":return Ds.fromObject(o);case"text":return xn.fromObject(o)}return o}}static IsVisible(e,n){if(!n)return!0;let r=e;for(;r;){if(typeof r.visible=="boolean"&&!r.visible||typeof r.opacity=="number"&&r.opacity<=0)return!1;r=r.parent}return!0}static VisitForHitTest(e,n,r,o,s,a,l){const c=e&&e.children;if(!c)return!1;const d=n.results;for(let u=c.length-1;u>=0;u--){const h=c[u];if(!h||!an.IsVisible(h,n.visibleOnly))continue;const f=typeof h.getBoundingClientRect=="function"?h.getBoundingClientRect():null;if(!(f&&!Lg(f,n.x,n.y,a))){if(h instanceof an){if(r&&(!o||o(h))&&typeof h.contains=="function"&&h.contains(n.x,n.y,s)&&(d.push(h),l)||an.VisitForHitTest(h,n,r,o,s,a,l))return!0;continue}if(h instanceof On&&!(o&&!o(h))&&typeof h.contains=="function"&&h.contains(n.x,n.y,s)&&(d.push(h),l))return!0}}return!1}copy(e){super.copy.call(this,e),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let n=0;n<an.Properties.length;n++){const r=an.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new an,r=this.children.map(function(o){return o.clone()});return n.add(r),n.opacity=this.opacity,this.mask&&(n.mask=this.mask),n.translation.copy(this.translation),n.rotation=this.rotation,n.scale=this.scale,n.className=this.className,this.matrix.manual&&n.matrix.copy(this.matrix),e&&e.add(n),n._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="group",e.children=[],e.opacity=this.opacity,e.className=this.className,e.mask=this.mask?this.mask.toObject():null,oe.each(this.children,(n,r)=>{e.children[r]=n.toObject()},this),e}dispose(){if(super.dispose(),this.children)for(let e=0;e<this.children.length;e++){const n=this.children[e];typeof n.dispose=="function"&&n.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}getShapesAtPoint(e,n,r){const o=r||{},{results:s,hitOptions:a,context:l,single:c,empty:d}=uy.getShapesAtPoint;s.length=0;const u=o.mode==="deepest"||o.deepest?"deepest":"all",h=o.visibleOnly!==!1,f=!!o.includeGroups,m=typeof o.filter=="function"?o.filter:null,p=typeof o.tolerance=="number"?o.tolerance:0;typeof o.precision=="number"?a.precision=o.precision:delete a.precision,typeof o.fill<"u"?a.fill=o.fill:delete a.fill,typeof o.stroke<"u"?a.stroke=o.stroke:delete a.stroke,a.tolerance=p,a.ignoreVisibility=!h;const g=u==="deepest";if(l.x=e,l.y=n,l.visibleOnly=h,l.results=s,an.VisitForHitTest(this,l,f,m,a,p,g),g){if(s.length>0){const b=s[0];return s.length=0,c[0]=b,c.length=1,c}return d.length=0,d}const y=s.slice();return s.length=0,y}corner(){const e=this.getBoundingClientRect(!0);for(let n=0;n<this.children.length;n++){const r=this.children[n];r.translation.x-=e.left,r.translation.y-=e.top}return this.mask&&(this.mask.translation.x-=e.left,this.mask.translation.y-=e.top),this}center(){const e=this.getBoundingClientRect(!0),n=e.left+e.width/2-this.translation.x,r=e.top+e.height/2-this.translation.y;for(let o=0;o<this.children.length;o++){const s=this.children[o];s.isShape&&(s.translation.x-=n,s.translation.y-=r)}return this.mask&&(this.mask.translation.x-=n,this.mask.translation.y-=r),this}getById(e){let n=null;function r(o){if(o.id===e)return o;if(o.children){if(o.children.ids[e])return o.children.ids[e];for(let s=0;s<o.children.length;s++)if(n=r(o.children[s]),n)return n}return null}return r(this)}getByClassName(e){const n=[];function r(o){if(Array.prototype.indexOf.call(o.classList,e)>=0&&n.push(o),o.children)for(let s=0;s<o.children.length;s++){const a=o.children[s];r(a)}return n}return r(this)}getByType(e){const n=[];function r(o){if(o instanceof e&&n.push(o),o.children)for(let s=0;s<o.children.length;s++){const a=o.children[s];r(a)}return n}return r(this)}add(e){e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let n=0;n<e.length;n++){const r=e[n];if(!(r&&r.id))continue;const o=Array.prototype.indexOf.call(this.children,r);o>=0&&this.children.splice(o,1),this.children.push(r)}return this}remove(e){const n=arguments.length,r=this.parent;if(n<=0&&r)return r.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let o=0;o<e.length;o++){const s=e[o];if(!s||!this.children.ids[s.id])continue;const a=this.children.indexOf(s);a>=0&&this.children.splice(a,1)}return this}getBoundingClientRect(e){let n,r,o,s,a,l;this._update(!0);let c=1/0,d=-1/0,u=1/0,h=-1/0;const f=/texture|gradient/i;r=e?this.matrix:this.worldMatrix;for(let m=0;m<this.children.length;m++){const p=this.children[m];if(!(!p.visible||f.test(p._renderer.type))&&(n=p.getBoundingClientRect(e),o=typeof n.top!="number"||oe.isNaN(n.top)||!isFinite(n.top),s=typeof n.left!="number"||oe.isNaN(n.left)||!isFinite(n.left),a=typeof n.right!="number"||oe.isNaN(n.right)||!isFinite(n.right),l=typeof n.bottom!="number"||oe.isNaN(n.bottom)||!isFinite(n.bottom),!(o||s||a||l)))if(e){const[g,y]=r.multiply(n.left,n.top),[b,_]=r.multiply(n.right,n.top),[k,x]=r.multiply(n.left,n.bottom),[C,N]=r.multiply(n.right,n.bottom);u=yo(y,_,x,N,u),c=yo(g,b,k,C,c),d=bo(g,b,k,C,d),h=bo(y,_,x,N,h)}else u=yo(n.top,u),c=yo(n.left,c),d=bo(n.right,d),h=bo(n.bottom,h)}return{top:u,left:c,right:d,bottom:h,width:d-c,height:h-u}}noFill(){return this.children.forEach(function(e){e.noFill()}),this}noStroke(){return this.children.forEach(function(e){e.noStroke()}),this}subdivide(){const e=arguments;return this.children.forEach(function(n){n.subdivide.apply(n,e)}),this}_update(){let e,n,r;if(this._flagBeginning||this._flagEnding){const o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),a=this.length;let l=0;const c=o*a,d=s*a;for(e=0;e<this.children.length;e++)r=this.children[e],n=r.length,c>l+n?(r.beginning=1,r.ending=1):d<l?(r.beginning=0,r.ending=0):c>l&&c<l+n?(r.beginning=(c-l)/n,r.ending=1):d>l&&d<l+n?(r.beginning=0,r.ending=(d-l)/n):(r.beginning=0,r.ending=1),l+=n}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};B(qs,"Children",Tc),B(qs,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var mt=qs,Yc={visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._flagVisible=this._visible!==t||this._flagVisible,this._visible=t}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!==t||this._flagOpacity,this._opacity=t}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._flagBeginning=this._beginning!==t||this._flagBeginning,this._beginning=t}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._flagEnding=this._ending!==t||this._flagEnding,this._ending=t}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let t=0;t<this.children.length;t++){const e=this.children[t];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){this._fill=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.fill=t}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){this._stroke=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.stroke=t}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.linewidth=t}}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.join=t}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.miter=t}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.cap=t}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.closed=t}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.curved=t}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){this._automatic=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.automatic=t}}},children:{enumerable:!0,get:function(){return this._children},set:function(t){const e=mt.InsertChildren.bind(this),n=mt.RemoveChildren.bind(this),r=mt.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new Tc(t),this._children.bind(ee.Types.insert,e),this._children.bind(ee.Types.remove,n),this._children.bind(ee.Types.order,r),t.length>0&&e(t)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,oe.isObject(t)&&!t.clip&&(t.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.strokeAttenuation!==void 0&&(n.strokeAttenuation=t)}}}};function Uc(t,e){const n=t.parent;let r;if(n===e){o();return}if(n&&n.children.ids[t.id]&&(r=Array.prototype.indexOf.call(n.children,t),n.children.splice(r,1),s()),e){o();return}s(),n._flagAdditions&&n.additions.length===0&&(n._flagAdditions=!1),n._flagSubtractions&&n.subtractions.length===0&&(n._flagSubtractions=!1),delete t.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,t),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,t),r>=0&&e.additions.splice(r,1)),t.parent=e,e.additions.push(t),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(n.additions,t),r>=0&&n.additions.splice(r,1),r=Array.prototype.indexOf.call(n.subtractions,t),r<0&&(n.subtractions.push(t),n._flagSubtractions=!0)}}var _o=class extends Re{constructor(e,n,r,o){const s=[new Ne(e,n),new Ne(r,o)];super(s);for(let a in Kc)Object.defineProperty(this,a,Kc[a]);this.vertices[0].command=ie.move,this.vertices[1].command=ie.line,this.automatic=!1}};B(_o,"Properties",["left","right"]);var Kc={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(oe.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=ie.move;else{const e=new Dt("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(t){if(oe.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=ie.line;else{const e=new Dt("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}},kn={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},fy={start:"left",middle:"center",end:"right"},Gc=["id","class","transform","xmlns","viewBox"],hy=["x","y","width","height","href","xlink:href"];function my(t){return fy[t]}function py(t){const e=t.getAttribute("dominant-baseline"),n=t.getAttribute("alignment-baseline");return e||n}function Tr(t){return t.replace(/svg:/gi,"").toLowerCase()}function Zc(t,e){if(e.x+=t.translateX,e.y+=t.translateY,e.x*=t.scaleX,e.y*=t.scaleY,t.rotation!==0){const n=e.length();e.x=n*Math.cos(t.rotation),e.y=n*Math.sin(t.rotation)}}function gy(t,e){e||(e={});const n=t.split(";");for(let r=0;r<n.length;r++){const o=n[r].split(":"),s=o[0],a=o[1];if(typeof s>"u"||typeof a>"u")continue;const l=s.replace(/\s/g,""),c=a.replace(/\s/g,"");e[l]=c}return e}function yy(t){const e={},n=by(t),r=Math.max(n.length,t.style.length);for(let o=0;o<r;o++){const s=t.style[o],a=n[o];s&&(e[s]=t.style[s]),a&&(e[a]=t.getAttribute(a))}return e}function by(t){const e=t.getAttributeNames();for(let n=0;n<Gc.length;n++){const r=Gc[n],o=Array.prototype.indexOf.call(e,r);o>=0&&e.splice(o,1)}return e}function _y(t,e){const n=e.split(/[\s,]/),r=-parseFloat(n[0]),o=-parseFloat(n[1]),s=parseFloat(n[2]),a=parseFloat(n[3]);if(r&&o)for(let h=0;h<t.children.length;h++){const f=t.children[h];"translation"in f?f.translation.add(r,o):"x"in f?f.x=r:"y"in f&&(f.y=o)}const l=typeof t.x=="number",c=typeof t.y=="number",d=typeof t.width=="number",u=typeof t.height=="number";return l&&(t.translation.x+=t.x),c&&(t.translation.y+=t.y),(d||u)&&(t.scale=new re(1,1)),d&&(t.scale.x=t.width/s),u&&(t.scale.y=t.height/a),t.mask=new oi(0,0,s,a),t.mask.origin.set(-s/2,-a/2),t}function tn(t,e,n){const r={},o={},s={};let a,l,c,d,u,h,f,m,p,g,y,b,_,k,x,C,N;if(t===null)return r;if(Ue.getComputedStyle){const w=Ue.getComputedStyle(t);for(a=w.length;a--;)c=w[a],d=w[c],typeof d<"u"&&(r[c]=d)}for(a=0;a<t.attributes.length;a++)h=t.attributes[a],/style/i.test(h.nodeName)?gy(h.value,s):o[h.nodeName]=h.value;typeof r.opacity<"u"&&(r["stroke-opacity"]=r.opacity,r["fill-opacity"]=r.opacity,delete r.opacity),n&&oe.defaults(r,n),oe.extend(r,s,o),r.visible=!(typeof r.display>"u"&&/none/i.test(r.display))||typeof r.visibility>"u"&&/hidden/i.test(r.visibility);for(c in r)switch(d=r[c],c){case"gradientTransform":if(/none/i.test(d)||(l=t.gradientTransform&&t.gradientTransform.baseVal&&t.gradientTransform.baseVal.length>0?t.gradientTransform.baseVal[0].matrix:t.getCTM?t.getCTM():null,l===null))break;switch(f=bi(l),e._renderer.type){case"linear-gradient":Zc(f,e.left),Zc(f,e.right);break;case"radial-gradient":e.center.x+=f.translateX,e.center.y+=f.translateY,e.focal.x+=f.translateX,e.focal.y+=f.translateY,e.radius*=Math.max(f.scaleX,f.scaleY);break}break;case"transform":if(/none/i.test(d)||(l=t.transform&&t.transform.baseVal&&t.transform.baseVal.length>0?t.transform.baseVal[0].matrix:t.getCTM?t.getCTM():null,l===null))break;f=bi(l),e.translation.set(f.translateX,f.translateY),e.rotation=Math.PI*(f.rotation/180),e.scale=new re(f.scaleX,f.scaleY),m=parseFloat((r.x+"").replace("px")),p=parseFloat((r.y+"").replace("px")),m&&(e.translation.x=m),p&&(e.translation.y=p);break;case"visible":if(e instanceof mt){e._visible=d;break}e.visible=d;break;case"stroke-linecap":if(e instanceof mt){e._cap=d;break}e.cap=d;break;case"stroke-linejoin":if(e instanceof mt){e._join=d;break}e.join=d;break;case"stroke-miterlimit":if(e instanceof mt){e._miter=d;break}e.miter=d;break;case"stroke-width":if(e instanceof mt){e._linewidth=parseFloat(d);break}e.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(e instanceof mt){e._opacity=parseFloat(d);break}e.opacity=parseFloat(d);break;case"clip-path":if(kn.cssBackgroundImage.test(d)&&(g=d.replace(kn.cssBackgroundImage,"$1"),Ye.defs.current&&Ye.defs.current.contains(g)&&(b=Ye.defs.current.get(g),b&&b.childNodes.length>0)))switch(b=b.childNodes[0],_=Tr(b.nodeName),e.mask=Ye[_].call(this,b,{}),e._renderer.type){case"text":case"path":e.position.add(e.mask.position),e.mask.position.clear();break}break;case"fill":case"stroke":u=(e instanceof mt?"_":"")+c,kn.cssBackgroundImage.test(d)?(g=d.replace(kn.cssBackgroundImage,"$1"),Ye.defs.current&&Ye.defs.current.contains(g)?(b=Ye.defs.current.get(g),b.object||(_=Tr(b.nodeName),b.object=Ye[_].call(this,b,{})),b=b.object):(y=xy(this),b=y.getById(g)),e[u]=b):e[u]=d;break;case"id":e.id=d;break;case"class":case"className":e.classList=d.split(" "),e._flagClassName=!0;break;case"x":case"y":if(k=e instanceof dt,x=e instanceof Ke,C=e instanceof Ge,k||x||C)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(N=new Dt("only pixel values are supported with the "+c+" attribute."),console.warn(N.name,N.message)),e.translation[c]=parseFloat(d);break;case"font-family":e instanceof xn&&(e.family=d);break;case"font-size":e instanceof xn&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(N=new Dt("only pixel values are supported with the "+c+" attribute."),console.warn(N.name,N.message)),e.size=parseFloat(d));break;case"font-weight":e instanceof xn&&(e.weight=d);break;case"font-style":e instanceof xn&&(e.style=d);break;case"text-decoration":e instanceof xn&&(e.decoration=d);break;case"line-height":e instanceof xn&&(e.leading=d);break}return Object.keys(t.dataset).length&&(e.dataset=t.dataset),r}function wy(t,e){for(let n=0,r=t.childNodes.length;n<r;n++){const o=t.childNodes[n];!o.id||Tr(t.nodeName)==="#text"||e.add(o.id,o)}}function xy(t){for(;t.parent;)t=t.parent;return t.scene}var Ye={svg:function(t){const e=Ye.defs.current=new ro,n=t.getElementsByTagName("defs");for(let p=0;p<n.length;p++)wy(n[p],e);const r=Ye.g.call(this,t),o=t.getAttribute("viewBox"),s=t.getAttribute("x"),a=t.getAttribute("y"),l=t.getAttribute("width"),c=t.getAttribute("height");r.defs=e;const d=o!==null,u=s!==null,h=a!==null,f=l!==null,m=c!==null;return u&&(r.x=parseFloat(s.replace(kn.unitSuffix,""))),h&&(r.y=parseFloat(a.replace(kn.unitSuffix,""))),f&&(r.width=parseFloat(l.replace(kn.unitSuffix,""))),m&&(r.height=parseFloat(c.replace(kn.unitSuffix,""))),d&&_y(r,o),delete Ye.defs.current,r},defs:function(t){return null},use:function(t,e){let n;const r=t.getAttribute("href")||t.getAttribute("xlink:href");if(!r)return n=new Dt("encountered <use /> with no href."),console.warn(n.name,n.message),null;const o=r.slice(1);if(!Ye.defs.current.contains(o))return n=new Dt("unable to find element for reference "+r+"."),console.warn(n.name,n.message),null;const a=Ye.defs.current.get(o).cloneNode(!0);for(let c=0;c<t.attributes.length;c++){const d=t.attributes[c],u=hy.includes(d.nodeName),h=!a.hasAttribute(d.nodeName);(u||h)&&a.setAttribute(d.nodeName,d.value)}const l=Tr(a.nodeName);return Ye[l].call(this,a,e)},g:function(t,e){const n=new mt;tn.call(this,t,n,e),this.add(n);const r=yy.call(this,t);for(let o=0,s=t.childNodes.length;o<s;o++){const a=t.childNodes[o],l=a.nodeName;if(!l)return;const c=Tr(l);if(c in Ye){const d=Ye[c].call(n,a,r);d&&!d.parent&&n.add(d)}}return n},polygon:function(t,e){let n;typeof t=="string"?n=t:n=t.getAttribute("points");const r=[];n.replace(/(-?[\d.eE-]+)[,|\s](-?[\d.eE-]+)/g,function(s,a,l){r.push(new Ne(parseFloat(a),parseFloat(l)))});const o=new Re(r,!0);return o.stroke="none",o.fill="black",tn.call(this,t,o,e),o},polyline:function(t,e){const n=Ye.polygon.call(this,t,e);return n.closed=!1,n},path:function(t,e){let n;typeof t=="string"?(n=t,t=null):n=t.getAttribute("d");let r=[],o=!1,s=!1;if(n){let l=new Ne,c,d,u=n.match(/[a-df-z][^a-df-z]*/gi);const h=u.length-1;oe.each(u.slice(0),function(f,m){const p=f.slice(1).trim().match(kn.path),g=f[0],y=g.toLowerCase();let b,_,k,x,C;const N=[];switch(m===0&&(u=[]),y){case"h":case"v":p.length>1&&(b=1);break;case"m":case"l":case"t":p.length>2&&(b=2);break;case"s":case"q":p.length>4&&(b=4);break;case"c":p.length>6&&(b=6);break;case"a":p.length>7&&(b=7);break}if(b){for(_=0,k=p.length,C=0;_<k;_+=b){if(x=g,C>0)switch(g){case"m":x="l";break;case"M":x="L";break}N.push(x+p.slice(_,_+b).join(" ")),C++}u=Array.prototype.concat.apply(u,N)}else u.push(f)}),oe.each(u,function(f,m){let p,g,y;const b=f[0],_=b.toLowerCase();d=f.slice(1).trim().match(kn.path),s=b===_;let k,x,C,N,w,S,v,$,E,A,R,F,H,Q,Z,O,P;switch(_){case"z":if(m>=h)o=!0;else{g=l.x,y=l.y,p=new Ne(g,y,void 0,void 0,void 0,void 0,ie.close);for(let V=r.length-1;V>=0;V--){const M=r[V];if(/m/i.test(M.command)){l=M;break}}}break;case"m":case"l":c=void 0,g=parseFloat(d[0]),y=parseFloat(d[1]),p=new Ne(g,y,void 0,void 0,void 0,void 0,/m/i.test(_)?ie.move:ie.line),s&&p.addSelf(l),l=p;break;case"h":case"v":A=/h/i.test(_)?"x":"y",R=/x/i.test(A)?"y":"x",p=new Ne(void 0,void 0,void 0,void 0,void 0,void 0,ie.line),p[A]=parseFloat(d[0]),p[R]=l[R],s&&(p[A]+=l[A]),l=p;break;case"c":case"s":k=l.x,x=l.y,c||(c=new re),/c/i.test(_)?(C=parseFloat(d[0]),N=parseFloat(d[1]),w=parseFloat(d[2]),S=parseFloat(d[3]),v=parseFloat(d[4]),$=parseFloat(d[5])):(E=ks(l,c,s),C=E.x,N=E.y,w=parseFloat(d[0]),S=parseFloat(d[1]),v=parseFloat(d[2]),$=parseFloat(d[3])),s&&(C+=k,N+=x,w+=k,S+=x,v+=k,$+=x),l.controls.right.set(C-l.x,N-l.y),p=new Ne(v,$,w-v,S-$,void 0,void 0,ie.curve),l=p,c=p.controls.left;break;case"t":case"q":k=l.x,x=l.y,c||(c=new re),/q/i.test(_)?(C=parseFloat(d[0]),N=parseFloat(d[1]),w=parseFloat(d[0]),S=parseFloat(d[1]),v=parseFloat(d[2]),$=parseFloat(d[3])):(E=ks(l,c,s),C=E.x,N=E.y,w=E.x,S=E.y,v=parseFloat(d[0]),$=parseFloat(d[1])),s&&(C+=k,N+=x,w+=k,S+=x,v+=k,$+=x),l.controls.right.set((C-l.x)*.33,(N-l.y)*.33),p=new Ne(v,$,w-v,S-$,void 0,void 0,ie.curve),l=p,c=p.controls.left;break;case"a":k=l.x,x=l.y,H=parseFloat(d[0]),Q=parseFloat(d[1]),Z=parseFloat(d[2]),O=parseFloat(d[3]),P=parseFloat(d[4]),v=parseFloat(d[5]),$=parseFloat(d[6]),s&&(v+=k,$+=x),F=new Ne(v,$),F.command=ie.arc,F.rx=H,F.ry=Q,F.xAxisRotation=Z,F.largeArcFlag=O,F.sweepFlag=P,p=F,l=F,c=void 0;break}p&&(Array.isArray(p)?r=r.concat(p):r.push(p))})}n=new Re(r,o,void 0,!0),n.stroke="none",n.fill="black";const a=n.getBoundingClientRect(!0);return a.centroid={x:a.left+a.width/2,y:a.top+a.height/2},oe.each(n.vertices,function(l){l.subSelf(a.centroid)}),tn.call(this,t,n,e),n.translation.addSelf(a.centroid),n},circle:function(t,e){const n=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),o=parseFloat(t.getAttribute("r")),s=new mo(0,0,o);return s.stroke="none",s.fill="black",tn.call(this,t,s,e),s.translation.x=n,s.translation.y=r,s},ellipse:function(t,e){const n=parseFloat(t.getAttribute("cx")),r=parseFloat(t.getAttribute("cy")),o=parseFloat(t.getAttribute("rx")),s=parseFloat(t.getAttribute("ry")),a=new po(0,0,o,s);return a.stroke="none",a.fill="black",tn.call(this,t,a,e),a.translation.x=n,a.translation.y=r,a},rect:function(t,e){const n=parseFloat(t.getAttribute("rx")),r=parseFloat(t.getAttribute("ry"));if(!oe.isNaN(n)||!oe.isNaN(r))return Ye["rounded-rect"](t);const o=parseFloat(t.getAttribute("width")),s=parseFloat(t.getAttribute("height")),a=o/2,l=s/2,c=new oi(0,0,o,s);return c.stroke="none",c.fill="black",tn.call(this,t,c,e),c.translation.x+=a,c.translation.y+=l,c},"rounded-rect":function(t,e){const n=parseFloat(t.getAttribute("rx"))||0,r=parseFloat(t.getAttribute("ry"))||0,o=parseFloat(t.getAttribute("width")),s=parseFloat(t.getAttribute("height")),a=o/2,l=s/2,c=new re(n,r),d=new go(0,0,o,s,c);return d.stroke="none",d.fill="black",tn.call(this,t,d,e),d.translation.x+=a,d.translation.y+=l,d},line:function(t,e){const n=parseFloat(t.getAttribute("x1")),r=parseFloat(t.getAttribute("y1")),o=parseFloat(t.getAttribute("x2")),s=parseFloat(t.getAttribute("y2")),a=new _o(n,r,o,s).noFill();return tn.call(this,t,a,e),a},lineargradient:function(t,e){let n=t.getAttribute("gradientUnits"),r=t.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let o=parseFloat(t.getAttribute("x1")||0),s=parseFloat(t.getAttribute("y1")||0),a=parseFloat(t.getAttribute("x2")||0),l=parseFloat(t.getAttribute("y2")||0);const c=(a+o)/2,d=(l+s)/2;/userSpaceOnUse/i.test(n)&&(o-=c,s-=d,a-=c,l-=d);const u=[];for(let f=0;f<t.children.length;f++){const m=t.children[f];let p=m.getAttribute("offset");/%/gi.test(p)&&(p=parseFloat(p.replace(/%/gi,""))/100),p=parseFloat(p);let g=m.getAttribute("stop-color"),y=m.getAttribute("stop-opacity"),b=m.getAttribute("style"),_;g===null&&(_=b?b.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,g=_&&_.length>1?_[1]:void 0),y===null?(_=b?b.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=_&&_.length>1?parseFloat(_[1]):1):y=parseFloat(y),u.push(new ri(p,g,y))}const h=new Ke(o,s,a,l,u);return h.spread=r,h.units=n,tn.call(this,t,h,e),h},radialgradient:function(t,e){let n=t.getAttribute("gradientUnits"),r=t.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let o=parseFloat(t.getAttribute("cx"))||0,s=parseFloat(t.getAttribute("cy"))||0,a=parseFloat(t.getAttribute("r")),l=parseFloat(t.getAttribute("fx")),c=parseFloat(t.getAttribute("fy"));oe.isNaN(l)&&(l=o),oe.isNaN(c)&&(c=s);const d=Math.abs(o+l)/2,u=Math.abs(s+c)/2;/userSpaceOnUse/i.test(n)&&(o-=d,s-=u,l-=d,c-=u);const h=[];for(let m=0;m<t.children.length;m++){const p=t.children[m];let g=p.getAttribute("offset");/%/gi.test(g)&&(g=parseFloat(g.replace(/%/gi,""))/100),g=parseFloat(g);let y=p.getAttribute("stop-color"),b=p.getAttribute("stop-opacity"),_=p.getAttribute("style"),k;y===null&&(k=_?_.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,y=k&&k.length>1?k[1]:void 0),b===null?(k=_?_.match(/stop-opacity:\s?([0-9.-]*)/):!1,b=k&&k.length>1?parseFloat(k[1]):1):b=parseFloat(b),h.push(new ri(g,y,b))}const f=new Ge(o,s,a,h,l,c);return f.spread=r,f.units=n,tn.call(this,t,f,e),f},text:function(t,e){const n=my(t.getAttribute("text-anchor"))||"left",r=py(t)||"baseline";let o="";t.childNodes.length>0&&t.childNodes[0].tagName==="TSPAN"?o=t.childNodes[0].textContent:o=t.textContent;const s=new xn(o);return tn.call(this,t,s,e),s.alignment=n,s.baseline=r,s},clippath:function(t,e){return Ye.defs.current&&!Ye.defs.current.contains(t.id)&&Ye.defs.current.add(t.id,t),null},image:function(t,e){let n;const r=t.getAttribute("href")||t.getAttribute("xlink:href");if(!r)return n=new Dt("encountered <image /> with no href."),console.warn(n.name,n.message),null;const o=parseFloat(t.getAttribute("x"))||0,s=parseFloat(t.getAttribute("y"))||0,a=parseFloat(t.getAttribute("width")),l=parseFloat(t.getAttribute("height")),c=new ho(r,o,s);return oe.isNaN(a)||(c.width=a),oe.isNaN(l)||(c.height=l),tn.call(this,t,c,e),c}};function Qc(t,e){const n=new XMLHttpRequest;return n.open("GET",t),n.onreadystatechange=function(){n.readyState===4&&n.status===200&&e(n.responseText)},n.send(),n}var Xs=class Mn extends oi{constructor(e,n,r,o,s,a){super(n,r,o||1,s||1),B(this,"_flagTexture",!1),B(this,"_flagMode",!1),B(this,"_texture",null),B(this,"_mode","fill"),this._renderer.type="image";for(let l in ed)Object.defineProperty(this,l,ed[l]);this.noStroke(),this.noFill(),e instanceof Oe?this.texture=e:typeof e=="string"&&(this.texture=new Oe(e)),typeof a=="string"&&(this.mode=a),this._update()}static fromObject(e){const n=new Mn().copy(e);return"id"in e&&(n.id=e.id),n}copy(e){super.copy.call(this,e);for(let n=0;n<Mn.Properties.length;n++){const r=Mn.Properties[n];r in e&&(this[r]=e[r])}return this}clone(e){const n=new Mn(this.texture,this.translation.x,this.translation.y,this.width,this.height);return e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return e.renderer.type="image",e.texture=this.texture.toObject(),e.mode=this.mode,e}dispose(){return super.dispose(),this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const e=this._texture;if(e&&(this._flagTexture&&(this.fill=e),e.loaded)){const n=e.image.width,r=e.image.height,o=this.width,s=this.height,a=o/n,l=s/r;switch(this._mode){case Mn.Modes.fill:{const c=Math.max(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="repeat";break}case Mn.Modes.fit:{const c=Math.min(a,l);e.scale=c,e.offset.x=0,e.offset.y=0,e.repeat="no-repeat";break}case Mn.Modes.crop:break;case Mn.Modes.tile:{e.offset.x=(n-o)/2,e.offset.y=(r-s)/2,e.repeat="repeat";break}case Mn.Modes.stretch:default:e.scale=new re(a,l),e.offset.x=0,e.offset.y=0,e.repeat="repeat"}}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagTexture=this._flagMode=!1,this}};B(Xs,"Modes",{fill:"fill",fit:"fit",crop:"crop",tile:"tile",stretch:"stretch"}),B(Xs,"Properties",["texture","mode"]);var Jc=Xs,ed={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},mode:{enumerable:!0,get:function(){return this._mode},set:function(t){this._mode=t,this._flagMode=!0}}},Ys=[],Us=Math.max,ky=Math.min,td=Math.abs,wo=Math.sin,xo=Math.cos,vy=Math.acos,ko=Math.sqrt,Pe={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},baselines:{top:"top",middle:"middle",bottom:"bottom",baseline:"alphabetic"},getRendererType:function(t){return t in Pe?t:"path"},group:{renderChild:function(t){const e=Pe.getRendererType(t._renderer.type);Pe[e].render.call(t,this.ctx,!0,this.clip)},render:function(t){if(!this._visible)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this._matrix.elements,n=this.parent;this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);const r=this._mask,o=vo(e),s=!o||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=t,s&&(t.save(),o||t.transform(e[0],e[3],e[1],e[4],e[2],e[5])),r){const a=Pe.getRendererType(r._renderer.type);Pe[a].render.call(r,t,!0)}if(this._opacity>0&&this._scale!==0)for(let a=0;a<this.children.length;a++){const l=this.children[a],c=Pe.getRendererType(l._renderer.type);Pe[c].render.call(l,t)}return s&&t.restore(),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(t,e,n){let r,o,s,a,l,c,d,u,h,f,m,p,g,y,b,_,k,x,C,N,w,S,v,$,E,A,R,F,H,Q,Z,O,P,V;if(V=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,H=this._mask,Q=this._clip,l=this._opacity*(V||1),c=this._visible,!e&&(!c||Q||l===0))return this;if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,a=this._fill,d=this._cap,u=this._join,h=this._miter,f=this._closed,m=this._renderer.vertices,p=m.length,g=p-1,Z=vo(r),P=this.dashes,Z||(t.save(),t.transform(r[0],r[3],r[1],r[4],r[2],r[5])),H){const K=Pe.getRendererType(H._renderer.type);Pe[K].render.call(H,t,!0)}if(a)if(typeof a=="string")t.fillStyle=a;else{const K=Pe.getRendererType(a._renderer.type);Pe[K].render.call(a,t,this),t.fillStyle=a._renderer.effect}if(o){if(typeof o=="string")t.strokeStyle=o;else{const K=Pe.getRendererType(o._renderer.type);Pe[K].render.call(o,t,this),t.strokeStyle=o._renderer.effect}s&&(t.lineWidth=wn(this)),h&&(t.miterLimit=h),u&&(t.lineJoin=u),!f&&d&&(t.lineCap=d)}typeof l=="number"&&(t.globalAlpha=l),P&&P.length>0&&(t.lineDashOffset=P.offset||0,t.setLineDash(P)),t.beginPath();let M,L,Y,U,G,q,W;for(let K=0;K<p;K++)switch(_=m[K],R=_.x,F=_.y,_.command){case ie.close:t.closePath();break;case ie.arc:M=_.rx,L=_.ry,Y=_.xAxisRotation,U=_.largeArcFlag,G=_.sweepFlag,y=f?rt(K-1,p):Us(K-1,0),b=m[y],q=b.x,W=b.y,Pe.renderSvgArcCommand(t,q,W,M,L,U,G,Y,R,F);break;case ie.curve:y=f?rt(K-1,p):Math.max(K-1,0),b=m[y],v=b.controls&&b.controls.right||re.zero,$=_.controls&&_.controls.left||re.zero,b._relative?(w=v.x+b.x,S=v.y+b.y):(w=v.x,S=v.y),_._relative?(C=$.x+_.x,N=$.y+_.y):(C=$.x,N=$.y),t.bezierCurveTo(w,S,C,N,R,F),K>=g&&f&&(k=x,E=_.controls&&_.controls.right||re.zero,A=k.controls&&k.controls.left||re.zero,_._relative?(w=E.x+_.x,S=E.y+_.y):(w=E.x,S=E.y),k._relative?(C=A.x+k.x,N=A.y+k.y):(C=A.x,N=A.y),R=k.x,F=k.y,t.bezierCurveTo(w,S,C,N,R,F));break;case ie.line:t.lineTo(R,F);break;case ie.move:x=_,t.moveTo(R,F);break}return f&&t.closePath(),!Q&&!n&&(Pe.isHidden.test(a)||(O=a._renderer&&a._renderer.offset,O&&(t.save(),t.translate(-a._renderer.offset.x,-a._renderer.offset.y),t.scale(a._renderer.scale.x,a._renderer.scale.y)),t.fill(),O&&t.restore()),Pe.isHidden.test(o)||(O=o._renderer&&o._renderer.offset,O&&(t.save(),t.translate(-o._renderer.offset.x,-o._renderer.offset.y),t.scale(o._renderer.scale.x,o._renderer.scale.y),t.lineWidth=s/o._renderer.scale.x),t.stroke(),O&&t.restore())),Z||t.restore(),Q&&!n&&t.clip(),P&&P.length>0&&t.setLineDash(Ys),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(t,e,n){let r,o,s,a,l,c,d,u,h,f,m,p,g,y,b,_;if(_=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,l=this._opacity*(_||1),c=this._visible,!e&&(!c||l===0))return this;if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,o=this._stroke,s=this._linewidth,a=this._fill,u=this._renderer.collection,h=u.length,g=vo(r),b=this.dashes,d=this._size,g||(t.save(),t.transform(r[0],r[3],r[1],r[4],r[2],r[5])),a)if(typeof a=="string")t.fillStyle=a;else{const C=Pe.getRendererType(a._renderer.type);Pe[C].render.call(a,t,this),t.fillStyle=a._renderer.effect}if(o){if(typeof o=="string")t.strokeStyle=o;else{const C=Pe.getRendererType(o._renderer.type);Pe[C].render.call(o,t,this),t.strokeStyle=o._renderer.effect}s&&(t.lineWidth=wn(this))}typeof l=="number"&&(t.globalAlpha=l),b&&b.length>0&&(t.lineDashOffset=b.offset||0,t.setLineDash(b)),t.beginPath();let k=d*.5,x;this._sizeAttenuation||(x=this.worldMatrix.elements,x=bi(x[0],x[3],x[1],x[4],x[2],x[5]),k/=Math.max(x.scaleX,x.scaleY));for(let C=0;C<h;C++)f=u[C],m=f.x,p=f.y,t.moveTo(m+k,p),t.arc(m,p,k,0,tt);return n||(Pe.isHidden.test(a)||(y=a._renderer&&a._renderer.offset,y&&(t.save(),t.translate(-a._renderer.offset.x,-a._renderer.offset.y),t.scale(a._renderer.scale.x,a._renderer.scale.y)),t.fill(),y&&t.restore()),Pe.isHidden.test(o)||(y=o._renderer&&o._renderer.offset,y&&(t.save(),t.translate(-o._renderer.offset.x,-o._renderer.offset.y),t.scale(o._renderer.scale.x,o._renderer.scale.y),t.lineWidth=s/o._renderer.scale.x),t.stroke(),y&&t.restore())),g||t.restore(),b&&b.length>0&&t.setLineDash(Ys),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(t,e,n){const r=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,o=this._opacity*r,s=this._visible,a=this._mask,l=this._clip;if(!e&&(!s||l||o===0))return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const c=this._matrix.elements,d=this._stroke,u=this._linewidth,h=this._fill,f=this._decoration,m=this._direction,p=vo(c),g=h._renderer&&h._renderer.offset&&d._renderer&&d._renderer.offset,y=this.dashes,b=Pe.alignments[this._alignment]||this._alignment,_=Pe.baselines[this._baseline]||this._baseline;let k,x,C,N,w,S,v,$,E,A,R;if(p||(t.save(),t.transform(c[0],c[3],c[1],c[4],c[2],c[5])),a){const F=Pe.getRendererType(a._renderer.type);Pe[F].render.call(a,t,!0)}if(g||(t.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),t.textAlign=b,t.textBaseline=_,t.direction=m,h)if(typeof h=="string")t.fillStyle=h;else{const F=Pe.getRendererType(h._renderer.type);Pe[F].render.call(h,t,this),t.fillStyle=h._renderer.effect}if(d){if(typeof d=="string")t.strokeStyle=d;else{const F=Pe.getRendererType(d._renderer.type);Pe[F].render.call(d,t,this),t.strokeStyle=d._renderer.effect}u&&(t.lineWidth=wn(this))}if(typeof o=="number"&&(t.globalAlpha=o),y&&y.length>0&&(t.lineDashOffset=y.offset||0,t.setLineDash(y)),!l&&!n&&(Pe.isHidden.test(h)||(h._renderer&&h._renderer.offset?(S=h._renderer.scale.x,v=h._renderer.scale.y,t.save(),t.translate(-h._renderer.offset.x,-h._renderer.offset.y),t.scale(S,v),k=this._size/h._renderer.scale.y,x=this._leading/h._renderer.scale.y,t.font=[this._style,this._weight,k+"px/",x+"px",this._family].join(" "),C=h._renderer.offset.x/h._renderer.scale.x,N=h._renderer.offset.y/h._renderer.scale.y,t.fillText(this.value,C,N),t.restore()):t.fillText(this.value,0,0)),Pe.isHidden.test(d)||(d._renderer&&d._renderer.offset?(S=d._renderer.scale.x,v=d._renderer.scale.y,t.save(),t.translate(-d._renderer.offset.x,-d._renderer.offset.y),t.scale(S,v),k=this._size/d._renderer.scale.y,x=this._leading/d._renderer.scale.y,t.font=[this._style,this._weight,k+"px/",x+"px",this._family].join(" "),C=d._renderer.offset.x/d._renderer.scale.x,N=d._renderer.offset.y/d._renderer.scale.y,w=u/d._renderer.scale.x,t.lineWidth=w,t.strokeText(this.value,C,N),t.restore()):t.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(f)){const F=t.measureText(this.value);let H=1;switch(f){case"underline":E=F.actualBoundingBoxDescent,R=F.actualBoundingBoxDescent;break;case"strikethrough":E=0,R=0,H=.5;break}switch(_){case"top":E+=this._size*H,R+=this._size*H;break;case"baseline":case"bottom":E-=this._size*H,R-=this._size*H;break}switch(b){case"left":case"start":$=0,A=F.width;break;case"right":case"end":$=-F.width,A=0;break;default:$=-F.width/2,A=F.width/2}t.lineWidth=Math.max(Math.floor(this._size/15),1),t.strokeStyle=t.fillStyle,t.beginPath(),t.moveTo($,E),t.lineTo(A,R),t.stroke()}return p||t.restore(),l&&!n&&t.clip(),y&&y.length>0&&t.setLineDash(Ys),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(e){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let n,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(n=e.getBoundingClientRect(!0),r=(r-.5)*n.width,o=(o-.5)*n.height,s=(s-.5)*n.width,a=(a-.5)*n.height),this._renderer.effect=t.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(t,e){if(e){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let n,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(n=e.getBoundingClientRect(!0),r=(r-.5)*n.width*.5,o=(o-.5)*n.height*.5,s=(s-.5)*n.width*.5,a=(a-.5)*n.height*.5,l*=Math.min(n.width,n.height)),this._renderer.effect=t.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(t){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=t.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof re||(this._renderer.offset=new re),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,e&&(this._renderer.offset.x+=e.width/2,this._renderer.offset.y+=e.height/2,this._scale instanceof re?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(this._renderer.scale instanceof re||(this._renderer.scale=new re),this._scale instanceof re?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},renderSvgArcCommand:function(t,e,n,r,o,s,a,l,c,d){l=l*Math.PI/180,r=td(r),o=td(o);const u=(e-c)/2,h=(n-d)/2,f=xo(l)*u+wo(l)*h,m=-wo(l)*u+xo(l)*h,p=f*f,g=m*m;let y=r*r,b=o*o;const _=p/y+g/b;if(_>1){const F=ko(_);r=F*r,o=F*o,y=r*r,b=o*o}const k=y*g+b*p,x=(y*b-k)/k;let C=ko(Us(0,x));s===a&&(C=-C);const N=C*r*m/o,w=-C*o*f/r,S=xo(l)*N-wo(l)*w+(e+c)/2,v=wo(l)*N+xo(l)*w+(n+d)/2,$=nd(1,0,(f-N)/r,(m-w)/o),E=nd((f-N)/r,(m-w)/o,(-f-N)/r,(-m-w)/o)%tt,A=$+E;Cy(t,S,v,r,o,$,A,a===0,l)}},vt=class extends ee{constructor(t){super();const e=t.smoothing!==!1;this.domElement=t.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=t.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=e),this.scene=new mt,this.scene.parent=this}setSize(t,e,n){return this.width=t,this.height=e,this.ratio=typeof n>"u"?vs(this.ctx):n,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,this.domElement.style&&oe.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this.trigger(ee.Types.resize,t,e,n)}render(){const t=this.ratio===1;return t||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Pe.group.render.call(this.scene,this.ctx),t||this.ctx.restore(),this}};B(vt,"Utils",Pe);function Cy(t,e,n,r,o,s,a,l,c){const d=a-s,u=Ui.Tolerance.epsilon,h=Math.abs(d)<u;let f=rt(d,tt);f<u&&(h?f=0:f=tt),l===!0&&!h&&(f===tt?f=-tt:f=f-tt);for(let m=0;m<xt.Resolution;m++){const p=m/(xt.Resolution-1),g=s+p*f;let y=e+r*Math.cos(g),b=n+o*Math.sin(g);if(c!==0){const _=Math.cos(c),k=Math.sin(c),x=y-e,C=b-n;y=x*_-C*k+e,b=x*k+C*_+n}t.lineTo(y,b)}}function nd(t,e,n,r){const o=t*n+e*r,s=ko(t*t+e*e)*ko(n*n+r*r);let a=vy(Us(-1,ky(1,o/s)));return t*r-e*n<0&&(a=-a),a}function vo(t){return t[0]===1&&t[3]===0&&t[1]===0&&t[4]===1&&t[2]===0&&t[5]===0}var ce={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},baselines:{top:"hanging",middle:"middle",bottom:"ideographic",baseline:"alphabetic"},createElement:function(t,e){const n=t,r=document.createElementNS(ce.ns,n);return n==="svg"&&(e=oe.defaults(e||{},{version:ce.version})),e&&Object.keys(e).length>0&&ce.setAttributes(r,e),r},setAttributes:function(t,e){const n=Object.keys(e);for(let r=0;r<n.length;r++)/href/.test(n[r])?t.setAttributeNS(ce.xlink,n[r],e[n[r]]):t.setAttribute(n[r],e[n[r]]);return this},removeAttributes:function(t,e){for(let n in e)t.removeAttribute(n);return this},toString:function(t,e){let n=t.length,r=n-1,o,s="";for(let a=0;a<n;a++){const l=t[a],c=e?rt(a-1,n):Math.max(a-1,0),d=t[c];let u,h,f,m,p,g,y,b,_,k,x,C,N,w,S,v=Ie(l.x),$=Ie(l.y);switch(l.command){case ie.close:u=ie.close;break;case ie.arc:x=l.rx,C=l.ry,N=l.xAxisRotation,w=l.largeArcFlag,S=l.sweepFlag,u=ie.arc+" "+x+" "+C+" "+N+" "+w+" "+S+" "+v+" "+$;break;case ie.curve:y=d.controls&&d.controls.right||re.zero,b=l.controls&&l.controls.left||re.zero,d.relative?(f=Ie(y.x+d.x),m=Ie(y.y+d.y)):(f=Ie(y.x),m=Ie(y.y)),l.relative?(p=Ie(b.x+l.x),g=Ie(b.y+l.y)):(p=Ie(b.x),g=Ie(b.y)),u=(a===0?ie.move:ie.curve)+" "+f+" "+m+" "+p+" "+g+" "+v+" "+$;break;case ie.move:o=l,u=ie.move+" "+v+" "+$;break;default:u=l.command+" "+v+" "+$}a>=r&&e&&(l.command===ie.curve&&(h=o,_=l.controls&&l.controls.right||l,k=h.controls&&h.controls.left||h,l.relative?(f=Ie(_.x+l.x),m=Ie(_.y+l.y)):(f=Ie(_.x),m=Ie(_.y)),h.relative?(p=Ie(k.x+h.x),g=Ie(k.y+h.y)):(p=Ie(k.x),g=Ie(k.y)),v=Ie(h.x),$=Ie(h.y),u+=" C "+f+" "+m+" "+p+" "+g+" "+v+" "+$),l.command!==ie.close&&(u+=" Z")),s+=u+" "}return s},pointsToString:function(t,e){let n="";const r=e*.5;for(let o=0;o<t.length;o++){const s=t[o].x,a=t[o].y-r;n+=ie.move+" "+s+" "+a+" ",n+="a "+r+" "+r+" 0 1 0 0.001 0 Z"}return n},getClip:function(t,e){let n=t._renderer.clip;return n||(n=t._renderer.clip=ce.createElement("clipPath",{"clip-rule":"nonzero"})),n.parentNode===null&&e.defs.appendChild(n),n},getRendererType:function(t){return t in ce?t:"path"},defs:{update:function(t){const{defs:e}=t;if(e._flagUpdate){const n=Array.prototype.slice.call(e.children,0);for(let r=0;r<n.length;r++){const o=n[r],s=o.id,a=`[fill="url(#${s})"],[stroke="url(#${s})"],[clip-path="url(#${s})"]`;t.querySelector(a)||e.removeChild(o)}e._flagUpdate=!1}}},group:{appendChild:function(t){const e=t._renderer.elem;if(!e)return;const n=e.nodeName;!n||/(radial|linear)gradient/i.test(n)||t._clip||this.elem.appendChild(e)},removeChild:function(t){const e=t._renderer.elem;!e||e.parentNode!=this.elem||!e.nodeName||t._clip||this.elem.removeChild(e)},orderChild:function(t){this.elem.appendChild(t._renderer.elem)},renderChild:function(t){const e=ce.getRendererType(t._renderer.type);ce[e].render.call(t,this)},render:function(t){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),this._renderer.elem||(this._renderer.elem=ce.createElement("g",{id:this.id}),t.appendChild(this._renderer.elem));const e=this._matrix.manual||this._flagMatrix,n={domElement:t,elem:this._renderer.elem};e&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let r=0;r<this.children.length;r++){const o=this.children[r],s=ce.getRendererType(o._renderer.type);ce[s].render.call(o,t)}if(this._flagId&&this._renderer.elem.setAttribute("id",this._id),this._flagOpacity&&this._renderer.elem.setAttribute("opacity",this._opacity),this._flagVisible&&this._renderer.elem.setAttribute("display",this._visible?"inline":"none"),this._flagClassName&&this._renderer.elem.setAttribute("class",this.classList.join(" ")),this._flagAdditions&&this.additions.forEach(ce.group.appendChild,n),this._flagSubtractions&&this.subtractions.forEach(ce.group.removeChild,n),this._flagOrder&&this.children.forEach(ce.group.orderChild,n),this._flagMask)if(this._mask){const r=ce.getRendererType(this._mask._renderer.type);ce[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.dataset&&Object.assign(this._renderer.elem.dataset,this.dataset),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(t){if(this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices){const r=ce.toString(this._renderer.vertices,this._closed);e.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ce.getRendererType(this._fill._renderer.type);ce[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ce.getRendererType(this._stroke._renderer.type);ce[r].render.call(this._stroke,t,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=wn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this._flagCap&&(e["stroke-linecap"]=this._cap),this._flagJoin&&(e["stroke-linejoin"]=this._join),this._flagMiter&&(e["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ce.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ce.createElement("path",e),t.appendChild(this._renderer.elem)),this._flagClip){const r=ce.getClip(this,t),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=ce.getRendererType(this._mask._renderer.type);ce[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(t){if(this._opacity===0&&!this._flagOpacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let r=this._size;if(!this._sizeAttenuation){const s=this.worldMatrix.elements,a=bi(s[0],s[3],s[1],s[4],s[2],s[5]);r/=Math.max(a.scaleX,a.scaleY)}const o=ce.pointsToString(this._renderer.collection,r);e.d=o}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ce.getRendererType(this._fill._renderer.type);ce[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ce.getRendererType(this._stroke._renderer.type);ce[r].render.call(this._stroke,t,!0)}return this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=wn(this)),this._flagOpacity&&(e["stroke-opacity"]=this._opacity,e["fill-opacity"]=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ce.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ce.createElement("path",e),t.appendChild(this._renderer.elem)),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},text:{render:function(t){this._update();const e={};if((this._matrix.manual||this._flagMatrix)&&(e.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(e.id=this._id),this._flagFamily&&(e["font-family"]=this._family),this._flagSize&&(e["font-size"]=this._size),this._flagLeading&&(e["line-height"]=this._leading),this._flagAlignment&&(e["text-anchor"]=ce.alignments[this._alignment]||this._alignment),this._flagBaseline&&(e["dominant-baseline"]=ce.baselines[this._baseline]||this._baseline),this._flagStyle&&(e["font-style"]=this._style),this._flagWeight&&(e["font-weight"]=this._weight),this._flagDecoration&&(e["text-decoration"]=this._decoration),this._flagDirection&&(e.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=ce.getRendererType(this._fill._renderer.type);ce[r].render.call(this._fill,t,!0)}if(this._flagFill&&(e.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=ce.getRendererType(this._stroke._renderer.type);ce[r].render.call(this._stroke,t,!0)}if(this._flagStroke&&(e.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(t.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(e["stroke-width"]=wn(this)),this._flagOpacity&&(e.opacity=this._opacity),this._flagClassName&&(e.class=this.classList.join(" ")),this._flagVisible&&(e.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(e["stroke-dasharray"]=this.dashes.join(" "),e["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?ce.setAttributes(this._renderer.elem,e):(e.id=this._id,this._renderer.elem=ce.createElement("text",e),t.appendChild(this._renderer.elem)),this._flagClip){const r=ce.getClip(this,t),o=this._renderer.elem;this._clip?(o.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(o)):(r.removeAttribute("id"),o.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(o))}if(this._flagMask)if(this._mask){const r=ce.getRendererType(this._mask._renderer.type);ce[r].render.call(this._mask,t),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(t,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const n={};if(this._flagId&&(n.id=this._id),this._flagEndPoints&&(n.x1=this.left._x,n.y1=this.left._y,n.x2=this.right._x,n.y2=this.right._y),this._flagSpread&&(n.spreadMethod=this._spread),this._flagUnits&&(n.gradientUnits=this._units),this._renderer.elem?ce.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=ce.createElement("linearGradient",n)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],a={};s._flagOffset&&(a.offset=100*s._offset+"%"),s._flagColor&&(a["stop-color"]=s._color),s._flagOpacity&&(a["stop-opacity"]=s._opacity),s._renderer.elem?ce.setAttributes(s._renderer.elem,a):s._renderer.elem=ce.createElement("stop",a),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"radial-gradient":{render:function(t,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const n={};if(this._flagId&&(n.id=this._id),this._flagCenter&&(n.cx=this.center._x,n.cy=this.center._y),this._flagFocal&&(n.fx=this.focal._x,n.fy=this.focal._y),this._flagRadius&&(n.r=this._radius),this._flagSpread&&(n.spreadMethod=this._spread),this._flagUnits&&(n.gradientUnits=this._units),this._renderer.elem?ce.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=ce.createElement("radialGradient",n)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._flagStops){const r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(let o=0;o<this.stops.length;o++){const s=this.stops[o],a={};s._flagOffset&&(a.offset=100*s._offset+"%"),s._flagColor&&(a["stop-color"]=s._color),s._flagOpacity&&(a["stop-opacity"]=s._opacity),s._renderer.elem?ce.setAttributes(s._renderer.elem,a):s._renderer.elem=ce.createElement("stop",a),r&&this._renderer.elem.appendChild(s._renderer.elem),s.flagReset()}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},texture:{render:function(t,e){oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),e||this._update();const n={},r={x:0,y:0},o=this.image;if(this._flagId&&(n.id=this._id),this._flagLoaded&&this.loaded)switch(o.nodeName.toLowerCase()){case"canvas":r.href=r["xlink:href"]=o.toDataURL("image/png");break;case"img":case"image":r.href=r["xlink:href"]=this.src;break}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(n.x=this._offset.x,n.y=this._offset.y,o&&(n.x-=o.width/2,n.y-=o.height/2,this._scale instanceof re?(n.x*=this._scale.x,n.y*=this._scale.y):(n.x*=this._scale,n.y*=this._scale)),n.x>0&&(n.x*=-1),n.y>0&&(n.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(n.width=0,n.height=0,o)){switch(n.width=o.width,n.height=o.height,this._repeat){case"no-repeat":n.width+=1,n.height+=1;break}this._scale instanceof re?(n.width*=this._scale.x,n.height*=this._scale.y):(n.width*=this._scale,n.height*=this._scale),/no-repeat/i.test(this._repeat)?r.preserveAspectRatio="xMidYMid":r.preserveAspectRatio="none",r.width=n.width,r.height=n.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?ce.setAttributes(this._renderer.image,r):this._renderer.image=ce.createElement("image",r)),this._renderer.elem?Object.keys(n).length!==0&&ce.setAttributes(this._renderer.elem,n):(n.id=this._id,n.patternUnits="userSpaceOnUse",this._renderer.elem=ce.createElement("pattern",n)),this._renderer.elem.parentNode===null&&t.defs.appendChild(this._renderer.elem),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},id=class extends ee{constructor(t){super(),this.domElement=t.domElement||ce.createElement("svg"),this.scene=new mt,this.scene.parent=this,this.defs=ce.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(t,e){return this.width=t,this.height=e,ce.setAttributes(this.domElement,{width:t,height:e}),this.trigger(ee.Types.resize,t,e)}render(){return ce.group.render.call(this.scene,this.domElement),ce.defs.update(this.domElement),this}};B(id,"Utils",ce);var nn={create:function(t,e,n){const r=t.createShader(t[n]);if(t.shaderSource(r,e),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const s=t.getShaderInfoLog(r);throw t.deleteShader(r),new Dt("unable to compile shader "+r+": "+s)}return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:`
|
|
41
41
|
precision mediump float;
|
|
42
42
|
attribute vec2 a_position;
|
|
43
43
|
|